The chart tiled rectangles and the globe draped quads, which was the last place the grid assumed its cells were rectangles of the picture. Both adapters now take the system's ring as it comes: the chart draws a plain polygon while the loop stays on the sheet, closes a pole cell's loop along the pole's own edge, and splits a ring that stayed continuous across the antimeridian into its two visible pieces with a small pure clipper; the globe drapes the ring directly -- unwrapped longitudes just carry past 180, because the trigonometry underneath is periodic -- and fills it as a fan from the cell's own centre, spokes densified by span so the sheet follows the curve instead of opening into almond-shaped gaps between them. For geohash nothing observable moves: the parity tour reads identical across all thirty-two steps, and the clipper is exercised only by its unit tests until a system with real geodesic cells arrives.
- commit
- 56800ad9766c00d03313103e32be1b3e737b20af
- parent
- d79bab2d3806183316fcddad04754a6ee016e5b9
- author
- Dami <dami.etoile@gmail.com>
| M | assets/ | 488 | +++++++++++++++--------------- |
| M | frontend/ | 36 | ++ |
| M | frontend/ | 186 | +++++++---- |
| M | frontend/ | 38 | ++- |
| M | frontend/ | 28 | ++- |
@@ -1,18 +1,18 @@
1-(()=>{var Kse=Object.create;var J4=Object.defineProperty;var Zse=Object.getOwnPropertyDescriptor;var Qse=Object.getOwnPropertyNames;var Jse=Object.getPrototypeOf,eoe=Object.prototype.hasOwnProperty;var toe=(i,e)=>()=>{try{return e||i((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},noe=(i,e)=>{for(var t in e)J4(i,t,{get:e[t],enumerable:!0})},ioe=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Qse(e))!eoe.call(i,r)&&r!==t&&J4(i,r,{get:()=>e[r],enumerable:!(n=Zse(e,r))||n.enumerable});return i};var roe=(i,e,t)=>(t=i!=null?Kse(Jse(i)):{},ioe(e||!i||!i.__esModule?J4(t,"default",{value:i,enumerable:!0}):t,i));var H$=toe((_v,q6)=>{(function(i,e){typeof _v=="object"&&typeof q6=="object"?q6.exports=e():typeof define=="function"&&define.amd?define("FrameTicker",[],e):typeof _v=="object"?_v.FrameTicker=e():i.FrameTicker=e()})(_v,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 oG=i=>new Promise(e=>setTimeout(e,i)),as=i=>document.querySelector(i);async function soe(){for(let i=0;i<300&&!(window.__atlasDebug&&!as("#map-loading")?.checkVisibility?.());i+=1)await oG(100)}async function ooe(){let i="";for(let e=0;e<100;e+=1){await oG(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 md(i,e={}){window.dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0,...e}))}function aoe(i,e={}){window.dispatchEvent(new KeyboardEvent("keyup",{key:i,bubbles:!0,cancelable:!0,...e}))}function loe(i){as("#map").dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0}))}function O0(i,e){i.value=e,i.dispatchEvent(new Event("change",{bubbles:!0}))}function eP(i,e){let t=as(i);t.value=e,t.dispatchEvent(new Event("input",{bubbles:!0}))}function tP(i,e=!1){let t=as("#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 coe(){let i=[],e=async p=>{await ooe(),i.push({name:p,snapshot:JSON.parse(window.render_game_to_text())})};await soe(),localStorage.clear();let t=as("#game-select"),n=t.options[0].value;O0(t,n),await e("initial"),eP("#pin-search","a"),await e("search-a");let r=as(".search-result");r&&(r.click(),await e("search-select-first"),as("#close-detail").click(),await e("detail-closed")),eP("#pin-search",""),await e("search-cleared");let s=as(".category-row input");s&&(s.click(),await e("category-hidden"),s.click(),await e("category-restored"));let o=as(".only-button");if(o){o.click(),await e("solo-first");let p=as("#solo-chip");p&&!p.hidden&&p.click(),await e("solo-cleared")}let a=as("#legend .layer-title");a&&(a.click(),await e("section-folded"),as("#expand-all").click(),await e("sections-unfolded")),as("#hide-all").click(),await e("all-hidden"),as("#show-all").click(),await e("all-shown");let l=as(".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")),md("g"),await e("grid-open"),eP("#grid-input","m"),await e("grid-descended"),md(" "),await e("subgrid-hidden"),md(" "),md("Escape"),await e("grid-ascended"),md("Escape"),await e("grid-closed"),md("z"),await e("labels-on"),aoe("z"),await e("labels-off"),md("b",{metaKey:!0}),await e("sidebar-collapsed"),md("b",{metaKey:!0}),await e("sidebar-restored"),as("#zoom-in").click(),await e("zoomed-in");let c=as("#overview-dock");c&&!as("#overview-shelf").hidden&&(c.click(),await e("overview-docked"),c.click(),await e("overview-undocked")),as("#zoom-out").click(),await e("zoomed-out"),loe("Escape"),await e("viewport-escape");let u=as("#variant-select");u.options.length>1&&(O0(u,u.options[1].value),await e("variant-second"),O0(u,u.options[0].value),await e("variant-first"));let f=as("#map-select");return f.options.length>1&&(O0(f,f.options[1].value),await e("map-second"),O0(f,f.options[0].value),await e("map-first")),t.options.length>1&&(O0(t,t.options[1].value),await e("game-second"),O0(t,n),await e("game-first")),localStorage.clear(),{viewport:[window.innerWidth,window.innerHeight],steps:i}}var nP=!1;async function aG(){if(!nP){nP=!0,tP("parity tour running\u2026");try{let i=await coe(),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}`);tP(`parity tour complete \u2713 ${i.steps.length} steps`),console.log("parity tour saved to",t)}catch(i){tP(`parity tour failed: ${i}`,!0),console.error("parity tour failed",i)}finally{nP=!1}}}window.__atlasTour=aG;window.addEventListener("keydown",i=>{i.key==="F9"&&aG()});var nn=i=>document.querySelector(i),ye={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 B0(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 U={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,gridSystem:"geohash",globeActive:!1,subgridVisible:!0,gridCell:"",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 U0=["#4fb3d5","#c9924b","#82b56a","#c96a6a","#9581cc","#4bc9a9","#d4b04a","#6a92c9","#b08a5a","#8fb3a2"],k0="0123456789bcdefghjkmnpqrstuvwxyz";var iP="atlas.session";var lG={light:"rgba(255, 255, 255, 0.96)",dark:"rgba(7, 9, 7, 0.98)"},Li={labelSizePx:11,neighborLabelSizePx:10,labelInsetPx:5,labelFont:"ui-monospace, SFMono-Regular, Menlo, monospace",prefixAlpha:.55,chip:"rgba(12, 15, 22, 0.76)",neighborChip:"rgba(8, 11, 18, 0.88)",lineWhite:"#ffffff",widths:{leaf:2.5,scope:2.5,scopeBare:1.8,child:1.4,neighbor:1},childLineAlpha:.82,neighborLineAlpha:.44,leafFillAlpha:.14,childFillAlpha:.055,neighborTextAlpha:.72,dimColor:"#050810",dimBase:.3,dimStep:.06,dimCap:.52};function hw(i){let e=[...fw()],t=!0;for(let n of i){let r=k0.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 sP(i,e){let t=[...fw()],[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+=k0[l]}return o}var rP={key:null,extent:null};function uoe(i){let t=`${fw().join(",")}|${i}`;return rP.key!==t&&(rP={key:t,extent:hw(i)}),rP.extent}var oP={slug:"geohash",name:"Geohash",appliesTo(){return!0},maxLevel(){return 3},inputLength(){return 3},level(i){return i.length},parent(i){return i.slice(0,-1)},children(i){return[...k0].map(e=>i+e)},childIndex(i){return Math.max(0,k0.indexOf(i[i.length-1]))},contains(i,e){let t=uoe(i),[n,r]=e;return n>=t[0]&&n<=t[2]&&r>=t[1]&&r<=t[3]},descendTarget(i,e){return sP(e,i.length+1)},bbox:hw,center(i){let e=hw(i);return[(e[0]+e[2])/2,(e[1]+e[3])/2]},ring(i){let[e,t,n,r]=hw(i);return[[e,t],[e,r],[n,r],[n,t],[e,t]]},poleContained(){return null},label(i){return{context:i.slice(0,-1),principal:i.slice(-1)}},colorKey(i){return Math.max(0,k0.indexOf(i[i.length-1]))%U0.length},normalizeInput(i){return[...i.toLocaleLowerCase()].filter(e=>k0.includes(e)).slice(0,3).join("")},parseInput(i){return i},locate(i){let e=sP(i,3);return e?{label:"Geohash",value:e}:null}};function cG(i,e=3){return sP(i,e)}function fw(){let i=U.variant?.surface;if(i)return[i.x,-(i.y+i.height),i.x+i.width,-i.y];let e=U.game?.tileGrid.size??0,t=U.variant?.bounds||{x:0,y:0,width:e,height:e};return[t.x,-(t.y+t.height),t.x+t.width,-t.y]}var hoe=[oP];function la(){return hoe.find(i=>i.slug===U.gridSystem)||oP}var ys={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function aP(i){let e=Pr();for(let t=0,n=i.length;t<n;++t)V0(e,i[t]);return e}function foe(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 dl(n,r,s,o,t)}function cg(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 pw(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i.slice()}function gd(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 wc(i,e){return xx(i,e[0],e[1])}function xu(i,e){return i[0]<=e[0]&&e[2]<=i[2]&&i[1]<=e[1]&&e[3]<=i[3]}function xx(i,e,t){return i[0]<=e&&e<=i[2]&&i[1]<=t&&t<=i[3]}function dw(i,e){let t=i[0],n=i[1],r=i[2],s=i[3],o=e[0],a=e[1],l=ys.UNKNOWN;return o<t?l=l|ys.LEFT:o>r&&(l=l|ys.RIGHT),a<n?l=l|ys.BELOW:a>s&&(l=l|ys.ABOVE),l===ys.UNKNOWN&&(l=ys.INTERSECTING),l}function Pr(){return[1/0,1/0,-1/0,-1/0]}function dl(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 G0(i){return dl(1/0,1/0,-1/0,-1/0,i)}function Aw(i,e){let t=i[0],n=i[1];return dl(t,n,t,n,e)}function ug(i,e,t,n,r){let s=G0(r);return lP(s,i,e,t,n)}function z0(i,e){return i[0]==e[0]&&i[2]==e[2]&&i[1]==e[1]&&i[3]==e[3]}function mw(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 V0(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 lP(i,e,t,n,r){for(;t<n;t+=r)doe(i,e[t],e[t+1]);return i}function doe(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 gw(i,e){let t;return t=e(hg(i)),t||(t=e(fg(i)),t)||(t=e(dg(i)),t)||(t=e(Wl(i)),t)?t:!1}function yx(i){let e=0;return vu(i)||(e=jn(i)*xr(i)),e}function hg(i){return[i[0],i[1]]}function fg(i){return[i[2],i[1]]}function za(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function uG(i,e){let t;if(e==="bottom-left")t=hg(i);else if(e==="bottom-right")t=fg(i);else if(e==="top-left")t=Wl(i);else if(e==="top-right")t=dg(i);else throw new Error("Invalid corner");return t}function vx(i,e,t,n,r){let[s,o,a,l,c,u,f,p]=cP(i,e,t,n);return dl(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 cP(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 xr(i){return i[3]-i[1]}function yu(i,e,t){let n=t||Pr();return yr(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]):G0(n),n}function uP(i,e){if(!yr(i,e))return[i.slice()];if(xu(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 Wl(i){return[i[0],i[3]]}function dg(i){return[i[2],i[3]]}function jn(i){return i[2]-i[0]}function yr(i,e){return i[0]<=e[2]&&i[2]>=e[0]&&i[1]<=e[3]&&i[3]>=e[1]}function vu(i){return i[2]<i[0]||i[3]<i[1]}function hG(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i}function fG(i,e,t){let n=!1,r=dw(i,e),s=dw(i,t);if(r===ys.INTERSECTING||s===ys.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&ys.ABOVE&&!(r&ys.ABOVE)&&(w=p-(x-c)/v,n=w>=o&&w<=l),!n&&s&ys.RIGHT&&!(r&ys.RIGHT)&&(S=x-(p-l)*v,n=S>=a&&S<=c),!n&&s&ys.BELOW&&!(r&ys.BELOW)&&(w=p-(x-a)/v,n=w>=o&&w<=l),!n&&s&ys.LEFT&&!(r&ys.LEFT)&&(S=x-(p-o)*v,n=S>=a&&S<=c)}return n}function dG(i,e,t,n){if(vu(i))return G0(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 foe(s,o,t)}function hP(i,e){let t=e.getExtent(),n=za(i);if(e.canWrapX()&&(n[0]<t[0]||n[0]>=t[2])){let r=jn(t),o=Math.floor((n[0]-t[0])/r)*r;i[0]-=o,i[2]-=o}return i}function _w(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]]];hP(i,e);let r=jn(n);if(jn(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 pG(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(...uP(t[o],e[n]));t=s}return t}var AG={info:1,warn:2,error:3,none:4},poe=AG.info;function xw(...i){poe>AG.warn||console.warn(...i)}function xi(i,e,t){return Math.min(Math.max(i,e),t)}function mG(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 Sc(i,e,t,n)}function Sc(i,e,t,n){let r=t-i,s=n-e;return r*r+s*s}function gG(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 yw(i){return i*180/Math.PI}function Tc(i){return i*Math.PI/180}function bu(i,e){let t=i%e;return t*e<0?t+e:t}function Do(i,e,t){return i+t*(e-i)}function q0(i,e){let t=Math.pow(10,e);return Math.round(i*t)/t}function bx(i,e){return Math.floor(q0(i,e))}function wx(i,e){return Math.ceil(q0(i,e))}function vw(i,e,t){if(i>=e&&i<t)return i;let n=t-e;return((i-e)%n+n)%n+e}function _G(i,e){return i[0]+=+e[0],i[1]+=+e[1],i}function H0(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 pg(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 xG(i,e){return i[0]*=e,i[1]*=e,i}function bw(i,e){if(e.canWrapX()){let t=jn(e.getExtent()),n=yG(i,e,t);n&&(i[0]-=n*t)}return i}function yG(i,e,t){let n=e.getExtent(),r=0;return e.canWrapX()&&(i[0]<n[0]||i[0]>n[2])&&(t=t||jn(n),r=Math.floor((i[0]-n[0])/t)),r}function vG(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(xi(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 tf={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var fP=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_||tf[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_}},_d=fP;var Sx=6378137,Ag=Math.PI*Sx,Aoe=[-Ag,-Ag,Ag,Ag],moe=[-180,-85,180,85],ww=Sx*Math.log(Math.tan(Math.PI/2)),xd=class extends _d{constructor(e){super({code:e,units:"m",extent:Aoe,global:!0,worldExtent:moe,getPointResolution:function(t,n){return t/Math.cosh(n[1]/Sx)}})}},dP=[new xd("EPSG:3857"),new xd("EPSG:102100"),new xd("EPSG:102113"),new xd("EPSG:900913"),new xd("http://www.opengis.net/def/crs/EPSG/0/3857"),new xd("http://www.opengis.net/gml/srs/epsg.xml#3857")];function bG(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]=Ag*i[s]/180;let o=Sx*Math.log(Math.tan(Math.PI*(+i[s+1]+90)/360));o>ww?o=ww:o<-ww&&(o=-ww),e[s+1]=o}return e}function wG(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]/Ag,e[s+1]=360*Math.atan(Math.exp(i[s+1]/Sx))/Math.PI-90;return e}var goe=6378137,SG=[-180,-90,180,90],_oe=Math.PI*goe/180,nf=class extends _d{constructor(e,t){super({code:e,units:"degrees",extent:SG,axisOrientation:t,global:!0,metersPerUnit:_oe,worldExtent:SG})}},pP=[new nf("CRS:84"),new nf("EPSG:4326","neu"),new nf("urn:ogc:def:crs:OGC:1.3:CRS84"),new nf("urn:ogc:def:crs:OGC:2:84"),new nf("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new nf("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new nf("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var AP={};function TG(i){return AP[i]||AP[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function EG(i,e){AP[i]=e}function wu(i){for(let e in i)delete i[e]}function Ec(i){let e;for(e in i)return!1;return!e}var mg={};function gg(i,e,t){let n=i.getCode(),r=e.getCode();n in mg||(mg[n]={}),mg[n][r]=t}function Sw(i,e){return i in mg&&e in mg[i]?mg[i][e]:null}var Tw=.9996,jl=.00669438,Mw=jl*jl,Cw=Mw*jl,W0=jl/(1-jl),MG=Math.sqrt(1-jl),_g=(1-MG)/(1+MG),IG=_g*_g,mP=IG*_g,gP=mP*_g,NG=gP*_g,LG=1-jl/4-3*Mw/64-5*Cw/256,xoe=3*jl/8+3*Mw/32+45*Cw/1024,yoe=15*Mw/256+45*Cw/1024,voe=35*Cw/3072,boe=3/2*_g-27/32*mP+269/512*NG,woe=21/16*IG-55/32*gP,Soe=151/96*mP-417/128*NG,Toe=1097/512*gP,Ew=6378137;function Eoe(i,e,t){let n=i-5e5,o=(t.north?e:e-1e7)/Tw/(Ew*LG),a=o+boe*Math.sin(2*o)+woe*Math.sin(4*o)+Soe*Math.sin(6*o)+Toe*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-jl*c,w=Math.sqrt(1-jl*c),S=Ew/w,T=(1-jl)/v,P=W0*u**2,R=P*P,C=n/(S*Tw),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*W0))+B/720*(61+90*p+298*P+45*x-252*W0-3*R),V=(C-D/6*(1+2*p+P)+N/120*(5-2*P+28*p-3*R+8*W0+24*x))/u;return V=vw(V+Tc(DG(t.number)),-Math.PI,Math.PI),[yw(V),yw(z)]}var CG=-80,RG=84,Moe=-180,Coe=180;function Roe(i,e,t){i=vw(i,Moe,Coe),e<CG?e=CG:e>RG&&(e=RG);let n=Tc(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,c=Tc(i),u=DG(t.number),f=Tc(u),p=Ew/Math.sqrt(1-jl*r**2),x=W0*s**2,v=s*vw(c-f,-Math.PI,Math.PI),w=v*v,S=w*v,T=S*v,P=T*v,R=P*v,C=Ew*(LG*n-xoe*Math.sin(2*n)+yoe*Math.sin(4*n)-voe*Math.sin(6*n)),L=Tw*p*(v+S/6*(1-a+x)+P/120*(5-18*a+l+72*x-58*W0))+5e5,D=Tw*(C+p*o*(w/2+T/24*(5-a+9*x+4*x**2)+R/720*(61-58*a+l+600*x-330*W0)));return t.north||(D+=1e7),[L,D]}function DG(i){return(i-1)*6-180+3}var Poe=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function FG(i){let e=0;for(let r of Poe){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 PG(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 FG(i)?new _d({code:i,units:"m"}):null}function BG(i){let e=FG(i.getCode());return e?{forward:PG(Roe,e),inverse:PG(Eoe,e)}:null}var Ioe=63710088e-1;function _P(i,e,t){t=t||Ioe;let n=Tc(i[1]),r=Tc(e[1]),s=(r-n)/2,o=Tc(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 Noe=[BG],Loe=[OG];var yP=!0;function kG(i){yP=!(i===void 0?!0:i)}function bP(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 vP(i){EG(i.getCode(),i),gg(i,i,bP)}function Doe(i){i.forEach(vP)}function vs(i){if(typeof i!="string")return i;let e=TG(i);if(e)return e;for(let t of Loe){let n=t(i);if(n)return n}return null}function wP(i,e,t,n){i=vs(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/tf[n])}}else{let o=i.getUnits();if(o=="degrees"&&!n||n=="degrees")r=e;else{let a=j0(i,vs("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=_P(c.slice(0,2),c.slice(2,4)),f=_P(c.slice(4,6),c.slice(6,8));r=(u+f)/2}let l=n?tf[n]:i.getMetersPerUnit();l!==void 0&&(r/=l)}}return r}function UG(i){Doe(i),i.forEach(function(e){i.forEach(function(t){e!==t&&gg(e,t,bP)})})}function Foe(i,e,t,n){i.forEach(function(r){e.forEach(function(s){gg(r,s,t),gg(s,r,n)})})}function Rw(i,e){return i?typeof i=="string"?vs(i):i:vs(e)}function GG(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 xg(i,e){if(i===e)return!0;let t=i.getUnits()===e.getUnits();return(i.getCode()===e.getCode()||j0(i,e)===bP)&&t}function j0(i,e){let t=i.getCode(),n=e.getCode(),r=Sw(t,n);if(r)return r;let s=null,o=null;for(let l of Noe)s||(s=l(i)),o||(o=l(e));if(!s&&!o)return null;let a="EPSG:4326";if(o)if(s)r=xP(s.inverse,o.forward);else{let l=Sw(t,a);l&&(r=xP(l,o.forward))}else{let l=Sw(a,n);l&&(r=xP(s.inverse,l))}return r&&(vP(i),vP(e),gg(i,e,r)),r}function xP(i,e){return function(t,n,r,s){return n=i(t,n,r,s),e(n,n,r,s)}}function X0(i,e){let t=vs(i),n=vs(e);return j0(t,n)}function yg(i,e,t){let n=X0(e,t);if(!n){let r=vs(e).getCode(),s=vs(t).getCode();throw new Error(`No transform available between ${r} and ${s}`)}return n(i,void 0,i.length)}function zG(i,e,t,n){let r=X0(e,t);return dG(i,r,void 0,n)}var Mc=null;function $0(){return Mc}function Tx(i,e){return Mc?yg(i,e,Mc):i}function Cc(i,e){return Mc?yg(i,Mc,e):(yP&&!H0(i,[0,0])&&i[0]>=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&(yP=!1,xw("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i)}function yd(i,e){return Mc?zG(i,e,Mc):i}function Rc(i,e){return Mc?zG(i,Mc,e):i}function VG(i,e){if(!Mc)return i;let t=vs(e).getMetersPerUnit(),n=Mc.getMetersPerUnit();return t&&n?i*t/n:i}function Ooe(){UG(dP),UG(pP),Foe(pP,dP,bG,wG)}Ooe();function SP(i){return i[0]>0&&i[1]>0}function qG(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 jr(i,e){return Array.isArray(i)?i:(e===void 0?e=[i,i]:(e[0]=i,e[1]=i),e)}var Pw=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 Y0(i,e,t,n,r){return r!==void 0?(r.minX=i,r.maxX=e,r.minY=t,r.maxY=n,r):new Pw(i,e,t,n)}var Iw=Pw;function HG(i,e,t){let n,r;t=t||Va;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 Va(i,e){return i>e?1:i<e?-1:0}function WG(i,e){return i<e?1:i>e?-1:0}function vg(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 jG(i,e,t){for(;e<t;){let n=i[e];i[e]=i[t],i[t]=n,++e,--t}}function Pc(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 Fo(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||Va;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 Vn(i,e){if(!i)throw new Error(e)}function $G(i,e,t,n,r){return!gw(r,function(o){return!vd(i,e,t,n,o[0],o[1])})}function vd(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 Ex(i,e,t,n,r,s){if(t.length===0||!vd(i,e,t[0],n,r,s))return!1;for(let o=1,a=t.length;o<a;++o)if(vd(i,t[o-1],t[o],n,r,s))return!1;return!0}function YG(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(Ex(i,e,l,n,r,s))return!0;e=l[l.length-1]}return!1}function KG(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 Nw(i,e,t,n,r,s){return s=s??lP(Pr(),i,e,t,n),yr(r,s)?s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:KG(i,e,t,n,function(o,a){return fG(r,o,a)}):!1}function TP(i,e,t,n,r){return!!(Nw(i,e,t,n,r)||vd(i,e,t,n,r[0],r[1])||vd(i,e,t,n,r[0],r[3])||vd(i,e,t,n,r[2],r[1])||vd(i,e,t,n,r[2],r[3]))}function EP(i,e,t,n,r){if(!TP(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)&&!Nw(i,t[s-1],t[s],n,r))return!1;return!0}function ZG(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 Kn(){throw new Error("Unimplemented abstract method.")}var Boe=0;function Ln(i){return i.ol_uid||(i.ol_uid=String(++Boe))}function bg(i,e,t,n){return n!==void 0?(n[0]=i,n[1]=e,n[2]=t,n):[i,e,t]}function Uoe(i,e,t){return i+"/"+e+"/"+t}function wg(i,e,t,n,r){return`${Ln(i)},${e},${Uoe(t,n,r)}`}function QG(i){return koe(i[0],i[1],i[2])}function koe(i,e,t){return(e<<i)+t}function JG(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 Sg=[0,0,0],bd=5,MP=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,Vn(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,Vn(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_=Wl(s)),Vn(!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,Vn(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,Vn(!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 Iw(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=Y0(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 Y0(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 Y0(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 Y0(c,c,u,u,n);let f=Math.floor(l*(s+1))-1,p=Math.floor(l*(o+1))-1;return Y0(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,Sg);let r=Sg[1],s=Sg[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,Sg);let o=Sg[1],a=Sg[2];return Y0(r,o,s,a,n)}getTileCoordCenter(e){let t=this.getOrigin(e[0]),n=this.getResolution(e[0]),r=jr(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=jr(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 dl(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=jr(this.getTileSize(o),this.tmpSize_),u=a*(e-l[0])/n/c[0],f=a*(l[1]-t)/n/c[1];return r?(u=wx(u,bd)-1,f=wx(f,bd)-1):(u=bx(u,bd),f=bx(f,bd)),bg(o,u,f,s)}getTileCoordForXYAndZ_(e,t,n,r,s){let o=this.getOrigin(n),a=this.getResolution(n),l=jr(this.getTileSize(n),this.tmpSize_),c=(e-o[0])/a/l[0],u=(o[1]-t)/a/l[1];return r?(c=wx(c,bd)-1,u=wx(u,bd)-1):(c=bx(c,bd),u=bx(u,bd)),bg(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=vg(this.resolutions_,e,t||0);return xi(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return TP(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}},Mx=MP;function Lw(i){let e=i.getDefaultTileGrid();return e||(e=zoe(i),i.setDefaultTileGrid(e)),e}function tz(i,e,t){let n=e[0],r=i.getTileCoordCenter(e),s=Dw(t);if(!wc(s,r)){let o=jn(s),a=Math.ceil((s[0]-r[0])/o);return r[0]+=o*a,i.getTileCoordForCoordAndZ(r,n)}return e}function Goe(i,e,t,n){n=n!==void 0?n:"top-left";let r=iz(i,e,t);return new Mx({extent:i,origin:uG(i,n),resolutions:r,tileSize:t})}function nz(i){let e=i||{},t=e.extent||vs("EPSG:3857").getExtent(),n={extent:t,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:iz(t,e.maxZoom,e.tileSize,e.maxResolution)};return new Mx(n)}function iz(i,e,t,n){e=e!==void 0?e:42,t=jr(t!==void 0?t:256);let r=xr(i),s=jn(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 zoe(i,e,t,n){let r=Dw(i);return Goe(r,e,t,n)}function Dw(i){i=vs(i);let e=i.getExtent();if(!e){let t=180*tf.degrees/i.getMetersPerUnit();e=dl(-t,-t,t,t)}return e}var Mn={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function kn(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 Tg(i,e,t,n){return kn(i,e,t,n,!0)}function ri(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),wu(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 CP=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},wd=CP;function rf(){return!0}function sf(){return!1}function of(){}function Fw(i){let e,t,n;return function(){let r=Array.prototype.slice.call(arguments);return(!t||this!==n||!Fo(r,t))&&(n=this,t=r,e=i.apply(this,arguments)),e}}function rz(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 Ks=RP;var PP=class extends wd{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 Ks(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,of);delete o[n]}return l}disposeInternal(){this.listeners_&&wu(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]=of,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}},Sd=PP;var K0=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",Voe=K0.includes("safari")&&!K0.includes("chrom"),T5e=Voe&&(K0.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(K0)),sz=K0.includes("webkit")&&!K0.includes("edge"),IP=K0.includes("macintosh"),oz=typeof devicePixelRatio<"u"?devicePixelRatio:1,Us=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,NP=typeof Image<"u"&&Image.prototype.decode;var Ow=(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 az(i,e,t){let n=i,r=!0,s=!1,o=!1,a=[Tg(n,Jt.LOAD,function(){o=!0,s||e()})];return n.src&&NP?(s=!0,n.decode().then(function(){r&&e()}).catch(function(l){r&&(o?e():t())})):a.push(Tg(n,Jt.ERROR,t)),function(){r=!1,a.forEach(ri)}}function qoe(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 lz(i,e){return e&&(i.src=e),i.src&&NP?new Promise((t,n)=>i.decode().then(()=>t(i)).catch(r=>i.complete&&i.width?t(i):n(r))):qoe(i)}var rn={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function LP(i){return Math.pow(i,3)}function Xl(i){return 1-LP(1-i)}function cz(i){return 3*i*i-2*i*i*i}function uz(i){return i}var DP=class extends Sd{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(){Kn()}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()}},Eg=DP;function Ti(i,e,t,n){let r;return t&&t.length?r=t.shift():Us?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 FP;function Cx(){return FP||(FP=Ti(1,1)),FP}function Z0(i){let e=i.canvas;e.width=1,e.height=1,i.clearRect(0,0,1,1)}function OP(i,e){let t=e.parentNode;t&&t.replaceChild(i,e)}function hz(i){for(;i.lastChild;)i.lastChild.remove()}function fz(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 pl(i){return typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas}var BP=class extends Eg{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_,Us?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_=Hoe(),this.changed()}handleImageLoad_(){if(Us)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_=az(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 Hoe(){let i=Ti(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}var Uw=BP;var UP,Q0=[];function dz(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 kP(i,e){return Math.abs(i[e*4]-210)>2||Math.abs(i[e*4+3]-.75*255)>2}function Woe(){if(UP===void 0){let i=Ti(6,6,Q0);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",dz(i,4,5,4,0),dz(i,4,5,0,5);let e=i.getImageData(0,0,3,3).data;UP=kP(e,0)||kP(e,4)||kP(e,8),Z0(i),Q0.push(i.canvas)}return UP}function pz(i,e,t,n){let r=yg(t,e,i),s=wP(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||wc(l,r)){let c=wP(i,s,r)/s;isFinite(c)&&c>0&&(s/=c)}return s}function Az(i,e,t,n){let r=za(t),s=pz(i,e,r,n);return(!isFinite(s)||s<=0)&&gw(t,function(o){return s=pz(i,e,o,n),isFinite(s)&&s>0}),s}function mz(i,e,t,n,r,s,o,a,l,c,u,f,p,x){let v=Ti(Math.round(t*i),Math.round(t*e),Q0);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=Pr();l.forEach(function(L,D,F){mw(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=Ti(Math.round(jn(S)*P),Math.round(xr(S)*P),Q0),f||(T.imageSmoothingEnabled=!1),r&&x){let L=(r[0]-S[0])*P,D=-(r[3]-S[3])*P,F=jn(r)*P,N=xr(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=jn(L.clipExtent)*P,j=xr(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=jn(L.extent)*P,V=xr(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=Wl(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),be=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,be-ee]],mt=gG(Ue);if(!mt)return;if(v.save(),v.beginPath(),Woe()||!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,be)}else v.moveTo(ae,ce),v.lineTo(Z,ee),v.lineTo(de,be);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(jn($e)/Me.width,-xr($e)/Me.height)}v.drawImage(Me,0,0),v.restore()}),T&&(Z0(T),Q0.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 joe=[1,0,0,1,0,0],tNe=new Array(6);function Zs(){return joe.slice(0)}function gz(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 Ir(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 uo(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 Gw(i,e){let t=Xoe(e);Vn(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 Xoe(i){return i[0]*i[3]-i[1]*i[2]}var $oe=[1e5,1e5,1e5,1e5,2,2];function _z(i){return"matrix("+i.join(", ")+")"}function kw(i){return i.substring(7,i.length-1).split(",").map(parseFloat)}function xz(i,e){let t=kw(i),n=kw(e);for(let r=0;r<6;++r)if(Math.round((t[r]-n[r])*$oe[r])!==0)return!1;return!0}var Yoe=10,yz=.25,GP=class{constructor(e,t,n,r,s,o,a){this.sourceProj_=e,this.targetProj_=t;let l={},c=a?GG(R=>Ir(a,yg(R,this.targetProj_,this.sourceProj_))):X0(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()&&jn(r)>=jn(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?jn(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?jn(this.targetProj_.getExtent()):null;let u=Wl(n),f=dg(n),p=fg(n),x=hg(n),v=this.transformInv_(u),w=this.transformInv_(f),S=this.transformInv_(p),T=this.transformInv_(x),P=Yoe+(o?Math.max(0,Math.ceil(Math.log2(yx(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=aP([s,o,a,l]),f=this.sourceWorldWidth_?jn(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=aP([e,t,n,r]);v=jn(S)/this.targetWorldWidth_>yz||v}!x&&this.sourceProj_.isGlobal()&&f&&(v=f>yz||v)}if(!v&&this.maxSourceExtent_&&isFinite(u[0])&&isFinite(u[1])&&isFinite(u[2])&&isFinite(u[3])&&!yr(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=(bu(s[0],p)+bu(a[0],p))/2-bu(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=Pr();return this.triangles_.forEach(function(t,n,r){let s=t.source;V0(e,s[0]),V0(e,s[1]),V0(e,s[2])}),e}getTriangles(){return this.triangles_}},vz=GP;var zP=class extends Eg{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?yu(x,v):x;if(yx(S)===0){this.state=rn.EMPTY;return}let T=e.getExtent();T&&(w?w=yu(w,T):w=T);let P=r.getResolution(this.wrappedTileCoord_[0]),R=Az(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 vz(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]=xi(L[1],w[1],w[3]),L[3]=xi(L[3],w[1],w[3])):L=yu(L,w)),!yx(L))this.state=rn.EMPTY;else{let D=0,F=0;e.canWrapX()&&(D=jn(T),F=Math.floor((L[0]-T[0])/D)),_w(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_=mz(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=kn(t,Jt.CHANGE,s=>{let o=t.getState();(o==rn.LOADED||o==rn.ERROR||o==rn.EMPTY)&&(ri(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(ri),this.sourcesListenerKeys_=null}release(){this.canvas_&&(Z0(this.canvas_.getContext("2d")),Q0.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}},zw=zP;var Koe=/\{z\}/g,Zoe=/\{x\}/g,Qoe=/\{y\}/g,Joe=/\{-y\}/g;function bz(i,e,t,n,r){return i.replace(Koe,e.toString()).replace(Zoe,t.toString()).replace(Qoe,n.toString()).replace(Joe,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 wz(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 eae(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 bz(i,o,t[1],t[2],s)})}function Sz(i,e){let t=i.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=eae(i[r],e);return tae(n)}function tae(i){return i.length===1?i[0]:(function(e,t,n){if(!e)return;let r=QG(e),s=bu(r,i.length);return i[s](e,t,n)})}var Ic={PROPERTYCHANGE:"propertychange"};var Mg=class extends Sd{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]=kn(this,e[s],t);return r}return kn(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]=Tg(this,e[s],t)}else n=Tg(this,e,t);return t.ol_key=n,n}unInternal(e,t){let n=t.ol_key;if(n)nae(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)}};Mg.prototype.on;Mg.prototype.once;Mg.prototype.un;function nae(i){if(Array.isArray(i))for(let e=0,t=i.length;e<t;++e)ri(i[e]);else ri(i)}var Vw=Mg;var qw=class extends Ks{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}},VP=class extends Vw{constructor(e){super(),this.on,this.once,this.un,Ln(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 qw(n,e,t)),n=Ic.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new qw(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],Ec(this.values_)&&(this.values_=null),t||this.notify(e,n)}}},bs=VP;var qP=class extends bs{constructor(e){super(),this.projection=vs(e.projection),this.attributions_=Tz(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_=Tz(e),this.changed()}setState(e){this.state_=e,this.changed()}};function Tz(i){return i?typeof i=="function"?i:(Array.isArray(i)||(i=[i]),e=>i):null}var Hw=qP;var HP=class extends Hw{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&&jr(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),t),this.tmpSize=[0,0],this.key_=e.key||Ln(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 Kn()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:Lw(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,n){let r=this.getTileGridForProjection(n),s=this.getTilePixelRatio(t),o=jr(r.getTileSize(e),this.tmpSize);return s==1?o:qG(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=tz(r,e,n)),JG(e,r)?e:null}clear(){}refresh(){this.clear(),super.refresh()}},Ww=class extends Ks{constructor(e,t){super(e),this.tile=t}},Ez=HP;var jw={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};var WP=class i extends Ez{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=Ln(t),r=t.getState(),s;r==rn.LOADING?(this.tileLoadingKeys_[n]=!0,s=jw.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],s=r==rn.ERROR?jw.TILELOADERROR:r==rn.LOADED?jw.TILELOADEND:void 0),s!=null&&this.dispatchEvent(new Ww(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=wz(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;let t=e.join(`2-`);this.generateTileUrlFunction_?this.setTileUrlFunction(Sz(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,n){}},Mz=WP;var jP=class extends Mz{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:iae,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:Uw,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!xg(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||xg(t,e)))return this.tileGrid;let n=Ln(e);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=Lw(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||xg(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 zw(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=wg(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=vs(e);if(n){let r=Ln(n);r in this.tileGridForProjection||(this.tileGridForProjection[r]=t)}}};function iae(i,e){if(Us){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 Cz=jP;var XP=class extends Cz{constructor(e){e=e||{};let t=e.projection!==void 0?e.projection:"EPSG:3857",n=e.tileGrid!==void 0?e.tileGrid:nz({extent:Dw(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_}},Rz=XP;function Nc(){if(!U.map||!U.variant||U.settling)return;let i=U.engine?.getView();try{let e=Pz();e.last=U.game.slug,e.games[U.game.slug]={game:U.game.slug,map:U.map.slug,variant:U.map.variants.indexOf(U.variant),center:i?.getCenter(),zoom:i?.getZoom(),hidden:[...U.hiddenCategories],collapsed:[...U.collapsedSections],overviewDocked:U.overviewDocked,dockFolded:U.dockFolded,dockDismissed:U.dockDismissed},localStorage.setItem(iP,JSON.stringify(e))}catch{}}function Pz(){try{let i=JSON.parse(localStorage.getItem(iP)||"null");if(i&&i.games)return i}catch{}return{last:"",games:{}}}function Cg(i){let e=Pz(),t=i||e.last,n=t&&e.games[t];return n&&n.game&&n.map?n:null}function Rg(){let[i,e]=decodeURIComponent(location.hash.replace(/^#\/?/,"")).split("/").map(t=>t.trim());return{game:i,map:e}}function Iz(){if(!U.game||!U.map)return;let i=`#${U.game.slug}/${U.map.slug}`;location.hash!==i&&history.replaceState(null,"",i)}var $P=class i extends bs{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_&&(ri(this.geometryChangeKey_),this.geometryChangeKey_=null);let e=this.getGeometry();e&&(this.geometryChangeKey_=kn(e,Jt.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?rae(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 rae(i){if(typeof i=="function")return i;let e;return Array.isArray(i)?e=i:(Vn(typeof i.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[i]),function(){return e}}var Td=$P;function qa(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 Xw(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 Lz(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 Dz=Zs(),sae=[NaN,NaN],YP=class extends bs{constructor(){super(),this.extent_=Pr(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=Fw((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 Kn()}closestPointXY(e,t,n,r){return Kn()}containsXY(e,t){return this.closestPointXY(e,t,sae,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 Kn()}getExtent(e){if(this.extentRevision_!=this.getRevision()){let t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&G0(t),this.extentRevision_=this.getRevision()}return hG(this.extent_,e)}rotate(e,t){Kn()}scale(e,t,n){Kn()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return Kn()}getType(){return Kn()}applyTransform(e){Kn()}intersectsExtent(e){return Kn()}translate(e,t){Kn()}transform(e,t){let n=vs(e),r=n.getUnits()=="tile-pixels"?function(s,o,a){let l=n.getExtent(),c=n.getWorldExtent(),u=xr(c)/xr(l);uo(Dz,c[0],c[3],u,-u,0,0,0);let f=qa(s,0,s.length,a,Dz,o),p=X0(n,t);return p?p(f,f,a):f}:X0(n,t);return this.applyTransform(r),this}},Fz=YP;var KP=class extends Fz{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(e){return ug(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return Kn()}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){Kn()}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=oae(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();Xw(n,0,n.length,r,e,t,n),this.changed()}}scale(e,t,n){t===void 0&&(t=e),n||(n=za(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();Lz(n,0,n.length,r,e,t,n),this.changed()}}};function oae(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 Bz(i,e,t){let n=i.getFlatCoordinates();if(!n)return null;let r=i.getStride();return qa(n,0,n.length,r,e,t)}var Su=KP;function Uz(i,e,t,n){for(let r=0,s=t.length;r<s;++r)i[e++]=t[r];return e}function Rx(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 ZP(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=Rx(i,e,t[o],n);r[s++]=l,e=l}return r.length=s,r}function kz(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=ZP(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 QP=class i extends Su{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=Sc(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 Aw(this.flatCoordinates,e)}getType(){return"Point"}intersectsExtent(e){return xx(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()}},Lc=QP;function J0(){return lG[U.map?.iconOutset==="dark"?"dark":"light"]}function aae(i){let e=U.map?.iconOutset==="dark",t=cae(i);return(e?t>.3:t<.88)?i:lae(i,e?.74:.42)}function lae(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 cae(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 $w(i){let e=Math.abs(Number(i)||0);return U0[(Math.imul(e,2654435761)>>>0)%U0.length]}function af(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 Pg(i,e){i.style.setProperty("--pin-color",eA(e))}function eA(i){return aae(i.color||$w(i.id))}function Ig(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("${JP(e.iconAsset)}")`),i.classList.add("has-source-icon")}function JP(i){let e=i.split("/").map(t=>encodeURIComponent(t)).join("/");return`${U.game.base}/icons/${e}`}function Dc(i){return i.split(/\s+/).slice(0,2).map(e=>e[0]||"").join("")}function Gz(i){return Math.imul(Number(i)||0,2654435761)>>>0}function zz(i){return String(i||"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`>#]/g,"").replace(/\r/g,"").replace(/\n{3,}/g,`3-4-`).trim()}function Fc(i){return new Intl.NumberFormat().format(i)}function ls(i,e,t){return Math.min(t,Math.max(e,i))}function Yw(i){return i instanceof HTMLElement&&(i.matches("input, textarea, select")||i.isContentEditable)}var uae=100;function Ed(){if(!ye.searchResults)return;let i=U.pins.filter(n=>!n.filteredHidden).sort((n,r)=>n.location.title.localeCompare(r.location.title)),e=i.slice(0,uae),t=document.createDocumentFragment();if(!e.length){let n=document.createElement("p");n.className="search-empty",n.textContent=U.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",U.selectedPin===n&&r.classList.add("is-selected"),r.dataset.location=String(n.location.id),Pg(r,n.category);let s=document.createElement("span");s.className="result-dot",Ig(s,n.category,Dc(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 ${Fc(i.length)} \u2014 search or filter to narrow the list.`,t.append(n)}ye.searchResults.replaceChildren(t),fae(i.length),hae()}var Vz=28;function hae(){let i=U.selectedPin?.location.title||"",e=i.length>Vz?`${i.slice(0,Vz-1).trimEnd()}\u2026`:i;ye.dockRailName.textContent=e?` \xB7 ${e}`:"",ye.dockRailName.hidden=!e}function fae(i){ye.dockCount.textContent=`${Fc(i)} ${i===1?"location":"locations"}`,U.search?(ye.dockFlag.textContent=`\u201C${U.search}\u201D`,ye.dockFlag.hidden=!1):U.hiddenCategories.size>0?(ye.dockFlag.textContent="filtered",ye.dockFlag.hidden=!1):ye.dockFlag.hidden=!0}function Kw(){!U.dockFolded||U.dockDismissed||Zw(!1)}function eI(i){U.dockDismissed=i,Zw(i)}function Zw(i,e=!0){U.dockFolded=i,ye.dock.classList.toggle("is-folded",i),ye.dockFold.setAttribute("aria-expanded",String(!i));let t=i?"Bring the panel back (\u2318\u2325B)":"Put the panel away (\u2318\u2325B)";ye.dockFold.setAttribute("aria-label",t),ye.dockFold.setAttribute("title",t),e&&Nc()}function tI(i){U.hiddenCategories.delete(i.category.id),Ix(),$l(),Md(),Px(i,!0)}function Px(i,e=!1){U.selectedPin=i,document.dispatchEvent(new Event("atlas:selection")),Tu(),U.layers.pins.changed(),U.layers.pinLabels.changed(),U.layers.text.changed(),U.layers.textDetail.changed(),U.layers.priority.changed(),ye.detailTitle.textContent=i.location.title,ye.detailCategory.textContent=`${i.group.title} / ${i.category.title}`,ye.detailDescription.textContent="",ye.detailLinks.hidden=!0,pae(i),ye.detailID.textContent=String(i.location.id),ye.detailCoordinates.textContent=`${i.location.lat.toFixed(6)}, ${i.location.lng.toFixed(6)}`;let t=cG(i.coordinate);ye.detailCell.textContent=t,ye.detailCellField.hidden=!t;let n=dae(i);if(ye.detailSource.textContent=n,ye.detailSourceField.hidden=!n,Pg(ye.detailDot,i.category),Ig(ye.detailDot,i.category,Dc(i.category.title)),ye.detail.hidden=!1,Kw(),Ed(),e){let r=U.engine.getView();r.animate({center:i.coordinate,zoom:Math.min(Eu(U.variant),Math.max(r.getZoom()||0,4)),duration:220})}}function dae(i){let e=U.map?.merged;if(!e?.length)return"";let t=e.find(n=>n.origin)?.source||"";if(U.pinSourceIndex?.map!==U.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)}}U.pinSourceIndex={map:U.map,byID:n}}for(let n of e)if(!n.origin&&i.group.title===n.source)return n.source;return U.pinSourceIndex.byID.get(i.location.id)||t}async function pae(i){let e=await qz();if(U.selectedPin!==i)return;let t=e[String(i.location.id)]||{};i.location.description=t.d||"",i.location.links=t.l||[],ye.detailDescription.textContent=zz(t.d)||"No description is included in the archive.",Aae(i)}function Aae(i){let e=(i.location.links||[]).filter(n=>U.pinByID.has(n.locationId));if(ye.detailLinks.hidden=e.length===0,!e.length){ye.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)}ye.detailLinks.replaceChildren(t)}function Oc(){let i=U.selectedPin!==null;U.selectedPin=null,document.dispatchEvent(new Event("atlas:selection")),U.sources&&(Tu(),U.layers.pins.changed(),U.layers.pinLabels.changed(),U.layers.text.changed(),U.layers.textDetail.changed(),U.layers.priority.changed()),ye.detail.hidden=!0,i&&Ed()}function nI(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 iI(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=nI(i,e,a,n),e=a}return r}function Hz(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=iI(i,e,a,n),e=a[a.length-1]}return r}function Wz(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]=Do(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 rI(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=Sc(s,o,a,l);c>r&&(r=c),s=a,o=l}return r}function sI(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=rI(i,e,a,n,r),e=a}return r}function jz(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=sI(i,e,a,n,r),e=a[a.length-1]}return r}function oI(i,e,t,n,r,s,o,a,l,c,u){if(e==t)return c;let f,p;if(r===0){if(p=Sc(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(Wz(i,x-n,x,n,o,a,u),p=Sc(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&&(Wz(i,t-n,e,n,o,a,u),p=Sc(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 aI(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=oI(i,e,x,n,r,s,o,a,l,c,u),e=x}return c}function Xz(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=aI(i,e,x,n,r,s,o,a,l,c,u),e=x[x.length-1]}return c}function Mu(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 Ng(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++]=Mu(i,e,l,n,r[s]),e=l}return r.length=s,r}function Nx(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?[]:Ng(i,e,l,n,r[s]),e=l[l.length-1]}return r.length=s,r}function Lx(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=mG(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 $z(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=Lx(i,e,u,n,r,s,o),a.push(o),e=u}return o}function Cd(i,e){return e*Math.round(i/e)}function mae(i,e,t,n,r,s,o){if(e==t)return o;let a=Cd(i[e],r),l=Cd(i[e+1],r);e+=n,s[o++]=a,s[o++]=l;let c,u;do if(c=Cd(i[e],r),u=Cd(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=Cd(i[e],r),p=Cd(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 Dx(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=mae(i,e,u,n,r,s,o),a.push(o),e=u}return o}function Yz(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l],f=[];o=Dx(i,e,u,n,r,s,o,f),a.push(f),e=u[u.length-1]}return o}var lI=class i extends Su{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<gd(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(rI(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),oI(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,n,r))}getArea(){return nI(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Mu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(e){let t=[];return t.length=Lx(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new i(t,"XY")}getType(){return"LinearRing"}intersectsExtent(e){return Nw(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Rx(this.flatCoordinates,0,e,this.stride),this.changed()}},cI=lI;function Fx(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(Va),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,Ex(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 Qw(i,e,t,n,r){let s=[];for(let o=0,a=t.length;o<a;++o){let l=t[o];s=Fx(i,e,l,n,r,2*o,s),e=l[l.length-1]}return s}function Kz(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 uI(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 hI(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=uI(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 Zz(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(!hI(i,e,a,n,r))return!1;a.length&&(e=a[a.length-1])}return!0}function Jw(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=uI(i,e,a,n);(s===0?r&&l||!r&&!l:r&&!l||!r&&l)&&Kz(i,e,a,n),e=a}return e}function fI(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s)e=Jw(i,e,t[s],n,r);return e}function Qz(i,e){let t=[],n=0,r=0,s;for(let o=0,a=e.length;o<a;++o){let l=e[o],c=uI(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 eS=class i extends Su{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?Pc(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<gd(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(sI(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),aI(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return Ex(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return iI(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),Jw(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,Ng(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let e=za(this.getExtent());this.flatInteriorPoint_=Fx(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Lc(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new cI(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 cI(t.slice(s,l),e);r.push(c),s=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;hI(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=Jw(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=Dx(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=ZP(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},Cu=eS;function dI(i){if(vu(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 eS(s,"XY",[s.length])}function Jz(i){return i.key.toLocaleLowerCase()==="g"?(i.preventDefault(),eV(),U.gridEnabled?(ye.gridInput.focus(),ye.gridInput.select()):ye.viewport.focus({preventScroll:!0}),!0):i.key===" "&&U.gridEnabled&&i.target!==ye.subgridToggle?(i.preventDefault(),Ox(!U.subgridVisible),!0):i.key==="Escape"&&U.gridEnabled?(i.preventDefault(),pI(),!0):!1}function eV(i=!U.gridEnabled){U.gridEnabled=i,i&&Ox(!0),nS(),Tu(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed()}function Ox(i){U.subgridVisible=i,U.layers.grid.changed(),U.layers.gridContext.changed(),ye.subgridToggle.setAttribute("aria-pressed",String(i)),ye.subgridToggle.setAttribute("aria-label",i?"Hide the subgrid":"Show the subgrid"),tV(),document.dispatchEvent(new Event("atlas:grid"))}function tV(){if(!U.gridEnabled){ye.gridHint.textContent="G \xB7 grid off";return}ye.gridHint.textContent=`G-${U.gridCell||"root"}`+(U.subgridVisible?"":" no subgrid")}function tA(i){let e=la(),t=e.parseInput(e.normalizeInput(i));if(t===null)return;let n=t!==U.gridCell;U.gridCell=t,U.gridEnabled||(U.gridEnabled=!0),nS(),Tu(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed(),n&&(Oc(),U.engine.getView().fit(AI(),{size:U.engine.getSize(),padding:[52,52,52,52],maxZoom:Eu(U.variant),duration:180}))}function pI(){if(U.gridEnabled){if(!U.gridCell){eV(!1);return}tA(la().parent(U.gridCell))}}function nS(){if(U.sources){if(U.sources.grid.clear(),U.sources.gridContext.clear(),ye.gridNavigator.hidden=!U.gridEnabled,tV(),U.gridEnabled&&U.variant){let i=la();ye.gridInput.maxLength=i.inputLength(U.map),ye.gridInput.value=U.gridCell,ye.gridBack.title=U.gridCell?`Back one ${i.slug} level`:`Close ${i.slug} grid`;for(let e of rS())xae(e)}document.dispatchEvent(new Event("atlas:grid"))}}function gae(i){return U0[la().colorKey(i)]}function iS(i,{subgridVisible:e,labelled:t}){let{role:n,contextDistance:r}=i;if(n==="child"&&(!t||!e))return null;let s=gae(i.hash),o=n==="leaf"||n==="scope",a=n==="scope"&&e,l={color:o?Li.lineWhite:s,opacity:n==="neighbor"?Li.neighborLineAlpha:n==="child"?Li.childLineAlpha:1,widthPx:a?Li.widths.scopeBare:Li.widths[n]},c=null;n==="neighbor"?c={color:Li.dimColor,opacity:Math.min(Li.dimCap,Li.dimBase+r*Li.dimStep)}:n==="leaf"?c={color:s,opacity:Li.leafFillAlpha}:n==="child"&&(c={color:s,opacity:Li.childFillAlpha});let u=null;if(t&&!a){let{context:f,principal:p}=la().label(i.hash);u={prefix:f,final:p,color:o?Li.lineWhite:s,textAlpha:n==="neighbor"?Li.neighborTextAlpha:1,chip:n==="neighbor"?Li.neighborChip:Li.chip,sizePx:n==="neighbor"?Li.neighborLabelSizePx:Li.labelSizePx}}return{line:l,fill:c,label:u,bare:a}}function rS(){let i=la(),e=[],t=_ae(i,U.gridCell);for(let n=0;n<t.length-1;n++){let r=t[n+1];for(let s of i.children(t[n]))s!==r&&e.push(tS(i,s,"neighbor",t.length-1-n))}if(U.gridCell&&i.level(U.gridCell)>=i.maxLevel(U.map))return e.push(tS(i,U.gridCell,"leaf",0)),e;U.gridCell&&e.push(tS(i,U.gridCell,"scope",0));for(let n of i.children(U.gridCell))e.push(tS(i,n,"child",0));return e}function _ae(i,e){let t=[e],n=e;for(;n;)n=i.parent(n),t.unshift(n);return t}function tS(i,e,t,n){return{hash:e,extent:i.bbox(e),ring:i.ring(e),pole:i.poleContained(e),childIndex:i.childIndex(e),role:t,contextDistance:n}}function xae(i){let e=la(),t=U.pins.filter(s=>!s.filteredHidden&&e.contains(i.hash,s.coordinate)).length,n=new Td({geometry:yae(i),gridCell:{hash:i.hash,extent:i.extent,role:i.role,count:t,contextDistance:i.contextDistance},priority:i.role==="neighbor"?-i.contextDistance*100+i.childIndex:i.childIndex});(i.role==="neighbor"?U.sources.gridContext:U.sources.grid).addFeature(n)}function yae(i){return new Cu([i.ring])}function AI(){return la().bbox(U.gridCell)}function nV(){return la().maxLevel(U.map)}function Rd(i){return!U.gridEnabled||!U.gridCell?!1:la().contains(U.gridCell,i.coordinate)}function Ru(i){let e=i.attrs?.["atlas.render.as"];return e||(i.displayType==="text"?"text":"pin")}function iV(i){return i?.attrs?.["atlas.geometry.surface"]||"plane"}function lf(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 oS=[NaN,NaN,NaN,0],mI;function vae(){return mI||(mI=Ti(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),mI}var bae=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,wae=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Sae=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Tae=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function sS(i,e){return i.endsWith("%")?Number(i.substring(0,i.length-1))/e:Number(i)}function Ux(i){throw new Error('failed to parse "'+i+'" as color')}function rV(i){if(i.toLowerCase().startsWith("rgb")){let s=i.match(wae)||i.match(bae)||i.match(Sae);if(s){let o=s[4],a=100/255;return[xi(sS(s[1],a)+.5|0,0,255),xi(sS(s[2],a)+.5|0,0,255),xi(sS(s[3],a)+.5|0,0,255),o!==void 0?xi(sS(o,100),0,1):1]}Ux(i)}if(i.startsWith("#")){if(Tae.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}Ux(i)}let e=vae();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&&Ux(i));let n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return rV(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]=q0(r[3]/255,3),r}function sV(i){return typeof i=="string"?i:Gx(i)}var Eae=1024,Bx={},gI=0;function oV(i){if(i.length===4)return i;let e=i.slice();return e[3]=1,e}function _I(i){return i>.0031308?Math.pow(i,1/2.4)*269.025-14.025:i*3294.6}function xI(i){return i>.2068965?Math.pow(i,3):(i-4/29)*(108/841)}function yI(i){return i>10.314724?Math.pow((i+14.025)/269.025,2.4):i/3294.6}function vI(i){return i>.0088564?Math.pow(i,1/3):i/(108/841)+4/29}function bI(i){let e=yI(i[0]),t=yI(i[1]),n=yI(i[2]),r=vI(e*.222488403+t*.716873169+n*.06060791),s=500*(vI(e*.452247074+t*.399439023+n*.148375274)-r),o=200*(r-vI(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 aV(i){let e=(i[0]+16)/116,t=i[1],n=i[2]*Math.PI/180,r=xI(e),s=xI(e+t/500*Math.cos(n)),o=xI(e-t/200*Math.sin(n)),a=_I(s*3.021973625-r*1.617392459-o*.404875592),l=_I(s*-.943766287+r*1.916279586+o*.027607165),c=_I(s*.069407491-r*.22898585+o*1.159737864);return[xi(a+.5|0,0,255),xi(l+.5|0,0,255),xi(c+.5|0,0,255),i[3]]}function kx(i){if(i==="none")return oS;if(Bx.hasOwnProperty(i))return Bx[i];if(gI>=Eae){let t=0;for(let n in Bx)(t++&3)===0&&(delete Bx[n],--gI)}let e=rV(i);e.length!==4&&Ux(i);for(let t of e)isNaN(t)&&Ux(i);return Bx[i]=e,++gI,e}function Yl(i){return Array.isArray(i)?i:kx(i)}function Gx(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 SI=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=wI(e,t);return n in this.cache_?this.cache_[n]:null}getPattern(e,t){let n=wI(e,t);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,n,r){let s=wI(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]=Cx().createPattern(n.getImage(1),"repeat")}):this.patternCache_[s]=Cx().createPattern(n.getImage(1),"repeat")),o||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function wI(i,e){let t=e?Yl(e):"null";return i+":"+t}var Oo=new SI;var zx=null,aS=class extends Sd{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){zx||(zx=Ti(1,1,void 0,{willReadFrequently:!0})),zx.drawImage(this.image_,0,0);try{zx.getImageData(0,0,1,1),this.tainted_=!1}catch{zx=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=Ti(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&&lz(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=Ti(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=sV(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 Pd(i,e,t,n,r,s){let o=e===void 0?void 0:Oo.get(e,r);return o||(o=new aS(i,i&&"src"in i?i.src||void 0:e,t,n,r),Oo.set(e,r,o,s)),s&&o&&!Oo.getPattern(e,r)&&Oo.set(e,r,o,s),o}var lV=aS;function Ha(i){return i?Array.isArray(i)?Gx(i):typeof i=="object"&&"src"in i?Mae(i):i:null}function Mae(i){if(!i.offset||!i.size)return Oo.getPattern(i.src,i.color);let e=i.src+":"+i.offset,t=Oo.getPattern(e,i.color);if(t)return t;let n=Oo.get(i.src,null);if(n.getImageState()!==Mn.LOADED)return null;let r=Ti(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]),Pd(r.canvas,e,void 0,Mn.LOADED,i.color,!0),Oo.getPattern(e,i.color)}var Vx="ol-hidden";var Id="ol-unselectable";var Lg="ol-control",TI="ol-collapsed",Cae=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"),cV=["style","variant","weight","size","lineHeight","family"],lS={normal:400,bold:700},cS=function(i){let e=i.match(Cae);if(!e)return null;let t={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let n=0,r=cV.length;n<r;++n){let s=e[n+1];s!==void 0&&(t[cV[n]]=typeof s=="string"?s.trim():s)}return isNaN(Number(t.weight))&&t.weight in lS&&(t.weight=lS[t.weight]),t.families=t.family.split(/,\s?/).map(n=>n.trim().replace(/^['"]|['"]$/g,"")),t};var uS="10px sans-serif",ks="#000",Pu="round",Wa=[],ja=0,Iu="round",cf=10,hV=0,Bo="#000",Nd="center",iA="middle",uf=[0,0,0,0],hf=1,nA=new bs,qx=null,uV,EI={},Rae=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Pae(i,e,t){return`${i} ${e} 16px "${t}"`}var fV=(function(){let e,t;async function n(s){await t.ready;let o=cS(s),a=o.families[0].toLowerCase(),l=o.weight,c=[];return t.forEach(f=>{let p=f.family.replace(/^['"]|['"]$/g,"").toLowerCase(),x=lS[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=nA.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)?(wu(EI),nA.set(c,100)):(u+=10,nA.set(c,u,!0),u<100&&(s=!1)))}e=void 0,s||(e=setTimeout(r,100))}return async function(s){t||(t=Us?self.fonts:document.fonts);let o=cS(s);if(!o)return;let a=o.families,l=!1;for(let c of a){if(Rae.has(c))continue;let u=Pae(o.style,o.weight,c);nA.get(u)===void 0&&(nA.set(u,0,!0),l=!0)}l&&(clearTimeout(e),e=setTimeout(r,100))}})(),Iae=(function(){let i;return function(e){let t=EI[e];if(t==null){if(Us){let n=cS(e),r=dV(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 dV(i,e){return qx||(qx=Ti(1,1)),i!=uV&&(qx.font=i,uV=qx.font),qx.measureText(e)}function pV(i,e){return dV(i,e).width}function MI(i,e,t){if(e in t)return t[e];let n=e.split(`5-`).reduce((r,s)=>Math.max(r,pV(i,s)),0);return t[e]=n,n}function AV(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=pV(p,f);t.push(x),o+=x;let v=Iae(p);n.push(v),l=Math.max(l,v)}return{width:s,height:a,widths:t,heights:n,lineWidths:r}}function mV(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]),Nae(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 Nae(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 CI=class i{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=jr(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 Kn()}getImage(e){return Kn()}getHitDetectionImage(){return Kn()}getPixelRatio(e){return 1}getImageState(){return Kn()}getImageSize(){return Kn()}getOrigin(){return Kn()}getSize(){return Kn()}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_=jr(e)}listenImageChange(e){Kn()}load(){Kn()}unlistenImageChange(e){Kn()}ready(){return Promise.resolve()}},hS=CI;var RI=class i extends hS{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=Oo.get(n,null)?.getImage(1);if(!r){let s=this.renderOptions_,o=Math.ceil(s.size*e),a=Ti(o,o);this.draw_(s,a,e),r=a.canvas;let l=new lV(r,void 0,null,Mn.LOADED,null);Oo.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=Pu,t=Iu,n=0,r=null,s=0,o,a=0;this.stroke_&&(o=Ha(this.stroke_.getColor()??Bo),a=this.stroke_.getWidth()??hf,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??Iu,e=this.stroke_.getLineCap()??Pu,n=this.stroke_.getMiterLimit()??cf);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=ks),t.fillStyle=Ha(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=Yl(n)),n===null?r=1:Array.isArray(n)&&(r=n.length===4?n[3]:1),r===0&&(t=Ti(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=ks,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()}},fS=RI;var PI=class i extends fS{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}},dS=PI;var II=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=Pd(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?Ln(e):typeof e=="object"&&"src"in e?e.src+":"+e.offset:Yl(e).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},Xr=II;function gV(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 NI=class i extends hS{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;Vn(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||Ln(o)),Vn(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),Vn(!((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?Yl(e.color):null,this.iconImage_=Pd(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(gV(x[0],x[1],e.width,e.height))};this.listenImageChange(p);return}}c!==void 0&&this.setScale(gV(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?Yl(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_=Pd(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_=Pd(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()}},rA=NI;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}},ho=LI;var pS=class i{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=_V,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_=_V,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function xV(i){let e;if(typeof i=="function")e=i;else{let t;Array.isArray(i)?t=i:(Vn(typeof i.getZIndex=="function","Expected an `Style` or an array of `Style`"),t=[i]),e=function(){return t}}return e}var DI=null;function FI(i,e){if(!DI){let t=new Xr({color:"rgba(255,255,255,0.4)"}),n=new ho({color:"#3399CC",width:1.25});DI=[new pS({image:new dS({fill:t,stroke:n,radius:5}),fill:t,stroke:n})]}return DI}function _V(i){return i.getGeometry()}var ws=pS;var Lae="#333",OI=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_=jr(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 Xr({color:Lae}),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 Xr?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_=jr(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}},ff=OI;function Kl(i,e){return(i.get("priority")||0)-(e.get("priority")||0)}function bV(i){let e=i.get("pin");return!e||Zl(e)||e.insideHighlightedZone||Dg(e)?null:BI(e,!1)}function wV(i){let e=i.get("pin");return!e||!U.highlightedZones.size||!e.insideHighlightedZone||Zl(e)||Dg(e)?null:BI(e,!1)}function SV(i){let e=i.get("pin");return!e||Zl(e)||!U.labelsHeld?null:RV(e)}function TV(i){let e=i.get("pin");if(!e||Zl(e)||e.insideHighlightedZone||Dg(e)||jx())return null;if(U.labelsHeld)return Hx(e,!1);let t=U.fitZoom+Math.log2(BV(e.category));return(U.engine.getView().getZoom()||0)<t?null:Hx(e,!1)}function EV(i){let e=i.get("pin");return!e||Zl(e)||e.insideHighlightedZone||Dg(e)||!jx()?null:Hx(e,!1)}function MV(i){let e=i.get("pin");return!e||!U.highlightedZones.size||!e.insideHighlightedZone||Zl(e)||Dg(e)?null:Hx(e,!1)}function CV(i){let e=i.get("pin");if(!e||Zl(e))return null;if(Ru(e.category)==="text")return Hx(e,e===U.selectedPin);let t=BI(e,e===U.selectedPin);return e===U.hoveredPin||e===U.selectedPin?[t,RV(e)]:t}function BI(i,e){let t=`marker:${i.category.id}:${e?1:0}`;if(U.styleCache.has(t))return U.styleCache.get(t);let n=eA(i.category),r=e?2e7:i.priority,s=U.markerIcons.get(Wx(i.category)),o;return s?o=new ws({image:new rA({src:s,width:e?36:31,height:e?36:31}),zIndex:r}):o=new ws({text:new ff({text:Dc(i.category.title),font:`900 ${e?15:13}px Inter, sans-serif`,fill:new Xr({color:n}),stroke:new ho({color:J0(),width:e?4:3})}),zIndex:r}),U.styleCache.set(t,o),o}function RV(i){let e=`marker-label:${i.location.id}`;if(U.styleCache.has(e))return U.styleCache.get(e);let t=new ws({text:new ff({text:i.location.title,offsetY:21,font:'700 10px "Arial Narrow", "Roboto Condensed", sans-serif',fill:new Xr({color:"#f2ece0"}),stroke:new ho({color:"rgba(0,0,0,0.98)",width:3}),backgroundFill:new Xr({color:"rgba(10,12,17,0.72)"}),padding:[2,4,2,4],overflow:!0}),zIndex:i.priority});return U.styleCache.set(e,t),t}function PV(i){if(!i.iconAsset)return;let e=Wx(i);if(U.markerIcons.has(e))return;U.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=eA(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=J0(),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),U.markerIcons.set(e,n.toDataURL("image/png")),Dae(),U.layers.pins.changed(),U.layers.zonePins.changed(),U.layers.priority.changed()},t.onerror=()=>U.markerIcons.set(e,!1),t.src=JP(i.iconAsset)}function Dae(){for(let i of U.styleCache.keys())i.startsWith("marker:")&&U.styleCache.delete(i)}function Wx(i){return`${i.iconAsset||""}:${eA(i)}:${U.map?.iconOutset||"light"}`}function Hx(i,e){let t=`text:${i.location.id}:${e?1:0}`;if(U.styleCache.has(t))return U.styleCache.get(t);let r=[new ws({text:new ff({text:i.location.title,font:`${e?"900":"800"} 14px "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new Xr({color:e?"#7fd0ea":"#f2ece0"}),stroke:new ho({color:"rgba(0,0,0,0.95)",width:4}),backgroundFill:new Xr({color:e?"rgba(13,16,23,0.9)":"rgba(10,12,17,0.58)"}),backgroundStroke:e?new ho({color:"#3aa5c9",width:1}):void 0,padding:[3,6,3,6],overflow:!0}),zIndex:e?2e7:i.priority+3e6})];return U.styleCache.set(t,r),r}function AS(i,e){return`${i} ${e}px ${Li.labelFont}`}function UI(i,e){let t=i.get("gridCell");if(!t)return null;let n=t.role==="neighbor",r=n?Li.neighborLabelSizePx:Li.labelSizePx,s=AS(900,r),o=n?[2,4,2,4]:[3,5,3,5],a=Fae(t,s,r,o,e),l=iS(t,{subgridVisible:U.subgridVisible,labelled:a});if(!l)return null;let c=`grid:${t.hash}:${t.role}:${t.contextDistance}:${a?1:0}:${l.bare?1:0}`;if(U.styleCache.has(c))return U.styleCache.get(c);let u=t.role==="leaf"||t.role==="scope"?100:i.get("priority"),f=[new ws({fill:l.fill?new Xr({color:af(l.fill.color,l.fill.opacity)}):void 0,stroke:new ho({color:af(l.line.color,l.line.opacity),width:l.line.widthPx}),zIndex:u})];if(l.label){let p=l.label.prefix?[l.label.prefix,AS(500,r),l.label.final,AS(900,r)]:l.label.final,x=Li.labelInsetPx*e;f.push(new ws({geometry:new Lc([t.extent[2]-x,t.extent[1]+x]),text:new ff({text:p,font:AS(900,r),textAlign:"right",textBaseline:"bottom",fill:new Xr({color:af(l.label.color,l.label.textAlpha)}),backgroundFill:new Xr({color:l.label.chip}),padding:o,overflow:!0}),zIndex:u+1}))}return U.styleCache.set(c,f),f}function Fae(i,e,t,n,r){if(!r)return!0;let s=kI(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 yV=document.createElement("canvas").getContext("2d"),vV=new Map;function kI(i,e){let t=`${e}|${i}`,n=vV.get(t);return n===void 0&&(yV.font=e,n=yV.measureText(i).width,vV.set(t,n)),n}var Oae=new ws({fill:new Xr({color:"rgba(5, 8, 16, 0.62)"})});function IV(){return U.zonesVisible?Oae:null}function NV(i){if(!U.zonesVisible)return null;let e=i.get("zone"),t=i.get("child"),n=U.highlightedZones.has(e.id),r=OV(e.id),s=`zone:${e.id}:${t?1:0}:${n?1:r?2:0}`;if(U.styleCache.has(s))return U.styleCache.get(s);let o=i.get("color");if(r){let c=new ws({stroke:new ho({color:af(o,t?.34:.44),width:t?1:1.3,lineDash:t?[3,4]:[7,5]}),zIndex:t?101:100});return U.styleCache.set(s,c),c}let a=new ws({fill:new Xr({color:af(o,t?.035:.07)}),stroke:new ho({color:af(o,t?.5:.72),width:t?1.2:1.8,lineDash:t?[3,4]:[7,5]})});if(!n)return U.styleCache.set(s,a),a;let l=[new ws({stroke:new ho({color:"rgba(255,255,255,0.94)",width:5}),zIndex:9e3}),new ws({fill:new Xr({color:af(o,.22)}),stroke:new ho({color:o,width:2.6}),zIndex:9001})];return U.styleCache.set(s,l),l}function LV(i){if(!U.zonesVisible||jx())return null;let e=i.get("child"),t=U.highlightedZones.has(i.get("zone").id),n=U.engine.getView().getZoom()||0;if(!t&&e&&n<U.fitZoom+3)return null;let r=i.get("span")/U.engine.getView().getResolution();return!t&&U.zoneTitleCount>40&&r<52?null:FV(i)}function DV(i){return!U.zonesVisible||!jx()?null:FV(i)}function FV(i){let e=i.get("child"),t=i.get("zone"),n=U.highlightedZones.has(t.id),r=OV(t.id),s=`zone-title:${t.id}:${e?1:0}:${n?1:r?2:0}`;if(U.styleCache.has(s))return U.styleCache.get(s);let o=i.get("color"),a=new ws({text:new ff({text:t.title.toLocaleUpperCase(),font:`${e?"700 12px":"800 14px"} "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new Xr({color:n?"#10131a":r?"rgba(196,191,177,0.56)":e?"#c8c2b4":"#f2ece0"}),stroke:new ho({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 Xr({color:n?o:r?"rgba(8,11,18,0.84)":"rgba(13,16,23,0.72)"}),backgroundStroke:new ho({color:n?"#ffffff":af(o,r?.24:.55),width:n?2:1}),padding:[5,8,5,8],overflow:!0}),zIndex:n?91e5:i.get("priority")});return U.styleCache.set(s,a),a}function OV(i){if(!U.highlightedZones.size||U.highlightedZones.has(i))return!1;for(let e of U.highlightedZones)if(Bae(i,e))return!1;return!0}function Bae(i,e){let t=new Set,n=U.zoneRecords.get(e)?.zone.parentRegionId;for(;n!=null&&!t.has(n);){if(n===i)return!0;t.add(n),n=U.zoneRecords.get(n)?.zone.parentRegionId}return!1}var GI=class i extends Su{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){Pc(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<gd(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=Sc(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 Mu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){let t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new Lc(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 Lc(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(xx(e,o,a))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Rx(this.flatCoordinates,0,e,this.stride),this.changed()}},UV=GI;function mS(i,e,t,n){let r=[],s=Pr();for(let o=0,a=t.length;o<a;++o){let l=t[o];s=ug(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 zI=class i extends Su{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;Pc(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;Pc(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<gd(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(jz(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Xz(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return YG(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return Hz(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),fI(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,Nx(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let e=mS(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Qw(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new UV(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;Zz(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=fI(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=Yz(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 Cu(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 Cu(t.slice(s,c),e,l);r.push(u),s=c}return r}getType(){return"MultiPolygon"}intersectsExtent(e){return ZG(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);let n=kz(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()}},kV=zI;function VI(){let i=(U.map.zones||[]).filter(WI);U.renderedShard=U.variant?.shard||0,U.sources.zones.clear(),U.sources.zoneTitles.clear(),U.zoneRecords.clear(),U.highlightedZones.clear(),U.focusedZoneID=null,U.zoneTitleCount=0,gS(!0),ye.zoneIndex.hidden=i.length===0,ye.zoneCount.textContent=Fc(i.length);for(let e of i){let t=Pr(),n=[],r=!1;for(let l of e.features||[]){let c=Gae(l);c&&(r=!0,n.push(c),mw(t,c.getExtent()),U.sources.zones.addFeature(new Td({geometry:c,zone:e,color:$w(e.id),child:e.parentRegionId!=null})))}if(!r)continue;let s=$w(e.id),o=e.center?Fg(e.center.lat,e.center.lng):za(t),a=Math.max(t[2]-t[0],t[3]-t[1]);U.sources.zoneTitles.addFeature(new Td({geometry:new Lc(o),zone:e,color:s,child:e.parentRegionId!=null,span:a,priority:(e.parentRegionId==null?2e6:1e6)+Math.round(a)})),U.zoneRecords.set(e.id,{zone:e,extent:t.slice(),geometries:n,color:s})}U.zoneTitleCount=U.sources.zoneTitles.getFeatures().length,zV(),Uae()}function zV(){if(U.sources.zoneScrim.clear(),!U.highlightedZones.size)return;let[i,e,t,n]=U.projection.getExtent(),r=[GV([[i,e],[t,e],[t,n],[i,n],[i,e]],!0)];for(let s of U.highlightedZones)for(let o of U.zoneRecords.get(s)?.geometries||[]){let a=o.getType()==="MultiPolygon"?o.getPolygons():[o];for(let l of a)l.getLinearRings().forEach((c,u)=>{r.push(GV(c.getCoordinates(),u>0))})}U.sources.zoneScrim.addFeature(new Td({geometry:new Cu(r)}))}function GV(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 Uae(){let i=document.createDocumentFragment();for(let{zone:e,depth:t}of kae()){let n=U.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)}ye.zoneList.replaceChildren(i),ye.zoneIndex.hidden=U.zoneRecords.size===0}function kae(){let i=[...U.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 gS(i){U.zonesVisible=i,ye.zoneToggle.checked=i,U.layers.zoneScrim.setVisible(i),U.layers.zones.setVisible(i),U.layers.zoneTitles.setVisible(i),U.layers.zoneTitleDetail.setVisible(i)}function VV(i){let e=U.zoneRecords.get(i);e&&(U.focusedZoneID=i,HV(),Oc(),U.engine.getView().fit(e.extent,{size:U.engine.getSize(),padding:[54,54,54,54],maxZoom:Eu(U.variant),duration:220}),ye.sidebar.classList.remove("is-open"),ye.mobileLegend.setAttribute("aria-expanded","false"))}function qV(i){U.zoneRecords.has(i)&&(U.highlightedZones.has(i)?U.highlightedZones.delete(i):(U.highlightedZones.add(i),gS(!0)),U.hoveredPin=null,qI(),HI(),HV(),zV(),U.layers.zones.changed(),U.layers.zoneTitles.changed(),U.layers.zoneTitleDetail.changed())}function HV(){ye.zoneIndex.classList.toggle("has-highlights",U.highlightedZones.size>0);for(let i of ye.zoneList.querySelectorAll("[data-zone]")){let e=Number(i.dataset.zone),t=U.highlightedZones.has(e);i.classList.toggle("is-highlighted",t),i.classList.toggle("is-current",U.focusedZoneID===e),i.setAttribute("aria-pressed",String(t))}}function Gae(i){if(!i?.coordinates)return null;let e=([t,n])=>Fg(n,t);return i.type==="Polygon"?new Cu(i.coordinates.map(t=>t.map(e))):i.type==="MultiPolygon"?new kV(i.coordinates.map(t=>t.map(n=>n.map(e)))):null}function Fg(i,e){let t=zae(),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 zae(){let i=U.game.tileGrid,e=U.map?.grid;return e?{...i,...e}:i}function WV(){U.sources.pins.clear(),U.sources.text.clear(),U.sources.priority.clear(),U.pins=[],U.pinByID.clear();for(let i of U.map.groups)for(let e of i.categories){Ru(e)!=="text"&&PV(e);for(let t of e.locations){let n={location:t,category:e,group:i,coordinate:Fg(t.lat,t.lng),filteredHidden:!1,priority:Wae(e,t),feature:null};n.feature=new Td({geometry:new Lc(n.coordinate),pin:n,priority:n.priority}),U.pins.push(n),U.pinByID.set(t.id,n),Ru(e)==="text"?U.sources.text.addFeature(n.feature):U.sources.pins.addFeature(n.feature)}}$l()}function $l(){for(let i of U.pins){let e=U.hiddenCategories.has(i.category.id),t=U.search&&!i.location.title.toLocaleLowerCase().includes(U.search);i.filteredHidden=!!(e||t)}qI(),HI(),U.selectedPin?.filteredHidden&&Oc(),Ed(),document.dispatchEvent(new Event("atlas:filters"))}function qI(){if(!U.highlightedZones.size){for(let e of U.pins)e.insideHighlightedZone=!1;return}let i=[...U.highlightedZones].map(e=>U.zoneRecords.get(e)).filter(Boolean);for(let e of U.pins)e.insideHighlightedZone=i.some(t=>t.geometries.some(n=>Vae(n,e.coordinate)))}function Vae(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 HI(){U.eligibleLocations=U.pins.filter(i=>!Zl(i)).length,Tu(),U.layers.pins.changed(),U.layers.zonePins.changed(),U.layers.pinLabels.changed(),U.layers.text.changed(),U.layers.zoneText.changed(),U.layers.textDetail.changed(),U.layers.priority.changed(),sA()}function Tu(){U.sources.priority.clear();for(let i of U.pins){if(Zl(i))continue;let e=!!U.search&&i.location.title.toLocaleLowerCase().includes(U.search);(i===U.selectedPin||i===U.hoveredPin||e||Rd(i))&&U.sources.priority.addFeature(i.feature)}}function Og(i){U.hoveredPin!==i&&(U.hoveredPin=i,U.sources&&(Tu(),U.layers.pins.changed(),U.layers.priority.changed()))}function _S(i){U.labelsHeld!==i&&(U.labelsHeld=i,ye.labelsHint.textContent=i?"Z \xB7 labels shown":"Z \xB7 hold for labels",U.layers.pinLabels.changed(),U.layers.text.changed(),document.dispatchEvent(new Event("atlas:labels")))}function Dg(i){return i===U.selectedPin||i===U.hoveredPin||Rd(i)||!!U.search&&i.location.title.toLocaleLowerCase().includes(U.search)}function Zl(i){return i.filteredHidden||qae(i)||Hae(i)||!WI(i.location)}function WI(i){let e=U.variant?.shard;return!e||!i.shard||i.shard===e}function qae(i){return!U.highlightedZones.size||i.insideHighlightedZone||i===U.selectedPin?!1:!(U.search&&i.location.title.toLocaleLowerCase().includes(U.search))}function Hae(i){return!U.gridEnabled||!U.gridCell||Rd(i)||i===U.selectedPin?!1:!(U.search&&i.location.title.toLocaleLowerCase().includes(U.search))}function Wae(i,e){return Math.max(0,1e6-Math.min(i.locations.length,999)*1e3)+Gz(e.id)%1e3}function BV(i){return i.locations.length>200?4:i.locations.length>75?2.5:1}function jx(){return(U.engine?.getView().getZoom()||0)>=(U.variant?.maxZoom||0)-.05}function jV(i){let e=[],t=[];for(let n of i){let r=[];for(let s of n.categories)(Ru(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 XV(){let i=document.createDocumentFragment();for(let e of U.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(jae(e.key,e.title,n));let r=document.createElement("div");r.className="category-toggles";for(let s of e.categories)r.append(Xae(s));t.append(r),i.append(t)}ye.legend.replaceChildren(i),xS(),Md()}function jae(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=Fc(t),r.append(s,o,a);let l=$V(`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 $V(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 Xae(i){let e=Ru(i)==="text",t=document.createElement("label");t.className="category-row",Pg(t,i);let n=document.createElement("input");n.type="checkbox",n.dataset.category=String(i.id),n.checked=!U.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",Ig(r,i,Dc(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=Fc(i.locations.length);let a=$V(`Show only ${i.title}`);return a.dataset.onlyCategory=String(i.id),t.append(n,r,s,a,o),t}function jI(i){if(U.collapsedSections.clear(),i)for(let e of ye.layers.querySelectorAll("[data-section]"))U.collapsedSections.add(e.dataset.section);xS()}function xS(){for(let i of ye.layers.querySelectorAll("[data-section]")){let e=U.collapsedSections.has(i.dataset.section);i.setAttribute("aria-expanded",String(!e)),i.closest(".layer-section").classList.toggle("is-collapsed",e)}Nc()}function Xx(i){if(U.hiddenCategories.clear(),!i)for(let e of U.map.groups)for(let t of e.categories)U.hiddenCategories.add(t.id);Ix(),$l(),Ed(),Md()}function Ix(){for(let i of document.querySelectorAll("[data-category]"))i.checked=!U.hiddenCategories.has(Number(i.dataset.category))}function YV(i){let e=U.map.sections.find(n=>n.key===i);if(!e)return;let t=e.categories.some(n=>!U.hiddenCategories.has(n.id));for(let n of e.categories)t?U.hiddenCategories.add(n.id):U.hiddenCategories.delete(n.id);Ix(),$l(),Md()}function KV(i){if(U.map){if($ae(i)){Xx(!0);return}U.hiddenCategories.clear();for(let e of U.map.sections){let t=i.section===e.key;for(let n of e.categories)!t&&i.category!==n.id&&U.hiddenCategories.add(n.id)}Ix(),$l(),Ed(),Md()}}function $ae(i){for(let e of U.map.sections)for(let t of e.categories)if((i.section===e.key||i.category===t.id)===U.hiddenCategories.has(t.id))return!1;return!0}function Yae(){let i=ye.soloChip;if(!U.map){i.hidden=!0;return}let e=null,t=0,n=null,r=0;for(let o of U.map.sections){let a=0;for(let l of o.categories)U.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 Md(){if(U.map){for(let i of U.map.sections){let e=ye.legend.querySelector(`input[data-section-toggle="${i.key}"]`);e&&(e.checked=i.categories.some(t=>!U.hiddenCategories.has(t.id)))}Yae(),Nc()}}async function ZV(i){let[e,t]=await Promise.all([fetch(`${U.game.base}/maps/${i.slug}.json`),fetch(`${U.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 Kae(r,s),{...i,grid:n.grid,variants:n.variants,groups:n.groups,zones:n.zones||[],attrs:n.attrs||{},merged:n.merged||[],sections:jV(n.groups)}}function Kae(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 qz(){let i=`${U.game.base}/${U.map.slug}`;return U.textByMap.has(i)||U.textByMap.set(i,fetch(`${U.game.base}/maps/${U.map.slug}.text`).then(e=>e.json()).catch(()=>({}))),U.textByMap.get(i)}var yS=null;function oA(){return yS||(yS=Zae().finally(()=>{yS=null})),yS}async function Zae(){let i=await fetch("/data/catalog.json");if(!i.ok)return;let e=U.game;if(U.catalog=await i.json(),B0(ye.game,U.catalog.games,"title"),XI(),!U.catalog.games.length)return;let t=e&&U.catalog.games.find(n=>n.slug===e.slug);if(!t){let n=Rg();await df(n.game||Cg()?.game||U.catalog.games[0].slug,n.game?n.map:void 0);return}if(t.stamp!==e.stamp){for(let r of U.textByMap.keys())r.startsWith(e.base+"/")&&U.textByMap.delete(r);let n=U.engine?.getView();U.restore={game:t.slug,map:U.map?.slug,variant:U.map?U.map.variants.indexOf(U.variant):0,center:n?.getCenter(),zoom:n?.getZoom(),hidden:[...U.hiddenCategories],collapsed:[...U.collapsedSections],overviewDocked:U.overviewDocked,dockFolded:U.dockFolded,dockDismissed:U.dockDismissed},await df(t.slug,U.map?.slug);return}U.game=t,ye.game.value=t.slug}function XI(){let i=!U.catalog?.games?.length;ye.emptyState.hidden=!i,U.catalog?.bundlesDir&&(ye.emptyPath.textContent=U.catalog.bundlesDir)}async function $I(){for(let i of[ye.emptyOpen,ye.addBundles])i.disabled=!0;try{let e=await(await fetch("/data/bundles/import",{method:"POST"})).json().catch(()=>({}));await oA();let t=e.imported?.[0];t&&U.catalog.games.some(n=>n.slug===t)&&await df(t)}finally{for(let i of[ye.emptyOpen,ye.addBundles])i.disabled=!1}}var Qs={ADD:"add",REMOVE:"remove"};var QV={LENGTH:"length"},Bg=class extends Ks{constructor(e,t,n){super(e),this.element=t,this.index=n}},YI=class extends bs{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(QV.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 Bg(Qs.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 Bg(Qs.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 Bg(Qs.REMOVE,r,e)),this.dispatchEvent(new Bg(Qs.ADD,t,e))}updateLength_(){this.set(QV.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")}},fo=YI;var KI=class extends Ks{constructor(e,t,n){super(e),this.map=t,this.frameState=n!==void 0?n:null}},Ld=KI;var ZI=class extends Ld{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()}},Nu=ZI;var rr={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 $x={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var QI=class extends Sd{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_=kn(n,$x.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=kn(n,$x.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(Jt.TOUCHMOVE,this.boundHandleTouchMove_,Ow?{passive:!1}:!1)}emulateClick_(e){let t=new Nu(rr.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new Nu(rr.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let n=new Nu(rr.SINGLECLICK,this.map_,e);this.dispatchEvent(n)},250)}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==rr.POINTERUP||t.type==rr.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==rr.POINTERDOWN||t.type==rr.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new Nu(rr.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(ri),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 Nu(rr.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(kn(n,rr.POINTERMOVE,this.handlePointerMove_,this),kn(n,rr.POINTERUP,this.handlePointerUp_,this),kn(this.element_,rr.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push(kn(this.element_.getRootNode(),rr.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new Nu(rr.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 Nu(rr.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_&&(ri(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(Jt.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(ri(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(ri),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},JV=QI;var Lu={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var po={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};var Yx=1/0,JI=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,wu(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){Vn(!(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!=Yx?(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==Yx?delete this.queuedElements_[this.keyFunction_(o)]:(n[r]=l,t[r++]=o);t.length=r,n.length=r,this.heapify_()}},eq=JI;var e5=class extends eq{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())}}},tq=e5;function nq(i,e,t,n,r){if(!i||!(t in i.wantedTiles))return Yx;if(!i.wantedTiles[t][e.getKey()])return Yx;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 Gs={ANIMATING:0,INTERACTING:1};var Ql={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function t5(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=xi(n[0],p,x),T=xi(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 iq(i){return i}function n5(i,e,t,n){let r=jn(e)/t[0],s=xr(e)/t[1];return n?Math.min(i,Math.max(r,s)):Math.min(i,Math.min(r,s))}function i5(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),xi(n,t/2,e*2)}function rq(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?n5(l,t,o,n):l;if(a)return e?i5(r,u,c):xi(r,c,u);let f=Math.min(u,r),p=Math.floor(vg(i,f,s));return i[p]>u&&p<i.length-1?i[p+1]:i[p]}})}function sq(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?n5(e,r,l,s):e;if(c)return n?i5(o,u,t):xi(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 xi(T,t,u)}})}function r5(i,e,t,n,r){return t=t!==void 0?t:!0,(function(s,o,a,l){if(s!==void 0){let c=n?n5(i,n,a,r):i;return!t||!l?xi(s,e,c):i5(s,c,e)}})}function Ug(i){if(i!==void 0)return 0}function s5(i){if(i!==void 0)return i}function oq(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 aq(i){let e=i===void 0?Tc(5):i;return(function(t,n){return n||t===void 0?t:Math.abs(t)<=e?0:t})}var o5=0,l5=class extends bs{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=Rw(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&&kG(),e.center&&(e.center=Cc(e.center,this.projection_)),e.extent&&(e.extent=Rc(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let a in Ql)delete t[a];this.setProperties(t,!0);let n=Jae(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=Qae(e),s=n.constraint,o=ele(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=Cc(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=Cc(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&&vS(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||cz,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=bu(u.rotation-l+Math.PI,2*Math.PI)-Math.PI;f.targetRotation=l+p,l=f.targetRotation}tle(f)?f.complete=!0:s+=f.duration,c.push(f)}this.animations_.push(c),this.setHint(Gs.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[Gs.ANIMATING]>0}getInteracting(){return this.hints_[Gs.INTERACTING]>0}cancelAnimations(){this.setHint(Gs.ANIMATING,-this.hints_[Gs.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){let r=this.animations_[t];if(r[0].callback&&vS(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?bu(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(Gs.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let o=r[0].callback;o&&vS(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]],pg(n,e-this.getRotation()),_G(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&&Tx(e,this.getProjection())}getCenterInternal(){return this.get(Ql.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 yd(t,this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();Vn(t,"The view center is not defined");let n=this.getResolution();Vn(n!==void 0,"The view resolution is not defined");let r=this.getRotation();return Vn(r!==void 0,"The view rotation is not defined"),vx(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(Ql.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(Rc(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();let n=jn(e)/t[0],r=xr(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(Ql.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=a5(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=vg(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=xi(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/Math.pow(n,xi(e-t,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let n;if(Vn(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(e)){Vn(!vu(e),"Cannot fit empty extent provided as `geometry`");let r=Rc(e,this.getProjection());n=dI(r)}else if(e.getType()==="Circle"){let r=Rc(e.getExtent(),this.getProjection());n=dI(r),n.rotate(this.getRotation(),za(r))}else{let r=$0();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=za(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:of;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),vS(S,!0))}centerOn(e,t,n){this.centerOnInternal(Cc(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(a5(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=a5(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=Tx(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&&Cc(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=Cc(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&&Cc(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(Ql.ROTATION)!==r&&this.set(Ql.ROTATION,r),this.get(Ql.RESOLUTION)!==o&&(this.set(Ql.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Ql.CENTER)||!H0(this.get(Ql.CENTER),a))&&this.set(Ql.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()||!H0(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:e,easing:Xl,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Gs.INTERACTING,1)}endInteraction(e,t,n){n=n&&Cc(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(Gs.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 vS(i,e){setTimeout(function(){i(e)},0)}function Qae(i){if(i.extent!==void 0){let t=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return t5(i.extent,i.constrainOnlyCenter,t)}let e=Rw(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&e.isGlobal()){let t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,t5(t,!1,!1)}return iq}function Jae(i){let e,t,n,o=i.minZoom!==void 0?i.minZoom:o5,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=Rw(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=rq(S,u,!v&&w,f):e=r5(t,n,u,!v&&w,f)}else{let T=(x?Math.max(jn(x),xr(x)):360*tf.degrees/p.getMetersPerUnit())/256/Math.pow(2,o5),P=T/Math.pow(2,28-o5);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=sq(l,t,n,u,!v&&w,f):e=r5(t,n,u,!v&&w,f)}return{constraint:e,maxResolution:t,minResolution:n,minZoom:o,zoomFactor:l}}function ele(i){if(i.enableRotation!==void 0?i.enableRotation:!0){let t=i.constrainRotation;return t===void 0||t===!0?aq():t===!1?s5:typeof t=="number"?oq(t):s5}return Ug}function tle(i){return!(i.sourceCenter&&i.targetCenter&&!H0(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function a5(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 Al=l5;var c5=class extends bs{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)ri(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!==of&&this.listenerKeys.push(kn(e,Lu.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}},kg=c5;var u5=class extends kg{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+" "+Id+" "+Lg+(this.collapsed_&&this.collapsible_?" "+TI:"")+(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=>rz(()=>r))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!Fo(t,this.renderedAttributions_)){hz(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(TI),this.collapsed_?OP(this.collapseLabel_,this.label_):OP(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)}},lq=u5;var h5=class extends kg{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+" "+Id+" "+Lg,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(Vx)}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:Xl}):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(Vx);!s&&n===0?this.element.classList.add(Vx):s&&n!==0&&this.element.classList.remove(Vx)}this.label_.style.transform=r}this.rotation_=n}},cq=h5;var f5=class extends kg{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+" "+Id+" "+Lg,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:Xl})):n.setZoom(s)}}},uq=f5;function bS(i){i=i||{};let e=new fo;return(i.zoom===void 0||i.zoom)&&e.push(new uq(i.zoomOptions)),(i.rotate===void 0||i.rotate)&&e.push(new cq(i.rotateOptions)),(i.attribution===void 0||i.attribution)&&e.push(new lq(i.attributionOptions)),e}var d5=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_}},hq=d5;var p5={ACTIVE:"active"};var A5=class extends bs{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(p5.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(p5.ACTIVE,e)}setMap(e){this.map_=e}};function fq(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:uz,center:i.getConstrainedCenter(r)})}}function Gg(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:Xl})}var Du=A5;var m5=class extends Du{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==rr.DBLCLICK){let n=e.originalEvent,r=e.map,s=e.coordinate,o=n.shiftKey?-this.delta_:this.delta_,a=r.getView();Gg(a,o,s,this.duration_),n.preventDefault(),t=!0}return!t}},dq=m5;function Kx(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 pq=function(i){let e=i.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},nle=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)},wS=function(i){let e=i.map.getTargetElement(),t=e.getRootNode();return(t instanceof ShadowRoot?t.host:e).hasAttribute("tabindex")?nle(i):!0},Aq=rf;var SS=function(i){let e=i.originalEvent;return"pointerId"in e&&e.button==0&&!(sz&&IP&&e.ctrlKey)};var TS=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey};var mq=function(i){let e=i.originalEvent;return IP?e.metaKey:e.ctrlKey},gq=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},ES=function(i){let e=i.originalEvent,t=e.target.tagName;return t!=="INPUT"&&t!=="SELECT"&&t!=="TEXTAREA"&&!e.target.isContentEditable},MS=function(i){let e=i.originalEvent;return"pointerId"in e&&e.pointerType=="mouse"};var _q=function(i){let e=i.originalEvent;return"pointerId"in e&&e.isPrimary&&e.button===0};var g5=class extends Du{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==rr.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==rr.POINTERUP){let n=this.handleUpEvent(e);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(e.type==rr.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==rr.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 zg(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 Fu=g5;var _5=class extends Fu{constructor(e){super({stopDown:sf}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let t=e.condition?e.condition:Kx(TS,_q);this.condition_=e.onFocusOnly?Kx(wS,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(zg(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();xG(s,a.getResolution()),pg(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:Xl})}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}},xq=_5;var x5=class extends Fu{constructor(e){e=e||{},super({stopDown:sf}),this.condition_=e.condition?e.condition:pq,this.lastAngle_=void 0,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){if(!MS(e))return;let t=e.map,n=t.getView();if(n.getConstraints().rotation===Ug)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 MS(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return MS(e)&&SS(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},yq=x5;var y5=class extends wd{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 Cu([r])}getGeometry(){return this.geometry_}},vq=y5;var Vg={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"},aA=class extends Ks{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},v5=class extends Fu{constructor(e){super(),this.on,this.once,this.un,e=e??{},this.box_=new vq(e.className||"ol-dragbox"),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??SS,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 aA(Vg.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 aA(t?Vg.BOXEND:Vg.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 aA(Vg.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new aA(Vg.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new aA(Vg.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(e)}},bq=v5;var b5=class extends bq{constructor(e){e=e||{};let t=e.condition?e.condition:gq;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:Xl})}},wq=b5;var Dd={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};var w5=class extends Du{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return TS(t)&&ES(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==Dd.DOWN||r==Dd.LEFT||r==Dd.RIGHT||r==Dd.UP)){let o=e.map.getView(),a=o.getResolution()*this.pixelDelta_,l=0,c=0;r==Dd.DOWN?c=-a:r==Dd.LEFT?l=-a:r==Dd.RIGHT?l=a:c=a;let u=[l,c];pg(u,o.getRotation()),fq(o,u,this.duration_),n.preventDefault(),t=!0}}return!t}},Sq=w5;var S5=class extends Du{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:function(t){return!mq(t)&&ES(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();Gg(a,o,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},Tq=S5;var ile=40,rle=300,sle=3,T5=class extends Du{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:Aq;this.condition_=e.onFocusOnly?Kx(wS,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(ri),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(e),e){let t=e.getOwnerDocument();this.ctrlKeyListenerKeys_.push(kn(t,"keydown",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!0)}),kn(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*=ile;break;case WheelEvent.DOM_DELTA_PAGE:o*=rle;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*sle),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=-xi(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),Gg(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)}},Eq=T5;var E5=class extends Fu{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=sf),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!==Ug&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(zg(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}},Mq=E5;var M5=class extends Fu{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=sf),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(zg(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}},Cq=M5;function CS(i){i=i||{};let e=new fo,t=new hq(-.005,.05,100);return(i.altShiftDragRotate===void 0||i.altShiftDragRotate)&&e.push(new yq),(i.doubleClickZoom===void 0||i.doubleClickZoom)&&e.push(new dq({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan===void 0||i.dragPan)&&e.push(new xq({onFocusOnly:i.onFocusOnly,kinetic:t})),(i.pinchRotate===void 0||i.pinchRotate)&&e.push(new Mq),(i.pinchZoom===void 0||i.pinchZoom)&&e.push(new Cq({duration:i.zoomDuration})),(i.keyboard===void 0||i.keyboard)&&(e.push(new Sq),e.push(new Tq({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom===void 0||i.mouseWheelZoom)&&e.push(new Eq({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom===void 0||i.shiftDragZoom)&&e.push(new wq({duration:i.zoomDuration})),e}var Ei={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 C5=class extends bs{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[Ei.OPACITY]=e.opacity!==void 0?e.opacity:1,Vn(typeof t[Ei.OPACITY]=="number","Layer opacity must be a number"),t[Ei.VISIBLE]=e.visible!==void 0?e.visible:!0,t[Ei.Z_INDEX]=e.zIndex,t[Ei.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[Ei.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[Ei.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[Ei.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=xi(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 Kn()}getLayerStatesArray(e){return Kn()}getExtent(){return this.get(Ei.EXTENT)}getMaxResolution(){return this.get(Ei.MAX_RESOLUTION)}getMinResolution(){return this.get(Ei.MIN_RESOLUTION)}getMinZoom(){return this.get(Ei.MIN_ZOOM)}getMaxZoom(){return this.get(Ei.MAX_ZOOM)}getOpacity(){return this.get(Ei.OPACITY)}getSourceState(){return Kn()}getVisible(){return this.get(Ei.VISIBLE)}getZIndex(){return this.get(Ei.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(Ei.EXTENT,e)}setMaxResolution(e){this.set(Ei.MAX_RESOLUTION,e)}setMinResolution(e){this.set(Ei.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(Ei.MAX_ZOOM,e)}setMinZoom(e){this.set(Ei.MIN_ZOOM,e)}setOpacity(e){Vn(typeof e=="number","Layer opacity must be a number"),this.set(Ei.OPACITY,e)}setVisible(e){this.set(Ei.VISIBLE,e)}setZIndex(e){this.set(Ei.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},RS=C5;var Fd={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"},Bc=class extends Ks{constructor(e,t){super(e),this.layer=t}},R5={LAYERS:"layers"},P5=class i extends RS{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(R5.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new fo(n.slice(),{unique:!0}):Vn(typeof n.getArray=="function","Expected `layers` to be an array or a `Collection`"):n=new fo(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(ri),this.layersListenerKeys_.length=0;let e=this.getLayers();this.layersListenerKeys_.push(kn(e,Qs.ADD,this.handleLayersAdd_,this),kn(e,Qs.REMOVE,this.handleLayersRemove_,this));for(let n in this.listenerKeys_)this.listenerKeys_[n].forEach(ri);wu(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 Bc(Fd.ADDLAYER,s))}this.changed()}registerLayerListeners_(e){let t=[kn(e,Ic.PROPERTYCHANGE,this.handleLayerChange_,this),kn(e,Jt.CHANGE,this.handleLayerChange_,this)];e instanceof i&&t.push(kn(e,Fd.ADDLAYER,this.handleLayerGroupAdd_,this),kn(e,Fd.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[Ln(e)]=t}handleLayerGroupAdd_(e){this.dispatchEvent(new Bc(Fd.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new Bc(Fd.REMOVELAYER,e.layer))}handleLayersAdd_(e){let t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new Bc(Fd.ADDLAYER,t)),this.changed()}handleLayersRemove_(e){let t=e.element,n=Ln(t);this.listenerKeys_[n].forEach(ri),delete this.listenerKeys_[n],this.dispatchEvent(new Bc(Fd.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(R5.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 Bc(Fd.REMOVELAYER,n[r]))}this.set(R5.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=yu(l.extent,r.extent):l.extent=r.extent),l.zIndex===void 0&&(l.zIndex=s)}return t}getSourceState(){return"ready"}},Zx=P5;var Ao={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var I5=class extends RS{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(Ei.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(Ei.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_&&(ri(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;let e=this.getSource();e&&(this.sourceChangeKey_=kn(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 Al?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||yr(s,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t=this.getSource()?.getAttributions();if(!t)return[];let n=e instanceof Al?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(Ei.MAP,e)}getMapInternal(){return this.get(Ei.MAP)}setMap(e){this.mapPrecomposeKey_&&(ri(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(ri(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=kn(e,Ao.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=kn(this,Jt.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){let t=e.frameState.layerStatesArray,n=this.getLayerState(!1);Vn(!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(Ei.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 lA=I5;function PS(i,e,t=0,n=i.length-1,r=ole){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));PS(i,e,x,v,r)}let s=i[e],o=t,a=n;for(Jx(i,t,e),r(i[n],s)>0&&Jx(i,t,n);o<a;){for(Jx(i,o,a),o++,a--;r(i[o],s)<0;)o++;for(;r(i[a],s)>0;)a--}r(i[t],s)===0?Jx(i,t,a):(a++,Jx(i,a,n)),a<=e&&(t=a+1),e<=a&&(n=a-1)}}function Jx(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function ole(i,e){return i<e?-1:i>e?1:0}var cA=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(!NS(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;NS(e,l)&&(t.leaf?n.push(a):L5(e,l)?this._all(a,n):s.push(a))}t=s.pop()}return n}collides(e){let t=this.data;if(!NS(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(NS(e,o)){if(t.leaf||L5(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=Hg([]),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=ale(e,n.children,t);if(u!==-1)return n.children.splice(u,1),s.push(n),this._condense(s),this}!c&&!n.leaf&&L5(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=Hg(e.slice(t,n+1)),qg(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=Hg([]),a.leaf=!1,a.height=r;let l=Math.ceil(s/o),c=l*Math.ceil(Math.sqrt(o));Rq(e,t,n,c,this.compareMinX);for(let u=t;u<=n;u+=c){let f=Math.min(u+c-1,n);Rq(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 qg(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=N5(c),f=ule(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),ty(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=Hg(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,qg(n,this.toBBox),qg(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(n,a)}_splitRoot(e,t){this.data=Hg([e,t]),this.data.height=e.height+1,this.data.leaf=!1,qg(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=ey(e,0,a,this.toBBox),c=ey(e,a,n,this.toBBox),u=hle(l,c),f=N5(l)+N5(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:lle,s=e.leaf?this.compareMinY:cle,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=ey(e,0,t,s),a=ey(e,n-t,n,s),l=IS(o)+IS(a);for(let c=t;c<n-t;c++){let u=e.children[c];ty(o,e.leaf?s(u):u),l+=IS(o)}for(let c=n-t-1;c>=t;c--){let u=e.children[c];ty(a,e.leaf?s(u):u),l+=IS(a)}return l}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)ty(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():qg(e[t],this.toBBox)}};function ale(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 qg(i,e){ey(i,0,i.children.length,e,i)}function ey(i,e,t,n,r){r||(r=Hg(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];ty(r,i.leaf?n(o):o)}return r}function ty(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 lle(i,e){return i.minX-e.minX}function cle(i,e){return i.minY-e.minY}function N5(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function IS(i){return i.maxX-i.minX+(i.maxY-i.minY)}function ule(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 hle(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 L5(i,e){return i.minX<=e.minX&&i.minY<=e.minY&&e.maxX<=i.maxX&&e.maxY<=i.maxY}function NS(i,e){return e.minX<=i.maxX&&e.minY<=i.maxY&&e.maxX>=i.minX&&e.maxY>=i.minY}function Hg(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Rq(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;PS(i,o,e,t,r),s.push(e,o,o,t)}}var hA=0,DS=0,Uo=1<<hA++,si=1<<hA++,ko=1<<hA++,ca=1<<hA++,Af=1<<hA++,uA=1<<hA++,FS=Math.pow(2,hA)-1,F5={[Uo]:"boolean",[si]:"number",[ko]:"string",[ca]:"color",[Af]:"number[]",[uA]:"size"},fle=Object.keys(F5).map(Number).sort(Va);function dle(i){return i in F5}function pf(i){let e=[];for(let t of fle)ny(i,t)&&e.push(F5[t]);return e.length===0?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function ny(i,e){return(i&e)===e}function LS(i,e){return!!(i&e)}function Od(i,e){return i===e}var Nr=class{constructor(e,t){if(!dle(e))throw new Error(`literal expressions must have a specific type, got ${pf(e)}`);this.type=e,this.value=t}},OS=class{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}};function BS(i){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:i}}function $r(i,e,t){switch(typeof i){case"boolean":{if(Od(e,ko))return new Nr(ko,i?"true":"false");if(!ny(e,Uo))throw new Error(`got a boolean, but expected ${pf(e)}`);return new Nr(Uo,i)}case"number":{if(Od(e,uA))return new Nr(uA,jr(i));if(Od(e,Uo))return new Nr(Uo,!!i);if(Od(e,ko))return new Nr(ko,i.toString());if(!ny(e,si))throw new Error(`got a number, but expected ${pf(e)}`);return new Nr(si,i)}case"string":{if(Od(e,ca))return new Nr(ca,kx(i));if(Od(e,Uo))return new Nr(Uo,!!i);if(!ny(e,ko))throw new Error(`got a string, but expected ${pf(e)}`);return new Nr(ko,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 Tle(i,e,t);for(let n of i)if(typeof n!="number")throw new Error("expected an array of numbers");if(Od(e,uA)){if(i.length!==2)throw new Error(`expected an array of two values for a size, got ${i.length}`);return new Nr(uA,i)}if(Od(e,ca)){if(i.length===3)return new Nr(ca,[...i,1]);if(i.length===4)return new Nr(ca,i);throw new Error(`expected an array of 3 or 4 values for a color, got ${i.length}`)}if(!ny(e,Af))throw new Error(`got an array of numbers, but expected ${pf(e)}`);return new Nr(Af,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"},ple={[Je.Get]:Fn(Zn(1,1/0),Pq),[Je.Var]:Ale(),[Je.Has]:Fn(Zn(1,1/0),Pq),[Je.Id]:Fn(mle,Wg),[Je.Concat]:Fn(Zn(2,1/0),zi(ko)),[Je.GeometryType]:Fn(gle,Wg),[Je.LineMetric]:Fn(_le,Wg),[Je.Resolution]:Fn(D5,Wg),[Je.Zoom]:Fn(D5,Wg),[Je.Time]:Fn(D5,Wg),[Je.Any]:Fn(Zn(2,1/0),zi(Uo)),[Je.All]:Fn(Zn(2,1/0),zi(Uo)),[Je.Not]:Fn(Zn(1,1),zi(Uo)),[Je.Equal]:Fn(Zn(2,2),Nq()),[Je.NotEqual]:Fn(Zn(2,2),Nq()),[Je.GreaterThan]:Fn(Zn(2,2),zi(si)),[Je.GreaterThanOrEqualTo]:Fn(Zn(2,2),zi(si)),[Je.LessThan]:Fn(Zn(2,2),zi(si)),[Je.LessThanOrEqualTo]:Fn(Zn(2,2),zi(si)),[Je.Multiply]:Fn(Zn(2,1/0),Iq),[Je.Coalesce]:Fn(Zn(2,1/0),Iq),[Je.Divide]:Fn(Zn(2,2),zi(si)),[Je.Add]:Fn(Zn(2,1/0),zi(si)),[Je.Subtract]:Fn(Zn(2,2),zi(si)),[Je.Clamp]:Fn(Zn(3,3),zi(si)),[Je.Mod]:Fn(Zn(2,2),zi(si)),[Je.Pow]:Fn(Zn(2,2),zi(si)),[Je.Abs]:Fn(Zn(1,1),zi(si)),[Je.Floor]:Fn(Zn(1,1),zi(si)),[Je.Ceil]:Fn(Zn(1,1),zi(si)),[Je.Round]:Fn(Zn(1,1),zi(si)),[Je.Sin]:Fn(Zn(1,1),zi(si)),[Je.Cos]:Fn(Zn(1,1),zi(si)),[Je.Atan]:Fn(Zn(1,2),zi(si)),[Je.Sqrt]:Fn(Zn(1,1),zi(si)),[Je.Match]:Fn(Zn(4,1/0),Lq,yle),[Je.Between]:Fn(Zn(3,3),zi(si)),[Je.Interpolate]:Fn(Zn(6,1/0),Lq,vle),[Je.Case]:Fn(Zn(3,1/0),xle,ble),[Je.In]:Fn(Zn(2,2),wle),[Je.Number]:Fn(Zn(1,1/0),zi(FS)),[Je.String]:Fn(Zn(1,1/0),zi(FS)),[Je.Array]:Fn(Zn(1,1/0),zi(si)),[Je.Color]:Fn(Zn(1,4),zi(si)),[Je.Band]:Fn(Zn(1,3),zi(si)),[Je.Palette]:Fn(Zn(2,2),Sle),[Je.ToString]:Fn(Zn(1,1),zi(Uo|si|ko|ca))};function Pq(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 Nr(si,o);break}case"string":{r[s]=new Nr(ko,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 Ale(){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=$r(s,FS,t);if(!(o instanceof Nr))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${n}`);let a=o.type;if(typeof s=="string"&&LS(r,ca)&&!LS(r,ko)?a=ca:Array.isArray(s)&&s.length===2&&LS(r,uA)&&!LS(r,Af)&&(a=uA),r&=a,r===DS)throw new Error(`the type expected from the var operator (${pf(e)}) did not have any overlap with the type of the corresponding style variables (${pf(a)}), variable name: ${n}`)}if(t.variables.has(n)){let o=t.variables.get(n);if(r&=o,r===DS)throw new Error(`a new type expected from the var operator (${pf(e)}) did not have any overlap with the previous type expected for it (${pf(o)}), variable name: ${n}`)}return t.variables.set(n,r),new OS(r,"var",new Nr(ko,n))}}function mle(i,e,t){t.featureId=!0}function gle(i,e,t){t.geometryType=!0}function _le(i,e,t){t.mCoordinate=!0}function D5(i,e,t){t.mapState=!0}function Wg(i,e,t){let n=i[0];if(i.length!==1)throw new Error(`expected no arguments for ${n} operation`);return[]}function Zn(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 Iq(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=$r(i[s+1],e,t);r[s]=o}return r}function zi(i){return function(e,t,n){let r=e.length-1,s=new Array(r);for(let o=0;o<r;++o){let a=$r(e[o+1],i,n);s[o]=a}return s}}function Nq(){return function(i,e,t){let n=i[0],r=i.length-1,s=new Array(r),o=FS;for(let a=0;a<r;++a){let l=$r(i[a+1],o,t);o&=l.type}if(o===DS)throw new Error(`no common type was found among the arguments of ${n}`);for(let a=0;a<r;++a){let l=$r(i[a+1],o,t);s[a]=l}return s}}function xle(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 Lq(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 yle(i,e,t){let n=i.length-1,r=$r(i[i.length-1],e,t),s=ko|si|Uo,o=new Array(n-2);for(let l=0;l<n-2;l+=2){try{let c=$r(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===DS)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=$r(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=$r(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[$r(i[1],s,t),...o,r]}function vle(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 Nr(si,r),o;try{o=$r(i[2],si,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=$r(i[l+3],si,t);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${c.message}`)}try{let c=$r(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 ble(i,e,t){let n=$r(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=$r(i[s+1],Uo,t);r[s]=o}catch(o){throw new Error(`failed to parse argument ${s} of case expression: ${o.message}`)}try{let o=$r(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 wle(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=ko:r=si;let s=new Array(n.length);for(let a=0;a<s.length;a++)try{let l=$r(n[a],r,t);s[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[$r(i[1],r,t),...s]}function Sle(i,e,t){let n;try{n=$r(i[1],si,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=$r(r[o],ca,t)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof Nr))throw new Error(`the palette color at index ${o} must be a literal value`);s[o]=a}return[n,...s]}function Fn(...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 OS(t,r,...s)}}function Tle(i,e,t){let n=i[0],r=ple[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(i,e,t)}function US(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 US(i.getGeometries()[0]);default:return""}}function O5(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function kc(i,e,t){let n=$r(i,e,t);return Uc(n,t)}function Uc(i,e){if(i instanceof Nr){if(i.type===ca&&typeof i.value=="string"){let n=kx(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 Ele(i,e);case Je.Get:case Je.Var:case Je.Has:return Mle(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=>Uc(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 Rle(i,e);case Je.Equal:case Je.NotEqual:case Je.LessThan:case Je.LessThanOrEqualTo:case Je.GreaterThan:case Je.GreaterThanOrEqualTo:return Cle(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 Ple(i,e);case Je.Case:return Ile(i,e);case Je.Match:return Nle(i,e);case Je.Interpolate:return Lle(i,e);case Je.ToString:return Dle(i,e);default:throw new Error(`Unsupported operator ${t}`)}}function Ele(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Uc(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 Mle(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 Cle(i,e){let t=i.operator,n=Uc(i.args[0],e),r=Uc(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 Rle(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Uc(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 Ple(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Uc(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 Ile(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Uc(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 Nle(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Uc(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 Lle(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Uc(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=oV(f)),u>=o)return c===2?f:p?Fle(s,o,a,l,u,f):iy(s,o,a,l,u,f);a=u,l=f}return l}}function Dle(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Uc(i.args[s],e);if(t===Je.ToString)return s=>{let o=r[0](s);return i.args[0].type===ca?Gx(o):o.toString()};throw new Error(`Unsupported convert operator ${t}`)}function iy(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 Fle(i,e,t,n,r,s){if(r-t===0)return n;let a=bI(n),l=bI(s),c=l[2]-a[2];c>180?c-=360:c<-180&&(c+=360);let u=[iy(i,e,t,a[0],r,l[0]),iy(i,e,t,a[1],r,l[1]),a[2]+iy(i,e,t,0,r,c),iy(i,e,t,n[3],r,s[3])];return aV(u)}function Ole(i){return!0}function Ble(i,e){e=e??BS();let t=Ule(i,e),n=O5();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=US(r.getGeometry())),t(n)}}function Dq(i,e){e=e??BS();let t=i.length,n=new Array(t);for(let o=0;o<t;++o)n[o]=B5(i[o],e);let r=O5(),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=US(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 Uq(i,e){if(e=e??BS(),!Array.isArray(i))return Dq([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 Ble(s,e)}return Dq(i,e)}function Ule(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?kc(s.filter,Uo,e):Ole,a;if(Array.isArray(s.style)){let l=s.style.length;a=new Array(l);for(let c=0;c<l;++c)a[c]=B5(s.style[c],e)}else a=[B5(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 B5(i,e){let t=ry(i,"",e),n=sy(i,"",e),r=kle(i,e),s=Gle(i,e),o=mo(i,"z-index",e);if(!t&&!n&&!r&&!s&&!Ec(i))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(i));let a=new ws;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 ry(i,e,t){let n;if(e+"fill-pattern-src"in i)n=Hle(i,e+"fill-",t);else{if(i[e+"fill-color"]==="none")return s=>null;n=GS(i,e+"fill-color",t)}if(!n)return null;let r=new Xr;return function(s){let o=n(s);return o===oS?null:(r.setColor(o),r)}}function sy(i,e,t){let n=mo(i,e+"stroke-width",t),r=GS(i,e+"stroke-color",t);if(!n&&!r)return null;let s=mf(i,e+"stroke-line-cap",t),o=mf(i,e+"stroke-line-join",t),a=kq(i,e+"stroke-line-dash",t),l=mo(i,e+"stroke-line-dash-offset",t),c=mo(i,e+"stroke-miter-limit",t),u=mo(i,e+"stroke-offset",t),f=new ho;return function(p){if(r){let x=r(p);if(x===oS)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 kle(i,e){let t="text-",n=mf(i,t+"value",e);if(!n)return null;let r=ry(i,t,e),s=ry(i,t+"background-",e),o=sy(i,t,e),a=sy(i,t+"background-",e),l=mf(i,t+"font",e),c=mo(i,t+"max-angle",e),u=mo(i,t+"offset-x",e),f=mo(i,t+"offset-y",e),p=jg(i,t+"overflow",e),x=mf(i,t+"placement",e),v=mo(i,t+"repeat",e),w=zS(i,t+"scale",e),S=jg(i,t+"rotate-with-view",e),T=mo(i,t+"rotation",e),P=mf(i,t+"align",e),R=mf(i,t+"justify",e),C=mf(i,t+"baseline",e),L=jg(i,t+"keep-upright",e),D=kq(i,t+"padding",e),F=VS(i,t+"declutter-mode"),N=new ff({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 Gle(i,e){return"icon-src"in i?zle(i,e):"shape-points"in i?Vle(i,e):"circle-radius"in i?qle(i,e):null}function zle(i,e){let t="icon-",n=t+"src",r=Gq(i[n],n),s=kS(i,t+"anchor",e),o=zS(i,t+"scale",e),a=mo(i,t+"opacity",e),l=kS(i,t+"displacement",e),c=mo(i,t+"rotation",e),u=jg(i,t+"rotate-with-view",e),f=Oq(i,t+"anchor-origin"),p=Bq(i,t+"anchor-x-units"),x=Bq(i,t+"anchor-y-units"),v=gf(i,t+"color"),w,S=null;v!==void 0&&(Array.isArray(v)&&v.length>0&&typeof v[0]=="string"?S=GS(i,t+"color",e):w=zq(v,t+"color"));let T=jle(i,t+"cross-origin"),P=Xle(i,t+"offset"),R=Oq(i,t+"offset-origin"),C=U5(i,t+"width"),L=U5(i,t+"height"),D=Wle(i,t+"size"),F=VS(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 rA(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 Vle(i,e){let t="shape-",n=t+"points",r=t+"radius",s=k5(i[n],n);if(!(r in i))throw new Error(`Expected a number for ${r}`);let o=mo(i,r,e),a=typeof i[r]=="number"?i[r]:5,l=t+"radius2",c=mo(i,l,e),u=typeof i[l]=="number"?i[l]:void 0,f=ry(i,t,e),p=sy(i,t,e),x=zS(i,t+"scale",e),v=kS(i,t+"displacement",e),w=mo(i,t+"rotation",e),S=jg(i,t+"rotate-with-view",e),T=U5(i,t+"angle"),P=VS(i,t+"declutter-mode"),R=new fS({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 qle(i,e){let t="circle-",n=ry(i,t,e),r=sy(i,t,e),s=mo(i,t+"radius",e),o=zS(i,t+"scale",e),a=kS(i,t+"displacement",e),l=mo(i,t+"rotation",e),c=jg(i,t+"rotate-with-view",e),u=VS(i,t+"declutter-mode"),f=new dS({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 gf(i,e){if(!(e in i))return;let t=i[e];return t===void 0?void 0:t}function mo(i,e,t){let n=gf(i,e);if(n===void 0)return;let r=kc(n,si,t);return function(s){return k5(r(s),e)}}function mf(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=kc(n,ko,t);return function(s){return Gq(r(s),e)}}function Hle(i,e,t){let n=mf(i,e+"pattern-src",t),r=Fq(i,e+"pattern-offset",t),s=Fq(i,e+"pattern-size",t),o=GS(i,e+"color",t);return function(a){return{src:n(a),offset:r&&r(a),size:s&&s(a),color:o&&o(a)}}}function jg(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=kc(n,Uo,t);return function(s){let o=r(s);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${e}`);return o}}function GS(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=kc(n,ca,t);return function(s){return zq(r(s),e)}}function kq(i,e,t){let n=gf(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=kc(o,si,t);return function(c){return k5(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=kc(n,Af,t);return function(s){return oy(r(s),e)}}function kS(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=kc(n,Af,t);return function(s){let o=oy(r(s),e);if(o.length!==2)throw new Error(`Expected two numbers for ${e}`);return o}}function Fq(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=kc(n,Af,t);return function(s){return Vq(r(s),e)}}function zS(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=kc(n,Af|si,t);return function(s){return $le(r(s),e)}}function U5(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 Wle(i,e){let t=i[e];if(t!==void 0){if(typeof t=="number")return jr(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 jle(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 Oq(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 Bq(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 Xle(i,e){let t=i[e];if(t!==void 0)return oy(t,e)}function VS(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 oy(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 Gq(i,e){if(typeof i!="string")throw new Error(`Expected a string for ${e}`);return i}function k5(i,e){if(typeof i!="number")throw new Error(`Expected a number for ${e}`);return i}function zq(i,e){if(typeof i=="string")return i;let t=oy(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 Vq(i,e){let t=oy(i,e);if(t.length!==2)throw new Error(`Expected an array of two numbers for ${e}`);return t}function $le(i,e){return typeof i=="number"?i:Vq(i,e)}var qq={RENDER_ORDER:"renderOrder"},G5=class extends lA{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(qq.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 cA(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(qq.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?FI:e;let t=Yle(e);this.styleFunction_=e===null?void 0:xV(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function Yle(i){if(i===void 0)return FI;if(!i)return null;if(typeof i=="function"||i instanceof ws)return i;if(Array.isArray(i)&&i.length===0)return[];if(Array.isArray(i)&&i[0]instanceof ws){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r];if(!(s instanceof ws))throw new Error("Expected a list of style instances");n[r]=s}return n}return Uq(i)}var qS=G5;var z5=class extends Ks{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r}},HS=z5;var V5=class extends wd{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){Kn()}calculateMatrices2D(e){let t=e.viewState,n=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;uo(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),Gw(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=bw(e.slice(),p),v=[[0,0]];if(p.canWrapX()&&r){let C=p.getExtent(),L=jn(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,rf,this,s,o)!==void 0}getMap(){return this.map_}renderFrame(e){Kn()}scheduleExpireIconCache(e){Oo.canExpireCache()&&e.postRenderFunctions.push(Kle)}};function Kle(i,e){Oo.expire()}var Hq=V5;var q5=class extends Hq{constructor(e){super(e),this.fontChangeListenerKey_=kn(nA,Ic.PROPERTYCHANGE,e.redrawText,e),this.element_=Us?Bw():document.createElement("div");let t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=Id+" 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 HS(e,void 0,t);n.dispatchEvent(r)}}disposeInternal(){ri(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(Ao.PRECOMPOSE,e);let t=e.layerStatesArray.sort((u,f)=>u.zIndex-f.zIndex);t.some(u=>u.layer instanceof qS&&u.layer.getDeclutter())&&(e.declutter={});let r=e.viewState;this.children_.length=0;let o=this.getMap().getTargetElement(),a;pl(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),fz(this.element_,this.children_);for(let u of a?this.children_:[]){let f=u.firstElementChild||u,p=u.style.backgroundColor;if(p&&(!pl(f)||f.width>0)&&(a.fillStyle=p,a.fillRect(0,0,a.canvas.width,a.canvas.height)),!pl(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(...kw(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(Ao.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))}}},Wq=q5;function jq(i){if(i instanceof lA){i.setMapInternal(null);return}i instanceof Zx&&i.getLayers().forEach(jq)}function Xq(i,e){if(i instanceof lA){i.setMapInternal(e);return}if(i instanceof Zx){let t=i.getLayers().getArray();for(let n=0,r=t.length;n<r;++n)Xq(t[n],e)}}var H5=class extends bs{constructor(e){super(),e=e||{},this.on,this.once,this.un;let t=Zle(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:oz,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=Zs(),this.pixelToCoordinateTransform_=Zs(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,Us||(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,Us||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=t.controls||(Us?new fo:bS()),this.interactions=t.interactions||(Us?new fo:CS({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new tq(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(po.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(po.VIEW,this.handleViewChanged_),this.addChangeListener(po.SIZE,this.handleSizeChanged_),this.addChangeListener(po.TARGET,this.handleTargetChanged_),this.setProperties(t.values);let n=this;e.view&&!(e.view instanceof Al)&&e.view.then(function(r){n.setView(new Al(r))}),this.controls.addEventListener(Qs.ADD,r=>{r.element.setMap(this)}),this.controls.addEventListener(Qs.REMOVE,r=>{r.element.setMap(null)}),this.interactions.addEventListener(Qs.ADD,r=>{r.element.setMap(this)}),this.interactions.addEventListener(Qs.REMOVE,r=>{r.element.setMap(null)}),this.overlays_.addEventListener(Qs.ADD,r=>{this.addOverlayInternal_(r.element)}),this.overlays_.addEventListener(Qs.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){Xq(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:rf,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 Zx?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:rf,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(po.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return Tx(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){let t=this.frameState_;return t?Ir(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(po.LAYERGROUP)}setLayers(e){let t=this.getLayerGroup();if(e instanceof fo){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=Cc(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){let t=this.frameState_;return t?Ir(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(po.SIZE)}getView(){return this.get(po.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 nq(this.frameState_,e,t,n,r)}handleBrowserEvent(e,t){t=t||e.type;let n=new Nu(t,this,e);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(e){if(!this.frameState_)return;let t=e.originalEvent,n=t.type;if(n===$x.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[Gs.ANIMATING]||o[Gs.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(Ao.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Ao.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Ld(Lu.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Ld(Lu.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)ri(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_&&!pl(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(pl(t)||t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new Wq(this)),!pl(t)){this.mapBrowserEventHandler_=new JV(this,this.moveTolerance_);for(let r in rr)this.mapBrowserEventHandler_.addEventListener(rr[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(Jt.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(Jt.WHEEL,this.boundHandleBrowserEvent_,Ow?{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_=[kn(n,Jt.KEYDOWN,this.handleBrowserEvent,this),kn(n,Jt.KEYPRESS,this.handleBrowserEvent,this)],!pl(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_&&(ri(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(ri(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);let e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=kn(e,Ic.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=kn(e,Jt.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(ri),this.layerGroupPropertyListenerKeys_=null);let e=this.getLayerGroup();e&&(this.handleLayerAdd_(new Bc("addlayer",e)),this.layerGroupPropertyListenerKeys_=[kn(e,Ic.PROPERTYCHANGE,this.render,this),kn(e,Jt.CHANGE,this.render,this),kn(e,"addlayer",this.handleLayerAdd_,this),kn(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){jq(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&&SP(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:vx(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:Ln(this),renderTargets:{}},a.nextCenter&&a.nextResolution){let l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;s.nextExtent=vx(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_||!vu(this.previousExtent_)&&!z0(s.extent,this.previousExtent_))&&(this.dispatchEvent(new Ld(Lu.MOVESTART,this,r)),this.previousExtent_=G0(this.previousExtent_)),this.previousExtent_&&!s.viewHints[Gs.ANIMATING]&&!s.viewHints[Gs.INTERACTING]&&!z0(s.extent,this.previousExtent_)&&(this.dispatchEvent(new Ld(Lu.MOVEEND,this,s)),pw(s.extent,this.previousExtent_))),this.dispatchEvent(new Ld(Lu.POSTRENDER,this,s)),this.renderComplete_=(this.hasListener(Lu.LOADSTART)||this.hasListener(Lu.LOADEND)||this.hasListener(Ao.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 Bc("removelayer",t)),this.set(po.LAYERGROUP,e)}setSize(e){this.set(po.SIZE,e)}setTarget(e){this.set(po.TARGET,e)}setView(e){if(!e||e instanceof Al){this.set(po.VIEW,e);return}this.set(po.VIEW,new Al);let t=this;e.then(function(n){t.setView(new Al(n))})}updateSize(){let e=this.getTargetElement(),t;if(e){let r,s;if(pl(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)],!SP(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&xw("No map visible because the map container's width or height are 0."))}let n=this.getSize();t&&(!n||!Fo(t,n))&&(this.updateViewportSize_(t),this.setSize(t))}updateViewportSize_(e){let t=this.getView();t&&t.setViewportSize(e)}};function Zle(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 Zx({layers:i.layers});t[po.LAYERGROUP]=n,t[po.TARGET]=i.target,t[po.VIEW]=i.view instanceof Al?i.view:new Al;let r;i.controls!==void 0&&(Array.isArray(i.controls)?r=new fo(i.controls.slice()):(Vn(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 fo(i.interactions.slice()):(Vn(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 fo(i.overlays.slice()):(Vn(typeof i.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=i.overlays):o=new fo,{controls:r,interactions:s,keyboardEventTarget:e,overlays:o,values:t}}var $q=H5;function WS(i){return i instanceof Image||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageBitmap?i:null}var Qle=new Error("disposed");var Jle=[256,256],W5=class extends Eg{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=WS(this.data_);return e?[e.width,e.height]:Jle}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(Qle),this.controller_=null),super.disposeInternal()}},j5=W5;var X5=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 wd&&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 Vn(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 Vn(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){Vn(!(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}},$5=X5;var Y5=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(Cx(),{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}},jS=Y5;var ece=5,K5=class extends Vw{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=ece,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 Kn()}getData(e){return null}prepareFrame(e){return Kn()}renderFrame(e,t){return Kn()}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=K5;var Q5=[],Xg=null;function tce(){Xg=Ti(1,1,void 0,{willReadFrequently:!0})}var Z5=class extends Yq{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=Zs(),this.pixelTransform=Zs(),this.inversePixelTransform=Zs(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){Xg||tce(),Xg.clearRect(0,0,1,1);let r;try{Xg.drawImage(e,t,n,1,1,0,0,1,1),r=Xg.getImageData(0,0,1,1).data}catch{return Xg=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(pl(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&&Fo(Yl(e.style.backgroundColor),Yl(n)))){let c=e.firstElementChild;pl(c)&&(l=c.getContext("2d"))}if(l&&xz(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=Us?Bw():document.createElement("div"),a.className=o;let c=a.style;c.position="absolute",c.width="100%",c.height="100%",l=Ti();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=Wl(n),s=dg(n),o=fg(n),a=hg(n);Ir(t.coordinateToPixelTransform,r),Ir(t.coordinateToPixelTransform,s),Ir(t.coordinateToPixelTransform,o),Ir(t.coordinateToPixelTransform,a);let l=this.inversePixelTransform;Ir(l,r),Ir(l,s),Ir(l,o),Ir(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(jn(n)/r*o),l=Math.round(xr(n)/r*o);uo(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,s,-a/2,-l/2),Gw(this.inversePixelTransform,this.pixelTransform);let c=_z(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 HS(e,this.inversePixelTransform,n,t);r.dispatchEvent(s)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(Ao.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(Ao.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new jS),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(Ao.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(Ao.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 uo(this.tempTransform,l,c,u,f,-n,p,x)}disposeInternal(){delete this.frameState,super.disposeInternal()}},XS=Z5;function J5(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 nce(i,e,t){let n=i[t];return n?n.delete(e):!1}function Kq(i,e){let t=i.layerStatesArray[i.layerIndex];t.extent&&(e=yu(e,Rc(t.extent,i.viewState.projection)));let n=t.layer.getRenderSource();if(!n.getWrapX()){let r=n.getTileGridForProjection(i.viewState.projection).getExtent();r&&(e=yu(e,r))}return e}var eN=class extends XS{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=Pr(),this.tempTileRange_=new Iw(0,0,0,0),this.tempTileCoord_=bg(0,0,0);let n=t.cacheSize!==void 0?t.cacheSize:512;this.tileCache_=new $5(n),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new $5(512)),this.sourceTileCache_}getOrCreateTile(e,t,n,r){let s=this.tileCache_,a=this.getLayer().getSource(),l=wg(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||xg(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=Ir(t.pixelToCoordinateTransform,e.slice()),s=n.getExtent();if(s&&!wc(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=jr(l.getTileSize(u)),w=l.getResolution(u),S;if(p instanceof Uw||p instanceof zw)S=p.getImage();else if(p instanceof j5){if(S=WS(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=Ln(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?cP(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||!J5(r,L,S))continue;let F=L.getKey();if(f[F]=!0,L.getState()===rn.IDLE&&!e.tileQueue.isKeyQueued(F)){let N=bg(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=wg(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(Ln(this)),J5(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=wg(l,c,n,u,f),x=!1;if(a.containsKey(p)){let v=a.peek(p);v.getState()===rn.LOADED&&(J5(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?Rc(n.extent,s):null,this.layerExtent&&(v=yu(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=Kq(e,e.nextExtent);this.enqueueTiles(e,ee,Z,L,D)}let F=Kq(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=Ln(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)){nce(L,Z,p),e.animate=!0;continue}if(this.findAltTiles_(f,ae,p+1,L))continue;let be=f.getMinZoom();for(let Ie=p-1;Ie>=be&&!this.findAltTiles_(f,ae,Ie,L);--Ie);}let z=x/o*l/w,V=this.getRenderContext(e);uo(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(Va);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,be=ae[0]*de*z,Ie=ae[1]*de*z,Qe=f.getTileCoordForCoordAndZ(Wl(C),ee),Ue=f.getTileCoordExtent(Qe),mt=Ir(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)*be),Ct=Qe[2]-$e[2],un=Math.round(mt[1]-(Ct-1)*Ie),Gt=Math.round(mt[0]-Et*be),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]&&yr(yt,K[Qt])&&ln.push(K[Qt]);let Zt;ln.length>0&&(Zt=pG(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:be,h:Ie,gutter:Qe}=j[Z];this.drawTile(ae,e,ce,de,be,Ie,Qe,!0,void 0)}if(this.renderedResolution=x,this.extentChanged=!this.renderedExtent_||!z0(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=Ln(u),de=ae.wantedTiles[ce],be=de?Object.keys(de).length:0;this.updateCacheSize(be),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 j5){if(u=WS(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=Ln(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=Ln(t);r in e||(e[r]={}),e[r][n.getKey()]=!0}},Zq=eN;var ay={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};var tN=class extends lA{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(ay.PRELOAD)}setPreload(e){this.set(ay.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(ay.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(ay.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}},Qq=tN;var nN=class extends Qq{constructor(e){super(e)}createRenderer(){return new Zq(this,{cacheSize:this.getCacheSize()})}},iN=nN;var rN=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){}},$S=rN;var ly={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},cy=[ly.FILL],Ou=[ly.STROKE],_f=[ly.BEGIN_PATH],sN=[ly.CLOSE_PATH],An=ly;var oN=class extends $S{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],wc(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=dw(c,p),S!==w?(x&&(a[l++]=u,a[l++]=f,x=!1),a[l++]=p[0],a[l++]=p[1]):S===ys.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,Nx,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,p,e,r||n,Nx,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,Ng,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,f,e,r||n,Ng,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,Mu,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,Mu,s]);break;case"MultiPoint":c=e.getFlatCoordinates(),u=this.appendFlatPointCoordinates(c,a),u>l&&(this.instructions.push([An.CUSTOM,l,u,e,n,Mu,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,Mu,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,jG(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=Ha(n||ks)??void 0}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){let n=e.getColor();t.strokeStyle=Ha(n||Bo);let r=e.getLineCap();t.lineCap=r!==void 0?r:Pu;let s=e.getLineDash();t.lineDash=s?s.slice():Wa;let o=e.getLineDashOffset();t.lineDashOffset=o||ja;let a=e.getLineJoin();t.lineJoin=a!==void 0?a:Iu;let l=e.getWidth();t.lineWidth=l!==void 0?l:hf;let c=e.getMiterLimit();t.miterLimit=c!==void 0?c:cf;let u=e.getOffset();t.strokeOffset=u??hV,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&&!Fo(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_=pw(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;cg(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Bu=oN;var aN=class extends Bu{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&&!wc(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||wc(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}},Jq=aN;var lN=class extends Bu{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,Bo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Wa,ja],_f);let l=e.getFlatCoordinates(),c=e.getStride();this.drawFlatCoordinates_(l,0,l.length,c,a),this.hitDetectionInstructions.push(Ou),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,Bo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Wa,ja],_f);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(Ou),this.endGeometry(t)}finish(){let e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(Ou),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(Ou),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(_f)}},eH=lN;var cN=class extends Bu{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(_f),this.hitDetectionInstructions.push(_f);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(sN),this.hitDetectionInstructions.push(sN)),t=f}return a&&(this.instructions.push(cy),this.hitDetectionInstructions.push(cy)),l&&(this.instructions.push(Ou),this.hitDetectionInstructions.push(Ou)),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,ks]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Bo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Wa,ja]);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(_f,f),this.hitDetectionInstructions.push(_f,f),r.fillStyle!==void 0&&(this.instructions.push(cy),this.hitDetectionInstructions.push(cy)),r.strokeStyle!==void 0&&(this.instructions.push(Ou),this.hitDetectionInstructions.push(Ou)),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,ks]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Bo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Wa,ja]);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,ks]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Bo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Wa,ja]);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]=Cd(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}},uN=cN;var hN=0,fN=1;function ice(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 hN=u,fN=f,!0}function tH(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(ice(r,s,o,a,T,P,L,D)){let F=L-T,N=D-P,B=T+hN*F,z=P+hN*N,V=T+fN*F,H=P+fN*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 nH(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=Do(c,f,v),S=Do(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=Do(c,f,v/x),S=Do(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 iH(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 uy={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},dN=class extends Bu{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[ks]={fillStyle:ks},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(!yr(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")&&!xu(this.getBufferedMaxExtent(),p)){let T=tH(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=nH(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=iH(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!=uf&&(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==uf?uf: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]=ks),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_?ks: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||Nd,justify:t.justify,textBaseline:t.textBaseline||iA,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=uy[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&&ks,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=Ha(o.getColor()||ks)):(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()||Pu,s.lineDash=w?w.slice():Wa,s.lineDashOffset=S===void 0?ja:S,s.lineJoin=a.getLineJoin()||Iu,s.lineWidth=T===void 0?hf:T,s.miterLimit=P===void 0?cf:P,s.strokeStyle=Ha(a.getColor()||Bo)}n=this.textState_;let l=e.getFont()||uS;fV(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()||iA,n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||uf,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:Ln(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:"|"+Ln(r.fillStyle):""}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},rH=dN;var rce={Circle:uN,Default:Bu,Image:Jq,LineString:eH,Polygon:uN,Text:rH},pN=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=rce[t];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=s}return s}},sH=pN;function oH(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 YS(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]=sce(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 sce(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=vG([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 KS(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 AN;function oce(){return AN||(AN=new Intl.Segmenter(void 0,{granularity:"grapheme"})),AN}function aH(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=Do(w,x,C),D=Do(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=Do(w,x,C),V=Do(S,v,C),H=!1;if(p)if(f){let ae=[L,D,z,V];Xw(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(oce().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 be=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===be)continue;let Qe=(H?ee.slice(ce-ae,ce-be):ee.slice(be,ae)).join("");C=T===0?0:(s+Ie/2-P)/T;let Ue=Do(w,x,C),mt=Do(S,v,C);J.push([Ue,mt,Ie/2,de,Qe]),s+=Ie}return J}var $g=Pr(),Bd=[],xf=[],yf=[],Ud=[];function lH(i){return i[3].declutterBox}var cH=new RegExp("[\u0591-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC\u0800-\u0FFF\uE800-\uEFFF]");function mN(i,e){return e==="start"?e=cH.test(i)?"right":"left":e==="end"&&(e=cH.test(i)?"left":"right"),uy[e]}function ace(i,e,t){return t>0&&i.push(`7-`,""),i.push(e,""),i}function lce(i,e,t){return t%2===0&&(i+=e),i}var gN=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_=Zs(),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 jS: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?uy[l.justify]:mN(Array.isArray(e)?e[0]:e,l.textAlign||Nd),p=r&&o.lineWidth?o.lineWidth:0,x=Array.isArray(e)?e:String(e).split(`8-`).reduce(ace,[]),{width:v,height:w,widths:S,heights:T,lineWidths:P}=AV(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 be=[ce,B+N*S[J]+f*(S[J]-P[j]),.5*(p+H)+K];B+=S[J],r&&z.push("strokeText",be),n&&V.push("fillText",be),++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)&&(Bd[0]=F,Ud[0]=F,Bd[1]=N,xf[1]=N,xf[0]=F+L,yf[0]=xf[0],yf[1]=N+D,Ud[1]=yf[1]);let B;return f!==0?(B=uo(Zs(),n,r,1,1,f,-n,-r),Ir(B,Bd),Ir(B,xf),Ir(B,yf),Ir(B,Ud),dl(Math.min(Bd[0],xf[0],yf[0],Ud[0]),Math.min(Bd[1],xf[1],yf[1],Ud[1]),Math.max(Bd[0],xf[0],yf[0],Ud[0]),Math.max(Bd[1],xf[1],yf[1],Ud[1]),$g)):dl(Math.min(F,F+L),Math.min(N,N+D),Math.max(F,F+L),Math.max(N,N+D),$g),x&&(T=Math.round(T),P=Math.round(P)),{drawImageX:T,drawImageY:P,drawImageW:R,drawImageH:C,originX:c,originY:u,declutterBox:{minX:$g[0],minY:$g[1],maxX:$g[2],maxY:$g[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,Bd,xf,yf,Ud,o,a),mV(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=Ir(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=mN(Array.isArray(e)?e[0]:e,s.textAlign||Nd),u=uy[s.textBaseline||iA],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_&&Fo(n,this.renderedTransform_)?u=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),u=qa(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),gz(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,be,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&&!yr(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],pi=Ue[13];R=Ue[14]||"declutter";let Bn=Ue[15];if(!N&&Ue.length>=20){B=Ue[19],z=Ue[20],V=Ue[21],H=Ue[22];let Nn=this.drawLabelWithPointPlacement_(B,z,V,H);N=Nn.label,Ue[3]=N;let Vr=Ue[23];S=(Nn.anchorX-Vr)*this.pixelRatio,Ue[4]=S;let _r=Ue[24];T=(Nn.anchorY-_r)*this.pixelRatio,Ue[5]=T,vt=N.height,Ue[6]=vt,pi=N.width,Ue[13]=pi}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=uf,Te=null,Pe=null),Qt&&ee?xn+=Z:!Qt&&!ee&&(xn-=Z);let Ve=0;for(;x<v;x+=2){if(le&&le[Ve++]<pi/this.pixelRatio)continue;let Nn=this.calculateImageOrLabelDimensions_(N.width,N.height,u[x],u[x+1],pi,vt,S,T,ln,Zt,xn,ge,s,X,!!Te||!!Pe,de),Vr=[e,t,N,Nn,yt,Te,Pe];if(l){let _r,ll,ra;if(Bn){let ar=v-x;if(!Bn[ar]){Bn[ar]={args:Vr,declutterMode:R};continue}let Ds=Bn[ar];_r=Ds.args,ll=Ds.declutterMode,delete Bn[ar],ra=lH(_r)}let cl,Fa;if(_r&&(ll!=="declutter"||!l.collides(ra))&&(cl=!0),(R!=="declutter"||!l.collides(Nn.declutterBox))&&(Fa=!0),ll==="declutter"&&R==="declutter"){let ar=cl&&Fa;cl=ar,Fa=ar}cl&&(ll!=="none"&&l.insert(ra),this.replayImageOrLabel_.apply(this,_r)),Fa&&(R!=="none"&&l.insert(Nn.declutterBox),this.replayImageOrLabel_.apply(this,Vr))}else this.replayImageOrLabel_.apply(this,Vr)}++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(lce,"")),z=Ue[12];let cn=[Ue[13],Ue[13]];R=Ue[14]||"declutter";let yn=Ue[15],Pn=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=oH(u,gt,St,2),ct=Math.abs(Ye[0])*MI(bt,B,wt);if(Ze||ct<=Dt){let Nn=this.textStates[z].textAlign,Vr=(Dt-ct)*mN(B,Nn),_r=aH(u,gt,St,2,B,Vr,Rt,Math.abs(Ye[0]),MI,bt,wt,ee?0:this.viewRotation_,yn);e:if(_r){let ll=[],ra,cl,Fa,ar,Ds;if(V)for(ra=0,cl=_r.length;ra<cl;++ra){Ds=_r[ra],Fa=Ds[4],ar=this.createLabel(Fa,z,"",V),S=Ds[2]+(Ye[0]<0?-Mt:Mt)-Pn,T=qe*ar.height+(.5-qe)*2*Mt*Ye[1]/Ye[0]-Pt;let ul=this.calculateImageOrLabelDimensions_(ar.width,ar.height,Ds[0],Ds[1],ar.width,ar.height,S,T,0,0,Ds[3],cn,!1,uf,!1,de);if(l&&R==="declutter"&&l.collides(ul.declutterBox))break e;ll.push([e,t,ar,ul,1,null,null])}if(H)for(ra=0,cl=_r.length;ra<cl;++ra){Ds=_r[ra],Fa=Ds[4],ar=this.createLabel(Fa,z,H,""),S=Ds[2]-Pn,T=qe*ar.height-Pt;let ul=this.calculateImageOrLabelDimensions_(ar.width,ar.height,Ds[0],Ds[1],ar.width,ar.height,S,T,0,0,Ds[3],cn,!1,uf,!1,de);if(l&&R==="declutter"&&l.collides(ul.declutterBox))break e;ll.push([e,t,ar,ul,1,null,null])}l&&R!=="none"&&l.load(ll.map(lH));for(let ul=0,mu=ll.length;ul<mu;++ul)this.replayImageOrLabel_.apply(this,ll[ul])}}++f;break;case An.END_GEOMETRY:if(o!==void 0){de=Ue[1];let Nn=o(de,Qe,R);if(Nn)return Nn}++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,Wi;if(P){let Vr=(Ue[4]??!1)||Math.abs(u[x]-u[v-2])<1e-6&&Math.abs(u[x+1]-u[v-1])<1e-6;YS(u,x,v,2,P,Vr,w),KS(w,2,Vr),Ce=w,jt=0,Wi=Ce.length}else Ce=u,jt=x,Wi=v;be=Ce[jt],Ie=Ce[jt+1],e.moveTo(be,Ie),C=be+.5|0,L=Ie+.5|0;for(let Nn=jt+2;Nn<Wi;Nn+=2)be=Ce[Nn],Ie=Ce[Nn+1],D=be+.5|0,F=Ie+.5|0,(Nn==Wi-2||D!==C||F!==L)&&(e.lineTo(be,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)}},uH=gN;var kd=["Polygon","Circle","LineString","Image","Text","Default"],yN=["Image","Text"],hH=kd.filter(i=>!yN.includes(i)),fH=!1,dH=!1;function cce(){let i=0,e=n=>{let r=Ti(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};fH={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0}[i],dH=!0}var xN=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_=Zs(),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 uH(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){dH===!1&&cce(),r=Math.round(r);let a=r*2+1,l=uo(this.hitDetectionTransform_,r+.5,r+.5,1/t,-1/t,-n,-e[0],-e[1]),c=!this.hitDetectionContext_;c&&(this.hitDetectionContext_=Ti(a,a,null,{willReadFrequently:fH}));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=Pr(),V0(f,e),cg(f,t*(this.renderBuffer_+r),f));let p=uce(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(Va);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=kd.length-1;T>=0;--T)if(x=kd[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 qa(a,0,8,2,e,a),a}isEmpty(){return Ec(this.executorsByZIndex_)}execute(e,t,n,r,s,o,a){let l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?WG:Va),o=o||kd;let c=kd.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+kd.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(Va);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}},_N={};function uce(i){if(_N[i]!==void 0)return _N[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 _N[i]=r,r}var pH=xN;var vN=class extends $S{constructor(e,t,n,r,s,o,a){super(),this.context_=e,this.pixelRatio_=t,this.extent_=n,this.transform_=r,this.transformRotation_=r?q0(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_=Zs()}drawImages_(e,t,n,r){if(!this.image_)return;let s=qa(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_;uo(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=qa(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=qa(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=YS(l,0,u,2,o,f,l),KS(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_)),!!yr(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=Bz(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_)),!!yr(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(yr(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_)),!!yr(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_)),!!yr(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),Fo(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:Nd;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:Ha(n||ks)}}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||Wa,f=t.getOffset();this.strokeState_={lineCap:r!==void 0?r:Pu,lineDash:this.pixelRatio_===1?u:u.map(p=>p*this.pixelRatio_),lineDashOffset:(o||ja)*this.pixelRatio_,lineJoin:a!==void 0?a:Iu,lineWidth:(l!==void 0?l:hf)*this.pixelRatio_,miterLimit:c!==void 0?c:cf,strokeStyle:Ha(n||Bo),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:Ha(x||ks)}}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:Pu,lineDash:w||Wa,lineDashOffset:S||ja,lineJoin:T!==void 0?T:Iu,lineWidth:P!==void 0?P:hf,miterLimit:R!==void 0?R:cf,strokeStyle:Ha(x||Bo)}}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:uS,textAlign:f!==void 0?f:Nd,textBaseline:p!==void 0?p:iA},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]]}}},AH=vN;var Gc=.5;function mH(i,e,t,n,r,s,o,a,l){let c=l?yd(r,l):r,u=i[0]*Gc,f=i[1]*Gc,p=Ti(u,f);p.imageSmoothingEnabled=!1;let x=p.canvas,v=new AH(p,Gc,r,null,o,a,l?j0($0(),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||!yr(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 be=Ti(de[0],de[1],void 0,{alpha:!1}),Ie=be.canvas;be.fillStyle=N,be.fillRect(0,0,Ie.width,Ie.height),K.setImage(new rA({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 be=0,Ie=de.length;be<Ie;++be){let Qe=de[be];ae[Qe.getType().replace("Multi","")].push(Qe,K)}}else ae[ce.replace("Multi","")].push(H,K)}}let P=Object.keys(T).map(Number).sort(Va);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 gH(i,e,t){let n=[];if(t){let r=Math.floor(Math.round(i[0])*Gc),s=Math.floor(Math.round(i[1])*Gc),o=(xi(r,0,t.width-1)+xi(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 hce=.5,_H={Point:_ce,LineString:Ace,Polygon:yce,MultiPoint:xce,MultiLineString:mce,MultiPolygon:gce,GeometryCollection:pce,Circle:fce};function xH(i,e){return parseInt(Ln(i),10)-parseInt(Ln(e),10)}function bN(i,e){let t=wN(i,e);return t*t}function wN(i,e){return hce*i/e}function fce(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 SN(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)),dce(i,e,t,n,s,o,a),f}function dce(i,e,t,n,r,s,o){let a=t.getGeometryFunction()(e);if(!a)return;let l=a.simplifyTransformed(n,r);if(t.getRenderer())yH(i,l,t,e,o);else{let u=_H[l.getType()];u(i,l,t,e,o,s)}}function yH(i,e,t,n,r){if(e.getType()=="GeometryCollection"){let o=e.getGeometries();for(let a=0,l=o.length;a<l;++a)yH(i,o[a],t,n,r);return}i.getBuilder(t.getZIndex(),"Default").drawCustom(e,n,t.getRenderer(),t.getHitDetectionRenderer(),r)}function pce(i,e,t,n,r,s){let o=e.getGeometriesArray(),a,l;for(a=0,l=o.length;a<l;++a){let c=_H[o[a].getType()];c(i,o[a],t,n,r,s)}}function Ace(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 mce(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 gce(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 _ce(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 xce(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 yce(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 TN=class extends XS{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_=Pr(),this.wrappedRenderedExtent_=Pr(),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[Gs.ANIMATING]||v[Gs.INTERACTING]),S=this.context,T=Math.round(jn(r)/a*x),P=Math.round(xr(r)/a*x),R=f.getWrapX()&&l.canWrapX(),C=R?jn(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?kd:n?yN:hH,n?p&&t.declutter[p]:void 0)}while(++D<L)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=Ti(this.context.canvas.width,this.context.canvas.height,Q5))}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),Q5.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(Ao.PRERENDER)||this.getLayer().hasListener(Ao.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=Rc(n.extent,l);a=yr(u,e.extent),a&&!xu(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]*Gc,p=n[1]*Gc;u.push(this.getRenderTransform(r,s,o,Gc,f,p,0).slice());let x=c.getSource(),v=a.getExtent();if(x.getWrapX()&&a.canWrapX()&&!xu(v,l)){let S=l[0],T=jn(v),P=0,R;for(;S<v[0];)--P,R=T*P,u.push(this.getRenderTransform(r,s,o,Gc,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,Gc,f,p,R).slice()),S-=T}let w=$0();this.hitDetectionImageData_=mH(n,u,this.renderedFeatures_,c.getStyleFunction(),l,s,o,bN(s,this.renderedPixelRatio_),w?a:null)}t(gH(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=Ln(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[Gs.ANIMATING],s=e.viewHints[Gs.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=xH);let S=c.center.slice(),T=cg(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&&!vu(Z)&&(this.extendX_=Z[0]<C[0]||Z[2]>C[2])}if(L&&(!xu(C,e.extent)||this.extendX_)){let Z=jn(C),ee=Math.max(jn(T)/2,Z),ae=C[0],ce=C[2];this.extendX_&&(ae-=Z,ce+=Z),T[0]=ae-ee,T[2]=ce+ee,bw(S,u);let de=hP(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&&xu(this.wrappedRenderedExtent_,T))return Fo(this.renderedExtent_,P)||(this.hitDetectionImageData_=null,this.renderedExtent_=P),this.renderedCenter_=S,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let D=new sH(wN(f,p),T,f,p),F=$0(),N;if(F){for(let Z=0,ee=R.length;Z<ee;++Z){let ae=R[Z],ce=yd(ae,u);n.loadFeatures(ce,VG(f,u),F)}N=j0(F,u)}else for(let Z=0,ee=R.length;Z<ee;++Z)n.loadFeatures(R[Z],f,u);let B=bN(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=yd(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 pH(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=SN(r,e,n[c],t,this.boundHandleStyleImageChange_,s,o,a)||l;else l=SN(r,e,n,t,this.boundHandleStyleImageChange_,s,o,a);return l}},vH=TN;var EN=class extends qS{constructor(e){super(e)}createRenderer(){return new vH(this)}},bH=EN;var vce=!1;function bce(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=vce,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 MN(i,e){return function(t,n,r,s,o){bce(i,e,t,n,r,(a,l)=>{this.addFeatures(a),s!==void 0&&s(a)},()=>{this.changed(),o!==void 0&&o()})}}function wH(i,e){return[[-1/0,-1/0,1/0,1/0]]}function CN(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=HG(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]:Do(i[a+u],i[a+n+u],l);return s}var SH=Zs(),hy=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"?Aw(this.flatCoordinates_):ug(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let e=za(this.getExtent());this.flatInteriorPoints_=Fx(this.flatCoordinates_,0,this.ends_,this.stride_,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let e=Qz(this.flatCoordinates_,this.ends_),t=mS(this.flatCoordinates_,0,e,this.stride_);this.flatInteriorPoints_=Qw(this.flatCoordinates_,0,e,this.stride_,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=CN(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=CN(e,t,o,this.stride_,.5);Pc(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=vs(e);let t=e.getExtent(),n=e.getWorldExtent();if(t&&n){let r=xr(n)/xr(t);uo(SH,n[0],n[3],r,-r,0,0,0),qa(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,SH,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=Fw((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=Lx(n,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,e,n,0),r=[n.length];break;case"MultiLineString":r=[],n.length=$z(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,e,n,0,r);break;case"Polygon":r=[],n.length=Dx(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}};hy.prototype.getFlatCoordinates=hy.prototype.getOrientedFlatCoordinates;var fA=hy;var RN=class{constructor(e){this.rbush_=new cA(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_[Ln(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_[Ln(a)]=l}this.rbush_.load(n)}remove(e){let t=Ln(e),n=this.items_[t];return delete this.items_[t],this.rbush_.remove(n)!==null}update(e,t){let n=this.items_[Ln(t)],r=[n.minX,n.minY,n.maxX,n.maxY];z0(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 Ec(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){let t=this.rbush_.toJSON();return dl(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]}},PN=RN;var ml={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};var Uu=class extends Ks{constructor(e,t,n){super(e),this.feature=t,this.features=n}},IN=class extends Hw{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_=of,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&&(Vn(this.format_,"`format` must be set when `url` is set"),this.loader_=MN(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:wH;let t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new PN:null,this.loadedExtentsRtree_=new PN,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 fo(r)),r!==void 0&&this.addFeaturesInternal(r),n!==void 0&&this.bindFeaturesCollection_(n)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){let t=Ln(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 Uu(ml.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof fA||(this.featureChangeKeys_[e]=[kn(t,Jt.CHANGE,this.handleFeatureChange_,this),kn(t,Ic.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 fA){let s=this.idIndex_[r];s instanceof fA?Array.isArray(s)?s.push(t):this.idIndex_[r]=[s,t]:n=!1}else n=!1}return n&&(Vn(!(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=Ln(a);this.addToIndex_(l,a)&&n.push(a)}for(let s=0,o=n.length;s<o;s++){let a=n[s],l=Ln(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(ml.ADDFEATURE))for(let s=0,o=n.length;s<o;s++)this.dispatchEvent(new Uu(ml.ADDFEATURE,n[s]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(ml.ADDFEATURE,function(n){t||(t=!0,e.push(n.feature),t=!1)}),this.addEventListener(ml.REMOVEFEATURE,function(n){t||(t=!0,e.remove(n.feature),t=!1)}),e.addEventListener(Qs.ADD,n=>{t||(t=!0,this.addFeature(n.element),t=!1)}),e.addEventListener(Qs.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(ri);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 Uu(ml.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 fA||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 fA||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(),Ec(this.nullGeometryFeatures_)||Pc(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=_w(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||rf,this.featuresRtree_.forEachInExtent(l,function(c){if(t(c)){let u=c.getGeometry(),f=a;if(a=u instanceof fA?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=Ln(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 Uu(ml.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 Ln(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Ec(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 xu(u.extent,l)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new Uu(ml.FEATURESLOADSTART));let u=v=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new Uu(ml.FEATURESLOADEND,void 0,v))},f=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new Uu(ml.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=uP(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=Ln(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(ri),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(ml.REMOVEFEATURE)&&this.dispatchEvent(new Uu(ml.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){Vn(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(MN(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}},vf=IN;var ya={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},op={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},n3=0,r2=1,i3=2;var xL=0,ap=1,r3=2,tc=3,_o=0,hi=1,sr=2,Zr=0,cs=1,ju=2,Xu=3,$u=4,Uf=5,s2=6,zs=100,o2=101,a2=102,s3=103,o3=104,Xc=200,l2=201,c2=202,u2=203,Xd=204,$d=205,h2=206,f2=207,d2=208,p2=209,A2=210,dW=211,pW=212,AW=213,mW=214,gA=0,_A=1,xA=2,zu=3,yA=4,vA=5,bA=6,wA=7,GA=0,a3=1,l3=2,Vs=0,m2=1,g2=2,_2=3,x2=4,yL=5,y2=6,v2=7;var b2=300,bl=301,nc=302,lp=303,cp=304,Yu=306,If=1e3,Vo=1001,Nf=1002,yi=1003,w2=1004;var ic=1005;var bi=1006,up=1007;var yo=1008,vL=1008,Vi=1009,Ku=1010,Zu=1011,Ka=1012,Fr=1013,Ai=1014,Zi=1015,Fi=1016,zA=1017,VA=1018,Ho=1020,qA=35902,HA=35899,I_=1021,kf=1022,wr=1023,Ts=1026,eo=1027,Gf=1028,Qu=1029,Rs=1030,Ju=1031,S2=1032,hp=1033,eh=33776,th=33777,nh=33778,ih=33779,WA=35840,jA=35841,XA=35842,$A=35843,fp=36196,dp=37492,pp=37496,Ap=37488,mp=37489,rh=37490,gp=37491,_p=37808,xp=37809,yp=37810,vp=37811,bp=37812,wp=37813,Sp=37814,Tp=37815,Ep=37816,Mp=37817,Cp=37818,Rp=37819,Pp=37820,Ip=37821,Np=36492,Lp=36494,Dp=36495,Fp=36283,Op=36284,sh=36285,Bp=36286;var Ty=2300,PT=2301,CT=2302,oL=2303,aL=2400,lL=2401,cL=2402;var bL=0,wL=1,c3=2,gW=3200;var wl=0,u3=1,Wo="",vr="srgb",Yd="srgb-linear",Kd="linear",Bt="srgb",T2="",h3="rg",SL="ga",TL=0,Mf=7680,EL=7681,ML=7682,CL=7683,RL=34055,PL=34056,IL=5386,NL=512,LL=513,DL=514,FL=515,OL=516,BL=517,UL=518,Ey=519,E2=512,N_=513,M2=514,oh=515,YA=516,C2=517,$c=518,R2=519,Zd=35044,KA=35048;var kL="300 es",go=2e3,Xa=2001,rc={COMPUTE:"compute",RENDER:"render"};var zf={TEXTURE_COMPARE:"depthTextureCompare"};function wce(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function L_(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function A_(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function f3(){let i=A_("canvas");return i.style.display="block",i}var TH={},m_=null;function SA(...i){let e="THREE."+i.shift();m_?m_("log",e,...i):console.log(e,...i)}function _W(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=_W(i);let e="THREE."+i.shift();if(m_)m_("warn",e,...i);else{let t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function Ge(...i){i=_W(i);let e="THREE."+i.shift();if(m_)m_("error",e,...i);else{let t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function Qn(...i){let e=i.join(" ");e in TH||(TH[e]=!0,je(...i))}function GL(){return typeof self<"u"&&typeof self.scheduler<"u"&&typeof self.scheduler.yield<"u"?self.scheduler.yield():new Promise(i=>{requestAnimationFrame(i)})}function xW(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 P2={[gA]:_A,[xA]:bA,[yA]:wA,[zu]:vA,[_A]:gA,[bA]:xA,[wA]:yA,[vA]:zu},qo=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}}},Go=["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"],EH=1234567,vy=Math.PI/180,Lf=180/Math.PI;function Gu(){let i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Go[i&255]+Go[i>>8&255]+Go[i>>16&255]+Go[i>>24&255]+"-"+Go[e&255]+Go[e>>8&255]+"-"+Go[e>>16&15|64]+Go[e>>24&255]+"-"+Go[t&63|128]+Go[t>>8&255]+"-"+Go[t>>16&255]+Go[t>>24&255]+Go[n&255]+Go[n>>8&255]+Go[n>>16&255]+Go[n>>24&255]).toLowerCase()}function In(i,e,t){return Math.max(e,Math.min(t,i))}function zL(i,e){return(i%e+e)%e}function Sce(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function Tce(i,e,t){return i!==e?(t-i)/(e-i):0}function by(i,e,t){return(1-t)*i+t*e}function Ece(i,e,t,n){return by(i,e,1-Math.exp(-t*n))}function Mce(i,e=1){return e-Math.abs(zL(i,e*2)-e)}function Cce(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function Rce(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function Pce(i,e){return i+Math.floor(Math.random()*(e-i+1))}function Ice(i,e){return i+Math.random()*(e-i)}function Nce(i){return i*(.5-Math.random())}function Lce(i){i!==void 0&&(EH=i);let e=EH+=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 Dce(i){return i*vy}function Fce(i){return i*Lf}function Oce(i){return(i&i-1)===0&&i!==0}function Bce(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Uce(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function kce(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 fa(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 Wn(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 Yc={DEG2RAD:vy,RAD2DEG:Lf,generateUUID:Gu,clamp:In,euclideanModulo:zL,mapLinear:Sce,inverseLerp:Tce,lerp:by,damp:Ece,pingpong:Mce,smoothstep:Cce,smootherstep:Rce,randInt:Pce,randFloat:Ice,randFloatSpread:Nce,seededRandom:Lce,degToRad:Dce,radToDeg:Fce,isPowerOfTwo:Oce,ceilPowerOfTwo:Bce,floorPowerOfTwo:Uce,setQuaternionFromProperEuler:kce,normalize:Wn,denormalize:fa},jL=class jL{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=In(this.x,e.x,t.x),this.y=In(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=In(this.x,e,t),this.y=In(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(In(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(In(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}};jL.prototype.isVector2=!0;var Oe=jL,Es=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(In(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}},XL=class XL{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(MH.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(MH.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=In(this.x,e.x,t.x),this.y=In(this.y,e.y,t.y),this.z=In(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=In(this.x,e,t),this.y=In(this.y,e,t),this.z=In(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(In(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 NN.copy(this).projectOnVector(e),this.sub(NN)}reflect(e){return this.sub(NN.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(In(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}};XL.prototype.isVector3=!0;var ie=XL,NN=new ie,MH=new Es,$L=class $L{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 Qn("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(LN.makeScale(e,t)),this}rotate(e){return Qn("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(LN.makeRotation(-e)),this}translate(e,t){return Qn("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(LN.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)}};$L.prototype.isMatrix3=!0;var Sn=$L,LN=new Sn,CH=new Sn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),RH=new Sn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Gce(){let i={enabled:!0,workingColorSpace:Yd,spaces:{},convert:function(r,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===Bt&&(r.r=Pf(r.r),r.g=Pf(r.g),r.b=Pf(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=p_(r.r),r.g=p_(r.g),r.b=p_(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===Wo?Kd: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 Qn("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return Qn("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({[Yd]:{primaries:e,whitePoint:n,transfer:Kd,toXYZ:CH,fromXYZ:RH,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:vr},outputColorSpaceConfig:{drawingBufferColorSpace:vr}},[vr]:{primaries:e,whitePoint:n,transfer:Bt,toXYZ:CH,fromXYZ:RH,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:vr}}}),i}var sn=Gce();function Pf(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function p_(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var Yg,IT=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{Yg===void 0&&(Yg=A_("canvas")),Yg.width=e.width,Yg.height=e.height;let r=Yg.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=Yg}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=A_("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]=Pf(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(Pf(t[n]/255)*255):t[n]=Pf(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}},zce=0,g_=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:zce++}),this.uuid=Gu(),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(DN(r[o].image)):s.push(DN(r[o]))}else s=DN(r);n.url=s}return t||(e.images[this.uuid]=n),n}};function DN(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?IT.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 Vce=0,FN=new ie,Ms=class i extends qo{constructor(e=i.DEFAULT_IMAGE,t=i.DEFAULT_MAPPING,n=Vo,r=Vo,s=bi,o=yo,a=wr,l=Vi,c=i.DEFAULT_ANISOTROPY,u=Wo){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Vce++}),this.uuid=Gu(),this.name="",this.source=new g_(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(FN).x}get height(){return this.source.getSize(FN).y}get depth(){return this.source.getSize(FN).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!==b2)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case If:e.x=e.x-Math.floor(e.x);break;case Vo:e.x=e.x<0?0:1;break;case Nf: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 If:e.y=e.y-Math.floor(e.y);break;case Vo:e.y=e.y<0?0:1;break;case Nf: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++}};Ms.DEFAULT_IMAGE=null;Ms.DEFAULT_MAPPING=b2;Ms.DEFAULT_ANISOTROPY=1;var YL=class YL{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=In(this.x,e.x,t.x),this.y=In(this.y,e.y,t.y),this.z=In(this.z,e.z,t.z),this.w=In(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=In(this.x,e,t),this.y=In(this.y,e,t),this.z=In(this.z,e,t),this.w=In(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(In(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}};YL.prototype.isVector4=!0;var gn=YL,da=class extends qo{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:bi,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 Ms(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:bi,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 g_(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"})}},pa=class extends da{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},TA=class extends Ms{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=yi,this.minFilter=yi,this.wrapR=Vo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}};var NT=class extends Ms{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=yi,this.minFilter=yi,this.wrapR=Vo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var t3=class t3{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 t3().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/Kg.setFromMatrixColumn(e,0).length(),s=1/Kg.setFromMatrixColumn(e,1).length(),o=1/Kg.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(qce,e,Hce)}lookAt(e,t,n){let r=this.elements;return gl.subVectors(e,t),gl.lengthSq()===0&&(gl.z=1),gl.normalize(),Gd.crossVectors(n,gl),Gd.lengthSq()===0&&(Math.abs(n.z)===1?gl.x+=1e-4:gl.z+=1e-4,gl.normalize(),Gd.crossVectors(n,gl)),Gd.normalize(),ZS.crossVectors(gl,Gd),r[0]=Gd.x,r[4]=ZS.x,r[8]=gl.x,r[1]=Gd.y,r[5]=ZS.y,r[9]=gl.y,r[2]=Gd.z,r[6]=ZS.z,r[10]=gl.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],be=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*be,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*be,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*be,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*be,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=Kg.set(r[0],r[1],r[2]).length(),a=Kg.set(r[4],r[5],r[6]).length(),l=Kg.set(r[8],r[9],r[10]).length();s<0&&(o=-o),zc.copy(this);let c=1/o,u=1/a,f=1/l;return zc.elements[0]*=c,zc.elements[1]*=c,zc.elements[2]*=c,zc.elements[4]*=u,zc.elements[5]*=u,zc.elements[6]*=u,zc.elements[8]*=f,zc.elements[9]*=f,zc.elements[10]*=f,t.setFromRotationMatrix(zc),n.x=o,n.y=a,n.z=l,this}makePerspective(e,t,n,r,s,o,a=go,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===go)v=-(o+s)/(o-s),w=-2*o*s/(o-s);else if(a===Xa)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=go,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===go)v=-2/(o-s),w=-(o+s)/(o-s);else if(a===Xa)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}};t3.prototype.isMatrix4=!0;var on=t3,Kg=new ie,zc=new on,qce=new ie(0,0,0),Hce=new ie(1,1,1),Gd=new ie,ZS=new ie,gl=new ie,PH=new on,IH=new Es,Aa=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(In(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(-In(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(In(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(-In(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(In(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(-In(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 PH.makeRotationFromQuaternion(e),this.setFromRotationMatrix(PH,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return IH.setFromEuler(this),this.setFromQuaternion(IH,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}};Aa.DEFAULT_ORDER="XYZ";var __=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}},Wce=0,NH=new ie,Zg=new Es,bf=new on,QS=new ie,fy=new ie,jce=new ie,Xce=new Es,LH=new ie(1,0,0),DH=new ie(0,1,0),FH=new ie(0,0,1),OH={type:"added"},$ce={type:"removed"},Qg={type:"childadded",child:null},ON={type:"childremoved",child:null},Ki=class i extends qo{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Wce++}),this.uuid=Gu(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i.DEFAULT_UP.clone();let e=new ie,t=new Aa,n=new Es,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 __,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 Zg.setFromAxisAngle(e,t),this.quaternion.multiply(Zg),this}rotateOnWorldAxis(e,t){return Zg.setFromAxisAngle(e,t),this.quaternion.premultiply(Zg),this}rotateX(e){return this.rotateOnAxis(LH,e)}rotateY(e){return this.rotateOnAxis(DH,e)}rotateZ(e){return this.rotateOnAxis(FH,e)}translateOnAxis(e,t){return NH.copy(e).applyQuaternion(this.quaternion),this.position.add(NH.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(LH,e)}translateY(e){return this.translateOnAxis(DH,e)}translateZ(e){return this.translateOnAxis(FH,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(bf.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?QS.copy(e):QS.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),fy.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?bf.lookAt(fy,QS,this.up):bf.lookAt(QS,fy,this.up),this.quaternion.setFromRotationMatrix(bf),r&&(bf.extractRotation(r.matrixWorld),Zg.setFromRotationMatrix(bf),this.quaternion.premultiply(Zg.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(OH),Qg.child=e,this.dispatchEvent(Qg),Qg.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($ce),ON.child=e,this.dispatchEvent(ON),ON.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),bf.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),bf.multiply(e.parent.matrixWorld)),e.applyMatrix4(bf),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(OH),Qg.child=e,this.dispatchEvent(Qg),Qg.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(fy,e,jce),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(fy,Xce,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}};Ki.DEFAULT_UP=new ie(0,1,0);Ki.DEFAULT_MATRIX_AUTO_UPDATE=!0;Ki.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var br=class extends Ki{constructor(){super(),this.isGroup=!0,this.type="Group"}},Yce={type:"move"},Qd=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new br,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 br,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 br,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(Yce)))}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 br;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},yW={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},zd={h:0,s:0,l:0},JS={h:0,s:0,l:0};function BN(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=vr){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=zL(e,1),t=In(t,0,1),n=In(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=BN(o,s,e+1/3),this.g=BN(o,s,e),this.b=BN(o,s,e-1/3)}return sn.colorSpaceToWorking(this,r),this}setStyle(e,t=vr){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=vr){let n=yW[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=Pf(e.r),this.g=Pf(e.g),this.b=Pf(e.b),this}copyLinearToSRGB(e){return this.r=p_(e.r),this.g=p_(e.g),this.b=p_(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=vr){return sn.workingToColorSpace(zo.copy(this),e),Math.round(In(zo.r*255,0,255))*65536+Math.round(In(zo.g*255,0,255))*256+Math.round(In(zo.b*255,0,255))}getHexString(e=vr){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=sn.workingColorSpace){sn.workingToColorSpace(zo.copy(this),t);let n=zo.r,r=zo.g,s=zo.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(zo.copy(this),t),e.r=zo.r,e.g=zo.g,e.b=zo.b,e}getStyle(e=vr){sn.workingToColorSpace(zo.copy(this),e);let t=zo.r,n=zo.g,r=zo.b;return e!==vr?`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(zd),this.setHSL(zd.h+e,zd.s+t,zd.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(zd),e.getHSL(JS);let n=by(zd.h,JS.h,t),r=by(zd.s,JS.s,t),s=by(zd.l,JS.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}},zo=new Ut;Ut.NAMES=yW;var Jd=class extends Ki{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 Aa,this.environmentIntensity=1,this.environmentRotation=new Aa,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}},Vc=new ie,wf=new ie,UN=new ie,Sf=new ie,Jg=new ie,e_=new ie,BH=new ie,kN=new ie,GN=new ie,zN=new ie,VN=new gn,qN=new gn,HN=new gn,Cf=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),Vc.subVectors(e,t),r.cross(Vc);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){Vc.subVectors(r,t),wf.subVectors(n,t),UN.subVectors(e,t);let o=Vc.dot(Vc),a=Vc.dot(wf),l=Vc.dot(UN),c=wf.dot(wf),u=wf.dot(UN),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,Sf)===null?!1:Sf.x>=0&&Sf.y>=0&&Sf.x+Sf.y<=1}static getInterpolation(e,t,n,r,s,o,a,l){return this.getBarycoord(e,t,n,r,Sf)===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,Sf.x),l.addScaledVector(o,Sf.y),l.addScaledVector(a,Sf.z),l)}static getInterpolatedAttribute(e,t,n,r,s,o){return VN.setScalar(0),qN.setScalar(0),HN.setScalar(0),VN.fromBufferAttribute(e,t),qN.fromBufferAttribute(e,n),HN.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(VN,s.x),o.addScaledVector(qN,s.y),o.addScaledVector(HN,s.z),o}static isFrontFacing(e,t,n,r){return Vc.subVectors(n,t),wf.subVectors(e,t),Vc.cross(wf).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 Vc.subVectors(this.c,this.b),wf.subVectors(this.a,this.b),Vc.cross(wf).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),e_.subVectors(s,n),kN.subVectors(e,n);let l=Jg.dot(kN),c=e_.dot(kN);if(l<=0&&c<=0)return t.copy(n);GN.subVectors(e,r);let u=Jg.dot(GN),f=e_.dot(GN);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);zN.subVectors(e,s);let x=Jg.dot(zN),v=e_.dot(zN);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(e_,a);let S=u*v-x*f;if(S<=0&&f-u>=0&&x-v>=0)return BH.subVectors(s,r),a=(f-u)/(f-u+(x-v)),t.copy(r).addScaledVector(BH,a);let T=1/(S+w+p);return o=w*T,a=p*T,t.copy(n).addScaledVector(Jg,o).addScaledVector(e_,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},ma=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(qc.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(qc.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=qc.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,qc):qc.fromBufferAttribute(s,o),qc.applyMatrix4(e.matrixWorld),this.expandByPoint(qc);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),eT.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),eT.copy(n.boundingBox)),eT.applyMatrix4(e.matrixWorld),this.union(eT)}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,qc),qc.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(dy),tT.subVectors(this.max,dy),t_.subVectors(e.a,dy),n_.subVectors(e.b,dy),i_.subVectors(e.c,dy),Vd.subVectors(n_,t_),qd.subVectors(i_,n_),dA.subVectors(t_,i_);let t=[0,-Vd.z,Vd.y,0,-qd.z,qd.y,0,-dA.z,dA.y,Vd.z,0,-Vd.x,qd.z,0,-qd.x,dA.z,0,-dA.x,-Vd.y,Vd.x,0,-qd.y,qd.x,0,-dA.y,dA.x,0];return!WN(t,t_,n_,i_,tT)||(t=[1,0,0,0,1,0,0,0,1],!WN(t,t_,n_,i_,tT))?!1:(nT.crossVectors(Vd,qd),t=[nT.x,nT.y,nT.z],WN(t,t_,n_,i_,tT))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,qc).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(qc).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:(Tf[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Tf[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Tf[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Tf[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Tf[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Tf[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Tf[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Tf[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Tf),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}},Tf=[new ie,new ie,new ie,new ie,new ie,new ie,new ie,new ie],qc=new ie,eT=new ma,t_=new ie,n_=new ie,i_=new ie,Vd=new ie,qd=new ie,dA=new ie,dy=new ie,tT=new ie,nT=new ie,pA=new ie;function WN(i,e,t,n,r){for(let s=0,o=i.length-3;s<=o;s+=3){pA.fromArray(i,s);let a=r.x*Math.abs(pA.x)+r.y*Math.abs(pA.y)+r.z*Math.abs(pA.z),l=e.dot(pA),c=t.dot(pA),u=n.dot(pA);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}var Rf=Kce();function Kce(){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 _l(i){Math.abs(i)>65504&&je("DataUtils.toHalfFloat(): Value out of range."),i=In(i,-65504,65504),Rf.floatView[0]=i;let e=Rf.uint32View[0],t=e>>23&511;return Rf.baseTable[t]+((e&8388607)>>Rf.shiftTable[t])}function iT(i){let e=i>>10;return Rf.uint32View[0]=Rf.mantissaTable[Rf.offsetTable[e]+(i&1023)]+Rf.exponentTable[e],Rf.floatView[0]}var Ss=new ie,rT=new Oe,Zce=0,Di=class extends qo{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:Zce++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Zd,this.updateRanges=[],this.gpuType=Zi,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++)rT.fromBufferAttribute(this,t),rT.applyMatrix3(e),this.setXY(t,rT.x,rT.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Ss.fromBufferAttribute(this,t),Ss.applyMatrix3(e),this.setXYZ(t,Ss.x,Ss.y,Ss.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Ss.fromBufferAttribute(this,t),Ss.applyMatrix4(e),this.setXYZ(t,Ss.x,Ss.y,Ss.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Ss.fromBufferAttribute(this,t),Ss.applyNormalMatrix(e),this.setXYZ(t,Ss.x,Ss.y,Ss.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Ss.fromBufferAttribute(this,t),Ss.transformDirection(e),this.setXYZ(t,Ss.x,Ss.y,Ss.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=fa(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Wn(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=fa(t,this.array)),t}setX(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=fa(t,this.array)),t}setY(e,t){return this.normalized&&(t=Wn(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=fa(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Wn(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=fa(t,this.array)),t}setW(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Wn(t,this.array),n=Wn(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=Wn(t,this.array),n=Wn(n,this.array),r=Wn(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=Wn(t,this.array),n=Wn(n,this.array),r=Wn(r,this.array),s=Wn(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!==Zd&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}};var EA=class extends Di{constructor(e,t,n){super(new Uint16Array(e),t,n)}};var MA=class extends Di{constructor(e,t,n){super(new Uint32Array(e),t,n)}},x_=class extends Di{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=iT(this.array[e*this.itemSize]);return this.normalized&&(t=fa(t,this.array)),t}setX(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize]=_l(t),this}getY(e){let t=iT(this.array[e*this.itemSize+1]);return this.normalized&&(t=fa(t,this.array)),t}setY(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize+1]=_l(t),this}getZ(e){let t=iT(this.array[e*this.itemSize+2]);return this.normalized&&(t=fa(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize+2]=_l(t),this}getW(e){let t=iT(this.array[e*this.itemSize+3]);return this.normalized&&(t=fa(t,this.array)),t}setW(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize+3]=_l(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Wn(t,this.array),n=Wn(n,this.array)),this.array[e+0]=_l(t),this.array[e+1]=_l(n),this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Wn(t,this.array),n=Wn(n,this.array),r=Wn(r,this.array)),this.array[e+0]=_l(t),this.array[e+1]=_l(n),this.array[e+2]=_l(r),this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=Wn(t,this.array),n=Wn(n,this.array),r=Wn(r,this.array),s=Wn(s,this.array)),this.array[e+0]=_l(t),this.array[e+1]=_l(n),this.array[e+2]=_l(r),this.array[e+3]=_l(s),this}},Rn=class extends Di{constructor(e,t,n){super(new Float32Array(e),t,n)}},Qce=new ma,py=new ie,jN=new ie,$a=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):Qce.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;py.subVectors(e,this.center);let t=py.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(py,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):(jN.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(py.copy(e.center).add(jN)),this.expandByPoint(py.copy(e.center).sub(jN))),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}},Jce=0,Jl=new on,XN=new Ki,r_=new ie,xl=new ma,Ay=new ma,Js=new ie,qn=class i extends qo{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Jce++}),this.uuid=Gu(),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(wce(e)?MA:EA)(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 Jl.makeRotationFromQuaternion(e),this.applyMatrix4(Jl),this}rotateX(e){return Jl.makeRotationX(e),this.applyMatrix4(Jl),this}rotateY(e){return Jl.makeRotationY(e),this.applyMatrix4(Jl),this}rotateZ(e){return Jl.makeRotationZ(e),this.applyMatrix4(Jl),this}translate(e,t,n){return Jl.makeTranslation(e,t,n),this.applyMatrix4(Jl),this}scale(e,t,n){return Jl.makeScale(e,t,n),this.applyMatrix4(Jl),this}lookAt(e){return XN.lookAt(e),XN.updateMatrix(),this.applyMatrix4(XN.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(r_).negate(),this.translate(r_.x,r_.y,r_.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 Rn(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 ma);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];xl.setFromBufferAttribute(s),this.morphTargetsRelative?(Js.addVectors(this.boundingBox.min,xl.min),this.boundingBox.expandByPoint(Js),Js.addVectors(this.boundingBox.max,xl.max),this.boundingBox.expandByPoint(Js)):(this.boundingBox.expandByPoint(xl.min),this.boundingBox.expandByPoint(xl.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 $a);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(xl.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){let a=t[s];Ay.setFromBufferAttribute(a),this.morphTargetsRelative?(Js.addVectors(xl.min,Ay.min),xl.expandByPoint(Js),Js.addVectors(xl.max,Ay.max),xl.expandByPoint(Js)):(xl.expandByPoint(Ay.min),xl.expandByPoint(Ay.max))}xl.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)Js.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(Js));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++)Js.fromBufferAttribute(a,c),l&&(r_.fromBufferAttribute(e,c),Js.add(r_)),r=Math.max(r,n.distanceToSquared(Js))}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 Di(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 Di(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++)Js.fromBufferAttribute(e,t),Js.normalize(),e.setXYZ(t,Js.x,Js.y,Js.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 Di(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"})}},Df=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Zd,this.updateRanges=[],this.version=0,this.uuid=Gu()}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=Gu()),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=Gu()),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}}},ua=new ie,xo=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++)ua.fromBufferAttribute(this,t),ua.applyMatrix4(e),this.setXYZ(t,ua.x,ua.y,ua.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ua.fromBufferAttribute(this,t),ua.applyNormalMatrix(e),this.setXYZ(t,ua.x,ua.y,ua.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ua.fromBufferAttribute(this,t),ua.transformDirection(e),this.setXYZ(t,ua.x,ua.y,ua.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=fa(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Wn(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Wn(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Wn(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Wn(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Wn(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=fa(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=fa(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=fa(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=fa(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Wn(t,this.array),n=Wn(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=Wn(t,this.array),n=Wn(n,this.array),r=Wn(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=Wn(t,this.array),n=Wn(n,this.array),r=Wn(r,this.array),s=Wn(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){SA("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 Di(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){SA("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}}},eue=0,Cs=class extends qo{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:eue++}),this.uuid=Gu(),this.name="",this.type="Material",this.blending=cs,this.side=_o,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Xd,this.blendDst=$d,this.blendEquation=zs,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ut(0,0,0),this.blendAlpha=0,this.depthFunc=zu,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Ey,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Mf,this.stencilZFail=Mf,this.stencilZPass=Mf,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!==cs&&(n.blending=this.blending),this.side!==_o&&(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!==Xd&&(n.blendSrc=this.blendSrc),this.blendDst!==$d&&(n.blendDst=this.blendDst),this.blendEquation!==zs&&(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!==zu&&(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!==Ey&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Mf&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Mf&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Mf&&(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++}},Vu=class extends Cs{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}},s_,my=new ie,o_=new ie,a_=new ie,l_=new Oe,gy=new Oe,vW=new on,sT=new ie,_y=new ie,oT=new ie,UH=new Oe,$N=new Oe,kH=new Oe,CA=class extends Ki{constructor(e=new Vu){if(super(),this.isSprite=!0,this.type="Sprite",s_===void 0){s_=new qn;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 Df(t,5);s_.setIndex([0,1,2,0,2,3]),s_.setAttribute("position",new xo(n,3,0,!1)),s_.setAttribute("uv",new xo(n,2,3,!1))}this.geometry=s_,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.'),o_.setFromMatrixScale(this.matrixWorld),vW.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),a_.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&o_.multiplyScalar(-a_.z);let n=this.material.rotation,r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));let o=this.center;aT(sT.set(-.5,-.5,0),a_,o,o_,r,s),aT(_y.set(.5,-.5,0),a_,o,o_,r,s),aT(oT.set(.5,.5,0),a_,o,o_,r,s),UH.set(0,0),$N.set(1,0),kH.set(1,1);let a=e.ray.intersectTriangle(sT,_y,oT,!1,my);if(a===null&&(aT(_y.set(-.5,.5,0),a_,o,o_,r,s),$N.set(0,1),a=e.ray.intersectTriangle(sT,oT,_y,!1,my),a===null))return;let l=e.ray.origin.distanceTo(my);l<e.near||l>e.far||t.push({distance:l,point:my.clone(),uv:Cf.getInterpolation(my,sT,_y,oT,UH,$N,kH,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 aT(i,e,t,n,r,s){l_.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(gy.x=s*l_.x-r*l_.y,gy.y=r*l_.x+s*l_.y):gy.copy(l_),i.copy(e),i.x+=gy.x,i.y+=gy.y,i.applyMatrix4(vW)}var Ef=new ie,YN=new ie,lT=new ie,Hd=new ie,KN=new ie,cT=new ie,ZN=new ie,Ff=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,Ef)),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=Ef.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ef.copy(this.origin).addScaledVector(this.direction,t),Ef.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){YN.copy(e).add(t).multiplyScalar(.5),lT.copy(t).sub(e).normalize(),Hd.copy(this.origin).sub(YN);let s=e.distanceTo(t)*.5,o=-this.direction.dot(lT),a=Hd.dot(this.direction),l=-Hd.dot(lT),c=Hd.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(YN).addScaledVector(lT,p),x}intersectSphere(e,t){Ef.subVectors(e.center,this.origin);let n=Ef.dot(this.direction),r=Ef.dot(Ef)-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,Ef)!==null}intersectTriangle(e,t,n,r,s){KN.subVectors(t,e),cT.subVectors(n,e),ZN.crossVectors(KN,cT);let o=this.direction.dot(ZN),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Hd.subVectors(this.origin,e);let l=a*this.direction.dot(cT.crossVectors(Hd,cT));if(l<0)return null;let c=a*this.direction.dot(KN.cross(Hd));if(c<0||l+c>o)return null;let u=-a*Hd.dot(ZN);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)}},Yr=class extends Cs{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 Aa,this.combine=GA,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}},GH=new on,AA=new Ff,uT=new $a,zH=new ie,hT=new ie,fT=new ie,dT=new ie,QN=new ie,pT=new ie,VH=new ie,AT=new ie,Gn=class extends Ki{constructor(e=new qn,t=new Yr){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){pT.set(0,0,0);for(let l=0,c=s.length;l<c;l++){let u=a[l],f=s[l];u!==0&&(QN.fromBufferAttribute(f,e),o?pT.addScaledVector(QN,u):pT.addScaledVector(QN.sub(t),u))}t.add(pT)}return t}raycast(e,t){let n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),uT.copy(n.boundingSphere),uT.applyMatrix4(s),AA.copy(e.ray).recast(e.near),!(uT.containsPoint(AA.origin)===!1&&(AA.intersectSphere(uT,zH)===null||AA.origin.distanceToSquared(zH)>(e.far-e.near)**2))&&(GH.copy(s).invert(),AA.copy(e.ray).applyMatrix4(GH),!(n.boundingBox!==null&&AA.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,AA)))}_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=mT(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=mT(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=mT(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=mT(this,o,e,n,c,u,f,P,R,C),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}}};function tue(i,e,t,n,r,s,o,a){let l;if(e.side===hi?l=n.intersectTriangle(o,s,r,!0,a):l=n.intersectTriangle(r,s,o,e.side===_o,a),l===null)return null;AT.copy(a),AT.applyMatrix4(i.matrixWorld);let c=t.ray.origin.distanceTo(AT);return c<t.near||c>t.far?null:{distance:c,point:AT.clone(),object:i}}function mT(i,e,t,n,r,s,o,a,l,c){i.getVertexPosition(a,hT),i.getVertexPosition(l,fT),i.getVertexPosition(c,dT);let u=tue(i,e,t,n,hT,fT,dT,VH);if(u){let f=new ie;Cf.getBarycoord(VH,hT,fT,dT,f),r&&(u.uv=Cf.getInterpolatedAttribute(r,a,l,c,f,new Oe)),s&&(u.uv1=Cf.getInterpolatedAttribute(s,a,l,c,f,new Oe)),o&&(u.normal=Cf.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};Cf.getNormal(hT,fT,dT,p.normal),u.face=p,u.barycoord=f}return u}var RA=class extends Ms{constructor(e=null,t=1,n=1,r,s,o,a,l,c=yi,u=yi,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 yl=class extends Di{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 JN=new ie,nue=new ie,iue=new Sn,ha=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=JN.subVectors(n,t).cross(nue.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(JN),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||iue.getNormalMatrix(e),r=this.coplanarPoint(JN).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)}},mA=new $a,rue=new Oe(.5,.5),gT=new ie,ec=class{constructor(e=new ha,t=new ha,n=new ha,r=new ha,s=new ha,o=new ha){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=go,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===go)r[5].setComponents(c+l,x+p,T+S,L+C).normalize();else if(t===Xa)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(),mA.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),mA.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(mA)}intersectsSprite(e){mA.center.set(0,0,0);let t=rue.distanceTo(e.center);return mA.radius=.7071067811865476+t,mA.applyMatrix4(e.matrixWorld),this.intersectsSphere(mA)}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(gT.x=r.normal.x>0?e.max.x:e.min.x,gT.y=r.normal.y>0?e.max.y:e.min.y,gT.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(gT)<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)}},qH=new on,My=class i{constructor(){this.coordinateSystem=go,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];qH.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),n[r]===void 0&&(n[r]=new ec),n[r].setFromProjectionMatrix(qH,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 ec),t[r].copy(n[r]);return this._count=e._count,this}clone(){return new i().copy(this)}};var Hc=class extends Cs{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}},LT=new ie,DT=new ie,HH=new on,xy=new Ff,_T=new $a,eL=new ie,WH=new ie,ep=class extends Ki{constructor(e=new qn,t=new Hc){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++)LT.fromBufferAttribute(t,r-1),DT.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=LT.distanceTo(DT);e.setAttribute("lineDistance",new Rn(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(),_T.copy(n.boundingSphere),_T.applyMatrix4(r),_T.radius+=s,e.ray.intersectsSphere(_T)===!1)return;HH.copy(r).invert(),xy.copy(e.ray).applyMatrix4(HH);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=xT(this,e,xy,l,T,P,w);R&&t.push(R)}if(this.isLineLoop){let w=u.getX(v-1),S=u.getX(x),T=xT(this,e,xy,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=xT(this,e,xy,l,w,w+1,w);T&&t.push(T)}if(this.isLineLoop){let w=xT(this,e,xy,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 xT(i,e,t,n,r,s,o){let a=i.geometry.attributes.position;if(LT.fromBufferAttribute(a,r),DT.fromBufferAttribute(a,s),t.distanceSqToSegment(LT,DT,eL,WH)>n)return;eL.applyMatrix4(i.matrixWorld);let c=e.ray.origin.distanceTo(eL);if(!(c<e.near||c>e.far))return{distance:c,point:WH.clone().applyMatrix4(i.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:i}}var jH=new ie,XH=new ie,y_=class extends ep{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)jH.fromBufferAttribute(t,r),XH.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+jH.distanceTo(XH);e.setAttribute("lineDistance",new Rn(n,1))}else je("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}};var tp=class extends Cs{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}},$H=new on,uL=new Ff,yT=new $a,vT=new ie,Cy=class extends Ki{constructor(e=new qn,t=new tp){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(),yT.copy(n.boundingSphere),yT.applyMatrix4(r),yT.radius+=s,e.ray.intersectsSphere(yT)===!1)return;$H.copy(r).invert(),uL.copy(e.ray).applyMatrix4($H);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);vT.fromBufferAttribute(f,S),YH(vT,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++)vT.fromBufferAttribute(f,v),YH(vT,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=uL.distanceSqToPoint(i);if(a<t){let l=new ie;uL.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 PA=class extends Ms{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=yi,this.minFilter=yi,this.generateMipmaps=!1,this.needsUpdate=!0}};var qu=class extends Ms{constructor(e=[],t=bl,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 us=class extends Ms{constructor(e,t,n=Ai,r,s,o,a=yi,l=yi,c,u=Ts,f=1){if(u!==Ts&&u!==eo)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 g_(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}},v_=class extends us{constructor(e,t=Ai,n=bl,r,s,o=yi,a=yi,l,c=Ts){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}},Ry=class extends Ms{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},Wc=class i extends qn{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 Rn(c,3)),this.setAttribute("normal",new Rn(u,3)),this.setAttribute("uv",new Rn(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 be=de*V-K;for(let Ie=0;Ie<j;Ie++){let Qe=Ie*z-H;ce[w]=Qe*P,ce[S]=be*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 be=0;be<F;be++){let Ie=p+be+j*de,Qe=p+be+j*(de+1),Ue=p+(be+1)+j*(de+1),mt=p+(be+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 b_=class i extends qn{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 Rn(o,3)),this.setAttribute("normal",new Rn(a,3)),this.setAttribute("uv",new Rn(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)}},IA=class i extends qn{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 Rn(f,3)),this.setAttribute("normal",new Rn(p,3)),this.setAttribute("uv",new Rn(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 ga=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(In(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(In(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}},w_=class extends ga{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}},FT=class extends w_{constructor(e,t,n,r,s,o){super(e,t,n,n,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}};function VL(){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 KH=new ie,ZH=new ie,tL=new VL,nL=new VL,iL=new VL,OT=class extends ga{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]:(ZH.subVectors(r[0],r[1]).add(r[0]),c=ZH);let f=r[a%s],p=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:(KH.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=KH),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),tL.initNonuniformCatmullRom(c.x,f.x,p.x,u.x,v,w,S),nL.initNonuniformCatmullRom(c.y,f.y,p.y,u.y,v,w,S),iL.initNonuniformCatmullRom(c.z,f.z,p.z,u.z,v,w,S)}else this.curveType==="catmullrom"&&(tL.initCatmullRom(c.x,f.x,p.x,u.x,this.tension),nL.initCatmullRom(c.y,f.y,p.y,u.y,this.tension),iL.initCatmullRom(c.z,f.z,p.z,u.z,this.tension));return n.set(tL.calc(l),nL.calc(l),iL.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 QH(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 sue(i,e){let t=1-i;return t*t*e}function oue(i,e){return 2*(1-i)*i*e}function aue(i,e){return i*i*e}function wy(i,e,t,n){return sue(i,e)+oue(i,t)+aue(i,n)}function lue(i,e){let t=1-i;return t*t*t*e}function cue(i,e){let t=1-i;return 3*t*t*i*e}function uue(i,e){return 3*(1-i)*i*i*e}function hue(i,e){return i*i*i*e}function Sy(i,e,t,n,r){return lue(i,e)+cue(i,t)+uue(i,n)+hue(i,r)}var Py=class extends ga{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(Sy(e,r.x,s.x,o.x,a.x),Sy(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}},S_=class extends ga{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(Sy(e,r.x,s.x,o.x,a.x),Sy(e,r.y,s.y,o.y,a.y),Sy(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}},Iy=class extends ga{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}},BT=class extends ga{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}},Ny=class extends ga{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(wy(e,r.x,s.x,o.x),wy(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}},Ly=class extends ga{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(wy(e,r.x,s.x,o.x),wy(e,r.y,s.y,o.y),wy(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}},Dy=class extends ga{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(QH(a,l.x,c.x,u.x,f.x),QH(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}},UT=Object.freeze({__proto__:null,ArcCurve:FT,CatmullRomCurve3:OT,CubicBezierCurve:Py,CubicBezierCurve3:S_,EllipseCurve:w_,LineCurve:Iy,LineCurve3:BT,QuadraticBezierCurve:Ny,QuadraticBezierCurve3:Ly,SplineCurve:Dy}),kT=class extends ga{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 UT[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 UT[r.type]().fromJSON(r))}return this}},NA=class extends kT{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 Iy(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 Ny(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 Py(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 Dy(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 w_(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}},Fy=class extends NA{constructor(e){super(e),this.uuid=Gu(),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 NA().fromJSON(r))}return this}};function fue(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length,s=bW(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(n&&(s=gue(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 Oy(s,o,t,a,l,c,0),o}function bW(i,e,t,n,r){let s;if(r===Cue(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=JH(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=JH(o/n|0,i[o],i[o+1],s);return s&&T_(s,s.next)&&(Uy(s),s=s.next),s}function LA(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(T_(t,t.next)||Dr(t.prev,t,t.next)===0)){if(Uy(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Oy(i,e,t,n,r,s,o){if(!i)return;!o&&s&&bue(i,n,r,s);let a=i;for(;i.prev!==i.next;){let l=i.prev,c=i.next;if(s?pue(i,n,r,s):due(i)){e.push(l.i,i.i,c.i),Uy(i),i=c.next,a=c.next;continue}if(i=c,i===a){o?o===1?(i=Aue(LA(i),e),Oy(i,e,t,n,r,s,2)):o===2&&mue(i,e,t,n,r,s):Oy(LA(i),e,t,n,r,s,1);break}}}function due(i){let e=i.prev,t=i,n=i.next;if(Dr(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&&yy(r,a,s,l,o,c,v.x,v.y)&&Dr(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function pue(i,e,t,n){let r=i.prev,s=i,o=i.next;if(Dr(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=hL(x,v,e,t,n),P=hL(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&&yy(a,u,l,f,c,p,R.x,R.y)&&Dr(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&&yy(a,u,l,f,c,p,C.x,C.y)&&Dr(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&&yy(a,u,l,f,c,p,R.x,R.y)&&Dr(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&&yy(a,u,l,f,c,p,C.x,C.y)&&Dr(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function Aue(i,e){let t=i;do{let n=t.prev,r=t.next.next;!T_(n,r)&&SW(n,t,t.next,r)&&By(n,r)&&By(r,n)&&(e.push(n.i,t.i,r.i),Uy(t),Uy(t.next),t=i=r),t=t.next}while(t!==i);return LA(t)}function mue(i,e,t,n,r,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Tue(o,a)){let l=TW(o,a);o=LA(o,o.next),l=LA(l,l.next),Oy(o,e,t,n,r,s,0),Oy(l,e,t,n,r,s,0);return}a=a.next}o=o.next}while(o!==i)}function gue(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=bW(i,a,l,n,!1);c===c.next&&(c.steiner=!0),r.push(Sue(c))}r.sort(_ue);for(let s=0;s<r.length;s++)t=xue(r[s],t);return t}function _ue(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 xue(i,e){let t=yue(i,e);if(!t)return e;let n=TW(t,i);return LA(n,n.next),LA(t,t.next)}function yue(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(T_(i,t))return t;do{if(T_(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&&wW(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);By(t,i)&&(f<u||f===u&&(t.x>o.x||t.x===o.x&&vue(o,t)))&&(o=t,u=f)}t=t.next}while(t!==a);return o}function vue(i,e){return Dr(i.prev,i,e.prev)<0&&Dr(e.next,i,i.next)<0}function bue(i,e,t,n){let r=i;do r.z===0&&(r.z=hL(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,wue(r)}function wue(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 hL(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 Sue(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 wW(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 yy(i,e,t,n,r,s,o,a){return!(i===o&&e===a)&&wW(i,e,t,n,r,s,o,a)}function Tue(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!Eue(i,e)&&(By(i,e)&&By(e,i)&&Mue(i,e)&&(Dr(i.prev,i,e.prev)||Dr(i,e.prev,e))||T_(i,e)&&Dr(i.prev,i,i.next)>0&&Dr(e.prev,e,e.next)>0)}function Dr(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function T_(i,e){return i.x===e.x&&i.y===e.y}function SW(i,e,t,n){let r=wT(Dr(i,e,t)),s=wT(Dr(i,e,n)),o=wT(Dr(t,n,i)),a=wT(Dr(t,n,e));return!!(r!==s&&o!==a||r===0&&bT(i,t,e)||s===0&&bT(i,n,e)||o===0&&bT(t,i,n)||a===0&&bT(t,e,n))}function bT(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 wT(i){return i>0?1:i<0?-1:0}function Eue(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&&SW(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function By(i,e){return Dr(i.prev,i,i.next)<0?Dr(i,e,i.next)>=0&&Dr(i,i.prev,e)>=0:Dr(i,e,i.prev)<0||Dr(i,i.next,e)<0}function Mue(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 TW(i,e){let t=fL(i.i,i.x,i.y),n=fL(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 JH(i,e,t,n){let r=fL(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 Uy(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 fL(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Cue(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 dL=class{static triangulate(e,t,n=2){return fue(e,t,n)}},jd=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=[];eW(e),tW(n,e);let o=e.length;t.forEach(eW);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,tW(n,t[l]);let a=dL.triangulate(n,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}};function eW(i){let e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function tW(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}var ky=class i extends qn{constructor(e=new Fy([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 Rn(r,3)),this.setAttribute("uv",new Rn(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:Rue,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(!jd.isClockWise(z)){z=z.reverse();for(let Xe=0,st=V.length;Xe<st;Xe++){let tt=V[Xe];jd.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,pi=Math.max(Math.abs(Zt.x),Math.abs(Zt.y),Math.abs(vt.x),Math.abs(vt.y)),Bn=tt*pi*pi;if(ge<=Bn){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,pi=Zt*Zt+Qt*Qt,Bn=Zt*ge-Qt*xn;if(Math.abs(Bn)>Number.EPSILON){let le=Math.sqrt(pi),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(pi)):(vt=Zt,yt=Qt,ln=Math.sqrt(pi/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=[],be,Ie=ce.concat();for(let Xe=0,st=J;Xe<st;Xe++){let tt=V[Xe];be=[];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),be[vt]=ae(tt[vt],tt[ln],tt[Zt]);de.push(be),Ie=Ie.concat(be)}let Qe;if(S===0)Qe=jd.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];be=de[Zt];let ge=[];for(let pi=0,Bn=xn.length;pi<Bn;pi++){let le=Z(xn[pi],be[pi],ln);Et(le.x,le.y,-yt),vt===0&&ge.push(le)}vt===0&&st.push(ge)}}Qe=jd.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];be=de[yt];for(let Qt=0,xn=Zt.length;Qt<xn;Qt++){let ge=Z(Zt[Qt],be[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,pi=st+yt+Qt,Bn=st+yt+xn,le=st+vt+xn;Ct(ge,pi,Bn,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 Pue(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 UT[r.type]().fromJSON(r)),new i(n,e.options)}},Rue={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 Pue(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 DA=class i extends qn{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 Rn(v,3)),this.setAttribute("normal",new Rn(w,3)),this.setAttribute("uv",new Rn(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 _a=class i extends qn{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 Rn(v,3)),this.setAttribute("normal",new Rn(w,3)),this.setAttribute("uv",new Rn(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 Gy=class i extends qn{constructor(e=new Ly(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 Rn(f,3)),this.setAttribute("normal",new Rn(p,3)),this.setAttribute("uv",new Rn(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 UT[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}},zy=class extends qn{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),nW(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),nW(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Rn(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}};function nW(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 Vy=class extends Cs{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(iW(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(iW(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 jo(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 iW(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function Iue(i){let e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function qL(i){let e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:sn.workingColorSpace}var QA={clone:ZA,merge:jo},Nue=`void main() {1+(()=>{var Jse=Object.create;var eP=Object.defineProperty;var eoe=Object.getOwnPropertyDescriptor;var toe=Object.getOwnPropertyNames;var noe=Object.getPrototypeOf,ioe=Object.prototype.hasOwnProperty;var roe=(i,e)=>()=>{try{return e||i((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},soe=(i,e)=>{for(var t in e)eP(i,t,{get:e[t],enumerable:!0})},ooe=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of toe(e))!ioe.call(i,r)&&r!==t&&eP(i,r,{get:()=>e[r],enumerable:!(n=eoe(e,r))||n.enumerable});return i};var aoe=(i,e,t)=>(t=i!=null?Jse(noe(i)):{},ooe(e||!i||!i.__esModule?eP(t,"default",{value:i,enumerable:!0}):t,i));var j$=roe((yv,H6)=>{(function(i,e){typeof yv=="object"&&typeof H6=="object"?H6.exports=e():typeof define=="function"&&define.amd?define("FrameTicker",[],e):typeof yv=="object"?yv.FrameTicker=e():i.FrameTicker=e()})(yv,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 lG=i=>new Promise(e=>setTimeout(e,i)),ls=i=>document.querySelector(i);async function loe(){for(let i=0;i<300&&!(window.__atlasDebug&&!ls("#map-loading")?.checkVisibility?.());i+=1)await lG(100)}async function coe(){let i="";for(let e=0;e<100;e+=1){await lG(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 md(i,e={}){window.dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0,...e}))}function uoe(i,e={}){window.dispatchEvent(new KeyboardEvent("keyup",{key:i,bubbles:!0,cancelable:!0,...e}))}function hoe(i){ls("#map").dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0}))}function O0(i,e){i.value=e,i.dispatchEvent(new Event("change",{bubbles:!0}))}function tP(i,e){let t=ls(i);t.value=e,t.dispatchEvent(new Event("input",{bubbles:!0}))}function nP(i,e=!1){let t=ls("#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 foe(){let i=[],e=async p=>{await coe(),i.push({name:p,snapshot:JSON.parse(window.render_game_to_text())})};await loe(),localStorage.clear();let t=ls("#game-select"),n=t.options[0].value;O0(t,n),await e("initial"),tP("#pin-search","a"),await e("search-a");let r=ls(".search-result");r&&(r.click(),await e("search-select-first"),ls("#close-detail").click(),await e("detail-closed")),tP("#pin-search",""),await e("search-cleared");let s=ls(".category-row input");s&&(s.click(),await e("category-hidden"),s.click(),await e("category-restored"));let o=ls(".only-button");if(o){o.click(),await e("solo-first");let p=ls("#solo-chip");p&&!p.hidden&&p.click(),await e("solo-cleared")}let a=ls("#legend .layer-title");a&&(a.click(),await e("section-folded"),ls("#expand-all").click(),await e("sections-unfolded")),ls("#hide-all").click(),await e("all-hidden"),ls("#show-all").click(),await e("all-shown");let l=ls(".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")),md("g"),await e("grid-open"),tP("#grid-input","m"),await e("grid-descended"),md(" "),await e("subgrid-hidden"),md(" "),md("Escape"),await e("grid-ascended"),md("Escape"),await e("grid-closed"),md("z"),await e("labels-on"),uoe("z"),await e("labels-off"),md("b",{metaKey:!0}),await e("sidebar-collapsed"),md("b",{metaKey:!0}),await e("sidebar-restored"),ls("#zoom-in").click(),await e("zoomed-in");let c=ls("#overview-dock");c&&!ls("#overview-shelf").hidden&&(c.click(),await e("overview-docked"),c.click(),await e("overview-undocked")),ls("#zoom-out").click(),await e("zoomed-out"),hoe("Escape"),await e("viewport-escape");let u=ls("#variant-select");u.options.length>1&&(O0(u,u.options[1].value),await e("variant-second"),O0(u,u.options[0].value),await e("variant-first"));let f=ls("#map-select");return f.options.length>1&&(O0(f,f.options[1].value),await e("map-second"),O0(f,f.options[0].value),await e("map-first")),t.options.length>1&&(O0(t,t.options[1].value),await e("game-second"),O0(t,n),await e("game-first")),localStorage.clear(),{viewport:[window.innerWidth,window.innerHeight],steps:i}}var iP=!1;async function cG(){if(!iP){iP=!0,nP("parity tour running\u2026");try{let i=await foe(),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}`);nP(`parity tour complete \u2713 ${i.steps.length} steps`),console.log("parity tour saved to",t)}catch(i){nP(`parity tour failed: ${i}`,!0),console.error("parity tour failed",i)}finally{iP=!1}}}window.__atlasTour=cG;window.addEventListener("keydown",i=>{i.key==="F9"&&cG()});var nn=i=>document.querySelector(i),ye={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 B0(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 U={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,gridSystem:"geohash",globeActive:!1,subgridVisible:!0,gridCell:"",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 U0=["#4fb3d5","#c9924b","#82b56a","#c96a6a","#9581cc","#4bc9a9","#d4b04a","#6a92c9","#b08a5a","#8fb3a2"],k0="0123456789bcdefghjkmnpqrstuvwxyz";var rP="atlas.session";var uG={light:"rgba(255, 255, 255, 0.96)",dark:"rgba(7, 9, 7, 0.98)"},Li={labelSizePx:11,neighborLabelSizePx:10,labelInsetPx:5,labelFont:"ui-monospace, SFMono-Regular, Menlo, monospace",prefixAlpha:.55,chip:"rgba(12, 15, 22, 0.76)",neighborChip:"rgba(8, 11, 18, 0.88)",lineWhite:"#ffffff",widths:{leaf:2.5,scope:2.5,scopeBare:1.8,child:1.4,neighbor:1},childLineAlpha:.82,neighborLineAlpha:.44,leafFillAlpha:.14,childFillAlpha:.055,neighborTextAlpha:.72,dimColor:"#050810",dimBase:.3,dimStep:.06,dimCap:.52};function fw(i){let e=[...cg()],t=!0;for(let n of i){let r=k0.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 oP(i,e){let t=[...cg()],[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+=k0[l]}return o}var sP={key:null,extent:null};function doe(i){let t=`${cg().join(",")}|${i}`;return sP.key!==t&&(sP={key:t,extent:fw(i)}),sP.extent}var aP={slug:"geohash",name:"Geohash",appliesTo(){return!0},maxLevel(){return 3},inputLength(){return 3},level(i){return i.length},parent(i){return i.slice(0,-1)},children(i){return[...k0].map(e=>i+e)},childIndex(i){return Math.max(0,k0.indexOf(i[i.length-1]))},contains(i,e){let t=doe(i),[n,r]=e;return n>=t[0]&&n<=t[2]&&r>=t[1]&&r<=t[3]},descendTarget(i,e){return oP(e,i.length+1)},bbox:fw,center(i){let e=fw(i);return[(e[0]+e[2])/2,(e[1]+e[3])/2]},ring(i){let[e,t,n,r]=fw(i);return[[e,t],[e,r],[n,r],[n,t],[e,t]]},poleContained(){return null},label(i){return{context:i.slice(0,-1),principal:i.slice(-1)}},colorKey(i){return Math.max(0,k0.indexOf(i[i.length-1]))%U0.length},normalizeInput(i){return[...i.toLocaleLowerCase()].filter(e=>k0.includes(e)).slice(0,3).join("")},parseInput(i){return i},locate(i){let e=oP(i,3);return e?{label:"Geohash",value:e}:null}};function hG(i,e=3){return oP(i,e)}function cg(){let i=U.variant?.surface;if(i)return[i.x,-(i.y+i.height),i.x+i.width,-i.y];let e=U.game?.tileGrid.size??0,t=U.variant?.bounds||{x:0,y:0,width:e,height:e};return[t.x,-(t.y+t.height),t.x+t.width,-t.y]}var poe=[aP];function uo(){return poe.find(i=>i.slug===U.gridSystem)||aP}function fG(i,e,t){let n=i[0]===i[i.length-1]||Aoe(i[0],i[i.length-1])?i.slice(0,-1):[...i];for(let[r,s]of[[e,([o])=>o>=e],[t,([o])=>o<=t]]){let o=[];for(let a=0;a<n.length;a++){let l=n[a],c=n[(a+n.length-1)%n.length],u=s(l),f=s(c);if(u!==f){let p=(r-c[0])/(l[0]-c[0]);o.push([r,c[1]+p*(l[1]-c[1])])}u&&o.push(l)}if(n=o,n.length===0)return[]}return[...n,n[0]]}function Aoe(i,e){return i[0]===e[0]&&i[1]===e[1]}var ys={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function lP(i){let e=Pr();for(let t=0,n=i.length;t<n;++t)V0(e,i[t]);return e}function moe(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 dl(n,r,s,o,t)}function ug(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 pw(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i.slice()}function gd(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 wc(i,e){return vx(i,e[0],e[1])}function xu(i,e){return i[0]<=e[0]&&e[2]<=i[2]&&i[1]<=e[1]&&e[3]<=i[3]}function vx(i,e,t){return i[0]<=e&&e<=i[2]&&i[1]<=t&&t<=i[3]}function dw(i,e){let t=i[0],n=i[1],r=i[2],s=i[3],o=e[0],a=e[1],l=ys.UNKNOWN;return o<t?l=l|ys.LEFT:o>r&&(l=l|ys.RIGHT),a<n?l=l|ys.BELOW:a>s&&(l=l|ys.ABOVE),l===ys.UNKNOWN&&(l=ys.INTERSECTING),l}function Pr(){return[1/0,1/0,-1/0,-1/0]}function dl(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 G0(i){return dl(1/0,1/0,-1/0,-1/0,i)}function Aw(i,e){let t=i[0],n=i[1];return dl(t,n,t,n,e)}function hg(i,e,t,n,r){let s=G0(r);return cP(s,i,e,t,n)}function z0(i,e){return i[0]==e[0]&&i[2]==e[2]&&i[1]==e[1]&&i[3]==e[3]}function mw(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 V0(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 cP(i,e,t,n,r){for(;t<n;t+=r)goe(i,e[t],e[t+1]);return i}function goe(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 gw(i,e){let t;return t=e(fg(i)),t||(t=e(dg(i)),t)||(t=e(pg(i)),t)||(t=e(Wl(i)),t)?t:!1}function bx(i){let e=0;return vu(i)||(e=jn(i)*xr(i)),e}function fg(i){return[i[0],i[1]]}function dg(i){return[i[2],i[1]]}function za(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function dG(i,e){let t;if(e==="bottom-left")t=fg(i);else if(e==="bottom-right")t=dg(i);else if(e==="top-left")t=Wl(i);else if(e==="top-right")t=pg(i);else throw new Error("Invalid corner");return t}function wx(i,e,t,n,r){let[s,o,a,l,c,u,f,p]=uP(i,e,t,n);return dl(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 uP(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 xr(i){return i[3]-i[1]}function yu(i,e,t){let n=t||Pr();return yr(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]):G0(n),n}function hP(i,e){if(!yr(i,e))return[i.slice()];if(xu(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 Wl(i){return[i[0],i[3]]}function pg(i){return[i[2],i[3]]}function jn(i){return i[2]-i[0]}function yr(i,e){return i[0]<=e[2]&&i[2]>=e[0]&&i[1]<=e[3]&&i[3]>=e[1]}function vu(i){return i[2]<i[0]||i[3]<i[1]}function pG(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i}function AG(i,e,t){let n=!1,r=dw(i,e),s=dw(i,t);if(r===ys.INTERSECTING||s===ys.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&ys.ABOVE&&!(r&ys.ABOVE)&&(w=p-(x-c)/v,n=w>=o&&w<=l),!n&&s&ys.RIGHT&&!(r&ys.RIGHT)&&(S=x-(p-l)*v,n=S>=a&&S<=c),!n&&s&ys.BELOW&&!(r&ys.BELOW)&&(w=p-(x-a)/v,n=w>=o&&w<=l),!n&&s&ys.LEFT&&!(r&ys.LEFT)&&(S=x-(p-o)*v,n=S>=a&&S<=c)}return n}function mG(i,e,t,n){if(vu(i))return G0(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 moe(s,o,t)}function fP(i,e){let t=e.getExtent(),n=za(i);if(e.canWrapX()&&(n[0]<t[0]||n[0]>=t[2])){let r=jn(t),o=Math.floor((n[0]-t[0])/r)*r;i[0]-=o,i[2]-=o}return i}function _w(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]]];fP(i,e);let r=jn(n);if(jn(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 gG(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(...hP(t[o],e[n]));t=s}return t}var _G={info:1,warn:2,error:3,none:4},_oe=_G.info;function xw(...i){_oe>_G.warn||console.warn(...i)}function xi(i,e,t){return Math.min(Math.max(i,e),t)}function xG(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 Sc(i,e,t,n)}function Sc(i,e,t,n){let r=t-i,s=n-e;return r*r+s*s}function yG(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 yw(i){return i*180/Math.PI}function Tc(i){return i*Math.PI/180}function bu(i,e){let t=i%e;return t*e<0?t+e:t}function Fo(i,e,t){return i+t*(e-i)}function q0(i,e){let t=Math.pow(10,e);return Math.round(i*t)/t}function Sx(i,e){return Math.floor(q0(i,e))}function Tx(i,e){return Math.ceil(q0(i,e))}function vw(i,e,t){if(i>=e&&i<t)return i;let n=t-e;return((i-e)%n+n)%n+e}function vG(i,e){return i[0]+=+e[0],i[1]+=+e[1],i}function H0(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 Ag(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 bG(i,e){return i[0]*=e,i[1]*=e,i}function bw(i,e){if(e.canWrapX()){let t=jn(e.getExtent()),n=wG(i,e,t);n&&(i[0]-=n*t)}return i}function wG(i,e,t){let n=e.getExtent(),r=0;return e.canWrapX()&&(i[0]<n[0]||i[0]>n[2])&&(t=t||jn(n),r=Math.floor((i[0]-n[0])/t)),r}function SG(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(xi(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 tf={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var dP=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_||tf[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_}},_d=dP;var Ex=6378137,mg=Math.PI*Ex,xoe=[-mg,-mg,mg,mg],yoe=[-180,-85,180,85],ww=Ex*Math.log(Math.tan(Math.PI/2)),xd=class extends _d{constructor(e){super({code:e,units:"m",extent:xoe,global:!0,worldExtent:yoe,getPointResolution:function(t,n){return t/Math.cosh(n[1]/Ex)}})}},pP=[new xd("EPSG:3857"),new xd("EPSG:102100"),new xd("EPSG:102113"),new xd("EPSG:900913"),new xd("http://www.opengis.net/def/crs/EPSG/0/3857"),new xd("http://www.opengis.net/gml/srs/epsg.xml#3857")];function TG(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]=mg*i[s]/180;let o=Ex*Math.log(Math.tan(Math.PI*(+i[s+1]+90)/360));o>ww?o=ww:o<-ww&&(o=-ww),e[s+1]=o}return e}function EG(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]/mg,e[s+1]=360*Math.atan(Math.exp(i[s+1]/Ex))/Math.PI-90;return e}var voe=6378137,MG=[-180,-90,180,90],boe=Math.PI*voe/180,nf=class extends _d{constructor(e,t){super({code:e,units:"degrees",extent:MG,axisOrientation:t,global:!0,metersPerUnit:boe,worldExtent:MG})}},AP=[new nf("CRS:84"),new nf("EPSG:4326","neu"),new nf("urn:ogc:def:crs:OGC:1.3:CRS84"),new nf("urn:ogc:def:crs:OGC:2:84"),new nf("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new nf("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new nf("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var mP={};function CG(i){return mP[i]||mP[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function RG(i,e){mP[i]=e}function wu(i){for(let e in i)delete i[e]}function Ec(i){let e;for(e in i)return!1;return!e}var gg={};function _g(i,e,t){let n=i.getCode(),r=e.getCode();n in gg||(gg[n]={}),gg[n][r]=t}function Sw(i,e){return i in gg&&e in gg[i]?gg[i][e]:null}var Tw=.9996,jl=.00669438,Mw=jl*jl,Cw=Mw*jl,W0=jl/(1-jl),PG=Math.sqrt(1-jl),xg=(1-PG)/(1+PG),DG=xg*xg,gP=DG*xg,_P=gP*xg,FG=_P*xg,OG=1-jl/4-3*Mw/64-5*Cw/256,woe=3*jl/8+3*Mw/32+45*Cw/1024,Soe=15*Mw/256+45*Cw/1024,Toe=35*Cw/3072,Eoe=3/2*xg-27/32*gP+269/512*FG,Moe=21/16*DG-55/32*_P,Coe=151/96*gP-417/128*FG,Roe=1097/512*_P,Ew=6378137;function Poe(i,e,t){let n=i-5e5,o=(t.north?e:e-1e7)/Tw/(Ew*OG),a=o+Eoe*Math.sin(2*o)+Moe*Math.sin(4*o)+Coe*Math.sin(6*o)+Roe*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-jl*c,w=Math.sqrt(1-jl*c),S=Ew/w,T=(1-jl)/v,R=W0*u**2,P=R*R,C=n/(S*Tw),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*R-4*P-9*W0))+B/720*(61+90*p+298*R+45*x-252*W0-3*P),V=(C-D/6*(1+2*p+R)+N/120*(5-2*R+28*p-3*P+8*W0+24*x))/u;return V=vw(V+Tc(BG(t.number)),-Math.PI,Math.PI),[yw(V),yw(z)]}var IG=-80,NG=84,Ioe=-180,Noe=180;function Loe(i,e,t){i=vw(i,Ioe,Noe),e<IG?e=IG:e>NG&&(e=NG);let n=Tc(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,c=Tc(i),u=BG(t.number),f=Tc(u),p=Ew/Math.sqrt(1-jl*r**2),x=W0*s**2,v=s*vw(c-f,-Math.PI,Math.PI),w=v*v,S=w*v,T=S*v,R=T*v,P=R*v,C=Ew*(OG*n-woe*Math.sin(2*n)+Soe*Math.sin(4*n)-Toe*Math.sin(6*n)),L=Tw*p*(v+S/6*(1-a+x)+R/120*(5-18*a+l+72*x-58*W0))+5e5,D=Tw*(C+p*o*(w/2+T/24*(5-a+9*x+4*x**2)+P/720*(61-58*a+l+600*x-330*W0)));return t.north||(D+=1e7),[L,D]}function BG(i){return(i-1)*6-180+3}var Doe=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function UG(i){let e=0;for(let r of Doe){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 LG(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 kG(i){return UG(i)?new _d({code:i,units:"m"}):null}function GG(i){let e=UG(i.getCode());return e?{forward:LG(Loe,e),inverse:LG(Poe,e)}:null}var Foe=63710088e-1;function xP(i,e,t){t=t||Foe;let n=Tc(i[1]),r=Tc(e[1]),s=(r-n)/2,o=Tc(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 Ooe=[GG],Boe=[kG];var vP=!0;function VG(i){vP=!(i===void 0?!0:i)}function wP(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 bP(i){RG(i.getCode(),i),_g(i,i,wP)}function Uoe(i){i.forEach(bP)}function vs(i){if(typeof i!="string")return i;let e=CG(i);if(e)return e;for(let t of Boe){let n=t(i);if(n)return n}return null}function SP(i,e,t,n){i=vs(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/tf[n])}}else{let o=i.getUnits();if(o=="degrees"&&!n||n=="degrees")r=e;else{let a=j0(i,vs("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=xP(c.slice(0,2),c.slice(2,4)),f=xP(c.slice(4,6),c.slice(6,8));r=(u+f)/2}let l=n?tf[n]:i.getMetersPerUnit();l!==void 0&&(r/=l)}}return r}function zG(i){Uoe(i),i.forEach(function(e){i.forEach(function(t){e!==t&&_g(e,t,wP)})})}function koe(i,e,t,n){i.forEach(function(r){e.forEach(function(s){_g(r,s,t),_g(s,r,n)})})}function Rw(i,e){return i?typeof i=="string"?vs(i):i:vs(e)}function qG(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 yg(i,e){if(i===e)return!0;let t=i.getUnits()===e.getUnits();return(i.getCode()===e.getCode()||j0(i,e)===wP)&&t}function j0(i,e){let t=i.getCode(),n=e.getCode(),r=Sw(t,n);if(r)return r;let s=null,o=null;for(let l of Ooe)s||(s=l(i)),o||(o=l(e));if(!s&&!o)return null;let a="EPSG:4326";if(o)if(s)r=yP(s.inverse,o.forward);else{let l=Sw(t,a);l&&(r=yP(l,o.forward))}else{let l=Sw(a,n);l&&(r=yP(s.inverse,l))}return r&&(bP(i),bP(e),_g(i,e,r)),r}function yP(i,e){return function(t,n,r,s){return n=i(t,n,r,s),e(n,n,r,s)}}function X0(i,e){let t=vs(i),n=vs(e);return j0(t,n)}function vg(i,e,t){let n=X0(e,t);if(!n){let r=vs(e).getCode(),s=vs(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=X0(e,t);return mG(i,r,void 0,n)}var Mc=null;function $0(){return Mc}function Mx(i,e){return Mc?vg(i,e,Mc):i}function Cc(i,e){return Mc?vg(i,Mc,e):(vP&&!H0(i,[0,0])&&i[0]>=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&(vP=!1,xw("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i)}function yd(i,e){return Mc?HG(i,e,Mc):i}function Rc(i,e){return Mc?HG(i,Mc,e):i}function WG(i,e){if(!Mc)return i;let t=vs(e).getMetersPerUnit(),n=Mc.getMetersPerUnit();return t&&n?i*t/n:i}function Goe(){zG(pP),zG(AP),koe(AP,pP,TG,EG)}Goe();function TP(i){return i[0]>0&&i[1]>0}function jG(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 jr(i,e){return Array.isArray(i)?i:(e===void 0?e=[i,i]:(e[0]=i,e[1]=i),e)}var Pw=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 Y0(i,e,t,n,r){return r!==void 0?(r.minX=i,r.maxX=e,r.minY=t,r.maxY=n,r):new Pw(i,e,t,n)}var Iw=Pw;function XG(i,e,t){let n,r;t=t||Va;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 Va(i,e){return i>e?1:i<e?-1:0}function $G(i,e){return i<e?1:i>e?-1:0}function bg(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 YG(i,e,t){for(;e<t;){let n=i[e];i[e]=i[t],i[t]=n,++e,--t}}function Pc(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 Oo(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 KG(i,e,t){let n=e||Va;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 Vn(i,e){if(!i)throw new Error(e)}function ZG(i,e,t,n,r){return!gw(r,function(o){return!vd(i,e,t,n,o[0],o[1])})}function vd(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 Cx(i,e,t,n,r,s){if(t.length===0||!vd(i,e,t[0],n,r,s))return!1;for(let o=1,a=t.length;o<a;++o)if(vd(i,t[o-1],t[o],n,r,s))return!1;return!0}function QG(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(Cx(i,e,l,n,r,s))return!0;e=l[l.length-1]}return!1}function JG(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 Nw(i,e,t,n,r,s){return s=s??cP(Pr(),i,e,t,n),yr(r,s)?s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:JG(i,e,t,n,function(o,a){return AG(r,o,a)}):!1}function EP(i,e,t,n,r){return!!(Nw(i,e,t,n,r)||vd(i,e,t,n,r[0],r[1])||vd(i,e,t,n,r[0],r[3])||vd(i,e,t,n,r[2],r[1])||vd(i,e,t,n,r[2],r[3]))}function MP(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(ZG(i,t[s-1],t[s],n,r)&&!Nw(i,t[s-1],t[s],n,r))return!1;return!0}function ez(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(MP(i,e,a,n,r))return!0;e=a[a.length-1]}return!1}function Kn(){throw new Error("Unimplemented abstract method.")}var zoe=0;function Ln(i){return i.ol_uid||(i.ol_uid=String(++zoe))}function wg(i,e,t,n){return n!==void 0?(n[0]=i,n[1]=e,n[2]=t,n):[i,e,t]}function Voe(i,e,t){return i+"/"+e+"/"+t}function Sg(i,e,t,n,r){return`${Ln(i)},${e},${Voe(t,n,r)}`}function tz(i){return qoe(i[0],i[1],i[2])}function qoe(i,e,t){return(e<<i)+t}function nz(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 Tg=[0,0,0],bd=5,CP=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,Vn(KG(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,Vn(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_=Wl(s)),Vn(!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,Vn(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,Vn(!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 Iw(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=Y0(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 Y0(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 Y0(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 Y0(c,c,u,u,n);let f=Math.floor(l*(s+1))-1,p=Math.floor(l*(o+1))-1;return Y0(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,Tg);let r=Tg[1],s=Tg[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,Tg);let o=Tg[1],a=Tg[2];return Y0(r,o,s,a,n)}getTileCoordCenter(e){let t=this.getOrigin(e[0]),n=this.getResolution(e[0]),r=jr(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=jr(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 dl(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=jr(this.getTileSize(o),this.tmpSize_),u=a*(e-l[0])/n/c[0],f=a*(l[1]-t)/n/c[1];return r?(u=Tx(u,bd)-1,f=Tx(f,bd)-1):(u=Sx(u,bd),f=Sx(f,bd)),wg(o,u,f,s)}getTileCoordForXYAndZ_(e,t,n,r,s){let o=this.getOrigin(n),a=this.getResolution(n),l=jr(this.getTileSize(n),this.tmpSize_),c=(e-o[0])/a/l[0],u=(o[1]-t)/a/l[1];return r?(c=Tx(c,bd)-1,u=Tx(u,bd)-1):(c=Sx(c,bd),u=Sx(u,bd)),wg(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=bg(this.resolutions_,e,t||0);return xi(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}},Rx=CP;function Lw(i){let e=i.getDefaultTileGrid();return e||(e=Woe(i),i.setDefaultTileGrid(e)),e}function rz(i,e,t){let n=e[0],r=i.getTileCoordCenter(e),s=Dw(t);if(!wc(s,r)){let o=jn(s),a=Math.ceil((s[0]-r[0])/o);return r[0]+=o*a,i.getTileCoordForCoordAndZ(r,n)}return e}function Hoe(i,e,t,n){n=n!==void 0?n:"top-left";let r=oz(i,e,t);return new Rx({extent:i,origin:dG(i,n),resolutions:r,tileSize:t})}function sz(i){let e=i||{},t=e.extent||vs("EPSG:3857").getExtent(),n={extent:t,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:oz(t,e.maxZoom,e.tileSize,e.maxResolution)};return new Rx(n)}function oz(i,e,t,n){e=e!==void 0?e:42,t=jr(t!==void 0?t:256);let r=xr(i),s=jn(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 Woe(i,e,t,n){let r=Dw(i);return Hoe(r,e,t,n)}function Dw(i){i=vs(i);let e=i.getExtent();if(!e){let t=180*tf.degrees/i.getMetersPerUnit();e=dl(-t,-t,t,t)}return e}var Mn={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function kn(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 Eg(i,e,t,n){return kn(i,e,t,n,!0)}function ri(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),wu(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 RP=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},wd=RP;function rf(){return!0}function sf(){return!1}function of(){}function Fw(i){let e,t,n;return function(){let r=Array.prototype.slice.call(arguments);return(!t||this!==n||!Oo(r,t))&&(n=this,t=r,e=i.apply(this,arguments)),e}}function az(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 PP=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};var Ks=PP;var IP=class extends wd{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 Ks(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,of);delete o[n]}return l}disposeInternal(){this.listeners_&&wu(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]=of,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}},Sd=IP;var K0=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",joe=K0.includes("safari")&&!K0.includes("chrom"),R5e=joe&&(K0.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(K0)),lz=K0.includes("webkit")&&!K0.includes("edge"),NP=K0.includes("macintosh"),cz=typeof devicePixelRatio<"u"?devicePixelRatio:1,Us=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,LP=typeof Image<"u"&&Image.prototype.decode;var Ow=(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 uz(i,e,t){let n=i,r=!0,s=!1,o=!1,a=[Eg(n,Jt.LOAD,function(){o=!0,s||e()})];return n.src&&LP?(s=!0,n.decode().then(function(){r&&e()}).catch(function(l){r&&(o?e():t())})):a.push(Eg(n,Jt.ERROR,t)),function(){r=!1,a.forEach(ri)}}function Xoe(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 hz(i,e){return e&&(i.src=e),i.src&&LP?new Promise((t,n)=>i.decode().then(()=>t(i)).catch(r=>i.complete&&i.width?t(i):n(r))):Xoe(i)}var rn={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function DP(i){return Math.pow(i,3)}function Xl(i){return 1-DP(1-i)}function fz(i){return 3*i*i-2*i*i*i}function dz(i){return i}var FP=class extends Sd{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(){Kn()}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:DP(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=FP;function Ti(i,e,t,n){let r;return t&&t.length?r=t.shift():Us?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 OP;function Px(){return OP||(OP=Ti(1,1)),OP}function Z0(i){let e=i.canvas;e.width=1,e.height=1,i.clearRect(0,0,1,1)}function BP(i,e){let t=e.parentNode;t&&t.replaceChild(i,e)}function pz(i){for(;i.lastChild;)i.lastChild.remove()}function Az(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 pl(i){return typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas}var UP=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_,Us?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_=$oe(),this.changed()}handleImageLoad_(){if(Us)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_=uz(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 $oe(){let i=Ti(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}var Uw=UP;var kP,Q0=[];function mz(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 GP(i,e){return Math.abs(i[e*4]-210)>2||Math.abs(i[e*4+3]-.75*255)>2}function Yoe(){if(kP===void 0){let i=Ti(6,6,Q0);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",mz(i,4,5,4,0),mz(i,4,5,0,5);let e=i.getImageData(0,0,3,3).data;kP=GP(e,0)||GP(e,4)||GP(e,8),Z0(i),Q0.push(i.canvas)}return kP}function gz(i,e,t,n){let r=vg(t,e,i),s=SP(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||wc(l,r)){let c=SP(i,s,r)/s;isFinite(c)&&c>0&&(s/=c)}return s}function _z(i,e,t,n){let r=za(t),s=gz(i,e,r,n);return(!isFinite(s)||s<=0)&&gw(t,function(o){return s=gz(i,e,o,n),isFinite(s)&&s>0}),s}function xz(i,e,t,n,r,s,o,a,l,c,u,f,p,x){let v=Ti(Math.round(t*i),Math.round(t*e),Q0);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=Pr();l.forEach(function(L,D,F){mw(S,L.extent)});let T,R=t/n,P=(f?1:1+Math.pow(2,-24))/R;if(!p||l.length!==1||c!==0){if(T=Ti(Math.round(jn(S)*R),Math.round(xr(S)*R),Q0),f||(T.imageSmoothingEnabled=!1),r&&x){let L=(r[0]-S[0])*R,D=-(r[3]-S[3])*R,F=jn(r)*R,N=xr(r)*R;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])*R,K=-(L.clipExtent[3]-S[3])*R,J=jn(L.clipExtent)*R,j=xr(L.clipExtent)*R;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])*R,B=-(L.extent[3]-S[3])*R,z=jn(L.extent)*R,V=xr(L.extent)*R;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=Wl(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),be=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,be-ee]],mt=yG(Ue);if(!mt)return;if(v.save(),v.beginPath(),Yoe()||!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,be)}else v.moveTo(ae,ce),v.lineTo(Z,ee),v.lineTo(de,be);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(P,-P);else{let ze=l[0],$e=ze.extent;Me=ze.image,v.scale(jn($e)/Me.width,-xr($e)/Me.height)}v.drawImage(Me,0,0),v.restore()}),T&&(Z0(T),Q0.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 Koe=[1,0,0,1,0,0],sNe=new Array(6);function Zs(){return Koe.slice(0)}function yz(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 Ir(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 ho(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 Gw(i,e){let t=Zoe(e);Vn(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 Zoe(i){return i[0]*i[3]-i[1]*i[2]}var Qoe=[1e5,1e5,1e5,1e5,2,2];function vz(i){return"matrix("+i.join(", ")+")"}function kw(i){return i.substring(7,i.length-1).split(",").map(parseFloat)}function bz(i,e){let t=kw(i),n=kw(e);for(let r=0;r<6;++r)if(Math.round((t[r]-n[r])*Qoe[r])!==0)return!1;return!0}var Joe=10,wz=.25,zP=class{constructor(e,t,n,r,s,o,a){this.sourceProj_=e,this.targetProj_=t;let l={},c=a?qG(P=>Ir(a,vg(P,this.targetProj_,this.sourceProj_))):X0(this.targetProj_,this.sourceProj_);this.transformInv_=function(P){let C=P[0]+"/"+P[1];return l[C]||(l[C]=c(P)),l[C]},this.maxSourceExtent_=r,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&jn(r)>=jn(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?jn(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?jn(this.targetProj_.getExtent()):null;let u=Wl(n),f=pg(n),p=dg(n),x=fg(n),v=this.transformInv_(u),w=this.transformInv_(f),S=this.transformInv_(p),T=this.transformInv_(x),R=Joe+(o?Math.max(0,Math.ceil(Math.log2(bx(n)/(o*o*256*256)))):0);if(this.addQuad_(u,f,p,x,v,w,S,T,R),this.wrapsXInSource_){let P=1/0;this.triangles_.forEach(function(C,L,D){P=Math.min(P,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])-P>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]-P>this.sourceWorldWidth_/2&&(L[0][0]-=this.sourceWorldWidth_),L[1][0]-P>this.sourceWorldWidth_/2&&(L[1][0]-=this.sourceWorldWidth_),L[2][0]-P>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=lP([s,o,a,l]),f=this.sourceWorldWidth_?jn(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=lP([e,t,n,r]);v=jn(S)/this.targetWorldWidth_>wz||v}!x&&this.sourceProj_.isGlobal()&&f&&(v=f>wz||v)}if(!v&&this.maxSourceExtent_&&isFinite(u[0])&&isFinite(u[1])&&isFinite(u[2])&&isFinite(u[3])&&!yr(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),R;x?R=(bu(s[0],p)+bu(a[0],p))/2-bu(T[0],p):R=(s[0]+a[0])/2-T[0];let P=(s[1]+a[1])/2-T[1];v=R*R+P*P>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),R=[(r[0]+e[0])/2,(r[1]+e[1])/2],P=this.transformInv_(R);this.addQuad_(e,t,S,R,s,o,T,P,c-1),this.addQuad_(R,S,n,r,P,T,a,l,c-1)}else{let S=[(e[0]+t[0])/2,(e[1]+t[1])/2],T=this.transformInv_(S),R=[(n[0]+r[0])/2,(n[1]+r[1])/2],P=this.transformInv_(R);this.addQuad_(e,S,R,r,s,T,P,l,c-1),this.addQuad_(S,t,n,R,T,o,a,P,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=Pr();return this.triangles_.forEach(function(t,n,r){let s=t.source;V0(e,s[0]),V0(e,s[1]),V0(e,s[2])}),e}getTriangles(){return this.triangles_}},Sz=zP;var VP=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?yu(x,v):x;if(bx(S)===0){this.state=rn.EMPTY;return}let T=e.getExtent();T&&(w?w=yu(w,T):w=T);let R=r.getResolution(this.wrappedTileCoord_[0]),P=_z(e,n,S,R);if(!isFinite(P)||P<=0){this.state=rn.EMPTY;return}let C=u!==void 0?u:.5;if(this.triangulation_=new Sz(e,n,S,w,P*C,R),this.triangulation_.getTriangles().length===0){this.state=rn.EMPTY;return}this.sourceZ_=t.getZForResolution(P);let L=this.triangulation_.calculateSourceExtent();if(w&&(e.canWrapX()?(L[1]=xi(L[1],w[1],w[3]),L[3]=xi(L[3],w[1],w[3])):L=yu(L,w)),!bx(L))this.state=rn.EMPTY;else{let D=0,F=0;e.canWrapX()&&(D=jn(T),F=Math.floor((L[0]-T[0])/D)),_w(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_=xz(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=kn(t,Jt.CHANGE,s=>{let o=t.getState();(o==rn.LOADED||o==rn.ERROR||o==rn.EMPTY)&&(ri(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(ri),this.sourcesListenerKeys_=null}release(){this.canvas_&&(Z0(this.canvas_.getContext("2d")),Q0.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}},zw=VP;var eae=/\{z\}/g,tae=/\{x\}/g,nae=/\{y\}/g,iae=/\{-y\}/g;function Tz(i,e,t,n,r){return i.replace(eae,e.toString()).replace(tae,t.toString()).replace(nae,n.toString()).replace(iae,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 Ez(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 rae(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 Tz(i,o,t[1],t[2],s)})}function Mz(i,e){let t=i.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=rae(i[r],e);return sae(n)}function sae(i){return i.length===1?i[0]:(function(e,t,n){if(!e)return;let r=tz(e),s=bu(r,i.length);return i[s](e,t,n)})}var Ic={PROPERTYCHANGE:"propertychange"};var Cg=class extends Sd{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]=kn(this,e[s],t);return r}return kn(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]=Eg(this,e[s],t)}else n=Eg(this,e,t);return t.ol_key=n,n}unInternal(e,t){let n=t.ol_key;if(n)oae(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)}};Cg.prototype.on;Cg.prototype.once;Cg.prototype.un;function oae(i){if(Array.isArray(i))for(let e=0,t=i.length;e<t;++e)ri(i[e]);else ri(i)}var Vw=Cg;var qw=class extends Ks{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}},qP=class extends Vw{constructor(e){super(),this.on,this.once,this.un,Ln(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 qw(n,e,t)),n=Ic.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new qw(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],Ec(this.values_)&&(this.values_=null),t||this.notify(e,n)}}},bs=qP;var HP=class extends bs{constructor(e){super(),this.projection=vs(e.projection),this.attributions_=Cz(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_=Cz(e),this.changed()}setState(e){this.state_=e,this.changed()}};function Cz(i){return i?typeof i=="function"?i:(Array.isArray(i)||(i=[i]),e=>i):null}var Hw=HP;var WP=class extends Hw{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&&jr(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),t),this.tmpSize=[0,0],this.key_=e.key||Ln(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 Kn()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:Lw(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,n){let r=this.getTileGridForProjection(n),s=this.getTilePixelRatio(t),o=jr(r.getTileSize(e),this.tmpSize);return s==1?o:jG(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=rz(r,e,n)),nz(e,r)?e:null}clear(){}refresh(){this.clear(),super.refresh()}},Ww=class extends Ks{constructor(e,t){super(e),this.tile=t}},Rz=WP;var jw={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};var jP=class i extends Rz{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=Ln(t),r=t.getState(),s;r==rn.LOADING?(this.tileLoadingKeys_[n]=!0,s=jw.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],s=r==rn.ERROR?jw.TILELOADERROR:r==rn.LOADED?jw.TILELOADEND:void 0),s!=null&&this.dispatchEvent(new Ww(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=Ez(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;let t=e.join(`2+`);this.generateTileUrlFunction_?this.setTileUrlFunction(Mz(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,n){}},Pz=jP;var XP=class extends Pz{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:aae,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:Uw,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!yg(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||yg(t,e)))return this.tileGrid;let n=Ln(e);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=Lw(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||yg(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 zw(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=Sg(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=vs(e);if(n){let r=Ln(n);r in this.tileGridForProjection||(this.tileGridForProjection[r]=t)}}};function aae(i,e){if(Us){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 Iz=XP;var $P=class extends Iz{constructor(e){e=e||{};let t=e.projection!==void 0?e.projection:"EPSG:3857",n=e.tileGrid!==void 0?e.tileGrid:sz({extent:Dw(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_}},Nz=$P;function Nc(){if(!U.map||!U.variant||U.settling)return;let i=U.engine?.getView();try{let e=Lz();e.last=U.game.slug,e.games[U.game.slug]={game:U.game.slug,map:U.map.slug,variant:U.map.variants.indexOf(U.variant),center:i?.getCenter(),zoom:i?.getZoom(),hidden:[...U.hiddenCategories],collapsed:[...U.collapsedSections],overviewDocked:U.overviewDocked,dockFolded:U.dockFolded,dockDismissed:U.dockDismissed},localStorage.setItem(rP,JSON.stringify(e))}catch{}}function Lz(){try{let i=JSON.parse(localStorage.getItem(rP)||"null");if(i&&i.games)return i}catch{}return{last:"",games:{}}}function Rg(i){let e=Lz(),t=i||e.last,n=t&&e.games[t];return n&&n.game&&n.map?n:null}function Pg(){let[i,e]=decodeURIComponent(location.hash.replace(/^#\/?/,"")).split("/").map(t=>t.trim());return{game:i,map:e}}function Dz(){if(!U.game||!U.map)return;let i=`#${U.game.slug}/${U.map.slug}`;location.hash!==i&&history.replaceState(null,"",i)}var YP=class i extends bs{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_&&(ri(this.geometryChangeKey_),this.geometryChangeKey_=null);let e=this.getGeometry();e&&(this.geometryChangeKey_=kn(e,Jt.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?lae(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 lae(i){if(typeof i=="function")return i;let e;return Array.isArray(i)?e=i:(Vn(typeof i.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[i]),function(){return e}}var Td=YP;function qa(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 Xw(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 Fz(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 Oz(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 Bz=Zs(),cae=[NaN,NaN],KP=class extends bs{constructor(){super(),this.extent_=Pr(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=Fw((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 Kn()}closestPointXY(e,t,n,r){return Kn()}containsXY(e,t){return this.closestPointXY(e,t,cae,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 Kn()}getExtent(e){if(this.extentRevision_!=this.getRevision()){let t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&G0(t),this.extentRevision_=this.getRevision()}return pG(this.extent_,e)}rotate(e,t){Kn()}scale(e,t,n){Kn()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return Kn()}getType(){return Kn()}applyTransform(e){Kn()}intersectsExtent(e){return Kn()}translate(e,t){Kn()}transform(e,t){let n=vs(e),r=n.getUnits()=="tile-pixels"?function(s,o,a){let l=n.getExtent(),c=n.getWorldExtent(),u=xr(c)/xr(l);ho(Bz,c[0],c[3],u,-u,0,0,0);let f=qa(s,0,s.length,a,Bz,o),p=X0(n,t);return p?p(f,f,a):f}:X0(n,t);return this.applyTransform(r),this}},Uz=KP;var ZP=class extends Uz{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(e){return hg(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return Kn()}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=kz(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){Kn()}setLayout(e,t,n){let r;if(e)r=kz(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=uae(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();Xw(n,0,n.length,r,e,t,n),this.changed()}}scale(e,t,n){t===void 0&&(t=e),n||(n=za(this.getExtent()));let r=this.getFlatCoordinates();if(r){let s=this.getStride();Fz(r,0,r.length,s,e,t,n,r),this.changed()}}translate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();Oz(n,0,n.length,r,e,t,n),this.changed()}}};function uae(i){let e;return i==2?e="XY":i==3?e="XYZ":i==4&&(e="XYZM"),e}function kz(i){let e;return i=="XY"?e=2:i=="XYZ"||i=="XYM"?e=3:i=="XYZM"&&(e=4),e}function Gz(i,e,t){let n=i.getFlatCoordinates();if(!n)return null;let r=i.getStride();return qa(n,0,n.length,r,e,t)}var Su=ZP;function zz(i,e,t,n){for(let r=0,s=t.length;r<s;++r)i[e++]=t[r];return e}function Ix(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 QP(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=Ix(i,e,t[o],n);r[s++]=l,e=l}return r.length=s,r}function Vz(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=QP(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 JP=class i extends Su{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=Sc(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 Aw(this.flatCoordinates,e)}getType(){return"Point"}intersectsExtent(e){return vx(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=zz(this.flatCoordinates,0,e,this.stride),this.changed()}},Lc=JP;function J0(){return uG[U.map?.iconOutset==="dark"?"dark":"light"]}function hae(i){let e=U.map?.iconOutset==="dark",t=dae(i);return(e?t>.3:t<.88)?i:fae(i,e?.74:.42)}function fae(i,e){let t=String(i).replace("#","");if(t.length!==6)return i;let[n,r,s]=[0,2,4].map(P=>parseInt(t.slice(P,P+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],R=P=>Math.round((P+v)*255).toString(16).padStart(2,"0");return`#${R(w)}${R(S)}${R(T)}`}function dae(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 $w(i){let e=Math.abs(Number(i)||0);return U0[(Math.imul(e,2654435761)>>>0)%U0.length]}function af(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 Ig(i,e){i.style.setProperty("--pin-color",eA(e))}function eA(i){return hae(i.color||$w(i.id))}function Ng(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("${eI(e.iconAsset)}")`),i.classList.add("has-source-icon")}function eI(i){let e=i.split("/").map(t=>encodeURIComponent(t)).join("/");return`${U.game.base}/icons/${e}`}function Dc(i){return i.split(/\s+/).slice(0,2).map(e=>e[0]||"").join("")}function qz(i){return Math.imul(Number(i)||0,2654435761)>>>0}function Hz(i){return String(i||"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`>#]/g,"").replace(/\r/g,"").replace(/\n{3,}/g,`3+4+`).trim()}function Fc(i){return new Intl.NumberFormat().format(i)}function Xr(i,e,t){return Math.min(t,Math.max(e,i))}function Yw(i){return i instanceof HTMLElement&&(i.matches("input, textarea, select")||i.isContentEditable)}var pae=100;function Ed(){if(!ye.searchResults)return;let i=U.pins.filter(n=>!n.filteredHidden).sort((n,r)=>n.location.title.localeCompare(r.location.title)),e=i.slice(0,pae),t=document.createDocumentFragment();if(!e.length){let n=document.createElement("p");n.className="search-empty",n.textContent=U.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",U.selectedPin===n&&r.classList.add("is-selected"),r.dataset.location=String(n.location.id),Ig(r,n.category);let s=document.createElement("span");s.className="result-dot",Ng(s,n.category,Dc(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 ${Fc(i.length)} \u2014 search or filter to narrow the list.`,t.append(n)}ye.searchResults.replaceChildren(t),mae(i.length),Aae()}var Wz=28;function Aae(){let i=U.selectedPin?.location.title||"",e=i.length>Wz?`${i.slice(0,Wz-1).trimEnd()}\u2026`:i;ye.dockRailName.textContent=e?` \xB7 ${e}`:"",ye.dockRailName.hidden=!e}function mae(i){ye.dockCount.textContent=`${Fc(i)} ${i===1?"location":"locations"}`,U.search?(ye.dockFlag.textContent=`\u201C${U.search}\u201D`,ye.dockFlag.hidden=!1):U.hiddenCategories.size>0?(ye.dockFlag.textContent="filtered",ye.dockFlag.hidden=!1):ye.dockFlag.hidden=!0}function Kw(){!U.dockFolded||U.dockDismissed||Zw(!1)}function tI(i){U.dockDismissed=i,Zw(i)}function Zw(i,e=!0){U.dockFolded=i,ye.dock.classList.toggle("is-folded",i),ye.dockFold.setAttribute("aria-expanded",String(!i));let t=i?"Bring the panel back (\u2318\u2325B)":"Put the panel away (\u2318\u2325B)";ye.dockFold.setAttribute("aria-label",t),ye.dockFold.setAttribute("title",t),e&&Nc()}function nI(i){U.hiddenCategories.delete(i.category.id),Lx(),$l(),Md(),Nx(i,!0)}function Nx(i,e=!1){U.selectedPin=i,document.dispatchEvent(new Event("atlas:selection")),Tu(),U.layers.pins.changed(),U.layers.pinLabels.changed(),U.layers.text.changed(),U.layers.textDetail.changed(),U.layers.priority.changed(),ye.detailTitle.textContent=i.location.title,ye.detailCategory.textContent=`${i.group.title} / ${i.category.title}`,ye.detailDescription.textContent="",ye.detailLinks.hidden=!0,_ae(i),ye.detailID.textContent=String(i.location.id),ye.detailCoordinates.textContent=`${i.location.lat.toFixed(6)}, ${i.location.lng.toFixed(6)}`;let t=hG(i.coordinate);ye.detailCell.textContent=t,ye.detailCellField.hidden=!t;let n=gae(i);if(ye.detailSource.textContent=n,ye.detailSourceField.hidden=!n,Ig(ye.detailDot,i.category),Ng(ye.detailDot,i.category,Dc(i.category.title)),ye.detail.hidden=!1,Kw(),Ed(),e){let r=U.engine.getView();r.animate({center:i.coordinate,zoom:Math.min(Eu(U.variant),Math.max(r.getZoom()||0,4)),duration:220})}}function gae(i){let e=U.map?.merged;if(!e?.length)return"";let t=e.find(n=>n.origin)?.source||"";if(U.pinSourceIndex?.map!==U.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)}}U.pinSourceIndex={map:U.map,byID:n}}for(let n of e)if(!n.origin&&i.group.title===n.source)return n.source;return U.pinSourceIndex.byID.get(i.location.id)||t}async function _ae(i){let e=await jz();if(U.selectedPin!==i)return;let t=e[String(i.location.id)]||{};i.location.description=t.d||"",i.location.links=t.l||[],ye.detailDescription.textContent=Hz(t.d)||"No description is included in the archive.",xae(i)}function xae(i){let e=(i.location.links||[]).filter(n=>U.pinByID.has(n.locationId));if(ye.detailLinks.hidden=e.length===0,!e.length){ye.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)}ye.detailLinks.replaceChildren(t)}function Oc(){let i=U.selectedPin!==null;U.selectedPin=null,document.dispatchEvent(new Event("atlas:selection")),U.sources&&(Tu(),U.layers.pins.changed(),U.layers.pinLabels.changed(),U.layers.text.changed(),U.layers.textDetail.changed(),U.layers.priority.changed()),ye.detail.hidden=!0,i&&Ed()}function Mu(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 Lg(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++]=Mu(i,e,l,n,r[s]),e=l}return r.length=s,r}function Dx(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?[]:Lg(i,e,l,n,r[s]),e=l[l.length-1]}return r.length=s,r}var iI=class i extends Su{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){Pc(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<gd(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=Sc(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 Mu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){let t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new Lc(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 Lc(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(vx(e,o,a))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Ix(this.flatCoordinates,0,e,this.stride),this.changed()}},Xz=iI;function rI(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 sI(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=rI(i,e,a,n),e=a}return r}function $z(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=sI(i,e,a,n),e=a[a.length-1]}return r}function Yz(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]=Fo(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 oI(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=Sc(s,o,a,l);c>r&&(r=c),s=a,o=l}return r}function aI(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=oI(i,e,a,n,r),e=a}return r}function Kz(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=aI(i,e,a,n,r),e=a[a.length-1]}return r}function lI(i,e,t,n,r,s,o,a,l,c,u){if(e==t)return c;let f,p;if(r===0){if(p=Sc(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(Yz(i,x-n,x,n,o,a,u),p=Sc(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&&(Yz(i,t-n,e,n,o,a,u),p=Sc(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 cI(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=lI(i,e,x,n,r,s,o,a,l,c,u),e=x}return c}function Zz(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=cI(i,e,x,n,r,s,o,a,l,c,u),e=x[x.length-1]}return c}function Fx(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 R=p+n;R<f;R+=n){let P=i[R],C=i[R+1],L=xG(P,C,v,w,S,T);L>x&&(u=R,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 Qz(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=Fx(i,e,u,n,r,s,o),a.push(o),e=u}return o}function Cd(i,e){return e*Math.round(i/e)}function yae(i,e,t,n,r,s,o){if(e==t)return o;let a=Cd(i[e],r),l=Cd(i[e+1],r);e+=n,s[o++]=a,s[o++]=l;let c,u;do if(c=Cd(i[e],r),u=Cd(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=Cd(i[e],r),p=Cd(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 Ox(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=yae(i,e,u,n,r,s,o),a.push(o),e=u}return o}function Jz(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l],f=[];o=Ox(i,e,u,n,r,s,o,f),a.push(f),e=u[u.length-1]}return o}var uI=class i extends Su{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<gd(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(oI(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),lI(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,n,r))}getArea(){return rI(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Mu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(e){let t=[];return t.length=Fx(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new i(t,"XY")}getType(){return"LinearRing"}intersectsExtent(e){return Nw(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Ix(this.flatCoordinates,0,e,this.stride),this.changed()}},hI=uI;function Bx(i,e,t,n,r,s,o){let a,l,c,u,f,p,x,v=r[s+1],w=[];for(let R=0,P=t.length;R<P;++R){let C=t[R];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(Va),u=w[0],a=1,l=w.length;a<l;++a){f=w[a];let R=Math.abs(f-u);R>T&&(c=(u+f)/2,Cx(i,e,t,n,c,v)&&(S=c,T=R)),u=f}return isNaN(S)&&(S=r[s]),o?(o.push(S,v,T),o):[S,v,T]}function Qw(i,e,t,n,r){let s=[];for(let o=0,a=t.length;o<a;++o){let l=t[o];s=Bx(i,e,l,n,r,2*o,s),e=l[l.length-1]}return s}function eV(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 fI(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 dI(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=fI(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 tV(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(!dI(i,e,a,n,r))return!1;a.length&&(e=a[a.length-1])}return!0}function Jw(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=fI(i,e,a,n);(s===0?r&&l||!r&&!l:r&&!l||!r&&l)&&eV(i,e,a,n),e=a}return e}function pI(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s)e=Jw(i,e,t[s],n,r);return e}function nV(i,e){let t=[],n=0,r=0,s;for(let o=0,a=e.length;o<a;++o){let l=e[o],c=fI(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 eS=class i extends Su{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?Pc(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<gd(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(aI(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),cI(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return Cx(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return sI(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),Jw(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,Lg(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let e=za(this.getExtent());this.flatInteriorPoint_=Bx(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Lc(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new hI(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 hI(t.slice(s,l),e);r.push(c),s=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;dI(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=Jw(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=Ox(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(e),t,0,n),new i(t,"XY",n)}getType(){return"Polygon"}intersectsExtent(e){return MP(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let n=QP(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},Cu=eS;function AI(i){if(vu(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 eS(s,"XY",[s.length])}function tS(i,e,t,n){let r=[],s=Pr();for(let o=0,a=t.length;o<a;++o){let l=t[o];s=hg(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 mI=class i extends Su{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;Pc(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;Pc(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<gd(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Kz(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Zz(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return QG(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return $z(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),pI(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,Dx(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let e=tS(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Qw(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new Xz(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;tV(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=pI(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=Jz(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 Cu(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 Cu(t.slice(s,c),e,l);r.push(u),s=c}return r}getType(){return"MultiPolygon"}intersectsExtent(e){return ez(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);let n=Vz(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()}},nS=mI;function iV(i){return i.key.toLocaleLowerCase()==="g"?(i.preventDefault(),rV(),U.gridEnabled?(ye.gridInput.focus(),ye.gridInput.select()):ye.viewport.focus({preventScroll:!0}),!0):i.key===" "&&U.gridEnabled&&i.target!==ye.subgridToggle?(i.preventDefault(),Ux(!U.subgridVisible),!0):i.key==="Escape"&&U.gridEnabled?(i.preventDefault(),gI(),!0):!1}function rV(i=!U.gridEnabled){U.gridEnabled=i,i&&Ux(!0),rS(),Tu(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed()}function Ux(i){U.subgridVisible=i,U.layers.grid.changed(),U.layers.gridContext.changed(),ye.subgridToggle.setAttribute("aria-pressed",String(i)),ye.subgridToggle.setAttribute("aria-label",i?"Hide the subgrid":"Show the subgrid"),sV(),document.dispatchEvent(new Event("atlas:grid"))}function sV(){if(!U.gridEnabled){ye.gridHint.textContent="G \xB7 grid off";return}ye.gridHint.textContent=`G-${U.gridCell||"root"}`+(U.subgridVisible?"":" no subgrid")}function tA(i){let e=uo(),t=e.parseInput(e.normalizeInput(i));if(t===null)return;let n=t!==U.gridCell;U.gridCell=t,U.gridEnabled||(U.gridEnabled=!0),rS(),Tu(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed(),n&&(Oc(),U.engine.getView().fit(_I(),{size:U.engine.getSize(),padding:[52,52,52,52],maxZoom:Eu(U.variant),duration:180}))}function gI(){if(U.gridEnabled){if(!U.gridCell){rV(!1);return}tA(uo().parent(U.gridCell))}}function rS(){if(U.sources){if(U.sources.grid.clear(),U.sources.gridContext.clear(),ye.gridNavigator.hidden=!U.gridEnabled,sV(),U.gridEnabled&&U.variant){let i=uo();ye.gridInput.maxLength=i.inputLength(U.map),ye.gridInput.value=U.gridCell,ye.gridBack.title=U.gridCell?`Back one ${i.slug} level`:`Close ${i.slug} grid`;for(let e of oS())wae(e)}document.dispatchEvent(new Event("atlas:grid"))}}function vae(i){return U0[uo().colorKey(i)]}function sS(i,{subgridVisible:e,labelled:t}){let{role:n,contextDistance:r}=i;if(n==="child"&&(!t||!e))return null;let s=vae(i.hash),o=n==="leaf"||n==="scope",a=n==="scope"&&e,l={color:o?Li.lineWhite:s,opacity:n==="neighbor"?Li.neighborLineAlpha:n==="child"?Li.childLineAlpha:1,widthPx:a?Li.widths.scopeBare:Li.widths[n]},c=null;n==="neighbor"?c={color:Li.dimColor,opacity:Math.min(Li.dimCap,Li.dimBase+r*Li.dimStep)}:n==="leaf"?c={color:s,opacity:Li.leafFillAlpha}:n==="child"&&(c={color:s,opacity:Li.childFillAlpha});let u=null;if(t&&!a){let{context:f,principal:p}=uo().label(i.hash);u={prefix:f,final:p,color:o?Li.lineWhite:s,textAlpha:n==="neighbor"?Li.neighborTextAlpha:1,chip:n==="neighbor"?Li.neighborChip:Li.chip,sizePx:n==="neighbor"?Li.neighborLabelSizePx:Li.labelSizePx}}return{line:l,fill:c,label:u,bare:a}}function oS(){let i=uo(),e=[],t=bae(i,U.gridCell);for(let n=0;n<t.length-1;n++){let r=t[n+1];for(let s of i.children(t[n]))s!==r&&e.push(iS(i,s,"neighbor",t.length-1-n))}if(U.gridCell&&i.level(U.gridCell)>=i.maxLevel(U.map))return e.push(iS(i,U.gridCell,"leaf",0)),e;U.gridCell&&e.push(iS(i,U.gridCell,"scope",0));for(let n of i.children(U.gridCell))e.push(iS(i,n,"child",0));return e}function bae(i,e){let t=[e],n=e;for(;n;)n=i.parent(n),t.unshift(n);return t}function iS(i,e,t,n){return{hash:e,extent:i.bbox(e),ring:i.ring(e),pole:i.poleContained(e),childIndex:i.childIndex(e),role:t,contextDistance:n}}function wae(i){let e=uo(),t=U.pins.filter(s=>!s.filteredHidden&&e.contains(i.hash,s.coordinate)).length,n=new Td({geometry:Sae(i),gridCell:{hash:i.hash,extent:i.extent,role:i.role,count:t,contextDistance:i.contextDistance},priority:i.role==="neighbor"?-i.contextDistance*100+i.childIndex:i.childIndex});(i.role==="neighbor"?U.sources.gridContext:U.sources.grid).addFeature(n)}function Sae(i){let e=cg(),t=i.ring;if(i.pole){let o=i.pole==="north"?e[3]:e[1],a=t.slice(0,-1);t=[...a,[a[a.length-1][0],o],[a[0][0],o],a[0]]}if(t.every(([o])=>o>=e[0]&&o<=e[2]))return new Cu([t]);let r=e[2]-e[0],s=[];for(let o of[0,-r,r]){let a=fG(t.map(([l,c])=>[l+o,c]),e[0],e[2]);a.length>=4&&s.push([a])}return new nS(s)}function _I(){return uo().bbox(U.gridCell)}function oV(){return uo().maxLevel(U.map)}function Rd(i){return!U.gridEnabled||!U.gridCell?!1:uo().contains(U.gridCell,i.coordinate)}function Ru(i){let e=i.attrs?.["atlas.render.as"];return e||(i.displayType==="text"?"text":"pin")}function aV(i){return i?.attrs?.["atlas.geometry.surface"]||"plane"}function lf(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 lS=[NaN,NaN,NaN,0],xI;function Tae(){return xI||(xI=Ti(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),xI}var Eae=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Mae=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Cae=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Rae=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function aS(i,e){return i.endsWith("%")?Number(i.substring(0,i.length-1))/e:Number(i)}function Gx(i){throw new Error('failed to parse "'+i+'" as color')}function lV(i){if(i.toLowerCase().startsWith("rgb")){let s=i.match(Mae)||i.match(Eae)||i.match(Cae);if(s){let o=s[4],a=100/255;return[xi(aS(s[1],a)+.5|0,0,255),xi(aS(s[2],a)+.5|0,0,255),xi(aS(s[3],a)+.5|0,0,255),o!==void 0?xi(aS(o,100),0,1):1]}Gx(i)}if(i.startsWith("#")){if(Rae.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}Gx(i)}let e=Tae();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&&Gx(i));let n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return lV(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]=q0(r[3]/255,3),r}function cV(i){return typeof i=="string"?i:Vx(i)}var Pae=1024,kx={},yI=0;function uV(i){if(i.length===4)return i;let e=i.slice();return e[3]=1,e}function vI(i){return i>.0031308?Math.pow(i,1/2.4)*269.025-14.025:i*3294.6}function bI(i){return i>.2068965?Math.pow(i,3):(i-4/29)*(108/841)}function wI(i){return i>10.314724?Math.pow((i+14.025)/269.025,2.4):i/3294.6}function SI(i){return i>.0088564?Math.pow(i,1/3):i/(108/841)+4/29}function TI(i){let e=wI(i[0]),t=wI(i[1]),n=wI(i[2]),r=SI(e*.222488403+t*.716873169+n*.06060791),s=500*(SI(e*.452247074+t*.399439023+n*.148375274)-r),o=200*(r-SI(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 hV(i){let e=(i[0]+16)/116,t=i[1],n=i[2]*Math.PI/180,r=bI(e),s=bI(e+t/500*Math.cos(n)),o=bI(e-t/200*Math.sin(n)),a=vI(s*3.021973625-r*1.617392459-o*.404875592),l=vI(s*-.943766287+r*1.916279586+o*.027607165),c=vI(s*.069407491-r*.22898585+o*1.159737864);return[xi(a+.5|0,0,255),xi(l+.5|0,0,255),xi(c+.5|0,0,255),i[3]]}function zx(i){if(i==="none")return lS;if(kx.hasOwnProperty(i))return kx[i];if(yI>=Pae){let t=0;for(let n in kx)(t++&3)===0&&(delete kx[n],--yI)}let e=lV(i);e.length!==4&&Gx(i);for(let t of e)isNaN(t)&&Gx(i);return kx[i]=e,++yI,e}function Yl(i){return Array.isArray(i)?i:zx(i)}function Vx(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 MI=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=EI(e,t);return n in this.cache_?this.cache_[n]:null}getPattern(e,t){let n=EI(e,t);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,n,r){let s=EI(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]=Px().createPattern(n.getImage(1),"repeat")}):this.patternCache_[s]=Px().createPattern(n.getImage(1),"repeat")),o||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function EI(i,e){let t=e?Yl(e):"null";return i+":"+t}var Bo=new MI;var qx=null,cS=class extends Sd{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){qx||(qx=Ti(1,1,void 0,{willReadFrequently:!0})),qx.drawImage(this.image_,0,0);try{qx.getImageData(0,0,1,1),this.tainted_=!1}catch{qx=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=Ti(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&&hz(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=Ti(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=cV(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 Pd(i,e,t,n,r,s){let o=e===void 0?void 0:Bo.get(e,r);return o||(o=new cS(i,i&&"src"in i?i.src||void 0:e,t,n,r),Bo.set(e,r,o,s)),s&&o&&!Bo.getPattern(e,r)&&Bo.set(e,r,o,s),o}var fV=cS;function Ha(i){return i?Array.isArray(i)?Vx(i):typeof i=="object"&&"src"in i?Iae(i):i:null}function Iae(i){if(!i.offset||!i.size)return Bo.getPattern(i.src,i.color);let e=i.src+":"+i.offset,t=Bo.getPattern(e,i.color);if(t)return t;let n=Bo.get(i.src,null);if(n.getImageState()!==Mn.LOADED)return null;let r=Ti(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]),Pd(r.canvas,e,void 0,Mn.LOADED,i.color,!0),Bo.getPattern(e,i.color)}var Hx="ol-hidden";var Id="ol-unselectable";var Dg="ol-control",CI="ol-collapsed",Nae=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"),dV=["style","variant","weight","size","lineHeight","family"],uS={normal:400,bold:700},hS=function(i){let e=i.match(Nae);if(!e)return null;let t={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let n=0,r=dV.length;n<r;++n){let s=e[n+1];s!==void 0&&(t[dV[n]]=typeof s=="string"?s.trim():s)}return isNaN(Number(t.weight))&&t.weight in uS&&(t.weight=uS[t.weight]),t.families=t.family.split(/,\s?/).map(n=>n.trim().replace(/^['"]|['"]$/g,"")),t};var fS="10px sans-serif",ks="#000",Pu="round",Wa=[],ja=0,Iu="round",cf=10,AV=0,Uo="#000",Nd="center",iA="middle",uf=[0,0,0,0],hf=1,nA=new bs,Wx=null,pV,RI={},Lae=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Dae(i,e,t){return`${i} ${e} 16px "${t}"`}var mV=(function(){let e,t;async function n(s){await t.ready;let o=hS(s),a=o.families[0].toLowerCase(),l=o.weight,c=[];return t.forEach(f=>{let p=f.family.replace(/^['"]|['"]$/g,"").toLowerCase(),x=uS[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=nA.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)?(wu(RI),nA.set(c,100)):(u+=10,nA.set(c,u,!0),u<100&&(s=!1)))}e=void 0,s||(e=setTimeout(r,100))}return async function(s){t||(t=Us?self.fonts:document.fonts);let o=hS(s);if(!o)return;let a=o.families,l=!1;for(let c of a){if(Lae.has(c))continue;let u=Dae(o.style,o.weight,c);nA.get(u)===void 0&&(nA.set(u,0,!0),l=!0)}l&&(clearTimeout(e),e=setTimeout(r,100))}})(),Fae=(function(){let i;return function(e){let t=RI[e];if(t==null){if(Us){let n=hS(e),r=gV(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);RI[e]=t}return t}})();function gV(i,e){return Wx||(Wx=Ti(1,1)),i!=pV&&(Wx.font=i,pV=Wx.font),Wx.measureText(e)}function _V(i,e){return gV(i,e).width}function PI(i,e,t){if(e in t)return t[e];let n=e.split(`5+`).reduce((r,s)=>Math.max(r,_V(i,s)),0);return t[e]=n,n}function xV(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=_V(p,f);t.push(x),o+=x;let v=Fae(p);n.push(v),l=Math.max(l,v)}return{width:s,height:a,widths:t,heights:n,lineWidths:r}}function yV(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]),Oae(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 Oae(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_=jr(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 Kn()}getImage(e){return Kn()}getHitDetectionImage(){return Kn()}getPixelRatio(e){return 1}getImageState(){return Kn()}getImageSize(){return Kn()}getOrigin(){return Kn()}getSize(){return Kn()}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_=jr(e)}listenImageChange(e){Kn()}load(){Kn()}unlistenImageChange(e){Kn()}ready(){return Promise.resolve()}},dS=II;var NI=class i extends dS{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=Bo.get(n,null)?.getImage(1);if(!r){let s=this.renderOptions_,o=Math.ceil(s.size*e),a=Ti(o,o);this.draw_(s,a,e),r=a.canvas;let l=new fV(r,void 0,null,Mn.LOADED,null);Bo.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),R=Math.sqrt(r*r-T*T),P=s-R,L=Math.sqrt(T*T+P*P)/T;if(L<=n){let D=L*t/2-s-r;return 2*Math.max(S,D)}return S*2}createRenderOptions(){let e=Pu,t=Iu,n=0,r=null,s=0,o,a=0;this.stroke_&&(o=Ha(this.stroke_.getColor()??Uo),a=this.stroke_.getWidth()??hf,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??Iu,e=this.stroke_.getLineCap()??Pu,n=this.stroke_.getMiterLimit()??cf);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=ks),t.fillStyle=Ha(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=Yl(n)),n===null?r=1:Array.isArray(n)&&(r=n.length===4?n[3]:1),r===0&&(t=Ti(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=ks,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()}},pS=NI;var LI=class i extends pS{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}},AS=LI;var DI=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=Pd(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?Ln(e):typeof e=="object"&&"src"in e?e.src+":"+e.offset:Yl(e).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},$r=DI;function vV(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 FI=class i extends dS{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;Vn(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||Ln(o)),Vn(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),Vn(!((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?Yl(e.color):null,this.iconImage_=Pd(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(vV(x[0],x[1],e.width,e.height))};this.listenImageChange(p);return}}c!==void 0&&this.setScale(vV(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?Yl(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_=Pd(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_=Pd(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()}},rA=FI;var OI=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}},fo=OI;var mS=class i{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=bV,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_=bV,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function wV(i){let e;if(typeof i=="function")e=i;else{let t;Array.isArray(i)?t=i:(Vn(typeof i.getZIndex=="function","Expected an `Style` or an array of `Style`"),t=[i]),e=function(){return t}}return e}var BI=null;function UI(i,e){if(!BI){let t=new $r({color:"rgba(255,255,255,0.4)"}),n=new fo({color:"#3399CC",width:1.25});BI=[new mS({image:new AS({fill:t,stroke:n,radius:5}),fill:t,stroke:n})]}return BI}function bV(i){return i.getGeometry()}var ws=mS;var Bae="#333",kI=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_=jr(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 $r({color:Bae}),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 $r?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_=jr(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}},ff=kI;function Kl(i,e){return(i.get("priority")||0)-(e.get("priority")||0)}function EV(i){let e=i.get("pin");return!e||Zl(e)||e.insideHighlightedZone||Fg(e)?null:GI(e,!1)}function MV(i){let e=i.get("pin");return!e||!U.highlightedZones.size||!e.insideHighlightedZone||Zl(e)||Fg(e)?null:GI(e,!1)}function CV(i){let e=i.get("pin");return!e||Zl(e)||!U.labelsHeld?null:LV(e)}function RV(i){let e=i.get("pin");if(!e||Zl(e)||e.insideHighlightedZone||Fg(e)||$x())return null;if(U.labelsHeld)return jx(e,!1);let t=U.fitZoom+Math.log2(zV(e.category));return(U.engine.getView().getZoom()||0)<t?null:jx(e,!1)}function PV(i){let e=i.get("pin");return!e||Zl(e)||e.insideHighlightedZone||Fg(e)||!$x()?null:jx(e,!1)}function IV(i){let e=i.get("pin");return!e||!U.highlightedZones.size||!e.insideHighlightedZone||Zl(e)||Fg(e)?null:jx(e,!1)}function NV(i){let e=i.get("pin");if(!e||Zl(e))return null;if(Ru(e.category)==="text")return jx(e,e===U.selectedPin);let t=GI(e,e===U.selectedPin);return e===U.hoveredPin||e===U.selectedPin?[t,LV(e)]:t}function GI(i,e){let t=`marker:${i.category.id}:${e?1:0}`;if(U.styleCache.has(t))return U.styleCache.get(t);let n=eA(i.category),r=e?2e7:i.priority,s=U.markerIcons.get(Xx(i.category)),o;return s?o=new ws({image:new rA({src:s,width:e?36:31,height:e?36:31}),zIndex:r}):o=new ws({text:new ff({text:Dc(i.category.title),font:`900 ${e?15:13}px Inter, sans-serif`,fill:new $r({color:n}),stroke:new fo({color:J0(),width:e?4:3})}),zIndex:r}),U.styleCache.set(t,o),o}function LV(i){let e=`marker-label:${i.location.id}`;if(U.styleCache.has(e))return U.styleCache.get(e);let t=new ws({text:new ff({text:i.location.title,offsetY:21,font:'700 10px "Arial Narrow", "Roboto Condensed", sans-serif',fill:new $r({color:"#f2ece0"}),stroke:new fo({color:"rgba(0,0,0,0.98)",width:3}),backgroundFill:new $r({color:"rgba(10,12,17,0.72)"}),padding:[2,4,2,4],overflow:!0}),zIndex:i.priority});return U.styleCache.set(e,t),t}function DV(i){if(!i.iconAsset)return;let e=Xx(i);if(U.markerIcons.has(e))return;U.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=eA(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=J0(),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),U.markerIcons.set(e,n.toDataURL("image/png")),Uae(),U.layers.pins.changed(),U.layers.zonePins.changed(),U.layers.priority.changed()},t.onerror=()=>U.markerIcons.set(e,!1),t.src=eI(i.iconAsset)}function Uae(){for(let i of U.styleCache.keys())i.startsWith("marker:")&&U.styleCache.delete(i)}function Xx(i){return`${i.iconAsset||""}:${eA(i)}:${U.map?.iconOutset||"light"}`}function jx(i,e){let t=`text:${i.location.id}:${e?1:0}`;if(U.styleCache.has(t))return U.styleCache.get(t);let r=[new ws({text:new ff({text:i.location.title,font:`${e?"900":"800"} 14px "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new $r({color:e?"#7fd0ea":"#f2ece0"}),stroke:new fo({color:"rgba(0,0,0,0.95)",width:4}),backgroundFill:new $r({color:e?"rgba(13,16,23,0.9)":"rgba(10,12,17,0.58)"}),backgroundStroke:e?new fo({color:"#3aa5c9",width:1}):void 0,padding:[3,6,3,6],overflow:!0}),zIndex:e?2e7:i.priority+3e6})];return U.styleCache.set(t,r),r}function gS(i,e){return`${i} ${e}px ${Li.labelFont}`}function zI(i,e){let t=i.get("gridCell");if(!t)return null;let n=t.role==="neighbor",r=n?Li.neighborLabelSizePx:Li.labelSizePx,s=gS(900,r),o=n?[2,4,2,4]:[3,5,3,5],a=kae(t,s,r,o,e),l=sS(t,{subgridVisible:U.subgridVisible,labelled:a});if(!l)return null;let c=`grid:${t.hash}:${t.role}:${t.contextDistance}:${a?1:0}:${l.bare?1:0}`;if(U.styleCache.has(c))return U.styleCache.get(c);let u=t.role==="leaf"||t.role==="scope"?100:i.get("priority"),f=[new ws({fill:l.fill?new $r({color:af(l.fill.color,l.fill.opacity)}):void 0,stroke:new fo({color:af(l.line.color,l.line.opacity),width:l.line.widthPx}),zIndex:u})];if(l.label){let p=l.label.prefix?[l.label.prefix,gS(500,r),l.label.final,gS(900,r)]:l.label.final,x=Li.labelInsetPx*e;f.push(new ws({geometry:new Lc([t.extent[2]-x,t.extent[1]+x]),text:new ff({text:p,font:gS(900,r),textAlign:"right",textBaseline:"bottom",fill:new $r({color:af(l.label.color,l.label.textAlpha)}),backgroundFill:new $r({color:l.label.chip}),padding:o,overflow:!0}),zIndex:u+1}))}return U.styleCache.set(c,f),f}function kae(i,e,t,n,r){if(!r)return!0;let s=VI(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 SV=document.createElement("canvas").getContext("2d"),TV=new Map;function VI(i,e){let t=`${e}|${i}`,n=TV.get(t);return n===void 0&&(SV.font=e,n=SV.measureText(i).width,TV.set(t,n)),n}var Gae=new ws({fill:new $r({color:"rgba(5, 8, 16, 0.62)"})});function FV(){return U.zonesVisible?Gae:null}function OV(i){if(!U.zonesVisible)return null;let e=i.get("zone"),t=i.get("child"),n=U.highlightedZones.has(e.id),r=GV(e.id),s=`zone:${e.id}:${t?1:0}:${n?1:r?2:0}`;if(U.styleCache.has(s))return U.styleCache.get(s);let o=i.get("color");if(r){let c=new ws({stroke:new fo({color:af(o,t?.34:.44),width:t?1:1.3,lineDash:t?[3,4]:[7,5]}),zIndex:t?101:100});return U.styleCache.set(s,c),c}let a=new ws({fill:new $r({color:af(o,t?.035:.07)}),stroke:new fo({color:af(o,t?.5:.72),width:t?1.2:1.8,lineDash:t?[3,4]:[7,5]})});if(!n)return U.styleCache.set(s,a),a;let l=[new ws({stroke:new fo({color:"rgba(255,255,255,0.94)",width:5}),zIndex:9e3}),new ws({fill:new $r({color:af(o,.22)}),stroke:new fo({color:o,width:2.6}),zIndex:9001})];return U.styleCache.set(s,l),l}function BV(i){if(!U.zonesVisible||$x())return null;let e=i.get("child"),t=U.highlightedZones.has(i.get("zone").id),n=U.engine.getView().getZoom()||0;if(!t&&e&&n<U.fitZoom+3)return null;let r=i.get("span")/U.engine.getView().getResolution();return!t&&U.zoneTitleCount>40&&r<52?null:kV(i)}function UV(i){return!U.zonesVisible||!$x()?null:kV(i)}function kV(i){let e=i.get("child"),t=i.get("zone"),n=U.highlightedZones.has(t.id),r=GV(t.id),s=`zone-title:${t.id}:${e?1:0}:${n?1:r?2:0}`;if(U.styleCache.has(s))return U.styleCache.get(s);let o=i.get("color"),a=new ws({text:new ff({text:t.title.toLocaleUpperCase(),font:`${e?"700 12px":"800 14px"} "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new $r({color:n?"#10131a":r?"rgba(196,191,177,0.56)":e?"#c8c2b4":"#f2ece0"}),stroke:new fo({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 $r({color:n?o:r?"rgba(8,11,18,0.84)":"rgba(13,16,23,0.72)"}),backgroundStroke:new fo({color:n?"#ffffff":af(o,r?.24:.55),width:n?2:1}),padding:[5,8,5,8],overflow:!0}),zIndex:n?91e5:i.get("priority")});return U.styleCache.set(s,a),a}function GV(i){if(!U.highlightedZones.size||U.highlightedZones.has(i))return!1;for(let e of U.highlightedZones)if(zae(i,e))return!1;return!0}function zae(i,e){let t=new Set,n=U.zoneRecords.get(e)?.zone.parentRegionId;for(;n!=null&&!t.has(n);){if(n===i)return!0;t.add(n),n=U.zoneRecords.get(n)?.zone.parentRegionId}return!1}function qI(){let i=(U.map.zones||[]).filter(jI);U.renderedShard=U.variant?.shard||0,U.sources.zones.clear(),U.sources.zoneTitles.clear(),U.zoneRecords.clear(),U.highlightedZones.clear(),U.focusedZoneID=null,U.zoneTitleCount=0,_S(!0),ye.zoneIndex.hidden=i.length===0,ye.zoneCount.textContent=Fc(i.length);for(let e of i){let t=Pr(),n=[],r=!1;for(let l of e.features||[]){let c=Hae(l);c&&(r=!0,n.push(c),mw(t,c.getExtent()),U.sources.zones.addFeature(new Td({geometry:c,zone:e,color:$w(e.id),child:e.parentRegionId!=null})))}if(!r)continue;let s=$w(e.id),o=e.center?Og(e.center.lat,e.center.lng):za(t),a=Math.max(t[2]-t[0],t[3]-t[1]);U.sources.zoneTitles.addFeature(new Td({geometry:new Lc(o),zone:e,color:s,child:e.parentRegionId!=null,span:a,priority:(e.parentRegionId==null?2e6:1e6)+Math.round(a)})),U.zoneRecords.set(e.id,{zone:e,extent:t.slice(),geometries:n,color:s})}U.zoneTitleCount=U.sources.zoneTitles.getFeatures().length,qV(),Vae()}function qV(){if(U.sources.zoneScrim.clear(),!U.highlightedZones.size)return;let[i,e,t,n]=U.projection.getExtent(),r=[VV([[i,e],[t,e],[t,n],[i,n],[i,e]],!0)];for(let s of U.highlightedZones)for(let o of U.zoneRecords.get(s)?.geometries||[]){let a=o.getType()==="MultiPolygon"?o.getPolygons():[o];for(let l of a)l.getLinearRings().forEach((c,u)=>{r.push(VV(c.getCoordinates(),u>0))})}U.sources.zoneScrim.addFeature(new Td({geometry:new Cu(r)}))}function VV(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 Vae(){let i=document.createDocumentFragment();for(let{zone:e,depth:t}of qae()){let n=U.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)}ye.zoneList.replaceChildren(i),ye.zoneIndex.hidden=U.zoneRecords.size===0}function qae(){let i=[...U.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 _S(i){U.zonesVisible=i,ye.zoneToggle.checked=i,U.layers.zoneScrim.setVisible(i),U.layers.zones.setVisible(i),U.layers.zoneTitles.setVisible(i),U.layers.zoneTitleDetail.setVisible(i)}function HV(i){let e=U.zoneRecords.get(i);e&&(U.focusedZoneID=i,jV(),Oc(),U.engine.getView().fit(e.extent,{size:U.engine.getSize(),padding:[54,54,54,54],maxZoom:Eu(U.variant),duration:220}),ye.sidebar.classList.remove("is-open"),ye.mobileLegend.setAttribute("aria-expanded","false"))}function WV(i){U.zoneRecords.has(i)&&(U.highlightedZones.has(i)?U.highlightedZones.delete(i):(U.highlightedZones.add(i),_S(!0)),U.hoveredPin=null,HI(),WI(),jV(),qV(),U.layers.zones.changed(),U.layers.zoneTitles.changed(),U.layers.zoneTitleDetail.changed())}function jV(){ye.zoneIndex.classList.toggle("has-highlights",U.highlightedZones.size>0);for(let i of ye.zoneList.querySelectorAll("[data-zone]")){let e=Number(i.dataset.zone),t=U.highlightedZones.has(e);i.classList.toggle("is-highlighted",t),i.classList.toggle("is-current",U.focusedZoneID===e),i.setAttribute("aria-pressed",String(t))}}function Hae(i){if(!i?.coordinates)return null;let e=([t,n])=>Og(n,t);return i.type==="Polygon"?new Cu(i.coordinates.map(t=>t.map(e))):i.type==="MultiPolygon"?new nS(i.coordinates.map(t=>t.map(n=>n.map(e)))):null}function Og(i,e){let t=Wae(),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 Wae(){let i=U.game.tileGrid,e=U.map?.grid;return e?{...i,...e}:i}function XV(){U.sources.pins.clear(),U.sources.text.clear(),U.sources.priority.clear(),U.pins=[],U.pinByID.clear();for(let i of U.map.groups)for(let e of i.categories){Ru(e)!=="text"&&DV(e);for(let t of e.locations){let n={location:t,category:e,group:i,coordinate:Og(t.lat,t.lng),filteredHidden:!1,priority:Yae(e,t),feature:null};n.feature=new Td({geometry:new Lc(n.coordinate),pin:n,priority:n.priority}),U.pins.push(n),U.pinByID.set(t.id,n),Ru(e)==="text"?U.sources.text.addFeature(n.feature):U.sources.pins.addFeature(n.feature)}}$l()}function $l(){for(let i of U.pins){let e=U.hiddenCategories.has(i.category.id),t=U.search&&!i.location.title.toLocaleLowerCase().includes(U.search);i.filteredHidden=!!(e||t)}HI(),WI(),U.selectedPin?.filteredHidden&&Oc(),Ed(),document.dispatchEvent(new Event("atlas:filters"))}function HI(){if(!U.highlightedZones.size){for(let e of U.pins)e.insideHighlightedZone=!1;return}let i=[...U.highlightedZones].map(e=>U.zoneRecords.get(e)).filter(Boolean);for(let e of U.pins)e.insideHighlightedZone=i.some(t=>t.geometries.some(n=>jae(n,e.coordinate)))}function jae(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 WI(){U.eligibleLocations=U.pins.filter(i=>!Zl(i)).length,Tu(),U.layers.pins.changed(),U.layers.zonePins.changed(),U.layers.pinLabels.changed(),U.layers.text.changed(),U.layers.zoneText.changed(),U.layers.textDetail.changed(),U.layers.priority.changed(),sA()}function Tu(){U.sources.priority.clear();for(let i of U.pins){if(Zl(i))continue;let e=!!U.search&&i.location.title.toLocaleLowerCase().includes(U.search);(i===U.selectedPin||i===U.hoveredPin||e||Rd(i))&&U.sources.priority.addFeature(i.feature)}}function Bg(i){U.hoveredPin!==i&&(U.hoveredPin=i,U.sources&&(Tu(),U.layers.pins.changed(),U.layers.priority.changed()))}function xS(i){U.labelsHeld!==i&&(U.labelsHeld=i,ye.labelsHint.textContent=i?"Z \xB7 labels shown":"Z \xB7 hold for labels",U.layers.pinLabels.changed(),U.layers.text.changed(),document.dispatchEvent(new Event("atlas:labels")))}function Fg(i){return i===U.selectedPin||i===U.hoveredPin||Rd(i)||!!U.search&&i.location.title.toLocaleLowerCase().includes(U.search)}function Zl(i){return i.filteredHidden||Xae(i)||$ae(i)||!jI(i.location)}function jI(i){let e=U.variant?.shard;return!e||!i.shard||i.shard===e}function Xae(i){return!U.highlightedZones.size||i.insideHighlightedZone||i===U.selectedPin?!1:!(U.search&&i.location.title.toLocaleLowerCase().includes(U.search))}function $ae(i){return!U.gridEnabled||!U.gridCell||Rd(i)||i===U.selectedPin?!1:!(U.search&&i.location.title.toLocaleLowerCase().includes(U.search))}function Yae(i,e){return Math.max(0,1e6-Math.min(i.locations.length,999)*1e3)+qz(e.id)%1e3}function zV(i){return i.locations.length>200?4:i.locations.length>75?2.5:1}function $x(){return(U.engine?.getView().getZoom()||0)>=(U.variant?.maxZoom||0)-.05}function $V(i){let e=[],t=[];for(let n of i){let r=[];for(let s of n.categories)(Ru(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 U.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(Kae(e.key,e.title,n));let r=document.createElement("div");r.className="category-toggles";for(let s of e.categories)r.append(Zae(s));t.append(r),i.append(t)}ye.legend.replaceChildren(i),yS(),Md()}function Kae(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=Fc(t),r.append(s,o,a);let l=KV(`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 KV(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 Zae(i){let e=Ru(i)==="text",t=document.createElement("label");t.className="category-row",Ig(t,i);let n=document.createElement("input");n.type="checkbox",n.dataset.category=String(i.id),n.checked=!U.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",Ng(r,i,Dc(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=Fc(i.locations.length);let a=KV(`Show only ${i.title}`);return a.dataset.onlyCategory=String(i.id),t.append(n,r,s,a,o),t}function XI(i){if(U.collapsedSections.clear(),i)for(let e of ye.layers.querySelectorAll("[data-section]"))U.collapsedSections.add(e.dataset.section);yS()}function yS(){for(let i of ye.layers.querySelectorAll("[data-section]")){let e=U.collapsedSections.has(i.dataset.section);i.setAttribute("aria-expanded",String(!e)),i.closest(".layer-section").classList.toggle("is-collapsed",e)}Nc()}function Yx(i){if(U.hiddenCategories.clear(),!i)for(let e of U.map.groups)for(let t of e.categories)U.hiddenCategories.add(t.id);Lx(),$l(),Ed(),Md()}function Lx(){for(let i of document.querySelectorAll("[data-category]"))i.checked=!U.hiddenCategories.has(Number(i.dataset.category))}function ZV(i){let e=U.map.sections.find(n=>n.key===i);if(!e)return;let t=e.categories.some(n=>!U.hiddenCategories.has(n.id));for(let n of e.categories)t?U.hiddenCategories.add(n.id):U.hiddenCategories.delete(n.id);Lx(),$l(),Md()}function QV(i){if(U.map){if(Qae(i)){Yx(!0);return}U.hiddenCategories.clear();for(let e of U.map.sections){let t=i.section===e.key;for(let n of e.categories)!t&&i.category!==n.id&&U.hiddenCategories.add(n.id)}Lx(),$l(),Ed(),Md()}}function Qae(i){for(let e of U.map.sections)for(let t of e.categories)if((i.section===e.key||i.category===t.id)===U.hiddenCategories.has(t.id))return!1;return!0}function Jae(){let i=ye.soloChip;if(!U.map){i.hidden=!0;return}let e=null,t=0,n=null,r=0;for(let o of U.map.sections){let a=0;for(let l of o.categories)U.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 Md(){if(U.map){for(let i of U.map.sections){let e=ye.legend.querySelector(`input[data-section-toggle="${i.key}"]`);e&&(e.checked=i.categories.some(t=>!U.hiddenCategories.has(t.id)))}Jae(),Nc()}}async function JV(i){let[e,t]=await Promise.all([fetch(`${U.game.base}/maps/${i.slug}.json`),fetch(`${U.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 ele(r,s),{...i,grid:n.grid,variants:n.variants,groups:n.groups,zones:n.zones||[],attrs:n.attrs||{},merged:n.merged||[],sections:$V(n.groups)}}function ele(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 jz(){let i=`${U.game.base}/${U.map.slug}`;return U.textByMap.has(i)||U.textByMap.set(i,fetch(`${U.game.base}/maps/${U.map.slug}.text`).then(e=>e.json()).catch(()=>({}))),U.textByMap.get(i)}var vS=null;function oA(){return vS||(vS=tle().finally(()=>{vS=null})),vS}async function tle(){let i=await fetch("/data/catalog.json");if(!i.ok)return;let e=U.game;if(U.catalog=await i.json(),B0(ye.game,U.catalog.games,"title"),$I(),!U.catalog.games.length)return;let t=e&&U.catalog.games.find(n=>n.slug===e.slug);if(!t){let n=Pg();await df(n.game||Rg()?.game||U.catalog.games[0].slug,n.game?n.map:void 0);return}if(t.stamp!==e.stamp){for(let r of U.textByMap.keys())r.startsWith(e.base+"/")&&U.textByMap.delete(r);let n=U.engine?.getView();U.restore={game:t.slug,map:U.map?.slug,variant:U.map?U.map.variants.indexOf(U.variant):0,center:n?.getCenter(),zoom:n?.getZoom(),hidden:[...U.hiddenCategories],collapsed:[...U.collapsedSections],overviewDocked:U.overviewDocked,dockFolded:U.dockFolded,dockDismissed:U.dockDismissed},await df(t.slug,U.map?.slug);return}U.game=t,ye.game.value=t.slug}function $I(){let i=!U.catalog?.games?.length;ye.emptyState.hidden=!i,U.catalog?.bundlesDir&&(ye.emptyPath.textContent=U.catalog.bundlesDir)}async function YI(){for(let i of[ye.emptyOpen,ye.addBundles])i.disabled=!0;try{let e=await(await fetch("/data/bundles/import",{method:"POST"})).json().catch(()=>({}));await oA();let t=e.imported?.[0];t&&U.catalog.games.some(n=>n.slug===t)&&await df(t)}finally{for(let i of[ye.emptyOpen,ye.addBundles])i.disabled=!1}}var Qs={ADD:"add",REMOVE:"remove"};var eq={LENGTH:"length"},Ug=class extends Ks{constructor(e,t,n){super(e),this.element=t,this.index=n}},KI=class extends bs{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(eq.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 Ug(Qs.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 Ug(Qs.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 Ug(Qs.REMOVE,r,e)),this.dispatchEvent(new Ug(Qs.ADD,t,e))}updateLength_(){this.set(eq.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")}},po=KI;var ZI=class extends Ks{constructor(e,t,n){super(e),this.map=t,this.frameState=n!==void 0?n:null}},Ld=ZI;var QI=class extends Ld{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()}},Nu=QI;var rr={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 JI=class extends Sd{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_=kn(n,Kx.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=kn(n,Kx.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(Jt.TOUCHMOVE,this.boundHandleTouchMove_,Ow?{passive:!1}:!1)}emulateClick_(e){let t=new Nu(rr.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new Nu(rr.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let n=new Nu(rr.SINGLECLICK,this.map_,e);this.dispatchEvent(n)},250)}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==rr.POINTERUP||t.type==rr.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==rr.POINTERDOWN||t.type==rr.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new Nu(rr.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(ri),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 Nu(rr.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(kn(n,rr.POINTERMOVE,this.handlePointerMove_,this),kn(n,rr.POINTERUP,this.handlePointerUp_,this),kn(this.element_,rr.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push(kn(this.element_.getRootNode(),rr.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new Nu(rr.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 Nu(rr.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_&&(ri(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(Jt.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(ri(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(ri),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},tq=JI;var Lu={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var Ao={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};var Zx=1/0,e5=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,wu(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){Vn(!(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!=Zx?(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==Zx?delete this.queuedElements_[this.keyFunction_(o)]:(n[r]=l,t[r++]=o);t.length=r,n.length=r,this.heapify_()}},nq=e5;var t5=class extends nq{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())}}},iq=t5;function rq(i,e,t,n,r){if(!i||!(t in i.wantedTiles))return Zx;if(!i.wantedTiles[t][e.getKey()])return Zx;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 Gs={ANIMATING:0,INTERACTING:1};var Ql={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function n5(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=xi(n[0],p,x),T=xi(n[1],v,w);if(o&&t&&r){let R=30*r;S+=-R*Math.log(1+Math.max(0,p-n[0])/R)+R*Math.log(1+Math.max(0,n[0]-x)/R),T+=-R*Math.log(1+Math.max(0,v-n[1])/R)+R*Math.log(1+Math.max(0,n[1]-w)/R)}return[S,T]})}function sq(i){return i}function i5(i,e,t,n){let r=jn(e)/t[0],s=xr(e)/t[1];return n?Math.min(i,Math.max(r,s)):Math.min(i,Math.min(r,s))}function r5(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),xi(n,t/2,e*2)}function oq(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?i5(l,t,o,n):l;if(a)return e?r5(r,u,c):xi(r,c,u);let f=Math.min(u,r),p=Math.floor(bg(i,f,s));return i[p]>u&&p<i.length-1?i[p+1]:i[p]}})}function aq(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?i5(e,r,l,s):e;if(c)return n?r5(o,u,t):xi(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 xi(T,t,u)}})}function s5(i,e,t,n,r){return t=t!==void 0?t:!0,(function(s,o,a,l){if(s!==void 0){let c=n?i5(i,n,a,r):i;return!t||!l?xi(s,e,c):r5(s,c,e)}})}function kg(i){if(i!==void 0)return 0}function o5(i){if(i!==void 0)return i}function lq(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 cq(i){let e=i===void 0?Tc(5):i;return(function(t,n){return n||t===void 0?t:Math.abs(t)<=e?0:t})}var a5=0,c5=class extends bs{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=Rw(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&&VG(),e.center&&(e.center=Cc(e.center,this.projection_)),e.extent&&(e.extent=Rc(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let a in Ql)delete t[a];this.setProperties(t,!0);let n=ile(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=nle(e),s=n.constraint,o=rle(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=Cc(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=Cc(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&&bS(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||fz,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=bu(u.rotation-l+Math.PI,2*Math.PI)-Math.PI;f.targetRotation=l+p,l=f.targetRotation}sle(f)?f.complete=!0:s+=f.duration,c.push(f)}this.animations_.push(c),this.setHint(Gs.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[Gs.ANIMATING]>0}getInteracting(){return this.hints_[Gs.INTERACTING]>0}cancelAnimations(){this.setHint(Gs.ANIMATING,-this.hints_[Gs.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){let r=this.animations_[t];if(r[0].callback&&bS(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?bu(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(Gs.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let o=r[0].callback;o&&bS(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]],Ag(n,e-this.getRotation()),vG(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&&Mx(e,this.getProjection())}getCenterInternal(){return this.get(Ql.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 yd(t,this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();Vn(t,"The view center is not defined");let n=this.getResolution();Vn(n!==void 0,"The view resolution is not defined");let r=this.getRotation();return Vn(r!==void 0,"The view rotation is not defined"),wx(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(Ql.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(Rc(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();let n=jn(e)/t[0],r=xr(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(Ql.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=l5(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=bg(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=xi(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/Math.pow(n,xi(e-t,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let n;if(Vn(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(e)){Vn(!vu(e),"Cannot fit empty extent provided as `geometry`");let r=Rc(e,this.getProjection());n=AI(r)}else if(e.getType()==="Circle"){let r=Rc(e.getExtent(),this.getProjection());n=AI(r),n.rotate(this.getRotation(),za(r))}else{let r=$0();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=za(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:of;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),bS(S,!0))}centerOn(e,t,n){this.centerOnInternal(Cc(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(l5(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=l5(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=Mx(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&&Cc(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=Cc(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&&Cc(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(Ql.ROTATION)!==r&&this.set(Ql.ROTATION,r),this.get(Ql.RESOLUTION)!==o&&(this.set(Ql.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Ql.CENTER)||!H0(this.get(Ql.CENTER),a))&&this.set(Ql.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()||!H0(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:e,easing:Xl,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Gs.INTERACTING,1)}endInteraction(e,t,n){n=n&&Cc(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(Gs.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 bS(i,e){setTimeout(function(){i(e)},0)}function nle(i){if(i.extent!==void 0){let t=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return n5(i.extent,i.constrainOnlyCenter,t)}let e=Rw(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&e.isGlobal()){let t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,n5(t,!1,!1)}return sq}function ile(i){let e,t,n,o=i.minZoom!==void 0?i.minZoom:a5,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=Rw(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=oq(S,u,!v&&w,f):e=s5(t,n,u,!v&&w,f)}else{let T=(x?Math.max(jn(x),xr(x)):360*tf.degrees/p.getMetersPerUnit())/256/Math.pow(2,a5),R=T/Math.pow(2,28-a5);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=R),a=o+Math.floor(Math.log(t/n)/Math.log(l)),n=t/Math.pow(l,a-o),i.constrainResolution?e=aq(l,t,n,u,!v&&w,f):e=s5(t,n,u,!v&&w,f)}return{constraint:e,maxResolution:t,minResolution:n,minZoom:o,zoomFactor:l}}function rle(i){if(i.enableRotation!==void 0?i.enableRotation:!0){let t=i.constrainRotation;return t===void 0||t===!0?cq():t===!1?o5:typeof t=="number"?lq(t):o5}return kg}function sle(i){return!(i.sourceCenter&&i.targetCenter&&!H0(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function l5(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 Al=c5;var u5=class extends bs{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)ri(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!==of&&this.listenerKeys.push(kn(e,Lu.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}},Gg=u5;var h5=class extends Gg{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+" "+Id+" "+Dg+(this.collapsed_&&this.collapsible_?" "+CI:"")+(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=>az(()=>r))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!Oo(t,this.renderedAttributions_)){pz(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(CI),this.collapsed_?BP(this.collapseLabel_,this.label_):BP(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)}},uq=h5;var f5=class extends Gg{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+" "+Id+" "+Dg,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(Hx)}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:Xl}):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(Hx);!s&&n===0?this.element.classList.add(Hx):s&&n!==0&&this.element.classList.remove(Hx)}this.label_.style.transform=r}this.rotation_=n}},hq=f5;var d5=class extends Gg{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+" "+Id+" "+Dg,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:Xl})):n.setZoom(s)}}},fq=d5;function wS(i){i=i||{};let e=new po;return(i.zoom===void 0||i.zoom)&&e.push(new fq(i.zoomOptions)),(i.rotate===void 0||i.rotate)&&e.push(new hq(i.rotateOptions)),(i.attribution===void 0||i.attribution)&&e.push(new uq(i.attributionOptions)),e}var p5=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_}},dq=p5;var A5={ACTIVE:"active"};var m5=class extends bs{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(A5.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(A5.ACTIVE,e)}setMap(e){this.map_=e}};function pq(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:dz,center:i.getConstrainedCenter(r)})}}function zg(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:Xl})}var Du=m5;var g5=class extends Du{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==rr.DBLCLICK){let n=e.originalEvent,r=e.map,s=e.coordinate,o=n.shiftKey?-this.delta_:this.delta_,a=r.getView();zg(a,o,s,this.duration_),n.preventDefault(),t=!0}return!t}},Aq=g5;function Qx(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 mq=function(i){let e=i.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},ole=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")?ole(i):!0},gq=rf;var TS=function(i){let e=i.originalEvent;return"pointerId"in e&&e.button==0&&!(lz&&NP&&e.ctrlKey)};var ES=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey};var _q=function(i){let e=i.originalEvent;return NP?e.metaKey:e.ctrlKey},xq=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},MS=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 yq=function(i){let e=i.originalEvent;return"pointerId"in e&&e.isPrimary&&e.button===0};var _5=class extends Du{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==rr.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==rr.POINTERUP){let n=this.handleUpEvent(e);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(e.type==rr.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==rr.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 Vg(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 Fu=_5;var x5=class extends Fu{constructor(e){super({stopDown:sf}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let t=e.condition?e.condition:Qx(ES,yq);this.condition_=e.onFocusOnly?Qx(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(Vg(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();bG(s,a.getResolution()),Ag(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:Xl})}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}},vq=x5;var y5=class extends Fu{constructor(e){e=e||{},super({stopDown:sf}),this.condition_=e.condition?e.condition:mq,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===kg)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)&&TS(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},bq=y5;var v5=class extends wd{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 Cu([r])}getGeometry(){return this.geometry_}},wq=v5;var qg={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"},aA=class extends Ks{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},b5=class extends Fu{constructor(e){super(),this.on,this.once,this.un,e=e??{},this.box_=new wq(e.className||"ol-dragbox"),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??TS,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 aA(qg.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 aA(t?qg.BOXEND:qg.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 aA(qg.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new aA(qg.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new aA(qg.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(e)}},Sq=b5;var w5=class extends Sq{constructor(e){e=e||{};let t=e.condition?e.condition:xq;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:Xl})}},Tq=w5;var Dd={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};var S5=class extends Du{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return ES(t)&&MS(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==Dd.DOWN||r==Dd.LEFT||r==Dd.RIGHT||r==Dd.UP)){let o=e.map.getView(),a=o.getResolution()*this.pixelDelta_,l=0,c=0;r==Dd.DOWN?c=-a:r==Dd.LEFT?l=-a:r==Dd.RIGHT?l=a:c=a;let u=[l,c];Ag(u,o.getRotation()),pq(o,u,this.duration_),n.preventDefault(),t=!0}}return!t}},Eq=S5;var T5=class extends Du{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:function(t){return!_q(t)&&MS(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();zg(a,o,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},Mq=T5;var ale=40,lle=300,cle=3,E5=class extends Du{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:gq;this.condition_=e.onFocusOnly?Qx(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(ri),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(e),e){let t=e.getOwnerDocument();this.ctrlKeyListenerKeys_.push(kn(t,"keydown",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!0)}),kn(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*=ale;break;case WheelEvent.DOM_DELTA_PAGE:o*=lle;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*cle),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=-xi(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),zg(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)}},Cq=E5;var M5=class extends Fu{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=sf),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!==kg&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(Vg(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}},Rq=M5;var C5=class extends Fu{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=sf),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(Vg(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}},Pq=C5;function RS(i){i=i||{};let e=new po,t=new dq(-.005,.05,100);return(i.altShiftDragRotate===void 0||i.altShiftDragRotate)&&e.push(new bq),(i.doubleClickZoom===void 0||i.doubleClickZoom)&&e.push(new Aq({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan===void 0||i.dragPan)&&e.push(new vq({onFocusOnly:i.onFocusOnly,kinetic:t})),(i.pinchRotate===void 0||i.pinchRotate)&&e.push(new Rq),(i.pinchZoom===void 0||i.pinchZoom)&&e.push(new Pq({duration:i.zoomDuration})),(i.keyboard===void 0||i.keyboard)&&(e.push(new Eq),e.push(new Mq({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom===void 0||i.mouseWheelZoom)&&e.push(new Cq({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom===void 0||i.shiftDragZoom)&&e.push(new Tq({duration:i.zoomDuration})),e}var Ei={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 R5=class extends bs{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[Ei.OPACITY]=e.opacity!==void 0?e.opacity:1,Vn(typeof t[Ei.OPACITY]=="number","Layer opacity must be a number"),t[Ei.VISIBLE]=e.visible!==void 0?e.visible:!0,t[Ei.Z_INDEX]=e.zIndex,t[Ei.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[Ei.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[Ei.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[Ei.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=xi(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 Kn()}getLayerStatesArray(e){return Kn()}getExtent(){return this.get(Ei.EXTENT)}getMaxResolution(){return this.get(Ei.MAX_RESOLUTION)}getMinResolution(){return this.get(Ei.MIN_RESOLUTION)}getMinZoom(){return this.get(Ei.MIN_ZOOM)}getMaxZoom(){return this.get(Ei.MAX_ZOOM)}getOpacity(){return this.get(Ei.OPACITY)}getSourceState(){return Kn()}getVisible(){return this.get(Ei.VISIBLE)}getZIndex(){return this.get(Ei.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(Ei.EXTENT,e)}setMaxResolution(e){this.set(Ei.MAX_RESOLUTION,e)}setMinResolution(e){this.set(Ei.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(Ei.MAX_ZOOM,e)}setMinZoom(e){this.set(Ei.MIN_ZOOM,e)}setOpacity(e){Vn(typeof e=="number","Layer opacity must be a number"),this.set(Ei.OPACITY,e)}setVisible(e){this.set(Ei.VISIBLE,e)}setZIndex(e){this.set(Ei.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},PS=R5;var Fd={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"},Bc=class extends Ks{constructor(e,t){super(e),this.layer=t}},P5={LAYERS:"layers"},I5=class i extends PS{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(P5.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new po(n.slice(),{unique:!0}):Vn(typeof n.getArray=="function","Expected `layers` to be an array or a `Collection`"):n=new po(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(ri),this.layersListenerKeys_.length=0;let e=this.getLayers();this.layersListenerKeys_.push(kn(e,Qs.ADD,this.handleLayersAdd_,this),kn(e,Qs.REMOVE,this.handleLayersRemove_,this));for(let n in this.listenerKeys_)this.listenerKeys_[n].forEach(ri);wu(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 Bc(Fd.ADDLAYER,s))}this.changed()}registerLayerListeners_(e){let t=[kn(e,Ic.PROPERTYCHANGE,this.handleLayerChange_,this),kn(e,Jt.CHANGE,this.handleLayerChange_,this)];e instanceof i&&t.push(kn(e,Fd.ADDLAYER,this.handleLayerGroupAdd_,this),kn(e,Fd.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[Ln(e)]=t}handleLayerGroupAdd_(e){this.dispatchEvent(new Bc(Fd.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new Bc(Fd.REMOVELAYER,e.layer))}handleLayersAdd_(e){let t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new Bc(Fd.ADDLAYER,t)),this.changed()}handleLayersRemove_(e){let t=e.element,n=Ln(t);this.listenerKeys_[n].forEach(ri),delete this.listenerKeys_[n],this.dispatchEvent(new Bc(Fd.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(P5.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 Bc(Fd.REMOVELAYER,n[r]))}this.set(P5.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=yu(l.extent,r.extent):l.extent=r.extent),l.zIndex===void 0&&(l.zIndex=s)}return t}getSourceState(){return"ready"}},Jx=I5;var mo={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var N5=class extends PS{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(Ei.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(Ei.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_&&(ri(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;let e=this.getSource();e&&(this.sourceChangeKey_=kn(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 Al?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 ey(r,t.viewState)&&(!s||yr(s,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t=this.getSource()?.getAttributions();if(!t)return[];let n=e instanceof Al?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(Ei.MAP,e)}getMapInternal(){return this.get(Ei.MAP)}setMap(e){this.mapPrecomposeKey_&&(ri(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(ri(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=kn(e,mo.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=kn(this,Jt.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){let t=e.frameState.layerStatesArray,n=this.getLayerState(!1);Vn(!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(Ei.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 ey(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 lA=N5;function IS(i,e,t=0,n=i.length-1,r=ule){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));IS(i,e,x,v,r)}let s=i[e],o=t,a=n;for(ty(i,t,e),r(i[n],s)>0&&ty(i,t,n);o<a;){for(ty(i,o,a),o++,a--;r(i[o],s)<0;)o++;for(;r(i[a],s)>0;)a--}r(i[t],s)===0?ty(i,t,a):(a++,ty(i,a,n)),a<=e&&(t=a+1),e<=a&&(n=a-1)}}function ty(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function ule(i,e){return i<e?-1:i>e?1:0}var cA=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(!LS(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;LS(e,l)&&(t.leaf?n.push(a):D5(e,l)?this._all(a,n):s.push(a))}t=s.pop()}return n}collides(e){let t=this.data;if(!LS(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(LS(e,o)){if(t.leaf||D5(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=Wg([]),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=hle(e,n.children,t);if(u!==-1)return n.children.splice(u,1),s.push(n),this._condense(s),this}!c&&!n.leaf&&D5(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=Wg(e.slice(t,n+1)),Hg(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=Wg([]),a.leaf=!1,a.height=r;let l=Math.ceil(s/o),c=l*Math.ceil(Math.sqrt(o));Iq(e,t,n,c,this.compareMinX);for(let u=t;u<=n;u+=c){let f=Math.min(u+c-1,n);Iq(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 Hg(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=L5(c),f=ple(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),iy(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=Wg(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,Hg(n,this.toBBox),Hg(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(n,a)}_splitRoot(e,t){this.data=Wg([e,t]),this.data.height=e.height+1,this.data.leaf=!1,Hg(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=ny(e,0,a,this.toBBox),c=ny(e,a,n,this.toBBox),u=Ale(l,c),f=L5(l)+L5(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:fle,s=e.leaf?this.compareMinY:dle,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=ny(e,0,t,s),a=ny(e,n-t,n,s),l=NS(o)+NS(a);for(let c=t;c<n-t;c++){let u=e.children[c];iy(o,e.leaf?s(u):u),l+=NS(o)}for(let c=n-t-1;c>=t;c--){let u=e.children[c];iy(a,e.leaf?s(u):u),l+=NS(a)}return l}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)iy(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():Hg(e[t],this.toBBox)}};function hle(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 Hg(i,e){ny(i,0,i.children.length,e,i)}function ny(i,e,t,n,r){r||(r=Wg(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];iy(r,i.leaf?n(o):o)}return r}function iy(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 fle(i,e){return i.minX-e.minX}function dle(i,e){return i.minY-e.minY}function L5(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function NS(i){return i.maxX-i.minX+(i.maxY-i.minY)}function ple(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 Ale(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 D5(i,e){return i.minX<=e.minX&&i.minY<=e.minY&&e.maxX<=i.maxX&&e.maxY<=i.maxY}function LS(i,e){return e.minX<=i.maxX&&e.minY<=i.maxY&&e.maxX>=i.minX&&e.maxY>=i.minY}function Wg(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Iq(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;IS(i,o,e,t,r),s.push(e,o,o,t)}}var hA=0,FS=0,ko=1<<hA++,si=1<<hA++,Go=1<<hA++,ca=1<<hA++,Af=1<<hA++,uA=1<<hA++,OS=Math.pow(2,hA)-1,O5={[ko]:"boolean",[si]:"number",[Go]:"string",[ca]:"color",[Af]:"number[]",[uA]:"size"},mle=Object.keys(O5).map(Number).sort(Va);function gle(i){return i in O5}function pf(i){let e=[];for(let t of mle)ry(i,t)&&e.push(O5[t]);return e.length===0?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function ry(i,e){return(i&e)===e}function DS(i,e){return!!(i&e)}function Od(i,e){return i===e}var Nr=class{constructor(e,t){if(!gle(e))throw new Error(`literal expressions must have a specific type, got ${pf(e)}`);this.type=e,this.value=t}},BS=class{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}};function US(i){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:i}}function Yr(i,e,t){switch(typeof i){case"boolean":{if(Od(e,Go))return new Nr(Go,i?"true":"false");if(!ry(e,ko))throw new Error(`got a boolean, but expected ${pf(e)}`);return new Nr(ko,i)}case"number":{if(Od(e,uA))return new Nr(uA,jr(i));if(Od(e,ko))return new Nr(ko,!!i);if(Od(e,Go))return new Nr(Go,i.toString());if(!ry(e,si))throw new Error(`got a number, but expected ${pf(e)}`);return new Nr(si,i)}case"string":{if(Od(e,ca))return new Nr(ca,zx(i));if(Od(e,ko))return new Nr(ko,!!i);if(!ry(e,Go))throw new Error(`got a string, but expected ${pf(e)}`);return new Nr(Go,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 Rle(i,e,t);for(let n of i)if(typeof n!="number")throw new Error("expected an array of numbers");if(Od(e,uA)){if(i.length!==2)throw new Error(`expected an array of two values for a size, got ${i.length}`);return new Nr(uA,i)}if(Od(e,ca)){if(i.length===3)return new Nr(ca,[...i,1]);if(i.length===4)return new Nr(ca,i);throw new Error(`expected an array of 3 or 4 values for a color, got ${i.length}`)}if(!ry(e,Af))throw new Error(`got an array of numbers, but expected ${pf(e)}`);return new Nr(Af,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"},_le={[Je.Get]:Fn(Zn(1,1/0),Nq),[Je.Var]:xle(),[Je.Has]:Fn(Zn(1,1/0),Nq),[Je.Id]:Fn(yle,jg),[Je.Concat]:Fn(Zn(2,1/0),zi(Go)),[Je.GeometryType]:Fn(vle,jg),[Je.LineMetric]:Fn(ble,jg),[Je.Resolution]:Fn(F5,jg),[Je.Zoom]:Fn(F5,jg),[Je.Time]:Fn(F5,jg),[Je.Any]:Fn(Zn(2,1/0),zi(ko)),[Je.All]:Fn(Zn(2,1/0),zi(ko)),[Je.Not]:Fn(Zn(1,1),zi(ko)),[Je.Equal]:Fn(Zn(2,2),Dq()),[Je.NotEqual]:Fn(Zn(2,2),Dq()),[Je.GreaterThan]:Fn(Zn(2,2),zi(si)),[Je.GreaterThanOrEqualTo]:Fn(Zn(2,2),zi(si)),[Je.LessThan]:Fn(Zn(2,2),zi(si)),[Je.LessThanOrEqualTo]:Fn(Zn(2,2),zi(si)),[Je.Multiply]:Fn(Zn(2,1/0),Lq),[Je.Coalesce]:Fn(Zn(2,1/0),Lq),[Je.Divide]:Fn(Zn(2,2),zi(si)),[Je.Add]:Fn(Zn(2,1/0),zi(si)),[Je.Subtract]:Fn(Zn(2,2),zi(si)),[Je.Clamp]:Fn(Zn(3,3),zi(si)),[Je.Mod]:Fn(Zn(2,2),zi(si)),[Je.Pow]:Fn(Zn(2,2),zi(si)),[Je.Abs]:Fn(Zn(1,1),zi(si)),[Je.Floor]:Fn(Zn(1,1),zi(si)),[Je.Ceil]:Fn(Zn(1,1),zi(si)),[Je.Round]:Fn(Zn(1,1),zi(si)),[Je.Sin]:Fn(Zn(1,1),zi(si)),[Je.Cos]:Fn(Zn(1,1),zi(si)),[Je.Atan]:Fn(Zn(1,2),zi(si)),[Je.Sqrt]:Fn(Zn(1,1),zi(si)),[Je.Match]:Fn(Zn(4,1/0),Fq,Sle),[Je.Between]:Fn(Zn(3,3),zi(si)),[Je.Interpolate]:Fn(Zn(6,1/0),Fq,Tle),[Je.Case]:Fn(Zn(3,1/0),wle,Ele),[Je.In]:Fn(Zn(2,2),Mle),[Je.Number]:Fn(Zn(1,1/0),zi(OS)),[Je.String]:Fn(Zn(1,1/0),zi(OS)),[Je.Array]:Fn(Zn(1,1/0),zi(si)),[Je.Color]:Fn(Zn(1,4),zi(si)),[Je.Band]:Fn(Zn(1,3),zi(si)),[Je.Palette]:Fn(Zn(2,2),Cle),[Je.ToString]:Fn(Zn(1,1),zi(ko|si|Go|ca))};function Nq(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 Nr(si,o);break}case"string":{r[s]=new Nr(Go,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 xle(){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=Yr(s,OS,t);if(!(o instanceof Nr))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${n}`);let a=o.type;if(typeof s=="string"&&DS(r,ca)&&!DS(r,Go)?a=ca:Array.isArray(s)&&s.length===2&&DS(r,uA)&&!DS(r,Af)&&(a=uA),r&=a,r===FS)throw new Error(`the type expected from the var operator (${pf(e)}) did not have any overlap with the type of the corresponding style variables (${pf(a)}), variable name: ${n}`)}if(t.variables.has(n)){let o=t.variables.get(n);if(r&=o,r===FS)throw new Error(`a new type expected from the var operator (${pf(e)}) did not have any overlap with the previous type expected for it (${pf(o)}), variable name: ${n}`)}return t.variables.set(n,r),new BS(r,"var",new Nr(Go,n))}}function yle(i,e,t){t.featureId=!0}function vle(i,e,t){t.geometryType=!0}function ble(i,e,t){t.mCoordinate=!0}function F5(i,e,t){t.mapState=!0}function jg(i,e,t){let n=i[0];if(i.length!==1)throw new Error(`expected no arguments for ${n} operation`);return[]}function Zn(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 Lq(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=Yr(i[s+1],e,t);r[s]=o}return r}function zi(i){return function(e,t,n){let r=e.length-1,s=new Array(r);for(let o=0;o<r;++o){let a=Yr(e[o+1],i,n);s[o]=a}return s}}function Dq(){return function(i,e,t){let n=i[0],r=i.length-1,s=new Array(r),o=OS;for(let a=0;a<r;++a){let l=Yr(i[a+1],o,t);o&=l.type}if(o===FS)throw new Error(`no common type was found among the arguments of ${n}`);for(let a=0;a<r;++a){let l=Yr(i[a+1],o,t);s[a]=l}return s}}function wle(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 Fq(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 Sle(i,e,t){let n=i.length-1,r=Yr(i[i.length-1],e,t),s=Go|si|ko,o=new Array(n-2);for(let l=0;l<n-2;l+=2){try{let c=Yr(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===FS)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=Yr(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=Yr(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[Yr(i[1],s,t),...o,r]}function Tle(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 Nr(si,r),o;try{o=Yr(i[2],si,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=Yr(i[l+3],si,t);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${c.message}`)}try{let c=Yr(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 Ele(i,e,t){let n=Yr(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=Yr(i[s+1],ko,t);r[s]=o}catch(o){throw new Error(`failed to parse argument ${s} of case expression: ${o.message}`)}try{let o=Yr(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 Mle(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=Go:r=si;let s=new Array(n.length);for(let a=0;a<s.length;a++)try{let l=Yr(n[a],r,t);s[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[Yr(i[1],r,t),...s]}function Cle(i,e,t){let n;try{n=Yr(i[1],si,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=Yr(r[o],ca,t)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof Nr))throw new Error(`the palette color at index ${o} must be a literal value`);s[o]=a}return[n,...s]}function Fn(...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 BS(t,r,...s)}}function Rle(i,e,t){let n=i[0],r=_le[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(i,e,t)}function kS(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 kS(i.getGeometries()[0]);default:return""}}function B5(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function kc(i,e,t){let n=Yr(i,e,t);return Uc(n,t)}function Uc(i,e){if(i instanceof Nr){if(i.type===ca&&typeof i.value=="string"){let n=zx(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 Ple(i,e);case Je.Get:case Je.Var:case Je.Has:return Ile(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=>Uc(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 Lle(i,e);case Je.Equal:case Je.NotEqual:case Je.LessThan:case Je.LessThanOrEqualTo:case Je.GreaterThan:case Je.GreaterThanOrEqualTo:return Nle(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 Dle(i,e);case Je.Case:return Fle(i,e);case Je.Match:return Ole(i,e);case Je.Interpolate:return Ble(i,e);case Je.ToString:return Ule(i,e);default:throw new Error(`Unsupported operator ${t}`)}}function Ple(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Uc(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 Ile(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 Nle(i,e){let t=i.operator,n=Uc(i.args[0],e),r=Uc(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 Lle(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Uc(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 Dle(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Uc(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 Fle(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Uc(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 Ole(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Uc(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 Ble(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Uc(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=uV(f)),u>=o)return c===2?f:p?kle(s,o,a,l,u,f):sy(s,o,a,l,u,f);a=u,l=f}return l}}function Ule(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Uc(i.args[s],e);if(t===Je.ToString)return s=>{let o=r[0](s);return i.args[0].type===ca?Vx(o):o.toString()};throw new Error(`Unsupported convert operator ${t}`)}function sy(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 kle(i,e,t,n,r,s){if(r-t===0)return n;let a=TI(n),l=TI(s),c=l[2]-a[2];c>180?c-=360:c<-180&&(c+=360);let u=[sy(i,e,t,a[0],r,l[0]),sy(i,e,t,a[1],r,l[1]),a[2]+sy(i,e,t,0,r,c),sy(i,e,t,n[3],r,s[3])];return hV(u)}function Gle(i){return!0}function zle(i,e){e=e??US();let t=Vle(i,e),n=B5();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=kS(r.getGeometry())),t(n)}}function Oq(i,e){e=e??US();let t=i.length,n=new Array(t);for(let o=0;o<t;++o)n[o]=U5(i[o],e);let r=B5(),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=kS(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 Gq(i,e){if(e=e??US(),!Array.isArray(i))return Oq([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 zle(s,e)}return Oq(i,e)}function Vle(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?kc(s.filter,ko,e):Gle,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=oy(i,"",e),n=ay(i,"",e),r=qle(i,e),s=Hle(i,e),o=go(i,"z-index",e);if(!t&&!n&&!r&&!s&&!Ec(i))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(i));let a=new ws;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 oy(i,e,t){let n;if(e+"fill-pattern-src"in i)n=$le(i,e+"fill-",t);else{if(i[e+"fill-color"]==="none")return s=>null;n=zS(i,e+"fill-color",t)}if(!n)return null;let r=new $r;return function(s){let o=n(s);return o===lS?null:(r.setColor(o),r)}}function ay(i,e,t){let n=go(i,e+"stroke-width",t),r=zS(i,e+"stroke-color",t);if(!n&&!r)return null;let s=mf(i,e+"stroke-line-cap",t),o=mf(i,e+"stroke-line-join",t),a=zq(i,e+"stroke-line-dash",t),l=go(i,e+"stroke-line-dash-offset",t),c=go(i,e+"stroke-miter-limit",t),u=go(i,e+"stroke-offset",t),f=new fo;return function(p){if(r){let x=r(p);if(x===lS)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 qle(i,e){let t="text-",n=mf(i,t+"value",e);if(!n)return null;let r=oy(i,t,e),s=oy(i,t+"background-",e),o=ay(i,t,e),a=ay(i,t+"background-",e),l=mf(i,t+"font",e),c=go(i,t+"max-angle",e),u=go(i,t+"offset-x",e),f=go(i,t+"offset-y",e),p=Xg(i,t+"overflow",e),x=mf(i,t+"placement",e),v=go(i,t+"repeat",e),w=VS(i,t+"scale",e),S=Xg(i,t+"rotate-with-view",e),T=go(i,t+"rotation",e),R=mf(i,t+"align",e),P=mf(i,t+"justify",e),C=mf(i,t+"baseline",e),L=Xg(i,t+"keep-upright",e),D=zq(i,t+"padding",e),F=qS(i,t+"declutter-mode"),N=new ff({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)),R){let z=R(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(P){let z=P(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 Hle(i,e){return"icon-src"in i?Wle(i,e):"shape-points"in i?jle(i,e):"circle-radius"in i?Xle(i,e):null}function Wle(i,e){let t="icon-",n=t+"src",r=Vq(i[n],n),s=GS(i,t+"anchor",e),o=VS(i,t+"scale",e),a=go(i,t+"opacity",e),l=GS(i,t+"displacement",e),c=go(i,t+"rotation",e),u=Xg(i,t+"rotate-with-view",e),f=Uq(i,t+"anchor-origin"),p=kq(i,t+"anchor-x-units"),x=kq(i,t+"anchor-y-units"),v=gf(i,t+"color"),w,S=null;v!==void 0&&(Array.isArray(v)&&v.length>0&&typeof v[0]=="string"?S=zS(i,t+"color",e):w=qq(v,t+"color"));let T=Kle(i,t+"cross-origin"),R=Zle(i,t+"offset"),P=Uq(i,t+"offset-origin"),C=k5(i,t+"width"),L=k5(i,t+"height"),D=Yle(i,t+"size"),F=qS(i,t+"declutter-mode"),N={src:r,anchorOrigin:f,anchorXUnits:p,anchorYUnits:x,crossOrigin:T,offset:R,offsetOrigin:P,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 rA(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 jle(i,e){let t="shape-",n=t+"points",r=t+"radius",s=G5(i[n],n);if(!(r in i))throw new Error(`Expected a number for ${r}`);let o=go(i,r,e),a=typeof i[r]=="number"?i[r]:5,l=t+"radius2",c=go(i,l,e),u=typeof i[l]=="number"?i[l]:void 0,f=oy(i,t,e),p=ay(i,t,e),x=VS(i,t+"scale",e),v=GS(i,t+"displacement",e),w=go(i,t+"rotation",e),S=Xg(i,t+"rotate-with-view",e),T=k5(i,t+"angle"),R=qS(i,t+"declutter-mode"),P=new pS({points:s,radius:a,radius2:u,angle:T,declutterMode:R});return function(C){return o&&P.setRadius(o(C)),c&&P.setRadius2(c(C)),f&&P.setFill(f(C)),p&&P.setStroke(p(C)),v&&P.setDisplacement(v(C)),w&&P.setRotation(w(C)),S&&P.setRotateWithView(S(C)),x&&P.setScale(x(C)),P}}function Xle(i,e){let t="circle-",n=oy(i,t,e),r=ay(i,t,e),s=go(i,t+"radius",e),o=VS(i,t+"scale",e),a=GS(i,t+"displacement",e),l=go(i,t+"rotation",e),c=Xg(i,t+"rotate-with-view",e),u=qS(i,t+"declutter-mode"),f=new AS({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 gf(i,e){if(!(e in i))return;let t=i[e];return t===void 0?void 0:t}function go(i,e,t){let n=gf(i,e);if(n===void 0)return;let r=kc(n,si,t);return function(s){return G5(r(s),e)}}function mf(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=kc(n,Go,t);return function(s){return Vq(r(s),e)}}function $le(i,e,t){let n=mf(i,e+"pattern-src",t),r=Bq(i,e+"pattern-offset",t),s=Bq(i,e+"pattern-size",t),o=zS(i,e+"color",t);return function(a){return{src:n(a),offset:r&&r(a),size:s&&s(a),color:o&&o(a)}}}function Xg(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=kc(n,ko,t);return function(s){let o=r(s);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${e}`);return o}}function zS(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=kc(n,ca,t);return function(s){return qq(r(s),e)}}function zq(i,e,t){let n=gf(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=kc(o,si,t);return function(c){return G5(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=kc(n,Af,t);return function(s){return ly(r(s),e)}}function GS(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=kc(n,Af,t);return function(s){let o=ly(r(s),e);if(o.length!==2)throw new Error(`Expected two numbers for ${e}`);return o}}function Bq(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=kc(n,Af,t);return function(s){return Hq(r(s),e)}}function VS(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=kc(n,Af|si,t);return function(s){return Qle(r(s),e)}}function k5(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 Yle(i,e){let t=i[e];if(t!==void 0){if(typeof t=="number")return jr(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 Kle(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 Uq(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 kq(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 Zle(i,e){let t=i[e];if(t!==void 0)return ly(t,e)}function qS(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 ly(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 Vq(i,e){if(typeof i!="string")throw new Error(`Expected a string for ${e}`);return i}function G5(i,e){if(typeof i!="number")throw new Error(`Expected a number for ${e}`);return i}function qq(i,e){if(typeof i=="string")return i;let t=ly(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 Hq(i,e){let t=ly(i,e);if(t.length!==2)throw new Error(`Expected an array of two numbers for ${e}`);return t}function Qle(i,e){return typeof i=="number"?i:Hq(i,e)}var Wq={RENDER_ORDER:"renderOrder"},z5=class extends lA{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(Wq.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 cA(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(Wq.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?UI:e;let t=Jle(e);this.styleFunction_=e===null?void 0:wV(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function Jle(i){if(i===void 0)return UI;if(!i)return null;if(typeof i=="function"||i instanceof ws)return i;if(Array.isArray(i)&&i.length===0)return[];if(Array.isArray(i)&&i[0]instanceof ws){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r];if(!(s instanceof ws))throw new Error("Expected a list of style instances");n[r]=s}return n}return Gq(i)}var HS=z5;var V5=class extends Ks{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r}},WS=V5;var q5=class extends wd{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){Kn()}calculateMatrices2D(e){let t=e.viewState,n=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;ho(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),Gw(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=bw(e.slice(),p),v=[[0,0]];if(p.canWrapX()&&r){let C=p.getExtent(),L=jn(C);v.push([-L,0],[L,0])}let w=t.layerStatesArray,S=w.length,T=[],R=[];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()&&ey(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);R[0]=z[0]+v[C][0],R[1]=z[1]+v[C][1],c=N.forEachFeatureAtCoordinate(R,t,n,V,T)}if(c)return c}}if(T.length===0)return;let P=1/T.length;return T.forEach((C,L)=>C.distanceSq+=L*P),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,rf,this,s,o)!==void 0}getMap(){return this.map_}renderFrame(e){Kn()}scheduleExpireIconCache(e){Bo.canExpireCache()&&e.postRenderFunctions.push(ece)}};function ece(i,e){Bo.expire()}var jq=q5;var H5=class extends jq{constructor(e){super(e),this.fontChangeListenerKey_=kn(nA,Ic.PROPERTYCHANGE,e.redrawText,e),this.element_=Us?Bw():document.createElement("div");let t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=Id+" 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 WS(e,void 0,t);n.dispatchEvent(r)}}disposeInternal(){ri(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(mo.PRECOMPOSE,e);let t=e.layerStatesArray.sort((u,f)=>u.zIndex-f.zIndex);t.some(u=>u.layer instanceof HS&&u.layer.getDeclutter())&&(e.declutter={});let r=e.viewState;this.children_.length=0;let o=this.getMap().getTargetElement(),a;pl(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(!ey(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),Az(this.element_,this.children_);for(let u of a?this.children_:[]){let f=u.firstElementChild||u,p=u.style.backgroundColor;if(p&&(!pl(f)||f.width>0)&&(a.fillStyle=p,a.fillRect(0,0,a.canvas.width,a.canvas.height)),!pl(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(...kw(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(mo.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))}}},Xq=H5;function $q(i){if(i instanceof lA){i.setMapInternal(null);return}i instanceof Jx&&i.getLayers().forEach($q)}function Yq(i,e){if(i instanceof lA){i.setMapInternal(e);return}if(i instanceof Jx){let t=i.getLayers().getArray();for(let n=0,r=t.length;n<r;++n)Yq(t[n],e)}}var W5=class extends bs{constructor(e){super(),e=e||{},this.on,this.once,this.un;let t=tce(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:cz,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=Zs(),this.pixelToCoordinateTransform_=Zs(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,Us||(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,Us||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=t.controls||(Us?new po:wS()),this.interactions=t.interactions||(Us?new po:RS({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new iq(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(Ao.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(Ao.VIEW,this.handleViewChanged_),this.addChangeListener(Ao.SIZE,this.handleSizeChanged_),this.addChangeListener(Ao.TARGET,this.handleTargetChanged_),this.setProperties(t.values);let n=this;e.view&&!(e.view instanceof Al)&&e.view.then(function(r){n.setView(new Al(r))}),this.controls.addEventListener(Qs.ADD,r=>{r.element.setMap(this)}),this.controls.addEventListener(Qs.REMOVE,r=>{r.element.setMap(null)}),this.interactions.addEventListener(Qs.ADD,r=>{r.element.setMap(this)}),this.interactions.addEventListener(Qs.REMOVE,r=>{r.element.setMap(null)}),this.overlays_.addEventListener(Qs.ADD,r=>{this.addOverlayInternal_(r.element)}),this.overlays_.addEventListener(Qs.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:rf,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 Jx?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:rf,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(Ao.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return Mx(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){let t=this.frameState_;return t?Ir(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(Ao.LAYERGROUP)}setLayers(e){let t=this.getLayerGroup();if(e instanceof po){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=Cc(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){let t=this.frameState_;return t?Ir(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(Ao.SIZE)}getView(){return this.get(Ao.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 rq(this.frameState_,e,t,n,r)}handleBrowserEvent(e,t){t=t||e.type;let n=new Nu(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[Gs.ANIMATING]||o[Gs.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(mo.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(mo.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Ld(Lu.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Ld(Lu.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)ri(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_&&!pl(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(pl(t)||t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new Xq(this)),!pl(t)){this.mapBrowserEventHandler_=new tq(this,this.moveTolerance_);for(let r in rr)this.mapBrowserEventHandler_.addEventListener(rr[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(Jt.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(Jt.WHEEL,this.boundHandleBrowserEvent_,Ow?{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_=[kn(n,Jt.KEYDOWN,this.handleBrowserEvent,this),kn(n,Jt.KEYPRESS,this.handleBrowserEvent,this)],!pl(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_&&(ri(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(ri(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);let e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=kn(e,Ic.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=kn(e,Jt.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(ri),this.layerGroupPropertyListenerKeys_=null);let e=this.getLayerGroup();e&&(this.handleLayerAdd_(new Bc("addlayer",e)),this.layerGroupPropertyListenerKeys_=[kn(e,Ic.PROPERTYCHANGE,this.render,this),kn(e,Jt.CHANGE,this.render,this),kn(e,"addlayer",this.handleLayerAdd_,this),kn(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){$q(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&&TP(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:wx(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:Ln(this),renderTargets:{}},a.nextCenter&&a.nextResolution){let l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;s.nextExtent=wx(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_||!vu(this.previousExtent_)&&!z0(s.extent,this.previousExtent_))&&(this.dispatchEvent(new Ld(Lu.MOVESTART,this,r)),this.previousExtent_=G0(this.previousExtent_)),this.previousExtent_&&!s.viewHints[Gs.ANIMATING]&&!s.viewHints[Gs.INTERACTING]&&!z0(s.extent,this.previousExtent_)&&(this.dispatchEvent(new Ld(Lu.MOVEEND,this,s)),pw(s.extent,this.previousExtent_))),this.dispatchEvent(new Ld(Lu.POSTRENDER,this,s)),this.renderComplete_=(this.hasListener(Lu.LOADSTART)||this.hasListener(Lu.LOADEND)||this.hasListener(mo.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 Bc("removelayer",t)),this.set(Ao.LAYERGROUP,e)}setSize(e){this.set(Ao.SIZE,e)}setTarget(e){this.set(Ao.TARGET,e)}setView(e){if(!e||e instanceof Al){this.set(Ao.VIEW,e);return}this.set(Ao.VIEW,new Al);let t=this;e.then(function(n){t.setView(new Al(n))})}updateSize(){let e=this.getTargetElement(),t;if(e){let r,s;if(pl(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)],!TP(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&xw("No map visible because the map container's width or height are 0."))}let n=this.getSize();t&&(!n||!Oo(t,n))&&(this.updateViewportSize_(t),this.setSize(t))}updateViewportSize_(e){let t=this.getView();t&&t.setViewportSize(e)}};function tce(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 Jx({layers:i.layers});t[Ao.LAYERGROUP]=n,t[Ao.TARGET]=i.target,t[Ao.VIEW]=i.view instanceof Al?i.view:new Al;let r;i.controls!==void 0&&(Array.isArray(i.controls)?r=new po(i.controls.slice()):(Vn(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 po(i.interactions.slice()):(Vn(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 po(i.overlays.slice()):(Vn(typeof i.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=i.overlays):o=new po,{controls:r,interactions:s,keyboardEventTarget:e,overlays:o,values:t}}var Kq=W5;function jS(i){return i instanceof Image||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageBitmap?i:null}var nce=new Error("disposed");var ice=[256,256],j5=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=jS(this.data_);return e?[e.width,e.height]:ice}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(nce),this.controller_=null),super.disposeInternal()}},X5=j5;var $5=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 wd&&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 Vn(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 Vn(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){Vn(!(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}},Y5=$5;var K5=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(Px(),{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}},XS=K5;var rce=5,Z5=class extends Vw{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=rce,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 Kn()}getData(e){return null}prepareFrame(e){return Kn()}renderFrame(e,t){return Kn()}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()}},Zq=Z5;var J5=[],$g=null;function sce(){$g=Ti(1,1,void 0,{willReadFrequently:!0})}var Q5=class extends Zq{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=Zs(),this.pixelTransform=Zs(),this.inversePixelTransform=Zs(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){$g||sce(),$g.clearRect(0,0,1,1);let r;try{$g.drawImage(e,t,n,1,1,0,0,1,1),r=$g.getImageData(0,0,1,1).data}catch{return $g=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(pl(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&&Oo(Yl(e.style.backgroundColor),Yl(n)))){let c=e.firstElementChild;pl(c)&&(l=c.getContext("2d"))}if(l&&bz(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=Us?Bw():document.createElement("div"),a.className=o;let c=a.style;c.position="absolute",c.width="100%",c.height="100%",l=Ti();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=Wl(n),s=pg(n),o=dg(n),a=fg(n);Ir(t.coordinateToPixelTransform,r),Ir(t.coordinateToPixelTransform,s),Ir(t.coordinateToPixelTransform,o),Ir(t.coordinateToPixelTransform,a);let l=this.inversePixelTransform;Ir(l,r),Ir(l,s),Ir(l,o),Ir(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(jn(n)/r*o),l=Math.round(xr(n)/r*o);ho(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,s,-a/2,-l/2),Gw(this.inversePixelTransform,this.pixelTransform);let c=vz(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 WS(e,this.inversePixelTransform,n,t);r.dispatchEvent(s)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(mo.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(mo.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new XS),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(mo.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(mo.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 ho(this.tempTransform,l,c,u,f,-n,p,x)}disposeInternal(){delete this.frameState,super.disposeInternal()}},$S=Q5;function eN(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 oce(i,e,t){let n=i[t];return n?n.delete(e):!1}function Qq(i,e){let t=i.layerStatesArray[i.layerIndex];t.extent&&(e=yu(e,Rc(t.extent,i.viewState.projection)));let n=t.layer.getRenderSource();if(!n.getWrapX()){let r=n.getTileGridForProjection(i.viewState.projection).getExtent();r&&(e=yu(e,r))}return e}var tN=class extends $S{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=Pr(),this.tempTileRange_=new Iw(0,0,0,0),this.tempTileCoord_=wg(0,0,0);let n=t.cacheSize!==void 0?t.cacheSize:512;this.tileCache_=new Y5(n),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new Y5(512)),this.sourceTileCache_}getOrCreateTile(e,t,n,r){let s=this.tileCache_,a=this.getLayer().getSource(),l=Sg(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||yg(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=Ir(t.pixelToCoordinateTransform,e.slice()),s=n.getExtent();if(s&&!wc(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=jr(l.getTileSize(u)),w=l.getResolution(u),S;if(p instanceof Uw||p instanceof zw)S=p.getImage();else if(p instanceof X5){if(S=jS(p.getData()),!S)continue}else continue;let T=Math.floor(c*((r[0]-x[0])/w-f[1]*v[0])),R=Math.floor(c*((x[1]-r[1])/w-f[2]*v[1])),P=Math.round(c*a.getGutterForProjection(o.projection));return this.getImageData(S,T+P,R+P)}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=Ln(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?uP(o.center,o.resolution,v,e.size):void 0;for(let S=n;S>=x;--S){let T=c.getTileRangeForExtentAndZ(t,S,this.tempTileRange_),R=c.getResolution(S);for(let P=T.minX;P<=T.maxX;++P)for(let C=T.minY;C<=T.maxY;++C){if(v&&!c.tileCoordIntersectsViewport([S,P,C],w))continue;let L=this.getTile(S,P,C,e);if(!L||!eN(r,L,S))continue;let F=L.getKey();if(f[F]=!0,L.getState()===rn.IDLE&&!e.tileQueue.isKeyQueued(F)){let N=wg(S,P,C,this.tempTileCoord_);e.tileQueue.enqueue([L,u,c.getTileCoordCenter(N),R])}}}}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=Sg(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(Ln(this)),eN(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=Sg(l,c,n,u,f),x=!1;if(a.containsKey(p)){let v=a.peek(p);v.getState()===rn.LOADED&&(eN(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?Rc(n.extent,s):null,this.layerExtent&&(v=yu(v,this.layerExtent));let R=x*S/2/w,P=x*T/2/w,C=[a[0]-R,a[1]-P,a[0]+R,a[1]+P],L={};this.renderedTiles.length=0;let D=c.getPreload();if(e.nextExtent&&this.enqueueTilesForNextExtent()){let Z=f.getZForResolution(r.nextResolution,u.zDirection),ee=Qq(e,e.nextExtent);this.enqueueTiles(e,ee,Z,L,D)}let F=Qq(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=Ln(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)){oce(L,Z,p),e.animate=!0;continue}if(this.findAltTiles_(f,ae,p+1,L))continue;let be=f.getMinZoom();for(let Ie=p-1;Ie>=be&&!this.findAltTiles_(f,ae,Ie,L);--Ie);}let z=x/o*l/w,V=this.getRenderContext(e);ho(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(Va);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,be=ae[0]*de*z,Ie=ae[1]*de*z,Qe=f.getTileCoordForCoordAndZ(Wl(C),ee),Ue=f.getTileCoordExtent(Qe),mt=Ir(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)*be),Ct=Qe[2]-$e[2],un=Math.round(mt[1]-(Ct-1)*Ie),Gt=Math.round(mt[0]-Et*be),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]&&yr(yt,K[Qt])&&ln.push(K[Qt]);let Zt;ln.length>0&&(Zt=gG(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:be,h:Ie,gutter:Qe}=j[Z];this.drawTile(ae,e,ce,de,be,Ie,Qe,!0,void 0)}if(this.renderedResolution=x,this.extentChanged=!this.renderedExtent_||!z0(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=Ln(u),de=ae.wantedTiles[ce],be=de?Object.keys(de).length:0;this.updateCacheSize(be),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=jS(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=Ln(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 R=S/s,P=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)*R,a+(N-r)*P,B*R,z*P,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=Ln(t);r in e||(e[r]={}),e[r][n.getKey()]=!0}},Jq=tN;var cy={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};var nN=class extends lA{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(cy.PRELOAD)}setPreload(e){this.set(cy.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(cy.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(cy.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}},eH=nN;var iN=class extends eH{constructor(e){super(e)}createRenderer(){return new Jq(this,{cacheSize:this.getCacheSize()})}},rN=iN;var sN=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){}},YS=sN;var uy={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},hy=[uy.FILL],Ou=[uy.STROKE],_f=[uy.BEGIN_PATH],oN=[uy.CLOSE_PATH],An=uy;var aN=class extends YS{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],wc(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=dw(c,p),S!==w?(x&&(a[l++]=u,a[l++]=f,x=!1),a[l++]=p[0],a[l++]=p[1]):S===ys.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,Dx,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,p,e,r||n,Dx,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,Lg,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,f,e,r||n,Lg,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,Mu,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,Mu,s]);break;case"MultiPoint":c=e.getFlatCoordinates(),u=this.appendFlatPointCoordinates(c,a),u>l&&(this.instructions.push([An.CUSTOM,l,u,e,n,Mu,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,Mu,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,YG(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=Ha(n||ks)??void 0}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){let n=e.getColor();t.strokeStyle=Ha(n||Uo);let r=e.getLineCap();t.lineCap=r!==void 0?r:Pu;let s=e.getLineDash();t.lineDash=s?s.slice():Wa;let o=e.getLineDashOffset();t.lineDashOffset=o||ja;let a=e.getLineJoin();t.lineJoin=a!==void 0?a:Iu;let l=e.getWidth();t.lineWidth=l!==void 0?l:hf;let c=e.getMiterLimit();t.miterLimit=c!==void 0?c:cf;let u=e.getOffset();t.strokeOffset=u??AV,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&&!Oo(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_=pw(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;ug(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Bu=aN;var lN=class extends Bu{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&&!wc(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||wc(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}},tH=lN;var cN=class extends Bu{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,Uo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Wa,ja],_f);let l=e.getFlatCoordinates(),c=e.getStride();this.drawFlatCoordinates_(l,0,l.length,c,a),this.hitDetectionInstructions.push(Ou),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,Uo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Wa,ja],_f);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(Ou),this.endGeometry(t)}finish(){let e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(Ou),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(Ou),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(_f)}},nH=cN;var uN=class extends Bu{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(_f),this.hitDetectionInstructions.push(_f);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(oN),this.hitDetectionInstructions.push(oN)),t=f}return a&&(this.instructions.push(hy),this.hitDetectionInstructions.push(hy)),l&&(this.instructions.push(Ou),this.hitDetectionInstructions.push(Ou)),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,ks]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Uo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Wa,ja]);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(_f,f),this.hitDetectionInstructions.push(_f,f),r.fillStyle!==void 0&&(this.instructions.push(hy),this.hitDetectionInstructions.push(hy)),r.strokeStyle!==void 0&&(this.instructions.push(Ou),this.hitDetectionInstructions.push(Ou)),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,ks]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Uo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Wa,ja]);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,ks]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Uo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Wa,ja]);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]=Cd(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}},hN=uN;var fN=0,dN=1;function ace(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 fN=u,dN=f,!0}function iH(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],R=i[x+1],P=!1;for(let C=x+t;C<S;C+=t){let L=i[C],D=i[C+1];if(ace(r,s,o,a,T,R,L,D)){let F=L-T,N=D-R,B=T+fN*F,z=R+fN*N,V=T+dN*F,H=R+dN*N;u&&P&&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,P=!0}T=L,R=D}x=S}return u&&c.push(l.length),{flatCoordinates:l,ends:c}}function rH(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=Fo(c,f,v),S=Fo(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=Fo(c,f,v/x),S=Fo(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 sH(i,e,t,n,r){let s=t,o=t,a=0,l=0,c=t,u,f,p,x,v,w,S,T,R,P;for(f=t;f<n;f+=r){let C=e[f],L=e[f+1];v!==void 0&&(R=C-v,P=L-w,x=Math.sqrt(R*R+P*P),S!==void 0&&(l+=p,u=Math.acos((S*R+T*P)/(p*x)),u>i&&(l>a&&(a=l,s=c,o=f),l=0,c=f-r)),p=x,S=R,T=P),v=C,w=L}return l+=x,l>a?[c,f]:[s,o]}var fy={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},pN=class extends Bu{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[ks]={fillStyle:ks},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(!yr(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 R=0,P=T.length;R<P;++R)x.push(T[R][0])}if((c=="LineString"||c=="MultiLineString")&&!xu(this.getBufferedMaxExtent(),p)){let T=iH(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,R=x.length;T<R;++T){let P;v?P=rH(v*this.resolution,u,S,x[T],f):P=[u.slice(S,x[T])];for(let C=0,L=P.length;C<L;++C){let D=P[C],F=0,N=D.length;if(w==null){let z=sH(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!=uf&&(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==uf?uf:S.map(function(C){return C*T}),v,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,p]);let R=1/T,P=v?v.slice(0):null;P&&(P[1]=ks),this.hitDetectionInstructions.push([An.DRAW_IMAGE,l,x,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[R,R],NaN,this.declutterMode_,this.declutterImageWithText_,S,P,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?ks: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||Nd,justify:t.justify,textBaseline:t.textBaseline||iA,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=fy[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&&ks,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=Ha(o.getColor()||ks)):(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(),R=a.getMiterLimit();s.lineCap=a.getLineCap()||Pu,s.lineDash=w?w.slice():Wa,s.lineDashOffset=S===void 0?ja:S,s.lineJoin=a.getLineJoin()||Iu,s.lineWidth=T===void 0?hf:T,s.miterLimit=R===void 0?cf:R,s.strokeStyle=Ha(a.getColor()||Uo)}n=this.textState_;let l=e.getFont()||fS;mV(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()||iA,n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||uf,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:Ln(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:"|"+Ln(r.fillStyle):""}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},oH=pN;var lce={Circle:hN,Default:Bu,Image:tH,LineString:nH,Polygon:hN,Text:oH},AN=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=lce[t];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=s}return s}},aH=AN;function lH(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 KS(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,R,P,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],[R,P]=cce(p,x,v,w,S,T,r),o[C++]=R,o[C++]=P;for(let D=2;D<a;D++)o[C++]=i[L+D]}return o.length!=C&&(o.length=C),o}function cce(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=SG([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),R=S*(1/v);return[i+T*o,e+R*o]}function ZS(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 R=a+S*(c-a),P=l+S*(u-l);i[n+e]=R,i[n+e+1]=P,i.splice(n+2*e,o-n-e);break}}}return i}var mN;function uce(){return mN||(mN=new Intl.Segmenter(void 0,{granularity:"grapheme"})),mN}function cH(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,R=0;function P(){w=x,S=v,e+=n,x=i[e],v=i[e+1],R+=T,T=Math.sqrt((x-w)*(x-w)+(v-S)*(v-S))}do P();while(e<t-n&&R+T<s);let C=T===0?0:(s-R)/T,L=Fo(w,x,C),D=Fo(S,v,C),F=e-n,N=R,B=s+a*l(c,r,u);for(;e<t-n&&R+T<B;)P();C=T===0?0:(B-R)/T;let z=Fo(w,x,C),V=Fo(S,v,C),H=!1;if(p)if(f){let ae=[L,D,z,V];Xw(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,R=N,x=i[e],v=i[e+1];let Z;if(j){P(),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(uce().segment(r),ae=>ae.segment);for(let ae=0,ce=ee.length;ae<ce;){P();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 be=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&&R+T<s+Ie+ze/2)break;Ie+=ze}if(ae===be)continue;let Qe=(H?ee.slice(ce-ae,ce-be):ee.slice(be,ae)).join("");C=T===0?0:(s+Ie/2-R)/T;let Ue=Fo(w,x,C),mt=Fo(S,v,C);J.push([Ue,mt,Ie/2,de,Qe]),s+=Ie}return J}var Yg=Pr(),Bd=[],xf=[],yf=[],Ud=[];function uH(i){return i[3].declutterBox}var hH=new RegExp("[\u0591-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC\u0800-\u0FFF\uE800-\uEFFF]");function gN(i,e){return e==="start"?e=hH.test(i)?"right":"left":e==="end"&&(e=hH.test(i)?"left":"right"),fy[e]}function hce(i,e,t){return t>0&&i.push(`7+`,""),i.push(e,""),i}function fce(i,e,t){return t%2===0&&(i+=e),i}var _N=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_=Zs(),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 XS: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?fy[l.justify]:gN(Array.isArray(e)?e[0]:e,l.textAlign||Nd),p=r&&o.lineWidth?o.lineWidth:0,x=Array.isArray(e)?e:String(e).split(`8+`).reduce(hce,[]),{width:v,height:w,widths:S,heights:T,lineWidths:R}=xV(l,x),P=v+p,C=[],L=(P+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*P+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*P+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 be=[ce,B+N*S[J]+f*(S[J]-R[j]),.5*(p+H)+K];B+=S[J],r&&z.push("strokeText",be),n&&V.push("fillText",be),++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,R=r-l,P=s+c>e?e-c:s,C=o+u>t?t-u:o,L=v[3]+P*p[0]+v[1],D=v[0]+C*p[1]+v[2],F=T-v[3],N=R-v[0];(w||f!==0)&&(Bd[0]=F,Ud[0]=F,Bd[1]=N,xf[1]=N,xf[0]=F+L,yf[0]=xf[0],yf[1]=N+D,Ud[1]=yf[1]);let B;return f!==0?(B=ho(Zs(),n,r,1,1,f,-n,-r),Ir(B,Bd),Ir(B,xf),Ir(B,yf),Ir(B,Ud),dl(Math.min(Bd[0],xf[0],yf[0],Ud[0]),Math.min(Bd[1],xf[1],yf[1],Ud[1]),Math.max(Bd[0],xf[0],yf[0],Ud[0]),Math.max(Bd[1],xf[1],yf[1],Ud[1]),Yg)):dl(Math.min(F,F+L),Math.min(N,N+D),Math.max(F,F+L),Math.max(N,N+D),Yg),x&&(T=Math.round(T),R=Math.round(R)),{drawImageX:T,drawImageY:R,drawImageW:P,drawImageH:C,originX:c,originY:u,declutterBox:{minX:Yg[0],minY:Yg[1],maxX:Yg[2],maxY:Yg[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,Bd,xf,yf,Ud,o,a),yV(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=Ir(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=gN(Array.isArray(e)?e[0]:e,s.textAlign||Nd),u=fy[s.textBaseline||iA],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_&&Oo(n,this.renderedTransform_)?u=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),u=qa(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),yz(this.renderedTransform_,n));let f=0,p=r.length,x=0,v,w=[],S,T,R,P,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,be,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&&!yr(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],R=Ue[2]??0;let Me=u[x],ze=u[x+1],$e=u[x+2]-R,Et=u[x+3]-R,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],pi=Ue[13];P=Ue[14]||"declutter";let Bn=Ue[15];if(!N&&Ue.length>=20){B=Ue[19],z=Ue[20],V=Ue[21],H=Ue[22];let Nn=this.drawLabelWithPointPlacement_(B,z,V,H);N=Nn.label,Ue[3]=N;let Vr=Ue[23];S=(Nn.anchorX-Vr)*this.pixelRatio,Ue[4]=S;let _r=Ue[24];T=(Nn.anchorY-_r)*this.pixelRatio,Ue[5]=T,vt=N.height,Ue[6]=vt,pi=N.width,Ue[13]=pi}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=uf,Te=null,Pe=null),Qt&&ee?xn+=Z:!Qt&&!ee&&(xn-=Z);let Ve=0;for(;x<v;x+=2){if(le&&le[Ve++]<pi/this.pixelRatio)continue;let Nn=this.calculateImageOrLabelDimensions_(N.width,N.height,u[x],u[x+1],pi,vt,S,T,ln,Zt,xn,ge,s,X,!!Te||!!Pe,de),Vr=[e,t,N,Nn,yt,Te,Pe];if(l){let _r,ll,sa;if(Bn){let ar=v-x;if(!Bn[ar]){Bn[ar]={args:Vr,declutterMode:P};continue}let Ds=Bn[ar];_r=Ds.args,ll=Ds.declutterMode,delete Bn[ar],sa=uH(_r)}let cl,Fa;if(_r&&(ll!=="declutter"||!l.collides(sa))&&(cl=!0),(P!=="declutter"||!l.collides(Nn.declutterBox))&&(Fa=!0),ll==="declutter"&&P==="declutter"){let ar=cl&&Fa;cl=ar,Fa=ar}cl&&(ll!=="none"&&l.insert(sa),this.replayImageOrLabel_.apply(this,_r)),Fa&&(P!=="none"&&l.insert(Nn.declutterBox),this.replayImageOrLabel_.apply(this,Vr))}else this.replayImageOrLabel_.apply(this,Vr)}++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(fce,"")),z=Ue[12];let cn=[Ue[13],Ue[13]];P=Ue[14]||"declutter";let yn=Ue[15],Pn=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=lH(u,gt,St,2),ct=Math.abs(Ye[0])*PI(bt,B,wt);if(Ze||ct<=Dt){let Nn=this.textStates[z].textAlign,Vr=(Dt-ct)*gN(B,Nn),_r=cH(u,gt,St,2,B,Vr,Rt,Math.abs(Ye[0]),PI,bt,wt,ee?0:this.viewRotation_,yn);e:if(_r){let ll=[],sa,cl,Fa,ar,Ds;if(V)for(sa=0,cl=_r.length;sa<cl;++sa){Ds=_r[sa],Fa=Ds[4],ar=this.createLabel(Fa,z,"",V),S=Ds[2]+(Ye[0]<0?-Mt:Mt)-Pn,T=qe*ar.height+(.5-qe)*2*Mt*Ye[1]/Ye[0]-Pt;let ul=this.calculateImageOrLabelDimensions_(ar.width,ar.height,Ds[0],Ds[1],ar.width,ar.height,S,T,0,0,Ds[3],cn,!1,uf,!1,de);if(l&&P==="declutter"&&l.collides(ul.declutterBox))break e;ll.push([e,t,ar,ul,1,null,null])}if(H)for(sa=0,cl=_r.length;sa<cl;++sa){Ds=_r[sa],Fa=Ds[4],ar=this.createLabel(Fa,z,H,""),S=Ds[2]-Pn,T=qe*ar.height-Pt;let ul=this.calculateImageOrLabelDimensions_(ar.width,ar.height,Ds[0],Ds[1],ar.width,ar.height,S,T,0,0,Ds[3],cn,!1,uf,!1,de);if(l&&P==="declutter"&&l.collides(ul.declutterBox))break e;ll.push([e,t,ar,ul,1,null,null])}l&&P!=="none"&&l.load(ll.map(uH));for(let ul=0,mu=ll.length;ul<mu;++ul)this.replayImageOrLabel_.apply(this,ll[ul])}}++f;break;case An.END_GEOMETRY:if(o!==void 0){de=Ue[1];let Nn=o(de,Qe,P);if(Nn)return Nn}++f;break;case An.FILL:ce?K++:this.fill_(e),++f;break;case An.MOVE_TO_LINE_TO:x=Ue[1],v=Ue[2],R=Ue[3];let Ce,jt,Wi;if(R){let Vr=(Ue[4]??!1)||Math.abs(u[x]-u[v-2])<1e-6&&Math.abs(u[x+1]-u[v-1])<1e-6;KS(u,x,v,2,R,Vr,w),ZS(w,2,Vr),Ce=w,jt=0,Wi=Ce.length}else Ce=u,jt=x,Wi=v;be=Ce[jt],Ie=Ce[jt+1],e.moveTo(be,Ie),C=be+.5|0,L=Ie+.5|0;for(let Nn=jt+2;Nn<Wi;Nn+=2)be=Ce[Nn],Ie=Ce[Nn+1],D=be+.5|0,F=Ie+.5|0,(Nn==Wi-2||D!==C||F!==L)&&(e.lineTo(be,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)}},fH=_N;var kd=["Polygon","Circle","LineString","Image","Text","Default"],vN=["Image","Text"],dH=kd.filter(i=>!vN.includes(i)),pH=!1,AH=!1;function dce(){let i=0,e=n=>{let r=Ti(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};pH={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0}[i],AH=!0}var yN=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_=Zs(),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 fH(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){AH===!1&&dce(),r=Math.round(r);let a=r*2+1,l=ho(this.hitDetectionTransform_,r+.5,r+.5,1/t,-1/t,-n,-e[0],-e[1]),c=!this.hitDetectionContext_;c&&(this.hitDetectionContext_=Ti(a,a,null,{willReadFrequently:pH}));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=Pr(),V0(f,e),ug(f,t*(this.renderBuffer_+r),f));let p=pce(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(Va);let S,T,R,P,C;for(S=w.length-1;S>=0;--S){let L=w[S].toString();for(R=this.executorsByZIndex_[L],T=kd.length-1;T>=0;--T)if(x=kd[T],P=R[x],P!==void 0&&(C=P.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 qa(a,0,8,2,e,a),a}isEmpty(){return Ec(this.executorsByZIndex_)}execute(e,t,n,r,s,o,a){let l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?$G:Va),o=o||kd;let c=kd.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 R=a===null?void 0:T.getZIndexContext(),P=R?R.getContext():e,C=this.maxExtent_&&S!=="Image"&&S!=="Text";if(C&&(P.save(),this.clip(P,n)),!R||S==="Text"||S==="Image"?T.execute(P,t,n,r,s,a):R.pushFunction(L=>T.execute(L,t,n,r,s,a)),C&&P.restore(),R){R.offset();let L=l[u]*c+kd.indexOf(S);this.deferredZIndexContexts_[L]||(this.deferredZIndexContexts_[L]=[]),this.deferredZIndexContexts_[L].push(R)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){let e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(Va);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}},xN={};function pce(i){if(xN[i]!==void 0)return xN[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 xN[i]=r,r}var mH=yN;var bN=class extends YS{constructor(e,t,n,r,s,o,a){super(),this.context_=e,this.pixelRatio_=t,this.extent_=n,this.transform_=r,this.transformRotation_=r?q0(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_=Zs()}drawImages_(e,t,n,r){if(!this.image_)return;let s=qa(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_;ho(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=qa(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=qa(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=KS(l,0,u,2,o,f,l),ZS(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_)),!!yr(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=Gz(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_)),!!yr(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(yr(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_)),!!yr(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_)),!!yr(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),Oo(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:Nd;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:Ha(n||ks)}}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||Wa,f=t.getOffset();this.strokeState_={lineCap:r!==void 0?r:Pu,lineDash:this.pixelRatio_===1?u:u.map(p=>p*this.pixelRatio_),lineDashOffset:(o||ja)*this.pixelRatio_,lineJoin:a!==void 0?a:Iu,lineWidth:(l!==void 0?l:hf)*this.pixelRatio_,miterLimit:c!==void 0?c:cf,strokeStyle:Ha(n||Uo),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:Ha(x||ks)}}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(),R=n.getWidth(),P=n.getMiterLimit();this.textStrokeState_={lineCap:v!==void 0?v:Pu,lineDash:w||Wa,lineDashOffset:S||ja,lineJoin:T!==void 0?T:Iu,lineWidth:R!==void 0?R:hf,miterLimit:P!==void 0?P:cf,strokeStyle:Ha(x||Uo)}}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:fS,textAlign:f!==void 0?f:Nd,textBaseline:p!==void 0?p:iA},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]]}}},gH=bN;var Gc=.5;function _H(i,e,t,n,r,s,o,a,l){let c=l?yd(r,l):r,u=i[0]*Gc,f=i[1]*Gc,p=Ti(u,f);p.imageSmoothingEnabled=!1;let x=p.canvas,v=new gH(p,Gc,r,null,o,a,l?j0($0(),l):null),w=t.length,S=Math.floor((256*256*256-1)/w),T={};for(let P=1;P<=w;++P){let C=t[P-1],L=C.getStyleFunction()||n;if(!L)continue;let D=L(C,s);if(!D)continue;Array.isArray(D)||(D=[D]);let N=(P*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||!yr(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 be=Ti(de[0],de[1],void 0,{alpha:!1}),Ie=be.canvas;be.fillStyle=N,be.fillRect(0,0,Ie.width,Ie.height),K.setImage(new rA({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 be=0,Ie=de.length;be<Ie;++be){let Qe=de[be];ae[Qe.getType().replace("Multi","")].push(Qe,K)}}else ae[ce.replace("Multi","")].push(H,K)}}let R=Object.keys(T).map(Number).sort(Va);for(let P=0,C=R.length;P<C;++P){let L=T[R[P]];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 xH(i,e,t){let n=[];if(t){let r=Math.floor(Math.round(i[0])*Gc),s=Math.floor(Math.round(i[1])*Gc),o=(xi(r,0,t.width-1)+xi(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 Ace=.5,yH={Point:bce,LineString:xce,Polygon:Sce,MultiPoint:wce,MultiLineString:yce,MultiPolygon:vce,GeometryCollection:_ce,Circle:mce};function vH(i,e){return parseInt(Ln(i),10)-parseInt(Ln(e),10)}function wN(i,e){let t=SN(i,e);return t*t}function SN(i,e){return Ace*i/e}function mce(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 TN(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)),gce(i,e,t,n,s,o,a),f}function gce(i,e,t,n,r,s,o){let a=t.getGeometryFunction()(e);if(!a)return;let l=a.simplifyTransformed(n,r);if(t.getRenderer())bH(i,l,t,e,o);else{let u=yH[l.getType()];u(i,l,t,e,o,s)}}function bH(i,e,t,n,r){if(e.getType()=="GeometryCollection"){let o=e.getGeometries();for(let a=0,l=o.length;a<l;++a)bH(i,o[a],t,n,r);return}i.getBuilder(t.getZIndex(),"Default").drawCustom(e,n,t.getRenderer(),t.getHitDetectionRenderer(),r)}function _ce(i,e,t,n,r,s){let o=e.getGeometriesArray(),a,l;for(a=0,l=o.length;a<l;++a){let c=yH[o[a].getType()];c(i,o[a],t,n,r,s)}}function xce(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 yce(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 vce(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 bce(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 wce(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 Sce(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 EN=class extends $S{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_=Pr(),this.wrappedRenderedExtent_=Pr(),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[Gs.ANIMATING]||v[Gs.INTERACTING]),S=this.context,T=Math.round(jn(r)/a*x),R=Math.round(xr(r)/a*x),P=f.getWrapX()&&l.canWrapX(),C=P?jn(u):null,L=P?Math.ceil((r[2]-u[2])/C)+(this.extendX_?2:1):1,D=P?Math.floor((r[0]-u[0])/C)-(this.extendX_?1:0):0;do{let F=this.getRenderTransform(o,a,0,x,T,R,D*C);t.declutter&&(F=F.slice(0)),e.execute(S,[S.canvas.width,S.canvas.height],F,c,w,n===void 0?kd:n?vN:dH,n?p&&t.declutter[p]:void 0)}while(++D<L)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=Ti(this.context.canvas.width,this.context.canvas.height,J5))}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),J5.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(mo.PRERENDER)||this.getLayer().hasListener(mo.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=Rc(n.extent,l);a=yr(u,e.extent),a&&!xu(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]*Gc,p=n[1]*Gc;u.push(this.getRenderTransform(r,s,o,Gc,f,p,0).slice());let x=c.getSource(),v=a.getExtent();if(x.getWrapX()&&a.canWrapX()&&!xu(v,l)){let S=l[0],T=jn(v),R=0,P;for(;S<v[0];)--R,P=T*R,u.push(this.getRenderTransform(r,s,o,Gc,f,p,P).slice()),S+=T;for(R=0,S=l[2];S>v[2];)++R,P=T*R,u.push(this.getRenderTransform(r,s,o,Gc,f,p,P).slice()),S-=T}let w=$0();this.hitDetectionImageData_=_H(n,u,this.renderedFeatures_,c.getStyleFunction(),l,s,o,wN(s,this.renderedPixelRatio_),w?a:null)}t(xH(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=Ln(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[Gs.ANIMATING],s=e.viewHints[Gs.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=vH);let S=c.center.slice(),T=ug(l,v*f),R=T.slice(),P=[T.slice()],C=u.getExtent(),L=n.getWrapX()&&u.canWrapX();if(this.extendX_=!1,L){let Z=n.getExtent();Z&&!vu(Z)&&(this.extendX_=Z[0]<C[0]||Z[2]>C[2])}if(L&&(!xu(C,e.extent)||this.extendX_)){let Z=jn(C),ee=Math.max(jn(T)/2,Z),ae=C[0],ce=C[2];this.extendX_&&(ae-=Z,ce+=Z),T[0]=ae-ee,T[2]=ce+ee,bw(S,u);let de=fP(P[0],u);de[0]<C[0]&&de[2]<C[2]?P.push([de[0]+Z,de[1],de[2]+Z,de[3]]):de[0]>C[0]&&de[2]>C[2]&&P.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&&xu(this.wrappedRenderedExtent_,T))return Oo(this.renderedExtent_,R)||(this.hitDetectionImageData_=null,this.renderedExtent_=R),this.renderedCenter_=S,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let D=new aH(SN(f,p),T,f,p),F=$0(),N;if(F){for(let Z=0,ee=P.length;Z<ee;++Z){let ae=P[Z],ce=yd(ae,u);n.loadFeatures(ce,WG(f,u),F)}N=j0(F,u)}else for(let Z=0,ee=P.length;Z<ee;++Z)n.loadFeatures(P[Z],f,u);let B=wN(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=yd(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 mH(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_=R,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=TN(r,e,n[c],t,this.boundHandleStyleImageChange_,s,o,a)||l;else l=TN(r,e,n,t,this.boundHandleStyleImageChange_,s,o,a);return l}},wH=EN;var MN=class extends HS{constructor(e){super(e)}createRenderer(){return new wH(this)}},SH=MN;var Tce=!1;function Ece(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=Tce,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 CN(i,e){return function(t,n,r,s,o){Ece(i,e,t,n,r,(a,l)=>{this.addFeatures(a),s!==void 0&&s(a)},()=>{this.changed(),o!==void 0&&o()})}}function TH(i,e){return[[-1/0,-1/0,1/0,1/0]]}function RN(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],R=i[S+1];p+=Math.sqrt((T-u)*(T-u)+(R-f)*(R-f)),x.push(p),u=T,f=R}let v=r*p,w=XG(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]:Fo(i[a+u],i[a+n+u],l);return s}var EH=Zs(),dy=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"?Aw(this.flatCoordinates_):hg(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let e=za(this.getExtent());this.flatInteriorPoints_=Bx(this.flatCoordinates_,0,this.ends_,this.stride_,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let e=nV(this.flatCoordinates_,this.ends_),t=tS(this.flatCoordinates_,0,e,this.stride_);this.flatInteriorPoints_=Qw(this.flatCoordinates_,0,e,this.stride_,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=RN(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=RN(e,t,o,this.stride_,.5);Pc(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=vs(e);let t=e.getExtent(),n=e.getWorldExtent();if(t&&n){let r=xr(n)/xr(t);ho(EH,n[0],n[3],r,-r,0,0,0),qa(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,EH,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=Fw((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=Fx(n,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,e,n,0),r=[n.length];break;case"MultiLineString":r=[],n.length=Qz(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,e,n,0,r);break;case"Polygon":r=[],n.length=Ox(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}};dy.prototype.getFlatCoordinates=dy.prototype.getOrientedFlatCoordinates;var fA=dy;var PN=class{constructor(e){this.rbush_=new cA(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_[Ln(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_[Ln(a)]=l}this.rbush_.load(n)}remove(e){let t=Ln(e),n=this.items_[t];return delete this.items_[t],this.rbush_.remove(n)!==null}update(e,t){let n=this.items_[Ln(t)],r=[n.minX,n.minY,n.maxX,n.maxY];z0(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 Ec(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){let t=this.rbush_.toJSON();return dl(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=PN;var ml={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};var Uu=class extends Ks{constructor(e,t,n){super(e),this.feature=t,this.features=n}},NN=class extends Hw{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_=of,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&&(Vn(this.format_,"`format` must be set when `url` is set"),this.loader_=CN(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:TH;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 po(r)),r!==void 0&&this.addFeaturesInternal(r),n!==void 0&&this.bindFeaturesCollection_(n)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){let t=Ln(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 Uu(ml.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof fA||(this.featureChangeKeys_[e]=[kn(t,Jt.CHANGE,this.handleFeatureChange_,this),kn(t,Ic.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 fA){let s=this.idIndex_[r];s instanceof fA?Array.isArray(s)?s.push(t):this.idIndex_[r]=[s,t]:n=!1}else n=!1}return n&&(Vn(!(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=Ln(a);this.addToIndex_(l,a)&&n.push(a)}for(let s=0,o=n.length;s<o;s++){let a=n[s],l=Ln(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(ml.ADDFEATURE))for(let s=0,o=n.length;s<o;s++)this.dispatchEvent(new Uu(ml.ADDFEATURE,n[s]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(ml.ADDFEATURE,function(n){t||(t=!0,e.push(n.feature),t=!1)}),this.addEventListener(ml.REMOVEFEATURE,function(n){t||(t=!0,e.remove(n.feature),t=!1)}),e.addEventListener(Qs.ADD,n=>{t||(t=!0,this.addFeature(n.element),t=!1)}),e.addEventListener(Qs.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(ri);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 Uu(ml.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 fA||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 fA||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(),Ec(this.nullGeometryFeatures_)||Pc(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=_w(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||rf,this.featuresRtree_.forEachInExtent(l,function(c){if(t(c)){let u=c.getGeometry(),f=a;if(a=u instanceof fA?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=Ln(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 Uu(ml.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 Ln(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Ec(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 xu(u.extent,l)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new Uu(ml.FEATURESLOADSTART));let u=v=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new Uu(ml.FEATURESLOADEND,void 0,v))},f=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new Uu(ml.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=hP(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=Ln(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(ri),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(ml.REMOVEFEATURE)&&this.dispatchEvent(new Uu(ml.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){Vn(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(CN(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}},vf=NN;var ya={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},op={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},i3=0,o2=1,r3=2;var yL=0,ap=1,s3=2,tc=3,xo=0,hi=1,sr=2,Qr=0,cs=1,ju=2,Xu=3,$u=4,Uf=5,a2=6,zs=100,l2=101,c2=102,o3=103,a3=104,Xc=200,u2=201,h2=202,f2=203,Xd=204,$d=205,d2=206,p2=207,A2=208,m2=209,g2=210,AW=211,mW=212,gW=213,_W=214,gA=0,_A=1,xA=2,zu=3,yA=4,vA=5,bA=6,wA=7,GA=0,l3=1,c3=2,Vs=0,_2=1,x2=2,y2=3,v2=4,vL=5,b2=6,w2=7;var S2=300,bl=301,nc=302,lp=303,cp=304,Yu=306,If=1e3,qo=1001,Nf=1002,yi=1003,T2=1004;var ic=1005;var bi=1006,up=1007;var vo=1008,bL=1008,Vi=1009,Ku=1010,Zu=1011,Ka=1012,Fr=1013,Ai=1014,Zi=1015,Fi=1016,zA=1017,VA=1018,Wo=1020,qA=35902,HA=35899,N_=1021,kf=1022,wr=1023,Ts=1026,eo=1027,Gf=1028,Qu=1029,Rs=1030,Ju=1031,E2=1032,hp=1033,eh=33776,th=33777,nh=33778,ih=33779,WA=35840,jA=35841,XA=35842,$A=35843,fp=36196,dp=37492,pp=37496,Ap=37488,mp=37489,rh=37490,gp=37491,_p=37808,xp=37809,yp=37810,vp=37811,bp=37812,wp=37813,Sp=37814,Tp=37815,Ep=37816,Mp=37817,Cp=37818,Rp=37819,Pp=37820,Ip=37821,Np=36492,Lp=36494,Dp=36495,Fp=36283,Op=36284,sh=36285,Bp=36286;var My=2300,IT=2301,RT=2302,aL=2303,lL=2400,cL=2401,uL=2402;var wL=0,SL=1,u3=2,xW=3200;var wl=0,h3=1,jo="",vr="srgb",Yd="srgb-linear",Kd="linear",Bt="srgb",M2="",f3="rg",TL="ga",EL=0,Mf=7680,ML=7681,CL=7682,RL=7683,PL=34055,IL=34056,NL=5386,LL=512,DL=513,FL=514,OL=515,BL=516,UL=517,kL=518,Cy=519,C2=512,L_=513,R2=514,oh=515,YA=516,P2=517,$c=518,I2=519,Zd=35044,KA=35048;var GL="300 es",_o=2e3,Xa=2001,rc={COMPUTE:"compute",RENDER:"render"};var zf={TEXTURE_COMPARE:"depthTextureCompare"};function Mce(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function D_(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function m_(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function d3(){let i=m_("canvas");return i.style.display="block",i}var MH={},g_=null;function SA(...i){let e="THREE."+i.shift();g_?g_("log",e,...i):console.log(e,...i)}function yW(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=yW(i);let e="THREE."+i.shift();if(g_)g_("warn",e,...i);else{let t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function Ge(...i){i=yW(i);let e="THREE."+i.shift();if(g_)g_("error",e,...i);else{let t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function Qn(...i){let e=i.join(" ");e in MH||(MH[e]=!0,je(...i))}function zL(){return typeof self<"u"&&typeof self.scheduler<"u"&&typeof self.scheduler.yield<"u"?self.scheduler.yield():new Promise(i=>{requestAnimationFrame(i)})}function vW(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 N2={[gA]:_A,[xA]:bA,[yA]:wA,[zu]:vA,[_A]:gA,[bA]:xA,[wA]:yA,[vA]:zu},Ho=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}}},zo=["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"],CH=1234567,wy=Math.PI/180,Lf=180/Math.PI;function Gu(){let i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(zo[i&255]+zo[i>>8&255]+zo[i>>16&255]+zo[i>>24&255]+"-"+zo[e&255]+zo[e>>8&255]+"-"+zo[e>>16&15|64]+zo[e>>24&255]+"-"+zo[t&63|128]+zo[t>>8&255]+"-"+zo[t>>16&255]+zo[t>>24&255]+zo[n&255]+zo[n>>8&255]+zo[n>>16&255]+zo[n>>24&255]).toLowerCase()}function In(i,e,t){return Math.max(e,Math.min(t,i))}function VL(i,e){return(i%e+e)%e}function Cce(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function Rce(i,e,t){return i!==e?(t-i)/(e-i):0}function Sy(i,e,t){return(1-t)*i+t*e}function Pce(i,e,t,n){return Sy(i,e,1-Math.exp(-t*n))}function Ice(i,e=1){return e-Math.abs(VL(i,e*2)-e)}function Nce(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function Lce(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function Dce(i,e){return i+Math.floor(Math.random()*(e-i+1))}function Fce(i,e){return i+Math.random()*(e-i)}function Oce(i){return i*(.5-Math.random())}function Bce(i){i!==void 0&&(CH=i);let e=CH+=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 Uce(i){return i*wy}function kce(i){return i*Lf}function Gce(i){return(i&i-1)===0&&i!==0}function zce(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Vce(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function qce(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 fa(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 Wn(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 Yc={DEG2RAD:wy,RAD2DEG:Lf,generateUUID:Gu,clamp:In,euclideanModulo:VL,mapLinear:Cce,inverseLerp:Rce,lerp:Sy,damp:Pce,pingpong:Ice,smoothstep:Nce,smootherstep:Lce,randInt:Dce,randFloat:Fce,randFloatSpread:Oce,seededRandom:Bce,degToRad:Uce,radToDeg:kce,isPowerOfTwo:Gce,ceilPowerOfTwo:zce,floorPowerOfTwo:Vce,setQuaternionFromProperEuler:qce,normalize:Wn,denormalize:fa},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=In(this.x,e.x,t.x),this.y=In(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=In(this.x,e,t),this.y=In(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(In(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(In(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,Es=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 R=Math.acos(S),P=Math.sin(R);T=Math.sin(T*R)/P,a=Math.sin(a*R)/P,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 R=1/Math.sqrt(l*l+c*c+u*u+f*f);l*=R,c*=R,u*=R,f*=R}}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(In(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}},$L=class $L{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(RH.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(RH.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=In(this.x,e.x,t.x),this.y=In(this.y,e.y,t.y),this.z=In(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=In(this.x,e,t),this.y=In(this.y,e,t),this.z=In(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(In(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 LN.copy(this).projectOnVector(e),this.sub(LN)}reflect(e){return this.sub(LN.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(In(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}};$L.prototype.isVector3=!0;var ie=$L,LN=new ie,RH=new Es,YL=class YL{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],R=r[1],P=r[4],C=r[7],L=r[2],D=r[5],F=r[8];return s[0]=o*w+a*R+l*L,s[3]=o*S+a*P+l*D,s[6]=o*T+a*C+l*F,s[1]=c*w+u*R+f*L,s[4]=c*S+u*P+f*D,s[7]=c*T+u*C+f*F,s[2]=p*w+x*R+v*L,s[5]=p*S+x*P+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 Qn("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(DN.makeScale(e,t)),this}rotate(e){return Qn("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(DN.makeRotation(-e)),this}translate(e,t){return Qn("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(DN.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)}};YL.prototype.isMatrix3=!0;var Sn=YL,DN=new Sn,PH=new Sn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),IH=new Sn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Hce(){let i={enabled:!0,workingColorSpace:Yd,spaces:{},convert:function(r,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===Bt&&(r.r=Pf(r.r),r.g=Pf(r.g),r.b=Pf(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===jo?Kd: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 Qn("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return Qn("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({[Yd]:{primaries:e,whitePoint:n,transfer:Kd,toXYZ:PH,fromXYZ:IH,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:vr},outputColorSpaceConfig:{drawingBufferColorSpace:vr}},[vr]:{primaries:e,whitePoint:n,transfer:Bt,toXYZ:PH,fromXYZ:IH,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:vr}}}),i}var sn=Hce();function Pf(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 Kg,NT=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{Kg===void 0&&(Kg=m_("canvas")),Kg.width=e.width,Kg.height=e.height;let r=Kg.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=Kg}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=m_("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]=Pf(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(Pf(t[n]/255)*255):t[n]=Pf(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}},Wce=0,__=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Wce++}),this.uuid=Gu(),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(FN(r[o].image)):s.push(FN(r[o]))}else s=FN(r);n.url=s}return t||(e.images[this.uuid]=n),n}};function FN(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?NT.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 jce=0,ON=new ie,Ms=class i extends Ho{constructor(e=i.DEFAULT_IMAGE,t=i.DEFAULT_MAPPING,n=qo,r=qo,s=bi,o=vo,a=wr,l=Vi,c=i.DEFAULT_ANISOTROPY,u=jo){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:jce++}),this.uuid=Gu(),this.name="",this.source=new __(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(ON).x}get height(){return this.source.getSize(ON).y}get depth(){return this.source.getSize(ON).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!==S2)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case If:e.x=e.x-Math.floor(e.x);break;case qo:e.x=e.x<0?0:1;break;case Nf: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 If:e.y=e.y-Math.floor(e.y);break;case qo:e.y=e.y<0?0:1;break;case Nf: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++}};Ms.DEFAULT_IMAGE=null;Ms.DEFAULT_MAPPING=S2;Ms.DEFAULT_ANISOTROPY=1;var KL=class KL{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 P=(c+1)/2,C=(x+1)/2,L=(T+1)/2,D=(u+p)/4,F=(f+w)/4,N=(v+S)/4;return P>C&&P>L?P<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(P),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 R=Math.sqrt((S-v)*(S-v)+(f-w)*(f-w)+(p-u)*(p-u));return Math.abs(R)<.001&&(R=1),this.x=(S-v)/R,this.y=(f-w)/R,this.z=(p-u)/R,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=In(this.x,e.x,t.x),this.y=In(this.y,e.y,t.y),this.z=In(this.z,e.z,t.z),this.w=In(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=In(this.x,e,t),this.y=In(this.y,e,t),this.z=In(this.z,e,t),this.w=In(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(In(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}};KL.prototype.isVector4=!0;var gn=KL,da=class extends Ho{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:bi,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 Ms(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:bi,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 __(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"})}},pa=class extends da{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},TA=class extends Ms{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=yi,this.minFilter=yi,this.wrapR=qo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}};var LT=class extends Ms{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=yi,this.minFilter=yi,this.wrapR=qo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var n3=class n3{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 n3().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/Zg.setFromMatrixColumn(e,0).length(),s=1/Zg.setFromMatrixColumn(e,1).length(),o=1/Zg.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(Xce,e,$ce)}lookAt(e,t,n){let r=this.elements;return gl.subVectors(e,t),gl.lengthSq()===0&&(gl.z=1),gl.normalize(),Gd.crossVectors(n,gl),Gd.lengthSq()===0&&(Math.abs(n.z)===1?gl.x+=1e-4:gl.z+=1e-4,gl.normalize(),Gd.crossVectors(n,gl)),Gd.normalize(),QS.crossVectors(gl,Gd),r[0]=Gd.x,r[4]=QS.x,r[8]=gl.x,r[1]=Gd.y,r[5]=QS.y,r[9]=gl.y,r[2]=Gd.z,r[6]=QS.z,r[10]=gl.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],R=n[3],P=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],be=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*be,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*be,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*be,s[3]=R*D+P*z+C*J+L*ae,s[7]=R*F+P*V+C*j+L*ce,s[11]=R*N+P*H+C*Z+L*de,s[15]=R*B+P*K+C*ee+L*be,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],R=l*x-c*p,P=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*R-S*P+T*C)-n*(v*R-S*L+T*D)+r*(v*P-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],R=t*a-n*o,P=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=R*K-P*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*P)*j,e[7]=(u*F-p*C+x*P)*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*R)*j,e[11]=(f*C-u*D-x*R)*j,e[12]=(a*B-o*V-l*N)*j,e[13]=(t*V-n*B+r*N)*j,e[14]=(w*P-v*L-S*R)*j,e[15]=(u*L-f*P+p*R)*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,R=l*c,P=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-P)*L,r[3]=0,r[4]=(x-C)*D,r[5]=(1-(p+T))*D,r[6]=(S+R)*D,r[7]=0,r[8]=(v+P)*F,r[9]=(S-R)*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=Zg.set(r[0],r[1],r[2]).length(),a=Zg.set(r[4],r[5],r[6]).length(),l=Zg.set(r[8],r[9],r[10]).length();s<0&&(o=-o),zc.copy(this);let c=1/o,u=1/a,f=1/l;return zc.elements[0]*=c,zc.elements[1]*=c,zc.elements[2]*=c,zc.elements[4]*=u,zc.elements[5]*=u,zc.elements[6]*=u,zc.elements[8]*=f,zc.elements[9]*=f,zc.elements[10]*=f,t.setFromRotationMatrix(zc),n.x=o,n.y=a,n.z=l,this}makePerspective(e,t,n,r,s,o,a=_o,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===_o)v=-(o+s)/(o-s),w=-2*o*s/(o-s);else if(a===Xa)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=_o,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===_o)v=-2/(o-s),w=-(o+s)/(o-s);else if(a===Xa)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}};n3.prototype.isMatrix4=!0;var on=n3,Zg=new ie,zc=new on,Xce=new ie(0,0,0),$ce=new ie(1,1,1),Gd=new ie,QS=new ie,gl=new ie,NH=new on,LH=new Es,Aa=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(In(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(-In(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(In(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(-In(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(In(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(-In(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 NH.makeRotationFromQuaternion(e),this.setFromRotationMatrix(NH,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return LH.setFromEuler(this),this.setFromQuaternion(LH,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}};Aa.DEFAULT_ORDER="XYZ";var x_=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}},Yce=0,DH=new ie,Qg=new Es,bf=new on,JS=new ie,py=new ie,Kce=new ie,Zce=new Es,FH=new ie(1,0,0),OH=new ie(0,1,0),BH=new ie(0,0,1),UH={type:"added"},Qce={type:"removed"},Jg={type:"childadded",child:null},BN={type:"childremoved",child:null},Ki=class i extends Ho{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Yce++}),this.uuid=Gu(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i.DEFAULT_UP.clone();let e=new ie,t=new Aa,n=new Es,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 x_,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 Qg.setFromAxisAngle(e,t),this.quaternion.multiply(Qg),this}rotateOnWorldAxis(e,t){return Qg.setFromAxisAngle(e,t),this.quaternion.premultiply(Qg),this}rotateX(e){return this.rotateOnAxis(FH,e)}rotateY(e){return this.rotateOnAxis(OH,e)}rotateZ(e){return this.rotateOnAxis(BH,e)}translateOnAxis(e,t){return DH.copy(e).applyQuaternion(this.quaternion),this.position.add(DH.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(FH,e)}translateY(e){return this.translateOnAxis(OH,e)}translateZ(e){return this.translateOnAxis(BH,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(bf.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?JS.copy(e):JS.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),py.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?bf.lookAt(py,JS,this.up):bf.lookAt(JS,py,this.up),this.quaternion.setFromRotationMatrix(bf),r&&(bf.extractRotation(r.matrixWorld),Qg.setFromRotationMatrix(bf),this.quaternion.premultiply(Qg.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(UH),Jg.child=e,this.dispatchEvent(Jg),Jg.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(Qce),BN.child=e,this.dispatchEvent(BN),BN.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),bf.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),bf.multiply(e.parent.matrixWorld)),e.applyMatrix4(bf),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(UH),Jg.child=e,this.dispatchEvent(Jg),Jg.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(py,e,Kce),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(py,Zce,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}};Ki.DEFAULT_UP=new ie(0,1,0);Ki.DEFAULT_MATRIX_AUTO_UPDATE=!0;Ki.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var br=class extends Ki{constructor(){super(),this.isGroup=!0,this.type="Group"}},Jce={type:"move"},Qd=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new br,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 br,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 br,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(Jce)))}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 br;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},bW={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},zd={h:0,s:0,l:0},eT={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=vr){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=VL(e,1),t=In(t,0,1),n=In(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=vr){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=vr){let n=bW[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=Pf(e.r),this.g=Pf(e.g),this.b=Pf(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=vr){return sn.workingToColorSpace(Vo.copy(this),e),Math.round(In(Vo.r*255,0,255))*65536+Math.round(In(Vo.g*255,0,255))*256+Math.round(In(Vo.b*255,0,255))}getHexString(e=vr){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=sn.workingColorSpace){sn.workingToColorSpace(Vo.copy(this),t);let n=Vo.r,r=Vo.g,s=Vo.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(Vo.copy(this),t),e.r=Vo.r,e.g=Vo.g,e.b=Vo.b,e}getStyle(e=vr){sn.workingToColorSpace(Vo.copy(this),e);let t=Vo.r,n=Vo.g,r=Vo.b;return e!==vr?`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(zd),this.setHSL(zd.h+e,zd.s+t,zd.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(zd),e.getHSL(eT);let n=Sy(zd.h,eT.h,t),r=Sy(zd.s,eT.s,t),s=Sy(zd.l,eT.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}},Vo=new Ut;Ut.NAMES=bW;var Jd=class extends Ki{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 Aa,this.environmentIntensity=1,this.environmentRotation=new Aa,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}},Vc=new ie,wf=new ie,kN=new ie,Sf=new ie,e_=new ie,t_=new ie,kH=new ie,GN=new ie,zN=new ie,VN=new ie,qN=new gn,HN=new gn,WN=new gn,Cf=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),Vc.subVectors(e,t),r.cross(Vc);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){Vc.subVectors(r,t),wf.subVectors(n,t),kN.subVectors(e,t);let o=Vc.dot(Vc),a=Vc.dot(wf),l=Vc.dot(kN),c=wf.dot(wf),u=wf.dot(kN),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,Sf)===null?!1:Sf.x>=0&&Sf.y>=0&&Sf.x+Sf.y<=1}static getInterpolation(e,t,n,r,s,o,a,l){return this.getBarycoord(e,t,n,r,Sf)===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,Sf.x),l.addScaledVector(o,Sf.y),l.addScaledVector(a,Sf.z),l)}static getInterpolatedAttribute(e,t,n,r,s,o){return qN.setScalar(0),HN.setScalar(0),WN.setScalar(0),qN.fromBufferAttribute(e,t),HN.fromBufferAttribute(e,n),WN.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(qN,s.x),o.addScaledVector(HN,s.y),o.addScaledVector(WN,s.z),o}static isFrontFacing(e,t,n,r){return Vc.subVectors(n,t),wf.subVectors(e,t),Vc.cross(wf).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 Vc.subVectors(this.c,this.b),wf.subVectors(this.a,this.b),Vc.cross(wf).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;e_.subVectors(r,n),t_.subVectors(s,n),GN.subVectors(e,n);let l=e_.dot(GN),c=t_.dot(GN);if(l<=0&&c<=0)return t.copy(n);zN.subVectors(e,r);let u=e_.dot(zN),f=t_.dot(zN);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(e_,o);VN.subVectors(e,s);let x=e_.dot(VN),v=t_.dot(VN);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(t_,a);let S=u*v-x*f;if(S<=0&&f-u>=0&&x-v>=0)return kH.subVectors(s,r),a=(f-u)/(f-u+(x-v)),t.copy(r).addScaledVector(kH,a);let T=1/(S+w+p);return o=w*T,a=p*T,t.copy(n).addScaledVector(e_,o).addScaledVector(t_,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},ma=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(qc.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(qc.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=qc.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,qc):qc.fromBufferAttribute(s,o),qc.applyMatrix4(e.matrixWorld),this.expandByPoint(qc);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),tT.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),tT.copy(n.boundingBox)),tT.applyMatrix4(e.matrixWorld),this.union(tT)}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,qc),qc.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(Ay),nT.subVectors(this.max,Ay),n_.subVectors(e.a,Ay),i_.subVectors(e.b,Ay),r_.subVectors(e.c,Ay),Vd.subVectors(i_,n_),qd.subVectors(r_,i_),dA.subVectors(n_,r_);let t=[0,-Vd.z,Vd.y,0,-qd.z,qd.y,0,-dA.z,dA.y,Vd.z,0,-Vd.x,qd.z,0,-qd.x,dA.z,0,-dA.x,-Vd.y,Vd.x,0,-qd.y,qd.x,0,-dA.y,dA.x,0];return!jN(t,n_,i_,r_,nT)||(t=[1,0,0,0,1,0,0,0,1],!jN(t,n_,i_,r_,nT))?!1:(iT.crossVectors(Vd,qd),t=[iT.x,iT.y,iT.z],jN(t,n_,i_,r_,nT))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,qc).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(qc).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:(Tf[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Tf[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Tf[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Tf[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Tf[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Tf[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Tf[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Tf[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Tf),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}},Tf=[new ie,new ie,new ie,new ie,new ie,new ie,new ie,new ie],qc=new ie,tT=new ma,n_=new ie,i_=new ie,r_=new ie,Vd=new ie,qd=new ie,dA=new ie,Ay=new ie,nT=new ie,iT=new ie,pA=new ie;function jN(i,e,t,n,r){for(let s=0,o=i.length-3;s<=o;s+=3){pA.fromArray(i,s);let a=r.x*Math.abs(pA.x)+r.y*Math.abs(pA.y)+r.z*Math.abs(pA.z),l=e.dot(pA),c=t.dot(pA),u=n.dot(pA);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}var Rf=eue();function eue(){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 _l(i){Math.abs(i)>65504&&je("DataUtils.toHalfFloat(): Value out of range."),i=In(i,-65504,65504),Rf.floatView[0]=i;let e=Rf.uint32View[0],t=e>>23&511;return Rf.baseTable[t]+((e&8388607)>>Rf.shiftTable[t])}function rT(i){let e=i>>10;return Rf.uint32View[0]=Rf.mantissaTable[Rf.offsetTable[e]+(i&1023)]+Rf.exponentTable[e],Rf.floatView[0]}var Ss=new ie,sT=new Oe,tue=0,Di=class extends Ho{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:tue++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Zd,this.updateRanges=[],this.gpuType=Zi,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++)sT.fromBufferAttribute(this,t),sT.applyMatrix3(e),this.setXY(t,sT.x,sT.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Ss.fromBufferAttribute(this,t),Ss.applyMatrix3(e),this.setXYZ(t,Ss.x,Ss.y,Ss.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Ss.fromBufferAttribute(this,t),Ss.applyMatrix4(e),this.setXYZ(t,Ss.x,Ss.y,Ss.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Ss.fromBufferAttribute(this,t),Ss.applyNormalMatrix(e),this.setXYZ(t,Ss.x,Ss.y,Ss.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Ss.fromBufferAttribute(this,t),Ss.transformDirection(e),this.setXYZ(t,Ss.x,Ss.y,Ss.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=fa(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Wn(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=fa(t,this.array)),t}setX(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=fa(t,this.array)),t}setY(e,t){return this.normalized&&(t=Wn(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=fa(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Wn(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=fa(t,this.array)),t}setW(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Wn(t,this.array),n=Wn(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=Wn(t,this.array),n=Wn(n,this.array),r=Wn(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=Wn(t,this.array),n=Wn(n,this.array),r=Wn(r,this.array),s=Wn(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!==Zd&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}};var EA=class extends Di{constructor(e,t,n){super(new Uint16Array(e),t,n)}};var MA=class extends Di{constructor(e,t,n){super(new Uint32Array(e),t,n)}},y_=class extends Di{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=rT(this.array[e*this.itemSize]);return this.normalized&&(t=fa(t,this.array)),t}setX(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize]=_l(t),this}getY(e){let t=rT(this.array[e*this.itemSize+1]);return this.normalized&&(t=fa(t,this.array)),t}setY(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize+1]=_l(t),this}getZ(e){let t=rT(this.array[e*this.itemSize+2]);return this.normalized&&(t=fa(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize+2]=_l(t),this}getW(e){let t=rT(this.array[e*this.itemSize+3]);return this.normalized&&(t=fa(t,this.array)),t}setW(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize+3]=_l(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Wn(t,this.array),n=Wn(n,this.array)),this.array[e+0]=_l(t),this.array[e+1]=_l(n),this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Wn(t,this.array),n=Wn(n,this.array),r=Wn(r,this.array)),this.array[e+0]=_l(t),this.array[e+1]=_l(n),this.array[e+2]=_l(r),this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=Wn(t,this.array),n=Wn(n,this.array),r=Wn(r,this.array),s=Wn(s,this.array)),this.array[e+0]=_l(t),this.array[e+1]=_l(n),this.array[e+2]=_l(r),this.array[e+3]=_l(s),this}},Rn=class extends Di{constructor(e,t,n){super(new Float32Array(e),t,n)}},nue=new ma,my=new ie,XN=new ie,$a=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):nue.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;my.subVectors(e,this.center);let t=my.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(my,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(my.copy(e.center).add(XN)),this.expandByPoint(my.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}},iue=0,Jl=new on,$N=new Ki,s_=new ie,xl=new ma,gy=new ma,Js=new ie,qn=class i extends Ho{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:iue++}),this.uuid=Gu(),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(Mce(e)?MA:EA)(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 Jl.makeRotationFromQuaternion(e),this.applyMatrix4(Jl),this}rotateX(e){return Jl.makeRotationX(e),this.applyMatrix4(Jl),this}rotateY(e){return Jl.makeRotationY(e),this.applyMatrix4(Jl),this}rotateZ(e){return Jl.makeRotationZ(e),this.applyMatrix4(Jl),this}translate(e,t,n){return Jl.makeTranslation(e,t,n),this.applyMatrix4(Jl),this}scale(e,t,n){return Jl.makeScale(e,t,n),this.applyMatrix4(Jl),this}lookAt(e){return $N.lookAt(e),$N.updateMatrix(),this.applyMatrix4($N.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(s_).negate(),this.translate(s_.x,s_.y,s_.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 Rn(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 ma);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];xl.setFromBufferAttribute(s),this.morphTargetsRelative?(Js.addVectors(this.boundingBox.min,xl.min),this.boundingBox.expandByPoint(Js),Js.addVectors(this.boundingBox.max,xl.max),this.boundingBox.expandByPoint(Js)):(this.boundingBox.expandByPoint(xl.min),this.boundingBox.expandByPoint(xl.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 $a);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(xl.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){let a=t[s];gy.setFromBufferAttribute(a),this.morphTargetsRelative?(Js.addVectors(xl.min,gy.min),xl.expandByPoint(Js),Js.addVectors(xl.max,gy.max),xl.expandByPoint(Js)):(xl.expandByPoint(gy.min),xl.expandByPoint(gy.max))}xl.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)Js.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(Js));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++)Js.fromBufferAttribute(a,c),l&&(s_.fromBufferAttribute(e,c),Js.add(s_)),r=Math.max(r,n.distanceToSquared(Js))}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 Di(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 R=this.groups;R.length===0&&(R=[{start:0,count:e.count}]);for(let N=0,B=R.length;N<B;++N){let z=R[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 P=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];P.copy(B),P.sub(L.multiplyScalar(L.dot(B))).normalize(),C.crossVectors(D,B);let V=C.dot(l[N])<0?-1:1;o.setXYZW(N,P.x,P.y,P.z,V)}for(let N=0,B=R.length;N<B;++N){let z=R[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 Di(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++)Js.fromBufferAttribute(e,t),Js.normalize(),e.setXYZ(t,Js.x,Js.y,Js.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 Di(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"})}},Df=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Zd,this.updateRanges=[],this.version=0,this.uuid=Gu()}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=Gu()),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=Gu()),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}}},ua=new ie,yo=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++)ua.fromBufferAttribute(this,t),ua.applyMatrix4(e),this.setXYZ(t,ua.x,ua.y,ua.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ua.fromBufferAttribute(this,t),ua.applyNormalMatrix(e),this.setXYZ(t,ua.x,ua.y,ua.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ua.fromBufferAttribute(this,t),ua.transformDirection(e),this.setXYZ(t,ua.x,ua.y,ua.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=fa(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Wn(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Wn(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Wn(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Wn(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Wn(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=fa(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=fa(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=fa(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=fa(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Wn(t,this.array),n=Wn(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=Wn(t,this.array),n=Wn(n,this.array),r=Wn(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=Wn(t,this.array),n=Wn(n,this.array),r=Wn(r,this.array),s=Wn(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){SA("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 Di(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){SA("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}}},rue=0,Cs=class extends Ho{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:rue++}),this.uuid=Gu(),this.name="",this.type="Material",this.blending=cs,this.side=xo,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Xd,this.blendDst=$d,this.blendEquation=zs,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ut(0,0,0),this.blendAlpha=0,this.depthFunc=zu,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Cy,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Mf,this.stencilZFail=Mf,this.stencilZPass=Mf,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!==cs&&(n.blending=this.blending),this.side!==xo&&(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!==Xd&&(n.blendSrc=this.blendSrc),this.blendDst!==$d&&(n.blendDst=this.blendDst),this.blendEquation!==zs&&(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!==zu&&(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!==Cy&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Mf&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Mf&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Mf&&(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++}},Vu=class extends Cs{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}},o_,_y=new ie,a_=new ie,l_=new ie,c_=new Oe,xy=new Oe,wW=new on,oT=new ie,yy=new ie,aT=new ie,GH=new Oe,YN=new Oe,zH=new Oe,CA=class extends Ki{constructor(e=new Vu){if(super(),this.isSprite=!0,this.type="Sprite",o_===void 0){o_=new qn;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 Df(t,5);o_.setIndex([0,1,2,0,2,3]),o_.setAttribute("position",new yo(n,3,0,!1)),o_.setAttribute("uv",new yo(n,2,3,!1))}this.geometry=o_,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.'),a_.setFromMatrixScale(this.matrixWorld),wW.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),l_.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&a_.multiplyScalar(-l_.z);let n=this.material.rotation,r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));let o=this.center;lT(oT.set(-.5,-.5,0),l_,o,a_,r,s),lT(yy.set(.5,-.5,0),l_,o,a_,r,s),lT(aT.set(.5,.5,0),l_,o,a_,r,s),GH.set(0,0),YN.set(1,0),zH.set(1,1);let a=e.ray.intersectTriangle(oT,yy,aT,!1,_y);if(a===null&&(lT(yy.set(-.5,.5,0),l_,o,a_,r,s),YN.set(0,1),a=e.ray.intersectTriangle(oT,aT,yy,!1,_y),a===null))return;let l=e.ray.origin.distanceTo(_y);l<e.near||l>e.far||t.push({distance:l,point:_y.clone(),uv:Cf.getInterpolation(_y,oT,yy,aT,GH,YN,zH,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 lT(i,e,t,n,r,s){c_.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(xy.x=s*c_.x-r*c_.y,xy.y=r*c_.x+s*c_.y):xy.copy(c_),i.copy(e),i.x+=xy.x,i.y+=xy.y,i.applyMatrix4(wW)}var Ef=new ie,KN=new ie,cT=new ie,Hd=new ie,ZN=new ie,uT=new ie,QN=new ie,Ff=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,Ef)),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=Ef.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ef.copy(this.origin).addScaledVector(this.direction,t),Ef.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){KN.copy(e).add(t).multiplyScalar(.5),cT.copy(t).sub(e).normalize(),Hd.copy(this.origin).sub(KN);let s=e.distanceTo(t)*.5,o=-this.direction.dot(cT),a=Hd.dot(this.direction),l=-Hd.dot(cT),c=Hd.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(KN).addScaledVector(cT,p),x}intersectSphere(e,t){Ef.subVectors(e.center,this.origin);let n=Ef.dot(this.direction),r=Ef.dot(Ef)-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,Ef)!==null}intersectTriangle(e,t,n,r,s){ZN.subVectors(t,e),uT.subVectors(n,e),QN.crossVectors(ZN,uT);let o=this.direction.dot(QN),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Hd.subVectors(this.origin,e);let l=a*this.direction.dot(uT.crossVectors(Hd,uT));if(l<0)return null;let c=a*this.direction.dot(ZN.cross(Hd));if(c<0||l+c>o)return null;let u=-a*Hd.dot(QN);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)}},Kr=class extends Cs{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 Aa,this.combine=GA,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}},VH=new on,AA=new Ff,hT=new $a,qH=new ie,fT=new ie,dT=new ie,pT=new ie,JN=new ie,AT=new ie,HH=new ie,mT=new ie,Gn=class extends Ki{constructor(e=new qn,t=new Kr){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){AT.set(0,0,0);for(let l=0,c=s.length;l<c;l++){let u=a[l],f=s[l];u!==0&&(JN.fromBufferAttribute(f,e),o?AT.addScaledVector(JN,u):AT.addScaledVector(JN.sub(t),u))}t.add(AT)}return t}raycast(e,t){let n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),hT.copy(n.boundingSphere),hT.applyMatrix4(s),AA.copy(e.ray).recast(e.near),!(hT.containsPoint(AA.origin)===!1&&(AA.intersectSphere(hT,qH)===null||AA.origin.distanceToSquared(qH)>(e.far-e.near)**2))&&(VH.copy(s).invert(),AA.copy(e.ray).applyMatrix4(VH),!(n.boundingBox!==null&&AA.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,AA)))}_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],R=Math.max(S.start,x.start),P=Math.min(a.count,Math.min(S.start+S.count,x.start+x.count));for(let C=R,L=P;C<L;C+=3){let D=a.getX(C),F=a.getX(C+1),N=a.getX(C+2);r=gT(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 R=a.getX(S),P=a.getX(S+1),C=a.getX(S+2);r=gT(this,o,e,n,c,u,f,R,P,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],R=Math.max(S.start,x.start),P=Math.min(l.count,Math.min(S.start+S.count,x.start+x.count));for(let C=R,L=P;C<L;C+=3){let D=C,F=C+1,N=C+2;r=gT(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 R=S,P=S+1,C=S+2;r=gT(this,o,e,n,c,u,f,R,P,C),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}}};function sue(i,e,t,n,r,s,o,a){let l;if(e.side===hi?l=n.intersectTriangle(o,s,r,!0,a):l=n.intersectTriangle(r,s,o,e.side===xo,a),l===null)return null;mT.copy(a),mT.applyMatrix4(i.matrixWorld);let c=t.ray.origin.distanceTo(mT);return c<t.near||c>t.far?null:{distance:c,point:mT.clone(),object:i}}function gT(i,e,t,n,r,s,o,a,l,c){i.getVertexPosition(a,fT),i.getVertexPosition(l,dT),i.getVertexPosition(c,pT);let u=sue(i,e,t,n,fT,dT,pT,HH);if(u){let f=new ie;Cf.getBarycoord(HH,fT,dT,pT,f),r&&(u.uv=Cf.getInterpolatedAttribute(r,a,l,c,f,new Oe)),s&&(u.uv1=Cf.getInterpolatedAttribute(s,a,l,c,f,new Oe)),o&&(u.normal=Cf.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};Cf.getNormal(fT,dT,pT,p.normal),u.face=p,u.barycoord=f}return u}var RA=class extends Ms{constructor(e=null,t=1,n=1,r,s,o,a,l,c=yi,u=yi,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 yl=class extends Di{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 eL=new ie,oue=new ie,aue=new Sn,ha=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=eL.subVectors(n,t).cross(oue.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(eL),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||aue.getNormalMatrix(e),r=this.coplanarPoint(eL).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)}},mA=new $a,lue=new Oe(.5,.5),_T=new ie,ec=class{constructor(e=new ha,t=new ha,n=new ha,r=new ha,s=new ha,o=new ha){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=_o,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],R=s[12],P=s[13],C=s[14],L=s[15];if(r[0].setComponents(c-o,x-u,T-v,L-R).normalize(),r[1].setComponents(c+o,x+u,T+v,L+R).normalize(),r[2].setComponents(c+a,x+f,T+w,L+P).normalize(),r[3].setComponents(c-a,x-f,T-w,L-P).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===_o)r[5].setComponents(c+l,x+p,T+S,L+C).normalize();else if(t===Xa)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(),mA.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),mA.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(mA)}intersectsSprite(e){mA.center.set(0,0,0);let t=lue.distanceTo(e.center);return mA.radius=.7071067811865476+t,mA.applyMatrix4(e.matrixWorld),this.intersectsSphere(mA)}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(_T.x=r.normal.x>0?e.max.x:e.min.x,_T.y=r.normal.y>0?e.max.y:e.min.y,_T.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(_T)<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)}},WH=new on,Ry=class i{constructor(){this.coordinateSystem=_o,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];WH.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),n[r]===void 0&&(n[r]=new ec),n[r].setFromProjectionMatrix(WH,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 ec),t[r].copy(n[r]);return this._count=e._count,this}clone(){return new i().copy(this)}};var Hc=class extends Cs{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}},DT=new ie,FT=new ie,jH=new on,vy=new Ff,xT=new $a,tL=new ie,XH=new ie,ep=class extends Ki{constructor(e=new qn,t=new Hc){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++)DT.fromBufferAttribute(t,r-1),FT.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=DT.distanceTo(FT);e.setAttribute("lineDistance",new Rn(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(),xT.copy(n.boundingSphere),xT.applyMatrix4(r),xT.radius+=s,e.ray.intersectsSphere(xT)===!1)return;jH.copy(r).invert(),vy.copy(e.ray).applyMatrix4(jH);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),R=u.getX(w+1),P=yT(this,e,vy,l,T,R,w);P&&t.push(P)}if(this.isLineLoop){let w=u.getX(v-1),S=u.getX(x),T=yT(this,e,vy,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=yT(this,e,vy,l,w,w+1,w);T&&t.push(T)}if(this.isLineLoop){let w=yT(this,e,vy,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 yT(i,e,t,n,r,s,o){let a=i.geometry.attributes.position;if(DT.fromBufferAttribute(a,r),FT.fromBufferAttribute(a,s),t.distanceSqToSegment(DT,FT,tL,XH)>n)return;tL.applyMatrix4(i.matrixWorld);let c=e.ray.origin.distanceTo(tL);if(!(c<e.near||c>e.far))return{distance:c,point:XH.clone().applyMatrix4(i.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:i}}var $H=new ie,YH=new ie,v_=class extends ep{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)$H.fromBufferAttribute(t,r),YH.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+$H.distanceTo(YH);e.setAttribute("lineDistance",new Rn(n,1))}else je("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}};var tp=class extends Cs{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}},KH=new on,hL=new Ff,vT=new $a,bT=new ie,Py=class extends Ki{constructor(e=new qn,t=new tp){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(),vT.copy(n.boundingSphere),vT.applyMatrix4(r),vT.radius+=s,e.ray.intersectsSphere(vT)===!1)return;KH.copy(r).invert(),hL.copy(e.ray).applyMatrix4(KH);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);bT.fromBufferAttribute(f,S),ZH(bT,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++)bT.fromBufferAttribute(f,v),ZH(bT,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 ZH(i,e,t,n,r,s,o){let a=hL.distanceSqToPoint(i);if(a<t){let l=new ie;hL.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 PA=class extends Ms{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=yi,this.minFilter=yi,this.generateMipmaps=!1,this.needsUpdate=!0}};var qu=class extends Ms{constructor(e=[],t=bl,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 us=class extends Ms{constructor(e,t,n=Ai,r,s,o,a=yi,l=yi,c,u=Ts,f=1){if(u!==Ts&&u!==eo)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 __(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}},b_=class extends us{constructor(e,t=Ai,n=bl,r,s,o=yi,a=yi,l,c=Ts){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}},Iy=class extends Ms{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},Wc=class i extends qn{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 Rn(c,3)),this.setAttribute("normal",new Rn(u,3)),this.setAttribute("uv",new Rn(f,2));function v(w,S,T,R,P,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 be=de*V-K;for(let Ie=0;Ie<j;Ie++){let Qe=Ie*z-H;ce[w]=Qe*R,ce[S]=be*P,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 be=0;be<F;be++){let Ie=p+be+j*de,Qe=p+be+j*(de+1),Ue=p+(be+1)+j*(de+1),mt=p+(be+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 w_=class i extends qn{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 Rn(o,3)),this.setAttribute("normal",new Rn(a,3)),this.setAttribute("uv",new Rn(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)}},IA=class i extends qn{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;R(),o===!1&&(e>0&&P(!0),t>0&&P(!1)),this.setIndex(u),this.setAttribute("position",new Rn(f,3)),this.setAttribute("normal",new Rn(p,3)),this.setAttribute("uv",new Rn(x,2));function R(){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 P(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 ga=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(In(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(In(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}},S_=class extends ga{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}},OT=class extends S_{constructor(e,t,n,r,s,o){super(e,t,n,n,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}};function qL(){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 QH=new ie,JH=new ie,nL=new qL,iL=new qL,rL=new qL,BT=class extends ga{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]:(JH.subVectors(r[0],r[1]).add(r[0]),c=JH);let f=r[a%s],p=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:(QH.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=QH),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),nL.initNonuniformCatmullRom(c.x,f.x,p.x,u.x,v,w,S),iL.initNonuniformCatmullRom(c.y,f.y,p.y,u.y,v,w,S),rL.initNonuniformCatmullRom(c.z,f.z,p.z,u.z,v,w,S)}else this.curveType==="catmullrom"&&(nL.initCatmullRom(c.x,f.x,p.x,u.x,this.tension),iL.initCatmullRom(c.y,f.y,p.y,u.y,this.tension),rL.initCatmullRom(c.z,f.z,p.z,u.z,this.tension));return n.set(nL.calc(l),iL.calc(l),rL.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 eW(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 cue(i,e){let t=1-i;return t*t*e}function uue(i,e){return 2*(1-i)*i*e}function hue(i,e){return i*i*e}function Ty(i,e,t,n){return cue(i,e)+uue(i,t)+hue(i,n)}function fue(i,e){let t=1-i;return t*t*t*e}function due(i,e){let t=1-i;return 3*t*t*i*e}function pue(i,e){return 3*(1-i)*i*i*e}function Aue(i,e){return i*i*i*e}function Ey(i,e,t,n,r){return fue(i,e)+due(i,t)+pue(i,n)+Aue(i,r)}var Ny=class extends ga{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(Ey(e,r.x,s.x,o.x,a.x),Ey(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}},T_=class extends ga{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(Ey(e,r.x,s.x,o.x,a.x),Ey(e,r.y,s.y,o.y,a.y),Ey(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}},Ly=class extends ga{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}},UT=class extends ga{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}},Dy=class extends ga{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(Ty(e,r.x,s.x,o.x),Ty(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}},Fy=class extends ga{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(Ty(e,r.x,s.x,o.x),Ty(e,r.y,s.y,o.y),Ty(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}},Oy=class extends ga{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(eW(a,l.x,c.x,u.x,f.x),eW(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}},kT=Object.freeze({__proto__:null,ArcCurve:OT,CatmullRomCurve3:BT,CubicBezierCurve:Ny,CubicBezierCurve3:T_,EllipseCurve:S_,LineCurve:Ly,LineCurve3:UT,QuadraticBezierCurve:Dy,QuadraticBezierCurve3:Fy,SplineCurve:Oy}),GT=class extends ga{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 kT[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 kT[r.type]().fromJSON(r))}return this}},NA=class extends GT{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 Ly(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 Dy(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 Ny(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 Oy(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 S_(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}},By=class extends NA{constructor(e){super(e),this.uuid=Gu(),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 NA().fromJSON(r))}return this}};function mue(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length,s=SW(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(n&&(s=vue(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 Uy(s,o,t,a,l,c,0),o}function SW(i,e,t,n,r){let s;if(r===Nue(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=tW(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=tW(o/n|0,i[o],i[o+1],s);return s&&E_(s,s.next)&&(Gy(s),s=s.next),s}function LA(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(E_(t,t.next)||Dr(t.prev,t,t.next)===0)){if(Gy(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Uy(i,e,t,n,r,s,o){if(!i)return;!o&&s&&Eue(i,n,r,s);let a=i;for(;i.prev!==i.next;){let l=i.prev,c=i.next;if(s?_ue(i,n,r,s):gue(i)){e.push(l.i,i.i,c.i),Gy(i),i=c.next,a=c.next;continue}if(i=c,i===a){o?o===1?(i=xue(LA(i),e),Uy(i,e,t,n,r,s,2)):o===2&&yue(i,e,t,n,r,s):Uy(LA(i),e,t,n,r,s,1);break}}}function gue(i){let e=i.prev,t=i,n=i.next;if(Dr(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&&by(r,a,s,l,o,c,v.x,v.y)&&Dr(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function _ue(i,e,t,n){let r=i.prev,s=i,o=i.next;if(Dr(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=fL(x,v,e,t,n),R=fL(w,S,e,t,n),P=i.prevZ,C=i.nextZ;for(;P&&P.z>=T&&C&&C.z<=R;){if(P.x>=x&&P.x<=w&&P.y>=v&&P.y<=S&&P!==r&&P!==o&&by(a,u,l,f,c,p,P.x,P.y)&&Dr(P.prev,P,P.next)>=0||(P=P.prevZ,C.x>=x&&C.x<=w&&C.y>=v&&C.y<=S&&C!==r&&C!==o&&by(a,u,l,f,c,p,C.x,C.y)&&Dr(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;P&&P.z>=T;){if(P.x>=x&&P.x<=w&&P.y>=v&&P.y<=S&&P!==r&&P!==o&&by(a,u,l,f,c,p,P.x,P.y)&&Dr(P.prev,P,P.next)>=0)return!1;P=P.prevZ}for(;C&&C.z<=R;){if(C.x>=x&&C.x<=w&&C.y>=v&&C.y<=S&&C!==r&&C!==o&&by(a,u,l,f,c,p,C.x,C.y)&&Dr(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function xue(i,e){let t=i;do{let n=t.prev,r=t.next.next;!E_(n,r)&&EW(n,t,t.next,r)&&ky(n,r)&&ky(r,n)&&(e.push(n.i,t.i,r.i),Gy(t),Gy(t.next),t=i=r),t=t.next}while(t!==i);return LA(t)}function yue(i,e,t,n,r,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Rue(o,a)){let l=MW(o,a);o=LA(o,o.next),l=LA(l,l.next),Uy(o,e,t,n,r,s,0),Uy(l,e,t,n,r,s,0);return}a=a.next}o=o.next}while(o!==i)}function vue(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=SW(i,a,l,n,!1);c===c.next&&(c.steiner=!0),r.push(Cue(c))}r.sort(bue);for(let s=0;s<r.length;s++)t=wue(r[s],t);return t}function bue(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 wue(i,e){let t=Sue(i,e);if(!t)return e;let n=MW(t,i);return LA(n,n.next),LA(t,t.next)}function Sue(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(E_(i,t))return t;do{if(E_(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&&TW(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);ky(t,i)&&(f<u||f===u&&(t.x>o.x||t.x===o.x&&Tue(o,t)))&&(o=t,u=f)}t=t.next}while(t!==a);return o}function Tue(i,e){return Dr(i.prev,i,e.prev)<0&&Dr(e.next,i,i.next)<0}function Eue(i,e,t,n){let r=i;do r.z===0&&(r.z=fL(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,Mue(r)}function Mue(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 fL(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 Cue(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 TW(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 by(i,e,t,n,r,s,o,a){return!(i===o&&e===a)&&TW(i,e,t,n,r,s,o,a)}function Rue(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!Pue(i,e)&&(ky(i,e)&&ky(e,i)&&Iue(i,e)&&(Dr(i.prev,i,e.prev)||Dr(i,e.prev,e))||E_(i,e)&&Dr(i.prev,i,i.next)>0&&Dr(e.prev,e,e.next)>0)}function Dr(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function E_(i,e){return i.x===e.x&&i.y===e.y}function EW(i,e,t,n){let r=ST(Dr(i,e,t)),s=ST(Dr(i,e,n)),o=ST(Dr(t,n,i)),a=ST(Dr(t,n,e));return!!(r!==s&&o!==a||r===0&&wT(i,t,e)||s===0&&wT(i,n,e)||o===0&&wT(t,i,n)||a===0&&wT(t,e,n))}function wT(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 Pue(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&&EW(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function ky(i,e){return Dr(i.prev,i,i.next)<0?Dr(i,e,i.next)>=0&&Dr(i,i.prev,e)>=0:Dr(i,e,i.prev)<0||Dr(i,i.next,e)<0}function Iue(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 MW(i,e){let t=dL(i.i,i.x,i.y),n=dL(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 tW(i,e,t,n){let r=dL(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 Gy(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 dL(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Nue(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 pL=class{static triangulate(e,t,n=2){return mue(e,t,n)}},jd=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=[];nW(e),iW(n,e);let o=e.length;t.forEach(nW);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,iW(n,t[l]);let a=pL.triangulate(n,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}};function nW(i){let e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function iW(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}var zy=class i extends qn{constructor(e=new By([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 Rn(r,3)),this.setAttribute("uv",new Rn(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,R=t.UVGenerator!==void 0?t.UVGenerator:Lue,P,C=!1,L,D,F,N;if(T){P=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(!jd.isClockWise(z)){z=z.reverse();for(let Xe=0,st=V.length;Xe<st;Xe++){let tt=V[Xe];jd.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,pi=Math.max(Math.abs(Zt.x),Math.abs(Zt.y),Math.abs(vt.x),Math.abs(vt.y)),Bn=tt*pi*pi;if(ge<=Bn){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,pi=Zt*Zt+Qt*Qt,Bn=Zt*ge-Qt*xn;if(Math.abs(Bn)>Number.EPSILON){let le=Math.sqrt(pi),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(pi)):(vt=Zt,yt=Qt,ln=Math.sqrt(pi/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=[],be,Ie=ce.concat();for(let Xe=0,st=J;Xe<st;Xe++){let tt=V[Xe];be=[];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),be[vt]=ae(tt[vt],tt[ln],tt[Zt]);de.push(be),Ie=Ie.concat(be)}let Qe;if(S===0)Qe=jd.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];be=de[Zt];let ge=[];for(let pi=0,Bn=xn.length;pi<Bn;pi++){let le=Z(xn[pi],be[pi],ln);Et(le.x,le.y,-yt),vt===0&&ge.push(le)}vt===0&&st.push(ge)}}Qe=jd.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(P[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(P[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];be=de[yt];for(let Qt=0,xn=Zt.length;Qt<xn;Qt++){let ge=Z(Zt[Qt],be[Qt],vt);C?Et(ge.x,ge.y+P[u-1].y,P[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,pi=st+yt+Qt,Bn=st+yt+xn,le=st+vt+xn;Ct(ge,pi,Bn,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=R.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=R.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 Due(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 kT[r.type]().fromJSON(r)),new i(n,e.options)}},Lue={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 Due(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 DA=class i extends qn{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 R=T*p-o;for(let P=0;P<c;P++){let C=P*f-s;v.push(C,-R,0),w.push(0,0,1),S.push(P/a),S.push(1-T/l)}}for(let T=0;T<l;T++)for(let R=0;R<a;R++){let P=R+c*T,C=R+c*(T+1),L=R+1+c*(T+1),D=R+1+c*T;x.push(P,C,D),x.push(C,L,D)}this.setIndex(x),this.setAttribute("position",new Rn(v,3)),this.setAttribute("normal",new Rn(w,3)),this.setAttribute("uv",new Rn(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 _a=class i extends qn{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 R=[],P=T/n,C=o+P*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-P),R.push(c++)}u.push(R)}for(let T=0;T<n;T++)for(let R=0;R<t;R++){let P=u[T][R+1],C=u[T][R],L=u[T+1][R],D=u[T+1][R+1];(T!==0||o>0)&&x.push(P,C,D),(T!==n-1||l<Math.PI)&&x.push(C,L,D)}this.setIndex(x),this.setAttribute("position",new Rn(v,3)),this.setAttribute("normal",new Rn(w,3)),this.setAttribute("uv",new Rn(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 Vy=class i extends qn{constructor(e=new Fy(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 Rn(f,3)),this.setAttribute("normal",new Rn(p,3)),this.setAttribute("uv",new Rn(x,2));function w(){for(let P=0;P<t;P++)S(P);S(s===!1?t:0),R(),T()}function S(P){u=e.getPointAt(P/t,u);let C=o.normals[P],L=o.binormals[P];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 P=1;P<=t;P++)for(let C=1;C<=r;C++){let L=(r+1)*(P-1)+(C-1),D=(r+1)*P+(C-1),F=(r+1)*P+C,N=(r+1)*(P-1)+C;v.push(L,D,N),v.push(D,F,N)}}function R(){for(let P=0;P<=t;P++)for(let C=0;C<=r;C++)c.x=P/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 kT[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}},qy=class extends qn{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),R=a.getX(v+(S+1)%3);r.fromBufferAttribute(o,T),s.fromBufferAttribute(o,R),rW(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),rW(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Rn(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}};function rW(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 Hy=class extends Cs{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(sW(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(sW(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 Xo(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 sW(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function Fue(i){let e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function HL(i){let e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:sn.workingColorSpace}var QA={clone:ZA,merge:Xo},Oue=`void main() {1010 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );11-}`,Lue=`void main() {11+}`,Bue=`void main() {1212 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );13-}`,Kr=class extends Cs{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Nue,this.fragmentShader=Lue,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=Iue(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}},GT=class extends Kr{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}},E_=class extends Cs{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=wl,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 Aa,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}},qy=class extends E_{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 In(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}},FA=class extends Cs{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=wl,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 Aa,this.combine=GA,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}},Hy=class extends Cs{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=wl,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}},Wy=class extends Cs{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=wl,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}},xa=class extends Cs{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=wl,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 Aa,this.combine=GA,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}},zT=class extends Cs{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=gW,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}},VT=class extends Cs{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}},jy=class extends Cs{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=wl,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}},Xy=class extends Hc{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 ST(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}var np=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_(){}},qT=class extends np{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:aL,endingEnd:aL}}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 lL:s=e,a=2*t-n;break;case cL: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 lL:o=e,l=2*n-t;break;case cL: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}},HT=class extends np{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}},WT=class extends np{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}},jT=class extends np{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}},vl=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=ST(t,this.TimeBufferType),this.values=ST(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:ST(e.times,Array),values:ST(e.values,Array)};let r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new WT(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new HT(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new qT(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new jT(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 Ty:t=this.InterpolantFactoryMethodDiscrete;break;case PT:t=this.InterpolantFactoryMethodLinear;break;case CT:t=this.InterpolantFactoryMethodSmooth;break;case oL: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 Ty;case this.InterpolantFactoryMethodLinear:return PT;case this.InterpolantFactoryMethodSmooth:return CT;case this.InterpolantFactoryMethodBezier:return oL}}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&&L_(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()===CT,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}};vl.prototype.ValueTypeName="";vl.prototype.TimeBufferType=Float32Array;vl.prototype.ValueBufferType=Float32Array;vl.prototype.DefaultInterpolation=PT;var ip=class extends vl{constructor(e,t,n){super(e,t,n)}};ip.prototype.ValueTypeName="bool";ip.prototype.ValueBufferType=Array;ip.prototype.DefaultInterpolation=Ty;ip.prototype.InterpolantFactoryMethodLinear=void 0;ip.prototype.InterpolantFactoryMethodSmooth=void 0;var XT=class extends vl{constructor(e,t,n,r){super(e,t,n,r)}};XT.prototype.ValueTypeName="color";var $T=class extends vl{constructor(e,t,n,r){super(e,t,n,r)}};$T.prototype.ValueTypeName="number";var YT=class extends np{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)Es.slerpFlat(s,0,o,c-a,o,c,l);return s}},$y=class extends vl{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new YT(this.times,this.values,this.getValueSize(),e)}};$y.prototype.ValueTypeName="quaternion";$y.prototype.InterpolantFactoryMethodSmooth=void 0;var rp=class extends vl{constructor(e,t,n){super(e,t,n)}};rp.prototype.ValueTypeName="string";rp.prototype.ValueBufferType=Array;rp.prototype.DefaultInterpolation=Ty;rp.prototype.InterpolantFactoryMethodLinear=void 0;rp.prototype.InterpolantFactoryMethodSmooth=void 0;var KT=class extends vl{constructor(e,t,n,r){super(e,t,n,r)}};KT.prototype.ValueTypeName="vector";var RT={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(rW(i)||(this.files[i]=e))},get:function(i){if(this.enabled!==!1&&!rW(i))return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};function rW(i){try{let e=i.slice(i.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}var ZT=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}},EW=new ZT,sp=class{constructor(e){this.manager=e!==void 0?e:EW,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}};sp.DEFAULT_MATERIAL_NAME="__DEFAULT";var c_=new WeakMap,QT=class extends sp{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=RT.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=c_.get(o);f===void 0&&(f=[],c_.set(o,f)),f.push({onLoad:t,onError:r})}return o}let a=A_("img");function l(){u(),t&&t(this);let f=c_.get(this)||[];for(let p=0;p<f.length;p++){let x=f[p];x.onLoad&&x.onLoad(this)}c_.delete(this),s.manager.itemEnd(e)}function c(f){u(),r&&r(f),RT.remove(`image:${e}`);let p=c_.get(this)||[];for(let x=0;x<p.length;x++){let v=p[x];v.onError&&v.onError(f)}c_.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),RT.add(`image:${e}`,a),s.manager.itemStart(e),a.src=e,a}};var Ya=class extends sp{constructor(e){super(e)}load(e,t,n,r){let s=new Ms,o=new QT(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}},Hu=class extends Ki{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}},Yy=class extends Hu{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Ki.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}},rL=new on,sW=new ie,oW=new ie,Ky=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=Vi,this.map=null,this.mapPass=null,this.matrix=new on,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ec,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;sW.setFromMatrixPosition(e.matrixWorld),t.position.copy(sW),oW.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(oW),t.updateMatrixWorld(),rL.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(rL,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===Xa||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(rL)}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}},TT=new ie,ET=new Es,ku=new ie,Of=class extends Ki{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new on,this.projectionMatrix=new on,this.projectionMatrixInverse=new on,this.coordinateSystem=go,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(TT,ET,ku),ku.x===1&&ku.y===1&&ku.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(TT,ET,ku.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(TT,ET,ku),ku.x===1&&ku.y===1&&ku.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(TT,ET,ku.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},Wd=new ie,aW=new Oe,lW=new Oe,Lr=class extends Of{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=Lf*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(vy*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Lf*2*Math.atan(Math.tan(vy*.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){Wd.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Wd.x,Wd.y).multiplyScalar(-e/Wd.z),Wd.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Wd.x,Wd.y).multiplyScalar(-e/Wd.z)}getViewSize(e,t){return this.getViewBounds(e,aW,lW),t.subVectors(lW,aW)}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(vy*.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}},pL=class extends Ky{constructor(){super(new Lr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=Lf*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}},OA=class extends Hu{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(Ki.DEFAULT_UP),this.updateMatrix(),this.target=new Ki,this.distance=n,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new pL}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}},AL=class extends Ky{constructor(){super(new Lr(90,1,.5,500)),this.isPointLightShadow=!0}},Zy=class extends Hu{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 AL}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}},jc=class extends Of{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}},mL=class extends Ky{constructor(){super(new jc(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},BA=class extends Hu{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Ki.DEFAULT_UP),this.updateMatrix(),this.target=new Ki,this.shadow=new mL}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}},UA=class extends Hu{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}},Qy=class extends Hu{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}},JT=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)}},Jy=class extends Hu{constructor(e=new JT,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 e2=class extends qn{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 u_=-90,h_=1,M_=class extends Ki{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new Lr(u_,h_,e,t);r.layers=this.layers,this.add(r);let s=new Lr(u_,h_,e,t);s.layers=this.layers,this.add(s);let o=new Lr(u_,h_,e,t);o.layers=this.layers,this.add(o);let a=new Lr(u_,h_,e,t);a.layers=this.layers,this.add(a);let l=new Lr(u_,h_,e,t);l.layers=this.layers,this.add(l);let c=new Lr(u_,h_,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===go)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===Xa)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}},C_=class extends Lr{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},kA=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=Due.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 Due(){this._document.hidden===!1&&this.reset()}var HL="\\[\\]\\.:\\/",Fue=new RegExp("["+HL+"]","g"),WL="[^"+HL+"]",Oue="[^"+HL.replace("\\.","")+"]",Bue=/((?:WC+[\/:])*)/.source.replace("WC",WL),Uue=/(WCOD+)?/.source.replace("WCOD",Oue),kue=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",WL),Gue=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",WL),zue=new RegExp("^"+Bue+Uue+kue+Gue+"$"),Vue=["material","materials","bones","map"],gL=class{constructor(e,t,n){let r=n||hr.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()}},hr=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(Fue,"")}static parseTrackName(e){let t=zue.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);Vue.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}};hr.Composite=gL;hr.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};hr.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};hr.prototype.GetterByBindingType=[hr.prototype._getValue_direct,hr.prototype._getValue_array,hr.prototype._getValue_arrayElement,hr.prototype._getValue_toArray];hr.prototype.SetterByBindingTypeAndVersioning=[[hr.prototype._setValue_direct,hr.prototype._setValue_direct_setNeedsUpdate,hr.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[hr.prototype._setValue_array,hr.prototype._setValue_array_setNeedsUpdate,hr.prototype._setValue_array_setMatrixWorldNeedsUpdate],[hr.prototype._setValue_arrayElement,hr.prototype._setValue_arrayElement_setNeedsUpdate,hr.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[hr.prototype._setValue_fromArray,hr.prototype._setValue_fromArray_setNeedsUpdate,hr.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var TVe=new Float32Array(1);var Wu=class extends Df{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 cW=new on,t2=class{constructor(e,t,n=0,r=1/0){this.ray=new Ff(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new __,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 cW.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(cW),this}intersectObject(e,t=!0,n=[]){return _L(e,this,n,t),n.sort(uW),n}intersectObjects(e,t=!0,n=[]){for(let r=0,s=e.length;r<s;r++)_L(e[r],this,n,t);return n.sort(uW),n}};function uW(i,e){return i.distance-e.distance}function _L(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++)_L(s[o],e,t,!0)}}var R_=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=In(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(In(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};var KL=class KL{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}};KL.prototype.isMatrix2=!0;var P_=KL,hW=new Oe,e3=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=hW.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,hW).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)}},fW=new ie,MT=new ie,f_=new ie,d_=new ie,sL=new ie,que=new ie,Hue=new ie,n2=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){fW.subVectors(e,this.start),MT.subVectors(this.end,this.start);let n=MT.dot(MT);if(n===0)return 0;let s=MT.dot(fW)/n;return t&&(s=In(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=que,n=Hue){let r=10000000000000001e-32,s,o,a=this.start,l=e.start,c=this.end,u=e.end;f_.subVectors(c,a),d_.subVectors(u,l),sL.subVectors(a,l);let f=f_.dot(f_),p=d_.dot(d_),x=d_.dot(sL);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=In(o,0,1);else{let v=f_.dot(sL);if(p<=r)o=0,s=In(-v/f,0,1);else{let w=f_.dot(d_),S=f*p-w*w;S!==0?s=In((w*x-v*p)/S,0,1):s=0,o=(w*s+x)/p,o<0?(o=0,s=In(-v/f,0,1)):o>1&&(o=1,s=In((w-v)/f,0,1))}}return t.copy(a).addScaledVector(f_,s),n.copy(l).addScaledVector(d_,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 i2=class{constructor(){this.type="ShapePath",this.color=new Ut,this.subPaths=[],this.currentPath=null,this.userData={}}moveTo(e,t){return this.currentPath=new NA,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=jd.area(c);if(u===0)continue;let f=new e3;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 Fy;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 NA;u.curves=l.subPath.curves,c.holes.push(u)}return o}},Bf=class extends qo{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 I2(i,e,t,n){let r=Wue(n);switch(t){case I_:return i*e;case Gf:return i*e/r.components*r.byteLength;case Qu:return i*e/r.components*r.byteLength;case Rs:return i*e*2/r.components*r.byteLength;case Ju:return i*e*2/r.components*r.byteLength;case kf:return i*e*3/r.components*r.byteLength;case wr:return i*e*4/r.components*r.byteLength;case hp:return i*e*4/r.components*r.byteLength;case eh:case th:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case nh:case ih:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case jA:case $A:return Math.max(i,16)*Math.max(e,8)/4;case WA:case XA:return Math.max(i,8)*Math.max(e,8)/2;case fp:case dp:case Ap:case mp:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case pp:case rh:case gp:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case _p:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case xp:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case yp:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case vp:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case bp:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case wp:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case Sp:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case Tp:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case Ep:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case Mp:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case Cp:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case Rp:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case Pp:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case Ip:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case Np:case Lp:case Dp:return Math.ceil(i/4)*Math.ceil(e/4)*16;case Fp:case Op:return Math.ceil(i/4)*Math.ceil(e/4)*8;case sh:case Bp:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Wue(i){switch(i){case Vi:case Ku:return{byteLength:1,components:1};case Ka:case Zu:case Fi:return{byteLength:2,components:1};case zA:case VA:return{byteLength:2,components:4};case Ai:case Fr:case Zi:return{byteLength:4,components:1};case qA:case HA: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 KW(){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 $ue(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 Yue=`#ifdef USE_ALPHAHASH13+}`,Zr=class extends Cs{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Oue,this.fragmentShader=Bue,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=Fue(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}},zT=class extends Zr{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}},M_=class extends Cs{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=wl,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 Aa,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}},Wy=class extends M_{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 In(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}},FA=class extends Cs{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=wl,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 Aa,this.combine=GA,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}},jy=class extends Cs{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=wl,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}},Xy=class extends Cs{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=wl,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}},xa=class extends Cs{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=wl,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 Aa,this.combine=GA,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}},VT=class extends Cs{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=xW,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}},qT=class extends Cs{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}},$y=class extends Cs{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=wl,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}},Yy=class extends Hc{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 TT(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}var np=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_(){}},HT=class extends np{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:lL,endingEnd:lL}}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 cL:s=e,a=2*t-n;break;case uL: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 cL:o=e,l=2*n-t;break;case uL: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,R=(1+p)*S+(-1.5-2*p)*w+(-.5+p)*v+1,P=(-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]+R*o[c+L]+P*o[l+L]+C*o[f+L];return s}},WT=class extends np{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}},jT=class extends np{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}},XT=class extends np{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,R=f[T],P=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*R+3*z*N*L+B*r-n;if(Math.abs(j)<1e-10)break;let Z=3*V*(R-t)+6*z*F*(L-R)+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*P+3*z*N*D+B*S}return s}},vl=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=TT(t,this.TimeBufferType),this.values=TT(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:TT(e.times,Array),values:TT(e.values,Array)};let r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new jT(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new WT(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new HT(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new XT(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 IT:t=this.InterpolantFactoryMethodLinear;break;case RT:t=this.InterpolantFactoryMethodSmooth;break;case aL: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 IT;case this.InterpolantFactoryMethodSmooth:return RT;case this.InterpolantFactoryMethodBezier:return aL}}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&&D_(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()===RT,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}};vl.prototype.ValueTypeName="";vl.prototype.TimeBufferType=Float32Array;vl.prototype.ValueBufferType=Float32Array;vl.prototype.DefaultInterpolation=IT;var ip=class extends vl{constructor(e,t,n){super(e,t,n)}};ip.prototype.ValueTypeName="bool";ip.prototype.ValueBufferType=Array;ip.prototype.DefaultInterpolation=My;ip.prototype.InterpolantFactoryMethodLinear=void 0;ip.prototype.InterpolantFactoryMethodSmooth=void 0;var $T=class extends vl{constructor(e,t,n,r){super(e,t,n,r)}};$T.prototype.ValueTypeName="color";var YT=class extends vl{constructor(e,t,n,r){super(e,t,n,r)}};YT.prototype.ValueTypeName="number";var KT=class extends np{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)Es.slerpFlat(s,0,o,c-a,o,c,l);return s}},Ky=class extends vl{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new KT(this.times,this.values,this.getValueSize(),e)}};Ky.prototype.ValueTypeName="quaternion";Ky.prototype.InterpolantFactoryMethodSmooth=void 0;var rp=class extends vl{constructor(e,t,n){super(e,t,n)}};rp.prototype.ValueTypeName="string";rp.prototype.ValueBufferType=Array;rp.prototype.DefaultInterpolation=My;rp.prototype.InterpolantFactoryMethodLinear=void 0;rp.prototype.InterpolantFactoryMethodSmooth=void 0;var ZT=class extends vl{constructor(e,t,n,r){super(e,t,n,r)}};ZT.prototype.ValueTypeName="vector";var PT={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(oW(i)||(this.files[i]=e))},get:function(i){if(this.enabled!==!1&&!oW(i))return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};function oW(i){try{let e=i.slice(i.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}var QT=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}},CW=new QT,sp=class{constructor(e){this.manager=e!==void 0?e:CW,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}};sp.DEFAULT_MATERIAL_NAME="__DEFAULT";var u_=new WeakMap,JT=class extends sp{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=PT.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=u_.get(o);f===void 0&&(f=[],u_.set(o,f)),f.push({onLoad:t,onError:r})}return o}let a=m_("img");function l(){u(),t&&t(this);let f=u_.get(this)||[];for(let p=0;p<f.length;p++){let x=f[p];x.onLoad&&x.onLoad(this)}u_.delete(this),s.manager.itemEnd(e)}function c(f){u(),r&&r(f),PT.remove(`image:${e}`);let p=u_.get(this)||[];for(let x=0;x<p.length;x++){let v=p[x];v.onError&&v.onError(f)}u_.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),PT.add(`image:${e}`,a),s.manager.itemStart(e),a.src=e,a}};var Ya=class extends sp{constructor(e){super(e)}load(e,t,n,r){let s=new Ms,o=new JT(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}},Hu=class extends Ki{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 Hu{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Ki.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}},sL=new on,aW=new ie,lW=new ie,Qy=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=Vi,this.map=null,this.mapPass=null,this.matrix=new on,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ec,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;aW.setFromMatrixPosition(e.matrixWorld),t.position.copy(aW),lW.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(lW),t.updateMatrixWorld(),sL.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(sL,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===Xa||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(sL)}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}},ET=new ie,MT=new Es,ku=new ie,Of=class extends Ki{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new on,this.projectionMatrix=new on,this.projectionMatrixInverse=new on,this.coordinateSystem=_o,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(ET,MT,ku),ku.x===1&&ku.y===1&&ku.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(ET,MT,ku.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(ET,MT,ku),ku.x===1&&ku.y===1&&ku.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(ET,MT,ku.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},Wd=new ie,cW=new Oe,uW=new Oe,Lr=class extends Of{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=Lf*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(wy*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Lf*2*Math.atan(Math.tan(wy*.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){Wd.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Wd.x,Wd.y).multiplyScalar(-e/Wd.z),Wd.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Wd.x,Wd.y).multiplyScalar(-e/Wd.z)}getViewSize(e,t){return this.getViewBounds(e,cW,uW),t.subVectors(uW,cW)}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(wy*.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}},AL=class extends Qy{constructor(){super(new Lr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=Lf*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}},OA=class extends Hu{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(Ki.DEFAULT_UP),this.updateMatrix(),this.target=new Ki,this.distance=n,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new AL}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}},mL=class extends Qy{constructor(){super(new Lr(90,1,.5,500)),this.isPointLightShadow=!0}},Jy=class extends Hu{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 mL}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}},jc=class extends Of{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}},gL=class extends Qy{constructor(){super(new jc(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},BA=class extends Hu{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Ki.DEFAULT_UP),this.updateMatrix(),this.target=new Ki,this.shadow=new gL}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}},UA=class extends Hu{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}},e2=class extends Hu{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}},e3=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)}},t2=class extends Hu{constructor(e=new e3,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 n2=class extends qn{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 h_=-90,f_=1,C_=class extends Ki{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new Lr(h_,f_,e,t);r.layers=this.layers,this.add(r);let s=new Lr(h_,f_,e,t);s.layers=this.layers,this.add(s);let o=new Lr(h_,f_,e,t);o.layers=this.layers,this.add(o);let a=new Lr(h_,f_,e,t);a.layers=this.layers,this.add(a);let l=new Lr(h_,f_,e,t);l.layers=this.layers,this.add(l);let c=new Lr(h_,f_,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===_o)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===Xa)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}},R_=class extends Lr{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},kA=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=Uue.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 Uue(){this._document.hidden===!1&&this.reset()}var WL="\\[\\]\\.:\\/",kue=new RegExp("["+WL+"]","g"),jL="[^"+WL+"]",Gue="[^"+WL.replace("\\.","")+"]",zue=/((?:WC+[\/:])*)/.source.replace("WC",jL),Vue=/(WCOD+)?/.source.replace("WCOD",Gue),que=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",jL),Hue=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",jL),Wue=new RegExp("^"+zue+Vue+que+Hue+"$"),jue=["material","materials","bones","map"],_L=class{constructor(e,t,n){let r=n||hr.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()}},hr=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(kue,"")}static parseTrackName(e){let t=Wue.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);jue.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}};hr.Composite=_L;hr.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};hr.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};hr.prototype.GetterByBindingType=[hr.prototype._getValue_direct,hr.prototype._getValue_array,hr.prototype._getValue_arrayElement,hr.prototype._getValue_toArray];hr.prototype.SetterByBindingTypeAndVersioning=[[hr.prototype._setValue_direct,hr.prototype._setValue_direct_setNeedsUpdate,hr.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[hr.prototype._setValue_array,hr.prototype._setValue_array_setNeedsUpdate,hr.prototype._setValue_array_setMatrixWorldNeedsUpdate],[hr.prototype._setValue_arrayElement,hr.prototype._setValue_arrayElement_setNeedsUpdate,hr.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[hr.prototype._setValue_fromArray,hr.prototype._setValue_fromArray_setNeedsUpdate,hr.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var PVe=new Float32Array(1);var Wu=class extends Df{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 hW=new on,i2=class{constructor(e,t,n=0,r=1/0){this.ray=new Ff(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new x_,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 hW.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(hW),this}intersectObject(e,t=!0,n=[]){return xL(e,this,n,t),n.sort(fW),n}intersectObjects(e,t=!0,n=[]){for(let r=0,s=e.length;r<s;r++)xL(e[r],this,n,t);return n.sort(fW),n}};function fW(i,e){return i.distance-e.distance}function xL(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++)xL(s[o],e,t,!0)}}var P_=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=In(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(In(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};var ZL=class ZL{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}};ZL.prototype.isMatrix2=!0;var I_=ZL,dW=new Oe,t3=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=dW.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,dW).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)}},pW=new ie,CT=new ie,d_=new ie,p_=new ie,oL=new ie,Xue=new ie,$ue=new ie,r2=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){pW.subVectors(e,this.start),CT.subVectors(this.end,this.start);let n=CT.dot(CT);if(n===0)return 0;let s=CT.dot(pW)/n;return t&&(s=In(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=Xue,n=$ue){let r=10000000000000001e-32,s,o,a=this.start,l=e.start,c=this.end,u=e.end;d_.subVectors(c,a),p_.subVectors(u,l),oL.subVectors(a,l);let f=d_.dot(d_),p=p_.dot(p_),x=p_.dot(oL);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=In(o,0,1);else{let v=d_.dot(oL);if(p<=r)o=0,s=In(-v/f,0,1);else{let w=d_.dot(p_),S=f*p-w*w;S!==0?s=In((w*x-v*p)/S,0,1):s=0,o=(w*s+x)/p,o<0?(o=0,s=In(-v/f,0,1)):o>1&&(o=1,s=In((w-v)/f,0,1))}}return t.copy(a).addScaledVector(d_,s),n.copy(l).addScaledVector(p_,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 s2=class{constructor(){this.type="ShapePath",this.color=new Ut,this.subPaths=[],this.currentPath=null,this.userData={}}moveTo(e,t){return this.currentPath=new NA,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=jd.area(c);if(u===0)continue;let f=new t3;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 By;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 NA;u.curves=l.subPath.curves,c.holes.push(u)}return o}},Bf=class extends Ho{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 L2(i,e,t,n){let r=Yue(n);switch(t){case N_:return i*e;case Gf:return i*e/r.components*r.byteLength;case Qu:return i*e/r.components*r.byteLength;case Rs:return i*e*2/r.components*r.byteLength;case Ju:return i*e*2/r.components*r.byteLength;case kf:return i*e*3/r.components*r.byteLength;case wr:return i*e*4/r.components*r.byteLength;case hp:return i*e*4/r.components*r.byteLength;case eh:case th:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case nh:case ih:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case jA:case $A:return Math.max(i,16)*Math.max(e,8)/4;case WA:case XA:return Math.max(i,8)*Math.max(e,8)/2;case fp:case dp:case Ap:case mp:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case pp:case rh:case gp:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case _p:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case xp:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case yp:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case vp:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case bp:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case wp:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case Sp:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case Tp:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case Ep:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case Mp:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case Cp:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case Rp:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case Pp:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case Ip:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case Np:case Lp:case Dp:return Math.ceil(i/4)*Math.ceil(e/4)*16;case Fp:case Op:return Math.ceil(i/4)*Math.ceil(e/4)*8;case sh:case Bp:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Yue(i){switch(i){case Vi:case Ku:return{byteLength:1,components:1};case Ka:case Zu:case Fi:return{byteLength:2,components:1};case zA:case VA:return{byteLength:2,components:4};case Ai:case Fr:case Zi:return{byteLength:4,components:1};case qA:case HA: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 QW(){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 Que(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 Jue=`#ifdef USE_ALPHAHASH1414 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;15-#endif`,Kue=`#ifdef USE_ALPHAHASH15+#endif`,ehe=`#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`,Zue=`#ifdef USE_ALPHAMAP50+#endif`,the=`#ifdef USE_ALPHAMAP5151 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;52-#endif`,Que=`#ifdef USE_ALPHAMAP52+#endif`,nhe=`#ifdef USE_ALPHAMAP5353 uniform sampler2D alphaMap;54-#endif`,Jue=`#ifdef USE_ALPHATEST54+#endif`,ihe=`#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`,ehe=`#ifdef USE_ALPHATEST61+#endif`,rhe=`#ifdef USE_ALPHATEST6262 uniform float alphaTest;63-#endif`,the=`#ifdef USE_AOMAP63+#endif`,she=`#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`,nhe=`#ifdef USE_AOMAP76+#endif`,ohe=`#ifdef USE_AOMAP7777 uniform sampler2D aoMap;7878 uniform float aoMapIntensity;79-#endif`,ihe=`#ifdef USE_BATCHING79+#endif`,ahe=`#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`,rhe=`#ifdef USE_BATCHING113+#endif`,lhe=`#ifdef USE_BATCHING114114 mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );115-#endif`,she=`vec3 transformed = vec3( position );115+#endif`,che=`vec3 transformed = vec3( position );116116 #ifdef USE_ALPHAHASH117117 vPosition = vec3( position );118-#endif`,ohe=`vec3 objectNormal = vec3( normal );118+#endif`,uhe=`vec3 objectNormal = vec3( normal );119119 #ifdef USE_TANGENT120120 vec3 objectTangent = vec3( tangent.xyz );121-#endif`,ahe=`float G_BlinnPhong_Implicit( ) {121+#endif`,hhe=`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`,lhe=`#ifdef USE_IRIDESCENCE135+} // validated`,fhe=`#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`,che=`#ifdef USE_BUMPMAP198+#endif`,dhe=`#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`,uhe=`#if NUM_CLIPPING_PLANES > 0219+#endif`,phe=`#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`,hhe=`#if NUM_CLIPPING_PLANES > 0265+#endif`,Ahe=`#if NUM_CLIPPING_PLANES > 0266266 varying vec3 vClipPosition;267267 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];268-#endif`,fhe=`#if NUM_CLIPPING_PLANES > 0268+#endif`,mhe=`#if NUM_CLIPPING_PLANES > 0269269 varying vec3 vClipPosition;270-#endif`,dhe=`#if NUM_CLIPPING_PLANES > 0270+#endif`,ghe=`#if NUM_CLIPPING_PLANES > 0271271 vClipPosition = - mvPosition.xyz;272-#endif`,phe=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )272+#endif`,_he=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )273273 diffuseColor *= vColor;274-#endif`,Ahe=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )274+#endif`,xhe=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )275275 varying vec4 vColor;276-#endif`,mhe=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )276+#endif`,yhe=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )277277 varying vec4 vColor;278-#endif`,ghe=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )278+#endif`,vhe=`#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`,_he=`#define PI 3.141592653589793291+#endif`,bhe=`#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`,xhe=`#ifdef ENVMAP_TYPE_CUBE_UV362+} // validated`,whe=`#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`,yhe=`vec3 transformedNormal = objectNormal;455+#endif`,She=`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`,vhe=`#ifdef USE_DISPLACEMENTMAP481+#endif`,The=`#ifdef USE_DISPLACEMENTMAP482482 uniform sampler2D displacementMap;483483 uniform float displacementScale;484484 uniform float displacementBias;485-#endif`,bhe=`#ifdef USE_DISPLACEMENTMAP485+#endif`,Ehe=`#ifdef USE_DISPLACEMENTMAP486486 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );487-#endif`,whe=`#ifdef USE_EMISSIVEMAP487+#endif`,Mhe=`#ifdef USE_EMISSIVEMAP488488 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );489489 #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE490490 emissiveColor = sRGBTransferEOTF( emissiveColor );491491 #endif492492 totalEmissiveRadiance *= emissiveColor.rgb;493-#endif`,She=`#ifdef USE_EMISSIVEMAP493+#endif`,Che=`#ifdef USE_EMISSIVEMAP494494 uniform sampler2D emissiveMap;495-#endif`,The="gl_FragColor = linearToOutputTexel( gl_FragColor );",Ehe=`vec4 LinearTransferOETF( in vec4 value ) {495+#endif`,Rhe="gl_FragColor = linearToOutputTexel( gl_FragColor );",Phe=`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-}`,Mhe=`#ifdef USE_ENVMAP503+}`,Ihe=`#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`,Che=`#ifdef USE_ENVMAP530+#endif`,Nhe=`#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`,Rhe=`#ifdef USE_ENVMAP538+#endif`,Lhe=`#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`,Phe=`#ifdef USE_ENVMAP549+#endif`,Dhe=`#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`,Ihe=`#ifdef USE_ENVMAP560+#endif`,Fhe=`#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`,Nhe=`#ifdef USE_FOG577+#endif`,Ohe=`#ifdef USE_FOG578578 vFogDepth = - mvPosition.z;579-#endif`,Lhe=`#ifdef USE_FOG579+#endif`,Bhe=`#ifdef USE_FOG580580 varying float vFogDepth;581-#endif`,Dhe=`#ifdef USE_FOG581+#endif`,Uhe=`#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`,Fhe=`#ifdef USE_FOG588+#endif`,khe=`#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`,Ohe=`#ifdef USE_GRADIENTMAP597+#endif`,Ghe=`#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-}`,Bhe=`#ifdef USE_LIGHTMAP609+}`,zhe=`#ifdef USE_LIGHTMAP610610 uniform sampler2D lightMap;611611 uniform float lightMapIntensity;612-#endif`,Uhe=`LambertMaterial material;612+#endif`,Vhe=`LambertMaterial material;613613 material.diffuseColor = diffuseColor.rgb;614-material.specularStrength = specularStrength;`,khe=`varying vec3 vViewPosition;614+material.specularStrength = specularStrength;`,qhe=`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`,Ghe=`uniform bool receiveShadow;628+#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Hhe=`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>`,zhe=`#ifdef USE_ENVMAP745+#include <lightprobes_pars_fragment>`,Whe=`#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`,Vhe=`ToonMaterial material;779-material.diffuseColor = diffuseColor.rgb;`,qhe=`varying vec3 vViewPosition;778+#endif`,jhe=`ToonMaterial material;779+material.diffuseColor = diffuseColor.rgb;`,Xhe=`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`,Hhe=`BlinnPhongMaterial material;791+#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,$he=`BlinnPhongMaterial material;792792 material.diffuseColor = diffuseColor.rgb;793793 material.specularColor = specular;794794 material.specularShininess = shininess;795-material.specularStrength = specularStrength;`,Whe=`varying vec3 vViewPosition;795+material.specularStrength = specularStrength;`,Yhe=`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`,jhe=`PhysicalMaterial material;812+#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Khe=`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`,Xhe=`uniform sampler2D dfgLUT;902+#endif`,Zhe=`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-}`,$he=`1262+}`,Qhe=`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`,Yhe=`#if defined( RE_IndirectDiffuse )1384+#endif`,Jhe=`#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`,Khe=`#if defined( RE_IndirectDiffuse )1405+#endif`,efe=`#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`,Zhe=`#ifdef USE_LIGHT_PROBES_GRID1413+#endif`,tfe=`#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`,Qhe=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )1458+#endif`,nfe=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )14591459 gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;1460-#endif`,Jhe=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )1460+#endif`,ife=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )14611461 uniform float logDepthBufFC;14621462 varying float vFragDepth;14631463 varying float vIsPerspective;1464-#endif`,efe=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER1464+#endif`,rfe=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER14651465 varying float vFragDepth;14661466 varying float vIsPerspective;1467-#endif`,tfe=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER1467+#endif`,sfe=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER14681468 vFragDepth = 1.0 + gl_Position.w;14691469 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );1470-#endif`,nfe=`#ifdef USE_MAP1470+#endif`,ofe=`#ifdef USE_MAP14711471 vec4 sampledDiffuseColor = texture2D( map, vMapUv );14721472 #ifdef DECODE_VIDEO_TEXTURE14731473 sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );14741474 #endif14751475 diffuseColor *= sampledDiffuseColor;1476-#endif`,ife=`#ifdef USE_MAP1476+#endif`,afe=`#ifdef USE_MAP14771477 uniform sampler2D map;1478-#endif`,rfe=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )1478+#endif`,lfe=`#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`,sfe=`#if defined( USE_POINTS_UV )1490+#endif`,cfe=`#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`,ofe=`float metalnessFactor = metalness;1502+#endif`,ufe=`float metalnessFactor = metalness;15031503 #ifdef USE_METALNESSMAP15041504 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );15051505 metalnessFactor *= texelMetalness.b;1506-#endif`,afe=`#ifdef USE_METALNESSMAP1506+#endif`,hfe=`#ifdef USE_METALNESSMAP15071507 uniform sampler2D metalnessMap;1508-#endif`,lfe=`#ifdef USE_INSTANCING_MORPH1508+#endif`,ffe=`#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`,cfe=`#if defined( USE_MORPHCOLORS )1514+#endif`,dfe=`#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`,ufe=`#ifdef USE_MORPHNORMALS1523+#endif`,pfe=`#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`,hfe=`#ifdef USE_MORPHTARGETS1528+#endif`,Afe=`#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`,ffe=`#ifdef USE_MORPHTARGETS1542+#endif`,mfe=`#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`,dfe=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;1547+#endif`,gfe=`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;`,pfe=`#ifdef USE_NORMALMAP_OBJECTSPACE1588+vec3 nonPerturbedNormal = normal;`,_fe=`#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;`,pfe=`#ifdef USE_NORMALMAP_OBJECTSPACE
16031603 normal = normalize( tbn * mapN );16041604 #elif defined( USE_BUMPMAP )16051605 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );1606-#endif`,Afe=`#ifndef FLAT_SHADED1606+#endif`,xfe=`#ifndef FLAT_SHADED16071607 varying vec3 vNormal;16081608 #ifdef USE_TANGENT16091609 varying vec3 vTangent;16101610 varying vec3 vBitangent;16111611 #endif1612-#endif`,mfe=`#ifndef FLAT_SHADED1612+#endif`,yfe=`#ifndef FLAT_SHADED16131613 varying vec3 vNormal;16141614 #ifdef USE_TANGENT16151615 varying vec3 vTangent;16161616 varying vec3 vBitangent;16171617 #endif1618-#endif`,gfe=`#ifndef FLAT_SHADED1618+#endif`,vfe=`#ifndef FLAT_SHADED16191619 vNormal = normalize( transformedNormal );16201620 #ifdef USE_TANGENT16211621 vTangent = normalize( transformedTangent );@@ -1624,7 +1624,7 @@ vec3 nonPerturbedNormal = normal;`,pfe=`#ifdef USE_NORMALMAP_OBJECTSPACE
16241624 vBitangent = - vBitangent;16251625 #endif16261626 #endif1627-#endif`,_fe=`#ifdef USE_NORMALMAP1627+#endif`,bfe=`#ifdef USE_NORMALMAP16281628 uniform sampler2D normalMap;16291629 uniform vec2 normalScale;16301630 #endif@@ -1646,13 +1646,13 @@ vec3 nonPerturbedNormal = normal;`,pfe=`#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`,xfe=`#ifdef USE_CLEARCOAT1649+#endif`,wfe=`#ifdef USE_CLEARCOAT16501650 vec3 clearcoatNormal = nonPerturbedNormal;1651-#endif`,yfe=`#ifdef USE_CLEARCOAT_NORMALMAP1651+#endif`,Sfe=`#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`,vfe=`#ifdef USE_CLEARCOATMAP1655+#endif`,Tfe=`#ifdef USE_CLEARCOATMAP16561656 uniform sampler2D clearcoatMap;16571657 #endif16581658 #ifdef USE_CLEARCOAT_NORMALMAP@@ -1661,18 +1661,18 @@ vec3 nonPerturbedNormal = normal;`,pfe=`#ifdef USE_NORMALMAP_OBJECTSPACE
16611661 #endif16621662 #ifdef USE_CLEARCOAT_ROUGHNESSMAP16631663 uniform sampler2D clearcoatRoughnessMap;1664-#endif`,bfe=`#ifdef USE_IRIDESCENCEMAP1664+#endif`,Efe=`#ifdef USE_IRIDESCENCEMAP16651665 uniform sampler2D iridescenceMap;16661666 #endif16671667 #ifdef USE_IRIDESCENCE_THICKNESSMAP16681668 uniform sampler2D iridescenceThicknessMap;1669-#endif`,wfe=`#ifdef OPAQUE1669+#endif`,Mfe=`#ifdef OPAQUE16701670 diffuseColor.a = 1.0;16711671 #endif16721672 #ifdef USE_TRANSMISSION16731673 diffuseColor.a *= material.transmissionAlpha;16741674 #endif1675-gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Sfe=`vec3 packNormalToRGB( const in vec3 normal ) {1675+gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Cfe=`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-}`,Tfe=`#ifdef PREMULTIPLIED_ALPHA1754+}`,Rfe=`#ifdef PREMULTIPLIED_ALPHA17551755 gl_FragColor.rgb *= gl_FragColor.a;1756-#endif`,Efe=`vec4 mvPosition = vec4( transformed, 1.0 );1756+#endif`,Pfe=`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;`,Mfe=`#ifdef DITHERING1764+gl_Position = projectionMatrix * mvPosition;`,Ife=`#ifdef DITHERING17651765 gl_FragColor.rgb = dithering( gl_FragColor.rgb );1766-#endif`,Cfe=`#ifdef DITHERING1766+#endif`,Nfe=`#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`,Rfe=`float roughnessFactor = roughness;1773+#endif`,Lfe=`float roughnessFactor = roughness;17741774 #ifdef USE_ROUGHNESSMAP17751775 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );17761776 roughnessFactor *= texelRoughness.g;1777-#endif`,Pfe=`#ifdef USE_ROUGHNESSMAP1777+#endif`,Dfe=`#ifdef USE_ROUGHNESSMAP17781778 uniform sampler2D roughnessMap;1779-#endif`,Ife=`#if NUM_SPOT_LIGHT_COORDS > 01779+#endif`,Ffe=`#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;`,Mfe=`#ifdef DITHERING
19761976 }19771977 #endif19781978 #endif1979-#endif`,Nfe=`#if NUM_SPOT_LIGHT_COORDS > 01979+#endif`,Ofe=`#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;`,Mfe=`#ifdef DITHERING
20172017 };20182018 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];20192019 #endif2020-#endif`,Lfe=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )2020+#endif`,Bfe=`#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;`,Mfe=`#ifdef DITHERING
20532053 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;20542054 }20552055 #pragma unroll_loop_end2056-#endif`,Dfe=`float getShadowMask() {2056+#endif`,Ufe=`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;`,Mfe=`#ifdef DITHERING
20852085 #endif20862086 #endif20872087 return shadow;2088-}`,Ffe=`#ifdef USE_SKINNING2088+}`,kfe=`#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`,Ofe=`#ifdef USE_SKINNING2093+#endif`,Gfe=`#ifdef USE_SKINNING20942094 uniform mat4 bindMatrix;20952095 uniform mat4 bindMatrixInverse;20962096 uniform highp sampler2D boneTexture;@@ -2105,7 +2105,7 @@ gl_Position = projectionMatrix * mvPosition;`,Mfe=`#ifdef DITHERING
21052105 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );21062106 return mat4( v1, v2, v3, v4 );21072107 }2108-#endif`,Bfe=`#ifdef USE_SKINNING2108+#endif`,zfe=`#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;`,Mfe=`#ifdef DITHERING
21132113 skinned += boneMatZ * skinVertex * skinWeight.z;21142114 skinned += boneMatW * skinVertex * skinWeight.w;21152115 transformed = ( bindMatrixInverse * skinned ).xyz;2116-#endif`,Ufe=`#ifdef USE_SKINNING2116+#endif`,Vfe=`#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;`,Mfe=`#ifdef DITHERING
21242124 #ifdef USE_TANGENT21252125 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;21262126 #endif2127-#endif`,kfe=`float specularStrength;2127+#endif`,qfe=`float specularStrength;21282128 #ifdef USE_SPECULARMAP21292129 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );21302130 specularStrength = texelSpecular.r;21312131 #else21322132 specularStrength = 1.0;2133-#endif`,Gfe=`#ifdef USE_SPECULARMAP2133+#endif`,Hfe=`#ifdef USE_SPECULARMAP21342134 uniform sampler2D specularMap;2135-#endif`,zfe=`#if defined( TONE_MAPPING )2135+#endif`,Wfe=`#if defined( TONE_MAPPING )21362136 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );2137-#endif`,Vfe=`#ifndef saturate2137+#endif`,jfe=`#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; }`,qfe=`#ifdef USE_TRANSMISSION2234+vec3 CustomToneMapping( vec3 color ) { return color; }`,Xfe=`#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; }`,qfe=`#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`,Hfe=`#ifdef USE_TRANSMISSION2255+#endif`,$fe=`#ifdef USE_TRANSMISSION22562256 uniform float transmission;22572257 uniform float thickness;22582258 uniform float attenuationDistance;@@ -2378,7 +2378,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,qfe=`#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`,Wfe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )2381+#endif`,Yfe=`#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; }`,qfe=`#ifdef USE_TRANSMIS
24482448 #ifdef USE_THICKNESSMAP24492449 uniform mat3 thicknessMapTransform;24502450 varying vec2 vThicknessMapUv;2451-#endif`,jfe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )2451+#endif`,Kfe=`#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; }`,qfe=`#ifdef USE_TRANSMIS
25422542 #ifdef USE_THICKNESSMAP25432543 uniform mat3 thicknessMapTransform;25442544 varying vec2 vThicknessMapUv;2545-#endif`,Xfe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )2545+#endif`,Zfe=`#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; }`,qfe=`#ifdef USE_TRANSMIS
26132613 #endif26142614 #ifdef USE_THICKNESSMAP26152615 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;2616-#endif`,$fe=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 02616+#endif`,Qfe=`#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; }`,qfe=`#ifdef USE_TRANSMIS
26222622 worldPosition = instanceMatrix * worldPosition;26232623 #endif26242624 worldPosition = modelMatrix * worldPosition;2625-#endif`,Yfe=`varying vec2 vUv;2625+#endif`,Jfe=`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-}`,Kfe=`uniform sampler2D t2D;2630+}`,ede=`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-}`,Zfe=`varying vec3 vWorldDirection;2642+}`,tde=`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-}`,Qfe=`#ifdef ENVMAP_TYPE_CUBE2649+}`,nde=`#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-}`,Jfe=`varying vec3 vWorldDirection;2671+}`,ide=`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-}`,ede=`uniform samplerCube tCube;2678+}`,rde=`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-}`,tde=`#include <common>2688+}`,sde=`#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-}`,nde=`#if DEPTH_PACKING == 32002715+}`,ode=`#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-}`,ide=`#define DISTANCE2753+}`,ade=`#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-}`,rde=`#define DISTANCE2780+}`,lde=`#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-}`,sde=`varying vec3 vWorldDirection;2803+}`,cde=`varying vec3 vWorldDirection;28042804 #include <common>28052805 void main() {28062806 vWorldDirection = transformDirection( position, modelMatrix );28072807 #include <begin_vertex>28082808 #include <project_vertex>2809-}`,ode=`uniform sampler2D tEquirect;2809+}`,ude=`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-}`,ade=`uniform float scale;2818+}`,hde=`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-}`,lde=`uniform vec3 diffuse;2840+}`,fde=`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-}`,cde=`#include <common>2868+}`,dde=`#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-}`,ude=`uniform vec3 diffuse;2900+}`,pde=`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-}`,hde=`#define LAMBERT2948+}`,Ade=`#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-}`,fde=`#define LAMBERT2987+}`,mde=`#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-}`,dde=`#define MATCAP3045+}`,gde=`#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-}`,pde=`#define MATCAP3079+}`,_de=`#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-}`,Ade=`#define NORMAL3125+}`,xde=`#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-}`,mde=`#define NORMAL3158+}`,yde=`#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-}`,gde=`#define PHONG3179+}`,vde=`#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-}`,_de=`#define PHONG3218+}`,bde=`#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-}`,xde=`#define STANDARD3278+}`,wde=`#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-}`,yde=`#define STANDARD3321+}`,Sde=`#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-}`,vde=`#define TOON3446+}`,Tde=`#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-}`,bde=`#define TOON3483+}`,Ede=`#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-}`,wde=`uniform float size;3535+}`,Mde=`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-}`,Sde=`uniform vec3 diffuse;3566+}`,Cde=`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-}`,Tde=`#include <common>3591+}`,Rde=`#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-}`,Ede=`uniform vec3 color;3614+}`,Pde=`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-}`,Mde=`uniform float rotation;3630+}`,Ide=`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-}`,Cde=`uniform vec3 diffuse;3654+}`,Nde=`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-}`,On={alphahash_fragment:Yue,alphahash_pars_fragment:Kue,alphamap_fragment:Zue,alphamap_pars_fragment:Que,alphatest_fragment:Jue,alphatest_pars_fragment:ehe,aomap_fragment:the,aomap_pars_fragment:nhe,batching_pars_vertex:ihe,batching_vertex:rhe,begin_vertex:she,beginnormal_vertex:ohe,bsdfs:ahe,iridescence_fragment:lhe,bumpmap_pars_fragment:che,clipping_planes_fragment:uhe,clipping_planes_pars_fragment:hhe,clipping_planes_pars_vertex:fhe,clipping_planes_vertex:dhe,color_fragment:phe,color_pars_fragment:Ahe,color_pars_vertex:mhe,color_vertex:ghe,common:_he,cube_uv_reflection_fragment:xhe,defaultnormal_vertex:yhe,displacementmap_pars_vertex:vhe,displacementmap_vertex:bhe,emissivemap_fragment:whe,emissivemap_pars_fragment:She,colorspace_fragment:The,colorspace_pars_fragment:Ehe,envmap_fragment:Mhe,envmap_common_pars_fragment:Che,envmap_pars_fragment:Rhe,envmap_pars_vertex:Phe,envmap_physical_pars_fragment:zhe,envmap_vertex:Ihe,fog_vertex:Nhe,fog_pars_vertex:Lhe,fog_fragment:Dhe,fog_pars_fragment:Fhe,gradientmap_pars_fragment:Ohe,lightmap_pars_fragment:Bhe,lights_lambert_fragment:Uhe,lights_lambert_pars_fragment:khe,lights_pars_begin:Ghe,lights_toon_fragment:Vhe,lights_toon_pars_fragment:qhe,lights_phong_fragment:Hhe,lights_phong_pars_fragment:Whe,lights_physical_fragment:jhe,lights_physical_pars_fragment:Xhe,lights_fragment_begin:$he,lights_fragment_maps:Yhe,lights_fragment_end:Khe,lightprobes_pars_fragment:Zhe,logdepthbuf_fragment:Qhe,logdepthbuf_pars_fragment:Jhe,logdepthbuf_pars_vertex:efe,logdepthbuf_vertex:tfe,map_fragment:nfe,map_pars_fragment:ife,map_particle_fragment:rfe,map_particle_pars_fragment:sfe,metalnessmap_fragment:ofe,metalnessmap_pars_fragment:afe,morphinstance_vertex:lfe,morphcolor_vertex:cfe,morphnormal_vertex:ufe,morphtarget_pars_vertex:hfe,morphtarget_vertex:ffe,normal_fragment_begin:dfe,normal_fragment_maps:pfe,normal_pars_fragment:Afe,normal_pars_vertex:mfe,normal_vertex:gfe,normalmap_pars_fragment:_fe,clearcoat_normal_fragment_begin:xfe,clearcoat_normal_fragment_maps:yfe,clearcoat_pars_fragment:vfe,iridescence_pars_fragment:bfe,opaque_fragment:wfe,packing:Sfe,premultiplied_alpha_fragment:Tfe,project_vertex:Efe,dithering_fragment:Mfe,dithering_pars_fragment:Cfe,roughnessmap_fragment:Rfe,roughnessmap_pars_fragment:Pfe,shadowmap_pars_fragment:Ife,shadowmap_pars_vertex:Nfe,shadowmap_vertex:Lfe,shadowmask_pars_fragment:Dfe,skinbase_vertex:Ffe,skinning_pars_vertex:Ofe,skinning_vertex:Bfe,skinnormal_vertex:Ufe,specularmap_fragment:kfe,specularmap_pars_fragment:Gfe,tonemapping_fragment:zfe,tonemapping_pars_fragment:Vfe,transmission_fragment:qfe,transmission_pars_fragment:Hfe,uv_pars_fragment:Wfe,uv_pars_vertex:jfe,uv_vertex:Xfe,worldpos_vertex:$fe,background_vert:Yfe,background_frag:Kfe,backgroundCube_vert:Zfe,backgroundCube_frag:Qfe,cube_vert:Jfe,cube_frag:ede,depth_vert:tde,depth_frag:nde,distance_vert:ide,distance_frag:rde,equirect_vert:sde,equirect_frag:ode,linedashed_vert:ade,linedashed_frag:lde,meshbasic_vert:cde,meshbasic_frag:ude,meshlambert_vert:hde,meshlambert_frag:fde,meshmatcap_vert:dde,meshmatcap_frag:pde,meshnormal_vert:Ade,meshnormal_frag:mde,meshphong_vert:gde,meshphong_frag:_de,meshphysical_vert:xde,meshphysical_frag:yde,meshtoon_vert:vde,meshtoon_frag:bde,points_vert:wde,points_frag:Sde,shadow_vert:Tde,shadow_frag:Ede,sprite_vert:Mde,sprite_frag:Cde},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}}},va={basic:{uniforms:jo([Nt.common,Nt.specularmap,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.fog]),vertexShader:On.meshbasic_vert,fragmentShader:On.meshbasic_frag},lambert:{uniforms:jo([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:On.meshlambert_vert,fragmentShader:On.meshlambert_frag},phong:{uniforms:jo([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:On.meshphong_vert,fragmentShader:On.meshphong_frag},standard:{uniforms:jo([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:On.meshphysical_vert,fragmentShader:On.meshphysical_frag},toon:{uniforms:jo([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:On.meshtoon_vert,fragmentShader:On.meshtoon_frag},matcap:{uniforms:jo([Nt.common,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.fog,{matcap:{value:null}}]),vertexShader:On.meshmatcap_vert,fragmentShader:On.meshmatcap_frag},points:{uniforms:jo([Nt.points,Nt.fog]),vertexShader:On.points_vert,fragmentShader:On.points_frag},dashed:{uniforms:jo([Nt.common,Nt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:On.linedashed_vert,fragmentShader:On.linedashed_frag},depth:{uniforms:jo([Nt.common,Nt.displacementmap]),vertexShader:On.depth_vert,fragmentShader:On.depth_frag},normal:{uniforms:jo([Nt.common,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,{opacity:{value:1}}]),vertexShader:On.meshnormal_vert,fragmentShader:On.meshnormal_frag},sprite:{uniforms:jo([Nt.sprite,Nt.fog]),vertexShader:On.sprite_vert,fragmentShader:On.sprite_frag},background:{uniforms:{uvTransform:{value:new Sn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:On.background_vert,fragmentShader:On.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Sn}},vertexShader:On.backgroundCube_vert,fragmentShader:On.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:On.cube_vert,fragmentShader:On.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:On.equirect_vert,fragmentShader:On.equirect_frag},distance:{uniforms:jo([Nt.common,Nt.displacementmap,{referencePosition:{value:new ie},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:On.distance_vert,fragmentShader:On.distance_frag},shadow:{uniforms:jo([Nt.lights,Nt.fog,{color:{value:new Ut(0)},opacity:{value:1}}]),vertexShader:On.shadow_vert,fragmentShader:On.shadow_frag}};va.physical={uniforms:jo([va.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:On.meshphysical_vert,fragmentShader:On.meshphysical_frag};var d3={r:0,b:0,g:0},Rde=new on,ZW=new Sn;ZW.set(-1,0,0,0,1,0,0,0,1);function Pde(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===Yu)?(c===void 0&&(c=new Gn(new Wc(1,1,1),new Kr({name:"BackgroundCubeMaterial",uniforms:ZA(va.backgroundCube.uniforms),vertexShader:va.backgroundCube.vertexShader,fragmentShader:va.backgroundCube.fragmentShader,side:hi,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(Rde.makeRotationFromEuler(R.backgroundRotation)).transpose(),C.isCubeTexture&&C.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(ZW),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 Gn(new DA(2,2),new Kr({name:"BackgroundMaterial",uniforms:ZA(va.background.uniforms),vertexShader:va.background.vertexShader,fragmentShader:va.background.fragmentShader,side:_o,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(d3,qL(i)),t.buffers.color.setClear(d3.r,d3.g,d3.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 Ide(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 be=j[ce],Ie=Z[ce];if(Ie===void 0&&(ce==="instanceMatrix"&&V.instanceMatrix&&(Ie=V.instanceMatrix),ce==="instanceColor"&&V.instanceColor&&(Ie=V.instanceColor)),be===void 0||be.attribute!==Ie||Ie&&be.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 be=Z[ce];be===void 0&&(ce==="instanceMatrix"&&V.instanceMatrix&&(be=V.instanceMatrix),ce==="instanceColor"&&V.instanceColor&&(be=V.instanceColor));let Ie={};Ie.attribute=be,be&&be.data&&(Ie.data=be.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 be=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===Fr;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,be,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,be,Ie*Me,Ie/ce.locationSize*$e*Me,ze)}}else if(ee!==void 0){let be=ee[ae];if(be!==void 0)switch(be.length){case 2:i.vertexAttrib2fv(ce.location,be);break;case 3:i.vertexAttrib3fv(ce.location,be);break;case 4:i.vertexAttrib4fv(ce.location,be);break;default:i.vertexAttrib1fv(ce.location,be)}}}}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 Nde(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 Lde(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!==wr&&n.convert(F)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(F){let N=F===Fi&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(F!==Vi&&n.convert(F)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&F!==Zi&&!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 Dde(i){let e=this,t=null,n=0,r=!1,s=!1,o=new ha,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 Up=4,MW=[.125,.215,.35,.446,.526,.582],JA=20,Fde=256,N2=new jc,CW=new Ut,ZL=null,QL=0,JL=0,eD=!1,Ode=new ie,A3=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=Ode}=s;ZL=this._renderer.getRenderTarget(),QL=this._renderer.getActiveCubeFace(),JL=this._renderer.getActiveMipmapLevel(),eD=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=IW(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=PW(),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(ZL,QL,JL),this._renderer.xr.enabled=eD,e.scissorTest=!1,D_(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===bl||e.mapping===nc?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),ZL=this._renderer.getRenderTarget(),QL=this._renderer.getActiveCubeFace(),JL=this._renderer.getActiveMipmapLevel(),eD=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:bi,minFilter:bi,generateMipmaps:!1,type:Fi,format:wr,colorSpace:Yd,depthBuffer:!1},r=RW(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=RW(e,t,n);let{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=Bde(s)),this._blurMaterial=kde(s,e,t),this._ggxMaterial=Ude(s,e,t)}return r}_compileMaterial(e){let t=new Gn(new qn,e);this._renderer.compile(t,N2)}_sceneToCubeUV(e,t,n,r,s){let l=new Lr(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(CW),f.toneMapping=Vs,f.autoClear=!1,f.state.buffers.depth.getReversed()&&(f.setRenderTarget(r),f.clearDepth(),f.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Gn(new Wc,new Yr({name:"PMREM.Background",side:hi,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(CW),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;D_(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===bl||e.mapping===nc;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=IW()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=PW());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;D_(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,N2)}_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-Up?n-v+Up:0),T=4*(this._cubeSize-w);l.envMap.value=e.texture,l.roughness.value=x,l.mipInt.value=v-t,D_(s,S,T,3*w,2*w),r.setRenderTarget(s),r.render(a,N2),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=v-n,D_(e,S,T,3*w,2*w),r.setRenderTarget(e),r.render(a,N2)}_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*JA-1),w=s/v,S=isFinite(s)?1+Math.floor(u*w):JA;S>JA&&je(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${JA}`);let T=[],P=0;for(let F=0;F<JA;++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-Up?r-R+Up:0),D=4*(this._cubeSize-C);D_(t,L,D,3*C,2*C),l.setRenderTarget(t),l.render(f,N2)}};function Bde(i){let e=[],t=[],n=[],r=i,s=i-Up+1+MW.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-Up?l=MW[o-i+Up-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 qn;L.setAttribute("position",new Di(P,w)),L.setAttribute("uv",new Di(R,S)),L.setAttribute("faceIndex",new Di(C,T)),n.push(new Gn(L,null)),r>Up&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function RW(i,e,t){let n=new pa(i,e,t);return n.texture.mapping=Yu,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function D_(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function Ude(i,e,t){return new Kr({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:Fde,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:_3(),fragmentShader:`3679+}`,On={alphahash_fragment:Jue,alphahash_pars_fragment:ehe,alphamap_fragment:the,alphamap_pars_fragment:nhe,alphatest_fragment:ihe,alphatest_pars_fragment:rhe,aomap_fragment:she,aomap_pars_fragment:ohe,batching_pars_vertex:ahe,batching_vertex:lhe,begin_vertex:che,beginnormal_vertex:uhe,bsdfs:hhe,iridescence_fragment:fhe,bumpmap_pars_fragment:dhe,clipping_planes_fragment:phe,clipping_planes_pars_fragment:Ahe,clipping_planes_pars_vertex:mhe,clipping_planes_vertex:ghe,color_fragment:_he,color_pars_fragment:xhe,color_pars_vertex:yhe,color_vertex:vhe,common:bhe,cube_uv_reflection_fragment:whe,defaultnormal_vertex:She,displacementmap_pars_vertex:The,displacementmap_vertex:Ehe,emissivemap_fragment:Mhe,emissivemap_pars_fragment:Che,colorspace_fragment:Rhe,colorspace_pars_fragment:Phe,envmap_fragment:Ihe,envmap_common_pars_fragment:Nhe,envmap_pars_fragment:Lhe,envmap_pars_vertex:Dhe,envmap_physical_pars_fragment:Whe,envmap_vertex:Fhe,fog_vertex:Ohe,fog_pars_vertex:Bhe,fog_fragment:Uhe,fog_pars_fragment:khe,gradientmap_pars_fragment:Ghe,lightmap_pars_fragment:zhe,lights_lambert_fragment:Vhe,lights_lambert_pars_fragment:qhe,lights_pars_begin:Hhe,lights_toon_fragment:jhe,lights_toon_pars_fragment:Xhe,lights_phong_fragment:$he,lights_phong_pars_fragment:Yhe,lights_physical_fragment:Khe,lights_physical_pars_fragment:Zhe,lights_fragment_begin:Qhe,lights_fragment_maps:Jhe,lights_fragment_end:efe,lightprobes_pars_fragment:tfe,logdepthbuf_fragment:nfe,logdepthbuf_pars_fragment:ife,logdepthbuf_pars_vertex:rfe,logdepthbuf_vertex:sfe,map_fragment:ofe,map_pars_fragment:afe,map_particle_fragment:lfe,map_particle_pars_fragment:cfe,metalnessmap_fragment:ufe,metalnessmap_pars_fragment:hfe,morphinstance_vertex:ffe,morphcolor_vertex:dfe,morphnormal_vertex:pfe,morphtarget_pars_vertex:Afe,morphtarget_vertex:mfe,normal_fragment_begin:gfe,normal_fragment_maps:_fe,normal_pars_fragment:xfe,normal_pars_vertex:yfe,normal_vertex:vfe,normalmap_pars_fragment:bfe,clearcoat_normal_fragment_begin:wfe,clearcoat_normal_fragment_maps:Sfe,clearcoat_pars_fragment:Tfe,iridescence_pars_fragment:Efe,opaque_fragment:Mfe,packing:Cfe,premultiplied_alpha_fragment:Rfe,project_vertex:Pfe,dithering_fragment:Ife,dithering_pars_fragment:Nfe,roughnessmap_fragment:Lfe,roughnessmap_pars_fragment:Dfe,shadowmap_pars_fragment:Ffe,shadowmap_pars_vertex:Ofe,shadowmap_vertex:Bfe,shadowmask_pars_fragment:Ufe,skinbase_vertex:kfe,skinning_pars_vertex:Gfe,skinning_vertex:zfe,skinnormal_vertex:Vfe,specularmap_fragment:qfe,specularmap_pars_fragment:Hfe,tonemapping_fragment:Wfe,tonemapping_pars_fragment:jfe,transmission_fragment:Xfe,transmission_pars_fragment:$fe,uv_pars_fragment:Yfe,uv_pars_vertex:Kfe,uv_vertex:Zfe,worldpos_vertex:Qfe,background_vert:Jfe,background_frag:ede,backgroundCube_vert:tde,backgroundCube_frag:nde,cube_vert:ide,cube_frag:rde,depth_vert:sde,depth_frag:ode,distance_vert:ade,distance_frag:lde,equirect_vert:cde,equirect_frag:ude,linedashed_vert:hde,linedashed_frag:fde,meshbasic_vert:dde,meshbasic_frag:pde,meshlambert_vert:Ade,meshlambert_frag:mde,meshmatcap_vert:gde,meshmatcap_frag:_de,meshnormal_vert:xde,meshnormal_frag:yde,meshphong_vert:vde,meshphong_frag:bde,meshphysical_vert:wde,meshphysical_frag:Sde,meshtoon_vert:Tde,meshtoon_frag:Ede,points_vert:Mde,points_frag:Cde,shadow_vert:Rde,shadow_frag:Pde,sprite_vert:Ide,sprite_frag:Nde},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}}},va={basic:{uniforms:Xo([Nt.common,Nt.specularmap,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.fog]),vertexShader:On.meshbasic_vert,fragmentShader:On.meshbasic_frag},lambert:{uniforms:Xo([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:On.meshlambert_vert,fragmentShader:On.meshlambert_frag},phong:{uniforms:Xo([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:On.meshphong_vert,fragmentShader:On.meshphong_frag},standard:{uniforms:Xo([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:On.meshphysical_vert,fragmentShader:On.meshphysical_frag},toon:{uniforms:Xo([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:On.meshtoon_vert,fragmentShader:On.meshtoon_frag},matcap:{uniforms:Xo([Nt.common,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.fog,{matcap:{value:null}}]),vertexShader:On.meshmatcap_vert,fragmentShader:On.meshmatcap_frag},points:{uniforms:Xo([Nt.points,Nt.fog]),vertexShader:On.points_vert,fragmentShader:On.points_frag},dashed:{uniforms:Xo([Nt.common,Nt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:On.linedashed_vert,fragmentShader:On.linedashed_frag},depth:{uniforms:Xo([Nt.common,Nt.displacementmap]),vertexShader:On.depth_vert,fragmentShader:On.depth_frag},normal:{uniforms:Xo([Nt.common,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,{opacity:{value:1}}]),vertexShader:On.meshnormal_vert,fragmentShader:On.meshnormal_frag},sprite:{uniforms:Xo([Nt.sprite,Nt.fog]),vertexShader:On.sprite_vert,fragmentShader:On.sprite_frag},background:{uniforms:{uvTransform:{value:new Sn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:On.background_vert,fragmentShader:On.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Sn}},vertexShader:On.backgroundCube_vert,fragmentShader:On.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:On.cube_vert,fragmentShader:On.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:On.equirect_vert,fragmentShader:On.equirect_frag},distance:{uniforms:Xo([Nt.common,Nt.displacementmap,{referencePosition:{value:new ie},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:On.distance_vert,fragmentShader:On.distance_frag},shadow:{uniforms:Xo([Nt.lights,Nt.fog,{color:{value:new Ut(0)},opacity:{value:1}}]),vertexShader:On.shadow_vert,fragmentShader:On.shadow_frag}};va.physical={uniforms:Xo([va.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:On.meshphysical_vert,fragmentShader:On.meshphysical_frag};var p3={r:0,b:0,g:0},Lde=new on,JW=new Sn;JW.set(-1,0,0,0,1,0,0,0,1);function Dde(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(R){let P=R.isScene===!0?R.background:null;if(P&&P.isTexture){let C=R.backgroundBlurriness>0;P=e.get(P,C)}return P}function v(R){let P=!1,C=x(R);C===null?S(o,a):C&&C.isColor&&(S(C,1),P=!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||P)&&(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(R,P){let C=x(P);C&&(C.isCubeTexture||C.mapping===Yu)?(c===void 0&&(c=new Gn(new Wc(1,1,1),new Zr({name:"BackgroundCubeMaterial",uniforms:ZA(va.backgroundCube.uniforms),vertexShader:va.backgroundCube.vertexShader,fragmentShader:va.backgroundCube.fragmentShader,side:hi,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=P.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=P.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(Lde.makeRotationFromEuler(P.backgroundRotation)).transpose(),C.isCubeTexture&&C.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(JW),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(),R.unshift(c,c.geometry,c.material,0,0,null)):C&&C.isTexture&&(l===void 0&&(l=new Gn(new DA(2,2),new Zr({name:"BackgroundMaterial",uniforms:ZA(va.background.uniforms),vertexShader:va.background.vertexShader,fragmentShader:va.background.fragmentShader,side:xo,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=P.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(),R.unshift(l,l.geometry,l.material,0,0,null))}function S(R,P){R.getRGB(p3,HL(i)),t.buffers.color.setClear(p3.r,p3.g,p3.b,P,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(R,P=1){o.set(R),a=P,S(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(R){a=R,S(o,a)},render:v,addToRenderList:w,dispose:T}}function Fde(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 be=j[ce],Ie=Z[ce];if(Ie===void 0&&(ce==="instanceMatrix"&&V.instanceMatrix&&(Ie=V.instanceMatrix),ce==="instanceColor"&&V.instanceColor&&(Ie=V.instanceColor)),be===void 0||be.attribute!==Ie||Ie&&be.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 be=Z[ce];be===void 0&&(ce==="instanceMatrix"&&V.instanceMatrix&&(be=V.instanceMatrix),ce==="instanceColor"&&V.instanceColor&&(be=V.instanceColor));let Ie={};Ie.attribute=be,be&&be.data&&(Ie.data=be.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 R(){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 P(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 be=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===Fr;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++)P(ce.location+Ct,Ie/ce.locationSize,mt,be,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++)P(ce.location+$e,Ie/ce.locationSize,mt,be,Ie*Me,Ie/ce.locationSize*$e*Me,ze)}}else if(ee!==void 0){let be=ee[ae];if(be!==void 0)switch(be.length){case 2:i.vertexAttrib2fv(ce.location,be);break;case 3:i.vertexAttrib3fv(ce.location,be);break;case 4:i.vertexAttrib4fv(ce.location,be);break;default:i.vertexAttrib1fv(ce.location,be)}}}}R()}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:R}}function Ode(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 Bde(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!==wr&&n.convert(F)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(F){let N=F===Fi&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(F!==Vi&&n.convert(F)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&F!==Zi&&!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),R=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),P=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:R,maxVaryings:P,maxFragmentUniforms:C,maxSamples:L,samples:D}}function Ude(i){let e=this,t=null,n=0,r=!1,s=!1,o=new ha,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 R=s?0:n,P=R*4,C=T.clippingState||null;l.value=C,C=u(v,p,P,x);for(let L=0;L!==P;++L)C[L]=t[L];T.clippingState=C,this.numIntersection=w?this.numPlanes:0,this.numPlanes+=R}};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,R=p.matrixWorldInverse;a.getNormalMatrix(R),(S===null||S.length<T)&&(S=new Float32Array(T));for(let P=0,C=x;P!==w;++P,C+=4)o.copy(f[P]).applyMatrix4(R,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 Up=4,RW=[.125,.215,.35,.446,.526,.582],JA=20,kde=256,D2=new jc,PW=new Ut,QL=null,JL=0,eD=0,tD=!1,Gde=new ie,m3=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=Gde}=s;QL=this._renderer.getRenderTarget(),JL=this._renderer.getActiveCubeFace(),eD=this._renderer.getActiveMipmapLevel(),tD=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=LW(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=NW(),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(QL,JL,eD),this._renderer.xr.enabled=tD,e.scissorTest=!1,F_(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===bl||e.mapping===nc?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),QL=this._renderer.getRenderTarget(),JL=this._renderer.getActiveCubeFace(),eD=this._renderer.getActiveMipmapLevel(),tD=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:bi,minFilter:bi,generateMipmaps:!1,type:Fi,format:wr,colorSpace:Yd,depthBuffer:!1},r=IW(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=IW(e,t,n);let{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=zde(s)),this._blurMaterial=qde(s,e,t),this._ggxMaterial=Vde(s,e,t)}return r}_compileMaterial(e){let t=new Gn(new qn,e);this._renderer.compile(t,D2)}_sceneToCubeUV(e,t,n,r,s){let l=new Lr(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(PW),f.toneMapping=Vs,f.autoClear=!1,f.state.buffers.depth.getReversed()&&(f.setRenderTarget(r),f.clearDepth(),f.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Gn(new Wc,new Kr({name:"PMREM.Background",side:hi,depthWrite:!1,depthTest:!1})));let w=this._backgroundBox,S=w.material,T=!1,R=e.background;R?R.isColor&&(S.color.copy(R),e.background=null,T=!0):(S.color.copy(PW),T=!0);for(let P=0;P<6;P++){let C=P%3;C===0?(l.up.set(0,c[P],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+u[P],s.y,s.z)):C===1?(l.up.set(0,0,c[P]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+u[P],s.z)):(l.up.set(0,c[P],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+u[P]));let L=this._cubeSize;F_(r,C*L,P>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=R}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===bl||e.mapping===nc;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=LW()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=NW());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;F_(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,D2)}_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-Up?n-v+Up:0),T=4*(this._cubeSize-w);l.envMap.value=e.texture,l.roughness.value=x,l.mipInt.value=v-t,F_(s,S,T,3*w,2*w),r.setRenderTarget(s),r.render(a,D2),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=v-n,F_(e,S,T,3*w,2*w),r.setRenderTarget(e),r.render(a,D2)}_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*JA-1),w=s/v,S=isFinite(s)?1+Math.floor(u*w):JA;S>JA&&je(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${JA}`);let T=[],R=0;for(let F=0;F<JA;++F){let N=F/w,B=Math.exp(-N*N/2);T.push(B),F===0?R+=B:F<S&&(R+=2*B)}for(let F=0;F<T.length;F++)T[F]=T[F]/R;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:P}=this;p.dTheta.value=v,p.mipInt.value=P-n;let C=this._sizeLods[r],L=3*C*(r>P-Up?r-P+Up:0),D=4*(this._cubeSize-C);F_(t,L,D,3*C,2*C),l.setRenderTarget(t),l.render(f,D2)}};function zde(i){let e=[],t=[],n=[],r=i,s=i-Up+1+RW.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-Up?l=RW[o-i+Up-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,R=new Float32Array(w*v*x),P=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];R.set(B,w*v*D),P.set(p,S*v*D);let z=[D,D,D,D,D,D];C.set(z,T*v*D)}let L=new qn;L.setAttribute("position",new Di(R,w)),L.setAttribute("uv",new Di(P,S)),L.setAttribute("faceIndex",new Di(C,T)),n.push(new Gn(L,null)),r>Up&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function IW(i,e,t){let n=new pa(i,e,t);return n.texture.mapping=Yu,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function F_(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function Vde(i,e,t){return new Zr({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:kde,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:x3(),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:Zr,depthTest:!1,depthWrite:!1})}function kde(i,e,t){let n=new Float32Array(JA),r=new ie(0,1,0);return new Kr({name:"SphericalGaussianBlur",defines:{n:JA,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:_3(),fragmentShader:`3783+ `,blending:Qr,depthTest:!1,depthWrite:!1})}function qde(i,e,t){let n=new Float32Array(JA),r=new ie(0,1,0);return new Zr({name:"SphericalGaussianBlur",defines:{n:JA,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:x3(),fragmentShader:`37843784 37853785 precision mediump float;37863786 precision mediump int;@@ -3840,7 +3840,7 @@ void main() {
38403840 }38413841 38423842 }3843- `,blending:Zr,depthTest:!1,depthWrite:!1})}function PW(){return new Kr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:_3(),fragmentShader:`3843+ `,blending:Qr,depthTest:!1,depthWrite:!1})}function NW(){return new Zr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:x3(),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:Zr,depthTest:!1,depthWrite:!1})}function IW(){return new Kr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:_3(),fragmentShader:`3862+ `,blending:Qr,depthTest:!1,depthWrite:!1})}function LW(){return new Zr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:x3(),fragmentShader:`38633863 38643864 precision mediump float;38653865 precision mediump int;@@ -3875,7 +3875,7 @@ void main() {
38753875 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );38763876 38773877 }3878- `,blending:Zr,depthTest:!1,depthWrite:!1})}function _3(){return`3878+ `,blending:Qr,depthTest:!1,depthWrite:!1})}function x3(){return`38793879 38803880 precision mediump float;38813881 precision mediump int;@@ -3930,7 +3930,7 @@ void main() {
39303930 gl_Position = vec4( position, 1.0 );39313931 39323932 }3933- `}var m3=class extends pa{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 qu(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 g3=class extends pa{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 qu(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 Wc(5,5,5),s=new Kr({name:"CubemapFromEquirect",uniforms:ZA(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:hi,blending:Zr});s.uniforms.tEquirect.value=t;let o=new Gn(r,s),a=t.minFilter;return t.minFilter===yo&&(t.minFilter=bi),new M_(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 Gde(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===lp||x===cp)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 m3(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===lp||x===cp,w=x===bl||x===nc;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 A3(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 A3(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===lp?p.mapping=bl:x===cp&&(p.mapping=nc),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 zde(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&&Qn("WebGLRenderer: "+n+" extension not supported."),r}}}function Vde(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?MA:EA)(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 qde(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 Hde(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 Wde(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 TA(D,C,L,f);F.type=Zi,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 jde(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 Xde={[m2]:"LINEAR_TONE_MAPPING",[g2]:"REINHARD_TONE_MAPPING",[_2]:"CINEON_TONE_MAPPING",[x2]:"ACES_FILMIC_TONE_MAPPING",[y2]:"AGX_TONE_MAPPING",[v2]:"NEUTRAL_TONE_MAPPING",[yL]:"CUSTOM_TONE_MAPPING"};function $de(i,e,t,n,r,s){let o=new pa(e,t,{type:i,depthBuffer:r,stencilBuffer:s,samples:n?4:0,depthTexture:r?new us(e,t):void 0}),a=new pa(e,t,{type:Fi,depthBuffer:!1,stencilBuffer:!1}),l=new qn;l.setAttribute("position",new Rn([-1,3,0,-1,-1,0,3,-1,0],3)),l.setAttribute("uv",new Rn([0,2,0,0,2,0],2));let c=new GT({uniforms:{tDiffuse:{value:null}},vertexShader:`3968+ `},r=new Wc(5,5,5),s=new Zr({name:"CubemapFromEquirect",uniforms:ZA(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:hi,blending:Qr});s.uniforms.tEquirect.value=t;let o=new Gn(r,s),a=t.minFilter;return t.minFilter===vo&&(t.minFilter=bi),new C_(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 Hde(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===lp||x===cp)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 g3(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===lp||x===cp,w=x===bl||x===nc;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 m3(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 R=p.image;return v&&R&&R.height>0||w&&R&&l(R)?(n===null&&(n=new m3(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===lp?p.mapping=bl:x===cp&&(p.mapping=nc),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 Wde(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&&Qn("WebGLRenderer: "+n+" extension not supported."),r}}}function jde(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 R=x.array;w=x.version;for(let P=0,C=R.length;P<C;P+=3){let L=R[P+0],D=R[P+1],F=R[P+2];p.push(L,D,D,F,F,L)}}else{let R=v.array;w=v.version;for(let P=0,C=R.length/3-1;P<C;P+=3){let L=P+0,D=P+1,F=P+2;p.push(L,D,D,F,F,L)}}let S=new(v.count>=65535?MA:EA)(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 Xde(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 $de(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 Yde(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||[],R=a.morphAttributes.color||[],P=0;x===!0&&(P=1),v===!0&&(P=2),w===!0&&(P=3);let C=a.attributes.position.count*P,L=1;C>e.maxTextureSize&&(L=Math.ceil(C/e.maxTextureSize),C=e.maxTextureSize);let D=new Float32Array(C*L*4*f),F=new TA(D,C,L,f);F.type=Zi,F.needsUpdate=!0;let N=P*4;for(let z=0;z<f;z++){let V=S[z],H=T[z],K=R[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 Kde(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 Zde={[_2]:"LINEAR_TONE_MAPPING",[x2]:"REINHARD_TONE_MAPPING",[y2]:"CINEON_TONE_MAPPING",[v2]:"ACES_FILMIC_TONE_MAPPING",[b2]:"AGX_TONE_MAPPING",[w2]:"NEUTRAL_TONE_MAPPING",[vL]:"CUSTOM_TONE_MAPPING"};function Qde(i,e,t,n,r,s){let o=new pa(e,t,{type:i,depthBuffer:r,stencilBuffer:s,samples:n?4:0,depthTexture:r?new us(e,t):void 0}),a=new pa(e,t,{type:Fi,depthBuffer:!1,stencilBuffer:!1}),l=new qn;l.setAttribute("position",new Rn([-1,3,0,-1,-1,0,3,-1,0],3)),l.setAttribute("uv",new Rn([0,2,0,0,2,0],2));let c=new zT({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 Gn(l,c),f=new jc(-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===Vs&&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=Vs,!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=Xde[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 QW=new Ms,iD=new us(1,1),JW=new TA,ej=new NT,tj=new qu,NW=[],LW=[],DW=new Float32Array(16),FW=new Float32Array(9),OW=new Float32Array(4);function O_(i,e,t){let n=i[0];if(n<=0||n>0)return i;let r=e*t,s=NW[r];if(s===void 0&&(s=new Float32Array(r),NW[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 qs(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 Hs(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function x3(i,e){let t=LW[e];t===void 0&&(t=new Int32Array(e),LW[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function Yde(i,e){let t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function Kde(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(qs(t,e))return;i.uniform2fv(this.addr,e),Hs(t,e)}}function Zde(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(qs(t,e))return;i.uniform3fv(this.addr,e),Hs(t,e)}}function Qde(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(qs(t,e))return;i.uniform4fv(this.addr,e),Hs(t,e)}}function Jde(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(qs(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),Hs(t,e)}else{if(qs(t,n))return;OW.set(n),i.uniformMatrix2fv(this.addr,!1,OW),Hs(t,n)}}function epe(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(qs(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),Hs(t,e)}else{if(qs(t,n))return;FW.set(n),i.uniformMatrix3fv(this.addr,!1,FW),Hs(t,n)}}function tpe(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(qs(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),Hs(t,e)}else{if(qs(t,n))return;DW.set(n),i.uniformMatrix4fv(this.addr,!1,DW),Hs(t,n)}}function npe(i,e){let t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function ipe(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(qs(t,e))return;i.uniform2iv(this.addr,e),Hs(t,e)}}function rpe(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(qs(t,e))return;i.uniform3iv(this.addr,e),Hs(t,e)}}function spe(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(qs(t,e))return;i.uniform4iv(this.addr,e),Hs(t,e)}}function ope(i,e){let t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function ape(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(qs(t,e))return;i.uniform2uiv(this.addr,e),Hs(t,e)}}function lpe(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(qs(t,e))return;i.uniform3uiv(this.addr,e),Hs(t,e)}}function cpe(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(qs(t,e))return;i.uniform4uiv(this.addr,e),Hs(t,e)}}function upe(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?(iD.compareFunction=t.isReversedDepthBuffer()?$c:oh,s=iD):s=QW,t.setTexture2D(e||s,r)}function hpe(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||ej,r)}function fpe(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||tj,r)}function dpe(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||JW,r)}function ppe(i){switch(i){case 5126:return Yde;case 35664:return Kde;case 35665:return Zde;case 35666:return Qde;case 35674:return Jde;case 35675:return epe;case 35676:return tpe;case 5124:case 35670:return npe;case 35667:case 35671:return ipe;case 35668:case 35672:return rpe;case 35669:case 35673:return spe;case 5125:return ope;case 36294:return ape;case 36295:return lpe;case 36296:return cpe;case 35678:case 36198:case 36298:case 36306:case 35682:return upe;case 35679:case 36299:case 36307:return hpe;case 35680:case 36300:case 36308:case 36293:return fpe;case 36289:case 36303:case 36311:case 36292:return dpe}}function Ape(i,e){i.uniform1fv(this.addr,e)}function mpe(i,e){let t=O_(e,this.size,2);i.uniform2fv(this.addr,t)}function gpe(i,e){let t=O_(e,this.size,3);i.uniform3fv(this.addr,t)}function _pe(i,e){let t=O_(e,this.size,4);i.uniform4fv(this.addr,t)}function xpe(i,e){let t=O_(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function ype(i,e){let t=O_(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function vpe(i,e){let t=O_(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function bpe(i,e){i.uniform1iv(this.addr,e)}function wpe(i,e){i.uniform2iv(this.addr,e)}function Spe(i,e){i.uniform3iv(this.addr,e)}function Tpe(i,e){i.uniform4iv(this.addr,e)}function Epe(i,e){i.uniform1uiv(this.addr,e)}function Mpe(i,e){i.uniform2uiv(this.addr,e)}function Cpe(i,e){i.uniform3uiv(this.addr,e)}function Rpe(i,e){i.uniform4uiv(this.addr,e)}function Ppe(i,e,t){let n=this.cache,r=e.length,s=x3(t,r);qs(n,s)||(i.uniform1iv(this.addr,s),Hs(n,s));let o;this.type===i.SAMPLER_2D_SHADOW?o=iD:o=QW;for(let a=0;a!==r;++a)t.setTexture2D(e[a]||o,s[a])}function Ipe(i,e,t){let n=this.cache,r=e.length,s=x3(t,r);qs(n,s)||(i.uniform1iv(this.addr,s),Hs(n,s));for(let o=0;o!==r;++o)t.setTexture3D(e[o]||ej,s[o])}function Npe(i,e,t){let n=this.cache,r=e.length,s=x3(t,r);qs(n,s)||(i.uniform1iv(this.addr,s),Hs(n,s));for(let o=0;o!==r;++o)t.setTextureCube(e[o]||tj,s[o])}function Lpe(i,e,t){let n=this.cache,r=e.length,s=x3(t,r);qs(n,s)||(i.uniform1iv(this.addr,s),Hs(n,s));for(let o=0;o!==r;++o)t.setTexture2DArray(e[o]||JW,s[o])}function Dpe(i){switch(i){case 5126:return Ape;case 35664:return mpe;case 35665:return gpe;case 35666:return _pe;case 35674:return xpe;case 35675:return ype;case 35676:return vpe;case 5124:case 35670:return bpe;case 35667:case 35671:return wpe;case 35668:case 35672:return Spe;case 35669:case 35673:return Tpe;case 5125:return Epe;case 36294:return Mpe;case 36295:return Cpe;case 36296:return Rpe;case 35678:case 36198:case 36298:case 36306:case 35682:return Ppe;case 35679:case 36299:case 36307:return Ipe;case 35680:case 36300:case 36308:case 36293:return Npe;case 36289:case 36303:case 36311:case 36292:return Lpe}}var rD=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=ppe(t.type)}},sD=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=Dpe(t.type)}},oD=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)}}},tD=/(\w+)(\])?(\[|\.)?/g;function BW(i,e){i.seq.push(e),i.map[e.id]=e}function Fpe(i,e,t){let n=i.name,r=n.length;for(tD.lastIndex=0;;){let s=tD.exec(n),o=tD.lastIndex,a=s[1],l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===r){BW(t,c===void 0?new rD(a,i,e):new sD(a,i,e));break}else{let f=t.map[a];f===void 0&&(f=new oD(a),BW(t,f)),t=f}}}var F_=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);Fpe(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 UW(i,e,t){let n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}var Ope=37297,Bpe=0;function Upe(i,e){let t=i.split(`4014+ }`,depthTest:!1,depthWrite:!1}),u=new Gn(l,c),f=new jc(-1,1,1,-1,0,1),p=null,x=null,v=!1,w,S=null,T=[],R=!1;this.setSize=function(P,C){o.setSize(P,C),a.setSize(P,C);for(let L=0;L<T.length;L++){let D=T[L];D.setSize&&D.setSize(P,C)}},this.setEffects=function(P){T=P,R=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(P,C){if(v||P.toneMapping===Vs&&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 R===!1&&P.setRenderTarget(o),w=P.toneMapping,P.toneMapping=Vs,!0},this.hasRenderPass=function(){return R},this.end=function(P,C){P.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(P,D,L,C),N.needsSwap!==!1)){let B=L;L=D,D=B}}if(p!==P.outputColorSpace||x!==P.toneMapping){p=P.outputColorSpace,x=P.toneMapping,c.defines={},sn.getTransfer(p)===Bt&&(c.defines.SRGB_TRANSFER="");let F=Zde[x];F&&(c.defines[F]=""),c.needsUpdate=!0}c.uniforms.tDiffuse.value=L.texture,P.setRenderTarget(S),P.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 ej=new Ms,rD=new us(1,1),tj=new TA,nj=new LT,ij=new qu,DW=[],FW=[],OW=new Float32Array(16),BW=new Float32Array(9),UW=new Float32Array(4);function B_(i,e,t){let n=i[0];if(n<=0||n>0)return i;let r=e*t,s=DW[r];if(s===void 0&&(s=new Float32Array(r),DW[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 qs(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 Hs(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function y3(i,e){let t=FW[e];t===void 0&&(t=new Int32Array(e),FW[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function Jde(i,e){let t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function epe(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(qs(t,e))return;i.uniform2fv(this.addr,e),Hs(t,e)}}function tpe(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(qs(t,e))return;i.uniform3fv(this.addr,e),Hs(t,e)}}function npe(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(qs(t,e))return;i.uniform4fv(this.addr,e),Hs(t,e)}}function ipe(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(qs(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),Hs(t,e)}else{if(qs(t,n))return;UW.set(n),i.uniformMatrix2fv(this.addr,!1,UW),Hs(t,n)}}function rpe(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(qs(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),Hs(t,e)}else{if(qs(t,n))return;BW.set(n),i.uniformMatrix3fv(this.addr,!1,BW),Hs(t,n)}}function spe(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(qs(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),Hs(t,e)}else{if(qs(t,n))return;OW.set(n),i.uniformMatrix4fv(this.addr,!1,OW),Hs(t,n)}}function ope(i,e){let t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function ape(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(qs(t,e))return;i.uniform2iv(this.addr,e),Hs(t,e)}}function lpe(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(qs(t,e))return;i.uniform3iv(this.addr,e),Hs(t,e)}}function cpe(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(qs(t,e))return;i.uniform4iv(this.addr,e),Hs(t,e)}}function upe(i,e){let t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function hpe(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(qs(t,e))return;i.uniform2uiv(this.addr,e),Hs(t,e)}}function fpe(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(qs(t,e))return;i.uniform3uiv(this.addr,e),Hs(t,e)}}function dpe(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(qs(t,e))return;i.uniform4uiv(this.addr,e),Hs(t,e)}}function ppe(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?(rD.compareFunction=t.isReversedDepthBuffer()?$c:oh,s=rD):s=ej,t.setTexture2D(e||s,r)}function Ape(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||nj,r)}function mpe(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||ij,r)}function gpe(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||tj,r)}function _pe(i){switch(i){case 5126:return Jde;case 35664:return epe;case 35665:return tpe;case 35666:return npe;case 35674:return ipe;case 35675:return rpe;case 35676:return spe;case 5124:case 35670:return ope;case 35667:case 35671:return ape;case 35668:case 35672:return lpe;case 35669:case 35673:return cpe;case 5125:return upe;case 36294:return hpe;case 36295:return fpe;case 36296:return dpe;case 35678:case 36198:case 36298:case 36306:case 35682:return ppe;case 35679:case 36299:case 36307:return Ape;case 35680:case 36300:case 36308:case 36293:return mpe;case 36289:case 36303:case 36311:case 36292:return gpe}}function xpe(i,e){i.uniform1fv(this.addr,e)}function ype(i,e){let t=B_(e,this.size,2);i.uniform2fv(this.addr,t)}function vpe(i,e){let t=B_(e,this.size,3);i.uniform3fv(this.addr,t)}function bpe(i,e){let t=B_(e,this.size,4);i.uniform4fv(this.addr,t)}function wpe(i,e){let t=B_(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function Spe(i,e){let t=B_(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function Tpe(i,e){let t=B_(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function Epe(i,e){i.uniform1iv(this.addr,e)}function Mpe(i,e){i.uniform2iv(this.addr,e)}function Cpe(i,e){i.uniform3iv(this.addr,e)}function Rpe(i,e){i.uniform4iv(this.addr,e)}function Ppe(i,e){i.uniform1uiv(this.addr,e)}function Ipe(i,e){i.uniform2uiv(this.addr,e)}function Npe(i,e){i.uniform3uiv(this.addr,e)}function Lpe(i,e){i.uniform4uiv(this.addr,e)}function Dpe(i,e,t){let n=this.cache,r=e.length,s=y3(t,r);qs(n,s)||(i.uniform1iv(this.addr,s),Hs(n,s));let o;this.type===i.SAMPLER_2D_SHADOW?o=rD:o=ej;for(let a=0;a!==r;++a)t.setTexture2D(e[a]||o,s[a])}function Fpe(i,e,t){let n=this.cache,r=e.length,s=y3(t,r);qs(n,s)||(i.uniform1iv(this.addr,s),Hs(n,s));for(let o=0;o!==r;++o)t.setTexture3D(e[o]||nj,s[o])}function Ope(i,e,t){let n=this.cache,r=e.length,s=y3(t,r);qs(n,s)||(i.uniform1iv(this.addr,s),Hs(n,s));for(let o=0;o!==r;++o)t.setTextureCube(e[o]||ij,s[o])}function Bpe(i,e,t){let n=this.cache,r=e.length,s=y3(t,r);qs(n,s)||(i.uniform1iv(this.addr,s),Hs(n,s));for(let o=0;o!==r;++o)t.setTexture2DArray(e[o]||tj,s[o])}function Upe(i){switch(i){case 5126:return xpe;case 35664:return ype;case 35665:return vpe;case 35666:return bpe;case 35674:return wpe;case 35675:return Spe;case 35676:return Tpe;case 5124:case 35670:return Epe;case 35667:case 35671:return Mpe;case 35668:case 35672:return Cpe;case 35669:case 35673:return Rpe;case 5125:return Ppe;case 36294:return Ipe;case 36295:return Npe;case 36296:return Lpe;case 35678:case 36198:case 36298:case 36306:case 35682:return Dpe;case 35679:case 36299:case 36307:return Fpe;case 35680:case 36300:case 36308:case 36293:return Ope;case 36289:case 36303:case 36311:case 36292:return Bpe}}var sD=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=_pe(t.type)}},oD=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=Upe(t.type)}},aD=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)}}},nD=/(\w+)(\])?(\[|\.)?/g;function kW(i,e){i.seq.push(e),i.map[e.id]=e}function kpe(i,e,t){let n=i.name,r=n.length;for(nD.lastIndex=0;;){let s=nD.exec(n),o=nD.lastIndex,a=s[1],l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===r){kW(t,c===void 0?new sD(a,i,e):new oD(a,i,e));break}else{let f=t.map[a];f===void 0&&(f=new aD(a),kW(t,f)),t=f}}}var O_=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);kpe(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 GW(i,e,t){let n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}var Gpe=37297,zpe=0;function Vpe(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 kW=new Sn;function kpe(i){sn._getMatrix(kW,sn.workingColorSpace,i);let e=`mat3( ${kW.elements.map(t=>t.toFixed(4))} )`;switch(sn.getTransfer(i)){case Kd:return[e,"LinearTransferOETF"];case Bt:return[e,"sRGBTransferOETF"];default:return je("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function GW(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 zW=new Sn;function qpe(i){sn._getMatrix(zW,sn.workingColorSpace,i);let e=`mat3( ${zW.elements.map(t=>t.toFixed(4))} )`;switch(sn.getTransfer(i)){case Kd:return[e,"LinearTransferOETF"];case Bt:return[e,"sRGBTransferOETF"];default:return je("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function VW(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-`+Upe(i.getShaderSource(e),a)}else return s}function Gpe(i,e){let t=kpe(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`4021-`)}var zpe={[m2]:"Linear",[g2]:"Reinhard",[_2]:"Cineon",[x2]:"ACESFilmic",[y2]:"AgX",[v2]:"Neutral",[yL]:"Custom"};function Vpe(i,e){let t=zpe[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 p3=new ie;function qpe(){sn.getLuminanceCoefficients(p3);let i=p3.x.toFixed(4),e=p3.y.toFixed(4),t=p3.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`4022-`)}function Hpe(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(D2).join(`4023-`)}function Wpe(i){let e=[];for(let t in i){let n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`4024-`)}function jpe(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 D2(i){return i!==""}function zW(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 VW(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var Xpe=/^[ \t]*#include +<([\w\d./]+)>/gm;function aD(i){return i.replace(Xpe,Ype)}var $pe=new Map;function Ype(i,e){let t=On[e];if(t===void 0){let n=$pe.get(e);if(n!==void 0)t=On[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 aD(t)}var Kpe=/#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 qW(i){return i.replace(Kpe,Zpe)}function Zpe(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 HW(i){let e=`precision ${i.precision} float;4020+`+Vpe(i.getShaderSource(e),a)}else return s}function Hpe(i,e){let t=qpe(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`4021+`)}var Wpe={[_2]:"Linear",[x2]:"Reinhard",[y2]:"Cineon",[v2]:"ACESFilmic",[b2]:"AgX",[w2]:"Neutral",[vL]:"Custom"};function jpe(i,e){let t=Wpe[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 A3=new ie;function Xpe(){sn.getLuminanceCoefficients(A3);let i=A3.x.toFixed(4),e=A3.y.toFixed(4),t=A3.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`4022+`)}function $pe(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(O2).join(`4023+`)}function Ype(i){let e=[];for(let t in i){let n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`4024+`)}function Kpe(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 O2(i){return i!==""}function qW(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 HW(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var Zpe=/^[ \t]*#include +<([\w\d./]+)>/gm;function lD(i){return i.replace(Zpe,Jpe)}var Qpe=new Map;function Jpe(i,e){let t=On[e];if(t===void 0){let n=Qpe.get(e);if(n!==void 0)t=On[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 lD(t)}var e0e=/#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 WW(i){return i.replace(e0e,t0e)}function t0e(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 jW(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 Qpe={[ap]:"SHADOWMAP_TYPE_PCF",[tc]:"SHADOWMAP_TYPE_VSM"};function Jpe(i){return Qpe[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var e0e={[bl]:"ENVMAP_TYPE_CUBE",[nc]:"ENVMAP_TYPE_CUBE",[Yu]:"ENVMAP_TYPE_CUBE_UV"};function t0e(i){return i.envMap===!1?"ENVMAP_TYPE_CUBE":e0e[i.envMapMode]||"ENVMAP_TYPE_CUBE"}var n0e={[nc]:"ENVMAP_MODE_REFRACTION"};function i0e(i){return i.envMap===!1?"ENVMAP_MODE_REFLECTION":n0e[i.envMapMode]||"ENVMAP_MODE_REFLECTION"}var r0e={[GA]:"ENVMAP_BLENDING_MULTIPLY",[a3]:"ENVMAP_BLENDING_MIX",[l3]:"ENVMAP_BLENDING_ADD"};function s0e(i){return i.envMap===!1?"ENVMAP_BLENDING_NONE":r0e[i.combine]||"ENVMAP_BLENDING_NONE"}function o0e(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 a0e(i,e,t,n){let r=i.getContext(),s=t.defines,o=t.vertexShader,a=t.fragmentShader,l=Jpe(t),c=t0e(t),u=i0e(t),f=s0e(t),p=o0e(t),x=Hpe(t),v=Wpe(s),w=r.createProgram(),S,T,P=t.glslVersion?"#version "+t.glslVersion+`4045-`:"";t.isRawShaderMaterial?(S=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(D2).join(`4044+#define LOW_PRECISION`),e}var n0e={[ap]:"SHADOWMAP_TYPE_PCF",[tc]:"SHADOWMAP_TYPE_VSM"};function i0e(i){return n0e[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var r0e={[bl]:"ENVMAP_TYPE_CUBE",[nc]:"ENVMAP_TYPE_CUBE",[Yu]:"ENVMAP_TYPE_CUBE_UV"};function s0e(i){return i.envMap===!1?"ENVMAP_TYPE_CUBE":r0e[i.envMapMode]||"ENVMAP_TYPE_CUBE"}var o0e={[nc]:"ENVMAP_MODE_REFRACTION"};function a0e(i){return i.envMap===!1?"ENVMAP_MODE_REFLECTION":o0e[i.envMapMode]||"ENVMAP_MODE_REFLECTION"}var l0e={[GA]:"ENVMAP_BLENDING_MULTIPLY",[l3]:"ENVMAP_BLENDING_MIX",[c3]:"ENVMAP_BLENDING_ADD"};function c0e(i){return i.envMap===!1?"ENVMAP_BLENDING_NONE":l0e[i.combine]||"ENVMAP_BLENDING_NONE"}function u0e(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 h0e(i,e,t,n){let r=i.getContext(),s=t.defines,o=t.vertexShader,a=t.fragmentShader,l=i0e(t),c=s0e(t),u=a0e(t),f=c0e(t),p=u0e(t),x=$pe(t),v=Ype(s),w=r.createProgram(),S,T,R=t.glslVersion?"#version "+t.glslVersion+`4045+`:"";t.isRawShaderMaterial?(S=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(O2).join(`40464046 `),S.length>0&&(S+=`4047-`),T=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(D2).join(`4047+`),T=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(O2).join(`40484048 `),T.length>0&&(T+=`4049-`)):(S=[HW(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",`4050-`].filter(D2).join(`4051-`),T=[HW(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!==Vs?"#define TONE_MAPPING":"",t.toneMapping!==Vs?On.tonemapping_pars_fragment:"",t.toneMapping!==Vs?Vpe("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",On.colorspace_pars_fragment,Gpe("linearToOutputTexel",t.outputColorSpace),qpe(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`4052-`].filter(D2).join(`4053-`)),o=aD(o),o=zW(o,t),o=VW(o,t),a=aD(a),a=zW(a,t),a=VW(a,t),o=qW(o),a=qW(a),t.isRawShaderMaterial!==!0&&(P=`#version 300 es4049+`)):(S=[jW(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",`4050+`].filter(O2).join(`4051+`),T=[jW(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!==Vs?"#define TONE_MAPPING":"",t.toneMapping!==Vs?On.tonemapping_pars_fragment:"",t.toneMapping!==Vs?jpe("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",On.colorspace_pars_fragment,Hpe("linearToOutputTexel",t.outputColorSpace),Xpe(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`4052+`].filter(O2).join(`4053+`)),o=lD(o),o=qW(o,t),o=HW(o,t),a=lD(a),a=qW(a,t),a=HW(a,t),o=WW(o),a=WW(a),t.isRawShaderMaterial!==!0&&(R=`#version 300 es40544054 `,S=[x,"#define attribute in","#define varying out","#define texture2D texture"].join(`40554055 `)+`4056-`+S,T=["#define varying in",t.glslVersion===kL?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===kL?"":"#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===GL?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===GL?"":"#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=UW(r,r.VERTEX_SHADER,R),D=UW(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=GW(r,L,"vertex"),be=GW(r,D,"fragment");Ge("WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(w,r.VALIDATE_STATUS)+`4058+`+T);let P=R+S+o,C=R+T+a,L=GW(r,r.VERTEX_SHADER,P),D=GW(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=VW(r,L,"vertex"),be=VW(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-`+be)}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 F_(r,w),B=jpe(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,Ope)),z},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(w),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Bpe++,this.cacheKey=e,this.usedTimes=1,this.program=w,this.vertexShader=L,this.fragmentShader=D,this}var l0e=0,lD=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 cD(e),t.set(e,n)),n}},cD=class{constructor(e){this.id=l0e++,this.code=e,this.usedTimes=0}};function c0e(i){return i===Rs||i===rh||i===sh}function u0e(i,e,t,n,r,s){let o=new __,a=new lD,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===Yu?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 be=j.morphAttributes.position||j.morphAttributes.normal||j.morphAttributes.color,Ie=be!==void 0?be.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=va[de];Ue=jt.vertexShader,mt=jt.fragmentShader}else{Ue=N.vertexShader,mt=N.fragmentShader;let jt=a.getVertexShaderStage(N),Wi=a.getFragmentShaderStage(N);a.update(N,jt,Wi),Me=jt.id,ze=Wi.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,pi=N.clearcoat>0,Bn=N.dispersion>0,le=N.iridescence>0,X=N.sheen>0,Te=N.transmission>0,Pe=ge&&!!N.anisotropyMap,Ve=pi&&!!N.clearcoatMap,gt=pi&&!!N.clearcoatNormalMap,St=pi&&!!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,Pn=Te&&!!N.thicknessMap,xe=!!N.gradientMap,bt=!!N.alphaMap,Ye=N.alphaTest>0,wt=!!N.alphaHash,Dt=!!N.extensions,ct=Vs;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===u3,normalMapTangentSpace:yt&&N.normalMapType===wl,packedNormalMap:yt&&N.normalMapType===wl&&c0e(N.normalMap.format),metalnessMap:Qt,roughnessMap:xn,anisotropy:ge,anisotropyMap:Pe,clearcoat:pi,clearcoatMap:Ve,clearcoatNormalMap:gt,clearcoatRoughnessMap:St,dispersion:Bn,iridescence:le,iridescenceMap:qe,iridescenceThicknessMap:Ze,sheen:X,sheenColorMap:Rt,sheenRoughnessMap:en,specularMap:Pt,specularColorMap:Mt,specularIntensityMap:cn,transmission:Te,transmissionMap:yn,thicknessMap:Pn,gradientMap:xe,opaque:N.transparent===!1&&N.blending===cs&&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:Pn&&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===sr,flipSided:N.side===hi,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=va[B];z=QA.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 a0e(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 h0e(){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 f0e(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 WW(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 jW(){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||f0e),n.length>1&&n.sort(x||WW),r.length>1&&r.sort(x||WW),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 d0e(){let i=new WeakMap;function e(n,r){let s=i.get(n),o;return s===void 0?(o=new jW,i.set(n,[o])):r>=s.length?(o=new jW,s.push(o)):o=s[r],o}function t(){i=new WeakMap}return{get:e,dispose:t}}function p0e(){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 A0e(){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 m0e=0;function g0e(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function _0e(i){let e=new p0e,t=A0e(),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(g0e);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===Rs?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=m0e++)}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 XW(i){let e=new _0e(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 x0e(i){let e=new WeakMap;function t(r,s=0){let o=e.get(r),a;return o===void 0?(a=new XW(i),e.set(r,[a])):s>=o.length?(a=new XW(i),o.push(a)):a=o[s],a}function n(){e=new WeakMap}return{get:t,dispose:n}}var y0e=`void main() {4065+`+be)}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 O_(r,w),B=Kpe(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,Gpe)),z},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(w),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=zpe++,this.cacheKey=e,this.usedTimes=1,this.program=w,this.vertexShader=L,this.fragmentShader=D,this}var f0e=0,cD=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 uD(e),t.set(e,n)),n}},uD=class{constructor(e){this.id=f0e++,this.code=e,this.usedTimes=0}};function d0e(i){return i===Rs||i===rh||i===sh}function p0e(i,e,t,n,r,s){let o=new x_,a=new cD,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===Yu?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 be=j.morphAttributes.position||j.morphAttributes.normal||j.morphAttributes.color,Ie=be!==void 0?be.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=va[de];Ue=jt.vertexShader,mt=jt.fragmentShader}else{Ue=N.vertexShader,mt=N.fragmentShader;let jt=a.getVertexShaderStage(N),Wi=a.getFragmentShaderStage(N);a.update(N,jt,Wi),Me=jt.id,ze=Wi.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,pi=N.clearcoat>0,Bn=N.dispersion>0,le=N.iridescence>0,X=N.sheen>0,Te=N.transmission>0,Pe=ge&&!!N.anisotropyMap,Ve=pi&&!!N.clearcoatMap,gt=pi&&!!N.clearcoatNormalMap,St=pi&&!!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,Pn=Te&&!!N.thicknessMap,xe=!!N.gradientMap,bt=!!N.alphaMap,Ye=N.alphaTest>0,wt=!!N.alphaHash,Dt=!!N.extensions,ct=Vs;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===h3,normalMapTangentSpace:yt&&N.normalMapType===wl,packedNormalMap:yt&&N.normalMapType===wl&&d0e(N.normalMap.format),metalnessMap:Qt,roughnessMap:xn,anisotropy:ge,anisotropyMap:Pe,clearcoat:pi,clearcoatMap:Ve,clearcoatNormalMap:gt,clearcoatRoughnessMap:St,dispersion:Bn,iridescence:le,iridescenceMap:qe,iridescenceThicknessMap:Ze,sheen:X,sheenColorMap:Rt,sheenRoughnessMap:en,specularMap:Pt,specularColorMap:Mt,specularIntensityMap:cn,transmission:Te,transmissionMap:yn,thicknessMap:Pn,gradientMap:xe,opaque:N.transparent===!1&&N.blending===cs&&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:Pn&&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===sr,flipSided:N.side===hi,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),R(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 R(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 P(N){let B=x[N.type],z;if(B){let V=va[B];z=QA.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 h0e(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:P,acquireProgram:C,releaseProgram:L,releaseShaderCache:D,programs:c,dispose:F}}function A0e(){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 m0e(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 XW(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 $W(){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 R=i[e];return R===void 0?(R={id:p.id,object:p,geometry:x,material:v,materialVariant:o(p),groupOrder:w,renderOrder:p.renderOrder,z:S,group:T},i[e]=R):(R.id=p.id,R.object=p,R.geometry=x,R.material=v,R.materialVariant=o(p),R.groupOrder=w,R.renderOrder=p.renderOrder,R.z=S,R.group=T),e++,R}function l(p,x,v,w,S,T){let R=a(p,x,v,w,S,T);v.transmission>0?n.push(R):v.transparent===!0?r.push(R):t.push(R)}function c(p,x,v,w,S,T){let R=a(p,x,v,w,S,T);v.transmission>0?n.unshift(R):v.transparent===!0?r.unshift(R):t.unshift(R)}function u(p,x,v){t.length>1&&t.sort(p||m0e),n.length>1&&n.sort(x||XW),r.length>1&&r.sort(x||XW),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 g0e(){let i=new WeakMap;function e(n,r){let s=i.get(n),o;return s===void 0?(o=new $W,i.set(n,[o])):r>=s.length?(o=new $W,s.push(o)):o=s[r],o}function t(){i=new WeakMap}return{get:e,dispose:t}}function _0e(){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 x0e(){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 y0e=0;function v0e(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function b0e(i){let e=new _0e,t=x0e(),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,R=0,P=0,C=0,L=0,D=0,F=0;c.sort(v0e);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===Rs?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,R++}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,P++}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!==R||N.numPointShadows!==P||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=R,n.directionalShadowMap.length=R,n.pointShadow.length=P,n.pointShadowMap.length=P,n.spotShadow.length=C,n.spotShadowMap.length=C,n.directionalShadowMatrix.length=R,n.pointShadowMatrix.length=P,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=R,N.numPointShadows=P,N.numSpotShadows=C,N.numSpotMaps=L,N.numLightProbes=F,n.version=y0e++)}function l(c,u){let f=0,p=0,x=0,v=0,w=0,S=u.matrixWorldInverse;for(let T=0,R=c.length;T<R;T++){let P=c[T];if(P.isDirectionalLight){let C=n.directional[f];C.direction.setFromMatrixPosition(P.matrixWorld),r.setFromMatrixPosition(P.target.matrixWorld),C.direction.sub(r),C.direction.transformDirection(S),f++}else if(P.isSpotLight){let C=n.spot[x];C.position.setFromMatrixPosition(P.matrixWorld),C.position.applyMatrix4(S),C.direction.setFromMatrixPosition(P.matrixWorld),r.setFromMatrixPosition(P.target.matrixWorld),C.direction.sub(r),C.direction.transformDirection(S),x++}else if(P.isRectAreaLight){let C=n.rectArea[v];C.position.setFromMatrixPosition(P.matrixWorld),C.position.applyMatrix4(S),o.identity(),s.copy(P.matrixWorld),s.premultiply(S),o.extractRotation(s),C.halfWidth.set(P.width*.5,0,0),C.halfHeight.set(0,P.height*.5,0),C.halfWidth.applyMatrix4(o),C.halfHeight.applyMatrix4(o),v++}else if(P.isPointLight){let C=n.point[p];C.position.setFromMatrixPosition(P.matrixWorld),C.position.applyMatrix4(S),p++}else if(P.isHemisphereLight){let C=n.hemi[w];C.direction.setFromMatrixPosition(P.matrixWorld),C.direction.transformDirection(S),w++}}}return{setup:a,setupView:l,state:n}}function YW(i){let e=new b0e(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 w0e(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 S0e=`void main() {40664066 gl_Position = vec4( position, 1.0 );4067-}`,v0e=`uniform sampler2D shadow_pass;4067+}`,T0e=`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-}`,b0e=[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)],w0e=[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)],$W=new on,L2=new ie,nD=new ie;function S0e(i,e,t){let n=new ec,r=new Oe,s=new Oe,o=new gn,a=new zT,l=new VT,c={},u=t.maxTextureSize,f={[_o]:hi,[hi]:_o,[sr]:sr},p=new Kr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Oe},radius:{value:4}},vertexShader:y0e,fragmentShader:v0e}),x=p.clone();x.defines.HORIZONTAL_PASS=1;let v=new qn;v.setAttribute("position",new Di(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let w=new Gn(v,p),S=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=ap;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===r3&&(je("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=ap);let B=i.getRenderTarget(),z=i.getActiveCubeFace(),V=i.getActiveMipmapLevel(),H=i.state;H.setBlending(Zr),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===tc){if(Z.isPointLight){je("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}ee.map=new pa(r.x,r.y,{format:Rs,type:Fi,minFilter:bi,magFilter:bi,generateMipmaps:!1}),ee.map.texture.name=Z.name+".shadowMap",ee.map.depthTexture=new us(r.x,r.y,Zi),ee.map.depthTexture.name=Z.name+".shadowMapDepth",ee.map.depthTexture.format=Ts,ee.map.depthTexture.compareFunction=null,ee.map.depthTexture.minFilter=yi,ee.map.depthTexture.magFilter=yi}else Z.isPointLight?(ee.map=new m3(r.x),ee.map.depthTexture=new v_(r.x,Ai)):(ee.map=new pa(r.x,r.y),ee.map.depthTexture=new us(r.x,r.y,Ai)),ee.map.depthTexture.name=Z.name+".shadowMap",ee.map.depthTexture.format=Ts,this.type===ap?(ee.map.depthTexture.compareFunction=ce?$c:oh,ee.map.depthTexture.minFilter=bi,ee.map.depthTexture.magFilter=bi):(ee.map.depthTexture.compareFunction=null,ee.map.depthTexture.minFilter=yi,ee.map.depthTexture.magFilter=yi);ee.camera.updateProjectionMatrix()}let de=ee.map.isWebGLCubeRenderTarget?6:1;for(let be=0;be<de;be++){if(ee.map.isWebGLCubeRenderTarget)i.setRenderTarget(ee.map,be),i.clear();else{be===0&&(i.setRenderTarget(ee.map),i.clear());let Ie=ee.getViewport(be);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()),L2.setFromMatrixPosition(Z.matrixWorld),Ie.position.copy(L2),nD.copy(Ie.position),nD.add(b0e[be]),Ie.up.copy(w0e[be]),Ie.lookAt(nD),Ie.updateMatrixWorld(),Qe.makeTranslation(-L2.x,-L2.y,-L2.z),$W.multiplyMatrices(Ie.projectionMatrix,Ie.matrixWorldInverse),ee._frustum.setFromProjectionMatrix($W,Ie.coordinateSystem,Ie.reversedDepth)}else ee.updateMatrices(Z);n=ee.getFrustum(),C(F,N,ee.camera,Z,this.type)}ee.isPointLightShadow!==!0&&this.type===tc&&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 pa(r.x,r.y,{format:Rs,type:Fi})),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===tc?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===tc)&&(!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 T0e(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,Wi){Wi===!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=P2[ct]),wt!==ct){switch(ct){case gA:i.depthFunc(i.NEVER);break;case _A:i.depthFunc(i.ALWAYS);break;case xA:i.depthFunc(i.LESS);break;case zu:i.depthFunc(i.LEQUAL);break;case yA:i.depthFunc(i.EQUAL);break;case vA:i.depthFunc(i.GEQUAL);break;case bA:i.depthFunc(i.GREATER);break;case wA: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,Wi=null;return{setTest:function(Nn){xe||(Nn?$e(i.STENCIL_TEST):Et(i.STENCIL_TEST))},setMask:function(Nn){bt!==Nn&&!xe&&(i.stencilMask(Nn),bt=Nn)},setFunc:function(Nn,Vr,_r){(Ye!==Nn||wt!==Vr||Dt!==_r)&&(i.stencilFunc(Nn,Vr,_r),Ye=Nn,wt=Vr,Dt=_r)},setOp:function(Nn,Vr,_r){(ct!==Nn||Ce!==Vr||jt!==_r)&&(i.stencilOp(Nn,Vr,_r),ct=Nn,Ce=Vr,jt=_r)},setLocked:function(Nn){xe=Nn},setClear:function(Nn){Wi!==Nn&&(i.clearStencil(Nn),Wi=Nn)},reset:function(){xe=!1,bt=null,Ye=null,wt=null,Dt=null,ct=null,Ce=null,jt=null,Wi=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,be={},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(zu),vt(!1),yt(r2),$e(i.CULL_FACE),st(Zr);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={[zs]:i.FUNC_ADD,[o2]:i.FUNC_SUBTRACT,[a2]:i.FUNC_REVERSE_SUBTRACT};Gt[s3]=i.MIN,Gt[o3]=i.MAX;let Xe={[Xc]:i.ZERO,[l2]:i.ONE,[c2]:i.SRC_COLOR,[Xd]:i.SRC_ALPHA,[A2]:i.SRC_ALPHA_SATURATE,[d2]:i.DST_COLOR,[h2]:i.DST_ALPHA,[u2]:i.ONE_MINUS_SRC_COLOR,[$d]:i.ONE_MINUS_SRC_ALPHA,[p2]:i.ONE_MINUS_DST_COLOR,[f2]:i.ONE_MINUS_DST_ALPHA,[dW]:i.CONSTANT_COLOR,[pW]:i.ONE_MINUS_CONSTANT_COLOR,[AW]:i.CONSTANT_ALPHA,[mW]:i.ONE_MINUS_CONSTANT_ALPHA};function st(xe,bt,Ye,wt,Dt,ct,Ce,jt,Wi,Nn){if(xe===Zr){S===!0&&(Et(i.BLEND),S=!1);return}if(S===!1&&($e(i.BLEND),S=!0),xe!==Uf){if(xe!==T||Nn!==z){if((P!==zs||L!==zs)&&(i.blendEquation(i.FUNC_ADD),P=zs,L=zs),Nn)switch(xe){case cs:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case ju:i.blendFunc(i.ONE,i.ONE);break;case Xu:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case $u: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 cs:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case ju:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case Xu:Ge("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case $u: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=Nn}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||Wi!==B)&&(i.blendColor(jt.r,jt.g,jt.b,Wi),N.copy(jt),B=Wi),T=xe,z=!1}function tt(xe,bt){xe.side===sr?Et(i.CULL_FACE):$e(i.CULL_FACE);let Ye=xe.side===hi;bt&&(Ye=!Ye),vt(Ye),xe.blending===cs&&xe.transparent===!1?st(Zr):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!==n3?($e(i.CULL_FACE),xe!==H&&(xe===r2?i.cullFace(i.BACK):xe===i3?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=be[Ye];wt===void 0&&(wt={type:void 0,texture:void 0},be[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 pi(){let xe=be[de];xe!==void 0&&xe.type!==void 0&&(i.bindTexture(xe.type,null),xe.type=void 0,xe.texture=void 0)}function Bn(){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 Pn(){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,be={},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:pi,compressedTexImage2D:Bn,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:Pn}}function E0e(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):A_("canvas")}function S(le,X,Te){let Pe=1,Ve=Bn(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?Kd: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===Ai||X===Ho?Te=i.DEPTH24_STENCIL8:X===Zi?Te=i.DEPTH32F_STENCIL8:X===Ka&&(Te=i.DEPTH24_STENCIL8,je("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):X===null||X===Ai||X===Ho?Te=i.DEPTH_COMPONENT24:X===Zi?Te=i.DEPTH_COMPONENT32F:X===Ka&&(Te=i.DEPTH_COMPONENT16),Te}function D(le,X){return T(le)===!0||le.isFramebufferTexture&&le.minFilter!==yi&&le.minFilter!==bi?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 be(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={[If]:i.REPEAT,[Vo]:i.CLAMP_TO_EDGE,[Nf]:i.MIRRORED_REPEAT},Qe={[yi]:i.NEAREST,[w2]:i.NEAREST_MIPMAP_NEAREST,[ic]:i.NEAREST_MIPMAP_LINEAR,[bi]:i.LINEAR,[up]:i.LINEAR_MIPMAP_NEAREST,[yo]:i.LINEAR_MIPMAP_LINEAR},Ue={[E2]:i.NEVER,[R2]:i.ALWAYS,[N_]:i.LESS,[oh]:i.LEQUAL,[M2]:i.EQUAL,[$c]:i.GEQUAL,[YA]:i.GREATER,[C2]:i.NOTEQUAL};function mt(le,X){if(X.type===Zi&&e.has("OES_texture_float_linear")===!1&&(X.magFilter===bi||X.magFilter===up||X.magFilter===ic||X.magFilter===yo||X.minFilter===bi||X.minFilter===up||X.minFilter===ic||X.minFilter===yo)&&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===yi||X.minFilter!==ic&&X.minFilter!==yo||X.type===Zi&&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),Pn=ze(Pt.start,X.width,4);Mt.start<=cn+1&&yn===Pn&&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),Pn=cn%X.width,xe=Math.floor(cn/X.width),bt=yn,Ye=1;t.pixelStorei(i.UNPACK_SKIP_PIXELS,Pn),t.pixelStorei(i.UNPACK_SKIP_ROWS,xe),t.texSubImage2D(i.TEXTURE_2D,0,Pn,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===Wo?null:sn.getPrimaries(X.colorSpace),Dt=X.colorSpace===Wo||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=pi(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,Pn=St.__version===void 0||Ve===!0,xe=gt.dataReady,bt=D(X,Ze);if(X.isDepthTexture)Pt=L(X.format===eo,X.type),Pn&&(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&&Pn&&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?(Pn&&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&&Pn&&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!==wr)if(Rt!==null)if(yn){if(xe)if(X.layerUpdates.size>0){let Dt=I2(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&&Pn&&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!==wr?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(Pn&&t.texStorage3D(i.TEXTURE_2D_ARRAY,bt,Pt,Ze.width,Ze.height,Ze.depth),xe)if(X.layerUpdates.size>0){let Ye=I2(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?(Pn&&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(Pn)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&&Pn){let Ye=Bn(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(Pn){let Ye=Bn(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===Wo?null:sn.getPrimaries(X.colorSpace),Ze=X.colorSpace===Wo||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]=pi(X,Pt[ct]);let Mt=Pt[0],cn=s.convert(X.format,X.colorSpace),yn=s.convert(X.type),Pn=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,Pn,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!==wr?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,Pn,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,Pn,jt.width,jt.height,0,cn,yn,jt.data)}}}else{if(Dt=X.mipmaps,xe&&bt){Dt.length>0&&wt++;let ct=Bn(Pt[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,wt,Pn,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,Pn,Pt[ct].width,Pt[ct].height,0,cn,yn,Pt[ct].data);for(let Ce=0;Ce<Dt.length;Ce++){let Wi=Dt[Ce].image[ct].image;xe?Ye&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce+1,0,0,Wi.width,Wi.height,cn,yn,Wi.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce+1,Pn,Wi.width,Wi.height,0,cn,yn,Wi.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,Pn,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,Pn,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===Ts?Pt=i.DEPTH_COMPONENT24:X.depthTexture.format===eo&&(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===eo?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;if(X.depthTexture.format===Ts)xn(X)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Ze,qe,gt,0,St):i.framebufferTexture2D(i.FRAMEBUFFER,Ze,qe,gt,0);else if(X.depthTexture.format===eo)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 pi(le,X){let Te=le.colorSpace,Pe=le.format,Ve=le.type;return le.isCompressedTexture===!0||le.isVideoTexture===!0||Te!==Yd&&Te!==Wo&&(sn.getTransfer(Te)===Bt?(Pe!==wr||Ve!==Vi)&&je("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Ge("WebGLTextures: Unsupported texture color space:",Te)),X}function Bn(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=be,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 M0e(i,e){function t(n,r=Wo){let s,o=sn.getTransfer(r);if(n===Vi)return i.UNSIGNED_BYTE;if(n===zA)return i.UNSIGNED_SHORT_4_4_4_4;if(n===VA)return i.UNSIGNED_SHORT_5_5_5_1;if(n===qA)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===HA)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===Ku)return i.BYTE;if(n===Zu)return i.SHORT;if(n===Ka)return i.UNSIGNED_SHORT;if(n===Fr)return i.INT;if(n===Ai)return i.UNSIGNED_INT;if(n===Zi)return i.FLOAT;if(n===Fi)return i.HALF_FLOAT;if(n===I_)return i.ALPHA;if(n===kf)return i.RGB;if(n===wr)return i.RGBA;if(n===Ts)return i.DEPTH_COMPONENT;if(n===eo)return i.DEPTH_STENCIL;if(n===Gf)return i.RED;if(n===Qu)return i.RED_INTEGER;if(n===Rs)return i.RG;if(n===Ju)return i.RG_INTEGER;if(n===hp)return i.RGBA_INTEGER;if(n===eh||n===th||n===nh||n===ih)if(o===Bt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===eh)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===th)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===nh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===ih)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===eh)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===th)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===nh)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===ih)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===WA||n===jA||n===XA||n===$A)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===WA)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===jA)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===XA)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===$A)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===fp||n===dp||n===pp||n===Ap||n===mp||n===rh||n===gp)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===fp||n===dp)return o===Bt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===pp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===Ap)return s.COMPRESSED_R11_EAC;if(n===mp)return s.COMPRESSED_SIGNED_R11_EAC;if(n===rh)return s.COMPRESSED_RG11_EAC;if(n===gp)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===_p||n===xp||n===yp||n===vp||n===bp||n===wp||n===Sp||n===Tp||n===Ep||n===Mp||n===Cp||n===Rp||n===Pp||n===Ip)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===_p)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===xp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===yp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===vp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===bp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===wp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Sp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Tp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Ep)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Mp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Cp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Rp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Pp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Ip)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Np||n===Lp||n===Dp)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Np)return o===Bt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Lp)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Dp)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Fp||n===Op||n===sh||n===Bp)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Fp)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Op)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===sh)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Bp)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Ho?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}var C0e=`4092+}`,E0e=[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)],M0e=[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)],KW=new on,F2=new ie,iD=new ie;function C0e(i,e,t){let n=new ec,r=new Oe,s=new Oe,o=new gn,a=new VT,l=new qT,c={},u=t.maxTextureSize,f={[xo]:hi,[hi]:xo,[sr]:sr},p=new Zr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Oe},radius:{value:4}},vertexShader:S0e,fragmentShader:T0e}),x=p.clone();x.defines.HORIZONTAL_PASS=1;let v=new qn;v.setAttribute("position",new Di(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let w=new Gn(v,p),S=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=ap;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===s3&&(je("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=ap);let B=i.getRenderTarget(),z=i.getActiveCubeFace(),V=i.getActiveMipmapLevel(),H=i.state;H.setBlending(Qr),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===tc){if(Z.isPointLight){je("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}ee.map=new pa(r.x,r.y,{format:Rs,type:Fi,minFilter:bi,magFilter:bi,generateMipmaps:!1}),ee.map.texture.name=Z.name+".shadowMap",ee.map.depthTexture=new us(r.x,r.y,Zi),ee.map.depthTexture.name=Z.name+".shadowMapDepth",ee.map.depthTexture.format=Ts,ee.map.depthTexture.compareFunction=null,ee.map.depthTexture.minFilter=yi,ee.map.depthTexture.magFilter=yi}else Z.isPointLight?(ee.map=new g3(r.x),ee.map.depthTexture=new b_(r.x,Ai)):(ee.map=new pa(r.x,r.y),ee.map.depthTexture=new us(r.x,r.y,Ai)),ee.map.depthTexture.name=Z.name+".shadowMap",ee.map.depthTexture.format=Ts,this.type===ap?(ee.map.depthTexture.compareFunction=ce?$c:oh,ee.map.depthTexture.minFilter=bi,ee.map.depthTexture.magFilter=bi):(ee.map.depthTexture.compareFunction=null,ee.map.depthTexture.minFilter=yi,ee.map.depthTexture.magFilter=yi);ee.camera.updateProjectionMatrix()}let de=ee.map.isWebGLCubeRenderTarget?6:1;for(let be=0;be<de;be++){if(ee.map.isWebGLCubeRenderTarget)i.setRenderTarget(ee.map,be),i.clear();else{be===0&&(i.setRenderTarget(ee.map),i.clear());let Ie=ee.getViewport(be);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()),F2.setFromMatrixPosition(Z.matrixWorld),Ie.position.copy(F2),iD.copy(Ie.position),iD.add(E0e[be]),Ie.up.copy(M0e[be]),Ie.lookAt(iD),Ie.updateMatrixWorld(),Qe.makeTranslation(-F2.x,-F2.y,-F2.z),KW.multiplyMatrices(Ie.projectionMatrix,Ie.matrixWorldInverse),ee._frustum.setFromProjectionMatrix(KW,Ie.coordinateSystem,Ie.reversedDepth)}else ee.updateMatrices(Z);n=ee.getFrustum(),C(F,N,ee.camera,Z,this.type)}ee.isPointLightShadow!==!0&&this.type===tc&&R(ee,N),ee.needsUpdate=!1}T=this.type,S.needsUpdate=!1,i.setRenderTarget(B,z,V)};function R(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 pa(r.x,r.y,{format:Rs,type:Fi})),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 P(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===tc?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===tc)&&(!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=P(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=P(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 R0e(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,Wi){Wi===!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=N2[ct]),wt!==ct){switch(ct){case gA:i.depthFunc(i.NEVER);break;case _A:i.depthFunc(i.ALWAYS);break;case xA:i.depthFunc(i.LESS);break;case zu:i.depthFunc(i.LEQUAL);break;case yA:i.depthFunc(i.EQUAL);break;case vA:i.depthFunc(i.GEQUAL);break;case bA:i.depthFunc(i.GREATER);break;case wA: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,Wi=null;return{setTest:function(Nn){xe||(Nn?$e(i.STENCIL_TEST):Et(i.STENCIL_TEST))},setMask:function(Nn){bt!==Nn&&!xe&&(i.stencilMask(Nn),bt=Nn)},setFunc:function(Nn,Vr,_r){(Ye!==Nn||wt!==Vr||Dt!==_r)&&(i.stencilFunc(Nn,Vr,_r),Ye=Nn,wt=Vr,Dt=_r)},setOp:function(Nn,Vr,_r){(ct!==Nn||Ce!==Vr||jt!==_r)&&(i.stencilOp(Nn,Vr,_r),ct=Nn,Ce=Vr,jt=_r)},setLocked:function(Nn){xe=Nn},setClear:function(Nn){Wi!==Nn&&(i.clearStencil(Nn),Wi=Nn)},reset:function(){xe=!1,bt=null,Ye=null,wt=null,Dt=null,ct=null,Ce=null,jt=null,Wi=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,R=null,P=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,be={},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(zu),vt(!1),yt(o2),$e(i.CULL_FACE),st(Qr);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={[zs]:i.FUNC_ADD,[l2]:i.FUNC_SUBTRACT,[c2]:i.FUNC_REVERSE_SUBTRACT};Gt[o3]=i.MIN,Gt[a3]=i.MAX;let Xe={[Xc]:i.ZERO,[u2]:i.ONE,[h2]:i.SRC_COLOR,[Xd]:i.SRC_ALPHA,[g2]:i.SRC_ALPHA_SATURATE,[A2]:i.DST_COLOR,[d2]:i.DST_ALPHA,[f2]:i.ONE_MINUS_SRC_COLOR,[$d]:i.ONE_MINUS_SRC_ALPHA,[m2]:i.ONE_MINUS_DST_COLOR,[p2]:i.ONE_MINUS_DST_ALPHA,[AW]:i.CONSTANT_COLOR,[mW]:i.ONE_MINUS_CONSTANT_COLOR,[gW]:i.CONSTANT_ALPHA,[_W]:i.ONE_MINUS_CONSTANT_ALPHA};function st(xe,bt,Ye,wt,Dt,ct,Ce,jt,Wi,Nn){if(xe===Qr){S===!0&&(Et(i.BLEND),S=!1);return}if(S===!1&&($e(i.BLEND),S=!0),xe!==Uf){if(xe!==T||Nn!==z){if((R!==zs||L!==zs)&&(i.blendEquation(i.FUNC_ADD),R=zs,L=zs),Nn)switch(xe){case cs:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case ju:i.blendFunc(i.ONE,i.ONE);break;case Xu:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case $u: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 cs:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case ju:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case Xu:Ge("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case $u:Ge("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Ge("WebGLState: Invalid blending: ",xe);break}P=null,C=null,D=null,F=null,N.set(0,0,0),B=0,T=xe,z=Nn}return}Dt=Dt||bt,ct=ct||Ye,Ce=Ce||wt,(bt!==R||Dt!==L)&&(i.blendEquationSeparate(Gt[bt],Gt[Dt]),R=bt,L=Dt),(Ye!==P||wt!==C||ct!==D||Ce!==F)&&(i.blendFuncSeparate(Xe[Ye],Xe[wt],Xe[ct],Xe[Ce]),P=Ye,C=wt,D=ct,F=Ce),(jt.equals(N)===!1||Wi!==B)&&(i.blendColor(jt.r,jt.g,jt.b,Wi),N.copy(jt),B=Wi),T=xe,z=!1}function tt(xe,bt){xe.side===sr?Et(i.CULL_FACE):$e(i.CULL_FACE);let Ye=xe.side===hi;bt&&(Ye=!Ye),vt(Ye),xe.blending===cs&&xe.transparent===!1?st(Qr):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!==i3?($e(i.CULL_FACE),xe!==H&&(xe===o2?i.cullFace(i.BACK):xe===r3?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=be[Ye];wt===void 0&&(wt={type:void 0,texture:void 0},be[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 pi(){let xe=be[de];xe!==void 0&&xe.type!==void 0&&(i.bindTexture(xe.type,null),xe.type=void 0,xe.texture=void 0)}function Bn(){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 Pn(){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,be={},p={},x=new WeakMap,v=[],w=null,S=!1,T=null,R=null,P=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:pi,compressedTexImage2D:Bn,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:Pn}}function P0e(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):m_("canvas")}function S(le,X,Te){let Pe=1,Ve=Bn(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 R(le){i.generateMipmap(le)}function P(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?Kd: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===Ai||X===Wo?Te=i.DEPTH24_STENCIL8:X===Zi?Te=i.DEPTH32F_STENCIL8:X===Ka&&(Te=i.DEPTH24_STENCIL8,je("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):X===null||X===Ai||X===Wo?Te=i.DEPTH_COMPONENT24:X===Zi?Te=i.DEPTH_COMPONENT32F:X===Ka&&(Te=i.DEPTH_COMPONENT16),Te}function D(le,X){return T(le)===!0||le.isFramebufferTexture&&le.minFilter!==yi&&le.minFilter!==bi?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 be(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={[If]:i.REPEAT,[qo]:i.CLAMP_TO_EDGE,[Nf]:i.MIRRORED_REPEAT},Qe={[yi]:i.NEAREST,[T2]:i.NEAREST_MIPMAP_NEAREST,[ic]:i.NEAREST_MIPMAP_LINEAR,[bi]:i.LINEAR,[up]:i.LINEAR_MIPMAP_NEAREST,[vo]:i.LINEAR_MIPMAP_LINEAR},Ue={[C2]:i.NEVER,[I2]:i.ALWAYS,[L_]:i.LESS,[oh]:i.LEQUAL,[R2]:i.EQUAL,[$c]:i.GEQUAL,[YA]:i.GREATER,[P2]:i.NOTEQUAL};function mt(le,X){if(X.type===Zi&&e.has("OES_texture_float_linear")===!1&&(X.magFilter===bi||X.magFilter===up||X.magFilter===ic||X.magFilter===vo||X.minFilter===bi||X.minFilter===up||X.minFilter===ic||X.minFilter===vo)&&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===yi||X.minFilter!==ic&&X.minFilter!==vo||X.type===Zi&&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),Pn=ze(Pt.start,X.width,4);Mt.start<=cn+1&&yn===Pn&&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),Pn=cn%X.width,xe=Math.floor(cn/X.width),bt=yn,Ye=1;t.pixelStorei(i.UNPACK_SKIP_PIXELS,Pn),t.pixelStorei(i.UNPACK_SKIP_ROWS,xe),t.texSubImage2D(i.TEXTURE_2D,0,Pn,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===jo?null:sn.getPrimaries(X.colorSpace),Dt=X.colorSpace===jo||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=pi(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,Pn=St.__version===void 0||Ve===!0,xe=gt.dataReady,bt=D(X,Ze);if(X.isDepthTexture)Pt=L(X.format===eo,X.type),Pn&&(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&&Pn&&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?(Pn&&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&&Pn&&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!==wr)if(Rt!==null)if(yn){if(xe)if(X.layerUpdates.size>0){let Dt=L2(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&&Pn&&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!==wr?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(Pn&&t.texStorage3D(i.TEXTURE_2D_ARRAY,bt,Pt,Ze.width,Ze.height,Ze.depth),xe)if(X.layerUpdates.size>0){let Ye=L2(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?(Pn&&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(Pn)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&&Pn){let Ye=Bn(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(Pn){let Ye=Bn(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)&&R(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===jo?null:sn.getPrimaries(X.colorSpace),Ze=X.colorSpace===jo||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]=pi(X,Pt[ct]);let Mt=Pt[0],cn=s.convert(X.format,X.colorSpace),yn=s.convert(X.type),Pn=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,Pn,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!==wr?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,Pn,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,Pn,jt.width,jt.height,0,cn,yn,jt.data)}}}else{if(Dt=X.mipmaps,xe&&bt){Dt.length>0&&wt++;let ct=Bn(Pt[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,wt,Pn,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,Pn,Pt[ct].width,Pt[ct].height,0,cn,yn,Pt[ct].data);for(let Ce=0;Ce<Dt.length;Ce++){let Wi=Dt[Ce].image[ct].image;xe?Ye&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce+1,0,0,Wi.width,Wi.height,cn,yn,Wi.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce+1,Pn,Wi.width,Wi.height,0,cn,yn,Wi.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,Pn,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,Pn,cn,yn,jt.image[ct])}}}T(X)&&R(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===Ts?Pt=i.DEPTH_COMPONENT24:X.depthTexture.format===eo&&(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===eo?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;if(X.depthTexture.format===Ts)xn(X)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Ze,qe,gt,0,St):i.framebufferTexture2D(i.FRAMEBUFFER,Ze,qe,gt,0);else if(X.depthTexture.format===eo)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)&&R(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)&&R(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)&&R(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=P(le),St=n.get(Ve).__webglTexture;t.bindTexture(gt,St),R(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 pi(le,X){let Te=le.colorSpace,Pe=le.format,Ve=le.type;return le.isCompressedTexture===!0||le.isVideoTexture===!0||Te!==Yd&&Te!==jo&&(sn.getTransfer(Te)===Bt?(Pe!==wr||Ve!==Vi)&&je("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Ge("WebGLTextures: Unsupported texture color space:",Te)),X}function Bn(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=be,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 I0e(i,e){function t(n,r=jo){let s,o=sn.getTransfer(r);if(n===Vi)return i.UNSIGNED_BYTE;if(n===zA)return i.UNSIGNED_SHORT_4_4_4_4;if(n===VA)return i.UNSIGNED_SHORT_5_5_5_1;if(n===qA)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===HA)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===Ku)return i.BYTE;if(n===Zu)return i.SHORT;if(n===Ka)return i.UNSIGNED_SHORT;if(n===Fr)return i.INT;if(n===Ai)return i.UNSIGNED_INT;if(n===Zi)return i.FLOAT;if(n===Fi)return i.HALF_FLOAT;if(n===N_)return i.ALPHA;if(n===kf)return i.RGB;if(n===wr)return i.RGBA;if(n===Ts)return i.DEPTH_COMPONENT;if(n===eo)return i.DEPTH_STENCIL;if(n===Gf)return i.RED;if(n===Qu)return i.RED_INTEGER;if(n===Rs)return i.RG;if(n===Ju)return i.RG_INTEGER;if(n===hp)return i.RGBA_INTEGER;if(n===eh||n===th||n===nh||n===ih)if(o===Bt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===eh)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===th)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===nh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===ih)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===eh)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===th)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===nh)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===ih)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===WA||n===jA||n===XA||n===$A)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===WA)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===jA)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===XA)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===$A)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===fp||n===dp||n===pp||n===Ap||n===mp||n===rh||n===gp)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===fp||n===dp)return o===Bt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===pp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===Ap)return s.COMPRESSED_R11_EAC;if(n===mp)return s.COMPRESSED_SIGNED_R11_EAC;if(n===rh)return s.COMPRESSED_RG11_EAC;if(n===gp)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===_p||n===xp||n===yp||n===vp||n===bp||n===wp||n===Sp||n===Tp||n===Ep||n===Mp||n===Cp||n===Rp||n===Pp||n===Ip)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===_p)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===xp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===yp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===vp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===bp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===wp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Sp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Tp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Ep)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Mp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Cp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Rp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Pp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Ip)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Np||n===Lp||n===Dp)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Np)return o===Bt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Lp)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Dp)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Fp||n===Op||n===sh||n===Bp)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Fp)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Op)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===sh)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Bp)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Wo?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}var N0e=`40934093 void main() {40944094 40954095 gl_Position = vec4( position, 1.0 );40964096 4097-}`,R0e=`4097+}`,L0e=`40984098 uniform sampler2DArray depthColor;40994099 uniform float depthWidth;41004100 uniform float depthHeight;@@ -4113,23 +4113,23 @@ void main() {
41134113 41144114 }41154115 4116-}`,uD=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new Ry(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 Kr({vertexShader:C0e,fragmentShader:R0e,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Gn(new DA(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},hD=class extends qo{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 uD,T={},P=t.getContextAttributes(),R=null,C=null,L=[],D=[],F=new Oe,N=null,B=new Lr;B.viewport=new gn;let z=new Lr;z.viewport=new gn;let V=[B,z],H=new C_,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?eo:Ts,Et=P.stencil?Ho:Ai);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 pa(p.textureWidth,p.textureHeight,{format:wr,type:Vi,depthTexture:new us(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 pa(x.framebufferWidth,x.framebufferHeight,{format:wr,type:Vi,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,pi=yt-Qt,Bn=ln+(Et-Qt),le=Xe*Gt/ge*xn,X=st*Gt/ge*xn;Me.projectionMatrix.makePerspective(pi,Bn,le,X,xn,ge),Me.projectionMatrixInverse.copy(Me.projectionMatrix).invert()}}function be(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;be(H,Et);for(let Ct=0;Ct<Tt.length;Ct++)be(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=Lf*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 Lr,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 Ry,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 KW;mt.setAnimationLoop(Ue),this.setAnimationLoop=function(Me){Qe=Me},this.dispose=function(){}}},P0e=new on,nj=new Sn;nj.set(-1,0,0,0,1,0,0,0,1);function I0e(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,qL(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===hi&&(S.bumpScale.value*=-1)),T.normalMap&&(S.normalMap.value=T.normalMap,t(T.normalMap,S.normalMapTransform),S.normalScale.value.copy(T.normalScale),T.side===hi&&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(P0e.makeRotationFromEuler(C)).transpose(),R.isCubeTexture&&R.isRenderTargetTexture===!1&&S.envMapRotation.value.premultiply(nj),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===hi&&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 N0e(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,be=de%ce.boundary,Ie=de+be;D+=be,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 L0e=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;function D0e(){return ah===null&&(ah=new RA(L0e,16,16,Rs,Fi),ah.name="DFG_LUT",ah.minFilter=bi,ah.magFilter=bi,ah.wrapS=Vo,ah.wrapT=Vo,ah.generateMipmaps=!1,ah.needsUpdate=!0),ah}var g3=class{constructor(e={}){let{canvas:t=f3(),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=Vi}=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([hp,Ju,Qu]),T=new Set([Vi,Ai,Ka,Ho,zA,VA]),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=Vs,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let z=this,V=!1,H=null,K=null,J=null,j=null;this._outputColorSpace=vr;let Z=0,ee=0,ae=null,ce=-1,de=null,be=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 ec,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 pi(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",Wi,!1),t.addEventListener("webglcontextrestored",Nn,!1),t.addEventListener("webglcontextcreationerror",Vr,!1),ge===null){let Se="webgl2";if(ge=pi(Se,te),ge===null)throw pi(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 Bn,le,X,Te,Pe,Ve,gt,St,qe,Ze,Rt,en,Pt,Mt,cn,yn,Pn,xe,bt,Ye,wt,Dt,ct;function Ce(){Bn=new zde(ge),Bn.init(),wt=new M0e(ge,Bn),le=new Lde(ge,Bn,e,wt),X=new T0e(ge,Bn),le.reversedDepthBuffer&&p&&X.buffers.depth.setReversed(!0),K=ge.createFramebuffer(),J=ge.createFramebuffer(),j=ge.createFramebuffer(),Te=new Hde(ge),Pe=new h0e,Ve=new E0e(ge,Bn,X,Pe,le,wt,Te),gt=new Gde(z),St=new $ue(ge),Dt=new Ide(ge,St),qe=new Vde(ge,St,Te,Dt),Ze=new jde(ge,qe,St,Dt,Te),xe=new Wde(ge,le,Ve),cn=new Dde(Pe),Rt=new u0e(z,gt,Bn,le,Dt,cn),en=new I0e(z,Pe),Pt=new d0e,Mt=new x0e(Bn),Pn=new Pde(z,gt,X,Ze,v,l),yn=new S0e(z,Ze,le),ct=new N0e(ge,Te,le,X),bt=new Nde(ge,Bn,Te),Ye=new qde(ge,Bn,Te),Te.programs=Rt.programs,z.capabilities=le,z.extensions=Bn,z.properties=Pe,z.renderLists=Pt,z.shadowMap=yn,z.state=X,z.info=Te}Ce(),w!==Vi&&(B=new $de(w,t.width,t.height,a,r,s));let jt=new hD(z,ge);this.xr=jt,this.getContext=function(){return ge},this.getContextAttributes=function(){return ge.getContextAttributes()},this.forceContextLoss=function(){let te=Bn.get("WEBGL_lose_context");te&&te.loseContext()},this.forceContextRestore=function(){let te=Bn.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===Vi){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(be)},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(be.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(Pn.getClearColor())},this.setClearColor=function(){Pn.setClearColor(...arguments)},this.getClearAlpha=function(){return Pn.getClearAlpha()},this.setClearAlpha=function(){Pn.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=Pn.getClearColor(),tn=Pn.getClearAlpha(),hn=kt.r,zn=kt.g,Yn=kt.b;Yt?(P[0]=hn,P[1]=zn,P[2]=Yn,P[3]=tn,ge.clearBufferuiv(ge.COLOR,0,P)):(R[0]=hn,R[1]=zn,R[2]=Yn,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",Wi,!1),t.removeEventListener("webglcontextrestored",Nn,!1),t.removeEventListener("webglcontextcreationerror",Vr,!1),Pn.dispose(),Pt.dispose(),Mt.dispose(),Pe.dispose(),gt.dispose(),Ze.dispose(),Dt.dispose(),ct.dispose(),Rt.dispose(),jt.dispose(),jt.removeEventListener("sessionstart",Ds),jt.removeEventListener("sessionend",ul),mu.stop()};function Wi(te){te.preventDefault(),SA("WebGLRenderer: Context Lost."),V=!0}function Nn(){SA("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 Vr(te){Ge("WebGLRenderer: A WebGL context could not be created. Reason: ",te.statusMessage)}function _r(te){let Se=te.target;Se.removeEventListener("dispose",_r),ll(Se)}function ll(te){ra(te),Pe.remove(te)}function ra(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=f9(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 zn=ke.drawRange,Yn=ke.attributes.position,pn=zn.start*hn,ki=(zn.start+zn.count)*hn;zt!==null&&(pn=Math.max(pn,zt.start*hn),ki=Math.min(ki,(zt.start+zt.count)*hn)),tn!==null?(pn=Math.max(pn,0),ki=Math.min(ki,tn.count)):Yn!=null&&(pn=Math.max(pn,0),ki=Math.min(ki,Yn.count));let qr=ki-pn;if(qr<0||qr===1/0)return;Dt.setup(De,Le,kt,ke,tn);let Rr,ji=bt;if(tn!==null&&(Rr=St.get(tn),ji=Ye,ji.setIndex(Rr)),De.isMesh)Le.wireframe===!0?(X.setLineWidth(Le.wireframeLinewidth*xn()),ji.setMode(ge.LINES)):ji.setMode(ge.TRIANGLES);else if(De.isLine){let ao=Le.linewidth;ao===void 0&&(ao=1),X.setLineWidth(ao*xn()),De.isLineSegments?ji.setMode(ge.LINES):De.isLineLoop?ji.setMode(ge.LINE_LOOP):ji.setMode(ge.LINE_STRIP)}else De.isPoints?ji.setMode(ge.POINTS):De.isSprite&&ji.setMode(ge.TRIANGLES);if(De.isBatchedMesh)if(Bn.get("WEBGL_multi_draw"))ji.renderMultiDraw(De._multiDrawStarts,De._multiDrawCounts,De._multiDrawCount);else{let ao=De._multiDrawStarts,Xt=De._multiDrawCounts,Oa=De._multiDrawCount,mi=tn?St.get(tn).bytesPerElement:1,hl=Pe.get(Le).currentProgram.getUniforms();for(let vc=0;vc<Oa;vc++)hl.setValue(ge,"_gl_DrawID",vc),ji.render(ao[vc]/mi,Xt[vc])}else if(De.isInstancedMesh)ji.renderInstances(pn,qr,De.count);else if(ke.isInstancedBufferGeometry){let ao=ke._maxInstanceCount!==void 0?ke._maxInstanceCount:1/0,Xt=Math.min(ke.instanceCount,ao);ji.renderInstances(pn,qr,Xt)}else ji.render(pn,qr)};function cl(te,Se,ke){te.transparent===!0&&te.side===sr&&te.forceSinglePass===!1?(te.side=hi,te.needsUpdate=!0,ax(te,Se,ke),te.side=_o,te.needsUpdate=!0,ax(te,Se,ke),te.side=sr):ax(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];cl(kt,ke,De),Le.add(kt)}else cl(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)}Bn.get("KHR_parallel_shader_compile")!==null?zt():setTimeout(zt,10)})};let Fa=null;function ar(te){Fa&&Fa(te)}function Ds(){mu.stop()}function ul(){mu.start()}let mu=new KW;mu.setAnimationLoop(ar),typeof self<"u"&&mu.setContext(self),this.setAnimationLoop=function(te){Fa=te,jt.setAnimationLoop(te),te===null?mu.stop():mu.start()},jt.addEventListener("sessionstart",Ds),jt.addEventListener("sessionend",ul),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,go,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&&Kb(Yt,Se,-1/0,z.sortObjects)}Kb(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&&Pn.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,zn=tn.length;hn<zn;hn++){let Yn=tn[hn];y4(Yt,kt,te,Yn)}Qt&&Pn.render(te);for(let hn=0,zn=tn.length;hn<zn;hn++){let Yn=tn[hn];x4(L,te,Yn,Yn.viewport)}}else kt.length>0&&y4(Yt,kt,te,Se),Qt&&Pn.render(te),x4(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 Kb(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,zn=tn.length;hn<zn;hn++){let Yn=tn[hn],pn=kt[Yn.materialIndex];pn&&pn.visible&&L.push(te,Yt,pn,ke,ln.z,Yn)}}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++)Kb(zt[Yt],Se,ke,Le)}function x4(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(be.copy(Le)),De.length>0&&ox(De,Se,ke),zt.length>0&&ox(zt,Se,ke),Yt.length>0&&ox(Yt,Se,ke),X.buffers.depth.setTest(!0),X.buffers.depth.setMask(!0),X.buffers.color.setMask(!0),X.setPolygonOffset(!1)}function y4(te,Se,ke,Le){if((ke.isScene===!0?ke.overrideMaterial:null)!==null)return;if(D.state.transmissionRenderTarget[Le.id]===void 0){let pn=Bn.has("EXT_color_buffer_half_float")||Bn.has("EXT_color_buffer_float");D.state.transmissionRenderTarget[Le.id]=new pa(1,1,{generateMipmaps:!0,type:pn?Fi:Vi,minFilter:yo,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||be;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&&Pn.render(ke);let zn=z.toneMapping;z.toneMapping=Vs;let Yn=Le.viewport;if(Le.viewport!==void 0&&(Le.viewport=void 0),D.setupLightsView(Le),st===!0&&cn.setGlobalState(z.clippingPlanes,Le),ox(te,ke,Le),Ve.updateMultisampleRenderTarget(zt),Ve.updateRenderTargetMipmap(zt),Bn.has("WEBGL_multisampled_render_to_texture")===!1){let pn=!1;for(let ki=0,qr=Se.length;ki<qr;ki++){let Rr=Se[ki],{object:ji,geometry:ao,material:Xt,group:Oa}=Rr;if(Xt.side===sr&&ji.layers.test(Le.layers)){let mi=Xt.side;Xt.side=hi,Xt.needsUpdate=!0,v4(ji,ke,Le,ao,Xt,Oa),Xt.side=mi,Xt.needsUpdate=!0,pn=!0}}pn===!0&&(Ve.updateMultisampleRenderTarget(zt),Ve.updateRenderTargetMipmap(zt))}z.setRenderTarget(kt,tn,hn),z.setClearColor(Ue,mt),Yn!==void 0&&(Le.viewport=Yn),z.toneMapping=zn}function ox(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,zn=Yt.material;zn.allowOverride===!0&&Le!==null&&(zn=Le),kt.layers.test(ke.layers)&&v4(kt,Se,ke,tn,zn,hn)}}function v4(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===sr&&De.forceSinglePass===!1?(De.side=hi,De.needsUpdate=!0,z.renderBufferDirect(ke,Se,Le,De,te,zt),De.side=_o,De.needsUpdate=!0,z.renderBufferDirect(ke,Se,Le,De,te,zt),De.side=sr):z.renderBufferDirect(ke,Se,Le,De,te,zt),te.onAfterRender(z,Se,ke,Le,De,zt)}function ax(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 zn=te.isMeshStandardMaterial||te.isMeshLambertMaterial&&!te.envMap||te.isMeshPhongMaterial&&!te.envMap;Le.envMap=gt.get(te.envMap||Le.environment,zn),Le.envMapRotation=Le.environment!==null&&te.envMap===null?Se.environmentRotation:te.envMapRotation,hn===void 0&&(te.addEventListener("dispose",_r),hn=new Map,Le.programs=hn);let Yn=hn.get(tn);if(Yn!==void 0){if(Le.currentProgram===Yn&&Le.lightsStateVersion===Yt)return w4(te,kt),Yn}else kt.uniforms=Rt.getUniforms(te),H!==null&&te.isNodeMaterial&&H.build(te,ke,kt),te.onBeforeCompile(kt,z),Yn=Rt.acquireProgram(kt,tn),hn.set(tn,Yn),Le.uniforms=kt.uniforms;let pn=Le.uniforms;return(!te.isShaderMaterial&&!te.isRawShaderMaterial||te.clipping===!0)&&(pn.clippingPlanes=cn.uniform),w4(te,kt),Le.needsLights=p9(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=Yn,Le.uniformsList=null,Yn}function b4(te){if(te.uniformsList===null){let Se=te.currentProgram.getUniforms();te.uniformsList=F_.seqWithValue(Se.seq,te.uniforms)}return te.uniformsList}function w4(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 h9(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 f9(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),zn=Le.vertexColors===!0&&!!ke.attributes.color&&ke.attributes.color.itemSize===4,Yn=!!ke.attributes.tangent&&(!!Le.normalMap||Le.anisotropy>0),pn=!!ke.morphAttributes.position,ki=!!ke.morphAttributes.normal,qr=!!ke.morphAttributes.color,Rr=Vs;Le.toneMapped&&(ae===null||ae.isXRRenderTarget===!0)&&(Rr=z.toneMapping);let ji=ke.morphAttributes.position||ke.morphAttributes.normal||ke.morphAttributes.color,ao=ji!==void 0?ji.length:0,Xt=Pe.get(Le),Oa=D.state.lights;if(st===!0&&(tt===!0||te!==de)){let nr=te===de&&Le.id===ce;cn.setState(Le,te,nr)}let mi=!1;Le.version===Xt.__version?(Xt.needsLights&&Xt.lightsStateVersion!==Oa.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!==zn||Xt.vertexTangents!==Yn||Xt.morphTargets!==pn||Xt.morphNormals!==ki||Xt.morphColors!==qr||Xt.toneMapping!==Rr||Xt.morphTargetsCount!==ao||!!Xt.lightProbeGrid!=D.state.lightProbeGridArray.length>0)&&(mi=!0):(mi=!0,Xt.__version=Le.version);let hl=Xt.currentProgram;mi===!0&&(hl=ax(Le,Se,De),H&&Le.isNodeMaterial&&H.onUpdateProgram(Le,hl,Xt));let vc=!1,Kh=!1,P0=!1,Xi=hl.getUniforms(),Hr=Xt.uniforms;if(X.useProgram(hl.program)&&(vc=!0,Kh=!0,P0=!0),Le.id!==ce&&(ce=Le.id,Kh=!0),Xt.needsLights){let nr=h9(D.state.lightProbeGridArray,De);Xt.lightProbeGrid!==nr&&(Xt.lightProbeGrid=nr,Kh=!0)}if(vc||de!==te){X.buffers.depth.getReversed()&&te.reversedDepth!==!0&&(te._reversedDepth=!0,te.updateProjectionMatrix()),Xi.setValue(ge,"projectionMatrix",te.projectionMatrix),Xi.setValue(ge,"viewMatrix",te.matrixWorldInverse);let Qh=Xi.map.cameraPosition;Qh!==void 0&&Qh.setValue(ge,yt.setFromMatrixPosition(te.matrixWorld)),le.logarithmicDepthBuffer&&Xi.setValue(ge,"logDepthBufFC",2/(Math.log(te.far+1)/Math.LN2)),(Le.isMeshPhongMaterial||Le.isMeshToonMaterial||Le.isMeshLambertMaterial||Le.isMeshBasicMaterial||Le.isMeshStandardMaterial||Le.isShaderMaterial)&&Xi.setValue(ge,"isOrthographic",te.isOrthographicCamera===!0),de!==te&&(de=te,Kh=!0,P0=!0)}if(Xt.needsLights&&(Oa.state.directionalShadowMap.length>0&&Xi.setValue(ge,"directionalShadowMap",Oa.state.directionalShadowMap,Ve),Oa.state.spotShadowMap.length>0&&Xi.setValue(ge,"spotShadowMap",Oa.state.spotShadowMap,Ve),Oa.state.pointShadowMap.length>0&&Xi.setValue(ge,"pointShadowMap",Oa.state.pointShadowMap,Ve)),De.isSkinnedMesh){Xi.setOptional(ge,De,"bindMatrix"),Xi.setOptional(ge,De,"bindMatrixInverse");let nr=De.skeleton;nr&&(nr.boneTexture===null&&nr.computeBoneTexture(),Xi.setValue(ge,"boneTexture",nr.boneTexture,Ve))}De.isBatchedMesh&&(Xi.setOptional(ge,De,"batchingTexture"),Xi.setValue(ge,"batchingTexture",De._matricesTexture,Ve),Xi.setOptional(ge,De,"batchingIdTexture"),Xi.setValue(ge,"batchingIdTexture",De._indirectTexture,Ve),Xi.setOptional(ge,De,"batchingColorTexture"),De._colorsTexture!==null&&Xi.setValue(ge,"batchingColorTexture",De._colorsTexture,Ve));let Zh=ke.morphAttributes;if((Zh.position!==void 0||Zh.normal!==void 0||Zh.color!==void 0)&&xe.update(De,ke,hl),(Kh||Xt.receiveShadow!==De.receiveShadow)&&(Xt.receiveShadow=De.receiveShadow,Xi.setValue(ge,"receiveShadow",De.receiveShadow)),(Le.isMeshStandardMaterial||Le.isMeshLambertMaterial||Le.isMeshPhongMaterial)&&Le.envMap===null&&Se.environment!==null&&(Hr.envMapIntensity.value=Se.environmentIntensity),Hr.dfgLUT!==void 0&&(Hr.dfgLUT.value=D0e()),Kh){if(Xi.setValue(ge,"toneMappingExposure",z.toneMappingExposure),Xt.needsLights&&d9(Hr,P0),zt&&Le.fog===!0&&en.refreshFogUniforms(Hr,zt),en.refreshMaterialUniforms(Hr,Le,$e,ze,D.state.transmissionRenderTarget[te.id]),Xt.needsLights&&Xt.lightProbeGrid){let nr=Xt.lightProbeGrid;Hr.probesSH.value=nr.texture,Hr.probesMin.value.copy(nr.boundingBox.min),Hr.probesMax.value.copy(nr.boundingBox.max),Hr.probesResolution.value.copy(nr.resolution)}F_.upload(ge,b4(Xt),Hr,Ve)}if(Le.isShaderMaterial&&Le.uniformsNeedUpdate===!0&&(F_.upload(ge,b4(Xt),Hr,Ve),Le.uniformsNeedUpdate=!1),Le.isSpriteMaterial&&Xi.setValue(ge,"center",De.center),Xi.setValue(ge,"modelViewMatrix",De.modelViewMatrix),Xi.setValue(ge,"normalMatrix",De.normalMatrix),Xi.setValue(ge,"modelMatrix",De.matrixWorld),Le.uniformsGroups!==void 0){let nr=Le.uniformsGroups;for(let Qh=0,I0=nr.length;Qh<I0;Qh++){let S4=nr[Qh];ct.update(S4,hl),ct.bind(S4,hl)}}return hl}function d9(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 p9(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),be.copy(te.viewport),Ie.copy(te.scissor),Qe=te.scissorTest,X.viewport(be),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 zn=te.depthTexture;if(kt.__boundDepthTexture!==zn){if(zn!==null&&Pe.has(zn)&&(te.width!==zn.image.width||te.height!==zn.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,be.copy(te.viewport),Ie.copy(te.scissor),Qe=te.scissorTest}else be.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(be),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],zn=hn.format,Yn=hn.type;if(te.textures.length>1&&ge.readBuffer(ge.COLOR_ATTACHMENT0+kt),!le.textureFormatReadable(zn)){Ge("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!le.textureTypeReadable(Yn)){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(zn),wt.convert(Yn),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],zn=hn.format,Yn=hn.type;if(te.textures.length>1&&ge.readBuffer(ge.COLOR_ATTACHMENT0+kt),!le.textureFormatReadable(zn))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!le.textureTypeReadable(Yn))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(zn),wt.convert(Yn),0);let ki=ae!==null?Pe.get(ae).__webglFramebuffer:null;X.bindFramebuffer(ge.FRAMEBUFFER,ki);let qr=ge.fenceSync(ge.SYNC_GPU_COMMANDS_COMPLETE,0);return ge.flush(),await xW(ge,qr,4),ge.bindBuffer(ge.PIXEL_PACK_BUFFER,pn),ge.getBufferSubData(ge.PIXEL_PACK_BUFFER,0,zt),ge.deleteBuffer(pn),ge.deleteSync(qr),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,zn,Yn,pn,ki,qr,Rr=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,zn=ke.min.y,Yn=ke.isBox3?ke.min.z:0;else{let Hr=Math.pow(2,-De);Yt=Math.floor(Rr.width*Hr),kt=Math.floor(Rr.height*Hr),te.isDataArrayTexture?tn=Rr.depth:te.isData3DTexture?tn=Math.floor(Rr.depth*Hr):tn=1,hn=0,zn=0,Yn=0}Le!==null?(pn=Le.x,ki=Le.y,qr=Le.z):(pn=0,ki=0,qr=0);let ji=wt.convert(Se.format),ao=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 Oa=X.getParameter(ge.UNPACK_ROW_LENGTH),mi=X.getParameter(ge.UNPACK_IMAGE_HEIGHT),hl=X.getParameter(ge.UNPACK_SKIP_PIXELS),vc=X.getParameter(ge.UNPACK_SKIP_ROWS),Kh=X.getParameter(ge.UNPACK_SKIP_IMAGES);X.pixelStorei(ge.UNPACK_ROW_LENGTH,Rr.width),X.pixelStorei(ge.UNPACK_IMAGE_HEIGHT,Rr.height),X.pixelStorei(ge.UNPACK_SKIP_PIXELS,hn),X.pixelStorei(ge.UNPACK_SKIP_ROWS,zn),X.pixelStorei(ge.UNPACK_SKIP_IMAGES,Yn);let P0=te.isDataArrayTexture||te.isData3DTexture,Xi=Se.isDataArrayTexture||Se.isData3DTexture;if(te.isDepthTexture){let Hr=Pe.get(te),Zh=Pe.get(Se),nr=Pe.get(Hr.__renderTarget),Qh=Pe.get(Zh.__renderTarget);X.bindFramebuffer(ge.READ_FRAMEBUFFER,nr.__webglFramebuffer),X.bindFramebuffer(ge.DRAW_FRAMEBUFFER,Qh.__webglFramebuffer);for(let I0=0;I0<tn;I0++)P0&&(ge.framebufferTextureLayer(ge.READ_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,Pe.get(te).__webglTexture,De,Yn+I0),ge.framebufferTextureLayer(ge.DRAW_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,Pe.get(Se).__webglTexture,zt,qr+I0)),ge.blitFramebuffer(hn,zn,Yt,kt,pn,ki,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 Hr=Pe.get(te),Zh=Pe.get(Se);X.bindFramebuffer(ge.READ_FRAMEBUFFER,J),X.bindFramebuffer(ge.DRAW_FRAMEBUFFER,j);for(let nr=0;nr<tn;nr++)P0?ge.framebufferTextureLayer(ge.READ_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,Hr.__webglTexture,De,Yn+nr):ge.framebufferTexture2D(ge.READ_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,ge.TEXTURE_2D,Hr.__webglTexture,De),Xi?ge.framebufferTextureLayer(ge.DRAW_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,Zh.__webglTexture,zt,qr+nr):ge.framebufferTexture2D(ge.DRAW_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,ge.TEXTURE_2D,Zh.__webglTexture,zt),De!==0?ge.blitFramebuffer(hn,zn,Yt,kt,pn,ki,Yt,kt,ge.COLOR_BUFFER_BIT,ge.NEAREST):Xi?ge.copyTexSubImage3D(Xt,zt,pn,ki,qr+nr,hn,zn,Yt,kt):ge.copyTexSubImage2D(Xt,zt,pn,ki,hn,zn,Yt,kt);X.bindFramebuffer(ge.READ_FRAMEBUFFER,null),X.bindFramebuffer(ge.DRAW_FRAMEBUFFER,null)}else Xi?te.isDataTexture||te.isData3DTexture?ge.texSubImage3D(Xt,zt,pn,ki,qr,Yt,kt,tn,ji,ao,Rr.data):Se.isCompressedArrayTexture?ge.compressedTexSubImage3D(Xt,zt,pn,ki,qr,Yt,kt,tn,ji,Rr.data):ge.texSubImage3D(Xt,zt,pn,ki,qr,Yt,kt,tn,ji,ao,Rr):te.isDataTexture?ge.texSubImage2D(ge.TEXTURE_2D,zt,pn,ki,Yt,kt,ji,ao,Rr.data):te.isCompressedTexture?ge.compressedTexSubImage2D(ge.TEXTURE_2D,zt,pn,ki,Rr.width,Rr.height,ji,Rr.data):ge.texSubImage2D(ge.TEXTURE_2D,zt,pn,ki,Yt,kt,ji,ao,Rr);X.pixelStorei(ge.UNPACK_ROW_LENGTH,Oa),X.pixelStorei(ge.UNPACK_IMAGE_HEIGHT,mi),X.pixelStorei(ge.UNPACK_SKIP_PIXELS,hl),X.pixelStorei(ge.UNPACK_SKIP_ROWS,vc),X.pixelStorei(ge.UNPACK_SKIP_IMAGES,Kh),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 go}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 y3=class extends Ki{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}},B_=new ie,ij=new on,rj=new on,sj=new ie,oj=new ie,v3=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(),ij.copy(w.matrixWorldInverse),rj.multiplyMatrices(w.projectionMatrix,ij),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){B_.setFromMatrixPosition(v.matrixWorld),B_.applyMatrix4(rj);let T=B_.z>=-1&&B_.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("+(B_.x*s+s)+"px,"+(-B_.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 sj.setFromMatrixPosition(v.matrixWorld),oj.setFromMatrixPosition(w.matrixWorld),sj.distanceToSquared(oj)}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 F0e(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var F2=F0e;var O0e=typeof global=="object"&&global&&global.Object===Object&&global,aj=O0e;var B0e=typeof self=="object"&&self&&self.Object===Object&&self,U0e=aj||B0e||Function("return this")(),b3=U0e;var k0e=function(){return b3.Date.now()},w3=k0e;var G0e=/\s/;function z0e(i){for(var e=i.length;e--&&G0e.test(i.charAt(e)););return e}var lj=z0e;var V0e=/^\s+/;function q0e(i){return i&&i.slice(0,lj(i)+1).replace(V0e,"")}var cj=q0e;var H0e=b3.Symbol,U_=H0e;var uj=Object.prototype,W0e=uj.hasOwnProperty,j0e=uj.toString,O2=U_?U_.toStringTag:void 0;function X0e(i){var e=W0e.call(i,O2),t=i[O2];try{i[O2]=void 0;var n=!0}catch{}var r=j0e.call(i);return n&&(e?i[O2]=t:delete i[O2]),r}var hj=X0e;var $0e=Object.prototype,Y0e=$0e.toString;function K0e(i){return Y0e.call(i)}var fj=K0e;var Z0e="[object Null]",Q0e="[object Undefined]",dj=U_?U_.toStringTag:void 0;function J0e(i){return i==null?i===void 0?Q0e:Z0e:dj&&dj in Object(i)?hj(i):fj(i)}var pj=J0e;function eAe(i){return i!=null&&typeof i=="object"}var Aj=eAe;var tAe="[object Symbol]";function nAe(i){return typeof i=="symbol"||Aj(i)&&pj(i)==tAe}var mj=nAe;var gj=NaN,iAe=/^[-+]0x[0-9a-f]+$/i,rAe=/^0b[01]+$/i,sAe=/^0o[0-7]+$/i,oAe=parseInt;function aAe(i){if(typeof i=="number")return i;if(mj(i))return gj;if(F2(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=F2(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=cj(i);var t=rAe.test(i);return t||sAe.test(i)?oAe(i.slice(2),t?2:8):iAe.test(i)?gj:+i}var fD=aAe;var lAe="Expected a function",cAe=Math.max,uAe=Math.min;function hAe(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(lAe);e=fD(e)||0,F2(t)&&(u=!!t.leading,f="maxWait"in t,s=f?cAe(fD(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?uAe(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=w3();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(w3())}function L(){var D=w3(),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 _j=hAe;function xj(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 fAe(i){if(Array.isArray(i))return i}function dAe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function pAe(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function AAe(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 mAe(){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 gAe(i,e){return fAe(i)||AAe(i,e)||_Ae(i,e)||mAe()}function _Ae(i,e){if(i){if(typeof i=="string")return xj(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)?xj(i,e):void 0}}var xAe=pAe(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;dAe(this,i),this.name=e,this.defaultVal=r,this.triggerUpdate=o,this.onChange=l});function Or(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 xAe(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=_j(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(be,Ie){}:ee,ce=K.defaultVal,de=ce===void 0?null:ce;return function(be){var Ie=D[J];if(!arguments.length)return Ie;var Qe=be===void 0?de:be;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=gAe(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 Br=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-Br.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?Br.Bounce.In(i*2)*.5:Br.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}}}}),B2=function(){return performance.now()},tm=(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=B2()),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})(),k_={Linear:function(i,e){var t=i.length-1,n=t*e,r=Math.floor(n),s=k_.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=k_.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=k_.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=k_.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}}},yj=(function(){function i(){}return i.nextId=function(){return i._nextId++},i._nextId=0,i})(),dD=new tm,Ws=(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=Br.Linear.None,this._interpolationFunction=k_.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=yj.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=dD,dD.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=B2()),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=B2()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this)},i.prototype.resume=function(e){return e===void 0&&(e=B2()),!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=Br.Linear.None),this._easingFunction=e,this},i.prototype.interpolation=function(e){return e===void 0&&(e=k_.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=B2()),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 sWe=yj.nextId,lh=dD,oWe=lh.getAll.bind(lh),aWe=lh.removeAll.bind(lh),lWe=lh.add.bind(lh),cWe=lh.remove.bind(lh),uWe=lh.update.bind(lh);function vj(i){let e=+this._x.call(null,i),t=+this._y.call(null,i),n=+this._z.call(null,i);return bj(this.cover(e,t,n),e,t,n,i)}function bj(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 wj(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)bj(this,t[f],n[f],r[f],i[f]);return this}function Sj(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 Tj(){var i=[];return this.visit(function(e){if(!e.length)do i.push(e.data);while(e=e.next)}),i}function Ej(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 Oi(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 Mj(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 Oi(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 Oi(P[7],L,D,F,f,p,x),new Oi(P[6],l,D,F,L,p,x),new Oi(P[5],L,c,F,f,D,x),new Oi(P[4],l,c,F,L,D,x),new Oi(P[3],L,D,u,f,p,F),new Oi(P[2],l,D,u,L,p,F),new Oi(P[1],L,c,u,f,D,F),new Oi(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 yAe=(i,e,t,n,r,s)=>Math.sqrt((i-n)**2+(e-r)**2+(t-s)**2);function Cj(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;yAe(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 Rj(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 Pj(i){for(var e=0,t=i.length;e<t;++e)this.remove(i[e]);return this}function Ij(){return this._root}function Nj(){var i=0;return this.visit(function(e){if(!e.length)do++i;while(e=e.next)}),i}function Lj(i){var e=[],t,n=this._root,r,s,o,a,l,c,u;for(n&&e.push(new Oi(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 Oi(r,f,p,x,l,c,u)),(r=n[6])&&e.push(new Oi(r,s,p,x,f,c,u)),(r=n[5])&&e.push(new Oi(r,f,o,x,l,p,u)),(r=n[4])&&e.push(new Oi(r,s,o,x,f,p,u)),(r=n[3])&&e.push(new Oi(r,f,p,a,l,c,x)),(r=n[2])&&e.push(new Oi(r,s,p,a,f,c,x)),(r=n[1])&&e.push(new Oi(r,f,o,a,l,p,x)),(r=n[0])&&e.push(new Oi(r,s,o,a,f,p,x))}return this}function Dj(i){var e=[],t=[],n;for(this._root&&e.push(new Oi(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 Oi(s,o,a,l,p,x,v)),(s=r[1])&&e.push(new Oi(s,p,a,l,c,x,v)),(s=r[2])&&e.push(new Oi(s,o,x,l,p,u,v)),(s=r[3])&&e.push(new Oi(s,p,x,l,c,u,v)),(s=r[4])&&e.push(new Oi(s,o,a,v,p,x,f)),(s=r[5])&&e.push(new Oi(s,p,a,v,c,x,f)),(s=r[6])&&e.push(new Oi(s,o,x,v,p,u,f)),(s=r[7])&&e.push(new Oi(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 Fj(i){return i[0]}function Oj(i){return arguments.length?(this._x=i,this):this._x}function Bj(i){return i[1]}function Uj(i){return arguments.length?(this._y=i,this):this._y}function kj(i){return i[2]}function Gj(i){return arguments.length?(this._z=i,this):this._z}function U2(i,e,t,n){var r=new pD(e??Fj,t??Bj,n??kj,NaN,NaN,NaN,NaN,NaN,NaN);return i==null?r:r.addAll(i)}function pD(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 zj(i){for(var e={data:i.data},t=e;i=i.next;)t=t.next={data:i.data};return e}var vo=U2.prototype=pD.prototype;vo.copy=function(){var i=new pD(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=zj(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]=zj(n));return i};vo.add=vj;vo.addAll=wj;vo.cover=Sj;vo.data=Tj;vo.extent=Ej;vo.find=Mj;vo.findAllWithinRadius=Cj;vo.remove=Rj;vo.removeAll=Pj;vo.root=Ij;vo.size=Nj;vo.visit=Lj;vo.visitAfter=Dj;vo.x=Oj;vo.y=Uj;vo.z=Gj;function nm(i,e){return i==null||e==null?NaN:i<e?-1:i>e?1:i>=e?0:NaN}function AD(i,e){return i==null||e==null?NaN:e<i?-1:e>i?1:e>=i?0:NaN}function S3(i){let e,t,n;i.length!==2?(e=nm,t=(a,l)=>nm(i(a),l),n=(a,l)=>i(a)-l):(e=i===nm||i===AD?i:vAe,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 vAe(){return 0}function mD(i){return i===null?NaN:+i}var Vj=S3(nm),qj=Vj.right,bAe=Vj.left,wAe=S3(mD).center,k2=qj;function kp(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 bo=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 SAe=Math.sqrt(50),TAe=Math.sqrt(10),EAe=Math.sqrt(2);function T3(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>=SAe?10:s>=TAe?5:s>=EAe?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?T3(i,e,t*2):[a,l,c]}function E3(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?T3(e,i,t):T3(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 G2(i,e,t){return e=+e,i=+i,t=+t,T3(i,e,t)[2]}function gD(i,e,t){e=+e,i=+i,t=+t;let n=e<i,r=n?G2(e,i,t):G2(i,e,t);return(n?-1:1)*(r<0?1/-r:r)}function M3(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 C3(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*MAe(i){for(let e of i)yield*e}function ch(i){return Array.from(MAe(i))}function Vf(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 R3(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 P3(i,e){switch(arguments.length){case 0:break;case 1:this.range(i);break;default:this.range(e).domain(i);break}return this}function I3(i,e,t){i.prototype=e.prototype=t,t.constructor=i}function _D(i,e){var t=Object.create(i.prototype);for(var n in e)t[n]=e[n];return t}function q2(){}var z2=.7,D3=1/z2,G_="\\s*([+-]?\\d+)\\s*",V2="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",uh="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",CAe=/^#([0-9a-f]{3,8})$/,RAe=new RegExp(`^rgb\\(${G_},${G_},${G_}\\)$`),PAe=new RegExp(`^rgb\\(${uh},${uh},${uh}\\)$`),IAe=new RegExp(`^rgba\\(${G_},${G_},${G_},${V2}\\)$`),NAe=new RegExp(`^rgba\\(${uh},${uh},${uh},${V2}\\)$`),LAe=new RegExp(`^hsl\\(${V2},${uh},${uh}\\)$`),DAe=new RegExp(`^hsla\\(${V2},${uh},${uh},${V2}\\)$`),Hj={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};I3(q2,Zc,{copy(i){return Object.assign(new this.constructor,this,i)},displayable(){return this.rgb().displayable()},hex:Wj,formatHex:Wj,formatHex8:FAe,formatHsl:OAe,formatRgb:jj,toString:jj});function Wj(){return this.rgb().formatHex()}function FAe(){return this.rgb().formatHex8()}function OAe(){return Qj(this).formatHsl()}function jj(){return this.rgb().formatRgb()}function Zc(i){var e,t;return i=(i+"").trim().toLowerCase(),(e=CAe.exec(i))?(t=e[1].length,e=parseInt(e[1],16),t===6?Xj(e):t===3?new Za(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?N3(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?N3(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=RAe.exec(i))?new Za(e[1],e[2],e[3],1):(e=PAe.exec(i))?new Za(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=IAe.exec(i))?N3(e[1],e[2],e[3],e[4]):(e=NAe.exec(i))?N3(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=LAe.exec(i))?Kj(e[1],e[2]/100,e[3]/100,1):(e=DAe.exec(i))?Kj(e[1],e[2]/100,e[3]/100,e[4]):Hj.hasOwnProperty(i)?Xj(Hj[i]):i==="transparent"?new Za(NaN,NaN,NaN,0):null}function Xj(i){return new Za(i>>16&255,i>>8&255,i&255,1)}function N3(i,e,t,n){return n<=0&&(i=e=t=NaN),new Za(i,e,t,n)}function BAe(i){return i instanceof q2||(i=Zc(i)),i?(i=i.rgb(),new Za(i.r,i.g,i.b,i.opacity)):new Za}function z_(i,e,t,n){return arguments.length===1?BAe(i):new Za(i,e,t,n??1)}function Za(i,e,t,n){this.r=+i,this.g=+e,this.b=+t,this.opacity=+n}I3(Za,z_,_D(q2,{brighter(i){return i=i==null?D3:Math.pow(D3,i),new Za(this.r*i,this.g*i,this.b*i,this.opacity)},darker(i){return i=i==null?z2:Math.pow(z2,i),new Za(this.r*i,this.g*i,this.b*i,this.opacity)},rgb(){return this},clamp(){return new Za(rm(this.r),rm(this.g),rm(this.b),F3(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:$j,formatHex:$j,formatHex8:UAe,formatRgb:Yj,toString:Yj}));function $j(){return`#${im(this.r)}${im(this.g)}${im(this.b)}`}function UAe(){return`#${im(this.r)}${im(this.g)}${im(this.b)}${im((isNaN(this.opacity)?1:this.opacity)*255)}`}function Yj(){let i=F3(this.opacity);return`${i===1?"rgb(":"rgba("}${rm(this.r)}, ${rm(this.g)}, ${rm(this.b)}${i===1?")":`, ${i})`}`}function F3(i){return isNaN(i)?1:Math.max(0,Math.min(1,i))}function rm(i){return Math.max(0,Math.min(255,Math.round(i)||0))}function im(i){return i=rm(i),(i<16?"0":"")+i.toString(16)}function Kj(i,e,t,n){return n<=0?i=e=t=NaN:t<=0||t>=1?i=e=NaN:e<=0&&(i=NaN),new Kc(i,e,t,n)}function Qj(i){if(i instanceof Kc)return new Kc(i.h,i.s,i.l,i.opacity);if(i instanceof q2||(i=Zc(i)),!i)return new Kc;if(i instanceof Kc)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 Kc(o,a,l,i.opacity)}function Jj(i,e,t,n){return arguments.length===1?Qj(i):new Kc(i,e,t,n??1)}function Kc(i,e,t,n){this.h=+i,this.s=+e,this.l=+t,this.opacity=+n}I3(Kc,Jj,_D(q2,{brighter(i){return i=i==null?D3:Math.pow(D3,i),new Kc(this.h,this.s,this.l*i,this.opacity)},darker(i){return i=i==null?z2:Math.pow(z2,i),new Kc(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 Za(xD(i>=240?i-240:i+120,r,n),xD(i,r,n),xD(i<120?i+240:i-120,r,n),this.opacity)},clamp(){return new Kc(Zj(this.h),L3(this.s),L3(this.l),F3(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=F3(this.opacity);return`${i===1?"hsl(":"hsla("}${Zj(this.h)}, ${L3(this.s)*100}%, ${L3(this.l)*100}%${i===1?")":`, ${i})`}`}}));function Zj(i){return i=(i||0)%360,i<0?i+360:i}function L3(i){return Math.max(0,Math.min(1,i||0))}function xD(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 yD(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 eX(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 yD((t-n/e)*e,o,r,s,a)}}function tX(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 yD((t-n/e)*e,r,s,o,a)}}var H2=i=>()=>i;function kAe(i,e){return function(t){return i+t*e}}function GAe(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 nX(i){return(i=+i)==1?O3:function(e,t){return t-e?GAe(e,t,i):H2(isNaN(e)?t:e)}}function O3(i,e){var t=e-i;return t?kAe(i,t):H2(isNaN(i)?e:i)}var vD=(function i(e){var t=nX(e);function n(r,s){var o=t((r=z_(r)).r,(s=z_(s)).r),a=t(r.g,s.g),l=t(r.b,s.b),c=O3(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 iX(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=z_(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 kje=iX(eX),Gje=iX(tX);function B3(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 U3(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function bD(i,e){return(U3(e)?B3:wD)(i,e)}function wD(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]=sm(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 rX(i,e){var t=new Date;return i=+i,e=+e,function(n){return t.setTime(i*(1-n)+e*n),t}}function hh(i,e){return i=+i,e=+e,function(t){return i*(1-t)+e*t}}function sX(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]=sm(i[r],e[r]):n[r]=e[r];return function(s){for(r in t)n[r]=t[r](s);return n}}var TD=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,SD=new RegExp(TD.source,"g");function zAe(i){return function(){return i}}function VAe(i){return function(e){return i(e)+""}}function oX(i,e){var t=TD.lastIndex=SD.lastIndex=0,n,r,s,o=-1,a=[],l=[];for(i=i+"",e=e+"";(n=TD.exec(i))&&(r=SD.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:hh(n,r)})),t=SD.lastIndex;return t<e.length&&(s=e.slice(t),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?VAe(l[0].x):zAe(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 sm(i,e){var t=typeof e,n;return e==null||t==="boolean"?H2(e):(t==="number"?hh:t==="string"?(n=Zc(e))?(e=n,vD):oX:e instanceof Zc?vD:e instanceof Date?rX:U3(e)?B3:Array.isArray(e)?wD:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?sX:hh)(i,e)}function ED(i,e){return i=+i,e=+e,function(t){return Math.round(i*(1-t)+e*t)}}function MD(i){return function(){return i}}function CD(i){return+i}var aX=[0,1];function V_(i){return i}function RD(i,e){return(e-=i=+i)?function(t){return(t-i)/e}:MD(isNaN(e)?NaN:.5)}function qAe(i,e){var t;return i>e&&(t=i,i=e,e=t),function(n){return Math.max(i,Math.min(e,n))}}function HAe(i,e,t){var n=i[0],r=i[1],s=e[0],o=e[1];return r<n?(n=RD(r,n),s=t(o,s)):(n=RD(n,r),s=t(s,o)),function(a){return s(n(a))}}function WAe(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]=RD(i[o],i[o+1]),s[o]=t(e[o],e[o+1]);return function(a){var l=k2(i,a,1,n)-1;return s[l](r[l](a))}}function lX(i,e){return e.domain(i.domain()).range(i.range()).interpolate(i.interpolate()).clamp(i.clamp()).unknown(i.unknown())}function jAe(){var i=aX,e=aX,t=sm,n,r,s,o=V_,a,l,c;function u(){var p=Math.min(i.length,e.length);return o!==V_&&(o=qAe(i[0],i[p-1])),a=p>2?WAe:HAe,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),hh)))(p)))},f.domain=function(p){return arguments.length?(i=Array.from(p,CD),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:V_,u()):o!==V_},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 PD(){return jAe()(V_,V_)}function cX(i){return Math.abs(i=Math.round(i))>=1e21?i.toLocaleString("en").replace(/,/g,""):i.toString(10)}function om(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 fh(i){return i=om(Math.abs(i)),i?i[1]:NaN}function uX(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 hX(i){return function(e){return e.replace(/[0-9]/g,function(t){return i[+t]})}}var XAe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Gp(i){if(!(e=XAe.exec(i)))throw new Error("invalid format: "+i);var e;return new k3({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]})}Gp.prototype=k3.prototype;function k3(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+""}k3.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 fX(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 W2;function dX(i,e){var t=om(i,e);if(!t)return W2=void 0,i.toPrecision(e);var n=t[0],r=t[1],s=r-(W2=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")+om(i,Math.max(0,e+s-1))[0]}function ID(i,e){var t=om(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 ND={"%":(i,e)=>(i*100).toFixed(e),b:i=>Math.round(i).toString(2),c:i=>i+"",d:cX,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)=>ID(i*100,e),r:ID,s:dX,X:i=>Math.round(i).toString(16).toUpperCase(),x:i=>Math.round(i).toString(16)};function LD(i){return i}var pX=Array.prototype.map,AX=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function mX(i){var e=i.grouping===void 0||i.thousands===void 0?LD:uX(pX.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?LD:hX(pX.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=Gp(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"):ND[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=ND[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=fX(H)),ae&&+H==0&&w!=="+"&&(ae=!1),K=(ae?w==="("?w:a:w==="-"||w==="("?"":w)+K,J=(D==="s"&&!isNaN(H)&&W2!==void 0?AX[8+W2/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(fh(p)/3)))*3,v=Math.pow(10,-x),w=c((f=Gp(f),f.type="f",f),{suffix:AX[8+x/3]});return function(S){return w(v*S)}}return{format:c,formatPrefix:u}}var G3,z3,V3;DD({thousands:",",grouping:[3],currency:["$",""]});function DD(i){return G3=mX(i),z3=G3.format,V3=G3.formatPrefix,G3}function FD(i){return Math.max(0,-fh(Math.abs(i)))}function OD(i,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(fh(e)/3)))*3-fh(Math.abs(i)))}function BD(i,e){return i=Math.abs(i),e=Math.abs(e)-i,Math.max(0,fh(e)-fh(i))+1}function UD(i,e,t,n){var r=gD(i,e,t),s;switch(n=Gp(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(i),Math.abs(e));return n.precision==null&&!isNaN(s=OD(r,o))&&(n.precision=s),V3(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(s=BD(r,Math.max(Math.abs(i),Math.abs(e))))&&(n.precision=s-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(s=FD(r))&&(n.precision=s-(n.type==="%")*2);break}}return z3(n)}function kD(i){var e=i.domain;return i.ticks=function(t){var n=e();return E3(n[0],n[n.length-1],t??10)},i.tickFormat=function(t,n){var r=e();return UD(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=G2(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 Qa(){var i=PD();return i.copy=function(){return lX(i,Qa())},P3.apply(i,arguments),kD(i)}function j2(){var i=0,e=1,t=1,n=[.5],r=[0,1],s;function o(l){return l!=null&&l<=l?r[k2(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 j2().domain([i,e]).range(r).unknown(s)},P3.apply(kD(o),arguments)}var Cn=1e-6,am=1e-12,ei=Math.PI,to=ei/2,q_=ei/4,no=ei*2,Qi=180/ei,mn=ei/180,ti=Math.abs,H_=Math.atan,hs=Math.atan2,fn=Math.cos,X2=Math.ceil,gX=Math.exp;var q3=Math.hypot,_X=Math.log;var an=Math.sin,xX=Math.sign||function(i){return i>0?1:i<0?-1:0},wo=Math.sqrt,yX=Math.tan;function vX(i){return i>1?0:i<-1?ei:Math.acos(i)}function Xo(i){return i>1?to:i<-1?-to:Math.asin(i)}function GD(i){return(i=an(i/2))*i}function Qr(){}function H3(i,e){i&&wX.hasOwnProperty(i.type)&&wX[i.type](i,e)}var bX={Feature:function(i,e){H3(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)H3(t[n].geometry,e)}},wX={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){zD(i.coordinates,e,0)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)zD(t[n],e,0)},Polygon:function(i,e){SX(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)SX(t[n],e)},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)H3(t[n],e)}};function zD(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 SX(i,e){var t=-1,n=i.length;for(e.polygonStart();++t<n;)zD(i[t],e,1);e.polygonEnd()}function zp(i,e){i&&bX.hasOwnProperty(i.type)?bX[i.type](i,e):H3(i,e)}var $2=new bo,TX=new bo,EX,MX,VD,qD,HD,dh={point:Qr,lineStart:Qr,lineEnd:Qr,polygonStart:function(){$2=new bo,dh.lineStart=$Ae,dh.lineEnd=YAe},polygonEnd:function(){var i=+$2;TX.add(i<0?no+i:i),this.lineStart=this.lineEnd=this.point=Qr},sphere:function(){TX.add(no)}};function $Ae(){dh.point=KAe}function YAe(){CX(EX,MX)}function KAe(i,e){dh.point=CX,EX=i,MX=e,i*=mn,e*=mn,VD=i,qD=fn(e=e/2+q_),HD=an(e)}function CX(i,e){i*=mn,e*=mn,e=e/2+q_;var t=i-VD,n=t>=0?1:-1,r=n*t,s=fn(e),o=an(e),a=HD*o,l=qD*s+a*fn(r),c=a*n*an(r);$2.add(hs(c,l)),VD=i,qD=s,HD=o}function lm(i){return[hs(i[1],i[0]),Xo(i[2])]}function sc(i){var e=i[0],t=i[1],n=fn(t);return[n*fn(e),n*an(e),an(t)]}function Y2(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function qf(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 W3(i,e){i[0]+=e[0],i[1]+=e[1],i[2]+=e[2]}function K2(i,e){return[i[0]*e,i[1]*e,i[2]*e]}function cm(i){var e=wo(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);i[0]/=e,i[1]/=e,i[2]/=e}var Ur,Ja,Jr,Tl,um,NX,LX,W_,Z2,Vp,Wf,Hf={point:WD,lineStart:RX,lineEnd:PX,polygonStart:function(){Hf.point=FX,Hf.lineStart=ZAe,Hf.lineEnd=QAe,Z2=new bo,dh.polygonStart()},polygonEnd:function(){dh.polygonEnd(),Hf.point=WD,Hf.lineStart=RX,Hf.lineEnd=PX,$2<0?(Ur=-(Jr=180),Ja=-(Tl=90)):Z2>Cn?Tl=90:Z2<-Cn&&(Ja=-90),Wf[0]=Ur,Wf[1]=Jr},sphere:function(){Ur=-(Jr=180),Ja=-(Tl=90)}};function WD(i,e){Vp.push(Wf=[Ur=i,Jr=i]),e<Ja&&(Ja=e),e>Tl&&(Tl=e)}function DX(i,e){var t=sc([i*mn,e*mn]);if(W_){var n=qf(W_,t),r=[n[1],-n[0],0],s=qf(r,n);cm(s),s=lm(s);var o=i-um,a=o>0?1:-1,l=s[0]*Qi*a,c,u=ti(o)>180;u^(a*um<l&&l<a*i)?(c=s[1]*Qi,c>Tl&&(Tl=c)):(l=(l+360)%360-180,u^(a*um<l&&l<a*i)?(c=-s[1]*Qi,c<Ja&&(Ja=c)):(e<Ja&&(Ja=e),e>Tl&&(Tl=e))),u?i<um?Sl(Ur,i)>Sl(Ur,Jr)&&(Jr=i):Sl(i,Jr)>Sl(Ur,Jr)&&(Ur=i):Jr>=Ur?(i<Ur&&(Ur=i),i>Jr&&(Jr=i)):i>um?Sl(Ur,i)>Sl(Ur,Jr)&&(Jr=i):Sl(i,Jr)>Sl(Ur,Jr)&&(Ur=i)}else Vp.push(Wf=[Ur=i,Jr=i]);e<Ja&&(Ja=e),e>Tl&&(Tl=e),W_=t,um=i}function RX(){Hf.point=DX}function PX(){Wf[0]=Ur,Wf[1]=Jr,Hf.point=WD,W_=null}function FX(i,e){if(W_){var t=i-um;Z2.add(ti(t)>180?t+(t>0?360:-360):t)}else NX=i,LX=e;dh.point(i,e),DX(i,e)}function ZAe(){dh.lineStart()}function QAe(){FX(NX,LX),dh.lineEnd(),ti(Z2)>Cn&&(Ur=-(Jr=180)),Wf[0]=Ur,Wf[1]=Jr,W_=null}function Sl(i,e){return(e-=i)<0?e+360:e}function JAe(i,e){return i[0]-e[0]}function IX(i,e){return i[0]<=i[1]?i[0]<=e&&e<=i[1]:e<i[0]||i[1]<e}function j3(i){var e,t,n,r,s,o,a;if(Tl=Jr=-(Ur=Ja=1/0),Vp=[],zp(i,Hf),t=Vp.length){for(Vp.sort(JAe),e=1,n=Vp[0],s=[n];e<t;++e)r=Vp[e],IX(n,r[0])||IX(n,r[1])?(Sl(n[0],r[1])>Sl(n[0],n[1])&&(n[1]=r[1]),Sl(r[0],n[1])>Sl(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=Sl(n[1],r[0]))>o&&(o=a,Ur=r[0],Jr=n[1])}return Vp=Wf=null,Ur===1/0||Ja===1/0?[[NaN,NaN],[NaN,NaN]]:[[Ur,Ja],[Jr,Tl]]}var Q2,X3,$3,Y3,K3,Z3,Q3,J3,jD,XD,$D,UX,kX,ba,wa,Sa,Qc={sphere:Qr,point:YD,lineStart:OX,lineEnd:BX,polygonStart:function(){Qc.lineStart=nme,Qc.lineEnd=ime},polygonEnd:function(){Qc.lineStart=OX,Qc.lineEnd=BX}};function YD(i,e){i*=mn,e*=mn;var t=fn(e);J2(t*fn(i),t*an(i),an(e))}function J2(i,e,t){++Q2,$3+=(i-$3)/Q2,Y3+=(e-Y3)/Q2,K3+=(t-K3)/Q2}function OX(){Qc.point=eme}function eme(i,e){i*=mn,e*=mn;var t=fn(e);ba=t*fn(i),wa=t*an(i),Sa=an(e),Qc.point=tme,J2(ba,wa,Sa)}function tme(i,e){i*=mn,e*=mn;var t=fn(e),n=t*fn(i),r=t*an(i),s=an(e),o=hs(wo((o=wa*s-Sa*r)*o+(o=Sa*n-ba*s)*o+(o=ba*r-wa*n)*o),ba*n+wa*r+Sa*s);X3+=o,Z3+=o*(ba+(ba=n)),Q3+=o*(wa+(wa=r)),J3+=o*(Sa+(Sa=s)),J2(ba,wa,Sa)}function BX(){Qc.point=YD}function nme(){Qc.point=rme}function ime(){GX(UX,kX),Qc.point=YD}function rme(i,e){UX=i,kX=e,i*=mn,e*=mn,Qc.point=GX;var t=fn(e);ba=t*fn(i),wa=t*an(i),Sa=an(e),J2(ba,wa,Sa)}function GX(i,e){i*=mn,e*=mn;var t=fn(e),n=t*fn(i),r=t*an(i),s=an(e),o=wa*s-Sa*r,a=Sa*n-ba*s,l=ba*r-wa*n,c=q3(o,a,l),u=Xo(c),f=c&&-u/c;jD.add(f*o),XD.add(f*a),$D.add(f*l),X3+=u,Z3+=u*(ba+(ba=n)),Q3+=u*(wa+(wa=r)),J3+=u*(Sa+(Sa=s)),J2(ba,wa,Sa)}function eE(i){Q2=X3=$3=Y3=K3=Z3=Q3=J3=0,jD=new bo,XD=new bo,$D=new bo,zp(i,Qc);var e=+jD,t=+XD,n=+$D,r=q3(e,t,n);return r<am&&(e=Z3,t=Q3,n=J3,X3<Cn&&(e=$3,t=Y3,n=K3),r=q3(e,t,n),r<am)?[NaN,NaN]:[hs(t,e)*Qi,Xo(n/r)*Qi]}function ev(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 KD(i,e){return ti(i)>ei&&(i-=Math.round(i/no)*no),[i,e]}KD.invert=KD;function ZD(i,e,t){return(i%=no)?e||t?ev(VX(i),qX(e,t)):VX(i):e||t?qX(e,t):KD}function zX(i){return function(e,t){return e+=i,ti(e)>ei&&(e-=Math.round(e/no)*no),[e,t]}}function VX(i){var e=zX(i);return e.invert=zX(-i),e}function qX(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[hs(f*r-x*s,u*t-p*n),Xo(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[hs(f*r+p*s,u*t+x*n),Xo(x*t-u*n)]},o}function QD(i){i=ZD(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]*=Qi,t[1]*=Qi,t}return e.invert=function(t){return t=i.invert(t[0]*mn,t[1]*mn),t[0]*=Qi,t[1]*=Qi,t},e}function WX(i,e,t,n,r,s){if(t){var o=fn(e),a=an(e),l=n*t;r==null?(r=e+n*no,s=e-l/2):(r=HX(o,r),s=HX(o,s),(n>0?r<s:r>s)&&(r+=n*no));for(var c,u=r;n>0?u>s:u<s;u-=l)c=lm([o,-a*fn(u),-a*an(u)]),i.point(c[0],c[1])}}function HX(i,e){e=sc(e),e[0]-=i,cm(e);var t=vX(-e[1]);return((-e[2]<0?-t:t)+no-Cn)%no}function tE(){var i=[],e;return{point:function(t,n,r){e.push([t,n,r])},lineStart:function(){i.push(e=[])},lineEnd:Qr,rejoin:function(){i.length>1&&i.push(i.pop().concat(i.shift()))},result:function(){var t=i;return i=[],e=null,t}}}function j_(i,e){return ti(i[0]-e[0])<Cn&&ti(i[1]-e[1])<Cn}function nE(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 iE(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(j_(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 nE(S,v,null,!0)),o.push(P.o=new nE(S,null,P,!1)),s.push(P=new nE(T,v,null,!1)),o.push(P.o=new nE(T,null,P,!0))}}),!!s.length){for(o.sort(e),jX(s),jX(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 jX(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 JD(i){return ti(i[0])<=ei?i[0]:xX(i[0])*((ti(i[0])+ei)%no-ei)}function rE(i,e){var t=JD(e),n=e[1],r=an(n),s=[an(t),-fn(t),0],o=0,a=0,l=new bo;r===1?n=to+Cn:r===-1&&(n=-to-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=JD(x),w=x[1]/2+q_,S=an(w),T=fn(w),P=0;P<p;++P,v=C,S=D,T=F,x=R){var R=f[P],C=JD(R),L=R[1]/2+q_,D=an(L),F=fn(L),N=C-v,B=N>=0?1:-1,z=B*N,V=z>ei,H=S*D;if(l.add(hs(H*B*an(z),T*F+H*fn(z))),o+=V?N+B*no:N,V^v>=t^C>=t){var K=qf(sc(x),sc(R));cm(K);var J=qf(s,K);cm(J);var j=(V^N>=0?-1:1)*Xo(J[2]);(n>j||n===j&&(K[0]||K[1]))&&(a+=V^N>=0?1:-1)}}return(o<-Cn||o<Cn&&l<-am)^a&1}function sE(i,e,t,n){return function(r){var s=e(r),o=tE(),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=ch(u);var C=rE(c,n);u.length?(l||(r.polygonStart(),l=!0),iE(u,ome,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(sme))}}return p}}function sme(i){return i.length>1}function ome(i,e){return((i=i.x)[0]<0?i[1]-to-Cn:to-i[1])-((e=e.x)[0]<0?e[1]-to-Cn:to-e[1])}var e6=sE(function(){return!0},ame,cme,[-ei,-to]);function ame(i){var e=NaN,t=NaN,n=NaN,r;return{lineStart:function(){i.lineStart(),r=1},point:function(s,o){var a=s>0?ei:-ei,l=ti(s-e);ti(l-ei)<Cn?(i.point(e,t=(t+o)/2>0?to:-to),i.point(n,t),i.lineEnd(),i.lineStart(),i.point(a,t),i.point(s,t),r=0):n!==a&&l>=ei&&(ti(e-n)<Cn&&(e-=n*Cn),ti(s-a)<Cn&&(s-=a*Cn),t=lme(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 lme(i,e,t,n){var r,s,o=an(i-t);return ti(o)>Cn?H_((an(e)*(s=fn(n))*an(t)-an(n)*(r=fn(e))*an(i))/(r*s*o)):(e+n)/2}function cme(i,e,t,n){var r;if(i==null)r=t*to,n.point(-ei,r),n.point(0,r),n.point(ei,r),n.point(ei,0),n.point(ei,-r),n.point(0,-r),n.point(-ei,-r),n.point(-ei,0),n.point(-ei,r);else if(ti(i[0]-e[0])>Cn){var s=i[0]<e[0]?ei:-ei;r=t*s/2,n.point(-s,r),n.point(0,r),n.point(s,r)}else n.point(e[0],e[1])}function XX(i){var e=fn(i),t=2*mn,n=e>0,r=ti(e)>Cn;function s(u,f,p,x){WX(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?ei:-ei),T):0;if(!f&&(v=x=C)&&u.lineStart(),C!==x&&(R=l(f,P),(!R||j_(f,R)||j_(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||!j_(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=sc(u),v=sc(f),w=[1,0,0],S=qf(x,v),T=Y2(S,S),P=S[0],R=T-P*P;if(!R)return!p&&u;var C=e*T/R,L=-e*P/R,D=qf(w,S),F=K2(w,C),N=K2(S,L);W3(F,N);var B=D,z=Y2(F,B),V=Y2(B,B),H=z*z-V*(Y2(F,F)-1);if(!(H<0)){var K=wo(H),J=K2(B,(-z-K)/V);if(W3(J,F),J=lm(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,be=ti(de-ei)<Cn,Ie=be||de<Cn;if(!be&&ae<ee&&(ce=ee,ee=ae,ae=ce),Ie?be?ee+ae>0^J[1]<(ti(J[0]-j)<Cn?ee:ae):ee<=J[1]&&J[1]<=ae:de>ei^(j<=J[0]&&J[0]<=Z)){var Qe=K2(B,(-z+K)/V);return W3(Qe,F),[J,lm(Qe)]}}}function c(u,f){var p=n?i:ei-i,x=0;return u<-p?x|=1:u>p&&(x|=2),f<-p?x|=4:f>p&&(x|=8),x}return sE(o,a,s,n?[0,-i]:[-ei,i-ei])}function $X(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 tv=1e9,oE=-tv;function t6(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 ti(c[0]-i)<Cn?u>0?0:3:ti(c[0]-t)<Cn?u>0?2:1:ti(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=tE(),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,be=ae[0],Ie,Qe,Ue=be[0],mt=be[1];ce<de;++ce)Ie=Ue,Qe=mt,be=ae[ce],Ue=be[0],mt=be[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=ch(p)).length;(Z||ee)&&(c.polygonStart(),Z&&(c.lineStart(),s(null,null,1,c),c.lineEnd()),ee&&iE(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(oE,Math.min(tv,P)),R=Math.max(oE,Math.min(tv,R))],ce=[j=Math.max(oE,Math.min(tv,j)),Z=Math.max(oE,Math.min(tv,Z))];$X(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 n6,i6,aE,lE,X_={sphere:Qr,point:Qr,lineStart:ume,lineEnd:Qr,polygonStart:Qr,polygonEnd:Qr};function ume(){X_.point=fme,X_.lineEnd=hme}function hme(){X_.point=X_.lineEnd=Qr}function fme(i,e){i*=mn,e*=mn,i6=i,aE=an(e),lE=fn(e),X_.point=dme}function dme(i,e){i*=mn,e*=mn;var t=an(e),n=fn(e),r=ti(i-i6),s=fn(r),o=an(r),a=n*o,l=lE*t-aE*n*s,c=aE*t+lE*n*s;n6.add(hs(wo(a*a+l*l),c)),i6=i,aE=t,lE=n}function YX(i){return n6=new bo,zp(i,X_),+n6}var r6=[null,null],pme={type:"LineString",coordinates:r6};function el(i,e){return r6[0]=i,r6[1]=e,YX(pme)}var KX={Feature:function(i,e){return cE(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)if(cE(t[n].geometry,e))return!0;return!1}},ZX={Sphere:function(){return!0},Point:function(i,e){return QX(i.coordinates,e)},MultiPoint:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(QX(t[n],e))return!0;return!1},LineString:function(i,e){return JX(i.coordinates,e)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(JX(t[n],e))return!0;return!1},Polygon:function(i,e){return e$(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(e$(t[n],e))return!0;return!1},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)if(cE(t[n],e))return!0;return!1}};function cE(i,e){return i&&ZX.hasOwnProperty(i.type)?ZX[i.type](i,e):!1}function QX(i,e){return el(i,e)===0}function JX(i,e){for(var t,n,r,s=0,o=i.length;s<o;s++){if(n=el(i[s],e),n===0||s>0&&(r=el(i[s],i[s-1]),r>0&&t<=r&&n<=r&&(t+n-r)*(1-Math.pow((t-n)/r,2))<am*r))return!0;t=n}return!1}function e$(i,e){return!!rE(i.map(Ame),t$(e))}function Ame(i){return i=i.map(t$),i.pop(),i}function t$(i){return[i[0]*mn,i[1]*mn]}function s6(i,e){return(i&&KX.hasOwnProperty(i.type)?KX[i.type]:cE)(i,e)}function n$(i,e,t){var n=Vf(i,e-Cn,t).concat(e);return function(r){return n.map(function(s){return[r,s]})}}function i$(i,e,t){var n=Vf(i,e-Cn,t).concat(e);return function(r){return n.map(function(s){return[s,r]})}}function o6(){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 Vf(X2(n/u)*u,t,u).map(v).concat(Vf(X2(a/f)*f,o,f).map(w)).concat(Vf(X2(e/l)*l,i,l).filter(function(R){return ti(R%u)>Cn}).map(p)).concat(Vf(X2(s/c)*c,r,c).filter(function(R){return ti(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=n$(s,r,90),x=i$(e,i,S),v=n$(a,o,90),w=i$(n,t,S),T):S},T.extentMajor([[-180,-90+Cn],[180,90-Cn]]).extentMinor([[-180,-80-Cn],[180,80+Cn]])}function a6(){return o6()()}function hm(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*Xo(wo(GD(s-n)+o*l*GD(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[hs(L,C)*Qi,hs(D,wo(C*C+L*L))*Qi]}:function(){return[t*Qi,n*Qi]};return S.distance=v,S}var l6=i=>i;var $_=1/0,uE=$_,nv=-$_,hE=nv,mme={point:gme,lineStart:Qr,lineEnd:Qr,polygonStart:Qr,polygonEnd:Qr,result:function(){var i=[[$_,uE],[nv,hE]];return nv=hE=-(uE=$_=1/0),i}};function gme(i,e){i<$_&&($_=i),i>nv&&(nv=i),e<uE&&(uE=e),e>hE&&(hE=e)}var c6=mme;function iv(i){return function(e){var t=new u6;for(var n in i)t[n]=i[n];return t.stream=e,t}}function u6(){}u6.prototype={constructor:u6,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 h6(i,e,t){var n=i.clipExtent&&i.clipExtent();return i.scale(150).translate([0,0]),n!=null&&i.clipExtent(null),zp(t,i.stream(c6)),e(c6.result()),n!=null&&i.clipExtent(n),i}function f6(i,e,t){return h6(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 r$(i,e,t){return f6(i,[[0,0],e],t)}function s$(i,e,t){return h6(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 o$(i,e,t){return h6(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 a$=16,_me=fn(30*mn);function d6(i,e){return+e?yme(i,e):xme(i)}function xme(i){return iv({point:function(e,t){e=i(e,t),this.stream.point(e[0],e[1])}})}function yme(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=wo(C*C+L*L+D*D),N=Xo(D/=F),B=ti(ti(D)-1)<Cn||ti(s-f)<Cn?(s+f)/2:hs(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||ti((T*K+P*J)/R-.5)>.3||o*p+a*x+l*v<_me)&&(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=sc([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],a$,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,a$,n),S.lineEnd=C,C()}return S}}var vme=iv({point:function(i,e){this.stream.point(i*mn,e*mn)}});function bme(i){return iv({point:function(e,t){var n=i(e,t);return this.stream.point(n[0],n[1])}})}function wme(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 l$(i,e,t,n,r,s){if(!s)return wme(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 p6(i){return Sme(function(){return i})()}function Sme(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=e6,S=null,T,P,R,C=l6,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]*Qi,j[1]*Qi]}V.stream=function(j){return B&&z===j?B:B=vme(bme(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?XX(v=j*mn):(v=null,e6),J()):v*Qi},V.clipExtent=function(j){return arguments.length?(C=j==null?(S=T=P=R=null,l6):t6(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*Qi,o*Qi]},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*Qi,l*Qi,c*Qi]},V.angle=function(j){return arguments.length?(f=j%360*mn,K()):f*Qi},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=d6(F,L=j*j),J()):wo(L)},V.fitExtent=function(j,Z){return f6(V,j,Z)},V.fitSize=function(j,Z){return r$(V,j,Z)},V.fitWidth=function(j,Z){return s$(V,j,Z)},V.fitHeight=function(j,Z){return o$(V,j,Z)};function K(){var j=l$(t,0,0,p,x,f).apply(null,e(s,o)),Z=l$(t,n-j[0],r-j[1],p,x,f);return u=ZD(a,l,c),F=ev(e,Z),N=ev(u,F),D=d6(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 c$(i){return function(e,t){var n=wo(e*e+t*t),r=i(n),s=an(r),o=fn(r);return[hs(e*s,n*o),Xo(n&&t*s/n)]}}function rv(i,e){return[i,_X(yX((to+e)/2))]}rv.invert=function(i,e){return[i,2*H_(gX(e))-to]};function A6(i,e){var t=fn(e),n=1+fn(i)*t;return[t*an(i)/n,an(e)/n]}A6.invert=c$(function(i){return 2*H_(i)});function m6(){return p6(A6).scale(250).clipAngle(142)}function x6(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 Tme(i){if(Array.isArray(i))return i}function Eme(i){if(Array.isArray(i))return x6(i)}function sv(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 Mme(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Cme(i,e,t){return e=AE(e),Ume(i,p$()?Reflect.construct(e,[],AE(i).constructor):e.apply(i,t))}function d$(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Rme(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function ni(i,e){return i.get(sv(i,e))}function qp(i,e,t){d$(i,e),e.set(i,t)}function Hp(i,e,t){return i.set(sv(i,e),t),t}function Pme(i,e){d$(i,e),e.add(i)}function Ime(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,m$(n.key),n)}}function Nme(i,e,t){return e&&Ime(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function Y_(i,e,t){return(e=m$(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function AE(i){return AE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},AE(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&&y6(i,e)}function p$(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(p$=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)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.4118-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.4119-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 Mme(i)}function y6(i,e){return y6=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},y6(i,e)}function pE(i,e){return Tme(i)||Fme(i,e)||g$(i,e)||Ome()}function A$(i){return Eme(i)||Dme(i)||g$(i)||Bme()}function kme(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 m$(i){var e=kme(i,"string");return typeof e=="symbol"?e:e+""}function g$(i,e){if(i){if(typeof i=="string")return x6(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)?x6(i,e):void 0}}var _$=function(e){e instanceof Array?e.forEach(_$):(e.map&&e.map.dispose(),e.dispose())},v6=function(e){e.geometry&&e.geometry.dispose(),e.material&&_$(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(v6)};function x$(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 Gme(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 fm(i){return i*Math.PI/180}var y$=function(e){return 1-(rv(0,(.5-e)*Math.PI)[1]/Math.PI+1)/2},g6=function(e){return Math.max(0,Math.min(1,y$(e)))},u$=function(e){return .5-rv.invert(0,(2*(1-e)-1)*Math.PI)[1]/Math.PI},zme=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=Qa().domain([1,0]).range([t,n]).clamp(!0),s=Qa().domain([g6(t),g6(n)]).range([1,0]).clamp(!0),o=function(f){return s(g6(r(f)))},a=e.array,l=0,c=a.length;l<c;l+=2)a[l+1]=o(a[l+1]);e.needsUpdate=!0},h$=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,y$(a))));var l=Math.floor(a*s);return[o,l]},b6=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:u$(w/l)*l;var R=w+1===l?w+1:u$((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},Vme=6,qme=7,Hme=3,Wme=90,ph=new WeakMap,Wp=new WeakMap,_6=new WeakMap,fE=new WeakMap,oc=new WeakMap,mE=new WeakMap,K_=new WeakMap,dm=new WeakMap,dE=new WeakSet,v$=(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 Rme(this,e),n=Cme(this,e),Pme(n,dE),qp(n,ph,void 0),qp(n,Wp,void 0),qp(n,_6,void 0),qp(n,fE,void 0),qp(n,oc,{}),qp(n,mE,void 0),qp(n,K_,void 0),qp(n,dm,void 0),Y_(n,"minLevel",void 0),Y_(n,"maxLevel",void 0),Y_(n,"thresholds",A$(new Array(30)).map(function(p,x){return 8/Math.pow(2,x)})),Y_(n,"curvatureResolution",5),Y_(n,"tileMargin",0),Y_(n,"clearTiles",function(){Object.values(ni(oc,n)).forEach(function(p){p.forEach(function(x){x.obj&&(n.remove(x.obj),v6(x.obj),delete x.obj)})}),Hp(oc,n,{})}),Hp(ph,n,t),n.tileUrl=s,Hp(Wp,n,f),n.minLevel=a,n.maxLevel=c,n.level=0,n.add(Hp(dm,n,new Gn(new _a(ni(ph,n)*.99,180,90),new Yr({color:0})))),ni(dm,n).visible=!1,ni(dm,n).material.polygonOffset=!0,ni(dm,n).material.polygonOffsetUnits=3,ni(dm,n).material.polygonOffsetFactor=1,n}return Lme(e,i),Nme(e,[{key:"tileUrl",get:function(){return ni(_6,this)},set:function(n){Hp(_6,this,n),this.updatePov(ni(K_,this))}},{key:"level",get:function(){return ni(fE,this)},set:function(n){var r,s=this;ni(oc,this)[n]||sv(dE,this,jme).call(this,n);var o=ni(fE,this);if(Hp(fE,this,n),!(n===o||o===void 0)){if(ni(dm,this).visible=n>0,ni(oc,this)[n].forEach(function(l){return l.obj&&(l.obj.material.depthWrite=!0)}),o<n&&((r=ni(oc,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++)ni(oc,this)[a]&&ni(oc,this)[a].forEach(function(l){l.obj&&(s.remove(l.obj),v6(l.obj),delete l.obj)});sv(dE,this,f$).call(this)}}},{key:"updatePov",value:function(n){var r=this;if(!(!n||!(n instanceof Of))){Hp(K_,this,n);var s;if(Hp(mE,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=pE(R,2),L=C[0],D=C[1];return x$(L,D,ni(ph,r))}).map(function(R){var C=R.x,L=R.y,D=R.z;return new ie(C,L,D)})}return s||(s=new ec,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-ni(ph,this))/ni(ph,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)),sv(dE,this,f$).call(this)}}}}])})(br);function jme(i){var e=this;if(i>qme){ni(oc,this)[i]=[];return}var t=ni(oc,this)[i]=b6(i,ni(Wp,this));t.forEach(function(n){return n.centroid=x$(n.lat,n.lng,ni(ph,e))}),t.octree=U2().x(function(n){return n.centroid.x}).y(function(n){return n.centroid.y}).z(function(n){return n.centroid.z}).addAll(t)}function f$(){var i=this;if(!(!this.tileUrl||this.level===void 0||!ni(oc,this).hasOwnProperty(this.level))&&!(!ni(mE,this)&&this.level>Vme)){var e=ni(oc,this)[this.level];if(ni(K_,this)){var t=this.worldToLocal(ni(K_,this).position.clone());if(e.octree){var n,r=this.worldToLocal(ni(K_,this).position.clone()),s=(r.length()-ni(ph,this))*Hme;e=(n=e.octree).findAllWithinRadius.apply(n,A$(r).concat([s]))}else{var o=Gme(t),a=(o.r/ni(ph,this)-1)*Wme,l=a/Math.cos(fm(o.lat)),c=[o.lng-l,o.lng+l],u=[o.lat+a,o.lat-a],f=h$(this.level,ni(Wp,this),c[0],u[0]),p=pE(f,2),x=p[0],v=p[1],w=h$(this.level,ni(Wp,this),c[1],u[1]),S=pE(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=b6(this.level,ni(Wp,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]=b6(this.level,ni(Wp,this),L,D,L,D)[0],e.push(R[F])),C.push(R[F])}e=C}}}e.filter(function(N){return!N.obj}).filter(ni(mE,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=fm(V),ae=fm(-H),ce=new Gn(new _a(ni(ph,i),Math.ceil(j/i.curvatureResolution),Math.ceil(Z/i.curvatureResolution),fm(90-j/2)+ee,fm(j),fm(90-Z/2)+ae,fm(Z)),new xa);if(ni(Wp,i)){var de=[H+K/2,H-K/2].map(function(Ue){return .5-Ue/180}),be=pE(de,2),Ie=be[0],Qe=be[1];zme(ce.geometry.attributes.uv,Ie,Qe)}N.obj=ce}N.loading||(N.loading=!0,new Ya().load(i.tileUrl(B,z,i.level),function(Ue){var mt=N.obj;mt&&(Ue.colorSpace=vr,mt.material.map=Ue,mt.material.color=null,mt.material.needsUpdate=!0,i.add(mt)),N.loading=!1}))})}}var cv=new Set,w6=!1;function P6(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length;cv.size&&cv.clear();let s=T$(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a=0,l=0,c=0;if(n&&(s=Zme(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 S6(s,o,a,l,c),o}function T$(i,e,t,n,r){let s=null;if(r===uge(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=S$(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=S$(o/n|0,i[o],i[o+1],s);return s&&uv(s,s.next)&&(fv(s),s=s.next),s}function Am(i,e=i){let t=e===i,n=i,r;do r=!1,n!==n.next&&(cv.size===0||!cv.has(n))&&(uv(n,n.next)||Ps(n.prev,n,n.next)===0)?((t||n===e)&&(e=n.prev),w6=!0,fv(n),n=n.prev,r=!0):(t||n!==e)&&(n=n.next,r=!t);while(r||n!==e);return e}function S6(i,e,t,n,r){r&&rge(i,t,n,r);let s=i,o=!1;for(;i.prev!==i.next;){let a=i.prev,l=i.next;if(Ps(a,i,l)<0&&(r?$me(i,t,n,r):Xme(i))){e.push(a.i,i.i,l.i),fv(i),i=l,s=l;continue}if(i=l,i===s){if(w6=!1,i=Am(i),w6){s=i;continue}if(!o){i=Yme(i,e),s=i,o=!0;continue}Kme(i,e,t,n,r);break}}}function Xme(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)&&yE(r,a,s,l,o,c,v.x,v.y)&&Ps(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function $me(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=C6(x,v,e,t,n),P=C6(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)&&yE(a,u,l,f,c,p,R.x,R.y)&&Ps(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)&&yE(a,u,l,f,c,p,C.x,C.y)&&Ps(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function Yme(i,e){let t=i,n=!1;do{let r=t.prev,s=t.next.next;C$(r,t,t.next,s,!1)&&hv(r,s)&&hv(s,r)&&(e.push(r.i,t.i,s.i),fv(t),fv(t.next),t=i=s,n=!0),t=t.next}while(t!==i);return n?Am(t):t}function Kme(i,e,t,n,r){let s=i;do{let o=s.next.next;for(;o!==s.prev;){if(s.i!==o.i&&age(s,o)){let a=R$(s,o);s=Am(s,s.next),a=Am(a,a.next),S6(s,e,t,n,r),S6(a,e,t,n,r);return}o=o.next}s=s.next}while(s!==i)}var T6=!1;function Zme(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=T$(i,a,l,n,!1);c===c.next&&cv.add(c),r.push(oge(c))}r.sort(Qme),ege(i.length/n,e.length),M$(t,t),T6=!0;for(let s=0;s<r.length;s++)t=Jme(r[s],t);return T6=!1,Am(t)}function Qme(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 Jme(i,e){let t=nge(i,e);if(!t)return e;let n=R$(t,i),r=n.next;return M$(t,r.next),Am(n,n.next),Am(t,t.next)}var E$=16,es=new Float64Array(0),xE=0,E6=[],M6=[];function ege(i,e){let t=Math.ceil((i+2*e)/E$)+e+2;es.length<t*4&&(es=new Float64Array(t*4)),xE=0}function M$(i,e){let t=i;do{let n=xE++;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<E$&&t!==e);M6[n]=t;let c=n*4;es[c]=r,es[c+1]=s,es[c+2]=o,es[c+3]=a}while(t!==e)}function tge(i,e){let t=i.z*4;e.x<es[t]&&(es[t]=e.x),e.y<es[t+1]&&(es[t+1]=e.y),e.x>es[t+2]&&(es[t+2]=e.x),e.y>es[t+3]&&(es[t+3]=e.y)}function b$(i){let e=M6[i];for(;e.prev.next!==e;)e=e.next;return M6[i]=e,e}function w$(i){let e=E6[i];for(;e.prev.next!==e;)e=e.next;return E6[i]=e,e}function nge(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(uv(i,t))return t;for(let p=0,x=0;p<xE;p++,x+=4){if(r<es[x+1]||r>es[x+3]||es[x]>n||es[x+2]<=s)continue;let v=b$(p);t=w$(p);do{if(t.prev.next===t){if(uv(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<xE;p++,x+=4){if(es[x+2]<a||es[x]>n||es[x+3]<c||es[x+1]>u)continue;let v=b$(p);t=w$(p);do{if(t.prev.next===t&&n>=t.x&&t.x>=a&&n!==t.x&&yE(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);(hv(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&&ige(o,t)))&&(o=t,f=w)}t=t.next}while(t!==v)}return o}function ige(i,e){return Ps(i.prev,i,e.prev)<0&&Ps(e.next,i,i.next)<0}var ac=[],ov=[],pm=new Uint32Array(0),av=new Uint32Array(0),lv=new Uint32Array(256);function rge(i,e,t,n){let r=i,s=0;do r.z=C6(r.x,r.y,e,t,n),ac[s++]=r,r=r.next;while(r!==i);sge(s);let o=null;for(let a=0;a<s;a++){let l=ac[a];l.prevZ=o,o&&(o.nextZ=l),o=l}o.nextZ=null}function sge(i){if(i<=32){for(let e=1;e<i;e++){let t=ac[e],n=t.z,r=e-1;for(;r>=0&&ac[r].z>n;)ac[r+1]=ac[r],r--;ac[r+1]=t}return}pm.length<i&&(pm=new Uint32Array(i),av=new Uint32Array(i),ov=new Array(i));for(let e=0;e<i;e++)pm[e]=ac[e].z;gE(i,ac,pm,ov,av,0),gE(i,ov,av,ac,pm,8),gE(i,ac,pm,ov,av,16),gE(i,ov,av,ac,pm,24)}function gE(i,e,t,n,r,s){lv.fill(0);for(let a=0;a<i;a++)lv[t[a]>>>s&255]++;let o=0;for(let a=0;a<256;a++){let l=lv[a];lv[a]=o,o+=l}for(let a=0;a<i;a++){let l=t[a],c=lv[l>>>s&255]++;n[c]=e[a],r[c]=l}}function C6(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 oge(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 yE(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 age(i,e){let t=uv(i,e)&&Ps(i.prev,i,i.next)>0&&Ps(e.prev,e,e.next)>0;return i.next.i!==e.i&&(t||hv(i,e)&&hv(e,i)&&(Ps(i.prev,i,e.prev)!==0||Ps(i,e.prev,e)!==0))&&!lge(i,e)&&(t||cge(i,e))}function Ps(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function uv(i,e){return i.x===e.x&&i.y===e.y}function C$(i,e,t,n,r=!0){let s=Ps(i,e,t),o=Ps(i,e,n),a=Ps(t,n,i),l=Ps(t,n,e);return(s>0&&o<0||s<0&&o>0)&&(a>0&&l<0||a<0&&l>0)?!0:r?!!(s===0&&_E(i,t,e)||o===0&&_E(i,n,e)||a===0&&_E(t,i,n)||l===0&&_E(t,e,n)):!1}function _E(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 lge(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&&C$(o,a,i,e))return!0;o=a}while(o!==i);return!1}function hv(i,e){return Ps(i.prev,i,i.next)<0?Ps(i,e,i.next)>=0&&Ps(i,i.prev,e)>=0:Ps(i,e,i.prev)<0||Ps(i,i.next,e)<0}function cge(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 R$(i,e){let t=R6(i.i,i.x,i.y),n=R6(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 S$(i,e,t,n){let r=R6(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 fv(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),T6&&tge(i.prev,i.next)}function R6(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function uge(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 Z_(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 N6(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 hge(i){if(Array.isArray(i))return i}function fge(i){if(Array.isArray(i))return N6(i)}function dge(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function pge(i,e,t){return e=vE(e),wge(i,N$()?Reflect.construct(e,[],vE(i).constructor):e.apply(i,t))}function Age(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function mge(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function gge(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=F6(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 vE(i){return vE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},vE(i)}function _ge(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&&L6(i,e)}function N$(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(N$=function(){return!!i})()}function xge(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function yge(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 vge(){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 bge(){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 wge(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 dge(i)}function L6(i,e){return L6=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},L6(i,e)}function dv(i,e){return hge(i)||yge(i,e)||F6(i,e)||vge()}function Sge(i){return fge(i)||xge(i)||F6(i)||bge()}function F6(i,e){if(i){if(typeof i=="string")return N6(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)?N6(i,e):void 0}}var P$=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=el(s,r)*180/Math.PI;if(o>t)for(var a=hm(r,s),l=r.length>2||s.length>2?hh(r[2]||0,s[2]||0):null,c=l?function(p){return[].concat(Sge(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},D6=typeof window<"u"&&window.THREE?window.THREE:{BufferGeometry:qn,Float32BufferAttribute:Rn},Tge=new D6.BufferGeometry().setAttribute?"setAttribute":"addAttribute",O6=(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;Age(this,e),n=pge(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;pv({indices:a,vertices:l},S),n.addGroup(T,a.length-T,c++)}),a.length&&n.setIndex(a),l.length&&n[Tge]("position",new D6.Float32BufferAttribute(l,3));function u(S,T){var P=I6(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=dv(R,1),L=C[0];pv(P,L)}),[P]}function p(S,T){for(var P=P$(S,s).map(function(N){var B=dv(N,3),z=B[0],V=B[1],H=B[2],K=H===void 0?0:H;return I6(V,z,T+K)}),R=Z_([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=dv(R,1),L=C[0];pv(P,L)}),[P]}function v(S,T){for(var P=S.map(function(j){return P$(j,s).map(function(Z){var ee=dv(Z,3),ae=ee[0],ce=ee[1],de=ee[2],be=de===void 0?0:de;return I6(ce,ae,T+be)})}),R=Z_(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=dv(L,2),F=D[0],N=D[1];pv(P,F),N&&pv(R,N)});var C=[P];return R.vertices.length&&C.push(R),C}return n}return _ge(e,i),mge(e)})(D6.BufferGeometry);function pv(i,e){var t=Math.round(i.vertices.length/3);I$(i.vertices,e.vertices),I$(i.indices,e.indices.map(function(n){return n+t}))}function I$(i,e){var t=gge(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 I6(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={};noe(Av,{computeMikkTSpaceTangents:()=>Ege,computeMorphedAttributes:()=>Dge,deepCloneAttribute:()=>Cge,deinterleaveAttribute:()=>bE,deinterleaveGeometry:()=>Pge,estimateBytesUsed:()=>Ige,interleaveAttributes:()=>Rge,mergeAttributes:()=>B6,mergeGeometries:()=>Mge,mergeGroups:()=>Fge,mergeVertices:()=>Nge,toCreasedNormals:()=>Oge,toTrianglesDrawMode:()=>Lge});function Ege(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 Di(s,4)),i!==r&&i.copy(r),i}function Mge(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 qn,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=B6(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=B6(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 B6(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 Di(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 Cge(i){return i.isInstancedInterleavedBufferAttribute||i.isInterleavedBufferAttribute?bE(i):i.isInstancedBufferAttribute?new yl().copy(i):new Di().copy(i)}function Rge(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 Df(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 xo(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 bE(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 yl(s,n,r,i.meshPerAttribute):o=new Di(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 Pge(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,bE(s)),e[r]=n.get(s))}for(let r in t){let s=t[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,bE(s)),t[r]=n.get(s))}}function Ige(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 Nge(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 Lge(i,e){if(e===bL)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),i;if(e===c3||e===wL){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===c3)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 Dge(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,be,Ie,Qe,Ue,mt,Me){e.fromBufferAttribute(de,Qe),t.fromBufferAttribute(de,Ue),n.fromBufferAttribute(de,mt);let ze=ce.morphTargetInfluences;if(be&&ze){a.set(0,0,0),l.set(0,0,0),c.set(0,0,0);for(let $e=0,Et=be.length;$e<Et;$e++){let Tt=ze[$e],Ct=be[$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 Rn(j,3),ae=new Rn(Z,3);return{positionAttribute:T,normalAttribute:C,morphedPositionAttribute:ee,morphedNormalAttribute:ae}}function Fge(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 Oge(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,be=Z*de-ee*ce,Ie=ee*ae-j*de,Qe=j*ce-Z*ae,Ue=1/(Math.sqrt(be*be+Ie*Ie+Qe*Qe)||1);c[3*C+0]=be*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],be=c[ae+2];D*ce+F*de+N*be>o&&(H+=ce,K+=de,J+=be)}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 Di(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 wE(i){"@babel/helpers - typeof";return wE=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},wE(i)}var Bge=/^\s+/,Uge=/\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=kge(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=k$(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=D$(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=D$(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=L$(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=L$(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 F$(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return qge(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(Sr(this._r,255)*100)+"%",g:Math.round(Sr(this._g,255)*100)+"%",b:Math.round(Sr(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(Sr(this._r,255)*100)+"%, "+Math.round(Sr(this._g,255)*100)+"%, "+Math.round(Sr(this._b,255)*100)+"%)":"rgba("+Math.round(Sr(this._r,255)*100)+"%, "+Math.round(Sr(this._g,255)*100)+"%, "+Math.round(Sr(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:t_e[F$(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t="#"+O$(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var s=dn(e);n="#"+O$(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(Xge,arguments)},brighten:function(){return this._applyModification($ge,arguments)},darken:function(){return this._applyModification(Yge,arguments)},desaturate:function(){return this._applyModification(Hge,arguments)},saturate:function(){return this._applyModification(Wge,arguments)},greyscale:function(){return this._applyModification(jge,arguments)},spin:function(){return this._applyModification(Kge,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(Jge,arguments)},complement:function(){return this._applyCombination(Zge,arguments)},monochromatic:function(){return this._applyCombination(e_e,arguments)},splitcomplement:function(){return this._applyCombination(Qge,arguments)},triad:function(){return this._applyCombination(B$,[3])},tetrad:function(){return this._applyCombination(B$,[4])}};dn.fromRatio=function(i,e){if(wE(i)=="object"){var t={};for(var n in i)i.hasOwnProperty(n)&&(n==="a"?t[n]=i[n]:t[n]=mv(i[n]));i=t}return dn(i,e)};function kge(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=s_e(i)),wE(i)=="object"&&(jf(i.r)&&jf(i.g)&&jf(i.b)?(e=Gge(i.r,i.g,i.b),o=!0,a=String(i.r).substr(-1)==="%"?"prgb":"rgb"):jf(i.h)&&jf(i.s)&&jf(i.v)?(n=mv(i.s),r=mv(i.v),e=Vge(i.h,n,r),o=!0,a="hsv"):jf(i.h)&&jf(i.s)&&jf(i.l)&&(n=mv(i.s),s=mv(i.l),e=zge(i.h,n,s),o=!0,a="hsl"),i.hasOwnProperty("a")&&(t=i.a)),t=k$(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 Gge(i,e,t){return{r:Sr(i,255)*255,g:Sr(e,255)*255,b:Sr(t,255)*255}}function L$(i,e,t){i=Sr(i,255),e=Sr(e,255),t=Sr(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 zge(i,e,t){var n,r,s;i=Sr(i,360),e=Sr(e,100),t=Sr(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 D$(i,e,t){i=Sr(i,255),e=Sr(e,255),t=Sr(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 Vge(i,e,t){i=Sr(i,360)*6,e=Sr(e,100),t=Sr(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 F$(i,e,t,n){var r=[eu(Math.round(i).toString(16)),eu(Math.round(e).toString(16)),eu(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 qge(i,e,t,n,r){var s=[eu(Math.round(i).toString(16)),eu(Math.round(e).toString(16)),eu(Math.round(t).toString(16)),eu(G$(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 O$(i,e,t,n){var r=[eu(G$(n)),eu(Math.round(i).toString(16)),eu(Math.round(e).toString(16)),eu(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 Hge(i,e){e=e===0?0:e||10;var t=dn(i).toHsl();return t.s-=e/100,t.s=SE(t.s),dn(t)}function Wge(i,e){e=e===0?0:e||10;var t=dn(i).toHsl();return t.s+=e/100,t.s=SE(t.s),dn(t)}function jge(i){return dn(i).desaturate(100)}function Xge(i,e){e=e===0?0:e||10;var t=dn(i).toHsl();return t.l+=e/100,t.l=SE(t.l),dn(t)}function $ge(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 Yge(i,e){e=e===0?0:e||10;var t=dn(i).toHsl();return t.l-=e/100,t.l=SE(t.l),dn(t)}function Kge(i,e){var t=dn(i).toHsl(),n=(t.h+e)%360;return t.h=n<0?360+n:n,dn(t)}function Zge(i){var e=dn(i).toHsl();return e.h=(e.h+180)%360,dn(e)}function B$(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 Qge(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 Jge(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 e_e(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=o_e(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 U6=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"},t_e=dn.hexNames=n_e(U6);function n_e(i){var e={};for(var t in i)i.hasOwnProperty(t)&&(e[i[t]]=t);return e}function k$(i){return i=parseFloat(i),(isNaN(i)||i<0||i>1)&&(i=1),i}function Sr(i,e){i_e(i)&&(i="100%");var t=r_e(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 SE(i){return Math.min(1,Math.max(0,i))}function El(i){return parseInt(i,16)}function i_e(i){return typeof i=="string"&&i.indexOf(".")!=-1&&parseFloat(i)===1}function r_e(i){return typeof i=="string"&&i.indexOf("%")!=-1}function eu(i){return i.length==1?"0"+i:""+i}function mv(i){return i<=1&&(i=i*100+"%"),i}function G$(i){return Math.round(parseFloat(i)*255).toString(16)}function U$(i){return El(i)/255}var Jc=(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 jf(i){return!!Jc.CSS_UNIT.exec(i)}function s_e(i){i=i.replace(Bge,"").replace(Uge,"").toLowerCase();var e=!1;if(U6[i])i=U6[i],e=!0;else if(i=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=Jc.rgb.exec(i))?{r:t[1],g:t[2],b:t[3]}:(t=Jc.rgba.exec(i))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=Jc.hsl.exec(i))?{h:t[1],s:t[2],l:t[3]}:(t=Jc.hsla.exec(i))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=Jc.hsv.exec(i))?{h:t[1],s:t[2],v:t[3]}:(t=Jc.hsva.exec(i))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=Jc.hex8.exec(i))?{r:El(t[1]),g:El(t[2]),b:El(t[3]),a:U$(t[4]),format:e?"name":"hex8"}:(t=Jc.hex6.exec(i))?{r:El(t[1]),g:El(t[2]),b:El(t[3]),format:e?"name":"hex"}:(t=Jc.hex4.exec(i))?{r:El(t[1]+""+t[1]),g:El(t[2]+""+t[2]),b:El(t[3]+""+t[3]),a:U$(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=Jc.hex3.exec(i))?{r:El(t[1]+""+t[1]),g:El(t[2]+""+t[2]),b:El(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function o_e(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 V6(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 l_e(i){if(Array.isArray(i))return V6(i)}function z$(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 c_e(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function u_e(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function $o(i,e){return i.get(z$(i,e))}function Q_(i,e,t){c_e(i,e),e.set(i,t)}function TE(i,e,t){return i.set(z$(i,e),t),t}function h_e(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,y_e(n.key),n)}}function f_e(i,e,t){return e&&h_e(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function d_e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function p_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 A_e(){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 m_e(){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 g_e(i,e){return a_e(i)||p_e(i,e)||V$(i,e)||A_e()}function __e(i){return l_e(i)||d_e(i)||V$(i)||m_e()}function x_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 y_e(i){var e=x_e(i,"string");return typeof e=="symbol"?e:e+""}function V$(i,e){if(i){if(typeof i=="string")return V6(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)?V6(i,e):void 0}}var J_=new WeakMap,gv=new WeakMap,e1=new WeakMap,k6=new WeakMap,G6=new WeakMap,z6=new WeakMap,q$=(function(){function i(){u_e(this,i),Q_(this,J_,new Map),Q_(this,gv,new Map),Q_(this,e1,function(e){return e}),Q_(this,k6,function(){return{}}),Q_(this,G6,function(){}),Q_(this,z6,function(){})}return f_e(i,[{key:"getObj",value:function(t){return $o(J_,this).get($o(e1,this).call(this,t))}},{key:"getData",value:function(t){return $o(gv,this).get(t)}},{key:"entries",value:function(){return __e($o(gv,this).entries()).map(function(t){var n=g_e(t,2),r=n[0],s=n[1];return[s,r]})}},{key:"id",value:function(t){return TE(e1,this,rt(t)),this}},{key:"onCreateObj",value:function(t){return TE(k6,this,t),this}},{key:"onUpdateObj",value:function(t){return TE(G6,this,t),this}},{key:"onRemoveObj",value:function(t){return TE(z6,this,t),this}},{key:"digest",value:function(t){var n=this;t.filter(function(s){return!$o(J_,n).has($o(e1,n).call(n,s))}).forEach(function(s){var o=$o(k6,n).call(n,s);$o(J_,n).set($o(e1,n).call(n,s),o),$o(gv,n).set(o,s)});var r=new Map(t.map(function(s){return[$o(e1,n).call(n,s),s]}));return $o(J_,this).forEach(function(s,o){r.has(o)?$o(G6,n).call(n,s,r.get(o)):($o(z6,n).call(n,s,o),$o(J_,n).delete(o),$o(gv,n).delete(s))}),this}},{key:"clear",value:function(){return this.digest([]),this}}])})();var eg=roe(H$(),1);var vi=11102230246251565e-32,Is=134217729,xv=(3+8*vi)*vi;function mm(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 yv(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 v_e=(3+16*vi)*vi,b_e=(2+12*vi)*vi,w_e=(9+64*vi)*vi*vi,t1=ut(4),W$=ut(8),j$=ut(12),X$=ut(16),Ta=ut(4);function S_e(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=Is*B,x=p-(p-B),v=B-x,p=Is*H,w=p-(p-H),S=H-w,L=v*S-(C-x*w-v*w-x*S),D=V*z,p=Is*V,x=p-(p-V),v=V-x,p=Is*z,w=p-(p-z),S=z-w,F=v*S-(D-x*w-v*w-x*S),T=L-F,f=L-T,t1[0]=L-(T+f)+(f-F),P=C+T,f=P-C,R=C-(P-f)+(T-f),T=R-D,f=R-T,t1[1]=R-(T+f)+(f-D),N=P+T,f=N-P,t1[2]=P-(N-f)+(T-f),t1[3]=N;let K=yv(4,t1),J=b_e*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=w_e*o+xv*Math.abs(K),K+=B*u+H*a-(V*c+z*l),K>=J||-K>=J))return K;C=a*H,p=Is*a,x=p-(p-a),v=a-x,p=Is*H,w=p-(p-H),S=H-w,L=v*S-(C-x*w-v*w-x*S),D=l*z,p=Is*l,x=p-(p-l),v=l-x,p=Is*z,w=p-(p-z),S=z-w,F=v*S-(D-x*w-v*w-x*S),T=L-F,f=L-T,Ta[0]=L-(T+f)+(f-F),P=C+T,f=P-C,R=C-(P-f)+(T-f),T=R-D,f=R-T,Ta[1]=R-(T+f)+(f-D),N=P+T,f=N-P,Ta[2]=P-(N-f)+(T-f),Ta[3]=N;let j=mm(4,t1,4,Ta,W$);C=B*u,p=Is*B,x=p-(p-B),v=B-x,p=Is*u,w=p-(p-u),S=u-w,L=v*S-(C-x*w-v*w-x*S),D=V*c,p=Is*V,x=p-(p-V),v=V-x,p=Is*c,w=p-(p-c),S=c-w,F=v*S-(D-x*w-v*w-x*S),T=L-F,f=L-T,Ta[0]=L-(T+f)+(f-F),P=C+T,f=P-C,R=C-(P-f)+(T-f),T=R-D,f=R-T,Ta[1]=R-(T+f)+(f-D),N=P+T,f=N-P,Ta[2]=P-(N-f)+(T-f),Ta[3]=N;let Z=mm(j,W$,4,Ta,j$);C=a*u,p=Is*a,x=p-(p-a),v=a-x,p=Is*u,w=p-(p-u),S=u-w,L=v*S-(C-x*w-v*w-x*S),D=l*c,p=Is*l,x=p-(p-l),v=l-x,p=Is*c,w=p-(p-c),S=c-w,F=v*S-(D-x*w-v*w-x*S),T=L-F,f=L-T,Ta[0]=L-(T+f)+(f-F),P=C+T,f=P-C,R=C-(P-f)+(T-f),T=R-D,f=R-T,Ta[1]=R-(T+f)+(f-D),N=P+T,f=N-P,Ta[2]=P-(N-f)+(T-f),Ta[3]=N;let ee=mm(Z,j$,4,Ta,X$);return X$[ee-1]}function jp(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)>=v_e*c?l:-S_e(i,e,t,n,r,s,c)}var KKe=(7+56*vi)*vi,ZKe=(3+28*vi)*vi,QKe=(26+288*vi)*vi*vi,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(8),cZe=ut(8),uZe=ut(8),hZe=ut(4),fZe=ut(8),dZe=ut(8),pZe=ut(16),AZe=ut(12),mZe=ut(192),gZe=ut(192);var yZe=(10+96*vi)*vi,vZe=(4+48*vi)*vi,bZe=(44+576*vi)*vi*vi,wZe=ut(4),SZe=ut(4),TZe=ut(4),EZe=ut(4),MZe=ut(4),CZe=ut(4),RZe=ut(4),PZe=ut(4),IZe=ut(8),NZe=ut(8),LZe=ut(8),DZe=ut(8),FZe=ut(8),OZe=ut(8),BZe=ut(8),UZe=ut(8),kZe=ut(8),GZe=ut(4),zZe=ut(4),VZe=ut(4),qZe=ut(8),HZe=ut(16),WZe=ut(16),jZe=ut(16),XZe=ut(32),$Ze=ut(32),YZe=ut(48),KZe=ut(64),ZZe=ut(1152),QZe=ut(1152);var nQe=(16+224*vi)*vi,iQe=(5+72*vi)*vi,rQe=(71+1408*vi)*vi*vi,sQe=ut(4),oQe=ut(4),aQe=ut(4),lQe=ut(4),cQe=ut(4),uQe=ut(4),hQe=ut(4),fQe=ut(4),dQe=ut(4),pQe=ut(4),AQe=ut(24),mQe=ut(24),gQe=ut(24),_Qe=ut(24),xQe=ut(24),yQe=ut(24),vQe=ut(24),bQe=ut(24),wQe=ut(24),SQe=ut(24),TQe=ut(1152),EQe=ut(1152),MQe=ut(1152),CQe=ut(1152),RQe=ut(1152),PQe=ut(2304),IQe=ut(2304),NQe=ut(3456),LQe=ut(5760),DQe=ut(8),FQe=ut(8),OQe=ut(8),BQe=ut(16),UQe=ut(24),kQe=ut(48),GQe=ut(48),zQe=ut(96),VQe=ut(192),qQe=ut(384),HQe=ut(384),WQe=ut(384),jQe=ut(768);var XQe=ut(96),$Qe=ut(96),YQe=ut(96),KQe=ut(1152);var Y$=Math.pow(2,-52),EE=new Uint32Array(512),Xp=class i{static from(e,t=P_e,n=I_e){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=H6(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=H6(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=C_e(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];n1(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(jp(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=R_e(S,T,P,R,L,D);this._cx=F.x,this._cy=F.y;for(let B=0;B<o;B++)this._dists[B]=H6(e[2*B],e[2*B+1],F.x,F.y);n1(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,be=this._hashKey(K,J);de<this._hashSize&&(j=s[(be+de)%this._hashSize],!(j!==-1&&j!==n[j]));de++);j=t[j];let Z=j,ee;for(;ee=n[Z],jp(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],jp(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],jp(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(E_e(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=EE[--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(M_e(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<EE.length&&(EE[s++]=P)}else{if(s===0)break;e=EE[--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 E_e(i,e){let t=i/(Math.abs(i)+Math.abs(e));return(e>0?3-t:1+t)/4}function H6(i,e,t,n){let r=i-t,s=e-n;return r*r+s*s}function M_e(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 C_e(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 R_e(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 n1(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;vv(i,r,s),e[i[t]]>e[i[n]]&&vv(i,t,n),e[i[s]]>e[i[n]]&&vv(i,s,n),e[i[t]]>e[i[s]]&&vv(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;vv(i,s,o)}i[t+1]=i[o],i[o]=a,n-s+1>=o-t?(n1(i,e,s,n),n1(i,e,t,o-1)):(n1(i,e,t,o-1),n1(i,e,s,n))}}function vv(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function P_e(i){return i[0]}function I_e(i){return i[1]}function K$(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=jp(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 Z$(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 Q$(i){return i.type==="Feature"?i.geometry:i}function N_e(i,e,t={}){if(!i)throw new Error("point is required");if(!e)throw new Error("polygon is required");let n=Z$(i),r=Q$(e),s=r.type,o=e.bbox,a=r.coordinates;if(o&&L_e(n,o)===!1)return!1;s==="Polygon"&&(a=[a]);let l=!1;for(var c=0;c<a.length;++c){let u=K$(n,a[c]);if(u===0)return!t.ignoreBoundary;u&&(l=!0)}return l}function L_e(i,e){return e[0]<=i[0]&&e[1]<=i[1]&&e[2]>=i[0]&&e[3]>=i[1]}var J$=N_e;var lc=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 $p=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 bv=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 lc: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 lc: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 lc: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 $p;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 D_e=2*Math.PI,i1=Math.pow;function F_e(i){return i[0]}function O_e(i){return i[1]}function B_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 U_e(i,e,t){return[i+Math.sin(i+e)*t,e+Math.cos(i-e)*t]}var r1=class i{static from(e,t=F_e,n=O_e,r){return new i("length"in e?k_e(e,t,n,r):Float64Array.from(G_e(e,t,n,r)))}constructor(e){this._delaunator=new Xp(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&&B_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=U_e(t[2*p],t[2*p+1],f);t[2*p]=v[0],t[2*p+1]=v[1]}this._delaunator=new Xp(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 bv(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=i1(t-c[e*2],2)+i1(n-c[e*2+1],2),p=r[e],x=p;do{let v=l[x],w=i1(t-c[v*2],2)+i1(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&&i1(t-c[x*2],2)+i1(n-c[x*2+1],2)<f)return x;break}}while(x!==p);return u}render(e){let t=e==null?e=new lc: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 lc: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,D_e)}return n&&n.value()}renderHull(e){let t=e==null?e=new lc: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 $p;return this.renderHull(e),e.value()}renderTriangle(e,t){let n=t==null?t=new lc: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 $p;return this.renderTriangle(e,t),t.value()}};function k_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*G_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 wv=Math.PI,eY=wv/2,PJe=wv/4,IJe=wv*2,W6=180/wv,j6=wv/180;var X6=Math.atan2,ME=Math.cos;var tY=Math.max,nY=Math.min;var CE=Math.sin,iY=Math.sign||function(i){return i>0?1:i<0?-1:0},RE=Math.sqrt;function $6(i){return i>1?eY:i<-1?-eY:Math.asin(i)}function Y6(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function tl(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 Sv(i,e){return[i[0]+e[0],i[1]+e[1],i[2]+e[2]]}function Tv(i){var e=RE(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);return[i[0]/e,i[1]/e,i[2]/e]}function K6(i){return[X6(i[1],i[0])*W6,$6(tY(-1,nY(1,i[2])))*W6]}function Ah(i){let e=i[0]*j6,t=i[1]*j6,n=ME(t);return[n*ME(e),n*CE(e),CE(t)]}function PE(i){return i=i.map(e=>Ah(e)),Y6(i[0],tl(i[2],i[1]))}function sY(i){let e=V_e(i),t=H_e(e),n=q_e(t,i),r=j_e(t,i.length),s=z_e(r,i),o=W_e(t,i),{polygons:a,centers:l}=X_e(o,t,i),c=$_e(a),u=K_e(t,i),f=Y_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 z_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=Ah([r,s]);do a=o,o=null,l=t(u,Ah(e[a])),i[a].forEach(f=>{let p=t(u,Ah(e[f]));if(p<l){l=p,o=f,c=f;return}});while(o!==null);return c}}function V_e(i){if(i.length<2)return{};let e=0;for(;isNaN(i[e][0]+i[e][1])&&e++<i.length;);let t=QD(i[e]),n=m6().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*RE(s);r.forEach(p=>i[p]=[o,0]),i.push([0,o]),i.push([-o,0]),i.push([0,-o]);let a=r1.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 q_e(i,e){let t=new Set;return e.length===2?[[0,1]]:(i.forEach(n=>{if(n[0]!==n[1]&&!(PE(n.map(r=>e[r]))<0))for(let r=0,s;r<3;r++)s=(r+1)%3,t.add(kp([n[r],n[s]]).join("-"))}),Array.from(t,n=>n.split("-").map(Number)))}function H_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 W_e(i,e){return i.map(t=>{let n=t.map(s=>e[s]).map(Ah),r=Sv(Sv(tl(n[1],n[0]),tl(n[2],n[1])),tl(n[0],n[2]));return K6(Tv(r))})}function j_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 X_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=Ah(t[0]),l=Ah(t[1]),c=Tv(Sv(a,l)),u=Tv(tl(a,l)),f=tl(c,u),p=[c,tl(c,f),tl(tl(c,f),f),tl(tl(tl(c,f),f),f)].map(K6).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=rY(t[a[0][3][0]],t[a[0][3][1]],r[l[0]]),f=rY(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 rY(i,e,t){i=Ah(i),e=Ah(e),t=Ah(t);let n=iY(Y6(tl(e,i),t));return K6(Tv(Sv(i,e)).map(r=>n*r))}function $_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 Y_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=kp([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 K_e(i,e){let t=new Set,n=[];i.map(a=>{if(!(PE(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 Z6(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=sY(e.points)}return e};return e._vx=function(t){if(typeof t=="object"&&"type"in t)return eE(t)[0];if(0 in t)return t[0]},e._vy=function(t){if(typeof t=="object"&&"type"in t)return eE(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=>PE(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=>el(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||el([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 J6(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 Z_e(i){if(Array.isArray(i))return i}function Q_e(i){if(Array.isArray(i))return J6(i)}function J_e(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function e1e(i,e,t){return e=NE(e),l1e(i,aY()?Reflect.construct(e,[],NE(i).constructor):e.apply(i,t))}function t1e(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function n1e(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function NE(i){return NE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},NE(i)}function i1e(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&&e8(i,e)}function aY(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(aY=function(){return!!i})()}function r1e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function s1e(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 o1e(){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 a1e(){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 l1e(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 J_e(i)}function e8(i,e){return e8=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},e8(i,e)}function mh(i,e){return Z_e(i)||s1e(i,e)||lY(i,e)||o1e()}function Q6(i){return Q_e(i)||r1e(i)||lY(i)||a1e()}function lY(i,e){if(i){if(typeof i=="string")return J6(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)?J6(i,e):void 0}}function c1e(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.resolution,n=t===void 0?1/0:t,r=u1e(i,n),s=ch(r),o=h1e(i,n),a=[].concat(Q6(s),Q6(o)),l={type:"Polygon",coordinates:i},c=j3(l),u=mh(c,2),f=mh(u[0],2),p=f[0],x=f[1],v=mh(u[1],2),w=v[0],S=v[1],T=p>w||S>=89||x<=-89,P=[];if(T){var R=Z6(a).triangles(),C=new Map(a.map(function(ee,ae){var ce=mh(ee,2),de=ce[0],be=ce[1];return["".concat(de,"-").concat(be),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=mh(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 be=ee.properties.circumcenter;if(!t8(be,l,T))return}(ae=P).push.apply(ae,de)}})}else if(o.length)for(var B=Xp.from(a),z=function(ae){var ce,de=[2,1,0].map(function(Qe){return B.triangles[ae+Qe]}),be=de.map(function(Qe){return a[Qe]});if(de.some(function(Qe){return Qe<s.length})){var Ie=[0,1].map(function(Qe){return C3(be,function(Ue){return Ue[Qe]})});if(!t8(Ie,l,T))return 1}(ce=P).push.apply(ce,Q6(de))},V=0,H=B.triangles.length;V<H;V+=3)z(V);else{var L=Z_(r),D=L.vertices,F=L.holes,N=F===void 0?[]:F;P=P6(D,N,2)}var K=Qa(kp(a,function(ee){return ee[0]}),[0,1]),J=Qa(kp(a,function(ee){return ee[1]}),[0,1]),j=a.map(function(ee){var ae=mh(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 u1e(i,e){return i.map(function(t){var n=[],r;return t.forEach(function(s){if(r){var o=el(s,r)*180/Math.PI;if(o>e)for(var a=hm(r,s),l=1/Math.ceil(o/e),c=l;c<1;)n.push(a(c)),c+=l}n.push(r=s)}),n})}function h1e(i,e){var t={type:"Polygon",coordinates:i},n=j3(t),r=mh(n,2),s=mh(r[0],2),o=s[0],a=s[1],l=mh(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 f1e(e,{minLng:o,maxLng:c,minLat:a,maxLat:u}).filter(function(p){return t8(p,t,f)})}function f1e(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 t8(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return t?s6(e,i):J$(i,e)}var IE=window.THREE?window.THREE:{BufferGeometry:qn,Float32BufferAttribute:Rn},oY=new IE.BufferGeometry().setAttribute?"setAttribute":"addAttribute",LE=(function(i){function e(t,n,r,s,o,a,l){var c;t1e(this,e),c=e1e(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=c1e(t,{resolution:l}),f=u.contour,p=u.triangles,x=ch(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[oY]("position",new IE.Float32BufferAttribute(v,3)),c[oY]("uv",new IE.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=mh(V,2),K=H[0],J=H[1];return d1e(J,K,N(K,J))})});return Z_(B)}function C(){for(var D=R(f,n),F=D.vertices,N=D.holes,B=R(f,r),z=B.vertices,V=ch([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 be=0;be<H;be+=1)ce.push(be/(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 i1e(e,i),n1e(e)})(IE.BufferGeometry);function d1e(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 n8(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 p1e(i){if(Array.isArray(i))return i}function A1e(i){if(Array.isArray(i))return n8(i)}function m1e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function g1e(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 _1e(){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 x1e(){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 y1e(i,e){if(i==null)return{};var t,n,r=v1e(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 v1e(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 b1e(i,e){return p1e(i)||g1e(i,e)||cY(i,e)||_1e()}function w1e(i){return A1e(i)||m1e(i)||cY(i)||x1e()}function S1e(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 T1e(i){var e=S1e(i,"string");return typeof e=="symbol"?e:e+""}function cY(i,e){if(i){if(typeof i=="string")return n8(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)?n8(i,e):void 0}}var uY=(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=y1e(S,[x].map(T1e));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=b1e(u,2),p=f[0],x=f[1];return a(x,[].concat(w1e(c),[p]))})})(s),e instanceof Array&&e.length===0&&o.length===1&&(o[0].keys=[])),o});var fi=(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 wi=wt(nt);if(wi){It(wi.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":be[Ne>>3]=nt;break;default:N0("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 be[Ne>>3];default:N0("invalid type for getValue: "+nt)}return null}var S=!1;function T(Ne,nt){Ne||N0("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 $i={string:function(Jn){var Ni=0;if(Jn!=null&&Jn!==0){var Qb=(Jn.length<<2)+1;Ni=A9(Qb),B(Jn,Ni,Qb)}return Ni},array:function(Jn){var Ni=A9(Jn.length);return V(Jn,Ni),Ni}};function wi(Jn){return nt==="string"?F(Jn):nt==="boolean"?!!Jn:Jn}var ne=P(Ne),Yi=[],Ba=0;if(He)for(var Xs=0;Xs<He.length;Xs++){var Fs=$i[It[Xs]];Fs?(Ba===0&&(Ba=hre()),Yi[Xs]=Fs(He[Xs])):Yi[Xs]=He[Xs]}var ss=ne.apply(null,Yi);return ss=wi(ss),Ba!==0&&ure(Ba),ss}function C(Ne,nt,It,He){It=It||[];var h=It.every(function(wi){return wi==="number"}),$i=nt!=="string";return $i&&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 $i="";nt<h;){var wi=Ne[nt++];if(!(wi&128)){$i+=String.fromCharCode(wi);continue}var ne=Ne[nt++]&63;if((wi&224)==192){$i+=String.fromCharCode((wi&31)<<6|ne);continue}var Yi=Ne[nt++]&63;if((wi&240)==224?wi=(wi&15)<<12|ne<<6|Yi:wi=(wi&7)<<18|ne<<12|Yi<<6|Ne[nt++]&63,wi<65536)$i+=String.fromCharCode(wi);else{var Ba=wi-65536;$i+=String.fromCharCode(55296|Ba>>10,56320|Ba&1023)}}return $i}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,$i=It+He-1,wi=0;wi<Ne.length;++wi){var ne=Ne.charCodeAt(wi);if(ne>=55296&&ne<=57343){var Yi=Ne.charCodeAt(++wi);ne=65536+((ne&1023)<<10)|Yi&1023}if(ne<=127){if(It>=$i)break;nt[It++]=ne}else if(ne<=2047){if(It+1>=$i)break;nt[It++]=192|ne>>6,nt[It++]=128|ne&63}else if(ne<=65535){if(It+2>=$i)break;nt[It++]=224|ne>>12,nt[It++]=128|ne>>6&63,nt[It++]=128|ne&63}else{if(It+3>=$i)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,be;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=be=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 pi(Ne){Qt++,e.monitorRunDependencies&&e.monitorRunDependencies(Qt)}function Bn(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){N0("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){N0("OOM")}function Pn(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,$i=Math.max(nt,h);$i<Ne;)$i<=536870912?$i=H(2*$i,It):$i=Math.min(H((3*$i+2147483648)/4,It),He);var wi=Pn($i);return!!wi}var bt=typeof atob=="function"?atob:function(Ne){var nt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",It="",He,h,$i,wi,ne,Yi,Ba,Xs=0;Ne=Ne.replace(/[^A-Za-z0-9\+\/\=]/g,"");do wi=nt.indexOf(Ne.charAt(Xs++)),ne=nt.indexOf(Ne.charAt(Xs++)),Yi=nt.indexOf(Ne.charAt(Xs++)),Ba=nt.indexOf(Ne.charAt(Xs++)),He=wi<<2|ne>>4,h=(ne&15)<<4|Yi>>2,$i=(Yi&3)<<6|Ba,It=It+String.fromCharCode(He),Yi!==64&&(It=It+String.fromCharCode(h)),Ba!==64&&(It=It+String.fromCharCode($i));while(Xs<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:N0,b:f,c:p,d:en,e:cn,f:Pt,g:Mt,h:xe,i:yn,j:St,k:qe,l:Pn,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),$i=new Ne.Uint8Array(It),wi=new Ne.Float32Array(It),ne=new Ne.Float64Array(It),Yi=nt.o|0,Ba=nt.p|0,Xs=Ne.Math.floor,Fs=Ne.Math.abs,ss=Ne.Math.sqrt,Jn=Ne.Math.cos,Ni=Ne.Math.sin,Qb=Ne.Math.tan,fre=Ne.Math.acos,lx=Ne.Math.asin,x9=Ne.Math.atan,sa=Ne.Math.atan2,sg=Ne.Math.ceil,Ua=Ne.Math.imul,M4=Ne.Math.min,dre=Ne.Math.max,Jh=Ne.Math.clz32,pre=nt.a,Dn=nt.b,Q=nt.c,ci=nt.d,y9=nt.e,Are=nt.f,mre=nt.g,gre=nt.h,_re=nt.i,Y=28416;function xre(d){return He=new Int8Array(d),$i=new Uint8Array(d),h=new Int32Array(d),wi=new Float32Array(d),ne=new Float64Array(d),It=d,!0}function yre(d){d=d|0;var A=0;return A=Y,Y=Y+d|0,Y=Y+15&-16,A|0}function vre(){return Y|0}function bre(d){d=d|0,Y=d}function wre(d,A){d=d|0,A=A|0,Y=d}function Sre(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=nw(15,A)|0,A|0):(m=((d|0)<0)<<31>>31,g=ur(d|0,m|0,3,0)|0,_=Q()|0,m=pt(d|0,m|0,1,0)|0,m=ur(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 v9(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,b9(d,A,m,_,0)|0}function b9(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,!(w9(d,A,m,_,g)|0))return _=0,Y=M,_|0;do if((m|0)>=0){if((m|0)>13780509){if(y=nw(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=ur(m|0,y|0,3,0)|0,E=Q()|0,y=pt(m|0,y|0,1,0)|0,y=ur(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(dd(_|0,0,b<<3|0)|0,g|0){dd(g|0,0,b<<2|0)|0,y=gu(d,A,m,_,g,b,E,0)|0;break}y=oa(b,4)|0,y?(I=gu(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 w9(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),Gi(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=Os(y,A,4,$,W)|0,y|0)break e;if(A=W,y=h[A>>2]|0,A=h[A+4>>2]|0,Gi(y,A)|0){y=9;break e}}if(y=Os(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,Gi(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=Os(y,A,4,$,W)|0,y|0)break e;if(A=W,y=h[A>>2]|0,A=h[A+4>>2]|0,Gi(y,A)|0){y=9;break e}}if(y=Os(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,Gi(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 gu(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=ef(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=fd(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=Os(d,A,2,W,$)|0,M|0){case 9:{q=9;break}case 0:{M=$,M=gu(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=Os(d,A,3,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=gu(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=Os(d,A,1,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=gu(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=Os(d,A,5,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=gu(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=Os(d,A,4,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=gu(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=Os(d,A,6,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=gu(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 Os(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=ka(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($=(Vl(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=L0($|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(lr(E)|0){t:do if((ka(d,A)|0)==1){if((O|0)!=(E|0))if(M9(E,h[7696+(O*28|0)>>2]|0)|0){d=k4(d,A)|0,b=1,A=Q()|0;break}else ci(27634,26928,533,26936);switch(M|0){case 3:{d=L0(d,A)|0,A=Q()|0,h[_>>2]=(h[_>>2]|0)+1,b=0;break t}case 5:{d=k4(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=U4(d,A)|0,A=Q()|0,y=y+1|0;while((y|0)!=(m|0))}if((O|0)!=(E|0)){if(!(C4(E)|0)){if((b|0)!=0|(ka(d,A)|0)!=5)break;h[_>>2]=(h[_>>2]|0)+1;break}switch(G&127){case 8:case 118:break e;default:}(ka(d,A)|0)!=3&&(h[_>>2]=(h[_>>2]|0)+1)}}else if((m|0)>0){y=0;do d=L0(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 Tre(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,S9(d,A,m,_)|0?(dd(_|0,0,m*48|0)|0,_=Ere(d,A,m,_)|0,_|0):(_=0,_|0)}function S9(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(Gi(d,A)|0)d=9;else{g=0,G=d;do{if(d=Os(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,Gi(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=Os(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,!(Gi(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=Os(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,Gi(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 Ere(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=nw(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=ur(m|0,g|0,3,0)|0,y=Q()|0,g=pt(m|0,g|0,1,0)|0,g=ur(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=oa(g,8)|0,!I)g=13;else{if(O=oa(g,4)|0,!O){_t(I),g=13;break}if(g=gu(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 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;for(E=Y,Y=Y+16|0,y=E,b=E+8|0,g=(Gi(d,A)|0)==0,g=g?1:2;;){if(h[b>>2]=0,I=(Os(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 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;if(E=Y,Y=Y+48|0,g=E+16|0,y=E+8|0,b=E,m=mx(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,W9(y,g),m=I9(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 T9(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,we=0,me=0,Fe=0,Ke=0,Ee=0,ve=0,At=0,We=0,Ot=0,at=0,dt=0,ui=0,gi=0,lo=0,Un=0,_i=0,aa=0;if(gi=Y,Y=Y+64|0,Ot=gi+48|0,at=gi+32|0,dt=gi+24|0,Fe=gi+8|0,Ke=gi,M=h[d>>2]|0,(M|0)<=0)return ui=0,Y=gi,ui|0;for(Ee=d+4|0,ve=Ot+8|0,At=at+8|0,We=Fe+8|0,E=0,we=0;;){I=h[Ee>>2]|0,re=I+(we<<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],(we|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+(we+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=Vre(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(Un=1/(+(I>>>0)+4294967296*+(M|0)),aa=+ne[Ot>>3],M=Bs(I|0,M|0,_e|0,re|0)|0,_i=+(M>>>0)+4294967296*+(Q()|0),lo=+(_e>>>0)+4294967296*+(re|0),ne[Fe>>3]=Un*(aa*_i)+Un*(+ne[at>>3]*lo),ne[We>>3]=Un*(+ne[ve>>3]*_i)+Un*(+ne[At>>3]*lo),M=G4(Fe,_,Ke)|0,M|0){E=M;break}ue=Ke,oe=h[ue>>2]|0,ue=h[ue+4>>2]|0,q=ef(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,ui=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=fd(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,ui=16;break}}while(!1);if((ui|0)==16&&(ui=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(we=we+1|0,!I){ui=21;break}if(M=h[d>>2]|0,(we|0)>=(M|0)){E=0,ui=21;break}}return(ui|0)==21?(Y=gi,E|0):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,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,we=0,me=0,Fe=0,Ke=0,Ee=0,ve=0,At=0,We=0,Ot=0,at=0,dt=0,ui=0,gi=0,lo=0,Un=0,_i=0;if(_i=Y,Y=Y+112|0,ui=_i+80|0,M=_i+72|0,gi=_i,lo=_i+56|0,g=mx(m)|0,g|0)return Un=g,Y=_i,Un|0;if(I=d+8|0,Un=cr((h[I>>2]<<5)+32|0)|0,!Un)return Un=13,Y=_i,Un|0;if(X4(d,Un),g=mx(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,W9(M,ui),g=I9(ui,A,gi)|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=gi,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=gi,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=gi,h[g>>2]=at,h[g+4>>2]=dt,g=0}if(!g){if(m=oa(at,8)|0,!m)return _t(Un),Un=13,Y=_i,Un|0;if(E=oa(at,8)|0,!E)return _t(Un),_t(m),Un=13,Y=_i,Un|0;We=ui,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=T9(M,at,dt,A,ui,m,E)|0;e:do if(g)_t(m),_t(E),_t(Un);else{t:do if((h[I>>2]|0)>0){for(b=d+12|0,y=0;g=T9((h[b>>2]|0)+(y<<3)|0,at,dt,A,ui,m,E)|0,y=y+1|0,!(g|0);)if((y|0)>=(h[I>>2]|0))break t;_t(m),_t(E),_t(Un);break e}while(!1);(dt|0)>0|(dt|0)==0&at>>>0>0&&dd(E|0,0,at<<3|0)|0,Ot=ui,We=h[Ot+4>>2]|0;t:do if((We|0)>0|(We|0)==0&(h[Ot>>2]|0)>>>0>0){Ee=m,ve=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,we=0,y=0,b=0;;){E=gi,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,w9(I,A,1,gi,0)|0){E=gi,M=E+56|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));E=oa(7,4)|0,E|0&&(gu(I,A,1,gi,E,7,0,0)|0,_t(E))}for(oe=0;;){$=gi+(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=ef(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=fd(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}lg(W,$,lo)|0,$4(d,Un,lo)|0&&(q=pt(y|0,b|0,1,0)|0,b=Q()|0,G=E,h[G>>2]=W,h[G+4>>2]=$,y=ve+(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,we|0,1,0)|0,we=Q()|0,b=ui,y=h[b>>2]|0,b=h[b+4>>2]|0,(we|0)<(b|0)|(we|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 we=Ee+(y<<3)|0,h[we>>2]=0,h[we+4>>2]=0,y=pt(y|0,b|0,1,0)|0,b=Q()|0,we=ui,re=h[we+4>>2]|0;while((b|0)<(re|0)|((b|0)==(re|0)?y>>>0<(h[we>>2]|0)>>>0:0))}if(we=ui,h[we>>2]=E,h[we+4>>2]=M,(M|0)>0|(M|0)==0&E>>>0>0)oe=m,ue=Ke,_e=Ot,re=Fe,we=ve,m=me,Ke=g,Fe=At,me=oe,g=ue,Ot=We,We=_e,At=re,ve=Ee,Ee=we;else break t}_t(At),_t(We),_t(Un),g=1;break e}else g=E;while(!1);_t(Un),_t(m),_t(g),g=0}while(!1);return Un=g,Y=_i,Un|0}}return _t(Un),Un=g,Y=_i,Un|0}function Rre(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=Tse(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 zl(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=+Ni(+E)*+Ni(+g),_=+ne[y+(d<<4)+8>>3]-+ne[y+8>>3],m=+sa(+(+Ni(+_)*m),+(+Jn(+E)*+Jn(+g)+ +Jn(+_)*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,_=+Ni(+I)*+Ni(+M),E=+ne[y+(G<<4)+8>>3]-+ne[y+(O<<4)+8>>3],m=+sa(+(+Ni(+E)*_),+(+Jn(+I)*+Jn(+M)+ +Jn(+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 Pre(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=D0(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],zl(_,m)|0,y=0,Y=b,y|0)}function Ire(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=D0(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],zl(_,m)|0,ne[m>>3]=+ne[m>>3]*4058973249931477e-8,y=0,Y=b,y|0)}function Nre(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=D0(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],zl(_,m)|0,ne[m>>3]=+ne[m>>3]*4058973249931477e-8*1e6,y=0,Y=b,y|0)}function lr(d){return d=d|0,d>>>0>121?(d=0,d|0):(d=h[7696+(d*28|0)+16>>2]|0,d|0)}function C4(d){return d=d|0,(d|0)==4|(d|0)==117|0}function E9(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 Lre(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 Dre(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 Fre(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 M9(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 R4(d,A){return d=d|0,A=A|0,h[848+(d*28|0)+(A<<2)>>2]|0}function P4(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 Ore(){return 122}function Bre(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 Ure(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 kre(d){return d=d|0,+ne[d+16>>3]<+ne[d+24>>3]|0}function Gre(d){return d=d|0,+(+ne[d>>3]-+ne[d+8>>3])}function C9(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 I4(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=+fl(y,d),y<+fl(+ne[g>>3],A)||(O=+fl(+ne[m>>3],d),O>+fl(+ne[_>>3],A))?(E=0,E|0):(E=1,E|0))}function zre(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 R9(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=+fl(y,d),y<=+fl(+ne[g>>3],A)?(O=+fl(+ne[_>>3],d),E=O>=+fl(+ne[m>>3],A),E|0):(E=0,E|0))}function P9(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));bc(d|0,_|0,168)|0,Y=g}function I9(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=V4(A,I)|0,A|0?(W=A,Y=$,W|0):(M=I,I=h[M>>2]|0,M=h[M+4>>2]|0,lg(I,M,O)|0,D0(I,M,G)|0,b=+dx(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=+dx(O,G),ue=+ne[M>>3]-+ne[I>>3],y=+Fs(+ue),oe=+ne[O>>3]-+ne[G>>3],_=+Fs(+oe),!(ue==0|oe==0)&&(ue=+rG(+y,+_),ue=+sg(+(g*g/+cw(+(ue/+cw(+y,+_)),3)/(b*(b*2.59807621135)*.8))),ne[Yi>>3]=ue,q=~~ue>>>0,W=+Fs(ue)>=1?ue>0?~~+M4(+Xs(ue/4294967296),4294967295)>>>0:~~+sg((ue-+(~~ue>>>0))/4294967296)>>>0:0,(h[Yi+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 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,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=V4(m,M)|0,m|0?(_=m,Y=I,_|0):(m=M,g=h[m>>2]|0,m=h[m+4>>2]|0,lg(g,m,b)|0,D0(g,m,E)|0,O=+dx(b,E+8|0),O=+sg(+(+dx(d,A)/(O*2))),ne[Yi>>3]=O,m=~~O>>>0,g=+Fs(O)>=1?O>0?~~+M4(+Xs(O/4294967296),4294967295)>>>0:~~+sg((O-+(~~O>>>0))/4294967296)>>>0:0,(h[Yi+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 qre(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,we=0,me=0,Fe=0,Ke=0,Ee=0,ve=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,!(tw(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=cr(g)|0,!b)return at=13,Y=dt,at|0;for(bc(b|0,d|0,g|0)|0,sw(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=ur(A|0,m|0,6,0)|0,y=Q()|0,M){b=0,E=0;do at=d+(E<<3)|0,at=((Gi(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,we=y}else me=g,we=y;if(_e=ur(me|0,we|0,10,0)|0,re=Q()|0,Ot=cr(me<<5)|0,!Ot)return at=13,Y=dt,at|0;if(at=oa(_e,4)|0,!at)return _t(Ot),at=13,Y=dt,at|0;e:do if(M){for(ve=d,N4(h[ve>>2]|0,h[ve+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,ve=W+(G<<5)|0,h[ve>>2]=h[Ee>>2],h[ve+4>>2]=Ke,He[W+(G<<5)+9>>0]=0,He[W+(G<<5)+8>>0]=0,h[W+(G<<5)+20>>2]=W,ve=W+(G<<5)+24|0,h[ve>>2]=1,h[ve+4>>2]=0,ve=He[y+G>>0]|0,Ke=pt(I|0,O|0,G|0,q|0)|0,Ke=ef(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,ve=ve&255,h[W+(ve<<5)+16>>2]=W+((Ke&255)<<5),h[W+(ve<<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;ve=d+($<<3)|0,N4(h[ve>>2]|0,h[ve+4>>2]|0,At)|0||(W=Ot+(g<<5)|0)}ci(27634,26956,108,26975)}while(!1);if((we|0)>0|(we|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=ur(g^b|0,(Q()|0)^y|0,484763065,-1084733587)|0,b=Q()|0,g=et(y|0,b|0,27)|0,b=ur(g^y|0,(Q()|0)^b|0,321982955,-1798288965)|0,y=Q()|0,g=et(b|0,y|0,31)|0,y=ef(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=fd(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)<(we|0)|(M|0)==(we|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(ve=E,L9(h[ve>>2]|0,h[ve+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=ur(y^I|0,(Q()|0)^O|0,484763065,-1084733587)|0,b=Q()|0,g=et(y|0,b|0,27)|0,b=ur(g^y|0,(Q()|0)^b|0,321982955,-1798288965)|0,y=Q()|0,g=et(b|0,y|0,31)|0,y=ef(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(;ve=g,!((h[ve>>2]|0)==(I|0)&&(h[ve+4>>2]|0)==(O|0));)if(g=pt(y|0,b|0,1,0)|0,y=fd(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,ve=Ot+(G<<5)+12|0,h[(h[ve>>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[ve>>2],y=ew(E)|0,ve=ew(g)|0,g=y+24|0,m=h[g+4>>2]|0,Ee=ve+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:ve,y=Ee?ve:y,(y|0)!=(g|0)&&(Ke=g+24|0,ve=y+24|0,Ee=ve,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[ve>>2]=Ke,h[ve+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)<(we|0)|(q|0)==(we|0)&G>>>0<me>>>0);(We|0)==39&&ci(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)<(we|0)|(y|0)==(we|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,ve=g;while(!((h[ve>>2]|0)==(y|0)&&(h[ve+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)<(we|0)|(O|0)==(we|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)<(we|0)|(y|0)==(we|0)&g>>>0<me>>>0);Ee=b,Ke=E,g=1}else Ee=0,Ke=0,g=0;ve=cr(Ee*24|0)|0;e:do if(ve|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($=cr(y<<4)|0,!$)break;y=oe,b=ue,W=0,q=0,E=0,M=0;do{if(cx(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=Wse($,W<<4)|0,!y){We=75;break}ue=ew(g)|0,re=h[ue+4>>2]|0,g=ve+(m*24|0)|0,h[g>>2]=h[ue>>2],h[g+4>>2]=re,g=ve+(m*24|0)+16|0,h[g>>2]=W,h[ve+(m*24|0)+20>>2]=y,h[At>>2]=h[g>>2],h[At+4>>2]=h[g+4>>2],zl(At,ve+(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)<(we|0)|(A|0)==(we|0)&d>>>0<me>>>0)_e=g,m=y;else break t}if((We|0)==69?ci(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[ve+(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(ve);break e}while(!1);sw(ve,Ee,24,2);t:do if((Ee|0)==0&(Ke|0)==0){if(re=cr(192)|0,re|0){if(h[re+16>>2]=0,h[re+20>>2]=0,q=re+8|0,h[q>>2]=3,g=cr(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],zl(At,re)|0,h[re+40>>2]=0,h[re+44>>2]=0,G=re+32|0,h[G>>2]=3,g=cr(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],zl(At,re+24|0)|0,h[re+64>>2]=0,h[re+68>>2]=0,O=re+56|0,h[O>>2]=3,g=cr(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],zl(At,re+48|0)|0,h[re+88>>2]=0,h[re+92>>2]=0,I=re+80|0,h[I>>2]=3,g=cr(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],zl(At,re+72|0)|0,h[re+112>>2]=0,h[re+116>>2]=0,M=re+104|0,h[M>>2]=3,g=cr(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],zl(At,re+96|0)|0,h[re+136>>2]=0,h[re+140>>2]=0,E=re+128|0,h[E>>2]=3,g=cr(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],zl(At,re+120|0)|0,h[re+160>>2]=0,h[re+164>>2]=0,b=re+152|0,h[b>>2]=3,g=cr(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],zl(At,re+144|0)|0,h[re+184>>2]=0,h[re+188>>2]=0,y=re+176|0,h[y>>2]=3,g=cr(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],zl(At,re+168|0)|0,sw(re,8,24,3),g=cr(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=ve+(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=cr(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=ve+(y*24|0)|0,We=ve+(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=ve+(y*24|0)|0,We=Bs(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=cr(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=ve+(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[ve+(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(sw(d,ue,24,3),g=cr(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(ve),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[ve+(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(ve),_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 Wre(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 ew(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=ew(m)|0,h[A>>2]=m,m|0)}function jre(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 Xre(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 $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;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){B4(d,A,y,O)|0,B4(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&&Gi(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 v9(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 Yre(d,A,m,_,g){return d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,m=Jb(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 Kre(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 Zre(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,_=Os(d,A&-2130706433|134217728,y&7,_,m)|0,Y=g,_|0):(_=6,Y=g,_|0)}function N9(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&(Gi(d,m)|0)!=0?(m=0,m|0):(m=tw(d,m)|0,m|0)}function Qre(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,_=Os(d,y,A&7,_,m+8|0)|0,Y=g,_|0):(_=6,Y=g,_|0)}function N4(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0;return g=(Gi(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 cx(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,_=Vse(d,y,_&7)|0,(_|0)==-1?(h[m>>2]=0,y=6,Y=b,y|0):(ag(d,y,g)|0&&ci(27634,27035,282,27050),A=et(d|0,A|0,52)|0,Q()|0,A=A&15,Gi(d,y)|0?L4(g,A,_,2,m):D4(g,A,_,2,m),y=0,Y=b,y|0)):(y=6,Y=b,y|0)}function L9(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=Os(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=Jb(_,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 Jre(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,we=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=+fre(+(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],we=+ne[15888+(d*24|0)+8>>3],_e=+ne[15888+(d*24|0)+16>>3],Fe=-(_e+(re*0+we*0)),b=re*Fe+0,oe=we*Fe+0,Fe=_e*Fe+1,ue=+ss(+(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*we+M*_e),$=I+re*Fe,_=O+we*Fe,I=M+_e*Fe,O=+ss(+(I*I+($*$+_*_))),O=O>0?1/O:0,$=$*O,_=_*O,O=I*O,_=+fx(me-+fx(+sa(+(O*(we*b-re*oe)+($*(_e*oe-we*ue)+_*(re*ue-_e*b))),+(ue*O+(b*$+oe*_))))),Vl(A)|0?b=+fx(_+-.3334731722518321):b=_,_=+Qb(+y)*2.618033988749896,(A|0)>0){d=0;do _=_*2.6457513110645907,d=d+1|0;while((d|0)!=(A|0))}M=+Jn(+b)*_,b=+Ni(+b)*_}A=m+4|0,W=m+12|0,h[W>>2]=0,y=+Fs(+b)*1.1547005383792515,_=+Fs(+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=Bs(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=Bs(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 ese(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,ux(g,h[d>>2]|0,A,0,m),Y=_}function ux(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=+zse(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=+sa(+ +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=(Vl(m)|0)==0,y=+x9(+((m?E:E*.37796447300922725)*.381966011250105))):(y=+x9(+(y*.381966011250105)),Vl(m)|0&&(b=+fx(b+.3334731722518321))),G=+fx(+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=+ss(+(W*W+(I*I+b*b))),q=q>0?1/q:0,I=I*q,b=b*q,q=W*q,W=+Jn(+G),G=+Ni(+G),ue=+Jn(+y),$=+Ni(+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=+ss(+(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 L4(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,we=0,me=0,Fe=0,Ke=0,Ee=0,ve=0,At=0,We=0,Ot=0,at=0,dt=0,ui=0,gi=0,lo=0,Un=0,_i=0,aa=0,_s=0,Wr=0,xs=0,os=0,Ga=0,$s=0,Ys=0,Hl=0,co=0,Si=0,F0=0;if(Ga=Y,Y=Y+256|0,y=Ga+240|0,ui=Ga+224|0,Wr=Ga,xs=Ga+208|0,os=Ga+192|0,gi=Ga+168|0,lo=Ga+152|0,Un=Ga+136|0,_i=Ga+120|0,aa=Ga+104|0,_s=Ga+80|0,h[y>>2]=A,h[ui>>2]=h[d>>2],h[ui+4>>2]=h[d+4>>2],h[ui+8>>2]=h[d+8>>2],h[ui+12>>2]=h[d+12>>2],D9(ui,y,Wr),h[g>>2]=0,ui=_+m+((_|0)==5&1)|0,(ui|0)<=(m|0)){Y=Ga;return}me=h[y>>2]|0,we=xs+4|0,_e=xs+8|0,re=xs+12|0,Fe=os+8|0,Ke=m+5|0,Ee=16848+(me<<2)|0,ve=gi+8|0,At=16928+(me<<2)|0,We=lo+8|0,Ot=Un+8|0,at=_i+8|0,dt=os+8|0,W=gi+8|0,oe=gi+16|0,$=_s+8|0,ue=_s+16|0,q=m,_=0,b=0,E=0,M=0;e:for(;;){G=Wr+(((q|0)%5|0)<<4)|0,h[xs>>2]=h[G>>2],h[xs+4>>2]=h[G+4>>2],h[xs+8>>2]=h[G+8>>2],h[xs+12>>2]=h[G+12>>2];do;while((og(xs,me,0,1)|0)==2);if((q|0)>(m|0)&(Vl(A)|0)!=0){if(G=h[xs>>2]|0,d=h[we>>2]|0,I=h[_e>>2]|0,y=h[re>>2]|0,$s=+(E-M|0),ne[os>>3]=+(b-M|0)-$s*.5,ne[Fe>>3]=$s*.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 co=y+d|0,Si=(co|0)<0,I=_+d-(Si?co:0)|0,Hl=(I|0)<0,Ys=y+_-(Si?co:0)-(Hl?I:0)|0,y=(Ys|0)<0,d=(Si?0:co)-(Hl?I:0)-(y?Ys:0)|0,_=(Hl?0:I)-(y?Ys:0)|0,Ys=y?0:Ys,y=(_|0)<(d|0)?_:d,y=(Ys|0)<(y|0)?Ys:y,I=(y|0)>0,d=d-(I?y:0)|0,_=_-(I?y:0)|0,y=Ys-(I?y:0)|0,b=b+1|0;while((b|0)<(E|0))}else _=I;switch(Si=(h[Ee>>2]|0)*3|0,Ys=(Ua(Si,h[18608+(G*80|0)+(M*20|0)+4>>2]|0)|0)+d|0,I=(Ua(Si,h[18608+(G*80|0)+(M*20|0)+8>>2]|0)|0)+_|0,Si=(Ua(Si,h[18608+(G*80|0)+(M*20|0)+12>>2]|0)|0)+y|0,M=(Ys|0)<0,I=I-(M?Ys:0)|0,Hl=(I|0)<0,Si=Si+(M?0-Ys|0:0)+(Hl?0-I|0:0)|0,co=(Si|0)<0,Ys=(M?0:Ys)-(Hl?I:0)-(co?Si:0)|0,I=(Hl?0:I)-(co?Si:0)|0,Si=co?0:Si,co=(I|0)<(Ys|0)?I:Ys,co=(Si|0)<(co|0)?Si:co,Hl=(co|0)>0,Si=Si-(Hl?co:0)|0,$s=+(I-(Hl?co:0)-Si|0),ne[gi>>3]=+(Ys-(Hl?co:0)-Si|0)-$s*.5,ne[ve>>3]=$s*.8660254037844386,$s=+(h[At>>2]|0),ne[lo>>3]=$s*3,ne[We>>3]=0,F0=$s*-1.5,ne[Un>>3]=F0,ne[Ot>>3]=$s*2.598076211353316,ne[_i>>3]=F0,ne[at>>3]=$s*-2.598076211353316,h[17008+(O*80|0)+(G<<2)>>2]|0){case 1:{d=Un,_=lo;break}case 3:{d=_i,_=Un;break}case 2:{d=lo,_=_i;break}default:{d=12;break e}}$9(os,gi,_,d,aa),ux(aa,O,me,1,_s),Si=h[g>>2]|0,$s=+lx(+ +ne[ue>>3]),F0=+sa(+ +ne[$>>3],+ +ne[_s>>3]),ne[g+8+(Si<<4)>>3]=$s,ne[g+8+(Si<<4)+8>>3]=F0,h[g>>2]=(h[g>>2]|0)+1}if((q|0)<(Ke|0)&&(Si=h[re>>2]|0,$s=+((h[_e>>2]|0)-Si|0),ne[os>>3]=+((h[we>>2]|0)-Si|0)-$s*.5,ne[dt>>3]=$s*.8660254037844386,ux(os,h[xs>>2]|0,me,1,gi),Si=h[g>>2]|0,$s=+lx(+ +ne[oe>>3]),F0=+sa(+ +ne[W>>3],+ +ne[gi>>3]),ne[g+8+(Si<<4)>>3]=$s,ne[g+8+(Si<<4)+8>>3]=F0,h[g>>2]=(h[g>>2]|0)+1),q=q+1|0,(q|0)>=(ui|0)){d=3;break}else _=h[xs>>2]|0,b=h[we>>2]|0,E=h[_e>>2]|0,M=h[re>>2]|0}if((d|0)==3){Y=Ga;return}else(d|0)==12&&ci(27073,27120,599,27130)}function D9(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=(Vl(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-_),Vl(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 og(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=Ua(oe,h[g+8>>2]|0)|0,_e=Ua(oe,h[g+12>>2]|0)|0,b=(Ua(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 tse(d,A){d=d|0,A=A|0;var m=0;do m=og(d,A,0,1)|0;while((m|0)==2);return m|0}function D4(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,we=0,me=0,Fe=0,Ke=0,Ee=0,ve=0,At=0,We=0,Ot=0,at=0,dt=0,ui=0,gi=0,lo=0,Un=0,_i=0,aa=0,_s=0,Wr=0,xs=0,os=0;if(_s=Y,Y=Y+272|0,y=_s+256|0,b=_s+240|0,Un=_s,_i=_s+224|0,aa=_s+208|0,We=_s+184|0,Ot=_s+168|0,at=_s+152|0,dt=_s+136|0,ui=_s+120|0,gi=_s+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],F9(b,y,Un),h[g>>2]=0,At=_+m+((_|0)==6&1)|0,(At|0)<=(m|0)){Y=_s;return}_e=h[y>>2]|0,re=m+6|0,we=aa+8|0,me=We+8|0,Fe=16928+(_e<<2)|0,Ke=Ot+8|0,Ee=at+8|0,ve=dt+8|0,oe=h[b>>2]|0,q=_i+4|0,W=_i+8|0,$=_i+12|0,ue=aa+8|0,M=We+8|0,O=We+16|0,I=gi+8|0,G=gi+16|0,b=0,E=m,_=-1;e:for(;;){if(y=(E|0)%6|0,d=Un+(y<<4)|0,h[_i>>2]=h[d>>2],h[_i+4>>2]=h[d+4>>2],h[_i+8>>2]=h[d+8>>2],h[_i+12>>2]=h[d+12>>2],d=b,b=og(_i,_e,0,1)|0,(E|0)>(m|0)&(Vl(A)|0)!=0&&(lo=h[_i>>2]|0,(d|0)!=1&(lo|0)!=(_|0))){switch(os=(y+5|0)%6|0,d=h[Un+(os<<4)+12>>2]|0,Wr=+((h[Un+(os<<4)+8>>2]|0)-d|0),ne[aa>>3]=+((h[Un+(os<<4)+4>>2]|0)-d|0)-Wr*.5,ne[we>>3]=Wr*.8660254037844386,d=h[Un+(y<<4)+12>>2]|0,Wr=+((h[Un+(y<<4)+8>>2]|0)-d|0),ne[We>>3]=+((h[Un+(y<<4)+4>>2]|0)-d|0)-Wr*.5,ne[me>>3]=Wr*.8660254037844386,Wr=+(h[Fe>>2]|0),ne[Ot>>3]=Wr*3,ne[Ke>>3]=0,xs=Wr*-1.5,ne[at>>3]=xs,ne[Ee>>3]=Wr*2.598076211353316,ne[dt>>3]=xs,ne[ve>>3]=Wr*-2.598076211353316,h[17008+(oe*80|0)+(((_|0)==(oe|0)?lo:_)<<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}}$9(aa,We,_,d,ui),!(Y9(aa,ui)|0)&&!(Y9(We,ui)|0)&&(ux(ui,oe,_e,1,gi),os=h[g>>2]|0,Wr=+lx(+ +ne[G>>3]),xs=+sa(+ +ne[I>>3],+ +ne[gi>>3]),ne[g+8+(os<<4)>>3]=Wr,ne[g+8+(os<<4)+8>>3]=xs,h[g>>2]=(h[g>>2]|0)+1)}if((E|0)<(re|0)&&(os=h[$>>2]|0,Wr=+((h[W>>2]|0)-os|0),ne[aa>>3]=+((h[q>>2]|0)-os|0)-Wr*.5,ne[ue>>3]=Wr*.8660254037844386,ux(aa,h[_i>>2]|0,_e,1,We),os=h[g>>2]|0,Wr=+lx(+ +ne[O>>3]),xs=+sa(+ +ne[M>>3],+ +ne[We>>3]),ne[g+8+(os<<4)>>3]=Wr,ne[g+8+(os<<4)+8>>3]=xs,h[g>>2]=(h[g>>2]|0)+1),E=E+1|0,(E|0)>=(At|0)){d=3;break}else _=h[_i>>2]|0}if((d|0)==3){Y=_s;return}else(d|0)==8&&ci(27157,27120,766,27202)}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,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=(Vl(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-_),Vl(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 O9(d,A){return d=d|0,A=A|0,A=et(d|0,A|0,45)|0,Q()|0,A&127|0}function nse(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 ise(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 tw(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=Bs(-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=Z4(d|0,A|0,0)|0,Q()|0,((63-b|0)%3|0|0)!=0|0))}function rse(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=Bs(-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=Z4(d|0,m|0,0)|0,Q()|0,(63-b|0)%3|0|0))||N9(d,A)|0?(b=1,b|0):(b=(K9(d,A)|0)!=0&1,b|0)}function O4(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 B4(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 hx(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(!(lr(m&127)|0))m=ud(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=ud(7,0,g,((g|0)<0)<<31>>31)|0,g=Q()|0;break e}while(!1);m=ud(7,0,g,((g|0)<0)<<31>>31)|0,m=ur(m|0,Q()|0,5,0)|0,m=pt(m|0,Q()|0,-5,-1)|0,m=hd(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 Gi(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,!(lr(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 sse(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,q4(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,H4(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 B9(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,(_|0)<(m|0)?(m=A,_=d,Dn(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,Dn(m|0),_|0)}function U9(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 ose(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,we=0,me=0,Fe=0,Ke=0,Ee=0,ve=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=cr(We)|0,!at)return dt=13,dt|0;if(bc(at|0,d|0,We|0)|0,Ot=oa(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,ve=et(I|0,g|0,52)|0,Q()|0,ve=ve&15,At=ve+-1|0,Ee=(ve|0)!=0,Ke=(_|0)>0|(_|0)==0&m>>>0>0;t:do if(Ee&Ke){if(re=ht(At|0,0,52)|0,we=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|we,O>>>0>=ve>>>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=ef(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(!(lr(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=fd(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=hd(m|0,_|0,6,0)|0,Q()|0,Fe=oa(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(lr(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,we=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|we,W>>>0>=ve>>>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;$=ef(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,$=fd(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(dd(Ot|0,0,We|0)|0,bc(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)ci(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?ci(27634,27225,711,27235):(dt|0)==81?ci(27634,27225,723,27235):(dt|0)==85&&(bc(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 ase(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(q4($,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,H4($),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 lse(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=(hx(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 cse(d,A){return d=d|0,A=A|0,A=et(d|0,A|0,52)|0,Q()|0,A&1|0}function ka(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 U4(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,Dn(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 Dn(A|0),d|0}function L0(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,Dn(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 Dn(A|0),d|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;if(O=et(d|0,A|0,52)|0,Q()|0,O=O&15,!O)return I=A,O=d,Dn(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 Dn(A|0),d|0}function k4(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,Dn(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 Dn(A|0),d|0}function hse(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,we=0,me=0,Fe=0,Ke=0,Ee=0;if(me=Y,Y=Y+16|0,we=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,we=0,Dn(re|0),Y=me,we|0):(ht(E9(d)|0,0,45)|0,re=Q()|0|m,we=-1,Dn(re|0),Y=me,we|0);h[we>>2]=h[d>>2],h[we+4>>2]=h[d+4>>2],h[we+8>>2]=h[d+8>>2],h[we+12>>2]=h[d+12>>2],re=we+4|0;e:do if((A|0)>0)for(oe=we+8|0,ue=we+12|0,$=A,G=h[oe>>2]|0,q=h[ue>>2]|0,A=-1,O=h[we+4>>2]|0;;){W=$,$=$+-1|0,d=O-q|0,_=G-q|0,W&1?(y=_u(+((d*3|0)-_|0)*.14285714285714285)|0,h[re>>2]=y,d=_u(+((_<<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=_u(+((d<<1)+_|0)*.14285714285714285)|0,h[re>>2]=E,g=_u(+((_*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[we+8>>2]|0)<=2&&(h[we+12>>2]|0)<=2){if(_=E9(we)|0,d=ht(_|0,0,45)|0,A=d|A,d=Q()|0|m&-1040385,M=Lre(we)|0,!(lr(_)|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(M9(_,h[we>>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=U4(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,Dn(Ke|0),Y=me,Ee|0}function Vl(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[Yi>>3]=y,(h[Yi+4>>2]&2146435072|0)==2146435072||(_=+ne[d+8>>3],ne[Yi>>3]=_,(h[Yi+4>>2]&2146435072|0)==2146435072))return I=3,Y=O,I|0;g=+Jn(+y),G=g*+Jn(+_),g=g*+Ni(+_),_=+Ni(+y),ne[I>>3]=G,ne[I+8>>3]=g,ne[I+16>>3]=_,ne[Yi>>3]=G;do if((h[Yi+4>>2]&2146435072|0)!=2146435072&&(ne[Yi>>3]=_,d=h[Yi+4>>2]|0,ne[Yi>>3]=g,!((h[Yi+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],Jre(E,A,M),M=hse(M,A)|0,I=Q()|0,h[m>>2]=M,h[m+4>>2]=I,(M|0)==0&(I|0)==0)ci(27634,27225,1073,27248);else{b=0;break}else b=2;while(!1);return I=b,Y=O,I|0}function z4(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,lr(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 ag(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((lr(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],!(z4(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,!(lr(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(!(og(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(lr(q)|0)do;while((og(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=_u(+((_<<1)+d|0)*.14285714285714285)|0,h[W>>2]=A,_=_u(+((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 lg(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=ag(d,A,_)|0,y?(Y=b,y|0):(y=et(d|0,A|0,52)|0,Q()|0,ese(_,y&15,g),M=+lx(+ +ne[g+16>>3]),E=+sa(+ +ne[g+8>>3],+ +ne[g>>3]),ne[m>>3]=M,ne[m+8>>3]=E,y=0,Y=b,y|0)}function D0(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,_=ag(d,A,y)|0,_|0)return y=_,Y=b,y|0;_=et(d|0,A|0,45)|0,Q()|0,_=(lr(_&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 L4(y,g,0,5,m),E=0,Y=b,E|0}while(!1);return D4(y,g,0,6,m),E=0,Y=b,E|0}function fse(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,!(lr(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 k9(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(lr(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=k9((M|d)&~I,O&~(Q()|0),m)|0,Y=G,O|0}else g=0;while(!1);if(_=ag(d,A,y)|0,!_){g?(D9(y,I,O),M=5):(F9(y,I,O),M=6);e:do if(lr(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);dd(m|0,-1,d<<2|0)|0;e:do if(g)for(y=0;;){if(b=O+(y<<4)|0,tse(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,og(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 dse(){return 12}function V4(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 lr(_)|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(lr(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 pse(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(lr($&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,!(lr(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=ud(7,0,I,((I|0)<0)<<31>>31)|0,O=Q()|0,y?(y=ur(I|0,O|0,5,0)|0,y=pt(y|0,Q()|0,-5,-1)|0,y=hd(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=ur(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)ci(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=ud(7,0,b,((b|0)<0)<<31>>31)|0,g=ur(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 hx(oe,E,_e,ue)|0&&ci(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):(ci(27634,27225,1447,27259),0)}function Ase(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(hx(m,_,g,b)|0&&ci(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(lr(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=ud(7,0,E,((E|0)<0)<<31>>31)|0,m=Q()|0;do if(b)if(b=ur(E|0,m|0,5,0)|0,b=pt(b|0,Q()|0,-5,-1)|0,b=hd(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=Bs(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),_=hd(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=ur(_|0,d|0,E|0,m|0)|0,d=Bs(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=hd(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=ur(oe|0,b|0,E|0,m|0)|0,d=Bs(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,$=ud(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=hd(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=ur(q|0,W|0,$|0,oe|0)|0,d=Bs(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 q4(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=B9(A,m,g+1|0,_)|0,b=(Q()|0)&-15728641,m=ht(_|0,0,52)|0,m=A|m,b=b|(Q()|0),A=(Gi(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 G9(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=B9(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,Gi(g,y)|0){h[d>>2]=m;return}else{h[d>>2]=-1;return}}function H4(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 fx(d){d=+d;var A=0;return A=d<0?d+6.283185307179586:d,+(d>=6.283185307179586?A+-6.283185307179586:A)}function fl(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 mse(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=+Ni(+((g-_)*.5)),m=+Ni(+((+ne[A+8>>3]-+ne[d+8>>3])*.5)),m=y*y+m*(+Jn(+g)*+Jn(+_)*m),+(+sa(+ +ss(+m),+ +ss(+(1-m)))*2)}function dx(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=+Ni(+((g-_)*.5)),m=+Ni(+((+ne[A+8>>3]-+ne[d+8>>3])*.5)),m=y*y+m*(+Jn(+g)*+Jn(+_)*m),+(+sa(+ +ss(+m),+ +ss(+(1-m)))*2*6371.007180918475)}function gse(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=+Ni(+((g-_)*.5)),m=+Ni(+((+ne[A+8>>3]-+ne[d+8>>3])*.5)),m=y*y+m*(+Jn(+g)*+Jn(+_)*m),+(+sa(+ +ss(+m),+ +ss(+(1-m)))*2*6371.007180918475*1e3)}function z9(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 _se(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 xse(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 yse(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 nw(d,A){d=d|0,A=A|0;var m=0;return d>>>0>15?(A=4,A|0):(m=ud(7,0,d,((d|0)<0)<<31>>31)|0,m=ur(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 vse(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=cx(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=+Ni(+((_-I)*.5)),M=g,g=+ne[b+8+(d<<4)+8>>3],M=+Ni(+((g-M)*.5)),M=O*O+M*(+Jn(+_)*+Jn(+I)*M),y=y+ +sa(+ +ss(+M),+ +ss(+(1-M)))*2;while((d|0)<(A|0));return ne[m>>3]=y,b=0,Y=E,b|0}function bse(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=cx(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=+Ni(+((_-I)*.5)),M=g,g=+ne[b+8+(d<<4)+8>>3],M=+Ni(+((g-M)*.5)),M=O*O+M*(+Jn(+I)*+Jn(+_)*M),y=y+ +sa(+ +ss(+M),+ +ss(+(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 wse(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=cx(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=+Ni(+((_-I)*.5)),M=g,g=+ne[b+8+(d<<4)+8>>3],M=+Ni(+((g-M)*.5)),M=O*O+M*(+Jn(+I)*+Jn(+_)*M),y=y+ +sa(+ +ss(+M),+ +ss(+(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 Sse(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 Tse(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=oa(1,12)|0,!m){m=5;break}h[d+8>>2]=m,d=m}if(M=h[$>>2]|0,I=oa(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=cr(24)|0,!b){d=13,m=37;break e}Q4(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=oa(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=cr(24)|0,!y){d=13,m=37;break e}Q4(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 px(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=P4(M,I)|0,(b|0)==7)return ue=1,Y=_e,ue|0;E=P4(I,M)|0,(E|0)==7?ci(27291,27315,164,27325):(oe=b,y=E)}else oe=0,y=0;G=lr(M)|0,q=lr(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=use(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=k4(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(z4(M,E,ue)|0,W||ci(27340,27315,194,27325),b=(G|0)!=0,y=(q|0)!=0,b&y&&ci(27367,27315,195,27325),b){if(y=ka(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=ka(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,Vl(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(z4(m,_,ue)|0,(G|0)!=0&(q|0)!=0)if((I|0)!=(M|0)&&ci(27398,27315,264,27325),b=ka(d,A)|0,y=ka(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 V9(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,we=0,me=0,Fe=0,Ke=0,Ee=0,ve=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=lr(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,we=E-_e|0,ue=(we|0)<0,_e=(ue?0-we|0:0)+(m-_e)|0,m=(_e|0)<0,g=m?0:_e,_e=m?_e:0,m=(ue?0:we)-_e|0,_e=(A?0:b)-(ue?we:0)-_e|0,we=(m|0)<(_e|0)?m:_e,we=(g|0)<(we|0)?g:we,we=(we|0)>0?we:0,g=g-we|0,m=m-we|0;e:do switch(_e-we|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=R4(me,g)|0,(g|0)==127)?(_=1,_|0):(we=ht(g|0,0,45)|0,me=Q()|0,re=_,me=h[re+4>>2]&-1040385|me,h[_>>2]=h[re>>2]|we,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,Vl(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(ve=$<<1,O?(2147483647-ve|0)<($|0):(-2147483648-ve|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=_u(+(M-W|0)*.14285714285714285)|0,O=_u(+(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,ve=(W*3|0)+$-(Fe?Ke:0)|0,M=(ve|0)<0,G=($*3|0)+q-(Fe?Ke:0)-(M?ve:0)|0,O=(G|0)<0,Ee=O?0:G,I=(M?0:ve)-(O?G:0)|0,G=(Fe?0:Ke)-(M?ve:0)-(O?G:0)|0,O=(I|0)<(G|0)?I:G,O=(Ee|0)<(O|0)?Ee:O,ve=(O|0)>0,M=ve?O:0,I=I-(ve?O:0)|0,O=Ee-(ve?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=_u(+(M+W|0)*.14285714285714285)|0,O=_u(+(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,ve=(q?0-G|0:0)-(Ee?W:0)|0,$=(ve|0)<0,q=(q?0:G)-(Ee?W:0)-($?ve:0)|0,W=(Ee?0:W)-($?ve:0)|0,ve=$?0:ve,$=(W|0)<(q|0)?W:q,$=(ve|0)<($|0)?ve:$,Ee=($|0)>0,q=q-(Ee?$:0)|0,W=W-(Ee?$:0)|0,$=ve-(Ee?$:0)|0,Ee=(q*3|0)+$|0,ve=(Ee|0)<0,Fe=(W*3|0)+q-(ve?Ee:0)|0,M=(Fe|0)<0,G=($*3|0)+W-(ve?Ee:0)-(M?Fe:0)|0,O=(G|0)<0,Ke=O?0:G,I=(M?0:Fe)-(O?G:0)|0,G=(ve?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,ve=(G?0:I)-(b?Fe:0)|0,Fe=(Ee?0:M)-(G?I:0)-(b?Fe:0)|0,b=(ve|0)<(Fe|0)?ve: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,ve=ve-(m?b:0)-Ee|0,Ke=(ve|0)<0,Ee=(Ke?0-ve|0:0)+(O-(m?b:0)-Ee)|0,b=(Ee|0)<0,m=b?0:Ee,Ee=b?Ee:0,b=(Ke?0:ve)-Ee|0,Ee=(G?0:Fe)-(Ke?ve:0)-Ee|0,ve=(b|0)<(Ee|0)?b:Ee,ve=(m|0)<(ve|0)?m:ve,ve=(ve|0)>0?ve:0,m=m-ve|0,b=b-ve|0;e:do switch(Ee-ve|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,ve=_,h[ve>>2]=Ke|M,h[ve+4>>2]=Ee,(oe|0)<=1){re=47;break}else b=q,E=W,m=$}if((re|0)==24)ci(27634,27425,416,27447);else if((re|0)==36)ci(27634,27425,464,27461);else if((re|0)==47){if((q|0)>1|(W|0)>1|($|0)>1)return ve=1,ve|0;Fe=(q|0)<0,Ee=Fe?q:0,ve=W-Ee|0,Ke=(ve|0)<0,Ee=(Ke?0-ve|0:0)+($-Ee)|0,y=(Ee|0)<0,m=y?0:Ee,Ee=y?Ee:0,y=(Ke?0:ve)-Ee|0,Ee=(Fe?0:q)-(Ke?ve:0)-Ee|0,ve=(y|0)<(Ee|0)?y:Ee,ve=(m|0)<(ve|0)?m:ve,ve=(ve|0)>0?ve:0,m=m-ve|0,y=y-ve|0;e:do switch(Ee-ve|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=R4(me,y)|0,(E|0)==127?I=0:I=lr(E)|0;e:do if(y){if(ue){if(m=ka(d,A)|0,(m|0)==7)return ve=5,ve|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 ve=9,ve|0;y=R4(me,m)|0,(y|0)==127&&ci(27476,27315,415,27506),lr(y)|0?ci(27521,27315,416,27506):(g=y,we=b,_e=m)}else g=E,we=0,_e=y;if(M=h[4272+(me*28|0)+(_e<<2)>>2]|0,(M|0)<=-1&&ci(27552,27315,423,27506),!I){if((we|0)<0)return ve=5,ve|0;if(we|0){b=_,m=0,y=h[b>>2]|0,b=h[b+4>>2]|0;do y=L0(y,b)|0,b=Q()|0,ve=_,h[ve>>2]=y,h[ve+4>>2]=b,m=m+1|0;while((m|0)<(we|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=L0(y,b)|0,b=Q()|0,ve=_,h[ve>>2]=y,h[ve+4>>2]=b,m=m+1|0,(m|0)==(M|0)){re=104;break e}}if(E=P4(g,me)|0,(E|0)==7&&ci(27291,27315,432,27506),m=_,y=h[m>>2]|0,m=h[m+4>>2]|0,(M|0)>0){b=0;do y=L0(y,m)|0,m=Q()|0,ve=_,h[ve>>2]=y,h[ve+4>>2]=m,b=b+1|0;while((b|0)!=(M|0))}if(m=ka(y,m)|0,(m|0)==7&&ci(27634,27315,444,27506),y=C4(g)|0,y=h[(y?21760:21552)+(E*28|0)+(m<<2)>>2]|0,(y|0)<0&&ci(27634,27315,458,27506),!y)re=104;else{E=_,m=0,b=h[E>>2]|0,E=h[E+4>>2]|0;do b=U4(b,E)|0,E=Q()|0,ve=_,h[ve>>2]=b,h[ve+4>>2]=E,m=m+1|0;while((m|0)<(y|0));re=104}}else if((ue|0)!=0&(I|0)!=0){if(g=ka(d,A)|0,m=_,m=ka(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 ve=5,ve|0;if(!m)g=E,re=105;else{b=_,g=0,y=h[b>>2]|0,b=h[b+4>>2]|0;do y=L0(y,b)|0,b=Q()|0,ve=_,h[ve>>2]=y,h[ve+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&&(ve=_,(ka(h[ve>>2]|0,h[ve+4>>2]|0)|0)==1)?(ve=9,ve|0):(Ee=_,Fe=h[Ee>>2]|0,Ee=h[Ee+4>>2]&-1040385,Ke=ht(g|0,0,45)|0,Ee=Ee|(Q()|0),ve=_,h[ve>>2]=Fe|Ke,h[ve+4>>2]=Ee,ve=0,ve|0)}else if((re|0)==107)return g|0;return 0}function Ese(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=px(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 Mse(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-_),_=V9(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=px(d,A,d,A,b)|0,y|0?(E=y,Y=M,E|0):(d=px(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 Cse(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 Rse(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=q9(d,A,m,_,y,b,g,0,0,1,0)|0,E?(g=(q9(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 q9(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,we=0,me=0,Fe=0,Ke=0,Ee=0,ve=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,px(d,A,d,A,G)|0&&ci(27634,27315,696,27575),px(d,A,m,_,q)|0&&ci(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,ve=q+4|0,re=(h[ve>>2]|0)-re|0,h[ve>>2]=re,ve=re+_e|0,h[oe>>2]=0-ve,Ee=1/(+(g>>>0)+4294967296*+(y|0)),Fe=Ee*+(_e-m|0),Ke=Ee*+(re-_|0),Ee=Ee*+(At-ve|0),h[We>>2]=m,ve=We+4|0,h[ve>>2]=_,At=We+8|0,h[At>>2]=G,(y|0)<0)return I=0,Y=Ot,I|0;for(me=+(m|0),we=+(_|0),ue=+(G|0),_e=0,re=0;;){if($=+(_e>>>0)+4294967296*+(re|0),at=Fe*$+me,W=Ke*$+we,$=Ee*$+ue,_=~~+uw(+at),G=~~+uw(+W),m=~~+uw(+$),at=+Fs(+(+(_|0)-at)),W=+Fs(+(+(G|0)-W)),$=+Fs(+(+(m|0)-$)),at>W&at>$?(q=m+G|0,_=0-q|0):(q=0-_|0,W>$&&(G=q-m|0)),h[ve>>2]=G,h[We>>2]=q,h[At>>2]=0,m=_+G|0,(_|0)>0?(h[ve>>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[ve>>2]=0,q=G-_|0,m=0-_|0,(_|0)<0?(h[We>>2]=q,h[ve>>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[ve>>2]=oe-m,h[At>>2]=_-m),m=ur(_e|0,re|0,I|0,O|0)|0,m=pt(m|0,Q()|0,E|0,M|0)|0,Q()|0,m=V9(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 ud(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,Dn(g|0),y|0;y=d,g=A,d=1,A=0;do b=(m&1|0)==0&!0,d=ur((b?1:y)|0,(b?0:g)|0,d|0,A|0)|0,A=Q()|0,m=iG(m|0,_|0,1)|0,_=Q()|0,y=ur(y|0,g|0,y|0,g|0)|0,g=Q()|0;while(!((m|0)==0&(_|0)==0));return Dn(A|0),d|0}function j4(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=lg(d,A,y)|0,!g){I=+ne[y>>3],M=1/+Jn(+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 qre(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 Pse(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,O4(b,0,0,0),M=h[b>>2]|0,b=h[b+4>>2]|0;do if(m>>>0<=15){if(g=mx(_)|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=oa((h[A+8>>2]|0)+1|0,32)|0,g){X4(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);iw(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 iw(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,we=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=H9(m,_)|0,_=Q()|0):He[A>>0]=1,we=d+20|0,!(h[h[we>>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[we>>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=lg(m,_,W)|0,g|0){ue=15;break t}if($4(h[we>>2]|0,h[q>>2]|0,W)|0){ue=19;break t}break}default:}if(M&&(g=h[(h[we>>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],C9(26896,W)|0)){if(G4(h[(h[we>>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=D0(m,_,W)|0,g|0){ue=32;break}if(j4(m,_,$,0)|0){ue=36;break}if(b&&j9(h[we>>2]|0,h[q>>2]|0,W,$)|0){ue=42;break}if(M&&X9(h[we>>2]|0,h[q>>2]|0,W,$)|0){ue=42;break}}if(G){if(A=j4(m,_,W,1)|0,g=h[q>>2]|0,A|0){ue=45;break}if(I4(g,W)|0){if(P9($,W),R9(W,h[q>>2]|0)|0){ue=53;break}if($4(h[we>>2]|0,h[q>>2]|0,E)|0){ue=53;break}if(X9(h[we>>2]|0,h[q>>2]|0,$,W)|0){ue=53;break}}}}do if((y|0)<(h[oe>>2]|0)){if(A=j4(m,_,W,1)|0,g=h[q>>2]|0,A|0){ue=58;break t}if(!(I4(g,W)|0)){ue=73;break}if(R9(h[q>>2]|0,W)|0&&(P9($,W),j9(h[we>>2]|0,h[q>>2]|0,$,W)|0)){ue=65;break t}if(m=U9(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=H9(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[we>>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:{ci(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[we>>2]=0,h[oe>>2]=-1,h[re>>2]=0,h[q>>2]=0,h[d+8>>2]=g,Y=me;return}case 36:{ci(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[we>>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[we>>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[we>>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[we>>2]=0,h[d+12>>2]=-1,h[re>>2]=0,h[_e>>2]=0,Y=me}function H9(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&(Gi(m,g)|0)!=0,O=ht((O?2:1)+M|0,0,y|0)|0,I=Q()|0|A&~E,O=O|d&~b,Dn(I|0),Y=G,O|0}while(!1);return m=m&127,m>>>0>120?(I=0,O=0,Dn(I|0),Y=G,O|0):(O4(O,0,m+1|0,0),I=h[O+4>>2]|0,O=h[O>>2]|0,Dn(I|0),Y=G,O|0)}function Ise(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,Pse(G,d,A,m),I=G,q4(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,H4(q),d=q,A=h[d>>2]|0,d=h[d+4>>2]|0,(A|0)==0&(d|0)==0){if(iw(m),A=m,d=h[A>>2]|0,A=h[A+4>>2]|0,(d|0)==0&(A|0)==0){$=10;break}G9(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,G9(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 Nse(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;O4(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=mx(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=oa((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}X4(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=+Gre(m),q=q*+Ure(m),y=+Fs(+ +ne[m>>3]),y=q/+Jn(+ +cw(+y,+ +Fs(+ +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(z9(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(iw(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 hx(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,iw(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 Ax(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(!(C9(A,m)|0)||(A=kre(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 W9(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|+Fs(+(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 mx(d){return d=d|0,(d>>>0<4?0:15)|0}function X4(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,we=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,_=_|+Fs(+(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,we=A+(me<<5)+16|0,ne[we>>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[we>>3]=G,b=G),q=G>0&G<q?G:q,W=G<0&G>W?G:W,g=g|+Fs(+(G-E))>3.141592653589793,_=oe+1|0,(_|0)!=(_e|0);)Ee=oe,oe=_,O=y,_=Ee;g&&(ne[we>>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 $4(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;if(!(Ax(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,Ax((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 j9(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,!(Ax(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,Ax((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(rw(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(Ax(E,_,h[g+(b<<3)+4>>2]|0)|0){g=0;break e}if(g=b+1|0,rw((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 rw(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,we=0,me=0,Fe=0,Ke=0,Ee=0,ve=0;if(Ke=Y,Y=Y+176|0,re=Ke+172|0,g=Ke+168|0,we=Ke,!(I4(A,_)|0))return d=0,Y=Ke,d|0;if(zre(A,_,re,g),bc(we|0,m|0,168)|0,(h[m>>2]|0)>0){A=0;do Ee=we+8+(A<<4)+8|0,_e=+fl(+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=+fl(+ne[_+16>>3],h[g>>2]|0),W=+fl(+ne[_+24>>3],h[g>>2]|0);e:do if((h[d>>2]|0)>0){if(_=d+4|0,g=h[we>>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],$=+fl(+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=+fl(+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(ve=A,A=A+1|0,Ee=(A|0)==(g|0)?0:A,y=+ne[we+8+(ve<<4)+8>>3],b=+ne[we+8+(Ee<<4)+8>>3]-y,E=+ne[we+8+(ve<<4)>>3],M=+ne[we+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 ve=A,Y=Ke,ve|0}function X9(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0;if(rw(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,rw((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 Lse(){return 8}function Dse(){return 16}function Fse(){return 168}function Ose(){return 8}function Bse(){return 16}function Use(){return 12}function kse(){return 8}function Gse(d){return d=d|0,+(+((h[d>>2]|0)>>>0)+4294967296*+(h[d+4>>2]|0))}function zse(d){d=d|0;var A=0,m=0;return m=+ne[d>>3],A=+ne[d+8>>3],+ +ss(+(m*m+A*A))}function $9(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,+Fs(+(+ne[d>>3]-+ne[A>>3]))<11920928955078125e-23?(A=+Fs(+(+ne[d+8>>3]-+ne[A+8>>3]))<11920928955078125e-23,A|0):(A=0,A|0)}function Vse(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,_=Gi(d,A)|0,(m+-1|0)>>>0>5||(_=(_|0)!=0,(m|0)==1&_))return g=-1,Y=y,g|0;do if(gx(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 gx(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,_=ag(d,A,E)|0,_|0)return m=_,Y=O,m|0;y=O9(d,A)|0,I=ka(d,A)|0,Dre(y,M),_=Fre(y,h[E>>2]|0)|0;do if(lr(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:ci(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=C4(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 ql(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,we=0;if(we=Y,Y=Y+32|0,re=we+24|0,ue=we+20|0,$=we+8|0,W=we+16|0,q=we,M=(Gi(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=we,_|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=(Gi(d,A)|0)!=0,((g?4:5)|0)<(m|0)||gx(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=we,_|0;h[ue>>2]=0,g=Os(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=Gi(d,A)|0,(E|0)<0&&ci(27634,27636,248,27661),M=(g|0)!=0,((M?4:5)|0)<(E|0)&&ci(27634,27636,248,27661),gx(d,A,re)|0&&ci(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&&ci(27634,27636,248,27661),h[W>>2]=0,g=Os(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(Gi(M,I)|0?y=Jb(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=Gi(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(gx(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=(Gi(I,E)|0)!=0,M?d=Jb(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=Gi(I,E)|0,(d+-1|0)>>>0<=5&&(_e=(g|0)!=0,!((d|0)==1&_e)))do if(gx(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=we,_|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=we,_|0}function qse(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;return y=(Gi(d,A)|0)==0,_=ql(d,A,0,m)|0,g=(_|0)==0,y?!g||(_=ql(d,A,1,m+8|0)|0,_|0)||(_=ql(d,A,2,m+16|0)|0,_|0)||(_=ql(d,A,3,m+24|0)|0,_|0)||(_=ql(d,A,4,m+32|0)|0,_)?(y=_,y|0):ql(d,A,5,m+40|0)|0:!g||(_=ql(d,A,1,m+8|0)|0,_|0)||(_=ql(d,A,2,m+16|0)|0,_|0)||(_=ql(d,A,3,m+24|0)|0,_|0)||(_=ql(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,_=ag(d,E,y)|0,_|0?(E=_,Y=M,E|0):(A=et(d|0,A|0,52)|0,Q()|0,A=A&15,Gi(d,E)|0?L4(y,A,b,1,g):D4(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 K9(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,!(tw(d,_)|0))?(_=0,Y=g,_|0):(y=et(d|0,A|0,56)|0,Q()|0,y=(ql(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 Z9(){return 27680}function sw(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=Ua(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?Y4(d,m,_,g,M):aw(d,m,_,I,g,0,M),(g|0)==1){lw(I,1),g=0;break}else{lw(I,A),g=1;break}else Y4(d,m,_,g,M),ow(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(aw(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:(lw(I,2),q=g+-2|0,h[I>>2]=h[I>>2]^7,ow(I,1),aw(d+(0-(h[M+(q<<2)>>2]|0))+E|0,m,_,I,g+-1|0,1,M),lw(I,1),A=h[I>>2]|1,h[I>>2]=A,d=d+E|0,aw(d,m,_,I,q,1,M),g=q);(O|0)==19&&(O=0,A=Q9(I)|0,ow(I,A),d=d+E|0,g=A+g|0,A=h[I>>2]|0)}}while(!1);Y=G}function Y4(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);eG(A,O,_),Y=G}function ow(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 aw(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,$=Q9(G)|0,ow(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&&(eG(A,q,_),Y4(d,A,m,g,b)),Y=W}function lw(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 Q9(d){d=d|0;var A=0;return A=J9((h[d>>2]|0)+-1|0)|0,A?A|0:(A=J9(h[d+4>>2]|0)|0,((A|0)==0?0:A+32|0)|0)}function J9(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 eG(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,bc(_|0,h[A>>2]|0,g|0)|0,_=0;do E=A+(_<<2)|0,_=_+1|0,bc(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 _u(d){return d=+d,~~+sG(+d)|0}function cr(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,we=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:(we=(A+1048320|0)>>>16&8,me=A<<we,re=(me+520192|0)>>>16&4,me=me<<re,m=(me+245760|0)>>>16&2,m=14-(re|we|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);we=A+8|0,me=h[we>>2]|0,h[me+12>>2]=O,h[we>>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,we=me+G|0,h[6927]=we,h[we+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=pd(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=pd(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=pd(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((pd(d|0)|0)==-1){pd(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=pd(I|0)|0,$=pd(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&&(we=A+4|0,(h[A+12>>2]&8|0)==0)&&y>>>0>M>>>0&d>>>0<=M>>>0){h[we>>2]=m+b,me=(h[6924]|0)+b|0,re=M+8|0,re=(re&7|0)==0?0:0-re&7,we=M+re|0,re=me-re|0,h[6927]=we,h[6924]=re,h[we+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}we=(A+1048320|0)>>>16&8,me=A<<we,re=(me+520192|0)>>>16&4,me=me<<re,_=(me+245760|0)>>>16&2,_=14-(re|we|_)+(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);we=A+8|0,me=h[we>>2]|0,h[me+12>>2]=I,h[we>>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,we=y+re|0,re=m-re|0,h[6927]=we,h[6924]=re,h[we+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 we=A,A=A+4|0,h[A>>2]=7;while((we+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:(we=(A+1048320|0)>>>16&8,me=A<<we,re=(me+520192|0)>>>16&4,me=me<<re,_=(me+245760|0)>>>16&2,_=14-(re|we|_)+(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);we=A+8|0,me=h[we>>2]|0,h[me+12>>2]=M,h[we>>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,we=y+re|0,re=me-re|0,h[6927]=we,h[6924]=re,h[we+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,we=me+G|0,h[6927]=we,h[we+4>>2]=re|1,h[me+4>>2]=G|3,me=me+8|0,Y=Fe,me|0}return me=Z9()|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 oa(d,A){d=d|0,A=A|0;var m=0;return d?(m=Ua(A,d)|0,(A|d)>>>0>65535&&(m=((m>>>0)/(d>>>0)|0|0)==(A|0)?m:-1)):m=0,d=cr(m)|0,!d||!(h[d+-4>>2]&3)||dd(d|0,0,m|0)|0,d|0}function Wse(d,A){d=d|0,A=A|0;var m=0,_=0;return d?A>>>0>4294967231?(A=Z9()|0,h[A>>2]=12,A=0,A|0):(m=jse(d+-8|0,A>>>0<11?16:A+11&-8)|0,m|0?(A=m+8|0,A|0):(m=cr(A)|0,m?(_=h[d+-4>>2]|0,_=(_&-8)-((_&3|0)==0?8:4)|0,bc(m|0,d|0,(_>>>0<A>>>0?_:A)|0)|0,_t(d),A=m,A|0):(A=0,A|0))):(A=cr(A)|0,A|0)}function jse(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,tG(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,tG(E,I),d|0)}function tG(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,Dn(A+_+(m>>>0<d>>>0|0)>>>0|0),m|0|0}function Bs(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,_=A-_-(m>>>0>d>>>0|0)>>>0,Dn(_|0),d-m>>>0|0|0}function nG(d){return d=d|0,(d?31-(Jh(d^d-1)|0)|0:32)|0}function K4(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,Dn(q|0),g|0):(q=0,g=0,Dn(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,Dn(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,Dn(q|0),g|0):(q=0,g=0,Dn(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,Dn(W|0),$|0):($=nG(b|0)|0,W=I>>>($>>>0)|0,$=I<<32-$|O>>>($>>>0)|0,Dn(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,Dn(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,Dn(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>>>((nG(E|0)|0)>>>0),Dn(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,Dn(W|0),$|0):(W=0,$=0,Dn(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,Bs(I|0,m|0,_|0,q|0)|0,$=Q()|0,W=$>>31|(($|0)<0?-1:0)<<1,E=W&1,d=Bs(_|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,Dn(W|0),$|0}function hd(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=Bs(I^d|0,M^A|0,I|0,M|0)|0,b=Q()|0,d=y^I,A=g^M,Bs((K4(E,b,Bs(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 Xse(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0;return y=d&65535,g=A&65535,m=Ua(g,y)|0,_=d>>>16,d=(m>>>16)+(Ua(g,_)|0)|0,g=A>>>16,A=Ua(g,y)|0,Dn((d>>>16)+(Ua(g,_)|0)+(((d&65535)+A|0)>>>16)|0),d+A<<16|m&65535|0|0}function ur(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0;return g=d,y=m,m=Xse(g,y)|0,d=Q()|0,Dn((Ua(A,y)|0)+(Ua(_,g)|0)+d|d&0|0),m|0|0|0}function fd(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=Bs(b^d|0,y^A|0,b|0,y|0)|0,A=Q()|0,K4(d,A,Bs(I^m|0,M^_|0,I|0,M|0)|0,Q()|0,E)|0,_=Bs(h[E>>2]^b|0,h[E+4>>2]^y|0,b|0,y|0)|0,m=Q()|0,Y=g,Dn(m|0),_|0}function ef(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,K4(d,A,m,_,g)|0,Y=y,Dn(h[g+4>>2]|0),h[g>>2]|0|0}function iG(d,A,m){return d=d|0,A=A|0,m=m|0,(m|0)<32?(Dn(A>>m|0),d>>>m|(A&(1<<m)-1)<<32-m):(Dn(((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?(Dn(A>>>m|0),d>>>m|(A&(1<<m)-1)<<32-m):(Dn(0),A>>>m-32|0)}function ht(d,A,m){return d=d|0,A=A|0,m=m|0,(m|0)<32?(Dn(A<<m|(d&(1<<m)-1<<32-m)>>>32-m|0),d<<m):(Dn(d<<m-32|0),0)}function Z4(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),Dn(0),A|0}function rG(d,A){return d=+d,A=+A,d!=d?+A:A!=A?+d:+dre(+d,+A)}function cw(d,A){return d=+d,A=+A,d!=d?+A:A!=A?+d:+M4(+d,+A)}function uw(d){return d=+d,d>=0?+Xs(d+.5):+sg(d-.5)}function bc(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;if((m|0)>=8192)return mre(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 Q4(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 bc(d,A,m)|0;return d|0}function dd(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 sG(d){return d=+d,d>=0?+Xs(d+.5):+sg(d-.5)}function pd(d){d=d|0;var A=0,m=0,_=0;return _=Are()|0,m=h[Ba>>2]|0,A=m+d|0,(d|0)>0&(A|0)<(m|0)|(A|0)<0?(_re(A|0)|0,y9(12),-1):(A|0)>(_|0)&&!(gre(A|0)|0)?(y9(12),-1):(h[Ba>>2]=A,m|0)}function $se(d,A,m){return d=d|0,A=A|0,m=m|0,Ad[d&3](A|0,m|0)|0}function Yse(d,A){return d=d|0,A=A|0,pre(0),0}var Ad=[Yse,Wre,jre,Xre];return{___divdi3:hd,___muldi3:ur,___remdi3:fd,___uremdi3:ef,_areNeighborCells:$re,_bitshift64Ashr:iG,_bitshift64Lshr:et,_bitshift64Shl:ht,_calloc:oa,_cellAreaKm2:Ire,_cellAreaM2:Nre,_cellAreaRads2:Pre,_cellToBoundary:D0,_cellToCenterChild:U9,_cellToChildPos:pse,_cellToChildren:sse,_cellToChildrenSize:hx,_cellToLatLng:lg,_cellToLocalIj:Ese,_cellToParent:B4,_cellToVertex:ql,_cellToVertexes:qse,_cellsToDirectedEdge:Yre,_cellsToLinkedMultiPolygon:Rre,_childPosToCell:Ase,_compactCells:ose,_constructCell:ise,_destroyLinkedMultiPolygon:Sse,_directedEdgeToBoundary:cx,_directedEdgeToCells:Qre,_edgeLengthKm:bse,_edgeLengthM:wse,_edgeLengthRads:vse,_emscripten_replace_memory:xre,_free:_t,_getBaseCellNumber:O9,_getDirectedEdgeDestination:Zre,_getDirectedEdgeOrigin:Kre,_getHexagonAreaAvgKm2:z9,_getHexagonAreaAvgM2:_se,_getHexagonEdgeLengthAvgKm:xse,_getHexagonEdgeLengthAvgM:yse,_getIcosahedronFaces:k9,_getIndexDigit:nse,_getNumCells:nw,_getPentagons:V4,_getRes0Cells:Bre,_getResolution:F4,_greatCircleDistanceKm:dx,_greatCircleDistanceM:gse,_greatCircleDistanceRads:mse,_gridDisk:v9,_gridDiskDistances:b9,_gridDistance:W4,_gridPathCells:Rse,_gridPathCellsSize:Cse,_gridRing:Tre,_gridRingUnsafe:S9,_i64Add:pt,_i64Subtract:Bs,_isPentagon:Gi,_isResClassIII:cse,_isValidCell:tw,_isValidDirectedEdge:N9,_isValidIndex:rse,_isValidVertex:K9,_latLngToCell:G4,_llvm_ctlz_i64:Z4,_llvm_maxnum_f64:rG,_llvm_minnum_f64:cw,_llvm_round_f64:uw,_localIjToCell:Mse,_malloc:cr,_maxFaceCount:fse,_maxGridDiskSize:Sre,_maxPolygonToCellsSize:Mre,_maxPolygonToCellsSizeExperimental:Nse,_memcpy:bc,_memmove:Q4,_memset:dd,_originToDirectedEdges:N4,_pentagonCount:dse,_polygonToCells:Cre,_polygonToCellsExperimental:Ise,_readInt64AsDoubleFromPointer:Gse,_res0CellCount:Ore,_reverseDirectedEdge:L9,_round:sG,_sbrk:pd,_sizeOfCellBoundary:Fse,_sizeOfCoordIJ:kse,_sizeOfGeoLoop:Ose,_sizeOfGeoPolygon:Bse,_sizeOfH3Index:Lse,_sizeOfLatLng:Dse,_sizeOfLinkedGeoPolygon:Use,_uncompactCells:ase,_uncompactCellsSize:lse,_vertexToLatLng:Hse,dynCall_iii:$se,establishStackSpace:wre,stackAlloc:yre,stackRestore:bre,stackSave:vre}})(Dt,ct,K),jt=e.___divdi3=Ce.___divdi3,Wi=e.___muldi3=Ce.___muldi3,Nn=e.___remdi3=Ce.___remdi3,Vr=e.___uremdi3=Ce.___uremdi3,_r=e._areNeighborCells=Ce._areNeighborCells,ll=e._bitshift64Ashr=Ce._bitshift64Ashr,ra=e._bitshift64Lshr=Ce._bitshift64Lshr,cl=e._bitshift64Shl=Ce._bitshift64Shl,Fa=e._calloc=Ce._calloc,ar=e._cellAreaKm2=Ce._cellAreaKm2,Ds=e._cellAreaM2=Ce._cellAreaM2,ul=e._cellAreaRads2=Ce._cellAreaRads2,mu=e._cellToBoundary=Ce._cellToBoundary,Kb=e._cellToCenterChild=Ce._cellToCenterChild,x4=e._cellToChildPos=Ce._cellToChildPos,y4=e._cellToChildren=Ce._cellToChildren,ox=e._cellToChildrenSize=Ce._cellToChildrenSize,v4=e._cellToLatLng=Ce._cellToLatLng,ax=e._cellToLocalIj=Ce._cellToLocalIj,b4=e._cellToParent=Ce._cellToParent,w4=e._cellToVertex=Ce._cellToVertex,h9=e._cellToVertexes=Ce._cellToVertexes,f9=e._cellsToDirectedEdge=Ce._cellsToDirectedEdge,d9=e._cellsToLinkedMultiPolygon=Ce._cellsToLinkedMultiPolygon,p9=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,zn=e._getBaseCellNumber=Ce._getBaseCellNumber,Yn=e._getDirectedEdgeDestination=Ce._getDirectedEdgeDestination,pn=e._getDirectedEdgeOrigin=Ce._getDirectedEdgeOrigin,ki=e._getHexagonAreaAvgKm2=Ce._getHexagonAreaAvgKm2,qr=e._getHexagonAreaAvgM2=Ce._getHexagonAreaAvgM2,Rr=e._getHexagonEdgeLengthAvgKm=Ce._getHexagonEdgeLengthAvgKm,ji=e._getHexagonEdgeLengthAvgM=Ce._getHexagonEdgeLengthAvgM,ao=e._getIcosahedronFaces=Ce._getIcosahedronFaces,Xt=e._getIndexDigit=Ce._getIndexDigit,Oa=e._getNumCells=Ce._getNumCells,mi=e._getPentagons=Ce._getPentagons,hl=e._getRes0Cells=Ce._getRes0Cells,vc=e._getResolution=Ce._getResolution,Kh=e._greatCircleDistanceKm=Ce._greatCircleDistanceKm,P0=e._greatCircleDistanceM=Ce._greatCircleDistanceM,Xi=e._greatCircleDistanceRads=Ce._greatCircleDistanceRads,Hr=e._gridDisk=Ce._gridDisk,Zh=e._gridDiskDistances=Ce._gridDiskDistances,nr=e._gridDistance=Ce._gridDistance,Qh=e._gridPathCells=Ce._gridPathCells,I0=e._gridPathCellsSize=Ce._gridPathCellsSize,S4=e._gridRing=Ce._gridRing,Z4e=e._gridRingUnsafe=Ce._gridRingUnsafe,Q4e=e._i64Add=Ce._i64Add,J4e=e._i64Subtract=Ce._i64Subtract,ePe=e._isPentagon=Ce._isPentagon,tPe=e._isResClassIII=Ce._isResClassIII,nPe=e._isValidCell=Ce._isValidCell,iPe=e._isValidDirectedEdge=Ce._isValidDirectedEdge,rPe=e._isValidIndex=Ce._isValidIndex,sPe=e._isValidVertex=Ce._isValidVertex,oPe=e._latLngToCell=Ce._latLngToCell,aPe=e._llvm_ctlz_i64=Ce._llvm_ctlz_i64,lPe=e._llvm_maxnum_f64=Ce._llvm_maxnum_f64,cPe=e._llvm_minnum_f64=Ce._llvm_minnum_f64,uPe=e._llvm_round_f64=Ce._llvm_round_f64,hPe=e._localIjToCell=Ce._localIjToCell,fPe=e._malloc=Ce._malloc,dPe=e._maxFaceCount=Ce._maxFaceCount,pPe=e._maxGridDiskSize=Ce._maxGridDiskSize,APe=e._maxPolygonToCellsSize=Ce._maxPolygonToCellsSize,mPe=e._maxPolygonToCellsSizeExperimental=Ce._maxPolygonToCellsSizeExperimental,gPe=e._memcpy=Ce._memcpy,_Pe=e._memmove=Ce._memmove,xPe=e._memset=Ce._memset,yPe=e._originToDirectedEdges=Ce._originToDirectedEdges,vPe=e._pentagonCount=Ce._pentagonCount,bPe=e._polygonToCells=Ce._polygonToCells,wPe=e._polygonToCellsExperimental=Ce._polygonToCellsExperimental,SPe=e._readInt64AsDoubleFromPointer=Ce._readInt64AsDoubleFromPointer,TPe=e._res0CellCount=Ce._res0CellCount,EPe=e._reverseDirectedEdge=Ce._reverseDirectedEdge,MPe=e._round=Ce._round,CPe=e._sbrk=Ce._sbrk,RPe=e._sizeOfCellBoundary=Ce._sizeOfCellBoundary,PPe=e._sizeOfCoordIJ=Ce._sizeOfCoordIJ,IPe=e._sizeOfGeoLoop=Ce._sizeOfGeoLoop,NPe=e._sizeOfGeoPolygon=Ce._sizeOfGeoPolygon,LPe=e._sizeOfH3Index=Ce._sizeOfH3Index,DPe=e._sizeOfLatLng=Ce._sizeOfLatLng,FPe=e._sizeOfLinkedGeoPolygon=Ce._sizeOfLinkedGeoPolygon,OPe=e._uncompactCells=Ce._uncompactCells,BPe=e._uncompactCellsSize=Ce._uncompactCellsSize,UPe=e._vertexToLatLng=Ce._vertexToLatLng,kPe=e.establishStackSpace=Ce.establishStackSpace,A9=e.stackAlloc=Ce.stackAlloc,ure=e.stackRestore=Ce.stackRestore,hre=e.stackSave=Ce.stackSave,GPe=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));{pi("memory initializer");var T4=function(Ne){Ne.byteLength&&(Ne=new Uint8Array(Ne)),j.set(Ne,x),e.memoryInitializerRequest&&delete e.memoryInitializerRequest.response,Bn("memory initializer")},m9=function(){a(le,T4,function(){throw"could not load memory initializer "+le})},g9=wt(le);if(g9)T4(g9.buffer);else if(e.memoryInitializerRequest){var _9=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),m9();return}}T4(nt)};e.memoryInitializerRequest.response?setTimeout(_9,0):e.memoryInitializerRequest.addEventListener("load",_9)}else m9()}}var Zb;ge=function Ne(){Zb||E4(),Zb||(ge=Ne)};function E4(Ne){if(Ne=Ne||r,Qt>0||(Ct(),Qt>0))return;function nt(){Zb||(Zb=!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=E4;function N0(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=N0,e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return E4(),i})(typeof fi=="object"?fi:{}),wn="number",vn=wn,s1=wn,Tn=wn,En=wn,io=wn,qt=wn,E1e=[["sizeOfH3Index",wn],["sizeOfLatLng",wn],["sizeOfCellBoundary",wn],["sizeOfGeoLoop",wn],["sizeOfGeoPolygon",wn],["sizeOfLinkedGeoPolygon",wn],["sizeOfCoordIJ",wn],["readInt64AsDoubleFromPointer",wn],["isValidCell",s1,[Tn,En]],["isValidIndex",s1,[Tn,En]],["latLngToCell",vn,[wn,wn,io,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,io,wn,qt]],["polygonToCells",vn,[qt,io,wn,qt]],["maxPolygonToCellsSizeExperimental",vn,[qt,io,wn,qt]],["polygonToCellsExperimental",vn,[qt,io,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,io]],["uncompactCellsSize",vn,[qt,wn,wn,io,qt]],["isPentagon",s1,[Tn,En]],["isResClassIII",s1,[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,io,qt]],["cellToChildren",vn,[Tn,En,io,qt]],["cellToCenterChild",vn,[Tn,En,io,qt]],["cellToChildrenSize",vn,[Tn,En,io,qt]],["cellToChildPos",vn,[Tn,En,io,qt]],["childPosToCell",vn,[wn,wn,Tn,En,io,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",s1,[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,[io,qt]],["getHexagonAreaAvgKm2",vn,[io,qt]],["getHexagonEdgeLengthAvgM",vn,[io,qt]],["getHexagonEdgeLengthAvgKm",vn,[io,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,[io,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",s1,[Tn,En]]],M1e=0,C1e=1,R1e=2,P1e=3,dY=4,I1e=5,N1e=6,L1e=7,D1e=8,F1e=9,O1e=10,B1e=11,U1e=12,k1e=13,G1e=14,z1e=15,V1e=16,q1e=17,H1e=18,W1e=19,fs={};fs[M1e]="Success";fs[C1e]="The operation failed but a more specific error is not available";fs[R1e]="Argument was outside of acceptable range";fs[P1e]="Latitude or longitude arguments were outside of acceptable range";fs[dY]="Resolution argument was outside of acceptable range";fs[I1e]="Cell argument was not valid";fs[N1e]="Directed edge argument was not valid";fs[L1e]="Undirected edge argument was not valid";fs[D1e]="Vertex argument was not valid";fs[F1e]="Pentagon distortion was encountered";fs[O1e]="Duplicate input";fs[B1e]="Cell arguments were not neighbors";fs[U1e]="Cell arguments had incompatible resolutions";fs[k1e]="Memory allocation failed";fs[G1e]="Bounds of provided memory were insufficient";fs[z1e]="Mode or flags argument was not valid";fs[V1e]="Index argument was not valid";fs[q1e]="Base cell number was outside of acceptable range";fs[H1e]="Child indexing digits invalid";fs[W1e]="Child indexing digits refer to a deleted subsequence";var j1e=1e3,pY=1001,AY=1002,OE={};OE[j1e]="Unknown unit";OE[pY]="Array length out of bounds";OE[AY]="Got unexpected null value for H3 index";var X1e="Unknown error";function mY(i,e,t){var n=t&&"value"in t,r=new Error((i[e]||X1e)+" (code: "+e+(n?", value: "+t.value:"")+")");return r.code=e,r}function gY(i,e){var t=arguments.length===2?{value:e}:{};return mY(fs,i,t)}function _Y(i,e){var t=arguments.length===2?{value:e}:{};return mY(OE,i,t)}function Mv(i){if(i!==0)throw gY(i)}var nl={};E1e.forEach(function(e){nl[e[0]]=fi.cwrap.apply(fi,e)});var o1=16;var Cv=4;var a1=8,$1e=8,DE=nl.sizeOfH3Index(),i8=nl.sizeOfLatLng(),Y1e=nl.sizeOfCellBoundary(),K1e=nl.sizeOfGeoPolygon(),Ev=nl.sizeOfGeoLoop(),net=nl.sizeOfLinkedGeoPolygon(),iet=nl.sizeOfCoordIJ();function Z1e(i){if(typeof i!="number"||i<0||i>15||Math.floor(i)!==i)throw gY(dY,i);return i}function Q1e(i){if(!i)throw _Y(AY);return i}var J1e=Math.pow(2,32)-1,ret=Math.pow(2,31)-1;function exe(i){if(i>J1e)throw _Y(pY,i);return i}var txe=/[^0-9a-fA-F]/;function xY(i){if(Array.isArray(i)&&i.length===2&&Number.isInteger(i[0])&&Number.isInteger(i[1]))return i;if(typeof i!="string"||txe.test(i))return[0,0];var e=parseInt(i.substring(0,i.length-8),o1),t=parseInt(i.substring(i.length-8),o1);return[t,e]}function hY(i){if(i>=0)return i.toString(o1);i=i&2147483647;var e=yY(8,i.toString(o1)),t=(parseInt(e[0],o1)+8).toString(o1);return e=t+e.substring(1),e}function nxe(i,e){return hY(e)+yY(8,hY(i))}function yY(i,e){for(var t=i-e.length,n="",r=0;r<t;r++)n+="0";return n=n+e,n}var set=Math.pow(2,32);function fY(i,e,t){for(var n=i.length,r=fi._calloc(n,i8),s=t?1:0,o=t?0:1,a=0;a<n*2;a+=2)fi.HEAPF64.set([i[a/2][s],i[a/2][o]].map(SY),r/a1+a);return fi.HEAPU32.set([n,r],e/Cv),e}function ixe(i,e){var t=i.length-1,n=fi._calloc(K1e),r=0,s=r+Ev,o=s+Cv;fY(i[0],n+r,e);var a;if(t>0){a=fi._calloc(t,Ev);for(var l=0;l<t;l++)fY(i[l+1],a+Ev*l,e)}return fi.setValue(n+s,t,"i32"),fi.setValue(n+o,a,"i32"),n}function rxe(i){var e=0,t=e+Ev,n=t+Cv,r=Cv;fi._free(fi.getValue(i+e+r,"i8*"));var s=fi.getValue(i+t,"i32");if(s>0){for(var o=fi.getValue(i+n,"i32"),a=0;a<s;a++)fi._free(fi.getValue(o+Ev*a+r,"i8*"));fi._free(o)}fi._free(i)}function vY(i,e){e===void 0&&(e=0);var t=fi.getValue(i+DE*e,"i32"),n=fi.getValue(i+DE*e+Cv,"i32");return n?nxe(t,n):null}function sxe(i){return nl.readInt64AsDoubleFromPointer(i)}function oxe(i,e){for(var t=[],n=0;n<e;n++){var r=vY(i,n);r!==null&&t.push(r)}return t}function FE(i){return cxe(fi.getValue(i,"double"))}function bY(i){return[FE(i),FE(i+a1)]}function axe(i){return[FE(i+a1),FE(i)]}function lxe(i,e,t){for(var n=fi.getValue(i,"i32"),r=i+a1,s=[],o=e?axe:bY,a=0;a<n*2;a+=2)s.push(o(r+a1*a));return t&&s.push(s[0]),s}function wY(i,e,t){var n=fi._malloc(i8);fi.HEAPF64.set([i,e].map(SY),n/a1);var r=fi._malloc(DE);try{return Mv(nl.latLngToCell(n,t,r)),Q1e(vY(r))}finally{fi._free(r),fi._free(n)}}function r8(i){var e=fi._malloc(i8),t=xY(i),n=t[0],r=t[1];try{return Mv(nl.cellToLatLng(n,r,e)),bY(e)}finally{fi._free(e)}}function s8(i,e){var t=fi._malloc(Y1e),n=xY(i),r=n[0],s=n[1];try{return Mv(nl.cellToBoundary(r,s,t)),lxe(t,e,e)}finally{fi._free(t)}}function o8(i,e,t){if(Z1e(e),t=!!t,i.length===0||i[0].length===0)return[];var n=typeof i[0][0]=="number"?[i]:i,r=ixe(n,t),s=fi._malloc($1e);try{Mv(nl.maxPolygonToCellsSize(r,e,0,s));var o=exe(sxe(s)),a=fi._calloc(o,DE);try{return Mv(nl.polygonToCells(r,e,0,a)),oxe(a,o)}finally{fi._free(a)}}finally{fi._free(s),rxe(r)}}function SY(i){return i*Math.PI/180}function cxe(i){return i*180/Math.PI}function a8(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 uxe=["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"],TY=new WeakMap,EY=new WeakMap,MY=new WeakMap,j8=class{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=uxe,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=MY.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}},MY.set(e,t)),t}getMaterialData(e){let t=EY.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)}EY.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=TY.get(e);return n===void 0&&(n={renderId:-1,lightsData:[]},TY.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}},hxe=[/^StackTrace\.js$/,/^TSLCore\.js$/,/^.*Node\.js$/,/^three\.webgpu.*\.js$/];function fxe(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&&!hxe.some(n=>n.test(t.file)))}var kr=class{constructor(e=null){this.isStackTrace=!0,this.stack=fxe(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+}`,hD=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new Iy(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 Zr({vertexShader:N0e,fragmentShader:L0e,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Gn(new DA(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},fD=class extends Ho{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 hD,T={},R=t.getContextAttributes(),P=null,C=null,L=[],D=[],F=new Oe,N=null,B=new Lr;B.viewport=new gn;let z=new Lr;z.viewport=new gn;let V=[B,z],H=new R_,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(P),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(P=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),R.xrCompatible!==!0&&await t.makeXRCompatible(),N=e.getPixelRatio(),e.getSize(F),w&&"createProjectionLayer"in XRWebGLBinding.prototype){let $e=null,Et=null,Tt=null;R.depth&&(Tt=R.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,$e=R.stencil?eo:Ts,Et=R.stencil?Wo:Ai);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 pa(p.textureWidth,p.textureHeight,{format:wr,type:Vi,depthTexture:new us(p.textureWidth,p.textureHeight,Et,void 0,void 0,void 0,void 0,void 0,void 0,$e),stencilBuffer:R.stencil,colorSpace:e.outputColorSpace,samples:R.antialias?4:0,resolveDepthBuffer:p.ignoreDepthValues===!1,resolveStencilBuffer:p.ignoreDepthValues===!1})}else{let $e={antialias:R.antialias,alpha:!0,depth:R.depth,stencil:R.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 pa(x.framebufferWidth,x.framebufferHeight,{format:wr,type:Vi,colorSpace:e.outputColorSpace,stencilBuffer:R.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,pi=yt-Qt,Bn=ln+(Et-Qt),le=Xe*Gt/ge*xn,X=st*Gt/ge*xn;Me.projectionMatrix.makePerspective(pi,Bn,le,X,xn,ge),Me.projectionMatrixInverse.copy(Me.projectionMatrix).invert()}}function be(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;be(H,Et);for(let Ct=0;Ct<Tt.length;Ct++)be(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=Lf*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 Lr,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 Iy,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 QW;mt.setAnimationLoop(Ue),this.setAnimationLoop=function(Me){Qe=Me},this.dispose=function(){}}},D0e=new on,rj=new Sn;rj.set(-1,0,0,0,1,0,0,0,1);function F0e(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,HL(i)),T.isFog?(S.fogNear.value=T.near,S.fogFar.value=T.far):T.isFogExp2&&(S.fogDensity.value=T.density)}function r(S,T,R,P,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,R,P):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===hi&&(S.bumpScale.value*=-1)),T.normalMap&&(S.normalMap.value=T.normalMap,t(T.normalMap,S.normalMapTransform),S.normalScale.value.copy(T.normalScale),T.side===hi&&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 R=e.get(T),P=R.envMap,C=R.envMapRotation;P&&(S.envMap.value=P,S.envMapRotation.value.setFromMatrix4(D0e.makeRotationFromEuler(C)).transpose(),P.isCubeTexture&&P.isRenderTargetTexture===!1&&S.envMapRotation.value.premultiply(rj),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,R,P){S.diffuse.value.copy(T.color),S.opacity.value=T.opacity,S.size.value=T.size*R,S.scale.value=P*.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,R){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===hi&&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=R.texture,S.transmissionSamplerSize.value.set(R.width,R.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 R=e.get(T).light;S.referencePosition.value.setFromMatrixPosition(R.matrixWorld),S.nearDistance.value=R.shadow.camera.near,S.farDistance.value=R.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function O0e(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",R));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,be=de%ce.boundary,Ie=de+be;D+=be,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 R(C){let L=C.target;L.removeEventListener("dispose",R);let D=o.indexOf(L.__bindingPointIndex);o.splice(D,1),i.deleteBuffer(r[L.id]),delete r[L.id],delete s[L.id]}function P(){for(let C in r)i.deleteBuffer(r[C]);o=[],r={},s={}}return{bind:l,update:c,dispose:P}}var B0e=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;function U0e(){return ah===null&&(ah=new RA(B0e,16,16,Rs,Fi),ah.name="DFG_LUT",ah.minFilter=bi,ah.magFilter=bi,ah.wrapS=qo,ah.wrapT=qo,ah.generateMipmaps=!1,ah.needsUpdate=!0),ah}var _3=class{constructor(e={}){let{canvas:t=d3(),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=Vi}=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([hp,Ju,Qu]),T=new Set([Vi,Ai,Ka,Wo,zA,VA]),R=new Uint32Array(4),P=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=Vs,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let z=this,V=!1,H=null,K=null,J=null,j=null;this._outputColorSpace=vr;let Z=0,ee=0,ae=null,ce=-1,de=null,be=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 ec,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 pi(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",Wi,!1),t.addEventListener("webglcontextrestored",Nn,!1),t.addEventListener("webglcontextcreationerror",Vr,!1),ge===null){let Se="webgl2";if(ge=pi(Se,te),ge===null)throw pi(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 Bn,le,X,Te,Pe,Ve,gt,St,qe,Ze,Rt,en,Pt,Mt,cn,yn,Pn,xe,bt,Ye,wt,Dt,ct;function Ce(){Bn=new Wde(ge),Bn.init(),wt=new I0e(ge,Bn),le=new Bde(ge,Bn,e,wt),X=new R0e(ge,Bn),le.reversedDepthBuffer&&p&&X.buffers.depth.setReversed(!0),K=ge.createFramebuffer(),J=ge.createFramebuffer(),j=ge.createFramebuffer(),Te=new $de(ge),Pe=new A0e,Ve=new P0e(ge,Bn,X,Pe,le,wt,Te),gt=new Hde(z),St=new Que(ge),Dt=new Fde(ge,St),qe=new jde(ge,St,Te,Dt),Ze=new Kde(ge,qe,St,Dt,Te),xe=new Yde(ge,le,Ve),cn=new Ude(Pe),Rt=new p0e(z,gt,Bn,le,Dt,cn),en=new F0e(z,Pe),Pt=new g0e,Mt=new w0e(Bn),Pn=new Dde(z,gt,X,Ze,v,l),yn=new C0e(z,Ze,le),ct=new O0e(ge,Te,le,X),bt=new Ode(ge,Bn,Te),Ye=new Xde(ge,Bn,Te),Te.programs=Rt.programs,z.capabilities=le,z.extensions=Bn,z.properties=Pe,z.renderLists=Pt,z.shadowMap=yn,z.state=X,z.info=Te}Ce(),w!==Vi&&(B=new Qde(w,t.width,t.height,a,r,s));let jt=new fD(z,ge);this.xr=jt,this.getContext=function(){return ge},this.getContextAttributes=function(){return ge.getContextAttributes()},this.forceContextLoss=function(){let te=Bn.get("WEBGL_lose_context");te&&te.loseContext()},this.forceContextRestore=function(){let te=Bn.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===Vi){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(be)},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(be.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(Pn.getClearColor())},this.setClearColor=function(){Pn.setClearColor(...arguments)},this.getClearAlpha=function(){return Pn.getClearAlpha()},this.setClearAlpha=function(){Pn.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=Pn.getClearColor(),tn=Pn.getClearAlpha(),hn=kt.r,zn=kt.g,Yn=kt.b;Yt?(R[0]=hn,R[1]=zn,R[2]=Yn,R[3]=tn,ge.clearBufferuiv(ge.COLOR,0,R)):(P[0]=hn,P[1]=zn,P[2]=Yn,P[3]=tn,ge.clearBufferiv(ge.COLOR,0,P))}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",Wi,!1),t.removeEventListener("webglcontextrestored",Nn,!1),t.removeEventListener("webglcontextcreationerror",Vr,!1),Pn.dispose(),Pt.dispose(),Mt.dispose(),Pe.dispose(),gt.dispose(),Ze.dispose(),Dt.dispose(),ct.dispose(),Rt.dispose(),jt.dispose(),jt.removeEventListener("sessionstart",Ds),jt.removeEventListener("sessionend",ul),mu.stop()};function Wi(te){te.preventDefault(),SA("WebGLRenderer: Context Lost."),V=!0}function Nn(){SA("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 Vr(te){Ge("WebGLRenderer: A WebGL context could not be created. Reason: ",te.statusMessage)}function _r(te){let Se=te.target;Se.removeEventListener("dispose",_r),ll(Se)}function ll(te){sa(te),Pe.remove(te)}function sa(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=p9(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 zn=ke.drawRange,Yn=ke.attributes.position,pn=zn.start*hn,ki=(zn.start+zn.count)*hn;zt!==null&&(pn=Math.max(pn,zt.start*hn),ki=Math.min(ki,(zt.start+zt.count)*hn)),tn!==null?(pn=Math.max(pn,0),ki=Math.min(ki,tn.count)):Yn!=null&&(pn=Math.max(pn,0),ki=Math.min(ki,Yn.count));let qr=ki-pn;if(qr<0||qr===1/0)return;Dt.setup(De,Le,kt,ke,tn);let Rr,ji=bt;if(tn!==null&&(Rr=St.get(tn),ji=Ye,ji.setIndex(Rr)),De.isMesh)Le.wireframe===!0?(X.setLineWidth(Le.wireframeLinewidth*xn()),ji.setMode(ge.LINES)):ji.setMode(ge.TRIANGLES);else if(De.isLine){let ao=Le.linewidth;ao===void 0&&(ao=1),X.setLineWidth(ao*xn()),De.isLineSegments?ji.setMode(ge.LINES):De.isLineLoop?ji.setMode(ge.LINE_LOOP):ji.setMode(ge.LINE_STRIP)}else De.isPoints?ji.setMode(ge.POINTS):De.isSprite&&ji.setMode(ge.TRIANGLES);if(De.isBatchedMesh)if(Bn.get("WEBGL_multi_draw"))ji.renderMultiDraw(De._multiDrawStarts,De._multiDrawCounts,De._multiDrawCount);else{let ao=De._multiDrawStarts,Xt=De._multiDrawCounts,Oa=De._multiDrawCount,mi=tn?St.get(tn).bytesPerElement:1,hl=Pe.get(Le).currentProgram.getUniforms();for(let vc=0;vc<Oa;vc++)hl.setValue(ge,"_gl_DrawID",vc),ji.render(ao[vc]/mi,Xt[vc])}else if(De.isInstancedMesh)ji.renderInstances(pn,qr,De.count);else if(ke.isInstancedBufferGeometry){let ao=ke._maxInstanceCount!==void 0?ke._maxInstanceCount:1/0,Xt=Math.min(ke.instanceCount,ao);ji.renderInstances(pn,qr,Xt)}else ji.render(pn,qr)};function cl(te,Se,ke){te.transparent===!0&&te.side===sr&&te.forceSinglePass===!1?(te.side=hi,te.needsUpdate=!0,cx(te,Se,ke),te.side=xo,te.needsUpdate=!0,cx(te,Se,ke),te.side=sr):cx(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];cl(kt,ke,De),Le.add(kt)}else cl(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)}Bn.get("KHR_parallel_shader_compile")!==null?zt():setTimeout(zt,10)})};let Fa=null;function ar(te){Fa&&Fa(te)}function Ds(){mu.stop()}function ul(){mu.start()}let mu=new QW;mu.setAnimationLoop(ar),typeof self<"u"&&mu.setContext(self),this.setAnimationLoop=function(te){Fa=te,jt.setAnimationLoop(te),te===null?mu.stop():mu.start()},jt.addEventListener("sessionstart",Ds),jt.addEventListener("sessionend",ul),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,_o,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&&Zb(Yt,Se,-1/0,z.sortObjects)}Zb(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&&Pn.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,zn=tn.length;hn<zn;hn++){let Yn=tn[hn];v4(Yt,kt,te,Yn)}Qt&&Pn.render(te);for(let hn=0,zn=tn.length;hn<zn;hn++){let Yn=tn[hn];y4(L,te,Yn,Yn.viewport)}}else kt.length>0&&v4(Yt,kt,te,Se),Qt&&Pn.render(te),y4(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 Zb(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,zn=tn.length;hn<zn;hn++){let Yn=tn[hn],pn=kt[Yn.materialIndex];pn&&pn.visible&&L.push(te,Yt,pn,ke,ln.z,Yn)}}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++)Zb(zt[Yt],Se,ke,Le)}function y4(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(be.copy(Le)),De.length>0&&lx(De,Se,ke),zt.length>0&&lx(zt,Se,ke),Yt.length>0&&lx(Yt,Se,ke),X.buffers.depth.setTest(!0),X.buffers.depth.setMask(!0),X.buffers.color.setMask(!0),X.setPolygonOffset(!1)}function v4(te,Se,ke,Le){if((ke.isScene===!0?ke.overrideMaterial:null)!==null)return;if(D.state.transmissionRenderTarget[Le.id]===void 0){let pn=Bn.has("EXT_color_buffer_half_float")||Bn.has("EXT_color_buffer_float");D.state.transmissionRenderTarget[Le.id]=new pa(1,1,{generateMipmaps:!0,type:pn?Fi:Vi,minFilter:vo,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||be;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&&Pn.render(ke);let zn=z.toneMapping;z.toneMapping=Vs;let Yn=Le.viewport;if(Le.viewport!==void 0&&(Le.viewport=void 0),D.setupLightsView(Le),st===!0&&cn.setGlobalState(z.clippingPlanes,Le),lx(te,ke,Le),Ve.updateMultisampleRenderTarget(zt),Ve.updateRenderTargetMipmap(zt),Bn.has("WEBGL_multisampled_render_to_texture")===!1){let pn=!1;for(let ki=0,qr=Se.length;ki<qr;ki++){let Rr=Se[ki],{object:ji,geometry:ao,material:Xt,group:Oa}=Rr;if(Xt.side===sr&&ji.layers.test(Le.layers)){let mi=Xt.side;Xt.side=hi,Xt.needsUpdate=!0,b4(ji,ke,Le,ao,Xt,Oa),Xt.side=mi,Xt.needsUpdate=!0,pn=!0}}pn===!0&&(Ve.updateMultisampleRenderTarget(zt),Ve.updateRenderTargetMipmap(zt))}z.setRenderTarget(kt,tn,hn),z.setClearColor(Ue,mt),Yn!==void 0&&(Le.viewport=Yn),z.toneMapping=zn}function lx(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,zn=Yt.material;zn.allowOverride===!0&&Le!==null&&(zn=Le),kt.layers.test(ke.layers)&&b4(kt,Se,ke,tn,zn,hn)}}function b4(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===sr&&De.forceSinglePass===!1?(De.side=hi,De.needsUpdate=!0,z.renderBufferDirect(ke,Se,Le,De,te,zt),De.side=xo,De.needsUpdate=!0,z.renderBufferDirect(ke,Se,Le,De,te,zt),De.side=sr):z.renderBufferDirect(ke,Se,Le,De,te,zt),te.onAfterRender(z,Se,ke,Le,De,zt)}function cx(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 zn=te.isMeshStandardMaterial||te.isMeshLambertMaterial&&!te.envMap||te.isMeshPhongMaterial&&!te.envMap;Le.envMap=gt.get(te.envMap||Le.environment,zn),Le.envMapRotation=Le.environment!==null&&te.envMap===null?Se.environmentRotation:te.envMapRotation,hn===void 0&&(te.addEventListener("dispose",_r),hn=new Map,Le.programs=hn);let Yn=hn.get(tn);if(Yn!==void 0){if(Le.currentProgram===Yn&&Le.lightsStateVersion===Yt)return S4(te,kt),Yn}else kt.uniforms=Rt.getUniforms(te),H!==null&&te.isNodeMaterial&&H.build(te,ke,kt),te.onBeforeCompile(kt,z),Yn=Rt.acquireProgram(kt,tn),hn.set(tn,Yn),Le.uniforms=kt.uniforms;let pn=Le.uniforms;return(!te.isShaderMaterial&&!te.isRawShaderMaterial||te.clipping===!0)&&(pn.clippingPlanes=cn.uniform),S4(te,kt),Le.needsLights=m9(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=Yn,Le.uniformsList=null,Yn}function w4(te){if(te.uniformsList===null){let Se=te.currentProgram.getUniforms();te.uniformsList=O_.seqWithValue(Se.seq,te.uniforms)}return te.uniformsList}function S4(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 d9(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 p9(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),zn=Le.vertexColors===!0&&!!ke.attributes.color&&ke.attributes.color.itemSize===4,Yn=!!ke.attributes.tangent&&(!!Le.normalMap||Le.anisotropy>0),pn=!!ke.morphAttributes.position,ki=!!ke.morphAttributes.normal,qr=!!ke.morphAttributes.color,Rr=Vs;Le.toneMapped&&(ae===null||ae.isXRRenderTarget===!0)&&(Rr=z.toneMapping);let ji=ke.morphAttributes.position||ke.morphAttributes.normal||ke.morphAttributes.color,ao=ji!==void 0?ji.length:0,Xt=Pe.get(Le),Oa=D.state.lights;if(st===!0&&(tt===!0||te!==de)){let nr=te===de&&Le.id===ce;cn.setState(Le,te,nr)}let mi=!1;Le.version===Xt.__version?(Xt.needsLights&&Xt.lightsStateVersion!==Oa.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!==zn||Xt.vertexTangents!==Yn||Xt.morphTargets!==pn||Xt.morphNormals!==ki||Xt.morphColors!==qr||Xt.toneMapping!==Rr||Xt.morphTargetsCount!==ao||!!Xt.lightProbeGrid!=D.state.lightProbeGridArray.length>0)&&(mi=!0):(mi=!0,Xt.__version=Le.version);let hl=Xt.currentProgram;mi===!0&&(hl=cx(Le,Se,De),H&&Le.isNodeMaterial&&H.onUpdateProgram(Le,hl,Xt));let vc=!1,Kh=!1,P0=!1,Xi=hl.getUniforms(),Hr=Xt.uniforms;if(X.useProgram(hl.program)&&(vc=!0,Kh=!0,P0=!0),Le.id!==ce&&(ce=Le.id,Kh=!0),Xt.needsLights){let nr=d9(D.state.lightProbeGridArray,De);Xt.lightProbeGrid!==nr&&(Xt.lightProbeGrid=nr,Kh=!0)}if(vc||de!==te){X.buffers.depth.getReversed()&&te.reversedDepth!==!0&&(te._reversedDepth=!0,te.updateProjectionMatrix()),Xi.setValue(ge,"projectionMatrix",te.projectionMatrix),Xi.setValue(ge,"viewMatrix",te.matrixWorldInverse);let Qh=Xi.map.cameraPosition;Qh!==void 0&&Qh.setValue(ge,yt.setFromMatrixPosition(te.matrixWorld)),le.logarithmicDepthBuffer&&Xi.setValue(ge,"logDepthBufFC",2/(Math.log(te.far+1)/Math.LN2)),(Le.isMeshPhongMaterial||Le.isMeshToonMaterial||Le.isMeshLambertMaterial||Le.isMeshBasicMaterial||Le.isMeshStandardMaterial||Le.isShaderMaterial)&&Xi.setValue(ge,"isOrthographic",te.isOrthographicCamera===!0),de!==te&&(de=te,Kh=!0,P0=!0)}if(Xt.needsLights&&(Oa.state.directionalShadowMap.length>0&&Xi.setValue(ge,"directionalShadowMap",Oa.state.directionalShadowMap,Ve),Oa.state.spotShadowMap.length>0&&Xi.setValue(ge,"spotShadowMap",Oa.state.spotShadowMap,Ve),Oa.state.pointShadowMap.length>0&&Xi.setValue(ge,"pointShadowMap",Oa.state.pointShadowMap,Ve)),De.isSkinnedMesh){Xi.setOptional(ge,De,"bindMatrix"),Xi.setOptional(ge,De,"bindMatrixInverse");let nr=De.skeleton;nr&&(nr.boneTexture===null&&nr.computeBoneTexture(),Xi.setValue(ge,"boneTexture",nr.boneTexture,Ve))}De.isBatchedMesh&&(Xi.setOptional(ge,De,"batchingTexture"),Xi.setValue(ge,"batchingTexture",De._matricesTexture,Ve),Xi.setOptional(ge,De,"batchingIdTexture"),Xi.setValue(ge,"batchingIdTexture",De._indirectTexture,Ve),Xi.setOptional(ge,De,"batchingColorTexture"),De._colorsTexture!==null&&Xi.setValue(ge,"batchingColorTexture",De._colorsTexture,Ve));let Zh=ke.morphAttributes;if((Zh.position!==void 0||Zh.normal!==void 0||Zh.color!==void 0)&&xe.update(De,ke,hl),(Kh||Xt.receiveShadow!==De.receiveShadow)&&(Xt.receiveShadow=De.receiveShadow,Xi.setValue(ge,"receiveShadow",De.receiveShadow)),(Le.isMeshStandardMaterial||Le.isMeshLambertMaterial||Le.isMeshPhongMaterial)&&Le.envMap===null&&Se.environment!==null&&(Hr.envMapIntensity.value=Se.environmentIntensity),Hr.dfgLUT!==void 0&&(Hr.dfgLUT.value=U0e()),Kh){if(Xi.setValue(ge,"toneMappingExposure",z.toneMappingExposure),Xt.needsLights&&A9(Hr,P0),zt&&Le.fog===!0&&en.refreshFogUniforms(Hr,zt),en.refreshMaterialUniforms(Hr,Le,$e,ze,D.state.transmissionRenderTarget[te.id]),Xt.needsLights&&Xt.lightProbeGrid){let nr=Xt.lightProbeGrid;Hr.probesSH.value=nr.texture,Hr.probesMin.value.copy(nr.boundingBox.min),Hr.probesMax.value.copy(nr.boundingBox.max),Hr.probesResolution.value.copy(nr.resolution)}O_.upload(ge,w4(Xt),Hr,Ve)}if(Le.isShaderMaterial&&Le.uniformsNeedUpdate===!0&&(O_.upload(ge,w4(Xt),Hr,Ve),Le.uniformsNeedUpdate=!1),Le.isSpriteMaterial&&Xi.setValue(ge,"center",De.center),Xi.setValue(ge,"modelViewMatrix",De.modelViewMatrix),Xi.setValue(ge,"normalMatrix",De.normalMatrix),Xi.setValue(ge,"modelMatrix",De.matrixWorld),Le.uniformsGroups!==void 0){let nr=Le.uniformsGroups;for(let Qh=0,I0=nr.length;Qh<I0;Qh++){let T4=nr[Qh];ct.update(T4,hl),ct.bind(T4,hl)}}return hl}function A9(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 m9(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),be.copy(te.viewport),Ie.copy(te.scissor),Qe=te.scissorTest,X.viewport(be),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 zn=te.depthTexture;if(kt.__boundDepthTexture!==zn){if(zn!==null&&Pe.has(zn)&&(te.width!==zn.image.width||te.height!==zn.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,be.copy(te.viewport),Ie.copy(te.scissor),Qe=te.scissorTest}else be.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(be),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],zn=hn.format,Yn=hn.type;if(te.textures.length>1&&ge.readBuffer(ge.COLOR_ATTACHMENT0+kt),!le.textureFormatReadable(zn)){Ge("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!le.textureTypeReadable(Yn)){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(zn),wt.convert(Yn),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],zn=hn.format,Yn=hn.type;if(te.textures.length>1&&ge.readBuffer(ge.COLOR_ATTACHMENT0+kt),!le.textureFormatReadable(zn))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!le.textureTypeReadable(Yn))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(zn),wt.convert(Yn),0);let ki=ae!==null?Pe.get(ae).__webglFramebuffer:null;X.bindFramebuffer(ge.FRAMEBUFFER,ki);let qr=ge.fenceSync(ge.SYNC_GPU_COMMANDS_COMPLETE,0);return ge.flush(),await vW(ge,qr,4),ge.bindBuffer(ge.PIXEL_PACK_BUFFER,pn),ge.getBufferSubData(ge.PIXEL_PACK_BUFFER,0,zt),ge.deleteBuffer(pn),ge.deleteSync(qr),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,zn,Yn,pn,ki,qr,Rr=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,zn=ke.min.y,Yn=ke.isBox3?ke.min.z:0;else{let Hr=Math.pow(2,-De);Yt=Math.floor(Rr.width*Hr),kt=Math.floor(Rr.height*Hr),te.isDataArrayTexture?tn=Rr.depth:te.isData3DTexture?tn=Math.floor(Rr.depth*Hr):tn=1,hn=0,zn=0,Yn=0}Le!==null?(pn=Le.x,ki=Le.y,qr=Le.z):(pn=0,ki=0,qr=0);let ji=wt.convert(Se.format),ao=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 Oa=X.getParameter(ge.UNPACK_ROW_LENGTH),mi=X.getParameter(ge.UNPACK_IMAGE_HEIGHT),hl=X.getParameter(ge.UNPACK_SKIP_PIXELS),vc=X.getParameter(ge.UNPACK_SKIP_ROWS),Kh=X.getParameter(ge.UNPACK_SKIP_IMAGES);X.pixelStorei(ge.UNPACK_ROW_LENGTH,Rr.width),X.pixelStorei(ge.UNPACK_IMAGE_HEIGHT,Rr.height),X.pixelStorei(ge.UNPACK_SKIP_PIXELS,hn),X.pixelStorei(ge.UNPACK_SKIP_ROWS,zn),X.pixelStorei(ge.UNPACK_SKIP_IMAGES,Yn);let P0=te.isDataArrayTexture||te.isData3DTexture,Xi=Se.isDataArrayTexture||Se.isData3DTexture;if(te.isDepthTexture){let Hr=Pe.get(te),Zh=Pe.get(Se),nr=Pe.get(Hr.__renderTarget),Qh=Pe.get(Zh.__renderTarget);X.bindFramebuffer(ge.READ_FRAMEBUFFER,nr.__webglFramebuffer),X.bindFramebuffer(ge.DRAW_FRAMEBUFFER,Qh.__webglFramebuffer);for(let I0=0;I0<tn;I0++)P0&&(ge.framebufferTextureLayer(ge.READ_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,Pe.get(te).__webglTexture,De,Yn+I0),ge.framebufferTextureLayer(ge.DRAW_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,Pe.get(Se).__webglTexture,zt,qr+I0)),ge.blitFramebuffer(hn,zn,Yt,kt,pn,ki,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 Hr=Pe.get(te),Zh=Pe.get(Se);X.bindFramebuffer(ge.READ_FRAMEBUFFER,J),X.bindFramebuffer(ge.DRAW_FRAMEBUFFER,j);for(let nr=0;nr<tn;nr++)P0?ge.framebufferTextureLayer(ge.READ_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,Hr.__webglTexture,De,Yn+nr):ge.framebufferTexture2D(ge.READ_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,ge.TEXTURE_2D,Hr.__webglTexture,De),Xi?ge.framebufferTextureLayer(ge.DRAW_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,Zh.__webglTexture,zt,qr+nr):ge.framebufferTexture2D(ge.DRAW_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,ge.TEXTURE_2D,Zh.__webglTexture,zt),De!==0?ge.blitFramebuffer(hn,zn,Yt,kt,pn,ki,Yt,kt,ge.COLOR_BUFFER_BIT,ge.NEAREST):Xi?ge.copyTexSubImage3D(Xt,zt,pn,ki,qr+nr,hn,zn,Yt,kt):ge.copyTexSubImage2D(Xt,zt,pn,ki,hn,zn,Yt,kt);X.bindFramebuffer(ge.READ_FRAMEBUFFER,null),X.bindFramebuffer(ge.DRAW_FRAMEBUFFER,null)}else Xi?te.isDataTexture||te.isData3DTexture?ge.texSubImage3D(Xt,zt,pn,ki,qr,Yt,kt,tn,ji,ao,Rr.data):Se.isCompressedArrayTexture?ge.compressedTexSubImage3D(Xt,zt,pn,ki,qr,Yt,kt,tn,ji,Rr.data):ge.texSubImage3D(Xt,zt,pn,ki,qr,Yt,kt,tn,ji,ao,Rr):te.isDataTexture?ge.texSubImage2D(ge.TEXTURE_2D,zt,pn,ki,Yt,kt,ji,ao,Rr.data):te.isCompressedTexture?ge.compressedTexSubImage2D(ge.TEXTURE_2D,zt,pn,ki,Rr.width,Rr.height,ji,Rr.data):ge.texSubImage2D(ge.TEXTURE_2D,zt,pn,ki,Yt,kt,ji,ao,Rr);X.pixelStorei(ge.UNPACK_ROW_LENGTH,Oa),X.pixelStorei(ge.UNPACK_IMAGE_HEIGHT,mi),X.pixelStorei(ge.UNPACK_SKIP_PIXELS,hl),X.pixelStorei(ge.UNPACK_SKIP_ROWS,vc),X.pixelStorei(ge.UNPACK_SKIP_IMAGES,Kh),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 _o}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 v3=class extends Ki{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}},U_=new ie,sj=new on,oj=new on,aj=new ie,lj=new ie,b3=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(),sj.copy(w.matrixWorldInverse),oj.multiplyMatrices(w.projectionMatrix,sj),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){U_.setFromMatrixPosition(v.matrixWorld),U_.applyMatrix4(oj);let T=U_.z>=-1&&U_.z<=1&&v.layers.test(S.layers)===!0,R=v.element;R.style.display=T===!0?"":"none",T===!0&&(v.onBeforeRender(t,w,S),R.style.transform="translate("+-100*v.center.x+"%,"+-100*v.center.y+"%)translate("+(U_.x*s+s)+"px,"+(-U_.y*o+o)+"px)",R.parentNode!==l&&l.appendChild(R),v.onAfterRender(t,w,S));let P={distanceToCameraSquared:f(S,v)};a.objects.set(v,P)}for(let T=0,R=v.children.length;T<R;T++)u(v.children[T],w,S)}function f(v,w){return aj.setFromMatrixPosition(v.matrixWorld),lj.setFromMatrixPosition(w.matrixWorld),aj.distanceToSquared(lj)}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,R){if(T.renderOrder!==R.renderOrder)return R.renderOrder-T.renderOrder;let P=a.objects.get(T).distanceToCameraSquared,C=a.objects.get(R).distanceToCameraSquared;return P-C}),S=w.length;for(let T=0,R=w.length;T<R;T++)w[T].element.style.zIndex=S-T}}};function k0e(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var B2=k0e;var G0e=typeof global=="object"&&global&&global.Object===Object&&global,cj=G0e;var z0e=typeof self=="object"&&self&&self.Object===Object&&self,V0e=cj||z0e||Function("return this")(),w3=V0e;var q0e=function(){return w3.Date.now()},S3=q0e;var H0e=/\s/;function W0e(i){for(var e=i.length;e--&&H0e.test(i.charAt(e)););return e}var uj=W0e;var j0e=/^\s+/;function X0e(i){return i&&i.slice(0,uj(i)+1).replace(j0e,"")}var hj=X0e;var $0e=w3.Symbol,k_=$0e;var fj=Object.prototype,Y0e=fj.hasOwnProperty,K0e=fj.toString,U2=k_?k_.toStringTag:void 0;function Z0e(i){var e=Y0e.call(i,U2),t=i[U2];try{i[U2]=void 0;var n=!0}catch{}var r=K0e.call(i);return n&&(e?i[U2]=t:delete i[U2]),r}var dj=Z0e;var Q0e=Object.prototype,J0e=Q0e.toString;function eAe(i){return J0e.call(i)}var pj=eAe;var tAe="[object Null]",nAe="[object Undefined]",Aj=k_?k_.toStringTag:void 0;function iAe(i){return i==null?i===void 0?nAe:tAe:Aj&&Aj in Object(i)?dj(i):pj(i)}var mj=iAe;function rAe(i){return i!=null&&typeof i=="object"}var gj=rAe;var sAe="[object Symbol]";function oAe(i){return typeof i=="symbol"||gj(i)&&mj(i)==sAe}var _j=oAe;var xj=NaN,aAe=/^[-+]0x[0-9a-f]+$/i,lAe=/^0b[01]+$/i,cAe=/^0o[0-7]+$/i,uAe=parseInt;function hAe(i){if(typeof i=="number")return i;if(_j(i))return xj;if(B2(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=B2(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=hj(i);var t=lAe.test(i);return t||cAe.test(i)?uAe(i.slice(2),t?2:8):aAe.test(i)?xj:+i}var dD=hAe;var fAe="Expected a function",dAe=Math.max,pAe=Math.min;function AAe(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(fAe);e=dD(e)||0,B2(t)&&(u=!!t.leading,f="maxWait"in t,s=f?dAe(dD(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?pAe(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 R(D);a=setTimeout(T,w(D))}function R(D){return a=void 0,p&&n?x(D):(n=r=void 0,o)}function P(){a!==void 0&&clearTimeout(a),c=0,n=l=r=a=void 0}function C(){return a===void 0?o:R(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=P,L.flush=C,L}var yj=AAe;function vj(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 mAe(i){if(Array.isArray(i))return i}function gAe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function _Ae(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function xAe(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 yAe(){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 vAe(i,e){return mAe(i)||xAe(i,e)||bAe(i,e)||yAe()}function bAe(i,e){if(i){if(typeof i=="string")return vj(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)?vj(i,e):void 0}}var wAe=_Ae(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;gAe(this,i),this.name=e,this.defaultVal=r,this.triggerUpdate=o,this.onChange=l});function Or(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 wAe(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 R=!!(this instanceof v&&this.constructor),P=R?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=yj(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(be,Ie){}:ee,ce=K.defaultVal,de=ce===void 0?null:ce;return function(be){var Ie=D[J];if(!arguments.length)return Ie;var Qe=be===void 0?de:be;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=vAe(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,R&&P&&N(P),N}}var Br=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-Br.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?Br.Bounce.In(i*2)*.5:Br.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}}}}),k2=function(){return performance.now()},tm=(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=k2()),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})(),G_={Linear:function(i,e){var t=i.length-1,n=t*e,r=Math.floor(n),s=G_.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=G_.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=G_.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=G_.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}}},bj=(function(){function i(){}return i.nextId=function(){return i._nextId++},i._nextId=0,i})(),pD=new tm,Ws=(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=Br.Linear.None,this._interpolationFunction=G_.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=bj.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=pD,pD.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=k2()),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 R={};for(var T in f)R[T]=f[T];n[o]=f=R}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=k2()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this)},i.prototype.resume=function(e){return e===void 0&&(e=k2()),!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=Br.Linear.None),this._easingFunction=e,this},i.prototype.interpolation=function(e){return e===void 0&&(e=G_.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=k2()),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 uWe=bj.nextId,lh=pD,hWe=lh.getAll.bind(lh),fWe=lh.removeAll.bind(lh),dWe=lh.add.bind(lh),pWe=lh.remove.bind(lh),AWe=lh.update.bind(lh);function wj(i){let e=+this._x.call(null,i),t=+this._y.call(null,i),n=+this._z.call(null,i);return Sj(this.cover(e,t,n),e,t,n,i)}function Sj(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,R,P,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),R=+i._y.call(null,o.data),P=+i._z.call(null,o.data),e===T&&t===R&&n===P)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=(P>=S)<<2|(R>=w)<<1|T>=v));return s[N]=o,s[F]=a,i}function Tj(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)Sj(this,t[f],n[f],r[f],i[f]);return this}function Ej(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 Mj(){var i=[];return this.visit(function(e){if(!e.length)do i.push(e.data);while(e=e.next)}),i}function Cj(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 Oi(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 Rj(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=[],R=this._root,P,C;for(R&&T.push(new Oi(R,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);P=T.pop();)if(!(!(R=P.node)||(l=P.x0)>v||(c=P.y0)>w||(u=P.z0)>S||(f=P.x1)<s||(p=P.y1)<o||(x=P.z1)<a))if(R.length){var L=(l+f)/2,D=(c+p)/2,F=(u+x)/2;T.push(new Oi(R[7],L,D,F,f,p,x),new Oi(R[6],l,D,F,L,p,x),new Oi(R[5],L,c,F,f,D,x),new Oi(R[4],l,c,F,L,D,x),new Oi(R[3],L,D,u,f,p,F),new Oi(R[2],l,D,u,L,p,F),new Oi(R[1],L,c,u,f,D,F),new Oi(R[0],l,c,u,L,D,F)),(C=(t>=F)<<2|(e>=D)<<1|i>=L)&&(P=T[T.length-1],T[T.length-1]=T[T.length-1-C],T[T.length-1-C]=P)}else{var N=i-+this._x.call(null,R.data),B=e-+this._y.call(null,R.data),z=t-+this._z.call(null,R.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=R.data}}return r}var SAe=(i,e,t,n,r,s)=>Math.sqrt((i-n)**2+(e-r)**2+(t-s)**2);function Pj(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 R=f.data;SAe(i,e,t,this._x(R),this._y(R),this._z(R))<=n&&r.push(R)}while(f=f.next);return p>l||x>c||v>u||w<s||S<o||T<a}),r}function Ij(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,R,P,C,L,D;if(!t)return this;if(t.length)for(;;){if((R=p>=(w=(o+c)/2))?o=w:c=w,(P=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|P<<1|R]))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 Nj(i){for(var e=0,t=i.length;e<t;++e)this.remove(i[e]);return this}function Lj(){return this._root}function Dj(){var i=0;return this.visit(function(e){if(!e.length)do++i;while(e=e.next)}),i}function Fj(i){var e=[],t,n=this._root,r,s,o,a,l,c,u;for(n&&e.push(new Oi(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 Oi(r,f,p,x,l,c,u)),(r=n[6])&&e.push(new Oi(r,s,p,x,f,c,u)),(r=n[5])&&e.push(new Oi(r,f,o,x,l,p,u)),(r=n[4])&&e.push(new Oi(r,s,o,x,f,p,u)),(r=n[3])&&e.push(new Oi(r,f,p,a,l,c,x)),(r=n[2])&&e.push(new Oi(r,s,p,a,f,c,x)),(r=n[1])&&e.push(new Oi(r,f,o,a,l,p,x)),(r=n[0])&&e.push(new Oi(r,s,o,a,f,p,x))}return this}function Oj(i){var e=[],t=[],n;for(this._root&&e.push(new Oi(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 Oi(s,o,a,l,p,x,v)),(s=r[1])&&e.push(new Oi(s,p,a,l,c,x,v)),(s=r[2])&&e.push(new Oi(s,o,x,l,p,u,v)),(s=r[3])&&e.push(new Oi(s,p,x,l,c,u,v)),(s=r[4])&&e.push(new Oi(s,o,a,v,p,x,f)),(s=r[5])&&e.push(new Oi(s,p,a,v,c,x,f)),(s=r[6])&&e.push(new Oi(s,o,x,v,p,u,f)),(s=r[7])&&e.push(new Oi(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 Bj(i){return i[0]}function Uj(i){return arguments.length?(this._x=i,this):this._x}function kj(i){return i[1]}function Gj(i){return arguments.length?(this._y=i,this):this._y}function zj(i){return i[2]}function Vj(i){return arguments.length?(this._z=i,this):this._z}function G2(i,e,t,n){var r=new AD(e??Bj,t??kj,n??zj,NaN,NaN,NaN,NaN,NaN,NaN);return i==null?r:r.addAll(i)}function AD(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 qj(i){for(var e={data:i.data},t=e;i=i.next;)t=t.next={data:i.data};return e}var bo=G2.prototype=AD.prototype;bo.copy=function(){var i=new AD(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=qj(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]=qj(n));return i};bo.add=wj;bo.addAll=Tj;bo.cover=Ej;bo.data=Mj;bo.extent=Cj;bo.find=Rj;bo.findAllWithinRadius=Pj;bo.remove=Ij;bo.removeAll=Nj;bo.root=Lj;bo.size=Dj;bo.visit=Fj;bo.visitAfter=Oj;bo.x=Uj;bo.y=Gj;bo.z=Vj;function nm(i,e){return i==null||e==null?NaN:i<e?-1:i>e?1:i>=e?0:NaN}function mD(i,e){return i==null||e==null?NaN:e<i?-1:e>i?1:e>=i?0:NaN}function T3(i){let e,t,n;i.length!==2?(e=nm,t=(a,l)=>nm(i(a),l),n=(a,l)=>i(a)-l):(e=i===nm||i===mD?i:TAe,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 TAe(){return 0}function gD(i){return i===null?NaN:+i}var Hj=T3(nm),Wj=Hj.right,EAe=Hj.left,MAe=T3(gD).center,z2=Wj;function kp(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 wo=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 CAe=Math.sqrt(50),RAe=Math.sqrt(10),PAe=Math.sqrt(2);function E3(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>=CAe?10:s>=RAe?5:s>=PAe?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?E3(i,e,t*2):[a,l,c]}function M3(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?E3(e,i,t):E3(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 V2(i,e,t){return e=+e,i=+i,t=+t,E3(i,e,t)[2]}function _D(i,e,t){e=+e,i=+i,t=+t;let n=e<i,r=n?V2(e,i,t):V2(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 R3(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*IAe(i){for(let e of i)yield*e}function ch(i){return Array.from(IAe(i))}function Vf(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 P3(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 I3(i,e){switch(arguments.length){case 0:break;case 1:this.range(i);break;default:this.range(e).domain(i);break}return this}function N3(i,e,t){i.prototype=e.prototype=t,t.constructor=i}function xD(i,e){var t=Object.create(i.prototype);for(var n in e)t[n]=e[n];return t}function W2(){}var q2=.7,F3=1/q2,z_="\\s*([+-]?\\d+)\\s*",H2="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",uh="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",NAe=/^#([0-9a-f]{3,8})$/,LAe=new RegExp(`^rgb\\(${z_},${z_},${z_}\\)$`),DAe=new RegExp(`^rgb\\(${uh},${uh},${uh}\\)$`),FAe=new RegExp(`^rgba\\(${z_},${z_},${z_},${H2}\\)$`),OAe=new RegExp(`^rgba\\(${uh},${uh},${uh},${H2}\\)$`),BAe=new RegExp(`^hsl\\(${H2},${uh},${uh}\\)$`),UAe=new RegExp(`^hsla\\(${H2},${uh},${uh},${H2}\\)$`),jj={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};N3(W2,Zc,{copy(i){return Object.assign(new this.constructor,this,i)},displayable(){return this.rgb().displayable()},hex:Xj,formatHex:Xj,formatHex8:kAe,formatHsl:GAe,formatRgb:$j,toString:$j});function Xj(){return this.rgb().formatHex()}function kAe(){return this.rgb().formatHex8()}function GAe(){return eX(this).formatHsl()}function $j(){return this.rgb().formatRgb()}function Zc(i){var e,t;return i=(i+"").trim().toLowerCase(),(e=NAe.exec(i))?(t=e[1].length,e=parseInt(e[1],16),t===6?Yj(e):t===3?new Za(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?L3(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?L3(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=LAe.exec(i))?new Za(e[1],e[2],e[3],1):(e=DAe.exec(i))?new Za(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=FAe.exec(i))?L3(e[1],e[2],e[3],e[4]):(e=OAe.exec(i))?L3(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=BAe.exec(i))?Qj(e[1],e[2]/100,e[3]/100,1):(e=UAe.exec(i))?Qj(e[1],e[2]/100,e[3]/100,e[4]):jj.hasOwnProperty(i)?Yj(jj[i]):i==="transparent"?new Za(NaN,NaN,NaN,0):null}function Yj(i){return new Za(i>>16&255,i>>8&255,i&255,1)}function L3(i,e,t,n){return n<=0&&(i=e=t=NaN),new Za(i,e,t,n)}function zAe(i){return i instanceof W2||(i=Zc(i)),i?(i=i.rgb(),new Za(i.r,i.g,i.b,i.opacity)):new Za}function V_(i,e,t,n){return arguments.length===1?zAe(i):new Za(i,e,t,n??1)}function Za(i,e,t,n){this.r=+i,this.g=+e,this.b=+t,this.opacity=+n}N3(Za,V_,xD(W2,{brighter(i){return i=i==null?F3:Math.pow(F3,i),new Za(this.r*i,this.g*i,this.b*i,this.opacity)},darker(i){return i=i==null?q2:Math.pow(q2,i),new Za(this.r*i,this.g*i,this.b*i,this.opacity)},rgb(){return this},clamp(){return new Za(rm(this.r),rm(this.g),rm(this.b),O3(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:Kj,formatHex:Kj,formatHex8:VAe,formatRgb:Zj,toString:Zj}));function Kj(){return`#${im(this.r)}${im(this.g)}${im(this.b)}`}function VAe(){return`#${im(this.r)}${im(this.g)}${im(this.b)}${im((isNaN(this.opacity)?1:this.opacity)*255)}`}function Zj(){let i=O3(this.opacity);return`${i===1?"rgb(":"rgba("}${rm(this.r)}, ${rm(this.g)}, ${rm(this.b)}${i===1?")":`, ${i})`}`}function O3(i){return isNaN(i)?1:Math.max(0,Math.min(1,i))}function rm(i){return Math.max(0,Math.min(255,Math.round(i)||0))}function im(i){return i=rm(i),(i<16?"0":"")+i.toString(16)}function Qj(i,e,t,n){return n<=0?i=e=t=NaN:t<=0||t>=1?i=e=NaN:e<=0&&(i=NaN),new Kc(i,e,t,n)}function eX(i){if(i instanceof Kc)return new Kc(i.h,i.s,i.l,i.opacity);if(i instanceof W2||(i=Zc(i)),!i)return new Kc;if(i instanceof Kc)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 Kc(o,a,l,i.opacity)}function tX(i,e,t,n){return arguments.length===1?eX(i):new Kc(i,e,t,n??1)}function Kc(i,e,t,n){this.h=+i,this.s=+e,this.l=+t,this.opacity=+n}N3(Kc,tX,xD(W2,{brighter(i){return i=i==null?F3:Math.pow(F3,i),new Kc(this.h,this.s,this.l*i,this.opacity)},darker(i){return i=i==null?q2:Math.pow(q2,i),new Kc(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 Za(yD(i>=240?i-240:i+120,r,n),yD(i,r,n),yD(i<120?i+240:i-120,r,n),this.opacity)},clamp(){return new Kc(Jj(this.h),D3(this.s),D3(this.l),O3(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=O3(this.opacity);return`${i===1?"hsl(":"hsla("}${Jj(this.h)}, ${D3(this.s)*100}%, ${D3(this.l)*100}%${i===1?")":`, ${i})`}`}}));function Jj(i){return i=(i||0)%360,i<0?i+360:i}function D3(i){return Math.max(0,Math.min(1,i||0))}function yD(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 vD(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 nX(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 vD((t-n/e)*e,o,r,s,a)}}function iX(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 vD((t-n/e)*e,r,s,o,a)}}var j2=i=>()=>i;function qAe(i,e){return function(t){return i+t*e}}function HAe(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 rX(i){return(i=+i)==1?B3:function(e,t){return t-e?HAe(e,t,i):j2(isNaN(e)?t:e)}}function B3(i,e){var t=e-i;return t?qAe(i,t):j2(isNaN(i)?e:i)}var bD=(function i(e){var t=rX(e);function n(r,s){var o=t((r=V_(r)).r,(s=V_(s)).r),a=t(r.g,s.g),l=t(r.b,s.b),c=B3(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 sX(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=V_(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 Hje=sX(nX),Wje=sX(iX);function U3(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 k3(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function wD(i,e){return(k3(e)?U3:SD)(i,e)}function SD(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]=sm(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 oX(i,e){var t=new Date;return i=+i,e=+e,function(n){return t.setTime(i*(1-n)+e*n),t}}function hh(i,e){return i=+i,e=+e,function(t){return i*(1-t)+e*t}}function aX(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]=sm(i[r],e[r]):n[r]=e[r];return function(s){for(r in t)n[r]=t[r](s);return n}}var ED=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,TD=new RegExp(ED.source,"g");function WAe(i){return function(){return i}}function jAe(i){return function(e){return i(e)+""}}function lX(i,e){var t=ED.lastIndex=TD.lastIndex=0,n,r,s,o=-1,a=[],l=[];for(i=i+"",e=e+"";(n=ED.exec(i))&&(r=TD.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:hh(n,r)})),t=TD.lastIndex;return t<e.length&&(s=e.slice(t),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?jAe(l[0].x):WAe(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 sm(i,e){var t=typeof e,n;return e==null||t==="boolean"?j2(e):(t==="number"?hh:t==="string"?(n=Zc(e))?(e=n,bD):lX:e instanceof Zc?bD:e instanceof Date?oX:k3(e)?U3:Array.isArray(e)?SD:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?aX:hh)(i,e)}function MD(i,e){return i=+i,e=+e,function(t){return Math.round(i*(1-t)+e*t)}}function CD(i){return function(){return i}}function RD(i){return+i}var cX=[0,1];function q_(i){return i}function PD(i,e){return(e-=i=+i)?function(t){return(t-i)/e}:CD(isNaN(e)?NaN:.5)}function XAe(i,e){var t;return i>e&&(t=i,i=e,e=t),function(n){return Math.max(i,Math.min(e,n))}}function $Ae(i,e,t){var n=i[0],r=i[1],s=e[0],o=e[1];return r<n?(n=PD(r,n),s=t(o,s)):(n=PD(n,r),s=t(s,o)),function(a){return s(n(a))}}function YAe(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]=PD(i[o],i[o+1]),s[o]=t(e[o],e[o+1]);return function(a){var l=z2(i,a,1,n)-1;return s[l](r[l](a))}}function uX(i,e){return e.domain(i.domain()).range(i.range()).interpolate(i.interpolate()).clamp(i.clamp()).unknown(i.unknown())}function KAe(){var i=cX,e=cX,t=sm,n,r,s,o=q_,a,l,c;function u(){var p=Math.min(i.length,e.length);return o!==q_&&(o=XAe(i[0],i[p-1])),a=p>2?YAe:$Ae,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),hh)))(p)))},f.domain=function(p){return arguments.length?(i=Array.from(p,RD),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=MD,u()},f.clamp=function(p){return arguments.length?(o=p?!0:q_,u()):o!==q_},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 KAe()(q_,q_)}function hX(i){return Math.abs(i=Math.round(i))>=1e21?i.toLocaleString("en").replace(/,/g,""):i.toString(10)}function om(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 fh(i){return i=om(Math.abs(i)),i?i[1]:NaN}function fX(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 dX(i){return function(e){return e.replace(/[0-9]/g,function(t){return i[+t]})}}var ZAe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Gp(i){if(!(e=ZAe.exec(i)))throw new Error("invalid format: "+i);var e;return new G3({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]})}Gp.prototype=G3.prototype;function G3(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+""}G3.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 pX(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 X2;function AX(i,e){var t=om(i,e);if(!t)return X2=void 0,i.toPrecision(e);var n=t[0],r=t[1],s=r-(X2=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")+om(i,Math.max(0,e+s-1))[0]}function ND(i,e){var t=om(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 LD={"%":(i,e)=>(i*100).toFixed(e),b:i=>Math.round(i).toString(2),c:i=>i+"",d:hX,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)=>ND(i*100,e),r:ND,s:AX,X:i=>Math.round(i).toString(16).toUpperCase(),x:i=>Math.round(i).toString(16)};function DD(i){return i}var mX=Array.prototype.map,gX=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function _X(i){var e=i.grouping===void 0||i.thousands===void 0?DD:fX(mX.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?DD:dX(mX.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=Gp(f);var x=f.fill,v=f.align,w=f.sign,S=f.symbol,T=f.zero,R=f.width,P=f.comma,C=f.precision,L=f.trim,D=f.type;D==="n"?(P=!0,D="g"):LD[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=LD[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=pX(H)),ae&&+H==0&&w!=="+"&&(ae=!1),K=(ae?w==="("?w:a:w==="-"||w==="("?"":w)+K,J=(D==="s"&&!isNaN(H)&&X2!==void 0?gX[8+X2/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}}}P&&!T&&(H=e(H,1/0));var ce=K.length+H.length+J.length,de=ce<R?new Array(R-ce+1).join(x):"";switch(P&&T&&(H=e(de+H,de.length?R-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(fh(p)/3)))*3,v=Math.pow(10,-x),w=c((f=Gp(f),f.type="f",f),{suffix:gX[8+x/3]});return function(S){return w(v*S)}}return{format:c,formatPrefix:u}}var z3,V3,q3;FD({thousands:",",grouping:[3],currency:["$",""]});function FD(i){return z3=_X(i),V3=z3.format,q3=z3.formatPrefix,z3}function OD(i){return Math.max(0,-fh(Math.abs(i)))}function BD(i,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(fh(e)/3)))*3-fh(Math.abs(i)))}function UD(i,e){return i=Math.abs(i),e=Math.abs(e)-i,Math.max(0,fh(e)-fh(i))+1}function kD(i,e,t,n){var r=_D(i,e,t),s;switch(n=Gp(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(i),Math.abs(e));return n.precision==null&&!isNaN(s=BD(r,o))&&(n.precision=s),q3(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=OD(r))&&(n.precision=s-(n.type==="%")*2);break}}return V3(n)}function GD(i){var e=i.domain;return i.ticks=function(t){var n=e();return M3(n[0],n[n.length-1],t??10)},i.tickFormat=function(t,n){var r=e();return kD(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=V2(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 Qa(){var i=ID();return i.copy=function(){return uX(i,Qa())},I3.apply(i,arguments),GD(i)}function $2(){var i=0,e=1,t=1,n=[.5],r=[0,1],s;function o(l){return l!=null&&l<=l?r[z2(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 $2().domain([i,e]).range(r).unknown(s)},I3.apply(GD(o),arguments)}var Cn=1e-6,am=1e-12,ei=Math.PI,to=ei/2,H_=ei/4,no=ei*2,Qi=180/ei,mn=ei/180,ti=Math.abs,W_=Math.atan,hs=Math.atan2,fn=Math.cos,Y2=Math.ceil,xX=Math.exp;var H3=Math.hypot,yX=Math.log;var an=Math.sin,vX=Math.sign||function(i){return i>0?1:i<0?-1:0},So=Math.sqrt,bX=Math.tan;function wX(i){return i>1?0:i<-1?ei:Math.acos(i)}function $o(i){return i>1?to:i<-1?-to:Math.asin(i)}function zD(i){return(i=an(i/2))*i}function Jr(){}function W3(i,e){i&&TX.hasOwnProperty(i.type)&&TX[i.type](i,e)}var SX={Feature:function(i,e){W3(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)W3(t[n].geometry,e)}},TX={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){VD(i.coordinates,e,0)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)VD(t[n],e,0)},Polygon:function(i,e){EX(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)EX(t[n],e)},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)W3(t[n],e)}};function VD(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 EX(i,e){var t=-1,n=i.length;for(e.polygonStart();++t<n;)VD(i[t],e,1);e.polygonEnd()}function zp(i,e){i&&SX.hasOwnProperty(i.type)?SX[i.type](i,e):W3(i,e)}var K2=new wo,MX=new wo,CX,RX,qD,HD,WD,dh={point:Jr,lineStart:Jr,lineEnd:Jr,polygonStart:function(){K2=new wo,dh.lineStart=QAe,dh.lineEnd=JAe},polygonEnd:function(){var i=+K2;MX.add(i<0?no+i:i),this.lineStart=this.lineEnd=this.point=Jr},sphere:function(){MX.add(no)}};function QAe(){dh.point=eme}function JAe(){PX(CX,RX)}function eme(i,e){dh.point=PX,CX=i,RX=e,i*=mn,e*=mn,qD=i,HD=fn(e=e/2+H_),WD=an(e)}function PX(i,e){i*=mn,e*=mn,e=e/2+H_;var t=i-qD,n=t>=0?1:-1,r=n*t,s=fn(e),o=an(e),a=WD*o,l=HD*s+a*fn(r),c=a*n*an(r);K2.add(hs(c,l)),qD=i,HD=s,WD=o}function lm(i){return[hs(i[1],i[0]),$o(i[2])]}function sc(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 qf(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 j3(i,e){i[0]+=e[0],i[1]+=e[1],i[2]+=e[2]}function Q2(i,e){return[i[0]*e,i[1]*e,i[2]*e]}function cm(i){var e=So(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);i[0]/=e,i[1]/=e,i[2]/=e}var Ur,Ja,es,Tl,um,DX,FX,j_,J2,Vp,Wf,Hf={point:jD,lineStart:IX,lineEnd:NX,polygonStart:function(){Hf.point=BX,Hf.lineStart=tme,Hf.lineEnd=nme,J2=new wo,dh.polygonStart()},polygonEnd:function(){dh.polygonEnd(),Hf.point=jD,Hf.lineStart=IX,Hf.lineEnd=NX,K2<0?(Ur=-(es=180),Ja=-(Tl=90)):J2>Cn?Tl=90:J2<-Cn&&(Ja=-90),Wf[0]=Ur,Wf[1]=es},sphere:function(){Ur=-(es=180),Ja=-(Tl=90)}};function jD(i,e){Vp.push(Wf=[Ur=i,es=i]),e<Ja&&(Ja=e),e>Tl&&(Tl=e)}function OX(i,e){var t=sc([i*mn,e*mn]);if(j_){var n=qf(j_,t),r=[n[1],-n[0],0],s=qf(r,n);cm(s),s=lm(s);var o=i-um,a=o>0?1:-1,l=s[0]*Qi*a,c,u=ti(o)>180;u^(a*um<l&&l<a*i)?(c=s[1]*Qi,c>Tl&&(Tl=c)):(l=(l+360)%360-180,u^(a*um<l&&l<a*i)?(c=-s[1]*Qi,c<Ja&&(Ja=c)):(e<Ja&&(Ja=e),e>Tl&&(Tl=e))),u?i<um?Sl(Ur,i)>Sl(Ur,es)&&(es=i):Sl(i,es)>Sl(Ur,es)&&(Ur=i):es>=Ur?(i<Ur&&(Ur=i),i>es&&(es=i)):i>um?Sl(Ur,i)>Sl(Ur,es)&&(es=i):Sl(i,es)>Sl(Ur,es)&&(Ur=i)}else Vp.push(Wf=[Ur=i,es=i]);e<Ja&&(Ja=e),e>Tl&&(Tl=e),j_=t,um=i}function IX(){Hf.point=OX}function NX(){Wf[0]=Ur,Wf[1]=es,Hf.point=jD,j_=null}function BX(i,e){if(j_){var t=i-um;J2.add(ti(t)>180?t+(t>0?360:-360):t)}else DX=i,FX=e;dh.point(i,e),OX(i,e)}function tme(){dh.lineStart()}function nme(){BX(DX,FX),dh.lineEnd(),ti(J2)>Cn&&(Ur=-(es=180)),Wf[0]=Ur,Wf[1]=es,j_=null}function Sl(i,e){return(e-=i)<0?e+360:e}function ime(i,e){return i[0]-e[0]}function LX(i,e){return i[0]<=i[1]?i[0]<=e&&e<=i[1]:e<i[0]||i[1]<e}function X3(i){var e,t,n,r,s,o,a;if(Tl=es=-(Ur=Ja=1/0),Vp=[],zp(i,Hf),t=Vp.length){for(Vp.sort(ime),e=1,n=Vp[0],s=[n];e<t;++e)r=Vp[e],LX(n,r[0])||LX(n,r[1])?(Sl(n[0],r[1])>Sl(n[0],n[1])&&(n[1]=r[1]),Sl(r[0],n[1])>Sl(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=Sl(n[1],r[0]))>o&&(o=a,Ur=r[0],es=n[1])}return Vp=Wf=null,Ur===1/0||Ja===1/0?[[NaN,NaN],[NaN,NaN]]:[[Ur,Ja],[es,Tl]]}var ev,$3,Y3,K3,Z3,Q3,J3,eE,XD,$D,YD,GX,zX,ba,wa,Sa,Qc={sphere:Jr,point:KD,lineStart:UX,lineEnd:kX,polygonStart:function(){Qc.lineStart=ome,Qc.lineEnd=ame},polygonEnd:function(){Qc.lineStart=UX,Qc.lineEnd=kX}};function KD(i,e){i*=mn,e*=mn;var t=fn(e);tv(t*fn(i),t*an(i),an(e))}function tv(i,e,t){++ev,Y3+=(i-Y3)/ev,K3+=(e-K3)/ev,Z3+=(t-Z3)/ev}function UX(){Qc.point=rme}function rme(i,e){i*=mn,e*=mn;var t=fn(e);ba=t*fn(i),wa=t*an(i),Sa=an(e),Qc.point=sme,tv(ba,wa,Sa)}function sme(i,e){i*=mn,e*=mn;var t=fn(e),n=t*fn(i),r=t*an(i),s=an(e),o=hs(So((o=wa*s-Sa*r)*o+(o=Sa*n-ba*s)*o+(o=ba*r-wa*n)*o),ba*n+wa*r+Sa*s);$3+=o,Q3+=o*(ba+(ba=n)),J3+=o*(wa+(wa=r)),eE+=o*(Sa+(Sa=s)),tv(ba,wa,Sa)}function kX(){Qc.point=KD}function ome(){Qc.point=lme}function ame(){VX(GX,zX),Qc.point=KD}function lme(i,e){GX=i,zX=e,i*=mn,e*=mn,Qc.point=VX;var t=fn(e);ba=t*fn(i),wa=t*an(i),Sa=an(e),tv(ba,wa,Sa)}function VX(i,e){i*=mn,e*=mn;var t=fn(e),n=t*fn(i),r=t*an(i),s=an(e),o=wa*s-Sa*r,a=Sa*n-ba*s,l=ba*r-wa*n,c=H3(o,a,l),u=$o(c),f=c&&-u/c;XD.add(f*o),$D.add(f*a),YD.add(f*l),$3+=u,Q3+=u*(ba+(ba=n)),J3+=u*(wa+(wa=r)),eE+=u*(Sa+(Sa=s)),tv(ba,wa,Sa)}function tE(i){ev=$3=Y3=K3=Z3=Q3=J3=eE=0,XD=new wo,$D=new wo,YD=new wo,zp(i,Qc);var e=+XD,t=+$D,n=+YD,r=H3(e,t,n);return r<am&&(e=Q3,t=J3,n=eE,$3<Cn&&(e=Y3,t=K3,n=Z3),r=H3(e,t,n),r<am)?[NaN,NaN]:[hs(t,e)*Qi,$o(n/r)*Qi]}function nv(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 ZD(i,e){return ti(i)>ei&&(i-=Math.round(i/no)*no),[i,e]}ZD.invert=ZD;function QD(i,e,t){return(i%=no)?e||t?nv(HX(i),WX(e,t)):HX(i):e||t?WX(e,t):ZD}function qX(i){return function(e,t){return e+=i,ti(e)>ei&&(e-=Math.round(e/no)*no),[e,t]}}function HX(i){var e=qX(i);return e.invert=qX(-i),e}function WX(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[hs(f*r-x*s,u*t-p*n),$o(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[hs(f*r+p*s,u*t+x*n),$o(x*t-u*n)]},o}function JD(i){i=QD(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]*=Qi,t[1]*=Qi,t}return e.invert=function(t){return t=i.invert(t[0]*mn,t[1]*mn),t[0]*=Qi,t[1]*=Qi,t},e}function XX(i,e,t,n,r,s){if(t){var o=fn(e),a=an(e),l=n*t;r==null?(r=e+n*no,s=e-l/2):(r=jX(o,r),s=jX(o,s),(n>0?r<s:r>s)&&(r+=n*no));for(var c,u=r;n>0?u>s:u<s;u-=l)c=lm([o,-a*fn(u),-a*an(u)]),i.point(c[0],c[1])}}function jX(i,e){e=sc(e),e[0]-=i,cm(e);var t=wX(-e[1]);return((-e[2]<0?-t:t)+no-Cn)%no}function nE(){var i=[],e;return{point:function(t,n,r){e.push([t,n,r])},lineStart:function(){i.push(e=[])},lineEnd:Jr,rejoin:function(){i.length>1&&i.push(i.pop().concat(i.shift()))},result:function(){var t=i;return i=[],e=null,t}}}function X_(i,e){return ti(i[0]-e[0])<Cn&&ti(i[1]-e[1])<Cn}function iE(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 rE(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],R;if(X_(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(R=new iE(S,v,null,!0)),o.push(R.o=new iE(S,null,R,!1)),s.push(R=new iE(T,v,null,!1)),o.push(R.o=new iE(T,null,R,!0))}}),!!s.length){for(o.sort(e),$X(s),$X(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 $X(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 e6(i){return ti(i[0])<=ei?i[0]:vX(i[0])*((ti(i[0])+ei)%no-ei)}function sE(i,e){var t=e6(e),n=e[1],r=an(n),s=[an(t),-fn(t),0],o=0,a=0,l=new wo;r===1?n=to+Cn:r===-1&&(n=-to-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=e6(x),w=x[1]/2+H_,S=an(w),T=fn(w),R=0;R<p;++R,v=C,S=D,T=F,x=P){var P=f[R],C=e6(P),L=P[1]/2+H_,D=an(L),F=fn(L),N=C-v,B=N>=0?1:-1,z=B*N,V=z>ei,H=S*D;if(l.add(hs(H*B*an(z),T*F+H*fn(z))),o+=V?N+B*no:N,V^v>=t^C>=t){var K=qf(sc(x),sc(P));cm(K);var J=qf(s,K);cm(J);var j=(V^N>=0?-1:1)*$o(J[2]);(n>j||n===j&&(K[0]||K[1]))&&(a+=V^N>=0?1:-1)}}return(o<-Cn||o<Cn&&l<-am)^a&1}function oE(i,e,t,n){return function(r){var s=e(r),o=nE(),a=e(o),l=!1,c,u,f,p={point:x,lineStart:w,lineEnd:S,polygonStart:function(){p.point=T,p.lineStart=R,p.lineEnd=P,u=[],c=[]},polygonEnd:function(){p.point=x,p.lineStart=w,p.lineEnd=S,u=ch(u);var C=sE(c,n);u.length?(l||(r.polygonStart(),l=!0),rE(u,ume,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 R(){a.lineStart(),f=[]}function P(){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(cme))}}return p}}function cme(i){return i.length>1}function ume(i,e){return((i=i.x)[0]<0?i[1]-to-Cn:to-i[1])-((e=e.x)[0]<0?e[1]-to-Cn:to-e[1])}var t6=oE(function(){return!0},hme,dme,[-ei,-to]);function hme(i){var e=NaN,t=NaN,n=NaN,r;return{lineStart:function(){i.lineStart(),r=1},point:function(s,o){var a=s>0?ei:-ei,l=ti(s-e);ti(l-ei)<Cn?(i.point(e,t=(t+o)/2>0?to:-to),i.point(n,t),i.lineEnd(),i.lineStart(),i.point(a,t),i.point(s,t),r=0):n!==a&&l>=ei&&(ti(e-n)<Cn&&(e-=n*Cn),ti(s-a)<Cn&&(s-=a*Cn),t=fme(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 fme(i,e,t,n){var r,s,o=an(i-t);return ti(o)>Cn?W_((an(e)*(s=fn(n))*an(t)-an(n)*(r=fn(e))*an(i))/(r*s*o)):(e+n)/2}function dme(i,e,t,n){var r;if(i==null)r=t*to,n.point(-ei,r),n.point(0,r),n.point(ei,r),n.point(ei,0),n.point(ei,-r),n.point(0,-r),n.point(-ei,-r),n.point(-ei,0),n.point(-ei,r);else if(ti(i[0]-e[0])>Cn){var s=i[0]<e[0]?ei:-ei;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=ti(e)>Cn;function s(u,f,p,x){XX(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 R=[S,T],P,C=o(S,T),L=n?C?0:c(S,T):C?c(S+(S<0?ei:-ei),T):0;if(!f&&(v=x=C)&&u.lineStart(),C!==x&&(P=l(f,R),(!P||X_(f,P)||X_(R,P))&&(R[2]=1)),C!==x)w=0,C?(u.lineStart(),P=l(R,f),u.point(P[0],P[1])):(P=l(f,R),u.point(P[0],P[1],2),u.lineEnd()),f=P;else if(r&&f&&n^C){var D;!(L&p)&&(D=l(R,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||!X_(f,R))&&u.point(R[0],R[1]),f=R,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=sc(u),v=sc(f),w=[1,0,0],S=qf(x,v),T=Z2(S,S),R=S[0],P=T-R*R;if(!P)return!p&&u;var C=e*T/P,L=-e*R/P,D=qf(w,S),F=Q2(w,C),N=Q2(S,L);j3(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=So(H),J=Q2(B,(-z-K)/V);if(j3(J,F),J=lm(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,be=ti(de-ei)<Cn,Ie=be||de<Cn;if(!be&&ae<ee&&(ce=ee,ee=ae,ae=ce),Ie?be?ee+ae>0^J[1]<(ti(J[0]-j)<Cn?ee:ae):ee<=J[1]&&J[1]<=ae:de>ei^(j<=J[0]&&J[0]<=Z)){var Qe=Q2(B,(-z+K)/V);return j3(Qe,F),[J,lm(Qe)]}}}function c(u,f){var p=n?i:ei-i,x=0;return u<-p?x|=1:u>p&&(x|=2),f<-p?x|=4:f>p&&(x|=8),x}return oE(o,a,s,n?[0,-i]:[-ei,i-ei])}function KX(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 iv=1e9,aE=-iv;function n6(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 ti(c[0]-i)<Cn?u>0?0:3:ti(c[0]-t)<Cn?u>0?2:1:ti(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=nE(),p,x,v,w,S,T,R,P,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,be=ae[0],Ie,Qe,Ue=be[0],mt=be[1];ce<de;++ce)Ie=Ue,Qe=mt,be=ae[ce],Ue=be[0],mt=be[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=ch(p)).length;(Z||ee)&&(c.polygonStart(),Z&&(c.lineStart(),s(null,null,1,c),c.lineEnd()),ee&&rE(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,R=P=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=[R=Math.max(aE,Math.min(iv,R)),P=Math.max(aE,Math.min(iv,P))],ce=[j=Math.max(aE,Math.min(iv,j)),Z=Math.max(aE,Math.min(iv,Z))];KX(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)}R=j,P=Z,C=ee}return F}}var i6,r6,lE,cE,$_={sphere:Jr,point:Jr,lineStart:pme,lineEnd:Jr,polygonStart:Jr,polygonEnd:Jr};function pme(){$_.point=mme,$_.lineEnd=Ame}function Ame(){$_.point=$_.lineEnd=Jr}function mme(i,e){i*=mn,e*=mn,r6=i,lE=an(e),cE=fn(e),$_.point=gme}function gme(i,e){i*=mn,e*=mn;var t=an(e),n=fn(e),r=ti(i-r6),s=fn(r),o=an(r),a=n*o,l=cE*t-lE*n*s,c=lE*t+cE*n*s;i6.add(hs(So(a*a+l*l),c)),r6=i,lE=t,cE=n}function ZX(i){return i6=new wo,zp(i,$_),+i6}var s6=[null,null],_me={type:"LineString",coordinates:s6};function el(i,e){return s6[0]=i,s6[1]=e,ZX(_me)}var QX={Feature:function(i,e){return uE(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)if(uE(t[n].geometry,e))return!0;return!1}},JX={Sphere:function(){return!0},Point:function(i,e){return e$(i.coordinates,e)},MultiPoint:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(e$(t[n],e))return!0;return!1},LineString:function(i,e){return t$(i.coordinates,e)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(t$(t[n],e))return!0;return!1},Polygon:function(i,e){return n$(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(n$(t[n],e))return!0;return!1},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)if(uE(t[n],e))return!0;return!1}};function uE(i,e){return i&&JX.hasOwnProperty(i.type)?JX[i.type](i,e):!1}function e$(i,e){return el(i,e)===0}function t$(i,e){for(var t,n,r,s=0,o=i.length;s<o;s++){if(n=el(i[s],e),n===0||s>0&&(r=el(i[s],i[s-1]),r>0&&t<=r&&n<=r&&(t+n-r)*(1-Math.pow((t-n)/r,2))<am*r))return!0;t=n}return!1}function n$(i,e){return!!sE(i.map(xme),i$(e))}function xme(i){return i=i.map(i$),i.pop(),i}function i$(i){return[i[0]*mn,i[1]*mn]}function o6(i,e){return(i&&QX.hasOwnProperty(i.type)?QX[i.type]:uE)(i,e)}function r$(i,e,t){var n=Vf(i,e-Cn,t).concat(e);return function(r){return n.map(function(s){return[r,s]})}}function s$(i,e,t){var n=Vf(i,e-Cn,t).concat(e);return function(r){return n.map(function(s){return[s,r]})}}function a6(){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:R()}}function R(){return Vf(Y2(n/u)*u,t,u).map(v).concat(Vf(Y2(a/f)*f,o,f).map(w)).concat(Vf(Y2(e/l)*l,i,l).filter(function(P){return ti(P%u)>Cn}).map(p)).concat(Vf(Y2(s/c)*c,r,c).filter(function(P){return ti(P%f)>Cn}).map(x))}return T.lines=function(){return R().map(function(P){return{type:"LineString",coordinates:P}})},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(P){return arguments.length?T.extentMajor(P).extentMinor(P):T.extentMinor()},T.extentMajor=function(P){return arguments.length?(n=+P[0][0],t=+P[1][0],a=+P[0][1],o=+P[1][1],n>t&&(P=n,n=t,t=P),a>o&&(P=a,a=o,o=P),T.precision(S)):[[n,a],[t,o]]},T.extentMinor=function(P){return arguments.length?(e=+P[0][0],i=+P[1][0],s=+P[0][1],r=+P[1][1],e>i&&(P=e,e=i,i=P),s>r&&(P=s,s=r,r=P),T.precision(S)):[[e,s],[i,r]]},T.step=function(P){return arguments.length?T.stepMajor(P).stepMinor(P):T.stepMinor()},T.stepMajor=function(P){return arguments.length?(u=+P[0],f=+P[1],T):[u,f]},T.stepMinor=function(P){return arguments.length?(l=+P[0],c=+P[1],T):[l,c]},T.precision=function(P){return arguments.length?(S=+P,p=r$(s,r,90),x=s$(e,i,S),v=r$(a,o,90),w=s$(n,t,S),T):S},T.extentMajor([[-180,-90+Cn],[180,90-Cn]]).extentMinor([[-180,-80-Cn],[180,80+Cn]])}function l6(){return a6()()}function hm(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*$o(So(zD(s-n)+o*l*zD(r-t))),w=an(v),S=v?function(T){var R=an(T*=v)/w,P=an(v-T)/w,C=P*u+R*p,L=P*f+R*x,D=P*a+R*c;return[hs(L,C)*Qi,hs(D,So(C*C+L*L))*Qi]}:function(){return[t*Qi,n*Qi]};return S.distance=v,S}var c6=i=>i;var Y_=1/0,hE=Y_,rv=-Y_,fE=rv,yme={point:vme,lineStart:Jr,lineEnd:Jr,polygonStart:Jr,polygonEnd:Jr,result:function(){var i=[[Y_,hE],[rv,fE]];return rv=fE=-(hE=Y_=1/0),i}};function vme(i,e){i<Y_&&(Y_=i),i>rv&&(rv=i),e<hE&&(hE=e),e>fE&&(fE=e)}var u6=yme;function sv(i){return function(e){var t=new h6;for(var n in i)t[n]=i[n];return t.stream=e,t}}function h6(){}h6.prototype={constructor:h6,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 f6(i,e,t){var n=i.clipExtent&&i.clipExtent();return i.scale(150).translate([0,0]),n!=null&&i.clipExtent(null),zp(t,i.stream(u6)),e(u6.result()),n!=null&&i.clipExtent(n),i}function d6(i,e,t){return f6(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 o$(i,e,t){return d6(i,[[0,0],e],t)}function a$(i,e,t){return f6(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 l$(i,e,t){return f6(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 c$=16,bme=fn(30*mn);function p6(i,e){return+e?Sme(i,e):wme(i)}function wme(i){return sv({point:function(e,t){e=i(e,t),this.stream.point(e[0],e[1])}})}function Sme(i,e){function t(n,r,s,o,a,l,c,u,f,p,x,v,w,S){var T=c-n,R=u-r,P=T*T+R*R;if(P>4*e&&w--){var C=o+p,L=a+x,D=l+v,F=So(C*C+L*L+D*D),N=$o(D/=F),B=ti(ti(D)-1)<Cn||ti(s-f)<Cn?(s+f)/2:hs(L,C),z=i(B,N),V=z[0],H=z[1],K=V-n,J=H-r,j=R*K-T*J;(j*j/P>e||ti((T*K+R*J)/P-.5)>.3||o*p+a*x+l*v<bme)&&(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:R,lineEnd:C,polygonStart:function(){n.polygonStart(),S.lineStart=L},polygonEnd:function(){n.polygonEnd(),S.lineStart=R}};function T(N,B){N=i(N,B),n.point(N[0],N[1])}function R(){f=NaN,S.point=P,n.lineStart()}function P(N,B){var z=sc([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],c$,n),n.point(f,p)}function C(){S.point=T,n.lineEnd()}function L(){R(),S.point=D,S.lineEnd=F}function D(N,B){P(r=N,B),s=f,o=p,a=x,l=v,c=w,S.point=P}function F(){t(f,p,u,x,v,w,s,o,r,a,l,c,c$,n),S.lineEnd=C,C()}return S}}var Tme=sv({point:function(i,e){this.stream.point(i*mn,e*mn)}});function Eme(i){return sv({point:function(e,t){var n=i(e,t);return this.stream.point(n[0],n[1])}})}function Mme(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 u$(i,e,t,n,r,s){if(!s)return Mme(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 A6(i){return Cme(function(){return i})()}function Cme(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=t6,S=null,T,R,P,C=c6,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]*Qi,j[1]*Qi]}V.stream=function(j){return B&&z===j?B:B=Tme(Eme(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=R=P=null,J()):C},V.clipAngle=function(j){return arguments.length?(w=+j?YX(v=j*mn):(v=null,t6),J()):v*Qi},V.clipExtent=function(j){return arguments.length?(C=j==null?(S=T=R=P=null,c6):n6(S=+j[0][0],T=+j[0][1],R=+j[1][0],P=+j[1][1]),J()):S==null?null:[[S,T],[R,P]]},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*Qi,o*Qi]},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*Qi,l*Qi,c*Qi]},V.angle=function(j){return arguments.length?(f=j%360*mn,K()):f*Qi},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=p6(F,L=j*j),J()):So(L)},V.fitExtent=function(j,Z){return d6(V,j,Z)},V.fitSize=function(j,Z){return o$(V,j,Z)},V.fitWidth=function(j,Z){return a$(V,j,Z)},V.fitHeight=function(j,Z){return l$(V,j,Z)};function K(){var j=u$(t,0,0,p,x,f).apply(null,e(s,o)),Z=u$(t,n-j[0],r-j[1],p,x,f);return u=QD(a,l,c),F=nv(e,Z),N=nv(u,F),D=p6(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 h$(i){return function(e,t){var n=So(e*e+t*t),r=i(n),s=an(r),o=fn(r);return[hs(e*s,n*o),$o(n&&t*s/n)]}}function ov(i,e){return[i,yX(bX((to+e)/2))]}ov.invert=function(i,e){return[i,2*W_(xX(e))-to]};function m6(i,e){var t=fn(e),n=1+fn(i)*t;return[t*an(i)/n,an(e)/n]}m6.invert=h$(function(i){return 2*W_(i)});function g6(){return A6(m6).scale(250).clipAngle(142)}function y6(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 y6(i)}function av(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 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=mE(e),Vme(i,m$()?Reflect.construct(e,[],mE(i).constructor):e.apply(i,t))}function A$(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Lme(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function ni(i,e){return i.get(av(i,e))}function qp(i,e,t){A$(i,e),e.set(i,t)}function Hp(i,e,t){return i.set(av(i,e),t),t}function Dme(i,e){A$(i,e),e.add(i)}function Fme(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,_$(n.key),n)}}function Ome(i,e,t){return e&&Fme(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function K_(i,e,t){return(e=_$(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function mE(i){return mE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},mE(i)}function Bme(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&&v6(i,e)}function m$(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(m$=function(){return!!i})()}function Ume(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function kme(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 Gme(){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 zme(){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 Vme(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 v6(i,e){return v6=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},v6(i,e)}function AE(i,e){return Rme(i)||kme(i,e)||x$(i,e)||Gme()}function g$(i){return Pme(i)||Ume(i)||x$(i)||zme()}function qme(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 _$(i){var e=qme(i,"string");return typeof e=="symbol"?e:e+""}function x$(i,e){if(i){if(typeof i=="string")return y6(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)?y6(i,e):void 0}}var y$=function(e){e instanceof Array?e.forEach(y$):(e.map&&e.map.dispose(),e.dispose())},b6=function(e){e.geometry&&e.geometry.dispose(),e.material&&y$(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(b6)};function v$(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 Hme(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 fm(i){return i*Math.PI/180}var b$=function(e){return 1-(ov(0,(.5-e)*Math.PI)[1]/Math.PI+1)/2},_6=function(e){return Math.max(0,Math.min(1,b$(e)))},f$=function(e){return .5-ov.invert(0,(2*(1-e)-1)*Math.PI)[1]/Math.PI},Wme=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=Qa().domain([1,0]).range([t,n]).clamp(!0),s=Qa().domain([_6(t),_6(n)]).range([1,0]).clamp(!0),o=function(f){return s(_6(r(f)))},a=e.array,l=0,c=a.length;l<c;l+=2)a[l+1]=o(a[l+1]);e.needsUpdate=!0},d$=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,b$(a))));var l=Math.floor(a*s);return[o,l]},w6=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,R=u;if(t){T=w===0?w:f$(w/l)*l;var P=w+1===l?w+1:f$((w+1)/l)*l;R=(P-T)*180/l}var C=-180+(x+.5)*c,L=90-(T*180/l+R/2),D=R;a.push({x,y:w,lng:C,lat:L,latLen:D})}return a},jme=6,Xme=7,$me=3,Yme=90,ph=new WeakMap,Wp=new WeakMap,x6=new WeakMap,dE=new WeakMap,oc=new WeakMap,gE=new WeakMap,Z_=new WeakMap,dm=new WeakMap,pE=new WeakSet,w$=(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 Lme(this,e),n=Nme(this,e),Dme(n,pE),qp(n,ph,void 0),qp(n,Wp,void 0),qp(n,x6,void 0),qp(n,dE,void 0),qp(n,oc,{}),qp(n,gE,void 0),qp(n,Z_,void 0),qp(n,dm,void 0),K_(n,"minLevel",void 0),K_(n,"maxLevel",void 0),K_(n,"thresholds",g$(new Array(30)).map(function(p,x){return 8/Math.pow(2,x)})),K_(n,"curvatureResolution",5),K_(n,"tileMargin",0),K_(n,"clearTiles",function(){Object.values(ni(oc,n)).forEach(function(p){p.forEach(function(x){x.obj&&(n.remove(x.obj),b6(x.obj),delete x.obj)})}),Hp(oc,n,{})}),Hp(ph,n,t),n.tileUrl=s,Hp(Wp,n,f),n.minLevel=a,n.maxLevel=c,n.level=0,n.add(Hp(dm,n,new Gn(new _a(ni(ph,n)*.99,180,90),new Kr({color:0})))),ni(dm,n).visible=!1,ni(dm,n).material.polygonOffset=!0,ni(dm,n).material.polygonOffsetUnits=3,ni(dm,n).material.polygonOffsetFactor=1,n}return Bme(e,i),Ome(e,[{key:"tileUrl",get:function(){return ni(x6,this)},set:function(n){Hp(x6,this,n),this.updatePov(ni(Z_,this))}},{key:"level",get:function(){return ni(dE,this)},set:function(n){var r,s=this;ni(oc,this)[n]||av(pE,this,Kme).call(this,n);var o=ni(dE,this);if(Hp(dE,this,n),!(n===o||o===void 0)){if(ni(dm,this).visible=n>0,ni(oc,this)[n].forEach(function(l){return l.obj&&(l.obj.material.depthWrite=!0)}),o<n&&((r=ni(oc,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++)ni(oc,this)[a]&&ni(oc,this)[a].forEach(function(l){l.obj&&(s.remove(l.obj),b6(l.obj),delete l.obj)});av(pE,this,p$).call(this)}}},{key:"updatePov",value:function(n){var r=this;if(!(!n||!(n instanceof Of))){Hp(Z_,this,n);var s;if(Hp(gE,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,R=x+v/2;u.hullPnts=[[x,p],[T,w],[R,w],[T,S],[R,S]].map(function(P){var C=AE(P,2),L=C[0],D=C[1];return v$(L,D,ni(ph,r))}).map(function(P){var C=P.x,L=P.y,D=P.z;return new ie(C,L,D)})}return s||(s=new ec,n.updateMatrix(),n.updateMatrixWorld(),s.setFromProjectionMatrix(new on().multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse))),u.hullPnts.some(function(P){return s.containsPoint(P.clone().applyMatrix4(r.matrixWorld))})}),this.tileUrl){var o=n.position.clone(),a=o.distanceTo(this.getWorldPosition(new ie)),l=(a-ni(ph,this))/ni(ph,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)),av(pE,this,p$).call(this)}}}}])})(br);function Kme(i){var e=this;if(i>Xme){ni(oc,this)[i]=[];return}var t=ni(oc,this)[i]=w6(i,ni(Wp,this));t.forEach(function(n){return n.centroid=v$(n.lat,n.lng,ni(ph,e))}),t.octree=G2().x(function(n){return n.centroid.x}).y(function(n){return n.centroid.y}).z(function(n){return n.centroid.z}).addAll(t)}function p$(){var i=this;if(!(!this.tileUrl||this.level===void 0||!ni(oc,this).hasOwnProperty(this.level))&&!(!ni(gE,this)&&this.level>jme)){var e=ni(oc,this)[this.level];if(ni(Z_,this)){var t=this.worldToLocal(ni(Z_,this).position.clone());if(e.octree){var n,r=this.worldToLocal(ni(Z_,this).position.clone()),s=(r.length()-ni(ph,this))*$me;e=(n=e.octree).findAllWithinRadius.apply(n,g$(r).concat([s]))}else{var o=Hme(t),a=(o.r/ni(ph,this)-1)*Yme,l=a/Math.cos(fm(o.lat)),c=[o.lng-l,o.lng+l],u=[o.lat+a,o.lat-a],f=d$(this.level,ni(Wp,this),c[0],u[0]),p=AE(f,2),x=p[0],v=p[1],w=d$(this.level,ni(Wp,this),c[1],u[1]),S=AE(w,2),T=S[0],R=S[1];!e.record&&(e.record={});var P=e.record;if(!P.hasOwnProperty("".concat(Math.round((x+T)/2),"_").concat(Math.round((v+R)/2))))e=w6(this.level,ni(Wp,this),x,v,T,R).map(function(N){var B="".concat(N.x,"_").concat(N.y);return P.hasOwnProperty(B)?P[B]:(P[B]=N,e.push(N),N)});else{for(var C=[],L=x;L<=T;L++)for(var D=v;D<=R;D++){var F="".concat(L,"_").concat(D);P.hasOwnProperty(F)||(P[F]=w6(this.level,ni(Wp,this),L,D,L,D)[0],e.push(P[F])),C.push(P[F])}e=C}}}e.filter(function(N){return!N.obj}).filter(ni(gE,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=fm(V),ae=fm(-H),ce=new Gn(new _a(ni(ph,i),Math.ceil(j/i.curvatureResolution),Math.ceil(Z/i.curvatureResolution),fm(90-j/2)+ee,fm(j),fm(90-Z/2)+ae,fm(Z)),new xa);if(ni(Wp,i)){var de=[H+K/2,H-K/2].map(function(Ue){return .5-Ue/180}),be=AE(de,2),Ie=be[0],Qe=be[1];Wme(ce.geometry.attributes.uv,Ie,Qe)}N.obj=ce}N.loading||(N.loading=!0,new Ya().load(i.tileUrl(B,z,i.level),function(Ue){var mt=N.obj;mt&&(Ue.colorSpace=vr,mt.material.map=Ue,mt.material.color=null,mt.material.needsUpdate=!0,i.add(mt)),N.loading=!1}))})}}var hv=new Set,S6=!1;function I6(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length;hv.size&&hv.clear();let s=M$(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a=0,l=0,c=0;if(n&&(s=tge(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 T6(s,o,a,l,c),o}function M$(i,e,t,n,r){let s=null;if(r===pge(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=E$(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=E$(o/n|0,i[o],i[o+1],s);return s&&fv(s,s.next)&&(pv(s),s=s.next),s}function Am(i,e=i){let t=e===i,n=i,r;do r=!1,n!==n.next&&(hv.size===0||!hv.has(n))&&(fv(n,n.next)||Ps(n.prev,n,n.next)===0)?((t||n===e)&&(e=n.prev),S6=!0,pv(n),n=n.prev,r=!0):(t||n!==e)&&(n=n.next,r=!t);while(r||n!==e);return e}function T6(i,e,t,n,r){r&&lge(i,t,n,r);let s=i,o=!1;for(;i.prev!==i.next;){let a=i.prev,l=i.next;if(Ps(a,i,l)<0&&(r?Qme(i,t,n,r):Zme(i))){e.push(a.i,i.i,l.i),pv(i),i=l,s=l;continue}if(i=l,i===s){if(S6=!1,i=Am(i),S6){s=i;continue}if(!o){i=Jme(i,e),s=i,o=!0;continue}ege(i,e,t,n,r);break}}}function Zme(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)&&vE(r,a,s,l,o,c,v.x,v.y)&&Ps(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function Qme(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=R6(x,v,e,t,n),R=R6(w,S,e,t,n),P=i.prevZ;for(;P&&P.z>=T;){if(P.x>=x&&P.x<=w&&P.y>=v&&P.y<=S&&P!==o&&!(a===P.x&&u===P.y)&&vE(a,u,l,f,c,p,P.x,P.y)&&Ps(P.prev,P,P.next)>=0)return!1;P=P.prevZ}let C=i.nextZ;for(;C&&C.z<=R;){if(C.x>=x&&C.x<=w&&C.y>=v&&C.y<=S&&C!==o&&!(a===C.x&&u===C.y)&&vE(a,u,l,f,c,p,C.x,C.y)&&Ps(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function Jme(i,e){let t=i,n=!1;do{let r=t.prev,s=t.next.next;P$(r,t,t.next,s,!1)&&dv(r,s)&&dv(s,r)&&(e.push(r.i,t.i,s.i),pv(t),pv(t.next),t=i=s,n=!0),t=t.next}while(t!==i);return n?Am(t):t}function ege(i,e,t,n,r){let s=i;do{let o=s.next.next;for(;o!==s.prev;){if(s.i!==o.i&&hge(s,o)){let a=I$(s,o);s=Am(s,s.next),a=Am(a,a.next),T6(s,e,t,n,r),T6(a,e,t,n,r);return}o=o.next}s=s.next}while(s!==i)}var E6=!1;function tge(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=M$(i,a,l,n,!1);c===c.next&&hv.add(c),r.push(uge(c))}r.sort(nge),rge(i.length/n,e.length),R$(t,t),E6=!0;for(let s=0;s<r.length;s++)t=ige(r[s],t);return E6=!1,Am(t)}function nge(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 ige(i,e){let t=oge(i,e);if(!t)return e;let n=I$(t,i),r=n.next;return R$(t,r.next),Am(n,n.next),Am(t,t.next)}var C$=16,ts=new Float64Array(0),yE=0,M6=[],C6=[];function rge(i,e){let t=Math.ceil((i+2*e)/C$)+e+2;ts.length<t*4&&(ts=new Float64Array(t*4)),yE=0}function R$(i,e){let t=i;do{let n=yE++;M6[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<C$&&t!==e);C6[n]=t;let c=n*4;ts[c]=r,ts[c+1]=s,ts[c+2]=o,ts[c+3]=a}while(t!==e)}function sge(i,e){let t=i.z*4;e.x<ts[t]&&(ts[t]=e.x),e.y<ts[t+1]&&(ts[t+1]=e.y),e.x>ts[t+2]&&(ts[t+2]=e.x),e.y>ts[t+3]&&(ts[t+3]=e.y)}function S$(i){let e=C6[i];for(;e.prev.next!==e;)e=e.next;return C6[i]=e,e}function T$(i){let e=M6[i];for(;e.prev.next!==e;)e=e.next;return M6[i]=e,e}function oge(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(fv(i,t))return t;for(let p=0,x=0;p<yE;p++,x+=4){if(r<ts[x+1]||r>ts[x+3]||ts[x]>n||ts[x+2]<=s)continue;let v=S$(p);t=T$(p);do{if(t.prev.next===t){if(fv(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<yE;p++,x+=4){if(ts[x+2]<a||ts[x]>n||ts[x+3]<c||ts[x+1]>u)continue;let v=S$(p);t=T$(p);do{if(t.prev.next===t&&n>=t.x&&t.x>=a&&n!==t.x&&vE(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);(dv(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&&age(o,t)))&&(o=t,f=w)}t=t.next}while(t!==v)}return o}function age(i,e){return Ps(i.prev,i,e.prev)<0&&Ps(e.next,i,i.next)<0}var ac=[],lv=[],pm=new Uint32Array(0),cv=new Uint32Array(0),uv=new Uint32Array(256);function lge(i,e,t,n){let r=i,s=0;do r.z=R6(r.x,r.y,e,t,n),ac[s++]=r,r=r.next;while(r!==i);cge(s);let o=null;for(let a=0;a<s;a++){let l=ac[a];l.prevZ=o,o&&(o.nextZ=l),o=l}o.nextZ=null}function cge(i){if(i<=32){for(let e=1;e<i;e++){let t=ac[e],n=t.z,r=e-1;for(;r>=0&&ac[r].z>n;)ac[r+1]=ac[r],r--;ac[r+1]=t}return}pm.length<i&&(pm=new Uint32Array(i),cv=new Uint32Array(i),lv=new Array(i));for(let e=0;e<i;e++)pm[e]=ac[e].z;_E(i,ac,pm,lv,cv,0),_E(i,lv,cv,ac,pm,8),_E(i,ac,pm,lv,cv,16),_E(i,lv,cv,ac,pm,24)}function _E(i,e,t,n,r,s){uv.fill(0);for(let a=0;a<i;a++)uv[t[a]>>>s&255]++;let o=0;for(let a=0;a<256;a++){let l=uv[a];uv[a]=o,o+=l}for(let a=0;a<i;a++){let l=t[a],c=uv[l>>>s&255]++;n[c]=e[a],r[c]=l}}function R6(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 uge(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 vE(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 hge(i,e){let t=fv(i,e)&&Ps(i.prev,i,i.next)>0&&Ps(e.prev,e,e.next)>0;return i.next.i!==e.i&&(t||dv(i,e)&&dv(e,i)&&(Ps(i.prev,i,e.prev)!==0||Ps(i,e.prev,e)!==0))&&!fge(i,e)&&(t||dge(i,e))}function Ps(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function fv(i,e){return i.x===e.x&&i.y===e.y}function P$(i,e,t,n,r=!0){let s=Ps(i,e,t),o=Ps(i,e,n),a=Ps(t,n,i),l=Ps(t,n,e);return(s>0&&o<0||s<0&&o>0)&&(a>0&&l<0||a<0&&l>0)?!0:r?!!(s===0&&xE(i,t,e)||o===0&&xE(i,n,e)||a===0&&xE(t,i,n)||l===0&&xE(t,e,n)):!1}function xE(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 fge(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&&P$(o,a,i,e))return!0;o=a}while(o!==i);return!1}function dv(i,e){return Ps(i.prev,i,i.next)<0?Ps(i,e,i.next)>=0&&Ps(i,i.prev,e)>=0:Ps(i,e,i.prev)<0||Ps(i,i.next,e)<0}function dge(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 I$(i,e){let t=P6(i.i,i.x,i.y),n=P6(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 E$(i,e,t,n){let r=P6(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 pv(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),E6&&sge(i.prev,i.next)}function P6(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function pge(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 Q_(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 L6(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 Age(i){if(Array.isArray(i))return i}function mge(i){if(Array.isArray(i))return L6(i)}function gge(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function _ge(i,e,t){return e=bE(e),Mge(i,D$()?Reflect.construct(e,[],bE(i).constructor):e.apply(i,t))}function xge(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function yge(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function vge(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=O6(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 bE(i){return bE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},bE(i)}function bge(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&&D6(i,e)}function D$(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(D$=function(){return!!i})()}function wge(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Sge(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 Tge(){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 Ege(){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 Mge(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 gge(i)}function D6(i,e){return D6=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},D6(i,e)}function Av(i,e){return Age(i)||Sge(i,e)||O6(i,e)||Tge()}function Cge(i){return mge(i)||wge(i)||O6(i)||Ege()}function O6(i,e){if(i){if(typeof i=="string")return L6(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)?L6(i,e):void 0}}var N$=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=el(s,r)*180/Math.PI;if(o>t)for(var a=hm(r,s),l=r.length>2||s.length>2?hh(r[2]||0,s[2]||0):null,c=l?function(p){return[].concat(Cge(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},F6=typeof window<"u"&&window.THREE?window.THREE:{BufferGeometry:qn,Float32BufferAttribute:Rn},Rge=new F6.BufferGeometry().setAttribute?"setAttribute":"addAttribute",B6=(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;xge(this,e),n=_ge(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;mv({indices:a,vertices:l},S),n.addGroup(T,a.length-T,c++)}),a.length&&n.setIndex(a),l.length&&n[Rge]("position",new F6.Float32BufferAttribute(l,3));function u(S,T){var R=N6(S[1],S[0],T+(S[2]||0)),P=[];return[{vertices:R,indices:P}]}function f(S,T){var R={vertices:[],indices:[]};return S.map(function(P){return u(P,T)}).forEach(function(P){var C=Av(P,1),L=C[0];mv(R,L)}),[R]}function p(S,T){for(var R=N$(S,s).map(function(N){var B=Av(N,3),z=B[0],V=B[1],H=B[2],K=H===void 0?0:H;return N6(V,z,T+K)}),P=Q_([R]),C=P.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 R={vertices:[],indices:[]};return S.map(function(P){return p(P,T)}).forEach(function(P){var C=Av(P,1),L=C[0];mv(R,L)}),[R]}function v(S,T){for(var R=S.map(function(j){return N$(j,s).map(function(Z){var ee=Av(Z,3),ae=ee[0],ce=ee[1],de=ee[2],be=de===void 0?0:de;return N6(ce,ae,T+be)})}),P=Q_(R),C=P.vertices,L=P.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 R={vertices:[],indices:[]},P={vertices:[],indices:[]};S.map(function(L){return v(L,T)}).forEach(function(L){var D=Av(L,2),F=D[0],N=D[1];mv(R,F),N&&mv(P,N)});var C=[R];return P.vertices.length&&C.push(P),C}return n}return bge(e,i),yge(e)})(F6.BufferGeometry);function mv(i,e){var t=Math.round(i.vertices.length/3);L$(i.vertices,e.vertices),L$(i.indices,e.indices.map(function(n){return n+t}))}function L$(i,e){var t=vge(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 N6(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 gv={};soe(gv,{computeMikkTSpaceTangents:()=>Pge,computeMorphedAttributes:()=>Uge,deepCloneAttribute:()=>Nge,deinterleaveAttribute:()=>wE,deinterleaveGeometry:()=>Dge,estimateBytesUsed:()=>Fge,interleaveAttributes:()=>Lge,mergeAttributes:()=>U6,mergeGeometries:()=>Ige,mergeGroups:()=>kge,mergeVertices:()=>Oge,toCreasedNormals:()=>Gge,toTrianglesDrawMode:()=>Bge});function Pge(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 Di(s,4)),i!==r&&i.copy(r),i}function Ige(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 qn,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 Di(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 Nge(i){return i.isInstancedInterleavedBufferAttribute||i.isInterleavedBufferAttribute?wE(i):i.isInstancedBufferAttribute?new yl().copy(i):new Di().copy(i)}function Lge(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 Df(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 yo(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 wE(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 yl(s,n,r,i.meshPerAttribute):o=new Di(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 Dge(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,wE(s)),e[r]=n.get(s))}for(let r in t){let s=t[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,wE(s)),t[r]=n.get(s))}}function Fge(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 Oge(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 R=0,P=a.length;R<P;R++){let C=a[R],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 R=0;R<s;R++){let P=n?n.getX(R):R,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]](P)*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](P)),B)for(let Z=0,ee=B.length;Z<ee;Z++)H[Z][j](o,B[Z][J](P))}}t[C]=o,u.push(o),o++}}let T=i.clone();for(let R in i.attributes){let P=l[R];if(T.setAttribute(R,new P.constructor(P.array.slice(0,o*P.itemSize),P.itemSize,P.normalized)),R in c)for(let C=0;C<c[R].length;C++){let L=c[R][C];T.morphAttributes[R][C]=new L.constructor(L.array.slice(0,o*L.itemSize),L.itemSize,L.normalized)}}return T.setIndex(u),T}function Bge(i,e){if(e===wL)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),i;if(e===u3||e===SL){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===u3)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 Uge(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,be,Ie,Qe,Ue,mt,Me){e.fromBufferAttribute(de,Qe),t.fromBufferAttribute(de,Ue),n.fromBufferAttribute(de,mt);let ze=ce.morphTargetInfluences;if(be&&ze){a.set(0,0,0),l.set(0,0,0),c.set(0,0,0);for(let $e=0,Et=be.length;$e<Et;$e++){let Tt=ze[$e],Ct=be[$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,R=f.morphAttributes.position,P=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,R,P,x,v,w,j),u(i,C,L,P,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,R,P,x,v,w,j),u(i,C,L,P,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,R,P,x,v,w,j),u(i,C,L,P,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,R,P,x,v,w,j),u(i,C,L,P,x,v,w,Z);let ee=new Rn(j,3),ae=new Rn(Z,3);return{positionAttribute:T,normalAttribute:C,morphedPositionAttribute:ee,morphedNormalAttribute:ae}}function kge(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 Gge(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,be=Z*de-ee*ce,Ie=ee*ae-j*de,Qe=j*ce-Z*ae,Ue=1/(Math.sqrt(be*be+Ie*Ie+Qe*Qe)||1);c[3*C+0]=be*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),R=S.slice(0,w);for(let C=0;C<l;C++){let L=3*C;T[R[u[L+0]]++]=C,T[R[u[L+1]]++]=C,T[R[u[L+2]]++]=C}let P=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],be=c[ae+2];D*ce+F*de+N*be>o&&(H+=ce,K+=de,J+=be)}let j=1/(Math.sqrt(H*H+K*K+J*J)||1);P[3*z+0]=H*j,P[3*z+1]=K*j,P[3*z+2]=J*j}}return t.setAttribute("normal",new Di(P,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 zge=/^\s+/,Vge=/\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=qge(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=z$(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=O$(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString: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.v*100);return this._a==1?"hsv("+t+", "+n+"%, "+r+"%)":"hsva("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var e=F$(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=F$(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 B$(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return Xge(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(Sr(this._r,255)*100)+"%",g:Math.round(Sr(this._g,255)*100)+"%",b:Math.round(Sr(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(Sr(this._r,255)*100)+"%, "+Math.round(Sr(this._g,255)*100)+"%, "+Math.round(Sr(this._b,255)*100)+"%)":"rgba("+Math.round(Sr(this._r,255)*100)+"%, "+Math.round(Sr(this._g,255)*100)+"%, "+Math.round(Sr(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:s_e[B$(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t="#"+U$(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var s=dn(e);n="#"+U$(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(Zge,arguments)},brighten:function(){return this._applyModification(Qge,arguments)},darken:function(){return this._applyModification(Jge,arguments)},desaturate:function(){return this._applyModification($ge,arguments)},saturate:function(){return this._applyModification(Yge,arguments)},greyscale:function(){return this._applyModification(Kge,arguments)},spin:function(){return this._applyModification(e_e,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(i_e,arguments)},complement:function(){return this._applyCombination(t_e,arguments)},monochromatic:function(){return this._applyCombination(r_e,arguments)},splitcomplement:function(){return this._applyCombination(n_e,arguments)},triad:function(){return this._applyCombination(k$,[3])},tetrad:function(){return this._applyCombination(k$,[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]=_v(i[n]));i=t}return dn(i,e)};function qge(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=c_e(i)),SE(i)=="object"&&(jf(i.r)&&jf(i.g)&&jf(i.b)?(e=Hge(i.r,i.g,i.b),o=!0,a=String(i.r).substr(-1)==="%"?"prgb":"rgb"):jf(i.h)&&jf(i.s)&&jf(i.v)?(n=_v(i.s),r=_v(i.v),e=jge(i.h,n,r),o=!0,a="hsv"):jf(i.h)&&jf(i.s)&&jf(i.l)&&(n=_v(i.s),s=_v(i.l),e=Wge(i.h,n,s),o=!0,a="hsl"),i.hasOwnProperty("a")&&(t=i.a)),t=z$(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 Hge(i,e,t){return{r:Sr(i,255)*255,g:Sr(e,255)*255,b:Sr(t,255)*255}}function F$(i,e,t){i=Sr(i,255),e=Sr(e,255),t=Sr(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 Wge(i,e,t){var n,r,s;i=Sr(i,360),e=Sr(e,100),t=Sr(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 O$(i,e,t){i=Sr(i,255),e=Sr(e,255),t=Sr(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 jge(i,e,t){i=Sr(i,360)*6,e=Sr(e,100),t=Sr(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 B$(i,e,t,n){var r=[eu(Math.round(i).toString(16)),eu(Math.round(e).toString(16)),eu(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 Xge(i,e,t,n,r){var s=[eu(Math.round(i).toString(16)),eu(Math.round(e).toString(16)),eu(Math.round(t).toString(16)),eu(V$(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 U$(i,e,t,n){var r=[eu(V$(n)),eu(Math.round(i).toString(16)),eu(Math.round(e).toString(16)),eu(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 $ge(i,e){e=e===0?0:e||10;var t=dn(i).toHsl();return t.s-=e/100,t.s=TE(t.s),dn(t)}function Yge(i,e){e=e===0?0:e||10;var t=dn(i).toHsl();return t.s+=e/100,t.s=TE(t.s),dn(t)}function Kge(i){return dn(i).desaturate(100)}function Zge(i,e){e=e===0?0:e||10;var t=dn(i).toHsl();return t.l+=e/100,t.l=TE(t.l),dn(t)}function Qge(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 Jge(i,e){e=e===0?0:e||10;var t=dn(i).toHsl();return t.l-=e/100,t.l=TE(t.l),dn(t)}function e_e(i,e){var t=dn(i).toHsl(),n=(t.h+e)%360;return t.h=n<0?360+n:n,dn(t)}function t_e(i){var e=dn(i).toHsl();return e.h=(e.h+180)%360,dn(e)}function k$(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 n_e(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 i_e(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 r_e(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=u_e(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 k6=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"},s_e=dn.hexNames=o_e(k6);function o_e(i){var e={};for(var t in i)i.hasOwnProperty(t)&&(e[i[t]]=t);return e}function z$(i){return i=parseFloat(i),(isNaN(i)||i<0||i>1)&&(i=1),i}function Sr(i,e){a_e(i)&&(i="100%");var t=l_e(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 TE(i){return Math.min(1,Math.max(0,i))}function El(i){return parseInt(i,16)}function a_e(i){return typeof i=="string"&&i.indexOf(".")!=-1&&parseFloat(i)===1}function l_e(i){return typeof i=="string"&&i.indexOf("%")!=-1}function eu(i){return i.length==1?"0"+i:""+i}function _v(i){return i<=1&&(i=i*100+"%"),i}function V$(i){return Math.round(parseFloat(i)*255).toString(16)}function G$(i){return El(i)/255}var Jc=(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 jf(i){return!!Jc.CSS_UNIT.exec(i)}function c_e(i){i=i.replace(zge,"").replace(Vge,"").toLowerCase();var e=!1;if(k6[i])i=k6[i],e=!0;else if(i=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=Jc.rgb.exec(i))?{r:t[1],g:t[2],b:t[3]}:(t=Jc.rgba.exec(i))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=Jc.hsl.exec(i))?{h:t[1],s:t[2],l:t[3]}:(t=Jc.hsla.exec(i))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=Jc.hsv.exec(i))?{h:t[1],s:t[2],v:t[3]}:(t=Jc.hsva.exec(i))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=Jc.hex8.exec(i))?{r:El(t[1]),g:El(t[2]),b:El(t[3]),a:G$(t[4]),format:e?"name":"hex8"}:(t=Jc.hex6.exec(i))?{r:El(t[1]),g:El(t[2]),b:El(t[3]),format:e?"name":"hex"}:(t=Jc.hex4.exec(i))?{r:El(t[1]+""+t[1]),g:El(t[2]+""+t[2]),b:El(t[3]+""+t[3]),a:G$(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=Jc.hex3.exec(i))?{r:El(t[1]+""+t[1]),g:El(t[2]+""+t[2]),b:El(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function u_e(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 q6(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 h_e(i){if(Array.isArray(i))return i}function f_e(i){if(Array.isArray(i))return q6(i)}function q$(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 d_e(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function p_e(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Yo(i,e){return i.get(q$(i,e))}function J_(i,e,t){d_e(i,e),e.set(i,t)}function EE(i,e,t){return i.set(q$(i,e),t),t}function A_e(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,S_e(n.key),n)}}function m_e(i,e,t){return e&&A_e(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function g_e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function __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 x_e(){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 y_e(){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 v_e(i,e){return h_e(i)||__e(i,e)||H$(i,e)||x_e()}function b_e(i){return f_e(i)||g_e(i)||H$(i)||y_e()}function w_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 S_e(i){var e=w_e(i,"string");return typeof e=="symbol"?e:e+""}function H$(i,e){if(i){if(typeof i=="string")return q6(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)?q6(i,e):void 0}}var e1=new WeakMap,xv=new WeakMap,t1=new WeakMap,G6=new WeakMap,z6=new WeakMap,V6=new WeakMap,W$=(function(){function i(){p_e(this,i),J_(this,e1,new Map),J_(this,xv,new Map),J_(this,t1,function(e){return e}),J_(this,G6,function(){return{}}),J_(this,z6,function(){}),J_(this,V6,function(){})}return m_e(i,[{key:"getObj",value:function(t){return Yo(e1,this).get(Yo(t1,this).call(this,t))}},{key:"getData",value:function(t){return Yo(xv,this).get(t)}},{key:"entries",value:function(){return b_e(Yo(xv,this).entries()).map(function(t){var n=v_e(t,2),r=n[0],s=n[1];return[s,r]})}},{key:"id",value:function(t){return EE(t1,this,rt(t)),this}},{key:"onCreateObj",value:function(t){return EE(G6,this,t),this}},{key:"onUpdateObj",value:function(t){return EE(z6,this,t),this}},{key:"onRemoveObj",value:function(t){return EE(V6,this,t),this}},{key:"digest",value:function(t){var n=this;t.filter(function(s){return!Yo(e1,n).has(Yo(t1,n).call(n,s))}).forEach(function(s){var o=Yo(G6,n).call(n,s);Yo(e1,n).set(Yo(t1,n).call(n,s),o),Yo(xv,n).set(o,s)});var r=new Map(t.map(function(s){return[Yo(t1,n).call(n,s),s]}));return Yo(e1,this).forEach(function(s,o){r.has(o)?Yo(z6,n).call(n,s,r.get(o)):(Yo(V6,n).call(n,s,o),Yo(e1,n).delete(o),Yo(xv,n).delete(s))}),this}},{key:"clear",value:function(){return this.digest([]),this}}])})();var eg=aoe(j$(),1);var vi=11102230246251565e-32,Is=134217729,vv=(3+8*vi)*vi;function mm(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 bv(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 T_e=(3+16*vi)*vi,E_e=(2+12*vi)*vi,M_e=(9+64*vi)*vi*vi,n1=ut(4),X$=ut(8),$$=ut(12),Y$=ut(16),Ta=ut(4);function C_e(i,e,t,n,r,s,o){let a,l,c,u,f,p,x,v,w,S,T,R,P,C,L,D,F,N,B=i-r,z=t-r,V=e-s,H=n-s;C=B*H,p=Is*B,x=p-(p-B),v=B-x,p=Is*H,w=p-(p-H),S=H-w,L=v*S-(C-x*w-v*w-x*S),D=V*z,p=Is*V,x=p-(p-V),v=V-x,p=Is*z,w=p-(p-z),S=z-w,F=v*S-(D-x*w-v*w-x*S),T=L-F,f=L-T,n1[0]=L-(T+f)+(f-F),R=C+T,f=R-C,P=C-(R-f)+(T-f),T=P-D,f=P-T,n1[1]=P-(T+f)+(f-D),N=R+T,f=N-R,n1[2]=R-(N-f)+(T-f),n1[3]=N;let K=bv(4,n1),J=E_e*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=M_e*o+vv*Math.abs(K),K+=B*u+H*a-(V*c+z*l),K>=J||-K>=J))return K;C=a*H,p=Is*a,x=p-(p-a),v=a-x,p=Is*H,w=p-(p-H),S=H-w,L=v*S-(C-x*w-v*w-x*S),D=l*z,p=Is*l,x=p-(p-l),v=l-x,p=Is*z,w=p-(p-z),S=z-w,F=v*S-(D-x*w-v*w-x*S),T=L-F,f=L-T,Ta[0]=L-(T+f)+(f-F),R=C+T,f=R-C,P=C-(R-f)+(T-f),T=P-D,f=P-T,Ta[1]=P-(T+f)+(f-D),N=R+T,f=N-R,Ta[2]=R-(N-f)+(T-f),Ta[3]=N;let j=mm(4,n1,4,Ta,X$);C=B*u,p=Is*B,x=p-(p-B),v=B-x,p=Is*u,w=p-(p-u),S=u-w,L=v*S-(C-x*w-v*w-x*S),D=V*c,p=Is*V,x=p-(p-V),v=V-x,p=Is*c,w=p-(p-c),S=c-w,F=v*S-(D-x*w-v*w-x*S),T=L-F,f=L-T,Ta[0]=L-(T+f)+(f-F),R=C+T,f=R-C,P=C-(R-f)+(T-f),T=P-D,f=P-T,Ta[1]=P-(T+f)+(f-D),N=R+T,f=N-R,Ta[2]=R-(N-f)+(T-f),Ta[3]=N;let Z=mm(j,X$,4,Ta,$$);C=a*u,p=Is*a,x=p-(p-a),v=a-x,p=Is*u,w=p-(p-u),S=u-w,L=v*S-(C-x*w-v*w-x*S),D=l*c,p=Is*l,x=p-(p-l),v=l-x,p=Is*c,w=p-(p-c),S=c-w,F=v*S-(D-x*w-v*w-x*S),T=L-F,f=L-T,Ta[0]=L-(T+f)+(f-F),R=C+T,f=R-C,P=C-(R-f)+(T-f),T=P-D,f=P-T,Ta[1]=P-(T+f)+(f-D),N=R+T,f=N-R,Ta[2]=R-(N-f)+(T-f),Ta[3]=N;let ee=mm(Z,$$,4,Ta,Y$);return Y$[ee-1]}function jp(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)>=T_e*c?l:-C_e(i,e,t,n,r,s,c)}var tZe=(7+56*vi)*vi,nZe=(3+28*vi)*vi,iZe=(26+288*vi)*vi*vi,rZe=ut(4),sZe=ut(4),oZe=ut(4),aZe=ut(4),lZe=ut(4),cZe=ut(4),uZe=ut(4),hZe=ut(4),fZe=ut(4),dZe=ut(8),pZe=ut(8),AZe=ut(8),mZe=ut(4),gZe=ut(8),_Ze=ut(8),xZe=ut(16),yZe=ut(12),vZe=ut(192),bZe=ut(192);var TZe=(10+96*vi)*vi,EZe=(4+48*vi)*vi,MZe=(44+576*vi)*vi*vi,CZe=ut(4),RZe=ut(4),PZe=ut(4),IZe=ut(4),NZe=ut(4),LZe=ut(4),DZe=ut(4),FZe=ut(4),OZe=ut(8),BZe=ut(8),UZe=ut(8),kZe=ut(8),GZe=ut(8),zZe=ut(8),VZe=ut(8),qZe=ut(8),HZe=ut(8),WZe=ut(4),jZe=ut(4),XZe=ut(4),$Ze=ut(8),YZe=ut(16),KZe=ut(16),ZZe=ut(16),QZe=ut(32),JZe=ut(32),eQe=ut(48),tQe=ut(64),nQe=ut(1152),iQe=ut(1152);var aQe=(16+224*vi)*vi,lQe=(5+72*vi)*vi,cQe=(71+1408*vi)*vi*vi,uQe=ut(4),hQe=ut(4),fQe=ut(4),dQe=ut(4),pQe=ut(4),AQe=ut(4),mQe=ut(4),gQe=ut(4),_Qe=ut(4),xQe=ut(4),yQe=ut(24),vQe=ut(24),bQe=ut(24),wQe=ut(24),SQe=ut(24),TQe=ut(24),EQe=ut(24),MQe=ut(24),CQe=ut(24),RQe=ut(24),PQe=ut(1152),IQe=ut(1152),NQe=ut(1152),LQe=ut(1152),DQe=ut(1152),FQe=ut(2304),OQe=ut(2304),BQe=ut(3456),UQe=ut(5760),kQe=ut(8),GQe=ut(8),zQe=ut(8),VQe=ut(16),qQe=ut(24),HQe=ut(48),WQe=ut(48),jQe=ut(96),XQe=ut(192),$Qe=ut(384),YQe=ut(384),KQe=ut(384),ZQe=ut(768);var QQe=ut(96),JQe=ut(96),eJe=ut(96),tJe=ut(1152);var Z$=Math.pow(2,-52),ME=new Uint32Array(512),Xp=class i{static from(e,t=D_e,n=F_e){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=W6(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=W6(S,T,e[2*B],e[2*B+1]);V<z&&V>0&&(v=B,z=V)}let R=e[2*v],P=e[2*v+1],C=1/0;for(let B=0;B<o;B++){if(B===x||B===v)continue;let z=N_e(S,T,R,P,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];i1(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(jp(S,T,R,P,L,D)<0){let B=v,z=R,V=P;v=w,R=L,P=D,w=B,L=z,D=V}let F=L_e(S,T,R,P,L,D);this._cx=F.x,this._cy=F.y;for(let B=0;B<o;B++)this._dists[B]=W6(e[2*B],e[2*B+1],F.x,F.y);i1(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(R,P)]=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)<=Z$&&Math.abs(J-V)<=Z$||(z=K,V=J,H===x||H===v||H===w))continue;let j=0;for(let de=0,be=this._hashKey(K,J);de<this._hashSize&&(j=s[(be+de)%this._hashSize],!(j!==-1&&j!==n[j]));de++);j=t[j];let Z=j,ee;for(;ee=n[Z],jp(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],jp(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],jp(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(P_e(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=ME[--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(I_e(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 P=this._hullStart;do{if(this._hullTri[P]===f){this._hullTri[P]=e;break}P=this._hullPrev[P]}while(P!==this._hullStart)}this._link(e,T),this._link(a,n[o]),this._link(o,f);let R=c+(a+1)%3;s<ME.length&&(ME[s++]=R)}else{if(s===0)break;e=ME[--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 P_e(i,e){let t=i/(Math.abs(i)+Math.abs(e));return(e>0?3-t:1+t)/4}function W6(i,e,t,n){let r=i-t,s=e-n;return r*r+s*s}function I_e(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 N_e(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 L_e(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 i1(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;wv(i,r,s),e[i[t]]>e[i[n]]&&wv(i,t,n),e[i[s]]>e[i[n]]&&wv(i,s,n),e[i[t]]>e[i[s]]&&wv(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;wv(i,s,o)}i[t+1]=i[o],i[o]=a,n-s+1>=o-t?(i1(i,e,s,n),i1(i,e,t,o-1)):(i1(i,e,t,o-1),i1(i,e,s,n))}}function wv(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function D_e(i){return i[0]}function F_e(i){return i[1]}function Q$(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=jp(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 J$(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 eY(i){return i.type==="Feature"?i.geometry:i}function O_e(i,e,t={}){if(!i)throw new Error("point is required");if(!e)throw new Error("polygon is required");let n=J$(i),r=eY(e),s=r.type,o=e.bbox,a=r.coordinates;if(o&&B_e(n,o)===!1)return!1;s==="Polygon"&&(a=[a]);let l=!1;for(var c=0;c<a.length;++c){let u=Q$(n,a[c]);if(u===0)return!t.ignoreBoundary;u&&(l=!0)}return l}function B_e(i,e){return e[0]<=i[0]&&e[1]<=i[1]&&e[2]>=i[0]&&e[3]>=i[1]}var tY=O_e;var lc=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 $p=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 Sv=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,R,P;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);R=(F+V)/2-ae*Z,P=(N+H)/2+ae*j}else{let ae=1/ee,ce=K*K+J*J,de=j*j+Z*Z;R=F+(Z*ce-J*de)*ae,P=N+(K*de-j*ce)*ae}a[S]=R,a[S+1]=P}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 lc: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],R=o[v+1];this._renderSegment(w,S,T,R,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 lc: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 lc: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 $p;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,R;if(c===0){if((v=this._clipSegment(s,o,a,l,c,u))===null)continue;[w,S,T,R]=v}else{if((v=this._clipSegment(a,l,s,o,u,c))===null)continue;[T,R,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,R),f&&p&&this._edge(e,f,p,r,r.length),r?r.push(T,R):r=[T,R]}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 U_e=2*Math.PI,r1=Math.pow;function k_e(i){return i[0]}function G_e(i){return i[1]}function z_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 V_e(i,e,t){return[i+Math.sin(i+e)*t,e+Math.cos(i-e)*t]}var s1=class i{static from(e,t=k_e,n=G_e,r){return new i("length"in e?q_e(e,t,n,r):Float64Array.from(H_e(e,t,n,r)))}constructor(e){this._delaunator=new Xp(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&&z_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=V_e(t[2*p],t[2*p+1],f);t[2*p]=v[0],t[2*p+1]=v[1]}this._delaunator=new Xp(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 Sv(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=r1(t-c[e*2],2)+r1(n-c[e*2+1],2),p=r[e],x=p;do{let v=l[x],w=r1(t-c[v*2],2)+r1(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&&r1(t-c[x*2],2)+r1(n-c[x*2+1],2)<f)return x;break}}while(x!==p);return u}render(e){let t=e==null?e=new lc: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 lc: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,U_e)}return n&&n.value()}renderHull(e){let t=e==null?e=new lc: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 $p;return this.renderHull(e),e.value()}renderTriangle(e,t){let n=t==null?t=new lc: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 $p;return this.renderTriangle(e,t),t.value()}};function q_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*H_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 Tv=Math.PI,nY=Tv/2,FJe=Tv/4,OJe=Tv*2,j6=180/Tv,X6=Tv/180;var $6=Math.atan2,CE=Math.cos;var iY=Math.max,rY=Math.min;var RE=Math.sin,sY=Math.sign||function(i){return i>0?1:i<0?-1:0},PE=Math.sqrt;function Y6(i){return i>1?nY:i<-1?-nY:Math.asin(i)}function K6(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function tl(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 Ev(i,e){return[i[0]+e[0],i[1]+e[1],i[2]+e[2]]}function Mv(i){var e=PE(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);return[i[0]/e,i[1]/e,i[2]/e]}function Z6(i){return[$6(i[1],i[0])*j6,Y6(iY(-1,rY(1,i[2])))*j6]}function Ah(i){let e=i[0]*X6,t=i[1]*X6,n=CE(t);return[n*CE(e),n*RE(e),RE(t)]}function IE(i){return i=i.map(e=>Ah(e)),K6(i[0],tl(i[2],i[1]))}function aY(i){let e=j_e(i),t=$_e(e),n=X_e(t,i),r=K_e(t,i.length),s=W_e(r,i),o=Y_e(t,i),{polygons:a,centers:l}=Z_e(o,t,i),c=Q_e(a),u=e1e(t,i),f=J_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 W_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=Ah([r,s]);do a=o,o=null,l=t(u,Ah(e[a])),i[a].forEach(f=>{let p=t(u,Ah(e[f]));if(p<l){l=p,o=f,c=f;return}});while(o!==null);return c}}function j_e(i){if(i.length<2)return{};let e=0;for(;isNaN(i[e][0]+i[e][1])&&e++<i.length;);let t=JD(i[e]),n=g6().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*PE(s);r.forEach(p=>i[p]=[o,0]),i.push([0,o]),i.push([-o,0]),i.push([0,-o]);let a=s1.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 X_e(i,e){let t=new Set;return e.length===2?[[0,1]]:(i.forEach(n=>{if(n[0]!==n[1]&&!(IE(n.map(r=>e[r]))<0))for(let r=0,s;r<3;r++)s=(r+1)%3,t.add(kp([n[r],n[s]]).join("-"))}),Array.from(t,n=>n.split("-").map(Number)))}function $_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 Y_e(i,e){return i.map(t=>{let n=t.map(s=>e[s]).map(Ah),r=Ev(Ev(tl(n[1],n[0]),tl(n[2],n[1])),tl(n[0],n[2]));return Z6(Mv(r))})}function K_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 Z_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=Ah(t[0]),l=Ah(t[1]),c=Mv(Ev(a,l)),u=Mv(tl(a,l)),f=tl(c,u),p=[c,tl(c,f),tl(tl(c,f),f),tl(tl(tl(c,f),f),f)].map(Z6).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=oY(t[a[0][3][0]],t[a[0][3][1]],r[l[0]]),f=oY(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 oY(i,e,t){i=Ah(i),e=Ah(e),t=Ah(t);let n=sY(K6(tl(e,i),t));return Z6(Mv(Ev(i,e)).map(r=>n*r))}function Q_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 J_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=kp([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 e1e(i,e){let t=new Set,n=[];i.map(a=>{if(!(IE(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 Q6(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=aY(e.points)}return e};return e._vx=function(t){if(typeof t=="object"&&"type"in t)return tE(t)[0];if(0 in t)return t[0]},e._vy=function(t){if(typeof t=="object"&&"type"in t)return tE(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=>IE(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=>el(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||el([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 e8(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 t1e(i){if(Array.isArray(i))return i}function n1e(i){if(Array.isArray(i))return e8(i)}function i1e(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function r1e(i,e,t){return e=LE(e),f1e(i,cY()?Reflect.construct(e,[],LE(i).constructor):e.apply(i,t))}function s1e(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function o1e(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function LE(i){return LE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},LE(i)}function a1e(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&&t8(i,e)}function cY(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(cY=function(){return!!i})()}function l1e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function c1e(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 u1e(){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 h1e(){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 f1e(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 i1e(i)}function t8(i,e){return t8=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},t8(i,e)}function mh(i,e){return t1e(i)||c1e(i,e)||uY(i,e)||u1e()}function J6(i){return n1e(i)||l1e(i)||uY(i)||h1e()}function uY(i,e){if(i){if(typeof i=="string")return e8(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)?e8(i,e):void 0}}function d1e(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.resolution,n=t===void 0?1/0:t,r=p1e(i,n),s=ch(r),o=A1e(i,n),a=[].concat(J6(s),J6(o)),l={type:"Polygon",coordinates:i},c=X3(l),u=mh(c,2),f=mh(u[0],2),p=f[0],x=f[1],v=mh(u[1],2),w=v[0],S=v[1],T=p>w||S>=89||x<=-89,R=[];if(T){var P=Q6(a).triangles(),C=new Map(a.map(function(ee,ae){var ce=mh(ee,2),de=ce[0],be=ce[1];return["".concat(de,"-").concat(be),ae]}));P.features.forEach(function(ee){var ae,ce=ee.geometry.coordinates[0].slice(0,3).reverse(),de=[];if(ce.forEach(function(Ie){var Qe=mh(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 be=ee.properties.circumcenter;if(!n8(be,l,T))return}(ae=R).push.apply(ae,de)}})}else if(o.length)for(var B=Xp.from(a),z=function(ae){var ce,de=[2,1,0].map(function(Qe){return B.triangles[ae+Qe]}),be=de.map(function(Qe){return a[Qe]});if(de.some(function(Qe){return Qe<s.length})){var Ie=[0,1].map(function(Qe){return R3(be,function(Ue){return Ue[Qe]})});if(!n8(Ie,l,T))return 1}(ce=R).push.apply(ce,J6(de))},V=0,H=B.triangles.length;V<H;V+=3)z(V);else{var L=Q_(r),D=L.vertices,F=L.holes,N=F===void 0?[]:F;R=I6(D,N,2)}var K=Qa(kp(a,function(ee){return ee[0]}),[0,1]),J=Qa(kp(a,function(ee){return ee[1]}),[0,1]),j=a.map(function(ee){var ae=mh(ee,2),ce=ae[0],de=ae[1];return[K(ce),J(de)]}),Z={points:a,indices:R,uvs:j};return{contour:r,triangles:Z}}function p1e(i,e){return i.map(function(t){var n=[],r;return t.forEach(function(s){if(r){var o=el(s,r)*180/Math.PI;if(o>e)for(var a=hm(r,s),l=1/Math.ceil(o/e),c=l;c<1;)n.push(a(c)),c+=l}n.push(r=s)}),n})}function A1e(i,e){var t={type:"Polygon",coordinates:i},n=X3(t),r=mh(n,2),s=mh(r[0],2),o=s[0],a=s[1],l=mh(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 m1e(e,{minLng:o,maxLng:c,minLat:a,maxLat:u}).filter(function(p){return n8(p,t,f)})}function m1e(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 n8(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return t?o6(e,i):tY(i,e)}var NE=window.THREE?window.THREE:{BufferGeometry:qn,Float32BufferAttribute:Rn},lY=new NE.BufferGeometry().setAttribute?"setAttribute":"addAttribute",DE=(function(i){function e(t,n,r,s,o,a,l){var c;s1e(this,e),c=r1e(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=d1e(t,{resolution:l}),f=u.contour,p=u.triangles,x=ch(p.uvs),v=[],w=[],S=[],T=0,R=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&&R(C()),s&&R(L(n,!1)),o&&R(L(r,!0)),c.setIndex(S),c[lY]("position",new NE.Float32BufferAttribute(v,3)),c[lY]("uv",new NE.Float32BufferAttribute(w,2)),c.computeVertexNormals();function P(D,F){var N=typeof F=="function"?F:function(){return F},B=D.map(function(z){return z.map(function(V){var H=mh(V,2),K=H[0],J=H[1];return g1e(J,K,N(K,J))})});return Q_(B)}function C(){for(var D=P(f,n),F=D.vertices,N=D.holes,B=P(f,r),z=B.vertices,V=ch([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 be=0;be<H;be+=1)ce.push(be/(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:P([p.points],D).vertices,uvs:x}}return c}return a1e(e,i),o1e(e)})(NE.BufferGeometry);function g1e(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 i8(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 _1e(i){if(Array.isArray(i))return i}function x1e(i){if(Array.isArray(i))return i8(i)}function y1e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function v1e(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 b1e(){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 w1e(){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 S1e(i,e){if(i==null)return{};var t,n,r=T1e(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 T1e(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 E1e(i,e){return _1e(i)||v1e(i,e)||hY(i,e)||b1e()}function M1e(i){return x1e(i)||y1e(i)||hY(i)||w1e()}function C1e(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 R1e(i){var e=C1e(i,"string");return typeof e=="symbol"?e:e+""}function hY(i,e){if(i){if(typeof i=="string")return i8(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)?i8(i,e):void 0}}var fY=(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],R=S1e(S,[x].map(R1e));w=T,u=R}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=E1e(u,2),p=f[0],x=f[1];return a(x,[].concat(M1e(c),[p]))})})(s),e instanceof Array&&e.length===0&&o.length===1&&(o[0].keys=[])),o});var fi=(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 wi=wt(nt);if(wi){It(wi.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":be[Ne>>3]=nt;break;default:N0("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 be[Ne>>3];default:N0("invalid type for getValue: "+nt)}return null}var S=!1;function T(Ne,nt){Ne||N0("Assertion failed: "+nt)}function R(Ne){var nt=e["_"+Ne];return T(nt,"Cannot call unknown function "+Ne+", make sure it is exported"),nt}function P(Ne,nt,It,He,h){var $i={string:function(Jn){var Ni=0;if(Jn!=null&&Jn!==0){var Jb=(Jn.length<<2)+1;Ni=g9(Jb),B(Jn,Ni,Jb)}return Ni},array:function(Jn){var Ni=g9(Jn.length);return V(Jn,Ni),Ni}};function wi(Jn){return nt==="string"?F(Jn):nt==="boolean"?!!Jn:Jn}var ne=R(Ne),Yi=[],Ba=0;if(He)for(var Xs=0;Xs<He.length;Xs++){var Fs=$i[It[Xs]];Fs?(Ba===0&&(Ba=pre()),Yi[Xs]=Fs(He[Xs])):Yi[Xs]=He[Xs]}var os=ne.apply(null,Yi);return os=wi(os),Ba!==0&&dre(Ba),os}function C(Ne,nt,It,He){It=It||[];var h=It.every(function(wi){return wi==="number"}),$i=nt!=="string";return $i&&h&&!He?R(Ne):function(){return P(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 $i="";nt<h;){var wi=Ne[nt++];if(!(wi&128)){$i+=String.fromCharCode(wi);continue}var ne=Ne[nt++]&63;if((wi&224)==192){$i+=String.fromCharCode((wi&31)<<6|ne);continue}var Yi=Ne[nt++]&63;if((wi&240)==224?wi=(wi&15)<<12|ne<<6|Yi:wi=(wi&7)<<18|ne<<12|Yi<<6|Ne[nt++]&63,wi<65536)$i+=String.fromCharCode(wi);else{var Ba=wi-65536;$i+=String.fromCharCode(55296|Ba>>10,56320|Ba&1023)}}return $i}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,$i=It+He-1,wi=0;wi<Ne.length;++wi){var ne=Ne.charCodeAt(wi);if(ne>=55296&&ne<=57343){var Yi=Ne.charCodeAt(++wi);ne=65536+((ne&1023)<<10)|Yi&1023}if(ne<=127){if(It>=$i)break;nt[It++]=ne}else if(ne<=2047){if(It+1>=$i)break;nt[It++]=192|ne>>6,nt[It++]=128|ne&63}else if(ne<=65535){if(It+2>=$i)break;nt[It++]=224|ne>>12,nt[It++]=128|ne>>6&63,nt[It++]=128|ne&63}else{if(It+3>=$i)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,be;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=be=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 pi(Ne){Qt++,e.monitorRunDependencies&&e.monitorRunDependencies(Qt)}function Bn(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){N0("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){N0("OOM")}function Pn(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,$i=Math.max(nt,h);$i<Ne;)$i<=536870912?$i=H(2*$i,It):$i=Math.min(H((3*$i+2147483648)/4,It),He);var wi=Pn($i);return!!wi}var bt=typeof atob=="function"?atob:function(Ne){var nt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",It="",He,h,$i,wi,ne,Yi,Ba,Xs=0;Ne=Ne.replace(/[^A-Za-z0-9\+\/\=]/g,"");do wi=nt.indexOf(Ne.charAt(Xs++)),ne=nt.indexOf(Ne.charAt(Xs++)),Yi=nt.indexOf(Ne.charAt(Xs++)),Ba=nt.indexOf(Ne.charAt(Xs++)),He=wi<<2|ne>>4,h=(ne&15)<<4|Yi>>2,$i=(Yi&3)<<6|Ba,It=It+String.fromCharCode(He),Yi!==64&&(It=It+String.fromCharCode(h)),Ba!==64&&(It=It+String.fromCharCode($i));while(Xs<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:N0,b:f,c:p,d:en,e:cn,f:Pt,g:Mt,h:xe,i:yn,j:St,k:qe,l:Pn,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),$i=new Ne.Uint8Array(It),wi=new Ne.Float32Array(It),ne=new Ne.Float64Array(It),Yi=nt.o|0,Ba=nt.p|0,Xs=Ne.Math.floor,Fs=Ne.Math.abs,os=Ne.Math.sqrt,Jn=Ne.Math.cos,Ni=Ne.Math.sin,Jb=Ne.Math.tan,Are=Ne.Math.acos,ux=Ne.Math.asin,v9=Ne.Math.atan,oa=Ne.Math.atan2,sg=Ne.Math.ceil,Ua=Ne.Math.imul,C4=Ne.Math.min,mre=Ne.Math.max,Jh=Ne.Math.clz32,gre=nt.a,Dn=nt.b,Q=nt.c,ci=nt.d,b9=nt.e,_re=nt.f,xre=nt.g,yre=nt.h,vre=nt.i,Y=28416;function bre(d){return He=new Int8Array(d),$i=new Uint8Array(d),h=new Int32Array(d),wi=new Float32Array(d),ne=new Float64Array(d),It=d,!0}function wre(d){d=d|0;var A=0;return A=Y,Y=Y+d|0,Y=Y+15&-16,A|0}function Sre(){return Y|0}function Tre(d){d=d|0,Y=d}function Ere(d,A){d=d|0,A=A|0,Y=d}function Mre(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=iw(15,A)|0,A|0):(m=((d|0)<0)<<31>>31,g=ur(d|0,m|0,3,0)|0,_=Q()|0,m=pt(d|0,m|0,1,0)|0,m=ur(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 w9(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,S9(d,A,m,_,0)|0}function S9(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,!(T9(d,A,m,_,g)|0))return _=0,Y=M,_|0;do if((m|0)>=0){if((m|0)>13780509){if(y=iw(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=ur(m|0,y|0,3,0)|0,E=Q()|0,y=pt(m|0,y|0,1,0)|0,y=ur(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(dd(_|0,0,b<<3|0)|0,g|0){dd(g|0,0,b<<2|0)|0,y=gu(d,A,m,_,g,b,E,0)|0;break}y=aa(b,4)|0,y?(I=gu(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 T9(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),Gi(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=Os(y,A,4,$,W)|0,y|0)break e;if(A=W,y=h[A>>2]|0,A=h[A+4>>2]|0,Gi(y,A)|0){y=9;break e}}if(y=Os(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,Gi(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=Os(y,A,4,$,W)|0,y|0)break e;if(A=W,y=h[A>>2]|0,A=h[A+4>>2]|0,Gi(y,A)|0){y=9;break e}}if(y=Os(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,Gi(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 gu(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=ef(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=fd(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=Os(d,A,2,W,$)|0,M|0){case 9:{q=9;break}case 0:{M=$,M=gu(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=Os(d,A,3,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=gu(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=Os(d,A,1,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=gu(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=Os(d,A,5,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=gu(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=Os(d,A,4,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=gu(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=Os(d,A,6,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=gu(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 Os(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=ka(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($=(Vl(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=L0($|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(lr(E)|0){t:do if((ka(d,A)|0)==1){if((O|0)!=(E|0))if(R9(E,h[7696+(O*28|0)>>2]|0)|0){d=G4(d,A)|0,b=1,A=Q()|0;break}else ci(27634,26928,533,26936);switch(M|0){case 3:{d=L0(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=k4(d,A)|0,A=Q()|0,y=y+1|0;while((y|0)!=(m|0))}if((O|0)!=(E|0)){if(!(R4(E)|0)){if((b|0)!=0|(ka(d,A)|0)!=5)break;h[_>>2]=(h[_>>2]|0)+1;break}switch(G&127){case 8:case 118:break e;default:}(ka(d,A)|0)!=3&&(h[_>>2]=(h[_>>2]|0)+1)}}else if((m|0)>0){y=0;do d=L0(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 Cre(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,E9(d,A,m,_)|0?(dd(_|0,0,m*48|0)|0,_=Rre(d,A,m,_)|0,_|0):(_=0,_|0)}function E9(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(Gi(d,A)|0)d=9;else{g=0,G=d;do{if(d=Os(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,Gi(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=Os(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,!(Gi(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=Os(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,Gi(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 Rre(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=iw(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=ur(m|0,g|0,3,0)|0,y=Q()|0,g=pt(m|0,g|0,1,0)|0,g=ur(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=aa(g,8)|0,!I)g=13;else{if(O=aa(g,4)|0,!O){_t(I),g=13;break}if(g=gu(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 ew(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=(Gi(d,A)|0)==0,g=g?1:2;;){if(h[b>>2]=0,I=(Os(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 Pre(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=_x(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,X9(y,g),m=L9(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 M9(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,we=0,me=0,Fe=0,Ke=0,Ee=0,ve=0,At=0,We=0,Ot=0,at=0,dt=0,ui=0,gi=0,lo=0,Un=0,_i=0,la=0;if(gi=Y,Y=Y+64|0,Ot=gi+48|0,at=gi+32|0,dt=gi+24|0,Fe=gi+8|0,Ke=gi,M=h[d>>2]|0,(M|0)<=0)return ui=0,Y=gi,ui|0;for(Ee=d+4|0,ve=Ot+8|0,At=at+8|0,We=Fe+8|0,E=0,we=0;;){I=h[Ee>>2]|0,re=I+(we<<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],(we|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+(we+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=Wre(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(Un=1/(+(I>>>0)+4294967296*+(M|0)),la=+ne[Ot>>3],M=Bs(I|0,M|0,_e|0,re|0)|0,_i=+(M>>>0)+4294967296*+(Q()|0),lo=+(_e>>>0)+4294967296*+(re|0),ne[Fe>>3]=Un*(la*_i)+Un*(+ne[at>>3]*lo),ne[We>>3]=Un*(+ne[ve>>3]*_i)+Un*(+ne[At>>3]*lo),M=z4(Fe,_,Ke)|0,M|0){E=M;break}ue=Ke,oe=h[ue>>2]|0,ue=h[ue+4>>2]|0,q=ef(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,ui=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=fd(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,ui=16;break}}while(!1);if((ui|0)==16&&(ui=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(we=we+1|0,!I){ui=21;break}if(M=h[d>>2]|0,(we|0)>=(M|0)){E=0,ui=21;break}}return(ui|0)==21?(Y=gi,E|0):0}function Ire(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,we=0,me=0,Fe=0,Ke=0,Ee=0,ve=0,At=0,We=0,Ot=0,at=0,dt=0,ui=0,gi=0,lo=0,Un=0,_i=0;if(_i=Y,Y=Y+112|0,ui=_i+80|0,M=_i+72|0,gi=_i,lo=_i+56|0,g=_x(m)|0,g|0)return Un=g,Y=_i,Un|0;if(I=d+8|0,Un=cr((h[I>>2]<<5)+32|0)|0,!Un)return Un=13,Y=_i,Un|0;if($4(d,Un),g=_x(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,X9(M,ui),g=L9(ui,A,gi)|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=gi,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=gi,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=gi,h[g>>2]=at,h[g+4>>2]=dt,g=0}if(!g){if(m=aa(at,8)|0,!m)return _t(Un),Un=13,Y=_i,Un|0;if(E=aa(at,8)|0,!E)return _t(Un),_t(m),Un=13,Y=_i,Un|0;We=ui,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=M9(M,at,dt,A,ui,m,E)|0;e:do if(g)_t(m),_t(E),_t(Un);else{t:do if((h[I>>2]|0)>0){for(b=d+12|0,y=0;g=M9((h[b>>2]|0)+(y<<3)|0,at,dt,A,ui,m,E)|0,y=y+1|0,!(g|0);)if((y|0)>=(h[I>>2]|0))break t;_t(m),_t(E),_t(Un);break e}while(!1);(dt|0)>0|(dt|0)==0&at>>>0>0&&dd(E|0,0,at<<3|0)|0,Ot=ui,We=h[Ot+4>>2]|0;t:do if((We|0)>0|(We|0)==0&(h[Ot>>2]|0)>>>0>0){Ee=m,ve=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,we=0,y=0,b=0;;){E=gi,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,T9(I,A,1,gi,0)|0){E=gi,M=E+56|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));E=aa(7,4)|0,E|0&&(gu(I,A,1,gi,E,7,0,0)|0,_t(E))}for(oe=0;;){$=gi+(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=ef(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=fd(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}lg(W,$,lo)|0,Y4(d,Un,lo)|0&&(q=pt(y|0,b|0,1,0)|0,b=Q()|0,G=E,h[G>>2]=W,h[G+4>>2]=$,y=ve+(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,we|0,1,0)|0,we=Q()|0,b=ui,y=h[b>>2]|0,b=h[b+4>>2]|0,(we|0)<(b|0)|(we|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 we=Ee+(y<<3)|0,h[we>>2]=0,h[we+4>>2]=0,y=pt(y|0,b|0,1,0)|0,b=Q()|0,we=ui,re=h[we+4>>2]|0;while((b|0)<(re|0)|((b|0)==(re|0)?y>>>0<(h[we>>2]|0)>>>0:0))}if(we=ui,h[we>>2]=E,h[we+4>>2]=M,(M|0)>0|(M|0)==0&E>>>0>0)oe=m,ue=Ke,_e=Ot,re=Fe,we=ve,m=me,Ke=g,Fe=At,me=oe,g=ue,Ot=We,We=_e,At=re,ve=Ee,Ee=we;else break t}_t(At),_t(We),_t(Un),g=1;break e}else g=E;while(!1);_t(Un),_t(m),_t(g),g=0}while(!1);return Un=g,Y=_i,Un|0}}return _t(Un),Un=g,Y=_i,Un|0}function Nre(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=Xre(d,A,((A|0)<0)<<31>>31,b)|0,d|0)return b=d,Y=E,b|0;if(y=Cse(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 zl(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=+Ni(+E)*+Ni(+g),_=+ne[y+(d<<4)+8>>3]-+ne[y+8>>3],m=+oa(+(+Ni(+_)*m),+(+Jn(+E)*+Jn(+g)+ +Jn(+_)*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,_=+Ni(+I)*+Ni(+M),E=+ne[y+(G<<4)+8>>3]-+ne[y+(O<<4)+8>>3],m=+oa(+(+Ni(+E)*_),+(+Jn(+I)*+Jn(+M)+ +Jn(+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 Lre(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=D0(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],zl(_,m)|0,y=0,Y=b,y|0)}function Dre(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=D0(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],zl(_,m)|0,ne[m>>3]=+ne[m>>3]*4058973249931477e-8,y=0,Y=b,y|0)}function Fre(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=D0(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],zl(_,m)|0,ne[m>>3]=+ne[m>>3]*4058973249931477e-8*1e6,y=0,Y=b,y|0)}function lr(d){return d=d|0,d>>>0>121?(d=0,d|0):(d=h[7696+(d*28|0)+16>>2]|0,d|0)}function R4(d){return d=d|0,(d|0)==4|(d|0)==117|0}function C9(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 Ore(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 Bre(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 Ure(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 R9(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 P4(d,A){return d=d|0,A=A|0,h[848+(d*28|0)+(A<<2)>>2]|0}function I4(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 kre(){return 122}function Gre(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 zre(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 Vre(d){return d=d|0,+ne[d+16>>3]<+ne[d+24>>3]|0}function qre(d){return d=d|0,+(+ne[d>>3]-+ne[d+8>>3])}function P9(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 N4(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=+fl(y,d),y<+fl(+ne[g>>3],A)||(O=+fl(+ne[m>>3],d),O>+fl(+ne[_>>3],A))?(E=0,E|0):(E=1,E|0))}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;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 I9(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=+fl(y,d),y<=+fl(+ne[g>>3],A)?(O=+fl(+ne[_>>3],d),E=O>=+fl(+ne[m>>3],A),E|0):(E=0,E|0))}function N9(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));bc(d|0,_|0,168)|0,Y=g}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,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=q4(A,I)|0,A|0?(W=A,Y=$,W|0):(M=I,I=h[M>>2]|0,M=h[M+4>>2]|0,lg(I,M,O)|0,D0(I,M,G)|0,b=+Ax(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=+Ax(O,G),ue=+ne[M>>3]-+ne[I>>3],y=+Fs(+ue),oe=+ne[O>>3]-+ne[G>>3],_=+Fs(+oe),!(ue==0|oe==0)&&(ue=+oG(+y,+_),ue=+sg(+(g*g/+uw(+(ue/+uw(+y,+_)),3)/(b*(b*2.59807621135)*.8))),ne[Yi>>3]=ue,q=~~ue>>>0,W=+Fs(ue)>=1?ue>0?~~+C4(+Xs(ue/4294967296),4294967295)>>>0:~~+sg((ue-+(~~ue>>>0))/4294967296)>>>0:0,(h[Yi+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 Wre(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=q4(m,M)|0,m|0?(_=m,Y=I,_|0):(m=M,g=h[m>>2]|0,m=h[m+4>>2]|0,lg(g,m,b)|0,D0(g,m,E)|0,O=+Ax(b,E+8|0),O=+sg(+(+Ax(d,A)/(O*2))),ne[Yi>>3]=O,m=~~O>>>0,g=+Fs(O)>=1?O>0?~~+C4(+Xs(O/4294967296),4294967295)>>>0:~~+sg((O-+(~~O>>>0))/4294967296)>>>0:0,(h[Yi+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 jre(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 Xre(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,we=0,me=0,Fe=0,Ke=0,Ee=0,ve=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=O4(h[g>>2]|0,h[g+4>>2]|0)|0,b=0,E=0;;){if(y=d+(b<<3)|0,at=y,!(nw(h[at>>2]|0,h[at+4>>2]|0)|0)){g=5,We=159;break}if(at=y,at=(O4(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=cr(g)|0,!b)return at=13,Y=dt,at|0;for(bc(b|0,d|0,g|0)|0,ow(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=ur(A|0,m|0,6,0)|0,y=Q()|0,M){b=0,E=0;do at=d+(E<<3)|0,at=((Gi(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,we=y}else me=g,we=y;if(_e=ur(me|0,we|0,10,0)|0,re=Q()|0,Ot=cr(me<<5)|0,!Ot)return at=13,Y=dt,at|0;if(at=aa(_e,4)|0,!at)return _t(Ot),at=13,Y=dt,at|0;e:do if(M){for(ve=d,L4(h[ve>>2]|0,h[ve+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,ve=W+(G<<5)|0,h[ve>>2]=h[Ee>>2],h[ve+4>>2]=Ke,He[W+(G<<5)+9>>0]=0,He[W+(G<<5)+8>>0]=0,h[W+(G<<5)+20>>2]=W,ve=W+(G<<5)+24|0,h[ve>>2]=1,h[ve+4>>2]=0,ve=He[y+G>>0]|0,Ke=pt(I|0,O|0,G|0,q|0)|0,Ke=ef(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,ve=ve&255,h[W+(ve<<5)+16>>2]=W+((Ke&255)<<5),h[W+(ve<<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;ve=d+($<<3)|0,L4(h[ve>>2]|0,h[ve+4>>2]|0,At)|0||(W=Ot+(g<<5)|0)}ci(27634,26956,108,26975)}while(!1);if((we|0)>0|(we|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=ur(g^b|0,(Q()|0)^y|0,484763065,-1084733587)|0,b=Q()|0,g=et(y|0,b|0,27)|0,b=ur(g^y|0,(Q()|0)^b|0,321982955,-1798288965)|0,y=Q()|0,g=et(b|0,y|0,31)|0,y=ef(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=fd(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)<(we|0)|(M|0)==(we|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(ve=E,F9(h[ve>>2]|0,h[ve+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=ur(y^I|0,(Q()|0)^O|0,484763065,-1084733587)|0,b=Q()|0,g=et(y|0,b|0,27)|0,b=ur(g^y|0,(Q()|0)^b|0,321982955,-1798288965)|0,y=Q()|0,g=et(b|0,y|0,31)|0,y=ef(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(;ve=g,!((h[ve>>2]|0)==(I|0)&&(h[ve+4>>2]|0)==(O|0));)if(g=pt(y|0,b|0,1,0)|0,y=fd(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,ve=Ot+(G<<5)+12|0,h[(h[ve>>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[ve>>2],y=tw(E)|0,ve=tw(g)|0,g=y+24|0,m=h[g+4>>2]|0,Ee=ve+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:ve,y=Ee?ve:y,(y|0)!=(g|0)&&(Ke=g+24|0,ve=y+24|0,Ee=ve,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[ve>>2]=Ke,h[ve+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)<(we|0)|(q|0)==(we|0)&G>>>0<me>>>0);(We|0)==39&&ci(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)<(we|0)|(y|0)==(we|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,ve=g;while(!((h[ve>>2]|0)==(y|0)&&(h[ve+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)<(we|0)|(O|0)==(we|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)<(we|0)|(y|0)==(we|0)&g>>>0<me>>>0);Ee=b,Ke=E,g=1}else Ee=0,Ke=0,g=0;ve=cr(Ee*24|0)|0;e:do if(ve|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($=cr(y<<4)|0,!$)break;y=oe,b=ue,W=0,q=0,E=0,M=0;do{if(hx(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=$se($,W<<4)|0,!y){We=75;break}ue=tw(g)|0,re=h[ue+4>>2]|0,g=ve+(m*24|0)|0,h[g>>2]=h[ue>>2],h[g+4>>2]=re,g=ve+(m*24|0)+16|0,h[g>>2]=W,h[ve+(m*24|0)+20>>2]=y,h[At>>2]=h[g>>2],h[At+4>>2]=h[g+4>>2],zl(At,ve+(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)<(we|0)|(A|0)==(we|0)&d>>>0<me>>>0)_e=g,m=y;else break t}if((We|0)==69?ci(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[ve+(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(ve);break e}while(!1);ow(ve,Ee,24,2);t:do if((Ee|0)==0&(Ke|0)==0){if(re=cr(192)|0,re|0){if(h[re+16>>2]=0,h[re+20>>2]=0,q=re+8|0,h[q>>2]=3,g=cr(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],zl(At,re)|0,h[re+40>>2]=0,h[re+44>>2]=0,G=re+32|0,h[G>>2]=3,g=cr(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],zl(At,re+24|0)|0,h[re+64>>2]=0,h[re+68>>2]=0,O=re+56|0,h[O>>2]=3,g=cr(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],zl(At,re+48|0)|0,h[re+88>>2]=0,h[re+92>>2]=0,I=re+80|0,h[I>>2]=3,g=cr(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],zl(At,re+72|0)|0,h[re+112>>2]=0,h[re+116>>2]=0,M=re+104|0,h[M>>2]=3,g=cr(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],zl(At,re+96|0)|0,h[re+136>>2]=0,h[re+140>>2]=0,E=re+128|0,h[E>>2]=3,g=cr(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],zl(At,re+120|0)|0,h[re+160>>2]=0,h[re+164>>2]=0,b=re+152|0,h[b>>2]=3,g=cr(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],zl(At,re+144|0)|0,h[re+184>>2]=0,h[re+188>>2]=0,y=re+176|0,h[y>>2]=3,g=cr(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],zl(At,re+168|0)|0,ow(re,8,24,3),g=cr(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=ve+(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=cr(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=ve+(y*24|0)|0,We=ve+(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=ve+(y*24|0)|0,We=Bs(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=cr(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=ve+(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[ve+(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(ow(d,ue,24,3),g=cr(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(ve),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[ve+(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(ve),_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 $re(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 tw(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=tw(m)|0,h[A>>2]=m,m|0)}function Yre(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 Kre(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 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,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){U4(d,A,y,O)|0,U4(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&&Gi(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 w9(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 Qre(d,A,m,_,g){return d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,m=ew(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 Jre(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 ese(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,_=Os(d,A&-2130706433|134217728,y&7,_,m)|0,Y=g,_|0):(_=6,Y=g,_|0)}function D9(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&(Gi(d,m)|0)!=0?(m=0,m|0):(m=nw(d,m)|0,m|0)}function tse(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,_=Os(d,y,A&7,_,m+8|0)|0,Y=g,_|0):(_=6,Y=g,_|0)}function L4(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0;return g=(Gi(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 hx(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,_=Wse(d,y,_&7)|0,(_|0)==-1?(h[m>>2]=0,y=6,Y=b,y|0):(ag(d,y,g)|0&&ci(27634,27035,282,27050),A=et(d|0,A|0,52)|0,Q()|0,A=A&15,Gi(d,y)|0?D4(g,A,_,2,m):F4(g,A,_,2,m),y=0,Y=b,y|0)):(y=6,Y=b,y|0)}function F9(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=Os(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=ew(_,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 nse(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,we=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=+Are(+(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],we=+ne[15888+(d*24|0)+8>>3],_e=+ne[15888+(d*24|0)+16>>3],Fe=-(_e+(re*0+we*0)),b=re*Fe+0,oe=we*Fe+0,Fe=_e*Fe+1,ue=+os(+(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*we+M*_e),$=I+re*Fe,_=O+we*Fe,I=M+_e*Fe,O=+os(+(I*I+($*$+_*_))),O=O>0?1/O:0,$=$*O,_=_*O,O=I*O,_=+px(me-+px(+oa(+(O*(we*b-re*oe)+($*(_e*oe-we*ue)+_*(re*ue-_e*b))),+(ue*O+(b*$+oe*_))))),Vl(A)|0?b=+px(_+-.3334731722518321):b=_,_=+Jb(+y)*2.618033988749896,(A|0)>0){d=0;do _=_*2.6457513110645907,d=d+1|0;while((d|0)!=(A|0))}M=+Jn(+b)*_,b=+Ni(+b)*_}A=m+4|0,W=m+12|0,h[W>>2]=0,y=+Fs(+b)*1.1547005383792515,_=+Fs(+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=Bs(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=Bs(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 ise(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,fx(g,h[d>>2]|0,A,0,m),Y=_}function fx(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=+Hse(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=+oa(+ +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=(Vl(m)|0)==0,y=+v9(+((m?E:E*.37796447300922725)*.381966011250105))):(y=+v9(+(y*.381966011250105)),Vl(m)|0&&(b=+px(b+.3334731722518321))),G=+px(+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=+os(+(W*W+(I*I+b*b))),q=q>0?1/q:0,I=I*q,b=b*q,q=W*q,W=+Jn(+G),G=+Ni(+G),ue=+Jn(+y),$=+Ni(+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=+os(+(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 D4(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,we=0,me=0,Fe=0,Ke=0,Ee=0,ve=0,At=0,We=0,Ot=0,at=0,dt=0,ui=0,gi=0,lo=0,Un=0,_i=0,la=0,_s=0,Wr=0,xs=0,as=0,Ga=0,$s=0,Ys=0,Hl=0,co=0,Si=0,F0=0;if(Ga=Y,Y=Y+256|0,y=Ga+240|0,ui=Ga+224|0,Wr=Ga,xs=Ga+208|0,as=Ga+192|0,gi=Ga+168|0,lo=Ga+152|0,Un=Ga+136|0,_i=Ga+120|0,la=Ga+104|0,_s=Ga+80|0,h[y>>2]=A,h[ui>>2]=h[d>>2],h[ui+4>>2]=h[d+4>>2],h[ui+8>>2]=h[d+8>>2],h[ui+12>>2]=h[d+12>>2],O9(ui,y,Wr),h[g>>2]=0,ui=_+m+((_|0)==5&1)|0,(ui|0)<=(m|0)){Y=Ga;return}me=h[y>>2]|0,we=xs+4|0,_e=xs+8|0,re=xs+12|0,Fe=as+8|0,Ke=m+5|0,Ee=16848+(me<<2)|0,ve=gi+8|0,At=16928+(me<<2)|0,We=lo+8|0,Ot=Un+8|0,at=_i+8|0,dt=as+8|0,W=gi+8|0,oe=gi+16|0,$=_s+8|0,ue=_s+16|0,q=m,_=0,b=0,E=0,M=0;e:for(;;){G=Wr+(((q|0)%5|0)<<4)|0,h[xs>>2]=h[G>>2],h[xs+4>>2]=h[G+4>>2],h[xs+8>>2]=h[G+8>>2],h[xs+12>>2]=h[G+12>>2];do;while((og(xs,me,0,1)|0)==2);if((q|0)>(m|0)&(Vl(A)|0)!=0){if(G=h[xs>>2]|0,d=h[we>>2]|0,I=h[_e>>2]|0,y=h[re>>2]|0,$s=+(E-M|0),ne[as>>3]=+(b-M|0)-$s*.5,ne[Fe>>3]=$s*.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 co=y+d|0,Si=(co|0)<0,I=_+d-(Si?co:0)|0,Hl=(I|0)<0,Ys=y+_-(Si?co:0)-(Hl?I:0)|0,y=(Ys|0)<0,d=(Si?0:co)-(Hl?I:0)-(y?Ys:0)|0,_=(Hl?0:I)-(y?Ys:0)|0,Ys=y?0:Ys,y=(_|0)<(d|0)?_:d,y=(Ys|0)<(y|0)?Ys:y,I=(y|0)>0,d=d-(I?y:0)|0,_=_-(I?y:0)|0,y=Ys-(I?y:0)|0,b=b+1|0;while((b|0)<(E|0))}else _=I;switch(Si=(h[Ee>>2]|0)*3|0,Ys=(Ua(Si,h[18608+(G*80|0)+(M*20|0)+4>>2]|0)|0)+d|0,I=(Ua(Si,h[18608+(G*80|0)+(M*20|0)+8>>2]|0)|0)+_|0,Si=(Ua(Si,h[18608+(G*80|0)+(M*20|0)+12>>2]|0)|0)+y|0,M=(Ys|0)<0,I=I-(M?Ys:0)|0,Hl=(I|0)<0,Si=Si+(M?0-Ys|0:0)+(Hl?0-I|0:0)|0,co=(Si|0)<0,Ys=(M?0:Ys)-(Hl?I:0)-(co?Si:0)|0,I=(Hl?0:I)-(co?Si:0)|0,Si=co?0:Si,co=(I|0)<(Ys|0)?I:Ys,co=(Si|0)<(co|0)?Si:co,Hl=(co|0)>0,Si=Si-(Hl?co:0)|0,$s=+(I-(Hl?co:0)-Si|0),ne[gi>>3]=+(Ys-(Hl?co:0)-Si|0)-$s*.5,ne[ve>>3]=$s*.8660254037844386,$s=+(h[At>>2]|0),ne[lo>>3]=$s*3,ne[We>>3]=0,F0=$s*-1.5,ne[Un>>3]=F0,ne[Ot>>3]=$s*2.598076211353316,ne[_i>>3]=F0,ne[at>>3]=$s*-2.598076211353316,h[17008+(O*80|0)+(G<<2)>>2]|0){case 1:{d=Un,_=lo;break}case 3:{d=_i,_=Un;break}case 2:{d=lo,_=_i;break}default:{d=12;break e}}K9(as,gi,_,d,la),fx(la,O,me,1,_s),Si=h[g>>2]|0,$s=+ux(+ +ne[ue>>3]),F0=+oa(+ +ne[$>>3],+ +ne[_s>>3]),ne[g+8+(Si<<4)>>3]=$s,ne[g+8+(Si<<4)+8>>3]=F0,h[g>>2]=(h[g>>2]|0)+1}if((q|0)<(Ke|0)&&(Si=h[re>>2]|0,$s=+((h[_e>>2]|0)-Si|0),ne[as>>3]=+((h[we>>2]|0)-Si|0)-$s*.5,ne[dt>>3]=$s*.8660254037844386,fx(as,h[xs>>2]|0,me,1,gi),Si=h[g>>2]|0,$s=+ux(+ +ne[oe>>3]),F0=+oa(+ +ne[W>>3],+ +ne[gi>>3]),ne[g+8+(Si<<4)>>3]=$s,ne[g+8+(Si<<4)+8>>3]=F0,h[g>>2]=(h[g>>2]|0)+1),q=q+1|0,(q|0)>=(ui|0)){d=3;break}else _=h[xs>>2]|0,b=h[we>>2]|0,E=h[_e>>2]|0,M=h[re>>2]|0}if((d|0)==3){Y=Ga;return}else(d|0)==12&&ci(27073,27120,599,27130)}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;$=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=(Vl(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-_),Vl(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 og(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=Ua(oe,h[g+8>>2]|0)|0,_e=Ua(oe,h[g+12>>2]|0)|0,b=(Ua(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 rse(d,A){d=d|0,A=A|0;var m=0;do m=og(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,we=0,me=0,Fe=0,Ke=0,Ee=0,ve=0,At=0,We=0,Ot=0,at=0,dt=0,ui=0,gi=0,lo=0,Un=0,_i=0,la=0,_s=0,Wr=0,xs=0,as=0;if(_s=Y,Y=Y+272|0,y=_s+256|0,b=_s+240|0,Un=_s,_i=_s+224|0,la=_s+208|0,We=_s+184|0,Ot=_s+168|0,at=_s+152|0,dt=_s+136|0,ui=_s+120|0,gi=_s+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],B9(b,y,Un),h[g>>2]=0,At=_+m+((_|0)==6&1)|0,(At|0)<=(m|0)){Y=_s;return}_e=h[y>>2]|0,re=m+6|0,we=la+8|0,me=We+8|0,Fe=16928+(_e<<2)|0,Ke=Ot+8|0,Ee=at+8|0,ve=dt+8|0,oe=h[b>>2]|0,q=_i+4|0,W=_i+8|0,$=_i+12|0,ue=la+8|0,M=We+8|0,O=We+16|0,I=gi+8|0,G=gi+16|0,b=0,E=m,_=-1;e:for(;;){if(y=(E|0)%6|0,d=Un+(y<<4)|0,h[_i>>2]=h[d>>2],h[_i+4>>2]=h[d+4>>2],h[_i+8>>2]=h[d+8>>2],h[_i+12>>2]=h[d+12>>2],d=b,b=og(_i,_e,0,1)|0,(E|0)>(m|0)&(Vl(A)|0)!=0&&(lo=h[_i>>2]|0,(d|0)!=1&(lo|0)!=(_|0))){switch(as=(y+5|0)%6|0,d=h[Un+(as<<4)+12>>2]|0,Wr=+((h[Un+(as<<4)+8>>2]|0)-d|0),ne[la>>3]=+((h[Un+(as<<4)+4>>2]|0)-d|0)-Wr*.5,ne[we>>3]=Wr*.8660254037844386,d=h[Un+(y<<4)+12>>2]|0,Wr=+((h[Un+(y<<4)+8>>2]|0)-d|0),ne[We>>3]=+((h[Un+(y<<4)+4>>2]|0)-d|0)-Wr*.5,ne[me>>3]=Wr*.8660254037844386,Wr=+(h[Fe>>2]|0),ne[Ot>>3]=Wr*3,ne[Ke>>3]=0,xs=Wr*-1.5,ne[at>>3]=xs,ne[Ee>>3]=Wr*2.598076211353316,ne[dt>>3]=xs,ne[ve>>3]=Wr*-2.598076211353316,h[17008+(oe*80|0)+(((_|0)==(oe|0)?lo:_)<<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}}K9(la,We,_,d,ui),!(Z9(la,ui)|0)&&!(Z9(We,ui)|0)&&(fx(ui,oe,_e,1,gi),as=h[g>>2]|0,Wr=+ux(+ +ne[G>>3]),xs=+oa(+ +ne[I>>3],+ +ne[gi>>3]),ne[g+8+(as<<4)>>3]=Wr,ne[g+8+(as<<4)+8>>3]=xs,h[g>>2]=(h[g>>2]|0)+1)}if((E|0)<(re|0)&&(as=h[$>>2]|0,Wr=+((h[W>>2]|0)-as|0),ne[la>>3]=+((h[q>>2]|0)-as|0)-Wr*.5,ne[ue>>3]=Wr*.8660254037844386,fx(la,h[_i>>2]|0,_e,1,We),as=h[g>>2]|0,Wr=+ux(+ +ne[O>>3]),xs=+oa(+ +ne[M>>3],+ +ne[We>>3]),ne[g+8+(as<<4)>>3]=Wr,ne[g+8+(as<<4)+8>>3]=xs,h[g>>2]=(h[g>>2]|0)+1),E=E+1|0,(E|0)>=(At|0)){d=3;break}else _=h[_i>>2]|0}if((d|0)==3){Y=_s;return}else(d|0)==8&&ci(27157,27120,766,27202)}function B9(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=(Vl(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-_),Vl(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 O4(d,A){return d=d|0,A=A|0,A=et(d|0,A|0,52)|0,Q()|0,A&15|0}function U9(d,A){return d=d|0,A=A|0,A=et(d|0,A|0,45)|0,Q()|0,A&127|0}function sse(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 ose(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 nw(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=Bs(-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=Q4(d|0,A|0,0)|0,Q()|0,((63-b|0)%3|0|0)!=0|0))}function ase(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=Bs(-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=Q4(d|0,m|0,0)|0,Q()|0,(63-b|0)%3|0|0))||D9(d,A)|0?(b=1,b|0):(b=(Q9(d,A)|0)!=0&1,b|0)}function B4(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 U4(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 dx(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(!(lr(m&127)|0))m=ud(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=ud(7,0,g,((g|0)<0)<<31>>31)|0,g=Q()|0;break e}while(!1);m=ud(7,0,g,((g|0)<0)<<31>>31)|0,m=ur(m|0,Q()|0,5,0)|0,m=pt(m|0,Q()|0,-5,-1)|0,m=hd(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 Gi(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,!(lr(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 lse(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,H4(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,W4(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 k9(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,(_|0)<(m|0)?(m=A,_=d,Dn(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,Dn(m|0),_|0)}function G9(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 cse(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,we=0,me=0,Fe=0,Ke=0,Ee=0,ve=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=cr(We)|0,!at)return dt=13,dt|0;if(bc(at|0,d|0,We|0)|0,Ot=aa(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,ve=et(I|0,g|0,52)|0,Q()|0,ve=ve&15,At=ve+-1|0,Ee=(ve|0)!=0,Ke=(_|0)>0|(_|0)==0&m>>>0>0;t:do if(Ee&Ke){if(re=ht(At|0,0,52)|0,we=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|we,O>>>0>=ve>>>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=ef(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(!(lr(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=fd(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=hd(m|0,_|0,6,0)|0,Q()|0,Fe=aa(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(lr(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,we=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|we,W>>>0>=ve>>>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;$=ef(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,$=fd(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(dd(Ot|0,0,We|0)|0,bc(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)ci(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?ci(27634,27225,711,27235):(dt|0)==81?ci(27634,27225,723,27235):(dt|0)==85&&(bc(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 use(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(H4($,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,W4($),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 hse(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=(dx(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 fse(d,A){return d=d|0,A=A|0,A=et(d|0,A|0,52)|0,Q()|0,A&1|0}function ka(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 k4(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,Dn(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 Dn(A|0),d|0}function L0(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,Dn(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 Dn(A|0),d|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;if(O=et(d|0,A|0,52)|0,Q()|0,O=O&15,!O)return I=A,O=d,Dn(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 Dn(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,Dn(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 Dn(A|0),d|0}function pse(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,we=0,me=0,Fe=0,Ke=0,Ee=0;if(me=Y,Y=Y+16|0,we=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,we=0,Dn(re|0),Y=me,we|0):(ht(C9(d)|0,0,45)|0,re=Q()|0|m,we=-1,Dn(re|0),Y=me,we|0);h[we>>2]=h[d>>2],h[we+4>>2]=h[d+4>>2],h[we+8>>2]=h[d+8>>2],h[we+12>>2]=h[d+12>>2],re=we+4|0;e:do if((A|0)>0)for(oe=we+8|0,ue=we+12|0,$=A,G=h[oe>>2]|0,q=h[ue>>2]|0,A=-1,O=h[we+4>>2]|0;;){W=$,$=$+-1|0,d=O-q|0,_=G-q|0,W&1?(y=_u(+((d*3|0)-_|0)*.14285714285714285)|0,h[re>>2]=y,d=_u(+((_<<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=_u(+((d<<1)+_|0)*.14285714285714285)|0,h[re>>2]=E,g=_u(+((_*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[we+8>>2]|0)<=2&&(h[we+12>>2]|0)<=2){if(_=C9(we)|0,d=ht(_|0,0,45)|0,A=d|A,d=Q()|0|m&-1040385,M=Ore(we)|0,!(lr(_)|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(R9(_,h[we>>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=k4(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,Dn(Ke|0),Y=me,Ee|0}function Vl(d){return d=d|0,(d|0)%2|0|0}function z4(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[Yi>>3]=y,(h[Yi+4>>2]&2146435072|0)==2146435072||(_=+ne[d+8>>3],ne[Yi>>3]=_,(h[Yi+4>>2]&2146435072|0)==2146435072))return I=3,Y=O,I|0;g=+Jn(+y),G=g*+Jn(+_),g=g*+Ni(+_),_=+Ni(+y),ne[I>>3]=G,ne[I+8>>3]=g,ne[I+16>>3]=_,ne[Yi>>3]=G;do if((h[Yi+4>>2]&2146435072|0)!=2146435072&&(ne[Yi>>3]=_,d=h[Yi+4>>2]|0,ne[Yi>>3]=g,!((h[Yi+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],nse(E,A,M),M=pse(M,A)|0,I=Q()|0,h[m>>2]=M,h[m+4>>2]=I,(M|0)==0&(I|0)==0)ci(27634,27225,1073,27248);else{b=0;break}else b=2;while(!1);return I=b,Y=O,I|0}function V4(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,lr(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 ag(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((lr(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],!(V4(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,!(lr(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(!(og(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(lr(q)|0)do;while((og(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=_u(+((_<<1)+d|0)*.14285714285714285)|0,h[W>>2]=A,_=_u(+((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 lg(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=ag(d,A,_)|0,y?(Y=b,y|0):(y=et(d|0,A|0,52)|0,Q()|0,ise(_,y&15,g),M=+ux(+ +ne[g+16>>3]),E=+oa(+ +ne[g+8>>3],+ +ne[g>>3]),ne[m>>3]=M,ne[m+8>>3]=E,y=0,Y=b,y|0)}function D0(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,_=ag(d,A,y)|0,_|0)return y=_,Y=b,y|0;_=et(d|0,A|0,45)|0,Q()|0,_=(lr(_&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 D4(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 Ase(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,!(lr(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 z9(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(lr(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=z9((M|d)&~I,O&~(Q()|0),m)|0,Y=G,O|0}else g=0;while(!1);if(_=ag(d,A,y)|0,!_){g?(O9(y,I,O),M=5):(B9(y,I,O),M=6);e:do if(lr(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);dd(m|0,-1,d<<2|0)|0;e:do if(g)for(y=0;;){if(b=O+(y<<4)|0,rse(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,og(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 mse(){return 12}function q4(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 lr(_)|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(lr(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 gse(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(lr($&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,!(lr(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=ud(7,0,I,((I|0)<0)<<31>>31)|0,O=Q()|0,y?(y=ur(I|0,O|0,5,0)|0,y=pt(y|0,Q()|0,-5,-1)|0,y=hd(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=ur(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)ci(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=ud(7,0,b,((b|0)<0)<<31>>31)|0,g=ur(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 dx(oe,E,_e,ue)|0&&ci(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):(ci(27634,27225,1447,27259),0)}function _se(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(dx(m,_,g,b)|0&&ci(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(lr(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=ud(7,0,E,((E|0)<0)<<31>>31)|0,m=Q()|0;do if(b)if(b=ur(E|0,m|0,5,0)|0,b=pt(b|0,Q()|0,-5,-1)|0,b=hd(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=Bs(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),_=hd(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=ur(_|0,d|0,E|0,m|0)|0,d=Bs(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=hd(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=ur(oe|0,b|0,E|0,m|0)|0,d=Bs(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,$=ud(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=hd(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=ur(q|0,W|0,$|0,oe|0)|0,d=Bs(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 H4(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=k9(A,m,g+1|0,_)|0,b=(Q()|0)&-15728641,m=ht(_|0,0,52)|0,m=A|m,b=b|(Q()|0),A=(Gi(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 V9(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=k9(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,Gi(g,y)|0){h[d>>2]=m;return}else{h[d>>2]=-1;return}}function W4(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 px(d){d=+d;var A=0;return A=d<0?d+6.283185307179586:d,+(d>=6.283185307179586?A+-6.283185307179586:A)}function fl(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 xse(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=+Ni(+((g-_)*.5)),m=+Ni(+((+ne[A+8>>3]-+ne[d+8>>3])*.5)),m=y*y+m*(+Jn(+g)*+Jn(+_)*m),+(+oa(+ +os(+m),+ +os(+(1-m)))*2)}function Ax(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=+Ni(+((g-_)*.5)),m=+Ni(+((+ne[A+8>>3]-+ne[d+8>>3])*.5)),m=y*y+m*(+Jn(+g)*+Jn(+_)*m),+(+oa(+ +os(+m),+ +os(+(1-m)))*2*6371.007180918475)}function yse(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=+Ni(+((g-_)*.5)),m=+Ni(+((+ne[A+8>>3]-+ne[d+8>>3])*.5)),m=y*y+m*(+Jn(+g)*+Jn(+_)*m),+(+oa(+ +os(+m),+ +os(+(1-m)))*2*6371.007180918475*1e3)}function q9(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 vse(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 bse(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 wse(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 iw(d,A){d=d|0,A=A|0;var m=0;return d>>>0>15?(A=4,A|0):(m=ud(7,0,d,((d|0)<0)<<31>>31)|0,m=ur(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 Sse(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=hx(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=+Ni(+((_-I)*.5)),M=g,g=+ne[b+8+(d<<4)+8>>3],M=+Ni(+((g-M)*.5)),M=O*O+M*(+Jn(+_)*+Jn(+I)*M),y=y+ +oa(+ +os(+M),+ +os(+(1-M)))*2;while((d|0)<(A|0));return ne[m>>3]=y,b=0,Y=E,b|0}function Tse(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=hx(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=+Ni(+((_-I)*.5)),M=g,g=+ne[b+8+(d<<4)+8>>3],M=+Ni(+((g-M)*.5)),M=O*O+M*(+Jn(+I)*+Jn(+_)*M),y=y+ +oa(+ +os(+M),+ +os(+(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 Ese(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=hx(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=+Ni(+((_-I)*.5)),M=g,g=+ne[b+8+(d<<4)+8>>3],M=+Ni(+((g-M)*.5)),M=O*O+M*(+Jn(+I)*+Jn(+_)*M),y=y+ +oa(+ +os(+M),+ +os(+(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 Mse(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 Cse(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=aa(1,12)|0,!m){m=5;break}h[d+8>>2]=m,d=m}if(M=h[$>>2]|0,I=aa(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=cr(24)|0,!b){d=13,m=37;break e}J4(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=aa(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=cr(24)|0,!y){d=13,m=37;break e}J4(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 mx(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=I4(M,I)|0,(b|0)==7)return ue=1,Y=_e,ue|0;E=I4(I,M)|0,(E|0)==7?ci(27291,27315,164,27325):(oe=b,y=E)}else oe=0,y=0;G=lr(M)|0,q=lr(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=dse(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(V4(M,E,ue)|0,W||ci(27340,27315,194,27325),b=(G|0)!=0,y=(q|0)!=0,b&y&&ci(27367,27315,195,27325),b){if(y=ka(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=ka(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,Vl(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(V4(m,_,ue)|0,(G|0)!=0&(q|0)!=0)if((I|0)!=(M|0)&&ci(27398,27315,264,27325),b=ka(d,A)|0,y=ka(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 H9(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,we=0,me=0,Fe=0,Ke=0,Ee=0,ve=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=lr(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,we=E-_e|0,ue=(we|0)<0,_e=(ue?0-we|0:0)+(m-_e)|0,m=(_e|0)<0,g=m?0:_e,_e=m?_e:0,m=(ue?0:we)-_e|0,_e=(A?0:b)-(ue?we:0)-_e|0,we=(m|0)<(_e|0)?m:_e,we=(g|0)<(we|0)?g:we,we=(we|0)>0?we:0,g=g-we|0,m=m-we|0;e:do switch(_e-we|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=P4(me,g)|0,(g|0)==127)?(_=1,_|0):(we=ht(g|0,0,45)|0,me=Q()|0,re=_,me=h[re+4>>2]&-1040385|me,h[_>>2]=h[re>>2]|we,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,Vl(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(ve=$<<1,O?(2147483647-ve|0)<($|0):(-2147483648-ve|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=_u(+(M-W|0)*.14285714285714285)|0,O=_u(+(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,ve=(W*3|0)+$-(Fe?Ke:0)|0,M=(ve|0)<0,G=($*3|0)+q-(Fe?Ke:0)-(M?ve:0)|0,O=(G|0)<0,Ee=O?0:G,I=(M?0:ve)-(O?G:0)|0,G=(Fe?0:Ke)-(M?ve:0)-(O?G:0)|0,O=(I|0)<(G|0)?I:G,O=(Ee|0)<(O|0)?Ee:O,ve=(O|0)>0,M=ve?O:0,I=I-(ve?O:0)|0,O=Ee-(ve?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=_u(+(M+W|0)*.14285714285714285)|0,O=_u(+(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,ve=(q?0-G|0:0)-(Ee?W:0)|0,$=(ve|0)<0,q=(q?0:G)-(Ee?W:0)-($?ve:0)|0,W=(Ee?0:W)-($?ve:0)|0,ve=$?0:ve,$=(W|0)<(q|0)?W:q,$=(ve|0)<($|0)?ve:$,Ee=($|0)>0,q=q-(Ee?$:0)|0,W=W-(Ee?$:0)|0,$=ve-(Ee?$:0)|0,Ee=(q*3|0)+$|0,ve=(Ee|0)<0,Fe=(W*3|0)+q-(ve?Ee:0)|0,M=(Fe|0)<0,G=($*3|0)+W-(ve?Ee:0)-(M?Fe:0)|0,O=(G|0)<0,Ke=O?0:G,I=(M?0:Fe)-(O?G:0)|0,G=(ve?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,ve=(G?0:I)-(b?Fe:0)|0,Fe=(Ee?0:M)-(G?I:0)-(b?Fe:0)|0,b=(ve|0)<(Fe|0)?ve: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,ve=ve-(m?b:0)-Ee|0,Ke=(ve|0)<0,Ee=(Ke?0-ve|0:0)+(O-(m?b:0)-Ee)|0,b=(Ee|0)<0,m=b?0:Ee,Ee=b?Ee:0,b=(Ke?0:ve)-Ee|0,Ee=(G?0:Fe)-(Ke?ve:0)-Ee|0,ve=(b|0)<(Ee|0)?b:Ee,ve=(m|0)<(ve|0)?m:ve,ve=(ve|0)>0?ve:0,m=m-ve|0,b=b-ve|0;e:do switch(Ee-ve|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,ve=_,h[ve>>2]=Ke|M,h[ve+4>>2]=Ee,(oe|0)<=1){re=47;break}else b=q,E=W,m=$}if((re|0)==24)ci(27634,27425,416,27447);else if((re|0)==36)ci(27634,27425,464,27461);else if((re|0)==47){if((q|0)>1|(W|0)>1|($|0)>1)return ve=1,ve|0;Fe=(q|0)<0,Ee=Fe?q:0,ve=W-Ee|0,Ke=(ve|0)<0,Ee=(Ke?0-ve|0:0)+($-Ee)|0,y=(Ee|0)<0,m=y?0:Ee,Ee=y?Ee:0,y=(Ke?0:ve)-Ee|0,Ee=(Fe?0:q)-(Ke?ve:0)-Ee|0,ve=(y|0)<(Ee|0)?y:Ee,ve=(m|0)<(ve|0)?m:ve,ve=(ve|0)>0?ve:0,m=m-ve|0,y=y-ve|0;e:do switch(Ee-ve|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=P4(me,y)|0,(E|0)==127?I=0:I=lr(E)|0;e:do if(y){if(ue){if(m=ka(d,A)|0,(m|0)==7)return ve=5,ve|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 ve=9,ve|0;y=P4(me,m)|0,(y|0)==127&&ci(27476,27315,415,27506),lr(y)|0?ci(27521,27315,416,27506):(g=y,we=b,_e=m)}else g=E,we=0,_e=y;if(M=h[4272+(me*28|0)+(_e<<2)>>2]|0,(M|0)<=-1&&ci(27552,27315,423,27506),!I){if((we|0)<0)return ve=5,ve|0;if(we|0){b=_,m=0,y=h[b>>2]|0,b=h[b+4>>2]|0;do y=L0(y,b)|0,b=Q()|0,ve=_,h[ve>>2]=y,h[ve+4>>2]=b,m=m+1|0;while((m|0)<(we|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=L0(y,b)|0,b=Q()|0,ve=_,h[ve>>2]=y,h[ve+4>>2]=b,m=m+1|0,(m|0)==(M|0)){re=104;break e}}if(E=I4(g,me)|0,(E|0)==7&&ci(27291,27315,432,27506),m=_,y=h[m>>2]|0,m=h[m+4>>2]|0,(M|0)>0){b=0;do y=L0(y,m)|0,m=Q()|0,ve=_,h[ve>>2]=y,h[ve+4>>2]=m,b=b+1|0;while((b|0)!=(M|0))}if(m=ka(y,m)|0,(m|0)==7&&ci(27634,27315,444,27506),y=R4(g)|0,y=h[(y?21760:21552)+(E*28|0)+(m<<2)>>2]|0,(y|0)<0&&ci(27634,27315,458,27506),!y)re=104;else{E=_,m=0,b=h[E>>2]|0,E=h[E+4>>2]|0;do b=k4(b,E)|0,E=Q()|0,ve=_,h[ve>>2]=b,h[ve+4>>2]=E,m=m+1|0;while((m|0)<(y|0));re=104}}else if((ue|0)!=0&(I|0)!=0){if(g=ka(d,A)|0,m=_,m=ka(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 ve=5,ve|0;if(!m)g=E,re=105;else{b=_,g=0,y=h[b>>2]|0,b=h[b+4>>2]|0;do y=L0(y,b)|0,b=Q()|0,ve=_,h[ve>>2]=y,h[ve+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&&(ve=_,(ka(h[ve>>2]|0,h[ve+4>>2]|0)|0)==1)?(ve=9,ve|0):(Ee=_,Fe=h[Ee>>2]|0,Ee=h[Ee+4>>2]&-1040385,Ke=ht(g|0,0,45)|0,Ee=Ee|(Q()|0),ve=_,h[ve>>2]=Fe|Ke,h[ve+4>>2]=Ee,ve=0,ve|0)}else if((re|0)==107)return g|0;return 0}function Rse(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=mx(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 Pse(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-_),_=H9(d,A,O,g)|0),O=_,Y=G,O|0)}function j4(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=mx(d,A,d,A,b)|0,y|0?(E=y,Y=M,E|0):(d=mx(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 Ise(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=j4(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 Nse(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=j4(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=W9(d,A,m,_,y,b,g,0,0,1,0)|0,E?(g=(W9(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 W9(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,we=0,me=0,Fe=0,Ke=0,Ee=0,ve=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,mx(d,A,d,A,G)|0&&ci(27634,27315,696,27575),mx(d,A,m,_,q)|0&&ci(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,ve=q+4|0,re=(h[ve>>2]|0)-re|0,h[ve>>2]=re,ve=re+_e|0,h[oe>>2]=0-ve,Ee=1/(+(g>>>0)+4294967296*+(y|0)),Fe=Ee*+(_e-m|0),Ke=Ee*+(re-_|0),Ee=Ee*+(At-ve|0),h[We>>2]=m,ve=We+4|0,h[ve>>2]=_,At=We+8|0,h[At>>2]=G,(y|0)<0)return I=0,Y=Ot,I|0;for(me=+(m|0),we=+(_|0),ue=+(G|0),_e=0,re=0;;){if($=+(_e>>>0)+4294967296*+(re|0),at=Fe*$+me,W=Ke*$+we,$=Ee*$+ue,_=~~+hw(+at),G=~~+hw(+W),m=~~+hw(+$),at=+Fs(+(+(_|0)-at)),W=+Fs(+(+(G|0)-W)),$=+Fs(+(+(m|0)-$)),at>W&at>$?(q=m+G|0,_=0-q|0):(q=0-_|0,W>$&&(G=q-m|0)),h[ve>>2]=G,h[We>>2]=q,h[At>>2]=0,m=_+G|0,(_|0)>0?(h[ve>>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[ve>>2]=0,q=G-_|0,m=0-_|0,(_|0)<0?(h[We>>2]=q,h[ve>>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[ve>>2]=oe-m,h[At>>2]=_-m),m=ur(_e|0,re|0,I|0,O|0)|0,m=pt(m|0,Q()|0,E|0,M|0)|0,Q()|0,m=H9(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 ud(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,Dn(g|0),y|0;y=d,g=A,d=1,A=0;do b=(m&1|0)==0&!0,d=ur((b?1:y)|0,(b?0:g)|0,d|0,A|0)|0,A=Q()|0,m=sG(m|0,_|0,1)|0,_=Q()|0,y=ur(y|0,g|0,y|0,g|0)|0,g=Q()|0;while(!((m|0)==0&(_|0)==0));return Dn(A|0),d|0}function X4(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=lg(d,A,y)|0,!g){I=+ne[y>>3],M=1/+Jn(+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 jre(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 Lse(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,B4(b,0,0,0),M=h[b>>2]|0,b=h[b+4>>2]|0;do if(m>>>0<=15){if(g=_x(_)|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=aa((h[A+8>>2]|0)+1|0,32)|0,g){$4(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);rw(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 rw(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,we=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=j9(m,_)|0,_=Q()|0):He[A>>0]=1,we=d+20|0,!(h[h[we>>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[we>>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=lg(m,_,W)|0,g|0){ue=15;break t}if(Y4(h[we>>2]|0,h[q>>2]|0,W)|0){ue=19;break t}break}default:}if(M&&(g=h[(h[we>>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],P9(26896,W)|0)){if(z4(h[(h[we>>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=D0(m,_,W)|0,g|0){ue=32;break}if(X4(m,_,$,0)|0){ue=36;break}if(b&&$9(h[we>>2]|0,h[q>>2]|0,W,$)|0){ue=42;break}if(M&&Y9(h[we>>2]|0,h[q>>2]|0,W,$)|0){ue=42;break}}if(G){if(A=X4(m,_,W,1)|0,g=h[q>>2]|0,A|0){ue=45;break}if(N4(g,W)|0){if(N9($,W),I9(W,h[q>>2]|0)|0){ue=53;break}if(Y4(h[we>>2]|0,h[q>>2]|0,E)|0){ue=53;break}if(Y9(h[we>>2]|0,h[q>>2]|0,$,W)|0){ue=53;break}}}}do if((y|0)<(h[oe>>2]|0)){if(A=X4(m,_,W,1)|0,g=h[q>>2]|0,A|0){ue=58;break t}if(!(N4(g,W)|0)){ue=73;break}if(I9(h[q>>2]|0,W)|0&&(N9($,W),$9(h[we>>2]|0,h[q>>2]|0,$,W)|0)){ue=65;break t}if(m=G9(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=j9(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[we>>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:{ci(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[we>>2]=0,h[oe>>2]=-1,h[re>>2]=0,h[q>>2]=0,h[d+8>>2]=g,Y=me;return}case 36:{ci(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[we>>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[we>>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[we>>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[we>>2]=0,h[d+12>>2]=-1,h[re>>2]=0,h[_e>>2]=0,Y=me}function j9(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&(Gi(m,g)|0)!=0,O=ht((O?2:1)+M|0,0,y|0)|0,I=Q()|0|A&~E,O=O|d&~b,Dn(I|0),Y=G,O|0}while(!1);return m=m&127,m>>>0>120?(I=0,O=0,Dn(I|0),Y=G,O|0):(B4(O,0,m+1|0,0),I=h[O+4>>2]|0,O=h[O>>2]|0,Dn(I|0),Y=G,O|0)}function Dse(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,Lse(G,d,A,m),I=G,H4(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,W4(q),d=q,A=h[d>>2]|0,d=h[d+4>>2]|0,(A|0)==0&(d|0)==0){if(rw(m),A=m,d=h[A>>2]|0,A=h[A+4>>2]|0,(d|0)==0&(A|0)==0){$=10;break}V9(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,V9(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 Fse(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;B4(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=_x(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=aa((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}$4(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=+qre(m),q=q*+zre(m),y=+Fs(+ +ne[m>>3]),y=q/+Jn(+ +uw(+y,+ +Fs(+ +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(q9(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(rw(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 dx(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,rw(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 gx(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(!(P9(A,m)|0)||(A=Vre(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 X9(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|+Fs(+(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 _x(d){return d=d|0,(d>>>0<4?0:15)|0}function $4(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,we=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,_=_|+Fs(+(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,we=A+(me<<5)+16|0,ne[we>>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[we>>3]=G,b=G),q=G>0&G<q?G:q,W=G<0&G>W?G:W,g=g|+Fs(+(G-E))>3.141592653589793,_=oe+1|0,(_|0)!=(_e|0);)Ee=oe,oe=_,O=y,_=Ee;g&&(ne[we>>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 Y4(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;if(!(gx(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,gx((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 $9(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,!(gx(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,gx((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(sw(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(gx(E,_,h[g+(b<<3)+4>>2]|0)|0){g=0;break e}if(g=b+1|0,sw((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 sw(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,we=0,me=0,Fe=0,Ke=0,Ee=0,ve=0;if(Ke=Y,Y=Y+176|0,re=Ke+172|0,g=Ke+168|0,we=Ke,!(N4(A,_)|0))return d=0,Y=Ke,d|0;if(Hre(A,_,re,g),bc(we|0,m|0,168)|0,(h[m>>2]|0)>0){A=0;do Ee=we+8+(A<<4)+8|0,_e=+fl(+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=+fl(+ne[_+16>>3],h[g>>2]|0),W=+fl(+ne[_+24>>3],h[g>>2]|0);e:do if((h[d>>2]|0)>0){if(_=d+4|0,g=h[we>>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],$=+fl(+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=+fl(+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(ve=A,A=A+1|0,Ee=(A|0)==(g|0)?0:A,y=+ne[we+8+(ve<<4)+8>>3],b=+ne[we+8+(Ee<<4)+8>>3]-y,E=+ne[we+8+(ve<<4)>>3],M=+ne[we+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 ve=A,Y=Ke,ve|0}function Y9(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0;if(sw(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,sw((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 Ose(){return 8}function Bse(){return 16}function Use(){return 168}function kse(){return 8}function Gse(){return 16}function zse(){return 12}function Vse(){return 8}function qse(d){return d=d|0,+(+((h[d>>2]|0)>>>0)+4294967296*+(h[d+4>>2]|0))}function Hse(d){d=d|0;var A=0,m=0;return m=+ne[d>>3],A=+ne[d+8>>3],+ +os(+(m*m+A*A))}function K9(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 Z9(d,A){return d=d|0,A=A|0,+Fs(+(+ne[d>>3]-+ne[A>>3]))<11920928955078125e-23?(A=+Fs(+(+ne[d+8>>3]-+ne[A+8>>3]))<11920928955078125e-23,A|0):(A=0,A|0)}function Wse(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,_=Gi(d,A)|0,(m+-1|0)>>>0>5||(_=(_|0)!=0,(m|0)==1&_))return g=-1,Y=y,g|0;do if(xx(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 xx(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,_=ag(d,A,E)|0,_|0)return m=_,Y=O,m|0;y=U9(d,A)|0,I=ka(d,A)|0,Bre(y,M),_=Ure(y,h[E>>2]|0)|0;do if(lr(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:ci(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=R4(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 ql(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,we=0;if(we=Y,Y=Y+32|0,re=we+24|0,ue=we+20|0,$=we+8|0,W=we+16|0,q=we,M=(Gi(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=we,_|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=(Gi(d,A)|0)!=0,((g?4:5)|0)<(m|0)||xx(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=we,_|0;h[ue>>2]=0,g=Os(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=Gi(d,A)|0,(E|0)<0&&ci(27634,27636,248,27661),M=(g|0)!=0,((M?4:5)|0)<(E|0)&&ci(27634,27636,248,27661),xx(d,A,re)|0&&ci(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&&ci(27634,27636,248,27661),h[W>>2]=0,g=Os(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(Gi(M,I)|0?y=ew(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=Gi(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(xx(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=(Gi(I,E)|0)!=0,M?d=ew(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=Gi(I,E)|0,(d+-1|0)>>>0<=5&&(_e=(g|0)!=0,!((d|0)==1&_e)))do if(xx(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=we,_|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=we,_|0}function jse(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;return y=(Gi(d,A)|0)==0,_=ql(d,A,0,m)|0,g=(_|0)==0,y?!g||(_=ql(d,A,1,m+8|0)|0,_|0)||(_=ql(d,A,2,m+16|0)|0,_|0)||(_=ql(d,A,3,m+24|0)|0,_|0)||(_=ql(d,A,4,m+32|0)|0,_)?(y=_,y|0):ql(d,A,5,m+40|0)|0:!g||(_=ql(d,A,1,m+8|0)|0,_|0)||(_=ql(d,A,2,m+16|0)|0,_|0)||(_=ql(d,A,3,m+24|0)|0,_|0)||(_=ql(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 Xse(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,_=ag(d,E,y)|0,_|0?(E=_,Y=M,E|0):(A=et(d|0,A|0,52)|0,Q()|0,A=A&15,Gi(d,E)|0?D4(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 Q9(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,!(nw(d,_)|0))?(_=0,Y=g,_|0):(y=et(d|0,A|0,56)|0,Q()|0,y=(ql(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 J9(){return 27680}function ow(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=Ua(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?K4(d,m,_,g,M):lw(d,m,_,I,g,0,M),(g|0)==1){cw(I,1),g=0;break}else{cw(I,A),g=1;break}else K4(d,m,_,g,M),aw(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(lw(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:(cw(I,2),q=g+-2|0,h[I>>2]=h[I>>2]^7,aw(I,1),lw(d+(0-(h[M+(q<<2)>>2]|0))+E|0,m,_,I,g+-1|0,1,M),cw(I,1),A=h[I>>2]|1,h[I>>2]=A,d=d+E|0,lw(d,m,_,I,q,1,M),g=q);(O|0)==19&&(O=0,A=eG(I)|0,aw(I,A),d=d+E|0,g=A+g|0,A=h[I>>2]|0)}}while(!1);Y=G}function K4(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);nG(A,O,_),Y=G}function aw(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 lw(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,$=eG(G)|0,aw(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&&(nG(A,q,_),K4(d,A,m,g,b)),Y=W}function cw(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 eG(d){d=d|0;var A=0;return A=tG((h[d>>2]|0)+-1|0)|0,A?A|0:(A=tG(h[d+4>>2]|0)|0,((A|0)==0?0:A+32|0)|0)}function tG(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 nG(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,bc(_|0,h[A>>2]|0,g|0)|0,_=0;do E=A+(_<<2)|0,_=_+1|0,bc(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 _u(d){return d=+d,~~+aG(+d)|0}function cr(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,we=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:(we=(A+1048320|0)>>>16&8,me=A<<we,re=(me+520192|0)>>>16&4,me=me<<re,m=(me+245760|0)>>>16&2,m=14-(re|we|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);we=A+8|0,me=h[we>>2]|0,h[me+12>>2]=O,h[we>>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,we=me+G|0,h[6927]=we,h[we+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=pd(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=pd(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=pd(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((pd(d|0)|0)==-1){pd(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=pd(I|0)|0,$=pd(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&&(we=A+4|0,(h[A+12>>2]&8|0)==0)&&y>>>0>M>>>0&d>>>0<=M>>>0){h[we>>2]=m+b,me=(h[6924]|0)+b|0,re=M+8|0,re=(re&7|0)==0?0:0-re&7,we=M+re|0,re=me-re|0,h[6927]=we,h[6924]=re,h[we+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}we=(A+1048320|0)>>>16&8,me=A<<we,re=(me+520192|0)>>>16&4,me=me<<re,_=(me+245760|0)>>>16&2,_=14-(re|we|_)+(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);we=A+8|0,me=h[we>>2]|0,h[me+12>>2]=I,h[we>>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,we=y+re|0,re=m-re|0,h[6927]=we,h[6924]=re,h[we+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 we=A,A=A+4|0,h[A>>2]=7;while((we+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:(we=(A+1048320|0)>>>16&8,me=A<<we,re=(me+520192|0)>>>16&4,me=me<<re,_=(me+245760|0)>>>16&2,_=14-(re|we|_)+(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);we=A+8|0,me=h[we>>2]|0,h[me+12>>2]=M,h[we>>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,we=y+re|0,re=me-re|0,h[6927]=we,h[6924]=re,h[we+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,we=me+G|0,h[6927]=we,h[we+4>>2]=re|1,h[me+4>>2]=G|3,me=me+8|0,Y=Fe,me|0}return me=J9()|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 aa(d,A){d=d|0,A=A|0;var m=0;return d?(m=Ua(A,d)|0,(A|d)>>>0>65535&&(m=((m>>>0)/(d>>>0)|0|0)==(A|0)?m:-1)):m=0,d=cr(m)|0,!d||!(h[d+-4>>2]&3)||dd(d|0,0,m|0)|0,d|0}function $se(d,A){d=d|0,A=A|0;var m=0,_=0;return d?A>>>0>4294967231?(A=J9()|0,h[A>>2]=12,A=0,A|0):(m=Yse(d+-8|0,A>>>0<11?16:A+11&-8)|0,m|0?(A=m+8|0,A|0):(m=cr(A)|0,m?(_=h[d+-4>>2]|0,_=(_&-8)-((_&3|0)==0?8:4)|0,bc(m|0,d|0,(_>>>0<A>>>0?_:A)|0)|0,_t(d),A=m,A|0):(A=0,A|0))):(A=cr(A)|0,A|0)}function Yse(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,iG(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,iG(E,I),d|0)}function iG(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,Dn(A+_+(m>>>0<d>>>0|0)>>>0|0),m|0|0}function Bs(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,_=A-_-(m>>>0>d>>>0|0)>>>0,Dn(_|0),d-m>>>0|0|0}function rG(d){return d=d|0,(d?31-(Jh(d^d-1)|0)|0:32)|0}function Z4(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,Dn(q|0),g|0):(q=0,g=0,Dn(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,Dn(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,Dn(q|0),g|0):(q=0,g=0,Dn(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,Dn(W|0),$|0):($=rG(b|0)|0,W=I>>>($>>>0)|0,$=I<<32-$|O>>>($>>>0)|0,Dn(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,Dn(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,Dn(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>>>((rG(E|0)|0)>>>0),Dn(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,Dn(W|0),$|0):(W=0,$=0,Dn(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,Bs(I|0,m|0,_|0,q|0)|0,$=Q()|0,W=$>>31|(($|0)<0?-1:0)<<1,E=W&1,d=Bs(_|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,Dn(W|0),$|0}function hd(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=Bs(I^d|0,M^A|0,I|0,M|0)|0,b=Q()|0,d=y^I,A=g^M,Bs((Z4(E,b,Bs(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 Kse(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0;return y=d&65535,g=A&65535,m=Ua(g,y)|0,_=d>>>16,d=(m>>>16)+(Ua(g,_)|0)|0,g=A>>>16,A=Ua(g,y)|0,Dn((d>>>16)+(Ua(g,_)|0)+(((d&65535)+A|0)>>>16)|0),d+A<<16|m&65535|0|0}function ur(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0;return g=d,y=m,m=Kse(g,y)|0,d=Q()|0,Dn((Ua(A,y)|0)+(Ua(_,g)|0)+d|d&0|0),m|0|0|0}function fd(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=Bs(b^d|0,y^A|0,b|0,y|0)|0,A=Q()|0,Z4(d,A,Bs(I^m|0,M^_|0,I|0,M|0)|0,Q()|0,E)|0,_=Bs(h[E>>2]^b|0,h[E+4>>2]^y|0,b|0,y|0)|0,m=Q()|0,Y=g,Dn(m|0),_|0}function ef(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,Z4(d,A,m,_,g)|0,Y=y,Dn(h[g+4>>2]|0),h[g>>2]|0|0}function sG(d,A,m){return d=d|0,A=A|0,m=m|0,(m|0)<32?(Dn(A>>m|0),d>>>m|(A&(1<<m)-1)<<32-m):(Dn(((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?(Dn(A>>>m|0),d>>>m|(A&(1<<m)-1)<<32-m):(Dn(0),A>>>m-32|0)}function ht(d,A,m){return d=d|0,A=A|0,m=m|0,(m|0)<32?(Dn(A<<m|(d&(1<<m)-1<<32-m)>>>32-m|0),d<<m):(Dn(d<<m-32|0),0)}function Q4(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),Dn(0),A|0}function oG(d,A){return d=+d,A=+A,d!=d?+A:A!=A?+d:+mre(+d,+A)}function uw(d,A){return d=+d,A=+A,d!=d?+A:A!=A?+d:+C4(+d,+A)}function hw(d){return d=+d,d>=0?+Xs(d+.5):+sg(d-.5)}function bc(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;if((m|0)>=8192)return xre(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 J4(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 bc(d,A,m)|0;return d|0}function dd(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 aG(d){return d=+d,d>=0?+Xs(d+.5):+sg(d-.5)}function pd(d){d=d|0;var A=0,m=0,_=0;return _=_re()|0,m=h[Ba>>2]|0,A=m+d|0,(d|0)>0&(A|0)<(m|0)|(A|0)<0?(vre(A|0)|0,b9(12),-1):(A|0)>(_|0)&&!(yre(A|0)|0)?(b9(12),-1):(h[Ba>>2]=A,m|0)}function Zse(d,A,m){return d=d|0,A=A|0,m=m|0,Ad[d&3](A|0,m|0)|0}function Qse(d,A){return d=d|0,A=A|0,gre(0),0}var Ad=[Qse,$re,Yre,Kre];return{___divdi3:hd,___muldi3:ur,___remdi3:fd,___uremdi3:ef,_areNeighborCells:Zre,_bitshift64Ashr:sG,_bitshift64Lshr:et,_bitshift64Shl:ht,_calloc:aa,_cellAreaKm2:Dre,_cellAreaM2:Fre,_cellAreaRads2:Lre,_cellToBoundary:D0,_cellToCenterChild:G9,_cellToChildPos:gse,_cellToChildren:lse,_cellToChildrenSize:dx,_cellToLatLng:lg,_cellToLocalIj:Rse,_cellToParent:U4,_cellToVertex:ql,_cellToVertexes:jse,_cellsToDirectedEdge:Qre,_cellsToLinkedMultiPolygon:Nre,_childPosToCell:_se,_compactCells:cse,_constructCell:ose,_destroyLinkedMultiPolygon:Mse,_directedEdgeToBoundary:hx,_directedEdgeToCells:tse,_edgeLengthKm:Tse,_edgeLengthM:Ese,_edgeLengthRads:Sse,_emscripten_replace_memory:bre,_free:_t,_getBaseCellNumber:U9,_getDirectedEdgeDestination:ese,_getDirectedEdgeOrigin:Jre,_getHexagonAreaAvgKm2:q9,_getHexagonAreaAvgM2:vse,_getHexagonEdgeLengthAvgKm:bse,_getHexagonEdgeLengthAvgM:wse,_getIcosahedronFaces:z9,_getIndexDigit:sse,_getNumCells:iw,_getPentagons:q4,_getRes0Cells:Gre,_getResolution:O4,_greatCircleDistanceKm:Ax,_greatCircleDistanceM:yse,_greatCircleDistanceRads:xse,_gridDisk:w9,_gridDiskDistances:S9,_gridDistance:j4,_gridPathCells:Nse,_gridPathCellsSize:Ise,_gridRing:Cre,_gridRingUnsafe:E9,_i64Add:pt,_i64Subtract:Bs,_isPentagon:Gi,_isResClassIII:fse,_isValidCell:nw,_isValidDirectedEdge:D9,_isValidIndex:ase,_isValidVertex:Q9,_latLngToCell:z4,_llvm_ctlz_i64:Q4,_llvm_maxnum_f64:oG,_llvm_minnum_f64:uw,_llvm_round_f64:hw,_localIjToCell:Pse,_malloc:cr,_maxFaceCount:Ase,_maxGridDiskSize:Mre,_maxPolygonToCellsSize:Pre,_maxPolygonToCellsSizeExperimental:Fse,_memcpy:bc,_memmove:J4,_memset:dd,_originToDirectedEdges:L4,_pentagonCount:mse,_polygonToCells:Ire,_polygonToCellsExperimental:Dse,_readInt64AsDoubleFromPointer:qse,_res0CellCount:kre,_reverseDirectedEdge:F9,_round:aG,_sbrk:pd,_sizeOfCellBoundary:Use,_sizeOfCoordIJ:Vse,_sizeOfGeoLoop:kse,_sizeOfGeoPolygon:Gse,_sizeOfH3Index:Ose,_sizeOfLatLng:Bse,_sizeOfLinkedGeoPolygon:zse,_uncompactCells:use,_uncompactCellsSize:hse,_vertexToLatLng:Xse,dynCall_iii:Zse,establishStackSpace:Ere,stackAlloc:wre,stackRestore:Tre,stackSave:Sre}})(Dt,ct,K),jt=e.___divdi3=Ce.___divdi3,Wi=e.___muldi3=Ce.___muldi3,Nn=e.___remdi3=Ce.___remdi3,Vr=e.___uremdi3=Ce.___uremdi3,_r=e._areNeighborCells=Ce._areNeighborCells,ll=e._bitshift64Ashr=Ce._bitshift64Ashr,sa=e._bitshift64Lshr=Ce._bitshift64Lshr,cl=e._bitshift64Shl=Ce._bitshift64Shl,Fa=e._calloc=Ce._calloc,ar=e._cellAreaKm2=Ce._cellAreaKm2,Ds=e._cellAreaM2=Ce._cellAreaM2,ul=e._cellAreaRads2=Ce._cellAreaRads2,mu=e._cellToBoundary=Ce._cellToBoundary,Zb=e._cellToCenterChild=Ce._cellToCenterChild,y4=e._cellToChildPos=Ce._cellToChildPos,v4=e._cellToChildren=Ce._cellToChildren,lx=e._cellToChildrenSize=Ce._cellToChildrenSize,b4=e._cellToLatLng=Ce._cellToLatLng,cx=e._cellToLocalIj=Ce._cellToLocalIj,w4=e._cellToParent=Ce._cellToParent,S4=e._cellToVertex=Ce._cellToVertex,d9=e._cellToVertexes=Ce._cellToVertexes,p9=e._cellsToDirectedEdge=Ce._cellsToDirectedEdge,A9=e._cellsToLinkedMultiPolygon=Ce._cellsToLinkedMultiPolygon,m9=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,zn=e._getBaseCellNumber=Ce._getBaseCellNumber,Yn=e._getDirectedEdgeDestination=Ce._getDirectedEdgeDestination,pn=e._getDirectedEdgeOrigin=Ce._getDirectedEdgeOrigin,ki=e._getHexagonAreaAvgKm2=Ce._getHexagonAreaAvgKm2,qr=e._getHexagonAreaAvgM2=Ce._getHexagonAreaAvgM2,Rr=e._getHexagonEdgeLengthAvgKm=Ce._getHexagonEdgeLengthAvgKm,ji=e._getHexagonEdgeLengthAvgM=Ce._getHexagonEdgeLengthAvgM,ao=e._getIcosahedronFaces=Ce._getIcosahedronFaces,Xt=e._getIndexDigit=Ce._getIndexDigit,Oa=e._getNumCells=Ce._getNumCells,mi=e._getPentagons=Ce._getPentagons,hl=e._getRes0Cells=Ce._getRes0Cells,vc=e._getResolution=Ce._getResolution,Kh=e._greatCircleDistanceKm=Ce._greatCircleDistanceKm,P0=e._greatCircleDistanceM=Ce._greatCircleDistanceM,Xi=e._greatCircleDistanceRads=Ce._greatCircleDistanceRads,Hr=e._gridDisk=Ce._gridDisk,Zh=e._gridDiskDistances=Ce._gridDiskDistances,nr=e._gridDistance=Ce._gridDistance,Qh=e._gridPathCells=Ce._gridPathCells,I0=e._gridPathCellsSize=Ce._gridPathCellsSize,T4=e._gridRing=Ce._gridRing,tPe=e._gridRingUnsafe=Ce._gridRingUnsafe,nPe=e._i64Add=Ce._i64Add,iPe=e._i64Subtract=Ce._i64Subtract,rPe=e._isPentagon=Ce._isPentagon,sPe=e._isResClassIII=Ce._isResClassIII,oPe=e._isValidCell=Ce._isValidCell,aPe=e._isValidDirectedEdge=Ce._isValidDirectedEdge,lPe=e._isValidIndex=Ce._isValidIndex,cPe=e._isValidVertex=Ce._isValidVertex,uPe=e._latLngToCell=Ce._latLngToCell,hPe=e._llvm_ctlz_i64=Ce._llvm_ctlz_i64,fPe=e._llvm_maxnum_f64=Ce._llvm_maxnum_f64,dPe=e._llvm_minnum_f64=Ce._llvm_minnum_f64,pPe=e._llvm_round_f64=Ce._llvm_round_f64,APe=e._localIjToCell=Ce._localIjToCell,mPe=e._malloc=Ce._malloc,gPe=e._maxFaceCount=Ce._maxFaceCount,_Pe=e._maxGridDiskSize=Ce._maxGridDiskSize,xPe=e._maxPolygonToCellsSize=Ce._maxPolygonToCellsSize,yPe=e._maxPolygonToCellsSizeExperimental=Ce._maxPolygonToCellsSizeExperimental,vPe=e._memcpy=Ce._memcpy,bPe=e._memmove=Ce._memmove,wPe=e._memset=Ce._memset,SPe=e._originToDirectedEdges=Ce._originToDirectedEdges,TPe=e._pentagonCount=Ce._pentagonCount,EPe=e._polygonToCells=Ce._polygonToCells,MPe=e._polygonToCellsExperimental=Ce._polygonToCellsExperimental,CPe=e._readInt64AsDoubleFromPointer=Ce._readInt64AsDoubleFromPointer,RPe=e._res0CellCount=Ce._res0CellCount,PPe=e._reverseDirectedEdge=Ce._reverseDirectedEdge,IPe=e._round=Ce._round,NPe=e._sbrk=Ce._sbrk,LPe=e._sizeOfCellBoundary=Ce._sizeOfCellBoundary,DPe=e._sizeOfCoordIJ=Ce._sizeOfCoordIJ,FPe=e._sizeOfGeoLoop=Ce._sizeOfGeoLoop,OPe=e._sizeOfGeoPolygon=Ce._sizeOfGeoPolygon,BPe=e._sizeOfH3Index=Ce._sizeOfH3Index,UPe=e._sizeOfLatLng=Ce._sizeOfLatLng,kPe=e._sizeOfLinkedGeoPolygon=Ce._sizeOfLinkedGeoPolygon,GPe=e._uncompactCells=Ce._uncompactCells,zPe=e._uncompactCellsSize=Ce._uncompactCellsSize,VPe=e._vertexToLatLng=Ce._vertexToLatLng,qPe=e.establishStackSpace=Ce.establishStackSpace,g9=e.stackAlloc=Ce.stackAlloc,dre=e.stackRestore=Ce.stackRestore,pre=e.stackSave=Ce.stackSave,HPe=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));{pi("memory initializer");var E4=function(Ne){Ne.byteLength&&(Ne=new Uint8Array(Ne)),j.set(Ne,x),e.memoryInitializerRequest&&delete e.memoryInitializerRequest.response,Bn("memory initializer")},_9=function(){a(le,E4,function(){throw"could not load memory initializer "+le})},x9=wt(le);if(x9)E4(x9.buffer);else if(e.memoryInitializerRequest){var y9=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),_9();return}}E4(nt)};e.memoryInitializerRequest.response?setTimeout(y9,0):e.memoryInitializerRequest.addEventListener("load",y9)}else _9()}}var Qb;ge=function Ne(){Qb||M4(),Qb||(ge=Ne)};function M4(Ne){if(Ne=Ne||r,Qt>0||(Ct(),Qt>0))return;function nt(){Qb||(Qb=!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=M4;function N0(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=N0,e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return M4(),i})(typeof fi=="object"?fi:{}),wn="number",vn=wn,o1=wn,Tn=wn,En=wn,io=wn,qt=wn,P1e=[["sizeOfH3Index",wn],["sizeOfLatLng",wn],["sizeOfCellBoundary",wn],["sizeOfGeoLoop",wn],["sizeOfGeoPolygon",wn],["sizeOfLinkedGeoPolygon",wn],["sizeOfCoordIJ",wn],["readInt64AsDoubleFromPointer",wn],["isValidCell",o1,[Tn,En]],["isValidIndex",o1,[Tn,En]],["latLngToCell",vn,[wn,wn,io,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,io,wn,qt]],["polygonToCells",vn,[qt,io,wn,qt]],["maxPolygonToCellsSizeExperimental",vn,[qt,io,wn,qt]],["polygonToCellsExperimental",vn,[qt,io,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,io]],["uncompactCellsSize",vn,[qt,wn,wn,io,qt]],["isPentagon",o1,[Tn,En]],["isResClassIII",o1,[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,io,qt]],["cellToChildren",vn,[Tn,En,io,qt]],["cellToCenterChild",vn,[Tn,En,io,qt]],["cellToChildrenSize",vn,[Tn,En,io,qt]],["cellToChildPos",vn,[Tn,En,io,qt]],["childPosToCell",vn,[wn,wn,Tn,En,io,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",o1,[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,[io,qt]],["getHexagonAreaAvgKm2",vn,[io,qt]],["getHexagonEdgeLengthAvgM",vn,[io,qt]],["getHexagonEdgeLengthAvgKm",vn,[io,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,[io,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",o1,[Tn,En]]],I1e=0,N1e=1,L1e=2,D1e=3,AY=4,F1e=5,O1e=6,B1e=7,U1e=8,k1e=9,G1e=10,z1e=11,V1e=12,q1e=13,H1e=14,W1e=15,j1e=16,X1e=17,$1e=18,Y1e=19,fs={};fs[I1e]="Success";fs[N1e]="The operation failed but a more specific error is not available";fs[L1e]="Argument was outside of acceptable range";fs[D1e]="Latitude or longitude arguments were outside of acceptable range";fs[AY]="Resolution argument was outside of acceptable range";fs[F1e]="Cell argument was not valid";fs[O1e]="Directed edge argument was not valid";fs[B1e]="Undirected edge argument was not valid";fs[U1e]="Vertex argument was not valid";fs[k1e]="Pentagon distortion was encountered";fs[G1e]="Duplicate input";fs[z1e]="Cell arguments were not neighbors";fs[V1e]="Cell arguments had incompatible resolutions";fs[q1e]="Memory allocation failed";fs[H1e]="Bounds of provided memory were insufficient";fs[W1e]="Mode or flags argument was not valid";fs[j1e]="Index argument was not valid";fs[X1e]="Base cell number was outside of acceptable range";fs[$1e]="Child indexing digits invalid";fs[Y1e]="Child indexing digits refer to a deleted subsequence";var K1e=1e3,mY=1001,gY=1002,BE={};BE[K1e]="Unknown unit";BE[mY]="Array length out of bounds";BE[gY]="Got unexpected null value for H3 index";var Z1e="Unknown error";function _Y(i,e,t){var n=t&&"value"in t,r=new Error((i[e]||Z1e)+" (code: "+e+(n?", value: "+t.value:"")+")");return r.code=e,r}function xY(i,e){var t=arguments.length===2?{value:e}:{};return _Y(fs,i,t)}function yY(i,e){var t=arguments.length===2?{value:e}:{};return _Y(BE,i,t)}function Rv(i){if(i!==0)throw xY(i)}var nl={};P1e.forEach(function(e){nl[e[0]]=fi.cwrap.apply(fi,e)});var a1=16;var Pv=4;var l1=8,Q1e=8,FE=nl.sizeOfH3Index(),r8=nl.sizeOfLatLng(),J1e=nl.sizeOfCellBoundary(),exe=nl.sizeOfGeoPolygon(),Cv=nl.sizeOfGeoLoop(),aet=nl.sizeOfLinkedGeoPolygon(),cet=nl.sizeOfCoordIJ();function txe(i){if(typeof i!="number"||i<0||i>15||Math.floor(i)!==i)throw xY(AY,i);return i}function nxe(i){if(!i)throw yY(gY);return i}var ixe=Math.pow(2,32)-1,uet=Math.pow(2,31)-1;function rxe(i){if(i>ixe)throw yY(mY,i);return i}var sxe=/[^0-9a-fA-F]/;function vY(i){if(Array.isArray(i)&&i.length===2&&Number.isInteger(i[0])&&Number.isInteger(i[1]))return i;if(typeof i!="string"||sxe.test(i))return[0,0];var e=parseInt(i.substring(0,i.length-8),a1),t=parseInt(i.substring(i.length-8),a1);return[t,e]}function dY(i){if(i>=0)return i.toString(a1);i=i&2147483647;var e=bY(8,i.toString(a1)),t=(parseInt(e[0],a1)+8).toString(a1);return e=t+e.substring(1),e}function oxe(i,e){return dY(e)+bY(8,dY(i))}function bY(i,e){for(var t=i-e.length,n="",r=0;r<t;r++)n+="0";return n=n+e,n}var het=Math.pow(2,32);function pY(i,e,t){for(var n=i.length,r=fi._calloc(n,r8),s=t?1:0,o=t?0:1,a=0;a<n*2;a+=2)fi.HEAPF64.set([i[a/2][s],i[a/2][o]].map(EY),r/l1+a);return fi.HEAPU32.set([n,r],e/Pv),e}function axe(i,e){var t=i.length-1,n=fi._calloc(exe),r=0,s=r+Cv,o=s+Pv;pY(i[0],n+r,e);var a;if(t>0){a=fi._calloc(t,Cv);for(var l=0;l<t;l++)pY(i[l+1],a+Cv*l,e)}return fi.setValue(n+s,t,"i32"),fi.setValue(n+o,a,"i32"),n}function lxe(i){var e=0,t=e+Cv,n=t+Pv,r=Pv;fi._free(fi.getValue(i+e+r,"i8*"));var s=fi.getValue(i+t,"i32");if(s>0){for(var o=fi.getValue(i+n,"i32"),a=0;a<s;a++)fi._free(fi.getValue(o+Cv*a+r,"i8*"));fi._free(o)}fi._free(i)}function wY(i,e){e===void 0&&(e=0);var t=fi.getValue(i+FE*e,"i32"),n=fi.getValue(i+FE*e+Pv,"i32");return n?oxe(t,n):null}function cxe(i){return nl.readInt64AsDoubleFromPointer(i)}function uxe(i,e){for(var t=[],n=0;n<e;n++){var r=wY(i,n);r!==null&&t.push(r)}return t}function OE(i){return dxe(fi.getValue(i,"double"))}function SY(i){return[OE(i),OE(i+l1)]}function hxe(i){return[OE(i+l1),OE(i)]}function fxe(i,e,t){for(var n=fi.getValue(i,"i32"),r=i+l1,s=[],o=e?hxe:SY,a=0;a<n*2;a+=2)s.push(o(r+l1*a));return t&&s.push(s[0]),s}function TY(i,e,t){var n=fi._malloc(r8);fi.HEAPF64.set([i,e].map(EY),n/l1);var r=fi._malloc(FE);try{return Rv(nl.latLngToCell(n,t,r)),nxe(wY(r))}finally{fi._free(r),fi._free(n)}}function s8(i){var e=fi._malloc(r8),t=vY(i),n=t[0],r=t[1];try{return Rv(nl.cellToLatLng(n,r,e)),SY(e)}finally{fi._free(e)}}function o8(i,e){var t=fi._malloc(J1e),n=vY(i),r=n[0],s=n[1];try{return Rv(nl.cellToBoundary(r,s,t)),fxe(t,e,e)}finally{fi._free(t)}}function a8(i,e,t){if(txe(e),t=!!t,i.length===0||i[0].length===0)return[];var n=typeof i[0][0]=="number"?[i]:i,r=axe(n,t),s=fi._malloc(Q1e);try{Rv(nl.maxPolygonToCellsSize(r,e,0,s));var o=rxe(cxe(s)),a=fi._calloc(o,FE);try{return Rv(nl.polygonToCells(r,e,0,a)),uxe(a,o)}finally{fi._free(a)}}finally{fi._free(s),lxe(r)}}function EY(i){return i*Math.PI/180}function dxe(i){return i*180/Math.PI}function l8(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 pxe=["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"],MY=new WeakMap,CY=new WeakMap,RY=new WeakMap,X8=class{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=pxe,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=RY.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}},RY.set(e,t)),t}getMaterialData(e){let t=CY.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)}CY.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,R=w?w.id:null,P=w?w.version:null;if(S!==R||T!==P)return c.indexId=R,c.indexVersion=P,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=MY.get(e);return n===void 0&&(n={renderId:-1,lightsData:[]},MY.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}},Axe=[/^StackTrace\.js$/,/^TSLCore\.js$/,/^.*Node\.js$/,/^three\.webgpu.*\.js$/];function mxe(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&&!Axe.some(n=>n.test(t.file)))}var kr=class{constructor(e=null){this.isStackTrace=!0,this.stack=mxe(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 N7(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 V1=i=>N7(i),Tb=i=>N7(i),Yv=(...i)=>N7(i),dxe=new Map([[1,"float"],[2,"vec2"],[3,"vec3"],[4,"vec4"],[9,"mat3"],[16,"mat4"]]),CY=new WeakMap;function KK(i){return dxe.get(i)}function EM(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 ZK(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 kr)}function pxe(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 kr)}function Axe(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 kr)}function o0(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 L7(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 P_(...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"?gxe(e[0]):null}function QK(i){let e=CY.get(i);return e===void 0&&(e={},CY.set(i,e)),e}function mxe(i){let e="",t=new Uint8Array(i);for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function gxe(i){return Uint8Array.from(atob(i),e=>e.charCodeAt(0)).buffer}var v1={VERTEX:"vertex",FRAGMENT:"fragment"},_n={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},_xe={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},Mo={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},JK=["fragment","vertex"],yM=["setup","analyze","generate"],vM=[...JK,"compute"],jm=["x","y","z","w"],xxe={analyze:"setup",generate:"analyze"},yxe=0,$t=class i extends qo{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=yxe++,this.stackTrace=null,i.captureStackTrace===!0&&(this.stackTrace=new kr)}set needsUpdate(e){e===!0&&this.version++}get uuid(){return this._uuid===null&&(this._uuid=Yc.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(V1(r.slice(0,-4)),s.getCacheKey(e,t));this._cacheKey=Yv(Tb(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=xxe[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 td=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} ]`}},MM=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)}},Ar=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)}},X8=class extends Ar{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)}},vxe=jm.join(""),CM=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(jm.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===vxe.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}},$8=class extends Ar{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=jm[p];x===n[0]?(f.push(l),p+=n.length-1):f.push(c+"."+x)}return`${e.getType(s)}( ${f.join(", ")} )`}},Y8=class extends Ar{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=jm[f];p===t[u]?(c.push("1.0 - "+(a+"."+p)),u++):c.push(a+"."+p)}return`${e.getType(r)}( ${c.join(", ")} )`}},rb=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?o0(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=o0(this.value),e.nodeType=this.nodeType,e.valueType==="ArrayBuffer"&&(e.value=mxe(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?L7(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.")}},RY=/float|u?int/,gc=class extends rb{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 RY.test(n)&&RY.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),n,t)}},K8=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}},u0=null,Z8=new Map;function Be(i,e){if(Z8.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`);Z8.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 bxe=i=>i.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),PY=i=>bxe(i).split("").sort().join("");$t.prototype.assign=function(...i){if(this.isStackNode!==!0)return u0!==null?u0.assign(this,...i):Ge("TSL: No stack defined for assign operation. Make sure the assign is inside a Fn().",new kr),this;{let e=Z8.get("assign");return this.addToStack(e(...i))}};$t.prototype.toVarIntent=function(){return this};$t.prototype.get=function(i){return new K8(this,i)};var Kv={};function BE(i,e,t){Kv[i]=Kv[e]=Kv[t]={get(){this._cache=this._cache||{};let o=this._cache[i];return o===void 0&&(o=new CM(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=PY(i);return new $8(this,a,Vt(o))},$t.prototype["flip"+n]=$t.prototype["flip"+r]=$t.prototype["flip"+s]=function(){let o=PY(i);return new Y8(this,o)}}var gh=["x","y","z","w"],_h=["r","g","b","a"],xh=["s","t","p","q"];for(let i=0;i<4;i++){let e=gh[i],t=_h[i],n=xh[i];BE(e,t,n);for(let r=0;r<4;r++){e=gh[i]+gh[r],t=_h[i]+_h[r],n=xh[i]+xh[r],BE(e,t,n);for(let s=0;s<4;s++){e=gh[i]+gh[r]+gh[s],t=_h[i]+_h[r]+_h[s],n=xh[i]+xh[r]+xh[s],BE(e,t,n);for(let o=0;o<4;o++)e=gh[i]+gh[r]+gh[s]+gh[o],t=_h[i]+_h[r]+_h[s]+_h[o],n=xh[i]+xh[r]+xh[s]+xh[o],BE(e,t,n)}}}for(let i=0;i<32;i++)Kv[i]={get(){this._cache=this._cache||{};let e=this._cache[i];return e===void 0&&(e=new td(this,new gc(i,"uint")),this._cache[i]=e),e},set(e){this[i].assign(Vt(e))}};Object.defineProperties($t.prototype,Kv);var wxe=function(i,e=null){let t=o0(i);return t==="node"?i:e===null&&(t==="float"||t==="boolean")||t&&t!=="shader"&&t!=="string"?Vt(eF(i,e)):t==="shader"?i.isFn?i:Ae(i):i},Sxe=function(i,e=null){for(let t in i)i[t]=Vt(i[t],e);return i},Txe=function(i,e=null){let t=i.length;for(let n=0;n<t;n++)i[n]=Vt(i[n],e);return i},eZ=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 kr),u.concat(new Array(a-u.length).fill(0))):l!==void 0&&u.length>l?(Ge(`TSL: "${f}" parameter length exceeds limit.`,new kr),u.slice(0,l)):u}return e===null?s=(...u)=>r(new i(...Pm(c(u)))):t!==null?(t=Vt(t),s=(...u)=>r(new i(e,...Pm(c(u)),t))):s=(...u)=>r(new i(e,...Pm(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},Exe=function(i,...e){return new i(...Pm(e))},Q8=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(tZ(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?Mxe(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?Cxe(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 tZ(i){return i[0]&&(i[0].isNode||Object.getPrototypeOf(i[0])!==Object.prototype)}function Mxe(i){let e;return zC(i),tZ(i)?e=[...i]:e=i[0],e}function Cxe(i){let e=0;return zC(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 J8=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 Q8(this,e)}setup(){return this.call()}},Rxe=[!1,!0],Pxe=[0,1,2,3],Ixe=[-1,-2],nZ=[.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],D7=new Map;for(let i of Rxe)D7.set(i,new gc(i));var F7=new Map;for(let i of Pxe)F7.set(i,new gc(i,"uint"));var O7=new Map([...F7].map(i=>new gc(i.value,"int")));for(let i of Ixe)O7.set(i,new gc(i,"int"));var kC=new Map([...O7].map(i=>new gc(i.value)));for(let i of nZ)kC.set(i,new gc(i));for(let i of nZ)kC.set(-i,new gc(-i));var GC={bool:D7,uint:F7,ints:O7,float:kC},IY=new Map([...D7,...kC]),eF=(i,e)=>IY.has(i)?IY.get(i):i.isNode===!0?i:new gc(i,e),Ls=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 kr),new gc(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=[L7(i,...t)]),t.length===1&&e!==null&&e.has(t[0]))return Xv(e.get(t[0]));if(t.length===1){let r=eF(t[0],i);return r.nodeType===i?Xv(r):Xv(new MM(r,i))}let n=t.map(r=>eF(r));return Xv(new X8(n,i))}};function N1(i){return i&&i.isNode&&i.traverse(e=>{e.isConstNode&&(i=e.value)}),!!i}var iZ=i=>i!=null?i.nodeType||i.convertTo||(typeof i=="string"?i:null):null;function S1(i,e){return new J8(i,e)}var Vt=(i,e=null)=>wxe(i,e),Xv=(i,e=null)=>Vt(i,e).toVarIntent(),zC=(i,e=null)=>new Sxe(i,e),Pm=(i,e=null)=>new Txe(i,e),Hn=(i,e=null,t=null,n=null)=>new eZ(i,e,t,n),xt=(i,...e)=>new Exe(i,...e),lt=(i,e=null,t=null,n={})=>new eZ(i,e,t,{...n,intent:!0}),B7=(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)}}),Nxe=0,tF=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 kr),t=null)),this.shaderNode=new S1(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"+Nxe++,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 tF(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 sb=i=>{u0=i},U7=()=>u0,Wt=(...i)=>u0.If(...i),Lxe=(...i)=>u0.Switch(...i);function VC(i){return u0&&u0.addToStack(i),i}Be("toStack",VC);var rZ=new Ls("color"),se=new Ls("float",GC.float),fe=new Ls("int",GC.ints),it=new Ls("uint",GC.uint),Fl=new Ls("bool",GC.bool),ft=new Ls("vec2"),Tr=new Ls("ivec2"),k7=new Ls("uvec2"),sZ=new Ls("bvec2"),pe=new Ls("vec3"),G7=new Ls("ivec3"),Xm=new Ls("uvec3"),z7=new Ls("bvec3"),Lt=new Ls("vec4"),V7=new Ls("ivec4"),q7=new Ls("uvec4"),oZ=new Ls("bvec4"),qC=new Ls("mat2"),so=new Ls("mat3"),l0=new Ls("mat4");Be("toColor",rZ);Be("toFloat",se);Be("toInt",fe);Be("toUint",it);Be("toBool",Fl);Be("toVec2",ft);Be("toIVec2",Tr);Be("toUVec2",k7);Be("toBVec2",sZ);Be("toVec3",pe);Be("toIVec3",G7);Be("toUVec3",Xm);Be("toBVec3",z7);Be("toVec4",Lt);Be("toIVec4",V7);Be("toUVec4",q7);Be("toBVec4",oZ);Be("toMat2",qC);Be("toMat3",so);Be("toMat4",l0);var aZ=Hn(td).setParameterLength(2),lZ=(i,e)=>new MM(Vt(i),e),Dxe=(i,e)=>new CM(Vt(i),e);Be("element",aZ);Be("convert",lZ);var Fxe=i=>(je("TSL: append() has been renamed to Stack().",new kr),VC(i));Be("append",i=>(je("TSL: .append() has been renamed to .toStack().",new kr),VC(i)));var di=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 V1(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)}},rd=(i,e,t=null)=>new di(i,e,!1,t),$m=(i,e,t=null)=>new di(i,e,!0,t),Ci=xt(di,"vec4","DiffuseColor"),Sm=xt(di,"vec3","DiffuseContribution"),nF=xt(di,"vec3","EmissiveColor"),Eh=xt(di,"float","Roughness"),ed=xt(di,"float","Metalness"),RM=xt(di,"float","Clearcoat"),E1=xt(di,"float","ClearcoatRoughness"),Il=xt(di,"vec3","Sheen"),t0=xt(di,"float","SheenRoughness"),HC=xt(di,"float","Iridescence"),PM=xt(di,"float","IridescenceIOR"),IM=xt(di,"float","IridescenceThickness"),NM=xt(di,"float","AlphaT"),e0=xt(di,"float","Anisotropy"),Zv=xt(di,"vec3","AnisotropyT"),Im=xt(di,"vec3","AnisotropyB"),h0=xt(di,"color","SpecularColor"),Em=xt(di,"color","SpecularColorBlended"),Mm=xt(di,"float","SpecularF90"),LM=xt(di,"float","Shininess"),M1=xt(di,"output","Output"),Nm=xt(di,"float","dashSize"),ob=xt(di,"float","gapSize"),Oxe=xt(di,"float","pointWidth"),Qv=xt(di,"float","IOR"),DM=xt(di,"float","Transmission"),H7=xt(di,"float","Thickness"),W7=xt(di,"float","AttenuationDistance"),j7=xt(di,"color","AttenuationColor"),X7=xt(di,"float","Dispersion"),iF=xt(di,"float","AmbientOcclusion",!1,1),FM=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}},cZ=(i,e=1,t=null)=>new FM(i,!1,e,t),WC=(i,e=0,t=null)=>new FM(i,!0,e,t),Bxe=WC("frame",0,_n.FRAME),Kt=WC("render",0,_n.RENDER),uZ=cZ("object",1,_n.OBJECT),Bm=class extends rb{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=uZ}setName(e){return this.name=e,this}label(e){return je('TSL: "label()" has been deprecated. Use "setName()" instead.',new kr),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=iZ(e||i);if(t===i&&(i=L7(t)),i&&i.isNode===!0){let n=i.value;i.traverse(r=>{r.isConstNode===!0&&(n=r.value)}),i=n}return new Bm(i,t)},OM=class extends Ar{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)}},hZ=(...i)=>{let e;if(i.length===1){let t=i[0];e=new OM(null,t.length,t)}else{let t=i[0],n=i[1];e=new OM(t,n)}return Vt(e)};Be("toArray",(i,e)=>hZ(Array(e).fill(i)));var rF=class extends Ar{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 jm.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)}},fZ=Hn(rF).setParameterLength(2);Be("assign",fZ);var sF=class extends Ar{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(", ")} )`}},dZ=(i,...e)=>(e=e.length>1||e[0]&&e[0].isNode===!0?Pm(e):zC(e[0]),new sF(Vt(i),e));Be("call",dZ);var Uxe={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"},Gr=class i extends Ar{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(Uxe[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===go;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}},ps=lt(Gr,"+").setParameterLength(2,1/0).setName("add"),ii=lt(Gr,"-").setParameterLength(2,1/0).setName("sub"),bn=lt(Gr,"*").setParameterLength(2,1/0).setName("mul"),Ol=lt(Gr,"/").setParameterLength(2,1/0).setName("div"),jC=lt(Gr,"%").setParameterLength(2).setName("mod"),pZ=lt(Gr,"==").setParameterLength(2).setName("equal"),AZ=lt(Gr,"!=").setParameterLength(2).setName("notEqual"),mZ=lt(Gr,"<").setParameterLength(2).setName("lessThan"),$7=lt(Gr,">").setParameterLength(2).setName("greaterThan"),gZ=lt(Gr,"<=").setParameterLength(2).setName("lessThanEqual"),_Z=lt(Gr,">=").setParameterLength(2).setName("greaterThanEqual"),xZ=lt(Gr,"&&").setParameterLength(2,1/0).setName("and"),yZ=lt(Gr,"||").setParameterLength(2,1/0).setName("or"),vZ=lt(Gr,"!").setParameterLength(1).setName("not"),bZ=lt(Gr,"^^").setParameterLength(2).setName("xor"),wZ=lt(Gr,"&").setParameterLength(2).setName("bitAnd"),SZ=lt(Gr,"~").setParameterLength(1).setName("bitNot"),TZ=lt(Gr,"|").setParameterLength(2).setName("bitOr"),EZ=lt(Gr,"^").setParameterLength(2).setName("bitXor"),MZ=lt(Gr,"<<").setParameterLength(2).setName("shiftLeft"),CZ=lt(Gr,">>").setParameterLength(2).setName("shiftRight"),RZ=Ae(([i])=>(i.addAssign(1),i)),PZ=Ae(([i])=>(i.subAssign(1),i)),IZ=Ae(([i])=>{let e=fe(i).toConst();return i.addAssign(1),e}),NZ=Ae(([i])=>{let e=fe(i).toConst();return i.subAssign(1),e});Be("add",ps);Be("sub",ii);Be("mul",bn);Be("div",Ol);Be("mod",jC);Be("equal",pZ);Be("notEqual",AZ);Be("lessThan",mZ);Be("greaterThan",$7);Be("lessThanEqual",gZ);Be("greaterThanEqual",_Z);Be("and",xZ);Be("or",yZ);Be("not",vZ);Be("xor",bZ);Be("bitAnd",wZ);Be("bitNot",SZ);Be("bitOr",TZ);Be("bitXor",EZ);Be("shiftLeft",MZ);Be("shiftRight",CZ);Be("incrementBefore",RZ);Be("decrementBefore",PZ);Be("increment",IZ);Be("decrement",NZ);var Re=class i extends Ar{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=ii(1,t);else if(r===i.RECIPROCAL)s=Ol(1,t);else if(r===i.DIFFERENCE)s=er(ii(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=ta(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===go&&r===i.STEP?f.push(a.build(e,e.getTypeLength(a.getNodeType(e))===1?"float":o),l.build(e,o)):u===go&&(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===Xa&&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 XC=se(1e-6),kxe=se(1e6),BM=se(Math.PI),Gxe=se(Math.PI*2),zxe=se(Math.PI*2),Vxe=se(Math.PI*.5),LZ=lt(Re,Re.ALL).setParameterLength(1),DZ=lt(Re,Re.ANY).setParameterLength(1),FZ=lt(Re,Re.RADIANS).setParameterLength(1),OZ=lt(Re,Re.DEGREES).setParameterLength(1),Y7=lt(Re,Re.EXP).setParameterLength(1),L1=lt(Re,Re.EXP2).setParameterLength(1),$C=lt(Re,Re.LOG).setParameterLength(1),Ch=lt(Re,Re.LOG2).setParameterLength(1),Ia=lt(Re,Re.SQRT).setParameterLength(1),K7=lt(Re,Re.INVERSE_SQRT).setParameterLength(1),Rh=lt(Re,Re.FLOOR).setParameterLength(1),YC=lt(Re,Re.CEIL).setParameterLength(1),ta=lt(Re,Re.NORMALIZE).setParameterLength(1),au=lt(Re,Re.FRACT).setParameterLength(1),Ca=lt(Re,Re.SIN).setParameterLength(1),BZ=lt(Re,Re.SINH).setParameterLength(1),iu=lt(Re,Re.COS).setParameterLength(1),UZ=lt(Re,Re.COSH).setParameterLength(1),kZ=lt(Re,Re.TAN).setParameterLength(1),GZ=lt(Re,Re.TANH).setParameterLength(1),zZ=lt(Re,Re.ASIN).setParameterLength(1),VZ=lt(Re,Re.ASINH).setParameterLength(1),Z7=lt(Re,Re.ACOS).setParameterLength(1),qZ=lt(Re,Re.ACOSH).setParameterLength(1),Q7=lt(Re,Re.ATAN).setParameterLength(1,2),HZ=lt(Re,Re.ATANH).setParameterLength(1),er=lt(Re,Re.ABS).setParameterLength(1),J7=lt(Re,Re.SIGN).setParameterLength(1),Ph=lt(Re,Re.LENGTH).setParameterLength(1),eU=lt(Re,Re.NEGATE).setParameterLength(1),WZ=lt(Re,Re.ONE_MINUS).setParameterLength(1),tU=lt(Re,Re.DFDX).setParameterLength(1),nU=lt(Re,Re.DFDY).setParameterLength(1),jZ=lt(Re,Re.ROUND).setParameterLength(1),XZ=lt(Re,Re.RECIPROCAL).setParameterLength(1),iU=lt(Re,Re.TRUNC).setParameterLength(1),rU=lt(Re,Re.FWIDTH).setParameterLength(1),$Z=lt(Re,Re.TRANSPOSE).setParameterLength(1),YZ=lt(Re,Re.DETERMINANT).setParameterLength(1),KZ=lt(Re,Re.INVERSE).setParameterLength(1),il=lt(Re,Re.MIN).setParameterLength(2,1/0),Er=lt(Re,Re.MAX).setParameterLength(2,1/0),Um=lt(Re,Re.STEP).setParameterLength(2),ZZ=lt(Re,Re.REFLECT).setParameterLength(2),QZ=lt(Re,Re.DISTANCE).setParameterLength(2),JZ=lt(Re,Re.DIFFERENCE).setParameterLength(2),_c=lt(Re,Re.DOT).setParameterLength(2),nd=lt(Re,Re.CROSS).setParameterLength(2),pc=lt(Re,Re.POW).setParameterLength(2),sU=i=>bn(i,i),eQ=i=>bn(i,i,i),oU=i=>bn(i,i,i,i),tQ=lt(Re,Re.TRANSFORM_DIRECTION).setParameterLength(2),nQ=(i,e)=>ta(bn(e,Lt(pe(i),0)).xyz),iQ=(i,e)=>ta(Lt(pe(i),0).mul(e).xyz),rQ=i=>bn(J7(i),pc(er(i),1/3)),aU=i=>_c(i,i),Xn=lt(Re,Re.MIX).setParameterLength(3),lu=(i,e=0,t=1)=>new Re(Re.CLAMP,Vt(i),Vt(e),Vt(t)),KC=i=>lu(i),lU=lt(Re,Re.REFRACT).setParameterLength(3),Bl=lt(Re,Re.SMOOTHSTEP).setParameterLength(3),cU=lt(Re,Re.FACEFORWARD).setParameterLength(3),sQ=Ae(([i])=>{let n=43758.5453,r=_c(i.xy,ft(12.9898,78.233)),s=jC(r,BM);return au(Ca(s).mul(n))}),oQ=(i,e,t)=>Xn(e,t,i),aQ=(i,e,t)=>Bl(e,t,i),lQ=(i,e)=>Um(e,i),qxe=cU,Hxe=K7;Be("all",LZ);Be("any",DZ);Be("radians",FZ);Be("degrees",OZ);Be("exp",Y7);Be("exp2",L1);Be("log",$C);Be("log2",Ch);Be("sqrt",Ia);Be("inverseSqrt",K7);Be("floor",Rh);Be("ceil",YC);Be("normalize",ta);Be("fract",au);Be("sin",Ca);Be("sinh",BZ);Be("cos",iu);Be("cosh",UZ);Be("tan",kZ);Be("tanh",GZ);Be("asin",zZ);Be("asinh",VZ);Be("acos",Z7);Be("acosh",qZ);Be("atan",Q7);Be("atanh",HZ);Be("abs",er);Be("sign",J7);Be("length",Ph);Be("lengthSq",aU);Be("negate",eU);Be("oneMinus",WZ);Be("dFdx",tU);Be("dFdy",nU);Be("round",jZ);Be("reciprocal",XZ);Be("trunc",iU);Be("fwidth",rU);Be("min",il);Be("max",Er);Be("step",lQ);Be("reflect",ZZ);Be("distance",QZ);Be("dot",_c);Be("cross",nd);Be("pow",pc);Be("pow2",sU);Be("pow3",eQ);Be("pow4",oU);Be("transformDirection",tQ);Be("transformNormalByViewMatrix",nQ);Be("transformNormalByInverseViewMatrix",iQ);Be("mix",oQ);Be("clamp",lu);Be("refract",lU);Be("smoothstep",aQ);Be("faceForward",cU);Be("difference",JZ);Be("saturate",KC);Be("cbrt",rQ);Be("transpose",$Z);Be("determinant",YZ);Be("inverse",KZ);Be("rand",sQ);var oF=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?rd(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 L7(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 q1=i=>L7(i),Mb=i=>L7(i),Zv=(...i)=>L7(i),gxe=new Map([[1,"float"],[2,"vec2"],[3,"vec3"],[4,"vec4"],[9,"mat3"],[16,"mat4"]]),PY=new WeakMap;function QK(i){return gxe.get(i)}function MM(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 JK(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 kr)}function _xe(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 kr)}function xxe(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 kr)}function o0(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 D7(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 I_(...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"?vxe(e[0]):null}function eZ(i){let e=PY.get(i);return e===void 0&&(e={},PY.set(i,e)),e}function yxe(i){let e="",t=new Uint8Array(i);for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function vxe(i){return Uint8Array.from(atob(i),e=>e.charCodeAt(0)).buffer}var b1={VERTEX:"vertex",FRAGMENT:"fragment"},_n={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},bxe={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},Co={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},tZ=["fragment","vertex"],vM=["setup","analyze","generate"],bM=[...tZ,"compute"],jm=["x","y","z","w"],wxe={analyze:"setup",generate:"analyze"},Sxe=0,$t=class i extends Ho{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=Sxe++,this.stackTrace=null,i.captureStackTrace===!0&&(this.stackTrace=new kr)}set needsUpdate(e){e===!0&&this.version++}get uuid(){return this._uuid===null&&(this._uuid=Yc.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(q1(r.slice(0,-4)),s.getCacheKey(e,t));this._cacheKey=Zv(Mb(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=wxe[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 td=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)}},Ar=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)}},$8=class extends Ar{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)}},Txe=jm.join(""),RM=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(jm.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===Txe.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}},Y8=class extends Ar{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=jm[p];x===n[0]?(f.push(l),p+=n.length-1):f.push(c+"."+x)}return`${e.getType(s)}( ${f.join(", ")} )`}},K8=class extends Ar{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=jm[f];p===t[u]?(c.push("1.0 - "+(a+"."+p)),u++):c.push(a+"."+p)}return`${e.getType(r)}( ${c.join(", ")} )`}},ob=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?o0(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=o0(this.value),e.nodeType=this.nodeType,e.valueType==="ArrayBuffer"&&(e.value=yxe(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?D7(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.")}},IY=/float|u?int/,gc=class extends ob{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 IY.test(n)&&IY.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),n,t)}},Z8=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}},u0=null,Q8=new Map;function Be(i,e){if(Q8.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`);Q8.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 Exe=i=>i.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),NY=i=>Exe(i).split("").sort().join("");$t.prototype.assign=function(...i){if(this.isStackNode!==!0)return u0!==null?u0.assign(this,...i):Ge("TSL: No stack defined for assign operation. Make sure the assign is inside a Fn().",new kr),this;{let e=Q8.get("assign");return this.addToStack(e(...i))}};$t.prototype.toVarIntent=function(){return this};$t.prototype.get=function(i){return new Z8(this,i)};var Qv={};function UE(i,e,t){Qv[i]=Qv[e]=Qv[t]={get(){this._cache=this._cache||{};let o=this._cache[i];return o===void 0&&(o=new RM(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=NY(i);return new Y8(this,a,Vt(o))},$t.prototype["flip"+n]=$t.prototype["flip"+r]=$t.prototype["flip"+s]=function(){let o=NY(i);return new K8(this,o)}}var gh=["x","y","z","w"],_h=["r","g","b","a"],xh=["s","t","p","q"];for(let i=0;i<4;i++){let e=gh[i],t=_h[i],n=xh[i];UE(e,t,n);for(let r=0;r<4;r++){e=gh[i]+gh[r],t=_h[i]+_h[r],n=xh[i]+xh[r],UE(e,t,n);for(let s=0;s<4;s++){e=gh[i]+gh[r]+gh[s],t=_h[i]+_h[r]+_h[s],n=xh[i]+xh[r]+xh[s],UE(e,t,n);for(let o=0;o<4;o++)e=gh[i]+gh[r]+gh[s]+gh[o],t=_h[i]+_h[r]+_h[s]+_h[o],n=xh[i]+xh[r]+xh[s]+xh[o],UE(e,t,n)}}}for(let i=0;i<32;i++)Qv[i]={get(){this._cache=this._cache||{};let e=this._cache[i];return e===void 0&&(e=new td(this,new gc(i,"uint")),this._cache[i]=e),e},set(e){this[i].assign(Vt(e))}};Object.defineProperties($t.prototype,Qv);var Mxe=function(i,e=null){let t=o0(i);return t==="node"?i:e===null&&(t==="float"||t==="boolean")||t&&t!=="shader"&&t!=="string"?Vt(tF(i,e)):t==="shader"?i.isFn?i:Ae(i):i},Cxe=function(i,e=null){for(let t in i)i[t]=Vt(i[t],e);return i},Rxe=function(i,e=null){let t=i.length;for(let n=0;n<t;n++)i[n]=Vt(i[n],e);return i},nZ=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 kr),u.concat(new Array(a-u.length).fill(0))):l!==void 0&&u.length>l?(Ge(`TSL: "${f}" parameter length exceeds limit.`,new kr),u.slice(0,l)):u}return e===null?s=(...u)=>r(new i(...Pm(c(u)))):t!==null?(t=Vt(t),s=(...u)=>r(new i(e,...Pm(c(u)),t))):s=(...u)=>r(new i(e,...Pm(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},Pxe=function(i,...e){return new i(...Pm(e))},J8=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(iZ(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?Ixe(n):null;c=u.call(f)}else{let u=new Proxy(e,{get:(w,S,T)=>{let R;return Symbol.iterator===S?R=function*(){yield void 0}:R=Reflect.get(w,S,T),R}}),f=n?Nxe(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 iZ(i){return i[0]&&(i[0].isNode||Object.getPrototypeOf(i[0])!==Object.prototype)}function Ixe(i){let e;return VC(i),iZ(i)?e=[...i]:e=i[0],e}function Nxe(i){let e=0;return VC(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 eF=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 J8(this,e)}setup(){return this.call()}},Lxe=[!1,!0],Dxe=[0,1,2,3],Fxe=[-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],F7=new Map;for(let i of Lxe)F7.set(i,new gc(i));var O7=new Map;for(let i of Dxe)O7.set(i,new gc(i,"uint"));var B7=new Map([...O7].map(i=>new gc(i.value,"int")));for(let i of Fxe)B7.set(i,new gc(i,"int"));var GC=new Map([...B7].map(i=>new gc(i.value)));for(let i of rZ)GC.set(i,new gc(i));for(let i of rZ)GC.set(-i,new gc(-i));var zC={bool:F7,uint:O7,ints:B7,float:GC},LY=new Map([...F7,...GC]),tF=(i,e)=>LY.has(i)?LY.get(i):i.isNode===!0?i:new gc(i,e),Ls=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 kr),new gc(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=[D7(i,...t)]),t.length===1&&e!==null&&e.has(t[0]))return Yv(e.get(t[0]));if(t.length===1){let r=tF(t[0],i);return r.nodeType===i?Yv(r):Yv(new CM(r,i))}let n=t.map(r=>tF(r));return Yv(new $8(n,i))}};function L1(i){return i&&i.isNode&&i.traverse(e=>{e.isConstNode&&(i=e.value)}),!!i}var sZ=i=>i!=null?i.nodeType||i.convertTo||(typeof i=="string"?i:null):null;function T1(i,e){return new eF(i,e)}var Vt=(i,e=null)=>Mxe(i,e),Yv=(i,e=null)=>Vt(i,e).toVarIntent(),VC=(i,e=null)=>new Cxe(i,e),Pm=(i,e=null)=>new Rxe(i,e),Hn=(i,e=null,t=null,n=null)=>new nZ(i,e,t,n),xt=(i,...e)=>new Pxe(i,...e),lt=(i,e=null,t=null,n={})=>new nZ(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)}}),Oxe=0,nF=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 kr),t=null)),this.shaderNode=new T1(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"+Oxe++,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 nF(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 ab=i=>{u0=i},k7=()=>u0,Wt=(...i)=>u0.If(...i),Bxe=(...i)=>u0.Switch(...i);function qC(i){return u0&&u0.addToStack(i),i}Be("toStack",qC);var oZ=new Ls("color"),se=new Ls("float",zC.float),fe=new Ls("int",zC.ints),it=new Ls("uint",zC.uint),Fl=new Ls("bool",zC.bool),ft=new Ls("vec2"),Tr=new Ls("ivec2"),G7=new Ls("uvec2"),aZ=new Ls("bvec2"),pe=new Ls("vec3"),z7=new Ls("ivec3"),Xm=new Ls("uvec3"),V7=new Ls("bvec3"),Lt=new Ls("vec4"),q7=new Ls("ivec4"),H7=new Ls("uvec4"),lZ=new Ls("bvec4"),HC=new Ls("mat2"),so=new Ls("mat3"),l0=new Ls("mat4");Be("toColor",oZ);Be("toFloat",se);Be("toInt",fe);Be("toUint",it);Be("toBool",Fl);Be("toVec2",ft);Be("toIVec2",Tr);Be("toUVec2",G7);Be("toBVec2",aZ);Be("toVec3",pe);Be("toIVec3",z7);Be("toUVec3",Xm);Be("toBVec3",V7);Be("toVec4",Lt);Be("toIVec4",q7);Be("toUVec4",H7);Be("toBVec4",lZ);Be("toMat2",HC);Be("toMat3",so);Be("toMat4",l0);var cZ=Hn(td).setParameterLength(2),uZ=(i,e)=>new CM(Vt(i),e),Uxe=(i,e)=>new RM(Vt(i),e);Be("element",cZ);Be("convert",uZ);var kxe=i=>(je("TSL: append() has been renamed to Stack().",new kr),qC(i));Be("append",i=>(je("TSL: .append() has been renamed to .toStack().",new kr),qC(i)));var di=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 q1(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)}},rd=(i,e,t=null)=>new di(i,e,!1,t),$m=(i,e,t=null)=>new di(i,e,!0,t),Ci=xt(di,"vec4","DiffuseColor"),Sm=xt(di,"vec3","DiffuseContribution"),iF=xt(di,"vec3","EmissiveColor"),Eh=xt(di,"float","Roughness"),ed=xt(di,"float","Metalness"),PM=xt(di,"float","Clearcoat"),M1=xt(di,"float","ClearcoatRoughness"),Il=xt(di,"vec3","Sheen"),t0=xt(di,"float","SheenRoughness"),WC=xt(di,"float","Iridescence"),IM=xt(di,"float","IridescenceIOR"),NM=xt(di,"float","IridescenceThickness"),LM=xt(di,"float","AlphaT"),e0=xt(di,"float","Anisotropy"),Jv=xt(di,"vec3","AnisotropyT"),Im=xt(di,"vec3","AnisotropyB"),h0=xt(di,"color","SpecularColor"),Em=xt(di,"color","SpecularColorBlended"),Mm=xt(di,"float","SpecularF90"),DM=xt(di,"float","Shininess"),C1=xt(di,"output","Output"),Nm=xt(di,"float","dashSize"),lb=xt(di,"float","gapSize"),Gxe=xt(di,"float","pointWidth"),eb=xt(di,"float","IOR"),FM=xt(di,"float","Transmission"),W7=xt(di,"float","Thickness"),j7=xt(di,"float","AttenuationDistance"),X7=xt(di,"color","AttenuationColor"),$7=xt(di,"float","Dispersion"),rF=xt(di,"float","AmbientOcclusion",!1,1),OM=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}},hZ=(i,e=1,t=null)=>new OM(i,!1,e,t),jC=(i,e=0,t=null)=>new OM(i,!0,e,t),zxe=jC("frame",0,_n.FRAME),Kt=jC("render",0,_n.RENDER),fZ=hZ("object",1,_n.OBJECT),Bm=class extends ob{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=fZ}setName(e){return this.name=e,this}label(e){return je('TSL: "label()" has been deprecated. Use "setName()" instead.',new kr),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=sZ(e||i);if(t===i&&(i=D7(t)),i&&i.isNode===!0){let n=i.value;i.traverse(r=>{r.isConstNode===!0&&(n=r.value)}),i=n}return new Bm(i,t)},BM=class extends Ar{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)}},dZ=(...i)=>{let e;if(i.length===1){let t=i[0];e=new BM(null,t.length,t)}else{let t=i[0],n=i[1];e=new BM(t,n)}return Vt(e)};Be("toArray",(i,e)=>dZ(Array(e).fill(i)));var sF=class extends Ar{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 jm.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 R=v.components[T];e.addLineFlowCode(`${S}.${R} = ${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)}},pZ=Hn(sF).setParameterLength(2);Be("assign",pZ);var oF=class extends Ar{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(", ")} )`}},AZ=(i,...e)=>(e=e.length>1||e[0]&&e[0].isNode===!0?Pm(e):VC(e[0]),new oF(Vt(i),e));Be("call",AZ);var Vxe={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"},Gr=class i extends Ar{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(Vxe[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===_o;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}},ps=lt(Gr,"+").setParameterLength(2,1/0).setName("add"),ii=lt(Gr,"-").setParameterLength(2,1/0).setName("sub"),bn=lt(Gr,"*").setParameterLength(2,1/0).setName("mul"),Ol=lt(Gr,"/").setParameterLength(2,1/0).setName("div"),XC=lt(Gr,"%").setParameterLength(2).setName("mod"),mZ=lt(Gr,"==").setParameterLength(2).setName("equal"),gZ=lt(Gr,"!=").setParameterLength(2).setName("notEqual"),_Z=lt(Gr,"<").setParameterLength(2).setName("lessThan"),Y7=lt(Gr,">").setParameterLength(2).setName("greaterThan"),xZ=lt(Gr,"<=").setParameterLength(2).setName("lessThanEqual"),yZ=lt(Gr,">=").setParameterLength(2).setName("greaterThanEqual"),vZ=lt(Gr,"&&").setParameterLength(2,1/0).setName("and"),bZ=lt(Gr,"||").setParameterLength(2,1/0).setName("or"),wZ=lt(Gr,"!").setParameterLength(1).setName("not"),SZ=lt(Gr,"^^").setParameterLength(2).setName("xor"),TZ=lt(Gr,"&").setParameterLength(2).setName("bitAnd"),EZ=lt(Gr,"~").setParameterLength(1).setName("bitNot"),MZ=lt(Gr,"|").setParameterLength(2).setName("bitOr"),CZ=lt(Gr,"^").setParameterLength(2).setName("bitXor"),RZ=lt(Gr,"<<").setParameterLength(2).setName("shiftLeft"),PZ=lt(Gr,">>").setParameterLength(2).setName("shiftRight"),IZ=Ae(([i])=>(i.addAssign(1),i)),NZ=Ae(([i])=>(i.subAssign(1),i)),LZ=Ae(([i])=>{let e=fe(i).toConst();return i.addAssign(1),e}),DZ=Ae(([i])=>{let e=fe(i).toConst();return i.subAssign(1),e});Be("add",ps);Be("sub",ii);Be("mul",bn);Be("div",Ol);Be("mod",XC);Be("equal",mZ);Be("notEqual",gZ);Be("lessThan",_Z);Be("greaterThan",Y7);Be("lessThanEqual",xZ);Be("greaterThanEqual",yZ);Be("and",vZ);Be("or",bZ);Be("not",wZ);Be("xor",SZ);Be("bitAnd",TZ);Be("bitNot",EZ);Be("bitOr",MZ);Be("bitXor",CZ);Be("shiftLeft",RZ);Be("shiftRight",PZ);Be("incrementBefore",IZ);Be("decrementBefore",NZ);Be("increment",LZ);Be("decrement",DZ);var Re=class i extends Ar{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=ii(1,t);else if(r===i.RECIPROCAL)s=Ol(1,t);else if(r===i.DIFFERENCE)s=er(ii(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=na(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===_o&&r===i.STEP?f.push(a.build(e,e.getTypeLength(a.getNodeType(e))===1?"float":o),l.build(e,o)):u===_o&&(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===Xa&&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 $C=se(1e-6),qxe=se(1e6),UM=se(Math.PI),Hxe=se(Math.PI*2),Wxe=se(Math.PI*2),jxe=se(Math.PI*.5),FZ=lt(Re,Re.ALL).setParameterLength(1),OZ=lt(Re,Re.ANY).setParameterLength(1),BZ=lt(Re,Re.RADIANS).setParameterLength(1),UZ=lt(Re,Re.DEGREES).setParameterLength(1),K7=lt(Re,Re.EXP).setParameterLength(1),D1=lt(Re,Re.EXP2).setParameterLength(1),YC=lt(Re,Re.LOG).setParameterLength(1),Ch=lt(Re,Re.LOG2).setParameterLength(1),Ia=lt(Re,Re.SQRT).setParameterLength(1),Z7=lt(Re,Re.INVERSE_SQRT).setParameterLength(1),Rh=lt(Re,Re.FLOOR).setParameterLength(1),KC=lt(Re,Re.CEIL).setParameterLength(1),na=lt(Re,Re.NORMALIZE).setParameterLength(1),au=lt(Re,Re.FRACT).setParameterLength(1),Ca=lt(Re,Re.SIN).setParameterLength(1),kZ=lt(Re,Re.SINH).setParameterLength(1),iu=lt(Re,Re.COS).setParameterLength(1),GZ=lt(Re,Re.COSH).setParameterLength(1),zZ=lt(Re,Re.TAN).setParameterLength(1),VZ=lt(Re,Re.TANH).setParameterLength(1),qZ=lt(Re,Re.ASIN).setParameterLength(1),HZ=lt(Re,Re.ASINH).setParameterLength(1),Q7=lt(Re,Re.ACOS).setParameterLength(1),WZ=lt(Re,Re.ACOSH).setParameterLength(1),J7=lt(Re,Re.ATAN).setParameterLength(1,2),jZ=lt(Re,Re.ATANH).setParameterLength(1),er=lt(Re,Re.ABS).setParameterLength(1),eU=lt(Re,Re.SIGN).setParameterLength(1),Ph=lt(Re,Re.LENGTH).setParameterLength(1),tU=lt(Re,Re.NEGATE).setParameterLength(1),XZ=lt(Re,Re.ONE_MINUS).setParameterLength(1),nU=lt(Re,Re.DFDX).setParameterLength(1),iU=lt(Re,Re.DFDY).setParameterLength(1),$Z=lt(Re,Re.ROUND).setParameterLength(1),YZ=lt(Re,Re.RECIPROCAL).setParameterLength(1),rU=lt(Re,Re.TRUNC).setParameterLength(1),sU=lt(Re,Re.FWIDTH).setParameterLength(1),KZ=lt(Re,Re.TRANSPOSE).setParameterLength(1),ZZ=lt(Re,Re.DETERMINANT).setParameterLength(1),QZ=lt(Re,Re.INVERSE).setParameterLength(1),il=lt(Re,Re.MIN).setParameterLength(2,1/0),Er=lt(Re,Re.MAX).setParameterLength(2,1/0),Um=lt(Re,Re.STEP).setParameterLength(2),JZ=lt(Re,Re.REFLECT).setParameterLength(2),eQ=lt(Re,Re.DISTANCE).setParameterLength(2),tQ=lt(Re,Re.DIFFERENCE).setParameterLength(2),_c=lt(Re,Re.DOT).setParameterLength(2),nd=lt(Re,Re.CROSS).setParameterLength(2),pc=lt(Re,Re.POW).setParameterLength(2),oU=i=>bn(i,i),nQ=i=>bn(i,i,i),aU=i=>bn(i,i,i,i),iQ=lt(Re,Re.TRANSFORM_DIRECTION).setParameterLength(2),rQ=(i,e)=>na(bn(e,Lt(pe(i),0)).xyz),sQ=(i,e)=>na(Lt(pe(i),0).mul(e).xyz),oQ=i=>bn(eU(i),pc(er(i),1/3)),lU=i=>_c(i,i),Xn=lt(Re,Re.MIX).setParameterLength(3),lu=(i,e=0,t=1)=>new Re(Re.CLAMP,Vt(i),Vt(e),Vt(t)),ZC=i=>lu(i),cU=lt(Re,Re.REFRACT).setParameterLength(3),Bl=lt(Re,Re.SMOOTHSTEP).setParameterLength(3),uU=lt(Re,Re.FACEFORWARD).setParameterLength(3),aQ=Ae(([i])=>{let n=43758.5453,r=_c(i.xy,ft(12.9898,78.233)),s=XC(r,UM);return au(Ca(s).mul(n))}),lQ=(i,e,t)=>Xn(e,t,i),cQ=(i,e,t)=>Bl(e,t,i),uQ=(i,e)=>Um(e,i),Xxe=uU,$xe=Z7;Be("all",FZ);Be("any",OZ);Be("radians",BZ);Be("degrees",UZ);Be("exp",K7);Be("exp2",D1);Be("log",YC);Be("log2",Ch);Be("sqrt",Ia);Be("inverseSqrt",Z7);Be("floor",Rh);Be("ceil",KC);Be("normalize",na);Be("fract",au);Be("sin",Ca);Be("sinh",kZ);Be("cos",iu);Be("cosh",GZ);Be("tan",zZ);Be("tanh",VZ);Be("asin",qZ);Be("asinh",HZ);Be("acos",Q7);Be("acosh",WZ);Be("atan",J7);Be("atanh",jZ);Be("abs",er);Be("sign",eU);Be("length",Ph);Be("lengthSq",lU);Be("negate",tU);Be("oneMinus",XZ);Be("dFdx",nU);Be("dFdy",iU);Be("round",$Z);Be("reciprocal",YZ);Be("trunc",rU);Be("fwidth",sU);Be("min",il);Be("max",Er);Be("step",uQ);Be("reflect",JZ);Be("distance",eQ);Be("dot",_c);Be("cross",nd);Be("pow",pc);Be("pow2",oU);Be("pow3",nQ);Be("pow4",aU);Be("transformDirection",iQ);Be("transformNormalByViewMatrix",rQ);Be("transformNormalByInverseViewMatrix",sQ);Be("mix",lQ);Be("clamp",lu);Be("refract",cU);Be("smoothstep",cQ);Be("faceForward",uU);Be("difference",tQ);Be("saturate",ZC);Be("cbrt",oQ);Be("transpose",KZ);Be("determinant",ZZ);Be("inverse",QZ);Be("rand",aQ);var aF=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?rd(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)}},ea=Hn(oF).setParameterLength(2,3);Be("select",ea);var ab=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}},sd=(i=null,e={})=>{let t=i;return(t===null||t.isNode!==!0)&&(e=t||e,t=null),new ab(t,e)},cQ=i=>sd(i,{uniformFlow:!0}),uU=(i,e)=>sd(i,{nodeName:e});function uQ(i,e,t=null){return sd(t,{getShadow:({light:n,shadowColorNode:r})=>e===n?r.mul(i):r})}function hQ(i,e=null){return sd(e,{getAO:(t,{material:n})=>n.transparent===!0?t:t!==null?t.mul(i):i})}function fQ(i,e){return je('TSL: "label()" has been deprecated. Use "setName()" instead.'),uU(i,e)}Be("context",sd);Be("label",fQ);Be("uniformFlow",cQ);Be("setName",uU);Be("builtinShadowContext",(i,e,t)=>uQ(e,t,i));Be("builtinAOContext",(i,e)=>hQ(e,i));var C1=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}},hU=Hn(C1),dQ=(i,e=null)=>hU(i,e).toStack(),pQ=(i,e=null)=>hU(i,e,!0).toStack(),AQ=i=>hU(i).setIntent(!0).toStack();Be("toVar",dQ);Be("toConst",pQ);Be("toVarIntent",AQ);var aF=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}},Lm=(i,e,t=null)=>new aF(Vt(i),e,t),lF=class extends $t{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=Lm(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=Lm(this.node,"VERTEX")}return n.needsInterpolation||(n.needsInterpolation=e.shaderStage==="fragment"),n}setup(e){this.setupVarying(e),e.flowNodeFromShaderStage(v1.VERTEX,this.node)}analyze(e){this.setupVarying(e),e.flowNodeFromShaderStage(v1.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,v1.VERTEX);if(e.shaderStage===v1.VERTEX){let a=n.node.build(e,s);e.addLineFlowCode(`${o} = ${a}`,this)}else e.flowNodeFromShaderStage(v1.VERTEX,n.node,s,o);n[t]=o}return e.getPropertyName(r)}},A0=Hn(lF).setParameterLength(1,2),mQ=i=>A0(i);Be("toVarying",A0);Be("toVertexStage",mQ);var gQ=Ae(([i])=>{let e=i.mul(.9478672986).add(.0521327014).pow(2.4),t=i.mul(.0773993808),n=i.lessThanEqual(.04045);return Xn(e,t,n)}).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),_Q=Ae(([i])=>{let e=i.pow(.41666).mul(1.055).sub(.055),t=i.mul(12.92),n=i.lessThanEqual(.0031308);return Xn(e,t,n)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),fU="WorkingColorSpace",Wxe="OutputColorSpace",lb=class extends Ar{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===fU?sn.workingColorSpace:t===Wxe?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(gQ(s.rgb),s.a)),sn.getPrimaries(n)!==sn.getPrimaries(r)&&(s=Lt(so(sn._getMatrix(new Sn,n,r)).mul(s.rgb),s.a)),sn.getTransfer(r)===Bt&&(s=Lt(_Q(s.rgb),s.a))),s}},xQ=(i,e)=>new lb(Vt(i),fU,e),ZC=(i,e)=>new lb(Vt(i),e,fU),jxe=(i,e,t)=>new lb(Vt(i),e,t);Be("workingToColorSpace",xQ);Be("colorSpaceToWorking",ZC);var Xxe=class extends td{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)}},UM=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 Xxe(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}},$xe=(i,e,t)=>new UM(i,e,t),cF=class extends UM{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}},yQ=(i,e,t=null)=>new cF(i,e,t),uF=class extends Ar{static get type(){return"ToneMappingNode"}constructor(e,t=bQ,n=null){super("vec3"),this._toneMapping=e,this.exposureNode=t,this.colorNode=n}customCacheKey(){return Yv(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===Vs)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}},vQ=(i,e,t)=>new uF(i,Vt(e),Vt(t)),bQ=yQ("toneMappingExposure","float");Be("toneMapping",(i,e,t)=>vQ(e,t,i));var NY=new WeakMap;function LY(i,e){let t=NY.get(i);return t===void 0&&(t=new Df(i,e),NY.set(i,t)),t}var Th=class extends rb{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=Zd,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=LY(r.array,s):a=LY(r,s);let l=new xo(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 QC(i,e=null,t=0,n=0,r=Zd,s=!1){return e==="mat3"||e===null&&i.itemSize===9?so(new Th(i,"vec3",9,0).setUsage(r).setInstanced(s),new Th(i,"vec3",9,3).setUsage(r).setInstanced(s),new Th(i,"vec3",9,6).setUsage(r).setInstanced(s)):e==="mat4"||e===null&&i.itemSize===16?l0(new Th(i,"vec4",16,0).setUsage(r).setInstanced(s),new Th(i,"vec4",16,4).setUsage(r).setInstanced(s),new Th(i,"vec4",16,8).setUsage(r).setInstanced(s),new Th(i,"vec4",16,12).setUsage(r).setInstanced(s)):new Th(i,e,t,n).setUsage(r)}var dU=(i,e=null,t=0,n=0)=>QC(i,e,t,n),Yxe=(i,e=null,t=0,n=0)=>QC(i,e,t,n,KA),JC=(i,e=null,t=0,n=0)=>QC(i,e,t,n,Zd,!0),pU=(i,e=null,t=0,n=0)=>QC(i,e,t,n,KA,!0);Be("toAttribute",i=>dU(i.value));var Ns=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}};Ns.VERTEX="vertex";Ns.INSTANCE="instance";Ns.SUBGROUP="subgroup";Ns.INVOCATION_LOCAL="invocationLocal";Ns.INVOCATION_SUBGROUP="invocationSubgroup";Ns.DRAW="draw";var wQ=xt(Ns,Ns.VERTEX),ou=xt(Ns,Ns.INSTANCE),Kxe=xt(Ns,Ns.SUBGROUP),Zxe=xt(Ns,Ns.INVOCATION_SUBGROUP),Qxe=xt(Ns,Ns.INVOCATION_LOCAL),SQ=xt(Ns,Ns.DRAW),hF=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 kr),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=ou.build(e,"uint");e.flow.code=`${e.tab}if ( ${o} >= ${s} ) { return; }4145+`);return e.format(u,n,t)}},ta=Hn(aF).setParameterLength(2,3);Be("select",ta);var cb=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}},sd=(i=null,e={})=>{let t=i;return(t===null||t.isNode!==!0)&&(e=t||e,t=null),new cb(t,e)},hQ=i=>sd(i,{uniformFlow:!0}),hU=(i,e)=>sd(i,{nodeName:e});function fQ(i,e,t=null){return sd(t,{getShadow:({light:n,shadowColorNode:r})=>e===n?r.mul(i):r})}function dQ(i,e=null){return sd(e,{getAO:(t,{material:n})=>n.transparent===!0?t:t!==null?t.mul(i):i})}function pQ(i,e){return je('TSL: "label()" has been deprecated. Use "setName()" instead.'),hU(i,e)}Be("context",sd);Be("label",pQ);Be("uniformFlow",hQ);Be("setName",hU);Be("builtinShadowContext",(i,e,t)=>fQ(e,t,i));Be("builtinAOContext",(i,e)=>dQ(e,i));var R1=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}},fU=Hn(R1),AQ=(i,e=null)=>fU(i,e).toStack(),mQ=(i,e=null)=>fU(i,e,!0).toStack(),gQ=i=>fU(i).setIntent(!0).toStack();Be("toVar",AQ);Be("toConst",mQ);Be("toVarIntent",gQ);var lF=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}},Lm=(i,e,t=null)=>new lF(Vt(i),e,t),cF=class extends $t{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=Lm(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=Lm(this.node,"VERTEX")}return n.needsInterpolation||(n.needsInterpolation=e.shaderStage==="fragment"),n}setup(e){this.setupVarying(e),e.flowNodeFromShaderStage(b1.VERTEX,this.node)}analyze(e){this.setupVarying(e),e.flowNodeFromShaderStage(b1.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,b1.VERTEX);if(e.shaderStage===b1.VERTEX){let a=n.node.build(e,s);e.addLineFlowCode(`${o} = ${a}`,this)}else e.flowNodeFromShaderStage(b1.VERTEX,n.node,s,o);n[t]=o}return e.getPropertyName(r)}},A0=Hn(cF).setParameterLength(1,2),_Q=i=>A0(i);Be("toVarying",A0);Be("toVertexStage",_Q);var xQ=Ae(([i])=>{let e=i.mul(.9478672986).add(.0521327014).pow(2.4),t=i.mul(.0773993808),n=i.lessThanEqual(.04045);return Xn(e,t,n)}).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),yQ=Ae(([i])=>{let e=i.pow(.41666).mul(1.055).sub(.055),t=i.mul(12.92),n=i.lessThanEqual(.0031308);return Xn(e,t,n)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),dU="WorkingColorSpace",Yxe="OutputColorSpace",ub=class extends Ar{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===dU?sn.workingColorSpace:t===Yxe?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(xQ(s.rgb),s.a)),sn.getPrimaries(n)!==sn.getPrimaries(r)&&(s=Lt(so(sn._getMatrix(new Sn,n,r)).mul(s.rgb),s.a)),sn.getTransfer(r)===Bt&&(s=Lt(yQ(s.rgb),s.a))),s}},vQ=(i,e)=>new ub(Vt(i),dU,e),QC=(i,e)=>new ub(Vt(i),e,dU),Kxe=(i,e,t)=>new ub(Vt(i),e,t);Be("workingToColorSpace",vQ);Be("colorSpaceToWorking",QC);var Zxe=class extends td{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)}},kM=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 Zxe(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}},Qxe=(i,e,t)=>new kM(i,e,t),uF=class extends kM{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}},bQ=(i,e,t=null)=>new uF(i,e,t),hF=class extends Ar{static get type(){return"ToneMappingNode"}constructor(e,t=SQ,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===Vs)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}},wQ=(i,e,t)=>new hF(i,Vt(e),Vt(t)),SQ=bQ("toneMappingExposure","float");Be("toneMapping",(i,e,t)=>wQ(e,t,i));var DY=new WeakMap;function FY(i,e){let t=DY.get(i);return t===void 0&&(t=new Df(i,e),DY.set(i,t)),t}var Th=class extends ob{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=Zd,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=FY(r.array,s):a=FY(r,s);let l=new yo(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 JC(i,e=null,t=0,n=0,r=Zd,s=!1){return e==="mat3"||e===null&&i.itemSize===9?so(new Th(i,"vec3",9,0).setUsage(r).setInstanced(s),new Th(i,"vec3",9,3).setUsage(r).setInstanced(s),new Th(i,"vec3",9,6).setUsage(r).setInstanced(s)):e==="mat4"||e===null&&i.itemSize===16?l0(new Th(i,"vec4",16,0).setUsage(r).setInstanced(s),new Th(i,"vec4",16,4).setUsage(r).setInstanced(s),new Th(i,"vec4",16,8).setUsage(r).setInstanced(s),new Th(i,"vec4",16,12).setUsage(r).setInstanced(s)):new Th(i,e,t,n).setUsage(r)}var pU=(i,e=null,t=0,n=0)=>JC(i,e,t,n),Jxe=(i,e=null,t=0,n=0)=>JC(i,e,t,n,KA),eR=(i,e=null,t=0,n=0)=>JC(i,e,t,n,Zd,!0),AU=(i,e=null,t=0,n=0)=>JC(i,e,t,n,KA,!0);Be("toAttribute",i=>pU(i.value));var Ns=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}};Ns.VERTEX="vertex";Ns.INSTANCE="instance";Ns.SUBGROUP="subgroup";Ns.INVOCATION_LOCAL="invocationLocal";Ns.INVOCATION_SUBGROUP="invocationSubgroup";Ns.DRAW="draw";var TQ=xt(Ns,Ns.VERTEX),ou=xt(Ns,Ns.INSTANCE),eye=xt(Ns,Ns.SUBGROUP),tye=xt(Ns,Ns.INVOCATION_SUBGROUP),nye=xt(Ns,Ns.INVOCATION_LOCAL),EQ=xt(Ns,Ns.DRAW),fF=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 kr),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=ou.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)}}},AU=(i,e=[64])=>{(e.length===0||e.length>3)&&Ge("TSL: compute() workgroupSize must have 1, 2, or 3 elements",new kr);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 kr)}for(;e.length<3;)e.push(1);return new hF(Vt(i),e)},TQ=(i,e,t)=>{let n=AU(i,t);return typeof e=="number"?n.count=e:n.dispatchSize=e,n};Be("compute",TQ);Be("computeKernel",AU);var fF=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}},R1=i=>new fF(Vt(i));function EQ(i,e=!0){return je('TSL: "cache()" has been deprecated. Use "isolate()" instead.'),R1(i).setParent(e)}Be("cache",EQ);Be("isolate",R1);var dF=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)}},MQ=Hn(dF).setParameterLength(2);Be("bypass",MQ);var mU=Ae(([i,e,t,n=se(0),r=se(1),s=Fl(!1)])=>{let o=i.sub(e).div(t.sub(e));return N1(s)&&(o=o.clamp()),o.mul(r.sub(n)).add(n)});function CQ(i,e,t,n=se(0),r=se(1)){return mU(i,e,t,n,r,!0)}Be("remap",mU);Be("remapClamp",CQ);var P1=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)}},Ll=Hn(P1).setParameterLength(1,2),RQ=i=>(i?ea(i,Ll("discard")):Ll("discard")).toStack(),Jxe=()=>Ll("return").toStack();Be("discard",RQ);var gU=Ae(([i])=>Lt(i.rgb.mul(i.a),i.a),{color:"vec4",return:"vec4"}),PQ=Ae(([i])=>i.a.equal(0).select(Lt(0),Lt(i.rgb.div(i.a),i.a)),{color:"vec4",return:"vec4"}),pF=class extends Ar{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=PQ(t);let n=(this._toneMapping!==null?this._toneMapping:e.toneMapping)||Vs,r=(this.outputColorSpace!==null?this.outputColorSpace:e.outputColorSpace)||Wo;return n!==Vs&&(t=t.toneMapping(n)),r!==Wo&&r!==sn.workingColorSpace&&(t=t.workingToColorSpace(r)),t=gU(t),t}},_U=(i,e=null,t=null)=>new pF(Vt(i),e,t);Be("renderOutput",_U);var AF=class extends Ar{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)}}},mU=(i,e=[64])=>{(e.length===0||e.length>3)&&Ge("TSL: compute() workgroupSize must have 1, 2, or 3 elements",new kr);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 kr)}for(;e.length<3;)e.push(1);return new fF(Vt(i),e)},MQ=(i,e,t)=>{let n=mU(i,t);return typeof e=="number"?n.count=e:n.dispatchSize=e,n};Be("compute",MQ);Be("computeKernel",mU);var dF=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}},P1=i=>new dF(Vt(i));function CQ(i,e=!0){return je('TSL: "cache()" has been deprecated. Use "isolate()" instead.'),P1(i).setParent(e)}Be("cache",CQ);Be("isolate",P1);var pF=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)}},RQ=Hn(pF).setParameterLength(2);Be("bypass",RQ);var gU=Ae(([i,e,t,n=se(0),r=se(1),s=Fl(!1)])=>{let o=i.sub(e).div(t.sub(e));return L1(s)&&(o=o.clamp()),o.mul(r.sub(n)).add(n)});function PQ(i,e,t,n=se(0),r=se(1)){return gU(i,e,t,n,r,!0)}Be("remap",gU);Be("remapClamp",PQ);var I1=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)}},Ll=Hn(I1).setParameterLength(1,2),IQ=i=>(i?ta(i,Ll("discard")):Ll("discard")).toStack(),iye=()=>Ll("return").toStack();Be("discard",IQ);var _U=Ae(([i])=>Lt(i.rgb.mul(i.a),i.a),{color:"vec4",return:"vec4"}),NQ=Ae(([i])=>i.a.equal(0).select(Lt(0),Lt(i.rgb.div(i.a),i.a)),{color:"vec4",return:"vec4"}),AF=class extends Ar{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=NQ(t);let n=(this._toneMapping!==null?this._toneMapping:e.toneMapping)||Vs,r=(this.outputColorSpace!==null?this.outputColorSpace:e.outputColorSpace)||jo;return n!==Vs&&(t=t.toneMapping(n)),r!==jo&&r!==sn.workingColorSpace&&(t=t.workingToColorSpace(r)),t=_U(t),t}},xU=(i,e=null,t=null)=>new AF(Vt(i),e,t);Be("renderOutput",xU);var mF=class extends Ar{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-`,SA(o)}return n}},IQ=(i,e=null)=>new AF(Vt(i),e).toStack();Be("debug",IQ);var kM=class extends qo{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(){}},mF=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!==kM&&Qn('TSL: ".toInspector()" is only available with WebGPU.'),t}};function NQ(i,e="",t=null){return i=Vt(i),i.before(new mF(i,e,t))}Be("toInspector",NQ);function eye(i){je("TSL: AddNodeElement has been removed in favor of tree-shaking. Trying add",i)}var GM=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}},Dl=(i,e=null)=>new GM(i,e),Pi=(i=0)=>Dl("uv"+(i>0?i:""),"vec2"),gF=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)}},km=Hn(gF).setParameterLength(1,2),_F=class extends Bm{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))}}},xU=Hn(_F).setParameterLength(1),zM=class extends Error{constructor(e,t=null){super(e),this.name="NodeError",this.stackTrace=t}},yU=new Ms,xc=class extends Bm{static get type(){return"TextureNode"}constructor(e=yU,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===Ai?"uvec4":this.value.type===Fr?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return Pi(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(km(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 zM("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(zf.TEXTURE_COMPARE))o=this.compareNode;else{let l=n.compareFunction;l===null||l===N_||l===oh||l===YA||l===$c?a=this.compareNode:(o=this.compareNode,Qn('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===YA||Z===$c?j=Um(Ll(j,a),Ll(N,"float")).build(e,a):j=Um(Ll(N,"float"),Ll(j,a)).build(e,a)}e.addLineFlowCode(`${l} = ${j}`,this),o.snippet=j,o.propertyName=l}let c=l;return e.needsToWorkingColorSpace(n)&&(c=ZC(Ll(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(xU(t)),t.referenceNode=this.getBase();let n=t.value;return t.generateMipmaps===!1&&(n&&n.generateMipmaps===!1||n.minFilter===yi||n.magFilter===yi)&&(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 km(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}},tye=Hn(xc).setParameterLength(1,4).setName("texture"),li=(i=yU,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=tye(i,e,t,n),r},nye=(i=yU)=>li(i),ns=(...i)=>li(...i).setSampler(!1),iye=(i,e,t)=>li(i,e).level(t),rye=i=>(i.isNode===!0?i:li(i)).convert("sampler"),sye=i=>(i.isNode===!0?i:li(i)).convert("samplerComparison"),cb=class extends Bm{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"}},q1=(i,e,t)=>new cb(i,e,t),xF=class extends td{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)}},yF=class extends cb{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=t===null?o0(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 xF(this,Vt(e))}},Eo=(i,e)=>new yF(i,e),vF=class extends $t{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}},od=Hn(vF).setParameterLength(1),Rv,Pv,Co=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?Pv.copy(t.viewport):(e.getViewport(Pv),Pv.multiplyScalar(e.getPixelRatio())):this.scope===i.DPR?this._output.value=e.getPixelRatio():t!==null?(Rv.width=t.width,Rv.height=t.height):e.getDrawingBufferSize(Rv)}setup(){let e=this.scope,t=null;return e===i.SIZE?t=Ht(Rv||(Rv=new Oe)):e===i.VIEWPORT?t=Ht(Pv||(Pv=new gn)):e===i.DPR?t=Ht(1):t=ft(Ym.div(Gm)),this._output=t,t}generate(e){if(this.scope===i.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){let n=e.getNodeProperties(Gm).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${n}.y - ${t}.y )`}return t}return super.generate(e)}};Co.COORDINATE="coordinate";Co.VIEWPORT="viewport";Co.SIZE="size";Co.UV="uv";Co.DPR="dpr";var vU=xt(Co,Co.DPR),su=xt(Co,Co.UV),Gm=xt(Co,Co.SIZE),Ym=xt(Co,Co.COORDINATE),I1=xt(Co,Co.VIEWPORT),bU=I1.zw,LQ=Ym.sub(I1.xy),oye=LQ.div(bU),aye=Ae(()=>(je('TSL: "viewportResolution" is deprecated. Use "screenSize" instead.',new kr),Gm),"vec2").once()(),l8=null,UE=null,c8=null,kE=null,u8=null,GE=null,h8=null,zE=null,f8=null,VE=null,d8=null,qE=null,p8=null,HE=null,m0=Ht(0,"uint").setName("u_cameraIndex").setGroup(WC("cameraIndex")).toVarying("v_cameraIndex"),n0=Ht("float").setName("cameraNear").setGroup(Kt).onRenderUpdate(({camera:i})=>i.near),i0=Ht("float").setName("cameraFar").setGroup(Kt).onRenderUpdate(({camera:i})=>i.far),Pa=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.projectionMatrix);UE===null?UE=Eo(t).setGroup(Kt).setName("cameraProjectionMatrices"):UE.array=t,e=UE.element(i.isMultiViewCamera?od("gl_ViewID_OVR"):m0)}else l8===null&&(l8=Ht(i.projectionMatrix).setName("cameraProjectionMatrix").setGroup(Kt).onRenderUpdate(({camera:t})=>t.projectionMatrix)),e=l8;return e}).once()(),DQ=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.projectionMatrixInverse);kE===null?kE=Eo(t).setGroup(Kt).setName("cameraProjectionMatricesInverse"):kE.array=t,e=kE.element(i.isMultiViewCamera?od("gl_ViewID_OVR"):m0)}else c8===null&&(c8=Ht(i.projectionMatrixInverse).setName("cameraProjectionMatrixInverse").setGroup(Kt).onRenderUpdate(({camera:t})=>t.projectionMatrixInverse)),e=c8;return e}).once()(),g0=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorldInverse);GE===null?GE=Eo(t).setGroup(Kt).setName("cameraViewMatrices"):GE.array=t,e=GE.element(i.isMultiViewCamera?od("gl_ViewID_OVR"):m0)}else u8===null&&(u8=Ht(i.matrixWorldInverse).setName("cameraViewMatrix").setGroup(Kt).onRenderUpdate(({camera:t})=>t.matrixWorldInverse)),e=u8;return e}).once()(),Eb=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorld);zE===null?zE=Eo(t).setGroup(Kt).setName("cameraWorldMatrices"):zE.array=t,e=zE.element(i.isMultiViewCamera?od("gl_ViewID_OVR"):m0)}else h8===null&&(h8=Ht(i.matrixWorld).setName("cameraWorldMatrix").setGroup(Kt).onRenderUpdate(({camera:t})=>t.matrixWorld)),e=h8;return e}).once()(),lye=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.normalMatrix);VE===null?VE=Eo(t).setGroup(Kt).setName("cameraNormalMatrices"):VE.array=t,e=VE.element(i.isMultiViewCamera?od("gl_ViewID_OVR"):m0)}else f8===null&&(f8=Ht(i.normalMatrix).setName("cameraNormalMatrix").setGroup(Kt).onRenderUpdate(({camera:t})=>t.normalMatrix)),e=f8;return e}).once()(),FQ=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);qE===null?qE=Eo(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)}):qE.array=t,e=qE.element(i.isMultiViewCamera?od("gl_ViewID_OVR"):m0)}else d8===null&&(d8=Ht(new ie).setName("cameraPosition").setGroup(Kt).onRenderUpdate(({camera:t},n)=>n.value.setFromMatrixPosition(t.matrixWorld))),e=d8;return e}).once()(),cye=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.viewport);HE===null?HE=Eo(t,"vec4").setGroup(Kt).setName("cameraViewports"):HE.array=t,e=HE.element(m0)}else p8===null&&(p8=Lt(0,0,Gm.x,Gm.y).toConst("cameraViewport")),e=p8;return e}).once()(),DY=new $a,As=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 Bm(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(),DY.copy(s.boundingSphere).applyMatrix4(t.matrixWorld),n.value=DY.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}};As.WORLD_MATRIX="worldMatrix";As.POSITION="position";As.SCALE="scale";As.VIEW_POSITION="viewPosition";As.DIRECTION="direction";As.RADIUS="radius";var uye=Hn(As,As.DIRECTION).setParameterLength(1),hye=Hn(As,As.WORLD_MATRIX).setParameterLength(1),fye=Hn(As,As.POSITION).setParameterLength(1),dye=Hn(As,As.SCALE).setParameterLength(1),pye=Hn(As,As.VIEW_POSITION).setParameterLength(1),Aye=Hn(As,As.RADIUS).setParameterLength(1),rl=class extends As{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}},mye=xt(rl,rl.DIRECTION),Ac=xt(rl,rl.WORLD_MATRIX),gye=xt(rl,rl.POSITION),_ye=xt(rl,rl.SCALE),xye=xt(rl,rl.VIEW_POSITION),yye=xt(rl,rl.RADIUS),OQ=Ht(new Sn).onObjectUpdate(({object:i},e)=>e.value.getNormalMatrix(i.matrixWorld)),vye=Ht(new on).onObjectUpdate(({object:i},e)=>e.value.copy(i.matrixWorld).invert()),Dh=Ae(i=>i.context.modelViewMatrix||BQ).once()().toVar("modelViewMatrix"),BQ=g0.mul(Ac),bF=Ae(i=>(i.context.isHighPrecisionModelViewMatrix=!0,Ht("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),wF=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"),UQ=Ae(i=>i.shaderStage!=="fragment"?(Qn("TSL: `clipSpace` is only available in fragment stage."),Lt()):i.context.clipSpace.toVarying("v_clipSpace")).once()(),Qo=Dl("position","vec3"),dr=Qo.toVarying("positionLocal"),zm=Qo.toVarying("positionPrevious"),Ih=Ae(i=>Ac.mul(dr).xyz.toVarying(i.getSubBuildProperty("v_positionWorld")),"vec3").once(["POSITION"])(),wU=Ae(()=>dr.transformDirection(Ac).toVarying("v_positionWorldDirection").normalize().toVar("positionWorldDirection"),"vec3").once(["POSITION"])(),is=Ae(i=>{if(i.shaderStage==="fragment"&&i.material.vertexNode){let e=DQ.mul(UQ);return e.xyz.div(e.w).toVar("positionView")}return i.context.setupPositionView().toVarying("v_positionView")},"vec3").once(["POSITION","VERTEX"])(),qi=Ae(i=>{let e;return i.camera.isOrthographicCamera?e=pe(0,0,1):e=is.negate().toVarying("v_positionViewDirection").normalize(),e.toVar("positionViewDirection")},"vec3").once(["POSITION"])(),SF=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===hi?"false":e.getFrontFacing()}},kQ=xt(SF),SU=se(kQ).mul(2).sub(1),Km=Ae(([i],{material:e})=>{let t=e.side;return t===hi?i=i.mul(-1):t===sr&&(i=i.mul(SU)),i}),bye=i=>(Qn('TSL: "directionToFaceDirection()" has been renamed to "negateOnBackSide()".'),Km(i)),eR=Dl("normal","vec3"),ia=Ae(i=>i.geometry.hasAttribute("normal")===!1?(je('TSL: Vertex attribute "normal" not found on geometry.'),pe(0,1,0)):eR,"vec3").once()().toVar("normalLocal"),GQ=is.dFdx().cross(is.dFdy()).normalize().toVar("normalFlat"),D1=Ae(i=>{let e;return i.isFlatShading()?e=GQ:e=EU(ia).toVarying("v_normalViewGeometry").normalize(),e},"vec3").once()().toVar("normalViewGeometry"),zQ=Ae(i=>{let e=D1.transformNormalByInverseViewMatrix(g0);return i.isFlatShading()!==!0&&(e=e.toVarying("v_normalWorldGeometry")),e.normalize().toVar("normalWorldGeometry")},"vec3").once()(),ai=Ae(i=>{let e;return i.subBuildFn==="NORMAL"||i.subBuildFn==="VERTEX"?(e=D1,i.isFlatShading()!==!0&&(e=Km(e))):e=i.context.setupNormal().context({getUV:null,getTextureLevel:null}),e},"vec3").once(["NORMAL","VERTEX"])().toVar("normalView"),_0=ai.transformNormalByInverseViewMatrix(g0).toVar("normalWorld"),r0=Ae(({subBuildFn:i,context:e})=>{let t;return i==="NORMAL"||i==="VERTEX"?t=ai:t=e.setupClearcoatNormal().context({getUV:null,getTextureLevel:null}),t},"vec3").once(["NORMAL","VERTEX"])().toVar("clearcoatNormalView"),TU=Ae(([i,e=Ac])=>so(e).inverse().transpose().mul(i).normalize());Be("transformNormal",TU);var EU=Ae(([i],e)=>{let t=e.context.modelNormalViewMatrix;return t?i.transformNormalByViewMatrix(t):OQ.mul(i).transformNormalByViewMatrix(g0)}),wye=Ae(()=>(je('TSL: "transformedNormalView" is deprecated. Use "normalView" instead.'),ai)).once(["NORMAL","VERTEX"])(),Sye=Ae(()=>(je('TSL: "transformedNormalWorld" is deprecated. Use "normalWorld" instead.'),_0)).once(["NORMAL","VERTEX"])(),Tye=Ae(()=>(je('TSL: "transformedClearcoatNormalView" is deprecated. Use "clearcoatNormalView" instead.'),r0)).once(["NORMAL","VERTEX"])(),A8=new on,VQ=Ht(0).onReference(({material:i})=>i).onObjectUpdate(({material:i})=>i.refractionRatio),bM=Ht(1).onReference(({material:i})=>i).onObjectUpdate(function({material:i,scene:e}){return i.envMap?i.envMapIntensity:e.environmentIntensity}),VM=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?A8.makeRotationFromEuler(n).transpose():A8.identity(),A8}),qQ=qi.negate().reflect(ai),HQ=qi.negate().refract(ai,VQ),WQ=qQ.transformDirection(Eb).toVar("reflectVector"),jQ=HQ.transformDirection(Eb).toVar("refractVector"),XQ=new qu,TF=class extends xc{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===bl?WQ:e.mapping===nc?jQ:(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===Xa?pe(t.x,t.y.negate(),t.z):t:(t=VM.mul(t),(e.renderer.coordinateSystem===Xa||!n.isRenderTargetTexture)&&(t=pe(t.x.negate(),t.yz)),t)}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}},MU=Hn(TF).setParameterLength(1,4).setName("cubeTexture"),Ra=(i=XQ,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=MU(i,e,t,n),r},Eye=(i=XQ)=>MU(i),EF=class extends td{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)}},F1=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=q1(null,e,this.count):Array.isArray(this.getValueFromReference())?(t=Eo(null,e),t.updateType=_n.OBJECT):e==="texture"?t=li(null):e==="cubeTexture"?t=Ra(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}},ir=(i,e,t)=>new F1(i,e,t),$Q=(i,e,t,n)=>new F1(i,e,n,t),MF=class extends F1{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}},Qf=(i,e,t=null)=>new MF(i,e,t),YQ=Pi(),Mye=is.dFdx(),Cye=is.dFdy(),KQ=YQ.dFdx(),ZQ=YQ.dFdy(),QQ=ai,JQ=Cye.cross(QQ),eJ=QQ.cross(Mye),CF=JQ.mul(KQ.x).add(eJ.mul(ZQ.x)),RF=JQ.mul(KQ.y).add(eJ.mul(ZQ.y)),FY=CF.dot(CF).max(RF.dot(RF)),tJ=FY.equal(0).select(0,FY.inverseSqrt()),Rye=CF.mul(tJ).toVar("tangentViewFrame"),Pye=RF.mul(tJ).toVar("bitangentViewFrame"),tR=Dl("tangent","vec4"),f0=tR.xyz.toVar("tangentLocal"),nR=Ae(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=Dh.mul(Lt(f0,0)).xyz.toVarying("v_tangentView").normalize():e=Rye,i.isFlatShading()!==!0&&(e=Km(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("tangentView"),nJ=nR.transformDirection(Eb).toVarying("v_tangentWorld").normalize().toVar("tangentWorld"),iR=Ae(([i,e],t)=>{let n=i.mul(tR.w).xyz;return t.subBuildFn==="NORMAL"&&t.isFlatShading()!==!0&&(n=n.toVarying(e)),n}).once(["NORMAL"]),Iye=iR(eR.cross(tR),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),Nye=iR(ia.cross(f0),"v_bitangentLocal").normalize().toVar("bitangentLocal"),iJ=Ae(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=iR(ai.cross(nR),"v_bitangentView").normalize():e=Pye,i.isFlatShading()!==!0&&(e=Km(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("bitangentView"),Lye=iR(_0.cross(nJ),"v_bitangentWorld").normalize().toVar("bitangentWorld"),Cm=so(nR,iJ,ai).toVar("TBNViewMatrix"),rJ=qi.mul(Cm),Dye=(i,e)=>i.sub(rJ.mul(e)),sJ=Ae(()=>{let i=Im.cross(qi);return i=i.cross(Im).normalize(),i=Xn(i,ai,e0.mul(Eh.oneMinus()).oneMinus().pow2().pow2()).normalize(),i}).once()(),CU=i=>Vt(i).mul(.5).add(.5),oJ=i=>Vt(i).mul(2).sub(1),PF=i=>pe(i,Ia(KC(se(1).sub(_c(i,i))))),Fye=i=>(Qn('TSL: "directionToColor()" has been renamed to "packNormalToRGB()".'),CU(i)),Oye=i=>(Qn('TSL: "colorToDirection()" has been renamed to "unpackRGBToNormal()".'),oJ(i)),IF=class extends Ar{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=wl,this.unpackNormalMode=T2}setup(e){let{normalMapType:t,scaleNode:n,unpackNormalMode:r}=this,s=this.node.mul(2).sub(1);if(t===wl?r===h3?s=PF(s.xy):r===SL?s=PF(s.yw):r!==T2&&Ge(`THREE.NodeMaterial: Unexpected unpack normal mode: ${r}`):r!==T2&&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===u3?o=EU(s):t===wl?o=Cm.mul(s).normalize():(Ge(`NodeMaterial: Unsupported normal map type: ${t}`),o=ai),o}},NF=Hn(IF).setParameterLength(1,2),Bye=Ae(({textureNode:i,bumpScale:e})=>{let t=r=>i.isolate().context({getUV:s=>r(s.uvNode||Pi()),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)}),Uye=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(SU),u=c.sign().mul(n.x.mul(a).add(n.y.mul(l)));return c.abs().mul(t).sub(u).normalize()}),LF=class extends Ar{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 ai;let t=this.scaleNode!==null?this.scaleNode:1,n=Bye({textureNode:this.textureNode,bumpScale:t});return Uye({surf_pos:is,surf_norm:ai,dHdxy:n})}},RU=Hn(LF).setParameterLength(1,2),OY=new Map,ot=class i extends $t{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let n=OY.get(e);return n===void 0&&(n=Qf(e,t),OY.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=NF(this.getTexture("normal"),this.getCache("normalScale","vec2")),r.normalMapType=t.normalMapType,(t.normalMap.format==Rs||t.normalMap.format==sh||t.normalMap.format==rh)&&(r.unpackNormalMode=h3)):t.bumpMap?r=RU(this.getTexture("bump").r,this.getFloat("bumpScale")):r=ai;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=NF(this.getTexture(n),this.getCache(n+"Scale","vec2")):r=ai;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=qC(b1.x,b1.y,b1.y.negate(),b1.x).mul(s.rg.mul(2).sub(ft(1)).normalize().mul(s.b))}else r=b1;else if(n===i.IRIDESCENCE_THICKNESS){let s=ir("1","float",t.iridescenceThicknessRange);if(t.iridescenceThicknessMap){let o=ir("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 aJ=xt(ot,ot.ALPHA_TEST),lJ=xt(ot,ot.COLOR),cJ=xt(ot,ot.SHININESS),uJ=xt(ot,ot.EMISSIVE),PU=xt(ot,ot.OPACITY),hJ=xt(ot,ot.SPECULAR),DF=xt(ot,ot.SPECULAR_INTENSITY),fJ=xt(ot,ot.SPECULAR_COLOR),Jv=xt(ot,ot.SPECULAR_STRENGTH),wM=xt(ot,ot.REFLECTIVITY),dJ=xt(ot,ot.ROUGHNESS),pJ=xt(ot,ot.METALNESS),AJ=xt(ot,ot.NORMAL),mJ=xt(ot,ot.CLEARCOAT),gJ=xt(ot,ot.CLEARCOAT_ROUGHNESS),_J=xt(ot,ot.CLEARCOAT_NORMAL),xJ=xt(ot,ot.ROTATION),yJ=xt(ot,ot.SHEEN),vJ=xt(ot,ot.SHEEN_ROUGHNESS),bJ=xt(ot,ot.ANISOTROPY),wJ=xt(ot,ot.IRIDESCENCE),SJ=xt(ot,ot.IRIDESCENCE_IOR),TJ=xt(ot,ot.IRIDESCENCE_THICKNESS),EJ=xt(ot,ot.TRANSMISSION),MJ=xt(ot,ot.THICKNESS),CJ=xt(ot,ot.IOR),RJ=xt(ot,ot.ATTENUATION_DISTANCE),PJ=xt(ot,ot.ATTENUATION_COLOR),IU=xt(ot,ot.LINE_SCALE),NU=xt(ot,ot.LINE_DASH_SIZE),LU=xt(ot,ot.LINE_GAP_SIZE),qM=xt(ot,ot.LINE_WIDTH),DU=xt(ot,ot.LINE_DASH_OFFSET),IJ=xt(ot,ot.POINT_SIZE),NJ=xt(ot,ot.DISPERSION),FU=xt(ot,ot.LIGHT_MAP),LJ=xt(ot,ot.AO),b1=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))}),DJ=Ae(i=>i.context.setupModelViewProjection(),"vec4").once()().toVarying("v_modelViewProjection"),Na=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)}};Na.OBJECT="object";Na.MATERIAL="material";Na.FRAME="frame";Na.BEFORE_OBJECT="beforeObject";Na.BEFORE_MATERIAL="beforeMaterial";Na.BEFORE_FRAME="beforeFrame";var H1=(i,e)=>new Na(i,e).toStack(),Mb=i=>H1(Na.OBJECT,i),kye=i=>H1(Na.MATERIAL,i),FJ=i=>H1(Na.FRAME,i),Gye=i=>H1(Na.BEFORE_OBJECT,i),zye=i=>H1(Na.BEFORE_MATERIAL,i),Vye=i=>H1(Na.BEFORE_FRAME,i),FF=class extends td{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}},qye=Hn(FF).setParameterLength(2),OF=class extends cb{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=KK(e.itemSize),n=e.count):r=t,super(e,r,n),this.isStorageBufferNode=!0,this.structTypeNode=s,this.access=Mo.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 qye(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(Mo.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return this._attribute===null&&(this._attribute=dU(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}},c0=(i,e=null,t=0)=>new OF(i,e,t),BF=new WeakMap,BY=new WeakMap,UF=new WeakMap;function OJ(i,e){let t,n=Math.max(e.count,1);if(e.isStorageInstancedBufferAttribute===!0)t=c0(e,"mat4",n).element(ou);else if(n*16*4<=i.getUniformBufferLimit())t=q1(e.array,"mat4",n).element(ou);else{let o=BF.get(e);o||(o=new Wu(e.array,16,1),BF.set(e,o));let a=e.usage===KA?pU:JC,l=[a(o,"vec4",16,0),a(o,"vec4",16,4),a(o,"vec4",16,8),a(o,"vec4",16,12)];t=l0(...l)}return t}function Hye(i,e,t){let n=UF.get(i);if(n===void 0){let r=e.clone();n={previousInstanceMatrix:r,node:OJ(t,r)},UF.set(i,n)}return n.node}var OU=$m("vec3","vInstanceColor"),BJ=Ae(([i,e=null],t)=>{let n=i.isStorageInstancedBufferAttribute===!0,r=e&&e.isStorageInstancedBufferAttribute===!0,s=OJ(t,i),o=null;n||Math.max(i.count,1)*16*4>t.getUniformBufferLimit()&&(o=BF.get(i));let a=null,l=null;if(e)if(r)a=c0(e,"vec3",Math.max(e.count,1)).element(ou);else{let u=BY.get(e);u||(u=new yl(e.array,3),BY.set(e,u)),l=u;let f=e.usage===KA?pU:JC;a=pe(f(u,"vec3",3,0))}(o!==null||l!==null)&&FJ(()=>{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(dr).xyz;if(dr.assign(c),t.needsPreviousData()){let u=t.object;Mb(({object:p})=>{UF.get(p).previousInstanceMatrix.array.set(i.array)});let f=Hye(u,i,t);zm.assign(f.mul(zm).xyz)}if(t.hasGeometryAttribute("normal")){let u=TU(ia,s);ia.assign(u)}a!==null&&OU.assign(a)},"void"),UJ=Ae(([i])=>{let{instanceMatrix:e,instanceColor:t}=i;BJ(e,t)},"void"),Wye=Ae(([i,e])=>{let t=fe(km(ns(i),0).x).toConst(),n=fe(e),r=n.mod(t).toConst(),s=n.div(t).toConst();return ns(i,Tr(r,s))}),jye=Ae(([i,e])=>{let t=fe(km(ns(i),0).x).toConst(),n=fe(e).mod(t).toConst(),r=fe(e).div(t).toConst();return ns(i,Tr(n,r)).x}),BU=$m("vec4","vBatchColor"),kJ=Ae(([i],e)=>{let t=e.getDrawIndex()===null?ou:SQ,n=jye(i._indirectTexture,fe(t)),r=i._matricesTexture,s=fe(km(ns(r),0).x).toConst(),o=se(n).mul(4).toInt().toConst(),a=o.mod(s).toConst(),l=o.div(s).toConst(),c=l0(ns(r,Tr(a,l)),ns(r,Tr(a.add(1),l)),ns(r,Tr(a.add(2),l)),ns(r,Tr(a.add(3),l))),u=i._colorsTexture;if(u!==null){let v=Wye(u,n);BU.assign(v)}let f=so(c);dr.assign(c.mul(dr));let p=ia.div(pe(f[0].dot(f[0]),f[1].dot(f[1]),f[2].dot(f[2]))),x=f.mul(p).xyz;ia.assign(x),e.hasGeometryAttribute("tangent")&&f0.mulAssign(f)},"void"),HM=new WeakMap,WM=new WeakMap;function UU(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=ps(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 GJ(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=ps(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 zJ(i,e,t,n,r){let s=i.skeleton,o=WM.get(s);if(o===void 0){s.update();let a=new Float32Array(s.boneMatrices);o={previousBoneMatrices:a,node:q1(a,"mat4",s.bones.length)},WM.set(s,o)}return UU(o.node,zm,e,t,n,r)}var VJ=Ae(([i],e)=>{let t=Dl("skinIndex","uvec4"),n=Dl("skinWeight","vec4"),r=ir("bindMatrix","mat4"),s=ir("bindMatrixInverse","mat4"),o=$Q("skeleton.boneMatrices","mat4",i.skeleton.bones.length);if(Mb(({object:l,frameId:c})=>{let u=l.skeleton;if(HM.get(u)!==c){HM.set(u,c);let f=WM.get(u);f!==void 0&&f.previousBoneMatrices.set(u.boneMatrices),u.update()}}),e.needsPreviousData()){let l=zJ(i,r,s,t,n);zm.assign(l)}let a=UU(o,dr,r,s,t,n);if(dr.assign(a),e.hasGeometryAttribute("normal")){let{skinNormal:l,skinTangent:c}=GJ(o,ia,f0,r,s,t,n);ia.assign(l),e.hasGeometryAttribute("tangent")&&f0.assign(c)}},"void"),Xye=Ae(([i,e=null],t)=>{let n=c0(new yl(i.geometry.getAttribute("position").array,3),"vec3").setPBO(!0).toReadOnly().element(ou).toVar(),r=c0(new yl(new Uint32Array(i.geometry.getAttribute("skinIndex").array),4),"uvec4").setPBO(!0).toReadOnly().element(ou).toVar(),s=c0(new yl(i.geometry.getAttribute("skinWeight").array,4),"vec4").setPBO(!0).toReadOnly().element(ou).toVar(),o=Ht(i.bindMatrix,"mat4"),a=Ht(i.bindMatrixInverse,"mat4"),l=q1(i.skeleton.boneMatrices,"mat4",i.skeleton.bones.length),c=i.skeleton;if(Mb(({frameId:f})=>{if(HM.get(c)!==f){HM.set(c,f);let p=WM.get(c);p!==void 0&&p.previousBoneMatrices.set(c.boneMatrices),c.update()}}),t.needsPreviousData()){let f=zJ(i,o,a,r,s);zm.assign(f)}let u=UU(l,n,o,a,r,s);if(e!==null&&e.assign(u),t.hasGeometryAttribute("normal")){let{skinNormal:f,skinTangent:p}=GJ(l,ia,f0,o,a,r,s);ia.assign(f),t.hasGeometryAttribute("tangent")&&f0.assign(p)}return u}),kF=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]=Ll(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+`,SA(o)}return n}},LQ=(i,e=null)=>new mF(Vt(i),e).toStack();Be("debug",LQ);var GM=class extends Ho{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(){}},gF=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!==GM&&Qn('TSL: ".toInspector()" is only available with WebGPU.'),t}};function DQ(i,e="",t=null){return i=Vt(i),i.before(new gF(i,e,t))}Be("toInspector",DQ);function rye(i){je("TSL: AddNodeElement has been removed in favor of tree-shaking. Trying add",i)}var zM=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}},Dl=(i,e=null)=>new zM(i,e),Pi=(i=0)=>Dl("uv"+(i>0?i:""),"vec2"),_F=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)}},km=Hn(_F).setParameterLength(1,2),xF=class extends Bm{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))}}},yU=Hn(xF).setParameterLength(1),VM=class extends Error{constructor(e,t=null){super(e),this.name="NodeError",this.stackTrace=t}},vU=new Ms,xc=class extends Bm{static get type(){return"TextureNode"}constructor(e=vU,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===Ai?"uvec4":this.value.type===Fr?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return Pi(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(km(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 VM("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(zf.TEXTURE_COMPARE))o=this.compareNode;else{let l=n.compareFunction;l===null||l===L_||l===oh||l===YA||l===$c?a=this.compareNode:(o=this.compareNode,Qn('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:R}=r,P=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=R?this.generateOffset(e,R):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,P,C,L,K,F,B,z,V,H);if(N!==null){let Z=n.compareFunction;Z===YA||Z===$c?j=Um(Ll(j,a),Ll(N,"float")).build(e,a):j=Um(Ll(N,"float"),Ll(j,a)).build(e,a)}e.addLineFlowCode(`${l} = ${j}`,this),o.snippet=j,o.propertyName=l}let c=l;return e.needsToWorkingColorSpace(n)&&(c=QC(Ll(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(yU(t)),t.referenceNode=this.getBase();let n=t.value;return t.generateMipmaps===!1&&(n&&n.generateMipmaps===!1||n.minFilter===yi||n.magFilter===yi)&&(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 km(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}},sye=Hn(xc).setParameterLength(1,4).setName("texture"),li=(i=vU,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=sye(i,e,t,n),r},oye=(i=vU)=>li(i),is=(...i)=>li(...i).setSampler(!1),aye=(i,e,t)=>li(i,e).level(t),lye=i=>(i.isNode===!0?i:li(i)).convert("sampler"),cye=i=>(i.isNode===!0?i:li(i)).convert("samplerComparison"),hb=class extends Bm{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"}},H1=(i,e,t)=>new hb(i,e,t),yF=class extends td{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)}},vF=class extends hb{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=t===null?o0(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 yF(this,Vt(e))}},Mo=(i,e)=>new vF(i,e),bF=class extends $t{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}},od=Hn(bF).setParameterLength(1),Iv,Nv,Ro=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?Nv.copy(t.viewport):(e.getViewport(Nv),Nv.multiplyScalar(e.getPixelRatio())):this.scope===i.DPR?this._output.value=e.getPixelRatio():t!==null?(Iv.width=t.width,Iv.height=t.height):e.getDrawingBufferSize(Iv)}setup(){let e=this.scope,t=null;return e===i.SIZE?t=Ht(Iv||(Iv=new Oe)):e===i.VIEWPORT?t=Ht(Nv||(Nv=new gn)):e===i.DPR?t=Ht(1):t=ft(Ym.div(Gm)),this._output=t,t}generate(e){if(this.scope===i.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){let n=e.getNodeProperties(Gm).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${n}.y - ${t}.y )`}return t}return super.generate(e)}};Ro.COORDINATE="coordinate";Ro.VIEWPORT="viewport";Ro.SIZE="size";Ro.UV="uv";Ro.DPR="dpr";var bU=xt(Ro,Ro.DPR),su=xt(Ro,Ro.UV),Gm=xt(Ro,Ro.SIZE),Ym=xt(Ro,Ro.COORDINATE),N1=xt(Ro,Ro.VIEWPORT),wU=N1.zw,FQ=Ym.sub(N1.xy),uye=FQ.div(wU),hye=Ae(()=>(je('TSL: "viewportResolution" is deprecated. Use "screenSize" instead.',new kr),Gm),"vec2").once()(),c8=null,kE=null,u8=null,GE=null,h8=null,zE=null,f8=null,VE=null,d8=null,qE=null,p8=null,HE=null,A8=null,WE=null,m0=Ht(0,"uint").setName("u_cameraIndex").setGroup(jC("cameraIndex")).toVarying("v_cameraIndex"),n0=Ht("float").setName("cameraNear").setGroup(Kt).onRenderUpdate(({camera:i})=>i.near),i0=Ht("float").setName("cameraFar").setGroup(Kt).onRenderUpdate(({camera:i})=>i.far),Pa=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.projectionMatrix);kE===null?kE=Mo(t).setGroup(Kt).setName("cameraProjectionMatrices"):kE.array=t,e=kE.element(i.isMultiViewCamera?od("gl_ViewID_OVR"):m0)}else c8===null&&(c8=Ht(i.projectionMatrix).setName("cameraProjectionMatrix").setGroup(Kt).onRenderUpdate(({camera:t})=>t.projectionMatrix)),e=c8;return e}).once()(),OQ=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.projectionMatrixInverse);GE===null?GE=Mo(t).setGroup(Kt).setName("cameraProjectionMatricesInverse"):GE.array=t,e=GE.element(i.isMultiViewCamera?od("gl_ViewID_OVR"):m0)}else u8===null&&(u8=Ht(i.projectionMatrixInverse).setName("cameraProjectionMatrixInverse").setGroup(Kt).onRenderUpdate(({camera:t})=>t.projectionMatrixInverse)),e=u8;return e}).once()(),g0=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorldInverse);zE===null?zE=Mo(t).setGroup(Kt).setName("cameraViewMatrices"):zE.array=t,e=zE.element(i.isMultiViewCamera?od("gl_ViewID_OVR"):m0)}else h8===null&&(h8=Ht(i.matrixWorldInverse).setName("cameraViewMatrix").setGroup(Kt).onRenderUpdate(({camera:t})=>t.matrixWorldInverse)),e=h8;return e}).once()(),Cb=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorld);VE===null?VE=Mo(t).setGroup(Kt).setName("cameraWorldMatrices"):VE.array=t,e=VE.element(i.isMultiViewCamera?od("gl_ViewID_OVR"):m0)}else f8===null&&(f8=Ht(i.matrixWorld).setName("cameraWorldMatrix").setGroup(Kt).onRenderUpdate(({camera:t})=>t.matrixWorld)),e=f8;return e}).once()(),fye=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.normalMatrix);qE===null?qE=Mo(t).setGroup(Kt).setName("cameraNormalMatrices"):qE.array=t,e=qE.element(i.isMultiViewCamera?od("gl_ViewID_OVR"):m0)}else d8===null&&(d8=Ht(i.normalMatrix).setName("cameraNormalMatrix").setGroup(Kt).onRenderUpdate(({camera:t})=>t.normalMatrix)),e=d8;return e}).once()(),BQ=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);HE===null?HE=Mo(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)}):HE.array=t,e=HE.element(i.isMultiViewCamera?od("gl_ViewID_OVR"):m0)}else p8===null&&(p8=Ht(new ie).setName("cameraPosition").setGroup(Kt).onRenderUpdate(({camera:t},n)=>n.value.setFromMatrixPosition(t.matrixWorld))),e=p8;return e}).once()(),dye=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.viewport);WE===null?WE=Mo(t,"vec4").setGroup(Kt).setName("cameraViewports"):WE.array=t,e=WE.element(m0)}else A8===null&&(A8=Lt(0,0,Gm.x,Gm.y).toConst("cameraViewport")),e=A8;return e}).once()(),OY=new $a,As=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 Bm(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(),OY.copy(s.boundingSphere).applyMatrix4(t.matrixWorld),n.value=OY.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}};As.WORLD_MATRIX="worldMatrix";As.POSITION="position";As.SCALE="scale";As.VIEW_POSITION="viewPosition";As.DIRECTION="direction";As.RADIUS="radius";var pye=Hn(As,As.DIRECTION).setParameterLength(1),Aye=Hn(As,As.WORLD_MATRIX).setParameterLength(1),mye=Hn(As,As.POSITION).setParameterLength(1),gye=Hn(As,As.SCALE).setParameterLength(1),_ye=Hn(As,As.VIEW_POSITION).setParameterLength(1),xye=Hn(As,As.RADIUS).setParameterLength(1),rl=class extends As{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}},yye=xt(rl,rl.DIRECTION),Ac=xt(rl,rl.WORLD_MATRIX),vye=xt(rl,rl.POSITION),bye=xt(rl,rl.SCALE),wye=xt(rl,rl.VIEW_POSITION),Sye=xt(rl,rl.RADIUS),UQ=Ht(new Sn).onObjectUpdate(({object:i},e)=>e.value.getNormalMatrix(i.matrixWorld)),Tye=Ht(new on).onObjectUpdate(({object:i},e)=>e.value.copy(i.matrixWorld).invert()),Dh=Ae(i=>i.context.modelViewMatrix||kQ).once()().toVar("modelViewMatrix"),kQ=g0.mul(Ac),wF=Ae(i=>(i.context.isHighPrecisionModelViewMatrix=!0,Ht("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),SF=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"),GQ=Ae(i=>i.shaderStage!=="fragment"?(Qn("TSL: `clipSpace` is only available in fragment stage."),Lt()):i.context.clipSpace.toVarying("v_clipSpace")).once()(),Jo=Dl("position","vec3"),dr=Jo.toVarying("positionLocal"),zm=Jo.toVarying("positionPrevious"),Ih=Ae(i=>Ac.mul(dr).xyz.toVarying(i.getSubBuildProperty("v_positionWorld")),"vec3").once(["POSITION"])(),SU=Ae(()=>dr.transformDirection(Ac).toVarying("v_positionWorldDirection").normalize().toVar("positionWorldDirection"),"vec3").once(["POSITION"])(),rs=Ae(i=>{if(i.shaderStage==="fragment"&&i.material.vertexNode){let e=OQ.mul(GQ);return e.xyz.div(e.w).toVar("positionView")}return i.context.setupPositionView().toVarying("v_positionView")},"vec3").once(["POSITION","VERTEX"])(),qi=Ae(i=>{let e;return i.camera.isOrthographicCamera?e=pe(0,0,1):e=rs.negate().toVarying("v_positionViewDirection").normalize(),e.toVar("positionViewDirection")},"vec3").once(["POSITION"])(),TF=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===hi?"false":e.getFrontFacing()}},zQ=xt(TF),TU=se(zQ).mul(2).sub(1),Km=Ae(([i],{material:e})=>{let t=e.side;return t===hi?i=i.mul(-1):t===sr&&(i=i.mul(TU)),i}),Eye=i=>(Qn('TSL: "directionToFaceDirection()" has been renamed to "negateOnBackSide()".'),Km(i)),tR=Dl("normal","vec3"),ra=Ae(i=>i.geometry.hasAttribute("normal")===!1?(je('TSL: Vertex attribute "normal" not found on geometry.'),pe(0,1,0)):tR,"vec3").once()().toVar("normalLocal"),VQ=rs.dFdx().cross(rs.dFdy()).normalize().toVar("normalFlat"),F1=Ae(i=>{let e;return i.isFlatShading()?e=VQ:e=MU(ra).toVarying("v_normalViewGeometry").normalize(),e},"vec3").once()().toVar("normalViewGeometry"),qQ=Ae(i=>{let e=F1.transformNormalByInverseViewMatrix(g0);return i.isFlatShading()!==!0&&(e=e.toVarying("v_normalWorldGeometry")),e.normalize().toVar("normalWorldGeometry")},"vec3").once()(),ai=Ae(i=>{let e;return i.subBuildFn==="NORMAL"||i.subBuildFn==="VERTEX"?(e=F1,i.isFlatShading()!==!0&&(e=Km(e))):e=i.context.setupNormal().context({getUV:null,getTextureLevel:null}),e},"vec3").once(["NORMAL","VERTEX"])().toVar("normalView"),_0=ai.transformNormalByInverseViewMatrix(g0).toVar("normalWorld"),r0=Ae(({subBuildFn:i,context:e})=>{let t;return i==="NORMAL"||i==="VERTEX"?t=ai:t=e.setupClearcoatNormal().context({getUV:null,getTextureLevel:null}),t},"vec3").once(["NORMAL","VERTEX"])().toVar("clearcoatNormalView"),EU=Ae(([i,e=Ac])=>so(e).inverse().transpose().mul(i).normalize());Be("transformNormal",EU);var MU=Ae(([i],e)=>{let t=e.context.modelNormalViewMatrix;return t?i.transformNormalByViewMatrix(t):UQ.mul(i).transformNormalByViewMatrix(g0)}),Mye=Ae(()=>(je('TSL: "transformedNormalView" is deprecated. Use "normalView" instead.'),ai)).once(["NORMAL","VERTEX"])(),Cye=Ae(()=>(je('TSL: "transformedNormalWorld" is deprecated. Use "normalWorld" instead.'),_0)).once(["NORMAL","VERTEX"])(),Rye=Ae(()=>(je('TSL: "transformedClearcoatNormalView" is deprecated. Use "clearcoatNormalView" instead.'),r0)).once(["NORMAL","VERTEX"])(),m8=new on,HQ=Ht(0).onReference(({material:i})=>i).onObjectUpdate(({material:i})=>i.refractionRatio),wM=Ht(1).onReference(({material:i})=>i).onObjectUpdate(function({material:i,scene:e}){return i.envMap?i.envMapIntensity:e.environmentIntensity}),qM=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?m8.makeRotationFromEuler(n).transpose():m8.identity(),m8}),WQ=qi.negate().reflect(ai),jQ=qi.negate().refract(ai,HQ),XQ=WQ.transformDirection(Cb).toVar("reflectVector"),$Q=jQ.transformDirection(Cb).toVar("refractVector"),YQ=new qu,EF=class extends xc{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===bl?XQ:e.mapping===nc?$Q:(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===Xa?pe(t.x,t.y.negate(),t.z):t:(t=qM.mul(t),(e.renderer.coordinateSystem===Xa||!n.isRenderTargetTexture)&&(t=pe(t.x.negate(),t.yz)),t)}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}},CU=Hn(EF).setParameterLength(1,4).setName("cubeTexture"),Ra=(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=CU(i,e,t,n),r},Pye=(i=YQ)=>CU(i),MF=class extends td{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)}},O1=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 MF(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=H1(null,e,this.count):Array.isArray(this.getValueFromReference())?(t=Mo(null,e),t.updateType=_n.OBJECT):e==="texture"?t=li(null):e==="cubeTexture"?t=Ra(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}},ir=(i,e,t)=>new O1(i,e,t),KQ=(i,e,t,n)=>new O1(i,e,n,t),CF=class extends O1{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}},Qf=(i,e,t=null)=>new CF(i,e,t),ZQ=Pi(),Iye=rs.dFdx(),Nye=rs.dFdy(),QQ=ZQ.dFdx(),JQ=ZQ.dFdy(),eJ=ai,tJ=Nye.cross(eJ),nJ=eJ.cross(Iye),RF=tJ.mul(QQ.x).add(nJ.mul(JQ.x)),PF=tJ.mul(QQ.y).add(nJ.mul(JQ.y)),BY=RF.dot(RF).max(PF.dot(PF)),iJ=BY.equal(0).select(0,BY.inverseSqrt()),Lye=RF.mul(iJ).toVar("tangentViewFrame"),Dye=PF.mul(iJ).toVar("bitangentViewFrame"),nR=Dl("tangent","vec4"),f0=nR.xyz.toVar("tangentLocal"),iR=Ae(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=Dh.mul(Lt(f0,0)).xyz.toVarying("v_tangentView").normalize():e=Lye,i.isFlatShading()!==!0&&(e=Km(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("tangentView"),rJ=iR.transformDirection(Cb).toVarying("v_tangentWorld").normalize().toVar("tangentWorld"),rR=Ae(([i,e],t)=>{let n=i.mul(nR.w).xyz;return t.subBuildFn==="NORMAL"&&t.isFlatShading()!==!0&&(n=n.toVarying(e)),n}).once(["NORMAL"]),Fye=rR(tR.cross(nR),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),Oye=rR(ra.cross(f0),"v_bitangentLocal").normalize().toVar("bitangentLocal"),sJ=Ae(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=rR(ai.cross(iR),"v_bitangentView").normalize():e=Dye,i.isFlatShading()!==!0&&(e=Km(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("bitangentView"),Bye=rR(_0.cross(rJ),"v_bitangentWorld").normalize().toVar("bitangentWorld"),Cm=so(iR,sJ,ai).toVar("TBNViewMatrix"),oJ=qi.mul(Cm),Uye=(i,e)=>i.sub(oJ.mul(e)),aJ=Ae(()=>{let i=Im.cross(qi);return i=i.cross(Im).normalize(),i=Xn(i,ai,e0.mul(Eh.oneMinus()).oneMinus().pow2().pow2()).normalize(),i}).once()(),RU=i=>Vt(i).mul(.5).add(.5),lJ=i=>Vt(i).mul(2).sub(1),IF=i=>pe(i,Ia(ZC(se(1).sub(_c(i,i))))),kye=i=>(Qn('TSL: "directionToColor()" has been renamed to "packNormalToRGB()".'),RU(i)),Gye=i=>(Qn('TSL: "colorToDirection()" has been renamed to "unpackRGBToNormal()".'),lJ(i)),NF=class extends Ar{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=wl,this.unpackNormalMode=M2}setup(e){let{normalMapType:t,scaleNode:n,unpackNormalMode:r}=this,s=this.node.mul(2).sub(1);if(t===wl?r===f3?s=IF(s.xy):r===TL?s=IF(s.yw):r!==M2&&Ge(`THREE.NodeMaterial: Unexpected unpack normal mode: ${r}`):r!==M2&&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===h3?o=MU(s):t===wl?o=Cm.mul(s).normalize():(Ge(`NodeMaterial: Unsupported normal map type: ${t}`),o=ai),o}},LF=Hn(NF).setParameterLength(1,2),zye=Ae(({textureNode:i,bumpScale:e})=>{let t=r=>i.isolate().context({getUV:s=>r(s.uvNode||Pi()),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)}),Vye=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(TU),u=c.sign().mul(n.x.mul(a).add(n.y.mul(l)));return c.abs().mul(t).sub(u).normalize()}),DF=class extends Ar{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 ai;let t=this.scaleNode!==null?this.scaleNode:1,n=zye({textureNode:this.textureNode,bumpScale:t});return Vye({surf_pos:rs,surf_norm:ai,dHdxy:n})}},PU=Hn(DF).setParameterLength(1,2),UY=new Map,ot=class i extends $t{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let n=UY.get(e);return n===void 0&&(n=Qf(e,t),UY.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=LF(this.getTexture("normal"),this.getCache("normalScale","vec2")),r.normalMapType=t.normalMapType,(t.normalMap.format==Rs||t.normalMap.format==sh||t.normalMap.format==rh)&&(r.unpackNormalMode=f3)):t.bumpMap?r=PU(this.getTexture("bump").r,this.getFloat("bumpScale")):r=ai;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=LF(this.getTexture(n),this.getCache(n+"Scale","vec2")):r=ai;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=HC(w1.x,w1.y,w1.y.negate(),w1.x).mul(s.rg.mul(2).sub(ft(1)).normalize().mul(s.b))}else r=w1;else if(n===i.IRIDESCENCE_THICKNESS){let s=ir("1","float",t.iridescenceThicknessRange);if(t.iridescenceThicknessMap){let o=ir("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 cJ=xt(ot,ot.ALPHA_TEST),uJ=xt(ot,ot.COLOR),hJ=xt(ot,ot.SHININESS),fJ=xt(ot,ot.EMISSIVE),IU=xt(ot,ot.OPACITY),dJ=xt(ot,ot.SPECULAR),FF=xt(ot,ot.SPECULAR_INTENSITY),pJ=xt(ot,ot.SPECULAR_COLOR),tb=xt(ot,ot.SPECULAR_STRENGTH),SM=xt(ot,ot.REFLECTIVITY),AJ=xt(ot,ot.ROUGHNESS),mJ=xt(ot,ot.METALNESS),gJ=xt(ot,ot.NORMAL),_J=xt(ot,ot.CLEARCOAT),xJ=xt(ot,ot.CLEARCOAT_ROUGHNESS),yJ=xt(ot,ot.CLEARCOAT_NORMAL),vJ=xt(ot,ot.ROTATION),bJ=xt(ot,ot.SHEEN),wJ=xt(ot,ot.SHEEN_ROUGHNESS),SJ=xt(ot,ot.ANISOTROPY),TJ=xt(ot,ot.IRIDESCENCE),EJ=xt(ot,ot.IRIDESCENCE_IOR),MJ=xt(ot,ot.IRIDESCENCE_THICKNESS),CJ=xt(ot,ot.TRANSMISSION),RJ=xt(ot,ot.THICKNESS),PJ=xt(ot,ot.IOR),IJ=xt(ot,ot.ATTENUATION_DISTANCE),NJ=xt(ot,ot.ATTENUATION_COLOR),NU=xt(ot,ot.LINE_SCALE),LU=xt(ot,ot.LINE_DASH_SIZE),DU=xt(ot,ot.LINE_GAP_SIZE),HM=xt(ot,ot.LINE_WIDTH),FU=xt(ot,ot.LINE_DASH_OFFSET),LJ=xt(ot,ot.POINT_SIZE),DJ=xt(ot,ot.DISPERSION),OU=xt(ot,ot.LIGHT_MAP),FJ=xt(ot,ot.AO),w1=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))}),OJ=Ae(i=>i.context.setupModelViewProjection(),"vec4").once()().toVarying("v_modelViewProjection"),Na=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)}};Na.OBJECT="object";Na.MATERIAL="material";Na.FRAME="frame";Na.BEFORE_OBJECT="beforeObject";Na.BEFORE_MATERIAL="beforeMaterial";Na.BEFORE_FRAME="beforeFrame";var W1=(i,e)=>new Na(i,e).toStack(),Rb=i=>W1(Na.OBJECT,i),qye=i=>W1(Na.MATERIAL,i),BJ=i=>W1(Na.FRAME,i),Hye=i=>W1(Na.BEFORE_OBJECT,i),Wye=i=>W1(Na.BEFORE_MATERIAL,i),jye=i=>W1(Na.BEFORE_FRAME,i),OF=class extends td{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}},Xye=Hn(OF).setParameterLength(2),BF=class extends hb{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=QK(e.itemSize),n=e.count):r=t,super(e,r,n),this.isStorageBufferNode=!0,this.structTypeNode=s,this.access=Co.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 Xye(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(Co.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return this._attribute===null&&(this._attribute=pU(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}},c0=(i,e=null,t=0)=>new BF(i,e,t),UF=new WeakMap,kY=new WeakMap,kF=new WeakMap;function UJ(i,e){let t,n=Math.max(e.count,1);if(e.isStorageInstancedBufferAttribute===!0)t=c0(e,"mat4",n).element(ou);else if(n*16*4<=i.getUniformBufferLimit())t=H1(e.array,"mat4",n).element(ou);else{let o=UF.get(e);o||(o=new Wu(e.array,16,1),UF.set(e,o));let a=e.usage===KA?AU:eR,l=[a(o,"vec4",16,0),a(o,"vec4",16,4),a(o,"vec4",16,8),a(o,"vec4",16,12)];t=l0(...l)}return t}function $ye(i,e,t){let n=kF.get(i);if(n===void 0){let r=e.clone();n={previousInstanceMatrix:r,node:UJ(t,r)},kF.set(i,n)}return n.node}var BU=$m("vec3","vInstanceColor"),kJ=Ae(([i,e=null],t)=>{let n=i.isStorageInstancedBufferAttribute===!0,r=e&&e.isStorageInstancedBufferAttribute===!0,s=UJ(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=c0(e,"vec3",Math.max(e.count,1)).element(ou);else{let u=kY.get(e);u||(u=new yl(e.array,3),kY.set(e,u)),l=u;let f=e.usage===KA?AU:eR;a=pe(f(u,"vec3",3,0))}(o!==null||l!==null)&&BJ(()=>{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(dr).xyz;if(dr.assign(c),t.needsPreviousData()){let u=t.object;Rb(({object:p})=>{kF.get(p).previousInstanceMatrix.array.set(i.array)});let f=$ye(u,i,t);zm.assign(f.mul(zm).xyz)}if(t.hasGeometryAttribute("normal")){let u=EU(ra,s);ra.assign(u)}a!==null&&BU.assign(a)},"void"),GJ=Ae(([i])=>{let{instanceMatrix:e,instanceColor:t}=i;kJ(e,t)},"void"),Yye=Ae(([i,e])=>{let t=fe(km(is(i),0).x).toConst(),n=fe(e),r=n.mod(t).toConst(),s=n.div(t).toConst();return is(i,Tr(r,s))}),Kye=Ae(([i,e])=>{let t=fe(km(is(i),0).x).toConst(),n=fe(e).mod(t).toConst(),r=fe(e).div(t).toConst();return is(i,Tr(n,r)).x}),UU=$m("vec4","vBatchColor"),zJ=Ae(([i],e)=>{let t=e.getDrawIndex()===null?ou:EQ,n=Kye(i._indirectTexture,fe(t)),r=i._matricesTexture,s=fe(km(is(r),0).x).toConst(),o=se(n).mul(4).toInt().toConst(),a=o.mod(s).toConst(),l=o.div(s).toConst(),c=l0(is(r,Tr(a,l)),is(r,Tr(a.add(1),l)),is(r,Tr(a.add(2),l)),is(r,Tr(a.add(3),l))),u=i._colorsTexture;if(u!==null){let v=Yye(u,n);UU.assign(v)}let f=so(c);dr.assign(c.mul(dr));let p=ra.div(pe(f[0].dot(f[0]),f[1].dot(f[1]),f[2].dot(f[2]))),x=f.mul(p).xyz;ra.assign(x),e.hasGeometryAttribute("tangent")&&f0.mulAssign(f)},"void"),WM=new WeakMap,jM=new WeakMap;function kU(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=ps(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 VJ(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=ps(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 qJ(i,e,t,n,r){let s=i.skeleton,o=jM.get(s);if(o===void 0){s.update();let a=new Float32Array(s.boneMatrices);o={previousBoneMatrices:a,node:H1(a,"mat4",s.bones.length)},jM.set(s,o)}return kU(o.node,zm,e,t,n,r)}var HJ=Ae(([i],e)=>{let t=Dl("skinIndex","uvec4"),n=Dl("skinWeight","vec4"),r=ir("bindMatrix","mat4"),s=ir("bindMatrixInverse","mat4"),o=KQ("skeleton.boneMatrices","mat4",i.skeleton.bones.length);if(Rb(({object:l,frameId:c})=>{let u=l.skeleton;if(WM.get(u)!==c){WM.set(u,c);let f=jM.get(u);f!==void 0&&f.previousBoneMatrices.set(u.boneMatrices),u.update()}}),e.needsPreviousData()){let l=qJ(i,r,s,t,n);zm.assign(l)}let a=kU(o,dr,r,s,t,n);if(dr.assign(a),e.hasGeometryAttribute("normal")){let{skinNormal:l,skinTangent:c}=VJ(o,ra,f0,r,s,t,n);ra.assign(l),e.hasGeometryAttribute("tangent")&&f0.assign(c)}},"void"),Zye=Ae(([i,e=null],t)=>{let n=c0(new yl(i.geometry.getAttribute("position").array,3),"vec3").setPBO(!0).toReadOnly().element(ou).toVar(),r=c0(new yl(new Uint32Array(i.geometry.getAttribute("skinIndex").array),4),"uvec4").setPBO(!0).toReadOnly().element(ou).toVar(),s=c0(new yl(i.geometry.getAttribute("skinWeight").array,4),"vec4").setPBO(!0).toReadOnly().element(ou).toVar(),o=Ht(i.bindMatrix,"mat4"),a=Ht(i.bindMatrixInverse,"mat4"),l=H1(i.skeleton.boneMatrices,"mat4",i.skeleton.bones.length),c=i.skeleton;if(Rb(({frameId:f})=>{if(WM.get(c)!==f){WM.set(c,f);let p=jM.get(c);p!==void 0&&p.previousBoneMatrices.set(c.boneMatrices),c.update()}}),t.needsPreviousData()){let f=qJ(i,o,a,r,s);zm.assign(f)}let u=kU(l,n,o,a,r,s);if(e!==null&&e.assign(u),t.hasGeometryAttribute("normal")){let{skinNormal:f,skinTangent:p}=VJ(l,ra,f0,o,a,r,s);ra.assign(f),t.hasGeometryAttribute("tangent")&&f0.assign(p)}return u}),GF=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]=Ll(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},R=T.start,P=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)+" = "+R,F=p+" "+v+" "+P;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()}},Ri=(...i)=>new kF(Pm(i,"int")).toStack(),$ye=()=>Ll("continue").toStack(),qJ=()=>Ll("break").toStack(),m8=new WeakMap,Ml=new gn,UY=new WeakMap,kY=Ae(({bufferMap:i,influence:e,stride:t,width:n,depth:r,offset:s})=>{let o=fe(wQ).mul(t).add(s),a=o.div(n),l=o.sub(a.mul(n));return ns(i,Tr(l,a)).depth(r).xyz.mul(e)});function Yye(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=m8.get(i);if(o===void 0||o.count!==s){let T=function(){w.dispose(),m8.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 TA(v,f,p,s);w.type=Zi,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&&(Ml.fromBufferAttribute(R,F),v[D+N+0]=Ml.x,v[D+N+1]=Ml.y,v[D+N+2]=Ml.z,v[D+N+3]=0),t===!0&&(Ml.fromBufferAttribute(C,F),v[D+N+4]=Ml.x,v[D+N+5]=Ml.y,v[D+N+6]=Ml.z,v[D+N+7]=0),n===!0&&(Ml.fromBufferAttribute(L,F),v[D+N+8]=Ml.x,v[D+N+9]=Ml.y,v[D+N+10]=Ml.z,v[D+N+11]=L.itemSize===4?Ml.w:1)}}o={count:s,texture:w,stride:u,size:new Oe(f,p)},m8.set(i,o),i.addEventListener("dispose",T)}return o}var HJ=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=UY.get(i);(o===void 0||o.count!==s)&&(o={base:Ht(1),influences:i.morphTargetInfluences?Eo(i.morphTargetInfluences,"float"):null,count:s},UY.set(i,o));let{base:a,influences:l}=o,{texture:c,stride:u,size:f}=Yye(e);t===!0&&dr.mulAssign(a),n===!0&&ia.mulAssign(a);let p=fe(f.width);Ri(s,({i:x})=>{let v=se(0).toVar();i.count>1&&i.morphTexture!==null&&i.morphTexture!==void 0?v.assign(ns(i.morphTexture,Tr(fe(x).add(1),fe(ou))).r):v.assign(l.element(x).toVar()),Wt(v.notEqual(0),()=>{t===!0&&dr.addAssign(kY({bufferMap:c,influence:v,stride:u,width:p,depth:x,offset:fe(0)})),n===!0&&ia.addAssign(kY({bufferMap:c,influence:v,stride:u,width:p,depth:x,offset:fe(1)}))})}),Mb(({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"),d0=class extends $t{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}},GF=class extends d0{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}},zF=class extends ab{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)}},WJ=Hn(zF),VF=class extends d0{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}},gm=new Oe,O1=class extends xc{static get type(){return"ViewportTextureNode"}constructor(e=su,t=null,n=null){let r=null;n===null?(r=new PA,r.minFilter=yo,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(gm):s.getDrawingBufferSize?s.getDrawingBufferSize(gm):gm.set(s.width,s.height);let o=this.getTextureForReference(s);(o.image.width!==gm.width||o.image.height!==gm.height)&&(o.image.width=gm.width,o.image.height=gm.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}},Kye=Hn(O1).setParameterLength(0,3),kU=Hn(O1,null,null,{generateMipmaps:!0}).setParameterLength(0,3),Zye=kU(),jJ=(i=su,e=null)=>Zye.sample(i,e),g8=null,qF=class extends O1{static get type(){return"ViewportDepthTextureNode"}constructor(e=su,t=null,n=null){n===null&&(g8===null&&(g8=new us),n=g8),super(e,t,n)}},GU=Hn(qF).setParameterLength(0,3),cu=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=zU(is.z,n0,i0):r=Dm(is.z,n0,i0);else if(t===i.LINEAR_DEPTH)if(n!==null)if(e.isPerspectiveCamera){let s=rR(n,n0,i0);r=Dm(s,n0,i0)}else r=n;else r=Dm(is.z,n0,i0);return r}};cu.DEPTH_BASE="depthBase";cu.DEPTH="depth";cu.LINEAR_DEPTH="linearDepth";var Dm=(i,e,t)=>i.add(e).div(e.sub(t)),Qye=(i,e,t)=>i.add(t).div(t.sub(e)),XJ=Ae(([i,e,t],n)=>n.renderer.reversedDepthBuffer===!0?t.sub(e).mul(i).sub(t):e.sub(t).mul(i).sub(e)),zU=(i,e,t)=>e.add(i).mul(t).div(t.sub(e).mul(i)),$J=(i,e,t)=>e.mul(i.add(t)).div(i.mul(e.sub(t))),rR=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))),sR=(i,e,t)=>{e=e.max(1e-6).toVar();let n=Ch(i.negate().div(e)),r=Ch(t.div(e));return n.div(r)},Jye=(i,e,t)=>{let n=i.mul($C(t.div(e)));return se(Math.E).pow(n).mul(e).negate()},YJ=Hn(cu,cu.DEPTH_BASE),VU=xt(cu,cu.DEPTH),jM=Hn(cu,cu.LINEAR_DEPTH).setParameterLength(0,1),e2e=jM(GU());VU.assign=i=>YJ(i);var Fh=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=Eo(t).setGroup(Kt);Ri(o,({i:c})=>{let u=l.element(c);n.assign(is.dot(u.xyz).negate().add(u.w)),r.assign(n.fwidth().div(2)),s.mulAssign(Bl(r.negate(),r,n))})}let a=e.length;if(a>0){let l=Eo(e).setGroup(Kt),c=se(1).toVar("intersectionClipOpacity");Ri(a,({i:u})=>{let f=l.element(u);n.assign(is.dot(f.xyz).negate().add(f.w)),r.assign(n.fwidth().div(2)),c.mulAssign(Bl(r.negate(),r,n).oneMinus())}),s.mulAssign(c.oneMinus())}Ci.a.mulAssign(s),Ci.a.equal(0).discard()})()}setupDefault(e,t){return Ae(()=>{let n=t.length;if(this.hardwareClipping===!1&&n>0){let s=Eo(t).setGroup(Kt);Ri(n,({i:o})=>{let a=s.element(o);is.dot(a.xyz).greaterThan(a.w).discard()})}let r=e.length;if(r>0){let s=Eo(e).setGroup(Kt),o=Fl(!0).toVar("clipped");Ri(r,({i:a})=>{let l=s.element(a);o.assign(is.dot(l.xyz).greaterThan(l.w).and(o))}),o.discard()}})()}setupHardwareClipping(e,t){let n=e.length;return t.enableHardwareClipping(n),Ae(()=>{let r=Eo(e).setGroup(Kt),s=od(t.getClipDistance());Ri(n,({i:o})=>{let a=r.element(o),l=is.dot(a.xyz).sub(a.w).negate();s.element(o).assign(l)})})()}};Fh.ALPHA_TO_COVERAGE="alphaToCoverage";Fh.DEFAULT="default";Fh.HARDWARE="hardware";var t2e=()=>new Fh,n2e=()=>new Fh(Fh.ALPHA_TO_COVERAGE),i2e=()=>new Fh(Fh.HARDWARE),r2e=.05,GY=Ae(([i])=>au(bn(1e4,Ca(bn(17,i.x).add(bn(.1,i.y)))).mul(ps(.1,er(Ca(bn(13,i.y).add(i.x))))))),zY=Ae(([i])=>GY(ft(GY(i.xy),i.z))),s2e=Ae(([i])=>{let e=Er(Ph(tU(i.xyz)),Ph(nU(i.xyz))),t=se(1).div(se(r2e).mul(e)).toVar("pixScale"),n=ft(L1(Rh(Ch(t))),L1(YC(Ch(t)))),r=ft(zY(Rh(n.x.mul(i.xyz))),zY(Rh(n.y.mul(i.xyz)))),s=au(Ch(t)),o=ps(bn(s.oneMinus(),r.x),bn(s,r.y)),a=il(s,s.oneMinus()),l=pe(o.mul(o).div(bn(2,a).mul(ii(1,a))),o.sub(bn(.5,a)).div(ii(1,a)),ii(1,ii(1,o).mul(ii(1,o)).div(bn(2,a).mul(ii(1,a))))),c=o.lessThan(a.oneMinus()).select(o.lessThan(a).select(l.x,l.y),l.z);return lu(c,1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]}),HF=class extends GM{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}},KJ=(i=0)=>new HF(i),mr=class extends Cs{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(V1(t.slice(0,-4)),n.getCacheKey());return this.type+Tb(e)}build(e){this.setup(e)}setupObserver(e){return new j8(e)}setup(e){e.context.setupNormal=()=>Lm(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=Lm(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,Ci.a).max(0);o=this.setupOutput(e,c),M1.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&&M1.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=n2e():e.stack.addToStack(t2e())}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(i2e()),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=sR(is.z,n0,i0):r=Dm(is.z,n0,i0))}r!==null&&VU.assign(r).toStack()}setupPositionView(){return Dh.mul(dr).xyz}setupModelViewProjection(){return Pa.mul(is)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.position=e.removeStack(),DJ}setupPosition(e){let{object:t,geometry:n}=e;if((n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color)&&HJ(t),t.isSkinnedMesh===!0&&VJ(t),this.displacementMap){let r=Qf("displacementMap","texture"),s=Qf("displacementScale","float"),o=Qf("displacementBias","float");dr.addAssign(ia.normalize().mul(r.x.mul(s).add(o)))}return t.isBatchedMesh&&kJ(t),t.isInstancedMesh&&t.instanceMatrix&&t.instanceMatrix.isInstancedBufferAttribute===!0&&UJ(t),this.positionNode!==null&&dr.assign(Lm(this.positionNode,"POSITION","vec3")),dr}setupDiffuseColor(e){let{object:t,geometry:n}=e;this.maskNode!==null&&Fl(this.maskNode).not().discard();let r=this.colorNode?Lt(this.colorNode):lJ;this.vertexColors===!0&&n.hasAttribute("color")&&(r=r.mul(KJ())),t.instanceColor&&(r=OU.mul(r)),t.isBatchedMesh&&t._colorsTexture&&(r=BU.mul(r)),Ci.assign(r);let s=this.opacityNode?se(this.opacityNode):PU;Ci.a.assign(Ci.a.mul(s));let o=null;(this.alphaTestNode!==null||this.alphaTest>0)&&(o=this.alphaTestNode!==null?se(this.alphaTestNode):aJ,this.alphaToCoverage===!0?(Ci.a=Bl(o,o.add(rU(Ci.a)),Ci.a),Ci.a.lessThanEqual(0).discard()):Ci.a.lessThanEqual(o).discard()),this.alphaHash===!0&&Ci.a.lessThan(s2e(dr)).discard(),e.isOpaque()&&Ci.a.assign(1)}setupVariants(){}setupOutgoingLight(){return this.lights===!0?pe(0):Ci.rgb}setupNormal(){return this.normalNode?pe(this.normalNode):AJ}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?Qf("envMap","cubeTexture"):Qf("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new VF(FU)),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 GF(e.context.ambientOcclusion)),t}setupAmbientOcclusion(e){let t=this.aoNode;t===null&&e.material.aoMap&&(t=LJ),e.context.getAO&&(t=e.context.getAO(t,e)),t!==null&&(iF.assign(t),e.context.ambientOcclusion=iF)}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=WJ(l,u,a,n,r)}else n!==null&&(c=pe(r!==null?Xn(c,n,r):n));return(s&&s.isNode===!0||t.emissive&&t.emissive.isColor===!0)&&(nF.assign(pe(s||uJ)),c=c.add(nF)),c}setupFog(e,t){let n=e.fogNode;return n&&(M1.assign(t),t=Lt(n.toVar())),t}setupPremultipliedAlpha(e,t){return gU(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=Cs.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}},o2e=new Hc,WF=class extends mr{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues(o2e),this.setValues(e)}},a2e=new Xy,jF=class extends mr{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues(a2e),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):DU,t=this.dashScaleNode?se(this.dashScaleNode):IU,n=this.dashSizeNode?se(this.dashSizeNode):NU,r=this.gapSizeNode?se(this.gapSizeNode):LU;Nm.assign(n),ob.assign(r);let s=A0(Dl("lineDistance").mul(t));(e?s.add(e):s).mod(Nm.add(ob)).greaterThan(Nm).discard()}};var SM=$m("vec3","worldStart"),XF=$m("vec3","worldEnd"),ZJ=$m("float","lineDistance"),wm=$m("vec4","worldPos"),VY=Ae(({start:i,end:e})=>{let t=Pa.element(2).element(2),n=Pa.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"}),l2e=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"}),det=Ae(({material:i})=>{let e=i._useDash,t=i._useWorldUnits,n=Dl("instanceStart"),r=Dl("instanceEnd"),s=Lt(Dh.mul(Lt(n,1))).toVar("start"),o=Lt(Dh.mul(Lt(r,1))).toVar("end"),a,l;e&&(a=se(Dl("instanceDistanceStart")).toVar("distanceStart"),l=se(Dl("instanceDistanceEnd")).toVar("distanceEnd")),t&&(SM.assign(s.xyz),XF.assign(o.xyz));let c=I1.z.div(I1.w),u=Pa.element(2).element(3).equal(-1);if(Wt(u,()=>{Wt(s.z.lessThan(0).and(o.z.greaterThan(0)),()=>{let T=VY({start:s,end:o});o.assign(Lt(Xn(s.xyz,o.xyz,T),o.w)),e&&l.assign(Xn(a,l,T))}).ElseIf(o.z.lessThan(0).and(s.z.greaterThanEqual(0)),()=>{let T=VY({start:o,end:s});s.assign(Lt(Xn(o.xyz,s.xyz,T),s.w)),e&&a.assign(Xn(l,a,T))})}),e){let T=i.dashScaleNode?se(i.dashScaleNode):IU,P=i.offsetNode?se(i.offsetNode):DU,R=Qo.y.lessThan(.5).select(T.mul(a),T.mul(l));R=R.add(P),ZJ.assign(R)}let f=Pa.mul(s),p=Pa.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=Xn(s.xyz,o.xyz,.5).normalize(),R=T.cross(P).normalize(),C=T.cross(R);wm.assign(Qo.y.lessThan(.5).select(s,o));let L=qM.mul(.5);wm.addAssign(Lt(Qo.x.lessThan(0).select(R.mul(L),R.mul(L).negate()),0)),e||(wm.addAssign(Lt(Qo.y.lessThan(.5).select(T.mul(L).negate(),T.mul(L)),0)),wm.addAssign(Lt(C.mul(L),0)),Wt(Qo.y.greaterThan(1).or(Qo.y.lessThan(0)),()=>{wm.subAssign(Lt(C.mul(2).mul(L),0))})),S.assign(Pa.mul(wm));let D=pe().toVar();D.assign(Qo.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(Qo.x.lessThan(0).select(T.negate(),T)),Wt(Qo.y.lessThan(0),()=>{T.assign(T.sub(w))}).ElseIf(Qo.y.greaterThan(1),()=>{T.assign(T.add(w))}),T.assign(T.mul(qM)),T.assign(T.div(I1.w.div(vU))),S.assign(Qo.y.lessThan(.5).select(f,p)),T.assign(T.mul(S.w)),S.assign(S.add(Lt(T,0,0)))}return S})(),pet=Ae(({material:i,renderer:e})=>{let t=i._useAlphaToCoverage,n=i._useDash,r=i._useWorldUnits,s=Pi();if(n){let a=i.dashSizeNode?se(i.dashSizeNode):NU,l=i.gapSizeNode?se(i.gapSizeNode):LU;Nm.assign(a),ob.assign(l),s.y.lessThan(-1).or(s.y.greaterThan(1)).discard(),ZJ.mod(Nm.add(ob)).greaterThan(Nm).discard()}let o=se(1).toVar("alpha");if(r){let a=wm.xyz.normalize().mul(1e5),l=XF.sub(SM),c=l2e({p1:SM,p2:XF,p3:pe(0,0,0),p4:a}),u=SM.add(l.mul(c.x)),f=a.mul(c.y),v=u.sub(f).length().div(qM);if(!n)if(t&&e.currentSamples>0){let w=v.fwidth();o.assign(Bl(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(Bl(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 c2e=new Wy,$F=class extends mr{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(c2e),this.setValues(e)}setupDiffuseColor(){let e=this.opacityNode?se(this.opacityNode):PU;Ci.assign(ZC(Lt(CU(ai),e),vr))}},qU=Ae(([i=wU])=>{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)}),YF=Ae(([i=Pi()])=>{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)}),XM=class extends da{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 qu(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 Wc(5,5,5),o=qU(wU),a=new mr;a.colorNode=li(t,o,0),a.side=hi,a.blending=Zr;let l=new Gn(s,a),c=new Jd;c.add(l),t.minFilter===yo&&(t.minFilter=bi);let u=new M_(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)}},eb=new WeakMap,KF=class extends Ar{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=Ra(null);let t=new qu;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===lp||o===cp){if(eb.has(s)){let a=eb.get(s);qY(a,s.mapping),this._cubeTexture=a}else{let a=s.image;if(u2e(a)){let l=new XM(a.height);l.fromEquirectangularTexture(t,s),qY(l.texture,s.mapping),this._cubeTexture=l.texture,eb.set(s,l.texture),s.addEventListener("dispose",QJ)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}};function u2e(i){return i==null?!1:i.height>0}function QJ(i){let e=i.target;e.removeEventListener("dispose",QJ);let t=eb.get(e);t!==void 0&&(eb.delete(e),t.dispose())}function qY(i,e){e===lp?i.mapping=bl:e===cp&&(i.mapping=nc)}var JJ=Hn(KF).setParameterLength(1),ub=class extends d0{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=JJ(this.envNode)}},ZF=class extends d0{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)}},B1=class{start(e){e.lightsNode.setupLights(e,e.lightsNode.getLightNodes(e)),this.indirect(e)}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}},$M=class extends B1{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(Ci.rgb)}finish(e){let{material:t,context:n}=e,r=n.outgoingLight,s=e.context.environment;if(s)switch(t.combine){case GA:r.rgb.assign(Xn(r.rgb,r.rgb.mul(s.rgb),Jv.mul(wM)));break;case a3:r.rgb.assign(Xn(r.rgb,s.rgb,Jv.mul(wM)));break;case l3:r.rgb.addAssign(s.rgb.mul(Jv.mul(wM)));break;default:je("BasicLightingModel: Unsupported .combine value:",t.combine);break}}},h2e=new Yr,QF=class extends mr{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(h2e),this.setValues(e)}setupNormal(){return Km(D1)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new ub(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new ZF(FU)),t}setupOutgoingLight(){return Ci.rgb}setupLightingModel(){return new $M}},U1=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))}),Vm=Ae(i=>i.diffuseColor.mul(1/Math.PI)),f2e=()=>se(.25),d2e=Ae(({dotNH:i})=>LM.mul(se(.5)).add(1).mul(se(1/Math.PI)).mul(i.pow(LM))),p2e=Ae(({lightDirection:i})=>{let e=i.add(qi).normalize(),t=ai.dot(e).clamp(),n=qi.dot(e).clamp(),r=U1({f0:h0,f90:1,dotVH:n}),s=f2e(),o=d2e({dotNH:t});return r.mul(s).mul(o)}),YM=class extends $M{constructor(e=!0){super(),this.specular=e}direct({lightDirection:e,lightColor:t,reflectedLight:n}){let s=ai.dot(e).clamp().mul(t);n.directDiffuse.addAssign(s.mul(Vm({diffuseColor:Ci.rgb}))),this.specular===!0&&n.directSpecular.addAssign(s.mul(p2e({lightDirection:e})).mul(Jv))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(Vm({diffuseColor:Ci}))),r.indirectDiffuse.mulAssign(t)}},A2e=new xa,JF=class extends mr{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(A2e),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new ub(t):null}setupLightingModel(){return new YM(!1)}},m2e=new FA,eO=class extends mr{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(m2e),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new ub(t):null}setupLightingModel(){return new YM}setupVariants(){let e=(this.shininessNode?se(this.shininessNode):cJ).max(1e-4);LM.assign(e);let t=this.specularNode||hJ;h0.assign(t)}},eee=Ae(i=>{if(i.geometry.hasAttribute("normal")===!1)return se(0);let e=D1.dFdx().abs().max(D1.dFdy().abs());return e.x.max(e.y).max(e.z)}),HU=Ae(i=>{let{roughness:e}=i,t=eee(),n=e.max(.0525);return n=n.add(t),n=n.min(1),n}),tee=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 Ol(.5,r.add(s).max(XC))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),g2e=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 Ol(.5,l.add(c).max(XC))}).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"}]}),nee=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"}]}),_2e=se(1/Math.PI),x2e=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 _2e.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"}]}),WU=Ae(({lightDirection:i,f0:e,f90:t,roughness:n,f:r,normalView:s=ai,USE_IRIDESCENCE:o,USE_ANISOTROPY:a})=>{let l=n.pow2(),c=i.add(qi).normalize(),u=s.dot(i).clamp(),f=s.dot(qi).clamp(),p=s.dot(c).clamp(),x=qi.dot(c).clamp(),v=U1({f0:e,f90:t,dotVH:x}),w,S;if(N1(o)&&(v=HC.mix(v,r)),N1(a)){let T=Zv.dot(i),P=Zv.dot(qi),R=Zv.dot(c),C=Im.dot(i),L=Im.dot(qi),D=Im.dot(c);w=g2e({alphaT:NM,alphaB:l,dotTV:P,dotBV:L,dotTL:T,dotBL:C,dotNV:f,dotNL:u}),S=x2e({alphaT:NM,alphaB:l,dotNH:p,dotTH:R,dotBH:D})}else w=tee({alpha:l,dotNL:u,dotNV:f}),S=nee({alpha:l,dotNH:p});return v.mul(w).mul(S)}),y2e=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]),yh=null,hb=Ae(({roughness:i,dotNV:e})=>{yh===null&&(yh=new RA(y2e,16,16,Rs,Fi),yh.name="DFG_LUT",yh.minFilter=bi,yh.magFilter=bi,yh.wrapS=Vo,yh.wrapT=Vo,yh.generateMipmaps=!1,yh.needsUpdate=!0);let t=ft(i,e);return li(yh,t).rg}),v2e=Ae(({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o})=>{let a=WU({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o}),l=ai.dot(i).clamp(),c=ai.dot(qi).clamp(),u=hb({roughness:n,dotNV:c}),f=hb({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(XC)),C=S.mul(T),L=R.mul(C);return a.add(L)}),iee=Ae(i=>{let{dotNV:e,specularColor:t,specularF90:n,roughness:r}=i,s=hb({dotNV:e,roughness:r});return t.mul(s.x).add(n.mul(s.y))}),tO=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"}]}),b2e=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"}]}),w2e=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"}]}),S2e=Ae(({lightDirection:i})=>{let e=i.add(qi).normalize(),t=ai.dot(i).clamp(),n=ai.dot(qi).clamp(),r=ai.dot(e).clamp(),s=b2e({roughness:t0,dotNH:r}),o=w2e({dotNV:n,dotNL:t});return Il.mul(s).mul(o)}),HY=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"}]}),T2e=Ae(({f:i})=>{let e=i.length();return Er(e.mul(e).add(i.z).div(e.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),WE=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,Er(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"}]}),_8=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(so(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(WE({v1:w,v2:S})),R.addAssign(WE({v1:S,v2:T})),R.addAssign(WE({v1:T,v2:P})),R.addAssign(WE({v1:P,v2:w})),f.assign(pe(T2e({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 oR=1/6,ree=i=>bn(oR,bn(i,bn(i,i.negate().add(3)).sub(3)).add(1)),nO=i=>bn(oR,bn(i,bn(i,bn(3,i).sub(6))).add(4)),see=i=>bn(oR,bn(i,bn(i,bn(-3,i).add(3)).add(3)).add(1)),iO=i=>bn(oR,pc(i,3)),WY=i=>ree(i).add(nO(i)),jY=i=>see(i).add(iO(i)),XY=i=>ps(-1,nO(i).div(ree(i).add(nO(i)))),$Y=i=>ps(1,iO(i).div(see(i).add(iO(i)))),YY=(i,e,t)=>{let n=i.uvNode,r=bn(n,e.zw).add(.5),s=Rh(r),o=au(r),a=WY(o.x),l=jY(o.x),c=XY(o.x),u=$Y(o.x),f=XY(o.y),p=$Y(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=WY(o.y).mul(ps(a.mul(i.sample(x).level(t)),l.mul(i.sample(v).level(t)))),P=jY(o.y).mul(ps(a.mul(i.sample(w).level(t)),l.mul(i.sample(S).level(t))));return T.add(P)},jU=Ae(([i,e])=>{let t=ft(i.size(fe(e))),n=ft(i.size(fe(e.add(1)))),r=Ol(1,t),s=Ol(1,n),o=YY(i,Lt(r,t),Rh(e)),a=YY(i,Lt(s,n),YC(e));return au(e).mix(o,a)}),E2e=Ae(([i,e])=>{let t=e.mul(xU(i));return jU(i,t)}),KY=Ae(([i,e,t,n,r])=>{let s=pe(lU(e.negate(),ta(i),Ol(1,n))),o=pe(Ph(r[0].xyz),Ph(r[1].xyz),Ph(r[2].xyz));return ta(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"}]}),M2e=Ae(([i,e])=>i.mul(lu(e.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),C2e=kU(),R2e=jJ(),ZY=Ae(([i,e,t],{material:n})=>{let s=(n.side===hi?C2e:R2e).sample(i),o=Ch(Gm.x).mul(M2e(e,t));return jU(s,o)}),QY=Ae(([i,e,t])=>(Wt(t.notEqual(0),()=>{let n=$C(e).negate().div(t);return Y7(n.negate().mul(i))}),pe(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),P2e=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));Ri({start:0,end:3},({i:F})=>{let N=D.element(F),B=KY(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=ZY(H,t,N);w.element(F).assign(K.element(F)),w.a.addAssign(K.a),S.element(F).assign(n.element(F).mul(QY(Ph(B),p,x).element(F)))}),w.a.divAssign(3)}else{let L=KY(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=ZY(N,t,u),S=n.mul(QY(Ph(L),p,x))}let T=S.rgb.mul(w.rgb),P=i.dot(e).clamp(),R=pe(iee({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())}),I2e=so(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),N2e=i=>{let e=i.sqrt();return pe(1).add(e).div(pe(1).sub(e))},JY=(i,e)=>i.sub(e).div(i.add(e)).pow2(),L2e=(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),I2e.mul(a)},eK=Ae(({outsideIOR:i,eta2:e,cosTheta1:t,thinFilmThickness:n,baseF0:r})=>{let s=Xn(i,e,Bl(0,.03,n)),a=i.div(s).pow2().mul(t.pow2().oneMinus()).oneMinus();Wt(a.lessThan(0),()=>pe(1));let l=a.sqrt(),c=JY(s,i),u=U1({f0:c,f90:1,dotVH:t}),f=u.oneMinus(),p=s.lessThan(i).select(Math.PI,0),x=se(Math.PI).sub(p),v=N2e(r.clamp(0,.9999)),w=JY(v,s.toVec3()),S=U1({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 Ri({start:1,end:2,condition:"<=",name:"m"},({m:z})=>{B.mulAssign(L);let V=L2e(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"}]}),Iv=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()}),Nv=pe(.04),jE=se(1),KM=class extends B1{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=ai.dot(qi).clamp(),n=eK({outsideIOR:se(1),eta2:PM,cosTheta1:t,thinFilmThickness:IM,baseF0:h0}),r=eK({outsideIOR:se(1),eta2:PM,cosTheta1:t,thinFilmThickness:IM,baseF0:Ci.rgb});this.iridescenceFresnel=Xn(n,r,ed),this.iridescenceF0Dielectric=tO({f:n,f90:1,dotVH:t}),this.iridescenceF0Metallic=tO({f:r,f90:1,dotVH:t}),this.iridescenceF0=Xn(this.iridescenceF0Dielectric,this.iridescenceF0Metallic,ed)}if(this.transmission===!0){let t=Ih,n=FQ.sub(Ih).normalize(),r=_0,s=e.context;s.backdrop=P2e(r,n,Eh,Sm,Em,Mm,t,Ac,g0,Pa,Qv,H7,j7,W7,this.dispersion?X7:null),s.backdropAlpha=DM,Ci.a.mulAssign(Xn(1,s.backdrop.a,DM))}super.start(e)}computeMultiscattering(e,t,n,r,s=null){let o=ai.dot(qi).clamp(),a=hb({roughness:Eh,dotNV:o}),l=s?HC.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=ai.dot(e).clamp().mul(t).toVar();if(this.sheen===!0){this.sheenSpecularDirect.addAssign(s.mul(S2e({lightDirection:e})));let o=Iv({normal:ai,viewDir:qi,roughness:t0}),a=Iv({normal:ai,viewDir:e,roughness:t0}),l=Il.r.max(Il.g).max(Il.b).mul(o.max(a)).oneMinus();s.mulAssign(l)}if(this.clearcoat===!0){let a=r0.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(a.mul(WU({lightDirection:e,f0:Nv,f90:jE,roughness:E1,normalView:r0})))}n.directDiffuse.addAssign(s.mul(Vm({diffuseColor:Sm}))),n.directSpecular.addAssign(s.mul(v2e({lightDirection:e,f0:Em,f90:1,roughness:Eh,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=ai,x=qi,v=is.toVar(),w=HY({N:p,V:x,roughness:Eh}),S=o.sample(w).toVar(),T=a.sample(w).toVar(),P=so(pe(S.x,0,S.y),pe(0,1,0),pe(S.z,0,S.w)).toVar(),R=Em.mul(T.x).add(Mm.sub(Em).mul(T.y)).toVar();if(s.directSpecular.addAssign(e.mul(R).mul(_8({N:p,V:x,P:v,mInv:P,p0:l,p1:c,p2:u,p3:f}))),s.directDiffuse.addAssign(e.mul(Sm).mul(_8({N:p,V:x,P:v,mInv:so(1,0,0,0,1,0,0,0,1),p0:l,p1:c,p2:u,p3:f}))),this.clearcoat===!0){let C=r0,L=HY({N:C,V:x,roughness:E1}),D=o.sample(L),F=a.sample(L),N=so(pe(D.x,0,D.y),pe(0,1,0),pe(D.z,0,D.w)),B=Nv.mul(F.x).add(jE.sub(Nv).mul(F.y));this.clearcoatSpecularDirect.addAssign(e.mul(B).mul(_8({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(Vm({diffuseColor:Sm})).toVar();if(this.sheen===!0){let s=Iv({normal:ai,viewDir:qi,roughness:t0}),o=Il.r.max(Il.g).max(Il.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(Il,Iv({normal:ai,viewDir:qi,roughness:t0}))),this.clearcoat===!0){let S=r0.dot(qi).clamp(),T=iee({dotNV:S,specularColor:Nv,specularF90:jE,roughness:E1});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,h0,this.iridescenceF0Dielectric),this.computeMultiscattering(a,l,Mm,Ci.rgb,this.iridescenceF0Metallic);let c=Xn(s,a,ed),u=Xn(o,l,ed),f=s.add(o),p=Sm.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=Iv({normal:ai,viewDir:qi,roughness:t0}),T=Il.r.max(Il.g).max(Il.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=ai.dot(qi).clamp().add(t),o=Eh.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=r0.dot(qi).clamp(),r=U1({dotVH:n,f0:Nv,f90:jE}),s=t.mul(RM.mul(r).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(RM));t.assign(s)}if(this.sheen===!0){let n=t.add(this.sheenSpecularDirect,this.sheenSpecularIndirect.mul(1/Math.PI));t.assign(n)}}},tK=se(1),rO=se(-2),XE=se(.8),x8=se(-1),$E=se(.4),y8=se(2),YE=se(.305),v8=se(3),nK=se(.21),D2e=se(4),iK=se(4),F2e=se(16),O2e=Ae(([i])=>{let e=pe(er(i)).toVar(),t=se(-1).toVar();return Wt(e.x.greaterThan(e.z),()=>{Wt(e.x.greaterThan(e.y),()=>{t.assign(ea(i.x.greaterThan(0),0,3))}).Else(()=>{t.assign(ea(i.y.greaterThan(0),1,4))})}).Else(()=>{Wt(e.z.greaterThan(e.y),()=>{t.assign(ea(i.z.greaterThan(0),2,5))}).Else(()=>{t.assign(ea(i.y.greaterThan(0),1,4))})}),t}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),B2e=Ae(([i,e])=>{let t=ft().toVar();return Wt(e.equal(0),()=>{t.assign(ft(i.z,i.y).div(er(i.x)))}).ElseIf(e.equal(1),()=>{t.assign(ft(i.x.negate(),i.z.negate()).div(er(i.y)))}).ElseIf(e.equal(2),()=>{t.assign(ft(i.x.negate(),i.y).div(er(i.z)))}).ElseIf(e.equal(3),()=>{t.assign(ft(i.z.negate(),i.y).div(er(i.x)))}).ElseIf(e.equal(4),()=>{t.assign(ft(i.x.negate(),i.z).div(er(i.y)))}).Else(()=>{t.assign(ft(i.x,i.y).div(er(i.z)))}),bn(.5,t.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),U2e=Ae(([i])=>{let e=se(0).toVar();return Wt(i.greaterThanEqual(XE),()=>{e.assign(tK.sub(i).mul(x8.sub(rO)).div(tK.sub(XE)).add(rO))}).ElseIf(i.greaterThanEqual($E),()=>{e.assign(XE.sub(i).mul(y8.sub(x8)).div(XE.sub($E)).add(x8))}).ElseIf(i.greaterThanEqual(YE),()=>{e.assign($E.sub(i).mul(v8.sub(y8)).div($E.sub(YE)).add(y8))}).ElseIf(i.greaterThanEqual(nK),()=>{e.assign(YE.sub(i).mul(D2e.sub(v8)).div(YE.sub(nK)).add(v8))}).Else(()=>{e.assign(se(-2).mul(Ch(bn(1.16,i))))}),e}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),oee=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"}]}),aee=Ae(([i,e,t,n,r,s])=>{let o=se(t),a=pe(e),l=lu(U2e(o),rO,s),c=au(l),u=Rh(l),f=pe(fb(i,a,u,n,r,s)).toVar();return Wt(c.notEqual(0),()=>{let p=pe(fb(i,a,u.add(1),n,r,s)).toVar();f.assign(Xn(f,p,c))}),f}),fb=Ae(([i,e,t,n,r,s])=>{let o=se(t).toVar(),a=pe(e),l=se(O2e(a)).toVar(),c=se(Er(iK.sub(o),0)).toVar();o.assign(Er(o,iK));let u=se(L1(o)).toVar(),f=ft(B2e(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,F2e))),f.y.addAssign(bn(4,L1(s).sub(u))),f.x.mulAssign(n),f.y.mulAssign(r),i.sample(f).grad(ft(),ft())}),b8=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=iu(n),c=t.mul(l).add(r.cross(t).mul(Ca(n))).add(r.mul(r.dot(t).mul(l.oneMinus())));return fb(i,c,e,s,o,a)}),lee=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(ea(e,t,nd(t,n))).toVar();Wt(p.equal(pe(0)),()=>{p.assign(pe(n.z,0,n.x.negate()))}),p.assign(ta(p));let x=pe().toVar();return x.addAssign(r.element(0).mul(b8({theta:0,axis:p,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f}))),Ri({start:fe(1),end:i},({i:v})=>{Wt(v.greaterThanEqual(s),()=>{qJ()});let w=se(o.mul(se(v))).toVar();x.addAssign(r.element(v).mul(b8({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(b8({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)}),k2e=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)}),G2e=Ae(([i,e])=>ft(se(i).div(se(e)),k2e(i))),z2e=Ae(([i,e,t])=>{let n=t.mul(t).toConst(),r=pe(1,0,0).toConst(),s=nd(e,r).toConst(),o=Ia(i.x).toConst(),a=bn(2,3.14159265359).mul(i.y).toConst(),l=o.mul(iu(a)).toConst(),c=o.mul(Ca(a)).toVar(),u=bn(.5,e.z.add(1)).toConst();c.assign(u.oneMinus().mul(Ia(l.mul(l).oneMinus())).add(u.mul(c)));let f=r.mul(l).add(s.mul(c)).add(e.mul(Ia(Er(0,l.mul(l).add(c.mul(c)).oneMinus()))));return ta(pe(n.mul(f.x),n.mul(f.y),Er(0,f.z)))}),cee=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(fb(t,l,e,s,o,a))}).Else(()=>{let f=ea(er(l.z).lessThan(.999),pe(0,0,1),pe(1,0,0)),p=ta(nd(f,l)).toVar(),x=nd(l,p).toVar();Ri({start:it(0),end:r},({i:v})=>{let w=G2e(v,r),S=z2e(w,pe(0,0,1),i),T=ta(p.mul(S.x).add(x.mul(S.y)).add(l.mul(S.z))),P=ta(T.mul(_c(l,T).mul(2)).sub(l)),R=Er(_c(l,P),0);Wt(R.greaterThan(0),()=>{let C=fb(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)}),a0=4,rK=[.125,.215,.35,.446,.526,.582],Tm=20,V2e=512,Lv=new jc(-1,1,1,-1,0,1),q2e=new Lr(90,1),sK=new Ut,w8=null,S8=0,T8=0,H2e=new ie,ZM=new WeakMap,W2e=[3,1,5,0,4,2],E8=oee(Pi(),Dl("faceIndex")).normalize(),aR=pe(E8.x,E8.y,E8.z),sO=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=H2e,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.');w8=this._renderer.getRenderTarget(),S8=this._renderer.getActiveCubeFace(),T8=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 Qn('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 Qn('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 Qn('PMREMGenerator: ".fromCubemapAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}async compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=aK(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=lK(),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===bl||e.mapping===nc?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(w8,S8,T8),e.scissorTest=!1,this._setViewport(e,0,0,e.width,e.height)}_fromTexture(e,t){this._setSizeFromTexture(e),w8=this._renderer.getRenderTarget(),S8=this._renderer.getActiveCubeFace(),T8=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 oK(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=oK(e.width,e.height);let{_lodMax:t}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=j2e(t)),this._blurMaterial=X2e(t,e.width,e.height),this._ggxMaterial=$2e(t,e.width,e.height)}}async _compileMaterial(e){let t=new Gn(new qn,e);await this._renderer.compile(t,Lv)}_sceneToCubeUV(e,t,n,r,s){let o=q2e;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(sK),c.autoClear=!1,this._backgroundBox===null&&(this._backgroundBox=new Gn(new Wc,new Yr({name:"PMREM.Background",side:hi,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(sK),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===bl||e.mapping===nc;r?this._cubemapMaterial===null&&(this._cubemapMaterial=aK(e)):this._equirectMaterial===null&&(this._equirectMaterial=lK(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,Lv)}_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=ZM.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-a0?n-v+a0: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,Lv),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,Lv)}_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=ZM.get(c),x=this._sizeLods[n]-1,v=isFinite(s)?Math.PI/(2*x):2*Math.PI/(2*Tm-1),w=s/v,S=isFinite(s)?1+Math.floor(u*w):Tm;S>Tm&&je(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${Tm}`);let T=[],P=0;for(let F=0;F<Tm;++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-a0?r-R+a0:0),D=4*(this._cubeSize-C);this._setViewport(t,L,D,3*C,2*C),l.setRenderTarget(t),l.render(f,Lv)}_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 j2e(i){let e=[],t=[],n=[],r=i,s=i-a0+1+rK.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-a0?l=rK[o-i+a0-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=W2e[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 qn;L.setAttribute("position",new Di(P,w)),L.setAttribute("uv",new Di(R,S)),L.setAttribute("faceIndex",new Di(C,T)),n.push(new Gn(L,null)),r>a0&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function oK(i,e,t){let n={magFilter:bi,minFilter:bi,generateMipmaps:!1,type:Fi,format:wr,colorSpace:Yd,depthBuffer:t},r=new da(i,e,n);return r.texture.mapping=Yu,r.texture.name="PMREM.cubeUv",r.texture.isPMREMTexture=!0,r.scissorTest=!0,r}function lR(i){let e=new mr;return e.depthTest=!1,e.depthWrite=!1,e.blending=Zr,e.name=`PMREM_${i}`,e}function X2e(i,e,t){let n=Eo(new Array(Tm).fill(0)),r=Ht(new ie(0,1,0)),s=Ht(0),o=se(Tm),a=Ht(0),l=Ht(1),c=li(),u=Ht(0),f=se(1/e),p=se(1/t),x=se(i),v={n:o,latitudinal:a,weights:n,poleAxis:r,outputDirection:aR,dTheta:s,samples:l,envMap:c,mipInt:u,CUBEUV_TEXEL_WIDTH:f,CUBEUV_TEXEL_HEIGHT:p,CUBEUV_MAX_MIP:x},w=lR("blur");return w.fragmentNode=lee({...v,latitudinal:a.equal(1)}),ZM.set(w,v),w}function $2e(i,e,t){let n=li(),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=lR("ggx");return u.fragmentNode=cee({...c,N_immutable:aR,GGX_SAMPLES:it(V2e)}),ZM.set(u,c),u}function aK(i){let e=lR("cubemap");return e.fragmentNode=Ra(i,aR),e}function lK(i){let e=lR("equirect");return e.fragmentNode=li(i,qU(aR),0),e}var cK=new WeakMap;function Y2e(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 K2e(i,e,t){let n=Z2e(e),r=n.get(i);if((r!==void 0?r.pmremVersion:-1)!==i.pmremVersion){let o=i.image;if(i.isCubeTexture)if(Q2e(o))r=t.fromCubemap(i,r);else return null;else if(J2e(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 Z2e(i){let e=cK.get(i);return e===void 0&&(e=new WeakMap,cK.set(i,e)),e}var oO=class extends Ar{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 Ms;r.isRenderTargetTexture=!0,this._texture=li(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=Y2e(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===Yu?t=r:t=K2e(r,e.renderer,this._generator),t!==null&&(this._pmrem=t,this.updateFromTexture(t)))}setup(e){this._generator===null&&(this._generator=new sO(e.renderer)),this.updateBefore(e);let t=this.uvNode;t===null&&e.context.getUV&&(t=e.context.getUV(this,e)),t=this._pmrem.isRenderTargetTexture?VM.mul(pe(t.x,t.y.negate(),t.z)):VM.mul(t);let n=this.levelNode;return n===null&&e.context.getTextureLevel&&(n=e.context.getTextureLevel(this)),aee(this._texture,t,n,this._width,this._height,this._maxMip)}dispose(){super.dispose(),this._generator!==null&&this._generator.dispose()}};function Q2e(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 J2e(i){return i==null?!1:i.height>0}var XU=Hn(oO).setParameterLength(1,3),uK=new WeakMap,aO=class extends d0{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=XU(f),p.set(f,x)),n=x}let s=t.useAnisotropy===!0||t.anisotropy>0?sJ:ai,o=n.context(hK(Eh,s)).mul(bM),a=n.context(eve(_0)).mul(Math.PI).mul(bM),l=R1(o),c=R1(a);e.context.radiance.addAssign(l),e.context.iblIrradiance.addAssign(c);let u=e.context.lightingModel.clearcoatRadiance;if(u){let f=n.context(hK(E1,r0)).mul(bM),p=R1(f);u.addAssign(p)}}_getPMREMNodeCache(e){let t=uK.get(e);return t===void 0&&(t=new WeakMap,uK.set(e,t)),t}},hK=(i,e)=>{let t=null;return{getUV:()=>(t===null&&(t=qi.negate().reflect(e),t=oU(i).mix(t,e).normalize(),t=t.transformDirection(Eb)),t),getTextureLevel:()=>i}},eve=i=>({getUV:()=>i,getTextureLevel:()=>se(1)}),tve=new E_,QM=class extends mr{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(tve),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t===null&&e.environmentNode&&(t=e.environmentNode),t?new aO(t):null}setupLightingModel(){return new KM}setupSpecular(){let e=Xn(pe(.04),Ci.rgb,ed);h0.assign(pe(.04)),Em.assign(e),Mm.assign(1)}setupVariants(){let e=this.metalnessNode?se(this.metalnessNode):pJ;ed.assign(e);let t=this.roughnessNode?se(this.roughnessNode):dJ;t=HU({roughness:t}),Eh.assign(t),this.setupSpecular(),Sm.assign(Ci.rgb.mul(e.oneMinus()))}},nve=new qy,lO=class extends QM{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(nve),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):CJ;Qv.assign(e),h0.assign(il(sU(Qv.sub(1).div(Qv.add(1))).mul(fJ),pe(1)).mul(DF)),Em.assign(Xn(h0,Ci.rgb,ed)),Mm.assign(Xn(DF,1,ed))}setupLightingModel(){return new KM(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):mJ,n=this.clearcoatRoughnessNode?se(this.clearcoatRoughnessNode):gJ;RM.assign(t),E1.assign(HU({roughness:n}))}if(this.useSheen){let t=this.sheenNode?pe(this.sheenNode):yJ,n=this.sheenRoughnessNode?se(this.sheenRoughnessNode):vJ;Il.assign(t),t0.assign(n)}if(this.useIridescence){let t=this.iridescenceNode?se(this.iridescenceNode):wJ,n=this.iridescenceIORNode?se(this.iridescenceIORNode):SJ,r=this.iridescenceThicknessNode?se(this.iridescenceThicknessNode):TJ;HC.assign(t),PM.assign(n),IM.assign(r)}if(this.useAnisotropy){let t=(this.anisotropyNode?ft(this.anisotropyNode):bJ).toVar();e0.assign(t.length()),Wt(e0.equal(0),()=>{t.assign(ft(1,0))}).Else(()=>{t.divAssign(ft(e0)),e0.assign(e0.saturate())}),NM.assign(e0.pow2().mix(Eh.pow2(),1)),Zv.assign(Cm[0].mul(t.x).add(Cm[1].mul(t.y))),Im.assign(Cm[1].mul(t.x).sub(Cm[0].mul(t.y)))}if(this.useTransmission){let t=this.transmissionNode?se(this.transmissionNode):EJ,n=this.thicknessNode?se(this.thicknessNode):MJ,r=this.attenuationDistanceNode?se(this.attenuationDistanceNode):RJ,s=this.attenuationColorNode?pe(this.attenuationColorNode):PJ;if(DM.assign(t),H7.assign(n),W7.assign(r),j7.assign(s),this.useDispersion){let o=this.dispersionNode?se(this.dispersionNode):NJ;X7.assign(o)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?pe(this.clearcoatNormalNode):_J}setup(e){e.context.setupClearcoatNormal=()=>Lm(this.setupClearcoatNormal(e),"NORMAL","vec3"),super.setup(e)}};var ive=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=Qf("gradientMap","texture").context({getUV:()=>r});return pe(s.r)}else{let s=r.fwidth().mul(.5);return Xn(pe(.7),pe(1),Bl(se(.7).sub(s.x),se(.7).add(s.x),r.x))}}),cO=class extends B1{direct({lightDirection:e,lightColor:t,reflectedLight:n},r){let s=ive({normal:eR,lightDirection:e,builder:r}).mul(t);n.directDiffuse.addAssign(s.mul(Vm({diffuseColor:Ci.rgb})))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(Vm({diffuseColor:Ci}))),r.indirectDiffuse.mulAssign(t)}},rve=new Hy,uO=class extends mr{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(rve),this.setValues(e)}setupLightingModel(){return new cO}},uee=Ae(()=>{let i=pe(qi.z,0,qi.x.negate()).normalize(),e=qi.cross(i);return ft(i.dot(ai),e.dot(ai)).mul(.495).add(.5)}).once(["NORMAL","VERTEX"])().toVar("matcapUV"),sve=new jy,hO=class extends mr{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(sve),this.setValues(e)}setupVariants(e){let t=uee,n;e.material.matcap?n=Qf("matcap","texture").context({getUV:()=>t}):n=pe(Xn(.2,.8,t.y)),Ci.rgb.mulAssign(n.rgb)}},fO=class extends Ar{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 qC(s,o,o.negate(),s).mul(n)}else{let s=t,o=l0(Lt(1,0,0,0),Lt(0,iu(s.x),Ca(s.x).negate(),0),Lt(0,Ca(s.x),iu(s.x),0),Lt(0,0,0,1)),a=l0(Lt(iu(s.y),0,Ca(s.y),0),Lt(0,1,0,0),Lt(Ca(s.y).negate(),0,iu(s.y),0),Lt(0,0,0,1)),l=l0(Lt(iu(s.z),Ca(s.z).negate(),0,0),Lt(Ca(s.z),iu(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}}},Cb=Hn(fO).setParameterLength(2),ove=new Vu,JM=class extends mr{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(ove),this.setValues(e)}setupPositionView(e){let{object:t,camera:n}=e,{positionNode:r,rotationNode:s,scaleNode:o,sizeAttenuation:a}=this,l=Dh.mul(pe(r||0)),c=ft(Ac[0].xyz.length(),Ac[1].xyz.length());o!==null&&(c=c.mul(ft(o))),n.isPerspectiveCamera&&a===!1&&(c=c.mul(l.z.negate()));let u=Qo.xy;if(t.center&&t.center.isVector2===!0){let x=$xe("center","vec2",t);u=u.sub(x.sub(.5))}u=u.mul(c);let f=se(s||xJ),p=Cb(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)}},ave=new tp,lve=new Oe,dO=class extends JM{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.sizeNode=null,this.isPointsNodeMaterial=!0,this.setDefaultValues(ave),this.setValues(e)}setupPositionView(){let{positionNode:e}=this;return Dh.mul(pe(e||dr)).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):IJ;c=c.mul(vU),n.isPerspectiveCamera&&a===!0&&(c=c.mul(cve.div(is.z.negate()))),s&&s.isNode&&(c=c.mul(ft(s)));let u=Qo.xy;if(r&&r.isNode){let f=se(r);u=Cb(u,f)}return u=u.mul(c),u=u.div(bU.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)}},cve=Ht(1).onFrameUpdate(function({renderer:i}){let e=i.getSize(lve);this.value=.5*e.y}),pO=class extends B1{constructor(){super(),this.shadowNode=se(1).toVar("shadowMask")}direct({lightNode:e}){e.shadowNode!==null&&this.shadowNode.mulAssign(e.shadowNode)}finish({context:e}){Ci.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(Ci.rgb)}},uve=new Vy,AO=class extends mr{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.transparent=!0,this.setDefaultValues(uve),this.setValues(e)}setupLightingModel(){return new pO}},Aet=rd("vec3"),met=rd("vec3"),get=rd("vec3");var mO=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()}},Oh=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])}},hve=0,fK=new WeakMap;function fve(i){let e=Object.keys(i),t=fK.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)}fK.set(i.constructor,t)}for(let n=0;n<t.length;n++)e.push(t[n]);return e}var gO=class{constructor(e,t,n,r,s,o,a,l,c,u){this.id=hve++,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 fve(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+",",V1(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=Yv(e,this.camera.cameras.length)),this.object.receiveShadow&&(e=Yv(e,1)),e=Yv(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()}},vh=[],_O=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);vh[0]=e,vh[1]=t,vh[2]=o,vh[3]=s;let u=c.get(vh);return u===void 0?(u=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,n,r,s,o,a,l),c.set(vh,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)),vh[0]=null,vh[1]=null,vh[2]=null,vh[3]=null,u}getChainMap(e="default"){return this.chainMaps[e]||(this.chainMaps[e]=new Oh)}dispose(){this.chainMaps={}}createRenderObject(e,t,n,r,s,o,a,l,c,u,f){let p=this.getChainMap(f),x=new gO(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}},Bh=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}},mc={VERTEX:1,INDEX:2,STORAGE:3,INDIRECT:4},s0=16,dve=211,pve=212,xO=class extends Bh{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===mc.VERTEX?(this.backend.createAttribute(e),this.info.createAttribute(e)):t===mc.INDEX?(this.backend.createIndexAttribute(e),this.info.createIndexAttribute(e)):t===mc.STORAGE?(this.backend.createStorageAttribute(e),this.info.createStorageAttribute(e)):t===mc.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 hee(i){return i.index!==null?i.index.version:i.attributes.position.version}function fee(i){return i.index!==null?i.index.id:i.attributes.position.id}function dK(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?MA:EA)(e,1);return r.version=hee(i),r.__id=fee(i),r}var yO=class extends Bh{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,mc.STORAGE):this.updateAttribute(s,mc.VERTEX);let n=this.getIndex(e);n!==null&&this.updateAttribute(n,mc.INDEX);let r=e.geometry.indirect;r!==null&&this.updateAttribute(r,mc.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=dK(t),s.set(t,o)):(o.version!==hee(t)||o.__id!==fee(t))&&(this.attributes.delete(o),o=dK(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()}},vO=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===Ku||e.type===Vi?t=1:e.type===Zu||e.type===Ka||e.type===Fi?t=2:(e.type===Fr||e.type===Ai||e.type===Zi)&&(t=4);let n=4;e.format===I_||e.format===Gf||e.format===Qu||e.format===Ts||e.format===eo?n=1:e.format===Rs||e.format===Ju?n=2:(e.format===kf||e.format===S2)&&(n=3);let r=t*n;e.type===zA||e.type===VA?r=2:(e.type===Ho||e.type===qA||e.type===HA)&&(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}},eC=class{constructor(e){this.cacheKey=e,this.usedTimes=0}},bO=class extends eC{constructor(e,t,n){super(e),this.vertexProgram=t,this.fragmentProgram=n}},wO=class extends eC{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}},Ave=0,tb=class{constructor(e,t,n,r=null,s=null){this.id=Ave++,this.code=e,this.stage=t,this.name=n,this.transforms=r,this.attributes=s,this.usedTimes=0}},SO=class extends Bh{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 tb(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 tb(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 tb(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 wO(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 bO(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)}},TO=class extends Bh{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?mc.INDIRECT:mc.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?mc.INDIRECT:mc.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)}},mve=Object.freeze([]);function gve(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 pK(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 AK(i){return(i.transmission>0||i.transmissionNode&&i.transmissionNode.isNode)&&i.side===sr&&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?(AK(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?(AK(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||gve),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||pK),this.transparent.length>1&&this.transparent.sort(t||pK),n&&(this.opaque.reverse(),this.transparentDoublePass.reverse(),this.transparent.reverse())}finish(){this.lightsNode.setLights(this.lighting.enabled?this.lightsArray:mve);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}},l1=[],MO=class{constructor(e){this.lighting=e,this.lists=new Oh}get(e,t){let n=this.lists;l1[0]=e,l1[1]=t;let r=n.get(l1);return r===void 0&&(r=new EO(this.lighting,e,t),n.set(l1,r)),l1[0]=null,l1[1]=null,r}dispose(){this.lists=new Oh}},_ve=0,CO=class{constructor(){this.id=_ve++,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 dee(this)}};function dee(i){let{textures:e,activeCubeFace:t,activeMipmapLevel:n}=i,r=[t,n];for(let s of e)r.push(s.id);return Tb(r)}var RO=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 CO,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={}}},xve=new ie,PO=class extends Bh{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 us,u.format=e.stencilBuffer?eo:Ts,u.type=e.stencilBuffer?Ho:Ai,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=Vi}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=xve){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)}}},db=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)}},tC=class extends ab{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 pee(i,e=null,t=null){if(e&&e.isNode){let n=e;e=()=>n}return new tC(new Map([[i,e]]),t)}Be("overrideNode",(i,e,t)=>pee(e,t,i));function Aee(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 tC(t,e)}Be("overrideNodes",(i,e)=>Aee(e,i));var nC=class extends di{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 kr),s="float"),s}getHash(){return String(this.id)}generate(){return this.name}},yve=(i,e)=>new nC(i,e),IO=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 kr),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 S1(t);return this._currentCond=ea(e,n),this.addToStack(this._currentCond)}ElseIf(e,t){let n=new S1(t),r=ea(e,n);return this._currentCond.elseNode=r,this._currentCond=r,this}Else(e){return this._currentCond.elseNode=new S1(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 kr);let n=e[e.length-1],r=new S1(n),s=t[0];for(let a=1;a<t.length;a++)s=s.or(t[a]);let o=ea(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=U7(),r=e.buildStage;sb(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 sb(n),e.removeActiveStack(this),s}},TM=Hn(IO).setParameterLength(0,1);function vve(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 NO=class extends $t{static get type(){return"StructTypeNode"}constructor(e,t=null){super("struct"),this.membersLayout=vve(e),this.name=t,this.isStructTypeNode=!0}getLength(){let e=1,t=0;for(let n of this.membersLayout){let r=n.type,s=pxe(r),o=Axe(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)}},LO=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}},bve=(i,e=null)=>{let t=new NO(i,e);return B7((...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 LO(t,s)},t)},iC=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}},wve=Hn(iC),rC=class{constructor(e=cs){this.blending=e,this.blendSrc=Xd,this.blendDst=$d,this.blendEquation=zs,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)}},Sve=new rC(Zr),Tve=new rC(s2);function mee(i,e){for(let t=0;t<i.length;t++)if(i[t].name===e)return t;return-1}var DO=class extends iC{static get type(){return"MRTNode"}constructor(e){super(),this.outputNodes=e,this.blendModes={output:Tve},this.isMRTNode=!0}setBlendMode(e,t){return this.blendModes[e]=t,this}getBlendMode(e){return this.blendModes[e]||Sve}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=gee(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=mee(s,o);if(a===-1)continue;let l=e.getOutputType(a);r[a]=t[o].convert(l)}return this.members=r,super.setup(e)}},gee=Hn(DO),qm=class extends Ar{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)} )`}},_ee=lt(qm).setParameterLength(2),Eve=i=>new qm(i,"int","float"),xee=i=>new qm(i,"uint","float"),Mve=i=>new qm(i,"float","int"),Cve=i=>new qm(i,"float","uint"),KE={},uu=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(_ee(e,"uint")):t.assign(e)}_returnDataNode(e){switch(e){case"uint":return it;case"int":return fe;case"uvec2":return k7;case"uvec3":return Xm;case"uvec4":return q7;case"ivec2":return Tr;case"ivec3":return G7;case"ivec4":return V7}}_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(eU(o))),c=xee(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=KE[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}}KE[l]=u}let f=KE[c];return f===void 0&&(f=this._createMainLayout(c,s,a,u),KE[c]=f),Ae(()=>f(n))()}};uu.COUNT_TRAILING_ZEROS="countTrailingZeros";uu.COUNT_LEADING_ZEROS="countLeadingZeros";uu.COUNT_ONE_BITS="countOneBits";var Rve=lt(uu,uu.COUNT_TRAILING_ZEROS).setParameterLength(1),Pve=lt(uu,uu.COUNT_LEADING_ZEROS).setParameterLength(1),Ive=lt(uu,uu.COUNT_ONE_BITS).setParameterLength(1),Nve=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)}),FO=(i,e)=>pc(bn(4,i.mul(ii(1,i))),e),Lve=(i,e)=>i.lessThan(.5)?FO(i.mul(2),e).div(2):ii(1,FO(bn(ii(1,i),2),e).div(2)),Dve=(i,e,t)=>pc(Ol(pc(i,e),ps(pc(i,e),pc(ii(1,i),t))),1/e),Fve=(i,e)=>Ca(BM.mul(e.mul(i).sub(1))).div(BM.mul(e.mul(i).sub(1))),pb=class extends Ar{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)})`}},Ove=lt(pb,"snorm").setParameterLength(1),Bve=lt(pb,"unorm").setParameterLength(1),Uve=lt(pb,"float16").setParameterLength(1),Ab=class extends Ar{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)})`}},kve=lt(Ab,"snorm").setParameterLength(1),Gve=lt(Ab,"unorm").setParameterLength(1),zve=lt(Ab,"float16").setParameterLength(1),Zf=Ae(([i])=>i.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),Vve=Ae(([i])=>pe(Zf(i.z.add(Zf(i.y.mul(1)))),Zf(i.z.add(Zf(i.x.mul(1)))),Zf(i.y.add(Zf(i.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),qve=Ae(([i,e,t])=>{let n=pe(i).toVar(),r=se(1.4).toVar(),s=se(0).toVar(),o=pe(n).toVar();return Ri({start:se(0),end:se(3),type:"float",condition:"<="},()=>{let a=pe(Vve(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(Zf(n.z.add(Zf(n.x.add(Zf(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"}]}),OO=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)}},Hve=Hn(OO),Ro=i=>(...e)=>Hve(i,...e),W1=Ht(0).setGroup(Kt).onRenderUpdate(i=>i.time),Wve=Ht(0).setGroup(Kt).onRenderUpdate(i=>i.deltaTime),yee=Ht(0,"uint").setGroup(Kt).onRenderUpdate(i=>i.frameId),jve=(i=W1)=>i.add(.75).mul(Math.PI*2).sin().mul(.5).add(.5),Xve=(i=W1)=>i.fract().round(),$ve=(i=W1)=>i.add(.5).fract().mul(2).sub(1).abs(),Yve=(i=W1)=>i.fract();function Kve(i,e=null){return sd(e,{getUV:typeof i=="function"?i:()=>i})}var Zve=Ae(([i,e,t=ft(.5)])=>Cb(i.sub(t),e).add(t)),Qve=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))}),Jve=Ae(({position:i=null,horizontal:e=!0,vertical:t=!1})=>{let n;i!==null?(n=Ac.toVar(),n[3][0]=i.x,n[3][1]=i.y,n[3][2]=i.z):n=Ac;let r=g0.mul(n);return N1(e)&&(r[0][0]=Ac[0].length(),r[0][1]=0,r[0][2]=0),N1(t)&&(r[1][0]=0,r[1][1]=Ac[1].length(),r[1][2]=0),r[2][0]=0,r[2][1]=0,r[2][2]=1,Pa.mul(r).mul(dr)}),ebe=Ae(([i=null])=>{let e=jM();return jM(GU(i)).sub(e).lessThan(0).select(su,i)}),tbe=Ae(([i,e=Pi(),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)}),vee=Ae(([i,e=null,t=null,n=se(1),r=dr,s=ia])=>{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=li(u,a).mul(o.x),v=li(f,l).mul(o.y),w=li(p,c).mul(o.z);return ps(x,v,w)}),nbe=(...i)=>vee(...i),c1=new ha,_m=new ie,u1=new ie,M8=new ie,Dv=new on,ZE=new ie(0,0,-1),bh=new gn,Fv=new ie,QE=new ie,Ov=new gn,JE=new Oe,sC=new da,ibe=su.flipX();sC.depthTexture=new us(1,1);var eM=!1,BO=class i extends xc{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||sC.texture,ibe),this._reflectorBaseNode=e.reflector||new UO(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:sC.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()}},UO=class extends $t{static get type(){return"ReflectorBaseNode"}constructor(e,t={}){super();let{target:n=new Ki,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&&(Qn('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(JE),e.setSize(Math.round(JE.width*n),Math.round(JE.height*n))}setup(e){return this._updateResolution(sC,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 da(0,0,{type:Fi,samples:this.samples}),this.generateMipmaps===!0&&(t.texture.minFilter=vL,t.texture.generateMipmaps=!0),this.depth===!0&&(t.depthTexture=new us),this.renderTargets.set(e,t)),t}updateBefore(e){if(this.bounces===!1&&eM)return!1;eM=!0;let{scene:t,camera:n,renderer:r,material:s}=e,{target:o}=this,a=this.getVirtualCamera(n),l=this.getRenderTarget(a);r.getDrawingBufferSize(JE),this._updateResolution(l,r),u1.setFromMatrixPosition(o.matrixWorld),M8.setFromMatrixPosition(n.matrixWorld),Dv.extractRotation(o.matrixWorld),_m.set(0,0,1),_m.applyMatrix4(Dv),Fv.subVectors(u1,M8);let c=Fv.dot(_m)>0,u=!1;if(c===!0&&this.forceUpdate===!1){if(this.hasOutput===!1){eM=!1;return}u=!0}Fv.reflect(_m).negate(),Fv.add(u1),Dv.extractRotation(n.matrixWorld),ZE.set(0,0,-1),ZE.applyMatrix4(Dv),ZE.add(M8),QE.subVectors(u1,ZE),QE.reflect(_m).negate(),QE.add(u1),a.coordinateSystem=n.coordinateSystem,a.position.copy(Fv),a.up.set(0,1,0),a.up.applyMatrix4(Dv),a.up.reflect(_m),a.lookAt(QE),a.near=n.near,a.far=n.far,a.updateMatrixWorld(),a.projectionMatrix.copy(n.projectionMatrix),c1.setFromNormalAndCoplanarPoint(_m,u1),c1.applyMatrix4(a.matrixWorldInverse),bh.set(c1.normal.x,c1.normal.y,c1.normal.z,c1.constant);let f=a.projectionMatrix;Ov.x=(Math.sign(bh.x)+f.elements[8])/f.elements[0],Ov.y=(Math.sign(bh.y)+f.elements[9])/f.elements[5],Ov.z=-1,Ov.w=(1+f.elements[10])/f.elements[14],bh.multiplyScalar(1/bh.dot(Ov));let p=0;f.elements[2]=bh.x,f.elements[6]=bh.y,f.elements[10]=r.coordinateSystem===Xa?bh.z-p:bh.z+1-p,f.elements[14]=bh.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,eM=!1,this.forceUpdate=!1}get resolution(){return Qn('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale}set resolution(e){Qn('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale=e}},rbe=i=>new BO(i),C8=new jc(-1,1,1,-1,0,1),kO=class extends qn{constructor(e=!1){super();let t=e===!1?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new Rn([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Rn(t,2))}},sbe=new kO,mb=class extends Gn{constructor(e=null){super(sbe,e),this.camera=C8,this.isQuadMesh=!0}async renderAsync(e){Qn('QuadMesh: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await e.init(),e.render(this,C8)}render(e){e.render(this,C8)}},obe=new Oe,GO=class extends xc{static get type(){return"RTTNode"}constructor(e,t=null,n=null,r={type:Fi}){let s=new da(t,n,r);super(s.texture,Pi()),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 mb(new mr),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(obe),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 xc(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}},bee=(i,...e)=>new GO(Vt(i),...e),abe=(i,...e)=>i.isSampleNode||i.isTextureNode?i:i.isPassNode?i.getTextureNode():bee(i,...e),w1=Ae(([i,e,t],n)=>{let r;n.renderer.coordinateSystem===Xa?(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)}),lbe=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())}),cbe=Ae(([i,e,t])=>{let n=km(ns(e)),r=Tr(i.mul(n)).toVar(),s=ns(e,r).toVar(),o=ns(e,r.sub(Tr(2,0))).toVar(),a=ns(e,r.sub(Tr(1,0))).toVar(),l=ns(e,r.add(Tr(1,0))).toVar(),c=ns(e,r.add(Tr(2,0))).toVar(),u=ns(e,r.add(Tr(0,2))).toVar(),f=ns(e,r.add(Tr(0,1))).toVar(),p=ns(e,r.sub(Tr(0,1))).toVar(),x=ns(e,r.sub(Tr(0,2))).toVar(),v=er(ii(se(2).mul(a).sub(o),s)).toVar(),w=er(ii(se(2).mul(l).sub(c),s)).toVar(),S=er(ii(se(2).mul(f).sub(u),s)).toVar(),T=er(ii(se(2).mul(p).sub(x),s)).toVar(),P=w1(i,s,t).toVar(),R=v.lessThan(w).select(P.sub(w1(i.sub(ft(se(1).div(n.x),0)),a,t)),P.negate().add(w1(i.add(ft(se(1).div(n.x),0)),l,t))),C=S.lessThan(T).select(P.sub(w1(i.add(ft(0,se(1).div(n.y))),f,t)),P.negate().add(w1(i.sub(ft(0,se(1).div(n.y))),p,t)));return ta(nd(R,C))}),$U=Ae(([i])=>au(se(52.9829189).mul(au(_c(i,ft(.06711056,.00583715)))))).setLayout({name:"interleavedGradientNoise",type:"float",inputs:[{name:"position",type:"vec2"}]}),ru=Ae(([i,e,t])=>{let n=se(2.399963229728653),r=Ia(se(i).add(.5).div(se(e))),s=se(i).mul(n).add(t);return ft(iu(s),Ca(s)).mul(r)}).setLayout({name:"vogelDiskSample",type:"vec2",inputs:[{name:"sampleIndex",type:"int"},{name:"samplesCount",type:"int"},{name:"phi",type:"float"}]}),zO=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(Pi())}sample(e){return this.callback(e)}},ube=(i,e=null)=>new zO(i,Vt(e)),Hm=class extends yl{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageInstancedBufferAttribute=!0}},VO=class extends Di{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageBufferAttribute=!0}},hbe=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=EM("float")):(t=ZK(e),n=EM(e));let r=new VO(i,t,n);return c0(r,e,i)},fbe=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=EM("float")):(t=ZK(e),n=EM(e));let r=new Hm(i,t,n);return c0(r,e,r.count)},qO=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 )"}},dbe=xt(qO),R8=new on,wee=Ht(0).setGroup(Kt).onRenderUpdate(({scene:i})=>i.backgroundBlurriness),HO=Ht(1).setGroup(Kt).onRenderUpdate(({scene:i})=>i.backgroundIntensity),See=Ht(new on).setGroup(Kt).onRenderUpdate(({scene:i})=>{let e=i.background;return e!==null&&e.isTexture&&e.mapping!==b2||i.backgroundNode&&i.backgroundNode.isNode?R8.makeRotationFromEuler(i.backgroundRotation).transpose():R8.identity(),R8}),oC=class extends xc{static get type(){return"StorageTextureNode"}constructor(e,t,n=null){super(e,t),this.storeNode=n,this.mipLevel=0,this.isStorageTextureNode=!0,this.access=Mo.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(Mo.READ_WRITE)}toReadOnly(){return this.setAccess(Mo.READ_ONLY)}toWriteOnly(){return this.setAccess(Mo.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}},Tee=Hn(oC).setParameterLength(1,3),pbe=(i,e,t)=>{let n;return i.isStorageTextureNode===!0?n=i.store(e,t):(n=Tee(i,e,t),t!==null&&n.toStack()),n},WO=class extends oC{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")}},Abe=Hn(WO).setParameterLength(1,3),mbe=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()}),jO=class extends xc{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 mbe({texture:this,uv:e})}},YU=Hn(jO).setParameterLength(1,3),gbe=(...i)=>YU(...i).setSampler(!1),_be=(i,e,t)=>YU(i,e).level(t),XO=class extends F1{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}},xbe=(i,e,t)=>new XO(i,e,t),mK=new WeakMap,$O=class extends Ar{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=gK(n);this.previousModelWorldMatrix.value.copy(r);let s=Eee(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}){gK(e).copy(e.matrixWorld)}setup(){let e=this.projectionMatrix===null?Pa:Ht(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),n=e.mul(Dh).mul(dr),r=this.previousProjectionMatrix.mul(t).mul(zm),s=n.xy.div(n.w),o=r.xy.div(r.w);return ii(s,o)}};function Eee(i){let e=mK.get(i);return e===void 0&&(e={},mK.set(i,e)),e}function gK(i,e=0){let t=Eee(i),n=t[e];return n===void 0&&(t[e]=n=new on,t[e].copy(i.matrixWorld)),n}var ybe=xt($O),vbe=Ae(([i,e])=>il(1,i.oneMinus().div(e)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),bbe=Ae(([i,e])=>il(i.div(e.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),wbe=Ae(([i,e])=>i.oneMinus().mul(e.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),Sbe=Ae(([i,e])=>Xn(i.mul(2).mul(e),i.oneMinus().mul(2).mul(e.oneMinus()).oneMinus(),Um(.5,i))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),Tbe=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"}]}),Ebe=Ae(([i])=>KU(i.rgb)),Mbe=Ae(([i,e=se(1)])=>e.mix(KU(i.rgb),i.rgb).max(0)),Cbe=Ae(([i,e=se(0)])=>{let t=ps(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 Xn(i.rgb,n,r).max(0)}),Rbe=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(_c(t,i.rgb).mul(n.oneMinus()))))).max(0)}),KU=(i,e=pe(sn.getLuminanceCoefficients(new ie)))=>_c(i,e),Pbe=Ae(([i,e=pe(1),t=pe(0),n=pe(1),r=se(1),s=pe(sn.getLuminanceCoefficients(new ie,Yd))])=>{let o=i.rgb.dot(pe(s)),a=Er(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)}),Ibe=Ae(([i,e])=>i.mul(e).floor().div(e)),tM=null,YO=class extends O1{static get type(){return"ViewportSharedTextureNode"}constructor(e=su,t=null){tM===null&&(tM=new PA),super(e,t,tM)}getTextureForReference(){return tM}updateReference(){return this}},Nbe=Hn(YO).setParameterLength(0,2),nM=new Oe,aC=class extends xc{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)}},lC=class extends aC{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}},Uh=class i extends Ar{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 da(this._width,this._height,{type:Fi,...r});s.texture.name="output";let o=null;(this.scope===i.DEPTH||r.depthBuffer!==!1)&&(o=new us,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 lC(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 lC(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=rR(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=Dm(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=Zi),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),nM.set(s.width,s.height)):(r=this.camera,t.getDrawingBufferSize(nM)),this.setSize(nM.width,nM.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:sd({...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()}};Uh.COLOR="color";Uh.DEPTH="depth";var Lbe=(i,e,t)=>new Uh(Uh.COLOR,i,e,t),Dbe=(i,e)=>new aC(i,e),Fbe=(i,e,t)=>new Uh(Uh.DEPTH,i,e,t),KO=class extends Uh{static get type(){return"ToonOutlinePassNode"}constructor(e,t,n,r,s){super(Uh.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 mr;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=hi;let t=ia.negate(),n=Pa.mul(Dh),r=se(1),s=n.mul(Lt(dr,1)),o=n.mul(Lt(dr.add(t),1)),a=ta(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}},Obe=(i,e,t=new Ut(0,0,0),n=.003,r=1)=>new KO(i,e,Vt(t),Vt(n),Vt(r)),Mee=Ae(([i,e])=>i.mul(e).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Cee=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"}]}),Ree=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"}]}),Bbe=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)}),Pee=Ae(([i,e])=>{let t=so(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),n=so(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return i=i.mul(e).div(.6),i=t.mul(i),i=Bbe(i),i=n.mul(i),i.clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Ube=so(pe(1.6605,-.1246,-.0182),pe(-.5876,1.1329,-.1006),pe(-.0728,-.0083,1.1187)),kbe=so(pe(.6274,.0691,.0164),pe(.3293,.9195,.088),pe(.0433,.0113,.8956)),Gbe=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))))}),Iee=Ae(([i,e])=>{let t=pe(i).toVar(),n=so(pe(.856627153315983,.137318972929847,.11189821299995),pe(.0951212405381588,.761241990602591,.0767994186031903),pe(.0482516061458583,.101439036467562,.811302368396859)),r=so(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(kbe.mul(t)),t.assign(n.mul(t)),t.assign(Er(t,1e-10)),t.assign(Ch(t)),t.assign(t.sub(s).div(o.sub(s))),t.assign(lu(t,0,1)),t.assign(Gbe(t)),t.assign(r.mul(t)),t.assign(pc(Er(pe(0),t),pe(2.2))),t.assign(Ube.mul(t)),t.assign(lu(t,0,1)),t}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Nee=Ae(([i,e])=>{let t=se(.76),n=se(.15);i=i.mul(e);let r=il(i.r,il(i.g,i.b)),s=ea(r.lessThan(.08),r.sub(bn(6.25,r.mul(r))),.04);i.subAssign(s);let o=Er(i.r,Er(i.g,i.b));Wt(o.lessThan(t),()=>i);let a=ii(1,t),l=ii(1,a.mul(a).div(o.add(a.sub(t))));i.mulAssign(l.div(o));let c=ii(1,Ol(1,n.mul(o.sub(l)).add(1)));return Xn(i,pe(l),c)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Ji=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}},cR=Hn(Ji).setParameterLength(1,3),zbe=(i,e)=>cR(i,e,"js"),Vbe=(i,e)=>cR(i,e,"wgsl"),qbe=(i,e)=>cR(i,e,"glsl"),cC=class extends Ji{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)}},Lee=(i,e=[],t="")=>{let n=new cC(i,e,t);return B7((...s)=>n.call(...s),n)},Hbe=(i,e)=>Lee(i,e,"glsl"),Wbe=(i,e)=>Lee(i,e,"wgsl");function ZU(i){let e,t=i.context.getViewZ;return t!==void 0&&(e=t(this)),(e||is.z).negate()}var Dee=Ae(([i,e],t)=>{let n=ZU(t);return Bl(i,e,n)}),Fee=Ae(([i],e)=>{let t=ZU(e);return i.mul(i,t,t).negate().exp().oneMinus()}),jbe=Ae(([i,e],t)=>{let n=ZU(t),s=e.sub(Ih.y).max(0).toConst().mul(n).toConst();return i.mul(i,s,s).negate().exp().oneMinus()}),ZO=Ae(([i,e])=>Lt(e.toFloat().mix(M1.rgb,i.toVec3()),M1.a)),xm=null,ym=null,QO=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(o0(t.value)),s=e.getTypeLength(o0(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 zM('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(o0(o)),c=e.getTypeLength(o0(a));xm=xm||new gn,ym=ym||new gn,xm.setScalar(0),ym.setScalar(0),l===1?xm.setScalar(o):o.isColor?xm.set(o.r,o.g,o.b,1):xm.set(o.x,o.y,o.z||0,o.w||0),c===1?ym.setScalar(a):a.isColor?ym.set(a.r,a.g,a.b,1):ym.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=xm.getComponent(S),P=ym.getComponent(S);p[w]=Yc.lerp(T,P,Math.random())}let x=this.getNodeType(e);if(t.count*4*4<=e.getUniformBufferLimit())n=q1(p,"vec4",t.count).element(ou).convert(x);else{let w=new yl(p,4);e.geometry.setAttribute("__range"+this.id,w),n=JC(w).convert(x)}}else n=se(0);return n}},Xbe=Hn(QO).setParameterLength(2),JO=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}},Rb=(i,e)=>new JO(i,e),$be=Rb("numWorkgroups","uvec3"),Ybe=Rb("workgroupId","uvec3"),Kbe=Rb("globalId","uvec3"),Zbe=Rb("localId","uvec3"),Qbe=Rb("subgroupSize","uint"),eB=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)}},QU=Hn(eB),Jbe=()=>QU("workgroup").toStack(),ewe=()=>QU("storage").toStack(),twe=()=>QU("texture").toStack(),tB=class extends td{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}},nB=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 kr),this.setName(e)}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return new tB(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)}},nwe=(i,e)=>new nB("Workgroup",i,e),ms=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=Ll(u,s).toConst()),t.constNode.build(e)}};ms.ATOMIC_LOAD="atomicLoad";ms.ATOMIC_STORE="atomicStore";ms.ATOMIC_ADD="atomicAdd";ms.ATOMIC_SUB="atomicSub";ms.ATOMIC_MAX="atomicMax";ms.ATOMIC_MIN="atomicMin";ms.ATOMIC_AND="atomicAnd";ms.ATOMIC_OR="atomicOr";ms.ATOMIC_XOR="atomicXor";var iwe=Hn(ms),Gh=(i,e,t)=>iwe(i,e,t).toStack(),rwe=i=>Gh(ms.ATOMIC_LOAD,i,null),swe=(i,e)=>Gh(ms.ATOMIC_STORE,i,e),owe=(i,e)=>Gh(ms.ATOMIC_ADD,i,e),awe=(i,e)=>Gh(ms.ATOMIC_SUB,i,e),lwe=(i,e)=>Gh(ms.ATOMIC_MAX,i,e),cwe=(i,e)=>Gh(ms.ATOMIC_MIN,i,e),uwe=(i,e)=>Gh(ms.ATOMIC_AND,i,e),hwe=(i,e)=>Gh(ms.ATOMIC_OR,i,e),fwe=(i,e)=>Gh(ms.ATOMIC_XOR,i,e),Ft=class i extends Ar{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 dwe=lt(Ft,Ft.SUBGROUP_ELECT).setParameterLength(0),pwe=lt(Ft,Ft.SUBGROUP_BALLOT).setParameterLength(1),Awe=lt(Ft,Ft.SUBGROUP_ADD).setParameterLength(1),mwe=lt(Ft,Ft.SUBGROUP_INCLUSIVE_ADD).setParameterLength(1),gwe=lt(Ft,Ft.SUBGROUP_EXCLUSIVE_AND).setParameterLength(1),_we=lt(Ft,Ft.SUBGROUP_MUL).setParameterLength(1),xwe=lt(Ft,Ft.SUBGROUP_INCLUSIVE_MUL).setParameterLength(1),ywe=lt(Ft,Ft.SUBGROUP_EXCLUSIVE_MUL).setParameterLength(1),vwe=lt(Ft,Ft.SUBGROUP_AND).setParameterLength(1),bwe=lt(Ft,Ft.SUBGROUP_OR).setParameterLength(1),wwe=lt(Ft,Ft.SUBGROUP_XOR).setParameterLength(1),Swe=lt(Ft,Ft.SUBGROUP_MIN).setParameterLength(1),Twe=lt(Ft,Ft.SUBGROUP_MAX).setParameterLength(1),Ewe=lt(Ft,Ft.SUBGROUP_ALL).setParameterLength(0),Mwe=lt(Ft,Ft.SUBGROUP_ANY).setParameterLength(0),Cwe=lt(Ft,Ft.SUBGROUP_BROADCAST_FIRST).setParameterLength(2),Rwe=lt(Ft,Ft.QUAD_SWAP_X).setParameterLength(1),Pwe=lt(Ft,Ft.QUAD_SWAP_Y).setParameterLength(1),Iwe=lt(Ft,Ft.QUAD_SWAP_DIAGONAL).setParameterLength(1),Nwe=lt(Ft,Ft.SUBGROUP_BROADCAST).setParameterLength(2),Lwe=lt(Ft,Ft.SUBGROUP_SHUFFLE).setParameterLength(2),Dwe=lt(Ft,Ft.SUBGROUP_SHUFFLE_XOR).setParameterLength(2),Fwe=lt(Ft,Ft.SUBGROUP_SHUFFLE_UP).setParameterLength(2),Owe=lt(Ft,Ft.SUBGROUP_SHUFFLE_DOWN).setParameterLength(2),Bwe=lt(Ft,Ft.QUAD_BROADCAST).setParameterLength(1),iM;function uR(i){iM=iM||new WeakMap;let e=iM.get(i);return e===void 0&&iM.set(i,e={}),e}function hR(i){let e=uR(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 Oee(i,e=Ih){let t=hR(i).mul(e);return t.xyz.div(t.w)}function JU(i){let e=uR(i);return e.position||(e.position=Ht(new ie).setGroup(Kt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.matrixWorld)))}function Bee(i){let e=uR(i);return e.targetPosition||(e.targetPosition=Ht(new ie).setGroup(Kt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.target.matrixWorld)))}function ek(i){let e=uR(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 tk=i=>g0.transformDirection(JU(i).sub(Bee(i))),Uwe=rd("vec3","totalDiffuse"),kwe=rd("vec3","totalSpecular"),Gwe=rd("vec3","outgoingLight"),zwe=i=>i.sort((e,t)=>e.id-t.id),Vwe=(i,e)=>{for(let t of e)if(t.isAnalyticLightNode&&t.light.id===i)return t;return null},P8=new WeakMap,Bv=[],gb=class extends $t{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=Uwe,this.totalSpecularNode=kwe,this.outgoingLightNode=Gwe,this._lights=[],this.global=!0}customCacheKey(){let e=this._lights;for(let n=0;n<e.length;n++){let r=e[n];if(Bv.push(r.id),Bv.push(r.castShadow?1:0),r.isSpotLight===!0){let s=r.map!==null?r.map.id:-1,o=r.colorNode?r.colorNode.getCacheKey():-1;Bv.push(s,o)}}let t=Tb(Bv);return Bv.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=zwe([...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=Vwe(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}P8.has(l)===!1&&P8.set(l,new u(l)),c=P8.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}},qwe=(i=[])=>new gb().setLights(i),iB=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}){nk.assign(t.receivedShadowPositionNode||e.shadowPositionWorld||Ih)}},nk=rd("vec3","shadowPositionWorld");function Hwe(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 Wwe(i,e){return e=Hwe(i,e),i.setMRT(null),i.setRenderObjectFunction(null),i.setClearColor(0,1),i.autoClear=!0,e}function jwe(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 Xwe(i,e={}){return e.background=i.background,e.backgroundNode=i.backgroundNode,e.overrideMaterial=i.overrideMaterial,e}function $we(i,e){return e=Xwe(i,e),i.background=null,i.backgroundNode=null,i.overrideMaterial=null,e}function Ywe(i,e){i.background=e.background,i.backgroundNode=e.backgroundNode,i.overrideMaterial=e.overrideMaterial}function Kwe(i,e,t){return t=Wwe(i,t),t=$we(e,t),t}function Zwe(i,e,t){jwe(i,t),Ywe(e,t)}var uC=new WeakMap,Uee=Ae(({depthTexture:i,shadowCoord:e,depthLayer:t})=>{let n=li(i,e.xy).setName("t_basic");return i.isArrayTexture&&(n=n.depth(t)),n.compare(e.z)}),kee=Ae(({depthTexture:i,shadowCoord:e,shadow:t,depthLayer:n})=>{let r=(u,f)=>{let p=li(i,u);return i.isArrayTexture&&(p=p.depth(n)),p.compare(f)},s=ir("mapSize","vec2",t).setGroup(Kt),o=ir("radius","float",t).setGroup(Kt),a=ft(1).div(s),l=o.mul(a.x),c=$U(Ym.xy).mul(6.28318530718);return ps(r(e.xy.add(ru(0,5,c).mul(l)),e.z),r(e.xy.add(ru(1,5,c).mul(l)),e.z),r(e.xy.add(ru(2,5,c).mul(l)),e.z),r(e.xy.add(ru(3,5,c).mul(l)),e.z),r(e.xy.add(ru(4,5,c).mul(l)),e.z)).mul(1/5)}),Gee=Ae(({depthTexture:i,shadowCoord:e,shadow:t,depthLayer:n})=>{let r=ir("mapSize","vec2",t).setGroup(Kt),s=ft(1).div(r),o=e.xy,a=au(o.mul(r).add(.5)).toConst();o.subAssign(a.sub(.5).mul(s));let l=x=>{let v=li(i,o).offset(x).gather();return i.isArrayTexture&&(v=v.depth(n)),v.compare(e.z)},c=l(Tr(-1,1)).toConst(),u=l(Tr(1,1)).toConst(),f=l(Tr(-1,-1)).toConst(),p=l(Tr(1,-1)).toConst();return ps(Xn(c.x,u.y,a.x).add(c.y).add(u.x).mul(a.y),Xn(c.w,u.z,a.x).add(c.z).add(u.w),Xn(f.x,p.y,a.x).add(f.y).add(p.x),Xn(f.w,p.z,a.x).add(f.z).add(p.w).mul(a.y.oneMinus())).mul(1/9)}),zee=Ae(({depthTexture:i,shadowCoord:e,depthLayer:t},n)=>{let r=li(i).sample(e.xy);i.isArrayTexture&&(r=r.depth(t)),r=r.rg;let s=r.x,o=Er(1e-7,r.y.mul(r.y)),a=n.renderer.reversedDepthBuffer?Um(s,e.z):Um(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=lu(ii(u,.3).div(.65)),l.assign(Er(a,u))}),l}),Vee=i=>{let e=uC.get(i);return e===void 0&&(e=new mr,e.colorNode=Lt(0,0,0,1),e.isShadowPassMaterial=!0,e.name="ShadowMaterial",e.blending=Zr,e.fog=!1,uC.set(i,e)),e},qee=i=>{let e=uC.get(i);e!==void 0&&(e.dispose(),uC.delete(i))},_K=new Oh,h1=[],Hee=(i,e,t,n)=>{h1[0]=i,h1[1]=e;let r=_K.get(h1);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===tc)&&(n&&(QK(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,_K.set(h1,r)),h1[0]=null,h1[1]=null,r},Qwe=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));Ri({start:fe(0),end:fe(i),type:"int",condition:"<"},({i:u})=>{let f=l.add(se(u).mul(a)),p=n.sample(ps(Ym.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=Ia(o.sub(s.mul(s)).max(0));return ft(s,c)}),Jwe=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));Ri({start:fe(0),end:fe(i),type:"int",condition:"<"},({i:u})=>{let f=l.add(se(u).mul(a)),p=n.sample(ps(Ym.xy,ft(f,0).mul(e)).div(t));n.value.isArrayTexture&&(p=p.depth(r)),s.addAssign(p.x),o.addAssign(ps(p.y.mul(p.y),p.x.mul(p.x)))}),s.divAssign(i),o.divAssign(i);let c=Ia(o.sub(s.mul(s)).max(0));return ft(s,c)}),eSe=[Uee,kee,Gee,zee],I8,rM=new mb,hC=class extends iB{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||ir("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=ir("near","float",n.camera).setGroup(Kt),u=ir("far","float",n.camera).setGroup(Kt);a=sR(l.negate(),c,u)}return o=pe(o.x,o.y.oneMinus(),r.reversedDepthBuffer?a.sub(s):a.add(s)),o}getShadowFilterFn(e){return eSe[e]}setupRenderTarget(e,t){let n=new us(e.mapSize.width,e.mapSize.height);n.name="ShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?$c:oh;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(zf.TEXTURE_COMPARE);if((l===ap||l===r3)&&c?(o.minFilter=bi,o.magFilter=bi):(o.minFilter=yi,o.magFilter=yi),s.camera.coordinateSystem=n.coordinateSystem,s.camera.updateProjectionMatrix(),l===tc&&s.isPointLightShadow!==!0){o.compareFunction=null,a.depth>1?(a._vsmShadowMapVertical||(a._vsmShadowMapVertical=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:Rs,type:Fi,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:Rs,type:Fi,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:Rs,type:Fi,depthBuffer:!1}),this.vsmShadowMapHorizontal=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:Rs,type:Fi,depthBuffer:!1}));let D=li(o);o.isArrayTexture&&(D=D.depth(this.depthLayer));let F=li(this.vsmShadowMapVertical.texture);o.isArrayTexture&&(F=F.depth(this.depthLayer));let N=ir("blurSamples","float",s).setGroup(Kt),B=ir("radius","float",s).setGroup(Kt),z=ir("mapSize","vec2",s).setGroup(Kt),V=this.vsmMaterialVertical||(this.vsmMaterialVertical=new mr);V.fragmentNode=Qwe({samples:N,radius:B,size:z,shadowPass:D,depthLayer:this.depthLayer}).context(e.getSharedContext()),V.name="VSMVertical",V=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new mr),V.fragmentNode=Jwe({samples:N,radius:B,size:z,shadowPass:F,depthLayer:this.depthLayer}).context(e.getSharedContext()),V.name="VSMHorizontal"}let u=ir("intensity","float",s).setGroup(Kt),f=ir("normalBias","float",s).setGroup(Kt),p=hR(r),x=_0.mul(f),v;!t.highPrecision||e.material.receivedShadowPositionNode||e.context.shadowPositionWorld?v=p.mul(nk.add(x)):v=Ht("mat4").onObjectUpdate(({object:F},N)=>N.value.multiplyMatrices(p.value,F.matrixWorld)).mul(dr).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===tc&&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=Ra(a.texture,w.xyz):(R=li(a.texture,w),o.isArrayTexture&&(R=R.depth(this.depthLayer))));let C;R?C=Xn(1,P.rgb.mix(R,1),u.mul(R.a)).toVar():C=Xn(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?Ra(this.shadowMap.texture,YF()):li(this.shadowMap.texture)),C.toInspector(`${L} / Depth`,()=>{let D=ir("near","float",this.shadow.camera),F=ir("far","float",this.shadow.camera),N;this.shadowMap.texture.isCubeTexture?N=Ra(this.shadowMap.depthTexture,YF()).r:N=li(this.shadowMap.depthTexture).r;let B;return this.shadow.camera.isPerspectiveCamera?B=rR(N,D,F):B=XJ(N,D,F),B=Dm(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;I8=Kwe(s,o,I8),o.overrideMaterial=Vee(n),s.setRenderObjectFunction(Hee(s,r,l,x)),s.setClearColor(0,0),s.setRenderTarget(t),this.renderShadow(e),s.setRenderObjectFunction(f),l===tc&&r.isPointLightShadow!==!0&&this.vsmPass(s),r.camera.layers.mask=u,Zwe(s,o,I8)}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),rM.material=this.vsmMaterialVertical,rM.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),rM.material=this.vsmMaterialHorizontal,rM.render(e)}dispose(){this._reset(),super.dispose()}_reset(){this._currentShadowType=null,qee(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))}},Wee=(i,e)=>new hC(i,e),tSe=new Ut,xK=new on,Uv=new ie,N8=new ie,nSe=[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)],iSe=[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)],rSe=[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)],sSe=[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)],jee=Ae(({depthTexture:i,bd3D:e,dp:t})=>Ra(i,e).compare(t)),Xee=Ae(({depthTexture:i,bd3D:e,dp:t,shadow:n})=>{let r=ir("radius","float",n).setGroup(Kt),s=ir("mapSize","vec2",n).setGroup(Kt),o=r.div(s.x),a=er(e),l=ta(nd(e,a.x.greaterThan(a.z).select(pe(0,1,0),pe(1,0,0)))),c=nd(e,l),u=$U(Ym.xy).mul(6.28318530718),f=ru(0,5,u),p=ru(1,5,u),x=ru(2,5,u),v=ru(3,5,u),w=ru(4,5,u);return Ra(i,e.add(l.mul(f.x).add(c.mul(f.y)).mul(o))).compare(t).add(Ra(i,e.add(l.mul(p.x).add(c.mul(p.y)).mul(o))).compare(t)).add(Ra(i,e.add(l.mul(x.x).add(c.mul(x.y)).mul(o))).compare(t)).add(Ra(i,e.add(l.mul(v.x).add(c.mul(v.y)).mul(o))).compare(t)).add(Ra(i,e.add(l.mul(w.x).add(c.mul(w.y)).mul(o))).compare(t)).mul(1/5)}),oSe=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=ir("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=$J(a.negate(),l,c),p.subAssign(u)):r.renderer.logarithmicDepthBuffer?(p=sR(a.negate(),l,c),p.addAssign(u)):(p=zU(a.negate(),l,c),p.addAssign(u));let x=s.normalize();f.assign(i({depthTexture:e,bd3D:x,dp:p,shadow:n}))}),f}),rB=class extends hC{static get type(){return"PointShadowNode"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return e===xL?jee:Xee}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:s}){return oSe({filterFn:t,depthTexture:n,shadowCoord:r,shadow:s})}setupRenderTarget(e,t){let n=new v_(e.mapSize.width);n.name="PointShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?$c:oh;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===Xa,u=c?nSe:rSe,f=c?iSe:sSe;n.setSize(t.mapSize.width,t.mapSize.width);let p=s.autoClear,x=s.getClearColor(tSe),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()),Uv.setFromMatrixPosition(r.matrixWorld),a.position.copy(Uv),N8.copy(a.position),N8.add(u[w]),a.up.copy(f[w]),a.lookAt(N8),a.updateMatrixWorld(),l.makeTranslation(-Uv.x,-Uv.y,-Uv.z),xK.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),t._frustum.setFromProjectionMatrix(xK,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)}},$ee=(i,e)=>new rB(i,e),id=class extends d0{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 ek(this.light).sub(e.context.positionView||is)}setupDirect(){}setupDirectRectArea(){}setupShadowNode(){return Wee(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)}},ik=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=ik({lightDistance:s,cutoffDistance:t,decayExponent:n}),a=i.mul(o);return{lightDirection:r,lightColor:a}},sB=class extends id{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 $ee(this.light)}setupDirect(e){return Yee({color:this.colorNode,lightVector:this.getLightVector(e),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode})}},aSe=Ae(([i=Pi()])=>{let e=i.mul(2),t=e.x.floor(),n=e.y.floor();return t.add(n).mod(2).sign()}),lSe=Ae(([i=Pi()],{renderer:e,material:t})=>{let n=aU(i.mul(2).sub(1)),r;if(t.alphaToCoverage&&e.currentSamples>0){let s=se(n.fwidth()).toVar();r=Bl(s.oneMinus(),s.add(1),n).oneMinus()}else r=ea(n.greaterThan(1),0,1);return r}),nb=Ae(([i,e,t])=>{let n=se(t).toVar(),r=se(e).toVar(),s=Fl(i).toVar();return ea(s,r,n).uniformFlow()}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),fC=Ae(([i,e])=>{let t=Fl(e).toVar(),n=se(i).toVar();return ea(t,n.negate(),n).uniformFlow()}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),ds=Ae(([i])=>{let e=se(i).toVar();return fe(Rh(e))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),pr=Ae(([i,e])=>{let t=se(i).toVar();return e.assign(ds(t)),t.sub(se(e))}),cSe=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(ii(1,a)).toVar();return ii(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"}]}),uSe=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(ii(1,a)).toVar();return ii(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"}]}),Kee=Ro([cSe,uSe]),hSe=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(ii(1,x)).toVar(),F=se(ii(1,p)).toVar();return se(ii(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"}]}),fSe=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(ii(1,x)).toVar(),F=se(ii(1,p)).toVar();return se(ii(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"}]}),Zee=Ro([hSe,fSe]),dSe=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(nb(o.lessThan(it(4)),r,n)).toVar(),l=se(bn(2,nb(o.lessThan(it(4)),n,r))).toVar();return fC(a,Fl(o.bitAnd(it(1)))).add(fC(l,Fl(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"}]}),pSe=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(nb(l.lessThan(it(8)),o,s)).toVar(),u=se(nb(l.lessThan(it(4)),s,nb(l.equal(it(12)).or(l.equal(it(14))),o,r))).toVar();return fC(c,Fl(l.bitAnd(it(1)))).add(fC(u,Fl(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"}]}),ro=Ro([dSe,pSe]),ASe=Ae(([i,e,t])=>{let n=se(t).toVar(),r=se(e).toVar(),s=Xm(i).toVar();return pe(ro(s.x,r,n),ro(s.y,r,n),ro(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"}]}),mSe=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=se(e).toVar(),a=Xm(i).toVar();return pe(ro(a.x,o,s,r),ro(a.y,o,s,r),ro(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"}]}),fc=Ro([ASe,mSe]),gSe=Ae(([i])=>{let e=se(i).toVar();return bn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),_Se=Ae(([i])=>{let e=se(i).toVar();return bn(.982,e)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),xSe=Ae(([i])=>{let e=pe(i).toVar();return bn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),Qee=Ro([gSe,xSe]),ySe=Ae(([i])=>{let e=pe(i).toVar();return bn(.982,e)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),Jee=Ro([_Se,ySe]),Nl=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"}]}),ete=Ae(([i,e,t])=>{i.subAssign(t),i.bitXorAssign(Nl(t,fe(4))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(Nl(i,fe(6))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(Nl(e,fe(8))),e.addAssign(i),i.subAssign(t),i.bitXorAssign(Nl(t,fe(16))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(Nl(i,fe(19))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(Nl(e,fe(4))),e.addAssign(i)}),Pb=Ae(([i,e,t])=>{let n=it(t).toVar(),r=it(e).toVar(),s=it(i).toVar();return n.bitXorAssign(r),n.subAssign(Nl(r,fe(14))),s.bitXorAssign(n),s.subAssign(Nl(n,fe(11))),r.bitXorAssign(s),r.subAssign(Nl(s,fe(25))),n.bitXorAssign(r),n.subAssign(Nl(r,fe(16))),s.bitXorAssign(n),s.subAssign(Nl(n,fe(4))),r.bitXorAssign(s),r.subAssign(Nl(s,fe(14))),n.bitXorAssign(r),n.subAssign(Nl(r,fe(24))),n}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),na=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"}]}),Nh=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"}]}),vSe=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 Pb(n.add(it(e)),n,n)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),bSe=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)),Pb(s,o,a)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),wSe=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)),Pb(a,l,c)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),SSe=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)),ete(c,u,f),c.addAssign(it(r)),Pb(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"}]}),TSe=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)),ete(f,p,x),f.addAssign(it(o)),p.addAssign(it(s)),Pb(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"}]}),Bi=Ro([vSe,bSe,wSe,SSe,TSe]),ESe=Ae(([i,e])=>{let t=fe(e).toVar(),n=fe(i).toVar(),r=it(Bi(n,t)).toVar(),s=Xm().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"}]}),MSe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=fe(e).toVar(),s=fe(i).toVar(),o=it(Bi(s,r,n)).toVar(),a=Xm().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"}]}),dc=Ro([ESe,MSe]),CSe=Ae(([i])=>{let e=ft(i).toVar(),t=fe().toVar(),n=fe().toVar(),r=se(pr(e.x,t)).toVar(),s=se(pr(e.y,n)).toVar(),o=se(Nh(r)).toVar(),a=se(Nh(s)).toVar(),l=se(Kee(ro(Bi(t,n),r,s),ro(Bi(t.add(fe(1)),n),r.sub(1),s),ro(Bi(t,n.add(fe(1))),r,s.sub(1)),ro(Bi(t.add(fe(1)),n.add(fe(1))),r.sub(1),s.sub(1)),o,a)).toVar();return Qee(l)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),RSe=Ae(([i])=>{let e=pe(i).toVar(),t=fe().toVar(),n=fe().toVar(),r=fe().toVar(),s=se(pr(e.x,t)).toVar(),o=se(pr(e.y,n)).toVar(),a=se(pr(e.z,r)).toVar(),l=se(Nh(s)).toVar(),c=se(Nh(o)).toVar(),u=se(Nh(a)).toVar(),f=se(Zee(ro(Bi(t,n,r),s,o,a),ro(Bi(t.add(fe(1)),n,r),s.sub(1),o,a),ro(Bi(t,n.add(fe(1)),r),s,o.sub(1),a),ro(Bi(t.add(fe(1)),n.add(fe(1)),r),s.sub(1),o.sub(1),a),ro(Bi(t,n,r.add(fe(1))),s,o,a.sub(1)),ro(Bi(t.add(fe(1)),n,r.add(fe(1))),s.sub(1),o,a.sub(1)),ro(Bi(t,n.add(fe(1)),r.add(fe(1))),s,o.sub(1),a.sub(1)),ro(Bi(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 Jee(f)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]}),rk=Ro([CSe,RSe]),PSe=Ae(([i])=>{let e=ft(i).toVar(),t=fe().toVar(),n=fe().toVar(),r=se(pr(e.x,t)).toVar(),s=se(pr(e.y,n)).toVar(),o=se(Nh(r)).toVar(),a=se(Nh(s)).toVar(),l=pe(Kee(fc(dc(t,n),r,s),fc(dc(t.add(fe(1)),n),r.sub(1),s),fc(dc(t,n.add(fe(1))),r,s.sub(1)),fc(dc(t.add(fe(1)),n.add(fe(1))),r.sub(1),s.sub(1)),o,a)).toVar();return Qee(l)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),ISe=Ae(([i])=>{let e=pe(i).toVar(),t=fe().toVar(),n=fe().toVar(),r=fe().toVar(),s=se(pr(e.x,t)).toVar(),o=se(pr(e.y,n)).toVar(),a=se(pr(e.z,r)).toVar(),l=se(Nh(s)).toVar(),c=se(Nh(o)).toVar(),u=se(Nh(a)).toVar(),f=pe(Zee(fc(dc(t,n,r),s,o,a),fc(dc(t.add(fe(1)),n,r),s.sub(1),o,a),fc(dc(t,n.add(fe(1)),r),s,o.sub(1),a),fc(dc(t.add(fe(1)),n.add(fe(1)),r),s.sub(1),o.sub(1),a),fc(dc(t,n,r.add(fe(1))),s,o,a.sub(1)),fc(dc(t.add(fe(1)),n,r.add(fe(1))),s.sub(1),o,a.sub(1)),fc(dc(t,n.add(fe(1)),r.add(fe(1))),s,o.sub(1),a.sub(1)),fc(dc(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 Jee(f)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),Ib=Ro([PSe,ISe]),NSe=Ae(([i])=>{let e=se(i).toVar(),t=fe(ds(e)).toVar();return na(Bi(t))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),LSe=Ae(([i])=>{let e=ft(i).toVar(),t=fe(ds(e.x)).toVar(),n=fe(ds(e.y)).toVar();return na(Bi(t,n))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),DSe=Ae(([i])=>{let e=pe(i).toVar(),t=fe(ds(e.x)).toVar(),n=fe(ds(e.y)).toVar(),r=fe(ds(e.z)).toVar();return na(Bi(t,n,r))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),FSe=Ae(([i])=>{let e=Lt(i).toVar(),t=fe(ds(e.x)).toVar(),n=fe(ds(e.y)).toVar(),r=fe(ds(e.z)).toVar(),s=fe(ds(e.w)).toVar();return na(Bi(t,n,r,s))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]}),OSe=Ro([NSe,LSe,DSe,FSe]),BSe=Ae(([i])=>{let e=se(i).toVar(),t=fe(ds(e)).toVar();return pe(na(Bi(t,fe(0))),na(Bi(t,fe(1))),na(Bi(t,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),USe=Ae(([i])=>{let e=ft(i).toVar(),t=fe(ds(e.x)).toVar(),n=fe(ds(e.y)).toVar();return pe(na(Bi(t,n,fe(0))),na(Bi(t,n,fe(1))),na(Bi(t,n,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),kSe=Ae(([i])=>{let e=pe(i).toVar(),t=fe(ds(e.x)).toVar(),n=fe(ds(e.y)).toVar(),r=fe(ds(e.z)).toVar();return pe(na(Bi(t,n,r,fe(0))),na(Bi(t,n,r,fe(1))),na(Bi(t,n,r,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),GSe=Ae(([i])=>{let e=Lt(i).toVar(),t=fe(ds(e.x)).toVar(),n=fe(ds(e.y)).toVar(),r=fe(ds(e.z)).toVar(),s=fe(ds(e.w)).toVar();return pe(na(Bi(t,n,r,s,fe(0))),na(Bi(t,n,r,s,fe(1))),na(Bi(t,n,r,s,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]}),fR=Ro([BSe,USe,kSe,GSe]),dC=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 Ri(o,()=>{l.addAssign(c.mul(rk(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"}]}),dR=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 Ri(o,()=>{l.addAssign(c.mul(Ib(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"}]}),zSe=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=fe(e).toVar(),a=pe(i).toVar();return ft(dC(a,o,s,r),dC(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"}]}),VSe=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=fe(e).toVar(),a=pe(i).toVar(),l=pe(dR(a,o,s,r)).toVar(),c=se(dC(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"}]}),qSe=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(fR(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)),()=>er(T.x).add(er(T.y))),Wt(a.equal(fe(3)),()=>Er(er(T.x),er(T.y))),_c(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"}]}),HSe=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(fR(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)),()=>er(C.x).add(er(C.y)).add(er(C.z))),Wt(c.equal(fe(3)),()=>Er(er(C.x),er(C.y),er(C.z))),_c(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"}]}),j1=Ro([qSe,HSe]),WSe=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(pr(s.x,o),pr(s.y,a)).toVar(),c=se(1e6).toVar();return Ri({start:-1,end:fe(1),name:"x",condition:"<="},({x:u})=>{Ri({start:-1,end:fe(1),name:"y",condition:"<="},({y:f})=>{let p=se(j1(l,u,f,o,a,r,n)).toVar();c.assign(il(c,p))})}),Wt(n.equal(fe(0)),()=>{c.assign(Ia(c))}),c}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),jSe=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(pr(s.x,o),pr(s.y,a)).toVar(),c=ft(1e6,1e6).toVar();return Ri({start:-1,end:fe(1),name:"x",condition:"<="},({x:u})=>{Ri({start:-1,end:fe(1),name:"y",condition:"<="},({y:f})=>{let p=se(j1(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(Ia(c))}),c}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),XSe=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(pr(s.x,o),pr(s.y,a)).toVar(),c=pe(1e6,1e6,1e6).toVar();return Ri({start:-1,end:fe(1),name:"x",condition:"<="},({x:u})=>{Ri({start:-1,end:fe(1),name:"y",condition:"<="},({y:f})=>{let p=se(j1(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(Ia(c))}),c}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),$Se=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(pr(s.x,o),pr(s.y,a),pr(s.z,l)).toVar(),u=se(1e6).toVar();return Ri({start:-1,end:fe(1),name:"x",condition:"<="},({x:f})=>{Ri({start:-1,end:fe(1),name:"y",condition:"<="},({y:p})=>{Ri({start:-1,end:fe(1),name:"z",condition:"<="},({z:x})=>{let v=se(j1(c,f,p,x,o,a,l,r,n)).toVar();u.assign(il(u,v))})})}),Wt(n.equal(fe(0)),()=>{u.assign(Ia(u))}),u}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),YSe=Ro([WSe,$Se]),KSe=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(pr(s.x,o),pr(s.y,a),pr(s.z,l)).toVar(),u=ft(1e6,1e6).toVar();return Ri({start:-1,end:fe(1),name:"x",condition:"<="},({x:f})=>{Ri({start:-1,end:fe(1),name:"y",condition:"<="},({y:p})=>{Ri({start:-1,end:fe(1),name:"z",condition:"<="},({z:x})=>{let v=se(j1(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(Ia(u))}),u}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),ZSe=Ro([jSe,KSe]),QSe=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(pr(s.x,o),pr(s.y,a),pr(s.z,l)).toVar(),u=pe(1e6,1e6,1e6).toVar();return Ri({start:-1,end:fe(1),name:"x",condition:"<="},({x:f})=>{Ri({start:-1,end:fe(1),name:"y",condition:"<="},({y:p})=>{Ri({start:-1,end:fe(1),name:"z",condition:"<="},({z:x})=>{let v=se(j1(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(Ia(u))}),u}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),sk=Ro([XSe,QSe]),JSe=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=Fl(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(Ib(D))}),Wt(f.equal(fe(1)),()=>{F.assign(fR(D))}),Wt(f.equal(fe(2)),()=>{F.assign(sk(D,w,fe(0)))}),Wt(f.equal(fe(3)),()=>{F.assign(dR(pe(D,0),R,C,L))}),F.assign(F.mul(T.sub(S)).add(S)),Wt(P,()=>{F.assign(lu(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"}]}),eTe=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=Fl(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(Ib(D))}),Wt(f.equal(fe(1)),()=>{F.assign(fR(D))}),Wt(f.equal(fe(2)),()=>{F.assign(sk(D,w,fe(0)))}),Wt(f.equal(fe(3)),()=>{F.assign(dR(D,R,C,L))}),F.assign(F.mul(T.sub(S)).add(S)),Wt(P,()=>{F.assign(lu(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"}]}),tTe=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(Rh(r)).mul(6).toVar();let s=fe(iU(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"}]}),nTe=Ae(([i])=>{let e=pe(i).toVar(),t=se(e.x).toVar(),n=se(e.y).toVar(),r=se(e.z).toVar(),s=se(il(t,il(n,r))).toVar(),o=se(Er(t,Er(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(ps(2,r.sub(t).div(a)))}).Else(()=>{l.assign(ps(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"}]}),iTe=Ae(([i])=>{let e=pe(i).toVar(),t=z7($7(e,pe(.04045))).toVar(),n=pe(e.div(12.92)).toVar(),r=pe(pc(Er(e.add(pe(.055)),pe(0)).div(1.055),pe(2.4))).toVar();return Xn(n,r,t)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),tte=(i,e)=>{i=se(i),e=se(e);let t=ft(e.dFdx(),e.dFdy()).length().mul(.7071067811865476);return Bl(i.sub(t),i.add(t),e)},nte=(i,e,t,n)=>Xn(i,e,t[n].clamp()),rTe=(i,e,t=Pi())=>nte(i,e,t,"x"),sTe=(i,e,t=Pi())=>nte(i,e,t,"y"),oTe=(i,e,t,n,r=Pi())=>{let s=r.x.clamp(),o=r.y.clamp(),a=Xn(i,e,s),l=Xn(t,n,s);return Xn(a,l,o)},ite=(i,e,t,n,r)=>Xn(i,e,tte(t,n[r])),aTe=(i,e,t,n=Pi())=>ite(i,e,t,n,"x"),lTe=(i,e,t,n=Pi())=>ite(i,e,t,n,"y"),cTe=(i=1,e=0,t=Pi())=>t.mul(i).add(e),uTe=(i,e=1)=>(i=se(i),i.abs().pow(e).mul(i.sign())),hTe=(i,e=1,t=.5)=>se(i).sub(t).mul(e).add(t),fTe=(i=Pi(),e=1,t=0)=>rk(i.convert("vec2|vec3")).mul(e).add(t),dTe=(i=Pi(),e=1,t=0)=>Ib(i.convert("vec2|vec3")).mul(e).add(t),pTe=(i=Pi(),e=1,t=0)=>(i=i.convert("vec2|vec3"),Lt(Ib(i),rk(i.add(ft(19,73)))).mul(e).add(t)),ATe=(i,e=Pi(),t=ft(1,1),n=ft(0,0),r=1,s=0,o=1,a=!1,l=1,c=2,u=.5)=>JSe(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),mTe=(i,e=Pi(),t=ft(1,1),n=ft(0,0),r=1,s=0,o=1,a=!1,l=1,c=2,u=.5)=>eTe(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),gTe=(i=Pi(),e=1)=>YSe(i.convert("vec2|vec3"),e,fe(1)),_Te=(i=Pi(),e=1)=>ZSe(i.convert("vec2|vec3"),e,fe(1)),xTe=(i=Pi(),e=1)=>sk(i.convert("vec2|vec3"),e,fe(1)),yTe=(i=Pi())=>OSe(i.convert("vec2|vec3")),vTe=(i=Pi(),e=3,t=2,n=.5,r=1)=>dC(i,fe(e),t,n).mul(r),bTe=(i=Pi(),e=3,t=2,n=.5,r=1)=>zSe(i,fe(e),t,n).mul(r),wTe=(i=Pi(),e=3,t=2,n=.5,r=1)=>dR(i,fe(e),t,n).mul(r),STe=(i=Pi(),e=3,t=2,n=.5,r=1)=>VSe(i,fe(e),t,n).mul(r),TTe=(i,e=se(0))=>ps(i,e),ETe=(i,e=se(0))=>ii(i,e),MTe=(i,e=se(1))=>bn(i,e),CTe=(i,e=se(1))=>Ol(i,e),RTe=(i,e=se(1))=>jC(i,e),PTe=(i,e=se(1))=>pc(i,e),ITe=(i=se(0),e=se(1))=>Q7(i,e),NTe=()=>W1,LTe=()=>yee,DTe=(i,e=se(1))=>ii(e,i),FTe=(i,e,t,n)=>i.greaterThan(e).mix(t,n),OTe=(i,e,t,n)=>i.greaterThanEqual(e).mix(t,n),BTe=(i,e,t,n)=>i.equal(e).mix(t,n),UTe=(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},kTe=(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},GTe=(i,e)=>{i=ft(i),e=se(e);let t=e.mul(Math.PI/180);return Cb(i,t)},zTe=(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))},VTe=(i,e)=>(i=pe(i),e=se(e),RU(i,e)),qTe=Ae(([i,e,t])=>{let n=ta(i).toVar(),r=ii(se(.5).mul(e.sub(t)),Ih).div(n).toVar(),s=ii(se(-.5).mul(e.sub(t)),Ih).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=il(o.x,o.y,o.z).toVar();return Ih.add(n.mul(a)).toVar().sub(t)}),rte=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}),k=Object.freeze({__proto__:null,BRDF_GGX:WU,BRDF_Lambert:Vm,BasicPointShadowFilter:jee,BasicShadowFilter:Uee,Break:qJ,Const:pQ,Continue:$ye,DFGLUT:hb,D_GGX:nee,Discard:RQ,EPSILON:XC,F_Schlick:U1,Fn:Ae,HALF_PI:Vxe,INFINITY:kxe,If:Wt,Loop:Ri,NodeAccess:Mo,NodeShaderStage:v1,NodeType:_xe,NodeUpdateType:_n,OnBeforeFrameUpdate:Vye,OnBeforeMaterialUpdate:zye,OnBeforeObjectUpdate:Gye,OnFrameUpdate:FJ,OnMaterialUpdate:kye,OnObjectUpdate:Mb,PCFShadowFilter:kee,PCFSoftShadowFilter:Gee,PI:BM,PI2:Gxe,PointShadowFilter:Xee,Return:Jxe,Schlick_to_F0:tO,ShaderNode:S1,Stack:VC,Switch:Lxe,TBNViewMatrix:Cm,TWO_PI:zxe,VSMShadowFilter:zee,V_GGX_SmithCorrelated:tee,Var:dQ,VarIntent:AQ,abs:er,acesFilmicToneMapping:Pee,acos:Z7,acosh:qZ,add:ps,addMethodChaining:Be,addNodeElement:eye,agxToneMapping:Iee,all:LZ,alphaT:NM,ambientOcclusion:iF,and:xZ,anisotropy:e0,anisotropyB:Im,anisotropyT:Zv,any:DZ,append:Fxe,array:hZ,asin:zZ,asinh:VZ,assign:fZ,atan:Q7,atanh:HZ,atomicAdd:owe,atomicAnd:uwe,atomicFunc:Gh,atomicLoad:rwe,atomicMax:lwe,atomicMin:cwe,atomicOr:hwe,atomicStore:swe,atomicSub:awe,atomicXor:fwe,attenuationColor:j7,attenuationDistance:W7,attribute:Dl,attributeArray:hbe,backgroundBlurriness:wee,backgroundIntensity:HO,backgroundRotation:See,batch:kJ,batchColor:BU,bentNormalView:sJ,billboarding:Jve,bitAnd:wZ,bitNot:SZ,bitOr:TZ,bitXor:EZ,bitangentGeometry:Iye,bitangentLocal:Nye,bitangentView:iJ,bitangentWorld:Lye,bitcast:_ee,blendBurn:vbe,blendColor:Tbe,blendDodge:bbe,blendOverlay:Sbe,blendScreen:wbe,blur:lee,bool:Fl,buffer:q1,bufferAttribute:dU,builtin:od,builtinAOContext:hQ,builtinShadowContext:uQ,bumpMap:RU,bvec2:sZ,bvec3:z7,bvec4:oZ,bypass:MQ,cache:EQ,call:dZ,cameraFar:i0,cameraIndex:m0,cameraNear:n0,cameraNormalMatrix:lye,cameraPosition:FQ,cameraProjectionMatrix:Pa,cameraProjectionMatrixInverse:DQ,cameraViewMatrix:g0,cameraViewport:cye,cameraWorldMatrix:Eb,cbrt:rQ,cdl:Pbe,ceil:YC,checker:aSe,cineonToneMapping:Ree,clamp:lu,clearcoat:RM,clearcoatNormalView:r0,clearcoatRoughness:E1,clipSpace:UQ,code:cR,color:rZ,colorSpaceToWorking:ZC,colorToDirection:Oye,compute:TQ,computeKernel:AU,computeSkinning:Xye,context:sd,convert:lZ,convertColorSpace:jxe,convertToTexture:abe,cos:iu,cosh:UZ,countLeadingZeros:Pve,countOneBits:Ive,countTrailingZeros:Rve,cross:nd,cubeTexture:Ra,cubeTextureBase:MU,dFdx:tU,dFdy:nU,dashSize:Nm,debug:IQ,decrement:NZ,decrementBefore:PZ,defaultBuildStages:yM,defaultShaderStages:JK,defined:N1,degrees:OZ,deltaTime:Wve,densityFogFactor:Fee,depth:VU,depthPass:Fbe,determinant:YZ,difference:JZ,diffuseColor:Ci,diffuseContribution:Sm,directPointLight:Yee,directionToColor:Fye,directionToFaceDirection:bye,dispersion:X7,disposeShadowMaterial:qee,distance:QZ,div:Ol,dot:_c,drawIndex:SQ,dynamicBufferAttribute:Yxe,element:aZ,emissive:nF,equal:pZ,equirectDirection:YF,equirectUV:qU,exp:Y7,exp2:L1,exponentialHeightFogFactor:jbe,expression:Ll,faceDirection:SU,faceForward:cU,faceforward:qxe,float:se,floatBitsToInt:Eve,floatBitsToUint:xee,floor:Rh,fog:ZO,fract:au,frameGroup:Bxe,frameId:yee,frontFacing:kQ,fwidth:rU,gain:Lve,gapSize:ob,getConstNodeType:iZ,getCurrentStack:U7,getDirection:oee,getDistanceAttenuation:ik,getGeometryRoughness:eee,getNormalFromDepth:cbe,getParallaxCorrectNormal:qTe,getRoughness:HU,getScreenPosition:lbe,getShIrradianceAt:rte,getShadowMaterial:Vee,getShadowRenderObjectFunction:Hee,getTextureIndex:mee,getViewPosition:w1,ggxConvolution:cee,globalId:Kbe,glsl:qbe,glslFn:Hbe,grayscale:Ebe,greaterThan:$7,greaterThanEqual:_Z,hash:Nve,highpModelNormalViewMatrix:wF,highpModelViewMatrix:bF,hue:Rbe,increment:IZ,incrementBefore:RZ,inspector:NQ,instance:BJ,instanceColor:OU,instanceIndex:ou,instancedArray:fbe,instancedBufferAttribute:JC,instancedDynamicBufferAttribute:pU,instancedMesh:UJ,int:fe,intBitsToFloat:Mve,interleavedGradientNoise:$U,inverse:KZ,inverseSqrt:K7,inversesqrt:Hxe,invocationLocalIndex:Qxe,invocationSubgroupIndex:Zxe,ior:Qv,iridescence:HC,iridescenceIOR:PM,iridescenceThickness:IM,isolate:R1,ivec2:Tr,ivec3:G7,ivec4:V7,js:zbe,label:fQ,length:Ph,lengthSq:aU,lessThan:mZ,lessThanEqual:gZ,lightPosition:JU,lightProjectionUV:Oee,lightShadowMatrix:hR,lightTargetDirection:tk,lightTargetPosition:Bee,lightViewPosition:ek,lightingContext:WJ,lights:qwe,linearDepth:jM,linearToneMapping:Mee,localId:Zbe,log:$C,log2:Ch,logarithmicDepthToViewZ:Jye,luminance:KU,mat2:qC,mat3:so,mat4:l0,matcapUV:uee,materialAO:LJ,materialAlphaTest:aJ,materialAnisotropy:bJ,materialAnisotropyVector:b1,materialAttenuationColor:PJ,materialAttenuationDistance:RJ,materialClearcoat:mJ,materialClearcoatNormal:_J,materialClearcoatRoughness:gJ,materialColor:lJ,materialDispersion:NJ,materialEmissive:uJ,materialEnvIntensity:bM,materialEnvRotation:VM,materialIOR:CJ,materialIridescence:wJ,materialIridescenceIOR:SJ,materialIridescenceThickness:TJ,materialLightMap:FU,materialLineDashOffset:DU,materialLineDashSize:NU,materialLineGapSize:LU,materialLineScale:IU,materialLineWidth:qM,materialMetalness:pJ,materialNormal:AJ,materialOpacity:PU,materialPointSize:IJ,materialReference:Qf,materialReflectivity:wM,materialRefractionRatio:VQ,materialRotation:xJ,materialRoughness:dJ,materialSheen:yJ,materialSheenRoughness:vJ,materialShininess:cJ,materialSpecular:hJ,materialSpecularColor:fJ,materialSpecularIntensity:DF,materialSpecularStrength:Jv,materialThickness:MJ,materialTransmission:EJ,max:Er,maxMipLevel:xU,mediumpModelViewMatrix:BQ,metalness:ed,min:il,mix:Xn,mixElement:oQ,mod:jC,modelDirection:mye,modelNormalMatrix:OQ,modelPosition:gye,modelRadius:yye,modelScale:_ye,modelViewMatrix:Dh,modelViewPosition:xye,modelViewProjection:DJ,modelWorldMatrix:Ac,modelWorldMatrixInverse:vye,morphReference:HJ,mrt:gee,mul:bn,mx_aastep:tte,mx_add:TTe,mx_atan2:ITe,mx_cell_noise_float:yTe,mx_contrast:hTe,mx_divide:CTe,mx_fractal_noise_float:vTe,mx_fractal_noise_vec2:bTe,mx_fractal_noise_vec3:wTe,mx_fractal_noise_vec4:STe,mx_frame:LTe,mx_heighttonormal:VTe,mx_hsvtorgb:tTe,mx_ifequal:BTe,mx_ifgreater:FTe,mx_ifgreatereq:OTe,mx_invert:DTe,mx_modulo:RTe,mx_multiply:MTe,mx_noise_float:fTe,mx_noise_vec3:dTe,mx_noise_vec4:pTe,mx_place2d:kTe,mx_power:PTe,mx_ramp4:oTe,mx_ramplr:rTe,mx_ramptb:sTe,mx_rgbtohsv:nTe,mx_rotate2d:GTe,mx_rotate3d:zTe,mx_safepower:uTe,mx_separate:UTe,mx_splitlr:aTe,mx_splittb:lTe,mx_srgb_texture_to_lin_rec709:iTe,mx_subtract:ETe,mx_timer:NTe,mx_transform_uv:cTe,mx_unifiednoise2d:ATe,mx_unifiednoise3d:mTe,mx_worley_noise_float:gTe,mx_worley_noise_vec2:_Te,mx_worley_noise_vec3:xTe,negate:eU,negateOnBackSide:Km,neutralToneMapping:Nee,nodeArray:Pm,nodeImmutable:xt,nodeObject:Vt,nodeObjectIntent:Xv,nodeObjects:zC,nodeProxy:Hn,nodeProxyConstructor:B7,nodeProxyIntent:lt,normalFlat:GQ,normalGeometry:eR,normalLocal:ia,normalMap:NF,normalView:ai,normalViewGeometry:D1,normalWorld:_0,normalWorldGeometry:zQ,normalize:ta,not:vZ,notEqual:AZ,numWorkgroups:$be,objectDirection:uye,objectGroup:uZ,objectPosition:fye,objectRadius:Aye,objectScale:dye,objectViewPosition:pye,objectWorldMatrix:hye,oneMinus:WZ,or:yZ,orthographicDepthToViewZ:XJ,oscSawtooth:Yve,oscSine:jve,oscSquare:Xve,oscTriangle:$ve,output:M1,outputStruct:wve,overloadingFn:Ro,overrideNode:pee,overrideNodes:Aee,packHalf2x16:Uve,packNormalToRGB:CU,packSnorm2x16:Ove,packUnorm2x16:Bve,parabola:FO,parallaxDirection:rJ,parallaxUV:Dye,parameter:yve,pass:Lbe,passTexture:Dbe,pcurve:Dve,perspectiveDepthToViewZ:rR,pmremTexture:XU,pointShadow:$ee,pointUV:dbe,pointWidth:Oxe,positionGeometry:Qo,positionLocal:dr,positionPrevious:zm,positionView:is,positionViewDirection:qi,positionWorld:Ih,positionWorldDirection:wU,posterize:Ibe,pow:pc,pow2:sU,pow3:eQ,pow4:oU,premultiplyAlpha:gU,property:rd,quadBroadcast:Bwe,quadSwapDiagonal:Iwe,quadSwapX:Rwe,quadSwapY:Pwe,radians:FZ,rand:sQ,range:Xbe,rangeFogFactor:Dee,reciprocal:XZ,reference:ir,referenceBuffer:$Q,reflect:ZZ,reflectVector:WQ,reflectView:qQ,reflector:rbe,refract:lU,refractVector:jQ,refractView:HQ,reinhardToneMapping:Cee,remap:mU,remapClamp:CQ,renderGroup:Kt,renderOutput:_U,rendererReference:yQ,replaceDefaultUV:Kve,rotate:Cb,rotateUV:Zve,roughness:Eh,round:jZ,rtt:bee,sRGBTransferEOTF:gQ,sRGBTransferOETF:_Q,sample:ube,sampler:rye,samplerComparison:sye,saturate:KC,saturation:Mbe,screenCoordinate:Ym,screenDPR:vU,screenSize:Gm,screenUV:su,select:ea,setCurrentStack:sb,setName:uU,shaderStages:vM,shadow:Wee,shadowPositionWorld:nk,shapeCircle:lSe,sharedUniformGroup:WC,sheen:Il,sheenRoughness:t0,shiftLeft:MZ,shiftRight:CZ,shininess:LM,sign:J7,sin:Ca,sinc:Fve,sinh:BZ,skinning:VJ,smoothstep:Bl,smoothstepElement:aQ,specularColor:h0,specularColorBlended:Em,specularF90:Mm,spherizeUV:Qve,split:Dxe,spritesheetUV:tbe,sqrt:Ia,stack:TM,step:Um,stepElement:lQ,storage:c0,storageBarrier:ewe,storageTexture:Tee,storageTexture3D:Abe,struct:bve,sub:ii,subBuild:Lm,subgroupAdd:Awe,subgroupAll:Ewe,subgroupAnd:vwe,subgroupAny:Mwe,subgroupBallot:pwe,subgroupBroadcast:Nwe,subgroupBroadcastFirst:Cwe,subgroupElect:dwe,subgroupExclusiveAdd:gwe,subgroupExclusiveMul:ywe,subgroupInclusiveAdd:mwe,subgroupInclusiveMul:xwe,subgroupIndex:Kxe,subgroupMax:Twe,subgroupMin:Swe,subgroupMul:_we,subgroupOr:bwe,subgroupShuffle:Lwe,subgroupShuffleDown:Owe,subgroupShuffleUp:Fwe,subgroupShuffleXor:Dwe,subgroupSize:Qbe,subgroupXor:wwe,tan:kZ,tangentGeometry:tR,tangentLocal:f0,tangentView:nR,tangentWorld:nJ,tanh:GZ,texture:li,texture3D:YU,texture3DLevel:_be,texture3DLoad:gbe,textureBarrier:twe,textureBicubic:E2e,textureBicubicLevel:jU,textureCubeUV:aee,textureLevel:iye,textureLoad:ns,textureSize:km,textureStore:pbe,thickness:H7,time:W1,toneMapping:vQ,toneMappingExposure:bQ,toonOutlinePass:Obe,transformDirection:tQ,transformNormal:TU,transformNormalByInverseViewMatrix:iQ,transformNormalByViewMatrix:nQ,transformNormalToView:EU,transformedClearcoatNormalView:Tye,transformedNormalView:wye,transformedNormalWorld:Sye,transmission:DM,transpose:$Z,triNoise3D:qve,triplanarTexture:nbe,triplanarTextures:vee,trunc:iU,uint:it,uintBitsToFloat:Cve,uniform:Ht,uniformArray:Eo,uniformCubeTexture:Eye,uniformFlow:cQ,uniformGroup:cZ,uniformTexture:nye,unpackHalf2x16:zve,unpackNormal:PF,unpackRGBToNormal:oJ,unpackSnorm2x16:kve,unpackUnorm2x16:Gve,unpremultiplyAlpha:PQ,userData:xbe,uv:Pi,uvec2:k7,uvec3:Xm,uvec4:q7,varying:A0,varyingProperty:$m,vec2:ft,vec3:pe,vec4:Lt,vectorComponents:jm,velocity:ybe,vertexColor:KJ,vertexIndex:wQ,vertexStage:mQ,vibrance:Cbe,viewZToLogarithmicDepth:sR,viewZToOrthographicDepth:Dm,viewZToPerspectiveDepth:zU,viewZToReversedOrthographicDepth:Qye,viewZToReversedPerspectiveDepth:$J,viewport:I1,viewportCoordinate:LQ,viewportDepthTexture:GU,viewportLinearDepth:e2e,viewportMipTexture:kU,viewportOpaqueMipTexture:jJ,viewportResolution:aye,viewportSafeUV:ebe,viewportSharedTexture:Nbe,viewportSize:bU,viewportTexture:Kye,viewportUV:oye,vogelDiskSample:ru,wgsl:Vbe,wgslFn:Wbe,workgroupArray:nwe,workgroupBarrier:Jbe,workgroupId:Ybe,workingToColorSpace:xQ,xor:bZ}),tu=new db,oB=class extends Bh{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(tu),tu.a=r._clearColor.a;else if(s.isColor===!0)s.getRGB(tu),tu.a=1,o=!0;else if(s.isNode===!0){let l=this.get(e),c=s;tu.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(HO).context({getUV:()=>See.mul(zQ),getTextureLevel:()=>wee}),x=Pa.element(3).element(3).equal(1),v=Ol(1,Pa.element(1).element(1)).mul(3),w=x.select(dr.mul(v),dr),S=Dh.mul(Lt(w,0)),T=Pa.mul(Lt(S.xyz,1));T=T.setZ(T.w);let P=new mr;P.name="Background.material",P.side=hi,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 Gn(new _a(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(HO),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"?tu.set(0,0,0,1):a==="alpha-blend"&&tu.set(0,0,0,0),r.autoClear===!0||o===!0){let l=n.clearColorValue;l.r=tu.r,l.g=tu.g,l.b=tu.b,l.a=tu.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}},HTe=0,_b=class{constructor(e="",t=[]){this.name=e,this.bindings=t,this.id=HTe++}},aB=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 _b(t.name,[]);e.push(r);for(let s of t.bindings)r.bindings.push(s.clone())}else e.push(t);return e}},pC=class{constructor(e,t,n=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=n}},lB=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}},AC=class{constructor(e,t,n=!1,r=null){this.isNodeVar=!0,this.name=e,this.type=t,this.readOnly=n,this.count=r}},cB=class extends AC{constructor(e,t,n=null,r=null){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0,this.interpolationType=n,this.interpolationSampling=r}},uB=class{constructor(e,t,n=""){this.name=e,this.type=t,this.code=n,Object.defineProperty(this,"isNodeCode",{value:!0})}},WTe=0,ib=class{constructor(e=null){this.id=WTe++,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)}},hB=class{constructor(e,t){this.name=e,this.members=t,this.output=!1}},kh=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}},fB=class extends kh{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}},dB=class extends kh{constructor(e,t=new Oe){super(e,t),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}},pB=class extends kh{constructor(e,t=new ie){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}},AB=class extends kh{constructor(e,t=new gn){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}},mB=class extends kh{constructor(e,t=new Ut){super(e,t),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}},gB=class extends kh{constructor(e,t=new P_){super(e,t),this.isMatrix2Uniform=!0,this.boundary=8,this.itemSize=4}},_B=class extends kh{constructor(e,t=new Sn){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}},xB=class extends kh{constructor(e,t=new on){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}},yB=class extends fB{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},vB=class extends dB{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},bB=class extends pB{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},wB=class extends AB{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},SB=class extends mB{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},TB=class extends gB{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},EB=class extends _B{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},MB=class extends xB{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},jTe=0,yK=new WeakMap,vK=new WeakMap,XTe=new WeakMap,$Te=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),sM=i=>/e/g.test(i)?String(i).replace(/\+/g,""):(i=Number(i),i+(i%1?"":".0")),ste=i=>{if(i.writeUsageCount>0)return!0;if(i.subBuildsCache!==void 0){for(let e in i.subBuildsCache)if(ste(i.subBuildsCache[e]))return!0}return!1},mC=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=TM(),this.stacks=[],this.tab=" ",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new ib,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:jTe++})}isFlatShading(){return this.material.flatShading===!0||this.geometry.hasAttribute("normal")===!1}isOpaque(){let e=this.material;return e.transparent===!1&&e.blending===cs&&e.alphaToCoverage===!1}createRenderTarget(e,t,n){return new da(e,t,n)}createCubeRenderTarget(e,t){return new XM(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===Fr?o="ivec":r===Ai&&(o="uvec"),s===Gf||s===Qu?r===Fr?t="int":r===Ai?t="uint":t="float":s===Rs||s===Ju?t=`${o}2`:s===kf||s===S2?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=yK.get(a);l===void 0&&(l=new Map,yK.set(a,l));let c=V1(o);s=l.get(c),s===void 0&&(s=new _b(e,t),l.set(c,s))}else s=new _b(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 vM)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===bi||e.magFilter===up||e.magFilter===ic||e.magFilter===yo||e.minFilter===bi||e.minFilter===up||e.minFilter===ic||e.minFilter===yo}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 ib(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(ste(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 sM(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")}( ${sM(t.r)}, ${sM(t.g)}, ${sM(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 pC(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===Fr?"int":t===Ai?"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=KK(e),r=t==="float"?"":t[0];return/mat2/.test(t)===!0&&(n=n.replace("vec","mat")),r+n}getTypeFromArray(e){return $Te.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 x_)&&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=TM(this.stack);let e=U7();return this.stacks.push(e),sb(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,sb(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 pC(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 hB(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 lB(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 AC(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 cB(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 uB("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=vK.get(t);n===void 0&&(n=new WeakMap,vK.set(t,n));let r=n.get(e);if(r===void 0){r=new cC;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 nC(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 ib,this.stack=TM();for(let u of yM)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()}},Ri=(...i)=>new GF(Pm(i,"int")).toStack(),Qye=()=>Ll("continue").toStack(),WJ=()=>Ll("break").toStack(),g8=new WeakMap,Ml=new gn,GY=new WeakMap,zY=Ae(({bufferMap:i,influence:e,stride:t,width:n,depth:r,offset:s})=>{let o=fe(TQ).mul(t).add(s),a=o.div(n),l=o.sub(a.mul(n));return is(i,Tr(l,a)).depth(r).xyz.mul(e)});function Jye(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=g8.get(i);if(o===void 0||o.count!==s){let T=function(){w.dispose(),g8.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 TA(v,f,p,s);w.type=Zi,w.needsUpdate=!0;let S=u*4;for(let R=0;R<s;R++){let P=a[R],C=l[R],L=c[R],D=f*p*4*R;for(let F=0;F<P.count;F++){let N=F*S;e===!0&&(Ml.fromBufferAttribute(P,F),v[D+N+0]=Ml.x,v[D+N+1]=Ml.y,v[D+N+2]=Ml.z,v[D+N+3]=0),t===!0&&(Ml.fromBufferAttribute(C,F),v[D+N+4]=Ml.x,v[D+N+5]=Ml.y,v[D+N+6]=Ml.z,v[D+N+7]=0),n===!0&&(Ml.fromBufferAttribute(L,F),v[D+N+8]=Ml.x,v[D+N+9]=Ml.y,v[D+N+10]=Ml.z,v[D+N+11]=L.itemSize===4?Ml.w:1)}}o={count:s,texture:w,stride:u,size:new Oe(f,p)},g8.set(i,o),i.addEventListener("dispose",T)}return o}var jJ=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=GY.get(i);(o===void 0||o.count!==s)&&(o={base:Ht(1),influences:i.morphTargetInfluences?Mo(i.morphTargetInfluences,"float"):null,count:s},GY.set(i,o));let{base:a,influences:l}=o,{texture:c,stride:u,size:f}=Jye(e);t===!0&&dr.mulAssign(a),n===!0&&ra.mulAssign(a);let p=fe(f.width);Ri(s,({i:x})=>{let v=se(0).toVar();i.count>1&&i.morphTexture!==null&&i.morphTexture!==void 0?v.assign(is(i.morphTexture,Tr(fe(x).add(1),fe(ou))).r):v.assign(l.element(x).toVar()),Wt(v.notEqual(0),()=>{t===!0&&dr.addAssign(zY({bufferMap:c,influence:v,stride:u,width:p,depth:x,offset:fe(0)})),n===!0&&ra.addAssign(zY({bufferMap:c,influence:v,stride:u,width:p,depth:x,offset:fe(1)}))})}),Rb(({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"),d0=class extends $t{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}},zF=class extends d0{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}},VF=class extends cb{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)}},XJ=Hn(VF),qF=class extends d0{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}},gm=new Oe,B1=class extends xc{static get type(){return"ViewportTextureNode"}constructor(e=su,t=null,n=null){let r=null;n===null?(r=new PA,r.minFilter=vo,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(gm):s.getDrawingBufferSize?s.getDrawingBufferSize(gm):gm.set(s.width,s.height);let o=this.getTextureForReference(s);(o.image.width!==gm.width||o.image.height!==gm.height)&&(o.image.width=gm.width,o.image.height=gm.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}},e2e=Hn(B1).setParameterLength(0,3),GU=Hn(B1,null,null,{generateMipmaps:!0}).setParameterLength(0,3),t2e=GU(),$J=(i=su,e=null)=>t2e.sample(i,e),_8=null,HF=class extends B1{static get type(){return"ViewportDepthTextureNode"}constructor(e=su,t=null,n=null){n===null&&(_8===null&&(_8=new us),n=_8),super(e,t,n)}},zU=Hn(HF).setParameterLength(0,3),cu=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=ZJ().assign(n));else if(t===i.DEPTH)e.isPerspectiveCamera?r=VU(rs.z,n0,i0):r=Dm(rs.z,n0,i0);else if(t===i.LINEAR_DEPTH)if(n!==null)if(e.isPerspectiveCamera){let s=sR(n,n0,i0);r=Dm(s,n0,i0)}else r=n;else r=Dm(rs.z,n0,i0);return r}};cu.DEPTH_BASE="depthBase";cu.DEPTH="depth";cu.LINEAR_DEPTH="linearDepth";var Dm=(i,e,t)=>i.add(e).div(e.sub(t)),n2e=(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)),VU=(i,e,t)=>e.add(i).mul(t).div(t.sub(e).mul(i)),KJ=(i,e,t)=>e.mul(i.add(t)).div(i.mul(e.sub(t))),sR=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))),oR=(i,e,t)=>{e=e.max(1e-6).toVar();let n=Ch(i.negate().div(e)),r=Ch(t.div(e));return n.div(r)},i2e=(i,e,t)=>{let n=i.mul(YC(t.div(e)));return se(Math.E).pow(n).mul(e).negate()},ZJ=Hn(cu,cu.DEPTH_BASE),qU=xt(cu,cu.DEPTH),XM=Hn(cu,cu.LINEAR_DEPTH).setParameterLength(0,1),r2e=XM(zU());qU.assign=i=>ZJ(i);var Fh=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=Mo(t).setGroup(Kt);Ri(o,({i:c})=>{let u=l.element(c);n.assign(rs.dot(u.xyz).negate().add(u.w)),r.assign(n.fwidth().div(2)),s.mulAssign(Bl(r.negate(),r,n))})}let a=e.length;if(a>0){let l=Mo(e).setGroup(Kt),c=se(1).toVar("intersectionClipOpacity");Ri(a,({i:u})=>{let f=l.element(u);n.assign(rs.dot(f.xyz).negate().add(f.w)),r.assign(n.fwidth().div(2)),c.mulAssign(Bl(r.negate(),r,n).oneMinus())}),s.mulAssign(c.oneMinus())}Ci.a.mulAssign(s),Ci.a.equal(0).discard()})()}setupDefault(e,t){return Ae(()=>{let n=t.length;if(this.hardwareClipping===!1&&n>0){let s=Mo(t).setGroup(Kt);Ri(n,({i:o})=>{let a=s.element(o);rs.dot(a.xyz).greaterThan(a.w).discard()})}let r=e.length;if(r>0){let s=Mo(e).setGroup(Kt),o=Fl(!0).toVar("clipped");Ri(r,({i:a})=>{let l=s.element(a);o.assign(rs.dot(l.xyz).greaterThan(l.w).and(o))}),o.discard()}})()}setupHardwareClipping(e,t){let n=e.length;return t.enableHardwareClipping(n),Ae(()=>{let r=Mo(e).setGroup(Kt),s=od(t.getClipDistance());Ri(n,({i:o})=>{let a=r.element(o),l=rs.dot(a.xyz).sub(a.w).negate();s.element(o).assign(l)})})()}};Fh.ALPHA_TO_COVERAGE="alphaToCoverage";Fh.DEFAULT="default";Fh.HARDWARE="hardware";var s2e=()=>new Fh,o2e=()=>new Fh(Fh.ALPHA_TO_COVERAGE),a2e=()=>new Fh(Fh.HARDWARE),l2e=.05,VY=Ae(([i])=>au(bn(1e4,Ca(bn(17,i.x).add(bn(.1,i.y)))).mul(ps(.1,er(Ca(bn(13,i.y).add(i.x))))))),qY=Ae(([i])=>VY(ft(VY(i.xy),i.z))),c2e=Ae(([i])=>{let e=Er(Ph(nU(i.xyz)),Ph(iU(i.xyz))),t=se(1).div(se(l2e).mul(e)).toVar("pixScale"),n=ft(D1(Rh(Ch(t))),D1(KC(Ch(t)))),r=ft(qY(Rh(n.x.mul(i.xyz))),qY(Rh(n.y.mul(i.xyz)))),s=au(Ch(t)),o=ps(bn(s.oneMinus(),r.x),bn(s,r.y)),a=il(s,s.oneMinus()),l=pe(o.mul(o).div(bn(2,a).mul(ii(1,a))),o.sub(bn(.5,a)).div(ii(1,a)),ii(1,ii(1,o).mul(ii(1,o)).div(bn(2,a).mul(ii(1,a))))),c=o.lessThan(a.oneMinus()).select(o.lessThan(a).select(l.x,l.y),l.z);return lu(c,1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]}),WF=class extends zM{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}},QJ=(i=0)=>new WF(i),mr=class extends Cs{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(q1(t.slice(0,-4)),n.getCacheKey());return this.type+Mb(e)}build(e){this.setup(e)}setupObserver(e){return new X8(e)}setup(e){e.context.setupNormal=()=>Lm(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=Lm(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,Ci.a).max(0);o=this.setupOutput(e,c),C1.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&&C1.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=o2e():e.stack.addToStack(s2e())}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(a2e()),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=oR(rs.z,n0,i0):r=Dm(rs.z,n0,i0))}r!==null&&qU.assign(r).toStack()}setupPositionView(){return Dh.mul(dr).xyz}setupModelViewProjection(){return Pa.mul(rs)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.position=e.removeStack(),OJ}setupPosition(e){let{object:t,geometry:n}=e;if((n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color)&&jJ(t),t.isSkinnedMesh===!0&&HJ(t),this.displacementMap){let r=Qf("displacementMap","texture"),s=Qf("displacementScale","float"),o=Qf("displacementBias","float");dr.addAssign(ra.normalize().mul(r.x.mul(s).add(o)))}return t.isBatchedMesh&&zJ(t),t.isInstancedMesh&&t.instanceMatrix&&t.instanceMatrix.isInstancedBufferAttribute===!0&&GJ(t),this.positionNode!==null&&dr.assign(Lm(this.positionNode,"POSITION","vec3")),dr}setupDiffuseColor(e){let{object:t,geometry:n}=e;this.maskNode!==null&&Fl(this.maskNode).not().discard();let r=this.colorNode?Lt(this.colorNode):uJ;this.vertexColors===!0&&n.hasAttribute("color")&&(r=r.mul(QJ())),t.instanceColor&&(r=BU.mul(r)),t.isBatchedMesh&&t._colorsTexture&&(r=UU.mul(r)),Ci.assign(r);let s=this.opacityNode?se(this.opacityNode):IU;Ci.a.assign(Ci.a.mul(s));let o=null;(this.alphaTestNode!==null||this.alphaTest>0)&&(o=this.alphaTestNode!==null?se(this.alphaTestNode):cJ,this.alphaToCoverage===!0?(Ci.a=Bl(o,o.add(sU(Ci.a)),Ci.a),Ci.a.lessThanEqual(0).discard()):Ci.a.lessThanEqual(o).discard()),this.alphaHash===!0&&Ci.a.lessThan(c2e(dr)).discard(),e.isOpaque()&&Ci.a.assign(1)}setupVariants(){}setupOutgoingLight(){return this.lights===!0?pe(0):Ci.rgb}setupNormal(){return this.normalNode?pe(this.normalNode):gJ}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?Qf("envMap","cubeTexture"):Qf("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new qF(OU)),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 zF(e.context.ambientOcclusion)),t}setupAmbientOcclusion(e){let t=this.aoNode;t===null&&e.material.aoMap&&(t=FJ),e.context.getAO&&(t=e.context.getAO(t,e)),t!==null&&(rF.assign(t),e.context.ambientOcclusion=rF)}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=XJ(l,u,a,n,r)}else n!==null&&(c=pe(r!==null?Xn(c,n,r):n));return(s&&s.isNode===!0||t.emissive&&t.emissive.isColor===!0)&&(iF.assign(pe(s||fJ)),c=c.add(iF)),c}setupFog(e,t){let n=e.fogNode;return n&&(C1.assign(t),t=Lt(n.toVar())),t}setupPremultipliedAlpha(e,t){return _U(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=Cs.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}},u2e=new Hc,jF=class extends mr{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues(u2e),this.setValues(e)}},h2e=new Yy,XF=class extends mr{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues(h2e),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):FU,t=this.dashScaleNode?se(this.dashScaleNode):NU,n=this.dashSizeNode?se(this.dashSizeNode):LU,r=this.gapSizeNode?se(this.gapSizeNode):DU;Nm.assign(n),lb.assign(r);let s=A0(Dl("lineDistance").mul(t));(e?s.add(e):s).mod(Nm.add(lb)).greaterThan(Nm).discard()}};var TM=$m("vec3","worldStart"),$F=$m("vec3","worldEnd"),JJ=$m("float","lineDistance"),wm=$m("vec4","worldPos"),HY=Ae(({start:i,end:e})=>{let t=Pa.element(2).element(2),n=Pa.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"}),f2e=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"}),_et=Ae(({material:i})=>{let e=i._useDash,t=i._useWorldUnits,n=Dl("instanceStart"),r=Dl("instanceEnd"),s=Lt(Dh.mul(Lt(n,1))).toVar("start"),o=Lt(Dh.mul(Lt(r,1))).toVar("end"),a,l;e&&(a=se(Dl("instanceDistanceStart")).toVar("distanceStart"),l=se(Dl("instanceDistanceEnd")).toVar("distanceEnd")),t&&(TM.assign(s.xyz),$F.assign(o.xyz));let c=N1.z.div(N1.w),u=Pa.element(2).element(3).equal(-1);if(Wt(u,()=>{Wt(s.z.lessThan(0).and(o.z.greaterThan(0)),()=>{let T=HY({start:s,end:o});o.assign(Lt(Xn(s.xyz,o.xyz,T),o.w)),e&&l.assign(Xn(a,l,T))}).ElseIf(o.z.lessThan(0).and(s.z.greaterThanEqual(0)),()=>{let T=HY({start:o,end:s});s.assign(Lt(Xn(o.xyz,s.xyz,T),s.w)),e&&a.assign(Xn(l,a,T))})}),e){let T=i.dashScaleNode?se(i.dashScaleNode):NU,R=i.offsetNode?se(i.offsetNode):FU,P=Jo.y.lessThan(.5).select(T.mul(a),T.mul(l));P=P.add(R),JJ.assign(P)}let f=Pa.mul(s),p=Pa.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(),R=Xn(s.xyz,o.xyz,.5).normalize(),P=T.cross(R).normalize(),C=T.cross(P);wm.assign(Jo.y.lessThan(.5).select(s,o));let L=HM.mul(.5);wm.addAssign(Lt(Jo.x.lessThan(0).select(P.mul(L),P.mul(L).negate()),0)),e||(wm.addAssign(Lt(Jo.y.lessThan(.5).select(T.mul(L).negate(),T.mul(L)),0)),wm.addAssign(Lt(C.mul(L),0)),Wt(Jo.y.greaterThan(1).or(Jo.y.lessThan(0)),()=>{wm.subAssign(Lt(C.mul(2).mul(L),0))})),S.assign(Pa.mul(wm));let D=pe().toVar();D.assign(Jo.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(Jo.x.lessThan(0).select(T.negate(),T)),Wt(Jo.y.lessThan(0),()=>{T.assign(T.sub(w))}).ElseIf(Jo.y.greaterThan(1),()=>{T.assign(T.add(w))}),T.assign(T.mul(HM)),T.assign(T.div(N1.w.div(bU))),S.assign(Jo.y.lessThan(.5).select(f,p)),T.assign(T.mul(S.w)),S.assign(S.add(Lt(T,0,0)))}return S})(),xet=Ae(({material:i,renderer:e})=>{let t=i._useAlphaToCoverage,n=i._useDash,r=i._useWorldUnits,s=Pi();if(n){let a=i.dashSizeNode?se(i.dashSizeNode):LU,l=i.gapSizeNode?se(i.gapSizeNode):DU;Nm.assign(a),lb.assign(l),s.y.lessThan(-1).or(s.y.greaterThan(1)).discard(),JJ.mod(Nm.add(lb)).greaterThan(Nm).discard()}let o=se(1).toVar("alpha");if(r){let a=wm.xyz.normalize().mul(1e5),l=$F.sub(TM),c=f2e({p1:TM,p2:$F,p3:pe(0,0,0),p4:a}),u=TM.add(l.mul(c.x)),f=a.mul(c.y),v=u.sub(f).length().div(HM);if(!n)if(t&&e.currentSamples>0){let w=v.fwidth();o.assign(Bl(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(Bl(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 d2e=new Xy,YF=class extends mr{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(d2e),this.setValues(e)}setupDiffuseColor(){let e=this.opacityNode?se(this.opacityNode):IU;Ci.assign(QC(Lt(RU(ai),e),vr))}},HU=Ae(([i=SU])=>{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)}),KF=Ae(([i=Pi()])=>{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)}),$M=class extends da{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 qu(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 Wc(5,5,5),o=HU(SU),a=new mr;a.colorNode=li(t,o,0),a.side=hi,a.blending=Qr;let l=new Gn(s,a),c=new Jd;c.add(l),t.minFilter===vo&&(t.minFilter=bi);let u=new C_(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)}},nb=new WeakMap,ZF=class extends Ar{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=Ra(null);let t=new qu;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===lp||o===cp){if(nb.has(s)){let a=nb.get(s);WY(a,s.mapping),this._cubeTexture=a}else{let a=s.image;if(p2e(a)){let l=new $M(a.height);l.fromEquirectangularTexture(t,s),WY(l.texture,s.mapping),this._cubeTexture=l.texture,nb.set(s,l.texture),s.addEventListener("dispose",eee)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}};function p2e(i){return i==null?!1:i.height>0}function eee(i){let e=i.target;e.removeEventListener("dispose",eee);let t=nb.get(e);t!==void 0&&(nb.delete(e),t.dispose())}function WY(i,e){e===lp?i.mapping=bl:e===cp&&(i.mapping=nc)}var tee=Hn(ZF).setParameterLength(1),fb=class extends d0{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=tee(this.envNode)}},QF=class extends d0{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)}},U1=class{start(e){e.lightsNode.setupLights(e,e.lightsNode.getLightNodes(e)),this.indirect(e)}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}},YM=class extends U1{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(Ci.rgb)}finish(e){let{material:t,context:n}=e,r=n.outgoingLight,s=e.context.environment;if(s)switch(t.combine){case GA:r.rgb.assign(Xn(r.rgb,r.rgb.mul(s.rgb),tb.mul(SM)));break;case l3:r.rgb.assign(Xn(r.rgb,s.rgb,tb.mul(SM)));break;case c3:r.rgb.addAssign(s.rgb.mul(tb.mul(SM)));break;default:je("BasicLightingModel: Unsupported .combine value:",t.combine);break}}},A2e=new Kr,JF=class extends mr{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(A2e),this.setValues(e)}setupNormal(){return Km(F1)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new fb(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new QF(OU)),t}setupOutgoingLight(){return Ci.rgb}setupLightingModel(){return new YM}},k1=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))}),Vm=Ae(i=>i.diffuseColor.mul(1/Math.PI)),m2e=()=>se(.25),g2e=Ae(({dotNH:i})=>DM.mul(se(.5)).add(1).mul(se(1/Math.PI)).mul(i.pow(DM))),_2e=Ae(({lightDirection:i})=>{let e=i.add(qi).normalize(),t=ai.dot(e).clamp(),n=qi.dot(e).clamp(),r=k1({f0:h0,f90:1,dotVH:n}),s=m2e(),o=g2e({dotNH:t});return r.mul(s).mul(o)}),KM=class extends YM{constructor(e=!0){super(),this.specular=e}direct({lightDirection:e,lightColor:t,reflectedLight:n}){let s=ai.dot(e).clamp().mul(t);n.directDiffuse.addAssign(s.mul(Vm({diffuseColor:Ci.rgb}))),this.specular===!0&&n.directSpecular.addAssign(s.mul(_2e({lightDirection:e})).mul(tb))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(Vm({diffuseColor:Ci}))),r.indirectDiffuse.mulAssign(t)}},x2e=new xa,eO=class extends mr{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(x2e),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new fb(t):null}setupLightingModel(){return new KM(!1)}},y2e=new FA,tO=class extends mr{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(y2e),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new fb(t):null}setupLightingModel(){return new KM}setupVariants(){let e=(this.shininessNode?se(this.shininessNode):hJ).max(1e-4);DM.assign(e);let t=this.specularNode||dJ;h0.assign(t)}},nee=Ae(i=>{if(i.geometry.hasAttribute("normal")===!1)return se(0);let e=F1.dFdx().abs().max(F1.dFdy().abs());return e.x.max(e.y).max(e.z)}),WU=Ae(i=>{let{roughness:e}=i,t=nee(),n=e.max(.0525);return n=n.add(t),n=n.min(1),n}),iee=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 Ol(.5,r.add(s).max($C))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),v2e=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 Ol(.5,l.add(c).max($C))}).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"}]}),ree=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"}]}),b2e=se(1/Math.PI),w2e=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 b2e.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"}]}),jU=Ae(({lightDirection:i,f0:e,f90:t,roughness:n,f:r,normalView:s=ai,USE_IRIDESCENCE:o,USE_ANISOTROPY:a})=>{let l=n.pow2(),c=i.add(qi).normalize(),u=s.dot(i).clamp(),f=s.dot(qi).clamp(),p=s.dot(c).clamp(),x=qi.dot(c).clamp(),v=k1({f0:e,f90:t,dotVH:x}),w,S;if(L1(o)&&(v=WC.mix(v,r)),L1(a)){let T=Jv.dot(i),R=Jv.dot(qi),P=Jv.dot(c),C=Im.dot(i),L=Im.dot(qi),D=Im.dot(c);w=v2e({alphaT:LM,alphaB:l,dotTV:R,dotBV:L,dotTL:T,dotBL:C,dotNV:f,dotNL:u}),S=w2e({alphaT:LM,alphaB:l,dotNH:p,dotTH:P,dotBH:D})}else w=iee({alpha:l,dotNL:u,dotNV:f}),S=ree({alpha:l,dotNH:p});return v.mul(w).mul(S)}),S2e=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]),yh=null,db=Ae(({roughness:i,dotNV:e})=>{yh===null&&(yh=new RA(S2e,16,16,Rs,Fi),yh.name="DFG_LUT",yh.minFilter=bi,yh.magFilter=bi,yh.wrapS=qo,yh.wrapT=qo,yh.generateMipmaps=!1,yh.needsUpdate=!0);let t=ft(i,e);return li(yh,t).rg}),T2e=Ae(({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o})=>{let a=jU({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o}),l=ai.dot(i).clamp(),c=ai.dot(qi).clamp(),u=db({roughness:n,dotNV:c}),f=db({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),R=e.add(e.oneMinus().mul(.047619)),P=p.mul(x).mul(R).div(se(1).sub(S.mul(T).mul(R).mul(R)).add($C)),C=S.mul(T),L=P.mul(C);return a.add(L)}),see=Ae(i=>{let{dotNV:e,specularColor:t,specularF90:n,roughness:r}=i,s=db({dotNV:e,roughness:r});return t.mul(s.x).add(n.mul(s.y))}),nO=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"}]}),E2e=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"}]}),M2e=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"}]}),C2e=Ae(({lightDirection:i})=>{let e=i.add(qi).normalize(),t=ai.dot(i).clamp(),n=ai.dot(qi).clamp(),r=ai.dot(e).clamp(),s=E2e({roughness:t0,dotNH:r}),o=M2e({dotNV:n,dotNL:t});return Il.mul(s).mul(o)}),jY=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"}]}),R2e=Ae(({f:i})=>{let e=i.length();return Er(e.mul(e).add(i.z).div(e.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),jE=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,Er(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"}]}),x8=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(so(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(),R=v.mul(a.sub(t)).normalize().toVar(),P=pe(0).toVar();P.addAssign(jE({v1:w,v2:S})),P.addAssign(jE({v1:S,v2:T})),P.addAssign(jE({v1:T,v2:R})),P.addAssign(jE({v1:R,v2:w})),f.assign(pe(R2e({f:P})))}),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 aR=1/6,oee=i=>bn(aR,bn(i,bn(i,i.negate().add(3)).sub(3)).add(1)),iO=i=>bn(aR,bn(i,bn(i,bn(3,i).sub(6))).add(4)),aee=i=>bn(aR,bn(i,bn(i,bn(-3,i).add(3)).add(3)).add(1)),rO=i=>bn(aR,pc(i,3)),XY=i=>oee(i).add(iO(i)),$Y=i=>aee(i).add(rO(i)),YY=i=>ps(-1,iO(i).div(oee(i).add(iO(i)))),KY=i=>ps(1,rO(i).div(aee(i).add(rO(i)))),ZY=(i,e,t)=>{let n=i.uvNode,r=bn(n,e.zw).add(.5),s=Rh(r),o=au(r),a=XY(o.x),l=$Y(o.x),c=YY(o.x),u=KY(o.x),f=YY(o.y),p=KY(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=XY(o.y).mul(ps(a.mul(i.sample(x).level(t)),l.mul(i.sample(v).level(t)))),R=$Y(o.y).mul(ps(a.mul(i.sample(w).level(t)),l.mul(i.sample(S).level(t))));return T.add(R)},XU=Ae(([i,e])=>{let t=ft(i.size(fe(e))),n=ft(i.size(fe(e.add(1)))),r=Ol(1,t),s=Ol(1,n),o=ZY(i,Lt(r,t),Rh(e)),a=ZY(i,Lt(s,n),KC(e));return au(e).mix(o,a)}),P2e=Ae(([i,e])=>{let t=e.mul(yU(i));return XU(i,t)}),QY=Ae(([i,e,t,n,r])=>{let s=pe(cU(e.negate(),na(i),Ol(1,n))),o=pe(Ph(r[0].xyz),Ph(r[1].xyz),Ph(r[2].xyz));return na(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"}]}),I2e=Ae(([i,e])=>i.mul(lu(e.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),N2e=GU(),L2e=$J(),JY=Ae(([i,e,t],{material:n})=>{let s=(n.side===hi?N2e:L2e).sample(i),o=Ch(Gm.x).mul(I2e(e,t));return XU(s,o)}),eK=Ae(([i,e,t])=>(Wt(t.notEqual(0),()=>{let n=YC(e).negate().div(t);return K7(n.negate().mul(i))}),pe(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),D2e=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));Ri({start:0,end:3},({i:F})=>{let N=D.element(F),B=QY(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=JY(H,t,N);w.element(F).assign(K.element(F)),w.a.addAssign(K.a),S.element(F).assign(n.element(F).mul(eK(Ph(B),p,x).element(F)))}),w.a.divAssign(3)}else{let L=QY(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=JY(N,t,u),S=n.mul(eK(Ph(L),p,x))}let T=S.rgb.mul(w.rgb),R=i.dot(e).clamp(),P=pe(see({dotNV:R,specularColor:r,specularF90:s,roughness:t})),C=S.r.add(S.g,S.b).div(3);return Lt(P.oneMinus().mul(T),w.a.oneMinus().mul(C).oneMinus())}),F2e=so(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),O2e=i=>{let e=i.sqrt();return pe(1).add(e).div(pe(1).sub(e))},tK=(i,e)=>i.sub(e).div(i.add(e)).pow2(),B2e=(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),F2e.mul(a)},nK=Ae(({outsideIOR:i,eta2:e,cosTheta1:t,thinFilmThickness:n,baseF0:r})=>{let s=Xn(i,e,Bl(0,.03,n)),a=i.div(s).pow2().mul(t.pow2().oneMinus()).oneMinus();Wt(a.lessThan(0),()=>pe(1));let l=a.sqrt(),c=tK(s,i),u=k1({f0:c,f90:1,dotVH:t}),f=u.oneMinus(),p=s.lessThan(i).select(Math.PI,0),x=se(Math.PI).sub(p),v=O2e(r.clamp(0,.9999)),w=tK(v,s.toVec3()),S=k1({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)),R=s.mul(n,l,2),P=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 Ri({start:1,end:2,condition:"<=",name:"m"},({m:z})=>{B.mulAssign(L);let V=B2e(se(z).mul(R),se(z).mul(P)).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"}]}),Lv=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()}),Dv=pe(.04),XE=se(1),ZM=class extends U1{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=ai.dot(qi).clamp(),n=nK({outsideIOR:se(1),eta2:IM,cosTheta1:t,thinFilmThickness:NM,baseF0:h0}),r=nK({outsideIOR:se(1),eta2:IM,cosTheta1:t,thinFilmThickness:NM,baseF0:Ci.rgb});this.iridescenceFresnel=Xn(n,r,ed),this.iridescenceF0Dielectric=nO({f:n,f90:1,dotVH:t}),this.iridescenceF0Metallic=nO({f:r,f90:1,dotVH:t}),this.iridescenceF0=Xn(this.iridescenceF0Dielectric,this.iridescenceF0Metallic,ed)}if(this.transmission===!0){let t=Ih,n=BQ.sub(Ih).normalize(),r=_0,s=e.context;s.backdrop=D2e(r,n,Eh,Sm,Em,Mm,t,Ac,g0,Pa,eb,W7,X7,j7,this.dispersion?$7:null),s.backdropAlpha=FM,Ci.a.mulAssign(Xn(1,s.backdrop.a,FM))}super.start(e)}computeMultiscattering(e,t,n,r,s=null){let o=ai.dot(qi).clamp(),a=db({roughness:Eh,dotNV:o}),l=s?WC.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=ai.dot(e).clamp().mul(t).toVar();if(this.sheen===!0){this.sheenSpecularDirect.addAssign(s.mul(C2e({lightDirection:e})));let o=Lv({normal:ai,viewDir:qi,roughness:t0}),a=Lv({normal:ai,viewDir:e,roughness:t0}),l=Il.r.max(Il.g).max(Il.b).mul(o.max(a)).oneMinus();s.mulAssign(l)}if(this.clearcoat===!0){let a=r0.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(a.mul(jU({lightDirection:e,f0:Dv,f90:XE,roughness:M1,normalView:r0})))}n.directDiffuse.addAssign(s.mul(Vm({diffuseColor:Sm}))),n.directSpecular.addAssign(s.mul(T2e({lightDirection:e,f0:Em,f90:1,roughness:Eh,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=ai,x=qi,v=rs.toVar(),w=jY({N:p,V:x,roughness:Eh}),S=o.sample(w).toVar(),T=a.sample(w).toVar(),R=so(pe(S.x,0,S.y),pe(0,1,0),pe(S.z,0,S.w)).toVar(),P=Em.mul(T.x).add(Mm.sub(Em).mul(T.y)).toVar();if(s.directSpecular.addAssign(e.mul(P).mul(x8({N:p,V:x,P:v,mInv:R,p0:l,p1:c,p2:u,p3:f}))),s.directDiffuse.addAssign(e.mul(Sm).mul(x8({N:p,V:x,P:v,mInv:so(1,0,0,0,1,0,0,0,1),p0:l,p1:c,p2:u,p3:f}))),this.clearcoat===!0){let C=r0,L=jY({N:C,V:x,roughness:M1}),D=o.sample(L),F=a.sample(L),N=so(pe(D.x,0,D.y),pe(0,1,0),pe(D.z,0,D.w)),B=Dv.mul(F.x).add(XE.sub(Dv).mul(F.y));this.clearcoatSpecularDirect.addAssign(e.mul(B).mul(x8({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(Vm({diffuseColor:Sm})).toVar();if(this.sheen===!0){let s=Lv({normal:ai,viewDir:qi,roughness:t0}),o=Il.r.max(Il.g).max(Il.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(Il,Lv({normal:ai,viewDir:qi,roughness:t0}))),this.clearcoat===!0){let S=r0.dot(qi).clamp(),T=see({dotNV:S,specularColor:Dv,specularF90:XE,roughness:M1});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,h0,this.iridescenceF0Dielectric),this.computeMultiscattering(a,l,Mm,Ci.rgb,this.iridescenceF0Metallic);let c=Xn(s,a,ed),u=Xn(o,l,ed),f=s.add(o),p=Sm.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=Lv({normal:ai,viewDir:qi,roughness:t0}),T=Il.r.max(Il.g).max(Il.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=ai.dot(qi).clamp().add(t),o=Eh.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=r0.dot(qi).clamp(),r=k1({dotVH:n,f0:Dv,f90:XE}),s=t.mul(PM.mul(r).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(PM));t.assign(s)}if(this.sheen===!0){let n=t.add(this.sheenSpecularDirect,this.sheenSpecularIndirect.mul(1/Math.PI));t.assign(n)}}},iK=se(1),sO=se(-2),$E=se(.8),y8=se(-1),YE=se(.4),v8=se(2),KE=se(.305),b8=se(3),rK=se(.21),U2e=se(4),sK=se(4),k2e=se(16),G2e=Ae(([i])=>{let e=pe(er(i)).toVar(),t=se(-1).toVar();return Wt(e.x.greaterThan(e.z),()=>{Wt(e.x.greaterThan(e.y),()=>{t.assign(ta(i.x.greaterThan(0),0,3))}).Else(()=>{t.assign(ta(i.y.greaterThan(0),1,4))})}).Else(()=>{Wt(e.z.greaterThan(e.y),()=>{t.assign(ta(i.z.greaterThan(0),2,5))}).Else(()=>{t.assign(ta(i.y.greaterThan(0),1,4))})}),t}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),z2e=Ae(([i,e])=>{let t=ft().toVar();return Wt(e.equal(0),()=>{t.assign(ft(i.z,i.y).div(er(i.x)))}).ElseIf(e.equal(1),()=>{t.assign(ft(i.x.negate(),i.z.negate()).div(er(i.y)))}).ElseIf(e.equal(2),()=>{t.assign(ft(i.x.negate(),i.y).div(er(i.z)))}).ElseIf(e.equal(3),()=>{t.assign(ft(i.z.negate(),i.y).div(er(i.x)))}).ElseIf(e.equal(4),()=>{t.assign(ft(i.x.negate(),i.z).div(er(i.y)))}).Else(()=>{t.assign(ft(i.x,i.y).div(er(i.z)))}),bn(.5,t.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),V2e=Ae(([i])=>{let e=se(0).toVar();return Wt(i.greaterThanEqual($E),()=>{e.assign(iK.sub(i).mul(y8.sub(sO)).div(iK.sub($E)).add(sO))}).ElseIf(i.greaterThanEqual(YE),()=>{e.assign($E.sub(i).mul(v8.sub(y8)).div($E.sub(YE)).add(y8))}).ElseIf(i.greaterThanEqual(KE),()=>{e.assign(YE.sub(i).mul(b8.sub(v8)).div(YE.sub(KE)).add(v8))}).ElseIf(i.greaterThanEqual(rK),()=>{e.assign(KE.sub(i).mul(U2e.sub(b8)).div(KE.sub(rK)).add(b8))}).Else(()=>{e.assign(se(-2).mul(Ch(bn(1.16,i))))}),e}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),lee=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"}]}),cee=Ae(([i,e,t,n,r,s])=>{let o=se(t),a=pe(e),l=lu(V2e(o),sO,s),c=au(l),u=Rh(l),f=pe(pb(i,a,u,n,r,s)).toVar();return Wt(c.notEqual(0),()=>{let p=pe(pb(i,a,u.add(1),n,r,s)).toVar();f.assign(Xn(f,p,c))}),f}),pb=Ae(([i,e,t,n,r,s])=>{let o=se(t).toVar(),a=pe(e),l=se(G2e(a)).toVar(),c=se(Er(sK.sub(o),0)).toVar();o.assign(Er(o,sK));let u=se(D1(o)).toVar(),f=ft(z2e(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,k2e))),f.y.addAssign(bn(4,D1(s).sub(u))),f.x.mulAssign(n),f.y.mulAssign(r),i.sample(f).grad(ft(),ft())}),w8=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=iu(n),c=t.mul(l).add(r.cross(t).mul(Ca(n))).add(r.mul(r.dot(t).mul(l.oneMinus())));return pb(i,c,e,s,o,a)}),uee=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(ta(e,t,nd(t,n))).toVar();Wt(p.equal(pe(0)),()=>{p.assign(pe(n.z,0,n.x.negate()))}),p.assign(na(p));let x=pe().toVar();return x.addAssign(r.element(0).mul(w8({theta:0,axis:p,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f}))),Ri({start:fe(1),end:i},({i:v})=>{Wt(v.greaterThanEqual(s),()=>{WJ()});let w=se(o.mul(se(v))).toVar();x.addAssign(r.element(v).mul(w8({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(w8({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)}),q2e=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)}),H2e=Ae(([i,e])=>ft(se(i).div(se(e)),q2e(i))),W2e=Ae(([i,e,t])=>{let n=t.mul(t).toConst(),r=pe(1,0,0).toConst(),s=nd(e,r).toConst(),o=Ia(i.x).toConst(),a=bn(2,3.14159265359).mul(i.y).toConst(),l=o.mul(iu(a)).toConst(),c=o.mul(Ca(a)).toVar(),u=bn(.5,e.z.add(1)).toConst();c.assign(u.oneMinus().mul(Ia(l.mul(l).oneMinus())).add(u.mul(c)));let f=r.mul(l).add(s.mul(c)).add(e.mul(Ia(Er(0,l.mul(l).add(c.mul(c)).oneMinus()))));return na(pe(n.mul(f.x),n.mul(f.y),Er(0,f.z)))}),hee=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(pb(t,l,e,s,o,a))}).Else(()=>{let f=ta(er(l.z).lessThan(.999),pe(0,0,1),pe(1,0,0)),p=na(nd(f,l)).toVar(),x=nd(l,p).toVar();Ri({start:it(0),end:r},({i:v})=>{let w=H2e(v,r),S=W2e(w,pe(0,0,1),i),T=na(p.mul(S.x).add(x.mul(S.y)).add(l.mul(S.z))),R=na(T.mul(_c(l,T).mul(2)).sub(l)),P=Er(_c(l,R),0);Wt(P.greaterThan(0),()=>{let C=pb(t,R,e,s,o,a);c.addAssign(C.mul(P)),u.addAssign(P)})}),Wt(u.greaterThan(0),()=>{c.assign(c.div(u))})}),Lt(c,1)}),a0=4,oK=[.125,.215,.35,.446,.526,.582],Tm=20,j2e=512,Fv=new jc(-1,1,1,-1,0,1),X2e=new Lr(90,1),aK=new Ut,S8=null,T8=0,E8=0,$2e=new ie,QM=new WeakMap,Y2e=[3,1,5,0,4,2],M8=lee(Pi(),Dl("faceIndex")).normalize(),lR=pe(M8.x,M8.y,M8.z),oO=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=$2e,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.');S8=this._renderer.getRenderTarget(),T8=this._renderer.getActiveCubeFace(),E8=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 Qn('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 Qn('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 Qn('PMREMGenerator: ".fromCubemapAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}async compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=cK(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=uK(),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===bl||e.mapping===nc?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(S8,T8,E8),e.scissorTest=!1,this._setViewport(e,0,0,e.width,e.height)}_fromTexture(e,t){this._setSizeFromTexture(e),S8=this._renderer.getRenderTarget(),T8=this._renderer.getActiveCubeFace(),E8=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 lK(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=lK(e.width,e.height);let{_lodMax:t}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=K2e(t)),this._blurMaterial=Z2e(t,e.width,e.height),this._ggxMaterial=Q2e(t,e.width,e.height)}}async _compileMaterial(e){let t=new Gn(new qn,e);await this._renderer.compile(t,Fv)}_sceneToCubeUV(e,t,n,r,s){let o=X2e;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(aK),c.autoClear=!1,this._backgroundBox===null&&(this._backgroundBox=new Gn(new Wc,new Kr({name:"PMREM.Background",side:hi,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(aK),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===bl||e.mapping===nc;r?this._cubemapMaterial===null&&(this._cubemapMaterial=cK(e)):this._equirectMaterial===null&&(this._equirectMaterial=uK(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,Fv)}_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=QM.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-a0?n-v+a0: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,Fv),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,Fv)}_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=QM.get(c),x=this._sizeLods[n]-1,v=isFinite(s)?Math.PI/(2*x):2*Math.PI/(2*Tm-1),w=s/v,S=isFinite(s)?1+Math.floor(u*w):Tm;S>Tm&&je(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${Tm}`);let T=[],R=0;for(let F=0;F<Tm;++F){let N=F/w,B=Math.exp(-N*N/2);T.push(B),F===0?R+=B:F<S&&(R+=2*B)}for(let F=0;F<T.length;F++)T[F]=T[F]/R;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:P}=this;p.dTheta.value=v,p.mipInt.value=P-n;let C=this._sizeLods[r],L=3*C*(r>P-a0?r-P+a0:0),D=4*(this._cubeSize-C);this._setViewport(t,L,D,3*C,2*C),l.setRenderTarget(t),l.render(f,Fv)}_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 K2e(i){let e=[],t=[],n=[],r=i,s=i-a0+1+oK.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-a0?l=oK[o-i+a0-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,R=new Float32Array(w*v*x),P=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=Y2e[D];R.set(B,w*v*z),P.set(p,S*v*z);let V=[z,z,z,z,z,z];C.set(V,T*v*z)}let L=new qn;L.setAttribute("position",new Di(R,w)),L.setAttribute("uv",new Di(P,S)),L.setAttribute("faceIndex",new Di(C,T)),n.push(new Gn(L,null)),r>a0&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function lK(i,e,t){let n={magFilter:bi,minFilter:bi,generateMipmaps:!1,type:Fi,format:wr,colorSpace:Yd,depthBuffer:t},r=new da(i,e,n);return r.texture.mapping=Yu,r.texture.name="PMREM.cubeUv",r.texture.isPMREMTexture=!0,r.scissorTest=!0,r}function cR(i){let e=new mr;return e.depthTest=!1,e.depthWrite=!1,e.blending=Qr,e.name=`PMREM_${i}`,e}function Z2e(i,e,t){let n=Mo(new Array(Tm).fill(0)),r=Ht(new ie(0,1,0)),s=Ht(0),o=se(Tm),a=Ht(0),l=Ht(1),c=li(),u=Ht(0),f=se(1/e),p=se(1/t),x=se(i),v={n:o,latitudinal:a,weights:n,poleAxis:r,outputDirection:lR,dTheta:s,samples:l,envMap:c,mipInt:u,CUBEUV_TEXEL_WIDTH:f,CUBEUV_TEXEL_HEIGHT:p,CUBEUV_MAX_MIP:x},w=cR("blur");return w.fragmentNode=uee({...v,latitudinal:a.equal(1)}),QM.set(w,v),w}function Q2e(i,e,t){let n=li(),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=cR("ggx");return u.fragmentNode=hee({...c,N_immutable:lR,GGX_SAMPLES:it(j2e)}),QM.set(u,c),u}function cK(i){let e=cR("cubemap");return e.fragmentNode=Ra(i,lR),e}function uK(i){let e=cR("equirect");return e.fragmentNode=li(i,HU(lR),0),e}var hK=new WeakMap;function J2e(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 eve(i,e,t){let n=tve(e),r=n.get(i);if((r!==void 0?r.pmremVersion:-1)!==i.pmremVersion){let o=i.image;if(i.isCubeTexture)if(nve(o))r=t.fromCubemap(i,r);else return null;else if(ive(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 tve(i){let e=hK.get(i);return e===void 0&&(e=new WeakMap,hK.set(i,e)),e}var aO=class extends Ar{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 Ms;r.isRenderTargetTexture=!0,this._texture=li(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=J2e(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===Yu?t=r:t=eve(r,e.renderer,this._generator),t!==null&&(this._pmrem=t,this.updateFromTexture(t)))}setup(e){this._generator===null&&(this._generator=new oO(e.renderer)),this.updateBefore(e);let t=this.uvNode;t===null&&e.context.getUV&&(t=e.context.getUV(this,e)),t=this._pmrem.isRenderTargetTexture?qM.mul(pe(t.x,t.y.negate(),t.z)):qM.mul(t);let n=this.levelNode;return n===null&&e.context.getTextureLevel&&(n=e.context.getTextureLevel(this)),cee(this._texture,t,n,this._width,this._height,this._maxMip)}dispose(){super.dispose(),this._generator!==null&&this._generator.dispose()}};function nve(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 ive(i){return i==null?!1:i.height>0}var $U=Hn(aO).setParameterLength(1,3),fK=new WeakMap,lO=class extends d0{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=$U(f),p.set(f,x)),n=x}let s=t.useAnisotropy===!0||t.anisotropy>0?aJ:ai,o=n.context(dK(Eh,s)).mul(wM),a=n.context(rve(_0)).mul(Math.PI).mul(wM),l=P1(o),c=P1(a);e.context.radiance.addAssign(l),e.context.iblIrradiance.addAssign(c);let u=e.context.lightingModel.clearcoatRadiance;if(u){let f=n.context(dK(M1,r0)).mul(wM),p=P1(f);u.addAssign(p)}}_getPMREMNodeCache(e){let t=fK.get(e);return t===void 0&&(t=new WeakMap,fK.set(e,t)),t}},dK=(i,e)=>{let t=null;return{getUV:()=>(t===null&&(t=qi.negate().reflect(e),t=aU(i).mix(t,e).normalize(),t=t.transformDirection(Cb)),t),getTextureLevel:()=>i}},rve=i=>({getUV:()=>i,getTextureLevel:()=>se(1)}),sve=new M_,JM=class extends mr{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(sve),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t===null&&e.environmentNode&&(t=e.environmentNode),t?new lO(t):null}setupLightingModel(){return new ZM}setupSpecular(){let e=Xn(pe(.04),Ci.rgb,ed);h0.assign(pe(.04)),Em.assign(e),Mm.assign(1)}setupVariants(){let e=this.metalnessNode?se(this.metalnessNode):mJ;ed.assign(e);let t=this.roughnessNode?se(this.roughnessNode):AJ;t=WU({roughness:t}),Eh.assign(t),this.setupSpecular(),Sm.assign(Ci.rgb.mul(e.oneMinus()))}},ove=new Wy,cO=class extends JM{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(ove),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):PJ;eb.assign(e),h0.assign(il(oU(eb.sub(1).div(eb.add(1))).mul(pJ),pe(1)).mul(FF)),Em.assign(Xn(h0,Ci.rgb,ed)),Mm.assign(Xn(FF,1,ed))}setupLightingModel(){return new ZM(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):_J,n=this.clearcoatRoughnessNode?se(this.clearcoatRoughnessNode):xJ;PM.assign(t),M1.assign(WU({roughness:n}))}if(this.useSheen){let t=this.sheenNode?pe(this.sheenNode):bJ,n=this.sheenRoughnessNode?se(this.sheenRoughnessNode):wJ;Il.assign(t),t0.assign(n)}if(this.useIridescence){let t=this.iridescenceNode?se(this.iridescenceNode):TJ,n=this.iridescenceIORNode?se(this.iridescenceIORNode):EJ,r=this.iridescenceThicknessNode?se(this.iridescenceThicknessNode):MJ;WC.assign(t),IM.assign(n),NM.assign(r)}if(this.useAnisotropy){let t=(this.anisotropyNode?ft(this.anisotropyNode):SJ).toVar();e0.assign(t.length()),Wt(e0.equal(0),()=>{t.assign(ft(1,0))}).Else(()=>{t.divAssign(ft(e0)),e0.assign(e0.saturate())}),LM.assign(e0.pow2().mix(Eh.pow2(),1)),Jv.assign(Cm[0].mul(t.x).add(Cm[1].mul(t.y))),Im.assign(Cm[1].mul(t.x).sub(Cm[0].mul(t.y)))}if(this.useTransmission){let t=this.transmissionNode?se(this.transmissionNode):CJ,n=this.thicknessNode?se(this.thicknessNode):RJ,r=this.attenuationDistanceNode?se(this.attenuationDistanceNode):IJ,s=this.attenuationColorNode?pe(this.attenuationColorNode):NJ;if(FM.assign(t),W7.assign(n),j7.assign(r),X7.assign(s),this.useDispersion){let o=this.dispersionNode?se(this.dispersionNode):DJ;$7.assign(o)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?pe(this.clearcoatNormalNode):yJ}setup(e){e.context.setupClearcoatNormal=()=>Lm(this.setupClearcoatNormal(e),"NORMAL","vec3"),super.setup(e)}};var ave=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=Qf("gradientMap","texture").context({getUV:()=>r});return pe(s.r)}else{let s=r.fwidth().mul(.5);return Xn(pe(.7),pe(1),Bl(se(.7).sub(s.x),se(.7).add(s.x),r.x))}}),uO=class extends U1{direct({lightDirection:e,lightColor:t,reflectedLight:n},r){let s=ave({normal:tR,lightDirection:e,builder:r}).mul(t);n.directDiffuse.addAssign(s.mul(Vm({diffuseColor:Ci.rgb})))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(Vm({diffuseColor:Ci}))),r.indirectDiffuse.mulAssign(t)}},lve=new jy,hO=class extends mr{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(lve),this.setValues(e)}setupLightingModel(){return new uO}},fee=Ae(()=>{let i=pe(qi.z,0,qi.x.negate()).normalize(),e=qi.cross(i);return ft(i.dot(ai),e.dot(ai)).mul(.495).add(.5)}).once(["NORMAL","VERTEX"])().toVar("matcapUV"),cve=new $y,fO=class extends mr{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(cve),this.setValues(e)}setupVariants(e){let t=fee,n;e.material.matcap?n=Qf("matcap","texture").context({getUV:()=>t}):n=pe(Xn(.2,.8,t.y)),Ci.rgb.mulAssign(n.rgb)}},dO=class extends Ar{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 HC(s,o,o.negate(),s).mul(n)}else{let s=t,o=l0(Lt(1,0,0,0),Lt(0,iu(s.x),Ca(s.x).negate(),0),Lt(0,Ca(s.x),iu(s.x),0),Lt(0,0,0,1)),a=l0(Lt(iu(s.y),0,Ca(s.y),0),Lt(0,1,0,0),Lt(Ca(s.y).negate(),0,iu(s.y),0),Lt(0,0,0,1)),l=l0(Lt(iu(s.z),Ca(s.z).negate(),0,0),Lt(Ca(s.z),iu(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}}},Pb=Hn(dO).setParameterLength(2),uve=new Vu,eC=class extends mr{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(uve),this.setValues(e)}setupPositionView(e){let{object:t,camera:n}=e,{positionNode:r,rotationNode:s,scaleNode:o,sizeAttenuation:a}=this,l=Dh.mul(pe(r||0)),c=ft(Ac[0].xyz.length(),Ac[1].xyz.length());o!==null&&(c=c.mul(ft(o))),n.isPerspectiveCamera&&a===!1&&(c=c.mul(l.z.negate()));let u=Jo.xy;if(t.center&&t.center.isVector2===!0){let x=Qxe("center","vec2",t);u=u.sub(x.sub(.5))}u=u.mul(c);let f=se(s||vJ),p=Pb(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)}},hve=new tp,fve=new Oe,pO=class extends eC{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.sizeNode=null,this.isPointsNodeMaterial=!0,this.setDefaultValues(hve),this.setValues(e)}setupPositionView(){let{positionNode:e}=this;return Dh.mul(pe(e||dr)).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):LJ;c=c.mul(bU),n.isPerspectiveCamera&&a===!0&&(c=c.mul(dve.div(rs.z.negate()))),s&&s.isNode&&(c=c.mul(ft(s)));let u=Jo.xy;if(r&&r.isNode){let f=se(r);u=Pb(u,f)}return u=u.mul(c),u=u.div(wU.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)}},dve=Ht(1).onFrameUpdate(function({renderer:i}){let e=i.getSize(fve);this.value=.5*e.y}),AO=class extends U1{constructor(){super(),this.shadowNode=se(1).toVar("shadowMask")}direct({lightNode:e}){e.shadowNode!==null&&this.shadowNode.mulAssign(e.shadowNode)}finish({context:e}){Ci.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(Ci.rgb)}},pve=new Hy,mO=class extends mr{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.transparent=!0,this.setDefaultValues(pve),this.setValues(e)}setupLightingModel(){return new AO}},yet=rd("vec3"),vet=rd("vec3"),bet=rd("vec3");var gO=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()}},Oh=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])}},Ave=0,pK=new WeakMap;function mve(i){let e=Object.keys(i),t=pK.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)}pK.set(i.constructor,t)}for(let n=0;n<t.length;n++)e.push(t[n]);return e}var _O=class{constructor(e,t,n,r,s,o,a,l,c,u){this.id=Ave++,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 mve(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+",",q1(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()}},vh=[],xO=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);vh[0]=e,vh[1]=t,vh[2]=o,vh[3]=s;let u=c.get(vh);return u===void 0?(u=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,n,r,s,o,a,l),c.set(vh,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)),vh[0]=null,vh[1]=null,vh[2]=null,vh[3]=null,u}getChainMap(e="default"){return this.chainMaps[e]||(this.chainMaps[e]=new Oh)}dispose(){this.chainMaps={}}createRenderObject(e,t,n,r,s,o,a,l,c,u,f){let p=this.getChainMap(f),x=new _O(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}},Bh=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}},mc={VERTEX:1,INDEX:2,STORAGE:3,INDIRECT:4},s0=16,gve=211,_ve=212,yO=class extends Bh{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===mc.VERTEX?(this.backend.createAttribute(e),this.info.createAttribute(e)):t===mc.INDEX?(this.backend.createIndexAttribute(e),this.info.createIndexAttribute(e)):t===mc.STORAGE?(this.backend.createStorageAttribute(e),this.info.createStorageAttribute(e)):t===mc.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 dee(i){return i.index!==null?i.index.version:i.attributes.position.version}function pee(i){return i.index!==null?i.index.id:i.attributes.position.id}function AK(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?MA:EA)(e,1);return r.version=dee(i),r.__id=pee(i),r}var vO=class extends Bh{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,mc.STORAGE):this.updateAttribute(s,mc.VERTEX);let n=this.getIndex(e);n!==null&&this.updateAttribute(n,mc.INDEX);let r=e.geometry.indirect;r!==null&&this.updateAttribute(r,mc.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=AK(t),s.set(t,o)):(o.version!==dee(t)||o.__id!==pee(t))&&(this.attributes.delete(o),o=AK(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()}},bO=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===Ku||e.type===Vi?t=1:e.type===Zu||e.type===Ka||e.type===Fi?t=2:(e.type===Fr||e.type===Ai||e.type===Zi)&&(t=4);let n=4;e.format===N_||e.format===Gf||e.format===Qu||e.format===Ts||e.format===eo?n=1:e.format===Rs||e.format===Ju?n=2:(e.format===kf||e.format===E2)&&(n=3);let r=t*n;e.type===zA||e.type===VA?r=2:(e.type===Wo||e.type===qA||e.type===HA)&&(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}},tC=class{constructor(e){this.cacheKey=e,this.usedTimes=0}},wO=class extends tC{constructor(e,t,n){super(e),this.vertexProgram=t,this.fragmentProgram=n}},SO=class extends tC{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}},xve=0,ib=class{constructor(e,t,n,r=null,s=null){this.id=xve++,this.code=e,this.stage=t,this.name=n,this.transforms=r,this.attributes=s,this.usedTimes=0}},TO=class extends Bh{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 ib(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 ib(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 ib(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 SO(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 wO(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)}},EO=class extends Bh{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?mc.INDIRECT:mc.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?mc.INDIRECT:mc.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)}},yve=Object.freeze([]);function vve(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 mK(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 gK(i){return(i.transmission>0||i.transmissionNode&&i.transmissionNode.isNode)&&i.side===sr&&i.forceSinglePass===!1}var MO=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?(gK(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?(gK(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||vve),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||mK),this.transparent.length>1&&this.transparent.sort(t||mK),n&&(this.opaque.reverse(),this.transparentDoublePass.reverse(),this.transparent.reverse())}finish(){this.lightsNode.setLights(this.lighting.enabled?this.lightsArray:yve);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}},c1=[],CO=class{constructor(e){this.lighting=e,this.lists=new Oh}get(e,t){let n=this.lists;c1[0]=e,c1[1]=t;let r=n.get(c1);return r===void 0&&(r=new MO(this.lighting,e,t),n.set(c1,r)),c1[0]=null,c1[1]=null,r}dispose(){this.lists=new Oh}},bve=0,RO=class{constructor(){this.id=bve++,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 Aee(this)}};function Aee(i){let{textures:e,activeCubeFace:t,activeMipmapLevel:n}=i,r=[t,n];for(let s of e)r.push(s.id);return Mb(r)}var PO=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 RO,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={}}},wve=new ie,IO=class extends Bh{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 us,u.format=e.stencilBuffer?eo:Ts,u.type=e.stencilBuffer?Wo:Ai,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=Vi}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=wve){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)}}},Ab=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)}},nC=class extends cb{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 mee(i,e=null,t=null){if(e&&e.isNode){let n=e;e=()=>n}return new nC(new Map([[i,e]]),t)}Be("overrideNode",(i,e,t)=>mee(e,t,i));function gee(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 nC(t,e)}Be("overrideNodes",(i,e)=>gee(e,i));var iC=class extends di{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 kr),s="float"),s}getHash(){return String(this.id)}generate(){return this.name}},Sve=(i,e)=>new iC(i,e),NO=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 kr),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 T1(t);return this._currentCond=ta(e,n),this.addToStack(this._currentCond)}ElseIf(e,t){let n=new T1(t),r=ta(e,n);return this._currentCond.elseNode=r,this._currentCond=r,this}Else(e){return this._currentCond.elseNode=new T1(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 kr);let n=e[e.length-1],r=new T1(n),s=t[0];for(let a=1;a<t.length;a++)s=s.or(t[a]);let o=ta(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=k7(),r=e.buildStage;ab(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 ab(n),e.removeActiveStack(this),s}},EM=Hn(NO).setParameterLength(0,1);function Tve(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 LO=class extends $t{static get type(){return"StructTypeNode"}constructor(e,t=null){super("struct"),this.membersLayout=Tve(e),this.name=t,this.isStructTypeNode=!0}getLength(){let e=1,t=0;for(let n of this.membersLayout){let r=n.type,s=_xe(r),o=xxe(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)}},DO=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}},Eve=(i,e=null)=>{let t=new LO(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 DO(t,s)},t)},rC=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}},Mve=Hn(rC),sC=class{constructor(e=cs){this.blending=e,this.blendSrc=Xd,this.blendDst=$d,this.blendEquation=zs,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)}},Cve=new sC(Qr),Rve=new sC(a2);function _ee(i,e){for(let t=0;t<i.length;t++)if(i[t].name===e)return t;return-1}var FO=class extends rC{static get type(){return"MRTNode"}constructor(e){super(),this.outputNodes=e,this.blendModes={output:Rve},this.isMRTNode=!0}setBlendMode(e,t){return this.blendModes[e]=t,this}getBlendMode(e){return this.blendModes[e]||Cve}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=xee(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=_ee(s,o);if(a===-1)continue;let l=e.getOutputType(a);r[a]=t[o].convert(l)}return this.members=r,super.setup(e)}},xee=Hn(FO),qm=class extends Ar{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)} )`}},yee=lt(qm).setParameterLength(2),Pve=i=>new qm(i,"int","float"),vee=i=>new qm(i,"uint","float"),Ive=i=>new qm(i,"float","int"),Nve=i=>new qm(i,"float","uint"),ZE={},uu=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(yee(e,"uint")):t.assign(e)}_returnDataNode(e){switch(e){case"uint":return it;case"int":return fe;case"uvec2":return G7;case"uvec3":return Xm;case"uvec4":return H7;case"ivec2":return Tr;case"ivec3":return z7;case"ivec4":return q7}}_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(tU(o))),c=vee(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=ZE[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}}ZE[l]=u}let f=ZE[c];return f===void 0&&(f=this._createMainLayout(c,s,a,u),ZE[c]=f),Ae(()=>f(n))()}};uu.COUNT_TRAILING_ZEROS="countTrailingZeros";uu.COUNT_LEADING_ZEROS="countLeadingZeros";uu.COUNT_ONE_BITS="countOneBits";var Lve=lt(uu,uu.COUNT_TRAILING_ZEROS).setParameterLength(1),Dve=lt(uu,uu.COUNT_LEADING_ZEROS).setParameterLength(1),Fve=lt(uu,uu.COUNT_ONE_BITS).setParameterLength(1),Ove=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)}),OO=(i,e)=>pc(bn(4,i.mul(ii(1,i))),e),Bve=(i,e)=>i.lessThan(.5)?OO(i.mul(2),e).div(2):ii(1,OO(bn(ii(1,i),2),e).div(2)),Uve=(i,e,t)=>pc(Ol(pc(i,e),ps(pc(i,e),pc(ii(1,i),t))),1/e),kve=(i,e)=>Ca(UM.mul(e.mul(i).sub(1))).div(UM.mul(e.mul(i).sub(1))),mb=class extends Ar{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)})`}},Gve=lt(mb,"snorm").setParameterLength(1),zve=lt(mb,"unorm").setParameterLength(1),Vve=lt(mb,"float16").setParameterLength(1),gb=class extends Ar{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)})`}},qve=lt(gb,"snorm").setParameterLength(1),Hve=lt(gb,"unorm").setParameterLength(1),Wve=lt(gb,"float16").setParameterLength(1),Zf=Ae(([i])=>i.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),jve=Ae(([i])=>pe(Zf(i.z.add(Zf(i.y.mul(1)))),Zf(i.z.add(Zf(i.x.mul(1)))),Zf(i.y.add(Zf(i.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),Xve=Ae(([i,e,t])=>{let n=pe(i).toVar(),r=se(1.4).toVar(),s=se(0).toVar(),o=pe(n).toVar();return Ri({start:se(0),end:se(3),type:"float",condition:"<="},()=>{let a=pe(jve(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(Zf(n.z.add(Zf(n.x.add(Zf(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"}]}),BO=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)}},$ve=Hn(BO),Po=i=>(...e)=>$ve(i,...e),j1=Ht(0).setGroup(Kt).onRenderUpdate(i=>i.time),Yve=Ht(0).setGroup(Kt).onRenderUpdate(i=>i.deltaTime),bee=Ht(0,"uint").setGroup(Kt).onRenderUpdate(i=>i.frameId),Kve=(i=j1)=>i.add(.75).mul(Math.PI*2).sin().mul(.5).add(.5),Zve=(i=j1)=>i.fract().round(),Qve=(i=j1)=>i.add(.5).fract().mul(2).sub(1).abs(),Jve=(i=j1)=>i.fract();function ebe(i,e=null){return sd(e,{getUV:typeof i=="function"?i:()=>i})}var tbe=Ae(([i,e,t=ft(.5)])=>Pb(i.sub(t),e).add(t)),nbe=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))}),ibe=Ae(({position:i=null,horizontal:e=!0,vertical:t=!1})=>{let n;i!==null?(n=Ac.toVar(),n[3][0]=i.x,n[3][1]=i.y,n[3][2]=i.z):n=Ac;let r=g0.mul(n);return L1(e)&&(r[0][0]=Ac[0].length(),r[0][1]=0,r[0][2]=0),L1(t)&&(r[1][0]=0,r[1][1]=Ac[1].length(),r[1][2]=0),r[2][0]=0,r[2][1]=0,r[2][2]=1,Pa.mul(r).mul(dr)}),rbe=Ae(([i=null])=>{let e=XM();return XM(zU(i)).sub(e).lessThan(0).select(su,i)}),sbe=Ae(([i,e=Pi(),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)}),wee=Ae(([i,e=null,t=null,n=se(1),r=dr,s=ra])=>{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=li(u,a).mul(o.x),v=li(f,l).mul(o.y),w=li(p,c).mul(o.z);return ps(x,v,w)}),obe=(...i)=>wee(...i),u1=new ha,_m=new ie,h1=new ie,C8=new ie,Ov=new on,QE=new ie(0,0,-1),bh=new gn,Bv=new ie,JE=new ie,Uv=new gn,eM=new Oe,oC=new da,abe=su.flipX();oC.depthTexture=new us(1,1);var tM=!1,UO=class i extends xc{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||oC.texture,abe),this._reflectorBaseNode=e.reflector||new kO(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:oC.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()}},kO=class extends $t{static get type(){return"ReflectorBaseNode"}constructor(e,t={}){super();let{target:n=new Ki,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&&(Qn('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(eM),e.setSize(Math.round(eM.width*n),Math.round(eM.height*n))}setup(e){return this._updateResolution(oC,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 da(0,0,{type:Fi,samples:this.samples}),this.generateMipmaps===!0&&(t.texture.minFilter=bL,t.texture.generateMipmaps=!0),this.depth===!0&&(t.depthTexture=new us),this.renderTargets.set(e,t)),t}updateBefore(e){if(this.bounces===!1&&tM)return!1;tM=!0;let{scene:t,camera:n,renderer:r,material:s}=e,{target:o}=this,a=this.getVirtualCamera(n),l=this.getRenderTarget(a);r.getDrawingBufferSize(eM),this._updateResolution(l,r),h1.setFromMatrixPosition(o.matrixWorld),C8.setFromMatrixPosition(n.matrixWorld),Ov.extractRotation(o.matrixWorld),_m.set(0,0,1),_m.applyMatrix4(Ov),Bv.subVectors(h1,C8);let c=Bv.dot(_m)>0,u=!1;if(c===!0&&this.forceUpdate===!1){if(this.hasOutput===!1){tM=!1;return}u=!0}Bv.reflect(_m).negate(),Bv.add(h1),Ov.extractRotation(n.matrixWorld),QE.set(0,0,-1),QE.applyMatrix4(Ov),QE.add(C8),JE.subVectors(h1,QE),JE.reflect(_m).negate(),JE.add(h1),a.coordinateSystem=n.coordinateSystem,a.position.copy(Bv),a.up.set(0,1,0),a.up.applyMatrix4(Ov),a.up.reflect(_m),a.lookAt(JE),a.near=n.near,a.far=n.far,a.updateMatrixWorld(),a.projectionMatrix.copy(n.projectionMatrix),u1.setFromNormalAndCoplanarPoint(_m,h1),u1.applyMatrix4(a.matrixWorldInverse),bh.set(u1.normal.x,u1.normal.y,u1.normal.z,u1.constant);let f=a.projectionMatrix;Uv.x=(Math.sign(bh.x)+f.elements[8])/f.elements[0],Uv.y=(Math.sign(bh.y)+f.elements[9])/f.elements[5],Uv.z=-1,Uv.w=(1+f.elements[10])/f.elements[14],bh.multiplyScalar(1/bh.dot(Uv));let p=0;f.elements[2]=bh.x,f.elements[6]=bh.y,f.elements[10]=r.coordinateSystem===Xa?bh.z-p:bh.z+1-p,f.elements[14]=bh.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,tM=!1,this.forceUpdate=!1}get resolution(){return Qn('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale}set resolution(e){Qn('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale=e}},lbe=i=>new UO(i),R8=new jc(-1,1,1,-1,0,1),GO=class extends qn{constructor(e=!1){super();let t=e===!1?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new Rn([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Rn(t,2))}},cbe=new GO,_b=class extends Gn{constructor(e=null){super(cbe,e),this.camera=R8,this.isQuadMesh=!0}async renderAsync(e){Qn('QuadMesh: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await e.init(),e.render(this,R8)}render(e){e.render(this,R8)}},ube=new Oe,zO=class extends xc{static get type(){return"RTTNode"}constructor(e,t=null,n=null,r={type:Fi}){let s=new da(t,n,r);super(s.texture,Pi()),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 _b(new mr),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(ube),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 xc(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}},See=(i,...e)=>new zO(Vt(i),...e),hbe=(i,...e)=>i.isSampleNode||i.isTextureNode?i:i.isPassNode?i.getTextureNode():See(i,...e),S1=Ae(([i,e,t],n)=>{let r;n.renderer.coordinateSystem===Xa?(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)}),fbe=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())}),dbe=Ae(([i,e,t])=>{let n=km(is(e)),r=Tr(i.mul(n)).toVar(),s=is(e,r).toVar(),o=is(e,r.sub(Tr(2,0))).toVar(),a=is(e,r.sub(Tr(1,0))).toVar(),l=is(e,r.add(Tr(1,0))).toVar(),c=is(e,r.add(Tr(2,0))).toVar(),u=is(e,r.add(Tr(0,2))).toVar(),f=is(e,r.add(Tr(0,1))).toVar(),p=is(e,r.sub(Tr(0,1))).toVar(),x=is(e,r.sub(Tr(0,2))).toVar(),v=er(ii(se(2).mul(a).sub(o),s)).toVar(),w=er(ii(se(2).mul(l).sub(c),s)).toVar(),S=er(ii(se(2).mul(f).sub(u),s)).toVar(),T=er(ii(se(2).mul(p).sub(x),s)).toVar(),R=S1(i,s,t).toVar(),P=v.lessThan(w).select(R.sub(S1(i.sub(ft(se(1).div(n.x),0)),a,t)),R.negate().add(S1(i.add(ft(se(1).div(n.x),0)),l,t))),C=S.lessThan(T).select(R.sub(S1(i.add(ft(0,se(1).div(n.y))),f,t)),R.negate().add(S1(i.sub(ft(0,se(1).div(n.y))),p,t)));return na(nd(P,C))}),YU=Ae(([i])=>au(se(52.9829189).mul(au(_c(i,ft(.06711056,.00583715)))))).setLayout({name:"interleavedGradientNoise",type:"float",inputs:[{name:"position",type:"vec2"}]}),ru=Ae(([i,e,t])=>{let n=se(2.399963229728653),r=Ia(se(i).add(.5).div(se(e))),s=se(i).mul(n).add(t);return ft(iu(s),Ca(s)).mul(r)}).setLayout({name:"vogelDiskSample",type:"vec2",inputs:[{name:"sampleIndex",type:"int"},{name:"samplesCount",type:"int"},{name:"phi",type:"float"}]}),VO=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(Pi())}sample(e){return this.callback(e)}},pbe=(i,e=null)=>new VO(i,Vt(e)),Hm=class extends yl{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageInstancedBufferAttribute=!0}},qO=class extends Di{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageBufferAttribute=!0}},Abe=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=MM("float")):(t=JK(e),n=MM(e));let r=new qO(i,t,n);return c0(r,e,i)},mbe=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=MM("float")):(t=JK(e),n=MM(e));let r=new Hm(i,t,n);return c0(r,e,r.count)},HO=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 )"}},gbe=xt(HO),P8=new on,Tee=Ht(0).setGroup(Kt).onRenderUpdate(({scene:i})=>i.backgroundBlurriness),WO=Ht(1).setGroup(Kt).onRenderUpdate(({scene:i})=>i.backgroundIntensity),Eee=Ht(new on).setGroup(Kt).onRenderUpdate(({scene:i})=>{let e=i.background;return e!==null&&e.isTexture&&e.mapping!==S2||i.backgroundNode&&i.backgroundNode.isNode?P8.makeRotationFromEuler(i.backgroundRotation).transpose():P8.identity(),P8}),aC=class extends xc{static get type(){return"StorageTextureNode"}constructor(e,t,n=null){super(e,t),this.storeNode=n,this.mipLevel=0,this.isStorageTextureNode=!0,this.access=Co.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(Co.READ_WRITE)}toReadOnly(){return this.setAccess(Co.READ_ONLY)}toWriteOnly(){return this.setAccess(Co.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}},Mee=Hn(aC).setParameterLength(1,3),_be=(i,e,t)=>{let n;return i.isStorageTextureNode===!0?n=i.store(e,t):(n=Mee(i,e,t),t!==null&&n.toStack()),n},jO=class extends aC{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")}},xbe=Hn(jO).setParameterLength(1,3),ybe=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 xc{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 ybe({texture:this,uv:e})}},KU=Hn(XO).setParameterLength(1,3),vbe=(...i)=>KU(...i).setSampler(!1),bbe=(i,e,t)=>KU(i,e).level(t),$O=class extends O1{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}},wbe=(i,e,t)=>new $O(i,e,t),_K=new WeakMap,YO=class extends Ar{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=xK(n);this.previousModelWorldMatrix.value.copy(r);let s=Cee(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}){xK(e).copy(e.matrixWorld)}setup(){let e=this.projectionMatrix===null?Pa:Ht(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),n=e.mul(Dh).mul(dr),r=this.previousProjectionMatrix.mul(t).mul(zm),s=n.xy.div(n.w),o=r.xy.div(r.w);return ii(s,o)}};function Cee(i){let e=_K.get(i);return e===void 0&&(e={},_K.set(i,e)),e}function xK(i,e=0){let t=Cee(i),n=t[e];return n===void 0&&(t[e]=n=new on,t[e].copy(i.matrixWorld)),n}var Sbe=xt(YO),Tbe=Ae(([i,e])=>il(1,i.oneMinus().div(e)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),Ebe=Ae(([i,e])=>il(i.div(e.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),Mbe=Ae(([i,e])=>i.oneMinus().mul(e.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),Cbe=Ae(([i,e])=>Xn(i.mul(2).mul(e),i.oneMinus().mul(2).mul(e.oneMinus()).oneMinus(),Um(.5,i))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),Rbe=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"}]}),Pbe=Ae(([i])=>ZU(i.rgb)),Ibe=Ae(([i,e=se(1)])=>e.mix(ZU(i.rgb),i.rgb).max(0)),Nbe=Ae(([i,e=se(0)])=>{let t=ps(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 Xn(i.rgb,n,r).max(0)}),Lbe=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(_c(t,i.rgb).mul(n.oneMinus()))))).max(0)}),ZU=(i,e=pe(sn.getLuminanceCoefficients(new ie)))=>_c(i,e),Dbe=Ae(([i,e=pe(1),t=pe(0),n=pe(1),r=se(1),s=pe(sn.getLuminanceCoefficients(new ie,Yd))])=>{let o=i.rgb.dot(pe(s)),a=Er(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)}),Fbe=Ae(([i,e])=>i.mul(e).floor().div(e)),nM=null,KO=class extends B1{static get type(){return"ViewportSharedTextureNode"}constructor(e=su,t=null){nM===null&&(nM=new PA),super(e,t,nM)}getTextureForReference(){return nM}updateReference(){return this}},Obe=Hn(KO).setParameterLength(0,2),iM=new Oe,lC=class extends xc{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)}},cC=class extends lC{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}},Uh=class i extends Ar{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 da(this._width,this._height,{type:Fi,...r});s.texture.name="output";let o=null;(this.scope===i.DEPTH||r.depthBuffer!==!1)&&(o=new us,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 cC(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 cC(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=sR(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=Dm(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=Zi),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),iM.set(s.width,s.height)):(r=this.camera,t.getDrawingBufferSize(iM)),this.setSize(iM.width,iM.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:sd({...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()}};Uh.COLOR="color";Uh.DEPTH="depth";var Bbe=(i,e,t)=>new Uh(Uh.COLOR,i,e,t),Ube=(i,e)=>new lC(i,e),kbe=(i,e,t)=>new Uh(Uh.DEPTH,i,e,t),ZO=class extends Uh{static get type(){return"ToonOutlinePassNode"}constructor(e,t,n,r,s){super(Uh.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 mr;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=hi;let t=ra.negate(),n=Pa.mul(Dh),r=se(1),s=n.mul(Lt(dr,1)),o=n.mul(Lt(dr.add(t),1)),a=na(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}},Gbe=(i,e,t=new Ut(0,0,0),n=.003,r=1)=>new ZO(i,e,Vt(t),Vt(n),Vt(r)),Ree=Ae(([i,e])=>i.mul(e).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Pee=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"}]}),Iee=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"}]}),zbe=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)}),Nee=Ae(([i,e])=>{let t=so(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),n=so(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return i=i.mul(e).div(.6),i=t.mul(i),i=zbe(i),i=n.mul(i),i.clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Vbe=so(pe(1.6605,-.1246,-.0182),pe(-.5876,1.1329,-.1006),pe(-.0728,-.0083,1.1187)),qbe=so(pe(.6274,.0691,.0164),pe(.3293,.9195,.088),pe(.0433,.0113,.8956)),Hbe=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))))}),Lee=Ae(([i,e])=>{let t=pe(i).toVar(),n=so(pe(.856627153315983,.137318972929847,.11189821299995),pe(.0951212405381588,.761241990602591,.0767994186031903),pe(.0482516061458583,.101439036467562,.811302368396859)),r=so(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(qbe.mul(t)),t.assign(n.mul(t)),t.assign(Er(t,1e-10)),t.assign(Ch(t)),t.assign(t.sub(s).div(o.sub(s))),t.assign(lu(t,0,1)),t.assign(Hbe(t)),t.assign(r.mul(t)),t.assign(pc(Er(pe(0),t),pe(2.2))),t.assign(Vbe.mul(t)),t.assign(lu(t,0,1)),t}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Dee=Ae(([i,e])=>{let t=se(.76),n=se(.15);i=i.mul(e);let r=il(i.r,il(i.g,i.b)),s=ta(r.lessThan(.08),r.sub(bn(6.25,r.mul(r))),.04);i.subAssign(s);let o=Er(i.r,Er(i.g,i.b));Wt(o.lessThan(t),()=>i);let a=ii(1,t),l=ii(1,a.mul(a).div(o.add(a.sub(t))));i.mulAssign(l.div(o));let c=ii(1,Ol(1,n.mul(o.sub(l)).add(1)));return Xn(i,pe(l),c)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Ji=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}},uR=Hn(Ji).setParameterLength(1,3),Wbe=(i,e)=>uR(i,e,"js"),jbe=(i,e)=>uR(i,e,"wgsl"),Xbe=(i,e)=>uR(i,e,"glsl"),uC=class extends Ji{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)}},Fee=(i,e=[],t="")=>{let n=new uC(i,e,t);return U7((...s)=>n.call(...s),n)},$be=(i,e)=>Fee(i,e,"glsl"),Ybe=(i,e)=>Fee(i,e,"wgsl");function QU(i){let e,t=i.context.getViewZ;return t!==void 0&&(e=t(this)),(e||rs.z).negate()}var Oee=Ae(([i,e],t)=>{let n=QU(t);return Bl(i,e,n)}),Bee=Ae(([i],e)=>{let t=QU(e);return i.mul(i,t,t).negate().exp().oneMinus()}),Kbe=Ae(([i,e],t)=>{let n=QU(t),s=e.sub(Ih.y).max(0).toConst().mul(n).toConst();return i.mul(i,s,s).negate().exp().oneMinus()}),QO=Ae(([i,e])=>Lt(e.toFloat().mix(C1.rgb,i.toVec3()),C1.a)),xm=null,ym=null,JO=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(o0(t.value)),s=e.getTypeLength(o0(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 VM('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(o0(o)),c=e.getTypeLength(o0(a));xm=xm||new gn,ym=ym||new gn,xm.setScalar(0),ym.setScalar(0),l===1?xm.setScalar(o):o.isColor?xm.set(o.r,o.g,o.b,1):xm.set(o.x,o.y,o.z||0,o.w||0),c===1?ym.setScalar(a):a.isColor?ym.set(a.r,a.g,a.b,1):ym.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=xm.getComponent(S),R=ym.getComponent(S);p[w]=Yc.lerp(T,R,Math.random())}let x=this.getNodeType(e);if(t.count*4*4<=e.getUniformBufferLimit())n=H1(p,"vec4",t.count).element(ou).convert(x);else{let w=new yl(p,4);e.geometry.setAttribute("__range"+this.id,w),n=eR(w).convert(x)}}else n=se(0);return n}},Zbe=Hn(JO).setParameterLength(2),eB=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}},Ib=(i,e)=>new eB(i,e),Qbe=Ib("numWorkgroups","uvec3"),Jbe=Ib("workgroupId","uvec3"),ewe=Ib("globalId","uvec3"),twe=Ib("localId","uvec3"),nwe=Ib("subgroupSize","uint"),tB=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)}},JU=Hn(tB),iwe=()=>JU("workgroup").toStack(),rwe=()=>JU("storage").toStack(),swe=()=>JU("texture").toStack(),nB=class extends td{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}},iB=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 kr),this.setName(e)}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return new nB(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)}},owe=(i,e)=>new iB("Workgroup",i,e),ms=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=Ll(u,s).toConst()),t.constNode.build(e)}};ms.ATOMIC_LOAD="atomicLoad";ms.ATOMIC_STORE="atomicStore";ms.ATOMIC_ADD="atomicAdd";ms.ATOMIC_SUB="atomicSub";ms.ATOMIC_MAX="atomicMax";ms.ATOMIC_MIN="atomicMin";ms.ATOMIC_AND="atomicAnd";ms.ATOMIC_OR="atomicOr";ms.ATOMIC_XOR="atomicXor";var awe=Hn(ms),Gh=(i,e,t)=>awe(i,e,t).toStack(),lwe=i=>Gh(ms.ATOMIC_LOAD,i,null),cwe=(i,e)=>Gh(ms.ATOMIC_STORE,i,e),uwe=(i,e)=>Gh(ms.ATOMIC_ADD,i,e),hwe=(i,e)=>Gh(ms.ATOMIC_SUB,i,e),fwe=(i,e)=>Gh(ms.ATOMIC_MAX,i,e),dwe=(i,e)=>Gh(ms.ATOMIC_MIN,i,e),pwe=(i,e)=>Gh(ms.ATOMIC_AND,i,e),Awe=(i,e)=>Gh(ms.ATOMIC_OR,i,e),mwe=(i,e)=>Gh(ms.ATOMIC_XOR,i,e),Ft=class i extends Ar{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 gwe=lt(Ft,Ft.SUBGROUP_ELECT).setParameterLength(0),_we=lt(Ft,Ft.SUBGROUP_BALLOT).setParameterLength(1),xwe=lt(Ft,Ft.SUBGROUP_ADD).setParameterLength(1),ywe=lt(Ft,Ft.SUBGROUP_INCLUSIVE_ADD).setParameterLength(1),vwe=lt(Ft,Ft.SUBGROUP_EXCLUSIVE_AND).setParameterLength(1),bwe=lt(Ft,Ft.SUBGROUP_MUL).setParameterLength(1),wwe=lt(Ft,Ft.SUBGROUP_INCLUSIVE_MUL).setParameterLength(1),Swe=lt(Ft,Ft.SUBGROUP_EXCLUSIVE_MUL).setParameterLength(1),Twe=lt(Ft,Ft.SUBGROUP_AND).setParameterLength(1),Ewe=lt(Ft,Ft.SUBGROUP_OR).setParameterLength(1),Mwe=lt(Ft,Ft.SUBGROUP_XOR).setParameterLength(1),Cwe=lt(Ft,Ft.SUBGROUP_MIN).setParameterLength(1),Rwe=lt(Ft,Ft.SUBGROUP_MAX).setParameterLength(1),Pwe=lt(Ft,Ft.SUBGROUP_ALL).setParameterLength(0),Iwe=lt(Ft,Ft.SUBGROUP_ANY).setParameterLength(0),Nwe=lt(Ft,Ft.SUBGROUP_BROADCAST_FIRST).setParameterLength(2),Lwe=lt(Ft,Ft.QUAD_SWAP_X).setParameterLength(1),Dwe=lt(Ft,Ft.QUAD_SWAP_Y).setParameterLength(1),Fwe=lt(Ft,Ft.QUAD_SWAP_DIAGONAL).setParameterLength(1),Owe=lt(Ft,Ft.SUBGROUP_BROADCAST).setParameterLength(2),Bwe=lt(Ft,Ft.SUBGROUP_SHUFFLE).setParameterLength(2),Uwe=lt(Ft,Ft.SUBGROUP_SHUFFLE_XOR).setParameterLength(2),kwe=lt(Ft,Ft.SUBGROUP_SHUFFLE_UP).setParameterLength(2),Gwe=lt(Ft,Ft.SUBGROUP_SHUFFLE_DOWN).setParameterLength(2),zwe=lt(Ft,Ft.QUAD_BROADCAST).setParameterLength(1),rM;function hR(i){rM=rM||new WeakMap;let e=rM.get(i);return e===void 0&&rM.set(i,e={}),e}function fR(i){let e=hR(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 Uee(i,e=Ih){let t=fR(i).mul(e);return t.xyz.div(t.w)}function ek(i){let e=hR(i);return e.position||(e.position=Ht(new ie).setGroup(Kt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.matrixWorld)))}function kee(i){let e=hR(i);return e.targetPosition||(e.targetPosition=Ht(new ie).setGroup(Kt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.target.matrixWorld)))}function tk(i){let e=hR(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 nk=i=>g0.transformDirection(ek(i).sub(kee(i))),Vwe=rd("vec3","totalDiffuse"),qwe=rd("vec3","totalSpecular"),Hwe=rd("vec3","outgoingLight"),Wwe=i=>i.sort((e,t)=>e.id-t.id),jwe=(i,e)=>{for(let t of e)if(t.isAnalyticLightNode&&t.light.id===i)return t;return null},I8=new WeakMap,kv=[],xb=class extends $t{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=Vwe,this.totalSpecularNode=qwe,this.outgoingLightNode=Hwe,this._lights=[],this.global=!0}customCacheKey(){let e=this._lights;for(let n=0;n<e.length;n++){let r=e[n];if(kv.push(r.id),kv.push(r.castShadow?1:0),r.isSpotLight===!0){let s=r.map!==null?r.map.id:-1,o=r.colorNode?r.colorNode.getCacheKey():-1;kv.push(s,o)}}let t=Mb(kv);return kv.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=Wwe([...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=jwe(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}},Xwe=(i=[])=>new xb().setLights(i),rB=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}){ik.assign(t.receivedShadowPositionNode||e.shadowPositionWorld||Ih)}},ik=rd("vec3","shadowPositionWorld");function $we(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 Ywe(i,e){return e=$we(i,e),i.setMRT(null),i.setRenderObjectFunction(null),i.setClearColor(0,1),i.autoClear=!0,e}function Kwe(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 Zwe(i,e={}){return e.background=i.background,e.backgroundNode=i.backgroundNode,e.overrideMaterial=i.overrideMaterial,e}function Qwe(i,e){return e=Zwe(i,e),i.background=null,i.backgroundNode=null,i.overrideMaterial=null,e}function Jwe(i,e){i.background=e.background,i.backgroundNode=e.backgroundNode,i.overrideMaterial=e.overrideMaterial}function eSe(i,e,t){return t=Ywe(i,t),t=Qwe(e,t),t}function tSe(i,e,t){Kwe(i,t),Jwe(e,t)}var hC=new WeakMap,Gee=Ae(({depthTexture:i,shadowCoord:e,depthLayer:t})=>{let n=li(i,e.xy).setName("t_basic");return i.isArrayTexture&&(n=n.depth(t)),n.compare(e.z)}),zee=Ae(({depthTexture:i,shadowCoord:e,shadow:t,depthLayer:n})=>{let r=(u,f)=>{let p=li(i,u);return i.isArrayTexture&&(p=p.depth(n)),p.compare(f)},s=ir("mapSize","vec2",t).setGroup(Kt),o=ir("radius","float",t).setGroup(Kt),a=ft(1).div(s),l=o.mul(a.x),c=YU(Ym.xy).mul(6.28318530718);return ps(r(e.xy.add(ru(0,5,c).mul(l)),e.z),r(e.xy.add(ru(1,5,c).mul(l)),e.z),r(e.xy.add(ru(2,5,c).mul(l)),e.z),r(e.xy.add(ru(3,5,c).mul(l)),e.z),r(e.xy.add(ru(4,5,c).mul(l)),e.z)).mul(1/5)}),Vee=Ae(({depthTexture:i,shadowCoord:e,shadow:t,depthLayer:n})=>{let r=ir("mapSize","vec2",t).setGroup(Kt),s=ft(1).div(r),o=e.xy,a=au(o.mul(r).add(.5)).toConst();o.subAssign(a.sub(.5).mul(s));let l=x=>{let v=li(i,o).offset(x).gather();return i.isArrayTexture&&(v=v.depth(n)),v.compare(e.z)},c=l(Tr(-1,1)).toConst(),u=l(Tr(1,1)).toConst(),f=l(Tr(-1,-1)).toConst(),p=l(Tr(1,-1)).toConst();return ps(Xn(c.x,u.y,a.x).add(c.y).add(u.x).mul(a.y),Xn(c.w,u.z,a.x).add(c.z).add(u.w),Xn(f.x,p.y,a.x).add(f.y).add(p.x),Xn(f.w,p.z,a.x).add(f.z).add(p.w).mul(a.y.oneMinus())).mul(1/9)}),qee=Ae(({depthTexture:i,shadowCoord:e,depthLayer:t},n)=>{let r=li(i).sample(e.xy);i.isArrayTexture&&(r=r.depth(t)),r=r.rg;let s=r.x,o=Er(1e-7,r.y.mul(r.y)),a=n.renderer.reversedDepthBuffer?Um(s,e.z):Um(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=lu(ii(u,.3).div(.65)),l.assign(Er(a,u))}),l}),Hee=i=>{let e=hC.get(i);return e===void 0&&(e=new mr,e.colorNode=Lt(0,0,0,1),e.isShadowPassMaterial=!0,e.name="ShadowMaterial",e.blending=Qr,e.fog=!1,hC.set(i,e)),e},Wee=i=>{let e=hC.get(i);e!==void 0&&(e.dispose(),hC.delete(i))},yK=new Oh,f1=[],jee=(i,e,t,n)=>{f1[0]=i,f1[1]=e;let r=yK.get(f1);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===tc)&&(n&&(eZ(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,yK.set(f1,r)),f1[0]=null,f1[1]=null,r},nSe=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));Ri({start:fe(0),end:fe(i),type:"int",condition:"<"},({i:u})=>{let f=l.add(se(u).mul(a)),p=n.sample(ps(Ym.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=Ia(o.sub(s.mul(s)).max(0));return ft(s,c)}),iSe=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));Ri({start:fe(0),end:fe(i),type:"int",condition:"<"},({i:u})=>{let f=l.add(se(u).mul(a)),p=n.sample(ps(Ym.xy,ft(f,0).mul(e)).div(t));n.value.isArrayTexture&&(p=p.depth(r)),s.addAssign(p.x),o.addAssign(ps(p.y.mul(p.y),p.x.mul(p.x)))}),s.divAssign(i),o.divAssign(i);let c=Ia(o.sub(s.mul(s)).max(0));return ft(s,c)}),rSe=[Gee,zee,Vee,qee],N8,sM=new _b,fC=class extends rB{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||ir("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=ir("near","float",n.camera).setGroup(Kt),u=ir("far","float",n.camera).setGroup(Kt);a=oR(l.negate(),c,u)}return o=pe(o.x,o.y.oneMinus(),r.reversedDepthBuffer?a.sub(s):a.add(s)),o}getShadowFilterFn(e){return rSe[e]}setupRenderTarget(e,t){let n=new us(e.mapSize.width,e.mapSize.height);n.name="ShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?$c:oh;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(zf.TEXTURE_COMPARE);if((l===ap||l===s3)&&c?(o.minFilter=bi,o.magFilter=bi):(o.minFilter=yi,o.magFilter=yi),s.camera.coordinateSystem=n.coordinateSystem,s.camera.updateProjectionMatrix(),l===tc&&s.isPointLightShadow!==!0){o.compareFunction=null,a.depth>1?(a._vsmShadowMapVertical||(a._vsmShadowMapVertical=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:Rs,type:Fi,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:Rs,type:Fi,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:Rs,type:Fi,depthBuffer:!1}),this.vsmShadowMapHorizontal=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:Rs,type:Fi,depthBuffer:!1}));let D=li(o);o.isArrayTexture&&(D=D.depth(this.depthLayer));let F=li(this.vsmShadowMapVertical.texture);o.isArrayTexture&&(F=F.depth(this.depthLayer));let N=ir("blurSamples","float",s).setGroup(Kt),B=ir("radius","float",s).setGroup(Kt),z=ir("mapSize","vec2",s).setGroup(Kt),V=this.vsmMaterialVertical||(this.vsmMaterialVertical=new mr);V.fragmentNode=nSe({samples:N,radius:B,size:z,shadowPass:D,depthLayer:this.depthLayer}).context(e.getSharedContext()),V.name="VSMVertical",V=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new mr),V.fragmentNode=iSe({samples:N,radius:B,size:z,shadowPass:F,depthLayer:this.depthLayer}).context(e.getSharedContext()),V.name="VSMHorizontal"}let u=ir("intensity","float",s).setGroup(Kt),f=ir("normalBias","float",s).setGroup(Kt),p=fR(r),x=_0.mul(f),v;!t.highPrecision||e.material.receivedShadowPositionNode||e.context.shadowPositionWorld?v=p.mul(ik.add(x)):v=Ht("mat4").onObjectUpdate(({object:F},N)=>N.value.multiplyMatrices(p.value,F.matrixWorld)).mul(dr).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===tc&&s.isPointLightShadow!==!0?this.vsmShadowMapHorizontal.texture:o,R=this.setupShadowFilter(e,{filterFn:S,shadowTexture:a.texture,depthTexture:T,shadowCoord:w,shadow:s,depthLayer:this.depthLayer}),P;t.shadowMap.transmitted===!0&&(a.texture.isCubeTexture?P=Ra(a.texture,w.xyz):(P=li(a.texture,w),o.isArrayTexture&&(P=P.depth(this.depthLayer))));let C;P?C=Xn(1,R.rgb.mix(P,1),u.mul(P.a)).toVar():C=Xn(1,R,u).toVar(),this.shadowMap=a,this.shadow.map=a;let L=`${this.light.type} Shadow [ ${this.light.name||"ID: "+this.light.id} ]`;return P&&C.toInspector(`${L} / Color`,()=>this.shadowMap.texture.isCubeTexture?Ra(this.shadowMap.texture,KF()):li(this.shadowMap.texture)),C.toInspector(`${L} / Depth`,()=>{let D=ir("near","float",this.shadow.camera),F=ir("far","float",this.shadow.camera),N;this.shadowMap.texture.isCubeTexture?N=Ra(this.shadowMap.depthTexture,KF()).r:N=li(this.shadowMap.depthTexture).r;let B;return this.shadow.camera.isPerspectiveCamera?B=sR(N,D,F):B=YJ(N,D,F),B=Dm(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;N8=eSe(s,o,N8),o.overrideMaterial=Hee(n),s.setRenderObjectFunction(jee(s,r,l,x)),s.setClearColor(0,0),s.setRenderTarget(t),this.renderShadow(e),s.setRenderObjectFunction(f),l===tc&&r.isPointLightShadow!==!0&&this.vsmPass(s),r.camera.layers.mask=u,tSe(s,o,N8)}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),sM.material=this.vsmMaterialVertical,sM.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),sM.material=this.vsmMaterialHorizontal,sM.render(e)}dispose(){this._reset(),super.dispose()}_reset(){this._currentShadowType=null,Wee(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))}},Xee=(i,e)=>new fC(i,e),sSe=new Ut,vK=new on,Gv=new ie,L8=new ie,oSe=[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)],aSe=[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)],lSe=[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)],cSe=[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)],$ee=Ae(({depthTexture:i,bd3D:e,dp:t})=>Ra(i,e).compare(t)),Yee=Ae(({depthTexture:i,bd3D:e,dp:t,shadow:n})=>{let r=ir("radius","float",n).setGroup(Kt),s=ir("mapSize","vec2",n).setGroup(Kt),o=r.div(s.x),a=er(e),l=na(nd(e,a.x.greaterThan(a.z).select(pe(0,1,0),pe(1,0,0)))),c=nd(e,l),u=YU(Ym.xy).mul(6.28318530718),f=ru(0,5,u),p=ru(1,5,u),x=ru(2,5,u),v=ru(3,5,u),w=ru(4,5,u);return Ra(i,e.add(l.mul(f.x).add(c.mul(f.y)).mul(o))).compare(t).add(Ra(i,e.add(l.mul(p.x).add(c.mul(p.y)).mul(o))).compare(t)).add(Ra(i,e.add(l.mul(x.x).add(c.mul(x.y)).mul(o))).compare(t)).add(Ra(i,e.add(l.mul(v.x).add(c.mul(v.y)).mul(o))).compare(t)).add(Ra(i,e.add(l.mul(w.x).add(c.mul(w.y)).mul(o))).compare(t)).mul(1/5)}),uSe=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=ir("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=KJ(a.negate(),l,c),p.subAssign(u)):r.renderer.logarithmicDepthBuffer?(p=oR(a.negate(),l,c),p.addAssign(u)):(p=VU(a.negate(),l,c),p.addAssign(u));let x=s.normalize();f.assign(i({depthTexture:e,bd3D:x,dp:p,shadow:n}))}),f}),sB=class extends fC{static get type(){return"PointShadowNode"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return e===yL?$ee:Yee}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:s}){return uSe({filterFn:t,depthTexture:n,shadowCoord:r,shadow:s})}setupRenderTarget(e,t){let n=new b_(e.mapSize.width);n.name="PointShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?$c:oh;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===Xa,u=c?oSe:lSe,f=c?aSe:cSe;n.setSize(t.mapSize.width,t.mapSize.width);let p=s.autoClear,x=s.getClearColor(sSe),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()),Gv.setFromMatrixPosition(r.matrixWorld),a.position.copy(Gv),L8.copy(a.position),L8.add(u[w]),a.up.copy(f[w]),a.lookAt(L8),a.updateMatrixWorld(),l.makeTranslation(-Gv.x,-Gv.y,-Gv.z),vK.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),t._frustum.setFromProjectionMatrix(vK,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)}},Kee=(i,e)=>new sB(i,e),id=class extends d0{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 tk(this.light).sub(e.context.positionView||rs)}setupDirect(){}setupDirectRectArea(){}setupShadowNode(){return Xee(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)}},rk=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)}),Zee=({color:i,lightVector:e,cutoffDistance:t,decayExponent:n})=>{let r=e.normalize(),s=e.length(),o=rk({lightDistance:s,cutoffDistance:t,decayExponent:n}),a=i.mul(o);return{lightDirection:r,lightColor:a}},oB=class extends id{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 Kee(this.light)}setupDirect(e){return Zee({color:this.colorNode,lightVector:this.getLightVector(e),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode})}},hSe=Ae(([i=Pi()])=>{let e=i.mul(2),t=e.x.floor(),n=e.y.floor();return t.add(n).mod(2).sign()}),fSe=Ae(([i=Pi()],{renderer:e,material:t})=>{let n=lU(i.mul(2).sub(1)),r;if(t.alphaToCoverage&&e.currentSamples>0){let s=se(n.fwidth()).toVar();r=Bl(s.oneMinus(),s.add(1),n).oneMinus()}else r=ta(n.greaterThan(1),0,1);return r}),rb=Ae(([i,e,t])=>{let n=se(t).toVar(),r=se(e).toVar(),s=Fl(i).toVar();return ta(s,r,n).uniformFlow()}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),dC=Ae(([i,e])=>{let t=Fl(e).toVar(),n=se(i).toVar();return ta(t,n.negate(),n).uniformFlow()}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),ds=Ae(([i])=>{let e=se(i).toVar();return fe(Rh(e))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),pr=Ae(([i,e])=>{let t=se(i).toVar();return e.assign(ds(t)),t.sub(se(e))}),dSe=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(ii(1,a)).toVar();return ii(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"}]}),pSe=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(ii(1,a)).toVar();return ii(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"}]}),Qee=Po([dSe,pSe]),ASe=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(),R=se(n).toVar(),P=se(t).toVar(),C=se(e).toVar(),L=se(i).toVar(),D=se(ii(1,x)).toVar(),F=se(ii(1,p)).toVar();return se(ii(1,f)).toVar().mul(F.mul(L.mul(D).add(C.mul(x))).add(p.mul(P.mul(D).add(R.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"}]}),mSe=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(),R=pe(n).toVar(),P=pe(t).toVar(),C=pe(e).toVar(),L=pe(i).toVar(),D=se(ii(1,x)).toVar(),F=se(ii(1,p)).toVar();return se(ii(1,f)).toVar().mul(F.mul(L.mul(D).add(C.mul(x))).add(p.mul(P.mul(D).add(R.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"}]}),Jee=Po([ASe,mSe]),gSe=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(rb(o.lessThan(it(4)),r,n)).toVar(),l=se(bn(2,rb(o.lessThan(it(4)),n,r))).toVar();return dC(a,Fl(o.bitAnd(it(1)))).add(dC(l,Fl(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"}]}),_Se=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(rb(l.lessThan(it(8)),o,s)).toVar(),u=se(rb(l.lessThan(it(4)),s,rb(l.equal(it(12)).or(l.equal(it(14))),o,r))).toVar();return dC(c,Fl(l.bitAnd(it(1)))).add(dC(u,Fl(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"}]}),ro=Po([gSe,_Se]),xSe=Ae(([i,e,t])=>{let n=se(t).toVar(),r=se(e).toVar(),s=Xm(i).toVar();return pe(ro(s.x,r,n),ro(s.y,r,n),ro(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"}]}),ySe=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=se(e).toVar(),a=Xm(i).toVar();return pe(ro(a.x,o,s,r),ro(a.y,o,s,r),ro(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"}]}),fc=Po([xSe,ySe]),vSe=Ae(([i])=>{let e=se(i).toVar();return bn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),bSe=Ae(([i])=>{let e=se(i).toVar();return bn(.982,e)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),wSe=Ae(([i])=>{let e=pe(i).toVar();return bn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),ete=Po([vSe,wSe]),SSe=Ae(([i])=>{let e=pe(i).toVar();return bn(.982,e)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),tte=Po([bSe,SSe]),Nl=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"}]}),nte=Ae(([i,e,t])=>{i.subAssign(t),i.bitXorAssign(Nl(t,fe(4))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(Nl(i,fe(6))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(Nl(e,fe(8))),e.addAssign(i),i.subAssign(t),i.bitXorAssign(Nl(t,fe(16))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(Nl(i,fe(19))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(Nl(e,fe(4))),e.addAssign(i)}),Nb=Ae(([i,e,t])=>{let n=it(t).toVar(),r=it(e).toVar(),s=it(i).toVar();return n.bitXorAssign(r),n.subAssign(Nl(r,fe(14))),s.bitXorAssign(n),s.subAssign(Nl(n,fe(11))),r.bitXorAssign(s),r.subAssign(Nl(s,fe(25))),n.bitXorAssign(r),n.subAssign(Nl(r,fe(16))),s.bitXorAssign(n),s.subAssign(Nl(n,fe(4))),r.bitXorAssign(s),r.subAssign(Nl(s,fe(14))),n.bitXorAssign(r),n.subAssign(Nl(r,fe(24))),n}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),ia=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"}]}),Nh=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"}]}),TSe=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 Nb(n.add(it(e)),n,n)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),ESe=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)),Nb(s,o,a)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),MSe=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)),Nb(a,l,c)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),CSe=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)),nte(c,u,f),c.addAssign(it(r)),Nb(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"}]}),RSe=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)),nte(f,p,x),f.addAssign(it(o)),p.addAssign(it(s)),Nb(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"}]}),Bi=Po([TSe,ESe,MSe,CSe,RSe]),PSe=Ae(([i,e])=>{let t=fe(e).toVar(),n=fe(i).toVar(),r=it(Bi(n,t)).toVar(),s=Xm().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"}]}),ISe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=fe(e).toVar(),s=fe(i).toVar(),o=it(Bi(s,r,n)).toVar(),a=Xm().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"}]}),dc=Po([PSe,ISe]),NSe=Ae(([i])=>{let e=ft(i).toVar(),t=fe().toVar(),n=fe().toVar(),r=se(pr(e.x,t)).toVar(),s=se(pr(e.y,n)).toVar(),o=se(Nh(r)).toVar(),a=se(Nh(s)).toVar(),l=se(Qee(ro(Bi(t,n),r,s),ro(Bi(t.add(fe(1)),n),r.sub(1),s),ro(Bi(t,n.add(fe(1))),r,s.sub(1)),ro(Bi(t.add(fe(1)),n.add(fe(1))),r.sub(1),s.sub(1)),o,a)).toVar();return ete(l)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),LSe=Ae(([i])=>{let e=pe(i).toVar(),t=fe().toVar(),n=fe().toVar(),r=fe().toVar(),s=se(pr(e.x,t)).toVar(),o=se(pr(e.y,n)).toVar(),a=se(pr(e.z,r)).toVar(),l=se(Nh(s)).toVar(),c=se(Nh(o)).toVar(),u=se(Nh(a)).toVar(),f=se(Jee(ro(Bi(t,n,r),s,o,a),ro(Bi(t.add(fe(1)),n,r),s.sub(1),o,a),ro(Bi(t,n.add(fe(1)),r),s,o.sub(1),a),ro(Bi(t.add(fe(1)),n.add(fe(1)),r),s.sub(1),o.sub(1),a),ro(Bi(t,n,r.add(fe(1))),s,o,a.sub(1)),ro(Bi(t.add(fe(1)),n,r.add(fe(1))),s.sub(1),o,a.sub(1)),ro(Bi(t,n.add(fe(1)),r.add(fe(1))),s,o.sub(1),a.sub(1)),ro(Bi(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 tte(f)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]}),sk=Po([NSe,LSe]),DSe=Ae(([i])=>{let e=ft(i).toVar(),t=fe().toVar(),n=fe().toVar(),r=se(pr(e.x,t)).toVar(),s=se(pr(e.y,n)).toVar(),o=se(Nh(r)).toVar(),a=se(Nh(s)).toVar(),l=pe(Qee(fc(dc(t,n),r,s),fc(dc(t.add(fe(1)),n),r.sub(1),s),fc(dc(t,n.add(fe(1))),r,s.sub(1)),fc(dc(t.add(fe(1)),n.add(fe(1))),r.sub(1),s.sub(1)),o,a)).toVar();return ete(l)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),FSe=Ae(([i])=>{let e=pe(i).toVar(),t=fe().toVar(),n=fe().toVar(),r=fe().toVar(),s=se(pr(e.x,t)).toVar(),o=se(pr(e.y,n)).toVar(),a=se(pr(e.z,r)).toVar(),l=se(Nh(s)).toVar(),c=se(Nh(o)).toVar(),u=se(Nh(a)).toVar(),f=pe(Jee(fc(dc(t,n,r),s,o,a),fc(dc(t.add(fe(1)),n,r),s.sub(1),o,a),fc(dc(t,n.add(fe(1)),r),s,o.sub(1),a),fc(dc(t.add(fe(1)),n.add(fe(1)),r),s.sub(1),o.sub(1),a),fc(dc(t,n,r.add(fe(1))),s,o,a.sub(1)),fc(dc(t.add(fe(1)),n,r.add(fe(1))),s.sub(1),o,a.sub(1)),fc(dc(t,n.add(fe(1)),r.add(fe(1))),s,o.sub(1),a.sub(1)),fc(dc(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 tte(f)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),Lb=Po([DSe,FSe]),OSe=Ae(([i])=>{let e=se(i).toVar(),t=fe(ds(e)).toVar();return ia(Bi(t))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),BSe=Ae(([i])=>{let e=ft(i).toVar(),t=fe(ds(e.x)).toVar(),n=fe(ds(e.y)).toVar();return ia(Bi(t,n))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),USe=Ae(([i])=>{let e=pe(i).toVar(),t=fe(ds(e.x)).toVar(),n=fe(ds(e.y)).toVar(),r=fe(ds(e.z)).toVar();return ia(Bi(t,n,r))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),kSe=Ae(([i])=>{let e=Lt(i).toVar(),t=fe(ds(e.x)).toVar(),n=fe(ds(e.y)).toVar(),r=fe(ds(e.z)).toVar(),s=fe(ds(e.w)).toVar();return ia(Bi(t,n,r,s))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]}),GSe=Po([OSe,BSe,USe,kSe]),zSe=Ae(([i])=>{let e=se(i).toVar(),t=fe(ds(e)).toVar();return pe(ia(Bi(t,fe(0))),ia(Bi(t,fe(1))),ia(Bi(t,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),VSe=Ae(([i])=>{let e=ft(i).toVar(),t=fe(ds(e.x)).toVar(),n=fe(ds(e.y)).toVar();return pe(ia(Bi(t,n,fe(0))),ia(Bi(t,n,fe(1))),ia(Bi(t,n,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),qSe=Ae(([i])=>{let e=pe(i).toVar(),t=fe(ds(e.x)).toVar(),n=fe(ds(e.y)).toVar(),r=fe(ds(e.z)).toVar();return pe(ia(Bi(t,n,r,fe(0))),ia(Bi(t,n,r,fe(1))),ia(Bi(t,n,r,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),HSe=Ae(([i])=>{let e=Lt(i).toVar(),t=fe(ds(e.x)).toVar(),n=fe(ds(e.y)).toVar(),r=fe(ds(e.z)).toVar(),s=fe(ds(e.w)).toVar();return pe(ia(Bi(t,n,r,s,fe(0))),ia(Bi(t,n,r,s,fe(1))),ia(Bi(t,n,r,s,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]}),dR=Po([zSe,VSe,qSe,HSe]),pC=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 Ri(o,()=>{l.addAssign(c.mul(sk(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"}]}),pR=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 Ri(o,()=>{l.addAssign(c.mul(Lb(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"}]}),WSe=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=fe(e).toVar(),a=pe(i).toVar();return ft(pC(a,o,s,r),pC(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"}]}),jSe=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=fe(e).toVar(),a=pe(i).toVar(),l=pe(pR(a,o,s,r)).toVar(),c=se(pC(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"}]}),XSe=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(dR(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)),()=>er(T.x).add(er(T.y))),Wt(a.equal(fe(3)),()=>Er(er(T.x),er(T.y))),_c(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"}]}),$Se=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(),R=pe(dR(pe(S.add(x),w.add(p),v.add(f)))).toVar();R.subAssign(.5),R.mulAssign(u),R.addAssign(.5);let P=pe(pe(se(S),se(w),se(v)).add(R)).toVar(),C=pe(P.sub(T)).toVar();return Wt(c.equal(fe(2)),()=>er(C.x).add(er(C.y)).add(er(C.z))),Wt(c.equal(fe(3)),()=>Er(er(C.x),er(C.y),er(C.z))),_c(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"}]}),X1=Po([XSe,$Se]),YSe=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(pr(s.x,o),pr(s.y,a)).toVar(),c=se(1e6).toVar();return Ri({start:-1,end:fe(1),name:"x",condition:"<="},({x:u})=>{Ri({start:-1,end:fe(1),name:"y",condition:"<="},({y:f})=>{let p=se(X1(l,u,f,o,a,r,n)).toVar();c.assign(il(c,p))})}),Wt(n.equal(fe(0)),()=>{c.assign(Ia(c))}),c}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),KSe=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(pr(s.x,o),pr(s.y,a)).toVar(),c=ft(1e6,1e6).toVar();return Ri({start:-1,end:fe(1),name:"x",condition:"<="},({x:u})=>{Ri({start:-1,end:fe(1),name:"y",condition:"<="},({y:f})=>{let p=se(X1(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(Ia(c))}),c}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),ZSe=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(pr(s.x,o),pr(s.y,a)).toVar(),c=pe(1e6,1e6,1e6).toVar();return Ri({start:-1,end:fe(1),name:"x",condition:"<="},({x:u})=>{Ri({start:-1,end:fe(1),name:"y",condition:"<="},({y:f})=>{let p=se(X1(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(Ia(c))}),c}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),QSe=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(pr(s.x,o),pr(s.y,a),pr(s.z,l)).toVar(),u=se(1e6).toVar();return Ri({start:-1,end:fe(1),name:"x",condition:"<="},({x:f})=>{Ri({start:-1,end:fe(1),name:"y",condition:"<="},({y:p})=>{Ri({start:-1,end:fe(1),name:"z",condition:"<="},({z:x})=>{let v=se(X1(c,f,p,x,o,a,l,r,n)).toVar();u.assign(il(u,v))})})}),Wt(n.equal(fe(0)),()=>{u.assign(Ia(u))}),u}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),JSe=Po([YSe,QSe]),eTe=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(pr(s.x,o),pr(s.y,a),pr(s.z,l)).toVar(),u=ft(1e6,1e6).toVar();return Ri({start:-1,end:fe(1),name:"x",condition:"<="},({x:f})=>{Ri({start:-1,end:fe(1),name:"y",condition:"<="},({y:p})=>{Ri({start:-1,end:fe(1),name:"z",condition:"<="},({z:x})=>{let v=se(X1(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(Ia(u))}),u}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),tTe=Po([KSe,eTe]),nTe=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(pr(s.x,o),pr(s.y,a),pr(s.z,l)).toVar(),u=pe(1e6,1e6,1e6).toVar();return Ri({start:-1,end:fe(1),name:"x",condition:"<="},({x:f})=>{Ri({start:-1,end:fe(1),name:"y",condition:"<="},({y:p})=>{Ri({start:-1,end:fe(1),name:"z",condition:"<="},({z:x})=>{let v=se(X1(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(Ia(u))}),u}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),ok=Po([ZSe,nTe]),iTe=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(),R=Fl(a).toVar(),P=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(Lb(D))}),Wt(f.equal(fe(1)),()=>{F.assign(dR(D))}),Wt(f.equal(fe(2)),()=>{F.assign(ok(D,w,fe(0)))}),Wt(f.equal(fe(3)),()=>{F.assign(pR(pe(D,0),P,C,L))}),F.assign(F.mul(T.sub(S)).add(S)),Wt(R,()=>{F.assign(lu(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"}]}),rTe=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(),R=Fl(a).toVar(),P=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(Lb(D))}),Wt(f.equal(fe(1)),()=>{F.assign(dR(D))}),Wt(f.equal(fe(2)),()=>{F.assign(ok(D,w,fe(0)))}),Wt(f.equal(fe(3)),()=>{F.assign(pR(D,P,C,L))}),F.assign(F.mul(T.sub(S)).add(S)),Wt(R,()=>{F.assign(lu(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"}]}),sTe=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(Rh(r)).mul(6).toVar();let s=fe(rU(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"}]}),oTe=Ae(([i])=>{let e=pe(i).toVar(),t=se(e.x).toVar(),n=se(e.y).toVar(),r=se(e.z).toVar(),s=se(il(t,il(n,r))).toVar(),o=se(Er(t,Er(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(ps(2,r.sub(t).div(a)))}).Else(()=>{l.assign(ps(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"}]}),aTe=Ae(([i])=>{let e=pe(i).toVar(),t=V7(Y7(e,pe(.04045))).toVar(),n=pe(e.div(12.92)).toVar(),r=pe(pc(Er(e.add(pe(.055)),pe(0)).div(1.055),pe(2.4))).toVar();return Xn(n,r,t)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),ite=(i,e)=>{i=se(i),e=se(e);let t=ft(e.dFdx(),e.dFdy()).length().mul(.7071067811865476);return Bl(i.sub(t),i.add(t),e)},rte=(i,e,t,n)=>Xn(i,e,t[n].clamp()),lTe=(i,e,t=Pi())=>rte(i,e,t,"x"),cTe=(i,e,t=Pi())=>rte(i,e,t,"y"),uTe=(i,e,t,n,r=Pi())=>{let s=r.x.clamp(),o=r.y.clamp(),a=Xn(i,e,s),l=Xn(t,n,s);return Xn(a,l,o)},ste=(i,e,t,n,r)=>Xn(i,e,ite(t,n[r])),hTe=(i,e,t,n=Pi())=>ste(i,e,t,n,"x"),fTe=(i,e,t,n=Pi())=>ste(i,e,t,n,"y"),dTe=(i=1,e=0,t=Pi())=>t.mul(i).add(e),pTe=(i,e=1)=>(i=se(i),i.abs().pow(e).mul(i.sign())),ATe=(i,e=1,t=.5)=>se(i).sub(t).mul(e).add(t),mTe=(i=Pi(),e=1,t=0)=>sk(i.convert("vec2|vec3")).mul(e).add(t),gTe=(i=Pi(),e=1,t=0)=>Lb(i.convert("vec2|vec3")).mul(e).add(t),_Te=(i=Pi(),e=1,t=0)=>(i=i.convert("vec2|vec3"),Lt(Lb(i),sk(i.add(ft(19,73)))).mul(e).add(t)),xTe=(i,e=Pi(),t=ft(1,1),n=ft(0,0),r=1,s=0,o=1,a=!1,l=1,c=2,u=.5)=>iTe(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),yTe=(i,e=Pi(),t=ft(1,1),n=ft(0,0),r=1,s=0,o=1,a=!1,l=1,c=2,u=.5)=>rTe(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),vTe=(i=Pi(),e=1)=>JSe(i.convert("vec2|vec3"),e,fe(1)),bTe=(i=Pi(),e=1)=>tTe(i.convert("vec2|vec3"),e,fe(1)),wTe=(i=Pi(),e=1)=>ok(i.convert("vec2|vec3"),e,fe(1)),STe=(i=Pi())=>GSe(i.convert("vec2|vec3")),TTe=(i=Pi(),e=3,t=2,n=.5,r=1)=>pC(i,fe(e),t,n).mul(r),ETe=(i=Pi(),e=3,t=2,n=.5,r=1)=>WSe(i,fe(e),t,n).mul(r),MTe=(i=Pi(),e=3,t=2,n=.5,r=1)=>pR(i,fe(e),t,n).mul(r),CTe=(i=Pi(),e=3,t=2,n=.5,r=1)=>jSe(i,fe(e),t,n).mul(r),RTe=(i,e=se(0))=>ps(i,e),PTe=(i,e=se(0))=>ii(i,e),ITe=(i,e=se(1))=>bn(i,e),NTe=(i,e=se(1))=>Ol(i,e),LTe=(i,e=se(1))=>XC(i,e),DTe=(i,e=se(1))=>pc(i,e),FTe=(i=se(0),e=se(1))=>J7(i,e),OTe=()=>j1,BTe=()=>bee,UTe=(i,e=se(1))=>ii(e,i),kTe=(i,e,t,n)=>i.greaterThan(e).mix(t,n),GTe=(i,e,t,n)=>i.greaterThanEqual(e).mix(t,n),zTe=(i,e,t,n)=>i.equal(e).mix(t,n),VTe=(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},qTe=(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},HTe=(i,e)=>{i=ft(i),e=se(e);let t=e.mul(Math.PI/180);return Pb(i,t)},WTe=(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))},jTe=(i,e)=>(i=pe(i),e=se(e),PU(i,e)),XTe=Ae(([i,e,t])=>{let n=na(i).toVar(),r=ii(se(.5).mul(e.sub(t)),Ih).div(n).toVar(),s=ii(se(-.5).mul(e.sub(t)),Ih).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=il(o.x,o.y,o.z).toVar();return Ih.add(n.mul(a)).toVar().sub(t)}),ote=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}),k=Object.freeze({__proto__:null,BRDF_GGX:jU,BRDF_Lambert:Vm,BasicPointShadowFilter:$ee,BasicShadowFilter:Gee,Break:WJ,Const:mQ,Continue:Qye,DFGLUT:db,D_GGX:ree,Discard:IQ,EPSILON:$C,F_Schlick:k1,Fn:Ae,HALF_PI:jxe,INFINITY:qxe,If:Wt,Loop:Ri,NodeAccess:Co,NodeShaderStage:b1,NodeType:bxe,NodeUpdateType:_n,OnBeforeFrameUpdate:jye,OnBeforeMaterialUpdate:Wye,OnBeforeObjectUpdate:Hye,OnFrameUpdate:BJ,OnMaterialUpdate:qye,OnObjectUpdate:Rb,PCFShadowFilter:zee,PCFSoftShadowFilter:Vee,PI:UM,PI2:Hxe,PointShadowFilter:Yee,Return:iye,Schlick_to_F0:nO,ShaderNode:T1,Stack:qC,Switch:Bxe,TBNViewMatrix:Cm,TWO_PI:Wxe,VSMShadowFilter:qee,V_GGX_SmithCorrelated:iee,Var:AQ,VarIntent:gQ,abs:er,acesFilmicToneMapping:Nee,acos:Q7,acosh:WZ,add:ps,addMethodChaining:Be,addNodeElement:rye,agxToneMapping:Lee,all:FZ,alphaT:LM,ambientOcclusion:rF,and:vZ,anisotropy:e0,anisotropyB:Im,anisotropyT:Jv,any:OZ,append:kxe,array:dZ,asin:qZ,asinh:HZ,assign:pZ,atan:J7,atanh:jZ,atomicAdd:uwe,atomicAnd:pwe,atomicFunc:Gh,atomicLoad:lwe,atomicMax:fwe,atomicMin:dwe,atomicOr:Awe,atomicStore:cwe,atomicSub:hwe,atomicXor:mwe,attenuationColor:X7,attenuationDistance:j7,attribute:Dl,attributeArray:Abe,backgroundBlurriness:Tee,backgroundIntensity:WO,backgroundRotation:Eee,batch:zJ,batchColor:UU,bentNormalView:aJ,billboarding:ibe,bitAnd:TZ,bitNot:EZ,bitOr:MZ,bitXor:CZ,bitangentGeometry:Fye,bitangentLocal:Oye,bitangentView:sJ,bitangentWorld:Bye,bitcast:yee,blendBurn:Tbe,blendColor:Rbe,blendDodge:Ebe,blendOverlay:Cbe,blendScreen:Mbe,blur:uee,bool:Fl,buffer:H1,bufferAttribute:pU,builtin:od,builtinAOContext:dQ,builtinShadowContext:fQ,bumpMap:PU,bvec2:aZ,bvec3:V7,bvec4:lZ,bypass:RQ,cache:CQ,call:AZ,cameraFar:i0,cameraIndex:m0,cameraNear:n0,cameraNormalMatrix:fye,cameraPosition:BQ,cameraProjectionMatrix:Pa,cameraProjectionMatrixInverse:OQ,cameraViewMatrix:g0,cameraViewport:dye,cameraWorldMatrix:Cb,cbrt:oQ,cdl:Dbe,ceil:KC,checker:hSe,cineonToneMapping:Iee,clamp:lu,clearcoat:PM,clearcoatNormalView:r0,clearcoatRoughness:M1,clipSpace:GQ,code:uR,color:oZ,colorSpaceToWorking:QC,colorToDirection:Gye,compute:MQ,computeKernel:mU,computeSkinning:Zye,context:sd,convert:uZ,convertColorSpace:Kxe,convertToTexture:hbe,cos:iu,cosh:GZ,countLeadingZeros:Dve,countOneBits:Fve,countTrailingZeros:Lve,cross:nd,cubeTexture:Ra,cubeTextureBase:CU,dFdx:nU,dFdy:iU,dashSize:Nm,debug:LQ,decrement:DZ,decrementBefore:NZ,defaultBuildStages:vM,defaultShaderStages:tZ,defined:L1,degrees:UZ,deltaTime:Yve,densityFogFactor:Bee,depth:qU,depthPass:kbe,determinant:ZZ,difference:tQ,diffuseColor:Ci,diffuseContribution:Sm,directPointLight:Zee,directionToColor:kye,directionToFaceDirection:Eye,dispersion:$7,disposeShadowMaterial:Wee,distance:eQ,div:Ol,dot:_c,drawIndex:EQ,dynamicBufferAttribute:Jxe,element:cZ,emissive:iF,equal:mZ,equirectDirection:KF,equirectUV:HU,exp:K7,exp2:D1,exponentialHeightFogFactor:Kbe,expression:Ll,faceDirection:TU,faceForward:uU,faceforward:Xxe,float:se,floatBitsToInt:Pve,floatBitsToUint:vee,floor:Rh,fog:QO,fract:au,frameGroup:zxe,frameId:bee,frontFacing:zQ,fwidth:sU,gain:Bve,gapSize:lb,getConstNodeType:sZ,getCurrentStack:k7,getDirection:lee,getDistanceAttenuation:rk,getGeometryRoughness:nee,getNormalFromDepth:dbe,getParallaxCorrectNormal:XTe,getRoughness:WU,getScreenPosition:fbe,getShIrradianceAt:ote,getShadowMaterial:Hee,getShadowRenderObjectFunction:jee,getTextureIndex:_ee,getViewPosition:S1,ggxConvolution:hee,globalId:ewe,glsl:Xbe,glslFn:$be,grayscale:Pbe,greaterThan:Y7,greaterThanEqual:yZ,hash:Ove,highpModelNormalViewMatrix:SF,highpModelViewMatrix:wF,hue:Lbe,increment:LZ,incrementBefore:IZ,inspector:DQ,instance:kJ,instanceColor:BU,instanceIndex:ou,instancedArray:mbe,instancedBufferAttribute:eR,instancedDynamicBufferAttribute:AU,instancedMesh:GJ,int:fe,intBitsToFloat:Ive,interleavedGradientNoise:YU,inverse:QZ,inverseSqrt:Z7,inversesqrt:$xe,invocationLocalIndex:nye,invocationSubgroupIndex:tye,ior:eb,iridescence:WC,iridescenceIOR:IM,iridescenceThickness:NM,isolate:P1,ivec2:Tr,ivec3:z7,ivec4:q7,js:Wbe,label:pQ,length:Ph,lengthSq:lU,lessThan:_Z,lessThanEqual:xZ,lightPosition:ek,lightProjectionUV:Uee,lightShadowMatrix:fR,lightTargetDirection:nk,lightTargetPosition:kee,lightViewPosition:tk,lightingContext:XJ,lights:Xwe,linearDepth:XM,linearToneMapping:Ree,localId:twe,log:YC,log2:Ch,logarithmicDepthToViewZ:i2e,luminance:ZU,mat2:HC,mat3:so,mat4:l0,matcapUV:fee,materialAO:FJ,materialAlphaTest:cJ,materialAnisotropy:SJ,materialAnisotropyVector:w1,materialAttenuationColor:NJ,materialAttenuationDistance:IJ,materialClearcoat:_J,materialClearcoatNormal:yJ,materialClearcoatRoughness:xJ,materialColor:uJ,materialDispersion:DJ,materialEmissive:fJ,materialEnvIntensity:wM,materialEnvRotation:qM,materialIOR:PJ,materialIridescence:TJ,materialIridescenceIOR:EJ,materialIridescenceThickness:MJ,materialLightMap:OU,materialLineDashOffset:FU,materialLineDashSize:LU,materialLineGapSize:DU,materialLineScale:NU,materialLineWidth:HM,materialMetalness:mJ,materialNormal:gJ,materialOpacity:IU,materialPointSize:LJ,materialReference:Qf,materialReflectivity:SM,materialRefractionRatio:HQ,materialRotation:vJ,materialRoughness:AJ,materialSheen:bJ,materialSheenRoughness:wJ,materialShininess:hJ,materialSpecular:dJ,materialSpecularColor:pJ,materialSpecularIntensity:FF,materialSpecularStrength:tb,materialThickness:RJ,materialTransmission:CJ,max:Er,maxMipLevel:yU,mediumpModelViewMatrix:kQ,metalness:ed,min:il,mix:Xn,mixElement:lQ,mod:XC,modelDirection:yye,modelNormalMatrix:UQ,modelPosition:vye,modelRadius:Sye,modelScale:bye,modelViewMatrix:Dh,modelViewPosition:wye,modelViewProjection:OJ,modelWorldMatrix:Ac,modelWorldMatrixInverse:Tye,morphReference:jJ,mrt:xee,mul:bn,mx_aastep:ite,mx_add:RTe,mx_atan2:FTe,mx_cell_noise_float:STe,mx_contrast:ATe,mx_divide:NTe,mx_fractal_noise_float:TTe,mx_fractal_noise_vec2:ETe,mx_fractal_noise_vec3:MTe,mx_fractal_noise_vec4:CTe,mx_frame:BTe,mx_heighttonormal:jTe,mx_hsvtorgb:sTe,mx_ifequal:zTe,mx_ifgreater:kTe,mx_ifgreatereq:GTe,mx_invert:UTe,mx_modulo:LTe,mx_multiply:ITe,mx_noise_float:mTe,mx_noise_vec3:gTe,mx_noise_vec4:_Te,mx_place2d:qTe,mx_power:DTe,mx_ramp4:uTe,mx_ramplr:lTe,mx_ramptb:cTe,mx_rgbtohsv:oTe,mx_rotate2d:HTe,mx_rotate3d:WTe,mx_safepower:pTe,mx_separate:VTe,mx_splitlr:hTe,mx_splittb:fTe,mx_srgb_texture_to_lin_rec709:aTe,mx_subtract:PTe,mx_timer:OTe,mx_transform_uv:dTe,mx_unifiednoise2d:xTe,mx_unifiednoise3d:yTe,mx_worley_noise_float:vTe,mx_worley_noise_vec2:bTe,mx_worley_noise_vec3:wTe,negate:tU,negateOnBackSide:Km,neutralToneMapping:Dee,nodeArray:Pm,nodeImmutable:xt,nodeObject:Vt,nodeObjectIntent:Yv,nodeObjects:VC,nodeProxy:Hn,nodeProxyConstructor:U7,nodeProxyIntent:lt,normalFlat:VQ,normalGeometry:tR,normalLocal:ra,normalMap:LF,normalView:ai,normalViewGeometry:F1,normalWorld:_0,normalWorldGeometry:qQ,normalize:na,not:wZ,notEqual:gZ,numWorkgroups:Qbe,objectDirection:pye,objectGroup:fZ,objectPosition:mye,objectRadius:xye,objectScale:gye,objectViewPosition:_ye,objectWorldMatrix:Aye,oneMinus:XZ,or:bZ,orthographicDepthToViewZ:YJ,oscSawtooth:Jve,oscSine:Kve,oscSquare:Zve,oscTriangle:Qve,output:C1,outputStruct:Mve,overloadingFn:Po,overrideNode:mee,overrideNodes:gee,packHalf2x16:Vve,packNormalToRGB:RU,packSnorm2x16:Gve,packUnorm2x16:zve,parabola:OO,parallaxDirection:oJ,parallaxUV:Uye,parameter:Sve,pass:Bbe,passTexture:Ube,pcurve:Uve,perspectiveDepthToViewZ:sR,pmremTexture:$U,pointShadow:Kee,pointUV:gbe,pointWidth:Gxe,positionGeometry:Jo,positionLocal:dr,positionPrevious:zm,positionView:rs,positionViewDirection:qi,positionWorld:Ih,positionWorldDirection:SU,posterize:Fbe,pow:pc,pow2:oU,pow3:nQ,pow4:aU,premultiplyAlpha:_U,property:rd,quadBroadcast:zwe,quadSwapDiagonal:Fwe,quadSwapX:Lwe,quadSwapY:Dwe,radians:BZ,rand:aQ,range:Zbe,rangeFogFactor:Oee,reciprocal:YZ,reference:ir,referenceBuffer:KQ,reflect:JZ,reflectVector:XQ,reflectView:WQ,reflector:lbe,refract:cU,refractVector:$Q,refractView:jQ,reinhardToneMapping:Pee,remap:gU,remapClamp:PQ,renderGroup:Kt,renderOutput:xU,rendererReference:bQ,replaceDefaultUV:ebe,rotate:Pb,rotateUV:tbe,roughness:Eh,round:$Z,rtt:See,sRGBTransferEOTF:xQ,sRGBTransferOETF:yQ,sample:pbe,sampler:lye,samplerComparison:cye,saturate:ZC,saturation:Ibe,screenCoordinate:Ym,screenDPR:bU,screenSize:Gm,screenUV:su,select:ta,setCurrentStack:ab,setName:hU,shaderStages:bM,shadow:Xee,shadowPositionWorld:ik,shapeCircle:fSe,sharedUniformGroup:jC,sheen:Il,sheenRoughness:t0,shiftLeft:RZ,shiftRight:PZ,shininess:DM,sign:eU,sin:Ca,sinc:kve,sinh:kZ,skinning:HJ,smoothstep:Bl,smoothstepElement:cQ,specularColor:h0,specularColorBlended:Em,specularF90:Mm,spherizeUV:nbe,split:Uxe,spritesheetUV:sbe,sqrt:Ia,stack:EM,step:Um,stepElement:uQ,storage:c0,storageBarrier:rwe,storageTexture:Mee,storageTexture3D:xbe,struct:Eve,sub:ii,subBuild:Lm,subgroupAdd:xwe,subgroupAll:Pwe,subgroupAnd:Twe,subgroupAny:Iwe,subgroupBallot:_we,subgroupBroadcast:Owe,subgroupBroadcastFirst:Nwe,subgroupElect:gwe,subgroupExclusiveAdd:vwe,subgroupExclusiveMul:Swe,subgroupInclusiveAdd:ywe,subgroupInclusiveMul:wwe,subgroupIndex:eye,subgroupMax:Rwe,subgroupMin:Cwe,subgroupMul:bwe,subgroupOr:Ewe,subgroupShuffle:Bwe,subgroupShuffleDown:Gwe,subgroupShuffleUp:kwe,subgroupShuffleXor:Uwe,subgroupSize:nwe,subgroupXor:Mwe,tan:zZ,tangentGeometry:nR,tangentLocal:f0,tangentView:iR,tangentWorld:rJ,tanh:VZ,texture:li,texture3D:KU,texture3DLevel:bbe,texture3DLoad:vbe,textureBarrier:swe,textureBicubic:P2e,textureBicubicLevel:XU,textureCubeUV:cee,textureLevel:aye,textureLoad:is,textureSize:km,textureStore:_be,thickness:W7,time:j1,toneMapping:wQ,toneMappingExposure:SQ,toonOutlinePass:Gbe,transformDirection:iQ,transformNormal:EU,transformNormalByInverseViewMatrix:sQ,transformNormalByViewMatrix:rQ,transformNormalToView:MU,transformedClearcoatNormalView:Rye,transformedNormalView:Mye,transformedNormalWorld:Cye,transmission:FM,transpose:KZ,triNoise3D:Xve,triplanarTexture:obe,triplanarTextures:wee,trunc:rU,uint:it,uintBitsToFloat:Nve,uniform:Ht,uniformArray:Mo,uniformCubeTexture:Pye,uniformFlow:hQ,uniformGroup:hZ,uniformTexture:oye,unpackHalf2x16:Wve,unpackNormal:IF,unpackRGBToNormal:lJ,unpackSnorm2x16:qve,unpackUnorm2x16:Hve,unpremultiplyAlpha:NQ,userData:wbe,uv:Pi,uvec2:G7,uvec3:Xm,uvec4:H7,varying:A0,varyingProperty:$m,vec2:ft,vec3:pe,vec4:Lt,vectorComponents:jm,velocity:Sbe,vertexColor:QJ,vertexIndex:TQ,vertexStage:_Q,vibrance:Nbe,viewZToLogarithmicDepth:oR,viewZToOrthographicDepth:Dm,viewZToPerspectiveDepth:VU,viewZToReversedOrthographicDepth:n2e,viewZToReversedPerspectiveDepth:KJ,viewport:N1,viewportCoordinate:FQ,viewportDepthTexture:zU,viewportLinearDepth:r2e,viewportMipTexture:GU,viewportOpaqueMipTexture:$J,viewportResolution:hye,viewportSafeUV:rbe,viewportSharedTexture:Obe,viewportSize:wU,viewportTexture:e2e,viewportUV:uye,vogelDiskSample:ru,wgsl:jbe,wgslFn:Ybe,workgroupArray:owe,workgroupBarrier:iwe,workgroupId:Jbe,workingToColorSpace:vQ,xor:SZ}),tu=new Ab,aB=class extends Bh{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(tu),tu.a=r._clearColor.a;else if(s.isColor===!0)s.getRGB(tu),tu.a=1,o=!0;else if(s.isNode===!0){let l=this.get(e),c=s;tu.copy(r._clearColor);let u=l.backgroundMesh;if(u===void 0){let P=function(){s.removeEventListener("dispose",P),u.material.dispose(),u.geometry.dispose()},p=Lt(c).mul(WO).context({getUV:()=>Eee.mul(qQ),getTextureLevel:()=>Tee}),x=Pa.element(3).element(3).equal(1),v=Ol(1,Pa.element(1).element(1)).mul(3),w=x.select(dr.mul(v),dr),S=Dh.mul(Lt(w,0)),T=Pa.mul(Lt(S.xyz,1));T=T.setZ(T.w);let R=new mr;R.name="Background.material",R.side=hi,R.depthTest=!1,R.depthWrite=!1,R.allowOverride=!1,R.fog=!1,R.lights=!1,R.vertexNode=T,R.colorNode=p,l.backgroundMeshNode=p,l.backgroundMesh=u=new Gn(new _a(1,32,32),R),u.frustumCulled=!1,u.name="Background.mesh",s.addEventListener("dispose",P)}let f=c.getCacheKey();l.backgroundCacheKey!==f&&(l.backgroundMeshNode.node=Lt(c).mul(WO),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"?tu.set(0,0,0,1):a==="alpha-blend"&&tu.set(0,0,0,0),r.autoClear===!0||o===!0){let l=n.clearColorValue;l.r=tu.r,l.g=tu.g,l.b=tu.b,l.a=tu.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}},$Te=0,yb=class{constructor(e="",t=[]){this.name=e,this.bindings=t,this.id=$Te++}},lB=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 yb(t.name,[]);e.push(r);for(let s of t.bindings)r.bindings.push(s.clone())}else e.push(t);return e}},AC=class{constructor(e,t,n=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=n}},cB=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}},mC=class{constructor(e,t,n=!1,r=null){this.isNodeVar=!0,this.name=e,this.type=t,this.readOnly=n,this.count=r}},uB=class extends mC{constructor(e,t,n=null,r=null){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0,this.interpolationType=n,this.interpolationSampling=r}},hB=class{constructor(e,t,n=""){this.name=e,this.type=t,this.code=n,Object.defineProperty(this,"isNodeCode",{value:!0})}},YTe=0,sb=class{constructor(e=null){this.id=YTe++,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)}},fB=class{constructor(e,t){this.name=e,this.members=t,this.output=!1}},kh=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}},dB=class extends kh{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}},pB=class extends kh{constructor(e,t=new Oe){super(e,t),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}},AB=class extends kh{constructor(e,t=new ie){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}},mB=class extends kh{constructor(e,t=new gn){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}},gB=class extends kh{constructor(e,t=new Ut){super(e,t),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}},_B=class extends kh{constructor(e,t=new I_){super(e,t),this.isMatrix2Uniform=!0,this.boundary=8,this.itemSize=4}},xB=class extends kh{constructor(e,t=new Sn){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}},yB=class extends kh{constructor(e,t=new on){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}},vB=class extends dB{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},bB=class extends pB{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},wB=class extends AB{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},SB=class extends mB{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},TB=class extends gB{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},EB=class extends _B{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},MB=class extends xB{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},CB=class extends yB{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},KTe=0,bK=new WeakMap,wK=new WeakMap,ZTe=new WeakMap,QTe=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),oM=i=>/e/g.test(i)?String(i).replace(/\+/g,""):(i=Number(i),i+(i%1?"":".0")),ate=i=>{if(i.writeUsageCount>0)return!0;if(i.subBuildsCache!==void 0){for(let e in i.subBuildsCache)if(ate(i.subBuildsCache[e]))return!0}return!1},gC=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=EM(),this.stacks=[],this.tab=" ",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new sb,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:KTe++})}isFlatShading(){return this.material.flatShading===!0||this.geometry.hasAttribute("normal")===!1}isOpaque(){let e=this.material;return e.transparent===!1&&e.blending===cs&&e.alphaToCoverage===!1}createRenderTarget(e,t,n){return new da(e,t,n)}createCubeRenderTarget(e,t){return new $M(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===Fr?o="ivec":r===Ai&&(o="uvec"),s===Gf||s===Qu?r===Fr?t="int":r===Ai?t="uint":t="float":s===Rs||s===Ju?t=`${o}2`:s===kf||s===E2?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=bK.get(a);l===void 0&&(l=new Map,bK.set(a,l));let c=q1(o);s=l.get(c),s===void 0&&(s=new yb(e,t),l.set(c,s))}else s=new yb(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 bM)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===bi||e.magFilter===up||e.magFilter===ic||e.magFilter===vo||e.minFilter===bi||e.minFilter===up||e.minFilter===ic||e.minFilter===vo}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 sb(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(ate(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 oM(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")}( ${oM(t.r)}, ${oM(t.g)}, ${oM(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 AC(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===Fr?"int":t===Ai?"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=QK(e),r=t==="float"?"":t[0];return/mat2/.test(t)===!0&&(n=n.replace("vec","mat")),r+n}getTypeFromArray(e){return QTe.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 y_)&&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=EM(this.stack);let e=k7();return this.stacks.push(e),ab(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,ab(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 AC(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 fB(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 cB(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 mC(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 uB(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 hB("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=wK.get(t);n===void 0&&(n=new WeakMap,wK.set(t,n));let r=n.get(e);if(r===void 0){r=new uC;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 iC(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 sb,this.stack=EM();for(let u of vM)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 mr),r.build(this)}else this.addFlow("compute",e)}build(){this.prebuild();for(let e of yM){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of vM){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 yM){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of vM){this.setShaderStage(t);let n=this.flowNodes[t];for(let r of n)e==="generate"?this.flowNode(r):r.build(this);await GL()}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}getSharedDataFromNode(e){let t=XTe.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 yB(e);else if(t==="vec2"||t==="ivec2"||t==="uvec2")r=new vB(e);else if(t==="vec3"||t==="ivec3"||t==="uvec3")r=new bB(e);else if(t==="vec4"||t==="ivec4"||t==="uvec4")r=new wB(e);else if(t==="color")r=new SB(e);else if(t==="mat2")r=new TB(e);else if(t==="mat3")r=new EB(e);else if(t==="mat4")r=new MB(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")||QK(this.object).useVelocity===!0}},gC=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}},xb=class{constructor(e,t,n=null,r="",s=!1){this.type=e,this.name=t,this.count=n,this.qualifier=r,this.isConst=s}};xb.isNodeFunctionInput=!0;var CB=class extends id{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}},RB=class extends id{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setupDirect(){let e=this.colorNode;return{lightDirection:tk(this.light),lightColor:e}}},PB=class extends id{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=JU(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=_0.dot(r).mul(.5).add(.5),a=Xn(n,t,o);e.context.irradiance.addAssign(a)}},yb=class extends id{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 Bl(n,r,t)}getLightCoord(e){let t=e.getNodeProperties(this),n=t.projectionUV;return n===void 0&&(n=Oee(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(tk(s)),c=this.getSpotAttenuation(e,l),u=o.length(),f=ik({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=li(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}}},IB=class extends yb{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=li(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)}},NB=class extends id{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=Eo(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=rte(_0,this.lightProbe);e.context.irradiance.addAssign(t)}},YTe=Ae(([i,e])=>{let t=i.abs().sub(e);return Ph(Er(t,0)).add(il(Er(t.x,t.y),0))}),LB=class extends yb{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=hR(this.light).mul(e.context.positionWorld||Ih);return Wt(r.w.greaterThan(0),()=>{let s=r.xyz.div(r.w),o=YTe(s.xy.sub(ft(.5)),ft(.5)),a=Ol(-1,ii(1,Z7(n)).sub(1));t.assign(KC(o.mul(-2).mul(a)))}),t}},L8=new on,oM=new on,kv=null,DB=class extends id{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;oM.identity(),L8.copy(t.matrixWorld),L8.premultiply(n),oM.extractRotation(L8),this.halfWidth.value.set(t.width*.5,0,0),this.halfHeight.value.set(0,t.height*.5,0),this.halfWidth.value.applyMatrix4(oM),this.halfHeight.value.applyMatrix4(oM)}setupDirectRectArea(e){let t,n;e.isAvailable("float32Filterable")?(t=li(kv.LTC_FLOAT_1),n=li(kv.LTC_FLOAT_2)):(t=li(kv.LTC_HALF_1),n=li(kv.LTC_HALF_2));let{colorNode:r,light:s}=this,o=ek(s);return{lightColor:r,lightPosition:o,halfWidth:this.halfWidth,halfHeight:this.halfHeight,ltc_1:t,ltc_2:n}}static setLTC(e){kv=e}},_C=class{parseFunction(){je("Abstract function.")}},vb=class{constructor(e,t,n="",r=""){this.type=e,this.inputs=t,this.name=n,this.precision=r}getCode(){je("Abstract function.")}};vb.isNodeFunction=!0;var KTe=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,ZTe=/[a-z_0-9]+/ig,bK="#pragma main",QTe=i=>{i=i.trim();let e=i.indexOf(bK),t=e!==-1?i.slice(e+bK.length):i,n=t.match(KTe);if(n!==null&&n.length===5){let r=n[4],s=[],o=null;for(;(o=ZTe.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 xb(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.")},FB=class extends vb{constructor(e){let{type:t,inputs:n,name:r,precision:s,inputsCode:o,blockCode:a,headerCode:l}=QTe(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}},OB=class extends _C{parseFunction(e){return new FB(e)}},cc=[],Xf=[],wK=Ht(0,"int").setGroup(Kt),BB=class extends Bh{constructor(e,t){super(),this.renderer=e,this.backend=t,this.nodeFrame=new gC,this.nodeBuilderCache=new Map,this.callHashCache=new Oh,this.groupsData=new Oh,this._buildQueue=[],this._buildInProgress=!1,this.cacheLib={}}updateGroup(e){let t=e.groupNode;if(t.updateType===_n.OBJECT)return!0;cc[0]=t,cc[1]=e;let n=this.groupsData.get(cc);return n===void 0&&this.groupsData.set(cc,n={}),cc[0]=null,cc[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 mr),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 mr),l.build();let u=c.stackTrace;!u&&c.stack&&(u=new kr(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 aB(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){cc[0]=e,cc[1]=t;let n=this.renderer.info.calls,r=this.callHashCache.get(cc)||{};if(r.callId!==n){if(Xf.push(this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview?1:0),Xf.push(this.renderer.lighting.enabled?1:0),this.renderer.lighting.enabled){Xf.push(t.getCacheKey(!0)),Xf.push(this.renderer.shadowMap.enabled?1:0),Xf.push(this.renderer.shadowMap.type);let o=this.getEnvironmentNode(e);o&&Xf.push(o.getCacheKey())}let s=this.getFogNode(e);s&&Xf.push(s.getCacheKey()),r.callId=n,r.cacheKey=Tb(Xf),this.callHashCache.set(cc,r),Xf.length=0}return cc[0]=null,cc[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===lp||n.mapping===cp||n.mapping===Yu){if(e.backgroundBlurriness>0||n.mapping===Yu)return XU(n);{let o;return n.isCubeTexture===!0?o=Ra(n):o=li(n),JJ(o)}}else{if(n.isTexture===!0)return li(n,su.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=ir("color","color",n).setGroup(Kt),o=ir("density","float",n).setGroup(Kt);return ZO(s,Fee(o))}else if(n.isFog){let s=ir("color","color",n).setGroup(Kt),o=ir("near","float",n).setGroup(Kt),a=ir("far","float",n).setGroup(Kt);return ZO(s,Dee(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 Ra(n);if(n.isTexture===!0)return li(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=li(e,su).depth(od("gl_ViewID_OVR")).renderOutput(t.toneMapping,t.currentColorSpace):n=li(e,su).depth(wK).renderOutput(t.toneMapping,t.currentColorSpace):n=li(e,su).renderOutput(t.toneMapping,t.currentColorSpace),n}setOutputLayerIndex(e){wK.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 gC,this.nodeBuilderCache=new Map,this.cacheLib={}}},D8=new ha,xC=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++){D8.copy(e[s]).applyMatrix4(this.viewMatrix,this.viewNormalMatrix);let o=t[n+s],a=D8.normal;o.x=-a.x,o.y=-a.y,o.z=-a.z,o.w=D8.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}},UB=class{constructor(e,t,n){this.bundleGroup=e,this.camera=t,this.renderContext=n}},Yp=[],kB=class{constructor(){this.bundles=new Oh}get(e,t,n){let r=this.bundles;Yp[0]=e,Yp[1]=t,Yp[2]=n;let s=r.get(Yp);return s===void 0&&(s=new UB(e,t,n),r.set(Yp,s)),Yp[0]=null,Yp[1]=null,Yp[2]=null,s}dispose(){this.bundles=new Oh}},yC=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)}},JTe=new gb,SK=new WeakMap,GB=class{constructor(){this.enabled=!0,this._cache=[]}createNode(e=[]){return new gb().setLights(e)}getNode(e){if(e.isScene!==!0&&e.isGroup!==!0)return JTe;let t=SK.get(e);return t===void 0&&(t=this.createNode(),SK.set(e,t)),t}beginRender(e){this._cache.push(this.getNode(e).getLights())}finishRender(e){this.getNode(e).setLights(this._cache.pop())}},Rm=class extends da{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}},TK=new ie,EK=new ie,MK=new WeakMap,zB=class extends qo{constructor(e,t=!1){super(),this.enabled=!1,this.isPresenting=!1,this.cameraAutoUpdate=!0,this._renderer=e,this._cameraL=new Lr,this._cameraL.viewport=new gn,this._cameraL.matrixWorldAutoUpdate=!1,this._cameraR=new Lr,this._cameraR.viewport=new gn,this._cameraR.matrixWorldAutoUpdate=!1,this._cameras=[this._cameraL,this._cameraR],this._cameraXR=new C_,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=s3e.bind(this),this._gl=null,this._currentAnimationContext=null,this._currentAnimationLoop=null,this._currentPixelRatio=null,this._currentSamples=null,this._currentSize=new Oe,this._onSessionEvent=n3e.bind(this),this._onSessionEnd=i3e.bind(this),this._onInputSourcesChange=r3e.bind(this),this._onAnimationFrame=o3e.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){Qn(`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&&(Qn("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 da(n.textureWidth,n.textureHeight,{depth:2,minFilter:bi,magFilter:bi,depthBuffer:!0,multiview:!1,useArrayDepthTexture:!0,samples:0}),this._xrRenderTarget.texture.isArrayTexture=!0,this._useMultiviewIfPossible===!0&&Qn("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 DA(e,t),u=new Rm(s,o,{format:wr,type:Vi,depthTexture:new us(s,o,l.stencil?Ho:Ai,void 0,void 0,void 0,void 0,void 0,void 0,l.stencil?eo:Ts),stencilBuffer:l.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});u._autoAllocateDepthBuffer=!0;let f=new Yr({color:16777215,side:_o});f.map=u.texture,f.map.offset.y=1,f.map.repeat.y=-1;let p=new Gn(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 Yr({color:16777215,side:_o}),x.plane.material.blending=Uf,x.plane.material.blendEquation=zs,x.plane.material.blendSrc=Xc,x.plane.material.blendDst=Xc,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 IA(e,e,e*t/n,64,64,!0,Math.PI-t/2,t),f=new Rm(o,a,{format:wr,type:Vi,depthTexture:new us(o,a,c.stencil?Ho:Ai,void 0,void 0,void 0,void 0,void 0,void 0,c.stencil?eo:Ts),stencilBuffer:c.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});f._autoAllocateDepthBuffer=!0;let p=new Yr({color:16777215,side:hi});p.map=f.texture,p.map.offset.y=1,p.map.repeat.y=-1;let x=new Gn(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 Yr({color:16777215,side:hi}),v.plane.material.blending=Uf,v.plane.material.blendEquation=zs,v.plane.material.blendSrc=Xc,v.plane.material.blendDst=Xc,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 Es,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=MK.get(l),c===void 0&&(c=l.context({getOutput:f=>_U(f,n.toneMapping,n.outputColorSpace)}),MK.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?eo:Ts,s=t.stencil?Ho:Ai);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 us(c.textureWidth,c.textureHeight,s,void 0,void 0,void 0,void 0,void 0,void 0,r,f);if(this._xrRenderTarget=new Rm(c.textureWidth,c.textureHeight,{format:wr,type:Vi,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 Yr({color:16777215,side:x.type==="cylinder"?hi:_o}),x.plane.material.blending=Uf,x.plane.material.blendEquation=zs,x.plane.material.blendSrc=Xc,x.plane.material.blendDst=Xc,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 Rm(s.framebufferWidth,s.framebufferHeight,{format:wr,type:Vi,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;CK(s,l);for(let u=0;u<c.length;u++)CK(c[u],l);c.length===2?e3e(s,o,a):s.projectionMatrix.copy(o.projectionMatrix),t3e(e,s,l)}_getController(e){let t=this._controllers[e];return t===void 0&&(t=new Qd,this._controllers[e]=t),t}};function e3e(i,e,t){TK.setFromMatrixPosition(e.matrixWorld),EK.setFromMatrixPosition(t.matrixWorld);let n=TK.distanceTo(EK),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 CK(i,e){e===null?i.matrixWorld.copy(i.matrix):i.matrixWorld.multiplyMatrices(e.matrixWorld,i.matrix),i.matrixWorldInverse.copy(i.matrixWorld).invert()}function t3e(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=Lf*2*Math.atan(1/i.projectionMatrix.elements[5]),i.zoom=1)}function n3e(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 i3e(){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 Rm(t.pixelwidth,t.pixelheight,{format:wr,type:Vi,depthTexture:new us(t.pixelwidth,t.pixelheight,t.stencilBuffer?Ho:Ai,void 0,void 0,void 0,void 0,void 0,void 0,t.stencilBuffer?eo:Ts),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 r3e(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 s3e(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 o3e(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 Lr,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 VB=class extends qo{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 PA,this.depthTexture=new us}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"})}},RK=new Jd,f1=new Oe,F8=new gn,aM=new ec,lM=new My,d1=new on,$f=new gn,a3e={[_o]:hi,[hi]:_o,[sr]:sr},qB=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=Fi,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=vr,this.toneMapping=Vs,this.toneMappingExposure=1,this.sortObjects=!0,this.depth=o,this.stencil=a,this.info=new vO,this.contextNode=sd(),this.library=new yC,this.lighting=new GB,this._samples=c||l===!0?4:0,this._onCanvasTargetResize=this._onCanvasTargetResize.bind(this),this._canvasTarget=new VB(e.getDomElement()),this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize),this._canvasTarget.isDefaultCanvasTarget=!0,this._inspector=new kM,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 db(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:ap},this.xr=new zB(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 BB(this,n),this._animation=new mO(this,this._nodes,this.info),this._attributes=new xO(n,this.info),this._background=new oB(this,this._nodes),this._geometries=new yO(this._attributes,this.info),this._textures=new PO(this,n,this.info),this._pipelines=new SO(n,this._nodes,this.info),this._bindings=new TO(n,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new _O(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new MO(this.lighting),this._bundles=new kB,this._renderContexts=new RO(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:RK,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 xC),x.clippingContext.updateGlobal(u,t),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t=this._updateCamera(t),u.onBeforeRender(this,e,t,p);let S=t.isArrayCamera?lM:aM;t.isArrayCamera?S.setFromArrayCamera(t):(d1.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),S.setFromProjectionMatrix(d1,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 GL()}}async renderAsync(e,t){Qn('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=bF,t.modelNormalViewMatrix=wF):this.highPrecision&&(delete t.modelViewMatrix,delete t.modelNormalViewMatrix)}get highPrecision(){let e=this.contextNode.value;return e.modelViewMatrix===bF&&e.modelNormalViewMatrix===wF}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getOutputBufferType(){return this._outputBufferType}getColorBufferType(){return Qn('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 mr),r.build(this)}else this.addFlow("compute",e)}build(){this.prebuild();for(let e of vM){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of bM){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 vM){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of bM){this.setShaderStage(t);let n=this.flowNodes[t];for(let r of n)e==="generate"?this.flowNode(r):r.build(this);await zL()}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}getSharedDataFromNode(e){let t=ZTe.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 vB(e);else if(t==="vec2"||t==="ivec2"||t==="uvec2")r=new bB(e);else if(t==="vec3"||t==="ivec3"||t==="uvec3")r=new wB(e);else if(t==="vec4"||t==="ivec4"||t==="uvec4")r=new SB(e);else if(t==="color")r=new TB(e);else if(t==="mat2")r=new EB(e);else if(t==="mat3")r=new MB(e);else if(t==="mat4")r=new CB(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")||eZ(this.object).useVelocity===!0}},_C=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}},vb=class{constructor(e,t,n=null,r="",s=!1){this.type=e,this.name=t,this.count=n,this.qualifier=r,this.isConst=s}};vb.isNodeFunctionInput=!0;var RB=class extends id{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}},PB=class extends id{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setupDirect(){let e=this.colorNode;return{lightDirection:nk(this.light),lightColor:e}}},IB=class extends id{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=ek(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=_0.dot(r).mul(.5).add(.5),a=Xn(n,t,o);e.context.irradiance.addAssign(a)}},bb=class extends id{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 Bl(n,r,t)}getLightCoord(e){let t=e.getNodeProperties(this),n=t.projectionUV;return n===void 0&&(n=Uee(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(nk(s)),c=this.getSpotAttenuation(e,l),u=o.length(),f=rk({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=li(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}}},NB=class extends bb{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=li(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)}},LB=class extends id{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=Mo(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=ote(_0,this.lightProbe);e.context.irradiance.addAssign(t)}},JTe=Ae(([i,e])=>{let t=i.abs().sub(e);return Ph(Er(t,0)).add(il(Er(t.x,t.y),0))}),DB=class extends bb{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=fR(this.light).mul(e.context.positionWorld||Ih);return Wt(r.w.greaterThan(0),()=>{let s=r.xyz.div(r.w),o=JTe(s.xy.sub(ft(.5)),ft(.5)),a=Ol(-1,ii(1,Q7(n)).sub(1));t.assign(ZC(o.mul(-2).mul(a)))}),t}},D8=new on,aM=new on,zv=null,FB=class extends id{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;aM.identity(),D8.copy(t.matrixWorld),D8.premultiply(n),aM.extractRotation(D8),this.halfWidth.value.set(t.width*.5,0,0),this.halfHeight.value.set(0,t.height*.5,0),this.halfWidth.value.applyMatrix4(aM),this.halfHeight.value.applyMatrix4(aM)}setupDirectRectArea(e){let t,n;e.isAvailable("float32Filterable")?(t=li(zv.LTC_FLOAT_1),n=li(zv.LTC_FLOAT_2)):(t=li(zv.LTC_HALF_1),n=li(zv.LTC_HALF_2));let{colorNode:r,light:s}=this,o=tk(s);return{lightColor:r,lightPosition:o,halfWidth:this.halfWidth,halfHeight:this.halfHeight,ltc_1:t,ltc_2:n}}static setLTC(e){zv=e}},xC=class{parseFunction(){je("Abstract function.")}},wb=class{constructor(e,t,n="",r=""){this.type=e,this.inputs=t,this.name=n,this.precision=r}getCode(){je("Abstract function.")}};wb.isNodeFunction=!0;var e3e=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,t3e=/[a-z_0-9]+/ig,SK="#pragma main",n3e=i=>{i=i.trim();let e=i.indexOf(SK),t=e!==-1?i.slice(e+SK.length):i,n=t.match(e3e);if(n!==null&&n.length===5){let r=n[4],s=[],o=null;for(;(o=t3e.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 R=s[l++][0];a.push(new vb(S,R,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.")},OB=class extends wb{constructor(e){let{type:t,inputs:n,name:r,precision:s,inputsCode:o,blockCode:a,headerCode:l}=n3e(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}},BB=class extends xC{parseFunction(e){return new OB(e)}},cc=[],Xf=[],TK=Ht(0,"int").setGroup(Kt),UB=class extends Bh{constructor(e,t){super(),this.renderer=e,this.backend=t,this.nodeFrame=new _C,this.nodeBuilderCache=new Map,this.callHashCache=new Oh,this.groupsData=new Oh,this._buildQueue=[],this._buildInProgress=!1,this.cacheLib={}}updateGroup(e){let t=e.groupNode;if(t.updateType===_n.OBJECT)return!0;cc[0]=t,cc[1]=e;let n=this.groupsData.get(cc);return n===void 0&&this.groupsData.set(cc,n={}),cc[0]=null,cc[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 mr),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 mr),l.build();let u=c.stackTrace;!u&&c.stack&&(u=new kr(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 lB(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){cc[0]=e,cc[1]=t;let n=this.renderer.info.calls,r=this.callHashCache.get(cc)||{};if(r.callId!==n){if(Xf.push(this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview?1:0),Xf.push(this.renderer.lighting.enabled?1:0),this.renderer.lighting.enabled){Xf.push(t.getCacheKey(!0)),Xf.push(this.renderer.shadowMap.enabled?1:0),Xf.push(this.renderer.shadowMap.type);let o=this.getEnvironmentNode(e);o&&Xf.push(o.getCacheKey())}let s=this.getFogNode(e);s&&Xf.push(s.getCacheKey()),r.callId=n,r.cacheKey=Mb(Xf),this.callHashCache.set(cc,r),Xf.length=0}return cc[0]=null,cc[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===lp||n.mapping===cp||n.mapping===Yu){if(e.backgroundBlurriness>0||n.mapping===Yu)return $U(n);{let o;return n.isCubeTexture===!0?o=Ra(n):o=li(n),tee(o)}}else{if(n.isTexture===!0)return li(n,su.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=ir("color","color",n).setGroup(Kt),o=ir("density","float",n).setGroup(Kt);return QO(s,Bee(o))}else if(n.isFog){let s=ir("color","color",n).setGroup(Kt),o=ir("near","float",n).setGroup(Kt),a=ir("far","float",n).setGroup(Kt);return QO(s,Oee(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 Ra(n);if(n.isTexture===!0)return li(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=li(e,su).depth(od("gl_ViewID_OVR")).renderOutput(t.toneMapping,t.currentColorSpace):n=li(e,su).depth(TK).renderOutput(t.toneMapping,t.currentColorSpace):n=li(e,su).renderOutput(t.toneMapping,t.currentColorSpace),n}setOutputLayerIndex(e){TK.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 _C,this.nodeBuilderCache=new Map,this.cacheLib={}}},F8=new ha,yC=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++){F8.copy(e[s]).applyMatrix4(this.viewMatrix,this.viewNormalMatrix);let o=t[n+s],a=F8.normal;o.x=-a.x,o.y=-a.y,o.z=-a.z,o.w=F8.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}},kB=class{constructor(e,t,n){this.bundleGroup=e,this.camera=t,this.renderContext=n}},Yp=[],GB=class{constructor(){this.bundles=new Oh}get(e,t,n){let r=this.bundles;Yp[0]=e,Yp[1]=t,Yp[2]=n;let s=r.get(Yp);return s===void 0&&(s=new kB(e,t,n),r.set(Yp,s)),Yp[0]=null,Yp[1]=null,Yp[2]=null,s}dispose(){this.bundles=new Oh}},vC=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)}},i3e=new xb,EK=new WeakMap,zB=class{constructor(){this.enabled=!0,this._cache=[]}createNode(e=[]){return new xb().setLights(e)}getNode(e){if(e.isScene!==!0&&e.isGroup!==!0)return i3e;let t=EK.get(e);return t===void 0&&(t=this.createNode(),EK.set(e,t)),t}beginRender(e){this._cache.push(this.getNode(e).getLights())}finishRender(e){this.getNode(e).setLights(this._cache.pop())}},Rm=class extends da{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}},MK=new ie,CK=new ie,RK=new WeakMap,VB=class extends Ho{constructor(e,t=!1){super(),this.enabled=!1,this.isPresenting=!1,this.cameraAutoUpdate=!0,this._renderer=e,this._cameraL=new Lr,this._cameraL.viewport=new gn,this._cameraL.matrixWorldAutoUpdate=!1,this._cameraR=new Lr,this._cameraR.viewport=new gn,this._cameraR.matrixWorldAutoUpdate=!1,this._cameras=[this._cameraL,this._cameraR],this._cameraXR=new R_,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=c3e.bind(this),this._gl=null,this._currentAnimationContext=null,this._currentAnimationLoop=null,this._currentPixelRatio=null,this._currentSamples=null,this._currentSize=new Oe,this._onSessionEvent=o3e.bind(this),this._onSessionEnd=a3e.bind(this),this._onInputSourcesChange=l3e.bind(this),this._onAnimationFrame=u3e.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){Qn(`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&&(Qn("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 da(n.textureWidth,n.textureHeight,{depth:2,minFilter:bi,magFilter:bi,depthBuffer:!0,multiview:!1,useArrayDepthTexture:!0,samples:0}),this._xrRenderTarget.texture.isArrayTexture=!0,this._useMultiviewIfPossible===!0&&Qn("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 DA(e,t),u=new Rm(s,o,{format:wr,type:Vi,depthTexture:new us(s,o,l.stencil?Wo:Ai,void 0,void 0,void 0,void 0,void 0,void 0,l.stencil?eo:Ts),stencilBuffer:l.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});u._autoAllocateDepthBuffer=!0;let f=new Kr({color:16777215,side:xo});f.map=u.texture,f.map.offset.y=1,f.map.repeat.y=-1;let p=new Gn(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 Kr({color:16777215,side:xo}),x.plane.material.blending=Uf,x.plane.material.blendEquation=zs,x.plane.material.blendSrc=Xc,x.plane.material.blendDst=Xc,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 IA(e,e,e*t/n,64,64,!0,Math.PI-t/2,t),f=new Rm(o,a,{format:wr,type:Vi,depthTexture:new us(o,a,c.stencil?Wo:Ai,void 0,void 0,void 0,void 0,void 0,void 0,c.stencil?eo:Ts),stencilBuffer:c.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});f._autoAllocateDepthBuffer=!0;let p=new Kr({color:16777215,side:hi});p.map=f.texture,p.map.offset.y=1,p.map.repeat.y=-1;let x=new Gn(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 Kr({color:16777215,side:hi}),v.plane.material.blending=Uf,v.plane.material.blendEquation=zs,v.plane.material.blendSrc=Xc,v.plane.material.blendDst=Xc,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 Es,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=RK.get(l),c===void 0&&(c=l.context({getOutput:f=>xU(f,n.toneMapping,n.outputColorSpace)}),RK.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?eo:Ts,s=t.stencil?Wo:Ai);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 us(c.textureWidth,c.textureHeight,s,void 0,void 0,void 0,void 0,void 0,void 0,r,f);if(this._xrRenderTarget=new Rm(c.textureWidth,c.textureHeight,{format:wr,type:Vi,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 Kr({color:16777215,side:x.type==="cylinder"?hi:xo}),x.plane.material.blending=Uf,x.plane.material.blendEquation=zs,x.plane.material.blendSrc=Xc,x.plane.material.blendDst=Xc,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 Rm(s.framebufferWidth,s.framebufferHeight,{format:wr,type:Vi,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;PK(s,l);for(let u=0;u<c.length;u++)PK(c[u],l);c.length===2?r3e(s,o,a):s.projectionMatrix.copy(o.projectionMatrix),s3e(e,s,l)}_getController(e){let t=this._controllers[e];return t===void 0&&(t=new Qd,this._controllers[e]=t),t}};function r3e(i,e,t){MK.setFromMatrixPosition(e.matrixWorld),CK.setFromMatrixPosition(t.matrixWorld);let n=MK.distanceTo(CK),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,R=p-w,P=x+(n-w),C=l*a/T*S,L=c*a/T*S;i.projectionMatrix.makePerspective(R,P,C,L,S,T),i.projectionMatrixInverse.copy(i.projectionMatrix).invert()}}function PK(i,e){e===null?i.matrixWorld.copy(i.matrix):i.matrixWorld.multiplyMatrices(e.matrixWorld,i.matrix),i.matrixWorldInverse.copy(i.matrixWorld).invert()}function s3e(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=Lf*2*Math.atan(1/i.projectionMatrix.elements[5]),i.zoom=1)}function o3e(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 a3e(){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 Rm(t.pixelwidth,t.pixelheight,{format:wr,type:Vi,depthTexture:new us(t.pixelwidth,t.pixelheight,t.stencilBuffer?Wo:Ai,void 0,void 0,void 0,void 0,void 0,void 0,t.stencilBuffer?eo:Ts),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 l3e(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 c3e(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 u3e(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 Lr,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 qB=class extends Ho{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 PA,this.depthTexture=new us}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"})}},IK=new Jd,d1=new Oe,O8=new gn,lM=new ec,cM=new Ry,p1=new on,$f=new gn,h3e={[xo]:hi,[hi]:xo,[sr]:sr},HB=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=Fi,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=vr,this.toneMapping=Vs,this.toneMappingExposure=1,this.sortObjects=!0,this.depth=o,this.stencil=a,this.info=new bO,this.contextNode=sd(),this.library=new vC,this.lighting=new zB,this._samples=c||l===!0?4:0,this._onCanvasTargetResize=this._onCanvasTargetResize.bind(this),this._canvasTarget=new qB(e.getDomElement()),this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize),this._canvasTarget.isDefaultCanvasTarget=!0,this._inspector=new GM,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 Ab(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:ap},this.xr=new VB(this,p),this.debug={checkShaderErrors:!0,onShaderError:null,getShaderAsync:async(v,w,S)=>{await this.compileAsync(S,w,v);let R=this.needsFrameBufferTarget&&this._renderTarget===null?this._getFrameBufferTarget():this._renderTarget||this._outputRenderTarget,P=this._renderLists.get(v,w),C=this._renderContexts.get(R,this._mrt),L=v.overrideMaterial||S.material,D=this._objects.get(S,L,v,w,P.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 gO(this,this._nodes,this.info),this._attributes=new yO(n,this.info),this._background=new aB(this,this._nodes),this._geometries=new vO(this._attributes,this.info),this._textures=new IO(this,n,this.info),this._pipelines=new TO(n,this._nodes,this.info),this._bindings=new EO(n,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new xO(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new CO(this.lighting),this._bundles=new GB,this._renderContexts=new PO(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:IK,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 yC),x.clippingContext.updateGlobal(u,t),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t=this._updateCamera(t),u.onBeforeRender(this,e,t,p);let S=t.isArrayCamera?cM:lM;t.isArrayCamera?S.setFromArrayCamera(t):(p1.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),S.setFromProjectionMatrix(p1,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 R=T.opaque,P=T.transparent,C=T.transparentDoublePass,L=T.lightsNode;this.opaque===!0&&R.length>0&&this._renderObjects(R,t,u,L),this.transparent===!0&&P.length>0&&this._renderTransparents(P,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 zL()}}async renderAsync(e,t){Qn('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=wF,t.modelNormalViewMatrix=SF):this.highPrecision&&(delete t.modelViewMatrix,delete t.modelNormalViewMatrix)}get highPrecision(){let e=this.contextNode.value;return e.modelViewMatrix===wF&&e.modelNormalViewMatrix===SF}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getOutputBufferType(){return this._outputBufferType}getColorBufferType(){return Qn('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!==Vs,r=t!==sn.workingColorSpace;if(n===!1&&r===!1)return null;let{width:s,height:o}=this.getDrawingBufferSize(f1),{depth:a,stencil:l}=this,c=this._outputRenderTarget||this._canvasTarget,u=this._frameBufferTargets.get(c);if(u===void 0){u=new da(s,o,{depthBuffer:a,stencilBuffer:l,type:this._outputBufferType,format:wr,colorSpace:sn.workingColorSpace,generateMipmaps:!1,minFilter:bi,magFilter:bi,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:RK,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(f1),F8.set(0,0,f1.width,f1.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(F8)===!1,w.scissorValue.copy(P).multiplyScalar(R).floor(),w.scissor=S._scissorTest&&w.scissorValue.equals(F8)===!1,w.scissorValue.width>>=x,w.scissorValue.height>>=x,w.clippingContext||(w.clippingContext=new xC),w.clippingContext.updateGlobal(u,t),u.onBeforeRender(this,e,t,v);let D=t.isArrayCamera?lM:aM;t.isArrayCamera?D.setFromArrayCamera(t):(d1.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),D.setFromProjectionMatrix(d1,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=f1.width,w.height=f1.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($f.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 mb(new mr),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){Qn('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(){Qn('Renderer: "clearColorAsync()" has been deprecated. Use "clearColor()" and "await renderer.init();" when creating the renderer.'),this.clear(!0,!1,!1)}async clearDepthAsync(){Qn('Renderer: "clearDepthAsync()" has been deprecated. Use "clearDepth()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!0,!1)}async clearStencilAsync(){Qn('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!==Vs,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:Vs}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 Qn('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){Qn('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=$f.set(t.x,t.y,e.image.width,e.image.height).floor();else if(t.isVector4)t=$f.copy(t).floor();else{Ge("Renderer.copyFramebufferToTexture: Invalid rectangle.");return}else t=$f.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?lM:aM;if(!e.frustumCulled||l.intersectsSprite(e)){this.sortObjects===!0&&$f.setFromMatrixPosition(e.matrixWorld).applyMatrix4(d1);let{geometry:c,material:u}=e;u.visible&&r.push(e,c,u,n,$f.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?lM:aM;if(!e.frustumCulled||l.intersectsObject(e)){let{geometry:c,material:u}=e;if(this.sortObjects===!0&&(c.boundingSphere===null&&c.computeBoundingSphere(),$f.copy(c.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4(d1)),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,$f.z,v,s)}}else u.visible&&r.push(e,c,u,n,$f.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=hi;this._renderObjects(t,n,r,s,"backSide");for(let{material:o}of t)o.side=_o;this._renderObjects(e,n,r,s);for(let{material:o}of t)o.side=sr}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&&Qn("Renderer: `shadowMap.transmitted` needs to be set to `true` when using `material.castShadowNode`.")):(f=pe(0),p=se(1)),r&&(p=p.mul(ir("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===tc?R.side=s.shadowSide!==null?s.shadowSide:s.side:R.side=s.shadowSide!==null?s.shadowSide:a3e[s.side],C!==null&&(R.colorNode=C),L!==null&&(R.depthNode=L),D!==null&&(R.positionNode=D)}s=R}s.transparent===!0&&s.side===sr&&s.forceSinglePass===!1?(s.side=hi,this._handleObjectFunction(e,s,t,n,a,o,l,"backSide"),s.side=_o,this._handleObjectFunction(e,s,t,n,a,o,l,c),s.side=sr):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}},vC=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 ote(i){return i+(s0-i%s0)%s0}var bC=class extends vC{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 ote(this._buffer.byteLength)}get buffer(){return this._buffer}update(){return!0}release(){this._buffer=null}},wC=class extends bC{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}},l3e=0,SC=class extends wC{constructor(e,t){super("UniformBuffer_"+l3e++,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 ote(this.buffer.byteLength)}get buffer(){return this.nodeUniform.value}},HB=class extends wC{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%s0,c=l%o,u=l+c;t+=c,u!==0&&s0-u<a&&(t+=s0-u),s.offset=t/e,s.index=n,t+=a}return Math.ceil(t/s0)*s0}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 u3e(n,r,s)===!1&&(this.buffer.set(r,s),c3e(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 c3e(i,e,t){for(let n=0,r=e.length;n<r;n++)i[t+n]=e[n]}function u3e(i,e,t){for(let n=0,r=e.length;n<r;n++)if(i[t+n]!==e[n])return!1;return!0}var h3e=0,TC=class extends HB{constructor(e,t){super(e),this.id=h3e++,this.groupNode=t,this.isNodeUniformsGroup=!0}},EC=class extends vC{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}},f3e=0,WB=class extends EC{constructor(e,t){super(e,t),this.id=f3e++,this.store=!1,this.mipLevel=0,this.isSampledTexture=!0}},k1=class extends WB{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()}},MC=class extends k1{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledCubeTexture=!0}},bb=class extends k1{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledTexture3D=!0}},PK={bitcast_int_uint:new Ji("uint tsl_bitcast_int_to_uint ( int x ) { return floatBitsToUint( intBitsToFloat ( x ) ); }"),bitcast_uint_int:new Ji("uint tsl_bitcast_uint_to_int ( uint x ) { return floatBitsToInt( uintBitsToFloat ( x ) ); }"),textureGather:new Ji(`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!==Vs,r=t!==sn.workingColorSpace;if(n===!1&&r===!1)return null;let{width:s,height:o}=this.getDrawingBufferSize(d1),{depth:a,stencil:l}=this,c=this._outputRenderTarget||this._canvasTarget,u=this._frameBufferTargets.get(c);if(u===void 0){u=new da(s,o,{depthBuffer:a,stencilBuffer:l,type:this._outputBufferType,format:wr,colorSpace:sn.workingColorSpace,generateMipmaps:!1,minFilter:bi,magFilter:bi,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:IK,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,R=S._scissor,P=S._pixelRatio;v!==null&&(T=v.viewport,R=v.scissor,P=1),this.getDrawingBufferSize(d1),O8.set(0,0,d1.width,d1.height);let C=T.minDepth===void 0?0:T.minDepth,L=T.maxDepth===void 0?1:T.maxDepth;w.viewportValue.copy(T).multiplyScalar(P).floor(),w.viewportValue.width>>=x,w.viewportValue.height>>=x,w.viewportValue.minDepth=C,w.viewportValue.maxDepth=L,w.viewport=w.viewportValue.equals(O8)===!1,w.scissorValue.copy(R).multiplyScalar(P).floor(),w.scissor=S._scissorTest&&w.scissorValue.equals(O8)===!1,w.scissorValue.width>>=x,w.scissorValue.height>>=x,w.clippingContext||(w.clippingContext=new yC),w.clippingContext.updateGlobal(u,t),u.onBeforeRender(this,e,t,v);let D=t.isArrayCamera?cM:lM;t.isArrayCamera?D.setFromArrayCamera(t):(p1.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),D.setFromProjectionMatrix(p1,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=d1.width,w.height=d1.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($f.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 _b(new mr),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){Qn('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(){Qn('Renderer: "clearColorAsync()" has been deprecated. Use "clearColor()" and "await renderer.init();" when creating the renderer.'),this.clear(!0,!1,!1)}async clearDepthAsync(){Qn('Renderer: "clearDepthAsync()" has been deprecated. Use "clearDepth()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!0,!1)}async clearStencilAsync(){Qn('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!==Vs,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:Vs}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 Qn('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){Qn('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=$f.set(t.x,t.y,e.image.width,e.image.height).floor();else if(t.isVector4)t=$f.copy(t).floor();else{Ge("Renderer.copyFramebufferToTexture: Invalid rectangle.");return}else t=$f.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?cM:lM;if(!e.frustumCulled||l.intersectsSprite(e)){this.sortObjects===!0&&$f.setFromMatrixPosition(e.matrixWorld).applyMatrix4(p1);let{geometry:c,material:u}=e;u.visible&&r.push(e,c,u,n,$f.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?cM:lM;if(!e.frustumCulled||l.intersectsObject(e)){let{geometry:c,material:u}=e;if(this.sortObjects===!0&&(c.boundingSphere===null&&c.computeBoundingSphere(),$f.copy(c.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4(p1)),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,$f.z,v,s)}}else u.visible&&r.push(e,c,u,n,$f.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=hi;this._renderObjects(t,n,r,s,"backSide");for(let{material:o}of t)o.side=xo;this._renderObjects(e,n,r,s);for(let{material:o}of t)o.side=sr}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&&Qn("Renderer: `shadowMap.transmitted` needs to be set to `true` when using `material.castShadowNode`.")):(f=pe(0),p=se(1)),r&&(p=p.mul(ir("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,R=this._currentSourceMaterial;if(e.onBeforeRender(this,t,n,r,s,o),s.allowOverride===!0&&t.overrideMaterial!==null){this._currentSourceMaterial=s;let P=t.overrideMaterial;if(u=!0,f=P.isNodeMaterial?P.colorNode:null,p=P.isNodeMaterial?P.depthNode:null,x=P.isNodeMaterial?P.positionNode:null,v=t.overrideMaterial.side,w=P.displacementMap,S=P.displacementScale,T=P.displacementBias,s.positionNode&&s.positionNode.isNode&&(P.positionNode=s.positionNode),P.alphaTest=s.alphaTest,P.alphaMap=s.alphaMap,P.displacementMap=s.displacementMap,P.displacementScale=s.displacementScale,P.displacementBias=s.displacementBias,P.transparent=s.transparent||s.transmission>0||s.transmissionNode&&s.transmissionNode.isNode||s.backdropNode&&s.backdropNode.isNode,P.isShadowPassMaterial){let{colorNode:C,depthNode:L,positionNode:D}=this._getShadowNodes(s);this.shadowMap.type===tc?P.side=s.shadowSide!==null?s.shadowSide:s.side:P.side=s.shadowSide!==null?s.shadowSide:h3e[s.side],C!==null&&(P.colorNode=C),L!==null&&(P.depthNode=L),D!==null&&(P.positionNode=D)}s=P}s.transparent===!0&&s.side===sr&&s.forceSinglePass===!1?(s.side=hi,this._handleObjectFunction(e,s,t,n,a,o,l,"backSide"),s.side=xo,this._handleObjectFunction(e,s,t,n,a,o,l,c),s.side=sr):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=R,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}},bC=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 lte(i){return i+(s0-i%s0)%s0}var wC=class extends bC{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 lte(this._buffer.byteLength)}get buffer(){return this._buffer}update(){return!0}release(){this._buffer=null}},SC=class extends wC{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}},f3e=0,TC=class extends SC{constructor(e,t){super("UniformBuffer_"+f3e++,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 lte(this.buffer.byteLength)}get buffer(){return this.nodeUniform.value}},WB=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%s0,c=l%o,u=l+c;t+=c,u!==0&&s0-u<a&&(t+=s0-u),s.offset=t/e,s.index=n,t+=a}return Math.ceil(t/s0)*s0}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 p3e(n,r,s)===!1&&(this.buffer.set(r,s),d3e(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 d3e(i,e,t){for(let n=0,r=e.length;n<r;n++)i[t+n]=e[n]}function p3e(i,e,t){for(let n=0,r=e.length;n<r;n++)if(i[t+n]!==e[n])return!1;return!0}var A3e=0,EC=class extends WB{constructor(e,t){super(e),this.id=A3e++,this.groupNode=t,this.isNodeUniformsGroup=!0}},MC=class extends bC{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}},m3e=0,jB=class extends MC{constructor(e,t){super(e,t),this.id=m3e++,this.store=!1,this.mipLevel=0,this.isSampledTexture=!0}},G1=class extends jB{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 G1{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledCubeTexture=!0}},Sb=class extends G1{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledTexture3D=!0}},NK={bitcast_int_uint:new Ji("uint tsl_bitcast_int_to_uint ( int x ) { return floatBitsToUint( intBitsToFloat ( x ) ); }"),bitcast_uint_int:new Ji("uint tsl_bitcast_uint_to_int ( uint x ) { return floatBitsToInt( uintBitsToFloat ( x ) ); }"),textureGather:new Ji(`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 ) );@@ -4221,7 +4221,7 @@ vec4 tsl_textureGatherCompare_array( sampler2DArrayShadow map, vec3 coord, ivec2
42214221 );42224222 return flipY ? ret.wzyx : ret;42234223 }4224-`)},d3e={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"},IK={low:"lowp",medium:"mediump",high:"highp"},NK={swizzleAssign:!0,storageBuffer:!1},LK={perspective:"smooth",linear:"noperspective"},DK={centroid:"centroid"},FK=`4224+`)},g3e={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"},LK={low:"lowp",medium:"mediump",high:"highp"},DK={swizzleAssign:!0,storageBuffer:!1},FK={perspective:"smooth",linear:"noperspective"},OK={centroid:"centroid"},BK=`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-`,jB=class extends mC{constructor(e,t){super(e,t,new OB),this.uniformGroups={},this.transforms=[],this.extensions={},this.builtins={vertex:[],fragment:[],compute:[]}}needsToWorkingColorSpace(e){return e.isVideoTexture===!0&&e.colorSpace!==Wo}_include(e){let t=PK[e];return t.build(this),this.addInclude(t),t}getMethod(e){return PK[e]!==void 0&&this._include(e),d3e[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+`,XB=class extends gC{constructor(e,t){super(e,t,new BB),this.uniformGroups={},this.transforms=[],this.extensions={},this.builtins={vertex:[],fragment:[],compute:[]}}needsToWorkingColorSpace(e){return e.isVideoTexture===!0&&e.colorSpace!==jo}_include(e){let t=NK[e];return t.build(this),this.addInclude(t),t}getMethod(e){return NK[e]!==void 0&&this._include(e),g3e[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?Qu:Gf;s===2?a=o?Ju:Rs:s===3?a=o?S2:kf:s===4&&(a=o?hp:wr);let l={Float32Array:Zi,Uint8Array:Vi,Uint16Array:Ka,Uint32Array:Ai,Int8Array:Ku,Int16Array:Zu,Int32Array:Fr,Uint8ClampedArray:Vi},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 RA(t.array,c,u,a,l[t.array.constructor.name]||Zi);x.needsUpdate=!0,x.isPBOTexture=!0;let v=new xc(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="."+jm.join("").slice(0,x),w=`ivec2(${a} % ${p}, ${a} / ${p})`,S=this.generateTextureLoad(null,o,w,"0",null,null),T="vec4";r.pbo.type===Ai?T="uvec4":r.pbo.type===Fr&&(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===Ai?f="u":u.type===Fr&&(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?Qu:Gf;s===2?a=o?Ju:Rs:s===3?a=o?E2:kf:s===4&&(a=o?hp:wr);let l={Float32Array:Zi,Uint8Array:Vi,Uint16Array:Ka,Uint32Array:Ai,Int8Array:Ku,Int16Array:Zu,Int32Array:Fr,Uint8ClampedArray:Vi},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 RA(t.array,c,u,a,l[t.array.constructor.name]||Zi);x.needsUpdate=!0,x.isPBOTexture=!0;let v=new xc(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="."+jm.join("").slice(0,x),w=`ivec2(${a} % ${p}, ${a} / ${p})`,S=this.generateTextureLoad(null,o,w,"0",null,null),T="vec4";r.pbo.type===Ai?T="uvec4":r.pbo.type===Fr&&(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===Ai?f="u":u.type===Fr&&(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=IK[w]+" "+S),f.push(" "+S)}r[c]=f}}l=!0}if(!l){let c=o.node.precision;c!==null&&(a=IK[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=LK[w]+" "+S),f.push(" "+S)}r[c]=f}}l=!0}if(!l){let c=o.node.precision;c!==null&&(a=LK[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!==Fr){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=LK[r.interpolationType]||r.interpolationType,a=DK[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=FK[r.interpolationType]||r.interpolationType,a=OK[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=LK[r.interpolationType]||r.interpolationType,a=DK[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=FK[r.interpolationType]||r.interpolationType,a=OK[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=NK[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)}NK[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=DK[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)}DK[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-${FK}4287+${BK}42884288 42894289 // structs42904290 ${e.structs}@@ -4323,7 +4323,7 @@ ${this.getSignature()}
43234323 ${e.extensions}43244324 43254325 // precision4326-${FK}4326+${BK}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 k1(s.name,s.node,l),u.push(a);else if(t==="cubeTexture"||t==="cubeDepthTexture")a=new MC(s.name,s.node,l),u.push(a);else if(t==="texture3D")a=new bb(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 SC(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 TC(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}},O8=null,p1=null,CC=class{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null,this.timestampQueryPool={[rc.RENDER]:null,[rc.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:")?rc.COMPUTE:rc.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){Qn("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 O8=O8||new Oe,this.renderer.getDrawingBufferSize(O8)}setScissorTest(){}getClearColor(){let e=this.renderer;return p1=p1||new db,e.getClearColor(p1),p1.getRGB(p1),p1}getDomElement(){let e=this.domElement;return e===null&&(e=this.parameters.canvas!==void 0?this.parameters.canvas:f3(),"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(){}},p3e=0,XB=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}},$B=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===Fr,id:p3e++};if(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute){let p=this._createBuffer(r,t,s,o);f=new XB(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}},Gv,Yf,YB=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;Gv={[zs]:e.FUNC_ADD,[o2]:e.FUNC_SUBTRACT,[a2]:e.FUNC_REVERSE_SUBTRACT},Yf={[Xc]:e.ZERO,[l2]:e.ONE,[c2]:e.SRC_COLOR,[Xd]:e.SRC_ALPHA,[A2]:e.SRC_ALPHA_SATURATE,[d2]:e.DST_COLOR,[h2]:e.DST_ALPHA,[u2]:e.ONE_MINUS_SRC_COLOR,[$d]:e.ONE_MINUS_SRC_ALPHA,[p2]:e.ONE_MINUS_DST_COLOR,[f2]: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!==n3?(this.enable(t.CULL_FACE),e!==this.currentCullFace&&(e===r2?t.cullFace(t.BACK):e===i3?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){Qn("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===s2?l=n:c.blending!==Zr&&(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===Uf){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,Gv[l],Gv[p]),r.blendFuncSeparateiOES(e,Yf[o],Yf[a],Yf[u],Yf[f])}else if(r.blendEquationSeparateiOES(e,n.FUNC_ADD,n.FUNC_ADD),c)switch(s){case cs:r.blendFuncSeparateiOES(e,n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case ju:r.blendFuncSeparateiOES(e,n.ONE,n.ONE,n.ONE,n.ONE);break;case Xu:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case $u: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 cs:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case ju:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case Xu:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case $u: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===Zr){this.currentBlendingEnabled===!0&&(this.disable(c.BLEND),this.currentBlendingEnabled=!1);return}if(this.currentBlendingEnabled===!1&&(this.enable(c.BLEND),this.currentBlendingEnabled=!0),e!==Uf){if(e!==this.currentBlending||l!==this.currentPremultipledAlpha){if((this.currentBlendEquation!==zs||this.currentBlendEquationAlpha!==zs)&&(c.blendEquation(c.FUNC_ADD),this.currentBlendEquation=zs,this.currentBlendEquationAlpha=zs),l)switch(e){case cs:c.blendFuncSeparate(c.ONE,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA);break;case ju:c.blendFunc(c.ONE,c.ONE);break;case Xu:c.blendFuncSeparate(c.ZERO,c.ONE_MINUS_SRC_COLOR,c.ZERO,c.ONE);break;case $u: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 cs:c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA);break;case ju:c.blendFuncSeparate(c.SRC_ALPHA,c.ONE,c.ONE,c.ONE);break;case Xu:Ge("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case $u: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(Gv[t],Gv[s]),this.currentBlendEquation=t,this.currentBlendEquationAlpha=s),(n!==this.currentBlendSrc||r!==this.currentBlendDst||o!==this.currentBlendSrcAlpha||a!==this.currentBlendDstAlpha)&&(c.blendFuncSeparate(Yf[n],Yf[r],Yf[o],Yf[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=P2[e]),this.currentDepthFunc!==e){let{gl:t}=this;switch(e){case gA:t.depthFunc(t.NEVER);break;case _A:t.depthFunc(t.ALWAYS);break;case xA:t.depthFunc(t.LESS);break;case zu:t.depthFunc(t.LEQUAL);break;case yA:t.depthFunc(t.EQUAL);break;case vA:t.depthFunc(t.GEQUAL);break;case bA:t.depthFunc(t.GREATER);break;case wA: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===sr?this.disable(r.CULL_FACE):this.enable(r.CULL_FACE);let s=e.side===hi;t&&(s=!s),this.setFlipSided(s),e.blending===cs&&e.transparent===!1?this.setBlending(Zr):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)}},KB=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.extensions=e.extensions}convert(e,t=Wo){let{gl:n,extensions:r}=this,s,o=sn.getTransfer(t);if(e===Vi)return n.UNSIGNED_BYTE;if(e===zA)return n.UNSIGNED_SHORT_4_4_4_4;if(e===VA)return n.UNSIGNED_SHORT_5_5_5_1;if(e===qA)return n.UNSIGNED_INT_5_9_9_9_REV;if(e===HA)return n.UNSIGNED_INT_10F_11F_11F_REV;if(e===Ku)return n.BYTE;if(e===Zu)return n.SHORT;if(e===Ka)return n.UNSIGNED_SHORT;if(e===Fr)return n.INT;if(e===Ai)return n.UNSIGNED_INT;if(e===Zi)return n.FLOAT;if(e===Fi)return n.HALF_FLOAT;if(e===I_)return n.ALPHA;if(e===kf)return n.RGB;if(e===wr)return n.RGBA;if(e===Ts)return n.DEPTH_COMPONENT;if(e===eo)return n.DEPTH_STENCIL;if(e===Gf)return n.RED;if(e===Qu)return n.RED_INTEGER;if(e===Rs)return n.RG;if(e===Ju)return n.RG_INTEGER;if(e===hp)return n.RGBA_INTEGER;if(e===eh||e===th||e===nh||e===ih)if(o===Bt)if(s=r.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(e===eh)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(e===th)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(e===nh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(e===ih)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=r.get("WEBGL_compressed_texture_s3tc"),s!==null){if(e===eh)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===th)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===nh)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===ih)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(e===WA||e===jA||e===XA||e===$A)if(s=r.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(e===WA)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===jA)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===XA)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===$A)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(e===fp||e===dp||e===pp||e===Ap||e===mp||e===rh||e===gp)if(s=r.get("WEBGL_compressed_texture_etc"),s!==null){if(e===fp||e===dp)return o===Bt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(e===pp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(e===Ap)return s.COMPRESSED_R11_EAC;if(e===mp)return s.COMPRESSED_SIGNED_R11_EAC;if(e===rh)return s.COMPRESSED_RG11_EAC;if(e===gp)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(e===_p||e===xp||e===yp||e===vp||e===bp||e===wp||e===Sp||e===Tp||e===Ep||e===Mp||e===Cp||e===Rp||e===Pp||e===Ip)if(s=r.get("WEBGL_compressed_texture_astc"),s!==null){if(e===_p)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(e===xp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(e===yp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(e===vp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(e===bp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(e===wp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(e===Sp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(e===Tp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(e===Ep)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(e===Mp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(e===Cp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(e===Rp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(e===Pp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(e===Ip)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(e===Np||e===Lp||e===Dp)if(s=r.get("EXT_texture_compression_bptc"),s!==null){if(e===Np)return o===Bt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(e===Lp)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(e===Dp)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(e===Fp||e===Op||e===sh||e===Bp)if(s=r.get("EXT_texture_compression_rgtc"),s!==null){if(e===Fp)return s.COMPRESSED_RED_RGTC1_EXT;if(e===Op)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(e===sh)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(e===Bp)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return e===Ho?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()})}},OK=!1,cM,B8,BK,ZB=class{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},this._srcFramebuffer=null,this._dstFramebuffer=null,OK===!1&&(this._init(),OK=!0)}_init(){let e=this.gl;cM={[If]:e.REPEAT,[Vo]:e.CLAMP_TO_EDGE,[Nf]:e.MIRRORED_REPEAT},B8={[yi]:e.NEAREST,[w2]:e.NEAREST_MIPMAP_NEAREST,[ic]:e.NEAREST_MIPMAP_LINEAR,[bi]:e.LINEAR,[up]:e.LINEAR_MIPMAP_NEAREST,[yo]:e.LINEAR_MIPMAP_LINEAR},BK={[E2]:e.NEVER,[R2]:e.ALWAYS,[N_]:e.LESS,[oh]:e.LEQUAL,[M2]:e.EQUAL,[$c]:e.GEQUAL,[YA]:e.GREATER,[C2]: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?Kd: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?Kd: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===Wo?null:sn.getPrimaries(t.colorSpace),c=t.colorSpace===Wo||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,cM[t.wrapS]),n.texParameteri(e,n.TEXTURE_WRAP_T,cM[t.wrapT]),(e===n.TEXTURE_3D||e===n.TEXTURE_2D_ARRAY)&&(t.isArrayTexture||n.texParameteri(e,n.TEXTURE_WRAP_R,cM[t.wrapR])),n.texParameteri(e,n.TEXTURE_MAG_FILTER,B8[t.magFilter]);let u=t.mipmaps!==void 0&&t.mipmaps.length>0,f=t.minFilter===bi&&u?yo:t.minFilter;if(n.texParameteri(e,n.TEXTURE_MIN_FILTER,B8[f]),t.compareFunction&&(n.texParameteri(e,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(e,n.TEXTURE_COMPARE_FUNC,BK[t.compareFunction])),r.has("EXT_texture_filter_anisotropic")===!0){if(t.magFilter===yi||t.minFilter!==ic&&t.minFilter!==yo||t.type===Zi&&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=uM(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=uM(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=I2(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=uM(v);n.texSubImage2D(a,p,0,0,v.width,v.height,l,c,w)}else{let p=uM(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],be=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,be),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 uM(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 QB=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)}},JB=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}},UK={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"},e7=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)}}},RC=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(){}},t7=class extends RC{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 Qn(`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}}},PC=class extends CC{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 QB(this),this.capabilities=new JB(this),this.attributeUtils=new $B(this),this.textureUtils=new ZB(this),this.bufferRenderer=new e7(this),this.state=new YB(this),this.utils=new KB(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 go}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 t7(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(rc.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(rc.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(rc.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)?(Qn("WebGLBackend.compute(): The count parameter must be a single number, not an array."),s=s[0]):s&&typeof s=="object"&&s.isIndirectStorageBufferAttribute&&(Qn("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(rc.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,be=ae.width*V,Ie=ae.height*V;c.viewport(Math.floor(ce),Math.floor(e.context.height-Ie-de),Math.floor(be),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 jB(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 G1(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 Sb(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 TC(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 EC(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}},B8=null,A1=null,RC=class{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null,this.timestampQueryPool={[rc.RENDER]:null,[rc.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:")?rc.COMPUTE:rc.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){Qn("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 B8=B8||new Oe,this.renderer.getDrawingBufferSize(B8)}setScissorTest(){}getClearColor(){let e=this.renderer;return A1=A1||new Ab,e.getClearColor(A1),A1.getRGB(A1),A1}getDomElement(){let e=this.domElement;return e===null&&(e=this.parameters.canvas!==void 0?this.parameters.canvas:d3(),"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(){}},_3e=0,$B=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}},YB=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===Fr,id:_3e++};if(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute){let p=this._createBuffer(r,t,s,o);f=new $B(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}},Vv,Yf,KB=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;Vv={[zs]:e.FUNC_ADD,[l2]:e.FUNC_SUBTRACT,[c2]:e.FUNC_REVERSE_SUBTRACT},Yf={[Xc]:e.ZERO,[u2]:e.ONE,[h2]:e.SRC_COLOR,[Xd]:e.SRC_ALPHA,[g2]:e.SRC_ALPHA_SATURATE,[A2]:e.DST_COLOR,[d2]:e.DST_ALPHA,[f2]:e.ONE_MINUS_SRC_COLOR,[$d]:e.ONE_MINUS_SRC_ALPHA,[m2]:e.ONE_MINUS_DST_COLOR,[p2]: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!==i3?(this.enable(t.CULL_FACE),e!==this.currentCullFace&&(e===o2?t.cullFace(t.BACK):e===r3?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){Qn("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===a2?l=n:c.blending!==Qr&&(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===Uf){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,Vv[l],Vv[p]),r.blendFuncSeparateiOES(e,Yf[o],Yf[a],Yf[u],Yf[f])}else if(r.blendEquationSeparateiOES(e,n.FUNC_ADD,n.FUNC_ADD),c)switch(s){case cs:r.blendFuncSeparateiOES(e,n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case ju:r.blendFuncSeparateiOES(e,n.ONE,n.ONE,n.ONE,n.ONE);break;case Xu:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case $u: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 cs:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case ju:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case Xu:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case $u: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===Qr){this.currentBlendingEnabled===!0&&(this.disable(c.BLEND),this.currentBlendingEnabled=!1);return}if(this.currentBlendingEnabled===!1&&(this.enable(c.BLEND),this.currentBlendingEnabled=!0),e!==Uf){if(e!==this.currentBlending||l!==this.currentPremultipledAlpha){if((this.currentBlendEquation!==zs||this.currentBlendEquationAlpha!==zs)&&(c.blendEquation(c.FUNC_ADD),this.currentBlendEquation=zs,this.currentBlendEquationAlpha=zs),l)switch(e){case cs:c.blendFuncSeparate(c.ONE,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA);break;case ju:c.blendFunc(c.ONE,c.ONE);break;case Xu:c.blendFuncSeparate(c.ZERO,c.ONE_MINUS_SRC_COLOR,c.ZERO,c.ONE);break;case $u: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 cs:c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA);break;case ju:c.blendFuncSeparate(c.SRC_ALPHA,c.ONE,c.ONE,c.ONE);break;case Xu:Ge("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case $u: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(Vv[t],Vv[s]),this.currentBlendEquation=t,this.currentBlendEquationAlpha=s),(n!==this.currentBlendSrc||r!==this.currentBlendDst||o!==this.currentBlendSrcAlpha||a!==this.currentBlendDstAlpha)&&(c.blendFuncSeparate(Yf[n],Yf[r],Yf[o],Yf[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=N2[e]),this.currentDepthFunc!==e){let{gl:t}=this;switch(e){case gA:t.depthFunc(t.NEVER);break;case _A:t.depthFunc(t.ALWAYS);break;case xA:t.depthFunc(t.LESS);break;case zu:t.depthFunc(t.LEQUAL);break;case yA:t.depthFunc(t.EQUAL);break;case vA:t.depthFunc(t.GEQUAL);break;case bA:t.depthFunc(t.GREATER);break;case wA: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===sr?this.disable(r.CULL_FACE):this.enable(r.CULL_FACE);let s=e.side===hi;t&&(s=!s),this.setFlipSided(s),e.blending===cs&&e.transparent===!1?this.setBlending(Qr):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)}},ZB=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.extensions=e.extensions}convert(e,t=jo){let{gl:n,extensions:r}=this,s,o=sn.getTransfer(t);if(e===Vi)return n.UNSIGNED_BYTE;if(e===zA)return n.UNSIGNED_SHORT_4_4_4_4;if(e===VA)return n.UNSIGNED_SHORT_5_5_5_1;if(e===qA)return n.UNSIGNED_INT_5_9_9_9_REV;if(e===HA)return n.UNSIGNED_INT_10F_11F_11F_REV;if(e===Ku)return n.BYTE;if(e===Zu)return n.SHORT;if(e===Ka)return n.UNSIGNED_SHORT;if(e===Fr)return n.INT;if(e===Ai)return n.UNSIGNED_INT;if(e===Zi)return n.FLOAT;if(e===Fi)return n.HALF_FLOAT;if(e===N_)return n.ALPHA;if(e===kf)return n.RGB;if(e===wr)return n.RGBA;if(e===Ts)return n.DEPTH_COMPONENT;if(e===eo)return n.DEPTH_STENCIL;if(e===Gf)return n.RED;if(e===Qu)return n.RED_INTEGER;if(e===Rs)return n.RG;if(e===Ju)return n.RG_INTEGER;if(e===hp)return n.RGBA_INTEGER;if(e===eh||e===th||e===nh||e===ih)if(o===Bt)if(s=r.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(e===eh)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(e===th)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(e===nh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(e===ih)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=r.get("WEBGL_compressed_texture_s3tc"),s!==null){if(e===eh)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===th)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===nh)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===ih)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(e===WA||e===jA||e===XA||e===$A)if(s=r.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(e===WA)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===jA)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===XA)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===$A)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(e===fp||e===dp||e===pp||e===Ap||e===mp||e===rh||e===gp)if(s=r.get("WEBGL_compressed_texture_etc"),s!==null){if(e===fp||e===dp)return o===Bt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(e===pp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(e===Ap)return s.COMPRESSED_R11_EAC;if(e===mp)return s.COMPRESSED_SIGNED_R11_EAC;if(e===rh)return s.COMPRESSED_RG11_EAC;if(e===gp)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(e===_p||e===xp||e===yp||e===vp||e===bp||e===wp||e===Sp||e===Tp||e===Ep||e===Mp||e===Cp||e===Rp||e===Pp||e===Ip)if(s=r.get("WEBGL_compressed_texture_astc"),s!==null){if(e===_p)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(e===xp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(e===yp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(e===vp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(e===bp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(e===wp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(e===Sp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(e===Tp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(e===Ep)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(e===Mp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(e===Cp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(e===Rp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(e===Pp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(e===Ip)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(e===Np||e===Lp||e===Dp)if(s=r.get("EXT_texture_compression_bptc"),s!==null){if(e===Np)return o===Bt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(e===Lp)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(e===Dp)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(e===Fp||e===Op||e===sh||e===Bp)if(s=r.get("EXT_texture_compression_rgtc"),s!==null){if(e===Fp)return s.COMPRESSED_RED_RGTC1_EXT;if(e===Op)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(e===sh)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(e===Bp)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return e===Wo?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()})}},UK=!1,uM,U8,kK,QB=class{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},this._srcFramebuffer=null,this._dstFramebuffer=null,UK===!1&&(this._init(),UK=!0)}_init(){let e=this.gl;uM={[If]:e.REPEAT,[qo]:e.CLAMP_TO_EDGE,[Nf]:e.MIRRORED_REPEAT},U8={[yi]:e.NEAREST,[T2]:e.NEAREST_MIPMAP_NEAREST,[ic]:e.NEAREST_MIPMAP_LINEAR,[bi]:e.LINEAR,[up]:e.LINEAR_MIPMAP_NEAREST,[vo]:e.LINEAR_MIPMAP_LINEAR},kK={[C2]:e.NEVER,[I2]:e.ALWAYS,[L_]:e.LESS,[oh]:e.LEQUAL,[R2]:e.EQUAL,[$c]:e.GEQUAL,[YA]:e.GREATER,[P2]: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?Kd: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?Kd: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===jo?null:sn.getPrimaries(t.colorSpace),c=t.colorSpace===jo||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,uM[t.wrapS]),n.texParameteri(e,n.TEXTURE_WRAP_T,uM[t.wrapT]),(e===n.TEXTURE_3D||e===n.TEXTURE_2D_ARRAY)&&(t.isArrayTexture||n.texParameteri(e,n.TEXTURE_WRAP_R,uM[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===bi&&u?vo: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,kK[t.compareFunction])),r.has("EXT_texture_filter_anisotropic")===!0){if(t.magFilter===yi||t.minFilter!==ic&&t.minFilter!==vo||t.type===Zi&&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=hM(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=hM(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=L2(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=hM(v);n.texSubImage2D(a,p,0,0,v.width,v.height,l,c,w)}else{let p=hM(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,R,P,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,R=n.min.y,P=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,R=0,P=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,R),c.pixelStorei(a.UNPACK_SKIP_IMAGES,P);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],be=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,P+Qe),a.framebufferTextureLayer(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,u,o,D+Qe)),a.blitFramebuffer(T,R,v,w,C,L,v,w,a.DEPTH_BUFFER_BIT,a.NEAREST);c.bindFramebuffer(a.READ_FRAMEBUFFER,be),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,P+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,R,v,w,C,L,v,w,a.COLOR_BUFFER_BIT,a.NEAREST):J?a.copyTexSubImage3D(f,o,C,L,D+ae,T,R,v,w):a.copyTexSubImage2D(f,o,C,L,T,R,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()],R=S.msaaFrameBuffer;s.bindFramebuffer(r.DRAW_FRAMEBUFFER,T),s.bindFramebuffer(r.READ_FRAMEBUFFER,R);let P=p-l-u;r.blitFramebuffer(a,P,a+c,P+u,a,P,a+c,P+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,P,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,R=l.createBuffer();l.bindBuffer(l.PIXEL_PACK_BUFFER,R),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 P=new v(T/v.BYTES_PER_ELEMENT);return l.bindBuffer(l.PIXEL_PACK_BUFFER,R),l.getBufferSubData(l.PIXEL_PACK_BUFFER,0,P),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),a.state.bindFramebuffer(l.READ_FRAMEBUFFER,null),l.deleteFramebuffer(p),P}_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 hM(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 JB=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)}},e7=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}},GK={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"},t7=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)}}},PC=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(){}},n7=class extends PC{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 Qn(`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}}},IC=class extends RC{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 JB(this),this.capabilities=new e7(this),this.attributeUtils=new YB(this),this.textureUtils=new QB(this),this.bufferRenderer=new t7(this),this.state=new KB(this),this.utils=new ZB(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 _o}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 n7(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(rc.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(rc.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(rc.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)?(Qn("WebGLBackend.compute(): The count parameter must be a single number, not an array."),s=s[0]):s&&typeof s=="object"&&s.isIndirectStorageBufferAttribute&&(Qn("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(rc.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 R=u.lastOcclusionObject;if(R!==t&&R!==void 0){if(R!==null&&R.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 P=this.bufferRenderer;t.isPoints?P.mode=l.POINTS:t.isLineSegments?P.mode=l.LINES:t.isLine?P.mode=l.LINE_STRIP:t.isLineLoop?P.mode=l.LINE_LOOP:r.wireframe===!0?(c.setLineWidth(r.wireframeLinewidth*this.renderer.getPixelRatio()),P.mode=l.LINES):P.mode=l.TRIANGLES;let{vertexCount:C,instanceCount:L}=f,{firstVertex:D}=f;if(P.object=t,S!==null){D*=S.array.BYTES_PER_ELEMENT;let F=this.get(S);P.index=S.count,P.type=F.type}else P.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,be=ae.width*V,Ie=ae.height*V;c.viewport(Math.floor(ce),Math.floor(e.context.height-Ie-de),Math.floor(be),Math.floor(Ie))}c.bindBufferBase(l.UNIFORM_BUFFER,z,F.indexesGPU[j]),this._draw(t,P,D,C,L,a)}this._currentContext.activeCubeFace=J,this.renderer._activeCubeFace=J}}else this._draw(t,P,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(`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=L_(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=L_(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(UK).filter(r=>UK[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===zf.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=dee(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)}},$v={PointList:"point-list",LineList:"line-list",LineStrip:"line-strip",TriangleList:"triangle-list"},Lh=typeof self<"u"&&self.GPUShaderStage?self.GPUShaderStage:{VERTEX:1,FRAGMENT:2,COMPUTE:4},So={Never:"never",Less:"less",Equal:"equal",LessEqual:"less-equal",Greater:"greater",NotEqual:"not-equal",GreaterEqual:"greater-equal",Always:"always"},Ma={Store:"store"},Mi={Load:"load",Clear:"clear"},kK={CCW:"ccw",CW:"cw"},GK={None:"none",Back:"back"},IC={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"},U8={ClampToEdge:"clamp-to-edge",Repeat:"repeat",MirrorRepeat:"mirror-repeat"},hc={Linear:"linear",Nearest:"nearest"},oi={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"},vm={Add:"add",Subtract:"subtract",ReverseSubtract:"reverse-subtract",Min:"min",Max:"max"},zK={None:0,All:15},Kp={Keep:"keep",Zero:"zero",Replace:"replace",Invert:"invert",IncrementClamp:"increment-clamp",DecrementClamp:"decrement-clamp",IncrementWrap:"increment-wrap",DecrementWrap:"decrement-wrap"},k8={Storage:"storage",ReadOnlyStorage:"read-only-storage"},G8={WriteOnly:"write-only",ReadOnly:"read-only",ReadWrite:"read-write"},VK={NonFiltering:"non-filtering",Comparison:"comparison"},bm={Float:"float",UnfilterableFloat:"unfilterable-float",Depth:"depth",SInt:"sint",UInt:"uint"},qK={TwoD:"2d",ThreeD:"3d"},To={TwoD:"2d",TwoDArray:"2d-array",Cube:"cube",ThreeD:"3d"},A3e={All:"all"},hM={Vertex:"vertex",Instance:"instance"},NC={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"},HK={"texture-compression-s3tc":"texture-compression-bc","texture-compression-etc1":"texture-compression-etc2"},n7=class extends EC{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()}},i7=class extends bC{constructor(e,t){super(e,t?t.array:null),this._attribute=t,this.isStorageBuffer=!0}get attribute(){return this._attribute}},m3e=0,r7=class extends i7{constructor(e,t){super("StorageBuffer_"+m3e++,e?e.value:null),this.nodeUniform=e,this.access=e?e.access:Mo.READ_WRITE,this.groupNode=t}get attribute(){return this.nodeUniform.value}get buffer(){return this.nodeUniform.value.array}},z8=[null],s7=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 $v.PointList;if(e.isLineSegments||e.isMesh&&t.wireframe===!0)return $v.LineList;if(e.isLine)return $v.LineStrip;if(e.isMesh)return $v.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===Vi)return he.BGRA8Unorm;if(t===Fi)return he.RGBA16Float;throw new Error("THREE.WebGPUUtils: Unsupported output buffer type.")}};function Mh(i,e){z8[0]=e,i.queue.submit(z8),z8[0]=null}var LC=class{constructor(){this.label="",this.layout=null,this.entries=[]}reset(){this.label="",this.layout=null,this.entries.length=0}},p0=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}},Wm=class{constructor(){this.label=""}reset(){this.label=""}},DC=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}},Fm=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}},Om=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}},FC=class{constructor(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample=new o7,this.fragment=null}reset(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample.reset(),this.fragment=null}},o7=class{constructor(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}reset(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}},OC=class{constructor(){this.label="",this.code="",this.compilationHints=[]}reset(){this.label="",this.code="",this.compilationHints.length=0}},wb=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}},Sb=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"}},Zp=new LC,Qp=new p0,fM=new Wm,V8=new DC,q8=new Om,A1=new FC,zv=new Fm,dM=new OC,m1=new wb,ts=new Sb,a7=class extends Bh{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 R=this.get(T);w.push(R)}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=D_(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=D_(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(GK).filter(r=>GK[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===zf.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"),R=this.extensions.get("OVR_multiview2"),P=this._useMultisampledExtension(s),C=Aee(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)R.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(P)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,P),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)R.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,N,B.textureGPU,0,a,0,2);else if(v&&P)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||P||s.multiview)&&s._isOpaqueFramebuffer!==!0){n.bindFramebuffer(t.FRAMEBUFFER,L);let F=this.get(e.textures[0]);s.multiview?R.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,F.textureGPU,0,a,0,2):P?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?R.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,N,B.textureGPU,0,a,0,2):P?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&&P===!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)}},Kv={PointList:"point-list",LineList:"line-list",LineStrip:"line-strip",TriangleList:"triangle-list"},Lh=typeof self<"u"&&self.GPUShaderStage?self.GPUShaderStage:{VERTEX:1,FRAGMENT:2,COMPUTE:4},To={Never:"never",Less:"less",Equal:"equal",LessEqual:"less-equal",Greater:"greater",NotEqual:"not-equal",GreaterEqual:"greater-equal",Always:"always"},Ma={Store:"store"},Mi={Load:"load",Clear:"clear"},zK={CCW:"ccw",CW:"cw"},VK={None:"none",Back:"back"},NC={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"},k8={ClampToEdge:"clamp-to-edge",Repeat:"repeat",MirrorRepeat:"mirror-repeat"},hc={Linear:"linear",Nearest:"nearest"},oi={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"},vm={Add:"add",Subtract:"subtract",ReverseSubtract:"reverse-subtract",Min:"min",Max:"max"},qK={None:0,All:15},Kp={Keep:"keep",Zero:"zero",Replace:"replace",Invert:"invert",IncrementClamp:"increment-clamp",DecrementClamp:"decrement-clamp",IncrementWrap:"increment-wrap",DecrementWrap:"decrement-wrap"},G8={Storage:"storage",ReadOnlyStorage:"read-only-storage"},z8={WriteOnly:"write-only",ReadOnly:"read-only",ReadWrite:"read-write"},HK={NonFiltering:"non-filtering",Comparison:"comparison"},bm={Float:"float",UnfilterableFloat:"unfilterable-float",Depth:"depth",SInt:"sint",UInt:"uint"},WK={TwoD:"2d",ThreeD:"3d"},Eo={TwoD:"2d",TwoDArray:"2d-array",Cube:"cube",ThreeD:"3d"},x3e={All:"all"},fM={Vertex:"vertex",Instance:"instance"},LC={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"},jK={"texture-compression-s3tc":"texture-compression-bc","texture-compression-etc1":"texture-compression-etc2"},i7=class extends MC{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()}},r7=class extends wC{constructor(e,t){super(e,t?t.array:null),this._attribute=t,this.isStorageBuffer=!0}get attribute(){return this._attribute}},y3e=0,s7=class extends r7{constructor(e,t){super("StorageBuffer_"+y3e++,e?e.value:null),this.nodeUniform=e,this.access=e?e.access:Co.READ_WRITE,this.groupNode=t}get attribute(){return this.nodeUniform.value}get buffer(){return this.nodeUniform.value.array}},V8=[null],o7=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 Kv.PointList;if(e.isLineSegments||e.isMesh&&t.wireframe===!0)return Kv.LineList;if(e.isLine)return Kv.LineStrip;if(e.isMesh)return Kv.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===Vi)return he.BGRA8Unorm;if(t===Fi)return he.RGBA16Float;throw new Error("THREE.WebGPUUtils: Unsupported output buffer type.")}};function Mh(i,e){V8[0]=e,i.queue.submit(V8),V8[0]=null}var DC=class{constructor(){this.label="",this.layout=null,this.entries=[]}reset(){this.label="",this.layout=null,this.entries.length=0}},p0=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}},Wm=class{constructor(){this.label=""}reset(){this.label=""}},FC=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}},Fm=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}},Om=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}},OC=class{constructor(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample=new a7,this.fragment=null}reset(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample.reset(),this.fragment=null}},a7=class{constructor(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}reset(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}},BC=class{constructor(){this.label="",this.code="",this.compilationHints=[]}reset(){this.label="",this.code="",this.compilationHints.length=0}},Tb=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}},Eb=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"}},Zp=new DC,Qp=new p0,dM=new Wm,q8=new FC,H8=new Om,m1=new OC,qv=new Fm,pM=new BC,g1=new Tb,ns=new Eb,l7=class extends Bh{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:hc.Linear}),this.flipYSampler=e.createSampler({minFilter:hc.Nearest}),Qp.size=4,Qp.usage=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,this.flipUniformBuffer=e.createBuffer(Qp),Qp.reset(),e.queue.writeBuffer(this.flipUniformBuffer,0,new Uint32Array([1])),Qp.size=4,Qp.usage=GPUBufferUsage.UNIFORM,this.noFlipUniformBuffer=e.createBuffer(Qp),Qp.reset(),this.transferPipelines={},dM.label="mipmap",dM.code=t,this.mipmapShaderModule=e.createShaderModule(dM),dM.reset()}getTransferPipeline(e,t){t=t||"2d-array";let n=`${e}-${t}`,r=this.transferPipelines[n];return r===void 0&&(A1.label=`mipmap-${e}-${t}`,A1.vertex={module:this.mipmapShaderModule},A1.fragment={module:this.mipmapShaderModule,entryPoint:`main_${t.replace("-","_")}`,targets:[{format:e}]},A1.layout="auto",r=this.device.createRenderPipeline(A1),A1.reset(),this.transferPipelines[n]=r),r}flipY(e,t,n=0){let r=t.format,{width:s,height:o}=t.size;m1.size.width=s,m1.size.height=o,m1.format=r,m1.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING;let a=this.device.createTexture(m1);m1.reset();let l=this.getTransferPipeline(r,e.textureBindingViewDimension),c=this.getTransferPipeline(r,a.textureBindingViewDimension),u=this.device.createCommandEncoder(fM),f=(p,x,v,w,S,T)=>{let P=p.getBindGroupLayout(0);ts.dimension=x.textureBindingViewDimension||"2d-array",ts.mipLevelCount=1;let R=x.createView(ts);ts.reset(),Zp.layout=P,Zp.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(Zp);Zp.reset(),ts.dimension="2d",ts.mipLevelCount=1,ts.baseArrayLayer=S,ts.arrayLayerCount=1;let L=w.createView(ts);ts.reset(),zv.view=L,zv.loadOp=Mi.Clear,zv.storeOp=Ma.Store,q8.colorAttachments.push(zv);let D=u.beginRenderPass(q8);q8.reset(),zv.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),Mh(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&&(fM.label="mipmapEncoder",s=this.device.createCommandEncoder(fM),fM.reset()),this._mipmapRunBundles(s,r),t===null&&Mh(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++){ts.dimension=t,ts.baseMipLevel=o-1,ts.mipLevelCount=1;let l=e.createView(ts);ts.reset(),Zp.layout=r,Zp.entries.push({binding:0,resource:this.mipmapSampler},{binding:1,resource:l},{binding:2,resource:{buffer:this.noFlipUniformBuffer}});let c=this.device.createBindGroup(Zp);Zp.reset(),ts.dimension="2d",ts.baseMipLevel=o,ts.mipLevelCount=1,ts.baseArrayLayer=a,ts.arrayLayerCount=1;let u=e.createView(ts);ts.reset();let f=new Fm;f.view=u,f.loadOp=Mi.Clear,f.storeOp=Ma.Store;let p=new Om;p.colorAttachments.push(f),V8.colorFormats=[e.format];let x=this.device.createRenderBundleEncoder(V8);V8.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()}}},l7=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}},G1=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"}},c7=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}},u7=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}},h7=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}},f7=class extends G1{constructor(){super(),this.colorSpace="srgb",this.premultipliedAlpha=!1}reset(){super.reset(),this.colorSpace="srgb",this.premultipliedAlpha=!1}},BC=class{constructor(){this.width=0,this.height=1,this.depthOrArrayLayers=1}reset(){this.width=0,this.height=1,this.depthOrArrayLayers=1}},pM=new p0,g3e=new Wm,Yo=new l7,Jo=new G1,AM=new c7,Jf=new u7,mM=new h7,g1=new f7,Jp=new wb,Zo=new BC,_3e={[E2]:"never",[N_]:"less",[M2]:"equal",[oh]:"less-equal",[YA]:"greater",[$c]:"greater-equal",[R2]:"always",[C2]:"not-equal"},x3e=[0,1,3,2,4,5];function WK(i,e,t,n,r,s,o,a,l,c){Jo.texture=e,Jo.mipLevel=t,Jo.origin.z=n,Jf.offset=n*s,Jf.bytesPerRow=o,Jf.rowsPerImage=a,Zo.width=l,Zo.height=c,i.queue.writeTexture(Jo,r.data,Jf,Zo),Jo.reset(),Jf.reset(),Zo.reset()}var d7=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){Yo.addressModeU=this._convertAddressMode(n.wrapS),Yo.addressModeV=this._convertAddressMode(n.wrapT),Yo.addressModeW=this._convertAddressMode(n.wrapR),Yo.magFilter=this._convertFilterMode(n.magFilter),Yo.minFilter=this._convertFilterMode(n.minFilter),Yo.mipmapFilter=this._convertMipmapFilterMode(n.minFilter),n.isDepthTexture&&(n.compareFunction===null||r.compareNode===null)&&(Yo.magFilter=hc.Nearest,Yo.minFilter=hc.Nearest,Yo.mipmapFilter=hc.Nearest),Yo.magFilter===hc.Linear&&Yo.minFilter===hc.Linear&&Yo.mipmapFilter===hc.Linear&&(Yo.maxAnisotropy=n.anisotropy),n.isDepthTexture&&n.compareFunction!==null&&r.compareNode!==null&&t.hasCompatibility(zf.TEXTURE_COMPARE)&&(Yo.compare=_3e[n.compareFunction]);let l=t.device.createSampler(Yo);Yo.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=p7(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||p7(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 wb;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=To.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(),Jp.label="colorBuffer",Jp.size.width=n,Jp.size.height=r,Jp.sampleCount=e.utils.getSampleCount(e.renderer.currentSamples),Jp.format=e.utils.getPreferredCanvasFormat(),Jp.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,l=e.device.createTexture(Jp),Jp.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=eo,f=n.renderer.reversedDepthBuffer===!0?Zi:Ho):e&&(u=Ts,f=n.renderer.reversedDepthBuffer===!0?Zi:Ai),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,pM.size=(s-1)*p+r*f,pM.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let x=a.createBuffer(pM);pM.reset();let v=a.createCommandEncoder(g3e);Jo.texture=c,Jo.origin.x=t,Jo.origin.y=n,Jo.origin.z=o,AM.buffer=x,AM.bytesPerRow=p,Zo.width=r,Zo.height=s,v.copyTextureToBuffer(Jo,AM,Zo),Jo.reset(),AM.reset(),Zo.reset();let w=this._getTypedArrayType(u);Mh(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 Ms;n.minFilter=yi,n.magFilter=yi,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 qu;n.minFilter=yi,n.magFilter=yi,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?x3e[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;mM.source=e,mM.flipY=s,g1.texture=t,g1.mipLevel=a,g1.origin.z=r,g1.premultipliedAlpha=o,Zo.width=c,Zo.height=u;try{l.queue.copyExternalImageToTexture(mM,g1,Zo)}catch{}finally{mM.reset(),g1.reset(),Zo.reset()}}_getPassUtils(){let e=this._passUtils;return e===null&&(this._passUtils=e=new a7(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;Jo.texture=t,Jo.mipLevel=a,Jo.origin.z=r,Jf.offset=e.width*e.height*u*o,Jf.bytesPerRow=f,Zo.width=e.width,Zo.height=e.height,l.queue.writeTexture(Jo,c,Jf,Zo),Jo.reset(),Jf.reset(),Zo.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)WK(s,t,c,R,u,S,v,w,T,P);else for(let R=0;R<x;R++)WK(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=U8.ClampToEdge;return e===If?t=U8.Repeat:e===Nf&&(t=U8.MirrorRepeat),t}_convertFilterMode(e){let t=hc.Linear;return(e===yi||e===w2||e===ic)&&(t=hc.Nearest),t}_convertMipmapFilterMode(e){return e===ic||e===yo?hc.Linear:hc.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=qK.ThreeD:t=qK.TwoD,t}};function p7(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(NC.TextureFormatsTier1),l===!1&&je("WebGPURenderer: Unable to use normalized textures without texture-formats-tier1 feature.")),i.isCompressedTexture===!0||i.isCompressedArrayTexture===!0)switch(t){case eh:case th:a=o===Bt?he.BC1RGBAUnormSRGB:he.BC1RGBAUnorm;break;case nh:a=o===Bt?he.BC2RGBAUnormSRGB:he.BC2RGBAUnorm;break;case ih:a=o===Bt?he.BC3RGBAUnormSRGB:he.BC3RGBAUnorm;break;case Fp:a=he.BC4RUnorm;break;case Op:a=he.BC4RSnorm;break;case sh:a=he.BC5RGUnorm;break;case Bp:a=he.BC5RGSnorm;break;case Np:a=o===Bt?he.BC7RGBAUnormSRGB:he.BC7RGBAUnorm;break;case Lp:a=he.BC6HRGBFloat;break;case Dp:a=he.BC6HRGBUFloat;break;case dp:case fp:a=o===Bt?he.ETC2RGB8UnormSRGB:he.ETC2RGB8Unorm;break;case pp:a=o===Bt?he.ETC2RGBA8UnormSRGB:he.ETC2RGBA8Unorm;break;case Ap:a=he.EACR11Unorm;break;case mp:a=he.EACR11Snorm;break;case rh:a=he.EACRG11Unorm;break;case gp:a=he.EACRG11Snorm;break;case _p:a=o===Bt?he.ASTC4x4UnormSRGB:he.ASTC4x4Unorm;break;case xp:a=o===Bt?he.ASTC5x4UnormSRGB:he.ASTC5x4Unorm;break;case yp:a=o===Bt?he.ASTC5x5UnormSRGB:he.ASTC5x5Unorm;break;case vp:a=o===Bt?he.ASTC6x5UnormSRGB:he.ASTC6x5Unorm;break;case bp:a=o===Bt?he.ASTC6x6UnormSRGB:he.ASTC6x6Unorm;break;case wp:a=o===Bt?he.ASTC8x5UnormSRGB:he.ASTC8x5Unorm;break;case Sp:a=o===Bt?he.ASTC8x6UnormSRGB:he.ASTC8x6Unorm;break;case Tp:a=o===Bt?he.ASTC8x8UnormSRGB:he.ASTC8x8Unorm;break;case Ep:a=o===Bt?he.ASTC10x5UnormSRGB:he.ASTC10x5Unorm;break;case Mp:a=o===Bt?he.ASTC10x6UnormSRGB:he.ASTC10x6Unorm;break;case Cp:a=o===Bt?he.ASTC10x8UnormSRGB:he.ASTC10x8Unorm;break;case Rp:a=o===Bt?he.ASTC10x10UnormSRGB:he.ASTC10x10Unorm;break;case Pp:a=o===Bt?he.ASTC12x10UnormSRGB:he.ASTC12x10Unorm;break;case Ip:a=o===Bt?he.ASTC12x12UnormSRGB:he.ASTC12x12Unorm;break;case wr:a=o===Bt?he.RGBA8UnormSRGB:he.RGBA8Unorm;break;default:Ge("WebGPURenderer: Unsupported texture format.",t)}else switch(t){case wr:switch(n){case Ku:a=he.RGBA8Snorm;break;case Zu:a=l?he.RGBA16Snorm:he.RGBA16Sint;break;case Ka:a=l?he.RGBA16Unorm:he.RGBA16Uint;break;case Ai:a=he.RGBA32Uint;break;case Fr:a=he.RGBA32Sint;break;case Vi:a=o===Bt?he.RGBA8UnormSRGB:he.RGBA8Unorm;break;case Fi:a=he.RGBA16Float;break;case Zi:a=he.RGBA32Float;break;default:Ge("WebGPURenderer: Unsupported texture type with RGBAFormat.",n)}break;case kf:switch(n){case qA:a=he.RGB9E5UFloat;break;case HA:a=he.RG11B10UFloat;break;default:Ge("WebGPURenderer: Unsupported texture type with RGBFormat.",n)}break;case Gf:switch(n){case Ku:a=he.R8Snorm;break;case Zu:a=l?he.R16Snorm:he.R16Sint;break;case Ka:a=l?he.R16Unorm:he.R16Uint;break;case Ai:a=he.R32Uint;break;case Fr:a=he.R32Sint;break;case Vi:a=he.R8Unorm;break;case Fi:a=he.R16Float;break;case Zi:a=he.R32Float;break;default:Ge("WebGPURenderer: Unsupported texture type with RedFormat.",n)}break;case Rs:switch(n){case Ku:a=he.RG8Snorm;break;case Zu:a=l?he.RG16Snorm:he.RG16Sint;break;case Ka:a=l?he.RG16Unorm:he.RG16Uint;break;case Ai:a=he.RG32Uint;break;case Fr:a=he.RG32Sint;break;case Vi:a=he.RG8Unorm;break;case Fi:a=he.RG16Float;break;case Zi:a=he.RG32Float;break;default:Ge("WebGPURenderer: Unsupported texture type with RGFormat.",n)}break;case Ts:switch(n){case Ka:a=he.Depth16Unorm;break;case Ai:a=he.Depth24Plus;break;case Zi:a=he.Depth32Float;break;default:Ge("WebGPURenderer: Unsupported texture type with DepthFormat.",n)}break;case eo:switch(n){case Ho:a=he.Depth24PlusStencil8;break;case Zi:e&&e.features.has(NC.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 Qu:switch(n){case Fr:a=he.R32Sint;break;case Ai:a=he.R32Uint;break;default:Ge("WebGPURenderer: Unsupported texture type with RedIntegerFormat.",n)}break;case Ju:switch(n){case Fr:a=he.RG32Sint;break;case Ai:a=he.RG32Uint;break;default:Ge("WebGPURenderer: Unsupported texture type with RGIntegerFormat.",n)}break;case hp:switch(n){case Fr:a=he.RGBA32Sint;break;case Ai:a=he.RGBA32Uint;break;default:Ge("WebGPURenderer: Unsupported texture type with RGBAIntegerFormat.",n)}break;default:Ge("WebGPURenderer: Unsupported texture format.",t)}return a}var y3e=/^[fn]*\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)\s*[\-\>]*\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/i,v3e=/([a-z_0-9]+)\s*:\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/ig,jK={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"},b3e=i=>{i=i.trim();let e=i.match(y3e);if(e!==null&&e.length===4){let t=e[2],n=[],r=null;for(;(r=v3e.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=jK[x]),s.push(new xb(x,f))}let o=i.substring(e[0].length),a=e[3]||"void",l=e[1]!==void 0?e[1]:"";return{type:jK[a]||a,inputs:s,name:l,inputsCode:t,blockCode:o,outputType:a}}else throw new Error("THREE.WGSLNodeFunction: Function is not a WGSL code.")},A7=class extends vb{constructor(e){let{type:t,inputs:n,name:r,inputsCode:s,blockCode:o,outputType:a}=b3e(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}},m7=class extends _C{parseFunction(e){return new A7(e)}},w3e={[Mo.READ_ONLY]:"read",[Mo.WRITE_ONLY]:"write",[Mo.READ_WRITE]:"read_write"},XK={[If]:"repeat",[Vo]:"clamp",[Nf]:"mirror"},H8={vertex:Lh.VERTEX,fragment:Lh.FRAGMENT,compute:Lh.COMPUTE},$K={instance:!0,swizzleAssign:!1,storageBuffer:!0},S3e={"^^":"tsl_xor"},T3e={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={},Vv={tsl_xor:new Ji("fn tsl_xor( a : bool, b : bool ) -> bool { return ( a || b ) && !( a && b ); }"),mod_float:new Ji("fn tsl_mod_float( x : f32, y : f32 ) -> f32 { return x - y * floor( x / y ); }"),mod_vec2:new Ji("fn tsl_mod_vec2( x : vec2f, y : vec2f ) -> vec2f { return x - y * floor( x / y ); }"),mod_vec3:new Ji("fn tsl_mod_vec3( x : vec3f, y : vec3f ) -> vec3f { return x - y * floor( x / y ); }"),mod_vec4:new Ji("fn tsl_mod_vec4( x : vec4f, y : vec4f ) -> vec4f { return x - y * floor( x / y ); }"),equals_bool:new Ji("fn tsl_equals_bool( a : bool, b : bool ) -> bool { return a == b; }"),equals_bvec2:new Ji("fn tsl_equals_bvec2( a : vec2f, b : vec2f ) -> vec2<bool> { return vec2<bool>( a.x == b.x, a.y == b.y ); }"),equals_bvec3:new Ji("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 Ji("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 Ji("fn tsl_repeatWrapping_float( coord: f32 ) -> f32 { return fract( coord ); }"),mirrorWrapping_float:new Ji("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 Ji("fn tsl_clampWrapping_float( coord: f32 ) -> f32 { return clamp( coord, 0.0, 1.0 ); }"),inverse_mat2:new Ji(`4443+`;this.mipmapSampler=e.createSampler({minFilter:hc.Linear}),this.flipYSampler=e.createSampler({minFilter:hc.Nearest}),Qp.size=4,Qp.usage=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,this.flipUniformBuffer=e.createBuffer(Qp),Qp.reset(),e.queue.writeBuffer(this.flipUniformBuffer,0,new Uint32Array([1])),Qp.size=4,Qp.usage=GPUBufferUsage.UNIFORM,this.noFlipUniformBuffer=e.createBuffer(Qp),Qp.reset(),this.transferPipelines={},pM.label="mipmap",pM.code=t,this.mipmapShaderModule=e.createShaderModule(pM),pM.reset()}getTransferPipeline(e,t){t=t||"2d-array";let n=`${e}-${t}`,r=this.transferPipelines[n];return r===void 0&&(m1.label=`mipmap-${e}-${t}`,m1.vertex={module:this.mipmapShaderModule},m1.fragment={module:this.mipmapShaderModule,entryPoint:`main_${t.replace("-","_")}`,targets:[{format:e}]},m1.layout="auto",r=this.device.createRenderPipeline(m1),m1.reset(),this.transferPipelines[n]=r),r}flipY(e,t,n=0){let r=t.format,{width:s,height:o}=t.size;g1.size.width=s,g1.size.height=o,g1.format=r,g1.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING;let a=this.device.createTexture(g1);g1.reset();let l=this.getTransferPipeline(r,e.textureBindingViewDimension),c=this.getTransferPipeline(r,a.textureBindingViewDimension),u=this.device.createCommandEncoder(dM),f=(p,x,v,w,S,T)=>{let R=p.getBindGroupLayout(0);ns.dimension=x.textureBindingViewDimension||"2d-array",ns.mipLevelCount=1;let P=x.createView(ns);ns.reset(),Zp.layout=R,Zp.entries.push({binding:0,resource:this.flipYSampler},{binding:1,resource:P},{binding:2,resource:{buffer:T?this.flipUniformBuffer:this.noFlipUniformBuffer}});let C=this.device.createBindGroup(Zp);Zp.reset(),ns.dimension="2d",ns.mipLevelCount=1,ns.baseArrayLayer=S,ns.arrayLayerCount=1;let L=w.createView(ns);ns.reset(),qv.view=L,qv.loadOp=Mi.Clear,qv.storeOp=Ma.Store,H8.colorAttachments.push(qv);let D=u.beginRenderPass(H8);H8.reset(),qv.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),Mh(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&&(dM.label="mipmapEncoder",s=this.device.createCommandEncoder(dM),dM.reset()),this._mipmapRunBundles(s,r),t===null&&Mh(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++){ns.dimension=t,ns.baseMipLevel=o-1,ns.mipLevelCount=1;let l=e.createView(ns);ns.reset(),Zp.layout=r,Zp.entries.push({binding:0,resource:this.mipmapSampler},{binding:1,resource:l},{binding:2,resource:{buffer:this.noFlipUniformBuffer}});let c=this.device.createBindGroup(Zp);Zp.reset(),ns.dimension="2d",ns.baseMipLevel=o,ns.mipLevelCount=1,ns.baseArrayLayer=a,ns.arrayLayerCount=1;let u=e.createView(ns);ns.reset();let f=new Fm;f.view=u,f.loadOp=Mi.Clear,f.storeOp=Ma.Store;let p=new Om;p.colorAttachments.push(f),q8.colorFormats=[e.format];let x=this.device.createRenderBundleEncoder(q8);q8.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()}}},c7=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}},z1=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"}},u7=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}},h7=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}},f7=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}},d7=class extends z1{constructor(){super(),this.colorSpace="srgb",this.premultipliedAlpha=!1}reset(){super.reset(),this.colorSpace="srgb",this.premultipliedAlpha=!1}},UC=class{constructor(){this.width=0,this.height=1,this.depthOrArrayLayers=1}reset(){this.width=0,this.height=1,this.depthOrArrayLayers=1}},AM=new p0,v3e=new Wm,Ko=new c7,ea=new z1,mM=new u7,Jf=new h7,gM=new f7,_1=new d7,Jp=new Tb,Qo=new UC,b3e={[C2]:"never",[L_]:"less",[R2]:"equal",[oh]:"less-equal",[YA]:"greater",[$c]:"greater-equal",[I2]:"always",[P2]:"not-equal"},w3e=[0,1,3,2,4,5];function XK(i,e,t,n,r,s,o,a,l,c){ea.texture=e,ea.mipLevel=t,ea.origin.z=n,Jf.offset=n*s,Jf.bytesPerRow=o,Jf.rowsPerImage=a,Qo.width=l,Qo.height=c,i.queue.writeTexture(ea,r.data,Jf,Qo),ea.reset(),Jf.reset(),Qo.reset()}var p7=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){Ko.addressModeU=this._convertAddressMode(n.wrapS),Ko.addressModeV=this._convertAddressMode(n.wrapT),Ko.addressModeW=this._convertAddressMode(n.wrapR),Ko.magFilter=this._convertFilterMode(n.magFilter),Ko.minFilter=this._convertFilterMode(n.minFilter),Ko.mipmapFilter=this._convertMipmapFilterMode(n.minFilter),n.isDepthTexture&&(n.compareFunction===null||r.compareNode===null)&&(Ko.magFilter=hc.Nearest,Ko.minFilter=hc.Nearest,Ko.mipmapFilter=hc.Nearest),Ko.magFilter===hc.Linear&&Ko.minFilter===hc.Linear&&Ko.mipmapFilter===hc.Linear&&(Ko.maxAnisotropy=n.anisotropy),n.isDepthTexture&&n.compareFunction!==null&&r.compareNode!==null&&t.hasCompatibility(zf.TEXTURE_COMPARE)&&(Ko.compare=b3e[n.compareFunction]);let l=t.device.createSampler(Ko);Ko.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=A7(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||A7(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 Tb;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=Eo.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(),Jp.label="colorBuffer",Jp.size.width=n,Jp.size.height=r,Jp.sampleCount=e.utils.getSampleCount(e.renderer.currentSamples),Jp.format=e.utils.getPreferredCanvasFormat(),Jp.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,l=e.device.createTexture(Jp),Jp.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=eo,f=n.renderer.reversedDepthBuffer===!0?Zi:Wo):e&&(u=Ts,f=n.renderer.reversedDepthBuffer===!0?Zi:Ai),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,AM.size=(s-1)*p+r*f,AM.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let x=a.createBuffer(AM);AM.reset();let v=a.createCommandEncoder(v3e);ea.texture=c,ea.origin.x=t,ea.origin.y=n,ea.origin.z=o,mM.buffer=x,mM.bytesPerRow=p,Qo.width=r,Qo.height=s,v.copyTextureToBuffer(ea,mM,Qo),ea.reset(),mM.reset(),Qo.reset();let w=this._getTypedArrayType(u);Mh(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 Ms;n.minFilter=yi,n.magFilter=yi,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 qu;n.minFilter=yi,n.magFilter=yi,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?w3e[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;gM.source=e,gM.flipY=s,_1.texture=t,_1.mipLevel=a,_1.origin.z=r,_1.premultipliedAlpha=o,Qo.width=c,Qo.height=u;try{l.queue.copyExternalImageToTexture(gM,_1,Qo)}catch{}finally{gM.reset(),_1.reset(),Qo.reset()}}_getPassUtils(){let e=this._passUtils;return e===null&&(this._passUtils=e=new l7(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;ea.texture=t,ea.mipLevel=a,ea.origin.z=r,Jf.offset=e.width*e.height*u*o,Jf.bytesPerRow=f,Qo.width=e.width,Qo.height=e.height,l.queue.writeTexture(ea,c,Jf,Qo),ea.reset(),Jf.reset(),Qo.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,R=w*o.height;if(l!==null)for(let P of l)XK(s,t,c,P,u,S,v,w,T,R);else for(let P=0;P<x;P++)XK(s,t,c,P,u,S,v,w,T,R)}}_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=k8.ClampToEdge;return e===If?t=k8.Repeat:e===Nf&&(t=k8.MirrorRepeat),t}_convertFilterMode(e){let t=hc.Linear;return(e===yi||e===T2||e===ic)&&(t=hc.Nearest),t}_convertMipmapFilterMode(e){return e===ic||e===vo?hc.Linear:hc.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=WK.ThreeD:t=WK.TwoD,t}};function A7(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(LC.TextureFormatsTier1),l===!1&&je("WebGPURenderer: Unable to use normalized textures without texture-formats-tier1 feature.")),i.isCompressedTexture===!0||i.isCompressedArrayTexture===!0)switch(t){case eh:case th:a=o===Bt?he.BC1RGBAUnormSRGB:he.BC1RGBAUnorm;break;case nh:a=o===Bt?he.BC2RGBAUnormSRGB:he.BC2RGBAUnorm;break;case ih:a=o===Bt?he.BC3RGBAUnormSRGB:he.BC3RGBAUnorm;break;case Fp:a=he.BC4RUnorm;break;case Op:a=he.BC4RSnorm;break;case sh:a=he.BC5RGUnorm;break;case Bp:a=he.BC5RGSnorm;break;case Np:a=o===Bt?he.BC7RGBAUnormSRGB:he.BC7RGBAUnorm;break;case Lp:a=he.BC6HRGBFloat;break;case Dp:a=he.BC6HRGBUFloat;break;case dp:case fp:a=o===Bt?he.ETC2RGB8UnormSRGB:he.ETC2RGB8Unorm;break;case pp:a=o===Bt?he.ETC2RGBA8UnormSRGB:he.ETC2RGBA8Unorm;break;case Ap:a=he.EACR11Unorm;break;case mp:a=he.EACR11Snorm;break;case rh:a=he.EACRG11Unorm;break;case gp:a=he.EACRG11Snorm;break;case _p:a=o===Bt?he.ASTC4x4UnormSRGB:he.ASTC4x4Unorm;break;case xp:a=o===Bt?he.ASTC5x4UnormSRGB:he.ASTC5x4Unorm;break;case yp:a=o===Bt?he.ASTC5x5UnormSRGB:he.ASTC5x5Unorm;break;case vp:a=o===Bt?he.ASTC6x5UnormSRGB:he.ASTC6x5Unorm;break;case bp:a=o===Bt?he.ASTC6x6UnormSRGB:he.ASTC6x6Unorm;break;case wp:a=o===Bt?he.ASTC8x5UnormSRGB:he.ASTC8x5Unorm;break;case Sp:a=o===Bt?he.ASTC8x6UnormSRGB:he.ASTC8x6Unorm;break;case Tp:a=o===Bt?he.ASTC8x8UnormSRGB:he.ASTC8x8Unorm;break;case Ep:a=o===Bt?he.ASTC10x5UnormSRGB:he.ASTC10x5Unorm;break;case Mp:a=o===Bt?he.ASTC10x6UnormSRGB:he.ASTC10x6Unorm;break;case Cp:a=o===Bt?he.ASTC10x8UnormSRGB:he.ASTC10x8Unorm;break;case Rp:a=o===Bt?he.ASTC10x10UnormSRGB:he.ASTC10x10Unorm;break;case Pp:a=o===Bt?he.ASTC12x10UnormSRGB:he.ASTC12x10Unorm;break;case Ip:a=o===Bt?he.ASTC12x12UnormSRGB:he.ASTC12x12Unorm;break;case wr:a=o===Bt?he.RGBA8UnormSRGB:he.RGBA8Unorm;break;default:Ge("WebGPURenderer: Unsupported texture format.",t)}else switch(t){case wr:switch(n){case Ku:a=he.RGBA8Snorm;break;case Zu:a=l?he.RGBA16Snorm:he.RGBA16Sint;break;case Ka:a=l?he.RGBA16Unorm:he.RGBA16Uint;break;case Ai:a=he.RGBA32Uint;break;case Fr:a=he.RGBA32Sint;break;case Vi:a=o===Bt?he.RGBA8UnormSRGB:he.RGBA8Unorm;break;case Fi:a=he.RGBA16Float;break;case Zi:a=he.RGBA32Float;break;default:Ge("WebGPURenderer: Unsupported texture type with RGBAFormat.",n)}break;case kf:switch(n){case qA:a=he.RGB9E5UFloat;break;case HA:a=he.RG11B10UFloat;break;default:Ge("WebGPURenderer: Unsupported texture type with RGBFormat.",n)}break;case Gf:switch(n){case Ku:a=he.R8Snorm;break;case Zu:a=l?he.R16Snorm:he.R16Sint;break;case Ka:a=l?he.R16Unorm:he.R16Uint;break;case Ai:a=he.R32Uint;break;case Fr:a=he.R32Sint;break;case Vi:a=he.R8Unorm;break;case Fi:a=he.R16Float;break;case Zi:a=he.R32Float;break;default:Ge("WebGPURenderer: Unsupported texture type with RedFormat.",n)}break;case Rs:switch(n){case Ku:a=he.RG8Snorm;break;case Zu:a=l?he.RG16Snorm:he.RG16Sint;break;case Ka:a=l?he.RG16Unorm:he.RG16Uint;break;case Ai:a=he.RG32Uint;break;case Fr:a=he.RG32Sint;break;case Vi:a=he.RG8Unorm;break;case Fi:a=he.RG16Float;break;case Zi:a=he.RG32Float;break;default:Ge("WebGPURenderer: Unsupported texture type with RGFormat.",n)}break;case Ts:switch(n){case Ka:a=he.Depth16Unorm;break;case Ai:a=he.Depth24Plus;break;case Zi:a=he.Depth32Float;break;default:Ge("WebGPURenderer: Unsupported texture type with DepthFormat.",n)}break;case eo:switch(n){case Wo:a=he.Depth24PlusStencil8;break;case Zi:e&&e.features.has(LC.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 Qu:switch(n){case Fr:a=he.R32Sint;break;case Ai:a=he.R32Uint;break;default:Ge("WebGPURenderer: Unsupported texture type with RedIntegerFormat.",n)}break;case Ju:switch(n){case Fr:a=he.RG32Sint;break;case Ai:a=he.RG32Uint;break;default:Ge("WebGPURenderer: Unsupported texture type with RGIntegerFormat.",n)}break;case hp:switch(n){case Fr:a=he.RGBA32Sint;break;case Ai:a=he.RGBA32Uint;break;default:Ge("WebGPURenderer: Unsupported texture type with RGBAIntegerFormat.",n)}break;default:Ge("WebGPURenderer: Unsupported texture format.",t)}return a}var S3e=/^[fn]*\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)\s*[\-\>]*\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/i,T3e=/([a-z_0-9]+)\s*:\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/ig,$K={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"},E3e=i=>{i=i.trim();let e=i.match(S3e);if(e!==null&&e.length===4){let t=e[2],n=[],r=null;for(;(r=T3e.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=$K[x]),s.push(new vb(x,f))}let o=i.substring(e[0].length),a=e[3]||"void",l=e[1]!==void 0?e[1]:"";return{type:$K[a]||a,inputs:s,name:l,inputsCode:t,blockCode:o,outputType:a}}else throw new Error("THREE.WGSLNodeFunction: Function is not a WGSL code.")},m7=class extends wb{constructor(e){let{type:t,inputs:n,name:r,inputsCode:s,blockCode:o,outputType:a}=E3e(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}},g7=class extends xC{parseFunction(e){return new m7(e)}},M3e={[Co.READ_ONLY]:"read",[Co.WRITE_ONLY]:"write",[Co.READ_WRITE]:"read_write"},YK={[If]:"repeat",[qo]:"clamp",[Nf]:"mirror"},W8={vertex:Lh.VERTEX,fragment:Lh.FRAGMENT,compute:Lh.COMPUTE},KK={instance:!0,swizzleAssign:!1,storageBuffer:!0},C3e={"^^":"tsl_xor"},R3e={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>"},ZK={},Hv={tsl_xor:new Ji("fn tsl_xor( a : bool, b : bool ) -> bool { return ( a || b ) && !( a && b ); }"),mod_float:new Ji("fn tsl_mod_float( x : f32, y : f32 ) -> f32 { return x - y * floor( x / y ); }"),mod_vec2:new Ji("fn tsl_mod_vec2( x : vec2f, y : vec2f ) -> vec2f { return x - y * floor( x / y ); }"),mod_vec3:new Ji("fn tsl_mod_vec3( x : vec3f, y : vec3f ) -> vec3f { return x - y * floor( x / y ); }"),mod_vec4:new Ji("fn tsl_mod_vec4( x : vec4f, y : vec4f ) -> vec4f { return x - y * floor( x / y ); }"),equals_bool:new Ji("fn tsl_equals_bool( a : bool, b : bool ) -> bool { return a == b; }"),equals_bvec2:new Ji("fn tsl_equals_bvec2( a : vec2f, b : vec2f ) -> vec2<bool> { return vec2<bool>( a.x == b.x, a.y == b.y ); }"),equals_bvec3:new Ji("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 Ji("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 Ji("fn tsl_repeatWrapping_float( coord: f32 ) -> f32 { return fract( coord ); }"),mirrorWrapping_float:new Ji("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 Ji("fn tsl_clampWrapping_float( coord: f32 ) -> f32 { return clamp( coord, 0.0, 1.0 ); }"),inverse_mat2:new Ji(`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 ];@@ -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-`)},E3e={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"},ate="";(typeof navigator<"u"&&/Firefox|Deno/g.test(navigator.userAgent))!==!0&&(ate+=`diagnostic( off, derivative_uniformity );4562-`);var g7=class extends mC{constructor(e,t){super(e,t,new m7),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_${XK[e.wrapS]}S_${XK[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+`)},P3e={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"},cte="";(typeof navigator<"u"&&/Firefox|Deno/g.test(navigator.userAgent))!==!0&&(cte+=`diagnostic( off, derivative_uniformity );4562+`);var _7=class extends gC{constructor(e,t){super(e,t,new g7),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_${YK[e.wrapS]}S_${YK[e.wrapT]}T_${e.is3DTexture||e.isData3DTexture?"3d":"2d"}`,n=ZK[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===If?(r.push(Vv.repeatWrapping_float),o+=` tsl_repeatWrapping_float( coord.${c} )`):l===Vo?(r.push(Vv.clampWrapping_float),o+=` tsl_clampWrapping_float( coord.${c} )`):l===Nf?(r.push(Vv.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===If?(r.push(Hv.repeatWrapping_float),o+=` tsl_repeatWrapping_float( coord.${c} )`):l===qo?(r.push(Hv.clampWrapping_float),o+=` tsl_clampWrapping_float( coord.${c} )`):l===Nf?(r.push(Hv.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 Ji(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 C1(new P1(`textureDimensions( ${o} )`,a)),r.dimensionsSnippet[n]=s,(e.isArrayTexture||e.isDataArrayTexture||e.is3DTexture||e.isData3DTexture)&&(r.arrayLayerCount=new C1(new P1(`textureNumLayers(${t})`,"u32"))),e.isTextureCube&&(r.cubeFaceCount=new C1(new P1("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(zf.TEXTURE_COMPARE)}isUnfilterable(e){return this.getComponentTypeFromTexture(e)!=="float"||!this.isAvailable("float32Filterable")&&e.type===Zi||this.isSampleCompare(e)===!1&&e.minFilter===yi&&e.magFilter===yi||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=S3e[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."),Mo.READ_WRITE):Mo.READ_ONLY:e.access}getStorageAccess(e,t){return w3e[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 bb(s.name,s.node,l,p):f=new k1(s.name,s.node,l,p):t==="cubeTexture"||t==="cubeDepthTexture"?f=new MC(s.name,s.node,l,p):t==="texture3D"&&(f=new bb(s.name,s.node,l,p)),f.store=e.isStorageTextureNode===!0,f.mipLevel=f.store?e.mipLevel:0,f.setVisibility(H8[n]),e.value.isCubeTexture===!0||this.isUnfilterable(e.value)===!1&&f.store===!1||e.gatherNode!==null){let v=new n7(`${s.name}_sampler`,s.node,l);v.setVisibility(H8[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"?SC:r7;p=new x(e,l),f.buffer=p}p.setVisibility(p.getVisibility()|H8[n]),u.push(p),a=p,s.name=r||"NodeBuffer_"+s.id}else{let f=this.uniformGroups[c];f===void 0&&(f=new TC(c,l),f.setVisibility(Lh.VERTEX|Lh.FRAGMENT|Lh.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+`,ZK[t]=n=new Ji(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 R1(new I1(`textureDimensions( ${o} )`,a)),r.dimensionsSnippet[n]=s,(e.isArrayTexture||e.isDataArrayTexture||e.is3DTexture||e.isData3DTexture)&&(r.arrayLayerCount=new R1(new I1(`textureNumLayers(${t})`,"u32"))),e.isTextureCube&&(r.cubeFaceCount=new R1(new I1("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(zf.TEXTURE_COMPARE)}isUnfilterable(e){return this.getComponentTypeFromTexture(e)!=="float"||!this.isAvailable("float32Filterable")&&e.type===Zi||this.isSampleCompare(e)===!1&&e.minFilter===yi&&e.magFilter===yi||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=C3e[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."),Co.READ_WRITE):Co.READ_ONLY:e.access}getStorageAccess(e,t){return M3e[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 Sb(s.name,s.node,l,p):f=new G1(s.name,s.node,l,p):t==="cubeTexture"||t==="cubeDepthTexture"?f=new CC(s.name,s.node,l,p):t==="texture3D"&&(f=new Sb(s.name,s.node,l,p)),f.store=e.isStorageTextureNode===!0,f.mipLevel=f.store?e.mipLevel:0,f.setVisibility(W8[n]),e.value.isCubeTexture===!0||this.isUnfilterable(e.value)===!1&&f.store===!1||e.gatherNode!==null){let v=new i7(`${s.name}_sampler`,s.node,l);v.setVisibility(W8[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"?TC:s7;p=new x(e,l),f.buffer=p}p.setVisibility(p.getVisibility()|W8[n]),u.push(p),a=p,s.name=r||"NodeBuffer_"+s.id}else{let f=this.uniformGroups[c];f===void 0&&(f=new EC(c,l),f.setVisibility(Lh.VERTEX|Lh.FRAGMENT|Lh.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=p7(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 R=A7(x,t.device),P=this.getStorageAccess(c.node,e),C=c.node.value.is3DTexture,L=c.node.value.isArrayTexture;w=`texture_storage_${C?"3d":`2d${L?"_array":""}`}<${R}, ${P}>`}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 R=this.getComponentTypeFromTexture(x).charAt(0);w=`texture${S}_2d<${R}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 R=` value : array< ${p.isAtomic?`atomic<${x}>`:`${x}`}${w} >`;s.push(this._getWGSLStructBinding(c.name,R,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(),R=this.getType(this.getVectorType(T));v.push(` ${S.name} : ${R}`)}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 T3e[e]||e}isAvailable(e){let t=$K[e];return t===void 0&&(e==="float32Filterable"?t=this.renderer.hasFeature("float32-filterable"):e==="clipDistance"&&(t=this.renderer.hasFeature("clip-distances")),$K[e]=t),t}_getWGSLMethod(e){return Vv[e]!==void 0&&this._include(e),E3e[e]}_include(e){let t=Vv[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 R3e[e]||e}isAvailable(e){let t=KK[e];return t===void 0&&(e==="float32Filterable"?t=this.renderer.hasFeature("float32-filterable"):e==="clipDistance"&&(t=this.renderer.hasFeature("clip-distances")),KK[e]=t),t}_getWGSLMethod(e){return Hv[e]!==void 0&&this._include(e),P3e[e]}_include(e){let t=Hv[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-${ate}4637+${cte}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};`}},Ko=new p0,W8=new Wm,lte=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"&<e.set(Float16Array,["float16"]);var M3e=new Map([[x_,["float16"]]]),C3e=new Map([[Int32Array,"sint32"],[Int16Array,"sint32"],[Uint32Array,"uint32"],[Uint16Array,"uint32"],[Float32Array,"float32"]]),_7=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;Ko.label=n.name,Ko.size=f,Ko.usage=t,Ko.mappedAtCreation=!0,o=a.createBuffer(Ko),Ko.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=L_(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?hM.Instance:hM.Vertex):(f=s.itemSize*o,p=s.isInstancedBufferAttribute?hM.Instance:hM.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){Ko.label=`${t.name}_readback`,Ko.size=t.maxByteLength,Ko.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,u=o.createBuffer(Ko),Ko.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 Ko.label=`${e.name}_readback`,Ko.size=c,Ko.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,u=o.createBuffer(Ko),Ko.reset();W8.label=`readback_encoder_${e.name}`;let f=o.createCommandEncoder(W8);W8.reset(),f.copyBufferToBuffer(l,n,u,0,c);let p=f.finish();if(Mh(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=C3e.get(r);else{let l=(M3e.get(s)||lte.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}},Cl=new LC,qv=new p0,_1=new Sb,x7=class{constructor(e){this.layoutGPU=e,this.usedTimes=0}},y7=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=V1(JSON.stringify(s)),a=this._bindGroupLayoutCache.get(o);return a===void 0&&(a=new x7(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=L_(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];qv.label="bindingCameraIndex_"+o,qv.size=16,qv.usage=s;let a=r.createBuffer(qv);qv.reset(),r.queue.writeBuffer(a,0,e,0),Cl.label="bindGroupCameraIndex_"+o,Cl.layout=t,Cl.entries.push({binding:0,resource:{buffer:a}});let l=r.createBindGroup(Cl);return Cl.reset(),l}createBindGroup(e,t){let n=this.backend,r=n.device,s=0;Cl.label="bindGroup_"+e.name,Cl.layout=t;for(let a of e.bindings){if(a.isUniformBuffer){let l=n.get(a);Cl.entries.push({binding:s,resource:{buffer:l.buffer}})}else if(a.isStorageBuffer){let l=n.get(a.attribute).buffer;Cl.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=A3e.All,v;a.isSampledCubeTexture?v=To.Cube:a.texture.isArrayTexture||a.texture.isDataArrayTexture||a.texture.isCompressedArrayTexture?v=To.TwoDArray:a.isSampledTexture3D?v=To.ThreeD:v=To.TwoD,_1.aspect=x,_1.dimension=v,_1.mipLevelCount=u,_1.baseMipLevel=f,c=l[p]=l.texture.createView(_1),_1.reset()}}Cl.entries.push({binding:s,resource:c})}else if(a.isSampler){let l=n.get(a);Cl.entries.push({binding:s,resource:l.sampler})}s++}let o=r.createBindGroup(Cl);return Cl.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&Lh.COMPUTE&&(r.access===Mo.READ_WRITE||r.access===Mo.WRITE_ONLY)?a.type=k8.Storage:a.type=k8.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===Mo.READ_WRITE?a.access=G8.ReadWrite:l===Mo.WRITE_ONLY?a.access=G8.WriteOnly:a.access=G8.ReadOnly,r.texture.isArrayTexture?a.viewDimension=To.TwoDArray:r.texture.is3DTexture&&(a.viewDimension=To.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=bm.UnfilterableFloat)),r.texture.isDepthTexture)s.compatibilityMode&&r.texture.compareFunction===null?a.sampleType=bm.UnfilterableFloat:a.sampleType=bm.Depth;else{let c=r.texture.type;c===Fr?a.sampleType=bm.SInt:c===Ai?a.sampleType=bm.UInt:c===Zi&&(this.backend.hasFeature("float32-filterable")?a.sampleType=bm.Float:a.sampleType=bm.UnfilterableFloat)}r.isSampledCubeTexture?a.viewDimension=To.Cube:r.texture.isArrayTexture||r.texture.isDataArrayTexture||r.texture.isCompressedArrayTexture?a.viewDimension=To.TwoDArray:r.isSampledTexture3D&&(a.viewDimension=To.ThreeD),o.texture=a}else if(r.isSampler){let a={};r.texture.isDepthTexture&&(r.texture.compareFunction!==null&&r.textureNode.compareNode!==null&&s.hasCompatibility(zf.TEXTURE_COMPARE)?a.type=VK.Comparison:a.type=VK.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()}},v7=class{constructor(e){this.backend=e}getMaxAnisotropy(){return 16}getUniformBufferLimit(){return this.backend.device.limits.maxUniformBufferBindingSize}},b7=class{constructor(){this.label="",this.layout=null,this.compute=null}reset(){this.label="",this.layout=null,this.compute=null}},w7=class{constructor(){this.label="",this.bindGroupLayouts=null}reset(){this.label="",this.bindGroupLayouts=null}},Hv=new b7,x1=new w7,y1=new DC,Rl=new FC,S7=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!==Zr&&(r.blending!==cs||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 be=Z.getBlendMode(ae.name);be.blending===s2?de=w:be.blending!==Zr&&(de=this._getBlending(be))}else Qn("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);x1.bindGroupLayouts=x;let B=u.createPipelineLayout(x1);x1.reset(),Rl.label=`renderPipeline_${r.name||r.type}_${r.id}`,Rl.vertex=Object.assign({},R,{buffers:v}),Rl.fragment=Object.assign({},C,{targets:P}),Rl.primitive=L,Rl.multisample.count=N,Rl.multisample.alphaToCoverageEnabled=r.alphaToCoverage&&N>1,Rl.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===$v.TriangleList&&(z.depthBias=r.polygonOffsetUnits,z.depthBiasSlopeScale=r.polygonOffsetFactor,z.depthBiasClamp=0),Rl.depthStencil=z),u.pushErrorScope("validation");let K=[{program:a,module:R.module},{program:l,module:C.module}],J=Rl.label;if(t===null)p.pipeline=u.createRenderPipeline(Rl),Rl.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(Rl)}catch(de){ee=de}if(Rl.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);y1.label=t,y1.colorFormats=a,y1.depthStencilFormat=o,y1.sampleCount=l;let c=s.createRenderBundleEncoder(y1);return y1.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"),x1.bindGroupLayouts=a;let u=r.createPipelineLayout(x1);x1.reset(),Hv.label=c,Hv.compute=s,Hv.layout=u,o.pipeline=r.createComputePipeline(Hv),Hv.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};`}},Zo=new p0,j8=new Wm,ute=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"&&ute.set(Float16Array,["float16"]);var I3e=new Map([[y_,["float16"]]]),N3e=new Map([[Int32Array,"sint32"],[Int16Array,"sint32"],[Uint32Array,"uint32"],[Uint16Array,"uint32"],[Float32Array,"float32"]]),x7=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;Zo.label=n.name,Zo.size=f,Zo.usage=t,Zo.mappedAtCreation=!0,o=a.createBuffer(Zo),Zo.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=D_(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 P=Math.floor(w.start/l),C=Math.ceil((w.start+w.count)/l)-P;S=P*c*p,T=C*c*p}else S=w.start*p,T=w.count*p;let R=S*(f?a.BYTES_PER_ELEMENT:1);r.queue.writeBuffer(o,R,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?fM.Instance:fM.Vertex):(f=s.itemSize*o,p=s.isInstancedBufferAttribute?fM.Instance:fM.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){Zo.label=`${t.name}_readback`,Zo.size=t.maxByteLength,Zo.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,u=o.createBuffer(Zo),Zo.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 Zo.label=`${e.name}_readback`,Zo.size=c,Zo.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,u=o.createBuffer(Zo),Zo.reset();j8.label=`readback_encoder_${e.name}`;let f=o.createCommandEncoder(j8);j8.reset(),f.copyBufferToBuffer(l,n,u,0,c);let p=f.finish();if(Mh(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=N3e.get(r);else{let l=(I3e.get(s)||ute.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}},Cl=new DC,Wv=new p0,x1=new Eb,y7=class{constructor(e){this.layoutGPU=e,this.usedTimes=0}},v7=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=q1(JSON.stringify(s)),a=this._bindGroupLayoutCache.get(o);return a===void 0&&(a=new y7(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=D_(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];Wv.label="bindingCameraIndex_"+o,Wv.size=16,Wv.usage=s;let a=r.createBuffer(Wv);Wv.reset(),r.queue.writeBuffer(a,0,e,0),Cl.label="bindGroupCameraIndex_"+o,Cl.layout=t,Cl.entries.push({binding:0,resource:{buffer:a}});let l=r.createBindGroup(Cl);return Cl.reset(),l}createBindGroup(e,t){let n=this.backend,r=n.device,s=0;Cl.label="bindGroup_"+e.name,Cl.layout=t;for(let a of e.bindings){if(a.isUniformBuffer){let l=n.get(a);Cl.entries.push({binding:s,resource:{buffer:l.buffer}})}else if(a.isStorageBuffer){let l=n.get(a.attribute).buffer;Cl.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=x3e.All,v;a.isSampledCubeTexture?v=Eo.Cube:a.texture.isArrayTexture||a.texture.isDataArrayTexture||a.texture.isCompressedArrayTexture?v=Eo.TwoDArray:a.isSampledTexture3D?v=Eo.ThreeD:v=Eo.TwoD,x1.aspect=x,x1.dimension=v,x1.mipLevelCount=u,x1.baseMipLevel=f,c=l[p]=l.texture.createView(x1),x1.reset()}}Cl.entries.push({binding:s,resource:c})}else if(a.isSampler){let l=n.get(a);Cl.entries.push({binding:s,resource:l.sampler})}s++}let o=r.createBindGroup(Cl);return Cl.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&Lh.COMPUTE&&(r.access===Co.READ_WRITE||r.access===Co.WRITE_ONLY)?a.type=G8.Storage:a.type=G8.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===Co.READ_WRITE?a.access=z8.ReadWrite:l===Co.WRITE_ONLY?a.access=z8.WriteOnly:a.access=z8.ReadOnly,r.texture.isArrayTexture?a.viewDimension=Eo.TwoDArray:r.texture.is3DTexture&&(a.viewDimension=Eo.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=bm.UnfilterableFloat)),r.texture.isDepthTexture)s.compatibilityMode&&r.texture.compareFunction===null?a.sampleType=bm.UnfilterableFloat:a.sampleType=bm.Depth;else{let c=r.texture.type;c===Fr?a.sampleType=bm.SInt:c===Ai?a.sampleType=bm.UInt:c===Zi&&(this.backend.hasFeature("float32-filterable")?a.sampleType=bm.Float:a.sampleType=bm.UnfilterableFloat)}r.isSampledCubeTexture?a.viewDimension=Eo.Cube:r.texture.isArrayTexture||r.texture.isDataArrayTexture||r.texture.isCompressedArrayTexture?a.viewDimension=Eo.TwoDArray:r.isSampledTexture3D&&(a.viewDimension=Eo.ThreeD),o.texture=a}else if(r.isSampler){let a={};r.texture.isDepthTexture&&(r.texture.compareFunction!==null&&r.textureNode.compareNode!==null&&s.hasCompatibility(zf.TEXTURE_COMPARE)?a.type=HK.Comparison:a.type=HK.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()}},b7=class{constructor(e){this.backend=e}getMaxAnisotropy(){return 16}getUniformBufferLimit(){return this.backend.device.limits.maxUniformBufferBindingSize}},w7=class{constructor(){this.label="",this.layout=null,this.compute=null}reset(){this.label="",this.layout=null,this.compute=null}},S7=class{constructor(){this.label="",this.bindGroupLayouts=null}reset(){this.label="",this.bindGroupLayouts=null}},jv=new w7,y1=new S7,v1=new FC,Rl=new OC,T7=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!==Qr&&(r.blending!==cs||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),R=[];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 be=Z.getBlendMode(ae.name);be.blending===a2?de=w:be.blending!==Qr&&(de=this._getBlending(be))}else Qn("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;R.push({format:ce,blend:de,writeMask:T})}}else{let j=f.getCurrentColorFormat(e.context);R.push({format:j,blend:w,writeMask:T})}let P=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);y1.bindGroupLayouts=x;let B=u.createPipelineLayout(y1);y1.reset(),Rl.label=`renderPipeline_${r.name||r.type}_${r.id}`,Rl.vertex=Object.assign({},P,{buffers:v}),Rl.fragment=Object.assign({},C,{targets:R}),Rl.primitive=L,Rl.multisample.count=N,Rl.multisample.alphaToCoverageEnabled=r.alphaToCoverage&&N>1,Rl.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===Kv.TriangleList&&(z.depthBias=r.polygonOffsetUnits,z.depthBiasSlopeScale=r.polygonOffsetFactor,z.depthBiasClamp=0),Rl.depthStencil=z),u.pushErrorScope("validation");let K=[{program:a,module:P.module},{program:l,module:C.module}],J=Rl.label;if(t===null)p.pipeline=u.createRenderPipeline(Rl),Rl.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(Rl)}catch(de){ee=de}if(Rl.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);v1.label=t,v1.colorFormats=a,v1.depthStencilFormat=o,v1.sampleCount=l;let c=s.createRenderBundleEncoder(v1);return v1.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"),y1.bindGroupLayouts=a;let u=r.createPipelineLayout(y1);y1.reset(),jv.label=c,jv.compute=s,jv.layout=u,o.pipeline=r.createComputePipeline(jv),jv.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===Uf){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:vm.Add},n={srcFactor:p,dstFactor:x,operation:vm.Add}};if(l)switch(r){case cs:c(oi.One,oi.OneMinusSrcAlpha,oi.One,oi.OneMinusSrcAlpha);break;case ju:c(oi.One,oi.One,oi.One,oi.One);break;case Xu:c(oi.Zero,oi.OneMinusSrc,oi.Zero,oi.One);break;case $u:c(oi.Dst,oi.OneMinusSrcAlpha,oi.Zero,oi.One);break}else switch(r){case cs:c(oi.SrcAlpha,oi.OneMinusSrcAlpha,oi.One,oi.OneMinusSrcAlpha);break;case ju:c(oi.SrcAlpha,oi.One,oi.One,oi.One);break;case Xu:Ge(`WebGPURenderer: "SubtractiveBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break;case $u: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 Xc:t=oi.Zero;break;case l2:t=oi.One;break;case c2:t=oi.Src;break;case u2:t=oi.OneMinusSrc;break;case Xd:t=oi.SrcAlpha;break;case $d:t=oi.OneMinusSrcAlpha;break;case d2:t=oi.Dst;break;case p2:t=oi.OneMinusDst;break;case h2:t=oi.DstAlpha;break;case f2:t=oi.OneMinusDstAlpha;break;case A2:t=oi.SrcAlphaSaturated;break;case dve:t=oi.Constant;break;case pve:t=oi.OneMinusConstant;break;default:Ge("WebGPURenderer: Blend factor not supported.",e)}return t}_getStencilCompare(e){let t,n=e.stencilFunc;switch(n){case NL:t=So.Never;break;case Ey:t=So.Always;break;case LL:t=So.Less;break;case FL:t=So.LessEqual;break;case DL:t=So.Equal;break;case UL:t=So.GreaterEqual;break;case OL:t=So.Greater;break;case BL:t=So.NotEqual;break;default:Ge("WebGPURenderer: Invalid stencil function.",n)}return t}_getStencilOperation(e){let t;switch(e){case Mf:t=Kp.Keep;break;case TL:t=Kp.Zero;break;case EL:t=Kp.Replace;break;case IL:t=Kp.Invert;break;case ML:t=Kp.IncrementClamp;break;case CL:t=Kp.DecrementClamp;break;case RL:t=Kp.IncrementWrap;break;case PL:t=Kp.DecrementWrap;break;default:Ge("WebGPURenderer: Invalid stencil operation.",t)}return t}_getBlendOperation(e){let t;switch(e){case zs:t=vm.Add;break;case o2:t=vm.Subtract;break;case a2:t=vm.ReverseSubtract;break;case s3:t=vm.Min;break;case o3:t=vm.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?IC.Uint16:IC.Uint32);let o=n.side===hi;return e.isMesh&&e.matrixWorld.determinantAffine()<0&&(o=!o),r.frontFace=o===!0?kK.CW:kK.CCW,r.cullMode=n.side===sr?GK.None:GK.Back,r}_getColorWriteMask(e){return e.colorWrite===!0?zK.All:zK.None}_getDepthCompare(e){let t;if(e.depthTest===!1)t=So.Always;else{let n=this.backend.parameters.reversedDepthBuffer?P2[e.depthFunc]:e.depthFunc;switch(n){case gA:t=So.Never;break;case _A:t=So.Always;break;case xA:t=So.Less;break;case zu:t=So.LessEqual;break;case yA:t=So.Equal;break;case vA:t=So.GreaterEqual;break;case bA:t=So.Greater;break;case wA:t=So.NotEqual;break;default:Ge("WebGPUPipelineUtils: Invalid depth function.",n)}}return t}},UC=class{constructor(){this.label="",this.type=void 0,this.count=0}reset(){this.label="",this.type=void 0,this.count=0}},wh=new p0,R3e=new Wm,Wv=new UC,T7=class extends RC{constructor(e,t,n=2048){super(n),this.device=e,this.type=t,Wv.label=`queryset_global_timestamp_${t}`,Wv.type="timestamp",Wv.count=this.maxQueries,this.querySet=this.device.createQuerySet(Wv),Wv.reset();let r=this.maxQueries*8;wh.label=`buffer_timestamp_resolve_${t}`,wh.size=r,wh.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,this.resolveBuffer=this.device.createBuffer(wh),wh.reset(),wh.label=`buffer_timestamp_result_${t}`,wh.size=r,wh.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,this.resultBuffer=this.device.createBuffer(wh),wh.reset()}allocateQueriesForContext(e){if(!this.trackTimestamp||this.isDisposed)return null;if(this.currentQueryIndex+2>this.maxQueries)return Qn(`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(R3e);r.resolveQuerySet(this.querySet,0,t,this.resolveBuffer,0),r.copyBufferToBuffer(this.resolveBuffer,0,this.resultBuffer,0,n);let s=r.finish();if(Mh(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}},T1=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}},M7=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}},nu={r:0,g:0,b:0,a:1},Pl=new p0,Ea=new Wm,gM=new E7,jv=new UC,_M=new OC,xM=new M7,uc=new G1,Sh=new G1,fr=new Sb,Kf=new BC,C7=class extends CC{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 s7(this),this.attributeUtils=new _7(this),this.bindingUtils=new y7(this),this.capabilities=new v7(this),this.pipelineUtils=new S7(this),this.textureUtils=new d7(this),this.occludedResolveCache=new Map;let t=typeof navigator>"u"?!0:/Android/.test(navigator.userAgent)===!1;this._compatibility={[zf.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(NC),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(NC.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===Fi?"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 Xa}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 Om,s.colorAttachments.push(new Fm),e.depth===!0||e.stencil===!0){let l=new T1;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:To.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(fr.label=`colorAttachment_${w}`,fr.baseMipLevel=e.activeMipmapLevel,fr.mipLevelCount=1,fr.baseArrayLayer=e.activeCubeFace,fr.arrayLayerCount=1,fr.dimension=To.TwoD,n.isRenderTarget3D)p=e.activeCubeFace,fr.baseArrayLayer=0,fr.dimension=To.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++){fr.baseArrayLayer=P,fr.arrayLayerCount=1,fr.dimension=To.TwoD;let R=S.texture.createView(fr);f.push({view:R,resolveTarget:void 0,depthSlice:void 0})}}else fr.dimension=To.TwoDArray;if(x!==!0){let T=S.texture.createView(fr),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})}fr.reset()}let v=[];for(let w=0;w<f.length;w++){let S=f[w],T=new Fm;T.view=S.view,T.depthSlice=S.depthSlice,T.resolveTarget=S.resolveTarget,v.push(T)}if(l={textureViews:f,colorAttachments:v,descriptor:new Om},e.depth){let w=this.get(e.depthTexture);(e.depthTexture.isArrayTexture||e.depthTexture.isCubeTexture)&&(fr.dimension=To.TwoD,fr.arrayLayerCount=1,fr.baseArrayLayer=e.activeCubeFace);let S=new T1;S.view=w.texture.createView(fr),l.depthStencilAttachment=S,fr.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||Mi.Load,f.storeOp=t.storeOp||Ma.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,jv.label=`occlusionQuerySet_${e.id}`,jv.type="occlusion",jv.count=r,s=n.createQuerySet(jv),jv.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:Mi.Load}),this.initTimestampQuery(rc.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:(nu.r=0,nu.g=0,nu.b=0,nu.a=1,f.clearValue=nu),f.loadOp=Mi.Clear):f.loadOp=Mi.Load,f.storeOp=Ma.Store}}else{let c=o.colorAttachments[0];e.clearColor?(c.clearValue=e.clearColorValue,c.loadOp=Mi.Clear):c.loadOp=Mi.Load,c.storeOp=Ma.Store}e.depth&&(e.clearDepth?(a.depthClearValue=e.clearDepthValue,a.depthLoadOp=Mi.Clear):a.depthLoadOp=Mi.Load,a.depthStoreOp=Ma.Store),e.stencil&&(e.clearStencil?(a.stencilClearValue=e.clearStencilValue,a.stencilLoadOp=Mi.Clear):a.stencilLoadOp=Mi.Load,a.stencilStoreOp=Ma.Store),Ea.label="renderContext_"+e.id;let l=n.createCommandEncoder(Ea);if(Ea.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 Fm;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 Om;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]||(fr.dimension=To.TwoD,fr.baseArrayLayer=a,fr.arrayLayerCount=1,o.viewCache[f]=o.texture.createView(fr),fr.reset());let p=new T1;p.view=o.viewCache[f],p.depthLoadOp=s.depthLoadOp||Mi.Clear,p.depthStoreOp=s.depthStoreOp||Ma.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 T1;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=Mi.Clear):o.depthLoadOp=Mi.Load),e.stencil&&(e.clearStencil?(o.stencilClearValue=e.clearStencilValue,o.stencilLoadOp=Mi.Clear):o.stencilLoadOp=Mi.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&&(Pl.size=s,Pl.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,o=this.device.createBuffer(Pl),Pl.reset(),this.occludedResolveCache.set(s,o)),Pl.size=s,Pl.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let a=this.device.createBuffer(Pl);Pl.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(Mh(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();nu.r=x.r,nu.g=x.g,nu.b=x.b,nu.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=nu,v.loadOp=Mi.Clear,v.storeOp=Ma.Store}(c||u)&&(l=x.depthStencilAttachment)}else{c=r.depth,u=r.stencil;let x={loadOp:e?Mi.Clear:Mi.Load,clearValue:e?nu:void 0};c&&(x.depthLoadOp=t?Mi.Clear:Mi.Load,x.depthClearValue=t?o.getClearDepth():void 0,x.depthStoreOp=Ma.Store),u&&(x.stencilLoadOp=n?Mi.Clear:Mi.Load,x.stencilClearValue=n?o.getClearStencil():void 0,x.stencilStoreOp=Ma.Store);let v=this._getRenderPassDescriptor(r,x);a=v.colorAttachments,l=v.depthStencilAttachment}c&&l&&(t?(l.depthLoadOp=Mi.Clear,l.depthClearValue=o.getClearDepth(),l.depthStoreOp=Ma.Store):(l.depthLoadOp=Mi.Load,l.depthStoreOp=Ma.Store)),u&&l&&(n?(l.stencilLoadOp=Mi.Clear,l.stencilClearValue=o.getClearStencil(),l.stencilStoreOp=Ma.Store):(l.stencilLoadOp=Mi.Load,l.stencilStoreOp=Ma.Store)),Ea.label="clear";let f=s.createCommandEncoder(Ea);Ea.reset(),f.beginRenderPass({colorAttachments:a,depthStencilAttachment:l}).end(),Mh(s,f.finish())}beginCompute(e){let t=this.get(e),n="computeGroup_"+e.id;gM.label=n,Ea.label=n,this.initTimestampQuery(rc.COMPUTE,this.getTimestampUID(e),gM),t.cmdEncoderGPU=this.device.createCommandEncoder(Ea),t.passEncoderGPU=t.cmdEncoderGPU.beginComputePass(gM),t.currentPipeline=null,Ea.reset(),gM.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(),Mh(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?IC.Uint16:IC.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 T7(this.device,e,2048));let r=this.timestampQueryPool[e],s=r.allocateQueriesForContext(t);xM.querySet=r.querySet,xM.beginningOfPassWriteIndex=s,xM.endOfPassWriteIndex=s+1,n.timestampWrites=xM}createNodeBuilder(e,t){return new g7(e,t)}createProgram(e){let t=this.get(e);_M.label=e.stage+(e.name!==""?`_${e.name}`:""),_M.code=e.code,t.module={module:this.device.createShaderModule(_M),entryPoint:"main"},_M.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&Lh.VERTEX&&s.push("vertex"),e.visibility&Lh.FRAGMENT&&s.push("fragment"),e.visibility&Lh.COMPUTE&&s.push("compute");let o=`(${s.join(",")})`;Pl.label=`bindingBuffer${e.id}_${e.name}_${o}`,Pl.size=n,Pl.usage=r;let a=this.device.createBuffer(Pl);Pl.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 HK[e]!==void 0&&(e=HK[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),Ea.label="copyTextureToTexture_"+e.id+"_"+t.id;let S=this.device.createCommandEncoder(Ea);Ea.reset();let T=this.get(e).texture,P=this.get(t).texture;uc.texture=T,uc.mipLevel=s,uc.origin.x=u,uc.origin.y=f,uc.origin.z=p,Sh.texture=P,Sh.mipLevel=o,Sh.origin.x=a,Sh.origin.y=l,Sh.origin.z=c,Kf.width=x,Kf.height=v,Kf.depthOrArrayLayers=w,S.copyTextureToTexture(uc,Sh,Kf),uc.reset(),Sh.reset(),Kf.reset(),Mh(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):(Ea.label="copyFramebufferToTexture_"+e.id,a=this.device.createCommandEncoder(Ea),Ea.reset()),uc.texture=s,uc.origin.x=n.x,uc.origin.y=n.y,Sh.texture=o,Kf.width=n.z,Kf.height=n.w,a.copyTextureToTexture(uc,Sh,Kf),uc.reset(),Sh.reset(),Kf.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=Mi.Load;t.depth&&(l.depthStencilAttachment.depthLoadOp=Mi.Load),t.stencil&&(l.depthStencilAttachment.stencilLoadOp=Mi.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 Mh(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()}},R7=class extends OA{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}},P7=class extends OA{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}},I7=class extends yC{constructor(){super(),this.addMaterial(eO,"MeshPhongMaterial"),this.addMaterial(QM,"MeshStandardMaterial"),this.addMaterial(lO,"MeshPhysicalMaterial"),this.addMaterial(uO,"MeshToonMaterial"),this.addMaterial(QF,"MeshBasicMaterial"),this.addMaterial(JF,"MeshLambertMaterial"),this.addMaterial($F,"MeshNormalMaterial"),this.addMaterial(hO,"MeshMatcapMaterial"),this.addMaterial(WF,"LineBasicMaterial"),this.addMaterial(jF,"LineDashedMaterial"),this.addMaterial(dO,"PointsMaterial"),this.addMaterial(JM,"SpriteMaterial"),this.addMaterial(AO,"ShadowMaterial"),this.addLight(sB,Zy),this.addLight(RB,BA),this.addLight(DB,Qy),this.addLight(yb,OA),this.addLight(CB,UA),this.addLight(PB,Yy),this.addLight(NB,Jy),this.addLight(IB,R7),this.addLight(LB,P7),this.addToneMapping(Mee,m2),this.addToneMapping(Cee,g2),this.addToneMapping(Ree,_2),this.addToneMapping(Pee,x2),this.addToneMapping(Iee,y2),this.addToneMapping(Nee,v2)}},z1=class extends qB{constructor(e={}){let t;e.forceWebGL?t=PC:(t=C7,e.getFallback=()=>(je("WebGPURenderer: WebGPU is not available, running under WebGL2 backend."),new PC(e)));let n=new t(e);super(n,e),this.library=new I7,this.isWebGPURenderer=!0,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}};var yet=k.BRDF_GGX,vet=k.BRDF_Lambert,bet=k.BasicPointShadowFilter,wet=k.BasicShadowFilter,Tet=k.Break,Eet=k.Const,Met=k.Continue,Cet=k.DFGLUT,Ret=k.D_GGX,Pet=k.Discard,Iet=k.EPSILON,Net=k.F_Schlick,cte=k.Fn,Let=k.INFINITY,ute=k.If,hte=k.Loop,Det=k.NodeAccess,Fet=k.NodeShaderStage,Oet=k.NodeType,Bet=k.NodeUpdateType,Uet=k.PCFShadowFilter,ket=k.PCFSoftShadowFilter,Get=k.PI,zet=k.PI2,Vet=k.TWO_PI,qet=k.HALF_PI,Het=k.PointShadowFilter,Wet=k.Return,jet=k.Schlick_to_F0,Xet=k.ShaderNode,$et=k.Stack,Yet=k.Switch,Ket=k.TBNViewMatrix,Zet=k.VSMShadowFilter,Qet=k.V_GGX_SmithCorrelated,Jet=k.Var,ett=k.VarIntent,ttt=k.abs,ntt=k.acesFilmicToneMapping,itt=k.acos,rtt=k.acosh,stt=k.add,ott=k.addMethodChaining,att=k.addNodeElement,ltt=k.agxToneMapping,ctt=k.all,utt=k.alphaT,htt=k.ambientOcclusion,ftt=k.and,dtt=k.anisotropy,ptt=k.anisotropyB,Att=k.anisotropyT,mtt=k.any,gtt=k.append,_tt=k.array,fte=k.asin,xtt=k.asinh,ytt=k.assign,vtt=k.atan,btt=k.atanh,wtt=k.atomicAdd,Stt=k.atomicAnd,Ttt=k.atomicFunc,Ett=k.atomicLoad,Mtt=k.atomicMax,Ctt=k.atomicMin,Rtt=k.atomicOr,Ptt=k.atomicStore,Itt=k.atomicSub,Ntt=k.atomicXor,Ltt=k.attenuationColor,Dtt=k.attenuationDistance,Ftt=k.attribute,Ott=k.attributeArray,Btt=k.backgroundBlurriness,Utt=k.backgroundIntensity,ktt=k.backgroundRotation,Gtt=k.batch,ztt=k.bentNormalView,Vtt=k.billboarding,qtt=k.bitAnd,Htt=k.bitNot,Wtt=k.bitOr,jtt=k.bitXor,Xtt=k.bitangentGeometry,$tt=k.bitangentLocal,Ytt=k.bitangentView,Ktt=k.bitangentWorld,Ztt=k.bitcast,Qtt=k.blendBurn,Jtt=k.blendColor,ent=k.blendDodge,tnt=k.blendOverlay,nnt=k.blendScreen,int=k.blur,rnt=k.bool,snt=k.buffer,ont=k.bufferAttribute,ant=k.bumpMap,lnt=k.builtin,cnt=k.builtinAOContext,unt=k.builtinShadowContext,hnt=k.bvec2,fnt=k.bvec3,dnt=k.bvec4,pnt=k.bypass,Ant=k.cache,mnt=k.call,gnt=k.cameraFar,_nt=k.cameraIndex,xnt=k.cameraNear,ynt=k.cameraNormalMatrix,vnt=k.cameraPosition,bnt=k.cameraProjectionMatrix,wnt=k.cameraProjectionMatrixInverse,Snt=k.cameraViewMatrix,Tnt=k.cameraViewport,Ent=k.cameraWorldMatrix,Mnt=k.cbrt,Cnt=k.cdl,Rnt=k.ceil,Pnt=k.checker,Int=k.cineonToneMapping,Nnt=k.clamp,Lnt=k.clearcoat,Dnt=k.clearcoatNormalView,Fnt=k.clearcoatRoughness,Ont=k.clipSpace,Bnt=k.code,Unt=k.color,knt=k.colorSpaceToWorking,Gnt=k.colorToDirection,znt=k.compute,Vnt=k.computeKernel,qnt=k.computeSkinning,Hnt=k.context,Wnt=k.convert,jnt=k.convertColorSpace,Xnt=k.convertToTexture,$nt=k.countLeadingZeros,Ynt=k.countOneBits,Knt=k.countTrailingZeros,dte=k.cos,Znt=k.cosh,Qnt=k.cross,Jnt=k.cubeTexture,eit=k.cubeTextureBase,tit=k.dFdx,nit=k.dFdy,iit=k.dashSize,rit=k.debug,sit=k.decrement,oit=k.decrementBefore,ait=k.defaultBuildStages,lit=k.defaultShaderStages,cit=k.defined,uit=k.degrees,hit=k.deltaTime,fit=k.densityFog,dit=k.densityFogFactor,pit=k.depth,Ait=k.depthPass,mit=k.determinant,git=k.difference,_it=k.diffuseColor,xit=k.directPointLight,yit=k.directionToColor,vit=k.directionToFaceDirection,bit=k.dispersion,wit=k.distance,Sit=k.div,Tit=k.dot,Eit=k.drawIndex,Mit=k.dynamicBufferAttribute,Cit=k.element,Rit=k.emissive,Pit=k.equal,Iit=k.equirectDirection,Nit=k.equirectUV,pte=k.exp,Lit=k.exp2,Dit=k.exponentialHeightFogFactor,Fit=k.expression,Oit=k.faceDirection,Bit=k.faceForward,Uit=k.faceforward,Ate=k.float,kit=k.floatBitsToInt,Git=k.floatBitsToUint,zit=k.floor,Vit=k.fog,qit=k.fract,Hit=k.frameGroup,Wit=k.frameId,jit=k.frontFacing,Xit=k.fwidth,$it=k.gain,Yit=k.gapSize,Kit=k.getConstNodeType,Zit=k.getCurrentStack,Qit=k.getDirection,Jit=k.getDistanceAttenuation,ert=k.getGeometryRoughness,trt=k.getNormalFromDepth,nrt=k.interleavedGradientNoise,irt=k.vogelDiskSample,rrt=k.getParallaxCorrectNormal,srt=k.getRoughness,ort=k.getScreenPosition,art=k.getShIrradianceAt,lrt=k.getShadowMaterial,crt=k.getShadowRenderObjectFunction,urt=k.getTextureIndex,hrt=k.getViewPosition,frt=k.globalId,drt=k.glsl,prt=k.glslFn,Art=k.grayscale,mrt=k.greaterThan,grt=k.greaterThanEqual,_rt=k.hash,xrt=k.highpModelNormalViewMatrix,yrt=k.highpModelViewMatrix,vrt=k.hue,brt=k.increment,wrt=k.incrementBefore,Srt=k.instance,mte=k.instanceIndex,Trt=k.instancedArray,Ert=k.instancedBufferAttribute,Mrt=k.instancedDynamicBufferAttribute,Crt=k.instancedMesh,Rrt=k.int,Prt=k.intBitsToFloat,Irt=k.inverse,Nrt=k.inverseSqrt,Lrt=k.inversesqrt,Drt=k.invocationLocalIndex,Frt=k.invocationSubgroupIndex,Ort=k.ior,Brt=k.iridescence,Urt=k.iridescenceIOR,krt=k.iridescenceThickness,Grt=k.ivec2,zrt=k.ivec3,Vrt=k.ivec4,qrt=k.js,Hrt=k.label,Wrt=k.length,jrt=k.lengthSq,Xrt=k.lessThan,$rt=k.lessThanEqual,Yrt=k.lightPosition,Krt=k.lightProjectionUV,Zrt=k.lightShadowMatrix,Qrt=k.lightTargetDirection,Jrt=k.lightTargetPosition,est=k.lightViewPosition,tst=k.lightingContext,nst=k.lights,ist=k.linearDepth,rst=k.linearToneMapping,sst=k.localId,ost=k.log,ast=k.log2,lst=k.logarithmicDepthToViewZ,cst=k.luminance,ust=k.mat2,hst=k.mat3,fst=k.mat4,dst=k.matcapUV,pst=k.materialAO,Ast=k.materialAlphaTest,mst=k.materialAnisotropy,gst=k.materialAnisotropyVector,_st=k.materialAttenuationColor,xst=k.materialAttenuationDistance,yst=k.materialClearcoat,vst=k.materialClearcoatNormal,bst=k.materialClearcoatRoughness,wst=k.materialColor,Sst=k.materialDispersion,Tst=k.materialEmissive,Est=k.materialEnvIntensity,Mst=k.materialEnvRotation,Cst=k.materialIOR,Rst=k.materialIridescence,Pst=k.materialIridescenceIOR,Ist=k.materialIridescenceThickness,Nst=k.materialLightMap,Lst=k.materialLineDashOffset,Dst=k.materialLineDashSize,Fst=k.materialLineGapSize,Ost=k.materialLineScale,Bst=k.materialLineWidth,Ust=k.materialMetalness,kst=k.materialNormal,Gst=k.materialOpacity,zst=k.materialPointSize,Vst=k.materialReference,qst=k.materialReflectivity,Hst=k.materialRefractionRatio,Wst=k.materialRotation,jst=k.materialRoughness,Xst=k.materialSheen,$st=k.materialSheenRoughness,Yst=k.materialShininess,Kst=k.materialSpecular,Zst=k.materialSpecularColor,Qst=k.materialSpecularIntensity,Jst=k.materialSpecularStrength,eot=k.materialThickness,tot=k.materialTransmission,not=k.max,iot=k.maxMipLevel,rot=k.mediumpModelViewMatrix,sot=k.metalness,oot=k.min,aot=k.mix,lot=k.mixElement,cot=k.mod,uot=k.modelDirection,hot=k.modelNormalMatrix,fot=k.modelPosition,dot=k.modelRadius,pot=k.modelScale,Aot=k.modelViewMatrix,mot=k.modelViewPosition,got=k.modelViewProjection,_ot=k.modelWorldMatrix,xot=k.modelWorldMatrixInverse,yot=k.morphReference,vot=k.mrt,bot=k.mul,wot=k.mx_aastep,Sot=k.mx_add,Tot=k.mx_atan2,Eot=k.mx_cell_noise_float,Mot=k.mx_contrast,Cot=k.mx_divide,Rot=k.mx_fractal_noise_float,Pot=k.mx_fractal_noise_vec2,Iot=k.mx_fractal_noise_vec3,Not=k.mx_fractal_noise_vec4,Lot=k.mx_frame,Dot=k.mx_heighttonormal,Fot=k.mx_hsvtorgb,Oot=k.mx_ifequal,Bot=k.mx_ifgreater,Uot=k.mx_ifgreatereq,kot=k.mx_invert,Got=k.mx_modulo,zot=k.mx_multiply,Vot=k.mx_noise_float,qot=k.mx_noise_vec3,Hot=k.mx_noise_vec4,Wot=k.mx_place2d,jot=k.mx_power,Xot=k.mx_ramp4,$ot=k.mx_ramplr,Yot=k.mx_ramptb,Kot=k.mx_rgbtohsv,Zot=k.mx_rotate2d,Qot=k.mx_rotate3d,Jot=k.mx_safepower,eat=k.mx_separate,tat=k.mx_splitlr,nat=k.mx_splittb,iat=k.mx_srgb_texture_to_lin_rec709,rat=k.mx_subtract,sat=k.mx_timer,oat=k.mx_transform_uv,aat=k.mx_unifiednoise2d,lat=k.mx_unifiednoise3d,cat=k.mx_worley_noise_float,uat=k.mx_worley_noise_vec2,hat=k.mx_worley_noise_vec3,gte=k.negate,fat=k.negateOnBackSide,dat=k.neutralToneMapping,pat=k.nodeArray,Aat=k.nodeImmutable,mat=k.nodeObject,gat=k.nodeObjectIntent,_at=k.nodeObjects,xat=k.nodeProxy,yat=k.nodeProxyIntent,vat=k.normalFlat,bat=k.normalGeometry,wat=k.normalLocal,Sat=k.normalMap,Tat=k.normalView,Eat=k.normalViewGeometry,Mat=k.normalWorld,Cat=k.normalWorldGeometry,Rat=k.normalize,Pat=k.not,Iat=k.notEqual,Nat=k.numWorkgroups,Lat=k.objectDirection,Dat=k.objectGroup,Fat=k.objectPosition,Oat=k.objectRadius,Bat=k.objectScale,Uat=k.objectViewPosition,kat=k.objectWorldMatrix,Gat=k.OnBeforeObjectUpdate,zat=k.OnBeforeMaterialUpdate,Vat=k.OnObjectUpdate,qat=k.OnMaterialUpdate,Hat=k.oneMinus,Wat=k.or,jat=k.orthographicDepthToViewZ,Xat=k.oscSawtooth,$at=k.oscSine,Yat=k.oscSquare,Kat=k.oscTriangle,Zat=k.output,Qat=k.outputStruct,Jat=k.overloadingFn,elt=k.overrideNode,tlt=k.overrideNodes,nlt=k.packHalf2x16,ilt=k.packSnorm2x16,rlt=k.packUnorm2x16,slt=k.packNormalToRGB,olt=k.parabola,alt=k.parallaxDirection,llt=k.parallaxUV,clt=k.parameter,ult=k.pass,hlt=k.passTexture,flt=k.pcurve,dlt=k.perspectiveDepthToViewZ,plt=k.pmremTexture,Alt=k.pointShadow,mlt=k.pointUV,glt=k.pointWidth,_lt=k.positionGeometry,xlt=k.positionLocal,ylt=k.positionPrevious,vlt=k.positionView,blt=k.positionViewDirection,wlt=k.positionWorld,Slt=k.positionWorldDirection,Tlt=k.posterize,Elt=k.pow,Mlt=k.pow2,Clt=k.pow3,Rlt=k.pow4,Plt=k.premultiplyAlpha,Ilt=k.property,Nlt=k.radians,Llt=k.rand,Dlt=k.range,Flt=k.rangeFog,Olt=k.rangeFogFactor,Blt=k.reciprocal,Ult=k.reference,klt=k.referenceBuffer,Glt=k.reflect,zlt=k.reflectVector,Vlt=k.reflectView,qlt=k.reflector,Hlt=k.refract,Wlt=k.refractVector,jlt=k.refractView,Xlt=k.reinhardToneMapping,$lt=k.remap,Ylt=k.remapClamp,Klt=k.renderGroup,Zlt=k.renderOutput,Qlt=k.rendererReference,Jlt=k.replaceDefaultUV,ect=k.rotate,tct=k.rotateUV,nct=k.roughness,ict=k.round,rct=k.rtt,sct=k.sRGBTransferEOTF,oct=k.sRGBTransferOETF,act=k.sample,lct=k.sampler,cct=k.samplerComparison,uct=k.saturate,hct=k.saturation,fct=k.screen,dct=k.screenCoordinate,pct=k.screenDPR,Act=k.screenSize,mct=k.screenUV,gct=k.select,_ct=k.setCurrentStack,xct=k.setName,yct=k.shaderStages,vct=k.shadow,bct=k.shadowPositionWorld,wct=k.shapeCircle,Sct=k.sharedUniformGroup,Tct=k.sheen,Ect=k.sheenRoughness,Mct=k.shiftLeft,Cct=k.shiftRight,Rct=k.shininess,Pct=k.sign,_te=k.sin,Ict=k.sinh,Nct=k.sinc,Lct=k.skinning,Dct=k.smoothstep,Fct=k.smoothstepElement,Oct=k.specularColor,Bct=k.specularF90,Uct=k.spherizeUV,kct=k.split,Gct=k.spritesheetUV,xte=k.sqrt,zct=k.stack,Vct=k.step,qct=k.stepElement,yte=k.storage,Hct=k.storageBarrier,Wct=k.storageTexture,jct=k.storageTexture3D,Xct=k.struct,$ct=k.sub,Yct=k.subgroupAdd,Kct=k.subgroupAll,Zct=k.subgroupAnd,Qct=k.subgroupAny,Jct=k.subgroupBallot,eut=k.subgroupBroadcast,tut=k.subgroupBroadcastFirst,nut=k.subBuild,iut=k.subgroupElect,rut=k.subgroupExclusiveAdd,sut=k.subgroupExclusiveMul,out=k.subgroupInclusiveAdd,aut=k.subgroupInclusiveMul,lut=k.subgroupIndex,cut=k.subgroupMax,uut=k.subgroupMin,hut=k.subgroupMul,fut=k.subgroupOr,dut=k.subgroupShuffle,put=k.subgroupShuffleDown,Aut=k.subgroupShuffleUp,mut=k.subgroupShuffleXor,gut=k.subgroupSize,_ut=k.subgroupXor,xut=k.tan,yut=k.tanh,vut=k.tangentGeometry,but=k.tangentLocal,wut=k.tangentView,Sut=k.tangentWorld,Tut=k.texture,Eut=k.texture3D,Mut=k.textureBarrier,Cut=k.textureBicubic,Rut=k.textureBicubicLevel,Put=k.textureCubeUV,Iut=k.textureLoad,Nut=k.textureSize,Lut=k.textureLevel,Dut=k.textureStore,Fut=k.thickness,Out=k.time,But=k.toneMapping,Uut=k.toneMappingExposure,kut=k.toonOutlinePass,Gut=k.transformDirection,zut=k.transformNormal,Vut=k.transformNormalByInverseViewMatrix,qut=k.transformNormalByViewMatrix,Hut=k.transformNormalToView,Wut=k.transformedClearcoatNormalView,jut=k.transformedNormalView,Xut=k.transformedNormalWorld,$ut=k.transmission,Yut=k.transpose,Kut=k.triNoise3D,Zut=k.triplanarTexture,Qut=k.triplanarTextures,Jut=k.trunc,eht=k.uint,tht=k.uintBitsToFloat,vte=k.uniform,nht=k.uniformArray,iht=k.uniformCubeTexture,rht=k.uniformGroup,sht=k.uniformFlow,oht=k.uniformTexture,aht=k.unpackHalf2x16,lht=k.unpackSnorm2x16,cht=k.unpackUnorm2x16,uht=k.unpackRGBToNormal,hht=k.unpremultiplyAlpha,fht=k.userData,dht=k.uv,pht=k.uvec2,Aht=k.uvec3,mht=k.uvec4,ght=k.varying,_ht=k.varyingProperty,xht=k.vec2,yht=k.vec3,vht=k.vec4,bht=k.vectorComponents,wht=k.velocity,Sht=k.vertexColor,Tht=k.vertexIndex,Eht=k.vertexStage,Mht=k.vibrance,Cht=k.viewZToLogarithmicDepth,Rht=k.viewZToOrthographicDepth,Pht=k.viewZToPerspectiveDepth,Iht=k.viewZToReversedOrthographicDepth,Nht=k.viewZToReversedPerspectiveDepth,Lht=k.viewport,Dht=k.viewportCoordinate,Fht=k.viewportDepthTexture,Oht=k.viewportLinearDepth,Bht=k.viewportMipTexture,Uht=k.viewportOpaqueMipTexture,kht=k.viewportResolution,Ght=k.viewportSafeUV,zht=k.viewportSharedTexture,Vht=k.viewportSize,qht=k.viewportTexture,Hht=k.viewportUV,Wht=k.wgsl,jht=k.wgslFn,Xht=k.workgroupArray,$ht=k.workgroupBarrier,Yht=k.workgroupId,Kht=k.workingToColorSpace,Zht=k.xor;var bte=new ma,pR=new ie,X1=class extends e2{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 Rn(e,3)),this.setAttribute("uv",new Rn(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 Wu(t,6,1);return this.setAttribute("instanceStart",new xo(n,3,0)),this.setAttribute("instanceEnd",new xo(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 Wu(t,6,1);return this.setAttribute("instanceColorStart",new xo(n,3,0)),this.setAttribute("instanceColorEnd",new xo(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 zy(e.geometry)),this}fromLineSegments(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ma);let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),bte.setFromBufferAttribute(t),this.boundingBox.union(bte))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new $a),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++)pR.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(pR)),pR.fromBufferAttribute(t,s),r=Math.max(r,n.distanceToSquared(pR));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}};va.line={uniforms:QA.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===Uf){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:vm.Add},n={srcFactor:p,dstFactor:x,operation:vm.Add}};if(l)switch(r){case cs:c(oi.One,oi.OneMinusSrcAlpha,oi.One,oi.OneMinusSrcAlpha);break;case ju:c(oi.One,oi.One,oi.One,oi.One);break;case Xu:c(oi.Zero,oi.OneMinusSrc,oi.Zero,oi.One);break;case $u:c(oi.Dst,oi.OneMinusSrcAlpha,oi.Zero,oi.One);break}else switch(r){case cs:c(oi.SrcAlpha,oi.OneMinusSrcAlpha,oi.One,oi.OneMinusSrcAlpha);break;case ju:c(oi.SrcAlpha,oi.One,oi.One,oi.One);break;case Xu:Ge(`WebGPURenderer: "SubtractiveBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break;case $u: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 Xc:t=oi.Zero;break;case u2:t=oi.One;break;case h2:t=oi.Src;break;case f2:t=oi.OneMinusSrc;break;case Xd:t=oi.SrcAlpha;break;case $d:t=oi.OneMinusSrcAlpha;break;case A2:t=oi.Dst;break;case m2:t=oi.OneMinusDst;break;case d2:t=oi.DstAlpha;break;case p2:t=oi.OneMinusDstAlpha;break;case g2:t=oi.SrcAlphaSaturated;break;case gve:t=oi.Constant;break;case _ve:t=oi.OneMinusConstant;break;default:Ge("WebGPURenderer: Blend factor not supported.",e)}return t}_getStencilCompare(e){let t,n=e.stencilFunc;switch(n){case LL:t=To.Never;break;case Cy:t=To.Always;break;case DL:t=To.Less;break;case OL:t=To.LessEqual;break;case FL:t=To.Equal;break;case kL:t=To.GreaterEqual;break;case BL:t=To.Greater;break;case UL:t=To.NotEqual;break;default:Ge("WebGPURenderer: Invalid stencil function.",n)}return t}_getStencilOperation(e){let t;switch(e){case Mf:t=Kp.Keep;break;case EL:t=Kp.Zero;break;case ML:t=Kp.Replace;break;case NL:t=Kp.Invert;break;case CL:t=Kp.IncrementClamp;break;case RL:t=Kp.DecrementClamp;break;case PL:t=Kp.IncrementWrap;break;case IL:t=Kp.DecrementWrap;break;default:Ge("WebGPURenderer: Invalid stencil operation.",t)}return t}_getBlendOperation(e){let t;switch(e){case zs:t=vm.Add;break;case l2:t=vm.Subtract;break;case c2:t=vm.ReverseSubtract;break;case o3:t=vm.Min;break;case a3:t=vm.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?NC.Uint16:NC.Uint32);let o=n.side===hi;return e.isMesh&&e.matrixWorld.determinantAffine()<0&&(o=!o),r.frontFace=o===!0?zK.CW:zK.CCW,r.cullMode=n.side===sr?VK.None:VK.Back,r}_getColorWriteMask(e){return e.colorWrite===!0?qK.All:qK.None}_getDepthCompare(e){let t;if(e.depthTest===!1)t=To.Always;else{let n=this.backend.parameters.reversedDepthBuffer?N2[e.depthFunc]:e.depthFunc;switch(n){case gA:t=To.Never;break;case _A:t=To.Always;break;case xA:t=To.Less;break;case zu:t=To.LessEqual;break;case yA:t=To.Equal;break;case vA:t=To.GreaterEqual;break;case bA:t=To.Greater;break;case wA:t=To.NotEqual;break;default:Ge("WebGPUPipelineUtils: Invalid depth function.",n)}}return t}},kC=class{constructor(){this.label="",this.type=void 0,this.count=0}reset(){this.label="",this.type=void 0,this.count=0}},wh=new p0,L3e=new Wm,Xv=new kC,E7=class extends PC{constructor(e,t,n=2048){super(n),this.device=e,this.type=t,Xv.label=`queryset_global_timestamp_${t}`,Xv.type="timestamp",Xv.count=this.maxQueries,this.querySet=this.device.createQuerySet(Xv),Xv.reset();let r=this.maxQueries*8;wh.label=`buffer_timestamp_resolve_${t}`,wh.size=r,wh.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,this.resolveBuffer=this.device.createBuffer(wh),wh.reset(),wh.label=`buffer_timestamp_result_${t}`,wh.size=r,wh.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,this.resultBuffer=this.device.createBuffer(wh),wh.reset()}allocateQueriesForContext(e){if(!this.trackTimestamp||this.isDisposed)return null;if(this.currentQueryIndex+2>this.maxQueries)return Qn(`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(L3e);r.resolveQuerySet(this.querySet,0,t,this.resolveBuffer,0),r.copyBufferToBuffer(this.resolveBuffer,0,this.resultBuffer,0,n);let s=r.finish();if(Mh(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}}},M7=class{constructor(){this.label="",this.timestampWrites=void 0}reset(){this.label="",this.timestampWrites=void 0}},E1=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}},C7=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}},nu={r:0,g:0,b:0,a:1},Pl=new p0,Ea=new Wm,_M=new M7,$v=new kC,xM=new BC,yM=new C7,uc=new z1,Sh=new z1,fr=new Eb,Kf=new UC,R7=class extends RC{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 o7(this),this.attributeUtils=new x7(this),this.bindingUtils=new v7(this),this.capabilities=new b7(this),this.pipelineUtils=new T7(this),this.textureUtils=new p7(this),this.occludedResolveCache=new Map;let t=typeof navigator>"u"?!0:/Android/.test(navigator.userAgent)===!1;this._compatibility={[zf.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(LC),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(LC.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===Fi?"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 Xa}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 Om,s.colorAttachments.push(new Fm),e.depth===!0||e.stencil===!0){let l=new E1;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:Eo.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(fr.label=`colorAttachment_${w}`,fr.baseMipLevel=e.activeMipmapLevel,fr.mipLevelCount=1,fr.baseArrayLayer=e.activeCubeFace,fr.arrayLayerCount=1,fr.dimension=Eo.TwoD,n.isRenderTarget3D)p=e.activeCubeFace,fr.baseArrayLayer=0,fr.dimension=Eo.ThreeD;else if(n.isRenderTarget&&u[w].image.depth>1)if(x===!0){let T=e.camera.cameras;for(let R=0;R<T.length;R++){fr.baseArrayLayer=R,fr.arrayLayerCount=1,fr.dimension=Eo.TwoD;let P=S.texture.createView(fr);f.push({view:P,resolveTarget:void 0,depthSlice:void 0})}}else fr.dimension=Eo.TwoDArray;if(x!==!0){let T=S.texture.createView(fr),R,P;S.msaaTexture!==void 0?(R=S.msaaTexture.createView(),P=T):(R=T,P=void 0),f.push({view:R,resolveTarget:P,depthSlice:p})}fr.reset()}let v=[];for(let w=0;w<f.length;w++){let S=f[w],T=new Fm;T.view=S.view,T.depthSlice=S.depthSlice,T.resolveTarget=S.resolveTarget,v.push(T)}if(l={textureViews:f,colorAttachments:v,descriptor:new Om},e.depth){let w=this.get(e.depthTexture);(e.depthTexture.isArrayTexture||e.depthTexture.isCubeTexture)&&(fr.dimension=Eo.TwoD,fr.arrayLayerCount=1,fr.baseArrayLayer=e.activeCubeFace);let S=new E1;S.view=w.texture.createView(fr),l.depthStencilAttachment=S,fr.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||Mi.Load,f.storeOp=t.storeOp||Ma.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,$v.label=`occlusionQuerySet_${e.id}`,$v.type="occlusion",$v.count=r,s=n.createQuerySet($v),$v.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:Mi.Load}),this.initTimestampQuery(rc.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:(nu.r=0,nu.g=0,nu.b=0,nu.a=1,f.clearValue=nu),f.loadOp=Mi.Clear):f.loadOp=Mi.Load,f.storeOp=Ma.Store}}else{let c=o.colorAttachments[0];e.clearColor?(c.clearValue=e.clearColorValue,c.loadOp=Mi.Clear):c.loadOp=Mi.Load,c.storeOp=Ma.Store}e.depth&&(e.clearDepth?(a.depthClearValue=e.clearDepthValue,a.depthLoadOp=Mi.Clear):a.depthLoadOp=Mi.Load,a.depthStoreOp=Ma.Store),e.stencil&&(e.clearStencil?(a.stencilClearValue=e.clearStencilValue,a.stencilLoadOp=Mi.Clear):a.stencilLoadOp=Mi.Load,a.stencilStoreOp=Ma.Store),Ea.label="renderContext_"+e.id;let l=n.createCommandEncoder(Ea);if(Ea.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 Fm;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 Om;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]||(fr.dimension=Eo.TwoD,fr.baseArrayLayer=a,fr.arrayLayerCount=1,o.viewCache[f]=o.texture.createView(fr),fr.reset());let p=new E1;p.view=o.viewCache[f],p.depthLoadOp=s.depthLoadOp||Mi.Clear,p.depthStoreOp=s.depthStoreOp||Ma.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 E1;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=Mi.Clear):o.depthLoadOp=Mi.Load),e.stencil&&(e.clearStencil?(o.stencilClearValue=e.clearStencilValue,o.stencilLoadOp=Mi.Clear):o.stencilLoadOp=Mi.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&&(Pl.size=s,Pl.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,o=this.device.createBuffer(Pl),Pl.reset(),this.occludedResolveCache.set(s,o)),Pl.size=s,Pl.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let a=this.device.createBuffer(Pl);Pl.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(Mh(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();nu.r=x.r,nu.g=x.g,nu.b=x.b,nu.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=nu,v.loadOp=Mi.Clear,v.storeOp=Ma.Store}(c||u)&&(l=x.depthStencilAttachment)}else{c=r.depth,u=r.stencil;let x={loadOp:e?Mi.Clear:Mi.Load,clearValue:e?nu:void 0};c&&(x.depthLoadOp=t?Mi.Clear:Mi.Load,x.depthClearValue=t?o.getClearDepth():void 0,x.depthStoreOp=Ma.Store),u&&(x.stencilLoadOp=n?Mi.Clear:Mi.Load,x.stencilClearValue=n?o.getClearStencil():void 0,x.stencilStoreOp=Ma.Store);let v=this._getRenderPassDescriptor(r,x);a=v.colorAttachments,l=v.depthStencilAttachment}c&&l&&(t?(l.depthLoadOp=Mi.Clear,l.depthClearValue=o.getClearDepth(),l.depthStoreOp=Ma.Store):(l.depthLoadOp=Mi.Load,l.depthStoreOp=Ma.Store)),u&&l&&(n?(l.stencilLoadOp=Mi.Clear,l.stencilClearValue=o.getClearStencil(),l.stencilStoreOp=Ma.Store):(l.stencilLoadOp=Mi.Load,l.stencilStoreOp=Ma.Store)),Ea.label="clear";let f=s.createCommandEncoder(Ea);Ea.reset(),f.beginRenderPass({colorAttachments:a,depthStencilAttachment:l}).end(),Mh(s,f.finish())}beginCompute(e){let t=this.get(e),n="computeGroup_"+e.id;_M.label=n,Ea.label=n,this.initTimestampQuery(rc.COMPUTE,this.getTimestampUID(e),_M),t.cmdEncoderGPU=this.device.createCommandEncoder(Ea),t.passEncoderGPU=t.cmdEncoderGPU.beginComputePass(_M),t.currentPipeline=null,Ea.reset(),_M.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(),Mh(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 R=s[S];if(w[S]!==R.id){let P=this.get(R);l.setBindGroup(S,P.group),w[S]=R.id}}if(v===!0&&c.index!==x){let S=this.get(x).buffer,T=x.array instanceof Uint16Array?NC.Uint16:NC.Uint32;l.setIndexBuffer(S,T),c.index=x}for(let S=0,T=o.length;S<T;S++){let R=o[S];if(c.attributes[S]!==R){let P=this.get(R).buffer;l.setVertexBuffer(S,P),c.attributes[S]=R}}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,R=u._multiDrawCount,P=v===!0?x.array.BYTES_PER_ELEMENT:1;f.wireframe&&(P=u.geometry.attributes.position.count>65535?4:2);for(let C=0;C<R;C++)v===!0?l.drawIndexed(T[C],1,S[C]/P,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:R}=a,P=e.getIndirect();if(P!==null){let C=this.get(P).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,R,0,0);t.update(u,S,T)}else{let{vertexCount:S,instanceCount:T,firstVertex:R}=a,P=e.getIndirect();if(P!==null){let C=this.get(P).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,R,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=[],R=new Uint32Array([0,0,0,0]);for(let P=0,C=x.length;P<C;P++){R[0]=P;let{layoutGPU:L}=S.layout,D=this.bindingUtils.createBindGroupIndex(R,L);T.push(D)}p.indexesGPU=T}let w=this.renderer.getPixelRatio();for(let S=0,T=x.length;S<T;S++){let R=x[S];if(n.layers.test(R.layers)){let P=R.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(P&&!D&&C.setViewport(Math.floor(P.x*w),Math.floor(P.y*w),Math.floor(P.width*w),Math.floor(P.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 E7(this.device,e,2048));let r=this.timestampQueryPool[e],s=r.allocateQueriesForContext(t);yM.querySet=r.querySet,yM.beginningOfPassWriteIndex=s,yM.endOfPassWriteIndex=s+1,n.timestampWrites=yM}createNodeBuilder(e,t){return new _7(e,t)}createProgram(e){let t=this.get(e);xM.label=e.stage+(e.name!==""?`_${e.name}`:""),xM.code=e.code,t.module={module:this.device.createShaderModule(xM),entryPoint:"main"},xM.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&Lh.VERTEX&&s.push("vertex"),e.visibility&Lh.FRAGMENT&&s.push("fragment"),e.visibility&Lh.COMPUTE&&s.push("compute");let o=`(${s.join(",")})`;Pl.label=`bindingBuffer${e.id}_${e.name}_${o}`,Pl.size=n,Pl.usage=r;let a=this.device.createBuffer(Pl);Pl.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 jK[e]!==void 0&&(e=jK[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),Ea.label="copyTextureToTexture_"+e.id+"_"+t.id;let S=this.device.createCommandEncoder(Ea);Ea.reset();let T=this.get(e).texture,R=this.get(t).texture;uc.texture=T,uc.mipLevel=s,uc.origin.x=u,uc.origin.y=f,uc.origin.z=p,Sh.texture=R,Sh.mipLevel=o,Sh.origin.x=a,Sh.origin.y=l,Sh.origin.z=c,Kf.width=x,Kf.height=v,Kf.depthOrArrayLayers=w,S.copyTextureToTexture(uc,Sh,Kf),uc.reset(),Sh.reset(),Kf.reset(),Mh(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):(Ea.label="copyFramebufferToTexture_"+e.id,a=this.device.createCommandEncoder(Ea),Ea.reset()),uc.texture=s,uc.origin.x=n.x,uc.origin.y=n.y,Sh.texture=o,Kf.width=n.z,Kf.height=n.w,a.copyTextureToTexture(uc,Sh,Kf),uc.reset(),Sh.reset(),Kf.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=Mi.Load;t.depth&&(l.depthStencilAttachment.depthLoadOp=Mi.Load),t.stencil&&(l.depthStencilAttachment.stencilLoadOp=Mi.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 Mh(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()}},P7=class extends OA{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 OA{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}},N7=class extends vC{constructor(){super(),this.addMaterial(tO,"MeshPhongMaterial"),this.addMaterial(JM,"MeshStandardMaterial"),this.addMaterial(cO,"MeshPhysicalMaterial"),this.addMaterial(hO,"MeshToonMaterial"),this.addMaterial(JF,"MeshBasicMaterial"),this.addMaterial(eO,"MeshLambertMaterial"),this.addMaterial(YF,"MeshNormalMaterial"),this.addMaterial(fO,"MeshMatcapMaterial"),this.addMaterial(jF,"LineBasicMaterial"),this.addMaterial(XF,"LineDashedMaterial"),this.addMaterial(pO,"PointsMaterial"),this.addMaterial(eC,"SpriteMaterial"),this.addMaterial(mO,"ShadowMaterial"),this.addLight(oB,Jy),this.addLight(PB,BA),this.addLight(FB,e2),this.addLight(bb,OA),this.addLight(RB,UA),this.addLight(IB,Zy),this.addLight(LB,t2),this.addLight(NB,P7),this.addLight(DB,I7),this.addToneMapping(Ree,_2),this.addToneMapping(Pee,x2),this.addToneMapping(Iee,y2),this.addToneMapping(Nee,v2),this.addToneMapping(Lee,b2),this.addToneMapping(Dee,w2)}},V1=class extends HB{constructor(e={}){let t;e.forceWebGL?t=IC:(t=R7,e.getFallback=()=>(je("WebGPURenderer: WebGPU is not available, running under WebGL2 backend."),new IC(e)));let n=new t(e);super(n,e),this.library=new N7,this.isWebGPURenderer=!0,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}};var Eet=k.BRDF_GGX,Met=k.BRDF_Lambert,Cet=k.BasicPointShadowFilter,Ret=k.BasicShadowFilter,Pet=k.Break,Iet=k.Const,Net=k.Continue,Let=k.DFGLUT,Det=k.D_GGX,Fet=k.Discard,Oet=k.EPSILON,Bet=k.F_Schlick,hte=k.Fn,Uet=k.INFINITY,fte=k.If,dte=k.Loop,ket=k.NodeAccess,Get=k.NodeShaderStage,zet=k.NodeType,Vet=k.NodeUpdateType,qet=k.PCFShadowFilter,Het=k.PCFSoftShadowFilter,Wet=k.PI,jet=k.PI2,Xet=k.TWO_PI,$et=k.HALF_PI,Yet=k.PointShadowFilter,Ket=k.Return,Zet=k.Schlick_to_F0,Qet=k.ShaderNode,Jet=k.Stack,ett=k.Switch,ttt=k.TBNViewMatrix,ntt=k.VSMShadowFilter,itt=k.V_GGX_SmithCorrelated,rtt=k.Var,stt=k.VarIntent,ott=k.abs,att=k.acesFilmicToneMapping,ltt=k.acos,ctt=k.acosh,utt=k.add,htt=k.addMethodChaining,ftt=k.addNodeElement,dtt=k.agxToneMapping,ptt=k.all,Att=k.alphaT,mtt=k.ambientOcclusion,gtt=k.and,_tt=k.anisotropy,xtt=k.anisotropyB,ytt=k.anisotropyT,vtt=k.any,btt=k.append,wtt=k.array,pte=k.asin,Stt=k.asinh,Ttt=k.assign,Ett=k.atan,Mtt=k.atanh,Ctt=k.atomicAdd,Rtt=k.atomicAnd,Ptt=k.atomicFunc,Itt=k.atomicLoad,Ntt=k.atomicMax,Ltt=k.atomicMin,Dtt=k.atomicOr,Ftt=k.atomicStore,Ott=k.atomicSub,Btt=k.atomicXor,Utt=k.attenuationColor,ktt=k.attenuationDistance,Gtt=k.attribute,ztt=k.attributeArray,Vtt=k.backgroundBlurriness,qtt=k.backgroundIntensity,Htt=k.backgroundRotation,Wtt=k.batch,jtt=k.bentNormalView,Xtt=k.billboarding,$tt=k.bitAnd,Ytt=k.bitNot,Ktt=k.bitOr,Ztt=k.bitXor,Qtt=k.bitangentGeometry,Jtt=k.bitangentLocal,ent=k.bitangentView,tnt=k.bitangentWorld,nnt=k.bitcast,int=k.blendBurn,rnt=k.blendColor,snt=k.blendDodge,ont=k.blendOverlay,ant=k.blendScreen,lnt=k.blur,cnt=k.bool,unt=k.buffer,hnt=k.bufferAttribute,fnt=k.bumpMap,dnt=k.builtin,pnt=k.builtinAOContext,Ant=k.builtinShadowContext,mnt=k.bvec2,gnt=k.bvec3,_nt=k.bvec4,xnt=k.bypass,ynt=k.cache,vnt=k.call,bnt=k.cameraFar,wnt=k.cameraIndex,Snt=k.cameraNear,Tnt=k.cameraNormalMatrix,Ent=k.cameraPosition,Mnt=k.cameraProjectionMatrix,Cnt=k.cameraProjectionMatrixInverse,Rnt=k.cameraViewMatrix,Pnt=k.cameraViewport,Int=k.cameraWorldMatrix,Nnt=k.cbrt,Lnt=k.cdl,Dnt=k.ceil,Fnt=k.checker,Ont=k.cineonToneMapping,Bnt=k.clamp,Unt=k.clearcoat,knt=k.clearcoatNormalView,Gnt=k.clearcoatRoughness,znt=k.clipSpace,Vnt=k.code,qnt=k.color,Hnt=k.colorSpaceToWorking,Wnt=k.colorToDirection,jnt=k.compute,Xnt=k.computeKernel,$nt=k.computeSkinning,Ynt=k.context,Knt=k.convert,Znt=k.convertColorSpace,Qnt=k.convertToTexture,Jnt=k.countLeadingZeros,eit=k.countOneBits,tit=k.countTrailingZeros,Ate=k.cos,nit=k.cosh,iit=k.cross,rit=k.cubeTexture,sit=k.cubeTextureBase,oit=k.dFdx,ait=k.dFdy,lit=k.dashSize,cit=k.debug,uit=k.decrement,hit=k.decrementBefore,fit=k.defaultBuildStages,dit=k.defaultShaderStages,pit=k.defined,Ait=k.degrees,mit=k.deltaTime,git=k.densityFog,_it=k.densityFogFactor,xit=k.depth,yit=k.depthPass,vit=k.determinant,bit=k.difference,wit=k.diffuseColor,Sit=k.directPointLight,Tit=k.directionToColor,Eit=k.directionToFaceDirection,Mit=k.dispersion,Cit=k.distance,Rit=k.div,Pit=k.dot,Iit=k.drawIndex,Nit=k.dynamicBufferAttribute,Lit=k.element,Dit=k.emissive,Fit=k.equal,Oit=k.equirectDirection,Bit=k.equirectUV,mte=k.exp,Uit=k.exp2,kit=k.exponentialHeightFogFactor,Git=k.expression,zit=k.faceDirection,Vit=k.faceForward,qit=k.faceforward,gte=k.float,Hit=k.floatBitsToInt,Wit=k.floatBitsToUint,jit=k.floor,Xit=k.fog,$it=k.fract,Yit=k.frameGroup,Kit=k.frameId,Zit=k.frontFacing,Qit=k.fwidth,Jit=k.gain,ert=k.gapSize,trt=k.getConstNodeType,nrt=k.getCurrentStack,irt=k.getDirection,rrt=k.getDistanceAttenuation,srt=k.getGeometryRoughness,ort=k.getNormalFromDepth,art=k.interleavedGradientNoise,lrt=k.vogelDiskSample,crt=k.getParallaxCorrectNormal,urt=k.getRoughness,hrt=k.getScreenPosition,frt=k.getShIrradianceAt,drt=k.getShadowMaterial,prt=k.getShadowRenderObjectFunction,Art=k.getTextureIndex,mrt=k.getViewPosition,grt=k.globalId,_rt=k.glsl,xrt=k.glslFn,yrt=k.grayscale,vrt=k.greaterThan,brt=k.greaterThanEqual,wrt=k.hash,Srt=k.highpModelNormalViewMatrix,Trt=k.highpModelViewMatrix,Ert=k.hue,Mrt=k.increment,Crt=k.incrementBefore,Rrt=k.instance,_te=k.instanceIndex,Prt=k.instancedArray,Irt=k.instancedBufferAttribute,Nrt=k.instancedDynamicBufferAttribute,Lrt=k.instancedMesh,Drt=k.int,Frt=k.intBitsToFloat,Ort=k.inverse,Brt=k.inverseSqrt,Urt=k.inversesqrt,krt=k.invocationLocalIndex,Grt=k.invocationSubgroupIndex,zrt=k.ior,Vrt=k.iridescence,qrt=k.iridescenceIOR,Hrt=k.iridescenceThickness,Wrt=k.ivec2,jrt=k.ivec3,Xrt=k.ivec4,$rt=k.js,Yrt=k.label,Krt=k.length,Zrt=k.lengthSq,Qrt=k.lessThan,Jrt=k.lessThanEqual,est=k.lightPosition,tst=k.lightProjectionUV,nst=k.lightShadowMatrix,ist=k.lightTargetDirection,rst=k.lightTargetPosition,sst=k.lightViewPosition,ost=k.lightingContext,ast=k.lights,lst=k.linearDepth,cst=k.linearToneMapping,ust=k.localId,hst=k.log,fst=k.log2,dst=k.logarithmicDepthToViewZ,pst=k.luminance,Ast=k.mat2,mst=k.mat3,gst=k.mat4,_st=k.matcapUV,xst=k.materialAO,yst=k.materialAlphaTest,vst=k.materialAnisotropy,bst=k.materialAnisotropyVector,wst=k.materialAttenuationColor,Sst=k.materialAttenuationDistance,Tst=k.materialClearcoat,Est=k.materialClearcoatNormal,Mst=k.materialClearcoatRoughness,Cst=k.materialColor,Rst=k.materialDispersion,Pst=k.materialEmissive,Ist=k.materialEnvIntensity,Nst=k.materialEnvRotation,Lst=k.materialIOR,Dst=k.materialIridescence,Fst=k.materialIridescenceIOR,Ost=k.materialIridescenceThickness,Bst=k.materialLightMap,Ust=k.materialLineDashOffset,kst=k.materialLineDashSize,Gst=k.materialLineGapSize,zst=k.materialLineScale,Vst=k.materialLineWidth,qst=k.materialMetalness,Hst=k.materialNormal,Wst=k.materialOpacity,jst=k.materialPointSize,Xst=k.materialReference,$st=k.materialReflectivity,Yst=k.materialRefractionRatio,Kst=k.materialRotation,Zst=k.materialRoughness,Qst=k.materialSheen,Jst=k.materialSheenRoughness,eot=k.materialShininess,tot=k.materialSpecular,not=k.materialSpecularColor,iot=k.materialSpecularIntensity,rot=k.materialSpecularStrength,sot=k.materialThickness,oot=k.materialTransmission,aot=k.max,lot=k.maxMipLevel,cot=k.mediumpModelViewMatrix,uot=k.metalness,hot=k.min,fot=k.mix,dot=k.mixElement,pot=k.mod,Aot=k.modelDirection,mot=k.modelNormalMatrix,got=k.modelPosition,_ot=k.modelRadius,xot=k.modelScale,yot=k.modelViewMatrix,vot=k.modelViewPosition,bot=k.modelViewProjection,wot=k.modelWorldMatrix,Sot=k.modelWorldMatrixInverse,Tot=k.morphReference,Eot=k.mrt,Mot=k.mul,Cot=k.mx_aastep,Rot=k.mx_add,Pot=k.mx_atan2,Iot=k.mx_cell_noise_float,Not=k.mx_contrast,Lot=k.mx_divide,Dot=k.mx_fractal_noise_float,Fot=k.mx_fractal_noise_vec2,Oot=k.mx_fractal_noise_vec3,Bot=k.mx_fractal_noise_vec4,Uot=k.mx_frame,kot=k.mx_heighttonormal,Got=k.mx_hsvtorgb,zot=k.mx_ifequal,Vot=k.mx_ifgreater,qot=k.mx_ifgreatereq,Hot=k.mx_invert,Wot=k.mx_modulo,jot=k.mx_multiply,Xot=k.mx_noise_float,$ot=k.mx_noise_vec3,Yot=k.mx_noise_vec4,Kot=k.mx_place2d,Zot=k.mx_power,Qot=k.mx_ramp4,Jot=k.mx_ramplr,eat=k.mx_ramptb,tat=k.mx_rgbtohsv,nat=k.mx_rotate2d,iat=k.mx_rotate3d,rat=k.mx_safepower,sat=k.mx_separate,oat=k.mx_splitlr,aat=k.mx_splittb,lat=k.mx_srgb_texture_to_lin_rec709,cat=k.mx_subtract,uat=k.mx_timer,hat=k.mx_transform_uv,fat=k.mx_unifiednoise2d,dat=k.mx_unifiednoise3d,pat=k.mx_worley_noise_float,Aat=k.mx_worley_noise_vec2,mat=k.mx_worley_noise_vec3,xte=k.negate,gat=k.negateOnBackSide,_at=k.neutralToneMapping,xat=k.nodeArray,yat=k.nodeImmutable,vat=k.nodeObject,bat=k.nodeObjectIntent,wat=k.nodeObjects,Sat=k.nodeProxy,Tat=k.nodeProxyIntent,Eat=k.normalFlat,Mat=k.normalGeometry,Cat=k.normalLocal,Rat=k.normalMap,Pat=k.normalView,Iat=k.normalViewGeometry,Nat=k.normalWorld,Lat=k.normalWorldGeometry,Dat=k.normalize,Fat=k.not,Oat=k.notEqual,Bat=k.numWorkgroups,Uat=k.objectDirection,kat=k.objectGroup,Gat=k.objectPosition,zat=k.objectRadius,Vat=k.objectScale,qat=k.objectViewPosition,Hat=k.objectWorldMatrix,Wat=k.OnBeforeObjectUpdate,jat=k.OnBeforeMaterialUpdate,Xat=k.OnObjectUpdate,$at=k.OnMaterialUpdate,Yat=k.oneMinus,Kat=k.or,Zat=k.orthographicDepthToViewZ,Qat=k.oscSawtooth,Jat=k.oscSine,elt=k.oscSquare,tlt=k.oscTriangle,nlt=k.output,ilt=k.outputStruct,rlt=k.overloadingFn,slt=k.overrideNode,olt=k.overrideNodes,alt=k.packHalf2x16,llt=k.packSnorm2x16,clt=k.packUnorm2x16,ult=k.packNormalToRGB,hlt=k.parabola,flt=k.parallaxDirection,dlt=k.parallaxUV,plt=k.parameter,Alt=k.pass,mlt=k.passTexture,glt=k.pcurve,_lt=k.perspectiveDepthToViewZ,xlt=k.pmremTexture,ylt=k.pointShadow,vlt=k.pointUV,blt=k.pointWidth,wlt=k.positionGeometry,Slt=k.positionLocal,Tlt=k.positionPrevious,Elt=k.positionView,Mlt=k.positionViewDirection,Clt=k.positionWorld,Rlt=k.positionWorldDirection,Plt=k.posterize,Ilt=k.pow,Nlt=k.pow2,Llt=k.pow3,Dlt=k.pow4,Flt=k.premultiplyAlpha,Olt=k.property,Blt=k.radians,Ult=k.rand,klt=k.range,Glt=k.rangeFog,zlt=k.rangeFogFactor,Vlt=k.reciprocal,qlt=k.reference,Hlt=k.referenceBuffer,Wlt=k.reflect,jlt=k.reflectVector,Xlt=k.reflectView,$lt=k.reflector,Ylt=k.refract,Klt=k.refractVector,Zlt=k.refractView,Qlt=k.reinhardToneMapping,Jlt=k.remap,ect=k.remapClamp,tct=k.renderGroup,nct=k.renderOutput,ict=k.rendererReference,rct=k.replaceDefaultUV,sct=k.rotate,oct=k.rotateUV,act=k.roughness,lct=k.round,cct=k.rtt,uct=k.sRGBTransferEOTF,hct=k.sRGBTransferOETF,fct=k.sample,dct=k.sampler,pct=k.samplerComparison,Act=k.saturate,mct=k.saturation,gct=k.screen,_ct=k.screenCoordinate,xct=k.screenDPR,yct=k.screenSize,vct=k.screenUV,bct=k.select,wct=k.setCurrentStack,Sct=k.setName,Tct=k.shaderStages,Ect=k.shadow,Mct=k.shadowPositionWorld,Cct=k.shapeCircle,Rct=k.sharedUniformGroup,Pct=k.sheen,Ict=k.sheenRoughness,Nct=k.shiftLeft,Lct=k.shiftRight,Dct=k.shininess,Fct=k.sign,yte=k.sin,Oct=k.sinh,Bct=k.sinc,Uct=k.skinning,kct=k.smoothstep,Gct=k.smoothstepElement,zct=k.specularColor,Vct=k.specularF90,qct=k.spherizeUV,Hct=k.split,Wct=k.spritesheetUV,vte=k.sqrt,jct=k.stack,Xct=k.step,$ct=k.stepElement,bte=k.storage,Yct=k.storageBarrier,Kct=k.storageTexture,Zct=k.storageTexture3D,Qct=k.struct,Jct=k.sub,eut=k.subgroupAdd,tut=k.subgroupAll,nut=k.subgroupAnd,iut=k.subgroupAny,rut=k.subgroupBallot,sut=k.subgroupBroadcast,out=k.subgroupBroadcastFirst,aut=k.subBuild,lut=k.subgroupElect,cut=k.subgroupExclusiveAdd,uut=k.subgroupExclusiveMul,hut=k.subgroupInclusiveAdd,fut=k.subgroupInclusiveMul,dut=k.subgroupIndex,put=k.subgroupMax,Aut=k.subgroupMin,mut=k.subgroupMul,gut=k.subgroupOr,_ut=k.subgroupShuffle,xut=k.subgroupShuffleDown,yut=k.subgroupShuffleUp,vut=k.subgroupShuffleXor,but=k.subgroupSize,wut=k.subgroupXor,Sut=k.tan,Tut=k.tanh,Eut=k.tangentGeometry,Mut=k.tangentLocal,Cut=k.tangentView,Rut=k.tangentWorld,Put=k.texture,Iut=k.texture3D,Nut=k.textureBarrier,Lut=k.textureBicubic,Dut=k.textureBicubicLevel,Fut=k.textureCubeUV,Out=k.textureLoad,But=k.textureSize,Uut=k.textureLevel,kut=k.textureStore,Gut=k.thickness,zut=k.time,Vut=k.toneMapping,qut=k.toneMappingExposure,Hut=k.toonOutlinePass,Wut=k.transformDirection,jut=k.transformNormal,Xut=k.transformNormalByInverseViewMatrix,$ut=k.transformNormalByViewMatrix,Yut=k.transformNormalToView,Kut=k.transformedClearcoatNormalView,Zut=k.transformedNormalView,Qut=k.transformedNormalWorld,Jut=k.transmission,eht=k.transpose,tht=k.triNoise3D,nht=k.triplanarTexture,iht=k.triplanarTextures,rht=k.trunc,sht=k.uint,oht=k.uintBitsToFloat,wte=k.uniform,aht=k.uniformArray,lht=k.uniformCubeTexture,cht=k.uniformGroup,uht=k.uniformFlow,hht=k.uniformTexture,fht=k.unpackHalf2x16,dht=k.unpackSnorm2x16,pht=k.unpackUnorm2x16,Aht=k.unpackRGBToNormal,mht=k.unpremultiplyAlpha,ght=k.userData,_ht=k.uv,xht=k.uvec2,yht=k.uvec3,vht=k.uvec4,bht=k.varying,wht=k.varyingProperty,Sht=k.vec2,Tht=k.vec3,Eht=k.vec4,Mht=k.vectorComponents,Cht=k.velocity,Rht=k.vertexColor,Pht=k.vertexIndex,Iht=k.vertexStage,Nht=k.vibrance,Lht=k.viewZToLogarithmicDepth,Dht=k.viewZToOrthographicDepth,Fht=k.viewZToPerspectiveDepth,Oht=k.viewZToReversedOrthographicDepth,Bht=k.viewZToReversedPerspectiveDepth,Uht=k.viewport,kht=k.viewportCoordinate,Ght=k.viewportDepthTexture,zht=k.viewportLinearDepth,Vht=k.viewportMipTexture,qht=k.viewportOpaqueMipTexture,Hht=k.viewportResolution,Wht=k.viewportSafeUV,jht=k.viewportSharedTexture,Xht=k.viewportSize,$ht=k.viewportTexture,Yht=k.viewportUV,Kht=k.wgsl,Zht=k.wgslFn,Qht=k.workgroupArray,Jht=k.workgroupBarrier,eft=k.workgroupId,tft=k.workingToColorSpace,nft=k.xor;var Ste=new ma,AR=new ie,$1=class extends n2{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 Rn(e,3)),this.setAttribute("uv",new Rn(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 Wu(t,6,1);return this.setAttribute("instanceStart",new yo(n,3,0)),this.setAttribute("instanceEnd",new yo(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 Wu(t,6,1);return this.setAttribute("instanceColorStart",new yo(n,3,0)),this.setAttribute("instanceColorEnd",new yo(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 qy(e.geometry)),this}fromLineSegments(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ma);let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),Ste.setFromBufferAttribute(t),this.boundingBox.union(Ste))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new $a),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++)AR.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(AR)),AR.fromBufferAttribute(t,s),r=Math.max(r,n.distanceToSquared(AR));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}};va.line={uniforms:QA.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};`}},Ko=new p0,W8=new Wm,lte=new Map([[Int8Array,["sint8","
50925092 #include <premultiplied_alpha_fragment>50935093 50945094 }5095- `};var zh=class extends Kr{constructor(e){super({type:"LineMaterial",uniforms:QA.clone(va.line.uniforms),vertexShader:va.line.vertexShader,fragmentShader:va.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 ok=new gn,wte=new ie,Ste=new ie,Po=new gn,Io=new gn,Vh=new gn,ak=new ie,lk=new on,No=new n2,Tte=new ie,AR=new ma,mR=new $a,qh=new gn,Hh,Zm;function Ete(i,e,t){return qh.set(0,0,-e,1).applyMatrix4(i.projectionMatrix),qh.multiplyScalar(1/qh.w),qh.x=Zm/t.width,qh.y=Zm/t.height,qh.applyMatrix4(i.projectionMatrixInverse),qh.multiplyScalar(1/qh.w),Math.abs(Math.max(qh.x,qh.y))}function I3e(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++){No.start.fromBufferAttribute(r,a),No.end.fromBufferAttribute(s,a),No.applyMatrix4(t);let c=new ie,u=new ie;Hh.distanceSqToSegment(No.start,No.end,u,c),u.distanceTo(c)<Zm*.5&&e.push({point:u,pointOnLine:c,distance:Hh.origin.distanceTo(u),object:i,face:null,faceIndex:a,uv:null,uv1:null})}}function N3e(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;Hh.at(1,Vh),Vh.w=1,Vh.applyMatrix4(e.matrixWorldInverse),Vh.applyMatrix4(n),Vh.multiplyScalar(1/Vh.w),Vh.x*=s.x/2,Vh.y*=s.y/2,Vh.z=0,ak.copy(Vh),lk.multiplyMatrices(e.matrixWorldInverse,o);for(let p=0,x=u;p<x;p++){if(Po.fromBufferAttribute(l,p),Io.fromBufferAttribute(c,p),Po.w=1,Io.w=1,Po.applyMatrix4(lk),Io.applyMatrix4(lk),Po.z>f&&Io.z>f)continue;if(Po.z>f){let R=Po.z-Io.z,C=(Po.z-f)/R;Po.lerp(Io,C)}else if(Io.z>f){let R=Io.z-Po.z,C=(Io.z-f)/R;Io.lerp(Po,C)}Po.applyMatrix4(n),Io.applyMatrix4(n),Po.multiplyScalar(1/Po.w),Io.multiplyScalar(1/Io.w),Po.x*=s.x/2,Po.y*=s.y/2,Io.x*=s.x/2,Io.y*=s.y/2,No.start.copy(Po),No.start.z=0,No.end.copy(Io),No.end.z=0;let w=No.closestPointToPointParameter(ak,!0);No.at(w,Tte);let S=Yc.lerp(Po.z,Io.z,w),T=S>=-1&&S<=1,P=ak.distanceTo(Tte)<Zm*.5;if(T&&P){No.start.fromBufferAttribute(l,p),No.end.fromBufferAttribute(c,p),No.start.applyMatrix4(o),No.end.applyMatrix4(o);let R=new ie,C=new ie;Hh.distanceSqToSegment(No.start,No.end,C,R),t.push({point:C,pointOnLine:R,distance:Hh.origin.distanceTo(C),object:i,face:null,faceIndex:p,uv:null,uv1:null})}}}var gR=class extends Gn{constructor(e=new X1,t=new zh({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)wte.fromBufferAttribute(t,o),Ste.fromBufferAttribute(n,o),r[a]=a===0?0:r[a-1],r[a+1]=r[a]+wte.distanceTo(Ste);let s=new Wu(r,2,1);return e.setAttribute("instanceDistanceStart",new xo(s,1,0)),e.setAttribute("instanceDistanceEnd",new xo(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;Hh=e.ray;let o=this.matrixWorld,a=this.geometry,l=this.material;Zm=l.linewidth+s,a.boundingSphere===null&&a.computeBoundingSphere(),mR.copy(a.boundingSphere).applyMatrix4(o);let c;if(n)c=Zm*.5;else{let f=Math.max(r.near,mR.distanceToPoint(Hh.origin));c=Ete(r,f,l.resolution)}if(mR.radius+=c,Hh.intersectsSphere(mR)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),AR.copy(a.boundingBox).applyMatrix4(o);let u;if(n)u=Zm*.5;else{let f=Math.max(r.near,AR.distanceToPoint(Hh.origin));u=Ete(r,f,l.resolution)}AR.expandByScalar(u),Hh.intersectsBox(AR)!==!1&&(n?I3e(this,t):N3e(this,r,t))}onBeforeRender(e){let t=this.material.uniforms;t&&t.resolution&&(e.getViewport(ok),this.material.uniforms.resolution.value.set(ok.z,ok.w))}};var x0=class extends X1{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 $1=class extends gR{constructor(e=new x0,t=new zh({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}};var Y1=class{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100,n="ltr"){let r=[],s=L3e(e,t,this.data,n);for(let o=0,a=s.length;o<a;o++)r.push(...s[o].toShapes());return r}};function L3e(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=D3e(f,s,l,c,t);n=="tb"?(l=0,c+=t.ascender*s):l+=p.offsetX,a.push(p.path)}}return a}function D3e(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 i2,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 Nb=class i extends ky{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 Y1(t.font.data),new i(t.text,t)}};function dk(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 F3e(i){if(Array.isArray(i))return i}function O3e(i){if(Array.isArray(i))return dk(i)}function Ute(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 B3e(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Mte(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 U3e(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var s=i.apply(e,t);function o(l){Mte(s,n,r,o,a,"next",l)}function a(l){Mte(s,n,r,o,a,"throw",l)}o(void 0)})}}function SR(i,e,t){return e=J1(e),X3e(i,xk()?Reflect.construct(e,t||[],J1(i).constructor):e.apply(i,t))}function k3e(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function TR(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Lb(i,e){return i.get(Ute(i,e))}function ck(i,e,t){k3e(i,e),e.set(i,t)}function uk(i,e,t){return i.set(Ute(i,e),t),t}function _k(i,e,t){if(xk())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 G3e(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,kte(n.key),n)}}function ER(i,e,t){return e&&G3e(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function oo(i,e,t){return(e=kte(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function pk(){return pk=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(i,e,t){var n=$3e(i,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(arguments.length<3?i:t):r.value}},pk.apply(null,arguments)}function J1(i){return J1=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},J1(i)}function MR(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&&mk(i,e)}function xk(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(xk=function(){return!!i})()}function z3e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function V3e(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 q3e(){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 H3e(){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 Cte(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 Ui(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Cte(Object(t),!0).forEach(function(n){oo(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Cte(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function W3e(i,e){if(i==null)return{};var t,n,r=j3e(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 j3e(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 X3e(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 B3e(i)}function Ak(){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 Ul(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]())):(Ul(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,Ul(x,r,"GeneratorFunction")),x.prototype=Object.create(f),x}return l.prototype=c,Ul(f,"constructor",c),Ul(c,"constructor",l),l.displayName="GeneratorFunction",Ul(c,r,"GeneratorFunction"),Ul(f),Ul(f,r,"Generator"),Ul(f,n,function(){return this}),Ul(f,"toString",function(){return"[object Generator]"}),(Ak=function(){return{w:s,m:p}})()}function Ul(i,e,t,n){var r=Object.defineProperty;try{r({},"",{})}catch{r=0}Ul=function(s,o,a,l){function c(u,f){Ul(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))},Ul(i,e,t,n)}function mk(i,e){return mk=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},mk(i,e)}function gr(i,e){return F3e(i)||V3e(i,e)||Gte(i,e)||q3e()}function $3e(i,e){for(;!{}.hasOwnProperty.call(i,e)&&(i=J1(i))!==null;);return i}function hk(i,e,t,n){var r=pk(J1(i.prototype),e,t);return typeof r=="function"?function(s){return r.apply(t,s)}:r}function Hi(i){return O3e(i)||z3e(i)||Gte(i)||H3e()}function Y3e(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 kte(i){var e=Y3e(i,"string");return typeof e=="symbol"?e:e+""}function Gte(i,e){if(i){if(typeof i=="string")return dk(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)?dk(i,e):void 0}}var zte=function(e){e instanceof Array?e.forEach(zte):(e.map&&e.map.dispose(),e.dispose())},b0=function(e){e.geometry&&e.geometry.dispose(),e.material&&zte(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(b0)},zr=function(e){if(e&&e.children)for(;e.children.length;){var t=e.children[0];e.remove(t),b0(t)}};function La(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 or=100;function Rte(){return or}function yc(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=or*(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 Vte(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/or-1}}function Jm(i){return i*Math.PI/180}var Fb=window.THREE?window.THREE:{BackSide:hi,BufferAttribute:Di,Color:Ut,Mesh:Gn,ShaderMaterial:Kr},K3e=`5095+ `};var zh=class extends Zr{constructor(e){super({type:"LineMaterial",uniforms:QA.clone(va.line.uniforms),vertexShader:va.line.vertexShader,fragmentShader:va.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 ak=new gn,Tte=new ie,Ete=new ie,Io=new gn,No=new gn,Vh=new gn,lk=new ie,ck=new on,Lo=new r2,Mte=new ie,mR=new ma,gR=new $a,qh=new gn,Hh,Zm;function Cte(i,e,t){return qh.set(0,0,-e,1).applyMatrix4(i.projectionMatrix),qh.multiplyScalar(1/qh.w),qh.x=Zm/t.width,qh.y=Zm/t.height,qh.applyMatrix4(i.projectionMatrixInverse),qh.multiplyScalar(1/qh.w),Math.abs(Math.max(qh.x,qh.y))}function F3e(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++){Lo.start.fromBufferAttribute(r,a),Lo.end.fromBufferAttribute(s,a),Lo.applyMatrix4(t);let c=new ie,u=new ie;Hh.distanceSqToSegment(Lo.start,Lo.end,u,c),u.distanceTo(c)<Zm*.5&&e.push({point:u,pointOnLine:c,distance:Hh.origin.distanceTo(u),object:i,face:null,faceIndex:a,uv:null,uv1:null})}}function O3e(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;Hh.at(1,Vh),Vh.w=1,Vh.applyMatrix4(e.matrixWorldInverse),Vh.applyMatrix4(n),Vh.multiplyScalar(1/Vh.w),Vh.x*=s.x/2,Vh.y*=s.y/2,Vh.z=0,lk.copy(Vh),ck.multiplyMatrices(e.matrixWorldInverse,o);for(let p=0,x=u;p<x;p++){if(Io.fromBufferAttribute(l,p),No.fromBufferAttribute(c,p),Io.w=1,No.w=1,Io.applyMatrix4(ck),No.applyMatrix4(ck),Io.z>f&&No.z>f)continue;if(Io.z>f){let P=Io.z-No.z,C=(Io.z-f)/P;Io.lerp(No,C)}else if(No.z>f){let P=No.z-Io.z,C=(No.z-f)/P;No.lerp(Io,C)}Io.applyMatrix4(n),No.applyMatrix4(n),Io.multiplyScalar(1/Io.w),No.multiplyScalar(1/No.w),Io.x*=s.x/2,Io.y*=s.y/2,No.x*=s.x/2,No.y*=s.y/2,Lo.start.copy(Io),Lo.start.z=0,Lo.end.copy(No),Lo.end.z=0;let w=Lo.closestPointToPointParameter(lk,!0);Lo.at(w,Mte);let S=Yc.lerp(Io.z,No.z,w),T=S>=-1&&S<=1,R=lk.distanceTo(Mte)<Zm*.5;if(T&&R){Lo.start.fromBufferAttribute(l,p),Lo.end.fromBufferAttribute(c,p),Lo.start.applyMatrix4(o),Lo.end.applyMatrix4(o);let P=new ie,C=new ie;Hh.distanceSqToSegment(Lo.start,Lo.end,C,P),t.push({point:C,pointOnLine:P,distance:Hh.origin.distanceTo(C),object:i,face:null,faceIndex:p,uv:null,uv1:null})}}}var _R=class extends Gn{constructor(e=new $1,t=new zh({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)Tte.fromBufferAttribute(t,o),Ete.fromBufferAttribute(n,o),r[a]=a===0?0:r[a-1],r[a+1]=r[a]+Tte.distanceTo(Ete);let s=new Wu(r,2,1);return e.setAttribute("instanceDistanceStart",new yo(s,1,0)),e.setAttribute("instanceDistanceEnd",new yo(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;Hh=e.ray;let o=this.matrixWorld,a=this.geometry,l=this.material;Zm=l.linewidth+s,a.boundingSphere===null&&a.computeBoundingSphere(),gR.copy(a.boundingSphere).applyMatrix4(o);let c;if(n)c=Zm*.5;else{let f=Math.max(r.near,gR.distanceToPoint(Hh.origin));c=Cte(r,f,l.resolution)}if(gR.radius+=c,Hh.intersectsSphere(gR)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),mR.copy(a.boundingBox).applyMatrix4(o);let u;if(n)u=Zm*.5;else{let f=Math.max(r.near,mR.distanceToPoint(Hh.origin));u=Cte(r,f,l.resolution)}mR.expandByScalar(u),Hh.intersectsBox(mR)!==!1&&(n?F3e(this,t):O3e(this,r,t))}onBeforeRender(e){let t=this.material.uniforms;t&&t.resolution&&(e.getViewport(ak),this.material.uniforms.resolution.value.set(ak.z,ak.w))}};var x0=class extends $1{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 Y1=class extends _R{constructor(e=new x0,t=new zh({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}};var K1=class{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100,n="ltr"){let r=[],s=B3e(e,t,this.data,n);for(let o=0,a=s.length;o<a;o++)r.push(...s[o].toShapes());return r}};function B3e(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=U3e(f,s,l,c,t);n=="tb"?(l=0,c+=t.ascender*s):l+=p.offsetX,a.push(p.path)}}return a}function U3e(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 s2,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 Db=class i extends zy{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 K1(t.font.data),new i(t.text,t)}};function pk(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 k3e(i){if(Array.isArray(i))return i}function G3e(i){if(Array.isArray(i))return pk(i)}function Gte(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 z3e(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Rte(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 V3e(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var s=i.apply(e,t);function o(l){Rte(s,n,r,o,a,"next",l)}function a(l){Rte(s,n,r,o,a,"throw",l)}o(void 0)})}}function TR(i,e,t){return e=ex(e),Z3e(i,yk()?Reflect.construct(e,t||[],ex(i).constructor):e.apply(i,t))}function q3e(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function ER(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Fb(i,e){return i.get(Gte(i,e))}function uk(i,e,t){q3e(i,e),e.set(i,t)}function hk(i,e,t){return i.set(Gte(i,e),t),t}function xk(i,e,t){if(yk())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 H3e(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,zte(n.key),n)}}function MR(i,e,t){return e&&H3e(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function oo(i,e,t){return(e=zte(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Ak(){return Ak=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(i,e,t){var n=Q3e(i,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(arguments.length<3?i:t):r.value}},Ak.apply(null,arguments)}function ex(i){return ex=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ex(i)}function CR(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&&gk(i,e)}function yk(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(yk=function(){return!!i})()}function W3e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function j3e(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 X3e(){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 $3e(){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 Pte(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 Ui(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Pte(Object(t),!0).forEach(function(n){oo(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Pte(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Y3e(i,e){if(i==null)return{};var t,n,r=K3e(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 K3e(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 Z3e(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 z3e(i)}function mk(){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,R=Object.create(T.prototype);return Ul(R,"_invoke",(function(P,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:P.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),R}var o={};function a(){}function l(){}function c(){}e=Object.getPrototypeOf;var u=[][n]?e(e([][n]())):(Ul(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,Ul(x,r,"GeneratorFunction")),x.prototype=Object.create(f),x}return l.prototype=c,Ul(f,"constructor",c),Ul(c,"constructor",l),l.displayName="GeneratorFunction",Ul(c,r,"GeneratorFunction"),Ul(f),Ul(f,r,"Generator"),Ul(f,n,function(){return this}),Ul(f,"toString",function(){return"[object Generator]"}),(mk=function(){return{w:s,m:p}})()}function Ul(i,e,t,n){var r=Object.defineProperty;try{r({},"",{})}catch{r=0}Ul=function(s,o,a,l){function c(u,f){Ul(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))},Ul(i,e,t,n)}function gk(i,e){return gk=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},gk(i,e)}function gr(i,e){return k3e(i)||j3e(i,e)||Vte(i,e)||X3e()}function Q3e(i,e){for(;!{}.hasOwnProperty.call(i,e)&&(i=ex(i))!==null;);return i}function fk(i,e,t,n){var r=Ak(ex(i.prototype),e,t);return typeof r=="function"?function(s){return r.apply(t,s)}:r}function Hi(i){return G3e(i)||W3e(i)||Vte(i)||$3e()}function J3e(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 zte(i){var e=J3e(i,"string");return typeof e=="symbol"?e:e+""}function Vte(i,e){if(i){if(typeof i=="string")return pk(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)?pk(i,e):void 0}}var qte=function(e){e instanceof Array?e.forEach(qte):(e.map&&e.map.dispose(),e.dispose())},b0=function(e){e.geometry&&e.geometry.dispose(),e.material&&qte(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(b0)},zr=function(e){if(e&&e.children)for(;e.children.length;){var t=e.children[0];e.remove(t),b0(t)}};function La(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 or=100;function Ite(){return or}function yc(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=or*(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 Hte(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/or-1}}function Jm(i){return i*Math.PI/180}var Bb=window.THREE?window.THREE:{BackSide:hi,BufferAttribute:Di,Color:Ut,Mesh:Gn,ShaderMaterial:Zr},eEe=`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-}`,Z3e=`5118+}`,tEe=`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 Q3e(i,e,t,n){return new Fb.ShaderMaterial({depthWrite:!1,transparent:!0,vertexShader:K3e,fragmentShader:Z3e,uniforms:{coefficient:{value:i},color:{value:new Fb.Color(e)},power:{value:t},hollowRadius:{value:n}}})}function J3e(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 Fb.BufferAttribute(n,3)),t}var eEe=(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;TR(this,e),n=SR(this,e);var T=J3e(t,l),P=Q3e(u,o,p,v);return S&&(P.side=Fb.BackSide),n.geometry=T,n.material=P,n}return MR(e,i),ER(e)})(Fb.Mesh),Wh=window.THREE?window.THREE:{Color:Ut,Group:br,LineBasicMaterial:Hc,LineSegments:y_,Mesh:Gn,MeshPhongMaterial:FA,SphereGeometry:_a,SRGBColorSpace:vr,TextureLoader:Ya},qte=Or({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){b0(e.globeObj),b0(e.tileEngine),b0(e.graticulesObj)}},stateInit:function(){var e=new Wh.MeshPhongMaterial({color:0}),t=new Wh.Mesh(void 0,e);t.rotation.y=-Math.PI/2;var n=new v$(or),r=new Wh.Group;r.__globeObjType="globe",r.add(t),r.add(n);var s=new Wh.LineSegments(new O6(a6(),or,2),new Wh.LineBasicMaterial({color:"lightgrey",transparent:!0,opacity:.1}));return{globeGroup:r,globeObj:t,graticulesObj:s,defaultGlobeMaterial:e,tileEngine:n}},init:function(e,t){zr(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 Wh.SphereGeometry(or,s,s/2),e.tileEngine.curvatureResolution=e.globeCurvatureResolution}if(t.hasOwnProperty("globeImageUrl")&&(e.globeImageUrl?new Wh.TextureLoader().load(e.globeImageUrl,function(a){var l;a.colorSpace=Wh.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 Wh.Color(0))),t.hasOwnProperty("bumpImageUrl")&&(e.bumpImageUrl?e.bumpImageUrl&&new Wh.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),b0(e.atmosphereObj)),e.atmosphereColor&&e.atmosphereAltitude)){var o=e.atmosphereObj=new eEe(e.globeObj.geometry,{color:e.atmosphereColor,size:or*e.atmosphereAltitude,hollowRadius:or,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())}}),jh=function(e){return isNaN(e)?parseInt(dn(e).toHex(),16):e},pu=function(e){return e&&isNaN(e)?Zc(e).opacity:1},w0=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=gr(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(Hi(x),[s]):x};function tEe(i,e,t){return i.opacity=e,i.transparent=e<1,i.depthWrite=e>=1,i}var Pte=window.THREE?window.THREE:{BufferAttribute:Di};function Xh(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 Pte.BufferAttribute(new t(i),e);for(var n=new Pte.BufferAttribute(new t(i.length*e),e),r=0,s=i.length;r<s;r++)n.set(i[r],r*e);return n}function nEe(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 fk=new WeakMap,_R=new WeakMap,xR=new WeakMap,sl=(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 TR(this,e),n=SR(this,e),oo(n,"scene",void 0),ck(n,fk,void 0),ck(n,_R,void 0),ck(n,xR,void 0),n.scene=t,uk(fk,n,o),uk(_R,n,l),uk(xR,n,u),n.onRemoveObj(function(){}),n}return MR(e,i),ER(e,[{key:"onCreateObj",value:function(n){var r=this;return hk(e,"onCreateObj",this)([function(s){var o=n(s);return s[Lb(_R,r)]=o,o[Lb(fk,r)]=s,r.scene.add(o),o}]),this}},{key:"onRemoveObj",value:function(n){var r=this;return hk(e,"onRemoveObj",this)([function(s,o){var a=hk(e,"getData",r)([s]);n(s,o);var l=function(){r.scene.remove(s),b0(s),delete a[Lb(_R,r)]};Lb(xR,r)?setTimeout(l,Lb(xR,r)):l()}]),this}}])})(q$),hu=window.THREE?window.THREE:{BufferGeometry:qn,CylinderGeometry:IA,Matrix4:on,Mesh:Gn,MeshLambertMaterial:xa,Object3D:Ki,Vector3:ie},Ite=Object.assign({},Av),Nte=Ite.BufferGeometryUtils||Ite,Hte=Or({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;zr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new sl(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 hu.CylinderGeometry(1,1,1,e.pointResolution);l.applyMatrix4(new hu.Matrix4().makeRotationX(Math.PI/2)),l.applyMatrix4(new hu.Matrix4().makeTranslation(0,0,-.5));var c=2*Math.PI*or/360,u={};if(!e.pointsMerge&&t.hasOwnProperty("pointsMerge")&&zr(e.scene),e.dataMapper.scene=e.pointsMerge?new hu.Object3D:e.scene,e.dataMapper.onCreateObj(x).onUpdateObj(v).digest(e.pointsData),e.pointsMerge){var f=e.pointsData.length?(Nte.mergeGeometries||Nte.mergeBufferGeometries)(e.pointsData.map(function(w){var S=e.dataMapper.getObj(w),T=S.geometry.clone();S.updateMatrix(),T.applyMatrix4(S.matrix);var P=w0(a(w));return T.setAttribute("color",Xh(Array(T.getAttribute("position").count).fill(P),4)),T})):new hu.BufferGeometry,p=new hu.Mesh(f,new hu.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0}));p.__globeObjType="points",p.__data=e.pointsData,e.dataMapper.clear(),zr(e.scene),e.scene.add(p)}function x(){var w=new hu.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,yc(H,K));var J=e.pointsMerge?new hu.Vector3(0,0,0):e.scene.localToWorld(new hu.Vector3(0,0,0));w.lookAt(J),w.scale.x=w.scale.y=Math.min(30,z)*c,w.scale.z=Math.max(V*or,.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 Ws(R).to(P,e.pointsTransitionDuration).easing(Br.Quadratic.InOut).onUpdate(T).onComplete(function(){e.tweenGroup.remove(this)}).start())),!e.pointsMerge){var C=a(S),L=C?pu(C):0,D=!!L;w.visible=D,D&&(u.hasOwnProperty(C)||(u[C]=new hu.MeshLambertMaterial({color:jh(C),transparent:L<1,opacity:L})),w.material=u[C])}}}}),Wte=function(){return{uniforms:{dashOffset:{value:0},dashSize:{value:1},gapSize:{value:0},dashTranslate:{value:0}},vertexShader:`5141+}`;function nEe(i,e,t,n){return new Bb.ShaderMaterial({depthWrite:!1,transparent:!0,vertexShader:eEe,fragmentShader:tEe,uniforms:{coefficient:{value:i},color:{value:new Bb.Color(e)},power:{value:t},hollowRadius:{value:n}}})}function iEe(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 Bb.BufferAttribute(n,3)),t}var rEe=(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;ER(this,e),n=TR(this,e);var T=iEe(t,l),R=nEe(u,o,p,v);return S&&(R.side=Bb.BackSide),n.geometry=T,n.material=R,n}return CR(e,i),MR(e)})(Bb.Mesh),Wh=window.THREE?window.THREE:{Color:Ut,Group:br,LineBasicMaterial:Hc,LineSegments:v_,Mesh:Gn,MeshPhongMaterial:FA,SphereGeometry:_a,SRGBColorSpace:vr,TextureLoader:Ya},Wte=Or({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){b0(e.globeObj),b0(e.tileEngine),b0(e.graticulesObj)}},stateInit:function(){var e=new Wh.MeshPhongMaterial({color:0}),t=new Wh.Mesh(void 0,e);t.rotation.y=-Math.PI/2;var n=new w$(or),r=new Wh.Group;r.__globeObjType="globe",r.add(t),r.add(n);var s=new Wh.LineSegments(new B6(l6(),or,2),new Wh.LineBasicMaterial({color:"lightgrey",transparent:!0,opacity:.1}));return{globeGroup:r,globeObj:t,graticulesObj:s,defaultGlobeMaterial:e,tileEngine:n}},init:function(e,t){zr(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 Wh.SphereGeometry(or,s,s/2),e.tileEngine.curvatureResolution=e.globeCurvatureResolution}if(t.hasOwnProperty("globeImageUrl")&&(e.globeImageUrl?new Wh.TextureLoader().load(e.globeImageUrl,function(a){var l;a.colorSpace=Wh.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 Wh.Color(0))),t.hasOwnProperty("bumpImageUrl")&&(e.bumpImageUrl?e.bumpImageUrl&&new Wh.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),b0(e.atmosphereObj)),e.atmosphereColor&&e.atmosphereAltitude)){var o=e.atmosphereObj=new rEe(e.globeObj.geometry,{color:e.atmosphereColor,size:or*e.atmosphereAltitude,hollowRadius:or,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())}}),jh=function(e){return isNaN(e)?parseInt(dn(e).toHex(),16):e},pu=function(e){return e&&isNaN(e)?Zc(e).opacity:1},w0=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=gr(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(Hi(x),[s]):x};function sEe(i,e,t){return i.opacity=e,i.transparent=e<1,i.depthWrite=e>=1,i}var Nte=window.THREE?window.THREE:{BufferAttribute:Di};function Xh(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 Nte.BufferAttribute(new t(i),e);for(var n=new Nte.BufferAttribute(new t(i.length*e),e),r=0,s=i.length;r<s;r++)n.set(i[r],r*e);return n}function oEe(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 dk=new WeakMap,xR=new WeakMap,yR=new WeakMap,sl=(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 ER(this,e),n=TR(this,e),oo(n,"scene",void 0),uk(n,dk,void 0),uk(n,xR,void 0),uk(n,yR,void 0),n.scene=t,hk(dk,n,o),hk(xR,n,l),hk(yR,n,u),n.onRemoveObj(function(){}),n}return CR(e,i),MR(e,[{key:"onCreateObj",value:function(n){var r=this;return fk(e,"onCreateObj",this)([function(s){var o=n(s);return s[Fb(xR,r)]=o,o[Fb(dk,r)]=s,r.scene.add(o),o}]),this}},{key:"onRemoveObj",value:function(n){var r=this;return fk(e,"onRemoveObj",this)([function(s,o){var a=fk(e,"getData",r)([s]);n(s,o);var l=function(){r.scene.remove(s),b0(s),delete a[Fb(xR,r)]};Fb(yR,r)?setTimeout(l,Fb(yR,r)):l()}]),this}}])})(W$),hu=window.THREE?window.THREE:{BufferGeometry:qn,CylinderGeometry:IA,Matrix4:on,Mesh:Gn,MeshLambertMaterial:xa,Object3D:Ki,Vector3:ie},Lte=Object.assign({},gv),Dte=Lte.BufferGeometryUtils||Lte,jte=Or({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;zr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new sl(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 hu.CylinderGeometry(1,1,1,e.pointResolution);l.applyMatrix4(new hu.Matrix4().makeRotationX(Math.PI/2)),l.applyMatrix4(new hu.Matrix4().makeTranslation(0,0,-.5));var c=2*Math.PI*or/360,u={};if(!e.pointsMerge&&t.hasOwnProperty("pointsMerge")&&zr(e.scene),e.dataMapper.scene=e.pointsMerge?new hu.Object3D:e.scene,e.dataMapper.onCreateObj(x).onUpdateObj(v).digest(e.pointsData),e.pointsMerge){var f=e.pointsData.length?(Dte.mergeGeometries||Dte.mergeBufferGeometries)(e.pointsData.map(function(w){var S=e.dataMapper.getObj(w),T=S.geometry.clone();S.updateMatrix(),T.applyMatrix4(S.matrix);var R=w0(a(w));return T.setAttribute("color",Xh(Array(T.getAttribute("position").count).fill(R),4)),T})):new hu.BufferGeometry,p=new hu.Mesh(f,new hu.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0}));p.__globeObjType="points",p.__data=e.pointsData,e.dataMapper.clear(),zr(e.scene),e.scene.add(p)}function x(){var w=new hu.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,yc(H,K));var J=e.pointsMerge?new hu.Vector3(0,0,0):e.scene.localToWorld(new hu.Vector3(0,0,0));w.lookAt(J),w.scale.x=w.scale.y=Math.min(30,z)*c,w.scale.z=Math.max(V*or,.1)},R={alt:+s(S),r:+o(S),lat:+n(S),lng:+r(S)},P=w.__currentTargetD||Object.assign({},R,{alt:-.001});if(Object.keys(R).some(function(F){return P[F]!==R[F]})&&(e.pointsMerge||!e.pointsTransitionDuration||e.pointsTransitionDuration<0?T(R):e.tweenGroup.add(new Ws(P).to(R,e.pointsTransitionDuration).easing(Br.Quadratic.InOut).onUpdate(T).onComplete(function(){e.tweenGroup.remove(this)}).start())),!e.pointsMerge){var C=a(S),L=C?pu(C):0,D=!!L;w.visible=D,D&&(u.hasOwnProperty(C)||(u[C]=new hu.MeshLambertMaterial({color:jh(C),transparent:L<1,opacity:L})),w.material=u[C])}}}}),Xte=function(){return{uniforms:{dashOffset:{value:0},dashSize:{value:1},gapSize:{value:0},dashTranslate:{value:0}},vertexShader:`51425142 `.concat(On.common,`51435143 `).concat(On.logdepthbuf_pars_vertex,`51445144 @@ -5178,7 +5178,7 @@ void main() {
51785178 51795179 `).concat(On.logdepthbuf_fragment,`51805180 }5181- `)}},gk=function(e){return e.uniforms.uSurfaceRadius={type:"float",value:0},e.vertexShader=(`attribute float surfaceRadius;5181+ `)}},_k=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},iEe=function(e){return e.vertexShader=`5189+`)),e},aEe=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},yk=function(e,t){return e.onBeforeCompile=function(n){e.userData.shader=t(n)},e},rEe=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)}}},sEe=["stroke"],fu=window.THREE?window.THREE:{BufferGeometry:qn,CubicBezierCurve3:S_,Curve:ga,Group:br,Line:ep,Mesh:Gn,NormalBlending:cs,ShaderMaterial:Kr,TubeGeometry:Gy,Vector3:ie},oEe=eg.default.default||eg.default,jte=Or({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 oEe,sharedMaterial:new fu.ShaderMaterial(Ui(Ui({},Wte()),{},{transparent:!0,blending:fu.NormalBlending}))}},init:function(e,t){zr(e),t.scene=e,t.dataMapper=new sl(e,{objBindAttr:"__threeObjArc"}).onCreateObj(function(){var n=new fu.Group;return n.__globeObjType="arc",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var o=gr(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")){zr(R);var F=D?new fu.Mesh:new fu.Line(new fu.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=W3e(ee,sEe),de=S(ce);D?(N.geometry&&N.geometry.dispose(),N.geometry=new fu.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 Ws(J).to(K,e.arcsTransitionDuration).easing(Br.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=gr(Me,3),$e=ze[0],Et=ze[1],Tt=ze[2],Ct=yc(Et,$e,Tt),un=Ct.x,Gt=Ct.y,Xe=Ct.z;return new fu.Vector3(un,Gt,Xe)},K=[F,D],J=[z,B],j=C;if(j==null&&(j=el(K,J)/2*L+Math.max(N,V)),j||N||V){var Z=hm(K,J),ee=function(Me,ze){return ze+(ze-Me)*(Me<ze?.5:.25)},ae=[.25,.75].map(function(mt){return[].concat(Hi(Z(mt)),[ee(mt<.5?N:V,j)])}),ce=gr(ae,2),de=ce[0],be=ce[1],Ie=_k(fu.CubicBezierCurve3,Hi([[].concat(K,[N]),de,be,[].concat(J,[V])].map(H)));return Ie}else{var Qe=.001;return Ue.apply(void 0,Hi([[].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 fu.Vector3().addVectors(mt.clone().multiplyScalar(Math.sin((1-Tt)*ze)),Me.clone().multiplyScalar(Math.sin(Tt*ze))).divideScalar(Math.sin(ze))},Et=new fu.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?Qa().domain(R.map(function(j,Z){return Z/(R.length-1)})).range(R):R;F=function(Z){return w0(N(Z),!0,!0)}}else{var B=w0(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 Xh(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(),Xh(F,1)}}}),y0=window.THREE?window.THREE:{BufferGeometry:qn,DoubleSide:sr,Mesh:Gn,MeshLambertMaterial:xa,Object3D:Ki},Lte=Object.assign({},Av),Dte=Lte.BufferGeometryUtils||Lte,Xte=Or({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;zr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new sl(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=uY(e.hexBinPointsData.map(function(P){return Ui(Ui({},P),{},{h3Idx:wY(n(P),r(P),e.hexBinResolution)})}),"h3Idx"),f=Object.entries(u).map(function(P){var R=gr(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")&&zr(e.scene),e.dataMapper.scene=e.hexBinMerge?new y0.Object3D:e.scene,e.dataMapper.id(function(P){return P.h3Idx}).onCreateObj(S).onUpdateObj(T).digest(f),e.hexBinMerge){var x=f.length?(Dte.mergeGeometries||Dte.mergeBufferGeometries)(f.map(function(P){var R=e.dataMapper.getObj(P),C=R.geometry.toNonIndexed();R.updateMatrix(),C.applyMatrix4(R.matrix);var L=w0(a(P)),D=w0(l(P)),F=C.getAttribute("position").count,N=C.groups[0].count;return C.setAttribute("color",Xh(Hi(new Array(F)).map(function(B,z){return z>=N?L:D}),4)),C})):new y0.BufferGeometry,v=new y0.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0,side:y0.DoubleSide});v.onBeforeCompile=function(P){v.userData.shader=gk(P)};var w=new y0.Mesh(x,v);w.__globeObjType="hexBinPoints",w.__data=f,e.dataMapper.clear(),zr(e.scene),e.scene.add(w)}function S(P){var R=new y0.Mesh;R.__hexCenter=r8(P.h3Idx),R.__hexGeoJson=s8(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=gr(P.__hexCenter,2),F=D[0],N=D[1],B=L===0?P.__hexGeoJson:P.__hexGeoJson.map(function(Z){var ee=gr(Z,2),ae=ee[0],ce=ee[1];return[[ae,N],[ce,F]].map(function(de){var be=gr(de,2),Ie=be[0],Qe=be[1];return C(Ie,Qe,L)})}),z=e.hexTopCurvatureResolution;P.geometry&&P.geometry.dispose(),P.geometry=new LE([B],0,or,!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=or/(ce+1);P.geometry.setAttribute("surfaceRadius",Xh(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 Ws(K).to(V,e.hexTransitionDuration).easing(Br.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=pu(Z);p[Z]=yk(new y0.MeshLambertMaterial({color:jh(Z),transparent:ee<1,opacity:ee,side:y0.DoubleSide}),gk)}}),P.material=[J,j].map(function(Z){return p[Z]})}}}}),$te=function(e){return e*e},ad=function(e){return e*Math.PI/180};function aEe(i,e){var t=Math.sqrt,n=Math.cos,r=function(u){return $te(Math.sin(u/2))},s=ad(i[1]),o=ad(e[1]),a=ad(i[0]),l=ad(e[0]);return 2*Math.asin(t(r(o-s)+n(s)*n(o)*r(l-a)))}var lEe=Math.sqrt(2*Math.PI);function cEe(i,e){return Math.exp(-$te(i/e)/2)/(e*lEe)}var uEe=function(e){var t=gr(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 R3(s.map(function(S){var T=p(S);if(!T)return 0;var P=aEe(v,[l(S),u(S)]);return cEe(P,w)*T}))},hEe=(function(){var i=U3e(Ak().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,be,Ie,Qe,Ue,mt,Me,ze=arguments,$e,Et,Tt;return Ak().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 uEe(un,r,{lngAccessor:a,latAccessor:c,weightAccessor:f,bandwidth:p})}));case 1:return x=4,v=cte,w=ute,S=vte,T=yte,P=Ate,R=mte,C=hte,L=xte,D=_te,F=dte,N=fte,B=pte,z=gte,V=T(new Hm(new Float32Array(t.flat().map(ad)),2),"vec2",t.length),H=T(new Hm(new Float32Array(r.map(function(un){return[ad(a(un)),ad(c(un)),f(un)]}).flat()),3),"vec3",r.length),K=new Hm(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))},be=S(ad(p)),Ie=S(ad(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,be).mul(vt))})})})}),mt=Ue().compute(t.length),Me=new z1,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)}})(),yR=window.THREE?window.THREE:{Mesh:Gn,MeshLambertMaterial:xa,SphereGeometry:_a},fEe=3.5,dEe=.1,Fte=100,pEe=function(e){var t=Zc(a8(e));return t.opacity=Math.cbrt(e),t.formatRgb()},Yte=Or({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 pEe}},heatmapColorSaturation:{default:1.5},heatmapBaseAltitude:{default:.01},heatmapTopAltitude:{},heatmapsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;zr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new sl(e,{objBindAttr:"__threeObjHeatmap"}).onCreateObj(function(){var s=new yR.Mesh(new yR.SphereGeometry(or),yk(new yR.MeshLambertMaterial({vertexColors:!0,transparent:!0}),iEe));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=yc(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(dEe,x/fEe),C=Math.ceil(360/(R||-1));f.geometry.parameters.widthSegments!==C&&(f.geometry.dispose(),f.geometry=new yR.SphereGeometry(or,C,C/2));var L=nEe(f.geometry.getAttribute("position")),D=L.map(function(F){var N=gr(F,3),B=N[0],z=N[1],V=N[2],H=Vte({x:B,y:z,z:V}),K=H.lng,J=H.lat;return[K,J]});hEe(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=Hi(new Array(Fte)).map(function(H,K){return w0(v(K/(Fte-1)))}),B=function(K){var J=f.__currentTargetD=K,j=J.kdeVals,Z=J.topAlt,ee=J.saturation,ae=M3(j.map(Math.abs))||1e-15,ce=j2([0,ae/ee],N);f.geometry.setAttribute("color",Xh(j.map(function(be){return ce(Math.abs(be))}),4));var de=Qa([0,ae],[or*(1+S),or*(1+(Z||S))]);f.geometry.setAttribute("r",Xh(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 Ws(V).to(z,e.heatmapsTransitionDuration).easing(Br.Quadratic.InOut).onUpdate(B).onComplete(function(){e.tweenGroup.remove(this)}).start()))})}).digest(e.heatmapsData)}}),v0=window.THREE?window.THREE:{DoubleSide:sr,Group:br,LineBasicMaterial:Hc,LineSegments:y_,Mesh:Gn,MeshBasicMaterial:Yr},Kte=Or({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;zr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new sl(e,{objBindAttr:"__threeObjPolygon"}).id(function(s){return s.id}).onCreateObj(function(){var s=new v0.Group;return s.__defaultSideMaterial=yk(new v0.MeshBasicMaterial({side:v0.DoubleSide,depthWrite:!0}),gk),s.__defaultCapMaterial=new v0.MeshBasicMaterial({side:v0.DoubleSide,depthWrite:!0}),s.add(new v0.Mesh(void 0,[s.__defaultSideMaterial,s.__defaultCapMaterial])),s.add(new v0.LineSegments(void 0,new v0.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(Ui({id:"".concat(v,"_0"),coords:x.coordinates},p)):x.type==="MultiPolygon"?u.push.apply(u,Hi(x.coordinates.map(function(w,S){return Ui({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=gr(f.children,2),D=L[0],F=L[1],N=!!P;F.visible=N;var B=!!(v||w),z=!!(S||T);AEe(D.geometry.parameters||{},{polygonGeoJson:x,curvatureResolution:C,closedTop:B,includeSides:z})||(D.geometry&&D.geometry.dispose(),D.geometry=new LE(x,0,or,!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 O6({type:"Polygon",coordinates:x},or,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=gr(ae,2),de=ce[0],be=ce[1];if(!(!de||be<0)){var Ie=D.material[be],Qe=pu(de);Ie.color.set(jh(de)),Ie.transparent=Qe<1,Ie.opacity=Qe}}),N){var K=F.material,J=pu(P);K.color.set(jh(P)),K.transparent=J<1,K.opacity=J}var j={alt:R},Z=function(ce){var de=f.__currentTargetD=ce,be=de.alt;D.scale.x=D.scale.y=D.scale.z=1+be,N&&(F.scale.x=F.scale.y=F.scale.z=1+be+1e-4),rEe(f.__defaultSideMaterial,function(Ie){return Ie.uSurfaceRadius.value=or/(be+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 Ws(ee).to(j,e.polygonsTransitionDuration).easing(Br.Quadratic.InOut).onUpdate(Z).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(u)}});function AEe(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=gr(n,2),s=r[0],o=r[1];return i.hasOwnProperty(s)&&t(s)(i[s],o)})}var K1=window.THREE?window.THREE:{BufferGeometry:qn,DoubleSide:sr,Mesh:Gn,MeshLambertMaterial:xa,Vector3:ie},Ote=Object.assign({},Av),Bte=Ote.BufferGeometryUtils||Ote,Zte=Or({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;zr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new sl(e,{objBindAttr:"__threeObjHexPolygon"}).onCreateObj(function(){var s=new K1.Mesh(void 0,new K1.MeshLambertMaterial({side:K1.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=pu(R);u.material.color.set(jh(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"?o8(p.coordinates,x,!0).forEach(function(H){return B.push(H)}):p.type==="MultiPolygon"?p.coordinates.forEach(function(H){return o8(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=r8(H),J=s8(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?(Bte.mergeGeometries||Bte.mergeBufferGeometries)(z.map(function(ae){var ce=gr(ae.hexCenter,2),de=ce[0],be=ce[1];if(S){var Ie=yc(de,be,j),Qe=yc(ae.hexGeoJson[0][1],ae.hexGeoJson[0][0],j),Ue=.85*(1-Z)*new K1.Vector3(Ie.x,Ie.y,Ie.z).distanceTo(new K1.Vector3(Qe.x,Qe.y,Qe.z)),mt=new b_(Ue,P);return mt.rotateX(Jm(-de)),mt.rotateY(Jm(be)),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=gr($e,2),Tt=Et[0],Ct=Et[1];return[[Tt,be],[Ct,de]].map(function(un){var Gt=gr(un,2),Xe=Gt[0],st=Gt[1];return Me(Xe,st,Z)})});return new LE([ze],or,or*(1+j),!1,!0,!1,ee)}})):new K1.BufferGeometry};!e.hexPolygonsTransitionDuration||e.hexPolygonsTransitionDuration<0?V(L):e.tweenGroup.add(new Ws(F).to(L,e.hexPolygonsTransitionDuration).easing(Br.Quadratic.InOut).onUpdate(V).onComplete(function(){e.tweenGroup.remove(this)}).start())}}).digest(e.hexPolygonsData)}}),mEe=window.THREE?window.THREE:{Vector3:ie};function gEe(i,e){var t=function(o,a){var l=o[o.length-1];return[].concat(Hi(o),Hi(Array(a-o.length).fill(l)))},n=Math.max(i.length,e.length),r=bD.apply(void 0,Hi([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=gr(o,3),l=a[0],c=a[1],u=a[2];return new mEe.Vector3(l,c,u)})}}var Qm=window.THREE?window.THREE:{BufferGeometry:qn,Color:Ut,Group:br,Line:ep,NormalBlending:cs,ShaderMaterial:Kr,Vector3:ie},_Ee=eg.default.default||eg.default,Qte=Or({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 _Ee,sharedMaterial:new Qm.ShaderMaterial(Ui(Ui({},Wte()),{},{transparent:!0,blending:Qm.NormalBlending}))}},init:function(e,t){zr(e),t.scene=e,t.dataMapper=new sl(e,{objBindAttr:"__threeObjPath"}).onCreateObj(function(){var n=new Qm.Group;return n.__globeObjType="path",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var o=gr(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")){zr(S);var C=R?new $1(new x0,new zh):new Qm.Line(new Qm.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=pu(j);L.material.color=new Qm.Color(jh(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=gEe(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,Hi(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(be){return de[be]!==ce[be]})&&(!e.pathTransitionDuration||e.pathTransitionDuration<0?ae(ce):e.tweenGroup.add(new Ws(de).to(ce,e.pathTransitionDuration).easing(Br.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=gr(B,3),V=z[0],H=z[1],K=z[2],J=yc(V,H,K),j=J.x,Z=J.y,ee=J.z;return new Qm.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?Qa().domain(S.map(function(K,J){return J/(S.length-1)})).range(S):S;L=function(J){return w0(D(J),R,!0)}}else{var F=w0(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 Xh(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(),Xh(C,1)}}}),vR=window.THREE?window.THREE:{Euler:Aa,Mesh:Gn,MeshLambertMaterial:xa,SphereGeometry:_a},Jte=Or({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 vR.MeshLambertMaterial({color:"#ffbb88",opacity:.4,transparent:!0})}},tileCurvatureResolution:{default:5},tilesTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;zr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new sl(e,{objBindAttr:"__threeObjTile"}).onCreateObj(function(){var s=new vR.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=Z1(L),z=Z1(-C);u.geometry&&u.geometry.dispose(),u.geometry=new vR.SphereGeometry(or*(1+D),Math.ceil(F/(x||-1)),Math.ceil(N/(x||-1)),Z1(90-F/2)+(p?B:0),Z1(F),Z1(90-N/2)+(p?z:0),Z1(N)),p||u.setRotationFromEuler(new vR.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 Ws(S).to(w,e.tilesTransitionDuration).easing(Br.Quadratic.InOut).onUpdate(v).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.tilesData)}}),Z1=function(e){return e*Math.PI/180},Db=window.THREE?window.THREE:{BufferGeometry:qn,Color:Ut,Points:Cy,PointsMaterial:tp},ene=Or({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){zr(e),t.scene=e,t.dataMapper=new sl(e,{objBindAttr:"__threeObjParticles"}).onCreateObj(function(){var n=new Db.Points(new Db.BufferGeometry,new Db.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",Xh(s(r).map(function(c){return Object.values(yc(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=gr(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 Db.Color(16777215),u.material.transparent=!1,u.material.alphaTest=.5,u.material.map=o(c);else{var f=n(c),p=pu(f);u.material.color=new Db.Color(jh(f)),u.material.transparent=p<1,u.material.opacity=p,u.material.alphaTest=0}})}}),xEe=window.THREE?window.THREE:{BufferGeometry:qn},yEe=(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;TR(this,e),t=SR(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 MR(e,i),ER(e)})(xEe.BufferGeometry),Q1=window.THREE?window.THREE:{Color:Ut,Group:br,Line:ep,LineBasicMaterial:Hc,Vector3:ie},vEe=eg.default.default||eg.default,tne=Or({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;zr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new sl(e,{objBindAttr:"__threeObjRing",removeDelay:3e4}).onCreateObj(function(){var s=new Q1.Group;return s.__globeObjType="ring",s}),t.ticker=new vEe,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=gr(f,2),x=p[1];return x}).forEach(function(f){var p=gr(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 Q1.Line(new yEe(1,t.ringResolution),new Q1.LineBasicMaterial),T=o(x),P=T instanceof Array||T instanceof Function,R;P?T instanceof Array?(R=Qa().domain(T.map(function(V,H){return H/(T.length-1)})).range(T),S.material.transparent=T.some(function(V){return pu(V)<1})):(R=T,S.material.transparent=!0):(S.material.color=new Q1.Color(jh(T)),tEe(S.material,pu(T)));var C=or*(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 Q1.Color(jh(j)),S.material.transparent&&(S.material.opacity=pu(j))}};if(F===0)B({t:0}),v.add(S);else{var z=Math.abs(L/F)*1e3;t.tweenGroup.add(new Ws({t:0}).to({t:1},z).onUpdate(B).onStart(function(){return v.add(S)}).onComplete(function(){t.tweenGroup.remove(this),v.remove(S),b0(S)}).start())}}})}})},update:function(e){var t=rt(e.ringLat),n=rt(e.ringLng),r=rt(e.ringAltitude),s=e.scene.localToWorld(new Q1.Vector3(0,0,0));e.dataMapper.onUpdateObj(function(o,a){var l=t(a),c=n(a),u=r(a);Object.assign(o.position,yc(l,c,u)),o.lookAt(s)}).digest(e.ringsData)}}),bEe={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 "}},wEe="normal",SEe=1189,TEe=-100,EEe="normal",MEe={yMin:-334,xMin:-111,yMax:1189,xMax:1672},CEe=1e3,REe={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},vk=function(e,t){return e.onBeforeCompile=function(n){e.userData.shader=t(n)},e},lEe=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)}}},cEe=["stroke"],fu=window.THREE?window.THREE:{BufferGeometry:qn,CubicBezierCurve3:T_,Curve:ga,Group:br,Line:ep,Mesh:Gn,NormalBlending:cs,ShaderMaterial:Zr,TubeGeometry:Vy,Vector3:ie},uEe=eg.default.default||eg.default,$te=Or({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 uEe,sharedMaterial:new fu.ShaderMaterial(Ui(Ui({},Xte()),{},{transparent:!0,blending:fu.NormalBlending}))}},init:function(e,t){zr(e),t.scene=e,t.dataMapper=new sl(e,{objBindAttr:"__threeObjArc"}).onCreateObj(function(){var n=new fu.Group;return n.__globeObjType="arc",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var o=gr(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(P,C){var L=u(C),D=L!=null;if(!P.children.length||D!==(P.children[0].type==="Mesh")){zr(P);var F=D?new fu.Mesh:new fu.Line(new fu.BufferGeometry);F.material=e.sharedMaterial.clone(),P.add(F)}var N=P.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=R(e.arcCurveResolution,D?e.arcCircularResolution+1:1,!0);N.geometry.setAttribute("color",z),N.geometry.setAttribute("relDistance",V);var H=function(Z){var ee=P.__currentTargetD=Z,ae=ee.stroke,ce=Y3e(ee,cEe),de=S(ce);D?(N.geometry&&N.geometry.dispose(),N.geometry=new fu.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=P.__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 Ws(J).to(K,e.arcsTransitionDuration).easing(Br.Quadratic.InOut).onUpdate(H).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.arcsData);function S(P){var C=P.alt,L=P.altAutoScale,D=P.startLat,F=P.startLng,N=P.startAlt,B=P.endLat,z=P.endLng,V=P.endAlt,H=function(Me){var ze=gr(Me,3),$e=ze[0],Et=ze[1],Tt=ze[2],Ct=yc(Et,$e,Tt),un=Ct.x,Gt=Ct.y,Xe=Ct.z;return new fu.Vector3(un,Gt,Xe)},K=[F,D],J=[z,B],j=C;if(j==null&&(j=el(K,J)/2*L+Math.max(N,V)),j||N||V){var Z=hm(K,J),ee=function(Me,ze){return ze+(ze-Me)*(Me<ze?.5:.25)},ae=[.25,.75].map(function(mt){return[].concat(Hi(Z(mt)),[ee(mt<.5?N:V,j)])}),ce=gr(ae,2),de=ce[0],be=ce[1],Ie=xk(fu.CubicBezierCurve3,Hi([[].concat(K,[N]),de,be,[].concat(J,[V])].map(H)));return Ie}else{var Qe=.001;return Ue.apply(void 0,Hi([[].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 fu.Vector3().addVectors(mt.clone().multiplyScalar(Math.sin((1-Tt)*ze)),Me.clone().multiplyScalar(Math.sin(Tt*ze))).divideScalar(Math.sin(ze))},Et=new fu.Curve;return Et.getPoint=$e,Et}}function T(P,C){var L=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,D=C+1,F;if(P instanceof Array||P instanceof Function){var N=P instanceof Array?Qa().domain(P.map(function(j,Z){return Z/(P.length-1)})).range(P):P;F=function(Z){return w0(N(Z),!0,!0)}}else{var B=w0(P,!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 Xh(z,4)}function R(P){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=P+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(),Xh(F,1)}}}),y0=window.THREE?window.THREE:{BufferGeometry:qn,DoubleSide:sr,Mesh:Gn,MeshLambertMaterial:xa,Object3D:Ki},Fte=Object.assign({},gv),Ote=Fte.BufferGeometryUtils||Fte,Yte=Or({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;zr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new sl(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=fY(e.hexBinPointsData.map(function(R){return Ui(Ui({},R),{},{h3Idx:TY(n(R),r(R),e.hexBinResolution)})}),"h3Idx"),f=Object.entries(u).map(function(R){var P=gr(R,2),C=P[0],L=P[1];return{h3Idx:C,points:L,sumWeight:L.reduce(function(D,F){return D+ +s(F)},0)}}),p={};if(!e.hexBinMerge&&t.hasOwnProperty("hexBinMerge")&&zr(e.scene),e.dataMapper.scene=e.hexBinMerge?new y0.Object3D:e.scene,e.dataMapper.id(function(R){return R.h3Idx}).onCreateObj(S).onUpdateObj(T).digest(f),e.hexBinMerge){var x=f.length?(Ote.mergeGeometries||Ote.mergeBufferGeometries)(f.map(function(R){var P=e.dataMapper.getObj(R),C=P.geometry.toNonIndexed();P.updateMatrix(),C.applyMatrix4(P.matrix);var L=w0(a(R)),D=w0(l(R)),F=C.getAttribute("position").count,N=C.groups[0].count;return C.setAttribute("color",Xh(Hi(new Array(F)).map(function(B,z){return z>=N?L:D}),4)),C})):new y0.BufferGeometry,v=new y0.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0,side:y0.DoubleSide});v.onBeforeCompile=function(R){v.userData.shader=_k(R)};var w=new y0.Mesh(x,v);w.__globeObjType="hexBinPoints",w.__data=f,e.dataMapper.clear(),zr(e.scene),e.scene.add(w)}function S(R){var P=new y0.Mesh;P.__hexCenter=s8(R.h3Idx),P.__hexGeoJson=o8(R.h3Idx,!0).reverse();var C=P.__hexCenter[1];return P.__hexGeoJson.forEach(function(L){var D=L[0];Math.abs(C-D)>170&&(L[0]+=C>D?360:-360)}),P.__globeObjType="hexbin",P}function T(R,P){var C=function(ee,ae,ce){return ee-(ee-ae)*ce},L=Math.max(0,Math.min(1,+c(P))),D=gr(R.__hexCenter,2),F=D[0],N=D[1],B=L===0?R.__hexGeoJson:R.__hexGeoJson.map(function(Z){var ee=gr(Z,2),ae=ee[0],ce=ee[1];return[[ae,N],[ce,F]].map(function(de){var be=gr(de,2),Ie=be[0],Qe=be[1];return C(Ie,Qe,L)})}),z=e.hexTopCurvatureResolution;R.geometry&&R.geometry.dispose(),R.geometry=new DE([B],0,or,!1,!0,!0,z);var V={alt:+o(P)},H=function(ee){var ae=R.__currentTargetD=ee,ce=ae.alt;R.scale.x=R.scale.y=R.scale.z=1+ce;var de=or/(ce+1);R.geometry.setAttribute("surfaceRadius",Xh(Array(R.geometry.getAttribute("position").count).fill(de),1))},K=R.__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 Ws(K).to(V,e.hexTransitionDuration).easing(Br.Quadratic.InOut).onUpdate(H).onComplete(function(){e.tweenGroup.remove(this)}).start())),!e.hexBinMerge){var J=l(P),j=a(P);[J,j].forEach(function(Z){if(!p.hasOwnProperty(Z)){var ee=pu(Z);p[Z]=vk(new y0.MeshLambertMaterial({color:jh(Z),transparent:ee<1,opacity:ee,side:y0.DoubleSide}),_k)}}),R.material=[J,j].map(function(Z){return p[Z]})}}}}),Kte=function(e){return e*e},ad=function(e){return e*Math.PI/180};function hEe(i,e){var t=Math.sqrt,n=Math.cos,r=function(u){return Kte(Math.sin(u/2))},s=ad(i[1]),o=ad(e[1]),a=ad(i[0]),l=ad(e[0]);return 2*Math.asin(t(r(o-s)+n(s)*n(o)*r(l-a)))}var fEe=Math.sqrt(2*Math.PI);function dEe(i,e){return Math.exp(-Kte(i/e)/2)/(e*fEe)}var pEe=function(e){var t=gr(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 P3(s.map(function(S){var T=p(S);if(!T)return 0;var R=hEe(v,[l(S),u(S)]);return dEe(R,w)*T}))},AEe=(function(){var i=V3e(mk().m(function e(t){var n,r,s,o,a,l,c,u,f,p,x,v,w,S,T,R,P,C,L,D,F,N,B,z,V,H,K,J,j,Z,ee,ae,ce,de,be,Ie,Qe,Ue,mt,Me,ze=arguments,$e,Et,Tt;return mk().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 pEe(un,r,{lngAccessor:a,latAccessor:c,weightAccessor:f,bandwidth:p})}));case 1:return x=4,v=hte,w=fte,S=wte,T=bte,R=gte,P=_te,C=dte,L=vte,D=yte,F=Ate,N=pte,B=mte,z=xte,V=T(new Hm(new Float32Array(t.flat().map(ad)),2),"vec2",t.length),H=T(new Hm(new Float32Array(r.map(function(un){return[ad(a(un)),ad(c(un)),f(un)]}).flat()),3),"vec3",r.length),K=new Hm(t.length,1),J=T(K,"float",t.length),j=R(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=R(Gt[1]),tt=R(Xe[1]),vt=R(Gt[0]),yt=R(Xe[0]);return R(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))},be=S(ad(p)),Ie=S(ad(p*x)),Qe=S(r.length),Ue=v(function(){var un=V.element(P),Gt=J.element(P);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,be).mul(vt))})})})}),mt=Ue().compute(t.length),Me=new V1,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)}})(),vR=window.THREE?window.THREE:{Mesh:Gn,MeshLambertMaterial:xa,SphereGeometry:_a},mEe=3.5,gEe=.1,Bte=100,_Ee=function(e){var t=Zc(l8(e));return t.opacity=Math.cbrt(e),t.formatRgb()},Zte=Or({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 _Ee}},heatmapColorSaturation:{default:1.5},heatmapBaseAltitude:{default:.01},heatmapTopAltitude:{},heatmapsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;zr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new sl(e,{objBindAttr:"__threeObjHeatmap"}).onCreateObj(function(){var s=new vR.Mesh(new vR.SphereGeometry(or),vk(new vR.MeshLambertMaterial({vertexColors:!0,transparent:!0}),aEe));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),R=t(p).map(function(F){var N=n(F),B=r(F),z=yc(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)}}),P=Math.max(gEe,x/mEe),C=Math.ceil(360/(P||-1));f.geometry.parameters.widthSegments!==C&&(f.geometry.dispose(),f.geometry=new vR.SphereGeometry(or,C,C/2));var L=oEe(f.geometry.getAttribute("position")),D=L.map(function(F){var N=gr(F,3),B=N[0],z=N[1],V=N[2],H=Hte({x:B,y:z,z:V}),K=H.lng,J=H.lat;return[K,J]});AEe(D,R,{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=Hi(new Array(Bte)).map(function(H,K){return w0(v(K/(Bte-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=$2([0,ae/ee],N);f.geometry.setAttribute("color",Xh(j.map(function(be){return ce(Math.abs(be))}),4));var de=Qa([0,ae],[or*(1+S),or*(1+(Z||S))]);f.geometry.setAttribute("r",Xh(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 Ws(V).to(z,e.heatmapsTransitionDuration).easing(Br.Quadratic.InOut).onUpdate(B).onComplete(function(){e.tweenGroup.remove(this)}).start()))})}).digest(e.heatmapsData)}}),v0=window.THREE?window.THREE:{DoubleSide:sr,Group:br,LineBasicMaterial:Hc,LineSegments:v_,Mesh:Gn,MeshBasicMaterial:Kr},Qte=Or({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;zr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new sl(e,{objBindAttr:"__threeObjPolygon"}).id(function(s){return s.id}).onCreateObj(function(){var s=new v0.Group;return s.__defaultSideMaterial=vk(new v0.MeshBasicMaterial({side:v0.DoubleSide,depthWrite:!0}),_k),s.__defaultCapMaterial=new v0.MeshBasicMaterial({side:v0.DoubleSide,depthWrite:!0}),s.add(new v0.Mesh(void 0,[s.__defaultSideMaterial,s.__defaultCapMaterial])),s.add(new v0.LineSegments(void 0,new v0.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(Ui({id:"".concat(v,"_0"),coords:x.coordinates},p)):x.type==="MultiPolygon"?u.push.apply(u,Hi(x.coordinates.map(function(w,S){return Ui({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,R=p.strokeColor,P=p.altitude,C=p.capCurvatureResolution,L=gr(f.children,2),D=L[0],F=L[1],N=!!R;F.visible=N;var B=!!(v||w),z=!!(S||T);xEe(D.geometry.parameters||{},{polygonGeoJson:x,curvatureResolution:C,closedTop:B,includeSides:z})||(D.geometry&&D.geometry.dispose(),D.geometry=new DE(x,0,or,!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 B6({type:"Polygon",coordinates:x},or,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=gr(ae,2),de=ce[0],be=ce[1];if(!(!de||be<0)){var Ie=D.material[be],Qe=pu(de);Ie.color.set(jh(de)),Ie.transparent=Qe<1,Ie.opacity=Qe}}),N){var K=F.material,J=pu(R);K.color.set(jh(R)),K.transparent=J<1,K.opacity=J}var j={alt:P},Z=function(ce){var de=f.__currentTargetD=ce,be=de.alt;D.scale.x=D.scale.y=D.scale.z=1+be,N&&(F.scale.x=F.scale.y=F.scale.z=1+be+1e-4),lEe(f.__defaultSideMaterial,function(Ie){return Ie.uSurfaceRadius.value=or/(be+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 Ws(ee).to(j,e.polygonsTransitionDuration).easing(Br.Quadratic.InOut).onUpdate(Z).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(u)}});function xEe(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=gr(n,2),s=r[0],o=r[1];return i.hasOwnProperty(s)&&t(s)(i[s],o)})}var Z1=window.THREE?window.THREE:{BufferGeometry:qn,DoubleSide:sr,Mesh:Gn,MeshLambertMaterial:xa,Vector3:ie},Ute=Object.assign({},gv),kte=Ute.BufferGeometryUtils||Ute,Jte=Or({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;zr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new sl(e,{objBindAttr:"__threeObjHexPolygon"}).onCreateObj(function(){var s=new Z1.Mesh(void 0,new Z1.MeshLambertMaterial({side:Z1.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),R=c(f),P=n(f),C=pu(P);u.material.color.set(jh(P)),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"?a8(p.coordinates,x,!0).forEach(function(H){return B.push(H)}):p.type==="MultiPolygon"?p.coordinates.forEach(function(H){return a8(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=s8(H),J=o8(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?(kte.mergeGeometries||kte.mergeBufferGeometries)(z.map(function(ae){var ce=gr(ae.hexCenter,2),de=ce[0],be=ce[1];if(S){var Ie=yc(de,be,j),Qe=yc(ae.hexGeoJson[0][1],ae.hexGeoJson[0][0],j),Ue=.85*(1-Z)*new Z1.Vector3(Ie.x,Ie.y,Ie.z).distanceTo(new Z1.Vector3(Qe.x,Qe.y,Qe.z)),mt=new w_(Ue,R);return mt.rotateX(Jm(-de)),mt.rotateY(Jm(be)),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=gr($e,2),Tt=Et[0],Ct=Et[1];return[[Tt,be],[Ct,de]].map(function(un){var Gt=gr(un,2),Xe=Gt[0],st=Gt[1];return Me(Xe,st,Z)})});return new DE([ze],or,or*(1+j),!1,!0,!1,ee)}})):new Z1.BufferGeometry};!e.hexPolygonsTransitionDuration||e.hexPolygonsTransitionDuration<0?V(L):e.tweenGroup.add(new Ws(F).to(L,e.hexPolygonsTransitionDuration).easing(Br.Quadratic.InOut).onUpdate(V).onComplete(function(){e.tweenGroup.remove(this)}).start())}}).digest(e.hexPolygonsData)}}),yEe=window.THREE?window.THREE:{Vector3:ie};function vEe(i,e){var t=function(o,a){var l=o[o.length-1];return[].concat(Hi(o),Hi(Array(a-o.length).fill(l)))},n=Math.max(i.length,e.length),r=wD.apply(void 0,Hi([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=gr(o,3),l=a[0],c=a[1],u=a[2];return new yEe.Vector3(l,c,u)})}}var Qm=window.THREE?window.THREE:{BufferGeometry:qn,Color:Ut,Group:br,Line:ep,NormalBlending:cs,ShaderMaterial:Zr,Vector3:ie},bEe=eg.default.default||eg.default,ene=Or({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 bEe,sharedMaterial:new Qm.ShaderMaterial(Ui(Ui({},Xte()),{},{transparent:!0,blending:Qm.NormalBlending}))}},init:function(e,t){zr(e),t.scene=e,t.dataMapper=new sl(e,{objBindAttr:"__threeObjPath"}).onCreateObj(function(){var n=new Qm.Group;return n.__globeObjType="path",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var o=gr(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 R=o(T),P=R!=null;if(!S.children.length||P===(S.children[0].type==="Line")){zr(S);var C=P?new Y1(new x0,new zh):new Qm.Line(new Qm.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,P){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=pu(j);L.material.color=new Qm.Color(jh(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=vEe(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(P){var ze;L.geometry.setPositions((ze=[]).concat.apply(ze,Hi(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:R,interpolK:1},de=Object.assign({},S.__currentTargetD||ce,{interpolK:0});Object.keys(ce).some(function(be){return de[be]!==ce[be]})&&(!e.pathTransitionDuration||e.pathTransitionDuration<0?ae(ce):e.tweenGroup.add(new Ws(de).to(ce,e.pathTransitionDuration).easing(Br.Quadratic.InOut).onUpdate(ae).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.pathsData);function p(S){var T=0,R;return S.forEach(function(P){R&&(T+=R.distanceTo(P)),R=P}),T}function x(S,T,R,P,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=gr(B,3),V=z[0],H=z[1],K=z[2],J=yc(V,H,K),j=J.x,Z=J.y,ee=J.z;return new Qm.Vector3(j,Z,ee)};return D(S.map(function(N){return[T(N),R(N),P(N)]}),C).map(F)}function v(S,T){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,P=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?Qa().domain(S.map(function(K,J){return J/(S.length-1)})).range(S):S;L=function(J){return w0(D(J),P,!0)}}else{var F=w0(S,P,!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<R;H++)N.push(V);return Xh(N,P?4:3)}function w(S){for(var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,P=S+1,C=[],L=0,D=P;L<D;L++)for(var F=L/(D-1),N=0;N<T;N++)C.push(F);return R&&C.reverse(),Xh(C,1)}}}),bR=window.THREE?window.THREE:{Euler:Aa,Mesh:Gn,MeshLambertMaterial:xa,SphereGeometry:_a},tne=Or({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 bR.MeshLambertMaterial({color:"#ffbb88",opacity:.4,transparent:!0})}},tileCurvatureResolution:{default:5},tilesTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;zr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new sl(e,{objBindAttr:"__threeObjTile"}).onCreateObj(function(){var s=new bR.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(R){var P=u.__currentTargetD=R,C=P.lat,L=P.lng,D=P.alt,F=P.width,N=P.height,B=Q1(L),z=Q1(-C);u.geometry&&u.geometry.dispose(),u.geometry=new bR.SphereGeometry(or*(1+D),Math.ceil(F/(x||-1)),Math.ceil(N/(x||-1)),Q1(90-F/2)+(p?B:0),Q1(F),Q1(90-N/2)+(p?z:0),Q1(N)),p||u.setRotationFromEuler(new bR.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 Ws(S).to(w,e.tilesTransitionDuration).easing(Br.Quadratic.InOut).onUpdate(v).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.tilesData)}}),Q1=function(e){return e*Math.PI/180},Ob=window.THREE?window.THREE:{BufferGeometry:qn,Color:Ut,Points:Py,PointsMaterial:tp},nne=Or({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){zr(e),t.scene=e,t.dataMapper=new sl(e,{objBindAttr:"__threeObjParticles"}).onCreateObj(function(){var n=new Ob.Points(new Ob.BufferGeometry,new Ob.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",Xh(s(r).map(function(c){return Object.values(yc(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=gr(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 Ob.Color(16777215),u.material.transparent=!1,u.material.alphaTest=.5,u.material.map=o(c);else{var f=n(c),p=pu(f);u.material.color=new Ob.Color(jh(f)),u.material.transparent=p<1,u.material.opacity=p,u.material.alphaTest=0}})}}),wEe=window.THREE?window.THREE:{BufferGeometry:qn},SEe=(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;ER(this,e),t=TR(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 CR(e,i),MR(e)})(wEe.BufferGeometry),J1=window.THREE?window.THREE:{Color:Ut,Group:br,Line:ep,LineBasicMaterial:Hc,Vector3:ie},TEe=eg.default.default||eg.default,ine=Or({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;zr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new sl(e,{objBindAttr:"__threeObjRing",removeDelay:3e4}).onCreateObj(function(){var s=new J1.Group;return s.__globeObjType="ring",s}),t.ticker=new TEe,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=gr(f,2),x=p[1];return x}).forEach(function(f){var p=gr(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 J1.Line(new SEe(1,t.ringResolution),new J1.LineBasicMaterial),T=o(x),R=T instanceof Array||T instanceof Function,P;R?T instanceof Array?(P=Qa().domain(T.map(function(V,H){return H/(T.length-1)})).range(T),S.material.transparent=T.some(function(V){return pu(V)<1})):(P=T,S.material.transparent=!0):(S.material.color=new J1.Color(jh(T)),sEe(S.material,pu(T)));var C=or*(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)),R){var j=P(K);S.material.color=new J1.Color(jh(j)),S.material.transparent&&(S.material.opacity=pu(j))}};if(F===0)B({t:0}),v.add(S);else{var z=Math.abs(L/F)*1e3;t.tweenGroup.add(new Ws({t:0}).to({t:1},z).onUpdate(B).onStart(function(){return v.add(S)}).onComplete(function(){t.tweenGroup.remove(this),v.remove(S),b0(S)}).start())}}})}})},update:function(e){var t=rt(e.ringLat),n=rt(e.ringLng),r=rt(e.ringAltitude),s=e.scene.localToWorld(new J1.Vector3(0,0,0));e.dataMapper.onUpdateObj(function(o,a){var l=t(a),c=n(a),u=r(a);Object.assign(o.position,yc(l,c,u)),o.lookAt(s)}).digest(e.ringsData)}}),EEe={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 "}},MEe="normal",CEe=1189,REe=-100,PEe="normal",IEe={yMin:-334,xMin:-111,yMax:1189,xMax:1672},NEe=1e3,LEe={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"},PEe=-334,IEe="Helvetiker",NEe=1522,LEe=50,DEe={glyphs:bEe,cssFontWeight:wEe,ascender:SEe,underlinePosition:TEe,cssFontStyle:EEe,boundingBox:MEe,resolution:CEe,original_font_information:REe,descender:PEe,familyName:IEe,lineHeight:NEe,underlineThickness:LEe},du=Ui(Ui({},window.THREE?window.THREE:{BoxGeometry:Wc,CircleGeometry:b_,DoubleSide:sr,Group:br,Mesh:Gn,MeshLambertMaterial:xa,TextGeometry:Nb,Vector3:ie}),{},{Font:Y1,TextGeometry:Nb}),nne=Or({props:{labelsData:{default:[]},labelLat:{default:"lat"},labelLng:{default:"lng"},labelAltitude:{default:.002},labelText:{default:"text"},labelSize:{default:.5},labelTypeFace:{default:DEe,onChange:function(e,t){t.font=new du.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;zr(e),t.scene=e,t.tweenGroup=r;var s=new du.CircleGeometry(1,32);t.dataMapper=new sl(e,{objBindAttr:"__threeObjLabel"}).onCreateObj(function(){var o=new du.MeshLambertMaterial;o.side=sr;var a=new du.Group;a.add(new du.Mesh(s,o));var l=new du.Mesh(void 0,o);a.add(l);var c=new du.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*or/360;e.dataMapper.onUpdateObj(function(v,w){var S=gr(v.children,2),T=S[0],P=S[1],R=gr(P.children,1),C=R[0],L=l(w),D=pu(L);P.material.color.set(jh(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 du.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=_k(du.BoxGeometry,Hi(new du.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,be=ee.rot,Ie=ee.scale;Object.assign(v.position,yc(ae,ce,de)),v.lookAt(e.scene.localToWorld(new du.Vector3(0,0,0))),v.rotateY(Math.PI),v.rotateZ(-be*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 Ws(J).to(K,e.labelsTransitionDuration).easing(Br.Quadratic.InOut).onUpdate(H).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.labelsData)}}),FEe=Ui(Ui({},window.THREE?window.THREE:{}),{},{CSS2DObject:y3}),ine=Or({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=gr(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;zr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new sl(e,{objBindAttr:"__threeObjHtml"}).onCreateObj(function(s){var o=rt(t.htmlElement)(s),a=new FEe.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,yc(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 Ws(a.__currentTargetD).to(u,e.htmlTransitionDuration).easing(Br.Quadratic.InOut).onUpdate(c).onComplete(function(){e.tweenGroup.remove(this)}).start())}).digest(e.htmlElementsData)}}),bR=window.THREE?window.THREE:{Group:br,Mesh:Gn,MeshLambertMaterial:xa,SphereGeometry:_a},rne=Or({props:{objectsData:{default:[]},objectLat:{default:"lat"},objectLng:{default:"lng"},objectAltitude:{default:.01},objectFacesSurface:{default:!0},objectRotation:{},objectThreeObject:{default:new bR.Mesh(new bR.SphereGeometry(1,16,8),new bR.MeshLambertMaterial({color:"#ffffaa",transparent:!0,opacity:.7}))}},init:function(e,t){zr(e),t.scene=e,t.dataMapper=new sl(e,{objBindAttr:"__threeObjObject"}).onCreateObj(function(n){var r=rt(t.objectThreeObject)(n);t.objectThreeObject===r&&(r=r.clone());var s=new bR.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,yc(u,f,p)),o(c)?l.setRotationFromEuler(new Aa(Jm(-u),Jm(f),0,"YXZ")):l.rotation.set(0,0,0);var x=l.children[0],v=a(c);v&&x.setRotationFromEuler(new Aa(Jm(v.x||0),Jm(v.y||0),Jm(v.z||0)))}).digest(e.objectsData)}}),sne=Or({props:{customLayerData:{default:[]},customThreeObject:{},customThreeObjectUpdate:{triggerUpdate:!1}},init:function(e,t){zr(e),t.scene=e,t.dataMapper=new sl(e,{objBindAttr:"__threeObjCustom"}).onCreateObj(function(n){var r=rt(t.customThreeObject)(n,or);return r&&(t.customThreeObject===r&&(r=r.clone()),r.__globeObjType="custom"),r})},update:function(e,t){e.customThreeObjectUpdate||zr(e.scene);var n=rt(e.customThreeObjectUpdate);t.hasOwnProperty("customThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(r,s){return n(r,s,or)}).digest(e.customLayerData)}}),wR=window.THREE?window.THREE:{Camera:Of,Group:br,Vector2:Oe,Vector3:ie},OEe=["globeLayer","pointsLayer","arcsLayer","hexBinLayer","heatmapsLayer","polygonsLayer","hexedPolygonsLayer","pathsLayer","tilesLayer","particlesLayer","ringsLayer","labelsLayer","htmlElementsLayer","objectsLayer","customLayer"],one=La("globeLayer",qte),BEe=Object.assign.apply(Object,Hi(["globeImageUrl","bumpImageUrl","globeCurvatureResolution","globeTileEngineUrl","globeTileEngineMaxLevel","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude"].map(function(i){return oo({},i,one.linkProp(i))}))),UEe=Object.assign.apply(Object,Hi(["globeMaterial","globeTileEngineClearCache"].map(function(i){return oo({},i,one.linkMethod(i))}))),kEe=La("pointsLayer",Hte),GEe=Object.assign.apply(Object,Hi(["pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration"].map(function(i){return oo({},i,kEe.linkProp(i))}))),zEe=La("arcsLayer",jte),VEe=Object.assign.apply(Object,Hi(["arcsData","arcStartLat","arcStartLng","arcStartAltitude","arcEndLat","arcEndLng","arcEndAltitude","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration"].map(function(i){return oo({},i,zEe.linkProp(i))}))),qEe=La("hexBinLayer",Xte),HEe=Object.assign.apply(Object,Hi(["hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration"].map(function(i){return oo({},i,qEe.linkProp(i))}))),WEe=La("heatmapsLayer",Yte),jEe=Object.assign.apply(Object,Hi(["heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration"].map(function(i){return oo({},i,WEe.linkProp(i))}))),XEe=La("hexedPolygonsLayer",Zte),$Ee=Object.assign.apply(Object,Hi(["hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration"].map(function(i){return oo({},i,XEe.linkProp(i))}))),YEe=La("polygonsLayer",Kte),KEe=Object.assign.apply(Object,Hi(["polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration"].map(function(i){return oo({},i,YEe.linkProp(i))}))),ZEe=La("pathsLayer",Qte),QEe=Object.assign.apply(Object,Hi(["pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration"].map(function(i){return oo({},i,ZEe.linkProp(i))}))),JEe=La("tilesLayer",Jte),eMe=Object.assign.apply(Object,Hi(["tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration"].map(function(i){return oo({},i,JEe.linkProp(i))}))),tMe=La("particlesLayer",ene),nMe=Object.assign.apply(Object,Hi(["particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture"].map(function(i){return oo({},i,tMe.linkProp(i))}))),iMe=La("ringsLayer",tne),rMe=Object.assign.apply(Object,Hi(["ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod"].map(function(i){return oo({},i,iMe.linkProp(i))}))),sMe=La("labelsLayer",nne),oMe=Object.assign.apply(Object,Hi(["labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration"].map(function(i){return oo({},i,sMe.linkProp(i))}))),aMe=La("htmlElementsLayer",ine),lMe=Object.assign.apply(Object,Hi(["htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration"].map(function(i){return oo({},i,aMe.linkProp(i))}))),cMe=La("objectsLayer",rne),uMe=Object.assign.apply(Object,Hi(["objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject"].map(function(i){return oo({},i,cMe.linkProp(i))}))),hMe=La("customLayer",sne),fMe=Object.assign.apply(Object,Hi(["customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(i){return oo({},i,hMe.linkProp(i))}))),dMe=Or({props:Ui(Ui(Ui(Ui(Ui(Ui(Ui(Ui(Ui(Ui(Ui(Ui(Ui(Ui(Ui({onGlobeReady:{triggerUpdate:!1},rendererSize:{default:new wR.Vector2(window.innerWidth,window.innerHeight),onChange:function(e,t){t.pathsLayer.rendererSize(e)},triggerUpdate:!1}},BEe),GEe),VEe),HEe),jEe),KEe),$Ee),QEe),eMe),nMe),rMe),oMe),lMe),uMe),fMe),methods:Ui({getGlobeRadius:Rte,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 yc.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 Vte.apply(void 0,n)},setPointOfView:function(e,t){var n=t instanceof wR.Camera?t.position:t,r=Rte(),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()})}},UEe),stateInit:function(){var e=new tm,t={tweenGroup:e},n={globeLayer:qte(t),pointsLayer:Hte(t),arcsLayer:jte(t),hexBinLayer:Xte(t),heatmapsLayer:Yte(t),polygonsLayer:Kte(t),hexedPolygonsLayer:Zte(t),pathsLayer:Qte(t),tilesLayer:Jte(t),particlesLayer:ene(t),ringsLayer:tne(t),labelsLayer:nne(t),htmlElementsLayer:ine(t),objectsLayer:rne(t),customLayer:sne(t)};return Ui(Ui({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;zr(e),t.scene=e,t.scene.visible=!1,OEe.forEach(function(c){var u=new wR.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 Ws({k:1e-6}).to({k:1},600).easing(Br.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 wR.Vector3(0,1,0);t.tweenGroup.add(new Ws({rot:Math.PI*2}).to({rot:0},1200).easing(Br.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 pMe(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;TR(this,s);for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];return o=SR(this,s,[].concat(l)),o.__kapsuleInstance=_k(i,[].concat(Hi(t?[o]:[]),l)),o}return MR(s,r),ER(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 AMe=window.THREE?window.THREE:{Group:br},vk=pMe(dMe,AMe.Group,!0);var bk={type:"change"},Tk={type:"start"},Ek={type:"end"},ane=1e-6,Ii={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4},CR=new Oe,S0=new Oe,mMe=new ie,RR=new ie,wk=new ie,ex=new Es,lne=new ie,PR=new ie,Sk=new ie,IR=new ie,NR=class extends Bf{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:ya.ROTATE,MIDDLE:ya.DOLLY,RIGHT:ya.PAN},this.target=new ie,this.state=Ii.NONE,this.keyState=Ii.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=_Me.bind(this),this._onPointerDown=gMe.bind(this),this._onPointerUp=xMe.bind(this),this._onPointerCancel=yMe.bind(this),this._onContextMenu=MMe.bind(this),this._onMouseWheel=EMe.bind(this),this._onKeyDown=bMe.bind(this),this._onKeyUp=vMe.bind(this),this._onTouchStart=CMe.bind(this),this._onTouchMove=RMe.bind(this),this._onTouchEnd=PMe.bind(this),this._onMouseDown=wMe.bind(this),this._onMouseMove=SMe.bind(this),this._onMouseUp=TMe.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)>ane&&(this.dispatchEvent(bk),this._lastPosition.copy(this.object.position))):this.object.isOrthographicCamera?(this.object.lookAt(this.target),(this._lastPosition.distanceToSquared(this.object.position)>ane||this._lastZoom!==this.object.zoom)&&(this.dispatchEvent(bk),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom)):console.warn("THREE.TrackballControls: Unsupported camera type.")}reset(){this.state=Ii.NONE,this.keyState=Ii.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(bk),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom}_panCamera(){if(S0.copy(this._panEnd).sub(this._panStart),S0.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;S0.x*=e,S0.y*=t}S0.multiplyScalar(this._eye.length()*this.panSpeed),RR.copy(this._eye).cross(this.object.up).setLength(S0.x),RR.add(mMe.copy(this.object.up).setLength(S0.y)),this.object.position.add(RR),this.target.add(RR),this.staticMoving?this._panStart.copy(this._panEnd):this._panStart.add(S0.subVectors(this._panEnd,this._panStart).multiplyScalar(this.dynamicDampingFactor))}}_rotateCamera(){IR.set(this._moveCurr.x-this._movePrev.x,this._moveCurr.y-this._movePrev.y,0);let e=IR.length();e?(this._eye.copy(this.object.position).sub(this.target),lne.copy(this._eye).normalize(),PR.copy(this.object.up).normalize(),Sk.crossVectors(PR,lne).normalize(),PR.setLength(this._moveCurr.y-this._movePrev.y),Sk.setLength(this._moveCurr.x-this._movePrev.x),IR.copy(PR.add(Sk)),wk.crossVectors(IR,this._eye).normalize(),e*=this.rotateSpeed,ex.setFromAxisAngle(wk,e),this._eye.applyQuaternion(ex),this.object.up.applyQuaternion(ex),this._lastAxis.copy(wk),this._lastAngle=e):!this.staticMoving&&this._lastAngle&&(this._lastAngle*=Math.sqrt(1-this.dynamicDampingFactor),this._eye.copy(this.object.position).sub(this.target),ex.setFromAxisAngle(this._lastAxis,this._lastAngle),this._eye.applyQuaternion(ex),this.object.up.applyQuaternion(ex)),this._movePrev.copy(this._moveCurr)}_zoomCamera(){let e;this.state===Ii.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=Yc.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=Yc.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 CR.set((e-this.screen.left)/this.screen.width,(t-this.screen.top)/this.screen.height),CR}_getMouseOnCircle(e,t){return CR.set((e-this.screen.width*.5-this.screen.left)/(this.screen.width*.5),(this.screen.height+2*(this.screen.top-t))/this.screen.width),CR}_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 gMe(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 _Me(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function xMe(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 yMe(i){this._removePointer(i)}function vMe(){this.enabled!==!1&&(this.keyState=Ii.NONE,window.addEventListener("keydown",this._onKeyDown))}function bMe(i){this.enabled!==!1&&(window.removeEventListener("keydown",this._onKeyDown),this.keyState===Ii.NONE&&(i.code===this.keys[Ii.ROTATE]&&!this.noRotate?this.keyState=Ii.ROTATE:i.code===this.keys[Ii.ZOOM]&&!this.noZoom?this.keyState=Ii.ZOOM:i.code===this.keys[Ii.PAN]&&!this.noPan&&(this.keyState=Ii.PAN)))}function wMe(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 ya.DOLLY:this.state=Ii.ZOOM;break;case ya.ROTATE:this.state=Ii.ROTATE;break;case ya.PAN:this.state=Ii.PAN;break;default:this.state=Ii.NONE}let t=this.keyState!==Ii.NONE?this.keyState:this.state;t===Ii.ROTATE&&!this.noRotate?(this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY)),this._movePrev.copy(this._moveCurr)):t===Ii.ZOOM&&!this.noZoom?(this._zoomStart.copy(this._getMouseOnScreen(i.pageX,i.pageY)),this._zoomEnd.copy(this._zoomStart)):t===Ii.PAN&&!this.noPan&&(this._panStart.copy(this._getMouseOnScreen(i.pageX,i.pageY)),this._panEnd.copy(this._panStart)),this.dispatchEvent(Tk)}function SMe(i){let e=this.keyState!==Ii.NONE?this.keyState:this.state;e===Ii.ROTATE&&!this.noRotate?(this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY))):e===Ii.ZOOM&&!this.noZoom?this._zoomEnd.copy(this._getMouseOnScreen(i.pageX,i.pageY)):e===Ii.PAN&&!this.noPan&&this._panEnd.copy(this._getMouseOnScreen(i.pageX,i.pageY))}function TMe(){this.state=Ii.NONE,this.dispatchEvent(Ek)}function EMe(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(Tk),this.dispatchEvent(Ek)}}function MMe(i){this.enabled!==!1&&i.preventDefault()}function CMe(i){if(this._trackPointer(i),this._pointers.length===1)this.state=Ii.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(this._pointers[0].pageX,this._pointers[0].pageY)),this._movePrev.copy(this._moveCurr);else{this.state=Ii.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(Tk)}function RMe(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 PMe(i){switch(this._pointers.length){case 0:this.state=Ii.NONE;break;case 1:this.state=Ii.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY)),this._movePrev.copy(this._moveCurr);break;case 2:this.state=Ii.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 cne={type:"change"},Ck={type:"start"},hne={type:"end"},LR=new Ff,une=new ha,IMe=Math.cos(70*Yc.DEG2RAD),js=new ie,ol=2*Math.PI,tr={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},Mk=1e-6,DR=class extends Bf{constructor(e,t=null){super(e,t),this.state=tr.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:ya.ROTATE,MIDDLE:ya.DOLLY,RIGHT:ya.PAN},this.touches={ONE:op.ROTATE,TWO:op.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 Es,this._lastTargetPosition=new ie,this._quat=new Es().setFromUnitVectors(e.up,new ie(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new R_,this._sphericalDelta=new R_,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=LMe.bind(this),this._onPointerDown=NMe.bind(this),this._onPointerUp=DMe.bind(this),this._onContextMenu=zMe.bind(this),this._onMouseWheel=BMe.bind(this),this._onKeyDown=UMe.bind(this),this._onTouchStart=kMe.bind(this),this._onTouchMove=GMe.bind(this),this._onMouseDown=FMe.bind(this),this._onMouseMove=OMe.bind(this),this._interceptControlDown=VMe.bind(this),this._interceptControlUp=qMe.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(cne),this.update(),this.state=tr.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;js.copy(t).sub(this.target),js.applyQuaternion(this._quat),this._spherical.setFromVector3(js),this.autoRotate&&this.state===tr.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+=ol:n>Math.PI&&(n-=ol),r<-Math.PI?r+=ol:r>Math.PI&&(r-=ol),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(js.setFromSpherical(this._spherical),js.applyQuaternion(this._quatInverse),t.copy(this.target).add(js),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=js.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=js.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):(LR.origin.copy(this.object.position),LR.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(LR.direction))<IMe?this.object.lookAt(this.target):(une.setFromNormalAndCoplanarPoint(this.object.up,this.target),LR.intersectPlane(une,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)>Mk||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Mk||this._lastTargetPosition.distanceToSquared(this.target)>Mk?(this.dispatchEvent(cne),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?ol/60*this.autoRotateSpeed*e:ol/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){js.setFromMatrixColumn(t,0),js.multiplyScalar(-e),this._panOffset.add(js)}_panUp(e,t){this.screenSpacePanning===!0?js.setFromMatrixColumn(t,1):(js.setFromMatrixColumn(t,0),js.crossVectors(this.object.up,js)),js.multiplyScalar(e),this._panOffset.add(js)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let r=this.object.position;js.copy(r).sub(this.target);let s=js.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(ol*this._rotateDelta.x/t.clientHeight),this._rotateUp(ol*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(ol*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(-ol*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(ol*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(-ol*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(ol*this._rotateDelta.x/t.clientHeight),this._rotateUp(ol*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 NMe(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 LMe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function DMe(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(hne),this.state=tr.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 FMe(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 ya.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(i),this.state=tr.DOLLY;break;case ya.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=tr.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=tr.ROTATE}break;case ya.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=tr.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=tr.PAN}break;default:this.state=tr.NONE}this.state!==tr.NONE&&this.dispatchEvent(Ck)}function OMe(i){switch(this.state){case tr.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(i);break;case tr.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(i);break;case tr.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(i);break}}function BMe(i){this.enabled===!1||this.enableZoom===!1||this.state!==tr.NONE||(i.preventDefault(),this.dispatchEvent(Ck),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(hne))}function UMe(i){this.enabled!==!1&&this._handleKeyDown(i)}function kMe(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case op.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=tr.TOUCH_ROTATE;break;case op.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(i),this.state=tr.TOUCH_PAN;break;default:this.state=tr.NONE}break;case 2:switch(this.touches.TWO){case op.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=tr.TOUCH_DOLLY_PAN;break;case op.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(i),this.state=tr.TOUCH_DOLLY_ROTATE;break;default:this.state=tr.NONE}break;default:this.state=tr.NONE}this.state!==tr.NONE&&this.dispatchEvent(Ck)}function GMe(i){switch(this._trackPointer(i),this.state){case tr.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(i),this.update();break;case tr.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(i),this.update();break;case tr.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(i),this.update();break;case tr.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(i),this.update();break;default:this.state=tr.NONE}}function zMe(i){this.enabled!==!1&&i.preventDefault()}function VMe(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function qMe(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}var HMe={type:"change"},fne=1e-6,dne=new Es,FR=class extends Bf{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 Es,this._lastPosition=new ie,this._status=0,this._onKeyDown=WMe.bind(this),this._onKeyUp=jMe.bind(this),this._onPointerMove=$Me.bind(this),this._onPointerDown=XMe.bind(this),this._onPointerUp=YMe.bind(this),this._onPointerCancel=KMe.bind(this),this._onContextMenu=ZMe.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),dne.set(this._rotationVector.x*r,this._rotationVector.y*r,this._rotationVector.z*r,1).normalize(),t.quaternion.multiply(dne),(this._lastPosition.distanceToSquared(t.position)>fne||8*(1-this._lastQuaternion.dot(t.quaternion))>fne)&&(this.dispatchEvent(HMe),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 WMe(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 jMe(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 XMe(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 $Me(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 YMe(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 KMe(){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 ZMe(i){this.enabled!==!1&&i.preventDefault()}var pne={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"},DEe=-334,FEe="Helvetiker",OEe=1522,BEe=50,UEe={glyphs:EEe,cssFontWeight:MEe,ascender:CEe,underlinePosition:REe,cssFontStyle:PEe,boundingBox:IEe,resolution:NEe,original_font_information:LEe,descender:DEe,familyName:FEe,lineHeight:OEe,underlineThickness:BEe},du=Ui(Ui({},window.THREE?window.THREE:{BoxGeometry:Wc,CircleGeometry:w_,DoubleSide:sr,Group:br,Mesh:Gn,MeshLambertMaterial:xa,TextGeometry:Db,Vector3:ie}),{},{Font:K1,TextGeometry:Db}),rne=Or({props:{labelsData:{default:[]},labelLat:{default:"lat"},labelLng:{default:"lng"},labelAltitude:{default:.002},labelText:{default:"text"},labelSize:{default:.5},labelTypeFace:{default:UEe,onChange:function(e,t){t.font=new du.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;zr(e),t.scene=e,t.tweenGroup=r;var s=new du.CircleGeometry(1,32);t.dataMapper=new sl(e,{objBindAttr:"__threeObjLabel"}).onCreateObj(function(){var o=new du.MeshLambertMaterial;o.side=sr;var a=new du.Group;a.add(new du.Mesh(s,o));var l=new du.Mesh(void 0,o);a.add(l);var c=new du.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*or/360;e.dataMapper.onUpdateObj(function(v,w){var S=gr(v.children,2),T=S[0],R=S[1],P=gr(R.children,1),C=P[0],L=l(w),D=pu(L);R.material.color.set(jh(L)),R.material.transparent=D<1,R.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(R.geometry&&R.geometry.dispose(),R.geometry=new du.TextGeometry(s(w),{font:e.font,size:z,depth:0,bevelEnabled:!0,bevelThickness:0,bevelSize:0,curveSegments:e.labelResolution}),C.geometry&&C.geometry.dispose(),R.geometry.computeBoundingBox(),C.geometry=xk(du.BoxGeometry,Hi(new du.Vector3().subVectors(R.geometry.boundingBox.max,R.geometry.boundingBox.min).clampScalar(0,1/0).toArray())),N!=="right"&&R.geometry.center(),F){var V=B+z/2;N==="right"&&(R.position.x=V),R.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,be=ee.rot,Ie=ee.scale;Object.assign(v.position,yc(ae,ce,de)),v.lookAt(e.scene.localToWorld(new du.Vector3(0,0,0))),v.rotateY(Math.PI),v.rotateZ(-be*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 Ws(J).to(K,e.labelsTransitionDuration).easing(Br.Quadratic.InOut).onUpdate(H).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.labelsData)}}),kEe=Ui(Ui({},window.THREE?window.THREE:{}),{},{CSS2DObject:v3}),sne=Or({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=gr(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;zr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new sl(e,{objBindAttr:"__threeObjHtml"}).onCreateObj(function(s){var o=rt(t.htmlElement)(s),a=new kEe.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,yc(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 Ws(a.__currentTargetD).to(u,e.htmlTransitionDuration).easing(Br.Quadratic.InOut).onUpdate(c).onComplete(function(){e.tweenGroup.remove(this)}).start())}).digest(e.htmlElementsData)}}),wR=window.THREE?window.THREE:{Group:br,Mesh:Gn,MeshLambertMaterial:xa,SphereGeometry:_a},one=Or({props:{objectsData:{default:[]},objectLat:{default:"lat"},objectLng:{default:"lng"},objectAltitude:{default:.01},objectFacesSurface:{default:!0},objectRotation:{},objectThreeObject:{default:new wR.Mesh(new wR.SphereGeometry(1,16,8),new wR.MeshLambertMaterial({color:"#ffffaa",transparent:!0,opacity:.7}))}},init:function(e,t){zr(e),t.scene=e,t.dataMapper=new sl(e,{objBindAttr:"__threeObjObject"}).onCreateObj(function(n){var r=rt(t.objectThreeObject)(n);t.objectThreeObject===r&&(r=r.clone());var s=new wR.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,yc(u,f,p)),o(c)?l.setRotationFromEuler(new Aa(Jm(-u),Jm(f),0,"YXZ")):l.rotation.set(0,0,0);var x=l.children[0],v=a(c);v&&x.setRotationFromEuler(new Aa(Jm(v.x||0),Jm(v.y||0),Jm(v.z||0)))}).digest(e.objectsData)}}),ane=Or({props:{customLayerData:{default:[]},customThreeObject:{},customThreeObjectUpdate:{triggerUpdate:!1}},init:function(e,t){zr(e),t.scene=e,t.dataMapper=new sl(e,{objBindAttr:"__threeObjCustom"}).onCreateObj(function(n){var r=rt(t.customThreeObject)(n,or);return r&&(t.customThreeObject===r&&(r=r.clone()),r.__globeObjType="custom"),r})},update:function(e,t){e.customThreeObjectUpdate||zr(e.scene);var n=rt(e.customThreeObjectUpdate);t.hasOwnProperty("customThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(r,s){return n(r,s,or)}).digest(e.customLayerData)}}),SR=window.THREE?window.THREE:{Camera:Of,Group:br,Vector2:Oe,Vector3:ie},GEe=["globeLayer","pointsLayer","arcsLayer","hexBinLayer","heatmapsLayer","polygonsLayer","hexedPolygonsLayer","pathsLayer","tilesLayer","particlesLayer","ringsLayer","labelsLayer","htmlElementsLayer","objectsLayer","customLayer"],lne=La("globeLayer",Wte),zEe=Object.assign.apply(Object,Hi(["globeImageUrl","bumpImageUrl","globeCurvatureResolution","globeTileEngineUrl","globeTileEngineMaxLevel","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude"].map(function(i){return oo({},i,lne.linkProp(i))}))),VEe=Object.assign.apply(Object,Hi(["globeMaterial","globeTileEngineClearCache"].map(function(i){return oo({},i,lne.linkMethod(i))}))),qEe=La("pointsLayer",jte),HEe=Object.assign.apply(Object,Hi(["pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration"].map(function(i){return oo({},i,qEe.linkProp(i))}))),WEe=La("arcsLayer",$te),jEe=Object.assign.apply(Object,Hi(["arcsData","arcStartLat","arcStartLng","arcStartAltitude","arcEndLat","arcEndLng","arcEndAltitude","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration"].map(function(i){return oo({},i,WEe.linkProp(i))}))),XEe=La("hexBinLayer",Yte),$Ee=Object.assign.apply(Object,Hi(["hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration"].map(function(i){return oo({},i,XEe.linkProp(i))}))),YEe=La("heatmapsLayer",Zte),KEe=Object.assign.apply(Object,Hi(["heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration"].map(function(i){return oo({},i,YEe.linkProp(i))}))),ZEe=La("hexedPolygonsLayer",Jte),QEe=Object.assign.apply(Object,Hi(["hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration"].map(function(i){return oo({},i,ZEe.linkProp(i))}))),JEe=La("polygonsLayer",Qte),eMe=Object.assign.apply(Object,Hi(["polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration"].map(function(i){return oo({},i,JEe.linkProp(i))}))),tMe=La("pathsLayer",ene),nMe=Object.assign.apply(Object,Hi(["pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration"].map(function(i){return oo({},i,tMe.linkProp(i))}))),iMe=La("tilesLayer",tne),rMe=Object.assign.apply(Object,Hi(["tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration"].map(function(i){return oo({},i,iMe.linkProp(i))}))),sMe=La("particlesLayer",nne),oMe=Object.assign.apply(Object,Hi(["particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture"].map(function(i){return oo({},i,sMe.linkProp(i))}))),aMe=La("ringsLayer",ine),lMe=Object.assign.apply(Object,Hi(["ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod"].map(function(i){return oo({},i,aMe.linkProp(i))}))),cMe=La("labelsLayer",rne),uMe=Object.assign.apply(Object,Hi(["labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration"].map(function(i){return oo({},i,cMe.linkProp(i))}))),hMe=La("htmlElementsLayer",sne),fMe=Object.assign.apply(Object,Hi(["htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration"].map(function(i){return oo({},i,hMe.linkProp(i))}))),dMe=La("objectsLayer",one),pMe=Object.assign.apply(Object,Hi(["objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject"].map(function(i){return oo({},i,dMe.linkProp(i))}))),AMe=La("customLayer",ane),mMe=Object.assign.apply(Object,Hi(["customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(i){return oo({},i,AMe.linkProp(i))}))),gMe=Or({props:Ui(Ui(Ui(Ui(Ui(Ui(Ui(Ui(Ui(Ui(Ui(Ui(Ui(Ui(Ui({onGlobeReady:{triggerUpdate:!1},rendererSize:{default:new SR.Vector2(window.innerWidth,window.innerHeight),onChange:function(e,t){t.pathsLayer.rendererSize(e)},triggerUpdate:!1}},zEe),HEe),jEe),$Ee),KEe),eMe),QEe),nMe),rMe),oMe),lMe),uMe),fMe),pMe),mMe),methods:Ui({getGlobeRadius:Ite,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 yc.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 Hte.apply(void 0,n)},setPointOfView:function(e,t){var n=t instanceof SR.Camera?t.position:t,r=Ite(),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()})}},VEe),stateInit:function(){var e=new tm,t={tweenGroup:e},n={globeLayer:Wte(t),pointsLayer:jte(t),arcsLayer:$te(t),hexBinLayer:Yte(t),heatmapsLayer:Zte(t),polygonsLayer:Qte(t),hexedPolygonsLayer:Jte(t),pathsLayer:ene(t),tilesLayer:tne(t),particlesLayer:nne(t),ringsLayer:ine(t),labelsLayer:rne(t),htmlElementsLayer:sne(t),objectsLayer:one(t),customLayer:ane(t)};return Ui(Ui({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;zr(e),t.scene=e,t.scene.visible=!1,GEe.forEach(function(c){var u=new SR.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 Ws({k:1e-6}).to({k:1},600).easing(Br.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 SR.Vector3(0,1,0);t.tweenGroup.add(new Ws({rot:Math.PI*2}).to({rot:0},1200).easing(Br.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 _Me(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;ER(this,s);for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];return o=TR(this,s,[].concat(l)),o.__kapsuleInstance=xk(i,[].concat(Hi(t?[o]:[]),l)),o}return CR(s,r),MR(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 xMe=window.THREE?window.THREE:{Group:br},bk=_Me(gMe,xMe.Group,!0);var wk={type:"change"},Ek={type:"start"},Mk={type:"end"},cne=1e-6,Ii={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4},RR=new Oe,S0=new Oe,yMe=new ie,PR=new ie,Sk=new ie,tx=new Es,une=new ie,IR=new ie,Tk=new ie,NR=new ie,LR=class extends Bf{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:ya.ROTATE,MIDDLE:ya.DOLLY,RIGHT:ya.PAN},this.target=new ie,this.state=Ii.NONE,this.keyState=Ii.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=bMe.bind(this),this._onPointerDown=vMe.bind(this),this._onPointerUp=wMe.bind(this),this._onPointerCancel=SMe.bind(this),this._onContextMenu=IMe.bind(this),this._onMouseWheel=PMe.bind(this),this._onKeyDown=EMe.bind(this),this._onKeyUp=TMe.bind(this),this._onTouchStart=NMe.bind(this),this._onTouchMove=LMe.bind(this),this._onTouchEnd=DMe.bind(this),this._onMouseDown=MMe.bind(this),this._onMouseMove=CMe.bind(this),this._onMouseUp=RMe.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)>cne&&(this.dispatchEvent(wk),this._lastPosition.copy(this.object.position))):this.object.isOrthographicCamera?(this.object.lookAt(this.target),(this._lastPosition.distanceToSquared(this.object.position)>cne||this._lastZoom!==this.object.zoom)&&(this.dispatchEvent(wk),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom)):console.warn("THREE.TrackballControls: Unsupported camera type.")}reset(){this.state=Ii.NONE,this.keyState=Ii.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(wk),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom}_panCamera(){if(S0.copy(this._panEnd).sub(this._panStart),S0.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;S0.x*=e,S0.y*=t}S0.multiplyScalar(this._eye.length()*this.panSpeed),PR.copy(this._eye).cross(this.object.up).setLength(S0.x),PR.add(yMe.copy(this.object.up).setLength(S0.y)),this.object.position.add(PR),this.target.add(PR),this.staticMoving?this._panStart.copy(this._panEnd):this._panStart.add(S0.subVectors(this._panEnd,this._panStart).multiplyScalar(this.dynamicDampingFactor))}}_rotateCamera(){NR.set(this._moveCurr.x-this._movePrev.x,this._moveCurr.y-this._movePrev.y,0);let e=NR.length();e?(this._eye.copy(this.object.position).sub(this.target),une.copy(this._eye).normalize(),IR.copy(this.object.up).normalize(),Tk.crossVectors(IR,une).normalize(),IR.setLength(this._moveCurr.y-this._movePrev.y),Tk.setLength(this._moveCurr.x-this._movePrev.x),NR.copy(IR.add(Tk)),Sk.crossVectors(NR,this._eye).normalize(),e*=this.rotateSpeed,tx.setFromAxisAngle(Sk,e),this._eye.applyQuaternion(tx),this.object.up.applyQuaternion(tx),this._lastAxis.copy(Sk),this._lastAngle=e):!this.staticMoving&&this._lastAngle&&(this._lastAngle*=Math.sqrt(1-this.dynamicDampingFactor),this._eye.copy(this.object.position).sub(this.target),tx.setFromAxisAngle(this._lastAxis,this._lastAngle),this._eye.applyQuaternion(tx),this.object.up.applyQuaternion(tx)),this._movePrev.copy(this._moveCurr)}_zoomCamera(){let e;this.state===Ii.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=Yc.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=Yc.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 RR.set((e-this.screen.left)/this.screen.width,(t-this.screen.top)/this.screen.height),RR}_getMouseOnCircle(e,t){return RR.set((e-this.screen.width*.5-this.screen.left)/(this.screen.width*.5),(this.screen.height+2*(this.screen.top-t))/this.screen.width),RR}_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 vMe(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 bMe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function wMe(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 SMe(i){this._removePointer(i)}function TMe(){this.enabled!==!1&&(this.keyState=Ii.NONE,window.addEventListener("keydown",this._onKeyDown))}function EMe(i){this.enabled!==!1&&(window.removeEventListener("keydown",this._onKeyDown),this.keyState===Ii.NONE&&(i.code===this.keys[Ii.ROTATE]&&!this.noRotate?this.keyState=Ii.ROTATE:i.code===this.keys[Ii.ZOOM]&&!this.noZoom?this.keyState=Ii.ZOOM:i.code===this.keys[Ii.PAN]&&!this.noPan&&(this.keyState=Ii.PAN)))}function MMe(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 ya.DOLLY:this.state=Ii.ZOOM;break;case ya.ROTATE:this.state=Ii.ROTATE;break;case ya.PAN:this.state=Ii.PAN;break;default:this.state=Ii.NONE}let t=this.keyState!==Ii.NONE?this.keyState:this.state;t===Ii.ROTATE&&!this.noRotate?(this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY)),this._movePrev.copy(this._moveCurr)):t===Ii.ZOOM&&!this.noZoom?(this._zoomStart.copy(this._getMouseOnScreen(i.pageX,i.pageY)),this._zoomEnd.copy(this._zoomStart)):t===Ii.PAN&&!this.noPan&&(this._panStart.copy(this._getMouseOnScreen(i.pageX,i.pageY)),this._panEnd.copy(this._panStart)),this.dispatchEvent(Ek)}function CMe(i){let e=this.keyState!==Ii.NONE?this.keyState:this.state;e===Ii.ROTATE&&!this.noRotate?(this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY))):e===Ii.ZOOM&&!this.noZoom?this._zoomEnd.copy(this._getMouseOnScreen(i.pageX,i.pageY)):e===Ii.PAN&&!this.noPan&&this._panEnd.copy(this._getMouseOnScreen(i.pageX,i.pageY))}function RMe(){this.state=Ii.NONE,this.dispatchEvent(Mk)}function PMe(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(Ek),this.dispatchEvent(Mk)}}function IMe(i){this.enabled!==!1&&i.preventDefault()}function NMe(i){if(this._trackPointer(i),this._pointers.length===1)this.state=Ii.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(this._pointers[0].pageX,this._pointers[0].pageY)),this._movePrev.copy(this._moveCurr);else{this.state=Ii.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(Ek)}function LMe(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 DMe(i){switch(this._pointers.length){case 0:this.state=Ii.NONE;break;case 1:this.state=Ii.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY)),this._movePrev.copy(this._moveCurr);break;case 2:this.state=Ii.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(Mk)}var hne={type:"change"},Rk={type:"start"},dne={type:"end"},DR=new Ff,fne=new ha,FMe=Math.cos(70*Yc.DEG2RAD),js=new ie,ol=2*Math.PI,tr={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},Ck=1e-6,FR=class extends Bf{constructor(e,t=null){super(e,t),this.state=tr.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:ya.ROTATE,MIDDLE:ya.DOLLY,RIGHT:ya.PAN},this.touches={ONE:op.ROTATE,TWO:op.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 Es,this._lastTargetPosition=new ie,this._quat=new Es().setFromUnitVectors(e.up,new ie(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new P_,this._sphericalDelta=new P_,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=BMe.bind(this),this._onPointerDown=OMe.bind(this),this._onPointerUp=UMe.bind(this),this._onContextMenu=WMe.bind(this),this._onMouseWheel=zMe.bind(this),this._onKeyDown=VMe.bind(this),this._onTouchStart=qMe.bind(this),this._onTouchMove=HMe.bind(this),this._onMouseDown=kMe.bind(this),this._onMouseMove=GMe.bind(this),this._interceptControlDown=jMe.bind(this),this._interceptControlUp=XMe.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(hne),this.update(),this.state=tr.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;js.copy(t).sub(this.target),js.applyQuaternion(this._quat),this._spherical.setFromVector3(js),this.autoRotate&&this.state===tr.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+=ol:n>Math.PI&&(n-=ol),r<-Math.PI?r+=ol:r>Math.PI&&(r-=ol),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(js.setFromSpherical(this._spherical),js.applyQuaternion(this._quatInverse),t.copy(this.target).add(js),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=js.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=js.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):(DR.origin.copy(this.object.position),DR.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(DR.direction))<FMe?this.object.lookAt(this.target):(fne.setFromNormalAndCoplanarPoint(this.object.up,this.target),DR.intersectPlane(fne,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)>Ck||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Ck||this._lastTargetPosition.distanceToSquared(this.target)>Ck?(this.dispatchEvent(hne),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?ol/60*this.autoRotateSpeed*e:ol/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){js.setFromMatrixColumn(t,0),js.multiplyScalar(-e),this._panOffset.add(js)}_panUp(e,t){this.screenSpacePanning===!0?js.setFromMatrixColumn(t,1):(js.setFromMatrixColumn(t,0),js.crossVectors(this.object.up,js)),js.multiplyScalar(e),this._panOffset.add(js)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let r=this.object.position;js.copy(r).sub(this.target);let s=js.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(ol*this._rotateDelta.x/t.clientHeight),this._rotateUp(ol*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(ol*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(-ol*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(ol*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(-ol*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(ol*this._rotateDelta.x/t.clientHeight),this._rotateUp(ol*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 OMe(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 BMe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function UMe(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(dne),this.state=tr.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 kMe(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 ya.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(i),this.state=tr.DOLLY;break;case ya.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=tr.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=tr.ROTATE}break;case ya.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=tr.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=tr.PAN}break;default:this.state=tr.NONE}this.state!==tr.NONE&&this.dispatchEvent(Rk)}function GMe(i){switch(this.state){case tr.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(i);break;case tr.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(i);break;case tr.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(i);break}}function zMe(i){this.enabled===!1||this.enableZoom===!1||this.state!==tr.NONE||(i.preventDefault(),this.dispatchEvent(Rk),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(dne))}function VMe(i){this.enabled!==!1&&this._handleKeyDown(i)}function qMe(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case op.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=tr.TOUCH_ROTATE;break;case op.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(i),this.state=tr.TOUCH_PAN;break;default:this.state=tr.NONE}break;case 2:switch(this.touches.TWO){case op.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=tr.TOUCH_DOLLY_PAN;break;case op.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(i),this.state=tr.TOUCH_DOLLY_ROTATE;break;default:this.state=tr.NONE}break;default:this.state=tr.NONE}this.state!==tr.NONE&&this.dispatchEvent(Rk)}function HMe(i){switch(this._trackPointer(i),this.state){case tr.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(i),this.update();break;case tr.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(i),this.update();break;case tr.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(i),this.update();break;case tr.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(i),this.update();break;default:this.state=tr.NONE}}function WMe(i){this.enabled!==!1&&i.preventDefault()}function jMe(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function XMe(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}var $Me={type:"change"},pne=1e-6,Ane=new Es,OR=class extends Bf{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 Es,this._lastPosition=new ie,this._status=0,this._onKeyDown=YMe.bind(this),this._onKeyUp=KMe.bind(this),this._onPointerMove=QMe.bind(this),this._onPointerDown=ZMe.bind(this),this._onPointerUp=JMe.bind(this),this._onPointerCancel=eCe.bind(this),this._onContextMenu=tCe.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),Ane.set(this._rotationVector.x*r,this._rotationVector.y*r,this._rotationVector.z*r,1).normalize(),t.quaternion.multiply(Ane),(this._lastPosition.distanceToSquared(t.position)>pne||8*(1-this._lastQuaternion.dot(t.quaternion))>pne)&&(this.dispatchEvent($Me),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 YMe(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 KMe(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 ZMe(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 QMe(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 JMe(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 eCe(){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 tCe(i){this.enabled!==!1&&i.preventDefault()}var mne={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 ld=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(){}},QMe=new jc(-1,1,1,-1,0,1),Rk=class extends qn{constructor(){super(),this.setAttribute("position",new Rn([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Rn([0,2,0,0,2,0],2))}},JMe=new Rk,OR=class{constructor(e){this._mesh=new Gn(JMe,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,QMe)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}};var BR=class extends ld{constructor(e,t="tDiffuse"){super(),this.textureID=t,this.uniforms=null,this.material=null,e instanceof Kr?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=QA.clone(e.uniforms),this.material=new Kr({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 OR(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 Ob=class extends ld{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)}},UR=class extends ld{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}};var kR=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 pa(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Fi}),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 BR(pne),this.copyPass.material.blending=Zr,this.timer=new kA}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()}Ob!==void 0&&(o instanceof Ob?n=!0:o instanceof UR&&(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 GR=class extends ld{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 Da(){return Da=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},Da.apply(null,arguments)}function Ane(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function T0(i,e){return T0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},T0(i,e)}function mne(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i,T0(i,e)}function zR(i){return zR=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},zR(i)}function gne(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}function Pk(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Pk=function(){return!!i})()}function _ne(i,e,t){if(Pk())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return t&&T0(r,t.prototype),r}function VR(i){var e=typeof Map=="function"?new Map:void 0;return VR=function(n){if(n===null||!gne(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 _ne(n,arguments,zR(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),T0(r,n)},VR(i)}var al=(function(i){mne(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 Ane(n)}return e})(VR(Error));function xne(i,e){return i.substr(-e.length)===e}var eCe=/^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/;function yne(i){if(typeof i!="string")return i;var e=i.match(eCe);return e?parseFloat(i):i}var tCe=function(e){return function(t,n){n===void 0&&(n="16px");var r=t,s=n;if(typeof t=="string"){if(!xne(t,"px"))throw new al(69,e,t);r=yne(t)}if(typeof n=="string"){if(!xne(n,"px"))throw new al(70,e,n);s=yne(n)}if(typeof r=="string")throw new al(71,t,e);if(typeof s=="string")throw new al(72,n,e);return""+r/s+e}},bne=tCe,Ldt=bne("em");var Ddt=bne("rem");function Ik(i){return Math.round(i*255)}function nCe(i,e,t){return Ik(i)+","+Ik(e)+","+Ik(t)}function Bb(i,e,t,n){if(n===void 0&&(n=nCe),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 vne={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 iCe(i){if(typeof i!="string")return i;var e=i.toLowerCase();return vne[e]?"#"+vne[e]:i}var rCe=/^#[a-fA-F0-9]{6}$/,sCe=/^#[a-fA-F0-9]{8}$/,oCe=/^#[a-fA-F0-9]{3}$/,aCe=/^#[a-fA-F0-9]{4}$/,Nk=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,lCe=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,cCe=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,uCe=/^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 E0(i){if(typeof i!="string")throw new al(3);var e=iCe(i);if(e.match(rCe))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(sCe)){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(oCe))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(aCe)){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=Nk.exec(e);if(r)return{red:parseInt(""+r[1],10),green:parseInt(""+r[2],10),blue:parseInt(""+r[3],10)};var s=lCe.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=cCe.exec(e);if(o){var a=parseInt(""+o[1],10),l=parseInt(""+o[2],10)/100,c=parseInt(""+o[3],10)/100,u="rgb("+Bb(a,l,c)+")",f=Nk.exec(u);if(!f)throw new al(4,e,u);return{red:parseInt(""+f[1],10),green:parseInt(""+f[2],10),blue:parseInt(""+f[3],10)}}var p=uCe.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("+Bb(x,v,w)+")",T=Nk.exec(S);if(!T)throw new al(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 al(5)}function hCe(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 M0(i){return hCe(E0(i))}var fCe=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},Dk=fCe;function tg(i){var e=i.toString(16);return e.length===1?"0"+e:e}function Lk(i){return tg(Math.round(i*255))}function dCe(i,e,t){return Dk("#"+Lk(i)+Lk(e)+Lk(t))}function qR(i,e,t){return Bb(i,e,t,dCe)}function pCe(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return qR(i,e,t);if(typeof i=="object"&&e===void 0&&t===void 0)return qR(i.hue,i.saturation,i.lightness);throw new al(1)}function ACe(i,e,t,n){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number"&&typeof n=="number")return n>=1?qR(i,e,t):"rgba("+Bb(i,e,t)+","+n+")";if(typeof i=="object"&&e===void 0&&t===void 0&&n===void 0)return i.alpha>=1?qR(i.hue,i.saturation,i.lightness):"rgba("+Bb(i.hue,i.saturation,i.lightness)+","+i.alpha+")";throw new al(2)}function Fk(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return Dk("#"+tg(i)+tg(e)+tg(t));if(typeof i=="object"&&e===void 0&&t===void 0)return Dk("#"+tg(i.red)+tg(i.green)+tg(i.blue));throw new al(6)}function HR(i,e,t,n){if(typeof i=="string"&&typeof e=="number"){var r=E0(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?Fk(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?Fk(i.red,i.green,i.blue):"rgba("+i.red+","+i.green+","+i.blue+","+i.alpha+")"}throw new al(7)}var mCe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},gCe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&typeof e.alpha=="number"},_Ce=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},xCe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&typeof e.alpha=="number"};function C0(i){if(typeof i!="object")throw new al(8);if(gCe(i))return HR(i);if(mCe(i))return Fk(i);if(xCe(i))return ACe(i);if(_Ce(i))return pCe(i);throw new al(8)}function wne(i,e,t){return function(){var r=t.concat(Array.prototype.slice.call(arguments));return r.length>=e?i.apply(this,r):wne(i,e,r)}}function kl(i){return wne(i,i.length,[])}function yCe(i,e){if(e==="transparent")return e;var t=M0(e);return C0(Da({},t,{hue:t.hue+parseFloat(i)}))}var Fdt=kl(yCe);function tx(i,e,t){return Math.max(i,Math.min(e,t))}function vCe(i,e){if(e==="transparent")return e;var t=M0(e);return C0(Da({},t,{lightness:tx(0,1,t.lightness-parseFloat(i))}))}var Odt=kl(vCe);function bCe(i,e){if(e==="transparent")return e;var t=M0(e);return C0(Da({},t,{saturation:tx(0,1,t.saturation-parseFloat(i))}))}var Bdt=kl(bCe);function wCe(i,e){if(e==="transparent")return e;var t=M0(e);return C0(Da({},t,{lightness:tx(0,1,t.lightness+parseFloat(i))}))}var Udt=kl(wCe);function SCe(i,e,t){if(e==="transparent")return t;if(t==="transparent")return e;if(i===0)return t;var n=E0(e),r=Da({},n,{alpha:typeof n.alpha=="number"?n.alpha:1}),s=E0(t),o=Da({},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 HR(x)}var TCe=kl(SCe),Sne=TCe;function ECe(i,e){if(e==="transparent")return e;var t=E0(e),n=typeof t.alpha=="number"?t.alpha:1,r=Da({},t,{alpha:tx(0,1,(n*100+parseFloat(i)*100)/100)});return HR(r)}var MCe=kl(ECe),Tne=MCe;function CCe(i,e){if(e==="transparent")return e;var t=M0(e);return C0(Da({},t,{saturation:tx(0,1,t.saturation+parseFloat(i))}))}var kdt=kl(CCe);function RCe(i,e){return e==="transparent"?e:C0(Da({},M0(e),{hue:parseFloat(i)}))}var Gdt=kl(RCe);function PCe(i,e){return e==="transparent"?e:C0(Da({},M0(e),{lightness:parseFloat(i)}))}var zdt=kl(PCe);function ICe(i,e){return e==="transparent"?e:C0(Da({},M0(e),{saturation:parseFloat(i)}))}var Vdt=kl(ICe);function NCe(i,e){return e==="transparent"?e:Sne(parseFloat(i),"rgb(0, 0, 0)",e)}var qdt=kl(NCe);function LCe(i,e){return e==="transparent"?e:Sne(parseFloat(i),"rgb(255, 255, 255)",e)}var Hdt=kl(LCe);function DCe(i,e){if(e==="transparent")return e;var t=E0(e),n=typeof t.alpha=="number"?t.alpha:1,r=Da({},t,{alpha:tx(0,1,+(n*100-parseFloat(i)*100).toFixed(2)/100)});return HR(r)}var Wdt=kl(DCe);var WR="http://www.w3.org/1999/xhtml",Ok={svg:"http://www.w3.org/2000/svg",xhtml:WR,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function jR(i){var e=i+="",t=e.indexOf(":");return t>=0&&(e=i.slice(0,t))!=="xmlns"&&(i=i.slice(t+1)),Ok.hasOwnProperty(e)?{space:Ok[e],local:i}:i}function FCe(i){return function(){var e=this.ownerDocument,t=this.namespaceURI;return t===WR&&e.documentElement.namespaceURI===WR?e.createElement(i):e.createElementNS(t,i)}}function OCe(i){return function(){return this.ownerDocument.createElementNS(i.space,i.local)}}function XR(i){var e=jR(i);return(e.local?OCe:FCe)(e)}function BCe(){}function $R(i){return i==null?BCe:function(){return this.querySelector(i)}}function Ene(i){typeof i!="function"&&(i=$R(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 rs(n,this._parents)}function Bk(i){return i==null?[]:Array.isArray(i)?i:Array.from(i)}function UCe(){return[]}function Mne(i){return i==null?UCe:function(){return this.querySelectorAll(i)}}function kCe(i){return function(){return Bk(i.apply(this,arguments))}}function Cne(i){typeof i=="function"?i=kCe(i):i=Mne(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 rs(n,r)}function Rne(i){return function(){return this.matches(i)}}function YR(i){return function(e){return e.matches(i)}}var GCe=Array.prototype.find;function zCe(i){return function(){return GCe.call(this.children,i)}}function VCe(){return this.firstElementChild}function Pne(i){return this.select(i==null?VCe:zCe(typeof i=="function"?i:YR(i)))}var qCe=Array.prototype.filter;function HCe(){return Array.from(this.children)}function WCe(i){return function(){return qCe.call(this.children,i)}}function Ine(i){return this.selectAll(i==null?HCe:WCe(typeof i=="function"?i:YR(i)))}function Nne(i){typeof i!="function"&&(i=Rne(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 rs(n,this._parents)}function KR(i){return new Array(i.length)}function Lne(){return new rs(this._enter||this._groups.map(KR),this._parents)}function Ub(i,e){this.ownerDocument=i.ownerDocument,this.namespaceURI=i.namespaceURI,this._next=null,this._parent=i,this.__data__=e}Ub.prototype={constructor:Ub,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 Dne(i){return function(){return i}}function jCe(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 Ub(i,s[o]);for(;o<l;++o)(a=e[o])&&(r[o]=a)}function XCe(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 Ub(i,s[a]);for(a=0;a<u;++a)(l=e[a])&&c.get(p[a])===l&&(r[a]=l)}function $Ce(i){return i.__data__}function Fne(i,e){if(!arguments.length)return Array.from(this,$Ce);var t=e?XCe:jCe,n=this._parents,r=this._groups;typeof i!="function"&&(i=Dne(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=YCe(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 rs(o,n),o._enter=a,o._exit=l,o}function YCe(i){return typeof i=="object"&&"length"in i?i:Array.from(i)}function One(){return new rs(this._exit||this._groups.map(KR),this._parents)}function Bne(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 Une(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 rs(a,this._parents)}function kne(){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 Gne(i){i||(i=KCe);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 rs(r,this._parents).order()}function KCe(i,e){return i<e?-1:i>e?1:i>=e?0:NaN}function zne(){var i=arguments[0];return arguments[0]=this,i.apply(null,arguments),this}function Vne(){return Array.from(this)}function qne(){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 Hne(){let i=0;for(let e of this)++i;return i}function Wne(){return!this.node()}function jne(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 ZCe(i){return function(){this.removeAttribute(i)}}function QCe(i){return function(){this.removeAttributeNS(i.space,i.local)}}function JCe(i,e){return function(){this.setAttribute(i,e)}}function eRe(i,e){return function(){this.setAttributeNS(i.space,i.local,e)}}function tRe(i,e){return function(){var t=e.apply(this,arguments);t==null?this.removeAttribute(i):this.setAttribute(i,t)}}function nRe(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 Xne(i,e){var t=jR(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?QCe:ZCe:typeof e=="function"?t.local?nRe:tRe:t.local?eRe:JCe)(t,e))}function ZR(i){return i.ownerDocument&&i.ownerDocument.defaultView||i.document&&i||i.defaultView}function iRe(i){return function(){this.style.removeProperty(i)}}function rRe(i,e,t){return function(){this.style.setProperty(i,e,t)}}function sRe(i,e,t){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(i):this.style.setProperty(i,n,t)}}function $ne(i,e,t){return arguments.length>1?this.each((e==null?iRe:typeof e=="function"?sRe:rRe)(i,e,t??"")):oRe(this.node(),i)}function oRe(i,e){return i.style.getPropertyValue(e)||ZR(i).getComputedStyle(i,null).getPropertyValue(e)}function aRe(i){return function(){delete this[i]}}function lRe(i,e){return function(){this[i]=e}}function cRe(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?aRe:typeof e=="function"?cRe:lRe)(i,e)):this.node()[i]}function Kne(i){return i.trim().split(/^|\s+/)}function Uk(i){return i.classList||new Zne(i)}function Zne(i){this._node=i,this._names=Kne(i.getAttribute("class")||"")}Zne.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 Qne(i,e){for(var t=Uk(i),n=-1,r=e.length;++n<r;)t.add(e[n])}function Jne(i,e){for(var t=Uk(i),n=-1,r=e.length;++n<r;)t.remove(e[n])}function uRe(i){return function(){Qne(this,i)}}function hRe(i){return function(){Jne(this,i)}}function fRe(i,e){return function(){(e.apply(this,arguments)?Qne:Jne)(this,i)}}function eie(i,e){var t=Kne(i+"");if(arguments.length<2){for(var n=Uk(this.node()),r=-1,s=t.length;++r<s;)if(!n.contains(t[r]))return!1;return!0}return this.each((typeof e=="function"?fRe:e?uRe:hRe)(t,e))}function dRe(){this.textContent=""}function pRe(i){return function(){this.textContent=i}}function ARe(i){return function(){var e=i.apply(this,arguments);this.textContent=e??""}}function tie(i){return arguments.length?this.each(i==null?dRe:(typeof i=="function"?ARe:pRe)(i)):this.node().textContent}function mRe(){this.innerHTML=""}function gRe(i){return function(){this.innerHTML=i}}function _Re(i){return function(){var e=i.apply(this,arguments);this.innerHTML=e??""}}function nie(i){return arguments.length?this.each(i==null?mRe:(typeof i=="function"?_Re:gRe)(i)):this.node().innerHTML}function xRe(){this.nextSibling&&this.parentNode.appendChild(this)}function iie(){return this.each(xRe)}function yRe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function rie(){return this.each(yRe)}function sie(i){var e=typeof i=="function"?i:XR(i);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function vRe(){return null}function oie(i,e){var t=typeof i=="function"?i:XR(i),n=e==null?vRe:typeof e=="function"?e:$R(e);return this.select(function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)})}function bRe(){var i=this.parentNode;i&&i.removeChild(this)}function aie(){return this.each(bRe)}function wRe(){var i=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function SRe(){var i=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function lie(i){return this.select(i?SRe:wRe)}function cie(i){return arguments.length?this.property("__data__",i):this.node().__data__}function TRe(i){return function(e){i.call(this,e,this.__data__)}}function ERe(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 MRe(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 CRe(i,e,t){return function(){var n=this.__on,r,s=TRe(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 uie(i,e,t){var n=ERe(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?CRe:MRe,r=0;r<s;++r)this.each(a(n[r],e,t));return this}function hie(i,e,t){var n=ZR(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 RRe(i,e){return function(){return hie(this,i,e)}}function PRe(i,e){return function(){return hie(this,i,e.apply(this,arguments))}}function fie(i,e){return this.each((typeof e=="function"?PRe:RRe)(i,e))}function*die(){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 kk=[null];function rs(i,e){this._groups=i,this._parents=e}function IRe(){return new rs([[document.documentElement]],kk)}function NRe(){return this}rs.prototype=IRe.prototype={constructor:rs,select:Ene,selectAll:Cne,selectChild:Pne,selectChildren:Ine,filter:Nne,data:Fne,enter:Lne,exit:One,join:Bne,merge:Une,selection:NRe,order:kne,sort:Gne,call:zne,nodes:Vne,node:qne,size:Hne,empty:Wne,each:jne,attr:Xne,style:$ne,property:Yne,classed:eie,text:tie,html:nie,raise:iie,lower:rie,append:sie,insert:oie,remove:aie,clone:lie,datum:cie,on:uie,dispatch:fie,[Symbol.iterator]:die};function Gk(i){return typeof i=="string"?new rs([[document.querySelector(i)]],[document.documentElement]):new rs([[i]],kk)}function pie(i){let e;for(;e=i.sourceEvent;)i=e;return i}function zk(i,e){if(i=pie(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 zb,Mr,xie,Wk,R0,Aie,yie,vie,Vk,JR,kb,bie,jk,qk,Hk,LRe,t4={},n4=[],DRe=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,r4=Array.isArray;function $h(i,e){for(var t in e)i[t]=e[t];return i}function Xk(i){i&&i.parentNode&&i.parentNode.removeChild(i)}function FRe(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?zb.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 Gb(i,o,n,r,null)}function Gb(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??++xie,__i:-1,__u:0};return r==null&&Mr.vnode!=null&&Mr.vnode(s),s}function s4(i){return i.children}function e4(i,e){this.props=i,this.context=e}function ng(i,e){if(e==null)return i.__?ng(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"?ng(i):null}function ORe(i){if(i.__P&&i.__d){var e=i.__v,t=e.__e,n=[],r=[],s=$h({},e);s.__v=e.__v+1,Mr.vnode&&Mr.vnode(s),$k(i.__P,s,e,i.__n,i.__P.namespaceURI,32&e.__u?[t]:null,n,t??ng(e),!!(32&e.__u),r),s.__v=e.__v,s.__.__k[s.__i]=s,Mie(n,s,r),e.__e=e.__=null,s.__e!=t&&wie(s)}}function wie(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}),wie(i)}function mie(i){(!i.__d&&(i.__d=!0)&&R0.push(i)&&!i4.__r++||Aie!=Mr.debounceRendering)&&((Aie=Mr.debounceRendering)||yie)(i4)}function i4(){try{for(var i,e=1;R0.length;)R0.length>e&&R0.sort(vie),i=R0.shift(),e=R0.length,ORe(i)}finally{R0.length=i4.__r=0}}function Sie(i,e,t,n,r,s,o,a,l,c,u){var f,p,x,v,w,S,T=n&&n.__k||n4,P=e.length;for(l=BRe(t,e,T,l,P),f=0;f<P;f++)(x=t.__k[f])!=null&&(p=x.__i!=-1&&T[x.__i]||t4,x.__i=f,S=$k(i,x,p,r,s,o,a,l,c,u),v=x.__e,x.ref&&p.ref!=x.ref&&(p.ref&&Yk(p.ref,null,x),u.push(x.ref,x.__c||v,x)),w==null&&v!=null&&(w=v),4&x.__u?(l=Tie(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 BRe(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]=Gb(null,o,null,null,null):r4(o)?o=i.__k[s]=Gb(s4,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=i.__k[s]=Gb(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=URe(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=ng(a)),Rie(a,a));return n}function Tie(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=Tie(n[r],e,t));return e}i.__e!=e&&(e&&i.type&&!e.parentNode&&(e=ng(i)),e=t.insertBefore(i.__e,e||null));do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function URe(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 gie(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||DRe.test(e)?t:t+"px"}function QR(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||gie(i.style,e,"");if(t)for(e in t)n&&t[e]==n[e]||gie(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(bie,"$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[kb]=n[kb]:(t[kb]=jk,i.addEventListener(e,s?Hk:qk,s)):i.removeEventListener(e,s?Hk:qk,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 _ie(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e[JR]==null)e[JR]=jk++;else if(e[JR]<t[kb])return;return t(Mr.event?Mr.event(e):e)}}}function $k(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=Mr.__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 e4(P,L),p.constructor=z,p.render=GRe),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=$h({},p.__s)),$h(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)}),n4.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&o.push(p),a=ng(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=Mr.__r,F=0,R)p.state=p.__s,p.__d=!1,D&&D(e),u=p.render(p.props,p.state,p.context),n4.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=$h($h({},n),p.getChildContext())),R&&!x&&p.getSnapshotBeforeUpdate!=null&&(S=p.getSnapshotBeforeUpdate(v,w)),N=u!=null&&u.type===s4&&u.key==null?Cie(u.props.children):u,a=Sie(i,r4(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--;)Xk(s[B])}else e.__e=t.__e;e.__k==null&&(e.__k=t.__k||[]),V.then||Eie(e),Mr.__e(V,e,t)}}else s==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=kRe(t.__e,e,t,n,r,s,o,l,c);return(u=Mr.diffed)&&u(e),128&e.__u?void 0:a}function Eie(i){i&&(i.__c&&(i.__c.__e=!0),i.__k&&i.__k.some(Eie))}function Mie(i,e,t){for(var n=0;n<t.length;n++)Yk(t[n],t[++n],t[++n]);Mr.__c&&Mr.__c(e,i),i.some(function(r){try{i=r.__h,r.__h=[],i.some(function(s){s.call(r)})}catch(s){Mr.__e(s,r.__v)}})}function Cie(i){return typeof i!="object"||i==null||i.__b>0?i:r4(i)?i.map(Cie):i.constructor!==void 0?null:$h({},i)}function kRe(i,e,t,n,r,s,o,a,l){var c,u,f,p,x,v,w,S=t.props||t4,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&&(Mr.__m&&Mr.__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&&zb.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||QR(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||QR(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=""),Sie(e.type=="template"?i.content:i,r4(p)?p:[p],e,t,n,P=="foreignObject"?"http://www.w3.org/1999/xhtml":r,s,o,s?s[0]:t.__k&&ng(t,0),a,l),s!=null)for(c=s.length;c--;)Xk(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])&&QR(i,c,v,S[c],r),c="checked",w!=null&&w!=i[c]&&QR(i,c,w,S[c],r))}return i}function Yk(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){Mr.__e(r,t)}}function Rie(i,e,t){var n,r;if(Mr.unmount&&Mr.unmount(i),(n=i.ref)&&(n.current&&n.current!=i.__e||Yk(n,null,e)),(n=i.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){Mr.__e(s,e)}n.base=n.__P=n.__n=null}if(n=i.__k)for(r=0;r<n.length;r++)n[r]&&Rie(n[r],e,t||typeof i.type!="function");t||Xk(i.__e),i.__c=i.__=i.__e=void 0}function GRe(i,e,t){return this.constructor(i,t)}function Pie(i,e,t){var n,r,s,o;e==document&&(e=document.documentElement),Mr.__&&Mr.__(i,e),r=(n=typeof t=="function")?null:t&&t.__k||e.__k,s=[],o=[],$k(e,i=(!n&&t||e).__k=FRe(s4,null,[i]),r||t4,t4,e.namespaceURI,!n&&t?[t]:r?null:e.firstChild?zb.call(e.childNodes):null,s,!n&&t?t:r?r.__e:e.firstChild,n,o),Mie(s,i,o),i.props.children=null}function Kk(i,e,t){var n,r,s,o,a=$h({},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?zb.call(arguments,2):t),Gb(i.type,a,n||i.key,r||i.ref,null)}zb=n4.slice,Mr={__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}},xie=0,Wk=function(i){return i!=null&&i.constructor===void 0},e4.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=$h({},this.state),typeof i=="function"&&(i=i($h({},t),this.props)),i&&$h(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),mie(this))},e4.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),mie(this))},e4.prototype.render=s4,R0=[],yie=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,vie=function(i,e){return i.__v.__b-e.__v.__b},i4.__r=0,Vk=Math.random().toString(8),JR="__d"+Vk,kb="__a"+Vk,bie=/(PointerCapture)$|Capture$/i,jk=0,qk=_ie(!1),Hk=_ie(!0),LRe=0;function Iie(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 zRe(i){if(Array.isArray(i))return i}function VRe(i,e,t){return(e=$Re(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function qRe(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 HRe(){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 Nie(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 WRe(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Nie(Object(t),!0).forEach(function(n){VRe(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Nie(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function jRe(i,e){return zRe(i)||qRe(i,e)||YRe(i,e)||HRe()}function XRe(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 $Re(i){var e=XRe(i,"string");return typeof e=="symbol"?e:e+""}function o4(i){"@babel/helpers - typeof";return o4=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},o4(i)}function YRe(i,e){if(i){if(typeof i=="string")return Iie(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)?Iie(i,e):void 0}}var Zk=function(e){if(o4(e)!=="object")return e;var t=Kk(e);if(t.props){var n;t.props=WRe({},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(Zk):Zk(t.props.children))}return t},KRe=function(e){return Wk(Kk(e))},ZRe=function(e,t){delete t.__k,Pie(Zk(e),t)};function QRe(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 JRe=`.float-tooltip-kap {5257+ }`};var ld=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(){}},nCe=new jc(-1,1,1,-1,0,1),Pk=class extends qn{constructor(){super(),this.setAttribute("position",new Rn([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Rn([0,2,0,0,2,0],2))}},iCe=new Pk,BR=class{constructor(e){this._mesh=new Gn(iCe,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,nCe)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}};var UR=class extends ld{constructor(e,t="tDiffuse"){super(),this.textureID=t,this.uniforms=null,this.material=null,e instanceof Zr?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=QA.clone(e.uniforms),this.material=new Zr({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 BR(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 Ub=class extends ld{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)}},kR=class extends ld{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}};var GR=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 pa(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Fi}),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 UR(mne),this.copyPass.material.blending=Qr,this.timer=new kA}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()}Ub!==void 0&&(o instanceof Ub?n=!0:o instanceof kR&&(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 zR=class extends ld{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 Da(){return Da=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},Da.apply(null,arguments)}function gne(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function T0(i,e){return T0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},T0(i,e)}function _ne(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i,T0(i,e)}function VR(i){return VR=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},VR(i)}function xne(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 yne(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&&T0(r,t.prototype),r}function qR(i){var e=typeof Map=="function"?new Map:void 0;return qR=function(n){if(n===null||!xne(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 yne(n,arguments,VR(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),T0(r,n)},qR(i)}var al=(function(i){_ne(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 gne(n)}return e})(qR(Error));function vne(i,e){return i.substr(-e.length)===e}var rCe=/^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/;function bne(i){if(typeof i!="string")return i;var e=i.match(rCe);return e?parseFloat(i):i}var sCe=function(e){return function(t,n){n===void 0&&(n="16px");var r=t,s=n;if(typeof t=="string"){if(!vne(t,"px"))throw new al(69,e,t);r=bne(t)}if(typeof n=="string"){if(!vne(n,"px"))throw new al(70,e,n);s=bne(n)}if(typeof r=="string")throw new al(71,t,e);if(typeof s=="string")throw new al(72,n,e);return""+r/s+e}},Sne=sCe,Udt=Sne("em");var kdt=Sne("rem");function Nk(i){return Math.round(i*255)}function oCe(i,e,t){return Nk(i)+","+Nk(e)+","+Nk(t)}function kb(i,e,t,n){if(n===void 0&&(n=oCe),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 wne={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 aCe(i){if(typeof i!="string")return i;var e=i.toLowerCase();return wne[e]?"#"+wne[e]:i}var lCe=/^#[a-fA-F0-9]{6}$/,cCe=/^#[a-fA-F0-9]{8}$/,uCe=/^#[a-fA-F0-9]{3}$/,hCe=/^#[a-fA-F0-9]{4}$/,Lk=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,fCe=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,dCe=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,pCe=/^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 E0(i){if(typeof i!="string")throw new al(3);var e=aCe(i);if(e.match(lCe))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(cCe)){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(uCe))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(hCe)){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=Lk.exec(e);if(r)return{red:parseInt(""+r[1],10),green:parseInt(""+r[2],10),blue:parseInt(""+r[3],10)};var s=fCe.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=dCe.exec(e);if(o){var a=parseInt(""+o[1],10),l=parseInt(""+o[2],10)/100,c=parseInt(""+o[3],10)/100,u="rgb("+kb(a,l,c)+")",f=Lk.exec(u);if(!f)throw new al(4,e,u);return{red:parseInt(""+f[1],10),green:parseInt(""+f[2],10),blue:parseInt(""+f[3],10)}}var p=pCe.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("+kb(x,v,w)+")",T=Lk.exec(S);if(!T)throw new al(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 al(5)}function ACe(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 M0(i){return ACe(E0(i))}var mCe=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},Fk=mCe;function tg(i){var e=i.toString(16);return e.length===1?"0"+e:e}function Dk(i){return tg(Math.round(i*255))}function gCe(i,e,t){return Fk("#"+Dk(i)+Dk(e)+Dk(t))}function HR(i,e,t){return kb(i,e,t,gCe)}function _Ce(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return HR(i,e,t);if(typeof i=="object"&&e===void 0&&t===void 0)return HR(i.hue,i.saturation,i.lightness);throw new al(1)}function xCe(i,e,t,n){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number"&&typeof n=="number")return n>=1?HR(i,e,t):"rgba("+kb(i,e,t)+","+n+")";if(typeof i=="object"&&e===void 0&&t===void 0&&n===void 0)return i.alpha>=1?HR(i.hue,i.saturation,i.lightness):"rgba("+kb(i.hue,i.saturation,i.lightness)+","+i.alpha+")";throw new al(2)}function Ok(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return Fk("#"+tg(i)+tg(e)+tg(t));if(typeof i=="object"&&e===void 0&&t===void 0)return Fk("#"+tg(i.red)+tg(i.green)+tg(i.blue));throw new al(6)}function WR(i,e,t,n){if(typeof i=="string"&&typeof e=="number"){var r=E0(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?Ok(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?Ok(i.red,i.green,i.blue):"rgba("+i.red+","+i.green+","+i.blue+","+i.alpha+")"}throw new al(7)}var yCe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},vCe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&typeof e.alpha=="number"},bCe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},wCe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&typeof e.alpha=="number"};function C0(i){if(typeof i!="object")throw new al(8);if(vCe(i))return WR(i);if(yCe(i))return Ok(i);if(wCe(i))return xCe(i);if(bCe(i))return _Ce(i);throw new al(8)}function Tne(i,e,t){return function(){var r=t.concat(Array.prototype.slice.call(arguments));return r.length>=e?i.apply(this,r):Tne(i,e,r)}}function kl(i){return Tne(i,i.length,[])}function SCe(i,e){if(e==="transparent")return e;var t=M0(e);return C0(Da({},t,{hue:t.hue+parseFloat(i)}))}var Gdt=kl(SCe);function nx(i,e,t){return Math.max(i,Math.min(e,t))}function TCe(i,e){if(e==="transparent")return e;var t=M0(e);return C0(Da({},t,{lightness:nx(0,1,t.lightness-parseFloat(i))}))}var zdt=kl(TCe);function ECe(i,e){if(e==="transparent")return e;var t=M0(e);return C0(Da({},t,{saturation:nx(0,1,t.saturation-parseFloat(i))}))}var Vdt=kl(ECe);function MCe(i,e){if(e==="transparent")return e;var t=M0(e);return C0(Da({},t,{lightness:nx(0,1,t.lightness+parseFloat(i))}))}var qdt=kl(MCe);function CCe(i,e,t){if(e==="transparent")return t;if(t==="transparent")return e;if(i===0)return t;var n=E0(e),r=Da({},n,{alpha:typeof n.alpha=="number"?n.alpha:1}),s=E0(t),o=Da({},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 WR(x)}var RCe=kl(CCe),Ene=RCe;function PCe(i,e){if(e==="transparent")return e;var t=E0(e),n=typeof t.alpha=="number"?t.alpha:1,r=Da({},t,{alpha:nx(0,1,(n*100+parseFloat(i)*100)/100)});return WR(r)}var ICe=kl(PCe),Mne=ICe;function NCe(i,e){if(e==="transparent")return e;var t=M0(e);return C0(Da({},t,{saturation:nx(0,1,t.saturation+parseFloat(i))}))}var Hdt=kl(NCe);function LCe(i,e){return e==="transparent"?e:C0(Da({},M0(e),{hue:parseFloat(i)}))}var Wdt=kl(LCe);function DCe(i,e){return e==="transparent"?e:C0(Da({},M0(e),{lightness:parseFloat(i)}))}var jdt=kl(DCe);function FCe(i,e){return e==="transparent"?e:C0(Da({},M0(e),{saturation:parseFloat(i)}))}var Xdt=kl(FCe);function OCe(i,e){return e==="transparent"?e:Ene(parseFloat(i),"rgb(0, 0, 0)",e)}var $dt=kl(OCe);function BCe(i,e){return e==="transparent"?e:Ene(parseFloat(i),"rgb(255, 255, 255)",e)}var Ydt=kl(BCe);function UCe(i,e){if(e==="transparent")return e;var t=E0(e),n=typeof t.alpha=="number"?t.alpha:1,r=Da({},t,{alpha:nx(0,1,+(n*100-parseFloat(i)*100).toFixed(2)/100)});return WR(r)}var Kdt=kl(UCe);var jR="http://www.w3.org/1999/xhtml",Bk={svg:"http://www.w3.org/2000/svg",xhtml:jR,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function XR(i){var e=i+="",t=e.indexOf(":");return t>=0&&(e=i.slice(0,t))!=="xmlns"&&(i=i.slice(t+1)),Bk.hasOwnProperty(e)?{space:Bk[e],local:i}:i}function kCe(i){return function(){var e=this.ownerDocument,t=this.namespaceURI;return t===jR&&e.documentElement.namespaceURI===jR?e.createElement(i):e.createElementNS(t,i)}}function GCe(i){return function(){return this.ownerDocument.createElementNS(i.space,i.local)}}function $R(i){var e=XR(i);return(e.local?GCe:kCe)(e)}function zCe(){}function YR(i){return i==null?zCe:function(){return this.querySelector(i)}}function Cne(i){typeof i!="function"&&(i=YR(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 ss(n,this._parents)}function Uk(i){return i==null?[]:Array.isArray(i)?i:Array.from(i)}function VCe(){return[]}function Rne(i){return i==null?VCe:function(){return this.querySelectorAll(i)}}function qCe(i){return function(){return Uk(i.apply(this,arguments))}}function Pne(i){typeof i=="function"?i=qCe(i):i=Rne(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 ss(n,r)}function Ine(i){return function(){return this.matches(i)}}function KR(i){return function(e){return e.matches(i)}}var HCe=Array.prototype.find;function WCe(i){return function(){return HCe.call(this.children,i)}}function jCe(){return this.firstElementChild}function Nne(i){return this.select(i==null?jCe:WCe(typeof i=="function"?i:KR(i)))}var XCe=Array.prototype.filter;function $Ce(){return Array.from(this.children)}function YCe(i){return function(){return XCe.call(this.children,i)}}function Lne(i){return this.selectAll(i==null?$Ce:YCe(typeof i=="function"?i:KR(i)))}function Dne(i){typeof i!="function"&&(i=Ine(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 ss(n,this._parents)}function ZR(i){return new Array(i.length)}function Fne(){return new ss(this._enter||this._groups.map(ZR),this._parents)}function Gb(i,e){this.ownerDocument=i.ownerDocument,this.namespaceURI=i.namespaceURI,this._next=null,this._parent=i,this.__data__=e}Gb.prototype={constructor:Gb,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 One(i){return function(){return i}}function KCe(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 Gb(i,s[o]);for(;o<l;++o)(a=e[o])&&(r[o]=a)}function ZCe(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 Gb(i,s[a]);for(a=0;a<u;++a)(l=e[a])&&c.get(p[a])===l&&(r[a]=l)}function QCe(i){return i.__data__}function Bne(i,e){if(!arguments.length)return Array.from(this,QCe);var t=e?ZCe:KCe,n=this._parents,r=this._groups;typeof i!="function"&&(i=One(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=JCe(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 R=0,P=0,C,L;R<v;++R)if(C=w[R]){for(R>=P&&(P=R+1);!(L=S[P])&&++P<v;);C._next=L||null}}return o=new ss(o,n),o._enter=a,o._exit=l,o}function JCe(i){return typeof i=="object"&&"length"in i?i:Array.from(i)}function Une(){return new ss(this._exit||this._groups.map(ZR),this._parents)}function kne(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 Gne(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 ss(a,this._parents)}function zne(){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 Vne(i){i||(i=eRe);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 ss(r,this._parents).order()}function eRe(i,e){return i<e?-1:i>e?1:i>=e?0:NaN}function qne(){var i=arguments[0];return arguments[0]=this,i.apply(null,arguments),this}function Hne(){return Array.from(this)}function Wne(){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 jne(){let i=0;for(let e of this)++i;return i}function Xne(){return!this.node()}function $ne(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 tRe(i){return function(){this.removeAttribute(i)}}function nRe(i){return function(){this.removeAttributeNS(i.space,i.local)}}function iRe(i,e){return function(){this.setAttribute(i,e)}}function rRe(i,e){return function(){this.setAttributeNS(i.space,i.local,e)}}function sRe(i,e){return function(){var t=e.apply(this,arguments);t==null?this.removeAttribute(i):this.setAttribute(i,t)}}function oRe(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=XR(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?nRe:tRe:typeof e=="function"?t.local?oRe:sRe:t.local?rRe:iRe)(t,e))}function QR(i){return i.ownerDocument&&i.ownerDocument.defaultView||i.document&&i||i.defaultView}function aRe(i){return function(){this.style.removeProperty(i)}}function lRe(i,e,t){return function(){this.style.setProperty(i,e,t)}}function cRe(i,e,t){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(i):this.style.setProperty(i,n,t)}}function Kne(i,e,t){return arguments.length>1?this.each((e==null?aRe:typeof e=="function"?cRe:lRe)(i,e,t??"")):uRe(this.node(),i)}function uRe(i,e){return i.style.getPropertyValue(e)||QR(i).getComputedStyle(i,null).getPropertyValue(e)}function hRe(i){return function(){delete this[i]}}function fRe(i,e){return function(){this[i]=e}}function dRe(i,e){return function(){var t=e.apply(this,arguments);t==null?delete this[i]:this[i]=t}}function Zne(i,e){return arguments.length>1?this.each((e==null?hRe:typeof e=="function"?dRe:fRe)(i,e)):this.node()[i]}function Qne(i){return i.trim().split(/^|\s+/)}function kk(i){return i.classList||new Jne(i)}function Jne(i){this._node=i,this._names=Qne(i.getAttribute("class")||"")}Jne.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 eie(i,e){for(var t=kk(i),n=-1,r=e.length;++n<r;)t.add(e[n])}function tie(i,e){for(var t=kk(i),n=-1,r=e.length;++n<r;)t.remove(e[n])}function pRe(i){return function(){eie(this,i)}}function ARe(i){return function(){tie(this,i)}}function mRe(i,e){return function(){(e.apply(this,arguments)?eie:tie)(this,i)}}function nie(i,e){var t=Qne(i+"");if(arguments.length<2){for(var n=kk(this.node()),r=-1,s=t.length;++r<s;)if(!n.contains(t[r]))return!1;return!0}return this.each((typeof e=="function"?mRe:e?pRe:ARe)(t,e))}function gRe(){this.textContent=""}function _Re(i){return function(){this.textContent=i}}function xRe(i){return function(){var e=i.apply(this,arguments);this.textContent=e??""}}function iie(i){return arguments.length?this.each(i==null?gRe:(typeof i=="function"?xRe:_Re)(i)):this.node().textContent}function yRe(){this.innerHTML=""}function vRe(i){return function(){this.innerHTML=i}}function bRe(i){return function(){var e=i.apply(this,arguments);this.innerHTML=e??""}}function rie(i){return arguments.length?this.each(i==null?yRe:(typeof i=="function"?bRe:vRe)(i)):this.node().innerHTML}function wRe(){this.nextSibling&&this.parentNode.appendChild(this)}function sie(){return this.each(wRe)}function SRe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function oie(){return this.each(SRe)}function aie(i){var e=typeof i=="function"?i:$R(i);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function TRe(){return null}function lie(i,e){var t=typeof i=="function"?i:$R(i),n=e==null?TRe:typeof e=="function"?e:YR(e);return this.select(function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)})}function ERe(){var i=this.parentNode;i&&i.removeChild(this)}function cie(){return this.each(ERe)}function MRe(){var i=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function CRe(){var i=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function uie(i){return this.select(i?CRe:MRe)}function hie(i){return arguments.length?this.property("__data__",i):this.node().__data__}function RRe(i){return function(e){i.call(this,e,this.__data__)}}function PRe(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 IRe(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 NRe(i,e,t){return function(){var n=this.__on,r,s=RRe(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 fie(i,e,t){var n=PRe(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?NRe:IRe,r=0;r<s;++r)this.each(a(n[r],e,t));return this}function die(i,e,t){var n=QR(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 LRe(i,e){return function(){return die(this,i,e)}}function DRe(i,e){return function(){return die(this,i,e.apply(this,arguments))}}function pie(i,e){return this.each((typeof e=="function"?DRe:LRe)(i,e))}function*Aie(){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 Gk=[null];function ss(i,e){this._groups=i,this._parents=e}function FRe(){return new ss([[document.documentElement]],Gk)}function ORe(){return this}ss.prototype=FRe.prototype={constructor:ss,select:Cne,selectAll:Pne,selectChild:Nne,selectChildren:Lne,filter:Dne,data:Bne,enter:Fne,exit:Une,join:kne,merge:Gne,selection:ORe,order:zne,sort:Vne,call:qne,nodes:Hne,node:Wne,size:jne,empty:Xne,each:$ne,attr:Yne,style:Kne,property:Zne,classed:nie,text:iie,html:rie,raise:sie,lower:oie,append:aie,insert:lie,remove:cie,clone:uie,datum:hie,on:fie,dispatch:pie,[Symbol.iterator]:Aie};function zk(i){return typeof i=="string"?new ss([[document.querySelector(i)]],[document.documentElement]):new ss([[i]],Gk)}function mie(i){let e;for(;e=i.sourceEvent;)i=e;return i}function Vk(i,e){if(i=mie(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 qb,Mr,vie,jk,R0,gie,bie,wie,qk,e4,zb,Sie,Xk,Hk,Wk,BRe,n4={},i4=[],URe=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,s4=Array.isArray;function $h(i,e){for(var t in e)i[t]=e[t];return i}function $k(i){i&&i.parentNode&&i.parentNode.removeChild(i)}function kRe(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?qb.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 Vb(i,o,n,r,null)}function Vb(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??++vie,__i:-1,__u:0};return r==null&&Mr.vnode!=null&&Mr.vnode(s),s}function o4(i){return i.children}function t4(i,e){this.props=i,this.context=e}function ng(i,e){if(e==null)return i.__?ng(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"?ng(i):null}function GRe(i){if(i.__P&&i.__d){var e=i.__v,t=e.__e,n=[],r=[],s=$h({},e);s.__v=e.__v+1,Mr.vnode&&Mr.vnode(s),Yk(i.__P,s,e,i.__n,i.__P.namespaceURI,32&e.__u?[t]:null,n,t??ng(e),!!(32&e.__u),r),s.__v=e.__v,s.__.__k[s.__i]=s,Rie(n,s,r),e.__e=e.__=null,s.__e!=t&&Tie(s)}}function Tie(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}),Tie(i)}function _ie(i){(!i.__d&&(i.__d=!0)&&R0.push(i)&&!r4.__r++||gie!=Mr.debounceRendering)&&((gie=Mr.debounceRendering)||bie)(r4)}function r4(){try{for(var i,e=1;R0.length;)R0.length>e&&R0.sort(wie),i=R0.shift(),e=R0.length,GRe(i)}finally{R0.length=r4.__r=0}}function Eie(i,e,t,n,r,s,o,a,l,c,u){var f,p,x,v,w,S,T=n&&n.__k||i4,R=e.length;for(l=zRe(t,e,T,l,R),f=0;f<R;f++)(x=t.__k[f])!=null&&(p=x.__i!=-1&&T[x.__i]||n4,x.__i=f,S=Yk(i,x,p,r,s,o,a,l,c,u),v=x.__e,x.ref&&p.ref!=x.ref&&(p.ref&&Kk(p.ref,null,x),u.push(x.ref,x.__c||v,x)),w==null&&v!=null&&(w=v),4&x.__u?(l=Mie(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 zRe(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]=Vb(null,o,null,null,null):s4(o)?o=i.__k[s]=Vb(o4,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=i.__k[s]=Vb(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=VRe(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=ng(a)),Iie(a,a));return n}function Mie(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=Mie(n[r],e,t));return e}i.__e!=e&&(e&&i.type&&!e.parentNode&&(e=ng(i)),e=t.insertBefore(i.__e,e||null));do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function VRe(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 xie(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||URe.test(e)?t:t+"px"}function JR(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||xie(i.style,e,"");if(t)for(e in t)n&&t[e]==n[e]||xie(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(Sie,"$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[zb]=n[zb]:(t[zb]=Xk,i.addEventListener(e,s?Wk:Hk,s)):i.removeEventListener(e,s?Wk:Hk,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 yie(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e[e4]==null)e[e4]=Xk++;else if(e[e4]<t[zb])return;return t(Mr.event?Mr.event(e):e)}}}function Yk(i,e,t,n,r,s,o,a,l,c){var u,f,p,x,v,w,S,T,R,P,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=Mr.__b)&&u(e);e:if(typeof z=="function"){f=o.length;try{if(R=e.props,P=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:(P?e.__c=p=new z(R,L):(e.__c=p=new t4(R,L),p.constructor=z,p.render=HRe),C&&C.sub(p),p.state||(p.state={}),p.__n=n,x=p.__d=!0,p.__h=[],p._sb=[]),P&&p.__s==null&&(p.__s=p.state),P&&z.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=$h({},p.__s)),$h(p.__s,z.getDerivedStateFromProps(R,p.__s))),v=p.props,w=p.state,p.__v=e,x)P&&z.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),P&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(P&&z.getDerivedStateFromProps==null&&R!==v&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(R,L),e.__v==t.__v||!p.__e&&p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(R,p.__s,L)===!1){e.__v!=t.__v&&(p.props=R,p.state=p.__s,p.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(V){V&&(V.__=e)}),i4.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&o.push(p),a=ng(t);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(R,p.__s,L),P&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(v,w,S)})}if(p.context=L,p.props=R,p.__P=i,p.__e=!1,D=Mr.__r,F=0,P)p.state=p.__s,p.__d=!1,D&&D(e),u=p.render(p.props,p.state,p.context),i4.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=$h($h({},n),p.getChildContext())),P&&!x&&p.getSnapshotBeforeUpdate!=null&&(S=p.getSnapshotBeforeUpdate(v,w)),N=u!=null&&u.type===o4&&u.key==null?Pie(u.props.children):u,a=Eie(i,s4(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--;)$k(s[B])}else e.__e=t.__e;e.__k==null&&(e.__k=t.__k||[]),V.then||Cie(e),Mr.__e(V,e,t)}}else s==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=qRe(t.__e,e,t,n,r,s,o,l,c);return(u=Mr.diffed)&&u(e),128&e.__u?void 0:a}function Cie(i){i&&(i.__c&&(i.__c.__e=!0),i.__k&&i.__k.some(Cie))}function Rie(i,e,t){for(var n=0;n<t.length;n++)Kk(t[n],t[++n],t[++n]);Mr.__c&&Mr.__c(e,i),i.some(function(r){try{i=r.__h,r.__h=[],i.some(function(s){s.call(r)})}catch(s){Mr.__e(s,r.__v)}})}function Pie(i){return typeof i!="object"||i==null||i.__b>0?i:s4(i)?i.map(Pie):i.constructor!==void 0?null:$h({},i)}function qRe(i,e,t,n,r,s,o,a,l){var c,u,f,p,x,v,w,S=t.props||n4,T=e.props,R=e.type;if(R=="svg"?r="http://www.w3.org/2000/svg":R=="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==!!R&&(R?x.localName==R:x.nodeType==3)){i=x,s[c]=null;break}}if(i==null){if(R==null)return document.createTextNode(T);i=document.createElementNS(r,R,T.is&&T),a&&(Mr.__m&&Mr.__m(e,s),a=!1),s=null}if(R==null)S===T||a&&i.data==T||(i.data=T);else{if(s=R=="textarea"&&T.defaultValue!=null?null:s&&qb.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||JR(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||JR(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=""),Eie(e.type=="template"?i.content:i,s4(p)?p:[p],e,t,n,R=="foreignObject"?"http://www.w3.org/1999/xhtml":r,s,o,s?s[0]:t.__k&&ng(t,0),a,l),s!=null)for(c=s.length;c--;)$k(s[c]);a&&R!="textarea"||(c="value",R=="progress"&&v==null?i.removeAttribute("value"):v!=null&&(v!==i[c]||R=="progress"&&!v||R=="option"&&v!=S[c])&&JR(i,c,v,S[c],r),c="checked",w!=null&&w!=i[c]&&JR(i,c,w,S[c],r))}return i}function Kk(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){Mr.__e(r,t)}}function Iie(i,e,t){var n,r;if(Mr.unmount&&Mr.unmount(i),(n=i.ref)&&(n.current&&n.current!=i.__e||Kk(n,null,e)),(n=i.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){Mr.__e(s,e)}n.base=n.__P=n.__n=null}if(n=i.__k)for(r=0;r<n.length;r++)n[r]&&Iie(n[r],e,t||typeof i.type!="function");t||$k(i.__e),i.__c=i.__=i.__e=void 0}function HRe(i,e,t){return this.constructor(i,t)}function Nie(i,e,t){var n,r,s,o;e==document&&(e=document.documentElement),Mr.__&&Mr.__(i,e),r=(n=typeof t=="function")?null:t&&t.__k||e.__k,s=[],o=[],Yk(e,i=(!n&&t||e).__k=kRe(o4,null,[i]),r||n4,n4,e.namespaceURI,!n&&t?[t]:r?null:e.firstChild?qb.call(e.childNodes):null,s,!n&&t?t:r?r.__e:e.firstChild,n,o),Rie(s,i,o),i.props.children=null}function Zk(i,e,t){var n,r,s,o,a=$h({},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?qb.call(arguments,2):t),Vb(i.type,a,n||i.key,r||i.ref,null)}qb=i4.slice,Mr={__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}},vie=0,jk=function(i){return i!=null&&i.constructor===void 0},t4.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=$h({},this.state),typeof i=="function"&&(i=i($h({},t),this.props)),i&&$h(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),_ie(this))},t4.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),_ie(this))},t4.prototype.render=o4,R0=[],bie=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,wie=function(i,e){return i.__v.__b-e.__v.__b},r4.__r=0,qk=Math.random().toString(8),e4="__d"+qk,zb="__a"+qk,Sie=/(PointerCapture)$|Capture$/i,Xk=0,Hk=yie(!1),Wk=yie(!0),BRe=0;function Lie(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 WRe(i){if(Array.isArray(i))return i}function jRe(i,e,t){return(e=QRe(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function XRe(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 $Re(){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 Die(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 YRe(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Die(Object(t),!0).forEach(function(n){jRe(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Die(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function KRe(i,e){return WRe(i)||XRe(i,e)||JRe(i,e)||$Re()}function ZRe(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 QRe(i){var e=ZRe(i,"string");return typeof e=="symbol"?e:e+""}function a4(i){"@babel/helpers - typeof";return a4=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},a4(i)}function JRe(i,e){if(i){if(typeof i=="string")return Lie(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)?Lie(i,e):void 0}}var Qk=function(e){if(a4(e)!=="object")return e;var t=Zk(e);if(t.props){var n;t.props=YRe({},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(Qk):Qk(t.props.children))}return t},e4e=function(e){return jk(Zk(e))},t4e=function(e,t){delete t.__k,Nie(Qk(e),t)};function n4e(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 i4e=`.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-`;QRe(JRe);var Lie=Or({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&&o4(e)==="object"&&!!e.node&&typeof e.node=="function",a=Gk(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=jRe(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=zk(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):KRe(e.content)?(e.tooltipEl.text(""),ZRe(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 e4e(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 t4e=`.scene-nav-info {5269+`;n4e(i4e);var Fie=Or({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&&a4(e)==="object"&&!!e.node&&typeof e.node=="function",a=zk(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=KRe(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=Vk(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):e4e(e.content)?(e.tooltipEl.text(""),t4e(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 r4e(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 s4e=`.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-}`;e4e(t4e);function Qk(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 n4e(i){if(Array.isArray(i))return i}function i4e(i){if(Array.isArray(i))return Qk(i)}function r4e(i,e,t){return(e=h4e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function s4e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function o4e(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 a4e(){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 l4e(){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 c4e(i,e){return n4e(i)||o4e(i,e)||Die(i,e)||a4e()}function ig(i){return i4e(i)||s4e(i)||Die(i)||l4e()}function u4e(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 h4e(i){var e=u4e(i,"string");return typeof e=="symbol"?e:e+""}function Die(i,e){if(i){if(typeof i=="string")return Qk(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)?Qk(i,e):void 0}}var Fie=function(e){e instanceof Array?e.forEach(Fie):(e.map&&e.map.dispose(),e.dispose())},Oie=function(e){e.geometry&&e.geometry.dispose(),e.material&&Fie(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(Oie)},f4e=function(e){for(;e.children.length;){var t=e.children[0];e.remove(t),Oie(t)}},Cr=window.THREE?window.THREE:{WebGLRenderer:g3,Scene:Jd,PerspectiveCamera:Lr,Raycaster:t2,SRGBColorSpace:vr,TextureLoader:Ya,Vector2:Oe,Vector3:ie,Box3:ma,Color:Ut,Mesh:Gn,SphereGeometry:_a,MeshBasicMaterial:Yr,BackSide:hi,Timer:kA},Jk=Or({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 Ws(u).to(l,r).easing(Br.Quadratic.Out).onUpdate(p).onComplete(function(){e.povPosTween=void 0,e.tweenGroup.remove(this)}).start()),e.tweenGroup.add(e.povTgtTween=new Ws(f).to(c,r/3).easing(Br.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 Cr.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 Cr.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 Cr.Vector3(0,0,0),a=Math.max.apply(Math,ig(Object.entries(t).map(function(x){var v=c4e(x,2),w=v[0],S=v[1];return Math.max.apply(Math,ig(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 Cr.Box3(new Cr.Vector3(0,0,0),new Cr.Vector3(0,0,0)),r=e.objects.filter(t);return r.length?(r.forEach(function(s){return n.expandByObject(s)}),Object.assign.apply(Object,ig(["x","y","z"].map(function(s){return r4e({},s,[n.min[s],n.max[s]])})))):null},getScreenCoords:function(e,t,n,r){var s=new Cr.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 Cr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),o=new Cr.Raycaster;return o.setFromCamera(s,e.camera),Object.assign({},o.ray.at(r,new Cr.Vector3))},intersectingObjects:function(e,t,n){var r=new Cr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),s=new Cr.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;f4e(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 Cr.Scene,camera:new Cr.PerspectiveCamera,timer:new Cr.Timer,tweenGroup:new tm,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 Lie(t.container),t.pointerPos=new Cr.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?z1:Cr.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 kR(t.renderer),t.postProcessingComposer.addPass(new GR(t.scene,t.camera)),t.controls=new{trackball:NR,orbit:DR,fly:FR}[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(ig(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 Cr.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(ig(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(ig(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(ig(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 Cr.SphereGeometry(e.skyRadius)),t.hasOwnProperty("backgroundColor")){var f=E0(e.backgroundColor).alpha;f===void 0&&(f=1),e.renderer.setClearColor(new Cr.Color(Tne(1,e.backgroundColor)),f)}t.hasOwnProperty("backgroundImageUrl")&&(e.backgroundImageUrl?new Cr.TextureLoader().load(e.backgroundImageUrl,function(x){x.colorSpace=Cr.SRGBColorSpace,e.skysphere.material=new Cr.MeshBasicMaterial({map:x,side:Cr.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 d4e(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 p4e=`.scene-container .clickable {5284+}`;r4e(s4e);function Jk(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 o4e(i){if(Array.isArray(i))return i}function a4e(i){if(Array.isArray(i))return Jk(i)}function l4e(i,e,t){return(e=A4e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function c4e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function u4e(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 h4e(){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 f4e(){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 d4e(i,e){return o4e(i)||u4e(i,e)||Oie(i,e)||h4e()}function ig(i){return a4e(i)||c4e(i)||Oie(i)||f4e()}function p4e(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 A4e(i){var e=p4e(i,"string");return typeof e=="symbol"?e:e+""}function Oie(i,e){if(i){if(typeof i=="string")return Jk(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)?Jk(i,e):void 0}}var Bie=function(e){e instanceof Array?e.forEach(Bie):(e.map&&e.map.dispose(),e.dispose())},Uie=function(e){e.geometry&&e.geometry.dispose(),e.material&&Bie(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(Uie)},m4e=function(e){for(;e.children.length;){var t=e.children[0];e.remove(t),Uie(t)}},Cr=window.THREE?window.THREE:{WebGLRenderer:_3,Scene:Jd,PerspectiveCamera:Lr,Raycaster:i2,SRGBColorSpace:vr,TextureLoader:Ya,Vector2:Oe,Vector3:ie,Box3:ma,Color:Ut,Mesh:Gn,SphereGeometry:_a,MeshBasicMaterial:Kr,BackSide:hi,Timer:kA},e9=Or({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 Ws(u).to(l,r).easing(Br.Quadratic.Out).onUpdate(p).onComplete(function(){e.povPosTween=void 0,e.tweenGroup.remove(this)}).start()),e.tweenGroup.add(e.povTgtTween=new Ws(f).to(c,r/3).easing(Br.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,R=w.z;S!==void 0&&(s.position.x=S),T!==void 0&&(s.position.y=T),R!==void 0&&(s.position.z=R)}function x(w){var S=new Cr.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 Cr.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 Cr.Vector3(0,0,0),a=Math.max.apply(Math,ig(Object.entries(t).map(function(x){var v=d4e(x,2),w=v[0],S=v[1];return Math.max.apply(Math,ig(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 Cr.Box3(new Cr.Vector3(0,0,0),new Cr.Vector3(0,0,0)),r=e.objects.filter(t);return r.length?(r.forEach(function(s){return n.expandByObject(s)}),Object.assign.apply(Object,ig(["x","y","z"].map(function(s){return l4e({},s,[n.min[s],n.max[s]])})))):null},getScreenCoords:function(e,t,n,r){var s=new Cr.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 Cr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),o=new Cr.Raycaster;return o.setFromCamera(s,e.camera),Object.assign({},o.ray.at(r,new Cr.Vector3))},intersectingObjects:function(e,t,n){var r=new Cr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),s=new Cr.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;m4e(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 Cr.Scene,camera:new Cr.PerspectiveCamera,timer:new Cr.Timer,tweenGroup:new tm,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 Fie(t.container),t.pointerPos=new Cr.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(R){return Math.abs(R)>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(R){var P=R.getBoundingClientRect(),C=window.pageXOffset||document.documentElement.scrollLeft,L=window.pageYOffset||document.documentElement.scrollTop;return{top:P.top+L,left:P.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?V1:Cr.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 GR(t.renderer),t.postProcessingComposer.addPass(new zR(t.scene,t.camera)),t.controls=new{trackball:LR,orbit:FR,fly:OR}[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(ig(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 Cr.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(ig(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(ig(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(ig(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 Cr.SphereGeometry(e.skyRadius)),t.hasOwnProperty("backgroundColor")){var f=E0(e.backgroundColor).alpha;f===void 0&&(f=1),e.renderer.setClearColor(new Cr.Color(Mne(1,e.backgroundColor)),f)}t.hasOwnProperty("backgroundImageUrl")&&(e.backgroundImageUrl?new Cr.TextureLoader().load(e.backgroundImageUrl,function(x){x.colorSpace=Cr.SRGBColorSpace,e.skysphere.material=new Cr.MeshBasicMaterial({map:x,side:Cr.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 g4e(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 _4e=`.scene-container .clickable {52875287 cursor: pointer;5288-}`;d4e(p4e);function e9(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 A4e(i){if(Array.isArray(i))return e9(i)}function qb(i,e,t){return(e=v4e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function m4e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function g4e(){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 Bie(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 rg(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Bie(Object(t),!0).forEach(function(n){qb(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Bie(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function _4e(i,e){if(i==null)return{};var t,n,r=x4e(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 x4e(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 a4(i){return A4e(i)||m4e(i)||b4e(i)||g4e()}function y4e(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 v4e(i){var e=y4e(i,"string");return typeof e=="symbol"?e:e+""}function b4e(i,e){if(i){if(typeof i=="string")return e9(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)?e9(i,e):void 0}}function Uie(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 w4e=["rendererConfig","waitForGlobeReady"],Vb=rg(rg({},window.THREE?window.THREE:{AmbientLight:UA,DirectionalLight:BA,Vector2:Oe,REVISION:"185"}),{},{CSS2DRenderer:v3}),kie=Uie("globe",vk),S4e=Object.assign.apply(Object,a4(["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 qb({},i,kie.linkProp(i))}))),T4e=Object.assign.apply(Object,a4(["globeMaterial","globeTileEngineClearCache","getGlobeRadius","getCoords","toGeoCoords"].map(function(i){return qb({},i,kie.linkMethod(i))}))),Gie=Uie("renderObjs",Jk),E4e=Object.assign.apply(Object,a4(["width","height","backgroundColor","backgroundImageUrl","enablePointerInteraction"].map(function(i){return qb({},i,Gie.linkProp(i))}))),M4e=Object.assign.apply(Object,a4(["lights","postProcessingComposer"].map(function(i){return qb({},i,Gie.linkMethod(i))}))),zie=Or({props:rg(rg({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}))}}},S4e),E4e),methods:rg(rg({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 Ws(r).to(o,n).easing(Br.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()}},T4e),M4e),stateInit:function(e){var t=e.rendererConfig,n=e.waitForGlobeReady,r=n===void 0?!0:n,s=_4e(e,w4e),o=new vk(rg({waitForGlobeReady:r},s));return{globe:o,renderObjs:Jk({controlType:"orbit",rendererConfig:t,waitForLoadComplete:r,extraRenderers:[new Vb.CSS2DRenderer]}).skyRadius(o.getGlobeRadius()*500).showNavInfo(!1).objects([o]).lights([new Vb.AmbientLight(13421772,Math.PI),new Vb.DirectionalLight(16777215,.6*Math.PI)]),tweenGroup:new tm}},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 Vb.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}};Vb.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 Hie=4,Wb=100,Xb=Wb+.2,cd=8,C4e=96,Wie=.045,jie=.08;function $b(i,e,t){let 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 $n=null,c4="",gs={group:null,tiles:new Map,key:"",variant:""},Lo={group:null,cell:null,fitKey:""},Au={group:null,key:""},R4e=180,n9=null,nx=new Map,f4=new Map,Vie=new Map;function Xie(){let i=iV(U.map)==="sphere"&&lf(U.map)!==null;ye.globeToggle.hidden=!i,$ie(),!i&&$n&&(Hb(),gs.group=null,Lo.group=null,Lo.cell=null,Au.group=null,Au.key="",$n._destructor(),$n=null,c4="",n9=null,ye.globe.replaceChildren())}function d4(){U.globeActive?$ie():Zie()}var jb=2.5,u4=2,ix=.08,p4=4;function P4e(i){let e=Number.isFinite(i)?i:u4;return ls(jb/2**(e-u4),ix,p4)}function r9(i){let e=Number.isFinite(i)?Math.max(i,ix/2):jb,t=(U.variant?.maxZoom??u4)+2;return ls(u4+Math.log2(jb/e),0,t)}function s9(i){if(!$n||!U.globeActive)return;let e=$n.pointOfView(),t=ls((Number.isFinite(e.altitude)?e.altitude:jb)/2**i,ix,p4);$n.pointOfView({altitude:t},180)}function $ie(){let i=lf(U.map),e=U.engine?.getView();if($n&&U.globeActive&&i&&e){let t=$n.pointOfView(),[n,r]=i.toWorld(t.lat,t.lng);Number.isFinite(n)&&Number.isFinite(r)&&(e.cancelAnimations(),e.setCenter([n,-r]),e.setZoom(r9(t.altitude)))}U.globeActive=!1,ye.globe.hidden=!0,ye.globeToggle.setAttribute("aria-pressed","false"),ye.viewport.hidden=!1,Hb(),U.overviewKey="",document.dispatchEvent(new Event("atlas:globe-camera"))}function Yie(){if(!$n||!U.globeActive)return null;let i=$n.pointOfView();return{lat:i.lat,lng:i.lng}}function Kie(i,e,t){if(!$n)return;let n=$n.pointOfView().altitude;$n.pointOfView({lat:i,lng:e,altitude:n},t?180:0)}async function Zie(){let i=lf(U.map);if(!i)return;if(U.globeActive=!0,ye.viewport.hidden=!0,ye.globe.hidden=!1,ye.globeToggle.setAttribute("aria-pressed","true"),U.overviewKey="",!$n){$n=zie({animateIn:!1})(ye.globe).backgroundColor("#0b0e12").showAtmosphere(!0).atmosphereColor("#8a6f5b").atmosphereAltitude(.12).objectLat(o=>o.lat).objectLng(o=>o.lng).objectAltitude(o=>o.pin===U.selectedPin?.03:.014).objectThreeObject(o=>V4e(o.pin)).objectLabel(o=>o.pin.location.title).onObjectClick(o=>Px(o.pin)).onObjectHover(o=>{ye.globe.style.cursor=o?"pointer":""}).onZoom(()=>{document.dispatchEvent(new Event("atlas:globe-camera")),qie(),l4(),q4e()}),document.addEventListener("atlas:selection",z4e),document.addEventListener("atlas:filters",t9),document.addEventListener("atlas:grid",()=>{h4(),t9(),l4()}),document.addEventListener("atlas:labels",l4),$n.onGlobeClick(({lat:o,lng:a})=>{if(!U.gridEnabled)return;let l=lf(U.map);if(!l)return;let[c,u]=l.toWorld(o,a),f=la().descendTarget(U.gridCell,[c,-u]);f&&tA(f)});let s=$n.controls();s.minDistance=Wb*(1+ix),s.maxDistance=Wb*(1+p4),gs.group=new br,$n.scene().add(gs.group),Lo.group=new br,$n.scene().add(Lo.group),Au.group=new br,$n.scene().add(Au.group),window.__atlasGlobe={detail:gs,grid:Lo,labels:Au,sprites:nx}}o9();let e=U.engine?.getView(),t=e?.getCenter();if(t&&Number.isFinite(t[0])&&Number.isFinite(t[1])){let[s,o]=i.toLatLng(t[0],-t[1]);$n.pointOfView({lat:s,lng:o,altitude:P4e(e.getZoom())})}else $n.pointOfView({lat:10,lng:0,altitude:jb});let n=U.variant||U.map.variants[0],r=`${U.game.stamp}:${U.map.slug}:${n.tiles}`;if(c4!==r){c4=r;let s=await W4e(n);s&&c4===r&&$n.globeImageUrl(s)}n9!==U.pins&&(n9=U.pins,nx.clear(),f4.clear(),$n.objectsData(H4e(i))),t9(),ere(),qie(),h4(),l4(),document.dispatchEvent(new Event("atlas:globe-camera"))}function h4(){if(!$n||!Lo.group)return;for(let e of[...Lo.group.children])Lo.group.remove(e),e.geometry?.dispose(),e.material?.map?.dispose(),e.material?.dispose();let i=U.globeActive?lf(U.map):null;if(!i||!U.gridEnabled){Lo.cell=null;return}for(let e of rS()){let t=Qie(e.extent,i),n=iS(e,{subgridVisible:U.subgridVisible,labelled:N4e(e,t)});n&&(n.fill&&Lo.group.add(L4e(t,n.fill)),Lo.group.add(B4e(t,n.line)),n.label&&Lo.group.add(U4e(n.label,t)))}Lo.cell!==null&&Lo.cell!==U.gridCell&&k4e(i),Lo.cell=U.gridCell}function I4e(i){let e=$n.pointOfView(),t=Math.max(e.altitude,ix/2),n=50*Math.PI/180,r=2*t*Wb*Math.tan(n/2)/Math.max(1,ye.globe.clientHeight||1),s=Wb*Math.PI/180/r;return{width:Math.abs(i.east-i.west)*s,height:Math.abs(i.north-i.south)*s}}function N4e(i,e){let n=i.role==="neighbor"?Li.neighborLabelSizePx:Li.labelSizePx,r=`900 ${n}px ${Li.labelFont}`,s=I4e(e);return kI(i.hash,r)+9<=s.width&&n+6<=s.height}function L4e(i,e){let t=D4e(i,Xb+.12),n=new Yr({color:e.color,transparent:!0,opacity:e.opacity,depthWrite:!1}),r=new Gn(t,n);return r.renderOrder=1,r}function D4e(i,e){let t=[],n=[],r=Math.max(Math.abs(i.east-i.west),Math.abs(i.north-i.south)),s=ls(Math.ceil(r/2),6,48);for(let a=0;a<=s;a++){let l=i.north+(i.south-i.north)*a/s;for(let c=0;c<=s;c++){let u=i.west+(i.east-i.west)*c/s;t.push(...$b(l,u,e))}}for(let a=0;a<s;a++)for(let l=0;l<s;l++){let c=a*(s+1)+l;n.push(c,c+s+1,c+1),n.push(c+1,c+s+1,c+s+2)}let o=new qn;return o.setAttribute("position",new Rn(t,3)),o.setIndex(n),o}function l4(){if(!$n||!Au.group)return;let i=U.globeActive&&U.labelsHeld,e=i?$n.pointOfView():null,t=i?`${Math.round(e.lat)}:${Math.round(e.lng)}:${e.altitude.toFixed(2)}:${U.gridCell}`:"";if(t===Au.key)return;Au.key=t;for(let r of[...Au.group.children])Au.group.remove(r),r.material?.map?.dispose(),r.material?.dispose();if(!i)return;let n=[];for(let[r,s]of nx){if(!s.visible)continue;let o=f4.get(r);if(!o)continue;let a=F4e(e,o);a>85||n.push({pin:r,stood:o,distance:a})}n.sort((r,s)=>r.distance-s.distance);for(let{pin:r,stood:s}of n.slice(0,R4e))Au.group.add(O4e(r,s))}function F4e(i,e){let t=Math.PI/180,n=Math.sin(i.lat*t)*Math.sin(e.lat*t)+Math.cos(i.lat*t)*Math.cos(e.lat*t)*Math.cos((i.lng-e.lng)*t);return Math.acos(ls(n,-1,1))*180/Math.PI}function O4e(i,e){let t=i.location.title,n=document.createElement("canvas"),r=n.getContext("2d"),s="600 26px Inter, system-ui, sans-serif";r.font=s;let o=Math.ceil(r.measureText(t).width)+24;n.width=o,n.height=40,r.font=s,r.textAlign="center",r.textBaseline="middle",r.fillStyle="rgba(10, 13, 17, 0.78)",r.fillRect(0,0,o,40),r.fillStyle="#e6ebf0",r.fillText(t,o/2,21);let a=new Vu({depthWrite:!1,sizeAttenuation:!1,transparent:!0});new Ya().load(n.toDataURL("image/png"),u=>{a.map=u,a.needsUpdate=!0});let l=new CA(a);l.position.set(...$b(e.lat,e.lng,Xb+.4));let c=.028;return l.scale.set(c*o/40,c,1),l.center.set(.5,0),l}function Qie(i,e){let[t,n]=e.toLatLng(i[0],-i[3]).reverse(),[r,s]=e.toLatLng(i[2],-i[1]).reverse();return{west:t,north:n,east:r,south:s}}function B4e(i,e){let t=[],n=Math.max(Math.abs(i.east-i.west),Math.abs(i.north-i.south)),r=ls(Math.ceil(n/2),12,48),s=(u,f,p,x,v)=>[f+(x-f)*u,p+(v-p)*u],o=[[i.north,i.west,i.north,i.east],[i.north,i.east,i.south,i.east],[i.south,i.east,i.south,i.west],[i.south,i.west,i.north,i.west]];for(let u of o)for(let f=0;f<r;f++)t.push(...$b(...s(f/r,...u),Xb+.25));t.push(...t.slice(0,3));let a=new x0;a.setPositions(t);let l=new zh({color:e.color,transparent:!0,opacity:e.opacity,linewidth:e.widthPx,depthWrite:!1});l.resolution.set(ye.globe.clientWidth||1,ye.globe.clientHeight||1);let c=new $1(a,l);return c.computeLineDistances(),c.renderOrder=2,c}function U4e(i,e){let n=i.sizePx*2,r=`500 ${n}px ${Li.labelFont}`,s=`900 ${n}px ${Li.labelFont}`,o=document.createElement("canvas"),a=o.getContext("2d");a.font=r;let l=i.prefix?a.measureText(i.prefix).width:0;a.font=s;let c=a.measureText(i.final).width,u=10;o.width=Math.ceil(l+c+u*2),o.height=n+u*1.4,a.fillStyle=i.chip,a.fillRect(0,0,o.width,o.height),a.textBaseline="middle";let f=o.height/2+2;i.prefix&&(a.font=r,a.fillStyle=i.color,a.globalAlpha=Li.prefixAlpha*i.textAlpha,a.fillText(i.prefix,u,f)),a.font=s,a.globalAlpha=i.textAlpha,a.fillStyle=i.color,a.fillText(i.final,u+l,f),a.globalAlpha=1;let p=new Vu({depthWrite:!1,transparent:!0,sizeAttenuation:!1});new Ya().load(o.toDataURL("image/png"),P=>{p.map=P,p.needsUpdate=!0});let x=new CA(p),v=Math.abs(e.north-e.south)*.02,w=Math.abs(e.east-e.west)*.02;x.position.set(...$b(e.south+v,e.east-w,Xb+.35));let S=Math.max(1,ye.globe.clientHeight||1),T=o.height/2/S;return x.scale.set(T*o.width/o.height,T,1),x.center.set(1,0),x.renderOrder=3,x}function k4e(i){let t=rS().find(l=>l.role==="scope"||l.role==="leaf");if(!t)return;let n=Qie(t.extent,i),r=(n.north+n.south)/2,s=(n.west+n.east)/2,o=Math.max(Math.abs(n.east-n.west),Math.abs(n.north-n.south)),a=ls(o/45,ix,p4);$n.pointOfView({lat:r,lng:s,altitude:a},400)}function qie(){if(!$n||!gs.group)return;let i=U.globeActive?U.variant||U.map.variants[0]:null;if(!i){Hb();return}gs.variant!==i.tiles&&(Hb(),gs.variant=i.tiles);let e=$n.pointOfView(),t=Math.min(Math.round(r9(e.altitude))+1,i.maxZoom);if(t<=Hie||!i.formats[t]){Hb(),gs.key="";return}let n=2**t,r=n/2,s=360/n,o=Math.acos(1/(1+e.altitude))*180/Math.PI+s,a=Math.floor(((e.lng+180)%360+360)%360/s),l=Math.floor((90-e.lat)/s),c=Math.ceil(o/s);for(;(2*c+1)**2>C4e&&c>1;)c--;let u=new Set;for(let p=-c;p<=c;p++){let x=l+p;if(!(x<0||x>=r))for(let v=-c;v<=c;v++){let w=((a+v)%n+n)%n;u.add(`${t}/${w}/${x}`)}}let f=`${i.tiles}:${[...u].sort().join(",")}`;if(f!==gs.key){gs.key=f;for(let[p,x]of gs.tiles)u.has(p)||(gs.group.remove(x),Jie(x),gs.tiles.delete(p));for(let p of u){if(gs.tiles.has(p))continue;let[x,v,w]=p.split("/").map(Number),S=G4e(i,x,v,w);gs.tiles.set(p,S),gs.group.add(S)}}}function G4e(i,e,t,n){let r=360/2**e,s=-180+t*r,o=90-n*r,a=[],l=[],c=[];for(let w=0;w<=cd;w++){let S=o-w/cd*r;for(let T=0;T<=cd;T++){let P=s+T/cd*r;a.push(...$b(S,P,Xb)),l.push(T/cd,1-w/cd)}}let u=cd+1;for(let w=0;w<cd;w++)for(let S=0;S<cd;S++){let T=w*u+S;c.push(T,T+u,T+1),c.push(T+1,T+u,T+u+1)}let f=new qn;f.setAttribute("position",new Rn(a,3)),f.setAttribute("uv",new Rn(l,2)),f.setIndex(c);let p=new Yr,x=new Gn(f,p);x.visible=!1;let v=`${U.game.base}/tiles/${i.tiles}/${e}/${t}/${n}.${i.formats[e]}`;return new Ya().load(v,w=>{w.colorSpace=vr,p.map=w,p.needsUpdate=!0,x.visible=!0}),x}function Hb(){if(gs.group){for(let i of gs.tiles.values())gs.group.remove(i),Jie(i);gs.tiles.clear(),gs.key=""}}function Jie(i){i.geometry.dispose(),i.material.map?.dispose(),i.material.dispose()}function ere(){if($n){for(let[i,e]of nx){let t=i===U.selectedPin;e.material=nre(i.category,t);let n=t?jie:Wie;e.scale.set(n,n,1)}$n.objectAltitude(i=>i.pin===U.selectedPin?.03:.014)}}function z4e(){if(!$n||!U.globeActive)return;ere();let i=f4.get(U.selectedPin);if(i){let e=$n.pointOfView().altitude;$n.pointOfView({lat:i.lat,lng:i.lng,altitude:e},600)}}function tre(i){return!(i.filteredHidden||U.hiddenCategories.has(i.category.id)||U.gridEnabled&&U.gridCell&&!Rd(i))}function t9(){if(!(!$n||!U.globeActive))for(let[i,e]of nx)e.visible=tre(i)}function V4e(i){let e=new CA(nre(i.category,i===U.selectedPin)),t=i===U.selectedPin?jie:Wie;return e.scale.set(t,t,1),e.visible=tre(i),nx.set(i,e),e}function nre(i,e){let t=`${Wx(i)}:${e?"ringed":"plain"}`,n=Vie.get(t);if(n)return n;n=new Vu({depthWrite:!1,sizeAttenuation:!1}),Vie.set(t,n);let r=U.markerIcons.get(Wx(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=J0(),l.strokeText(Dc(i.title),40,41),l.fillStyle=eA(i),l.fillText(Dc(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 Ya().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 ire(){U.globeActive&&Zie()}function o9(){!$n||ye.globe.hidden||($n.width(ye.globe.clientWidth).height(ye.globe.clientHeight),h4())}function q4e(){if(!$n||!U.globeActive||!U.gridEnabled)return;let i=$n.pointOfView(),e=`${U.gridCell}:${Math.round(r9(i.altitude)*2)}`;e!==Lo.fitKey&&(Lo.fitKey=e,h4())}function H4e(i){let e=[];for(let t of U.pins){let[n,r]=Fg(t.location.lat,t.location.lng),[s,o]=i.toLatLng(n,-r);e.push({lat:s,lng:o,pin:t}),f4.set(t,{lat:s,lng:o})}return e}async function W4e(i){let e=Math.min(Hie,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=`${U.game.base}/tiles/${i.tiles}/${e}/${c}/${l}.${t}`;a.push(j4e(u).then(f=>{f&&o.drawImage(f,c*256,l*256,256,256)}))}return await Promise.all(a),s.toDataURL("image/jpeg",.92)}function j4e(i){return new Promise(e=>{let t=new Image;t.onload=()=>e(t),t.onerror=()=>e(null),t.src=i})}function rre(){let i=U.variant,e=ye.overviewCanvas,t=e.getContext("2d"),n=Yh(),r=U.game.tileGrid.size,s=U.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=++U.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||!m4(i,l,T,S))continue;let P=new Image;P.onload=()=>{U.overviewRun===u&&t.drawImage(P,T*s-n[0]*c,S*s+n[3]*c,s,s)},P.src=`${U.game.base}/tiles/${encodeURIComponent(i.tiles)}/${l}/${T}/${S}.${f}`}rx()}function rx(){let i=Yie();if(i){let w=lf(U.map);if(!w||!U.variant)return;let S=Yh(),[T,P]=w.toWorld(i.lat,i.lng),R=ye.overviewCanvas,C=ls((T-S[0])/(S[2]-S[0]),0,1),L=ls((P+S[3])/(S[3]-S[1]),0,1);U.overviewKey="",ye.overviewShelf.hidden=!1;let D=ye.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=U.engine?.getView();if(!e||!U.variant)return;let t=Yh(),n=e.calculateExtent(U.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===U.overviewKey||(U.overviewKey=l,ye.overviewShelf.hidden=a,a))return;let c=ye.overviewCanvas,u=ls((n[0]-t[0])/r,0,1),f=ls((n[2]-t[0])/r,0,1),p=ls((t[3]-n[3])/s,0,1),x=ls((t[3]-n[1])/s,0,1),v=ye.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 A4(i,e=!0){U.overviewDocked=i,i&&U.overviewPointer!==null&&(U.overviewPointer=null,sx()),ye.overviewShelf.classList.toggle("is-docked",i),ye.overviewDock.setAttribute("aria-expanded",String(!i));let t=i?"Bring the overview back":"Put the overview away";ye.overviewDock.setAttribute("aria-label",t),ye.overviewDock.title=t,e&&Nc()}function a9(i,e){let t=ye.overviewCanvas.getBoundingClientRect(),n=Yh(),r=(a,l,c)=>ls((a-l)/(c-l),0,1);if(U.globeActive){let a=lf(U.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);Kie(u,f,e);return}let s=U.engine?.getView();if(!s||!U.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 Gl(i){return new bH({updateWhileAnimating:!0,...i})}function sre(){let i=U.game.tileGrid.size,e=[0,-i,i,0];U.projection=new _d({code:"ATLAS:PIXELS",units:"pixels",extent:e}),U.sources={grid:new vf({wrapX:!1}),gridContext:new vf({wrapX:!1}),zoneScrim:new vf({wrapX:!1}),zones:new vf({wrapX:!1}),zoneTitles:new vf({wrapX:!1}),text:new vf({wrapX:!1}),pins:new vf({wrapX:!1}),priority:new vf({wrapX:!1})},U.layers={raster:new iN({zIndex:0}),rasterDetail:new iN({zIndex:1}),grid:Gl({source:U.sources.grid,style:UI,renderOrder:Kl,renderBuffer:40,zIndex:5}),zoneScrim:Gl({source:U.sources.zoneScrim,style:IV,zIndex:6}),zones:Gl({source:U.sources.zones,style:NV,renderBuffer:32,zIndex:10}),zoneTitles:Gl({source:U.sources.zoneTitles,style:LV,renderOrder:Kl,renderBuffer:160,zIndex:20}),zoneTitleDetail:Gl({source:U.sources.zoneTitles,style:DV,renderOrder:Kl,renderBuffer:160,zIndex:44}),text:Gl({source:U.sources.text,style:TV,renderOrder:Kl,renderBuffer:220,zIndex:30}),textDetail:Gl({source:U.sources.text,style:EV,renderOrder:Kl,renderBuffer:220,zIndex:45}),zoneText:Gl({source:U.sources.text,style:MV,renderOrder:Kl,renderBuffer:220,zIndex:41}),pins:Gl({source:U.sources.pins,style:bV,renderOrder:Kl,renderBuffer:48,zIndex:40}),zonePins:Gl({source:U.sources.pins,style:wV,renderOrder:Kl,renderBuffer:48,zIndex:42}),pinLabels:Gl({source:U.sources.pins,style:SV,renderOrder:Kl,renderBuffer:180,zIndex:45}),gridContext:Gl({source:U.sources.gridContext,style:UI,renderOrder:Kl,renderBuffer:40,zIndex:48}),priority:Gl({source:U.sources.priority,style:CV,renderOrder:Kl,renderBuffer:220,zIndex:50})},U.engine=new $q({target:ye.viewport,layers:Object.values(U.layers),controls:bS({attribution:!1,rotate:!1,zoom:!1}),interactions:CS({onFocusOnly:!1}),view:_4(5)}),U.engine.on("movestart",()=>{U.engine.getViewport().classList.add("is-dragging")}),U.engine.on("moveend",()=>{U.engine.getViewport().classList.remove("is-dragging"),U.overviewPointer===null&&sx()}),U.engine.on("postrender",rx),ye.viewport.addEventListener("wheel",()=>{document.activeElement!==ye.viewport&&ye.viewport.focus({preventScroll:!0})},{capture:!0,passive:!0}),U.engine.on("singleclick",t=>{if(U.gridEnabled){let r=U.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===U.layers.grid||s===U.layers.gridContext});if(r){tA(r.hash);return}}let n=U.engine.forEachFeatureAtPixel(t.pixel,(r,s)=>g4(s)&&r.get("pin")||null,{hitTolerance:5,layerFilter:g4});n&&Px(n)}),U.engine.on("pointermove",t=>{if(t.dragging){Og(null);return}let n=U.engine.forEachFeatureAtPixel(t.pixel,(o,a)=>g4(a)&&o.get("pin")||null,{hitTolerance:4,layerFilter:g4}),r=n&&Ru(n.category)==="text"?null:n;Og(r||null);let s=U.gridEnabled&&U.engine.hasFeatureAtPixel(t.pixel,{layerFilter:o=>o===U.layers.grid||o===U.layers.gridContext});U.engine.getTargetElement().style.cursor=n||s?"pointer":""}),U.engine.getViewport().addEventListener("pointerleave",()=>Og(null))}function g4(i){return i===U.layers.pins||i===U.layers.zonePins||i===U.layers.pinLabels||i===U.layers.priority||i===U.layers.text||i===U.layers.textDetail||i===U.layers.zoneText}function _4(i,e=null){let t=U.game.tileGrid.size,n=e||[0,-t,t,0];return new Al({projection:U.projection,center:[(n[0]+n[2])/2,(n[1]+n[3])/2],resolutions:l9(i),minZoom:0,maxZoom:i,extent:n,constrainResolution:!1,smoothResolutionConstraint:!1,showFullExtent:!0,zoom:0})}function l9(i){let e=U.game.tileGrid.size/U.game.tileGrid.tileSize;return Array.from({length:i+1},(t,n)=>e/2**n)}async function df(i,e){U.game=U.catalog.games.find(r=>r.slug===i)||U.catalog.games[0],U.engine||sre(),!e&&!U.restore&&(U.restore=Cg(U.game.slug)),ye.game.value=U.game.slug,B0(ye.map,U.game.maps,"title"),ye.map.disabled=U.game.maps.length===1,ye.map.title=ye.map.disabled?"This game has one map":"Choose a map";let t=U.restore?.game===U.game.slug?U.restore:null,n=e&&U.game.maps.find(r=>r.slug===e)||t&&U.game.maps.find(r=>r.slug===t.map);await c9((n||U.game.maps[0]).slug)}async function c9(i){let e=U.game.maps.find(s=>s.slug===i)||U.game.maps[0],t=++U.mapRun;ye.loading.hidden=!1;let n;try{n=await ZV(e)}catch{U.mapRun===t&&(ye.loading.hidden=!0,oA());return}if(U.mapRun!==t)return;U.settling=!0,U.map=n,document.documentElement.style.setProperty("--icon-outset-color",J0()),ye.map.value=U.map.slug,B0(ye.variant,U.map.variants,"name"),ye.variantField.hidden=U.map.variants.length<2,U.styleCache.clear(),Og(null),U.gridCell="",U.gridSystem="geohash",U.hiddenCategories.clear(),U.collapsedSections.clear(),U.collapsedSections.add("zones");for(let s of U.map.groups)for(let o of s.categories)o.visible||U.hiddenCategories.add(o.id);let r=U.restore?.map===U.map.slug?U.restore:null;r&&(U.hiddenCategories=new Set(r.hidden),U.collapsedSections=new Set(r.collapsed)),A4(!!U.restore?.overviewDocked,!1),Zw(U.restore?!!U.restore.dockFolded:!0,!1),U.dockDismissed=!!U.restore?.dockDismissed,U.search="",ye.search.value="",ye.dock.hidden=!1,Oc(),XV(),VI(),WV(),u9(r?ls(r.variant,0,U.map.variants.length-1):0,!0),Xie(),U.restore=null,ye.sidebar.classList.remove("is-open"),ye.mobileLegend.setAttribute("aria-expanded","false"),Iz(),U.settling=!1,Nc()}function u9(i,e=!1){let t=U.variant;U.variant=U.map.variants[i]||U.map.variants[0];let n=U.variant,r=e?null:Y4e(t,n),s=Eu(n);if(ye.variant.value=String(U.map.variants.indexOf(U.variant)),e)U.engine.setView(_4(s,Yh()));else{let w=U.engine.getView(),S=_4(s,Yh());S.setCenter(w.getCenter()),S.setZoom(w.getZoom()||0),U.engine.setView(S)}let o=++U.tileRun,a=0;U.tileStats={requested:0,loaded:0,errors:0,peakPending:0},ye.loading.hidden=!1;let l=w=>{w.on("tileloadstart",()=>{U.tileRun===o&&(a++,U.tileStats.requested++,U.tileStats.peakPending=Math.max(U.tileStats.peakPending,a))});let S=T=>{U.tileRun===o&&(a=Math.max(0,a-1),T?U.tileStats.errors++:U.tileStats.loaded++,a===0&&U.tileStats.loaded>0&&(ye.loading.hidden=!0))};return w.on("tileloadend",()=>S(!1)),w.on("tileloaderror",()=>S(!0)),w},c=(w,S)=>l(new Rz({projection:U.projection,tileGrid:new Mx({extent:[0,-U.game.tileGrid.size,U.game.tileGrid.size,0],origin:[0,0],resolutions:l9(w),tileSize:U.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`${U.game.base}/tiles/${encodeURIComponent(n.tiles)}/${T}/${P}/${R}.${C}`}})),u=n.fullZoom??n.maxZoom,f=c(u,(w,S,T)=>m4(n,w,S,T)),p=U.layers.raster.getSource();U.layers.raster.setSource(f),U.layers.raster.setExtent(Yh()),U.layers.raster.setBackground(n.background||void 0),p?.clear();let x=U.layers.rasterDetail.getSource();n.maxZoom>u?(U.layers.rasterDetail.setSource(c(n.maxZoom,(w,S,T)=>w>u&&m4(n,w,S,T))),U.layers.rasterDetail.setExtent(Yh()),U.layers.rasterDetail.setVisible(!0)):U.layers.rasterDetail.setVisible(!1),x?.clear(),nS(),U.gridEnabled&&(Tu(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed()),U.overviewKey="",rre();let v=e&&U.restore?.map===U.map.slug?U.restore:null;if(U.renderedShard!==(n.shard||0)&&(VI(),$l()),v?.center&&Number.isFinite(v.zoom)){let w=U.engine.getView();w.setCenter(v.center),w.setZoom(v.zoom),U.fitZoom=v.zoom,sA()}else e?requestAnimationFrame(K4e):(r&&U.engine.getView().animate({center:r,duration:200}),sA());Nc()}function m4(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=$4e(i,e,r),l=o*r.w+s;return(a[l>>3]&1<<(l&7))!==0}function $4e(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 Eu(i){return i.maxZoom+2}function sx(){sA(),Nc()}function Y4e(i,e){if(!i||!e||!i.shard||!e.shard||i.shard===e.shard||!i.bounds||!e.bounds)return null;let n=U.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+ls(r,0,1)*e.bounds.width,-(e.bounds.y+ls(s,0,1)*e.bounds.height)]}function ore(){let e=document.querySelector(".app-shell").classList.toggle("sidebar-collapsed");ye.mobileLegend.setAttribute("aria-expanded",String(!e)),requestAnimationFrame(()=>U.engine?.updateSize())}function Yh(){let i=U.game.tileGrid.size,e=U.variant?.bounds||{x:0,y:0,width:i,height:i};return[e.x,-(e.y+e.height),e.x+e.width,-e.y]}function K4e(){if(!U.engine||!U.variant)return;let i=U.engine.getView();i.fit(Yh(),{size:U.engine.getSize(),padding:[36,36,36,36],maxZoom:U.variant.maxZoom,duration:0}),U.fitZoom=i.getZoom()||0,sA()}function Yb(i){let e=U.engine.getView(),t=e.getZoom()||0;e.animate({zoom:ls(t+i,U.variant.minZoom,Eu(U.variant)),duration:140})}function sA(){let i=U.engine?.getView().getZoom();if(ye.viewport.dataset.zoom=Number.isFinite(i)?i.toFixed(3):"",!U.engine||!U.pins.length){ye.visibleCount.textContent="0 locations visible";return}let e=U.engine.getView().calculateExtent(U.engine.getSize()),t=0;for(let n of U.pins){if(Zl(n))continue;let[r,s]=n.coordinate;r>=e[0]&&r<=e[2]&&s>=e[1]&&s<=e[3]&&t++}ye.visibleCount.textContent=`${Fc(U.eligibleLocations)} enabled \xB7 ${Fc(t)} in view`}function are(){ye.game.addEventListener("change",()=>{df(ye.game.value)}),ye.map.addEventListener("change",()=>{c9(ye.map.value)}),ye.addBundles.addEventListener("click",()=>{$I()}),ye.emptyOpen.addEventListener("click",()=>{$I()}),ye.variant.addEventListener("change",()=>{u9(Number(ye.variant.value)),ire()}),ye.globeToggle.addEventListener("click",()=>d4()),ye.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?U.hiddenCategories.delete(s):U.hiddenCategories.add(s),$l(),Md()});let i=null,e=()=>{for(let s of ye.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&&ye.layers.contains(r)&&r.classList.add("is-hovered")};ye.layers.addEventListener("pointermove",n=>{i={x:n.clientX,y:n.clientY},e()},{passive:!0}),ye.layers.addEventListener("pointerleave",()=>{i=null,e()}),ye.layers.addEventListener("scroll",e,{passive:!0}),ye.layers.addEventListener("click",n=>{let r=n.target.closest("[data-only-category], [data-only-section]");if(r){n.preventDefault(),n.stopPropagation(),KV(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;U.collapsedSections.has(o)?U.collapsedSections.delete(o):U.collapsedSections.add(o),xS()}),ye.soloChip.addEventListener("click",()=>Xx(!0)),nn("#expand-all").addEventListener("click",()=>jI(!1)),nn("#collapse-all").addEventListener("click",()=>jI(!0)),nn("#show-all").addEventListener("click",()=>Xx(!0)),nn("#hide-all").addEventListener("click",()=>Xx(!1)),ye.zoneToggle.addEventListener("change",()=>{gS(ye.zoneToggle.checked)}),ye.zoneIndex.addEventListener("click",n=>{let r=n.target.closest("[data-zone]");r&&VV(Number(r.dataset.zone))}),ye.zoneIndex.addEventListener("contextmenu",n=>{let r=n.target.closest("[data-zone]");r&&(n.preventDefault(),qV(Number(r.dataset.zone)))}),ye.search.addEventListener("input",()=>{U.search=ye.search.value.trim().toLocaleLowerCase(),$l(),U.search&&Kw()}),ye.dockFold.addEventListener("click",()=>{eI(!U.dockFolded)}),ye.searchResults.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=U.pinByID.get(Number(r.dataset.location));s&&tI(s)}),ye.detailLinks.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=U.pinByID.get(Number(r.dataset.location));s&&tI(s)}),nn("#close-detail").addEventListener("click",Oc),nn("#zoom-in").addEventListener("click",()=>U.globeActive?s9(1):Yb(1)),nn("#zoom-out").addEventListener("click",()=>U.globeActive?s9(-1):Yb(-1)),ye.gridBack.addEventListener("click",pI),ye.gridInput.addEventListener("input",()=>{let n=la(),r=n.normalizeInput(ye.gridInput.value);ye.gridInput.value=r,n.parseInput(r)!==null&&tA(r)}),ye.subgridToggle.addEventListener("click",()=>{Ox(!U.subgridVisible),ye.viewport.focus({preventScroll:!0})}),ye.gridInput.addEventListener("keydown",n=>{if(n.key===" "){n.preventDefault(),Ox(!U.subgridVisible);return}if(n.key==="`"){n.preventDefault(),ye.globeToggle.hidden||d4();return}n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),ye.viewport.focus({preventScroll:!0}))}),ye.viewport.addEventListener("keydown",n=>{if(!Yw(n.target)){if(n.key==="+"||n.key==="=")Yb(1);else if(n.key==="-")Yb(-1);else if(n.key==="Escape")Oc();else return;n.preventDefault()}}),window.addEventListener("contextmenu",n=>{Yw(n.target)||n.preventDefault()}),window.addEventListener("keydown",n=>{if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="r"){n.preventDefault(),location.reload();return}if(!Yw(n.target)){if(n.key==="`"&&!n.metaKey&&!n.ctrlKey&&!n.altKey){ye.globeToggle.hidden||(n.preventDefault(),d4());return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="k"){n.preventDefault(),ye.search.focus(),ye.search.select();return}if((n.metaKey||n.ctrlKey)&&n.altKey&&n.code==="KeyB"){n.preventDefault(),ye.dock.hidden||eI(!U.dockFolded);return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="b"){n.preventDefault(),ore();return}Jz(n)||n.key.toLocaleLowerCase()==="z"&&(n.preventDefault(),n.repeat||_S(!0))}}),window.addEventListener("keyup",n=>{n.key.toLocaleLowerCase()==="z"&&_S(!1)}),window.addEventListener("blur",()=>_S(!1)),window.addEventListener("hashchange",()=>{let n=Rg();n.game===U.game?.slug&&n.map===U.map?.slug||(U.restore=null,df(n.game||U.catalog.games[0].slug,n.map))}),window.addEventListener("resize",()=>{U.engine?.updateSize(),rx(),o9()}),document.addEventListener("atlas:globe-camera",()=>rx()),ye.overview.addEventListener("pointerdown",n=>{U.overviewDocked||n.pointerType==="mouse"&&n.button!==0||(n.preventDefault(),ye.overview.setPointerCapture(n.pointerId),U.overviewPointer=n.pointerId,a9(n,!0))}),ye.overview.addEventListener("pointermove",n=>{U.overviewPointer===n.pointerId&&(n.preventDefault(),a9(n,!1))});let t=n=>{U.overviewPointer===n.pointerId&&(U.overviewPointer=null,sx())};ye.overview.addEventListener("pointerup",t),ye.overview.addEventListener("pointercancel",t),ye.overviewDock.addEventListener("click",()=>{A4(!U.overviewDocked),ye.viewport.focus({preventScroll:!0})}),ye.mobileLegend.addEventListener("click",()=>{let n=ye.sidebar.classList.toggle("is-open");ye.mobileLegend.setAttribute("aria-expanded",String(n))})}function lre(){let i=()=>({game:U.game?.title,map:U.map?.title,variant:U.variant?.name,zoom:U.engine?.getView().getZoom(),center:U.engine?.getView().getCenter(),resolution:U.engine?.getView().getResolution(),nativeMaxZoom:U.variant?.maxZoom,maxZoom:U.variant?Eu(U.variant):null,interpolate:U.variant?.interpolate,tileStats:{...U.tileStats},pins:U.pins.length,eligibleLocations:U.eligibleLocations,domNodes:document.querySelectorAll("*").length,canvases:document.querySelectorAll("canvas").length,rasterCacheSize:64,labelsHeld:U.labelsHeld,hoveredPin:U.hoveredPin?.location.title||null,selectedPin:U.selectedPin?.location.title||null,fitZoom:U.fitZoom,filters:{hiddenCategories:[...U.hiddenCategories].sort(),collapsedSections:[...U.collapsedSections].sort()},ui:{sidebarCollapsed:document.querySelector(".app-shell")?.classList.contains("sidebar-collapsed")??!1,detailOpen:!ye.detail.hidden,detailTitle:ye.detail.hidden?null:ye.detailTitle.textContent||null,searchQuery:U.search,searchResultsVisible:!ye.searchResults.hidden,soloChip:ye.soloChip.hidden?null:ye.soloChip.textContent,visibleCountText:ye.visibleCount.textContent,overviewDocked:U.overviewDocked,dockFolded:U.dockFolded,dockDismissed:U.dockDismissed,subgridVisible:U.subgridVisible},zones:{visible:U.zonesVisible,count:U.zoneRecords.size,focused:U.zoneRecords.get(U.focusedZoneID)?.zone.title||null,highlighted:[...U.highlightedZones].map(e=>U.zoneRecords.get(e)?.zone.title).filter(Boolean),focusedPins:U.pins.filter(e=>!e.filteredHidden&&e.insideHighlightedZone).length},grid:{enabled:U.gridEnabled,prefix:U.gridCell,maximumDepth:nV(),extent:U.gridEnabled?AI():null,cells:[...U.sources.grid.getFeatures(),...U.sources.gridContext.getFeatures()].map(e=>e.get("gridCell")),priorityPins:U.gridCell?U.pins.filter(e=>!e.filteredHidden&&Rd(e)).length:0}});window.__atlasDebug={snapshot:i,setLayerVisible:(e,t)=>U.layers[e]?.setVisible(t),refreshCatalog:oA},window.render_game_to_text=()=>JSON.stringify({coordinateSystem:"ATLAS:PIXELS; origin top-left; x increases right; y decreases downward",...i()}),window.advanceTime=()=>U.engine?.renderSync()}async function cre(){are();try{let i=await fetch("/data/catalog.json");if(!i.ok)throw new Error(`catalog request returned ${i.status}`);if(U.catalog=await i.json(),B0(ye.game,U.catalog.games,"title"),XI(),window.runtime?.EventsOn?.("atlas:catalog-changed",()=>{oA()}),U.catalog.games.length){let e=Rg(),t=Cg(),n=t&&(!e.game||e.game===t.game&&e.map===t.map);U.restore=n?t:null,await df(e.game||t?.game||U.catalog.games[0].slug,e.map||t?.map),U.restore=null}else ye.loading.hidden=!0;lre(),requestAnimationFrame(()=>ye.viewport.focus({preventScroll:!0}))}catch(i){ye.loading.hidden=!0,ye.fatalMessage.textContent=i instanceof Error?i.message:String(i),ye.fatal.hidden=!1}}cre();})();5288+}`;g4e(_4e);function t9(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 x4e(i){if(Array.isArray(i))return t9(i)}function Wb(i,e,t){return(e=T4e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function y4e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function v4e(){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 kie(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 rg(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?kie(Object(t),!0).forEach(function(n){Wb(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):kie(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function b4e(i,e){if(i==null)return{};var t,n,r=w4e(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 w4e(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 l4(i){return x4e(i)||y4e(i)||E4e(i)||v4e()}function S4e(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 T4e(i){var e=S4e(i,"string");return typeof e=="symbol"?e:e+""}function E4e(i,e){if(i){if(typeof i=="string")return t9(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)?t9(i,e):void 0}}function Gie(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 M4e=["rendererConfig","waitForGlobeReady"],Hb=rg(rg({},window.THREE?window.THREE:{AmbientLight:UA,DirectionalLight:BA,Vector2:Oe,REVISION:"185"}),{},{CSS2DRenderer:b3}),zie=Gie("globe",bk),C4e=Object.assign.apply(Object,l4(["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 Wb({},i,zie.linkProp(i))}))),R4e=Object.assign.apply(Object,l4(["globeMaterial","globeTileEngineClearCache","getGlobeRadius","getCoords","toGeoCoords"].map(function(i){return Wb({},i,zie.linkMethod(i))}))),Vie=Gie("renderObjs",e9),P4e=Object.assign.apply(Object,l4(["width","height","backgroundColor","backgroundImageUrl","enablePointerInteraction"].map(function(i){return Wb({},i,Vie.linkProp(i))}))),I4e=Object.assign.apply(Object,l4(["lights","postProcessingComposer"].map(function(i){return Wb({},i,Vie.linkMethod(i))}))),qie=Or({props:rg(rg({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}))}}},C4e),P4e),methods:rg(rg({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 Ws(r).to(o,n).easing(Br.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()}},R4e),I4e),stateInit:function(e){var t=e.rendererConfig,n=e.waitForGlobeReady,r=n===void 0?!0:n,s=b4e(e,M4e),o=new bk(rg({waitForGlobeReady:r},s));return{globe:o,renderObjs:e9({controlType:"orbit",rendererConfig:t,waitForLoadComplete:r,extraRenderers:[new Hb.CSS2DRenderer]}).skyRadius(o.getGlobeRadius()*500).showNavInfo(!1).objects([o]).lights([new Hb.AmbientLight(13421772,Math.PI),new Hb.DirectionalLight(16777215,.6*Math.PI)]),tweenGroup:new tm}},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 Hb.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}};Hb.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,R=v?v.__globeObjType:null,P=(w=v)!==null&&w!==void 0&&w.__data?l[R](v.__data,f):null;S&&S!==R&&p[S]&&p[S](null,T||null),R&&p[R]&&p[R](P,S===R?T:null),t.renderObjs.renderer().domElement.classList[R&&x[R]&&rt(t.showPointerCursor)(R,P)?"add":"remove"]("clickable"),t.hoverObj=v,t.hoverData=P}}).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),R=T.lat,P=T.lng;w.unshift({lat:R,lng:P})}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),R=T.lat,P=T.lng;w.unshift({lat:R,lng:P})}else w.push(n.toGeoCoords(S));l.hasOwnProperty(v)&&w.unshift(l[v](x.__data,f)),p[v].apply(p,w)}}}),this._animationCycle()}});var jie=4,Xb=100,Yb=Xb+.2,cd=8,N4e=96,Xie=.045,$ie=.08;function ix(i,e,t){let 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 $n=null,u4="",gs={group:null,tiles:new Map,key:"",variant:""},Do={group:null,cell:null,fitKey:""},Au={group:null,key:""},L4e=180,i9=null,rx=new Map,d4=new Map,Hie=new Map;function Yie(){let i=aV(U.map)==="sphere"&&lf(U.map)!==null;ye.globeToggle.hidden=!i,Kie(),!i&&$n&&(jb(),gs.group=null,Do.group=null,Do.cell=null,Au.group=null,Au.key="",$n._destructor(),$n=null,u4="",i9=null,ye.globe.replaceChildren())}function p4(){U.globeActive?Kie():Jie()}var $b=2.5,h4=2,sx=.08,A4=4;function D4e(i){let e=Number.isFinite(i)?i:h4;return Xr($b/2**(e-h4),sx,A4)}function s9(i){let e=Number.isFinite(i)?Math.max(i,sx/2):$b,t=(U.variant?.maxZoom??h4)+2;return Xr(h4+Math.log2($b/e),0,t)}function o9(i){if(!$n||!U.globeActive)return;let e=$n.pointOfView(),t=Xr((Number.isFinite(e.altitude)?e.altitude:$b)/2**i,sx,A4);$n.pointOfView({altitude:t},180)}function Kie(){let i=lf(U.map),e=U.engine?.getView();if($n&&U.globeActive&&i&&e){let t=$n.pointOfView(),[n,r]=i.toWorld(t.lat,t.lng);Number.isFinite(n)&&Number.isFinite(r)&&(e.cancelAnimations(),e.setCenter([n,-r]),e.setZoom(s9(t.altitude)))}U.globeActive=!1,ye.globe.hidden=!0,ye.globeToggle.setAttribute("aria-pressed","false"),ye.viewport.hidden=!1,jb(),U.overviewKey="",document.dispatchEvent(new Event("atlas:globe-camera"))}function Zie(){if(!$n||!U.globeActive)return null;let i=$n.pointOfView();return{lat:i.lat,lng:i.lng}}function Qie(i,e,t){if(!$n)return;let n=$n.pointOfView().altitude;$n.pointOfView({lat:i,lng:e,altitude:n},t?180:0)}async function Jie(){let i=lf(U.map);if(!i)return;if(U.globeActive=!0,ye.viewport.hidden=!0,ye.globe.hidden=!1,ye.globeToggle.setAttribute("aria-pressed","true"),U.overviewKey="",!$n){$n=qie({animateIn:!1})(ye.globe).backgroundColor("#0b0e12").showAtmosphere(!0).atmosphereColor("#8a6f5b").atmosphereAltitude(.12).objectLat(o=>o.lat).objectLng(o=>o.lng).objectAltitude(o=>o.pin===U.selectedPin?.03:.014).objectThreeObject(o=>j4e(o.pin)).objectLabel(o=>o.pin.location.title).onObjectClick(o=>Nx(o.pin)).onObjectHover(o=>{ye.globe.style.cursor=o?"pointer":""}).onZoom(()=>{document.dispatchEvent(new Event("atlas:globe-camera")),Wie(),c4(),X4e()}),document.addEventListener("atlas:selection",W4e),document.addEventListener("atlas:filters",n9),document.addEventListener("atlas:grid",()=>{f4(),n9(),c4()}),document.addEventListener("atlas:labels",c4),$n.onGlobeClick(({lat:o,lng:a})=>{if(!U.gridEnabled)return;let l=lf(U.map);if(!l)return;let[c,u]=l.toWorld(o,a),f=uo().descendTarget(U.gridCell,[c,-u]);f&&tA(f)});let s=$n.controls();s.minDistance=Xb*(1+sx),s.maxDistance=Xb*(1+A4),gs.group=new br,$n.scene().add(gs.group),Do.group=new br,$n.scene().add(Do.group),Au.group=new br,$n.scene().add(Au.group),window.__atlasGlobe={detail:gs,grid:Do,labels:Au,sprites:rx}}l9();let e=U.engine?.getView(),t=e?.getCenter();if(t&&Number.isFinite(t[0])&&Number.isFinite(t[1])){let[s,o]=i.toLatLng(t[0],-t[1]);$n.pointOfView({lat:s,lng:o,altitude:D4e(e.getZoom())})}else $n.pointOfView({lat:10,lng:0,altitude:$b});let n=U.variant||U.map.variants[0],r=`${U.game.stamp}:${U.map.slug}:${n.tiles}`;if(u4!==r){u4=r;let s=await Y4e(n);s&&u4===r&&$n.globeImageUrl(s)}i9!==U.pins&&(i9=U.pins,rx.clear(),d4.clear(),$n.objectsData($4e(i))),n9(),ire(),Wie(),f4(),c4(),document.dispatchEvent(new Event("atlas:globe-camera"))}function f4(){if(!$n||!Do.group)return;for(let t of[...Do.group.children])Do.group.remove(t),t.geometry?.dispose(),t.material?.map?.dispose(),t.material?.dispose();let i=U.globeActive?lf(U.map):null;if(!i||!U.gridEnabled){Do.cell=null;return}let e=uo();for(let t of oS()){let n=ere(t.ring,i),r=a9(n),s=sS(t,{subgridVisible:U.subgridVisible,labelled:B4e(t,r)});if(s){if(s.fill){let o=tre(e.center(t.hash),i);Do.group.add(U4e(n,o,s.fill))}Do.group.add(z4e(n,s.line)),s.label&&Do.group.add(V4e(s.label,r))}}Do.cell!==null&&Do.cell!==U.gridCell&&q4e(i),Do.cell=U.gridCell}function ere(i,e){return i.map(([t,n])=>e.toLatLng(t,-n))}function tre(i,e){return e.toLatLng(i[0],-i[1])}function F4e(i){let e=[];for(let t=0;t<i.length-1;t++){let[n,r]=i[t],[s,o]=i[t+1],a=Math.max(Math.abs(s-n),Math.abs(o-r)),l=Xr(Math.ceil(a/2),1,48);for(let c=0;c<l;c++){let u=c/l;e.push([n+(s-n)*u,r+(o-r)*u])}}return e}function a9(i){let e=-1/0,t=1/0,n=1/0,r=-1/0;for(let[s,o]of i)e=Math.max(e,s),t=Math.min(t,s),n=Math.min(n,o),r=Math.max(r,o);return{north:e,south:t,west:n,east:r}}function O4e(i){let e=$n.pointOfView(),t=Math.max(e.altitude,sx/2),n=50*Math.PI/180,r=2*t*Xb*Math.tan(n/2)/Math.max(1,ye.globe.clientHeight||1),s=Xb*Math.PI/180/r;return{width:Math.abs(i.east-i.west)*s,height:Math.abs(i.north-i.south)*s}}function B4e(i,e){let n=i.role==="neighbor"?Li.neighborLabelSizePx:Li.labelSizePx,r=`900 ${n}px ${Li.labelFont}`,s=O4e(e);return VI(i.hash,r)+9<=s.width&&n+6<=s.height}function U4e(i,e,t){let n=Yb+.12,r=F4e(i),s=a9(i),o=Math.max(s.east-s.west,s.north-s.south),a=Xr(Math.ceil(o/6),2,24),l=[...ix(e[0],e[1],n)],c=[];for(let w=1;w<=a;w++)for(let[S,T]of r){let R=w/a;l.push(...ix(e[0]+(S-e[0])*R,e[1]+(T-e[1])*R,n))}let u=r.length,f=(w,S)=>1+(w-1)*u+S%u;for(let w=0;w<u;w++)c.push(0,f(1,w),f(1,w+1));for(let w=1;w<a;w++)for(let S=0;S<u;S++)c.push(f(w,S),f(w+1,S),f(w,S+1)),c.push(f(w,S+1),f(w+1,S),f(w+1,S+1));let p=new qn;p.setAttribute("position",new Rn(l,3)),p.setIndex(c);let x=new Kr({color:t.color,transparent:!0,opacity:t.opacity,depthWrite:!1,side:2}),v=new Gn(p,x);return v.renderOrder=1,v}function c4(){if(!$n||!Au.group)return;let i=U.globeActive&&U.labelsHeld,e=i?$n.pointOfView():null,t=i?`${Math.round(e.lat)}:${Math.round(e.lng)}:${e.altitude.toFixed(2)}:${U.gridCell}`:"";if(t===Au.key)return;Au.key=t;for(let r of[...Au.group.children])Au.group.remove(r),r.material?.map?.dispose(),r.material?.dispose();if(!i)return;let n=[];for(let[r,s]of rx){if(!s.visible)continue;let o=d4.get(r);if(!o)continue;let a=k4e(e,o);a>85||n.push({pin:r,stood:o,distance:a})}n.sort((r,s)=>r.distance-s.distance);for(let{pin:r,stood:s}of n.slice(0,L4e))Au.group.add(G4e(r,s))}function k4e(i,e){let t=Math.PI/180,n=Math.sin(i.lat*t)*Math.sin(e.lat*t)+Math.cos(i.lat*t)*Math.cos(e.lat*t)*Math.cos((i.lng-e.lng)*t);return Math.acos(Xr(n,-1,1))*180/Math.PI}function G4e(i,e){let t=i.location.title,n=document.createElement("canvas"),r=n.getContext("2d"),s="600 26px Inter, system-ui, sans-serif";r.font=s;let o=Math.ceil(r.measureText(t).width)+24;n.width=o,n.height=40,r.font=s,r.textAlign="center",r.textBaseline="middle",r.fillStyle="rgba(10, 13, 17, 0.78)",r.fillRect(0,0,o,40),r.fillStyle="#e6ebf0",r.fillText(t,o/2,21);let a=new Vu({depthWrite:!1,sizeAttenuation:!1,transparent:!0});new Ya().load(n.toDataURL("image/png"),u=>{a.map=u,a.needsUpdate=!0});let l=new CA(a);l.position.set(...ix(e.lat,e.lng,Yb+.4));let c=.028;return l.scale.set(c*o/40,c,1),l.center.set(.5,0),l}function z4e(i,e){let t=[];for(let o=0;o<i.length-1;o++){let[a,l]=i[o],[c,u]=i[o+1],f=Math.max(Math.abs(c-a),Math.abs(u-l)),p=Xr(Math.ceil(f/2),4,48);for(let x=0;x<p;x++){let v=x/p;t.push(...ix(a+(c-a)*v,l+(u-l)*v,Yb+.25))}}t.push(...t.slice(0,3));let n=new x0;n.setPositions(t);let r=new zh({color:e.color,transparent:!0,opacity:e.opacity,linewidth:e.widthPx,depthWrite:!1});r.resolution.set(ye.globe.clientWidth||1,ye.globe.clientHeight||1);let s=new Y1(n,r);return s.computeLineDistances(),s.renderOrder=2,s}function V4e(i,e){let n=i.sizePx*2,r=`500 ${n}px ${Li.labelFont}`,s=`900 ${n}px ${Li.labelFont}`,o=document.createElement("canvas"),a=o.getContext("2d");a.font=r;let l=i.prefix?a.measureText(i.prefix).width:0;a.font=s;let c=a.measureText(i.final).width,u=10;o.width=Math.ceil(l+c+u*2),o.height=n+u*1.4,a.fillStyle=i.chip,a.fillRect(0,0,o.width,o.height),a.textBaseline="middle";let f=o.height/2+2;i.prefix&&(a.font=r,a.fillStyle=i.color,a.globalAlpha=Li.prefixAlpha*i.textAlpha,a.fillText(i.prefix,u,f)),a.font=s,a.globalAlpha=i.textAlpha,a.fillStyle=i.color,a.fillText(i.final,u+l,f),a.globalAlpha=1;let p=new Vu({depthWrite:!1,transparent:!0,sizeAttenuation:!1});new Ya().load(o.toDataURL("image/png"),R=>{p.map=R,p.needsUpdate=!0});let x=new CA(p),v=Math.abs(e.north-e.south)*.02,w=Math.abs(e.east-e.west)*.02;x.position.set(...ix(e.south+v,e.east-w,Yb+.35));let S=Math.max(1,ye.globe.clientHeight||1),T=o.height/2/S;return x.scale.set(T*o.width/o.height,T,1),x.center.set(1,0),x.renderOrder=3,x}function q4e(i){let t=oS().find(l=>l.role==="scope"||l.role==="leaf");if(!t)return;let[n,r]=tre(uo().center(t.hash),i),s=a9(ere(t.ring,i)),o=Math.max(s.east-s.west,s.north-s.south),a=Xr(o/45,sx,A4);$n.pointOfView({lat:n,lng:r,altitude:a},400)}function Wie(){if(!$n||!gs.group)return;let i=U.globeActive?U.variant||U.map.variants[0]:null;if(!i){jb();return}gs.variant!==i.tiles&&(jb(),gs.variant=i.tiles);let e=$n.pointOfView(),t=Math.min(Math.round(s9(e.altitude))+1,i.maxZoom);if(t<=jie||!i.formats[t]){jb(),gs.key="";return}let n=2**t,r=n/2,s=360/n,o=Math.acos(1/(1+e.altitude))*180/Math.PI+s,a=Math.floor(((e.lng+180)%360+360)%360/s),l=Math.floor((90-e.lat)/s),c=Math.ceil(o/s);for(;(2*c+1)**2>N4e&&c>1;)c--;let u=new Set;for(let p=-c;p<=c;p++){let x=l+p;if(!(x<0||x>=r))for(let v=-c;v<=c;v++){let w=((a+v)%n+n)%n;u.add(`${t}/${w}/${x}`)}}let f=`${i.tiles}:${[...u].sort().join(",")}`;if(f!==gs.key){gs.key=f;for(let[p,x]of gs.tiles)u.has(p)||(gs.group.remove(x),nre(x),gs.tiles.delete(p));for(let p of u){if(gs.tiles.has(p))continue;let[x,v,w]=p.split("/").map(Number),S=H4e(i,x,v,w);gs.tiles.set(p,S),gs.group.add(S)}}}function H4e(i,e,t,n){let r=360/2**e,s=-180+t*r,o=90-n*r,a=[],l=[],c=[];for(let w=0;w<=cd;w++){let S=o-w/cd*r;for(let T=0;T<=cd;T++){let R=s+T/cd*r;a.push(...ix(S,R,Yb)),l.push(T/cd,1-w/cd)}}let u=cd+1;for(let w=0;w<cd;w++)for(let S=0;S<cd;S++){let T=w*u+S;c.push(T,T+u,T+1),c.push(T+1,T+u,T+u+1)}let f=new qn;f.setAttribute("position",new Rn(a,3)),f.setAttribute("uv",new Rn(l,2)),f.setIndex(c);let p=new Kr,x=new Gn(f,p);x.visible=!1;let v=`${U.game.base}/tiles/${i.tiles}/${e}/${t}/${n}.${i.formats[e]}`;return new Ya().load(v,w=>{w.colorSpace=vr,p.map=w,p.needsUpdate=!0,x.visible=!0}),x}function jb(){if(gs.group){for(let i of gs.tiles.values())gs.group.remove(i),nre(i);gs.tiles.clear(),gs.key=""}}function nre(i){i.geometry.dispose(),i.material.map?.dispose(),i.material.dispose()}function ire(){if($n){for(let[i,e]of rx){let t=i===U.selectedPin;e.material=sre(i.category,t);let n=t?$ie:Xie;e.scale.set(n,n,1)}$n.objectAltitude(i=>i.pin===U.selectedPin?.03:.014)}}function W4e(){if(!$n||!U.globeActive)return;ire();let i=d4.get(U.selectedPin);if(i){let e=$n.pointOfView().altitude;$n.pointOfView({lat:i.lat,lng:i.lng,altitude:e},600)}}function rre(i){return!(i.filteredHidden||U.hiddenCategories.has(i.category.id)||U.gridEnabled&&U.gridCell&&!Rd(i))}function n9(){if(!(!$n||!U.globeActive))for(let[i,e]of rx)e.visible=rre(i)}function j4e(i){let e=new CA(sre(i.category,i===U.selectedPin)),t=i===U.selectedPin?$ie:Xie;return e.scale.set(t,t,1),e.visible=rre(i),rx.set(i,e),e}function sre(i,e){let t=`${Xx(i)}:${e?"ringed":"plain"}`,n=Hie.get(t);if(n)return n;n=new Vu({depthWrite:!1,sizeAttenuation:!1}),Hie.set(t,n);let r=U.markerIcons.get(Xx(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=J0(),l.strokeText(Dc(i.title),40,41),l.fillStyle=eA(i),l.fillText(Dc(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 Ya().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 ore(){U.globeActive&&Jie()}function l9(){!$n||ye.globe.hidden||($n.width(ye.globe.clientWidth).height(ye.globe.clientHeight),f4())}function X4e(){if(!$n||!U.globeActive||!U.gridEnabled)return;let i=$n.pointOfView(),e=`${U.gridCell}:${Math.round(s9(i.altitude)*2)}`;e!==Do.fitKey&&(Do.fitKey=e,f4())}function $4e(i){let e=[];for(let t of U.pins){let[n,r]=Og(t.location.lat,t.location.lng),[s,o]=i.toLatLng(n,-r);e.push({lat:s,lng:o,pin:t}),d4.set(t,{lat:s,lng:o})}return e}async function Y4e(i){let e=Math.min(jie,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=`${U.game.base}/tiles/${i.tiles}/${e}/${c}/${l}.${t}`;a.push(K4e(u).then(f=>{f&&o.drawImage(f,c*256,l*256,256,256)}))}return await Promise.all(a),s.toDataURL("image/jpeg",.92)}function K4e(i){return new Promise(e=>{let t=new Image;t.onload=()=>e(t),t.onerror=()=>e(null),t.src=i})}function are(){let i=U.variant,e=ye.overviewCanvas,t=e.getContext("2d"),n=Yh(),r=U.game.tileGrid.size,s=U.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=++U.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||!g4(i,l,T,S))continue;let R=new Image;R.onload=()=>{U.overviewRun===u&&t.drawImage(R,T*s-n[0]*c,S*s+n[3]*c,s,s)},R.src=`${U.game.base}/tiles/${encodeURIComponent(i.tiles)}/${l}/${T}/${S}.${f}`}ox()}function ox(){let i=Zie();if(i){let w=lf(U.map);if(!w||!U.variant)return;let S=Yh(),[T,R]=w.toWorld(i.lat,i.lng),P=ye.overviewCanvas,C=Xr((T-S[0])/(S[2]-S[0]),0,1),L=Xr((R+S[3])/(S[3]-S[1]),0,1);U.overviewKey="",ye.overviewShelf.hidden=!1;let D=ye.overviewViewport.style,F=22;D.left=`${C*P.width-F/2}px`,D.top=`${L*P.height-F/2}px`,D.width=`${F}px`,D.height=`${F}px`;return}let e=U.engine?.getView();if(!e||!U.variant)return;let t=Yh(),n=e.calculateExtent(U.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===U.overviewKey||(U.overviewKey=l,ye.overviewShelf.hidden=a,a))return;let c=ye.overviewCanvas,u=Xr((n[0]-t[0])/r,0,1),f=Xr((n[2]-t[0])/r,0,1),p=Xr((t[3]-n[3])/s,0,1),x=Xr((t[3]-n[1])/s,0,1),v=ye.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 m4(i,e=!0){U.overviewDocked=i,i&&U.overviewPointer!==null&&(U.overviewPointer=null,ax()),ye.overviewShelf.classList.toggle("is-docked",i),ye.overviewDock.setAttribute("aria-expanded",String(!i));let t=i?"Bring the overview back":"Put the overview away";ye.overviewDock.setAttribute("aria-label",t),ye.overviewDock.title=t,e&&Nc()}function c9(i,e){let t=ye.overviewCanvas.getBoundingClientRect(),n=Yh(),r=(a,l,c)=>Xr((a-l)/(c-l),0,1);if(U.globeActive){let a=lf(U.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);Qie(u,f,e);return}let s=U.engine?.getView();if(!s||!U.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 Gl(i){return new SH({updateWhileAnimating:!0,...i})}function lre(){let i=U.game.tileGrid.size,e=[0,-i,i,0];U.projection=new _d({code:"ATLAS:PIXELS",units:"pixels",extent:e}),U.sources={grid:new vf({wrapX:!1}),gridContext:new vf({wrapX:!1}),zoneScrim:new vf({wrapX:!1}),zones:new vf({wrapX:!1}),zoneTitles:new vf({wrapX:!1}),text:new vf({wrapX:!1}),pins:new vf({wrapX:!1}),priority:new vf({wrapX:!1})},U.layers={raster:new rN({zIndex:0}),rasterDetail:new rN({zIndex:1}),grid:Gl({source:U.sources.grid,style:zI,renderOrder:Kl,renderBuffer:40,zIndex:5}),zoneScrim:Gl({source:U.sources.zoneScrim,style:FV,zIndex:6}),zones:Gl({source:U.sources.zones,style:OV,renderBuffer:32,zIndex:10}),zoneTitles:Gl({source:U.sources.zoneTitles,style:BV,renderOrder:Kl,renderBuffer:160,zIndex:20}),zoneTitleDetail:Gl({source:U.sources.zoneTitles,style:UV,renderOrder:Kl,renderBuffer:160,zIndex:44}),text:Gl({source:U.sources.text,style:RV,renderOrder:Kl,renderBuffer:220,zIndex:30}),textDetail:Gl({source:U.sources.text,style:PV,renderOrder:Kl,renderBuffer:220,zIndex:45}),zoneText:Gl({source:U.sources.text,style:IV,renderOrder:Kl,renderBuffer:220,zIndex:41}),pins:Gl({source:U.sources.pins,style:EV,renderOrder:Kl,renderBuffer:48,zIndex:40}),zonePins:Gl({source:U.sources.pins,style:MV,renderOrder:Kl,renderBuffer:48,zIndex:42}),pinLabels:Gl({source:U.sources.pins,style:CV,renderOrder:Kl,renderBuffer:180,zIndex:45}),gridContext:Gl({source:U.sources.gridContext,style:zI,renderOrder:Kl,renderBuffer:40,zIndex:48}),priority:Gl({source:U.sources.priority,style:NV,renderOrder:Kl,renderBuffer:220,zIndex:50})},U.engine=new Kq({target:ye.viewport,layers:Object.values(U.layers),controls:wS({attribution:!1,rotate:!1,zoom:!1}),interactions:RS({onFocusOnly:!1}),view:x4(5)}),U.engine.on("movestart",()=>{U.engine.getViewport().classList.add("is-dragging")}),U.engine.on("moveend",()=>{U.engine.getViewport().classList.remove("is-dragging"),U.overviewPointer===null&&ax()}),U.engine.on("postrender",ox),ye.viewport.addEventListener("wheel",()=>{document.activeElement!==ye.viewport&&ye.viewport.focus({preventScroll:!0})},{capture:!0,passive:!0}),U.engine.on("singleclick",t=>{if(U.gridEnabled){let r=U.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===U.layers.grid||s===U.layers.gridContext});if(r){tA(r.hash);return}}let n=U.engine.forEachFeatureAtPixel(t.pixel,(r,s)=>_4(s)&&r.get("pin")||null,{hitTolerance:5,layerFilter:_4});n&&Nx(n)}),U.engine.on("pointermove",t=>{if(t.dragging){Bg(null);return}let n=U.engine.forEachFeatureAtPixel(t.pixel,(o,a)=>_4(a)&&o.get("pin")||null,{hitTolerance:4,layerFilter:_4}),r=n&&Ru(n.category)==="text"?null:n;Bg(r||null);let s=U.gridEnabled&&U.engine.hasFeatureAtPixel(t.pixel,{layerFilter:o=>o===U.layers.grid||o===U.layers.gridContext});U.engine.getTargetElement().style.cursor=n||s?"pointer":""}),U.engine.getViewport().addEventListener("pointerleave",()=>Bg(null))}function _4(i){return i===U.layers.pins||i===U.layers.zonePins||i===U.layers.pinLabels||i===U.layers.priority||i===U.layers.text||i===U.layers.textDetail||i===U.layers.zoneText}function x4(i,e=null){let t=U.game.tileGrid.size,n=e||[0,-t,t,0];return new Al({projection:U.projection,center:[(n[0]+n[2])/2,(n[1]+n[3])/2],resolutions:u9(i),minZoom:0,maxZoom:i,extent:n,constrainResolution:!1,smoothResolutionConstraint:!1,showFullExtent:!0,zoom:0})}function u9(i){let e=U.game.tileGrid.size/U.game.tileGrid.tileSize;return Array.from({length:i+1},(t,n)=>e/2**n)}async function df(i,e){U.game=U.catalog.games.find(r=>r.slug===i)||U.catalog.games[0],U.engine||lre(),!e&&!U.restore&&(U.restore=Rg(U.game.slug)),ye.game.value=U.game.slug,B0(ye.map,U.game.maps,"title"),ye.map.disabled=U.game.maps.length===1,ye.map.title=ye.map.disabled?"This game has one map":"Choose a map";let t=U.restore?.game===U.game.slug?U.restore:null,n=e&&U.game.maps.find(r=>r.slug===e)||t&&U.game.maps.find(r=>r.slug===t.map);await h9((n||U.game.maps[0]).slug)}async function h9(i){let e=U.game.maps.find(s=>s.slug===i)||U.game.maps[0],t=++U.mapRun;ye.loading.hidden=!1;let n;try{n=await JV(e)}catch{U.mapRun===t&&(ye.loading.hidden=!0,oA());return}if(U.mapRun!==t)return;U.settling=!0,U.map=n,document.documentElement.style.setProperty("--icon-outset-color",J0()),ye.map.value=U.map.slug,B0(ye.variant,U.map.variants,"name"),ye.variantField.hidden=U.map.variants.length<2,U.styleCache.clear(),Bg(null),U.gridCell="",U.gridSystem="geohash",U.hiddenCategories.clear(),U.collapsedSections.clear(),U.collapsedSections.add("zones");for(let s of U.map.groups)for(let o of s.categories)o.visible||U.hiddenCategories.add(o.id);let r=U.restore?.map===U.map.slug?U.restore:null;r&&(U.hiddenCategories=new Set(r.hidden),U.collapsedSections=new Set(r.collapsed)),m4(!!U.restore?.overviewDocked,!1),Zw(U.restore?!!U.restore.dockFolded:!0,!1),U.dockDismissed=!!U.restore?.dockDismissed,U.search="",ye.search.value="",ye.dock.hidden=!1,Oc(),YV(),qI(),XV(),f9(r?Xr(r.variant,0,U.map.variants.length-1):0,!0),Yie(),U.restore=null,ye.sidebar.classList.remove("is-open"),ye.mobileLegend.setAttribute("aria-expanded","false"),Dz(),U.settling=!1,Nc()}function f9(i,e=!1){let t=U.variant;U.variant=U.map.variants[i]||U.map.variants[0];let n=U.variant,r=e?null:J4e(t,n),s=Eu(n);if(ye.variant.value=String(U.map.variants.indexOf(U.variant)),e)U.engine.setView(x4(s,Yh()));else{let w=U.engine.getView(),S=x4(s,Yh());S.setCenter(w.getCenter()),S.setZoom(w.getZoom()||0),U.engine.setView(S)}let o=++U.tileRun,a=0;U.tileStats={requested:0,loaded:0,errors:0,peakPending:0},ye.loading.hidden=!1;let l=w=>{w.on("tileloadstart",()=>{U.tileRun===o&&(a++,U.tileStats.requested++,U.tileStats.peakPending=Math.max(U.tileStats.peakPending,a))});let S=T=>{U.tileRun===o&&(a=Math.max(0,a-1),T?U.tileStats.errors++:U.tileStats.loaded++,a===0&&U.tileStats.loaded>0&&(ye.loading.hidden=!0))};return w.on("tileloadend",()=>S(!1)),w.on("tileloaderror",()=>S(!0)),w},c=(w,S)=>l(new Nz({projection:U.projection,tileGrid:new Rx({extent:[0,-U.game.tileGrid.size,U.game.tileGrid.size,0],origin:[0,0],resolutions:u9(w),tileSize:U.game.tileGrid.tileSize}),cacheSize:64,interpolate:n.interpolate,transition:0,wrapX:!1,tileUrlFunction:([T,R,P])=>{let C=n.formats[T];if(!(!C||R<0||P<0||!S(T,R,P)))return`${U.game.base}/tiles/${encodeURIComponent(n.tiles)}/${T}/${R}/${P}.${C}`}})),u=n.fullZoom??n.maxZoom,f=c(u,(w,S,T)=>g4(n,w,S,T)),p=U.layers.raster.getSource();U.layers.raster.setSource(f),U.layers.raster.setExtent(Yh()),U.layers.raster.setBackground(n.background||void 0),p?.clear();let x=U.layers.rasterDetail.getSource();n.maxZoom>u?(U.layers.rasterDetail.setSource(c(n.maxZoom,(w,S,T)=>w>u&&g4(n,w,S,T))),U.layers.rasterDetail.setExtent(Yh()),U.layers.rasterDetail.setVisible(!0)):U.layers.rasterDetail.setVisible(!1),x?.clear(),rS(),U.gridEnabled&&(Tu(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed()),U.overviewKey="",are();let v=e&&U.restore?.map===U.map.slug?U.restore:null;if(U.renderedShard!==(n.shard||0)&&(qI(),$l()),v?.center&&Number.isFinite(v.zoom)){let w=U.engine.getView();w.setCenter(v.center),w.setZoom(v.zoom),U.fitZoom=v.zoom,sA()}else e?requestAnimationFrame(ePe):(r&&U.engine.getView().animate({center:r,duration:200}),sA());Nc()}function g4(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=Q4e(i,e,r),l=o*r.w+s;return(a[l>>3]&1<<(l&7))!==0}function Q4e(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 Eu(i){return i.maxZoom+2}function ax(){sA(),Nc()}function J4e(i,e){if(!i||!e||!i.shard||!e.shard||i.shard===e.shard||!i.bounds||!e.bounds)return null;let n=U.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+Xr(r,0,1)*e.bounds.width,-(e.bounds.y+Xr(s,0,1)*e.bounds.height)]}function cre(){let e=document.querySelector(".app-shell").classList.toggle("sidebar-collapsed");ye.mobileLegend.setAttribute("aria-expanded",String(!e)),requestAnimationFrame(()=>U.engine?.updateSize())}function Yh(){let i=U.game.tileGrid.size,e=U.variant?.bounds||{x:0,y:0,width:i,height:i};return[e.x,-(e.y+e.height),e.x+e.width,-e.y]}function ePe(){if(!U.engine||!U.variant)return;let i=U.engine.getView();i.fit(Yh(),{size:U.engine.getSize(),padding:[36,36,36,36],maxZoom:U.variant.maxZoom,duration:0}),U.fitZoom=i.getZoom()||0,sA()}function Kb(i){let e=U.engine.getView(),t=e.getZoom()||0;e.animate({zoom:Xr(t+i,U.variant.minZoom,Eu(U.variant)),duration:140})}function sA(){let i=U.engine?.getView().getZoom();if(ye.viewport.dataset.zoom=Number.isFinite(i)?i.toFixed(3):"",!U.engine||!U.pins.length){ye.visibleCount.textContent="0 locations visible";return}let e=U.engine.getView().calculateExtent(U.engine.getSize()),t=0;for(let n of U.pins){if(Zl(n))continue;let[r,s]=n.coordinate;r>=e[0]&&r<=e[2]&&s>=e[1]&&s<=e[3]&&t++}ye.visibleCount.textContent=`${Fc(U.eligibleLocations)} enabled \xB7 ${Fc(t)} in view`}function ure(){ye.game.addEventListener("change",()=>{df(ye.game.value)}),ye.map.addEventListener("change",()=>{h9(ye.map.value)}),ye.addBundles.addEventListener("click",()=>{YI()}),ye.emptyOpen.addEventListener("click",()=>{YI()}),ye.variant.addEventListener("change",()=>{f9(Number(ye.variant.value)),ore()}),ye.globeToggle.addEventListener("click",()=>p4()),ye.legend.addEventListener("change",n=>{let r=n.target;if(r.dataset.sectionToggle){ZV(r.dataset.sectionToggle);return}if(!r.dataset.category)return;let s=Number(r.dataset.category);r.checked?U.hiddenCategories.delete(s):U.hiddenCategories.add(s),$l(),Md()});let i=null,e=()=>{for(let s of ye.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&&ye.layers.contains(r)&&r.classList.add("is-hovered")};ye.layers.addEventListener("pointermove",n=>{i={x:n.clientX,y:n.clientY},e()},{passive:!0}),ye.layers.addEventListener("pointerleave",()=>{i=null,e()}),ye.layers.addEventListener("scroll",e,{passive:!0}),ye.layers.addEventListener("click",n=>{let r=n.target.closest("[data-only-category], [data-only-section]");if(r){n.preventDefault(),n.stopPropagation(),QV(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;U.collapsedSections.has(o)?U.collapsedSections.delete(o):U.collapsedSections.add(o),yS()}),ye.soloChip.addEventListener("click",()=>Yx(!0)),nn("#expand-all").addEventListener("click",()=>XI(!1)),nn("#collapse-all").addEventListener("click",()=>XI(!0)),nn("#show-all").addEventListener("click",()=>Yx(!0)),nn("#hide-all").addEventListener("click",()=>Yx(!1)),ye.zoneToggle.addEventListener("change",()=>{_S(ye.zoneToggle.checked)}),ye.zoneIndex.addEventListener("click",n=>{let r=n.target.closest("[data-zone]");r&&HV(Number(r.dataset.zone))}),ye.zoneIndex.addEventListener("contextmenu",n=>{let r=n.target.closest("[data-zone]");r&&(n.preventDefault(),WV(Number(r.dataset.zone)))}),ye.search.addEventListener("input",()=>{U.search=ye.search.value.trim().toLocaleLowerCase(),$l(),U.search&&Kw()}),ye.dockFold.addEventListener("click",()=>{tI(!U.dockFolded)}),ye.searchResults.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=U.pinByID.get(Number(r.dataset.location));s&&nI(s)}),ye.detailLinks.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=U.pinByID.get(Number(r.dataset.location));s&&nI(s)}),nn("#close-detail").addEventListener("click",Oc),nn("#zoom-in").addEventListener("click",()=>U.globeActive?o9(1):Kb(1)),nn("#zoom-out").addEventListener("click",()=>U.globeActive?o9(-1):Kb(-1)),ye.gridBack.addEventListener("click",gI),ye.gridInput.addEventListener("input",()=>{let n=uo(),r=n.normalizeInput(ye.gridInput.value);ye.gridInput.value=r,n.parseInput(r)!==null&&tA(r)}),ye.subgridToggle.addEventListener("click",()=>{Ux(!U.subgridVisible),ye.viewport.focus({preventScroll:!0})}),ye.gridInput.addEventListener("keydown",n=>{if(n.key===" "){n.preventDefault(),Ux(!U.subgridVisible);return}if(n.key==="`"){n.preventDefault(),ye.globeToggle.hidden||p4();return}n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),ye.viewport.focus({preventScroll:!0}))}),ye.viewport.addEventListener("keydown",n=>{if(!Yw(n.target)){if(n.key==="+"||n.key==="=")Kb(1);else if(n.key==="-")Kb(-1);else if(n.key==="Escape")Oc();else return;n.preventDefault()}}),window.addEventListener("contextmenu",n=>{Yw(n.target)||n.preventDefault()}),window.addEventListener("keydown",n=>{if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="r"){n.preventDefault(),location.reload();return}if(!Yw(n.target)){if(n.key==="`"&&!n.metaKey&&!n.ctrlKey&&!n.altKey){ye.globeToggle.hidden||(n.preventDefault(),p4());return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="k"){n.preventDefault(),ye.search.focus(),ye.search.select();return}if((n.metaKey||n.ctrlKey)&&n.altKey&&n.code==="KeyB"){n.preventDefault(),ye.dock.hidden||tI(!U.dockFolded);return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="b"){n.preventDefault(),cre();return}iV(n)||n.key.toLocaleLowerCase()==="z"&&(n.preventDefault(),n.repeat||xS(!0))}}),window.addEventListener("keyup",n=>{n.key.toLocaleLowerCase()==="z"&&xS(!1)}),window.addEventListener("blur",()=>xS(!1)),window.addEventListener("hashchange",()=>{let n=Pg();n.game===U.game?.slug&&n.map===U.map?.slug||(U.restore=null,df(n.game||U.catalog.games[0].slug,n.map))}),window.addEventListener("resize",()=>{U.engine?.updateSize(),ox(),l9()}),document.addEventListener("atlas:globe-camera",()=>ox()),ye.overview.addEventListener("pointerdown",n=>{U.overviewDocked||n.pointerType==="mouse"&&n.button!==0||(n.preventDefault(),ye.overview.setPointerCapture(n.pointerId),U.overviewPointer=n.pointerId,c9(n,!0))}),ye.overview.addEventListener("pointermove",n=>{U.overviewPointer===n.pointerId&&(n.preventDefault(),c9(n,!1))});let t=n=>{U.overviewPointer===n.pointerId&&(U.overviewPointer=null,ax())};ye.overview.addEventListener("pointerup",t),ye.overview.addEventListener("pointercancel",t),ye.overviewDock.addEventListener("click",()=>{m4(!U.overviewDocked),ye.viewport.focus({preventScroll:!0})}),ye.mobileLegend.addEventListener("click",()=>{let n=ye.sidebar.classList.toggle("is-open");ye.mobileLegend.setAttribute("aria-expanded",String(n))})}function hre(){let i=()=>({game:U.game?.title,map:U.map?.title,variant:U.variant?.name,zoom:U.engine?.getView().getZoom(),center:U.engine?.getView().getCenter(),resolution:U.engine?.getView().getResolution(),nativeMaxZoom:U.variant?.maxZoom,maxZoom:U.variant?Eu(U.variant):null,interpolate:U.variant?.interpolate,tileStats:{...U.tileStats},pins:U.pins.length,eligibleLocations:U.eligibleLocations,domNodes:document.querySelectorAll("*").length,canvases:document.querySelectorAll("canvas").length,rasterCacheSize:64,labelsHeld:U.labelsHeld,hoveredPin:U.hoveredPin?.location.title||null,selectedPin:U.selectedPin?.location.title||null,fitZoom:U.fitZoom,filters:{hiddenCategories:[...U.hiddenCategories].sort(),collapsedSections:[...U.collapsedSections].sort()},ui:{sidebarCollapsed:document.querySelector(".app-shell")?.classList.contains("sidebar-collapsed")??!1,detailOpen:!ye.detail.hidden,detailTitle:ye.detail.hidden?null:ye.detailTitle.textContent||null,searchQuery:U.search,searchResultsVisible:!ye.searchResults.hidden,soloChip:ye.soloChip.hidden?null:ye.soloChip.textContent,visibleCountText:ye.visibleCount.textContent,overviewDocked:U.overviewDocked,dockFolded:U.dockFolded,dockDismissed:U.dockDismissed,subgridVisible:U.subgridVisible},zones:{visible:U.zonesVisible,count:U.zoneRecords.size,focused:U.zoneRecords.get(U.focusedZoneID)?.zone.title||null,highlighted:[...U.highlightedZones].map(e=>U.zoneRecords.get(e)?.zone.title).filter(Boolean),focusedPins:U.pins.filter(e=>!e.filteredHidden&&e.insideHighlightedZone).length},grid:{enabled:U.gridEnabled,prefix:U.gridCell,maximumDepth:oV(),extent:U.gridEnabled?_I():null,cells:[...U.sources.grid.getFeatures(),...U.sources.gridContext.getFeatures()].map(e=>e.get("gridCell")),priorityPins:U.gridCell?U.pins.filter(e=>!e.filteredHidden&&Rd(e)).length:0}});window.__atlasDebug={snapshot:i,setLayerVisible:(e,t)=>U.layers[e]?.setVisible(t),refreshCatalog:oA},window.render_game_to_text=()=>JSON.stringify({coordinateSystem:"ATLAS:PIXELS; origin top-left; x increases right; y decreases downward",...i()}),window.advanceTime=()=>U.engine?.renderSync()}async function fre(){ure();try{let i=await fetch("/data/catalog.json");if(!i.ok)throw new Error(`catalog request returned ${i.status}`);if(U.catalog=await i.json(),B0(ye.game,U.catalog.games,"title"),$I(),window.runtime?.EventsOn?.("atlas:catalog-changed",()=>{oA()}),U.catalog.games.length){let e=Pg(),t=Rg(),n=t&&(!e.game||e.game===t.game&&e.map===t.map);U.restore=n?t:null,await df(e.game||t?.game||U.catalog.games[0].slug,e.map||t?.map),U.restore=null}else ye.loading.hidden=!0;hre(),requestAnimationFrame(()=>ye.viewport.focus({preventScroll:!0}))}catch(i){ye.loading.hidden=!0,ye.fatalMessage.textContent=i instanceof Error?i.message:String(i),ye.fatal.hidden=!1}}fre();})();@@ -71,3 +71,39 @@ export function applicableSystems(map) {
7171 export function activeSystem() {7272 return cellSystems.find((system) => system.slug === state.gridSystem) || geohashSystem;7373 }74+75+// clipRingX cuts a closed ring against two vertical edges -- the standard76+// Sutherland-Hodgman walk, one edge at a time. It exists for rings that77+// left the surface's x-range by staying continuous across the antimeridian:78+// the chart clips the unwrapped ring once as it lies and once shifted a79+// world over, and draws the pieces. Returns a closed ring, or [] when80+// nothing survives.81+export function clipRingX(ring, minimumX, maximumX) {82+ let points = ring[0] === ring[ring.length - 1] || samePoint(ring[0], ring[ring.length - 1])83+ ? ring.slice(0, -1)84+ : [...ring];85+ for (const [edge, keep] of [86+ [minimumX, ([x]) => x >= minimumX],87+ [maximumX, ([x]) => x <= maximumX],88+ ]) {89+ const output = [];90+ for (let at = 0; at < points.length; at++) {91+ const current = points[at];92+ const previous = points[(at + points.length - 1) % points.length];93+ const currentIn = keep(current);94+ const previousIn = keep(previous);95+ if (currentIn !== previousIn) {96+ const t = (edge - previous[0]) / (current[0] - previous[0]);97+ output.push([edge, previous[1] + t * (current[1] - previous[1])]);98+ }99+ if (currentIn) output.push(current);100+ }101+ points = output;102+ if (points.length === 0) return [];103+ }104+ return [...points, points[0]];105+}106+107+function samePoint(a, b) {108+ return a[0] === b[0] && a[1] === b[1];109+}@@ -333,15 +333,20 @@ function rebuildGlobeGrid() {
333333 grid.cell = null;334334 return;335335 }336+ const system = activeSystem();336337 for (const cell of gridCellPlan()) {337- const corners = cellCorners(cell.extent, mapping);338+ const ringLL = ringLatLng(cell.ring, mapping);339+ const corners = ringBounds(ringLL);338340 const visual = gridCellVisual(cell, {339341 subgridVisible: state.subgridVisible,340342 labelled: gridLabelFits(cell, corners),341343 });342344 if (!visual) continue;343- if (visual.fill) grid.group.add(cellFill(corners, visual.fill));344- grid.group.add(cellBoundary(corners, visual.line));345+ if (visual.fill) {346+ const centerLL = pointLatLng(system.center(cell.hash), mapping);347+ grid.group.add(ringFill(ringLL, centerLL, visual.fill));348+ }349+ grid.group.add(cellBoundary(ringLL, visual.line));345350 if (visual.label) grid.group.add(cellChip(visual.label, corners));346351 }347352 if (grid.cell !== null && grid.cell !== state.gridCell) {@@ -350,6 +355,52 @@ function rebuildGlobeGrid() {
350355 grid.cell = state.gridCell;351356 }352357 358+// ringLatLng lands a system's world-pixel ring on the sphere. The ring is359+// continuous by contract, so a loop that crossed the antimeridian simply360+// carries longitudes past 180 -- the trigonometry underneath is periodic361+// and drapes it where it belongs, which is why the globe never needs the362+// splitting the chart does.363+function ringLatLng(ring, mapping) {364+ return ring.map(([x, y]) => mapping.toLatLng(x, -y));365+}366+367+function pointLatLng(point, mapping) {368+ return mapping.toLatLng(point[0], -point[1]);369+}370+371+// densifyRing subdivides each ring segment by its span, returning the open372+// loop the fill fans from.373+function densifyRing(ringLL) {374+ const open = [];375+ for (let at = 0; at < ringLL.length - 1; at++) {376+ const [fromLat, fromLng] = ringLL[at];377+ const [toLat, toLng] = ringLL[at + 1];378+ const span = Math.max(Math.abs(toLat - fromLat), Math.abs(toLng - fromLng));379+ const steps = clamp(Math.ceil(span / 2), 1, 48);380+ for (let step = 0; step < steps; step++) {381+ const t = step / steps;382+ open.push([fromLat + (toLat - fromLat) * t, fromLng + (toLng - fromLng) * t]);383+ }384+ }385+ return open;386+}387+388+// ringBounds is the cell's frame in degrees, for the fit gate, the chip389+// anchor, and the camera.390+function ringBounds(ringLL) {391+ let north = -Infinity;392+ let south = Infinity;393+ let west = Infinity;394+ let east = -Infinity;395+ for (const [lat, lng] of ringLL) {396+ north = Math.max(north, lat);397+ south = Math.min(south, lat);398+ west = Math.min(west, lng);399+ east = Math.max(east, lng);400+ }401+ return { north, south, west, east };402+}403+353404 // cellScreenPx estimates how many pixels a cell spans on screen: degrees of354405 // ground per pixel fall out of the camera's distance and field of view. It355406 // is the globe's answer to the chart's extent-over-resolution, feeding the@@ -379,54 +430,57 @@ function gridLabelFits(cell, corners) {
379430 return measureLabel(cell.hash, font) + 9 <= px.width && size + 6 <= px.height;380431 }381432 382-// cellFill lays a cell's tint or dim on the ground: a translucent quad just383-// off the detail tiles, under the boundary lines.384-function cellFill(corners, fill) {385- const geometry = quadGeometry(corners, detailRadius + 0.12);433+// ringFill lays a cell's tint or dim on the ground: a fan of triangles434+// from the cell's own centre out to its ring, each spoke subdivided so the435+// sheet follows the curve instead of sagging under it, just off the detail436+// tiles and under the boundary lines.437+function ringFill(ringLL, centerLL, fill) {438+ const radius = detailRadius + 0.12;439+ // The fan needs spokes as dense as the boundary's steps: with only the440+ // ring's own corners, the sheet between spokes sags below the ground and441+ // the fill opens into almond-shaped gaps.442+ const open = densifyRing(ringLL);443+ const bounds = ringBounds(ringLL);444+ const span = Math.max(bounds.east - bounds.west, bounds.north - bounds.south);445+ const rows = clamp(Math.ceil(span / 6), 2, 24);446+ const positions = [...surfacePoint(centerLL[0], centerLL[1], radius)];447+ const indices = [];448+ for (let row = 1; row <= rows; row++) {449+ for (const [lat, lng] of open) {450+ const t = row / rows;451+ positions.push(...surfacePoint(452+ centerLL[0] + (lat - centerLL[0]) * t,453+ centerLL[1] + (lng - centerLL[1]) * t,454+ radius,455+ ));456+ }457+ }458+ const count = open.length;459+ const at = (row, index) => 1 + (row - 1) * count + (index % count);460+ for (let index = 0; index < count; index++) {461+ indices.push(0, at(1, index), at(1, index + 1));462+ }463+ for (let row = 1; row < rows; row++) {464+ for (let index = 0; index < count; index++) {465+ indices.push(at(row, index), at(row + 1, index), at(row, index + 1));466+ indices.push(at(row, index + 1), at(row + 1, index), at(row + 1, index + 1));467+ }468+ }469+ const geometry = new BufferGeometry();470+ geometry.setAttribute("position", new Float32BufferAttribute(positions, 3));471+ geometry.setIndex(indices);386472 const material = new MeshBasicMaterial({387473 color: fill.color,388474 transparent: true,389475 opacity: fill.opacity,390476 depthWrite: false,477+ side: 2,391478 });392479 const mesh = new Mesh(geometry, material);393480 mesh.renderOrder = 1;394481 return mesh;395482 }396483 397-// quadGeometry drapes one lat/lng rectangle on the sphere, subdivided398-// enough to follow the curve: a flat chord across a wide cell sags below399-// the surface by more than the layer's clearance, and the ground pokes400-// through the fill in polka dots. Tessellation follows the span so the sag401-// stays a fraction of the clearance at any size.402-function quadGeometry(corners, radius) {403- const positions = [];404- const indices = [];405- const span = Math.max(406- Math.abs(corners.east - corners.west),407- Math.abs(corners.north - corners.south),408- );409- const steps = clamp(Math.ceil(span / 2), 6, 48);410- for (let i = 0; i <= steps; i++) {411- const lat = corners.north + ((corners.south - corners.north) * i) / steps;412- for (let j = 0; j <= steps; j++) {413- const lng = corners.west + ((corners.east - corners.west) * j) / steps;414- positions.push(...surfacePoint(lat, lng, radius));415- }416- }417- for (let i = 0; i < steps; i++) {418- for (let j = 0; j < steps; j++) {419- const corner = i * (steps + 1) + j;420- indices.push(corner, corner + steps + 1, corner + 1);421- indices.push(corner + 1, corner + steps + 1, corner + steps + 2);422- }423- }424- const geometry = new BufferGeometry();425- geometry.setAttribute("position", new Float32BufferAttribute(positions, 3));426- geometry.setIndex(indices);427- return geometry;428-}429-430484 // rebuildGlobeLabels raises names over the pins while Z is held: the ones431485 // nearest what the camera faces, within a budget -- a planet of two432486 // thousand names at once is noise, and the chart's own flood is bounded by@@ -510,37 +564,25 @@ function labelSprite(pin, stood) {
510564 return sprite;511565 }512566 513-// cellCorners lands a cell's chart extent on the sphere: latitudes and514-// longitudes of its frame, through the map's declared flattening.515-function cellCorners(extent, mapping) {516- const [west, north] = mapping.toLatLng(extent[0], -extent[3]).reverse();517- const [east, south] = mapping.toLatLng(extent[2], -extent[1]).reverse();518- return { west, north, east, south };519-}520-521567 // cellBoundary drapes a cell's frame at its token weight. WebGL's plain522568 // lines are one pixel whatever they ask for, so the frame is a fat line --523569 // Line2 -- whose width is spoken in the same pixels the chart strokes.524-function cellBoundary(corners, line) {570+// The ring arrives pre-tessellated by its system; each segment is further571+// subdivided by its own span so long geohash edges still follow the curve.572+function cellBoundary(ringLL, line) {525573 const positions = [];526- const span = Math.max(527- Math.abs(corners.east - corners.west),528- Math.abs(corners.north - corners.south),529- );530- const steps = clamp(Math.ceil(span / 2), 12, 48);531- const point = (t, fromLat, fromLng, toLat, toLng) => [532- fromLat + (toLat - fromLat) * t,533- fromLng + (toLng - fromLng) * t,534- ];535- const edges = [536- [corners.north, corners.west, corners.north, corners.east],537- [corners.north, corners.east, corners.south, corners.east],538- [corners.south, corners.east, corners.south, corners.west],539- [corners.south, corners.west, corners.north, corners.west],540- ];541- for (const edge of edges) {574+ for (let at = 0; at < ringLL.length - 1; at++) {575+ const [fromLat, fromLng] = ringLL[at];576+ const [toLat, toLng] = ringLL[at + 1];577+ const span = Math.max(Math.abs(toLat - fromLat), Math.abs(toLng - fromLng));578+ const steps = clamp(Math.ceil(span / 2), 4, 48);542579 for (let step = 0; step < steps; step++) {543- positions.push(...surfacePoint(...point(step / steps, ...edge), detailRadius + 0.25));580+ const t = step / steps;581+ positions.push(...surfacePoint(582+ fromLat + (toLat - fromLat) * t,583+ fromLng + (toLng - fromLng) * t,584+ detailRadius + 0.25,585+ ));544586 }545587 }546588 positions.push(...positions.slice(0, 3));@@ -628,13 +670,11 @@ function frameGridCell(mapping) {
628670 const plan = gridCellPlan();629671 const chosen = plan.find((cell) => cell.role === "scope" || cell.role === "leaf");630672 if (!chosen) return;631- const corners = cellCorners(chosen.extent, mapping);632- const lat = (corners.north + corners.south) / 2;633- const lng = (corners.west + corners.east) / 2;634- const span = Math.max(635- Math.abs(corners.east - corners.west),636- Math.abs(corners.north - corners.south),637- );673+ // The camera aims where the system says the cell's middle is -- a pole674+ // cap's middle is the pole, which no frame corner would have named.675+ const [lat, lng] = pointLatLng(activeSystem().center(chosen.hash), mapping);676+ const bounds = ringBounds(ringLatLng(chosen.ring, mapping));677+ const span = Math.max(bounds.east - bounds.west, bounds.north - bounds.south);638678 const altitude = clamp(span / 45, nearestAltitude, farthestAltitude);639679 globe.pointOfView({ lat, lng, altitude }, 400);640680 }@@ -5,9 +5,10 @@
55 // the state, the navigator, and the plan both renderers draw from, and it66 // no longer knows what a geohash is.77 import Feature from "ol/Feature.js";8+import MultiPolygon from "ol/geom/MultiPolygon.js";89 import Polygon from "ol/geom/Polygon.js";910 10-import { activeSystem } from "./cellsystems/index.js";11+import { activeSystem, clipRingX, surfaceExtent } from "./cellsystems/index.js";1112 import { gridTheme, palette } from "./constants.js";1213 import { closeDetail } from "./detail.js";1314 import { elements } from "./dom.js";@@ -276,11 +277,38 @@ export function addGridFeature(cell) {
276277 }277278 278279 // gridGeometry tiles one plan cell for the chart. A system's ring is a279-// closed loop already; today every ring stays within the surface, and the280-// wrap-and-pole cases arrive with the first system whose cells are not281-// rectangles of the picture.280+// closed, continuous loop; most rings lie within the surface and become a281+// plain polygon -- every geohash ring does, byte for byte as before. A282+// cell holding a pole circles it, so its loop closes along the pole's own283+// edge of the picture; and a ring that stayed continuous across the284+// antimeridian is drawn twice, clipped to the surface as it lies and285+// shifted a world over, so the one cell appears as its two pieces.282286 function gridGeometry(cell) {283- return new Polygon([cell.ring]);287+ const surface = surfaceExtent();288+ let ring = cell.ring;289+ if (cell.pole) {290+ const poleY = cell.pole === "north" ? surface[3] : surface[1];291+ const open = ring.slice(0, -1);292+ ring = [293+ ...open,294+ [open[open.length - 1][0], poleY],295+ [open[0][0], poleY],296+ open[0],297+ ];298+ }299+ const inside = ring.every(([x]) => x >= surface[0] && x <= surface[2]);300+ if (inside) return new Polygon([ring]);301+ const width = surface[2] - surface[0];302+ const pieces = [];303+ for (const shift of [0, -width, width]) {304+ const clipped = clipRingX(305+ ring.map(([x, y]) => [x + shift, y]),306+ surface[0],307+ surface[2],308+ );309+ if (clipped.length >= 4) pieces.push([clipped]);310+ }311+ return new MultiPolygon(pieces);284312 }285313 286314 export function currentGridExtent() {@@ -6,7 +6,7 @@ import assert from "node:assert/strict";
66 import test from "node:test";77 88 import { state } from "../src/state.js";9-import { surfaceExtent } from "../src/cellsystems/index.js";9+import { clipRingX, surfaceExtent } from "../src/cellsystems/index.js";1010 import { geohashSystem, geohashCellAt } from "../src/cellsystems/geohash.js";1111 1212 function onSquareSurface() {@@ -56,6 +56,32 @@ test("normalizeInput keeps what the alphabet keeps", () => {
5656 assert.equal(geohashSystem.parseInput(""), "", "the root is a place");5757 });5858 59+test("clipRingX cuts a wrapped ring against the surface edges", () => {60+ // The clip may start its ring at any vertex; the shape is what matters.61+ const canonical = (ring) => {62+ const open = ring.slice(0, -1).map(([x, y]) => `${x},${y}`);63+ const start = open.indexOf([...open].sort()[0]);64+ return [...open.slice(start), ...open.slice(0, start)].join(" ");65+ };66+ // A square straddling the right edge at x=100: the piece as it lies.67+ const straddling = [[80, -10], [80, -30], [120, -30], [120, -10], [80, -10]];68+ assert.equal(69+ canonical(clipRingX(straddling, 0, 100)),70+ canonical([[80, -10], [80, -30], [100, -30], [100, -10], [80, -10]]),71+ );72+ // Shifted a world (100) left, the other piece appears at the left edge.73+ const shifted = straddling.map(([x, y]) => [x - 100, y]);74+ assert.equal(75+ canonical(clipRingX(shifted, 0, 100)),76+ canonical([[0, -10], [0, -30], [20, -30], [20, -10], [0, -10]]),77+ );78+ // A ring entirely outside survives as nothing.79+ assert.deepEqual(clipRingX(shifted.map(([x, y]) => [x - 200, y]), 0, 100), []);80+ // A ring entirely inside comes back whole, closed, in its own order.81+ const inside = [[10, -10], [10, -20], [20, -20], [20, -10], [10, -10]];82+ assert.deepEqual(clipRingX(inside, 0, 100), inside);83+});84+5985 test("plan primitives stay stable", () => {6086 onSquareSurface();6187 const children = geohashSystem.children("m");