@reearth/core 0.0.7-alpha.70 → 0.0.7-alpha.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core.umd.cjs CHANGED
@@ -21,7 +21,7 @@ ${h.message}`)}if(u){r.push(...a.actions),o=a;break}}return o?[o]:void 0}get eve
21
21
  <%s {...props} />
22
22
  React keys must be passed directly to JSX without using spread:
23
23
  let props = %s;
24
- <%s key={someKey} {...props} />`,q,be,Ae,be),J[be+q]=!0)}if(be=null,Q!==void 0&&(n(Q),be=""+Q),s(W)&&(n(W.key),be=""+W.key),"key"in W){Q={};for(var Pe in W)Pe!=="key"&&(Q[Pe]=W[Pe])}else Q=W;return be&&a(Q,typeof z=="function"?z.displayName||z.name||"Unknown":z),l(z,be,Q,r(),oe,Ee)}function h(z){d(z)?z._store&&(z._store.validated=1):typeof z=="object"&&z!==null&&z.$$typeof===G&&(z._payload.status==="fulfilled"?d(z._payload.value)&&z._payload.value._store&&(z._payload.value._store.validated=1):z._store&&(z._store.validated=1))}function d(z){return typeof z=="object"&&z!==null&&z.$$typeof===p}var f=R,p=Symbol.for("react.transitional.element"),m=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),g=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),S=Symbol.for("react.consumer"),E=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),V=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),G=Symbol.for("react.lazy"),N=Symbol.for("react.activity"),k=Symbol.for("react.client.reference"),P=f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,w=Object.prototype.hasOwnProperty,x=Array.isArray,I=console.createTask?console.createTask:function(){return null};f={react_stack_bottom_frame:function(z){return z()}};var X,D={},Y=f.react_stack_bottom_frame.bind(f,o)(),H=I(i(o)),J={};Xm.Fragment=y,Xm.jsx=function(z,W,Q){var q=1e4>P.recentlyCreatedOwnerStacks++;return u(z,W,Q,!1,q?Error("react-stack-top-frame"):Y,q?I(i(z)):H)},Xm.jsxs=function(z,W,Q){var q=1e4>P.recentlyCreatedOwnerStacks++;return u(z,W,Q,!0,q?Error("react-stack-top-frame"):Y,q?I(i(z)):H)}})()),Xm}var MM;function Cne(){return MM||(MM=1,process.env.NODE_ENV==="production"?Sv.exports=Ene():Sv.exports=Tne()),Sv.exports}var Zm=Cne();function Rne(e,t){return t?Ev(e).reduce((n,[i,r])=>(tf(t,i)&&(n[i]=r),n),{}):{}}function Ev(e){return Object.keys(e).map(t=>[t,e[t]])}function tf(e,t){return!!e&&e.indexOf(t)!==-1}function Ine(e,t){return!!e&&!!t&&[...Object.keys(e),...Object.keys(t)].every(n=>e[n]===t[n])}function Mne(e){return e&&typeof e.isDestroyed=="function"&&typeof e.destroy=="function"}function Lne(e){return Mne(e)&&e.isDestroyed()}function lc(e){return e&&typeof e=="object"&&"then"in e&&typeof e.then=="function"}const Xu="__RESIUM_EVENT_MANAGER",Tv=["onClick","onDoubleClick","onMouseDown","onMouseUp","onMiddleClick","onMiddleDown","onMiddleUp","onMouseMove","onPinchEnd","onPinchMove","onPinchStart","onRightClick","onRightDown","onRightUp","onWheel","onMouseEnter","onMouseLeave"];let LM=class FD{static eventTypeMap={onClick:M.ScreenSpaceEventType.LEFT_CLICK,onDoubleClick:M.ScreenSpaceEventType.LEFT_DOUBLE_CLICK,onMouseDown:M.ScreenSpaceEventType.LEFT_DOWN,onMouseUp:M.ScreenSpaceEventType.LEFT_UP,onMiddleClick:M.ScreenSpaceEventType.MIDDLE_CLICK,onMiddleDown:M.ScreenSpaceEventType.MIDDLE_DOWN,onMiddleUp:M.ScreenSpaceEventType.MIDDLE_UP,onMouseMove:M.ScreenSpaceEventType.MOUSE_MOVE,onPinchEnd:M.ScreenSpaceEventType.PINCH_END,onPinchMove:M.ScreenSpaceEventType.PINCH_MOVE,onPinchStart:M.ScreenSpaceEventType.PINCH_START,onRightClick:M.ScreenSpaceEventType.RIGHT_CLICK,onRightDown:M.ScreenSpaceEventType.RIGHT_DOWN,onRightUp:M.ScreenSpaceEventType.RIGHT_UP,onWheel:M.ScreenSpaceEventType.WHEEL,onMouseEnter:M.ScreenSpaceEventType.MOUSE_MOVE,onMouseLeave:M.ScreenSpaceEventType.MOUSE_MOVE};scene;sshe;events={onClick:new Map,onDoubleClick:new Map,onMouseDown:new Map,onMouseUp:new Map,onMiddleClick:new Map,onMiddleDown:new Map,onMiddleUp:new Map,onMouseMove:new Map,onPinchEnd:new Map,onPinchMove:new Map,onPinchStart:new Map,onRightClick:new Map,onRightDown:new Map,onRightUp:new Map,onWheel:new Map,onMouseEnter:new Map,onMouseLeave:new Map};hovered=void 0;constructor(t){this.scene=t,this.sshe=new M.ScreenSpaceEventHandler(t?.canvas)}destroy(){this.hovered=void 0,this.sshe.isDestroyed()||this.sshe.destroy()}isDestroyed(){return this.sshe.isDestroyed()}on(t,n,i){t&&n==="onWheel"||this.events[n].set(t,i)}off(t,n){this.events[n].delete(t),this.hovered===t&&(this.hovered=void 0)}setEvents(t,n){Ev(n).forEach(([i,r])=>{const o=i;tf(Tv,o)&&(r?this.on(t,o,r):this.off(t,o))}),this.commit()}clearEvents(t){this.hovered=void 0,Tv.forEach(n=>{this.off(t,n)}),this.commit()}commit(){const t=this.sshe,n=this.sshe.isDestroyed();n||(this.events.onMouseEnter.size===0&&this.events.onMouseLeave.size===0&&this.events.onMouseMove.size===0?this.sshe.removeInputAction(M.ScreenSpaceEventType.MOUSE_MOVE):this.sshe.getInputAction(M.ScreenSpaceEventType.MOUSE_MOVE)||this.sshe.setInputAction(this.onMouseMove,M.ScreenSpaceEventType.MOUSE_MOVE)),Ev(this.events).forEach(([i,r])=>{if(i==="onMouseEnter"||i==="onMouseLeave"||i==="onMouseMove")return;const o=FD.eventTypeMap[i];n||(r.size===0?t.removeInputAction(o):t.getInputAction(o)||t.setInputAction(this.eventCallback(i),o))})}getScreenSpaceEventHandler(){return this.sshe}getEventCallback(t,n){return n===null?this.events[t].get(null):this.events[t].get(n.id)||this.events[t].get(n.id?.entityCollection?.owner)||this.events[t].get(n.primitive)||this.events[t].get(n.tileset)}onMouseMove=t=>{const n=this.pick(t.endPosition);this.hovered!==n&&(this.hovered&&(this.getEventCallback("onMouseLeave",this.hovered)?.(t,this.hovered),this.getEventCallback("onMouseLeave",null)?.(t,this.hovered)),n&&(this.getEventCallback("onMouseEnter",n)?.(t,n),this.getEventCallback("onMouseEnter",null)?.(t,n))),n&&this.getEventCallback("onMouseMove",n)?.(t,n),this.getEventCallback("onMouseMove",null)?.(t,n),this.hovered=n};eventCallback=t=>n=>{const i=this.pick(n?.position);i&&this.getEventCallback(t,i)?.(n,i),this.getEventCallback(t,null)?.(n,i)};pick(t){if(t)return this.scene?.pick(t)}};const Pne=({name:e,create:t,destroy:n,provide:i,update:r,cesiumReadonlyProps:o,cesiumEventProps:s,otherProps:a,setCesiumPropsAfterCreate:c,useCommonEvent:l,useRootEvent:u},h,d)=>{const f=R.useRef(void 0),p=Qn(),m=R.useRef(i?{}:void 0),y=R.useRef({}),g=R.useRef(PM(h)),v=R.useRef({}),[S,E]=R.useState(!1),C=R.useRef(!1),O=R.useRef(null),V=R.useRef(void 0),A=p?.[Xu],G=R.useRef(void 0),N=R.useRef(void 0),k=R.useCallback(async I=>{if(!f.current)return;const X=f.current,D=Object.keys(I),Y=Object.keys(s||[]),H=D.concat(Object.keys(v.current).filter(W=>!D.includes(W))).filter(W=>v.current[W]!==I[W]).map(W=>[W,v.current[W],I[W]]),J=[];for(const[W,Q,q]of H)if(o?.includes(W))J.push(W);else if(tf(Y,W)){const oe=s?.[W],Ee=X[oe];Ee instanceof M.Event&&(typeof Q>"u"?(Ee.addEventListener(q),y.current[oe]=q):typeof q>"u"?(Ee.removeEventListener(Q),delete y.current[oe]):(Ee.removeEventListener(Q),Ee.addEventListener(q)))}else W!=="children"&&!Tv.includes(W)&&!a?.includes(W)&&(X[W]=q);const z=u?m.current?.[Xu]:A;if(l&&z&&f.current&&z.setEvents(u?null:f.current,I),r&&C.current){const W=r(f.current,I,v.current,p);lc(W)&&await W}v.current=I,g.current=I,C.current&&J.length>0&&(process.env.NODE_ENV!=="production"&&console.warn(`Warning: <${e}> is recreated because following read-only props have been updated: ${J.join(", ")}`),w(),await x(),G.current=P())},[]),P=R.useCallback(async()=>{await new Promise(Y=>queueMicrotask(()=>Y(void 0)));const I=t?.(p,g.current,O.current);let X;if(lc(I)?X=await I:X=I,Array.isArray(X)?(f.current=X[0],V.current=X[1]):f.current=X,c)await k(g.current);else{if(f.current&&s){const Y=f.current;for(const H of Object.keys(g.current)){const J=s[H];if(J){const z=g.current[H],W=Y[J];z&&W instanceof M.Event&&W.addEventListener(z)}}}v.current=g.current}i&&f.current&&(m.current={...p,...i(f.current,p,h,V.current)});const D=u?m.current?.[Xu]:A;l&&D&&f.current&&D.setEvents(u?null:f.current,g.current),N.current||E(!0)},[]),w=R.useCallback(()=>{E(!1),C.current=!1},[]),x=R.useCallback(async()=>{await new Promise(X=>queueMicrotask(()=>X(void 0))),G.current&&(await G.current,G.current=void 0),f.current&&n&&n(f.current,p,O.current,V.current);const I=u?m.current?.[Xu]:A;if(l&&I&&f.current&&I.clearEvents(u?null:f.current),f.current&&!Lne(f.current)){const X=Object.keys(y.current);for(const D of X)f.current[D]?.removeEventListener?.(y.current[D])}y.current={},m.current=void 0,V.current=void 0,f.current=void 0},[]);return R.useLayoutEffect(()=>((async()=>(N.current&&(await N.current,N.current=void 0),G.current=P()))(),()=>{w(),N.current=x()}),[P,x,w]),R.useEffect(()=>{(async()=>{G.current&&await G.current;const I=PM(h);S?Ine(I,v.current)||(await k(I),p.__$internal?.onUpdate?.()):(v.current=I,g.current=I,C.current=!0)})()},[p.__$internal,S,h,k]),R.useImperativeHandle(d,()=>({cesiumElement:S?f.current:null}),[S]),[m.current,S,O]};function PM(e){const{children:t,...n}=e;return n}const lt=({renderContainer:e,noChildren:t,containerProps:n,defaultProps:i,...r})=>{const o=(s,a)=>{const c={...i,...s},[l,u,h]=Pne(r,c,a);if(t)return null;const d=u&&"children"in c?c.children:null,f=e?Zm.jsx("div",{"data-testid":"resium-container",ref:h,...typeof n=="function"?n(c):Rne(c,n),children:d}):d?Zm.jsx(Zm.Fragment,{children:d}):null;return l?Zm.jsx(xv.Provider,{value:l,children:f}):f};return o.displayName=r.name,R.forwardRef(o)},One=["enabled","selected"],Ko=e=>lt({name:e.name,create(t,n){if(!t.scene)return;const i=e.create(n,t.scene.postProcessStages);return typeof n.enabled=="boolean"&&(i.enabled=n.enabled),n.selected&&"selected"in i&&(i.selected=n.selected),e.props.forEach(r=>{!tf(e.readonlyProps,r)&&typeof n[r]<"u"&&(i.uniforms[r]=n[r])}),!e.noMount&&t.scene&&!t.scene.isDestroyed()&&t.scene.postProcessStages.add(i),i},destroy(t,n){e.noMount?t.enabled=!1:(n.scene&&!n.scene.isDestroyed()&&n.scene.postProcessStages.remove(t),t.isDestroyed()||t.destroy())},update(t,n,i){e.props.forEach(r=>{!tf(e.readonlyProps,r)&&n[r]!==i[r]&&(t.uniforms[r]=n[r])})},cesiumProps:One,cesiumReadonlyProps:e.readonlyProps,defaultProps:{enabled:!0}});lt({name:"Billboard",create(e,t){return e.billboardCollection?.add(t)},destroy(e,t){t.billboardCollection&&!t.billboardCollection.isDestroyed()&&t.billboardCollection.remove(e)},cesiumProps:["alignedAxis","color","disableDepthTestDistance","distanceDisplayCondition","eyeOffset","height","heightReference","horizontalOrigin","image","pixelOffset","pixelOffsetScaleByDistance","position","rotation","scale","scaleByDistance","show","sizeInMeters","splitDirection","translucencyByDistance","verticalOrigin","width","id"],useCommonEvent:!0}),lt({name:"BillboardCollection",create(e,t){if(!e.primitiveCollection)return;const n=new M.BillboardCollection({modelMatrix:t.modelMatrix,debugShowBoundingVolume:t.debugShowBoundingVolume,scene:e.scene,blendOption:t.blendOption});return e.primitiveCollection.add(n),n},destroy(e,t){t.primitiveCollection&&!t.primitiveCollection.isDestroyed()&&t.primitiveCollection.remove(e),e.isDestroyed()||e.destroy()},provide(e){return{billboardCollection:e}},cesiumProps:["blendOption","debugShowBoundingVolume","debugShowTextureAtlas","modelMatrix","show"]});const Gne=["image","show","scale","horizontalOrigin","verticalOrigin","eyeOffset","pixelOffset","rotation","alignedAxis","width","height","color","scaleByDistance","translucencyByDistance","pixelOffsetScaleByDistance","imageSubRegion","sizeInMeters","heightReference","distanceDisplayCondition","disableDepthTestDistance","splitDirection"],Vne={onDefinitionChange:"definitionChanged"},OM=lt({name:"BillboardGraphics",create(e,t){if(!e.entity)return;const n=new M.BillboardGraphics(t);return e.entity.billboard=n,n},destroy(e,t){t.entity&&(t.entity.billboard=void 0)},cesiumProps:Gne,cesiumEventProps:Vne}),Fne=["heightReference","dimensions","show","fill","material","outline","outlineColor","outlineWidth","shadows","distanceDisplayCondition"],Ane={onDefinitionChange:"definitionChanged"},GM=lt({name:"BoxGraphics",create(e,t){if(!e.entity)return;const n=new M.BoxGraphics(t);return e.entity.box=n,n},destroy(e,t){t.entity&&(t.entity.box=void 0)},cesiumProps:Fne,cesiumEventProps:Ane}),zne=["position","direction","up","right","frustum","defaultMoveAmount","defaultLookAmount","defaultRotateAmount","defaultZoomAmount","constrainedAxis","maximumZoomFactor","percentageChanged"],Nne={onChange:"changed",onMoveEnd:"moveEnd",onMoveStart:"moveStart"},kne=lt({name:"Camera",create:e=>e.scene?.camera,cesiumProps:zne,cesiumEventProps:Nne,setCesiumPropsAfterCreate:!0}),Xne=["show","modelMatrix","shadows","maximumScreenSpaceError","cullRequestsWhileMoving","cullRequestsWhileMovingMultiplier","preloadWhenHidden","preloadFlightDestinations","preferLeaves","progressiveResolutionHeightFraction","foveatedScreenSpaceError","foveatedConeSize","foveatedMinimumScreenSpaceErrorRelaxation","foveatedInterpolationCallback","foveatedTimeDelay","dynamicScreenSpaceError","dynamicScreenSpaceErrorDensity","dynamicScreenSpaceErrorFactor","dynamicScreenSpaceErrorHeightFalloff","skipLevelOfDetail","baseScreenSpaceError","skipScreenSpaceErrorFactor","skipLevels","immediatelyLoadDesiredLevelOfDetail","loadSiblings","clippingPlanes","clippingPolygons","lightColor","colorBlendAmount","colorBlendMode","debugFreezeFrame","debugColorizeTiles","debugWireframe","debugShowBoundingVolume","debugShowContentBoundingVolume","debugShowViewerRequestVolume","debugShowGeometricError","debugShowRenderingStatistics","debugShowMemoryUsage","debugShowUrl","style","backFaceCulling","showOutline","vectorClassificationOnly","vectorKeepDecodedPositions","splitDirection","customShader","imageBasedLighting","showCreditsOnScreen","featureIdLabel","instanceFeatureIdLabel","outlineColor","cacheBytes","maximumCacheOverflowBytes","enableCollision"],Zne=["asynchronouslyLoadImagery","classificationType","cullWithChildrenBounds","debugHeatmapTilePropertyName","ellipsoid","enableDebugWireframe","heightReference","modelUpAxis","modelForwardAxis","projectTo2D","enableShowOutline","enablePick","environmentMapOptions","scene"],Dne={onAllTilesLoad:"allTilesLoaded",onInitialTilesLoad:"initialTilesLoaded",onLoadProgress:"loadProgress",onTileFailed:"tileFailed",onTileLoad:"tileLoad",onTileUnload:"tileUnload",onTileVisible:"tileVisible"},Une=["onReady","onError","url"],Wne=lt({name:"Cesium3DTileset",async create(e,t){if(!e.primitiveCollection)return;const n=t.url;let i;lc(n)?i=await n:i=n;let r;try{r=await M.Cesium3DTileset.fromUrl(i,t),t.onReady?.(r)}catch(o){t.onError?.(o);return}return t.colorBlendAmount&&(r.colorBlendAmount=t.colorBlendAmount),t.colorBlendMode&&(r.colorBlendMode=t.colorBlendMode),t.style&&(r.style=t.style),e.primitiveCollection.add(r),r},destroy(e,t){t.primitiveCollection&&!t.primitiveCollection.isDestroyed()&&t.primitiveCollection.remove(e),e.isDestroyed()||e.destroy()},cesiumProps:Xne,cesiumReadonlyProps:Zne,cesiumEventProps:Dne,otherProps:Une,useCommonEvent:!0});lt({name:"Cesium3DTilesetGraphics",create(e,t){if(!e.entity)return;const n=new M.Cesium3DTilesetGraphics(t);return e.entity.tileset=n,n},destroy(e,t){t.entity&&(t.entity.tileset=void 0)},cesiumProps:["show","uri","maximumScreenSpaceError"],cesiumEventProps:{onDefinitionChange:"definitionChanged"}}),lt({name:"Cesium3DTilesTerrainProvider",async create(e,t){const{onReady:n,assetId:i,accessToken:r,url:o,children:s,...a}=t;let c;if(i!==void 0)c=await M.Cesium3DTilesTerrainProvider.fromIonAssetId(i,a);else if(o!==void 0)c=await M.Cesium3DTilesTerrainProvider.fromUrl(o,a);else throw new Error("Cesium3DTilesTerrainProvider requires either 'url' or 'assetId' prop to be provided");return n&&n(c),c}}),lt({name:"CesiumWidget",create(e,t,n){if(!n)return;const i=new M.CesiumWidget(n,t);if(!i)return;typeof t.resolutionScale=="number"&&(i.resolutionScale=t.resolutionScale);const r=new LM(i.scene);return[i,r]},destroy(e,t,n,i){i&&!i.isDestroyed()&&i.destroy(),e.isDestroyed()||e.destroy()},provide(e,t,n,i){return{cesiumWidget:e,scene:e.scene,camera:e.scene.camera,imageryLayerCollection:e.scene.globe.imageryLayers,primitiveCollection:e.scene.primitives,globe:e.scene.globe,__$internal:{onUpdate:n?.onUpdate},[Xu]:i}},containerProps:({id:e,className:t,style:n,full:i,containerProps:r})=>({className:t,id:e,style:{...i?{position:"absolute",bottom:"0",left:"0",right:"0",top:"0"}:{},...n},...r}),cesiumProps:["resolutionScale","useDefaultRenderLoop","targetFrameRate","useBrowserRecommendedResolution","allowDataSourcesToSuspendAnimation","trackedEntity","clockTrackedDataSource","terrainProvider","creditDisplay"],cesiumReadonlyProps:["clock","shouldAnimate","ellipsoid","baseLayer","skyBox","skyAtmosphere","sceneMode","scene3DOnly","orderIndependentTranslucency","mapMode2D","mapProjection","globe","showRenderLoopErrors","automaticallyTrackDataSourceClocks","contextOptions","creditContainer","creditViewport","dataSources","shadows","terrainShadows","terrain","requestRenderMode","maximumRenderTimeChange","msaaSamples","blurActiveElementOnCanvasFocus"],otherProps:["className","id","style","full","containerProps"],renderContainer:!0,useCommonEvent:!0,useRootEvent:!0}),lt({name:"ClassificationPrimitive",async create(e,t){if(!e.primitiveCollection)return;const n=new M.ClassificationPrimitive(t);if(t.onReady){const i=()=>{n.ready&&(t.onReady?.(n),e.scene?.postRender.removeEventListener(i))};e.scene?.postRender.addEventListener(i)}return e.primitiveCollection.add(n),n},destroy(e,t){t.primitiveCollection&&!t.primitiveCollection.isDestroyed()&&t.primitiveCollection.remove(e),e.isDestroyed()||e.destroy()},cesiumProps:["classificationType","debugShowBoundingVolume","debugShowShadowVolume","show"],cesiumReadonlyProps:["allowPicking","asynchronous","compressVertices","geometryInstances","interleave","releaseGeometryInstances","vertexCacheOptimize","appearance"],otherProps:["onReady"],useCommonEvent:!0});const Bne={onStop:"onStop",onTick:"onTick"},Yne=["canAnimate","clockRange","clockStep","currentTime","multiplier","shouldAnimate","startTime","stopTime"],Hne=lt({name:"Clock",create:e=>e.cesiumWidget?.clock,cesiumProps:Yne,cesiumEventProps:Bne,setCesiumPropsAfterCreate:!0});lt({name:"CloudCollection",create:e=>{if(!e.primitiveCollection)return;const t=new M.CloudCollection;return e.primitiveCollection.add(t),t},destroy(e,t){t.primitiveCollection&&!t.primitiveCollection.isDestroyed()&&t.primitiveCollection.remove(e),e.isDestroyed()||e.destroy()},provide:e=>({cloudCollection:e}),cesiumProps:["noiseDetail","noiseOffset","show","debugBillboards","debugEllipsoids"],setCesiumPropsAfterCreate:!0}),lt({name:"CorridorGraphics",create(e,t){if(!e.entity)return;const n=new M.CorridorGraphics(t);return t.classificationType&&(n.classificationType=t.classificationType),e.entity.corridor=n,n},destroy(e,t){t.entity&&(t.entity.corridor=void 0)},cesiumProps:["positions","width","cornerType","height","heightReference","extrudedHeight","extrudedHeightReference","show","fill","material","outline","outlineColor","outlineWidth","granularity","shadows","distanceDisplayCondition","zIndex","classificationType"],cesiumEventProps:{onDefinitionChange:"definitionChanged"}}),lt({name:"CumulusCloud",create:(e,t)=>e.cloudCollection?.add(t),destroy(e,t){t.cloudCollection&&!t.cloudCollection.isDestroyed()&&t.cloudCollection.remove(e)},cesiumProps:["show","position","scale","maximumSize","slice","brightness","color"]});const jne=["clustering","name","show","clock","isLoading"],Kne={onChange:"changedEvent",onError:"errorEvent",onLoading:"loadingEvent"},Jne=lt({name:"CustomDataSource",create(e,t){if(!e.dataSourceCollection)return;const n=new M.CustomDataSource(t.name);return t.clustering&&(n.clustering=t.clustering),typeof t.show=="boolean"&&(n.show=t.show),typeof t.clock<"u"&&(n.clock=t.clock),e.dataSourceCollection.add(n),n},destroy(e,t){t.dataSourceCollection&&!t.dataSourceCollection.isDestroyed()&&t.dataSourceCollection.remove(e)},provide(e){return{entityCollection:e.entities,dataSource:e}},cesiumProps:jne,cesiumEventProps:Kne,useCommonEvent:!0});lt({name:"CylinderGraphics",create(e,t){if(!e.entity)return;const n=new M.CylinderGraphics(t);return e.entity.cylinder=n,n},destroy(e,t){t.entity&&(t.entity.cylinder=void 0)},cesiumProps:["heightReference","length","topRadius","bottomRadius","show","fill","material","outline","outlineColor","outlineWidth","numberOfVerticalLines","slices","distanceDisplayCondition","shadows"],cesiumEventProps:{onDefinitionChange:"definitionChanged"}});const Qne=["clustering","show"],qne=["name","sourceUri","credit"],$ne={onChange:"changedEvent",onError:"errorEvent",onLoading:"loadingEvent"},eie=["onLoad","data"],VM=(e,{data:t,onLoad:n,...i})=>{t&&e.load(t,i).then(r=>{n&&n(r)})},tie=lt({name:"CzmlDataSource",create(e,t){if(!e.dataSourceCollection)return;const n=new M.CzmlDataSource(t.name);return t.clustering&&(n.clustering=t.clustering),typeof t.show=="boolean"&&(n.show=t.show),e.dataSourceCollection.add(n),t.data&&VM(n,t),n},update(e,t,n){t.data?n.show!==t.show&&(e.show=typeof t.show=="boolean"?t.show:!0):e.show=!1,t.data&&(n.data!==t.data||n.sourceUri!==t.sourceUri||n.credit!==t.credit)&&VM(e,t)},destroy(e,t){t.dataSourceCollection&&!t.dataSourceCollection.isDestroyed()&&t.dataSourceCollection.remove(e)},provide(e){return{dataSource:e}},cesiumProps:Qne,cesiumReadonlyProps:qne,cesiumEventProps:$ne,otherProps:eie,useCommonEvent:!0}),nie=["semiMajorAxis","semiMinorAxis","height","heightReference","extrudedHeight","show","fill","material","outline","outlineColor","outlineWidth","numberOfVerticalLines","rotation","stRotation","granularity","shadows","distanceDisplayCondition","zIndex","classificationType","extrudedHeightReference"],iie={onDefinitionChange:"definitionChanged"},rie=lt({name:"EllipseGraphics",create(e,t){if(!e.entity)return;const n=new M.EllipseGraphics(t);return e.entity.ellipse=n,n},destroy(e,t){t.entity&&(t.entity.ellipse=void 0)},cesiumProps:nie,cesiumEventProps:iie}),oie=["heightReference","radii","show","fill","innerRadii","material","maximumClock","maximumCone","minimumClock","minimumCone","outline","outlineColor","outlineWidth","subdivisions","stackPartitions","slicePartitions","shadows","distanceDisplayCondition"],sie={onDefinitionChange:"definitionChanged"},aie=lt({name:"EllipsoidGraphics",create(e,t){if(!e.entity)return;const n=new M.EllipsoidGraphics(t);return e.entity.ellipsoid=n,n},destroy(e,t){t.entity&&(t.entity.ellipsoid=void 0)},cesiumProps:oie,cesiumEventProps:sie}),cie=["availability","billboard","box","corridor","cylinder","description","ellipse","ellipsoid","entityCollection","label","model","name","orientation","path","plane","parent","point","polygon","polyline","polylineVolume","position","properties","rectangle","show","tileset","trackingReferenceFrame","viewFrom","wall"],lie=["id"],uie={onDefinitionChange:"definitionChanged"},hie=["selected","tracked"],uc=lt({name:"Entity",create(e,t){if(!e.entityCollection)return;const n=new M.Entity(t);return e.viewer&&t.selected&&(e.viewer.selectedEntity=n),e.viewer&&t.tracked&&(e.viewer.trackedEntity=n),e.entityCollection.add(n),n},destroy(e,t){t.entityCollection&&t.entityCollection.remove(e)},update(e,t,n,i){i.viewer&&(t.selected!==n.selected&&(t.selected?i.viewer.selectedEntity=e:i.viewer.selectedEntity===e&&(i.viewer.selectedEntity=void 0)),t.tracked!==n.tracked&&(t.tracked?i.viewer.trackedEntity=e:i.viewer.trackedEntity===e&&(i.viewer.trackedEntity=void 0)))},provide(e,t,n){return{entity:e,__$internal:{onUpdate:n?.onUpdate}}},cesiumProps:cie,cesiumReadonlyProps:lie,cesiumEventProps:uie,otherProps:hie,useCommonEvent:!0}),die=["density","enabled","heightFalloff","heightScalar","maxHeight","minimumBrightness","renderable","screenSpaceErrorFactor","visualDensityScalar"],fie=lt({name:"Fog",create(e){if(!e.scene)return;const t=new M.Fog;return e.scene.fog=t,t},destroy(e,t){t.scene&&!t.scene.isDestroyed()&&(t.scene.fog=new M.Fog)},cesiumProps:die,setCesiumPropsAfterCreate:!0}),pie=["clustering","name","show"],mie=["clampToGround","sourceUri","credit","markerSize","markerSymbol","markerColor","stroke","strokeWidth","fill","describe"],gie={onChange:"changedEvent",onError:"errorEvent",onLoading:"loadingEvent"},yie=["onLoad","data"],FM=(e,{data:t,onLoad:n,...i})=>{t&&e.load(t,i).then(r=>{n&&n(r)})},bie=lt({name:"GeoJsonDataSource",create(e,t){if(!e.dataSourceCollection)return;const n=new M.GeoJsonDataSource(t.name);return t.clustering&&(n.clustering=t.clustering),typeof t.show=="boolean"&&(n.show=t.show),e.dataSourceCollection.add(n),t.data&&FM(n,t),n},update(e,t,n){t.data?n.show!==t.show&&(e.show=typeof t.show=="boolean"?t.show:!0):e.show=!1,t.data&&(n.data!==t.data||n.clampToGround!==t.clampToGround||n.sourceUri!==t.sourceUri||n.credit!==t.credit||n.markerSize!==t.markerSize||n.markerSymbol!==t.markerSymbol||n.markerColor!==t.markerColor||n.stroke!==t.stroke||n.strokeWidth!==t.strokeWidth||n.fill!==t.fill)&&FM(e,t)},destroy(e,t){t.dataSourceCollection&&!t.dataSourceCollection.isDestroyed()&&t.dataSourceCollection.remove(e)},provide(e){return{dataSource:e}},cesiumProps:pie,cesiumReadonlyProps:mie,cesiumEventProps:gie,otherProps:yie,useCommonEvent:!0}),_ie={onImageryLayersUpdate:"imageryLayersUpdatedEvent",onTerrainProviderChange:"terrainProviderChanged",onTileLoadProgress:"tileLoadProgressEvent"},vie=["atmosphereBrightnessShift","atmosphereHueShift","atmosphereSaturationShift","backFaceCulling","baseColor","clippingPlanes","depthTestAgainstTerrain","enableLighting","lightingFadeInDistance","lightingFadeOutDistance","material","maximumScreenSpaceError","nightFadeInDistance","nightFadeOutDistance","oceanNormalMapUrl","shadows","show","showGroundAtmosphere","showWaterEffect","tileCacheSize","loadingDescendantLimit","preloadAncestors","preloadSiblings","fillHighlightColor","dynamicAtmosphereLighting","dynamicAtmosphereLightingFromSun","showSkirts","cartographicLimitRectangle","translucency","undergroundColor","undergroundColorAlphaByDistance","lambertDiffuseMultiplier","atmosphereLightIntensity","atmosphereRayleighCoefficient","atmosphereMieCoefficient","atmosphereRayleighScaleHeight","atmosphereMieScaleHeight","atmosphereMieAnisotropy","vertexShadowDarkness","clippingPolygons"],wie=["terrainProvider"],xie=lt({name:"Globe",create:e=>e.scene?.globe,update:async(e,t)=>{const n=t.terrainProvider;let i;lc(n)?i=await n:i=n,e.terrainProvider=i},cesiumProps:vie,cesiumEventProps:_ie,otherProps:wie,setCesiumPropsAfterCreate:!0});lt({name:"Google2DImageryProvider",async create(e,t){const{onReady:n,assetId:i,accessToken:r,key:o,children:s,...a}=t;let c;if(i!==void 0){const l={...a,assetId:i};r!==void 0&&(l.accessToken=r),c=await M.Google2DImageryProvider.fromIonAssetId(l)}else{const l={...a};o!==void 0&&(l.key=o),c=await M.Google2DImageryProvider.fromUrl(l)}return n&&n(c),c}}),lt({name:"GroundPolylinePrimitive",create(e,t){if(!e.primitiveCollection)return;const n=new M.GroundPolylinePrimitive(t);if(t.onReady){const i=()=>{n.ready&&(t.onReady?.(n),e.scene?.postRender.removeEventListener(i))};e.scene?.postRender.addEventListener(i)}return e.primitiveCollection.add(n),n},destroy(e,t){t.primitiveCollection&&!t.primitiveCollection.isDestroyed()&&t.primitiveCollection.remove(e),e.isDestroyed()||e.destroy()},cesiumProps:["appearance","classificationType","debugShowBoundingVolume","debugShowShadowVolume","show"],cesiumReadonlyProps:["allowPicking","asynchronous","geometryInstances","interleave","releaseGeometryInstances"],otherProps:["onReady"],useCommonEvent:!0}),lt({name:"GroundPrimitive",create(e,t){if(!e.primitiveCollection)return;const n=new M.GroundPrimitive(t);if(t.onReady){const i=()=>{n.ready&&(t.onReady?.(n),e.scene?.postRender.removeEventListener(i))};e.scene?.postRender.addEventListener(i)}return e.primitiveCollection.add(n),n},destroy(e,t){t.primitiveCollection&&!t.primitiveCollection.isDestroyed()&&t.primitiveCollection.remove(e),e.isDestroyed()||e.destroy()},cesiumProps:["appearance","classificationType","debugShowBoundingVolume","debugShowShadowVolume","show"],cesiumReadonlyProps:["allowPicking","asynchronous","compressVertices","geometryInstances","interleave","releaseGeometryInstances","vertexCacheOptimize"],otherProps:["onReady"],useCommonEvent:!0}),lt({name:"GroundPrimitiveCollection",create:e=>e.scene?.groundPrimitives,provide:e=>({primitiveCollection:e}),cesiumProps:["show","destroyPrimitives","primitiveAdded","primitiveRemoved"],setCesiumPropsAfterCreate:!0});const Sie=["alpha","brightness","contrast","hue","saturation","gamma","splitDirection","minificationFilter","magnificationFilter","cutoutRectangle","show","nightAlpha","dayAlpha","colorToAlpha","colorToAlphaThreshold","index"],Eie=["rectangle","maximumAnisotropy","minimumTerrainLevel","maximumTerrainLevel","imageryProvider"],Tie=lt({name:"ImageryLayer",async create(e,t){if(!e.imageryLayerCollection)return;const n=lc(t.imageryProvider)?t.imageryProvider:new Promise(s=>queueMicrotask(()=>s(t.imageryProvider))),i=e.__$internal?.imageryLayerWaitingList?.slice();e.__$internal?.imageryLayerWaitingList&&e.__$internal.imageryLayerWaitingList.push(n),i&&await Promise.all(i.filter(s=>lc(s)));const r=await n;if(e.__$internal?.imageryLayerWaitingList&&(e.__$internal.imageryLayerWaitingList=e.__$internal.imageryLayerWaitingList.filter(s=>s!==n)),!r)return;const o=new M.ImageryLayer(r,t);return e.imageryLayerCollection.add(o,t.index),o},destroy(e,t){t.imageryLayerCollection&&t.imageryLayerCollection.remove(e)},cesiumProps:Sie,cesiumReadonlyProps:Eie});lt({name:"ImageryLayerCollection",create:e=>e.globe?.imageryLayers,cesiumEventProps:{onLayerAdd:"layerAdded",onLayerMove:"layerMoved",onLayerRemove:"layerRemoved",onLayerShowOrHide:"layerShownOrHidden"}});const Cie=["clustering","name","show"],Rie=["canvas","camera","ellipsoid","clampToGround","sourceUri","credit","screenOverlayContainer"],Iie={onChange:"changedEvent",onError:"errorEvent",onLoading:"loadingEvent",onRefresh:"refreshEvent",onUnsupportedNode:"unsupportedNodeEvent"},Mie=["onLoad","data"],AM=(e,{data:t,onLoad:n,...i})=>{t&&e.load(t,i).then(r=>{n&&n(r)})},Lie=lt({name:"KmlDataSource",create(e,t){if(!e.scene||!e.dataSourceCollection||!e.scene)return;const n=new M.KmlDataSource({camera:t.camera||e.scene.camera,canvas:t.canvas||e.scene.canvas,ellipsoid:t.ellipsoid,credit:t.credit});return t.clustering&&(n.clustering=t.clustering),typeof t.show=="boolean"&&(n.show=t.show),typeof t.name<"u"&&(n.name=t.name),e.dataSourceCollection.add(n),t.data&&AM(n,t),n},update(e,t,n){t.data?n.show!==t.show&&(e.show=typeof t.show=="boolean"?t.show:!0):e.show=!1,t.data&&(n.data!==t.data||n.clampToGround!==t.clampToGround||n.ellipsoid!==t.ellipsoid||n.sourceUri!==t.sourceUri||n.credit!==t.credit)&&AM(e,t)},destroy(e,t){t.dataSourceCollection&&!t.dataSourceCollection.isDestroyed()&&t.dataSourceCollection.remove(e)},provide(e){return{dataSource:e}},cesiumProps:Cie,cesiumReadonlyProps:Rie,cesiumEventProps:Iie,otherProps:Mie,useCommonEvent:!0});lt({name:"Label",create:(e,t)=>e.labelCollection?.add(t),destroy(e,t){t.labelCollection&&!t.labelCollection.isDestroyed()&&t.labelCollection.remove(e)},cesiumProps:["backgroundColor","backgroundPadding","disableDepthTestDistance","distanceDisplayCondition","eyeOffset","fillColor","font","heightReference","horizontalOrigin","id","outlineColor","outlineWidth","pixelOffset","pixelOffsetScaleByDistance","position","scale","scaleByDistance","show","showBackground","style","text","translucencyByDistance","verticalOrigin"],useCommonEvent:!0}),lt({name:"LabelCollection",create(e,t){if(!e.scene||!e.primitiveCollection)return;const n=new M.LabelCollection({scene:e.scene,modelMatrix:t.modelMatrix,blendOption:t.blendOption,debugShowBoundingVolume:t.debugShowBoundingVolume});return e.primitiveCollection.add(n),n},destroy(e,t){t.primitiveCollection&&!t.primitiveCollection.isDestroyed()&&t.primitiveCollection.remove(e),e.isDestroyed()||e.destroy()},provide(e){return{labelCollection:e}},cesiumProps:["blendOption","debugShowBoundingVolume","modelMatrix","show"]});const Pie=["text","font","style","fillColor","outlineColor","outlineWidth","show","showBackground","backgroundColor","backgroundPadding","scale","horizontalOrigin","verticalOrigin","eyeOffset","pixelOffset","translucencyByDistance","pixelOffsetScaleByDistance","scaleByDistance","heightReference","distanceDisplayCondition","disableDepthTestDistance"],Oie={onDefinitionChange:"definitionChanged"},Gie=lt({name:"LabelGraphics",create(e,t){if(!e.entity)return;const n=new M.LabelGraphics(t);return e.entity.label=n,n},destroy(e,t){t.entity&&(t.entity.label=void 0)},cesiumProps:Pie,cesiumEventProps:Oie});lt({name:"Model",async create(e,{scene:t,url:n,colorBlendMode:i,...r}){if(!e.scene||!e.primitiveCollection||!n)return;const o=n;let s;lc(o)?s=await o:s=o;let a;try{a=await M.Model.fromGltfAsync({...r,url:s,colorBlendMode:i,scene:t||e.scene})}catch(c){r.onError?.(c);return}return e.primitiveCollection.add(a),a},destroy(e,t){t.primitiveCollection&&!t.primitiveCollection.isDestroyed()&&t.primitiveCollection.remove(e),e.isDestroyed()||e.destroy()},cesiumEventProps:{onReady:"readyEvent"},cesiumProps:["backFaceCulling","clampAnimations","clippingPlanes","clippingPolygons","color","colorBlendAmount","colorBlendMode","customShader","debugShowBoundingVolume","debugWireframe","distanceDisplayCondition","enableVerticalExaggeration","featureIdLabel","heightReference","id","imageBasedLighting","instanceFeatureIdLabel","lightColor","maximumScale","minimumPixelSize","modelMatrix","outlineColor","scale","shadows","show","showCreditsOnScreen","showOutline","silhouetteColor","silhouetteSize","splitDirection","style","pointCloudShading"],cesiumReadonlyProps:["allowPicking","asynchronous","basePath","credit","enableDebugWireframe","gltf","incrementallyLoadTextures","scene","releaseGltfJson","cull","opaquePass","upAxis","forwardAxis","content","enableShowOutline","projectTo2D","classificationType","gltfCallback","enablePick","environmentMapOptions"],otherProps:["onReady","onError","url"],useCommonEvent:!0});const Vie=["uri","show","scale","minimumPixelSize","maximumScale","incrementallyLoadTextures","runAnimations","clampAnimations","nodeTransformations","shadows","heightReference","distanceDisplayCondition","silhouetteColor","silhouetteSize","color","colorBlendMode","colorBlendAmount","clippingPlanes","imageBasedLightingFactor","lightColor","articulations","customShader","enableVerticalExaggeration","environmentMapOptions"],Fie={onDefinitionChange:"definitionChanged"},Aie=lt({name:"ModelGraphics",create(e,t){if(!e.entity)return;const n=new M.ModelGraphics(t);return e.entity.model=n,n},destroy(e,t){t.entity&&(t.entity.model=void 0)},cesiumProps:Vie,cesiumEventProps:Fie}),zie=["onlySunLighting","show","textureUrl"],Nie=["ellipsoid"],kie=lt({name:"Moon",create(e,t){if(!e.scene)return;const n=new M.Moon(t);return e.scene.moon=n,n},destroy(e,t){t.scene&&!t.scene.isDestroyed()&&(t.scene.moon=new M.Moon)},cesiumProps:zie,cesiumReadonlyProps:Nie});lt({name:"ParticleSystem",create(e,t){if(!e.primitiveCollection)return;const n=new M.ParticleSystem({...t,updateCallback:t.onUpdate});return e.primitiveCollection.add(n),n},update(e,t,n){t.onUpdate!==n.onUpdate&&(e.updateCallback=t.onUpdate)},destroy(e,t){t.primitiveCollection&&!t.primitiveCollection.isDestroyed()&&t.primitiveCollection.remove(e)},cesiumProps:["show","emitter","modelMatrix","emitterModelMatrix","emissionRate","bursts","loop","startScale","endScale","startColor","endColor","image","imageSize","minimumImageSize","maximumImageSize","speed","minimumSpeed","maximumSpeed","lifetime","particleLife","minimumParticleLife","maximumParticleLife","mass","minimumMass","maximumMass","sizeInMeters"],cesiumEventProps:{onComplete:"complete",onUpdate:"updateCallback"}}),lt({name:"PathGraphics",create(e,t){if(!e.entity)return;const n=new M.PathGraphics(t);return e.entity.path=n,n},destroy(e,t){t.entity&&(t.entity.path=void 0)},cesiumProps:["leadTime","trailTime","show","width","material","resolution","distanceDisplayCondition"],cesiumEventProps:{onDefinitionChange:"definitionChanged"}});const Xie=["plane","dimensions","show","fill","material","outline","outlineColor","outlineWidth","shadows","distanceDisplayCondition"],Zie={onDefinitionChange:"definitionChanged"},Die=lt({name:"PlaneGraphics",create(e,t){if(!e.entity)return;const n=new M.PlaneGraphics(t);return e.entity.plane=n,n},destroy(e,t){t.entity&&(t.entity.plane=void 0)},cesiumProps:Xie,cesiumEventProps:Zie}),Uie=["color","pixelSize","outlineColor","outlineWidth","show","scaleByDistance","translucencyByDistance","heightReference","distanceDisplayCondition","disableDepthTestDistance","splitDirection"],Wie={onDefinitionChange:"definitionChanged"},Bie=lt({name:"PointGraphics",create(e,t){if(!e.entity)return;const n=new M.PointGraphics(t);return e.entity.point=n,n},destroy(e,t){t.entity&&(t.entity.point=void 0)},cesiumProps:Uie,cesiumEventProps:Wie});lt({name:"PointPrimitive",create:(e,t)=>e.pointPrimitiveCollection?.add(t),destroy(e,t){t.pointPrimitiveCollection&&!t.pointPrimitiveCollection.isDestroyed()&&t.pointPrimitiveCollection.remove(e)},cesiumProps:["color","disableDepthTestDistance","distanceDisplayCondition","id","outlineColor","outlineWidth","pixelSize","position","scaleByDistance","show","splitDirection","translucencyByDistance"],useCommonEvent:!0}),lt({name:"PointPrimitveCollection",create(e,t){if(!e.primitiveCollection)return;const n=new M.PointPrimitiveCollection(t);return e.primitiveCollection.add(n),n},destroy(e,t){t.primitiveCollection&&!t.primitiveCollection.isDestroyed()&&t.primitiveCollection.remove(e),e.isDestroyed()||e.destroy()},provide(e){return{pointPrimitiveCollection:e}},cesiumProps:["blendOption","debugShowBoundingVolume","modelMatrix","show"]});const Yie=["arcType","hierarchy","height","heightReference","extrudedHeight","extrudedHeightReference","show","fill","material","outline","outlineColor","outlineWidth","stRotation","granularity","perPositionHeight","closeTop","closeBottom","shadows","distanceDisplayCondition","zIndex","classificationType","textureCoordinates"],Hie={onDefinitionChange:"definitionChanged"},zM=lt({name:"PolygonGraphics",create(e,t){if(!e.entity)return;const n=new M.PolygonGraphics(t);return e.entity.polygon=n,n},destroy(e,t){t.entity&&(t.entity.polygon=void 0)},cesiumProps:Yie,cesiumEventProps:Hie});lt({name:"Polyline",create:(e,t)=>e.polylineCollection?.add(t),destroy(e,t){t.polylineCollection&&!t.polylineCollection.isDestroyed()&&t.polylineCollection.remove(e)},cesiumProps:["distanceDisplayCondition","id","loop","material","positions","show","width"],useCommonEvent:!0}),lt({name:"PolylineCollection",create(e,t){if(!e.primitiveCollection)return;const n=new M.PolylineCollection({modelMatrix:t.modelMatrix,debugShowBoundingVolume:t.debugShowBoundingVolume,length:t.length,scene:e.scene});return e.primitiveCollection.add(n),n},destroy(e,t){t.primitiveCollection&&!t.primitiveCollection.isDestroyed()&&t.primitiveCollection.remove(e),e.isDestroyed()||e.destroy()},provide(e){return{polylineCollection:e}},cesiumProps:["debugShowBoundingVolume","length","modelMatrix","show"]});const jie=["arcType","classificationType","positions","clampToGround","width","show","material","depthFailMaterial","granularity","shadows","distanceDisplayCondition","zIndex"],Kie={onDefinitionChange:"definitionChanged"},ml=lt({name:"PolylineGraphics",create(e,t){if(!e.entity)return;const n=new M.PolylineGraphics(t);return e.entity.polyline=n,n},destroy(e,t){t.entity&&(t.entity.polyline=void 0)},cesiumProps:jie,cesiumEventProps:Kie});lt({name:"PolylineVolumeGraphics",create(e,t){if(!e.entity)return;const n=new M.PolylineVolumeGraphics(t);return e.entity.polylineVolume=n,n},destroy(e,t){t.entity&&(t.entity.polylineVolume=void 0)},cesiumProps:["positions","shape","cornerType","show","fill","material","outline","outlineColor","outlineWidth","granularity","shadows","distanceDisplayCondition"],cesiumEventProps:{onDefinitionChange:"definitionChanged"}}),lt({name:"PostProcessStage",create(e,t){if(!e.scene)return;const n=new M.PostProcessStage(t);return typeof t.enabled=="boolean"&&(n.enabled=t.enabled),t.selected&&(n.selected=t.selected),e.scene.postProcessStages.add(n),n},destroy(e,t){t.scene&&!t.scene.isDestroyed()&&t.scene.postProcessStages.remove(e),e.isDestroyed()||e.destroy()},cesiumProps:["enabled","selected"],cesiumReadonlyProps:["clearColor","forcePowerOfTwo","fragmentShader","name","pixelDatatype","pixelFormat","sampleMode","scissorRectangle","textureScale","uniforms"]}),Ko({name:"BlackAndWhiteStage",props:["gradations"],create:()=>M.PostProcessStageLibrary.createBlackAndWhiteStage()}),Ko({name:"BrightnessStage",props:["brightness"],create:()=>M.PostProcessStageLibrary.createBrightnessStage()}),Ko({name:"LensFlareStage",props:["dirtTexture","starTexture","intensity","distortion","ghostDispersal","haloWidth","earthRadius"],create:()=>M.PostProcessStageLibrary.createLensFlareStage()}),Ko({name:"Fxaa",create:(e,t)=>t.fxaa,props:[]}),Ko({name:"NightVisionStage",props:[],create:()=>M.PostProcessStageLibrary.createNightVisionStage()}),lt({name:"PostProcessStageComposite",create(e,t){if(!e.scene)return;const n=new M.PostProcessStageComposite(t);return typeof t.enabled=="boolean"&&(n.enabled=t.enabled),t.selected&&(n.selected=t.selected),e.scene.postProcessStages.add(n),n},destroy(e,t){t.scene&&!t.scene.isDestroyed()&&t.scene.postProcessStages.remove(e),e.isDestroyed()||e.destroy()},cesiumProps:["enabled","selected"],cesiumReadonlyProps:["inputPreviousStageTexture","name","stages","uniforms"]}),Ko({name:"AmbientOcclusion",create:(e,t)=>t.ambientOcclusion,props:["ambientOcclusionOnly","bias","delta","frustumLength","intensity","lengthCap","sigma","stepSize"],noMount:!0}),Ko({name:"Bloom",create:(e,t)=>t.bloom,props:["brightness","contrast","delta","glowOnly","sigma","stepSize"],noMount:!0}),Ko({name:"BlurStage",props:["delta","sigma","stepSize"],create:()=>M.PostProcessStageLibrary.createBlurStage()}),Ko({name:"DepthOfFieldStage",props:["delta","focalDistance","sigma","stepSize"],create:()=>M.PostProcessStageLibrary.createDepthOfFieldStage()}),Ko({name:"EdgeDetectionStage",props:["color","length"],create:()=>M.PostProcessStageLibrary.createEdgeDetectionStage()}),Ko({name:"SilhouetteStage",props:["color","length"],create:()=>M.PostProcessStageLibrary.createSilhouetteStage()});const Jie=["appearance","cull","debugShowBoundingVolume","depthFailAppearance","modelMatrix","shadows","show"],Qie=["allowPicking","asynchronous","compressVertices","geometryInstances","interleave","releaseGeometryInstances","vertexCacheOptimize"],qie=["onReady"],$ie=lt({name:"Primitive",create(e,t){if(!e.primitiveCollection)return;const n=new M.Primitive(t);if(t.onReady){const i=()=>{n.ready&&(t.onReady?.(n),e.scene?.postRender.removeEventListener(i))};e.scene?.postRender.addEventListener(i)}return e.primitiveCollection.add(n),n},destroy(e,t){t.primitiveCollection&&!t.primitiveCollection.isDestroyed()&&t.primitiveCollection.remove(e),e.isDestroyed()||e.destroy()},cesiumProps:Jie,cesiumReadonlyProps:Qie,otherProps:qie,useCommonEvent:!0});lt({name:"RectangleGraphics",create(e,t){if(!e.entity)return;const n=new M.RectangleGraphics(t);return e.entity.rectangle=n,n},destroy(e,t){t.entity&&(t.entity.rectangle=void 0)},cesiumProps:["classificationType","coordinates","height","heightReference","extrudedHeight","extrudedHeightReference","show","fill","material","outline","outlineColor","outlineWidth","rotation","stRotation","granularity","shadows","distanceDisplayCondition","zIndex"],cesiumEventProps:{onDefinitionChange:"definitionChanged"}});const ere=["backgroundColor","completeMorphOnUserInput","debugShowCommands","debugShowDepthFrustum","debugShowFramesPerSecond","debugShowFrustumPlanes","debugShowFrustums","eyeSeparation","farToNearRatio","focalLength","fog","gamma","globe","highDynamicRange","invertClassification","invertClassificationColor","light","logarithmicDepthBuffer","logarithmicDepthFarToNearRatio","maximumRenderTimeChange","minimumDisableDepthTestDistance","moon","morphTime","nearToFarDistance2D","pickTranslucentDepth","requestRenderMode","rethrowRenderErrors","shadowMap","skyAtmosphere","skyBox","specularEnvironmentMaps","sphericalHarmonicCoefficients","sun","sunBloom","terrainProvider","useDepthPicking","useWebVR","msaaSamples","splitPosition","verticalExaggeration","verticalExaggerationRelativeHeight","atmosphere"],tre={onMorphComplete:"morphComplete",onMorphStart:"morphStart",onPostRender:"postRender",onPreRender:"preRender",onPreUpdate:"preUpdate",onPostUpdate:"postUpdate",onRenderError:"renderError",onTerrainProviderChange:"terrainProviderChanged"},nre=["mode","morphDuration","enableEdgeVisibility"],NM=(e,t,n)=>{switch(t){case M.SceneMode.SCENE2D:e.morphTo2D(n);break;case M.SceneMode.COLUMBUS_VIEW:e.morphToColumbusView(n);break;case M.SceneMode.SCENE3D:e.morphTo3D(n);break}},ire=lt({name:"Scene",create(e,t){return e.scene&&(t.mode&&NM(e.scene,t.mode,t.morphDuration),t.enableEdgeVisibility!==void 0&&(e.scene._enableEdgeVisibility=t.enableEdgeVisibility)),e.scene},update(e,t,n){t.mode!==n.mode&&t.mode&&NM(e,t.mode,t.morphDuration),t.enableEdgeVisibility!==n.enableEdgeVisibility&&t.enableEdgeVisibility!==void 0&&(e._enableEdgeVisibility=t.enableEdgeVisibility)},cesiumProps:ere,cesiumEventProps:tre,otherProps:nre,setCesiumPropsAfterCreate:!0}),rre=["bounceAnimationTime","enableCollisionDetection","enableInputs","enableLook","enableRotate","enableTilt","enableTranslate","enableZoom","inertiaSpin","inertiaTranslate","inertiaZoom","lookEventTypes","maximumMovementRatio","maximumZoomDistance","minimumCollisionTerrainHeight","minimumPickingTerrainHeight","minimumTrackBallHeight","minimumZoomDistance","rotateEventTypes","tiltEventTypes","translateEventTypes","zoomEventTypes","minimumPickingTerrainDistanceWithInertia","maximumTiltAngle","zoomFactor"],ore=lt({name:"ScreenSpaceCameraController",create:e=>e.scene?.screenSpaceCameraController,cesiumProps:rre,setCesiumPropsAfterCreate:!0}),hc=({action:e,modifier:t,type:n})=>{const i=Qn();return R.useEffect(()=>{if(!(!i.screenSpaceEventHandler||i.screenSpaceEventHandler.isDestroyed())){if(e)return i.screenSpaceEventHandler.setInputAction(e,n,t),()=>{!i.screenSpaceEventHandler||i.screenSpaceEventHandler.isDestroyed()||i.screenSpaceEventHandler.removeInputAction(n,t)};i.screenSpaceEventHandler.removeInputAction(n,t)}},[e,i.screenSpaceEventHandler,t,n]),null},kM=lt({name:"ScreenSpaceEventHandler",create(e,t){return t.useDefault?e.cesiumWidget?.screenSpaceEventHandler:e.scene?new M.ScreenSpaceEventHandler(e.scene.canvas):void 0},destroy(e){e.isDestroyed()||e.destroy()},provide(e){return{screenSpaceEventHandler:e}}});lt({name:"ShadowMap",create:e=>e.scene?.shadowMap,cesiumProps:["darkness","fadingEnabled","maximumDistance","enabled","normalOffset","softShadows","size"]});const sre=["brightnessShift","hueShift","saturationShift","show","perFragmentAtmosphere","atmosphereLightIntensity","atmosphereRayleighCoefficient","atmosphereMieCoefficient","atmosphereRayleighScaleHeight","atmosphereMieScaleHeight","atmosphereMieAnisotropy"],are=lt({name:"SkyAtmosphere",create:e=>e.scene?.skyAtmosphere,cesiumProps:sre,setCesiumPropsAfterCreate:!0}),cre=["sources","show"],lre=lt({name:"SkyBox",create:e=>e.scene?.skyBox,cesiumProps:cre,setCesiumPropsAfterCreate:!0}),ure=["glowFactor","show"],hre=lt({name:"Sun",create(e){if(!e.scene)return;const t=new M.Sun;return e.scene.sun=t,t},destroy(e,t){t.scene&&!t.scene.isDestroyed()&&(t.scene.sun=new M.Sun)},cesiumProps:ure,setCesiumPropsAfterCreate:!0});lt({name:"TimeDynamicPointCloud",create(e,t){if(!e.cesiumWidget||!e.primitiveCollection||!e.cesiumWidget?.clock)return;const n=new M.TimeDynamicPointCloud({...t,clock:t.clock??e.cesiumWidget.clock});if(t.onReady){const i=()=>{t.onReady?.(n),n.frameChanged.removeEventListener(i)};n.frameChanged.addEventListener(i)}return e.primitiveCollection.add(n),n},destroy(e,t){t.primitiveCollection&&!t.primitiveCollection.isDestroyed()&&t.primitiveCollection.remove(e),e.isDestroyed()||e.destroy()},cesiumProps:["clippingPlanes","maximumMemoryUsage","modelMatrix","shadows","show","style","intervals"],cesiumReadonlyProps:["clock","shading"],cesiumEventProps:{onFrameChange:"frameChanged"},otherProps:["onReady"],useCommonEvent:!0});const dre=["terrainShadows","clockTrackedDataSource","targetFrameRate","useDefaultRenderLoop","resolutionScale","allowDataSourcesToSuspendAnimation","trackedEntity","selectedEntity","shadows","useBrowserRecommendedResolution","creditDisplay"],fre=["baseLayer","animation","baseLayerPicker","fullscreenButton","vrButton","geocoder","homeButton","infoBox","sceneModePicker","selectionIndicator","timeline","navigationHelpButton","navigationInstructionsInitiallyVisible","scene3DOnly","shouldAnimate","clockViewModel","selectedImageryProviderViewModel","imageryProviderViewModels","selectedTerrainProviderViewModel","terrainProviderViewModels","ellipsoid","skyBox","skyAtmosphere","fullscreenElement","showRenderLoopErrors","automaticallyTrackDataSourceClocks","contextOptions","sceneMode","mapProjection","globe","orderIndependentTranslucency","creditContainer","creditViewport","dataSources","mapMode2D","projectionPicker","blurActiveElementOnCanvasFocus","requestRenderMode","maximumRenderTimeChange","depthPlaneEllipsoidOffset","msaaSamples","terrain"],pre={onSelectedEntityChange:"selectedEntityChanged",onTrackedEntityChange:"trackedEntityChanged"},mre=["className","id","style","full","containerProps","extend","terrainProvider"],gre=lt({name:"Viewer",async create(e,{baseLayer:t,terrainProvider:n,...i},r){if(!r)return;let o;lc(n)?o=await n:o=n;const s=new M.Viewer(r,{...i,terrainProvider:o,baseLayer:t??void 0});if(!s)return;t===!1&&s.imageryLayers.removeAll(),s&&i.extend&&(Array.isArray(i.extend)?i.extend.forEach(c=>{s.extend(c,{})}):s.extend(i.extend,{}));const a=new LM(s.scene);return[s,a]},destroy(e,t,n,i){i&&!i.isDestroyed()&&i.destroy(),e.isDestroyed()||e.destroy()},provide(e,t,n,i){return{viewer:e,cesiumWidget:e.cesiumWidget,dataSourceCollection:e.dataSources,entityCollection:e.entities,scene:e.scene,camera:e.scene.camera,imageryLayerCollection:e.scene.globe.imageryLayers,primitiveCollection:e.scene.primitives,globe:e.scene.globe,__$internal:{onUpdate:n?.onUpdate,imageryLayerWaitingList:[]},[Xu]:i}},containerProps:({id:e,className:t,style:n,full:i,containerProps:r})=>({className:t,id:e,style:{...i?{position:"absolute",bottom:"0",left:"0",right:"0",top:"0"}:{},...n},...r}),cesiumProps:dre,cesiumReadonlyProps:fre,cesiumEventProps:pre,otherProps:mre,renderContainer:!0,useCommonEvent:!0,useRootEvent:!0});lt({name:"WallGraphics",create(e,t){if(!e.entity)return;const n=new M.WallGraphics(t);return e.entity.wall=n,n},destroy(e,t){t.entity&&(t.entity.wall=void 0)},cesiumProps:["positions","maximumHeights","minimumHeights","show","fill","material","outline","outlineColor","outlineWidth","granularity","shadows","distanceDisplayCondition"],cesiumEventProps:{onDefinitionChange:"definitionChanged"}});const Cv=R.memo(({space:e})=>{const t=R.useMemo(()=>({rectangle:{coordinates:M.Rectangle.fromDegrees(...e.wsen),height:e.height,heightReference:M.HeightReference.NONE,extrudedHeight:e.extrudedHeight,clampToGround:!1,fill:!0,outline:!0,outlineColor:M.Color.fromCssColorString(e.outlineColor??""),material:M.Color.fromCssColorString(e.color??""),classificationType:M.ClassificationType.TERRAIN}}),[e]);return ce.jsx(uc,{id:e.id,...t})});Cv.displayName="SpatialIdSpace";const Rv=R.memo(({wsen:e,color:t})=>{const n=R.useMemo(()=>({rectangle:{coordinates:M.Rectangle.fromDegrees(...e),clampToGround:!0,fill:!0,outline:!1,material:M.Color.fromCssColorString(t),classificationType:M.ClassificationType.BOTH}}),[e,t]);return ce.jsx(uc,{...n})});Rv.displayName="SpatialIdSpace";const XM=R.memo(({indicator:e})=>{const t=R.useMemo(()=>({rectangle:{coordinates:M.Rectangle.fromDegrees(...e.wsen),height:e.height,extrudedHeight:e.extrudedHeight,clampToGround:!1,fill:!0,outline:!0,outlineColor:M.Color.fromCssColorString(e.outlineColor),material:M.Color.fromCssColorString(e.color),classificationType:M.ClassificationType.TERRAIN}}),[e]);return ce.jsx(uc,{...t})});XM.displayName="VerticalSpaceIndicator";const yre={zoom:20,maxHeight:4e3,minHeight:-1e3,dataOnly:!1,rightClickToExit:!0,color:"#00bebe44",outlineColor:"#00bebe55",groundIndicatorColor:"#00000066",selectorColor:"#ff990099",selectorOutlineColor:"#ff9900aa",verticalSpaceIndicatorColor:"#ffffff33",verticalSpaceIndicatorOutlineColor:"#ffffff55"},Dm={min:-85.0511,max:85.0511};function bre(e){return"z"in e&&"f"in e&&"x"in e&&"y"in e}const Zu=25,ZM={f:0,x:0,y:0,z:0},_re=180/Math.PI;function DM(e,t=1){const{f:n,x:i,y:r,z:o}=e;if(t<=0)throw new Error("steps must be greater than 0");if(t>o)throw new Error(`Getting parent tile of ${e}, ${t} steps is not possible because it would go beyond the root tile (z=0)`);return{f:n>>t,x:i>>t,y:r>>t,z:o-t}}function Um(e=ZM){const{f:t,x:n,y:i,z:r}=e;return[{f:t*2,x:n*2,y:i*2,z:r+1},{f:t*2,x:n*2+1,y:i*2,z:r+1},{f:t*2,x:n*2,y:i*2+1,z:r+1},{f:t*2,x:n*2+1,y:i*2+1,z:r+1},{f:t*2+1,x:n*2,y:i*2,z:r+1},{f:t*2+1,x:n*2+1,y:i*2,z:r+1},{f:t*2+1,x:n*2,y:i*2+1,z:r+1},{f:t*2+1,x:n*2+1,y:i*2+1,z:r+1}]}function Iv(e=ZM){const{f:t,x:n,y:i,z:r}=e;return[Is({f:t,x:n,y:i,z:r}),Is({f:t,x:n+1,y:i,z:r}),Is({f:t,x:n,y:i+1,z:r}),Is({f:t,x:n+1,y:i+1,z:r}),Is({f:t,x:n-1,y:i,z:r}),Is({f:t,x:n,y:i-1,z:r}),Is({f:t,x:n-1,y:i-1,z:r}),Is({f:t,x:n+1,y:i-1,z:r}),Is({f:t,x:n-1,y:i+1,z:r})]}function vre(e){const t=e.match(/^\/?(\d+)\/(?:(\d+)\/)?(\d+)\/(\d+)$/);if(t)return{z:parseInt(t[1],10),f:parseInt(t[2]||"0",10),x:parseInt(t[3],10),y:parseInt(t[4],10)}}function Mv(e){const t=Math.PI-2*Math.PI*e.y/Math.pow(2,e.z);return{lng:e.x/Math.pow(2,e.z)*360-180,lat:_re*Math.atan(.5*(Math.exp(t)-Math.exp(-t)))}}function wre(e){const t=e.x*2+1,n=e.y*2+1,i=e.z+1;return Mv({x:t,y:n,z:i})}function xre(e){return{...wre(e),alt:nf(e)+2**Zu/2**(e.z+1)}}function UM(e){const t=Mv(e),n=Mv({...e,y:e.y+1,x:e.x+1});return[t,n]}function nf(e){return e.f*2**Zu/2**e.z}function Sre(e){const t=typeof e.alt<"u"?e.alt:0;if(t<=-33554432||t>=2**Zu)throw new Error(`ZFXY only supports altitude between -2^${Zu} and +2^${Zu}.`);const n=Math.floor(2**e.zoom*t/2**Zu),i=Math.PI/180,r=Math.sin(e.lat*i),o=2**e.zoom;let s=o*(e.lng/360+.5);const a=o*(.5-.25*Math.log((1+r)/(1-r))/Math.PI);return s=s%o,s<0&&(s=s+o),{f:n,x:Math.floor(s),y:Math.floor(a),z:e.zoom}}function Is(e){const{z:t,f:n,x:i,y:r}=e;return{z:t,f:Math.max(Math.min(n,2**t),-(2**t)),x:i<0?i+2**t:i%2**t,y:r<0?r+2**t:r%2**t}}function Ere(e){let t=!1;e[0]==="-"&&(t=!0,e=e.substring(1));let n=Um(),i;for(const r of e)i={...n[parseInt(r,10)-1]},n=Um(i);return t&&(i.f=-i.f),i}function Tre(e){let{f:t,x:n,y:i,z:r}=e;const o=t;let s="";for(;r>0;){const a={f:Math.abs(t),x:n,y:i,z:r},c=DM(a);s=(Um(c).findIndex(h=>h.f===Math.abs(t)&&h.x===n&&h.y===i&&h.z===r)+1).toString()+s,t=c.f,n=c.x,i=c.y,r=c.z}return(o<0?"-":"")+s}function gl(e,t,n){n===void 0&&(n={});var i={type:"Feature"};return(n.id===0||n.id)&&(i.id=n.id),n.bbox&&(i.bbox=n.bbox),i.properties=t||{},i.geometry=e,i}function Cre(e,t,n){if(n===void 0&&(n={}),!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!BM(e[0])||!BM(e[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:e};return gl(i,t,n)}function WM(e,t,n){if(n===void 0&&(n={}),e.length<2)throw new Error("coordinates must be an array of two or more positions");var i={type:"LineString",coordinates:e};return gl(i,t,n)}function Wm(e,t){t===void 0&&(t={});var n={type:"FeatureCollection"};return t.id&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.features=e,n}function Rre(e,t,n){n===void 0&&(n={});var i={type:"MultiLineString",coordinates:e};return gl(i,t,n)}function BM(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}function YM(e,t,n){if(e!==null)for(var i,r,o,s,a,c,l,u=0,h=0,d,f=e.type,p=f==="FeatureCollection",m=f==="Feature",y=p?e.features.length:1,g=0;g<y;g++){l=p?e.features[g].geometry:m?e.geometry:e,d=l?l.type==="GeometryCollection":!1,a=d?l.geometries.length:1;for(var v=0;v<a;v++){var S=0,E=0;if(s=d?l.geometries[v]:l,s!==null){c=s.coordinates;var C=s.type;switch(u=0,C){case null:break;case"Point":if(t(c,h,g,S,E)===!1)return!1;h++,S++;break;case"LineString":case"MultiPoint":for(i=0;i<c.length;i++){if(t(c[i],h,g,S,E)===!1)return!1;h++,C==="MultiPoint"&&S++}C==="LineString"&&S++;break;case"Polygon":case"MultiLineString":for(i=0;i<c.length;i++){for(r=0;r<c[i].length-u;r++){if(t(c[i][r],h,g,S,E)===!1)return!1;h++}C==="MultiLineString"&&S++,C==="Polygon"&&E++}C==="Polygon"&&S++;break;case"MultiPolygon":for(i=0;i<c.length;i++){for(E=0,r=0;r<c[i].length;r++){for(o=0;o<c[i][r].length-u;o++){if(t(c[i][r][o],h,g,S,E)===!1)return!1;h++}E++}S++}break;case"GeometryCollection":for(i=0;i<s.geometries.length;i++)if(YM(s.geometries[i],t)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function HM(e,t){if(e.type==="Feature")t(e,0);else if(e.type==="FeatureCollection")for(var n=0;n<e.features.length&&t(e.features[n],n)!==!1;n++);}function Ire(e,t){var n,i,r,o,s,a,c,l,u,h,d=0,f=e.type==="FeatureCollection",p=e.type==="Feature",m=f?e.features.length:1;for(n=0;n<m;n++){for(a=f?e.features[n].geometry:p?e.geometry:e,l=f?e.features[n].properties:p?e.properties:{},u=f?e.features[n].bbox:p?e.bbox:void 0,h=f?e.features[n].id:p?e.id:void 0,c=a?a.type==="GeometryCollection":!1,s=c?a.geometries.length:1,r=0;r<s;r++){if(o=c?a.geometries[r]:a,o===null){if(t(null,d,l,u,h)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(o,d,l,u,h)===!1)return!1;break}case"GeometryCollection":{for(i=0;i<o.geometries.length;i++)if(t(o.geometries[i],d,l,u,h)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}d++}}function rf(e,t){Ire(e,function(n,i,r,o,s){var a=n===null?null:n.type;switch(a){case null:case"Point":case"LineString":case"Polygon":return t(gl(n,r,{bbox:o,id:s}),i,0)===!1?!1:void 0}var c;switch(a){case"MultiPoint":c="Point";break;case"MultiLineString":c="LineString";break;case"MultiPolygon":c="Polygon";break}for(var l=0;l<n.coordinates.length;l++){var u=n.coordinates[l],h={type:c,coordinates:u};if(t(gl(h,r),i,l)===!1)return!1}})}function Bm(e){var t=[1/0,1/0,-1/0,-1/0];return YM(e,function(n){t[0]>n[0]&&(t[0]=n[0]),t[1]>n[1]&&(t[1]=n[1]),t[2]<n[0]&&(t[2]=n[0]),t[3]<n[1]&&(t[3]=n[1])}),t}Bm.default=Bm;function Mre(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if(e.type==="Feature"&&e.geometry!==null&&e.geometry.type==="Point")return e.geometry.coordinates;if(e.type==="Point")return e.coordinates}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return e;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function of(e){if(Array.isArray(e))return e;if(e.type==="Feature"){if(e.geometry!==null)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Ym(e){return e.type==="Feature"?e.geometry:e}function sf(e,t,n){if(n===void 0&&(n={}),!e)throw new Error("point is required");if(!t)throw new Error("polygon is required");var i=Mre(e),r=Ym(t),o=r.type,s=t.bbox,a=r.coordinates;if(s&&Lre(i,s)===!1)return!1;o==="Polygon"&&(a=[a]);for(var c=!1,l=0;l<a.length&&!c;l++)if(jM(i,a[l][0],n.ignoreBoundary)){for(var u=!1,h=1;h<a[l].length&&!u;)jM(i,a[l][h],!n.ignoreBoundary)&&(u=!0),h++;u||(c=!0)}return c}function jM(e,t,n){var i=!1;t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]&&(t=t.slice(0,t.length-1));for(var r=0,o=t.length-1;r<t.length;o=r++){var s=t[r][0],a=t[r][1],c=t[o][0],l=t[o][1],u=e[1]*(s-c)+a*(c-e[0])+l*(e[0]-s)===0&&(s-e[0])*(c-e[0])<=0&&(a-e[1])*(l-e[1])<=0;if(u)return!n;var h=a>e[1]!=l>e[1]&&e[0]<(c-s)*(e[1]-a)/(l-a)+s;h&&(i=!i)}return i}function Lre(e,t){return t[0]<=e[0]&&t[1]<=e[1]&&t[2]>=e[0]&&t[3]>=e[1]}function KM(e){if(!e)throw new Error("geojson is required");var t=[];return rf(e,function(n){Pre(n,t)}),Wm(t)}function Pre(e,t){var n=[],i=e.geometry;if(i!==null){switch(i.type){case"Polygon":n=of(i);break;case"LineString":n=[of(i)]}n.forEach(function(r){var o=Ore(r,e.properties);o.forEach(function(s){s.id=t.length,t.push(s)})})}}function Ore(e,t){var n=[];return e.reduce(function(i,r){var o=WM([i,r],t);return o.bbox=Gre(i,r),n.push(o),r}),n}function Gre(e,t){var n=e[0],i=e[1],r=t[0],o=t[1],s=n<r?n:r,a=i<o?i:o,c=n>r?n:r,l=i>o?i:o;return[s,a,c,l]}var Lv={exports:{}};function Vre(e,t,n,i,r){JM(e,t,n||0,i||e.length-1,r||Fre)}function JM(e,t,n,i,r){for(;i>n;){if(i-n>600){var o=i-n+1,s=t-n+1,a=Math.log(o),c=.5*Math.exp(2*a/3),l=.5*Math.sqrt(a*c*(o-c)/o)*(s-o/2<0?-1:1),u=Math.max(n,Math.floor(t-s*c/o+l)),h=Math.min(i,Math.floor(t+(o-s)*c/o+l));JM(e,t,u,h,r)}var d=e[t],f=n,p=i;for(af(e,n,t),r(e[i],d)>0&&af(e,n,i);f<p;){for(af(e,f,p),f++,p--;r(e[f],d)<0;)f++;for(;r(e[p],d)>0;)p--}r(e[n],d)===0?af(e,n,p):(p++,af(e,p,i)),p<=t&&(n=p+1),t<=p&&(i=p-1)}}function af(e,t,n){var i=e[t];e[t]=e[n],e[n]=i}function Fre(e,t){return e<t?-1:e>t?1:0}let Are=class{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let n=this.data;const i=[];if(!jm(t,n))return i;const r=this.toBBox,o=[];for(;n;){for(let s=0;s<n.children.length;s++){const a=n.children[s],c=n.leaf?r(a):a;jm(t,c)&&(n.leaf?i.push(a):Ov(t,c)?this._all(a,i):o.push(a))}n=o.pop()}return i}collides(t){let n=this.data;if(!jm(t,n))return!1;const i=[];for(;n;){for(let r=0;r<n.children.length;r++){const o=n.children[r],s=n.leaf?this.toBBox(o):o;if(jm(t,s)){if(n.leaf||Ov(t,s))return!0;i.push(o)}}n=i.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let i=0;i<t.length;i++)this.insert(t[i]);return this}let n=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=n;else if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){const i=this.data;this.data=n,n=i}this._insert(n,this.data.height-n.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=Uu([]),this}remove(t,n){if(!t)return this;let i=this.data;const r=this.toBBox(t),o=[],s=[];let a,c,l;for(;i||o.length;){if(i||(i=o.pop(),c=o[o.length-1],a=s.pop(),l=!0),i.leaf){const u=zre(t,i.children,n);if(u!==-1)return i.children.splice(u,1),o.push(i),this._condense(o),this}!l&&!i.leaf&&Ov(i,r)?(o.push(i),s.push(a),a=0,c=i,i=i.children[0]):c?(a++,i=c.children[a],l=!1):i=null}return this}toBBox(t){return t}compareMinX(t,n){return t.minX-n.minX}compareMinY(t,n){return t.minY-n.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,n){const i=[];for(;t;)t.leaf?n.push(...t.children):i.push(...t.children),t=i.pop();return n}_build(t,n,i,r){const o=i-n+1;let s=this._maxEntries,a;if(o<=s)return a=Uu(t.slice(n,i+1)),Du(a,this.toBBox),a;r||(r=Math.ceil(Math.log(o)/Math.log(s)),s=Math.ceil(o/Math.pow(s,r-1))),a=Uu([]),a.leaf=!1,a.height=r;const c=Math.ceil(o/s),l=c*Math.ceil(Math.sqrt(s));QM(t,n,i,l,this.compareMinX);for(let u=n;u<=i;u+=l){const h=Math.min(u+l-1,i);QM(t,u,h,c,this.compareMinY);for(let d=u;d<=h;d+=c){const f=Math.min(d+c-1,h);a.children.push(this._build(t,d,f,r-1))}}return Du(a,this.toBBox),a}_chooseSubtree(t,n,i,r){for(;r.push(n),!(n.leaf||r.length-1===i);){let o=1/0,s=1/0,a;for(let c=0;c<n.children.length;c++){const l=n.children[c],u=Pv(l),h=Xre(t,l)-u;h<s?(s=h,o=u<o?u:o,a=l):h===s&&u<o&&(o=u,a=l)}n=a||n.children[0]}return n}_insert(t,n,i){const r=i?t:this.toBBox(t),o=[],s=this._chooseSubtree(r,this.data,n,o);for(s.children.push(t),lf(s,r);n>=0&&o[n].children.length>this._maxEntries;)this._split(o,n),n--;this._adjustParentBBoxes(r,o,n)}_split(t,n){const i=t[n],r=i.children.length,o=this._minEntries;this._chooseSplitAxis(i,o,r);const s=this._chooseSplitIndex(i,o,r),a=Uu(i.children.splice(s,i.children.length-s));a.height=i.height,a.leaf=i.leaf,Du(i,this.toBBox),Du(a,this.toBBox),n?t[n-1].children.push(a):this._splitRoot(i,a)}_splitRoot(t,n){this.data=Uu([t,n]),this.data.height=t.height+1,this.data.leaf=!1,Du(this.data,this.toBBox)}_chooseSplitIndex(t,n,i){let r,o=1/0,s=1/0;for(let a=n;a<=i-n;a++){const c=cf(t,0,a,this.toBBox),l=cf(t,a,i,this.toBBox),u=Zre(c,l),h=Pv(c)+Pv(l);u<o?(o=u,r=a,s=h<s?h:s):u===o&&h<s&&(s=h,r=a)}return r||i-n}_chooseSplitAxis(t,n,i){const r=t.leaf?this.compareMinX:Nre,o=t.leaf?this.compareMinY:kre,s=this._allDistMargin(t,n,i,r),a=this._allDistMargin(t,n,i,o);s<a&&t.children.sort(r)}_allDistMargin(t,n,i,r){t.children.sort(r);const o=this.toBBox,s=cf(t,0,n,o),a=cf(t,i-n,i,o);let c=Hm(s)+Hm(a);for(let l=n;l<i-n;l++){const u=t.children[l];lf(s,t.leaf?o(u):u),c+=Hm(s)}for(let l=i-n-1;l>=n;l--){const u=t.children[l];lf(a,t.leaf?o(u):u),c+=Hm(a)}return c}_adjustParentBBoxes(t,n,i){for(let r=i;r>=0;r--)lf(n[r],t)}_condense(t){for(let n=t.length-1,i;n>=0;n--)t[n].children.length===0?n>0?(i=t[n-1].children,i.splice(i.indexOf(t[n]),1)):this.clear():Du(t[n],this.toBBox)}};function zre(e,t,n){if(!n)return t.indexOf(e);for(let i=0;i<t.length;i++)if(n(e,t[i]))return i;return-1}function Du(e,t){cf(e,0,e.children.length,t,e)}function cf(e,t,n,i,r){r||(r=Uu(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let o=t;o<n;o++){const s=e.children[o];lf(r,e.leaf?i(s):s)}return r}function lf(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function Nre(e,t){return e.minX-t.minX}function kre(e,t){return e.minY-t.minY}function Pv(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function Hm(e){return e.maxX-e.minX+(e.maxY-e.minY)}function Xre(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function Zre(e,t){const n=Math.max(e.minX,t.minX),i=Math.max(e.minY,t.minY),r=Math.min(e.maxX,t.maxX),o=Math.min(e.maxY,t.maxY);return Math.max(0,r-n)*Math.max(0,o-i)}function Ov(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function jm(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function Uu(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function QM(e,t,n,i,r){const o=[t,n];for(;o.length;){if(n=o.pop(),t=o.pop(),n-t<=i)continue;const s=t+Math.ceil((n-t)/i/2)*i;Vre(e,s,t,n,r),o.push(t,s,s,n)}}var Gv={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.earthRadius=63710088e-1,e.factors={centimeters:e.earthRadius*100,centimetres:e.earthRadius*100,degrees:e.earthRadius/111325,feet:e.earthRadius*3.28084,inches:e.earthRadius*39.37,kilometers:e.earthRadius/1e3,kilometres:e.earthRadius/1e3,meters:e.earthRadius,metres:e.earthRadius,miles:e.earthRadius/1609.344,millimeters:e.earthRadius*1e3,millimetres:e.earthRadius*1e3,nauticalmiles:e.earthRadius/1852,radians:1,yards:e.earthRadius*1.0936},e.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/e.earthRadius,yards:1.0936133},e.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function t(k,P,w){w===void 0&&(w={});var x={type:"Feature"};return(w.id===0||w.id)&&(x.id=w.id),w.bbox&&(x.bbox=w.bbox),x.properties=P||{},x.geometry=k,x}e.feature=t;function n(k,P,w){switch(k){case"Point":return i(P).geometry;case"LineString":return a(P).geometry;case"Polygon":return o(P).geometry;case"MultiPoint":return h(P).geometry;case"MultiLineString":return u(P).geometry;case"MultiPolygon":return d(P).geometry;default:throw new Error(k+" is invalid")}}e.geometry=n;function i(k,P,w){if(w===void 0&&(w={}),!k)throw new Error("coordinates is required");if(!Array.isArray(k))throw new Error("coordinates must be an Array");if(k.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!V(k[0])||!V(k[1]))throw new Error("coordinates must contain numbers");var x={type:"Point",coordinates:k};return t(x,P,w)}e.point=i;function r(k,P,w){return w===void 0&&(w={}),l(k.map(function(x){return i(x,P)}),w)}e.points=r;function o(k,P,w){w===void 0&&(w={});for(var x=0,I=k;x<I.length;x++){var X=I[x];if(X.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var D=0;D<X[X.length-1].length;D++)if(X[X.length-1][D]!==X[0][D])throw new Error("First and last Position are not equivalent.")}var Y={type:"Polygon",coordinates:k};return t(Y,P,w)}e.polygon=o;function s(k,P,w){return w===void 0&&(w={}),l(k.map(function(x){return o(x,P)}),w)}e.polygons=s;function a(k,P,w){if(w===void 0&&(w={}),k.length<2)throw new Error("coordinates must be an array of two or more positions");var x={type:"LineString",coordinates:k};return t(x,P,w)}e.lineString=a;function c(k,P,w){return w===void 0&&(w={}),l(k.map(function(x){return a(x,P)}),w)}e.lineStrings=c;function l(k,P){P===void 0&&(P={});var w={type:"FeatureCollection"};return P.id&&(w.id=P.id),P.bbox&&(w.bbox=P.bbox),w.features=k,w}e.featureCollection=l;function u(k,P,w){w===void 0&&(w={});var x={type:"MultiLineString",coordinates:k};return t(x,P,w)}e.multiLineString=u;function h(k,P,w){w===void 0&&(w={});var x={type:"MultiPoint",coordinates:k};return t(x,P,w)}e.multiPoint=h;function d(k,P,w){w===void 0&&(w={});var x={type:"MultiPolygon",coordinates:k};return t(x,P,w)}e.multiPolygon=d;function f(k,P,w){w===void 0&&(w={});var x={type:"GeometryCollection",geometries:k};return t(x,P,w)}e.geometryCollection=f;function p(k,P){if(P===void 0&&(P=0),P&&!(P>=0))throw new Error("precision must be a positive number");var w=Math.pow(10,P||0);return Math.round(k*w)/w}e.round=p;function m(k,P){P===void 0&&(P="kilometers");var w=e.factors[P];if(!w)throw new Error(P+" units is invalid");return k*w}e.radiansToLength=m;function y(k,P){P===void 0&&(P="kilometers");var w=e.factors[P];if(!w)throw new Error(P+" units is invalid");return k/w}e.lengthToRadians=y;function g(k,P){return S(y(k,P))}e.lengthToDegrees=g;function v(k){var P=k%360;return P<0&&(P+=360),P}e.bearingToAzimuth=v;function S(k){var P=k%(2*Math.PI);return P*180/Math.PI}e.radiansToDegrees=S;function E(k){var P=k%360;return P*Math.PI/180}e.degreesToRadians=E;function C(k,P,w){if(P===void 0&&(P="kilometers"),w===void 0&&(w="kilometers"),!(k>=0))throw new Error("length must be a positive number");return m(y(k,P),w)}e.convertLength=C;function O(k,P,w){if(P===void 0&&(P="meters"),w===void 0&&(w="kilometers"),!(k>=0))throw new Error("area must be a positive number");var x=e.areaFactors[P];if(!x)throw new Error("invalid original units");var I=e.areaFactors[w];if(!I)throw new Error("invalid final units");return k/x*I}e.convertArea=O;function V(k){return!isNaN(k)&&k!==null&&!Array.isArray(k)}e.isNumber=V;function A(k){return!!k&&k.constructor===Object}e.isObject=A;function G(k){if(!k)throw new Error("bbox is required");if(!Array.isArray(k))throw new Error("bbox must be an Array");if(k.length!==4&&k.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");k.forEach(function(P){if(!V(P))throw new Error("bbox must only contain numbers")})}e.validateBBox=G;function N(k){if(!k)throw new Error("id is required");if(["string","number"].indexOf(typeof k)===-1)throw new Error("id must be a number or a string")}e.validateId=N})(Gv);var ni={};Object.defineProperty(ni,"__esModule",{value:!0});var Wi=Gv;function uf(e,t,n){if(e!==null)for(var i,r,o,s,a,c,l,u=0,h=0,d,f=e.type,p=f==="FeatureCollection",m=f==="Feature",y=p?e.features.length:1,g=0;g<y;g++){l=p?e.features[g].geometry:m?e.geometry:e,d=l?l.type==="GeometryCollection":!1,a=d?l.geometries.length:1;for(var v=0;v<a;v++){var S=0,E=0;if(s=d?l.geometries[v]:l,s!==null){c=s.coordinates;var C=s.type;switch(u=n&&(C==="Polygon"||C==="MultiPolygon")?1:0,C){case null:break;case"Point":if(t(c,h,g,S,E)===!1)return!1;h++,S++;break;case"LineString":case"MultiPoint":for(i=0;i<c.length;i++){if(t(c[i],h,g,S,E)===!1)return!1;h++,C==="MultiPoint"&&S++}C==="LineString"&&S++;break;case"Polygon":case"MultiLineString":for(i=0;i<c.length;i++){for(r=0;r<c[i].length-u;r++){if(t(c[i][r],h,g,S,E)===!1)return!1;h++}C==="MultiLineString"&&S++,C==="Polygon"&&E++}C==="Polygon"&&S++;break;case"MultiPolygon":for(i=0;i<c.length;i++){for(E=0,r=0;r<c[i].length;r++){for(o=0;o<c[i][r].length-u;o++){if(t(c[i][r][o],h,g,S,E)===!1)return!1;h++}E++}S++}break;case"GeometryCollection":for(i=0;i<s.geometries.length;i++)if(uf(s.geometries[i],t,n)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Dre(e,t,n,i){var r=n;return uf(e,function(o,s,a,c,l){s===0&&n===void 0?r=o:r=t(r,o,s,a,c,l)},i),r}function qM(e,t){var n;switch(e.type){case"FeatureCollection":for(n=0;n<e.features.length&&t(e.features[n].properties,n)!==!1;n++);break;case"Feature":t(e.properties,0);break}}function Ure(e,t,n){var i=n;return qM(e,function(r,o){o===0&&n===void 0?i=r:i=t(i,r,o)}),i}function $M(e,t){if(e.type==="Feature")t(e,0);else if(e.type==="FeatureCollection")for(var n=0;n<e.features.length&&t(e.features[n],n)!==!1;n++);}function Wre(e,t,n){var i=n;return $M(e,function(r,o){o===0&&n===void 0?i=r:i=t(i,r,o)}),i}function Bre(e){var t=[];return uf(e,function(n){t.push(n)}),t}function Vv(e,t){var n,i,r,o,s,a,c,l,u,h,d=0,f=e.type==="FeatureCollection",p=e.type==="Feature",m=f?e.features.length:1;for(n=0;n<m;n++){for(a=f?e.features[n].geometry:p?e.geometry:e,l=f?e.features[n].properties:p?e.properties:{},u=f?e.features[n].bbox:p?e.bbox:void 0,h=f?e.features[n].id:p?e.id:void 0,c=a?a.type==="GeometryCollection":!1,s=c?a.geometries.length:1,r=0;r<s;r++){if(o=c?a.geometries[r]:a,o===null){if(t(null,d,l,u,h)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(o,d,l,u,h)===!1)return!1;break}case"GeometryCollection":{for(i=0;i<o.geometries.length;i++)if(t(o.geometries[i],d,l,u,h)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}d++}}function Yre(e,t,n){var i=n;return Vv(e,function(r,o,s,a,c){o===0&&n===void 0?i=r:i=t(i,r,o,s,a,c)}),i}function Km(e,t){Vv(e,function(n,i,r,o,s){var a=n===null?null:n.type;switch(a){case null:case"Point":case"LineString":case"Polygon":return t(Wi.feature(n,r,{bbox:o,id:s}),i,0)===!1?!1:void 0}var c;switch(a){case"MultiPoint":c="Point";break;case"MultiLineString":c="LineString";break;case"MultiPolygon":c="Polygon";break}for(var l=0;l<n.coordinates.length;l++){var u=n.coordinates[l],h={type:c,coordinates:u};if(t(Wi.feature(h,r),i,l)===!1)return!1}})}function Hre(e,t,n){var i=n;return Km(e,function(r,o,s){o===0&&s===0&&n===void 0?i=r:i=t(i,r,o,s)}),i}function e5(e,t){Km(e,function(n,i,r){var o=0;if(n.geometry){var s=n.geometry.type;if(!(s==="Point"||s==="MultiPoint")){var a,c=0,l=0,u=0;if(uf(n,function(h,d,f,p,m){if(a===void 0||i>c||p>l||m>u){a=h,c=i,l=p,u=m,o=0;return}var y=Wi.lineString([a,h],n.properties);if(t(y,i,r,m,o)===!1)return!1;o++,a=h})===!1)return!1}}})}function jre(e,t,n){var i=n,r=!1;return e5(e,function(o,s,a,c,l){r===!1&&n===void 0?i=o:i=t(i,o,s,a,c,l),r=!0}),i}function t5(e,t){if(!e)throw new Error("geojson is required");Km(e,function(n,i,r){if(n.geometry!==null){var o=n.geometry.type,s=n.geometry.coordinates;switch(o){case"LineString":if(t(n,i,r,0,0)===!1)return!1;break;case"Polygon":for(var a=0;a<s.length;a++)if(t(Wi.lineString(s[a],n.properties),i,r,a)===!1)return!1;break}}})}function Kre(e,t,n){var i=n;return t5(e,function(r,o,s,a){o===0&&n===void 0?i=r:i=t(i,r,o,s,a)}),i}function Jre(e,t){if(t=t||{},!Wi.isObject(t))throw new Error("options is invalid");var n=t.featureIndex||0,i=t.multiFeatureIndex||0,r=t.geometryIndex||0,o=t.segmentIndex||0,s=t.properties,a;switch(e.type){case"FeatureCollection":n<0&&(n=e.features.length+n),s=s||e.features[n].properties,a=e.features[n].geometry;break;case"Feature":s=s||e.properties,a=e.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":a=e;break;default:throw new Error("geojson is invalid")}if(a===null)return null;var c=a.coordinates;switch(a.type){case"Point":case"MultiPoint":return null;case"LineString":return o<0&&(o=c.length+o-1),Wi.lineString([c[o],c[o+1]],s,t);case"Polygon":return r<0&&(r=c.length+r),o<0&&(o=c[r].length+o-1),Wi.lineString([c[r][o],c[r][o+1]],s,t);case"MultiLineString":return i<0&&(i=c.length+i),o<0&&(o=c[i].length+o-1),Wi.lineString([c[i][o],c[i][o+1]],s,t);case"MultiPolygon":return i<0&&(i=c.length+i),r<0&&(r=c[i].length+r),o<0&&(o=c[i][r].length-o-1),Wi.lineString([c[i][r][o],c[i][r][o+1]],s,t)}throw new Error("geojson is invalid")}function Qre(e,t){if(t=t||{},!Wi.isObject(t))throw new Error("options is invalid");var n=t.featureIndex||0,i=t.multiFeatureIndex||0,r=t.geometryIndex||0,o=t.coordIndex||0,s=t.properties,a;switch(e.type){case"FeatureCollection":n<0&&(n=e.features.length+n),s=s||e.features[n].properties,a=e.features[n].geometry;break;case"Feature":s=s||e.properties,a=e.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":a=e;break;default:throw new Error("geojson is invalid")}if(a===null)return null;var c=a.coordinates;switch(a.type){case"Point":return Wi.point(c,s,t);case"MultiPoint":return i<0&&(i=c.length+i),Wi.point(c[i],s,t);case"LineString":return o<0&&(o=c.length+o),Wi.point(c[o],s,t);case"Polygon":return r<0&&(r=c.length+r),o<0&&(o=c[r].length+o),Wi.point(c[r][o],s,t);case"MultiLineString":return i<0&&(i=c.length+i),o<0&&(o=c[i].length+o),Wi.point(c[i][o],s,t);case"MultiPolygon":return i<0&&(i=c.length+i),r<0&&(r=c[i].length+r),o<0&&(o=c[i][r].length-o),Wi.point(c[i][r][o],s,t)}throw new Error("geojson is invalid")}ni.coordAll=Bre,ni.coordEach=uf,ni.coordReduce=Dre,ni.featureEach=$M,ni.featureReduce=Wre,ni.findPoint=Qre,ni.findSegment=Jre,ni.flattenEach=Km,ni.flattenReduce=Hre,ni.geomEach=Vv,ni.geomReduce=Yre,ni.lineEach=t5,ni.lineReduce=Kre,ni.propEach=qM,ni.propReduce=Ure,ni.segmentEach=e5,ni.segmentReduce=jre;var Fv={};Object.defineProperty(Fv,"__esModule",{value:!0});var qre=ni;function Av(e){var t=[1/0,1/0,-1/0,-1/0];return qre.coordEach(e,function(n){t[0]>n[0]&&(t[0]=n[0]),t[1]>n[1]&&(t[1]=n[1]),t[2]<n[0]&&(t[2]=n[0]),t[3]<n[1]&&(t[3]=n[1])}),t}Av.default=Av,Fv.default=Av;var Ms=Are,n5=Gv,i5=ni,Wu=Fv.default,$re=i5.featureEach;i5.coordEach,n5.polygon;var r5=n5.featureCollection;function o5(e){var t=new Ms(e);return t.insert=function(n){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:Wu(n),Ms.prototype.insert.call(this,n)},t.load=function(n){var i=[];return Array.isArray(n)?n.forEach(function(r){if(r.type!=="Feature")throw new Error("invalid features");r.bbox=r.bbox?r.bbox:Wu(r),i.push(r)}):$re(n,function(r){if(r.type!=="Feature")throw new Error("invalid features");r.bbox=r.bbox?r.bbox:Wu(r),i.push(r)}),Ms.prototype.load.call(this,i)},t.remove=function(n,i){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:Wu(n),Ms.prototype.remove.call(this,n,i)},t.clear=function(){return Ms.prototype.clear.call(this)},t.search=function(n){var i=Ms.prototype.search.call(this,this.toBBox(n));return r5(i)},t.collides=function(n){return Ms.prototype.collides.call(this,this.toBBox(n))},t.all=function(){var n=Ms.prototype.all.call(this);return r5(n)},t.toJSON=function(){return Ms.prototype.toJSON.call(this)},t.fromJSON=function(n){return Ms.prototype.fromJSON.call(this,n)},t.toBBox=function(n){var i;if(n.bbox)i=n.bbox;else if(Array.isArray(n)&&n.length===4)i=n;else if(Array.isArray(n)&&n.length===6)i=[n[0],n[1],n[3],n[4]];else if(n.type==="Feature")i=Wu(n);else if(n.type==="FeatureCollection")i=Wu(n);else throw new Error("invalid geojson");return{minX:i[0],minY:i[1],maxX:i[2],maxY:i[3]}},t}Lv.exports=o5,Lv.exports.default=o5;function zv(e,t){var n={},i=[];if(e.type==="LineString"&&(e=gl(e)),t.type==="LineString"&&(t=gl(t)),e.type==="Feature"&&t.type==="Feature"&&e.geometry!==null&&t.geometry!==null&&e.geometry.type==="LineString"&&t.geometry.type==="LineString"&&e.geometry.coordinates.length===2&&t.geometry.coordinates.length===2){var r=s5(e,t);return r&&i.push(r),Wm(i)}var o=Lv.exports();return o.load(KM(t)),HM(KM(e),function(s){HM(o.search(s),function(a){var c=s5(s,a);if(c){var l=of(c).join(",");n[l]||(n[l]=!0,i.push(c))}})}),Wm(i)}function s5(e,t){var n=of(e),i=of(t);if(n.length!==2)throw new Error("<intersects> line1 must only contain 2 coordinates");if(i.length!==2)throw new Error("<intersects> line2 must only contain 2 coordinates");var r=n[0][0],o=n[0][1],s=n[1][0],a=n[1][1],c=i[0][0],l=i[0][1],u=i[1][0],h=i[1][1],d=(h-l)*(s-r)-(u-c)*(a-o),f=(u-c)*(o-l)-(h-l)*(r-c),p=(s-r)*(o-l)-(a-o)*(r-c);if(d===0)return null;var m=f/d,y=p/d;if(m>=0&&m<=1&&y>=0&&y<=1){var g=r+m*(s-r),v=o+m*(a-o);return Cre([g,v])}return null}function Nv(e,t){t===void 0&&(t={});var n=Ym(e);switch(!t.properties&&e.type==="Feature"&&(t.properties=e.properties),n.type){case"Polygon":return eoe(n,t);case"MultiPolygon":return toe(n,t);default:throw new Error("invalid poly")}}function eoe(e,t){t===void 0&&(t={});var n=Ym(e),i=n.coordinates,r=t.properties?t.properties:e.type==="Feature"?e.properties:{};return a5(i,r)}function toe(e,t){t===void 0&&(t={});var n=Ym(e),i=n.coordinates,r=t.properties?t.properties:e.type==="Feature"?e.properties:{},o=[];return i.forEach(function(s){o.push(a5(s,r))}),Wm(o)}function a5(e,t){return e.length>1?Rre(e,t):WM(e[0],t)}function noe(e,t){var n=!0;return rf(e,function(i){rf(t,function(r){if(n===!1)return!1;n=ioe(i.geometry,r.geometry)})}),n}function ioe(e,t){switch(e.type){case"Point":switch(t.type){case"Point":return!aoe(e.coordinates,t.coordinates);case"LineString":return!c5(t,e);case"Polygon":return!sf(e,t)}break;case"LineString":switch(t.type){case"Point":return!c5(e,t);case"LineString":return!roe(e,t);case"Polygon":return!l5(t,e)}break;case"Polygon":switch(t.type){case"Point":return!sf(t,e);case"LineString":return!l5(e,t);case"Polygon":return!ooe(t,e)}}return!1}function c5(e,t){for(var n=0;n<e.coordinates.length-1;n++)if(soe(e.coordinates[n],e.coordinates[n+1],t.coordinates))return!0;return!1}function roe(e,t){var n=zv(e,t);return n.features.length>0}function l5(e,t){for(var n=0,i=t.coordinates;n<i.length;n++){var r=i[n];if(sf(r,e))return!0}var o=zv(t,Nv(e));return o.features.length>0}function ooe(e,t){for(var n=0,i=e.coordinates[0];n<i.length;n++){var r=i[n];if(sf(r,t))return!0}for(var o=0,s=t.coordinates[0];o<s.length;o++){var a=s[o];if(sf(a,e))return!0}var c=zv(Nv(e),Nv(t));return c.features.length>0}function soe(e,t,n){var i=n[0]-e[0],r=n[1]-e[1],o=t[0]-e[0],s=t[1]-e[1],a=i*s-r*o;return a!==0?!1:Math.abs(o)>=Math.abs(s)?o>0?e[0]<=n[0]&&n[0]<=t[0]:t[0]<=n[0]&&n[0]<=e[0]:s>0?e[1]<=n[1]&&n[1]<=t[1]:t[1]<=n[1]&&n[1]<=e[1]}function aoe(e,t){return e[0]===t[0]&&e[1]===t[1]}function u5(e,t){var n=!1;return rf(e,function(i){rf(t,function(r){if(n===!0)return!0;n=!noe(i.geometry,r.geometry)})}),n}const coe=Math.PI/180,kv=28;function loe(e){for(let t=0;t<kv;t++){const n=1<<32-(t+1);if((e[0]&n)!==(e[2]&n)||(e[1]&n)!==(e[3]&n))return t}return kv}function uoe(e,t){const n=Jm(e[0],e[1],32),i=Jm(e[2],e[3],32),r=[n[0],n[1],i[0],i[1]],o=Math.min(loe(r),typeof t<"u"?t:kv);if(o===0)return[0,0,0];const s=r[0]>>>32-o,a=r[1]>>>32-o;return[s,a,o]}function Jm(e,t,n){var i=hoe(e,t,n);return i[0]=Math.floor(i[0]),i[1]=Math.floor(i[1]),i}function hoe(e,t,n){var i=Math.sin(t*coe),r=Math.pow(2,n),o=r*(e/360+.5),s=r*(.5-.25*Math.log((1+i)/(1-i))/Math.PI);return o=o%r,o<0&&(o=o+r),[o,s,n]}function doe(e,t,n,i){let r=poe(e,t,n);return boe(r,i)}function foe(e,t){const n=_oe(e,t);return moe(n)}function poe(e,t,n){let i=0n;return i=Xv(e)|Xv(t)<<1n|Xv(n)<<2n,i}function moe(e){let t=Zv(e),n=Zv(e>>1n),i=Zv(e>>2n);return[t,n,i]}function Xv(e){let t=BigInt(e)&BigInt("0x3ffffffffff");return t=(t|t<<64n)&BigInt("0x3ff0000000000000000ffffffff"),t=(t|t<<32n)&BigInt("0x3ff00000000ffff00000000ffff"),t=(t|t<<16n)&BigInt("0x30000ff0000ff0000ff0000ff0000ff"),t=(t|t<<8n)&BigInt("0x300f00f00f00f00f00f00f00f00f00f"),t=(t|t<<4n)&BigInt("0x30c30c30c30c30c30c30c30c30c30c3"),t=(t|t<<2n)&BigInt("0x9249249249249249249249249249249"),t}function Zv(e){let t=e&BigInt("0x9249249249249249249249249249249");return t=(t|t>>2n)&BigInt("0x30c30c30c30c30c30c30c30c30c30c3"),t=(t|t>>4n)&BigInt("0x300f00f00f00f00f00f00f00f00f00f"),t=(t|t>>8n)&BigInt("0x30000ff0000ff0000ff0000ff0000ff"),t=(t|t>>16n)&BigInt("0x3ff00000000ffff00000000ffff"),t=(t|t>>32n)&BigInt("0x3ff0000000000000000ffffffff"),t=(t|t>>64n)&BigInt("0x3ffffffffff"),Number(t)}const goe=[48,33,27,34,47,78,28,77,66,29,51,52,65,30,72,63,76,95,75,24,53,54,82,81,18,3,17,80,61,4,62,15,0,59,71,60,49,50,86,85,84,83,5,90,79,56,6,89,32,23,1,94,11,12,2,93,42,41,13,14,35,88,36,31,92,37,87,38,91,74,8,73,46,45,9,10,7,20,64,19,70,25,39,16,69,26,44,43,22,55,21,68,57,40,58,67],yoe=[48,33,35,26,30,79,77,44,78,68,64,50,51,25,29,63,27,87,86,74,72,52,53,89,83,18,16,1,5,60,62,15,0,52,53,57,59,87,86,66,61,95,91,81,80,2,6,76,32,2,6,12,13,95,91,17,93,41,40,36,38,10,11,31,14,79,77,92,88,33,35,82,70,10,11,23,21,41,40,4,19,25,29,47,46,68,64,34,45,60,62,71,67,18,16,49];function h5(e,t,n){let i=0,r=0n;for(let o=3*(t-1);o>=0;o-=3)i=n[i|Number(e>>BigInt(o)&7n)],r=r<<3n|BigInt(i&7),i&=-8;return r}function boe(e,t){return h5(e,t,goe)}function _oe(e,t){return h5(e,t,yoe)}function voe(e){const t=e.z>0?e.f+2**(e.z-1):0;return doe(e.x,e.y,t,e.z)}function woe(e,t){if(t===0)return{z:0,f:0,x:0,y:0};const[n,i,r]=foe(e,t);return{f:r-2**(t-1),x:n,y:i,z:t}}function xoe(e,t){return"H"+e.toString(8).padStart(t,"0").split("").map(n=>(parseInt(n)+1).toString()).join("")}function Soe(e){if(e[0]!=="H")return;const t=e.substring(1).split("").map(i=>(parseInt(i)-1).toString()).join(""),n=BigInt("0o"+t);return woe(n,t.length)}const Eoe=25;class Bi{constructor(t,n){if(typeof t=="string"){let i=vre(t)||Soe(t)||Ere(t);if(i)this.zfxy=i,this._regenerateAttributesFromZFXY();else throw new Error(`parse ZFXY failed with input: ${t}`);return}else if(bre(t)){this.zfxy=t,this._regenerateAttributesFromZFXY();return}else this.zfxy=Sre({...t,zoom:typeof n<"u"?n:Eoe});this._regenerateAttributesFromZFXY()}up(t=1){return this.move({f:t})}down(t=1){return this.move({f:-t})}north(t=1){return this.move({y:t})}south(t=1){return this.move({y:-t})}east(t=1){return this.move({x:t})}west(t=1){return this.move({x:-t})}move(t){const n=new Bi(this.zfxy);return n.zfxy=Is({z:n.zfxy.z,f:n.zfxy.f+(t.f||0),x:n.zfxy.x+(t.x||0),y:n.zfxy.y+(t.y||0)}),n._regenerateAttributesFromZFXY(),n}parent(t){const n=typeof t>"u"?1:this.zfxy.z-t;return new Bi(DM(this.zfxy,n))}children(){return Um(this.zfxy).map(t=>new Bi(t))}surroundings(){return[...Iv(this.zfxy).filter(({z:t,f:n,x:i,y:r})=>`/${t}/${n}/${i}/${r}`!==this.zfxyStr).map(t=>new Bi(t)),...Iv(this.up().zfxy).map(t=>new Bi(t)),...Iv(this.down().zfxy).map(t=>new Bi(t))]}contains(t){const n=this.toGeoJSON(),i={type:"Point",coordinates:[t.lng,t.lat]},r=this.alt,o=nf({...this.zfxy,f:this.zfxy.f+1});return u5(n,i)&&(typeof t.alt<"u"?t.alt>=r&&t.alt<o:!0)}toGeoJSON(){const[t,n]=UM(this.zfxy);return{type:"Polygon",coordinates:[[[t.lng,t.lat],[t.lng,n.lat],[n.lng,n.lat],[n.lng,t.lat],[t.lng,t.lat]]]}}vertices3d(){const[t,n]=UM(this.zfxy),i=nf(this.zfxy),r=nf({...this.zfxy,f:this.zfxy.f+1});return[[t.lng,t.lat,i],[t.lng,n.lat,i],[n.lng,n.lat,i],[n.lng,t.lat,i],[t.lng,t.lat,r],[t.lng,n.lat,r],[n.lng,n.lat,r],[n.lng,t.lat,r]]}static getSpaceById(t,n){return new Bi(t,n)}static getSpaceByLocation(t,n){return new Bi(t,n)}static getSpaceByZFXY(t){return new Bi(t)}static boundingSpaceForGeometry(t,n){n=n||25;const i=Bm(t),r=uoe(i,n),[o,s,a]=r;return new Bi({x:o,y:s,z:a,f:0})}static spacesForGeometry(t,n){const i=n;if(i===0)return[new Bi("0/0/0/0")];if(t.type==="GeometryCollection")throw new Error("GeometryCollection not supported");const r=Bm(t),o=Jm(r[0],r[1],32),s=Jm(r[2],r[3],32),a=Math.min(o[0],s[0])>>>32-i,c=Math.min(o[1],s[1])>>>32-i,l=(Math.max(s[0],o[0])>>>32-i)+1,u=(Math.max(s[1],o[1])>>>32-i)+1,h=[];for(let d=a;d<=l;d++)for(let f=c;f<=u;f++){const p=new Bi({x:d,y:f,z:i,f:0});u5(t,p.toGeoJSON())&&h.push(p)}return h}_regenerateAttributesFromZFXY(){this.alt=nf(this.zfxy),this.center=xre(this.zfxy),this.zoom=this.zfxy.z,this.id=this.tilehash=Tre(this.zfxy),this.zfxyStr=`/${this.zfxy.z}/${this.zfxy.f}/${this.zfxy.x}/${this.zfxy.y}`,this.hilbertIndex=voe(this.zfxy),this.hilbertTilehash=xoe(this.hilbertIndex,this.zfxy.z)}}const Dv=e=>{const t=e.vertices3d(),n=[t[0][0],t[1][1],t[2][0],t[3][1]],i=t[0][2],r=t[4][2];return{wsen:n,height:i,extrudedHeight:r}},Qm=(e,t,n,i,r)=>{const o=new Bi({lat:t,lng:e,alt:n},i),{wsen:s,height:a,extrudedHeight:c}=Dv(o);return{id:oc(),space:o,wsen:s,height:a+r,extrudedHeight:c+r}},Toe=e=>({id:e.id,center:e.center,alt:e.alt,zoom:e.zoom,zfxy:e.zfxy,zfxyStr:e.zfxyStr,tilehash:e.tilehash,hilbertTilehash:e.hilbertTilehash,hilbertIndex:e.hilbertIndex.toString(),vertices:e.vertices3d()}),Coe=(e,t,n)=>{const i=new Bi({lat:0,lng:0,alt:e},n),r=new Bi({lat:0,lng:0,alt:t},n),{height:o}=Dv(i),{extrudedHeight:s}=Dv(r);return{top:o,bottom:s}},Roe=({ref:e,engineRef:t,geoidRef:n,terrainEnabled:i,interactionMode:r,overrideInteractionMode:o,onMount:s})=>{const[a,c]=R.useState("idle"),[l,u]=R.useState(null),[h,d]=R.useState(null),[f,p]=R.useState(null),m=R.useRef(null),[y,g]=R.useState(null),v=R.useRef(null),[S,E]=R.useState(null),[C,O]=R.useState(null),[V,A]=R.useState(yre),G=R.useMemo(()=>Coe(V.maxHeight,V.minHeight,V.zoom),[V.maxHeight,V.minHeight,V.zoom]),N=R.useMemo(()=>{const fe=[...l??[],...y?[y]:[]];if(!fe)return null;const Xe=fe.reduce((tt,nt)=>(tt.find(Z=>Z.space.zfxy.z===nt.space.zfxy.z&&Z.space.zfxy.x===nt.space.zfxy.x&&Z.space.zfxy.y===nt.space.zfxy.y)||tt.push(nt),tt),[]);return Xe.length===0?null:Xe.map(tt=>{const{wsen:nt}=tt;return{id:oc(),spaceId:tt.space.id,wsen:nt,color:V.groundIndicatorColor}})},[l,y,V.groundIndicatorColor]),k=R.useCallback(fe=>{c("coordinate"),A(Xe=>({...Xe,...fe})),o?.("spatialId"),setTimeout(()=>{t.current?.setCursor("crosshair")},100)},[t,o]),P=R.useRef(r);P.current=r;const w=R.useCallback(()=>{c("idle"),E(null),O(null),g(null),p(null),m.current=null,v.current=null,d(null),o?.(P.current==="spatialId"?"default":P.current??"default"),t.current?.setCursor("default"),t.current?.requestRender()},[o,t]),x=R.useCallback(async fe=>{if(a!=="idle"&&!Pe.current){if(a==="coordinate"){if(!f||fe.lat===void 0||fe.lng===void 0||fe.lat>Dm.max||fe.lat<Dm.min)return;c("fetchingGeoid");const{id:Xe,wsen:tt,space:nt}=Qm(fe.lng,fe.lat,0,V.zoom,0);requestAnimationFrame(()=>{t.current?.setCursor("wait")});const[Z,pe]=await Promise.all([n.current?.getGeoidHeight(fe.lng,fe.lat),n.current?.getGeoidHeight(nt.center.lng,nt.center.lat)]);if(setTimeout(()=>{t.current?.setCursor("crosshair")},100),Z===void 0&&pe===void 0){c("coordinate");return}const ue=Z??pe??0,$=pe??Z??0;v.current=$,d({id:Xe,wsen:tt,height:G.top+$,extrudedHeight:G.bottom+$,color:V.verticalSpaceIndicatorColor,outlineColor:V.verticalSpaceIndicatorOutlineColor}),O([fe.lng,fe.lat,(i?fe.height??0:0)-ue]),E(t.current?.toXYZ(fe.lng,fe.lat,fe.height??0)??null);const j=Qm(fe.lng,fe.lat,(i?fe.height??0:0)-ue,V.zoom,$);g({...j,color:V.color,outlineColor:V.outlineColor}),m.current=f,p(null),t.current?.requestRender(),c("floor")}else if(a==="floor"){if(!y)return;const Xe={...y,id:oc(),color:V.color,outlineColor:V.outlineColor};V.dataOnly||u(nt=>nt?[...nt,Xe]:[Xe]),w();const tt=Toe(Xe.space);be.current.forEach(nt=>nt(tt))}}},[a,i,t,n,y,V,G,f,w]),I=R.useCallback(fe=>{if(a!=="idle"&&!Pe.current){if(a==="coordinate"){if(fe.lat===void 0||fe.lng===void 0||fe.lat>Dm.max||fe.lat<Dm.min)return;const Xe=Qm(fe.lng,fe.lat,0,V.zoom,0);if(Xe.space.id===f?.uid)return;p({id:oc(),uid:Xe.space.id,wsen:Xe.wsen,color:V.selectorColor})}else if(a==="floor"){if(fe.x===void 0||fe.y===void 0||S===null||C===null)return;const Xe=t.current?.getExtrudedHeight(S,[fe.x,fe.y],!0)??0;if(C[2]+Xe>G.top||C[2]+Xe<G.bottom)return;const tt=Qm(C[0],C[1],C[2]+Xe,V.zoom,v.current??0);if(tt.space.id===y?.space.id)return;g({...tt,color:V.selectorColor,outlineColor:V.selectorOutlineColor})}}},[a,y,S,C,t,V,G,f?.uid]),X=R.useCallback(()=>{a!=="idle"&&(a==="coordinate"&&V.rightClickToExit?w():a==="floor"&&(g(null),E(null),O(null),d(null),p(m.current),c("coordinate"),v.current=null),t.current?.requestRender())},[a,V,t,w]),D=R.useCallback(()=>{X()},[X]);vv("keydown",fe=>{fe.code==="Escape"&&X()});const Y=R.useRef(!1),H=R.useRef(x);H.current=x;const J=R.useCallback(fe=>{H.current(fe)},[]),z=R.useRef(I);z.current=I;const W=R.useCallback(fe=>{z.current(fe)},[]),Q=R.useRef(D);Q.current=D;const q=R.useCallback(()=>{Q.current()},[]);R.useEffect(()=>{Y.current||!t.current||(Y.current=!0,t.current.onMouseUp(J),t.current.onMouseMove(W),t.current.onRightClick(q))},[t,J,W,q]);const oe=R.useRef(a);oe.current=a;const Ee=R.useRef(w);Ee.current=w,R.useEffect(()=>{Pe.current||r!=="spatialId"&&oe.current!=="idle"&&Ee.current()},[r]);const be=R.useRef([]),Ae=R.useCallback(fe=>{be.current.push(fe)},[]);R.useImperativeHandle(e,()=>({pickSpace:k,onSpacePick:Ae,exitPickSpace:w}),[k,Ae,w]);const Pe=R.useRef(!1);return R.useEffect(()=>{const fe=Xe=>{Xe.code==="Space"&&oe.current!=="idle"&&(Pe.current=!0,o?.("move"))};return window.addEventListener("keydown",fe),()=>{window.removeEventListener("keydown",fe)}},[o]),R.useEffect(()=>window.addEventListener("keyup",fe=>{fe.code==="Space"&&Pe.current&&(Pe.current=!1,o?.("spatialId"))}),[o]),R.useEffect(()=>{s?.()},[s]),{spatialIdSpaces:l,verticalSpaceIndicator:h,coordinateSelector:f,spaceSelector:y,groundIndicators:N}},Ioe=({engineRef:e,geoidRef:t,terrainEnabled:n,interactionMode:i,overrideInteractionMode:r,onMount:o},s)=>{const{spatialIdSpaces:a,verticalSpaceIndicator:c,coordinateSelector:l,spaceSelector:u,groundIndicators:h}=Roe({ref:s,engineRef:e,geoidRef:t,terrainEnabled:n,interactionMode:i,overrideInteractionMode:r,onMount:o});return ce.jsxs(ce.Fragment,{children:[a&&a.length>0&&a.map(d=>ce.jsx(Cv,{space:d},d.id)),h&&h.length>0&&h.map(d=>ce.jsx(Rv,{wsen:d.wsen,color:d.color},d.id)),c&&ce.jsx(XM,{indicator:c}),l&&ce.jsx(Rv,{wsen:l.wsen,color:l.color}),u&&ce.jsx(Cv,{space:u})]})},Moe=R.forwardRef(Ioe);var Uv={};try{Uv.EventTarget=new EventTarget().constructor}catch{(function(t,n){var i=t.create,r=t.defineProperty,o=s.prototype;a(o,"addEventListener",function(l,u,h){for(var d=n.get(this),f=d[l]||(d[l]=[]),p=0,m=f.length;p<m;p++)if(f[p].listener===u)return;f.push({target:this,listener:u,options:h})}),a(o,"dispatchEvent",function(l){var u=n.get(this),h=u[l.type];return h&&(a(l,"target",this),a(l,"currentTarget",this),h.slice(0).some(c,l),delete l.currentTarget,delete l.target),!0}),a(o,"removeEventListener",function(l,u){for(var h=n.get(this),d=h[l]||(h[l]=[]),f=0,p=d.length;f<p;f++)if(d[f].listener===u){d.splice(f,1);return}}),Uv.EventTarget=s;function s(){n.set(this,i(null))}function a(l,u,h){r(l,u,{configurable:!0,writable:!0,value:h})}function c(l){var u=l.options;return u&&u.once&&l.target.removeEventListener(this.type,l.listener),typeof l.listener=="function"?l.listener.call(l.target,this):l.listener.handleEvent(this),this._stopImmediatePropagationFlag}})(Object,new WeakMap)}const Loe=Uv.EventTarget;function Poe(){const e=new Loe,t=new Map,n=(c,l)=>{let u=t.get(c);u||(u=new Map,t.set(c,u));let h=u.get(l);return h||(h=d=>{l(...d.detail)},u.set(l,h)),h},i=(c,l)=>{t.get(c)?.delete(l)},r=(c,l)=>{const u=n(c,l);e.addEventListener(String(c),u)},o=(c,l)=>{const u=n(c,l);e.removeEventListener(String(c),u),i(c,u)},s=(c,l)=>{const u=n(c,l);e.addEventListener(String(c),u,{once:!0})};return[{get on(){return r},get off(){return o},get once(){return s}},(c,...l)=>e.dispatchEvent(new CustomEvent(String(c),{detail:l}))]}function Ooe(e,t,n){const i=n.reduce((r,o)=>({...r,[o]:(...s)=>{t(o,...s)}}),{});for(const r of Object.keys(i))e.on(r,i[r]);return()=>{for(const r of Object.keys(i))e.off(r,i[r])}}function Goe({engines:e,engine:t,isBuilt:n,isEditable:i,clusters:r,hiddenLayers:o,layers:s,overrides:a,timelineManagerRef:c,interactionMode:l,selectedFeature:u,onLayerSelect:h,overrideInteractionMode:d,onSketchTypeChange:f,onSketchFeatureCreate:p,onSketchPluginFeatureCreate:m,onSketchFeatureUpdate:y,onSketchPluginFeatureUpdate:g,onSketchFeatureDelete:v,onSketchPluginFeatureDelete:S,featureFlags:E=N0.default,onMount:C,onAPIReady:O,...V},A){const G=t?e?.[t]:void 0,N=G?.component,{engineRef:k,layersRef:P,sketchRef:w,spatialIdRef:x,geoidRef:I,selectedLayer:X,requestingRenderMode:D,handleLayerSelect:Y,handleEngineLayerSelect:H,sketchEditingFeature:J,setSketchEditingFeature:z,handleEngineMount:W,handleLayersMount:Q,handleSketchMount:q,handleSpatialIdMount:oe}=pU({ref:A,timelineManagerRef:c,onLayerSelect:h,onMount:C,onAPIReady:O}),Ee=R.useMemo(()=>({layerId:X.layerId,featureId:X.featureId}),[X.layerId,X.featureId]),be=R.useMemo(()=>X.reason,[X.reason]);return N?ce.jsxs(N,{ref:k,isBuilt:n,isEditable:i,selectedLayerId:Ee,layerSelectionReason:be,layersRef:P,requestingRenderMode:D,timelineManagerRef:c,onLayerSelect:H,featureFlags:E,onMount:W,...V,children:[ce.jsx(Bee,{ref:P,engineRef:k,clusters:r,hiddenLayers:o,isBuilt:n,isEditable:i,layers:s,overrides:a,selectedLayer:X,Feature:G?.featureComponent,clusterComponent:G?.clusterComponent,delegatedDataTypes:G.delegatedDataTypes,meta:V.meta,viewerProperty:V.property,requestingRenderMode:D,sketchEditingFeature:J,onLayerSelect:Y,onMount:Q}),ce.jsx(Sne,{ref:w,layersRef:P,engineRef:k,interactionMode:l,selectedFeature:u,SketchComponent:G?.sketchComponent,onLayerSelect:Y,overrideInteractionMode:d,onSketchTypeChange:f,onSketchFeatureCreate:p,onSketchPluginFeatureCreate:m,onSketchFeatureUpdate:y,onSketchPluginFeatureUpdate:g,onSketchFeatureDelete:v,onSketchPluginFeatureDelete:S,sketchEditingFeature:J,onSketchEditFeature:z,onMount:q}),ce.jsx(Moe,{ref:x,engineRef:k,geoidRef:I,interactionMode:l,terrainEnabled:!!V.property?.terrain?.enabled,overrideInteractionMode:d,onMount:oe}),ce.jsx(DD,{ref:I,geoidServer:V.property?.geoid?.server})]}):null}const d5=R.forwardRef(Goe),Voe=R.createContext(null),Wv={didCatch:!1,error:null};let Foe=class extends R.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Wv}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(...t){const{error:n}=this.state;n!==null&&(this.props.onReset?.({args:t,reason:"imperative-api"}),this.setState(Wv))}componentDidCatch(t,n){this.props.onError?.(t,n)}componentDidUpdate(t,n){const{didCatch:i}=this.state,{resetKeys:r}=this.props;i&&n.error!==null&&Aoe(t.resetKeys,r)&&(this.props.onReset?.({next:r,prev:t.resetKeys,reason:"keys"}),this.setState(Wv))}render(){const{children:t,fallbackRender:n,FallbackComponent:i,fallback:r}=this.props,{didCatch:o,error:s}=this.state;let a=t;if(o){const c={error:s,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")a=n(c);else if(i)a=R.createElement(i,c);else if(r!==void 0)a=r;else throw s}return R.createElement(Voe.Provider,{value:{didCatch:o,error:s,resetErrorBoundary:this.resetErrorBoundary}},a)}};function Aoe(e=[],t=[]){return e.length!==t.length||e.some((n,i)=>!Object.is(n,t[i]))}const f5=R.createContext(void 0),zoe=()=>{const e=R.useContext(f5);if(!e)throw new Error("Visualizer is not declared. You have to use this hook inside of Visualizer");return e},Noe=e=>e,koe=({mapRef:e,children:t})=>{const n=R.useMemo(()=>Noe(e),[e]);return ce.jsx(f5.Provider,{value:n,children:t})},p5=R.createContext({}),Xoe=({property:e,children:t})=>{const{clusterPixelRange:n=15,clusterMinSize:i=3,clusterLabelTypography:r={fontFamily:"sans-serif",fontSize:30,fontWeight:400,color:"#FFF",textAlign:"center",bold:!1,italic:!1,underline:!1},clusterImage:o,clusterImageWidth:s,clusterImageHeight:a}=e?.default??{},c=R.useMemo(()=>new M.EntityCluster({enabled:!0,pixelRange:15,minimumClusterSize:2,clusterBillboards:!0,clusterLabels:!0,clusterPoints:!0}),[]);return R.useEffect(()=>{const l=R.Children.count(t)<i,u=c?.clusterEvent.addEventListener((h,d)=>{d.label.font=hC(r,{fontSize:30}),d.label.horizontalOrigin=r.textAlign==="right"?M.HorizontalOrigin.LEFT:r.textAlign==="left"?M.HorizontalOrigin.RIGHT:M.HorizontalOrigin.CENTER,d.label.verticalOrigin=M.VerticalOrigin.CENTER,d.label.fillColor=M.Color.fromCssColorString(r.color??"#FFF"),d.label.eyeOffset=new M.Cartesian3(0,0,-5),d.billboard.show=!0,d.billboard.image=o,d.billboard.height=a,d.billboard.width=s,c.minimumClusterSize=l?R.Children.count(t):i});return c.enabled=!l,c.pixelRange=0,c.pixelRange=n,()=>{u()}},[i,n,r,o,a,s,t,c]),c?ce.jsx(Jne,{show:!0,clustering:c,children:t}):null};function Zoe({timelineManagerRef:e}){const{start:t,stop:n,current:i}=e?.current?.computedTimeline??{},{animation:r,stepType:o,rangeType:s,multiplier:a}=e?.current?.options??{},c=R.useMemo(()=>t?M.JulianDate.fromDate(t):void 0,[t]),l=R.useMemo(()=>n?M.JulianDate.fromDate(n):void 0,[n]),u=R.useMemo(()=>i?M.JulianDate.fromDate(i):void 0,[i]),h=o==="fixed"?M.ClockStep.TICK_DEPENDENT:M.ClockStep.SYSTEM_CLOCK_MULTIPLIER,d=a??1,f=R.useCallback(p=>{const m=M.JulianDate.toDate(p.startTime),y=M.JulianDate.toDate(p.stopTime);e?.current?.handleTick?.(M.JulianDate.toDate(p.currentTime),{start:m,stop:y})},[e]);return ce.jsx(Hne,{shouldAnimate:r,canAnimate:r,startTime:c,stopTime:l,currentTime:u,clockStep:h,multiplier:d,clockRange:s?Doe[s]:void 0,onTick:f})}const Doe={unbounded:M.ClockRange.UNBOUNDED,clamped:M.ClockRange.CLAMPED,bounced:M.ClockRange.LOOP_STOP},Uoe={translateEventTypes:M.CameraEventType.LEFT_DRAG,zoomEventTypes:[M.CameraEventType.RIGHT_DRAG,M.CameraEventType.WHEEL,M.CameraEventType.PINCH],rotateEventTypes:M.CameraEventType.LEFT_DRAG,tiltEventTypes:[M.CameraEventType.MIDDLE_DRAG,M.CameraEventType.PINCH,{eventType:M.CameraEventType.LEFT_DRAG,modifier:M.KeyboardEventModifier.CTRL},{eventType:M.CameraEventType.RIGHT_DRAG,modifier:M.KeyboardEventModifier.CTRL}],lookEventTypes:[{eventType:M.CameraEventType.LEFT_DRAG,modifier:M.KeyboardEventModifier.SHIFT}]},Woe="__reearth_layer_id",Boe=50,m5={engine:{},lightbox:[],screen:[]},Yoe=(e,t,n,i="none",r=!1,o="rgba(0, 0, 0, 0.7)",s=3,a=0,c=0)=>{const l=document.createElement("canvas"),u=l.getContext("2d");if(!(!e||!u))return u.save(),l.width=t+s*2,l.height=n+s*2,u.shadowBlur=s,u.shadowOffsetX=a,u.shadowOffsetY=c,u.globalCompositeOperation="source-over",u.clearRect(0,0,l.width,l.height),u.drawImage(e,(l.width-t)/2,(l.height-n)/2,t,n),i==="circle"?(u.fillStyle="black",u.globalCompositeOperation="destination-in",u.arc(l.width/2,l.height/2,Math.min(t,n)/2,0,2*Math.PI),u.fill(),r&&(u.shadowColor=o,u.globalCompositeOperation="destination-over",u.fillStyle="black",u.arc(l.width/2,l.height/2,Math.min(t,n)/2,0,2*Math.PI),u.fill())):r&&(u.shadowColor=o,u.globalCompositeOperation="destination-over",u.fillStyle="black",u.rect((l.width-t)/2,(l.height-n)/2,t,n),u.fill()),u.restore(),l.toDataURL()},Bv=({image:e,imageSize:t,crop:n,shadow:i,shadowColor:r,shadowBlur:o,shadowOffsetX:s,shadowOffsetY:a})=>{const c=sU(e),l=c?typeof t=="number"?Math.floor(c.width*t):Math.min(Boe,c.width):0,u=c?Math.floor(typeof t=="number"?c.height*t:l/c.width*c.height):0;return[R.useMemo(()=>Yoe(c,l,u,n,i,r,o,s,a),[n,u,c,i,o,r,s,a,l])??"",l,u]},g5=e=>({left:M.HorizontalOrigin.LEFT,center:M.HorizontalOrigin.CENTER,right:M.HorizontalOrigin.RIGHT,"":void 0})[e||""],y5=e=>({top:M.VerticalOrigin.TOP,center:M.VerticalOrigin.CENTER,baseline:M.VerticalOrigin.BASELINE,bottom:M.VerticalOrigin.BOTTOM,"":void 0})[e||""],Yv=(e,t,n,i=!1)=>{if(!e)return;const r=e.camera,o=e.globe.ellipsoid;let s;if(i){const u=r.getPickRay(new M.Cartesian2(t,n));u&&(s=e.globe.pick(u,e))}if(s||(s=r?.pickEllipsoid(new M.Cartesian2(t,n),o)),!s)return;const{latitude:a,longitude:c,height:l}=o.cartesianToCartographic(s);return{lat:M.Math.toDegrees(a),lng:M.Math.toDegrees(c),height:l}},Hoe=(e,t,n)=>{const i=M.IntersectionTests.rayEllipsoid(e,t);if(!i){const r=M.IntersectionTests.grazingAltitudeLocation(e,t);return n?r.clone(n):r}return M.Ray.getPoint(e,i.start,n)},b5=e=>{const t=new M.Ray;return e.positionWC.clone(t.origin),e.directionWC.clone(t.direction),t},_5=(e,t,n)=>{let i;const{camera:r,globe:o}=e;if(t instanceof M.Cartesian2){if(i=r.getPickRay(t,new M.Ray),!i)return}else i=b5(r),n=t;return Hoe(i,o.ellipsoid,n)},joe=e=>{const t=b5(e.camera);return e.globe.pick(t,e)},v5=(e,t)=>{const n=M.Cartographic.fromCartesian(e,t.globe.ellipsoid);return{lng:M.Math.toDegrees(n.longitude),lat:M.Math.toDegrees(n.latitude),height:n.height}},Hv=(e,t,n)=>{if(!e||!t)return()=>{};const i=w5({fov:t.fov,camera:e,duration:n?.duration,easing:n?.easing}),r=typeof t.lat=="number"&&typeof t.lng=="number"&&typeof t.height=="number"?M.Cartesian3.fromDegrees(t.lng,t.lat,t.height):void 0;return r&&e.flyTo({destination:r,orientation:{heading:t.heading,pitch:t.pitch,roll:t.roll},duration:n?.duration??0,easingFunction:n?.easing}),()=>{i?.(),e?.cancelFlight()}},Koe=(e,t,n)=>{if(!e||!t)return()=>{};const i=w5({fov:t.fov,camera:e,duration:n?.duration,easing:n?.easing}),r=typeof t.lat=="number"&&typeof t.lng=="number"&&typeof t.height=="number"?M.Cartesian3.fromDegrees(t.lng,t.lat,t.height):void 0;return r&&e.flyToBoundingSphere(new M.BoundingSphere(r,t.radius),{offset:t.heading!==void 0||t.pitch!==void 0||t.range!==void 0?new M.HeadingPitchRange(t.heading,t.pitch,t.range):void 0,duration:n?.duration,easingFunction:n?.easing}),()=>{i?.(),e?.cancelFlight()}},Joe=(e,t)=>{if(!t)return;const n=typeof t.lat=="number"&&typeof t.lng=="number"?M.Cartesian3.fromDegrees(t.lng,t.lat,t.height):void 0;n&&e.camera.lookAtTransform(M.Matrix4.fromTranslation(n))},w5=({fov:e,camera:t,easing:n,duration:i})=>{if(typeof e=="number"&&t.frustum instanceof M.PerspectiveFrustum&&typeof t.frustum.fov=="number"&&t.frustum.fov!==e){const r=t.frustum.fov;return oU(o=>{t.frustum instanceof M.PerspectiveFrustum&&(t.frustum.fov=(e-r)*o+r)},n||"inOutCubic",(i??0)*1e3)}},x5=({camera:e,scene:t})=>{const n=new M.Cartesian3,i=e.getPickRay(e.positionWC);if(i)return i.origin=e.positionWC,i.direction=e.directionWC,t.globe.pick(i,t,n)},S5=({viewer:e,relativeAmount:t},n)=>{const{camera:i,scene:r}=e;if(r.mode!==M.SceneMode.SCENE3D){const d=po(e);Hv(i,{...d,height:(d?.height||1)*t},{duration:.5});return}const s=x5({camera:i,scene:r})||M.IntersectionTests.grazingAltitudeLocation(new M.Ray(r.globe.ellipsoid.cartographicToCartesian(i.positionCartographic),i.directionWC),r.globe.ellipsoid);if(!s)return;const a={heading:i.heading,pitch:i.pitch,roll:i.roll},c=new M.Cartesian3,l=M.Cartesian3.subtract(i.position,s,c),u=M.Cartesian3.multiplyByScalar(l,t,l),h=M.Cartesian3.add(s,u,s);i.flyTo({destination:h,orientation:a,duration:n?.duration||.5,convert:!1})},po=e=>{if(!e||e.isDestroyed()||!e.camera||!e.scene)return;const{camera:t}=e;if(!(t.frustum instanceof M.PerspectiveFrustum||t.frustum instanceof M.OrthographicOffCenterFrustum))return;const{latitude:n,longitude:i,height:r}=t.positionCartographic,o=M.Math.toDegrees(n),s=M.Math.toDegrees(i),{heading:a,pitch:c,roll:l}=t,u=t.frustum instanceof M.PerspectiveFrustum?t.frustum.fov??1:1,h=t.frustum instanceof M.PerspectiveFrustum?t.frustum.aspectRatio??1:1;return{lng:s,lat:o,height:r,heading:a,pitch:c,roll:l,fov:u,aspectRatio:h}},Qoe=e=>{if(e)return{get start(){return M.JulianDate.toDate(e.startTime)},get stop(){return M.JulianDate.toDate(e.stopTime)},get current(){return M.JulianDate.toDate(e.currentTime)},get playing(){return e.shouldAnimate},get speed(){return e.multiplier}}},qoe=e=>({highlight:M.ColorBlendMode.HIGHLIGHT,replace:M.ColorBlendMode.REPLACE,mix:M.ColorBlendMode.MIX})[e||""],$oe=(e="highlight")=>({highlight:M.Cesium3DTileColorBlendMode.HIGHLIGHT,replace:M.Cesium3DTileColorBlendMode.REPLACE,mix:M.Cesium3DTileColorBlendMode.MIX})[e],da=e=>({clamp:M.HeightReference.CLAMP_TO_GROUND,relative:M.HeightReference.RELATIVE_TO_GROUND,none:M.HeightReference.NONE})[e||""],ese=e=>{if(!e)return;const t=new Map([["left_drag",M.CameraEventType.LEFT_DRAG],["right_drag",M.CameraEventType.RIGHT_DRAG],["middle_drag",M.CameraEventType.MIDDLE_DRAG],["wheel",M.CameraEventType.WHEEL],["pinch",M.CameraEventType.PINCH]]),n=new Map([["ctrl",M.KeyboardEventModifier.CTRL],["shift",M.KeyboardEventModifier.SHIFT],["alt",M.KeyboardEventModifier.ALT]]),i=l=>{if(l)return l.map(u=>typeof u=="string"?t.get(u):{eventType:t.get(u.eventType),modifier:n.get(u.modifier)})},r=i(e.translateEventTypes),o=i(e.zoomEventTypes),s=i(e.rotateEventTypes),a=i(e.tiltEventTypes),c=i(e.lookEventTypes);return{...Uoe,...r&&{translateEventTypes:r},...o&&{zoomEventTypes:o},...s&&{rotateEventTypes:s},...a&&{tiltEventTypes:a},...c&&{lookEventTypes:c},...e.minimumZoomDistance!==void 0&&{minimumZoomDistance:e.minimumZoomDistance},...e.maximumZoomDistance!==void 0&&{maximumZoomDistance:e.maximumZoomDistance},...e.enableCollisionDetection!==void 0&&{enableCollisionDetection:e.enableCollisionDetection}}},hf=e=>({both:M.ClassificationType.BOTH,"3dtiles":M.ClassificationType.CESIUM_3D_TILE,terrain:M.ClassificationType.TERRAIN})[e||""],dc=e=>({enabled:M.ShadowMode.ENABLED,cast_only:M.ShadowMode.CAST_ONLY,receive_only:M.ShadowMode.RECEIVE_ONLY,disabled:M.ShadowMode.DISABLED})[e||""],tse="reearth_unselectable",nse="reearth_draggable";function E5(e){return!e?.properties?.hasProperty(tse)}function ise(e){return e.properties?.[nse]}function rse(e,t){const n=e.camera,r=e.globe.ellipsoid.geodeticSurfaceNormal(n.position,new M.Cartesian3);n.look(r,t)}function ose(e,t){const n=e.camera,i=e.globe.ellipsoid,r=df(n.right,n.position,i),o=i.geodeticSurfaceNormal(n.position,new M.Cartesian3),s=M.Math.toDegrees(M.Cartesian3.angleBetween(o,n.up)),a=pse(n.up,r,t),l=M.Math.toDegrees(M.Cartesian3.angleBetween(o,a))<s?1:(90-s)/90;n.look(r,t*l)}function sse(e,t){const n=df(e.camera.direction,e.camera.position,e.globe.ellipsoid);e.camera.move(n,t)}function ase(e,t){const n=df(e.camera.direction,e.camera.position,e.globe.ellipsoid);e.camera.move(n,-t)}function cse(e,t){const n=e.globe.ellipsoid.geodeticSurfaceNormal(e.camera.position,new M.Cartesian3);e.camera.move(n,t)}function lse(e,t){const n=e.globe.ellipsoid.geodeticSurfaceNormal(e.camera.position,new M.Cartesian3);e.camera.move(n,-t)}function use(e,t){const n=df(e.camera.right,e.camera.position,e.globe.ellipsoid);e.camera.move(n,-t)}function hse(e,t){const n=df(e.camera.right,e.camera.position,e.globe.ellipsoid);e.camera.move(n,t)}async function dse(e,t=0){const n=po(e);if(n?.lng===void 0||n?.lat===void 0)return;const i=await Bu(e.scene,n.lng,n.lat);if(i&&i!==0){const r=po(e);r&&r?.height<i+t&&e.scene.camera.moveUp(i+t-r.height)}}async function fse(e,t,n,i,r=0){if(n.lng===void 0||n.lat===void 0)return;const o=await Bu(e.scene,n.lng,n.lat),s=o?o+r:r;t.current?.(),t.current=Hv(e.scene?.camera,{...po(e),...n,height:s},i)}function df(e,t,n){const i=n.geodeticSurfaceNormal(t,new M.Cartesian3),r=M.Cartesian3.dot(e,i),o=M.Cartesian3.multiplyByScalar(i,r,new M.Cartesian3);return M.Cartesian3.subtract(e,o,new M.Cartesian3)}function pse(e,t,n){const i=M.Quaternion.fromAxisAngle(t,-n,new M.Quaternion),r=M.Matrix3.fromQuaternion(i,new M.Matrix3);return M.Matrix3.multiplyByVector(r,e,e.clone())}async function Bu(e,t,n){const i=e.terrainProvider;if(i instanceof M.EllipsoidTerrainProvider)return 0;const[r]=await M.sampleTerrainMostDetailed(i,[M.Cartographic.fromDegrees(t,n)]);return r.height}async function T5(e,t){const n=M.Cartographic.fromCartesian(t),[i,r]=[M.Math.toDegrees(n?.longitude||0),M.Math.toDegrees(n?.latitude||0)];if(!(!i||!r))return await Bu(e,i,r)}const mse=e=>e?.match(/^#[A-Fa-f0-9]|^rgba?/),fc=e=>{if(!e||typeof e!="string")return;const t=e.match(/^#([A-Fa-f0-9]{6})([A-Fa-f0-9]{2})$|^#([A-Fa-f0-9]{3})([A-Fa-f0-9])$/);if(!t)return M.Color.fromCssColorString(e);const n=parseInt(t[4]?t[4].repeat(2):t[2],16)/255;return M.Color.fromCssColorString(`#${t[1]??t[3]}`).withAlpha(n)},Yu=(e,t)=>{e.scene.screenSpaceCameraController.enableTranslate=t,e.scene.screenSpaceCameraController.enableRotate=t,e.scene.screenSpaceCameraController.enableLook=t,e.scene.screenSpaceCameraController.enableTilt=t,e.scene.screenSpaceCameraController.enableZoom=t};function gse(e,t,n,i=!1){const r=new M.Cartesian3,o=new M.Cartesian3,s=new M.Ray,a=new M.Plane(M.Cartesian3.UNIT_X,0),c=new M.Cartographic;let l;try{const u=e.globe.ellipsoid.geodeticSurfaceNormal(t,o),h=e.camera.getPickRay(n,s);if(h==null)return;const d=M.Plane.fromPointNormal(t,M.Cartesian3.normalize(M.Cartesian3.cross(u,M.Cartesian3.cross(u,h.direction,r),r),r),a);if(l=M.IntersectionTests.rayPlane(h,d,r),l==null)return;const f=M.Cartographic.fromCartesian(l,e.globe.ellipsoid,c).height,p=M.Cartographic.fromCartesian(t,e.globe.ellipsoid,c).height;return i?f-p:Math.max(0,f-p)}catch(u){console.error(u)}}function C5(e){if(!e)return m5;const t=e.creditDisplay;if(!t)return m5;const{lightboxCredits:n,screenCredits:i}=t?._currentFrameCredits||{},r=t._currentCesiumCredit;return{engine:{cesium:r?.html?{html:r.html}:void 0},lightbox:Array.from(n?._array??[]).map(s=>({html:s?.credit?.html})),screen:Array.from(i?._array??[]).map(s=>({html:s?.credit?.html}))}}const yse="https://terrain.reearth.land/cesium-mesh/ellipsoid";function bse(e){const t=R.useRef(new Map),n=R.useRef(void 0);return R.useMemo(()=>{if(!e.terrain)return n.current||(n.current=new M.EllipsoidTerrainProvider),Promise.resolve(n.current);const i=e.terrainType??"cesium",r=_se(i,e);let o=t.current.get(r);return o||(o=vse(i,e),t.current.set(r,o)),o},[e])}function _se(e,t){const n=t.ionAsset??"",i=t.ionUrl??"",r=t.ionAccessToken??"",o=String(!!t.normal);return`${e}|asset:${n}|url:${i}|ion:${r}|normal:${o}`}function vse(e,t){switch(e){case"reearth_terrain":return M.CesiumTerrainProvider.fromUrl(yse,{requestVertexNormals:!!t.normal,requestWaterMask:!1});case"cesium":return M.CesiumTerrainProvider.fromUrl(M.IonResource.fromAssetId(1,{accessToken:t.ionAccessToken}),{requestVertexNormals:!!t.normal,requestWaterMask:!1});case"cesiumion":return!t.ionAsset&&!t.ionUrl?Promise.resolve(new M.EllipsoidTerrainProvider):M.CesiumTerrainProvider.fromUrl(t.ionUrl??M.IonResource.fromAssetId(parseInt(String(t.ionAsset),10),{accessToken:t.ionAccessToken}),{requestVertexNormals:!!t.normal});default:return Promise.resolve(new M.EllipsoidTerrainProvider)}}function wse({property:e,cesiumIonAccessToken:t,onTerrainProviderChange:n}){const i=bse({terrain:e?.terrain?.enabled,terrainType:e?.terrain?.type,normal:e?.terrain?.normal,ionAccessToken:e?.assets?.cesium?.terrain?.ionAccessToken||t,ionAsset:e?.assets?.cesium?.terrain?.ionAsset,ionUrl:e?.assets?.cesium?.terrain?.ionUrl}),r=R.useMemo(()=>fc(e?.globe?.baseColor),[e?.globe?.baseColor]),o=R.useRef(null);return R.useEffect(()=>{let s=!1;return i.then(a=>{s||o.current!==a&&(o.current=a,n?.())}).catch(a=>{s||console.warn("Terrain provider failed to load:",a)}),()=>{s=!0}},[i,n]),ce.jsx(xie,{baseColor:r,enableLighting:!!e?.globe?.enableLighting,showGroundAtmosphere:e?.globe?.atmosphere?.enabled??!0,atmosphereLightIntensity:e?.globe?.atmosphere?.lightIntensity,atmosphereSaturationShift:e?.globe?.atmosphere?.saturationShift,atmosphereHueShift:e?.globe?.atmosphere?.hueShift,atmosphereBrightnessShift:e?.globe?.atmosphere?.brightnessShift,terrainProvider:i,depthTestAgainstTerrain:!!e?.globe?.depthTestAgainstTerrain})}const He={};He.EMPTY_OBJECT=Object.freeze({}),He.EMPTY_ARRAY=Object.freeze([]);function _(e){return e!=null}function F(e){this.name="DeveloperError",this.message=e;let t;try{throw new Error}catch(n){t=n.stack}this.stack=t}_(Object.create)&&(F.prototype=Object.create(Error.prototype),F.prototype.constructor=F),F.prototype.toString=function(){let e=`${this.name}: ${this.message}`;return _(this.stack)&&(e+=`
24
+ <%s key={someKey} {...props} />`,q,be,Ae,be),J[be+q]=!0)}if(be=null,Q!==void 0&&(n(Q),be=""+Q),s(W)&&(n(W.key),be=""+W.key),"key"in W){Q={};for(var Pe in W)Pe!=="key"&&(Q[Pe]=W[Pe])}else Q=W;return be&&a(Q,typeof z=="function"?z.displayName||z.name||"Unknown":z),l(z,be,Q,r(),oe,Ee)}function h(z){d(z)?z._store&&(z._store.validated=1):typeof z=="object"&&z!==null&&z.$$typeof===G&&(z._payload.status==="fulfilled"?d(z._payload.value)&&z._payload.value._store&&(z._payload.value._store.validated=1):z._store&&(z._store.validated=1))}function d(z){return typeof z=="object"&&z!==null&&z.$$typeof===p}var f=R,p=Symbol.for("react.transitional.element"),m=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),g=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),S=Symbol.for("react.consumer"),E=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),V=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),G=Symbol.for("react.lazy"),N=Symbol.for("react.activity"),k=Symbol.for("react.client.reference"),P=f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,w=Object.prototype.hasOwnProperty,x=Array.isArray,I=console.createTask?console.createTask:function(){return null};f={react_stack_bottom_frame:function(z){return z()}};var X,D={},Y=f.react_stack_bottom_frame.bind(f,o)(),H=I(i(o)),J={};Xm.Fragment=y,Xm.jsx=function(z,W,Q){var q=1e4>P.recentlyCreatedOwnerStacks++;return u(z,W,Q,!1,q?Error("react-stack-top-frame"):Y,q?I(i(z)):H)},Xm.jsxs=function(z,W,Q){var q=1e4>P.recentlyCreatedOwnerStacks++;return u(z,W,Q,!0,q?Error("react-stack-top-frame"):Y,q?I(i(z)):H)}})()),Xm}var MM;function Cne(){return MM||(MM=1,process.env.NODE_ENV==="production"?Sv.exports=Ene():Sv.exports=Tne()),Sv.exports}var Zm=Cne();function Rne(e,t){return t?Ev(e).reduce((n,[i,r])=>(tf(t,i)&&(n[i]=r),n),{}):{}}function Ev(e){return Object.keys(e).map(t=>[t,e[t]])}function tf(e,t){return!!e&&e.indexOf(t)!==-1}function Ine(e,t){return!!e&&!!t&&[...Object.keys(e),...Object.keys(t)].every(n=>e[n]===t[n])}function Mne(e){return e&&typeof e.isDestroyed=="function"&&typeof e.destroy=="function"}function Lne(e){return Mne(e)&&e.isDestroyed()}function lc(e){return e&&typeof e=="object"&&"then"in e&&typeof e.then=="function"}const Xu="__RESIUM_EVENT_MANAGER",Tv=["onClick","onDoubleClick","onMouseDown","onMouseUp","onMiddleClick","onMiddleDown","onMiddleUp","onMouseMove","onPinchEnd","onPinchMove","onPinchStart","onRightClick","onRightDown","onRightUp","onWheel","onMouseEnter","onMouseLeave"];let LM=class FD{static eventTypeMap={onClick:M.ScreenSpaceEventType.LEFT_CLICK,onDoubleClick:M.ScreenSpaceEventType.LEFT_DOUBLE_CLICK,onMouseDown:M.ScreenSpaceEventType.LEFT_DOWN,onMouseUp:M.ScreenSpaceEventType.LEFT_UP,onMiddleClick:M.ScreenSpaceEventType.MIDDLE_CLICK,onMiddleDown:M.ScreenSpaceEventType.MIDDLE_DOWN,onMiddleUp:M.ScreenSpaceEventType.MIDDLE_UP,onMouseMove:M.ScreenSpaceEventType.MOUSE_MOVE,onPinchEnd:M.ScreenSpaceEventType.PINCH_END,onPinchMove:M.ScreenSpaceEventType.PINCH_MOVE,onPinchStart:M.ScreenSpaceEventType.PINCH_START,onRightClick:M.ScreenSpaceEventType.RIGHT_CLICK,onRightDown:M.ScreenSpaceEventType.RIGHT_DOWN,onRightUp:M.ScreenSpaceEventType.RIGHT_UP,onWheel:M.ScreenSpaceEventType.WHEEL,onMouseEnter:M.ScreenSpaceEventType.MOUSE_MOVE,onMouseLeave:M.ScreenSpaceEventType.MOUSE_MOVE};scene;sshe;events={onClick:new Map,onDoubleClick:new Map,onMouseDown:new Map,onMouseUp:new Map,onMiddleClick:new Map,onMiddleDown:new Map,onMiddleUp:new Map,onMouseMove:new Map,onPinchEnd:new Map,onPinchMove:new Map,onPinchStart:new Map,onRightClick:new Map,onRightDown:new Map,onRightUp:new Map,onWheel:new Map,onMouseEnter:new Map,onMouseLeave:new Map};hovered=void 0;constructor(t){this.scene=t,this.sshe=new M.ScreenSpaceEventHandler(t?.canvas)}destroy(){this.hovered=void 0,this.sshe.isDestroyed()||this.sshe.destroy()}isDestroyed(){return this.sshe.isDestroyed()}on(t,n,i){t&&n==="onWheel"||this.events[n].set(t,i)}off(t,n){this.events[n].delete(t),this.hovered===t&&(this.hovered=void 0)}setEvents(t,n){Ev(n).forEach(([i,r])=>{const o=i;tf(Tv,o)&&(r?this.on(t,o,r):this.off(t,o))}),this.commit()}clearEvents(t){this.hovered=void 0,Tv.forEach(n=>{this.off(t,n)}),this.commit()}commit(){const t=this.sshe,n=this.sshe.isDestroyed();n||(this.events.onMouseEnter.size===0&&this.events.onMouseLeave.size===0&&this.events.onMouseMove.size===0?this.sshe.removeInputAction(M.ScreenSpaceEventType.MOUSE_MOVE):this.sshe.getInputAction(M.ScreenSpaceEventType.MOUSE_MOVE)||this.sshe.setInputAction(this.onMouseMove,M.ScreenSpaceEventType.MOUSE_MOVE)),Ev(this.events).forEach(([i,r])=>{if(i==="onMouseEnter"||i==="onMouseLeave"||i==="onMouseMove")return;const o=FD.eventTypeMap[i];n||(r.size===0?t.removeInputAction(o):t.getInputAction(o)||t.setInputAction(this.eventCallback(i),o))})}getScreenSpaceEventHandler(){return this.sshe}getEventCallback(t,n){return n===null?this.events[t].get(null):this.events[t].get(n.id)||this.events[t].get(n.id?.entityCollection?.owner)||this.events[t].get(n.primitive)||this.events[t].get(n.tileset)}onMouseMove=t=>{const n=this.pick(t.endPosition);this.hovered!==n&&(this.hovered&&(this.getEventCallback("onMouseLeave",this.hovered)?.(t,this.hovered),this.getEventCallback("onMouseLeave",null)?.(t,this.hovered)),n&&(this.getEventCallback("onMouseEnter",n)?.(t,n),this.getEventCallback("onMouseEnter",null)?.(t,n))),n&&this.getEventCallback("onMouseMove",n)?.(t,n),this.getEventCallback("onMouseMove",null)?.(t,n),this.hovered=n};eventCallback=t=>n=>{const i=this.pick(n?.position);i&&this.getEventCallback(t,i)?.(n,i),this.getEventCallback(t,null)?.(n,i)};pick(t){if(t)return this.scene?.pick(t)}};const Pne=({name:e,create:t,destroy:n,provide:i,update:r,cesiumReadonlyProps:o,cesiumEventProps:s,otherProps:a,setCesiumPropsAfterCreate:c,useCommonEvent:l,useRootEvent:u},h,d)=>{const f=R.useRef(void 0),p=Qn(),m=R.useRef(i?{}:void 0),y=R.useRef({}),g=R.useRef(PM(h)),v=R.useRef({}),[S,E]=R.useState(!1),C=R.useRef(!1),O=R.useRef(null),V=R.useRef(void 0),A=p?.[Xu],G=R.useRef(void 0),N=R.useRef(void 0),k=R.useCallback(async I=>{if(!f.current)return;const X=f.current,D=Object.keys(I),Y=Object.keys(s||[]),H=D.concat(Object.keys(v.current).filter(W=>!D.includes(W))).filter(W=>v.current[W]!==I[W]).map(W=>[W,v.current[W],I[W]]),J=[];for(const[W,Q,q]of H)if(o?.includes(W))J.push(W);else if(tf(Y,W)){const oe=s?.[W],Ee=X[oe];Ee instanceof M.Event&&(typeof Q>"u"?(Ee.addEventListener(q),y.current[oe]=q):typeof q>"u"?(Ee.removeEventListener(Q),delete y.current[oe]):(Ee.removeEventListener(Q),Ee.addEventListener(q)))}else W!=="children"&&!Tv.includes(W)&&!a?.includes(W)&&(X[W]=q);const z=u?m.current?.[Xu]:A;if(l&&z&&f.current&&z.setEvents(u?null:f.current,I),r&&C.current){const W=r(f.current,I,v.current,p);lc(W)&&await W}v.current=I,g.current=I,C.current&&J.length>0&&(process.env.NODE_ENV!=="production"&&console.warn(`Warning: <${e}> is recreated because following read-only props have been updated: ${J.join(", ")}`),w(),await x(),G.current=P())},[]),P=R.useCallback(async()=>{await new Promise(Y=>queueMicrotask(()=>Y(void 0)));const I=t?.(p,g.current,O.current);let X;if(lc(I)?X=await I:X=I,Array.isArray(X)?(f.current=X[0],V.current=X[1]):f.current=X,c)await k(g.current);else{if(f.current&&s){const Y=f.current;for(const H of Object.keys(g.current)){const J=s[H];if(J){const z=g.current[H],W=Y[J];z&&W instanceof M.Event&&W.addEventListener(z)}}}v.current=g.current}i&&f.current&&(m.current={...p,...i(f.current,p,h,V.current)});const D=u?m.current?.[Xu]:A;l&&D&&f.current&&D.setEvents(u?null:f.current,g.current),N.current||E(!0)},[]),w=R.useCallback(()=>{E(!1),C.current=!1},[]),x=R.useCallback(async()=>{await new Promise(X=>queueMicrotask(()=>X(void 0))),G.current&&(await G.current,G.current=void 0),f.current&&n&&n(f.current,p,O.current,V.current);const I=u?m.current?.[Xu]:A;if(l&&I&&f.current&&I.clearEvents(u?null:f.current),f.current&&!Lne(f.current)){const X=Object.keys(y.current);for(const D of X)f.current[D]?.removeEventListener?.(y.current[D])}y.current={},m.current=void 0,V.current=void 0,f.current=void 0},[]);return R.useLayoutEffect(()=>((async()=>(N.current&&(await N.current,N.current=void 0),G.current=P()))(),()=>{w(),N.current=x()}),[P,x,w]),R.useEffect(()=>{(async()=>{G.current&&await G.current;const I=PM(h);S?Ine(I,v.current)||(await k(I),p.__$internal?.onUpdate?.()):(v.current=I,g.current=I,C.current=!0)})()},[p.__$internal,S,h,k]),R.useImperativeHandle(d,()=>({cesiumElement:S?f.current:null}),[S]),[m.current,S,O]};function PM(e){const{children:t,...n}=e;return n}const lt=({renderContainer:e,noChildren:t,containerProps:n,defaultProps:i,...r})=>{const o=(s,a)=>{const c={...i,...s},[l,u,h]=Pne(r,c,a);if(t)return null;const d=u&&"children"in c?c.children:null,f=e?Zm.jsx("div",{"data-testid":"resium-container",ref:h,...typeof n=="function"?n(c):Rne(c,n),children:d}):d?Zm.jsx(Zm.Fragment,{children:d}):null;return l?Zm.jsx(xv.Provider,{value:l,children:f}):f};return o.displayName=r.name,R.forwardRef(o)},One=["enabled","selected"],Ko=e=>lt({name:e.name,create(t,n){if(!t.scene)return;const i=e.create(n,t.scene.postProcessStages);return typeof n.enabled=="boolean"&&(i.enabled=n.enabled),n.selected&&"selected"in i&&(i.selected=n.selected),e.props.forEach(r=>{!tf(e.readonlyProps,r)&&typeof n[r]<"u"&&(i.uniforms[r]=n[r])}),!e.noMount&&t.scene&&!t.scene.isDestroyed()&&t.scene.postProcessStages.add(i),i},destroy(t,n){e.noMount?t.enabled=!1:(n.scene&&!n.scene.isDestroyed()&&n.scene.postProcessStages.remove(t),t.isDestroyed()||t.destroy())},update(t,n,i){e.props.forEach(r=>{!tf(e.readonlyProps,r)&&n[r]!==i[r]&&(t.uniforms[r]=n[r])})},cesiumProps:One,cesiumReadonlyProps:e.readonlyProps,defaultProps:{enabled:!0}});lt({name:"Billboard",create(e,t){return e.billboardCollection?.add(t)},destroy(e,t){t.billboardCollection&&!t.billboardCollection.isDestroyed()&&t.billboardCollection.remove(e)},cesiumProps:["alignedAxis","color","disableDepthTestDistance","distanceDisplayCondition","eyeOffset","height","heightReference","horizontalOrigin","image","pixelOffset","pixelOffsetScaleByDistance","position","rotation","scale","scaleByDistance","show","sizeInMeters","splitDirection","translucencyByDistance","verticalOrigin","width","id"],useCommonEvent:!0}),lt({name:"BillboardCollection",create(e,t){if(!e.primitiveCollection)return;const n=new M.BillboardCollection({modelMatrix:t.modelMatrix,debugShowBoundingVolume:t.debugShowBoundingVolume,scene:e.scene,blendOption:t.blendOption});return e.primitiveCollection.add(n),n},destroy(e,t){t.primitiveCollection&&!t.primitiveCollection.isDestroyed()&&t.primitiveCollection.remove(e),e.isDestroyed()||e.destroy()},provide(e){return{billboardCollection:e}},cesiumProps:["blendOption","debugShowBoundingVolume","debugShowTextureAtlas","modelMatrix","show"]});const Gne=["image","show","scale","horizontalOrigin","verticalOrigin","eyeOffset","pixelOffset","rotation","alignedAxis","width","height","color","scaleByDistance","translucencyByDistance","pixelOffsetScaleByDistance","imageSubRegion","sizeInMeters","heightReference","distanceDisplayCondition","disableDepthTestDistance","splitDirection"],Vne={onDefinitionChange:"definitionChanged"},OM=lt({name:"BillboardGraphics",create(e,t){if(!e.entity)return;const n=new M.BillboardGraphics(t);return e.entity.billboard=n,n},destroy(e,t){t.entity&&(t.entity.billboard=void 0)},cesiumProps:Gne,cesiumEventProps:Vne}),Fne=["heightReference","dimensions","show","fill","material","outline","outlineColor","outlineWidth","shadows","distanceDisplayCondition"],Ane={onDefinitionChange:"definitionChanged"},GM=lt({name:"BoxGraphics",create(e,t){if(!e.entity)return;const n=new M.BoxGraphics(t);return e.entity.box=n,n},destroy(e,t){t.entity&&(t.entity.box=void 0)},cesiumProps:Fne,cesiumEventProps:Ane}),zne=["position","direction","up","right","frustum","defaultMoveAmount","defaultLookAmount","defaultRotateAmount","defaultZoomAmount","constrainedAxis","maximumZoomFactor","percentageChanged"],Nne={onChange:"changed",onMoveEnd:"moveEnd",onMoveStart:"moveStart"},kne=lt({name:"Camera",create:e=>e.scene?.camera,cesiumProps:zne,cesiumEventProps:Nne,setCesiumPropsAfterCreate:!0}),Xne=["show","modelMatrix","shadows","maximumScreenSpaceError","cullRequestsWhileMoving","cullRequestsWhileMovingMultiplier","preloadWhenHidden","preloadFlightDestinations","preferLeaves","progressiveResolutionHeightFraction","foveatedScreenSpaceError","foveatedConeSize","foveatedMinimumScreenSpaceErrorRelaxation","foveatedInterpolationCallback","foveatedTimeDelay","dynamicScreenSpaceError","dynamicScreenSpaceErrorDensity","dynamicScreenSpaceErrorFactor","dynamicScreenSpaceErrorHeightFalloff","skipLevelOfDetail","baseScreenSpaceError","skipScreenSpaceErrorFactor","skipLevels","immediatelyLoadDesiredLevelOfDetail","loadSiblings","clippingPlanes","clippingPolygons","lightColor","colorBlendAmount","colorBlendMode","debugFreezeFrame","debugColorizeTiles","debugWireframe","debugShowBoundingVolume","debugShowContentBoundingVolume","debugShowViewerRequestVolume","debugShowGeometricError","debugShowRenderingStatistics","debugShowMemoryUsage","debugShowUrl","style","backFaceCulling","showOutline","vectorClassificationOnly","vectorKeepDecodedPositions","splitDirection","customShader","imageBasedLighting","showCreditsOnScreen","featureIdLabel","instanceFeatureIdLabel","outlineColor","cacheBytes","maximumCacheOverflowBytes","enableCollision"],Zne=["asynchronouslyLoadImagery","classificationType","cullWithChildrenBounds","debugHeatmapTilePropertyName","ellipsoid","enableDebugWireframe","heightReference","modelUpAxis","modelForwardAxis","projectTo2D","enableShowOutline","enablePick","environmentMapOptions","scene"],Dne={onAllTilesLoad:"allTilesLoaded",onInitialTilesLoad:"initialTilesLoaded",onLoadProgress:"loadProgress",onTileFailed:"tileFailed",onTileLoad:"tileLoad",onTileUnload:"tileUnload",onTileVisible:"tileVisible"},Une=["onReady","onError","url"],Wne=lt({name:"Cesium3DTileset",async create(e,t){if(!e.primitiveCollection)return;const n=t.url;let i;lc(n)?i=await n:i=n;let r;try{r=await M.Cesium3DTileset.fromUrl(i,t),t.onReady?.(r)}catch(o){t.onError?.(o);return}return t.colorBlendAmount&&(r.colorBlendAmount=t.colorBlendAmount),t.colorBlendMode&&(r.colorBlendMode=t.colorBlendMode),t.style&&(r.style=t.style),e.primitiveCollection.add(r),r},destroy(e,t){t.primitiveCollection&&!t.primitiveCollection.isDestroyed()&&t.primitiveCollection.remove(e),e.isDestroyed()||e.destroy()},cesiumProps:Xne,cesiumReadonlyProps:Zne,cesiumEventProps:Dne,otherProps:Une,useCommonEvent:!0});lt({name:"Cesium3DTilesetGraphics",create(e,t){if(!e.entity)return;const n=new M.Cesium3DTilesetGraphics(t);return e.entity.tileset=n,n},destroy(e,t){t.entity&&(t.entity.tileset=void 0)},cesiumProps:["show","uri","maximumScreenSpaceError"],cesiumEventProps:{onDefinitionChange:"definitionChanged"}}),lt({name:"Cesium3DTilesTerrainProvider",async create(e,t){const{onReady:n,assetId:i,accessToken:r,url:o,children:s,...a}=t;let c;if(i!==void 0)c=await M.Cesium3DTilesTerrainProvider.fromIonAssetId(i,a);else if(o!==void 0)c=await M.Cesium3DTilesTerrainProvider.fromUrl(o,a);else throw new Error("Cesium3DTilesTerrainProvider requires either 'url' or 'assetId' prop to be provided");return n&&n(c),c}}),lt({name:"CesiumWidget",create(e,t,n){if(!n)return;const i=new M.CesiumWidget(n,t);if(!i)return;typeof t.resolutionScale=="number"&&(i.resolutionScale=t.resolutionScale);const r=new LM(i.scene);return[i,r]},destroy(e,t,n,i){i&&!i.isDestroyed()&&i.destroy(),e.isDestroyed()||e.destroy()},provide(e,t,n,i){return{cesiumWidget:e,scene:e.scene,camera:e.scene.camera,imageryLayerCollection:e.scene.globe.imageryLayers,primitiveCollection:e.scene.primitives,globe:e.scene.globe,__$internal:{onUpdate:n?.onUpdate},[Xu]:i}},containerProps:({id:e,className:t,style:n,full:i,containerProps:r})=>({className:t,id:e,style:{...i?{position:"absolute",bottom:"0",left:"0",right:"0",top:"0"}:{},...n},...r}),cesiumProps:["resolutionScale","useDefaultRenderLoop","targetFrameRate","useBrowserRecommendedResolution","allowDataSourcesToSuspendAnimation","trackedEntity","clockTrackedDataSource","terrainProvider","creditDisplay"],cesiumReadonlyProps:["clock","shouldAnimate","ellipsoid","baseLayer","skyBox","skyAtmosphere","sceneMode","scene3DOnly","orderIndependentTranslucency","mapMode2D","mapProjection","globe","showRenderLoopErrors","automaticallyTrackDataSourceClocks","contextOptions","creditContainer","creditViewport","dataSources","shadows","terrainShadows","terrain","requestRenderMode","maximumRenderTimeChange","msaaSamples","blurActiveElementOnCanvasFocus"],otherProps:["className","id","style","full","containerProps"],renderContainer:!0,useCommonEvent:!0,useRootEvent:!0}),lt({name:"ClassificationPrimitive",async create(e,t){if(!e.primitiveCollection)return;const n=new M.ClassificationPrimitive(t);if(t.onReady){const i=()=>{n.ready&&(t.onReady?.(n),e.scene?.postRender.removeEventListener(i))};e.scene?.postRender.addEventListener(i)}return e.primitiveCollection.add(n),n},destroy(e,t){t.primitiveCollection&&!t.primitiveCollection.isDestroyed()&&t.primitiveCollection.remove(e),e.isDestroyed()||e.destroy()},cesiumProps:["classificationType","debugShowBoundingVolume","debugShowShadowVolume","show"],cesiumReadonlyProps:["allowPicking","asynchronous","compressVertices","geometryInstances","interleave","releaseGeometryInstances","vertexCacheOptimize","appearance"],otherProps:["onReady"],useCommonEvent:!0});const Bne={onStop:"onStop",onTick:"onTick"},Yne=["canAnimate","clockRange","clockStep","currentTime","multiplier","shouldAnimate","startTime","stopTime"],Hne=lt({name:"Clock",create:e=>e.cesiumWidget?.clock,cesiumProps:Yne,cesiumEventProps:Bne,setCesiumPropsAfterCreate:!0});lt({name:"CloudCollection",create:e=>{if(!e.primitiveCollection)return;const t=new M.CloudCollection;return e.primitiveCollection.add(t),t},destroy(e,t){t.primitiveCollection&&!t.primitiveCollection.isDestroyed()&&t.primitiveCollection.remove(e),e.isDestroyed()||e.destroy()},provide:e=>({cloudCollection:e}),cesiumProps:["noiseDetail","noiseOffset","show","debugBillboards","debugEllipsoids"],setCesiumPropsAfterCreate:!0}),lt({name:"CorridorGraphics",create(e,t){if(!e.entity)return;const n=new M.CorridorGraphics(t);return t.classificationType&&(n.classificationType=t.classificationType),e.entity.corridor=n,n},destroy(e,t){t.entity&&(t.entity.corridor=void 0)},cesiumProps:["positions","width","cornerType","height","heightReference","extrudedHeight","extrudedHeightReference","show","fill","material","outline","outlineColor","outlineWidth","granularity","shadows","distanceDisplayCondition","zIndex","classificationType"],cesiumEventProps:{onDefinitionChange:"definitionChanged"}}),lt({name:"CumulusCloud",create:(e,t)=>e.cloudCollection?.add(t),destroy(e,t){t.cloudCollection&&!t.cloudCollection.isDestroyed()&&t.cloudCollection.remove(e)},cesiumProps:["show","position","scale","maximumSize","slice","brightness","color"]});const jne=["clustering","name","show","clock","isLoading"],Kne={onChange:"changedEvent",onError:"errorEvent",onLoading:"loadingEvent"},Jne=lt({name:"CustomDataSource",create(e,t){if(!e.dataSourceCollection)return;const n=new M.CustomDataSource(t.name);return t.clustering&&(n.clustering=t.clustering),typeof t.show=="boolean"&&(n.show=t.show),typeof t.clock<"u"&&(n.clock=t.clock),e.dataSourceCollection.add(n),n},destroy(e,t){t.dataSourceCollection&&!t.dataSourceCollection.isDestroyed()&&t.dataSourceCollection.remove(e)},provide(e){return{entityCollection:e.entities,dataSource:e}},cesiumProps:jne,cesiumEventProps:Kne,useCommonEvent:!0});lt({name:"CylinderGraphics",create(e,t){if(!e.entity)return;const n=new M.CylinderGraphics(t);return e.entity.cylinder=n,n},destroy(e,t){t.entity&&(t.entity.cylinder=void 0)},cesiumProps:["heightReference","length","topRadius","bottomRadius","show","fill","material","outline","outlineColor","outlineWidth","numberOfVerticalLines","slices","distanceDisplayCondition","shadows"],cesiumEventProps:{onDefinitionChange:"definitionChanged"}});const Qne=["clustering","show"],qne=["name","sourceUri","credit"],$ne={onChange:"changedEvent",onError:"errorEvent",onLoading:"loadingEvent"},eie=["onLoad","data"],VM=(e,{data:t,onLoad:n,...i})=>{t&&e.load(t,i).then(r=>{n&&n(r)})},tie=lt({name:"CzmlDataSource",create(e,t){if(!e.dataSourceCollection)return;const n=new M.CzmlDataSource(t.name);return t.clustering&&(n.clustering=t.clustering),typeof t.show=="boolean"&&(n.show=t.show),e.dataSourceCollection.add(n),t.data&&VM(n,t),n},update(e,t,n){t.data?n.show!==t.show&&(e.show=typeof t.show=="boolean"?t.show:!0):e.show=!1,t.data&&(n.data!==t.data||n.sourceUri!==t.sourceUri||n.credit!==t.credit)&&VM(e,t)},destroy(e,t){t.dataSourceCollection&&!t.dataSourceCollection.isDestroyed()&&t.dataSourceCollection.remove(e)},provide(e){return{dataSource:e}},cesiumProps:Qne,cesiumReadonlyProps:qne,cesiumEventProps:$ne,otherProps:eie,useCommonEvent:!0}),nie=["semiMajorAxis","semiMinorAxis","height","heightReference","extrudedHeight","show","fill","material","outline","outlineColor","outlineWidth","numberOfVerticalLines","rotation","stRotation","granularity","shadows","distanceDisplayCondition","zIndex","classificationType","extrudedHeightReference"],iie={onDefinitionChange:"definitionChanged"},rie=lt({name:"EllipseGraphics",create(e,t){if(!e.entity)return;const n=new M.EllipseGraphics(t);return e.entity.ellipse=n,n},destroy(e,t){t.entity&&(t.entity.ellipse=void 0)},cesiumProps:nie,cesiumEventProps:iie}),oie=["heightReference","radii","show","fill","innerRadii","material","maximumClock","maximumCone","minimumClock","minimumCone","outline","outlineColor","outlineWidth","subdivisions","stackPartitions","slicePartitions","shadows","distanceDisplayCondition"],sie={onDefinitionChange:"definitionChanged"},aie=lt({name:"EllipsoidGraphics",create(e,t){if(!e.entity)return;const n=new M.EllipsoidGraphics(t);return e.entity.ellipsoid=n,n},destroy(e,t){t.entity&&(t.entity.ellipsoid=void 0)},cesiumProps:oie,cesiumEventProps:sie}),cie=["availability","billboard","box","corridor","cylinder","description","ellipse","ellipsoid","entityCollection","label","model","name","orientation","path","plane","parent","point","polygon","polyline","polylineVolume","position","properties","rectangle","show","tileset","trackingReferenceFrame","viewFrom","wall"],lie=["id"],uie={onDefinitionChange:"definitionChanged"},hie=["selected","tracked"],uc=lt({name:"Entity",create(e,t){if(!e.entityCollection)return;const n=new M.Entity(t);return e.viewer&&t.selected&&(e.viewer.selectedEntity=n),e.viewer&&t.tracked&&(e.viewer.trackedEntity=n),e.entityCollection.add(n),n},destroy(e,t){t.entityCollection&&t.entityCollection.remove(e)},update(e,t,n,i){i.viewer&&(t.selected!==n.selected&&(t.selected?i.viewer.selectedEntity=e:i.viewer.selectedEntity===e&&(i.viewer.selectedEntity=void 0)),t.tracked!==n.tracked&&(t.tracked?i.viewer.trackedEntity=e:i.viewer.trackedEntity===e&&(i.viewer.trackedEntity=void 0)))},provide(e,t,n){return{entity:e,__$internal:{onUpdate:n?.onUpdate}}},cesiumProps:cie,cesiumReadonlyProps:lie,cesiumEventProps:uie,otherProps:hie,useCommonEvent:!0}),die=["density","enabled","heightFalloff","heightScalar","maxHeight","minimumBrightness","renderable","screenSpaceErrorFactor","visualDensityScalar"],fie=lt({name:"Fog",create(e){if(!e.scene)return;const t=new M.Fog;return e.scene.fog=t,t},destroy(e,t){t.scene&&!t.scene.isDestroyed()&&(t.scene.fog=new M.Fog)},cesiumProps:die,setCesiumPropsAfterCreate:!0}),pie=["clustering","name","show"],mie=["clampToGround","sourceUri","credit","markerSize","markerSymbol","markerColor","stroke","strokeWidth","fill","describe"],gie={onChange:"changedEvent",onError:"errorEvent",onLoading:"loadingEvent"},yie=["onLoad","data"],FM=(e,{data:t,onLoad:n,...i})=>{t&&e.load(t,i).then(r=>{n&&n(r)})},bie=lt({name:"GeoJsonDataSource",create(e,t){if(!e.dataSourceCollection)return;const n=new M.GeoJsonDataSource(t.name);return t.clustering&&(n.clustering=t.clustering),typeof t.show=="boolean"&&(n.show=t.show),e.dataSourceCollection.add(n),t.data&&FM(n,t),n},update(e,t,n){t.data?n.show!==t.show&&(e.show=typeof t.show=="boolean"?t.show:!0):e.show=!1,t.data&&(n.data!==t.data||n.clampToGround!==t.clampToGround||n.sourceUri!==t.sourceUri||n.credit!==t.credit||n.markerSize!==t.markerSize||n.markerSymbol!==t.markerSymbol||n.markerColor!==t.markerColor||n.stroke!==t.stroke||n.strokeWidth!==t.strokeWidth||n.fill!==t.fill)&&FM(e,t)},destroy(e,t){t.dataSourceCollection&&!t.dataSourceCollection.isDestroyed()&&t.dataSourceCollection.remove(e)},provide(e){return{dataSource:e}},cesiumProps:pie,cesiumReadonlyProps:mie,cesiumEventProps:gie,otherProps:yie,useCommonEvent:!0}),_ie={onImageryLayersUpdate:"imageryLayersUpdatedEvent",onTerrainProviderChange:"terrainProviderChanged",onTileLoadProgress:"tileLoadProgressEvent"},vie=["atmosphereBrightnessShift","atmosphereHueShift","atmosphereSaturationShift","backFaceCulling","baseColor","clippingPlanes","depthTestAgainstTerrain","enableLighting","lightingFadeInDistance","lightingFadeOutDistance","material","maximumScreenSpaceError","nightFadeInDistance","nightFadeOutDistance","oceanNormalMapUrl","shadows","show","showGroundAtmosphere","showWaterEffect","tileCacheSize","loadingDescendantLimit","preloadAncestors","preloadSiblings","fillHighlightColor","dynamicAtmosphereLighting","dynamicAtmosphereLightingFromSun","showSkirts","cartographicLimitRectangle","translucency","undergroundColor","undergroundColorAlphaByDistance","lambertDiffuseMultiplier","atmosphereLightIntensity","atmosphereRayleighCoefficient","atmosphereMieCoefficient","atmosphereRayleighScaleHeight","atmosphereMieScaleHeight","atmosphereMieAnisotropy","vertexShadowDarkness","clippingPolygons"],wie=["terrainProvider"],xie=lt({name:"Globe",create:e=>e.scene?.globe,update:async(e,t)=>{const n=t.terrainProvider;let i;lc(n)?i=await n:i=n,e.terrainProvider=i},cesiumProps:vie,cesiumEventProps:_ie,otherProps:wie,setCesiumPropsAfterCreate:!0});lt({name:"Google2DImageryProvider",async create(e,t){const{onReady:n,assetId:i,accessToken:r,key:o,children:s,...a}=t;let c;if(i!==void 0){const l={...a,assetId:i};r!==void 0&&(l.accessToken=r),c=await M.Google2DImageryProvider.fromIonAssetId(l)}else{const l={...a};o!==void 0&&(l.key=o),c=await M.Google2DImageryProvider.fromUrl(l)}return n&&n(c),c}}),lt({name:"GroundPolylinePrimitive",create(e,t){if(!e.primitiveCollection)return;const n=new M.GroundPolylinePrimitive(t);if(t.onReady){const i=()=>{n.ready&&(t.onReady?.(n),e.scene?.postRender.removeEventListener(i))};e.scene?.postRender.addEventListener(i)}return e.primitiveCollection.add(n),n},destroy(e,t){t.primitiveCollection&&!t.primitiveCollection.isDestroyed()&&t.primitiveCollection.remove(e),e.isDestroyed()||e.destroy()},cesiumProps:["appearance","classificationType","debugShowBoundingVolume","debugShowShadowVolume","show"],cesiumReadonlyProps:["allowPicking","asynchronous","geometryInstances","interleave","releaseGeometryInstances"],otherProps:["onReady"],useCommonEvent:!0}),lt({name:"GroundPrimitive",create(e,t){if(!e.primitiveCollection)return;const n=new M.GroundPrimitive(t);if(t.onReady){const i=()=>{n.ready&&(t.onReady?.(n),e.scene?.postRender.removeEventListener(i))};e.scene?.postRender.addEventListener(i)}return e.primitiveCollection.add(n),n},destroy(e,t){t.primitiveCollection&&!t.primitiveCollection.isDestroyed()&&t.primitiveCollection.remove(e),e.isDestroyed()||e.destroy()},cesiumProps:["appearance","classificationType","debugShowBoundingVolume","debugShowShadowVolume","show"],cesiumReadonlyProps:["allowPicking","asynchronous","compressVertices","geometryInstances","interleave","releaseGeometryInstances","vertexCacheOptimize"],otherProps:["onReady"],useCommonEvent:!0}),lt({name:"GroundPrimitiveCollection",create:e=>e.scene?.groundPrimitives,provide:e=>({primitiveCollection:e}),cesiumProps:["show","destroyPrimitives","primitiveAdded","primitiveRemoved"],setCesiumPropsAfterCreate:!0});const Sie=["alpha","brightness","contrast","hue","saturation","gamma","splitDirection","minificationFilter","magnificationFilter","cutoutRectangle","show","nightAlpha","dayAlpha","colorToAlpha","colorToAlphaThreshold","index"],Eie=["rectangle","maximumAnisotropy","minimumTerrainLevel","maximumTerrainLevel","imageryProvider"],Tie=lt({name:"ImageryLayer",async create(e,t){if(!e.imageryLayerCollection)return;const n=lc(t.imageryProvider)?t.imageryProvider:new Promise(s=>queueMicrotask(()=>s(t.imageryProvider))),i=e.__$internal?.imageryLayerWaitingList?.slice();e.__$internal?.imageryLayerWaitingList&&e.__$internal.imageryLayerWaitingList.push(n),i&&await Promise.all(i.filter(s=>lc(s)));const r=await n;if(e.__$internal?.imageryLayerWaitingList&&(e.__$internal.imageryLayerWaitingList=e.__$internal.imageryLayerWaitingList.filter(s=>s!==n)),!r)return;const o=new M.ImageryLayer(r,t);return e.imageryLayerCollection.add(o,t.index),o},destroy(e,t){t.imageryLayerCollection&&t.imageryLayerCollection.remove(e)},cesiumProps:Sie,cesiumReadonlyProps:Eie});lt({name:"ImageryLayerCollection",create:e=>e.globe?.imageryLayers,cesiumEventProps:{onLayerAdd:"layerAdded",onLayerMove:"layerMoved",onLayerRemove:"layerRemoved",onLayerShowOrHide:"layerShownOrHidden"}});const Cie=["clustering","name","show"],Rie=["canvas","camera","ellipsoid","clampToGround","sourceUri","credit","screenOverlayContainer"],Iie={onChange:"changedEvent",onError:"errorEvent",onLoading:"loadingEvent",onRefresh:"refreshEvent",onUnsupportedNode:"unsupportedNodeEvent"},Mie=["onLoad","data"],AM=(e,{data:t,onLoad:n,...i})=>{t&&e.load(t,i).then(r=>{n&&n(r)})},Lie=lt({name:"KmlDataSource",create(e,t){if(!e.scene||!e.dataSourceCollection||!e.scene)return;const n=new M.KmlDataSource({camera:t.camera||e.scene.camera,canvas:t.canvas||e.scene.canvas,ellipsoid:t.ellipsoid,credit:t.credit});return t.clustering&&(n.clustering=t.clustering),typeof t.show=="boolean"&&(n.show=t.show),typeof t.name<"u"&&(n.name=t.name),e.dataSourceCollection.add(n),t.data&&AM(n,t),n},update(e,t,n){t.data?n.show!==t.show&&(e.show=typeof t.show=="boolean"?t.show:!0):e.show=!1,t.data&&(n.data!==t.data||n.clampToGround!==t.clampToGround||n.ellipsoid!==t.ellipsoid||n.sourceUri!==t.sourceUri||n.credit!==t.credit)&&AM(e,t)},destroy(e,t){t.dataSourceCollection&&!t.dataSourceCollection.isDestroyed()&&t.dataSourceCollection.remove(e)},provide(e){return{dataSource:e}},cesiumProps:Cie,cesiumReadonlyProps:Rie,cesiumEventProps:Iie,otherProps:Mie,useCommonEvent:!0});lt({name:"Label",create:(e,t)=>e.labelCollection?.add(t),destroy(e,t){t.labelCollection&&!t.labelCollection.isDestroyed()&&t.labelCollection.remove(e)},cesiumProps:["backgroundColor","backgroundPadding","disableDepthTestDistance","distanceDisplayCondition","eyeOffset","fillColor","font","heightReference","horizontalOrigin","id","outlineColor","outlineWidth","pixelOffset","pixelOffsetScaleByDistance","position","scale","scaleByDistance","show","showBackground","style","text","translucencyByDistance","verticalOrigin"],useCommonEvent:!0}),lt({name:"LabelCollection",create(e,t){if(!e.scene||!e.primitiveCollection)return;const n=new M.LabelCollection({scene:e.scene,modelMatrix:t.modelMatrix,blendOption:t.blendOption,debugShowBoundingVolume:t.debugShowBoundingVolume});return e.primitiveCollection.add(n),n},destroy(e,t){t.primitiveCollection&&!t.primitiveCollection.isDestroyed()&&t.primitiveCollection.remove(e),e.isDestroyed()||e.destroy()},provide(e){return{labelCollection:e}},cesiumProps:["blendOption","debugShowBoundingVolume","modelMatrix","show"]});const Pie=["text","font","style","fillColor","outlineColor","outlineWidth","show","showBackground","backgroundColor","backgroundPadding","scale","horizontalOrigin","verticalOrigin","eyeOffset","pixelOffset","translucencyByDistance","pixelOffsetScaleByDistance","scaleByDistance","heightReference","distanceDisplayCondition","disableDepthTestDistance"],Oie={onDefinitionChange:"definitionChanged"},Gie=lt({name:"LabelGraphics",create(e,t){if(!e.entity)return;const n=new M.LabelGraphics(t);return e.entity.label=n,n},destroy(e,t){t.entity&&(t.entity.label=void 0)},cesiumProps:Pie,cesiumEventProps:Oie});lt({name:"Model",async create(e,{scene:t,url:n,colorBlendMode:i,...r}){if(!e.scene||!e.primitiveCollection||!n)return;const o=n;let s;lc(o)?s=await o:s=o;let a;try{a=await M.Model.fromGltfAsync({...r,url:s,colorBlendMode:i,scene:t||e.scene})}catch(c){r.onError?.(c);return}return e.primitiveCollection.add(a),a},destroy(e,t){t.primitiveCollection&&!t.primitiveCollection.isDestroyed()&&t.primitiveCollection.remove(e),e.isDestroyed()||e.destroy()},cesiumEventProps:{onReady:"readyEvent"},cesiumProps:["backFaceCulling","clampAnimations","clippingPlanes","clippingPolygons","color","colorBlendAmount","colorBlendMode","customShader","debugShowBoundingVolume","debugWireframe","distanceDisplayCondition","enableVerticalExaggeration","featureIdLabel","heightReference","id","imageBasedLighting","instanceFeatureIdLabel","lightColor","maximumScale","minimumPixelSize","modelMatrix","outlineColor","scale","shadows","show","showCreditsOnScreen","showOutline","silhouetteColor","silhouetteSize","splitDirection","style","pointCloudShading"],cesiumReadonlyProps:["allowPicking","asynchronous","basePath","credit","enableDebugWireframe","gltf","incrementallyLoadTextures","scene","releaseGltfJson","cull","opaquePass","upAxis","forwardAxis","content","enableShowOutline","projectTo2D","classificationType","gltfCallback","enablePick","environmentMapOptions"],otherProps:["onReady","onError","url"],useCommonEvent:!0});const Vie=["uri","show","scale","minimumPixelSize","maximumScale","incrementallyLoadTextures","runAnimations","clampAnimations","nodeTransformations","shadows","heightReference","distanceDisplayCondition","silhouetteColor","silhouetteSize","color","colorBlendMode","colorBlendAmount","clippingPlanes","imageBasedLightingFactor","lightColor","articulations","customShader","enableVerticalExaggeration","environmentMapOptions"],Fie={onDefinitionChange:"definitionChanged"},Aie=lt({name:"ModelGraphics",create(e,t){if(!e.entity)return;const n=new M.ModelGraphics(t);return e.entity.model=n,n},destroy(e,t){t.entity&&(t.entity.model=void 0)},cesiumProps:Vie,cesiumEventProps:Fie}),zie=["onlySunLighting","show","textureUrl"],Nie=["ellipsoid"],kie=lt({name:"Moon",create(e,t){if(!e.scene)return;const n=new M.Moon(t);return e.scene.moon=n,n},destroy(e,t){t.scene&&!t.scene.isDestroyed()&&(t.scene.moon=new M.Moon)},cesiumProps:zie,cesiumReadonlyProps:Nie});lt({name:"ParticleSystem",create(e,t){if(!e.primitiveCollection)return;const n=new M.ParticleSystem({...t,updateCallback:t.onUpdate});return e.primitiveCollection.add(n),n},update(e,t,n){t.onUpdate!==n.onUpdate&&(e.updateCallback=t.onUpdate)},destroy(e,t){t.primitiveCollection&&!t.primitiveCollection.isDestroyed()&&t.primitiveCollection.remove(e)},cesiumProps:["show","emitter","modelMatrix","emitterModelMatrix","emissionRate","bursts","loop","startScale","endScale","startColor","endColor","image","imageSize","minimumImageSize","maximumImageSize","speed","minimumSpeed","maximumSpeed","lifetime","particleLife","minimumParticleLife","maximumParticleLife","mass","minimumMass","maximumMass","sizeInMeters"],cesiumEventProps:{onComplete:"complete",onUpdate:"updateCallback"}}),lt({name:"PathGraphics",create(e,t){if(!e.entity)return;const n=new M.PathGraphics(t);return e.entity.path=n,n},destroy(e,t){t.entity&&(t.entity.path=void 0)},cesiumProps:["leadTime","trailTime","show","width","material","resolution","distanceDisplayCondition"],cesiumEventProps:{onDefinitionChange:"definitionChanged"}});const Xie=["plane","dimensions","show","fill","material","outline","outlineColor","outlineWidth","shadows","distanceDisplayCondition"],Zie={onDefinitionChange:"definitionChanged"},Die=lt({name:"PlaneGraphics",create(e,t){if(!e.entity)return;const n=new M.PlaneGraphics(t);return e.entity.plane=n,n},destroy(e,t){t.entity&&(t.entity.plane=void 0)},cesiumProps:Xie,cesiumEventProps:Zie}),Uie=["color","pixelSize","outlineColor","outlineWidth","show","scaleByDistance","translucencyByDistance","heightReference","distanceDisplayCondition","disableDepthTestDistance","splitDirection"],Wie={onDefinitionChange:"definitionChanged"},Bie=lt({name:"PointGraphics",create(e,t){if(!e.entity)return;const n=new M.PointGraphics(t);return e.entity.point=n,n},destroy(e,t){t.entity&&(t.entity.point=void 0)},cesiumProps:Uie,cesiumEventProps:Wie});lt({name:"PointPrimitive",create:(e,t)=>e.pointPrimitiveCollection?.add(t),destroy(e,t){t.pointPrimitiveCollection&&!t.pointPrimitiveCollection.isDestroyed()&&t.pointPrimitiveCollection.remove(e)},cesiumProps:["color","disableDepthTestDistance","distanceDisplayCondition","id","outlineColor","outlineWidth","pixelSize","position","scaleByDistance","show","splitDirection","translucencyByDistance"],useCommonEvent:!0}),lt({name:"PointPrimitveCollection",create(e,t){if(!e.primitiveCollection)return;const n=new M.PointPrimitiveCollection(t);return e.primitiveCollection.add(n),n},destroy(e,t){t.primitiveCollection&&!t.primitiveCollection.isDestroyed()&&t.primitiveCollection.remove(e),e.isDestroyed()||e.destroy()},provide(e){return{pointPrimitiveCollection:e}},cesiumProps:["blendOption","debugShowBoundingVolume","modelMatrix","show"]});const Yie=["arcType","hierarchy","height","heightReference","extrudedHeight","extrudedHeightReference","show","fill","material","outline","outlineColor","outlineWidth","stRotation","granularity","perPositionHeight","closeTop","closeBottom","shadows","distanceDisplayCondition","zIndex","classificationType","textureCoordinates"],Hie={onDefinitionChange:"definitionChanged"},zM=lt({name:"PolygonGraphics",create(e,t){if(!e.entity)return;const n=new M.PolygonGraphics(t);return e.entity.polygon=n,n},destroy(e,t){t.entity&&(t.entity.polygon=void 0)},cesiumProps:Yie,cesiumEventProps:Hie});lt({name:"Polyline",create:(e,t)=>e.polylineCollection?.add(t),destroy(e,t){t.polylineCollection&&!t.polylineCollection.isDestroyed()&&t.polylineCollection.remove(e)},cesiumProps:["distanceDisplayCondition","id","loop","material","positions","show","width"],useCommonEvent:!0}),lt({name:"PolylineCollection",create(e,t){if(!e.primitiveCollection)return;const n=new M.PolylineCollection({modelMatrix:t.modelMatrix,debugShowBoundingVolume:t.debugShowBoundingVolume,length:t.length,scene:e.scene});return e.primitiveCollection.add(n),n},destroy(e,t){t.primitiveCollection&&!t.primitiveCollection.isDestroyed()&&t.primitiveCollection.remove(e),e.isDestroyed()||e.destroy()},provide(e){return{polylineCollection:e}},cesiumProps:["debugShowBoundingVolume","length","modelMatrix","show"]});const jie=["arcType","classificationType","positions","clampToGround","width","show","material","depthFailMaterial","granularity","shadows","distanceDisplayCondition","zIndex"],Kie={onDefinitionChange:"definitionChanged"},ml=lt({name:"PolylineGraphics",create(e,t){if(!e.entity)return;const n=new M.PolylineGraphics(t);return e.entity.polyline=n,n},destroy(e,t){t.entity&&(t.entity.polyline=void 0)},cesiumProps:jie,cesiumEventProps:Kie});lt({name:"PolylineVolumeGraphics",create(e,t){if(!e.entity)return;const n=new M.PolylineVolumeGraphics(t);return e.entity.polylineVolume=n,n},destroy(e,t){t.entity&&(t.entity.polylineVolume=void 0)},cesiumProps:["positions","shape","cornerType","show","fill","material","outline","outlineColor","outlineWidth","granularity","shadows","distanceDisplayCondition"],cesiumEventProps:{onDefinitionChange:"definitionChanged"}}),lt({name:"PostProcessStage",create(e,t){if(!e.scene)return;const n=new M.PostProcessStage(t);return typeof t.enabled=="boolean"&&(n.enabled=t.enabled),t.selected&&(n.selected=t.selected),e.scene.postProcessStages.add(n),n},destroy(e,t){t.scene&&!t.scene.isDestroyed()&&t.scene.postProcessStages.remove(e),e.isDestroyed()||e.destroy()},cesiumProps:["enabled","selected"],cesiumReadonlyProps:["clearColor","forcePowerOfTwo","fragmentShader","name","pixelDatatype","pixelFormat","sampleMode","scissorRectangle","textureScale","uniforms"]}),Ko({name:"BlackAndWhiteStage",props:["gradations"],create:()=>M.PostProcessStageLibrary.createBlackAndWhiteStage()}),Ko({name:"BrightnessStage",props:["brightness"],create:()=>M.PostProcessStageLibrary.createBrightnessStage()}),Ko({name:"LensFlareStage",props:["dirtTexture","starTexture","intensity","distortion","ghostDispersal","haloWidth","earthRadius"],create:()=>M.PostProcessStageLibrary.createLensFlareStage()}),Ko({name:"Fxaa",create:(e,t)=>t.fxaa,props:[]}),Ko({name:"NightVisionStage",props:[],create:()=>M.PostProcessStageLibrary.createNightVisionStage()}),lt({name:"PostProcessStageComposite",create(e,t){if(!e.scene)return;const n=new M.PostProcessStageComposite(t);return typeof t.enabled=="boolean"&&(n.enabled=t.enabled),t.selected&&(n.selected=t.selected),e.scene.postProcessStages.add(n),n},destroy(e,t){t.scene&&!t.scene.isDestroyed()&&t.scene.postProcessStages.remove(e),e.isDestroyed()||e.destroy()},cesiumProps:["enabled","selected"],cesiumReadonlyProps:["inputPreviousStageTexture","name","stages","uniforms"]}),Ko({name:"AmbientOcclusion",create:(e,t)=>t.ambientOcclusion,props:["ambientOcclusionOnly","bias","delta","frustumLength","intensity","lengthCap","sigma","stepSize"],noMount:!0}),Ko({name:"Bloom",create:(e,t)=>t.bloom,props:["brightness","contrast","delta","glowOnly","sigma","stepSize"],noMount:!0}),Ko({name:"BlurStage",props:["delta","sigma","stepSize"],create:()=>M.PostProcessStageLibrary.createBlurStage()}),Ko({name:"DepthOfFieldStage",props:["delta","focalDistance","sigma","stepSize"],create:()=>M.PostProcessStageLibrary.createDepthOfFieldStage()}),Ko({name:"EdgeDetectionStage",props:["color","length"],create:()=>M.PostProcessStageLibrary.createEdgeDetectionStage()}),Ko({name:"SilhouetteStage",props:["color","length"],create:()=>M.PostProcessStageLibrary.createSilhouetteStage()});const Jie=["appearance","cull","debugShowBoundingVolume","depthFailAppearance","modelMatrix","shadows","show"],Qie=["allowPicking","asynchronous","compressVertices","geometryInstances","interleave","releaseGeometryInstances","vertexCacheOptimize"],qie=["onReady"],$ie=lt({name:"Primitive",create(e,t){if(!e.primitiveCollection)return;const n=new M.Primitive(t);if(t.onReady){const i=()=>{n.ready&&(t.onReady?.(n),e.scene?.postRender.removeEventListener(i))};e.scene?.postRender.addEventListener(i)}return e.primitiveCollection.add(n),n},destroy(e,t){t.primitiveCollection&&!t.primitiveCollection.isDestroyed()&&t.primitiveCollection.remove(e),e.isDestroyed()||e.destroy()},cesiumProps:Jie,cesiumReadonlyProps:Qie,otherProps:qie,useCommonEvent:!0});lt({name:"RectangleGraphics",create(e,t){if(!e.entity)return;const n=new M.RectangleGraphics(t);return e.entity.rectangle=n,n},destroy(e,t){t.entity&&(t.entity.rectangle=void 0)},cesiumProps:["classificationType","coordinates","height","heightReference","extrudedHeight","extrudedHeightReference","show","fill","material","outline","outlineColor","outlineWidth","rotation","stRotation","granularity","shadows","distanceDisplayCondition","zIndex"],cesiumEventProps:{onDefinitionChange:"definitionChanged"}});const ere=["backgroundColor","completeMorphOnUserInput","debugShowCommands","debugShowDepthFrustum","debugShowFramesPerSecond","debugShowFrustumPlanes","debugShowFrustums","eyeSeparation","farToNearRatio","focalLength","fog","gamma","globe","highDynamicRange","invertClassification","invertClassificationColor","light","logarithmicDepthBuffer","logarithmicDepthFarToNearRatio","maximumRenderTimeChange","minimumDisableDepthTestDistance","moon","morphTime","nearToFarDistance2D","pickTranslucentDepth","requestRenderMode","rethrowRenderErrors","shadowMap","skyAtmosphere","skyBox","specularEnvironmentMaps","sphericalHarmonicCoefficients","sun","sunBloom","terrainProvider","useDepthPicking","useWebVR","msaaSamples","splitPosition","verticalExaggeration","verticalExaggerationRelativeHeight","atmosphere"],tre={onMorphComplete:"morphComplete",onMorphStart:"morphStart",onPostRender:"postRender",onPreRender:"preRender",onPreUpdate:"preUpdate",onPostUpdate:"postUpdate",onRenderError:"renderError",onTerrainProviderChange:"terrainProviderChanged"},nre=["mode","morphDuration","enableEdgeVisibility"],NM=(e,t,n)=>{switch(t){case M.SceneMode.SCENE2D:e.morphTo2D(n);break;case M.SceneMode.COLUMBUS_VIEW:e.morphToColumbusView(n);break;case M.SceneMode.SCENE3D:e.morphTo3D(n);break}},ire=lt({name:"Scene",create(e,t){return e.scene&&(t.mode&&NM(e.scene,t.mode,t.morphDuration),t.enableEdgeVisibility!==void 0&&(e.scene._enableEdgeVisibility=t.enableEdgeVisibility)),e.scene},update(e,t,n){t.mode!==n.mode&&t.mode&&NM(e,t.mode,t.morphDuration),t.enableEdgeVisibility!==n.enableEdgeVisibility&&t.enableEdgeVisibility!==void 0&&(e._enableEdgeVisibility=t.enableEdgeVisibility)},cesiumProps:ere,cesiumEventProps:tre,otherProps:nre,setCesiumPropsAfterCreate:!0}),rre=["bounceAnimationTime","enableCollisionDetection","enableInputs","enableLook","enableRotate","enableTilt","enableTranslate","enableZoom","inertiaSpin","inertiaTranslate","inertiaZoom","lookEventTypes","maximumMovementRatio","maximumZoomDistance","minimumCollisionTerrainHeight","minimumPickingTerrainHeight","minimumTrackBallHeight","minimumZoomDistance","rotateEventTypes","tiltEventTypes","translateEventTypes","zoomEventTypes","minimumPickingTerrainDistanceWithInertia","maximumTiltAngle","zoomFactor"],ore=lt({name:"ScreenSpaceCameraController",create:e=>e.scene?.screenSpaceCameraController,cesiumProps:rre,setCesiumPropsAfterCreate:!0}),hc=({action:e,modifier:t,type:n})=>{const i=Qn();return R.useEffect(()=>{if(!(!i.screenSpaceEventHandler||i.screenSpaceEventHandler.isDestroyed())){if(e)return i.screenSpaceEventHandler.setInputAction(e,n,t),()=>{!i.screenSpaceEventHandler||i.screenSpaceEventHandler.isDestroyed()||i.screenSpaceEventHandler.removeInputAction(n,t)};i.screenSpaceEventHandler.removeInputAction(n,t)}},[e,i.screenSpaceEventHandler,t,n]),null},kM=lt({name:"ScreenSpaceEventHandler",create(e,t){return t.useDefault?e.cesiumWidget?.screenSpaceEventHandler:e.scene?new M.ScreenSpaceEventHandler(e.scene.canvas):void 0},destroy(e){e.isDestroyed()||e.destroy()},provide(e){return{screenSpaceEventHandler:e}}});lt({name:"ShadowMap",create:e=>e.scene?.shadowMap,cesiumProps:["darkness","fadingEnabled","maximumDistance","enabled","normalOffset","softShadows","size"]});const sre=["brightnessShift","hueShift","saturationShift","show","perFragmentAtmosphere","atmosphereLightIntensity","atmosphereRayleighCoefficient","atmosphereMieCoefficient","atmosphereRayleighScaleHeight","atmosphereMieScaleHeight","atmosphereMieAnisotropy"],are=lt({name:"SkyAtmosphere",create:e=>e.scene?.skyAtmosphere,cesiumProps:sre,setCesiumPropsAfterCreate:!0}),cre=["sources","show"],lre=lt({name:"SkyBox",create:e=>e.scene?.skyBox,cesiumProps:cre,setCesiumPropsAfterCreate:!0}),ure=["glowFactor","show"],hre=lt({name:"Sun",create(e){if(!e.scene)return;const t=new M.Sun;return e.scene.sun=t,t},destroy(e,t){t.scene&&!t.scene.isDestroyed()&&(t.scene.sun=new M.Sun)},cesiumProps:ure,setCesiumPropsAfterCreate:!0});lt({name:"TimeDynamicPointCloud",create(e,t){if(!e.cesiumWidget||!e.primitiveCollection||!e.cesiumWidget?.clock)return;const n=new M.TimeDynamicPointCloud({...t,clock:t.clock??e.cesiumWidget.clock});if(t.onReady){const i=()=>{t.onReady?.(n),n.frameChanged.removeEventListener(i)};n.frameChanged.addEventListener(i)}return e.primitiveCollection.add(n),n},destroy(e,t){t.primitiveCollection&&!t.primitiveCollection.isDestroyed()&&t.primitiveCollection.remove(e),e.isDestroyed()||e.destroy()},cesiumProps:["clippingPlanes","maximumMemoryUsage","modelMatrix","shadows","show","style","intervals"],cesiumReadonlyProps:["clock","shading"],cesiumEventProps:{onFrameChange:"frameChanged"},otherProps:["onReady"],useCommonEvent:!0});const dre=["terrainShadows","clockTrackedDataSource","targetFrameRate","useDefaultRenderLoop","resolutionScale","allowDataSourcesToSuspendAnimation","trackedEntity","selectedEntity","shadows","useBrowserRecommendedResolution","creditDisplay"],fre=["baseLayer","animation","baseLayerPicker","fullscreenButton","vrButton","geocoder","homeButton","infoBox","sceneModePicker","selectionIndicator","timeline","navigationHelpButton","navigationInstructionsInitiallyVisible","scene3DOnly","shouldAnimate","clockViewModel","selectedImageryProviderViewModel","imageryProviderViewModels","selectedTerrainProviderViewModel","terrainProviderViewModels","ellipsoid","skyBox","skyAtmosphere","fullscreenElement","showRenderLoopErrors","automaticallyTrackDataSourceClocks","contextOptions","sceneMode","mapProjection","globe","orderIndependentTranslucency","creditContainer","creditViewport","dataSources","mapMode2D","projectionPicker","blurActiveElementOnCanvasFocus","requestRenderMode","maximumRenderTimeChange","depthPlaneEllipsoidOffset","msaaSamples","terrain"],pre={onSelectedEntityChange:"selectedEntityChanged",onTrackedEntityChange:"trackedEntityChanged"},mre=["className","id","style","full","containerProps","extend","terrainProvider"],gre=lt({name:"Viewer",async create(e,{baseLayer:t,terrainProvider:n,...i},r){if(!r)return;let o;lc(n)?o=await n:o=n;const s=new M.Viewer(r,{...i,terrainProvider:o,baseLayer:t??void 0});if(!s)return;t===!1&&s.imageryLayers.removeAll(),s&&i.extend&&(Array.isArray(i.extend)?i.extend.forEach(c=>{s.extend(c,{})}):s.extend(i.extend,{}));const a=new LM(s.scene);return[s,a]},destroy(e,t,n,i){i&&!i.isDestroyed()&&i.destroy(),e.isDestroyed()||e.destroy()},provide(e,t,n,i){return{viewer:e,cesiumWidget:e.cesiumWidget,dataSourceCollection:e.dataSources,entityCollection:e.entities,scene:e.scene,camera:e.scene.camera,imageryLayerCollection:e.scene.globe.imageryLayers,primitiveCollection:e.scene.primitives,globe:e.scene.globe,__$internal:{onUpdate:n?.onUpdate,imageryLayerWaitingList:[]},[Xu]:i}},containerProps:({id:e,className:t,style:n,full:i,containerProps:r})=>({className:t,id:e,style:{...i?{position:"absolute",bottom:"0",left:"0",right:"0",top:"0"}:{},...n},...r}),cesiumProps:dre,cesiumReadonlyProps:fre,cesiumEventProps:pre,otherProps:mre,renderContainer:!0,useCommonEvent:!0,useRootEvent:!0});lt({name:"WallGraphics",create(e,t){if(!e.entity)return;const n=new M.WallGraphics(t);return e.entity.wall=n,n},destroy(e,t){t.entity&&(t.entity.wall=void 0)},cesiumProps:["positions","maximumHeights","minimumHeights","show","fill","material","outline","outlineColor","outlineWidth","granularity","shadows","distanceDisplayCondition"],cesiumEventProps:{onDefinitionChange:"definitionChanged"}});const Cv=R.memo(({space:e})=>{const t=R.useMemo(()=>({rectangle:{coordinates:M.Rectangle.fromDegrees(...e.wsen),height:e.height,heightReference:M.HeightReference.NONE,extrudedHeight:e.extrudedHeight,clampToGround:!1,fill:!0,outline:!0,outlineColor:M.Color.fromCssColorString(e.outlineColor??""),material:M.Color.fromCssColorString(e.color??""),classificationType:M.ClassificationType.TERRAIN}}),[e]);return ce.jsx(uc,{id:e.id,...t})});Cv.displayName="SpatialIdSpace";const Rv=R.memo(({wsen:e,color:t})=>{const n=R.useMemo(()=>({rectangle:{coordinates:M.Rectangle.fromDegrees(...e),clampToGround:!0,fill:!0,outline:!1,material:M.Color.fromCssColorString(t),classificationType:M.ClassificationType.BOTH}}),[e,t]);return ce.jsx(uc,{...n})});Rv.displayName="SpatialIdSpace";const XM=R.memo(({indicator:e})=>{const t=R.useMemo(()=>({rectangle:{coordinates:M.Rectangle.fromDegrees(...e.wsen),height:e.height,extrudedHeight:e.extrudedHeight,clampToGround:!1,fill:!0,outline:!0,outlineColor:M.Color.fromCssColorString(e.outlineColor),material:M.Color.fromCssColorString(e.color),classificationType:M.ClassificationType.TERRAIN}}),[e]);return ce.jsx(uc,{...t})});XM.displayName="VerticalSpaceIndicator";const yre={zoom:20,maxHeight:4e3,minHeight:-1e3,dataOnly:!1,rightClickToExit:!0,color:"#00bebe44",outlineColor:"#00bebe55",groundIndicatorColor:"#00000066",selectorColor:"#ff990099",selectorOutlineColor:"#ff9900aa",verticalSpaceIndicatorColor:"#ffffff33",verticalSpaceIndicatorOutlineColor:"#ffffff55"},Dm={min:-85.0511,max:85.0511};function bre(e){return"z"in e&&"f"in e&&"x"in e&&"y"in e}const Zu=25,ZM={f:0,x:0,y:0,z:0},_re=180/Math.PI;function DM(e,t=1){const{f:n,x:i,y:r,z:o}=e;if(t<=0)throw new Error("steps must be greater than 0");if(t>o)throw new Error(`Getting parent tile of ${e}, ${t} steps is not possible because it would go beyond the root tile (z=0)`);return{f:n>>t,x:i>>t,y:r>>t,z:o-t}}function Um(e=ZM){const{f:t,x:n,y:i,z:r}=e;return[{f:t*2,x:n*2,y:i*2,z:r+1},{f:t*2,x:n*2+1,y:i*2,z:r+1},{f:t*2,x:n*2,y:i*2+1,z:r+1},{f:t*2,x:n*2+1,y:i*2+1,z:r+1},{f:t*2+1,x:n*2,y:i*2,z:r+1},{f:t*2+1,x:n*2+1,y:i*2,z:r+1},{f:t*2+1,x:n*2,y:i*2+1,z:r+1},{f:t*2+1,x:n*2+1,y:i*2+1,z:r+1}]}function Iv(e=ZM){const{f:t,x:n,y:i,z:r}=e;return[Is({f:t,x:n,y:i,z:r}),Is({f:t,x:n+1,y:i,z:r}),Is({f:t,x:n,y:i+1,z:r}),Is({f:t,x:n+1,y:i+1,z:r}),Is({f:t,x:n-1,y:i,z:r}),Is({f:t,x:n,y:i-1,z:r}),Is({f:t,x:n-1,y:i-1,z:r}),Is({f:t,x:n+1,y:i-1,z:r}),Is({f:t,x:n-1,y:i+1,z:r})]}function vre(e){const t=e.match(/^\/?(\d+)\/(?:(\d+)\/)?(\d+)\/(\d+)$/);if(t)return{z:parseInt(t[1],10),f:parseInt(t[2]||"0",10),x:parseInt(t[3],10),y:parseInt(t[4],10)}}function Mv(e){const t=Math.PI-2*Math.PI*e.y/Math.pow(2,e.z);return{lng:e.x/Math.pow(2,e.z)*360-180,lat:_re*Math.atan(.5*(Math.exp(t)-Math.exp(-t)))}}function wre(e){const t=e.x*2+1,n=e.y*2+1,i=e.z+1;return Mv({x:t,y:n,z:i})}function xre(e){return{...wre(e),alt:nf(e)+2**Zu/2**(e.z+1)}}function UM(e){const t=Mv(e),n=Mv({...e,y:e.y+1,x:e.x+1});return[t,n]}function nf(e){return e.f*2**Zu/2**e.z}function Sre(e){const t=typeof e.alt<"u"?e.alt:0;if(t<=-33554432||t>=2**Zu)throw new Error(`ZFXY only supports altitude between -2^${Zu} and +2^${Zu}.`);const n=Math.floor(2**e.zoom*t/2**Zu),i=Math.PI/180,r=Math.sin(e.lat*i),o=2**e.zoom;let s=o*(e.lng/360+.5);const a=o*(.5-.25*Math.log((1+r)/(1-r))/Math.PI);return s=s%o,s<0&&(s=s+o),{f:n,x:Math.floor(s),y:Math.floor(a),z:e.zoom}}function Is(e){const{z:t,f:n,x:i,y:r}=e;return{z:t,f:Math.max(Math.min(n,2**t),-(2**t)),x:i<0?i+2**t:i%2**t,y:r<0?r+2**t:r%2**t}}function Ere(e){let t=!1;e[0]==="-"&&(t=!0,e=e.substring(1));let n=Um(),i;for(const r of e)i={...n[parseInt(r,10)-1]},n=Um(i);return t&&(i.f=-i.f),i}function Tre(e){let{f:t,x:n,y:i,z:r}=e;const o=t;let s="";for(;r>0;){const a={f:Math.abs(t),x:n,y:i,z:r},c=DM(a);s=(Um(c).findIndex(h=>h.f===Math.abs(t)&&h.x===n&&h.y===i&&h.z===r)+1).toString()+s,t=c.f,n=c.x,i=c.y,r=c.z}return(o<0?"-":"")+s}function gl(e,t,n){n===void 0&&(n={});var i={type:"Feature"};return(n.id===0||n.id)&&(i.id=n.id),n.bbox&&(i.bbox=n.bbox),i.properties=t||{},i.geometry=e,i}function Cre(e,t,n){if(n===void 0&&(n={}),!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!BM(e[0])||!BM(e[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:e};return gl(i,t,n)}function WM(e,t,n){if(n===void 0&&(n={}),e.length<2)throw new Error("coordinates must be an array of two or more positions");var i={type:"LineString",coordinates:e};return gl(i,t,n)}function Wm(e,t){t===void 0&&(t={});var n={type:"FeatureCollection"};return t.id&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.features=e,n}function Rre(e,t,n){n===void 0&&(n={});var i={type:"MultiLineString",coordinates:e};return gl(i,t,n)}function BM(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}function YM(e,t,n){if(e!==null)for(var i,r,o,s,a,c,l,u=0,h=0,d,f=e.type,p=f==="FeatureCollection",m=f==="Feature",y=p?e.features.length:1,g=0;g<y;g++){l=p?e.features[g].geometry:m?e.geometry:e,d=l?l.type==="GeometryCollection":!1,a=d?l.geometries.length:1;for(var v=0;v<a;v++){var S=0,E=0;if(s=d?l.geometries[v]:l,s!==null){c=s.coordinates;var C=s.type;switch(u=0,C){case null:break;case"Point":if(t(c,h,g,S,E)===!1)return!1;h++,S++;break;case"LineString":case"MultiPoint":for(i=0;i<c.length;i++){if(t(c[i],h,g,S,E)===!1)return!1;h++,C==="MultiPoint"&&S++}C==="LineString"&&S++;break;case"Polygon":case"MultiLineString":for(i=0;i<c.length;i++){for(r=0;r<c[i].length-u;r++){if(t(c[i][r],h,g,S,E)===!1)return!1;h++}C==="MultiLineString"&&S++,C==="Polygon"&&E++}C==="Polygon"&&S++;break;case"MultiPolygon":for(i=0;i<c.length;i++){for(E=0,r=0;r<c[i].length;r++){for(o=0;o<c[i][r].length-u;o++){if(t(c[i][r][o],h,g,S,E)===!1)return!1;h++}E++}S++}break;case"GeometryCollection":for(i=0;i<s.geometries.length;i++)if(YM(s.geometries[i],t)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function HM(e,t){if(e.type==="Feature")t(e,0);else if(e.type==="FeatureCollection")for(var n=0;n<e.features.length&&t(e.features[n],n)!==!1;n++);}function Ire(e,t){var n,i,r,o,s,a,c,l,u,h,d=0,f=e.type==="FeatureCollection",p=e.type==="Feature",m=f?e.features.length:1;for(n=0;n<m;n++){for(a=f?e.features[n].geometry:p?e.geometry:e,l=f?e.features[n].properties:p?e.properties:{},u=f?e.features[n].bbox:p?e.bbox:void 0,h=f?e.features[n].id:p?e.id:void 0,c=a?a.type==="GeometryCollection":!1,s=c?a.geometries.length:1,r=0;r<s;r++){if(o=c?a.geometries[r]:a,o===null){if(t(null,d,l,u,h)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(o,d,l,u,h)===!1)return!1;break}case"GeometryCollection":{for(i=0;i<o.geometries.length;i++)if(t(o.geometries[i],d,l,u,h)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}d++}}function rf(e,t){Ire(e,function(n,i,r,o,s){var a=n===null?null:n.type;switch(a){case null:case"Point":case"LineString":case"Polygon":return t(gl(n,r,{bbox:o,id:s}),i,0)===!1?!1:void 0}var c;switch(a){case"MultiPoint":c="Point";break;case"MultiLineString":c="LineString";break;case"MultiPolygon":c="Polygon";break}for(var l=0;l<n.coordinates.length;l++){var u=n.coordinates[l],h={type:c,coordinates:u};if(t(gl(h,r),i,l)===!1)return!1}})}function Bm(e){var t=[1/0,1/0,-1/0,-1/0];return YM(e,function(n){t[0]>n[0]&&(t[0]=n[0]),t[1]>n[1]&&(t[1]=n[1]),t[2]<n[0]&&(t[2]=n[0]),t[3]<n[1]&&(t[3]=n[1])}),t}Bm.default=Bm;function Mre(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if(e.type==="Feature"&&e.geometry!==null&&e.geometry.type==="Point")return e.geometry.coordinates;if(e.type==="Point")return e.coordinates}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return e;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function of(e){if(Array.isArray(e))return e;if(e.type==="Feature"){if(e.geometry!==null)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Ym(e){return e.type==="Feature"?e.geometry:e}function sf(e,t,n){if(n===void 0&&(n={}),!e)throw new Error("point is required");if(!t)throw new Error("polygon is required");var i=Mre(e),r=Ym(t),o=r.type,s=t.bbox,a=r.coordinates;if(s&&Lre(i,s)===!1)return!1;o==="Polygon"&&(a=[a]);for(var c=!1,l=0;l<a.length&&!c;l++)if(jM(i,a[l][0],n.ignoreBoundary)){for(var u=!1,h=1;h<a[l].length&&!u;)jM(i,a[l][h],!n.ignoreBoundary)&&(u=!0),h++;u||(c=!0)}return c}function jM(e,t,n){var i=!1;t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]&&(t=t.slice(0,t.length-1));for(var r=0,o=t.length-1;r<t.length;o=r++){var s=t[r][0],a=t[r][1],c=t[o][0],l=t[o][1],u=e[1]*(s-c)+a*(c-e[0])+l*(e[0]-s)===0&&(s-e[0])*(c-e[0])<=0&&(a-e[1])*(l-e[1])<=0;if(u)return!n;var h=a>e[1]!=l>e[1]&&e[0]<(c-s)*(e[1]-a)/(l-a)+s;h&&(i=!i)}return i}function Lre(e,t){return t[0]<=e[0]&&t[1]<=e[1]&&t[2]>=e[0]&&t[3]>=e[1]}function KM(e){if(!e)throw new Error("geojson is required");var t=[];return rf(e,function(n){Pre(n,t)}),Wm(t)}function Pre(e,t){var n=[],i=e.geometry;if(i!==null){switch(i.type){case"Polygon":n=of(i);break;case"LineString":n=[of(i)]}n.forEach(function(r){var o=Ore(r,e.properties);o.forEach(function(s){s.id=t.length,t.push(s)})})}}function Ore(e,t){var n=[];return e.reduce(function(i,r){var o=WM([i,r],t);return o.bbox=Gre(i,r),n.push(o),r}),n}function Gre(e,t){var n=e[0],i=e[1],r=t[0],o=t[1],s=n<r?n:r,a=i<o?i:o,c=n>r?n:r,l=i>o?i:o;return[s,a,c,l]}var Lv={exports:{}};function Vre(e,t,n,i,r){JM(e,t,n||0,i||e.length-1,r||Fre)}function JM(e,t,n,i,r){for(;i>n;){if(i-n>600){var o=i-n+1,s=t-n+1,a=Math.log(o),c=.5*Math.exp(2*a/3),l=.5*Math.sqrt(a*c*(o-c)/o)*(s-o/2<0?-1:1),u=Math.max(n,Math.floor(t-s*c/o+l)),h=Math.min(i,Math.floor(t+(o-s)*c/o+l));JM(e,t,u,h,r)}var d=e[t],f=n,p=i;for(af(e,n,t),r(e[i],d)>0&&af(e,n,i);f<p;){for(af(e,f,p),f++,p--;r(e[f],d)<0;)f++;for(;r(e[p],d)>0;)p--}r(e[n],d)===0?af(e,n,p):(p++,af(e,p,i)),p<=t&&(n=p+1),t<=p&&(i=p-1)}}function af(e,t,n){var i=e[t];e[t]=e[n],e[n]=i}function Fre(e,t){return e<t?-1:e>t?1:0}let Are=class{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let n=this.data;const i=[];if(!jm(t,n))return i;const r=this.toBBox,o=[];for(;n;){for(let s=0;s<n.children.length;s++){const a=n.children[s],c=n.leaf?r(a):a;jm(t,c)&&(n.leaf?i.push(a):Ov(t,c)?this._all(a,i):o.push(a))}n=o.pop()}return i}collides(t){let n=this.data;if(!jm(t,n))return!1;const i=[];for(;n;){for(let r=0;r<n.children.length;r++){const o=n.children[r],s=n.leaf?this.toBBox(o):o;if(jm(t,s)){if(n.leaf||Ov(t,s))return!0;i.push(o)}}n=i.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let i=0;i<t.length;i++)this.insert(t[i]);return this}let n=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=n;else if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){const i=this.data;this.data=n,n=i}this._insert(n,this.data.height-n.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=Uu([]),this}remove(t,n){if(!t)return this;let i=this.data;const r=this.toBBox(t),o=[],s=[];let a,c,l;for(;i||o.length;){if(i||(i=o.pop(),c=o[o.length-1],a=s.pop(),l=!0),i.leaf){const u=zre(t,i.children,n);if(u!==-1)return i.children.splice(u,1),o.push(i),this._condense(o),this}!l&&!i.leaf&&Ov(i,r)?(o.push(i),s.push(a),a=0,c=i,i=i.children[0]):c?(a++,i=c.children[a],l=!1):i=null}return this}toBBox(t){return t}compareMinX(t,n){return t.minX-n.minX}compareMinY(t,n){return t.minY-n.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,n){const i=[];for(;t;)t.leaf?n.push(...t.children):i.push(...t.children),t=i.pop();return n}_build(t,n,i,r){const o=i-n+1;let s=this._maxEntries,a;if(o<=s)return a=Uu(t.slice(n,i+1)),Du(a,this.toBBox),a;r||(r=Math.ceil(Math.log(o)/Math.log(s)),s=Math.ceil(o/Math.pow(s,r-1))),a=Uu([]),a.leaf=!1,a.height=r;const c=Math.ceil(o/s),l=c*Math.ceil(Math.sqrt(s));QM(t,n,i,l,this.compareMinX);for(let u=n;u<=i;u+=l){const h=Math.min(u+l-1,i);QM(t,u,h,c,this.compareMinY);for(let d=u;d<=h;d+=c){const f=Math.min(d+c-1,h);a.children.push(this._build(t,d,f,r-1))}}return Du(a,this.toBBox),a}_chooseSubtree(t,n,i,r){for(;r.push(n),!(n.leaf||r.length-1===i);){let o=1/0,s=1/0,a;for(let c=0;c<n.children.length;c++){const l=n.children[c],u=Pv(l),h=Xre(t,l)-u;h<s?(s=h,o=u<o?u:o,a=l):h===s&&u<o&&(o=u,a=l)}n=a||n.children[0]}return n}_insert(t,n,i){const r=i?t:this.toBBox(t),o=[],s=this._chooseSubtree(r,this.data,n,o);for(s.children.push(t),lf(s,r);n>=0&&o[n].children.length>this._maxEntries;)this._split(o,n),n--;this._adjustParentBBoxes(r,o,n)}_split(t,n){const i=t[n],r=i.children.length,o=this._minEntries;this._chooseSplitAxis(i,o,r);const s=this._chooseSplitIndex(i,o,r),a=Uu(i.children.splice(s,i.children.length-s));a.height=i.height,a.leaf=i.leaf,Du(i,this.toBBox),Du(a,this.toBBox),n?t[n-1].children.push(a):this._splitRoot(i,a)}_splitRoot(t,n){this.data=Uu([t,n]),this.data.height=t.height+1,this.data.leaf=!1,Du(this.data,this.toBBox)}_chooseSplitIndex(t,n,i){let r,o=1/0,s=1/0;for(let a=n;a<=i-n;a++){const c=cf(t,0,a,this.toBBox),l=cf(t,a,i,this.toBBox),u=Zre(c,l),h=Pv(c)+Pv(l);u<o?(o=u,r=a,s=h<s?h:s):u===o&&h<s&&(s=h,r=a)}return r||i-n}_chooseSplitAxis(t,n,i){const r=t.leaf?this.compareMinX:Nre,o=t.leaf?this.compareMinY:kre,s=this._allDistMargin(t,n,i,r),a=this._allDistMargin(t,n,i,o);s<a&&t.children.sort(r)}_allDistMargin(t,n,i,r){t.children.sort(r);const o=this.toBBox,s=cf(t,0,n,o),a=cf(t,i-n,i,o);let c=Hm(s)+Hm(a);for(let l=n;l<i-n;l++){const u=t.children[l];lf(s,t.leaf?o(u):u),c+=Hm(s)}for(let l=i-n-1;l>=n;l--){const u=t.children[l];lf(a,t.leaf?o(u):u),c+=Hm(a)}return c}_adjustParentBBoxes(t,n,i){for(let r=i;r>=0;r--)lf(n[r],t)}_condense(t){for(let n=t.length-1,i;n>=0;n--)t[n].children.length===0?n>0?(i=t[n-1].children,i.splice(i.indexOf(t[n]),1)):this.clear():Du(t[n],this.toBBox)}};function zre(e,t,n){if(!n)return t.indexOf(e);for(let i=0;i<t.length;i++)if(n(e,t[i]))return i;return-1}function Du(e,t){cf(e,0,e.children.length,t,e)}function cf(e,t,n,i,r){r||(r=Uu(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let o=t;o<n;o++){const s=e.children[o];lf(r,e.leaf?i(s):s)}return r}function lf(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function Nre(e,t){return e.minX-t.minX}function kre(e,t){return e.minY-t.minY}function Pv(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function Hm(e){return e.maxX-e.minX+(e.maxY-e.minY)}function Xre(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function Zre(e,t){const n=Math.max(e.minX,t.minX),i=Math.max(e.minY,t.minY),r=Math.min(e.maxX,t.maxX),o=Math.min(e.maxY,t.maxY);return Math.max(0,r-n)*Math.max(0,o-i)}function Ov(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function jm(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function Uu(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function QM(e,t,n,i,r){const o=[t,n];for(;o.length;){if(n=o.pop(),t=o.pop(),n-t<=i)continue;const s=t+Math.ceil((n-t)/i/2)*i;Vre(e,s,t,n,r),o.push(t,s,s,n)}}var Gv={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.earthRadius=63710088e-1,e.factors={centimeters:e.earthRadius*100,centimetres:e.earthRadius*100,degrees:e.earthRadius/111325,feet:e.earthRadius*3.28084,inches:e.earthRadius*39.37,kilometers:e.earthRadius/1e3,kilometres:e.earthRadius/1e3,meters:e.earthRadius,metres:e.earthRadius,miles:e.earthRadius/1609.344,millimeters:e.earthRadius*1e3,millimetres:e.earthRadius*1e3,nauticalmiles:e.earthRadius/1852,radians:1,yards:e.earthRadius*1.0936},e.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/e.earthRadius,yards:1.0936133},e.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function t(k,P,w){w===void 0&&(w={});var x={type:"Feature"};return(w.id===0||w.id)&&(x.id=w.id),w.bbox&&(x.bbox=w.bbox),x.properties=P||{},x.geometry=k,x}e.feature=t;function n(k,P,w){switch(k){case"Point":return i(P).geometry;case"LineString":return a(P).geometry;case"Polygon":return o(P).geometry;case"MultiPoint":return h(P).geometry;case"MultiLineString":return u(P).geometry;case"MultiPolygon":return d(P).geometry;default:throw new Error(k+" is invalid")}}e.geometry=n;function i(k,P,w){if(w===void 0&&(w={}),!k)throw new Error("coordinates is required");if(!Array.isArray(k))throw new Error("coordinates must be an Array");if(k.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!V(k[0])||!V(k[1]))throw new Error("coordinates must contain numbers");var x={type:"Point",coordinates:k};return t(x,P,w)}e.point=i;function r(k,P,w){return w===void 0&&(w={}),l(k.map(function(x){return i(x,P)}),w)}e.points=r;function o(k,P,w){w===void 0&&(w={});for(var x=0,I=k;x<I.length;x++){var X=I[x];if(X.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var D=0;D<X[X.length-1].length;D++)if(X[X.length-1][D]!==X[0][D])throw new Error("First and last Position are not equivalent.")}var Y={type:"Polygon",coordinates:k};return t(Y,P,w)}e.polygon=o;function s(k,P,w){return w===void 0&&(w={}),l(k.map(function(x){return o(x,P)}),w)}e.polygons=s;function a(k,P,w){if(w===void 0&&(w={}),k.length<2)throw new Error("coordinates must be an array of two or more positions");var x={type:"LineString",coordinates:k};return t(x,P,w)}e.lineString=a;function c(k,P,w){return w===void 0&&(w={}),l(k.map(function(x){return a(x,P)}),w)}e.lineStrings=c;function l(k,P){P===void 0&&(P={});var w={type:"FeatureCollection"};return P.id&&(w.id=P.id),P.bbox&&(w.bbox=P.bbox),w.features=k,w}e.featureCollection=l;function u(k,P,w){w===void 0&&(w={});var x={type:"MultiLineString",coordinates:k};return t(x,P,w)}e.multiLineString=u;function h(k,P,w){w===void 0&&(w={});var x={type:"MultiPoint",coordinates:k};return t(x,P,w)}e.multiPoint=h;function d(k,P,w){w===void 0&&(w={});var x={type:"MultiPolygon",coordinates:k};return t(x,P,w)}e.multiPolygon=d;function f(k,P,w){w===void 0&&(w={});var x={type:"GeometryCollection",geometries:k};return t(x,P,w)}e.geometryCollection=f;function p(k,P){if(P===void 0&&(P=0),P&&!(P>=0))throw new Error("precision must be a positive number");var w=Math.pow(10,P||0);return Math.round(k*w)/w}e.round=p;function m(k,P){P===void 0&&(P="kilometers");var w=e.factors[P];if(!w)throw new Error(P+" units is invalid");return k*w}e.radiansToLength=m;function y(k,P){P===void 0&&(P="kilometers");var w=e.factors[P];if(!w)throw new Error(P+" units is invalid");return k/w}e.lengthToRadians=y;function g(k,P){return S(y(k,P))}e.lengthToDegrees=g;function v(k){var P=k%360;return P<0&&(P+=360),P}e.bearingToAzimuth=v;function S(k){var P=k%(2*Math.PI);return P*180/Math.PI}e.radiansToDegrees=S;function E(k){var P=k%360;return P*Math.PI/180}e.degreesToRadians=E;function C(k,P,w){if(P===void 0&&(P="kilometers"),w===void 0&&(w="kilometers"),!(k>=0))throw new Error("length must be a positive number");return m(y(k,P),w)}e.convertLength=C;function O(k,P,w){if(P===void 0&&(P="meters"),w===void 0&&(w="kilometers"),!(k>=0))throw new Error("area must be a positive number");var x=e.areaFactors[P];if(!x)throw new Error("invalid original units");var I=e.areaFactors[w];if(!I)throw new Error("invalid final units");return k/x*I}e.convertArea=O;function V(k){return!isNaN(k)&&k!==null&&!Array.isArray(k)}e.isNumber=V;function A(k){return!!k&&k.constructor===Object}e.isObject=A;function G(k){if(!k)throw new Error("bbox is required");if(!Array.isArray(k))throw new Error("bbox must be an Array");if(k.length!==4&&k.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");k.forEach(function(P){if(!V(P))throw new Error("bbox must only contain numbers")})}e.validateBBox=G;function N(k){if(!k)throw new Error("id is required");if(["string","number"].indexOf(typeof k)===-1)throw new Error("id must be a number or a string")}e.validateId=N})(Gv);var ni={};Object.defineProperty(ni,"__esModule",{value:!0});var Wi=Gv;function uf(e,t,n){if(e!==null)for(var i,r,o,s,a,c,l,u=0,h=0,d,f=e.type,p=f==="FeatureCollection",m=f==="Feature",y=p?e.features.length:1,g=0;g<y;g++){l=p?e.features[g].geometry:m?e.geometry:e,d=l?l.type==="GeometryCollection":!1,a=d?l.geometries.length:1;for(var v=0;v<a;v++){var S=0,E=0;if(s=d?l.geometries[v]:l,s!==null){c=s.coordinates;var C=s.type;switch(u=n&&(C==="Polygon"||C==="MultiPolygon")?1:0,C){case null:break;case"Point":if(t(c,h,g,S,E)===!1)return!1;h++,S++;break;case"LineString":case"MultiPoint":for(i=0;i<c.length;i++){if(t(c[i],h,g,S,E)===!1)return!1;h++,C==="MultiPoint"&&S++}C==="LineString"&&S++;break;case"Polygon":case"MultiLineString":for(i=0;i<c.length;i++){for(r=0;r<c[i].length-u;r++){if(t(c[i][r],h,g,S,E)===!1)return!1;h++}C==="MultiLineString"&&S++,C==="Polygon"&&E++}C==="Polygon"&&S++;break;case"MultiPolygon":for(i=0;i<c.length;i++){for(E=0,r=0;r<c[i].length;r++){for(o=0;o<c[i][r].length-u;o++){if(t(c[i][r][o],h,g,S,E)===!1)return!1;h++}E++}S++}break;case"GeometryCollection":for(i=0;i<s.geometries.length;i++)if(uf(s.geometries[i],t,n)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Dre(e,t,n,i){var r=n;return uf(e,function(o,s,a,c,l){s===0&&n===void 0?r=o:r=t(r,o,s,a,c,l)},i),r}function qM(e,t){var n;switch(e.type){case"FeatureCollection":for(n=0;n<e.features.length&&t(e.features[n].properties,n)!==!1;n++);break;case"Feature":t(e.properties,0);break}}function Ure(e,t,n){var i=n;return qM(e,function(r,o){o===0&&n===void 0?i=r:i=t(i,r,o)}),i}function $M(e,t){if(e.type==="Feature")t(e,0);else if(e.type==="FeatureCollection")for(var n=0;n<e.features.length&&t(e.features[n],n)!==!1;n++);}function Wre(e,t,n){var i=n;return $M(e,function(r,o){o===0&&n===void 0?i=r:i=t(i,r,o)}),i}function Bre(e){var t=[];return uf(e,function(n){t.push(n)}),t}function Vv(e,t){var n,i,r,o,s,a,c,l,u,h,d=0,f=e.type==="FeatureCollection",p=e.type==="Feature",m=f?e.features.length:1;for(n=0;n<m;n++){for(a=f?e.features[n].geometry:p?e.geometry:e,l=f?e.features[n].properties:p?e.properties:{},u=f?e.features[n].bbox:p?e.bbox:void 0,h=f?e.features[n].id:p?e.id:void 0,c=a?a.type==="GeometryCollection":!1,s=c?a.geometries.length:1,r=0;r<s;r++){if(o=c?a.geometries[r]:a,o===null){if(t(null,d,l,u,h)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(o,d,l,u,h)===!1)return!1;break}case"GeometryCollection":{for(i=0;i<o.geometries.length;i++)if(t(o.geometries[i],d,l,u,h)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}d++}}function Yre(e,t,n){var i=n;return Vv(e,function(r,o,s,a,c){o===0&&n===void 0?i=r:i=t(i,r,o,s,a,c)}),i}function Km(e,t){Vv(e,function(n,i,r,o,s){var a=n===null?null:n.type;switch(a){case null:case"Point":case"LineString":case"Polygon":return t(Wi.feature(n,r,{bbox:o,id:s}),i,0)===!1?!1:void 0}var c;switch(a){case"MultiPoint":c="Point";break;case"MultiLineString":c="LineString";break;case"MultiPolygon":c="Polygon";break}for(var l=0;l<n.coordinates.length;l++){var u=n.coordinates[l],h={type:c,coordinates:u};if(t(Wi.feature(h,r),i,l)===!1)return!1}})}function Hre(e,t,n){var i=n;return Km(e,function(r,o,s){o===0&&s===0&&n===void 0?i=r:i=t(i,r,o,s)}),i}function e5(e,t){Km(e,function(n,i,r){var o=0;if(n.geometry){var s=n.geometry.type;if(!(s==="Point"||s==="MultiPoint")){var a,c=0,l=0,u=0;if(uf(n,function(h,d,f,p,m){if(a===void 0||i>c||p>l||m>u){a=h,c=i,l=p,u=m,o=0;return}var y=Wi.lineString([a,h],n.properties);if(t(y,i,r,m,o)===!1)return!1;o++,a=h})===!1)return!1}}})}function jre(e,t,n){var i=n,r=!1;return e5(e,function(o,s,a,c,l){r===!1&&n===void 0?i=o:i=t(i,o,s,a,c,l),r=!0}),i}function t5(e,t){if(!e)throw new Error("geojson is required");Km(e,function(n,i,r){if(n.geometry!==null){var o=n.geometry.type,s=n.geometry.coordinates;switch(o){case"LineString":if(t(n,i,r,0,0)===!1)return!1;break;case"Polygon":for(var a=0;a<s.length;a++)if(t(Wi.lineString(s[a],n.properties),i,r,a)===!1)return!1;break}}})}function Kre(e,t,n){var i=n;return t5(e,function(r,o,s,a){o===0&&n===void 0?i=r:i=t(i,r,o,s,a)}),i}function Jre(e,t){if(t=t||{},!Wi.isObject(t))throw new Error("options is invalid");var n=t.featureIndex||0,i=t.multiFeatureIndex||0,r=t.geometryIndex||0,o=t.segmentIndex||0,s=t.properties,a;switch(e.type){case"FeatureCollection":n<0&&(n=e.features.length+n),s=s||e.features[n].properties,a=e.features[n].geometry;break;case"Feature":s=s||e.properties,a=e.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":a=e;break;default:throw new Error("geojson is invalid")}if(a===null)return null;var c=a.coordinates;switch(a.type){case"Point":case"MultiPoint":return null;case"LineString":return o<0&&(o=c.length+o-1),Wi.lineString([c[o],c[o+1]],s,t);case"Polygon":return r<0&&(r=c.length+r),o<0&&(o=c[r].length+o-1),Wi.lineString([c[r][o],c[r][o+1]],s,t);case"MultiLineString":return i<0&&(i=c.length+i),o<0&&(o=c[i].length+o-1),Wi.lineString([c[i][o],c[i][o+1]],s,t);case"MultiPolygon":return i<0&&(i=c.length+i),r<0&&(r=c[i].length+r),o<0&&(o=c[i][r].length-o-1),Wi.lineString([c[i][r][o],c[i][r][o+1]],s,t)}throw new Error("geojson is invalid")}function Qre(e,t){if(t=t||{},!Wi.isObject(t))throw new Error("options is invalid");var n=t.featureIndex||0,i=t.multiFeatureIndex||0,r=t.geometryIndex||0,o=t.coordIndex||0,s=t.properties,a;switch(e.type){case"FeatureCollection":n<0&&(n=e.features.length+n),s=s||e.features[n].properties,a=e.features[n].geometry;break;case"Feature":s=s||e.properties,a=e.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":a=e;break;default:throw new Error("geojson is invalid")}if(a===null)return null;var c=a.coordinates;switch(a.type){case"Point":return Wi.point(c,s,t);case"MultiPoint":return i<0&&(i=c.length+i),Wi.point(c[i],s,t);case"LineString":return o<0&&(o=c.length+o),Wi.point(c[o],s,t);case"Polygon":return r<0&&(r=c.length+r),o<0&&(o=c[r].length+o),Wi.point(c[r][o],s,t);case"MultiLineString":return i<0&&(i=c.length+i),o<0&&(o=c[i].length+o),Wi.point(c[i][o],s,t);case"MultiPolygon":return i<0&&(i=c.length+i),r<0&&(r=c[i].length+r),o<0&&(o=c[i][r].length-o),Wi.point(c[i][r][o],s,t)}throw new Error("geojson is invalid")}ni.coordAll=Bre,ni.coordEach=uf,ni.coordReduce=Dre,ni.featureEach=$M,ni.featureReduce=Wre,ni.findPoint=Qre,ni.findSegment=Jre,ni.flattenEach=Km,ni.flattenReduce=Hre,ni.geomEach=Vv,ni.geomReduce=Yre,ni.lineEach=t5,ni.lineReduce=Kre,ni.propEach=qM,ni.propReduce=Ure,ni.segmentEach=e5,ni.segmentReduce=jre;var Fv={};Object.defineProperty(Fv,"__esModule",{value:!0});var qre=ni;function Av(e){var t=[1/0,1/0,-1/0,-1/0];return qre.coordEach(e,function(n){t[0]>n[0]&&(t[0]=n[0]),t[1]>n[1]&&(t[1]=n[1]),t[2]<n[0]&&(t[2]=n[0]),t[3]<n[1]&&(t[3]=n[1])}),t}Av.default=Av,Fv.default=Av;var Ms=Are,n5=Gv,i5=ni,Wu=Fv.default,$re=i5.featureEach;i5.coordEach,n5.polygon;var r5=n5.featureCollection;function o5(e){var t=new Ms(e);return t.insert=function(n){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:Wu(n),Ms.prototype.insert.call(this,n)},t.load=function(n){var i=[];return Array.isArray(n)?n.forEach(function(r){if(r.type!=="Feature")throw new Error("invalid features");r.bbox=r.bbox?r.bbox:Wu(r),i.push(r)}):$re(n,function(r){if(r.type!=="Feature")throw new Error("invalid features");r.bbox=r.bbox?r.bbox:Wu(r),i.push(r)}),Ms.prototype.load.call(this,i)},t.remove=function(n,i){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:Wu(n),Ms.prototype.remove.call(this,n,i)},t.clear=function(){return Ms.prototype.clear.call(this)},t.search=function(n){var i=Ms.prototype.search.call(this,this.toBBox(n));return r5(i)},t.collides=function(n){return Ms.prototype.collides.call(this,this.toBBox(n))},t.all=function(){var n=Ms.prototype.all.call(this);return r5(n)},t.toJSON=function(){return Ms.prototype.toJSON.call(this)},t.fromJSON=function(n){return Ms.prototype.fromJSON.call(this,n)},t.toBBox=function(n){var i;if(n.bbox)i=n.bbox;else if(Array.isArray(n)&&n.length===4)i=n;else if(Array.isArray(n)&&n.length===6)i=[n[0],n[1],n[3],n[4]];else if(n.type==="Feature")i=Wu(n);else if(n.type==="FeatureCollection")i=Wu(n);else throw new Error("invalid geojson");return{minX:i[0],minY:i[1],maxX:i[2],maxY:i[3]}},t}Lv.exports=o5,Lv.exports.default=o5;function zv(e,t){var n={},i=[];if(e.type==="LineString"&&(e=gl(e)),t.type==="LineString"&&(t=gl(t)),e.type==="Feature"&&t.type==="Feature"&&e.geometry!==null&&t.geometry!==null&&e.geometry.type==="LineString"&&t.geometry.type==="LineString"&&e.geometry.coordinates.length===2&&t.geometry.coordinates.length===2){var r=s5(e,t);return r&&i.push(r),Wm(i)}var o=Lv.exports();return o.load(KM(t)),HM(KM(e),function(s){HM(o.search(s),function(a){var c=s5(s,a);if(c){var l=of(c).join(",");n[l]||(n[l]=!0,i.push(c))}})}),Wm(i)}function s5(e,t){var n=of(e),i=of(t);if(n.length!==2)throw new Error("<intersects> line1 must only contain 2 coordinates");if(i.length!==2)throw new Error("<intersects> line2 must only contain 2 coordinates");var r=n[0][0],o=n[0][1],s=n[1][0],a=n[1][1],c=i[0][0],l=i[0][1],u=i[1][0],h=i[1][1],d=(h-l)*(s-r)-(u-c)*(a-o),f=(u-c)*(o-l)-(h-l)*(r-c),p=(s-r)*(o-l)-(a-o)*(r-c);if(d===0)return null;var m=f/d,y=p/d;if(m>=0&&m<=1&&y>=0&&y<=1){var g=r+m*(s-r),v=o+m*(a-o);return Cre([g,v])}return null}function Nv(e,t){t===void 0&&(t={});var n=Ym(e);switch(!t.properties&&e.type==="Feature"&&(t.properties=e.properties),n.type){case"Polygon":return eoe(n,t);case"MultiPolygon":return toe(n,t);default:throw new Error("invalid poly")}}function eoe(e,t){t===void 0&&(t={});var n=Ym(e),i=n.coordinates,r=t.properties?t.properties:e.type==="Feature"?e.properties:{};return a5(i,r)}function toe(e,t){t===void 0&&(t={});var n=Ym(e),i=n.coordinates,r=t.properties?t.properties:e.type==="Feature"?e.properties:{},o=[];return i.forEach(function(s){o.push(a5(s,r))}),Wm(o)}function a5(e,t){return e.length>1?Rre(e,t):WM(e[0],t)}function noe(e,t){var n=!0;return rf(e,function(i){rf(t,function(r){if(n===!1)return!1;n=ioe(i.geometry,r.geometry)})}),n}function ioe(e,t){switch(e.type){case"Point":switch(t.type){case"Point":return!aoe(e.coordinates,t.coordinates);case"LineString":return!c5(t,e);case"Polygon":return!sf(e,t)}break;case"LineString":switch(t.type){case"Point":return!c5(e,t);case"LineString":return!roe(e,t);case"Polygon":return!l5(t,e)}break;case"Polygon":switch(t.type){case"Point":return!sf(t,e);case"LineString":return!l5(e,t);case"Polygon":return!ooe(t,e)}}return!1}function c5(e,t){for(var n=0;n<e.coordinates.length-1;n++)if(soe(e.coordinates[n],e.coordinates[n+1],t.coordinates))return!0;return!1}function roe(e,t){var n=zv(e,t);return n.features.length>0}function l5(e,t){for(var n=0,i=t.coordinates;n<i.length;n++){var r=i[n];if(sf(r,e))return!0}var o=zv(t,Nv(e));return o.features.length>0}function ooe(e,t){for(var n=0,i=e.coordinates[0];n<i.length;n++){var r=i[n];if(sf(r,t))return!0}for(var o=0,s=t.coordinates[0];o<s.length;o++){var a=s[o];if(sf(a,e))return!0}var c=zv(Nv(e),Nv(t));return c.features.length>0}function soe(e,t,n){var i=n[0]-e[0],r=n[1]-e[1],o=t[0]-e[0],s=t[1]-e[1],a=i*s-r*o;return a!==0?!1:Math.abs(o)>=Math.abs(s)?o>0?e[0]<=n[0]&&n[0]<=t[0]:t[0]<=n[0]&&n[0]<=e[0]:s>0?e[1]<=n[1]&&n[1]<=t[1]:t[1]<=n[1]&&n[1]<=e[1]}function aoe(e,t){return e[0]===t[0]&&e[1]===t[1]}function u5(e,t){var n=!1;return rf(e,function(i){rf(t,function(r){if(n===!0)return!0;n=!noe(i.geometry,r.geometry)})}),n}const coe=Math.PI/180,kv=28;function loe(e){for(let t=0;t<kv;t++){const n=1<<32-(t+1);if((e[0]&n)!==(e[2]&n)||(e[1]&n)!==(e[3]&n))return t}return kv}function uoe(e,t){const n=Jm(e[0],e[1],32),i=Jm(e[2],e[3],32),r=[n[0],n[1],i[0],i[1]],o=Math.min(loe(r),typeof t<"u"?t:kv);if(o===0)return[0,0,0];const s=r[0]>>>32-o,a=r[1]>>>32-o;return[s,a,o]}function Jm(e,t,n){var i=hoe(e,t,n);return i[0]=Math.floor(i[0]),i[1]=Math.floor(i[1]),i}function hoe(e,t,n){var i=Math.sin(t*coe),r=Math.pow(2,n),o=r*(e/360+.5),s=r*(.5-.25*Math.log((1+i)/(1-i))/Math.PI);return o=o%r,o<0&&(o=o+r),[o,s,n]}function doe(e,t,n,i){let r=poe(e,t,n);return boe(r,i)}function foe(e,t){const n=_oe(e,t);return moe(n)}function poe(e,t,n){let i=0n;return i=Xv(e)|Xv(t)<<1n|Xv(n)<<2n,i}function moe(e){let t=Zv(e),n=Zv(e>>1n),i=Zv(e>>2n);return[t,n,i]}function Xv(e){let t=BigInt(e)&BigInt("0x3ffffffffff");return t=(t|t<<64n)&BigInt("0x3ff0000000000000000ffffffff"),t=(t|t<<32n)&BigInt("0x3ff00000000ffff00000000ffff"),t=(t|t<<16n)&BigInt("0x30000ff0000ff0000ff0000ff0000ff"),t=(t|t<<8n)&BigInt("0x300f00f00f00f00f00f00f00f00f00f"),t=(t|t<<4n)&BigInt("0x30c30c30c30c30c30c30c30c30c30c3"),t=(t|t<<2n)&BigInt("0x9249249249249249249249249249249"),t}function Zv(e){let t=e&BigInt("0x9249249249249249249249249249249");return t=(t|t>>2n)&BigInt("0x30c30c30c30c30c30c30c30c30c30c3"),t=(t|t>>4n)&BigInt("0x300f00f00f00f00f00f00f00f00f00f"),t=(t|t>>8n)&BigInt("0x30000ff0000ff0000ff0000ff0000ff"),t=(t|t>>16n)&BigInt("0x3ff00000000ffff00000000ffff"),t=(t|t>>32n)&BigInt("0x3ff0000000000000000ffffffff"),t=(t|t>>64n)&BigInt("0x3ffffffffff"),Number(t)}const goe=[48,33,27,34,47,78,28,77,66,29,51,52,65,30,72,63,76,95,75,24,53,54,82,81,18,3,17,80,61,4,62,15,0,59,71,60,49,50,86,85,84,83,5,90,79,56,6,89,32,23,1,94,11,12,2,93,42,41,13,14,35,88,36,31,92,37,87,38,91,74,8,73,46,45,9,10,7,20,64,19,70,25,39,16,69,26,44,43,22,55,21,68,57,40,58,67],yoe=[48,33,35,26,30,79,77,44,78,68,64,50,51,25,29,63,27,87,86,74,72,52,53,89,83,18,16,1,5,60,62,15,0,52,53,57,59,87,86,66,61,95,91,81,80,2,6,76,32,2,6,12,13,95,91,17,93,41,40,36,38,10,11,31,14,79,77,92,88,33,35,82,70,10,11,23,21,41,40,4,19,25,29,47,46,68,64,34,45,60,62,71,67,18,16,49];function h5(e,t,n){let i=0,r=0n;for(let o=3*(t-1);o>=0;o-=3)i=n[i|Number(e>>BigInt(o)&7n)],r=r<<3n|BigInt(i&7),i&=-8;return r}function boe(e,t){return h5(e,t,goe)}function _oe(e,t){return h5(e,t,yoe)}function voe(e){const t=e.z>0?e.f+2**(e.z-1):0;return doe(e.x,e.y,t,e.z)}function woe(e,t){if(t===0)return{z:0,f:0,x:0,y:0};const[n,i,r]=foe(e,t);return{f:r-2**(t-1),x:n,y:i,z:t}}function xoe(e,t){return"H"+e.toString(8).padStart(t,"0").split("").map(n=>(parseInt(n)+1).toString()).join("")}function Soe(e){if(e[0]!=="H")return;const t=e.substring(1).split("").map(i=>(parseInt(i)-1).toString()).join(""),n=BigInt("0o"+t);return woe(n,t.length)}const Eoe=25;class Bi{constructor(t,n){if(typeof t=="string"){let i=vre(t)||Soe(t)||Ere(t);if(i)this.zfxy=i,this._regenerateAttributesFromZFXY();else throw new Error(`parse ZFXY failed with input: ${t}`);return}else if(bre(t)){this.zfxy=t,this._regenerateAttributesFromZFXY();return}else this.zfxy=Sre({...t,zoom:typeof n<"u"?n:Eoe});this._regenerateAttributesFromZFXY()}up(t=1){return this.move({f:t})}down(t=1){return this.move({f:-t})}north(t=1){return this.move({y:t})}south(t=1){return this.move({y:-t})}east(t=1){return this.move({x:t})}west(t=1){return this.move({x:-t})}move(t){const n=new Bi(this.zfxy);return n.zfxy=Is({z:n.zfxy.z,f:n.zfxy.f+(t.f||0),x:n.zfxy.x+(t.x||0),y:n.zfxy.y+(t.y||0)}),n._regenerateAttributesFromZFXY(),n}parent(t){const n=typeof t>"u"?1:this.zfxy.z-t;return new Bi(DM(this.zfxy,n))}children(){return Um(this.zfxy).map(t=>new Bi(t))}surroundings(){return[...Iv(this.zfxy).filter(({z:t,f:n,x:i,y:r})=>`/${t}/${n}/${i}/${r}`!==this.zfxyStr).map(t=>new Bi(t)),...Iv(this.up().zfxy).map(t=>new Bi(t)),...Iv(this.down().zfxy).map(t=>new Bi(t))]}contains(t){const n=this.toGeoJSON(),i={type:"Point",coordinates:[t.lng,t.lat]},r=this.alt,o=nf({...this.zfxy,f:this.zfxy.f+1});return u5(n,i)&&(typeof t.alt<"u"?t.alt>=r&&t.alt<o:!0)}toGeoJSON(){const[t,n]=UM(this.zfxy);return{type:"Polygon",coordinates:[[[t.lng,t.lat],[t.lng,n.lat],[n.lng,n.lat],[n.lng,t.lat],[t.lng,t.lat]]]}}vertices3d(){const[t,n]=UM(this.zfxy),i=nf(this.zfxy),r=nf({...this.zfxy,f:this.zfxy.f+1});return[[t.lng,t.lat,i],[t.lng,n.lat,i],[n.lng,n.lat,i],[n.lng,t.lat,i],[t.lng,t.lat,r],[t.lng,n.lat,r],[n.lng,n.lat,r],[n.lng,t.lat,r]]}static getSpaceById(t,n){return new Bi(t,n)}static getSpaceByLocation(t,n){return new Bi(t,n)}static getSpaceByZFXY(t){return new Bi(t)}static boundingSpaceForGeometry(t,n){n=n||25;const i=Bm(t),r=uoe(i,n),[o,s,a]=r;return new Bi({x:o,y:s,z:a,f:0})}static spacesForGeometry(t,n){const i=n;if(i===0)return[new Bi("0/0/0/0")];if(t.type==="GeometryCollection")throw new Error("GeometryCollection not supported");const r=Bm(t),o=Jm(r[0],r[1],32),s=Jm(r[2],r[3],32),a=Math.min(o[0],s[0])>>>32-i,c=Math.min(o[1],s[1])>>>32-i,l=(Math.max(s[0],o[0])>>>32-i)+1,u=(Math.max(s[1],o[1])>>>32-i)+1,h=[];for(let d=a;d<=l;d++)for(let f=c;f<=u;f++){const p=new Bi({x:d,y:f,z:i,f:0});u5(t,p.toGeoJSON())&&h.push(p)}return h}_regenerateAttributesFromZFXY(){this.alt=nf(this.zfxy),this.center=xre(this.zfxy),this.zoom=this.zfxy.z,this.id=this.tilehash=Tre(this.zfxy),this.zfxyStr=`/${this.zfxy.z}/${this.zfxy.f}/${this.zfxy.x}/${this.zfxy.y}`,this.hilbertIndex=voe(this.zfxy),this.hilbertTilehash=xoe(this.hilbertIndex,this.zfxy.z)}}const Dv=e=>{const t=e.vertices3d(),n=[t[0][0],t[1][1],t[2][0],t[3][1]],i=t[0][2],r=t[4][2];return{wsen:n,height:i,extrudedHeight:r}},Qm=(e,t,n,i,r)=>{const o=new Bi({lat:t,lng:e,alt:n},i),{wsen:s,height:a,extrudedHeight:c}=Dv(o);return{id:oc(),space:o,wsen:s,height:a+r,extrudedHeight:c+r}},Toe=e=>({id:e.id,center:e.center,alt:e.alt,zoom:e.zoom,zfxy:e.zfxy,zfxyStr:e.zfxyStr,tilehash:e.tilehash,hilbertTilehash:e.hilbertTilehash,hilbertIndex:e.hilbertIndex.toString(),vertices:e.vertices3d()}),Coe=(e,t,n)=>{const i=new Bi({lat:0,lng:0,alt:e},n),r=new Bi({lat:0,lng:0,alt:t},n),{height:o}=Dv(i),{extrudedHeight:s}=Dv(r);return{top:o,bottom:s}},Roe=({ref:e,engineRef:t,geoidRef:n,terrainEnabled:i,interactionMode:r,overrideInteractionMode:o,onMount:s})=>{const[a,c]=R.useState("idle"),[l,u]=R.useState(null),[h,d]=R.useState(null),[f,p]=R.useState(null),m=R.useRef(null),[y,g]=R.useState(null),v=R.useRef(null),[S,E]=R.useState(null),[C,O]=R.useState(null),[V,A]=R.useState(yre),G=R.useMemo(()=>Coe(V.maxHeight,V.minHeight,V.zoom),[V.maxHeight,V.minHeight,V.zoom]),N=R.useMemo(()=>{const fe=[...l??[],...y?[y]:[]];if(!fe)return null;const Xe=fe.reduce((tt,nt)=>(tt.find(Z=>Z.space.zfxy.z===nt.space.zfxy.z&&Z.space.zfxy.x===nt.space.zfxy.x&&Z.space.zfxy.y===nt.space.zfxy.y)||tt.push(nt),tt),[]);return Xe.length===0?null:Xe.map(tt=>{const{wsen:nt}=tt;return{id:oc(),spaceId:tt.space.id,wsen:nt,color:V.groundIndicatorColor}})},[l,y,V.groundIndicatorColor]),k=R.useCallback(fe=>{c("coordinate"),A(Xe=>({...Xe,...fe})),o?.("spatialId"),setTimeout(()=>{t.current?.setCursor("crosshair")},100)},[t,o]),P=R.useRef(r);P.current=r;const w=R.useCallback(()=>{c("idle"),E(null),O(null),g(null),p(null),m.current=null,v.current=null,d(null),o?.(P.current==="spatialId"?"default":P.current??"default"),t.current?.setCursor("default"),t.current?.requestRender()},[o,t]),x=R.useCallback(async fe=>{if(a!=="idle"&&!Pe.current){if(a==="coordinate"){if(!f||fe.lat===void 0||fe.lng===void 0||fe.lat>Dm.max||fe.lat<Dm.min)return;c("fetchingGeoid");const{id:Xe,wsen:tt,space:nt}=Qm(fe.lng,fe.lat,0,V.zoom,0);requestAnimationFrame(()=>{t.current?.setCursor("wait")});const[Z,pe]=await Promise.all([n.current?.getGeoidHeight(fe.lng,fe.lat),n.current?.getGeoidHeight(nt.center.lng,nt.center.lat)]);if(setTimeout(()=>{t.current?.setCursor("crosshair")},100),Z===void 0&&pe===void 0){c("coordinate");return}const ue=Z??pe??0,$=pe??Z??0;v.current=$,d({id:Xe,wsen:tt,height:G.top+$,extrudedHeight:G.bottom+$,color:V.verticalSpaceIndicatorColor,outlineColor:V.verticalSpaceIndicatorOutlineColor}),O([fe.lng,fe.lat,(i?fe.height??0:0)-ue]),E(t.current?.toXYZ(fe.lng,fe.lat,fe.height??0)??null);const j=Qm(fe.lng,fe.lat,(i?fe.height??0:0)-ue,V.zoom,$);g({...j,color:V.color,outlineColor:V.outlineColor}),m.current=f,p(null),t.current?.requestRender(),c("floor")}else if(a==="floor"){if(!y)return;const Xe={...y,id:oc(),color:V.color,outlineColor:V.outlineColor};V.dataOnly||u(nt=>nt?[...nt,Xe]:[Xe]),w();const tt=Toe(Xe.space);be.current.forEach(nt=>nt(tt))}}},[a,i,t,n,y,V,G,f,w]),I=R.useCallback(fe=>{if(a!=="idle"&&!Pe.current){if(a==="coordinate"){if(fe.lat===void 0||fe.lng===void 0||fe.lat>Dm.max||fe.lat<Dm.min)return;const Xe=Qm(fe.lng,fe.lat,0,V.zoom,0);if(Xe.space.id===f?.uid)return;p({id:oc(),uid:Xe.space.id,wsen:Xe.wsen,color:V.selectorColor})}else if(a==="floor"){if(fe.x===void 0||fe.y===void 0||S===null||C===null)return;const Xe=t.current?.getExtrudedHeight(S,[fe.x,fe.y],!0)??0;if(C[2]+Xe>G.top||C[2]+Xe<G.bottom)return;const tt=Qm(C[0],C[1],C[2]+Xe,V.zoom,v.current??0);if(tt.space.id===y?.space.id)return;g({...tt,color:V.selectorColor,outlineColor:V.selectorOutlineColor})}}},[a,y,S,C,t,V,G,f?.uid]),X=R.useCallback(()=>{a!=="idle"&&(a==="coordinate"&&V.rightClickToExit?w():a==="floor"&&(g(null),E(null),O(null),d(null),p(m.current),c("coordinate"),v.current=null),t.current?.requestRender())},[a,V,t,w]),D=R.useCallback(()=>{X()},[X]);vv("keydown",fe=>{fe.code==="Escape"&&X()});const Y=R.useRef(!1),H=R.useRef(x);H.current=x;const J=R.useCallback(fe=>{H.current(fe)},[]),z=R.useRef(I);z.current=I;const W=R.useCallback(fe=>{z.current(fe)},[]),Q=R.useRef(D);Q.current=D;const q=R.useCallback(()=>{Q.current()},[]);R.useEffect(()=>{Y.current||!t.current||(Y.current=!0,t.current.onMouseUp(J),t.current.onMouseMove(W),t.current.onRightClick(q))},[t,J,W,q]);const oe=R.useRef(a);oe.current=a;const Ee=R.useRef(w);Ee.current=w,R.useEffect(()=>{Pe.current||r!=="spatialId"&&oe.current!=="idle"&&Ee.current()},[r]);const be=R.useRef([]),Ae=R.useCallback(fe=>{be.current.push(fe)},[]);R.useImperativeHandle(e,()=>({pickSpace:k,onSpacePick:Ae,exitPickSpace:w}),[k,Ae,w]);const Pe=R.useRef(!1);return R.useEffect(()=>{const fe=Xe=>{Xe.code==="Space"&&oe.current!=="idle"&&(Pe.current=!0,o?.("move"))};return window.addEventListener("keydown",fe),()=>{window.removeEventListener("keydown",fe)}},[o]),R.useEffect(()=>window.addEventListener("keyup",fe=>{fe.code==="Space"&&Pe.current&&(Pe.current=!1,o?.("spatialId"))}),[o]),R.useEffect(()=>{s?.()},[s]),{spatialIdSpaces:l,verticalSpaceIndicator:h,coordinateSelector:f,spaceSelector:y,groundIndicators:N}},Ioe=({engineRef:e,geoidRef:t,terrainEnabled:n,interactionMode:i,overrideInteractionMode:r,onMount:o},s)=>{const{spatialIdSpaces:a,verticalSpaceIndicator:c,coordinateSelector:l,spaceSelector:u,groundIndicators:h}=Roe({ref:s,engineRef:e,geoidRef:t,terrainEnabled:n,interactionMode:i,overrideInteractionMode:r,onMount:o});return ce.jsxs(ce.Fragment,{children:[a&&a.length>0&&a.map(d=>ce.jsx(Cv,{space:d},d.id)),h&&h.length>0&&h.map(d=>ce.jsx(Rv,{wsen:d.wsen,color:d.color},d.id)),c&&ce.jsx(XM,{indicator:c}),l&&ce.jsx(Rv,{wsen:l.wsen,color:l.color}),u&&ce.jsx(Cv,{space:u})]})},Moe=R.forwardRef(Ioe);var Uv={};try{Uv.EventTarget=new EventTarget().constructor}catch{(function(t,n){var i=t.create,r=t.defineProperty,o=s.prototype;a(o,"addEventListener",function(l,u,h){for(var d=n.get(this),f=d[l]||(d[l]=[]),p=0,m=f.length;p<m;p++)if(f[p].listener===u)return;f.push({target:this,listener:u,options:h})}),a(o,"dispatchEvent",function(l){var u=n.get(this),h=u[l.type];return h&&(a(l,"target",this),a(l,"currentTarget",this),h.slice(0).some(c,l),delete l.currentTarget,delete l.target),!0}),a(o,"removeEventListener",function(l,u){for(var h=n.get(this),d=h[l]||(h[l]=[]),f=0,p=d.length;f<p;f++)if(d[f].listener===u){d.splice(f,1);return}}),Uv.EventTarget=s;function s(){n.set(this,i(null))}function a(l,u,h){r(l,u,{configurable:!0,writable:!0,value:h})}function c(l){var u=l.options;return u&&u.once&&l.target.removeEventListener(this.type,l.listener),typeof l.listener=="function"?l.listener.call(l.target,this):l.listener.handleEvent(this),this._stopImmediatePropagationFlag}})(Object,new WeakMap)}const Loe=Uv.EventTarget;function Poe(){const e=new Loe,t=new Map,n=(c,l)=>{let u=t.get(c);u||(u=new Map,t.set(c,u));let h=u.get(l);return h||(h=d=>{l(...d.detail)},u.set(l,h)),h},i=(c,l)=>{t.get(c)?.delete(l)},r=(c,l)=>{const u=n(c,l);e.addEventListener(String(c),u)},o=(c,l)=>{const u=n(c,l);e.removeEventListener(String(c),u),i(c,u)},s=(c,l)=>{const u=n(c,l);e.addEventListener(String(c),u,{once:!0})};return[{get on(){return r},get off(){return o},get once(){return s}},(c,...l)=>e.dispatchEvent(new CustomEvent(String(c),{detail:l}))]}function Ooe(e,t,n){const i=n.reduce((r,o)=>({...r,[o]:(...s)=>{t(o,...s)}}),{});for(const r of Object.keys(i))e.on(r,i[r]);return()=>{for(const r of Object.keys(i))e.off(r,i[r])}}function Goe({engines:e,engine:t,isBuilt:n,isEditable:i,clusters:r,hiddenLayers:o,layers:s,overrides:a,timelineManagerRef:c,interactionMode:l,selectedFeature:u,onLayerSelect:h,overrideInteractionMode:d,onSketchTypeChange:f,onSketchFeatureCreate:p,onSketchPluginFeatureCreate:m,onSketchFeatureUpdate:y,onSketchPluginFeatureUpdate:g,onSketchFeatureDelete:v,onSketchPluginFeatureDelete:S,featureFlags:E=N0.default,onMount:C,onAPIReady:O,...V},A){const G=t?e?.[t]:void 0,N=G?.component,{engineRef:k,layersRef:P,sketchRef:w,spatialIdRef:x,geoidRef:I,selectedLayer:X,requestingRenderMode:D,handleLayerSelect:Y,handleEngineLayerSelect:H,sketchEditingFeature:J,setSketchEditingFeature:z,handleEngineMount:W,handleLayersMount:Q,handleSketchMount:q,handleSpatialIdMount:oe}=pU({ref:A,timelineManagerRef:c,onLayerSelect:h,onMount:C,onAPIReady:O}),Ee=R.useMemo(()=>({layerId:X.layerId,featureId:X.featureId}),[X.layerId,X.featureId]),be=R.useMemo(()=>X.reason,[X.reason]);return N?ce.jsxs(N,{ref:k,isBuilt:n,isEditable:i,selectedLayerId:Ee,layerSelectionReason:be,layersRef:P,requestingRenderMode:D,timelineManagerRef:c,onLayerSelect:H,featureFlags:E,onMount:W,...V,children:[ce.jsx(Bee,{ref:P,engineRef:k,clusters:r,hiddenLayers:o,isBuilt:n,isEditable:i,layers:s,overrides:a,selectedLayer:X,Feature:G?.featureComponent,clusterComponent:G?.clusterComponent,delegatedDataTypes:G.delegatedDataTypes,meta:V.meta,viewerProperty:V.property,requestingRenderMode:D,sketchEditingFeature:J,onLayerSelect:Y,onMount:Q}),ce.jsx(Sne,{ref:w,layersRef:P,engineRef:k,interactionMode:l,selectedFeature:u,SketchComponent:G?.sketchComponent,onLayerSelect:Y,overrideInteractionMode:d,onSketchTypeChange:f,onSketchFeatureCreate:p,onSketchPluginFeatureCreate:m,onSketchFeatureUpdate:y,onSketchPluginFeatureUpdate:g,onSketchFeatureDelete:v,onSketchPluginFeatureDelete:S,sketchEditingFeature:J,onSketchEditFeature:z,onMount:q}),ce.jsx(Moe,{ref:x,engineRef:k,geoidRef:I,interactionMode:l,terrainEnabled:!!V.property?.terrain?.enabled,overrideInteractionMode:d,onMount:oe}),ce.jsx(DD,{ref:I,geoidServer:V.property?.geoid?.server})]}):null}const d5=R.forwardRef(Goe),Voe=R.createContext(null),Wv={didCatch:!1,error:null};let Foe=class extends R.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Wv}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(...t){const{error:n}=this.state;n!==null&&(this.props.onReset?.({args:t,reason:"imperative-api"}),this.setState(Wv))}componentDidCatch(t,n){this.props.onError?.(t,n)}componentDidUpdate(t,n){const{didCatch:i}=this.state,{resetKeys:r}=this.props;i&&n.error!==null&&Aoe(t.resetKeys,r)&&(this.props.onReset?.({next:r,prev:t.resetKeys,reason:"keys"}),this.setState(Wv))}render(){const{children:t,fallbackRender:n,FallbackComponent:i,fallback:r}=this.props,{didCatch:o,error:s}=this.state;let a=t;if(o){const c={error:s,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")a=n(c);else if(i)a=R.createElement(i,c);else if(r!==void 0)a=r;else throw s}return R.createElement(Voe.Provider,{value:{didCatch:o,error:s,resetErrorBoundary:this.resetErrorBoundary}},a)}};function Aoe(e=[],t=[]){return e.length!==t.length||e.some((n,i)=>!Object.is(n,t[i]))}const f5=R.createContext(void 0),zoe=()=>{const e=R.useContext(f5);if(!e)throw new Error("Visualizer is not declared. You have to use this hook inside of Visualizer");return e},Noe=e=>e,koe=({mapRef:e,children:t})=>{const n=R.useMemo(()=>Noe(e),[e]);return ce.jsx(f5.Provider,{value:n,children:t})},p5=R.createContext({}),Xoe=({property:e,children:t})=>{const{clusterPixelRange:n=15,clusterMinSize:i=3,clusterLabelTypography:r={fontFamily:"sans-serif",fontSize:30,fontWeight:400,color:"#FFF",textAlign:"center",bold:!1,italic:!1,underline:!1},clusterImage:o,clusterImageWidth:s,clusterImageHeight:a}=e?.default??{},c=R.useMemo(()=>new M.EntityCluster({enabled:!0,pixelRange:15,minimumClusterSize:2,clusterBillboards:!0,clusterLabels:!0,clusterPoints:!0}),[]);return R.useEffect(()=>{const l=R.Children.count(t)<i,u=c?.clusterEvent.addEventListener((h,d)=>{d.label.font=hC(r,{fontSize:30}),d.label.horizontalOrigin=r.textAlign==="right"?M.HorizontalOrigin.LEFT:r.textAlign==="left"?M.HorizontalOrigin.RIGHT:M.HorizontalOrigin.CENTER,d.label.verticalOrigin=M.VerticalOrigin.CENTER,d.label.fillColor=M.Color.fromCssColorString(r.color??"#FFF"),d.label.eyeOffset=new M.Cartesian3(0,0,-5),d.billboard.show=!0,d.billboard.image=o,d.billboard.height=a,d.billboard.width=s,c.minimumClusterSize=l?R.Children.count(t):i});return c.enabled=!l,c.pixelRange=0,c.pixelRange=n,()=>{u()}},[i,n,r,o,a,s,t,c]),c?ce.jsx(Jne,{show:!0,clustering:c,children:t}):null};function Zoe({timelineManagerRef:e}){const{start:t,stop:n,current:i}=e?.current?.computedTimeline??{},{animation:r,stepType:o,rangeType:s,multiplier:a}=e?.current?.options??{},c=R.useMemo(()=>t?M.JulianDate.fromDate(t):void 0,[t]),l=R.useMemo(()=>n?M.JulianDate.fromDate(n):void 0,[n]),u=R.useMemo(()=>i?M.JulianDate.fromDate(i):void 0,[i]),h=o==="fixed"?M.ClockStep.TICK_DEPENDENT:M.ClockStep.SYSTEM_CLOCK_MULTIPLIER,d=a??1,f=R.useCallback(p=>{const m=M.JulianDate.toDate(p.startTime),y=M.JulianDate.toDate(p.stopTime);e?.current?.handleTick?.(M.JulianDate.toDate(p.currentTime),{start:m,stop:y})},[e]);return ce.jsx(Hne,{shouldAnimate:r,canAnimate:r,startTime:c,stopTime:l,currentTime:u,clockStep:h,multiplier:d,clockRange:s?Doe[s]:void 0,onTick:f})}const Doe={unbounded:M.ClockRange.UNBOUNDED,clamped:M.ClockRange.CLAMPED,bounced:M.ClockRange.LOOP_STOP},Uoe={translateEventTypes:M.CameraEventType.LEFT_DRAG,zoomEventTypes:[M.CameraEventType.RIGHT_DRAG,M.CameraEventType.WHEEL,M.CameraEventType.PINCH],rotateEventTypes:M.CameraEventType.LEFT_DRAG,tiltEventTypes:[M.CameraEventType.MIDDLE_DRAG,M.CameraEventType.PINCH,{eventType:M.CameraEventType.LEFT_DRAG,modifier:M.KeyboardEventModifier.CTRL},{eventType:M.CameraEventType.RIGHT_DRAG,modifier:M.KeyboardEventModifier.CTRL}],lookEventTypes:[{eventType:M.CameraEventType.LEFT_DRAG,modifier:M.KeyboardEventModifier.SHIFT}]},Woe="__reearth_layer_id",Boe=50,m5={engine:{},lightbox:[],screen:[]},Yoe=(e,t,n,i="none",r=!1,o="rgba(0, 0, 0, 0.7)",s=3,a=0,c=0)=>{const l=document.createElement("canvas"),u=l.getContext("2d");if(!(!e||!u))return u.save(),l.width=t+s*2,l.height=n+s*2,u.shadowBlur=s,u.shadowOffsetX=a,u.shadowOffsetY=c,u.globalCompositeOperation="source-over",u.clearRect(0,0,l.width,l.height),u.drawImage(e,(l.width-t)/2,(l.height-n)/2,t,n),i==="circle"?(u.fillStyle="black",u.globalCompositeOperation="destination-in",u.arc(l.width/2,l.height/2,Math.min(t,n)/2,0,2*Math.PI),u.fill(),r&&(u.shadowColor=o,u.globalCompositeOperation="destination-over",u.fillStyle="black",u.arc(l.width/2,l.height/2,Math.min(t,n)/2,0,2*Math.PI),u.fill())):r&&(u.shadowColor=o,u.globalCompositeOperation="destination-over",u.fillStyle="black",u.rect((l.width-t)/2,(l.height-n)/2,t,n),u.fill()),u.restore(),l.toDataURL()},Bv=({image:e,imageSize:t,crop:n,shadow:i,shadowColor:r,shadowBlur:o,shadowOffsetX:s,shadowOffsetY:a})=>{const c=sU(e),l=c?typeof t=="number"?Math.floor(c.width*t):Math.min(Boe,c.width):0,u=c?Math.floor(typeof t=="number"?c.height*t:l/c.width*c.height):0;return[R.useMemo(()=>Yoe(c,l,u,n,i,r,o,s,a),[n,u,c,i,o,r,s,a,l])??"",l,u]},g5=e=>({left:M.HorizontalOrigin.LEFT,center:M.HorizontalOrigin.CENTER,right:M.HorizontalOrigin.RIGHT,"":void 0})[e||""],y5=e=>({top:M.VerticalOrigin.TOP,center:M.VerticalOrigin.CENTER,baseline:M.VerticalOrigin.BASELINE,bottom:M.VerticalOrigin.BOTTOM,"":void 0})[e||""],Yv=(e,t,n,i=!1)=>{if(!e)return;const r=e.camera,o=e.globe.ellipsoid;let s;if(i){const u=r.getPickRay(new M.Cartesian2(t,n));u&&(s=e.globe.pick(u,e))}if(s||(s=r?.pickEllipsoid(new M.Cartesian2(t,n),o)),!s)return;const{latitude:a,longitude:c,height:l}=o.cartesianToCartographic(s);return{lat:M.Math.toDegrees(a),lng:M.Math.toDegrees(c),height:l}},Hoe=(e,t,n)=>{const i=M.IntersectionTests.rayEllipsoid(e,t);if(!i){const r=M.IntersectionTests.grazingAltitudeLocation(e,t);return n?r.clone(n):r}return M.Ray.getPoint(e,i.start,n)},b5=e=>{const t=new M.Ray;return e.positionWC.clone(t.origin),e.directionWC.clone(t.direction),t},_5=(e,t,n)=>{let i;const{camera:r,globe:o}=e;if(t instanceof M.Cartesian2){if(i=r.getPickRay(t,new M.Ray),!i)return}else i=b5(r),n=t;return Hoe(i,o.ellipsoid,n)},joe=e=>{const t=b5(e.camera);return e.globe.pick(t,e)},v5=(e,t)=>{const n=M.Cartographic.fromCartesian(e,t.globe.ellipsoid);return{lng:M.Math.toDegrees(n.longitude),lat:M.Math.toDegrees(n.latitude),height:n.height}},Hv=(e,t,n)=>{if(!e||!t)return()=>{};const i=w5({fov:t.fov,camera:e,duration:n?.duration,easing:n?.easing}),r=typeof t.lat=="number"&&typeof t.lng=="number"&&typeof t.height=="number"?M.Cartesian3.fromDegrees(t.lng,t.lat,t.height):void 0;return r&&e.flyTo({destination:r,orientation:{heading:t.heading,pitch:t.pitch,roll:t.roll},duration:n?.duration??0,easingFunction:n?.easing}),()=>{i?.(),e?.cancelFlight()}},Koe=(e,t,n)=>{if(!e||!t)return()=>{};const i=w5({fov:t.fov,camera:e,duration:n?.duration,easing:n?.easing}),r=typeof t.lat=="number"&&typeof t.lng=="number"&&typeof t.height=="number"?M.Cartesian3.fromDegrees(t.lng,t.lat,t.height):void 0;return r&&e.flyToBoundingSphere(new M.BoundingSphere(r,t.radius),{offset:t.heading!==void 0||t.pitch!==void 0||t.range!==void 0?new M.HeadingPitchRange(t.heading,t.pitch,t.range):void 0,duration:n?.duration,easingFunction:n?.easing}),()=>{i?.(),e?.cancelFlight()}},Joe=(e,t)=>{if(!t)return;const n=typeof t.lat=="number"&&typeof t.lng=="number"?M.Cartesian3.fromDegrees(t.lng,t.lat,t.height):void 0;n&&e.camera.lookAtTransform(M.Matrix4.fromTranslation(n))},w5=({fov:e,camera:t,easing:n,duration:i})=>{if(typeof e=="number"&&t.frustum instanceof M.PerspectiveFrustum&&typeof t.frustum.fov=="number"&&t.frustum.fov!==e){const r=t.frustum.fov;return oU(o=>{t.frustum instanceof M.PerspectiveFrustum&&(t.frustum.fov=(e-r)*o+r)},n||"inOutCubic",(i??0)*1e3)}},x5=({camera:e,scene:t})=>{const n=new M.Cartesian3,i=e.getPickRay(e.positionWC);if(i)return i.origin=e.positionWC,i.direction=e.directionWC,t.globe.pick(i,t,n)},S5=({viewer:e,relativeAmount:t},n)=>{const{camera:i,scene:r}=e;if(r.mode!==M.SceneMode.SCENE3D){const d=po(e);Hv(i,{...d,height:(d?.height||1)*t},{duration:.5});return}const s=x5({camera:i,scene:r})||M.IntersectionTests.grazingAltitudeLocation(new M.Ray(r.globe.ellipsoid.cartographicToCartesian(i.positionCartographic),i.directionWC),r.globe.ellipsoid);if(!s)return;const a={heading:i.heading,pitch:i.pitch,roll:i.roll},c=new M.Cartesian3,l=M.Cartesian3.subtract(i.position,s,c),u=M.Cartesian3.multiplyByScalar(l,t,l),h=M.Cartesian3.add(s,u,s);i.flyTo({destination:h,orientation:a,duration:n?.duration||.5,convert:!1})},po=e=>{if(!e||e.isDestroyed()||!e.camera||!e.scene)return;const{camera:t}=e;if(!(t.frustum instanceof M.PerspectiveFrustum||t.frustum instanceof M.OrthographicOffCenterFrustum))return;const{latitude:n,longitude:i,height:r}=t.positionCartographic,o=M.Math.toDegrees(n),s=M.Math.toDegrees(i),{heading:a,pitch:c,roll:l}=t,u=t.frustum instanceof M.PerspectiveFrustum?t.frustum.fov??1:1,h=t.frustum instanceof M.PerspectiveFrustum?t.frustum.aspectRatio??1:1;return{lng:s,lat:o,height:r,heading:a,pitch:c,roll:l,fov:u,aspectRatio:h}},Qoe=e=>{if(e)return{get start(){return M.JulianDate.toDate(e.startTime)},get stop(){return M.JulianDate.toDate(e.stopTime)},get current(){return M.JulianDate.toDate(e.currentTime)},get playing(){return e.shouldAnimate},get speed(){return e.multiplier}}},qoe=e=>({highlight:M.ColorBlendMode.HIGHLIGHT,replace:M.ColorBlendMode.REPLACE,mix:M.ColorBlendMode.MIX})[e||""],$oe=(e="highlight")=>({highlight:M.Cesium3DTileColorBlendMode.HIGHLIGHT,replace:M.Cesium3DTileColorBlendMode.REPLACE,mix:M.Cesium3DTileColorBlendMode.MIX})[e],da=e=>({clamp:M.HeightReference.CLAMP_TO_GROUND,relative:M.HeightReference.RELATIVE_TO_GROUND,none:M.HeightReference.NONE})[e||""],ese=e=>{if(!e)return;const t=new Map([["left_drag",M.CameraEventType.LEFT_DRAG],["right_drag",M.CameraEventType.RIGHT_DRAG],["middle_drag",M.CameraEventType.MIDDLE_DRAG],["wheel",M.CameraEventType.WHEEL],["pinch",M.CameraEventType.PINCH]]),n=new Map([["ctrl",M.KeyboardEventModifier.CTRL],["shift",M.KeyboardEventModifier.SHIFT],["alt",M.KeyboardEventModifier.ALT]]),i=l=>{if(l)return l.map(u=>typeof u=="string"?t.get(u):{eventType:t.get(u.eventType),modifier:n.get(u.modifier)})},r=i(e.translateEventTypes),o=i(e.zoomEventTypes),s=i(e.rotateEventTypes),a=i(e.tiltEventTypes),c=i(e.lookEventTypes);return{...Uoe,...r&&{translateEventTypes:r},...o&&{zoomEventTypes:o},...s&&{rotateEventTypes:s},...a&&{tiltEventTypes:a},...c&&{lookEventTypes:c},...e.minimumZoomDistance!==void 0&&{minimumZoomDistance:e.minimumZoomDistance},...e.maximumZoomDistance!==void 0&&{maximumZoomDistance:e.maximumZoomDistance},...e.enableCollisionDetection!==void 0&&{enableCollisionDetection:e.enableCollisionDetection}}},hf=e=>({both:M.ClassificationType.BOTH,"3dtiles":M.ClassificationType.CESIUM_3D_TILE,terrain:M.ClassificationType.TERRAIN})[e||""],dc=e=>({enabled:M.ShadowMode.ENABLED,cast_only:M.ShadowMode.CAST_ONLY,receive_only:M.ShadowMode.RECEIVE_ONLY,disabled:M.ShadowMode.DISABLED})[e||""],tse="reearth_unselectable",nse="reearth_draggable";function E5(e){return!e?.properties?.hasProperty(tse)}function ise(e){return e.properties?.[nse]}function rse(e,t){const n=e.camera,r=e.globe.ellipsoid.geodeticSurfaceNormal(n.position,new M.Cartesian3);n.look(r,t)}function ose(e,t){const n=e.camera,i=e.globe.ellipsoid,r=df(n.right,n.position,i),o=i.geodeticSurfaceNormal(n.position,new M.Cartesian3),s=M.Math.toDegrees(M.Cartesian3.angleBetween(o,n.up)),a=pse(n.up,r,t),l=M.Math.toDegrees(M.Cartesian3.angleBetween(o,a))<s?1:(90-s)/90;n.look(r,t*l)}function sse(e,t){const n=df(e.camera.direction,e.camera.position,e.globe.ellipsoid);e.camera.move(n,t)}function ase(e,t){const n=df(e.camera.direction,e.camera.position,e.globe.ellipsoid);e.camera.move(n,-t)}function cse(e,t){const n=e.globe.ellipsoid.geodeticSurfaceNormal(e.camera.position,new M.Cartesian3);e.camera.move(n,t)}function lse(e,t){const n=e.globe.ellipsoid.geodeticSurfaceNormal(e.camera.position,new M.Cartesian3);e.camera.move(n,-t)}function use(e,t){const n=df(e.camera.right,e.camera.position,e.globe.ellipsoid);e.camera.move(n,-t)}function hse(e,t){const n=df(e.camera.right,e.camera.position,e.globe.ellipsoid);e.camera.move(n,t)}async function dse(e,t=0){const n=po(e);if(n?.lng===void 0||n?.lat===void 0)return;const i=await Bu(e.scene,n.lng,n.lat);if(i&&i!==0){const r=po(e);r&&r?.height<i+t&&e.scene.camera.moveUp(i+t-r.height)}}async function fse(e,t,n,i,r=0){if(n.lng===void 0||n.lat===void 0)return;const o=await Bu(e.scene,n.lng,n.lat),s=o?o+r:r;t.current?.(),t.current=Hv(e.scene?.camera,{...po(e),...n,height:s},i)}function df(e,t,n){const i=n.geodeticSurfaceNormal(t,new M.Cartesian3),r=M.Cartesian3.dot(e,i),o=M.Cartesian3.multiplyByScalar(i,r,new M.Cartesian3);return M.Cartesian3.subtract(e,o,new M.Cartesian3)}function pse(e,t,n){const i=M.Quaternion.fromAxisAngle(t,-n,new M.Quaternion),r=M.Matrix3.fromQuaternion(i,new M.Matrix3);return M.Matrix3.multiplyByVector(r,e,e.clone())}async function Bu(e,t,n){const i=e.terrainProvider;if(i instanceof M.EllipsoidTerrainProvider)return 0;const[r]=await M.sampleTerrainMostDetailed(i,[M.Cartographic.fromDegrees(t,n)]);return r.height}async function T5(e,t){const n=M.Cartographic.fromCartesian(t),[i,r]=[M.Math.toDegrees(n?.longitude||0),M.Math.toDegrees(n?.latitude||0)];if(!(!i||!r))return await Bu(e,i,r)}const mse=e=>e?.match(/^#[A-Fa-f0-9]|^rgba?/),fc=e=>{if(!e||typeof e!="string")return;const t=e.match(/^#([A-Fa-f0-9]{6})([A-Fa-f0-9]{2})$|^#([A-Fa-f0-9]{3})([A-Fa-f0-9])$/);if(!t)return M.Color.fromCssColorString(e);const n=parseInt(t[4]?t[4].repeat(2):t[2],16)/255;return M.Color.fromCssColorString(`#${t[1]??t[3]}`).withAlpha(n)},Yu=(e,t)=>{e.scene.screenSpaceCameraController.enableTranslate=t,e.scene.screenSpaceCameraController.enableRotate=t,e.scene.screenSpaceCameraController.enableLook=t,e.scene.screenSpaceCameraController.enableTilt=t,e.scene.screenSpaceCameraController.enableZoom=t};function gse(e,t,n,i=!1){const r=new M.Cartesian3,o=new M.Cartesian3,s=new M.Ray,a=new M.Plane(M.Cartesian3.UNIT_X,0),c=new M.Cartographic;let l;try{const u=e.globe.ellipsoid.geodeticSurfaceNormal(t,o),h=e.camera.getPickRay(n,s);if(h==null)return;const d=M.Plane.fromPointNormal(t,M.Cartesian3.normalize(M.Cartesian3.cross(u,M.Cartesian3.cross(u,h.direction,r),r),r),a);if(l=M.IntersectionTests.rayPlane(h,d,r),l==null)return;const f=M.Cartographic.fromCartesian(l,e.globe.ellipsoid,c).height,p=M.Cartographic.fromCartesian(t,e.globe.ellipsoid,c).height;return i?f-p:Math.max(0,f-p)}catch(u){console.error(u)}}function C5(e){if(!e)return m5;const t=e.creditDisplay;if(!t)return m5;const{lightboxCredits:n,screenCredits:i}=t?._currentFrameCredits||{},r=t._currentCesiumCredit;return{engine:{cesium:r?.html?{html:r.html}:void 0},lightbox:Array.from(n?._array??[]).map(s=>({html:s?.credit?.html})),screen:Array.from(i?._array??[]).map(s=>({html:s?.credit?.html}))}}const yse="https://terrain.reearth.land/cesium-mesh/ellipsoid";function bse(e){const t=R.useRef(new Map),n=R.useRef(void 0);return R.useMemo(()=>{if(!e.terrain)return n.current||(n.current=new M.EllipsoidTerrainProvider),Promise.resolve(n.current);const i=e.terrainType??"cesium",r=_se(i,e);let o=t.current.get(r);return o||(o=vse(i,e),t.current.set(r,o)),o},[e])}function _se(e,t){const n=t.ionAsset??"",i=t.ionUrl??"",r=t.ionAccessToken??"",o=String(!!t.normal);return`${e}|asset:${n}|url:${i}|ion:${r}|normal:${o}`}function vse(e,t){switch(e){case"reearth_terrain":return M.CesiumTerrainProvider.fromUrl(yse,{requestVertexNormals:!!t.normal,requestWaterMask:!1});case"cesium":return M.CesiumTerrainProvider.fromUrl(M.IonResource.fromAssetId(1,{accessToken:t.ionAccessToken}),{requestVertexNormals:!!t.normal,requestWaterMask:!1});case"cesiumion":return!t.ionAsset&&!t.ionUrl?Promise.resolve(new M.EllipsoidTerrainProvider):M.CesiumTerrainProvider.fromUrl(t.ionUrl??M.IonResource.fromAssetId(parseInt(String(t.ionAsset),10),{accessToken:t.ionAccessToken}),{requestVertexNormals:!!t.normal});default:return Promise.resolve(new M.EllipsoidTerrainProvider)}}function wse({property:e,cesiumIonAccessToken:t,onTerrainProviderChange:n}){const i=bse({terrain:e?.terrain?.enabled,terrainType:e?.terrain?.type,normal:e?.terrain?.normal,ionAccessToken:e?.assets?.cesium?.terrain?.ionAccessToken||t,ionAsset:e?.assets?.cesium?.terrain?.ionAsset,ionUrl:e?.assets?.cesium?.terrain?.ionUrl}),r=R.useMemo(()=>fc(e?.globe?.baseColor),[e?.globe?.baseColor]),o=R.useRef(null);R.useEffect(()=>{let a=!1;return i.then(c=>{if(a)return;const l=o.current?.cesiumElement;l&&(l.terrainProvider=c)}).catch(()=>{}),()=>{a=!0}},[i]);const s=R.useRef(null);return R.useEffect(()=>{let a=!1;return i.then(c=>{a||s.current!==c&&(s.current=c,n?.())}).catch(c=>{a||console.warn("Terrain provider failed to load:",c)}),()=>{a=!0}},[i,n]),ce.jsx(xie,{ref:o,baseColor:r,enableLighting:!!e?.globe?.enableLighting,showGroundAtmosphere:e?.globe?.atmosphere?.enabled??!0,atmosphereLightIntensity:e?.globe?.atmosphere?.lightIntensity,atmosphereSaturationShift:e?.globe?.atmosphere?.saturationShift,atmosphereHueShift:e?.globe?.atmosphere?.hueShift,atmosphereBrightnessShift:e?.globe?.atmosphere?.brightnessShift,terrainProvider:i,depthTestAgainstTerrain:!!e?.globe?.depthTestAgainstTerrain})}const He={};He.EMPTY_OBJECT=Object.freeze({}),He.EMPTY_ARRAY=Object.freeze([]);function _(e){return e!=null}function F(e){this.name="DeveloperError",this.message=e;let t;try{throw new Error}catch(n){t=n.stack}this.stack=t}_(Object.create)&&(F.prototype=Object.create(Error.prototype),F.prototype.constructor=F),F.prototype.toString=function(){let e=`${this.name}: ${this.message}`;return _(this.stack)&&(e+=`
25
25
  ${this.stack.toString()}`),e},F.throwInstantiationError=function(){throw new F("This function defines an interface and should not be called directly.")};const T={};T.typeOf={};function xse(e){return`${e} is required, actual value was undefined`}function Hu(e,t,n){return`Expected ${n} to be typeof ${t}, actual typeof was ${e}`}T.defined=function(e,t){if(!_(t))throw new F(xse(e))},T.typeOf.func=function(e,t){if(typeof t!="function")throw new F(Hu(typeof t,"function",e))},T.typeOf.string=function(e,t){if(typeof t!="string")throw new F(Hu(typeof t,"string",e))},T.typeOf.number=function(e,t){if(typeof t!="number")throw new F(Hu(typeof t,"number",e))},T.typeOf.number.lessThan=function(e,t,n){if(T.typeOf.number(e,t),t>=n)throw new F(`Expected ${e} to be less than ${n}, actual value was ${t}`)},T.typeOf.number.lessThanOrEquals=function(e,t,n){if(T.typeOf.number(e,t),t>n)throw new F(`Expected ${e} to be less than or equal to ${n}, actual value was ${t}`)},T.typeOf.number.greaterThan=function(e,t,n){if(T.typeOf.number(e,t),t<=n)throw new F(`Expected ${e} to be greater than ${n}, actual value was ${t}`)},T.typeOf.number.greaterThanOrEquals=function(e,t,n){if(T.typeOf.number(e,t),t<n)throw new F(`Expected ${e} to be greater than or equal to ${n}, actual value was ${t}`)},T.typeOf.object=function(e,t){if(typeof t!="object")throw new F(Hu(typeof t,"object",e))},T.typeOf.bool=function(e,t){if(typeof t!="boolean")throw new F(Hu(typeof t,"boolean",e))},T.typeOf.bigint=function(e,t){if(typeof t!="bigint")throw new F(Hu(typeof t,"bigint",e))},T.typeOf.number.equals=function(e,t,n,i){if(T.typeOf.number(e,n),T.typeOf.number(t,i),n!==i)throw new F(`${e} must be equal to ${t}, the actual values are ${n} and ${i}`)};function Yt(){this._listeners=new Map,this._toRemove=new Map,this._toAdd=new Map,this._invokingListeners=!1,this._listenerCount=0}Object.defineProperties(Yt.prototype,{numberOfListeners:{get:function(){return this._listenerCount}}}),Yt.prototype.addEventListener=function(e,t){T.typeOf.func("listener",e);const n=this,i=n._invokingListeners?n._toAdd:n._listeners;return jv(this,i,e,t)&&n._listenerCount++,function(){n.removeEventListener(e,t)}};function jv(e,t,n,i){t.has(n)||t.set(n,new Set);const r=t.get(n);return r.has(i)?!1:(r.add(i),!0)}Yt.prototype.removeEventListener=function(e,t){T.typeOf.func("listener",e);const n=Kv(this,this._listeners,e,t),i=Kv(this,this._toAdd,e,t),r=n||i;return r&&this._listenerCount--,r};function Kv(e,t,n,i){const r=t.get(n);if(!r||!r.has(i))return!1;if(e._invokingListeners){if(!jv(e,e._toRemove,n,i))return!1}else r.delete(i),r.size===0&&t.delete(n);return!0}Yt.prototype.raiseEvent=function(){this._invokingListeners=!0;for(const[e,t]of this._listeners.entries())if(_(e))for(const n of t)e.apply(n,arguments);this._invokingListeners=!1;for(const[e,t]of this._toAdd.entries())for(const n of t)jv(this,this._listeners,e,n);this._toAdd.clear();for(const[e,t]of this._toRemove.entries())for(const n of t)Kv(this,this._listeners,e,n);this._toRemove.clear()};function Ls(e){this._value=void 0,this._hasClone=!1,this._hasEquals=!1,this._definitionChanged=new Yt,this.setValue(e)}Object.defineProperties(Ls.prototype,{isConstant:{value:!0},definitionChanged:{get:function(){return this._definitionChanged}}}),Ls.prototype.getValue=function(e,t){return this._hasClone?this._value.clone(t):this._value},Ls.prototype.setValue=function(e){const t=this._value;if(t!==e){const n=_(e),i=n&&typeof e.clone=="function",r=n&&typeof e.equals=="function";(!r||!e.equals(t))&&(this._hasClone=i,this._hasEquals=r,this._value=i?e.clone(this._value):e,this._definitionChanged.raiseEvent(this))}},Ls.prototype.equals=function(e){return this===e||e instanceof Ls&&(!this._hasEquals&&this._value===e._value||this._hasEquals&&this._value.equals(e._value))},Ls.prototype.valueOf=function(){return this._value},Ls.prototype.toString=function(){return String(this._value)};function Sse(e,t,n,i,r){return{configurable:i,get:function(){return this[t]},set:function(o){const s=this[t],a=this[n];_(a)&&(a(),this[n]=void 0),o!==void 0&&(!_(o)||!_(o.getValue))&&_(r)&&(o=r(o)),s!==o&&(this[t]=o,this._definitionChanged.raiseEvent(this,e,o,s)),_(o)&&_(o.definitionChanged)&&(this[n]=o.definitionChanged.addEventListener(function(){this._definitionChanged.raiseEvent(this,e,o,o)},this))}}}function Ese(e){return new Ls(e)}function ne(e,t,n){return Sse(e,`_${e.toString()}`,`_${e.toString()}Subscription`,t??!1,n??Ese)}function ff(e){this._definitionChanged=new Yt,this._show=void 0,this._showSubscription=void 0,this._image=void 0,this._imageSubscription=void 0,this._scale=void 0,this._scaleSubscription=void 0,this._pixelOffset=void 0,this._pixelOffsetSubscription=void 0,this._eyeOffset=void 0,this._eyeOffsetSubscription=void 0,this._horizontalOrigin=void 0,this._horizontalOriginSubscription=void 0,this._verticalOrigin=void 0,this._verticalOriginSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._color=void 0,this._colorSubscription=void 0,this._rotation=void 0,this._rotationSubscription=void 0,this._alignedAxis=void 0,this._alignedAxisSubscription=void 0,this._sizeInMeters=void 0,this._sizeInMetersSubscription=void 0,this._width=void 0,this._widthSubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._scaleByDistance=void 0,this._scaleByDistanceSubscription=void 0,this._translucencyByDistance=void 0,this._translucencyByDistanceSubscription=void 0,this._pixelOffsetScaleByDistance=void 0,this._pixelOffsetScaleByDistanceSubscription=void 0,this._imageSubRegion=void 0,this._imageSubRegionSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._disableDepthTestDistance=void 0,this._disableDepthTestDistanceSubscription=void 0,this._splitDirection=void 0,this._splitDirectionSubscription=void 0,this.merge(e??He.EMPTY_OBJECT)}Object.defineProperties(ff.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ne("show"),image:ne("image"),scale:ne("scale"),pixelOffset:ne("pixelOffset"),eyeOffset:ne("eyeOffset"),horizontalOrigin:ne("horizontalOrigin"),verticalOrigin:ne("verticalOrigin"),heightReference:ne("heightReference"),color:ne("color"),rotation:ne("rotation"),alignedAxis:ne("alignedAxis"),sizeInMeters:ne("sizeInMeters"),width:ne("width"),height:ne("height"),scaleByDistance:ne("scaleByDistance"),translucencyByDistance:ne("translucencyByDistance"),pixelOffsetScaleByDistance:ne("pixelOffsetScaleByDistance"),imageSubRegion:ne("imageSubRegion"),distanceDisplayCondition:ne("distanceDisplayCondition"),disableDepthTestDistance:ne("disableDepthTestDistance"),splitDirection:ne("splitDirection")}),ff.prototype.clone=function(e){return _(e)?(e.show=this._show,e.image=this._image,e.scale=this._scale,e.pixelOffset=this._pixelOffset,e.eyeOffset=this._eyeOffset,e.horizontalOrigin=this._horizontalOrigin,e.verticalOrigin=this._verticalOrigin,e.heightReference=this._heightReference,e.color=this._color,e.rotation=this._rotation,e.alignedAxis=this._alignedAxis,e.sizeInMeters=this._sizeInMeters,e.width=this._width,e.height=this._height,e.scaleByDistance=this._scaleByDistance,e.translucencyByDistance=this._translucencyByDistance,e.pixelOffsetScaleByDistance=this._pixelOffsetScaleByDistance,e.imageSubRegion=this._imageSubRegion,e.distanceDisplayCondition=this._distanceDisplayCondition,e.disableDepthTestDistance=this._disableDepthTestDistance,e.splitDirection=this._splitDirection,e):new ff(this)},ff.prototype.merge=function(e){if(!_(e))throw new F("source is required.");this.show=this._show??e.show,this.image=this._image??e.image,this.scale=this._scale??e.scale,this.pixelOffset=this._pixelOffset??e.pixelOffset,this.eyeOffset=this._eyeOffset??e.eyeOffset,this.horizontalOrigin=this._horizontalOrigin??e.horizontalOrigin,this.verticalOrigin=this._verticalOrigin??e.verticalOrigin,this.heightReference=this._heightReference??e.heightReference,this.color=this._color??e.color,this.rotation=this._rotation??e.rotation,this.alignedAxis=this._alignedAxis??e.alignedAxis,this.sizeInMeters=this._sizeInMeters??e.sizeInMeters,this.width=this._width??e.width,this.height=this._height??e.height,this.scaleByDistance=this._scaleByDistance??e.scaleByDistance,this.translucencyByDistance=this._translucencyByDistance??e.translucencyByDistance,this.pixelOffsetScaleByDistance=this._pixelOffsetScaleByDistance??e.pixelOffsetScaleByDistance,this.imageSubRegion=this._imageSubRegion??e.imageSubRegion,this.distanceDisplayCondition=this._distanceDisplayCondition??e.distanceDisplayCondition,this.disableDepthTestDistance=this._disableDepthTestDistance??e.disableDepthTestDistance,this.splitDirection=this.splitDirection??e.splitDirection};var Jv,R5;function Tse(){if(R5)return Jv;R5=1;var e=function(t){t==null&&(t=new Date().getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,t.constructor==Array?this.init_by_array(t,t.length):this.init_seed(t)};return e.prototype.init_seed=function(t){for(this.mt[0]=t>>>0,this.mti=1;this.mti<this.N;this.mti++){var t=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(((t&4294901760)>>>16)*1812433253<<16)+(t&65535)*1812433253+this.mti,this.mt[this.mti]>>>=0}},e.prototype.init_by_array=function(t,n){var i,r,o;for(this.init_seed(19650218),i=1,r=0,o=this.N>n?this.N:n;o;o--){var s=this.mt[i-1]^this.mt[i-1]>>>30;this.mt[i]=(this.mt[i]^(((s&4294901760)>>>16)*1664525<<16)+(s&65535)*1664525)+t[r]+r,this.mt[i]>>>=0,i++,r++,i>=this.N&&(this.mt[0]=this.mt[this.N-1],i=1),r>=n&&(r=0)}for(o=this.N-1;o;o--){var s=this.mt[i-1]^this.mt[i-1]>>>30;this.mt[i]=(this.mt[i]^(((s&4294901760)>>>16)*1566083941<<16)+(s&65535)*1566083941)-i,this.mt[i]>>>=0,i++,i>=this.N&&(this.mt[0]=this.mt[this.N-1],i=1)}this.mt[0]=2147483648},e.prototype.random_int=function(){var t,n=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var i;for(this.mti==this.N+1&&this.init_seed(5489),i=0;i<this.N-this.M;i++)t=this.mt[i]&this.UPPER_MASK|this.mt[i+1]&this.LOWER_MASK,this.mt[i]=this.mt[i+this.M]^t>>>1^n[t&1];for(;i<this.N-1;i++)t=this.mt[i]&this.UPPER_MASK|this.mt[i+1]&this.LOWER_MASK,this.mt[i]=this.mt[i+(this.M-this.N)]^t>>>1^n[t&1];t=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^t>>>1^n[t&1],this.mti=0}return t=this.mt[this.mti++],t^=t>>>11,t^=t<<7&2636928640,t^=t<<15&4022730752,t^=t>>>18,t>>>0},e.prototype.random_int31=function(){return this.random_int()>>>1},e.prototype.random_incl=function(){return this.random_int()*(1/4294967295)},e.prototype.random=function(){return this.random_int()*(1/4294967296)},e.prototype.random_excl=function(){return(this.random_int()+.5)*(1/4294967296)},e.prototype.random_long=function(){var t=this.random_int()>>>5,n=this.random_int()>>>6;return(t*67108864+n)*(1/9007199254740992)},Jv=e,Jv}var Cse=Tse();const I5=uu(Cse),U={};U.EPSILON1=.1,U.EPSILON2=.01,U.EPSILON3=.001,U.EPSILON4=1e-4,U.EPSILON5=1e-5,U.EPSILON6=1e-6,U.EPSILON7=1e-7,U.EPSILON8=1e-8,U.EPSILON9=1e-9,U.EPSILON10=1e-10,U.EPSILON11=1e-11,U.EPSILON12=1e-12,U.EPSILON13=1e-13,U.EPSILON14=1e-14,U.EPSILON15=1e-15,U.EPSILON16=1e-16,U.EPSILON17=1e-17,U.EPSILON18=1e-18,U.EPSILON19=1e-19,U.EPSILON20=1e-20,U.EPSILON21=1e-21,U.GRAVITATIONALPARAMETER=3986004418e5,U.SOLAR_RADIUS=6955e5,U.LUNAR_RADIUS=1737400,U.SIXTY_FOUR_KILOBYTES=64*1024,U.FOUR_GIGABYTES=4*1024*1024*1024,U.sign=Math.sign??function(t){return t=+t,t===0||t!==t?t:t>0?1:-1},U.signNotZero=function(e){return e<0?-1:1},U.toSNorm=function(e,t){return t=t??255,Math.round((U.clamp(e,-1,1)*.5+.5)*t)},U.fromSNorm=function(e,t){return t=t??255,U.clamp(e,0,t)/t*2-1},U.normalize=function(e,t,n){return n=Math.max(n-t,0),n===0?0:U.clamp((e-t)/n,0,1)},U.sinh=Math.sinh??function(t){return(Math.exp(t)-Math.exp(-t))/2},U.cosh=Math.cosh??function(t){return(Math.exp(t)+Math.exp(-t))/2},U.lerp=function(e,t,n){return(1-n)*e+n*t},U.PI=Math.PI,U.ONE_OVER_PI=1/Math.PI,U.PI_OVER_TWO=Math.PI/2,U.PI_OVER_THREE=Math.PI/3,U.PI_OVER_FOUR=Math.PI/4,U.PI_OVER_SIX=Math.PI/6,U.THREE_PI_OVER_TWO=3*Math.PI/2,U.TWO_PI=2*Math.PI,U.ONE_OVER_TWO_PI=1/(2*Math.PI),U.RADIANS_PER_DEGREE=Math.PI/180,U.DEGREES_PER_RADIAN=180/Math.PI,U.RADIANS_PER_ARCSECOND=U.RADIANS_PER_DEGREE/3600,U.toRadians=function(e){if(!_(e))throw new F("degrees is required.");return e*U.RADIANS_PER_DEGREE},U.toDegrees=function(e){if(!_(e))throw new F("radians is required.");return e*U.DEGREES_PER_RADIAN},U.convertLongitudeRange=function(e){if(!_(e))throw new F("angle is required.");const t=U.TWO_PI,n=e-Math.floor(e/t)*t;return n<-Math.PI?n+t:n>=Math.PI?n-t:n},U.clampToLatitudeRange=function(e){if(!_(e))throw new F("angle is required.");return U.clamp(e,-1*U.PI_OVER_TWO,U.PI_OVER_TWO)},U.negativePiToPi=function(e){if(!_(e))throw new F("angle is required.");return e>=-U.PI&&e<=U.PI?e:U.zeroToTwoPi(e+U.PI)-U.PI},U.zeroToTwoPi=function(e){if(!_(e))throw new F("angle is required.");if(e>=0&&e<=U.TWO_PI)return e;const t=U.mod(e,U.TWO_PI);return Math.abs(t)<U.EPSILON14&&Math.abs(e)>U.EPSILON14?U.TWO_PI:t},U.mod=function(e,t){if(!_(e))throw new F("m is required.");if(!_(t))throw new F("n is required.");if(t===0)throw new F("divisor cannot be 0.");return U.sign(e)===U.sign(t)&&Math.abs(e)<Math.abs(t)?e:(e%t+t)%t},U.equalsEpsilon=function(e,t,n,i){if(!_(e))throw new F("left is required.");if(!_(t))throw new F("right is required.");n=n??0,i=i??n;const r=Math.abs(e-t);return r<=i||r<=n*Math.max(Math.abs(e),Math.abs(t))},U.lessThan=function(e,t,n){if(!_(e))throw new F("first is required.");if(!_(t))throw new F("second is required.");if(!_(n))throw new F("absoluteEpsilon is required.");return e-t<-n},U.lessThanOrEquals=function(e,t,n){if(!_(e))throw new F("first is required.");if(!_(t))throw new F("second is required.");if(!_(n))throw new F("absoluteEpsilon is required.");return e-t<n},U.greaterThan=function(e,t,n){if(!_(e))throw new F("first is required.");if(!_(t))throw new F("second is required.");if(!_(n))throw new F("absoluteEpsilon is required.");return e-t>n},U.greaterThanOrEquals=function(e,t,n){if(!_(e))throw new F("first is required.");if(!_(t))throw new F("second is required.");if(!_(n))throw new F("absoluteEpsilon is required.");return e-t>-n};const qm=[1];U.factorial=function(e){if(typeof e!="number"||e<0)throw new F("A number greater than or equal to 0 is required.");const t=qm.length;if(e>=t){let n=qm[t-1];for(let i=t;i<=e;i++){const r=n*i;qm.push(r),n=r}}return qm[e]},U.incrementWrap=function(e,t,n){if(n=n??0,!_(e))throw new F("n is required.");if(t<=n)throw new F("maximumValue must be greater than minimumValue.");return++e,e>t&&(e=n),e},U.isPowerOfTwo=function(e){if(typeof e!="number"||e<0||e>4294967295)throw new F("A number between 0 and (2^32)-1 is required.");return e!==0&&(e&e-1)===0},U.nextPowerOfTwo=function(e){if(typeof e!="number"||e<0||e>2147483648)throw new F("A number between 0 and 2^31 is required.");return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e},U.previousPowerOfTwo=function(e){if(typeof e!="number"||e<0||e>4294967295)throw new F("A number between 0 and (2^32)-1 is required.");return e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e|=e>>32,e=(e>>>0)-(e>>>1),e},U.clamp=function(e,t,n){return T.typeOf.number("value",e),T.typeOf.number("min",t),T.typeOf.number("max",n),e<t?t:e>n?n:e};let M5=new I5;U.setRandomNumberSeed=function(e){if(!_(e))throw new F("seed is required.");M5=new I5(e)},U.nextRandomNumber=function(){return M5.random()},U.randomBetween=function(e,t){return U.nextRandomNumber()*(t-e)+e},U.acosClamped=function(e){if(!_(e))throw new F("value is required.");return Math.acos(U.clamp(e,-1,1))},U.asinClamped=function(e){if(!_(e))throw new F("value is required.");return Math.asin(U.clamp(e,-1,1))},U.chordLength=function(e,t){if(!_(e))throw new F("angle is required.");if(!_(t))throw new F("radius is required.");return 2*t*Math.sin(e*.5)},U.logBase=function(e,t){if(!_(e))throw new F("number is required.");if(!_(t))throw new F("base is required.");return Math.log(e)/Math.log(t)},U.cbrt=Math.cbrt??function(t){const n=Math.pow(Math.abs(t),.3333333333333333);return t<0?-n:n},U.log2=Math.log2??function(t){return Math.log(t)*Math.LOG2E},U.fog=function(e,t){const n=e*t;return 1-Math.exp(-(n*n))},U.fastApproximateAtan=function(e){return T.typeOf.number("x",e),e*(-.1784*Math.abs(e)-.0663*e*e+1.0301)},U.fastApproximateAtan2=function(e,t){T.typeOf.number("x",e),T.typeOf.number("y",t);let n,i=Math.abs(e);n=Math.abs(t);const r=Math.max(i,n);n=Math.min(i,n);const o=n/r;if(isNaN(o))throw new F("either x or y must be nonzero");return i=U.fastApproximateAtan(o),i=Math.abs(t)>Math.abs(e)?U.PI_OVER_TWO-i:i,i=e<0?U.PI-i:i,i=t<0?-i:i,i};class me{constructor(t,n){this.x=t??0,this.y=n??0}static fromElements(t,n,i){return _(i)?(i.x=t,i.y=n,i):new me(t,n)}static clone(t,n){if(_(t))return _(n)?(n.x=t.x,n.y=t.y,n):new me(t.x,t.y)}static pack(t,n,i){return T.typeOf.object("value",t),T.defined("array",n),i=i??0,n[i++]=t.x,n[i]=t.y,n}static unpack(t,n,i){return T.defined("array",t),n=n??0,_(i)||(i=new me),i.x=t[n++],i.y=t[n],i}static packArray(t,n){T.defined("array",t);const i=t.length,r=i*2;if(!_(n))n=new Array(r);else{if(!Array.isArray(n)&&n.length!==r)throw new F("If result is a typed array, it must have exactly array.length * 2 elements");n.length!==r&&(n.length=r)}for(let o=0;o<i;++o)me.pack(t[o],n,o*2);return n}static unpackArray(t,n){if(T.defined("array",t),T.typeOf.number.greaterThanOrEquals("array.length",t.length,2),t.length%2!==0)throw new F("array length must be a multiple of 2.");const i=t.length;_(n)?n.length=i/2:n=new Array(i/2);for(let r=0;r<i;r+=2){const o=r/2;n[o]=me.unpack(t,r,n[o])}return n}static maximumComponent(t){return T.typeOf.object("cartesian",t),Math.max(t.x,t.y)}static minimumComponent(t){return T.typeOf.object("cartesian",t),Math.min(t.x,t.y)}static minimumByComponent(t,n,i){return T.typeOf.object("first",t),T.typeOf.object("second",n),T.typeOf.object("result",i),i.x=Math.min(t.x,n.x),i.y=Math.min(t.y,n.y),i}static maximumByComponent(t,n,i){return T.typeOf.object("first",t),T.typeOf.object("second",n),T.typeOf.object("result",i),i.x=Math.max(t.x,n.x),i.y=Math.max(t.y,n.y),i}static clamp(t,n,i,r){T.typeOf.object("value",t),T.typeOf.object("min",n),T.typeOf.object("max",i),T.typeOf.object("result",r);const o=U.clamp(t.x,n.x,i.x),s=U.clamp(t.y,n.y,i.y);return r.x=o,r.y=s,r}static magnitudeSquared(t){return T.typeOf.object("cartesian",t),t.x*t.x+t.y*t.y}static magnitude(t){return Math.sqrt(me.magnitudeSquared(t))}static distance(t,n){return T.typeOf.object("left",t),T.typeOf.object("right",n),me.subtract(t,n,$m),me.magnitude($m)}static distanceSquared(t,n){return T.typeOf.object("left",t),T.typeOf.object("right",n),me.subtract(t,n,$m),me.magnitudeSquared($m)}static normalize(t,n){T.typeOf.object("cartesian",t),T.typeOf.object("result",n);const i=me.magnitude(t);if(n.x=t.x/i,n.y=t.y/i,isNaN(n.x)||isNaN(n.y))throw new F("normalized result is not a number");return n}static dot(t,n){return T.typeOf.object("left",t),T.typeOf.object("right",n),t.x*n.x+t.y*n.y}static cross(t,n){return T.typeOf.object("left",t),T.typeOf.object("right",n),t.x*n.y-t.y*n.x}static multiplyComponents(t,n,i){return T.typeOf.object("left",t),T.typeOf.object("right",n),T.typeOf.object("result",i),i.x=t.x*n.x,i.y=t.y*n.y,i}static divideComponents(t,n,i){return T.typeOf.object("left",t),T.typeOf.object("right",n),T.typeOf.object("result",i),i.x=t.x/n.x,i.y=t.y/n.y,i}static add(t,n,i){return T.typeOf.object("left",t),T.typeOf.object("right",n),T.typeOf.object("result",i),i.x=t.x+n.x,i.y=t.y+n.y,i}static subtract(t,n,i){return T.typeOf.object("left",t),T.typeOf.object("right",n),T.typeOf.object("result",i),i.x=t.x-n.x,i.y=t.y-n.y,i}static multiplyByScalar(t,n,i){return T.typeOf.object("cartesian",t),T.typeOf.number("scalar",n),T.typeOf.object("result",i),i.x=t.x*n,i.y=t.y*n,i}static divideByScalar(t,n,i){return T.typeOf.object("cartesian",t),T.typeOf.number("scalar",n),T.typeOf.object("result",i),i.x=t.x/n,i.y=t.y/n,i}static negate(t,n){return T.typeOf.object("cartesian",t),T.typeOf.object("result",n),n.x=-t.x,n.y=-t.y,n}static abs(t,n){return T.typeOf.object("cartesian",t),T.typeOf.object("result",n),n.x=Math.abs(t.x),n.y=Math.abs(t.y),n}static lerp(t,n,i,r){return T.typeOf.object("start",t),T.typeOf.object("end",n),T.typeOf.number("t",i),T.typeOf.object("result",r),me.multiplyByScalar(n,i,L5),r=me.multiplyByScalar(t,1-i,r),me.add(L5,r,r)}static angleBetween(t,n){return T.typeOf.object("left",t),T.typeOf.object("right",n),me.normalize(t,P5),me.normalize(n,O5),U.acosClamped(me.dot(P5,O5))}static mostOrthogonalAxis(t,n){T.typeOf.object("cartesian",t),T.typeOf.object("result",n);const i=me.normalize(t,Rse);return me.abs(i,i),i.x<=i.y?n=me.clone(me.UNIT_X,n):n=me.clone(me.UNIT_Y,n),n}static equals(t,n){return t===n||_(t)&&_(n)&&t.x===n.x&&t.y===n.y}static equalsArray(t,n,i){return t.x===n[i]&&t.y===n[i+1]}static equalsEpsilon(t,n,i,r){return t===n||_(t)&&_(n)&&U.equalsEpsilon(t.x,n.x,i,r)&&U.equalsEpsilon(t.y,n.y,i,r)}clone(t){return me.clone(this,t)}equals(t){return me.equals(this,t)}equalsEpsilon(t,n,i){return me.equalsEpsilon(this,t,n,i)}toString(){return`(${this.x}, ${this.y})`}}me.fromCartesian3=me.clone,me.fromCartesian4=me.clone,me.packedLength=2,me.fromArray=me.unpack;const $m=new me,L5=new me,P5=new me,O5=new me,Rse=new me;me.ZERO=Object.freeze(new me(0,0)),me.ONE=Object.freeze(new me(1,1)),me.UNIT_X=Object.freeze(new me(1,0)),me.UNIT_Y=Object.freeze(new me(0,1));class b{constructor(t,n,i){this.x=t??0,this.y=n??0,this.z=i??0}static fromSpherical(t,n){T.typeOf.object("spherical",t),_(n)||(n=new b);const i=t.clock,r=t.cone,o=t.magnitude??1,s=o*Math.sin(r);return n.x=s*Math.cos(i),n.y=s*Math.sin(i),n.z=o*Math.cos(r),n}static fromElements(t,n,i,r){return _(r)?(r.x=t,r.y=n,r.z=i,r):new b(t,n,i)}static clone(t,n){if(_(t))return _(n)?(n.x=t.x,n.y=t.y,n.z=t.z,n):new b(t.x,t.y,t.z)}static pack(t,n,i){return T.typeOf.object("value",t),T.defined("array",n),i=i??0,n[i++]=t.x,n[i++]=t.y,n[i]=t.z,n}static unpack(t,n,i){return T.defined("array",t),n=n??0,_(i)||(i=new b),i.x=t[n++],i.y=t[n++],i.z=t[n],i}static packArray(t,n){T.defined("array",t);const i=t.length,r=i*3;if(!_(n))n=new Array(r);else{if(!Array.isArray(n)&&n.length!==r)throw new F("If result is a typed array, it must have exactly array.length * 3 elements");n.length!==r&&(n.length=r)}for(let o=0;o<i;++o)b.pack(t[o],n,o*3);return n}static unpackArray(t,n){if(T.defined("array",t),T.typeOf.number.greaterThanOrEquals("array.length",t.length,3),t.length%3!==0)throw new F("array length must be a multiple of 3.");const i=t.length;_(n)?n.length=i/3:n=new Array(i/3);for(let r=0;r<i;r+=3){const o=r/3;n[o]=b.unpack(t,r,n[o])}return n}static maximumComponent(t){return T.typeOf.object("cartesian",t),Math.max(t.x,t.y,t.z)}static minimumComponent(t){return T.typeOf.object("cartesian",t),Math.min(t.x,t.y,t.z)}static minimumByComponent(t,n,i){return T.typeOf.object("first",t),T.typeOf.object("second",n),T.typeOf.object("result",i),i.x=Math.min(t.x,n.x),i.y=Math.min(t.y,n.y),i.z=Math.min(t.z,n.z),i}static maximumByComponent(t,n,i){return T.typeOf.object("first",t),T.typeOf.object("second",n),T.typeOf.object("result",i),i.x=Math.max(t.x,n.x),i.y=Math.max(t.y,n.y),i.z=Math.max(t.z,n.z),i}static clamp(t,n,i,r){T.typeOf.object("value",t),T.typeOf.object("min",n),T.typeOf.object("max",i),T.typeOf.object("result",r);const o=U.clamp(t.x,n.x,i.x),s=U.clamp(t.y,n.y,i.y),a=U.clamp(t.z,n.z,i.z);return r.x=o,r.y=s,r.z=a,r}static magnitudeSquared(t){return T.typeOf.object("cartesian",t),t.x*t.x+t.y*t.y+t.z*t.z}static magnitude(t){return Math.sqrt(b.magnitudeSquared(t))}static distance(t,n){return T.typeOf.object("left",t),T.typeOf.object("right",n),b.subtract(t,n,eg),b.magnitude(eg)}static distanceSquared(t,n){return T.typeOf.object("left",t),T.typeOf.object("right",n),b.subtract(t,n,eg),b.magnitudeSquared(eg)}static normalize(t,n){T.typeOf.object("cartesian",t),T.typeOf.object("result",n);const i=b.magnitude(t);if(n.x=t.x/i,n.y=t.y/i,n.z=t.z/i,isNaN(n.x)||isNaN(n.y)||isNaN(n.z))throw new F("normalized result is not a number");return n}static dot(t,n){return T.typeOf.object("left",t),T.typeOf.object("right",n),t.x*n.x+t.y*n.y+t.z*n.z}static multiplyComponents(t,n,i){return T.typeOf.object("left",t),T.typeOf.object("right",n),T.typeOf.object("result",i),i.x=t.x*n.x,i.y=t.y*n.y,i.z=t.z*n.z,i}static divideComponents(t,n,i){return T.typeOf.object("left",t),T.typeOf.object("right",n),T.typeOf.object("result",i),i.x=t.x/n.x,i.y=t.y/n.y,i.z=t.z/n.z,i}static add(t,n,i){return T.typeOf.object("left",t),T.typeOf.object("right",n),T.typeOf.object("result",i),i.x=t.x+n.x,i.y=t.y+n.y,i.z=t.z+n.z,i}static subtract(t,n,i){return T.typeOf.object("left",t),T.typeOf.object("right",n),T.typeOf.object("result",i),i.x=t.x-n.x,i.y=t.y-n.y,i.z=t.z-n.z,i}static multiplyByScalar(t,n,i){return T.typeOf.object("cartesian",t),T.typeOf.number("scalar",n),T.typeOf.object("result",i),i.x=t.x*n,i.y=t.y*n,i.z=t.z*n,i}static divideByScalar(t,n,i){return T.typeOf.object("cartesian",t),T.typeOf.number("scalar",n),T.typeOf.object("result",i),i.x=t.x/n,i.y=t.y/n,i.z=t.z/n,i}static negate(t,n){return T.typeOf.object("cartesian",t),T.typeOf.object("result",n),n.x=-t.x,n.y=-t.y,n.z=-t.z,n}static abs(t,n){return T.typeOf.object("cartesian",t),T.typeOf.object("result",n),n.x=Math.abs(t.x),n.y=Math.abs(t.y),n.z=Math.abs(t.z),n}static lerp(t,n,i,r){return T.typeOf.object("start",t),T.typeOf.object("end",n),T.typeOf.number("t",i),T.typeOf.object("result",r),b.multiplyByScalar(n,i,G5),r=b.multiplyByScalar(t,1-i,r),b.add(G5,r,r)}static angleBetween(t,n){T.typeOf.object("left",t),T.typeOf.object("right",n),b.normalize(t,tg),b.normalize(n,Qv);const i=b.dot(tg,Qv),r=b.magnitude(b.cross(tg,Qv,tg));return Math.atan2(r,i)}static mostOrthogonalAxis(t,n){T.typeOf.object("cartesian",t),T.typeOf.object("result",n);const i=b.normalize(t,Ise);return b.abs(i,i),i.x<=i.y?i.x<=i.z?n=b.clone(b.UNIT_X,n):n=b.clone(b.UNIT_Z,n):i.y<=i.z?n=b.clone(b.UNIT_Y,n):n=b.clone(b.UNIT_Z,n),n}static projectVector(t,n,i){T.defined("a",t),T.defined("b",n),T.defined("result",i);const r=b.dot(t,n)/b.dot(n,n);return b.multiplyByScalar(n,r,i)}static equals(t,n){return t===n||_(t)&&_(n)&&t.x===n.x&&t.y===n.y&&t.z===n.z}static equalsArray(t,n,i){return t.x===n[i]&&t.y===n[i+1]&&t.z===n[i+2]}static equalsEpsilon(t,n,i,r){return t===n||_(t)&&_(n)&&U.equalsEpsilon(t.x,n.x,i,r)&&U.equalsEpsilon(t.y,n.y,i,r)&&U.equalsEpsilon(t.z,n.z,i,r)}static cross(t,n,i){T.typeOf.object("left",t),T.typeOf.object("right",n),T.typeOf.object("result",i);const r=t.x,o=t.y,s=t.z,a=n.x,c=n.y,l=n.z,u=o*l-s*c,h=s*a-r*l,d=r*c-o*a;return i.x=u,i.y=h,i.z=d,i}static midpoint(t,n,i){return T.typeOf.object("left",t),T.typeOf.object("right",n),T.typeOf.object("result",i),i.x=(t.x+n.x)*.5,i.y=(t.y+n.y)*.5,i.z=(t.z+n.z)*.5,i}static fromDegrees(t,n,i,r,o){return T.typeOf.number("longitude",t),T.typeOf.number("latitude",n),t=U.toRadians(t),n=U.toRadians(n),b.fromRadians(t,n,i,r,o)}static fromRadians(t,n,i,r,o){T.typeOf.number("longitude",t),T.typeOf.number("latitude",n),i=i??0;const s=_(r)?r.radiiSquared:b._ellipsoidRadiiSquared,a=Math.cos(n);mo.x=a*Math.cos(t),mo.y=a*Math.sin(t),mo.z=Math.sin(n),mo=b.normalize(mo,mo),b.multiplyComponents(s,mo,ju);const c=Math.sqrt(b.dot(mo,ju));return ju=b.divideByScalar(ju,c,ju),mo=b.multiplyByScalar(mo,i,mo),_(o)||(o=new b),b.add(ju,mo,o)}static fromDegreesArray(t,n,i){if(T.defined("coordinates",t),t.length<2||t.length%2!==0)throw new F("the number of coordinates must be a multiple of 2 and at least 2");const r=t.length;_(i)?i.length=r/2:i=new Array(r/2);for(let o=0;o<r;o+=2){const s=t[o],a=t[o+1],c=o/2;i[c]=b.fromDegrees(s,a,0,n,i[c])}return i}static fromRadiansArray(t,n,i){if(T.defined("coordinates",t),t.length<2||t.length%2!==0)throw new F("the number of coordinates must be a multiple of 2 and at least 2");const r=t.length;_(i)?i.length=r/2:i=new Array(r/2);for(let o=0;o<r;o+=2){const s=t[o],a=t[o+1],c=o/2;i[c]=b.fromRadians(s,a,0,n,i[c])}return i}static fromDegreesArrayHeights(t,n,i){if(T.defined("coordinates",t),t.length<3||t.length%3!==0)throw new F("the number of coordinates must be a multiple of 3 and at least 3");const r=t.length;_(i)?i.length=r/3:i=new Array(r/3);for(let o=0;o<r;o+=3){const s=t[o],a=t[o+1],c=t[o+2],l=o/3;i[l]=b.fromDegrees(s,a,c,n,i[l])}return i}static fromRadiansArrayHeights(t,n,i){if(T.defined("coordinates",t),t.length<3||t.length%3!==0)throw new F("the number of coordinates must be a multiple of 3 and at least 3");const r=t.length;_(i)?i.length=r/3:i=new Array(r/3);for(let o=0;o<r;o+=3){const s=t[o],a=t[o+1],c=t[o+2],l=o/3;i[l]=b.fromRadians(s,a,c,n,i[l])}return i}clone(t){return b.clone(this,t)}equals(t){return b.equals(this,t)}equalsEpsilon(t,n,i){return b.equalsEpsilon(this,t,n,i)}toString(){return`(${this.x}, ${this.y}, ${this.z})`}}b.fromCartesian4=b.clone,b.packedLength=3,b.fromArray=b.unpack;const eg=new b,G5=new b,tg=new b,Qv=new b,Ise=new b;let mo=new b,ju=new b;b._ellipsoidRadiiSquared=new b(6378137*6378137,6378137*6378137,6356752314245179e-9*6356752314245179e-9),b.ZERO=Object.freeze(new b(0,0,0)),b.ONE=Object.freeze(new b(1,1,1)),b.UNIT_X=Object.freeze(new b(1,0,0)),b.UNIT_Y=Object.freeze(new b(0,1,0)),b.UNIT_Z=Object.freeze(new b(0,0,1));const Mse=new b,Lse=new b;function V5(e,t,n,i,r){if(!_(e))throw new F("cartesian is required.");if(!_(t))throw new F("oneOverRadii is required.");if(!_(n))throw new F("oneOverRadiiSquared is required.");if(!_(i))throw new F("centerToleranceSquared is required.");const o=e.x,s=e.y,a=e.z,c=t.x,l=t.y,u=t.z,h=o*o*c*c,d=s*s*l*l,f=a*a*u*u,p=h+d+f,m=Math.sqrt(1/p),y=b.multiplyByScalar(e,m,Mse);if(p<i)return isFinite(m)?b.clone(y,r):void 0;const g=n.x,v=n.y,S=n.z,E=Lse;E.x=y.x*g*2,E.y=y.y*v*2,E.z=y.z*S*2;let C=(1-m)*b.magnitude(e)/(.5*b.magnitude(E)),O=0,V,A,G,N,k,P,w,x,I,X,D;do{C-=O,G=1/(1+C*g),N=1/(1+C*v),k=1/(1+C*S),P=G*G,w=N*N,x=k*k,I=P*G,X=w*N,D=x*k,V=h*P+d*w+f*x-1,A=h*I*g+d*X*v+f*D*S;const Y=-2*A;O=V/Y}while(Math.abs(V)>U.EPSILON12);return _(r)?(r.x=o*G,r.y=s*N,r.z=a*k,r):new b(o*G,s*N,a*k)}function Ce(e,t,n){this.longitude=e??0,this.latitude=t??0,this.height=n??0}Ce.fromRadians=function(e,t,n,i){return T.typeOf.number("longitude",e),T.typeOf.number("latitude",t),n=n??0,_(i)?(i.longitude=e,i.latitude=t,i.height=n,i):new Ce(e,t,n)},Ce.fromDegrees=function(e,t,n,i){return T.typeOf.number("longitude",e),T.typeOf.number("latitude",t),e=U.toRadians(e),t=U.toRadians(t),Ce.fromRadians(e,t,n,i)};const Pse=new b,Ose=new b,Gse=new b;Ce._ellipsoidOneOverRadii=new b(1/6378137,1/6378137,1/6356752314245179e-9),Ce._ellipsoidOneOverRadiiSquared=new b(1/(6378137*6378137),1/(6378137*6378137),1/(6356752314245179e-9*6356752314245179e-9)),Ce._ellipsoidCenterToleranceSquared=U.EPSILON1,Ce.fromCartesian=function(e,t,n){const i=_(t)?t.oneOverRadii:Ce._ellipsoidOneOverRadii,r=_(t)?t.oneOverRadiiSquared:Ce._ellipsoidOneOverRadiiSquared,o=_(t)?t._centerToleranceSquared:Ce._ellipsoidCenterToleranceSquared,s=V5(e,i,r,o,Ose);if(!_(s))return;let a=b.multiplyComponents(s,r,Pse);a=b.normalize(a,a);const c=b.subtract(e,s,Gse),l=Math.atan2(a.y,a.x),u=Math.asin(a.z),h=U.sign(b.dot(c,e))*b.magnitude(c);return _(n)?(n.longitude=l,n.latitude=u,n.height=h,n):new Ce(l,u,h)},Ce.toCartesian=function(e,t,n){return T.defined("cartographic",e),b.fromRadians(e.longitude,e.latitude,e.height,t,n)},Ce.clone=function(e,t){if(_(e))return _(t)?(t.longitude=e.longitude,t.latitude=e.latitude,t.height=e.height,t):new Ce(e.longitude,e.latitude,e.height)},Ce.equals=function(e,t){return e===t||_(e)&&_(t)&&e.longitude===t.longitude&&e.latitude===t.latitude&&e.height===t.height},Ce.equalsEpsilon=function(e,t,n){return n=n??0,e===t||_(e)&&_(t)&&Math.abs(e.longitude-t.longitude)<=n&&Math.abs(e.latitude-t.latitude)<=n&&Math.abs(e.height-t.height)<=n},Ce.ZERO=Object.freeze(new Ce(0,0,0)),Ce.prototype.clone=function(e){return Ce.clone(this,e)},Ce.prototype.equals=function(e){return Ce.equals(this,e)},Ce.prototype.equalsEpsilon=function(e,t){return Ce.equalsEpsilon(this,e,t)},Ce.prototype.toString=function(){return`(${this.longitude}, ${this.latitude}, ${this.height})`};function F5(e,t,n,i){t=t??0,n=n??0,i=i??0,T.typeOf.number.greaterThanOrEquals("x",t,0),T.typeOf.number.greaterThanOrEquals("y",n,0),T.typeOf.number.greaterThanOrEquals("z",i,0),e._radii=new b(t,n,i),e._radiiSquared=new b(t*t,n*n,i*i),e._radiiToTheFourth=new b(t*t*t*t,n*n*n*n,i*i*i*i),e._oneOverRadii=new b(t===0?0:1/t,n===0?0:1/n,i===0?0:1/i),e._oneOverRadiiSquared=new b(t===0?0:1/(t*t),n===0?0:1/(n*n),i===0?0:1/(i*i)),e._minimumRadius=Math.min(t,n,i),e._maximumRadius=Math.max(t,n,i),e._centerToleranceSquared=U.EPSILON1,e._radiiSquared.z!==0&&(e._squaredXOverSquaredZ=e._radiiSquared.x/e._radiiSquared.z)}function it(e,t,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,this._squaredXOverSquaredZ=void 0,F5(this,e,t,n)}Object.defineProperties(it.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),it.clone=function(e,t){if(!_(e))return;const n=e._radii;return _(t)?(b.clone(n,t._radii),b.clone(e._radiiSquared,t._radiiSquared),b.clone(e._radiiToTheFourth,t._radiiToTheFourth),b.clone(e._oneOverRadii,t._oneOverRadii),b.clone(e._oneOverRadiiSquared,t._oneOverRadiiSquared),t._minimumRadius=e._minimumRadius,t._maximumRadius=e._maximumRadius,t._centerToleranceSquared=e._centerToleranceSquared,t):new it(n.x,n.y,n.z)},it.fromCartesian3=function(e,t){return _(t)||(t=new it),_(e)&&F5(t,e.x,e.y,e.z),t},it.WGS84=Object.freeze(new it(6378137,6378137,6356752314245179e-9)),it.UNIT_SPHERE=Object.freeze(new it(1,1,1)),it.MOON=Object.freeze(new it(U.LUNAR_RADIUS,U.LUNAR_RADIUS,U.LUNAR_RADIUS)),it.MARS=Object.freeze(new it(3396190,3396190,3376200)),it._default=it.WGS84,Object.defineProperties(it,{default:{get:function(){return it._default},set:function(e){T.typeOf.object("value",e),it._default=e,b._ellipsoidRadiiSquared=e.radiiSquared,Ce._ellipsoidOneOverRadii=e.oneOverRadii,Ce._ellipsoidOneOverRadiiSquared=e.oneOverRadiiSquared,Ce._ellipsoidCenterToleranceSquared=e._centerToleranceSquared}}}),it.prototype.clone=function(e){return it.clone(this,e)},it.packedLength=b.packedLength,it.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=n??0,b.pack(e._radii,t,n),t},it.unpack=function(e,t,n){T.defined("array",e),t=t??0;const i=b.unpack(e,t);return it.fromCartesian3(i,n)},it.prototype.geocentricSurfaceNormal=b.normalize,it.prototype.geodeticSurfaceNormalCartographic=function(e,t){T.typeOf.object("cartographic",e);const n=e.longitude,i=e.latitude,r=Math.cos(i),o=r*Math.cos(n),s=r*Math.sin(n),a=Math.sin(i);return _(t)||(t=new b),t.x=o,t.y=s,t.z=a,b.normalize(t,t)},it.prototype.geodeticSurfaceNormal=function(e,t){if(T.typeOf.object("cartesian",e),isNaN(e.x)||isNaN(e.y)||isNaN(e.z))throw new F("cartesian has a NaN component");if(!b.equalsEpsilon(e,b.ZERO,U.EPSILON14))return _(t)||(t=new b),t=b.multiplyComponents(e,this._oneOverRadiiSquared,t),b.normalize(t,t)};const Vse=new b,Fse=new b;it.prototype.cartographicToCartesian=function(e,t){const n=Vse,i=Fse;this.geodeticSurfaceNormalCartographic(e,n),b.multiplyComponents(this._radiiSquared,n,i);const r=Math.sqrt(b.dot(n,i));return b.divideByScalar(i,r,i),b.multiplyByScalar(n,e.height,n),_(t)||(t=new b),b.add(i,n,t)},it.prototype.cartographicArrayToCartesianArray=function(e,t){T.defined("cartographics",e);const n=e.length;_(t)?t.length=n:t=new Array(n);for(let i=0;i<n;i++)t[i]=this.cartographicToCartesian(e[i],t[i]);return t};const Ase=new b,zse=new b,Nse=new b;it.prototype.cartesianToCartographic=function(e,t){const n=this.scaleToGeodeticSurface(e,zse);if(!_(n))return;const i=this.geodeticSurfaceNormal(n,Ase),r=b.subtract(e,n,Nse),o=Math.atan2(i.y,i.x),s=Math.asin(i.z),a=U.sign(b.dot(r,e))*b.magnitude(r);return _(t)?(t.longitude=o,t.latitude=s,t.height=a,t):new Ce(o,s,a)},it.prototype.cartesianArrayToCartographicArray=function(e,t){T.defined("cartesians",e);const n=e.length;_(t)?t.length=n:t=new Array(n);for(let i=0;i<n;++i)t[i]=this.cartesianToCartographic(e[i],t[i]);return t},it.prototype.scaleToGeodeticSurface=function(e,t){return V5(e,this._oneOverRadii,this._oneOverRadiiSquared,this._centerToleranceSquared,t)},it.prototype.scaleToGeocentricSurface=function(e,t){T.typeOf.object("cartesian",e),_(t)||(t=new b);const n=e.x,i=e.y,r=e.z,o=this._oneOverRadiiSquared,s=1/Math.sqrt(n*n*o.x+i*i*o.y+r*r*o.z);return b.multiplyByScalar(e,s,t)},it.prototype.transformPositionToScaledSpace=function(e,t){return _(t)||(t=new b),b.multiplyComponents(e,this._oneOverRadii,t)},it.prototype.transformPositionFromScaledSpace=function(e,t){return _(t)||(t=new b),b.multiplyComponents(e,this._radii,t)},it.prototype.equals=function(e){return this===e||_(e)&&b.equals(this._radii,e._radii)},it.prototype.toString=function(){return this._radii.toString()},it.prototype.getSurfaceNormalIntersectionWithZAxis=function(e,t,n){if(T.typeOf.object("position",e),!U.equalsEpsilon(this._radii.x,this._radii.y,U.EPSILON15))throw new F("Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)");T.typeOf.number.greaterThan("Ellipsoid.radii.z",this._radii.z,0),t=t??0;const i=this._squaredXOverSquaredZ;if(_(n)||(n=new b),n.x=0,n.y=0,n.z=e.z*(1-i),!(Math.abs(n.z)>=this._radii.z-t))return n};const kse=new b;it.prototype.getLocalCurvature=function(e,t){T.typeOf.object("surfacePosition",e),_(t)||(t=new me);const n=this.getSurfaceNormalIntersectionWithZAxis(e,0,kse),i=b.distance(e,n),r=this.minimumRadius*i/this.maximumRadius**2,o=i*r**2;return me.fromElements(1/i,1/o,t)};const Xse=[.14887433898163,.43339539412925,.67940956829902,.86506336668898,.97390652851717,0],Zse=[.29552422471475,.26926671930999,.21908636251598,.14945134915058,.066671344308684,0];function A5(e,t,n){T.typeOf.number("a",e),T.typeOf.number("b",t),T.typeOf.func("func",n);const i=.5*(t+e),r=.5*(t-e);let o=0;for(let s=0;s<5;s++){const a=r*Xse[s];o+=Zse[s]*(n(i+a)+n(i-a))}return o*=r,o}it.prototype.surfaceArea=function(e){T.typeOf.object("rectangle",e);const t=e.west;let n=e.east;const i=e.south,r=e.north;for(;n<t;)n+=U.TWO_PI;const o=this._radiiSquared,s=o.x,a=o.y,c=o.z,l=s*a;return A5(i,r,function(u){const h=Math.cos(u),d=Math.sin(u);return Math.cos(u)*A5(t,n,function(f){const p=Math.cos(f),m=Math.sin(f);return Math.sqrt(l*d*d+c*(a*p*p+s*m*m)*h*h)})})};function Jo(e){this._ellipsoid=e??it.default,this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}Object.defineProperties(Jo.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),Jo.prototype.project=function(e,t){const n=this._semimajorAxis,i=e.longitude*n,r=e.latitude*n,o=e.height;return _(t)?(t.x=i,t.y=r,t.z=o,t):new b(i,r,o)},Jo.prototype.unproject=function(e,t){if(!_(e))throw new F("cartesian is required");const n=this._oneOverSemimajorAxis,i=e.x*n,r=e.y*n,o=e.z;return _(t)?(t.longitude=i,t.latitude=r,t.height=o,t):new Ce(i,r,o)};const ii=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1});class Me{constructor(t,n,i,r){this.x=t??0,this.y=n??0,this.z=i??0,this.w=r??0}static fromElements(t,n,i,r,o){return _(o)?(o.x=t,o.y=n,o.z=i,o.w=r,o):new Me(t,n,i,r)}static fromColor(t,n){return T.typeOf.object("color",t),_(n)?(n.x=t.red,n.y=t.green,n.z=t.blue,n.w=t.alpha,n):new Me(t.red,t.green,t.blue,t.alpha)}static clone(t,n){if(_(t))return _(n)?(n.x=t.x,n.y=t.y,n.z=t.z,n.w=t.w,n):new Me(t.x,t.y,t.z,t.w)}static pack(t,n,i){return T.typeOf.object("value",t),T.defined("array",n),i=i??0,n[i++]=t.x,n[i++]=t.y,n[i++]=t.z,n[i]=t.w,n}static unpack(t,n,i){return T.defined("array",t),n=n??0,_(i)||(i=new Me),i.x=t[n++],i.y=t[n++],i.z=t[n++],i.w=t[n],i}static packArray(t,n){T.defined("array",t);const i=t.length,r=i*4;if(!_(n))n=new Array(r);else{if(!Array.isArray(n)&&n.length!==r)throw new F("If result is a typed array, it must have exactly array.length * 4 elements");n.length!==r&&(n.length=r)}for(let o=0;o<i;++o)Me.pack(t[o],n,o*4);return n}static unpackArray(t,n){if(T.defined("array",t),T.typeOf.number.greaterThanOrEquals("array.length",t.length,4),t.length%4!==0)throw new F("array length must be a multiple of 4.");const i=t.length;_(n)?n.length=i/4:n=new Array(i/4);for(let r=0;r<i;r+=4){const o=r/4;n[o]=Me.unpack(t,r,n[o])}return n}static maximumComponent(t){return T.typeOf.object("cartesian",t),Math.max(t.x,t.y,t.z,t.w)}static minimumComponent(t){return T.typeOf.object("cartesian",t),Math.min(t.x,t.y,t.z,t.w)}static minimumByComponent(t,n,i){return T.typeOf.object("first",t),T.typeOf.object("second",n),T.typeOf.object("result",i),i.x=Math.min(t.x,n.x),i.y=Math.min(t.y,n.y),i.z=Math.min(t.z,n.z),i.w=Math.min(t.w,n.w),i}static maximumByComponent(t,n,i){return T.typeOf.object("first",t),T.typeOf.object("second",n),T.typeOf.object("result",i),i.x=Math.max(t.x,n.x),i.y=Math.max(t.y,n.y),i.z=Math.max(t.z,n.z),i.w=Math.max(t.w,n.w),i}static clamp(t,n,i,r){T.typeOf.object("value",t),T.typeOf.object("min",n),T.typeOf.object("max",i),T.typeOf.object("result",r);const o=U.clamp(t.x,n.x,i.x),s=U.clamp(t.y,n.y,i.y),a=U.clamp(t.z,n.z,i.z),c=U.clamp(t.w,n.w,i.w);return r.x=o,r.y=s,r.z=a,r.w=c,r}static magnitudeSquared(t){return T.typeOf.object("cartesian",t),t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w}static magnitude(t){return Math.sqrt(Me.magnitudeSquared(t))}static distance(t,n){return T.typeOf.object("left",t),T.typeOf.object("right",n),Me.subtract(t,n,ng),Me.magnitude(ng)}static distanceSquared(t,n){return T.typeOf.object("left",t),T.typeOf.object("right",n),Me.subtract(t,n,ng),Me.magnitudeSquared(ng)}static normalize(t,n){T.typeOf.object("cartesian",t),T.typeOf.object("result",n);const i=Me.magnitude(t);if(n.x=t.x/i,n.y=t.y/i,n.z=t.z/i,n.w=t.w/i,isNaN(n.x)||isNaN(n.y)||isNaN(n.z)||isNaN(n.w))throw new F("normalized result is not a number");return n}static dot(t,n){return T.typeOf.object("left",t),T.typeOf.object("right",n),t.x*n.x+t.y*n.y+t.z*n.z+t.w*n.w}static multiplyComponents(t,n,i){return T.typeOf.object("left",t),T.typeOf.object("right",n),T.typeOf.object("result",i),i.x=t.x*n.x,i.y=t.y*n.y,i.z=t.z*n.z,i.w=t.w*n.w,i}static divideComponents(t,n,i){return T.typeOf.object("left",t),T.typeOf.object("right",n),T.typeOf.object("result",i),i.x=t.x/n.x,i.y=t.y/n.y,i.z=t.z/n.z,i.w=t.w/n.w,i}static add(t,n,i){return T.typeOf.object("left",t),T.typeOf.object("right",n),T.typeOf.object("result",i),i.x=t.x+n.x,i.y=t.y+n.y,i.z=t.z+n.z,i.w=t.w+n.w,i}static subtract(t,n,i){return T.typeOf.object("left",t),T.typeOf.object("right",n),T.typeOf.object("result",i),i.x=t.x-n.x,i.y=t.y-n.y,i.z=t.z-n.z,i.w=t.w-n.w,i}static multiplyByScalar(t,n,i){return T.typeOf.object("cartesian",t),T.typeOf.number("scalar",n),T.typeOf.object("result",i),i.x=t.x*n,i.y=t.y*n,i.z=t.z*n,i.w=t.w*n,i}static divideByScalar(t,n,i){return T.typeOf.object("cartesian",t),T.typeOf.number("scalar",n),T.typeOf.object("result",i),i.x=t.x/n,i.y=t.y/n,i.z=t.z/n,i.w=t.w/n,i}static negate(t,n){return T.typeOf.object("cartesian",t),T.typeOf.object("result",n),n.x=-t.x,n.y=-t.y,n.z=-t.z,n.w=-t.w,n}static abs(t,n){return T.typeOf.object("cartesian",t),T.typeOf.object("result",n),n.x=Math.abs(t.x),n.y=Math.abs(t.y),n.z=Math.abs(t.z),n.w=Math.abs(t.w),n}static lerp(t,n,i,r){return T.typeOf.object("start",t),T.typeOf.object("end",n),T.typeOf.number("t",i),T.typeOf.object("result",r),Me.multiplyByScalar(n,i,z5),r=Me.multiplyByScalar(t,1-i,r),Me.add(z5,r,r)}static mostOrthogonalAxis(t,n){T.typeOf.object("cartesian",t),T.typeOf.object("result",n);const i=Me.normalize(t,Dse);return Me.abs(i,i),i.x<=i.y?i.x<=i.z?i.x<=i.w?n=Me.clone(Me.UNIT_X,n):n=Me.clone(Me.UNIT_W,n):i.z<=i.w?n=Me.clone(Me.UNIT_Z,n):n=Me.clone(Me.UNIT_W,n):i.y<=i.z?i.y<=i.w?n=Me.clone(Me.UNIT_Y,n):n=Me.clone(Me.UNIT_W,n):i.z<=i.w?n=Me.clone(Me.UNIT_Z,n):n=Me.clone(Me.UNIT_W,n),n}static equals(t,n){return t===n||_(t)&&_(n)&&t.x===n.x&&t.y===n.y&&t.z===n.z&&t.w===n.w}static equalsArray(t,n,i){return t.x===n[i]&&t.y===n[i+1]&&t.z===n[i+2]&&t.w===n[i+3]}static equalsEpsilon(t,n,i,r){return t===n||_(t)&&_(n)&&U.equalsEpsilon(t.x,n.x,i,r)&&U.equalsEpsilon(t.y,n.y,i,r)&&U.equalsEpsilon(t.z,n.z,i,r)&&U.equalsEpsilon(t.w,n.w,i,r)}clone(t){return Me.clone(this,t)}equals(t){return Me.equals(this,t)}equalsEpsilon(t,n,i){return Me.equalsEpsilon(this,t,n,i)}toString(){return`(${this.x}, ${this.y}, ${this.z}, ${this.w})`}static packFloat(t,n){return T.typeOf.number("value",t),_(n)||(n=new Me),qv[0]=t,N5?(n.x=Yi[0],n.y=Yi[1],n.z=Yi[2],n.w=Yi[3]):(n.x=Yi[3],n.y=Yi[2],n.z=Yi[1],n.w=Yi[0]),n}static unpackFloat(t){return T.typeOf.object("packedFloat",t),N5?(Yi[0]=t.x,Yi[1]=t.y,Yi[2]=t.z,Yi[3]=t.w):(Yi[0]=t.w,Yi[1]=t.z,Yi[2]=t.y,Yi[3]=t.x),qv[0]}}Me.packedLength=4,Me.fromArray=Me.unpack;const ng=new Me,z5=new Me,Dse=new Me;Me.ZERO=Object.freeze(new Me(0,0,0,0)),Me.ONE=Object.freeze(new Me(1,1,1,1)),Me.UNIT_X=Object.freeze(new Me(1,0,0,0)),Me.UNIT_Y=Object.freeze(new Me(0,1,0,0)),Me.UNIT_Z=Object.freeze(new Me(0,0,1,0)),Me.UNIT_W=Object.freeze(new Me(0,0,0,1));const qv=new Float32Array(1),Yi=new Uint8Array(qv.buffer),Use=new Uint32Array([287454020]),N5=new Uint8Array(Use.buffer)[0]===68;function pf(e,t,n){T.defined("array",e),T.defined("itemToFind",t),T.defined("comparator",n);let i=0,r=e.length-1,o,s;for(;i<=r;){if(o=~~((i+r)/2),s=n(e[o],t),s<0){i=o+1;continue}if(s>0){r=o-1;continue}return o}return~(r+1)}function $v(e,t,n,i,r){this.xPoleWander=e,this.yPoleWander=t,this.xPoleOffset=n,this.yPoleOffset=i,this.ut1MinusUtc=r}function ew(e){if(e===null||isNaN(e))throw new F("year is required and must be a number.");return e%4===0&&e%100!==0||e%400===0}const k5=[31,28,31,30,31,30,31,31,30,31,30,31];function tw(e,t,n,i,r,o,s,a){e=e??1,t=t??1,n=n??1,i=i??0,r=r??0,o=o??0,s=s??0,a=a??!1,m(),y(),this.year=e,this.month=t,this.day=n,this.hour=i,this.minute=r,this.second=o,this.millisecond=s,this.isLeapSecond=a;function m(){T.typeOf.number.greaterThanOrEquals("Year",e,1),T.typeOf.number.lessThanOrEquals("Year",e,9999),T.typeOf.number.greaterThanOrEquals("Month",t,1),T.typeOf.number.lessThanOrEquals("Month",t,12),T.typeOf.number.greaterThanOrEquals("Day",n,1),T.typeOf.number.lessThanOrEquals("Day",n,31),T.typeOf.number.greaterThanOrEquals("Hour",i,0),T.typeOf.number.lessThanOrEquals("Hour",i,23),T.typeOf.number.greaterThanOrEquals("Minute",r,0),T.typeOf.number.lessThanOrEquals("Minute",r,59),T.typeOf.bool("IsLeapSecond",a),T.typeOf.number.greaterThanOrEquals("Second",o,0),T.typeOf.number.lessThanOrEquals("Second",o,a?60:59),T.typeOf.number.greaterThanOrEquals("Millisecond",s,0),T.typeOf.number.lessThan("Millisecond",s,1e3)}function y(){const g=t===2&&ew(e)?k5[t-1]+1:k5[t-1];if(n>g)throw new F("Month and Day represents invalid date")}}function ln(e,t){this.julianDate=e,this.offset=t}const Fn=Object.freeze({SECONDS_PER_MILLISECOND:.001,SECONDS_PER_MINUTE:60,MINUTES_PER_HOUR:60,HOURS_PER_DAY:24,SECONDS_PER_HOUR:3600,MINUTES_PER_DAY:1440,SECONDS_PER_DAY:86400,DAYS_PER_JULIAN_CENTURY:36525,PICOSECOND:1e-9,MODIFIED_JULIAN_DATE_DIFFERENCE:24000005e-1}),Ft=Object.freeze({UTC:0,TAI:1}),X5=new tw,ig=[31,28,31,30,31,30,31,31,30,31,30,31],rg=29;function nw(e,t){return Fe.compare(e.julianDate,t.julianDate)}const Ku=new ln;function og(e){Ku.julianDate=e;const t=Fe.leapSeconds;let n=pf(t,Ku,nw);n<0&&(n=~n),n>=t.length&&(n=t.length-1);let i=t[n].offset;n>0&&Fe.secondsDifference(t[n].julianDate,e)>i&&(n--,i=t[n].offset),Fe.addSeconds(e,i,e)}function Z5(e,t){Ku.julianDate=e;const n=Fe.leapSeconds;let i=pf(n,Ku,nw);if(i<0&&(i=~i),i===0)return Fe.addSeconds(e,-n[0].offset,t);if(i>=n.length)return Fe.addSeconds(e,-n[i-1].offset,t);const r=Fe.secondsDifference(n[i].julianDate,e);if(r===0)return Fe.addSeconds(e,-n[i].offset,t);if(!(r<=1))return Fe.addSeconds(e,-n[--i].offset,t)}function pc(e,t,n){const i=t/Fn.SECONDS_PER_DAY|0;return e+=i,t-=Fn.SECONDS_PER_DAY*i,t<0&&(e--,t+=Fn.SECONDS_PER_DAY),n.dayNumber=e,n.secondsOfDay=t,n}function iw(e,t,n,i,r,o,s){const a=(t-14)/12|0,c=e+4800+a;let l=(1461*c/4|0)+(367*(t-2-12*a)/12|0)-(3*((c+100)/100|0)/4|0)+n-32075;i=i-12,i<0&&(i+=24);const u=o+(i*Fn.SECONDS_PER_HOUR+r*Fn.SECONDS_PER_MINUTE+s*Fn.SECONDS_PER_MILLISECOND);return u>=43200&&(l-=1),[l,u]}const Wse=/^(\d{4})$/,Bse=/^(\d{4})-(\d{2})$/,Yse=/^(\d{4})-?(\d{3})$/,Hse=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,jse=/^(\d{4})-?(\d{2})-?(\d{2})$/,rw=/([Z+\-])?(\d{2})?:?(\d{2})?$/,Kse=/^(\d{2})(\.\d+)?/.source+rw.source,Jse=/^(\d{2}):?(\d{2})(\.\d+)?/.source+rw.source,Qse=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+rw.source,Qo="Invalid ISO 8601 date.";function Fe(e,t,n){this.dayNumber=void 0,this.secondsOfDay=void 0,e=e??0,t=t??0,n=n??Ft.UTC;const i=e|0;t=t+(e-i)*Fn.SECONDS_PER_DAY,pc(i,t,this),n===Ft.UTC&&og(this)}Fe.fromGregorianDate=function(e,t){if(!(e instanceof tw))throw new F("date must be a valid GregorianDate.");const n=iw(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond);return _(t)?(pc(n[0],n[1],t),og(t),t):new Fe(n[0],n[1],Ft.UTC)},Fe.fromDate=function(e,t){if(!(e instanceof Date)||isNaN(e.getTime()))throw new F("date must be a valid JavaScript Date.");const n=iw(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds());return _(t)?(pc(n[0],n[1],t),og(t),t):new Fe(n[0],n[1],Ft.UTC)},Fe.fromIso8601=function(e,t){if(typeof e!="string")throw new F(Qo);e=e.replace(",",".");let n=e.split("T"),i,r=1,o=1,s=0,a=0,c=0,l=0;const u=n[0],h=n[1];let d,f;if(!_(u))throw new F(Qo);let p;if(n=u.match(jse),n!==null){if(p=u.split("-").length-1,p>0&&p!==2)throw new F(Qo);i=+n[1],r=+n[2],o=+n[3]}else if(n=u.match(Bse),n!==null)i=+n[1],r=+n[2];else if(n=u.match(Wse),n!==null)i=+n[1];else{let v;if(n=u.match(Yse),n!==null){if(i=+n[1],v=+n[2],f=ew(i),v<1||f&&v>366||!f&&v>365)throw new F(Qo)}else if(n=u.match(Hse),n!==null){i=+n[1];const S=+n[2],E=+n[3]||0;if(p=u.split("-").length-1,p>0&&(!_(n[3])&&p!==1||_(n[3])&&p!==2))throw new F(Qo);const C=new Date(Date.UTC(i,0,4));v=S*7+E-C.getUTCDay()-3}else throw new F(Qo);d=new Date(Date.UTC(i,0,1)),d.setUTCDate(v),r=d.getUTCMonth()+1,o=d.getUTCDate()}if(f=ew(i),r<1||r>12||o<1||(r!==2||!f)&&o>ig[r-1]||f&&r===2&&o>rg)throw new F(Qo);let m;if(_(h)){if(n=h.match(Qse),n!==null){if(p=h.split(":").length-1,p>0&&p!==2&&p!==3)throw new F(Qo);s=+n[1],a=+n[2],c=+n[3],l=+(n[4]||0)*1e3,m=5}else if(n=h.match(Jse),n!==null){if(p=h.split(":").length-1,p>2)throw new F(Qo);s=+n[1],a=+n[2],c=+(n[3]||0)*60,m=4}else if(n=h.match(Kse),n!==null)s=+n[1],a=+(n[2]||0)*60,m=3;else throw new F(Qo);if(a>=60||c>=61||s>24||s===24&&(a>0||c>0||l>0))throw new F(Qo);const v=n[m],S=+n[m+1],E=+(n[m+2]||0);switch(v){case"+":s=s-S,a=a-E;break;case"-":s=s+S,a=a+E;break;case"Z":break;default:a=a+new Date(Date.UTC(i,r-1,o,s,a)).getTimezoneOffset();break}}const y=c===60;for(y&&c--;a>=60;)a-=60,s++;for(;s>=24;)s-=24,o++;for(d=f&&r===2?rg:ig[r-1];o>d;)o-=d,r++,r>12&&(r-=12,i++),d=f&&r===2?rg:ig[r-1];for(;a<0;)a+=60,s--;for(;s<0;)s+=24,o--;for(;o<1;)r--,r<1&&(r+=12,i--),d=f&&r===2?rg:ig[r-1],o+=d;const g=iw(i,r,o,s,a,c,l);return _(t)?(pc(g[0],g[1],t),og(t)):t=new Fe(g[0],g[1],Ft.UTC),y&&Fe.addSeconds(t,1,t),t},Fe.now=function(e){return Fe.fromDate(new Date,e)};const sg=new Fe(0,0,Ft.TAI);Fe.toGregorianDate=function(e,t){if(!_(e))throw new F("julianDate is required.");let n=!1,i=Z5(e,sg);_(i)||(Fe.addSeconds(e,-1,sg),i=Z5(sg,sg),n=!0);let r=i.dayNumber;const o=i.secondsOfDay;o>=43200&&(r+=1);let s=r+68569|0;const a=4*s/146097|0;s=s-((146097*a+3)/4|0)|0;const c=4e3*(s+1)/1461001|0;s=s-(1461*c/4|0)+31|0;const l=80*s/2447|0,u=s-(2447*l/80|0)|0;s=l/11|0;const h=l+2-12*s|0,d=100*(a-49)+c+s|0;let f=o/Fn.SECONDS_PER_HOUR|0,p=o-f*Fn.SECONDS_PER_HOUR;const m=p/Fn.SECONDS_PER_MINUTE|0;p=p-m*Fn.SECONDS_PER_MINUTE;let y=p|0;const g=(p-y)/Fn.SECONDS_PER_MILLISECOND;return f+=12,f>23&&(f-=24),n&&(y+=1),_(t)?(t.year=d,t.month=h,t.day=u,t.hour=f,t.minute=m,t.second=y,t.millisecond=g,t.isLeapSecond=n,t):new tw(d,h,u,f,m,y,g,n)},Fe.toDate=function(e){if(!_(e))throw new F("julianDate is required.");const t=Fe.toGregorianDate(e,X5);let n=t.second;return t.isLeapSecond&&(n-=1),new Date(Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,n,t.millisecond))},Fe.toIso8601=function(e,t){if(!_(e))throw new F("julianDate is required.");const n=Fe.toGregorianDate(e,X5);let i=n.year,r=n.month,o=n.day,s=n.hour;const a=n.minute,c=n.second,l=n.millisecond;i===1e4&&r===1&&o===1&&s===0&&a===0&&c===0&&l===0&&(i=9999,r=12,o=31,s=24);let u;if(!_(t)&&l!==0){const h=l*.01;return u=h<1e-6?h.toFixed(20).replace(".","").replace(/0+$/,""):h.toString().replace(".",""),`${i.toString().padStart(4,"0")}-${r.toString().padStart(2,"0")}-${o.toString().padStart(2,"0")}T${s.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${c.toString().padStart(2,"0")}.${u}Z`}return!_(t)||t===0?`${i.toString().padStart(4,"0")}-${r.toString().padStart(2,"0")}-${o.toString().padStart(2,"0")}T${s.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${c.toString().padStart(2,"0")}Z`:(u=(l*.01).toFixed(t).replace(".","").slice(0,t),`${i.toString().padStart(4,"0")}-${r.toString().padStart(2,"0")}-${o.toString().padStart(2,"0")}T${s.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${c.toString().padStart(2,"0")}.${u}Z`)},Fe.clone=function(e,t){if(_(e))return _(t)?(t.dayNumber=e.dayNumber,t.secondsOfDay=e.secondsOfDay,t):new Fe(e.dayNumber,e.secondsOfDay,Ft.TAI)},Fe.compare=function(e,t){if(!_(e))throw new F("left is required.");if(!_(t))throw new F("right is required.");const n=e.dayNumber-t.dayNumber;return n!==0?n:e.secondsOfDay-t.secondsOfDay},Fe.equals=function(e,t){return e===t||_(e)&&_(t)&&e.dayNumber===t.dayNumber&&e.secondsOfDay===t.secondsOfDay},Fe.equalsEpsilon=function(e,t,n){return n=n??0,e===t||_(e)&&_(t)&&Math.abs(Fe.secondsDifference(e,t))<=n},Fe.totalDays=function(e){if(!_(e))throw new F("julianDate is required.");return e.dayNumber+e.secondsOfDay/Fn.SECONDS_PER_DAY},Fe.secondsDifference=function(e,t){if(!_(e))throw new F("left is required.");if(!_(t))throw new F("right is required.");return(e.dayNumber-t.dayNumber)*Fn.SECONDS_PER_DAY+(e.secondsOfDay-t.secondsOfDay)},Fe.daysDifference=function(e,t){if(!_(e))throw new F("left is required.");if(!_(t))throw new F("right is required.");const n=e.dayNumber-t.dayNumber,i=(e.secondsOfDay-t.secondsOfDay)/Fn.SECONDS_PER_DAY;return n+i},Fe.computeTaiMinusUtc=function(e){Ku.julianDate=e;const t=Fe.leapSeconds;let n=pf(t,Ku,nw);return n<0&&(n=~n,--n,n<0&&(n=0)),t[n].offset},Fe.addSeconds=function(e,t,n){if(!_(e))throw new F("julianDate is required.");if(!_(t))throw new F("seconds is required.");if(!_(n))throw new F("result is required.");return pc(e.dayNumber,e.secondsOfDay+t,n)},Fe.addMinutes=function(e,t,n){if(!_(e))throw new F("julianDate is required.");if(!_(t))throw new F("minutes is required.");if(!_(n))throw new F("result is required.");const i=e.secondsOfDay+t*Fn.SECONDS_PER_MINUTE;return pc(e.dayNumber,i,n)},Fe.addHours=function(e,t,n){if(!_(e))throw new F("julianDate is required.");if(!_(t))throw new F("hours is required.");if(!_(n))throw new F("result is required.");const i=e.secondsOfDay+t*Fn.SECONDS_PER_HOUR;return pc(e.dayNumber,i,n)},Fe.addDays=function(e,t,n){if(!_(e))throw new F("julianDate is required.");if(!_(t))throw new F("days is required.");if(!_(n))throw new F("result is required.");const i=e.dayNumber+t;return pc(i,e.secondsOfDay,n)},Fe.lessThan=function(e,t){return Fe.compare(e,t)<0},Fe.lessThanOrEquals=function(e,t){return Fe.compare(e,t)<=0},Fe.greaterThan=function(e,t){return Fe.compare(e,t)>0},Fe.greaterThanOrEquals=function(e,t){return Fe.compare(e,t)>=0},Fe.prototype.clone=function(e){return Fe.clone(this,e)},Fe.prototype.equals=function(e){return Fe.equals(this,e)},Fe.prototype.equalsEpsilon=function(e,t){return Fe.equalsEpsilon(this,e,t)},Fe.prototype.toString=function(){return Fe.toIso8601(this)},Fe.leapSeconds=[new ln(new Fe(2441317,43210,Ft.TAI),10),new ln(new Fe(2441499,43211,Ft.TAI),11),new ln(new Fe(2441683,43212,Ft.TAI),12),new ln(new Fe(2442048,43213,Ft.TAI),13),new ln(new Fe(2442413,43214,Ft.TAI),14),new ln(new Fe(2442778,43215,Ft.TAI),15),new ln(new Fe(2443144,43216,Ft.TAI),16),new ln(new Fe(2443509,43217,Ft.TAI),17),new ln(new Fe(2443874,43218,Ft.TAI),18),new ln(new Fe(2444239,43219,Ft.TAI),19),new ln(new Fe(2444786,43220,Ft.TAI),20),new ln(new Fe(2445151,43221,Ft.TAI),21),new ln(new Fe(2445516,43222,Ft.TAI),22),new ln(new Fe(2446247,43223,Ft.TAI),23),new ln(new Fe(2447161,43224,Ft.TAI),24),new ln(new Fe(2447892,43225,Ft.TAI),25),new ln(new Fe(2448257,43226,Ft.TAI),26),new ln(new Fe(2448804,43227,Ft.TAI),27),new ln(new Fe(2449169,43228,Ft.TAI),28),new ln(new Fe(2449534,43229,Ft.TAI),29),new ln(new Fe(2450083,43230,Ft.TAI),30),new ln(new Fe(2450630,43231,Ft.TAI),31),new ln(new Fe(2451179,43232,Ft.TAI),32),new ln(new Fe(2453736,43233,Ft.TAI),33),new ln(new Fe(2454832,43234,Ft.TAI),34),new ln(new Fe(2456109,43235,Ft.TAI),35),new ln(new Fe(2457204,43236,Ft.TAI),36),new ln(new Fe(2457754,43237,Ft.TAI),37)];var ag={exports:{}},mf={exports:{}};var qse=mf.exports,D5;function $se(){return D5||(D5=1,(function(e,t){(function(n){var i=t&&!t.nodeType&&t,r=e&&!e.nodeType&&e,o=typeof el=="object"&&el;(o.global===o||o.window===o||o.self===o)&&(n=o);var s,a=2147483647,c=36,l=1,u=26,h=38,d=700,f=72,p=128,m="-",y=/^xn--/,g=/[^\x20-\x7E]/,v=/[\x2E\u3002\uFF0E\uFF61]/g,S={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},E=c-l,C=Math.floor,O=String.fromCharCode,V;function A(J){throw new RangeError(S[J])}function G(J,z){for(var W=J.length,Q=[];W--;)Q[W]=z(J[W]);return Q}function N(J,z){var W=J.split("@"),Q="";W.length>1&&(Q=W[0]+"@",J=W[1]),J=J.replace(v,".");var q=J.split("."),oe=G(q,z).join(".");return Q+oe}function k(J){for(var z=[],W=0,Q=J.length,q,oe;W<Q;)q=J.charCodeAt(W++),q>=55296&&q<=56319&&W<Q?(oe=J.charCodeAt(W++),(oe&64512)==56320?z.push(((q&1023)<<10)+(oe&1023)+65536):(z.push(q),W--)):z.push(q);return z}function P(J){return G(J,function(z){var W="";return z>65535&&(z-=65536,W+=O(z>>>10&1023|55296),z=56320|z&1023),W+=O(z),W}).join("")}function w(J){return J-48<10?J-22:J-65<26?J-65:J-97<26?J-97:c}function x(J,z){return J+22+75*(J<26)-((z!=0)<<5)}function I(J,z,W){var Q=0;for(J=W?C(J/d):J>>1,J+=C(J/z);J>E*u>>1;Q+=c)J=C(J/E);return C(Q+(E+1)*J/(J+h))}function X(J){var z=[],W=J.length,Q,q=0,oe=p,Ee=f,be,Ae,Pe,fe,Xe,tt,nt,Z,pe;for(be=J.lastIndexOf(m),be<0&&(be=0),Ae=0;Ae<be;++Ae)J.charCodeAt(Ae)>=128&&A("not-basic"),z.push(J.charCodeAt(Ae));for(Pe=be>0?be+1:0;Pe<W;){for(fe=q,Xe=1,tt=c;Pe>=W&&A("invalid-input"),nt=w(J.charCodeAt(Pe++)),(nt>=c||nt>C((a-q)/Xe))&&A("overflow"),q+=nt*Xe,Z=tt<=Ee?l:tt>=Ee+u?u:tt-Ee,!(nt<Z);tt+=c)pe=c-Z,Xe>C(a/pe)&&A("overflow"),Xe*=pe;Q=z.length+1,Ee=I(q-fe,Q,fe==0),C(q/Q)>a-oe&&A("overflow"),oe+=C(q/Q),q%=Q,z.splice(q++,0,oe)}return P(z)}function D(J){var z,W,Q,q,oe,Ee,be,Ae,Pe,fe,Xe,tt=[],nt,Z,pe,ue;for(J=k(J),nt=J.length,z=p,W=0,oe=f,Ee=0;Ee<nt;++Ee)Xe=J[Ee],Xe<128&&tt.push(O(Xe));for(Q=q=tt.length,q&&tt.push(m);Q<nt;){for(be=a,Ee=0;Ee<nt;++Ee)Xe=J[Ee],Xe>=z&&Xe<be&&(be=Xe);for(Z=Q+1,be-z>C((a-W)/Z)&&A("overflow"),W+=(be-z)*Z,z=be,Ee=0;Ee<nt;++Ee)if(Xe=J[Ee],Xe<z&&++W>a&&A("overflow"),Xe==z){for(Ae=W,Pe=c;fe=Pe<=oe?l:Pe>=oe+u?u:Pe-oe,!(Ae<fe);Pe+=c)ue=Ae-fe,pe=c-fe,tt.push(O(x(fe+ue%pe,0))),Ae=C(ue/pe);tt.push(O(x(Ae,0))),oe=I(W,Z,Q==q),W=0,++Q}++W,++z}return tt.join("")}function Y(J){return N(J,function(z){return y.test(z)?X(z.slice(4).toLowerCase()):z})}function H(J){return N(J,function(z){return g.test(z)?"xn--"+D(z):z})}if(s={version:"1.3.2",ucs2:{decode:k,encode:P},decode:X,encode:D,toASCII:H,toUnicode:Y},i&&r)if(e.exports==i)r.exports=s;else for(V in s)s.hasOwnProperty(V)&&(i[V]=s[V]);else n.punycode=s})(qse)})(mf,mf.exports)),mf.exports}var cg={exports:{}};var eae=cg.exports,U5;function tae(){return U5||(U5=1,(function(e){(function(t,n){e.exports?e.exports=n():t.IPv6=n(t)})(eae,function(t){var n=t&&t.IPv6;function i(o){var s=o.toLowerCase(),a=s.split(":"),c=a.length,l=8;a[0]===""&&a[1]===""&&a[2]===""?(a.shift(),a.shift()):a[0]===""&&a[1]===""?a.shift():a[c-1]===""&&a[c-2]===""&&a.pop(),c=a.length,a[c-1].indexOf(".")!==-1&&(l=7);var u;for(u=0;u<c&&a[u]!=="";u++);if(u<l)for(a.splice(u,1,"0000");a.length<l;)a.splice(u,0,"0000");for(var h,d=0;d<l;d++){h=a[d].split("");for(var f=0;f<3&&(h[0]==="0"&&h.length>1);f++)h.splice(0,1);a[d]=h.join("")}var p=-1,m=0,y=0,g=-1,v=!1;for(d=0;d<l;d++)v?a[d]==="0"?y+=1:(v=!1,y>m&&(p=g,m=y)):a[d]==="0"&&(v=!0,g=d,y=1);y>m&&(p=g,m=y),m>1&&a.splice(p,m,""),c=a.length;var S="";for(a[0]===""&&(S=":"),d=0;d<c&&(S+=a[d],d!==c-1);d++)S+=":";return a[c-1]===""&&(S+=":"),S}function r(){return t.IPv6===this&&(t.IPv6=n),this}return{best:i,noConflict:r}})})(cg)),cg.exports}var lg={exports:{}};var nae=lg.exports,W5;function iae(){return W5||(W5=1,(function(e){(function(t,n){e.exports?e.exports=n():t.SecondLevelDomains=n(t)})(nae,function(t){var n=t&&t.SecondLevelDomains,i={list:{ac:" com gov mil net org ",ae:" ac co gov mil name net org pro sch ",af:" com edu gov net org ",al:" com edu gov mil net org ",ao:" co ed gv it og pb ",ar:" com edu gob gov int mil net org tur ",at:" ac co gv or ",au:" asn com csiro edu gov id net org ",ba:" co com edu gov mil net org rs unbi unmo unsa untz unze ",bb:" biz co com edu gov info net org store tv ",bh:" biz cc com edu gov info net org ",bn:" com edu gov net org ",bo:" com edu gob gov int mil net org tv ",br:" adm adv agr am arq art ato b bio blog bmd cim cng cnt com coop ecn edu eng esp etc eti far flog fm fnd fot fst g12 ggf gov imb ind inf jor jus lel mat med mil mus net nom not ntr odo org ppg pro psc psi qsl rec slg srv tmp trd tur tv vet vlog wiki zlg ",bs:" com edu gov net org ",bz:" du et om ov rg ",ca:" ab bc mb nb nf nl ns nt nu on pe qc sk yk ",ck:" biz co edu gen gov info net org ",cn:" ac ah bj com cq edu fj gd gov gs gx gz ha hb he hi hl hn jl js jx ln mil net nm nx org qh sc sd sh sn sx tj tw xj xz yn zj ",co:" com edu gov mil net nom org ",cr:" ac c co ed fi go or sa ",cy:" ac biz com ekloges gov ltd name net org parliament press pro tm ",do:" art com edu gob gov mil net org sld web ",dz:" art asso com edu gov net org pol ",ec:" com edu fin gov info med mil net org pro ",eg:" com edu eun gov mil name net org sci ",er:" com edu gov ind mil net org rochest w ",es:" com edu gob nom org ",et:" biz com edu gov info name net org ",fj:" ac biz com info mil name net org pro ",fk:" ac co gov net nom org ",fr:" asso com f gouv nom prd presse tm ",gg:" co net org ",gh:" com edu gov mil org ",gn:" ac com gov net org ",gr:" com edu gov mil net org ",gt:" com edu gob ind mil net org ",gu:" com edu gov net org ",hk:" com edu gov idv net org ",hu:" 2000 agrar bolt casino city co erotica erotika film forum games hotel info ingatlan jogasz konyvelo lakas media news org priv reklam sex shop sport suli szex tm tozsde utazas video ",id:" ac co go mil net or sch web ",il:" ac co gov idf k12 muni net org ",in:" ac co edu ernet firm gen gov i ind mil net nic org res ",iq:" com edu gov i mil net org ",ir:" ac co dnssec gov i id net org sch ",it:" edu gov ",je:" co net org ",jo:" com edu gov mil name net org sch ",jp:" ac ad co ed go gr lg ne or ",ke:" ac co go info me mobi ne or sc ",kh:" com edu gov mil net org per ",ki:" biz com de edu gov info mob net org tel ",km:" asso com coop edu gouv k medecin mil nom notaires pharmaciens presse tm veterinaire ",kn:" edu gov net org ",kr:" ac busan chungbuk chungnam co daegu daejeon es gangwon go gwangju gyeongbuk gyeonggi gyeongnam hs incheon jeju jeonbuk jeonnam k kg mil ms ne or pe re sc seoul ulsan ",kw:" com edu gov net org ",ky:" com edu gov net org ",kz:" com edu gov mil net org ",lb:" com edu gov net org ",lk:" assn com edu gov grp hotel int ltd net ngo org sch soc web ",lr:" com edu gov net org ",lv:" asn com conf edu gov id mil net org ",ly:" com edu gov id med net org plc sch ",ma:" ac co gov m net org press ",mc:" asso tm ",me:" ac co edu gov its net org priv ",mg:" com edu gov mil nom org prd tm ",mk:" com edu gov inf name net org pro ",ml:" com edu gov net org presse ",mn:" edu gov org ",mo:" com edu gov net org ",mt:" com edu gov net org ",mv:" aero biz com coop edu gov info int mil museum name net org pro ",mw:" ac co com coop edu gov int museum net org ",mx:" com edu gob net org ",my:" com edu gov mil name net org sch ",nf:" arts com firm info net other per rec store web ",ng:" biz com edu gov mil mobi name net org sch ",ni:" ac co com edu gob mil net nom org ",np:" com edu gov mil net org ",nr:" biz com edu gov info net org ",om:" ac biz co com edu gov med mil museum net org pro sch ",pe:" com edu gob mil net nom org sld ",ph:" com edu gov i mil net ngo org ",pk:" biz com edu fam gob gok gon gop gos gov net org web ",pl:" art bialystok biz com edu gda gdansk gorzow gov info katowice krakow lodz lublin mil net ngo olsztyn org poznan pwr radom slupsk szczecin torun warszawa waw wroc wroclaw zgora ",pr:" ac biz com edu est gov info isla name net org pro prof ",ps:" com edu gov net org plo sec ",pw:" belau co ed go ne or ",ro:" arts com firm info nom nt org rec store tm www ",rs:" ac co edu gov in org ",sb:" com edu gov net org ",sc:" com edu gov net org ",sh:" co com edu gov net nom org ",sl:" com edu gov net org ",st:" co com consulado edu embaixada gov mil net org principe saotome store ",sv:" com edu gob org red ",sz:" ac co org ",tr:" av bbs bel biz com dr edu gen gov info k12 name net org pol tel tsk tv web ",tt:" aero biz cat co com coop edu gov info int jobs mil mobi museum name net org pro tel travel ",tw:" club com ebiz edu game gov idv mil net org ",mu:" ac co com gov net or org ",mz:" ac co edu gov org ",na:" co com ",nz:" ac co cri geek gen govt health iwi maori mil net org parliament school ",pa:" abo ac com edu gob ing med net nom org sld ",pt:" com edu gov int net nome org publ ",py:" com edu gov mil net org ",qa:" com edu gov mil net org ",re:" asso com nom ",ru:" ac adygeya altai amur arkhangelsk astrakhan bashkiria belgorod bir bryansk buryatia cbg chel chelyabinsk chita chukotka chuvashia com dagestan e-burg edu gov grozny int irkutsk ivanovo izhevsk jar joshkar-ola kalmykia kaluga kamchatka karelia kazan kchr kemerovo khabarovsk khakassia khv kirov koenig komi kostroma kranoyarsk kuban kurgan kursk lipetsk magadan mari mari-el marine mil mordovia mosreg msk murmansk nalchik net nnov nov novosibirsk nsk omsk orenburg org oryol penza perm pp pskov ptz rnd ryazan sakhalin samara saratov simbirsk smolensk spb stavropol stv surgut tambov tatarstan tom tomsk tsaritsyn tsk tula tuva tver tyumen udm udmurtia ulan-ude vladikavkaz vladimir vladivostok volgograd vologda voronezh vrn vyatka yakutia yamal yekaterinburg yuzhno-sakhalinsk ",rw:" ac co com edu gouv gov int mil net ",sa:" com edu gov med net org pub sch ",sd:" com edu gov info med net org tv ",se:" a ac b bd c d e f g h i k l m n o org p parti pp press r s t tm u w x y z ",sg:" com edu gov idn net org per ",sn:" art com edu gouv org perso univ ",sy:" com edu gov mil net news org ",th:" ac co go in mi net or ",tj:" ac biz co com edu go gov info int mil name net nic org test web ",tn:" agrinet com defense edunet ens fin gov ind info intl mincom nat net org perso rnrt rns rnu tourism ",tz:" ac co go ne or ",ua:" biz cherkassy chernigov chernovtsy ck cn co com crimea cv dn dnepropetrovsk donetsk dp edu gov if in ivano-frankivsk kh kharkov kherson khmelnitskiy kiev kirovograd km kr ks kv lg lugansk lutsk lviv me mk net nikolaev od odessa org pl poltava pp rovno rv sebastopol sumy te ternopil uzhgorod vinnica vn zaporizhzhe zhitomir zp zt ",ug:" ac co go ne or org sc ",uk:" ac bl british-library co cym gov govt icnet jet lea ltd me mil mod national-library-scotland nel net nhs nic nls org orgn parliament plc police sch scot soc ",us:" dni fed isa kids nsn ",uy:" com edu gub mil net org ",ve:" co com edu gob info mil net org web ",vi:" co com k12 net org ",vn:" ac biz com edu gov health info int name net org pro ",ye:" co com gov ltd me net org plc ",yu:" ac co edu gov org ",za:" ac agric alt bourse city co cybernet db edu gov grondar iaccess imt inca landesign law mil net ngo nis nom olivetti org pix school tm web ",zm:" ac co com edu gov net org sch ",com:"ar br cn de eu gb gr hu jpn kr no qc ru sa se uk us uy za ",net:"gb jp se uk ",org:"ae",de:"com "},has:function(r){var o=r.lastIndexOf(".");if(o<=0||o>=r.length-1)return!1;var s=r.lastIndexOf(".",o-1);if(s<=0||s>=o-1)return!1;var a=i.list[r.slice(o+1)];return a?a.indexOf(" "+r.slice(s+1,o)+" ")>=0:!1},is:function(r){var o=r.lastIndexOf(".");if(o<=0||o>=r.length-1)return!1;var s=r.lastIndexOf(".",o-1);if(s>=0)return!1;var a=i.list[r.slice(o+1)];return a?a.indexOf(" "+r.slice(0,o)+" ")>=0:!1},get:function(r){var o=r.lastIndexOf(".");if(o<=0||o>=r.length-1)return null;var s=r.lastIndexOf(".",o-1);if(s<=0||s>=o-1)return null;var a=i.list[r.slice(o+1)];return!a||a.indexOf(" "+r.slice(s+1,o)+" ")<0?null:r.slice(s+1)},noConflict:function(){return t.SecondLevelDomains===this&&(t.SecondLevelDomains=n),this}};return i})})(lg)),lg.exports}var rae=ag.exports,B5;function oae(){return B5||(B5=1,(function(e){(function(t,n){e.exports?e.exports=n($se(),tae(),iae()):t.URI=n(t.punycode,t.IPv6,t.SecondLevelDomains,t)})(rae,function(t,n,i,r){var o=r&&r.URI;function s(w,x){var I=arguments.length>=1,X=arguments.length>=2;if(!(this instanceof s))return I?X?new s(w,x):new s(w):new s;if(w===void 0){if(I)throw new TypeError("undefined is not a valid argument for URI");typeof location<"u"?w=location.href+"":w=""}if(w===null&&I)throw new TypeError("null is not a valid argument for URI");return this.href(w),x!==void 0?this.absoluteTo(x):this}function a(w){return/^[0-9]+$/.test(w)}s.version="1.19.11";var c=s.prototype,l=Object.prototype.hasOwnProperty;function u(w){return w.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function h(w){return w===void 0?"Undefined":String(Object.prototype.toString.call(w)).slice(8,-1)}function d(w){return h(w)==="Array"}function f(w,x){var I={},X,D;if(h(x)==="RegExp")I=null;else if(d(x))for(X=0,D=x.length;X<D;X++)I[x[X]]=!0;else I[x]=!0;for(X=0,D=w.length;X<D;X++){var Y=I&&I[w[X]]!==void 0||!I&&x.test(w[X]);Y&&(w.splice(X,1),D--,X--)}return w}function p(w,x){var I,X;if(d(x)){for(I=0,X=x.length;I<X;I++)if(!p(w,x[I]))return!1;return!0}var D=h(x);for(I=0,X=w.length;I<X;I++)if(D==="RegExp"){if(typeof w[I]=="string"&&w[I].match(x))return!0}else if(w[I]===x)return!0;return!1}function m(w,x){if(!d(w)||!d(x)||w.length!==x.length)return!1;w.sort(),x.sort();for(var I=0,X=w.length;I<X;I++)if(w[I]!==x[I])return!1;return!0}function y(w){var x=/^\/+|\/+$/g;return w.replace(x,"")}s._parts=function(){return{protocol:null,username:null,password:null,hostname:null,urn:null,port:null,path:null,query:null,fragment:null,preventInvalidHostname:s.preventInvalidHostname,duplicateQueryParameters:s.duplicateQueryParameters,escapeQuerySpace:s.escapeQuerySpace}},s.preventInvalidHostname=!1,s.duplicateQueryParameters=!1,s.escapeQuerySpace=!0,s.protocol_expression=/^[a-z][a-z0-9.+-]*$/i,s.idn_expression=/[^a-z0-9\._-]/i,s.punycode_expression=/(xn--)/i,s.ip4_expression=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,s.ip6_expression=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,s.find_uri_expression=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/ig,s.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?«»“”„‘’]+$/,parens:/(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g},s.leading_whitespace_expression=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,s.ascii_tab_whitespace=/[\u0009\u000A\u000D]+/g,s.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"},s.hostProtocols=["http","https"],s.invalid_hostname_characters=/[^a-zA-Z0-9\.\-:_]/,s.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src",audio:"src",video:"src"},s.getDomAttribute=function(w){if(!(!w||!w.nodeName)){var x=w.nodeName.toLowerCase();if(!(x==="input"&&w.type!=="image"))return s.domAttributes[x]}};function g(w){return escape(w)}function v(w){return encodeURIComponent(w).replace(/[!'()*]/g,g).replace(/\*/g,"%2A")}s.encode=v,s.decode=decodeURIComponent,s.iso8859=function(){s.encode=escape,s.decode=unescape},s.unicode=function(){s.encode=v,s.decode=decodeURIComponent},s.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/ig,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\/\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/ig,map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"="}}},urnpath:{encode:{expression:/%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/ig,map:{"%21":"!","%24":"$","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"=","%40":"@"}},decode:{expression:/[\/\?#:]/g,map:{"/":"%2F","?":"%3F","#":"%23",":":"%3A"}}}},s.encodeQuery=function(w,x){var I=s.encode(w+"");return x===void 0&&(x=s.escapeQuerySpace),x?I.replace(/%20/g,"+"):I},s.decodeQuery=function(w,x){w+="",x===void 0&&(x=s.escapeQuerySpace);try{return s.decode(x?w.replace(/\+/g,"%20"):w)}catch{return w}};var S={encode:"encode",decode:"decode"},E,C=function(w,x){return function(I){try{return s[x](I+"").replace(s.characters[w][x].expression,function(X){return s.characters[w][x].map[X]})}catch{return I}}};for(E in S)s[E+"PathSegment"]=C("pathname",S[E]),s[E+"UrnPathSegment"]=C("urnpath",S[E]);var O=function(w,x,I){return function(X){var D;I?D=function(z){return s[x](s[I](z))}:D=s[x];for(var Y=(X+"").split(w),H=0,J=Y.length;H<J;H++)Y[H]=D(Y[H]);return Y.join(w)}};s.decodePath=O("/","decodePathSegment"),s.decodeUrnPath=O(":","decodeUrnPathSegment"),s.recodePath=O("/","encodePathSegment","decode"),s.recodeUrnPath=O(":","encodeUrnPathSegment","decode"),s.encodeReserved=C("reserved","encode"),s.parse=function(w,x){var I;return x||(x={preventInvalidHostname:s.preventInvalidHostname}),w=w.replace(s.leading_whitespace_expression,""),w=w.replace(s.ascii_tab_whitespace,""),I=w.indexOf("#"),I>-1&&(x.fragment=w.substring(I+1)||null,w=w.substring(0,I)),I=w.indexOf("?"),I>-1&&(x.query=w.substring(I+1)||null,w=w.substring(0,I)),w=w.replace(/^(https?|ftp|wss?)?:+[/\\]*/i,"$1://"),w=w.replace(/^[/\\]{2,}/i,"//"),w.substring(0,2)==="//"?(x.protocol=null,w=w.substring(2),w=s.parseAuthority(w,x)):(I=w.indexOf(":"),I>-1&&(x.protocol=w.substring(0,I)||null,x.protocol&&!x.protocol.match(s.protocol_expression)?x.protocol=void 0:w.substring(I+1,I+3).replace(/\\/g,"/")==="//"?(w=w.substring(I+3),w=s.parseAuthority(w,x)):(w=w.substring(I+1),x.urn=!0))),x.path=w,x},s.parseHost=function(w,x){w||(w=""),w=w.replace(/\\/g,"/");var I=w.indexOf("/"),X,D;if(I===-1&&(I=w.length),w.charAt(0)==="[")X=w.indexOf("]"),x.hostname=w.substring(1,X)||null,x.port=w.substring(X+2,I)||null,x.port==="/"&&(x.port=null);else{var Y=w.indexOf(":"),H=w.indexOf("/"),J=w.indexOf(":",Y+1);J!==-1&&(H===-1||J<H)?(x.hostname=w.substring(0,I)||null,x.port=null):(D=w.substring(0,I).split(":"),x.hostname=D[0]||null,x.port=D[1]||null)}return x.hostname&&w.substring(I).charAt(0)!=="/"&&(I++,w="/"+w),x.preventInvalidHostname&&s.ensureValidHostname(x.hostname,x.protocol),x.port&&s.ensureValidPort(x.port),w.substring(I)||"/"},s.parseAuthority=function(w,x){return w=s.parseUserinfo(w,x),s.parseHost(w,x)},s.parseUserinfo=function(w,x){var I=w,X=w.indexOf("\\");X!==-1&&(w=w.replace(/\\/g,"/"));var D=w.indexOf("/"),Y=w.lastIndexOf("@",D>-1?D:w.length-1),H;return Y>-1&&(D===-1||Y<D)?(H=w.substring(0,Y).split(":"),x.username=H[0]?s.decode(H[0]):null,H.shift(),x.password=H[0]?s.decode(H.join(":")):null,w=I.substring(Y+1)):(x.username=null,x.password=null),w},s.parseQuery=function(w,x){if(!w)return{};if(w=w.replace(/&+/g,"&").replace(/^\?*&*|&+$/g,""),!w)return{};for(var I={},X=w.split("&"),D=X.length,Y,H,J,z=0;z<D;z++)Y=X[z].split("="),H=s.decodeQuery(Y.shift(),x),J=Y.length?s.decodeQuery(Y.join("="),x):null,H!=="__proto__"&&(l.call(I,H)?((typeof I[H]=="string"||I[H]===null)&&(I[H]=[I[H]]),I[H].push(J)):I[H]=J);return I},s.build=function(w){var x="",I=!1;return w.protocol&&(x+=w.protocol+":"),!w.urn&&(x||w.hostname)&&(x+="//",I=!0),x+=s.buildAuthority(w)||"",typeof w.path=="string"&&(w.path.charAt(0)!=="/"&&I&&(x+="/"),x+=w.path),typeof w.query=="string"&&w.query&&(x+="?"+w.query),typeof w.fragment=="string"&&w.fragment&&(x+="#"+w.fragment),x},s.buildHost=function(w){var x="";if(w.hostname)s.ip6_expression.test(w.hostname)?x+="["+w.hostname+"]":x+=w.hostname;else return"";return w.port&&(x+=":"+w.port),x},s.buildAuthority=function(w){return s.buildUserinfo(w)+s.buildHost(w)},s.buildUserinfo=function(w){var x="";return w.username&&(x+=s.encode(w.username)),w.password&&(x+=":"+s.encode(w.password)),x&&(x+="@"),x},s.buildQuery=function(w,x,I){var X="",D,Y,H,J;for(Y in w)if(Y!=="__proto__"&&l.call(w,Y))if(d(w[Y]))for(D={},H=0,J=w[Y].length;H<J;H++)w[Y][H]!==void 0&&D[w[Y][H]+""]===void 0&&(X+="&"+s.buildQueryParameter(Y,w[Y][H],I),x!==!0&&(D[w[Y][H]+""]=!0));else w[Y]!==void 0&&(X+="&"+s.buildQueryParameter(Y,w[Y],I));return X.substring(1)},s.buildQueryParameter=function(w,x,I){return s.encodeQuery(w,I)+(x!==null?"="+s.encodeQuery(x,I):"")},s.addQuery=function(w,x,I){if(typeof x=="object")for(var X in x)l.call(x,X)&&s.addQuery(w,X,x[X]);else if(typeof x=="string"){if(w[x]===void 0){w[x]=I;return}else typeof w[x]=="string"&&(w[x]=[w[x]]);d(I)||(I=[I]),w[x]=(w[x]||[]).concat(I)}else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter")},s.setQuery=function(w,x,I){if(typeof x=="object")for(var X in x)l.call(x,X)&&s.setQuery(w,X,x[X]);else if(typeof x=="string")w[x]=I===void 0?null:I;else throw new TypeError("URI.setQuery() accepts an object, string as the name parameter")},s.removeQuery=function(w,x,I){var X,D,Y;if(d(x))for(X=0,D=x.length;X<D;X++)w[x[X]]=void 0;else if(h(x)==="RegExp")for(Y in w)x.test(Y)&&(w[Y]=void 0);else if(typeof x=="object")for(Y in x)l.call(x,Y)&&s.removeQuery(w,Y,x[Y]);else if(typeof x=="string")I!==void 0?h(I)==="RegExp"?!d(w[x])&&I.test(w[x])?w[x]=void 0:w[x]=f(w[x],I):w[x]===String(I)&&(!d(I)||I.length===1)?w[x]=void 0:d(w[x])&&(w[x]=f(w[x],I)):w[x]=void 0;else throw new TypeError("URI.removeQuery() accepts an object, string, RegExp as the first parameter")},s.hasQuery=function(w,x,I,X){switch(h(x)){case"String":break;case"RegExp":for(var D in w)if(l.call(w,D)&&x.test(D)&&(I===void 0||s.hasQuery(w,D,I)))return!0;return!1;case"Object":for(var Y in x)if(l.call(x,Y)&&!s.hasQuery(w,Y,x[Y]))return!1;return!0;default:throw new TypeError("URI.hasQuery() accepts a string, regular expression or object as the name parameter")}switch(h(I)){case"Undefined":return x in w;case"Boolean":var H=!!(d(w[x])?w[x].length:w[x]);return I===H;case"Function":return!!I(w[x],x,w);case"Array":if(!d(w[x]))return!1;var J=X?p:m;return J(w[x],I);case"RegExp":return d(w[x])?X?p(w[x],I):!1:!!(w[x]&&w[x].match(I));case"Number":I=String(I);case"String":return d(w[x])?X?p(w[x],I):!1:w[x]===I;default:throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter")}},s.joinPaths=function(){for(var w=[],x=[],I=0,X=0;X<arguments.length;X++){var D=new s(arguments[X]);w.push(D);for(var Y=D.segment(),H=0;H<Y.length;H++)typeof Y[H]=="string"&&x.push(Y[H]),Y[H]&&I++}if(!x.length||!I)return new s("");var J=new s("").segment(x);return(w[0].path()===""||w[0].path().slice(0,1)==="/")&&J.path("/"+J.path()),J.normalize()},s.commonPath=function(w,x){var I=Math.min(w.length,x.length),X;for(X=0;X<I;X++)if(w.charAt(X)!==x.charAt(X)){X--;break}return X<1?w.charAt(0)===x.charAt(0)&&w.charAt(0)==="/"?"/":"":((w.charAt(X)!=="/"||x.charAt(X)!=="/")&&(X=w.substring(0,X).lastIndexOf("/")),w.substring(0,X+1))},s.withinString=function(w,x,I){I||(I={});var X=I.start||s.findUri.start,D=I.end||s.findUri.end,Y=I.trim||s.findUri.trim,H=I.parens||s.findUri.parens,J=/[a-z0-9-]=["']?$/i;for(X.lastIndex=0;;){var z=X.exec(w);if(!z)break;var W=z.index;if(I.ignoreHtml){var Q=w.slice(Math.max(W-3,0),W);if(Q&&J.test(Q))continue}for(var q=W+w.slice(W).search(D),oe=w.slice(W,q),Ee=-1;;){var be=H.exec(oe);if(!be)break;var Ae=be.index+be[0].length;Ee=Math.max(Ee,Ae)}if(Ee>-1?oe=oe.slice(0,Ee)+oe.slice(Ee).replace(Y,""):oe=oe.replace(Y,""),!(oe.length<=z[0].length)&&!(I.ignore&&I.ignore.test(oe))){q=W+oe.length;var Pe=x(oe,W,q,w);if(Pe===void 0){X.lastIndex=q;continue}Pe=String(Pe),w=w.slice(0,W)+Pe+w.slice(q),X.lastIndex=W+Pe.length}}return X.lastIndex=0,w},s.ensureValidHostname=function(w,x){var I=!!w,X=!!x,D=!1;if(X&&(D=p(s.hostProtocols,x)),D&&!I)throw new TypeError("Hostname cannot be empty, if protocol is "+x);if(w&&w.match(s.invalid_hostname_characters)){if(!t)throw new TypeError('Hostname "'+w+'" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available');if(t.toASCII(w).match(s.invalid_hostname_characters))throw new TypeError('Hostname "'+w+'" contains characters other than [A-Z0-9.-:_]')}},s.ensureValidPort=function(w){if(w){var x=Number(w);if(!(a(x)&&x>0&&x<65536))throw new TypeError('Port "'+w+'" is not a valid port')}},s.noConflict=function(w){if(w){var x={URI:this.noConflict()};return r.URITemplate&&typeof r.URITemplate.noConflict=="function"&&(x.URITemplate=r.URITemplate.noConflict()),r.IPv6&&typeof r.IPv6.noConflict=="function"&&(x.IPv6=r.IPv6.noConflict()),r.SecondLevelDomains&&typeof r.SecondLevelDomains.noConflict=="function"&&(x.SecondLevelDomains=r.SecondLevelDomains.noConflict()),x}else r.URI===this&&(r.URI=o);return this},c.build=function(w){return w===!0?this._deferred_build=!0:(w===void 0||this._deferred_build)&&(this._string=s.build(this._parts),this._deferred_build=!1),this},c.clone=function(){return new s(this)},c.valueOf=c.toString=function(){return this.build(!1)._string};function V(w){return function(x,I){return x===void 0?this._parts[w]||"":(this._parts[w]=x||null,this.build(!I),this)}}function A(w,x){return function(I,X){return I===void 0?this._parts[w]||"":(I!==null&&(I=I+"",I.charAt(0)===x&&(I=I.substring(1))),this._parts[w]=I,this.build(!X),this)}}c.protocol=V("protocol"),c.username=V("username"),c.password=V("password"),c.hostname=V("hostname"),c.port=V("port"),c.query=A("query","?"),c.fragment=A("fragment","#"),c.search=function(w,x){var I=this.query(w,x);return typeof I=="string"&&I.length?"?"+I:I},c.hash=function(w,x){var I=this.fragment(w,x);return typeof I=="string"&&I.length?"#"+I:I},c.pathname=function(w,x){if(w===void 0||w===!0){var I=this._parts.path||(this._parts.hostname?"/":"");return w?(this._parts.urn?s.decodeUrnPath:s.decodePath)(I):I}else return this._parts.urn?this._parts.path=w?s.recodeUrnPath(w):"":this._parts.path=w?s.recodePath(w):"/",this.build(!x),this},c.path=c.pathname,c.href=function(w,x){var I;if(w===void 0)return this.toString();this._string="",this._parts=s._parts();var X=w instanceof s,D=typeof w=="object"&&(w.hostname||w.path||w.pathname);if(w.nodeName){var Y=s.getDomAttribute(w);w=w[Y]||"",D=!1}if(!X&&D&&w.pathname!==void 0&&(w=w.toString()),typeof w=="string"||w instanceof String)this._parts=s.parse(String(w),this._parts);else if(X||D){var H=X?w._parts:w;for(I in H)I!=="query"&&l.call(this._parts,I)&&(this._parts[I]=H[I]);H.query&&this.query(H.query,!1)}else throw new TypeError("invalid input");return this.build(!x),this},c.is=function(w){var x=!1,I=!1,X=!1,D=!1,Y=!1,H=!1,J=!1,z=!this._parts.urn;switch(this._parts.hostname&&(z=!1,I=s.ip4_expression.test(this._parts.hostname),X=s.ip6_expression.test(this._parts.hostname),x=I||X,D=!x,Y=D&&i&&i.has(this._parts.hostname),H=D&&s.idn_expression.test(this._parts.hostname),J=D&&s.punycode_expression.test(this._parts.hostname)),w.toLowerCase()){case"relative":return z;case"absolute":return!z;case"domain":case"name":return D;case"sld":return Y;case"ip":return x;case"ip4":case"ipv4":case"inet4":return I;case"ip6":case"ipv6":case"inet6":return X;case"idn":return H;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":return J}return null};var G=c.protocol,N=c.port,k=c.hostname;c.protocol=function(w,x){if(w&&(w=w.replace(/:(\/\/)?$/,""),!w.match(s.protocol_expression)))throw new TypeError('Protocol "'+w+`" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]`);return G.call(this,w,x)},c.scheme=c.protocol,c.port=function(w,x){return this._parts.urn?w===void 0?"":this:(w!==void 0&&(w===0&&(w=null),w&&(w+="",w.charAt(0)===":"&&(w=w.substring(1)),s.ensureValidPort(w))),N.call(this,w,x))},c.hostname=function(w,x){if(this._parts.urn)return w===void 0?"":this;if(w!==void 0){var I={preventInvalidHostname:this._parts.preventInvalidHostname},X=s.parseHost(w,I);if(X!=="/")throw new TypeError('Hostname "'+w+'" contains characters other than [A-Z0-9.-]');w=I.hostname,this._parts.preventInvalidHostname&&s.ensureValidHostname(w,this._parts.protocol)}return k.call(this,w,x)},c.origin=function(w,x){if(this._parts.urn)return w===void 0?"":this;if(w===void 0){var I=this.protocol(),X=this.authority();return X?(I?I+"://":"")+this.authority():""}else{var D=s(w);return this.protocol(D.protocol()).authority(D.authority()).build(!x),this}},c.host=function(w,x){if(this._parts.urn)return w===void 0?"":this;if(w===void 0)return this._parts.hostname?s.buildHost(this._parts):"";var I=s.parseHost(w,this._parts);if(I!=="/")throw new TypeError('Hostname "'+w+'" contains characters other than [A-Z0-9.-]');return this.build(!x),this},c.authority=function(w,x){if(this._parts.urn)return w===void 0?"":this;if(w===void 0)return this._parts.hostname?s.buildAuthority(this._parts):"";var I=s.parseAuthority(w,this._parts);if(I!=="/")throw new TypeError('Hostname "'+w+'" contains characters other than [A-Z0-9.-]');return this.build(!x),this},c.userinfo=function(w,x){if(this._parts.urn)return w===void 0?"":this;if(w===void 0){var I=s.buildUserinfo(this._parts);return I&&I.substring(0,I.length-1)}else return w[w.length-1]!=="@"&&(w+="@"),s.parseUserinfo(w,this._parts),this.build(!x),this},c.resource=function(w,x){var I;return w===void 0?this.path()+this.search()+this.hash():(I=s.parse(w),this._parts.path=I.path,this._parts.query=I.query,this._parts.fragment=I.fragment,this.build(!x),this)},c.subdomain=function(w,x){if(this._parts.urn)return w===void 0?"":this;if(w===void 0){if(!this._parts.hostname||this.is("IP"))return"";var I=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,I)||""}else{var X=this._parts.hostname.length-this.domain().length,D=this._parts.hostname.substring(0,X),Y=new RegExp("^"+u(D));if(w&&w.charAt(w.length-1)!=="."&&(w+="."),w.indexOf(":")!==-1)throw new TypeError("Domains cannot contain colons");return w&&s.ensureValidHostname(w,this._parts.protocol),this._parts.hostname=this._parts.hostname.replace(Y,w),this.build(!x),this}},c.domain=function(w,x){if(this._parts.urn)return w===void 0?"":this;if(typeof w=="boolean"&&(x=w,w=void 0),w===void 0){if(!this._parts.hostname||this.is("IP"))return"";var I=this._parts.hostname.match(/\./g);if(I&&I.length<2)return this._parts.hostname;var X=this._parts.hostname.length-this.tld(x).length-1;return X=this._parts.hostname.lastIndexOf(".",X-1)+1,this._parts.hostname.substring(X)||""}else{if(!w)throw new TypeError("cannot set domain empty");if(w.indexOf(":")!==-1)throw new TypeError("Domains cannot contain colons");if(s.ensureValidHostname(w,this._parts.protocol),!this._parts.hostname||this.is("IP"))this._parts.hostname=w;else{var D=new RegExp(u(this.domain())+"$");this._parts.hostname=this._parts.hostname.replace(D,w)}return this.build(!x),this}},c.tld=function(w,x){if(this._parts.urn)return w===void 0?"":this;if(typeof w=="boolean"&&(x=w,w=void 0),w===void 0){if(!this._parts.hostname||this.is("IP"))return"";var I=this._parts.hostname.lastIndexOf("."),X=this._parts.hostname.substring(I+1);return x!==!0&&i&&i.list[X.toLowerCase()]&&i.get(this._parts.hostname)||X}else{var D;if(w)if(w.match(/[^a-zA-Z0-9-]/))if(i&&i.is(w))D=new RegExp(u(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(D,w);else throw new TypeError('TLD "'+w+'" contains characters other than [A-Z0-9]');else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");D=new RegExp(u(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(D,w)}else throw new TypeError("cannot set TLD empty");return this.build(!x),this}},c.directory=function(w,x){if(this._parts.urn)return w===void 0?"":this;if(w===void 0||w===!0){if(!this._parts.path&&!this._parts.hostname)return"";if(this._parts.path==="/")return"/";var I=this._parts.path.length-this.filename().length-1,X=this._parts.path.substring(0,I)||(this._parts.hostname?"/":"");return w?s.decodePath(X):X}else{var D=this._parts.path.length-this.filename().length,Y=this._parts.path.substring(0,D),H=new RegExp("^"+u(Y));return this.is("relative")||(w||(w="/"),w.charAt(0)!=="/"&&(w="/"+w)),w&&w.charAt(w.length-1)!=="/"&&(w+="/"),w=s.recodePath(w),this._parts.path=this._parts.path.replace(H,w),this.build(!x),this}},c.filename=function(w,x){if(this._parts.urn)return w===void 0?"":this;if(typeof w!="string"){if(!this._parts.path||this._parts.path==="/")return"";var I=this._parts.path.lastIndexOf("/"),X=this._parts.path.substring(I+1);return w?s.decodePathSegment(X):X}else{var D=!1;w.charAt(0)==="/"&&(w=w.substring(1)),w.match(/\.?\//)&&(D=!0);var Y=new RegExp(u(this.filename())+"$");return w=s.recodePath(w),this._parts.path=this._parts.path.replace(Y,w),D?this.normalizePath(x):this.build(!x),this}},c.suffix=function(w,x){if(this._parts.urn)return w===void 0?"":this;if(w===void 0||w===!0){if(!this._parts.path||this._parts.path==="/")return"";var I=this.filename(),X=I.lastIndexOf("."),D,Y;return X===-1?"":(D=I.substring(X+1),Y=/^[a-z0-9%]+$/i.test(D)?D:"",w?s.decodePathSegment(Y):Y)}else{w.charAt(0)==="."&&(w=w.substring(1));var H=this.suffix(),J;if(H)w?J=new RegExp(u(H)+"$"):J=new RegExp(u("."+H)+"$");else{if(!w)return this;this._parts.path+="."+s.recodePath(w)}return J&&(w=s.recodePath(w),this._parts.path=this._parts.path.replace(J,w)),this.build(!x),this}},c.segment=function(w,x,I){var X=this._parts.urn?":":"/",D=this.path(),Y=D.substring(0,1)==="/",H=D.split(X);if(w!==void 0&&typeof w!="number"&&(I=x,x=w,w=void 0),w!==void 0&&typeof w!="number")throw new Error('Bad segment "'+w+'", must be 0-based integer');if(Y&&H.shift(),w<0&&(w=Math.max(H.length+w,0)),x===void 0)return w===void 0?H:H[w];if(w===null||H[w]===void 0)if(d(x)){H=[];for(var J=0,z=x.length;J<z;J++)!x[J].length&&(!H.length||!H[H.length-1].length)||(H.length&&!H[H.length-1].length&&H.pop(),H.push(y(x[J])))}else(x||typeof x=="string")&&(x=y(x),H[H.length-1]===""?H[H.length-1]=x:H.push(x));else x?H[w]=y(x):H.splice(w,1);return Y&&H.unshift(""),this.path(H.join(X),I)},c.segmentCoded=function(w,x,I){var X,D,Y;if(typeof w!="number"&&(I=x,x=w,w=void 0),x===void 0){if(X=this.segment(w,x,I),!d(X))X=X!==void 0?s.decode(X):void 0;else for(D=0,Y=X.length;D<Y;D++)X[D]=s.decode(X[D]);return X}if(!d(x))x=typeof x=="string"||x instanceof String?s.encode(x):x;else for(D=0,Y=x.length;D<Y;D++)x[D]=s.encode(x[D]);return this.segment(w,x,I)};var P=c.query;return c.query=function(w,x){if(w===!0)return s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if(typeof w=="function"){var I=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace),X=w.call(this,I);return this._parts.query=s.buildQuery(X||I,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!x),this}else return w!==void 0&&typeof w!="string"?(this._parts.query=s.buildQuery(w,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!x),this):P.call(this,w,x)},c.setQuery=function(w,x,I){var X=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if(typeof w=="string"||w instanceof String)X[w]=x!==void 0?x:null;else if(typeof w=="object")for(var D in w)l.call(w,D)&&(X[D]=w[D]);else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");return this._parts.query=s.buildQuery(X,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof w!="string"&&(I=x),this.build(!I),this},c.addQuery=function(w,x,I){var X=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return s.addQuery(X,w,x===void 0?null:x),this._parts.query=s.buildQuery(X,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof w!="string"&&(I=x),this.build(!I),this},c.removeQuery=function(w,x,I){var X=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return s.removeQuery(X,w,x),this._parts.query=s.buildQuery(X,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof w!="string"&&(I=x),this.build(!I),this},c.hasQuery=function(w,x,I){var X=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return s.hasQuery(X,w,x,I)},c.setSearch=c.setQuery,c.addSearch=c.addQuery,c.removeSearch=c.removeQuery,c.hasSearch=c.hasQuery,c.normalize=function(){return this._parts.urn?this.normalizeProtocol(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build():this.normalizeProtocol(!1).normalizeHostname(!1).normalizePort(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build()},c.normalizeProtocol=function(w){return typeof this._parts.protocol=="string"&&(this._parts.protocol=this._parts.protocol.toLowerCase(),this.build(!w)),this},c.normalizeHostname=function(w){return this._parts.hostname&&(this.is("IDN")&&t?this._parts.hostname=t.toASCII(this._parts.hostname):this.is("IPv6")&&n&&(this._parts.hostname=n.best(this._parts.hostname)),this._parts.hostname=this._parts.hostname.toLowerCase(),this.build(!w)),this},c.normalizePort=function(w){return typeof this._parts.protocol=="string"&&this._parts.port===s.defaultPorts[this._parts.protocol]&&(this._parts.port=null,this.build(!w)),this},c.normalizePath=function(w){var x=this._parts.path;if(!x)return this;if(this._parts.urn)return this._parts.path=s.recodeUrnPath(this._parts.path),this.build(!w),this;if(this._parts.path==="/")return this;x=s.recodePath(x);var I,X="",D,Y;for(x.charAt(0)!=="/"&&(I=!0,x="/"+x),(x.slice(-3)==="/.."||x.slice(-2)==="/.")&&(x+="/"),x=x.replace(/(\/(\.\/)+)|(\/\.$)/g,"/").replace(/\/{2,}/g,"/"),I&&(X=x.substring(1).match(/^(\.\.\/)+/)||"",X&&(X=X[0]));D=x.search(/\/\.\.(\/|$)/),D!==-1;){if(D===0){x=x.substring(3);continue}Y=x.substring(0,D).lastIndexOf("/"),Y===-1&&(Y=D),x=x.substring(0,Y)+x.substring(D+3)}return I&&this.is("relative")&&(x=X+x.substring(1)),this._parts.path=x,this.build(!w),this},c.normalizePathname=c.normalizePath,c.normalizeQuery=function(w){return typeof this._parts.query=="string"&&(this._parts.query.length?this.query(s.parseQuery(this._parts.query,this._parts.escapeQuerySpace)):this._parts.query=null,this.build(!w)),this},c.normalizeFragment=function(w){return this._parts.fragment||(this._parts.fragment=null,this.build(!w)),this},c.normalizeSearch=c.normalizeQuery,c.normalizeHash=c.normalizeFragment,c.iso8859=function(){var w=s.encode,x=s.decode;s.encode=escape,s.decode=decodeURIComponent;try{this.normalize()}finally{s.encode=w,s.decode=x}return this},c.unicode=function(){var w=s.encode,x=s.decode;s.encode=v,s.decode=unescape;try{this.normalize()}finally{s.encode=w,s.decode=x}return this},c.readable=function(){var w=this.clone();w.username("").password("").normalize();var x="";if(w._parts.protocol&&(x+=w._parts.protocol+"://"),w._parts.hostname&&(w.is("punycode")&&t?(x+=t.toUnicode(w._parts.hostname),w._parts.port&&(x+=":"+w._parts.port)):x+=w.host()),w._parts.hostname&&w._parts.path&&w._parts.path.charAt(0)!=="/"&&(x+="/"),x+=w.path(!0),w._parts.query){for(var I="",X=0,D=w._parts.query.split("&"),Y=D.length;X<Y;X++){var H=(D[X]||"").split("=");I+="&"+s.decodeQuery(H[0],this._parts.escapeQuerySpace).replace(/&/g,"%26"),H[1]!==void 0&&(I+="="+s.decodeQuery(H[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}x+="?"+I.substring(1)}return x+=s.decodeQuery(w.hash(),!0),x},c.absoluteTo=function(w){var x=this.clone(),I=["protocol","username","password","hostname","port"],X,D,Y;if(this._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(w instanceof s||(w=new s(w)),x._parts.protocol||(x._parts.protocol=w._parts.protocol,this._parts.hostname))return x;for(D=0;Y=I[D];D++)x._parts[Y]=w._parts[Y];return x._parts.path?(x._parts.path.substring(-2)===".."&&(x._parts.path+="/"),x.path().charAt(0)!=="/"&&(X=w.directory(),X=X||(w.path().indexOf("/")===0?"/":""),x._parts.path=(X?X+"/":"")+x._parts.path,x.normalizePath())):(x._parts.path=w._parts.path,x._parts.query||(x._parts.query=w._parts.query)),x.build(),x},c.relativeTo=function(w){var x=this.clone().normalize(),I,X,D,Y,H;if(x._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(w=new s(w).normalize(),I=x._parts,X=w._parts,Y=x.path(),H=w.path(),Y.charAt(0)!=="/")throw new Error("URI is already relative");if(H.charAt(0)!=="/")throw new Error("Cannot calculate a URI relative to another relative URI");if(I.protocol===X.protocol&&(I.protocol=null),I.username!==X.username||I.password!==X.password||I.protocol!==null||I.username!==null||I.password!==null)return x.build();if(I.hostname===X.hostname&&I.port===X.port)I.hostname=null,I.port=null;else return x.build();if(Y===H)return I.path="",x.build();if(D=s.commonPath(Y,H),!D)return x.build();var J=X.path.substring(D.length).replace(/[^\/]*$/,"").replace(/.*?\//g,"../");return I.path=J+I.path.substring(D.length)||"./",x.build()},c.equals=function(w){var x=this.clone(),I=new s(w),X={},D={},Y={},H,J,z;if(x.normalize(),I.normalize(),x.toString()===I.toString())return!0;if(H=x.query(),J=I.query(),x.query(""),I.query(""),x.toString()!==I.toString()||H.length!==J.length)return!1;X=s.parseQuery(H,this._parts.escapeQuerySpace),D=s.parseQuery(J,this._parts.escapeQuerySpace);for(z in X)if(l.call(X,z)){if(d(X[z])){if(!m(X[z],D[z]))return!1}else if(X[z]!==D[z])return!1;Y[z]=!0}for(z in D)if(l.call(D,z)&&!Y[z])return!1;return!0},c.preventInvalidHostname=function(w){return this._parts.preventInvalidHostname=!!w,this},c.duplicateQueryParameters=function(w){return this._parts.duplicateQueryParameters=!!w,this},c.escapeQuerySpace=function(w){return this._parts.escapeQuerySpace=!!w,this},s})})(ag)),ag.exports}var sae=oae();const fa=uu(sae);function aae(e){return(e.length===0||e[e.length-1]!=="/")&&(e=`${e}/`),e}function fr(e,t){if(e===null||typeof e!="object")return e;t=t??!1;const n=new e.constructor;for(const i in e)if(e.hasOwnProperty(i)){let r=e[i];t&&(r=fr(r,t)),n[i]=r}return n}function Pr(e,t,n){n=n??!1;const i={},r=_(e),o=_(t);let s,a,c;if(r)for(s in e)e.hasOwnProperty(s)&&(a=e[s],o&&n&&typeof a=="object"&&t.hasOwnProperty(s)?(c=t[s],typeof c=="object"?i[s]=Pr(a,c,n):i[s]=a):i[s]=a);if(o)for(s in t)t.hasOwnProperty(s)&&!i.hasOwnProperty(s)&&(c=t[s],i[s]=c);return i}function gf(){let e,t;const n=new Promise(function(i,r){e=i,t=r});return{resolve:e,reject:t,promise:n}}function yf(e,t){let n;return typeof document<"u"&&(n=document),yf._implementation(e,t,n)}yf._implementation=function(e,t,n){if(!_(e))throw new F("relative uri is required.");if(!_(t)){if(typeof n>"u")return e;t=n.baseURI??n.location.href}const i=new fa(e);return i.scheme()!==""?i.toString():i.absoluteTo(t).toString()};function cae(e,t){if(!_(e))throw new F("uri is required.");let n="";const i=e.lastIndexOf("/");return i!==-1&&(n=e.substring(0,i+1)),t&&(e=new fa(e),e.query().length!==0&&(n+=`?${e.query()}`),e.fragment().length!==0&&(n+=`#${e.fragment()}`)),n}function lae(e){if(!_(e))throw new F("uri is required.");const t=new fa(e);t.normalize();let n=t.path(),i=n.lastIndexOf("/");return i!==-1&&(n=n.substr(i+1)),i=n.lastIndexOf("."),i===-1?n="":n=n.substr(i+1),n}const Y5={};function H5(e,t,n){_(t)||(t=e.width),_(n)||(n=e.height);let i=Y5[t];_(i)||(i={},Y5[t]=i);let r=i[n];if(!_(r)){const o=document.createElement("canvas");o.width=t,o.height=n,r=o.getContext("2d",{willReadFrequently:!0}),r.globalCompositeOperation="copy",i[n]=r}return r.drawImage(e,0,0,t,n),r.getImageData(0,0,t,n).data}const uae=/^blob:/i;function j5(e){return T.typeOf.string("uri",e),uae.test(e)}let Ps;function ow(e){_(Ps)||(Ps=document.createElement("a")),Ps.href=window.location.href;const t=Ps.host,n=Ps.protocol;return Ps.href=e,Ps.href=Ps.href,n!==Ps.protocol||t!==Ps.host}const hae=/^data:/i;function K5(e){return T.typeOf.string("uri",e),hae.test(e)}function dae(e){const t=document.createElement("script");return t.async=!0,t.src=e,new Promise((n,i)=>{window.crossOriginIsolated&&t.setAttribute("crossorigin","anonymous");const r=document.getElementsByTagName("head")[0];t.onload=function(){t.onload=void 0,r.removeChild(t),n()},t.onerror=function(o){i(o)},r.appendChild(t)})}function fae(e){if(!_(e))throw new F("obj is required.");let t="";for(const n in e)if(e.hasOwnProperty(n)){const i=e[n],r=`${encodeURIComponent(n)}=`;if(Array.isArray(i))for(let o=0,s=i.length;o<s;++o)t+=`${r+encodeURIComponent(i[o])}&`;else t+=`${r+encodeURIComponent(i)}&`}return t=t.slice(0,-1),t}function pae(e){if(!_(e))throw new F("queryString is required.");const t={};if(e==="")return t;const n=e.replace(/\+/g,"%20").split(/[&;]/);for(let i=0,r=n.length;i<r;++i){const o=n[i].split("="),s=decodeURIComponent(o[0]);let a=o[1];_(a)?a=decodeURIComponent(a):a="";const c=t[s];typeof c=="string"?t[s]=[c,a]:Array.isArray(c)?c.push(a):t[s]=a}return t}const Wn=Object.freeze({UNISSUED:0,ISSUED:1,ACTIVE:2,RECEIVED:3,CANCELLED:4,FAILED:5}),mae=Object.freeze({TERRAIN:0,IMAGERY:1,TILES3D:2,OTHER:3});function ug(e){e=e??He.EMPTY_OBJECT;const t=e.throttleByServer??!1,n=e.throttle??!1;this.url=e.url,this.requestFunction=e.requestFunction,this.cancelFunction=e.cancelFunction,this.priorityFunction=e.priorityFunction,this.priority=e.priority??0,this.throttle=n,this.throttleByServer=t,this.type=e.type??mae.OTHER,this.serverKey=e.serverKey,this.state=Wn.UNISSUED,this.deferred=void 0,this.cancelled=!1}ug.prototype.cancel=function(){this.cancelled=!0},ug.prototype.clone=function(e){return _(e)?(e.url=this.url,e.requestFunction=this.requestFunction,e.cancelFunction=this.cancelFunction,e.priorityFunction=this.priorityFunction,e.priority=this.priority,e.throttle=this.throttle,e.throttleByServer=this.throttleByServer,e.type=this.type,e.serverKey=this.serverKey,e.state=Wn.UNISSUED,e.deferred=void 0,e.cancelled=!1,e):new ug(this)};function gae(e){const t={};if(!e)return t;const n=e.split(`\r
26
26
  `);for(let i=0;i<n.length;++i){const r=n[i],o=r.indexOf(": ");if(o>0){const s=r.substring(0,o),a=r.substring(o+2);t[s]=a}}return t}function bf(e,t,n){this.statusCode=e,this.response=t,this.responseHeaders=n,typeof this.responseHeaders=="string"&&(this.responseHeaders=gae(this.responseHeaders))}bf.prototype.toString=function(){let e="Request has failed.";return _(this.statusCode)&&(e+=` Status Code: ${this.statusCode}`),e};function yl(e){T.typeOf.object("options",e),T.defined("options.comparator",e.comparator),this._comparator=e.comparator,this._array=[],this._length=0,this._maximumLength=void 0}Object.defineProperties(yl.prototype,{length:{get:function(){return this._length}},internalArray:{get:function(){return this._array}},maximumLength:{get:function(){return this._maximumLength},set:function(e){T.typeOf.number.greaterThanOrEquals("maximumLength",e,0);const t=this._length;if(e<t){const n=this._array;for(let i=e;i<t;++i)n[i]=void 0;this._length=e,n.length=e}this._maximumLength=e}},comparator:{get:function(){return this._comparator}}});function sw(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}yl.prototype.reserve=function(e){e=e??this._length,this._array.length=e},yl.prototype.heapify=function(e){e=e??0;const t=this._length,n=this._comparator,i=this._array;let r=-1,o=!0;for(;o;){const s=2*(e+1),a=s-1;a<t&&n(i[a],i[e])<0?r=a:r=e,s<t&&n(i[s],i[r])<0&&(r=s),r!==e?(sw(i,r,e),e=r):o=!1}},yl.prototype.resort=function(){const e=this._length;for(let t=Math.ceil(e/2);t>=0;--t)this.heapify(t)},yl.prototype.insert=function(e){T.defined("element",e);const t=this._array,n=this._comparator,i=this._maximumLength;let r=this._length++;for(r<t.length?t[r]=e:t.push(e);r!==0;){const s=Math.floor((r-1)/2);if(n(t[r],t[s])<0)sw(t,r,s),r=s;else break}let o;return _(i)&&this._length>i&&(o=t[i],this._length=i),o},yl.prototype.pop=function(e){if(e=e??0,this._length===0)return;T.typeOf.number.lessThan("index",e,this._length);const t=this._array,n=t[e];return sw(t,e,--this._length),this.heapify(e),t[this._length]=void 0,n};function yae(e,t){return e.priority-t.priority}const Ht={numberOfAttemptedRequests:0,numberOfActiveRequests:0,numberOfCancelledRequests:0,numberOfCancelledActiveRequests:0,numberOfFailedRequests:0,numberOfActiveRequestsEver:0,lastNumberOfActiveRequests:0};let Ju=20;const Hi=new yl({comparator:yae});Hi.maximumLength=Ju,Hi.reserve(Ju);const Os=[];let pa={};const bae=typeof document<"u"?new fa(document.location.href):new fa,hg=new Yt;function gn(){}gn.maximumRequests=50,gn.maximumRequestsPerServer=18,gn.requestsByServer={},gn.throttleRequests=!0,gn.debugShowStatistics=!1,gn.requestCompletedEvent=hg,Object.defineProperties(gn,{statistics:{get:function(){return Ht}},priorityHeapLength:{get:function(){return Ju},set:function(e){if(e<Ju)for(;Hi.length>e;){const t=Hi.pop();bl(t)}Ju=e,Hi.maximumLength=e,Hi.reserve(e)}}});function J5(e){_(e.priorityFunction)&&(e.priority=e.priorityFunction())}gn.serverHasOpenSlots=function(e,t){t=t??1;const n=gn.requestsByServer[e]??gn.maximumRequestsPerServer;return pa[e]+t<=n},gn.heapHasOpenSlots=function(e){return Hi.length+e<=Ju};function Q5(e){return e.state===Wn.UNISSUED&&(e.state=Wn.ISSUED,e.deferred=gf()),e.deferred.promise}function _ae(e){return function(t){if(e.state===Wn.CANCELLED)return;const n=e.deferred;--Ht.numberOfActiveRequests,--pa[e.serverKey],hg.raiseEvent(),e.state=Wn.RECEIVED,e.deferred=void 0,n.resolve(t)}}function vae(e){return function(t){e.state!==Wn.CANCELLED&&(++Ht.numberOfFailedRequests,--Ht.numberOfActiveRequests,--pa[e.serverKey],hg.raiseEvent(t),e.state=Wn.FAILED,e.deferred.reject(t))}}function q5(e){const t=Q5(e);return e.state=Wn.ACTIVE,Os.push(e),++Ht.numberOfActiveRequests,++Ht.numberOfActiveRequestsEver,++pa[e.serverKey],e.requestFunction().then(_ae(e)).catch(vae(e)),t}function bl(e){const t=e.state===Wn.ACTIVE;if(e.state=Wn.CANCELLED,++Ht.numberOfCancelledRequests,_(e.deferred)){const n=e.deferred;e.deferred=void 0,n.reject()}t&&(--Ht.numberOfActiveRequests,--pa[e.serverKey],++Ht.numberOfCancelledActiveRequests),_(e.cancelFunction)&&e.cancelFunction()}gn.update=function(){let e,t,n=0;const i=Os.length;for(e=0;e<i;++e){if(t=Os[e],t.cancelled&&bl(t),t.state!==Wn.ACTIVE){++n;continue}n>0&&(Os[e-n]=t)}Os.length-=n;const r=Hi.internalArray,o=Hi.length;for(e=0;e<o;++e)J5(r[e]);Hi.resort();const s=Math.max(gn.maximumRequests-Os.length,0);let a=0;for(;a<s&&Hi.length>0;){if(t=Hi.pop(),t.cancelled){bl(t);continue}if(t.throttleByServer&&!gn.serverHasOpenSlots(t.serverKey)){bl(t);continue}q5(t),++a}wae()},gn.getServerKey=function(e){T.typeOf.string("url",e);let t=new fa(e);t.scheme()===""&&(t=t.absoluteTo(bae),t.normalize());let n=t.authority();/:/.test(n)||(n=`${n}:${t.scheme()==="https"?"443":"80"}`);const i=pa[n];return _(i)||(pa[n]=0),n},gn.request=function(e){if(T.typeOf.object("request",e),T.typeOf.string("request.url",e.url),T.typeOf.func("request.requestFunction",e.requestFunction),K5(e.url)||j5(e.url))return hg.raiseEvent(),e.state=Wn.RECEIVED,e.requestFunction();if(++Ht.numberOfAttemptedRequests,_(e.serverKey)||(e.serverKey=gn.getServerKey(e.url)),gn.throttleRequests&&e.throttleByServer&&!gn.serverHasOpenSlots(e.serverKey))return;if(!gn.throttleRequests||!e.throttle)return q5(e);if(Os.length>=gn.maximumRequests)return;J5(e);const t=Hi.insert(e);if(_(t)){if(t===e)return;bl(t)}return Q5(e)};function wae(){gn.debugShowStatistics&&(Ht.numberOfActiveRequests===0&&Ht.lastNumberOfActiveRequests>0&&(Ht.numberOfAttemptedRequests>0&&(console.log(`Number of attempted requests: ${Ht.numberOfAttemptedRequests}`),Ht.numberOfAttemptedRequests=0),Ht.numberOfCancelledRequests>0&&(console.log(`Number of cancelled requests: ${Ht.numberOfCancelledRequests}`),Ht.numberOfCancelledRequests=0),Ht.numberOfCancelledActiveRequests>0&&(console.log(`Number of cancelled active requests: ${Ht.numberOfCancelledActiveRequests}`),Ht.numberOfCancelledActiveRequests=0),Ht.numberOfFailedRequests>0&&(console.log(`Number of failed requests: ${Ht.numberOfFailedRequests}`),Ht.numberOfFailedRequests=0)),Ht.lastNumberOfActiveRequests=Ht.numberOfActiveRequests)}gn.clearForSpecs=function(){for(;Hi.length>0;){const t=Hi.pop();bl(t)}const e=Os.length;for(let t=0;t<e;++t)bl(Os[t]);Os.length=0,pa={},Ht.numberOfAttemptedRequests=0,Ht.numberOfActiveRequests=0,Ht.numberOfCancelledRequests=0,Ht.numberOfCancelledActiveRequests=0,Ht.numberOfFailedRequests=0,Ht.numberOfActiveRequestsEver=0,Ht.lastNumberOfActiveRequests=0},gn.numberOfActiveRequestsByServer=function(e){return pa[e]},gn.requestHeap=Hi;function Bn(e){this.name="RuntimeError",this.message=e;let t;try{throw new Error}catch(n){t=n.stack}this.stack=t}_(Object.create)&&(Bn.prototype=Object.create(Error.prototype),Bn.prototype.constructor=Bn),Bn.prototype.toString=function(){let e=`${this.name}: ${this.message}`;return _(this.stack)&&(e+=`
27
27
  ${this.stack.toString()}`),e};const Qu={};let qu={};Qu.add=function(e,t){if(!_(e))throw new F("host is required.");if(!_(t)||t<=0)throw new F("port is required to be greater than 0.");const n=`${e.toLowerCase()}:${t}`;_(qu[n])||(qu[n]=!0)},Qu.remove=function(e,t){if(!_(e))throw new F("host is required.");if(!_(t)||t<=0)throw new F("port is required to be greater than 0.");const n=`${e.toLowerCase()}:${t}`;_(qu[n])&&delete qu[n]};function xae(e){const t=new fa(e);t.normalize();let n=t.authority();if(n.length!==0){if(t.authority(n),n.indexOf("@")!==-1&&(n=n.split("@")[1]),n.indexOf(":")===-1){let i=t.scheme();if(i.length===0&&(i=window.location.protocol,i=i.substring(0,i.length-1)),i==="http")n+=":80";else if(i==="https")n+=":443";else return}return n}}Qu.contains=function(e){if(!_(e))throw new F("url is required.");const t=xae(e);return!!(_(t)&&_(qu[t]))},Qu.clear=function(){qu={}};const $5=(function(){try{const e=new XMLHttpRequest;return e.open("GET","#",!0),e.responseType="blob",e.responseType==="blob"}catch{return!1}})();function ze(e){e=e??He.EMPTY_OBJECT,typeof e=="string"&&(e={url:e}),T.typeOf.string("options.url",e.url),this._url=void 0,this._templateValues=Gs(e.templateValues,{}),this._queryParameters=Gs(e.queryParameters,{}),this.headers=Gs(e.headers,{}),this.request=e.request??new ug,this.proxy=e.proxy,this.retryCallback=e.retryCallback,this.retryAttempts=e.retryAttempts??0,this._retryCount=0,e.parseUrl??!0?this.parseUrl(e.url,!0,!0):this._url=e.url,this._credits=e.credits}function Gs(e,t){return _(e)?fr(e):t}ze.createIfNeeded=function(e){return e instanceof ze?e.getDerivedResource({request:e.request}):typeof e!="string"?e:new ze({url:e})};let $u;ze.supportsImageBitmapOptions=function(){return _($u)?$u:typeof createImageBitmap!="function"?($u=Promise.resolve(!1),$u):($u=ze.fetchBlob({url:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAABGdBTUEAAE4g3rEiDgAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADElEQVQI12Ng6GAAAAEUAIngE3ZiAAAAAElFTkSuQmCC"}).then(function(t){const n={imageOrientation:"flipY",premultiplyAlpha:"none",colorSpaceConversion:"none"};return Promise.all([createImageBitmap(t,n),createImageBitmap(t)])}).then(function(t){const n=H5(t[0]),i=H5(t[1]);return n[1]!==i[1]}).catch(function(){return!1}),$u)},Object.defineProperties(ze,{isBlobSupported:{get:function(){return $5}}}),Object.defineProperties(ze.prototype,{queryParameters:{get:function(){return this._queryParameters}},templateValues:{get:function(){return this._templateValues}},url:{get:function(){return this.getUrlComponent(!0,!0)},set:function(e){this.parseUrl(e,!1,!1)}},extension:{get:function(){return lae(this._url)}},isDataUri:{get:function(){return K5(this._url)}},isBlobUri:{get:function(){return j5(this._url)}},isCrossOriginUrl:{get:function(){return ow(this._url)}},hasHeaders:{get:function(){return Object.keys(this.headers).length>0}},credits:{get:function(){return this._credits}}}),ze.prototype.toString=function(){return this.getUrlComponent(!0,!0)},ze.prototype.parseUrl=function(e,t,n,i){let r=new fa(e);const o=Sae(r.query());this._queryParameters=t?dg(o,this.queryParameters,n):o,r.search(""),r.fragment(""),_(i)&&r.scheme()===""&&(r=r.absoluteTo(yf(i))),this._url=r.toString()};function Sae(e){return e.length===0?{}:e.indexOf("=")===-1?{[e]:void 0}:pae(e)}function dg(e,t,n){if(!n)return Pr(e,t);const i=fr(e,!0);for(const r in t)if(t.hasOwnProperty(r)){let o=i[r];const s=t[r];_(o)?(Array.isArray(o)||(o=i[r]=[o]),i[r]=o.concat(s)):i[r]=Array.isArray(s)?s.slice():s}return i}ze.prototype.getUrlComponent=function(e,t){if(this.isDataUri)return this._url;let n=this._url;e&&(n=`${n}${Eae(this.queryParameters)}`),n=n.replace(/%7B/g,"{").replace(/%7D/g,"}");const i=this._templateValues;return Object.keys(i).length>0&&(n=n.replace(/{(.*?)}/g,function(r,o){const s=i[o];return _(s)?encodeURIComponent(s):r})),t&&_(this.proxy)&&(n=this.proxy.getURL(n)),n};function Eae(e){const t=Object.keys(e);return t.length===0?"":t.length===1&&!_(e[t[0]])?`?${t[0]}`:`?${fae(e)}`}ze.prototype.setQueryParameters=function(e,t){t?this._queryParameters=dg(this._queryParameters,e,!1):this._queryParameters=dg(e,this._queryParameters,!1)},ze.prototype.appendQueryParameters=function(e){this._queryParameters=dg(e,this._queryParameters,!0)},ze.prototype.setTemplateValues=function(e,t){t?this._templateValues=Pr(this._templateValues,e):this._templateValues=Pr(e,this._templateValues)},ze.prototype.getDerivedResource=function(e){const t=this.clone();if(t._retryCount=0,_(e.url)){const n=e.preserveQueryParameters??!1;t.parseUrl(e.url,!0,n,this._url)}return _(e.queryParameters)&&(t._queryParameters=Pr(e.queryParameters,t.queryParameters)),_(e.templateValues)&&(t._templateValues=Pr(e.templateValues,t.templateValues)),_(e.headers)&&(t.headers=Pr(e.headers,t.headers)),_(e.proxy)&&(t.proxy=e.proxy),_(e.request)&&(t.request=e.request),_(e.retryCallback)&&(t.retryCallback=e.retryCallback),_(e.retryAttempts)&&(t.retryAttempts=e.retryAttempts),t},ze.prototype.retryOnError=function(e){const t=this.retryCallback;if(typeof t!="function"||this._retryCount>=this.retryAttempts)return Promise.resolve(!1);const n=this;return Promise.resolve(t(this,e)).then(function(i){return++n._retryCount,i})},ze.prototype.clone=function(e){return _(e)?(e._url=this._url,e._queryParameters=fr(this._queryParameters),e._templateValues=fr(this._templateValues),e.headers=fr(this.headers),e.proxy=this.proxy,e.retryCallback=this.retryCallback,e.retryAttempts=this.retryAttempts,e._retryCount=0,e.request=this.request.clone(),e):new ze({url:this._url,queryParameters:this.queryParameters,templateValues:this.templateValues,headers:this.headers,proxy:this.proxy,retryCallback:this.retryCallback,retryAttempts:this.retryAttempts,request:this.request.clone(),parseUrl:!1,credits:_(this.credits)?this.credits.slice():void 0})},ze.prototype.getBaseUri=function(e){return cae(this.getUrlComponent(e),e)},ze.prototype.appendForwardSlash=function(){this._url=aae(this._url)},ze.prototype.fetchArrayBuffer=function(){return this.fetch({responseType:"arraybuffer"})},ze.fetchArrayBuffer=function(e){return new ze(e).fetchArrayBuffer()},ze.prototype.fetchBlob=function(){return this.fetch({responseType:"blob"})},ze.fetchBlob=function(e){return new ze(e).fetchBlob()},ze.prototype.fetchImage=function(e){e=e??He.EMPTY_OBJECT;const t=e.preferImageBitmap??!1,n=e.preferBlob??!1,i=e.flipY??!1,r=e.skipColorSpaceConversion??!1;if(aw(this.request),!$5||this.isDataUri||this.isBlobUri||!this.hasHeaders&&!n)return this._fetchImage({resource:this,flipY:i,skipColorSpaceConversion:r,preferImageBitmap:t});const o=this.fetchBlob();if(!_(o))return;let s,a,c,l;return ze.supportsImageBitmapOptions().then(function(u){return s=u,a=s&&t,o}).then(function(u){if(!_(u))return;if(l=u,a)return ze.createImageBitmapFromBlob(u,{flipY:i,premultiplyAlpha:!1,skipColorSpaceConversion:r});const h=window.URL.createObjectURL(u);return c=new ze({url:h}),c._fetchImage({flipY:i,skipColorSpaceConversion:r,preferImageBitmap:!1})}).then(function(u){if(_(u))return u.blob=l,a||window.URL.revokeObjectURL(c.url),u}).catch(function(u){return _(c)&&window.URL.revokeObjectURL(c.url),u.blob=l,Promise.reject(u)})},ze.prototype._fetchImage=function(e){const t=this,n=e.flipY,i=e.skipColorSpaceConversion,r=e.preferImageBitmap,o=t.request;o.url=t.url,o.requestFunction=function(){let a=!1;!t.isDataUri&&!t.isBlobUri&&(a=t.isCrossOriginUrl);const c=gf();return ze._Implementations.createImage(o,a,c,n,i,r),c.promise};const s=gn.request(o);if(_(s))return s.catch(function(a){return o.state!==Wn.FAILED?Promise.reject(a):t.retryOnError(a).then(function(c){return c?(o.state=Wn.UNISSUED,o.deferred=void 0,t._fetchImage({flipY:n,skipColorSpaceConversion:i,preferImageBitmap:r})):Promise.reject(a)})})},ze.fetchImage=function(e){return new ze(e).fetchImage({flipY:e.flipY,skipColorSpaceConversion:e.skipColorSpaceConversion,preferBlob:e.preferBlob,preferImageBitmap:e.preferImageBitmap})},ze.prototype.fetchText=function(){return this.fetch({responseType:"text"})},ze.fetchText=function(e){return new ze(e).fetchText()},ze.prototype.fetchJson=function(){const e=this.fetch({responseType:"text",headers:{Accept:"application/json,*/*;q=0.01"}});if(_(e))return e.then(function(t){if(_(t))return JSON.parse(t)})},ze.fetchJson=function(e){return new ze(e).fetchJson()},ze.prototype.fetchXML=function(){return this.fetch({responseType:"document",overrideMimeType:"text/xml"})},ze.fetchXML=function(e){return new ze(e).fetchXML()},ze.prototype.fetchJsonp=function(e){e=e??"callback",aw(this.request);let t;do t=`loadJsonp${U.nextRandomNumber().toString().substring(2,8)}`;while(_(window[t]));return eL(this,e,t)};function eL(e,t,n){const i={};i[t]=n,e.setQueryParameters(i);const r=e.request,o=e.url;r.url=o,r.requestFunction=function(){const a=gf();return window[n]=function(c){a.resolve(c);try{delete window[n]}catch{window[n]=void 0}},ze._Implementations.loadAndExecuteScript(o,n,a),a.promise};const s=gn.request(r);if(_(s))return s.catch(function(a){return r.state!==Wn.FAILED?Promise.reject(a):e.retryOnError(a).then(function(c){return c?(r.state=Wn.UNISSUED,r.deferred=void 0,eL(e,t,n)):Promise.reject(a)})})}ze.fetchJsonp=function(e){return new ze(e).fetchJsonp(e.callbackParameterName)},ze.prototype._makeRequest=function(e){const t=this;aw(t.request);const n=t.request,i=t.url;n.url=i,n.requestFunction=function(){const o=e.responseType,s=Pr(e.headers,t.headers),a=e.overrideMimeType,c=e.method,l=e.data,u=gf(),h=ze._Implementations.loadWithXhr(i,o,c,l,s,u,a);return _(h)&&_(h.abort)&&(n.cancelFunction=function(){h.abort()}),u.promise};const r=gn.request(n);if(_(r))return r.then(function(o){return n.cancelFunction=void 0,o}).catch(function(o){return n.cancelFunction=void 0,n.state!==Wn.FAILED?Promise.reject(o):t.retryOnError(o).then(function(s){return s?(n.state=Wn.UNISSUED,n.deferred=void 0,t.fetch(e)):Promise.reject(o)})})};function aw(e){if(e.state===Wn.ISSUED||e.state===Wn.ACTIVE)throw new Bn("The Resource is already being fetched.");e.state=Wn.UNISSUED,e.deferred=void 0}const Tae=/^data:(.*?)(;base64)?,(.*)$/;function fg(e,t){const n=decodeURIComponent(t);return e?atob(n):n}function tL(e,t){const n=fg(e,t),i=new ArrayBuffer(n.length),r=new Uint8Array(i);for(let o=0;o<n.length;o++)r[o]=n.charCodeAt(o);return i}function Cae(e,t){t=t??"";const n=e[1],i=!!e[2],r=e[3];let o,s;switch(t){case"":case"text":return fg(i,r);case"arraybuffer":return tL(i,r);case"blob":return o=tL(i,r),new Blob([o],{type:n});case"document":return s=new DOMParser,s.parseFromString(fg(i,r),n);case"json":return JSON.parse(fg(i,r));default:throw new F(`Unhandled responseType: ${t}`)}}ze.prototype.fetch=function(e){return e=Gs(e,{}),e.method="GET",this._makeRequest(e)},ze.fetch=function(e){return new ze(e).fetch({responseType:e.responseType,overrideMimeType:e.overrideMimeType})},ze.prototype.delete=function(e){return e=Gs(e,{}),e.method="DELETE",this._makeRequest(e)},ze.delete=function(e){return new ze(e).delete({responseType:e.responseType,overrideMimeType:e.overrideMimeType,data:e.data})},ze.prototype.head=function(e){return e=Gs(e,{}),e.method="HEAD",this._makeRequest(e)},ze.head=function(e){return new ze(e).head({responseType:e.responseType,overrideMimeType:e.overrideMimeType})},ze.prototype.options=function(e){return e=Gs(e,{}),e.method="OPTIONS",this._makeRequest(e)},ze.options=function(e){return new ze(e).options({responseType:e.responseType,overrideMimeType:e.overrideMimeType})},ze.prototype.post=function(e,t){return T.defined("data",e),t=Gs(t,{}),t.method="POST",t.data=e,this._makeRequest(t)},ze.post=function(e){return new ze(e).post(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})},ze.prototype.put=function(e,t){return T.defined("data",e),t=Gs(t,{}),t.method="PUT",t.data=e,this._makeRequest(t)},ze.put=function(e){return new ze(e).put(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})},ze.prototype.patch=function(e,t){return T.defined("data",e),t=Gs(t,{}),t.method="PATCH",t.data=e,this._makeRequest(t)},ze.patch=function(e){return new ze(e).patch(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})},ze._Implementations={},ze._Implementations.loadImageElement=function(e,t,n){const i=new Image;i.onload=function(){i.naturalWidth===0&&i.naturalHeight===0&&i.width===0&&i.height===0&&(i.width=300,i.height=150),n.resolve(i)},i.onerror=function(r){n.reject(r)},t&&(Qu.contains(e)?i.crossOrigin="use-credentials":i.crossOrigin=""),i.src=e},ze._Implementations.createImage=function(e,t,n,i,r,o,s){const a=e.url;ze.supportsImageBitmapOptions().then(function(c){if(!(c&&o)){ze._Implementations.loadImageElement(a,t,n);return}const l="blob",u="GET",h=gf(),d=ze._Implementations.loadWithXhr(a,l,u,void 0,s,h,void 0,void 0,void 0);return _(d)&&_(d.abort)&&(e.cancelFunction=function(){d.abort()}),h.promise.then(function(f){if(!_(f)){n.reject(new Bn(`Successfully retrieved ${a} but it contained no content.`));return}return ze.createImageBitmapFromBlob(f,{flipY:i,premultiplyAlpha:!1,skipColorSpaceConversion:r})}).then(function(f){n.resolve(f)})}).catch(function(c){n.reject(c)})},ze.createImageBitmapFromBlob=function(e,t){return T.defined("options",t),T.typeOf.bool("options.flipY",t.flipY),T.typeOf.bool("options.premultiplyAlpha",t.premultiplyAlpha),T.typeOf.bool("options.skipColorSpaceConversion",t.skipColorSpaceConversion),createImageBitmap(e,{imageOrientation:t.flipY?"flipY":"none",premultiplyAlpha:t.premultiplyAlpha?"premultiply":"none",colorSpaceConversion:t.skipColorSpaceConversion?"none":"default"})};function Rae(e,t,n,i,r,o,s){fetch(e,{method:n,headers:r}).then(async a=>{if(!a.ok){const c={};a.headers.forEach((l,u)=>{c[u]=l}),o.reject(new bf(a.status,a,c));return}switch(t){case"text":o.resolve(a.text());break;case"json":o.resolve(a.json());break;default:o.resolve(new Uint8Array(await a.arrayBuffer()).buffer);break}}).catch(()=>{o.reject(new bf)})}const Iae=typeof XMLHttpRequest>"u";ze._Implementations.loadWithXhr=function(e,t,n,i,r,o,s){const a=Tae.exec(e);if(a!==null){o.resolve(Cae(a,t));return}if(Iae){Rae(e,t,n,i,r,o);return}const c=new XMLHttpRequest;if(Qu.contains(e)&&(c.withCredentials=!0),c.open(n,e,!0),_(s)&&_(c.overrideMimeType)&&c.overrideMimeType(s),_(r))for(const u in r)r.hasOwnProperty(u)&&c.setRequestHeader(u,r[u]);_(t)&&(c.responseType=t);let l=!1;return typeof e=="string"&&(l=e.indexOf("file://")===0||typeof window<"u"&&window.location.origin==="file://"),c.onload=function(){if((c.status<200||c.status>=300)&&!(l&&c.status===0)){o.reject(new bf(c.status,c.response,c.getAllResponseHeaders()));return}const u=c.response,h=c.responseType;if(n==="HEAD"||n==="OPTIONS"){const f=c.getAllResponseHeaders().trim().split(/[\r\n]+/),p={};f.forEach(function(m){const y=m.split(": "),g=y.shift();p[g]=y.join(": ")}),o.resolve(p);return}if(c.status===204)o.resolve(void 0);else if(_(u)&&(!_(t)||h===t))o.resolve(u);else if(t==="json"&&typeof u=="string")try{o.resolve(JSON.parse(u))}catch(d){o.reject(d)}else(h===""||h==="document")&&_(c.responseXML)&&c.responseXML.hasChildNodes()?o.resolve(c.responseXML):(h===""||h==="text")&&_(c.responseText)?o.resolve(c.responseText):o.reject(new Bn("Invalid XMLHttpRequest response type."))},c.onerror=function(u){o.reject(new bf)},c.send(i),c},ze._Implementations.loadAndExecuteScript=function(e,t,n){return dae(e).catch(function(i){n.reject(i)})},ze._DefaultImplementations={},ze._DefaultImplementations.createImage=ze._Implementations.createImage,ze._DefaultImplementations.loadWithXhr=ze._Implementations.loadWithXhr,ze._DefaultImplementations.loadAndExecuteScript=ze._Implementations.loadAndExecuteScript,ze.DEFAULT=Object.freeze(new ze({url:typeof document>"u"?"":document.location.href.split("?")[0]}));function _f(e){e=e??He.EMPTY_OBJECT,this._dates=void 0,this._samples=void 0,this._dateColumn=-1,this._xPoleWanderRadiansColumn=-1,this._yPoleWanderRadiansColumn=-1,this._ut1MinusUtcSecondsColumn=-1,this._xCelestialPoleOffsetRadiansColumn=-1,this._yCelestialPoleOffsetRadiansColumn=-1,this._taiMinusUtcSecondsColumn=-1,this._columnCount=0,this._lastIndex=-1,this._addNewLeapSeconds=e.addNewLeapSeconds??!0,_(e.data)?nL(this,e.data):nL(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]})}_f.fromUrl=async function(e,t){T.defined("url",e),t=t??He.EMPTY_OBJECT;const n=ze.createIfNeeded(e);let i;try{i=await n.fetchJson()}catch{throw new Bn(`An error occurred while retrieving the EOP data from the URL ${n.url}.`)}return new _f({addNewLeapSeconds:t.addNewLeapSeconds,data:i})},_f.NONE=Object.freeze({compute:function(e,t){return _(t)?(t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0):t=new $v(0,0,0,0,0),t}}),_f.prototype.compute=function(e,t){if(!_(this._samples))return;if(_(t)||(t=new $v(0,0,0,0,0)),this._samples.length===0)return t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0,t;const n=this._dates,i=this._lastIndex;let r=0,o=0;if(_(i)){const a=n[i],c=n[i+1],l=Fe.lessThanOrEquals(a,e),u=!_(c),h=u||Fe.greaterThanOrEquals(c,e);if(l&&h)return r=i,!u&&c.equals(e)&&++r,o=r+1,rL(this,n,this._samples,e,r,o,t),t}let s=pf(n,e,Fe.compare,this._dateColumn);return s>=0?(s<n.length-1&&n[s+1].equals(e)&&++s,r=s,o=s):(o=~s,r=o-1,r<0&&(r=0)),this._lastIndex=r,rL(this,n,this._samples,e,r,o,t),t};function Mae(e,t){return Fe.compare(e.julianDate,t)}function nL(e,t){if(!_(t.columnNames))throw new Bn("Error in loaded EOP data: The columnNames property is required.");if(!_(t.samples))throw new Bn("Error in loaded EOP data: The samples property is required.");const n=t.columnNames.indexOf("modifiedJulianDateUtc"),i=t.columnNames.indexOf("xPoleWanderRadians"),r=t.columnNames.indexOf("yPoleWanderRadians"),o=t.columnNames.indexOf("ut1MinusUtcSeconds"),s=t.columnNames.indexOf("xCelestialPoleOffsetRadians"),a=t.columnNames.indexOf("yCelestialPoleOffsetRadians"),c=t.columnNames.indexOf("taiMinusUtcSeconds");if(n<0||i<0||r<0||o<0||s<0||a<0||c<0)throw new Bn("Error in loaded EOP data: The columnNames property must include modifiedJulianDateUtc, xPoleWanderRadians, yPoleWanderRadians, ut1MinusUtcSeconds, xCelestialPoleOffsetRadians, yCelestialPoleOffsetRadians, and taiMinusUtcSeconds columns");const l=e._samples=t.samples,u=e._dates=[];e._dateColumn=n,e._xPoleWanderRadiansColumn=i,e._yPoleWanderRadiansColumn=r,e._ut1MinusUtcSecondsColumn=o,e._xCelestialPoleOffsetRadiansColumn=s,e._yCelestialPoleOffsetRadiansColumn=a,e._taiMinusUtcSecondsColumn=c,e._columnCount=t.columnNames.length,e._lastIndex=void 0;let h;const d=e._addNewLeapSeconds;for(let f=0,p=l.length;f<p;f+=e._columnCount){const m=l[f+n],y=l[f+c],g=m+Fn.MODIFIED_JULIAN_DATE_DIFFERENCE,v=new Fe(g,y,Ft.TAI);if(u.push(v),d){if(y!==h&&_(h)){const S=Fe.leapSeconds,E=pf(S,v,Mae);if(E<0){const C=new ln(v,y);S.splice(~E,0,C)}}h=y}}}function iL(e,t,n,i,r){const o=n*i;r.xPoleWander=t[o+e._xPoleWanderRadiansColumn],r.yPoleWander=t[o+e._yPoleWanderRadiansColumn],r.xPoleOffset=t[o+e._xCelestialPoleOffsetRadiansColumn],r.yPoleOffset=t[o+e._yCelestialPoleOffsetRadiansColumn],r.ut1MinusUtc=t[o+e._ut1MinusUtcSecondsColumn]}function vf(e,t,n){return t+e*(n-t)}function rL(e,t,n,i,r,o,s){const a=e._columnCount;if(o>t.length-1)return s.xPoleWander=0,s.yPoleWander=0,s.xPoleOffset=0,s.yPoleOffset=0,s.ut1MinusUtc=0,s;const c=t[r],l=t[o];if(c.equals(l)||i.equals(c))return iL(e,n,r,a,s),s;if(i.equals(l))return iL(e,n,o,a,s),s;const u=Fe.secondsDifference(i,c)/Fe.secondsDifference(l,c),h=r*a,d=o*a;let f=n[h+e._ut1MinusUtcSecondsColumn],p=n[d+e._ut1MinusUtcSecondsColumn];const m=p-f;if(m>.5||m<-.5){const y=n[h+e._taiMinusUtcSecondsColumn],g=n[d+e._taiMinusUtcSecondsColumn];y!==g&&(l.equals(i)?f=p:p-=g-y)}return s.xPoleWander=vf(u,n[h+e._xPoleWanderRadiansColumn],n[d+e._xPoleWanderRadiansColumn]),s.yPoleWander=vf(u,n[h+e._yPoleWanderRadiansColumn],n[d+e._yPoleWanderRadiansColumn]),s.xPoleOffset=vf(u,n[h+e._xCelestialPoleOffsetRadiansColumn],n[d+e._xCelestialPoleOffsetRadiansColumn]),s.yPoleOffset=vf(u,n[h+e._yCelestialPoleOffsetRadiansColumn],n[d+e._yCelestialPoleOffsetRadiansColumn]),s.ut1MinusUtc=vf(u,f,p),s}function xi(e,t,n){this.heading=e??0,this.pitch=t??0,this.roll=n??0}xi.fromQuaternion=function(e,t){if(!_(e))throw new F("quaternion is required");_(t)||(t=new xi);const n=2*(e.w*e.y-e.z*e.x),i=1-2*(e.x*e.x+e.y*e.y),r=2*(e.w*e.x+e.y*e.z),o=1-2*(e.y*e.y+e.z*e.z),s=2*(e.w*e.z+e.x*e.y);return t.heading=-Math.atan2(s,o),t.roll=Math.atan2(r,i),t.pitch=-U.asinClamped(n),t},xi.fromDegrees=function(e,t,n,i){if(!_(e))throw new F("heading is required");if(!_(t))throw new F("pitch is required");if(!_(n))throw new F("roll is required");return _(i)||(i=new xi),i.heading=e*U.RADIANS_PER_DEGREE,i.pitch=t*U.RADIANS_PER_DEGREE,i.roll=n*U.RADIANS_PER_DEGREE,i},xi.clone=function(e,t){if(_(e))return _(t)?(t.heading=e.heading,t.pitch=e.pitch,t.roll=e.roll,t):new xi(e.heading,e.pitch,e.roll)},xi.equals=function(e,t){return e===t||_(e)&&_(t)&&e.heading===t.heading&&e.pitch===t.pitch&&e.roll===t.roll},xi.equalsEpsilon=function(e,t,n,i){return e===t||_(e)&&_(t)&&U.equalsEpsilon(e.heading,t.heading,n,i)&&U.equalsEpsilon(e.pitch,t.pitch,n,i)&&U.equalsEpsilon(e.roll,t.roll,n,i)},xi.prototype.clone=function(e){return xi.clone(this,e)},xi.prototype.equals=function(e){return xi.equals(this,e)},xi.prototype.equalsEpsilon=function(e,t,n){return xi.equalsEpsilon(this,e,t,n)},xi.prototype.toString=function(){return`(${this.heading}, ${this.pitch}, ${this.roll})`};const oL=/((?:.*\/)|^)Cesium\.js(?:\?|\#|$)/;function Lae(){const e=document.getElementsByTagName("script");for(let t=0,n=e.length;t<n;++t){const i=e[t].getAttribute("src"),r=oL.exec(i);if(r!==null)return r[1]}}let pg;function sL(e){return typeof document>"u"?e:(_(pg)||(pg=document.createElement("a")),pg.href=e,pg.href)}let _l;function aL(){if(_(_l))return _l;let e;if(typeof CESIUM_BASE_URL<"u"?e=CESIUM_BASE_URL:_(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:lu&&lu.tagName.toUpperCase()==="SCRIPT"&&lu.src||new URL("core.umd.cjs",document.baseURI).href)?e=yf(".",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:lu&&lu.tagName.toUpperCase()==="SCRIPT"&&lu.src||new URL("core.umd.cjs",document.baseURI).href):typeof define=="object"&&_(define.amd)&&!define.amd.toUrlUndefined&&_(require.toUrl)?e=yf("..",qr("Core/buildModuleUrl.js")):e=Lae(),!_(e))throw new F("Unable to determine Cesium base URL automatically, try defining a global variable called CESIUM_BASE_URL.");return _l=new ze({url:sL(e)}),_l.appendForwardSlash(),_l}function Pae(e){return sL(require.toUrl(`../${e}`))}function cL(e){return aL().getDerivedResource({url:e}).url}let mg;function qr(e){return _(mg)||(typeof define=="object"&&_(define.amd)&&!define.amd.toUrlUndefined&&_(require.toUrl)?mg=Pae:mg=cL),mg(e)}qr._cesiumScriptRegex=oL,qr._buildModuleUrlFromBaseUrl=cL,qr._clearBaseResource=function(){_l=void 0},qr.setBaseUrl=function(e){_l=ze.DEFAULT.getDerivedResource({url:e})},qr.getCesiumBaseUrl=aL;function lL(e,t,n){this.x=e,this.y=t,this.s=n}function cw(e){e=e??He.EMPTY_OBJECT,this._xysFileUrlTemplate=ze.createIfNeeded(e.xysFileUrlTemplate),this._interpolationOrder=e.interpolationOrder??9,this._sampleZeroJulianEphemerisDate=e.sampleZeroJulianEphemerisDate??24423965e-1,this._sampleZeroDateTT=new Fe(this._sampleZeroJulianEphemerisDate,0,Ft.TAI),this._stepSizeDays=e.stepSizeDays??1,this._samplesPerXysFile=e.samplesPerXysFile??1e3,this._totalSamples=e.totalSamples??27426,this._samples=new Array(this._totalSamples*3),this._chunkDownloadsInProgress=[];const t=this._interpolationOrder,n=this._denominators=new Array(t+1),i=this._xTable=new Array(t+1),r=Math.pow(this._stepSizeDays,t);for(let o=0;o<=t;++o){n[o]=r,i[o]=o*this._stepSizeDays;for(let s=0;s<=t;++s)s!==o&&(n[o]*=o-s);n[o]=1/n[o]}this._work=new Array(t+1),this._coef=new Array(t+1)}const Oae=new Fe(0,0,Ft.TAI);function lw(e,t,n){const i=Oae;return i.dayNumber=t,i.secondsOfDay=n,Fe.daysDifference(i,e._sampleZeroDateTT)}cw.prototype.preload=function(e,t,n,i){const r=lw(this,e,t),o=lw(this,n,i);let s=r/this._stepSizeDays-this._interpolationOrder/2|0;s<0&&(s=0);let a=o/this._stepSizeDays-this._interpolationOrder/2|0+this._interpolationOrder;a>=this._totalSamples&&(a=this._totalSamples-1);const c=s/this._samplesPerXysFile|0,l=a/this._samplesPerXysFile|0,u=[];for(let h=c;h<=l;++h)u.push(uw(this,h));return Promise.all(u)},cw.prototype.computeXysRadians=function(e,t,n){const i=lw(this,e,t);if(i<0)return;const r=i/this._stepSizeDays|0;if(r>=this._totalSamples)return;const o=this._interpolationOrder;let s=r-(o/2|0);s<0&&(s=0);let a=s+o;a>=this._totalSamples&&(a=this._totalSamples-1,s=a-o,s<0&&(s=0));let c=!1;const l=this._samples;if(_(l[s*3])||(uw(this,s/this._samplesPerXysFile|0),c=!0),_(l[a*3])||(uw(this,a/this._samplesPerXysFile|0),c=!0),c)return;_(n)?(n.x=0,n.y=0,n.s=0):n=new lL(0,0,0);const u=i-s*this._stepSizeDays,h=this._work,d=this._denominators,f=this._coef,p=this._xTable;let m,y;for(m=0;m<=o;++m)h[m]=u-p[m];for(m=0;m<=o;++m){for(f[m]=1,y=0;y<=o;++y)y!==m&&(f[m]*=h[y]);f[m]*=d[m];let g=(s+m)*3;n.x+=f[m]*l[g++],n.y+=f[m]*l[g++],n.s+=f[m]*l[g]}return n};function uw(e,t){if(e._chunkDownloadsInProgress[t])return e._chunkDownloadsInProgress[t];let n;const i=e._xysFileUrlTemplate;_(i)?n=i.getDerivedResource({templateValues:{0:t}}):n=new ze({url:qr(`Assets/IAU2006_XYS/IAU2006_XYS_${t}.json`)});const r=n.fetchJson().then(function(o){e._chunkDownloadsInProgress[t]=!1;const s=e._samples,a=o.samples,c=t*e._samplesPerXysFile*3;for(let l=0,u=a.length;l<u;++l)s[c+l]=a[l]});return e._chunkDownloadsInProgress[t]=r,r}function ie(e,t,n,i,r,o,s,a,c){this[0]=e??0,this[1]=i??0,this[2]=s??0,this[3]=t??0,this[4]=r??0,this[5]=a??0,this[6]=n??0,this[7]=o??0,this[8]=c??0}ie.packedLength=9,ie.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=n??0,t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t[n++]=e[4],t[n++]=e[5],t[n++]=e[6],t[n++]=e[7],t[n++]=e[8],t},ie.unpack=function(e,t,n){return T.defined("array",e),t=t??0,_(n)||(n=new ie),n[0]=e[t++],n[1]=e[t++],n[2]=e[t++],n[3]=e[t++],n[4]=e[t++],n[5]=e[t++],n[6]=e[t++],n[7]=e[t++],n[8]=e[t++],n},ie.packArray=function(e,t){T.defined("array",e);const n=e.length,i=n*9;if(!_(t))t=new Array(i);else{if(!Array.isArray(t)&&t.length!==i)throw new F("If result is a typed array, it must have exactly array.length * 9 elements");t.length!==i&&(t.length=i)}for(let r=0;r<n;++r)ie.pack(e[r],t,r*9);return t},ie.unpackArray=function(e,t){if(T.defined("array",e),T.typeOf.number.greaterThanOrEquals("array.length",e.length,9),e.length%9!==0)throw new F("array length must be a multiple of 9.");const n=e.length;_(t)?t.length=n/9:t=new Array(n/9);for(let i=0;i<n;i+=9){const r=i/9;t[r]=ie.unpack(e,i,t[r])}return t},ie.clone=function(e,t){if(_(e))return _(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):new ie(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8])},ie.fromArray=ie.unpack,ie.fromColumnMajorArray=function(e,t){return T.defined("values",e),ie.clone(e,t)},ie.fromRowMajorArray=function(e,t){return T.defined("values",e),_(t)?(t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],t):new ie(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},ie.fromQuaternion=function(e,t){T.typeOf.object("quaternion",e);const n=e.x*e.x,i=e.x*e.y,r=e.x*e.z,o=e.x*e.w,s=e.y*e.y,a=e.y*e.z,c=e.y*e.w,l=e.z*e.z,u=e.z*e.w,h=e.w*e.w,d=n-s-l+h,f=2*(i-u),p=2*(r+c),m=2*(i+u),y=-n+s-l+h,g=2*(a-o),v=2*(r-c),S=2*(a+o),E=-n-s+l+h;return _(t)?(t[0]=d,t[1]=m,t[2]=v,t[3]=f,t[4]=y,t[5]=S,t[6]=p,t[7]=g,t[8]=E,t):new ie(d,f,p,m,y,g,v,S,E)},ie.fromHeadingPitchRoll=function(e,t){T.typeOf.object("headingPitchRoll",e);const n=Math.cos(-e.pitch),i=Math.cos(-e.heading),r=Math.cos(e.roll),o=Math.sin(-e.pitch),s=Math.sin(-e.heading),a=Math.sin(e.roll),c=n*i,l=-r*s+a*o*i,u=a*s+r*o*i,h=n*s,d=r*i+a*o*s,f=-a*i+r*o*s,p=-o,m=a*n,y=r*n;return _(t)?(t[0]=c,t[1]=h,t[2]=p,t[3]=l,t[4]=d,t[5]=m,t[6]=u,t[7]=f,t[8]=y,t):new ie(c,l,u,h,d,f,p,m,y)},ie.fromScale=function(e,t){return T.typeOf.object("scale",e),_(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=e.y,t[5]=0,t[6]=0,t[7]=0,t[8]=e.z,t):new ie(e.x,0,0,0,e.y,0,0,0,e.z)},ie.fromUniformScale=function(e,t){return T.typeOf.number("scale",e),_(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=e,t):new ie(e,0,0,0,e,0,0,0,e)},ie.fromCrossProduct=function(e,t){return T.typeOf.object("vector",e),_(t)?(t[0]=0,t[1]=e.z,t[2]=-e.y,t[3]=-e.z,t[4]=0,t[5]=e.x,t[6]=e.y,t[7]=-e.x,t[8]=0,t):new ie(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},ie.fromRotationX=function(e,t){T.typeOf.number("angle",e);const n=Math.cos(e),i=Math.sin(e);return _(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=n,t[5]=i,t[6]=0,t[7]=-i,t[8]=n,t):new ie(1,0,0,0,n,-i,0,i,n)},ie.fromRotationY=function(e,t){T.typeOf.number("angle",e);const n=Math.cos(e),i=Math.sin(e);return _(t)?(t[0]=n,t[1]=0,t[2]=-i,t[3]=0,t[4]=1,t[5]=0,t[6]=i,t[7]=0,t[8]=n,t):new ie(n,0,i,0,1,0,-i,0,n)},ie.fromRotationZ=function(e,t){T.typeOf.number("angle",e);const n=Math.cos(e),i=Math.sin(e);return _(t)?(t[0]=n,t[1]=i,t[2]=0,t[3]=-i,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new ie(n,-i,0,i,n,0,0,0,1)},ie.toArray=function(e,t){return T.typeOf.object("matrix",e),_(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},ie.getElementIndex=function(e,t){return T.typeOf.number.greaterThanOrEquals("row",t,0),T.typeOf.number.lessThanOrEquals("row",t,2),T.typeOf.number.greaterThanOrEquals("column",e,0),T.typeOf.number.lessThanOrEquals("column",e,2),e*3+t},ie.getColumn=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.number.greaterThanOrEquals("index",t,0),T.typeOf.number.lessThanOrEquals("index",t,2),T.typeOf.object("result",n);const i=t*3,r=e[i],o=e[i+1],s=e[i+2];return n.x=r,n.y=o,n.z=s,n},ie.setColumn=function(e,t,n,i){T.typeOf.object("matrix",e),T.typeOf.number.greaterThanOrEquals("index",t,0),T.typeOf.number.lessThanOrEquals("index",t,2),T.typeOf.object("cartesian",n),T.typeOf.object("result",i),i=ie.clone(e,i);const r=t*3;return i[r]=n.x,i[r+1]=n.y,i[r+2]=n.z,i},ie.getRow=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.number.greaterThanOrEquals("index",t,0),T.typeOf.number.lessThanOrEquals("index",t,2),T.typeOf.object("result",n);const i=e[t],r=e[t+3],o=e[t+6];return n.x=i,n.y=r,n.z=o,n},ie.setRow=function(e,t,n,i){return T.typeOf.object("matrix",e),T.typeOf.number.greaterThanOrEquals("index",t,0),T.typeOf.number.lessThanOrEquals("index",t,2),T.typeOf.object("cartesian",n),T.typeOf.object("result",i),i=ie.clone(e,i),i[t]=n.x,i[t+3]=n.y,i[t+6]=n.z,i};const Gae=new b;ie.setScale=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.object("scale",t),T.typeOf.object("result",n);const i=ie.getScale(e,Gae),r=t.x/i.x,o=t.y/i.y,s=t.z/i.z;return n[0]=e[0]*r,n[1]=e[1]*r,n[2]=e[2]*r,n[3]=e[3]*o,n[4]=e[4]*o,n[5]=e[5]*o,n[6]=e[6]*s,n[7]=e[7]*s,n[8]=e[8]*s,n};const Vae=new b;ie.setUniformScale=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.number("scale",t),T.typeOf.object("result",n);const i=ie.getScale(e,Vae),r=t/i.x,o=t/i.y,s=t/i.z;return n[0]=e[0]*r,n[1]=e[1]*r,n[2]=e[2]*r,n[3]=e[3]*o,n[4]=e[4]*o,n[5]=e[5]*o,n[6]=e[6]*s,n[7]=e[7]*s,n[8]=e[8]*s,n};const hw=new b;ie.getScale=function(e,t){return T.typeOf.object("matrix",e),T.typeOf.object("result",t),t.x=b.magnitude(b.fromElements(e[0],e[1],e[2],hw)),t.y=b.magnitude(b.fromElements(e[3],e[4],e[5],hw)),t.z=b.magnitude(b.fromElements(e[6],e[7],e[8],hw)),t};const uL=new b;ie.getMaximumScale=function(e){return ie.getScale(e,uL),b.maximumComponent(uL)};const Fae=new b;ie.setRotation=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.object("result",n);const i=ie.getScale(e,Fae);return n[0]=t[0]*i.x,n[1]=t[1]*i.x,n[2]=t[2]*i.x,n[3]=t[3]*i.y,n[4]=t[4]*i.y,n[5]=t[5]*i.y,n[6]=t[6]*i.z,n[7]=t[7]*i.z,n[8]=t[8]*i.z,n};const Aae=new b;ie.getRotation=function(e,t){T.typeOf.object("matrix",e),T.typeOf.object("result",t);const n=ie.getScale(e,Aae);return t[0]=e[0]/n.x,t[1]=e[1]/n.x,t[2]=e[2]/n.x,t[3]=e[3]/n.y,t[4]=e[4]/n.y,t[5]=e[5]/n.y,t[6]=e[6]/n.z,t[7]=e[7]/n.z,t[8]=e[8]/n.z,t},ie.multiply=function(e,t,n){T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n);const i=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],r=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],o=e[2]*t[0]+e[5]*t[1]+e[8]*t[2],s=e[0]*t[3]+e[3]*t[4]+e[6]*t[5],a=e[1]*t[3]+e[4]*t[4]+e[7]*t[5],c=e[2]*t[3]+e[5]*t[4]+e[8]*t[5],l=e[0]*t[6]+e[3]*t[7]+e[6]*t[8],u=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],h=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return n[0]=i,n[1]=r,n[2]=o,n[3]=s,n[4]=a,n[5]=c,n[6]=l,n[7]=u,n[8]=h,n},ie.add=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n},ie.subtract=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n},ie.multiplyByVector=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.object("cartesian",t),T.typeOf.object("result",n);const i=t.x,r=t.y,o=t.z,s=e[0]*i+e[3]*r+e[6]*o,a=e[1]*i+e[4]*r+e[7]*o,c=e[2]*i+e[5]*r+e[8]*o;return n.x=s,n.y=a,n.z=c,n},ie.multiplyByScalar=function(e,t,n){return T.typeOf.object("matrix",e),T.typeOf.number("scalar",t),T.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n},ie.multiplyByScale=function(e,t,n){return T.typeOf.object("matrix",e),T.typeOf.object("scale",t),T.typeOf.object("result",n),n[0]=e[0]*t.x,n[1]=e[1]*t.x,n[2]=e[2]*t.x,n[3]=e[3]*t.y,n[4]=e[4]*t.y,n[5]=e[5]*t.y,n[6]=e[6]*t.z,n[7]=e[7]*t.z,n[8]=e[8]*t.z,n},ie.multiplyByUniformScale=function(e,t,n){return T.typeOf.object("matrix",e),T.typeOf.number("scale",t),T.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n},ie.negate=function(e,t){return T.typeOf.object("matrix",e),T.typeOf.object("result",t),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t},ie.transpose=function(e,t){T.typeOf.object("matrix",e),T.typeOf.object("result",t);const n=e[0],i=e[3],r=e[6],o=e[1],s=e[4],a=e[7],c=e[2],l=e[5],u=e[8];return t[0]=n,t[1]=i,t[2]=r,t[3]=o,t[4]=s,t[5]=a,t[6]=c,t[7]=l,t[8]=u,t};function zae(e){let t=0;for(let n=0;n<9;++n){const i=e[n];t+=i*i}return Math.sqrt(t)}const dw=[1,0,0],fw=[2,2,1];function Nae(e){let t=0;for(let n=0;n<3;++n){const i=e[ie.getElementIndex(fw[n],dw[n])];t+=2*i*i}return Math.sqrt(t)}function kae(e,t){const n=U.EPSILON15;let i=0,r=1;for(let l=0;l<3;++l){const u=Math.abs(e[ie.getElementIndex(fw[l],dw[l])]);u>i&&(r=l,i=u)}let o=1,s=0;const a=dw[r],c=fw[r];if(Math.abs(e[ie.getElementIndex(c,a)])>n){const l=e[ie.getElementIndex(c,c)],u=e[ie.getElementIndex(a,a)],h=e[ie.getElementIndex(c,a)],d=(l-u)/2/h;let f;d<0?f=-1/(-d+Math.sqrt(1+d*d)):f=1/(d+Math.sqrt(1+d*d)),o=1/Math.sqrt(1+f*f),s=f*o}return t=ie.clone(ie.IDENTITY,t),t[ie.getElementIndex(a,a)]=t[ie.getElementIndex(c,c)]=o,t[ie.getElementIndex(c,a)]=s,t[ie.getElementIndex(a,c)]=-s,t}const gg=new ie,hL=new ie;ie.computeEigenDecomposition=function(e,t){T.typeOf.object("matrix",e);const n=U.EPSILON20,i=10;let r=0,o=0;_(t)||(t={});const s=t.unitary=ie.clone(ie.IDENTITY,t.unitary),a=t.diagonal=ie.clone(e,t.diagonal),c=n*zae(a);for(;o<i&&Nae(a)>c;)kae(a,gg),ie.transpose(gg,hL),ie.multiply(a,gg,a),ie.multiply(hL,a,a),ie.multiply(s,gg,s),++r>2&&(++o,r=0);return t},ie.abs=function(e,t){return T.typeOf.object("matrix",e),T.typeOf.object("result",t),t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t},ie.determinant=function(e){T.typeOf.object("matrix",e);const t=e[0],n=e[3],i=e[6],r=e[1],o=e[4],s=e[7],a=e[2],c=e[5],l=e[8];return t*(o*l-c*s)+r*(c*i-n*l)+a*(n*s-o*i)},ie.inverse=function(e,t){T.typeOf.object("matrix",e),T.typeOf.object("result",t);const n=e[0],i=e[1],r=e[2],o=e[3],s=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=ie.determinant(e);if(Math.abs(h)<=U.EPSILON15)throw new F("matrix is not invertible");t[0]=s*u-l*a,t[1]=l*r-i*u,t[2]=i*a-s*r,t[3]=c*a-o*u,t[4]=n*u-c*r,t[5]=o*r-n*a,t[6]=o*l-c*s,t[7]=c*i-n*l,t[8]=n*s-o*i;const d=1/h;return ie.multiplyByScalar(t,d,t)};const Xae=new ie;ie.inverseTranspose=function(e,t){return T.typeOf.object("matrix",e),T.typeOf.object("result",t),ie.inverse(ie.transpose(e,Xae),t)},ie.equals=function(e,t){return e===t||_(e)&&_(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},ie.equalsEpsilon=function(e,t,n){return n=n??0,e===t||_(e)&&_(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n},ie.IDENTITY=Object.freeze(new ie(1,0,0,0,1,0,0,0,1)),ie.ZERO=Object.freeze(new ie(0,0,0,0,0,0,0,0,0)),ie.COLUMN0ROW0=0,ie.COLUMN0ROW1=1,ie.COLUMN0ROW2=2,ie.COLUMN1ROW0=3,ie.COLUMN1ROW1=4,ie.COLUMN1ROW2=5,ie.COLUMN2ROW0=6,ie.COLUMN2ROW1=7,ie.COLUMN2ROW2=8,Object.defineProperties(ie.prototype,{length:{get:function(){return ie.packedLength}}}),ie.prototype.clone=function(e){return ie.clone(this,e)},ie.prototype.equals=function(e){return ie.equals(this,e)},ie.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]},ie.prototype.equalsEpsilon=function(e,t){return ie.equalsEpsilon(this,e,t)},ie.prototype.toString=function(){return`(${this[0]}, ${this[3]}, ${this[6]})
@@ -6728,7 +6728,7 @@ vec3 getTurboColormap(const float v) {
6728
6728
  ${zb}
6729
6729
  ${rPe}
6730
6730
  ${tPe}
6731
- `,uniforms:{...Qr(u,["color","frustumLength","blackPoint","whitePoint","gamma"]),globeDepthTexture:()=>c?.()??d._depthTexture}});if(r){const f=$Le({prefix:e,outputType:s,useGlobeDepth:a,getGlobeDepthTexture:c,uniforms:{textureScale:t,...Qr(u,["frustumLength","normalExponent","depthExponent"])}}),p=new M.PostProcessStageComposite({name:`${e}_ambient_occlusion_generate_and_filter`,stages:[h,f]});return d.uniforms.ambientOcclusionTexture=p.name,new M.PostProcessStageComposite({name:`${e}_ambient_occlusion`,stages:[p,d],inputPreviousStageTexture:!1,uniforms:fE([{stage:h,uniforms:["intensity","maxRadius","bias","frustumLength","focalLength"]},{stage:f,uniforms:["frustumLength","normalExponent","depthExponent"]},{stage:d,uniforms:["color","blackPoint","whitePoint","gamma"]}])})}else return d.uniforms.ambientOcclusionTexture=h.name,new M.PostProcessStageComposite({name:`${e}_ambient_occlusion`,stages:[h,d],inputPreviousStageTexture:!1,uniforms:fE([{stage:h,uniforms:["intensity","maxRadius","bias","frustumLength","focalLength"]},{stage:d,uniforms:["color","blackPoint","whitePoint","gamma"]}])})}const aPe=({enabled:e=!0,textureScale:t,directions:n,steps:i,denoise:r,accurateNormalReconstruction:o,outputType:s,useGlobeDepth:a,...c})=>{const{viewer:l}=Qn(),u=l?.scene,h=fF({owner:u?.postProcessStages,keys:[t,i,n,r,o,s,a],create:()=>{const d=sPe({textureScale:t,steps:i,directions:n,denoise:r,accurateNormalReconstruction:o,outputType:s,useGlobeDepth:a,getGlobeDepthTexture:()=>u.context.uniformState.globeDepthTexture,uniforms:c});return d.enabled=e,d},transferOwnership:(d,f)=>(f?.add(d),()=>{f?.remove(d)})});return h.enabled=e,Object.assign(h.uniforms,c),u?.requestRender(),Gl(()=>{const d=u?.camera.frustum;if(d instanceof M.PerspectiveFrustum&&d.fovy!==void 0&&d.aspectRatio!==void 0){const f=1/Math.tan(d.fovy/2);h.uniforms.focalLength.x=f*d.aspectRatio,h.uniforms.focalLength.y=f}}),null},cPe=e=>{const t=Qn(),[n,i]=R.useState(!1);return Gl(()=>{const r=t.scene;i(!r?.globe.depthTestAgainstTerrain);const{globeHeight:o}=r;if(!r||o==null)return;const s=r.camera.positionCartographic.height-o,a=r?.camera.frustum;a instanceof M.PerspectiveFrustum&&a.fov!==void 0&&(r.camera.frustum.near=M.Math.clamp(s-1,1,5)/Math.tan(a.fov/2))}),ce.jsx(aPe,{...e,useGlobeDepth:n})};var SN=(e=>(e[e.Occlusion=1]="Occlusion",e[e.Normal=2]="Normal",e[e.Depth=3]="Depth",e[e.Weight=4]="Weight",e[e.Shade=5]="Shade",e))(SN||{});const lPe={low:{directions:4,steps:4,textureScale:.5,maxRadius:30},medium:{directions:4,steps:8,textureScale:.5,maxRadius:40},high:{directions:8,steps:8,textureScale:1,maxRadius:40},extreme:{directions:16,steps:16,textureScale:1,maxRadius:40}},uPe="#00bebe",d0="#3B3CD0",hPe="#FF9900",dPe="#3B3CD0";let Jl,fPe,pPe,Ql;const f0=({position:e,clampToGround:t=!1,index:n,isEditing:i,isSelected:r,isAddingPoint:o,isExtrudedControlPoint:s,handleControlPointMouseEvent:a})=>{const c=R.useRef(e);c.current=e;const l=Wo(()=>new wo((f,p)=>"getValue"in c.current?c.current.getValue(f,p):c.current,!1)),u=R.useMemo(()=>({position:l,billboard:{image:i?o?bPe():r?yPe():gPe():mPe(),width:i?16:8,height:i?16:8,heightReference:t?vl.CLAMP_TO_GROUND:vl.NONE,disableDepthTestDistance:1/0}}),[t,l,o,i,r]),h=R.useCallback(()=>{a?.(n,!!s,"mousedown")},[n,s,a]),d=R.useCallback(()=>{a?.(n,!!s,"click")},[n,s,a]);return ce.jsx(uc,{...u,onMouseDown:h,onClick:d})};function mPe(){if(Jl!=null)return Jl;Jl=document.createElement("canvas"),Jl.width=16,Jl.height=16;const e=Jl.getContext("2d");return Vn(e!=null),e.fillStyle="white",e.fillRect(3,3,10,10),e.strokeStyle="black",e.lineWidth=2,e.strokeRect(3,3,10,10),Jl}function gPe(){return EN(fPe,{size:32,color:"white",strokeColor:d0})}function yPe(){return EN(pPe,{size:32,color:"white",strokeColor:hPe})}function bPe(){if(Ql!=null)return Ql;Ql=document.createElement("canvas"),Ql.width=32,Ql.height=32;const e=Ql.getContext("2d");return Vn(e!=null),e.beginPath(),e.arc(16,16,12,0,2*Math.PI),e.fillStyle="white",e.fill(),e.strokeStyle=dPe,e.lineWidth=4,e.stroke(),e.beginPath(),e.moveTo(16,8),e.lineTo(16,24),e.stroke(),e.moveTo(8,16),e.lineTo(24,16),e.stroke(),Ql}function EN(e,t){if(e!=null)return e;e=document.createElement("canvas"),e.width=t.size,e.height=t.size;const n=e.getContext("2d");return Vn(n!=null),n.beginPath(),n.arc(t.size/2,t.size/2,t.size/2-4,0,2*Math.PI),n.fillStyle=t.color,n.fill(),n.strokeStyle=t.strokeColor,n.lineWidth=4,n.stroke(),e}function _Pe(e,t){if(typeof e=="function")return e(t),()=>{e(null)};if(e!=null)return e.current=t,()=>{e.current=null}}const p0=R.memo(R.forwardRef(({entities:e,...t},n)=>{const{viewer:i}=Qn(),r=i?.scene,o=i?.entities,s=e??o,[a,c]=R.useState(()=>new io(t));return R.useEffect(()=>{c(new io(t))},[t.id]),R.useEffect(()=>(s?.add(a),()=>{s?.remove(a),r?.requestRender()}),[r,s,a]),R.useEffect(()=>_Pe(n,a),[n,a]),Object.assign(a,Ka(t,"id")),r?.requestRender(),null})),vPe={padding:"5px",color:"#fff",backgroundColor:"#000",borderRadius:"5px",lineHeight:1},TN=({children:e})=>ce.jsx("div",{style:vPe,children:e}),CN=R.createContext({});function RN(e){const t=R.useRef(null);return t.current===null&&(t.current=e()),t.current}const wPe=typeof window<"u"?R.useLayoutEffect:R.useEffect,pE=R.createContext(null);function mE(e,t){e.indexOf(t)===-1&&e.push(t)}function Nb(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const ia=(e,t,n)=>n>t?t:n<e?e:n;function gE(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}let Jh=()=>{},Ua=()=>{};typeof process<"u"&&process.env?.NODE_ENV!=="production"&&(Jh=(e,t,n)=>{!e&&typeof console<"u"&&console.warn(gE(t,n))},Ua=(e,t,n)=>{if(!e)throw new Error(gE(t,n))});const Wa={},IN=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function MN(e){return typeof e=="object"&&e!==null}const LN=e=>/^0[^.\s]+$/u.test(e);function PN(e){let t;return()=>(t===void 0&&(t=e()),t)}const No=e=>e,xPe=(e,t)=>n=>t(e(n)),m0=(...e)=>e.reduce(xPe),g0=(e,t,n)=>{const i=t-e;return i===0?1:(n-e)/i};class yE{constructor(){this.subscriptions=[]}add(t){return mE(this.subscriptions,t),()=>Nb(this.subscriptions,t)}notify(t,n,i){const r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](t,n,i);else for(let o=0;o<r;o++){const s=this.subscriptions[o];s&&s(t,n,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const ko=e=>e*1e3,Xo=e=>e/1e3;function ON(e,t){return t?e*(1e3/t):0}const GN=new Set;function bE(e,t,n){e||GN.has(t)||(console.warn(gE(t,n)),GN.add(t))}const VN=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,SPe=1e-7,EPe=12;function TPe(e,t,n,i,r){let o,s,a=0;do s=t+(n-t)/2,o=VN(s,i,r)-e,o>0?n=s:t=s;while(Math.abs(o)>SPe&&++a<EPe);return s}function y0(e,t,n,i){if(e===t&&n===i)return No;const r=o=>TPe(o,0,1,e,n);return o=>o===0||o===1?o:VN(r(o),t,i)}const FN=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,AN=e=>t=>1-e(1-t),zN=y0(.33,1.53,.69,.99),_E=AN(zN),NN=FN(_E),kN=e=>(e*=2)<1?.5*_E(e):.5*(2-Math.pow(2,-10*(e-1))),vE=e=>1-Math.sin(Math.acos(e)),XN=AN(vE),ZN=FN(vE),CPe=y0(.42,0,1,1),RPe=y0(0,0,.58,1),DN=y0(.42,0,.58,1),IPe=e=>Array.isArray(e)&&typeof e[0]!="number",UN=e=>Array.isArray(e)&&typeof e[0]=="number",WN={linear:No,easeIn:CPe,easeInOut:DN,easeOut:RPe,circIn:vE,circInOut:ZN,circOut:XN,backIn:_E,backInOut:NN,backOut:zN,anticipate:kN},MPe=e=>typeof e=="string",BN=e=>{if(UN(e)){Ua(e.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[t,n,i,r]=e;return y0(t,n,i,r)}else if(MPe(e))return Ua(WN[e]!==void 0,`Invalid easing type '${e}'`,"invalid-easing-type"),WN[e];return e},kb=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function LPe(e,t){let n=new Set,i=new Set,r=!1,o=!1;const s=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function c(u){s.has(u)&&(l.schedule(u),e()),u(a)}const l={schedule:(u,h=!1,d=!1)=>{const p=d&&r?n:i;return h&&s.add(u),p.has(u)||p.add(u),u},cancel:u=>{i.delete(u),s.delete(u)},process:u=>{if(a=u,r){o=!0;return}r=!0,[n,i]=[i,n],n.forEach(c),n.clear(),r=!1,o&&(o=!1,l.process(u))}};return l}const PPe=40;function YN(e,t){let n=!1,i=!0;const r={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,s=kb.reduce((S,E)=>(S[E]=LPe(o),S),{}),{setup:a,read:c,resolveKeyframes:l,preUpdate:u,update:h,preRender:d,render:f,postRender:p}=s,m=()=>{const S=Wa.useManualTiming?r.timestamp:performance.now();n=!1,Wa.useManualTiming||(r.delta=i?1e3/60:Math.max(Math.min(S-r.timestamp,PPe),1)),r.timestamp=S,r.isProcessing=!0,a.process(r),c.process(r),l.process(r),u.process(r),h.process(r),d.process(r),f.process(r),p.process(r),r.isProcessing=!1,n&&t&&(i=!1,e(m))},y=()=>{n=!0,i=!0,r.isProcessing||e(m)};return{schedule:kb.reduce((S,E)=>{const C=s[E];return S[E]=(O,V=!1,A=!1)=>(n||y(),C.schedule(O,V,A)),S},{}),cancel:S=>{for(let E=0;E<kb.length;E++)s[kb[E]].cancel(S)},state:r,steps:s}}const{schedule:Tn,cancel:Bc,state:Xi,steps:wE}=YN(typeof requestAnimationFrame<"u"?requestAnimationFrame:No,!0);let Xb;function OPe(){Xb=void 0}const wr={now:()=>(Xb===void 0&&wr.set(Xi.isProcessing||Wa.useManualTiming?Xi.timestamp:performance.now()),Xb),set:e=>{Xb=e,queueMicrotask(OPe)}},HN=e=>t=>typeof t=="string"&&t.startsWith(e),jN=HN("--"),GPe=HN("var(--"),xE=e=>GPe(e)?VPe.test(e.split("/*")[0].trim()):!1,VPe=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function KN(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const Qh={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},b0={...Qh,transform:e=>ia(0,1,e)},Zb={...Qh,default:1},_0=e=>Math.round(e*1e5)/1e5,SE=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function FPe(e){return e==null}const APe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,EE=(e,t)=>n=>!!(typeof n=="string"&&APe.test(n)&&n.startsWith(e)||t&&!FPe(n)&&Object.prototype.hasOwnProperty.call(n,t)),JN=(e,t,n)=>i=>{if(typeof i!="string")return i;const[r,o,s,a]=i.match(SE);return{[e]:parseFloat(r),[t]:parseFloat(o),[n]:parseFloat(s),alpha:a!==void 0?parseFloat(a):1}},zPe=e=>ia(0,255,e),TE={...Qh,transform:e=>Math.round(zPe(e))},ql={test:EE("rgb","red"),parse:JN("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:i=1})=>"rgba("+TE.transform(e)+", "+TE.transform(t)+", "+TE.transform(n)+", "+_0(b0.transform(i))+")"};function NPe(e){let t="",n="",i="",r="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),i=e.substring(5,7),r=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),i=e.substring(3,4),r=e.substring(4,5),t+=t,n+=n,i+=i,r+=r),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(i,16),alpha:r?parseInt(r,16)/255:1}}const CE={test:EE("#"),parse:NPe,transform:ql.transform},v0=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Yc=v0("deg"),ra=v0("%"),at=v0("px"),kPe=v0("vh"),XPe=v0("vw"),QN={...ra,parse:e=>ra.parse(e)/100,transform:e=>ra.transform(e*100)},qh={test:EE("hsl","hue"),parse:JN("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:i=1})=>"hsla("+Math.round(e)+", "+ra.transform(_0(t))+", "+ra.transform(_0(n))+", "+_0(b0.transform(i))+")"},ui={test:e=>ql.test(e)||CE.test(e)||qh.test(e),parse:e=>ql.test(e)?ql.parse(e):qh.test(e)?qh.parse(e):CE.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?ql.transform(e):qh.transform(e),getAnimatableNone:e=>{const t=ui.parse(e);return t.alpha=0,ui.transform(t)}},ZPe=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function DPe(e){return isNaN(e)&&typeof e=="string"&&(e.match(SE)?.length||0)+(e.match(ZPe)?.length||0)>0}const qN="number",$N="color",UPe="var",WPe="var(",ek="${}",BPe=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function w0(e){const t=e.toString(),n=[],i={color:[],number:[],var:[]},r=[];let o=0;const a=t.replace(BPe,c=>(ui.test(c)?(i.color.push(o),r.push($N),n.push(ui.parse(c))):c.startsWith(WPe)?(i.var.push(o),r.push(UPe),n.push(c)):(i.number.push(o),r.push(qN),n.push(parseFloat(c))),++o,ek)).split(ek);return{values:n,split:a,indexes:i,types:r}}function tk(e){return w0(e).values}function nk(e){const{split:t,types:n}=w0(e),i=t.length;return r=>{let o="";for(let s=0;s<i;s++)if(o+=t[s],r[s]!==void 0){const a=n[s];a===qN?o+=_0(r[s]):a===$N?o+=ui.transform(r[s]):o+=r[s]}return o}}const YPe=e=>typeof e=="number"?0:ui.test(e)?ui.getAnimatableNone(e):e;function HPe(e){const t=tk(e);return nk(e)(t.map(YPe))}const ys={test:DPe,parse:tk,createTransformer:nk,getAnimatableNone:HPe};function RE(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function jPe({hue:e,saturation:t,lightness:n,alpha:i}){e/=360,t/=100,n/=100;let r=0,o=0,s=0;if(!t)r=o=s=n;else{const a=n<.5?n*(1+t):n+t-n*t,c=2*n-a;r=RE(c,a,e+1/3),o=RE(c,a,e),s=RE(c,a,e-1/3)}return{red:Math.round(r*255),green:Math.round(o*255),blue:Math.round(s*255),alpha:i}}function Db(e,t){return n=>n>0?t:e}const Zn=(e,t,n)=>e+(t-e)*n,IE=(e,t,n)=>{const i=e*e,r=n*(t*t-i)+i;return r<0?0:Math.sqrt(r)},KPe=[CE,ql,qh],JPe=e=>KPe.find(t=>t.test(e));function ik(e){const t=JPe(e);if(Jh(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!t)return!1;let n=t.parse(e);return t===qh&&(n=jPe(n)),n}const rk=(e,t)=>{const n=ik(e),i=ik(t);if(!n||!i)return Db(e,t);const r={...n};return o=>(r.red=IE(n.red,i.red,o),r.green=IE(n.green,i.green,o),r.blue=IE(n.blue,i.blue,o),r.alpha=Zn(n.alpha,i.alpha,o),ql.transform(r))},ME=new Set(["none","hidden"]);function QPe(e,t){return ME.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function qPe(e,t){return n=>Zn(e,t,n)}function LE(e){return typeof e=="number"?qPe:typeof e=="string"?xE(e)?Db:ui.test(e)?rk:tOe:Array.isArray(e)?ok:typeof e=="object"?ui.test(e)?rk:$Pe:Db}function ok(e,t){const n=[...e],i=n.length,r=e.map((o,s)=>LE(o)(o,t[s]));return o=>{for(let s=0;s<i;s++)n[s]=r[s](o);return n}}function $Pe(e,t){const n={...e,...t},i={};for(const r in n)e[r]!==void 0&&t[r]!==void 0&&(i[r]=LE(e[r])(e[r],t[r]));return r=>{for(const o in i)n[o]=i[o](r);return n}}function eOe(e,t){const n=[],i={color:0,var:0,number:0};for(let r=0;r<t.values.length;r++){const o=t.types[r],s=e.indexes[o][i[o]],a=e.values[s]??0;n[r]=a,i[o]++}return n}const tOe=(e,t)=>{const n=ys.createTransformer(t),i=w0(e),r=w0(t);return i.indexes.var.length===r.indexes.var.length&&i.indexes.color.length===r.indexes.color.length&&i.indexes.number.length>=r.indexes.number.length?ME.has(e)&&!r.values.length||ME.has(t)&&!i.values.length?QPe(e,t):m0(ok(eOe(i,r),r.values),n):(Jh(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),Db(e,t))};function sk(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Zn(e,t,n):LE(e)(e,t)}const nOe=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>Tn.update(t,n),stop:()=>Bc(t),now:()=>Xi.isProcessing?Xi.timestamp:wr.now()}},ak=(e,t,n=10)=>{let i="";const r=Math.max(Math.round(t/n),2);for(let o=0;o<r;o++)i+=Math.round(e(o/(r-1))*1e4)/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},Ub=2e4;function PE(e){let t=0;const n=50;let i=e.next(t);for(;!i.done&&t<Ub;)t+=n,i=e.next(t);return t>=Ub?1/0:t}function iOe(e,t=100,n){const i=n({...e,keyframes:[0,t]}),r=Math.min(PE(i),Ub);return{type:"keyframes",ease:o=>i.next(r*o).value/t,duration:Xo(r)}}const rOe=5;function ck(e,t,n){const i=Math.max(t-rOe,0);return ON(n-e(i),t-i)}const Dn={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},OE=.001;function oOe({duration:e=Dn.duration,bounce:t=Dn.bounce,velocity:n=Dn.velocity,mass:i=Dn.mass}){let r,o;Jh(e<=ko(Dn.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let s=1-t;s=ia(Dn.minDamping,Dn.maxDamping,s),e=ia(Dn.minDuration,Dn.maxDuration,Xo(e)),s<1?(r=l=>{const u=l*s,h=u*e,d=u-n,f=GE(l,s),p=Math.exp(-h);return OE-d/f*p},o=l=>{const h=l*s*e,d=h*n+n,f=Math.pow(s,2)*Math.pow(l,2)*e,p=Math.exp(-h),m=GE(Math.pow(l,2),s);return(-r(l)+OE>0?-1:1)*((d-f)*p)/m}):(r=l=>{const u=Math.exp(-l*e),h=(l-n)*e+1;return-OE+u*h},o=l=>{const u=Math.exp(-l*e),h=(n-l)*(e*e);return u*h});const a=5/e,c=aOe(r,o,a);if(e=ko(e),isNaN(c))return{stiffness:Dn.stiffness,damping:Dn.damping,duration:e};{const l=Math.pow(c,2)*i;return{stiffness:l,damping:s*2*Math.sqrt(i*l),duration:e}}}const sOe=12;function aOe(e,t,n){let i=n;for(let r=1;r<sOe;r++)i=i-e(i)/t(i);return i}function GE(e,t){return e*Math.sqrt(1-t*t)}const cOe=["duration","bounce"],lOe=["stiffness","damping","mass"];function lk(e,t){return t.some(n=>e[n]!==void 0)}function uOe(e){let t={velocity:Dn.velocity,stiffness:Dn.stiffness,damping:Dn.damping,mass:Dn.mass,isResolvedFromDuration:!1,...e};if(!lk(e,lOe)&&lk(e,cOe))if(t.velocity=0,e.visualDuration){const n=e.visualDuration,i=2*Math.PI/(n*1.2),r=i*i,o=2*ia(.05,1,1-(e.bounce||0))*Math.sqrt(r);t={...t,mass:Dn.mass,stiffness:r,damping:o}}else{const n=oOe({...e,velocity:0});t={...t,...n,mass:Dn.mass},t.isResolvedFromDuration=!0}return t}function Wb(e=Dn.visualDuration,t=Dn.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:i,restDelta:r}=n;const o=n.keyframes[0],s=n.keyframes[n.keyframes.length-1],a={done:!1,value:o},{stiffness:c,damping:l,mass:u,duration:h,velocity:d,isResolvedFromDuration:f}=uOe({...n,velocity:-Xo(n.velocity||0)}),p=d||0,m=l/(2*Math.sqrt(c*u)),y=s-o,g=Xo(Math.sqrt(c/u)),v=Math.abs(y)<5;i||(i=v?Dn.restSpeed.granular:Dn.restSpeed.default),r||(r=v?Dn.restDelta.granular:Dn.restDelta.default);let S;if(m<1){const C=GE(g,m);S=O=>{const V=Math.exp(-m*g*O);return s-V*((p+m*g*y)/C*Math.sin(C*O)+y*Math.cos(C*O))}}else if(m===1)S=C=>s-Math.exp(-g*C)*(y+(p+g*y)*C);else{const C=g*Math.sqrt(m*m-1);S=O=>{const V=Math.exp(-m*g*O),A=Math.min(C*O,300);return s-V*((p+m*g*y)*Math.sinh(A)+C*y*Math.cosh(A))/C}}const E={calculatedDuration:f&&h||null,next:C=>{const O=S(C);if(f)a.done=C>=h;else{let V=C===0?p:0;m<1&&(V=C===0?ko(p):ck(S,C,O));const A=Math.abs(V)<=i,G=Math.abs(s-O)<=r;a.done=A&&G}return a.value=a.done?s:O,a},toString:()=>{const C=Math.min(PE(E),Ub),O=ak(V=>E.next(C*V).value,C,30);return C+"ms "+O},toTransition:()=>{}};return E}Wb.applyToOptions=e=>{const t=iOe(e,100,Wb);return e.ease=t.ease,e.duration=ko(t.duration),e.type="keyframes",e};function VE({keyframes:e,velocity:t=0,power:n=.8,timeConstant:i=325,bounceDamping:r=10,bounceStiffness:o=500,modifyTarget:s,min:a,max:c,restDelta:l=.5,restSpeed:u}){const h=e[0],d={done:!1,value:h},f=A=>a!==void 0&&A<a||c!==void 0&&A>c,p=A=>a===void 0?c:c===void 0||Math.abs(a-A)<Math.abs(c-A)?a:c;let m=n*t;const y=h+m,g=s===void 0?y:s(y);g!==y&&(m=g-h);const v=A=>-m*Math.exp(-A/i),S=A=>g+v(A),E=A=>{const G=v(A),N=S(A);d.done=Math.abs(G)<=l,d.value=d.done?g:N};let C,O;const V=A=>{f(d.value)&&(C=A,O=Wb({keyframes:[d.value,p(d.value)],velocity:ck(S,A,d.value),damping:r,stiffness:o,restDelta:l,restSpeed:u}))};return V(0),{calculatedDuration:null,next:A=>{let G=!1;return!O&&C===void 0&&(G=!0,E(A),V(A)),C!==void 0&&A>=C?O.next(A-C):(!G&&E(A),d)}}}function hOe(e,t,n){const i=[],r=n||Wa.mix||sk,o=e.length-1;for(let s=0;s<o;s++){let a=r(e[s],e[s+1]);if(t){const c=Array.isArray(t)?t[s]||No:t;a=m0(c,a)}i.push(a)}return i}function dOe(e,t,{clamp:n=!0,ease:i,mixer:r}={}){const o=e.length;if(Ua(o===t.length,"Both input and output ranges must be the same length","range-length"),o===1)return()=>t[0];if(o===2&&t[0]===t[1])return()=>t[1];const s=e[0]===e[1];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=hOe(t,i,r),c=a.length,l=u=>{if(s&&u<e[0])return t[0];let h=0;if(c>1)for(;h<e.length-2&&!(u<e[h+1]);h++);const d=g0(e[h],e[h+1],u);return a[h](d)};return n?u=>l(ia(e[0],e[o-1],u)):l}function fOe(e,t){const n=e[e.length-1];for(let i=1;i<=t;i++){const r=g0(0,t,i);e.push(Zn(n,1,r))}}function pOe(e){const t=[0];return fOe(t,e.length-1),t}function mOe(e,t){return e.map(n=>n*t)}function gOe(e,t){return e.map(()=>t||DN).splice(0,e.length-1)}function $h({duration:e=300,keyframes:t,times:n,ease:i="easeInOut"}){const r=IPe(i)?i.map(BN):BN(i),o={done:!1,value:t[0]},s=mOe(n&&n.length===t.length?n:pOe(t),e),a=dOe(s,t,{ease:Array.isArray(r)?r:gOe(t,r)});return{calculatedDuration:e,next:c=>(o.value=a(c),o.done=c>=e,o)}}const yOe=e=>e!==null;function FE(e,{repeat:t,repeatType:n="loop"},i,r=1){const o=e.filter(yOe),a=r<0||t&&n!=="loop"&&t%2===1?0:o.length-1;return!a||i===void 0?o[a]:i}const bOe={decay:VE,inertia:VE,tween:$h,keyframes:$h,spring:Wb};function uk(e){typeof e.type=="string"&&(e.type=bOe[e.type])}class AE{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const _Oe=e=>e/100;class zE extends AE{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==wr.now()&&this.tick(wr.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;uk(t);const{type:n=$h,repeat:i=0,repeatDelay:r=0,repeatType:o,velocity:s=0}=t;let{keyframes:a}=t;const c=n||$h;process.env.NODE_ENV!=="production"&&c!==$h&&Ua(a.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${a}`,"spring-two-frames"),c!==$h&&typeof a[0]!="number"&&(this.mixKeyframes=m0(_Oe,sk(a[0],a[1])),a=[0,100]);const l=c({...t,keyframes:a});o==="mirror"&&(this.mirroredGenerator=c({...t,keyframes:[...a].reverse(),velocity:-s})),l.calculatedDuration===null&&(l.calculatedDuration=PE(l));const{calculatedDuration:u}=l;this.calculatedDuration=u,this.resolvedDuration=u+r,this.totalDuration=this.resolvedDuration*(i+1)-r,this.generator=l}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:i,totalDuration:r,mixKeyframes:o,mirroredGenerator:s,resolvedDuration:a,calculatedDuration:c}=this;if(this.startTime===null)return i.next(0);const{delay:l=0,keyframes:u,repeat:h,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-r/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const g=this.currentTime-l*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=r);let S=this.currentTime,E=i;if(h){const A=Math.min(this.currentTime,r)/a;let G=Math.floor(A),N=A%1;!N&&A>=1&&(N=1),N===1&&G--,G=Math.min(G,h+1),G%2&&(d==="reverse"?(N=1-N,f&&(N-=f/a)):d==="mirror"&&(E=s)),S=ia(0,1,N)*a}const C=v?{done:!1,value:u[0]}:E.next(S);o&&!v&&(C.value=o(C.value));let{done:O}=C;!v&&c!==null&&(O=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);const V=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&O);return V&&p!==VE&&(C.value=FE(u,this.options,y,this.speed)),m&&m(C.value),V&&this.finish(),C}then(t,n){return this.finished.then(t,n)}get duration(){return Xo(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Xo(t)}get time(){return Xo(this.currentTime)}set time(t){t=ko(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;n&&this.driver&&this.updateTime(wr.now()),this.playbackSpeed=t,n&&this.driver&&(this.time=Xo(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=nOe,startTime:n}=this.options;this.driver||(this.driver=t(r=>this.tick(r))),this.options.onPlay?.();const i=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=i):this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime||(this.startTime=n??i),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(wr.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}function vOe(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const $l=e=>e*180/Math.PI,NE=e=>{const t=$l(Math.atan2(e[1],e[0]));return kE(t)},wOe={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:NE,rotateZ:NE,skewX:e=>$l(Math.atan(e[1])),skewY:e=>$l(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},kE=e=>(e=e%360,e<0&&(e+=360),e),hk=NE,dk=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),fk=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),xOe={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:dk,scaleY:fk,scale:e=>(dk(e)+fk(e))/2,rotateX:e=>kE($l(Math.atan2(e[6],e[5]))),rotateY:e=>kE($l(Math.atan2(-e[2],e[0]))),rotateZ:hk,rotate:hk,skewX:e=>$l(Math.atan(e[4])),skewY:e=>$l(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function XE(e){return e.includes("scale")?1:0}function ZE(e,t){if(!e||e==="none")return XE(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,r;if(n)i=xOe,r=n;else{const a=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=wOe,r=a}if(!r)return XE(t);const o=i[t],s=r[1].split(",").map(EOe);return typeof o=="function"?o(s):s[o]}const SOe=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return ZE(n,t)};function EOe(e){return parseFloat(e.trim())}const ed=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],td=new Set(ed),pk=e=>e===Qh||e===at,TOe=new Set(["x","y","z"]),COe=ed.filter(e=>!TOe.has(e));function ROe(e){const t=[];return COe.forEach(n=>{const i=e.getValue(n);i!==void 0&&(t.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))}),t}const Hc={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>ZE(t,"x"),y:(e,{transform:t})=>ZE(t,"y")};Hc.translateX=Hc.x,Hc.translateY=Hc.y;const eu=new Set;let DE=!1,UE=!1,WE=!1;function mk(){if(UE){const e=Array.from(eu).filter(i=>i.needsMeasurement),t=new Set(e.map(i=>i.element)),n=new Map;t.forEach(i=>{const r=ROe(i);r.length&&(n.set(i,r),i.render())}),e.forEach(i=>i.measureInitialState()),t.forEach(i=>{i.render();const r=n.get(i);r&&r.forEach(([o,s])=>{i.getValue(o)?.set(s)})}),e.forEach(i=>i.measureEndState()),e.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}UE=!1,DE=!1,eu.forEach(e=>e.complete(WE)),eu.clear()}function gk(){eu.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(UE=!0)})}function IOe(){WE=!0,gk(),mk(),WE=!1}class BE{constructor(t,n,i,r,o,s=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=i,this.motionValue=r,this.element=o,this.isAsync=s}scheduleResolve(){this.state="scheduled",this.isAsync?(eu.add(this),DE||(DE=!0,Tn.read(gk),Tn.resolveKeyframes(mk))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:i,motionValue:r}=this;if(t[0]===null){const o=r?.get(),s=t[t.length-1];if(o!==void 0)t[0]=o;else if(i&&n){const a=i.readValue(n,s);a!=null&&(t[0]=a)}t[0]===void 0&&(t[0]=s),r&&o===void 0&&r.set(t[0])}vOe(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),eu.delete(this)}cancel(){this.state==="scheduled"&&(eu.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const MOe=e=>e.startsWith("--");function yk(e,t,n){MOe(t)?e.style.setProperty(t,n):e.style[t]=n}const LOe={};function bk(e,t){const n=PN(e);return()=>LOe[t]??n()}const POe=bk(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),_k=bk(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),x0=([e,t,n,i])=>`cubic-bezier(${e}, ${t}, ${n}, ${i})`,vk={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:x0([0,.65,.55,1]),circOut:x0([.55,0,1,.45]),backIn:x0([.31,.01,.66,-.59]),backOut:x0([.33,1.53,.69,.99])};function wk(e,t){if(e)return typeof e=="function"?_k()?ak(e,t):"ease-out":UN(e)?x0(e):Array.isArray(e)?e.map(n=>wk(n,t)||vk.easeOut):vk[e]}function OOe(e,t,n,{delay:i=0,duration:r=300,repeat:o=0,repeatType:s="loop",ease:a="easeOut",times:c}={},l=void 0){const u={[t]:n};c&&(u.offset=c);const h=wk(a,r);Array.isArray(h)&&(u.easing=h);const d={delay:i,duration:r,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:o+1,direction:s==="reverse"?"alternate":"normal"};return l&&(d.pseudoElement=l),e.animate(u,d)}function xk(e){return typeof e=="function"&&"applyToOptions"in e}function GOe({type:e,...t}){return xk(e)&&_k()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class Sk extends AE{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:n,name:i,keyframes:r,pseudoElement:o,allowFlatten:s=!1,finalKeyframe:a,onComplete:c}=t;this.isPseudoElement=!!o,this.allowFlatten=s,this.options=t,Ua(typeof t.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const l=GOe(t);this.animation=OOe(n,i,r,l,o),l.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!o){const u=FE(r,this.options,a,this.speed);this.updateMotionValue&&this.updateMotionValue(u),yk(n,i,u),this.animation.cancel()}c?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return Xo(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Xo(t)}get time(){return Xo(Number(this.animation.currentTime)||0)}set time(t){const n=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=ko(t),n&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:n,rangeEnd:i,observe:r}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&POe()?(this.animation.timeline=t,n&&(this.animation.rangeStart=n),i&&(this.animation.rangeEnd=i),No):r(this)}}const Ek={anticipate:kN,backInOut:NN,circInOut:ZN};function VOe(e){return e in Ek}function FOe(e){typeof e.ease=="string"&&VOe(e.ease)&&(e.ease=Ek[e.ease])}const YE=10;class AOe extends Sk{constructor(t){FOe(t),uk(t),super(t),t.startTime!==void 0&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:i,onComplete:r,element:o,...s}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const a=new zE({...s,autoplay:!1}),c=Math.max(YE,wr.now()-this.startTime),l=ia(0,YE,c-YE),u=a.sample(c).value,{name:h}=this.options;o&&h&&yk(o,h,u),n.setWithVelocity(a.sample(Math.max(0,c-l)).value,u,l),a.stop()}}const Tk=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(ys.test(e)||e==="0")&&!e.startsWith("url("));function zOe(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function NOe(e,t,n,i){const r=e[0];if(r===null)return!1;if(t==="display"||t==="visibility")return!0;const o=e[e.length-1],s=Tk(r,t),a=Tk(o,t);return Jh(s===a,`You are trying to animate ${t} from "${r}" to "${o}". "${s?o:r}" is not an animatable value.`,"value-not-animatable"),!s||!a?!1:zOe(e)||(n==="spring"||xk(n))&&i}function HE(e){e.duration=0,e.type="keyframes"}const kOe=new Set(["opacity","clipPath","filter","transform"]),XOe=PN(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function ZOe(e){const{motionValue:t,name:n,repeatDelay:i,repeatType:r,damping:o,type:s}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:l}=t.owner.getProps();return XOe()&&n&&kOe.has(n)&&(n!=="transform"||!l)&&!c&&!i&&r!=="mirror"&&o!==0&&s!=="inertia"}const DOe=40;class UOe extends AE{constructor({autoplay:t=!0,delay:n=0,type:i="keyframes",repeat:r=0,repeatDelay:o=0,repeatType:s="loop",keyframes:a,name:c,motionValue:l,element:u,...h}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=wr.now();const d={autoplay:t,delay:n,type:i,repeat:r,repeatDelay:o,repeatType:s,name:c,motionValue:l,element:u,...h},f=u?.KeyframeResolver||BE;this.keyframeResolver=new f(a,(p,m,y)=>this.onKeyframesResolved(p,m,d,!y),c,l,u),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,n,i,r){this.keyframeResolver=void 0;const{name:o,type:s,velocity:a,delay:c,isHandoff:l,onUpdate:u}=i;this.resolvedAt=wr.now(),NOe(t,o,s,a)||((Wa.instantAnimations||!c)&&u?.(FE(t,i,n)),t[0]=t[t.length-1],HE(i),i.repeat=0);const d={startTime:r?this.resolvedAt?this.resolvedAt-this.createdAt>DOe?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...i,keyframes:t},f=!l&&ZOe(d),p=d.motionValue?.owner?.current,m=f?new AOe({...d,element:p}):new zE(d);m.finished.then(()=>{this.notifyFinished()}).catch(No),this.pendingTimeline&&(this.stopTimeline=m.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),IOe()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}function Ck(e,t,n,i=0,r=1){const o=Array.from(e).sort((l,u)=>l.sortNodePosition(u)).indexOf(t),s=e.size,a=(s-1)*i;return typeof n=="function"?n(o,s):r===1?o*i:a-o*i}const WOe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function BOe(e){const t=WOe.exec(e);if(!t)return[,];const[,n,i,r]=t;return[`--${n??i}`,r]}const YOe=4;function Rk(e,t,n=1){Ua(n<=YOe,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[i,r]=BOe(e);if(!i)return;const o=window.getComputedStyle(t).getPropertyValue(i);if(o){const s=o.trim();return IN(s)?parseFloat(s):s}return xE(r)?Rk(r,t,n+1):r}const HOe={type:"spring",stiffness:500,damping:25,restSpeed:10},jOe=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),KOe={type:"keyframes",duration:.8},JOe={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},QOe=(e,{keyframes:t})=>t.length>2?KOe:td.has(e)?e.startsWith("scale")?jOe(t[1]):HOe:JOe,qOe=e=>e!==null;function $Oe(e,{repeat:t,repeatType:n="loop"},i){const r=e.filter(qOe),o=t&&n!=="loop"&&t%2===1?0:r.length-1;return r[o]}function Ik(e,t){if(e?.inherit&&t){const{inherit:n,...i}=e;return{...t,...i}}return e}function jE(e,t){const n=e?.[t]??e?.default??e;return n!==e?Ik(n,e):n}function eGe({when:e,delay:t,delayChildren:n,staggerChildren:i,staggerDirection:r,repeat:o,repeatType:s,repeatDelay:a,from:c,elapsed:l,...u}){return!!Object.keys(u).length}const KE=(e,t,n,i={},r,o)=>s=>{const a=jE(i,e)||{},c=a.delay||i.delay||0;let{elapsed:l=0}=i;l=l-ko(c);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...a,delay:-l,onUpdate:d=>{t.set(d),a.onUpdate&&a.onUpdate(d)},onComplete:()=>{s(),a.onComplete&&a.onComplete()},name:e,motionValue:t,element:o?void 0:r};eGe(a)||Object.assign(u,QOe(e,u)),u.duration&&(u.duration=ko(u.duration)),u.repeatDelay&&(u.repeatDelay=ko(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let h=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(HE(u),u.delay===0&&(h=!0)),(Wa.instantAnimations||Wa.skipAnimations||r?.shouldSkipAnimations)&&(h=!0,HE(u),u.delay=0),u.allowFlatten=!a.type&&!a.ease,h&&!o&&t.get()!==void 0){const d=$Oe(u.keyframes,a);if(d!==void 0){Tn.update(()=>{u.onUpdate(d),u.onComplete()});return}}return a.isSync?new zE(u):new UOe(u)};function Mk(e){const t=[{},{}];return e?.values.forEach((n,i)=>{t[0][i]=n.get(),t[1][i]=n.getVelocity()}),t}function JE(e,t,n,i){if(typeof t=="function"){const[r,o]=Mk(i);t=t(n!==void 0?n:e.custom,r,o)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[r,o]=Mk(i);t=t(n!==void 0?n:e.custom,r,o)}return t}function nd(e,t,n){const i=e.getProps();return JE(i,t,n!==void 0?n:i.custom,e)}const Lk=new Set(["width","height","top","left","right","bottom",...ed]),Pk=30,tGe=e=>!isNaN(parseFloat(e));class nGe{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=i=>{const r=wr.now();if(this.updatedAt!==r&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=wr.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=tGe(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return process.env.NODE_ENV!=="production"&&bE(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new yE);const i=this.events[t].add(n);return t==="change"?()=>{i(),Tn.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,i){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-i}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=wr.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Pk)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Pk);return ON(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function tu(e,t){return new nGe(e,t)}const QE=e=>Array.isArray(e);function iGe(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,tu(n))}function rGe(e){return QE(e)?e[e.length-1]||0:e}function oGe(e,t){const n=nd(e,t);let{transitionEnd:i={},transition:r={},...o}=n||{};o={...o,...i};for(const s in o){const a=rGe(o[s]);iGe(e,s,a)}}const ir=e=>!!(e&&e.getVelocity);function sGe(e){return!!(ir(e)&&e.add)}function qE(e,t){const n=e.getValue("willChange");if(sGe(n))return n.add(t);if(!n&&Wa.WillChange){const i=new Wa.WillChange("auto");e.addValue("willChange",i),i.add(t)}}function $E(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const Ok="data-"+$E("framerAppearId");function Gk(e){return e.props[Ok]}function aGe({protectedKeys:e,needsAnimating:t},n){const i=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,i}function Vk(e,t,{delay:n=0,transitionOverride:i,type:r}={}){let{transition:o,transitionEnd:s,...a}=t;const c=e.getDefaultTransition();o=o?Ik(o,c):c;const l=o?.reduceMotion;i&&(o=i);const u=[],h=r&&e.animationState&&e.animationState.getState()[r];for(const d in a){const f=e.getValue(d,e.latestValues[d]??null),p=a[d];if(p===void 0||h&&aGe(h,d))continue;const m={delay:n,...jE(o||{},d)},y=f.get();if(y!==void 0&&!f.isAnimating&&!Array.isArray(p)&&p===y&&!m.velocity)continue;let g=!1;if(window.MotionHandoffAnimation){const E=Gk(e);if(E){const C=window.MotionHandoffAnimation(E,d,Tn);C!==null&&(m.startTime=C,g=!0)}}qE(e,d);const v=l??e.shouldReduceMotion;f.start(KE(d,f,p,v&&Lk.has(d)?{type:!1}:m,e,g));const S=f.animation;S&&u.push(S)}if(s){const d=()=>Tn.update(()=>{s&&oGe(e,s)});u.length?Promise.all(u).then(d):d()}return u}function eT(e,t,n={}){const i=nd(e,t,n.type==="exit"?e.presenceContext?.custom:void 0);let{transition:r=e.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(r=n.transitionOverride);const o=i?()=>Promise.all(Vk(e,i,n)):()=>Promise.resolve(),s=e.variantChildren&&e.variantChildren.size?(c=0)=>{const{delayChildren:l=0,staggerChildren:u,staggerDirection:h}=r;return cGe(e,t,c,l,u,h,n)}:()=>Promise.resolve(),{when:a}=r;if(a){const[c,l]=a==="beforeChildren"?[o,s]:[s,o];return c().then(()=>l())}else return Promise.all([o(),s(n.delay)])}function cGe(e,t,n=0,i=0,r=0,o=1,s){const a=[];for(const c of e.variantChildren)c.notify("AnimationStart",t),a.push(eT(c,t,{...s,delay:n+(typeof i=="function"?0:i)+Ck(e.variantChildren,c,i,r,o)}).then(()=>c.notify("AnimationComplete",t)));return Promise.all(a)}function lGe(e,t,n={}){e.notify("AnimationStart",t);let i;if(Array.isArray(t)){const r=t.map(o=>eT(e,o,n));i=Promise.all(r)}else if(typeof t=="string")i=eT(e,t,n);else{const r=typeof t=="function"?nd(e,t,n.custom):t;i=Promise.all(Vk(e,r,n))}return i.then(()=>{e.notify("AnimationComplete",t)})}const uGe={test:e=>e==="auto",parse:e=>e},Fk=e=>t=>t.test(e),Ak=[Qh,at,ra,Yc,XPe,kPe,uGe],zk=e=>Ak.find(Fk(e));function hGe(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||LN(e):!0}const dGe=new Set(["brightness","contrast","saturate","opacity"]);function fGe(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[i]=n.match(SE)||[];if(!i)return e;const r=n.replace(i,"");let o=dGe.has(t)?1:0;return i!==n&&(o*=100),t+"("+o+r+")"}const pGe=/\b([a-z-]*)\(.*?\)/gu,tT={...ys,getAnimatableNone:e=>{const t=e.match(pGe);return t?t.map(fGe).join(" "):e}},nT={...ys,getAnimatableNone:e=>{const t=ys.parse(e);return ys.createTransformer(e)(t.map(i=>typeof i=="number"?0:typeof i=="object"?{...i,alpha:1}:i))}},Nk={...Qh,transform:Math.round},iT={borderWidth:at,borderTopWidth:at,borderRightWidth:at,borderBottomWidth:at,borderLeftWidth:at,borderRadius:at,borderTopLeftRadius:at,borderTopRightRadius:at,borderBottomRightRadius:at,borderBottomLeftRadius:at,width:at,maxWidth:at,height:at,maxHeight:at,top:at,right:at,bottom:at,left:at,inset:at,insetBlock:at,insetBlockStart:at,insetBlockEnd:at,insetInline:at,insetInlineStart:at,insetInlineEnd:at,padding:at,paddingTop:at,paddingRight:at,paddingBottom:at,paddingLeft:at,paddingBlock:at,paddingBlockStart:at,paddingBlockEnd:at,paddingInline:at,paddingInlineStart:at,paddingInlineEnd:at,margin:at,marginTop:at,marginRight:at,marginBottom:at,marginLeft:at,marginBlock:at,marginBlockStart:at,marginBlockEnd:at,marginInline:at,marginInlineStart:at,marginInlineEnd:at,fontSize:at,backgroundPositionX:at,backgroundPositionY:at,...{rotate:Yc,rotateX:Yc,rotateY:Yc,rotateZ:Yc,scale:Zb,scaleX:Zb,scaleY:Zb,scaleZ:Zb,skew:Yc,skewX:Yc,skewY:Yc,distance:at,translateX:at,translateY:at,translateZ:at,x:at,y:at,z:at,perspective:at,transformPerspective:at,opacity:b0,originX:QN,originY:QN,originZ:at},zIndex:Nk,fillOpacity:b0,strokeOpacity:b0,numOctaves:Nk},mGe={...iT,color:ui,backgroundColor:ui,outlineColor:ui,fill:ui,stroke:ui,borderColor:ui,borderTopColor:ui,borderRightColor:ui,borderBottomColor:ui,borderLeftColor:ui,filter:tT,WebkitFilter:tT,mask:nT,WebkitMask:nT},kk=e=>mGe[e],gGe=new Set([tT,nT]);function Xk(e,t){let n=kk(e);return gGe.has(n)||(n=ys),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const yGe=new Set(["auto","none","0"]);function bGe(e,t,n){let i=0,r;for(;i<e.length&&!r;){const o=e[i];typeof o=="string"&&!yGe.has(o)&&w0(o).values.length&&(r=e[i]),i++}if(r&&n)for(const o of t)e[o]=Xk(n,r)}class _Ge extends BE{constructor(t,n,i,r,o){super(t,n,i,r,o,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:i}=this;if(!n||!n.current)return;super.readKeyframes();for(let u=0;u<t.length;u++){let h=t[u];if(typeof h=="string"&&(h=h.trim(),xE(h))){const d=Rk(h,n.current);d!==void 0&&(t[u]=d),u===t.length-1&&(this.finalKeyframe=h)}}if(this.resolveNoneKeyframes(),!Lk.has(i)||t.length!==2)return;const[r,o]=t,s=zk(r),a=zk(o),c=KN(r),l=KN(o);if(c!==l&&Hc[i]){this.needsMeasurement=!0;return}if(s!==a)if(pk(s)&&pk(a))for(let u=0;u<t.length;u++){const h=t[u];typeof h=="string"&&(t[u]=parseFloat(h))}else Hc[i]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,i=[];for(let r=0;r<t.length;r++)(t[r]===null||hGe(t[r]))&&i.push(r);i.length&&bGe(t,i,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:i}=this;if(!t||!t.current)return;i==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Hc[i](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const r=n[n.length-1];r!==void 0&&t.getValue(i,r).jump(r,!1)}measureEndState(){const{element:t,name:n,unresolvedKeyframes:i}=this;if(!t||!t.current)return;const r=t.getValue(n);r&&r.jump(this.measuredOrigin,!1);const o=i.length-1,s=i[o];i[o]=Hc[n](t.measureViewportBox(),window.getComputedStyle(t.current)),s!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=s),this.removedTransforms?.length&&this.removedTransforms.forEach(([a,c])=>{t.getValue(a).set(c)}),this.resolveNoneKeyframes()}}const vGe=new Set(["opacity","clipPath","filter","transform"]);function Zk(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let i=document;const r=n?.[e]??i.querySelectorAll(e);return r?Array.from(r):[]}return Array.from(e).filter(i=>i!=null)}const Dk=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function wGe(e){return MN(e)&&"offsetHeight"in e}const{schedule:rT}=YN(queueMicrotask,!1),bs={x:!1,y:!1};function Uk(){return bs.x||bs.y}function xGe(e){return e==="x"||e==="y"?bs[e]?null:(bs[e]=!0,()=>{bs[e]=!1}):bs.x||bs.y?null:(bs.x=bs.y=!0,()=>{bs.x=bs.y=!1})}function Wk(e,t){const n=Zk(e),i=new AbortController,r={passive:!0,...t,signal:i.signal};return[n,r,()=>i.abort()]}function SGe(e){return!(e.pointerType==="touch"||Uk())}function EGe(e,t,n={}){const[i,r,o]=Wk(e,n);return i.forEach(s=>{let a=!1,c=!1,l;const u=()=>{s.removeEventListener("pointerleave",p)},h=y=>{l&&(l(y),l=void 0),u()},d=y=>{a=!1,window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",d),c&&(c=!1,h(y))},f=()=>{a=!0,window.addEventListener("pointerup",d,r),window.addEventListener("pointercancel",d,r)},p=y=>{if(y.pointerType!=="touch"){if(a){c=!0;return}h(y)}},m=y=>{if(!SGe(y))return;c=!1;const g=t(s,y);typeof g=="function"&&(l=g,s.addEventListener("pointerleave",p,r))};s.addEventListener("pointerenter",m,r),s.addEventListener("pointerdown",f,r)}),o}const Bk=(e,t)=>t?e===t?!0:Bk(e,t.parentElement):!1,oT=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,TGe=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function CGe(e){return TGe.has(e.tagName)||e.isContentEditable===!0}const RGe=new Set(["INPUT","SELECT","TEXTAREA"]);function IGe(e){return RGe.has(e.tagName)||e.isContentEditable===!0}const Bb=new WeakSet;function Yk(e){return t=>{t.key==="Enter"&&e(t)}}function sT(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const MGe=(e,t)=>{const n=e.currentTarget;if(!n)return;const i=Yk(()=>{if(Bb.has(n))return;sT(n,"down");const r=Yk(()=>{sT(n,"up")}),o=()=>sT(n,"cancel");n.addEventListener("keyup",r,t),n.addEventListener("blur",o,t)});n.addEventListener("keydown",i,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",i),t)};function Hk(e){return oT(e)&&!Uk()}const jk=new WeakSet;function LGe(e,t,n={}){const[i,r,o]=Wk(e,n),s=a=>{const c=a.currentTarget;if(!Hk(a)||jk.has(a))return;Bb.add(c),n.stopPropagation&&jk.add(a);const l=t(c,a),u=(f,p)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",d),Bb.has(c)&&Bb.delete(c),Hk(f)&&typeof l=="function"&&l(f,{success:p})},h=f=>{u(f,c===window||c===document||n.useGlobalTarget||Bk(c,f.target))},d=f=>{u(f,!1)};window.addEventListener("pointerup",h,r),window.addEventListener("pointercancel",d,r)};return i.forEach(a=>{(n.useGlobalTarget?window:a).addEventListener("pointerdown",s,r),wGe(a)&&(a.addEventListener("focus",l=>MGe(l,r)),!CGe(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),o}function aT(e){return MN(e)&&"ownerSVGElement"in e}const Yb=new WeakMap;let Hb;const Kk=(e,t,n)=>(i,r)=>r&&r[0]?r[0][e+"Size"]:aT(i)&&"getBBox"in i?i.getBBox()[t]:i[n],PGe=Kk("inline","width","offsetWidth"),OGe=Kk("block","height","offsetHeight");function GGe({target:e,borderBoxSize:t}){Yb.get(e)?.forEach(n=>{n(e,{get width(){return PGe(e,t)},get height(){return OGe(e,t)}})})}function VGe(e){e.forEach(GGe)}function FGe(){typeof ResizeObserver>"u"||(Hb=new ResizeObserver(VGe))}function AGe(e,t){Hb||FGe();const n=Zk(e);return n.forEach(i=>{let r=Yb.get(i);r||(r=new Set,Yb.set(i,r)),r.add(t),Hb?.observe(i)}),()=>{n.forEach(i=>{const r=Yb.get(i);r?.delete(t),r?.size||Hb?.unobserve(i)})}}const jb=new Set;let id;function zGe(){id=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};jb.forEach(t=>t(e))},window.addEventListener("resize",id)}function NGe(e){return jb.add(e),id||zGe(),()=>{jb.delete(e),!jb.size&&typeof id=="function"&&(window.removeEventListener("resize",id),id=void 0)}}function Jk(e,t){return typeof e=="function"?NGe(e):AGe(e,t)}function kGe(e){return aT(e)&&e.tagName==="svg"}const XGe=[...Ak,ui,ys],ZGe=e=>XGe.find(Fk(e)),Qk=()=>({translate:0,scale:1,origin:0,originPoint:0}),rd=()=>({x:Qk(),y:Qk()}),qk=()=>({min:0,max:0}),_i=()=>({x:qk(),y:qk()}),DGe=new WeakMap;function Kb(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function S0(e){return typeof e=="string"||Array.isArray(e)}const cT=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],lT=["initial",...cT];function Jb(e){return Kb(e.animate)||lT.some(t=>S0(e[t]))}function $k(e){return!!(Jb(e)||e.variants)}function UGe(e,t,n){for(const i in t){const r=t[i],o=n[i];if(ir(r))e.addValue(i,r);else if(ir(o))e.addValue(i,tu(r,{owner:e}));else if(o!==r)if(e.hasValue(i)){const s=e.getValue(i);s.liveStyle===!0?s.jump(r):s.hasAnimated||s.set(r)}else{const s=e.getStaticValue(i);e.addValue(i,tu(s!==void 0?s:r,{owner:e}))}}for(const i in n)t[i]===void 0&&e.removeValue(i);return t}const uT={current:null},eX={current:!1},WGe=typeof window<"u";function BGe(){if(eX.current=!0,!!WGe)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>uT.current=e.matches;e.addEventListener("change",t),t()}else uT.current=!1}const tX=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Qb={};function nX(e){Qb=e}function YGe(){return Qb}class HGe{scrapeMotionValuesFromProps(t,n,i){return{}}constructor({parent:t,props:n,presenceContext:i,reducedMotionConfig:r,skipAnimations:o,blockInitialAnimation:s,visualState:a},c={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=BE,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const f=wr.now();this.renderScheduledAt<f&&(this.renderScheduledAt=f,Tn.render(this.render,!1,!0))};const{latestValues:l,renderState:u}=a;this.latestValues=l,this.baseTarget={...l},this.initialValues=n.initial?{...l}:{},this.renderState=u,this.parent=t,this.props=n,this.presenceContext=i,this.depth=t?t.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=o,this.options=c,this.blockInitialAnimation=!!s,this.isControllingVariants=Jb(n),this.isVariantNode=$k(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:h,...d}=this.scrapeMotionValuesFromProps(n,{},this);for(const f in d){const p=d[f];l[f]!==void 0&&ir(p)&&p.set(l[f])}}mount(t){if(this.hasBeenMounted)for(const n in this.initialValues)this.values.get(n)?.jump(this.initialValues[n]),this.latestValues[n]=this.initialValues[n];this.current=t,DGe.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,i)=>this.bindToMotionValue(i,n)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(eX.current||BGe(),this.shouldReduceMotion=uT.current),process.env.NODE_ENV!=="production"&&bE(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected.","reduced-motion-disabled"),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),Bc(this.notifyUpdate),Bc(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),n.accelerate&&vGe.has(t)&&this.current instanceof HTMLElement){const{factory:s,keyframes:a,times:c,ease:l,duration:u}=n.accelerate,h=new Sk({element:this.current,name:t,keyframes:a,times:c,ease:l,duration:ko(u)}),d=s(h);this.valueSubscriptions.set(t,()=>{d(),h.cancel()});return}const i=td.has(t);i&&this.onBindTransform&&this.onBindTransform();const r=n.on("change",s=>{this.latestValues[t]=s,this.props.onUpdate&&Tn.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let o;typeof window<"u"&&window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{r(),o&&o(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Qb){const n=Qb[t];if(!n)continue;const{isEnabled:i,Feature:r}=n;if(!this.features[t]&&r&&i(this.props)&&(this.features[t]=new r(this)),this.features[t]){const o=this.features[t];o.isMounted?o.update():(o.mount(),o.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):_i()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let i=0;i<tX.length;i++){const r=tX[i];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);const o="on"+r,s=t[o];s&&(this.propEventSubscriptions[r]=this.on(r,s))}this.prevMotionValues=UGe(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const i=this.values.get(t);n!==i&&(i&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let i=this.values.get(t);return i===void 0&&n!==void 0&&(i=tu(n===null?void 0:n,{owner:this}),this.addValue(t,i)),i}readValue(t,n){let i=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return i!=null&&(typeof i=="string"&&(IN(i)||LN(i))?i=parseFloat(i):!ZGe(i)&&ys.test(n)&&(i=Xk(t,n)),this.setBaseTarget(t,ir(i)?i.get():i)),ir(i)?i.get():i}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){const{initial:n}=this.props;let i;if(typeof n=="string"||typeof n=="object"){const o=JE(this.props,n,this.presenceContext?.custom);o&&(i=o[t])}if(n&&i!==void 0)return i;const r=this.getBaseTargetFromProps(this.props,t);return r!==void 0&&!ir(r)?r:this.initialValues[t]!==void 0&&i===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new yE),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){rT.render(this.render)}}class iX extends HGe{constructor(){super(...arguments),this.KeyframeResolver=_Ge}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){const i=t.style;return i?i[n]:void 0}removeValueFromRenderState(t,{vars:n,style:i}){delete n[t],delete i[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;ir(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class jc{constructor(t){this.isMounted=!1,this.node=t}update(){}}function rX({top:e,left:t,right:n,bottom:i}){return{x:{min:t,max:n},y:{min:e,max:i}}}function jGe({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function KGe(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),i=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:i.y,right:i.x}}function hT(e){return e===void 0||e===1}function dT({scale:e,scaleX:t,scaleY:n}){return!hT(e)||!hT(t)||!hT(n)}function nu(e){return dT(e)||oX(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function oX(e){return sX(e.x)||sX(e.y)}function sX(e){return e&&e!=="0%"}function qb(e,t,n){const i=e-n,r=t*i;return n+r}function aX(e,t,n,i,r){return r!==void 0&&(e=qb(e,r,i)),qb(e,n,i)+t}function fT(e,t=0,n=1,i,r){e.min=aX(e.min,t,n,i,r),e.max=aX(e.max,t,n,i,r)}function cX(e,{x:t,y:n}){fT(e.x,t.translate,t.scale,t.originPoint),fT(e.y,n.translate,n.scale,n.originPoint)}const lX=.999999999999,uX=1.0000000000001;function JGe(e,t,n,i=!1){const r=n.length;if(!r)return;t.x=t.y=1;let o,s;for(let a=0;a<r;a++){o=n[a],s=o.projectionDelta;const{visualElement:c}=o.options;c&&c.props.style&&c.props.style.display==="contents"||(i&&o.options.layoutScroll&&o.scroll&&o!==o.root&&sd(e,{x:-o.scroll.offset.x,y:-o.scroll.offset.y}),s&&(t.x*=s.x.scale,t.y*=s.y.scale,cX(e,s)),i&&nu(o.latestValues)&&sd(e,o.latestValues))}t.x<uX&&t.x>lX&&(t.x=1),t.y<uX&&t.y>lX&&(t.y=1)}function od(e,t){e.min=e.min+t,e.max=e.max+t}function hX(e,t,n,i,r=.5){const o=Zn(e.min,e.max,r);fT(e,t,n,o,i)}function dX(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function sd(e,t){hX(e.x,dX(t.x,e.x),t.scaleX,t.scale,t.originX),hX(e.y,dX(t.y,e.y),t.scaleY,t.scale,t.originY)}function fX(e,t){return rX(KGe(e.getBoundingClientRect(),t))}function QGe(e,t,n){const i=fX(e,n),{scroll:r}=t;return r&&(od(i.x,r.offset.x),od(i.y,r.offset.y)),i}const qGe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},$Ge=ed.length;function eVe(e,t,n){let i="",r=!0;for(let o=0;o<$Ge;o++){const s=ed[o],a=e[s];if(a===void 0)continue;let c=!0;if(typeof a=="number")c=a===(s.startsWith("scale")?1:0);else{const l=parseFloat(a);c=s.startsWith("scale")?l===1:l===0}if(!c||n){const l=Dk(a,iT[s]);if(!c){r=!1;const u=qGe[s]||s;i+=`${u}(${l}) `}n&&(t[s]=l)}}return i=i.trim(),n?i=n(t,r?"":i):r&&(i="none"),i}function pT(e,t,n){const{style:i,vars:r,transformOrigin:o}=e;let s=!1,a=!1;for(const c in t){const l=t[c];if(td.has(c)){s=!0;continue}else if(jN(c)){r[c]=l;continue}else{const u=Dk(l,iT[c]);c.startsWith("origin")?(a=!0,o[c]=u):i[c]=u}}if(t.transform||(s||n?i.transform=eVe(t,e.transform,n):i.transform&&(i.transform="none")),a){const{originX:c="50%",originY:l="50%",originZ:u=0}=o;i.transformOrigin=`${c} ${l} ${u}`}}function pX(e,{style:t,vars:n},i,r){const o=e.style;let s;for(s in t)o[s]=t[s];r?.applyProjectionStyles(o,i);for(s in n)o.setProperty(s,n[s])}function mX(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const E0={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(at.test(e))e=parseFloat(e);else return e;const n=mX(e,t.target.x),i=mX(e,t.target.y);return`${n}% ${i}%`}},tVe={correct:(e,{treeScale:t,projectionDelta:n})=>{const i=e,r=ys.parse(e);if(r.length>5)return i;const o=ys.createTransformer(e),s=typeof r[0]!="number"?1:0,a=n.x.scale*t.x,c=n.y.scale*t.y;r[0+s]/=a,r[1+s]/=c;const l=Zn(a,c,.5);return typeof r[2+s]=="number"&&(r[2+s]/=l),typeof r[3+s]=="number"&&(r[3+s]/=l),o(r)}},mT={borderRadius:{...E0,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:E0,borderTopRightRadius:E0,borderBottomLeftRadius:E0,borderBottomRightRadius:E0,boxShadow:tVe};function gX(e,{layout:t,layoutId:n}){return td.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!mT[e]||e==="opacity")}function gT(e,t,n){const i=e.style,r=t?.style,o={};if(!i)return o;for(const s in i)(ir(i[s])||r&&ir(r[s])||gX(s,e)||n?.getValue(s)?.liveStyle!==void 0)&&(o[s]=i[s]);return o}function nVe(e){return window.getComputedStyle(e)}class iVe extends iX{constructor(){super(...arguments),this.type="html",this.renderInstance=pX}readValueFromInstance(t,n){if(td.has(n))return this.projection?.isProjecting?XE(n):SOe(t,n);{const i=nVe(t),r=(jN(n)?i.getPropertyValue(n):i[n])||0;return typeof r=="string"?r.trim():r}}measureInstanceViewportBox(t,{transformPagePoint:n}){return fX(t,n)}build(t,n,i){pT(t,n,i.transformTemplate)}scrapeMotionValuesFromProps(t,n,i){return gT(t,n,i)}}const rVe={offset:"stroke-dashoffset",array:"stroke-dasharray"},oVe={offset:"strokeDashoffset",array:"strokeDasharray"};function sVe(e,t,n=1,i=0,r=!0){e.pathLength=1;const o=r?rVe:oVe;e[o.offset]=`${-i}`,e[o.array]=`${t} ${n}`}const aVe=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function yX(e,{attrX:t,attrY:n,attrScale:i,pathLength:r,pathSpacing:o=1,pathOffset:s=0,...a},c,l,u){if(pT(e,a,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:h,style:d}=e;h.transform&&(d.transform=h.transform,delete h.transform),(d.transform||h.transformOrigin)&&(d.transformOrigin=h.transformOrigin??"50% 50%",delete h.transformOrigin),d.transform&&(d.transformBox=u?.transformBox??"fill-box",delete h.transformBox);for(const f of aVe)h[f]!==void 0&&(d[f]=h[f],delete h[f]);t!==void 0&&(h.x=t),n!==void 0&&(h.y=n),i!==void 0&&(h.scale=i),r!==void 0&&sVe(h,r,o,s,!1)}const bX=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),_X=e=>typeof e=="string"&&e.toLowerCase()==="svg";function cVe(e,t,n,i){pX(e,t,void 0,i);for(const r in t.attrs)e.setAttribute(bX.has(r)?r:$E(r),t.attrs[r])}function vX(e,t,n){const i=gT(e,t,n);for(const r in e)if(ir(e[r])||ir(t[r])){const o=ed.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;i[o]=e[r]}return i}class lVe extends iX{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=_i}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(td.has(n)){const i=kk(n);return i&&i.default||0}return n=bX.has(n)?n:$E(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,i){return vX(t,n,i)}build(t,n,i){yX(t,n,this.isSVGTag,i.transformTemplate,i.style)}renderInstance(t,n,i,r){cVe(t,n,i,r)}mount(t){this.isSVGTag=_X(t.tagName),super.mount(t)}}const uVe=lT.length;function wX(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?wX(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<uVe;n++){const i=lT[n],r=e.props[i];(S0(r)||r===!1)&&(t[i]=r)}return t}function xX(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let i=0;i<n;i++)if(t[i]!==e[i])return!1;return!0}const hVe=[...cT].reverse(),dVe=cT.length;function fVe(e){return t=>Promise.all(t.map(({animation:n,options:i})=>lGe(e,n,i)))}function pVe(e){let t=fVe(e),n=SX(),i=!0,r=!1;const o=l=>(u,h)=>{const d=nd(e,h,l==="exit"?e.presenceContext?.custom:void 0);if(d){const{transition:f,transitionEnd:p,...m}=d;u={...u,...m,...p}}return u};function s(l){t=l(e)}function a(l){const{props:u}=e,h=wX(e.parent)||{},d=[],f=new Set;let p={},m=1/0;for(let g=0;g<dVe;g++){const v=hVe[g],S=n[v],E=u[v]!==void 0?u[v]:h[v],C=S0(E),O=v===l?S.isActive:null;O===!1&&(m=g);let V=E===h[v]&&E!==u[v]&&C;if(V&&(i||r)&&e.manuallyAnimateOnMount&&(V=!1),S.protectedKeys={...p},!S.isActive&&O===null||!E&&!S.prevProp||Kb(E)||typeof E=="boolean")continue;if(v==="exit"&&S.isActive&&O!==!0){S.prevResolvedValues&&(p={...p,...S.prevResolvedValues});continue}const A=mVe(S.prevProp,E);let G=A||v===l&&S.isActive&&!V&&C||g>m&&C,N=!1;const k=Array.isArray(E)?E:[E];let P=k.reduce(o(v),{});O===!1&&(P={});const{prevResolvedValues:w={}}=S,x={...w,...P},I=Y=>{G=!0,f.has(Y)&&(N=!0,f.delete(Y)),S.needsAnimating[Y]=!0;const H=e.getValue(Y);H&&(H.liveStyle=!1)};for(const Y in x){const H=P[Y],J=w[Y];if(p.hasOwnProperty(Y))continue;let z=!1;QE(H)&&QE(J)?z=!xX(H,J):z=H!==J,z?H!=null?I(Y):f.add(Y):H!==void 0&&f.has(Y)?I(Y):S.protectedKeys[Y]=!0}S.prevProp=E,S.prevResolvedValues=P,S.isActive&&(p={...p,...P}),(i||r)&&e.blockInitialAnimation&&(G=!1);const X=V&&A;G&&(!X||N)&&d.push(...k.map(Y=>{const H={type:v};if(typeof Y=="string"&&(i||r)&&!X&&e.manuallyAnimateOnMount&&e.parent){const{parent:J}=e,z=nd(J,Y);if(J.enteringChildren&&z){const{delayChildren:W}=z.transition||{};H.delay=Ck(J.enteringChildren,e,W)}}return{animation:Y,options:H}}))}if(f.size){const g={};if(typeof u.initial!="boolean"){const v=nd(e,Array.isArray(u.initial)?u.initial[0]:u.initial);v&&v.transition&&(g.transition=v.transition)}f.forEach(v=>{const S=e.getBaseTarget(v),E=e.getValue(v);E&&(E.liveStyle=!0),g[v]=S??null}),d.push({animation:g})}let y=!!d.length;return i&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(y=!1),i=!1,r=!1,y?t(d):Promise.resolve()}function c(l,u){if(n[l].isActive===u)return Promise.resolve();e.variantChildren?.forEach(d=>d.animationState?.setActive(l,u)),n[l].isActive=u;const h=a(l);for(const d in n)n[d].protectedKeys={};return h}return{animateChanges:a,setActive:c,setAnimateFunction:s,getState:()=>n,reset:()=>{n=SX(),r=!0}}}function mVe(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!xX(t,e):!1}function iu(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function SX(){return{animate:iu(!0),whileInView:iu(),whileHover:iu(),whileTap:iu(),whileDrag:iu(),whileFocus:iu(),exit:iu()}}function EX(e,t){e.min=t.min,e.max=t.max}function _s(e,t){EX(e.x,t.x),EX(e.y,t.y)}function TX(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const CX=1e-4,gVe=1-CX,yVe=1+CX,RX=.01,bVe=0-RX,_Ve=0+RX;function xr(e){return e.max-e.min}function vVe(e,t,n){return Math.abs(e-t)<=n}function IX(e,t,n,i=.5){e.origin=i,e.originPoint=Zn(t.min,t.max,e.origin),e.scale=xr(n)/xr(t),e.translate=Zn(n.min,n.max,e.origin)-e.originPoint,(e.scale>=gVe&&e.scale<=yVe||isNaN(e.scale))&&(e.scale=1),(e.translate>=bVe&&e.translate<=_Ve||isNaN(e.translate))&&(e.translate=0)}function T0(e,t,n,i){IX(e.x,t.x,n.x,i?i.originX:void 0),IX(e.y,t.y,n.y,i?i.originY:void 0)}function MX(e,t,n){e.min=n.min+t.min,e.max=e.min+xr(t)}function wVe(e,t,n){MX(e.x,t.x,n.x),MX(e.y,t.y,n.y)}function LX(e,t,n){e.min=t.min-n.min,e.max=e.min+xr(t)}function $b(e,t,n){LX(e.x,t.x,n.x),LX(e.y,t.y,n.y)}function PX(e,t,n,i,r){return e-=t,e=qb(e,1/n,i),r!==void 0&&(e=qb(e,1/r,i)),e}function xVe(e,t=0,n=1,i=.5,r,o=e,s=e){if(ra.test(t)&&(t=parseFloat(t),t=Zn(s.min,s.max,t/100)-s.min),typeof t!="number")return;let a=Zn(o.min,o.max,i);e===o&&(a-=t),e.min=PX(e.min,t,n,a,r),e.max=PX(e.max,t,n,a,r)}function OX(e,t,[n,i,r],o,s){xVe(e,t[n],t[i],t[r],t.scale,o,s)}const SVe=["x","scaleX","originX"],EVe=["y","scaleY","originY"];function GX(e,t,n,i){OX(e.x,t,SVe,n?n.x:void 0,i?i.x:void 0),OX(e.y,t,EVe,n?n.y:void 0,i?i.y:void 0)}function VX(e){return e.translate===0&&e.scale===1}function FX(e){return VX(e.x)&&VX(e.y)}function AX(e,t){return e.min===t.min&&e.max===t.max}function TVe(e,t){return AX(e.x,t.x)&&AX(e.y,t.y)}function zX(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function NX(e,t){return zX(e.x,t.x)&&zX(e.y,t.y)}function kX(e){return xr(e.x)/xr(e.y)}function XX(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function oa(e){return[e("x"),e("y")]}function CVe(e,t,n){let i="";const r=e.x.translate/t.x,o=e.y.translate/t.y,s=n?.z||0;if((r||o||s)&&(i=`translate3d(${r}px, ${o}px, ${s}px) `),(t.x!==1||t.y!==1)&&(i+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:l,rotate:u,rotateX:h,rotateY:d,skewX:f,skewY:p}=n;l&&(i=`perspective(${l}px) ${i}`),u&&(i+=`rotate(${u}deg) `),h&&(i+=`rotateX(${h}deg) `),d&&(i+=`rotateY(${d}deg) `),f&&(i+=`skewX(${f}deg) `),p&&(i+=`skewY(${p}deg) `)}const a=e.x.scale*t.x,c=e.y.scale*t.y;return(a!==1||c!==1)&&(i+=`scale(${a}, ${c})`),i||"none"}const ZX=["TopLeft","TopRight","BottomLeft","BottomRight"],RVe=ZX.length,DX=e=>typeof e=="string"?parseFloat(e):e,UX=e=>typeof e=="number"||at.test(e);function IVe(e,t,n,i,r,o){r?(e.opacity=Zn(0,n.opacity??1,MVe(i)),e.opacityExit=Zn(t.opacity??1,0,LVe(i))):o&&(e.opacity=Zn(t.opacity??1,n.opacity??1,i));for(let s=0;s<RVe;s++){const a=`border${ZX[s]}Radius`;let c=WX(t,a),l=WX(n,a);if(c===void 0&&l===void 0)continue;c||(c=0),l||(l=0),c===0||l===0||UX(c)===UX(l)?(e[a]=Math.max(Zn(DX(c),DX(l),i),0),(ra.test(l)||ra.test(c))&&(e[a]+="%")):e[a]=l}(t.rotate||n.rotate)&&(e.rotate=Zn(t.rotate||0,n.rotate||0,i))}function WX(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const MVe=BX(0,.5,XN),LVe=BX(.5,.95,No);function BX(e,t,n){return i=>i<e?0:i>t?1:n(g0(e,t,i))}function PVe(e,t,n){const i=ir(e)?e:tu(e);return i.start(KE("",i,t,n)),i.animation}function C0(e,t,n,i={passive:!0}){return e.addEventListener(t,n,i),()=>e.removeEventListener(t,n)}const OVe=(e,t)=>e.depth-t.depth;class GVe{constructor(){this.children=[],this.isDirty=!1}add(t){mE(this.children,t),this.isDirty=!0}remove(t){Nb(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(OVe),this.isDirty=!1,this.children.forEach(t)}}function VVe(e,t){const n=wr.now(),i=({timestamp:r})=>{const o=r-n;o>=t&&(Bc(i),e(o-t))};return Tn.setup(i,!0),()=>Bc(i)}function e1(e){return ir(e)?e.get():e}class FVe{constructor(){this.members=[]}add(t){mE(this.members,t);for(let n=this.members.length-1;n>=0;n--){const i=this.members[n];if(i===t||i===this.lead||i===this.prevLead)continue;const r=i.instance;(!r||r.isConnected===!1)&&!i.snapshot&&(Nb(this.members,i),i.unmount())}t.scheduleRender()}remove(t){if(Nb(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){for(let n=this.members.indexOf(t)-1;n>=0;n--){const i=this.members[n];if(i.isPresent!==!1&&i.instance?.isConnected!==!1)return this.promote(i),!0}return!1}promote(t,n){const i=this.lead;if(t!==i&&(this.prevLead=i,this.lead=t,t.show(),i)){i.updateSnapshot(),t.scheduleRender();const{layoutDependency:r}=i.options,{layoutDependency:o}=t.options;(r===void 0||r!==o)&&(t.resumeFrom=i,n&&(i.preserveOpacity=!0),i.snapshot&&(t.snapshot=i.snapshot,t.snapshot.latestValues=i.animationValues||i.latestValues),t.root?.isUpdating&&(t.isLayoutDirty=!0)),t.options.crossfade===!1&&i.hide()}}exitAnimationComplete(){this.members.forEach(t=>{t.options.onExitComplete?.(),t.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(t=>t.instance&&t.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}}const t1={hasAnimatedSinceResize:!0,hasEverUpdated:!1},yT=["","X","Y","Z"],AVe=1e3;let zVe=0;function bT(e,t,n,i){const{latestValues:r}=t;r[e]&&(n[e]=r[e],t.setStaticValue(e,0),i&&(i[e]=0))}function YX(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=Gk(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:r,layoutId:o}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",Tn,!(r||o))}const{parent:i}=e;i&&!i.hasCheckedOptimisedAppear&&YX(i)}function HX({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:i,resetTransform:r}){return class{constructor(s={},a=t?.()){this.id=zVe++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(XVe),this.nodes.forEach(WVe),this.nodes.forEach(BVe),this.nodes.forEach(ZVe)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=s,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new GVe)}addEventListener(s,a){return this.eventHandlers.has(s)||this.eventHandlers.set(s,new yE),this.eventHandlers.get(s).add(a)}notifyListeners(s,...a){const c=this.eventHandlers.get(s);c&&c.notify(...a)}hasListeners(s){return this.eventHandlers.has(s)}mount(s){if(this.instance)return;this.isSVG=aT(s)&&!kGe(s),this.instance=s;const{layoutId:a,layout:c,visualElement:l}=this.options;if(l&&!l.current&&l.mount(s),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(c||a)&&(this.isLayoutDirty=!0),e){let u,h=0;const d=()=>this.root.updateBlockedByResize=!1;Tn.read(()=>{h=window.innerWidth}),e(s,()=>{const f=window.innerWidth;f!==h&&(h=f,this.root.updateBlockedByResize=!0,u&&u(),u=VVe(d,250),t1.hasAnimatedSinceResize&&(t1.hasAnimatedSinceResize=!1,this.nodes.forEach(JX)))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&l&&(a||c)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:h,hasRelativeLayoutChanged:d,layout:f})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const p=this.options.transition||l.getDefaultTransition()||JVe,{onLayoutAnimationStart:m,onLayoutAnimationComplete:y}=l.getProps(),g=!this.targetLayout||!NX(this.targetLayout,f),v=!h&&d;if(this.options.layoutRoot||this.resumeFrom||v||h&&(g||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const S={...jE(p,"layout"),onPlay:m,onComplete:y};(l.shouldReduceMotion||this.options.layoutRoot)&&(S.delay=0,S.type=!1),this.startAnimation(S),this.setAnimationOrigin(u,v)}else h||JX(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=f})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const s=this.getStack();s&&s.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Bc(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(YVe),this.animationId++)}getTransformTemplate(){const{visualElement:s}=this.options;return s&&s.getProps().transformTemplate}willUpdate(s=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&YX(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const h=this.path[u];h.shouldResetTransform=!0,h.updateScroll("snapshot"),h.options.layoutRoot&&h.willUpdate(!1)}const{layoutId:a,layout:c}=this.options;if(a===void 0&&!c)return;const l=this.getTransformTemplate();this.prevTransformTemplateValue=l?l(this.latestValues,""):void 0,this.updateSnapshot(),s&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(jX);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(KX);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(UVe),this.nodes.forEach(NVe),this.nodes.forEach(kVe)):this.nodes.forEach(KX),this.clearAllSnapshots();const a=wr.now();Xi.delta=ia(0,1e3/60,a-Xi.timestamp),Xi.timestamp=a,Xi.isProcessing=!0,wE.update.process(Xi),wE.preRender.process(Xi),wE.render.process(Xi),Xi.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,rT.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(DVe),this.sharedNodes.forEach(HVe)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Tn.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Tn.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!xr(this.snapshot.measuredBox.x)&&!xr(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const s=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=_i(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:a}=this.options;a&&a.notify("LayoutMeasure",this.layout.layoutBox,s?s.layoutBox:void 0)}updateScroll(s="measure"){let a=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===s&&(a=!1),a&&this.instance){const c=i(this.instance);this.scroll={animationId:this.root.animationId,phase:s,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!r)return;const s=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!FX(this.projectionDelta),c=this.getTransformTemplate(),l=c?c(this.latestValues,""):void 0,u=l!==this.prevTransformTemplateValue;s&&this.instance&&(a||nu(this.latestValues)||u)&&(r(this.instance,l),this.shouldResetTransform=!1,this.scheduleRender())}measure(s=!0){const a=this.measurePageBox();let c=this.removeElementScroll(a);return s&&(c=this.removeTransform(c)),QVe(c),{animationId:this.root.animationId,measuredBox:a,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:s}=this.options;if(!s)return _i();const a=s.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(qVe))){const{scroll:l}=this.root;l&&(od(a.x,l.offset.x),od(a.y,l.offset.y))}return a}removeElementScroll(s){const a=_i();if(_s(a,s),this.scroll?.wasRoot)return a;for(let c=0;c<this.path.length;c++){const l=this.path[c],{scroll:u,options:h}=l;l!==this.root&&u&&h.layoutScroll&&(u.wasRoot&&_s(a,s),od(a.x,u.offset.x),od(a.y,u.offset.y))}return a}applyTransform(s,a=!1){const c=_i();_s(c,s);for(let l=0;l<this.path.length;l++){const u=this.path[l];!a&&u.options.layoutScroll&&u.scroll&&u!==u.root&&sd(c,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),nu(u.latestValues)&&sd(c,u.latestValues)}return nu(this.latestValues)&&sd(c,this.latestValues),c}removeTransform(s){const a=_i();_s(a,s);for(let c=0;c<this.path.length;c++){const l=this.path[c];if(!l.instance||!nu(l.latestValues))continue;dT(l.latestValues)&&l.updateSnapshot();const u=_i(),h=l.measurePageBox();_s(u,h),GX(a,l.latestValues,l.snapshot?l.snapshot.layoutBox:void 0,u)}return nu(this.latestValues)&&GX(a,this.latestValues),a}setTargetDelta(s){this.targetDelta=s,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(s){this.options={...this.options,...s,crossfade:s.crossfade!==void 0?s.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Xi.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(s=!1){const a=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=a.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=a.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=a.isSharedProjectionDirty);const c=!!this.resumingFrom||this!==a;if(!(s||c&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:u,layoutId:h}=this.options;if(!this.layout||!(u||h))return;this.resolvedRelativeTargetAt=Xi.timestamp;const d=this.getClosestProjectingParent();d&&this.linkedParentVersion!==d.layoutVersion&&!d.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(d&&d.layout?this.createRelativeTarget(d,this.layout.layoutBox,d.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=_i(),this.targetWithTransforms=_i()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),wVe(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):_s(this.target,this.layout.layoutBox),cX(this.target,this.targetDelta)):_s(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,d&&!!d.resumingFrom==!!this.resumingFrom&&!d.options.layoutScroll&&d.target&&this.animationProgress!==1?this.createRelativeTarget(d,this.target,d.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||dT(this.parent.latestValues)||oX(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(s,a,c){this.relativeParent=s,this.linkedParentVersion=s.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=_i(),this.relativeTargetOrigin=_i(),$b(this.relativeTargetOrigin,a,c),_s(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const s=this.getLead(),a=!!this.resumingFrom||this!==s;let c=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(c=!1),a&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===Xi.timestamp&&(c=!1),c)return;const{layout:l,layoutId:u}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(l||u))return;_s(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,d=this.treeScale.y;JGe(this.layoutCorrected,this.treeScale,this.path,a),s.layout&&!s.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(s.target=s.layout.layoutBox,s.targetWithTransforms=_i());const{target:f}=s;if(!f){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(TX(this.prevProjectionDelta.x,this.projectionDelta.x),TX(this.prevProjectionDelta.y,this.projectionDelta.y)),T0(this.projectionDelta,this.layoutCorrected,f,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==d||!XX(this.projectionDelta.x,this.prevProjectionDelta.x)||!XX(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",f))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(s=!0){if(this.options.visualElement?.scheduleRender(),s){const a=this.getStack();a&&a.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=rd(),this.projectionDelta=rd(),this.projectionDeltaWithTransform=rd()}setAnimationOrigin(s,a=!1){const c=this.snapshot,l=c?c.latestValues:{},u={...this.latestValues},h=rd();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const d=_i(),f=c?c.source:void 0,p=this.layout?this.layout.source:void 0,m=f!==p,y=this.getStack(),g=!y||y.members.length<=1,v=!!(m&&!g&&this.options.crossfade===!0&&!this.path.some(KVe));this.animationProgress=0;let S;this.mixTargetDelta=E=>{const C=E/1e3;QX(h.x,s.x,C),QX(h.y,s.y,C),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&($b(d,this.layout.layoutBox,this.relativeParent.layout.layoutBox),jVe(this.relativeTarget,this.relativeTargetOrigin,d,C),S&&TVe(this.relativeTarget,S)&&(this.isProjectionDirty=!1),S||(S=_i()),_s(S,this.relativeTarget)),m&&(this.animationValues=u,IVe(u,l,this.latestValues,C,v,g)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=C},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(s){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Bc(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Tn.update(()=>{t1.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=tu(0)),this.motionValue.jump(0,!1),this.currentAnimation=PVe(this.motionValue,[0,1e3],{...s,velocity:0,isSync:!0,onUpdate:a=>{this.mixTargetDelta(a),s.onUpdate&&s.onUpdate(a)},onStop:()=>{},onComplete:()=>{s.onComplete&&s.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const s=this.getStack();s&&s.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(AVe),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const s=this.getLead();let{targetWithTransforms:a,target:c,layout:l,latestValues:u}=s;if(!(!a||!c||!l)){if(this!==s&&this.layout&&l&&nZ(this.options.animationType,this.layout.layoutBox,l.layoutBox)){c=this.target||_i();const h=xr(this.layout.layoutBox.x);c.x.min=s.target.x.min,c.x.max=c.x.min+h;const d=xr(this.layout.layoutBox.y);c.y.min=s.target.y.min,c.y.max=c.y.min+d}_s(a,c),sd(a,u),T0(this.projectionDeltaWithTransform,this.layoutCorrected,a,u)}}registerSharedNode(s,a){this.sharedNodes.has(s)||this.sharedNodes.set(s,new FVe),this.sharedNodes.get(s).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const s=this.getStack();return s?s.lead===this:!0}getLead(){const{layoutId:s}=this.options;return s?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:s}=this.options;return s?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:s}=this.options;if(s)return this.root.sharedNodes.get(s)}promote({needsReset:s,transition:a,preserveFollowOpacity:c}={}){const l=this.getStack();l&&l.promote(this,c),s&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const s=this.getStack();return s?s.relegate(this):!1}resetSkewAndRotation(){const{visualElement:s}=this.options;if(!s)return;let a=!1;const{latestValues:c}=s;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(a=!0),!a)return;const l={};c.z&&bT("z",s,l,this.animationValues);for(let u=0;u<yT.length;u++)bT(`rotate${yT[u]}`,s,l,this.animationValues),bT(`skew${yT[u]}`,s,l,this.animationValues);s.render();for(const u in l)s.setStaticValue(u,l[u]),this.animationValues&&(this.animationValues[u]=l[u]);s.scheduleRender()}applyProjectionStyles(s,a){if(!this.instance||this.isSVG)return;if(!this.isVisible){s.visibility="hidden";return}const c=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,s.visibility="",s.opacity="",s.pointerEvents=e1(a?.pointerEvents)||"",s.transform=c?c(this.latestValues,""):"none";return}const l=this.getLead();if(!this.projectionDelta||!this.layout||!l.target){this.options.layoutId&&(s.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,s.pointerEvents=e1(a?.pointerEvents)||""),this.hasProjected&&!nu(this.latestValues)&&(s.transform=c?c({},""):"none",this.hasProjected=!1);return}s.visibility="";const u=l.animationValues||l.latestValues;this.applyTransformsToTarget();let h=CVe(this.projectionDeltaWithTransform,this.treeScale,u);c&&(h=c(u,h)),s.transform=h;const{x:d,y:f}=this.projectionDelta;s.transformOrigin=`${d.origin*100}% ${f.origin*100}% 0`,l.animationValues?s.opacity=l===this?u.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:u.opacityExit:s.opacity=l===this?u.opacity!==void 0?u.opacity:"":u.opacityExit!==void 0?u.opacityExit:0;for(const p in mT){if(u[p]===void 0)continue;const{correct:m,applyTo:y,isCSSVariable:g}=mT[p],v=h==="none"?u[p]:m(u[p],l);if(y){const S=y.length;for(let E=0;E<S;E++)s[y[E]]=v}else g?this.options.visualElement.renderState.vars[p]=v:s[p]=v}this.options.layoutId&&(s.pointerEvents=l===this?e1(a?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(s=>s.currentAnimation?.stop()),this.root.nodes.forEach(jX),this.root.sharedNodes.clear()}}}function NVe(e){e.updateLayout()}function kVe(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:i}=e.layout,{animationType:r}=e.options,o=t.source!==e.layout.source;r==="size"?oa(u=>{const h=o?t.measuredBox[u]:t.layoutBox[u],d=xr(h);h.min=n[u].min,h.max=h.min+d}):nZ(r,t.layoutBox,n)&&oa(u=>{const h=o?t.measuredBox[u]:t.layoutBox[u],d=xr(n[u]);h.max=h.min+d,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[u].max=e.relativeTarget[u].min+d)});const s=rd();T0(s,n,t.layoutBox);const a=rd();o?T0(a,e.applyTransform(i,!0),t.measuredBox):T0(a,n,t.layoutBox);const c=!FX(s);let l=!1;if(!e.resumeFrom){const u=e.getClosestProjectingParent();if(u&&!u.resumeFrom){const{snapshot:h,layout:d}=u;if(h&&d){const f=_i();$b(f,t.layoutBox,h.layoutBox);const p=_i();$b(p,n,d.layoutBox),NX(f,p)||(l=!0),u.options.layoutRoot&&(e.relativeTarget=p,e.relativeTargetOrigin=f,e.relativeParent=u)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:t,delta:a,layoutDelta:s,hasLayoutChanged:c,hasRelativeLayoutChanged:l})}else if(e.isLead()){const{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function XVe(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function ZVe(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function DVe(e){e.clearSnapshot()}function jX(e){e.clearMeasurements()}function KX(e){e.isLayoutDirty=!1}function UVe(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function JX(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function WVe(e){e.resolveTargetDelta()}function BVe(e){e.calcProjection()}function YVe(e){e.resetSkewAndRotation()}function HVe(e){e.removeLeadSnapshot()}function QX(e,t,n){e.translate=Zn(t.translate,0,n),e.scale=Zn(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function qX(e,t,n,i){e.min=Zn(t.min,n.min,i),e.max=Zn(t.max,n.max,i)}function jVe(e,t,n,i){qX(e.x,t.x,n.x,i),qX(e.y,t.y,n.y,i)}function KVe(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const JVe={duration:.45,ease:[.4,0,.1,1]},$X=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),eZ=$X("applewebkit/")&&!$X("chrome/")?Math.round:No;function tZ(e){e.min=eZ(e.min),e.max=eZ(e.max)}function QVe(e){tZ(e.x),tZ(e.y)}function nZ(e,t,n){return e==="position"||e==="preserve-aspect"&&!vVe(kX(t),kX(n),.2)}function qVe(e){return e!==e.root&&e.scroll?.wasRoot}const $Ve=HX({attachResizeListener:(e,t)=>C0(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),_T={current:void 0},iZ=HX({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!_T.current){const e=new $Ve({});e.mount(window),e.setOptions({layoutScroll:!0}),_T.current=e}return _T.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),vT=R.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function e9e(e=!0){const t=R.useContext(pE);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:i,register:r}=t,o=R.useId();R.useEffect(()=>{if(e)return r(o)},[e]);const s=R.useCallback(()=>e&&i&&i(o),[o,i,e]);return!n&&i?[!1,s]:[!0]}const rZ=R.createContext({strict:!1}),oZ={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let sZ=!1;function t9e(){if(sZ)return;const e={};for(const t in oZ)e[t]={isEnabled:n=>oZ[t].some(i=>!!n[i])};nX(e),sZ=!0}function aZ(){return t9e(),YGe()}function n9e(e){const t=aZ();for(const n in e)t[n]={...t[n],...e[n]};nX(t)}const i9e=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function n1(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||i9e.has(e)}let cZ=e=>!n1(e);function r9e(e){typeof e=="function"&&(cZ=t=>t.startsWith("on")?!n1(t):e(t))}try{r9e(require("@emotion/is-prop-valid").default)}catch{}function o9e(e,t,n){const i={};for(const r in e)r==="values"&&typeof e.values=="object"||(cZ(r)||n===!0&&n1(r)||!t&&!n1(r)||e.draggable&&r.startsWith("onDrag"))&&(i[r]=e[r]);return i}const i1=R.createContext({});function s9e(e,t){if(Jb(e)){const{initial:n,animate:i}=e;return{initial:n===!1||S0(n)?n:void 0,animate:S0(i)?i:void 0}}return e.inherit!==!1?t:{}}function a9e(e){const{initial:t,animate:n}=s9e(e,R.useContext(i1));return R.useMemo(()=>({initial:t,animate:n}),[lZ(t),lZ(n)])}function lZ(e){return Array.isArray(e)?e.join(" "):e}const wT=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function uZ(e,t,n){for(const i in t)!ir(t[i])&&!gX(i,n)&&(e[i]=t[i])}function c9e({transformTemplate:e},t){return R.useMemo(()=>{const n=wT();return pT(n,t,e),Object.assign({},n.vars,n.style)},[t])}function l9e(e,t){const n=e.style||{},i={};return uZ(i,n,e),Object.assign(i,c9e(e,t)),i}function u9e(e,t){const n={},i=l9e(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=i,n}const hZ=()=>({...wT(),attrs:{}});function h9e(e,t,n,i){const r=R.useMemo(()=>{const o=hZ();return yX(o,t,_X(i),e.transformTemplate,e.style),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};uZ(o,e.style,e),r.style={...o,...r.style}}return r}const d9e=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function xT(e){return typeof e!="string"||e.includes("-")?!1:!!(d9e.indexOf(e)>-1||/[A-Z]/u.test(e))}function f9e(e,t,n,{latestValues:i},r,o=!1,s){const c=(s??xT(e)?h9e:u9e)(t,i,r,e),l=o9e(t,typeof e=="string",o),u=e!==R.Fragment?{...l,...c,ref:n}:{},{children:h}=t,d=R.useMemo(()=>ir(h)?h.get():h,[h]);return R.createElement(e,{...u,children:d})}function p9e({scrapeMotionValuesFromProps:e,createRenderState:t},n,i,r){return{latestValues:m9e(n,i,r,e),renderState:t()}}function m9e(e,t,n,i){const r={},o=i(e,{});for(const d in o)r[d]=e1(o[d]);let{initial:s,animate:a}=e;const c=Jb(e),l=$k(e);t&&l&&!c&&e.inherit!==!1&&(s===void 0&&(s=t.initial),a===void 0&&(a=t.animate));let u=n?n.initial===!1:!1;u=u||s===!1;const h=u?a:s;if(h&&typeof h!="boolean"&&!Kb(h)){const d=Array.isArray(h)?h:[h];for(let f=0;f<d.length;f++){const p=JE(e,d[f]);if(p){const{transitionEnd:m,transition:y,...g}=p;for(const v in g){let S=g[v];if(Array.isArray(S)){const E=u?S.length-1:0;S=S[E]}S!==null&&(r[v]=S)}for(const v in m)r[v]=m[v]}}}return r}const dZ=e=>(t,n)=>{const i=R.useContext(i1),r=R.useContext(pE),o=()=>p9e(e,t,i,r);return n?o():RN(o)},g9e=dZ({scrapeMotionValuesFromProps:gT,createRenderState:wT}),y9e=dZ({scrapeMotionValuesFromProps:vX,createRenderState:hZ}),b9e=Symbol.for("motionComponentSymbol");function _9e(e,t,n){const i=R.useRef(n);R.useInsertionEffect(()=>{i.current=n});const r=R.useRef(null);return R.useCallback(o=>{o&&e.onMount?.(o);const s=i.current;if(typeof s=="function")if(o){const a=s(o);typeof a=="function"&&(r.current=a)}else r.current?(r.current(),r.current=null):s(o);else s&&(s.current=o);t&&(o?t.mount(o):t.unmount())},[t])}const fZ=R.createContext({});function ad(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function v9e(e,t,n,i,r,o){const{visualElement:s}=R.useContext(i1),a=R.useContext(rZ),c=R.useContext(pE),l=R.useContext(vT),u=l.reducedMotion,h=l.skipAnimations,d=R.useRef(null),f=R.useRef(!1);i=i||a.renderer,!d.current&&i&&(d.current=i(e,{visualState:t,parent:s,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,skipAnimations:h,isSVG:o}),f.current&&d.current&&(d.current.manuallyAnimateOnMount=!0));const p=d.current,m=R.useContext(fZ);p&&!p.projection&&r&&(p.type==="html"||p.type==="svg")&&w9e(d.current,n,r,m);const y=R.useRef(!1);R.useInsertionEffect(()=>{p&&y.current&&p.update(n,c)});const g=n[Ok],v=R.useRef(!!g&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(g)&&window.MotionHasOptimisedAnimation?.(g));return wPe(()=>{f.current=!0,p&&(y.current=!0,window.MotionIsMounted=!0,p.updateFeatures(),p.scheduleRenderMicrotask(),v.current&&p.animationState&&p.animationState.animateChanges())}),R.useEffect(()=>{p&&(!v.current&&p.animationState&&p.animationState.animateChanges(),v.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(g)}),v.current=!1),p.enteringChildren=void 0)}),p}function w9e(e,t,n,i){const{layoutId:r,layout:o,drag:s,dragConstraints:a,layoutScroll:c,layoutRoot:l,layoutCrossfade:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:pZ(e.parent)),e.projection.setOptions({layoutId:r,layout:o,alwaysMeasureLayout:!!s||a&&ad(a),visualElement:e,animationType:typeof o=="string"?o:"both",initialPromotionConfig:i,crossfade:u,layoutScroll:c,layoutRoot:l})}function pZ(e){if(e)return e.options.allowProjection!==!1?e.projection:pZ(e.parent)}function ST(e,{forwardMotionProps:t=!1,type:n}={},i,r){i&&n9e(i);const o=n?n==="svg":xT(e),s=o?y9e:g9e;function a(l,u){let h;const d={...R.useContext(vT),...l,layoutId:x9e(l)},{isStatic:f}=d,p=a9e(l),m=s(l,f);if(!f&&typeof window<"u"){S9e(d,i);const y=E9e(d);h=y.MeasureLayout,p.visualElement=v9e(e,m,d,r,y.ProjectionNode,o)}return ce.jsxs(i1.Provider,{value:p,children:[h&&p.visualElement?ce.jsx(h,{visualElement:p.visualElement,...d}):null,f9e(e,l,_9e(m,p.visualElement,u),m,f,t,o)]})}a.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const c=R.forwardRef(a);return c[b9e]=e,c}function x9e({layoutId:e}){const t=R.useContext(CN).id;return t&&e!==void 0?t+"-"+e:e}function S9e(e,t){const n=R.useContext(rZ).strict;if(process.env.NODE_ENV!=="production"&&t&&n){const i="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";e.ignoreStrict?Jh(!1,i,"lazy-strict-mode"):Ua(!1,i,"lazy-strict-mode")}}function E9e(e){const t=aZ(),{drag:n,layout:i}=t;if(!n&&!i)return{};const r={...n,...i};return{MeasureLayout:n?.isEnabled(e)||i?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function T9e(e,t){if(typeof Proxy>"u")return ST;const n=new Map,i=(o,s)=>ST(o,s,e,t),r=(o,s)=>(process.env.NODE_ENV!=="production"&&bE(!1,"motion() is deprecated. Use motion.create() instead."),i(o,s));return new Proxy(r,{get:(o,s)=>s==="create"?i:(n.has(s)||n.set(s,ST(s,void 0,e,t)),n.get(s))})}const C9e=(e,t)=>t.isSVG??xT(e)?new lVe(t):new iVe(t,{allowProjection:e!==R.Fragment});class R9e extends jc{constructor(t){super(t),t.animationState||(t.animationState=pVe(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Kb(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let I9e=0;class M9e extends jc{constructor(){super(...arguments),this.id=I9e++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===i)return;const r=this.node.animationState.setActive("exit",!t);n&&!t&&r.then(()=>{n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const L9e={animation:{Feature:R9e},exit:{Feature:M9e}};function R0(e){return{point:{x:e.pageX,y:e.pageY}}}const P9e=e=>t=>oT(t)&&e(t,R0(t));function I0(e,t,n,i){return C0(e,t,P9e(n),i)}const mZ=({current:e})=>e?e.ownerDocument.defaultView:null,gZ=(e,t)=>Math.abs(e-t);function O9e(e,t){const n=gZ(e.x,t.x),i=gZ(e.y,t.y);return Math.sqrt(n**2+i**2)}const yZ=new Set(["auto","scroll"]);class bZ{constructor(t,n,{transformPagePoint:i,contextWindow:r=window,dragSnapToOrigin:o=!1,distanceThreshold:s=3,element:a}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=f=>{this.handleScroll(f.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=TT(this.lastMoveEventInfo,this.history),p=this.startEvent!==null,m=O9e(f.offset,{x:0,y:0})>=this.distanceThreshold;if(!p&&!m)return;const{point:y}=f,{timestamp:g}=Xi;this.history.push({...y,timestamp:g});const{onStart:v,onMove:S}=this.handlers;p||(v&&v(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),S&&S(this.lastMoveEvent,f)},this.handlePointerMove=(f,p)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=ET(p,this.transformPagePoint),Tn.update(this.updatePoint,!0)},this.handlePointerUp=(f,p)=>{this.end();const{onEnd:m,onSessionEnd:y,resumeAnimation:g}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&g&&g(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const v=TT(f.type==="pointercancel"?this.lastMoveEventInfo:ET(p,this.transformPagePoint),this.history);this.startEvent&&m&&m(f,v),y&&y(f,v)},!oT(t))return;this.dragSnapToOrigin=o,this.handlers=n,this.transformPagePoint=i,this.distanceThreshold=s,this.contextWindow=r||window;const c=R0(t),l=ET(c,this.transformPagePoint),{point:u}=l,{timestamp:h}=Xi;this.history=[{...u,timestamp:h}];const{onSessionStart:d}=n;d&&d(t,TT(l,this.history)),this.removeListeners=m0(I0(this.contextWindow,"pointermove",this.handlePointerMove),I0(this.contextWindow,"pointerup",this.handlePointerUp),I0(this.contextWindow,"pointercancel",this.handlePointerUp)),a&&this.startScrollTracking(a)}startScrollTracking(t){let n=t.parentElement;for(;n;){const i=getComputedStyle(n);(yZ.has(i.overflowX)||yZ.has(i.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const n=this.scrollPositions.get(t);if(!n)return;const i=t===window,r=i?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},o={x:r.x-n.x,y:r.y-n.y};o.x===0&&o.y===0||(i?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=o.x,this.lastMoveEventInfo.point.y+=o.y):this.history.length>0&&(this.history[0].x-=o.x,this.history[0].y-=o.y),this.scrollPositions.set(t,r),Tn.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Bc(this.updatePoint)}}function ET(e,t){return t?{point:t(e.point)}:e}function _Z(e,t){return{x:e.x-t.x,y:e.y-t.y}}function TT({point:e},t){return{point:e,delta:_Z(e,vZ(t)),offset:_Z(e,G9e(t)),velocity:V9e(t,.1)}}function G9e(e){return e[0]}function vZ(e){return e[e.length-1]}function V9e(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,i=null;const r=vZ(e);for(;n>=0&&(i=e[n],!(r.timestamp-i.timestamp>ko(t)));)n--;if(!i)return{x:0,y:0};i===e[0]&&e.length>2&&r.timestamp-i.timestamp>ko(t)*2&&(i=e[1]);const o=Xo(r.timestamp-i.timestamp);if(o===0)return{x:0,y:0};const s={x:(r.x-i.x)/o,y:(r.y-i.y)/o};return s.x===1/0&&(s.x=0),s.y===1/0&&(s.y=0),s}function F9e(e,{min:t,max:n},i){return t!==void 0&&e<t?e=i?Zn(t,e,i.min):Math.max(e,t):n!==void 0&&e>n&&(e=i?Zn(n,e,i.max):Math.min(e,n)),e}function wZ(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function A9e(e,{top:t,left:n,bottom:i,right:r}){return{x:wZ(e.x,n,r),y:wZ(e.y,t,i)}}function xZ(e,t){let n=t.min-e.min,i=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,i]=[i,n]),{min:n,max:i}}function z9e(e,t){return{x:xZ(e.x,t.x),y:xZ(e.y,t.y)}}function N9e(e,t){let n=.5;const i=xr(e),r=xr(t);return r>i?n=g0(t.min,t.max-i,e.min):i>r&&(n=g0(e.min,e.max-r,t.min)),ia(0,1,n)}function k9e(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const CT=.35;function X9e(e=CT){return e===!1?e=0:e===!0&&(e=CT),{x:SZ(e,"left","right"),y:SZ(e,"top","bottom")}}function SZ(e,t,n){return{min:EZ(e,t),max:EZ(e,n)}}function EZ(e,t){return typeof e=="number"?e:e[t]||0}const Z9e=new WeakMap;class D9e{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=_i(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:i}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const o=h=>{n&&this.snapToCursor(R0(h).point),this.stopAnimation()},s=(h,d)=>{const{drag:f,dragPropagation:p,onDragStart:m}=this.getProps();if(f&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=xGe(f),!this.openDragLock))return;this.latestPointerEvent=h,this.latestPanInfo=d,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),oa(g=>{let v=this.getAxisMotionValue(g).get()||0;if(ra.test(v)){const{projection:S}=this.visualElement;if(S&&S.layout){const E=S.layout.layoutBox[g];E&&(v=xr(E)*(parseFloat(v)/100))}}this.originPoint[g]=v}),m&&Tn.update(()=>m(h,d),!1,!0),qE(this.visualElement,"transform");const{animationState:y}=this.visualElement;y&&y.setActive("whileDrag",!0)},a=(h,d)=>{this.latestPointerEvent=h,this.latestPanInfo=d;const{dragPropagation:f,dragDirectionLock:p,onDirectionLock:m,onDrag:y}=this.getProps();if(!f&&!this.openDragLock)return;const{offset:g}=d;if(p&&this.currentDirection===null){this.currentDirection=W9e(g),this.currentDirection!==null&&m&&m(this.currentDirection);return}this.updateAxis("x",d.point,g),this.updateAxis("y",d.point,g),this.visualElement.render(),y&&Tn.update(()=>y(h,d),!1,!0)},c=(h,d)=>{this.latestPointerEvent=h,this.latestPanInfo=d,this.stop(h,d),this.latestPointerEvent=null,this.latestPanInfo=null},l=()=>{const{dragSnapToOrigin:h}=this.getProps();(h||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:u}=this.getProps();this.panSession=new bZ(t,{onSessionStart:o,onStart:s,onMove:a,onSessionEnd:c,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,distanceThreshold:i,contextWindow:mZ(this.visualElement),element:this.visualElement.current})}stop(t,n){const i=t||this.latestPointerEvent,r=n||this.latestPanInfo,o=this.isDragging;if(this.cancel(),!o||!r||!i)return;const{velocity:s}=r;this.startAnimation(s);const{onDragEnd:a}=this.getProps();a&&Tn.postRender(()=>a(i,r))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,n,i){const{drag:r}=this.getProps();if(!i||!r1(t,r,this.currentDirection))return;const o=this.getAxisMotionValue(t);let s=this.originPoint[t]+i[t];this.constraints&&this.constraints[t]&&(s=F9e(s,this.constraints[t],this.elastic[t])),o.set(s)}resolveConstraints(){const{dragConstraints:t,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;t&&ad(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&i?this.constraints=A9e(i.layoutBox,t):this.constraints=!1,this.elastic=X9e(n),r!==this.constraints&&!ad(t)&&i&&this.constraints&&!this.hasMutatedConstraints&&oa(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=k9e(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!ad(t))return!1;const i=t.current;Ua(i!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const o=QGe(i,r.root,this.visualElement.getTransformPagePoint());let s=z9e(r.layout.layoutBox,o);if(n){const a=n(jGe(s));this.hasMutatedConstraints=!!a,a&&(s=rX(a))}return s}startAnimation(t){const{drag:n,dragMomentum:i,dragElastic:r,dragTransition:o,dragSnapToOrigin:s,onDragTransitionEnd:a}=this.getProps(),c=this.constraints||{},l=oa(u=>{if(!r1(u,n,this.currentDirection))return;let h=c&&c[u]||{};s&&(h={min:0,max:0});const d=r?200:1e6,f=r?40:1e7,p={type:"inertia",velocity:i?t[u]:0,bounceStiffness:d,bounceDamping:f,timeConstant:750,restDelta:1,restSpeed:10,...o,...h};return this.startAxisValueAnimation(u,p)});return Promise.all(l).then(a)}startAxisValueAnimation(t,n){const i=this.getAxisMotionValue(t);return qE(this.visualElement,t),i.start(KE(t,i,0,n,this.visualElement,!1))}stopAnimation(){oa(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,i=this.visualElement.getProps(),r=i[n];return r||this.visualElement.getValue(t,(i.initial?i.initial[t]:void 0)||0)}snapToCursor(t){oa(n=>{const{drag:i}=this.getProps();if(!r1(n,i,this.currentDirection))return;const{projection:r}=this.visualElement,o=this.getAxisMotionValue(n);if(r&&r.layout){const{min:s,max:a}=r.layout.layoutBox[n],c=o.get()||0;o.set(t[n]-Zn(s,a,.5)+c)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:i}=this.visualElement;if(!ad(n)||!i||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};oa(s=>{const a=this.getAxisMotionValue(s);if(a&&this.constraints!==!1){const c=a.get();r[s]=N9e({min:c,max:c},this.constraints[s])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.constraints=!1,this.resolveConstraints(),oa(s=>{if(!r1(s,t,null))return;const a=this.getAxisMotionValue(s),{min:c,max:l}=this.constraints[s];a.set(Zn(c,l,r[s]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;Z9e.set(this.visualElement,this);const t=this.visualElement.current,n=I0(t,"pointerdown",l=>{const{drag:u,dragListener:h=!0}=this.getProps(),d=l.target,f=d!==t&&IGe(d);u&&h&&!f&&this.start(l)});let i;const r=()=>{const{dragConstraints:l}=this.getProps();ad(l)&&l.current&&(this.constraints=this.resolveRefConstraints(),i||(i=U9e(t,l.current,()=>this.scalePositionWithinConstraints())))},{projection:o}=this.visualElement,s=o.addEventListener("measure",r);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),Tn.read(r);const a=C0(window,"resize",()=>this.scalePositionWithinConstraints()),c=o.addEventListener("didUpdate",(({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(oa(h=>{const d=this.getAxisMotionValue(h);d&&(this.originPoint[h]+=l[h].translate,d.set(d.get()+l[h].translate))}),this.visualElement.render())}));return()=>{a(),n(),s(),c&&c(),i&&i()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:i=!1,dragPropagation:r=!1,dragConstraints:o=!1,dragElastic:s=CT,dragMomentum:a=!0}=t;return{...t,drag:n,dragDirectionLock:i,dragPropagation:r,dragConstraints:o,dragElastic:s,dragMomentum:a}}}function TZ(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function U9e(e,t,n){const i=Jk(e,TZ(n)),r=Jk(t,TZ(n));return()=>{i(),r()}}function r1(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function W9e(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class B9e extends jc{constructor(t){super(t),this.removeGroupControls=No,this.removeListeners=No,this.controls=new D9e(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||No}update(){const{dragControls:t}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};t!==n&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const RT=e=>(t,n)=>{e&&Tn.update(()=>e(t,n),!1,!0)};class Y9e extends jc{constructor(){super(...arguments),this.removePointerDownListener=No}onPointerDown(t){this.session=new bZ(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:mZ(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:i,onPanEnd:r}=this.node.getProps();return{onSessionStart:RT(t),onStart:RT(n),onMove:RT(i),onEnd:(o,s)=>{delete this.session,r&&Tn.postRender(()=>r(o,s))}}}mount(){this.removePointerDownListener=I0(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let IT=!1;class H9e extends R.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:i,layoutId:r}=this.props,{projection:o}=t;o&&(n.group&&n.group.add(o),i&&i.register&&r&&i.register(o),IT&&o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),t1.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:i,drag:r,isPresent:o}=this.props,{projection:s}=i;return s&&(s.isPresent=o,t.layoutDependency!==n&&s.setOptions({...s.options,layoutDependency:n}),IT=!0,r||t.layoutDependency!==n||n===void 0||t.isPresent!==o?s.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?s.promote():s.relegate()||Tn.postRender(()=>{const a=s.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),rT.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:i}=this.props,{projection:r}=t;IT=!0,r&&(r.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(r),i&&i.deregister&&i.deregister(r))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function CZ(e){const[t,n]=e9e(),i=R.useContext(CN);return ce.jsx(H9e,{...e,layoutGroup:i,switchLayoutGroup:R.useContext(fZ),isPresent:t,safeToRemove:n})}const j9e={pan:{Feature:Y9e},drag:{Feature:B9e,ProjectionNode:iZ,MeasureLayout:CZ}};function RZ(e,t,n){const{props:i}=e;e.animationState&&i.whileHover&&e.animationState.setActive("whileHover",n==="Start");const r="onHover"+n,o=i[r];o&&Tn.postRender(()=>o(t,R0(t)))}class K9e extends jc{mount(){const{current:t}=this.node;t&&(this.unmount=EGe(t,(n,i)=>(RZ(this.node,i,"Start"),r=>RZ(this.node,r,"End"))))}unmount(){}}class J9e extends jc{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=m0(C0(this.node.current,"focus",()=>this.onFocus()),C0(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function IZ(e,t,n){const{props:i}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&i.whileTap&&e.animationState.setActive("whileTap",n==="Start");const r="onTap"+(n==="End"?"":n),o=i[r];o&&Tn.postRender(()=>o(t,R0(t)))}class Q9e extends jc{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:n,propagate:i}=this.node.props;this.unmount=LGe(t,(r,o)=>(IZ(this.node,o,"Start"),(s,{success:a})=>IZ(this.node,s,a?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:i?.tap===!1})}unmount(){}}const MT=new WeakMap,LT=new WeakMap,q9e=e=>{const t=MT.get(e.target);t&&t(e)},$9e=e=>{e.forEach(q9e)};function eFe({root:e,...t}){const n=e||document;LT.has(n)||LT.set(n,{});const i=LT.get(n),r=JSON.stringify(t);return i[r]||(i[r]=new IntersectionObserver($9e,{root:e,...t})),i[r]}function tFe(e,t,n){const i=eFe(t);return MT.set(e,n),i.observe(e),()=>{MT.delete(e),i.unobserve(e)}}const nFe={some:0,all:1};class iFe extends jc{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:i,amount:r="some",once:o}=t,s={root:n?n.current:void 0,rootMargin:i,threshold:typeof r=="number"?r:nFe[r]},a=c=>{const{isIntersecting:l}=c;if(this.isInView===l||(this.isInView=l,o&&!l&&this.hasEnteredView))return;l&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",l);const{onViewportEnter:u,onViewportLeave:h}=this.node.getProps(),d=l?u:h;d&&d(c)};return tFe(this.node.current,s,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(rFe(t,n))&&this.startObserver()}unmount(){}}function rFe({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const oFe={...L9e,...{inView:{Feature:iFe},tap:{Feature:Q9e},focus:{Feature:J9e},hover:{Feature:K9e}},...j9e,...{layout:{ProjectionNode:iZ,MeasureLayout:CZ}}},sFe=T9e(oFe,C9e);function MZ(e){const t=RN(()=>tu(e)),{isStatic:n}=R.useContext(vT);if(n){const[,i]=R.useState(e);R.useEffect(()=>t.on("change",i),[])}return t}function PT(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function aFe(e,t){var n=R.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(i){var r=n.value;r!==i&&(n.value=i,n.callback(i,r))}}}})[0];return n.callback=t,n.facade}var cFe=typeof window<"u"?A0.useLayoutEffect:A0.useEffect,LZ=new WeakMap;function lFe(e,t){var n=aFe(null,function(i){return e.forEach(function(r){return PT(r,i)})});return cFe(function(){var i=LZ.get(n);if(i){var r=new Set(i),o=new Set(e),s=n.current;r.forEach(function(a){o.has(a)||PT(a,null)}),o.forEach(function(a){r.has(a)||PT(a,s)})}LZ.set(n,e)},[e]),n}const uFe=new cs(it.WGS84,b.ZERO),OT=R.forwardRef(({position:e,children:t,...n},i)=>{const r=Wo(()=>new b);e?.clone(r);const o=MZ(""),s=MZ("none"),{toWindowPosition:a,getCamera:c,toXYZ:l,isPositionVisible:u}=ci(),h=R.useRef(null);Gl(()=>{if(h.current==null)return;let f;try{const v=a?.([r.x,r.y,r.z]);f=new me(v?.[0],v?.[1])}catch{s.set("none");return}const p=c?.();if(!p)return;const m=l?.(p?.lng,p?.lat,p?.height);if(!m)return;if(uFe.cameraPosition=new b(m[0],m[1],m[2]),f==null||f.x<0||f.y<0||f.x>window.innerWidth||f.y>window.innerHeight||!u?.([r.x,r.y,r.z])){s.set("none");return}const y=`calc(${f.x}px - 50%)`,g=`calc(${f.y}px - 50%)`;o.set(`translate(${y}, ${g})`),s.set("block")});const d=lFe([h,i]);return ce.jsx(sFe.div,{ref:d,...n,style:{...n.style,transform:o,display:s,position:"absolute",pointerEvents:"none",left:0,top:0},children:t})});OT.displayName="ScreenSpaceElement";const hFe=({a:e,b:t,color:n})=>{const i=R.useRef([e,t]);i.current=[e,t];const r=Wo(()=>new wo(()=>i.current,!1)),o=R.useMemo(()=>({polyline:{positions:r,width:1.5,material:new Ol({color:n,dashLength:8})}}),[n,r]);return ce.jsx(p0,{...o})},dFe=({a:e,b:t,extrudedHeight:n,color:i,showLine:r})=>{const o=Wo(()=>new b);return ce.jsxs(ce.Fragment,{children:[ce.jsx(OT,{position:b.midpoint(e,t,o),children:ce.jsx(TN,{children:n<1e3?`${n.toFixed(1)} m`:`${(n/1e3).toFixed(1)} km`})}),r&&ce.jsx(hFe,{a:e,b:t,color:i})]})},PZ=R.memo(({geometryOptions:{controlPoints:e,type:t},extrudedHeight:n,color:i,isEditing:r,extrudedPoint:o,centroidBasePoint:s,centroidExtrudedPoint:a,catchedExtrudedPoint:c,handleControlPointMouseEvent:l})=>{const u=e[e.length-1],h=o?new b(...o):void 0,d=s?new b(...s):void 0,f=a?new b(...a):void 0;return ce.jsxs(ce.Fragment,{children:[h&&ce.jsxs(ce.Fragment,{children:[ce.jsx(f0,{index:-1,position:h,isEditing:r,isExtrudedControlPoint:!0,handleControlPointMouseEvent:l}),(!r||c)&&ce.jsx(dFe,{a:u,b:h,extrudedHeight:n,color:r?B.fromCssColorString(d0):i,showLine:t!=="extrudedPolygon"})]}),d&&ce.jsx(f0,{index:-1,position:d,isEditing:r,isExtrudedControlPoint:!0}),f&&ce.jsx(f0,{index:-1,position:f,isEditing:r,isExtrudedControlPoint:!0})]})});PZ.displayName="ExtrudedControlPoints";const fFe=({id:e,hierarchy:t,extrudedHeight:n,color:i,disableShadow:r=!1,isEditing:o})=>{const s=R.useRef(t);s.current=t;const c=Wo(()=>new wo(()=>s.current,!1)),l=R.useRef(n);l.current=n;const h=Wo(()=>new wo(()=>l.current,!1)),d=R.useMemo(()=>({polygon:{hierarchy:c,heightReference:vl.RELATIVE_TO_TERRAIN,extrudedHeight:h,extrudedHeightReference:vl.RELATIVE_TO_TERRAIN,fill:!0,outline:!0,outlineWidth:1,outlineColor:o?B.fromCssColorString(d0):i?.withAlpha(1),material:new Rl(o?i?.withAlpha(.2):i),classificationType:eo.TERRAIN,shadows:r?Zf.DISABLED:Zf.ENABLED}}),[h,r,c,i,o]),{requestRender:f}=ci();return f?.(),ce.jsx(p0,{id:e,...d})},pFe=({dynamic:e=!1,hierarchy:t,color:n})=>{const i=R.useRef(t);i.current=t;const r=Wo(()=>new wo(()=>i.current,!1)),o=e?r:t,s=R.useMemo(()=>({polygon:{hierarchy:o,fill:!0,material:n?.withAlpha(.5),classificationType:eo.TERRAIN}}),[n,o]),{requestRender:a}=ci();return a?.(),ce.jsx(p0,{...s})},mFe=({dynamic:e=!1,positions:t,color:n,isEditing:i})=>{const r=R.useRef(t);r.current=t;const o=Wo(()=>new wo(()=>r.current,!e)),s=e?o:t,a=R.useMemo(()=>({polyline:{positions:s,width:1.5,material:i?B.fromCssColorString(d0):n,classificationType:eo.TERRAIN,clampToGround:!0}}),[n,s,i]),{requestRender:c}=ci();return c?.(),ce.jsx(p0,{...a})},OZ=new b,GZ=R.memo(({geometryOptions:{type:e,controlPoints:t},isEditing:n,handleAddControlPoint:i})=>{if(!["polyline","polygon","extrudedPolygon"].includes(e))return null;const r=[];for(let o=0;o<t.length-1;o++){const s=t[o+1],a=b.midpoint(t[o],s,OZ);r.push(a.clone())}if(e==="polygon"||e==="extrudedPolygon"){const o=b.midpoint(t[t.length-1],t[0],OZ);r.push(o.clone())}return ce.jsx(ce.Fragment,{children:r.map((o,s)=>ce.jsx(f0,{position:o,isAddingPoint:!0,index:s,clampToGround:!0,isEditing:n,handleControlPointMouseEvent:()=>i?.([o.x,o.y,o.z],s)},s))})});GZ.displayName="SurfaceAddingPoints";const gFe=({a:e,b:t,color:n})=>{const i=R.useRef([e,t]);i.current=[e,t];const r=Wo(()=>new wo(()=>i.current,!1)),o=R.useMemo(()=>({polyline:{positions:r,width:1.5,material:new Ol({color:n,dashLength:8}),classificationType:eo.TERRAIN,clampToGround:!0}}),[n,r]),{requestRender:s}=ci();return s?.(),ce.jsx(p0,{...o})},yFe=({a:e,b:t,color:n,showLine:i=!1})=>{const r=Wo(()=>new b),{getSurfaceDistance:o}=ci(),s=o?.(e,t);return s!==void 0?ce.jsxs(ce.Fragment,{children:[ce.jsx(OT,{position:b.midpoint(e,t,r),children:ce.jsx(TN,{children:s<1e3?`${s.toFixed(1)} m`:`${(s/1e3).toFixed(1)} km`})}),i&&ce.jsx(gFe,{a:e,b:t,color:n})]}):null},VZ=new b,FZ=R.memo(({geometryOptions:{type:e,controlPoints:t},color:n,isEditing:i,catchedControlPointIndex:r,selectedControlPointIndex:o,handleControlPointMouseEvent:s})=>{const a=[];if(t.length>=2)if(i){if(r!==void 0&&r!==-1)switch(e){case"polyline":r>0&&a.push({points:[t[r-1],t[r]],showLine:!1}),r<t.length-1&&a.push({points:[t[r],t[r+1]],showLine:!1});break;case"circle":case"extrudedCircle":r!==2&&a.push({points:[t[0],t[1]],showLine:!0});break;case"rectangle":case"extrudedRectangle":if(r<=1)a.push({points:[t[0],t[1]],showLine:!1});else if(r===2){const[c,l,u]=t,h=b.midpoint(c,l,VZ);a.push({points:[h,u],showLine:!0})}break;case"polygon":case"extrudedPolygon":a.push({points:[t[r],r===0?t[t.length-1]:t[r-1]],showLine:!1}),a.push({points:[t[r],r===t.length-1?t[0]:t[r+1]],showLine:!1});break}}else switch(e){case"rectangle":case"extrudedRectangle":if(t.length===2)a.push({points:t,showLine:!0});else if(t.length===3){const[c,l,u]=t,h=b.midpoint(c,l,VZ);a.push({points:[h,u],showLine:!0})}break;default:a.push({points:t.slice(-2),showLine:e==="circle"});break}return ce.jsxs(ce.Fragment,{children:[t.map((c,l)=>ce.jsx(f0,{position:c,index:l,isSelected:o===l,clampToGround:!0,isEditing:i,handleControlPointMouseEvent:s},l)),a.map(({points:c,showLine:l},u)=>ce.jsx(yFe,{a:c[0],b:c[1],color:i?B.fromCssColorString(d0):n,showLine:l},u))]})});FZ.displayName="SurfaceControlPoints";const AZ=R.memo(({geometryOptions:e,extrudedHeight:t,disableShadow:n,color:i,isEditing:r,extrudedPoint:o,centroidBasePoint:s,centroidExtrudedPoint:a,catchedControlPointIndex:c,catchedExtrudedPoint:l,selectedControlPointIndex:u,handleControlPointMouseEvent:h,handleAddControlPoint:d})=>{const f=R.useMemo(()=>e?{...e,controlPoints:e?.controlPoints.map(v=>new M.Cartesian3(...v))}:null,[e]),p=R.useMemo(()=>f?yN(f):null,[f]),{positionsArray:m,hierarchyArray:y}=R.useMemo(()=>p?.type==="Point"?{}:p?.type==="LineString"?{positionsArray:uF(p)}:p!=null?{positionsArray:uF(p),hierarchyArray:hF(p)}:{},[p]),g=R.useMemo(()=>B.fromCssColorString(i??uPe),[i]);return ce.jsxs(ce.Fragment,{children:[m?.map((v,S)=>ce.jsx(mFe,{dynamic:!0,positions:v,color:g,isEditing:r},S)),y?.map((v,S)=>ce.jsx(pFe,{dynamic:!0,hierarchy:v,color:g},S)),f!=null&&(!t||r)&&ce.jsx(FZ,{geometryOptions:f,color:g,isEditing:r,catchedControlPointIndex:c,selectedControlPointIndex:u,handleControlPointMouseEvent:h}),f!=null&&r&&ce.jsx(GZ,{geometryOptions:f,isEditing:r,handleAddControlPoint:d}),f!=null&&t&&ce.jsx(PZ,{geometryOptions:f,extrudedHeight:t,extrudedPoint:o,centroidBasePoint:s,centroidExtrudedPoint:a,catchedExtrudedPoint:l,color:g,isEditing:r,handleControlPointMouseEvent:h}),t&&y?.map((v,S)=>ce.jsx(fFe,{hierarchy:v,extrudedHeight:t,disableShadow:n,color:g,isEditing:r},S))]})});AZ.displayName="SketchComponent";const bFe=({className:e,style:t,property:n,time:i,camera:r,small:o,ready:s,children:a,selectedLayerId:c,isLayerDraggable:l,isLayerDragging:u,shouldRender:h,layerSelectionReason:d,meta:f,customProvider:p,displayCredits:m,layersRef:y,featureFlags:g,requestingRenderMode:v,timelineManagerRef:S,cameraForceHorizontalRoll:E,onLayerSelect:C,onCameraChange:O,onLayerDrag:V,onLayerDrop:A,onLayerEdit:G,onLayerSelectWithRectStart:N,onLayerSelectWithRectMove:k,onLayerSelectWithRectEnd:P,onMount:w,onLayerVisibility:x,onLayerLoad:I,onCreditsUpdate:X},D)=>{const{cesium:Y,mouseEventHandles:H,cesiumIonAccessToken:J,context:z,layerSelectWithRectEventHandlers:W,sceneLight:Q,sceneBackgroundColor:q,sceneMsaaSamples:oe,sceneMode:Ee,cameraViewBoundaries:be,cameraViewOuterBoundaries:Ae,cameraViewBoundariesMaterial:Pe,handleCameraChange:fe,handleCameraMoveEnd:Xe,handleUpdate:tt,handleClick:nt,handleMount:Z,handleUnmount:pe,handleTilesChange:ue,handleTerrainProviderChange:$}=JLe({ref:D,property:n,time:i,selectedLayerId:c,selectionReason:d,meta:f,customProvider:p,layersRef:y,featureFlags:g,timelineManagerRef:S,isLayerDraggable:l,isLayerDragging:u,shouldRender:h,requestingRenderMode:v,camera:r,cameraForceHorizontalRoll:E,onLayerDrag:V,onLayerDrop:A,onLayerSelect:C,onLayerEdit:G,onLayerSelectWithRectStart:N,onLayerSelectWithRectMove:k,onLayerSelectWithRectEnd:P,onLayerVisibility:x,onLayerLoad:I,onCameraChange:O,onMount:w,onCreditsUpdate:X}),j=n?.terrain?.enabled?n?.scene?.verticalExaggeration??1:1;return ce.jsxs(gre,{ref:Y,onUpdate:tt,className:e,requestRenderMode:!0,animation:!1,timeline:!1,baseLayer:!1,fullscreenButton:!1,homeButton:!1,geocoder:!1,infoBox:!1,baseLayerPicker:!1,navigationHelpButton:!1,projectionPicker:!1,sceneModePicker:!1,creditContainer:m?void 0:_Fe,style:{width:o?"300px":"auto",height:o?"300px":"100%",display:s?void 0:"none",cursor:u?"grab":void 0,...t},shadows:!!n?.scene?.shadow?.enabled,onClick:nt,onDoubleClick:H.doubleClick,onMouseDown:H.mouseDown,onMouseUp:H.mouseUp,onRightClick:H.rightClick,onRightDown:H.rightDown,onRightUp:H.rightUp,onMiddleClick:H.middleClick,onMiddleDown:H.middleDown,onMiddleUp:H.middleUp,onMouseMove:H.mouseMove,onMouseEnter:H.mouseEnter,onMouseLeave:H.mouseLeave,onWheel:H.wheel,automaticallyTrackDataSourceClocks:!1,children:[ce.jsx(zbe,{onMount:Z,onUnmount:pe}),ce.jsx(Zoe,{timelineManagerRef:S}),ce.jsx(Yye,{tiles:n?.tiles,cesiumIonAccessToken:J,customProvider:p,onTilesChange:ue}),ce.jsx(mF,{tileLabels:n?.tileLabels}),ce.jsx(Kye,{property:n,timelineManagerRef:S}),ce.jsxs(kM,{useDefault:!0,children:[ce.jsx(hc,{type:M.ScreenSpaceEventType.LEFT_CLICK}),ce.jsx(hc,{type:M.ScreenSpaceEventType.LEFT_DOUBLE_CLICK})]}),ce.jsxs(kM,{children:[ce.jsx(hc,{type:M.ScreenSpaceEventType.LEFT_DOWN,action:W.start.handler}),ce.jsx(hc,{type:M.ScreenSpaceEventType.LEFT_DOWN,modifier:M.KeyboardEventModifier.SHIFT,action:W.start.shift}),ce.jsx(hc,{type:M.ScreenSpaceEventType.MOUSE_MOVE,action:W.move.handler}),ce.jsx(hc,{type:M.ScreenSpaceEventType.MOUSE_MOVE,modifier:M.KeyboardEventModifier.SHIFT,action:W.move.shift}),ce.jsx(hc,{type:M.ScreenSpaceEventType.LEFT_UP,action:W.end.handler}),ce.jsx(hc,{type:M.ScreenSpaceEventType.LEFT_UP,modifier:M.KeyboardEventModifier.SHIFT,action:W.end.shift})]}),ce.jsx(ore,{maximumZoomDistance:n?.camera?.limiter?.enabled?n.camera?.limiter?.targetArea?.height??Number.POSITIVE_INFINITY:Number.POSITIVE_INFINITY,enableCollisionDetection:!n?.camera?.allowEnterGround}),ce.jsx(kne,{percentageChanged:.2,onChange:fe,onMoveEnd:Xe}),be&&n?.camera?.limiter?.showHelper&&ce.jsx(uc,{children:ce.jsx(ml,{positions:be,width:1,material:M.Color.RED,arcType:M.ArcType.RHUMB})}),Ae&&n?.camera?.limiter?.showHelper&&ce.jsx(uc,{children:ce.jsx(ml,{positions:Ae,width:1,material:Pe,arcType:M.ArcType.RHUMB})}),ce.jsx(ire,{backgroundColor:q,light:Q,mode:Ee,msaaSamples:oe,useDepthPicking:!0,useWebVR:!!n?.scene?.vr||void 0,debugShowFramesPerSecond:!!n?.debug?.showFramesPerSecond,verticalExaggerationRelativeHeight:n?.scene?.verticalExaggerationRelativeHeight,verticalExaggeration:j}),ce.jsx(lre,{show:n?.sky?.skyBox?.show??!0}),ce.jsx(fie,{enabled:n?.sky?.fog?.enabled??!0,density:n?.sky?.fog?.density}),ce.jsx(hre,{show:n?.sky?.sun?.show??!0}),ce.jsx(kie,{show:n?.sky?.moon?.show??!0}),ce.jsx(are,{show:n?.sky?.skyAtmosphere?.show??!0,atmosphereLightIntensity:n?.sky?.skyAtmosphere?.lightIntensity,saturationShift:n?.sky?.skyAtmosphere?.saturationShift,brightnessShift:n?.sky?.skyAtmosphere?.brightnessShift}),ce.jsx(wse,{property:n,cesiumIonAccessToken:J,onTerrainProviderChange:$}),ce.jsx(EF.Provider,{value:z,children:s?a:null}),ce.jsx(cPe,{...lPe[n?.render?.ambientOcclusion?.quality||"low"],enabled:!!n?.render?.ambientOcclusion?.enabled,intensity:n?.render?.ambientOcclusion?.intensity??100,outputType:n?.render?.ambientOcclusion?.ambientOcclusionOnly?SN.Occlusion:null})]})},_Fe=document.createElement("div"),zZ={cesium:{component:R.forwardRef(bFe),featureComponent:O5e,clusterComponent:Xoe,sketchComponent:AZ,delegatedDataTypes:["czml","wms","mvt","3dtiles","osm-buildings","reearth-buildings","google-photorealistic","kml"]}};function vFe({error:e,resetErrorBoundary:t}){const i=e?.message??String(e);return ce.jsxs("div",{children:[ce.jsx("h1",{children:"Oops! An Error Occurred"}),ce.jsx("p",{children:i}),ce.jsx("p",{children:ce.jsx("button",{style:{color:"#fff"},onClick:t,children:"Retry"})})]})}const wFe="0.0.7-alpha.70",xFe=({viewerProperty:e})=>{const t=R.useRef(e);t.current=e;const n=R.useMemo(()=>({get version(){return wFe},get viewerProperty(){return t.current}}),[]);R.useEffect(()=>{window.reearth_core=n},[n])},SFe=768,EFe=({wrapperRef:e})=>{const t=R.useMemo(()=>TFe(new URLSearchParams(window.location.search)),[]),[n,i]=R.useState({width:void 0,height:void 0,isMobile:void 0,query:t});return R.useEffect(()=>{const r=new ResizeObserver(o=>{const[s]=o;let a,c;if(s.contentBoxSize){const l=Array.isArray(s.contentBoxSize)?s.contentBoxSize[0]:s.contentBoxSize;a=l.inlineSize,c=l.blockSize}else s.contentRect?(a=s.contentRect.width,c=s.contentRect.height):(a=e.current?.clientWidth,c=e.current?.clientHeight);i(l=>({width:a,height:c,isMobile:a?a<=SFe:void 0,query:l.query}))});return e.current&&r.observe(e.current),()=>{r.disconnect()}},[e]),n};function TFe(e){const t={};for(const[n,i]of e)t[n]=i;return t}function CFe({camera:e,interactionMode:t,zoomedLayerId:n,viewerProperty:i,onLayerSelect:r,onCameraChange:o,onInteractionModeChange:s,onZoomToLayer:a,onLayerDrop:c,onSketchTypeChangeProp:l},u){const h=R.useRef(null);R.useImperativeHandle(u,()=>h.current,[]);const d=R.useRef(null),f=EFe({wrapperRef:d}),[p,m]=R.useState({}),[y,g]=R.useState(),[v,S]=R.useState(),E=R.useCallback(async(Ue,St,Dt,xt,mn)=>{const Li=p.layer?.layer?.type==="simple"&&p.layer?.layer?.data?.isSketchLayer;if(p.layerId===Ue&&p.featureId===St&&!Li)return;const $n=await Dt?.(),ei=Ue&&St?(Li?$n?.features?.find(ti=>ti.id===St):h.current?.engine.findComputedFeatureById?.(Ue,St))??mn?.feature:void 0;g(Ue&&St?h.current?.engine.findFeatureById?.(Ue,St):void 0),S(ei),m(ti=>ti.layerId===Ue&&ti.featureId===St?ti:{layerId:Ue,featureId:St,layer:$n,reason:xt}),r?.(Ue,Dt,ei,xt)},[p,r]),C=R.useRef(void 0),[O,V]=NZ(e,o),[A,G]=R.useState(!1),N=R.useCallback(Ue=>{G(!!Ue)},[]),[k,P]=NZ(t||"default",s);R.useEffect(()=>{k==="default"&&h?.current?.engine?.setCursor("auto")},[k]);const w=N0[k??"default"],x=R.useRef(void 0),I=R.useCallback(Ue=>{x.current=Ue},[]),X=R.useCallback(Ue=>{x.current?.(Ue)},[]),D=R.useRef(void 0),Y=R.useCallback(Ue=>{D.current=Ue},[]),H=R.useCallback(Ue=>{D.current?.(Ue)},[]),J=R.useRef(void 0),z=R.useCallback(Ue=>{J.current=Ue},[]),W=R.useCallback(Ue=>{J.current?.(Ue)},[]),Q=R.useRef(void 0),q=R.useCallback(Ue=>{Q.current=Ue},[]),oe=R.useCallback(Ue=>{Q.current?.(Ue)},[]),Ee=R.useRef(void 0),be=R.useCallback(Ue=>{Ee.current=Ue},[]),Ae=R.useCallback(Ue=>{Ee.current?.(Ue)},[]),Pe=R.useRef(void 0),fe=R.useCallback(Ue=>{Pe.current=Ue},[]),Xe=R.useCallback(Ue=>{Pe.current?.(Ue)},[]),tt=R.useRef([]),nt=R.useCallback(Ue=>{tt.current.push(Ue)},[]),Z=R.useCallback(Ue=>{tt.current.forEach(St=>St(Ue))},[]),pe=R.useRef([]),ue=R.useCallback(Ue=>{pe.current.push(Ue)},[]),$=R.useCallback(Ue=>{pe.current.forEach(St=>St(Ue))},[]),j=R.useRef([]),te=R.useCallback(Ue=>{j.current.push(Ue)},[]),le=R.useCallback(Ue=>{j.current.forEach(St=>St(Ue))},[]),ge=R.useRef([]),ee=R.useCallback(Ue=>{ge.current.push(Ue)},[]),he=R.useCallback((Ue,St)=>{ge.current.forEach(Dt=>Dt(Ue)),l?.(Ue,St)},[l]);R.useEffect(()=>{n&&(h.current?.engine?.lookAtLayer(n),a?.(void 0))},[n,a]);const[Ie,_e]=R.useState(!1),De=R.useCallback(()=>{_e(!0)},[]),Be=R.useCallback((Ue,St,Dt)=>{_e(!1);const xt=h.current?.layers.findById(Ue),mn=xt?.property.default.location?"default.location":xt?.property.default.position?"default.position":void 0;Dt&&xt&&xt.propertyId&&mn&&c?.(xt.propertyId,mn,Dt)},[c,h]),Je=R.useMemo(()=>({interactionMode:k,selectedLayer:p,selectedComputedFeature:v,viewport:f,handleCameraForceHorizontalRollChange:N,handleInteractionModeChange:P,onSketchPluginFeatureCreate:nt,onSketchPluginFeatureUpdate:ue,onSketchPluginFeatureDelete:te,onSketchTypeChange:ee,onLayerVisibility:Y,onLayerLoad:z,onLayerEdit:I,onLayerSelectWithRectStart:q,onLayerSelectWithRectMove:be,onLayerSelectWithRectEnd:fe}),[k,p,v,f,P,N,I,nt,ue,te,ee,Y,z,q,be,fe]),Nt=R.useMemo(()=>({position:"relative",width:"100%",height:"100%",overflow:"hidden"}),[]);return xFe({viewerProperty:i}),{mapRef:h,wrapperRef:d,selectedFeature:y,camera:O,featureFlags:w,isLayerDragging:Ie,timelineManagerRef:C,cameraForceHorizontalRoll:A,coreContextValue:Je,containerStyle:Nt,overriddenInteractionMode:k,handleLayerSelect:E,handleLayerDrag:De,handleLayerDrop:Be,handleLayerEdit:X,handleCameraChange:V,handleInteractionModeChange:P,handleSketchPluginFeatureCreate:Z,handleSketchPluginFeatureUpdate:$,handleSketchPluginFeatureDelete:le,handleSketchTypeChange:he,handleLayerVisibility:H,handleLayerLoad:W,handleLayerSelectWithRectStart:oe,handleLayerSelectWithRectMove:Ae,handleLayerSelectWithRectEnd:Xe}}function NZ(e,t){const[n,i]=R.useState(e),r=R.useCallback(o=>{o&&(i(o),t?.(o))},[t]);return R.useEffect(()=>{i(e)},[e]),[n,r]}const RFe=R.memo(R.forwardRef(({engine:e,isBuilt:t,isEditable:n,viewerProperty:i,layers:r,clusters:o,small:s,ready:a,hiddenLayers:c,camera:l,time:u,interactionMode:h,shouldRender:d,meta:f,customProvider:p,displayCredits:m=!0,style:y,zoomedLayerId:g,children:v,onLayerDrop:S,onLayerSelect:E,onCameraChange:C,onZoomToLayer:O,onInteractionModeChange:V,onMount:A,onSketchTypeChangeProp:G,onSketchFeatureCreate:N,onSketchFeatureUpdate:k,onSketchFeatureDelete:P,onAPIReady:w,onCreditsUpdate:x},I)=>{const{mapRef:X,wrapperRef:D,selectedFeature:Y,camera:H,featureFlags:J,isLayerDragging:z,timelineManagerRef:W,cameraForceHorizontalRoll:Q,coreContextValue:q,containerStyle:oe,overriddenInteractionMode:Ee,handleLayerSelect:be,handleLayerDrag:Ae,handleLayerDrop:Pe,handleLayerEdit:fe,handleCameraChange:Xe,handleInteractionModeChange:tt,handleSketchPluginFeatureCreate:nt,handleSketchPluginFeatureUpdate:Z,handleSketchPluginFeatureDelete:pe,handleSketchTypeChange:ue,handleLayerVisibility:$,handleLayerLoad:j,handleLayerSelectWithRectStart:te,handleLayerSelectWithRectMove:le,handleLayerSelectWithRectEnd:ge}=CFe({camera:l,interactionMode:h,zoomedLayerId:g,viewerProperty:i,onLayerSelect:E,onCameraChange:C,onZoomToLayer:O,onLayerDrop:S,onInteractionModeChange:V,onSketchTypeChangeProp:G},I);return ce.jsx(Foe,{FallbackComponent:vFe,children:ce.jsx(koe,{mapRef:X,children:ce.jsxs("div",{ref:D,style:oe,children:[ce.jsx(d5,{ref:X,isBuilt:t,isEditable:n,engine:e,layers:r,engines:zZ,camera:H,cameraForceHorizontalRoll:Q,clusters:o,hiddenLayers:c,isLayerDragging:z,isLayerDraggable:n,meta:f,customProvider:p,displayCredits:m,style:y,featureFlags:J,shouldRender:d,property:i,time:u,small:s,ready:a,timelineManagerRef:W,interactionMode:Ee,selectedFeature:Y,onCameraChange:Xe,onLayerDrag:Ae,onLayerDrop:Pe,onLayerSelect:be,onLayerEdit:fe,overrideInteractionMode:tt,onSketchFeatureCreate:N,onSketchPluginFeatureCreate:nt,onSketchFeatureUpdate:k,onSketchPluginFeatureUpdate:Z,onSketchFeatureDelete:P,onSketchPluginFeatureDelete:pe,onSketchTypeChange:ue,onMount:A,onLayerVisibility:$,onLayerLoad:j,onLayerSelectWithRectStart:te,onLayerSelectWithRectMove:le,onLayerSelectWithRectEnd:ge,onAPIReady:w,onCreditsUpdate:x}),ce.jsx(p5.Provider,{value:q,children:v})]})})})}));var cd=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},sa=[],Zo=[],IFe=typeof Uint8Array<"u"?Uint8Array:Array,GT=!1;function kZ(){GT=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,n=e.length;t<n;++t)sa[t]=e[t],Zo[e.charCodeAt(t)]=t;Zo[45]=62,Zo[95]=63}function MFe(e){GT||kZ();var t,n,i,r,o,s,a=e.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=e[a-2]==="="?2:e[a-1]==="="?1:0,s=new IFe(a*3/4-o),i=o>0?a-4:a;var c=0;for(t=0,n=0;t<i;t+=4,n+=3)r=Zo[e.charCodeAt(t)]<<18|Zo[e.charCodeAt(t+1)]<<12|Zo[e.charCodeAt(t+2)]<<6|Zo[e.charCodeAt(t+3)],s[c++]=r>>16&255,s[c++]=r>>8&255,s[c++]=r&255;return o===2?(r=Zo[e.charCodeAt(t)]<<2|Zo[e.charCodeAt(t+1)]>>4,s[c++]=r&255):o===1&&(r=Zo[e.charCodeAt(t)]<<10|Zo[e.charCodeAt(t+1)]<<4|Zo[e.charCodeAt(t+2)]>>2,s[c++]=r>>8&255,s[c++]=r&255),s}function LFe(e){return sa[e>>18&63]+sa[e>>12&63]+sa[e>>6&63]+sa[e&63]}function PFe(e,t,n){for(var i,r=[],o=t;o<n;o+=3)i=(e[o]<<16)+(e[o+1]<<8)+e[o+2],r.push(LFe(i));return r.join("")}function XZ(e){GT||kZ();for(var t,n=e.length,i=n%3,r="",o=[],s=16383,a=0,c=n-i;a<c;a+=s)o.push(PFe(e,a,a+s>c?c:a+s));return i===1?(t=e[n-1],r+=sa[t>>2],r+=sa[t<<4&63],r+="=="):i===2&&(t=(e[n-2]<<8)+e[n-1],r+=sa[t>>10],r+=sa[t>>4&63],r+=sa[t<<2&63],r+="="),o.push(r),o.join("")}function o1(e,t,n,i,r){var o,s,a=r*8-i-1,c=(1<<a)-1,l=c>>1,u=-7,h=n?r-1:0,d=n?-1:1,f=e[t+h];for(h+=d,o=f&(1<<-u)-1,f>>=-u,u+=a;u>0;o=o*256+e[t+h],h+=d,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=i;u>0;s=s*256+e[t+h],h+=d,u-=8);if(o===0)o=1-l;else{if(o===c)return s?NaN:(f?-1:1)*(1/0);s=s+Math.pow(2,i),o=o-l}return(f?-1:1)*s*Math.pow(2,o-i)}function ZZ(e,t,n,i,r,o){var s,a,c,l=o*8-r-1,u=(1<<l)-1,h=u>>1,d=r===23?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:o-1,p=i?1:-1,m=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),s+h>=1?t+=d/c:t+=d*Math.pow(2,1-h),t*c>=2&&(s++,c/=2),s+h>=u?(a=0,s=u):s+h>=1?(a=(t*c-1)*Math.pow(2,r),s=s+h):(a=t*Math.pow(2,h-1)*Math.pow(2,r),s=0));r>=8;e[n+f]=a&255,f+=p,a/=256,r-=8);for(s=s<<r|a,l+=r;l>0;e[n+f]=s&255,f+=p,s/=256,l-=8);e[n+f-p]|=m*128}var OFe={}.toString,DZ=Array.isArray||function(e){return OFe.call(e)=="[object Array]"},GFe=50;ve.TYPED_ARRAY_SUPPORT=cd.TYPED_ARRAY_SUPPORT!==void 0?cd.TYPED_ARRAY_SUPPORT:!0,s1();function s1(){return ve.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Ba(e,t){if(s1()<t)throw new RangeError("Invalid typed array length");return ve.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t),e.__proto__=ve.prototype):(e===null&&(e=new ve(t)),e.length=t),e}function ve(e,t,n){if(!ve.TYPED_ARRAY_SUPPORT&&!(this instanceof ve))return new ve(e,t,n);if(typeof e=="number"){if(typeof t=="string")throw new Error("If encoding is specified then the first argument must be a string");return VT(this,e)}return UZ(this,e,t,n)}ve.poolSize=8192,ve._augment=function(e){return e.__proto__=ve.prototype,e};function UZ(e,t,n,i){if(typeof t=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&t instanceof ArrayBuffer?AFe(e,t,n,i):typeof t=="string"?FFe(e,t,n):zFe(e,t)}ve.from=function(e,t,n){return UZ(null,e,t,n)},ve.TYPED_ARRAY_SUPPORT&&(ve.prototype.__proto__=Uint8Array.prototype,ve.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&ve[Symbol.species]);function WZ(e){if(typeof e!="number")throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function VFe(e,t,n,i){return WZ(t),t<=0?Ba(e,t):n!==void 0?typeof i=="string"?Ba(e,t).fill(n,i):Ba(e,t).fill(n):Ba(e,t)}ve.alloc=function(e,t,n){return VFe(null,e,t,n)};function VT(e,t){if(WZ(t),e=Ba(e,t<0?0:AT(t)|0),!ve.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}ve.allocUnsafe=function(e){return VT(null,e)},ve.allocUnsafeSlow=function(e){return VT(null,e)};function FFe(e,t,n){if((typeof n!="string"||n==="")&&(n="utf8"),!ve.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var i=BZ(t,n)|0;e=Ba(e,i);var r=e.write(t,n);return r!==i&&(e=e.slice(0,r)),e}function FT(e,t){var n=t.length<0?0:AT(t.length)|0;e=Ba(e,n);for(var i=0;i<n;i+=1)e[i]=t[i]&255;return e}function AFe(e,t,n,i){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(i||0))throw new RangeError("'length' is out of bounds");return n===void 0&&i===void 0?t=new Uint8Array(t):i===void 0?t=new Uint8Array(t,n):t=new Uint8Array(t,n,i),ve.TYPED_ARRAY_SUPPORT?(e=t,e.__proto__=ve.prototype):e=FT(e,t),e}function zFe(e,t){if(aa(t)){var n=AT(t.length)|0;return e=Ba(e,n),e.length===0||t.copy(e,0,0,n),e}if(t){if(typeof ArrayBuffer<"u"&&t.buffer instanceof ArrayBuffer||"length"in t)return typeof t.length!="number"||n4e(t.length)?Ba(e,0):FT(e,t);if(t.type==="Buffer"&&DZ(t.data))return FT(e,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function AT(e){if(e>=s1())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s1().toString(16)+" bytes");return e|0}ve.isBuffer=jr;function aa(e){return!!(e!=null&&e._isBuffer)}ve.compare=function(t,n){if(!aa(t)||!aa(n))throw new TypeError("Arguments must be Buffers");if(t===n)return 0;for(var i=t.length,r=n.length,o=0,s=Math.min(i,r);o<s;++o)if(t[o]!==n[o]){i=t[o],r=n[o];break}return i<r?-1:r<i?1:0},ve.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},ve.concat=function(t,n){if(!DZ(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return ve.alloc(0);var i;if(n===void 0)for(n=0,i=0;i<t.length;++i)n+=t[i].length;var r=ve.allocUnsafe(n),o=0;for(i=0;i<t.length;++i){var s=t[i];if(!aa(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,o),o+=s.length}return r};function BZ(e,t){if(aa(e))return e.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;typeof e!="string"&&(e=""+e);var n=e.length;if(n===0)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return l1(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return eD(e).length;default:if(i)return l1(e).length;t=(""+t).toLowerCase(),i=!0}}ve.byteLength=BZ;function NFe(e,t,n){var i=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return jFe(this,t,n);case"utf8":case"utf-8":return KZ(this,t,n);case"ascii":return YFe(this,t,n);case"latin1":case"binary":return HFe(this,t,n);case"base64":return WFe(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return KFe(this,t,n);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}ve.prototype._isBuffer=!0;function ru(e,t,n){var i=e[t];e[t]=e[n],e[n]=i}ve.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var n=0;n<t;n+=2)ru(this,n,n+1);return this},ve.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var n=0;n<t;n+=4)ru(this,n,n+3),ru(this,n+1,n+2);return this},ve.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var n=0;n<t;n+=8)ru(this,n,n+7),ru(this,n+1,n+6),ru(this,n+2,n+5),ru(this,n+3,n+4);return this},ve.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?KZ(this,0,t):NFe.apply(this,arguments)},ve.prototype.equals=function(t){if(!aa(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:ve.compare(this,t)===0},ve.prototype.inspect=function(){var t="",n=GFe;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),"<Buffer "+t+">"},ve.prototype.compare=function(t,n,i,r,o){if(!aa(t))throw new TypeError("Argument must be a Buffer");if(n===void 0&&(n=0),i===void 0&&(i=t?t.length:0),r===void 0&&(r=0),o===void 0&&(o=this.length),n<0||i>t.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&n>=i)return 0;if(r>=o)return-1;if(n>=i)return 1;if(n>>>=0,i>>>=0,r>>>=0,o>>>=0,this===t)return 0;for(var s=o-r,a=i-n,c=Math.min(s,a),l=this.slice(r,o),u=t.slice(n,i),h=0;h<c;++h)if(l[h]!==u[h]){s=l[h],a=u[h];break}return s<a?-1:a<s?1:0};function YZ(e,t,n,i,r){if(e.length===0)return-1;if(typeof n=="string"?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=r?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(r)return-1;n=e.length-1}else if(n<0)if(r)n=0;else return-1;if(typeof t=="string"&&(t=ve.from(t,i)),aa(t))return t.length===0?-1:HZ(e,t,n,i,r);if(typeof t=="number")return t=t&255,ve.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?r?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):HZ(e,[t],n,i,r);throw new TypeError("val must be string, number or Buffer")}function HZ(e,t,n,i,r){var o=1,s=e.length,a=t.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(e.length<2||t.length<2)return-1;o=2,s/=2,a/=2,n/=2}function c(f,p){return o===1?f[p]:f.readUInt16BE(p*o)}var l;if(r){var u=-1;for(l=n;l<s;l++)if(c(e,l)===c(t,u===-1?0:l-u)){if(u===-1&&(u=l),l-u+1===a)return u*o}else u!==-1&&(l-=l-u),u=-1}else for(n+a>s&&(n=s-a),l=n;l>=0;l--){for(var h=!0,d=0;d<a;d++)if(c(e,l+d)!==c(t,d)){h=!1;break}if(h)return l}return-1}ve.prototype.includes=function(t,n,i){return this.indexOf(t,n,i)!==-1},ve.prototype.indexOf=function(t,n,i){return YZ(this,t,n,i,!0)},ve.prototype.lastIndexOf=function(t,n,i){return YZ(this,t,n,i,!1)};function kFe(e,t,n,i){n=Number(n)||0;var r=e.length-n;i?(i=Number(i),i>r&&(i=r)):i=r;var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");i>o/2&&(i=o/2);for(var s=0;s<i;++s){var a=parseInt(t.substr(s*2,2),16);if(isNaN(a))return s;e[n+s]=a}return s}function XFe(e,t,n,i){return u1(l1(t,e.length-n),e,n,i)}function jZ(e,t,n,i){return u1(e4e(t),e,n,i)}function ZFe(e,t,n,i){return jZ(e,t,n,i)}function DFe(e,t,n,i){return u1(eD(t),e,n,i)}function UFe(e,t,n,i){return u1(t4e(t,e.length-n),e,n,i)}ve.prototype.write=function(t,n,i,r){if(n===void 0)r="utf8",i=this.length,n=0;else if(i===void 0&&typeof n=="string")r=n,i=this.length,n=0;else if(isFinite(n))n=n|0,isFinite(i)?(i=i|0,r===void 0&&(r="utf8")):(r=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-n;if((i===void 0||i>o)&&(i=o),t.length>0&&(i<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var s=!1;;)switch(r){case"hex":return kFe(this,t,n,i);case"utf8":case"utf-8":return XFe(this,t,n,i);case"ascii":return jZ(this,t,n,i);case"latin1":case"binary":return ZFe(this,t,n,i);case"base64":return DFe(this,t,n,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return UFe(this,t,n,i);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),s=!0}},ve.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function WFe(e,t,n){return t===0&&n===e.length?XZ(e):XZ(e.slice(t,n))}function KZ(e,t,n){n=Math.min(e.length,n);for(var i=[],r=t;r<n;){var o=e[r],s=null,a=o>239?4:o>223?3:o>191?2:1;if(r+a<=n){var c,l,u,h;switch(a){case 1:o<128&&(s=o);break;case 2:c=e[r+1],(c&192)===128&&(h=(o&31)<<6|c&63,h>127&&(s=h));break;case 3:c=e[r+1],l=e[r+2],(c&192)===128&&(l&192)===128&&(h=(o&15)<<12|(c&63)<<6|l&63,h>2047&&(h<55296||h>57343)&&(s=h));break;case 4:c=e[r+1],l=e[r+2],u=e[r+3],(c&192)===128&&(l&192)===128&&(u&192)===128&&(h=(o&15)<<18|(c&63)<<12|(l&63)<<6|u&63,h>65535&&h<1114112&&(s=h))}}s===null?(s=65533,a=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|s&1023),i.push(s),r+=a}return BFe(i)}var JZ=4096;function BFe(e){var t=e.length;if(t<=JZ)return String.fromCharCode.apply(String,e);for(var n="",i=0;i<t;)n+=String.fromCharCode.apply(String,e.slice(i,i+=JZ));return n}function YFe(e,t,n){var i="";n=Math.min(e.length,n);for(var r=t;r<n;++r)i+=String.fromCharCode(e[r]&127);return i}function HFe(e,t,n){var i="";n=Math.min(e.length,n);for(var r=t;r<n;++r)i+=String.fromCharCode(e[r]);return i}function jFe(e,t,n){var i=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>i)&&(n=i);for(var r="",o=t;o<n;++o)r+=$Fe(e[o]);return r}function KFe(e,t,n){for(var i=e.slice(t,n),r="",o=0;o<i.length;o+=2)r+=String.fromCharCode(i[o]+i[o+1]*256);return r}ve.prototype.slice=function(t,n){var i=this.length;t=~~t,n=n===void 0?i:~~n,t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),n<0?(n+=i,n<0&&(n=0)):n>i&&(n=i),n<t&&(n=t);var r;if(ve.TYPED_ARRAY_SUPPORT)r=this.subarray(t,n),r.__proto__=ve.prototype;else{var o=n-t;r=new ve(o,void 0);for(var s=0;s<o;++s)r[s]=this[s+t]}return r};function Mi(e,t,n){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}ve.prototype.readUIntLE=function(t,n,i){t=t|0,n=n|0,i||Mi(t,n,this.length);for(var r=this[t],o=1,s=0;++s<n&&(o*=256);)r+=this[t+s]*o;return r},ve.prototype.readUIntBE=function(t,n,i){t=t|0,n=n|0,i||Mi(t,n,this.length);for(var r=this[t+--n],o=1;n>0&&(o*=256);)r+=this[t+--n]*o;return r},ve.prototype.readUInt8=function(t,n){return n||Mi(t,1,this.length),this[t]},ve.prototype.readUInt16LE=function(t,n){return n||Mi(t,2,this.length),this[t]|this[t+1]<<8},ve.prototype.readUInt16BE=function(t,n){return n||Mi(t,2,this.length),this[t]<<8|this[t+1]},ve.prototype.readUInt32LE=function(t,n){return n||Mi(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216},ve.prototype.readUInt32BE=function(t,n){return n||Mi(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])},ve.prototype.readIntLE=function(t,n,i){t=t|0,n=n|0,i||Mi(t,n,this.length);for(var r=this[t],o=1,s=0;++s<n&&(o*=256);)r+=this[t+s]*o;return o*=128,r>=o&&(r-=Math.pow(2,8*n)),r},ve.prototype.readIntBE=function(t,n,i){t=t|0,n=n|0,i||Mi(t,n,this.length);for(var r=n,o=1,s=this[t+--r];r>0&&(o*=256);)s+=this[t+--r]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*n)),s},ve.prototype.readInt8=function(t,n){return n||Mi(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]},ve.prototype.readInt16LE=function(t,n){n||Mi(t,2,this.length);var i=this[t]|this[t+1]<<8;return i&32768?i|4294901760:i},ve.prototype.readInt16BE=function(t,n){n||Mi(t,2,this.length);var i=this[t+1]|this[t]<<8;return i&32768?i|4294901760:i},ve.prototype.readInt32LE=function(t,n){return n||Mi(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},ve.prototype.readInt32BE=function(t,n){return n||Mi(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},ve.prototype.readFloatLE=function(t,n){return n||Mi(t,4,this.length),o1(this,t,!0,23,4)},ve.prototype.readFloatBE=function(t,n){return n||Mi(t,4,this.length),o1(this,t,!1,23,4)},ve.prototype.readDoubleLE=function(t,n){return n||Mi(t,8,this.length),o1(this,t,!0,52,8)},ve.prototype.readDoubleBE=function(t,n){return n||Mi(t,8,this.length),o1(this,t,!1,52,8)};function Hr(e,t,n,i,r,o){if(!aa(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>r||t<o)throw new RangeError('"value" argument is out of bounds');if(n+i>e.length)throw new RangeError("Index out of range")}ve.prototype.writeUIntLE=function(t,n,i,r){if(t=+t,n=n|0,i=i|0,!r){var o=Math.pow(2,8*i)-1;Hr(this,t,n,i,o,0)}var s=1,a=0;for(this[n]=t&255;++a<i&&(s*=256);)this[n+a]=t/s&255;return n+i},ve.prototype.writeUIntBE=function(t,n,i,r){if(t=+t,n=n|0,i=i|0,!r){var o=Math.pow(2,8*i)-1;Hr(this,t,n,i,o,0)}var s=i-1,a=1;for(this[n+s]=t&255;--s>=0&&(a*=256);)this[n+s]=t/a&255;return n+i},ve.prototype.writeUInt8=function(t,n,i){return t=+t,n=n|0,i||Hr(this,t,n,1,255,0),ve.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[n]=t&255,n+1};function a1(e,t,n,i){t<0&&(t=65535+t+1);for(var r=0,o=Math.min(e.length-n,2);r<o;++r)e[n+r]=(t&255<<8*(i?r:1-r))>>>(i?r:1-r)*8}ve.prototype.writeUInt16LE=function(t,n,i){return t=+t,n=n|0,i||Hr(this,t,n,2,65535,0),ve.TYPED_ARRAY_SUPPORT?(this[n]=t&255,this[n+1]=t>>>8):a1(this,t,n,!0),n+2},ve.prototype.writeUInt16BE=function(t,n,i){return t=+t,n=n|0,i||Hr(this,t,n,2,65535,0),ve.TYPED_ARRAY_SUPPORT?(this[n]=t>>>8,this[n+1]=t&255):a1(this,t,n,!1),n+2};function c1(e,t,n,i){t<0&&(t=4294967295+t+1);for(var r=0,o=Math.min(e.length-n,4);r<o;++r)e[n+r]=t>>>(i?r:3-r)*8&255}ve.prototype.writeUInt32LE=function(t,n,i){return t=+t,n=n|0,i||Hr(this,t,n,4,4294967295,0),ve.TYPED_ARRAY_SUPPORT?(this[n+3]=t>>>24,this[n+2]=t>>>16,this[n+1]=t>>>8,this[n]=t&255):c1(this,t,n,!0),n+4},ve.prototype.writeUInt32BE=function(t,n,i){return t=+t,n=n|0,i||Hr(this,t,n,4,4294967295,0),ve.TYPED_ARRAY_SUPPORT?(this[n]=t>>>24,this[n+1]=t>>>16,this[n+2]=t>>>8,this[n+3]=t&255):c1(this,t,n,!1),n+4},ve.prototype.writeIntLE=function(t,n,i,r){if(t=+t,n=n|0,!r){var o=Math.pow(2,8*i-1);Hr(this,t,n,i,o-1,-o)}var s=0,a=1,c=0;for(this[n]=t&255;++s<i&&(a*=256);)t<0&&c===0&&this[n+s-1]!==0&&(c=1),this[n+s]=(t/a>>0)-c&255;return n+i},ve.prototype.writeIntBE=function(t,n,i,r){if(t=+t,n=n|0,!r){var o=Math.pow(2,8*i-1);Hr(this,t,n,i,o-1,-o)}var s=i-1,a=1,c=0;for(this[n+s]=t&255;--s>=0&&(a*=256);)t<0&&c===0&&this[n+s+1]!==0&&(c=1),this[n+s]=(t/a>>0)-c&255;return n+i},ve.prototype.writeInt8=function(t,n,i){return t=+t,n=n|0,i||Hr(this,t,n,1,127,-128),ve.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[n]=t&255,n+1},ve.prototype.writeInt16LE=function(t,n,i){return t=+t,n=n|0,i||Hr(this,t,n,2,32767,-32768),ve.TYPED_ARRAY_SUPPORT?(this[n]=t&255,this[n+1]=t>>>8):a1(this,t,n,!0),n+2},ve.prototype.writeInt16BE=function(t,n,i){return t=+t,n=n|0,i||Hr(this,t,n,2,32767,-32768),ve.TYPED_ARRAY_SUPPORT?(this[n]=t>>>8,this[n+1]=t&255):a1(this,t,n,!1),n+2},ve.prototype.writeInt32LE=function(t,n,i){return t=+t,n=n|0,i||Hr(this,t,n,4,2147483647,-2147483648),ve.TYPED_ARRAY_SUPPORT?(this[n]=t&255,this[n+1]=t>>>8,this[n+2]=t>>>16,this[n+3]=t>>>24):c1(this,t,n,!0),n+4},ve.prototype.writeInt32BE=function(t,n,i){return t=+t,n=n|0,i||Hr(this,t,n,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),ve.TYPED_ARRAY_SUPPORT?(this[n]=t>>>24,this[n+1]=t>>>16,this[n+2]=t>>>8,this[n+3]=t&255):c1(this,t,n,!1),n+4};function QZ(e,t,n,i,r,o){if(n+i>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function qZ(e,t,n,i,r){return r||QZ(e,t,n,4),ZZ(e,t,n,i,23,4),n+4}ve.prototype.writeFloatLE=function(t,n,i){return qZ(this,t,n,!0,i)},ve.prototype.writeFloatBE=function(t,n,i){return qZ(this,t,n,!1,i)};function $Z(e,t,n,i,r){return r||QZ(e,t,n,8),ZZ(e,t,n,i,52,8),n+8}ve.prototype.writeDoubleLE=function(t,n,i){return $Z(this,t,n,!0,i)},ve.prototype.writeDoubleBE=function(t,n,i){return $Z(this,t,n,!1,i)},ve.prototype.copy=function(t,n,i,r){if(i||(i=0),!r&&r!==0&&(r=this.length),n>=t.length&&(n=t.length),n||(n=0),r>0&&r<i&&(r=i),r===i||t.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-n<r-i&&(r=t.length-n+i);var o=r-i,s;if(this===t&&i<n&&n<r)for(s=o-1;s>=0;--s)t[s+n]=this[s+i];else if(o<1e3||!ve.TYPED_ARRAY_SUPPORT)for(s=0;s<o;++s)t[s+n]=this[s+i];else Uint8Array.prototype.set.call(t,this.subarray(i,i+o),n);return o},ve.prototype.fill=function(t,n,i,r){if(typeof t=="string"){if(typeof n=="string"?(r=n,n=0,i=this.length):typeof i=="string"&&(r=i,i=this.length),t.length===1){var o=t.charCodeAt(0);o<256&&(t=o)}if(r!==void 0&&typeof r!="string")throw new TypeError("encoding must be a string");if(typeof r=="string"&&!ve.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else typeof t=="number"&&(t=t&255);if(n<0||this.length<n||this.length<i)throw new RangeError("Out of range index");if(i<=n)return this;n=n>>>0,i=i===void 0?this.length:i>>>0,t||(t=0);var s;if(typeof t=="number")for(s=n;s<i;++s)this[s]=t;else{var a=aa(t)?t:l1(new ve(t,r).toString()),c=a.length;for(s=0;s<i-n;++s)this[s+n]=a[s%c]}return this};var JFe=/[^+\/0-9A-Za-z-_]/g;function QFe(e){if(e=qFe(e).replace(JFe,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function qFe(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function $Fe(e){return e<16?"0"+e.toString(16):e.toString(16)}function l1(e,t){t=t||1/0;for(var n,i=e.length,r=null,o=[],s=0;s<i;++s){if(n=e.charCodeAt(s),n>55295&&n<57344){if(!r){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(s+1===i){(t-=3)>-1&&o.push(239,191,189);continue}r=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),r=n;continue}n=(r-55296<<10|n-56320)+65536}else r&&(t-=3)>-1&&o.push(239,191,189);if(r=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return o}function e4e(e){for(var t=[],n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function t4e(e,t){for(var n,i,r,o=[],s=0;s<e.length&&!((t-=2)<0);++s)n=e.charCodeAt(s),i=n>>8,r=n%256,o.push(r),o.push(i);return o}function eD(e){return MFe(QFe(e))}function u1(e,t,n,i){for(var r=0;r<i&&!(r+n>=t.length||r>=e.length);++r)t[r+n]=e[r];return r}function n4e(e){return e!==e}function jr(e){return e!=null&&(!!e._isBuffer||tD(e)||i4e(e))}function tD(e){return!!e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}function i4e(e){return typeof e.readFloatLE=="function"&&typeof e.slice=="function"&&tD(e.slice(0,0))}var zT;function Kc(){}Kc.prototype=Object.create(null);function Bt(){Bt.init.call(this)}Bt.EventEmitter=Bt,Bt.usingDomains=!1,Bt.prototype.domain=void 0,Bt.prototype._events=void 0,Bt.prototype._maxListeners=void 0,Bt.defaultMaxListeners=10,Bt.init=function(){this.domain=null,Bt.usingDomains&&zT.active&&!(this instanceof zT.Domain)&&(this.domain=zT.active),(!this._events||this._events===Object.getPrototypeOf(this)._events)&&(this._events=new Kc,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Bt.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||isNaN(t))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=t,this};function nD(e){return e._maxListeners===void 0?Bt.defaultMaxListeners:e._maxListeners}Bt.prototype.getMaxListeners=function(){return nD(this)};function r4e(e,t,n){if(t)e.call(n);else for(var i=e.length,r=M0(e,i),o=0;o<i;++o)r[o].call(n)}function o4e(e,t,n,i){if(t)e.call(n,i);else for(var r=e.length,o=M0(e,r),s=0;s<r;++s)o[s].call(n,i)}function s4e(e,t,n,i,r){if(t)e.call(n,i,r);else for(var o=e.length,s=M0(e,o),a=0;a<o;++a)s[a].call(n,i,r)}function a4e(e,t,n,i,r,o){if(t)e.call(n,i,r,o);else for(var s=e.length,a=M0(e,s),c=0;c<s;++c)a[c].call(n,i,r,o)}function c4e(e,t,n,i){if(t)e.apply(n,i);else for(var r=e.length,o=M0(e,r),s=0;s<r;++s)o[s].apply(n,i)}Bt.prototype.emit=function(t){var n,i,r,o,s,a,c,l=t==="error";if(a=this._events,a)l=l&&a.error==null;else if(!l)return!1;if(c=this.domain,l){if(n=arguments[1],c)n||(n=new Error('Uncaught, unspecified "error" event')),n.domainEmitter=this,n.domain=c,n.domainThrown=!1,c.emit("error",n);else{if(n instanceof Error)throw n;var u=new Error('Uncaught, unspecified "error" event. ('+n+")");throw u.context=n,u}return!1}if(i=a[t],!i)return!1;var h=typeof i=="function";switch(r=arguments.length,r){case 1:r4e(i,h,this);break;case 2:o4e(i,h,this,arguments[1]);break;case 3:s4e(i,h,this,arguments[1],arguments[2]);break;case 4:a4e(i,h,this,arguments[1],arguments[2],arguments[3]);break;default:for(o=new Array(r-1),s=1;s<r;s++)o[s-1]=arguments[s];c4e(i,h,this,o)}return!0};function iD(e,t,n,i){var r,o,s;if(typeof n!="function")throw new TypeError('"listener" argument must be a function');if(o=e._events,o?(o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),s=o[t]):(o=e._events=new Kc,e._eventsCount=0),!s)s=o[t]=n,++e._eventsCount;else if(typeof s=="function"?s=o[t]=i?[n,s]:[s,n]:i?s.unshift(n):s.push(n),!s.warned&&(r=nD(e),r&&r>0&&s.length>r)){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=s.length,l4e(a)}return e}function l4e(e){typeof console.warn=="function"?console.warn(e):console.log(e)}Bt.prototype.addListener=function(t,n){return iD(this,t,n,!1)},Bt.prototype.on=Bt.prototype.addListener,Bt.prototype.prependListener=function(t,n){return iD(this,t,n,!0)};function rD(e,t,n){var i=!1;function r(){e.removeListener(t,r),i||(i=!0,n.apply(e,arguments))}return r.listener=n,r}Bt.prototype.once=function(t,n){if(typeof n!="function")throw new TypeError('"listener" argument must be a function');return this.on(t,rD(this,t,n)),this},Bt.prototype.prependOnceListener=function(t,n){if(typeof n!="function")throw new TypeError('"listener" argument must be a function');return this.prependListener(t,rD(this,t,n)),this},Bt.prototype.removeListener=function(t,n){var i,r,o,s,a;if(typeof n!="function")throw new TypeError('"listener" argument must be a function');if(r=this._events,!r)return this;if(i=r[t],!i)return this;if(i===n||i.listener&&i.listener===n)--this._eventsCount===0?this._events=new Kc:(delete r[t],r.removeListener&&this.emit("removeListener",t,i.listener||n));else if(typeof i!="function"){for(o=-1,s=i.length;s-- >0;)if(i[s]===n||i[s].listener&&i[s].listener===n){a=i[s].listener,o=s;break}if(o<0)return this;if(i.length===1){if(i[0]=void 0,--this._eventsCount===0)return this._events=new Kc,this;delete r[t]}else u4e(i,o);r.removeListener&&this.emit("removeListener",t,a||n)}return this},Bt.prototype.removeAllListeners=function(t){var n,i;if(i=this._events,!i)return this;if(!i.removeListener)return arguments.length===0?(this._events=new Kc,this._eventsCount=0):i[t]&&(--this._eventsCount===0?this._events=new Kc:delete i[t]),this;if(arguments.length===0){for(var r=Object.keys(i),o=0,s;o<r.length;++o)s=r[o],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=new Kc,this._eventsCount=0,this}if(n=i[t],typeof n=="function")this.removeListener(t,n);else if(n)do this.removeListener(t,n[n.length-1]);while(n[0]);return this},Bt.prototype.listeners=function(t){var n,i,r=this._events;return r?(n=r[t],n?typeof n=="function"?i=[n.listener||n]:i=h4e(n):i=[]):i=[],i},Bt.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):oD.call(e,t)},Bt.prototype.listenerCount=oD;function oD(e){var t=this._events;if(t){var n=t[e];if(typeof n=="function")return 1;if(n)return n.length}return 0}Bt.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};function u4e(e,t){for(var n=t,i=n+1,r=e.length;i<r;n+=1,i+=1)e[n]=e[i];e.pop()}function M0(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}function h4e(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function sD(){throw new Error("setTimeout has not been defined")}function aD(){throw new Error("clearTimeout has not been defined")}var Jc=sD,Qc=aD;typeof cd.setTimeout=="function"&&(Jc=setTimeout),typeof cd.clearTimeout=="function"&&(Qc=clearTimeout);function cD(e){if(Jc===setTimeout)return setTimeout(e,0);if((Jc===sD||!Jc)&&setTimeout)return Jc=setTimeout,setTimeout(e,0);try{return Jc(e,0)}catch{try{return Jc.call(null,e,0)}catch{return Jc.call(this,e,0)}}}function d4e(e){if(Qc===clearTimeout)return clearTimeout(e);if((Qc===aD||!Qc)&&clearTimeout)return Qc=clearTimeout,clearTimeout(e);try{return Qc(e)}catch{try{return Qc.call(null,e)}catch{return Qc.call(this,e)}}}var Ya=[],ld=!1,ou,h1=-1;function f4e(){!ld||!ou||(ld=!1,ou.length?Ya=ou.concat(Ya):h1=-1,Ya.length&&lD())}function lD(){if(!ld){var e=cD(f4e);ld=!0;for(var t=Ya.length;t;){for(ou=Ya,Ya=[];++h1<t;)ou&&ou[h1].run();h1=-1,t=Ya.length}ou=null,ld=!1,d4e(e)}}function Do(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];Ya.push(new uD(e,t)),Ya.length===1&&!ld&&cD(lD)}function uD(e,t){this.fun=e,this.array=t}uD.prototype.run=function(){this.fun.apply(null,this.array)};var p4e={},L0=cd.performance||{};L0.now||L0.mozNow||L0.msNow||L0.oNow||L0.webkitNow;var d1={env:p4e},NT;typeof Object.create=="function"?NT=function(t,n){t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:NT=function(t,n){t.super_=n;var i=function(){};i.prototype=n.prototype,t.prototype=new i,t.prototype.constructor=t};var ud=NT,m4e=/%[sdj%]/g;function g4e(e){if(!UT(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(qc(arguments[n]));return t.join(" ")}for(var n=1,i=arguments,r=i.length,o=String(e).replace(m4e,function(a){if(a==="%%")return"%";if(n>=r)return a;switch(a){case"%s":return String(i[n++]);case"%d":return Number(i[n++]);case"%j":try{return JSON.stringify(i[n++])}catch{return"[Circular]"}default:return a}}),s=i[n];n<r;s=i[++n])DT(s)||!P0(s)?o+=" "+s:o+=" "+qc(s);return o}function hD(e,t){if($c(cd.process))return function(){return hD(e,t).apply(this,arguments)};if(d1.noDeprecation===!0)return e;var n=!1;function i(){if(!n){if(d1.throwDeprecation)throw new Error(t);d1.traceDeprecation?console.trace(t):console.error(t),n=!0}return e.apply(this,arguments)}return i}var f1={},kT;function y4e(e){if($c(kT)&&(kT=d1.env.NODE_DEBUG||""),e=e.toUpperCase(),!f1[e])if(new RegExp("\\b"+e+"\\b","i").test(kT)){var t=0;f1[e]=function(){var n=g4e.apply(null,arguments);console.error("%s %d: %s",e,t,n)}}else f1[e]=function(){};return f1[e]}function qc(e,t){var n={seen:[],stylize:_4e};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),dD(t)?n.showHidden=t:t&&C4e(n,t),$c(n.showHidden)&&(n.showHidden=!1),$c(n.depth)&&(n.depth=2),$c(n.colors)&&(n.colors=!1),$c(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=b4e),p1(n,e,n.depth)}qc.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},qc.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function b4e(e,t){var n=qc.styles[t];return n?"\x1B["+qc.colors[n][0]+"m"+e+"\x1B["+qc.colors[n][1]+"m":e}function _4e(e,t){return e}function v4e(e){var t={};return e.forEach(function(n,i){t[n]=!0}),t}function p1(e,t,n){if(e.customInspect&&t&&YT(t.inspect)&&t.inspect!==qc&&!(t.constructor&&t.constructor.prototype===t)){var i=t.inspect(n,e);return UT(i)||(i=p1(e,i,n)),i}var r=w4e(e,t);if(r)return r;var o=Object.keys(t),s=v4e(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),BT(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return XT(t);if(o.length===0){if(YT(t)){var a=t.name?": "+t.name:"";return e.stylize("[Function"+a+"]","special")}if(WT(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(fD(t))return e.stylize(Date.prototype.toString.call(t),"date");if(BT(t))return XT(t)}var c="",l=!1,u=["{","}"];if(E4e(t)&&(l=!0,u=["[","]"]),YT(t)){var h=t.name?": "+t.name:"";c=" [Function"+h+"]"}if(WT(t)&&(c=" "+RegExp.prototype.toString.call(t)),fD(t)&&(c=" "+Date.prototype.toUTCString.call(t)),BT(t)&&(c=" "+XT(t)),o.length===0&&(!l||t.length==0))return u[0]+c+u[1];if(n<0)return WT(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var d;return l?d=x4e(e,t,n,s,o):d=o.map(function(f){return ZT(e,t,n,s,f,l)}),e.seen.pop(),S4e(d,c,u)}function w4e(e,t){if($c(t))return e.stylize("undefined","undefined");if(UT(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(T4e(t))return e.stylize(""+t,"number");if(dD(t))return e.stylize(""+t,"boolean");if(DT(t))return e.stylize("null","null")}function XT(e){return"["+Error.prototype.toString.call(e)+"]"}function x4e(e,t,n,i,r){for(var o=[],s=0,a=t.length;s<a;++s)pD(t,String(s))?o.push(ZT(e,t,n,i,String(s),!0)):o.push("");return r.forEach(function(c){c.match(/^\d+$/)||o.push(ZT(e,t,n,i,c,!0))}),o}function ZT(e,t,n,i,r,o){var s,a,c;if(c=Object.getOwnPropertyDescriptor(t,r)||{value:t[r]},c.get?c.set?a=e.stylize("[Getter/Setter]","special"):a=e.stylize("[Getter]","special"):c.set&&(a=e.stylize("[Setter]","special")),pD(i,r)||(s="["+r+"]"),a||(e.seen.indexOf(c.value)<0?(DT(n)?a=p1(e,c.value,null):a=p1(e,c.value,n-1),a.indexOf(`
6731
+ `,uniforms:{...Qr(u,["color","frustumLength","blackPoint","whitePoint","gamma"]),globeDepthTexture:()=>c?.()??d._depthTexture}});if(r){const f=$Le({prefix:e,outputType:s,useGlobeDepth:a,getGlobeDepthTexture:c,uniforms:{textureScale:t,...Qr(u,["frustumLength","normalExponent","depthExponent"])}}),p=new M.PostProcessStageComposite({name:`${e}_ambient_occlusion_generate_and_filter`,stages:[h,f]});return d.uniforms.ambientOcclusionTexture=p.name,new M.PostProcessStageComposite({name:`${e}_ambient_occlusion`,stages:[p,d],inputPreviousStageTexture:!1,uniforms:fE([{stage:h,uniforms:["intensity","maxRadius","bias","frustumLength","focalLength"]},{stage:f,uniforms:["frustumLength","normalExponent","depthExponent"]},{stage:d,uniforms:["color","blackPoint","whitePoint","gamma"]}])})}else return d.uniforms.ambientOcclusionTexture=h.name,new M.PostProcessStageComposite({name:`${e}_ambient_occlusion`,stages:[h,d],inputPreviousStageTexture:!1,uniforms:fE([{stage:h,uniforms:["intensity","maxRadius","bias","frustumLength","focalLength"]},{stage:d,uniforms:["color","blackPoint","whitePoint","gamma"]}])})}const aPe=({enabled:e=!0,textureScale:t,directions:n,steps:i,denoise:r,accurateNormalReconstruction:o,outputType:s,useGlobeDepth:a,...c})=>{const{viewer:l}=Qn(),u=l?.scene,h=fF({owner:u?.postProcessStages,keys:[t,i,n,r,o,s,a],create:()=>{const d=sPe({textureScale:t,steps:i,directions:n,denoise:r,accurateNormalReconstruction:o,outputType:s,useGlobeDepth:a,getGlobeDepthTexture:()=>u.context.uniformState.globeDepthTexture,uniforms:c});return d.enabled=e,d},transferOwnership:(d,f)=>(f?.add(d),()=>{f?.remove(d)})});return h.enabled=e,Object.assign(h.uniforms,c),u?.requestRender(),Gl(()=>{const d=u?.camera.frustum;if(d instanceof M.PerspectiveFrustum&&d.fovy!==void 0&&d.aspectRatio!==void 0){const f=1/Math.tan(d.fovy/2);h.uniforms.focalLength.x=f*d.aspectRatio,h.uniforms.focalLength.y=f}}),null},cPe=e=>{const t=Qn(),[n,i]=R.useState(!1);return Gl(()=>{const r=t.scene;i(!r?.globe.depthTestAgainstTerrain);const{globeHeight:o}=r;if(!r||o==null)return;const s=r.camera.positionCartographic.height-o,a=r?.camera.frustum;a instanceof M.PerspectiveFrustum&&a.fov!==void 0&&(r.camera.frustum.near=M.Math.clamp(s-1,1,5)/Math.tan(a.fov/2))}),ce.jsx(aPe,{...e,useGlobeDepth:n})};var SN=(e=>(e[e.Occlusion=1]="Occlusion",e[e.Normal=2]="Normal",e[e.Depth=3]="Depth",e[e.Weight=4]="Weight",e[e.Shade=5]="Shade",e))(SN||{});const lPe={low:{directions:4,steps:4,textureScale:.5,maxRadius:30},medium:{directions:4,steps:8,textureScale:.5,maxRadius:40},high:{directions:8,steps:8,textureScale:1,maxRadius:40},extreme:{directions:16,steps:16,textureScale:1,maxRadius:40}},uPe="#00bebe",d0="#3B3CD0",hPe="#FF9900",dPe="#3B3CD0";let Jl,fPe,pPe,Ql;const f0=({position:e,clampToGround:t=!1,index:n,isEditing:i,isSelected:r,isAddingPoint:o,isExtrudedControlPoint:s,handleControlPointMouseEvent:a})=>{const c=R.useRef(e);c.current=e;const l=Wo(()=>new wo((f,p)=>"getValue"in c.current?c.current.getValue(f,p):c.current,!1)),u=R.useMemo(()=>({position:l,billboard:{image:i?o?bPe():r?yPe():gPe():mPe(),width:i?16:8,height:i?16:8,heightReference:t?vl.CLAMP_TO_GROUND:vl.NONE,disableDepthTestDistance:1/0}}),[t,l,o,i,r]),h=R.useCallback(()=>{a?.(n,!!s,"mousedown")},[n,s,a]),d=R.useCallback(()=>{a?.(n,!!s,"click")},[n,s,a]);return ce.jsx(uc,{...u,onMouseDown:h,onClick:d})};function mPe(){if(Jl!=null)return Jl;Jl=document.createElement("canvas"),Jl.width=16,Jl.height=16;const e=Jl.getContext("2d");return Vn(e!=null),e.fillStyle="white",e.fillRect(3,3,10,10),e.strokeStyle="black",e.lineWidth=2,e.strokeRect(3,3,10,10),Jl}function gPe(){return EN(fPe,{size:32,color:"white",strokeColor:d0})}function yPe(){return EN(pPe,{size:32,color:"white",strokeColor:hPe})}function bPe(){if(Ql!=null)return Ql;Ql=document.createElement("canvas"),Ql.width=32,Ql.height=32;const e=Ql.getContext("2d");return Vn(e!=null),e.beginPath(),e.arc(16,16,12,0,2*Math.PI),e.fillStyle="white",e.fill(),e.strokeStyle=dPe,e.lineWidth=4,e.stroke(),e.beginPath(),e.moveTo(16,8),e.lineTo(16,24),e.stroke(),e.moveTo(8,16),e.lineTo(24,16),e.stroke(),Ql}function EN(e,t){if(e!=null)return e;e=document.createElement("canvas"),e.width=t.size,e.height=t.size;const n=e.getContext("2d");return Vn(n!=null),n.beginPath(),n.arc(t.size/2,t.size/2,t.size/2-4,0,2*Math.PI),n.fillStyle=t.color,n.fill(),n.strokeStyle=t.strokeColor,n.lineWidth=4,n.stroke(),e}function _Pe(e,t){if(typeof e=="function")return e(t),()=>{e(null)};if(e!=null)return e.current=t,()=>{e.current=null}}const p0=R.memo(R.forwardRef(({entities:e,...t},n)=>{const{viewer:i}=Qn(),r=i?.scene,o=i?.entities,s=e??o,[a,c]=R.useState(()=>new io(t));return R.useEffect(()=>{c(new io(t))},[t.id]),R.useEffect(()=>(s?.add(a),()=>{s?.remove(a),r?.requestRender()}),[r,s,a]),R.useEffect(()=>_Pe(n,a),[n,a]),Object.assign(a,Ka(t,"id")),r?.requestRender(),null})),vPe={padding:"5px",color:"#fff",backgroundColor:"#000",borderRadius:"5px",lineHeight:1},TN=({children:e})=>ce.jsx("div",{style:vPe,children:e}),CN=R.createContext({});function RN(e){const t=R.useRef(null);return t.current===null&&(t.current=e()),t.current}const wPe=typeof window<"u"?R.useLayoutEffect:R.useEffect,pE=R.createContext(null);function mE(e,t){e.indexOf(t)===-1&&e.push(t)}function Nb(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const ia=(e,t,n)=>n>t?t:n<e?e:n;function gE(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}let Jh=()=>{},Ua=()=>{};typeof process<"u"&&process.env?.NODE_ENV!=="production"&&(Jh=(e,t,n)=>{!e&&typeof console<"u"&&console.warn(gE(t,n))},Ua=(e,t,n)=>{if(!e)throw new Error(gE(t,n))});const Wa={},IN=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function MN(e){return typeof e=="object"&&e!==null}const LN=e=>/^0[^.\s]+$/u.test(e);function PN(e){let t;return()=>(t===void 0&&(t=e()),t)}const No=e=>e,xPe=(e,t)=>n=>t(e(n)),m0=(...e)=>e.reduce(xPe),g0=(e,t,n)=>{const i=t-e;return i===0?1:(n-e)/i};class yE{constructor(){this.subscriptions=[]}add(t){return mE(this.subscriptions,t),()=>Nb(this.subscriptions,t)}notify(t,n,i){const r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](t,n,i);else for(let o=0;o<r;o++){const s=this.subscriptions[o];s&&s(t,n,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const ko=e=>e*1e3,Xo=e=>e/1e3;function ON(e,t){return t?e*(1e3/t):0}const GN=new Set;function bE(e,t,n){e||GN.has(t)||(console.warn(gE(t,n)),GN.add(t))}const VN=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,SPe=1e-7,EPe=12;function TPe(e,t,n,i,r){let o,s,a=0;do s=t+(n-t)/2,o=VN(s,i,r)-e,o>0?n=s:t=s;while(Math.abs(o)>SPe&&++a<EPe);return s}function y0(e,t,n,i){if(e===t&&n===i)return No;const r=o=>TPe(o,0,1,e,n);return o=>o===0||o===1?o:VN(r(o),t,i)}const FN=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,AN=e=>t=>1-e(1-t),zN=y0(.33,1.53,.69,.99),_E=AN(zN),NN=FN(_E),kN=e=>(e*=2)<1?.5*_E(e):.5*(2-Math.pow(2,-10*(e-1))),vE=e=>1-Math.sin(Math.acos(e)),XN=AN(vE),ZN=FN(vE),CPe=y0(.42,0,1,1),RPe=y0(0,0,.58,1),DN=y0(.42,0,.58,1),IPe=e=>Array.isArray(e)&&typeof e[0]!="number",UN=e=>Array.isArray(e)&&typeof e[0]=="number",WN={linear:No,easeIn:CPe,easeInOut:DN,easeOut:RPe,circIn:vE,circInOut:ZN,circOut:XN,backIn:_E,backInOut:NN,backOut:zN,anticipate:kN},MPe=e=>typeof e=="string",BN=e=>{if(UN(e)){Ua(e.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[t,n,i,r]=e;return y0(t,n,i,r)}else if(MPe(e))return Ua(WN[e]!==void 0,`Invalid easing type '${e}'`,"invalid-easing-type"),WN[e];return e},kb=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function LPe(e,t){let n=new Set,i=new Set,r=!1,o=!1;const s=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function c(u){s.has(u)&&(l.schedule(u),e()),u(a)}const l={schedule:(u,h=!1,d=!1)=>{const p=d&&r?n:i;return h&&s.add(u),p.has(u)||p.add(u),u},cancel:u=>{i.delete(u),s.delete(u)},process:u=>{if(a=u,r){o=!0;return}r=!0,[n,i]=[i,n],n.forEach(c),n.clear(),r=!1,o&&(o=!1,l.process(u))}};return l}const PPe=40;function YN(e,t){let n=!1,i=!0;const r={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,s=kb.reduce((S,E)=>(S[E]=LPe(o),S),{}),{setup:a,read:c,resolveKeyframes:l,preUpdate:u,update:h,preRender:d,render:f,postRender:p}=s,m=()=>{const S=Wa.useManualTiming?r.timestamp:performance.now();n=!1,Wa.useManualTiming||(r.delta=i?1e3/60:Math.max(Math.min(S-r.timestamp,PPe),1)),r.timestamp=S,r.isProcessing=!0,a.process(r),c.process(r),l.process(r),u.process(r),h.process(r),d.process(r),f.process(r),p.process(r),r.isProcessing=!1,n&&t&&(i=!1,e(m))},y=()=>{n=!0,i=!0,r.isProcessing||e(m)};return{schedule:kb.reduce((S,E)=>{const C=s[E];return S[E]=(O,V=!1,A=!1)=>(n||y(),C.schedule(O,V,A)),S},{}),cancel:S=>{for(let E=0;E<kb.length;E++)s[kb[E]].cancel(S)},state:r,steps:s}}const{schedule:Tn,cancel:Bc,state:Xi,steps:wE}=YN(typeof requestAnimationFrame<"u"?requestAnimationFrame:No,!0);let Xb;function OPe(){Xb=void 0}const wr={now:()=>(Xb===void 0&&wr.set(Xi.isProcessing||Wa.useManualTiming?Xi.timestamp:performance.now()),Xb),set:e=>{Xb=e,queueMicrotask(OPe)}},HN=e=>t=>typeof t=="string"&&t.startsWith(e),jN=HN("--"),GPe=HN("var(--"),xE=e=>GPe(e)?VPe.test(e.split("/*")[0].trim()):!1,VPe=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function KN(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const Qh={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},b0={...Qh,transform:e=>ia(0,1,e)},Zb={...Qh,default:1},_0=e=>Math.round(e*1e5)/1e5,SE=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function FPe(e){return e==null}const APe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,EE=(e,t)=>n=>!!(typeof n=="string"&&APe.test(n)&&n.startsWith(e)||t&&!FPe(n)&&Object.prototype.hasOwnProperty.call(n,t)),JN=(e,t,n)=>i=>{if(typeof i!="string")return i;const[r,o,s,a]=i.match(SE);return{[e]:parseFloat(r),[t]:parseFloat(o),[n]:parseFloat(s),alpha:a!==void 0?parseFloat(a):1}},zPe=e=>ia(0,255,e),TE={...Qh,transform:e=>Math.round(zPe(e))},ql={test:EE("rgb","red"),parse:JN("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:i=1})=>"rgba("+TE.transform(e)+", "+TE.transform(t)+", "+TE.transform(n)+", "+_0(b0.transform(i))+")"};function NPe(e){let t="",n="",i="",r="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),i=e.substring(5,7),r=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),i=e.substring(3,4),r=e.substring(4,5),t+=t,n+=n,i+=i,r+=r),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(i,16),alpha:r?parseInt(r,16)/255:1}}const CE={test:EE("#"),parse:NPe,transform:ql.transform},v0=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Yc=v0("deg"),ra=v0("%"),at=v0("px"),kPe=v0("vh"),XPe=v0("vw"),QN={...ra,parse:e=>ra.parse(e)/100,transform:e=>ra.transform(e*100)},qh={test:EE("hsl","hue"),parse:JN("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:i=1})=>"hsla("+Math.round(e)+", "+ra.transform(_0(t))+", "+ra.transform(_0(n))+", "+_0(b0.transform(i))+")"},ui={test:e=>ql.test(e)||CE.test(e)||qh.test(e),parse:e=>ql.test(e)?ql.parse(e):qh.test(e)?qh.parse(e):CE.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?ql.transform(e):qh.transform(e),getAnimatableNone:e=>{const t=ui.parse(e);return t.alpha=0,ui.transform(t)}},ZPe=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function DPe(e){return isNaN(e)&&typeof e=="string"&&(e.match(SE)?.length||0)+(e.match(ZPe)?.length||0)>0}const qN="number",$N="color",UPe="var",WPe="var(",ek="${}",BPe=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function w0(e){const t=e.toString(),n=[],i={color:[],number:[],var:[]},r=[];let o=0;const a=t.replace(BPe,c=>(ui.test(c)?(i.color.push(o),r.push($N),n.push(ui.parse(c))):c.startsWith(WPe)?(i.var.push(o),r.push(UPe),n.push(c)):(i.number.push(o),r.push(qN),n.push(parseFloat(c))),++o,ek)).split(ek);return{values:n,split:a,indexes:i,types:r}}function tk(e){return w0(e).values}function nk(e){const{split:t,types:n}=w0(e),i=t.length;return r=>{let o="";for(let s=0;s<i;s++)if(o+=t[s],r[s]!==void 0){const a=n[s];a===qN?o+=_0(r[s]):a===$N?o+=ui.transform(r[s]):o+=r[s]}return o}}const YPe=e=>typeof e=="number"?0:ui.test(e)?ui.getAnimatableNone(e):e;function HPe(e){const t=tk(e);return nk(e)(t.map(YPe))}const ys={test:DPe,parse:tk,createTransformer:nk,getAnimatableNone:HPe};function RE(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function jPe({hue:e,saturation:t,lightness:n,alpha:i}){e/=360,t/=100,n/=100;let r=0,o=0,s=0;if(!t)r=o=s=n;else{const a=n<.5?n*(1+t):n+t-n*t,c=2*n-a;r=RE(c,a,e+1/3),o=RE(c,a,e),s=RE(c,a,e-1/3)}return{red:Math.round(r*255),green:Math.round(o*255),blue:Math.round(s*255),alpha:i}}function Db(e,t){return n=>n>0?t:e}const Zn=(e,t,n)=>e+(t-e)*n,IE=(e,t,n)=>{const i=e*e,r=n*(t*t-i)+i;return r<0?0:Math.sqrt(r)},KPe=[CE,ql,qh],JPe=e=>KPe.find(t=>t.test(e));function ik(e){const t=JPe(e);if(Jh(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!t)return!1;let n=t.parse(e);return t===qh&&(n=jPe(n)),n}const rk=(e,t)=>{const n=ik(e),i=ik(t);if(!n||!i)return Db(e,t);const r={...n};return o=>(r.red=IE(n.red,i.red,o),r.green=IE(n.green,i.green,o),r.blue=IE(n.blue,i.blue,o),r.alpha=Zn(n.alpha,i.alpha,o),ql.transform(r))},ME=new Set(["none","hidden"]);function QPe(e,t){return ME.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function qPe(e,t){return n=>Zn(e,t,n)}function LE(e){return typeof e=="number"?qPe:typeof e=="string"?xE(e)?Db:ui.test(e)?rk:tOe:Array.isArray(e)?ok:typeof e=="object"?ui.test(e)?rk:$Pe:Db}function ok(e,t){const n=[...e],i=n.length,r=e.map((o,s)=>LE(o)(o,t[s]));return o=>{for(let s=0;s<i;s++)n[s]=r[s](o);return n}}function $Pe(e,t){const n={...e,...t},i={};for(const r in n)e[r]!==void 0&&t[r]!==void 0&&(i[r]=LE(e[r])(e[r],t[r]));return r=>{for(const o in i)n[o]=i[o](r);return n}}function eOe(e,t){const n=[],i={color:0,var:0,number:0};for(let r=0;r<t.values.length;r++){const o=t.types[r],s=e.indexes[o][i[o]],a=e.values[s]??0;n[r]=a,i[o]++}return n}const tOe=(e,t)=>{const n=ys.createTransformer(t),i=w0(e),r=w0(t);return i.indexes.var.length===r.indexes.var.length&&i.indexes.color.length===r.indexes.color.length&&i.indexes.number.length>=r.indexes.number.length?ME.has(e)&&!r.values.length||ME.has(t)&&!i.values.length?QPe(e,t):m0(ok(eOe(i,r),r.values),n):(Jh(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),Db(e,t))};function sk(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Zn(e,t,n):LE(e)(e,t)}const nOe=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>Tn.update(t,n),stop:()=>Bc(t),now:()=>Xi.isProcessing?Xi.timestamp:wr.now()}},ak=(e,t,n=10)=>{let i="";const r=Math.max(Math.round(t/n),2);for(let o=0;o<r;o++)i+=Math.round(e(o/(r-1))*1e4)/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},Ub=2e4;function PE(e){let t=0;const n=50;let i=e.next(t);for(;!i.done&&t<Ub;)t+=n,i=e.next(t);return t>=Ub?1/0:t}function iOe(e,t=100,n){const i=n({...e,keyframes:[0,t]}),r=Math.min(PE(i),Ub);return{type:"keyframes",ease:o=>i.next(r*o).value/t,duration:Xo(r)}}const rOe=5;function ck(e,t,n){const i=Math.max(t-rOe,0);return ON(n-e(i),t-i)}const Dn={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},OE=.001;function oOe({duration:e=Dn.duration,bounce:t=Dn.bounce,velocity:n=Dn.velocity,mass:i=Dn.mass}){let r,o;Jh(e<=ko(Dn.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let s=1-t;s=ia(Dn.minDamping,Dn.maxDamping,s),e=ia(Dn.minDuration,Dn.maxDuration,Xo(e)),s<1?(r=l=>{const u=l*s,h=u*e,d=u-n,f=GE(l,s),p=Math.exp(-h);return OE-d/f*p},o=l=>{const h=l*s*e,d=h*n+n,f=Math.pow(s,2)*Math.pow(l,2)*e,p=Math.exp(-h),m=GE(Math.pow(l,2),s);return(-r(l)+OE>0?-1:1)*((d-f)*p)/m}):(r=l=>{const u=Math.exp(-l*e),h=(l-n)*e+1;return-OE+u*h},o=l=>{const u=Math.exp(-l*e),h=(n-l)*(e*e);return u*h});const a=5/e,c=aOe(r,o,a);if(e=ko(e),isNaN(c))return{stiffness:Dn.stiffness,damping:Dn.damping,duration:e};{const l=Math.pow(c,2)*i;return{stiffness:l,damping:s*2*Math.sqrt(i*l),duration:e}}}const sOe=12;function aOe(e,t,n){let i=n;for(let r=1;r<sOe;r++)i=i-e(i)/t(i);return i}function GE(e,t){return e*Math.sqrt(1-t*t)}const cOe=["duration","bounce"],lOe=["stiffness","damping","mass"];function lk(e,t){return t.some(n=>e[n]!==void 0)}function uOe(e){let t={velocity:Dn.velocity,stiffness:Dn.stiffness,damping:Dn.damping,mass:Dn.mass,isResolvedFromDuration:!1,...e};if(!lk(e,lOe)&&lk(e,cOe))if(t.velocity=0,e.visualDuration){const n=e.visualDuration,i=2*Math.PI/(n*1.2),r=i*i,o=2*ia(.05,1,1-(e.bounce||0))*Math.sqrt(r);t={...t,mass:Dn.mass,stiffness:r,damping:o}}else{const n=oOe({...e,velocity:0});t={...t,...n,mass:Dn.mass},t.isResolvedFromDuration=!0}return t}function Wb(e=Dn.visualDuration,t=Dn.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:i,restDelta:r}=n;const o=n.keyframes[0],s=n.keyframes[n.keyframes.length-1],a={done:!1,value:o},{stiffness:c,damping:l,mass:u,duration:h,velocity:d,isResolvedFromDuration:f}=uOe({...n,velocity:-Xo(n.velocity||0)}),p=d||0,m=l/(2*Math.sqrt(c*u)),y=s-o,g=Xo(Math.sqrt(c/u)),v=Math.abs(y)<5;i||(i=v?Dn.restSpeed.granular:Dn.restSpeed.default),r||(r=v?Dn.restDelta.granular:Dn.restDelta.default);let S;if(m<1){const C=GE(g,m);S=O=>{const V=Math.exp(-m*g*O);return s-V*((p+m*g*y)/C*Math.sin(C*O)+y*Math.cos(C*O))}}else if(m===1)S=C=>s-Math.exp(-g*C)*(y+(p+g*y)*C);else{const C=g*Math.sqrt(m*m-1);S=O=>{const V=Math.exp(-m*g*O),A=Math.min(C*O,300);return s-V*((p+m*g*y)*Math.sinh(A)+C*y*Math.cosh(A))/C}}const E={calculatedDuration:f&&h||null,next:C=>{const O=S(C);if(f)a.done=C>=h;else{let V=C===0?p:0;m<1&&(V=C===0?ko(p):ck(S,C,O));const A=Math.abs(V)<=i,G=Math.abs(s-O)<=r;a.done=A&&G}return a.value=a.done?s:O,a},toString:()=>{const C=Math.min(PE(E),Ub),O=ak(V=>E.next(C*V).value,C,30);return C+"ms "+O},toTransition:()=>{}};return E}Wb.applyToOptions=e=>{const t=iOe(e,100,Wb);return e.ease=t.ease,e.duration=ko(t.duration),e.type="keyframes",e};function VE({keyframes:e,velocity:t=0,power:n=.8,timeConstant:i=325,bounceDamping:r=10,bounceStiffness:o=500,modifyTarget:s,min:a,max:c,restDelta:l=.5,restSpeed:u}){const h=e[0],d={done:!1,value:h},f=A=>a!==void 0&&A<a||c!==void 0&&A>c,p=A=>a===void 0?c:c===void 0||Math.abs(a-A)<Math.abs(c-A)?a:c;let m=n*t;const y=h+m,g=s===void 0?y:s(y);g!==y&&(m=g-h);const v=A=>-m*Math.exp(-A/i),S=A=>g+v(A),E=A=>{const G=v(A),N=S(A);d.done=Math.abs(G)<=l,d.value=d.done?g:N};let C,O;const V=A=>{f(d.value)&&(C=A,O=Wb({keyframes:[d.value,p(d.value)],velocity:ck(S,A,d.value),damping:r,stiffness:o,restDelta:l,restSpeed:u}))};return V(0),{calculatedDuration:null,next:A=>{let G=!1;return!O&&C===void 0&&(G=!0,E(A),V(A)),C!==void 0&&A>=C?O.next(A-C):(!G&&E(A),d)}}}function hOe(e,t,n){const i=[],r=n||Wa.mix||sk,o=e.length-1;for(let s=0;s<o;s++){let a=r(e[s],e[s+1]);if(t){const c=Array.isArray(t)?t[s]||No:t;a=m0(c,a)}i.push(a)}return i}function dOe(e,t,{clamp:n=!0,ease:i,mixer:r}={}){const o=e.length;if(Ua(o===t.length,"Both input and output ranges must be the same length","range-length"),o===1)return()=>t[0];if(o===2&&t[0]===t[1])return()=>t[1];const s=e[0]===e[1];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=hOe(t,i,r),c=a.length,l=u=>{if(s&&u<e[0])return t[0];let h=0;if(c>1)for(;h<e.length-2&&!(u<e[h+1]);h++);const d=g0(e[h],e[h+1],u);return a[h](d)};return n?u=>l(ia(e[0],e[o-1],u)):l}function fOe(e,t){const n=e[e.length-1];for(let i=1;i<=t;i++){const r=g0(0,t,i);e.push(Zn(n,1,r))}}function pOe(e){const t=[0];return fOe(t,e.length-1),t}function mOe(e,t){return e.map(n=>n*t)}function gOe(e,t){return e.map(()=>t||DN).splice(0,e.length-1)}function $h({duration:e=300,keyframes:t,times:n,ease:i="easeInOut"}){const r=IPe(i)?i.map(BN):BN(i),o={done:!1,value:t[0]},s=mOe(n&&n.length===t.length?n:pOe(t),e),a=dOe(s,t,{ease:Array.isArray(r)?r:gOe(t,r)});return{calculatedDuration:e,next:c=>(o.value=a(c),o.done=c>=e,o)}}const yOe=e=>e!==null;function FE(e,{repeat:t,repeatType:n="loop"},i,r=1){const o=e.filter(yOe),a=r<0||t&&n!=="loop"&&t%2===1?0:o.length-1;return!a||i===void 0?o[a]:i}const bOe={decay:VE,inertia:VE,tween:$h,keyframes:$h,spring:Wb};function uk(e){typeof e.type=="string"&&(e.type=bOe[e.type])}class AE{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const _Oe=e=>e/100;class zE extends AE{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==wr.now()&&this.tick(wr.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;uk(t);const{type:n=$h,repeat:i=0,repeatDelay:r=0,repeatType:o,velocity:s=0}=t;let{keyframes:a}=t;const c=n||$h;process.env.NODE_ENV!=="production"&&c!==$h&&Ua(a.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${a}`,"spring-two-frames"),c!==$h&&typeof a[0]!="number"&&(this.mixKeyframes=m0(_Oe,sk(a[0],a[1])),a=[0,100]);const l=c({...t,keyframes:a});o==="mirror"&&(this.mirroredGenerator=c({...t,keyframes:[...a].reverse(),velocity:-s})),l.calculatedDuration===null&&(l.calculatedDuration=PE(l));const{calculatedDuration:u}=l;this.calculatedDuration=u,this.resolvedDuration=u+r,this.totalDuration=this.resolvedDuration*(i+1)-r,this.generator=l}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:i,totalDuration:r,mixKeyframes:o,mirroredGenerator:s,resolvedDuration:a,calculatedDuration:c}=this;if(this.startTime===null)return i.next(0);const{delay:l=0,keyframes:u,repeat:h,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-r/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const g=this.currentTime-l*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=r);let S=this.currentTime,E=i;if(h){const A=Math.min(this.currentTime,r)/a;let G=Math.floor(A),N=A%1;!N&&A>=1&&(N=1),N===1&&G--,G=Math.min(G,h+1),G%2&&(d==="reverse"?(N=1-N,f&&(N-=f/a)):d==="mirror"&&(E=s)),S=ia(0,1,N)*a}const C=v?{done:!1,value:u[0]}:E.next(S);o&&!v&&(C.value=o(C.value));let{done:O}=C;!v&&c!==null&&(O=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);const V=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&O);return V&&p!==VE&&(C.value=FE(u,this.options,y,this.speed)),m&&m(C.value),V&&this.finish(),C}then(t,n){return this.finished.then(t,n)}get duration(){return Xo(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Xo(t)}get time(){return Xo(this.currentTime)}set time(t){t=ko(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;n&&this.driver&&this.updateTime(wr.now()),this.playbackSpeed=t,n&&this.driver&&(this.time=Xo(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=nOe,startTime:n}=this.options;this.driver||(this.driver=t(r=>this.tick(r))),this.options.onPlay?.();const i=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=i):this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime||(this.startTime=n??i),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(wr.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}function vOe(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const $l=e=>e*180/Math.PI,NE=e=>{const t=$l(Math.atan2(e[1],e[0]));return kE(t)},wOe={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:NE,rotateZ:NE,skewX:e=>$l(Math.atan(e[1])),skewY:e=>$l(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},kE=e=>(e=e%360,e<0&&(e+=360),e),hk=NE,dk=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),fk=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),xOe={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:dk,scaleY:fk,scale:e=>(dk(e)+fk(e))/2,rotateX:e=>kE($l(Math.atan2(e[6],e[5]))),rotateY:e=>kE($l(Math.atan2(-e[2],e[0]))),rotateZ:hk,rotate:hk,skewX:e=>$l(Math.atan(e[4])),skewY:e=>$l(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function XE(e){return e.includes("scale")?1:0}function ZE(e,t){if(!e||e==="none")return XE(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,r;if(n)i=xOe,r=n;else{const a=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=wOe,r=a}if(!r)return XE(t);const o=i[t],s=r[1].split(",").map(EOe);return typeof o=="function"?o(s):s[o]}const SOe=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return ZE(n,t)};function EOe(e){return parseFloat(e.trim())}const ed=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],td=new Set(ed),pk=e=>e===Qh||e===at,TOe=new Set(["x","y","z"]),COe=ed.filter(e=>!TOe.has(e));function ROe(e){const t=[];return COe.forEach(n=>{const i=e.getValue(n);i!==void 0&&(t.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))}),t}const Hc={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>ZE(t,"x"),y:(e,{transform:t})=>ZE(t,"y")};Hc.translateX=Hc.x,Hc.translateY=Hc.y;const eu=new Set;let DE=!1,UE=!1,WE=!1;function mk(){if(UE){const e=Array.from(eu).filter(i=>i.needsMeasurement),t=new Set(e.map(i=>i.element)),n=new Map;t.forEach(i=>{const r=ROe(i);r.length&&(n.set(i,r),i.render())}),e.forEach(i=>i.measureInitialState()),t.forEach(i=>{i.render();const r=n.get(i);r&&r.forEach(([o,s])=>{i.getValue(o)?.set(s)})}),e.forEach(i=>i.measureEndState()),e.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}UE=!1,DE=!1,eu.forEach(e=>e.complete(WE)),eu.clear()}function gk(){eu.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(UE=!0)})}function IOe(){WE=!0,gk(),mk(),WE=!1}class BE{constructor(t,n,i,r,o,s=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=i,this.motionValue=r,this.element=o,this.isAsync=s}scheduleResolve(){this.state="scheduled",this.isAsync?(eu.add(this),DE||(DE=!0,Tn.read(gk),Tn.resolveKeyframes(mk))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:i,motionValue:r}=this;if(t[0]===null){const o=r?.get(),s=t[t.length-1];if(o!==void 0)t[0]=o;else if(i&&n){const a=i.readValue(n,s);a!=null&&(t[0]=a)}t[0]===void 0&&(t[0]=s),r&&o===void 0&&r.set(t[0])}vOe(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),eu.delete(this)}cancel(){this.state==="scheduled"&&(eu.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const MOe=e=>e.startsWith("--");function yk(e,t,n){MOe(t)?e.style.setProperty(t,n):e.style[t]=n}const LOe={};function bk(e,t){const n=PN(e);return()=>LOe[t]??n()}const POe=bk(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),_k=bk(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),x0=([e,t,n,i])=>`cubic-bezier(${e}, ${t}, ${n}, ${i})`,vk={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:x0([0,.65,.55,1]),circOut:x0([.55,0,1,.45]),backIn:x0([.31,.01,.66,-.59]),backOut:x0([.33,1.53,.69,.99])};function wk(e,t){if(e)return typeof e=="function"?_k()?ak(e,t):"ease-out":UN(e)?x0(e):Array.isArray(e)?e.map(n=>wk(n,t)||vk.easeOut):vk[e]}function OOe(e,t,n,{delay:i=0,duration:r=300,repeat:o=0,repeatType:s="loop",ease:a="easeOut",times:c}={},l=void 0){const u={[t]:n};c&&(u.offset=c);const h=wk(a,r);Array.isArray(h)&&(u.easing=h);const d={delay:i,duration:r,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:o+1,direction:s==="reverse"?"alternate":"normal"};return l&&(d.pseudoElement=l),e.animate(u,d)}function xk(e){return typeof e=="function"&&"applyToOptions"in e}function GOe({type:e,...t}){return xk(e)&&_k()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class Sk extends AE{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:n,name:i,keyframes:r,pseudoElement:o,allowFlatten:s=!1,finalKeyframe:a,onComplete:c}=t;this.isPseudoElement=!!o,this.allowFlatten=s,this.options=t,Ua(typeof t.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const l=GOe(t);this.animation=OOe(n,i,r,l,o),l.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!o){const u=FE(r,this.options,a,this.speed);this.updateMotionValue&&this.updateMotionValue(u),yk(n,i,u),this.animation.cancel()}c?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return Xo(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Xo(t)}get time(){return Xo(Number(this.animation.currentTime)||0)}set time(t){const n=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=ko(t),n&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:n,rangeEnd:i,observe:r}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&POe()?(this.animation.timeline=t,n&&(this.animation.rangeStart=n),i&&(this.animation.rangeEnd=i),No):r(this)}}const Ek={anticipate:kN,backInOut:NN,circInOut:ZN};function VOe(e){return e in Ek}function FOe(e){typeof e.ease=="string"&&VOe(e.ease)&&(e.ease=Ek[e.ease])}const YE=10;class AOe extends Sk{constructor(t){FOe(t),uk(t),super(t),t.startTime!==void 0&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:i,onComplete:r,element:o,...s}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const a=new zE({...s,autoplay:!1}),c=Math.max(YE,wr.now()-this.startTime),l=ia(0,YE,c-YE),u=a.sample(c).value,{name:h}=this.options;o&&h&&yk(o,h,u),n.setWithVelocity(a.sample(Math.max(0,c-l)).value,u,l),a.stop()}}const Tk=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(ys.test(e)||e==="0")&&!e.startsWith("url("));function zOe(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function NOe(e,t,n,i){const r=e[0];if(r===null)return!1;if(t==="display"||t==="visibility")return!0;const o=e[e.length-1],s=Tk(r,t),a=Tk(o,t);return Jh(s===a,`You are trying to animate ${t} from "${r}" to "${o}". "${s?o:r}" is not an animatable value.`,"value-not-animatable"),!s||!a?!1:zOe(e)||(n==="spring"||xk(n))&&i}function HE(e){e.duration=0,e.type="keyframes"}const kOe=new Set(["opacity","clipPath","filter","transform"]),XOe=PN(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function ZOe(e){const{motionValue:t,name:n,repeatDelay:i,repeatType:r,damping:o,type:s}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:l}=t.owner.getProps();return XOe()&&n&&kOe.has(n)&&(n!=="transform"||!l)&&!c&&!i&&r!=="mirror"&&o!==0&&s!=="inertia"}const DOe=40;class UOe extends AE{constructor({autoplay:t=!0,delay:n=0,type:i="keyframes",repeat:r=0,repeatDelay:o=0,repeatType:s="loop",keyframes:a,name:c,motionValue:l,element:u,...h}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=wr.now();const d={autoplay:t,delay:n,type:i,repeat:r,repeatDelay:o,repeatType:s,name:c,motionValue:l,element:u,...h},f=u?.KeyframeResolver||BE;this.keyframeResolver=new f(a,(p,m,y)=>this.onKeyframesResolved(p,m,d,!y),c,l,u),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,n,i,r){this.keyframeResolver=void 0;const{name:o,type:s,velocity:a,delay:c,isHandoff:l,onUpdate:u}=i;this.resolvedAt=wr.now(),NOe(t,o,s,a)||((Wa.instantAnimations||!c)&&u?.(FE(t,i,n)),t[0]=t[t.length-1],HE(i),i.repeat=0);const d={startTime:r?this.resolvedAt?this.resolvedAt-this.createdAt>DOe?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...i,keyframes:t},f=!l&&ZOe(d),p=d.motionValue?.owner?.current,m=f?new AOe({...d,element:p}):new zE(d);m.finished.then(()=>{this.notifyFinished()}).catch(No),this.pendingTimeline&&(this.stopTimeline=m.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),IOe()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}function Ck(e,t,n,i=0,r=1){const o=Array.from(e).sort((l,u)=>l.sortNodePosition(u)).indexOf(t),s=e.size,a=(s-1)*i;return typeof n=="function"?n(o,s):r===1?o*i:a-o*i}const WOe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function BOe(e){const t=WOe.exec(e);if(!t)return[,];const[,n,i,r]=t;return[`--${n??i}`,r]}const YOe=4;function Rk(e,t,n=1){Ua(n<=YOe,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[i,r]=BOe(e);if(!i)return;const o=window.getComputedStyle(t).getPropertyValue(i);if(o){const s=o.trim();return IN(s)?parseFloat(s):s}return xE(r)?Rk(r,t,n+1):r}const HOe={type:"spring",stiffness:500,damping:25,restSpeed:10},jOe=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),KOe={type:"keyframes",duration:.8},JOe={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},QOe=(e,{keyframes:t})=>t.length>2?KOe:td.has(e)?e.startsWith("scale")?jOe(t[1]):HOe:JOe,qOe=e=>e!==null;function $Oe(e,{repeat:t,repeatType:n="loop"},i){const r=e.filter(qOe),o=t&&n!=="loop"&&t%2===1?0:r.length-1;return r[o]}function Ik(e,t){if(e?.inherit&&t){const{inherit:n,...i}=e;return{...t,...i}}return e}function jE(e,t){const n=e?.[t]??e?.default??e;return n!==e?Ik(n,e):n}function eGe({when:e,delay:t,delayChildren:n,staggerChildren:i,staggerDirection:r,repeat:o,repeatType:s,repeatDelay:a,from:c,elapsed:l,...u}){return!!Object.keys(u).length}const KE=(e,t,n,i={},r,o)=>s=>{const a=jE(i,e)||{},c=a.delay||i.delay||0;let{elapsed:l=0}=i;l=l-ko(c);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...a,delay:-l,onUpdate:d=>{t.set(d),a.onUpdate&&a.onUpdate(d)},onComplete:()=>{s(),a.onComplete&&a.onComplete()},name:e,motionValue:t,element:o?void 0:r};eGe(a)||Object.assign(u,QOe(e,u)),u.duration&&(u.duration=ko(u.duration)),u.repeatDelay&&(u.repeatDelay=ko(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let h=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(HE(u),u.delay===0&&(h=!0)),(Wa.instantAnimations||Wa.skipAnimations||r?.shouldSkipAnimations)&&(h=!0,HE(u),u.delay=0),u.allowFlatten=!a.type&&!a.ease,h&&!o&&t.get()!==void 0){const d=$Oe(u.keyframes,a);if(d!==void 0){Tn.update(()=>{u.onUpdate(d),u.onComplete()});return}}return a.isSync?new zE(u):new UOe(u)};function Mk(e){const t=[{},{}];return e?.values.forEach((n,i)=>{t[0][i]=n.get(),t[1][i]=n.getVelocity()}),t}function JE(e,t,n,i){if(typeof t=="function"){const[r,o]=Mk(i);t=t(n!==void 0?n:e.custom,r,o)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[r,o]=Mk(i);t=t(n!==void 0?n:e.custom,r,o)}return t}function nd(e,t,n){const i=e.getProps();return JE(i,t,n!==void 0?n:i.custom,e)}const Lk=new Set(["width","height","top","left","right","bottom",...ed]),Pk=30,tGe=e=>!isNaN(parseFloat(e));class nGe{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=i=>{const r=wr.now();if(this.updatedAt!==r&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=wr.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=tGe(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return process.env.NODE_ENV!=="production"&&bE(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new yE);const i=this.events[t].add(n);return t==="change"?()=>{i(),Tn.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,i){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-i}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=wr.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Pk)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Pk);return ON(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function tu(e,t){return new nGe(e,t)}const QE=e=>Array.isArray(e);function iGe(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,tu(n))}function rGe(e){return QE(e)?e[e.length-1]||0:e}function oGe(e,t){const n=nd(e,t);let{transitionEnd:i={},transition:r={},...o}=n||{};o={...o,...i};for(const s in o){const a=rGe(o[s]);iGe(e,s,a)}}const ir=e=>!!(e&&e.getVelocity);function sGe(e){return!!(ir(e)&&e.add)}function qE(e,t){const n=e.getValue("willChange");if(sGe(n))return n.add(t);if(!n&&Wa.WillChange){const i=new Wa.WillChange("auto");e.addValue("willChange",i),i.add(t)}}function $E(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const Ok="data-"+$E("framerAppearId");function Gk(e){return e.props[Ok]}function aGe({protectedKeys:e,needsAnimating:t},n){const i=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,i}function Vk(e,t,{delay:n=0,transitionOverride:i,type:r}={}){let{transition:o,transitionEnd:s,...a}=t;const c=e.getDefaultTransition();o=o?Ik(o,c):c;const l=o?.reduceMotion;i&&(o=i);const u=[],h=r&&e.animationState&&e.animationState.getState()[r];for(const d in a){const f=e.getValue(d,e.latestValues[d]??null),p=a[d];if(p===void 0||h&&aGe(h,d))continue;const m={delay:n,...jE(o||{},d)},y=f.get();if(y!==void 0&&!f.isAnimating&&!Array.isArray(p)&&p===y&&!m.velocity)continue;let g=!1;if(window.MotionHandoffAnimation){const E=Gk(e);if(E){const C=window.MotionHandoffAnimation(E,d,Tn);C!==null&&(m.startTime=C,g=!0)}}qE(e,d);const v=l??e.shouldReduceMotion;f.start(KE(d,f,p,v&&Lk.has(d)?{type:!1}:m,e,g));const S=f.animation;S&&u.push(S)}if(s){const d=()=>Tn.update(()=>{s&&oGe(e,s)});u.length?Promise.all(u).then(d):d()}return u}function eT(e,t,n={}){const i=nd(e,t,n.type==="exit"?e.presenceContext?.custom:void 0);let{transition:r=e.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(r=n.transitionOverride);const o=i?()=>Promise.all(Vk(e,i,n)):()=>Promise.resolve(),s=e.variantChildren&&e.variantChildren.size?(c=0)=>{const{delayChildren:l=0,staggerChildren:u,staggerDirection:h}=r;return cGe(e,t,c,l,u,h,n)}:()=>Promise.resolve(),{when:a}=r;if(a){const[c,l]=a==="beforeChildren"?[o,s]:[s,o];return c().then(()=>l())}else return Promise.all([o(),s(n.delay)])}function cGe(e,t,n=0,i=0,r=0,o=1,s){const a=[];for(const c of e.variantChildren)c.notify("AnimationStart",t),a.push(eT(c,t,{...s,delay:n+(typeof i=="function"?0:i)+Ck(e.variantChildren,c,i,r,o)}).then(()=>c.notify("AnimationComplete",t)));return Promise.all(a)}function lGe(e,t,n={}){e.notify("AnimationStart",t);let i;if(Array.isArray(t)){const r=t.map(o=>eT(e,o,n));i=Promise.all(r)}else if(typeof t=="string")i=eT(e,t,n);else{const r=typeof t=="function"?nd(e,t,n.custom):t;i=Promise.all(Vk(e,r,n))}return i.then(()=>{e.notify("AnimationComplete",t)})}const uGe={test:e=>e==="auto",parse:e=>e},Fk=e=>t=>t.test(e),Ak=[Qh,at,ra,Yc,XPe,kPe,uGe],zk=e=>Ak.find(Fk(e));function hGe(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||LN(e):!0}const dGe=new Set(["brightness","contrast","saturate","opacity"]);function fGe(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[i]=n.match(SE)||[];if(!i)return e;const r=n.replace(i,"");let o=dGe.has(t)?1:0;return i!==n&&(o*=100),t+"("+o+r+")"}const pGe=/\b([a-z-]*)\(.*?\)/gu,tT={...ys,getAnimatableNone:e=>{const t=e.match(pGe);return t?t.map(fGe).join(" "):e}},nT={...ys,getAnimatableNone:e=>{const t=ys.parse(e);return ys.createTransformer(e)(t.map(i=>typeof i=="number"?0:typeof i=="object"?{...i,alpha:1}:i))}},Nk={...Qh,transform:Math.round},iT={borderWidth:at,borderTopWidth:at,borderRightWidth:at,borderBottomWidth:at,borderLeftWidth:at,borderRadius:at,borderTopLeftRadius:at,borderTopRightRadius:at,borderBottomRightRadius:at,borderBottomLeftRadius:at,width:at,maxWidth:at,height:at,maxHeight:at,top:at,right:at,bottom:at,left:at,inset:at,insetBlock:at,insetBlockStart:at,insetBlockEnd:at,insetInline:at,insetInlineStart:at,insetInlineEnd:at,padding:at,paddingTop:at,paddingRight:at,paddingBottom:at,paddingLeft:at,paddingBlock:at,paddingBlockStart:at,paddingBlockEnd:at,paddingInline:at,paddingInlineStart:at,paddingInlineEnd:at,margin:at,marginTop:at,marginRight:at,marginBottom:at,marginLeft:at,marginBlock:at,marginBlockStart:at,marginBlockEnd:at,marginInline:at,marginInlineStart:at,marginInlineEnd:at,fontSize:at,backgroundPositionX:at,backgroundPositionY:at,...{rotate:Yc,rotateX:Yc,rotateY:Yc,rotateZ:Yc,scale:Zb,scaleX:Zb,scaleY:Zb,scaleZ:Zb,skew:Yc,skewX:Yc,skewY:Yc,distance:at,translateX:at,translateY:at,translateZ:at,x:at,y:at,z:at,perspective:at,transformPerspective:at,opacity:b0,originX:QN,originY:QN,originZ:at},zIndex:Nk,fillOpacity:b0,strokeOpacity:b0,numOctaves:Nk},mGe={...iT,color:ui,backgroundColor:ui,outlineColor:ui,fill:ui,stroke:ui,borderColor:ui,borderTopColor:ui,borderRightColor:ui,borderBottomColor:ui,borderLeftColor:ui,filter:tT,WebkitFilter:tT,mask:nT,WebkitMask:nT},kk=e=>mGe[e],gGe=new Set([tT,nT]);function Xk(e,t){let n=kk(e);return gGe.has(n)||(n=ys),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const yGe=new Set(["auto","none","0"]);function bGe(e,t,n){let i=0,r;for(;i<e.length&&!r;){const o=e[i];typeof o=="string"&&!yGe.has(o)&&w0(o).values.length&&(r=e[i]),i++}if(r&&n)for(const o of t)e[o]=Xk(n,r)}class _Ge extends BE{constructor(t,n,i,r,o){super(t,n,i,r,o,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:i}=this;if(!n||!n.current)return;super.readKeyframes();for(let u=0;u<t.length;u++){let h=t[u];if(typeof h=="string"&&(h=h.trim(),xE(h))){const d=Rk(h,n.current);d!==void 0&&(t[u]=d),u===t.length-1&&(this.finalKeyframe=h)}}if(this.resolveNoneKeyframes(),!Lk.has(i)||t.length!==2)return;const[r,o]=t,s=zk(r),a=zk(o),c=KN(r),l=KN(o);if(c!==l&&Hc[i]){this.needsMeasurement=!0;return}if(s!==a)if(pk(s)&&pk(a))for(let u=0;u<t.length;u++){const h=t[u];typeof h=="string"&&(t[u]=parseFloat(h))}else Hc[i]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,i=[];for(let r=0;r<t.length;r++)(t[r]===null||hGe(t[r]))&&i.push(r);i.length&&bGe(t,i,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:i}=this;if(!t||!t.current)return;i==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Hc[i](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const r=n[n.length-1];r!==void 0&&t.getValue(i,r).jump(r,!1)}measureEndState(){const{element:t,name:n,unresolvedKeyframes:i}=this;if(!t||!t.current)return;const r=t.getValue(n);r&&r.jump(this.measuredOrigin,!1);const o=i.length-1,s=i[o];i[o]=Hc[n](t.measureViewportBox(),window.getComputedStyle(t.current)),s!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=s),this.removedTransforms?.length&&this.removedTransforms.forEach(([a,c])=>{t.getValue(a).set(c)}),this.resolveNoneKeyframes()}}const vGe=new Set(["opacity","clipPath","filter","transform"]);function Zk(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let i=document;const r=n?.[e]??i.querySelectorAll(e);return r?Array.from(r):[]}return Array.from(e).filter(i=>i!=null)}const Dk=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function wGe(e){return MN(e)&&"offsetHeight"in e}const{schedule:rT}=YN(queueMicrotask,!1),bs={x:!1,y:!1};function Uk(){return bs.x||bs.y}function xGe(e){return e==="x"||e==="y"?bs[e]?null:(bs[e]=!0,()=>{bs[e]=!1}):bs.x||bs.y?null:(bs.x=bs.y=!0,()=>{bs.x=bs.y=!1})}function Wk(e,t){const n=Zk(e),i=new AbortController,r={passive:!0,...t,signal:i.signal};return[n,r,()=>i.abort()]}function SGe(e){return!(e.pointerType==="touch"||Uk())}function EGe(e,t,n={}){const[i,r,o]=Wk(e,n);return i.forEach(s=>{let a=!1,c=!1,l;const u=()=>{s.removeEventListener("pointerleave",p)},h=y=>{l&&(l(y),l=void 0),u()},d=y=>{a=!1,window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",d),c&&(c=!1,h(y))},f=()=>{a=!0,window.addEventListener("pointerup",d,r),window.addEventListener("pointercancel",d,r)},p=y=>{if(y.pointerType!=="touch"){if(a){c=!0;return}h(y)}},m=y=>{if(!SGe(y))return;c=!1;const g=t(s,y);typeof g=="function"&&(l=g,s.addEventListener("pointerleave",p,r))};s.addEventListener("pointerenter",m,r),s.addEventListener("pointerdown",f,r)}),o}const Bk=(e,t)=>t?e===t?!0:Bk(e,t.parentElement):!1,oT=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,TGe=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function CGe(e){return TGe.has(e.tagName)||e.isContentEditable===!0}const RGe=new Set(["INPUT","SELECT","TEXTAREA"]);function IGe(e){return RGe.has(e.tagName)||e.isContentEditable===!0}const Bb=new WeakSet;function Yk(e){return t=>{t.key==="Enter"&&e(t)}}function sT(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const MGe=(e,t)=>{const n=e.currentTarget;if(!n)return;const i=Yk(()=>{if(Bb.has(n))return;sT(n,"down");const r=Yk(()=>{sT(n,"up")}),o=()=>sT(n,"cancel");n.addEventListener("keyup",r,t),n.addEventListener("blur",o,t)});n.addEventListener("keydown",i,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",i),t)};function Hk(e){return oT(e)&&!Uk()}const jk=new WeakSet;function LGe(e,t,n={}){const[i,r,o]=Wk(e,n),s=a=>{const c=a.currentTarget;if(!Hk(a)||jk.has(a))return;Bb.add(c),n.stopPropagation&&jk.add(a);const l=t(c,a),u=(f,p)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",d),Bb.has(c)&&Bb.delete(c),Hk(f)&&typeof l=="function"&&l(f,{success:p})},h=f=>{u(f,c===window||c===document||n.useGlobalTarget||Bk(c,f.target))},d=f=>{u(f,!1)};window.addEventListener("pointerup",h,r),window.addEventListener("pointercancel",d,r)};return i.forEach(a=>{(n.useGlobalTarget?window:a).addEventListener("pointerdown",s,r),wGe(a)&&(a.addEventListener("focus",l=>MGe(l,r)),!CGe(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),o}function aT(e){return MN(e)&&"ownerSVGElement"in e}const Yb=new WeakMap;let Hb;const Kk=(e,t,n)=>(i,r)=>r&&r[0]?r[0][e+"Size"]:aT(i)&&"getBBox"in i?i.getBBox()[t]:i[n],PGe=Kk("inline","width","offsetWidth"),OGe=Kk("block","height","offsetHeight");function GGe({target:e,borderBoxSize:t}){Yb.get(e)?.forEach(n=>{n(e,{get width(){return PGe(e,t)},get height(){return OGe(e,t)}})})}function VGe(e){e.forEach(GGe)}function FGe(){typeof ResizeObserver>"u"||(Hb=new ResizeObserver(VGe))}function AGe(e,t){Hb||FGe();const n=Zk(e);return n.forEach(i=>{let r=Yb.get(i);r||(r=new Set,Yb.set(i,r)),r.add(t),Hb?.observe(i)}),()=>{n.forEach(i=>{const r=Yb.get(i);r?.delete(t),r?.size||Hb?.unobserve(i)})}}const jb=new Set;let id;function zGe(){id=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};jb.forEach(t=>t(e))},window.addEventListener("resize",id)}function NGe(e){return jb.add(e),id||zGe(),()=>{jb.delete(e),!jb.size&&typeof id=="function"&&(window.removeEventListener("resize",id),id=void 0)}}function Jk(e,t){return typeof e=="function"?NGe(e):AGe(e,t)}function kGe(e){return aT(e)&&e.tagName==="svg"}const XGe=[...Ak,ui,ys],ZGe=e=>XGe.find(Fk(e)),Qk=()=>({translate:0,scale:1,origin:0,originPoint:0}),rd=()=>({x:Qk(),y:Qk()}),qk=()=>({min:0,max:0}),_i=()=>({x:qk(),y:qk()}),DGe=new WeakMap;function Kb(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function S0(e){return typeof e=="string"||Array.isArray(e)}const cT=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],lT=["initial",...cT];function Jb(e){return Kb(e.animate)||lT.some(t=>S0(e[t]))}function $k(e){return!!(Jb(e)||e.variants)}function UGe(e,t,n){for(const i in t){const r=t[i],o=n[i];if(ir(r))e.addValue(i,r);else if(ir(o))e.addValue(i,tu(r,{owner:e}));else if(o!==r)if(e.hasValue(i)){const s=e.getValue(i);s.liveStyle===!0?s.jump(r):s.hasAnimated||s.set(r)}else{const s=e.getStaticValue(i);e.addValue(i,tu(s!==void 0?s:r,{owner:e}))}}for(const i in n)t[i]===void 0&&e.removeValue(i);return t}const uT={current:null},eX={current:!1},WGe=typeof window<"u";function BGe(){if(eX.current=!0,!!WGe)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>uT.current=e.matches;e.addEventListener("change",t),t()}else uT.current=!1}const tX=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Qb={};function nX(e){Qb=e}function YGe(){return Qb}class HGe{scrapeMotionValuesFromProps(t,n,i){return{}}constructor({parent:t,props:n,presenceContext:i,reducedMotionConfig:r,skipAnimations:o,blockInitialAnimation:s,visualState:a},c={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=BE,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const f=wr.now();this.renderScheduledAt<f&&(this.renderScheduledAt=f,Tn.render(this.render,!1,!0))};const{latestValues:l,renderState:u}=a;this.latestValues=l,this.baseTarget={...l},this.initialValues=n.initial?{...l}:{},this.renderState=u,this.parent=t,this.props=n,this.presenceContext=i,this.depth=t?t.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=o,this.options=c,this.blockInitialAnimation=!!s,this.isControllingVariants=Jb(n),this.isVariantNode=$k(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:h,...d}=this.scrapeMotionValuesFromProps(n,{},this);for(const f in d){const p=d[f];l[f]!==void 0&&ir(p)&&p.set(l[f])}}mount(t){if(this.hasBeenMounted)for(const n in this.initialValues)this.values.get(n)?.jump(this.initialValues[n]),this.latestValues[n]=this.initialValues[n];this.current=t,DGe.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,i)=>this.bindToMotionValue(i,n)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(eX.current||BGe(),this.shouldReduceMotion=uT.current),process.env.NODE_ENV!=="production"&&bE(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected.","reduced-motion-disabled"),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),Bc(this.notifyUpdate),Bc(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),n.accelerate&&vGe.has(t)&&this.current instanceof HTMLElement){const{factory:s,keyframes:a,times:c,ease:l,duration:u}=n.accelerate,h=new Sk({element:this.current,name:t,keyframes:a,times:c,ease:l,duration:ko(u)}),d=s(h);this.valueSubscriptions.set(t,()=>{d(),h.cancel()});return}const i=td.has(t);i&&this.onBindTransform&&this.onBindTransform();const r=n.on("change",s=>{this.latestValues[t]=s,this.props.onUpdate&&Tn.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let o;typeof window<"u"&&window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{r(),o&&o(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Qb){const n=Qb[t];if(!n)continue;const{isEnabled:i,Feature:r}=n;if(!this.features[t]&&r&&i(this.props)&&(this.features[t]=new r(this)),this.features[t]){const o=this.features[t];o.isMounted?o.update():(o.mount(),o.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):_i()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let i=0;i<tX.length;i++){const r=tX[i];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);const o="on"+r,s=t[o];s&&(this.propEventSubscriptions[r]=this.on(r,s))}this.prevMotionValues=UGe(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const i=this.values.get(t);n!==i&&(i&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let i=this.values.get(t);return i===void 0&&n!==void 0&&(i=tu(n===null?void 0:n,{owner:this}),this.addValue(t,i)),i}readValue(t,n){let i=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return i!=null&&(typeof i=="string"&&(IN(i)||LN(i))?i=parseFloat(i):!ZGe(i)&&ys.test(n)&&(i=Xk(t,n)),this.setBaseTarget(t,ir(i)?i.get():i)),ir(i)?i.get():i}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){const{initial:n}=this.props;let i;if(typeof n=="string"||typeof n=="object"){const o=JE(this.props,n,this.presenceContext?.custom);o&&(i=o[t])}if(n&&i!==void 0)return i;const r=this.getBaseTargetFromProps(this.props,t);return r!==void 0&&!ir(r)?r:this.initialValues[t]!==void 0&&i===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new yE),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){rT.render(this.render)}}class iX extends HGe{constructor(){super(...arguments),this.KeyframeResolver=_Ge}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){const i=t.style;return i?i[n]:void 0}removeValueFromRenderState(t,{vars:n,style:i}){delete n[t],delete i[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;ir(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class jc{constructor(t){this.isMounted=!1,this.node=t}update(){}}function rX({top:e,left:t,right:n,bottom:i}){return{x:{min:t,max:n},y:{min:e,max:i}}}function jGe({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function KGe(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),i=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:i.y,right:i.x}}function hT(e){return e===void 0||e===1}function dT({scale:e,scaleX:t,scaleY:n}){return!hT(e)||!hT(t)||!hT(n)}function nu(e){return dT(e)||oX(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function oX(e){return sX(e.x)||sX(e.y)}function sX(e){return e&&e!=="0%"}function qb(e,t,n){const i=e-n,r=t*i;return n+r}function aX(e,t,n,i,r){return r!==void 0&&(e=qb(e,r,i)),qb(e,n,i)+t}function fT(e,t=0,n=1,i,r){e.min=aX(e.min,t,n,i,r),e.max=aX(e.max,t,n,i,r)}function cX(e,{x:t,y:n}){fT(e.x,t.translate,t.scale,t.originPoint),fT(e.y,n.translate,n.scale,n.originPoint)}const lX=.999999999999,uX=1.0000000000001;function JGe(e,t,n,i=!1){const r=n.length;if(!r)return;t.x=t.y=1;let o,s;for(let a=0;a<r;a++){o=n[a],s=o.projectionDelta;const{visualElement:c}=o.options;c&&c.props.style&&c.props.style.display==="contents"||(i&&o.options.layoutScroll&&o.scroll&&o!==o.root&&sd(e,{x:-o.scroll.offset.x,y:-o.scroll.offset.y}),s&&(t.x*=s.x.scale,t.y*=s.y.scale,cX(e,s)),i&&nu(o.latestValues)&&sd(e,o.latestValues))}t.x<uX&&t.x>lX&&(t.x=1),t.y<uX&&t.y>lX&&(t.y=1)}function od(e,t){e.min=e.min+t,e.max=e.max+t}function hX(e,t,n,i,r=.5){const o=Zn(e.min,e.max,r);fT(e,t,n,o,i)}function dX(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function sd(e,t){hX(e.x,dX(t.x,e.x),t.scaleX,t.scale,t.originX),hX(e.y,dX(t.y,e.y),t.scaleY,t.scale,t.originY)}function fX(e,t){return rX(KGe(e.getBoundingClientRect(),t))}function QGe(e,t,n){const i=fX(e,n),{scroll:r}=t;return r&&(od(i.x,r.offset.x),od(i.y,r.offset.y)),i}const qGe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},$Ge=ed.length;function eVe(e,t,n){let i="",r=!0;for(let o=0;o<$Ge;o++){const s=ed[o],a=e[s];if(a===void 0)continue;let c=!0;if(typeof a=="number")c=a===(s.startsWith("scale")?1:0);else{const l=parseFloat(a);c=s.startsWith("scale")?l===1:l===0}if(!c||n){const l=Dk(a,iT[s]);if(!c){r=!1;const u=qGe[s]||s;i+=`${u}(${l}) `}n&&(t[s]=l)}}return i=i.trim(),n?i=n(t,r?"":i):r&&(i="none"),i}function pT(e,t,n){const{style:i,vars:r,transformOrigin:o}=e;let s=!1,a=!1;for(const c in t){const l=t[c];if(td.has(c)){s=!0;continue}else if(jN(c)){r[c]=l;continue}else{const u=Dk(l,iT[c]);c.startsWith("origin")?(a=!0,o[c]=u):i[c]=u}}if(t.transform||(s||n?i.transform=eVe(t,e.transform,n):i.transform&&(i.transform="none")),a){const{originX:c="50%",originY:l="50%",originZ:u=0}=o;i.transformOrigin=`${c} ${l} ${u}`}}function pX(e,{style:t,vars:n},i,r){const o=e.style;let s;for(s in t)o[s]=t[s];r?.applyProjectionStyles(o,i);for(s in n)o.setProperty(s,n[s])}function mX(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const E0={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(at.test(e))e=parseFloat(e);else return e;const n=mX(e,t.target.x),i=mX(e,t.target.y);return`${n}% ${i}%`}},tVe={correct:(e,{treeScale:t,projectionDelta:n})=>{const i=e,r=ys.parse(e);if(r.length>5)return i;const o=ys.createTransformer(e),s=typeof r[0]!="number"?1:0,a=n.x.scale*t.x,c=n.y.scale*t.y;r[0+s]/=a,r[1+s]/=c;const l=Zn(a,c,.5);return typeof r[2+s]=="number"&&(r[2+s]/=l),typeof r[3+s]=="number"&&(r[3+s]/=l),o(r)}},mT={borderRadius:{...E0,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:E0,borderTopRightRadius:E0,borderBottomLeftRadius:E0,borderBottomRightRadius:E0,boxShadow:tVe};function gX(e,{layout:t,layoutId:n}){return td.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!mT[e]||e==="opacity")}function gT(e,t,n){const i=e.style,r=t?.style,o={};if(!i)return o;for(const s in i)(ir(i[s])||r&&ir(r[s])||gX(s,e)||n?.getValue(s)?.liveStyle!==void 0)&&(o[s]=i[s]);return o}function nVe(e){return window.getComputedStyle(e)}class iVe extends iX{constructor(){super(...arguments),this.type="html",this.renderInstance=pX}readValueFromInstance(t,n){if(td.has(n))return this.projection?.isProjecting?XE(n):SOe(t,n);{const i=nVe(t),r=(jN(n)?i.getPropertyValue(n):i[n])||0;return typeof r=="string"?r.trim():r}}measureInstanceViewportBox(t,{transformPagePoint:n}){return fX(t,n)}build(t,n,i){pT(t,n,i.transformTemplate)}scrapeMotionValuesFromProps(t,n,i){return gT(t,n,i)}}const rVe={offset:"stroke-dashoffset",array:"stroke-dasharray"},oVe={offset:"strokeDashoffset",array:"strokeDasharray"};function sVe(e,t,n=1,i=0,r=!0){e.pathLength=1;const o=r?rVe:oVe;e[o.offset]=`${-i}`,e[o.array]=`${t} ${n}`}const aVe=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function yX(e,{attrX:t,attrY:n,attrScale:i,pathLength:r,pathSpacing:o=1,pathOffset:s=0,...a},c,l,u){if(pT(e,a,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:h,style:d}=e;h.transform&&(d.transform=h.transform,delete h.transform),(d.transform||h.transformOrigin)&&(d.transformOrigin=h.transformOrigin??"50% 50%",delete h.transformOrigin),d.transform&&(d.transformBox=u?.transformBox??"fill-box",delete h.transformBox);for(const f of aVe)h[f]!==void 0&&(d[f]=h[f],delete h[f]);t!==void 0&&(h.x=t),n!==void 0&&(h.y=n),i!==void 0&&(h.scale=i),r!==void 0&&sVe(h,r,o,s,!1)}const bX=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),_X=e=>typeof e=="string"&&e.toLowerCase()==="svg";function cVe(e,t,n,i){pX(e,t,void 0,i);for(const r in t.attrs)e.setAttribute(bX.has(r)?r:$E(r),t.attrs[r])}function vX(e,t,n){const i=gT(e,t,n);for(const r in e)if(ir(e[r])||ir(t[r])){const o=ed.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;i[o]=e[r]}return i}class lVe extends iX{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=_i}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(td.has(n)){const i=kk(n);return i&&i.default||0}return n=bX.has(n)?n:$E(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,i){return vX(t,n,i)}build(t,n,i){yX(t,n,this.isSVGTag,i.transformTemplate,i.style)}renderInstance(t,n,i,r){cVe(t,n,i,r)}mount(t){this.isSVGTag=_X(t.tagName),super.mount(t)}}const uVe=lT.length;function wX(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?wX(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<uVe;n++){const i=lT[n],r=e.props[i];(S0(r)||r===!1)&&(t[i]=r)}return t}function xX(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let i=0;i<n;i++)if(t[i]!==e[i])return!1;return!0}const hVe=[...cT].reverse(),dVe=cT.length;function fVe(e){return t=>Promise.all(t.map(({animation:n,options:i})=>lGe(e,n,i)))}function pVe(e){let t=fVe(e),n=SX(),i=!0,r=!1;const o=l=>(u,h)=>{const d=nd(e,h,l==="exit"?e.presenceContext?.custom:void 0);if(d){const{transition:f,transitionEnd:p,...m}=d;u={...u,...m,...p}}return u};function s(l){t=l(e)}function a(l){const{props:u}=e,h=wX(e.parent)||{},d=[],f=new Set;let p={},m=1/0;for(let g=0;g<dVe;g++){const v=hVe[g],S=n[v],E=u[v]!==void 0?u[v]:h[v],C=S0(E),O=v===l?S.isActive:null;O===!1&&(m=g);let V=E===h[v]&&E!==u[v]&&C;if(V&&(i||r)&&e.manuallyAnimateOnMount&&(V=!1),S.protectedKeys={...p},!S.isActive&&O===null||!E&&!S.prevProp||Kb(E)||typeof E=="boolean")continue;if(v==="exit"&&S.isActive&&O!==!0){S.prevResolvedValues&&(p={...p,...S.prevResolvedValues});continue}const A=mVe(S.prevProp,E);let G=A||v===l&&S.isActive&&!V&&C||g>m&&C,N=!1;const k=Array.isArray(E)?E:[E];let P=k.reduce(o(v),{});O===!1&&(P={});const{prevResolvedValues:w={}}=S,x={...w,...P},I=Y=>{G=!0,f.has(Y)&&(N=!0,f.delete(Y)),S.needsAnimating[Y]=!0;const H=e.getValue(Y);H&&(H.liveStyle=!1)};for(const Y in x){const H=P[Y],J=w[Y];if(p.hasOwnProperty(Y))continue;let z=!1;QE(H)&&QE(J)?z=!xX(H,J):z=H!==J,z?H!=null?I(Y):f.add(Y):H!==void 0&&f.has(Y)?I(Y):S.protectedKeys[Y]=!0}S.prevProp=E,S.prevResolvedValues=P,S.isActive&&(p={...p,...P}),(i||r)&&e.blockInitialAnimation&&(G=!1);const X=V&&A;G&&(!X||N)&&d.push(...k.map(Y=>{const H={type:v};if(typeof Y=="string"&&(i||r)&&!X&&e.manuallyAnimateOnMount&&e.parent){const{parent:J}=e,z=nd(J,Y);if(J.enteringChildren&&z){const{delayChildren:W}=z.transition||{};H.delay=Ck(J.enteringChildren,e,W)}}return{animation:Y,options:H}}))}if(f.size){const g={};if(typeof u.initial!="boolean"){const v=nd(e,Array.isArray(u.initial)?u.initial[0]:u.initial);v&&v.transition&&(g.transition=v.transition)}f.forEach(v=>{const S=e.getBaseTarget(v),E=e.getValue(v);E&&(E.liveStyle=!0),g[v]=S??null}),d.push({animation:g})}let y=!!d.length;return i&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(y=!1),i=!1,r=!1,y?t(d):Promise.resolve()}function c(l,u){if(n[l].isActive===u)return Promise.resolve();e.variantChildren?.forEach(d=>d.animationState?.setActive(l,u)),n[l].isActive=u;const h=a(l);for(const d in n)n[d].protectedKeys={};return h}return{animateChanges:a,setActive:c,setAnimateFunction:s,getState:()=>n,reset:()=>{n=SX(),r=!0}}}function mVe(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!xX(t,e):!1}function iu(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function SX(){return{animate:iu(!0),whileInView:iu(),whileHover:iu(),whileTap:iu(),whileDrag:iu(),whileFocus:iu(),exit:iu()}}function EX(e,t){e.min=t.min,e.max=t.max}function _s(e,t){EX(e.x,t.x),EX(e.y,t.y)}function TX(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const CX=1e-4,gVe=1-CX,yVe=1+CX,RX=.01,bVe=0-RX,_Ve=0+RX;function xr(e){return e.max-e.min}function vVe(e,t,n){return Math.abs(e-t)<=n}function IX(e,t,n,i=.5){e.origin=i,e.originPoint=Zn(t.min,t.max,e.origin),e.scale=xr(n)/xr(t),e.translate=Zn(n.min,n.max,e.origin)-e.originPoint,(e.scale>=gVe&&e.scale<=yVe||isNaN(e.scale))&&(e.scale=1),(e.translate>=bVe&&e.translate<=_Ve||isNaN(e.translate))&&(e.translate=0)}function T0(e,t,n,i){IX(e.x,t.x,n.x,i?i.originX:void 0),IX(e.y,t.y,n.y,i?i.originY:void 0)}function MX(e,t,n){e.min=n.min+t.min,e.max=e.min+xr(t)}function wVe(e,t,n){MX(e.x,t.x,n.x),MX(e.y,t.y,n.y)}function LX(e,t,n){e.min=t.min-n.min,e.max=e.min+xr(t)}function $b(e,t,n){LX(e.x,t.x,n.x),LX(e.y,t.y,n.y)}function PX(e,t,n,i,r){return e-=t,e=qb(e,1/n,i),r!==void 0&&(e=qb(e,1/r,i)),e}function xVe(e,t=0,n=1,i=.5,r,o=e,s=e){if(ra.test(t)&&(t=parseFloat(t),t=Zn(s.min,s.max,t/100)-s.min),typeof t!="number")return;let a=Zn(o.min,o.max,i);e===o&&(a-=t),e.min=PX(e.min,t,n,a,r),e.max=PX(e.max,t,n,a,r)}function OX(e,t,[n,i,r],o,s){xVe(e,t[n],t[i],t[r],t.scale,o,s)}const SVe=["x","scaleX","originX"],EVe=["y","scaleY","originY"];function GX(e,t,n,i){OX(e.x,t,SVe,n?n.x:void 0,i?i.x:void 0),OX(e.y,t,EVe,n?n.y:void 0,i?i.y:void 0)}function VX(e){return e.translate===0&&e.scale===1}function FX(e){return VX(e.x)&&VX(e.y)}function AX(e,t){return e.min===t.min&&e.max===t.max}function TVe(e,t){return AX(e.x,t.x)&&AX(e.y,t.y)}function zX(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function NX(e,t){return zX(e.x,t.x)&&zX(e.y,t.y)}function kX(e){return xr(e.x)/xr(e.y)}function XX(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function oa(e){return[e("x"),e("y")]}function CVe(e,t,n){let i="";const r=e.x.translate/t.x,o=e.y.translate/t.y,s=n?.z||0;if((r||o||s)&&(i=`translate3d(${r}px, ${o}px, ${s}px) `),(t.x!==1||t.y!==1)&&(i+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:l,rotate:u,rotateX:h,rotateY:d,skewX:f,skewY:p}=n;l&&(i=`perspective(${l}px) ${i}`),u&&(i+=`rotate(${u}deg) `),h&&(i+=`rotateX(${h}deg) `),d&&(i+=`rotateY(${d}deg) `),f&&(i+=`skewX(${f}deg) `),p&&(i+=`skewY(${p}deg) `)}const a=e.x.scale*t.x,c=e.y.scale*t.y;return(a!==1||c!==1)&&(i+=`scale(${a}, ${c})`),i||"none"}const ZX=["TopLeft","TopRight","BottomLeft","BottomRight"],RVe=ZX.length,DX=e=>typeof e=="string"?parseFloat(e):e,UX=e=>typeof e=="number"||at.test(e);function IVe(e,t,n,i,r,o){r?(e.opacity=Zn(0,n.opacity??1,MVe(i)),e.opacityExit=Zn(t.opacity??1,0,LVe(i))):o&&(e.opacity=Zn(t.opacity??1,n.opacity??1,i));for(let s=0;s<RVe;s++){const a=`border${ZX[s]}Radius`;let c=WX(t,a),l=WX(n,a);if(c===void 0&&l===void 0)continue;c||(c=0),l||(l=0),c===0||l===0||UX(c)===UX(l)?(e[a]=Math.max(Zn(DX(c),DX(l),i),0),(ra.test(l)||ra.test(c))&&(e[a]+="%")):e[a]=l}(t.rotate||n.rotate)&&(e.rotate=Zn(t.rotate||0,n.rotate||0,i))}function WX(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const MVe=BX(0,.5,XN),LVe=BX(.5,.95,No);function BX(e,t,n){return i=>i<e?0:i>t?1:n(g0(e,t,i))}function PVe(e,t,n){const i=ir(e)?e:tu(e);return i.start(KE("",i,t,n)),i.animation}function C0(e,t,n,i={passive:!0}){return e.addEventListener(t,n,i),()=>e.removeEventListener(t,n)}const OVe=(e,t)=>e.depth-t.depth;class GVe{constructor(){this.children=[],this.isDirty=!1}add(t){mE(this.children,t),this.isDirty=!0}remove(t){Nb(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(OVe),this.isDirty=!1,this.children.forEach(t)}}function VVe(e,t){const n=wr.now(),i=({timestamp:r})=>{const o=r-n;o>=t&&(Bc(i),e(o-t))};return Tn.setup(i,!0),()=>Bc(i)}function e1(e){return ir(e)?e.get():e}class FVe{constructor(){this.members=[]}add(t){mE(this.members,t);for(let n=this.members.length-1;n>=0;n--){const i=this.members[n];if(i===t||i===this.lead||i===this.prevLead)continue;const r=i.instance;(!r||r.isConnected===!1)&&!i.snapshot&&(Nb(this.members,i),i.unmount())}t.scheduleRender()}remove(t){if(Nb(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){for(let n=this.members.indexOf(t)-1;n>=0;n--){const i=this.members[n];if(i.isPresent!==!1&&i.instance?.isConnected!==!1)return this.promote(i),!0}return!1}promote(t,n){const i=this.lead;if(t!==i&&(this.prevLead=i,this.lead=t,t.show(),i)){i.updateSnapshot(),t.scheduleRender();const{layoutDependency:r}=i.options,{layoutDependency:o}=t.options;(r===void 0||r!==o)&&(t.resumeFrom=i,n&&(i.preserveOpacity=!0),i.snapshot&&(t.snapshot=i.snapshot,t.snapshot.latestValues=i.animationValues||i.latestValues),t.root?.isUpdating&&(t.isLayoutDirty=!0)),t.options.crossfade===!1&&i.hide()}}exitAnimationComplete(){this.members.forEach(t=>{t.options.onExitComplete?.(),t.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(t=>t.instance&&t.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}}const t1={hasAnimatedSinceResize:!0,hasEverUpdated:!1},yT=["","X","Y","Z"],AVe=1e3;let zVe=0;function bT(e,t,n,i){const{latestValues:r}=t;r[e]&&(n[e]=r[e],t.setStaticValue(e,0),i&&(i[e]=0))}function YX(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=Gk(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:r,layoutId:o}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",Tn,!(r||o))}const{parent:i}=e;i&&!i.hasCheckedOptimisedAppear&&YX(i)}function HX({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:i,resetTransform:r}){return class{constructor(s={},a=t?.()){this.id=zVe++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(XVe),this.nodes.forEach(WVe),this.nodes.forEach(BVe),this.nodes.forEach(ZVe)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=s,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new GVe)}addEventListener(s,a){return this.eventHandlers.has(s)||this.eventHandlers.set(s,new yE),this.eventHandlers.get(s).add(a)}notifyListeners(s,...a){const c=this.eventHandlers.get(s);c&&c.notify(...a)}hasListeners(s){return this.eventHandlers.has(s)}mount(s){if(this.instance)return;this.isSVG=aT(s)&&!kGe(s),this.instance=s;const{layoutId:a,layout:c,visualElement:l}=this.options;if(l&&!l.current&&l.mount(s),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(c||a)&&(this.isLayoutDirty=!0),e){let u,h=0;const d=()=>this.root.updateBlockedByResize=!1;Tn.read(()=>{h=window.innerWidth}),e(s,()=>{const f=window.innerWidth;f!==h&&(h=f,this.root.updateBlockedByResize=!0,u&&u(),u=VVe(d,250),t1.hasAnimatedSinceResize&&(t1.hasAnimatedSinceResize=!1,this.nodes.forEach(JX)))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&l&&(a||c)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:h,hasRelativeLayoutChanged:d,layout:f})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const p=this.options.transition||l.getDefaultTransition()||JVe,{onLayoutAnimationStart:m,onLayoutAnimationComplete:y}=l.getProps(),g=!this.targetLayout||!NX(this.targetLayout,f),v=!h&&d;if(this.options.layoutRoot||this.resumeFrom||v||h&&(g||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const S={...jE(p,"layout"),onPlay:m,onComplete:y};(l.shouldReduceMotion||this.options.layoutRoot)&&(S.delay=0,S.type=!1),this.startAnimation(S),this.setAnimationOrigin(u,v)}else h||JX(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=f})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const s=this.getStack();s&&s.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Bc(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(YVe),this.animationId++)}getTransformTemplate(){const{visualElement:s}=this.options;return s&&s.getProps().transformTemplate}willUpdate(s=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&YX(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const h=this.path[u];h.shouldResetTransform=!0,h.updateScroll("snapshot"),h.options.layoutRoot&&h.willUpdate(!1)}const{layoutId:a,layout:c}=this.options;if(a===void 0&&!c)return;const l=this.getTransformTemplate();this.prevTransformTemplateValue=l?l(this.latestValues,""):void 0,this.updateSnapshot(),s&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(jX);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(KX);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(UVe),this.nodes.forEach(NVe),this.nodes.forEach(kVe)):this.nodes.forEach(KX),this.clearAllSnapshots();const a=wr.now();Xi.delta=ia(0,1e3/60,a-Xi.timestamp),Xi.timestamp=a,Xi.isProcessing=!0,wE.update.process(Xi),wE.preRender.process(Xi),wE.render.process(Xi),Xi.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,rT.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(DVe),this.sharedNodes.forEach(HVe)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Tn.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Tn.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!xr(this.snapshot.measuredBox.x)&&!xr(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const s=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=_i(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:a}=this.options;a&&a.notify("LayoutMeasure",this.layout.layoutBox,s?s.layoutBox:void 0)}updateScroll(s="measure"){let a=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===s&&(a=!1),a&&this.instance){const c=i(this.instance);this.scroll={animationId:this.root.animationId,phase:s,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!r)return;const s=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!FX(this.projectionDelta),c=this.getTransformTemplate(),l=c?c(this.latestValues,""):void 0,u=l!==this.prevTransformTemplateValue;s&&this.instance&&(a||nu(this.latestValues)||u)&&(r(this.instance,l),this.shouldResetTransform=!1,this.scheduleRender())}measure(s=!0){const a=this.measurePageBox();let c=this.removeElementScroll(a);return s&&(c=this.removeTransform(c)),QVe(c),{animationId:this.root.animationId,measuredBox:a,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:s}=this.options;if(!s)return _i();const a=s.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(qVe))){const{scroll:l}=this.root;l&&(od(a.x,l.offset.x),od(a.y,l.offset.y))}return a}removeElementScroll(s){const a=_i();if(_s(a,s),this.scroll?.wasRoot)return a;for(let c=0;c<this.path.length;c++){const l=this.path[c],{scroll:u,options:h}=l;l!==this.root&&u&&h.layoutScroll&&(u.wasRoot&&_s(a,s),od(a.x,u.offset.x),od(a.y,u.offset.y))}return a}applyTransform(s,a=!1){const c=_i();_s(c,s);for(let l=0;l<this.path.length;l++){const u=this.path[l];!a&&u.options.layoutScroll&&u.scroll&&u!==u.root&&sd(c,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),nu(u.latestValues)&&sd(c,u.latestValues)}return nu(this.latestValues)&&sd(c,this.latestValues),c}removeTransform(s){const a=_i();_s(a,s);for(let c=0;c<this.path.length;c++){const l=this.path[c];if(!l.instance||!nu(l.latestValues))continue;dT(l.latestValues)&&l.updateSnapshot();const u=_i(),h=l.measurePageBox();_s(u,h),GX(a,l.latestValues,l.snapshot?l.snapshot.layoutBox:void 0,u)}return nu(this.latestValues)&&GX(a,this.latestValues),a}setTargetDelta(s){this.targetDelta=s,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(s){this.options={...this.options,...s,crossfade:s.crossfade!==void 0?s.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Xi.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(s=!1){const a=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=a.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=a.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=a.isSharedProjectionDirty);const c=!!this.resumingFrom||this!==a;if(!(s||c&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:u,layoutId:h}=this.options;if(!this.layout||!(u||h))return;this.resolvedRelativeTargetAt=Xi.timestamp;const d=this.getClosestProjectingParent();d&&this.linkedParentVersion!==d.layoutVersion&&!d.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(d&&d.layout?this.createRelativeTarget(d,this.layout.layoutBox,d.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=_i(),this.targetWithTransforms=_i()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),wVe(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):_s(this.target,this.layout.layoutBox),cX(this.target,this.targetDelta)):_s(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,d&&!!d.resumingFrom==!!this.resumingFrom&&!d.options.layoutScroll&&d.target&&this.animationProgress!==1?this.createRelativeTarget(d,this.target,d.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||dT(this.parent.latestValues)||oX(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(s,a,c){this.relativeParent=s,this.linkedParentVersion=s.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=_i(),this.relativeTargetOrigin=_i(),$b(this.relativeTargetOrigin,a,c),_s(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const s=this.getLead(),a=!!this.resumingFrom||this!==s;let c=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(c=!1),a&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===Xi.timestamp&&(c=!1),c)return;const{layout:l,layoutId:u}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(l||u))return;_s(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,d=this.treeScale.y;JGe(this.layoutCorrected,this.treeScale,this.path,a),s.layout&&!s.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(s.target=s.layout.layoutBox,s.targetWithTransforms=_i());const{target:f}=s;if(!f){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(TX(this.prevProjectionDelta.x,this.projectionDelta.x),TX(this.prevProjectionDelta.y,this.projectionDelta.y)),T0(this.projectionDelta,this.layoutCorrected,f,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==d||!XX(this.projectionDelta.x,this.prevProjectionDelta.x)||!XX(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",f))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(s=!0){if(this.options.visualElement?.scheduleRender(),s){const a=this.getStack();a&&a.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=rd(),this.projectionDelta=rd(),this.projectionDeltaWithTransform=rd()}setAnimationOrigin(s,a=!1){const c=this.snapshot,l=c?c.latestValues:{},u={...this.latestValues},h=rd();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const d=_i(),f=c?c.source:void 0,p=this.layout?this.layout.source:void 0,m=f!==p,y=this.getStack(),g=!y||y.members.length<=1,v=!!(m&&!g&&this.options.crossfade===!0&&!this.path.some(KVe));this.animationProgress=0;let S;this.mixTargetDelta=E=>{const C=E/1e3;QX(h.x,s.x,C),QX(h.y,s.y,C),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&($b(d,this.layout.layoutBox,this.relativeParent.layout.layoutBox),jVe(this.relativeTarget,this.relativeTargetOrigin,d,C),S&&TVe(this.relativeTarget,S)&&(this.isProjectionDirty=!1),S||(S=_i()),_s(S,this.relativeTarget)),m&&(this.animationValues=u,IVe(u,l,this.latestValues,C,v,g)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=C},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(s){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Bc(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Tn.update(()=>{t1.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=tu(0)),this.motionValue.jump(0,!1),this.currentAnimation=PVe(this.motionValue,[0,1e3],{...s,velocity:0,isSync:!0,onUpdate:a=>{this.mixTargetDelta(a),s.onUpdate&&s.onUpdate(a)},onStop:()=>{},onComplete:()=>{s.onComplete&&s.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const s=this.getStack();s&&s.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(AVe),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const s=this.getLead();let{targetWithTransforms:a,target:c,layout:l,latestValues:u}=s;if(!(!a||!c||!l)){if(this!==s&&this.layout&&l&&nZ(this.options.animationType,this.layout.layoutBox,l.layoutBox)){c=this.target||_i();const h=xr(this.layout.layoutBox.x);c.x.min=s.target.x.min,c.x.max=c.x.min+h;const d=xr(this.layout.layoutBox.y);c.y.min=s.target.y.min,c.y.max=c.y.min+d}_s(a,c),sd(a,u),T0(this.projectionDeltaWithTransform,this.layoutCorrected,a,u)}}registerSharedNode(s,a){this.sharedNodes.has(s)||this.sharedNodes.set(s,new FVe),this.sharedNodes.get(s).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const s=this.getStack();return s?s.lead===this:!0}getLead(){const{layoutId:s}=this.options;return s?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:s}=this.options;return s?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:s}=this.options;if(s)return this.root.sharedNodes.get(s)}promote({needsReset:s,transition:a,preserveFollowOpacity:c}={}){const l=this.getStack();l&&l.promote(this,c),s&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const s=this.getStack();return s?s.relegate(this):!1}resetSkewAndRotation(){const{visualElement:s}=this.options;if(!s)return;let a=!1;const{latestValues:c}=s;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(a=!0),!a)return;const l={};c.z&&bT("z",s,l,this.animationValues);for(let u=0;u<yT.length;u++)bT(`rotate${yT[u]}`,s,l,this.animationValues),bT(`skew${yT[u]}`,s,l,this.animationValues);s.render();for(const u in l)s.setStaticValue(u,l[u]),this.animationValues&&(this.animationValues[u]=l[u]);s.scheduleRender()}applyProjectionStyles(s,a){if(!this.instance||this.isSVG)return;if(!this.isVisible){s.visibility="hidden";return}const c=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,s.visibility="",s.opacity="",s.pointerEvents=e1(a?.pointerEvents)||"",s.transform=c?c(this.latestValues,""):"none";return}const l=this.getLead();if(!this.projectionDelta||!this.layout||!l.target){this.options.layoutId&&(s.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,s.pointerEvents=e1(a?.pointerEvents)||""),this.hasProjected&&!nu(this.latestValues)&&(s.transform=c?c({},""):"none",this.hasProjected=!1);return}s.visibility="";const u=l.animationValues||l.latestValues;this.applyTransformsToTarget();let h=CVe(this.projectionDeltaWithTransform,this.treeScale,u);c&&(h=c(u,h)),s.transform=h;const{x:d,y:f}=this.projectionDelta;s.transformOrigin=`${d.origin*100}% ${f.origin*100}% 0`,l.animationValues?s.opacity=l===this?u.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:u.opacityExit:s.opacity=l===this?u.opacity!==void 0?u.opacity:"":u.opacityExit!==void 0?u.opacityExit:0;for(const p in mT){if(u[p]===void 0)continue;const{correct:m,applyTo:y,isCSSVariable:g}=mT[p],v=h==="none"?u[p]:m(u[p],l);if(y){const S=y.length;for(let E=0;E<S;E++)s[y[E]]=v}else g?this.options.visualElement.renderState.vars[p]=v:s[p]=v}this.options.layoutId&&(s.pointerEvents=l===this?e1(a?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(s=>s.currentAnimation?.stop()),this.root.nodes.forEach(jX),this.root.sharedNodes.clear()}}}function NVe(e){e.updateLayout()}function kVe(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:i}=e.layout,{animationType:r}=e.options,o=t.source!==e.layout.source;r==="size"?oa(u=>{const h=o?t.measuredBox[u]:t.layoutBox[u],d=xr(h);h.min=n[u].min,h.max=h.min+d}):nZ(r,t.layoutBox,n)&&oa(u=>{const h=o?t.measuredBox[u]:t.layoutBox[u],d=xr(n[u]);h.max=h.min+d,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[u].max=e.relativeTarget[u].min+d)});const s=rd();T0(s,n,t.layoutBox);const a=rd();o?T0(a,e.applyTransform(i,!0),t.measuredBox):T0(a,n,t.layoutBox);const c=!FX(s);let l=!1;if(!e.resumeFrom){const u=e.getClosestProjectingParent();if(u&&!u.resumeFrom){const{snapshot:h,layout:d}=u;if(h&&d){const f=_i();$b(f,t.layoutBox,h.layoutBox);const p=_i();$b(p,n,d.layoutBox),NX(f,p)||(l=!0),u.options.layoutRoot&&(e.relativeTarget=p,e.relativeTargetOrigin=f,e.relativeParent=u)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:t,delta:a,layoutDelta:s,hasLayoutChanged:c,hasRelativeLayoutChanged:l})}else if(e.isLead()){const{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function XVe(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function ZVe(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function DVe(e){e.clearSnapshot()}function jX(e){e.clearMeasurements()}function KX(e){e.isLayoutDirty=!1}function UVe(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function JX(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function WVe(e){e.resolveTargetDelta()}function BVe(e){e.calcProjection()}function YVe(e){e.resetSkewAndRotation()}function HVe(e){e.removeLeadSnapshot()}function QX(e,t,n){e.translate=Zn(t.translate,0,n),e.scale=Zn(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function qX(e,t,n,i){e.min=Zn(t.min,n.min,i),e.max=Zn(t.max,n.max,i)}function jVe(e,t,n,i){qX(e.x,t.x,n.x,i),qX(e.y,t.y,n.y,i)}function KVe(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const JVe={duration:.45,ease:[.4,0,.1,1]},$X=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),eZ=$X("applewebkit/")&&!$X("chrome/")?Math.round:No;function tZ(e){e.min=eZ(e.min),e.max=eZ(e.max)}function QVe(e){tZ(e.x),tZ(e.y)}function nZ(e,t,n){return e==="position"||e==="preserve-aspect"&&!vVe(kX(t),kX(n),.2)}function qVe(e){return e!==e.root&&e.scroll?.wasRoot}const $Ve=HX({attachResizeListener:(e,t)=>C0(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),_T={current:void 0},iZ=HX({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!_T.current){const e=new $Ve({});e.mount(window),e.setOptions({layoutScroll:!0}),_T.current=e}return _T.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),vT=R.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function e9e(e=!0){const t=R.useContext(pE);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:i,register:r}=t,o=R.useId();R.useEffect(()=>{if(e)return r(o)},[e]);const s=R.useCallback(()=>e&&i&&i(o),[o,i,e]);return!n&&i?[!1,s]:[!0]}const rZ=R.createContext({strict:!1}),oZ={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let sZ=!1;function t9e(){if(sZ)return;const e={};for(const t in oZ)e[t]={isEnabled:n=>oZ[t].some(i=>!!n[i])};nX(e),sZ=!0}function aZ(){return t9e(),YGe()}function n9e(e){const t=aZ();for(const n in e)t[n]={...t[n],...e[n]};nX(t)}const i9e=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function n1(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||i9e.has(e)}let cZ=e=>!n1(e);function r9e(e){typeof e=="function"&&(cZ=t=>t.startsWith("on")?!n1(t):e(t))}try{r9e(require("@emotion/is-prop-valid").default)}catch{}function o9e(e,t,n){const i={};for(const r in e)r==="values"&&typeof e.values=="object"||(cZ(r)||n===!0&&n1(r)||!t&&!n1(r)||e.draggable&&r.startsWith("onDrag"))&&(i[r]=e[r]);return i}const i1=R.createContext({});function s9e(e,t){if(Jb(e)){const{initial:n,animate:i}=e;return{initial:n===!1||S0(n)?n:void 0,animate:S0(i)?i:void 0}}return e.inherit!==!1?t:{}}function a9e(e){const{initial:t,animate:n}=s9e(e,R.useContext(i1));return R.useMemo(()=>({initial:t,animate:n}),[lZ(t),lZ(n)])}function lZ(e){return Array.isArray(e)?e.join(" "):e}const wT=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function uZ(e,t,n){for(const i in t)!ir(t[i])&&!gX(i,n)&&(e[i]=t[i])}function c9e({transformTemplate:e},t){return R.useMemo(()=>{const n=wT();return pT(n,t,e),Object.assign({},n.vars,n.style)},[t])}function l9e(e,t){const n=e.style||{},i={};return uZ(i,n,e),Object.assign(i,c9e(e,t)),i}function u9e(e,t){const n={},i=l9e(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=i,n}const hZ=()=>({...wT(),attrs:{}});function h9e(e,t,n,i){const r=R.useMemo(()=>{const o=hZ();return yX(o,t,_X(i),e.transformTemplate,e.style),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};uZ(o,e.style,e),r.style={...o,...r.style}}return r}const d9e=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function xT(e){return typeof e!="string"||e.includes("-")?!1:!!(d9e.indexOf(e)>-1||/[A-Z]/u.test(e))}function f9e(e,t,n,{latestValues:i},r,o=!1,s){const c=(s??xT(e)?h9e:u9e)(t,i,r,e),l=o9e(t,typeof e=="string",o),u=e!==R.Fragment?{...l,...c,ref:n}:{},{children:h}=t,d=R.useMemo(()=>ir(h)?h.get():h,[h]);return R.createElement(e,{...u,children:d})}function p9e({scrapeMotionValuesFromProps:e,createRenderState:t},n,i,r){return{latestValues:m9e(n,i,r,e),renderState:t()}}function m9e(e,t,n,i){const r={},o=i(e,{});for(const d in o)r[d]=e1(o[d]);let{initial:s,animate:a}=e;const c=Jb(e),l=$k(e);t&&l&&!c&&e.inherit!==!1&&(s===void 0&&(s=t.initial),a===void 0&&(a=t.animate));let u=n?n.initial===!1:!1;u=u||s===!1;const h=u?a:s;if(h&&typeof h!="boolean"&&!Kb(h)){const d=Array.isArray(h)?h:[h];for(let f=0;f<d.length;f++){const p=JE(e,d[f]);if(p){const{transitionEnd:m,transition:y,...g}=p;for(const v in g){let S=g[v];if(Array.isArray(S)){const E=u?S.length-1:0;S=S[E]}S!==null&&(r[v]=S)}for(const v in m)r[v]=m[v]}}}return r}const dZ=e=>(t,n)=>{const i=R.useContext(i1),r=R.useContext(pE),o=()=>p9e(e,t,i,r);return n?o():RN(o)},g9e=dZ({scrapeMotionValuesFromProps:gT,createRenderState:wT}),y9e=dZ({scrapeMotionValuesFromProps:vX,createRenderState:hZ}),b9e=Symbol.for("motionComponentSymbol");function _9e(e,t,n){const i=R.useRef(n);R.useInsertionEffect(()=>{i.current=n});const r=R.useRef(null);return R.useCallback(o=>{o&&e.onMount?.(o);const s=i.current;if(typeof s=="function")if(o){const a=s(o);typeof a=="function"&&(r.current=a)}else r.current?(r.current(),r.current=null):s(o);else s&&(s.current=o);t&&(o?t.mount(o):t.unmount())},[t])}const fZ=R.createContext({});function ad(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function v9e(e,t,n,i,r,o){const{visualElement:s}=R.useContext(i1),a=R.useContext(rZ),c=R.useContext(pE),l=R.useContext(vT),u=l.reducedMotion,h=l.skipAnimations,d=R.useRef(null),f=R.useRef(!1);i=i||a.renderer,!d.current&&i&&(d.current=i(e,{visualState:t,parent:s,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,skipAnimations:h,isSVG:o}),f.current&&d.current&&(d.current.manuallyAnimateOnMount=!0));const p=d.current,m=R.useContext(fZ);p&&!p.projection&&r&&(p.type==="html"||p.type==="svg")&&w9e(d.current,n,r,m);const y=R.useRef(!1);R.useInsertionEffect(()=>{p&&y.current&&p.update(n,c)});const g=n[Ok],v=R.useRef(!!g&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(g)&&window.MotionHasOptimisedAnimation?.(g));return wPe(()=>{f.current=!0,p&&(y.current=!0,window.MotionIsMounted=!0,p.updateFeatures(),p.scheduleRenderMicrotask(),v.current&&p.animationState&&p.animationState.animateChanges())}),R.useEffect(()=>{p&&(!v.current&&p.animationState&&p.animationState.animateChanges(),v.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(g)}),v.current=!1),p.enteringChildren=void 0)}),p}function w9e(e,t,n,i){const{layoutId:r,layout:o,drag:s,dragConstraints:a,layoutScroll:c,layoutRoot:l,layoutCrossfade:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:pZ(e.parent)),e.projection.setOptions({layoutId:r,layout:o,alwaysMeasureLayout:!!s||a&&ad(a),visualElement:e,animationType:typeof o=="string"?o:"both",initialPromotionConfig:i,crossfade:u,layoutScroll:c,layoutRoot:l})}function pZ(e){if(e)return e.options.allowProjection!==!1?e.projection:pZ(e.parent)}function ST(e,{forwardMotionProps:t=!1,type:n}={},i,r){i&&n9e(i);const o=n?n==="svg":xT(e),s=o?y9e:g9e;function a(l,u){let h;const d={...R.useContext(vT),...l,layoutId:x9e(l)},{isStatic:f}=d,p=a9e(l),m=s(l,f);if(!f&&typeof window<"u"){S9e(d,i);const y=E9e(d);h=y.MeasureLayout,p.visualElement=v9e(e,m,d,r,y.ProjectionNode,o)}return ce.jsxs(i1.Provider,{value:p,children:[h&&p.visualElement?ce.jsx(h,{visualElement:p.visualElement,...d}):null,f9e(e,l,_9e(m,p.visualElement,u),m,f,t,o)]})}a.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const c=R.forwardRef(a);return c[b9e]=e,c}function x9e({layoutId:e}){const t=R.useContext(CN).id;return t&&e!==void 0?t+"-"+e:e}function S9e(e,t){const n=R.useContext(rZ).strict;if(process.env.NODE_ENV!=="production"&&t&&n){const i="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";e.ignoreStrict?Jh(!1,i,"lazy-strict-mode"):Ua(!1,i,"lazy-strict-mode")}}function E9e(e){const t=aZ(),{drag:n,layout:i}=t;if(!n&&!i)return{};const r={...n,...i};return{MeasureLayout:n?.isEnabled(e)||i?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function T9e(e,t){if(typeof Proxy>"u")return ST;const n=new Map,i=(o,s)=>ST(o,s,e,t),r=(o,s)=>(process.env.NODE_ENV!=="production"&&bE(!1,"motion() is deprecated. Use motion.create() instead."),i(o,s));return new Proxy(r,{get:(o,s)=>s==="create"?i:(n.has(s)||n.set(s,ST(s,void 0,e,t)),n.get(s))})}const C9e=(e,t)=>t.isSVG??xT(e)?new lVe(t):new iVe(t,{allowProjection:e!==R.Fragment});class R9e extends jc{constructor(t){super(t),t.animationState||(t.animationState=pVe(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Kb(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let I9e=0;class M9e extends jc{constructor(){super(...arguments),this.id=I9e++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===i)return;const r=this.node.animationState.setActive("exit",!t);n&&!t&&r.then(()=>{n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const L9e={animation:{Feature:R9e},exit:{Feature:M9e}};function R0(e){return{point:{x:e.pageX,y:e.pageY}}}const P9e=e=>t=>oT(t)&&e(t,R0(t));function I0(e,t,n,i){return C0(e,t,P9e(n),i)}const mZ=({current:e})=>e?e.ownerDocument.defaultView:null,gZ=(e,t)=>Math.abs(e-t);function O9e(e,t){const n=gZ(e.x,t.x),i=gZ(e.y,t.y);return Math.sqrt(n**2+i**2)}const yZ=new Set(["auto","scroll"]);class bZ{constructor(t,n,{transformPagePoint:i,contextWindow:r=window,dragSnapToOrigin:o=!1,distanceThreshold:s=3,element:a}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=f=>{this.handleScroll(f.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=TT(this.lastMoveEventInfo,this.history),p=this.startEvent!==null,m=O9e(f.offset,{x:0,y:0})>=this.distanceThreshold;if(!p&&!m)return;const{point:y}=f,{timestamp:g}=Xi;this.history.push({...y,timestamp:g});const{onStart:v,onMove:S}=this.handlers;p||(v&&v(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),S&&S(this.lastMoveEvent,f)},this.handlePointerMove=(f,p)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=ET(p,this.transformPagePoint),Tn.update(this.updatePoint,!0)},this.handlePointerUp=(f,p)=>{this.end();const{onEnd:m,onSessionEnd:y,resumeAnimation:g}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&g&&g(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const v=TT(f.type==="pointercancel"?this.lastMoveEventInfo:ET(p,this.transformPagePoint),this.history);this.startEvent&&m&&m(f,v),y&&y(f,v)},!oT(t))return;this.dragSnapToOrigin=o,this.handlers=n,this.transformPagePoint=i,this.distanceThreshold=s,this.contextWindow=r||window;const c=R0(t),l=ET(c,this.transformPagePoint),{point:u}=l,{timestamp:h}=Xi;this.history=[{...u,timestamp:h}];const{onSessionStart:d}=n;d&&d(t,TT(l,this.history)),this.removeListeners=m0(I0(this.contextWindow,"pointermove",this.handlePointerMove),I0(this.contextWindow,"pointerup",this.handlePointerUp),I0(this.contextWindow,"pointercancel",this.handlePointerUp)),a&&this.startScrollTracking(a)}startScrollTracking(t){let n=t.parentElement;for(;n;){const i=getComputedStyle(n);(yZ.has(i.overflowX)||yZ.has(i.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const n=this.scrollPositions.get(t);if(!n)return;const i=t===window,r=i?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},o={x:r.x-n.x,y:r.y-n.y};o.x===0&&o.y===0||(i?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=o.x,this.lastMoveEventInfo.point.y+=o.y):this.history.length>0&&(this.history[0].x-=o.x,this.history[0].y-=o.y),this.scrollPositions.set(t,r),Tn.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Bc(this.updatePoint)}}function ET(e,t){return t?{point:t(e.point)}:e}function _Z(e,t){return{x:e.x-t.x,y:e.y-t.y}}function TT({point:e},t){return{point:e,delta:_Z(e,vZ(t)),offset:_Z(e,G9e(t)),velocity:V9e(t,.1)}}function G9e(e){return e[0]}function vZ(e){return e[e.length-1]}function V9e(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,i=null;const r=vZ(e);for(;n>=0&&(i=e[n],!(r.timestamp-i.timestamp>ko(t)));)n--;if(!i)return{x:0,y:0};i===e[0]&&e.length>2&&r.timestamp-i.timestamp>ko(t)*2&&(i=e[1]);const o=Xo(r.timestamp-i.timestamp);if(o===0)return{x:0,y:0};const s={x:(r.x-i.x)/o,y:(r.y-i.y)/o};return s.x===1/0&&(s.x=0),s.y===1/0&&(s.y=0),s}function F9e(e,{min:t,max:n},i){return t!==void 0&&e<t?e=i?Zn(t,e,i.min):Math.max(e,t):n!==void 0&&e>n&&(e=i?Zn(n,e,i.max):Math.min(e,n)),e}function wZ(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function A9e(e,{top:t,left:n,bottom:i,right:r}){return{x:wZ(e.x,n,r),y:wZ(e.y,t,i)}}function xZ(e,t){let n=t.min-e.min,i=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,i]=[i,n]),{min:n,max:i}}function z9e(e,t){return{x:xZ(e.x,t.x),y:xZ(e.y,t.y)}}function N9e(e,t){let n=.5;const i=xr(e),r=xr(t);return r>i?n=g0(t.min,t.max-i,e.min):i>r&&(n=g0(e.min,e.max-r,t.min)),ia(0,1,n)}function k9e(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const CT=.35;function X9e(e=CT){return e===!1?e=0:e===!0&&(e=CT),{x:SZ(e,"left","right"),y:SZ(e,"top","bottom")}}function SZ(e,t,n){return{min:EZ(e,t),max:EZ(e,n)}}function EZ(e,t){return typeof e=="number"?e:e[t]||0}const Z9e=new WeakMap;class D9e{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=_i(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:i}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const o=h=>{n&&this.snapToCursor(R0(h).point),this.stopAnimation()},s=(h,d)=>{const{drag:f,dragPropagation:p,onDragStart:m}=this.getProps();if(f&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=xGe(f),!this.openDragLock))return;this.latestPointerEvent=h,this.latestPanInfo=d,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),oa(g=>{let v=this.getAxisMotionValue(g).get()||0;if(ra.test(v)){const{projection:S}=this.visualElement;if(S&&S.layout){const E=S.layout.layoutBox[g];E&&(v=xr(E)*(parseFloat(v)/100))}}this.originPoint[g]=v}),m&&Tn.update(()=>m(h,d),!1,!0),qE(this.visualElement,"transform");const{animationState:y}=this.visualElement;y&&y.setActive("whileDrag",!0)},a=(h,d)=>{this.latestPointerEvent=h,this.latestPanInfo=d;const{dragPropagation:f,dragDirectionLock:p,onDirectionLock:m,onDrag:y}=this.getProps();if(!f&&!this.openDragLock)return;const{offset:g}=d;if(p&&this.currentDirection===null){this.currentDirection=W9e(g),this.currentDirection!==null&&m&&m(this.currentDirection);return}this.updateAxis("x",d.point,g),this.updateAxis("y",d.point,g),this.visualElement.render(),y&&Tn.update(()=>y(h,d),!1,!0)},c=(h,d)=>{this.latestPointerEvent=h,this.latestPanInfo=d,this.stop(h,d),this.latestPointerEvent=null,this.latestPanInfo=null},l=()=>{const{dragSnapToOrigin:h}=this.getProps();(h||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:u}=this.getProps();this.panSession=new bZ(t,{onSessionStart:o,onStart:s,onMove:a,onSessionEnd:c,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,distanceThreshold:i,contextWindow:mZ(this.visualElement),element:this.visualElement.current})}stop(t,n){const i=t||this.latestPointerEvent,r=n||this.latestPanInfo,o=this.isDragging;if(this.cancel(),!o||!r||!i)return;const{velocity:s}=r;this.startAnimation(s);const{onDragEnd:a}=this.getProps();a&&Tn.postRender(()=>a(i,r))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,n,i){const{drag:r}=this.getProps();if(!i||!r1(t,r,this.currentDirection))return;const o=this.getAxisMotionValue(t);let s=this.originPoint[t]+i[t];this.constraints&&this.constraints[t]&&(s=F9e(s,this.constraints[t],this.elastic[t])),o.set(s)}resolveConstraints(){const{dragConstraints:t,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;t&&ad(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&i?this.constraints=A9e(i.layoutBox,t):this.constraints=!1,this.elastic=X9e(n),r!==this.constraints&&!ad(t)&&i&&this.constraints&&!this.hasMutatedConstraints&&oa(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=k9e(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!ad(t))return!1;const i=t.current;Ua(i!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const o=QGe(i,r.root,this.visualElement.getTransformPagePoint());let s=z9e(r.layout.layoutBox,o);if(n){const a=n(jGe(s));this.hasMutatedConstraints=!!a,a&&(s=rX(a))}return s}startAnimation(t){const{drag:n,dragMomentum:i,dragElastic:r,dragTransition:o,dragSnapToOrigin:s,onDragTransitionEnd:a}=this.getProps(),c=this.constraints||{},l=oa(u=>{if(!r1(u,n,this.currentDirection))return;let h=c&&c[u]||{};s&&(h={min:0,max:0});const d=r?200:1e6,f=r?40:1e7,p={type:"inertia",velocity:i?t[u]:0,bounceStiffness:d,bounceDamping:f,timeConstant:750,restDelta:1,restSpeed:10,...o,...h};return this.startAxisValueAnimation(u,p)});return Promise.all(l).then(a)}startAxisValueAnimation(t,n){const i=this.getAxisMotionValue(t);return qE(this.visualElement,t),i.start(KE(t,i,0,n,this.visualElement,!1))}stopAnimation(){oa(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,i=this.visualElement.getProps(),r=i[n];return r||this.visualElement.getValue(t,(i.initial?i.initial[t]:void 0)||0)}snapToCursor(t){oa(n=>{const{drag:i}=this.getProps();if(!r1(n,i,this.currentDirection))return;const{projection:r}=this.visualElement,o=this.getAxisMotionValue(n);if(r&&r.layout){const{min:s,max:a}=r.layout.layoutBox[n],c=o.get()||0;o.set(t[n]-Zn(s,a,.5)+c)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:i}=this.visualElement;if(!ad(n)||!i||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};oa(s=>{const a=this.getAxisMotionValue(s);if(a&&this.constraints!==!1){const c=a.get();r[s]=N9e({min:c,max:c},this.constraints[s])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.constraints=!1,this.resolveConstraints(),oa(s=>{if(!r1(s,t,null))return;const a=this.getAxisMotionValue(s),{min:c,max:l}=this.constraints[s];a.set(Zn(c,l,r[s]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;Z9e.set(this.visualElement,this);const t=this.visualElement.current,n=I0(t,"pointerdown",l=>{const{drag:u,dragListener:h=!0}=this.getProps(),d=l.target,f=d!==t&&IGe(d);u&&h&&!f&&this.start(l)});let i;const r=()=>{const{dragConstraints:l}=this.getProps();ad(l)&&l.current&&(this.constraints=this.resolveRefConstraints(),i||(i=U9e(t,l.current,()=>this.scalePositionWithinConstraints())))},{projection:o}=this.visualElement,s=o.addEventListener("measure",r);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),Tn.read(r);const a=C0(window,"resize",()=>this.scalePositionWithinConstraints()),c=o.addEventListener("didUpdate",(({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(oa(h=>{const d=this.getAxisMotionValue(h);d&&(this.originPoint[h]+=l[h].translate,d.set(d.get()+l[h].translate))}),this.visualElement.render())}));return()=>{a(),n(),s(),c&&c(),i&&i()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:i=!1,dragPropagation:r=!1,dragConstraints:o=!1,dragElastic:s=CT,dragMomentum:a=!0}=t;return{...t,drag:n,dragDirectionLock:i,dragPropagation:r,dragConstraints:o,dragElastic:s,dragMomentum:a}}}function TZ(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function U9e(e,t,n){const i=Jk(e,TZ(n)),r=Jk(t,TZ(n));return()=>{i(),r()}}function r1(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function W9e(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class B9e extends jc{constructor(t){super(t),this.removeGroupControls=No,this.removeListeners=No,this.controls=new D9e(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||No}update(){const{dragControls:t}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};t!==n&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const RT=e=>(t,n)=>{e&&Tn.update(()=>e(t,n),!1,!0)};class Y9e extends jc{constructor(){super(...arguments),this.removePointerDownListener=No}onPointerDown(t){this.session=new bZ(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:mZ(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:i,onPanEnd:r}=this.node.getProps();return{onSessionStart:RT(t),onStart:RT(n),onMove:RT(i),onEnd:(o,s)=>{delete this.session,r&&Tn.postRender(()=>r(o,s))}}}mount(){this.removePointerDownListener=I0(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let IT=!1;class H9e extends R.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:i,layoutId:r}=this.props,{projection:o}=t;o&&(n.group&&n.group.add(o),i&&i.register&&r&&i.register(o),IT&&o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),t1.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:i,drag:r,isPresent:o}=this.props,{projection:s}=i;return s&&(s.isPresent=o,t.layoutDependency!==n&&s.setOptions({...s.options,layoutDependency:n}),IT=!0,r||t.layoutDependency!==n||n===void 0||t.isPresent!==o?s.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?s.promote():s.relegate()||Tn.postRender(()=>{const a=s.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),rT.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:i}=this.props,{projection:r}=t;IT=!0,r&&(r.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(r),i&&i.deregister&&i.deregister(r))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function CZ(e){const[t,n]=e9e(),i=R.useContext(CN);return ce.jsx(H9e,{...e,layoutGroup:i,switchLayoutGroup:R.useContext(fZ),isPresent:t,safeToRemove:n})}const j9e={pan:{Feature:Y9e},drag:{Feature:B9e,ProjectionNode:iZ,MeasureLayout:CZ}};function RZ(e,t,n){const{props:i}=e;e.animationState&&i.whileHover&&e.animationState.setActive("whileHover",n==="Start");const r="onHover"+n,o=i[r];o&&Tn.postRender(()=>o(t,R0(t)))}class K9e extends jc{mount(){const{current:t}=this.node;t&&(this.unmount=EGe(t,(n,i)=>(RZ(this.node,i,"Start"),r=>RZ(this.node,r,"End"))))}unmount(){}}class J9e extends jc{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=m0(C0(this.node.current,"focus",()=>this.onFocus()),C0(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function IZ(e,t,n){const{props:i}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&i.whileTap&&e.animationState.setActive("whileTap",n==="Start");const r="onTap"+(n==="End"?"":n),o=i[r];o&&Tn.postRender(()=>o(t,R0(t)))}class Q9e extends jc{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:n,propagate:i}=this.node.props;this.unmount=LGe(t,(r,o)=>(IZ(this.node,o,"Start"),(s,{success:a})=>IZ(this.node,s,a?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:i?.tap===!1})}unmount(){}}const MT=new WeakMap,LT=new WeakMap,q9e=e=>{const t=MT.get(e.target);t&&t(e)},$9e=e=>{e.forEach(q9e)};function eFe({root:e,...t}){const n=e||document;LT.has(n)||LT.set(n,{});const i=LT.get(n),r=JSON.stringify(t);return i[r]||(i[r]=new IntersectionObserver($9e,{root:e,...t})),i[r]}function tFe(e,t,n){const i=eFe(t);return MT.set(e,n),i.observe(e),()=>{MT.delete(e),i.unobserve(e)}}const nFe={some:0,all:1};class iFe extends jc{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:i,amount:r="some",once:o}=t,s={root:n?n.current:void 0,rootMargin:i,threshold:typeof r=="number"?r:nFe[r]},a=c=>{const{isIntersecting:l}=c;if(this.isInView===l||(this.isInView=l,o&&!l&&this.hasEnteredView))return;l&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",l);const{onViewportEnter:u,onViewportLeave:h}=this.node.getProps(),d=l?u:h;d&&d(c)};return tFe(this.node.current,s,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(rFe(t,n))&&this.startObserver()}unmount(){}}function rFe({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const oFe={...L9e,...{inView:{Feature:iFe},tap:{Feature:Q9e},focus:{Feature:J9e},hover:{Feature:K9e}},...j9e,...{layout:{ProjectionNode:iZ,MeasureLayout:CZ}}},sFe=T9e(oFe,C9e);function MZ(e){const t=RN(()=>tu(e)),{isStatic:n}=R.useContext(vT);if(n){const[,i]=R.useState(e);R.useEffect(()=>t.on("change",i),[])}return t}function PT(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function aFe(e,t){var n=R.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(i){var r=n.value;r!==i&&(n.value=i,n.callback(i,r))}}}})[0];return n.callback=t,n.facade}var cFe=typeof window<"u"?A0.useLayoutEffect:A0.useEffect,LZ=new WeakMap;function lFe(e,t){var n=aFe(null,function(i){return e.forEach(function(r){return PT(r,i)})});return cFe(function(){var i=LZ.get(n);if(i){var r=new Set(i),o=new Set(e),s=n.current;r.forEach(function(a){o.has(a)||PT(a,null)}),o.forEach(function(a){r.has(a)||PT(a,s)})}LZ.set(n,e)},[e]),n}const uFe=new cs(it.WGS84,b.ZERO),OT=R.forwardRef(({position:e,children:t,...n},i)=>{const r=Wo(()=>new b);e?.clone(r);const o=MZ(""),s=MZ("none"),{toWindowPosition:a,getCamera:c,toXYZ:l,isPositionVisible:u}=ci(),h=R.useRef(null);Gl(()=>{if(h.current==null)return;let f;try{const v=a?.([r.x,r.y,r.z]);f=new me(v?.[0],v?.[1])}catch{s.set("none");return}const p=c?.();if(!p)return;const m=l?.(p?.lng,p?.lat,p?.height);if(!m)return;if(uFe.cameraPosition=new b(m[0],m[1],m[2]),f==null||f.x<0||f.y<0||f.x>window.innerWidth||f.y>window.innerHeight||!u?.([r.x,r.y,r.z])){s.set("none");return}const y=`calc(${f.x}px - 50%)`,g=`calc(${f.y}px - 50%)`;o.set(`translate(${y}, ${g})`),s.set("block")});const d=lFe([h,i]);return ce.jsx(sFe.div,{ref:d,...n,style:{...n.style,transform:o,display:s,position:"absolute",pointerEvents:"none",left:0,top:0},children:t})});OT.displayName="ScreenSpaceElement";const hFe=({a:e,b:t,color:n})=>{const i=R.useRef([e,t]);i.current=[e,t];const r=Wo(()=>new wo(()=>i.current,!1)),o=R.useMemo(()=>({polyline:{positions:r,width:1.5,material:new Ol({color:n,dashLength:8})}}),[n,r]);return ce.jsx(p0,{...o})},dFe=({a:e,b:t,extrudedHeight:n,color:i,showLine:r})=>{const o=Wo(()=>new b);return ce.jsxs(ce.Fragment,{children:[ce.jsx(OT,{position:b.midpoint(e,t,o),children:ce.jsx(TN,{children:n<1e3?`${n.toFixed(1)} m`:`${(n/1e3).toFixed(1)} km`})}),r&&ce.jsx(hFe,{a:e,b:t,color:i})]})},PZ=R.memo(({geometryOptions:{controlPoints:e,type:t},extrudedHeight:n,color:i,isEditing:r,extrudedPoint:o,centroidBasePoint:s,centroidExtrudedPoint:a,catchedExtrudedPoint:c,handleControlPointMouseEvent:l})=>{const u=e[e.length-1],h=o?new b(...o):void 0,d=s?new b(...s):void 0,f=a?new b(...a):void 0;return ce.jsxs(ce.Fragment,{children:[h&&ce.jsxs(ce.Fragment,{children:[ce.jsx(f0,{index:-1,position:h,isEditing:r,isExtrudedControlPoint:!0,handleControlPointMouseEvent:l}),(!r||c)&&ce.jsx(dFe,{a:u,b:h,extrudedHeight:n,color:r?B.fromCssColorString(d0):i,showLine:t!=="extrudedPolygon"})]}),d&&ce.jsx(f0,{index:-1,position:d,isEditing:r,isExtrudedControlPoint:!0}),f&&ce.jsx(f0,{index:-1,position:f,isEditing:r,isExtrudedControlPoint:!0})]})});PZ.displayName="ExtrudedControlPoints";const fFe=({id:e,hierarchy:t,extrudedHeight:n,color:i,disableShadow:r=!1,isEditing:o})=>{const s=R.useRef(t);s.current=t;const c=Wo(()=>new wo(()=>s.current,!1)),l=R.useRef(n);l.current=n;const h=Wo(()=>new wo(()=>l.current,!1)),d=R.useMemo(()=>({polygon:{hierarchy:c,heightReference:vl.RELATIVE_TO_TERRAIN,extrudedHeight:h,extrudedHeightReference:vl.RELATIVE_TO_TERRAIN,fill:!0,outline:!0,outlineWidth:1,outlineColor:o?B.fromCssColorString(d0):i?.withAlpha(1),material:new Rl(o?i?.withAlpha(.2):i),classificationType:eo.TERRAIN,shadows:r?Zf.DISABLED:Zf.ENABLED}}),[h,r,c,i,o]),{requestRender:f}=ci();return f?.(),ce.jsx(p0,{id:e,...d})},pFe=({dynamic:e=!1,hierarchy:t,color:n})=>{const i=R.useRef(t);i.current=t;const r=Wo(()=>new wo(()=>i.current,!1)),o=e?r:t,s=R.useMemo(()=>({polygon:{hierarchy:o,fill:!0,material:n?.withAlpha(.5),classificationType:eo.TERRAIN}}),[n,o]),{requestRender:a}=ci();return a?.(),ce.jsx(p0,{...s})},mFe=({dynamic:e=!1,positions:t,color:n,isEditing:i})=>{const r=R.useRef(t);r.current=t;const o=Wo(()=>new wo(()=>r.current,!e)),s=e?o:t,a=R.useMemo(()=>({polyline:{positions:s,width:1.5,material:i?B.fromCssColorString(d0):n,classificationType:eo.TERRAIN,clampToGround:!0}}),[n,s,i]),{requestRender:c}=ci();return c?.(),ce.jsx(p0,{...a})},OZ=new b,GZ=R.memo(({geometryOptions:{type:e,controlPoints:t},isEditing:n,handleAddControlPoint:i})=>{if(!["polyline","polygon","extrudedPolygon"].includes(e))return null;const r=[];for(let o=0;o<t.length-1;o++){const s=t[o+1],a=b.midpoint(t[o],s,OZ);r.push(a.clone())}if(e==="polygon"||e==="extrudedPolygon"){const o=b.midpoint(t[t.length-1],t[0],OZ);r.push(o.clone())}return ce.jsx(ce.Fragment,{children:r.map((o,s)=>ce.jsx(f0,{position:o,isAddingPoint:!0,index:s,clampToGround:!0,isEditing:n,handleControlPointMouseEvent:()=>i?.([o.x,o.y,o.z],s)},s))})});GZ.displayName="SurfaceAddingPoints";const gFe=({a:e,b:t,color:n})=>{const i=R.useRef([e,t]);i.current=[e,t];const r=Wo(()=>new wo(()=>i.current,!1)),o=R.useMemo(()=>({polyline:{positions:r,width:1.5,material:new Ol({color:n,dashLength:8}),classificationType:eo.TERRAIN,clampToGround:!0}}),[n,r]),{requestRender:s}=ci();return s?.(),ce.jsx(p0,{...o})},yFe=({a:e,b:t,color:n,showLine:i=!1})=>{const r=Wo(()=>new b),{getSurfaceDistance:o}=ci(),s=o?.(e,t);return s!==void 0?ce.jsxs(ce.Fragment,{children:[ce.jsx(OT,{position:b.midpoint(e,t,r),children:ce.jsx(TN,{children:s<1e3?`${s.toFixed(1)} m`:`${(s/1e3).toFixed(1)} km`})}),i&&ce.jsx(gFe,{a:e,b:t,color:n})]}):null},VZ=new b,FZ=R.memo(({geometryOptions:{type:e,controlPoints:t},color:n,isEditing:i,catchedControlPointIndex:r,selectedControlPointIndex:o,handleControlPointMouseEvent:s})=>{const a=[];if(t.length>=2)if(i){if(r!==void 0&&r!==-1)switch(e){case"polyline":r>0&&a.push({points:[t[r-1],t[r]],showLine:!1}),r<t.length-1&&a.push({points:[t[r],t[r+1]],showLine:!1});break;case"circle":case"extrudedCircle":r!==2&&a.push({points:[t[0],t[1]],showLine:!0});break;case"rectangle":case"extrudedRectangle":if(r<=1)a.push({points:[t[0],t[1]],showLine:!1});else if(r===2){const[c,l,u]=t,h=b.midpoint(c,l,VZ);a.push({points:[h,u],showLine:!0})}break;case"polygon":case"extrudedPolygon":a.push({points:[t[r],r===0?t[t.length-1]:t[r-1]],showLine:!1}),a.push({points:[t[r],r===t.length-1?t[0]:t[r+1]],showLine:!1});break}}else switch(e){case"rectangle":case"extrudedRectangle":if(t.length===2)a.push({points:t,showLine:!0});else if(t.length===3){const[c,l,u]=t,h=b.midpoint(c,l,VZ);a.push({points:[h,u],showLine:!0})}break;default:a.push({points:t.slice(-2),showLine:e==="circle"});break}return ce.jsxs(ce.Fragment,{children:[t.map((c,l)=>ce.jsx(f0,{position:c,index:l,isSelected:o===l,clampToGround:!0,isEditing:i,handleControlPointMouseEvent:s},l)),a.map(({points:c,showLine:l},u)=>ce.jsx(yFe,{a:c[0],b:c[1],color:i?B.fromCssColorString(d0):n,showLine:l},u))]})});FZ.displayName="SurfaceControlPoints";const AZ=R.memo(({geometryOptions:e,extrudedHeight:t,disableShadow:n,color:i,isEditing:r,extrudedPoint:o,centroidBasePoint:s,centroidExtrudedPoint:a,catchedControlPointIndex:c,catchedExtrudedPoint:l,selectedControlPointIndex:u,handleControlPointMouseEvent:h,handleAddControlPoint:d})=>{const f=R.useMemo(()=>e?{...e,controlPoints:e?.controlPoints.map(v=>new M.Cartesian3(...v))}:null,[e]),p=R.useMemo(()=>f?yN(f):null,[f]),{positionsArray:m,hierarchyArray:y}=R.useMemo(()=>p?.type==="Point"?{}:p?.type==="LineString"?{positionsArray:uF(p)}:p!=null?{positionsArray:uF(p),hierarchyArray:hF(p)}:{},[p]),g=R.useMemo(()=>B.fromCssColorString(i??uPe),[i]);return ce.jsxs(ce.Fragment,{children:[m?.map((v,S)=>ce.jsx(mFe,{dynamic:!0,positions:v,color:g,isEditing:r},S)),y?.map((v,S)=>ce.jsx(pFe,{dynamic:!0,hierarchy:v,color:g},S)),f!=null&&(!t||r)&&ce.jsx(FZ,{geometryOptions:f,color:g,isEditing:r,catchedControlPointIndex:c,selectedControlPointIndex:u,handleControlPointMouseEvent:h}),f!=null&&r&&ce.jsx(GZ,{geometryOptions:f,isEditing:r,handleAddControlPoint:d}),f!=null&&t&&ce.jsx(PZ,{geometryOptions:f,extrudedHeight:t,extrudedPoint:o,centroidBasePoint:s,centroidExtrudedPoint:a,catchedExtrudedPoint:l,color:g,isEditing:r,handleControlPointMouseEvent:h}),t&&y?.map((v,S)=>ce.jsx(fFe,{hierarchy:v,extrudedHeight:t,disableShadow:n,color:g,isEditing:r},S))]})});AZ.displayName="SketchComponent";const bFe=({className:e,style:t,property:n,time:i,camera:r,small:o,ready:s,children:a,selectedLayerId:c,isLayerDraggable:l,isLayerDragging:u,shouldRender:h,layerSelectionReason:d,meta:f,customProvider:p,displayCredits:m,layersRef:y,featureFlags:g,requestingRenderMode:v,timelineManagerRef:S,cameraForceHorizontalRoll:E,onLayerSelect:C,onCameraChange:O,onLayerDrag:V,onLayerDrop:A,onLayerEdit:G,onLayerSelectWithRectStart:N,onLayerSelectWithRectMove:k,onLayerSelectWithRectEnd:P,onMount:w,onLayerVisibility:x,onLayerLoad:I,onCreditsUpdate:X},D)=>{const{cesium:Y,mouseEventHandles:H,cesiumIonAccessToken:J,context:z,layerSelectWithRectEventHandlers:W,sceneLight:Q,sceneBackgroundColor:q,sceneMsaaSamples:oe,sceneMode:Ee,cameraViewBoundaries:be,cameraViewOuterBoundaries:Ae,cameraViewBoundariesMaterial:Pe,handleCameraChange:fe,handleCameraMoveEnd:Xe,handleUpdate:tt,handleClick:nt,handleMount:Z,handleUnmount:pe,handleTilesChange:ue,handleTerrainProviderChange:$}=JLe({ref:D,property:n,time:i,selectedLayerId:c,selectionReason:d,meta:f,customProvider:p,layersRef:y,featureFlags:g,timelineManagerRef:S,isLayerDraggable:l,isLayerDragging:u,shouldRender:h,requestingRenderMode:v,camera:r,cameraForceHorizontalRoll:E,onLayerDrag:V,onLayerDrop:A,onLayerSelect:C,onLayerEdit:G,onLayerSelectWithRectStart:N,onLayerSelectWithRectMove:k,onLayerSelectWithRectEnd:P,onLayerVisibility:x,onLayerLoad:I,onCameraChange:O,onMount:w,onCreditsUpdate:X}),j=n?.terrain?.enabled?n?.scene?.verticalExaggeration??1:1;return ce.jsxs(gre,{ref:Y,onUpdate:tt,className:e,requestRenderMode:!0,animation:!1,timeline:!1,baseLayer:!1,fullscreenButton:!1,homeButton:!1,geocoder:!1,infoBox:!1,baseLayerPicker:!1,navigationHelpButton:!1,projectionPicker:!1,sceneModePicker:!1,creditContainer:m?void 0:_Fe,style:{width:o?"300px":"auto",height:o?"300px":"100%",display:s?void 0:"none",cursor:u?"grab":void 0,...t},shadows:!!n?.scene?.shadow?.enabled,onClick:nt,onDoubleClick:H.doubleClick,onMouseDown:H.mouseDown,onMouseUp:H.mouseUp,onRightClick:H.rightClick,onRightDown:H.rightDown,onRightUp:H.rightUp,onMiddleClick:H.middleClick,onMiddleDown:H.middleDown,onMiddleUp:H.middleUp,onMouseMove:H.mouseMove,onMouseEnter:H.mouseEnter,onMouseLeave:H.mouseLeave,onWheel:H.wheel,automaticallyTrackDataSourceClocks:!1,children:[ce.jsx(zbe,{onMount:Z,onUnmount:pe}),ce.jsx(Zoe,{timelineManagerRef:S}),ce.jsx(Yye,{tiles:n?.tiles,cesiumIonAccessToken:J,customProvider:p,onTilesChange:ue}),ce.jsx(mF,{tileLabels:n?.tileLabels}),ce.jsx(Kye,{property:n,timelineManagerRef:S}),ce.jsxs(kM,{useDefault:!0,children:[ce.jsx(hc,{type:M.ScreenSpaceEventType.LEFT_CLICK}),ce.jsx(hc,{type:M.ScreenSpaceEventType.LEFT_DOUBLE_CLICK})]}),ce.jsxs(kM,{children:[ce.jsx(hc,{type:M.ScreenSpaceEventType.LEFT_DOWN,action:W.start.handler}),ce.jsx(hc,{type:M.ScreenSpaceEventType.LEFT_DOWN,modifier:M.KeyboardEventModifier.SHIFT,action:W.start.shift}),ce.jsx(hc,{type:M.ScreenSpaceEventType.MOUSE_MOVE,action:W.move.handler}),ce.jsx(hc,{type:M.ScreenSpaceEventType.MOUSE_MOVE,modifier:M.KeyboardEventModifier.SHIFT,action:W.move.shift}),ce.jsx(hc,{type:M.ScreenSpaceEventType.LEFT_UP,action:W.end.handler}),ce.jsx(hc,{type:M.ScreenSpaceEventType.LEFT_UP,modifier:M.KeyboardEventModifier.SHIFT,action:W.end.shift})]}),ce.jsx(ore,{maximumZoomDistance:n?.camera?.limiter?.enabled?n.camera?.limiter?.targetArea?.height??Number.POSITIVE_INFINITY:Number.POSITIVE_INFINITY,enableCollisionDetection:!n?.camera?.allowEnterGround}),ce.jsx(kne,{percentageChanged:.2,onChange:fe,onMoveEnd:Xe}),be&&n?.camera?.limiter?.showHelper&&ce.jsx(uc,{children:ce.jsx(ml,{positions:be,width:1,material:M.Color.RED,arcType:M.ArcType.RHUMB})}),Ae&&n?.camera?.limiter?.showHelper&&ce.jsx(uc,{children:ce.jsx(ml,{positions:Ae,width:1,material:Pe,arcType:M.ArcType.RHUMB})}),ce.jsx(ire,{backgroundColor:q,light:Q,mode:Ee,msaaSamples:oe,useDepthPicking:!0,useWebVR:!!n?.scene?.vr||void 0,debugShowFramesPerSecond:!!n?.debug?.showFramesPerSecond,verticalExaggerationRelativeHeight:n?.scene?.verticalExaggerationRelativeHeight,verticalExaggeration:j}),ce.jsx(lre,{show:n?.sky?.skyBox?.show??!0}),ce.jsx(fie,{enabled:n?.sky?.fog?.enabled??!0,density:n?.sky?.fog?.density}),ce.jsx(hre,{show:n?.sky?.sun?.show??!0}),ce.jsx(kie,{show:n?.sky?.moon?.show??!0}),ce.jsx(are,{show:n?.sky?.skyAtmosphere?.show??!0,atmosphereLightIntensity:n?.sky?.skyAtmosphere?.lightIntensity,saturationShift:n?.sky?.skyAtmosphere?.saturationShift,brightnessShift:n?.sky?.skyAtmosphere?.brightnessShift}),ce.jsx(wse,{property:n,cesiumIonAccessToken:J,onTerrainProviderChange:$}),ce.jsx(EF.Provider,{value:z,children:s?a:null}),ce.jsx(cPe,{...lPe[n?.render?.ambientOcclusion?.quality||"low"],enabled:!!n?.render?.ambientOcclusion?.enabled,intensity:n?.render?.ambientOcclusion?.intensity??100,outputType:n?.render?.ambientOcclusion?.ambientOcclusionOnly?SN.Occlusion:null})]})},_Fe=document.createElement("div"),zZ={cesium:{component:R.forwardRef(bFe),featureComponent:O5e,clusterComponent:Xoe,sketchComponent:AZ,delegatedDataTypes:["czml","wms","mvt","3dtiles","osm-buildings","reearth-buildings","google-photorealistic","kml"]}};function vFe({error:e,resetErrorBoundary:t}){const i=e?.message??String(e);return ce.jsxs("div",{children:[ce.jsx("h1",{children:"Oops! An Error Occurred"}),ce.jsx("p",{children:i}),ce.jsx("p",{children:ce.jsx("button",{style:{color:"#fff"},onClick:t,children:"Retry"})})]})}const wFe="0.0.7-alpha.71",xFe=({viewerProperty:e})=>{const t=R.useRef(e);t.current=e;const n=R.useMemo(()=>({get version(){return wFe},get viewerProperty(){return t.current}}),[]);R.useEffect(()=>{window.reearth_core=n},[n])},SFe=768,EFe=({wrapperRef:e})=>{const t=R.useMemo(()=>TFe(new URLSearchParams(window.location.search)),[]),[n,i]=R.useState({width:void 0,height:void 0,isMobile:void 0,query:t});return R.useEffect(()=>{const r=new ResizeObserver(o=>{const[s]=o;let a,c;if(s.contentBoxSize){const l=Array.isArray(s.contentBoxSize)?s.contentBoxSize[0]:s.contentBoxSize;a=l.inlineSize,c=l.blockSize}else s.contentRect?(a=s.contentRect.width,c=s.contentRect.height):(a=e.current?.clientWidth,c=e.current?.clientHeight);i(l=>({width:a,height:c,isMobile:a?a<=SFe:void 0,query:l.query}))});return e.current&&r.observe(e.current),()=>{r.disconnect()}},[e]),n};function TFe(e){const t={};for(const[n,i]of e)t[n]=i;return t}function CFe({camera:e,interactionMode:t,zoomedLayerId:n,viewerProperty:i,onLayerSelect:r,onCameraChange:o,onInteractionModeChange:s,onZoomToLayer:a,onLayerDrop:c,onSketchTypeChangeProp:l},u){const h=R.useRef(null);R.useImperativeHandle(u,()=>h.current,[]);const d=R.useRef(null),f=EFe({wrapperRef:d}),[p,m]=R.useState({}),[y,g]=R.useState(),[v,S]=R.useState(),E=R.useCallback(async(Ue,St,Dt,xt,mn)=>{const Li=p.layer?.layer?.type==="simple"&&p.layer?.layer?.data?.isSketchLayer;if(p.layerId===Ue&&p.featureId===St&&!Li)return;const $n=await Dt?.(),ei=Ue&&St?(Li?$n?.features?.find(ti=>ti.id===St):h.current?.engine.findComputedFeatureById?.(Ue,St))??mn?.feature:void 0;g(Ue&&St?h.current?.engine.findFeatureById?.(Ue,St):void 0),S(ei),m(ti=>ti.layerId===Ue&&ti.featureId===St?ti:{layerId:Ue,featureId:St,layer:$n,reason:xt}),r?.(Ue,Dt,ei,xt)},[p,r]),C=R.useRef(void 0),[O,V]=NZ(e,o),[A,G]=R.useState(!1),N=R.useCallback(Ue=>{G(!!Ue)},[]),[k,P]=NZ(t||"default",s);R.useEffect(()=>{k==="default"&&h?.current?.engine?.setCursor("auto")},[k]);const w=N0[k??"default"],x=R.useRef(void 0),I=R.useCallback(Ue=>{x.current=Ue},[]),X=R.useCallback(Ue=>{x.current?.(Ue)},[]),D=R.useRef(void 0),Y=R.useCallback(Ue=>{D.current=Ue},[]),H=R.useCallback(Ue=>{D.current?.(Ue)},[]),J=R.useRef(void 0),z=R.useCallback(Ue=>{J.current=Ue},[]),W=R.useCallback(Ue=>{J.current?.(Ue)},[]),Q=R.useRef(void 0),q=R.useCallback(Ue=>{Q.current=Ue},[]),oe=R.useCallback(Ue=>{Q.current?.(Ue)},[]),Ee=R.useRef(void 0),be=R.useCallback(Ue=>{Ee.current=Ue},[]),Ae=R.useCallback(Ue=>{Ee.current?.(Ue)},[]),Pe=R.useRef(void 0),fe=R.useCallback(Ue=>{Pe.current=Ue},[]),Xe=R.useCallback(Ue=>{Pe.current?.(Ue)},[]),tt=R.useRef([]),nt=R.useCallback(Ue=>{tt.current.push(Ue)},[]),Z=R.useCallback(Ue=>{tt.current.forEach(St=>St(Ue))},[]),pe=R.useRef([]),ue=R.useCallback(Ue=>{pe.current.push(Ue)},[]),$=R.useCallback(Ue=>{pe.current.forEach(St=>St(Ue))},[]),j=R.useRef([]),te=R.useCallback(Ue=>{j.current.push(Ue)},[]),le=R.useCallback(Ue=>{j.current.forEach(St=>St(Ue))},[]),ge=R.useRef([]),ee=R.useCallback(Ue=>{ge.current.push(Ue)},[]),he=R.useCallback((Ue,St)=>{ge.current.forEach(Dt=>Dt(Ue)),l?.(Ue,St)},[l]);R.useEffect(()=>{n&&(h.current?.engine?.lookAtLayer(n),a?.(void 0))},[n,a]);const[Ie,_e]=R.useState(!1),De=R.useCallback(()=>{_e(!0)},[]),Be=R.useCallback((Ue,St,Dt)=>{_e(!1);const xt=h.current?.layers.findById(Ue),mn=xt?.property.default.location?"default.location":xt?.property.default.position?"default.position":void 0;Dt&&xt&&xt.propertyId&&mn&&c?.(xt.propertyId,mn,Dt)},[c,h]),Je=R.useMemo(()=>({interactionMode:k,selectedLayer:p,selectedComputedFeature:v,viewport:f,handleCameraForceHorizontalRollChange:N,handleInteractionModeChange:P,onSketchPluginFeatureCreate:nt,onSketchPluginFeatureUpdate:ue,onSketchPluginFeatureDelete:te,onSketchTypeChange:ee,onLayerVisibility:Y,onLayerLoad:z,onLayerEdit:I,onLayerSelectWithRectStart:q,onLayerSelectWithRectMove:be,onLayerSelectWithRectEnd:fe}),[k,p,v,f,P,N,I,nt,ue,te,ee,Y,z,q,be,fe]),Nt=R.useMemo(()=>({position:"relative",width:"100%",height:"100%",overflow:"hidden"}),[]);return xFe({viewerProperty:i}),{mapRef:h,wrapperRef:d,selectedFeature:y,camera:O,featureFlags:w,isLayerDragging:Ie,timelineManagerRef:C,cameraForceHorizontalRoll:A,coreContextValue:Je,containerStyle:Nt,overriddenInteractionMode:k,handleLayerSelect:E,handleLayerDrag:De,handleLayerDrop:Be,handleLayerEdit:X,handleCameraChange:V,handleInteractionModeChange:P,handleSketchPluginFeatureCreate:Z,handleSketchPluginFeatureUpdate:$,handleSketchPluginFeatureDelete:le,handleSketchTypeChange:he,handleLayerVisibility:H,handleLayerLoad:W,handleLayerSelectWithRectStart:oe,handleLayerSelectWithRectMove:Ae,handleLayerSelectWithRectEnd:Xe}}function NZ(e,t){const[n,i]=R.useState(e),r=R.useCallback(o=>{o&&(i(o),t?.(o))},[t]);return R.useEffect(()=>{i(e)},[e]),[n,r]}const RFe=R.memo(R.forwardRef(({engine:e,isBuilt:t,isEditable:n,viewerProperty:i,layers:r,clusters:o,small:s,ready:a,hiddenLayers:c,camera:l,time:u,interactionMode:h,shouldRender:d,meta:f,customProvider:p,displayCredits:m=!0,style:y,zoomedLayerId:g,children:v,onLayerDrop:S,onLayerSelect:E,onCameraChange:C,onZoomToLayer:O,onInteractionModeChange:V,onMount:A,onSketchTypeChangeProp:G,onSketchFeatureCreate:N,onSketchFeatureUpdate:k,onSketchFeatureDelete:P,onAPIReady:w,onCreditsUpdate:x},I)=>{const{mapRef:X,wrapperRef:D,selectedFeature:Y,camera:H,featureFlags:J,isLayerDragging:z,timelineManagerRef:W,cameraForceHorizontalRoll:Q,coreContextValue:q,containerStyle:oe,overriddenInteractionMode:Ee,handleLayerSelect:be,handleLayerDrag:Ae,handleLayerDrop:Pe,handleLayerEdit:fe,handleCameraChange:Xe,handleInteractionModeChange:tt,handleSketchPluginFeatureCreate:nt,handleSketchPluginFeatureUpdate:Z,handleSketchPluginFeatureDelete:pe,handleSketchTypeChange:ue,handleLayerVisibility:$,handleLayerLoad:j,handleLayerSelectWithRectStart:te,handleLayerSelectWithRectMove:le,handleLayerSelectWithRectEnd:ge}=CFe({camera:l,interactionMode:h,zoomedLayerId:g,viewerProperty:i,onLayerSelect:E,onCameraChange:C,onZoomToLayer:O,onLayerDrop:S,onInteractionModeChange:V,onSketchTypeChangeProp:G},I);return ce.jsx(Foe,{FallbackComponent:vFe,children:ce.jsx(koe,{mapRef:X,children:ce.jsxs("div",{ref:D,style:oe,children:[ce.jsx(d5,{ref:X,isBuilt:t,isEditable:n,engine:e,layers:r,engines:zZ,camera:H,cameraForceHorizontalRoll:Q,clusters:o,hiddenLayers:c,isLayerDragging:z,isLayerDraggable:n,meta:f,customProvider:p,displayCredits:m,style:y,featureFlags:J,shouldRender:d,property:i,time:u,small:s,ready:a,timelineManagerRef:W,interactionMode:Ee,selectedFeature:Y,onCameraChange:Xe,onLayerDrag:Ae,onLayerDrop:Pe,onLayerSelect:be,onLayerEdit:fe,overrideInteractionMode:tt,onSketchFeatureCreate:N,onSketchPluginFeatureCreate:nt,onSketchFeatureUpdate:k,onSketchPluginFeatureUpdate:Z,onSketchFeatureDelete:P,onSketchPluginFeatureDelete:pe,onSketchTypeChange:ue,onMount:A,onLayerVisibility:$,onLayerLoad:j,onLayerSelectWithRectStart:te,onLayerSelectWithRectMove:le,onLayerSelectWithRectEnd:ge,onAPIReady:w,onCreditsUpdate:x}),ce.jsx(p5.Provider,{value:q,children:v})]})})})}));var cd=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},sa=[],Zo=[],IFe=typeof Uint8Array<"u"?Uint8Array:Array,GT=!1;function kZ(){GT=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,n=e.length;t<n;++t)sa[t]=e[t],Zo[e.charCodeAt(t)]=t;Zo[45]=62,Zo[95]=63}function MFe(e){GT||kZ();var t,n,i,r,o,s,a=e.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=e[a-2]==="="?2:e[a-1]==="="?1:0,s=new IFe(a*3/4-o),i=o>0?a-4:a;var c=0;for(t=0,n=0;t<i;t+=4,n+=3)r=Zo[e.charCodeAt(t)]<<18|Zo[e.charCodeAt(t+1)]<<12|Zo[e.charCodeAt(t+2)]<<6|Zo[e.charCodeAt(t+3)],s[c++]=r>>16&255,s[c++]=r>>8&255,s[c++]=r&255;return o===2?(r=Zo[e.charCodeAt(t)]<<2|Zo[e.charCodeAt(t+1)]>>4,s[c++]=r&255):o===1&&(r=Zo[e.charCodeAt(t)]<<10|Zo[e.charCodeAt(t+1)]<<4|Zo[e.charCodeAt(t+2)]>>2,s[c++]=r>>8&255,s[c++]=r&255),s}function LFe(e){return sa[e>>18&63]+sa[e>>12&63]+sa[e>>6&63]+sa[e&63]}function PFe(e,t,n){for(var i,r=[],o=t;o<n;o+=3)i=(e[o]<<16)+(e[o+1]<<8)+e[o+2],r.push(LFe(i));return r.join("")}function XZ(e){GT||kZ();for(var t,n=e.length,i=n%3,r="",o=[],s=16383,a=0,c=n-i;a<c;a+=s)o.push(PFe(e,a,a+s>c?c:a+s));return i===1?(t=e[n-1],r+=sa[t>>2],r+=sa[t<<4&63],r+="=="):i===2&&(t=(e[n-2]<<8)+e[n-1],r+=sa[t>>10],r+=sa[t>>4&63],r+=sa[t<<2&63],r+="="),o.push(r),o.join("")}function o1(e,t,n,i,r){var o,s,a=r*8-i-1,c=(1<<a)-1,l=c>>1,u=-7,h=n?r-1:0,d=n?-1:1,f=e[t+h];for(h+=d,o=f&(1<<-u)-1,f>>=-u,u+=a;u>0;o=o*256+e[t+h],h+=d,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=i;u>0;s=s*256+e[t+h],h+=d,u-=8);if(o===0)o=1-l;else{if(o===c)return s?NaN:(f?-1:1)*(1/0);s=s+Math.pow(2,i),o=o-l}return(f?-1:1)*s*Math.pow(2,o-i)}function ZZ(e,t,n,i,r,o){var s,a,c,l=o*8-r-1,u=(1<<l)-1,h=u>>1,d=r===23?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:o-1,p=i?1:-1,m=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),s+h>=1?t+=d/c:t+=d*Math.pow(2,1-h),t*c>=2&&(s++,c/=2),s+h>=u?(a=0,s=u):s+h>=1?(a=(t*c-1)*Math.pow(2,r),s=s+h):(a=t*Math.pow(2,h-1)*Math.pow(2,r),s=0));r>=8;e[n+f]=a&255,f+=p,a/=256,r-=8);for(s=s<<r|a,l+=r;l>0;e[n+f]=s&255,f+=p,s/=256,l-=8);e[n+f-p]|=m*128}var OFe={}.toString,DZ=Array.isArray||function(e){return OFe.call(e)=="[object Array]"},GFe=50;ve.TYPED_ARRAY_SUPPORT=cd.TYPED_ARRAY_SUPPORT!==void 0?cd.TYPED_ARRAY_SUPPORT:!0,s1();function s1(){return ve.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Ba(e,t){if(s1()<t)throw new RangeError("Invalid typed array length");return ve.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t),e.__proto__=ve.prototype):(e===null&&(e=new ve(t)),e.length=t),e}function ve(e,t,n){if(!ve.TYPED_ARRAY_SUPPORT&&!(this instanceof ve))return new ve(e,t,n);if(typeof e=="number"){if(typeof t=="string")throw new Error("If encoding is specified then the first argument must be a string");return VT(this,e)}return UZ(this,e,t,n)}ve.poolSize=8192,ve._augment=function(e){return e.__proto__=ve.prototype,e};function UZ(e,t,n,i){if(typeof t=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&t instanceof ArrayBuffer?AFe(e,t,n,i):typeof t=="string"?FFe(e,t,n):zFe(e,t)}ve.from=function(e,t,n){return UZ(null,e,t,n)},ve.TYPED_ARRAY_SUPPORT&&(ve.prototype.__proto__=Uint8Array.prototype,ve.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&ve[Symbol.species]);function WZ(e){if(typeof e!="number")throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function VFe(e,t,n,i){return WZ(t),t<=0?Ba(e,t):n!==void 0?typeof i=="string"?Ba(e,t).fill(n,i):Ba(e,t).fill(n):Ba(e,t)}ve.alloc=function(e,t,n){return VFe(null,e,t,n)};function VT(e,t){if(WZ(t),e=Ba(e,t<0?0:AT(t)|0),!ve.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}ve.allocUnsafe=function(e){return VT(null,e)},ve.allocUnsafeSlow=function(e){return VT(null,e)};function FFe(e,t,n){if((typeof n!="string"||n==="")&&(n="utf8"),!ve.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var i=BZ(t,n)|0;e=Ba(e,i);var r=e.write(t,n);return r!==i&&(e=e.slice(0,r)),e}function FT(e,t){var n=t.length<0?0:AT(t.length)|0;e=Ba(e,n);for(var i=0;i<n;i+=1)e[i]=t[i]&255;return e}function AFe(e,t,n,i){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(i||0))throw new RangeError("'length' is out of bounds");return n===void 0&&i===void 0?t=new Uint8Array(t):i===void 0?t=new Uint8Array(t,n):t=new Uint8Array(t,n,i),ve.TYPED_ARRAY_SUPPORT?(e=t,e.__proto__=ve.prototype):e=FT(e,t),e}function zFe(e,t){if(aa(t)){var n=AT(t.length)|0;return e=Ba(e,n),e.length===0||t.copy(e,0,0,n),e}if(t){if(typeof ArrayBuffer<"u"&&t.buffer instanceof ArrayBuffer||"length"in t)return typeof t.length!="number"||n4e(t.length)?Ba(e,0):FT(e,t);if(t.type==="Buffer"&&DZ(t.data))return FT(e,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function AT(e){if(e>=s1())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s1().toString(16)+" bytes");return e|0}ve.isBuffer=jr;function aa(e){return!!(e!=null&&e._isBuffer)}ve.compare=function(t,n){if(!aa(t)||!aa(n))throw new TypeError("Arguments must be Buffers");if(t===n)return 0;for(var i=t.length,r=n.length,o=0,s=Math.min(i,r);o<s;++o)if(t[o]!==n[o]){i=t[o],r=n[o];break}return i<r?-1:r<i?1:0},ve.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},ve.concat=function(t,n){if(!DZ(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return ve.alloc(0);var i;if(n===void 0)for(n=0,i=0;i<t.length;++i)n+=t[i].length;var r=ve.allocUnsafe(n),o=0;for(i=0;i<t.length;++i){var s=t[i];if(!aa(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,o),o+=s.length}return r};function BZ(e,t){if(aa(e))return e.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;typeof e!="string"&&(e=""+e);var n=e.length;if(n===0)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return l1(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return eD(e).length;default:if(i)return l1(e).length;t=(""+t).toLowerCase(),i=!0}}ve.byteLength=BZ;function NFe(e,t,n){var i=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return jFe(this,t,n);case"utf8":case"utf-8":return KZ(this,t,n);case"ascii":return YFe(this,t,n);case"latin1":case"binary":return HFe(this,t,n);case"base64":return WFe(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return KFe(this,t,n);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}ve.prototype._isBuffer=!0;function ru(e,t,n){var i=e[t];e[t]=e[n],e[n]=i}ve.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var n=0;n<t;n+=2)ru(this,n,n+1);return this},ve.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var n=0;n<t;n+=4)ru(this,n,n+3),ru(this,n+1,n+2);return this},ve.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var n=0;n<t;n+=8)ru(this,n,n+7),ru(this,n+1,n+6),ru(this,n+2,n+5),ru(this,n+3,n+4);return this},ve.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?KZ(this,0,t):NFe.apply(this,arguments)},ve.prototype.equals=function(t){if(!aa(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:ve.compare(this,t)===0},ve.prototype.inspect=function(){var t="",n=GFe;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),"<Buffer "+t+">"},ve.prototype.compare=function(t,n,i,r,o){if(!aa(t))throw new TypeError("Argument must be a Buffer");if(n===void 0&&(n=0),i===void 0&&(i=t?t.length:0),r===void 0&&(r=0),o===void 0&&(o=this.length),n<0||i>t.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&n>=i)return 0;if(r>=o)return-1;if(n>=i)return 1;if(n>>>=0,i>>>=0,r>>>=0,o>>>=0,this===t)return 0;for(var s=o-r,a=i-n,c=Math.min(s,a),l=this.slice(r,o),u=t.slice(n,i),h=0;h<c;++h)if(l[h]!==u[h]){s=l[h],a=u[h];break}return s<a?-1:a<s?1:0};function YZ(e,t,n,i,r){if(e.length===0)return-1;if(typeof n=="string"?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=r?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(r)return-1;n=e.length-1}else if(n<0)if(r)n=0;else return-1;if(typeof t=="string"&&(t=ve.from(t,i)),aa(t))return t.length===0?-1:HZ(e,t,n,i,r);if(typeof t=="number")return t=t&255,ve.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?r?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):HZ(e,[t],n,i,r);throw new TypeError("val must be string, number or Buffer")}function HZ(e,t,n,i,r){var o=1,s=e.length,a=t.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(e.length<2||t.length<2)return-1;o=2,s/=2,a/=2,n/=2}function c(f,p){return o===1?f[p]:f.readUInt16BE(p*o)}var l;if(r){var u=-1;for(l=n;l<s;l++)if(c(e,l)===c(t,u===-1?0:l-u)){if(u===-1&&(u=l),l-u+1===a)return u*o}else u!==-1&&(l-=l-u),u=-1}else for(n+a>s&&(n=s-a),l=n;l>=0;l--){for(var h=!0,d=0;d<a;d++)if(c(e,l+d)!==c(t,d)){h=!1;break}if(h)return l}return-1}ve.prototype.includes=function(t,n,i){return this.indexOf(t,n,i)!==-1},ve.prototype.indexOf=function(t,n,i){return YZ(this,t,n,i,!0)},ve.prototype.lastIndexOf=function(t,n,i){return YZ(this,t,n,i,!1)};function kFe(e,t,n,i){n=Number(n)||0;var r=e.length-n;i?(i=Number(i),i>r&&(i=r)):i=r;var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");i>o/2&&(i=o/2);for(var s=0;s<i;++s){var a=parseInt(t.substr(s*2,2),16);if(isNaN(a))return s;e[n+s]=a}return s}function XFe(e,t,n,i){return u1(l1(t,e.length-n),e,n,i)}function jZ(e,t,n,i){return u1(e4e(t),e,n,i)}function ZFe(e,t,n,i){return jZ(e,t,n,i)}function DFe(e,t,n,i){return u1(eD(t),e,n,i)}function UFe(e,t,n,i){return u1(t4e(t,e.length-n),e,n,i)}ve.prototype.write=function(t,n,i,r){if(n===void 0)r="utf8",i=this.length,n=0;else if(i===void 0&&typeof n=="string")r=n,i=this.length,n=0;else if(isFinite(n))n=n|0,isFinite(i)?(i=i|0,r===void 0&&(r="utf8")):(r=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-n;if((i===void 0||i>o)&&(i=o),t.length>0&&(i<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var s=!1;;)switch(r){case"hex":return kFe(this,t,n,i);case"utf8":case"utf-8":return XFe(this,t,n,i);case"ascii":return jZ(this,t,n,i);case"latin1":case"binary":return ZFe(this,t,n,i);case"base64":return DFe(this,t,n,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return UFe(this,t,n,i);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),s=!0}},ve.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function WFe(e,t,n){return t===0&&n===e.length?XZ(e):XZ(e.slice(t,n))}function KZ(e,t,n){n=Math.min(e.length,n);for(var i=[],r=t;r<n;){var o=e[r],s=null,a=o>239?4:o>223?3:o>191?2:1;if(r+a<=n){var c,l,u,h;switch(a){case 1:o<128&&(s=o);break;case 2:c=e[r+1],(c&192)===128&&(h=(o&31)<<6|c&63,h>127&&(s=h));break;case 3:c=e[r+1],l=e[r+2],(c&192)===128&&(l&192)===128&&(h=(o&15)<<12|(c&63)<<6|l&63,h>2047&&(h<55296||h>57343)&&(s=h));break;case 4:c=e[r+1],l=e[r+2],u=e[r+3],(c&192)===128&&(l&192)===128&&(u&192)===128&&(h=(o&15)<<18|(c&63)<<12|(l&63)<<6|u&63,h>65535&&h<1114112&&(s=h))}}s===null?(s=65533,a=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|s&1023),i.push(s),r+=a}return BFe(i)}var JZ=4096;function BFe(e){var t=e.length;if(t<=JZ)return String.fromCharCode.apply(String,e);for(var n="",i=0;i<t;)n+=String.fromCharCode.apply(String,e.slice(i,i+=JZ));return n}function YFe(e,t,n){var i="";n=Math.min(e.length,n);for(var r=t;r<n;++r)i+=String.fromCharCode(e[r]&127);return i}function HFe(e,t,n){var i="";n=Math.min(e.length,n);for(var r=t;r<n;++r)i+=String.fromCharCode(e[r]);return i}function jFe(e,t,n){var i=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>i)&&(n=i);for(var r="",o=t;o<n;++o)r+=$Fe(e[o]);return r}function KFe(e,t,n){for(var i=e.slice(t,n),r="",o=0;o<i.length;o+=2)r+=String.fromCharCode(i[o]+i[o+1]*256);return r}ve.prototype.slice=function(t,n){var i=this.length;t=~~t,n=n===void 0?i:~~n,t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),n<0?(n+=i,n<0&&(n=0)):n>i&&(n=i),n<t&&(n=t);var r;if(ve.TYPED_ARRAY_SUPPORT)r=this.subarray(t,n),r.__proto__=ve.prototype;else{var o=n-t;r=new ve(o,void 0);for(var s=0;s<o;++s)r[s]=this[s+t]}return r};function Mi(e,t,n){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}ve.prototype.readUIntLE=function(t,n,i){t=t|0,n=n|0,i||Mi(t,n,this.length);for(var r=this[t],o=1,s=0;++s<n&&(o*=256);)r+=this[t+s]*o;return r},ve.prototype.readUIntBE=function(t,n,i){t=t|0,n=n|0,i||Mi(t,n,this.length);for(var r=this[t+--n],o=1;n>0&&(o*=256);)r+=this[t+--n]*o;return r},ve.prototype.readUInt8=function(t,n){return n||Mi(t,1,this.length),this[t]},ve.prototype.readUInt16LE=function(t,n){return n||Mi(t,2,this.length),this[t]|this[t+1]<<8},ve.prototype.readUInt16BE=function(t,n){return n||Mi(t,2,this.length),this[t]<<8|this[t+1]},ve.prototype.readUInt32LE=function(t,n){return n||Mi(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216},ve.prototype.readUInt32BE=function(t,n){return n||Mi(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])},ve.prototype.readIntLE=function(t,n,i){t=t|0,n=n|0,i||Mi(t,n,this.length);for(var r=this[t],o=1,s=0;++s<n&&(o*=256);)r+=this[t+s]*o;return o*=128,r>=o&&(r-=Math.pow(2,8*n)),r},ve.prototype.readIntBE=function(t,n,i){t=t|0,n=n|0,i||Mi(t,n,this.length);for(var r=n,o=1,s=this[t+--r];r>0&&(o*=256);)s+=this[t+--r]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*n)),s},ve.prototype.readInt8=function(t,n){return n||Mi(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]},ve.prototype.readInt16LE=function(t,n){n||Mi(t,2,this.length);var i=this[t]|this[t+1]<<8;return i&32768?i|4294901760:i},ve.prototype.readInt16BE=function(t,n){n||Mi(t,2,this.length);var i=this[t+1]|this[t]<<8;return i&32768?i|4294901760:i},ve.prototype.readInt32LE=function(t,n){return n||Mi(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},ve.prototype.readInt32BE=function(t,n){return n||Mi(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},ve.prototype.readFloatLE=function(t,n){return n||Mi(t,4,this.length),o1(this,t,!0,23,4)},ve.prototype.readFloatBE=function(t,n){return n||Mi(t,4,this.length),o1(this,t,!1,23,4)},ve.prototype.readDoubleLE=function(t,n){return n||Mi(t,8,this.length),o1(this,t,!0,52,8)},ve.prototype.readDoubleBE=function(t,n){return n||Mi(t,8,this.length),o1(this,t,!1,52,8)};function Hr(e,t,n,i,r,o){if(!aa(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>r||t<o)throw new RangeError('"value" argument is out of bounds');if(n+i>e.length)throw new RangeError("Index out of range")}ve.prototype.writeUIntLE=function(t,n,i,r){if(t=+t,n=n|0,i=i|0,!r){var o=Math.pow(2,8*i)-1;Hr(this,t,n,i,o,0)}var s=1,a=0;for(this[n]=t&255;++a<i&&(s*=256);)this[n+a]=t/s&255;return n+i},ve.prototype.writeUIntBE=function(t,n,i,r){if(t=+t,n=n|0,i=i|0,!r){var o=Math.pow(2,8*i)-1;Hr(this,t,n,i,o,0)}var s=i-1,a=1;for(this[n+s]=t&255;--s>=0&&(a*=256);)this[n+s]=t/a&255;return n+i},ve.prototype.writeUInt8=function(t,n,i){return t=+t,n=n|0,i||Hr(this,t,n,1,255,0),ve.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[n]=t&255,n+1};function a1(e,t,n,i){t<0&&(t=65535+t+1);for(var r=0,o=Math.min(e.length-n,2);r<o;++r)e[n+r]=(t&255<<8*(i?r:1-r))>>>(i?r:1-r)*8}ve.prototype.writeUInt16LE=function(t,n,i){return t=+t,n=n|0,i||Hr(this,t,n,2,65535,0),ve.TYPED_ARRAY_SUPPORT?(this[n]=t&255,this[n+1]=t>>>8):a1(this,t,n,!0),n+2},ve.prototype.writeUInt16BE=function(t,n,i){return t=+t,n=n|0,i||Hr(this,t,n,2,65535,0),ve.TYPED_ARRAY_SUPPORT?(this[n]=t>>>8,this[n+1]=t&255):a1(this,t,n,!1),n+2};function c1(e,t,n,i){t<0&&(t=4294967295+t+1);for(var r=0,o=Math.min(e.length-n,4);r<o;++r)e[n+r]=t>>>(i?r:3-r)*8&255}ve.prototype.writeUInt32LE=function(t,n,i){return t=+t,n=n|0,i||Hr(this,t,n,4,4294967295,0),ve.TYPED_ARRAY_SUPPORT?(this[n+3]=t>>>24,this[n+2]=t>>>16,this[n+1]=t>>>8,this[n]=t&255):c1(this,t,n,!0),n+4},ve.prototype.writeUInt32BE=function(t,n,i){return t=+t,n=n|0,i||Hr(this,t,n,4,4294967295,0),ve.TYPED_ARRAY_SUPPORT?(this[n]=t>>>24,this[n+1]=t>>>16,this[n+2]=t>>>8,this[n+3]=t&255):c1(this,t,n,!1),n+4},ve.prototype.writeIntLE=function(t,n,i,r){if(t=+t,n=n|0,!r){var o=Math.pow(2,8*i-1);Hr(this,t,n,i,o-1,-o)}var s=0,a=1,c=0;for(this[n]=t&255;++s<i&&(a*=256);)t<0&&c===0&&this[n+s-1]!==0&&(c=1),this[n+s]=(t/a>>0)-c&255;return n+i},ve.prototype.writeIntBE=function(t,n,i,r){if(t=+t,n=n|0,!r){var o=Math.pow(2,8*i-1);Hr(this,t,n,i,o-1,-o)}var s=i-1,a=1,c=0;for(this[n+s]=t&255;--s>=0&&(a*=256);)t<0&&c===0&&this[n+s+1]!==0&&(c=1),this[n+s]=(t/a>>0)-c&255;return n+i},ve.prototype.writeInt8=function(t,n,i){return t=+t,n=n|0,i||Hr(this,t,n,1,127,-128),ve.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[n]=t&255,n+1},ve.prototype.writeInt16LE=function(t,n,i){return t=+t,n=n|0,i||Hr(this,t,n,2,32767,-32768),ve.TYPED_ARRAY_SUPPORT?(this[n]=t&255,this[n+1]=t>>>8):a1(this,t,n,!0),n+2},ve.prototype.writeInt16BE=function(t,n,i){return t=+t,n=n|0,i||Hr(this,t,n,2,32767,-32768),ve.TYPED_ARRAY_SUPPORT?(this[n]=t>>>8,this[n+1]=t&255):a1(this,t,n,!1),n+2},ve.prototype.writeInt32LE=function(t,n,i){return t=+t,n=n|0,i||Hr(this,t,n,4,2147483647,-2147483648),ve.TYPED_ARRAY_SUPPORT?(this[n]=t&255,this[n+1]=t>>>8,this[n+2]=t>>>16,this[n+3]=t>>>24):c1(this,t,n,!0),n+4},ve.prototype.writeInt32BE=function(t,n,i){return t=+t,n=n|0,i||Hr(this,t,n,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),ve.TYPED_ARRAY_SUPPORT?(this[n]=t>>>24,this[n+1]=t>>>16,this[n+2]=t>>>8,this[n+3]=t&255):c1(this,t,n,!1),n+4};function QZ(e,t,n,i,r,o){if(n+i>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function qZ(e,t,n,i,r){return r||QZ(e,t,n,4),ZZ(e,t,n,i,23,4),n+4}ve.prototype.writeFloatLE=function(t,n,i){return qZ(this,t,n,!0,i)},ve.prototype.writeFloatBE=function(t,n,i){return qZ(this,t,n,!1,i)};function $Z(e,t,n,i,r){return r||QZ(e,t,n,8),ZZ(e,t,n,i,52,8),n+8}ve.prototype.writeDoubleLE=function(t,n,i){return $Z(this,t,n,!0,i)},ve.prototype.writeDoubleBE=function(t,n,i){return $Z(this,t,n,!1,i)},ve.prototype.copy=function(t,n,i,r){if(i||(i=0),!r&&r!==0&&(r=this.length),n>=t.length&&(n=t.length),n||(n=0),r>0&&r<i&&(r=i),r===i||t.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-n<r-i&&(r=t.length-n+i);var o=r-i,s;if(this===t&&i<n&&n<r)for(s=o-1;s>=0;--s)t[s+n]=this[s+i];else if(o<1e3||!ve.TYPED_ARRAY_SUPPORT)for(s=0;s<o;++s)t[s+n]=this[s+i];else Uint8Array.prototype.set.call(t,this.subarray(i,i+o),n);return o},ve.prototype.fill=function(t,n,i,r){if(typeof t=="string"){if(typeof n=="string"?(r=n,n=0,i=this.length):typeof i=="string"&&(r=i,i=this.length),t.length===1){var o=t.charCodeAt(0);o<256&&(t=o)}if(r!==void 0&&typeof r!="string")throw new TypeError("encoding must be a string");if(typeof r=="string"&&!ve.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else typeof t=="number"&&(t=t&255);if(n<0||this.length<n||this.length<i)throw new RangeError("Out of range index");if(i<=n)return this;n=n>>>0,i=i===void 0?this.length:i>>>0,t||(t=0);var s;if(typeof t=="number")for(s=n;s<i;++s)this[s]=t;else{var a=aa(t)?t:l1(new ve(t,r).toString()),c=a.length;for(s=0;s<i-n;++s)this[s+n]=a[s%c]}return this};var JFe=/[^+\/0-9A-Za-z-_]/g;function QFe(e){if(e=qFe(e).replace(JFe,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function qFe(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function $Fe(e){return e<16?"0"+e.toString(16):e.toString(16)}function l1(e,t){t=t||1/0;for(var n,i=e.length,r=null,o=[],s=0;s<i;++s){if(n=e.charCodeAt(s),n>55295&&n<57344){if(!r){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(s+1===i){(t-=3)>-1&&o.push(239,191,189);continue}r=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),r=n;continue}n=(r-55296<<10|n-56320)+65536}else r&&(t-=3)>-1&&o.push(239,191,189);if(r=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return o}function e4e(e){for(var t=[],n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function t4e(e,t){for(var n,i,r,o=[],s=0;s<e.length&&!((t-=2)<0);++s)n=e.charCodeAt(s),i=n>>8,r=n%256,o.push(r),o.push(i);return o}function eD(e){return MFe(QFe(e))}function u1(e,t,n,i){for(var r=0;r<i&&!(r+n>=t.length||r>=e.length);++r)t[r+n]=e[r];return r}function n4e(e){return e!==e}function jr(e){return e!=null&&(!!e._isBuffer||tD(e)||i4e(e))}function tD(e){return!!e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}function i4e(e){return typeof e.readFloatLE=="function"&&typeof e.slice=="function"&&tD(e.slice(0,0))}var zT;function Kc(){}Kc.prototype=Object.create(null);function Bt(){Bt.init.call(this)}Bt.EventEmitter=Bt,Bt.usingDomains=!1,Bt.prototype.domain=void 0,Bt.prototype._events=void 0,Bt.prototype._maxListeners=void 0,Bt.defaultMaxListeners=10,Bt.init=function(){this.domain=null,Bt.usingDomains&&zT.active&&!(this instanceof zT.Domain)&&(this.domain=zT.active),(!this._events||this._events===Object.getPrototypeOf(this)._events)&&(this._events=new Kc,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Bt.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||isNaN(t))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=t,this};function nD(e){return e._maxListeners===void 0?Bt.defaultMaxListeners:e._maxListeners}Bt.prototype.getMaxListeners=function(){return nD(this)};function r4e(e,t,n){if(t)e.call(n);else for(var i=e.length,r=M0(e,i),o=0;o<i;++o)r[o].call(n)}function o4e(e,t,n,i){if(t)e.call(n,i);else for(var r=e.length,o=M0(e,r),s=0;s<r;++s)o[s].call(n,i)}function s4e(e,t,n,i,r){if(t)e.call(n,i,r);else for(var o=e.length,s=M0(e,o),a=0;a<o;++a)s[a].call(n,i,r)}function a4e(e,t,n,i,r,o){if(t)e.call(n,i,r,o);else for(var s=e.length,a=M0(e,s),c=0;c<s;++c)a[c].call(n,i,r,o)}function c4e(e,t,n,i){if(t)e.apply(n,i);else for(var r=e.length,o=M0(e,r),s=0;s<r;++s)o[s].apply(n,i)}Bt.prototype.emit=function(t){var n,i,r,o,s,a,c,l=t==="error";if(a=this._events,a)l=l&&a.error==null;else if(!l)return!1;if(c=this.domain,l){if(n=arguments[1],c)n||(n=new Error('Uncaught, unspecified "error" event')),n.domainEmitter=this,n.domain=c,n.domainThrown=!1,c.emit("error",n);else{if(n instanceof Error)throw n;var u=new Error('Uncaught, unspecified "error" event. ('+n+")");throw u.context=n,u}return!1}if(i=a[t],!i)return!1;var h=typeof i=="function";switch(r=arguments.length,r){case 1:r4e(i,h,this);break;case 2:o4e(i,h,this,arguments[1]);break;case 3:s4e(i,h,this,arguments[1],arguments[2]);break;case 4:a4e(i,h,this,arguments[1],arguments[2],arguments[3]);break;default:for(o=new Array(r-1),s=1;s<r;s++)o[s-1]=arguments[s];c4e(i,h,this,o)}return!0};function iD(e,t,n,i){var r,o,s;if(typeof n!="function")throw new TypeError('"listener" argument must be a function');if(o=e._events,o?(o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),s=o[t]):(o=e._events=new Kc,e._eventsCount=0),!s)s=o[t]=n,++e._eventsCount;else if(typeof s=="function"?s=o[t]=i?[n,s]:[s,n]:i?s.unshift(n):s.push(n),!s.warned&&(r=nD(e),r&&r>0&&s.length>r)){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=s.length,l4e(a)}return e}function l4e(e){typeof console.warn=="function"?console.warn(e):console.log(e)}Bt.prototype.addListener=function(t,n){return iD(this,t,n,!1)},Bt.prototype.on=Bt.prototype.addListener,Bt.prototype.prependListener=function(t,n){return iD(this,t,n,!0)};function rD(e,t,n){var i=!1;function r(){e.removeListener(t,r),i||(i=!0,n.apply(e,arguments))}return r.listener=n,r}Bt.prototype.once=function(t,n){if(typeof n!="function")throw new TypeError('"listener" argument must be a function');return this.on(t,rD(this,t,n)),this},Bt.prototype.prependOnceListener=function(t,n){if(typeof n!="function")throw new TypeError('"listener" argument must be a function');return this.prependListener(t,rD(this,t,n)),this},Bt.prototype.removeListener=function(t,n){var i,r,o,s,a;if(typeof n!="function")throw new TypeError('"listener" argument must be a function');if(r=this._events,!r)return this;if(i=r[t],!i)return this;if(i===n||i.listener&&i.listener===n)--this._eventsCount===0?this._events=new Kc:(delete r[t],r.removeListener&&this.emit("removeListener",t,i.listener||n));else if(typeof i!="function"){for(o=-1,s=i.length;s-- >0;)if(i[s]===n||i[s].listener&&i[s].listener===n){a=i[s].listener,o=s;break}if(o<0)return this;if(i.length===1){if(i[0]=void 0,--this._eventsCount===0)return this._events=new Kc,this;delete r[t]}else u4e(i,o);r.removeListener&&this.emit("removeListener",t,a||n)}return this},Bt.prototype.removeAllListeners=function(t){var n,i;if(i=this._events,!i)return this;if(!i.removeListener)return arguments.length===0?(this._events=new Kc,this._eventsCount=0):i[t]&&(--this._eventsCount===0?this._events=new Kc:delete i[t]),this;if(arguments.length===0){for(var r=Object.keys(i),o=0,s;o<r.length;++o)s=r[o],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=new Kc,this._eventsCount=0,this}if(n=i[t],typeof n=="function")this.removeListener(t,n);else if(n)do this.removeListener(t,n[n.length-1]);while(n[0]);return this},Bt.prototype.listeners=function(t){var n,i,r=this._events;return r?(n=r[t],n?typeof n=="function"?i=[n.listener||n]:i=h4e(n):i=[]):i=[],i},Bt.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):oD.call(e,t)},Bt.prototype.listenerCount=oD;function oD(e){var t=this._events;if(t){var n=t[e];if(typeof n=="function")return 1;if(n)return n.length}return 0}Bt.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};function u4e(e,t){for(var n=t,i=n+1,r=e.length;i<r;n+=1,i+=1)e[n]=e[i];e.pop()}function M0(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}function h4e(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function sD(){throw new Error("setTimeout has not been defined")}function aD(){throw new Error("clearTimeout has not been defined")}var Jc=sD,Qc=aD;typeof cd.setTimeout=="function"&&(Jc=setTimeout),typeof cd.clearTimeout=="function"&&(Qc=clearTimeout);function cD(e){if(Jc===setTimeout)return setTimeout(e,0);if((Jc===sD||!Jc)&&setTimeout)return Jc=setTimeout,setTimeout(e,0);try{return Jc(e,0)}catch{try{return Jc.call(null,e,0)}catch{return Jc.call(this,e,0)}}}function d4e(e){if(Qc===clearTimeout)return clearTimeout(e);if((Qc===aD||!Qc)&&clearTimeout)return Qc=clearTimeout,clearTimeout(e);try{return Qc(e)}catch{try{return Qc.call(null,e)}catch{return Qc.call(this,e)}}}var Ya=[],ld=!1,ou,h1=-1;function f4e(){!ld||!ou||(ld=!1,ou.length?Ya=ou.concat(Ya):h1=-1,Ya.length&&lD())}function lD(){if(!ld){var e=cD(f4e);ld=!0;for(var t=Ya.length;t;){for(ou=Ya,Ya=[];++h1<t;)ou&&ou[h1].run();h1=-1,t=Ya.length}ou=null,ld=!1,d4e(e)}}function Do(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];Ya.push(new uD(e,t)),Ya.length===1&&!ld&&cD(lD)}function uD(e,t){this.fun=e,this.array=t}uD.prototype.run=function(){this.fun.apply(null,this.array)};var p4e={},L0=cd.performance||{};L0.now||L0.mozNow||L0.msNow||L0.oNow||L0.webkitNow;var d1={env:p4e},NT;typeof Object.create=="function"?NT=function(t,n){t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:NT=function(t,n){t.super_=n;var i=function(){};i.prototype=n.prototype,t.prototype=new i,t.prototype.constructor=t};var ud=NT,m4e=/%[sdj%]/g;function g4e(e){if(!UT(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(qc(arguments[n]));return t.join(" ")}for(var n=1,i=arguments,r=i.length,o=String(e).replace(m4e,function(a){if(a==="%%")return"%";if(n>=r)return a;switch(a){case"%s":return String(i[n++]);case"%d":return Number(i[n++]);case"%j":try{return JSON.stringify(i[n++])}catch{return"[Circular]"}default:return a}}),s=i[n];n<r;s=i[++n])DT(s)||!P0(s)?o+=" "+s:o+=" "+qc(s);return o}function hD(e,t){if($c(cd.process))return function(){return hD(e,t).apply(this,arguments)};if(d1.noDeprecation===!0)return e;var n=!1;function i(){if(!n){if(d1.throwDeprecation)throw new Error(t);d1.traceDeprecation?console.trace(t):console.error(t),n=!0}return e.apply(this,arguments)}return i}var f1={},kT;function y4e(e){if($c(kT)&&(kT=d1.env.NODE_DEBUG||""),e=e.toUpperCase(),!f1[e])if(new RegExp("\\b"+e+"\\b","i").test(kT)){var t=0;f1[e]=function(){var n=g4e.apply(null,arguments);console.error("%s %d: %s",e,t,n)}}else f1[e]=function(){};return f1[e]}function qc(e,t){var n={seen:[],stylize:_4e};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),dD(t)?n.showHidden=t:t&&C4e(n,t),$c(n.showHidden)&&(n.showHidden=!1),$c(n.depth)&&(n.depth=2),$c(n.colors)&&(n.colors=!1),$c(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=b4e),p1(n,e,n.depth)}qc.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},qc.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function b4e(e,t){var n=qc.styles[t];return n?"\x1B["+qc.colors[n][0]+"m"+e+"\x1B["+qc.colors[n][1]+"m":e}function _4e(e,t){return e}function v4e(e){var t={};return e.forEach(function(n,i){t[n]=!0}),t}function p1(e,t,n){if(e.customInspect&&t&&YT(t.inspect)&&t.inspect!==qc&&!(t.constructor&&t.constructor.prototype===t)){var i=t.inspect(n,e);return UT(i)||(i=p1(e,i,n)),i}var r=w4e(e,t);if(r)return r;var o=Object.keys(t),s=v4e(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),BT(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return XT(t);if(o.length===0){if(YT(t)){var a=t.name?": "+t.name:"";return e.stylize("[Function"+a+"]","special")}if(WT(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(fD(t))return e.stylize(Date.prototype.toString.call(t),"date");if(BT(t))return XT(t)}var c="",l=!1,u=["{","}"];if(E4e(t)&&(l=!0,u=["[","]"]),YT(t)){var h=t.name?": "+t.name:"";c=" [Function"+h+"]"}if(WT(t)&&(c=" "+RegExp.prototype.toString.call(t)),fD(t)&&(c=" "+Date.prototype.toUTCString.call(t)),BT(t)&&(c=" "+XT(t)),o.length===0&&(!l||t.length==0))return u[0]+c+u[1];if(n<0)return WT(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var d;return l?d=x4e(e,t,n,s,o):d=o.map(function(f){return ZT(e,t,n,s,f,l)}),e.seen.pop(),S4e(d,c,u)}function w4e(e,t){if($c(t))return e.stylize("undefined","undefined");if(UT(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(T4e(t))return e.stylize(""+t,"number");if(dD(t))return e.stylize(""+t,"boolean");if(DT(t))return e.stylize("null","null")}function XT(e){return"["+Error.prototype.toString.call(e)+"]"}function x4e(e,t,n,i,r){for(var o=[],s=0,a=t.length;s<a;++s)pD(t,String(s))?o.push(ZT(e,t,n,i,String(s),!0)):o.push("");return r.forEach(function(c){c.match(/^\d+$/)||o.push(ZT(e,t,n,i,c,!0))}),o}function ZT(e,t,n,i,r,o){var s,a,c;if(c=Object.getOwnPropertyDescriptor(t,r)||{value:t[r]},c.get?c.set?a=e.stylize("[Getter/Setter]","special"):a=e.stylize("[Getter]","special"):c.set&&(a=e.stylize("[Setter]","special")),pD(i,r)||(s="["+r+"]"),a||(e.seen.indexOf(c.value)<0?(DT(n)?a=p1(e,c.value,null):a=p1(e,c.value,n-1),a.indexOf(`
6732
6732
  `)>-1&&(o?a=a.split(`
6733
6733
  `).map(function(l){return" "+l}).join(`
6734
6734
  `).substr(2):a=`