@reearth/core 0.0.7-alpha.37 → 0.0.7-alpha.38
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.js +9 -7
- package/dist/core.umd.cjs +3 -3
- package/dist/index.d.ts +12 -4
- package/package.json +1 -1
- package/src/Map/types/index.ts +11 -3
- package/src/Visualizer/index.tsx +2 -2
- package/src/engines/Cesium/common.ts +8 -7
- package/src/engines/Cesium/hooks.ts +3 -3
package/dist/core.umd.cjs
CHANGED
|
@@ -121,7 +121,7 @@ Event: `).concat(JSON.stringify(event)));else if(this.status!==InterpreterStatus
|
|
|
121
121
|
|
|
122
122
|
Check the render method of \``+al+"`."}return""}}function ep(al){return""}var Tf={};function rf(al){{var tf=qm();if(!tf){var lf=typeof al=="string"?al:al.displayName||al.name;lf&&(tf=`
|
|
123
123
|
|
|
124
|
-
Check the top-level render call using <`+lf+">.")}return tf}}function bf(al,tf){{if(!al._store||al._store.validated||al.key!=null)return;al._store.validated=!0;var lf=rf(tf);if(Tf[lf])return;Tf[lf]=!0;var yf="";al&&al._owner&&al._owner!==Qf.current&&(yf=" It was passed a child from "+yt(al._owner.type)+"."),Bf(al),se('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',lf,yf),Bf(null)}}function If(al,tf){{if(typeof al!="object")return;if(nf(al))for(var lf=0;lf<al.length;lf++){var yf=al[lf];qf(yf)&&bf(yf,tf)}else if(qf(al))al._store&&(al._store.validated=!0);else if(al){var Lf=nt(al);if(typeof Lf=="function"&&Lf!==al.entries)for(var Of=Lf.call(al),Mf;!(Mf=Of.next()).done;)qf(Mf.value)&&bf(Mf.value,tf)}}}function Uf(al){{var tf=al.type;if(tf==null||typeof tf=="string")return;var lf;if(typeof tf=="function")lf=tf.propTypes;else if(typeof tf=="object"&&(tf.$$typeof===y||tf.$$typeof===L))lf=tf.propTypes;else return;if(lf){var yf=yt(tf);cf(lf,al.props,"prop",yf,al)}else if(tf.PropTypes!==void 0&&!$m){$m=!0;var Lf=yt(tf);se("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Lf||"Unknown")}typeof tf.getDefaultProps=="function"&&!tf.getDefaultProps.isReactClassApproved&&se("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function jf(al){{for(var tf=Object.keys(al.props),lf=0;lf<tf.length;lf++){var yf=tf[lf];if(yf!=="children"&&yf!=="key"){Bf(al),se("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",yf),Bf(null);break}}al.ref!==null&&(Bf(al),se("Invalid attribute `ref` supplied to `React.Fragment`."),Bf(null))}}function jm(al,tf,lf,yf,Lf,Of){{var Mf=La(al);if(!Mf){var Vf="";(al===void 0||typeof al=="object"&&al!==null&&Object.keys(al).length===0)&&(Vf+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Gf=ep();Gf?Vf+=Gf:Vf+=qm();var Df;al===null?Df="null":nf(al)?Df="array":al!==void 0&&al.$$typeof===n?(Df="<"+(yt(al.type)||"Unknown")+" />",Vf=" Did you accidentally export a JSX literal instead of a component?"):Df=typeof al,se("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Df,Vf)}var Zf=Wf(al,tf,lf,Lf,Of);if(Zf==null)return Zf;if(Mf){var Kf=tf.children;if(Kf!==void 0)if(yf)if(nf(Kf)){for(var yp=0;yp<Kf.length;yp++)If(Kf[yp],al);Object.freeze&&Object.freeze(Kf)}else se("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else If(Kf,al)}return al===s?jf(Zf):Uf(Zf),Zf}}function sp(al,tf,lf){return jm(al,tf,lf,!0)}function cp(al,tf,lf){return jm(al,tf,lf,!1)}var fp=cp,mp=sp;pe$1.Fragment=s,pe$1.jsx=fp,pe$1.jsxs=mp}()),pe$1}process.env.NODE_ENV==="production"?Ae$1.exports=Ot$1():Ae$1.exports=Gt$1();var H$1=Ae$1.exports;function Bt$1(t,n){return n?Fe$1(t).reduce((o,[s,c])=>(ve$1(n,s)&&(o[s]=c),o),{}):{}}function Fe$1(t){return Object.keys(t).map(n=>[n,t[n]])}function ve$1(t,n){return!!t&&t.indexOf(n)!==-1}function At$1(t,n){return!!t&&!!n&&[...Object.keys(t),...Object.keys(n)].every(o=>t[o]===n[o])}function Ft$1(t){return t&&typeof t.isDestroyed=="function"&&typeof t.destroy=="function"}function It$1(t){return Ft$1(t)&&t.isDestroyed()}function J(t){return t&&typeof t=="object"&&"then"in t&&typeof t.then=="function"}const ce$1="__RESIUM_EVENT_MANAGER",Ie$1=["onClick","onDoubleClick","onMouseDown","onMouseUp","onMiddleClick","onMiddleDown","onMiddleUp","onMouseMove","onPinchEnd","onPinchMove","onPinchStart","onRightClick","onRightDown","onRightUp","onWheel","onMouseEnter","onMouseLeave"],Re$1=class lg{constructor(n){K$1(this,"scene"),K$1(this,"sshe"),K$1(this,"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}),K$1(this,"hovered"),K$1(this,"onMouseMove",o=>{var s,c,d,h,p,y;const S=this.pick(o.endPosition);this.hovered!==S&&(this.hovered&&((s=this.getEventCallback("onMouseLeave",this.hovered))==null||s(o,this.hovered),(c=this.getEventCallback("onMouseLeave",null))==null||c(o,this.hovered)),S&&((d=this.getEventCallback("onMouseEnter",S))==null||d(o,S),(h=this.getEventCallback("onMouseEnter",null))==null||h(o,S))),S&&((p=this.getEventCallback("onMouseMove",S))==null||p(o,S)),(y=this.getEventCallback("onMouseMove",null))==null||y(o,S),this.hovered=S}),K$1(this,"eventCallback",o=>s=>{var c,d;const h=this.pick(s==null?void 0:s.position);h&&((c=this.getEventCallback(o,h))==null||c(s,h)),(d=this.getEventCallback(o,null))==null||d(s,h)}),this.scene=n,this.sshe=new Cesium$1.ScreenSpaceEventHandler(n==null?void 0:n.canvas)}destroy(){this.hovered=void 0,this.sshe.isDestroyed()||this.sshe.destroy()}isDestroyed(){return this.sshe.isDestroyed()}on(n,o,s){n&&o==="onWheel"||this.events[o].set(n,s)}off(n,o){this.events[o].delete(n),this.hovered===n&&(this.hovered=void 0)}setEvents(n,o){Fe$1(o).forEach(([s,c])=>{const d=s;ve$1(Ie$1,d)&&(c?this.on(n,d,c):this.off(n,d))}),this.commit()}clearEvents(n){this.hovered=void 0,Ie$1.forEach(o=>{this.off(n,o)}),this.commit()}commit(){const n=this.sshe,o=this.sshe.isDestroyed();o||(this.events.onMouseEnter.size===0&&this.events.onMouseLeave.size===0&&this.events.onMouseMove.size===0?this.sshe.removeInputAction(Cesium$1.ScreenSpaceEventType.MOUSE_MOVE):this.sshe.getInputAction(Cesium$1.ScreenSpaceEventType.MOUSE_MOVE)||this.sshe.setInputAction(this.onMouseMove,Cesium$1.ScreenSpaceEventType.MOUSE_MOVE)),Fe$1(this.events).forEach(([s,c])=>{if(s==="onMouseEnter"||s==="onMouseLeave"||s==="onMouseMove")return;const d=lg.eventTypeMap[s];o||(c.size===0?n.removeInputAction(d):n.getInputAction(d)||n.setInputAction(this.eventCallback(s),d))})}getScreenSpaceEventHandler(){return this.sshe}getEventCallback(n,o){var s,c;return o===null?this.events[n].get(null):this.events[n].get(o.id)||this.events[n].get((c=(s=o.id)==null?void 0:s.entityCollection)==null?void 0:c.owner)||this.events[n].get(o.primitive)||this.events[n].get(o.tileset)}pick(n){var o;if(n)return(o=this.scene)==null?void 0:o.pick(n)}};K$1(Re$1,"eventTypeMap",{onClick:Cesium$1.ScreenSpaceEventType.LEFT_CLICK,onDoubleClick:Cesium$1.ScreenSpaceEventType.LEFT_DOUBLE_CLICK,onMouseDown:Cesium$1.ScreenSpaceEventType.LEFT_DOWN,onMouseUp:Cesium$1.ScreenSpaceEventType.LEFT_UP,onMiddleClick:Cesium$1.ScreenSpaceEventType.MIDDLE_CLICK,onMiddleDown:Cesium$1.ScreenSpaceEventType.MIDDLE_DOWN,onMiddleUp:Cesium$1.ScreenSpaceEventType.MIDDLE_UP,onMouseMove:Cesium$1.ScreenSpaceEventType.MOUSE_MOVE,onPinchEnd:Cesium$1.ScreenSpaceEventType.PINCH_END,onPinchMove:Cesium$1.ScreenSpaceEventType.PINCH_MOVE,onPinchStart:Cesium$1.ScreenSpaceEventType.PINCH_START,onRightClick:Cesium$1.ScreenSpaceEventType.RIGHT_CLICK,onRightDown:Cesium$1.ScreenSpaceEventType.RIGHT_DOWN,onRightUp:Cesium$1.ScreenSpaceEventType.RIGHT_UP,onWheel:Cesium$1.ScreenSpaceEventType.WHEEL,onMouseEnter:Cesium$1.ScreenSpaceEventType.MOUSE_MOVE,onMouseLeave:Cesium$1.ScreenSpaceEventType.MOUSE_MOVE});let De$1=Re$1;const Wt$1=({name:t,create:n,destroy:o,provide:s,update:c,cesiumReadonlyProps:d,cesiumEventProps:h,otherProps:p,setCesiumPropsAfterCreate:y,useCommonEvent:S,useRootEvent:P},L,F)=>{const N=React.useRef(),z=$e$1(),W=React.useRef(s?{}:void 0),nt=React.useRef({}),Pe=React.useRef(si$1(L)),se=React.useRef({}),[mt,kt]=React.useState(!1),mn=React.useRef(!1),_i=React.useRef(null),zi=React.useRef(),Sa=z==null?void 0:z[ce$1],fa=React.useRef(),La=React.useRef(),Ra=React.useCallback(async pi=>{var ba;if(!N.current)return;const Sc=N.current,ms=Object.keys(pi),Xs=Object.keys(h||[]),Nl=ms.concat(Object.keys(se.current).filter(Ru=>!ms.includes(Ru))).filter(Ru=>se.current[Ru]!==pi[Ru]).map(Ru=>[Ru,se.current[Ru],pi[Ru]]),pu=[];for(const[Ru,Vd,Gd]of Nl)if(d!=null&&d.includes(Ru))pu.push(Ru);else if(ve$1(Xs,Ru)){const uf=h==null?void 0:h[Ru],ff=Sc[uf];ff instanceof Cesium$1.Event&&(typeof Vd>"u"?(ff.addEventListener(Gd),nt.current[uf]=Gd):typeof Gd>"u"?(ff.removeEventListener(Vd),delete nt.current[uf]):(ff.removeEventListener(Vd),ff.addEventListener(Gd)))}else Ru!=="children"&&!Ie$1.includes(Ru)&&!(p!=null&&p.includes(Ru))&&(Sc[Ru]=Gd);const yu=P?(ba=W.current)==null?void 0:ba[ce$1]:Sa;if(S&&yu&&N.current&&yu.setEvents(P?null:N.current,pi),c&&mn.current){const Ru=c(N.current,pi,se.current,z);J(Ru)&&await Ru}se.current=pi,Pe.current=pi,mn.current&&pu.length>0&&(process.env.NODE_ENV!=="production"&&console.warn(`Warning: <${t}> is recreated because following read-only props have been updated: ${pu.join(", ")}`),yt(),await lt(),fa.current=ma())},[]),ma=React.useCallback(async()=>{var pi;await new Promise(Xs=>queueMicrotask(()=>Xs(void 0)));const ba=n==null?void 0:n(z,Pe.current,_i.current);let Sc;if(J(ba)?Sc=await ba:Sc=ba,Array.isArray(Sc)?(N.current=Sc[0],zi.current=Sc[1]):N.current=Sc,y)await Ra(Pe.current);else{if(N.current&&h){const Xs=N.current;for(const Nl of Object.keys(Pe.current)){const pu=h[Nl];if(pu){const yu=Pe.current[Nl],Ru=Xs[pu];yu&&Ru instanceof Cesium$1.Event&&Ru.addEventListener(yu)}}}se.current=Pe.current}s&&N.current&&(W.current={...z,...s(N.current,z,L,zi.current)});const ms=P?(pi=W.current)==null?void 0:pi[ce$1]:Sa;S&&ms&&N.current&&ms.setEvents(P?null:N.current,Pe.current),La.current||kt(!0)},[]),yt=React.useCallback(()=>{kt(!1),mn.current=!1},[]),lt=React.useCallback(async()=>{var pi,ba;await new Promise(ms=>queueMicrotask(()=>ms(void 0))),fa.current&&(await fa.current,fa.current=void 0),N.current&&o&&o(N.current,z,_i.current,zi.current);const Sc=P?(pi=W.current)==null?void 0:pi[ce$1]:Sa;if(S&&Sc&&N.current&&Sc.clearEvents(P?null:N.current),N.current&&!It$1(N.current)){const ms=Object.keys(nt.current);for(const Xs of ms){const Nl=N.current[Xs];(ba=Nl==null?void 0:Nl.removeEventListener)==null||ba.call(Nl,nt.current[Xs])}}nt.current={},W.current=void 0,zi.current=void 0,N.current=void 0},[]);return React.useLayoutEffect(()=>((async()=>(La.current&&(await La.current,La.current=void 0),fa.current=ma()))(),()=>{yt(),La.current=lt()}),[ma,lt,yt]),React.useEffect(()=>{(async()=>{var pi,ba;fa.current&&await fa.current;const Sc=si$1(L);mt?At$1(Sc,se.current)||(await Ra(Sc),(ba=(pi=z.__$internal)==null?void 0:pi.onUpdate)==null||ba.call(pi)):(se.current=Sc,Pe.current=Sc,mn.current=!0)})()},[z.__$internal,mt,L,Ra]),React.useImperativeHandle(F,()=>({cesiumElement:mt?N.current:null}),[mt]),[W.current,mt,_i]};function si$1(t){const{children:n,...o}=t;return o}const l=({renderContainer:t,noChildren:n,containerProps:o,defaultProps:s,...c})=>{const d=(h,p)=>{const y={...s,...h},[S,P,L]=Wt$1(c,y,p);if(n)return null;const F=P&&"children"in y?y.children:null,N=t?H$1.jsx("div",{"data-testid":"resium-container",ref:L,...typeof o=="function"?o(y):Bt$1(y,o),children:F}):F?H$1.jsx(H$1.Fragment,{children:F}):null;return S?H$1.jsx(We$1.Provider,{value:S,children:N}):N};return d.displayName=c.name,React.forwardRef(d)},Vt$1=["enabled","selected"],U$1=t=>l({name:t.name,create(n,o){if(!n.scene)return;const s=t.create(o,n.scene.postProcessStages);return typeof o.enabled=="boolean"&&(s.enabled=o.enabled),o.selected&&"selected"in s&&(s.selected=o.selected),t.props.forEach(c=>{!ve$1(t.readonlyProps,c)&&typeof o[c]<"u"&&(s.uniforms[c]=o[c])}),!t.noMount&&n.scene&&!n.scene.isDestroyed()&&n.scene.postProcessStages.add(s),s},destroy(n,o){t.noMount?n.enabled=!1:(o.scene&&!o.scene.isDestroyed()&&o.scene.postProcessStages.remove(n),n.isDestroyed()||n.destroy())},update(n,o,s){t.props.forEach(c=>{!ve$1(t.readonlyProps,c)&&o[c]!==s[c]&&(n.uniforms[c]=o[c])})},cesiumProps:Vt$1,cesiumReadonlyProps:t.readonlyProps,defaultProps:{enabled:!0}}),Ut$1=["alignedAxis","color","disableDepthTestDistance","distanceDisplayCondition","eyeOffset","height","heightReference","horizontalOrigin","image","pixelOffset","pixelOffsetScaleByDistance","position","rotation","scale","scaleByDistance","show","sizeInMeters","translucencyByDistance","verticalOrigin","width","id"];l({name:"Billboard",create(t,n){var o;return(o=t.billboardCollection)==null?void 0:o.add(n)},destroy(t,n){n.billboardCollection&&!n.billboardCollection.isDestroyed()&&n.billboardCollection.remove(t)},cesiumProps:Ut$1,useCommonEvent:!0});const Ht$1=["blendOption","debugShowBoundingVolume","debugShowTextureAtlas","modelMatrix","show"];l({name:"BillboardCollection",create(t,n){if(!t.primitiveCollection)return;const o=new Cesium$1.BillboardCollection({modelMatrix:n.modelMatrix,debugShowBoundingVolume:n.debugShowBoundingVolume,scene:t.scene,blendOption:n.blendOption});return t.primitiveCollection.add(o),o},destroy(t,n){n.primitiveCollection&&!n.primitiveCollection.isDestroyed()&&n.primitiveCollection.remove(t),t.isDestroyed()||t.destroy()},provide(t){return{billboardCollection:t}},cesiumProps:Ht$1});const xt$1=["image","show","scale","horizontalOrigin","verticalOrigin","eyeOffset","pixelOffset","rotation","alignedAxis","width","height","color","scaleByDistance","translucencyByDistance","pixelOffsetScaleByDistance","imageSubRegion","sizeInMeters","heightReference","distanceDisplayCondition","disableDepthTestDistance"],Nt$1={onDefinitionChange:"definitionChanged"},qt$1=l({name:"BillboardGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.BillboardGraphics(n);return t.entity.billboard=o,o},destroy(t,n){n.entity&&(n.entity.billboard=void 0)},cesiumProps:xt$1,cesiumEventProps:Nt$1}),gs$1=qt$1,Yt$1=["heightReference","dimensions","show","fill","material","outline","outlineColor","outlineWidth","shadows","distanceDisplayCondition"],Kt$1={onDefinitionChange:"definitionChanged"},Jt$1=l({name:"BoxGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.BoxGraphics(n);return t.entity.box=o,o},destroy(t,n){n.entity&&(n.entity.box=void 0)},cesiumProps:Yt$1,cesiumEventProps:Kt$1}),Cs$1=Jt$1,Zt$1=["position","direction","up","right","frustum","defaultMoveAmount","defaultLookAmount","defaultRotateAmount","defaultZoomAmount","constrainedAxis","maximumZoomFactor","percentageChanged"],Xt$1={onChange:"changed",onMoveEnd:"moveEnd",onMoveStart:"moveStart"},Qt$1=l({name:"Camera",create:t=>{var n;return(n=t.scene)==null?void 0:n.camera},cesiumProps:Zt$1,cesiumEventProps:Xt$1,setCesiumPropsAfterCreate:!0}),Ps$1=Qt$1,rn$1=["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","classificationType","ellipsoid","lightColor","colorBlendAmount","colorBlendMode","debugFreezeFrame","debugColorizeTiles","debugWireframe","debugShowBoundingVolume","debugShowContentBoundingVolume","debugShowViewerRequestVolume","debugShowGeometricError","debugShowRenderingStatistics","debugShowMemoryUsage","debugShowUrl","style","backFaceCulling","vectorClassificationOnly","vectorKeepDecodedPositions","splitDirection","customShader","imageBasedLighting","showCreditsOnScreen","featureIdLabel","instanceFeatureIdLabel","imageBasedLighting","outlineColor","cacheBytes","maximumCacheOverflowBytes","enableCollision"],sn$1=["showOutline","cullWithChildrenBounds","debugHeatmapTilePropertyName","enableDebugWireframe","modelUpAxis","modelForwardAxis","projectTo2D","enableShowOutline","enablePick"],an$1={onAllTilesLoad:"allTilesLoaded",onInitialTilesLoad:"initialTilesLoaded",onLoadProgress:"loadProgress",onTileFailed:"tileFailed",onTileLoad:"tileLoad",onTileUnload:"tileUnload",onTileVisible:"tileVisible"},cn$1=["onReady","onError","url"],ln$1=l({name:"Cesium3DTileset",async create(t,n){var o,s;if(!t.primitiveCollection)return;const c=n.url;let d;J(c)?d=await c:d=c;let h;try{h=await Cesium$1.Cesium3DTileset.fromUrl(d,n),(o=n.onReady)==null||o.call(n,h)}catch(p){(s=n.onError)==null||s.call(n,p);return}return n.colorBlendAmount&&(h.colorBlendAmount=n.colorBlendAmount),n.colorBlendMode&&(h.colorBlendMode=n.colorBlendMode),n.style&&(h.style=n.style),t.primitiveCollection.add(h),h},destroy(t,n){n.primitiveCollection&&!n.primitiveCollection.isDestroyed()&&n.primitiveCollection.remove(t),t.isDestroyed()||t.destroy()},cesiumProps:rn$1,cesiumReadonlyProps:sn$1,cesiumEventProps:an$1,otherProps:cn$1,useCommonEvent:!0}),Ds$1=ln$1,un$1=["show","uri","maximumScreenSpaceError"],dn$1={onDefinitionChange:"definitionChanged"};l({name:"Cesium3DTilesetGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.Cesium3DTilesetGraphics(n);return t.entity.tileset=o,o},destroy(t,n){n.entity&&(n.entity.tileset=void 0)},cesiumProps:un$1,cesiumEventProps:dn$1});const fn$1=["resolutionScale","useDefaultRenderLoop","targetFrameRate","useBrowserRecommendedResolution","creditDisplay"],hn$1=["clock","baseLayer","terrainProvider","skyBox","skyAtmosphere","sceneMode","scene3DOnly","orderIndependentTranslucency","mapMode2D","mapProjection","globe","showRenderLoopErrors","contextOptions","creditContainer","creditViewport","shadows","terrainShadows","terrain","requestRenderMode","maximumRenderTimeChange","msaaSamples","blurActiveElementOnCanvasFocus"],yn$1=["className","id","style","full","containerProps"];l({name:"CesiumWidget",create(t,n,o){if(!o)return;const s=new Cesium$1.CesiumWidget(o,n);if(!s)return;typeof n.resolutionScale=="number"&&(s.resolutionScale=n.resolutionScale);const c=new De$1(s.scene);return[s,c]},destroy(t,n,o,s){s&&!s.isDestroyed()&&s.destroy(),t.isDestroyed()||t.destroy()},provide(t,n,o,s){return{cesiumWidget:t,scene:t.scene,camera:t.scene.camera,imageryLayerCollection:t.scene.globe.imageryLayers,primitiveCollection:t.scene.primitives,globe:t.scene.globe,__$internal:{onUpdate:o==null?void 0:o.onUpdate},[ce$1]:s}},containerProps:({id:t,className:n,style:o,full:s,containerProps:c})=>({className:n,id:t,style:{...s?{position:"absolute",bottom:"0",left:"0",right:"0",top:"0"}:{},...o},...c}),cesiumProps:fn$1,cesiumReadonlyProps:hn$1,otherProps:yn$1,renderContainer:!0,useCommonEvent:!0,useRootEvent:!0});const vn$1=["classificationType","debugShowBoundingVolume","debugShowShadowVolume","show"],gn$1=["allowPicking","asynchronous","compressVertices","geometryInstances","interleave","releaseGeometryInstances","vertexCacheOptimize","appearance"],Cn$1=["onReady"];l({name:"ClassificationPrimitive",async create(t,n){var o;if(!t.primitiveCollection)return;const s=new Cesium$1.ClassificationPrimitive(n);if(n.onReady){const c=()=>{var d,h;s.ready&&((d=n.onReady)==null||d.call(n,s),(h=t.scene)==null||h.postRender.removeEventListener(c))};(o=t.scene)==null||o.postRender.addEventListener(c)}return t.primitiveCollection.add(s),s},destroy(t,n){n.primitiveCollection&&!n.primitiveCollection.isDestroyed()&&n.primitiveCollection.remove(t),t.isDestroyed()||t.destroy()},cesiumProps:vn$1,cesiumReadonlyProps:gn$1,otherProps:Cn$1,useCommonEvent:!0});const Sn$1={onStop:"onStop",onTick:"onTick"},En$1=["canAnimate","clockRange","clockStep","currentTime","multiplier","shouldAnimate","startTime","stopTime"],bn$1=l({name:"Clock",create:t=>{var n;return(n=t.cesiumWidget)==null?void 0:n.clock},cesiumProps:En$1,cesiumEventProps:Sn$1,setCesiumPropsAfterCreate:!0}),Ms$1=bn$1,wn$1=["noiseDetail","noiseOffset","show","debugBillboards","debugEllipsoids"];l({name:"CloudCollection",create:t=>{if(!t.primitiveCollection)return;const n=new Cesium$1.CloudCollection;return t.primitiveCollection.add(n),n},destroy(t,n){n.primitiveCollection&&!n.primitiveCollection.isDestroyed()&&n.primitiveCollection.remove(t),t.isDestroyed()||t.destroy()},provide:t=>({cloudCollection:t}),cesiumProps:wn$1,setCesiumPropsAfterCreate:!0});const Rn$1=["positions","width","cornerType","height","heightReference","extrudedHeight","extrudedHeightReference","show","fill","material","outline","outlineColor","outlineWidth","granularity","shadows","distanceDisplayCondition","zIndex","classificationType"],$n$1={onDefinitionChange:"definitionChanged"};l({name:"CorridorGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.CorridorGraphics(n);return n.classificationType&&(o.classificationType=n.classificationType),t.entity.corridor=o,o},destroy(t,n){n.entity&&(n.entity.corridor=void 0)},cesiumProps:Rn$1,cesiumEventProps:$n$1});const Mn$1=["show","position","scale","maximumSize","slice","brightness","color"];l({name:"CumulusCloud",create:(t,n)=>{var o;return(o=t.cloudCollection)==null?void 0:o.add(n)},destroy(t,n){n.cloudCollection&&!n.cloudCollection.isDestroyed()&&n.cloudCollection.remove(t)},cesiumProps:Mn$1});const Ln$1=["clustering","name","show","clock","isLoading"],_n$1={onChange:"changedEvent",onError:"errorEvent",onLoading:"loadingEvent"},On$1=l({name:"CustomDataSource",create(t,n){if(!t.dataSourceCollection)return;const o=new Cesium$1.CustomDataSource(n.name);return n.clustering&&(o.clustering=n.clustering),typeof n.show=="boolean"&&(o.show=n.show),typeof n.clock<"u"&&(o.clock=n.clock),t.dataSourceCollection.add(o),o},destroy(t,n){n.dataSourceCollection&&!n.dataSourceCollection.isDestroyed()&&n.dataSourceCollection.remove(t)},provide(t){return{entityCollection:t.entities,dataSource:t}},cesiumProps:Ln$1,cesiumEventProps:_n$1,useCommonEvent:!0}),Os$1=On$1,Gn$1=["heightReference","length","topRadius","bottomRadius","show","fill","material","outline","outlineColor","outlineWidth","numberOfVerticalLines","slices","distanceDisplayCondition","shadows"],Bn$1={onDefinitionChange:"definitionChanged"};l({name:"CylinderGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.CylinderGraphics(n);return t.entity.cylinder=o,o},destroy(t,n){n.entity&&(n.entity.cylinder=void 0)},cesiumProps:Gn$1,cesiumEventProps:Bn$1});const Fn$1=["clustering","show"],In$1=["name","sourceUri","credit"],Wn$1={onChange:"changedEvent",onError:"errorEvent",onLoading:"loadingEvent"},Vn$1=["onLoad","data"],ai=(t,{data:n,onLoad:o,...s})=>{n&&t.load(n,s).then(c=>{o&&o(c)})},Un$1=l({name:"CzmlDataSource",create(t,n){if(!t.dataSourceCollection)return;const o=new Cesium$1.CzmlDataSource(n.name);return n.clustering&&(o.clustering=n.clustering),typeof n.show=="boolean"&&(o.show=n.show),t.dataSourceCollection.add(o),n.data&&ai(o,n),o},update(t,n,o){n.data?o.show!==n.show&&(t.show=typeof n.show=="boolean"?n.show:!0):t.show=!1,n.data&&(o.data!==n.data||o.sourceUri!==n.sourceUri||o.credit!==n.credit)&&ai(t,n)},destroy(t,n){n.dataSourceCollection&&!n.dataSourceCollection.isDestroyed()&&n.dataSourceCollection.remove(t)},provide(t){return{dataSource:t}},cesiumProps:Fn$1,cesiumReadonlyProps:In$1,cesiumEventProps:Wn$1,otherProps:Vn$1,useCommonEvent:!0}),Bs$1=Un$1,jn$1=["semiMajorAxis","semiMinorAxis","height","heightReference","extrudedHeight","show","fill","material","outline","outlineColor","outlineWidth","numberOfVerticalLines","rotation","stRotation","granularity","shadows","distanceDisplayCondition","zIndex","classificationType","extrudedHeightReference"],Hn$1={onDefinitionChange:"definitionChanged"},zn$1=l({name:"EllipseGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.EllipseGraphics(n);return t.entity.ellipse=o,o},destroy(t,n){n.entity&&(n.entity.ellipse=void 0)},cesiumProps:jn$1,cesiumEventProps:Hn$1}),As$1=zn$1,xn$1=["heightReference","radii","show","fill","innerRadii","material","maximumClock","maximumCone","minimumClock","minimumCone","outline","outlineColor","outlineWidth","subdivisions","stackPartitions","slicePartitions","shadows","distanceDisplayCondition"],Nn$1={onDefinitionChange:"definitionChanged"},qn$1=l({name:"EllipsoidGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.EllipsoidGraphics(n);return t.entity.ellipsoid=o,o},destroy(t,n){n.entity&&(n.entity.ellipsoid=void 0)},cesiumProps:xn$1,cesiumEventProps:Nn$1}),Fs$1=qn$1,Yn$1=["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","viewFrom","wall"],Kn$1=["id"],Jn$1={onDefinitionChange:"definitionChanged"},Zn$1=["selected","tracked"],Xn$1=l({name:"Entity",create(t,n){if(!t.entityCollection)return;const o=new Cesium$1.Entity(n);return t.viewer&&n.selected&&(t.viewer.selectedEntity=o),t.viewer&&n.tracked&&(t.viewer.trackedEntity=o),t.entityCollection.add(o),o},destroy(t,n){n.entityCollection&&n.entityCollection.remove(t)},update(t,n,o,s){s.viewer&&(n.selected!==o.selected&&(n.selected?s.viewer.selectedEntity=t:s.viewer.selectedEntity===t&&(s.viewer.selectedEntity=void 0)),n.tracked!==o.tracked&&(n.tracked?s.viewer.trackedEntity=t:s.viewer.trackedEntity===t&&(s.viewer.trackedEntity=void 0)))},provide(t,n,o){return{entity:t,__$internal:{onUpdate:o==null?void 0:o.onUpdate}}},cesiumProps:Yn$1,cesiumReadonlyProps:Kn$1,cesiumEventProps:Jn$1,otherProps:Zn$1,useCommonEvent:!0}),Is$1=Xn$1,eo$1=["density","enabled","minimumBrightness","screenSpaceErrorFactor","renderable"],io$1=l({name:"Fog",create(t){if(!t.scene)return;const n=new Cesium$1.Fog;return t.scene.fog=n,n},destroy(t,n){n.scene&&!n.scene.isDestroyed()&&(n.scene.fog=new Cesium$1.Fog)},cesiumProps:eo$1,setCesiumPropsAfterCreate:!0}),Vs=io$1,to$1=["clustering","name","show"],no=["clampToGround","sourceUri","credit","markerSize","markerSymbol","markerColor","stroke","strokeWidth","fill","describe"],oo$1={onChange:"changedEvent",onError:"errorEvent",onLoading:"loadingEvent"},ro$1=["onLoad","data"],ci$1=(t,{data:n,onLoad:o,...s})=>{n&&t.load(n,s).then(c=>{o&&o(c)})},so$1=l({name:"GeoJsonDataSource",create(t,n){if(!t.dataSourceCollection)return;const o=new Cesium$1.GeoJsonDataSource(n.name);return n.clustering&&(o.clustering=n.clustering),typeof n.show=="boolean"&&(o.show=n.show),t.dataSourceCollection.add(o),n.data&&ci$1(o,n),o},update(t,n,o){n.data?o.show!==n.show&&(t.show=typeof n.show=="boolean"?n.show:!0):t.show=!1,n.data&&(o.data!==n.data||o.clampToGround!==n.clampToGround||o.sourceUri!==n.sourceUri||o.credit!==n.credit||o.markerSize!==n.markerSize||o.markerSymbol!==n.markerSymbol||o.markerColor!==n.markerColor||o.stroke!==n.stroke||o.strokeWidth!==n.strokeWidth||o.fill!==n.fill)&&ci$1(t,n)},destroy(t,n){n.dataSourceCollection&&!n.dataSourceCollection.isDestroyed()&&n.dataSourceCollection.remove(t)},provide(t){return{dataSource:t}},cesiumProps:to$1,cesiumReadonlyProps:no,cesiumEventProps:oo$1,otherProps:ro$1,useCommonEvent:!0}),Us$1=so$1,ao$1={onImageryLayersUpdate:"imageryLayersUpdatedEvent",onTerrainProviderChange:"terrainProviderChanged",onTileLoadProgress:"tileLoadProgressEvent"},co$1=["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"],lo$1=["terrainProvider"],uo$1=l({name:"Globe",create:t=>{var n;return(n=t.scene)==null?void 0:n.globe},update:async(t,n)=>{const o=n.terrainProvider;let s;J(o)?s=await o:s=o,t.terrainProvider=s},cesiumProps:co$1,cesiumEventProps:ao$1,otherProps:lo$1,setCesiumPropsAfterCreate:!0}),js$4=uo$1,mo$1=["appearance","classificationType","debugShowBoundingVolume","debugShowShadowVolume","show"],fo$1=["allowPicking","asynchronous","geometryInstances","interleave","releaseGeometryInstances"],ho$2=["onReady"];l({name:"GroundPolylinePrimitive",create(t,n){var o;if(!t.primitiveCollection)return;const s=new Cesium$1.GroundPolylinePrimitive(n);if(n.onReady){const c=()=>{var d,h;s.ready&&((d=n.onReady)==null||d.call(n,s),(h=t.scene)==null||h.postRender.removeEventListener(c))};(o=t.scene)==null||o.postRender.addEventListener(c)}return t.primitiveCollection.add(s),s},destroy(t,n){n.primitiveCollection&&!n.primitiveCollection.isDestroyed()&&n.primitiveCollection.remove(t),t.isDestroyed()||t.destroy()},cesiumProps:mo$1,cesiumReadonlyProps:fo$1,otherProps:ho$2,useCommonEvent:!0});const po$1=["appearance","classificationType","debugShowBoundingVolume","debugShowShadowVolume","show"],vo$2=["allowPicking","asynchronous","compressVertices","geometryInstances","interleave","releaseGeometryInstances","vertexCacheOptimize"],go$1=["onReady"];l({name:"GroundPrimitive",create(t,n){var o;if(!t.primitiveCollection)return;const s=new Cesium$1.GroundPrimitive(n);if(n.onReady){const c=()=>{var d,h;s.ready&&((d=n.onReady)==null||d.call(n,s),(h=t.scene)==null||h.postRender.removeEventListener(c))};(o=t.scene)==null||o.postRender.addEventListener(c)}return t.primitiveCollection.add(s),s},destroy(t,n){n.primitiveCollection&&!n.primitiveCollection.isDestroyed()&&n.primitiveCollection.remove(t),t.isDestroyed()||t.destroy()},cesiumProps:po$1,cesiumReadonlyProps:vo$2,otherProps:go$1,useCommonEvent:!0});const Po$1=["show","destroyPrimitives","primitiveAdded","primitiveRemoved"];l({name:"GroundPrimitiveCollection",create:t=>{var n;return(n=t.scene)==null?void 0:n.groundPrimitives},provide:t=>({primitiveCollection:t}),cesiumProps:Po$1,setCesiumPropsAfterCreate:!0});const Eo$1=["alpha","brightness","contrast","hue","saturation","gamma","splitDirection","minificationFilter","magnificationFilter","cutoutRectangle","show","nightAlpha","dayAlpha","colorToAlpha","colorToAlphaThreshold","index"],bo$1=["rectangle","maximumAnisotropy","minimumTerrainLevel","maximumTerrainLevel","readyEvent","imageryProvider"],wo$1=l({name:"ImageryLayer",async create(t,n){var o,s,c,d;if(!t.imageryLayerCollection)return;const h=J(n.imageryProvider)?n.imageryProvider:new Promise(P=>queueMicrotask(()=>P(n.imageryProvider))),p=(s=(o=t.__$internal)==null?void 0:o.imageryLayerWaitingList)==null?void 0:s.slice();(c=t.__$internal)!=null&&c.imageryLayerWaitingList&&t.__$internal.imageryLayerWaitingList.push(h),p&&await Promise.all(p.filter(P=>J(P)));const y=await h;if((d=t.__$internal)!=null&&d.imageryLayerWaitingList&&(t.__$internal.imageryLayerWaitingList=t.__$internal.imageryLayerWaitingList.filter(P=>P!==h)),!y)return;const S=new Cesium$1.ImageryLayer(y,n);return t.imageryLayerCollection.add(S,n.index),S},destroy(t,n){n.imageryLayerCollection&&n.imageryLayerCollection.remove(t)},cesiumProps:Eo$1,cesiumReadonlyProps:bo$1}),Ns$1=wo$1,Do$1={onLayerAdd:"layerAdded",onLayerMove:"layerMoved",onLayerRemove:"layerRemoved",onLayerShowOrHide:"layerShownOrHidden"};l({name:"ImageryLayerCollection",create:t=>{var n;return(n=t.globe)==null?void 0:n.imageryLayers},cesiumEventProps:Do$1});const $o$1=["clustering","name","show"],To$1=["canvas","camera","ellipsoid","clampToGround","sourceUri","credit","screenOverlayContainer"],Mo$1={onChange:"changedEvent",onError:"errorEvent",onLoading:"loadingEvent",onRefresh:"refreshEvent",onUnsupportedNode:"unsupportedNodeEvent"},ko$1=["onLoad","data"],li$1=(t,{data:n,onLoad:o,...s})=>{n&&t.load(n,s).then(c=>{o&&o(c)})},Lo$1=l({name:"KmlDataSource",create(t,n){if(!t.scene||!t.dataSourceCollection||!t.scene)return;const o=new Cesium$1.KmlDataSource({camera:n.camera||t.scene.camera,canvas:n.canvas||t.scene.canvas,ellipsoid:n.ellipsoid,credit:n.credit});return n.clustering&&(o.clustering=n.clustering),typeof n.show=="boolean"&&(o.show=n.show),typeof n.name<"u"&&(o.name=n.name),t.dataSourceCollection.add(o),n.data&&li$1(o,n),o},update(t,n,o){n.data?o.show!==n.show&&(t.show=typeof n.show=="boolean"?n.show:!0):t.show=!1,n.data&&(o.data!==n.data||o.clampToGround!==n.clampToGround||o.ellipsoid!==n.ellipsoid||o.sourceUri!==n.sourceUri||o.credit!==n.credit)&&li$1(t,n)},destroy(t,n){n.dataSourceCollection&&!n.dataSourceCollection.isDestroyed()&&n.dataSourceCollection.remove(t)},provide(t){return{dataSource:t}},cesiumProps:$o$1,cesiumReadonlyProps:To$1,cesiumEventProps:Mo$1,otherProps:ko$1,useCommonEvent:!0}),Ys$1=Lo$1,_o$1=["backgroundColor","backgroundPadding","disableDepthTestDistance","distanceDisplayCondition","eyeOffset","fillColor","font","heightReference","horizontalOrigin","id","outlineColor","outlineWidth","pixelOffset","pixelOffsetScaleByDistance","position","scale","scaleByDistance","show","showBackground","style","text","translucencyByDistance","verticalOrigin"];l({name:"Label",create:(t,n)=>{var o;return(o=t.labelCollection)==null?void 0:o.add(n)},destroy(t,n){n.labelCollection&&!n.labelCollection.isDestroyed()&&n.labelCollection.remove(t)},cesiumProps:_o$1,useCommonEvent:!0});const Go$1=["blendOption","debugShowBoundingVolume","modelMatrix","show"];l({name:"LabelCollection",create(t,n){if(!t.scene||!t.primitiveCollection)return;const o=new Cesium$1.LabelCollection({scene:t.scene,modelMatrix:n.modelMatrix,blendOption:n.blendOption,debugShowBoundingVolume:n.debugShowBoundingVolume});return t.primitiveCollection.add(o),o},destroy(t,n){n.primitiveCollection&&!n.primitiveCollection.isDestroyed()&&n.primitiveCollection.remove(t),t.isDestroyed()||t.destroy()},provide(t){return{labelCollection:t}},cesiumProps:Go$1});const Ao$1=["text","font","style","fillColor","outlineColor","outlineWidth","show","showBackground","backgroundColor","backgroundPadding","scale","horizontalOrigin","verticalOrigin","eyeOffset","pixelOffset","translucencyByDistance","pixelOffsetScaleByDistance","scaleByDistance","heightReference","distanceDisplayCondition","disableDepthTestDistance"],Fo$1={onDefinitionChange:"definitionChanged"},Io$1=l({name:"LabelGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.LabelGraphics(n);return t.entity.label=o,o},destroy(t,n){n.entity&&(n.entity.label=void 0)},cesiumProps:Ao$1,cesiumEventProps:Fo$1}),Zs=Io$1,Wo$1=["backFaceCulling","clampAnimations","clippingPlanes","color","colorBlendAmount","colorBlendMode","customShader","debugShowBoundingVolume","debugWireframe","distanceDisplayCondition","featureIdLabel","heightReference","id","imageBasedLighting","instanceFeatureIdLabel","lightColor","maximumScale","minimumPixelSize","modelMatrix","outlineColor","scale","shadows","show","showCreditsOnScreen","showOutline","silhouetteColor","silhouetteSize","splitDirection","style"],Vo$1=["allowPicking","asynchronous","basePath","credit","enableDebugWireframe","gltf","heightReference","incrementallyLoadTextures","scene","releaseGltfJson","cull","opaquePass","upAxis","forwardAxis","content","scene","enableShowOutline","projectTo2D","classificationType","errorEvent","readyEvent","texturesReadyEvent","gltfCallback","enablePick"],Uo$1=["onReady","onError","url"];l({name:"Model",async create(t,{scene:n,url:o,colorBlendMode:s,...c}){var d;if(!t.scene||!t.primitiveCollection||!o)return;const h=o;let p;J(h)?p=await h:p=h;let y;try{y=await Cesium$1.Model.fromGltfAsync({...c,url:p,colorBlendMode:s,scene:n||t.scene})}catch(S){(d=c.onError)==null||d.call(c,S);return}return t.primitiveCollection.add(y),y},destroy(t,n){n.primitiveCollection&&!n.primitiveCollection.isDestroyed()&&n.primitiveCollection.remove(t),t.isDestroyed()||t.destroy()},cesiumEventProps:{onReady:"readyEvent"},cesiumProps:Wo$1,cesiumReadonlyProps:Vo$1,otherProps:Uo$1,useCommonEvent:!0});const Ho$1=["uri","show","scale","minimumPixelSize","maximumScale","incrementallyLoadTextures","runAnimations","clampAnimations","nodeTransformations","shadows","heightReference","distanceDisplayCondition","silhouetteColor","silhouetteSize","color","colorBlendMode","colorBlendAmount","clippingPlanes","imageBasedLightingFactor","lightColor","articulations","customShader"],zo$1={onDefinitionChange:"definitionChanged"},xo$1=l({name:"ModelGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.ModelGraphics(n);return t.entity.model=o,o},destroy(t,n){n.entity&&(n.entity.model=void 0)},cesiumProps:Ho$1,cesiumEventProps:zo$1}),Qs$1=xo$1,No$1=["onlySunLighting","show","textureUrl"],qo$1=["ellipsoid"],Yo$1=l({name:"Moon",create(t,n){if(!t.scene)return;const o=new Cesium$1.Moon(n);return t.scene.moon=o,o},destroy(t,n){n.scene&&!n.scene.isDestroyed()&&(n.scene.moon=new Cesium$1.Moon)},cesiumProps:No$1,cesiumReadonlyProps:qo$1}),ea=Yo$1,Ko$1=["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"],Jo$1={onComplete:"complete",onUpdate:"updateCallback"};l({name:"ParticleSystem",create(t,n){if(!t.primitiveCollection)return;const o=new Cesium$1.ParticleSystem({...n,updateCallback:n.onUpdate});return t.primitiveCollection.add(o),o},update(t,n,o){n.onUpdate!==o.onUpdate&&(t.updateCallback=n.onUpdate)},destroy(t,n){n.primitiveCollection&&!n.primitiveCollection.isDestroyed()&&n.primitiveCollection.remove(t)},cesiumProps:Ko$1,cesiumEventProps:Jo$1});const Xo$1=["leadTime","trailTime","show","width","material","resolution","distanceDisplayCondition"],Qo$1={onDefinitionChange:"definitionChanged"};l({name:"PathGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.PathGraphics(n);return t.entity.path=o,o},destroy(t,n){n.entity&&(n.entity.path=void 0)},cesiumProps:Xo$1,cesiumEventProps:Qo$1});const ir$1=["plane","dimensions","show","fill","material","outline","outlineColor","outlineWidth","shadows","distanceDisplayCondition"],tr$1={onDefinitionChange:"definitionChanged"},nr$1=l({name:"PlaneGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.PlaneGraphics(n);return t.entity.plane=o,o},destroy(t,n){n.entity&&(n.entity.plane=void 0)},cesiumProps:ir$1,cesiumEventProps:tr$1}),na$1=nr$1,or$1=["color","pixelSize","outlineColor","outlineWidth","show","scaleByDistance","translucencyByDistance","heightReference","distanceDisplayCondition","disableDepthTestDistance"],rr$1={onDefinitionChange:"definitionChanged"},sr$1=l({name:"PointGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.PointGraphics(n);return t.entity.point=o,o},destroy(t,n){n.entity&&(n.entity.point=void 0)},cesiumProps:or$1,cesiumEventProps:rr$1}),oa$1=sr$1,ar$1=["color","disableDepthTestDistance","distanceDisplayCondition","id","outlineColor","outlineWidth","pixelSize","position","scaleByDistance","show","translucencyByDistance"];l({name:"PointPrimitive",create:(t,n)=>{var o;return(o=t.pointPrimitiveCollection)==null?void 0:o.add(n)},destroy(t,n){n.pointPrimitiveCollection&&!n.pointPrimitiveCollection.isDestroyed()&&n.pointPrimitiveCollection.remove(t)},cesiumProps:ar$1,useCommonEvent:!0});const lr$1=["blendOption","debugShowBoundingVolume","modelMatrix","show"];l({name:"PointPrimitveCollection",create(t,n){if(!t.primitiveCollection)return;const o=new Cesium$1.PointPrimitiveCollection(n);return t.primitiveCollection.add(o),o},destroy(t,n){n.primitiveCollection&&!n.primitiveCollection.isDestroyed()&&n.primitiveCollection.remove(t),t.isDestroyed()||t.destroy()},provide(t){return{pointPrimitiveCollection:t}},cesiumProps:lr$1});const dr$1=["arcType","hierarchy","height","heightReference","extrudedHeight","extrudedHeightReference","show","fill","material","outline","outlineColor","outlineWidth","stRotation","granularity","perPositionHeight","closeTop","closeBottom","shadows","distanceDisplayCondition","zIndex","classificationType","textureCoordinates"],mr$1={onDefinitionChange:"definitionChanged"},fr$1=l({name:"PolygonGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.PolygonGraphics(n);return t.entity.polygon=o,o},destroy(t,n){n.entity&&(n.entity.polygon=void 0)},cesiumProps:dr$1,cesiumEventProps:mr$1}),aa$1=fr$1,hr$1=["distanceDisplayCondition","id","loop","material","positions","show","width"];l({name:"Polyline",create:(t,n)=>{var o;return(o=t.polylineCollection)==null?void 0:o.add(n)},destroy(t,n){n.polylineCollection&&!n.polylineCollection.isDestroyed()&&n.polylineCollection.remove(t)},cesiumProps:hr$1,useCommonEvent:!0});const pr$1=["debugShowBoundingVolume","length","modelMatrix","show"];l({name:"PolylineCollection",create(t,n){if(!t.primitiveCollection)return;const o=new Cesium$1.PolylineCollection({modelMatrix:n.modelMatrix,debugShowBoundingVolume:n.debugShowBoundingVolume,length:n.length,scene:t.scene});return t.primitiveCollection.add(o),o},destroy(t,n){n.primitiveCollection&&!n.primitiveCollection.isDestroyed()&&n.primitiveCollection.remove(t),t.isDestroyed()||t.destroy()},provide(t){return{polylineCollection:t}},cesiumProps:pr$1});const gr$1=["arcType","classificationType","positions","clampToGround","width","show","material","depthFailMaterial","granularity","shadows","distanceDisplayCondition","zIndex"],Cr$1={onDefinitionChange:"definitionChanged"},Pr$1=l({name:"PolylineGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.PolylineGraphics(n);return t.entity.polyline=o,o},destroy(t,n){n.entity&&(n.entity.polyline=void 0)},cesiumProps:gr$1,cesiumEventProps:Cr$1}),ua$1=Pr$1,Sr$1=["positions","shape","cornerType","show","fill","material","outline","outlineColor","outlineWidth","granularity","shadows","distanceDisplayCondition"],Er$1={onDefinitionChange:"definitionChanged"};l({name:"PolylineVolumeGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.PolylineVolumeGraphics(n);return t.entity.polylineVolume=o,o},destroy(t,n){n.entity&&(n.entity.polylineVolume=void 0)},cesiumProps:Sr$1,cesiumEventProps:Er$1});const wr$1=["enabled","selected"],Dr$1=["clearColor","forcePowerOfTwo","fragmentShader","name","pixelDatatype","pixelFormat","sampleMode","scissorRectangle","textureScale","uniforms"];l({name:"PostProcessStage",create(t,n){if(!t.scene)return;const o=new Cesium$1.PostProcessStage(n);return typeof n.enabled=="boolean"&&(o.enabled=n.enabled),n.selected&&(o.selected=n.selected),t.scene.postProcessStages.add(o),o},destroy(t,n){n.scene&&!n.scene.isDestroyed()&&n.scene.postProcessStages.remove(t),t.isDestroyed()||t.destroy()},cesiumProps:wr$1,cesiumReadonlyProps:Dr$1}),U$1({name:"BlackAndWhiteStage",props:["gradations"],create:()=>Cesium$1.PostProcessStageLibrary.createBlackAndWhiteStage()}),U$1({name:"BrightnessStage",props:["brightness"],create:()=>Cesium$1.PostProcessStageLibrary.createBrightnessStage()}),U$1({name:"LensFlareStage",props:["dirtTexture","starTexture","intensity","distortion","ghostDispersal","haloWidth","earthRadius"],create:()=>Cesium$1.PostProcessStageLibrary.createLensFlareStage()}),U$1({name:"Fxaa",create:(t,n)=>n.fxaa,props:[]}),U$1({name:"NightVisionStage",props:[],create:()=>Cesium$1.PostProcessStageLibrary.createNightVisionStage()});const Rr$1=["enabled","selected"],$r$1=["inputPreviousStageTexture","name","stages","uniforms"];l({name:"PostProcessStageComposite",create(t,n){if(!t.scene)return;const o=new Cesium$1.PostProcessStageComposite(n);return typeof n.enabled=="boolean"&&(o.enabled=n.enabled),n.selected&&(o.selected=n.selected),t.scene.postProcessStages.add(o),o},destroy(t,n){n.scene&&!n.scene.isDestroyed()&&n.scene.postProcessStages.remove(t),t.isDestroyed()||t.destroy()},cesiumProps:Rr$1,cesiumReadonlyProps:$r$1}),U$1({name:"AmbientOcclusion",create:(t,n)=>n.ambientOcclusion,props:["ambientOcclusionOnly","bias","delta","frustumLength","intensity","lengthCap","sigma","stepSize"],noMount:!0}),U$1({name:"Bloom",create:(t,n)=>n.bloom,props:["brightness","contrast","delta","glowOnly","sigma","stepSize"],noMount:!0}),U$1({name:"BlurStage",props:["delta","sigma","stepSize"],create:()=>Cesium$1.PostProcessStageLibrary.createBlurStage()}),U$1({name:"DepthOfFieldStage",props:["delta","focalDistance","sigma","stepSize"],create:()=>Cesium$1.PostProcessStageLibrary.createDepthOfFieldStage()}),U$1({name:"EdgeDetectionStage",props:["color","length"],create:()=>Cesium$1.PostProcessStageLibrary.createEdgeDetectionStage()}),U$1({name:"SilhouetteStage",props:["color","length"],create:()=>Cesium$1.PostProcessStageLibrary.createSilhouetteStage()});const Tr$1=["appearance","cull","debugShowBoundingVolume","depthFailAppearance","modelMatrix","shadows","show"],Mr$1=["allowPicking","asynchronous","compressVertices","geometryInstances","interleave","releaseGeometryInstances","vertexCacheOptimize"],kr$1=["onReady"],Lr$1=l({name:"Primitive",create(t,n){var o;if(!t.primitiveCollection)return;const s=new Cesium$1.Primitive(n);if(n.onReady){const c=()=>{var d,h;s.ready&&((d=n.onReady)==null||d.call(n,s),(h=t.scene)==null||h.postRender.removeEventListener(c))};(o=t.scene)==null||o.postRender.addEventListener(c)}return t.primitiveCollection.add(s),s},destroy(t,n){n.primitiveCollection&&!n.primitiveCollection.isDestroyed()&&n.primitiveCollection.remove(t),t.isDestroyed()||t.destroy()},cesiumProps:Tr$1,cesiumReadonlyProps:Mr$1,otherProps:kr$1,useCommonEvent:!0}),Da$1=Lr$1,_r$1=["classificationType","coordinates","height","heightReference","extrudedHeight","extrudedHeightReference","show","fill","material","outline","outlineColor","outlineWidth","rotation","stRotation","granularity","shadows","distanceDisplayCondition","zIndex"],Or$1={onDefinitionChange:"definitionChanged"};l({name:"RectangleGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.RectangleGraphics(n);return t.entity.rectangle=o,o},destroy(t,n){n.entity&&(n.entity.rectangle=void 0)},cesiumProps:_r$1,cesiumEventProps:Or$1});const Br$1=["backgroundColor","completeMorphOnUserInput","debugCommandFilter","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","postProcessStages","msaaSamples","splitPosition","debugCommandFilter","verticalExaggeration","verticalExaggerationRelativeHeight","atmosphere"],Ar$1={onMorphComplete:"morphComplete",onMorphStart:"morphStart",onPostRender:"postRender",onPreRender:"preRender",onPreUpdate:"preUpdate",onPostUpdate:"postUpdate",onRenderError:"renderError",onTerrainProviderChange:"terrainProviderChanged"},Fr$1=["mode","morphDuration"],ui=(t,n,o)=>{switch(n){case Cesium$1.SceneMode.SCENE2D:t.morphTo2D(o);break;case Cesium$1.SceneMode.COLUMBUS_VIEW:t.morphToColumbusView(o);break;case Cesium$1.SceneMode.SCENE3D:t.morphTo3D(o);break}},Ir$1=l({name:"Scene",create(t,n){return t.scene&&n.mode&&ui(t.scene,n.mode,n.morphDuration),t.scene},update(t,n,o){n.mode!==o.mode&&n.mode&&ui(t,n.mode,n.morphDuration)},cesiumProps:Br$1,cesiumEventProps:Ar$1,otherProps:Fr$1,setCesiumPropsAfterCreate:!0}),$a$1=Ir$1,Wr$1=["bounceAnimationTime","enableCollisionDetection","enableInputs","enableLook","enableRotate","enableTilt","enableTranslate","enableZoom","inertiaSpin","inertiaTranslate","inertiaZoom","lookEventTypes","maximumMovementRatio","maximumZoomDistance","minimumCollisionTerrainHeight","minimumPickingTerrainHeight","minimumTrackBallHeight","minimumZoomDistance","rotateEventTypes","tiltEventTypes","translateEventTypes","zoomEventTypes","minimumPickingTerrainDistanceWithInertia"],Vr$1=l({name:"ScreenSpaceCameraController",create:t=>{var n;return(n=t.scene)==null?void 0:n.screenSpaceCameraController},cesiumProps:Wr$1,setCesiumPropsAfterCreate:!0}),Ta$1=Vr$1,Ur$1=({action:t,modifier:n,type:o})=>{const s=$e$1();return React.useEffect(()=>{if(!(!s.screenSpaceEventHandler||s.screenSpaceEventHandler.isDestroyed())){if(t)return s.screenSpaceEventHandler.setInputAction(t,o,n),()=>{!s.screenSpaceEventHandler||s.screenSpaceEventHandler.isDestroyed()||s.screenSpaceEventHandler.removeInputAction(o,n)};s.screenSpaceEventHandler.removeInputAction(o,n)}},[t,s.screenSpaceEventHandler,n,o]),null},Ma$1=Ur$1,jr$1=l({name:"ScreenSpaceEventHandler",create(t,n){var o;return n.useDefault?(o=t.cesiumWidget)==null?void 0:o.screenSpaceEventHandler:t.scene?new Cesium$1.ScreenSpaceEventHandler(t.scene.canvas):void 0},destroy(t){t.isDestroyed()||t.destroy()},provide(t){return{screenSpaceEventHandler:t}}}),ka$1=jr$1,Hr$1=["darkness","fadingEnabled","maximumDistance","enabled","normalOffset","softShadows","size"];l({name:"ShadowMap",create:t=>{var n;return(n=t.scene)==null?void 0:n.shadowMap},cesiumProps:Hr$1});const xr$1=["brightnessShift","hueShift","saturationShift","show","perFragmentAtmosphere","atmosphereLightIntensity","atmosphereRayleighCoefficient","atmosphereMieCoefficient","atmosphereRayleighScaleHeight","atmosphereMieScaleHeight","atmosphereMieAnisotropy"],Nr$1=l({name:"SkyAtmosphere",create:t=>{var n;return(n=t.scene)==null?void 0:n.skyAtmosphere},cesiumProps:xr$1,setCesiumPropsAfterCreate:!0}),_a$2=Nr$1,qr$1=["sources","show"],Yr$1=l({name:"SkyBox",create:t=>{var n;return(n=t.scene)==null?void 0:n.skyBox},cesiumProps:qr$1,setCesiumPropsAfterCreate:!0}),Oa$1=Yr$1,Kr$1=["glowFactor","show"],Jr$1=l({name:"Sun",create(t){if(!t.scene)return;const n=new Cesium$1.Sun;return t.scene.sun=n,n},destroy(t,n){n.scene&&!n.scene.isDestroyed()&&(n.scene.sun=new Cesium$1.Sun)},cesiumProps:Kr$1,setCesiumPropsAfterCreate:!0}),Ga$1=Jr$1,Zr$1=["clippingPlanes","maximumMemoryUsage","modelMatrix","shadows","show","style","intervals"],Xr$1=["clock","shading"],Qr$1=["onReady"],es$1={onFrameChange:"frameChanged"};l({name:"TimeDynamicPointCloud",create(t,n){var o;if(!t.cesiumWidget||!t.primitiveCollection||!((o=t.cesiumWidget)!=null&&o.clock))return;const s=new Cesium$1.TimeDynamicPointCloud({...n,clock:n.clock??t.cesiumWidget.clock});if(n.onReady){const c=()=>{var d;(d=n.onReady)==null||d.call(n,s),s.frameChanged.removeEventListener(c)};s.frameChanged.addEventListener(c)}return t.primitiveCollection.add(s),s},destroy(t,n){n.primitiveCollection&&!n.primitiveCollection.isDestroyed()&&n.primitiveCollection.remove(t),t.isDestroyed()||t.destroy()},cesiumProps:Zr$1,cesiumReadonlyProps:Xr$1,cesiumEventProps:es$1,otherProps:Qr$1,useCommonEvent:!0});const ts$1=["terrainShadows","clockTrackedDataSource","targetFrameRate","useDefaultRenderLoop","resolutionScale","allowDataSourcesToSuspendAnimation","trackedEntity","selectedEntity","shadows","useBrowserRecommendedResolution","creditDisplay"],ns$1=["baseLayer","animation","baseLayerPicker","fullscreenButton","vrButton","geocoder","homeButton","infoBox","sceneModePicker","selectionIndicator","timeline","navigationHelpButton","navigationInstructionsInitiallyVisible","scene3DOnly","shouldAnimate","clockViewModel","selectedImageryProviderViewModel","imageryProviderViewModels","selectedTerrainProviderViewModel","terrainProviderViewModels","skyBox","skyAtmosphere","fullscreenElement","showRenderLoopErrors","automaticallyTrackDataSourceClocks","contextOptions","sceneMode","mapProjection","globe","orderIndependentTranslucency","creditContainer","creditViewport","dataSources","mapMode2D","projectionPicker","requestRenderMode","maximumRenderTimeChange","depthPlaneEllipsoidOffset","msaaSamples","blurActiveElementOnCanvasFocus","terrain"],os$1={onSelectedEntityChange:"selectedEntityChanged",onTrackedEntityChange:"trackedEntityChanged"},rs$1=["className","id","style","full","containerProps","extend","terrainProvider"],ss$1=l({name:"Viewer",async create(t,{baseLayer:n,terrainProvider:o,...s},c){if(!c)return;let d;J(o)?d=await o:d=o;const h=new Cesium$1.Viewer(c,{...s,terrainProvider:d,baseLayer:n===!1?void 0:n});if(!h)return;n===!1&&h.imageryLayers.removeAll(),h&&s.extend&&(Array.isArray(s.extend)?s.extend.forEach(y=>{h.extend(y,{})}):h.extend(s.extend,{}));const p=new De$1(h.scene);return[h,p]},destroy(t,n,o,s){s&&!s.isDestroyed()&&s.destroy(),t.isDestroyed()||t.destroy()},provide(t,n,o,s){return{viewer:t,cesiumWidget:t.cesiumWidget,dataSourceCollection:t.dataSources,entityCollection:t.entities,scene:t.scene,camera:t.scene.camera,imageryLayerCollection:t.scene.globe.imageryLayers,primitiveCollection:t.scene.primitives,globe:t.scene.globe,__$internal:{onUpdate:o==null?void 0:o.onUpdate,imageryLayerWaitingList:[]},[ce$1]:s}},containerProps:({id:t,className:n,style:o,full:s,containerProps:c})=>({className:n,id:t,style:{...s?{position:"absolute",bottom:"0",left:"0",right:"0",top:"0"}:{},...o},...c}),cesiumProps:ts$1,cesiumReadonlyProps:ns$1,cesiumEventProps:os$1,otherProps:rs$1,renderContainer:!0,useCommonEvent:!0,useRootEvent:!0}),Aa$1=ss$1,as$1=["positions","maximumHeights","minimumHeights","show","fill","material","outline","outlineColor","outlineWidth","granularity","shadows","distanceDisplayCondition"],cs$1={onDefinitionChange:"definitionChanged"};l({name:"WallGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.WallGraphics(n);return t.entity.wall=o,o},destroy(t,n){n.entity&&(n.entity.wall=void 0)},cesiumProps:as$1,cesiumEventProps:cs$1});const SpatialIdSpace=React.memo(({space:t})=>{const n=React.useMemo(()=>({rectangle:{coordinates:Cesium$1.Rectangle.fromDegrees(...t.wsen),height:t.height,heightReference:Cesium$1.HeightReference.NONE,extrudedHeight:t.extrudedHeight,clampToGround:!1,fill:!0,outline:!0,outlineColor:Cesium$1.Color.fromCssColorString(t.outlineColor??""),material:Cesium$1.Color.fromCssColorString(t.color??""),classificationType:Cesium$1.ClassificationType.TERRAIN}}),[t]);return jsxRuntimeExports.jsx(Is$1,{id:t.id,...n})});SpatialIdSpace.displayName="SpatialIdSpace";const CoordinateIndicator=React.memo(({wsen:t,color:n})=>{const o=React.useMemo(()=>({rectangle:{coordinates:Cesium$1.Rectangle.fromDegrees(...t),clampToGround:!0,fill:!0,outline:!1,material:Cesium$1.Color.fromCssColorString(n),classificationType:Cesium$1.ClassificationType.BOTH}}),[t,n]);return jsxRuntimeExports.jsx(Is$1,{...o})});CoordinateIndicator.displayName="SpatialIdSpace";const VerticalSpaceIndicator=React.memo(({indicator:t})=>{const n=React.useMemo(()=>({rectangle:{coordinates:Cesium$1.Rectangle.fromDegrees(...t.wsen),height:t.height,extrudedHeight:t.extrudedHeight,clampToGround:!1,fill:!0,outline:!0,outlineColor:Cesium$1.Color.fromCssColorString(t.outlineColor),material:Cesium$1.Color.fromCssColorString(t.color),classificationType:Cesium$1.ClassificationType.TERRAIN}}),[t]);return jsxRuntimeExports.jsx(Is$1,{...n})});VerticalSpaceIndicator.displayName="VerticalSpaceIndicator";const SPATIALID_DEFAULT_OPTIONS={zoom:20,maxHeight:4e3,minHeight:-1e3,dataOnly:!1,rightClickToExit:!0,color:"#00bebe44",outlineColor:"#00bebe55",groundIndicatorColor:"#00000066",selectorColor:"#ff990099",selectorOutlineColor:"#ff9900aa",verticalSpaceIndicatorColor:"#ffffff33",verticalSpaceIndicatorOutlineColor:"#ffffff55"},SPATIALID_LATITUDE_RANGE={min:-85.0511,max:85.0511};function isZFXYTile(t){return"z"in t&&"f"in t&&"x"in t&&"y"in t}const ZFXY_1M_ZOOM_BASE=25,ZFXY_ROOT_TILE={f:0,x:0,y:0,z:0},rad2deg=180/Math.PI;function getParent(t,n=1){const{f:o,x:s,y:c,z:d}=t;if(n<=0)throw new Error("steps must be greater than 0");if(n>d)throw new Error(`Getting parent tile of ${t}, ${n} steps is not possible because it would go beyond the root tile (z=0)`);return{f:o>>n,x:s>>n,y:c>>n,z:d-n}}function getChildren(t=ZFXY_ROOT_TILE){const{f:n,x:o,y:s,z:c}=t;return[{f:n*2,x:o*2,y:s*2,z:c+1},{f:n*2,x:o*2+1,y:s*2,z:c+1},{f:n*2,x:o*2,y:s*2+1,z:c+1},{f:n*2,x:o*2+1,y:s*2+1,z:c+1},{f:n*2+1,x:o*2,y:s*2,z:c+1},{f:n*2+1,x:o*2+1,y:s*2,z:c+1},{f:n*2+1,x:o*2,y:s*2+1,z:c+1},{f:n*2+1,x:o*2+1,y:s*2+1,z:c+1}]}function getSurrounding(t=ZFXY_ROOT_TILE){const{f:n,x:o,y:s,z:c}=t;return[zfxyWraparound({f:n,x:o,y:s,z:c}),zfxyWraparound({f:n,x:o+1,y:s,z:c}),zfxyWraparound({f:n,x:o,y:s+1,z:c}),zfxyWraparound({f:n,x:o+1,y:s+1,z:c}),zfxyWraparound({f:n,x:o-1,y:s,z:c}),zfxyWraparound({f:n,x:o,y:s-1,z:c}),zfxyWraparound({f:n,x:o-1,y:s-1,z:c}),zfxyWraparound({f:n,x:o+1,y:s-1,z:c}),zfxyWraparound({f:n,x:o-1,y:s+1,z:c})]}function parseZFXYString(t){const n=t.match(/^\/?(\d+)\/(?:(\d+)\/)?(\d+)\/(\d+)$/);if(n)return{z:parseInt(n[1],10),f:parseInt(n[2]||"0",10),x:parseInt(n[3],10),y:parseInt(n[4],10)}}function getLngLat(t){const n=Math.PI-2*Math.PI*t.y/Math.pow(2,t.z);return{lng:t.x/Math.pow(2,t.z)*360-180,lat:rad2deg*Math.atan(.5*(Math.exp(n)-Math.exp(-n)))}}function getCenterLngLat(t){const n=t.x*2+1,o=t.y*2+1,s=t.z+1;return getLngLat({x:n,y:o,z:s,f:0})}function getCenterLngLatAlt(t){return{...getCenterLngLat(t),alt:getFloor(t)+2**ZFXY_1M_ZOOM_BASE/2**(t.z+1)}}function getBBox(t){const n=getLngLat(t),o=getLngLat({...t,y:t.y+1,x:t.x+1});return[n,o]}function getFloor(t){return t.f*2**ZFXY_1M_ZOOM_BASE/2**t.z}function calculateZFXY(t){const n=typeof t.alt<"u"?t.alt:0;if(n<=-33554432||n>=2**ZFXY_1M_ZOOM_BASE)throw new Error(`ZFXY only supports altitude between -2^${ZFXY_1M_ZOOM_BASE} and +2^${ZFXY_1M_ZOOM_BASE}.`);const o=Math.floor(2**t.zoom*n/2**ZFXY_1M_ZOOM_BASE),s=Math.PI/180,c=Math.sin(t.lat*s),d=2**t.zoom;let h=d*(t.lng/360+.5);const p=d*(.5-.25*Math.log((1+c)/(1-c))/Math.PI);return h=h%d,h<0&&(h=h+d),{f:o,x:Math.floor(h),y:Math.floor(p),z:t.zoom}}function zfxyWraparound(t){const{z:n,f:o,x:s,y:c}=t;return{z:n,f:Math.max(Math.min(o,2**n),-(2**n)),x:s<0?s+2**n:s%2**n,y:c<0?c+2**n:c%2**n}}function parseZFXYTilehash(t){let n=!1;t[0]==="-"&&(n=!0,t=t.substring(1));let o=getChildren(),s;for(const c of t)s={...o[parseInt(c,10)-1]},o=getChildren(s);return n&&(s.f=-s.f),s}function generateTilehash(t){let{f:n,x:o,y:s,z:c}=t;const d=n;let h="";for(;c>0;){const p={f:Math.abs(n),x:o,y:s,z:c},y=getParent(p);h=(getChildren(y).findIndex(L=>L.f===Math.abs(n)&&L.x===o&&L.y===s&&L.z===c)+1).toString()+h,n=y.f,o=y.x,s=y.y,c=y.z}return(d<0?"-":"")+h}function feature(t,n,o){o===void 0&&(o={});var s={type:"Feature"};return(o.id===0||o.id)&&(s.id=o.id),o.bbox&&(s.bbox=o.bbox),s.properties=n||{},s.geometry=t,s}function point(t,n,o){if(o===void 0&&(o={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!isNumber$1(t[0])||!isNumber$1(t[1]))throw new Error("coordinates must contain numbers");var s={type:"Point",coordinates:t};return feature(s,n,o)}function lineString(t,n,o){if(o===void 0&&(o={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");var s={type:"LineString",coordinates:t};return feature(s,n,o)}function featureCollection$1(t,n){n===void 0&&(n={});var o={type:"FeatureCollection"};return n.id&&(o.id=n.id),n.bbox&&(o.bbox=n.bbox),o.features=t,o}function multiLineString(t,n,o){o===void 0&&(o={});var s={type:"MultiLineString",coordinates:t};return feature(s,n,o)}function isNumber$1(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}function coordEach$1(t,n,o){if(t!==null)for(var s,c,d,h,p,y,S,P=0,L=0,F,N=t.type,z=N==="FeatureCollection",W=N==="Feature",nt=z?t.features.length:1,Pe=0;Pe<nt;Pe++){S=z?t.features[Pe].geometry:W?t.geometry:t,F=S?S.type==="GeometryCollection":!1,p=F?S.geometries.length:1;for(var se=0;se<p;se++){var mt=0,kt=0;if(h=F?S.geometries[se]:S,h!==null){y=h.coordinates;var mn=h.type;switch(P=0,mn){case null:break;case"Point":if(n(y,L,Pe,mt,kt)===!1)return!1;L++,mt++;break;case"LineString":case"MultiPoint":for(s=0;s<y.length;s++){if(n(y[s],L,Pe,mt,kt)===!1)return!1;L++,mn==="MultiPoint"&&mt++}mn==="LineString"&&mt++;break;case"Polygon":case"MultiLineString":for(s=0;s<y.length;s++){for(c=0;c<y[s].length-P;c++){if(n(y[s][c],L,Pe,mt,kt)===!1)return!1;L++}mn==="MultiLineString"&&mt++,mn==="Polygon"&&kt++}mn==="Polygon"&&mt++;break;case"MultiPolygon":for(s=0;s<y.length;s++){for(kt=0,c=0;c<y[s].length;c++){for(d=0;d<y[s][c].length-P;d++){if(n(y[s][c][d],L,Pe,mt,kt)===!1)return!1;L++}kt++}mt++}break;case"GeometryCollection":for(s=0;s<h.geometries.length;s++)if(coordEach$1(h.geometries[s],n)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function featureEach$2(t,n){if(t.type==="Feature")n(t,0);else if(t.type==="FeatureCollection")for(var o=0;o<t.features.length&&n(t.features[o],o)!==!1;o++);}function geomEach$1(t,n){var o,s,c,d,h,p,y,S,P,L,F=0,N=t.type==="FeatureCollection",z=t.type==="Feature",W=N?t.features.length:1;for(o=0;o<W;o++){for(p=N?t.features[o].geometry:z?t.geometry:t,S=N?t.features[o].properties:z?t.properties:{},P=N?t.features[o].bbox:z?t.bbox:void 0,L=N?t.features[o].id:z?t.id:void 0,y=p?p.type==="GeometryCollection":!1,h=y?p.geometries.length:1,c=0;c<h;c++){if(d=y?p.geometries[c]:p,d===null){if(n(null,F,S,P,L)===!1)return!1;continue}switch(d.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(n(d,F,S,P,L)===!1)return!1;break}case"GeometryCollection":{for(s=0;s<d.geometries.length;s++)if(n(d.geometries[s],F,S,P,L)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}F++}}function flattenEach$1(t,n){geomEach$1(t,function(o,s,c,d,h){var p=o===null?null:o.type;switch(p){case null:case"Point":case"LineString":case"Polygon":return n(feature(o,c,{bbox:d,id:h}),s,0)===!1?!1:void 0}var y;switch(p){case"MultiPoint":y="Point";break;case"MultiLineString":y="LineString";break;case"MultiPolygon":y="Polygon";break}for(var S=0;S<o.coordinates.length;S++){var P=o.coordinates[S],L={type:y,coordinates:P};if(n(feature(L,c),s,S)===!1)return!1}})}function bbox$2(t){var n=[1/0,1/0,-1/0,-1/0];return coordEach$1(t,function(o){n[0]>o[0]&&(n[0]=o[0]),n[1]>o[1]&&(n[1]=o[1]),n[2]<o[0]&&(n[2]=o[0]),n[3]<o[1]&&(n[3]=o[1])}),n}bbox$2.default=bbox$2;function getCoord(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if(t.type==="Feature"&&t.geometry!==null&&t.geometry.type==="Point")return t.geometry.coordinates;if(t.type==="Point")return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function getCoords(t){if(Array.isArray(t))return t;if(t.type==="Feature"){if(t.geometry!==null)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function getGeom(t){return t.type==="Feature"?t.geometry:t}function booleanPointInPolygon$1(t,n,o){if(o===void 0&&(o={}),!t)throw new Error("point is required");if(!n)throw new Error("polygon is required");var s=getCoord(t),c=getGeom(n),d=c.type,h=n.bbox,p=c.coordinates;if(h&&inBBox$1(s,h)===!1)return!1;d==="Polygon"&&(p=[p]);for(var y=!1,S=0;S<p.length&&!y;S++)if(inRing$1(s,p[S][0],o.ignoreBoundary)){for(var P=!1,L=1;L<p[S].length&&!P;)inRing$1(s,p[S][L],!o.ignoreBoundary)&&(P=!0),L++;P||(y=!0)}return y}function inRing$1(t,n,o){var s=!1;n[0][0]===n[n.length-1][0]&&n[0][1]===n[n.length-1][1]&&(n=n.slice(0,n.length-1));for(var c=0,d=n.length-1;c<n.length;d=c++){var h=n[c][0],p=n[c][1],y=n[d][0],S=n[d][1],P=t[1]*(h-y)+p*(y-t[0])+S*(t[0]-h)===0&&(h-t[0])*(y-t[0])<=0&&(p-t[1])*(S-t[1])<=0;if(P)return!o;var L=p>t[1]!=S>t[1]&&t[0]<(y-h)*(t[1]-p)/(S-p)+h;L&&(s=!s)}return s}function inBBox$1(t,n){return n[0]<=t[0]&&n[1]<=t[1]&&n[2]>=t[0]&&n[3]>=t[1]}function lineSegment(t){if(!t)throw new Error("geojson is required");var n=[];return flattenEach$1(t,function(o){lineSegmentFeature(o,n)}),featureCollection$1(n)}function lineSegmentFeature(t,n){var o=[],s=t.geometry;if(s!==null){switch(s.type){case"Polygon":o=getCoords(s);break;case"LineString":o=[getCoords(s)]}o.forEach(function(c){var d=createSegments(c,t.properties);d.forEach(function(h){h.id=n.length,n.push(h)})})}}function createSegments(t,n){var o=[];return t.reduce(function(s,c){var d=lineString([s,c],n);return d.bbox=bbox$1(s,c),o.push(d),c}),o}function bbox$1(t,n){var o=t[0],s=t[1],c=n[0],d=n[1],h=o<c?o:c,p=s<d?s:d,y=o>c?o:c,S=s>d?s:d;return[h,p,y,S]}var geojsonRbush$1={exports:{}};function quickselect$3(t,n,o,s,c){quickselectStep(t,n,o||0,s||t.length-1,c||defaultCompare)}function quickselectStep(t,n,o,s,c){for(;s>o;){if(s-o>600){var d=s-o+1,h=n-o+1,p=Math.log(d),y=.5*Math.exp(2*p/3),S=.5*Math.sqrt(p*y*(d-y)/d)*(h-d/2<0?-1:1),P=Math.max(o,Math.floor(n-h*y/d+S)),L=Math.min(s,Math.floor(n+(d-h)*y/d+S));quickselectStep(t,n,P,L,c)}var F=t[n],N=o,z=s;for(swap$3(t,o,n),c(t[s],F)>0&&swap$3(t,o,s);N<z;){for(swap$3(t,N,z),N++,z--;c(t[N],F)<0;)N++;for(;c(t[z],F)>0;)z--}c(t[o],F)===0?swap$3(t,o,z):(z++,swap$3(t,z,s)),z<=n&&(o=z+1),n<=z&&(s=z-1)}}function swap$3(t,n,o){var s=t[n];t[n]=t[o],t[o]=s}function defaultCompare(t,n){return t<n?-1:t>n?1:0}class RBush{constructor(n=9){this._maxEntries=Math.max(4,n),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(n){let o=this.data;const s=[];if(!intersects$1(n,o))return s;const c=this.toBBox,d=[];for(;o;){for(let h=0;h<o.children.length;h++){const p=o.children[h],y=o.leaf?c(p):p;intersects$1(n,y)&&(o.leaf?s.push(p):contains$1(n,y)?this._all(p,s):d.push(p))}o=d.pop()}return s}collides(n){let o=this.data;if(!intersects$1(n,o))return!1;const s=[];for(;o;){for(let c=0;c<o.children.length;c++){const d=o.children[c],h=o.leaf?this.toBBox(d):d;if(intersects$1(n,h)){if(o.leaf||contains$1(n,h))return!0;s.push(d)}}o=s.pop()}return!1}load(n){if(!(n&&n.length))return this;if(n.length<this._minEntries){for(let s=0;s<n.length;s++)this.insert(n[s]);return this}let o=this._build(n.slice(),0,n.length-1,0);if(!this.data.children.length)this.data=o;else if(this.data.height===o.height)this._splitRoot(this.data,o);else{if(this.data.height<o.height){const s=this.data;this.data=o,o=s}this._insert(o,this.data.height-o.height-1,!0)}return this}insert(n){return n&&this._insert(n,this.data.height-1),this}clear(){return this.data=createNode$1([]),this}remove(n,o){if(!n)return this;let s=this.data;const c=this.toBBox(n),d=[],h=[];let p,y,S;for(;s||d.length;){if(s||(s=d.pop(),y=d[d.length-1],p=h.pop(),S=!0),s.leaf){const P=findItem$1(n,s.children,o);if(P!==-1)return s.children.splice(P,1),d.push(s),this._condense(d),this}!S&&!s.leaf&&contains$1(s,c)?(d.push(s),h.push(p),p=0,y=s,s=s.children[0]):y?(p++,s=y.children[p],S=!1):s=null}return this}toBBox(n){return n}compareMinX(n,o){return n.minX-o.minX}compareMinY(n,o){return n.minY-o.minY}toJSON(){return this.data}fromJSON(n){return this.data=n,this}_all(n,o){const s=[];for(;n;)n.leaf?o.push(...n.children):s.push(...n.children),n=s.pop();return o}_build(n,o,s,c){const d=s-o+1;let h=this._maxEntries,p;if(d<=h)return p=createNode$1(n.slice(o,s+1)),calcBBox$1(p,this.toBBox),p;c||(c=Math.ceil(Math.log(d)/Math.log(h)),h=Math.ceil(d/Math.pow(h,c-1))),p=createNode$1([]),p.leaf=!1,p.height=c;const y=Math.ceil(d/h),S=y*Math.ceil(Math.sqrt(h));multiSelect$1(n,o,s,S,this.compareMinX);for(let P=o;P<=s;P+=S){const L=Math.min(P+S-1,s);multiSelect$1(n,P,L,y,this.compareMinY);for(let F=P;F<=L;F+=y){const N=Math.min(F+y-1,L);p.children.push(this._build(n,F,N,c-1))}}return calcBBox$1(p,this.toBBox),p}_chooseSubtree(n,o,s,c){for(;c.push(o),!(o.leaf||c.length-1===s);){let d=1/0,h=1/0,p;for(let y=0;y<o.children.length;y++){const S=o.children[y],P=bboxArea$1(S),L=enlargedArea$1(n,S)-P;L<h?(h=L,d=P<d?P:d,p=S):L===h&&P<d&&(d=P,p=S)}o=p||o.children[0]}return o}_insert(n,o,s){const c=s?n:this.toBBox(n),d=[],h=this._chooseSubtree(c,this.data,o,d);for(h.children.push(n),extend$2(h,c);o>=0&&d[o].children.length>this._maxEntries;)this._split(d,o),o--;this._adjustParentBBoxes(c,d,o)}_split(n,o){const s=n[o],c=s.children.length,d=this._minEntries;this._chooseSplitAxis(s,d,c);const h=this._chooseSplitIndex(s,d,c),p=createNode$1(s.children.splice(h,s.children.length-h));p.height=s.height,p.leaf=s.leaf,calcBBox$1(s,this.toBBox),calcBBox$1(p,this.toBBox),o?n[o-1].children.push(p):this._splitRoot(s,p)}_splitRoot(n,o){this.data=createNode$1([n,o]),this.data.height=n.height+1,this.data.leaf=!1,calcBBox$1(this.data,this.toBBox)}_chooseSplitIndex(n,o,s){let c,d=1/0,h=1/0;for(let p=o;p<=s-o;p++){const y=distBBox$1(n,0,p,this.toBBox),S=distBBox$1(n,p,s,this.toBBox),P=intersectionArea$1(y,S),L=bboxArea$1(y)+bboxArea$1(S);P<d?(d=P,c=p,h=L<h?L:h):P===d&&L<h&&(h=L,c=p)}return c||s-o}_chooseSplitAxis(n,o,s){const c=n.leaf?this.compareMinX:compareNodeMinX$1,d=n.leaf?this.compareMinY:compareNodeMinY$1,h=this._allDistMargin(n,o,s,c),p=this._allDistMargin(n,o,s,d);h<p&&n.children.sort(c)}_allDistMargin(n,o,s,c){n.children.sort(c);const d=this.toBBox,h=distBBox$1(n,0,o,d),p=distBBox$1(n,s-o,s,d);let y=bboxMargin$1(h)+bboxMargin$1(p);for(let S=o;S<s-o;S++){const P=n.children[S];extend$2(h,n.leaf?d(P):P),y+=bboxMargin$1(h)}for(let S=s-o-1;S>=o;S--){const P=n.children[S];extend$2(p,n.leaf?d(P):P),y+=bboxMargin$1(p)}return y}_adjustParentBBoxes(n,o,s){for(let c=s;c>=0;c--)extend$2(o[c],n)}_condense(n){for(let o=n.length-1,s;o>=0;o--)n[o].children.length===0?o>0?(s=n[o-1].children,s.splice(s.indexOf(n[o]),1)):this.clear():calcBBox$1(n[o],this.toBBox)}}function findItem$1(t,n,o){if(!o)return n.indexOf(t);for(let s=0;s<n.length;s++)if(o(t,n[s]))return s;return-1}function calcBBox$1(t,n){distBBox$1(t,0,t.children.length,n,t)}function distBBox$1(t,n,o,s,c){c||(c=createNode$1(null)),c.minX=1/0,c.minY=1/0,c.maxX=-1/0,c.maxY=-1/0;for(let d=n;d<o;d++){const h=t.children[d];extend$2(c,t.leaf?s(h):h)}return c}function extend$2(t,n){return t.minX=Math.min(t.minX,n.minX),t.minY=Math.min(t.minY,n.minY),t.maxX=Math.max(t.maxX,n.maxX),t.maxY=Math.max(t.maxY,n.maxY),t}function compareNodeMinX$1(t,n){return t.minX-n.minX}function compareNodeMinY$1(t,n){return t.minY-n.minY}function bboxArea$1(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function bboxMargin$1(t){return t.maxX-t.minX+(t.maxY-t.minY)}function enlargedArea$1(t,n){return(Math.max(n.maxX,t.maxX)-Math.min(n.minX,t.minX))*(Math.max(n.maxY,t.maxY)-Math.min(n.minY,t.minY))}function intersectionArea$1(t,n){const o=Math.max(t.minX,n.minX),s=Math.max(t.minY,n.minY),c=Math.min(t.maxX,n.maxX),d=Math.min(t.maxY,n.maxY);return Math.max(0,c-o)*Math.max(0,d-s)}function contains$1(t,n){return t.minX<=n.minX&&t.minY<=n.minY&&n.maxX<=t.maxX&&n.maxY<=t.maxY}function intersects$1(t,n){return n.minX<=t.maxX&&n.minY<=t.maxY&&n.maxX>=t.minX&&n.maxY>=t.minY}function createNode$1(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function multiSelect$1(t,n,o,s,c){const d=[n,o];for(;d.length;){if(o=d.pop(),n=d.pop(),o-n<=s)continue;const h=n+Math.ceil((o-n)/s/2)*s;quickselect$3(t,h,n,o,c),d.push(n,h,h,o)}}var js$2={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.earthRadius=63710088e-1,t.factors={centimeters:t.earthRadius*100,centimetres:t.earthRadius*100,degrees:t.earthRadius/111325,feet:t.earthRadius*3.28084,inches:t.earthRadius*39.37,kilometers:t.earthRadius/1e3,kilometres:t.earthRadius/1e3,meters:t.earthRadius,metres:t.earthRadius,miles:t.earthRadius/1609.344,millimeters:t.earthRadius*1e3,millimetres:t.earthRadius*1e3,nauticalmiles:t.earthRadius/1852,radians:1,yards:t.earthRadius*1.0936},t.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/t.earthRadius,yards:1.0936133},t.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 n(Ra,ma,yt){yt===void 0&&(yt={});var lt={type:"Feature"};return(yt.id===0||yt.id)&&(lt.id=yt.id),yt.bbox&&(lt.bbox=yt.bbox),lt.properties=ma||{},lt.geometry=Ra,lt}t.feature=n;function o(Ra,ma,yt){switch(Ra){case"Point":return s(ma).geometry;case"LineString":return p(ma).geometry;case"Polygon":return d(ma).geometry;case"MultiPoint":return L(ma).geometry;case"MultiLineString":return P(ma).geometry;case"MultiPolygon":return F(ma).geometry;default:throw new Error(Ra+" is invalid")}}t.geometry=o;function s(Ra,ma,yt){if(yt===void 0&&(yt={}),!Ra)throw new Error("coordinates is required");if(!Array.isArray(Ra))throw new Error("coordinates must be an Array");if(Ra.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!zi(Ra[0])||!zi(Ra[1]))throw new Error("coordinates must contain numbers");var lt={type:"Point",coordinates:Ra};return n(lt,ma,yt)}t.point=s;function c(Ra,ma,yt){return yt===void 0&&(yt={}),S(Ra.map(function(lt){return s(lt,ma)}),yt)}t.points=c;function d(Ra,ma,yt){yt===void 0&&(yt={});for(var lt=0,pi=Ra;lt<pi.length;lt++){var ba=pi[lt];if(ba.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var Sc=0;Sc<ba[ba.length-1].length;Sc++)if(ba[ba.length-1][Sc]!==ba[0][Sc])throw new Error("First and last Position are not equivalent.")}var ms={type:"Polygon",coordinates:Ra};return n(ms,ma,yt)}t.polygon=d;function h(Ra,ma,yt){return yt===void 0&&(yt={}),S(Ra.map(function(lt){return d(lt,ma)}),yt)}t.polygons=h;function p(Ra,ma,yt){if(yt===void 0&&(yt={}),Ra.length<2)throw new Error("coordinates must be an array of two or more positions");var lt={type:"LineString",coordinates:Ra};return n(lt,ma,yt)}t.lineString=p;function y(Ra,ma,yt){return yt===void 0&&(yt={}),S(Ra.map(function(lt){return p(lt,ma)}),yt)}t.lineStrings=y;function S(Ra,ma){ma===void 0&&(ma={});var yt={type:"FeatureCollection"};return ma.id&&(yt.id=ma.id),ma.bbox&&(yt.bbox=ma.bbox),yt.features=Ra,yt}t.featureCollection=S;function P(Ra,ma,yt){yt===void 0&&(yt={});var lt={type:"MultiLineString",coordinates:Ra};return n(lt,ma,yt)}t.multiLineString=P;function L(Ra,ma,yt){yt===void 0&&(yt={});var lt={type:"MultiPoint",coordinates:Ra};return n(lt,ma,yt)}t.multiPoint=L;function F(Ra,ma,yt){yt===void 0&&(yt={});var lt={type:"MultiPolygon",coordinates:Ra};return n(lt,ma,yt)}t.multiPolygon=F;function N(Ra,ma,yt){yt===void 0&&(yt={});var lt={type:"GeometryCollection",geometries:Ra};return n(lt,ma,yt)}t.geometryCollection=N;function z(Ra,ma){if(ma===void 0&&(ma=0),ma&&!(ma>=0))throw new Error("precision must be a positive number");var yt=Math.pow(10,ma||0);return Math.round(Ra*yt)/yt}t.round=z;function W(Ra,ma){ma===void 0&&(ma="kilometers");var yt=t.factors[ma];if(!yt)throw new Error(ma+" units is invalid");return Ra*yt}t.radiansToLength=W;function nt(Ra,ma){ma===void 0&&(ma="kilometers");var yt=t.factors[ma];if(!yt)throw new Error(ma+" units is invalid");return Ra/yt}t.lengthToRadians=nt;function Pe(Ra,ma){return mt(nt(Ra,ma))}t.lengthToDegrees=Pe;function se(Ra){var ma=Ra%360;return ma<0&&(ma+=360),ma}t.bearingToAzimuth=se;function mt(Ra){var ma=Ra%(2*Math.PI);return ma*180/Math.PI}t.radiansToDegrees=mt;function kt(Ra){var ma=Ra%360;return ma*Math.PI/180}t.degreesToRadians=kt;function mn(Ra,ma,yt){if(ma===void 0&&(ma="kilometers"),yt===void 0&&(yt="kilometers"),!(Ra>=0))throw new Error("length must be a positive number");return W(nt(Ra,ma),yt)}t.convertLength=mn;function _i(Ra,ma,yt){if(ma===void 0&&(ma="meters"),yt===void 0&&(yt="kilometers"),!(Ra>=0))throw new Error("area must be a positive number");var lt=t.areaFactors[ma];if(!lt)throw new Error("invalid original units");var pi=t.areaFactors[yt];if(!pi)throw new Error("invalid final units");return Ra/lt*pi}t.convertArea=_i;function zi(Ra){return!isNaN(Ra)&&Ra!==null&&!Array.isArray(Ra)}t.isNumber=zi;function Sa(Ra){return!!Ra&&Ra.constructor===Object}t.isObject=Sa;function fa(Ra){if(!Ra)throw new Error("bbox is required");if(!Array.isArray(Ra))throw new Error("bbox must be an Array");if(Ra.length!==4&&Ra.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");Ra.forEach(function(ma){if(!zi(ma))throw new Error("bbox must only contain numbers")})}t.validateBBox=fa;function La(Ra){if(!Ra)throw new Error("id is required");if(["string","number"].indexOf(typeof Ra)===-1)throw new Error("id must be a number or a string")}t.validateId=La})(js$2);var js$1={};Object.defineProperty(js$1,"__esModule",{value:!0});var helpers$1=js$2;function coordEach$2(t,n,o){if(t!==null)for(var s,c,d,h,p,y,S,P=0,L=0,F,N=t.type,z=N==="FeatureCollection",W=N==="Feature",nt=z?t.features.length:1,Pe=0;Pe<nt;Pe++){S=z?t.features[Pe].geometry:W?t.geometry:t,F=S?S.type==="GeometryCollection":!1,p=F?S.geometries.length:1;for(var se=0;se<p;se++){var mt=0,kt=0;if(h=F?S.geometries[se]:S,h!==null){y=h.coordinates;var mn=h.type;switch(P=o&&(mn==="Polygon"||mn==="MultiPolygon")?1:0,mn){case null:break;case"Point":if(n(y,L,Pe,mt,kt)===!1)return!1;L++,mt++;break;case"LineString":case"MultiPoint":for(s=0;s<y.length;s++){if(n(y[s],L,Pe,mt,kt)===!1)return!1;L++,mn==="MultiPoint"&&mt++}mn==="LineString"&&mt++;break;case"Polygon":case"MultiLineString":for(s=0;s<y.length;s++){for(c=0;c<y[s].length-P;c++){if(n(y[s][c],L,Pe,mt,kt)===!1)return!1;L++}mn==="MultiLineString"&&mt++,mn==="Polygon"&&kt++}mn==="Polygon"&&mt++;break;case"MultiPolygon":for(s=0;s<y.length;s++){for(kt=0,c=0;c<y[s].length;c++){for(d=0;d<y[s][c].length-P;d++){if(n(y[s][c][d],L,Pe,mt,kt)===!1)return!1;L++}kt++}mt++}break;case"GeometryCollection":for(s=0;s<h.geometries.length;s++)if(coordEach$2(h.geometries[s],n,o)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function coordReduce(t,n,o,s){var c=o;return coordEach$2(t,function(d,h,p,y,S){h===0&&o===void 0?c=d:c=n(c,d,h,p,y,S)},s),c}function propEach(t,n){var o;switch(t.type){case"FeatureCollection":for(o=0;o<t.features.length&&n(t.features[o].properties,o)!==!1;o++);break;case"Feature":n(t.properties,0);break}}function propReduce(t,n,o){var s=o;return propEach(t,function(c,d){d===0&&o===void 0?s=c:s=n(s,c,d)}),s}function featureEach$1(t,n){if(t.type==="Feature")n(t,0);else if(t.type==="FeatureCollection")for(var o=0;o<t.features.length&&n(t.features[o],o)!==!1;o++);}function featureReduce(t,n,o){var s=o;return featureEach$1(t,function(c,d){d===0&&o===void 0?s=c:s=n(s,c,d)}),s}function coordAll(t){var n=[];return coordEach$2(t,function(o){n.push(o)}),n}function geomEach$2(t,n){var o,s,c,d,h,p,y,S,P,L,F=0,N=t.type==="FeatureCollection",z=t.type==="Feature",W=N?t.features.length:1;for(o=0;o<W;o++){for(p=N?t.features[o].geometry:z?t.geometry:t,S=N?t.features[o].properties:z?t.properties:{},P=N?t.features[o].bbox:z?t.bbox:void 0,L=N?t.features[o].id:z?t.id:void 0,y=p?p.type==="GeometryCollection":!1,h=y?p.geometries.length:1,c=0;c<h;c++){if(d=y?p.geometries[c]:p,d===null){if(n(null,F,S,P,L)===!1)return!1;continue}switch(d.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(n(d,F,S,P,L)===!1)return!1;break}case"GeometryCollection":{for(s=0;s<d.geometries.length;s++)if(n(d.geometries[s],F,S,P,L)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}F++}}function geomReduce$1(t,n,o){var s=o;return geomEach$2(t,function(c,d,h,p,y){d===0&&o===void 0?s=c:s=n(s,c,d,h,p,y)}),s}function flattenEach$2(t,n){geomEach$2(t,function(o,s,c,d,h){var p=o===null?null:o.type;switch(p){case null:case"Point":case"LineString":case"Polygon":return n(helpers$1.feature(o,c,{bbox:d,id:h}),s,0)===!1?!1:void 0}var y;switch(p){case"MultiPoint":y="Point";break;case"MultiLineString":y="LineString";break;case"MultiPolygon":y="Polygon";break}for(var S=0;S<o.coordinates.length;S++){var P=o.coordinates[S],L={type:y,coordinates:P};if(n(helpers$1.feature(L,c),s,S)===!1)return!1}})}function flattenReduce(t,n,o){var s=o;return flattenEach$2(t,function(c,d,h){d===0&&h===0&&o===void 0?s=c:s=n(s,c,d,h)}),s}function segmentEach(t,n){flattenEach$2(t,function(o,s,c){var d=0;if(o.geometry){var h=o.geometry.type;if(!(h==="Point"||h==="MultiPoint")){var p,y=0,S=0,P=0;if(coordEach$2(o,function(L,F,N,z,W){if(p===void 0||s>y||z>S||W>P){p=L,y=s,S=z,P=W,d=0;return}var nt=helpers$1.lineString([p,L],o.properties);if(n(nt,s,c,W,d)===!1)return!1;d++,p=L})===!1)return!1}}})}function segmentReduce(t,n,o){var s=o,c=!1;return segmentEach(t,function(d,h,p,y,S){c===!1&&o===void 0?s=d:s=n(s,d,h,p,y,S),c=!0}),s}function lineEach(t,n){if(!t)throw new Error("geojson is required");flattenEach$2(t,function(o,s,c){if(o.geometry!==null){var d=o.geometry.type,h=o.geometry.coordinates;switch(d){case"LineString":if(n(o,s,c,0,0)===!1)return!1;break;case"Polygon":for(var p=0;p<h.length;p++)if(n(helpers$1.lineString(h[p],o.properties),s,c,p)===!1)return!1;break}}})}function lineReduce(t,n,o){var s=o;return lineEach(t,function(c,d,h,p){d===0&&o===void 0?s=c:s=n(s,c,d,h,p)}),s}function findSegment(t,n){if(n=n||{},!helpers$1.isObject(n))throw new Error("options is invalid");var o=n.featureIndex||0,s=n.multiFeatureIndex||0,c=n.geometryIndex||0,d=n.segmentIndex||0,h=n.properties,p;switch(t.type){case"FeatureCollection":o<0&&(o=t.features.length+o),h=h||t.features[o].properties,p=t.features[o].geometry;break;case"Feature":h=h||t.properties,p=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":p=t;break;default:throw new Error("geojson is invalid")}if(p===null)return null;var y=p.coordinates;switch(p.type){case"Point":case"MultiPoint":return null;case"LineString":return d<0&&(d=y.length+d-1),helpers$1.lineString([y[d],y[d+1]],h,n);case"Polygon":return c<0&&(c=y.length+c),d<0&&(d=y[c].length+d-1),helpers$1.lineString([y[c][d],y[c][d+1]],h,n);case"MultiLineString":return s<0&&(s=y.length+s),d<0&&(d=y[s].length+d-1),helpers$1.lineString([y[s][d],y[s][d+1]],h,n);case"MultiPolygon":return s<0&&(s=y.length+s),c<0&&(c=y[s].length+c),d<0&&(d=y[s][c].length-d-1),helpers$1.lineString([y[s][c][d],y[s][c][d+1]],h,n)}throw new Error("geojson is invalid")}function findPoint(t,n){if(n=n||{},!helpers$1.isObject(n))throw new Error("options is invalid");var o=n.featureIndex||0,s=n.multiFeatureIndex||0,c=n.geometryIndex||0,d=n.coordIndex||0,h=n.properties,p;switch(t.type){case"FeatureCollection":o<0&&(o=t.features.length+o),h=h||t.features[o].properties,p=t.features[o].geometry;break;case"Feature":h=h||t.properties,p=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":p=t;break;default:throw new Error("geojson is invalid")}if(p===null)return null;var y=p.coordinates;switch(p.type){case"Point":return helpers$1.point(y,h,n);case"MultiPoint":return s<0&&(s=y.length+s),helpers$1.point(y[s],h,n);case"LineString":return d<0&&(d=y.length+d),helpers$1.point(y[d],h,n);case"Polygon":return c<0&&(c=y.length+c),d<0&&(d=y[c].length+d),helpers$1.point(y[c][d],h,n);case"MultiLineString":return s<0&&(s=y.length+s),d<0&&(d=y[s].length+d),helpers$1.point(y[s][d],h,n);case"MultiPolygon":return s<0&&(s=y.length+s),c<0&&(c=y[s].length+c),d<0&&(d=y[s][c].length-d),helpers$1.point(y[s][c][d],h,n)}throw new Error("geojson is invalid")}js$1.coordAll=coordAll,js$1.coordEach=coordEach$2,js$1.coordReduce=coordReduce,js$1.featureEach=featureEach$1,js$1.featureReduce=featureReduce,js$1.findPoint=findPoint,js$1.findSegment=findSegment,js$1.flattenEach=flattenEach$2,js$1.flattenReduce=flattenReduce,js$1.geomEach=geomEach$2,js$1.geomReduce=geomReduce$1,js$1.lineEach=lineEach,js$1.lineReduce=lineReduce,js$1.propEach=propEach,js$1.propReduce=propReduce,js$1.segmentEach=segmentEach,js$1.segmentReduce=segmentReduce;var js$3={};Object.defineProperty(js$3,"__esModule",{value:!0});var meta_1=js$1;function bbox(t){var n=[1/0,1/0,-1/0,-1/0];return meta_1.coordEach(t,function(o){n[0]>o[0]&&(n[0]=o[0]),n[1]>o[1]&&(n[1]=o[1]),n[2]<o[0]&&(n[2]=o[0]),n[3]<o[1]&&(n[3]=o[1])}),n}bbox.default=bbox,js$3.default=bbox;var rbush$3=RBush,helpers=js$2,meta=js$1,turfBBox=js$3.default,featureEach$3=meta.featureEach;meta.coordEach,helpers.polygon;var featureCollection=helpers.featureCollection;function geojsonRbush(t){var n=new rbush$3(t);return n.insert=function(o){if(o.type!=="Feature")throw new Error("invalid feature");return o.bbox=o.bbox?o.bbox:turfBBox(o),rbush$3.prototype.insert.call(this,o)},n.load=function(o){var s=[];return Array.isArray(o)?o.forEach(function(c){if(c.type!=="Feature")throw new Error("invalid features");c.bbox=c.bbox?c.bbox:turfBBox(c),s.push(c)}):featureEach$3(o,function(c){if(c.type!=="Feature")throw new Error("invalid features");c.bbox=c.bbox?c.bbox:turfBBox(c),s.push(c)}),rbush$3.prototype.load.call(this,s)},n.remove=function(o,s){if(o.type!=="Feature")throw new Error("invalid feature");return o.bbox=o.bbox?o.bbox:turfBBox(o),rbush$3.prototype.remove.call(this,o,s)},n.clear=function(){return rbush$3.prototype.clear.call(this)},n.search=function(o){var s=rbush$3.prototype.search.call(this,this.toBBox(o));return featureCollection(s)},n.collides=function(o){return rbush$3.prototype.collides.call(this,this.toBBox(o))},n.all=function(){var o=rbush$3.prototype.all.call(this);return featureCollection(o)},n.toJSON=function(){return rbush$3.prototype.toJSON.call(this)},n.fromJSON=function(o){return rbush$3.prototype.fromJSON.call(this,o)},n.toBBox=function(o){var s;if(o.bbox)s=o.bbox;else if(Array.isArray(o)&&o.length===4)s=o;else if(Array.isArray(o)&&o.length===6)s=[o[0],o[1],o[3],o[4]];else if(o.type==="Feature")s=turfBBox(o);else if(o.type==="FeatureCollection")s=turfBBox(o);else throw new Error("invalid geojson");return{minX:s[0],minY:s[1],maxX:s[2],maxY:s[3]}},n}geojsonRbush$1.exports=geojsonRbush,geojsonRbush$1.exports.default=geojsonRbush;function lineIntersect(t,n){var o={},s=[];if(t.type==="LineString"&&(t=feature(t)),n.type==="LineString"&&(n=feature(n)),t.type==="Feature"&&n.type==="Feature"&&t.geometry!==null&&n.geometry!==null&&t.geometry.type==="LineString"&&n.geometry.type==="LineString"&&t.geometry.coordinates.length===2&&n.geometry.coordinates.length===2){var c=intersects$2(t,n);return c&&s.push(c),featureCollection$1(s)}var d=geojsonRbush$1.exports();return d.load(lineSegment(n)),featureEach$2(lineSegment(t),function(h){featureEach$2(d.search(h),function(p){var y=intersects$2(h,p);if(y){var S=getCoords(y).join(",");o[S]||(o[S]=!0,s.push(y))}})}),featureCollection$1(s)}function intersects$2(t,n){var o=getCoords(t),s=getCoords(n);if(o.length!==2)throw new Error("<intersects> line1 must only contain 2 coordinates");if(s.length!==2)throw new Error("<intersects> line2 must only contain 2 coordinates");var c=o[0][0],d=o[0][1],h=o[1][0],p=o[1][1],y=s[0][0],S=s[0][1],P=s[1][0],L=s[1][1],F=(L-S)*(h-c)-(P-y)*(p-d),N=(P-y)*(d-S)-(L-S)*(c-y),z=(h-c)*(d-S)-(p-d)*(c-y);if(F===0)return null;var W=N/F,nt=z/F;if(W>=0&&W<=1&&nt>=0&&nt<=1){var Pe=c+W*(h-c),se=d+W*(p-d);return point([Pe,se])}return null}function polygonToLine(t,n){n===void 0&&(n={});var o=getGeom(t);switch(!n.properties&&t.type==="Feature"&&(n.properties=t.properties),o.type){case"Polygon":return polygonToLine$1(o,n);case"MultiPolygon":return multiPolygonToLine(o,n);default:throw new Error("invalid poly")}}function polygonToLine$1(t,n){n===void 0&&(n={});var o=getGeom(t),s=o.coordinates,c=n.properties?n.properties:t.type==="Feature"?t.properties:{};return coordsToLine(s,c)}function multiPolygonToLine(t,n){n===void 0&&(n={});var o=getGeom(t),s=o.coordinates,c=n.properties?n.properties:t.type==="Feature"?t.properties:{},d=[];return s.forEach(function(h){d.push(coordsToLine(h,c))}),featureCollection$1(d)}function coordsToLine(t,n){return t.length>1?multiLineString(t,n):lineString(t[0],n)}function booleanDisjoint(t,n){var o=!0;return flattenEach$1(t,function(s){flattenEach$1(n,function(c){if(o===!1)return!1;o=disjoint(s.geometry,c.geometry)})}),o}function disjoint(t,n){switch(t.type){case"Point":switch(n.type){case"Point":return!compareCoords(t.coordinates,n.coordinates);case"LineString":return!isPointOnLine(n,t);case"Polygon":return!booleanPointInPolygon$1(t,n)}break;case"LineString":switch(n.type){case"Point":return!isPointOnLine(t,n);case"LineString":return!isLineOnLine(t,n);case"Polygon":return!isLineInPoly(n,t)}break;case"Polygon":switch(n.type){case"Point":return!booleanPointInPolygon$1(n,t);case"LineString":return!isLineInPoly(t,n);case"Polygon":return!isPolyInPoly(n,t)}}return!1}function isPointOnLine(t,n){for(var o=0;o<t.coordinates.length-1;o++)if(isPointOnLineSegment(t.coordinates[o],t.coordinates[o+1],n.coordinates))return!0;return!1}function isLineOnLine(t,n){var o=lineIntersect(t,n);return o.features.length>0}function isLineInPoly(t,n){for(var o=0,s=n.coordinates;o<s.length;o++){var c=s[o];if(booleanPointInPolygon$1(c,t))return!0}var d=lineIntersect(n,polygonToLine(t));return d.features.length>0}function isPolyInPoly(t,n){for(var o=0,s=t.coordinates[0];o<s.length;o++){var c=s[o];if(booleanPointInPolygon$1(c,n))return!0}for(var d=0,h=n.coordinates[0];d<h.length;d++){var p=h[d];if(booleanPointInPolygon$1(p,t))return!0}var y=lineIntersect(polygonToLine(t),polygonToLine(n));return y.features.length>0}function isPointOnLineSegment(t,n,o){var s=o[0]-t[0],c=o[1]-t[1],d=n[0]-t[0],h=n[1]-t[1],p=s*h-c*d;return p!==0?!1:Math.abs(d)>=Math.abs(h)?d>0?t[0]<=o[0]&&o[0]<=n[0]:n[0]<=o[0]&&o[0]<=t[0]:h>0?t[1]<=o[1]&&o[1]<=n[1]:n[1]<=o[1]&&o[1]<=t[1]}function compareCoords(t,n){return t[0]===n[0]&&t[1]===n[1]}function booleanIntersects(t,n){var o=!1;return flattenEach$1(t,function(s){flattenEach$1(n,function(c){if(o===!0)return!0;o=!booleanDisjoint(s.geometry,c.geometry)})}),o}const d2r=Math.PI/180,MAX_ZOOM=28;function getBboxZoom(t){for(let n=0;n<MAX_ZOOM;n++){const o=1<<32-(n+1);if((t[0]&o)!==(t[2]&o)||(t[1]&o)!==(t[3]&o))return n}return MAX_ZOOM}function bboxToTile(t,n){const o=pointToTile(t[0],t[1],32),s=pointToTile(t[2],t[3],32),c=[o[0],o[1],s[0],s[1]],d=Math.min(getBboxZoom(c),typeof n<"u"?n:MAX_ZOOM);if(d===0)return[0,0,0];const h=c[0]>>>32-d,p=c[1]>>>32-d;return[h,p,d]}function pointToTile(t,n,o){var s=pointToTileFraction(t,n,o);return s[0]=Math.floor(s[0]),s[1]=Math.floor(s[1]),s}function pointToTileFraction(t,n,o){var s=Math.sin(n*d2r),c=Math.pow(2,o),d=c*(t/360+.5),h=c*(.5-.25*Math.log((1+s)/(1-s))/Math.PI);return d=d%c,d<0&&(d=d+c),[d,h,o]}function encodeHilbert3D(t,n,o,s){let c=encodeMorton3D(t,n,o);return mortonToHilbertN(c,s)}function decodeHilbert3D(t,n){const o=hilbertToMortonN(t,n);return decodeMorton3D(o)}function encodeMorton3D(t,n,o){let s=0n;return s=splitBy3(t)|splitBy3(n)<<1n|splitBy3(o)<<2n,s}function decodeMorton3D(t){let n=compactBy3(t),o=compactBy3(t>>1n),s=compactBy3(t>>2n);return[n,o,s]}function splitBy3(t){let n=BigInt(t)&BigInt("0x3ffffffffff");return n=(n|n<<64n)&BigInt("0x3ff0000000000000000ffffffff"),n=(n|n<<32n)&BigInt("0x3ff00000000ffff00000000ffff"),n=(n|n<<16n)&BigInt("0x30000ff0000ff0000ff0000ff0000ff"),n=(n|n<<8n)&BigInt("0x300f00f00f00f00f00f00f00f00f00f"),n=(n|n<<4n)&BigInt("0x30c30c30c30c30c30c30c30c30c30c3"),n=(n|n<<2n)&BigInt("0x9249249249249249249249249249249"),n}function compactBy3(t){let n=t&BigInt("0x9249249249249249249249249249249");return n=(n|n>>2n)&BigInt("0x30c30c30c30c30c30c30c30c30c30c3"),n=(n|n>>4n)&BigInt("0x300f00f00f00f00f00f00f00f00f00f"),n=(n|n>>8n)&BigInt("0x30000ff0000ff0000ff0000ff0000ff"),n=(n|n>>16n)&BigInt("0x3ff00000000ffff00000000ffff"),n=(n|n>>32n)&BigInt("0x3ff0000000000000000ffffffff"),n=(n|n>>64n)&BigInt("0x3ffffffffff"),Number(n)}const mortonToHilbertTable=[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],hilbertToMortonTable=[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 transformCurve(t,n,o){let s=0,c=0n;for(let d=3*(n-1);d>=0;d-=3)s=o[s|Number(t>>BigInt(d)&7n)],c=c<<3n|BigInt(s&7),s&=-8;return c}function mortonToHilbertN(t,n){return transformCurve(t,n,mortonToHilbertTable)}function hilbertToMortonN(t,n){return transformCurve(t,n,hilbertToMortonTable)}function generateHilbertIndex(t){const n=t.z>0?t.f+2**(t.z-1):0;return encodeHilbert3D(t.x,t.y,n,t.z)}function parseHilbertIndex(t,n){if(n===0)return{z:0,f:0,x:0,y:0};const[o,s,c]=decodeHilbert3D(t,n);return{f:c-2**(n-1),x:o,y:s,z:n}}function generateHilbertTilehash(t,n){return"H"+t.toString(8).padStart(n,"0").split("").map(o=>(parseInt(o)+1).toString()).join("")}function parseHilbertTilehash(t){if(t[0]!=="H")return;const n=t.substring(1).split("").map(s=>(parseInt(s)-1).toString()).join(""),o=BigInt("0o"+n);return parseHilbertIndex(o,n.length)}const DEFAULT_ZOOM=25;class Space{constructor(n,o){if(typeof n=="string"){let s=parseZFXYString(n)||parseHilbertTilehash(n)||parseZFXYTilehash(n);if(s)this.zfxy=s,this._regenerateAttributesFromZFXY();else throw new Error(`parse ZFXY failed with input: ${n}`);return}else if(isZFXYTile(n)){this.zfxy=n,this._regenerateAttributesFromZFXY();return}else this.zfxy=calculateZFXY({...n,zoom:typeof o<"u"?o:DEFAULT_ZOOM});this._regenerateAttributesFromZFXY()}up(n=1){return this.move({f:n})}down(n=1){return this.move({f:-n})}north(n=1){return this.move({y:n})}south(n=1){return this.move({y:-n})}east(n=1){return this.move({x:n})}west(n=1){return this.move({x:-n})}move(n){const o=new Space(this.zfxy);return o.zfxy=zfxyWraparound({z:o.zfxy.z,f:o.zfxy.f+(n.f||0),x:o.zfxy.x+(n.x||0),y:o.zfxy.y+(n.y||0)}),o._regenerateAttributesFromZFXY(),o}parent(n){const o=typeof n>"u"?1:this.zfxy.z-n;return new Space(getParent(this.zfxy,o))}children(){return getChildren(this.zfxy).map(n=>new Space(n))}surroundings(){return[...getSurrounding(this.zfxy).filter(({z:n,f:o,x:s,y:c})=>`/${n}/${o}/${s}/${c}`!==this.zfxyStr).map(n=>new Space(n)),...getSurrounding(this.up().zfxy).map(n=>new Space(n)),...getSurrounding(this.down().zfxy).map(n=>new Space(n))]}contains(n){const o=this.toGeoJSON(),s={type:"Point",coordinates:[n.lng,n.lat]},c=this.alt,d=getFloor({...this.zfxy,f:this.zfxy.f+1});return booleanIntersects(o,s)&&(typeof n.alt<"u"?n.alt>=c&&n.alt<d:!0)}toGeoJSON(){const[n,o]=getBBox(this.zfxy);return{type:"Polygon",coordinates:[[[n.lng,n.lat],[n.lng,o.lat],[o.lng,o.lat],[o.lng,n.lat],[n.lng,n.lat]]]}}vertices3d(){const[n,o]=getBBox(this.zfxy),s=getFloor(this.zfxy),c=getFloor({...this.zfxy,f:this.zfxy.f+1});return[[n.lng,n.lat,s],[n.lng,o.lat,s],[o.lng,o.lat,s],[o.lng,n.lat,s],[n.lng,n.lat,c],[n.lng,o.lat,c],[o.lng,o.lat,c],[o.lng,n.lat,c]]}static getSpaceById(n,o){return new Space(n,o)}static getSpaceByLocation(n,o){return new Space(n,o)}static getSpaceByZFXY(n){return new Space(n)}static boundingSpaceForGeometry(n,o){o=o||25;const s=bbox$2(n),c=bboxToTile(s,o),[d,h,p]=c;return new Space({x:d,y:h,z:p,f:0})}static spacesForGeometry(n,o){const s=o;if(s===0)return[new Space("0/0/0/0")];if(n.type==="GeometryCollection")throw new Error("GeometryCollection not supported");const c=bbox$2(n),d=pointToTile(c[0],c[1],32),h=pointToTile(c[2],c[3],32),p=Math.min(d[0],h[0])>>>32-s,y=Math.min(d[1],h[1])>>>32-s,S=(Math.max(h[0],d[0])>>>32-s)+1,P=(Math.max(h[1],d[1])>>>32-s)+1,L=[];for(let F=p;F<=S;F++)for(let N=y;N<=P;N++){const z=new Space({x:F,y:N,z:s,f:0});booleanIntersects(n,z.toGeoJSON())&&L.push(z)}return L}_regenerateAttributesFromZFXY(){this.alt=getFloor(this.zfxy),this.center=getCenterLngLatAlt(this.zfxy),this.zoom=this.zfxy.z,this.id=this.tilehash=generateTilehash(this.zfxy),this.zfxyStr=`/${this.zfxy.z}/${this.zfxy.f}/${this.zfxy.x}/${this.zfxy.y}`,this.hilbertIndex=generateHilbertIndex(this.zfxy),this.hilbertTilehash=generateHilbertTilehash(this.hilbertIndex,this.zfxy.z)}}const getRectangeParamsFromSpace=t=>{const n=t.vertices3d(),o=[n[0][0],n[1][1],n[2][0],n[3][1]],s=n[0][2],c=n[4][2];return{wsen:o,height:s,extrudedHeight:c}},createSpatialIdSpace=(t,n,o,s,c)=>{const d=new Space({lat:n,lng:t,alt:o},s),{wsen:h,height:p,extrudedHeight:y}=getRectangeParamsFromSpace(d);return{id:v4(),space:d,wsen:h,height:p+c,extrudedHeight:y+c}},getSpaceData=t=>({id:t.id,center:t.center,alt:t.alt,zoom:t.zoom,zfxy:t.zfxy,zfxyStr:t.zfxyStr,tilehash:t.tilehash,hilbertTilehash:t.hilbertTilehash,hilbertIndex:t.hilbertIndex.toString(),vertices:t.vertices3d()}),getVerticalLimits=(t,n,o)=>{const s=new Space({lat:0,lng:0,alt:t},o),c=new Space({lat:0,lng:0,alt:n},o),{height:d}=getRectangeParamsFromSpace(s),{extrudedHeight:h}=getRectangeParamsFromSpace(c);return{top:d,bottom:h}},useHooks$8=({ref:t,engineRef:n,geoidRef:o,terrainEnabled:s,interactionMode:c,overrideInteractionMode:d,onMount:h})=>{const[p,y]=React.useState("idle"),[S,P]=React.useState(null),[L,F]=React.useState(null),[N,z]=React.useState(null),W=React.useRef(null),[nt,Pe]=React.useState(null),se=React.useRef(null),[mt,kt]=React.useState(null),[mn,_i]=React.useState(null),[zi,Sa]=React.useState(SPATIALID_DEFAULT_OPTIONS),fa=React.useMemo(()=>getVerticalLimits(zi.maxHeight,zi.minHeight,zi.zoom),[zi.maxHeight,zi.minHeight,zi.zoom]),La=React.useMemo(()=>{const of=[...S??[],...nt?[nt]:[]];if(!of)return null;const gf=of.reduce((Ef,xf)=>(Ef.find(Wa=>Wa.space.zfxy.z===xf.space.zfxy.z&&Wa.space.zfxy.x===xf.space.zfxy.x&&Wa.space.zfxy.y===xf.space.zfxy.y)||Ef.push(xf),Ef),[]);return gf.length===0?null:gf.map(Ef=>{const{wsen:xf}=Ef;return{id:v4(),spaceId:Ef.space.id,wsen:xf,color:zi.groundIndicatorColor}})},[S,nt,zi.groundIndicatorColor]),Ra=React.useCallback(of=>{y("coordinate"),Sa(gf=>({...gf,...of})),d==null||d("spatialId"),setTimeout(()=>{var gf;(gf=n.current)==null||gf.setCursor("crosshair")},100)},[n,d]),ma=React.useRef(c);ma.current=c;const yt=React.useCallback(()=>{var of,gf;y("idle"),kt(null),_i(null),Pe(null),z(null),W.current=null,se.current=null,F(null),d==null||d(ma.current==="spatialId"?"default":ma.current??"default"),(of=n.current)==null||of.setCursor("default"),(gf=n.current)==null||gf.requestRender()},[d,n]),lt=React.useCallback(async of=>{var gf,Ef,xf,Wa;if(p!=="idle"&&!hf.current){if(p==="coordinate"){if(!N||of.lat===void 0||of.lng===void 0||of.lat>SPATIALID_LATITUDE_RANGE.max||of.lat<SPATIALID_LATITUDE_RANGE.min)return;y("fetchingGeoid");const{id:af,wsen:Xd,space:gd}=createSpatialIdSpace(of.lng,of.lat,0,zi.zoom,0);requestAnimationFrame(()=>{var df;(df=n.current)==null||df.setCursor("wait")});const[pd,Zd]=await Promise.all([(gf=o.current)==null?void 0:gf.getGeoidHeight(of.lng,of.lat),(Ef=o.current)==null?void 0:Ef.getGeoidHeight(gd.center.lng,gd.center.lat)]);if(setTimeout(()=>{var df;(df=n.current)==null||df.setCursor("crosshair")},100),pd===void 0&&Zd===void 0){y("coordinate");return}const cf=pd??Zd??0,sf=Zd??pd??0;se.current=sf,F({id:af,wsen:Xd,height:fa.top+sf,extrudedHeight:fa.bottom+sf,color:zi.verticalSpaceIndicatorColor,outlineColor:zi.verticalSpaceIndicatorOutlineColor}),_i([of.lng,of.lat,(s?of.height??0:0)-cf]),kt(((xf=n.current)==null?void 0:xf.toXYZ(of.lng,of.lat,of.height??0))??null);const nf=createSpatialIdSpace(of.lng,of.lat,(s?of.height??0:0)-cf,zi.zoom,sf);Pe({...nf,color:zi.color,outlineColor:zi.outlineColor}),W.current=N,z(null),(Wa=n.current)==null||Wa.requestRender(),y("floor")}else if(p==="floor"){if(!nt)return;const af={...nt,id:v4(),color:zi.color,outlineColor:zi.outlineColor};zi.dataOnly||P(gd=>gd?[...gd,af]:[af]),yt();const Xd=getSpaceData(af.space);ff.current.forEach(gd=>gd(Xd))}}},[p,s,n,o,nt,zi,fa,N,yt]),pi=React.useCallback(of=>{var gf;if(p!=="idle"&&!hf.current){if(p==="coordinate"){if(of.lat===void 0||of.lng===void 0||of.lat>SPATIALID_LATITUDE_RANGE.max||of.lat<SPATIALID_LATITUDE_RANGE.min)return;const Ef=createSpatialIdSpace(of.lng,of.lat,0,zi.zoom,0);if(Ef.space.id===(N==null?void 0:N.uid))return;z({id:v4(),uid:Ef.space.id,wsen:Ef.wsen,color:zi.selectorColor})}else if(p==="floor"){if(of.x===void 0||of.y===void 0||mt===null||mn===null)return;const Ef=((gf=n.current)==null?void 0:gf.getExtrudedHeight(mt,[of.x,of.y],!0))??0;if(mn[2]+Ef>fa.top||mn[2]+Ef<fa.bottom)return;const xf=createSpatialIdSpace(mn[0],mn[1],mn[2]+Ef,zi.zoom,se.current??0);if(xf.space.id===(nt==null?void 0:nt.space.id))return;Pe({...xf,color:zi.selectorColor,outlineColor:zi.selectorOutlineColor})}}},[p,nt,mt,mn,n,zi,fa,N==null?void 0:N.uid]),ba=React.useCallback(()=>{var of;p!=="idle"&&(p==="coordinate"&&zi.rightClickToExit?yt():p==="floor"&&(Pe(null),kt(null),_i(null),F(null),z(W.current),y("coordinate"),se.current=null),(of=n.current)==null||of.requestRender())},[p,zi,n,yt]),Sc=React.useCallback(()=>{ba()},[ba]);useWindowEvent("keydown",of=>{of.code==="Escape"&&ba()});const ms=React.useRef(!1),Xs=React.useRef(lt);Xs.current=lt;const Nl=React.useCallback(of=>{Xs.current(of)},[]),pu=React.useRef(pi);pu.current=pi;const yu=React.useCallback(of=>{pu.current(of)},[]),Ru=React.useRef(Sc);Ru.current=Sc;const Vd=React.useCallback(()=>{Ru.current()},[]);React.useEffect(()=>{ms.current||!n.current||(ms.current=!0,n.current.onMouseUp(Nl),n.current.onMouseMove(yu),n.current.onRightClick(Vd))},[n,Nl,yu,Vd]);const Gd=React.useRef(p);Gd.current=p;const uf=React.useRef(yt);uf.current=yt,React.useEffect(()=>{hf.current||c!=="spatialId"&&Gd.current!=="idle"&&uf.current()},[c]);const ff=React.useRef([]),pf=React.useCallback(of=>{ff.current.push(of)},[]);React.useImperativeHandle(t,()=>({pickSpace:Ra,onSpacePick:pf,exitPickSpace:yt}),[Ra,pf,yt]);const hf=React.useRef(!1);return React.useEffect(()=>{const of=gf=>{gf.code==="Space"&&Gd.current!=="idle"&&(hf.current=!0,d==null||d("move"))};return window.addEventListener("keydown",of),()=>{window.removeEventListener("keydown",of)}},[d]),React.useEffect(()=>window.addEventListener("keyup",of=>{of.code==="Space"&&hf.current&&(hf.current=!1,d==null||d("spatialId"))}),[d]),React.useEffect(()=>{h==null||h()},[h]),{spatialIdSpaces:S,verticalSpaceIndicator:L,coordinateSelector:N,spaceSelector:nt,groundIndicators:La}},SpatialId=({engineRef:t,geoidRef:n,terrainEnabled:o,interactionMode:s,overrideInteractionMode:c,onMount:d},h)=>{const{spatialIdSpaces:p,verticalSpaceIndicator:y,coordinateSelector:S,spaceSelector:P,groundIndicators:L}=useHooks$8({ref:h,engineRef:t,geoidRef:n,terrainEnabled:o,interactionMode:s,overrideInteractionMode:c,onMount:d});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[p&&p.length>0&&p.map(F=>jsxRuntimeExports.jsx(SpatialIdSpace,{space:F},F.id)),L&&L.length>0&&L.map(F=>jsxRuntimeExports.jsx(CoordinateIndicator,{wsen:F.wsen,color:F.color},F.id)),y&&jsxRuntimeExports.jsx(VerticalSpaceIndicator,{indicator:y}),S&&jsxRuntimeExports.jsx(CoordinateIndicator,{wsen:S.wsen,color:S.color}),P&&jsxRuntimeExports.jsx(SpatialIdSpace,{space:P})]})},SpatialId$1=React.forwardRef(SpatialId);/*! (c) Andrea Giammarchi - ISC */var self$1={};try{self$1.EventTarget=new EventTarget().constructor}catch(t){(function(n,o){var s=n.create,c=n.defineProperty,d=h.prototype;p(d,"addEventListener",function(S,P,L){for(var F=o.get(this),N=F[S]||(F[S]=[]),z=0,W=N.length;z<W;z++)if(N[z].listener===P)return;N.push({target:this,listener:P,options:L})}),p(d,"dispatchEvent",function(S){var P=o.get(this),L=P[S.type];return L&&(p(S,"target",this),p(S,"currentTarget",this),L.slice(0).some(y,S),delete S.currentTarget,delete S.target),!0}),p(d,"removeEventListener",function(S,P){for(var L=o.get(this),F=L[S]||(L[S]=[]),N=0,z=F.length;N<z;N++)if(F[N].listener===P){F.splice(N,1);return}}),self$1.EventTarget=h;function h(){o.set(this,s(null))}function p(S,P,L){c(S,P,{configurable:!0,writable:!0,value:L})}function y(S){var P=S.options;return P&&P.once&&S.target.removeEventListener(this.type,S.listener),typeof S.listener=="function"?S.listener.call(S.target,this):S.listener.handleEvent(this),this._stopImmediatePropagationFlag}})(Object,new WeakMap)}const EventTarget$1=self$1.EventTarget;function events(){const t=new EventTarget$1,n=new Map,o=(y,S)=>{let P=n.get(y);P||(P=new Map,n.set(y,P));let L=P.get(S);return L||(L=F=>{S(...F.detail)},P.set(S,L)),L},s=(y,S)=>{var P;(P=n.get(y))==null||P.delete(S)},c=(y,S)=>{const P=o(y,S);t.addEventListener(String(y),P)},d=(y,S)=>{const P=o(y,S);t.removeEventListener(String(y),P),s(y,P)},h=(y,S)=>{const P=o(y,S);t.addEventListener(String(y),P,{once:!0})};return[{get on(){return c},get off(){return d},get once(){return h}},(y,...S)=>t.dispatchEvent(new CustomEvent(String(y),{detail:S}))]}function mergeEvents(t,n,o){const s=o.reduce((c,d)=>({...c,[d]:(...h)=>{n(d,...h)}}),{});for(const c of Object.keys(s))t.on(c,s[c]);return()=>{for(const c of Object.keys(s))t.off(c,s[c])}}function MapFn({engines:t,engine:n,isBuilt:o,isEditable:s,clusters:c,hiddenLayers:d,layers:h,overrides:p,timelineManagerRef:y,interactionMode:S,selectedFeature:P,onLayerSelect:L,overrideInteractionMode:F,onSketchTypeChange:N,onSketchFeatureCreate:z,onSketchPluginFeatureCreate:W,onSketchFeatureUpdate:nt,onSketchPluginFeatureUpdate:Pe,onSketchFeatureDelete:se,onSketchPluginFeatureDelete:mt,featureFlags:kt=INTERACTION_MODES.default,onMount:mn,onAPIReady:_i,...zi},Sa){var pf,hf,of,gf;const fa=n?t==null?void 0:t[n]:void 0,La=fa==null?void 0:fa.component,{engineRef:Ra,layersRef:ma,sketchRef:yt,spatialIdRef:lt,geoidRef:pi,selectedLayer:ba,requestingRenderMode:Sc,handleLayerSelect:ms,handleEngineLayerSelect:Xs,sketchEditingFeature:Nl,setSketchEditingFeature:pu,handleEngineMount:yu,handleLayersMount:Ru,handleSketchMount:Vd,handleSpatialIdMount:Gd}=useHooks$c({ref:Sa,timelineManagerRef:y,onLayerSelect:L,onMount:mn,onAPIReady:_i}),uf=React.useMemo(()=>({layerId:ba.layerId,featureId:ba.featureId}),[ba.layerId,ba.featureId]),ff=React.useMemo(()=>ba.reason,[ba.reason]);return La?jsxRuntimeExports.jsxs(La,{ref:Ra,isBuilt:o,isEditable:s,selectedLayerId:uf,layerSelectionReason:ff,layersRef:ma,requestingRenderMode:Sc,timelineManagerRef:y,onLayerSelect:Xs,featureFlags:kt,onMount:yu,...zi,children:[jsxRuntimeExports.jsx(Layers$1,{ref:ma,engineRef:Ra,clusters:c,hiddenLayers:d,isBuilt:o,isEditable:s,layers:h,overrides:p,selectedLayer:ba,Feature:fa==null?void 0:fa.featureComponent,clusterComponent:fa==null?void 0:fa.clusterComponent,delegatedDataTypes:fa.delegatedDataTypes,meta:zi.meta,viewerProperty:zi.property,requestingRenderMode:Sc,sketchEditingFeature:Nl,onLayerSelect:ms,onMount:Ru}),jsxRuntimeExports.jsx(Sketch$1,{ref:yt,layersRef:ma,engineRef:Ra,interactionMode:S,selectedFeature:P,SketchComponent:fa==null?void 0:fa.sketchComponent,onLayerSelect:ms,overrideInteractionMode:F,onSketchTypeChange:N,onSketchFeatureCreate:z,onSketchPluginFeatureCreate:W,onSketchFeatureUpdate:nt,onSketchPluginFeatureUpdate:Pe,onSketchFeatureDelete:se,onSketchPluginFeatureDelete:mt,sketchEditingFeature:Nl,onSketchEditFeature:pu,onMount:Vd}),jsxRuntimeExports.jsx(SpatialId$1,{ref:lt,engineRef:Ra,geoidRef:pi,interactionMode:S,terrainEnabled:!!((hf=(pf=zi.property)==null?void 0:pf.terrain)!=null&&hf.enabled),overrideInteractionMode:F,onMount:Gd}),jsxRuntimeExports.jsx(Geoid$1,{ref:pi,geoidServer:(gf=(of=zi.property)==null?void 0:of.geoid)==null?void 0:gf.server})]}):null}const Map$1=React.forwardRef(MapFn),ErrorBoundaryContext=React.createContext(null),initialState={didCatch:!1,error:null};class ErrorBoundary extends React.Component{constructor(n){super(n),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=initialState}static getDerivedStateFromError(n){return{didCatch:!0,error:n}}resetErrorBoundary(){const{error:n}=this.state;if(n!==null){for(var o,s,c=arguments.length,d=new Array(c),h=0;h<c;h++)d[h]=arguments[h];(o=(s=this.props).onReset)===null||o===void 0||o.call(s,{args:d,reason:"imperative-api"}),this.setState(initialState)}}componentDidCatch(n,o){var s,c;(s=(c=this.props).onError)===null||s===void 0||s.call(c,n,o)}componentDidUpdate(n,o){const{didCatch:s}=this.state,{resetKeys:c}=this.props;if(s&&o.error!==null&&hasArrayChanged(n.resetKeys,c)){var d,h;(d=(h=this.props).onReset)===null||d===void 0||d.call(h,{next:c,prev:n.resetKeys,reason:"keys"}),this.setState(initialState)}}render(){const{children:n,fallbackRender:o,FallbackComponent:s,fallback:c}=this.props,{didCatch:d,error:h}=this.state;let p=n;if(d){const y={error:h,resetErrorBoundary:this.resetErrorBoundary};if(React.isValidElement(c))p=c;else if(typeof o=="function")p=o(y);else if(s)p=React.createElement(s,y);else throw h}return React.createElement(ErrorBoundaryContext.Provider,{value:{didCatch:d,error:h,resetErrorBoundary:this.resetErrorBoundary}},p)}}function hasArrayChanged(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return t.length!==n.length||t.some((o,s)=>!Object.is(o,n[s]))}const context$1=React.createContext(void 0),useVisualizer=()=>{const t=React.useContext(context$1);if(!t)throw new Error("Visualizer is not declared. You have to use this hook inside of Visualizer");return t},filterMapRefToContext=t=>t,VisualizerProvider=({mapRef:t,children:n})=>{const o=React.useMemo(()=>filterMapRefToContext(t),[t]);return jsxRuntimeExports.jsx(context$1.Provider,{value:o,children:n})},coreContext=React.createContext({}),Cluster=({property:t,children:n})=>{const{clusterPixelRange:o=15,clusterMinSize:s=3,clusterLabelTypography:c={fontFamily:"sans-serif",fontSize:30,fontWeight:400,color:"#FFF",textAlign:"center",bold:!1,italic:!1,underline:!1},clusterImage:d,clusterImageWidth:h,clusterImageHeight:p}=(t==null?void 0:t.default)??{},y=React.useMemo(()=>new Cesium$1.EntityCluster({enabled:!0,pixelRange:15,minimumClusterSize:2,clusterBillboards:!0,clusterLabels:!0,clusterPoints:!0}),[]);return React.useEffect(()=>{const S=React.Children.count(n)<s,P=y==null?void 0:y.clusterEvent.addEventListener((L,F)=>{F.label.font=toCSSFont(c,{fontSize:30}),F.label.horizontalOrigin=c.textAlign==="right"?Cesium$1.HorizontalOrigin.LEFT:c.textAlign==="left"?Cesium$1.HorizontalOrigin.RIGHT:Cesium$1.HorizontalOrigin.CENTER,F.label.verticalOrigin=Cesium$1.VerticalOrigin.CENTER,F.label.fillColor=Cesium$1.Color.fromCssColorString(c.color??"#FFF"),F.label.eyeOffset=new Cesium$1.Cartesian3(0,0,-5),F.billboard.show=!0,F.billboard.image=d,F.billboard.height=p,F.billboard.width=h,y.minimumClusterSize=S?React.Children.count(n):s});return y.enabled=!S,y.pixelRange=0,y.pixelRange=o,()=>{P()}},[s,o,c,d,p,h,n,y]),y?jsxRuntimeExports.jsx(Os$1,{show:!0,clustering:y,children:n}):null};function ReearthClock({timelineManagerRef:t}){var z,W;const{start:n,stop:o,current:s}=((z=t==null?void 0:t.current)==null?void 0:z.computedTimeline)??{},{animation:c,stepType:d,rangeType:h,multiplier:p}=((W=t==null?void 0:t.current)==null?void 0:W.options)??{},y=React.useMemo(()=>n?Cesium$1.JulianDate.fromDate(n):void 0,[n]),S=React.useMemo(()=>o?Cesium$1.JulianDate.fromDate(o):void 0,[o]),P=React.useMemo(()=>s?Cesium$1.JulianDate.fromDate(s):void 0,[s]),L=d==="fixed"?Cesium$1.ClockStep.TICK_DEPENDENT:Cesium$1.ClockStep.SYSTEM_CLOCK_MULTIPLIER,F=p??1,N=React.useCallback(nt=>{var mt,kt;const Pe=Cesium$1.JulianDate.toDate(nt.startTime),se=Cesium$1.JulianDate.toDate(nt.stopTime);(kt=(mt=t==null?void 0:t.current)==null?void 0:mt.handleTick)==null||kt.call(mt,Cesium$1.JulianDate.toDate(nt.currentTime),{start:Pe,stop:se})},[t]);return jsxRuntimeExports.jsx(Ms$1,{shouldAnimate:c,canAnimate:c,startTime:y,stopTime:S,currentTime:P,clockStep:L,multiplier:F,clockRange:h?rangeTypes[h]:void 0,onTick:N})}const rangeTypes={unbounded:Cesium$1.ClockRange.UNBOUNDED,clamped:Cesium$1.ClockRange.CLAMPED,bounced:Cesium$1.ClockRange.LOOP_STOP},DEFAULT_SCREEN_SPACE_CAMERA_ASSIGNMENTS={translateEventTypes:Cesium$1.CameraEventType.LEFT_DRAG,zoomEventTypes:[Cesium$1.CameraEventType.RIGHT_DRAG,Cesium$1.CameraEventType.WHEEL,Cesium$1.CameraEventType.PINCH],rotateEventTypes:Cesium$1.CameraEventType.LEFT_DRAG,tiltEventTypes:[Cesium$1.CameraEventType.MIDDLE_DRAG,Cesium$1.CameraEventType.PINCH,{eventType:Cesium$1.CameraEventType.LEFT_DRAG,modifier:Cesium$1.KeyboardEventModifier.CTRL},{eventType:Cesium$1.CameraEventType.RIGHT_DRAG,modifier:Cesium$1.KeyboardEventModifier.CTRL}],lookEventTypes:[{eventType:Cesium$1.CameraEventType.LEFT_DRAG,modifier:Cesium$1.KeyboardEventModifier.SHIFT}]},layerIdField="__reearth_layer_id",defaultImageSize=50,drawIcon=(t,n,o,s="none",c=!1,d="rgba(0, 0, 0, 0.7)",h=3,p=0,y=0)=>{const S=document.createElement("canvas"),P=S.getContext("2d");if(!(!t||!P))return P.save(),S.width=n+h*2,S.height=o+h*2,P.shadowBlur=h,P.shadowOffsetX=p,P.shadowOffsetY=y,P.globalCompositeOperation="source-over",P.clearRect(0,0,S.width,S.height),P.drawImage(t,(S.width-n)/2,(S.height-o)/2,n,o),s==="circle"?(P.fillStyle="black",P.globalCompositeOperation="destination-in",P.arc(S.width/2,S.height/2,Math.min(n,o)/2,0,2*Math.PI),P.fill(),c&&(P.shadowColor=d,P.globalCompositeOperation="destination-over",P.fillStyle="black",P.arc(S.width/2,S.height/2,Math.min(n,o)/2,0,2*Math.PI),P.fill())):c&&(P.shadowColor=d,P.globalCompositeOperation="destination-over",P.fillStyle="black",P.rect((S.width-n)/2,(S.height-o)/2,n,o),P.fill()),P.restore(),S.toDataURL()},useIcon=({image:t,imageSize:n,crop:o,shadow:s,shadowColor:c,shadowBlur:d,shadowOffsetX:h,shadowOffsetY:p})=>{const y=useImage(t),S=y?typeof n=="number"?Math.floor(y.width*n):Math.min(defaultImageSize,y.width):0,P=y?Math.floor(typeof n=="number"?y.height*n:S/y.width*y.height):0;return[React.useMemo(()=>drawIcon(y,S,P,o,s,c,d,h,p),[o,P,y,s,d,c,h,p,S])??"",S,P]},ho$1=t=>({left:Cesium$1.HorizontalOrigin.LEFT,center:Cesium$1.HorizontalOrigin.CENTER,right:Cesium$1.HorizontalOrigin.RIGHT,"":void 0})[t||""],vo$1=t=>({top:Cesium$1.VerticalOrigin.TOP,center:Cesium$1.VerticalOrigin.CENTER,baseline:Cesium$1.VerticalOrigin.BASELINE,bottom:Cesium$1.VerticalOrigin.BOTTOM,"":void 0})[t||""],getLocationFromScreen=(t,n,o,s=!1)=>{if(!t)return;const c=t.camera,d=t.globe.ellipsoid;let h;if(s){const P=c.getPickRay(new Cesium$1.Cartesian2(n,o));P&&(h=t.globe.pick(P,t))}if(h||(h=c==null?void 0:c.pickEllipsoid(new Cesium$1.Cartesian2(n,o),d)),!h)return;const{latitude:p,longitude:y,height:S}=d.cartesianToCartographic(h);return{lat:Cesium$1.Math.toDegrees(p),lng:Cesium$1.Math.toDegrees(y),height:S}},getRayEllipsoidIntersection=(t,n,o)=>{const s=Cesium$1.IntersectionTests.rayEllipsoid(t,n);if(!s){const c=Cesium$1.IntersectionTests.grazingAltitudeLocation(t,n);return o?c.clone(o):c}return Cesium$1.Ray.getPoint(t,s.start,o)},createRayFromCamera=t=>{const n=new Cesium$1.Ray;return t.positionWC.clone(n.origin),t.directionWC.clone(n.direction),n},getCameraEllipsoidIntersection=(t,n,o)=>{let s;const{camera:c,globe:d}=t;if(n instanceof Cesium$1.Cartesian2){if(s=c.getPickRay(n,new Cesium$1.Ray),!s)return}else s=createRayFromCamera(c),o=n;return getRayEllipsoidIntersection(s,d.ellipsoid,o)},getCameraTerrainIntersection=t=>{const n=createRayFromCamera(t.camera);return t.globe.pick(n,t)},cartesianToLatLngHeight=(t,n)=>{const o=Cesium$1.Cartographic.fromCartesian(t,n.globe.ellipsoid);return{lng:Cesium$1.Math.toDegrees(o.longitude),lat:Cesium$1.Math.toDegrees(o.latitude),height:o.height}},flyTo=(t,n,o)=>{if(!t||!n)return()=>{};const s=animateFOV({fov:n.fov,camera:t,duration:o==null?void 0:o.duration,easing:o==null?void 0:o.easing}),c=typeof n.lat=="number"&&typeof n.lng=="number"&&typeof n.height=="number"?Cesium$1.Cartesian3.fromDegrees(n.lng,n.lat,n.height):void 0;return c&&t.flyTo({destination:c,orientation:{heading:n.heading,pitch:n.pitch,roll:n.roll},duration:(o==null?void 0:o.duration)??0,easingFunction:o==null?void 0:o.easing}),()=>{s==null||s(),t==null||t.cancelFlight()}},lookAt=(t,n,o)=>{if(!t||!n)return()=>{};const s=animateFOV({fov:n.fov,camera:t,duration:o==null?void 0:o.duration,easing:o==null?void 0:o.easing}),c=typeof n.lat=="number"&&typeof n.lng=="number"&&typeof n.height=="number"?Cesium$1.Cartesian3.fromDegrees(n.lng,n.lat,n.height):void 0;return c&&t.flyToBoundingSphere(new Cesium$1.BoundingSphere(c,n.radius),{offset:n.heading!==void 0||n.pitch!==void 0||n.range!==void 0?new Cesium$1.HeadingPitchRange(n.heading,n.pitch,n.range):void 0,duration:o==null?void 0:o.duration,easingFunction:o==null?void 0:o.easing}),()=>{s==null||s(),t==null||t.cancelFlight()}},lookAtWithoutAnimation=(t,n)=>{if(!n)return;const o=typeof n.lat=="number"&&typeof n.lng=="number"?Cesium$1.Cartesian3.fromDegrees(n.lng,n.lat,n.height):void 0;o&&t.camera.lookAtTransform(Cesium$1.Matrix4.fromTranslation(o))},animateFOV=({fov:t,camera:n,easing:o,duration:s})=>{if(typeof t=="number"&&n.frustum instanceof Cesium$1.PerspectiveFrustum&&typeof n.frustum.fov=="number"&&n.frustum.fov!==t){const c=n.frustum.fov;return tweenInterval(d=>{n.frustum instanceof Cesium$1.PerspectiveFrustum&&(n.frustum.fov=(t-c)*d+c)},o||"inOutCubic",(s??0)*1e3)}},getCenterCamera=({camera:t,scene:n})=>{const o=new Cesium$1.Cartesian3,s=t.getPickRay(t.positionWC);if(s)return s.origin=t.positionWC,s.direction=t.directionWC,n.globe.pick(s,n,o)},zoom=({viewer:t,relativeAmount:n},o)=>{const{camera:s,scene:c}=t;if(c.mode!==Cesium$1.SceneMode.SCENE3D){const F=getCamera(t);flyTo(s,{...F,height:((F==null?void 0:F.height)||1)*n},{duration:.5});return}const h=getCenterCamera({camera:s,scene:c})||Cesium$1.IntersectionTests.grazingAltitudeLocation(new Cesium$1.Ray(c.globe.ellipsoid.cartographicToCartesian(s.positionCartographic),s.directionWC),c.globe.ellipsoid);if(!h)return;const p={heading:s.heading,pitch:s.pitch,roll:s.roll},y=new Cesium$1.Cartesian3,S=Cesium$1.Cartesian3.subtract(s.position,h,y),P=Cesium$1.Cartesian3.multiplyByScalar(S,n,S),L=Cesium$1.Cartesian3.add(h,P,h);s.flyTo({destination:L,orientation:p,duration:(o==null?void 0:o.duration)||.5,convert:!1})},getCamera=t=>{if(!t||t.isDestroyed()||!t.camera||!t.scene)return;const{camera:n}=t;if(!(n.frustum instanceof Cesium$1.PerspectiveFrustum||n.frustum instanceof Cesium$1.OrthographicOffCenterFrustum))return;const{latitude:o,longitude:s,height:c}=n.positionCartographic,d=Cesium$1.Math.toDegrees(o),h=Cesium$1.Math.toDegrees(s),{heading:p,pitch:y,roll:S}=n,P=n.frustum instanceof Cesium$1.PerspectiveFrustum?n.frustum.fov:1,L=n.frustum instanceof Cesium$1.PerspectiveFrustum?n.frustum.aspectRatio:1;return{lng:h,lat:d,height:c,heading:p,pitch:y,roll:S,fov:P,aspectRatio:L}},getClock=t=>{if(t)return{get start(){return Cesium$1.JulianDate.toDate(t.startTime)},get stop(){return Cesium$1.JulianDate.toDate(t.stopTime)},get current(){return Cesium$1.JulianDate.toDate(t.currentTime)},get playing(){return t.shouldAnimate},get speed(){return t.multiplier}}},colorBlendMode=t=>({highlight:Cesium$1.ColorBlendMode.HIGHLIGHT,replace:Cesium$1.ColorBlendMode.REPLACE,mix:Cesium$1.ColorBlendMode.MIX})[t||""],colorBlendModeFor3DTile=(t="highlight")=>({highlight:Cesium$1.Cesium3DTileColorBlendMode.HIGHLIGHT,replace:Cesium$1.Cesium3DTileColorBlendMode.REPLACE,mix:Cesium$1.Cesium3DTileColorBlendMode.MIX})[t],heightReference=t=>({clamp:Cesium$1.HeightReference.CLAMP_TO_GROUND,relative:Cesium$1.HeightReference.RELATIVE_TO_GROUND,none:Cesium$1.HeightReference.NONE})[t||""],getOverriddenScreenSpaceCameraOptions=t=>{if(!t)return;const n=new Map([["left_drag",Cesium$1.CameraEventType.LEFT_DRAG],["right_drag",Cesium$1.CameraEventType.RIGHT_DRAG],["middle_drag",Cesium$1.CameraEventType.MIDDLE_DRAG],["wheel",Cesium$1.CameraEventType.WHEEL],["pinch",Cesium$1.CameraEventType.PINCH]]),o=new Map([["ctrl",Cesium$1.KeyboardEventModifier.CTRL],["shift",Cesium$1.KeyboardEventModifier.SHIFT],["alt",Cesium$1.KeyboardEventModifier.ALT]]),s=S=>{if(S)return S.map(P=>typeof P=="string"?n.get(P):{eventType:n.get(P.eventType),modifier:o.get(P.modifier)})},c=s(t.translateEventTypes),d=s(t.zoomEventTypes),h=s(t.rotateEventTypes),p=s(t.tiltEventTypes),y=s(t.lookEventTypes);return{...DEFAULT_SCREEN_SPACE_CAMERA_ASSIGNMENTS,...c&&{translateEventTypes:c},...d&&{zoomEventTypes:d},...h&&{rotateEventTypes:h},...p&&{tiltEventTypes:p},...y&&{lookEventTypes:y},...t.minimumZoomDistance!==void 0&&{minimumZoomDistance:t.minimumZoomDistance},...t.maximumZoomDistance!==void 0&&{maximumZoomDistance:t.maximumZoomDistance},...t.enableCollisionDetection!==void 0&&{enableCollisionDetection:t.enableCollisionDetection}}},classificationType=t=>({both:Cesium$1.ClassificationType.BOTH,"3dtiles":Cesium$1.ClassificationType.CESIUM_3D_TILE,terrain:Cesium$1.ClassificationType.TERRAIN})[t||""],shadowMode=t=>({enabled:Cesium$1.ShadowMode.ENABLED,cast_only:Cesium$1.ShadowMode.CAST_ONLY,receive_only:Cesium$1.ShadowMode.RECEIVE_ONLY,disabled:Cesium$1.ShadowMode.DISABLED})[t||""],unselectableTag="reearth_unselectable",draggableTag="reearth_draggable";function isSelectable(t){var n;return!((n=t==null?void 0:t.properties)!=null&&n.hasProperty(unselectableTag))}function isDraggable(t){var n;return(n=t.properties)==null?void 0:n[draggableTag]}function lookHorizontal(t,n){const o=t.camera,c=t.globe.ellipsoid.geodeticSurfaceNormal(o.position,new Cesium$1.Cartesian3);o.look(c,n)}function lookVertical(t,n){const o=t.camera,s=t.globe.ellipsoid,c=projectVectorToSurface(o.right,o.position,s),d=s.geodeticSurfaceNormal(o.position,new Cesium$1.Cartesian3),h=Cesium$1.Math.toDegrees(Cesium$1.Cartesian3.angleBetween(d,o.up)),p=rotateVectorAboutAxis(o.up,c,n),S=Cesium$1.Math.toDegrees(Cesium$1.Cartesian3.angleBetween(d,p))<h?1:(90-h)/90;o.look(c,n*S)}function moveForward(t,n){const o=projectVectorToSurface(t.camera.direction,t.camera.position,t.globe.ellipsoid);t.camera.move(o,n)}function moveBackward(t,n){const o=projectVectorToSurface(t.camera.direction,t.camera.position,t.globe.ellipsoid);t.camera.move(o,-n)}function moveUp(t,n){const o=t.globe.ellipsoid.geodeticSurfaceNormal(t.camera.position,new Cesium$1.Cartesian3);t.camera.move(o,n)}function moveDown(t,n){const o=t.globe.ellipsoid.geodeticSurfaceNormal(t.camera.position,new Cesium$1.Cartesian3);t.camera.move(o,-n)}function moveLeft(t,n){const o=projectVectorToSurface(t.camera.right,t.camera.position,t.globe.ellipsoid);t.camera.move(o,-n)}function moveRight(t,n){const o=projectVectorToSurface(t.camera.right,t.camera.position,t.globe.ellipsoid);t.camera.move(o,n)}async function moveOverTerrain(t,n=0){const o=getCamera(t);if((o==null?void 0:o.lng)===void 0||(o==null?void 0:o.lat)===void 0)return;const s=await sampleTerrainHeight(t.scene,o.lng,o.lat);if(s&&s!==0){const c=getCamera(t);c&&(c==null?void 0:c.height)<s+n&&t.scene.camera.moveUp(s+n-c.height)}}async function flyToGround(t,n,o,s,c=0){var p,y;if(o.lng===void 0||o.lat===void 0)return;const d=await sampleTerrainHeight(t.scene,o.lng,o.lat),h=d?d+c:c;(p=n.current)==null||p.call(n),n.current=flyTo((y=t.scene)==null?void 0:y.camera,{...getCamera(t),...o,height:h},s)}function projectVectorToSurface(t,n,o){const s=o.geodeticSurfaceNormal(n,new Cesium$1.Cartesian3),c=Cesium$1.Cartesian3.dot(t,s),d=Cesium$1.Cartesian3.multiplyByScalar(s,c,new Cesium$1.Cartesian3);return Cesium$1.Cartesian3.subtract(t,d,new Cesium$1.Cartesian3)}function rotateVectorAboutAxis(t,n,o){const s=Cesium$1.Quaternion.fromAxisAngle(n,-o,new Cesium$1.Quaternion),c=Cesium$1.Matrix3.fromQuaternion(s,new Cesium$1.Matrix3);return Cesium$1.Matrix3.multiplyByVector(c,t,t.clone())}async function sampleTerrainHeight(t,n,o){const s=t.terrainProvider;if(s instanceof Cesium$1.EllipsoidTerrainProvider)return 0;const[c]=await Cesium$1.sampleTerrainMostDetailed(s,[Cesium$1.Cartographic.fromDegrees(n,o)]);return c.height}async function sampleTerrainHeightFromCartesian(t,n){const o=Cesium$1.Cartographic.fromCartesian(n),[s,c]=[Cesium$1.Math.toDegrees((o==null?void 0:o.longitude)||0),Cesium$1.Math.toDegrees((o==null?void 0:o.latitude)||0)];if(!(!s||!c))return await sampleTerrainHeight(t,s,c)}const isColor=t=>t==null?void 0:t.match(/^#[A-Fa-f0-9]|^rgba?/),toColor$1=t=>{if(!t||typeof t!="string")return;const n=t.match(/^#([A-Fa-f0-9]{6})([A-Fa-f0-9]{2})$|^#([A-Fa-f0-9]{3})([A-Fa-f0-9])$/);if(!n)return Cesium$1.Color.fromCssColorString(t);const o=parseInt(n[4]?n[4].repeat(2):n[2],16)/255;return Cesium$1.Color.fromCssColorString(`#${n[1]??n[3]}`).withAlpha(o)},updateMapController=(t,n)=>{t.scene.screenSpaceCameraController.enableTranslate=n,t.scene.screenSpaceCameraController.enableRotate=n,t.scene.screenSpaceCameraController.enableLook=n,t.scene.screenSpaceCameraController.enableTilt=n,t.scene.screenSpaceCameraController.enableZoom=n};function getExtrudedHeight(t,n,o,s=!1){const c=new Cesium$1.Cartesian3,d=new Cesium$1.Cartesian3,h=new Cesium$1.Ray,p=new Cesium$1.Plane(Cesium$1.Cartesian3.UNIT_X,0),y=new Cesium$1.Cartographic;let S;try{const P=t.globe.ellipsoid.geodeticSurfaceNormal(n,d),L=t.camera.getPickRay(o,h);if(L==null)return;const F=Cesium$1.Plane.fromPointNormal(n,Cesium$1.Cartesian3.normalize(Cesium$1.Cartesian3.cross(P,Cesium$1.Cartesian3.cross(P,L.direction,c),c),c),p);if(S=Cesium$1.IntersectionTests.rayPlane(L,F,c),S==null)return;const N=Cesium$1.Cartographic.fromCartesian(S,t.globe.ellipsoid,y).height,z=Cesium$1.Cartographic.fromCartesian(n,t.globe.ellipsoid,y).height;return s?N-z:Math.max(0,N-z)}catch(P){console.error(P)}}function getCredits(t){if(!t)return;const n=t.creditDisplay;if(!n)return;const{lightboxCredits:o,screenCredits:s}=(n==null?void 0:n._currentFrameCredits)||{},c=n._currentCesiumCredit;return[...c!=null&&c.html?[{html:c.html}]:[],...Array.from((o==null?void 0:o._array)??[]).map(h=>{var p;return{html:(p=h==null?void 0:h.credit)==null?void 0:p.html}}),...Array.from((s==null?void 0:s._array)??[]).map(h=>{var p;return{html:(p=h==null?void 0:h.credit)==null?void 0:p.html}})]}function Globe({property:t,cesiumIonAccessToken:n,onTerrainProviderChange:o}){var h,p,y,S,P,L,F,N,z,W,nt,Pe,se,mt,kt,mn,_i,zi,Sa,fa,La,Ra;const s=React.useMemo(()=>({...t==null?void 0:t.terrain}),[t==null?void 0:t.terrain]),c=React.useMemo(()=>{var lt,pi,ba,Sc,ms,Xs,Nl,pu,yu;const ma={terrain:s==null?void 0:s.enabled,terrainType:s==null?void 0:s.type,normal:s==null?void 0:s.normal,ionAccessToken:((ba=(pi=(lt=t==null?void 0:t.assets)==null?void 0:lt.cesium)==null?void 0:pi.terrain)==null?void 0:ba.ionAccessToken)||n,ionAsset:(Xs=(ms=(Sc=t==null?void 0:t.assets)==null?void 0:Sc.cesium)==null?void 0:ms.terrain)==null?void 0:Xs.ionAsset,ionUrl:(yu=(pu=(Nl=t==null?void 0:t.assets)==null?void 0:Nl.cesium)==null?void 0:pu.terrain)==null?void 0:yu.ionUrl},yt=ma.terrain?terrainProviders[ma.terrainType||"cesium"]:void 0;return(typeof yt=="function"?yt(ma):yt)??defaultTerrainProvider},[s==null?void 0:s.enabled,s==null?void 0:s.type,s==null?void 0:s.normal,(y=(p=(h=t==null?void 0:t.assets)==null?void 0:h.cesium)==null?void 0:p.terrain)==null?void 0:y.ionAccessToken,(L=(P=(S=t==null?void 0:t.assets)==null?void 0:S.cesium)==null?void 0:P.terrain)==null?void 0:L.ionAsset,(z=(N=(F=t==null?void 0:t.assets)==null?void 0:F.cesium)==null?void 0:N.terrain)==null?void 0:z.ionUrl,n]),d=React.useMemo(()=>{var ma;return toColor$1((ma=t==null?void 0:t.globe)==null?void 0:ma.baseColor)},[(W=t==null?void 0:t.globe)==null?void 0:W.baseColor]);return React.useEffect(()=>{o==null||o()},[c,o]),jsxRuntimeExports.jsx(js$4,{baseColor:d,enableLighting:!!((nt=t==null?void 0:t.globe)!=null&&nt.enableLighting),showGroundAtmosphere:((se=(Pe=t==null?void 0:t.globe)==null?void 0:Pe.atmosphere)==null?void 0:se.enabled)??!0,atmosphereLightIntensity:(kt=(mt=t==null?void 0:t.globe)==null?void 0:mt.atmosphere)==null?void 0:kt.lightIntensity,atmosphereSaturationShift:(_i=(mn=t==null?void 0:t.globe)==null?void 0:mn.atmosphere)==null?void 0:_i.saturationShift,atmosphereHueShift:(Sa=(zi=t==null?void 0:t.globe)==null?void 0:zi.atmosphere)==null?void 0:Sa.hueShift,atmosphereBrightnessShift:(La=(fa=t==null?void 0:t.globe)==null?void 0:fa.atmosphere)==null?void 0:La.brightnessShift,terrainProvider:c,depthTestAgainstTerrain:!!((Ra=t==null?void 0:t.globe)!=null&&Ra.depthTestAgainstTerrain)})}const defaultTerrainProvider=new Cesium$1.EllipsoidTerrainProvider,terrainProviders={cesium:({ionAccessToken:t,normal:n})=>Cesium$1.CesiumTerrainProvider.fromUrl(Cesium$1.IonResource.fromAssetId(1,{accessToken:t}),{requestVertexNormals:n,requestWaterMask:!1}),arcgis:()=>Cesium$1.ArcGISTiledElevationTerrainProvider.fromUrl("https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer"),cesiumion:({ionAccessToken:t,ionAsset:n,ionUrl:o,normal:s})=>n?Cesium$1.CesiumTerrainProvider.fromUrl(o||Cesium$1.IonResource.fromAssetId(parseInt(n,10),{accessToken:t}),{requestVertexNormals:s}):null};function defined(t){return t!=null}function DeveloperError(t){this.name="DeveloperError",this.message=t;let n;try{throw new Error}catch(o){n=o.stack}this.stack=n}defined(Object.create)&&(DeveloperError.prototype=Object.create(Error.prototype),DeveloperError.prototype.constructor=DeveloperError),DeveloperError.prototype.toString=function(){let t=`${this.name}: ${this.message}`;return defined(this.stack)&&(t+=`
|
|
124
|
+
Check the top-level render call using <`+lf+">.")}return tf}}function bf(al,tf){{if(!al._store||al._store.validated||al.key!=null)return;al._store.validated=!0;var lf=rf(tf);if(Tf[lf])return;Tf[lf]=!0;var yf="";al&&al._owner&&al._owner!==Qf.current&&(yf=" It was passed a child from "+yt(al._owner.type)+"."),Bf(al),se('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',lf,yf),Bf(null)}}function If(al,tf){{if(typeof al!="object")return;if(nf(al))for(var lf=0;lf<al.length;lf++){var yf=al[lf];qf(yf)&&bf(yf,tf)}else if(qf(al))al._store&&(al._store.validated=!0);else if(al){var Lf=nt(al);if(typeof Lf=="function"&&Lf!==al.entries)for(var Of=Lf.call(al),Mf;!(Mf=Of.next()).done;)qf(Mf.value)&&bf(Mf.value,tf)}}}function Uf(al){{var tf=al.type;if(tf==null||typeof tf=="string")return;var lf;if(typeof tf=="function")lf=tf.propTypes;else if(typeof tf=="object"&&(tf.$$typeof===y||tf.$$typeof===L))lf=tf.propTypes;else return;if(lf){var yf=yt(tf);cf(lf,al.props,"prop",yf,al)}else if(tf.PropTypes!==void 0&&!$m){$m=!0;var Lf=yt(tf);se("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Lf||"Unknown")}typeof tf.getDefaultProps=="function"&&!tf.getDefaultProps.isReactClassApproved&&se("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function jf(al){{for(var tf=Object.keys(al.props),lf=0;lf<tf.length;lf++){var yf=tf[lf];if(yf!=="children"&&yf!=="key"){Bf(al),se("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",yf),Bf(null);break}}al.ref!==null&&(Bf(al),se("Invalid attribute `ref` supplied to `React.Fragment`."),Bf(null))}}function jm(al,tf,lf,yf,Lf,Of){{var Mf=La(al);if(!Mf){var Vf="";(al===void 0||typeof al=="object"&&al!==null&&Object.keys(al).length===0)&&(Vf+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Gf=ep();Gf?Vf+=Gf:Vf+=qm();var Df;al===null?Df="null":nf(al)?Df="array":al!==void 0&&al.$$typeof===n?(Df="<"+(yt(al.type)||"Unknown")+" />",Vf=" Did you accidentally export a JSX literal instead of a component?"):Df=typeof al,se("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Df,Vf)}var Zf=Wf(al,tf,lf,Lf,Of);if(Zf==null)return Zf;if(Mf){var Kf=tf.children;if(Kf!==void 0)if(yf)if(nf(Kf)){for(var yp=0;yp<Kf.length;yp++)If(Kf[yp],al);Object.freeze&&Object.freeze(Kf)}else se("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else If(Kf,al)}return al===s?jf(Zf):Uf(Zf),Zf}}function sp(al,tf,lf){return jm(al,tf,lf,!0)}function cp(al,tf,lf){return jm(al,tf,lf,!1)}var fp=cp,mp=sp;pe$1.Fragment=s,pe$1.jsx=fp,pe$1.jsxs=mp}()),pe$1}process.env.NODE_ENV==="production"?Ae$1.exports=Ot$1():Ae$1.exports=Gt$1();var H$1=Ae$1.exports;function Bt$1(t,n){return n?Fe$1(t).reduce((o,[s,c])=>(ve$1(n,s)&&(o[s]=c),o),{}):{}}function Fe$1(t){return Object.keys(t).map(n=>[n,t[n]])}function ve$1(t,n){return!!t&&t.indexOf(n)!==-1}function At$1(t,n){return!!t&&!!n&&[...Object.keys(t),...Object.keys(n)].every(o=>t[o]===n[o])}function Ft$1(t){return t&&typeof t.isDestroyed=="function"&&typeof t.destroy=="function"}function It$1(t){return Ft$1(t)&&t.isDestroyed()}function J(t){return t&&typeof t=="object"&&"then"in t&&typeof t.then=="function"}const ce$1="__RESIUM_EVENT_MANAGER",Ie$1=["onClick","onDoubleClick","onMouseDown","onMouseUp","onMiddleClick","onMiddleDown","onMiddleUp","onMouseMove","onPinchEnd","onPinchMove","onPinchStart","onRightClick","onRightDown","onRightUp","onWheel","onMouseEnter","onMouseLeave"],Re$1=class lg{constructor(n){K$1(this,"scene"),K$1(this,"sshe"),K$1(this,"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}),K$1(this,"hovered"),K$1(this,"onMouseMove",o=>{var s,c,d,h,p,y;const S=this.pick(o.endPosition);this.hovered!==S&&(this.hovered&&((s=this.getEventCallback("onMouseLeave",this.hovered))==null||s(o,this.hovered),(c=this.getEventCallback("onMouseLeave",null))==null||c(o,this.hovered)),S&&((d=this.getEventCallback("onMouseEnter",S))==null||d(o,S),(h=this.getEventCallback("onMouseEnter",null))==null||h(o,S))),S&&((p=this.getEventCallback("onMouseMove",S))==null||p(o,S)),(y=this.getEventCallback("onMouseMove",null))==null||y(o,S),this.hovered=S}),K$1(this,"eventCallback",o=>s=>{var c,d;const h=this.pick(s==null?void 0:s.position);h&&((c=this.getEventCallback(o,h))==null||c(s,h)),(d=this.getEventCallback(o,null))==null||d(s,h)}),this.scene=n,this.sshe=new Cesium$1.ScreenSpaceEventHandler(n==null?void 0:n.canvas)}destroy(){this.hovered=void 0,this.sshe.isDestroyed()||this.sshe.destroy()}isDestroyed(){return this.sshe.isDestroyed()}on(n,o,s){n&&o==="onWheel"||this.events[o].set(n,s)}off(n,o){this.events[o].delete(n),this.hovered===n&&(this.hovered=void 0)}setEvents(n,o){Fe$1(o).forEach(([s,c])=>{const d=s;ve$1(Ie$1,d)&&(c?this.on(n,d,c):this.off(n,d))}),this.commit()}clearEvents(n){this.hovered=void 0,Ie$1.forEach(o=>{this.off(n,o)}),this.commit()}commit(){const n=this.sshe,o=this.sshe.isDestroyed();o||(this.events.onMouseEnter.size===0&&this.events.onMouseLeave.size===0&&this.events.onMouseMove.size===0?this.sshe.removeInputAction(Cesium$1.ScreenSpaceEventType.MOUSE_MOVE):this.sshe.getInputAction(Cesium$1.ScreenSpaceEventType.MOUSE_MOVE)||this.sshe.setInputAction(this.onMouseMove,Cesium$1.ScreenSpaceEventType.MOUSE_MOVE)),Fe$1(this.events).forEach(([s,c])=>{if(s==="onMouseEnter"||s==="onMouseLeave"||s==="onMouseMove")return;const d=lg.eventTypeMap[s];o||(c.size===0?n.removeInputAction(d):n.getInputAction(d)||n.setInputAction(this.eventCallback(s),d))})}getScreenSpaceEventHandler(){return this.sshe}getEventCallback(n,o){var s,c;return o===null?this.events[n].get(null):this.events[n].get(o.id)||this.events[n].get((c=(s=o.id)==null?void 0:s.entityCollection)==null?void 0:c.owner)||this.events[n].get(o.primitive)||this.events[n].get(o.tileset)}pick(n){var o;if(n)return(o=this.scene)==null?void 0:o.pick(n)}};K$1(Re$1,"eventTypeMap",{onClick:Cesium$1.ScreenSpaceEventType.LEFT_CLICK,onDoubleClick:Cesium$1.ScreenSpaceEventType.LEFT_DOUBLE_CLICK,onMouseDown:Cesium$1.ScreenSpaceEventType.LEFT_DOWN,onMouseUp:Cesium$1.ScreenSpaceEventType.LEFT_UP,onMiddleClick:Cesium$1.ScreenSpaceEventType.MIDDLE_CLICK,onMiddleDown:Cesium$1.ScreenSpaceEventType.MIDDLE_DOWN,onMiddleUp:Cesium$1.ScreenSpaceEventType.MIDDLE_UP,onMouseMove:Cesium$1.ScreenSpaceEventType.MOUSE_MOVE,onPinchEnd:Cesium$1.ScreenSpaceEventType.PINCH_END,onPinchMove:Cesium$1.ScreenSpaceEventType.PINCH_MOVE,onPinchStart:Cesium$1.ScreenSpaceEventType.PINCH_START,onRightClick:Cesium$1.ScreenSpaceEventType.RIGHT_CLICK,onRightDown:Cesium$1.ScreenSpaceEventType.RIGHT_DOWN,onRightUp:Cesium$1.ScreenSpaceEventType.RIGHT_UP,onWheel:Cesium$1.ScreenSpaceEventType.WHEEL,onMouseEnter:Cesium$1.ScreenSpaceEventType.MOUSE_MOVE,onMouseLeave:Cesium$1.ScreenSpaceEventType.MOUSE_MOVE});let De$1=Re$1;const Wt$1=({name:t,create:n,destroy:o,provide:s,update:c,cesiumReadonlyProps:d,cesiumEventProps:h,otherProps:p,setCesiumPropsAfterCreate:y,useCommonEvent:S,useRootEvent:P},L,F)=>{const N=React.useRef(),z=$e$1(),W=React.useRef(s?{}:void 0),nt=React.useRef({}),Pe=React.useRef(si$1(L)),se=React.useRef({}),[mt,kt]=React.useState(!1),mn=React.useRef(!1),_i=React.useRef(null),zi=React.useRef(),Sa=z==null?void 0:z[ce$1],fa=React.useRef(),La=React.useRef(),Ra=React.useCallback(async pi=>{var ba;if(!N.current)return;const Sc=N.current,ms=Object.keys(pi),Xs=Object.keys(h||[]),Nl=ms.concat(Object.keys(se.current).filter(Ru=>!ms.includes(Ru))).filter(Ru=>se.current[Ru]!==pi[Ru]).map(Ru=>[Ru,se.current[Ru],pi[Ru]]),pu=[];for(const[Ru,Vd,Gd]of Nl)if(d!=null&&d.includes(Ru))pu.push(Ru);else if(ve$1(Xs,Ru)){const uf=h==null?void 0:h[Ru],ff=Sc[uf];ff instanceof Cesium$1.Event&&(typeof Vd>"u"?(ff.addEventListener(Gd),nt.current[uf]=Gd):typeof Gd>"u"?(ff.removeEventListener(Vd),delete nt.current[uf]):(ff.removeEventListener(Vd),ff.addEventListener(Gd)))}else Ru!=="children"&&!Ie$1.includes(Ru)&&!(p!=null&&p.includes(Ru))&&(Sc[Ru]=Gd);const yu=P?(ba=W.current)==null?void 0:ba[ce$1]:Sa;if(S&&yu&&N.current&&yu.setEvents(P?null:N.current,pi),c&&mn.current){const Ru=c(N.current,pi,se.current,z);J(Ru)&&await Ru}se.current=pi,Pe.current=pi,mn.current&&pu.length>0&&(process.env.NODE_ENV!=="production"&&console.warn(`Warning: <${t}> is recreated because following read-only props have been updated: ${pu.join(", ")}`),yt(),await lt(),fa.current=ma())},[]),ma=React.useCallback(async()=>{var pi;await new Promise(Xs=>queueMicrotask(()=>Xs(void 0)));const ba=n==null?void 0:n(z,Pe.current,_i.current);let Sc;if(J(ba)?Sc=await ba:Sc=ba,Array.isArray(Sc)?(N.current=Sc[0],zi.current=Sc[1]):N.current=Sc,y)await Ra(Pe.current);else{if(N.current&&h){const Xs=N.current;for(const Nl of Object.keys(Pe.current)){const pu=h[Nl];if(pu){const yu=Pe.current[Nl],Ru=Xs[pu];yu&&Ru instanceof Cesium$1.Event&&Ru.addEventListener(yu)}}}se.current=Pe.current}s&&N.current&&(W.current={...z,...s(N.current,z,L,zi.current)});const ms=P?(pi=W.current)==null?void 0:pi[ce$1]:Sa;S&&ms&&N.current&&ms.setEvents(P?null:N.current,Pe.current),La.current||kt(!0)},[]),yt=React.useCallback(()=>{kt(!1),mn.current=!1},[]),lt=React.useCallback(async()=>{var pi,ba;await new Promise(ms=>queueMicrotask(()=>ms(void 0))),fa.current&&(await fa.current,fa.current=void 0),N.current&&o&&o(N.current,z,_i.current,zi.current);const Sc=P?(pi=W.current)==null?void 0:pi[ce$1]:Sa;if(S&&Sc&&N.current&&Sc.clearEvents(P?null:N.current),N.current&&!It$1(N.current)){const ms=Object.keys(nt.current);for(const Xs of ms){const Nl=N.current[Xs];(ba=Nl==null?void 0:Nl.removeEventListener)==null||ba.call(Nl,nt.current[Xs])}}nt.current={},W.current=void 0,zi.current=void 0,N.current=void 0},[]);return React.useLayoutEffect(()=>((async()=>(La.current&&(await La.current,La.current=void 0),fa.current=ma()))(),()=>{yt(),La.current=lt()}),[ma,lt,yt]),React.useEffect(()=>{(async()=>{var pi,ba;fa.current&&await fa.current;const Sc=si$1(L);mt?At$1(Sc,se.current)||(await Ra(Sc),(ba=(pi=z.__$internal)==null?void 0:pi.onUpdate)==null||ba.call(pi)):(se.current=Sc,Pe.current=Sc,mn.current=!0)})()},[z.__$internal,mt,L,Ra]),React.useImperativeHandle(F,()=>({cesiumElement:mt?N.current:null}),[mt]),[W.current,mt,_i]};function si$1(t){const{children:n,...o}=t;return o}const l=({renderContainer:t,noChildren:n,containerProps:o,defaultProps:s,...c})=>{const d=(h,p)=>{const y={...s,...h},[S,P,L]=Wt$1(c,y,p);if(n)return null;const F=P&&"children"in y?y.children:null,N=t?H$1.jsx("div",{"data-testid":"resium-container",ref:L,...typeof o=="function"?o(y):Bt$1(y,o),children:F}):F?H$1.jsx(H$1.Fragment,{children:F}):null;return S?H$1.jsx(We$1.Provider,{value:S,children:N}):N};return d.displayName=c.name,React.forwardRef(d)},Vt$1=["enabled","selected"],U$1=t=>l({name:t.name,create(n,o){if(!n.scene)return;const s=t.create(o,n.scene.postProcessStages);return typeof o.enabled=="boolean"&&(s.enabled=o.enabled),o.selected&&"selected"in s&&(s.selected=o.selected),t.props.forEach(c=>{!ve$1(t.readonlyProps,c)&&typeof o[c]<"u"&&(s.uniforms[c]=o[c])}),!t.noMount&&n.scene&&!n.scene.isDestroyed()&&n.scene.postProcessStages.add(s),s},destroy(n,o){t.noMount?n.enabled=!1:(o.scene&&!o.scene.isDestroyed()&&o.scene.postProcessStages.remove(n),n.isDestroyed()||n.destroy())},update(n,o,s){t.props.forEach(c=>{!ve$1(t.readonlyProps,c)&&o[c]!==s[c]&&(n.uniforms[c]=o[c])})},cesiumProps:Vt$1,cesiumReadonlyProps:t.readonlyProps,defaultProps:{enabled:!0}}),Ut$1=["alignedAxis","color","disableDepthTestDistance","distanceDisplayCondition","eyeOffset","height","heightReference","horizontalOrigin","image","pixelOffset","pixelOffsetScaleByDistance","position","rotation","scale","scaleByDistance","show","sizeInMeters","translucencyByDistance","verticalOrigin","width","id"];l({name:"Billboard",create(t,n){var o;return(o=t.billboardCollection)==null?void 0:o.add(n)},destroy(t,n){n.billboardCollection&&!n.billboardCollection.isDestroyed()&&n.billboardCollection.remove(t)},cesiumProps:Ut$1,useCommonEvent:!0});const Ht$1=["blendOption","debugShowBoundingVolume","debugShowTextureAtlas","modelMatrix","show"];l({name:"BillboardCollection",create(t,n){if(!t.primitiveCollection)return;const o=new Cesium$1.BillboardCollection({modelMatrix:n.modelMatrix,debugShowBoundingVolume:n.debugShowBoundingVolume,scene:t.scene,blendOption:n.blendOption});return t.primitiveCollection.add(o),o},destroy(t,n){n.primitiveCollection&&!n.primitiveCollection.isDestroyed()&&n.primitiveCollection.remove(t),t.isDestroyed()||t.destroy()},provide(t){return{billboardCollection:t}},cesiumProps:Ht$1});const xt$1=["image","show","scale","horizontalOrigin","verticalOrigin","eyeOffset","pixelOffset","rotation","alignedAxis","width","height","color","scaleByDistance","translucencyByDistance","pixelOffsetScaleByDistance","imageSubRegion","sizeInMeters","heightReference","distanceDisplayCondition","disableDepthTestDistance"],Nt$1={onDefinitionChange:"definitionChanged"},qt$1=l({name:"BillboardGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.BillboardGraphics(n);return t.entity.billboard=o,o},destroy(t,n){n.entity&&(n.entity.billboard=void 0)},cesiumProps:xt$1,cesiumEventProps:Nt$1}),gs$1=qt$1,Yt$1=["heightReference","dimensions","show","fill","material","outline","outlineColor","outlineWidth","shadows","distanceDisplayCondition"],Kt$1={onDefinitionChange:"definitionChanged"},Jt$1=l({name:"BoxGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.BoxGraphics(n);return t.entity.box=o,o},destroy(t,n){n.entity&&(n.entity.box=void 0)},cesiumProps:Yt$1,cesiumEventProps:Kt$1}),Cs$1=Jt$1,Zt$1=["position","direction","up","right","frustum","defaultMoveAmount","defaultLookAmount","defaultRotateAmount","defaultZoomAmount","constrainedAxis","maximumZoomFactor","percentageChanged"],Xt$1={onChange:"changed",onMoveEnd:"moveEnd",onMoveStart:"moveStart"},Qt$1=l({name:"Camera",create:t=>{var n;return(n=t.scene)==null?void 0:n.camera},cesiumProps:Zt$1,cesiumEventProps:Xt$1,setCesiumPropsAfterCreate:!0}),Ps$1=Qt$1,rn$1=["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","classificationType","ellipsoid","lightColor","colorBlendAmount","colorBlendMode","debugFreezeFrame","debugColorizeTiles","debugWireframe","debugShowBoundingVolume","debugShowContentBoundingVolume","debugShowViewerRequestVolume","debugShowGeometricError","debugShowRenderingStatistics","debugShowMemoryUsage","debugShowUrl","style","backFaceCulling","vectorClassificationOnly","vectorKeepDecodedPositions","splitDirection","customShader","imageBasedLighting","showCreditsOnScreen","featureIdLabel","instanceFeatureIdLabel","imageBasedLighting","outlineColor","cacheBytes","maximumCacheOverflowBytes","enableCollision"],sn$1=["showOutline","cullWithChildrenBounds","debugHeatmapTilePropertyName","enableDebugWireframe","modelUpAxis","modelForwardAxis","projectTo2D","enableShowOutline","enablePick"],an$1={onAllTilesLoad:"allTilesLoaded",onInitialTilesLoad:"initialTilesLoaded",onLoadProgress:"loadProgress",onTileFailed:"tileFailed",onTileLoad:"tileLoad",onTileUnload:"tileUnload",onTileVisible:"tileVisible"},cn$1=["onReady","onError","url"],ln$1=l({name:"Cesium3DTileset",async create(t,n){var o,s;if(!t.primitiveCollection)return;const c=n.url;let d;J(c)?d=await c:d=c;let h;try{h=await Cesium$1.Cesium3DTileset.fromUrl(d,n),(o=n.onReady)==null||o.call(n,h)}catch(p){(s=n.onError)==null||s.call(n,p);return}return n.colorBlendAmount&&(h.colorBlendAmount=n.colorBlendAmount),n.colorBlendMode&&(h.colorBlendMode=n.colorBlendMode),n.style&&(h.style=n.style),t.primitiveCollection.add(h),h},destroy(t,n){n.primitiveCollection&&!n.primitiveCollection.isDestroyed()&&n.primitiveCollection.remove(t),t.isDestroyed()||t.destroy()},cesiumProps:rn$1,cesiumReadonlyProps:sn$1,cesiumEventProps:an$1,otherProps:cn$1,useCommonEvent:!0}),Ds$1=ln$1,un$1=["show","uri","maximumScreenSpaceError"],dn$1={onDefinitionChange:"definitionChanged"};l({name:"Cesium3DTilesetGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.Cesium3DTilesetGraphics(n);return t.entity.tileset=o,o},destroy(t,n){n.entity&&(n.entity.tileset=void 0)},cesiumProps:un$1,cesiumEventProps:dn$1});const fn$1=["resolutionScale","useDefaultRenderLoop","targetFrameRate","useBrowserRecommendedResolution","creditDisplay"],hn$1=["clock","baseLayer","terrainProvider","skyBox","skyAtmosphere","sceneMode","scene3DOnly","orderIndependentTranslucency","mapMode2D","mapProjection","globe","showRenderLoopErrors","contextOptions","creditContainer","creditViewport","shadows","terrainShadows","terrain","requestRenderMode","maximumRenderTimeChange","msaaSamples","blurActiveElementOnCanvasFocus"],yn$1=["className","id","style","full","containerProps"];l({name:"CesiumWidget",create(t,n,o){if(!o)return;const s=new Cesium$1.CesiumWidget(o,n);if(!s)return;typeof n.resolutionScale=="number"&&(s.resolutionScale=n.resolutionScale);const c=new De$1(s.scene);return[s,c]},destroy(t,n,o,s){s&&!s.isDestroyed()&&s.destroy(),t.isDestroyed()||t.destroy()},provide(t,n,o,s){return{cesiumWidget:t,scene:t.scene,camera:t.scene.camera,imageryLayerCollection:t.scene.globe.imageryLayers,primitiveCollection:t.scene.primitives,globe:t.scene.globe,__$internal:{onUpdate:o==null?void 0:o.onUpdate},[ce$1]:s}},containerProps:({id:t,className:n,style:o,full:s,containerProps:c})=>({className:n,id:t,style:{...s?{position:"absolute",bottom:"0",left:"0",right:"0",top:"0"}:{},...o},...c}),cesiumProps:fn$1,cesiumReadonlyProps:hn$1,otherProps:yn$1,renderContainer:!0,useCommonEvent:!0,useRootEvent:!0});const vn$1=["classificationType","debugShowBoundingVolume","debugShowShadowVolume","show"],gn$1=["allowPicking","asynchronous","compressVertices","geometryInstances","interleave","releaseGeometryInstances","vertexCacheOptimize","appearance"],Cn$1=["onReady"];l({name:"ClassificationPrimitive",async create(t,n){var o;if(!t.primitiveCollection)return;const s=new Cesium$1.ClassificationPrimitive(n);if(n.onReady){const c=()=>{var d,h;s.ready&&((d=n.onReady)==null||d.call(n,s),(h=t.scene)==null||h.postRender.removeEventListener(c))};(o=t.scene)==null||o.postRender.addEventListener(c)}return t.primitiveCollection.add(s),s},destroy(t,n){n.primitiveCollection&&!n.primitiveCollection.isDestroyed()&&n.primitiveCollection.remove(t),t.isDestroyed()||t.destroy()},cesiumProps:vn$1,cesiumReadonlyProps:gn$1,otherProps:Cn$1,useCommonEvent:!0});const Sn$1={onStop:"onStop",onTick:"onTick"},En$1=["canAnimate","clockRange","clockStep","currentTime","multiplier","shouldAnimate","startTime","stopTime"],bn$1=l({name:"Clock",create:t=>{var n;return(n=t.cesiumWidget)==null?void 0:n.clock},cesiumProps:En$1,cesiumEventProps:Sn$1,setCesiumPropsAfterCreate:!0}),Ms$1=bn$1,wn$1=["noiseDetail","noiseOffset","show","debugBillboards","debugEllipsoids"];l({name:"CloudCollection",create:t=>{if(!t.primitiveCollection)return;const n=new Cesium$1.CloudCollection;return t.primitiveCollection.add(n),n},destroy(t,n){n.primitiveCollection&&!n.primitiveCollection.isDestroyed()&&n.primitiveCollection.remove(t),t.isDestroyed()||t.destroy()},provide:t=>({cloudCollection:t}),cesiumProps:wn$1,setCesiumPropsAfterCreate:!0});const Rn$1=["positions","width","cornerType","height","heightReference","extrudedHeight","extrudedHeightReference","show","fill","material","outline","outlineColor","outlineWidth","granularity","shadows","distanceDisplayCondition","zIndex","classificationType"],$n$1={onDefinitionChange:"definitionChanged"};l({name:"CorridorGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.CorridorGraphics(n);return n.classificationType&&(o.classificationType=n.classificationType),t.entity.corridor=o,o},destroy(t,n){n.entity&&(n.entity.corridor=void 0)},cesiumProps:Rn$1,cesiumEventProps:$n$1});const Mn$1=["show","position","scale","maximumSize","slice","brightness","color"];l({name:"CumulusCloud",create:(t,n)=>{var o;return(o=t.cloudCollection)==null?void 0:o.add(n)},destroy(t,n){n.cloudCollection&&!n.cloudCollection.isDestroyed()&&n.cloudCollection.remove(t)},cesiumProps:Mn$1});const Ln$1=["clustering","name","show","clock","isLoading"],_n$1={onChange:"changedEvent",onError:"errorEvent",onLoading:"loadingEvent"},On$1=l({name:"CustomDataSource",create(t,n){if(!t.dataSourceCollection)return;const o=new Cesium$1.CustomDataSource(n.name);return n.clustering&&(o.clustering=n.clustering),typeof n.show=="boolean"&&(o.show=n.show),typeof n.clock<"u"&&(o.clock=n.clock),t.dataSourceCollection.add(o),o},destroy(t,n){n.dataSourceCollection&&!n.dataSourceCollection.isDestroyed()&&n.dataSourceCollection.remove(t)},provide(t){return{entityCollection:t.entities,dataSource:t}},cesiumProps:Ln$1,cesiumEventProps:_n$1,useCommonEvent:!0}),Os$1=On$1,Gn$1=["heightReference","length","topRadius","bottomRadius","show","fill","material","outline","outlineColor","outlineWidth","numberOfVerticalLines","slices","distanceDisplayCondition","shadows"],Bn$1={onDefinitionChange:"definitionChanged"};l({name:"CylinderGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.CylinderGraphics(n);return t.entity.cylinder=o,o},destroy(t,n){n.entity&&(n.entity.cylinder=void 0)},cesiumProps:Gn$1,cesiumEventProps:Bn$1});const Fn$1=["clustering","show"],In$1=["name","sourceUri","credit"],Wn$1={onChange:"changedEvent",onError:"errorEvent",onLoading:"loadingEvent"},Vn$1=["onLoad","data"],ai=(t,{data:n,onLoad:o,...s})=>{n&&t.load(n,s).then(c=>{o&&o(c)})},Un$1=l({name:"CzmlDataSource",create(t,n){if(!t.dataSourceCollection)return;const o=new Cesium$1.CzmlDataSource(n.name);return n.clustering&&(o.clustering=n.clustering),typeof n.show=="boolean"&&(o.show=n.show),t.dataSourceCollection.add(o),n.data&&ai(o,n),o},update(t,n,o){n.data?o.show!==n.show&&(t.show=typeof n.show=="boolean"?n.show:!0):t.show=!1,n.data&&(o.data!==n.data||o.sourceUri!==n.sourceUri||o.credit!==n.credit)&&ai(t,n)},destroy(t,n){n.dataSourceCollection&&!n.dataSourceCollection.isDestroyed()&&n.dataSourceCollection.remove(t)},provide(t){return{dataSource:t}},cesiumProps:Fn$1,cesiumReadonlyProps:In$1,cesiumEventProps:Wn$1,otherProps:Vn$1,useCommonEvent:!0}),Bs$1=Un$1,jn$1=["semiMajorAxis","semiMinorAxis","height","heightReference","extrudedHeight","show","fill","material","outline","outlineColor","outlineWidth","numberOfVerticalLines","rotation","stRotation","granularity","shadows","distanceDisplayCondition","zIndex","classificationType","extrudedHeightReference"],Hn$1={onDefinitionChange:"definitionChanged"},zn$1=l({name:"EllipseGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.EllipseGraphics(n);return t.entity.ellipse=o,o},destroy(t,n){n.entity&&(n.entity.ellipse=void 0)},cesiumProps:jn$1,cesiumEventProps:Hn$1}),As$1=zn$1,xn$1=["heightReference","radii","show","fill","innerRadii","material","maximumClock","maximumCone","minimumClock","minimumCone","outline","outlineColor","outlineWidth","subdivisions","stackPartitions","slicePartitions","shadows","distanceDisplayCondition"],Nn$1={onDefinitionChange:"definitionChanged"},qn$1=l({name:"EllipsoidGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.EllipsoidGraphics(n);return t.entity.ellipsoid=o,o},destroy(t,n){n.entity&&(n.entity.ellipsoid=void 0)},cesiumProps:xn$1,cesiumEventProps:Nn$1}),Fs$1=qn$1,Yn$1=["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","viewFrom","wall"],Kn$1=["id"],Jn$1={onDefinitionChange:"definitionChanged"},Zn$1=["selected","tracked"],Xn$1=l({name:"Entity",create(t,n){if(!t.entityCollection)return;const o=new Cesium$1.Entity(n);return t.viewer&&n.selected&&(t.viewer.selectedEntity=o),t.viewer&&n.tracked&&(t.viewer.trackedEntity=o),t.entityCollection.add(o),o},destroy(t,n){n.entityCollection&&n.entityCollection.remove(t)},update(t,n,o,s){s.viewer&&(n.selected!==o.selected&&(n.selected?s.viewer.selectedEntity=t:s.viewer.selectedEntity===t&&(s.viewer.selectedEntity=void 0)),n.tracked!==o.tracked&&(n.tracked?s.viewer.trackedEntity=t:s.viewer.trackedEntity===t&&(s.viewer.trackedEntity=void 0)))},provide(t,n,o){return{entity:t,__$internal:{onUpdate:o==null?void 0:o.onUpdate}}},cesiumProps:Yn$1,cesiumReadonlyProps:Kn$1,cesiumEventProps:Jn$1,otherProps:Zn$1,useCommonEvent:!0}),Is$1=Xn$1,eo$1=["density","enabled","minimumBrightness","screenSpaceErrorFactor","renderable"],io$1=l({name:"Fog",create(t){if(!t.scene)return;const n=new Cesium$1.Fog;return t.scene.fog=n,n},destroy(t,n){n.scene&&!n.scene.isDestroyed()&&(n.scene.fog=new Cesium$1.Fog)},cesiumProps:eo$1,setCesiumPropsAfterCreate:!0}),Vs=io$1,to$1=["clustering","name","show"],no=["clampToGround","sourceUri","credit","markerSize","markerSymbol","markerColor","stroke","strokeWidth","fill","describe"],oo$1={onChange:"changedEvent",onError:"errorEvent",onLoading:"loadingEvent"},ro$1=["onLoad","data"],ci$1=(t,{data:n,onLoad:o,...s})=>{n&&t.load(n,s).then(c=>{o&&o(c)})},so$1=l({name:"GeoJsonDataSource",create(t,n){if(!t.dataSourceCollection)return;const o=new Cesium$1.GeoJsonDataSource(n.name);return n.clustering&&(o.clustering=n.clustering),typeof n.show=="boolean"&&(o.show=n.show),t.dataSourceCollection.add(o),n.data&&ci$1(o,n),o},update(t,n,o){n.data?o.show!==n.show&&(t.show=typeof n.show=="boolean"?n.show:!0):t.show=!1,n.data&&(o.data!==n.data||o.clampToGround!==n.clampToGround||o.sourceUri!==n.sourceUri||o.credit!==n.credit||o.markerSize!==n.markerSize||o.markerSymbol!==n.markerSymbol||o.markerColor!==n.markerColor||o.stroke!==n.stroke||o.strokeWidth!==n.strokeWidth||o.fill!==n.fill)&&ci$1(t,n)},destroy(t,n){n.dataSourceCollection&&!n.dataSourceCollection.isDestroyed()&&n.dataSourceCollection.remove(t)},provide(t){return{dataSource:t}},cesiumProps:to$1,cesiumReadonlyProps:no,cesiumEventProps:oo$1,otherProps:ro$1,useCommonEvent:!0}),Us$1=so$1,ao$1={onImageryLayersUpdate:"imageryLayersUpdatedEvent",onTerrainProviderChange:"terrainProviderChanged",onTileLoadProgress:"tileLoadProgressEvent"},co$1=["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"],lo$1=["terrainProvider"],uo$1=l({name:"Globe",create:t=>{var n;return(n=t.scene)==null?void 0:n.globe},update:async(t,n)=>{const o=n.terrainProvider;let s;J(o)?s=await o:s=o,t.terrainProvider=s},cesiumProps:co$1,cesiumEventProps:ao$1,otherProps:lo$1,setCesiumPropsAfterCreate:!0}),js$4=uo$1,mo$1=["appearance","classificationType","debugShowBoundingVolume","debugShowShadowVolume","show"],fo$1=["allowPicking","asynchronous","geometryInstances","interleave","releaseGeometryInstances"],ho$2=["onReady"];l({name:"GroundPolylinePrimitive",create(t,n){var o;if(!t.primitiveCollection)return;const s=new Cesium$1.GroundPolylinePrimitive(n);if(n.onReady){const c=()=>{var d,h;s.ready&&((d=n.onReady)==null||d.call(n,s),(h=t.scene)==null||h.postRender.removeEventListener(c))};(o=t.scene)==null||o.postRender.addEventListener(c)}return t.primitiveCollection.add(s),s},destroy(t,n){n.primitiveCollection&&!n.primitiveCollection.isDestroyed()&&n.primitiveCollection.remove(t),t.isDestroyed()||t.destroy()},cesiumProps:mo$1,cesiumReadonlyProps:fo$1,otherProps:ho$2,useCommonEvent:!0});const po$1=["appearance","classificationType","debugShowBoundingVolume","debugShowShadowVolume","show"],vo$2=["allowPicking","asynchronous","compressVertices","geometryInstances","interleave","releaseGeometryInstances","vertexCacheOptimize"],go$1=["onReady"];l({name:"GroundPrimitive",create(t,n){var o;if(!t.primitiveCollection)return;const s=new Cesium$1.GroundPrimitive(n);if(n.onReady){const c=()=>{var d,h;s.ready&&((d=n.onReady)==null||d.call(n,s),(h=t.scene)==null||h.postRender.removeEventListener(c))};(o=t.scene)==null||o.postRender.addEventListener(c)}return t.primitiveCollection.add(s),s},destroy(t,n){n.primitiveCollection&&!n.primitiveCollection.isDestroyed()&&n.primitiveCollection.remove(t),t.isDestroyed()||t.destroy()},cesiumProps:po$1,cesiumReadonlyProps:vo$2,otherProps:go$1,useCommonEvent:!0});const Po$1=["show","destroyPrimitives","primitiveAdded","primitiveRemoved"];l({name:"GroundPrimitiveCollection",create:t=>{var n;return(n=t.scene)==null?void 0:n.groundPrimitives},provide:t=>({primitiveCollection:t}),cesiumProps:Po$1,setCesiumPropsAfterCreate:!0});const Eo$1=["alpha","brightness","contrast","hue","saturation","gamma","splitDirection","minificationFilter","magnificationFilter","cutoutRectangle","show","nightAlpha","dayAlpha","colorToAlpha","colorToAlphaThreshold","index"],bo$1=["rectangle","maximumAnisotropy","minimumTerrainLevel","maximumTerrainLevel","readyEvent","imageryProvider"],wo$1=l({name:"ImageryLayer",async create(t,n){var o,s,c,d;if(!t.imageryLayerCollection)return;const h=J(n.imageryProvider)?n.imageryProvider:new Promise(P=>queueMicrotask(()=>P(n.imageryProvider))),p=(s=(o=t.__$internal)==null?void 0:o.imageryLayerWaitingList)==null?void 0:s.slice();(c=t.__$internal)!=null&&c.imageryLayerWaitingList&&t.__$internal.imageryLayerWaitingList.push(h),p&&await Promise.all(p.filter(P=>J(P)));const y=await h;if((d=t.__$internal)!=null&&d.imageryLayerWaitingList&&(t.__$internal.imageryLayerWaitingList=t.__$internal.imageryLayerWaitingList.filter(P=>P!==h)),!y)return;const S=new Cesium$1.ImageryLayer(y,n);return t.imageryLayerCollection.add(S,n.index),S},destroy(t,n){n.imageryLayerCollection&&n.imageryLayerCollection.remove(t)},cesiumProps:Eo$1,cesiumReadonlyProps:bo$1}),Ns$1=wo$1,Do$1={onLayerAdd:"layerAdded",onLayerMove:"layerMoved",onLayerRemove:"layerRemoved",onLayerShowOrHide:"layerShownOrHidden"};l({name:"ImageryLayerCollection",create:t=>{var n;return(n=t.globe)==null?void 0:n.imageryLayers},cesiumEventProps:Do$1});const $o$1=["clustering","name","show"],To$1=["canvas","camera","ellipsoid","clampToGround","sourceUri","credit","screenOverlayContainer"],Mo$1={onChange:"changedEvent",onError:"errorEvent",onLoading:"loadingEvent",onRefresh:"refreshEvent",onUnsupportedNode:"unsupportedNodeEvent"},ko$1=["onLoad","data"],li$1=(t,{data:n,onLoad:o,...s})=>{n&&t.load(n,s).then(c=>{o&&o(c)})},Lo$1=l({name:"KmlDataSource",create(t,n){if(!t.scene||!t.dataSourceCollection||!t.scene)return;const o=new Cesium$1.KmlDataSource({camera:n.camera||t.scene.camera,canvas:n.canvas||t.scene.canvas,ellipsoid:n.ellipsoid,credit:n.credit});return n.clustering&&(o.clustering=n.clustering),typeof n.show=="boolean"&&(o.show=n.show),typeof n.name<"u"&&(o.name=n.name),t.dataSourceCollection.add(o),n.data&&li$1(o,n),o},update(t,n,o){n.data?o.show!==n.show&&(t.show=typeof n.show=="boolean"?n.show:!0):t.show=!1,n.data&&(o.data!==n.data||o.clampToGround!==n.clampToGround||o.ellipsoid!==n.ellipsoid||o.sourceUri!==n.sourceUri||o.credit!==n.credit)&&li$1(t,n)},destroy(t,n){n.dataSourceCollection&&!n.dataSourceCollection.isDestroyed()&&n.dataSourceCollection.remove(t)},provide(t){return{dataSource:t}},cesiumProps:$o$1,cesiumReadonlyProps:To$1,cesiumEventProps:Mo$1,otherProps:ko$1,useCommonEvent:!0}),Ys$1=Lo$1,_o$1=["backgroundColor","backgroundPadding","disableDepthTestDistance","distanceDisplayCondition","eyeOffset","fillColor","font","heightReference","horizontalOrigin","id","outlineColor","outlineWidth","pixelOffset","pixelOffsetScaleByDistance","position","scale","scaleByDistance","show","showBackground","style","text","translucencyByDistance","verticalOrigin"];l({name:"Label",create:(t,n)=>{var o;return(o=t.labelCollection)==null?void 0:o.add(n)},destroy(t,n){n.labelCollection&&!n.labelCollection.isDestroyed()&&n.labelCollection.remove(t)},cesiumProps:_o$1,useCommonEvent:!0});const Go$1=["blendOption","debugShowBoundingVolume","modelMatrix","show"];l({name:"LabelCollection",create(t,n){if(!t.scene||!t.primitiveCollection)return;const o=new Cesium$1.LabelCollection({scene:t.scene,modelMatrix:n.modelMatrix,blendOption:n.blendOption,debugShowBoundingVolume:n.debugShowBoundingVolume});return t.primitiveCollection.add(o),o},destroy(t,n){n.primitiveCollection&&!n.primitiveCollection.isDestroyed()&&n.primitiveCollection.remove(t),t.isDestroyed()||t.destroy()},provide(t){return{labelCollection:t}},cesiumProps:Go$1});const Ao$1=["text","font","style","fillColor","outlineColor","outlineWidth","show","showBackground","backgroundColor","backgroundPadding","scale","horizontalOrigin","verticalOrigin","eyeOffset","pixelOffset","translucencyByDistance","pixelOffsetScaleByDistance","scaleByDistance","heightReference","distanceDisplayCondition","disableDepthTestDistance"],Fo$1={onDefinitionChange:"definitionChanged"},Io$1=l({name:"LabelGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.LabelGraphics(n);return t.entity.label=o,o},destroy(t,n){n.entity&&(n.entity.label=void 0)},cesiumProps:Ao$1,cesiumEventProps:Fo$1}),Zs=Io$1,Wo$1=["backFaceCulling","clampAnimations","clippingPlanes","color","colorBlendAmount","colorBlendMode","customShader","debugShowBoundingVolume","debugWireframe","distanceDisplayCondition","featureIdLabel","heightReference","id","imageBasedLighting","instanceFeatureIdLabel","lightColor","maximumScale","minimumPixelSize","modelMatrix","outlineColor","scale","shadows","show","showCreditsOnScreen","showOutline","silhouetteColor","silhouetteSize","splitDirection","style"],Vo$1=["allowPicking","asynchronous","basePath","credit","enableDebugWireframe","gltf","heightReference","incrementallyLoadTextures","scene","releaseGltfJson","cull","opaquePass","upAxis","forwardAxis","content","scene","enableShowOutline","projectTo2D","classificationType","errorEvent","readyEvent","texturesReadyEvent","gltfCallback","enablePick"],Uo$1=["onReady","onError","url"];l({name:"Model",async create(t,{scene:n,url:o,colorBlendMode:s,...c}){var d;if(!t.scene||!t.primitiveCollection||!o)return;const h=o;let p;J(h)?p=await h:p=h;let y;try{y=await Cesium$1.Model.fromGltfAsync({...c,url:p,colorBlendMode:s,scene:n||t.scene})}catch(S){(d=c.onError)==null||d.call(c,S);return}return t.primitiveCollection.add(y),y},destroy(t,n){n.primitiveCollection&&!n.primitiveCollection.isDestroyed()&&n.primitiveCollection.remove(t),t.isDestroyed()||t.destroy()},cesiumEventProps:{onReady:"readyEvent"},cesiumProps:Wo$1,cesiumReadonlyProps:Vo$1,otherProps:Uo$1,useCommonEvent:!0});const Ho$1=["uri","show","scale","minimumPixelSize","maximumScale","incrementallyLoadTextures","runAnimations","clampAnimations","nodeTransformations","shadows","heightReference","distanceDisplayCondition","silhouetteColor","silhouetteSize","color","colorBlendMode","colorBlendAmount","clippingPlanes","imageBasedLightingFactor","lightColor","articulations","customShader"],zo$1={onDefinitionChange:"definitionChanged"},xo$1=l({name:"ModelGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.ModelGraphics(n);return t.entity.model=o,o},destroy(t,n){n.entity&&(n.entity.model=void 0)},cesiumProps:Ho$1,cesiumEventProps:zo$1}),Qs$1=xo$1,No$1=["onlySunLighting","show","textureUrl"],qo$1=["ellipsoid"],Yo$1=l({name:"Moon",create(t,n){if(!t.scene)return;const o=new Cesium$1.Moon(n);return t.scene.moon=o,o},destroy(t,n){n.scene&&!n.scene.isDestroyed()&&(n.scene.moon=new Cesium$1.Moon)},cesiumProps:No$1,cesiumReadonlyProps:qo$1}),ea=Yo$1,Ko$1=["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"],Jo$1={onComplete:"complete",onUpdate:"updateCallback"};l({name:"ParticleSystem",create(t,n){if(!t.primitiveCollection)return;const o=new Cesium$1.ParticleSystem({...n,updateCallback:n.onUpdate});return t.primitiveCollection.add(o),o},update(t,n,o){n.onUpdate!==o.onUpdate&&(t.updateCallback=n.onUpdate)},destroy(t,n){n.primitiveCollection&&!n.primitiveCollection.isDestroyed()&&n.primitiveCollection.remove(t)},cesiumProps:Ko$1,cesiumEventProps:Jo$1});const Xo$1=["leadTime","trailTime","show","width","material","resolution","distanceDisplayCondition"],Qo$1={onDefinitionChange:"definitionChanged"};l({name:"PathGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.PathGraphics(n);return t.entity.path=o,o},destroy(t,n){n.entity&&(n.entity.path=void 0)},cesiumProps:Xo$1,cesiumEventProps:Qo$1});const ir$1=["plane","dimensions","show","fill","material","outline","outlineColor","outlineWidth","shadows","distanceDisplayCondition"],tr$1={onDefinitionChange:"definitionChanged"},nr$1=l({name:"PlaneGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.PlaneGraphics(n);return t.entity.plane=o,o},destroy(t,n){n.entity&&(n.entity.plane=void 0)},cesiumProps:ir$1,cesiumEventProps:tr$1}),na$1=nr$1,or$1=["color","pixelSize","outlineColor","outlineWidth","show","scaleByDistance","translucencyByDistance","heightReference","distanceDisplayCondition","disableDepthTestDistance"],rr$1={onDefinitionChange:"definitionChanged"},sr$1=l({name:"PointGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.PointGraphics(n);return t.entity.point=o,o},destroy(t,n){n.entity&&(n.entity.point=void 0)},cesiumProps:or$1,cesiumEventProps:rr$1}),oa$1=sr$1,ar$1=["color","disableDepthTestDistance","distanceDisplayCondition","id","outlineColor","outlineWidth","pixelSize","position","scaleByDistance","show","translucencyByDistance"];l({name:"PointPrimitive",create:(t,n)=>{var o;return(o=t.pointPrimitiveCollection)==null?void 0:o.add(n)},destroy(t,n){n.pointPrimitiveCollection&&!n.pointPrimitiveCollection.isDestroyed()&&n.pointPrimitiveCollection.remove(t)},cesiumProps:ar$1,useCommonEvent:!0});const lr$1=["blendOption","debugShowBoundingVolume","modelMatrix","show"];l({name:"PointPrimitveCollection",create(t,n){if(!t.primitiveCollection)return;const o=new Cesium$1.PointPrimitiveCollection(n);return t.primitiveCollection.add(o),o},destroy(t,n){n.primitiveCollection&&!n.primitiveCollection.isDestroyed()&&n.primitiveCollection.remove(t),t.isDestroyed()||t.destroy()},provide(t){return{pointPrimitiveCollection:t}},cesiumProps:lr$1});const dr$1=["arcType","hierarchy","height","heightReference","extrudedHeight","extrudedHeightReference","show","fill","material","outline","outlineColor","outlineWidth","stRotation","granularity","perPositionHeight","closeTop","closeBottom","shadows","distanceDisplayCondition","zIndex","classificationType","textureCoordinates"],mr$1={onDefinitionChange:"definitionChanged"},fr$1=l({name:"PolygonGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.PolygonGraphics(n);return t.entity.polygon=o,o},destroy(t,n){n.entity&&(n.entity.polygon=void 0)},cesiumProps:dr$1,cesiumEventProps:mr$1}),aa$1=fr$1,hr$1=["distanceDisplayCondition","id","loop","material","positions","show","width"];l({name:"Polyline",create:(t,n)=>{var o;return(o=t.polylineCollection)==null?void 0:o.add(n)},destroy(t,n){n.polylineCollection&&!n.polylineCollection.isDestroyed()&&n.polylineCollection.remove(t)},cesiumProps:hr$1,useCommonEvent:!0});const pr$1=["debugShowBoundingVolume","length","modelMatrix","show"];l({name:"PolylineCollection",create(t,n){if(!t.primitiveCollection)return;const o=new Cesium$1.PolylineCollection({modelMatrix:n.modelMatrix,debugShowBoundingVolume:n.debugShowBoundingVolume,length:n.length,scene:t.scene});return t.primitiveCollection.add(o),o},destroy(t,n){n.primitiveCollection&&!n.primitiveCollection.isDestroyed()&&n.primitiveCollection.remove(t),t.isDestroyed()||t.destroy()},provide(t){return{polylineCollection:t}},cesiumProps:pr$1});const gr$1=["arcType","classificationType","positions","clampToGround","width","show","material","depthFailMaterial","granularity","shadows","distanceDisplayCondition","zIndex"],Cr$1={onDefinitionChange:"definitionChanged"},Pr$1=l({name:"PolylineGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.PolylineGraphics(n);return t.entity.polyline=o,o},destroy(t,n){n.entity&&(n.entity.polyline=void 0)},cesiumProps:gr$1,cesiumEventProps:Cr$1}),ua$1=Pr$1,Sr$1=["positions","shape","cornerType","show","fill","material","outline","outlineColor","outlineWidth","granularity","shadows","distanceDisplayCondition"],Er$1={onDefinitionChange:"definitionChanged"};l({name:"PolylineVolumeGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.PolylineVolumeGraphics(n);return t.entity.polylineVolume=o,o},destroy(t,n){n.entity&&(n.entity.polylineVolume=void 0)},cesiumProps:Sr$1,cesiumEventProps:Er$1});const wr$1=["enabled","selected"],Dr$1=["clearColor","forcePowerOfTwo","fragmentShader","name","pixelDatatype","pixelFormat","sampleMode","scissorRectangle","textureScale","uniforms"];l({name:"PostProcessStage",create(t,n){if(!t.scene)return;const o=new Cesium$1.PostProcessStage(n);return typeof n.enabled=="boolean"&&(o.enabled=n.enabled),n.selected&&(o.selected=n.selected),t.scene.postProcessStages.add(o),o},destroy(t,n){n.scene&&!n.scene.isDestroyed()&&n.scene.postProcessStages.remove(t),t.isDestroyed()||t.destroy()},cesiumProps:wr$1,cesiumReadonlyProps:Dr$1}),U$1({name:"BlackAndWhiteStage",props:["gradations"],create:()=>Cesium$1.PostProcessStageLibrary.createBlackAndWhiteStage()}),U$1({name:"BrightnessStage",props:["brightness"],create:()=>Cesium$1.PostProcessStageLibrary.createBrightnessStage()}),U$1({name:"LensFlareStage",props:["dirtTexture","starTexture","intensity","distortion","ghostDispersal","haloWidth","earthRadius"],create:()=>Cesium$1.PostProcessStageLibrary.createLensFlareStage()}),U$1({name:"Fxaa",create:(t,n)=>n.fxaa,props:[]}),U$1({name:"NightVisionStage",props:[],create:()=>Cesium$1.PostProcessStageLibrary.createNightVisionStage()});const Rr$1=["enabled","selected"],$r$1=["inputPreviousStageTexture","name","stages","uniforms"];l({name:"PostProcessStageComposite",create(t,n){if(!t.scene)return;const o=new Cesium$1.PostProcessStageComposite(n);return typeof n.enabled=="boolean"&&(o.enabled=n.enabled),n.selected&&(o.selected=n.selected),t.scene.postProcessStages.add(o),o},destroy(t,n){n.scene&&!n.scene.isDestroyed()&&n.scene.postProcessStages.remove(t),t.isDestroyed()||t.destroy()},cesiumProps:Rr$1,cesiumReadonlyProps:$r$1}),U$1({name:"AmbientOcclusion",create:(t,n)=>n.ambientOcclusion,props:["ambientOcclusionOnly","bias","delta","frustumLength","intensity","lengthCap","sigma","stepSize"],noMount:!0}),U$1({name:"Bloom",create:(t,n)=>n.bloom,props:["brightness","contrast","delta","glowOnly","sigma","stepSize"],noMount:!0}),U$1({name:"BlurStage",props:["delta","sigma","stepSize"],create:()=>Cesium$1.PostProcessStageLibrary.createBlurStage()}),U$1({name:"DepthOfFieldStage",props:["delta","focalDistance","sigma","stepSize"],create:()=>Cesium$1.PostProcessStageLibrary.createDepthOfFieldStage()}),U$1({name:"EdgeDetectionStage",props:["color","length"],create:()=>Cesium$1.PostProcessStageLibrary.createEdgeDetectionStage()}),U$1({name:"SilhouetteStage",props:["color","length"],create:()=>Cesium$1.PostProcessStageLibrary.createSilhouetteStage()});const Tr$1=["appearance","cull","debugShowBoundingVolume","depthFailAppearance","modelMatrix","shadows","show"],Mr$1=["allowPicking","asynchronous","compressVertices","geometryInstances","interleave","releaseGeometryInstances","vertexCacheOptimize"],kr$1=["onReady"],Lr$1=l({name:"Primitive",create(t,n){var o;if(!t.primitiveCollection)return;const s=new Cesium$1.Primitive(n);if(n.onReady){const c=()=>{var d,h;s.ready&&((d=n.onReady)==null||d.call(n,s),(h=t.scene)==null||h.postRender.removeEventListener(c))};(o=t.scene)==null||o.postRender.addEventListener(c)}return t.primitiveCollection.add(s),s},destroy(t,n){n.primitiveCollection&&!n.primitiveCollection.isDestroyed()&&n.primitiveCollection.remove(t),t.isDestroyed()||t.destroy()},cesiumProps:Tr$1,cesiumReadonlyProps:Mr$1,otherProps:kr$1,useCommonEvent:!0}),Da$1=Lr$1,_r$1=["classificationType","coordinates","height","heightReference","extrudedHeight","extrudedHeightReference","show","fill","material","outline","outlineColor","outlineWidth","rotation","stRotation","granularity","shadows","distanceDisplayCondition","zIndex"],Or$1={onDefinitionChange:"definitionChanged"};l({name:"RectangleGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.RectangleGraphics(n);return t.entity.rectangle=o,o},destroy(t,n){n.entity&&(n.entity.rectangle=void 0)},cesiumProps:_r$1,cesiumEventProps:Or$1});const Br$1=["backgroundColor","completeMorphOnUserInput","debugCommandFilter","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","postProcessStages","msaaSamples","splitPosition","debugCommandFilter","verticalExaggeration","verticalExaggerationRelativeHeight","atmosphere"],Ar$1={onMorphComplete:"morphComplete",onMorphStart:"morphStart",onPostRender:"postRender",onPreRender:"preRender",onPreUpdate:"preUpdate",onPostUpdate:"postUpdate",onRenderError:"renderError",onTerrainProviderChange:"terrainProviderChanged"},Fr$1=["mode","morphDuration"],ui=(t,n,o)=>{switch(n){case Cesium$1.SceneMode.SCENE2D:t.morphTo2D(o);break;case Cesium$1.SceneMode.COLUMBUS_VIEW:t.morphToColumbusView(o);break;case Cesium$1.SceneMode.SCENE3D:t.morphTo3D(o);break}},Ir$1=l({name:"Scene",create(t,n){return t.scene&&n.mode&&ui(t.scene,n.mode,n.morphDuration),t.scene},update(t,n,o){n.mode!==o.mode&&n.mode&&ui(t,n.mode,n.morphDuration)},cesiumProps:Br$1,cesiumEventProps:Ar$1,otherProps:Fr$1,setCesiumPropsAfterCreate:!0}),$a$1=Ir$1,Wr$1=["bounceAnimationTime","enableCollisionDetection","enableInputs","enableLook","enableRotate","enableTilt","enableTranslate","enableZoom","inertiaSpin","inertiaTranslate","inertiaZoom","lookEventTypes","maximumMovementRatio","maximumZoomDistance","minimumCollisionTerrainHeight","minimumPickingTerrainHeight","minimumTrackBallHeight","minimumZoomDistance","rotateEventTypes","tiltEventTypes","translateEventTypes","zoomEventTypes","minimumPickingTerrainDistanceWithInertia"],Vr$1=l({name:"ScreenSpaceCameraController",create:t=>{var n;return(n=t.scene)==null?void 0:n.screenSpaceCameraController},cesiumProps:Wr$1,setCesiumPropsAfterCreate:!0}),Ta$1=Vr$1,Ur$1=({action:t,modifier:n,type:o})=>{const s=$e$1();return React.useEffect(()=>{if(!(!s.screenSpaceEventHandler||s.screenSpaceEventHandler.isDestroyed())){if(t)return s.screenSpaceEventHandler.setInputAction(t,o,n),()=>{!s.screenSpaceEventHandler||s.screenSpaceEventHandler.isDestroyed()||s.screenSpaceEventHandler.removeInputAction(o,n)};s.screenSpaceEventHandler.removeInputAction(o,n)}},[t,s.screenSpaceEventHandler,n,o]),null},Ma$1=Ur$1,jr$1=l({name:"ScreenSpaceEventHandler",create(t,n){var o;return n.useDefault?(o=t.cesiumWidget)==null?void 0:o.screenSpaceEventHandler:t.scene?new Cesium$1.ScreenSpaceEventHandler(t.scene.canvas):void 0},destroy(t){t.isDestroyed()||t.destroy()},provide(t){return{screenSpaceEventHandler:t}}}),ka$1=jr$1,Hr$1=["darkness","fadingEnabled","maximumDistance","enabled","normalOffset","softShadows","size"];l({name:"ShadowMap",create:t=>{var n;return(n=t.scene)==null?void 0:n.shadowMap},cesiumProps:Hr$1});const xr$1=["brightnessShift","hueShift","saturationShift","show","perFragmentAtmosphere","atmosphereLightIntensity","atmosphereRayleighCoefficient","atmosphereMieCoefficient","atmosphereRayleighScaleHeight","atmosphereMieScaleHeight","atmosphereMieAnisotropy"],Nr$1=l({name:"SkyAtmosphere",create:t=>{var n;return(n=t.scene)==null?void 0:n.skyAtmosphere},cesiumProps:xr$1,setCesiumPropsAfterCreate:!0}),_a$2=Nr$1,qr$1=["sources","show"],Yr$1=l({name:"SkyBox",create:t=>{var n;return(n=t.scene)==null?void 0:n.skyBox},cesiumProps:qr$1,setCesiumPropsAfterCreate:!0}),Oa$1=Yr$1,Kr$1=["glowFactor","show"],Jr$1=l({name:"Sun",create(t){if(!t.scene)return;const n=new Cesium$1.Sun;return t.scene.sun=n,n},destroy(t,n){n.scene&&!n.scene.isDestroyed()&&(n.scene.sun=new Cesium$1.Sun)},cesiumProps:Kr$1,setCesiumPropsAfterCreate:!0}),Ga$1=Jr$1,Zr$1=["clippingPlanes","maximumMemoryUsage","modelMatrix","shadows","show","style","intervals"],Xr$1=["clock","shading"],Qr$1=["onReady"],es$1={onFrameChange:"frameChanged"};l({name:"TimeDynamicPointCloud",create(t,n){var o;if(!t.cesiumWidget||!t.primitiveCollection||!((o=t.cesiumWidget)!=null&&o.clock))return;const s=new Cesium$1.TimeDynamicPointCloud({...n,clock:n.clock??t.cesiumWidget.clock});if(n.onReady){const c=()=>{var d;(d=n.onReady)==null||d.call(n,s),s.frameChanged.removeEventListener(c)};s.frameChanged.addEventListener(c)}return t.primitiveCollection.add(s),s},destroy(t,n){n.primitiveCollection&&!n.primitiveCollection.isDestroyed()&&n.primitiveCollection.remove(t),t.isDestroyed()||t.destroy()},cesiumProps:Zr$1,cesiumReadonlyProps:Xr$1,cesiumEventProps:es$1,otherProps:Qr$1,useCommonEvent:!0});const ts$1=["terrainShadows","clockTrackedDataSource","targetFrameRate","useDefaultRenderLoop","resolutionScale","allowDataSourcesToSuspendAnimation","trackedEntity","selectedEntity","shadows","useBrowserRecommendedResolution","creditDisplay"],ns$1=["baseLayer","animation","baseLayerPicker","fullscreenButton","vrButton","geocoder","homeButton","infoBox","sceneModePicker","selectionIndicator","timeline","navigationHelpButton","navigationInstructionsInitiallyVisible","scene3DOnly","shouldAnimate","clockViewModel","selectedImageryProviderViewModel","imageryProviderViewModels","selectedTerrainProviderViewModel","terrainProviderViewModels","skyBox","skyAtmosphere","fullscreenElement","showRenderLoopErrors","automaticallyTrackDataSourceClocks","contextOptions","sceneMode","mapProjection","globe","orderIndependentTranslucency","creditContainer","creditViewport","dataSources","mapMode2D","projectionPicker","requestRenderMode","maximumRenderTimeChange","depthPlaneEllipsoidOffset","msaaSamples","blurActiveElementOnCanvasFocus","terrain"],os$1={onSelectedEntityChange:"selectedEntityChanged",onTrackedEntityChange:"trackedEntityChanged"},rs$1=["className","id","style","full","containerProps","extend","terrainProvider"],ss$1=l({name:"Viewer",async create(t,{baseLayer:n,terrainProvider:o,...s},c){if(!c)return;let d;J(o)?d=await o:d=o;const h=new Cesium$1.Viewer(c,{...s,terrainProvider:d,baseLayer:n===!1?void 0:n});if(!h)return;n===!1&&h.imageryLayers.removeAll(),h&&s.extend&&(Array.isArray(s.extend)?s.extend.forEach(y=>{h.extend(y,{})}):h.extend(s.extend,{}));const p=new De$1(h.scene);return[h,p]},destroy(t,n,o,s){s&&!s.isDestroyed()&&s.destroy(),t.isDestroyed()||t.destroy()},provide(t,n,o,s){return{viewer:t,cesiumWidget:t.cesiumWidget,dataSourceCollection:t.dataSources,entityCollection:t.entities,scene:t.scene,camera:t.scene.camera,imageryLayerCollection:t.scene.globe.imageryLayers,primitiveCollection:t.scene.primitives,globe:t.scene.globe,__$internal:{onUpdate:o==null?void 0:o.onUpdate,imageryLayerWaitingList:[]},[ce$1]:s}},containerProps:({id:t,className:n,style:o,full:s,containerProps:c})=>({className:n,id:t,style:{...s?{position:"absolute",bottom:"0",left:"0",right:"0",top:"0"}:{},...o},...c}),cesiumProps:ts$1,cesiumReadonlyProps:ns$1,cesiumEventProps:os$1,otherProps:rs$1,renderContainer:!0,useCommonEvent:!0,useRootEvent:!0}),Aa$1=ss$1,as$1=["positions","maximumHeights","minimumHeights","show","fill","material","outline","outlineColor","outlineWidth","granularity","shadows","distanceDisplayCondition"],cs$1={onDefinitionChange:"definitionChanged"};l({name:"WallGraphics",create(t,n){if(!t.entity)return;const o=new Cesium$1.WallGraphics(n);return t.entity.wall=o,o},destroy(t,n){n.entity&&(n.entity.wall=void 0)},cesiumProps:as$1,cesiumEventProps:cs$1});const SpatialIdSpace=React.memo(({space:t})=>{const n=React.useMemo(()=>({rectangle:{coordinates:Cesium$1.Rectangle.fromDegrees(...t.wsen),height:t.height,heightReference:Cesium$1.HeightReference.NONE,extrudedHeight:t.extrudedHeight,clampToGround:!1,fill:!0,outline:!0,outlineColor:Cesium$1.Color.fromCssColorString(t.outlineColor??""),material:Cesium$1.Color.fromCssColorString(t.color??""),classificationType:Cesium$1.ClassificationType.TERRAIN}}),[t]);return jsxRuntimeExports.jsx(Is$1,{id:t.id,...n})});SpatialIdSpace.displayName="SpatialIdSpace";const CoordinateIndicator=React.memo(({wsen:t,color:n})=>{const o=React.useMemo(()=>({rectangle:{coordinates:Cesium$1.Rectangle.fromDegrees(...t),clampToGround:!0,fill:!0,outline:!1,material:Cesium$1.Color.fromCssColorString(n),classificationType:Cesium$1.ClassificationType.BOTH}}),[t,n]);return jsxRuntimeExports.jsx(Is$1,{...o})});CoordinateIndicator.displayName="SpatialIdSpace";const VerticalSpaceIndicator=React.memo(({indicator:t})=>{const n=React.useMemo(()=>({rectangle:{coordinates:Cesium$1.Rectangle.fromDegrees(...t.wsen),height:t.height,extrudedHeight:t.extrudedHeight,clampToGround:!1,fill:!0,outline:!0,outlineColor:Cesium$1.Color.fromCssColorString(t.outlineColor),material:Cesium$1.Color.fromCssColorString(t.color),classificationType:Cesium$1.ClassificationType.TERRAIN}}),[t]);return jsxRuntimeExports.jsx(Is$1,{...n})});VerticalSpaceIndicator.displayName="VerticalSpaceIndicator";const SPATIALID_DEFAULT_OPTIONS={zoom:20,maxHeight:4e3,minHeight:-1e3,dataOnly:!1,rightClickToExit:!0,color:"#00bebe44",outlineColor:"#00bebe55",groundIndicatorColor:"#00000066",selectorColor:"#ff990099",selectorOutlineColor:"#ff9900aa",verticalSpaceIndicatorColor:"#ffffff33",verticalSpaceIndicatorOutlineColor:"#ffffff55"},SPATIALID_LATITUDE_RANGE={min:-85.0511,max:85.0511};function isZFXYTile(t){return"z"in t&&"f"in t&&"x"in t&&"y"in t}const ZFXY_1M_ZOOM_BASE=25,ZFXY_ROOT_TILE={f:0,x:0,y:0,z:0},rad2deg=180/Math.PI;function getParent(t,n=1){const{f:o,x:s,y:c,z:d}=t;if(n<=0)throw new Error("steps must be greater than 0");if(n>d)throw new Error(`Getting parent tile of ${t}, ${n} steps is not possible because it would go beyond the root tile (z=0)`);return{f:o>>n,x:s>>n,y:c>>n,z:d-n}}function getChildren(t=ZFXY_ROOT_TILE){const{f:n,x:o,y:s,z:c}=t;return[{f:n*2,x:o*2,y:s*2,z:c+1},{f:n*2,x:o*2+1,y:s*2,z:c+1},{f:n*2,x:o*2,y:s*2+1,z:c+1},{f:n*2,x:o*2+1,y:s*2+1,z:c+1},{f:n*2+1,x:o*2,y:s*2,z:c+1},{f:n*2+1,x:o*2+1,y:s*2,z:c+1},{f:n*2+1,x:o*2,y:s*2+1,z:c+1},{f:n*2+1,x:o*2+1,y:s*2+1,z:c+1}]}function getSurrounding(t=ZFXY_ROOT_TILE){const{f:n,x:o,y:s,z:c}=t;return[zfxyWraparound({f:n,x:o,y:s,z:c}),zfxyWraparound({f:n,x:o+1,y:s,z:c}),zfxyWraparound({f:n,x:o,y:s+1,z:c}),zfxyWraparound({f:n,x:o+1,y:s+1,z:c}),zfxyWraparound({f:n,x:o-1,y:s,z:c}),zfxyWraparound({f:n,x:o,y:s-1,z:c}),zfxyWraparound({f:n,x:o-1,y:s-1,z:c}),zfxyWraparound({f:n,x:o+1,y:s-1,z:c}),zfxyWraparound({f:n,x:o-1,y:s+1,z:c})]}function parseZFXYString(t){const n=t.match(/^\/?(\d+)\/(?:(\d+)\/)?(\d+)\/(\d+)$/);if(n)return{z:parseInt(n[1],10),f:parseInt(n[2]||"0",10),x:parseInt(n[3],10),y:parseInt(n[4],10)}}function getLngLat(t){const n=Math.PI-2*Math.PI*t.y/Math.pow(2,t.z);return{lng:t.x/Math.pow(2,t.z)*360-180,lat:rad2deg*Math.atan(.5*(Math.exp(n)-Math.exp(-n)))}}function getCenterLngLat(t){const n=t.x*2+1,o=t.y*2+1,s=t.z+1;return getLngLat({x:n,y:o,z:s,f:0})}function getCenterLngLatAlt(t){return{...getCenterLngLat(t),alt:getFloor(t)+2**ZFXY_1M_ZOOM_BASE/2**(t.z+1)}}function getBBox(t){const n=getLngLat(t),o=getLngLat({...t,y:t.y+1,x:t.x+1});return[n,o]}function getFloor(t){return t.f*2**ZFXY_1M_ZOOM_BASE/2**t.z}function calculateZFXY(t){const n=typeof t.alt<"u"?t.alt:0;if(n<=-33554432||n>=2**ZFXY_1M_ZOOM_BASE)throw new Error(`ZFXY only supports altitude between -2^${ZFXY_1M_ZOOM_BASE} and +2^${ZFXY_1M_ZOOM_BASE}.`);const o=Math.floor(2**t.zoom*n/2**ZFXY_1M_ZOOM_BASE),s=Math.PI/180,c=Math.sin(t.lat*s),d=2**t.zoom;let h=d*(t.lng/360+.5);const p=d*(.5-.25*Math.log((1+c)/(1-c))/Math.PI);return h=h%d,h<0&&(h=h+d),{f:o,x:Math.floor(h),y:Math.floor(p),z:t.zoom}}function zfxyWraparound(t){const{z:n,f:o,x:s,y:c}=t;return{z:n,f:Math.max(Math.min(o,2**n),-(2**n)),x:s<0?s+2**n:s%2**n,y:c<0?c+2**n:c%2**n}}function parseZFXYTilehash(t){let n=!1;t[0]==="-"&&(n=!0,t=t.substring(1));let o=getChildren(),s;for(const c of t)s={...o[parseInt(c,10)-1]},o=getChildren(s);return n&&(s.f=-s.f),s}function generateTilehash(t){let{f:n,x:o,y:s,z:c}=t;const d=n;let h="";for(;c>0;){const p={f:Math.abs(n),x:o,y:s,z:c},y=getParent(p);h=(getChildren(y).findIndex(L=>L.f===Math.abs(n)&&L.x===o&&L.y===s&&L.z===c)+1).toString()+h,n=y.f,o=y.x,s=y.y,c=y.z}return(d<0?"-":"")+h}function feature(t,n,o){o===void 0&&(o={});var s={type:"Feature"};return(o.id===0||o.id)&&(s.id=o.id),o.bbox&&(s.bbox=o.bbox),s.properties=n||{},s.geometry=t,s}function point(t,n,o){if(o===void 0&&(o={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!isNumber$1(t[0])||!isNumber$1(t[1]))throw new Error("coordinates must contain numbers");var s={type:"Point",coordinates:t};return feature(s,n,o)}function lineString(t,n,o){if(o===void 0&&(o={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");var s={type:"LineString",coordinates:t};return feature(s,n,o)}function featureCollection$1(t,n){n===void 0&&(n={});var o={type:"FeatureCollection"};return n.id&&(o.id=n.id),n.bbox&&(o.bbox=n.bbox),o.features=t,o}function multiLineString(t,n,o){o===void 0&&(o={});var s={type:"MultiLineString",coordinates:t};return feature(s,n,o)}function isNumber$1(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}function coordEach$1(t,n,o){if(t!==null)for(var s,c,d,h,p,y,S,P=0,L=0,F,N=t.type,z=N==="FeatureCollection",W=N==="Feature",nt=z?t.features.length:1,Pe=0;Pe<nt;Pe++){S=z?t.features[Pe].geometry:W?t.geometry:t,F=S?S.type==="GeometryCollection":!1,p=F?S.geometries.length:1;for(var se=0;se<p;se++){var mt=0,kt=0;if(h=F?S.geometries[se]:S,h!==null){y=h.coordinates;var mn=h.type;switch(P=0,mn){case null:break;case"Point":if(n(y,L,Pe,mt,kt)===!1)return!1;L++,mt++;break;case"LineString":case"MultiPoint":for(s=0;s<y.length;s++){if(n(y[s],L,Pe,mt,kt)===!1)return!1;L++,mn==="MultiPoint"&&mt++}mn==="LineString"&&mt++;break;case"Polygon":case"MultiLineString":for(s=0;s<y.length;s++){for(c=0;c<y[s].length-P;c++){if(n(y[s][c],L,Pe,mt,kt)===!1)return!1;L++}mn==="MultiLineString"&&mt++,mn==="Polygon"&&kt++}mn==="Polygon"&&mt++;break;case"MultiPolygon":for(s=0;s<y.length;s++){for(kt=0,c=0;c<y[s].length;c++){for(d=0;d<y[s][c].length-P;d++){if(n(y[s][c][d],L,Pe,mt,kt)===!1)return!1;L++}kt++}mt++}break;case"GeometryCollection":for(s=0;s<h.geometries.length;s++)if(coordEach$1(h.geometries[s],n)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function featureEach$2(t,n){if(t.type==="Feature")n(t,0);else if(t.type==="FeatureCollection")for(var o=0;o<t.features.length&&n(t.features[o],o)!==!1;o++);}function geomEach$1(t,n){var o,s,c,d,h,p,y,S,P,L,F=0,N=t.type==="FeatureCollection",z=t.type==="Feature",W=N?t.features.length:1;for(o=0;o<W;o++){for(p=N?t.features[o].geometry:z?t.geometry:t,S=N?t.features[o].properties:z?t.properties:{},P=N?t.features[o].bbox:z?t.bbox:void 0,L=N?t.features[o].id:z?t.id:void 0,y=p?p.type==="GeometryCollection":!1,h=y?p.geometries.length:1,c=0;c<h;c++){if(d=y?p.geometries[c]:p,d===null){if(n(null,F,S,P,L)===!1)return!1;continue}switch(d.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(n(d,F,S,P,L)===!1)return!1;break}case"GeometryCollection":{for(s=0;s<d.geometries.length;s++)if(n(d.geometries[s],F,S,P,L)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}F++}}function flattenEach$1(t,n){geomEach$1(t,function(o,s,c,d,h){var p=o===null?null:o.type;switch(p){case null:case"Point":case"LineString":case"Polygon":return n(feature(o,c,{bbox:d,id:h}),s,0)===!1?!1:void 0}var y;switch(p){case"MultiPoint":y="Point";break;case"MultiLineString":y="LineString";break;case"MultiPolygon":y="Polygon";break}for(var S=0;S<o.coordinates.length;S++){var P=o.coordinates[S],L={type:y,coordinates:P};if(n(feature(L,c),s,S)===!1)return!1}})}function bbox$2(t){var n=[1/0,1/0,-1/0,-1/0];return coordEach$1(t,function(o){n[0]>o[0]&&(n[0]=o[0]),n[1]>o[1]&&(n[1]=o[1]),n[2]<o[0]&&(n[2]=o[0]),n[3]<o[1]&&(n[3]=o[1])}),n}bbox$2.default=bbox$2;function getCoord(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if(t.type==="Feature"&&t.geometry!==null&&t.geometry.type==="Point")return t.geometry.coordinates;if(t.type==="Point")return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function getCoords(t){if(Array.isArray(t))return t;if(t.type==="Feature"){if(t.geometry!==null)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function getGeom(t){return t.type==="Feature"?t.geometry:t}function booleanPointInPolygon$1(t,n,o){if(o===void 0&&(o={}),!t)throw new Error("point is required");if(!n)throw new Error("polygon is required");var s=getCoord(t),c=getGeom(n),d=c.type,h=n.bbox,p=c.coordinates;if(h&&inBBox$1(s,h)===!1)return!1;d==="Polygon"&&(p=[p]);for(var y=!1,S=0;S<p.length&&!y;S++)if(inRing$1(s,p[S][0],o.ignoreBoundary)){for(var P=!1,L=1;L<p[S].length&&!P;)inRing$1(s,p[S][L],!o.ignoreBoundary)&&(P=!0),L++;P||(y=!0)}return y}function inRing$1(t,n,o){var s=!1;n[0][0]===n[n.length-1][0]&&n[0][1]===n[n.length-1][1]&&(n=n.slice(0,n.length-1));for(var c=0,d=n.length-1;c<n.length;d=c++){var h=n[c][0],p=n[c][1],y=n[d][0],S=n[d][1],P=t[1]*(h-y)+p*(y-t[0])+S*(t[0]-h)===0&&(h-t[0])*(y-t[0])<=0&&(p-t[1])*(S-t[1])<=0;if(P)return!o;var L=p>t[1]!=S>t[1]&&t[0]<(y-h)*(t[1]-p)/(S-p)+h;L&&(s=!s)}return s}function inBBox$1(t,n){return n[0]<=t[0]&&n[1]<=t[1]&&n[2]>=t[0]&&n[3]>=t[1]}function lineSegment(t){if(!t)throw new Error("geojson is required");var n=[];return flattenEach$1(t,function(o){lineSegmentFeature(o,n)}),featureCollection$1(n)}function lineSegmentFeature(t,n){var o=[],s=t.geometry;if(s!==null){switch(s.type){case"Polygon":o=getCoords(s);break;case"LineString":o=[getCoords(s)]}o.forEach(function(c){var d=createSegments(c,t.properties);d.forEach(function(h){h.id=n.length,n.push(h)})})}}function createSegments(t,n){var o=[];return t.reduce(function(s,c){var d=lineString([s,c],n);return d.bbox=bbox$1(s,c),o.push(d),c}),o}function bbox$1(t,n){var o=t[0],s=t[1],c=n[0],d=n[1],h=o<c?o:c,p=s<d?s:d,y=o>c?o:c,S=s>d?s:d;return[h,p,y,S]}var geojsonRbush$1={exports:{}};function quickselect$3(t,n,o,s,c){quickselectStep(t,n,o||0,s||t.length-1,c||defaultCompare)}function quickselectStep(t,n,o,s,c){for(;s>o;){if(s-o>600){var d=s-o+1,h=n-o+1,p=Math.log(d),y=.5*Math.exp(2*p/3),S=.5*Math.sqrt(p*y*(d-y)/d)*(h-d/2<0?-1:1),P=Math.max(o,Math.floor(n-h*y/d+S)),L=Math.min(s,Math.floor(n+(d-h)*y/d+S));quickselectStep(t,n,P,L,c)}var F=t[n],N=o,z=s;for(swap$3(t,o,n),c(t[s],F)>0&&swap$3(t,o,s);N<z;){for(swap$3(t,N,z),N++,z--;c(t[N],F)<0;)N++;for(;c(t[z],F)>0;)z--}c(t[o],F)===0?swap$3(t,o,z):(z++,swap$3(t,z,s)),z<=n&&(o=z+1),n<=z&&(s=z-1)}}function swap$3(t,n,o){var s=t[n];t[n]=t[o],t[o]=s}function defaultCompare(t,n){return t<n?-1:t>n?1:0}class RBush{constructor(n=9){this._maxEntries=Math.max(4,n),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(n){let o=this.data;const s=[];if(!intersects$1(n,o))return s;const c=this.toBBox,d=[];for(;o;){for(let h=0;h<o.children.length;h++){const p=o.children[h],y=o.leaf?c(p):p;intersects$1(n,y)&&(o.leaf?s.push(p):contains$1(n,y)?this._all(p,s):d.push(p))}o=d.pop()}return s}collides(n){let o=this.data;if(!intersects$1(n,o))return!1;const s=[];for(;o;){for(let c=0;c<o.children.length;c++){const d=o.children[c],h=o.leaf?this.toBBox(d):d;if(intersects$1(n,h)){if(o.leaf||contains$1(n,h))return!0;s.push(d)}}o=s.pop()}return!1}load(n){if(!(n&&n.length))return this;if(n.length<this._minEntries){for(let s=0;s<n.length;s++)this.insert(n[s]);return this}let o=this._build(n.slice(),0,n.length-1,0);if(!this.data.children.length)this.data=o;else if(this.data.height===o.height)this._splitRoot(this.data,o);else{if(this.data.height<o.height){const s=this.data;this.data=o,o=s}this._insert(o,this.data.height-o.height-1,!0)}return this}insert(n){return n&&this._insert(n,this.data.height-1),this}clear(){return this.data=createNode$1([]),this}remove(n,o){if(!n)return this;let s=this.data;const c=this.toBBox(n),d=[],h=[];let p,y,S;for(;s||d.length;){if(s||(s=d.pop(),y=d[d.length-1],p=h.pop(),S=!0),s.leaf){const P=findItem$1(n,s.children,o);if(P!==-1)return s.children.splice(P,1),d.push(s),this._condense(d),this}!S&&!s.leaf&&contains$1(s,c)?(d.push(s),h.push(p),p=0,y=s,s=s.children[0]):y?(p++,s=y.children[p],S=!1):s=null}return this}toBBox(n){return n}compareMinX(n,o){return n.minX-o.minX}compareMinY(n,o){return n.minY-o.minY}toJSON(){return this.data}fromJSON(n){return this.data=n,this}_all(n,o){const s=[];for(;n;)n.leaf?o.push(...n.children):s.push(...n.children),n=s.pop();return o}_build(n,o,s,c){const d=s-o+1;let h=this._maxEntries,p;if(d<=h)return p=createNode$1(n.slice(o,s+1)),calcBBox$1(p,this.toBBox),p;c||(c=Math.ceil(Math.log(d)/Math.log(h)),h=Math.ceil(d/Math.pow(h,c-1))),p=createNode$1([]),p.leaf=!1,p.height=c;const y=Math.ceil(d/h),S=y*Math.ceil(Math.sqrt(h));multiSelect$1(n,o,s,S,this.compareMinX);for(let P=o;P<=s;P+=S){const L=Math.min(P+S-1,s);multiSelect$1(n,P,L,y,this.compareMinY);for(let F=P;F<=L;F+=y){const N=Math.min(F+y-1,L);p.children.push(this._build(n,F,N,c-1))}}return calcBBox$1(p,this.toBBox),p}_chooseSubtree(n,o,s,c){for(;c.push(o),!(o.leaf||c.length-1===s);){let d=1/0,h=1/0,p;for(let y=0;y<o.children.length;y++){const S=o.children[y],P=bboxArea$1(S),L=enlargedArea$1(n,S)-P;L<h?(h=L,d=P<d?P:d,p=S):L===h&&P<d&&(d=P,p=S)}o=p||o.children[0]}return o}_insert(n,o,s){const c=s?n:this.toBBox(n),d=[],h=this._chooseSubtree(c,this.data,o,d);for(h.children.push(n),extend$2(h,c);o>=0&&d[o].children.length>this._maxEntries;)this._split(d,o),o--;this._adjustParentBBoxes(c,d,o)}_split(n,o){const s=n[o],c=s.children.length,d=this._minEntries;this._chooseSplitAxis(s,d,c);const h=this._chooseSplitIndex(s,d,c),p=createNode$1(s.children.splice(h,s.children.length-h));p.height=s.height,p.leaf=s.leaf,calcBBox$1(s,this.toBBox),calcBBox$1(p,this.toBBox),o?n[o-1].children.push(p):this._splitRoot(s,p)}_splitRoot(n,o){this.data=createNode$1([n,o]),this.data.height=n.height+1,this.data.leaf=!1,calcBBox$1(this.data,this.toBBox)}_chooseSplitIndex(n,o,s){let c,d=1/0,h=1/0;for(let p=o;p<=s-o;p++){const y=distBBox$1(n,0,p,this.toBBox),S=distBBox$1(n,p,s,this.toBBox),P=intersectionArea$1(y,S),L=bboxArea$1(y)+bboxArea$1(S);P<d?(d=P,c=p,h=L<h?L:h):P===d&&L<h&&(h=L,c=p)}return c||s-o}_chooseSplitAxis(n,o,s){const c=n.leaf?this.compareMinX:compareNodeMinX$1,d=n.leaf?this.compareMinY:compareNodeMinY$1,h=this._allDistMargin(n,o,s,c),p=this._allDistMargin(n,o,s,d);h<p&&n.children.sort(c)}_allDistMargin(n,o,s,c){n.children.sort(c);const d=this.toBBox,h=distBBox$1(n,0,o,d),p=distBBox$1(n,s-o,s,d);let y=bboxMargin$1(h)+bboxMargin$1(p);for(let S=o;S<s-o;S++){const P=n.children[S];extend$2(h,n.leaf?d(P):P),y+=bboxMargin$1(h)}for(let S=s-o-1;S>=o;S--){const P=n.children[S];extend$2(p,n.leaf?d(P):P),y+=bboxMargin$1(p)}return y}_adjustParentBBoxes(n,o,s){for(let c=s;c>=0;c--)extend$2(o[c],n)}_condense(n){for(let o=n.length-1,s;o>=0;o--)n[o].children.length===0?o>0?(s=n[o-1].children,s.splice(s.indexOf(n[o]),1)):this.clear():calcBBox$1(n[o],this.toBBox)}}function findItem$1(t,n,o){if(!o)return n.indexOf(t);for(let s=0;s<n.length;s++)if(o(t,n[s]))return s;return-1}function calcBBox$1(t,n){distBBox$1(t,0,t.children.length,n,t)}function distBBox$1(t,n,o,s,c){c||(c=createNode$1(null)),c.minX=1/0,c.minY=1/0,c.maxX=-1/0,c.maxY=-1/0;for(let d=n;d<o;d++){const h=t.children[d];extend$2(c,t.leaf?s(h):h)}return c}function extend$2(t,n){return t.minX=Math.min(t.minX,n.minX),t.minY=Math.min(t.minY,n.minY),t.maxX=Math.max(t.maxX,n.maxX),t.maxY=Math.max(t.maxY,n.maxY),t}function compareNodeMinX$1(t,n){return t.minX-n.minX}function compareNodeMinY$1(t,n){return t.minY-n.minY}function bboxArea$1(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function bboxMargin$1(t){return t.maxX-t.minX+(t.maxY-t.minY)}function enlargedArea$1(t,n){return(Math.max(n.maxX,t.maxX)-Math.min(n.minX,t.minX))*(Math.max(n.maxY,t.maxY)-Math.min(n.minY,t.minY))}function intersectionArea$1(t,n){const o=Math.max(t.minX,n.minX),s=Math.max(t.minY,n.minY),c=Math.min(t.maxX,n.maxX),d=Math.min(t.maxY,n.maxY);return Math.max(0,c-o)*Math.max(0,d-s)}function contains$1(t,n){return t.minX<=n.minX&&t.minY<=n.minY&&n.maxX<=t.maxX&&n.maxY<=t.maxY}function intersects$1(t,n){return n.minX<=t.maxX&&n.minY<=t.maxY&&n.maxX>=t.minX&&n.maxY>=t.minY}function createNode$1(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function multiSelect$1(t,n,o,s,c){const d=[n,o];for(;d.length;){if(o=d.pop(),n=d.pop(),o-n<=s)continue;const h=n+Math.ceil((o-n)/s/2)*s;quickselect$3(t,h,n,o,c),d.push(n,h,h,o)}}var js$2={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.earthRadius=63710088e-1,t.factors={centimeters:t.earthRadius*100,centimetres:t.earthRadius*100,degrees:t.earthRadius/111325,feet:t.earthRadius*3.28084,inches:t.earthRadius*39.37,kilometers:t.earthRadius/1e3,kilometres:t.earthRadius/1e3,meters:t.earthRadius,metres:t.earthRadius,miles:t.earthRadius/1609.344,millimeters:t.earthRadius*1e3,millimetres:t.earthRadius*1e3,nauticalmiles:t.earthRadius/1852,radians:1,yards:t.earthRadius*1.0936},t.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/t.earthRadius,yards:1.0936133},t.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 n(Ra,ma,yt){yt===void 0&&(yt={});var lt={type:"Feature"};return(yt.id===0||yt.id)&&(lt.id=yt.id),yt.bbox&&(lt.bbox=yt.bbox),lt.properties=ma||{},lt.geometry=Ra,lt}t.feature=n;function o(Ra,ma,yt){switch(Ra){case"Point":return s(ma).geometry;case"LineString":return p(ma).geometry;case"Polygon":return d(ma).geometry;case"MultiPoint":return L(ma).geometry;case"MultiLineString":return P(ma).geometry;case"MultiPolygon":return F(ma).geometry;default:throw new Error(Ra+" is invalid")}}t.geometry=o;function s(Ra,ma,yt){if(yt===void 0&&(yt={}),!Ra)throw new Error("coordinates is required");if(!Array.isArray(Ra))throw new Error("coordinates must be an Array");if(Ra.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!zi(Ra[0])||!zi(Ra[1]))throw new Error("coordinates must contain numbers");var lt={type:"Point",coordinates:Ra};return n(lt,ma,yt)}t.point=s;function c(Ra,ma,yt){return yt===void 0&&(yt={}),S(Ra.map(function(lt){return s(lt,ma)}),yt)}t.points=c;function d(Ra,ma,yt){yt===void 0&&(yt={});for(var lt=0,pi=Ra;lt<pi.length;lt++){var ba=pi[lt];if(ba.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var Sc=0;Sc<ba[ba.length-1].length;Sc++)if(ba[ba.length-1][Sc]!==ba[0][Sc])throw new Error("First and last Position are not equivalent.")}var ms={type:"Polygon",coordinates:Ra};return n(ms,ma,yt)}t.polygon=d;function h(Ra,ma,yt){return yt===void 0&&(yt={}),S(Ra.map(function(lt){return d(lt,ma)}),yt)}t.polygons=h;function p(Ra,ma,yt){if(yt===void 0&&(yt={}),Ra.length<2)throw new Error("coordinates must be an array of two or more positions");var lt={type:"LineString",coordinates:Ra};return n(lt,ma,yt)}t.lineString=p;function y(Ra,ma,yt){return yt===void 0&&(yt={}),S(Ra.map(function(lt){return p(lt,ma)}),yt)}t.lineStrings=y;function S(Ra,ma){ma===void 0&&(ma={});var yt={type:"FeatureCollection"};return ma.id&&(yt.id=ma.id),ma.bbox&&(yt.bbox=ma.bbox),yt.features=Ra,yt}t.featureCollection=S;function P(Ra,ma,yt){yt===void 0&&(yt={});var lt={type:"MultiLineString",coordinates:Ra};return n(lt,ma,yt)}t.multiLineString=P;function L(Ra,ma,yt){yt===void 0&&(yt={});var lt={type:"MultiPoint",coordinates:Ra};return n(lt,ma,yt)}t.multiPoint=L;function F(Ra,ma,yt){yt===void 0&&(yt={});var lt={type:"MultiPolygon",coordinates:Ra};return n(lt,ma,yt)}t.multiPolygon=F;function N(Ra,ma,yt){yt===void 0&&(yt={});var lt={type:"GeometryCollection",geometries:Ra};return n(lt,ma,yt)}t.geometryCollection=N;function z(Ra,ma){if(ma===void 0&&(ma=0),ma&&!(ma>=0))throw new Error("precision must be a positive number");var yt=Math.pow(10,ma||0);return Math.round(Ra*yt)/yt}t.round=z;function W(Ra,ma){ma===void 0&&(ma="kilometers");var yt=t.factors[ma];if(!yt)throw new Error(ma+" units is invalid");return Ra*yt}t.radiansToLength=W;function nt(Ra,ma){ma===void 0&&(ma="kilometers");var yt=t.factors[ma];if(!yt)throw new Error(ma+" units is invalid");return Ra/yt}t.lengthToRadians=nt;function Pe(Ra,ma){return mt(nt(Ra,ma))}t.lengthToDegrees=Pe;function se(Ra){var ma=Ra%360;return ma<0&&(ma+=360),ma}t.bearingToAzimuth=se;function mt(Ra){var ma=Ra%(2*Math.PI);return ma*180/Math.PI}t.radiansToDegrees=mt;function kt(Ra){var ma=Ra%360;return ma*Math.PI/180}t.degreesToRadians=kt;function mn(Ra,ma,yt){if(ma===void 0&&(ma="kilometers"),yt===void 0&&(yt="kilometers"),!(Ra>=0))throw new Error("length must be a positive number");return W(nt(Ra,ma),yt)}t.convertLength=mn;function _i(Ra,ma,yt){if(ma===void 0&&(ma="meters"),yt===void 0&&(yt="kilometers"),!(Ra>=0))throw new Error("area must be a positive number");var lt=t.areaFactors[ma];if(!lt)throw new Error("invalid original units");var pi=t.areaFactors[yt];if(!pi)throw new Error("invalid final units");return Ra/lt*pi}t.convertArea=_i;function zi(Ra){return!isNaN(Ra)&&Ra!==null&&!Array.isArray(Ra)}t.isNumber=zi;function Sa(Ra){return!!Ra&&Ra.constructor===Object}t.isObject=Sa;function fa(Ra){if(!Ra)throw new Error("bbox is required");if(!Array.isArray(Ra))throw new Error("bbox must be an Array");if(Ra.length!==4&&Ra.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");Ra.forEach(function(ma){if(!zi(ma))throw new Error("bbox must only contain numbers")})}t.validateBBox=fa;function La(Ra){if(!Ra)throw new Error("id is required");if(["string","number"].indexOf(typeof Ra)===-1)throw new Error("id must be a number or a string")}t.validateId=La})(js$2);var js$1={};Object.defineProperty(js$1,"__esModule",{value:!0});var helpers$1=js$2;function coordEach$2(t,n,o){if(t!==null)for(var s,c,d,h,p,y,S,P=0,L=0,F,N=t.type,z=N==="FeatureCollection",W=N==="Feature",nt=z?t.features.length:1,Pe=0;Pe<nt;Pe++){S=z?t.features[Pe].geometry:W?t.geometry:t,F=S?S.type==="GeometryCollection":!1,p=F?S.geometries.length:1;for(var se=0;se<p;se++){var mt=0,kt=0;if(h=F?S.geometries[se]:S,h!==null){y=h.coordinates;var mn=h.type;switch(P=o&&(mn==="Polygon"||mn==="MultiPolygon")?1:0,mn){case null:break;case"Point":if(n(y,L,Pe,mt,kt)===!1)return!1;L++,mt++;break;case"LineString":case"MultiPoint":for(s=0;s<y.length;s++){if(n(y[s],L,Pe,mt,kt)===!1)return!1;L++,mn==="MultiPoint"&&mt++}mn==="LineString"&&mt++;break;case"Polygon":case"MultiLineString":for(s=0;s<y.length;s++){for(c=0;c<y[s].length-P;c++){if(n(y[s][c],L,Pe,mt,kt)===!1)return!1;L++}mn==="MultiLineString"&&mt++,mn==="Polygon"&&kt++}mn==="Polygon"&&mt++;break;case"MultiPolygon":for(s=0;s<y.length;s++){for(kt=0,c=0;c<y[s].length;c++){for(d=0;d<y[s][c].length-P;d++){if(n(y[s][c][d],L,Pe,mt,kt)===!1)return!1;L++}kt++}mt++}break;case"GeometryCollection":for(s=0;s<h.geometries.length;s++)if(coordEach$2(h.geometries[s],n,o)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function coordReduce(t,n,o,s){var c=o;return coordEach$2(t,function(d,h,p,y,S){h===0&&o===void 0?c=d:c=n(c,d,h,p,y,S)},s),c}function propEach(t,n){var o;switch(t.type){case"FeatureCollection":for(o=0;o<t.features.length&&n(t.features[o].properties,o)!==!1;o++);break;case"Feature":n(t.properties,0);break}}function propReduce(t,n,o){var s=o;return propEach(t,function(c,d){d===0&&o===void 0?s=c:s=n(s,c,d)}),s}function featureEach$1(t,n){if(t.type==="Feature")n(t,0);else if(t.type==="FeatureCollection")for(var o=0;o<t.features.length&&n(t.features[o],o)!==!1;o++);}function featureReduce(t,n,o){var s=o;return featureEach$1(t,function(c,d){d===0&&o===void 0?s=c:s=n(s,c,d)}),s}function coordAll(t){var n=[];return coordEach$2(t,function(o){n.push(o)}),n}function geomEach$2(t,n){var o,s,c,d,h,p,y,S,P,L,F=0,N=t.type==="FeatureCollection",z=t.type==="Feature",W=N?t.features.length:1;for(o=0;o<W;o++){for(p=N?t.features[o].geometry:z?t.geometry:t,S=N?t.features[o].properties:z?t.properties:{},P=N?t.features[o].bbox:z?t.bbox:void 0,L=N?t.features[o].id:z?t.id:void 0,y=p?p.type==="GeometryCollection":!1,h=y?p.geometries.length:1,c=0;c<h;c++){if(d=y?p.geometries[c]:p,d===null){if(n(null,F,S,P,L)===!1)return!1;continue}switch(d.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(n(d,F,S,P,L)===!1)return!1;break}case"GeometryCollection":{for(s=0;s<d.geometries.length;s++)if(n(d.geometries[s],F,S,P,L)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}F++}}function geomReduce$1(t,n,o){var s=o;return geomEach$2(t,function(c,d,h,p,y){d===0&&o===void 0?s=c:s=n(s,c,d,h,p,y)}),s}function flattenEach$2(t,n){geomEach$2(t,function(o,s,c,d,h){var p=o===null?null:o.type;switch(p){case null:case"Point":case"LineString":case"Polygon":return n(helpers$1.feature(o,c,{bbox:d,id:h}),s,0)===!1?!1:void 0}var y;switch(p){case"MultiPoint":y="Point";break;case"MultiLineString":y="LineString";break;case"MultiPolygon":y="Polygon";break}for(var S=0;S<o.coordinates.length;S++){var P=o.coordinates[S],L={type:y,coordinates:P};if(n(helpers$1.feature(L,c),s,S)===!1)return!1}})}function flattenReduce(t,n,o){var s=o;return flattenEach$2(t,function(c,d,h){d===0&&h===0&&o===void 0?s=c:s=n(s,c,d,h)}),s}function segmentEach(t,n){flattenEach$2(t,function(o,s,c){var d=0;if(o.geometry){var h=o.geometry.type;if(!(h==="Point"||h==="MultiPoint")){var p,y=0,S=0,P=0;if(coordEach$2(o,function(L,F,N,z,W){if(p===void 0||s>y||z>S||W>P){p=L,y=s,S=z,P=W,d=0;return}var nt=helpers$1.lineString([p,L],o.properties);if(n(nt,s,c,W,d)===!1)return!1;d++,p=L})===!1)return!1}}})}function segmentReduce(t,n,o){var s=o,c=!1;return segmentEach(t,function(d,h,p,y,S){c===!1&&o===void 0?s=d:s=n(s,d,h,p,y,S),c=!0}),s}function lineEach(t,n){if(!t)throw new Error("geojson is required");flattenEach$2(t,function(o,s,c){if(o.geometry!==null){var d=o.geometry.type,h=o.geometry.coordinates;switch(d){case"LineString":if(n(o,s,c,0,0)===!1)return!1;break;case"Polygon":for(var p=0;p<h.length;p++)if(n(helpers$1.lineString(h[p],o.properties),s,c,p)===!1)return!1;break}}})}function lineReduce(t,n,o){var s=o;return lineEach(t,function(c,d,h,p){d===0&&o===void 0?s=c:s=n(s,c,d,h,p)}),s}function findSegment(t,n){if(n=n||{},!helpers$1.isObject(n))throw new Error("options is invalid");var o=n.featureIndex||0,s=n.multiFeatureIndex||0,c=n.geometryIndex||0,d=n.segmentIndex||0,h=n.properties,p;switch(t.type){case"FeatureCollection":o<0&&(o=t.features.length+o),h=h||t.features[o].properties,p=t.features[o].geometry;break;case"Feature":h=h||t.properties,p=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":p=t;break;default:throw new Error("geojson is invalid")}if(p===null)return null;var y=p.coordinates;switch(p.type){case"Point":case"MultiPoint":return null;case"LineString":return d<0&&(d=y.length+d-1),helpers$1.lineString([y[d],y[d+1]],h,n);case"Polygon":return c<0&&(c=y.length+c),d<0&&(d=y[c].length+d-1),helpers$1.lineString([y[c][d],y[c][d+1]],h,n);case"MultiLineString":return s<0&&(s=y.length+s),d<0&&(d=y[s].length+d-1),helpers$1.lineString([y[s][d],y[s][d+1]],h,n);case"MultiPolygon":return s<0&&(s=y.length+s),c<0&&(c=y[s].length+c),d<0&&(d=y[s][c].length-d-1),helpers$1.lineString([y[s][c][d],y[s][c][d+1]],h,n)}throw new Error("geojson is invalid")}function findPoint(t,n){if(n=n||{},!helpers$1.isObject(n))throw new Error("options is invalid");var o=n.featureIndex||0,s=n.multiFeatureIndex||0,c=n.geometryIndex||0,d=n.coordIndex||0,h=n.properties,p;switch(t.type){case"FeatureCollection":o<0&&(o=t.features.length+o),h=h||t.features[o].properties,p=t.features[o].geometry;break;case"Feature":h=h||t.properties,p=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":p=t;break;default:throw new Error("geojson is invalid")}if(p===null)return null;var y=p.coordinates;switch(p.type){case"Point":return helpers$1.point(y,h,n);case"MultiPoint":return s<0&&(s=y.length+s),helpers$1.point(y[s],h,n);case"LineString":return d<0&&(d=y.length+d),helpers$1.point(y[d],h,n);case"Polygon":return c<0&&(c=y.length+c),d<0&&(d=y[c].length+d),helpers$1.point(y[c][d],h,n);case"MultiLineString":return s<0&&(s=y.length+s),d<0&&(d=y[s].length+d),helpers$1.point(y[s][d],h,n);case"MultiPolygon":return s<0&&(s=y.length+s),c<0&&(c=y[s].length+c),d<0&&(d=y[s][c].length-d),helpers$1.point(y[s][c][d],h,n)}throw new Error("geojson is invalid")}js$1.coordAll=coordAll,js$1.coordEach=coordEach$2,js$1.coordReduce=coordReduce,js$1.featureEach=featureEach$1,js$1.featureReduce=featureReduce,js$1.findPoint=findPoint,js$1.findSegment=findSegment,js$1.flattenEach=flattenEach$2,js$1.flattenReduce=flattenReduce,js$1.geomEach=geomEach$2,js$1.geomReduce=geomReduce$1,js$1.lineEach=lineEach,js$1.lineReduce=lineReduce,js$1.propEach=propEach,js$1.propReduce=propReduce,js$1.segmentEach=segmentEach,js$1.segmentReduce=segmentReduce;var js$3={};Object.defineProperty(js$3,"__esModule",{value:!0});var meta_1=js$1;function bbox(t){var n=[1/0,1/0,-1/0,-1/0];return meta_1.coordEach(t,function(o){n[0]>o[0]&&(n[0]=o[0]),n[1]>o[1]&&(n[1]=o[1]),n[2]<o[0]&&(n[2]=o[0]),n[3]<o[1]&&(n[3]=o[1])}),n}bbox.default=bbox,js$3.default=bbox;var rbush$3=RBush,helpers=js$2,meta=js$1,turfBBox=js$3.default,featureEach$3=meta.featureEach;meta.coordEach,helpers.polygon;var featureCollection=helpers.featureCollection;function geojsonRbush(t){var n=new rbush$3(t);return n.insert=function(o){if(o.type!=="Feature")throw new Error("invalid feature");return o.bbox=o.bbox?o.bbox:turfBBox(o),rbush$3.prototype.insert.call(this,o)},n.load=function(o){var s=[];return Array.isArray(o)?o.forEach(function(c){if(c.type!=="Feature")throw new Error("invalid features");c.bbox=c.bbox?c.bbox:turfBBox(c),s.push(c)}):featureEach$3(o,function(c){if(c.type!=="Feature")throw new Error("invalid features");c.bbox=c.bbox?c.bbox:turfBBox(c),s.push(c)}),rbush$3.prototype.load.call(this,s)},n.remove=function(o,s){if(o.type!=="Feature")throw new Error("invalid feature");return o.bbox=o.bbox?o.bbox:turfBBox(o),rbush$3.prototype.remove.call(this,o,s)},n.clear=function(){return rbush$3.prototype.clear.call(this)},n.search=function(o){var s=rbush$3.prototype.search.call(this,this.toBBox(o));return featureCollection(s)},n.collides=function(o){return rbush$3.prototype.collides.call(this,this.toBBox(o))},n.all=function(){var o=rbush$3.prototype.all.call(this);return featureCollection(o)},n.toJSON=function(){return rbush$3.prototype.toJSON.call(this)},n.fromJSON=function(o){return rbush$3.prototype.fromJSON.call(this,o)},n.toBBox=function(o){var s;if(o.bbox)s=o.bbox;else if(Array.isArray(o)&&o.length===4)s=o;else if(Array.isArray(o)&&o.length===6)s=[o[0],o[1],o[3],o[4]];else if(o.type==="Feature")s=turfBBox(o);else if(o.type==="FeatureCollection")s=turfBBox(o);else throw new Error("invalid geojson");return{minX:s[0],minY:s[1],maxX:s[2],maxY:s[3]}},n}geojsonRbush$1.exports=geojsonRbush,geojsonRbush$1.exports.default=geojsonRbush;function lineIntersect(t,n){var o={},s=[];if(t.type==="LineString"&&(t=feature(t)),n.type==="LineString"&&(n=feature(n)),t.type==="Feature"&&n.type==="Feature"&&t.geometry!==null&&n.geometry!==null&&t.geometry.type==="LineString"&&n.geometry.type==="LineString"&&t.geometry.coordinates.length===2&&n.geometry.coordinates.length===2){var c=intersects$2(t,n);return c&&s.push(c),featureCollection$1(s)}var d=geojsonRbush$1.exports();return d.load(lineSegment(n)),featureEach$2(lineSegment(t),function(h){featureEach$2(d.search(h),function(p){var y=intersects$2(h,p);if(y){var S=getCoords(y).join(",");o[S]||(o[S]=!0,s.push(y))}})}),featureCollection$1(s)}function intersects$2(t,n){var o=getCoords(t),s=getCoords(n);if(o.length!==2)throw new Error("<intersects> line1 must only contain 2 coordinates");if(s.length!==2)throw new Error("<intersects> line2 must only contain 2 coordinates");var c=o[0][0],d=o[0][1],h=o[1][0],p=o[1][1],y=s[0][0],S=s[0][1],P=s[1][0],L=s[1][1],F=(L-S)*(h-c)-(P-y)*(p-d),N=(P-y)*(d-S)-(L-S)*(c-y),z=(h-c)*(d-S)-(p-d)*(c-y);if(F===0)return null;var W=N/F,nt=z/F;if(W>=0&&W<=1&&nt>=0&&nt<=1){var Pe=c+W*(h-c),se=d+W*(p-d);return point([Pe,se])}return null}function polygonToLine(t,n){n===void 0&&(n={});var o=getGeom(t);switch(!n.properties&&t.type==="Feature"&&(n.properties=t.properties),o.type){case"Polygon":return polygonToLine$1(o,n);case"MultiPolygon":return multiPolygonToLine(o,n);default:throw new Error("invalid poly")}}function polygonToLine$1(t,n){n===void 0&&(n={});var o=getGeom(t),s=o.coordinates,c=n.properties?n.properties:t.type==="Feature"?t.properties:{};return coordsToLine(s,c)}function multiPolygonToLine(t,n){n===void 0&&(n={});var o=getGeom(t),s=o.coordinates,c=n.properties?n.properties:t.type==="Feature"?t.properties:{},d=[];return s.forEach(function(h){d.push(coordsToLine(h,c))}),featureCollection$1(d)}function coordsToLine(t,n){return t.length>1?multiLineString(t,n):lineString(t[0],n)}function booleanDisjoint(t,n){var o=!0;return flattenEach$1(t,function(s){flattenEach$1(n,function(c){if(o===!1)return!1;o=disjoint(s.geometry,c.geometry)})}),o}function disjoint(t,n){switch(t.type){case"Point":switch(n.type){case"Point":return!compareCoords(t.coordinates,n.coordinates);case"LineString":return!isPointOnLine(n,t);case"Polygon":return!booleanPointInPolygon$1(t,n)}break;case"LineString":switch(n.type){case"Point":return!isPointOnLine(t,n);case"LineString":return!isLineOnLine(t,n);case"Polygon":return!isLineInPoly(n,t)}break;case"Polygon":switch(n.type){case"Point":return!booleanPointInPolygon$1(n,t);case"LineString":return!isLineInPoly(t,n);case"Polygon":return!isPolyInPoly(n,t)}}return!1}function isPointOnLine(t,n){for(var o=0;o<t.coordinates.length-1;o++)if(isPointOnLineSegment(t.coordinates[o],t.coordinates[o+1],n.coordinates))return!0;return!1}function isLineOnLine(t,n){var o=lineIntersect(t,n);return o.features.length>0}function isLineInPoly(t,n){for(var o=0,s=n.coordinates;o<s.length;o++){var c=s[o];if(booleanPointInPolygon$1(c,t))return!0}var d=lineIntersect(n,polygonToLine(t));return d.features.length>0}function isPolyInPoly(t,n){for(var o=0,s=t.coordinates[0];o<s.length;o++){var c=s[o];if(booleanPointInPolygon$1(c,n))return!0}for(var d=0,h=n.coordinates[0];d<h.length;d++){var p=h[d];if(booleanPointInPolygon$1(p,t))return!0}var y=lineIntersect(polygonToLine(t),polygonToLine(n));return y.features.length>0}function isPointOnLineSegment(t,n,o){var s=o[0]-t[0],c=o[1]-t[1],d=n[0]-t[0],h=n[1]-t[1],p=s*h-c*d;return p!==0?!1:Math.abs(d)>=Math.abs(h)?d>0?t[0]<=o[0]&&o[0]<=n[0]:n[0]<=o[0]&&o[0]<=t[0]:h>0?t[1]<=o[1]&&o[1]<=n[1]:n[1]<=o[1]&&o[1]<=t[1]}function compareCoords(t,n){return t[0]===n[0]&&t[1]===n[1]}function booleanIntersects(t,n){var o=!1;return flattenEach$1(t,function(s){flattenEach$1(n,function(c){if(o===!0)return!0;o=!booleanDisjoint(s.geometry,c.geometry)})}),o}const d2r=Math.PI/180,MAX_ZOOM=28;function getBboxZoom(t){for(let n=0;n<MAX_ZOOM;n++){const o=1<<32-(n+1);if((t[0]&o)!==(t[2]&o)||(t[1]&o)!==(t[3]&o))return n}return MAX_ZOOM}function bboxToTile(t,n){const o=pointToTile(t[0],t[1],32),s=pointToTile(t[2],t[3],32),c=[o[0],o[1],s[0],s[1]],d=Math.min(getBboxZoom(c),typeof n<"u"?n:MAX_ZOOM);if(d===0)return[0,0,0];const h=c[0]>>>32-d,p=c[1]>>>32-d;return[h,p,d]}function pointToTile(t,n,o){var s=pointToTileFraction(t,n,o);return s[0]=Math.floor(s[0]),s[1]=Math.floor(s[1]),s}function pointToTileFraction(t,n,o){var s=Math.sin(n*d2r),c=Math.pow(2,o),d=c*(t/360+.5),h=c*(.5-.25*Math.log((1+s)/(1-s))/Math.PI);return d=d%c,d<0&&(d=d+c),[d,h,o]}function encodeHilbert3D(t,n,o,s){let c=encodeMorton3D(t,n,o);return mortonToHilbertN(c,s)}function decodeHilbert3D(t,n){const o=hilbertToMortonN(t,n);return decodeMorton3D(o)}function encodeMorton3D(t,n,o){let s=0n;return s=splitBy3(t)|splitBy3(n)<<1n|splitBy3(o)<<2n,s}function decodeMorton3D(t){let n=compactBy3(t),o=compactBy3(t>>1n),s=compactBy3(t>>2n);return[n,o,s]}function splitBy3(t){let n=BigInt(t)&BigInt("0x3ffffffffff");return n=(n|n<<64n)&BigInt("0x3ff0000000000000000ffffffff"),n=(n|n<<32n)&BigInt("0x3ff00000000ffff00000000ffff"),n=(n|n<<16n)&BigInt("0x30000ff0000ff0000ff0000ff0000ff"),n=(n|n<<8n)&BigInt("0x300f00f00f00f00f00f00f00f00f00f"),n=(n|n<<4n)&BigInt("0x30c30c30c30c30c30c30c30c30c30c3"),n=(n|n<<2n)&BigInt("0x9249249249249249249249249249249"),n}function compactBy3(t){let n=t&BigInt("0x9249249249249249249249249249249");return n=(n|n>>2n)&BigInt("0x30c30c30c30c30c30c30c30c30c30c3"),n=(n|n>>4n)&BigInt("0x300f00f00f00f00f00f00f00f00f00f"),n=(n|n>>8n)&BigInt("0x30000ff0000ff0000ff0000ff0000ff"),n=(n|n>>16n)&BigInt("0x3ff00000000ffff00000000ffff"),n=(n|n>>32n)&BigInt("0x3ff0000000000000000ffffffff"),n=(n|n>>64n)&BigInt("0x3ffffffffff"),Number(n)}const mortonToHilbertTable=[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],hilbertToMortonTable=[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 transformCurve(t,n,o){let s=0,c=0n;for(let d=3*(n-1);d>=0;d-=3)s=o[s|Number(t>>BigInt(d)&7n)],c=c<<3n|BigInt(s&7),s&=-8;return c}function mortonToHilbertN(t,n){return transformCurve(t,n,mortonToHilbertTable)}function hilbertToMortonN(t,n){return transformCurve(t,n,hilbertToMortonTable)}function generateHilbertIndex(t){const n=t.z>0?t.f+2**(t.z-1):0;return encodeHilbert3D(t.x,t.y,n,t.z)}function parseHilbertIndex(t,n){if(n===0)return{z:0,f:0,x:0,y:0};const[o,s,c]=decodeHilbert3D(t,n);return{f:c-2**(n-1),x:o,y:s,z:n}}function generateHilbertTilehash(t,n){return"H"+t.toString(8).padStart(n,"0").split("").map(o=>(parseInt(o)+1).toString()).join("")}function parseHilbertTilehash(t){if(t[0]!=="H")return;const n=t.substring(1).split("").map(s=>(parseInt(s)-1).toString()).join(""),o=BigInt("0o"+n);return parseHilbertIndex(o,n.length)}const DEFAULT_ZOOM=25;class Space{constructor(n,o){if(typeof n=="string"){let s=parseZFXYString(n)||parseHilbertTilehash(n)||parseZFXYTilehash(n);if(s)this.zfxy=s,this._regenerateAttributesFromZFXY();else throw new Error(`parse ZFXY failed with input: ${n}`);return}else if(isZFXYTile(n)){this.zfxy=n,this._regenerateAttributesFromZFXY();return}else this.zfxy=calculateZFXY({...n,zoom:typeof o<"u"?o:DEFAULT_ZOOM});this._regenerateAttributesFromZFXY()}up(n=1){return this.move({f:n})}down(n=1){return this.move({f:-n})}north(n=1){return this.move({y:n})}south(n=1){return this.move({y:-n})}east(n=1){return this.move({x:n})}west(n=1){return this.move({x:-n})}move(n){const o=new Space(this.zfxy);return o.zfxy=zfxyWraparound({z:o.zfxy.z,f:o.zfxy.f+(n.f||0),x:o.zfxy.x+(n.x||0),y:o.zfxy.y+(n.y||0)}),o._regenerateAttributesFromZFXY(),o}parent(n){const o=typeof n>"u"?1:this.zfxy.z-n;return new Space(getParent(this.zfxy,o))}children(){return getChildren(this.zfxy).map(n=>new Space(n))}surroundings(){return[...getSurrounding(this.zfxy).filter(({z:n,f:o,x:s,y:c})=>`/${n}/${o}/${s}/${c}`!==this.zfxyStr).map(n=>new Space(n)),...getSurrounding(this.up().zfxy).map(n=>new Space(n)),...getSurrounding(this.down().zfxy).map(n=>new Space(n))]}contains(n){const o=this.toGeoJSON(),s={type:"Point",coordinates:[n.lng,n.lat]},c=this.alt,d=getFloor({...this.zfxy,f:this.zfxy.f+1});return booleanIntersects(o,s)&&(typeof n.alt<"u"?n.alt>=c&&n.alt<d:!0)}toGeoJSON(){const[n,o]=getBBox(this.zfxy);return{type:"Polygon",coordinates:[[[n.lng,n.lat],[n.lng,o.lat],[o.lng,o.lat],[o.lng,n.lat],[n.lng,n.lat]]]}}vertices3d(){const[n,o]=getBBox(this.zfxy),s=getFloor(this.zfxy),c=getFloor({...this.zfxy,f:this.zfxy.f+1});return[[n.lng,n.lat,s],[n.lng,o.lat,s],[o.lng,o.lat,s],[o.lng,n.lat,s],[n.lng,n.lat,c],[n.lng,o.lat,c],[o.lng,o.lat,c],[o.lng,n.lat,c]]}static getSpaceById(n,o){return new Space(n,o)}static getSpaceByLocation(n,o){return new Space(n,o)}static getSpaceByZFXY(n){return new Space(n)}static boundingSpaceForGeometry(n,o){o=o||25;const s=bbox$2(n),c=bboxToTile(s,o),[d,h,p]=c;return new Space({x:d,y:h,z:p,f:0})}static spacesForGeometry(n,o){const s=o;if(s===0)return[new Space("0/0/0/0")];if(n.type==="GeometryCollection")throw new Error("GeometryCollection not supported");const c=bbox$2(n),d=pointToTile(c[0],c[1],32),h=pointToTile(c[2],c[3],32),p=Math.min(d[0],h[0])>>>32-s,y=Math.min(d[1],h[1])>>>32-s,S=(Math.max(h[0],d[0])>>>32-s)+1,P=(Math.max(h[1],d[1])>>>32-s)+1,L=[];for(let F=p;F<=S;F++)for(let N=y;N<=P;N++){const z=new Space({x:F,y:N,z:s,f:0});booleanIntersects(n,z.toGeoJSON())&&L.push(z)}return L}_regenerateAttributesFromZFXY(){this.alt=getFloor(this.zfxy),this.center=getCenterLngLatAlt(this.zfxy),this.zoom=this.zfxy.z,this.id=this.tilehash=generateTilehash(this.zfxy),this.zfxyStr=`/${this.zfxy.z}/${this.zfxy.f}/${this.zfxy.x}/${this.zfxy.y}`,this.hilbertIndex=generateHilbertIndex(this.zfxy),this.hilbertTilehash=generateHilbertTilehash(this.hilbertIndex,this.zfxy.z)}}const getRectangeParamsFromSpace=t=>{const n=t.vertices3d(),o=[n[0][0],n[1][1],n[2][0],n[3][1]],s=n[0][2],c=n[4][2];return{wsen:o,height:s,extrudedHeight:c}},createSpatialIdSpace=(t,n,o,s,c)=>{const d=new Space({lat:n,lng:t,alt:o},s),{wsen:h,height:p,extrudedHeight:y}=getRectangeParamsFromSpace(d);return{id:v4(),space:d,wsen:h,height:p+c,extrudedHeight:y+c}},getSpaceData=t=>({id:t.id,center:t.center,alt:t.alt,zoom:t.zoom,zfxy:t.zfxy,zfxyStr:t.zfxyStr,tilehash:t.tilehash,hilbertTilehash:t.hilbertTilehash,hilbertIndex:t.hilbertIndex.toString(),vertices:t.vertices3d()}),getVerticalLimits=(t,n,o)=>{const s=new Space({lat:0,lng:0,alt:t},o),c=new Space({lat:0,lng:0,alt:n},o),{height:d}=getRectangeParamsFromSpace(s),{extrudedHeight:h}=getRectangeParamsFromSpace(c);return{top:d,bottom:h}},useHooks$8=({ref:t,engineRef:n,geoidRef:o,terrainEnabled:s,interactionMode:c,overrideInteractionMode:d,onMount:h})=>{const[p,y]=React.useState("idle"),[S,P]=React.useState(null),[L,F]=React.useState(null),[N,z]=React.useState(null),W=React.useRef(null),[nt,Pe]=React.useState(null),se=React.useRef(null),[mt,kt]=React.useState(null),[mn,_i]=React.useState(null),[zi,Sa]=React.useState(SPATIALID_DEFAULT_OPTIONS),fa=React.useMemo(()=>getVerticalLimits(zi.maxHeight,zi.minHeight,zi.zoom),[zi.maxHeight,zi.minHeight,zi.zoom]),La=React.useMemo(()=>{const of=[...S??[],...nt?[nt]:[]];if(!of)return null;const gf=of.reduce((Ef,xf)=>(Ef.find(Wa=>Wa.space.zfxy.z===xf.space.zfxy.z&&Wa.space.zfxy.x===xf.space.zfxy.x&&Wa.space.zfxy.y===xf.space.zfxy.y)||Ef.push(xf),Ef),[]);return gf.length===0?null:gf.map(Ef=>{const{wsen:xf}=Ef;return{id:v4(),spaceId:Ef.space.id,wsen:xf,color:zi.groundIndicatorColor}})},[S,nt,zi.groundIndicatorColor]),Ra=React.useCallback(of=>{y("coordinate"),Sa(gf=>({...gf,...of})),d==null||d("spatialId"),setTimeout(()=>{var gf;(gf=n.current)==null||gf.setCursor("crosshair")},100)},[n,d]),ma=React.useRef(c);ma.current=c;const yt=React.useCallback(()=>{var of,gf;y("idle"),kt(null),_i(null),Pe(null),z(null),W.current=null,se.current=null,F(null),d==null||d(ma.current==="spatialId"?"default":ma.current??"default"),(of=n.current)==null||of.setCursor("default"),(gf=n.current)==null||gf.requestRender()},[d,n]),lt=React.useCallback(async of=>{var gf,Ef,xf,Wa;if(p!=="idle"&&!hf.current){if(p==="coordinate"){if(!N||of.lat===void 0||of.lng===void 0||of.lat>SPATIALID_LATITUDE_RANGE.max||of.lat<SPATIALID_LATITUDE_RANGE.min)return;y("fetchingGeoid");const{id:af,wsen:Xd,space:gd}=createSpatialIdSpace(of.lng,of.lat,0,zi.zoom,0);requestAnimationFrame(()=>{var df;(df=n.current)==null||df.setCursor("wait")});const[pd,Zd]=await Promise.all([(gf=o.current)==null?void 0:gf.getGeoidHeight(of.lng,of.lat),(Ef=o.current)==null?void 0:Ef.getGeoidHeight(gd.center.lng,gd.center.lat)]);if(setTimeout(()=>{var df;(df=n.current)==null||df.setCursor("crosshair")},100),pd===void 0&&Zd===void 0){y("coordinate");return}const cf=pd??Zd??0,sf=Zd??pd??0;se.current=sf,F({id:af,wsen:Xd,height:fa.top+sf,extrudedHeight:fa.bottom+sf,color:zi.verticalSpaceIndicatorColor,outlineColor:zi.verticalSpaceIndicatorOutlineColor}),_i([of.lng,of.lat,(s?of.height??0:0)-cf]),kt(((xf=n.current)==null?void 0:xf.toXYZ(of.lng,of.lat,of.height??0))??null);const nf=createSpatialIdSpace(of.lng,of.lat,(s?of.height??0:0)-cf,zi.zoom,sf);Pe({...nf,color:zi.color,outlineColor:zi.outlineColor}),W.current=N,z(null),(Wa=n.current)==null||Wa.requestRender(),y("floor")}else if(p==="floor"){if(!nt)return;const af={...nt,id:v4(),color:zi.color,outlineColor:zi.outlineColor};zi.dataOnly||P(gd=>gd?[...gd,af]:[af]),yt();const Xd=getSpaceData(af.space);ff.current.forEach(gd=>gd(Xd))}}},[p,s,n,o,nt,zi,fa,N,yt]),pi=React.useCallback(of=>{var gf;if(p!=="idle"&&!hf.current){if(p==="coordinate"){if(of.lat===void 0||of.lng===void 0||of.lat>SPATIALID_LATITUDE_RANGE.max||of.lat<SPATIALID_LATITUDE_RANGE.min)return;const Ef=createSpatialIdSpace(of.lng,of.lat,0,zi.zoom,0);if(Ef.space.id===(N==null?void 0:N.uid))return;z({id:v4(),uid:Ef.space.id,wsen:Ef.wsen,color:zi.selectorColor})}else if(p==="floor"){if(of.x===void 0||of.y===void 0||mt===null||mn===null)return;const Ef=((gf=n.current)==null?void 0:gf.getExtrudedHeight(mt,[of.x,of.y],!0))??0;if(mn[2]+Ef>fa.top||mn[2]+Ef<fa.bottom)return;const xf=createSpatialIdSpace(mn[0],mn[1],mn[2]+Ef,zi.zoom,se.current??0);if(xf.space.id===(nt==null?void 0:nt.space.id))return;Pe({...xf,color:zi.selectorColor,outlineColor:zi.selectorOutlineColor})}}},[p,nt,mt,mn,n,zi,fa,N==null?void 0:N.uid]),ba=React.useCallback(()=>{var of;p!=="idle"&&(p==="coordinate"&&zi.rightClickToExit?yt():p==="floor"&&(Pe(null),kt(null),_i(null),F(null),z(W.current),y("coordinate"),se.current=null),(of=n.current)==null||of.requestRender())},[p,zi,n,yt]),Sc=React.useCallback(()=>{ba()},[ba]);useWindowEvent("keydown",of=>{of.code==="Escape"&&ba()});const ms=React.useRef(!1),Xs=React.useRef(lt);Xs.current=lt;const Nl=React.useCallback(of=>{Xs.current(of)},[]),pu=React.useRef(pi);pu.current=pi;const yu=React.useCallback(of=>{pu.current(of)},[]),Ru=React.useRef(Sc);Ru.current=Sc;const Vd=React.useCallback(()=>{Ru.current()},[]);React.useEffect(()=>{ms.current||!n.current||(ms.current=!0,n.current.onMouseUp(Nl),n.current.onMouseMove(yu),n.current.onRightClick(Vd))},[n,Nl,yu,Vd]);const Gd=React.useRef(p);Gd.current=p;const uf=React.useRef(yt);uf.current=yt,React.useEffect(()=>{hf.current||c!=="spatialId"&&Gd.current!=="idle"&&uf.current()},[c]);const ff=React.useRef([]),pf=React.useCallback(of=>{ff.current.push(of)},[]);React.useImperativeHandle(t,()=>({pickSpace:Ra,onSpacePick:pf,exitPickSpace:yt}),[Ra,pf,yt]);const hf=React.useRef(!1);return React.useEffect(()=>{const of=gf=>{gf.code==="Space"&&Gd.current!=="idle"&&(hf.current=!0,d==null||d("move"))};return window.addEventListener("keydown",of),()=>{window.removeEventListener("keydown",of)}},[d]),React.useEffect(()=>window.addEventListener("keyup",of=>{of.code==="Space"&&hf.current&&(hf.current=!1,d==null||d("spatialId"))}),[d]),React.useEffect(()=>{h==null||h()},[h]),{spatialIdSpaces:S,verticalSpaceIndicator:L,coordinateSelector:N,spaceSelector:nt,groundIndicators:La}},SpatialId=({engineRef:t,geoidRef:n,terrainEnabled:o,interactionMode:s,overrideInteractionMode:c,onMount:d},h)=>{const{spatialIdSpaces:p,verticalSpaceIndicator:y,coordinateSelector:S,spaceSelector:P,groundIndicators:L}=useHooks$8({ref:h,engineRef:t,geoidRef:n,terrainEnabled:o,interactionMode:s,overrideInteractionMode:c,onMount:d});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[p&&p.length>0&&p.map(F=>jsxRuntimeExports.jsx(SpatialIdSpace,{space:F},F.id)),L&&L.length>0&&L.map(F=>jsxRuntimeExports.jsx(CoordinateIndicator,{wsen:F.wsen,color:F.color},F.id)),y&&jsxRuntimeExports.jsx(VerticalSpaceIndicator,{indicator:y}),S&&jsxRuntimeExports.jsx(CoordinateIndicator,{wsen:S.wsen,color:S.color}),P&&jsxRuntimeExports.jsx(SpatialIdSpace,{space:P})]})},SpatialId$1=React.forwardRef(SpatialId);/*! (c) Andrea Giammarchi - ISC */var self$1={};try{self$1.EventTarget=new EventTarget().constructor}catch(t){(function(n,o){var s=n.create,c=n.defineProperty,d=h.prototype;p(d,"addEventListener",function(S,P,L){for(var F=o.get(this),N=F[S]||(F[S]=[]),z=0,W=N.length;z<W;z++)if(N[z].listener===P)return;N.push({target:this,listener:P,options:L})}),p(d,"dispatchEvent",function(S){var P=o.get(this),L=P[S.type];return L&&(p(S,"target",this),p(S,"currentTarget",this),L.slice(0).some(y,S),delete S.currentTarget,delete S.target),!0}),p(d,"removeEventListener",function(S,P){for(var L=o.get(this),F=L[S]||(L[S]=[]),N=0,z=F.length;N<z;N++)if(F[N].listener===P){F.splice(N,1);return}}),self$1.EventTarget=h;function h(){o.set(this,s(null))}function p(S,P,L){c(S,P,{configurable:!0,writable:!0,value:L})}function y(S){var P=S.options;return P&&P.once&&S.target.removeEventListener(this.type,S.listener),typeof S.listener=="function"?S.listener.call(S.target,this):S.listener.handleEvent(this),this._stopImmediatePropagationFlag}})(Object,new WeakMap)}const EventTarget$1=self$1.EventTarget;function events(){const t=new EventTarget$1,n=new Map,o=(y,S)=>{let P=n.get(y);P||(P=new Map,n.set(y,P));let L=P.get(S);return L||(L=F=>{S(...F.detail)},P.set(S,L)),L},s=(y,S)=>{var P;(P=n.get(y))==null||P.delete(S)},c=(y,S)=>{const P=o(y,S);t.addEventListener(String(y),P)},d=(y,S)=>{const P=o(y,S);t.removeEventListener(String(y),P),s(y,P)},h=(y,S)=>{const P=o(y,S);t.addEventListener(String(y),P,{once:!0})};return[{get on(){return c},get off(){return d},get once(){return h}},(y,...S)=>t.dispatchEvent(new CustomEvent(String(y),{detail:S}))]}function mergeEvents(t,n,o){const s=o.reduce((c,d)=>({...c,[d]:(...h)=>{n(d,...h)}}),{});for(const c of Object.keys(s))t.on(c,s[c]);return()=>{for(const c of Object.keys(s))t.off(c,s[c])}}function MapFn({engines:t,engine:n,isBuilt:o,isEditable:s,clusters:c,hiddenLayers:d,layers:h,overrides:p,timelineManagerRef:y,interactionMode:S,selectedFeature:P,onLayerSelect:L,overrideInteractionMode:F,onSketchTypeChange:N,onSketchFeatureCreate:z,onSketchPluginFeatureCreate:W,onSketchFeatureUpdate:nt,onSketchPluginFeatureUpdate:Pe,onSketchFeatureDelete:se,onSketchPluginFeatureDelete:mt,featureFlags:kt=INTERACTION_MODES.default,onMount:mn,onAPIReady:_i,...zi},Sa){var pf,hf,of,gf;const fa=n?t==null?void 0:t[n]:void 0,La=fa==null?void 0:fa.component,{engineRef:Ra,layersRef:ma,sketchRef:yt,spatialIdRef:lt,geoidRef:pi,selectedLayer:ba,requestingRenderMode:Sc,handleLayerSelect:ms,handleEngineLayerSelect:Xs,sketchEditingFeature:Nl,setSketchEditingFeature:pu,handleEngineMount:yu,handleLayersMount:Ru,handleSketchMount:Vd,handleSpatialIdMount:Gd}=useHooks$c({ref:Sa,timelineManagerRef:y,onLayerSelect:L,onMount:mn,onAPIReady:_i}),uf=React.useMemo(()=>({layerId:ba.layerId,featureId:ba.featureId}),[ba.layerId,ba.featureId]),ff=React.useMemo(()=>ba.reason,[ba.reason]);return La?jsxRuntimeExports.jsxs(La,{ref:Ra,isBuilt:o,isEditable:s,selectedLayerId:uf,layerSelectionReason:ff,layersRef:ma,requestingRenderMode:Sc,timelineManagerRef:y,onLayerSelect:Xs,featureFlags:kt,onMount:yu,...zi,children:[jsxRuntimeExports.jsx(Layers$1,{ref:ma,engineRef:Ra,clusters:c,hiddenLayers:d,isBuilt:o,isEditable:s,layers:h,overrides:p,selectedLayer:ba,Feature:fa==null?void 0:fa.featureComponent,clusterComponent:fa==null?void 0:fa.clusterComponent,delegatedDataTypes:fa.delegatedDataTypes,meta:zi.meta,viewerProperty:zi.property,requestingRenderMode:Sc,sketchEditingFeature:Nl,onLayerSelect:ms,onMount:Ru}),jsxRuntimeExports.jsx(Sketch$1,{ref:yt,layersRef:ma,engineRef:Ra,interactionMode:S,selectedFeature:P,SketchComponent:fa==null?void 0:fa.sketchComponent,onLayerSelect:ms,overrideInteractionMode:F,onSketchTypeChange:N,onSketchFeatureCreate:z,onSketchPluginFeatureCreate:W,onSketchFeatureUpdate:nt,onSketchPluginFeatureUpdate:Pe,onSketchFeatureDelete:se,onSketchPluginFeatureDelete:mt,sketchEditingFeature:Nl,onSketchEditFeature:pu,onMount:Vd}),jsxRuntimeExports.jsx(SpatialId$1,{ref:lt,engineRef:Ra,geoidRef:pi,interactionMode:S,terrainEnabled:!!((hf=(pf=zi.property)==null?void 0:pf.terrain)!=null&&hf.enabled),overrideInteractionMode:F,onMount:Gd}),jsxRuntimeExports.jsx(Geoid$1,{ref:pi,geoidServer:(gf=(of=zi.property)==null?void 0:of.geoid)==null?void 0:gf.server})]}):null}const Map$1=React.forwardRef(MapFn),ErrorBoundaryContext=React.createContext(null),initialState={didCatch:!1,error:null};class ErrorBoundary extends React.Component{constructor(n){super(n),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=initialState}static getDerivedStateFromError(n){return{didCatch:!0,error:n}}resetErrorBoundary(){const{error:n}=this.state;if(n!==null){for(var o,s,c=arguments.length,d=new Array(c),h=0;h<c;h++)d[h]=arguments[h];(o=(s=this.props).onReset)===null||o===void 0||o.call(s,{args:d,reason:"imperative-api"}),this.setState(initialState)}}componentDidCatch(n,o){var s,c;(s=(c=this.props).onError)===null||s===void 0||s.call(c,n,o)}componentDidUpdate(n,o){const{didCatch:s}=this.state,{resetKeys:c}=this.props;if(s&&o.error!==null&&hasArrayChanged(n.resetKeys,c)){var d,h;(d=(h=this.props).onReset)===null||d===void 0||d.call(h,{next:c,prev:n.resetKeys,reason:"keys"}),this.setState(initialState)}}render(){const{children:n,fallbackRender:o,FallbackComponent:s,fallback:c}=this.props,{didCatch:d,error:h}=this.state;let p=n;if(d){const y={error:h,resetErrorBoundary:this.resetErrorBoundary};if(React.isValidElement(c))p=c;else if(typeof o=="function")p=o(y);else if(s)p=React.createElement(s,y);else throw h}return React.createElement(ErrorBoundaryContext.Provider,{value:{didCatch:d,error:h,resetErrorBoundary:this.resetErrorBoundary}},p)}}function hasArrayChanged(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return t.length!==n.length||t.some((o,s)=>!Object.is(o,n[s]))}const context$1=React.createContext(void 0),useVisualizer=()=>{const t=React.useContext(context$1);if(!t)throw new Error("Visualizer is not declared. You have to use this hook inside of Visualizer");return t},filterMapRefToContext=t=>t,VisualizerProvider=({mapRef:t,children:n})=>{const o=React.useMemo(()=>filterMapRefToContext(t),[t]);return jsxRuntimeExports.jsx(context$1.Provider,{value:o,children:n})},coreContext=React.createContext({}),Cluster=({property:t,children:n})=>{const{clusterPixelRange:o=15,clusterMinSize:s=3,clusterLabelTypography:c={fontFamily:"sans-serif",fontSize:30,fontWeight:400,color:"#FFF",textAlign:"center",bold:!1,italic:!1,underline:!1},clusterImage:d,clusterImageWidth:h,clusterImageHeight:p}=(t==null?void 0:t.default)??{},y=React.useMemo(()=>new Cesium$1.EntityCluster({enabled:!0,pixelRange:15,minimumClusterSize:2,clusterBillboards:!0,clusterLabels:!0,clusterPoints:!0}),[]);return React.useEffect(()=>{const S=React.Children.count(n)<s,P=y==null?void 0:y.clusterEvent.addEventListener((L,F)=>{F.label.font=toCSSFont(c,{fontSize:30}),F.label.horizontalOrigin=c.textAlign==="right"?Cesium$1.HorizontalOrigin.LEFT:c.textAlign==="left"?Cesium$1.HorizontalOrigin.RIGHT:Cesium$1.HorizontalOrigin.CENTER,F.label.verticalOrigin=Cesium$1.VerticalOrigin.CENTER,F.label.fillColor=Cesium$1.Color.fromCssColorString(c.color??"#FFF"),F.label.eyeOffset=new Cesium$1.Cartesian3(0,0,-5),F.billboard.show=!0,F.billboard.image=d,F.billboard.height=p,F.billboard.width=h,y.minimumClusterSize=S?React.Children.count(n):s});return y.enabled=!S,y.pixelRange=0,y.pixelRange=o,()=>{P()}},[s,o,c,d,p,h,n,y]),y?jsxRuntimeExports.jsx(Os$1,{show:!0,clustering:y,children:n}):null};function ReearthClock({timelineManagerRef:t}){var z,W;const{start:n,stop:o,current:s}=((z=t==null?void 0:t.current)==null?void 0:z.computedTimeline)??{},{animation:c,stepType:d,rangeType:h,multiplier:p}=((W=t==null?void 0:t.current)==null?void 0:W.options)??{},y=React.useMemo(()=>n?Cesium$1.JulianDate.fromDate(n):void 0,[n]),S=React.useMemo(()=>o?Cesium$1.JulianDate.fromDate(o):void 0,[o]),P=React.useMemo(()=>s?Cesium$1.JulianDate.fromDate(s):void 0,[s]),L=d==="fixed"?Cesium$1.ClockStep.TICK_DEPENDENT:Cesium$1.ClockStep.SYSTEM_CLOCK_MULTIPLIER,F=p??1,N=React.useCallback(nt=>{var mt,kt;const Pe=Cesium$1.JulianDate.toDate(nt.startTime),se=Cesium$1.JulianDate.toDate(nt.stopTime);(kt=(mt=t==null?void 0:t.current)==null?void 0:mt.handleTick)==null||kt.call(mt,Cesium$1.JulianDate.toDate(nt.currentTime),{start:Pe,stop:se})},[t]);return jsxRuntimeExports.jsx(Ms$1,{shouldAnimate:c,canAnimate:c,startTime:y,stopTime:S,currentTime:P,clockStep:L,multiplier:F,clockRange:h?rangeTypes[h]:void 0,onTick:N})}const rangeTypes={unbounded:Cesium$1.ClockRange.UNBOUNDED,clamped:Cesium$1.ClockRange.CLAMPED,bounced:Cesium$1.ClockRange.LOOP_STOP},DEFAULT_SCREEN_SPACE_CAMERA_ASSIGNMENTS={translateEventTypes:Cesium$1.CameraEventType.LEFT_DRAG,zoomEventTypes:[Cesium$1.CameraEventType.RIGHT_DRAG,Cesium$1.CameraEventType.WHEEL,Cesium$1.CameraEventType.PINCH],rotateEventTypes:Cesium$1.CameraEventType.LEFT_DRAG,tiltEventTypes:[Cesium$1.CameraEventType.MIDDLE_DRAG,Cesium$1.CameraEventType.PINCH,{eventType:Cesium$1.CameraEventType.LEFT_DRAG,modifier:Cesium$1.KeyboardEventModifier.CTRL},{eventType:Cesium$1.CameraEventType.RIGHT_DRAG,modifier:Cesium$1.KeyboardEventModifier.CTRL}],lookEventTypes:[{eventType:Cesium$1.CameraEventType.LEFT_DRAG,modifier:Cesium$1.KeyboardEventModifier.SHIFT}]},layerIdField="__reearth_layer_id",defaultImageSize=50,drawIcon=(t,n,o,s="none",c=!1,d="rgba(0, 0, 0, 0.7)",h=3,p=0,y=0)=>{const S=document.createElement("canvas"),P=S.getContext("2d");if(!(!t||!P))return P.save(),S.width=n+h*2,S.height=o+h*2,P.shadowBlur=h,P.shadowOffsetX=p,P.shadowOffsetY=y,P.globalCompositeOperation="source-over",P.clearRect(0,0,S.width,S.height),P.drawImage(t,(S.width-n)/2,(S.height-o)/2,n,o),s==="circle"?(P.fillStyle="black",P.globalCompositeOperation="destination-in",P.arc(S.width/2,S.height/2,Math.min(n,o)/2,0,2*Math.PI),P.fill(),c&&(P.shadowColor=d,P.globalCompositeOperation="destination-over",P.fillStyle="black",P.arc(S.width/2,S.height/2,Math.min(n,o)/2,0,2*Math.PI),P.fill())):c&&(P.shadowColor=d,P.globalCompositeOperation="destination-over",P.fillStyle="black",P.rect((S.width-n)/2,(S.height-o)/2,n,o),P.fill()),P.restore(),S.toDataURL()},useIcon=({image:t,imageSize:n,crop:o,shadow:s,shadowColor:c,shadowBlur:d,shadowOffsetX:h,shadowOffsetY:p})=>{const y=useImage(t),S=y?typeof n=="number"?Math.floor(y.width*n):Math.min(defaultImageSize,y.width):0,P=y?Math.floor(typeof n=="number"?y.height*n:S/y.width*y.height):0;return[React.useMemo(()=>drawIcon(y,S,P,o,s,c,d,h,p),[o,P,y,s,d,c,h,p,S])??"",S,P]},ho$1=t=>({left:Cesium$1.HorizontalOrigin.LEFT,center:Cesium$1.HorizontalOrigin.CENTER,right:Cesium$1.HorizontalOrigin.RIGHT,"":void 0})[t||""],vo$1=t=>({top:Cesium$1.VerticalOrigin.TOP,center:Cesium$1.VerticalOrigin.CENTER,baseline:Cesium$1.VerticalOrigin.BASELINE,bottom:Cesium$1.VerticalOrigin.BOTTOM,"":void 0})[t||""],getLocationFromScreen=(t,n,o,s=!1)=>{if(!t)return;const c=t.camera,d=t.globe.ellipsoid;let h;if(s){const P=c.getPickRay(new Cesium$1.Cartesian2(n,o));P&&(h=t.globe.pick(P,t))}if(h||(h=c==null?void 0:c.pickEllipsoid(new Cesium$1.Cartesian2(n,o),d)),!h)return;const{latitude:p,longitude:y,height:S}=d.cartesianToCartographic(h);return{lat:Cesium$1.Math.toDegrees(p),lng:Cesium$1.Math.toDegrees(y),height:S}},getRayEllipsoidIntersection=(t,n,o)=>{const s=Cesium$1.IntersectionTests.rayEllipsoid(t,n);if(!s){const c=Cesium$1.IntersectionTests.grazingAltitudeLocation(t,n);return o?c.clone(o):c}return Cesium$1.Ray.getPoint(t,s.start,o)},createRayFromCamera=t=>{const n=new Cesium$1.Ray;return t.positionWC.clone(n.origin),t.directionWC.clone(n.direction),n},getCameraEllipsoidIntersection=(t,n,o)=>{let s;const{camera:c,globe:d}=t;if(n instanceof Cesium$1.Cartesian2){if(s=c.getPickRay(n,new Cesium$1.Ray),!s)return}else s=createRayFromCamera(c),o=n;return getRayEllipsoidIntersection(s,d.ellipsoid,o)},getCameraTerrainIntersection=t=>{const n=createRayFromCamera(t.camera);return t.globe.pick(n,t)},cartesianToLatLngHeight=(t,n)=>{const o=Cesium$1.Cartographic.fromCartesian(t,n.globe.ellipsoid);return{lng:Cesium$1.Math.toDegrees(o.longitude),lat:Cesium$1.Math.toDegrees(o.latitude),height:o.height}},flyTo=(t,n,o)=>{if(!t||!n)return()=>{};const s=animateFOV({fov:n.fov,camera:t,duration:o==null?void 0:o.duration,easing:o==null?void 0:o.easing}),c=typeof n.lat=="number"&&typeof n.lng=="number"&&typeof n.height=="number"?Cesium$1.Cartesian3.fromDegrees(n.lng,n.lat,n.height):void 0;return c&&t.flyTo({destination:c,orientation:{heading:n.heading,pitch:n.pitch,roll:n.roll},duration:(o==null?void 0:o.duration)??0,easingFunction:o==null?void 0:o.easing}),()=>{s==null||s(),t==null||t.cancelFlight()}},lookAt=(t,n,o)=>{if(!t||!n)return()=>{};const s=animateFOV({fov:n.fov,camera:t,duration:o==null?void 0:o.duration,easing:o==null?void 0:o.easing}),c=typeof n.lat=="number"&&typeof n.lng=="number"&&typeof n.height=="number"?Cesium$1.Cartesian3.fromDegrees(n.lng,n.lat,n.height):void 0;return c&&t.flyToBoundingSphere(new Cesium$1.BoundingSphere(c,n.radius),{offset:n.heading!==void 0||n.pitch!==void 0||n.range!==void 0?new Cesium$1.HeadingPitchRange(n.heading,n.pitch,n.range):void 0,duration:o==null?void 0:o.duration,easingFunction:o==null?void 0:o.easing}),()=>{s==null||s(),t==null||t.cancelFlight()}},lookAtWithoutAnimation=(t,n)=>{if(!n)return;const o=typeof n.lat=="number"&&typeof n.lng=="number"?Cesium$1.Cartesian3.fromDegrees(n.lng,n.lat,n.height):void 0;o&&t.camera.lookAtTransform(Cesium$1.Matrix4.fromTranslation(o))},animateFOV=({fov:t,camera:n,easing:o,duration:s})=>{if(typeof t=="number"&&n.frustum instanceof Cesium$1.PerspectiveFrustum&&typeof n.frustum.fov=="number"&&n.frustum.fov!==t){const c=n.frustum.fov;return tweenInterval(d=>{n.frustum instanceof Cesium$1.PerspectiveFrustum&&(n.frustum.fov=(t-c)*d+c)},o||"inOutCubic",(s??0)*1e3)}},getCenterCamera=({camera:t,scene:n})=>{const o=new Cesium$1.Cartesian3,s=t.getPickRay(t.positionWC);if(s)return s.origin=t.positionWC,s.direction=t.directionWC,n.globe.pick(s,n,o)},zoom=({viewer:t,relativeAmount:n},o)=>{const{camera:s,scene:c}=t;if(c.mode!==Cesium$1.SceneMode.SCENE3D){const F=getCamera(t);flyTo(s,{...F,height:((F==null?void 0:F.height)||1)*n},{duration:.5});return}const h=getCenterCamera({camera:s,scene:c})||Cesium$1.IntersectionTests.grazingAltitudeLocation(new Cesium$1.Ray(c.globe.ellipsoid.cartographicToCartesian(s.positionCartographic),s.directionWC),c.globe.ellipsoid);if(!h)return;const p={heading:s.heading,pitch:s.pitch,roll:s.roll},y=new Cesium$1.Cartesian3,S=Cesium$1.Cartesian3.subtract(s.position,h,y),P=Cesium$1.Cartesian3.multiplyByScalar(S,n,S),L=Cesium$1.Cartesian3.add(h,P,h);s.flyTo({destination:L,orientation:p,duration:(o==null?void 0:o.duration)||.5,convert:!1})},getCamera=t=>{if(!t||t.isDestroyed()||!t.camera||!t.scene)return;const{camera:n}=t;if(!(n.frustum instanceof Cesium$1.PerspectiveFrustum||n.frustum instanceof Cesium$1.OrthographicOffCenterFrustum))return;const{latitude:o,longitude:s,height:c}=n.positionCartographic,d=Cesium$1.Math.toDegrees(o),h=Cesium$1.Math.toDegrees(s),{heading:p,pitch:y,roll:S}=n,P=n.frustum instanceof Cesium$1.PerspectiveFrustum?n.frustum.fov:1,L=n.frustum instanceof Cesium$1.PerspectiveFrustum?n.frustum.aspectRatio:1;return{lng:h,lat:d,height:c,heading:p,pitch:y,roll:S,fov:P,aspectRatio:L}},getClock=t=>{if(t)return{get start(){return Cesium$1.JulianDate.toDate(t.startTime)},get stop(){return Cesium$1.JulianDate.toDate(t.stopTime)},get current(){return Cesium$1.JulianDate.toDate(t.currentTime)},get playing(){return t.shouldAnimate},get speed(){return t.multiplier}}},colorBlendMode=t=>({highlight:Cesium$1.ColorBlendMode.HIGHLIGHT,replace:Cesium$1.ColorBlendMode.REPLACE,mix:Cesium$1.ColorBlendMode.MIX})[t||""],colorBlendModeFor3DTile=(t="highlight")=>({highlight:Cesium$1.Cesium3DTileColorBlendMode.HIGHLIGHT,replace:Cesium$1.Cesium3DTileColorBlendMode.REPLACE,mix:Cesium$1.Cesium3DTileColorBlendMode.MIX})[t],heightReference=t=>({clamp:Cesium$1.HeightReference.CLAMP_TO_GROUND,relative:Cesium$1.HeightReference.RELATIVE_TO_GROUND,none:Cesium$1.HeightReference.NONE})[t||""],getOverriddenScreenSpaceCameraOptions=t=>{if(!t)return;const n=new Map([["left_drag",Cesium$1.CameraEventType.LEFT_DRAG],["right_drag",Cesium$1.CameraEventType.RIGHT_DRAG],["middle_drag",Cesium$1.CameraEventType.MIDDLE_DRAG],["wheel",Cesium$1.CameraEventType.WHEEL],["pinch",Cesium$1.CameraEventType.PINCH]]),o=new Map([["ctrl",Cesium$1.KeyboardEventModifier.CTRL],["shift",Cesium$1.KeyboardEventModifier.SHIFT],["alt",Cesium$1.KeyboardEventModifier.ALT]]),s=S=>{if(S)return S.map(P=>typeof P=="string"?n.get(P):{eventType:n.get(P.eventType),modifier:o.get(P.modifier)})},c=s(t.translateEventTypes),d=s(t.zoomEventTypes),h=s(t.rotateEventTypes),p=s(t.tiltEventTypes),y=s(t.lookEventTypes);return{...DEFAULT_SCREEN_SPACE_CAMERA_ASSIGNMENTS,...c&&{translateEventTypes:c},...d&&{zoomEventTypes:d},...h&&{rotateEventTypes:h},...p&&{tiltEventTypes:p},...y&&{lookEventTypes:y},...t.minimumZoomDistance!==void 0&&{minimumZoomDistance:t.minimumZoomDistance},...t.maximumZoomDistance!==void 0&&{maximumZoomDistance:t.maximumZoomDistance},...t.enableCollisionDetection!==void 0&&{enableCollisionDetection:t.enableCollisionDetection}}},classificationType=t=>({both:Cesium$1.ClassificationType.BOTH,"3dtiles":Cesium$1.ClassificationType.CESIUM_3D_TILE,terrain:Cesium$1.ClassificationType.TERRAIN})[t||""],shadowMode=t=>({enabled:Cesium$1.ShadowMode.ENABLED,cast_only:Cesium$1.ShadowMode.CAST_ONLY,receive_only:Cesium$1.ShadowMode.RECEIVE_ONLY,disabled:Cesium$1.ShadowMode.DISABLED})[t||""],unselectableTag="reearth_unselectable",draggableTag="reearth_draggable";function isSelectable(t){var n;return!((n=t==null?void 0:t.properties)!=null&&n.hasProperty(unselectableTag))}function isDraggable(t){var n;return(n=t.properties)==null?void 0:n[draggableTag]}function lookHorizontal(t,n){const o=t.camera,c=t.globe.ellipsoid.geodeticSurfaceNormal(o.position,new Cesium$1.Cartesian3);o.look(c,n)}function lookVertical(t,n){const o=t.camera,s=t.globe.ellipsoid,c=projectVectorToSurface(o.right,o.position,s),d=s.geodeticSurfaceNormal(o.position,new Cesium$1.Cartesian3),h=Cesium$1.Math.toDegrees(Cesium$1.Cartesian3.angleBetween(d,o.up)),p=rotateVectorAboutAxis(o.up,c,n),S=Cesium$1.Math.toDegrees(Cesium$1.Cartesian3.angleBetween(d,p))<h?1:(90-h)/90;o.look(c,n*S)}function moveForward(t,n){const o=projectVectorToSurface(t.camera.direction,t.camera.position,t.globe.ellipsoid);t.camera.move(o,n)}function moveBackward(t,n){const o=projectVectorToSurface(t.camera.direction,t.camera.position,t.globe.ellipsoid);t.camera.move(o,-n)}function moveUp(t,n){const o=t.globe.ellipsoid.geodeticSurfaceNormal(t.camera.position,new Cesium$1.Cartesian3);t.camera.move(o,n)}function moveDown(t,n){const o=t.globe.ellipsoid.geodeticSurfaceNormal(t.camera.position,new Cesium$1.Cartesian3);t.camera.move(o,-n)}function moveLeft(t,n){const o=projectVectorToSurface(t.camera.right,t.camera.position,t.globe.ellipsoid);t.camera.move(o,-n)}function moveRight(t,n){const o=projectVectorToSurface(t.camera.right,t.camera.position,t.globe.ellipsoid);t.camera.move(o,n)}async function moveOverTerrain(t,n=0){const o=getCamera(t);if((o==null?void 0:o.lng)===void 0||(o==null?void 0:o.lat)===void 0)return;const s=await sampleTerrainHeight(t.scene,o.lng,o.lat);if(s&&s!==0){const c=getCamera(t);c&&(c==null?void 0:c.height)<s+n&&t.scene.camera.moveUp(s+n-c.height)}}async function flyToGround(t,n,o,s,c=0){var p,y;if(o.lng===void 0||o.lat===void 0)return;const d=await sampleTerrainHeight(t.scene,o.lng,o.lat),h=d?d+c:c;(p=n.current)==null||p.call(n),n.current=flyTo((y=t.scene)==null?void 0:y.camera,{...getCamera(t),...o,height:h},s)}function projectVectorToSurface(t,n,o){const s=o.geodeticSurfaceNormal(n,new Cesium$1.Cartesian3),c=Cesium$1.Cartesian3.dot(t,s),d=Cesium$1.Cartesian3.multiplyByScalar(s,c,new Cesium$1.Cartesian3);return Cesium$1.Cartesian3.subtract(t,d,new Cesium$1.Cartesian3)}function rotateVectorAboutAxis(t,n,o){const s=Cesium$1.Quaternion.fromAxisAngle(n,-o,new Cesium$1.Quaternion),c=Cesium$1.Matrix3.fromQuaternion(s,new Cesium$1.Matrix3);return Cesium$1.Matrix3.multiplyByVector(c,t,t.clone())}async function sampleTerrainHeight(t,n,o){const s=t.terrainProvider;if(s instanceof Cesium$1.EllipsoidTerrainProvider)return 0;const[c]=await Cesium$1.sampleTerrainMostDetailed(s,[Cesium$1.Cartographic.fromDegrees(n,o)]);return c.height}async function sampleTerrainHeightFromCartesian(t,n){const o=Cesium$1.Cartographic.fromCartesian(n),[s,c]=[Cesium$1.Math.toDegrees((o==null?void 0:o.longitude)||0),Cesium$1.Math.toDegrees((o==null?void 0:o.latitude)||0)];if(!(!s||!c))return await sampleTerrainHeight(t,s,c)}const isColor=t=>t==null?void 0:t.match(/^#[A-Fa-f0-9]|^rgba?/),toColor$1=t=>{if(!t||typeof t!="string")return;const n=t.match(/^#([A-Fa-f0-9]{6})([A-Fa-f0-9]{2})$|^#([A-Fa-f0-9]{3})([A-Fa-f0-9])$/);if(!n)return Cesium$1.Color.fromCssColorString(t);const o=parseInt(n[4]?n[4].repeat(2):n[2],16)/255;return Cesium$1.Color.fromCssColorString(`#${n[1]??n[3]}`).withAlpha(o)},updateMapController=(t,n)=>{t.scene.screenSpaceCameraController.enableTranslate=n,t.scene.screenSpaceCameraController.enableRotate=n,t.scene.screenSpaceCameraController.enableLook=n,t.scene.screenSpaceCameraController.enableTilt=n,t.scene.screenSpaceCameraController.enableZoom=n};function getExtrudedHeight(t,n,o,s=!1){const c=new Cesium$1.Cartesian3,d=new Cesium$1.Cartesian3,h=new Cesium$1.Ray,p=new Cesium$1.Plane(Cesium$1.Cartesian3.UNIT_X,0),y=new Cesium$1.Cartographic;let S;try{const P=t.globe.ellipsoid.geodeticSurfaceNormal(n,d),L=t.camera.getPickRay(o,h);if(L==null)return;const F=Cesium$1.Plane.fromPointNormal(n,Cesium$1.Cartesian3.normalize(Cesium$1.Cartesian3.cross(P,Cesium$1.Cartesian3.cross(P,L.direction,c),c),c),p);if(S=Cesium$1.IntersectionTests.rayPlane(L,F,c),S==null)return;const N=Cesium$1.Cartographic.fromCartesian(S,t.globe.ellipsoid,y).height,z=Cesium$1.Cartographic.fromCartesian(n,t.globe.ellipsoid,y).height;return s?N-z:Math.max(0,N-z)}catch(P){console.error(P)}}function getCredits(t){if(!t)return;const n=t.creditDisplay;if(!n)return;const{lightboxCredits:o,screenCredits:s}=(n==null?void 0:n._currentFrameCredits)||{},c=n._currentCesiumCredit;return{engine:{cesium:c!=null&&c.html?{html:c.html}:void 0},lightbox:Array.from((o==null?void 0:o._array)??[]).map(h=>{var p;return{html:(p=h==null?void 0:h.credit)==null?void 0:p.html}}),screen:Array.from((s==null?void 0:s._array)??[]).map(h=>{var p;return{html:(p=h==null?void 0:h.credit)==null?void 0:p.html}})}}function Globe({property:t,cesiumIonAccessToken:n,onTerrainProviderChange:o}){var h,p,y,S,P,L,F,N,z,W,nt,Pe,se,mt,kt,mn,_i,zi,Sa,fa,La,Ra;const s=React.useMemo(()=>({...t==null?void 0:t.terrain}),[t==null?void 0:t.terrain]),c=React.useMemo(()=>{var lt,pi,ba,Sc,ms,Xs,Nl,pu,yu;const ma={terrain:s==null?void 0:s.enabled,terrainType:s==null?void 0:s.type,normal:s==null?void 0:s.normal,ionAccessToken:((ba=(pi=(lt=t==null?void 0:t.assets)==null?void 0:lt.cesium)==null?void 0:pi.terrain)==null?void 0:ba.ionAccessToken)||n,ionAsset:(Xs=(ms=(Sc=t==null?void 0:t.assets)==null?void 0:Sc.cesium)==null?void 0:ms.terrain)==null?void 0:Xs.ionAsset,ionUrl:(yu=(pu=(Nl=t==null?void 0:t.assets)==null?void 0:Nl.cesium)==null?void 0:pu.terrain)==null?void 0:yu.ionUrl},yt=ma.terrain?terrainProviders[ma.terrainType||"cesium"]:void 0;return(typeof yt=="function"?yt(ma):yt)??defaultTerrainProvider},[s==null?void 0:s.enabled,s==null?void 0:s.type,s==null?void 0:s.normal,(y=(p=(h=t==null?void 0:t.assets)==null?void 0:h.cesium)==null?void 0:p.terrain)==null?void 0:y.ionAccessToken,(L=(P=(S=t==null?void 0:t.assets)==null?void 0:S.cesium)==null?void 0:P.terrain)==null?void 0:L.ionAsset,(z=(N=(F=t==null?void 0:t.assets)==null?void 0:F.cesium)==null?void 0:N.terrain)==null?void 0:z.ionUrl,n]),d=React.useMemo(()=>{var ma;return toColor$1((ma=t==null?void 0:t.globe)==null?void 0:ma.baseColor)},[(W=t==null?void 0:t.globe)==null?void 0:W.baseColor]);return React.useEffect(()=>{o==null||o()},[c,o]),jsxRuntimeExports.jsx(js$4,{baseColor:d,enableLighting:!!((nt=t==null?void 0:t.globe)!=null&&nt.enableLighting),showGroundAtmosphere:((se=(Pe=t==null?void 0:t.globe)==null?void 0:Pe.atmosphere)==null?void 0:se.enabled)??!0,atmosphereLightIntensity:(kt=(mt=t==null?void 0:t.globe)==null?void 0:mt.atmosphere)==null?void 0:kt.lightIntensity,atmosphereSaturationShift:(_i=(mn=t==null?void 0:t.globe)==null?void 0:mn.atmosphere)==null?void 0:_i.saturationShift,atmosphereHueShift:(Sa=(zi=t==null?void 0:t.globe)==null?void 0:zi.atmosphere)==null?void 0:Sa.hueShift,atmosphereBrightnessShift:(La=(fa=t==null?void 0:t.globe)==null?void 0:fa.atmosphere)==null?void 0:La.brightnessShift,terrainProvider:c,depthTestAgainstTerrain:!!((Ra=t==null?void 0:t.globe)!=null&&Ra.depthTestAgainstTerrain)})}const defaultTerrainProvider=new Cesium$1.EllipsoidTerrainProvider,terrainProviders={cesium:({ionAccessToken:t,normal:n})=>Cesium$1.CesiumTerrainProvider.fromUrl(Cesium$1.IonResource.fromAssetId(1,{accessToken:t}),{requestVertexNormals:n,requestWaterMask:!1}),arcgis:()=>Cesium$1.ArcGISTiledElevationTerrainProvider.fromUrl("https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer"),cesiumion:({ionAccessToken:t,ionAsset:n,ionUrl:o,normal:s})=>n?Cesium$1.CesiumTerrainProvider.fromUrl(o||Cesium$1.IonResource.fromAssetId(parseInt(n,10),{accessToken:t}),{requestVertexNormals:s}):null};function defined(t){return t!=null}function DeveloperError(t){this.name="DeveloperError",this.message=t;let n;try{throw new Error}catch(o){n=o.stack}this.stack=n}defined(Object.create)&&(DeveloperError.prototype=Object.create(Error.prototype),DeveloperError.prototype.constructor=DeveloperError),DeveloperError.prototype.toString=function(){let t=`${this.name}: ${this.message}`;return defined(this.stack)&&(t+=`
|
|
125
125
|
${this.stack.toString()}`),t},DeveloperError.throwInstantiationError=function(){throw new DeveloperError("This function defines an interface and should not be called directly.")};const Check={};Check.typeOf={};function getUndefinedErrorMessage(t){return`${t} is required, actual value was undefined`}function getFailedTypeErrorMessage(t,n,o){return`Expected ${o} to be typeof ${n}, actual typeof was ${t}`}Check.defined=function(t,n){if(!defined(n))throw new DeveloperError(getUndefinedErrorMessage(t))},Check.typeOf.func=function(t,n){if(typeof n!="function")throw new DeveloperError(getFailedTypeErrorMessage(typeof n,"function",t))},Check.typeOf.string=function(t,n){if(typeof n!="string")throw new DeveloperError(getFailedTypeErrorMessage(typeof n,"string",t))},Check.typeOf.number=function(t,n){if(typeof n!="number")throw new DeveloperError(getFailedTypeErrorMessage(typeof n,"number",t))},Check.typeOf.number.lessThan=function(t,n,o){if(Check.typeOf.number(t,n),n>=o)throw new DeveloperError(`Expected ${t} to be less than ${o}, actual value was ${n}`)},Check.typeOf.number.lessThanOrEquals=function(t,n,o){if(Check.typeOf.number(t,n),n>o)throw new DeveloperError(`Expected ${t} to be less than or equal to ${o}, actual value was ${n}`)},Check.typeOf.number.greaterThan=function(t,n,o){if(Check.typeOf.number(t,n),n<=o)throw new DeveloperError(`Expected ${t} to be greater than ${o}, actual value was ${n}`)},Check.typeOf.number.greaterThanOrEquals=function(t,n,o){if(Check.typeOf.number(t,n),n<o)throw new DeveloperError(`Expected ${t} to be greater than or equal to ${o}, actual value was ${n}`)},Check.typeOf.object=function(t,n){if(typeof n!="object")throw new DeveloperError(getFailedTypeErrorMessage(typeof n,"object",t))},Check.typeOf.bool=function(t,n){if(typeof n!="boolean")throw new DeveloperError(getFailedTypeErrorMessage(typeof n,"boolean",t))},Check.typeOf.bigint=function(t,n){if(typeof n!="bigint")throw new DeveloperError(getFailedTypeErrorMessage(typeof n,"bigint",t))},Check.typeOf.number.equals=function(t,n,o,s){if(Check.typeOf.number(t,o),Check.typeOf.number(n,s),o!==s)throw new DeveloperError(`${t} must be equal to ${n}, the actual values are ${o} and ${s}`)};function defaultValue(t,n){return t??n}defaultValue.EMPTY_OBJECT=Object.freeze({});var MersenneTwister=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)};MersenneTwister.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}},MersenneTwister.prototype.init_by_array=function(t,n){var o,s,c;for(this.init_seed(19650218),o=1,s=0,c=this.N>n?this.N:n;c;c--){var d=this.mt[o-1]^this.mt[o-1]>>>30;this.mt[o]=(this.mt[o]^(((d&4294901760)>>>16)*1664525<<16)+(d&65535)*1664525)+t[s]+s,this.mt[o]>>>=0,o++,s++,o>=this.N&&(this.mt[0]=this.mt[this.N-1],o=1),s>=n&&(s=0)}for(c=this.N-1;c;c--){var d=this.mt[o-1]^this.mt[o-1]>>>30;this.mt[o]=(this.mt[o]^(((d&4294901760)>>>16)*1566083941<<16)+(d&65535)*1566083941)-o,this.mt[o]>>>=0,o++,o>=this.N&&(this.mt[0]=this.mt[this.N-1],o=1)}this.mt[0]=2147483648},MersenneTwister.prototype.random_int=function(){var t,n=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var o;for(this.mti==this.N+1&&this.init_seed(5489),o=0;o<this.N-this.M;o++)t=this.mt[o]&this.UPPER_MASK|this.mt[o+1]&this.LOWER_MASK,this.mt[o]=this.mt[o+this.M]^t>>>1^n[t&1];for(;o<this.N-1;o++)t=this.mt[o]&this.UPPER_MASK|this.mt[o+1]&this.LOWER_MASK,this.mt[o]=this.mt[o+(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},MersenneTwister.prototype.random_int31=function(){return this.random_int()>>>1},MersenneTwister.prototype.random_incl=function(){return this.random_int()*(1/4294967295)},MersenneTwister.prototype.random=function(){return this.random_int()*(1/4294967296)},MersenneTwister.prototype.random_excl=function(){return(this.random_int()+.5)*(1/4294967296)},MersenneTwister.prototype.random_long=function(){var t=this.random_int()>>>5,n=this.random_int()>>>6;return(t*67108864+n)*(1/9007199254740992)};var mersenneTwister=MersenneTwister;const MersenneTwister$1=getDefaultExportFromCjs(mersenneTwister),CesiumMath={};CesiumMath.EPSILON1=.1,CesiumMath.EPSILON2=.01,CesiumMath.EPSILON3=.001,CesiumMath.EPSILON4=1e-4,CesiumMath.EPSILON5=1e-5,CesiumMath.EPSILON6=1e-6,CesiumMath.EPSILON7=1e-7,CesiumMath.EPSILON8=1e-8,CesiumMath.EPSILON9=1e-9,CesiumMath.EPSILON10=1e-10,CesiumMath.EPSILON11=1e-11,CesiumMath.EPSILON12=1e-12,CesiumMath.EPSILON13=1e-13,CesiumMath.EPSILON14=1e-14,CesiumMath.EPSILON15=1e-15,CesiumMath.EPSILON16=1e-16,CesiumMath.EPSILON17=1e-17,CesiumMath.EPSILON18=1e-18,CesiumMath.EPSILON19=1e-19,CesiumMath.EPSILON20=1e-20,CesiumMath.EPSILON21=1e-21,CesiumMath.GRAVITATIONALPARAMETER=3986004418e5,CesiumMath.SOLAR_RADIUS=6955e5,CesiumMath.LUNAR_RADIUS=1737400,CesiumMath.SIXTY_FOUR_KILOBYTES=64*1024,CesiumMath.FOUR_GIGABYTES=4*1024*1024*1024,CesiumMath.sign=defaultValue(Math.sign,function(n){return n=+n,n===0||n!==n?n:n>0?1:-1}),CesiumMath.signNotZero=function(t){return t<0?-1:1},CesiumMath.toSNorm=function(t,n){return n=defaultValue(n,255),Math.round((CesiumMath.clamp(t,-1,1)*.5+.5)*n)},CesiumMath.fromSNorm=function(t,n){return n=defaultValue(n,255),CesiumMath.clamp(t,0,n)/n*2-1},CesiumMath.normalize=function(t,n,o){return o=Math.max(o-n,0),o===0?0:CesiumMath.clamp((t-n)/o,0,1)},CesiumMath.sinh=defaultValue(Math.sinh,function(n){return(Math.exp(n)-Math.exp(-n))/2}),CesiumMath.cosh=defaultValue(Math.cosh,function(n){return(Math.exp(n)+Math.exp(-n))/2}),CesiumMath.lerp=function(t,n,o){return(1-o)*t+o*n},CesiumMath.PI=Math.PI,CesiumMath.ONE_OVER_PI=1/Math.PI,CesiumMath.PI_OVER_TWO=Math.PI/2,CesiumMath.PI_OVER_THREE=Math.PI/3,CesiumMath.PI_OVER_FOUR=Math.PI/4,CesiumMath.PI_OVER_SIX=Math.PI/6,CesiumMath.THREE_PI_OVER_TWO=3*Math.PI/2,CesiumMath.TWO_PI=2*Math.PI,CesiumMath.ONE_OVER_TWO_PI=1/(2*Math.PI),CesiumMath.RADIANS_PER_DEGREE=Math.PI/180,CesiumMath.DEGREES_PER_RADIAN=180/Math.PI,CesiumMath.RADIANS_PER_ARCSECOND=CesiumMath.RADIANS_PER_DEGREE/3600,CesiumMath.toRadians=function(t){if(!defined(t))throw new DeveloperError("degrees is required.");return t*CesiumMath.RADIANS_PER_DEGREE},CesiumMath.toDegrees=function(t){if(!defined(t))throw new DeveloperError("radians is required.");return t*CesiumMath.DEGREES_PER_RADIAN},CesiumMath.convertLongitudeRange=function(t){if(!defined(t))throw new DeveloperError("angle is required.");const n=CesiumMath.TWO_PI,o=t-Math.floor(t/n)*n;return o<-Math.PI?o+n:o>=Math.PI?o-n:o},CesiumMath.clampToLatitudeRange=function(t){if(!defined(t))throw new DeveloperError("angle is required.");return CesiumMath.clamp(t,-1*CesiumMath.PI_OVER_TWO,CesiumMath.PI_OVER_TWO)},CesiumMath.negativePiToPi=function(t){if(!defined(t))throw new DeveloperError("angle is required.");return t>=-CesiumMath.PI&&t<=CesiumMath.PI?t:CesiumMath.zeroToTwoPi(t+CesiumMath.PI)-CesiumMath.PI},CesiumMath.zeroToTwoPi=function(t){if(!defined(t))throw new DeveloperError("angle is required.");if(t>=0&&t<=CesiumMath.TWO_PI)return t;const n=CesiumMath.mod(t,CesiumMath.TWO_PI);return Math.abs(n)<CesiumMath.EPSILON14&&Math.abs(t)>CesiumMath.EPSILON14?CesiumMath.TWO_PI:n},CesiumMath.mod=function(t,n){if(!defined(t))throw new DeveloperError("m is required.");if(!defined(n))throw new DeveloperError("n is required.");if(n===0)throw new DeveloperError("divisor cannot be 0.");return CesiumMath.sign(t)===CesiumMath.sign(n)&&Math.abs(t)<Math.abs(n)?t:(t%n+n)%n},CesiumMath.equalsEpsilon=function(t,n,o,s){if(!defined(t))throw new DeveloperError("left is required.");if(!defined(n))throw new DeveloperError("right is required.");o=defaultValue(o,0),s=defaultValue(s,o);const c=Math.abs(t-n);return c<=s||c<=o*Math.max(Math.abs(t),Math.abs(n))},CesiumMath.lessThan=function(t,n,o){if(!defined(t))throw new DeveloperError("first is required.");if(!defined(n))throw new DeveloperError("second is required.");if(!defined(o))throw new DeveloperError("absoluteEpsilon is required.");return t-n<-o},CesiumMath.lessThanOrEquals=function(t,n,o){if(!defined(t))throw new DeveloperError("first is required.");if(!defined(n))throw new DeveloperError("second is required.");if(!defined(o))throw new DeveloperError("absoluteEpsilon is required.");return t-n<o},CesiumMath.greaterThan=function(t,n,o){if(!defined(t))throw new DeveloperError("first is required.");if(!defined(n))throw new DeveloperError("second is required.");if(!defined(o))throw new DeveloperError("absoluteEpsilon is required.");return t-n>o},CesiumMath.greaterThanOrEquals=function(t,n,o){if(!defined(t))throw new DeveloperError("first is required.");if(!defined(n))throw new DeveloperError("second is required.");if(!defined(o))throw new DeveloperError("absoluteEpsilon is required.");return t-n>-o};const factorials=[1];CesiumMath.factorial=function(t){if(typeof t!="number"||t<0)throw new DeveloperError("A number greater than or equal to 0 is required.");const n=factorials.length;if(t>=n){let o=factorials[n-1];for(let s=n;s<=t;s++){const c=o*s;factorials.push(c),o=c}}return factorials[t]},CesiumMath.incrementWrap=function(t,n,o){if(o=defaultValue(o,0),!defined(t))throw new DeveloperError("n is required.");if(n<=o)throw new DeveloperError("maximumValue must be greater than minimumValue.");return++t,t>n&&(t=o),t},CesiumMath.isPowerOfTwo=function(t){if(typeof t!="number"||t<0||t>4294967295)throw new DeveloperError("A number between 0 and (2^32)-1 is required.");return t!==0&&(t&t-1)===0},CesiumMath.nextPowerOfTwo=function(t){if(typeof t!="number"||t<0||t>2147483648)throw new DeveloperError("A number between 0 and 2^31 is required.");return--t,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t,t},CesiumMath.previousPowerOfTwo=function(t){if(typeof t!="number"||t<0||t>4294967295)throw new DeveloperError("A number between 0 and (2^32)-1 is required.");return t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,t|=t>>32,t=(t>>>0)-(t>>>1),t},CesiumMath.clamp=function(t,n,o){return Check.typeOf.number("value",t),Check.typeOf.number("min",n),Check.typeOf.number("max",o),t<n?n:t>o?o:t};let randomNumberGenerator=new MersenneTwister$1;CesiumMath.setRandomNumberSeed=function(t){if(!defined(t))throw new DeveloperError("seed is required.");randomNumberGenerator=new MersenneTwister$1(t)},CesiumMath.nextRandomNumber=function(){return randomNumberGenerator.random()},CesiumMath.randomBetween=function(t,n){return CesiumMath.nextRandomNumber()*(n-t)+t},CesiumMath.acosClamped=function(t){if(!defined(t))throw new DeveloperError("value is required.");return Math.acos(CesiumMath.clamp(t,-1,1))},CesiumMath.asinClamped=function(t){if(!defined(t))throw new DeveloperError("value is required.");return Math.asin(CesiumMath.clamp(t,-1,1))},CesiumMath.chordLength=function(t,n){if(!defined(t))throw new DeveloperError("angle is required.");if(!defined(n))throw new DeveloperError("radius is required.");return 2*n*Math.sin(t*.5)},CesiumMath.logBase=function(t,n){if(!defined(t))throw new DeveloperError("number is required.");if(!defined(n))throw new DeveloperError("base is required.");return Math.log(t)/Math.log(n)},CesiumMath.cbrt=defaultValue(Math.cbrt,function(n){const o=Math.pow(Math.abs(n),.3333333333333333);return n<0?-o:o}),CesiumMath.log2=defaultValue(Math.log2,function(n){return Math.log(n)*Math.LOG2E}),CesiumMath.fog=function(t,n){const o=t*n;return 1-Math.exp(-(o*o))},CesiumMath.fastApproximateAtan=function(t){return Check.typeOf.number("x",t),t*(-.1784*Math.abs(t)-.0663*t*t+1.0301)},CesiumMath.fastApproximateAtan2=function(t,n){Check.typeOf.number("x",t),Check.typeOf.number("y",n);let o,s=Math.abs(t);o=Math.abs(n);const c=Math.max(s,o);o=Math.min(s,o);const d=o/c;if(isNaN(d))throw new DeveloperError("either x or y must be nonzero");return s=CesiumMath.fastApproximateAtan(d),s=Math.abs(n)>Math.abs(t)?CesiumMath.PI_OVER_TWO-s:s,s=t<0?CesiumMath.PI-s:s,s=n<0?-s:s,s};function Cartesian3(t,n,o){this.x=defaultValue(t,0),this.y=defaultValue(n,0),this.z=defaultValue(o,0)}Cartesian3.fromSpherical=function(t,n){Check.typeOf.object("spherical",t),defined(n)||(n=new Cartesian3);const o=t.clock,s=t.cone,c=defaultValue(t.magnitude,1),d=c*Math.sin(s);return n.x=d*Math.cos(o),n.y=d*Math.sin(o),n.z=c*Math.cos(s),n},Cartesian3.fromElements=function(t,n,o,s){return defined(s)?(s.x=t,s.y=n,s.z=o,s):new Cartesian3(t,n,o)},Cartesian3.clone=function(t,n){if(defined(t))return defined(n)?(n.x=t.x,n.y=t.y,n.z=t.z,n):new Cartesian3(t.x,t.y,t.z)},Cartesian3.fromCartesian4=Cartesian3.clone,Cartesian3.packedLength=3,Cartesian3.pack=function(t,n,o){return Check.typeOf.object("value",t),Check.defined("array",n),o=defaultValue(o,0),n[o++]=t.x,n[o++]=t.y,n[o]=t.z,n},Cartesian3.unpack=function(t,n,o){return Check.defined("array",t),n=defaultValue(n,0),defined(o)||(o=new Cartesian3),o.x=t[n++],o.y=t[n++],o.z=t[n],o},Cartesian3.packArray=function(t,n){Check.defined("array",t);const o=t.length,s=o*3;if(!defined(n))n=new Array(s);else{if(!Array.isArray(n)&&n.length!==s)throw new DeveloperError("If result is a typed array, it must have exactly array.length * 3 elements");n.length!==s&&(n.length=s)}for(let c=0;c<o;++c)Cartesian3.pack(t[c],n,c*3);return n},Cartesian3.unpackArray=function(t,n){if(Check.defined("array",t),Check.typeOf.number.greaterThanOrEquals("array.length",t.length,3),t.length%3!==0)throw new DeveloperError("array length must be a multiple of 3.");const o=t.length;defined(n)?n.length=o/3:n=new Array(o/3);for(let s=0;s<o;s+=3){const c=s/3;n[c]=Cartesian3.unpack(t,s,n[c])}return n},Cartesian3.fromArray=Cartesian3.unpack,Cartesian3.maximumComponent=function(t){return Check.typeOf.object("cartesian",t),Math.max(t.x,t.y,t.z)},Cartesian3.minimumComponent=function(t){return Check.typeOf.object("cartesian",t),Math.min(t.x,t.y,t.z)},Cartesian3.minimumByComponent=function(t,n,o){return Check.typeOf.object("first",t),Check.typeOf.object("second",n),Check.typeOf.object("result",o),o.x=Math.min(t.x,n.x),o.y=Math.min(t.y,n.y),o.z=Math.min(t.z,n.z),o},Cartesian3.maximumByComponent=function(t,n,o){return Check.typeOf.object("first",t),Check.typeOf.object("second",n),Check.typeOf.object("result",o),o.x=Math.max(t.x,n.x),o.y=Math.max(t.y,n.y),o.z=Math.max(t.z,n.z),o},Cartesian3.clamp=function(t,n,o,s){Check.typeOf.object("value",t),Check.typeOf.object("min",n),Check.typeOf.object("max",o),Check.typeOf.object("result",s);const c=CesiumMath.clamp(t.x,n.x,o.x),d=CesiumMath.clamp(t.y,n.y,o.y),h=CesiumMath.clamp(t.z,n.z,o.z);return s.x=c,s.y=d,s.z=h,s},Cartesian3.magnitudeSquared=function(t){return Check.typeOf.object("cartesian",t),t.x*t.x+t.y*t.y+t.z*t.z},Cartesian3.magnitude=function(t){return Math.sqrt(Cartesian3.magnitudeSquared(t))};const distanceScratch$2=new Cartesian3;Cartesian3.distance=function(t,n){return Check.typeOf.object("left",t),Check.typeOf.object("right",n),Cartesian3.subtract(t,n,distanceScratch$2),Cartesian3.magnitude(distanceScratch$2)},Cartesian3.distanceSquared=function(t,n){return Check.typeOf.object("left",t),Check.typeOf.object("right",n),Cartesian3.subtract(t,n,distanceScratch$2),Cartesian3.magnitudeSquared(distanceScratch$2)},Cartesian3.normalize=function(t,n){Check.typeOf.object("cartesian",t),Check.typeOf.object("result",n);const o=Cartesian3.magnitude(t);if(n.x=t.x/o,n.y=t.y/o,n.z=t.z/o,isNaN(n.x)||isNaN(n.y)||isNaN(n.z))throw new DeveloperError("normalized result is not a number");return n},Cartesian3.dot=function(t,n){return Check.typeOf.object("left",t),Check.typeOf.object("right",n),t.x*n.x+t.y*n.y+t.z*n.z},Cartesian3.multiplyComponents=function(t,n,o){return Check.typeOf.object("left",t),Check.typeOf.object("right",n),Check.typeOf.object("result",o),o.x=t.x*n.x,o.y=t.y*n.y,o.z=t.z*n.z,o},Cartesian3.divideComponents=function(t,n,o){return Check.typeOf.object("left",t),Check.typeOf.object("right",n),Check.typeOf.object("result",o),o.x=t.x/n.x,o.y=t.y/n.y,o.z=t.z/n.z,o},Cartesian3.add=function(t,n,o){return Check.typeOf.object("left",t),Check.typeOf.object("right",n),Check.typeOf.object("result",o),o.x=t.x+n.x,o.y=t.y+n.y,o.z=t.z+n.z,o},Cartesian3.subtract=function(t,n,o){return Check.typeOf.object("left",t),Check.typeOf.object("right",n),Check.typeOf.object("result",o),o.x=t.x-n.x,o.y=t.y-n.y,o.z=t.z-n.z,o},Cartesian3.multiplyByScalar=function(t,n,o){return Check.typeOf.object("cartesian",t),Check.typeOf.number("scalar",n),Check.typeOf.object("result",o),o.x=t.x*n,o.y=t.y*n,o.z=t.z*n,o},Cartesian3.divideByScalar=function(t,n,o){return Check.typeOf.object("cartesian",t),Check.typeOf.number("scalar",n),Check.typeOf.object("result",o),o.x=t.x/n,o.y=t.y/n,o.z=t.z/n,o},Cartesian3.negate=function(t,n){return Check.typeOf.object("cartesian",t),Check.typeOf.object("result",n),n.x=-t.x,n.y=-t.y,n.z=-t.z,n},Cartesian3.abs=function(t,n){return Check.typeOf.object("cartesian",t),Check.typeOf.object("result",n),n.x=Math.abs(t.x),n.y=Math.abs(t.y),n.z=Math.abs(t.z),n};const lerpScratch$3=new Cartesian3;Cartesian3.lerp=function(t,n,o,s){return Check.typeOf.object("start",t),Check.typeOf.object("end",n),Check.typeOf.number("t",o),Check.typeOf.object("result",s),Cartesian3.multiplyByScalar(n,o,lerpScratch$3),s=Cartesian3.multiplyByScalar(t,1-o,s),Cartesian3.add(lerpScratch$3,s,s)};const angleBetweenScratch$1=new Cartesian3,angleBetweenScratch2$1=new Cartesian3;Cartesian3.angleBetween=function(t,n){Check.typeOf.object("left",t),Check.typeOf.object("right",n),Cartesian3.normalize(t,angleBetweenScratch$1),Cartesian3.normalize(n,angleBetweenScratch2$1);const o=Cartesian3.dot(angleBetweenScratch$1,angleBetweenScratch2$1),s=Cartesian3.magnitude(Cartesian3.cross(angleBetweenScratch$1,angleBetweenScratch2$1,angleBetweenScratch$1));return Math.atan2(s,o)};const mostOrthogonalAxisScratch$2=new Cartesian3;Cartesian3.mostOrthogonalAxis=function(t,n){Check.typeOf.object("cartesian",t),Check.typeOf.object("result",n);const o=Cartesian3.normalize(t,mostOrthogonalAxisScratch$2);return Cartesian3.abs(o,o),o.x<=o.y?o.x<=o.z?n=Cartesian3.clone(Cartesian3.UNIT_X,n):n=Cartesian3.clone(Cartesian3.UNIT_Z,n):o.y<=o.z?n=Cartesian3.clone(Cartesian3.UNIT_Y,n):n=Cartesian3.clone(Cartesian3.UNIT_Z,n),n},Cartesian3.projectVector=function(t,n,o){Check.defined("a",t),Check.defined("b",n),Check.defined("result",o);const s=Cartesian3.dot(t,n)/Cartesian3.dot(n,n);return Cartesian3.multiplyByScalar(n,s,o)},Cartesian3.equals=function(t,n){return t===n||defined(t)&&defined(n)&&t.x===n.x&&t.y===n.y&&t.z===n.z},Cartesian3.equalsArray=function(t,n,o){return t.x===n[o]&&t.y===n[o+1]&&t.z===n[o+2]},Cartesian3.equalsEpsilon=function(t,n,o,s){return t===n||defined(t)&&defined(n)&&CesiumMath.equalsEpsilon(t.x,n.x,o,s)&&CesiumMath.equalsEpsilon(t.y,n.y,o,s)&&CesiumMath.equalsEpsilon(t.z,n.z,o,s)},Cartesian3.cross=function(t,n,o){Check.typeOf.object("left",t),Check.typeOf.object("right",n),Check.typeOf.object("result",o);const s=t.x,c=t.y,d=t.z,h=n.x,p=n.y,y=n.z,S=c*y-d*p,P=d*h-s*y,L=s*p-c*h;return o.x=S,o.y=P,o.z=L,o},Cartesian3.midpoint=function(t,n,o){return Check.typeOf.object("left",t),Check.typeOf.object("right",n),Check.typeOf.object("result",o),o.x=(t.x+n.x)*.5,o.y=(t.y+n.y)*.5,o.z=(t.z+n.z)*.5,o},Cartesian3.fromDegrees=function(t,n,o,s,c){return Check.typeOf.number("longitude",t),Check.typeOf.number("latitude",n),t=CesiumMath.toRadians(t),n=CesiumMath.toRadians(n),Cartesian3.fromRadians(t,n,o,s,c)};let scratchN=new Cartesian3,scratchK=new Cartesian3;const wgs84RadiiSquared=new Cartesian3(6378137*6378137,6378137*6378137,6356752314245179e-9*6356752314245179e-9);Cartesian3.fromRadians=function(t,n,o,s,c){Check.typeOf.number("longitude",t),Check.typeOf.number("latitude",n),o=defaultValue(o,0);const d=defined(s)?s.radiiSquared:wgs84RadiiSquared,h=Math.cos(n);scratchN.x=h*Math.cos(t),scratchN.y=h*Math.sin(t),scratchN.z=Math.sin(n),scratchN=Cartesian3.normalize(scratchN,scratchN),Cartesian3.multiplyComponents(d,scratchN,scratchK);const p=Math.sqrt(Cartesian3.dot(scratchN,scratchK));return scratchK=Cartesian3.divideByScalar(scratchK,p,scratchK),scratchN=Cartesian3.multiplyByScalar(scratchN,o,scratchN),defined(c)||(c=new Cartesian3),Cartesian3.add(scratchK,scratchN,c)},Cartesian3.fromDegreesArray=function(t,n,o){if(Check.defined("coordinates",t),t.length<2||t.length%2!==0)throw new DeveloperError("the number of coordinates must be a multiple of 2 and at least 2");const s=t.length;defined(o)?o.length=s/2:o=new Array(s/2);for(let c=0;c<s;c+=2){const d=t[c],h=t[c+1],p=c/2;o[p]=Cartesian3.fromDegrees(d,h,0,n,o[p])}return o},Cartesian3.fromRadiansArray=function(t,n,o){if(Check.defined("coordinates",t),t.length<2||t.length%2!==0)throw new DeveloperError("the number of coordinates must be a multiple of 2 and at least 2");const s=t.length;defined(o)?o.length=s/2:o=new Array(s/2);for(let c=0;c<s;c+=2){const d=t[c],h=t[c+1],p=c/2;o[p]=Cartesian3.fromRadians(d,h,0,n,o[p])}return o},Cartesian3.fromDegreesArrayHeights=function(t,n,o){if(Check.defined("coordinates",t),t.length<3||t.length%3!==0)throw new DeveloperError("the number of coordinates must be a multiple of 3 and at least 3");const s=t.length;defined(o)?o.length=s/3:o=new Array(s/3);for(let c=0;c<s;c+=3){const d=t[c],h=t[c+1],p=t[c+2],y=c/3;o[y]=Cartesian3.fromDegrees(d,h,p,n,o[y])}return o},Cartesian3.fromRadiansArrayHeights=function(t,n,o){if(Check.defined("coordinates",t),t.length<3||t.length%3!==0)throw new DeveloperError("the number of coordinates must be a multiple of 3 and at least 3");const s=t.length;defined(o)?o.length=s/3:o=new Array(s/3);for(let c=0;c<s;c+=3){const d=t[c],h=t[c+1],p=t[c+2],y=c/3;o[y]=Cartesian3.fromRadians(d,h,p,n,o[y])}return o},Cartesian3.ZERO=Object.freeze(new Cartesian3(0,0,0)),Cartesian3.ONE=Object.freeze(new Cartesian3(1,1,1)),Cartesian3.UNIT_X=Object.freeze(new Cartesian3(1,0,0)),Cartesian3.UNIT_Y=Object.freeze(new Cartesian3(0,1,0)),Cartesian3.UNIT_Z=Object.freeze(new Cartesian3(0,0,1)),Cartesian3.prototype.clone=function(t){return Cartesian3.clone(this,t)},Cartesian3.prototype.equals=function(t){return Cartesian3.equals(this,t)},Cartesian3.prototype.equalsEpsilon=function(t,n,o){return Cartesian3.equalsEpsilon(this,t,n,o)},Cartesian3.prototype.toString=function(){return`(${this.x}, ${this.y}, ${this.z})`};const scaleToGeodeticSurfaceIntersection=new Cartesian3,scaleToGeodeticSurfaceGradient=new Cartesian3;function scaleToGeodeticSurface(t,n,o,s,c){if(!defined(t))throw new DeveloperError("cartesian is required.");if(!defined(n))throw new DeveloperError("oneOverRadii is required.");if(!defined(o))throw new DeveloperError("oneOverRadiiSquared is required.");if(!defined(s))throw new DeveloperError("centerToleranceSquared is required.");const d=t.x,h=t.y,p=t.z,y=n.x,S=n.y,P=n.z,L=d*d*y*y,F=h*h*S*S,N=p*p*P*P,z=L+F+N,W=Math.sqrt(1/z),nt=Cartesian3.multiplyByScalar(t,W,scaleToGeodeticSurfaceIntersection);if(z<s)return isFinite(W)?Cartesian3.clone(nt,c):void 0;const Pe=o.x,se=o.y,mt=o.z,kt=scaleToGeodeticSurfaceGradient;kt.x=nt.x*Pe*2,kt.y=nt.y*se*2,kt.z=nt.z*mt*2;let mn=(1-W)*Cartesian3.magnitude(t)/(.5*Cartesian3.magnitude(kt)),_i=0,zi,Sa,fa,La,Ra,ma,yt,lt,pi,ba,Sc;do{mn-=_i,fa=1/(1+mn*Pe),La=1/(1+mn*se),Ra=1/(1+mn*mt),ma=fa*fa,yt=La*La,lt=Ra*Ra,pi=ma*fa,ba=yt*La,Sc=lt*Ra,zi=L*ma+F*yt+N*lt-1,Sa=L*pi*Pe+F*ba*se+N*Sc*mt;const ms=-2*Sa;_i=zi/ms}while(Math.abs(zi)>CesiumMath.EPSILON12);return defined(c)?(c.x=d*fa,c.y=h*La,c.z=p*Ra,c):new Cartesian3(d*fa,h*La,p*Ra)}function Cartographic(t,n,o){this.longitude=defaultValue(t,0),this.latitude=defaultValue(n,0),this.height=defaultValue(o,0)}Cartographic.fromRadians=function(t,n,o,s){return Check.typeOf.number("longitude",t),Check.typeOf.number("latitude",n),o=defaultValue(o,0),defined(s)?(s.longitude=t,s.latitude=n,s.height=o,s):new Cartographic(t,n,o)},Cartographic.fromDegrees=function(t,n,o,s){return Check.typeOf.number("longitude",t),Check.typeOf.number("latitude",n),t=CesiumMath.toRadians(t),n=CesiumMath.toRadians(n),Cartographic.fromRadians(t,n,o,s)};const cartesianToCartographicN$1=new Cartesian3,cartesianToCartographicP$1=new Cartesian3,cartesianToCartographicH$1=new Cartesian3,wgs84OneOverRadii=new Cartesian3(1/6378137,1/6378137,1/6356752314245179e-9),wgs84OneOverRadiiSquared=new Cartesian3(1/(6378137*6378137),1/(6378137*6378137),1/(6356752314245179e-9*6356752314245179e-9)),wgs84CenterToleranceSquared=CesiumMath.EPSILON1;Cartographic.fromCartesian=function(t,n,o){const s=defined(n)?n.oneOverRadii:wgs84OneOverRadii,c=defined(n)?n.oneOverRadiiSquared:wgs84OneOverRadiiSquared,d=defined(n)?n._centerToleranceSquared:wgs84CenterToleranceSquared,h=scaleToGeodeticSurface(t,s,c,d,cartesianToCartographicP$1);if(!defined(h))return;let p=Cartesian3.multiplyComponents(h,c,cartesianToCartographicN$1);p=Cartesian3.normalize(p,p);const y=Cartesian3.subtract(t,h,cartesianToCartographicH$1),S=Math.atan2(p.y,p.x),P=Math.asin(p.z),L=CesiumMath.sign(Cartesian3.dot(y,t))*Cartesian3.magnitude(y);return defined(o)?(o.longitude=S,o.latitude=P,o.height=L,o):new Cartographic(S,P,L)},Cartographic.toCartesian=function(t,n,o){return Check.defined("cartographic",t),Cartesian3.fromRadians(t.longitude,t.latitude,t.height,n,o)},Cartographic.clone=function(t,n){if(defined(t))return defined(n)?(n.longitude=t.longitude,n.latitude=t.latitude,n.height=t.height,n):new Cartographic(t.longitude,t.latitude,t.height)},Cartographic.equals=function(t,n){return t===n||defined(t)&&defined(n)&&t.longitude===n.longitude&&t.latitude===n.latitude&&t.height===n.height},Cartographic.equalsEpsilon=function(t,n,o){return o=defaultValue(o,0),t===n||defined(t)&&defined(n)&&Math.abs(t.longitude-n.longitude)<=o&&Math.abs(t.latitude-n.latitude)<=o&&Math.abs(t.height-n.height)<=o},Cartographic.ZERO=Object.freeze(new Cartographic(0,0,0)),Cartographic.prototype.clone=function(t){return Cartographic.clone(this,t)},Cartographic.prototype.equals=function(t){return Cartographic.equals(this,t)},Cartographic.prototype.equalsEpsilon=function(t,n){return Cartographic.equalsEpsilon(this,t,n)},Cartographic.prototype.toString=function(){return`(${this.longitude}, ${this.latitude}, ${this.height})`};function Cartesian2(t,n){this.x=defaultValue(t,0),this.y=defaultValue(n,0)}Cartesian2.fromElements=function(t,n,o){return defined(o)?(o.x=t,o.y=n,o):new Cartesian2(t,n)},Cartesian2.clone=function(t,n){if(defined(t))return defined(n)?(n.x=t.x,n.y=t.y,n):new Cartesian2(t.x,t.y)},Cartesian2.fromCartesian3=Cartesian2.clone,Cartesian2.fromCartesian4=Cartesian2.clone,Cartesian2.packedLength=2,Cartesian2.pack=function(t,n,o){return Check.typeOf.object("value",t),Check.defined("array",n),o=defaultValue(o,0),n[o++]=t.x,n[o]=t.y,n},Cartesian2.unpack=function(t,n,o){return Check.defined("array",t),n=defaultValue(n,0),defined(o)||(o=new Cartesian2),o.x=t[n++],o.y=t[n],o},Cartesian2.packArray=function(t,n){Check.defined("array",t);const o=t.length,s=o*2;if(!defined(n))n=new Array(s);else{if(!Array.isArray(n)&&n.length!==s)throw new DeveloperError("If result is a typed array, it must have exactly array.length * 2 elements");n.length!==s&&(n.length=s)}for(let c=0;c<o;++c)Cartesian2.pack(t[c],n,c*2);return n},Cartesian2.unpackArray=function(t,n){if(Check.defined("array",t),Check.typeOf.number.greaterThanOrEquals("array.length",t.length,2),t.length%2!==0)throw new DeveloperError("array length must be a multiple of 2.");const o=t.length;defined(n)?n.length=o/2:n=new Array(o/2);for(let s=0;s<o;s+=2){const c=s/2;n[c]=Cartesian2.unpack(t,s,n[c])}return n},Cartesian2.fromArray=Cartesian2.unpack,Cartesian2.maximumComponent=function(t){return Check.typeOf.object("cartesian",t),Math.max(t.x,t.y)},Cartesian2.minimumComponent=function(t){return Check.typeOf.object("cartesian",t),Math.min(t.x,t.y)},Cartesian2.minimumByComponent=function(t,n,o){return Check.typeOf.object("first",t),Check.typeOf.object("second",n),Check.typeOf.object("result",o),o.x=Math.min(t.x,n.x),o.y=Math.min(t.y,n.y),o},Cartesian2.maximumByComponent=function(t,n,o){return Check.typeOf.object("first",t),Check.typeOf.object("second",n),Check.typeOf.object("result",o),o.x=Math.max(t.x,n.x),o.y=Math.max(t.y,n.y),o},Cartesian2.clamp=function(t,n,o,s){Check.typeOf.object("value",t),Check.typeOf.object("min",n),Check.typeOf.object("max",o),Check.typeOf.object("result",s);const c=CesiumMath.clamp(t.x,n.x,o.x),d=CesiumMath.clamp(t.y,n.y,o.y);return s.x=c,s.y=d,s},Cartesian2.magnitudeSquared=function(t){return Check.typeOf.object("cartesian",t),t.x*t.x+t.y*t.y},Cartesian2.magnitude=function(t){return Math.sqrt(Cartesian2.magnitudeSquared(t))};const distanceScratch$1=new Cartesian2;Cartesian2.distance=function(t,n){return Check.typeOf.object("left",t),Check.typeOf.object("right",n),Cartesian2.subtract(t,n,distanceScratch$1),Cartesian2.magnitude(distanceScratch$1)},Cartesian2.distanceSquared=function(t,n){return Check.typeOf.object("left",t),Check.typeOf.object("right",n),Cartesian2.subtract(t,n,distanceScratch$1),Cartesian2.magnitudeSquared(distanceScratch$1)},Cartesian2.normalize=function(t,n){Check.typeOf.object("cartesian",t),Check.typeOf.object("result",n);const o=Cartesian2.magnitude(t);if(n.x=t.x/o,n.y=t.y/o,isNaN(n.x)||isNaN(n.y))throw new DeveloperError("normalized result is not a number");return n},Cartesian2.dot=function(t,n){return Check.typeOf.object("left",t),Check.typeOf.object("right",n),t.x*n.x+t.y*n.y},Cartesian2.cross=function(t,n){return Check.typeOf.object("left",t),Check.typeOf.object("right",n),t.x*n.y-t.y*n.x},Cartesian2.multiplyComponents=function(t,n,o){return Check.typeOf.object("left",t),Check.typeOf.object("right",n),Check.typeOf.object("result",o),o.x=t.x*n.x,o.y=t.y*n.y,o},Cartesian2.divideComponents=function(t,n,o){return Check.typeOf.object("left",t),Check.typeOf.object("right",n),Check.typeOf.object("result",o),o.x=t.x/n.x,o.y=t.y/n.y,o},Cartesian2.add=function(t,n,o){return Check.typeOf.object("left",t),Check.typeOf.object("right",n),Check.typeOf.object("result",o),o.x=t.x+n.x,o.y=t.y+n.y,o},Cartesian2.subtract=function(t,n,o){return Check.typeOf.object("left",t),Check.typeOf.object("right",n),Check.typeOf.object("result",o),o.x=t.x-n.x,o.y=t.y-n.y,o},Cartesian2.multiplyByScalar=function(t,n,o){return Check.typeOf.object("cartesian",t),Check.typeOf.number("scalar",n),Check.typeOf.object("result",o),o.x=t.x*n,o.y=t.y*n,o},Cartesian2.divideByScalar=function(t,n,o){return Check.typeOf.object("cartesian",t),Check.typeOf.number("scalar",n),Check.typeOf.object("result",o),o.x=t.x/n,o.y=t.y/n,o},Cartesian2.negate=function(t,n){return Check.typeOf.object("cartesian",t),Check.typeOf.object("result",n),n.x=-t.x,n.y=-t.y,n},Cartesian2.abs=function(t,n){return Check.typeOf.object("cartesian",t),Check.typeOf.object("result",n),n.x=Math.abs(t.x),n.y=Math.abs(t.y),n};const lerpScratch$2=new Cartesian2;Cartesian2.lerp=function(t,n,o,s){return Check.typeOf.object("start",t),Check.typeOf.object("end",n),Check.typeOf.number("t",o),Check.typeOf.object("result",s),Cartesian2.multiplyByScalar(n,o,lerpScratch$2),s=Cartesian2.multiplyByScalar(t,1-o,s),Cartesian2.add(lerpScratch$2,s,s)};const angleBetweenScratch=new Cartesian2,angleBetweenScratch2=new Cartesian2;Cartesian2.angleBetween=function(t,n){return Check.typeOf.object("left",t),Check.typeOf.object("right",n),Cartesian2.normalize(t,angleBetweenScratch),Cartesian2.normalize(n,angleBetweenScratch2),CesiumMath.acosClamped(Cartesian2.dot(angleBetweenScratch,angleBetweenScratch2))};const mostOrthogonalAxisScratch$1=new Cartesian2;Cartesian2.mostOrthogonalAxis=function(t,n){Check.typeOf.object("cartesian",t),Check.typeOf.object("result",n);const o=Cartesian2.normalize(t,mostOrthogonalAxisScratch$1);return Cartesian2.abs(o,o),o.x<=o.y?n=Cartesian2.clone(Cartesian2.UNIT_X,n):n=Cartesian2.clone(Cartesian2.UNIT_Y,n),n},Cartesian2.equals=function(t,n){return t===n||defined(t)&&defined(n)&&t.x===n.x&&t.y===n.y},Cartesian2.equalsArray=function(t,n,o){return t.x===n[o]&&t.y===n[o+1]},Cartesian2.equalsEpsilon=function(t,n,o,s){return t===n||defined(t)&&defined(n)&&CesiumMath.equalsEpsilon(t.x,n.x,o,s)&&CesiumMath.equalsEpsilon(t.y,n.y,o,s)},Cartesian2.ZERO=Object.freeze(new Cartesian2(0,0)),Cartesian2.ONE=Object.freeze(new Cartesian2(1,1)),Cartesian2.UNIT_X=Object.freeze(new Cartesian2(1,0)),Cartesian2.UNIT_Y=Object.freeze(new Cartesian2(0,1)),Cartesian2.prototype.clone=function(t){return Cartesian2.clone(this,t)},Cartesian2.prototype.equals=function(t){return Cartesian2.equals(this,t)},Cartesian2.prototype.equalsEpsilon=function(t,n,o){return Cartesian2.equalsEpsilon(this,t,n,o)},Cartesian2.prototype.toString=function(){return`(${this.x}, ${this.y})`};function initialize$1(t,n,o,s){n=defaultValue(n,0),o=defaultValue(o,0),s=defaultValue(s,0),Check.typeOf.number.greaterThanOrEquals("x",n,0),Check.typeOf.number.greaterThanOrEquals("y",o,0),Check.typeOf.number.greaterThanOrEquals("z",s,0),t._radii=new Cartesian3(n,o,s),t._radiiSquared=new Cartesian3(n*n,o*o,s*s),t._radiiToTheFourth=new Cartesian3(n*n*n*n,o*o*o*o,s*s*s*s),t._oneOverRadii=new Cartesian3(n===0?0:1/n,o===0?0:1/o,s===0?0:1/s),t._oneOverRadiiSquared=new Cartesian3(n===0?0:1/(n*n),o===0?0:1/(o*o),s===0?0:1/(s*s)),t._minimumRadius=Math.min(n,o,s),t._maximumRadius=Math.max(n,o,s),t._centerToleranceSquared=CesiumMath.EPSILON1,t._radiiSquared.z!==0&&(t._squaredXOverSquaredZ=t._radiiSquared.x/t._radiiSquared.z)}function Ellipsoid$1(t,n,o){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,initialize$1(this,t,n,o)}Object.defineProperties(Ellipsoid$1.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}}}),Ellipsoid$1.clone=function(t,n){if(!defined(t))return;const o=t._radii;return defined(n)?(Cartesian3.clone(o,n._radii),Cartesian3.clone(t._radiiSquared,n._radiiSquared),Cartesian3.clone(t._radiiToTheFourth,n._radiiToTheFourth),Cartesian3.clone(t._oneOverRadii,n._oneOverRadii),Cartesian3.clone(t._oneOverRadiiSquared,n._oneOverRadiiSquared),n._minimumRadius=t._minimumRadius,n._maximumRadius=t._maximumRadius,n._centerToleranceSquared=t._centerToleranceSquared,n):new Ellipsoid$1(o.x,o.y,o.z)},Ellipsoid$1.fromCartesian3=function(t,n){return defined(n)||(n=new Ellipsoid$1),defined(t)&&initialize$1(n,t.x,t.y,t.z),n},Ellipsoid$1.WGS84=Object.freeze(new Ellipsoid$1(6378137,6378137,6356752314245179e-9)),Ellipsoid$1.UNIT_SPHERE=Object.freeze(new Ellipsoid$1(1,1,1)),Ellipsoid$1.MOON=Object.freeze(new Ellipsoid$1(CesiumMath.LUNAR_RADIUS,CesiumMath.LUNAR_RADIUS,CesiumMath.LUNAR_RADIUS)),Ellipsoid$1.prototype.clone=function(t){return Ellipsoid$1.clone(this,t)},Ellipsoid$1.packedLength=Cartesian3.packedLength,Ellipsoid$1.pack=function(t,n,o){return Check.typeOf.object("value",t),Check.defined("array",n),o=defaultValue(o,0),Cartesian3.pack(t._radii,n,o),n},Ellipsoid$1.unpack=function(t,n,o){Check.defined("array",t),n=defaultValue(n,0);const s=Cartesian3.unpack(t,n);return Ellipsoid$1.fromCartesian3(s,o)},Ellipsoid$1.prototype.geocentricSurfaceNormal=Cartesian3.normalize,Ellipsoid$1.prototype.geodeticSurfaceNormalCartographic=function(t,n){Check.typeOf.object("cartographic",t);const o=t.longitude,s=t.latitude,c=Math.cos(s),d=c*Math.cos(o),h=c*Math.sin(o),p=Math.sin(s);return defined(n)||(n=new Cartesian3),n.x=d,n.y=h,n.z=p,Cartesian3.normalize(n,n)},Ellipsoid$1.prototype.geodeticSurfaceNormal=function(t,n){if(Check.typeOf.object("cartesian",t),isNaN(t.x)||isNaN(t.y)||isNaN(t.z))throw new DeveloperError("cartesian has a NaN component");if(!Cartesian3.equalsEpsilon(t,Cartesian3.ZERO,CesiumMath.EPSILON14))return defined(n)||(n=new Cartesian3),n=Cartesian3.multiplyComponents(t,this._oneOverRadiiSquared,n),Cartesian3.normalize(n,n)};const cartographicToCartesianNormal=new Cartesian3,cartographicToCartesianK=new Cartesian3;Ellipsoid$1.prototype.cartographicToCartesian=function(t,n){const o=cartographicToCartesianNormal,s=cartographicToCartesianK;this.geodeticSurfaceNormalCartographic(t,o),Cartesian3.multiplyComponents(this._radiiSquared,o,s);const c=Math.sqrt(Cartesian3.dot(o,s));return Cartesian3.divideByScalar(s,c,s),Cartesian3.multiplyByScalar(o,t.height,o),defined(n)||(n=new Cartesian3),Cartesian3.add(s,o,n)},Ellipsoid$1.prototype.cartographicArrayToCartesianArray=function(t,n){Check.defined("cartographics",t);const o=t.length;defined(n)?n.length=o:n=new Array(o);for(let s=0;s<o;s++)n[s]=this.cartographicToCartesian(t[s],n[s]);return n};const cartesianToCartographicN=new Cartesian3,cartesianToCartographicP=new Cartesian3,cartesianToCartographicH=new Cartesian3;Ellipsoid$1.prototype.cartesianToCartographic=function(t,n){const o=this.scaleToGeodeticSurface(t,cartesianToCartographicP);if(!defined(o))return;const s=this.geodeticSurfaceNormal(o,cartesianToCartographicN),c=Cartesian3.subtract(t,o,cartesianToCartographicH),d=Math.atan2(s.y,s.x),h=Math.asin(s.z),p=CesiumMath.sign(Cartesian3.dot(c,t))*Cartesian3.magnitude(c);return defined(n)?(n.longitude=d,n.latitude=h,n.height=p,n):new Cartographic(d,h,p)},Ellipsoid$1.prototype.cartesianArrayToCartographicArray=function(t,n){Check.defined("cartesians",t);const o=t.length;defined(n)?n.length=o:n=new Array(o);for(let s=0;s<o;++s)n[s]=this.cartesianToCartographic(t[s],n[s]);return n},Ellipsoid$1.prototype.scaleToGeodeticSurface=function(t,n){return scaleToGeodeticSurface(t,this._oneOverRadii,this._oneOverRadiiSquared,this._centerToleranceSquared,n)},Ellipsoid$1.prototype.scaleToGeocentricSurface=function(t,n){Check.typeOf.object("cartesian",t),defined(n)||(n=new Cartesian3);const o=t.x,s=t.y,c=t.z,d=this._oneOverRadiiSquared,h=1/Math.sqrt(o*o*d.x+s*s*d.y+c*c*d.z);return Cartesian3.multiplyByScalar(t,h,n)},Ellipsoid$1.prototype.transformPositionToScaledSpace=function(t,n){return defined(n)||(n=new Cartesian3),Cartesian3.multiplyComponents(t,this._oneOverRadii,n)},Ellipsoid$1.prototype.transformPositionFromScaledSpace=function(t,n){return defined(n)||(n=new Cartesian3),Cartesian3.multiplyComponents(t,this._radii,n)},Ellipsoid$1.prototype.equals=function(t){return this===t||defined(t)&&Cartesian3.equals(this._radii,t._radii)},Ellipsoid$1.prototype.toString=function(){return this._radii.toString()},Ellipsoid$1.prototype.getSurfaceNormalIntersectionWithZAxis=function(t,n,o){if(Check.typeOf.object("position",t),!CesiumMath.equalsEpsilon(this._radii.x,this._radii.y,CesiumMath.EPSILON15))throw new DeveloperError("Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)");Check.typeOf.number.greaterThan("Ellipsoid.radii.z",this._radii.z,0),n=defaultValue(n,0);const s=this._squaredXOverSquaredZ;if(defined(o)||(o=new Cartesian3),o.x=0,o.y=0,o.z=t.z*(1-s),!(Math.abs(o.z)>=this._radii.z-n))return o};const scratchEndpoint=new Cartesian3;Ellipsoid$1.prototype.getLocalCurvature=function(t,n){Check.typeOf.object("surfacePosition",t),defined(n)||(n=new Cartesian2);const o=this.getSurfaceNormalIntersectionWithZAxis(t,0,scratchEndpoint),s=Cartesian3.distance(t,o),c=this.minimumRadius*s/this.maximumRadius**2,d=s*c**2;return Cartesian2.fromElements(1/s,1/d,n)};const abscissas=[.14887433898163,.43339539412925,.67940956829902,.86506336668898,.97390652851717,0],weights=[.29552422471475,.26926671930999,.21908636251598,.14945134915058,.066671344308684,0];function gaussLegendreQuadrature(t,n,o){Check.typeOf.number("a",t),Check.typeOf.number("b",n),Check.typeOf.func("func",o);const s=.5*(n+t),c=.5*(n-t);let d=0;for(let h=0;h<5;h++){const p=c*abscissas[h];d+=weights[h]*(o(s+p)+o(s-p))}return d*=c,d}Ellipsoid$1.prototype.surfaceArea=function(t){Check.typeOf.object("rectangle",t);const n=t.west;let o=t.east;const s=t.south,c=t.north;for(;o<n;)o+=CesiumMath.TWO_PI;const d=this._radiiSquared,h=d.x,p=d.y,y=d.z,S=h*p;return gaussLegendreQuadrature(s,c,function(P){const L=Math.cos(P),F=Math.sin(P);return Math.cos(P)*gaussLegendreQuadrature(n,o,function(N){const z=Math.cos(N),W=Math.sin(N);return Math.sqrt(S*F*F+y*(p*z*z+h*W*W)*L*L)})})};function GeographicProjection(t){this._ellipsoid=defaultValue(t,Ellipsoid$1.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}Object.defineProperties(GeographicProjection.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),GeographicProjection.prototype.project=function(t,n){const o=this._semimajorAxis,s=t.longitude*o,c=t.latitude*o,d=t.height;return defined(n)?(n.x=s,n.y=c,n.z=d,n):new Cartesian3(s,c,d)},GeographicProjection.prototype.unproject=function(t,n){if(!defined(t))throw new DeveloperError("cartesian is required");const o=this._oneOverSemimajorAxis,s=t.x*o,c=t.y*o,d=t.z;return defined(n)?(n.longitude=s,n.latitude=c,n.height=d,n):new Cartographic(s,c,d)};const Intersect={OUTSIDE:-1,INTERSECTING:0,INSIDE:1},Intersect$1=Object.freeze(Intersect);function Interval(t,n){this.start=defaultValue(t,0),this.stop=defaultValue(n,0)}function Matrix3(t,n,o,s,c,d,h,p,y){this[0]=defaultValue(t,0),this[1]=defaultValue(s,0),this[2]=defaultValue(h,0),this[3]=defaultValue(n,0),this[4]=defaultValue(c,0),this[5]=defaultValue(p,0),this[6]=defaultValue(o,0),this[7]=defaultValue(d,0),this[8]=defaultValue(y,0)}Matrix3.packedLength=9,Matrix3.pack=function(t,n,o){return Check.typeOf.object("value",t),Check.defined("array",n),o=defaultValue(o,0),n[o++]=t[0],n[o++]=t[1],n[o++]=t[2],n[o++]=t[3],n[o++]=t[4],n[o++]=t[5],n[o++]=t[6],n[o++]=t[7],n[o++]=t[8],n},Matrix3.unpack=function(t,n,o){return Check.defined("array",t),n=defaultValue(n,0),defined(o)||(o=new Matrix3),o[0]=t[n++],o[1]=t[n++],o[2]=t[n++],o[3]=t[n++],o[4]=t[n++],o[5]=t[n++],o[6]=t[n++],o[7]=t[n++],o[8]=t[n++],o},Matrix3.packArray=function(t,n){Check.defined("array",t);const o=t.length,s=o*9;if(!defined(n))n=new Array(s);else{if(!Array.isArray(n)&&n.length!==s)throw new DeveloperError("If result is a typed array, it must have exactly array.length * 9 elements");n.length!==s&&(n.length=s)}for(let c=0;c<o;++c)Matrix3.pack(t[c],n,c*9);return n},Matrix3.unpackArray=function(t,n){if(Check.defined("array",t),Check.typeOf.number.greaterThanOrEquals("array.length",t.length,9),t.length%9!==0)throw new DeveloperError("array length must be a multiple of 9.");const o=t.length;defined(n)?n.length=o/9:n=new Array(o/9);for(let s=0;s<o;s+=9){const c=s/9;n[c]=Matrix3.unpack(t,s,n[c])}return n},Matrix3.clone=function(t,n){if(defined(t))return defined(n)?(n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n):new Matrix3(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8])},Matrix3.fromArray=Matrix3.unpack,Matrix3.fromColumnMajorArray=function(t,n){return Check.defined("values",t),Matrix3.clone(t,n)},Matrix3.fromRowMajorArray=function(t,n){return Check.defined("values",t),defined(n)?(n[0]=t[0],n[1]=t[3],n[2]=t[6],n[3]=t[1],n[4]=t[4],n[5]=t[7],n[6]=t[2],n[7]=t[5],n[8]=t[8],n):new Matrix3(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},Matrix3.fromQuaternion=function(t,n){Check.typeOf.object("quaternion",t);const o=t.x*t.x,s=t.x*t.y,c=t.x*t.z,d=t.x*t.w,h=t.y*t.y,p=t.y*t.z,y=t.y*t.w,S=t.z*t.z,P=t.z*t.w,L=t.w*t.w,F=o-h-S+L,N=2*(s-P),z=2*(c+y),W=2*(s+P),nt=-o+h-S+L,Pe=2*(p-d),se=2*(c-y),mt=2*(p+d),kt=-o-h+S+L;return defined(n)?(n[0]=F,n[1]=W,n[2]=se,n[3]=N,n[4]=nt,n[5]=mt,n[6]=z,n[7]=Pe,n[8]=kt,n):new Matrix3(F,N,z,W,nt,Pe,se,mt,kt)},Matrix3.fromHeadingPitchRoll=function(t,n){Check.typeOf.object("headingPitchRoll",t);const o=Math.cos(-t.pitch),s=Math.cos(-t.heading),c=Math.cos(t.roll),d=Math.sin(-t.pitch),h=Math.sin(-t.heading),p=Math.sin(t.roll),y=o*s,S=-c*h+p*d*s,P=p*h+c*d*s,L=o*h,F=c*s+p*d*h,N=-p*s+c*d*h,z=-d,W=p*o,nt=c*o;return defined(n)?(n[0]=y,n[1]=L,n[2]=z,n[3]=S,n[4]=F,n[5]=W,n[6]=P,n[7]=N,n[8]=nt,n):new Matrix3(y,S,P,L,F,N,z,W,nt)},Matrix3.fromScale=function(t,n){return Check.typeOf.object("scale",t),defined(n)?(n[0]=t.x,n[1]=0,n[2]=0,n[3]=0,n[4]=t.y,n[5]=0,n[6]=0,n[7]=0,n[8]=t.z,n):new Matrix3(t.x,0,0,0,t.y,0,0,0,t.z)},Matrix3.fromUniformScale=function(t,n){return Check.typeOf.number("scale",t),defined(n)?(n[0]=t,n[1]=0,n[2]=0,n[3]=0,n[4]=t,n[5]=0,n[6]=0,n[7]=0,n[8]=t,n):new Matrix3(t,0,0,0,t,0,0,0,t)},Matrix3.fromCrossProduct=function(t,n){return Check.typeOf.object("vector",t),defined(n)?(n[0]=0,n[1]=t.z,n[2]=-t.y,n[3]=-t.z,n[4]=0,n[5]=t.x,n[6]=t.y,n[7]=-t.x,n[8]=0,n):new Matrix3(0,-t.z,t.y,t.z,0,-t.x,-t.y,t.x,0)},Matrix3.fromRotationX=function(t,n){Check.typeOf.number("angle",t);const o=Math.cos(t),s=Math.sin(t);return defined(n)?(n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=o,n[5]=s,n[6]=0,n[7]=-s,n[8]=o,n):new Matrix3(1,0,0,0,o,-s,0,s,o)},Matrix3.fromRotationY=function(t,n){Check.typeOf.number("angle",t);const o=Math.cos(t),s=Math.sin(t);return defined(n)?(n[0]=o,n[1]=0,n[2]=-s,n[3]=0,n[4]=1,n[5]=0,n[6]=s,n[7]=0,n[8]=o,n):new Matrix3(o,0,s,0,1,0,-s,0,o)},Matrix3.fromRotationZ=function(t,n){Check.typeOf.number("angle",t);const o=Math.cos(t),s=Math.sin(t);return defined(n)?(n[0]=o,n[1]=s,n[2]=0,n[3]=-s,n[4]=o,n[5]=0,n[6]=0,n[7]=0,n[8]=1,n):new Matrix3(o,-s,0,s,o,0,0,0,1)},Matrix3.toArray=function(t,n){return Check.typeOf.object("matrix",t),defined(n)?(n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n):[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8]]},Matrix3.getElementIndex=function(t,n){return Check.typeOf.number.greaterThanOrEquals("row",n,0),Check.typeOf.number.lessThanOrEquals("row",n,2),Check.typeOf.number.greaterThanOrEquals("column",t,0),Check.typeOf.number.lessThanOrEquals("column",t,2),t*3+n},Matrix3.getColumn=function(t,n,o){Check.typeOf.object("matrix",t),Check.typeOf.number.greaterThanOrEquals("index",n,0),Check.typeOf.number.lessThanOrEquals("index",n,2),Check.typeOf.object("result",o);const s=n*3,c=t[s],d=t[s+1],h=t[s+2];return o.x=c,o.y=d,o.z=h,o},Matrix3.setColumn=function(t,n,o,s){Check.typeOf.object("matrix",t),Check.typeOf.number.greaterThanOrEquals("index",n,0),Check.typeOf.number.lessThanOrEquals("index",n,2),Check.typeOf.object("cartesian",o),Check.typeOf.object("result",s),s=Matrix3.clone(t,s);const c=n*3;return s[c]=o.x,s[c+1]=o.y,s[c+2]=o.z,s},Matrix3.getRow=function(t,n,o){Check.typeOf.object("matrix",t),Check.typeOf.number.greaterThanOrEquals("index",n,0),Check.typeOf.number.lessThanOrEquals("index",n,2),Check.typeOf.object("result",o);const s=t[n],c=t[n+3],d=t[n+6];return o.x=s,o.y=c,o.z=d,o},Matrix3.setRow=function(t,n,o,s){return Check.typeOf.object("matrix",t),Check.typeOf.number.greaterThanOrEquals("index",n,0),Check.typeOf.number.lessThanOrEquals("index",n,2),Check.typeOf.object("cartesian",o),Check.typeOf.object("result",s),s=Matrix3.clone(t,s),s[n]=o.x,s[n+3]=o.y,s[n+6]=o.z,s};const scaleScratch1$2=new Cartesian3;Matrix3.setScale=function(t,n,o){Check.typeOf.object("matrix",t),Check.typeOf.object("scale",n),Check.typeOf.object("result",o);const s=Matrix3.getScale(t,scaleScratch1$2),c=n.x/s.x,d=n.y/s.y,h=n.z/s.z;return o[0]=t[0]*c,o[1]=t[1]*c,o[2]=t[2]*c,o[3]=t[3]*d,o[4]=t[4]*d,o[5]=t[5]*d,o[6]=t[6]*h,o[7]=t[7]*h,o[8]=t[8]*h,o};const scaleScratch2$2=new Cartesian3;Matrix3.setUniformScale=function(t,n,o){Check.typeOf.object("matrix",t),Check.typeOf.number("scale",n),Check.typeOf.object("result",o);const s=Matrix3.getScale(t,scaleScratch2$2),c=n/s.x,d=n/s.y,h=n/s.z;return o[0]=t[0]*c,o[1]=t[1]*c,o[2]=t[2]*c,o[3]=t[3]*d,o[4]=t[4]*d,o[5]=t[5]*d,o[6]=t[6]*h,o[7]=t[7]*h,o[8]=t[8]*h,o};const scratchColumn$2=new Cartesian3;Matrix3.getScale=function(t,n){return Check.typeOf.object("matrix",t),Check.typeOf.object("result",n),n.x=Cartesian3.magnitude(Cartesian3.fromElements(t[0],t[1],t[2],scratchColumn$2)),n.y=Cartesian3.magnitude(Cartesian3.fromElements(t[3],t[4],t[5],scratchColumn$2)),n.z=Cartesian3.magnitude(Cartesian3.fromElements(t[6],t[7],t[8],scratchColumn$2)),n};const scaleScratch3$2=new Cartesian3;Matrix3.getMaximumScale=function(t){return Matrix3.getScale(t,scaleScratch3$2),Cartesian3.maximumComponent(scaleScratch3$2)};const scaleScratch4$2=new Cartesian3;Matrix3.setRotation=function(t,n,o){Check.typeOf.object("matrix",t),Check.typeOf.object("result",o);const s=Matrix3.getScale(t,scaleScratch4$2);return o[0]=n[0]*s.x,o[1]=n[1]*s.x,o[2]=n[2]*s.x,o[3]=n[3]*s.y,o[4]=n[4]*s.y,o[5]=n[5]*s.y,o[6]=n[6]*s.z,o[7]=n[7]*s.z,o[8]=n[8]*s.z,o};const scaleScratch5$2=new Cartesian3;Matrix3.getRotation=function(t,n){Check.typeOf.object("matrix",t),Check.typeOf.object("result",n);const o=Matrix3.getScale(t,scaleScratch5$2);return n[0]=t[0]/o.x,n[1]=t[1]/o.x,n[2]=t[2]/o.x,n[3]=t[3]/o.y,n[4]=t[4]/o.y,n[5]=t[5]/o.y,n[6]=t[6]/o.z,n[7]=t[7]/o.z,n[8]=t[8]/o.z,n},Matrix3.multiply=function(t,n,o){Check.typeOf.object("left",t),Check.typeOf.object("right",n),Check.typeOf.object("result",o);const s=t[0]*n[0]+t[3]*n[1]+t[6]*n[2],c=t[1]*n[0]+t[4]*n[1]+t[7]*n[2],d=t[2]*n[0]+t[5]*n[1]+t[8]*n[2],h=t[0]*n[3]+t[3]*n[4]+t[6]*n[5],p=t[1]*n[3]+t[4]*n[4]+t[7]*n[5],y=t[2]*n[3]+t[5]*n[4]+t[8]*n[5],S=t[0]*n[6]+t[3]*n[7]+t[6]*n[8],P=t[1]*n[6]+t[4]*n[7]+t[7]*n[8],L=t[2]*n[6]+t[5]*n[7]+t[8]*n[8];return o[0]=s,o[1]=c,o[2]=d,o[3]=h,o[4]=p,o[5]=y,o[6]=S,o[7]=P,o[8]=L,o},Matrix3.add=function(t,n,o){return Check.typeOf.object("left",t),Check.typeOf.object("right",n),Check.typeOf.object("result",o),o[0]=t[0]+n[0],o[1]=t[1]+n[1],o[2]=t[2]+n[2],o[3]=t[3]+n[3],o[4]=t[4]+n[4],o[5]=t[5]+n[5],o[6]=t[6]+n[6],o[7]=t[7]+n[7],o[8]=t[8]+n[8],o},Matrix3.subtract=function(t,n,o){return Check.typeOf.object("left",t),Check.typeOf.object("right",n),Check.typeOf.object("result",o),o[0]=t[0]-n[0],o[1]=t[1]-n[1],o[2]=t[2]-n[2],o[3]=t[3]-n[3],o[4]=t[4]-n[4],o[5]=t[5]-n[5],o[6]=t[6]-n[6],o[7]=t[7]-n[7],o[8]=t[8]-n[8],o},Matrix3.multiplyByVector=function(t,n,o){Check.typeOf.object("matrix",t),Check.typeOf.object("cartesian",n),Check.typeOf.object("result",o);const s=n.x,c=n.y,d=n.z,h=t[0]*s+t[3]*c+t[6]*d,p=t[1]*s+t[4]*c+t[7]*d,y=t[2]*s+t[5]*c+t[8]*d;return o.x=h,o.y=p,o.z=y,o},Matrix3.multiplyByScalar=function(t,n,o){return Check.typeOf.object("matrix",t),Check.typeOf.number("scalar",n),Check.typeOf.object("result",o),o[0]=t[0]*n,o[1]=t[1]*n,o[2]=t[2]*n,o[3]=t[3]*n,o[4]=t[4]*n,o[5]=t[5]*n,o[6]=t[6]*n,o[7]=t[7]*n,o[8]=t[8]*n,o},Matrix3.multiplyByScale=function(t,n,o){return Check.typeOf.object("matrix",t),Check.typeOf.object("scale",n),Check.typeOf.object("result",o),o[0]=t[0]*n.x,o[1]=t[1]*n.x,o[2]=t[2]*n.x,o[3]=t[3]*n.y,o[4]=t[4]*n.y,o[5]=t[5]*n.y,o[6]=t[6]*n.z,o[7]=t[7]*n.z,o[8]=t[8]*n.z,o},Matrix3.multiplyByUniformScale=function(t,n,o){return Check.typeOf.object("matrix",t),Check.typeOf.number("scale",n),Check.typeOf.object("result",o),o[0]=t[0]*n,o[1]=t[1]*n,o[2]=t[2]*n,o[3]=t[3]*n,o[4]=t[4]*n,o[5]=t[5]*n,o[6]=t[6]*n,o[7]=t[7]*n,o[8]=t[8]*n,o},Matrix3.negate=function(t,n){return Check.typeOf.object("matrix",t),Check.typeOf.object("result",n),n[0]=-t[0],n[1]=-t[1],n[2]=-t[2],n[3]=-t[3],n[4]=-t[4],n[5]=-t[5],n[6]=-t[6],n[7]=-t[7],n[8]=-t[8],n},Matrix3.transpose=function(t,n){Check.typeOf.object("matrix",t),Check.typeOf.object("result",n);const o=t[0],s=t[3],c=t[6],d=t[1],h=t[4],p=t[7],y=t[2],S=t[5],P=t[8];return n[0]=o,n[1]=s,n[2]=c,n[3]=d,n[4]=h,n[5]=p,n[6]=y,n[7]=S,n[8]=P,n};function computeFrobeniusNorm(t){let n=0;for(let o=0;o<9;++o){const s=t[o];n+=s*s}return Math.sqrt(n)}const rowVal=[1,0,0],colVal=[2,2,1];function offDiagonalFrobeniusNorm(t){let n=0;for(let o=0;o<3;++o){const s=t[Matrix3.getElementIndex(colVal[o],rowVal[o])];n+=2*s*s}return Math.sqrt(n)}function shurDecomposition(t,n){const o=CesiumMath.EPSILON15;let s=0,c=1;for(let S=0;S<3;++S){const P=Math.abs(t[Matrix3.getElementIndex(colVal[S],rowVal[S])]);P>s&&(c=S,s=P)}let d=1,h=0;const p=rowVal[c],y=colVal[c];if(Math.abs(t[Matrix3.getElementIndex(y,p)])>o){const S=t[Matrix3.getElementIndex(y,y)],P=t[Matrix3.getElementIndex(p,p)],L=t[Matrix3.getElementIndex(y,p)],F=(S-P)/2/L;let N;F<0?N=-1/(-F+Math.sqrt(1+F*F)):N=1/(F+Math.sqrt(1+F*F)),d=1/Math.sqrt(1+N*N),h=N*d}return n=Matrix3.clone(Matrix3.IDENTITY,n),n[Matrix3.getElementIndex(p,p)]=n[Matrix3.getElementIndex(y,y)]=d,n[Matrix3.getElementIndex(y,p)]=h,n[Matrix3.getElementIndex(p,y)]=-h,n}const jMatrix=new Matrix3,jMatrixTranspose=new Matrix3;Matrix3.computeEigenDecomposition=function(t,n){Check.typeOf.object("matrix",t);const o=CesiumMath.EPSILON20,s=10;let c=0,d=0;defined(n)||(n={});const h=n.unitary=Matrix3.clone(Matrix3.IDENTITY,n.unitary),p=n.diagonal=Matrix3.clone(t,n.diagonal),y=o*computeFrobeniusNorm(p);for(;d<s&&offDiagonalFrobeniusNorm(p)>y;)shurDecomposition(p,jMatrix),Matrix3.transpose(jMatrix,jMatrixTranspose),Matrix3.multiply(p,jMatrix,p),Matrix3.multiply(jMatrixTranspose,p,p),Matrix3.multiply(h,jMatrix,h),++c>2&&(++d,c=0);return n},Matrix3.abs=function(t,n){return Check.typeOf.object("matrix",t),Check.typeOf.object("result",n),n[0]=Math.abs(t[0]),n[1]=Math.abs(t[1]),n[2]=Math.abs(t[2]),n[3]=Math.abs(t[3]),n[4]=Math.abs(t[4]),n[5]=Math.abs(t[5]),n[6]=Math.abs(t[6]),n[7]=Math.abs(t[7]),n[8]=Math.abs(t[8]),n},Matrix3.determinant=function(t){Check.typeOf.object("matrix",t);const n=t[0],o=t[3],s=t[6],c=t[1],d=t[4],h=t[7],p=t[2],y=t[5],S=t[8];return n*(d*S-y*h)+c*(y*s-o*S)+p*(o*h-d*s)},Matrix3.inverse=function(t,n){Check.typeOf.object("matrix",t),Check.typeOf.object("result",n);const o=t[0],s=t[1],c=t[2],d=t[3],h=t[4],p=t[5],y=t[6],S=t[7],P=t[8],L=Matrix3.determinant(t);if(Math.abs(L)<=CesiumMath.EPSILON15)throw new DeveloperError("matrix is not invertible");n[0]=h*P-S*p,n[1]=S*c-s*P,n[2]=s*p-h*c,n[3]=y*p-d*P,n[4]=o*P-y*c,n[5]=d*c-o*p,n[6]=d*S-y*h,n[7]=y*s-o*S,n[8]=o*h-d*s;const F=1/L;return Matrix3.multiplyByScalar(n,F,n)};const scratchTransposeMatrix$1=new Matrix3;Matrix3.inverseTranspose=function(t,n){return Check.typeOf.object("matrix",t),Check.typeOf.object("result",n),Matrix3.inverse(Matrix3.transpose(t,scratchTransposeMatrix$1),n)},Matrix3.equals=function(t,n){return t===n||defined(t)&&defined(n)&&t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]&&t[4]===n[4]&&t[5]===n[5]&&t[6]===n[6]&&t[7]===n[7]&&t[8]===n[8]},Matrix3.equalsEpsilon=function(t,n,o){return o=defaultValue(o,0),t===n||defined(t)&&defined(n)&&Math.abs(t[0]-n[0])<=o&&Math.abs(t[1]-n[1])<=o&&Math.abs(t[2]-n[2])<=o&&Math.abs(t[3]-n[3])<=o&&Math.abs(t[4]-n[4])<=o&&Math.abs(t[5]-n[5])<=o&&Math.abs(t[6]-n[6])<=o&&Math.abs(t[7]-n[7])<=o&&Math.abs(t[8]-n[8])<=o},Matrix3.IDENTITY=Object.freeze(new Matrix3(1,0,0,0,1,0,0,0,1)),Matrix3.ZERO=Object.freeze(new Matrix3(0,0,0,0,0,0,0,0,0)),Matrix3.COLUMN0ROW0=0,Matrix3.COLUMN0ROW1=1,Matrix3.COLUMN0ROW2=2,Matrix3.COLUMN1ROW0=3,Matrix3.COLUMN1ROW1=4,Matrix3.COLUMN1ROW2=5,Matrix3.COLUMN2ROW0=6,Matrix3.COLUMN2ROW1=7,Matrix3.COLUMN2ROW2=8,Object.defineProperties(Matrix3.prototype,{length:{get:function(){return Matrix3.packedLength}}}),Matrix3.prototype.clone=function(t){return Matrix3.clone(this,t)},Matrix3.prototype.equals=function(t){return Matrix3.equals(this,t)},Matrix3.equalsArray=function(t,n,o){return t[0]===n[o]&&t[1]===n[o+1]&&t[2]===n[o+2]&&t[3]===n[o+3]&&t[4]===n[o+4]&&t[5]===n[o+5]&&t[6]===n[o+6]&&t[7]===n[o+7]&&t[8]===n[o+8]},Matrix3.prototype.equalsEpsilon=function(t,n){return Matrix3.equalsEpsilon(this,t,n)},Matrix3.prototype.toString=function(){return`(${this[0]}, ${this[3]}, ${this[6]})
|
|
126
126
|
(${this[1]}, ${this[4]}, ${this[7]})
|
|
127
127
|
(${this[2]}, ${this[5]}, ${this[8]})`};function Cartesian4(t,n,o,s){this.x=defaultValue(t,0),this.y=defaultValue(n,0),this.z=defaultValue(o,0),this.w=defaultValue(s,0)}Cartesian4.fromElements=function(t,n,o,s,c){return defined(c)?(c.x=t,c.y=n,c.z=o,c.w=s,c):new Cartesian4(t,n,o,s)},Cartesian4.fromColor=function(t,n){return Check.typeOf.object("color",t),defined(n)?(n.x=t.red,n.y=t.green,n.z=t.blue,n.w=t.alpha,n):new Cartesian4(t.red,t.green,t.blue,t.alpha)},Cartesian4.clone=function(t,n){if(defined(t))return defined(n)?(n.x=t.x,n.y=t.y,n.z=t.z,n.w=t.w,n):new Cartesian4(t.x,t.y,t.z,t.w)},Cartesian4.packedLength=4,Cartesian4.pack=function(t,n,o){return Check.typeOf.object("value",t),Check.defined("array",n),o=defaultValue(o,0),n[o++]=t.x,n[o++]=t.y,n[o++]=t.z,n[o]=t.w,n},Cartesian4.unpack=function(t,n,o){return Check.defined("array",t),n=defaultValue(n,0),defined(o)||(o=new Cartesian4),o.x=t[n++],o.y=t[n++],o.z=t[n++],o.w=t[n],o},Cartesian4.packArray=function(t,n){Check.defined("array",t);const o=t.length,s=o*4;if(!defined(n))n=new Array(s);else{if(!Array.isArray(n)&&n.length!==s)throw new DeveloperError("If result is a typed array, it must have exactly array.length * 4 elements");n.length!==s&&(n.length=s)}for(let c=0;c<o;++c)Cartesian4.pack(t[c],n,c*4);return n},Cartesian4.unpackArray=function(t,n){if(Check.defined("array",t),Check.typeOf.number.greaterThanOrEquals("array.length",t.length,4),t.length%4!==0)throw new DeveloperError("array length must be a multiple of 4.");const o=t.length;defined(n)?n.length=o/4:n=new Array(o/4);for(let s=0;s<o;s+=4){const c=s/4;n[c]=Cartesian4.unpack(t,s,n[c])}return n},Cartesian4.fromArray=Cartesian4.unpack,Cartesian4.maximumComponent=function(t){return Check.typeOf.object("cartesian",t),Math.max(t.x,t.y,t.z,t.w)},Cartesian4.minimumComponent=function(t){return Check.typeOf.object("cartesian",t),Math.min(t.x,t.y,t.z,t.w)},Cartesian4.minimumByComponent=function(t,n,o){return Check.typeOf.object("first",t),Check.typeOf.object("second",n),Check.typeOf.object("result",o),o.x=Math.min(t.x,n.x),o.y=Math.min(t.y,n.y),o.z=Math.min(t.z,n.z),o.w=Math.min(t.w,n.w),o},Cartesian4.maximumByComponent=function(t,n,o){return Check.typeOf.object("first",t),Check.typeOf.object("second",n),Check.typeOf.object("result",o),o.x=Math.max(t.x,n.x),o.y=Math.max(t.y,n.y),o.z=Math.max(t.z,n.z),o.w=Math.max(t.w,n.w),o},Cartesian4.clamp=function(t,n,o,s){Check.typeOf.object("value",t),Check.typeOf.object("min",n),Check.typeOf.object("max",o),Check.typeOf.object("result",s);const c=CesiumMath.clamp(t.x,n.x,o.x),d=CesiumMath.clamp(t.y,n.y,o.y),h=CesiumMath.clamp(t.z,n.z,o.z),p=CesiumMath.clamp(t.w,n.w,o.w);return s.x=c,s.y=d,s.z=h,s.w=p,s},Cartesian4.magnitudeSquared=function(t){return Check.typeOf.object("cartesian",t),t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w},Cartesian4.magnitude=function(t){return Math.sqrt(Cartesian4.magnitudeSquared(t))};const distanceScratch=new Cartesian4;Cartesian4.distance=function(t,n){return Check.typeOf.object("left",t),Check.typeOf.object("right",n),Cartesian4.subtract(t,n,distanceScratch),Cartesian4.magnitude(distanceScratch)},Cartesian4.distanceSquared=function(t,n){return Check.typeOf.object("left",t),Check.typeOf.object("right",n),Cartesian4.subtract(t,n,distanceScratch),Cartesian4.magnitudeSquared(distanceScratch)},Cartesian4.normalize=function(t,n){Check.typeOf.object("cartesian",t),Check.typeOf.object("result",n);const o=Cartesian4.magnitude(t);if(n.x=t.x/o,n.y=t.y/o,n.z=t.z/o,n.w=t.w/o,isNaN(n.x)||isNaN(n.y)||isNaN(n.z)||isNaN(n.w))throw new DeveloperError("normalized result is not a number");return n},Cartesian4.dot=function(t,n){return Check.typeOf.object("left",t),Check.typeOf.object("right",n),t.x*n.x+t.y*n.y+t.z*n.z+t.w*n.w},Cartesian4.multiplyComponents=function(t,n,o){return Check.typeOf.object("left",t),Check.typeOf.object("right",n),Check.typeOf.object("result",o),o.x=t.x*n.x,o.y=t.y*n.y,o.z=t.z*n.z,o.w=t.w*n.w,o},Cartesian4.divideComponents=function(t,n,o){return Check.typeOf.object("left",t),Check.typeOf.object("right",n),Check.typeOf.object("result",o),o.x=t.x/n.x,o.y=t.y/n.y,o.z=t.z/n.z,o.w=t.w/n.w,o},Cartesian4.add=function(t,n,o){return Check.typeOf.object("left",t),Check.typeOf.object("right",n),Check.typeOf.object("result",o),o.x=t.x+n.x,o.y=t.y+n.y,o.z=t.z+n.z,o.w=t.w+n.w,o},Cartesian4.subtract=function(t,n,o){return Check.typeOf.object("left",t),Check.typeOf.object("right",n),Check.typeOf.object("result",o),o.x=t.x-n.x,o.y=t.y-n.y,o.z=t.z-n.z,o.w=t.w-n.w,o},Cartesian4.multiplyByScalar=function(t,n,o){return Check.typeOf.object("cartesian",t),Check.typeOf.number("scalar",n),Check.typeOf.object("result",o),o.x=t.x*n,o.y=t.y*n,o.z=t.z*n,o.w=t.w*n,o},Cartesian4.divideByScalar=function(t,n,o){return Check.typeOf.object("cartesian",t),Check.typeOf.number("scalar",n),Check.typeOf.object("result",o),o.x=t.x/n,o.y=t.y/n,o.z=t.z/n,o.w=t.w/n,o},Cartesian4.negate=function(t,n){return Check.typeOf.object("cartesian",t),Check.typeOf.object("result",n),n.x=-t.x,n.y=-t.y,n.z=-t.z,n.w=-t.w,n},Cartesian4.abs=function(t,n){return Check.typeOf.object("cartesian",t),Check.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};const lerpScratch$1=new Cartesian4;Cartesian4.lerp=function(t,n,o,s){return Check.typeOf.object("start",t),Check.typeOf.object("end",n),Check.typeOf.number("t",o),Check.typeOf.object("result",s),Cartesian4.multiplyByScalar(n,o,lerpScratch$1),s=Cartesian4.multiplyByScalar(t,1-o,s),Cartesian4.add(lerpScratch$1,s,s)};const mostOrthogonalAxisScratch=new Cartesian4;Cartesian4.mostOrthogonalAxis=function(t,n){Check.typeOf.object("cartesian",t),Check.typeOf.object("result",n);const o=Cartesian4.normalize(t,mostOrthogonalAxisScratch);return Cartesian4.abs(o,o),o.x<=o.y?o.x<=o.z?o.x<=o.w?n=Cartesian4.clone(Cartesian4.UNIT_X,n):n=Cartesian4.clone(Cartesian4.UNIT_W,n):o.z<=o.w?n=Cartesian4.clone(Cartesian4.UNIT_Z,n):n=Cartesian4.clone(Cartesian4.UNIT_W,n):o.y<=o.z?o.y<=o.w?n=Cartesian4.clone(Cartesian4.UNIT_Y,n):n=Cartesian4.clone(Cartesian4.UNIT_W,n):o.z<=o.w?n=Cartesian4.clone(Cartesian4.UNIT_Z,n):n=Cartesian4.clone(Cartesian4.UNIT_W,n),n},Cartesian4.equals=function(t,n){return t===n||defined(t)&&defined(n)&&t.x===n.x&&t.y===n.y&&t.z===n.z&&t.w===n.w},Cartesian4.equalsArray=function(t,n,o){return t.x===n[o]&&t.y===n[o+1]&&t.z===n[o+2]&&t.w===n[o+3]},Cartesian4.equalsEpsilon=function(t,n,o,s){return t===n||defined(t)&&defined(n)&&CesiumMath.equalsEpsilon(t.x,n.x,o,s)&&CesiumMath.equalsEpsilon(t.y,n.y,o,s)&&CesiumMath.equalsEpsilon(t.z,n.z,o,s)&&CesiumMath.equalsEpsilon(t.w,n.w,o,s)},Cartesian4.ZERO=Object.freeze(new Cartesian4(0,0,0,0)),Cartesian4.ONE=Object.freeze(new Cartesian4(1,1,1,1)),Cartesian4.UNIT_X=Object.freeze(new Cartesian4(1,0,0,0)),Cartesian4.UNIT_Y=Object.freeze(new Cartesian4(0,1,0,0)),Cartesian4.UNIT_Z=Object.freeze(new Cartesian4(0,0,1,0)),Cartesian4.UNIT_W=Object.freeze(new Cartesian4(0,0,0,1)),Cartesian4.prototype.clone=function(t){return Cartesian4.clone(this,t)},Cartesian4.prototype.equals=function(t){return Cartesian4.equals(this,t)},Cartesian4.prototype.equalsEpsilon=function(t,n,o){return Cartesian4.equalsEpsilon(this,t,n,o)},Cartesian4.prototype.toString=function(){return`(${this.x}, ${this.y}, ${this.z}, ${this.w})`};const scratchF32Array=new Float32Array(1),scratchU8Array=new Uint8Array(scratchF32Array.buffer),testU32=new Uint32Array([287454020]),testU8=new Uint8Array(testU32.buffer),littleEndian=testU8[0]===68;Cartesian4.packFloat=function(t,n){return Check.typeOf.number("value",t),defined(n)||(n=new Cartesian4),scratchF32Array[0]=t,littleEndian?(n.x=scratchU8Array[0],n.y=scratchU8Array[1],n.z=scratchU8Array[2],n.w=scratchU8Array[3]):(n.x=scratchU8Array[3],n.y=scratchU8Array[2],n.z=scratchU8Array[1],n.w=scratchU8Array[0]),n},Cartesian4.unpackFloat=function(t){return Check.typeOf.object("packedFloat",t),littleEndian?(scratchU8Array[0]=t.x,scratchU8Array[1]=t.y,scratchU8Array[2]=t.z,scratchU8Array[3]=t.w):(scratchU8Array[0]=t.w,scratchU8Array[1]=t.z,scratchU8Array[2]=t.y,scratchU8Array[3]=t.x),scratchF32Array[0]};function RuntimeError(t){this.name="RuntimeError",this.message=t;let n;try{throw new Error}catch(o){n=o.stack}this.stack=n}defined(Object.create)&&(RuntimeError.prototype=Object.create(Error.prototype),RuntimeError.prototype.constructor=RuntimeError),RuntimeError.prototype.toString=function(){let t=`${this.name}: ${this.message}`;return defined(this.stack)&&(t+=`
|
|
@@ -6213,7 +6213,7 @@ czm_material czm_getMaterial(czm_materialInput materialInput) {
|
|
|
6213
6213
|
#else
|
|
6214
6214
|
initialColor = u_initialColor;
|
|
6215
6215
|
#endif
|
|
6216
|
-
vec4 color = computeDayColor(initialColor`).erase(["#ifdef APPLY_MATERIAL","czm_materialInput materialInput;","materialInput.st = v_textureCoordinates.st;","materialInput.normalEC = normalize(v_normalEC);","materialInput.positionToEyeEC = -v_positionEC;","materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalize(v_normalEC));","materialInput.slope = v_slope;","materialInput.height = v_height;","materialInput.aspect = v_aspect;","czm_material material = czm_getMaterial(materialInput);","vec4 materialColor = vec4(material.diffuse, material.alpha);","color = alphaBlend(materialColor, color);","#endif"]);function makeGlobeShadersDirty(t){const n=t.material;n==null?(t.material=Cesium$1.Material.fromType("Color"),t.material=void 0):(t.material=void 0,t.material=n)}const useIBL=({sphericalHarmonicCoefficients:t,globeImageBasedLighting:n,hasVertexNormals:o,enableLighting:s})=>{const c=React.useMemo(()=>o&&s,[o,s]),d=useImmutableFunction(t||[]),h=useImmutableFunction(n&&!!t),p=React.useMemo(()=>({u_reearth_sphericalHarmonicCoefficients:d,u_reearth_globeImageBasedLighting:h}),[d,h]),y=React.useMemo(()=>new StringMatcher().replace(["float diffuseIntensity = clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalize(v_normalEC)) * u_lambertDiffuseMultiplier + u_vertexShadowDarkness, 0.0, 1.0);","vec4 finalColor = vec4(color.rgb * czm_lightColor * diffuseIntensity, color.a);"],"vec4 finalColor = reearth_computeImageBasedLightingColor(color);"),[]);return{uniformMapForIBL:p,isIBLEnabled:c,shaderForIBL:y}},useTerrainHeatmap=({cesium:t,terrain:n})=>{const{type:o,maxHeight:s,minHeight:c,logarithmic:d,colorLUT:h}=(n==null?void 0:n.elevationHeatMap)??{},p=React.useMemo(()=>o==="custom",[o]),y=React.useMemo(()=>new StringMatcher().replace(["#ifdef APPLY_COLOR_TO_ALPHA","vec3 colorDiff = abs(color.rgb - colorToAlpha.rgb);","colorDiff.r = czm_maximumComponent(colorDiff);","alpha = czm_branchFreeTernary(colorDiff.r < colorToAlpha.a, 0.0, alpha);","#endif"],"color = reearth_calculateElevationMapForGlobe(colorToAlpha, color);"),[]);return React.useEffect(()=>{var P;if(!((P=t.current)!=null&&P.cesiumElement)||!p)return;const S=t.current.cesiumElement.scene.globe;return S.material=new VertexTerrainElevationMaterial,()=>{S.material=void 0}},[t,p]),React.useEffect(()=>{var P;if(!((P=t.current)!=null&&P.cesiumElement)||!p)return;const S=t.current.cesiumElement.scene.globe;S.material instanceof VertexTerrainElevationMaterial&&(S.material.uniforms.minHeight=c??S.material.uniforms.minHeight,S.material.uniforms.maxHeight=s??S.material.uniforms.maxHeight,S.material.uniforms.logarithmic=d??S.material.uniforms.logarithmic)},[t,p,s,c,d]),React.useEffect(()=>{var P;if(!((P=t.current)!=null&&P.cesiumElement)||!p||!h)return;const S=t.current.cesiumElement.scene.globe;S.material instanceof VertexTerrainElevationMaterial&&(S.material.uniforms.colorMap=createColorMapImage(h))},[t,p,h]),{isCustomHeatmapEnabled:p,shaderForTerrainHeatmap:y}},useOverrideGlobeShader=({cesium:t,sphericalHarmonicCoefficients:n,globeShadowDarkness:o,globeImageBasedLighting:s,hasVertexNormals:c,enableLighting:d,terrain:h})=>{const{uniformMapForIBL:p,isIBLEnabled:y,shaderForIBL:S}=useIBL({sphericalHarmonicCoefficients:n,globeImageBasedLighting:s,hasVertexNormals:c,enableLighting:d}),{isCustomHeatmapEnabled:P,shaderForTerrainHeatmap:L}=useTerrainHeatmap({cesium:t,terrain:h});React.useEffect(()=>{var W;if(!((W=t.current)!=null&&W.cesiumElement)||!c)return;const z=t.current.cesiumElement.scene.globe;z.vertexShadowDarkness=o??z.vertexShadowDarkness},[t,o,c]);const F=React.useRef(!1),N=React.useCallback(()=>{var mn,_i;if(!((mn=t.current)!=null&&mn.cesiumElement)||!F.current)return;const z=t.current.cesiumElement.scene.globe,W=z._surfaceShaderSet;if(!W)return;const nt=W.baseFragmentShaderSource,Pe=nt==null?void 0:nt.sources[nt.sources.length-1];if(!Pe||!nt)return;const se=[],mt=[];if(y&&z.enableLighting&&z.terrainProvider.hasVertexNormals&&(se.push(S),mt.push(IBLFS)),P&&(se.push(L),mt.push(HeatmapForTerrainFS)),!se.length||(F.current=!1,!((_i=z==null?void 0:z._surface)!=null&&_i._tileProvider)))return;makeGlobeShadersDirty(z);const kt=defaultMatcher.concat(...se).execute(Pe);z._surface._tileProvider.materialUniformMap={...z._surface._tileProvider.materialUniformMap??{},...p},W.baseFragmentShaderSource=new ShaderSource({sources:[...nt.sources.slice(0,-1),GlobeFSDefinitions+kt+mt.join("")],defines:nt.defines})},[t,P,y,S,L,p]);React.useEffect(()=>{var z;if((z=t.current)!=null&&z.cesiumElement)return t.current.cesiumElement.scene.postRender.addEventListener(N)},[t,N]),React.useEffect(()=>{var nt;if(!((nt=t.current)!=null&&nt.cesiumElement)||!y&&!P)return;const z=t.current.cesiumElement.scene,W=z.globe;return F.current=!0,z.requestRender(),()=>{W.isDestroyed()||makeGlobeShadersDirty(W)}},[t,P,y])},useViewerProperty=({cesium:t,property:n})=>{var h,p,y,S,P,L,F,N,z,W,nt;const o=React.useMemo(()=>{var se,mt,kt,mn,_i,zi,Sa,fa,La,Ra,ma,yt,lt,pi,ba,Sc,ms,Xs,Nl,pu,yu,Ru,Vd,Gd,uf,ff,pf;let Pe;return((mt=(se=n==null?void 0:n.scene)==null?void 0:se.light)==null?void 0:mt.type)==="sunLight"?Pe=new Cesium$1.SunLight({color:(mn=(kt=n.scene)==null?void 0:kt.light)!=null&&mn.color?Cesium$1.Color.fromCssColorString(n.scene.light.color):void 0,intensity:(zi=(_i=n.scene)==null?void 0:_i.light)==null?void 0:zi.intensity}):((fa=(Sa=n==null?void 0:n.scene)==null?void 0:Sa.light)==null?void 0:fa.type)==="directionalLight"?Pe=new Cesium$1.DirectionalLight({direction:new Cesium$1.Cartesian3(((ma=(Ra=(La=n==null?void 0:n.scene)==null?void 0:La.light)==null?void 0:Ra.direction)==null?void 0:ma[0])??1,((pi=(lt=(yt=n==null?void 0:n.scene)==null?void 0:yt.light)==null?void 0:lt.direction)==null?void 0:pi[1])??0,((ms=(Sc=(ba=n==null?void 0:n.scene)==null?void 0:ba.light)==null?void 0:Sc.direction)==null?void 0:ms[2])??0),color:(Nl=(Xs=n.scene)==null?void 0:Xs.light)!=null&&Nl.color?Cesium$1.Color.fromCssColorString(n.scene.light.color):void 0,intensity:(yu=(pu=n.scene)==null?void 0:pu.light)==null?void 0:yu.intensity}):(Pe=(Vd=(Ru=t.current)==null?void 0:Ru.cesiumElement)==null?void 0:Vd.scene.light,Pe&&(Pe.color=(uf=(Gd=n==null?void 0:n.scene)==null?void 0:Gd.light)!=null&&uf.color?Cesium$1.Color.fromCssColorString(n.scene.light.color):Pe.color,Pe.intensity=(pf=(ff=n==null?void 0:n.scene)==null?void 0:ff.light)!=null&&pf.intensity?n.scene.light.intensity:Pe.intensity)),Pe},[t,(p=(h=n==null?void 0:n.scene)==null?void 0:h.light)==null?void 0:p.type,(S=(y=n==null?void 0:n.scene)==null?void 0:y.light)==null?void 0:S.color,(L=(P=n==null?void 0:n.scene)==null?void 0:P.light)==null?void 0:L.direction,(N=(F=n==null?void 0:n.scene)==null?void 0:F.light)==null?void 0:N.intensity]),s=React.useMemo(()=>{var Pe;return(Pe=n==null?void 0:n.scene)!=null&&Pe.backgroundColor?Cesium$1.Color.fromCssColorString(n.scene.backgroundColor):void 0},[(z=n==null?void 0:n.scene)==null?void 0:z.backgroundColor]),c=React.useMemo(()=>{var Pe,se,mt;return((Pe=n==null?void 0:n.render)==null?void 0:Pe.antialias)==="extreme"?8:((se=n==null?void 0:n.render)==null?void 0:se.antialias)==="high"?6:((mt=n==null?void 0:n.render)==null?void 0:mt.antialias)==="medium"?4:1},[(W=n==null?void 0:n.render)==null?void 0:W.antialias]),d=React.useMemo(()=>{var Pe,se;return((Pe=n==null?void 0:n.scene)==null?void 0:Pe.mode)==="2d"?Cesium$1.SceneMode.SCENE2D:((se=n==null?void 0:n.scene)==null?void 0:se.mode)==="columbus"?Cesium$1.SceneMode.COLUMBUS_VIEW:Cesium$1.SceneMode.SCENE3D},[(nt=n==null?void 0:n.scene)==null?void 0:nt.mode]);return{sceneLight:o,sceneBackgroundColor:s,sceneMsaaSamples:c,sceneMode:d}},useHooks$1=({ref:t,property:n,time:o,selectedLayerId:s,selectionReason:c,meta:d,layersRef:h,featureFlags:p,timelineManagerRef:y,isLayerDraggable:S,isLayerDragging:P,shouldRender:L,requestingRenderMode:F,camera:N,cameraForceHorizontalRoll:z,onLayerSelect:W,onLayerDrag:nt,onLayerDrop:Pe,onLayerEdit:se,onLayerSelectWithRectStart:mt,onLayerSelectWithRectMove:kt,onLayerSelectWithRectEnd:mn,onLayerVisibility:_i,onLayerLoad:zi,onCameraChange:Sa,onMount:fa,onCreditsUpdate:La})=>{var sf,nf,df,Cf,mf,Sf,Pf,Af,Hf,_f,wf,Yf,Nf,vf,Ff,Xf,Wf,Qf,_m,Bf,$m,qf,qm,ep;const Ra=React.useRef(null),ma=typeof(d==null?void 0:d.cesiumIonAccessToken)=="string"&&d.cesiumIonAccessToken?d.cesiumIonAccessToken:Cesium$1.Ion.defaultAccessToken,yt=useEngineRef(t,Ra),lt=useLayerSelectWithRect({cesium:Ra,engineAPI:yt,onLayerSelectWithRectStart:mt,onLayerSelectWithRectMove:kt,onLayerSelectWithRectEnd:mn,featureFlags:p});React.useEffect(()=>{var Uf,jf,jm,sp,cp,fp,mp,al,tf,lf,yf,Lf,Of,Mf;const Tf=(jf=(Uf=Ra==null?void 0:Ra.current)==null?void 0:Uf.cesiumElement)==null?void 0:jf.shadowMap;if(!Tf)return;Tf.softShadows=((cp=(sp=(jm=n==null?void 0:n.scene)==null?void 0:jm.shadow)==null?void 0:sp.shadowMap)==null?void 0:cp.softShadows)??!1,Tf.darkness=((al=(mp=(fp=n==null?void 0:n.scene)==null?void 0:fp.shadow)==null?void 0:mp.shadowMap)==null?void 0:al.darkness)??.3,Tf.size=((yf=(lf=(tf=n==null?void 0:n.scene)==null?void 0:tf.shadow)==null?void 0:lf.shadowMap)==null?void 0:yf.size)??2048,Tf.maximumDistance=((Mf=(Of=(Lf=n==null?void 0:n.scene)==null?void 0:Lf.shadow)==null?void 0:Of.shadowMap)==null?void 0:Mf.maximumDistance)??5e3,Tf.fadingEnabled=!0,Tf.normalOffset=!0;const rf={polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffsetScale:.5,normalShading:!0,normalShadingSmooth:.3,depthBias:1e-4},bf={polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffsetScale:.1*100,normalShading:!0,normalShadingSmooth:.05,depthBias:2e-5*10},If={polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffsetScale:0,normalShading:!0,normalShadingSmooth:.1,depthBias:5e-4};Tf._terrainBias&&Object.assign(Tf._terrainBias,rf),Tf._primitiveBias&&Object.assign(Tf._primitiveBias,bf),Tf._pointBias&&Object.assign(Tf._pointBias,If)},[(df=(nf=(sf=n==null?void 0:n.scene)==null?void 0:sf.shadow)==null?void 0:nf.shadowMap)==null?void 0:df.softShadows,(Sf=(mf=(Cf=n==null?void 0:n.scene)==null?void 0:Cf.shadow)==null?void 0:mf.shadowMap)==null?void 0:Sf.darkness,(Hf=(Af=(Pf=n==null?void 0:n.scene)==null?void 0:Pf.shadow)==null?void 0:Af.shadowMap)==null?void 0:Hf.size,(Yf=(wf=(_f=n==null?void 0:n.scene)==null?void 0:_f.shadow)==null?void 0:wf.shadowMap)==null?void 0:Yf.maximumDistance]);const pi=React.useRef(),ba=React.useRef();React.useEffect(()=>{var Uf,jf,jm,sp,cp,fp,mp,al;const Tf=(Uf=Ra.current)==null?void 0:Uf.cesiumElement;if(!Tf||Tf.isDestroyed()||ba.current===(s==null?void 0:s.featureId)&&(s==null?void 0:s.featureId)!==void 0)return;const rf=getTag(pi.current);if(!(rf!=null&&rf.featureId)&&(rf!=null&&rf.layerId)&&(s!=null&&s.layerId)&&(rf==null?void 0:rf.layerId)===s.layerId||rf!=null&&rf.featureId&&(s!=null&&s.featureId)&&(rf==null?void 0:rf.featureId)===s.featureId)return;const bf=findEntity(Tf,void 0,s==null?void 0:s.featureId)||findEntity(Tf,s==null?void 0:s.layerId);if(pi.current===bf)return;const If=getTag(bf);if(bf instanceof Cesium$1.Entity&&!(If!=null&&If.hideIndicator)?Tf.selectedEntity=bf:Tf.selectedEntity=void 0,pi.current=bf,!bf&&(s!=null&&s.featureId)){const tf=[],lf=(jf=h==null?void 0:h.current)==null?void 0:jf.findAll(yf=>{var Lf,Of;return yf.type==="simple"&&!!((Lf=yf.data)!=null&&Lf.type)&&tf.includes((Of=yf.data)==null?void 0:Of.type)});if(lf!=null&&lf.length){const[yf,Lf]=(()=>{var Of;for(const Mf of lf){const Vf=(Of=Mf.computed)==null?void 0:Of.features.find(Gf=>Gf.id!==(s==null?void 0:s.featureId));if(Vf)return[Vf,Mf.id]}})()||[];W==null||W(Lf,yf==null?void 0:yf.id)}}if(!(If!=null&&If.unselectable)){if(bf&&bf instanceof Cesium$1.Cesium3DTileFeature){const tf=getTag(bf);if(tf){const lf=tileProperties(bf);W==null||W(tf.layerId,String(tf.featureId),lf.length?{defaultInfobox:{title:bf.getProperty("name"),content:{type:"table",value:lf}}}:void 0,{feature:tf.computedFeature})}return}if(bf){const tf=If!=null&&If.layerId?((jm=h==null?void 0:h.current)==null?void 0:jm.overriddenLayers().find(lf=>lf.id===If.layerId))??((sp=h==null?void 0:h.current)==null?void 0:sp.findById(If.layerId)):void 0;W==null||W(If==null?void 0:If.layerId,If==null?void 0:If.featureId,bf instanceof Cesium$1.Entity&&(bf.description||bf.properties)?{defaultInfobox:{title:bf.name,content:getEntityContent(bf,((fp=(cp=Ra.current)==null?void 0:cp.cesiumElement)==null?void 0:fp.clock.currentTime)??new Cesium$1.JulianDate,If!=null&&If.layerId?(al=(mp=tf==null?void 0:tf.infobox)==null?void 0:mp.property)==null?void 0:al.defaultContent:void 0)}}:void 0)}}},[Ra,s,W,h,p]);const Sc=React.useMemo(()=>{var Tf,rf,bf,If,Uf,jf;return(rf=(Tf=n==null?void 0:n.scene)==null?void 0:Tf.imageBasedLighting)!=null&&rf.sphericalHarmonicCoefficients?arrayToCartecian3((If=(bf=n==null?void 0:n.scene)==null?void 0:bf.imageBasedLighting)==null?void 0:If.sphericalHarmonicCoefficients,(jf=(Uf=n==null?void 0:n.scene)==null?void 0:Uf.imageBasedLighting)==null?void 0:jf.intensity):void 0},[(vf=(Nf=n==null?void 0:n.scene)==null?void 0:Nf.imageBasedLighting)==null?void 0:vf.sphericalHarmonicCoefficients,(Xf=(Ff=n==null?void 0:n.scene)==null?void 0:Ff.imageBasedLighting)==null?void 0:Xf.intensity]);useOverrideGlobeShader({cesium:Ra,sphericalHarmonicCoefficients:Sc,globeShadowDarkness:(Qf=(Wf=n==null?void 0:n.scene)==null?void 0:Wf.shadow)==null?void 0:Qf.darkness,globeImageBasedLighting:(Bf=(_m=n==null?void 0:n.scene)==null?void 0:_m.imageBasedLighting)==null?void 0:Bf.enabled,enableLighting:($m=n==null?void 0:n.globe)==null?void 0:$m.enableLighting,hasVertexNormals:((qf=n==null?void 0:n.terrain)==null?void 0:qf.enabled)&&n.terrain.normal,terrain:n==null?void 0:n.terrain});const ms=React.useCallback((Tf,rf,bf)=>{var If,Uf;if(((If=yt.mouseEventCallbacks[Tf])==null?void 0:If.length)>0){const jf=(Uf=Ra.current)==null?void 0:Uf.cesiumElement;if(!jf||jf.isDestroyed())return;const jm=makeMouseEventProps(jf,rf);if(!jm)return;const sp=getLayerId(bf);sp&&(jm.layerId=sp),yt.mouseEventCallbacks[Tf].forEach(cp=>cp(jm))}},[yt]),Xs=React.useCallback(Tf=>{yt.mouseEventCallbacks.wheel.length>0&&yt.mouseEventCallbacks.wheel.forEach(rf=>rf({delta:Tf}))},[yt]),Nl=React.useMemo(()=>{const Tf={click:void 0,doubleClick:void 0,mouseDown:void 0,mouseUp:void 0,rightClick:void 0,rightDown:void 0,rightUp:void 0,middleClick:void 0,middleDown:void 0,middleUp:void 0,mouseMove:void 0,mouseEnter:void 0,mouseLeave:void 0,wheel:rf=>{Xs(rf)}};return Object.keys(Tf).forEach(rf=>{rf!=="wheel"&&(Tf[rf]=(bf,If)=>{ms(rf,bf,If)})}),Tf},[ms,Xs]),pu=React.useCallback(async(Tf,rf)=>{var jf,jm,sp,cp,fp,mp,al,tf,lf,yf,Lf,Of,Mf,Vf;if((jf=Nl.click)==null||jf.call(Nl,Tf,rf),!(p&FEATURE_FLAGS.SINGLE_SELECTION))return;const bf=(jm=Ra.current)==null?void 0:jm.cesiumElement;if(!bf||bf.isDestroyed())return;ba.current=void 0;const If=findEntity(bf,void 0,s==null?void 0:s.featureId)||findEntity(bf,s==null?void 0:s.layerId),Uf=getTag(If);if((!If||If instanceof Cesium$1.Entity&&(Uf!=null&&Uf.hideIndicator))&&(bf.selectedEntity=void 0),rf&&"id"in rf&&rf.id instanceof Cesium$1.Entity&&isSelectable(rf.id)){const Gf=getTag(rf.id),Df=Gf!=null&&Gf.layerId?((sp=h==null?void 0:h.current)==null?void 0:sp.overriddenLayers().find(Zf=>Zf.id===Gf.layerId))??((cp=h==null?void 0:h.current)==null?void 0:cp.findById(Gf.layerId)):void 0;W==null||W(Gf==null?void 0:Gf.layerId,Gf==null?void 0:Gf.featureId,rf.id.description||rf.id.properties?{defaultInfobox:{title:(Df==null?void 0:Df.title)??rf.id.name,content:getEntityContent(rf.id,bf.clock.currentTime??new Cesium$1.JulianDate,Gf!=null&&Gf.layerId?(mp=(fp=Df==null?void 0:Df.infobox)==null?void 0:fp.property)==null?void 0:mp.defaultContent:void 0)}}:void 0),pi.current=rf.id,rf.id instanceof Cesium$1.Entity&&!(Gf!=null&&Gf.hideIndicator)?bf.selectedEntity=rf.id:bf.selectedEntity=void 0;return}if(rf&&(rf instanceof Cesium$1.Cesium3DTileFeature||rf instanceof Cesium$1.Cesium3DTilePointFeature)){const Gf=getTag(rf);if(Gf){const Df=tileProperties(rf);W==null||W(Gf.layerId,String(Gf.featureId),Df.length?{defaultInfobox:{title:rf.getProperty("name"),content:{type:"table",value:tileProperties(rf)}}}:void 0,{feature:Gf.computedFeature}),pi.current=rf}return}if(rf&&"content"in rf&&rf.content&&typeof rf.content=="object"&&"_model"in rf.content&&rf.content._model instanceof Cesium$1.Model){const Gf=rf.content._model,Df=getTag(Gf);Df&&(W==null||W(Df.layerId,String(Df.featureId)),pi.current=Gf);return}if(rf!=null&&rf.primitive&&(rf.primitive instanceof Cesium$1.Primitive||rf.primitive instanceof Cesium$1.GroundPrimitive)){const Gf=rf.primitive,Df=getTag(Gf);Df&&(W==null||W(Df.layerId,String(Df.featureId)),pi.current=Gf);return}if(rf===void 0&&Tf.position){const Gf=bf.scene,Df=Gf.camera.getPickRay(Tf.position);if(Df){const Zf=await Gf.imageryLayers.pickImageryLayerFeatures(Df,Gf),Kf=Zf==null?void 0:Zf.findLast(ap=>{var Fp,Kp,qp,cg;const rp=(Fp=ap==null?void 0:ap.data)==null?void 0:Fp.appearanceType;return rp&&((cg=(qp=(Kp=ap==null?void 0:ap.data)==null?void 0:Kp.feature)==null?void 0:qp[rp])==null?void 0:cg.show)!==!1}),yp=(al=Kf==null?void 0:Kf.data)==null?void 0:al.appearanceType;if(yp&&((yf=(lf=(tf=Kf==null?void 0:Kf.data)==null?void 0:tf.feature)==null?void 0:lf[yp])==null?void 0:yf.show)!==!1){const ap=getTag(Kf.imageryLayer),rp=Kf.position;rp&&requestAnimationFrame(()=>{ap!=null&&ap.hideIndicator||(bf.selectedEntity=new Cesium$1.Entity({position:Cesium$1.Cartographic.toCartesian(rp)}))});const Fp=ap!=null&&ap.layerId?((Lf=h==null?void 0:h.current)==null?void 0:Lf.overriddenLayers().find(qp=>qp.id===ap.layerId))??((Of=h==null?void 0:h.current)==null?void 0:Of.findById(ap.layerId)):void 0,Kp=getEntityContent(Kf.data.feature??Kf,bf.clock.currentTime??new Cesium$1.JulianDate,ap!=null&&ap.layerId?(Vf=(Mf=Fp==null?void 0:Fp.infobox)==null?void 0:Mf.property)==null?void 0:Vf.defaultContent:void 0);ba.current=Kf.data.featureId,W==null||W(Kf.data.layerId,Kf.data.featureId,Kp.value.length?{defaultInfobox:{title:(Fp==null?void 0:Fp.title)??Kf.name,content:Kp}}:void 0,{feature:Kf.data.feature});return}}}bf.selectedEntity=void 0,W==null||W()},[W,Nl,h,p,s==null?void 0:s.featureId,s==null?void 0:s.layerId]);React.useEffect(()=>{var Tf;if(e2eAccessToken())return setE2ECesiumViewer((Tf=Ra.current)==null?void 0:Tf.cesiumElement),()=>{setE2ECesiumViewer(void 0)}},[(qm=Ra.current)==null?void 0:qm.cesiumElement]),React.useEffect(()=>{var rf;const Tf=(rf=Ra.current)==null?void 0:rf.cesiumElement;!Tf||Tf.isDestroyed()||Tf.scene.requestRender()});const yu=React.useCallback(()=>{var rf;const Tf=(rf=Ra.current)==null?void 0:rf.cesiumElement;!Tf||Tf.isDestroyed()||Tf.scene.requestRender()},[]),Ru=React.useRef(La);Ru.current=La;const Vd=React.useCallback(()=>{Ru.current&&setTimeout(()=>{var bf;if(!Ru.current)return;const Tf=(bf=Ra.current)==null?void 0:bf.cesiumElement;if(!Tf||Tf.isDestroyed())return;const rf=getCredits(Tf)??[];Ru.current(rf)},3e3)},[]),Gd=React.useMemo(()=>({selectionReason:c,timelineManagerRef:y,flyTo:yt.flyTo,getCamera:yt.getCamera,onLayerEdit:se,onLayerVisibility:_i,onLayerLoad:zi,requestRender:yt.requestRender,getSurfaceDistance:yt.getSurfaceDistance,toXYZ:yt.toXYZ,toWindowPosition:yt.toWindowPosition,isPositionVisible:yt.isPositionVisible,updateCredits:Vd}),[c,yt,se,_i,zi,y,Vd]);React.useEffect(()=>{var rf,bf,If;const Tf=(bf=(rf=Ra.current)==null?void 0:rf.cesiumElement)==null?void 0:bf.scene.globe;if(Tf){const Uf=Tf._surface;Uf&&(Uf.tileProvider._debug.wireframe=((If=n==null?void 0:n.debug)==null?void 0:If.showGlobeWireframe)??!1)}},[(ep=n==null?void 0:n.debug)==null?void 0:ep.showGlobeWireframe]),React.useEffect(()=>{var Tf;o&&((Tf=y==null?void 0:y.current)==null||Tf.commit({cmd:"SET_TIME",payload:{start:o,stop:o,current:o},committer:{source:"initialize",id:"reearth_core"}}))},[o,y]);const{sceneLight:uf,sceneBackgroundColor:ff,sceneMsaaSamples:pf,sceneMode:hf}=useViewerProperty({property:n,cesium:Ra});useLayerDragDrop({cesium:Ra,onLayerDrag:nt,onLayerDrop:Pe,isLayerDraggable:S}),useExplicitRender({cesium:Ra,requestingRenderMode:F,isLayerDragging:P,shouldRender:L,property:n});const{cameraViewBoundaries:of,cameraViewOuterBoundaries:gf,cameraViewBoundariesMaterial:Ef,handleCameraChange:xf,handleCameraMoveEnd:Wa,mountCamera:af,unmountCamera:Xd}=useCamera({cesium:Ra,property:n,camera:N,cameraForceHorizontalRoll:z,featureFlags:p,engineAPI:yt,onCameraChange:Sa}),gd=React.useCallback(()=>{af==null||af(),fa==null||fa()},[af,fa]),pd=React.useCallback(()=>{Xd==null||Xd()},[Xd]),Zd=React.useCallback(()=>{Vd()},[Vd]),cf=React.useCallback(()=>{Vd()},[Vd]);return{cesium:Ra,cesiumIonAccessToken:ma,mouseEventHandles:Nl,layerSelectWithRectEventHandlers:lt,context:Gd,sceneLight:uf,sceneBackgroundColor:ff,sceneMsaaSamples:pf,sceneMode:hf,cameraViewBoundaries:of,cameraViewOuterBoundaries:gf,cameraViewBoundariesMaterial:Ef,handleCameraChange:xf,handleCameraMoveEnd:Wa,handleUpdate:yu,handleClick:pu,handleMount:gd,handleUnmount:pd,handleTilesChange:Zd,handleTerrainProviderChange:cf}};function tileProperties(t){return t.getPropertyIds().reduce((n,o)=>[...n,{key:o,value:t.getProperty(o)}],[])}function getLayerId(t){var n,o;if(t&&"id"in t&&t.id instanceof Cesium$1.Entity)return(n=getTag(t.id))==null?void 0:n.layerId;if(t&&t instanceof Cesium$1.Cesium3DTileFeature)return(o=getTag(t.tileset))==null?void 0:o.layerId}function makeHandler(t,n,o){return{name:t,get:()=>o[0].uniforms[n],set:s=>{o.forEach(c=>{c.uniforms[n]=s})}}}function createUniforms(t){const n=groupBy(t.flatMap(({stage:s,stages:c,uniforms:d})=>d.flatMap(h=>typeof h=="string"?[makeHandler(h,h,s!=null?[s]:c)]:Object.entries(h).map(([p,y])=>makeHandler(p,y,s!=null?[s]:c)))),({name:s})=>s),o={};return Object.entries(n).forEach(([s,c])=>{Object.defineProperty(o,s,{get:()=>c[0].get(),set:d=>{c.forEach(h=>{h.set(d)})}})}),o}const crossBilateralFilter=`#define SAMPLES (8.0)
|
|
6216
|
+
vec4 color = computeDayColor(initialColor`).erase(["#ifdef APPLY_MATERIAL","czm_materialInput materialInput;","materialInput.st = v_textureCoordinates.st;","materialInput.normalEC = normalize(v_normalEC);","materialInput.positionToEyeEC = -v_positionEC;","materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalize(v_normalEC));","materialInput.slope = v_slope;","materialInput.height = v_height;","materialInput.aspect = v_aspect;","czm_material material = czm_getMaterial(materialInput);","vec4 materialColor = vec4(material.diffuse, material.alpha);","color = alphaBlend(materialColor, color);","#endif"]);function makeGlobeShadersDirty(t){const n=t.material;n==null?(t.material=Cesium$1.Material.fromType("Color"),t.material=void 0):(t.material=void 0,t.material=n)}const useIBL=({sphericalHarmonicCoefficients:t,globeImageBasedLighting:n,hasVertexNormals:o,enableLighting:s})=>{const c=React.useMemo(()=>o&&s,[o,s]),d=useImmutableFunction(t||[]),h=useImmutableFunction(n&&!!t),p=React.useMemo(()=>({u_reearth_sphericalHarmonicCoefficients:d,u_reearth_globeImageBasedLighting:h}),[d,h]),y=React.useMemo(()=>new StringMatcher().replace(["float diffuseIntensity = clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalize(v_normalEC)) * u_lambertDiffuseMultiplier + u_vertexShadowDarkness, 0.0, 1.0);","vec4 finalColor = vec4(color.rgb * czm_lightColor * diffuseIntensity, color.a);"],"vec4 finalColor = reearth_computeImageBasedLightingColor(color);"),[]);return{uniformMapForIBL:p,isIBLEnabled:c,shaderForIBL:y}},useTerrainHeatmap=({cesium:t,terrain:n})=>{const{type:o,maxHeight:s,minHeight:c,logarithmic:d,colorLUT:h}=(n==null?void 0:n.elevationHeatMap)??{},p=React.useMemo(()=>o==="custom",[o]),y=React.useMemo(()=>new StringMatcher().replace(["#ifdef APPLY_COLOR_TO_ALPHA","vec3 colorDiff = abs(color.rgb - colorToAlpha.rgb);","colorDiff.r = czm_maximumComponent(colorDiff);","alpha = czm_branchFreeTernary(colorDiff.r < colorToAlpha.a, 0.0, alpha);","#endif"],"color = reearth_calculateElevationMapForGlobe(colorToAlpha, color);"),[]);return React.useEffect(()=>{var P;if(!((P=t.current)!=null&&P.cesiumElement)||!p)return;const S=t.current.cesiumElement.scene.globe;return S.material=new VertexTerrainElevationMaterial,()=>{S.material=void 0}},[t,p]),React.useEffect(()=>{var P;if(!((P=t.current)!=null&&P.cesiumElement)||!p)return;const S=t.current.cesiumElement.scene.globe;S.material instanceof VertexTerrainElevationMaterial&&(S.material.uniforms.minHeight=c??S.material.uniforms.minHeight,S.material.uniforms.maxHeight=s??S.material.uniforms.maxHeight,S.material.uniforms.logarithmic=d??S.material.uniforms.logarithmic)},[t,p,s,c,d]),React.useEffect(()=>{var P;if(!((P=t.current)!=null&&P.cesiumElement)||!p||!h)return;const S=t.current.cesiumElement.scene.globe;S.material instanceof VertexTerrainElevationMaterial&&(S.material.uniforms.colorMap=createColorMapImage(h))},[t,p,h]),{isCustomHeatmapEnabled:p,shaderForTerrainHeatmap:y}},useOverrideGlobeShader=({cesium:t,sphericalHarmonicCoefficients:n,globeShadowDarkness:o,globeImageBasedLighting:s,hasVertexNormals:c,enableLighting:d,terrain:h})=>{const{uniformMapForIBL:p,isIBLEnabled:y,shaderForIBL:S}=useIBL({sphericalHarmonicCoefficients:n,globeImageBasedLighting:s,hasVertexNormals:c,enableLighting:d}),{isCustomHeatmapEnabled:P,shaderForTerrainHeatmap:L}=useTerrainHeatmap({cesium:t,terrain:h});React.useEffect(()=>{var W;if(!((W=t.current)!=null&&W.cesiumElement)||!c)return;const z=t.current.cesiumElement.scene.globe;z.vertexShadowDarkness=o??z.vertexShadowDarkness},[t,o,c]);const F=React.useRef(!1),N=React.useCallback(()=>{var mn,_i;if(!((mn=t.current)!=null&&mn.cesiumElement)||!F.current)return;const z=t.current.cesiumElement.scene.globe,W=z._surfaceShaderSet;if(!W)return;const nt=W.baseFragmentShaderSource,Pe=nt==null?void 0:nt.sources[nt.sources.length-1];if(!Pe||!nt)return;const se=[],mt=[];if(y&&z.enableLighting&&z.terrainProvider.hasVertexNormals&&(se.push(S),mt.push(IBLFS)),P&&(se.push(L),mt.push(HeatmapForTerrainFS)),!se.length||(F.current=!1,!((_i=z==null?void 0:z._surface)!=null&&_i._tileProvider)))return;makeGlobeShadersDirty(z);const kt=defaultMatcher.concat(...se).execute(Pe);z._surface._tileProvider.materialUniformMap={...z._surface._tileProvider.materialUniformMap??{},...p},W.baseFragmentShaderSource=new ShaderSource({sources:[...nt.sources.slice(0,-1),GlobeFSDefinitions+kt+mt.join("")],defines:nt.defines})},[t,P,y,S,L,p]);React.useEffect(()=>{var z;if((z=t.current)!=null&&z.cesiumElement)return t.current.cesiumElement.scene.postRender.addEventListener(N)},[t,N]),React.useEffect(()=>{var nt;if(!((nt=t.current)!=null&&nt.cesiumElement)||!y&&!P)return;const z=t.current.cesiumElement.scene,W=z.globe;return F.current=!0,z.requestRender(),()=>{W.isDestroyed()||makeGlobeShadersDirty(W)}},[t,P,y])},useViewerProperty=({cesium:t,property:n})=>{var h,p,y,S,P,L,F,N,z,W,nt;const o=React.useMemo(()=>{var se,mt,kt,mn,_i,zi,Sa,fa,La,Ra,ma,yt,lt,pi,ba,Sc,ms,Xs,Nl,pu,yu,Ru,Vd,Gd,uf,ff,pf;let Pe;return((mt=(se=n==null?void 0:n.scene)==null?void 0:se.light)==null?void 0:mt.type)==="sunLight"?Pe=new Cesium$1.SunLight({color:(mn=(kt=n.scene)==null?void 0:kt.light)!=null&&mn.color?Cesium$1.Color.fromCssColorString(n.scene.light.color):void 0,intensity:(zi=(_i=n.scene)==null?void 0:_i.light)==null?void 0:zi.intensity}):((fa=(Sa=n==null?void 0:n.scene)==null?void 0:Sa.light)==null?void 0:fa.type)==="directionalLight"?Pe=new Cesium$1.DirectionalLight({direction:new Cesium$1.Cartesian3(((ma=(Ra=(La=n==null?void 0:n.scene)==null?void 0:La.light)==null?void 0:Ra.direction)==null?void 0:ma[0])??1,((pi=(lt=(yt=n==null?void 0:n.scene)==null?void 0:yt.light)==null?void 0:lt.direction)==null?void 0:pi[1])??0,((ms=(Sc=(ba=n==null?void 0:n.scene)==null?void 0:ba.light)==null?void 0:Sc.direction)==null?void 0:ms[2])??0),color:(Nl=(Xs=n.scene)==null?void 0:Xs.light)!=null&&Nl.color?Cesium$1.Color.fromCssColorString(n.scene.light.color):void 0,intensity:(yu=(pu=n.scene)==null?void 0:pu.light)==null?void 0:yu.intensity}):(Pe=(Vd=(Ru=t.current)==null?void 0:Ru.cesiumElement)==null?void 0:Vd.scene.light,Pe&&(Pe.color=(uf=(Gd=n==null?void 0:n.scene)==null?void 0:Gd.light)!=null&&uf.color?Cesium$1.Color.fromCssColorString(n.scene.light.color):Pe.color,Pe.intensity=(pf=(ff=n==null?void 0:n.scene)==null?void 0:ff.light)!=null&&pf.intensity?n.scene.light.intensity:Pe.intensity)),Pe},[t,(p=(h=n==null?void 0:n.scene)==null?void 0:h.light)==null?void 0:p.type,(S=(y=n==null?void 0:n.scene)==null?void 0:y.light)==null?void 0:S.color,(L=(P=n==null?void 0:n.scene)==null?void 0:P.light)==null?void 0:L.direction,(N=(F=n==null?void 0:n.scene)==null?void 0:F.light)==null?void 0:N.intensity]),s=React.useMemo(()=>{var Pe;return(Pe=n==null?void 0:n.scene)!=null&&Pe.backgroundColor?Cesium$1.Color.fromCssColorString(n.scene.backgroundColor):void 0},[(z=n==null?void 0:n.scene)==null?void 0:z.backgroundColor]),c=React.useMemo(()=>{var Pe,se,mt;return((Pe=n==null?void 0:n.render)==null?void 0:Pe.antialias)==="extreme"?8:((se=n==null?void 0:n.render)==null?void 0:se.antialias)==="high"?6:((mt=n==null?void 0:n.render)==null?void 0:mt.antialias)==="medium"?4:1},[(W=n==null?void 0:n.render)==null?void 0:W.antialias]),d=React.useMemo(()=>{var Pe,se;return((Pe=n==null?void 0:n.scene)==null?void 0:Pe.mode)==="2d"?Cesium$1.SceneMode.SCENE2D:((se=n==null?void 0:n.scene)==null?void 0:se.mode)==="columbus"?Cesium$1.SceneMode.COLUMBUS_VIEW:Cesium$1.SceneMode.SCENE3D},[(nt=n==null?void 0:n.scene)==null?void 0:nt.mode]);return{sceneLight:o,sceneBackgroundColor:s,sceneMsaaSamples:c,sceneMode:d}},useHooks$1=({ref:t,property:n,time:o,selectedLayerId:s,selectionReason:c,meta:d,layersRef:h,featureFlags:p,timelineManagerRef:y,isLayerDraggable:S,isLayerDragging:P,shouldRender:L,requestingRenderMode:F,camera:N,cameraForceHorizontalRoll:z,onLayerSelect:W,onLayerDrag:nt,onLayerDrop:Pe,onLayerEdit:se,onLayerSelectWithRectStart:mt,onLayerSelectWithRectMove:kt,onLayerSelectWithRectEnd:mn,onLayerVisibility:_i,onLayerLoad:zi,onCameraChange:Sa,onMount:fa,onCreditsUpdate:La})=>{var sf,nf,df,Cf,mf,Sf,Pf,Af,Hf,_f,wf,Yf,Nf,vf,Ff,Xf,Wf,Qf,_m,Bf,$m,qf,qm,ep;const Ra=React.useRef(null),ma=typeof(d==null?void 0:d.cesiumIonAccessToken)=="string"&&d.cesiumIonAccessToken?d.cesiumIonAccessToken:Cesium$1.Ion.defaultAccessToken,yt=useEngineRef(t,Ra),lt=useLayerSelectWithRect({cesium:Ra,engineAPI:yt,onLayerSelectWithRectStart:mt,onLayerSelectWithRectMove:kt,onLayerSelectWithRectEnd:mn,featureFlags:p});React.useEffect(()=>{var Uf,jf,jm,sp,cp,fp,mp,al,tf,lf,yf,Lf,Of,Mf;const Tf=(jf=(Uf=Ra==null?void 0:Ra.current)==null?void 0:Uf.cesiumElement)==null?void 0:jf.shadowMap;if(!Tf)return;Tf.softShadows=((cp=(sp=(jm=n==null?void 0:n.scene)==null?void 0:jm.shadow)==null?void 0:sp.shadowMap)==null?void 0:cp.softShadows)??!1,Tf.darkness=((al=(mp=(fp=n==null?void 0:n.scene)==null?void 0:fp.shadow)==null?void 0:mp.shadowMap)==null?void 0:al.darkness)??.3,Tf.size=((yf=(lf=(tf=n==null?void 0:n.scene)==null?void 0:tf.shadow)==null?void 0:lf.shadowMap)==null?void 0:yf.size)??2048,Tf.maximumDistance=((Mf=(Of=(Lf=n==null?void 0:n.scene)==null?void 0:Lf.shadow)==null?void 0:Of.shadowMap)==null?void 0:Mf.maximumDistance)??5e3,Tf.fadingEnabled=!0,Tf.normalOffset=!0;const rf={polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffsetScale:.5,normalShading:!0,normalShadingSmooth:.3,depthBias:1e-4},bf={polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffsetScale:.1*100,normalShading:!0,normalShadingSmooth:.05,depthBias:2e-5*10},If={polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffsetScale:0,normalShading:!0,normalShadingSmooth:.1,depthBias:5e-4};Tf._terrainBias&&Object.assign(Tf._terrainBias,rf),Tf._primitiveBias&&Object.assign(Tf._primitiveBias,bf),Tf._pointBias&&Object.assign(Tf._pointBias,If)},[(df=(nf=(sf=n==null?void 0:n.scene)==null?void 0:sf.shadow)==null?void 0:nf.shadowMap)==null?void 0:df.softShadows,(Sf=(mf=(Cf=n==null?void 0:n.scene)==null?void 0:Cf.shadow)==null?void 0:mf.shadowMap)==null?void 0:Sf.darkness,(Hf=(Af=(Pf=n==null?void 0:n.scene)==null?void 0:Pf.shadow)==null?void 0:Af.shadowMap)==null?void 0:Hf.size,(Yf=(wf=(_f=n==null?void 0:n.scene)==null?void 0:_f.shadow)==null?void 0:wf.shadowMap)==null?void 0:Yf.maximumDistance]);const pi=React.useRef(),ba=React.useRef();React.useEffect(()=>{var Uf,jf,jm,sp,cp,fp,mp,al;const Tf=(Uf=Ra.current)==null?void 0:Uf.cesiumElement;if(!Tf||Tf.isDestroyed()||ba.current===(s==null?void 0:s.featureId)&&(s==null?void 0:s.featureId)!==void 0)return;const rf=getTag(pi.current);if(!(rf!=null&&rf.featureId)&&(rf!=null&&rf.layerId)&&(s!=null&&s.layerId)&&(rf==null?void 0:rf.layerId)===s.layerId||rf!=null&&rf.featureId&&(s!=null&&s.featureId)&&(rf==null?void 0:rf.featureId)===s.featureId)return;const bf=findEntity(Tf,void 0,s==null?void 0:s.featureId)||findEntity(Tf,s==null?void 0:s.layerId);if(pi.current===bf)return;const If=getTag(bf);if(bf instanceof Cesium$1.Entity&&!(If!=null&&If.hideIndicator)?Tf.selectedEntity=bf:Tf.selectedEntity=void 0,pi.current=bf,!bf&&(s!=null&&s.featureId)){const tf=[],lf=(jf=h==null?void 0:h.current)==null?void 0:jf.findAll(yf=>{var Lf,Of;return yf.type==="simple"&&!!((Lf=yf.data)!=null&&Lf.type)&&tf.includes((Of=yf.data)==null?void 0:Of.type)});if(lf!=null&&lf.length){const[yf,Lf]=(()=>{var Of;for(const Mf of lf){const Vf=(Of=Mf.computed)==null?void 0:Of.features.find(Gf=>Gf.id!==(s==null?void 0:s.featureId));if(Vf)return[Vf,Mf.id]}})()||[];W==null||W(Lf,yf==null?void 0:yf.id)}}if(!(If!=null&&If.unselectable)){if(bf&&bf instanceof Cesium$1.Cesium3DTileFeature){const tf=getTag(bf);if(tf){const lf=tileProperties(bf);W==null||W(tf.layerId,String(tf.featureId),lf.length?{defaultInfobox:{title:bf.getProperty("name"),content:{type:"table",value:lf}}}:void 0,{feature:tf.computedFeature})}return}if(bf){const tf=If!=null&&If.layerId?((jm=h==null?void 0:h.current)==null?void 0:jm.overriddenLayers().find(lf=>lf.id===If.layerId))??((sp=h==null?void 0:h.current)==null?void 0:sp.findById(If.layerId)):void 0;W==null||W(If==null?void 0:If.layerId,If==null?void 0:If.featureId,bf instanceof Cesium$1.Entity&&(bf.description||bf.properties)?{defaultInfobox:{title:bf.name,content:getEntityContent(bf,((fp=(cp=Ra.current)==null?void 0:cp.cesiumElement)==null?void 0:fp.clock.currentTime)??new Cesium$1.JulianDate,If!=null&&If.layerId?(al=(mp=tf==null?void 0:tf.infobox)==null?void 0:mp.property)==null?void 0:al.defaultContent:void 0)}}:void 0)}}},[Ra,s,W,h,p]);const Sc=React.useMemo(()=>{var Tf,rf,bf,If,Uf,jf;return(rf=(Tf=n==null?void 0:n.scene)==null?void 0:Tf.imageBasedLighting)!=null&&rf.sphericalHarmonicCoefficients?arrayToCartecian3((If=(bf=n==null?void 0:n.scene)==null?void 0:bf.imageBasedLighting)==null?void 0:If.sphericalHarmonicCoefficients,(jf=(Uf=n==null?void 0:n.scene)==null?void 0:Uf.imageBasedLighting)==null?void 0:jf.intensity):void 0},[(vf=(Nf=n==null?void 0:n.scene)==null?void 0:Nf.imageBasedLighting)==null?void 0:vf.sphericalHarmonicCoefficients,(Xf=(Ff=n==null?void 0:n.scene)==null?void 0:Ff.imageBasedLighting)==null?void 0:Xf.intensity]);useOverrideGlobeShader({cesium:Ra,sphericalHarmonicCoefficients:Sc,globeShadowDarkness:(Qf=(Wf=n==null?void 0:n.scene)==null?void 0:Wf.shadow)==null?void 0:Qf.darkness,globeImageBasedLighting:(Bf=(_m=n==null?void 0:n.scene)==null?void 0:_m.imageBasedLighting)==null?void 0:Bf.enabled,enableLighting:($m=n==null?void 0:n.globe)==null?void 0:$m.enableLighting,hasVertexNormals:((qf=n==null?void 0:n.terrain)==null?void 0:qf.enabled)&&n.terrain.normal,terrain:n==null?void 0:n.terrain});const ms=React.useCallback((Tf,rf,bf)=>{var If,Uf;if(((If=yt.mouseEventCallbacks[Tf])==null?void 0:If.length)>0){const jf=(Uf=Ra.current)==null?void 0:Uf.cesiumElement;if(!jf||jf.isDestroyed())return;const jm=makeMouseEventProps(jf,rf);if(!jm)return;const sp=getLayerId(bf);sp&&(jm.layerId=sp),yt.mouseEventCallbacks[Tf].forEach(cp=>cp(jm))}},[yt]),Xs=React.useCallback(Tf=>{yt.mouseEventCallbacks.wheel.length>0&&yt.mouseEventCallbacks.wheel.forEach(rf=>rf({delta:Tf}))},[yt]),Nl=React.useMemo(()=>{const Tf={click:void 0,doubleClick:void 0,mouseDown:void 0,mouseUp:void 0,rightClick:void 0,rightDown:void 0,rightUp:void 0,middleClick:void 0,middleDown:void 0,middleUp:void 0,mouseMove:void 0,mouseEnter:void 0,mouseLeave:void 0,wheel:rf=>{Xs(rf)}};return Object.keys(Tf).forEach(rf=>{rf!=="wheel"&&(Tf[rf]=(bf,If)=>{ms(rf,bf,If)})}),Tf},[ms,Xs]),pu=React.useCallback(async(Tf,rf)=>{var jf,jm,sp,cp,fp,mp,al,tf,lf,yf,Lf,Of,Mf,Vf;if((jf=Nl.click)==null||jf.call(Nl,Tf,rf),!(p&FEATURE_FLAGS.SINGLE_SELECTION))return;const bf=(jm=Ra.current)==null?void 0:jm.cesiumElement;if(!bf||bf.isDestroyed())return;ba.current=void 0;const If=findEntity(bf,void 0,s==null?void 0:s.featureId)||findEntity(bf,s==null?void 0:s.layerId),Uf=getTag(If);if((!If||If instanceof Cesium$1.Entity&&(Uf!=null&&Uf.hideIndicator))&&(bf.selectedEntity=void 0),rf&&"id"in rf&&rf.id instanceof Cesium$1.Entity&&isSelectable(rf.id)){const Gf=getTag(rf.id),Df=Gf!=null&&Gf.layerId?((sp=h==null?void 0:h.current)==null?void 0:sp.overriddenLayers().find(Zf=>Zf.id===Gf.layerId))??((cp=h==null?void 0:h.current)==null?void 0:cp.findById(Gf.layerId)):void 0;W==null||W(Gf==null?void 0:Gf.layerId,Gf==null?void 0:Gf.featureId,rf.id.description||rf.id.properties?{defaultInfobox:{title:(Df==null?void 0:Df.title)??rf.id.name,content:getEntityContent(rf.id,bf.clock.currentTime??new Cesium$1.JulianDate,Gf!=null&&Gf.layerId?(mp=(fp=Df==null?void 0:Df.infobox)==null?void 0:fp.property)==null?void 0:mp.defaultContent:void 0)}}:void 0),pi.current=rf.id,rf.id instanceof Cesium$1.Entity&&!(Gf!=null&&Gf.hideIndicator)?bf.selectedEntity=rf.id:bf.selectedEntity=void 0;return}if(rf&&(rf instanceof Cesium$1.Cesium3DTileFeature||rf instanceof Cesium$1.Cesium3DTilePointFeature)){const Gf=getTag(rf);if(Gf){const Df=tileProperties(rf);W==null||W(Gf.layerId,String(Gf.featureId),Df.length?{defaultInfobox:{title:rf.getProperty("name"),content:{type:"table",value:tileProperties(rf)}}}:void 0,{feature:Gf.computedFeature}),pi.current=rf}return}if(rf&&"content"in rf&&rf.content&&typeof rf.content=="object"&&"_model"in rf.content&&rf.content._model instanceof Cesium$1.Model){const Gf=rf.content._model,Df=getTag(Gf);Df&&(W==null||W(Df.layerId,String(Df.featureId)),pi.current=Gf);return}if(rf!=null&&rf.primitive&&(rf.primitive instanceof Cesium$1.Primitive||rf.primitive instanceof Cesium$1.GroundPrimitive)){const Gf=rf.primitive,Df=getTag(Gf);Df&&(W==null||W(Df.layerId,String(Df.featureId)),pi.current=Gf);return}if(rf===void 0&&Tf.position){const Gf=bf.scene,Df=Gf.camera.getPickRay(Tf.position);if(Df){const Zf=await Gf.imageryLayers.pickImageryLayerFeatures(Df,Gf),Kf=Zf==null?void 0:Zf.findLast(ap=>{var Fp,Kp,qp,cg;const rp=(Fp=ap==null?void 0:ap.data)==null?void 0:Fp.appearanceType;return rp&&((cg=(qp=(Kp=ap==null?void 0:ap.data)==null?void 0:Kp.feature)==null?void 0:qp[rp])==null?void 0:cg.show)!==!1}),yp=(al=Kf==null?void 0:Kf.data)==null?void 0:al.appearanceType;if(yp&&((yf=(lf=(tf=Kf==null?void 0:Kf.data)==null?void 0:tf.feature)==null?void 0:lf[yp])==null?void 0:yf.show)!==!1){const ap=getTag(Kf.imageryLayer),rp=Kf.position;rp&&requestAnimationFrame(()=>{ap!=null&&ap.hideIndicator||(bf.selectedEntity=new Cesium$1.Entity({position:Cesium$1.Cartographic.toCartesian(rp)}))});const Fp=ap!=null&&ap.layerId?((Lf=h==null?void 0:h.current)==null?void 0:Lf.overriddenLayers().find(qp=>qp.id===ap.layerId))??((Of=h==null?void 0:h.current)==null?void 0:Of.findById(ap.layerId)):void 0,Kp=getEntityContent(Kf.data.feature??Kf,bf.clock.currentTime??new Cesium$1.JulianDate,ap!=null&&ap.layerId?(Vf=(Mf=Fp==null?void 0:Fp.infobox)==null?void 0:Mf.property)==null?void 0:Vf.defaultContent:void 0);ba.current=Kf.data.featureId,W==null||W(Kf.data.layerId,Kf.data.featureId,Kp.value.length?{defaultInfobox:{title:(Fp==null?void 0:Fp.title)??Kf.name,content:Kp}}:void 0,{feature:Kf.data.feature});return}}}bf.selectedEntity=void 0,W==null||W()},[W,Nl,h,p,s==null?void 0:s.featureId,s==null?void 0:s.layerId]);React.useEffect(()=>{var Tf;if(e2eAccessToken())return setE2ECesiumViewer((Tf=Ra.current)==null?void 0:Tf.cesiumElement),()=>{setE2ECesiumViewer(void 0)}},[(qm=Ra.current)==null?void 0:qm.cesiumElement]),React.useEffect(()=>{var rf;const Tf=(rf=Ra.current)==null?void 0:rf.cesiumElement;!Tf||Tf.isDestroyed()||Tf.scene.requestRender()});const yu=React.useCallback(()=>{var rf;const Tf=(rf=Ra.current)==null?void 0:rf.cesiumElement;!Tf||Tf.isDestroyed()||Tf.scene.requestRender()},[]),Ru=React.useRef(La);Ru.current=La;const Vd=React.useCallback(()=>{Ru.current&&setTimeout(()=>{var bf;if(!Ru.current)return;const Tf=(bf=Ra.current)==null?void 0:bf.cesiumElement;if(!Tf||Tf.isDestroyed())return;const rf=getCredits(Tf);Ru.current(rf)},3e3)},[]),Gd=React.useMemo(()=>({selectionReason:c,timelineManagerRef:y,flyTo:yt.flyTo,getCamera:yt.getCamera,onLayerEdit:se,onLayerVisibility:_i,onLayerLoad:zi,requestRender:yt.requestRender,getSurfaceDistance:yt.getSurfaceDistance,toXYZ:yt.toXYZ,toWindowPosition:yt.toWindowPosition,isPositionVisible:yt.isPositionVisible,updateCredits:Vd}),[c,yt,se,_i,zi,y,Vd]);React.useEffect(()=>{var rf,bf,If;const Tf=(bf=(rf=Ra.current)==null?void 0:rf.cesiumElement)==null?void 0:bf.scene.globe;if(Tf){const Uf=Tf._surface;Uf&&(Uf.tileProvider._debug.wireframe=((If=n==null?void 0:n.debug)==null?void 0:If.showGlobeWireframe)??!1)}},[(ep=n==null?void 0:n.debug)==null?void 0:ep.showGlobeWireframe]),React.useEffect(()=>{var Tf;o&&((Tf=y==null?void 0:y.current)==null||Tf.commit({cmd:"SET_TIME",payload:{start:o,stop:o,current:o},committer:{source:"initialize",id:"reearth_core"}}))},[o,y]);const{sceneLight:uf,sceneBackgroundColor:ff,sceneMsaaSamples:pf,sceneMode:hf}=useViewerProperty({property:n,cesium:Ra});useLayerDragDrop({cesium:Ra,onLayerDrag:nt,onLayerDrop:Pe,isLayerDraggable:S}),useExplicitRender({cesium:Ra,requestingRenderMode:F,isLayerDragging:P,shouldRender:L,property:n});const{cameraViewBoundaries:of,cameraViewOuterBoundaries:gf,cameraViewBoundariesMaterial:Ef,handleCameraChange:xf,handleCameraMoveEnd:Wa,mountCamera:af,unmountCamera:Xd}=useCamera({cesium:Ra,property:n,camera:N,cameraForceHorizontalRoll:z,featureFlags:p,engineAPI:yt,onCameraChange:Sa}),gd=React.useCallback(()=>{af==null||af(),fa==null||fa()},[af,fa]),pd=React.useCallback(()=>{Xd==null||Xd()},[Xd]),Zd=React.useCallback(()=>{Vd()},[Vd]),cf=React.useCallback(()=>{Vd()},[Vd]);return{cesium:Ra,cesiumIonAccessToken:ma,mouseEventHandles:Nl,layerSelectWithRectEventHandlers:lt,context:Gd,sceneLight:uf,sceneBackgroundColor:ff,sceneMsaaSamples:pf,sceneMode:hf,cameraViewBoundaries:of,cameraViewOuterBoundaries:gf,cameraViewBoundariesMaterial:Ef,handleCameraChange:xf,handleCameraMoveEnd:Wa,handleUpdate:yu,handleClick:pu,handleMount:gd,handleUnmount:pd,handleTilesChange:Zd,handleTerrainProviderChange:cf}};function tileProperties(t){return t.getPropertyIds().reduce((n,o)=>[...n,{key:o,value:t.getProperty(o)}],[])}function getLayerId(t){var n,o;if(t&&"id"in t&&t.id instanceof Cesium$1.Entity)return(n=getTag(t.id))==null?void 0:n.layerId;if(t&&t instanceof Cesium$1.Cesium3DTileFeature)return(o=getTag(t.tileset))==null?void 0:o.layerId}function makeHandler(t,n,o){return{name:t,get:()=>o[0].uniforms[n],set:s=>{o.forEach(c=>{c.uniforms[n]=s})}}}function createUniforms(t){const n=groupBy(t.flatMap(({stage:s,stages:c,uniforms:d})=>d.flatMap(h=>typeof h=="string"?[makeHandler(h,h,s!=null?[s]:c)]:Object.entries(h).map(([p,y])=>makeHandler(p,y,s!=null?[s]:c)))),({name:s})=>s),o={};return Object.entries(n).forEach(([s,c])=>{Object.defineProperty(o,s,{get:()=>c[0].get(),set:d=>{c.forEach(h=>{h.set(d)})}})}),o}const crossBilateralFilter=`#define SAMPLES (8.0)
|
|
6217
6217
|
|
|
6218
6218
|
#ifndef OUTPUT_TYPE
|
|
6219
6219
|
#define OUTPUT_TYPE (0)
|
|
@@ -6742,7 +6742,7 @@ vec3 getTurboColormap(const float v) {
|
|
|
6742
6742
|
${reconstructPosition}
|
|
6743
6743
|
${turboColorMap}
|
|
6744
6744
|
${ambientOcclusionModulate}
|
|
6745
|
-
`,uniforms:{...pick(P,["color","frustumLength","blackPoint","whitePoint","gamma"]),globeDepthTexture:()=>(y==null?void 0:y())??F._depthTexture}});if(c){const N=createBilateralFilterStage({prefix:t,outputType:h,useGlobeDepth:p,getGlobeDepthTexture:y,uniforms:{textureScale:n,...pick(P,["frustumLength","normalExponent","depthExponent"])}}),z=new Cesium$1.PostProcessStageComposite({name:`${t}_ambient_occlusion_generate_and_filter`,stages:[L,N]});return F.uniforms.ambientOcclusionTexture=z.name,new Cesium$1.PostProcessStageComposite({name:`${t}_ambient_occlusion`,stages:[z,F],inputPreviousStageTexture:!1,uniforms:createUniforms([{stage:L,uniforms:["intensity","maxRadius","bias","frustumLength","focalLength"]},{stage:N,uniforms:["frustumLength","normalExponent","depthExponent"]},{stage:F,uniforms:["color","blackPoint","whitePoint","gamma"]}])})}else return F.uniforms.ambientOcclusionTexture=L.name,new Cesium$1.PostProcessStageComposite({name:`${t}_ambient_occlusion`,stages:[L,F],inputPreviousStageTexture:!1,uniforms:createUniforms([{stage:L,uniforms:["intensity","maxRadius","bias","frustumLength","focalLength"]},{stage:F,uniforms:["color","blackPoint","whitePoint","gamma"]}])})}const AmbientOcclusionStage=({enabled:t=!0,textureScale:n,directions:o,steps:s,denoise:c,accurateNormalReconstruction:d,outputType:h,useGlobeDepth:p,...y})=>{const{viewer:S}=$e$1(),P=S==null?void 0:S.scene,L=useInstance({owner:P==null?void 0:P.postProcessStages,keys:[n,s,o,c,d,h,p],create:()=>{const F=createAmbientOcclusionStage({textureScale:n,steps:s,directions:o,denoise:c,accurateNormalReconstruction:d,outputType:h,useGlobeDepth:p,getGlobeDepthTexture:()=>P.context.uniformState.globeDepthTexture,uniforms:y});return F.enabled=t,F},transferOwnership:(F,N)=>(N==null||N.add(F),()=>{N==null||N.remove(F)})});return L.enabled=t,Object.assign(L.uniforms,y),P==null||P.requestRender(),usePreRender(()=>{const F=P==null?void 0:P.camera.frustum;if(F instanceof Cesium$1.PerspectiveFrustum){const N=1/Math.tan(F.fovy/2);L.uniforms.focalLength.x=N*F.aspectRatio,L.uniforms.focalLength.y=N}}),null},AmbientOcclusion=t=>{const n=$e$1(),[o,s]=React.useState(!1);return usePreRender(()=>{const c=n.scene;s(!(c!=null&&c.globe.depthTestAgainstTerrain));const{globeHeight:d}=c;if(!c||d==null)return;const h=c.camera.positionCartographic.height-d,p=c==null?void 0:c.camera.frustum;p instanceof Cesium$1.PerspectiveFrustum&&(c.camera.frustum.near=Cesium$1.Math.clamp(h-1,1,5)/Math.tan(p.fov/2))}),jsxRuntimeExports.jsx(AmbientOcclusionStage,{...t,useGlobeDepth:o})};var AmbientOcclusionOutputType=(t=>(t[t.Occlusion=1]="Occlusion",t[t.Normal=2]="Normal",t[t.Depth=3]="Depth",t[t.Weight=4]="Weight",t[t.Shade=5]="Shade",t))(AmbientOcclusionOutputType||{});const AMBIENT_OCCLUSION_QUALITY={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}},DEFAULT_SKETCH_COLOR="#00bebe",DEFAULT_EDIT_COLOR="#3B3CD0",SELECTED_EDIT_COLOR="#FF9900",ADDING_POINT_COLOR="#3B3CD0";let drawPointImage,editPointImage,selectedPointImage,addingPointImage;const ControlPoint=({position:t,clampToGround:n=!1,index:o,isEditing:s,isSelected:c,isAddingPoint:d,isExtrudedControlPoint:h,handleControlPointMouseEvent:p})=>{const y=React.useRef(t);y.current=t;const S=useConstant$2(()=>new CallbackProperty((N,z)=>"getValue"in y.current?y.current.getValue(N,z):y.current,!1)),P=React.useMemo(()=>({position:S,billboard:{image:s?d?getAddingPointImage():c?getSelectedPointImage():getEditPointImage():getDrawPointImage(),width:s?16:8,height:s?16:8,heightReference:n?HeightReference$1.CLAMP_TO_GROUND:HeightReference$1.NONE,disableDepthTestDistance:1/0}}),[n,S,d,s,c]),L=React.useCallback(()=>{p==null||p(o,!!h,"mousedown")},[o,h,p]),F=React.useCallback(()=>{p==null||p(o,!!h,"click")},[o,h,p]);return jsxRuntimeExports.jsx(Is$1,{...P,onMouseDown:L,onClick:F})};function getDrawPointImage(){if(drawPointImage!=null)return drawPointImage;drawPointImage=document.createElement("canvas"),drawPointImage.width=16,drawPointImage.height=16;const t=drawPointImage.getContext("2d");return invariant$1(t!=null),t.fillStyle="white",t.fillRect(3,3,10,10),t.strokeStyle="black",t.lineWidth=2,t.strokeRect(3,3,10,10),drawPointImage}function getEditPointImage(){return getImage(editPointImage,{size:32,color:"white",strokeColor:DEFAULT_EDIT_COLOR})}function getSelectedPointImage(){return getImage(selectedPointImage,{size:32,color:"white",strokeColor:SELECTED_EDIT_COLOR})}function getAddingPointImage(){if(addingPointImage!=null)return addingPointImage;addingPointImage=document.createElement("canvas"),addingPointImage.width=32,addingPointImage.height=32;const t=addingPointImage.getContext("2d");return invariant$1(t!=null),t.beginPath(),t.arc(16,16,12,0,2*Math.PI),t.fillStyle="white",t.fill(),t.strokeStyle=ADDING_POINT_COLOR,t.lineWidth=4,t.stroke(),t.beginPath(),t.moveTo(16,8),t.lineTo(16,24),t.stroke(),t.moveTo(8,16),t.lineTo(24,16),t.stroke(),addingPointImage}function getImage(t,n){if(t!=null)return t;t=document.createElement("canvas"),t.width=n.size,t.height=n.size;const o=t.getContext("2d");return invariant$1(o!=null),o.beginPath(),o.arc(n.size/2,n.size/2,n.size/2-4,0,2*Math.PI),o.fillStyle=n.color,o.fill(),o.strokeStyle=n.strokeColor,o.lineWidth=4,o.stroke(),t}function assignForwardedRef(t,n){if(typeof t=="function")return t(n),()=>{t(null)};if(t!=null)return t.current=n,()=>{t.current=null}}const Entity=React.memo(React.forwardRef(({entities:t,...n},o)=>{const{viewer:s}=$e$1(),c=s==null?void 0:s.scene,d=s==null?void 0:s.entities,h=t??d,[p,y]=React.useState(()=>new Entity$1(n));return React.useEffect(()=>{y(new Entity$1(n))},[n.id]),React.useEffect(()=>(h==null||h.add(p),()=>{h==null||h.remove(p),c==null||c.requestRender()}),[c,h,p]),React.useEffect(()=>assignForwardedRef(o,p),[o,p]),Object.assign(p,omit(n,"id")),c==null||c.requestRender(),null})),textStyle={padding:"5px",color:"#fff",backgroundColor:"#000",borderRadius:"5px",lineHeight:1},MeasurementText=({children:t})=>jsxRuntimeExports.jsx("div",{style:textStyle,children:t}),MotionConfigContext=React.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),MotionContext=React.createContext({}),PresenceContext=React.createContext(null),isBrowser=typeof document<"u",useIsomorphicLayoutEffect$1=isBrowser?React.useLayoutEffect:React.useEffect,LazyContext=React.createContext({strict:!1}),camelToDash=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),optimizedAppearDataId="framerAppearId",optimizedAppearDataAttribute="data-"+camelToDash(optimizedAppearDataId),MotionGlobalConfig={skipAnimations:!1,useManualTiming:!1};class Queue{constructor(){this.order=[],this.scheduled=new Set}add(n){if(!this.scheduled.has(n))return this.scheduled.add(n),this.order.push(n),!0}remove(n){const o=this.order.indexOf(n);o!==-1&&(this.order.splice(o,1),this.scheduled.delete(n))}clear(){this.order.length=0,this.scheduled.clear()}}function createRenderStep(t){let n=new Queue,o=new Queue,s=0,c=!1,d=!1;const h=new WeakSet,p={schedule:(y,S=!1,P=!1)=>{const L=P&&c,F=L?n:o;return S&&h.add(y),F.add(y)&&L&&c&&(s=n.order.length),y},cancel:y=>{o.remove(y),h.delete(y)},process:y=>{if(c){d=!0;return}if(c=!0,[n,o]=[o,n],o.clear(),s=n.order.length,s)for(let S=0;S<s;S++){const P=n.order[S];h.has(P)&&(p.schedule(P),t()),P(y)}c=!1,d&&(d=!1,p.process(y))}};return p}const stepsOrder=["read","resolveKeyframes","update","preRender","render","postRender"],maxElapsed=40;function createRenderBatcher(t,n){let o=!1,s=!0;const c={delta:0,timestamp:0,isProcessing:!1},d=stepsOrder.reduce((L,F)=>(L[F]=createRenderStep(()=>o=!0),L),{}),h=L=>{d[L].process(c)},p=()=>{const L=performance.now();o=!1,c.delta=s?1e3/60:Math.max(Math.min(L-c.timestamp,maxElapsed),1),c.timestamp=L,c.isProcessing=!0,stepsOrder.forEach(h),c.isProcessing=!1,o&&n&&(s=!1,t(p))},y=()=>{o=!0,s=!0,c.isProcessing||t(p)};return{schedule:stepsOrder.reduce((L,F)=>{const N=d[F];return L[F]=(z,W=!1,nt=!1)=>(o||y(),N.schedule(z,W,nt)),L},{}),cancel:L=>stepsOrder.forEach(F=>d[F].cancel(L)),state:c,steps:d}}const{schedule:microtask,cancel:cancelMicrotask}=createRenderBatcher(queueMicrotask,!1);function useVisualElement(t,n,o,s){const{visualElement:c}=React.useContext(MotionContext),d=React.useContext(LazyContext),h=React.useContext(PresenceContext),p=React.useContext(MotionConfigContext).reducedMotion,y=React.useRef();s=s||d.renderer,!y.current&&s&&(y.current=s(t,{visualState:n,parent:c,props:o,presenceContext:h,blockInitialAnimation:h?h.initial===!1:!1,reducedMotionConfig:p}));const S=y.current;React.useInsertionEffect(()=>{S&&S.update(o,h)});const P=React.useRef(!!(o[optimizedAppearDataAttribute]&&!window.HandoffComplete));return useIsomorphicLayoutEffect$1(()=>{S&&(microtask.postRender(S.render),P.current&&S.animationState&&S.animationState.animateChanges())}),React.useEffect(()=>{S&&(S.updateFeatures(),!P.current&&S.animationState&&S.animationState.animateChanges(),P.current&&(P.current=!1,window.HandoffComplete=!0))}),S}function isRefObject(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function useMotionRef(t,n,o){return React.useCallback(s=>{s&&t.mount&&t.mount(s),n&&(s?n.mount(s):n.unmount()),o&&(typeof o=="function"?o(s):isRefObject(o)&&(o.current=s))},[n])}function isVariantLabel(t){return typeof t=="string"||Array.isArray(t)}function isAnimationControls(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const variantPriorityOrder=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],variantProps=["initial",...variantPriorityOrder];function isControllingVariants(t){return isAnimationControls(t.animate)||variantProps.some(n=>isVariantLabel(t[n]))}function isVariantNode(t){return!!(isControllingVariants(t)||t.variants)}function getCurrentTreeVariants(t,n){if(isControllingVariants(t)){const{initial:o,animate:s}=t;return{initial:o===!1||isVariantLabel(o)?o:void 0,animate:isVariantLabel(s)?s:void 0}}return t.inherit!==!1?n:{}}function useCreateMotionContext(t){const{initial:n,animate:o}=getCurrentTreeVariants(t,React.useContext(MotionContext));return React.useMemo(()=>({initial:n,animate:o}),[variantLabelsAsDependency(n),variantLabelsAsDependency(o)])}function variantLabelsAsDependency(t){return Array.isArray(t)?t.join(" "):t}const featureProps={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"]},featureDefinitions={};for(const t in featureProps)featureDefinitions[t]={isEnabled:n=>featureProps[t].some(o=>!!n[o])};function loadFeatures(t){for(const n in t)featureDefinitions[n]={...featureDefinitions[n],...t[n]}}const LayoutGroupContext=React.createContext({}),SwitchLayoutGroupContext=React.createContext({}),motionComponentSymbol=Symbol.for("motionComponentSymbol");function createMotionComponent({preloadedFeatures:t,createVisualElement:n,useRender:o,useVisualState:s,Component:c}){t&&loadFeatures(t);function d(p,y){let S;const P={...React.useContext(MotionConfigContext),...p,layoutId:useLayoutId(p)},{isStatic:L}=P,F=useCreateMotionContext(p),N=s(p,L);if(!L&&isBrowser){F.visualElement=useVisualElement(c,N,P,n);const z=React.useContext(SwitchLayoutGroupContext),W=React.useContext(LazyContext).strict;F.visualElement&&(S=F.visualElement.loadFeatures(P,W,t,z))}return React__namespace.createElement(MotionContext.Provider,{value:F},S&&F.visualElement?React__namespace.createElement(S,{visualElement:F.visualElement,...P}):null,o(c,p,useMotionRef(N,F.visualElement,y),N,L,F.visualElement))}const h=React.forwardRef(d);return h[motionComponentSymbol]=c,h}function useLayoutId({layoutId:t}){const n=React.useContext(LayoutGroupContext).id;return n&&t!==void 0?n+"-"+t:t}function createMotionProxy(t){function n(s,c={}){return createMotionComponent(t(s,c))}if(typeof Proxy>"u")return n;const o=new Map;return new Proxy(n,{get:(s,c)=>(o.has(c)||o.set(c,n(c)),o.get(c))})}const lowercaseSVGElements=["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 isSVGComponent(t){return typeof t!="string"||t.includes("-")?!1:!!(lowercaseSVGElements.indexOf(t)>-1||/[A-Z]/u.test(t))}const scaleCorrectors={};function addScaleCorrector(t){Object.assign(scaleCorrectors,t)}const transformPropOrder=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],transformProps=new Set(transformPropOrder);function isForcedMotionValue(t,{layout:n,layoutId:o}){return transformProps.has(t)||t.startsWith("origin")||(n||o!==void 0)&&(!!scaleCorrectors[t]||t==="opacity")}const isMotionValue=t=>!!(t&&t.getVelocity),translateAlias={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},numTransforms=transformPropOrder.length;function buildTransform(t,{enableHardwareAcceleration:n=!0,allowTransformNone:o=!0},s,c){let d="";for(let h=0;h<numTransforms;h++){const p=transformPropOrder[h];if(t[p]!==void 0){const y=translateAlias[p]||p;d+=`${y}(${t[p]}) `}}return n&&!t.z&&(d+="translateZ(0)"),d=d.trim(),c?d=c(t,s?"":d):o&&s&&(d="none"),d}const checkStringStartsWith=t=>n=>typeof n=="string"&&n.startsWith(t),isCSSVariableName=checkStringStartsWith("--"),startsAsVariableToken=checkStringStartsWith("var(--"),isCSSVariableToken=t=>startsAsVariableToken(t)?singleCssVariableRegex.test(t.split("/*")[0].trim()):!1,singleCssVariableRegex=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,getValueAsType=(t,n)=>n&&typeof t=="number"?n.transform(t):t,clamp=(t,n,o)=>o>n?n:o<t?t:o,number={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},alpha={...number,transform:t=>clamp(0,1,t)},scale={...number,default:1},sanitize=t=>Math.round(t*1e5)/1e5,floatRegex=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,colorRegex=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,singleColorRegex=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;function isString$1(t){return typeof t=="string"}const createUnitType=t=>({test:n=>isString$1(n)&&n.endsWith(t)&&n.split(" ").length===1,parse:parseFloat,transform:n=>`${n}${t}`}),degrees=createUnitType("deg"),percent=createUnitType("%"),px=createUnitType("px"),vh=createUnitType("vh"),vw=createUnitType("vw"),progressPercentage={...percent,parse:t=>percent.parse(t)/100,transform:t=>percent.transform(t*100)},int={...number,transform:Math.round},numberValueTypes={borderWidth:px,borderTopWidth:px,borderRightWidth:px,borderBottomWidth:px,borderLeftWidth:px,borderRadius:px,radius:px,borderTopLeftRadius:px,borderTopRightRadius:px,borderBottomRightRadius:px,borderBottomLeftRadius:px,width:px,maxWidth:px,height:px,maxHeight:px,size:px,top:px,right:px,bottom:px,left:px,padding:px,paddingTop:px,paddingRight:px,paddingBottom:px,paddingLeft:px,margin:px,marginTop:px,marginRight:px,marginBottom:px,marginLeft:px,rotate:degrees,rotateX:degrees,rotateY:degrees,rotateZ:degrees,scale,scaleX:scale,scaleY:scale,scaleZ:scale,skew:degrees,skewX:degrees,skewY:degrees,distance:px,translateX:px,translateY:px,translateZ:px,x:px,y:px,z:px,perspective:px,transformPerspective:px,opacity:alpha,originX:progressPercentage,originY:progressPercentage,originZ:px,zIndex:int,backgroundPositionX:px,backgroundPositionY:px,fillOpacity:alpha,strokeOpacity:alpha,numOctaves:int};function buildHTMLStyles(t,n,o,s){const{style:c,vars:d,transform:h,transformOrigin:p}=t;let y=!1,S=!1,P=!0;for(const L in n){const F=n[L];if(isCSSVariableName(L)){d[L]=F;continue}const N=numberValueTypes[L],z=getValueAsType(F,N);if(transformProps.has(L)){if(y=!0,h[L]=z,!P)continue;F!==(N.default||0)&&(P=!1)}else L.startsWith("origin")?(S=!0,p[L]=z):c[L]=z}if(n.transform||(y||s?c.transform=buildTransform(t.transform,o,P,s):c.transform&&(c.transform="none")),S){const{originX:L="50%",originY:F="50%",originZ:N=0}=p;c.transformOrigin=`${L} ${F} ${N}`}}const createHtmlRenderState=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function copyRawValuesOnly(t,n,o){for(const s in n)!isMotionValue(n[s])&&!isForcedMotionValue(s,o)&&(t[s]=n[s])}function useInitialMotionValues({transformTemplate:t},n,o){return React.useMemo(()=>{const s=createHtmlRenderState();return buildHTMLStyles(s,n,{enableHardwareAcceleration:!o},t),Object.assign({},s.vars,s.style)},[n])}function useStyle(t,n,o){const s=t.style||{},c={};return copyRawValuesOnly(c,s,t),Object.assign(c,useInitialMotionValues(t,n,o)),c}function useHTMLProps(t,n,o){const s={},c=useStyle(t,n,o);return t.drag&&t.dragListener!==!1&&(s.draggable=!1,c.userSelect=c.WebkitUserSelect=c.WebkitTouchCallout="none",c.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(s.tabIndex=0),s.style=c,s}const validMotionProps=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","ignoreStrict","viewport"]);function isValidMotionProp(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||validMotionProps.has(t)}let shouldForward=t=>!isValidMotionProp(t);function loadExternalIsValidProp(t){t&&(shouldForward=n=>n.startsWith("on")?!isValidMotionProp(n):t(n))}try{loadExternalIsValidProp(require("@emotion/is-prop-valid").default)}catch(t){}function filterProps(t,n,o){const s={};for(const c in t)c==="values"&&typeof t.values=="object"||(shouldForward(c)||o===!0&&isValidMotionProp(c)||!n&&!isValidMotionProp(c)||t.draggable&&c.startsWith("onDrag"))&&(s[c]=t[c]);return s}function calcOrigin$1(t,n,o){return typeof t=="string"?t:px.transform(n+o*t)}function calcSVGTransformOrigin(t,n,o){const s=calcOrigin$1(n,t.x,t.width),c=calcOrigin$1(o,t.y,t.height);return`${s} ${c}`}const dashKeys={offset:"stroke-dashoffset",array:"stroke-dasharray"},camelKeys={offset:"strokeDashoffset",array:"strokeDasharray"};function buildSVGPath(t,n,o=1,s=0,c=!0){t.pathLength=1;const d=c?dashKeys:camelKeys;t[d.offset]=px.transform(-s);const h=px.transform(n),p=px.transform(o);t[d.array]=`${h} ${p}`}function buildSVGAttrs(t,{attrX:n,attrY:o,attrScale:s,originX:c,originY:d,pathLength:h,pathSpacing:p=1,pathOffset:y=0,...S},P,L,F){if(buildHTMLStyles(t,S,P,F),L){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:N,style:z,dimensions:W}=t;N.transform&&(W&&(z.transform=N.transform),delete N.transform),W&&(c!==void 0||d!==void 0||z.transform)&&(z.transformOrigin=calcSVGTransformOrigin(W,c!==void 0?c:.5,d!==void 0?d:.5)),n!==void 0&&(N.x=n),o!==void 0&&(N.y=o),s!==void 0&&(N.scale=s),h!==void 0&&buildSVGPath(N,h,p,y,!1)}const createSvgRenderState=()=>({...createHtmlRenderState(),attrs:{}}),isSVGTag=t=>typeof t=="string"&&t.toLowerCase()==="svg";function useSVGProps(t,n,o,s){const c=React.useMemo(()=>{const d=createSvgRenderState();return buildSVGAttrs(d,n,{enableHardwareAcceleration:!1},isSVGTag(s),t.transformTemplate),{...d.attrs,style:{...d.style}}},[n]);if(t.style){const d={};copyRawValuesOnly(d,t.style,t),c.style={...d,...c.style}}return c}function createUseRender(t=!1){return(o,s,c,{latestValues:d},h)=>{const y=(isSVGComponent(o)?useSVGProps:useHTMLProps)(s,d,h,o),S=filterProps(s,typeof o=="string",t),P=o!==React.Fragment?{...S,...y,ref:c}:{},{children:L}=s,F=React.useMemo(()=>isMotionValue(L)?L.get():L,[L]);return React.createElement(o,{...P,children:F})}}function renderHTML(t,{style:n,vars:o},s,c){Object.assign(t.style,n,c&&c.getProjectionStyles(s));for(const d in o)t.style.setProperty(d,o[d])}const camelCaseAttributes=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"]);function renderSVG(t,n,o,s){renderHTML(t,n,void 0,s);for(const c in n.attrs)t.setAttribute(camelCaseAttributes.has(c)?c:camelToDash(c),n.attrs[c])}function scrapeMotionValuesFromProps$1(t,n,o){var s;const{style:c}=t,d={};for(const h in c)(isMotionValue(c[h])||n.style&&isMotionValue(n.style[h])||isForcedMotionValue(h,t)||((s=o==null?void 0:o.getValue(h))===null||s===void 0?void 0:s.liveStyle)!==void 0)&&(d[h]=c[h]);return d}function scrapeMotionValuesFromProps(t,n,o){const s=scrapeMotionValuesFromProps$1(t,n,o);for(const c in t)if(isMotionValue(t[c])||isMotionValue(n[c])){const d=transformPropOrder.indexOf(c)!==-1?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c;s[d]=t[c]}return s}function resolveVariantFromProps(t,n,o,s={},c={}){return typeof n=="function"&&(n=n(o!==void 0?o:t.custom,s,c)),typeof n=="string"&&(n=t.variants&&t.variants[n]),typeof n=="function"&&(n=n(o!==void 0?o:t.custom,s,c)),n}function useConstant(t){const n=React.useRef(null);return n.current===null&&(n.current=t()),n.current}const isKeyframesTarget=t=>Array.isArray(t),isCustomValue=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),resolveFinalValueInKeyframes=t=>isKeyframesTarget(t)?t[t.length-1]||0:t;function resolveMotionValue(t){const n=isMotionValue(t)?t.get():t;return isCustomValue(n)?n.toValue():n}function makeState({scrapeMotionValuesFromProps:t,createRenderState:n,onMount:o},s,c,d){const h={latestValues:makeLatestValues(s,c,d,t),renderState:n()};return o&&(h.mount=p=>o(s,p,h)),h}const makeUseVisualState=t=>(n,o)=>{const s=React.useContext(MotionContext),c=React.useContext(PresenceContext),d=()=>makeState(t,n,s,c);return o?d():useConstant(d)};function makeLatestValues(t,n,o,s){const c={},d=s(t,{});for(const F in d)c[F]=resolveMotionValue(d[F]);let{initial:h,animate:p}=t;const y=isControllingVariants(t),S=isVariantNode(t);n&&S&&!y&&t.inherit!==!1&&(h===void 0&&(h=n.initial),p===void 0&&(p=n.animate));let P=o?o.initial===!1:!1;P=P||h===!1;const L=P?p:h;return L&&typeof L!="boolean"&&!isAnimationControls(L)&&(Array.isArray(L)?L:[L]).forEach(N=>{const z=resolveVariantFromProps(t,N);if(!z)return;const{transitionEnd:W,transition:nt,...Pe}=z;for(const se in Pe){let mt=Pe[se];if(Array.isArray(mt)){const kt=P?mt.length-1:0;mt=mt[kt]}mt!==null&&(c[se]=mt)}for(const se in W)c[se]=W[se]}),c}const noop$1=t=>t,{schedule:frame,cancel:cancelFrame,state:frameData,steps}=createRenderBatcher(typeof requestAnimationFrame<"u"?requestAnimationFrame:noop$1,!0),svgMotionConfig={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps,createRenderState:createSvgRenderState,onMount:(t,n,{renderState:o,latestValues:s})=>{frame.read(()=>{try{o.dimensions=typeof n.getBBox=="function"?n.getBBox():n.getBoundingClientRect()}catch{o.dimensions={x:0,y:0,width:0,height:0}}}),frame.render(()=>{buildSVGAttrs(o,s,{enableHardwareAcceleration:!1},isSVGTag(n.tagName),t.transformTemplate),renderSVG(n,o)})}})},htmlMotionConfig={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps:scrapeMotionValuesFromProps$1,createRenderState:createHtmlRenderState})};function createDomMotionConfig(t,{forwardMotionProps:n=!1},o,s){return{...isSVGComponent(t)?svgMotionConfig:htmlMotionConfig,preloadedFeatures:o,useRender:createUseRender(n),createVisualElement:s,Component:t}}function addDomEvent(t,n,o,s={passive:!0}){return t.addEventListener(n,o,s),()=>t.removeEventListener(n,o)}const isPrimaryPointer=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function extractEventInfo(t,n="page"){return{point:{x:t[n+"X"],y:t[n+"Y"]}}}const addPointerInfo=t=>n=>isPrimaryPointer(n)&&t(n,extractEventInfo(n));function addPointerEvent(t,n,o,s){return addDomEvent(t,n,addPointerInfo(o),s)}const combineFunctions=(t,n)=>o=>n(t(o)),pipe=(...t)=>t.reduce(combineFunctions);function createLock(t){let n=null;return()=>{const o=()=>{n=null};return n===null?(n=t,o):!1}}const globalHorizontalLock=createLock("dragHorizontal"),globalVerticalLock=createLock("dragVertical");function getGlobalLock(t){let n=!1;if(t==="y")n=globalVerticalLock();else if(t==="x")n=globalHorizontalLock();else{const o=globalHorizontalLock(),s=globalVerticalLock();o&&s?n=()=>{o(),s()}:(o&&o(),s&&s())}return n}function isDragActive(){const t=getGlobalLock(!0);return t?(t(),!1):!0}class Feature{constructor(n){this.isMounted=!1,this.node=n}update(){}}function addHoverEvent(t,n){const o="pointer"+(n?"enter":"leave"),s="onHover"+(n?"Start":"End"),c=(d,h)=>{if(d.pointerType==="touch"||isDragActive())return;const p=t.getProps();t.animationState&&p.whileHover&&t.animationState.setActive("whileHover",n),p[s]&&p[s](d,h)};return addPointerEvent(t.current,o,c,{passive:!t.getProps()[s]})}class HoverGesture extends Feature{mount(){this.unmount=pipe(addHoverEvent(this.node,!0),addHoverEvent(this.node,!1))}unmount(){}}class FocusGesture extends Feature{constructor(){super(...arguments),this.isActive=!1}onFocus(){let n=!1;try{n=this.node.current.matches(":focus-visible")}catch{n=!0}!n||!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=pipe(addDomEvent(this.node.current,"focus",()=>this.onFocus()),addDomEvent(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const isNodeOrChild=(t,n)=>n?t===n?!0:isNodeOrChild(t,n.parentElement):!1;function fireSyntheticPointerEvent(t,n){if(!n)return;const o=new PointerEvent("pointer"+t);n(o,extractEventInfo(o))}class PressGesture extends Feature{constructor(){super(...arguments),this.removeStartListeners=noop$1,this.removeEndListeners=noop$1,this.removeAccessibleListeners=noop$1,this.startPointerPress=(n,o)=>{if(this.isPressing)return;this.removeEndListeners();const s=this.node.getProps(),d=addPointerEvent(window,"pointerup",(p,y)=>{if(!this.checkPressEnd())return;const{onTap:S,onTapCancel:P,globalTapTarget:L}=this.node.getProps();!L&&!isNodeOrChild(this.node.current,p.target)?P&&P(p,y):S&&S(p,y)},{passive:!(s.onTap||s.onPointerUp)}),h=addPointerEvent(window,"pointercancel",(p,y)=>this.cancelPress(p,y),{passive:!(s.onTapCancel||s.onPointerCancel)});this.removeEndListeners=pipe(d,h),this.startPress(n,o)},this.startAccessiblePress=()=>{const n=d=>{if(d.key!=="Enter"||this.isPressing)return;const h=p=>{p.key!=="Enter"||!this.checkPressEnd()||fireSyntheticPointerEvent("up",(y,S)=>{const{onTap:P}=this.node.getProps();P&&P(y,S)})};this.removeEndListeners(),this.removeEndListeners=addDomEvent(this.node.current,"keyup",h),fireSyntheticPointerEvent("down",(p,y)=>{this.startPress(p,y)})},o=addDomEvent(this.node.current,"keydown",n),s=()=>{this.isPressing&&fireSyntheticPointerEvent("cancel",(d,h)=>this.cancelPress(d,h))},c=addDomEvent(this.node.current,"blur",s);this.removeAccessibleListeners=pipe(o,c)}}startPress(n,o){this.isPressing=!0;const{onTapStart:s,whileTap:c}=this.node.getProps();c&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),s&&s(n,o)}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!isDragActive()}cancelPress(n,o){if(!this.checkPressEnd())return;const{onTapCancel:s}=this.node.getProps();s&&s(n,o)}mount(){const n=this.node.getProps(),o=addPointerEvent(n.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(n.onTapStart||n.onPointerStart)}),s=addDomEvent(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=pipe(o,s)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const observerCallbacks=new WeakMap,observers=new WeakMap,fireObserverCallback=t=>{const n=observerCallbacks.get(t.target);n&&n(t)},fireAllObserverCallbacks=t=>{t.forEach(fireObserverCallback)};function initIntersectionObserver({root:t,...n}){const o=t||document;observers.has(o)||observers.set(o,{});const s=observers.get(o),c=JSON.stringify(n);return s[c]||(s[c]=new IntersectionObserver(fireAllObserverCallbacks,{root:t,...n})),s[c]}function observeIntersection(t,n,o){const s=initIntersectionObserver(n);return observerCallbacks.set(t,o),s.observe(t),()=>{observerCallbacks.delete(t),s.unobserve(t)}}const thresholdNames={some:0,all:1};class InViewFeature extends Feature{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:n={}}=this.node.getProps(),{root:o,margin:s,amount:c="some",once:d}=n,h={root:o?o.current:void 0,rootMargin:s,threshold:typeof c=="number"?c:thresholdNames[c]},p=y=>{const{isIntersecting:S}=y;if(this.isInView===S||(this.isInView=S,d&&!S&&this.hasEnteredView))return;S&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",S);const{onViewportEnter:P,onViewportLeave:L}=this.node.getProps(),F=S?P:L;F&&F(y)};return observeIntersection(this.node.current,h,p)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:n,prevProps:o}=this.node;["amount","margin","root"].some(hasViewportOptionChanged(n,o))&&this.startObserver()}unmount(){}}function hasViewportOptionChanged({viewport:t={}},{viewport:n={}}={}){return o=>t[o]!==n[o]}const gestureAnimations={inView:{Feature:InViewFeature},tap:{Feature:PressGesture},focus:{Feature:FocusGesture},hover:{Feature:HoverGesture}};function shallowCompare(t,n){if(!Array.isArray(n))return!1;const o=n.length;if(o!==t.length)return!1;for(let s=0;s<o;s++)if(n[s]!==t[s])return!1;return!0}function getCurrent(t){const n={};return t.values.forEach((o,s)=>n[s]=o.get()),n}function getVelocity$1(t){const n={};return t.values.forEach((o,s)=>n[s]=o.getVelocity()),n}function resolveVariant(t,n,o){const s=t.getProps();return resolveVariantFromProps(s,n,o!==void 0?o:s.custom,getCurrent(t),getVelocity$1(t))}const secondsToMilliseconds=t=>t*1e3,millisecondsToSeconds=t=>t/1e3,underDampedSpring={type:"spring",stiffness:500,damping:25,restSpeed:10},criticallyDampedSpring=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),keyframesTransition={type:"keyframes",duration:.8},ease={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},getDefaultTransition=(t,{keyframes:n})=>n.length>2?keyframesTransition:transformProps.has(t)?t.startsWith("scale")?criticallyDampedSpring(n[1]):underDampedSpring:ease;function isTransitionDefined({when:t,delay:n,delayChildren:o,staggerChildren:s,staggerDirection:c,repeat:d,repeatType:h,repeatDelay:p,from:y,elapsed:S,...P}){return!!Object.keys(P).length}function getValueTransition(t,n){return t[n]||t.default||t}const isNotNull=t=>t!==null;function getFinalKeyframe(t,{repeat:n,repeatType:o="loop"},s){const c=t.filter(isNotNull),d=n&&o!=="loop"&&n%2===1?0:c.length-1;return!d||s===void 0?c[d]:s}let now;function clearTime(){now=void 0}const time={now:()=>(now===void 0&&time.set(frameData.isProcessing||MotionGlobalConfig.useManualTiming?frameData.timestamp:performance.now()),now),set:t=>{now=t,queueMicrotask(clearTime)}},isZeroValueString=t=>/^0[^.\s]+$/u.test(t);function isNone(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||isZeroValueString(t):!0}let warning=noop$1,invariant=noop$1;process.env.NODE_ENV!=="production"&&(warning=(t,n)=>{!t&&typeof console<"u"&&console.warn(n)},invariant=(t,n)=>{if(!t)throw new Error(n)});const isNumericalString=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),splitCSSVariableRegex=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function parseCSSVariable(t){const n=splitCSSVariableRegex.exec(t);if(!n)return[,];const[,o,s,c]=n;return[`--${o??s}`,c]}const maxDepth=4;function getVariableValue(t,n,o=1){invariant(o<=maxDepth,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[s,c]=parseCSSVariable(t);if(!s)return;const d=window.getComputedStyle(n).getPropertyValue(s);if(d){const h=d.trim();return isNumericalString(h)?parseFloat(h):h}return isCSSVariableToken(c)?getVariableValue(c,n,o+1):c}const positionalKeys=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),isNumOrPxType=t=>t===number||t===px,getPosFromMatrix=(t,n)=>parseFloat(t.split(", ")[n]),getTranslateFromMatrix=(t,n)=>(o,{transform:s})=>{if(s==="none"||!s)return 0;const c=s.match(/^matrix3d\((.+)\)$/u);if(c)return getPosFromMatrix(c[1],n);{const d=s.match(/^matrix\((.+)\)$/u);return d?getPosFromMatrix(d[1],t):0}},transformKeys=new Set(["x","y","z"]),nonTranslationalTransformKeys=transformPropOrder.filter(t=>!transformKeys.has(t));function removeNonTranslationalTransform(t){const n=[];return nonTranslationalTransformKeys.forEach(o=>{const s=t.getValue(o);s!==void 0&&(n.push([o,s.get()]),s.set(o.startsWith("scale")?1:0))}),n}const positionalValues={width:({x:t},{paddingLeft:n="0",paddingRight:o="0"})=>t.max-t.min-parseFloat(n)-parseFloat(o),height:({y:t},{paddingTop:n="0",paddingBottom:o="0"})=>t.max-t.min-parseFloat(n)-parseFloat(o),top:(t,{top:n})=>parseFloat(n),left:(t,{left:n})=>parseFloat(n),bottom:({y:t},{top:n})=>parseFloat(n)+(t.max-t.min),right:({x:t},{left:n})=>parseFloat(n)+(t.max-t.min),x:getTranslateFromMatrix(4,13),y:getTranslateFromMatrix(5,14)};positionalValues.translateX=positionalValues.x,positionalValues.translateY=positionalValues.y;const testValueType=t=>n=>n.test(t),auto={test:t=>t==="auto",parse:t=>t},dimensionValueTypes=[number,px,percent,degrees,vw,vh,auto],findDimensionValueType=t=>dimensionValueTypes.find(testValueType(t)),toResolve=new Set;let isScheduled=!1,anyNeedsMeasurement=!1;function measureAllKeyframes(){if(anyNeedsMeasurement){const t=Array.from(toResolve).filter(s=>s.needsMeasurement),n=new Set(t.map(s=>s.element)),o=new Map;n.forEach(s=>{removeNonTranslationalTransform(s).length&&(o.set(s,removeNonTranslationalTransform(s)),s.render())}),t.forEach(s=>s.measureInitialState()),n.forEach(s=>{s.render()}),t.forEach(s=>s.measureEndState()),t.forEach(s=>{s.suspendedScrollY!==void 0&&window.scrollTo(0,s.suspendedScrollY)})}anyNeedsMeasurement=!1,isScheduled=!1,toResolve.forEach(t=>t.complete()),toResolve.clear()}function readAllKeyframes(){toResolve.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(anyNeedsMeasurement=!0)})}function flushKeyframeResolvers(){readAllKeyframes(),measureAllKeyframes()}class KeyframeResolver{constructor(n,o,s,c,d,h=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...n],this.onComplete=o,this.name=s,this.motionValue=c,this.element=d,this.isAsync=h}scheduleResolve(){this.isScheduled=!0,this.isAsync?(toResolve.add(this),isScheduled||(isScheduled=!0,frame.read(readAllKeyframes),frame.resolveKeyframes(measureAllKeyframes))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:n,name:o,element:s,motionValue:c}=this;for(let d=0;d<n.length;d++)if(n[d]===null)if(d===0){const h=c==null?void 0:c.get(),p=n[n.length-1];if(h!==void 0)n[0]=h;else if(s&&o){const y=s.readValue(o,p);y!=null&&(n[0]=y)}n[0]===void 0&&(n[0]=p),c&&h===void 0&&c.set(n[0])}else n[d]=n[d-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),toResolve.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,toResolve.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const isColorString=(t,n)=>o=>!!(isString$1(o)&&singleColorRegex.test(o)&&o.startsWith(t)||n&&Object.prototype.hasOwnProperty.call(o,n)),splitColor=(t,n,o)=>s=>{if(!isString$1(s))return s;const[c,d,h,p]=s.match(floatRegex);return{[t]:parseFloat(c),[n]:parseFloat(d),[o]:parseFloat(h),alpha:p!==void 0?parseFloat(p):1}},clampRgbUnit=t=>clamp(0,255,t),rgbUnit={...number,transform:t=>Math.round(clampRgbUnit(t))},rgba={test:isColorString("rgb","red"),parse:splitColor("red","green","blue"),transform:({red:t,green:n,blue:o,alpha:s=1})=>"rgba("+rgbUnit.transform(t)+", "+rgbUnit.transform(n)+", "+rgbUnit.transform(o)+", "+sanitize(alpha.transform(s))+")"};function parseHex(t){let n="",o="",s="",c="";return t.length>5?(n=t.substring(1,3),o=t.substring(3,5),s=t.substring(5,7),c=t.substring(7,9)):(n=t.substring(1,2),o=t.substring(2,3),s=t.substring(3,4),c=t.substring(4,5),n+=n,o+=o,s+=s,c+=c),{red:parseInt(n,16),green:parseInt(o,16),blue:parseInt(s,16),alpha:c?parseInt(c,16)/255:1}}const hex={test:isColorString("#"),parse:parseHex,transform:rgba.transform},hsla={test:isColorString("hsl","hue"),parse:splitColor("hue","saturation","lightness"),transform:({hue:t,saturation:n,lightness:o,alpha:s=1})=>"hsla("+Math.round(t)+", "+percent.transform(sanitize(n))+", "+percent.transform(sanitize(o))+", "+sanitize(alpha.transform(s))+")"},color={test:t=>rgba.test(t)||hex.test(t)||hsla.test(t),parse:t=>rgba.test(t)?rgba.parse(t):hsla.test(t)?hsla.parse(t):hex.parse(t),transform:t=>isString$1(t)?t:t.hasOwnProperty("red")?rgba.transform(t):hsla.transform(t)};function test(t){var n,o;return isNaN(t)&&isString$1(t)&&(((n=t.match(floatRegex))===null||n===void 0?void 0:n.length)||0)+(((o=t.match(colorRegex))===null||o===void 0?void 0:o.length)||0)>0}const NUMBER_TOKEN="number",COLOR_TOKEN="color",VAR_TOKEN="var",VAR_FUNCTION_TOKEN="var(",SPLIT_TOKEN="${}",complexRegex=/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 analyseComplexValue(t){const n=t.toString(),o=[],s={color:[],number:[],var:[]},c=[];let d=0;const p=n.replace(complexRegex,y=>(color.test(y)?(s.color.push(d),c.push(COLOR_TOKEN),o.push(color.parse(y))):y.startsWith(VAR_FUNCTION_TOKEN)?(s.var.push(d),c.push(VAR_TOKEN),o.push(y)):(s.number.push(d),c.push(NUMBER_TOKEN),o.push(parseFloat(y))),++d,SPLIT_TOKEN)).split(SPLIT_TOKEN);return{values:o,split:p,indexes:s,types:c}}function parseComplexValue(t){return analyseComplexValue(t).values}function createTransformer(t){const{split:n,types:o}=analyseComplexValue(t),s=n.length;return c=>{let d="";for(let h=0;h<s;h++)if(d+=n[h],c[h]!==void 0){const p=o[h];p===NUMBER_TOKEN?d+=sanitize(c[h]):p===COLOR_TOKEN?d+=color.transform(c[h]):d+=c[h]}return d}}const convertNumbersToZero=t=>typeof t=="number"?0:t;function getAnimatableNone$1(t){const n=parseComplexValue(t);return createTransformer(t)(n.map(convertNumbersToZero))}const complex={test,parse:parseComplexValue,createTransformer,getAnimatableNone:getAnimatableNone$1},maxDefaults=new Set(["brightness","contrast","saturate","opacity"]);function applyDefaultFilter(t){const[n,o]=t.slice(0,-1).split("(");if(n==="drop-shadow")return t;const[s]=o.match(floatRegex)||[];if(!s)return t;const c=o.replace(s,"");let d=maxDefaults.has(n)?1:0;return s!==o&&(d*=100),n+"("+d+c+")"}const functionRegex=/\b([a-z-]*)\(.*?\)/gu,filter={...complex,getAnimatableNone:t=>{const n=t.match(functionRegex);return n?n.map(applyDefaultFilter).join(" "):t}},defaultValueTypes={...numberValueTypes,color,backgroundColor:color,outlineColor:color,fill:color,stroke:color,borderColor:color,borderTopColor:color,borderRightColor:color,borderBottomColor:color,borderLeftColor:color,filter,WebkitFilter:filter},getDefaultValueType=t=>defaultValueTypes[t];function getAnimatableNone(t,n){let o=getDefaultValueType(t);return o!==filter&&(o=complex),o.getAnimatableNone?o.getAnimatableNone(n):void 0}function makeNoneKeyframesAnimatable(t,n,o){let s=0,c;for(;s<t.length&&!c;)typeof t[s]=="string"&&t[s]!=="none"&&t[s]!=="0"&&(c=t[s]),s++;if(c&&o)for(const d of n)t[d]=getAnimatableNone(o,c)}class DOMKeyframesResolver extends KeyframeResolver{constructor(n,o,s,c){super(n,o,s,c,c==null?void 0:c.owner,!0)}readKeyframes(){const{unresolvedKeyframes:n,element:o,name:s}=this;if(!o.current)return;super.readKeyframes();for(let y=0;y<n.length;y++){const S=n[y];if(typeof S=="string"&&isCSSVariableToken(S)){const P=getVariableValue(S,o.current);P!==void 0&&(n[y]=P)}}if(!positionalKeys.has(s)||n.length!==2)return this.resolveNoneKeyframes();const[c,d]=n,h=findDimensionValueType(c),p=findDimensionValueType(d);if(h!==p)if(isNumOrPxType(h)&&isNumOrPxType(p))for(let y=0;y<n.length;y++){const S=n[y];typeof S=="string"&&(n[y]=parseFloat(S))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:n,name:o}=this,s=[];for(let c=0;c<n.length;c++)isNone(n[c])&&s.push(c);s.length&&makeNoneKeyframesAnimatable(n,s,o)}measureInitialState(){const{element:n,unresolvedKeyframes:o,name:s}=this;if(!n.current)return;s==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=positionalValues[s](n.measureViewportBox(),window.getComputedStyle(n.current)),o[0]=this.measuredOrigin;const c=o[o.length-1];c!==void 0&&n.getValue(s,c).jump(c,!1)}measureEndState(){var n;const{element:o,name:s,unresolvedKeyframes:c}=this;if(!o.current)return;const d=o.getValue(s);d&&d.jump(this.measuredOrigin,!1);const h=c.length-1,p=c[h];c[h]=positionalValues[s](o.measureViewportBox(),window.getComputedStyle(o.current)),p!==null&&(this.finalKeyframe=p),!((n=this.removedTransforms)===null||n===void 0)&&n.length&&this.removedTransforms.forEach(([y,S])=>{o.getValue(y).set(S)}),this.resolveNoneKeyframes()}}function memo(t){let n;return()=>(n===void 0&&(n=t()),n)}const isAnimatable=(t,n)=>n==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(complex.test(t)||t==="0")&&!t.startsWith("url("));function hasKeyframesChanged(t){const n=t[0];if(t.length===1)return!0;for(let o=0;o<t.length;o++)if(t[o]!==n)return!0}function canAnimate(t,n,o,s){const c=t[0];if(c===null)return!1;const d=t[t.length-1],h=isAnimatable(c,n),p=isAnimatable(d,n);return warning(h===p,`You are trying to animate ${n} from "${c}" to "${d}". ${c} is not an animatable value - to enable this animation set ${c} to a value animatable to ${d} via the \`style\` property.`),!h||!p?!1:hasKeyframesChanged(t)||o==="spring"&&s}class BaseAnimation{constructor({autoplay:n=!0,delay:o=0,type:s="keyframes",repeat:c=0,repeatDelay:d=0,repeatType:h="loop",...p}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.options={autoplay:n,delay:o,type:s,repeat:c,repeatDelay:d,repeatType:h,...p},this.updateFinishedPromise()}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&flushKeyframeResolvers(),this._resolved}onKeyframesResolved(n,o){this.hasAttemptedResolve=!0;const{name:s,type:c,velocity:d,delay:h,onComplete:p,onUpdate:y,isGenerator:S}=this.options;if(!S&&!canAnimate(n,s,c,d))if(h)this.options.duration=0;else{y==null||y(getFinalKeyframe(n,this.options,o)),p==null||p(),this.resolveFinishedPromise();return}const P=this.initPlayback(n,o);P!==!1&&(this._resolved={keyframes:n,finalKeyframe:o,...P},this.onPostResolved())}onPostResolved(){}then(n,o){return this.currentFinishedPromise.then(n,o)}updateFinishedPromise(){this.currentFinishedPromise=new Promise(n=>{this.resolveFinishedPromise=n})}}function velocityPerSecond(t,n){return n?t*(1e3/n):0}const velocitySampleDuration=5;function calcGeneratorVelocity(t,n,o){const s=Math.max(n-velocitySampleDuration,0);return velocityPerSecond(o-t(s),n-s)}const safeMin=.001,minDuration=.01,maxDuration$1=10,minDamping=.05,maxDamping=1;function findSpring({duration:t=800,bounce:n=.25,velocity:o=0,mass:s=1}){let c,d;warning(t<=secondsToMilliseconds(maxDuration$1),"Spring duration must be 10 seconds or less");let h=1-n;h=clamp(minDamping,maxDamping,h),t=clamp(minDuration,maxDuration$1,millisecondsToSeconds(t)),h<1?(c=S=>{const P=S*h,L=P*t,F=P-o,N=calcAngularFreq(S,h),z=Math.exp(-L);return safeMin-F/N*z},d=S=>{const L=S*h*t,F=L*o+o,N=Math.pow(h,2)*Math.pow(S,2)*t,z=Math.exp(-L),W=calcAngularFreq(Math.pow(S,2),h);return(-c(S)+safeMin>0?-1:1)*((F-N)*z)/W}):(c=S=>{const P=Math.exp(-S*t),L=(S-o)*t+1;return-.001+P*L},d=S=>{const P=Math.exp(-S*t),L=(o-S)*(t*t);return P*L});const p=5/t,y=approximateRoot(c,d,p);if(t=secondsToMilliseconds(t),isNaN(y))return{stiffness:100,damping:10,duration:t};{const S=Math.pow(y,2)*s;return{stiffness:S,damping:h*2*Math.sqrt(s*S),duration:t}}}const rootIterations=12;function approximateRoot(t,n,o){let s=o;for(let c=1;c<rootIterations;c++)s=s-t(s)/n(s);return s}function calcAngularFreq(t,n){return t*Math.sqrt(1-n*n)}const durationKeys=["duration","bounce"],physicsKeys=["stiffness","damping","mass"];function isSpringType(t,n){return n.some(o=>t[o]!==void 0)}function getSpringOptions(t){let n={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!isSpringType(t,physicsKeys)&&isSpringType(t,durationKeys)){const o=findSpring(t);n={...n,...o,mass:1},n.isResolvedFromDuration=!0}return n}function spring({keyframes:t,restDelta:n,restSpeed:o,...s}){const c=t[0],d=t[t.length-1],h={done:!1,value:c},{stiffness:p,damping:y,mass:S,duration:P,velocity:L,isResolvedFromDuration:F}=getSpringOptions({...s,velocity:-millisecondsToSeconds(s.velocity||0)}),N=L||0,z=y/(2*Math.sqrt(p*S)),W=d-c,nt=millisecondsToSeconds(Math.sqrt(p/S)),Pe=Math.abs(W)<5;o||(o=Pe?.01:2),n||(n=Pe?.005:.5);let se;if(z<1){const mt=calcAngularFreq(nt,z);se=kt=>{const mn=Math.exp(-z*nt*kt);return d-mn*((N+z*nt*W)/mt*Math.sin(mt*kt)+W*Math.cos(mt*kt))}}else if(z===1)se=mt=>d-Math.exp(-nt*mt)*(W+(N+nt*W)*mt);else{const mt=nt*Math.sqrt(z*z-1);se=kt=>{const mn=Math.exp(-z*nt*kt),_i=Math.min(mt*kt,300);return d-mn*((N+z*nt*W)*Math.sinh(_i)+mt*W*Math.cosh(_i))/mt}}return{calculatedDuration:F&&P||null,next:mt=>{const kt=se(mt);if(F)h.done=mt>=P;else{let mn=N;mt!==0&&(z<1?mn=calcGeneratorVelocity(se,mt,kt):mn=0);const _i=Math.abs(mn)<=o,zi=Math.abs(d-kt)<=n;h.done=_i&&zi}return h.value=h.done?d:kt,h}}}function inertia({keyframes:t,velocity:n=0,power:o=.8,timeConstant:s=325,bounceDamping:c=10,bounceStiffness:d=500,modifyTarget:h,min:p,max:y,restDelta:S=.5,restSpeed:P}){const L=t[0],F={done:!1,value:L},N=Sa=>p!==void 0&&Sa<p||y!==void 0&&Sa>y,z=Sa=>p===void 0?y:y===void 0||Math.abs(p-Sa)<Math.abs(y-Sa)?p:y;let W=o*n;const nt=L+W,Pe=h===void 0?nt:h(nt);Pe!==nt&&(W=Pe-L);const se=Sa=>-W*Math.exp(-Sa/s),mt=Sa=>Pe+se(Sa),kt=Sa=>{const fa=se(Sa),La=mt(Sa);F.done=Math.abs(fa)<=S,F.value=F.done?Pe:La};let mn,_i;const zi=Sa=>{N(F.value)&&(mn=Sa,_i=spring({keyframes:[F.value,z(F.value)],velocity:calcGeneratorVelocity(mt,Sa,F.value),damping:c,stiffness:d,restDelta:S,restSpeed:P}))};return zi(0),{calculatedDuration:null,next:Sa=>{let fa=!1;return!_i&&mn===void 0&&(fa=!0,kt(Sa),zi(Sa)),mn!==void 0&&Sa>=mn?_i.next(Sa-mn):(!fa&&kt(Sa),F)}}}const calcBezier=(t,n,o)=>(((1-3*o+3*n)*t+(3*o-6*n))*t+3*n)*t,subdivisionPrecision=1e-7,subdivisionMaxIterations=12;function binarySubdivide(t,n,o,s,c){let d,h,p=0;do h=n+(o-n)/2,d=calcBezier(h,s,c)-t,d>0?o=h:n=h;while(Math.abs(d)>subdivisionPrecision&&++p<subdivisionMaxIterations);return h}function cubicBezier(t,n,o,s){if(t===n&&o===s)return noop$1;const c=d=>binarySubdivide(d,0,1,t,o);return d=>d===0||d===1?d:calcBezier(c(d),n,s)}const easeIn=cubicBezier(.42,0,1,1),easeOut=cubicBezier(0,0,.58,1),easeInOut=cubicBezier(.42,0,.58,1),isEasingArray=t=>Array.isArray(t)&&typeof t[0]!="number",mirrorEasing=t=>n=>n<=.5?t(2*n)/2:(2-t(2*(1-n)))/2,reverseEasing=t=>n=>1-t(1-n),circIn=t=>1-Math.sin(Math.acos(t)),circOut=reverseEasing(circIn),circInOut=mirrorEasing(circIn),backOut=cubicBezier(.33,1.53,.69,.99),backIn=reverseEasing(backOut),backInOut=mirrorEasing(backIn),anticipate=t=>(t*=2)<1?.5*backIn(t):.5*(2-Math.pow(2,-10*(t-1))),easingLookup={linear:noop$1,easeIn,easeInOut,easeOut,circIn,circInOut,circOut,backIn,backInOut,backOut,anticipate},easingDefinitionToFunction=t=>{if(Array.isArray(t)){invariant(t.length===4,"Cubic bezier arrays must contain four numerical values.");const[n,o,s,c]=t;return cubicBezier(n,o,s,c)}else if(typeof t=="string")return invariant(easingLookup[t]!==void 0,`Invalid easing type '${t}'`),easingLookup[t];return t},progress=(t,n,o)=>{const s=n-t;return s===0?1:(o-t)/s},mixNumber$1=(t,n,o)=>t+(n-t)*o;function hueToRgb(t,n,o){return o<0&&(o+=1),o>1&&(o-=1),o<1/6?t+(n-t)*6*o:o<1/2?n:o<2/3?t+(n-t)*(2/3-o)*6:t}function hslaToRgba({hue:t,saturation:n,lightness:o,alpha:s}){t/=360,n/=100,o/=100;let c=0,d=0,h=0;if(!n)c=d=h=o;else{const p=o<.5?o*(1+n):o+n-o*n,y=2*o-p;c=hueToRgb(y,p,t+1/3),d=hueToRgb(y,p,t),h=hueToRgb(y,p,t-1/3)}return{red:Math.round(c*255),green:Math.round(d*255),blue:Math.round(h*255),alpha:s}}const mixLinearColor=(t,n,o)=>{const s=t*t,c=o*(n*n-s)+s;return c<0?0:Math.sqrt(c)},colorTypes=[hex,rgba,hsla],getColorType=t=>colorTypes.find(n=>n.test(t));function asRGBA(t){const n=getColorType(t);invariant(!!n,`'${t}' is not an animatable color. Use the equivalent color code instead.`);let o=n.parse(t);return n===hsla&&(o=hslaToRgba(o)),o}const mixColor=(t,n)=>{const o=asRGBA(t),s=asRGBA(n),c={...o};return d=>(c.red=mixLinearColor(o.red,s.red,d),c.green=mixLinearColor(o.green,s.green,d),c.blue=mixLinearColor(o.blue,s.blue,d),c.alpha=mixNumber$1(o.alpha,s.alpha,d),rgba.transform(c))};function mixImmediate(t,n){return o=>o>0?n:t}function mixNumber(t,n){return o=>mixNumber$1(t,n,o)}function getMixer(t){return typeof t=="number"?mixNumber:typeof t=="string"?isCSSVariableToken(t)?mixImmediate:color.test(t)?mixColor:mixComplex:Array.isArray(t)?mixArray:typeof t=="object"?color.test(t)?mixColor:mixObject:mixImmediate}function mixArray(t,n){const o=[...t],s=o.length,c=t.map((d,h)=>getMixer(d)(d,n[h]));return d=>{for(let h=0;h<s;h++)o[h]=c[h](d);return o}}function mixObject(t,n){const o={...t,...n},s={};for(const c in o)t[c]!==void 0&&n[c]!==void 0&&(s[c]=getMixer(t[c])(t[c],n[c]));return c=>{for(const d in s)o[d]=s[d](c);return o}}function matchOrder(t,n){var o;const s=[],c={color:0,var:0,number:0};for(let d=0;d<n.values.length;d++){const h=n.types[d],p=t.indexes[h][c[h]],y=(o=t.values[p])!==null&&o!==void 0?o:0;s[d]=y,c[h]++}return s}const mixComplex=(t,n)=>{const o=complex.createTransformer(n),s=analyseComplexValue(t),c=analyseComplexValue(n);return s.indexes.var.length===c.indexes.var.length&&s.indexes.color.length===c.indexes.color.length&&s.indexes.number.length>=c.indexes.number.length?pipe(mixArray(matchOrder(s,c),c.values),o):(warning(!0,`Complex values '${t}' and '${n}' 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.`),mixImmediate(t,n))};function mix(t,n,o){return typeof t=="number"&&typeof n=="number"&&typeof o=="number"?mixNumber$1(t,n,o):getMixer(t)(t,n)}function createMixers(t,n,o){const s=[],c=o||mix,d=t.length-1;for(let h=0;h<d;h++){let p=c(t[h],t[h+1]);if(n){const y=Array.isArray(n)?n[h]||noop$1:n;p=pipe(y,p)}s.push(p)}return s}function interpolate(t,n,{clamp:o=!0,ease:s,mixer:c}={}){const d=t.length;if(invariant(d===n.length,"Both input and output ranges must be the same length"),d===1)return()=>n[0];if(d===2&&t[0]===t[1])return()=>n[1];t[0]>t[d-1]&&(t=[...t].reverse(),n=[...n].reverse());const h=createMixers(n,s,c),p=h.length,y=S=>{let P=0;if(p>1)for(;P<t.length-2&&!(S<t[P+1]);P++);const L=progress(t[P],t[P+1],S);return h[P](L)};return o?S=>y(clamp(t[0],t[d-1],S)):y}function fillOffset(t,n){const o=t[t.length-1];for(let s=1;s<=n;s++){const c=progress(0,n,s);t.push(mixNumber$1(o,1,c))}}function defaultOffset(t){const n=[0];return fillOffset(n,t.length-1),n}function convertOffsetToTimes(t,n){return t.map(o=>o*n)}function defaultEasing(t,n){return t.map(()=>n||easeInOut).splice(0,t.length-1)}function keyframes({duration:t=300,keyframes:n,times:o,ease:s="easeInOut"}){const c=isEasingArray(s)?s.map(easingDefinitionToFunction):easingDefinitionToFunction(s),d={done:!1,value:n[0]},h=convertOffsetToTimes(o&&o.length===n.length?o:defaultOffset(n),t),p=interpolate(h,n,{ease:Array.isArray(c)?c:defaultEasing(n,c)});return{calculatedDuration:t,next:y=>(d.value=p(y),d.done=y>=t,d)}}const maxGeneratorDuration=2e4;function calcGeneratorDuration(t){let n=0;const o=50;let s=t.next(n);for(;!s.done&&n<maxGeneratorDuration;)n+=o,s=t.next(n);return n>=maxGeneratorDuration?1/0:n}const frameloopDriver=t=>{const n=({timestamp:o})=>t(o);return{start:()=>frame.update(n,!0),stop:()=>cancelFrame(n),now:()=>frameData.isProcessing?frameData.timestamp:time.now()}},generators={decay:inertia,inertia,tween:keyframes,keyframes,spring},percentToProgress=t=>t/100;class MainThreadAnimation extends BaseAnimation{constructor({KeyframeResolver:n=KeyframeResolver,...o}){super(o),this.holdTime=null,this.startTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.state="idle";const{name:s,motionValue:c,keyframes:d}=this.options,h=(p,y)=>this.onKeyframesResolved(p,y);s&&c&&c.owner?this.resolver=c.owner.resolveKeyframes(d,h,s,c):this.resolver=new n(d,h,s,c),this.resolver.scheduleResolve()}initPlayback(n){const{type:o="keyframes",repeat:s=0,repeatDelay:c=0,repeatType:d,velocity:h=0}=this.options,p=generators[o]||keyframes;let y,S;p!==keyframes&&typeof n[0]!="number"&&(process.env.NODE_ENV!=="production"&&invariant(n.length===2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${n}`),y=pipe(percentToProgress,mix(n[0],n[1])),n=[0,100]);const P=p({...this.options,keyframes:n});d==="mirror"&&(S=p({...this.options,keyframes:[...n].reverse(),velocity:-h})),P.calculatedDuration===null&&(P.calculatedDuration=calcGeneratorDuration(P));const{calculatedDuration:L}=P,F=L+c,N=F*(s+1)-c;return{generator:P,mirroredGenerator:S,mapPercentToKeyframes:y,calculatedDuration:L,resolvedDuration:F,totalDuration:N}}onPostResolved(){const{autoplay:n=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!n?this.pause():this.state=this.pendingPlayState}tick(n,o=!1){const{resolved:s}=this;if(!s){const{keyframes:Sa}=this.options;return{done:!0,value:Sa[Sa.length-1]}}const{finalKeyframe:c,generator:d,mirroredGenerator:h,mapPercentToKeyframes:p,keyframes:y,calculatedDuration:S,totalDuration:P,resolvedDuration:L}=s;if(this.startTime===null)return d.next(0);const{delay:F,repeat:N,repeatType:z,repeatDelay:W,onUpdate:nt}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,n):this.speed<0&&(this.startTime=Math.min(n-P/this.speed,this.startTime)),o?this.currentTime=n:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(n-this.startTime)*this.speed;const Pe=this.currentTime-F*(this.speed>=0?1:-1),se=this.speed>=0?Pe<0:Pe>P;this.currentTime=Math.max(Pe,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=P);let mt=this.currentTime,kt=d;if(N){const Sa=Math.min(this.currentTime,P)/L;let fa=Math.floor(Sa),La=Sa%1;!La&&Sa>=1&&(La=1),La===1&&fa--,fa=Math.min(fa,N+1),!!(fa%2)&&(z==="reverse"?(La=1-La,W&&(La-=W/L)):z==="mirror"&&(kt=h)),mt=clamp(0,1,La)*L}const mn=se?{done:!1,value:y[0]}:kt.next(mt);p&&(mn.value=p(mn.value));let{done:_i}=mn;!se&&S!==null&&(_i=this.speed>=0?this.currentTime>=P:this.currentTime<=0);const zi=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&_i);return zi&&c!==void 0&&(mn.value=getFinalKeyframe(y,this.options,c)),nt&&nt(mn.value),zi&&this.finish(),mn}get duration(){const{resolved:n}=this;return n?millisecondsToSeconds(n.calculatedDuration):0}get time(){return millisecondsToSeconds(this.currentTime)}set time(n){n=secondsToMilliseconds(n),this.currentTime=n,this.holdTime!==null||this.speed===0?this.holdTime=n:this.driver&&(this.startTime=this.driver.now()-n/this.speed)}get speed(){return this.playbackSpeed}set speed(n){const o=this.playbackSpeed!==n;this.playbackSpeed=n,o&&(this.time=millisecondsToSeconds(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:n=frameloopDriver,onPlay:o}=this.options;this.driver||(this.driver=n(c=>this.tick(c))),o&&o();const s=this.driver.now();this.holdTime!==null?this.startTime=s-this.holdTime:(!this.startTime||this.state==="finished")&&(this.startTime=s),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var n;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(n=this.currentTime)!==null&&n!==void 0?n:0}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:n}=this.options;n&&n()}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:n}=this.options;n&&n()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(n){return this.startTime=0,this.tick(n,!0)}}const isBezierDefinition=t=>Array.isArray(t)&&typeof t[0]=="number";function isWaapiSupportedEasing(t){return!!(!t||typeof t=="string"&&supportedWaapiEasing[t]||isBezierDefinition(t)||Array.isArray(t)&&t.every(isWaapiSupportedEasing))}const cubicBezierAsString=([t,n,o,s])=>`cubic-bezier(${t}, ${n}, ${o}, ${s})`,supportedWaapiEasing={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:cubicBezierAsString([0,.65,.55,1]),circOut:cubicBezierAsString([.55,0,1,.45]),backIn:cubicBezierAsString([.31,.01,.66,-.59]),backOut:cubicBezierAsString([.33,1.53,.69,.99])};function mapEasingToNativeEasing(t){if(t)return isBezierDefinition(t)?cubicBezierAsString(t):Array.isArray(t)?t.map(mapEasingToNativeEasing):supportedWaapiEasing[t]}function animateStyle(t,n,o,{delay:s=0,duration:c=300,repeat:d=0,repeatType:h="loop",ease:p,times:y}={}){const S={[n]:o};y&&(S.offset=y);const P=mapEasingToNativeEasing(p);return Array.isArray(P)&&(S.easing=P),t.animate(S,{delay:s,duration:c,easing:Array.isArray(P)?"linear":P,fill:"both",iterations:d+1,direction:h==="reverse"?"alternate":"normal"})}const supportsWaapi=memo(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),acceleratedValues=new Set(["opacity","clipPath","filter","transform"]),sampleDelta=10,maxDuration=2e4;function requiresPregeneratedKeyframes(t){return t.type==="spring"||t.name==="backgroundColor"||!isWaapiSupportedEasing(t.ease)}function pregenerateKeyframes(t,n){const o=new MainThreadAnimation({...n,keyframes:t,repeat:0,delay:0,isGenerator:!0});let s={done:!1,value:t[0]};const c=[];let d=0;for(;!s.done&&d<maxDuration;)s=o.sample(d),c.push(s.value),d+=sampleDelta;return{times:void 0,keyframes:c,duration:d-sampleDelta,ease:"linear"}}class AcceleratedAnimation extends BaseAnimation{constructor(n){super(n);const{name:o,motionValue:s,keyframes:c}=this.options;this.resolver=new DOMKeyframesResolver(c,(d,h)=>this.onKeyframesResolved(d,h),o,s),this.resolver.scheduleResolve()}initPlayback(n,o){var s;let{duration:c=300,times:d,ease:h,type:p,motionValue:y,name:S}=this.options;if(!(!((s=y.owner)===null||s===void 0)&&s.current))return!1;if(requiresPregeneratedKeyframes(this.options)){const{onComplete:L,onUpdate:F,motionValue:N,...z}=this.options,W=pregenerateKeyframes(n,z);n=W.keyframes,n.length===1&&(n[1]=n[0]),c=W.duration,d=W.times,h=W.ease,p="keyframes"}const P=animateStyle(y.owner.current,S,n,{...this.options,duration:c,times:d,ease:h});return P.startTime=time.now(),this.pendingTimeline?(P.timeline=this.pendingTimeline,this.pendingTimeline=void 0):P.onfinish=()=>{const{onComplete:L}=this.options;y.set(getFinalKeyframe(n,this.options,o)),L&&L(),this.cancel(),this.resolveFinishedPromise()},{animation:P,duration:c,times:d,type:p,ease:h,keyframes:n}}get duration(){const{resolved:n}=this;if(!n)return 0;const{duration:o}=n;return millisecondsToSeconds(o)}get time(){const{resolved:n}=this;if(!n)return 0;const{animation:o}=n;return millisecondsToSeconds(o.currentTime||0)}set time(n){const{resolved:o}=this;if(!o)return;const{animation:s}=o;s.currentTime=secondsToMilliseconds(n)}get speed(){const{resolved:n}=this;if(!n)return 1;const{animation:o}=n;return o.playbackRate}set speed(n){const{resolved:o}=this;if(!o)return;const{animation:s}=o;s.playbackRate=n}get state(){const{resolved:n}=this;if(!n)return"idle";const{animation:o}=n;return o.playState}attachTimeline(n){if(!this._resolved)this.pendingTimeline=n;else{const{resolved:o}=this;if(!o)return noop$1;const{animation:s}=o;s.timeline=n,s.onfinish=null}return noop$1}play(){if(this.isStopped)return;const{resolved:n}=this;if(!n)return;const{animation:o}=n;o.playState==="finished"&&this.updateFinishedPromise(),o.play()}pause(){const{resolved:n}=this;if(!n)return;const{animation:o}=n;o.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;const{resolved:n}=this;if(!n)return;const{animation:o,keyframes:s,duration:c,type:d,ease:h,times:p}=n;if(!(o.playState==="idle"||o.playState==="finished")){if(this.time){const{motionValue:y,onUpdate:S,onComplete:P,...L}=this.options,F=new MainThreadAnimation({...L,keyframes:s,duration:c,type:d,ease:h,times:p,isGenerator:!0}),N=secondsToMilliseconds(this.time);y.setWithVelocity(F.sample(N-sampleDelta).value,F.sample(N).value,sampleDelta)}this.cancel()}}complete(){const{resolved:n}=this;n&&n.animation.finish()}cancel(){const{resolved:n}=this;n&&n.animation.cancel()}static supports(n){const{motionValue:o,name:s,repeatDelay:c,repeatType:d,damping:h,type:p}=n;return supportsWaapi()&&s&&acceleratedValues.has(s)&&o&&o.owner&&o.owner.current instanceof HTMLElement&&!o.owner.getProps().onUpdate&&!c&&d!=="mirror"&&h!==0&&p!=="inertia"}}const animateMotionValue=(t,n,o,s={},c,d)=>h=>{const p=getValueTransition(s,t)||{},y=p.delay||s.delay||0;let{elapsed:S=0}=s;S=S-secondsToMilliseconds(y);let P={keyframes:Array.isArray(o)?o:[null,o],ease:"easeOut",velocity:n.getVelocity(),...p,delay:-S,onUpdate:F=>{n.set(F),p.onUpdate&&p.onUpdate(F)},onComplete:()=>{h(),p.onComplete&&p.onComplete()},name:t,motionValue:n,element:d?void 0:c};isTransitionDefined(p)||(P={...P,...getDefaultTransition(t,P)}),P.duration&&(P.duration=secondsToMilliseconds(P.duration)),P.repeatDelay&&(P.repeatDelay=secondsToMilliseconds(P.repeatDelay)),P.from!==void 0&&(P.keyframes[0]=P.from);let L=!1;if((P.type===!1||P.duration===0&&!P.repeatDelay)&&(P.duration=0,P.delay===0&&(L=!0)),L&&!d&&n.get()!==void 0){const F=getFinalKeyframe(P.keyframes,p);if(F!==void 0){frame.update(()=>{P.onUpdate(F),P.onComplete()});return}}return!d&&AcceleratedAnimation.supports(P)?new AcceleratedAnimation(P):new MainThreadAnimation(P)};function isWillChangeMotionValue(t){return!!(isMotionValue(t)&&t.add)}function addUniqueItem(t,n){t.indexOf(n)===-1&&t.push(n)}function removeItem(t,n){const o=t.indexOf(n);o>-1&&t.splice(o,1)}class SubscriptionManager{constructor(){this.subscriptions=[]}add(n){return addUniqueItem(this.subscriptions,n),()=>removeItem(this.subscriptions,n)}notify(n,o,s){const c=this.subscriptions.length;if(c)if(c===1)this.subscriptions[0](n,o,s);else for(let d=0;d<c;d++){const h=this.subscriptions[d];h&&h(n,o,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const warned=new Set;function warnOnce(t,n,o){t||warned.has(n)||(console.warn(n),warned.add(n))}const MAX_VELOCITY_DELTA=30,isFloat=t=>!isNaN(parseFloat(t));class MotionValue{constructor(n,o={}){this.version="11.0.27",this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(s,c=!0)=>{const d=time.now();this.updatedAt!==d&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(s),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),c&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(n),this.canTrackVelocity=isFloat(this.current),this.owner=o.owner}setCurrent(n){this.current=n,this.updatedAt=time.now()}setPrevFrameValue(n=this.current){this.prevFrameValue=n,this.prevUpdatedAt=this.updatedAt}onChange(n){return process.env.NODE_ENV!=="production"&&warnOnce(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",n)}on(n,o){this.events[n]||(this.events[n]=new SubscriptionManager);const s=this.events[n].add(o);return n==="change"?()=>{s(),frame.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const n in this.events)this.events[n].clear()}attach(n,o){this.passiveEffect=n,this.stopPassiveEffect=o}set(n,o=!0){!o||!this.passiveEffect?this.updateAndNotify(n,o):this.passiveEffect(n,this.updateAndNotify)}setWithVelocity(n,o,s){this.set(o),this.prev=void 0,this.prevFrameValue=n,this.prevUpdatedAt=this.updatedAt-s}jump(n,o=!0){this.updateAndNotify(n),this.prev=n,this.prevUpdatedAt=this.prevFrameValue=void 0,o&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const n=time.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||n-this.updatedAt>MAX_VELOCITY_DELTA)return 0;const o=Math.min(this.updatedAt-this.prevUpdatedAt,MAX_VELOCITY_DELTA);return velocityPerSecond(parseFloat(this.current)-parseFloat(this.prevFrameValue),o)}start(n){return this.stop(),new Promise(o=>{this.hasAnimated=!0,this.animation=n(o),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.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function motionValue(t,n){return new MotionValue(t,n)}function setMotionValue(t,n,o){t.hasValue(n)?t.getValue(n).set(o):t.addValue(n,motionValue(o))}function setTarget(t,n){const o=resolveVariant(t,n);let{transitionEnd:s={},transition:c={},...d}=o||{};d={...d,...s};for(const h in d){const p=resolveFinalValueInKeyframes(d[h]);setMotionValue(t,h,p)}}function shouldBlockAnimation({protectedKeys:t,needsAnimating:n},o){const s=t.hasOwnProperty(o)&&n[o]!==!0;return n[o]=!1,s}function animateTarget(t,n,{delay:o=0,transitionOverride:s,type:c}={}){var d;let{transition:h=t.getDefaultTransition(),transitionEnd:p,...y}=n;const S=t.getValue("willChange");s&&(h=s);const P=[],L=c&&t.animationState&&t.animationState.getState()[c];for(const F in y){const N=t.getValue(F,(d=t.latestValues[F])!==null&&d!==void 0?d:null),z=y[F];if(z===void 0||L&&shouldBlockAnimation(L,F))continue;const W={delay:o,elapsed:0,...getValueTransition(h||{},F)};let nt=!1;if(window.HandoffAppearAnimations){const se=t.getProps()[optimizedAppearDataAttribute];if(se){const mt=window.HandoffAppearAnimations(se,F);mt!==null&&(W.elapsed=mt,nt=!0)}}N.start(animateMotionValue(F,N,z,t.shouldReduceMotion&&transformProps.has(F)?{type:!1}:W,t,nt));const Pe=N.animation;Pe&&(isWillChangeMotionValue(S)&&(S.add(F),Pe.then(()=>S.remove(F))),P.push(Pe))}return p&&Promise.all(P).then(()=>{frame.update(()=>{p&&setTarget(t,p)})}),P}function animateVariant(t,n,o={}){var s;const c=resolveVariant(t,n,o.type==="exit"?(s=t.presenceContext)===null||s===void 0?void 0:s.custom:void 0);let{transition:d=t.getDefaultTransition()||{}}=c||{};o.transitionOverride&&(d=o.transitionOverride);const h=c?()=>Promise.all(animateTarget(t,c,o)):()=>Promise.resolve(),p=t.variantChildren&&t.variantChildren.size?(S=0)=>{const{delayChildren:P=0,staggerChildren:L,staggerDirection:F}=d;return animateChildren(t,n,P+S,L,F,o)}:()=>Promise.resolve(),{when:y}=d;if(y){const[S,P]=y==="beforeChildren"?[h,p]:[p,h];return S().then(()=>P())}else return Promise.all([h(),p(o.delay)])}function animateChildren(t,n,o=0,s=0,c=1,d){const h=[],p=(t.variantChildren.size-1)*s,y=c===1?(S=0)=>S*s:(S=0)=>p-S*s;return Array.from(t.variantChildren).sort(sortByTreeOrder).forEach((S,P)=>{S.notify("AnimationStart",n),h.push(animateVariant(S,n,{...d,delay:o+y(P)}).then(()=>S.notify("AnimationComplete",n)))}),Promise.all(h)}function sortByTreeOrder(t,n){return t.sortNodePosition(n)}function animateVisualElement(t,n,o={}){t.notify("AnimationStart",n);let s;if(Array.isArray(n)){const c=n.map(d=>animateVariant(t,d,o));s=Promise.all(c)}else if(typeof n=="string")s=animateVariant(t,n,o);else{const c=typeof n=="function"?resolveVariant(t,n,o.custom):n;s=Promise.all(animateTarget(t,c,o))}return s.then(()=>{frame.postRender(()=>{t.notify("AnimationComplete",n)})})}const reversePriorityOrder=[...variantPriorityOrder].reverse(),numAnimationTypes=variantPriorityOrder.length;function animateList(t){return n=>Promise.all(n.map(({animation:o,options:s})=>animateVisualElement(t,o,s)))}function createAnimationState(t){let n=animateList(t);const o=createState();let s=!0;const c=y=>(S,P)=>{var L;const F=resolveVariant(t,P,y==="exit"?(L=t.presenceContext)===null||L===void 0?void 0:L.custom:void 0);if(F){const{transition:N,transitionEnd:z,...W}=F;S={...S,...W,...z}}return S};function d(y){n=y(t)}function h(y){const S=t.getProps(),P=t.getVariantContext(!0)||{},L=[],F=new Set;let N={},z=1/0;for(let nt=0;nt<numAnimationTypes;nt++){const Pe=reversePriorityOrder[nt],se=o[Pe],mt=S[Pe]!==void 0?S[Pe]:P[Pe],kt=isVariantLabel(mt),mn=Pe===y?se.isActive:null;mn===!1&&(z=nt);let _i=mt===P[Pe]&&mt!==S[Pe]&&kt;if(_i&&s&&t.manuallyAnimateOnMount&&(_i=!1),se.protectedKeys={...N},!se.isActive&&mn===null||!mt&&!se.prevProp||isAnimationControls(mt)||typeof mt=="boolean")continue;let Sa=checkVariantsDidChange(se.prevProp,mt)||Pe===y&&se.isActive&&!_i&&kt||nt>z&&kt,fa=!1;const La=Array.isArray(mt)?mt:[mt];let Ra=La.reduce(c(Pe),{});mn===!1&&(Ra={});const{prevResolvedValues:ma={}}=se,yt={...ma,...Ra},lt=pi=>{Sa=!0,F.has(pi)&&(fa=!0,F.delete(pi)),se.needsAnimating[pi]=!0;const ba=t.getValue(pi);ba&&(ba.liveStyle=!1)};for(const pi in yt){const ba=Ra[pi],Sc=ma[pi];if(N.hasOwnProperty(pi))continue;let ms=!1;isKeyframesTarget(ba)&&isKeyframesTarget(Sc)?ms=!shallowCompare(ba,Sc):ms=ba!==Sc,ms?ba!=null?lt(pi):F.add(pi):ba!==void 0&&F.has(pi)?lt(pi):se.protectedKeys[pi]=!0}se.prevProp=mt,se.prevResolvedValues=Ra,se.isActive&&(N={...N,...Ra}),s&&t.blockInitialAnimation&&(Sa=!1),Sa&&(!_i||fa)&&L.push(...La.map(pi=>({animation:pi,options:{type:Pe}})))}if(F.size){const nt={};F.forEach(Pe=>{const se=t.getBaseTarget(Pe),mt=t.getValue(Pe);mt&&(mt.liveStyle=!0),nt[Pe]=se===void 0?null:se}),L.push({animation:nt})}let W=!!L.length;return s&&(S.initial===!1||S.initial===S.animate)&&!t.manuallyAnimateOnMount&&(W=!1),s=!1,W?n(L):Promise.resolve()}function p(y,S){var P;if(o[y].isActive===S)return Promise.resolve();(P=t.variantChildren)===null||P===void 0||P.forEach(F=>{var N;return(N=F.animationState)===null||N===void 0?void 0:N.setActive(y,S)}),o[y].isActive=S;const L=h(y);for(const F in o)o[F].protectedKeys={};return L}return{animateChanges:h,setActive:p,setAnimateFunction:d,getState:()=>o}}function checkVariantsDidChange(t,n){return typeof n=="string"?n!==t:Array.isArray(n)?!shallowCompare(n,t):!1}function createTypeState(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function createState(){return{animate:createTypeState(!0),whileInView:createTypeState(),whileHover:createTypeState(),whileTap:createTypeState(),whileDrag:createTypeState(),whileFocus:createTypeState(),exit:createTypeState()}}class AnimationFeature extends Feature{constructor(n){super(n),n.animationState||(n.animationState=createAnimationState(n))}updateAnimationControlsSubscription(){const{animate:n}=this.node.getProps();this.unmount(),isAnimationControls(n)&&(this.unmount=n.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:n}=this.node.getProps(),{animate:o}=this.node.prevProps||{};n!==o&&this.updateAnimationControlsSubscription()}unmount(){}}let id$1=0;class ExitAnimationFeature extends Feature{constructor(){super(...arguments),this.id=id$1++}update(){if(!this.node.presenceContext)return;const{isPresent:n,onExitComplete:o}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||n===s)return;const c=this.node.animationState.setActive("exit",!n);o&&!n&&c.then(()=>o(this.id))}mount(){const{register:n}=this.node.presenceContext||{};n&&(this.unmount=n(this.id))}unmount(){}}const animations={animation:{Feature:AnimationFeature},exit:{Feature:ExitAnimationFeature}},distance=(t,n)=>Math.abs(t-n);function distance2D(t,n){const o=distance(t.x,n.x),s=distance(t.y,n.y);return Math.sqrt(o**2+s**2)}class PanSession{constructor(n,o,{transformPagePoint:s,contextWindow:c,dragSnapToOrigin:d=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const L=getPanInfo(this.lastMoveEventInfo,this.history),F=this.startEvent!==null,N=distance2D(L.offset,{x:0,y:0})>=3;if(!F&&!N)return;const{point:z}=L,{timestamp:W}=frameData;this.history.push({...z,timestamp:W});const{onStart:nt,onMove:Pe}=this.handlers;F||(nt&&nt(this.lastMoveEvent,L),this.startEvent=this.lastMoveEvent),Pe&&Pe(this.lastMoveEvent,L)},this.handlePointerMove=(L,F)=>{this.lastMoveEvent=L,this.lastMoveEventInfo=transformPoint(F,this.transformPagePoint),frame.update(this.updatePoint,!0)},this.handlePointerUp=(L,F)=>{this.end();const{onEnd:N,onSessionEnd:z,resumeAnimation:W}=this.handlers;if(this.dragSnapToOrigin&&W&&W(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const nt=getPanInfo(L.type==="pointercancel"?this.lastMoveEventInfo:transformPoint(F,this.transformPagePoint),this.history);this.startEvent&&N&&N(L,nt),z&&z(L,nt)},!isPrimaryPointer(n))return;this.dragSnapToOrigin=d,this.handlers=o,this.transformPagePoint=s,this.contextWindow=c||window;const h=extractEventInfo(n),p=transformPoint(h,this.transformPagePoint),{point:y}=p,{timestamp:S}=frameData;this.history=[{...y,timestamp:S}];const{onSessionStart:P}=o;P&&P(n,getPanInfo(p,this.history)),this.removeListeners=pipe(addPointerEvent(this.contextWindow,"pointermove",this.handlePointerMove),addPointerEvent(this.contextWindow,"pointerup",this.handlePointerUp),addPointerEvent(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(n){this.handlers=n}end(){this.removeListeners&&this.removeListeners(),cancelFrame(this.updatePoint)}}function transformPoint(t,n){return n?{point:n(t.point)}:t}function subtractPoint(t,n){return{x:t.x-n.x,y:t.y-n.y}}function getPanInfo({point:t},n){return{point:t,delta:subtractPoint(t,lastDevicePoint(n)),offset:subtractPoint(t,startDevicePoint(n)),velocity:getVelocity(n,.1)}}function startDevicePoint(t){return t[0]}function lastDevicePoint(t){return t[t.length-1]}function getVelocity(t,n){if(t.length<2)return{x:0,y:0};let o=t.length-1,s=null;const c=lastDevicePoint(t);for(;o>=0&&(s=t[o],!(c.timestamp-s.timestamp>secondsToMilliseconds(n)));)o--;if(!s)return{x:0,y:0};const d=millisecondsToSeconds(c.timestamp-s.timestamp);if(d===0)return{x:0,y:0};const h={x:(c.x-s.x)/d,y:(c.y-s.y)/d};return h.x===1/0&&(h.x=0),h.y===1/0&&(h.y=0),h}function calcLength(t){return t.max-t.min}function isNear(t,n=0,o=.01){return Math.abs(t-n)<=o}function calcAxisDelta(t,n,o,s=.5){t.origin=s,t.originPoint=mixNumber$1(n.min,n.max,t.origin),t.scale=calcLength(o)/calcLength(n),(isNear(t.scale,1,1e-4)||isNaN(t.scale))&&(t.scale=1),t.translate=mixNumber$1(o.min,o.max,t.origin)-t.originPoint,(isNear(t.translate)||isNaN(t.translate))&&(t.translate=0)}function calcBoxDelta(t,n,o,s){calcAxisDelta(t.x,n.x,o.x,s?s.originX:void 0),calcAxisDelta(t.y,n.y,o.y,s?s.originY:void 0)}function calcRelativeAxis(t,n,o){t.min=o.min+n.min,t.max=t.min+calcLength(n)}function calcRelativeBox(t,n,o){calcRelativeAxis(t.x,n.x,o.x),calcRelativeAxis(t.y,n.y,o.y)}function calcRelativeAxisPosition(t,n,o){t.min=n.min-o.min,t.max=t.min+calcLength(n)}function calcRelativePosition(t,n,o){calcRelativeAxisPosition(t.x,n.x,o.x),calcRelativeAxisPosition(t.y,n.y,o.y)}function applyConstraints(t,{min:n,max:o},s){return n!==void 0&&t<n?t=s?mixNumber$1(n,t,s.min):Math.max(t,n):o!==void 0&&t>o&&(t=s?mixNumber$1(o,t,s.max):Math.min(t,o)),t}function calcRelativeAxisConstraints(t,n,o){return{min:n!==void 0?t.min+n:void 0,max:o!==void 0?t.max+o-(t.max-t.min):void 0}}function calcRelativeConstraints(t,{top:n,left:o,bottom:s,right:c}){return{x:calcRelativeAxisConstraints(t.x,o,c),y:calcRelativeAxisConstraints(t.y,n,s)}}function calcViewportAxisConstraints(t,n){let o=n.min-t.min,s=n.max-t.max;return n.max-n.min<t.max-t.min&&([o,s]=[s,o]),{min:o,max:s}}function calcViewportConstraints(t,n){return{x:calcViewportAxisConstraints(t.x,n.x),y:calcViewportAxisConstraints(t.y,n.y)}}function calcOrigin(t,n){let o=.5;const s=calcLength(t),c=calcLength(n);return c>s?o=progress(n.min,n.max-s,t.min):s>c&&(o=progress(t.min,t.max-c,n.min)),clamp(0,1,o)}function rebaseAxisConstraints(t,n){const o={};return n.min!==void 0&&(o.min=n.min-t.min),n.max!==void 0&&(o.max=n.max-t.min),o}const defaultElastic=.35;function resolveDragElastic(t=defaultElastic){return t===!1?t=0:t===!0&&(t=defaultElastic),{x:resolveAxisElastic(t,"left","right"),y:resolveAxisElastic(t,"top","bottom")}}function resolveAxisElastic(t,n,o){return{min:resolvePointElastic(t,n),max:resolvePointElastic(t,o)}}function resolvePointElastic(t,n){return typeof t=="number"?t:t[n]||0}const createAxisDelta=()=>({translate:0,scale:1,origin:0,originPoint:0}),createDelta=()=>({x:createAxisDelta(),y:createAxisDelta()}),createAxis=()=>({min:0,max:0}),createBox=()=>({x:createAxis(),y:createAxis()});function eachAxis(t){return[t("x"),t("y")]}function convertBoundingBoxToBox({top:t,left:n,right:o,bottom:s}){return{x:{min:n,max:o},y:{min:t,max:s}}}function convertBoxToBoundingBox({x:t,y:n}){return{top:n.min,right:t.max,bottom:n.max,left:t.min}}function transformBoxPoints(t,n){if(!n)return t;const o=n({x:t.left,y:t.top}),s=n({x:t.right,y:t.bottom});return{top:o.y,left:o.x,bottom:s.y,right:s.x}}function isIdentityScale(t){return t===void 0||t===1}function hasScale({scale:t,scaleX:n,scaleY:o}){return!isIdentityScale(t)||!isIdentityScale(n)||!isIdentityScale(o)}function hasTransform(t){return hasScale(t)||has2DTranslate(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function has2DTranslate(t){return is2DTranslate(t.x)||is2DTranslate(t.y)}function is2DTranslate(t){return t&&t!=="0%"}function scalePoint(t,n,o){const s=t-o,c=n*s;return o+c}function applyPointDelta(t,n,o,s,c){return c!==void 0&&(t=scalePoint(t,c,s)),scalePoint(t,o,s)+n}function applyAxisDelta(t,n=0,o=1,s,c){t.min=applyPointDelta(t.min,n,o,s,c),t.max=applyPointDelta(t.max,n,o,s,c)}function applyBoxDelta(t,{x:n,y:o}){applyAxisDelta(t.x,n.translate,n.scale,n.originPoint),applyAxisDelta(t.y,o.translate,o.scale,o.originPoint)}function applyTreeDeltas(t,n,o,s=!1){const c=o.length;if(!c)return;n.x=n.y=1;let d,h;for(let p=0;p<c;p++){d=o[p],h=d.projectionDelta;const y=d.instance;y&&y.style&&y.style.display==="contents"||(s&&d.options.layoutScroll&&d.scroll&&d!==d.root&&transformBox(t,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),h&&(n.x*=h.x.scale,n.y*=h.y.scale,applyBoxDelta(t,h)),s&&hasTransform(d.latestValues)&&transformBox(t,d.latestValues))}n.x=snapToDefault(n.x),n.y=snapToDefault(n.y)}function snapToDefault(t){return Number.isInteger(t)||t>1.0000000000001||t<.999999999999?t:1}function translateAxis(t,n){t.min=t.min+n,t.max=t.max+n}function transformAxis(t,n,[o,s,c]){const d=n[c]!==void 0?n[c]:.5,h=mixNumber$1(t.min,t.max,d);applyAxisDelta(t,n[o],n[s],h,n.scale)}const xKeys$1=["x","scaleX","originX"],yKeys$1=["y","scaleY","originY"];function transformBox(t,n){transformAxis(t.x,n,xKeys$1),transformAxis(t.y,n,yKeys$1)}function measureViewportBox(t,n){return convertBoundingBoxToBox(transformBoxPoints(t.getBoundingClientRect(),n))}function measurePageBox(t,n,o){const s=measureViewportBox(t,o),{scroll:c}=n;return c&&(translateAxis(s.x,c.offset.x),translateAxis(s.y,c.offset.y)),s}const getContextWindow=({current:t})=>t?t.ownerDocument.defaultView:null,elementDragControls=new WeakMap;class VisualElementDragControls{constructor(n){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=createBox(),this.visualElement=n}start(n,{snapToCursor:o=!1}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const c=P=>{const{dragSnapToOrigin:L}=this.getProps();L?this.pauseAnimation():this.stopAnimation(),o&&this.snapToCursor(extractEventInfo(P,"page").point)},d=(P,L)=>{const{drag:F,dragPropagation:N,onDragStart:z}=this.getProps();if(F&&!N&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=getGlobalLock(F),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),eachAxis(nt=>{let Pe=this.getAxisMotionValue(nt).get()||0;if(percent.test(Pe)){const{projection:se}=this.visualElement;if(se&&se.layout){const mt=se.layout.layoutBox[nt];mt&&(Pe=calcLength(mt)*(parseFloat(Pe)/100))}}this.originPoint[nt]=Pe}),z&&z(P,L);const{animationState:W}=this.visualElement;W&&W.setActive("whileDrag",!0)},h=(P,L)=>{const{dragPropagation:F,dragDirectionLock:N,onDirectionLock:z,onDrag:W}=this.getProps();if(!F&&!this.openGlobalLock)return;const{offset:nt}=L;if(N&&this.currentDirection===null){this.currentDirection=getCurrentDirection(nt),this.currentDirection!==null&&z&&z(this.currentDirection);return}this.updateAxis("x",L.point,nt),this.updateAxis("y",L.point,nt),this.visualElement.render(),W&&W(P,L)},p=(P,L)=>this.stop(P,L),y=()=>eachAxis(P=>{var L;return this.getAnimationState(P)==="paused"&&((L=this.getAxisMotionValue(P).animation)===null||L===void 0?void 0:L.play())}),{dragSnapToOrigin:S}=this.getProps();this.panSession=new PanSession(n,{onSessionStart:c,onStart:d,onMove:h,onSessionEnd:p,resumeAnimation:y},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:S,contextWindow:getContextWindow(this.visualElement)})}stop(n,o){const s=this.isDragging;if(this.cancel(),!s)return;const{velocity:c}=o;this.startAnimation(c);const{onDragEnd:d}=this.getProps();d&&d(n,o)}cancel(){this.isDragging=!1;const{projection:n,animationState:o}=this.visualElement;n&&(n.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:s}=this.getProps();!s&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),o&&o.setActive("whileDrag",!1)}updateAxis(n,o,s){const{drag:c}=this.getProps();if(!s||!shouldDrag(n,c,this.currentDirection))return;const d=this.getAxisMotionValue(n);let h=this.originPoint[n]+s[n];this.constraints&&this.constraints[n]&&(h=applyConstraints(h,this.constraints[n],this.elastic[n])),d.set(h)}resolveConstraints(){var n;const{dragConstraints:o,dragElastic:s}=this.getProps(),c=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(n=this.visualElement.projection)===null||n===void 0?void 0:n.layout,d=this.constraints;o&&isRefObject(o)?this.constraints||(this.constraints=this.resolveRefConstraints()):o&&c?this.constraints=calcRelativeConstraints(c.layoutBox,o):this.constraints=!1,this.elastic=resolveDragElastic(s),d!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&eachAxis(h=>{this.getAxisMotionValue(h)&&(this.constraints[h]=rebaseAxisConstraints(c.layoutBox[h],this.constraints[h]))})}resolveRefConstraints(){const{dragConstraints:n,onMeasureDragConstraints:o}=this.getProps();if(!n||!isRefObject(n))return!1;const s=n.current;invariant(s!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:c}=this.visualElement;if(!c||!c.layout)return!1;const d=measurePageBox(s,c.root,this.visualElement.getTransformPagePoint());let h=calcViewportConstraints(c.layout.layoutBox,d);if(o){const p=o(convertBoxToBoundingBox(h));this.hasMutatedConstraints=!!p,p&&(h=convertBoundingBoxToBox(p))}return h}startAnimation(n){const{drag:o,dragMomentum:s,dragElastic:c,dragTransition:d,dragSnapToOrigin:h,onDragTransitionEnd:p}=this.getProps(),y=this.constraints||{},S=eachAxis(P=>{if(!shouldDrag(P,o,this.currentDirection))return;let L=y[P]||{};h&&(L={min:0,max:0});const F=c?200:1e6,N=c?40:1e7,z={type:"inertia",velocity:s?n[P]:0,bounceStiffness:F,bounceDamping:N,timeConstant:750,restDelta:1,restSpeed:10,...d,...L};return this.startAxisValueAnimation(P,z)});return Promise.all(S).then(p)}startAxisValueAnimation(n,o){const s=this.getAxisMotionValue(n);return s.start(animateMotionValue(n,s,0,o,this.visualElement))}stopAnimation(){eachAxis(n=>this.getAxisMotionValue(n).stop())}pauseAnimation(){eachAxis(n=>{var o;return(o=this.getAxisMotionValue(n).animation)===null||o===void 0?void 0:o.pause()})}getAnimationState(n){var o;return(o=this.getAxisMotionValue(n).animation)===null||o===void 0?void 0:o.state}getAxisMotionValue(n){const o="_drag"+n.toUpperCase(),s=this.visualElement.getProps(),c=s[o];return c||this.visualElement.getValue(n,(s.initial?s.initial[n]:void 0)||0)}snapToCursor(n){eachAxis(o=>{const{drag:s}=this.getProps();if(!shouldDrag(o,s,this.currentDirection))return;const{projection:c}=this.visualElement,d=this.getAxisMotionValue(o);if(c&&c.layout){const{min:h,max:p}=c.layout.layoutBox[o];d.set(n[o]-mixNumber$1(h,p,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:n,dragConstraints:o}=this.getProps(),{projection:s}=this.visualElement;if(!isRefObject(o)||!s||!this.constraints)return;this.stopAnimation();const c={x:0,y:0};eachAxis(h=>{const p=this.getAxisMotionValue(h);if(p){const y=p.get();c[h]=calcOrigin({min:y,max:y},this.constraints[h])}});const{transformTemplate:d}=this.visualElement.getProps();this.visualElement.current.style.transform=d?d({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),eachAxis(h=>{if(!shouldDrag(h,n,null))return;const p=this.getAxisMotionValue(h),{min:y,max:S}=this.constraints[h];p.set(mixNumber$1(y,S,c[h]))})}addListeners(){if(!this.visualElement.current)return;elementDragControls.set(this.visualElement,this);const n=this.visualElement.current,o=addPointerEvent(n,"pointerdown",y=>{const{drag:S,dragListener:P=!0}=this.getProps();S&&P&&this.start(y)}),s=()=>{const{dragConstraints:y}=this.getProps();isRefObject(y)&&(this.constraints=this.resolveRefConstraints())},{projection:c}=this.visualElement,d=c.addEventListener("measure",s);c&&!c.layout&&(c.root&&c.root.updateScroll(),c.updateLayout()),s();const h=addDomEvent(window,"resize",()=>this.scalePositionWithinConstraints()),p=c.addEventListener("didUpdate",({delta:y,hasLayoutChanged:S})=>{this.isDragging&&S&&(eachAxis(P=>{const L=this.getAxisMotionValue(P);L&&(this.originPoint[P]+=y[P].translate,L.set(L.get()+y[P].translate))}),this.visualElement.render())});return()=>{h(),o(),d(),p&&p()}}getProps(){const n=this.visualElement.getProps(),{drag:o=!1,dragDirectionLock:s=!1,dragPropagation:c=!1,dragConstraints:d=!1,dragElastic:h=defaultElastic,dragMomentum:p=!0}=n;return{...n,drag:o,dragDirectionLock:s,dragPropagation:c,dragConstraints:d,dragElastic:h,dragMomentum:p}}}function shouldDrag(t,n,o){return(n===!0||n===t)&&(o===null||o===t)}function getCurrentDirection(t,n=10){let o=null;return Math.abs(t.y)>n?o="y":Math.abs(t.x)>n&&(o="x"),o}class DragGesture extends Feature{constructor(n){super(n),this.removeGroupControls=noop$1,this.removeListeners=noop$1,this.controls=new VisualElementDragControls(n)}mount(){const{dragControls:n}=this.node.getProps();n&&(this.removeGroupControls=n.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||noop$1}unmount(){this.removeGroupControls(),this.removeListeners()}}const asyncHandler=t=>(n,o)=>{t&&t(n,o)};class PanGesture extends Feature{constructor(){super(...arguments),this.removePointerDownListener=noop$1}onPointerDown(n){this.session=new PanSession(n,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:getContextWindow(this.node)})}createPanHandlers(){const{onPanSessionStart:n,onPanStart:o,onPan:s,onPanEnd:c}=this.node.getProps();return{onSessionStart:asyncHandler(n),onStart:asyncHandler(o),onMove:s,onEnd:(d,h)=>{delete this.session,c&&c(d,h)}}}mount(){this.removePointerDownListener=addPointerEvent(this.node.current,"pointerdown",n=>this.onPointerDown(n))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function usePresence(){const t=React.useContext(PresenceContext);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:o,register:s}=t,c=React.useId();return React.useEffect(()=>s(c),[]),!n&&o?[!1,()=>o&&o(c)]:[!0]}const globalProjectionState={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function pixelsToPercent(t,n){return n.max===n.min?0:t/(n.max-n.min)*100}const correctBorderRadius={correct:(t,n)=>{if(!n.target)return t;if(typeof t=="string")if(px.test(t))t=parseFloat(t);else return t;const o=pixelsToPercent(t,n.target.x),s=pixelsToPercent(t,n.target.y);return`${o}% ${s}%`}},correctBoxShadow={correct:(t,{treeScale:n,projectionDelta:o})=>{const s=t,c=complex.parse(t);if(c.length>5)return s;const d=complex.createTransformer(t),h=typeof c[0]!="number"?1:0,p=o.x.scale*n.x,y=o.y.scale*n.y;c[0+h]/=p,c[1+h]/=y;const S=mixNumber$1(p,y,.5);return typeof c[2+h]=="number"&&(c[2+h]/=S),typeof c[3+h]=="number"&&(c[3+h]/=S),d(c)}};class MeasureLayoutWithContext extends React.Component{componentDidMount(){const{visualElement:n,layoutGroup:o,switchLayoutGroup:s,layoutId:c}=this.props,{projection:d}=n;addScaleCorrector(defaultScaleCorrectors),d&&(o.group&&o.group.add(d),s&&s.register&&c&&s.register(d),d.root.didUpdate(),d.addEventListener("animationComplete",()=>{this.safeToRemove()}),d.setOptions({...d.options,onExitComplete:()=>this.safeToRemove()})),globalProjectionState.hasEverUpdated=!0}getSnapshotBeforeUpdate(n){const{layoutDependency:o,visualElement:s,drag:c,isPresent:d}=this.props,h=s.projection;return h&&(h.isPresent=d,c||n.layoutDependency!==o||o===void 0?h.willUpdate():this.safeToRemove(),n.isPresent!==d&&(d?h.promote():h.relegate()||frame.postRender(()=>{const p=h.getStack();(!p||!p.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:n}=this.props.visualElement;n&&(n.root.didUpdate(),microtask.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:n,layoutGroup:o,switchLayoutGroup:s}=this.props,{projection:c}=n;c&&(c.scheduleCheckAfterUnmount(),o&&o.group&&o.group.remove(c),s&&s.deregister&&s.deregister(c))}safeToRemove(){const{safeToRemove:n}=this.props;n&&n()}render(){return null}}function MeasureLayout(t){const[n,o]=usePresence(),s=React.useContext(LayoutGroupContext);return React.createElement(MeasureLayoutWithContext,{...t,layoutGroup:s,switchLayoutGroup:React.useContext(SwitchLayoutGroupContext),isPresent:n,safeToRemove:o})}const defaultScaleCorrectors={borderRadius:{...correctBorderRadius,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:correctBorderRadius,borderTopRightRadius:correctBorderRadius,borderBottomLeftRadius:correctBorderRadius,borderBottomRightRadius:correctBorderRadius,boxShadow:correctBoxShadow},borders=["TopLeft","TopRight","BottomLeft","BottomRight"],numBorders=borders.length,asNumber=t=>typeof t=="string"?parseFloat(t):t,isPx=t=>typeof t=="number"||px.test(t);function mixValues(t,n,o,s,c,d){c?(t.opacity=mixNumber$1(0,o.opacity!==void 0?o.opacity:1,easeCrossfadeIn(s)),t.opacityExit=mixNumber$1(n.opacity!==void 0?n.opacity:1,0,easeCrossfadeOut(s))):d&&(t.opacity=mixNumber$1(n.opacity!==void 0?n.opacity:1,o.opacity!==void 0?o.opacity:1,s));for(let h=0;h<numBorders;h++){const p=`border${borders[h]}Radius`;let y=getRadius(n,p),S=getRadius(o,p);if(y===void 0&&S===void 0)continue;y||(y=0),S||(S=0),y===0||S===0||isPx(y)===isPx(S)?(t[p]=Math.max(mixNumber$1(asNumber(y),asNumber(S),s),0),(percent.test(S)||percent.test(y))&&(t[p]+="%")):t[p]=S}(n.rotate||o.rotate)&&(t.rotate=mixNumber$1(n.rotate||0,o.rotate||0,s))}function getRadius(t,n){return t[n]!==void 0?t[n]:t.borderRadius}const easeCrossfadeIn=compress(0,.5,circOut),easeCrossfadeOut=compress(.5,.95,noop$1);function compress(t,n,o){return s=>s<t?0:s>n?1:o(progress(t,n,s))}function copyAxisInto(t,n){t.min=n.min,t.max=n.max}function copyBoxInto(t,n){copyAxisInto(t.x,n.x),copyAxisInto(t.y,n.y)}function removePointDelta(t,n,o,s,c){return t-=n,t=scalePoint(t,1/o,s),c!==void 0&&(t=scalePoint(t,1/c,s)),t}function removeAxisDelta(t,n=0,o=1,s=.5,c,d=t,h=t){if(percent.test(n)&&(n=parseFloat(n),n=mixNumber$1(h.min,h.max,n/100)-h.min),typeof n!="number")return;let p=mixNumber$1(d.min,d.max,s);t===d&&(p-=n),t.min=removePointDelta(t.min,n,o,p,c),t.max=removePointDelta(t.max,n,o,p,c)}function removeAxisTransforms(t,n,[o,s,c],d,h){removeAxisDelta(t,n[o],n[s],n[c],n.scale,d,h)}const xKeys=["x","scaleX","originX"],yKeys=["y","scaleY","originY"];function removeBoxTransforms(t,n,o,s){removeAxisTransforms(t.x,n,xKeys,o?o.x:void 0,s?s.x:void 0),removeAxisTransforms(t.y,n,yKeys,o?o.y:void 0,s?s.y:void 0)}function isAxisDeltaZero(t){return t.translate===0&&t.scale===1}function isDeltaZero(t){return isAxisDeltaZero(t.x)&&isAxisDeltaZero(t.y)}function boxEquals(t,n){return t.x.min===n.x.min&&t.x.max===n.x.max&&t.y.min===n.y.min&&t.y.max===n.y.max}function boxEqualsRounded(t,n){return Math.round(t.x.min)===Math.round(n.x.min)&&Math.round(t.x.max)===Math.round(n.x.max)&&Math.round(t.y.min)===Math.round(n.y.min)&&Math.round(t.y.max)===Math.round(n.y.max)}function aspectRatio(t){return calcLength(t.x)/calcLength(t.y)}class NodeStack{constructor(){this.members=[]}add(n){addUniqueItem(this.members,n),n.scheduleRender()}remove(n){if(removeItem(this.members,n),n===this.prevLead&&(this.prevLead=void 0),n===this.lead){const o=this.members[this.members.length-1];o&&this.promote(o)}}relegate(n){const o=this.members.findIndex(c=>n===c);if(o===0)return!1;let s;for(let c=o;c>=0;c--){const d=this.members[c];if(d.isPresent!==!1){s=d;break}}return s?(this.promote(s),!0):!1}promote(n,o){const s=this.lead;if(n!==s&&(this.prevLead=s,this.lead=n,n.show(),s)){s.instance&&s.scheduleRender(),n.scheduleRender(),n.resumeFrom=s,o&&(n.resumeFrom.preserveOpacity=!0),s.snapshot&&(n.snapshot=s.snapshot,n.snapshot.latestValues=s.animationValues||s.latestValues),n.root&&n.root.isUpdating&&(n.isLayoutDirty=!0);const{crossfade:c}=n.options;c===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(n=>{const{options:o,resumingFrom:s}=n;o.onExitComplete&&o.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(n=>{n.instance&&n.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function buildProjectionTransform(t,n,o){let s="";const c=t.x.translate/n.x,d=t.y.translate/n.y,h=(o==null?void 0:o.z)||0;if((c||d||h)&&(s=`translate3d(${c}px, ${d}px, ${h}px) `),(n.x!==1||n.y!==1)&&(s+=`scale(${1/n.x}, ${1/n.y}) `),o){const{transformPerspective:S,rotate:P,rotateX:L,rotateY:F,skewX:N,skewY:z}=o;S&&(s=`perspective(${S}px) ${s}`),P&&(s+=`rotate(${P}deg) `),L&&(s+=`rotateX(${L}deg) `),F&&(s+=`rotateY(${F}deg) `),N&&(s+=`skewX(${N}deg) `),z&&(s+=`skewY(${z}deg) `)}const p=t.x.scale*n.x,y=t.y.scale*n.y;return(p!==1||y!==1)&&(s+=`scale(${p}, ${y})`),s||"none"}const compareByDepth=(t,n)=>t.depth-n.depth;class FlatTree{constructor(){this.children=[],this.isDirty=!1}add(n){addUniqueItem(this.children,n),this.isDirty=!0}remove(n){removeItem(this.children,n),this.isDirty=!0}forEach(n){this.isDirty&&this.children.sort(compareByDepth),this.isDirty=!1,this.children.forEach(n)}}function delay(t,n){const o=time.now(),s=({timestamp:c})=>{const d=c-o;d>=n&&(cancelFrame(s),t(d-n))};return frame.read(s,!0),()=>cancelFrame(s)}function record(t){window.MotionDebug&&window.MotionDebug.record(t)}function isSVGElement(t){return t instanceof SVGElement&&t.tagName!=="svg"}function animateSingleValue(t,n,o){const s=isMotionValue(t)?t:motionValue(t);return s.start(animateMotionValue("",s,n,o)),s.animation}const transformAxes=["","X","Y","Z"],hiddenVisibility={visibility:"hidden"},animationTarget=1e3;let id=0;const projectionFrameData={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function resetDistortingTransform(t,n,o,s){const{latestValues:c}=n;c[t]&&(o[t]=c[t],n.setStaticValue(t,0),s&&(s[t]=0))}function createProjectionNode({attachResizeListener:t,defaultParent:n,measureScroll:o,checkIsScrollRoot:s,resetTransform:c}){return class{constructor(h={},p=n==null?void 0:n()){this.id=id++,this.animationId=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.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,projectionFrameData.totalNodes=projectionFrameData.resolvedTargetDeltas=projectionFrameData.recalculatedProjection=0,this.nodes.forEach(propagateDirtyNodes),this.nodes.forEach(resolveTargetDelta),this.nodes.forEach(calcProjection),this.nodes.forEach(cleanDirtyNodes),record(projectionFrameData)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=h,this.root=p?p.root||p:this,this.path=p?[...p.path,p]:[],this.parent=p,this.depth=p?p.depth+1:0;for(let y=0;y<this.path.length;y++)this.path[y].shouldResetTransform=!0;this.root===this&&(this.nodes=new FlatTree)}addEventListener(h,p){return this.eventHandlers.has(h)||this.eventHandlers.set(h,new SubscriptionManager),this.eventHandlers.get(h).add(p)}notifyListeners(h,...p){const y=this.eventHandlers.get(h);y&&y.notify(...p)}hasListeners(h){return this.eventHandlers.has(h)}mount(h,p=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=isSVGElement(h),this.instance=h;const{layoutId:y,layout:S,visualElement:P}=this.options;if(P&&!P.current&&P.mount(h),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),p&&(S||y)&&(this.isLayoutDirty=!0),t){let L;const F=()=>this.root.updateBlockedByResize=!1;t(h,()=>{this.root.updateBlockedByResize=!0,L&&L(),L=delay(F,250),globalProjectionState.hasAnimatedSinceResize&&(globalProjectionState.hasAnimatedSinceResize=!1,this.nodes.forEach(finishAnimation))})}y&&this.root.registerSharedNode(y,this),this.options.animate!==!1&&P&&(y||S)&&this.addEventListener("didUpdate",({delta:L,hasLayoutChanged:F,hasRelativeTargetChanged:N,layout:z})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const W=this.options.transition||P.getDefaultTransition()||defaultLayoutTransition,{onLayoutAnimationStart:nt,onLayoutAnimationComplete:Pe}=P.getProps(),se=!this.targetLayout||!boxEqualsRounded(this.targetLayout,z)||N,mt=!F&&N;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||mt||F&&(se||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(L,mt);const kt={...getValueTransition(W,"layout"),onPlay:nt,onComplete:Pe};(P.shouldReduceMotion||this.options.layoutRoot)&&(kt.delay=0,kt.type=!1),this.startAnimation(kt)}else F||finishAnimation(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=z})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const h=this.getStack();h&&h.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,cancelFrame(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(resetSkewAndRotation),this.animationId++)}getTransformTemplate(){const{visualElement:h}=this.options;return h&&h.getProps().transformTemplate}willUpdate(h=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let P=0;P<this.path.length;P++){const L=this.path[P];L.shouldResetTransform=!0,L.updateScroll("snapshot"),L.options.layoutRoot&&L.willUpdate(!1)}const{layoutId:p,layout:y}=this.options;if(p===void 0&&!y)return;const S=this.getTransformTemplate();this.prevTransformTemplateValue=S?S(this.latestValues,""):void 0,this.updateSnapshot(),h&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(clearMeasurements);return}this.isUpdating||this.nodes.forEach(clearIsLayoutDirty),this.isUpdating=!1,window.HandoffCancelAllAnimations&&window.HandoffCancelAllAnimations(),this.nodes.forEach(resetTransformStyle),this.nodes.forEach(updateLayout),this.nodes.forEach(notifyLayoutUpdate),this.clearAllSnapshots();const p=time.now();frameData.delta=clamp(0,1e3/60,p-frameData.timestamp),frameData.timestamp=p,frameData.isProcessing=!0,steps.update.process(frameData),steps.preRender.process(frameData),steps.render.process(frameData),frameData.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,microtask.read(()=>this.update()))}clearAllSnapshots(){this.nodes.forEach(clearSnapshot),this.sharedNodes.forEach(removeLeadSnapshots)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,frame.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){frame.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let y=0;y<this.path.length;y++)this.path[y].updateScroll();const h=this.layout;this.layout=this.measure(!1),this.layoutCorrected=createBox(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:p}=this.options;p&&p.notify("LayoutMeasure",this.layout.layoutBox,h?h.layoutBox:void 0)}updateScroll(h="measure"){let p=!!(this.options.layoutScroll&&this.instance);this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===h&&(p=!1),p&&(this.scroll={animationId:this.root.animationId,phase:h,isRoot:s(this.instance),offset:o(this.instance)})}resetTransform(){if(!c)return;const h=this.isLayoutDirty||this.shouldResetTransform,p=this.projectionDelta&&!isDeltaZero(this.projectionDelta),y=this.getTransformTemplate(),S=y?y(this.latestValues,""):void 0,P=S!==this.prevTransformTemplateValue;h&&(p||hasTransform(this.latestValues)||P)&&(c(this.instance,S),this.shouldResetTransform=!1,this.scheduleRender())}measure(h=!0){const p=this.measurePageBox();let y=this.removeElementScroll(p);return h&&(y=this.removeTransform(y)),roundBox(y),{animationId:this.root.animationId,measuredBox:p,layoutBox:y,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:h}=this.options;if(!h)return createBox();const p=h.measureViewportBox(),{scroll:y}=this.root;return y&&(translateAxis(p.x,y.offset.x),translateAxis(p.y,y.offset.y)),p}removeElementScroll(h){const p=createBox();copyBoxInto(p,h);for(let y=0;y<this.path.length;y++){const S=this.path[y],{scroll:P,options:L}=S;if(S!==this.root&&P&&L.layoutScroll){if(P.isRoot){copyBoxInto(p,h);const{scroll:F}=this.root;F&&(translateAxis(p.x,-F.offset.x),translateAxis(p.y,-F.offset.y))}translateAxis(p.x,P.offset.x),translateAxis(p.y,P.offset.y)}}return p}applyTransform(h,p=!1){const y=createBox();copyBoxInto(y,h);for(let S=0;S<this.path.length;S++){const P=this.path[S];!p&&P.options.layoutScroll&&P.scroll&&P!==P.root&&transformBox(y,{x:-P.scroll.offset.x,y:-P.scroll.offset.y}),hasTransform(P.latestValues)&&transformBox(y,P.latestValues)}return hasTransform(this.latestValues)&&transformBox(y,this.latestValues),y}removeTransform(h){const p=createBox();copyBoxInto(p,h);for(let y=0;y<this.path.length;y++){const S=this.path[y];if(!S.instance||!hasTransform(S.latestValues))continue;hasScale(S.latestValues)&&S.updateSnapshot();const P=createBox(),L=S.measurePageBox();copyBoxInto(P,L),removeBoxTransforms(p,S.latestValues,S.snapshot?S.snapshot.layoutBox:void 0,P)}return hasTransform(this.latestValues)&&removeBoxTransforms(p,this.latestValues),p}setTargetDelta(h){this.targetDelta=h,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(h){this.options={...this.options,...h,crossfade:h.crossfade!==void 0?h.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!==frameData.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(h=!1){var p;const y=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=y.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=y.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=y.isSharedProjectionDirty);const S=!!this.resumingFrom||this!==y;if(!(h||S&&this.isSharedProjectionDirty||this.isProjectionDirty||!((p=this.parent)===null||p===void 0)&&p.isProjectionDirty||this.attemptToResolveRelativeTarget))return;const{layout:L,layoutId:F}=this.options;if(!(!this.layout||!(L||F))){if(this.resolvedRelativeTargetAt=frameData.timestamp,!this.targetDelta&&!this.relativeTarget){const N=this.getClosestProjectingParent();N&&N.layout&&this.animationProgress!==1?(this.relativeParent=N,this.forceRelativeParentToResolveTarget(),this.relativeTarget=createBox(),this.relativeTargetOrigin=createBox(),calcRelativePosition(this.relativeTargetOrigin,this.layout.layoutBox,N.layout.layoutBox),copyBoxInto(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=createBox(),this.targetWithTransforms=createBox()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),calcRelativeBox(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):copyBoxInto(this.target,this.layout.layoutBox),applyBoxDelta(this.target,this.targetDelta)):copyBoxInto(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const N=this.getClosestProjectingParent();N&&!!N.resumingFrom==!!this.resumingFrom&&!N.options.layoutScroll&&N.target&&this.animationProgress!==1?(this.relativeParent=N,this.forceRelativeParentToResolveTarget(),this.relativeTarget=createBox(),this.relativeTargetOrigin=createBox(),calcRelativePosition(this.relativeTargetOrigin,this.target,N.target),copyBoxInto(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}projectionFrameData.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||hasScale(this.parent.latestValues)||has2DTranslate(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var h;const p=this.getLead(),y=!!this.resumingFrom||this!==p;let S=!0;if((this.isProjectionDirty||!((h=this.parent)===null||h===void 0)&&h.isProjectionDirty)&&(S=!1),y&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(S=!1),this.resolvedRelativeTargetAt===frameData.timestamp&&(S=!1),S)return;const{layout:P,layoutId:L}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(P||L))return;copyBoxInto(this.layoutCorrected,this.layout.layoutBox);const F=this.treeScale.x,N=this.treeScale.y;applyTreeDeltas(this.layoutCorrected,this.treeScale,this.path,y),p.layout&&!p.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(p.target=p.layout.layoutBox,p.targetWithTransforms=createBox());const{target:z}=p;if(!z){this.projectionTransform&&(this.projectionDelta=createDelta(),this.projectionTransform="none",this.scheduleRender());return}this.projectionDelta||(this.projectionDelta=createDelta(),this.projectionDeltaWithTransform=createDelta());const W=this.projectionTransform;calcBoxDelta(this.projectionDelta,this.layoutCorrected,z,this.latestValues),this.projectionTransform=buildProjectionTransform(this.projectionDelta,this.treeScale),(this.projectionTransform!==W||this.treeScale.x!==F||this.treeScale.y!==N)&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",z)),projectionFrameData.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(h=!0){if(this.options.scheduleRender&&this.options.scheduleRender(),h){const p=this.getStack();p&&p.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}setAnimationOrigin(h,p=!1){const y=this.snapshot,S=y?y.latestValues:{},P={...this.latestValues},L=createDelta();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!p;const F=createBox(),N=y?y.source:void 0,z=this.layout?this.layout.source:void 0,W=N!==z,nt=this.getStack(),Pe=!nt||nt.members.length<=1,se=!!(W&&!Pe&&this.options.crossfade===!0&&!this.path.some(hasOpacityCrossfade));this.animationProgress=0;let mt;this.mixTargetDelta=kt=>{const mn=kt/1e3;mixAxisDelta(L.x,h.x,mn),mixAxisDelta(L.y,h.y,mn),this.setTargetDelta(L),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(calcRelativePosition(F,this.layout.layoutBox,this.relativeParent.layout.layoutBox),mixBox(this.relativeTarget,this.relativeTargetOrigin,F,mn),mt&&boxEquals(this.relativeTarget,mt)&&(this.isProjectionDirty=!1),mt||(mt=createBox()),copyBoxInto(mt,this.relativeTarget)),W&&(this.animationValues=P,mixValues(P,S,this.latestValues,mn,se,Pe)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=mn},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(h){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(cancelFrame(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=frame.update(()=>{globalProjectionState.hasAnimatedSinceResize=!0,this.currentAnimation=animateSingleValue(0,animationTarget,{...h,onUpdate:p=>{this.mixTargetDelta(p),h.onUpdate&&h.onUpdate(p)},onComplete:()=>{h.onComplete&&h.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 h=this.getStack();h&&h.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(animationTarget),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const h=this.getLead();let{targetWithTransforms:p,target:y,layout:S,latestValues:P}=h;if(!(!p||!y||!S)){if(this!==h&&this.layout&&S&&shouldAnimatePositionOnly(this.options.animationType,this.layout.layoutBox,S.layoutBox)){y=this.target||createBox();const L=calcLength(this.layout.layoutBox.x);y.x.min=h.target.x.min,y.x.max=y.x.min+L;const F=calcLength(this.layout.layoutBox.y);y.y.min=h.target.y.min,y.y.max=y.y.min+F}copyBoxInto(p,y),transformBox(p,P),calcBoxDelta(this.projectionDeltaWithTransform,this.layoutCorrected,p,P)}}registerSharedNode(h,p){this.sharedNodes.has(h)||this.sharedNodes.set(h,new NodeStack),this.sharedNodes.get(h).add(p);const S=p.options.initialPromotionConfig;p.promote({transition:S?S.transition:void 0,preserveFollowOpacity:S&&S.shouldPreserveFollowOpacity?S.shouldPreserveFollowOpacity(p):void 0})}isLead(){const h=this.getStack();return h?h.lead===this:!0}getLead(){var h;const{layoutId:p}=this.options;return p?((h=this.getStack())===null||h===void 0?void 0:h.lead)||this:this}getPrevLead(){var h;const{layoutId:p}=this.options;return p?(h=this.getStack())===null||h===void 0?void 0:h.prevLead:void 0}getStack(){const{layoutId:h}=this.options;if(h)return this.root.sharedNodes.get(h)}promote({needsReset:h,transition:p,preserveFollowOpacity:y}={}){const S=this.getStack();S&&S.promote(this,y),h&&(this.projectionDelta=void 0,this.needsReset=!0),p&&this.setOptions({transition:p})}relegate(){const h=this.getStack();return h?h.relegate(this):!1}resetSkewAndRotation(){const{visualElement:h}=this.options;if(!h)return;let p=!1;const{latestValues:y}=h;if((y.z||y.rotate||y.rotateX||y.rotateY||y.rotateZ||y.skewX||y.skewY)&&(p=!0),!p)return;const S={};y.z&&resetDistortingTransform("z",h,S,this.animationValues);for(let P=0;P<transformAxes.length;P++)resetDistortingTransform(`rotate${transformAxes[P]}`,h,S,this.animationValues),resetDistortingTransform(`skew${transformAxes[P]}`,h,S,this.animationValues);h.render();for(const P in S)h.setStaticValue(P,S[P]),this.animationValues&&(this.animationValues[P]=S[P]);h.scheduleRender()}getProjectionStyles(h){var p,y;if(!this.instance||this.isSVG)return;if(!this.isVisible)return hiddenVisibility;const S={visibility:""},P=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,S.opacity="",S.pointerEvents=resolveMotionValue(h==null?void 0:h.pointerEvents)||"",S.transform=P?P(this.latestValues,""):"none",S;const L=this.getLead();if(!this.projectionDelta||!this.layout||!L.target){const W={};return this.options.layoutId&&(W.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,W.pointerEvents=resolveMotionValue(h==null?void 0:h.pointerEvents)||""),this.hasProjected&&!hasTransform(this.latestValues)&&(W.transform=P?P({},""):"none",this.hasProjected=!1),W}const F=L.animationValues||L.latestValues;this.applyTransformsToTarget(),S.transform=buildProjectionTransform(this.projectionDeltaWithTransform,this.treeScale,F),P&&(S.transform=P(F,S.transform));const{x:N,y:z}=this.projectionDelta;S.transformOrigin=`${N.origin*100}% ${z.origin*100}% 0`,L.animationValues?S.opacity=L===this?(y=(p=F.opacity)!==null&&p!==void 0?p:this.latestValues.opacity)!==null&&y!==void 0?y:1:this.preserveOpacity?this.latestValues.opacity:F.opacityExit:S.opacity=L===this?F.opacity!==void 0?F.opacity:"":F.opacityExit!==void 0?F.opacityExit:0;for(const W in scaleCorrectors){if(F[W]===void 0)continue;const{correct:nt,applyTo:Pe}=scaleCorrectors[W],se=S.transform==="none"?F[W]:nt(F[W],L);if(Pe){const mt=Pe.length;for(let kt=0;kt<mt;kt++)S[Pe[kt]]=se}else S[W]=se}return this.options.layoutId&&(S.pointerEvents=L===this?resolveMotionValue(h==null?void 0:h.pointerEvents)||"":"none"),S}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(h=>{var p;return(p=h.currentAnimation)===null||p===void 0?void 0:p.stop()}),this.root.nodes.forEach(clearMeasurements),this.root.sharedNodes.clear()}}}function updateLayout(t){t.updateLayout()}function notifyLayoutUpdate(t){var n;const o=((n=t.resumeFrom)===null||n===void 0?void 0:n.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&o&&t.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:c}=t.layout,{animationType:d}=t.options,h=o.source!==t.layout.source;d==="size"?eachAxis(L=>{const F=h?o.measuredBox[L]:o.layoutBox[L],N=calcLength(F);F.min=s[L].min,F.max=F.min+N}):shouldAnimatePositionOnly(d,o.layoutBox,s)&&eachAxis(L=>{const F=h?o.measuredBox[L]:o.layoutBox[L],N=calcLength(s[L]);F.max=F.min+N,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[L].max=t.relativeTarget[L].min+N)});const p=createDelta();calcBoxDelta(p,s,o.layoutBox);const y=createDelta();h?calcBoxDelta(y,t.applyTransform(c,!0),o.measuredBox):calcBoxDelta(y,s,o.layoutBox);const S=!isDeltaZero(p);let P=!1;if(!t.resumeFrom){const L=t.getClosestProjectingParent();if(L&&!L.resumeFrom){const{snapshot:F,layout:N}=L;if(F&&N){const z=createBox();calcRelativePosition(z,o.layoutBox,F.layoutBox);const W=createBox();calcRelativePosition(W,s,N.layoutBox),boxEqualsRounded(z,W)||(P=!0),L.options.layoutRoot&&(t.relativeTarget=W,t.relativeTargetOrigin=z,t.relativeParent=L)}}}t.notifyListeners("didUpdate",{layout:s,snapshot:o,delta:y,layoutDelta:p,hasLayoutChanged:S,hasRelativeTargetChanged:P})}else if(t.isLead()){const{onExitComplete:s}=t.options;s&&s()}t.options.transition=void 0}function propagateDirtyNodes(t){projectionFrameData.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function cleanDirtyNodes(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function clearSnapshot(t){t.clearSnapshot()}function clearMeasurements(t){t.clearMeasurements()}function clearIsLayoutDirty(t){t.isLayoutDirty=!1}function resetTransformStyle(t){const{visualElement:n}=t.options;n&&n.getProps().onBeforeLayoutMeasure&&n.notify("BeforeLayoutMeasure"),t.resetTransform()}function finishAnimation(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function resolveTargetDelta(t){t.resolveTargetDelta()}function calcProjection(t){t.calcProjection()}function resetSkewAndRotation(t){t.resetSkewAndRotation()}function removeLeadSnapshots(t){t.removeLeadSnapshot()}function mixAxisDelta(t,n,o){t.translate=mixNumber$1(n.translate,0,o),t.scale=mixNumber$1(n.scale,1,o),t.origin=n.origin,t.originPoint=n.originPoint}function mixAxis(t,n,o,s){t.min=mixNumber$1(n.min,o.min,s),t.max=mixNumber$1(n.max,o.max,s)}function mixBox(t,n,o,s){mixAxis(t.x,n.x,o.x,s),mixAxis(t.y,n.y,o.y,s)}function hasOpacityCrossfade(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const defaultLayoutTransition={duration:.45,ease:[.4,0,.1,1]},userAgentContains=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),roundPoint=userAgentContains("applewebkit/")&&!userAgentContains("chrome/")?Math.round:noop$1;function roundAxis(t){t.min=roundPoint(t.min),t.max=roundPoint(t.max)}function roundBox(t){roundAxis(t.x),roundAxis(t.y)}function shouldAnimatePositionOnly(t,n,o){return t==="position"||t==="preserve-aspect"&&!isNear(aspectRatio(n),aspectRatio(o),.2)}const DocumentProjectionNode=createProjectionNode({attachResizeListener:(t,n)=>addDomEvent(t,"resize",n),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),rootProjectionNode={current:void 0},HTMLProjectionNode=createProjectionNode({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!rootProjectionNode.current){const t=new DocumentProjectionNode({});t.mount(window),t.setOptions({layoutScroll:!0}),rootProjectionNode.current=t}return rootProjectionNode.current},resetTransform:(t,n)=>{t.style.transform=n!==void 0?n:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),drag={pan:{Feature:PanGesture},drag:{Feature:DragGesture,ProjectionNode:HTMLProjectionNode,MeasureLayout}},prefersReducedMotion={current:null},hasReducedMotionListener={current:!1};function initPrefersReducedMotion(){if(hasReducedMotionListener.current=!0,!!isBrowser)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),n=()=>prefersReducedMotion.current=t.matches;t.addListener(n),n()}else prefersReducedMotion.current=!1}function updateMotionValuesFromProps(t,n,o){const{willChange:s}=n;for(const c in n){const d=n[c],h=o[c];if(isMotionValue(d))t.addValue(c,d),isWillChangeMotionValue(s)&&s.add(c),process.env.NODE_ENV==="development"&&warnOnce(d.version==="11.0.27",`Attempting to mix Framer Motion versions ${d.version} with 11.0.27 may not work as expected.`);else if(isMotionValue(h))t.addValue(c,motionValue(d,{owner:t})),isWillChangeMotionValue(s)&&s.remove(c);else if(h!==d)if(t.hasValue(c)){const p=t.getValue(c);p.liveStyle===!0?p.jump(d):p.hasAnimated||p.set(d)}else{const p=t.getStaticValue(c);t.addValue(c,motionValue(p!==void 0?p:d,{owner:t}))}}for(const c in o)n[c]===void 0&&t.removeValue(c);return n}const visualElementStore=new WeakMap,valueTypes=[...dimensionValueTypes,color,complex],findValueType=t=>valueTypes.find(testValueType(t)),featureNames=Object.keys(featureDefinitions),numFeatures=featureNames.length,propEventHandlers=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],numVariantProps=variantProps.length;function getClosestProjectingNode(t){if(t)return t.options.allowProjection!==!1?t.projection:getClosestProjectingNode(t.parent)}class VisualElement{constructor({parent:n,props:o,presenceContext:s,reducedMotionConfig:c,blockInitialAnimation:d,visualState:h},p={}){this.resolveKeyframes=(F,N,z,W)=>new this.KeyframeResolver(F,N,z,W,this),this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=KeyframeResolver,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},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.scheduleRender=()=>frame.render(this.render,!1,!0);const{latestValues:y,renderState:S}=h;this.latestValues=y,this.baseTarget={...y},this.initialValues=o.initial?{...y}:{},this.renderState=S,this.parent=n,this.props=o,this.presenceContext=s,this.depth=n?n.depth+1:0,this.reducedMotionConfig=c,this.options=p,this.blockInitialAnimation=!!d,this.isControllingVariants=isControllingVariants(o),this.isVariantNode=isVariantNode(o),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(n&&n.current);const{willChange:P,...L}=this.scrapeMotionValuesFromProps(o,{},this);for(const F in L){const N=L[F];y[F]!==void 0&&isMotionValue(N)&&(N.set(y[F],!1),isWillChangeMotionValue(P)&&P.add(F))}}scrapeMotionValuesFromProps(n,o,s){return{}}mount(n){this.current=n,visualElementStore.set(n,this),this.projection&&!this.projection.instance&&this.projection.mount(n),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((o,s)=>this.bindToMotionValue(s,o)),hasReducedMotionListener.current||initPrefersReducedMotion(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:prefersReducedMotion.current,process.env.NODE_ENV!=="production"&&warnOnce(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){visualElementStore.delete(this.current),this.projection&&this.projection.unmount(),cancelFrame(this.notifyUpdate),cancelFrame(this.render),this.valueSubscriptions.forEach(n=>n()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const n in this.events)this.events[n].clear();for(const n in this.features)this.features[n].unmount();this.current=null}bindToMotionValue(n,o){const s=transformProps.has(n),c=o.on("change",h=>{this.latestValues[n]=h,this.props.onUpdate&&frame.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0)}),d=o.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(n,()=>{c(),d(),o.owner&&o.stop()})}sortNodePosition(n){return!this.current||!this.sortInstanceNodePosition||this.type!==n.type?0:this.sortInstanceNodePosition(this.current,n.current)}loadFeatures({children:n,...o},s,c,d){let h,p;if(process.env.NODE_ENV!=="production"&&c&&s){const y="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";o.ignoreStrict?warning(!1,y):invariant(!1,y)}for(let y=0;y<numFeatures;y++){const S=featureNames[y],{isEnabled:P,Feature:L,ProjectionNode:F,MeasureLayout:N}=featureDefinitions[S];F&&(h=F),P(o)&&(!this.features[S]&&L&&(this.features[S]=new L(this)),N&&(p=N))}if((this.type==="html"||this.type==="svg")&&!this.projection&&h){this.projection=new h(this.latestValues,getClosestProjectingNode(this.parent));const{layoutId:y,layout:S,drag:P,dragConstraints:L,layoutScroll:F,layoutRoot:N}=o;this.projection.setOptions({layoutId:y,layout:S,alwaysMeasureLayout:!!P||L&&isRefObject(L),visualElement:this,scheduleRender:()=>this.scheduleRender(),animationType:typeof S=="string"?S:"both",initialPromotionConfig:d,layoutScroll:F,layoutRoot:N})}return p}updateFeatures(){for(const n in this.features){const o=this.features[n];o.isMounted?o.update():(o.mount(),o.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):createBox()}getStaticValue(n){return this.latestValues[n]}setStaticValue(n,o){this.latestValues[n]=o}update(n,o){(n.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=n,this.prevPresenceContext=this.presenceContext,this.presenceContext=o;for(let s=0;s<propEventHandlers.length;s++){const c=propEventHandlers[s];this.propEventSubscriptions[c]&&(this.propEventSubscriptions[c](),delete this.propEventSubscriptions[c]);const d=n["on"+c];d&&(this.propEventSubscriptions[c]=this.on(c,d))}this.prevMotionValues=updateMotionValuesFromProps(this,this.scrapeMotionValuesFromProps(n,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(n){return this.props.variants?this.props.variants[n]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}getVariantContext(n=!1){if(n)return this.parent?this.parent.getVariantContext():void 0;if(!this.isControllingVariants){const s=this.parent?this.parent.getVariantContext()||{}:{};return this.props.initial!==void 0&&(s.initial=this.props.initial),s}const o={};for(let s=0;s<numVariantProps;s++){const c=variantProps[s],d=this.props[c];(isVariantLabel(d)||d===!1)&&(o[c]=d)}return o}addVariantChild(n){const o=this.getClosestVariantNode();if(o)return o.variantChildren&&o.variantChildren.add(n),()=>o.variantChildren.delete(n)}addValue(n,o){o!==this.values.get(n)&&(this.removeValue(n),this.bindToMotionValue(n,o)),this.values.set(n,o),this.latestValues[n]=o.get()}removeValue(n){this.values.delete(n);const o=this.valueSubscriptions.get(n);o&&(o(),this.valueSubscriptions.delete(n)),delete this.latestValues[n],this.removeValueFromRenderState(n,this.renderState)}hasValue(n){return this.values.has(n)}getValue(n,o){if(this.props.values&&this.props.values[n])return this.props.values[n];let s=this.values.get(n);return s===void 0&&o!==void 0&&(s=motionValue(o===null?void 0:o,{owner:this}),this.addValue(n,s)),s}readValue(n,o){var s;let c=this.latestValues[n]!==void 0||!this.current?this.latestValues[n]:(s=this.getBaseTargetFromProps(this.props,n))!==null&&s!==void 0?s:this.readValueFromInstance(this.current,n,this.options);return c!=null&&(typeof c=="string"&&(isNumericalString(c)||isZeroValueString(c))?c=parseFloat(c):!findValueType(c)&&complex.test(o)&&(c=getAnimatableNone(n,o)),this.setBaseTarget(n,isMotionValue(c)?c.get():c)),isMotionValue(c)?c.get():c}setBaseTarget(n,o){this.baseTarget[n]=o}getBaseTarget(n){var o,s;const{initial:c}=this.props,d=typeof c=="string"||typeof c=="object"?(s=resolveVariantFromProps(this.props,c,(o=this.presenceContext)===null||o===void 0?void 0:o.custom))===null||s===void 0?void 0:s[n]:void 0;if(c&&d!==void 0)return d;const h=this.getBaseTargetFromProps(this.props,n);return h!==void 0&&!isMotionValue(h)?h:this.initialValues[n]!==void 0&&d===void 0?void 0:this.baseTarget[n]}on(n,o){return this.events[n]||(this.events[n]=new SubscriptionManager),this.events[n].add(o)}notify(n,...o){this.events[n]&&this.events[n].notify(...o)}}class DOMVisualElement extends VisualElement{constructor(){super(...arguments),this.KeyframeResolver=DOMKeyframesResolver}sortInstanceNodePosition(n,o){return n.compareDocumentPosition(o)&2?1:-1}getBaseTargetFromProps(n,o){return n.style?n.style[o]:void 0}removeValueFromRenderState(n,{vars:o,style:s}){delete o[n],delete s[n]}}function getComputedStyle(t){return window.getComputedStyle(t)}class HTMLVisualElement extends DOMVisualElement{constructor(){super(...arguments),this.type="html"}readValueFromInstance(n,o){if(transformProps.has(o)){const s=getDefaultValueType(o);return s&&s.default||0}else{const s=getComputedStyle(n),c=(isCSSVariableName(o)?s.getPropertyValue(o):s[o])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(n,{transformPagePoint:o}){return measureViewportBox(n,o)}build(n,o,s,c){buildHTMLStyles(n,o,s,c.transformTemplate)}scrapeMotionValuesFromProps(n,o,s){return scrapeMotionValuesFromProps$1(n,o,s)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:n}=this.props;isMotionValue(n)&&(this.childSubscription=n.on("change",o=>{this.current&&(this.current.textContent=`${o}`)}))}renderInstance(n,o,s,c){renderHTML(n,o,s,c)}}class SVGVisualElement extends DOMVisualElement{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1}getBaseTargetFromProps(n,o){return n[o]}readValueFromInstance(n,o){if(transformProps.has(o)){const s=getDefaultValueType(o);return s&&s.default||0}return o=camelCaseAttributes.has(o)?o:camelToDash(o),n.getAttribute(o)}measureInstanceViewportBox(){return createBox()}scrapeMotionValuesFromProps(n,o){return scrapeMotionValuesFromProps(n,o,this)}build(n,o,s,c){buildSVGAttrs(n,o,s,this.isSVGTag,c.transformTemplate)}renderInstance(n,o,s,c){renderSVG(n,o,s,c)}mount(n){this.isSVGTag=isSVGTag(n.tagName),super.mount(n)}}const createDomVisualElement=(t,n)=>isSVGComponent(t)?new SVGVisualElement(n,{enableHardwareAcceleration:!1}):new HTMLVisualElement(n,{allowProjection:t!==React.Fragment,enableHardwareAcceleration:!0}),layout={layout:{ProjectionNode:HTMLProjectionNode,MeasureLayout}},preloadedFeatures={...animations,...gestureAnimations,...drag,...layout},motion=createMotionProxy((t,n)=>createDomMotionConfig(t,n,preloadedFeatures,createDomVisualElement));function useMotionValue(t){const n=useConstant(()=>motionValue(t)),{isStatic:o}=React.useContext(MotionConfigContext);if(o){const[,s]=React.useState(t);React.useEffect(()=>n.on("change",s),[])}return n}function assignRef(t,n){return typeof t=="function"?t(n):t&&(t.current=n),t}function useCallbackRef(t,n){var o=React.useState(function(){return{value:t,callback:n,facade:{get current(){return o.value},set current(s){var c=o.value;c!==s&&(o.value=s,o.callback(s,c))}}}})[0];return o.callback=n,o.facade}var useIsomorphicLayoutEffect=typeof window<"u"?React__namespace.useLayoutEffect:React__namespace.useEffect,currentValues=new WeakMap;function useMergeRefs(t,n){var o=useCallbackRef(null,function(s){return t.forEach(function(c){return assignRef(c,s)})});return useIsomorphicLayoutEffect(function(){var s=currentValues.get(o);if(s){var c=new Set(s),d=new Set(t),h=o.current;c.forEach(function(p){d.has(p)||assignRef(p,null)}),d.forEach(function(p){c.has(p)||assignRef(p,h)})}currentValues.set(o,t)},[t]),o}const occluder=new EllipsoidalOccluder(Ellipsoid$1.WGS84,Cartesian3.ZERO),ScreenSpaceElement=React.forwardRef(({position:t,children:n,...o},s)=>{const c=useConstant$2(()=>new Cartesian3);t==null||t.clone(c);const d=useMotionValue(""),h=useMotionValue("none"),{toWindowPosition:p,getCamera:y,toXYZ:S,isPositionVisible:P}=useContext(),L=React.useRef(null);usePreRender(()=>{if(L.current==null)return;let N;try{const se=p==null?void 0:p([c.x,c.y,c.z]);N=new Cartesian2(se==null?void 0:se[0],se==null?void 0:se[1])}catch{h.set("none");return}const z=y==null?void 0:y();if(!z)return;const W=S==null?void 0:S(z==null?void 0:z.lng,z==null?void 0:z.lat,z==null?void 0:z.height);if(!W)return;if(occluder.cameraPosition=new Cartesian3(W[0],W[1],W[2]),N==null||N.x<0||N.y<0||N.x>window.innerWidth||N.y>window.innerHeight||!(P!=null&&P([c.x,c.y,c.z]))){h.set("none");return}const nt=`calc(${N.x}px - 50%)`,Pe=`calc(${N.y}px - 50%)`;d.set(`translate(${nt}, ${Pe})`),h.set("block")});const F=useMergeRefs([L,s]);return jsxRuntimeExports.jsx(motion.div,{ref:F,...o,style:{...o.style,transform:d,display:h,position:"absolute",pointerEvents:"none",left:0,top:0},children:n})});ScreenSpaceElement.displayName="ScreenSpaceElement";const MeasurementLine$1=({a:t,b:n,color:o})=>{const s=React.useRef([t,n]);s.current=[t,n];const c=useConstant$2(()=>new CallbackProperty(()=>s.current,!1)),d=React.useMemo(()=>({polyline:{positions:c,width:1.5,material:new PolylineDashMaterialProperty({color:o,dashLength:8})}}),[o,c]);return jsxRuntimeExports.jsx(Entity,{...d})},ExtrudedMeasurement=({a:t,b:n,extrudedHeight:o,color:s,showLine:c})=>{const d=useConstant$2(()=>new Cartesian3);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ScreenSpaceElement,{position:Cartesian3.midpoint(t,n,d),children:jsxRuntimeExports.jsx(MeasurementText,{children:o<1e3?`${o.toFixed(1)} m`:`${(o/1e3).toFixed(1)} km`})}),c&&jsxRuntimeExports.jsx(MeasurementLine$1,{a:t,b:n,color:s})]})},ExtrudedControlPoints=React.memo(({geometryOptions:{controlPoints:t,type:n},extrudedHeight:o,color:s,isEditing:c,extrudedPoint:d,centroidBasePoint:h,centroidExtrudedPoint:p,catchedExtrudedPoint:y,handleControlPointMouseEvent:S})=>{const P=t[t.length-1],L=d?new Cartesian3(...d):void 0,F=h?new Cartesian3(...h):void 0,N=p?new Cartesian3(...p):void 0;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[L&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ControlPoint,{index:-1,position:L,isEditing:c,isExtrudedControlPoint:!0,handleControlPointMouseEvent:S}),(!c||y)&&jsxRuntimeExports.jsx(ExtrudedMeasurement,{a:P,b:L,extrudedHeight:o,color:c?Color$1.fromCssColorString(DEFAULT_EDIT_COLOR):s,showLine:n!=="extrudedPolygon"})]}),F&&jsxRuntimeExports.jsx(ControlPoint,{index:-1,position:F,isEditing:c,isExtrudedControlPoint:!0}),N&&jsxRuntimeExports.jsx(ControlPoint,{index:-1,position:N,isEditing:c,isExtrudedControlPoint:!0})]})});ExtrudedControlPoints.displayName="ExtrudedControlPoints";const ExtrudedPolygonEntity=({id:t,hierarchy:n,extrudedHeight:o,color:s,disableShadow:c=!1,isEditing:d})=>{const h=React.useRef(n);h.current=n;const y=useConstant$2(()=>new CallbackProperty(()=>h.current,!1)),S=React.useRef(o);S.current=o;const L=useConstant$2(()=>new CallbackProperty(()=>S.current,!1)),F=React.useMemo(()=>({polygon:{hierarchy:y,heightReference:HeightReference$1.RELATIVE_TO_TERRAIN,extrudedHeight:L,extrudedHeightReference:HeightReference$1.RELATIVE_TO_TERRAIN,fill:!0,outline:!0,outlineWidth:1,outlineColor:d?Color$1.fromCssColorString(DEFAULT_EDIT_COLOR):s==null?void 0:s.withAlpha(1),material:new ColorMaterialProperty(d?s==null?void 0:s.withAlpha(.2):s),classificationType:ClassificationType$1.TERRAIN,shadows:c?ShadowMode$1.DISABLED:ShadowMode$1.ENABLED}}),[L,c,y,s,d]),{requestRender:N}=useContext();return N==null||N(),jsxRuntimeExports.jsx(Entity,{id:t,...F})},PolygonEntity=({dynamic:t=!1,hierarchy:n,color:o})=>{const s=React.useRef(n);s.current=n;const c=useConstant$2(()=>new CallbackProperty(()=>s.current,!1)),d=t?c:n,h=React.useMemo(()=>({polygon:{hierarchy:d,fill:!0,material:o==null?void 0:o.withAlpha(.5),classificationType:ClassificationType$1.TERRAIN}}),[o,d]),{requestRender:p}=useContext();return p==null||p(),jsxRuntimeExports.jsx(Entity,{...h})},PolylineEntity=({dynamic:t=!1,positions:n,color:o,isEditing:s})=>{const c=React.useRef(n);c.current=n;const d=useConstant$2(()=>new CallbackProperty(()=>c.current,!t)),h=t?d:n,p=React.useMemo(()=>({polyline:{positions:h,width:1.5,material:s?Color$1.fromCssColorString(DEFAULT_EDIT_COLOR):o,classificationType:ClassificationType$1.TERRAIN,clampToGround:!0}}),[o,h,s]),{requestRender:y}=useContext();return y==null||y(),jsxRuntimeExports.jsx(Entity,{...p})},cartesianScratch1$1=new Cartesian3,SurfaceAddingPoints=React.memo(({geometryOptions:{type:t,controlPoints:n},isEditing:o,handleAddControlPoint:s})=>{if(!["polyline","polygon","extrudedPolygon"].includes(t))return null;const c=[];for(let d=0;d<n.length-1;d++){const h=n[d+1],p=Cartesian3.midpoint(n[d],h,cartesianScratch1$1);c.push(p.clone())}if(t==="polygon"||t==="extrudedPolygon"){const d=Cartesian3.midpoint(n[n.length-1],n[0],cartesianScratch1$1);c.push(d.clone())}return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:c.map((d,h)=>jsxRuntimeExports.jsx(ControlPoint,{position:d,isAddingPoint:!0,index:h,clampToGround:!0,isEditing:o,handleControlPointMouseEvent:()=>s==null?void 0:s([d.x,d.y,d.z],h)},h))})});SurfaceAddingPoints.displayName="SurfaceAddingPoints";const MeasurementLine=({a:t,b:n,color:o})=>{const s=React.useRef([t,n]);s.current=[t,n];const c=useConstant$2(()=>new CallbackProperty(()=>s.current,!1)),d=React.useMemo(()=>({polyline:{positions:c,width:1.5,material:new PolylineDashMaterialProperty({color:o,dashLength:8}),classificationType:ClassificationType$1.TERRAIN,clampToGround:!0}}),[o,c]),{requestRender:h}=useContext();return h==null||h(),jsxRuntimeExports.jsx(Entity,{...d})},SurfaceMeasurement=({a:t,b:n,color:o,showLine:s=!1})=>{const c=useConstant$2(()=>new Cartesian3),{getSurfaceDistance:d}=useContext(),h=d==null?void 0:d(t,n);return h!==void 0?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ScreenSpaceElement,{position:Cartesian3.midpoint(t,n,c),children:jsxRuntimeExports.jsx(MeasurementText,{children:h<1e3?`${h.toFixed(1)} m`:`${(h/1e3).toFixed(1)} km`})}),s&&jsxRuntimeExports.jsx(MeasurementLine,{a:t,b:n,color:o})]}):null},cartesianScratch1=new Cartesian3,SurfaceControlPoints=React.memo(({geometryOptions:{type:t,controlPoints:n},color:o,isEditing:s,catchedControlPointIndex:c,selectedControlPointIndex:d,handleControlPointMouseEvent:h})=>{const p=[];if(n.length>=2)if(s){if(c!==void 0&&c!==-1)switch(t){case"polyline":c>0&&p.push({points:[n[c-1],n[c]],showLine:!1}),c<n.length-1&&p.push({points:[n[c],n[c+1]],showLine:!1});break;case"circle":case"extrudedCircle":c!==2&&p.push({points:[n[0],n[1]],showLine:!0});break;case"rectangle":case"extrudedRectangle":if(c<=1)p.push({points:[n[0],n[1]],showLine:!1});else if(c===2){const[y,S,P]=n,L=Cartesian3.midpoint(y,S,cartesianScratch1);p.push({points:[L,P],showLine:!0})}break;case"polygon":case"extrudedPolygon":p.push({points:[n[c],c===0?n[n.length-1]:n[c-1]],showLine:!1}),p.push({points:[n[c],c===n.length-1?n[0]:n[c+1]],showLine:!1});break}}else switch(t){case"rectangle":if(n.length===2)p.push({points:n,showLine:!0});else if(n.length===3){const[y,S,P]=n,L=Cartesian3.midpoint(y,S,cartesianScratch1);p.push({points:[L,P],showLine:!0})}break;default:p.push({points:n.slice(-2),showLine:t==="circle"});break}return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[n.map((y,S)=>jsxRuntimeExports.jsx(ControlPoint,{position:y,index:S,isSelected:d===S,clampToGround:!0,isEditing:s,handleControlPointMouseEvent:h},S)),p.map(({points:y,showLine:S},P)=>jsxRuntimeExports.jsx(SurfaceMeasurement,{a:y[0],b:y[1],color:s?Color$1.fromCssColorString(DEFAULT_EDIT_COLOR):o,showLine:S},P))]})});SurfaceControlPoints.displayName="SurfaceControlPoints";const SketchComponent=React.memo(({geometryOptions:t,extrudedHeight:n,disableShadow:o,color:s,isEditing:c,extrudedPoint:d,centroidBasePoint:h,centroidExtrudedPoint:p,catchedControlPointIndex:y,catchedExtrudedPoint:S,selectedControlPointIndex:P,handleControlPointMouseEvent:L,handleAddControlPoint:F})=>{const N=React.useMemo(()=>t?{...t,controlPoints:t==null?void 0:t.controlPoints.map(se=>new Cesium$1.Cartesian3(...se))}:null,[t]),z=React.useMemo(()=>N?createGeometry(N):null,[N]),{positionsArray:W,hierarchyArray:nt}=React.useMemo(()=>(z==null?void 0:z.type)==="Point"?{}:(z==null?void 0:z.type)==="LineString"?{positionsArray:convertGeometryToPositionsArray(z)}:z!=null?{positionsArray:convertGeometryToPositionsArray(z),hierarchyArray:convertPolygonToHierarchyArray(z)}:{},[z]),Pe=React.useMemo(()=>Color$1.fromCssColorString(s??DEFAULT_SKETCH_COLOR),[s]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[W==null?void 0:W.map((se,mt)=>jsxRuntimeExports.jsx(PolylineEntity,{dynamic:!0,positions:se,color:Pe,isEditing:c},mt)),nt==null?void 0:nt.map((se,mt)=>jsxRuntimeExports.jsx(PolygonEntity,{dynamic:!0,hierarchy:se,color:Pe},mt)),N!=null&&(!n||c)&&jsxRuntimeExports.jsx(SurfaceControlPoints,{geometryOptions:N,color:Pe,isEditing:c,catchedControlPointIndex:y,selectedControlPointIndex:P,handleControlPointMouseEvent:L}),N!=null&&c&&jsxRuntimeExports.jsx(SurfaceAddingPoints,{geometryOptions:N,isEditing:c,handleAddControlPoint:F}),N!=null&&n&&jsxRuntimeExports.jsx(ExtrudedControlPoints,{geometryOptions:N,extrudedHeight:n,extrudedPoint:d,centroidBasePoint:h,centroidExtrudedPoint:p,catchedExtrudedPoint:S,color:Pe,isEditing:c,handleControlPointMouseEvent:L}),n&&(nt==null?void 0:nt.map((se,mt)=>jsxRuntimeExports.jsx(ExtrudedPolygonEntity,{hierarchy:se,extrudedHeight:n,disableShadow:o,color:Pe,isEditing:c},mt)))]})});SketchComponent.displayName="SketchComponent";const Cesium=({className:t,style:n,property:o,time:s,camera:c,small:d,ready:h,children:p,selectedLayerId:y,isLayerDraggable:S,isLayerDragging:P,shouldRender:L,layerSelectionReason:F,meta:N,displayCredits:z,layersRef:W,featureFlags:nt,requestingRenderMode:Pe,timelineManagerRef:se,cameraForceHorizontalRoll:mt,onLayerSelect:kt,onCameraChange:mn,onLayerDrag:_i,onLayerDrop:zi,onLayerEdit:Sa,onLayerSelectWithRectStart:fa,onLayerSelectWithRectMove:La,onLayerSelectWithRectEnd:Ra,onMount:ma,onLayerVisibility:yt,onLayerLoad:lt,onCreditsUpdate:pi},ba)=>{var gd,pd,Zd,cf,sf,nf,df,Cf,mf,Sf,Pf,Af,Hf,_f,wf,Yf,Nf,vf,Ff,Xf,Wf,Qf,_m,Bf,$m,qf,qm,ep,Tf,rf,bf,If,Uf,jf,jm,sp,cp,fp,mp,al,tf,lf;const{cesium:Sc,mouseEventHandles:ms,cesiumIonAccessToken:Xs,context:Nl,layerSelectWithRectEventHandlers:pu,sceneLight:yu,sceneBackgroundColor:Ru,sceneMsaaSamples:Vd,sceneMode:Gd,cameraViewBoundaries:uf,cameraViewOuterBoundaries:ff,cameraViewBoundariesMaterial:pf,handleCameraChange:hf,handleCameraMoveEnd:of,handleUpdate:gf,handleClick:Ef,handleMount:xf,handleUnmount:Wa,handleTilesChange:af,handleTerrainProviderChange:Xd}=useHooks$1({ref:ba,property:o,time:s,selectedLayerId:y,selectionReason:F,meta:N,layersRef:W,featureFlags:nt,timelineManagerRef:se,isLayerDraggable:S,isLayerDragging:P,shouldRender:L,requestingRenderMode:Pe,camera:c,cameraForceHorizontalRoll:mt,onLayerDrag:_i,onLayerDrop:zi,onLayerSelect:kt,onLayerEdit:Sa,onLayerSelectWithRectStart:fa,onLayerSelectWithRectMove:La,onLayerSelectWithRectEnd:Ra,onLayerVisibility:yt,onLayerLoad:lt,onCameraChange:mn,onMount:ma,onCreditsUpdate:pi});return jsxRuntimeExports.jsxs(Aa$1,{ref:Sc,onUpdate:gf,className:t,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:z?void 0:creditContainer,style:{width:d?"300px":"auto",height:d?"300px":"100%",display:h?void 0:"none",cursor:P?"grab":void 0,...n},shadows:!!((pd=(gd=o==null?void 0:o.scene)==null?void 0:gd.shadow)!=null&&pd.enabled),onClick:Ef,onDoubleClick:ms.doubleClick,onMouseDown:ms.mouseDown,onMouseUp:ms.mouseUp,onRightClick:ms.rightClick,onRightDown:ms.rightDown,onRightUp:ms.rightUp,onMiddleClick:ms.middleClick,onMiddleDown:ms.middleDown,onMiddleUp:ms.middleUp,onMouseMove:ms.mouseMove,onMouseEnter:ms.mouseEnter,onMouseLeave:ms.mouseLeave,onWheel:ms.wheel,children:[jsxRuntimeExports.jsx(Event,{onMount:xf,onUnmount:Wa}),jsxRuntimeExports.jsx(ReearthClock,{timelineManagerRef:se}),jsxRuntimeExports.jsx(ImageryLayers,{tiles:o==null?void 0:o.tiles,cesiumIonAccessToken:Xs,onTilesChange:af}),jsxRuntimeExports.jsx(LabelImageryLayers,{tileLabels:o==null?void 0:o.tileLabels}),jsxRuntimeExports.jsx(Indicator,{property:o,timelineManagerRef:se}),jsxRuntimeExports.jsxs(ka$1,{useDefault:!0,children:[jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_CLICK}),jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_DOUBLE_CLICK})]}),jsxRuntimeExports.jsxs(ka$1,{children:[jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_DOWN,action:pu.start.handler}),jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_DOWN,modifier:Cesium$1.KeyboardEventModifier.SHIFT,action:pu.start.shift}),jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.MOUSE_MOVE,action:pu.move.handler}),jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.MOUSE_MOVE,modifier:Cesium$1.KeyboardEventModifier.SHIFT,action:pu.move.shift}),jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_UP,action:pu.end.handler}),jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_UP,modifier:Cesium$1.KeyboardEventModifier.SHIFT,action:pu.end.shift})]}),jsxRuntimeExports.jsx(Ta$1,{maximumZoomDistance:(cf=(Zd=o==null?void 0:o.camera)==null?void 0:Zd.limiter)!=null&&cf.enabled?((df=(nf=(sf=o.camera)==null?void 0:sf.limiter)==null?void 0:nf.targetArea)==null?void 0:df.height)??Number.POSITIVE_INFINITY:Number.POSITIVE_INFINITY,enableCollisionDetection:!((Cf=o==null?void 0:o.camera)!=null&&Cf.allowEnterGround)}),jsxRuntimeExports.jsx(Ps$1,{percentageChanged:.2,onChange:hf,onMoveEnd:of}),uf&&((Sf=(mf=o==null?void 0:o.camera)==null?void 0:mf.limiter)==null?void 0:Sf.showHelper)&&jsxRuntimeExports.jsx(Is$1,{children:jsxRuntimeExports.jsx(ua$1,{positions:uf,width:1,material:Cesium$1.Color.RED,arcType:Cesium$1.ArcType.RHUMB})}),ff&&((Af=(Pf=o==null?void 0:o.camera)==null?void 0:Pf.limiter)==null?void 0:Af.showHelper)&&jsxRuntimeExports.jsx(Is$1,{children:jsxRuntimeExports.jsx(ua$1,{positions:ff,width:1,material:pf,arcType:Cesium$1.ArcType.RHUMB})}),jsxRuntimeExports.jsx($a$1,{backgroundColor:Ru,light:yu,mode:Gd,msaaSamples:Vd,useDepthPicking:!1,useWebVR:!!((Hf=o==null?void 0:o.scene)!=null&&Hf.vr)||void 0,debugShowFramesPerSecond:!!((_f=o==null?void 0:o.debug)!=null&&_f.showFramesPerSecond),verticalExaggerationRelativeHeight:(wf=o==null?void 0:o.scene)==null?void 0:wf.verticalExaggerationRelativeHeight,verticalExaggeration:(Yf=o==null?void 0:o.scene)==null?void 0:Yf.verticalExaggeration}),jsxRuntimeExports.jsx(Oa$1,{show:((vf=(Nf=o==null?void 0:o.sky)==null?void 0:Nf.skyBox)==null?void 0:vf.show)??!0}),jsxRuntimeExports.jsx(Vs,{enabled:((Xf=(Ff=o==null?void 0:o.sky)==null?void 0:Ff.fog)==null?void 0:Xf.enabled)??!0,density:(Qf=(Wf=o==null?void 0:o.sky)==null?void 0:Wf.fog)==null?void 0:Qf.density}),jsxRuntimeExports.jsx(Ga$1,{show:((Bf=(_m=o==null?void 0:o.sky)==null?void 0:_m.sun)==null?void 0:Bf.show)??!0}),jsxRuntimeExports.jsx(ea,{show:((qf=($m=o==null?void 0:o.sky)==null?void 0:$m.moon)==null?void 0:qf.show)??!0}),jsxRuntimeExports.jsx(_a$2,{show:((ep=(qm=o==null?void 0:o.sky)==null?void 0:qm.skyAtmosphere)==null?void 0:ep.show)??!0,atmosphereLightIntensity:(rf=(Tf=o==null?void 0:o.sky)==null?void 0:Tf.skyAtmosphere)==null?void 0:rf.lightIntensity,saturationShift:(If=(bf=o==null?void 0:o.sky)==null?void 0:bf.skyAtmosphere)==null?void 0:If.saturationShift,brightnessShift:(jf=(Uf=o==null?void 0:o.sky)==null?void 0:Uf.skyAtmosphere)==null?void 0:jf.brightnessShift}),jsxRuntimeExports.jsx(Globe,{property:o,cesiumIonAccessToken:Xs,onTerrainProviderChange:Xd}),jsxRuntimeExports.jsx(context.Provider,{value:Nl,children:h?p:null}),jsxRuntimeExports.jsx(AmbientOcclusion,{...AMBIENT_OCCLUSION_QUALITY[((sp=(jm=o==null?void 0:o.render)==null?void 0:jm.ambientOcclusion)==null?void 0:sp.quality)||"low"],enabled:!!((fp=(cp=o==null?void 0:o.render)==null?void 0:cp.ambientOcclusion)!=null&&fp.enabled),intensity:((al=(mp=o==null?void 0:o.render)==null?void 0:mp.ambientOcclusion)==null?void 0:al.intensity)??100,outputType:(lf=(tf=o==null?void 0:o.render)==null?void 0:tf.ambientOcclusion)!=null&&lf.ambientOcclusionOnly?AmbientOcclusionOutputType.Occlusion:null})]})},creditContainer=document.createElement("div"),Component=React.forwardRef(Cesium),engine={component:Component,featureComponent:Feature$1,clusterComponent:Cluster,sketchComponent:SketchComponent,delegatedDataTypes:["czml","wms","mvt","3dtiles","osm-buildings","kml"]},engines={cesium:engine};function Error$1({error:t,resetErrorBoundary:n}){return jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h1",{children:"Oops! An Error Occurred"}),jsxRuntimeExports.jsx("p",{children:t.message}),jsxRuntimeExports.jsx("p",{children:jsxRuntimeExports.jsx("button",{style:{color:"#fff"},onClick:n,children:"Retry"})})]})}const version$1="0.0.7-alpha.37",useCoreAPI=({viewerProperty:t})=>{const n=React.useRef(t);n.current=t;const o=React.useMemo(()=>({get version(){return version$1},get viewerProperty(){return n.current}}),[]);React.useEffect(()=>{window.reearth_core=o},[o])},viewportMobileMaxWidth=768,useViewport=({wrapperRef:t})=>{const n=React.useMemo(()=>paramsToObject(new URLSearchParams(window.location.search)),[]),[o,s]=React.useState({width:void 0,height:void 0,isMobile:void 0,query:n});return React.useEffect(()=>{const c=new ResizeObserver(d=>{var S,P;const[h]=d;let p,y;if(h.contentBoxSize){const L=Array.isArray(h.contentBoxSize)?h.contentBoxSize[0]:h.contentBoxSize;p=L.inlineSize,y=L.blockSize}else h.contentRect?(p=h.contentRect.width,y=h.contentRect.height):(p=(S=t.current)==null?void 0:S.clientWidth,y=(P=t.current)==null?void 0:P.clientHeight);s(L=>({width:p,height:y,isMobile:p?p<=viewportMobileMaxWidth:void 0,query:L.query}))});return t.current&&c.observe(t.current),()=>{c.disconnect()}},[t]),o};function paramsToObject(t){const n={};for(const[o,s]of t)n[o]=s;return n}function useHooks({camera:t,interactionMode:n,zoomedLayerId:o,viewerProperty:s,onLayerSelect:c,onCameraChange:d,onInteractionModeChange:h,onZoomToLayer:p,onLayerDrop:y,onSketchTypeChangeProp:S},P){const L=React.useRef(null);React.useImperativeHandle(P,()=>L.current,[]);const F=React.useRef(null),N=useViewport({wrapperRef:F}),[z,W]=React.useState({}),[nt,Pe]=React.useState(),[se,mt]=React.useState(),kt=React.useCallback(async(_f,wf,Yf,Nf,vf)=>{var Qf,_m,Bf,$m,qf,qm,ep,Tf,rf,bf,If;const Ff=((Qf=z.layer)==null?void 0:Qf.layer.type)==="simple"&&(($m=(Bf=(_m=z.layer)==null?void 0:_m.layer)==null?void 0:Bf.data)==null?void 0:$m.isSketchLayer);if(z.layerId===_f&&z.featureId===wf&&!Ff)return;const Xf=await(Yf==null?void 0:Yf()),Wf=_f&&wf?(Ff?(qf=Xf==null?void 0:Xf.features)==null?void 0:qf.find(Uf=>Uf.id===wf):(Tf=(qm=L.current)==null?void 0:(ep=qm.engine).findComputedFeatureById)==null?void 0:Tf.call(ep,_f,wf))??(vf==null?void 0:vf.feature):void 0;Pe(_f&&wf?(If=(rf=L.current)==null?void 0:(bf=rf.engine).findFeatureById)==null?void 0:If.call(bf,_f,wf):void 0),mt(Wf),W(Uf=>Uf.layerId===_f&&Uf.featureId===wf?Uf:{layerId:_f,featureId:wf,layer:Xf,reason:Nf}),c==null||c(_f,Yf,Wf,Nf)},[z,c]),mn=React.useRef(),[_i,zi]=useValue(t,d),[Sa,fa]=React.useState(!1),La=React.useCallback(_f=>{fa(!!_f)},[]),[Ra,ma]=useValue(n||"default",h);React.useEffect(()=>{var _f,wf;Ra==="default"&&((wf=(_f=L==null?void 0:L.current)==null?void 0:_f.engine)==null||wf.setCursor("auto"))},[Ra]);const yt=INTERACTION_MODES[Ra??"default"],lt=React.useRef(),pi=React.useCallback(_f=>{lt.current=_f},[]),ba=React.useCallback(_f=>{var wf;(wf=lt.current)==null||wf.call(lt,_f)},[]),Sc=React.useRef(),ms=React.useCallback(_f=>{Sc.current=_f},[]),Xs=React.useCallback(_f=>{var wf;(wf=Sc.current)==null||wf.call(Sc,_f)},[]),Nl=React.useRef(),pu=React.useCallback(_f=>{Nl.current=_f},[]),yu=React.useCallback(_f=>{var wf;(wf=Nl.current)==null||wf.call(Nl,_f)},[]),Ru=React.useRef(),Vd=React.useCallback(_f=>{Ru.current=_f},[]),Gd=React.useCallback(_f=>{var wf;(wf=Ru.current)==null||wf.call(Ru,_f)},[]),uf=React.useRef(),ff=React.useCallback(_f=>{uf.current=_f},[]),pf=React.useCallback(_f=>{var wf;(wf=uf.current)==null||wf.call(uf,_f)},[]),hf=React.useRef(),of=React.useCallback(_f=>{hf.current=_f},[]),gf=React.useCallback(_f=>{var wf;(wf=hf.current)==null||wf.call(hf,_f)},[]),Ef=React.useRef([]),xf=React.useCallback(_f=>{Ef.current.push(_f)},[]),Wa=React.useCallback(_f=>{Ef.current.forEach(wf=>wf(_f))},[]),af=React.useRef([]),Xd=React.useCallback(_f=>{af.current.push(_f)},[]),gd=React.useCallback(_f=>{af.current.forEach(wf=>wf(_f))},[]),pd=React.useRef([]),Zd=React.useCallback(_f=>{pd.current.push(_f)},[]),cf=React.useCallback(_f=>{pd.current.forEach(wf=>wf(_f))},[]),sf=React.useRef([]),nf=React.useCallback(_f=>{sf.current.push(_f)},[]),df=React.useCallback((_f,wf)=>{sf.current.forEach(Yf=>Yf(_f)),S==null||S(_f,wf)},[S]);React.useEffect(()=>{var _f,wf;o&&((wf=(_f=L.current)==null?void 0:_f.engine)==null||wf.lookAtLayer(o),p==null||p(void 0))},[o,p]);const[Cf,mf]=React.useState(!1),Sf=React.useCallback(()=>{mf(!0)},[]),Pf=React.useCallback((_f,wf,Yf)=>{var Ff;mf(!1);const Nf=(Ff=L.current)==null?void 0:Ff.layers.findById(_f),vf=Nf!=null&&Nf.property.default.location?"default.location":Nf!=null&&Nf.property.default.position?"default.position":void 0;Yf&&Nf&&Nf.propertyId&&vf&&(y==null||y(Nf.propertyId,vf,Yf))},[y,L]),Af=React.useMemo(()=>({interactionMode:Ra,selectedLayer:z,selectedComputedFeature:se,viewport:N,handleCameraForceHorizontalRollChange:La,handleInteractionModeChange:ma,onSketchPluginFeatureCreate:xf,onSketchPluginFeatureUpdate:Xd,onSketchPluginFeatureDelete:Zd,onSketchTypeChange:nf,onLayerVisibility:ms,onLayerLoad:pu,onLayerEdit:pi,onLayerSelectWithRectStart:Vd,onLayerSelectWithRectMove:ff,onLayerSelectWithRectEnd:of}),[Ra,z,se,N,ma,La,pi,xf,Xd,Zd,nf,ms,pu,Vd,ff,of]),Hf=React.useMemo(()=>({position:"relative",width:"100%",height:"100%",overflow:"hidden"}),[]);return useCoreAPI({viewerProperty:s}),{mapRef:L,wrapperRef:F,selectedFeature:nt,camera:_i,featureFlags:yt,isLayerDragging:Cf,timelineManagerRef:mn,cameraForceHorizontalRoll:Sa,coreContextValue:Af,containerStyle:Hf,overriddenInteractionMode:Ra,handleLayerSelect:kt,handleLayerDrag:Sf,handleLayerDrop:Pf,handleLayerEdit:ba,handleCameraChange:zi,handleInteractionModeChange:ma,handleSketchPluginFeatureCreate:Wa,handleSketchPluginFeatureUpdate:gd,handleSketchPluginFeatureDelete:cf,handleSketchTypeChange:df,handleLayerVisibility:Xs,handleLayerLoad:yu,handleLayerSelectWithRectStart:Gd,handleLayerSelectWithRectMove:pf,handleLayerSelectWithRectEnd:gf}}function useValue(t,n){const[o,s]=React.useState(t),c=React.useCallback(d=>{d&&(s(d),n==null||n(d))},[n]);return React.useEffect(()=>{s(t)},[t]),[o,c]}const CoreVisualizer=React.memo(React.forwardRef(({engine:t,isBuilt:n,isEditable:o,viewerProperty:s,layers:c,clusters:d,small:h,ready:p,hiddenLayers:y,camera:S,time:P,interactionMode:L,shouldRender:F,meta:N,displayCredits:z=!0,style:W,zoomedLayerId:nt,children:Pe,onLayerDrop:se,onLayerSelect:mt,onCameraChange:kt,onZoomToLayer:mn,onInteractionModeChange:_i,onMount:zi,onSketchTypeChangeProp:Sa,onSketchFeatureCreate:fa,onSketchFeatureUpdate:La,onSketchFeatureDelete:Ra,onAPIReady:ma,onCreditsUpdate:yt},lt)=>{const{mapRef:pi,wrapperRef:ba,selectedFeature:Sc,camera:ms,featureFlags:Xs,isLayerDragging:Nl,timelineManagerRef:pu,cameraForceHorizontalRoll:yu,coreContextValue:Ru,containerStyle:Vd,overriddenInteractionMode:Gd,handleLayerSelect:uf,handleLayerDrag:ff,handleLayerDrop:pf,handleLayerEdit:hf,handleCameraChange:of,handleInteractionModeChange:gf,handleSketchPluginFeatureCreate:Ef,handleSketchPluginFeatureUpdate:xf,handleSketchPluginFeatureDelete:Wa,handleSketchTypeChange:af,handleLayerVisibility:Xd,handleLayerLoad:gd,handleLayerSelectWithRectStart:pd,handleLayerSelectWithRectMove:Zd,handleLayerSelectWithRectEnd:cf}=useHooks({camera:S,interactionMode:L,zoomedLayerId:nt,viewerProperty:s,onLayerSelect:mt,onCameraChange:kt,onZoomToLayer:mn,onLayerDrop:se,onInteractionModeChange:_i,onSketchTypeChangeProp:Sa},lt);return jsxRuntimeExports.jsx(ErrorBoundary,{FallbackComponent:Error$1,children:jsxRuntimeExports.jsx(VisualizerProvider,{mapRef:pi,children:jsxRuntimeExports.jsxs("div",{ref:ba,style:Vd,children:[jsxRuntimeExports.jsx(Map$1,{ref:pi,isBuilt:n,isEditable:o,engine:t,layers:c,engines,camera:ms,cameraForceHorizontalRoll:yu,clusters:d,hiddenLayers:y,isLayerDragging:Nl,isLayerDraggable:o,meta:N,displayCredits:z,style:W,featureFlags:Xs,shouldRender:F,property:s,time:P,small:h,ready:p,timelineManagerRef:pu,interactionMode:Gd,selectedFeature:Sc,onCameraChange:of,onLayerDrag:ff,onLayerDrop:pf,onLayerSelect:uf,onLayerEdit:hf,overrideInteractionMode:gf,onSketchFeatureCreate:fa,onSketchPluginFeatureCreate:Ef,onSketchFeatureUpdate:La,onSketchPluginFeatureUpdate:xf,onSketchFeatureDelete:Ra,onSketchPluginFeatureDelete:Wa,onSketchTypeChange:af,onMount:zi,onLayerVisibility:Xd,onLayerLoad:gd,onLayerSelectWithRectStart:pd,onLayerSelectWithRectMove:Zd,onLayerSelectWithRectEnd:cf,onAPIReady:ma,onCreditsUpdate:yt}),jsxRuntimeExports.jsx(coreContext.Provider,{value:Ru,children:Pe})]})})})}));var global$1=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},lookup=[],revLookup=[],Arr=typeof Uint8Array<"u"?Uint8Array:Array,inited=!1;function init(){inited=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=0,o=t.length;n<o;++n)lookup[n]=t[n],revLookup[t.charCodeAt(n)]=n;revLookup[45]=62,revLookup[95]=63}function toByteArray(t){inited||init();var n,o,s,c,d,h,p=t.length;if(p%4>0)throw new Error("Invalid string. Length must be a multiple of 4");d=t[p-2]==="="?2:t[p-1]==="="?1:0,h=new Arr(p*3/4-d),s=d>0?p-4:p;var y=0;for(n=0,o=0;n<s;n+=4,o+=3)c=revLookup[t.charCodeAt(n)]<<18|revLookup[t.charCodeAt(n+1)]<<12|revLookup[t.charCodeAt(n+2)]<<6|revLookup[t.charCodeAt(n+3)],h[y++]=c>>16&255,h[y++]=c>>8&255,h[y++]=c&255;return d===2?(c=revLookup[t.charCodeAt(n)]<<2|revLookup[t.charCodeAt(n+1)]>>4,h[y++]=c&255):d===1&&(c=revLookup[t.charCodeAt(n)]<<10|revLookup[t.charCodeAt(n+1)]<<4|revLookup[t.charCodeAt(n+2)]>>2,h[y++]=c>>8&255,h[y++]=c&255),h}function tripletToBase64(t){return lookup[t>>18&63]+lookup[t>>12&63]+lookup[t>>6&63]+lookup[t&63]}function encodeChunk(t,n,o){for(var s,c=[],d=n;d<o;d+=3)s=(t[d]<<16)+(t[d+1]<<8)+t[d+2],c.push(tripletToBase64(s));return c.join("")}function fromByteArray(t){inited||init();for(var n,o=t.length,s=o%3,c="",d=[],h=16383,p=0,y=o-s;p<y;p+=h)d.push(encodeChunk(t,p,p+h>y?y:p+h));return s===1?(n=t[o-1],c+=lookup[n>>2],c+=lookup[n<<4&63],c+="=="):s===2&&(n=(t[o-2]<<8)+t[o-1],c+=lookup[n>>10],c+=lookup[n>>4&63],c+=lookup[n<<2&63],c+="="),d.push(c),d.join("")}function read(t,n,o,s,c){var d,h,p=c*8-s-1,y=(1<<p)-1,S=y>>1,P=-7,L=o?c-1:0,F=o?-1:1,N=t[n+L];for(L+=F,d=N&(1<<-P)-1,N>>=-P,P+=p;P>0;d=d*256+t[n+L],L+=F,P-=8);for(h=d&(1<<-P)-1,d>>=-P,P+=s;P>0;h=h*256+t[n+L],L+=F,P-=8);if(d===0)d=1-S;else{if(d===y)return h?NaN:(N?-1:1)*(1/0);h=h+Math.pow(2,s),d=d-S}return(N?-1:1)*h*Math.pow(2,d-s)}function write(t,n,o,s,c,d){var h,p,y,S=d*8-c-1,P=(1<<S)-1,L=P>>1,F=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,N=s?0:d-1,z=s?1:-1,W=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(p=isNaN(n)?1:0,h=P):(h=Math.floor(Math.log(n)/Math.LN2),n*(y=Math.pow(2,-h))<1&&(h--,y*=2),h+L>=1?n+=F/y:n+=F*Math.pow(2,1-L),n*y>=2&&(h++,y/=2),h+L>=P?(p=0,h=P):h+L>=1?(p=(n*y-1)*Math.pow(2,c),h=h+L):(p=n*Math.pow(2,L-1)*Math.pow(2,c),h=0));c>=8;t[o+N]=p&255,N+=z,p/=256,c-=8);for(h=h<<c|p,S+=c;S>0;t[o+N]=h&255,N+=z,h/=256,S-=8);t[o+N-z]|=W*128}var toString={}.toString,isArray$1=Array.isArray||function(t){return toString.call(t)=="[object Array]"},INSPECT_MAX_BYTES=50;Buffer$1.TYPED_ARRAY_SUPPORT=global$1.TYPED_ARRAY_SUPPORT!==void 0?global$1.TYPED_ARRAY_SUPPORT:!0,kMaxLength();function kMaxLength(){return Buffer$1.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function createBuffer(t,n){if(kMaxLength()<n)throw new RangeError("Invalid typed array length");return Buffer$1.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(n),t.__proto__=Buffer$1.prototype):(t===null&&(t=new Buffer$1(n)),t.length=n),t}function Buffer$1(t,n,o){if(!Buffer$1.TYPED_ARRAY_SUPPORT&&!(this instanceof Buffer$1))return new Buffer$1(t,n,o);if(typeof t=="number"){if(typeof n=="string")throw new Error("If encoding is specified then the first argument must be a string");return allocUnsafe(this,t)}return from(this,t,n,o)}Buffer$1.poolSize=8192,Buffer$1._augment=function(t){return t.__proto__=Buffer$1.prototype,t};function from(t,n,o,s){if(typeof n=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&n instanceof ArrayBuffer?fromArrayBuffer(t,n,o,s):typeof n=="string"?fromString(t,n,o):fromObject(t,n)}Buffer$1.from=function(t,n,o){return from(null,t,n,o)},Buffer$1.TYPED_ARRAY_SUPPORT&&(Buffer$1.prototype.__proto__=Uint8Array.prototype,Buffer$1.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&Buffer$1[Symbol.species]);function assertSize(t){if(typeof t!="number")throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function alloc(t,n,o,s){return assertSize(n),n<=0?createBuffer(t,n):o!==void 0?typeof s=="string"?createBuffer(t,n).fill(o,s):createBuffer(t,n).fill(o):createBuffer(t,n)}Buffer$1.alloc=function(t,n,o){return alloc(null,t,n,o)};function allocUnsafe(t,n){if(assertSize(n),t=createBuffer(t,n<0?0:checked(n)|0),!Buffer$1.TYPED_ARRAY_SUPPORT)for(var o=0;o<n;++o)t[o]=0;return t}Buffer$1.allocUnsafe=function(t){return allocUnsafe(null,t)},Buffer$1.allocUnsafeSlow=function(t){return allocUnsafe(null,t)};function fromString(t,n,o){if((typeof o!="string"||o==="")&&(o="utf8"),!Buffer$1.isEncoding(o))throw new TypeError('"encoding" must be a valid string encoding');var s=byteLength(n,o)|0;t=createBuffer(t,s);var c=t.write(n,o);return c!==s&&(t=t.slice(0,c)),t}function fromArrayLike(t,n){var o=n.length<0?0:checked(n.length)|0;t=createBuffer(t,o);for(var s=0;s<o;s+=1)t[s]=n[s]&255;return t}function fromArrayBuffer(t,n,o,s){if(n.byteLength,o<0||n.byteLength<o)throw new RangeError("'offset' is out of bounds");if(n.byteLength<o+(s||0))throw new RangeError("'length' is out of bounds");return o===void 0&&s===void 0?n=new Uint8Array(n):s===void 0?n=new Uint8Array(n,o):n=new Uint8Array(n,o,s),Buffer$1.TYPED_ARRAY_SUPPORT?(t=n,t.__proto__=Buffer$1.prototype):t=fromArrayLike(t,n),t}function fromObject(t,n){if(internalIsBuffer(n)){var o=checked(n.length)|0;return t=createBuffer(t,o),t.length===0||n.copy(t,0,0,o),t}if(n){if(typeof ArrayBuffer<"u"&&n.buffer instanceof ArrayBuffer||"length"in n)return typeof n.length!="number"||isnan(n.length)?createBuffer(t,0):fromArrayLike(t,n);if(n.type==="Buffer"&&isArray$1(n.data))return fromArrayLike(t,n.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function checked(t){if(t>=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return t|0}Buffer$1.isBuffer=isBuffer;function internalIsBuffer(t){return!!(t!=null&&t._isBuffer)}Buffer$1.compare=function t(n,o){if(!internalIsBuffer(n)||!internalIsBuffer(o))throw new TypeError("Arguments must be Buffers");if(n===o)return 0;for(var s=n.length,c=o.length,d=0,h=Math.min(s,c);d<h;++d)if(n[d]!==o[d]){s=n[d],c=o[d];break}return s<c?-1:c<s?1:0},Buffer$1.isEncoding=function t(n){switch(String(n).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}},Buffer$1.concat=function t(n,o){if(!isArray$1(n))throw new TypeError('"list" argument must be an Array of Buffers');if(n.length===0)return Buffer$1.alloc(0);var s;if(o===void 0)for(o=0,s=0;s<n.length;++s)o+=n[s].length;var c=Buffer$1.allocUnsafe(o),d=0;for(s=0;s<n.length;++s){var h=n[s];if(!internalIsBuffer(h))throw new TypeError('"list" argument must be an Array of Buffers');h.copy(c,d),d+=h.length}return c};function byteLength(t,n){if(internalIsBuffer(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var o=t.length;if(o===0)return 0;for(var s=!1;;)switch(n){case"ascii":case"latin1":case"binary":return o;case"utf8":case"utf-8":case void 0:return utf8ToBytes(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return o*2;case"hex":return o>>>1;case"base64":return base64ToBytes(t).length;default:if(s)return utf8ToBytes(t).length;n=(""+n).toLowerCase(),s=!0}}Buffer$1.byteLength=byteLength;function slowToString(t,n,o){var s=!1;if((n===void 0||n<0)&&(n=0),n>this.length||((o===void 0||o>this.length)&&(o=this.length),o<=0)||(o>>>=0,n>>>=0,o<=n))return"";for(t||(t="utf8");;)switch(t){case"hex":return hexSlice(this,n,o);case"utf8":case"utf-8":return utf8Slice(this,n,o);case"ascii":return asciiSlice(this,n,o);case"latin1":case"binary":return latin1Slice(this,n,o);case"base64":return base64Slice(this,n,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,n,o);default:if(s)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),s=!0}}Buffer$1.prototype._isBuffer=!0;function swap(t,n,o){var s=t[n];t[n]=t[o],t[o]=s}Buffer$1.prototype.swap16=function t(){var n=this.length;if(n%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var o=0;o<n;o+=2)swap(this,o,o+1);return this},Buffer$1.prototype.swap32=function t(){var n=this.length;if(n%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var o=0;o<n;o+=4)swap(this,o,o+3),swap(this,o+1,o+2);return this},Buffer$1.prototype.swap64=function t(){var n=this.length;if(n%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var o=0;o<n;o+=8)swap(this,o,o+7),swap(this,o+1,o+6),swap(this,o+2,o+5),swap(this,o+3,o+4);return this},Buffer$1.prototype.toString=function t(){var n=this.length|0;return n===0?"":arguments.length===0?utf8Slice(this,0,n):slowToString.apply(this,arguments)},Buffer$1.prototype.equals=function t(n){if(!internalIsBuffer(n))throw new TypeError("Argument must be a Buffer");return this===n?!0:Buffer$1.compare(this,n)===0},Buffer$1.prototype.inspect=function t(){var n="",o=INSPECT_MAX_BYTES;return this.length>0&&(n=this.toString("hex",0,o).match(/.{2}/g).join(" "),this.length>o&&(n+=" ... ")),"<Buffer "+n+">"},Buffer$1.prototype.compare=function t(n,o,s,c,d){if(!internalIsBuffer(n))throw new TypeError("Argument must be a Buffer");if(o===void 0&&(o=0),s===void 0&&(s=n?n.length:0),c===void 0&&(c=0),d===void 0&&(d=this.length),o<0||s>n.length||c<0||d>this.length)throw new RangeError("out of range index");if(c>=d&&o>=s)return 0;if(c>=d)return-1;if(o>=s)return 1;if(o>>>=0,s>>>=0,c>>>=0,d>>>=0,this===n)return 0;for(var h=d-c,p=s-o,y=Math.min(h,p),S=this.slice(c,d),P=n.slice(o,s),L=0;L<y;++L)if(S[L]!==P[L]){h=S[L],p=P[L];break}return h<p?-1:p<h?1:0};function bidirectionalIndexOf(t,n,o,s,c){if(t.length===0)return-1;if(typeof o=="string"?(s=o,o=0):o>2147483647?o=2147483647:o<-2147483648&&(o=-2147483648),o=+o,isNaN(o)&&(o=c?0:t.length-1),o<0&&(o=t.length+o),o>=t.length){if(c)return-1;o=t.length-1}else if(o<0)if(c)o=0;else return-1;if(typeof n=="string"&&(n=Buffer$1.from(n,s)),internalIsBuffer(n))return n.length===0?-1:arrayIndexOf(t,n,o,s,c);if(typeof n=="number")return n=n&255,Buffer$1.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?c?Uint8Array.prototype.indexOf.call(t,n,o):Uint8Array.prototype.lastIndexOf.call(t,n,o):arrayIndexOf(t,[n],o,s,c);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(t,n,o,s,c){var d=1,h=t.length,p=n.length;if(s!==void 0&&(s=String(s).toLowerCase(),s==="ucs2"||s==="ucs-2"||s==="utf16le"||s==="utf-16le")){if(t.length<2||n.length<2)return-1;d=2,h/=2,p/=2,o/=2}function y(N,z){return d===1?N[z]:N.readUInt16BE(z*d)}var S;if(c){var P=-1;for(S=o;S<h;S++)if(y(t,S)===y(n,P===-1?0:S-P)){if(P===-1&&(P=S),S-P+1===p)return P*d}else P!==-1&&(S-=S-P),P=-1}else for(o+p>h&&(o=h-p),S=o;S>=0;S--){for(var L=!0,F=0;F<p;F++)if(y(t,S+F)!==y(n,F)){L=!1;break}if(L)return S}return-1}Buffer$1.prototype.includes=function t(n,o,s){return this.indexOf(n,o,s)!==-1},Buffer$1.prototype.indexOf=function t(n,o,s){return bidirectionalIndexOf(this,n,o,s,!0)},Buffer$1.prototype.lastIndexOf=function t(n,o,s){return bidirectionalIndexOf(this,n,o,s,!1)};function hexWrite(t,n,o,s){o=Number(o)||0;var c=t.length-o;s?(s=Number(s),s>c&&(s=c)):s=c;var d=n.length;if(d%2!==0)throw new TypeError("Invalid hex string");s>d/2&&(s=d/2);for(var h=0;h<s;++h){var p=parseInt(n.substr(h*2,2),16);if(isNaN(p))return h;t[o+h]=p}return h}function utf8Write(t,n,o,s){return blitBuffer(utf8ToBytes(n,t.length-o),t,o,s)}function asciiWrite(t,n,o,s){return blitBuffer(asciiToBytes(n),t,o,s)}function latin1Write(t,n,o,s){return asciiWrite(t,n,o,s)}function base64Write(t,n,o,s){return blitBuffer(base64ToBytes(n),t,o,s)}function ucs2Write(t,n,o,s){return blitBuffer(utf16leToBytes(n,t.length-o),t,o,s)}Buffer$1.prototype.write=function t(n,o,s,c){if(o===void 0)c="utf8",s=this.length,o=0;else if(s===void 0&&typeof o=="string")c=o,s=this.length,o=0;else if(isFinite(o))o=o|0,isFinite(s)?(s=s|0,c===void 0&&(c="utf8")):(c=s,s=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var d=this.length-o;if((s===void 0||s>d)&&(s=d),n.length>0&&(s<0||o<0)||o>this.length)throw new RangeError("Attempt to write outside buffer bounds");c||(c="utf8");for(var h=!1;;)switch(c){case"hex":return hexWrite(this,n,o,s);case"utf8":case"utf-8":return utf8Write(this,n,o,s);case"ascii":return asciiWrite(this,n,o,s);case"latin1":case"binary":return latin1Write(this,n,o,s);case"base64":return base64Write(this,n,o,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,n,o,s);default:if(h)throw new TypeError("Unknown encoding: "+c);c=(""+c).toLowerCase(),h=!0}},Buffer$1.prototype.toJSON=function t(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function base64Slice(t,n,o){return n===0&&o===t.length?fromByteArray(t):fromByteArray(t.slice(n,o))}function utf8Slice(t,n,o){o=Math.min(t.length,o);for(var s=[],c=n;c<o;){var d=t[c],h=null,p=d>239?4:d>223?3:d>191?2:1;if(c+p<=o){var y,S,P,L;switch(p){case 1:d<128&&(h=d);break;case 2:y=t[c+1],(y&192)===128&&(L=(d&31)<<6|y&63,L>127&&(h=L));break;case 3:y=t[c+1],S=t[c+2],(y&192)===128&&(S&192)===128&&(L=(d&15)<<12|(y&63)<<6|S&63,L>2047&&(L<55296||L>57343)&&(h=L));break;case 4:y=t[c+1],S=t[c+2],P=t[c+3],(y&192)===128&&(S&192)===128&&(P&192)===128&&(L=(d&15)<<18|(y&63)<<12|(S&63)<<6|P&63,L>65535&&L<1114112&&(h=L))}}h===null?(h=65533,p=1):h>65535&&(h-=65536,s.push(h>>>10&1023|55296),h=56320|h&1023),s.push(h),c+=p}return decodeCodePointsArray(s)}var MAX_ARGUMENTS_LENGTH=4096;function decodeCodePointsArray(t){var n=t.length;if(n<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,t);for(var o="",s=0;s<n;)o+=String.fromCharCode.apply(String,t.slice(s,s+=MAX_ARGUMENTS_LENGTH));return o}function asciiSlice(t,n,o){var s="";o=Math.min(t.length,o);for(var c=n;c<o;++c)s+=String.fromCharCode(t[c]&127);return s}function latin1Slice(t,n,o){var s="";o=Math.min(t.length,o);for(var c=n;c<o;++c)s+=String.fromCharCode(t[c]);return s}function hexSlice(t,n,o){var s=t.length;(!n||n<0)&&(n=0),(!o||o<0||o>s)&&(o=s);for(var c="",d=n;d<o;++d)c+=toHex(t[d]);return c}function utf16leSlice(t,n,o){for(var s=t.slice(n,o),c="",d=0;d<s.length;d+=2)c+=String.fromCharCode(s[d]+s[d+1]*256);return c}Buffer$1.prototype.slice=function t(n,o){var s=this.length;n=~~n,o=o===void 0?s:~~o,n<0?(n+=s,n<0&&(n=0)):n>s&&(n=s),o<0?(o+=s,o<0&&(o=0)):o>s&&(o=s),o<n&&(o=n);var c;if(Buffer$1.TYPED_ARRAY_SUPPORT)c=this.subarray(n,o),c.__proto__=Buffer$1.prototype;else{var d=o-n;c=new Buffer$1(d,void 0);for(var h=0;h<d;++h)c[h]=this[h+n]}return c};function checkOffset(t,n,o){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+n>o)throw new RangeError("Trying to access beyond buffer length")}Buffer$1.prototype.readUIntLE=function t(n,o,s){n=n|0,o=o|0,s||checkOffset(n,o,this.length);for(var c=this[n],d=1,h=0;++h<o&&(d*=256);)c+=this[n+h]*d;return c},Buffer$1.prototype.readUIntBE=function t(n,o,s){n=n|0,o=o|0,s||checkOffset(n,o,this.length);for(var c=this[n+--o],d=1;o>0&&(d*=256);)c+=this[n+--o]*d;return c},Buffer$1.prototype.readUInt8=function t(n,o){return o||checkOffset(n,1,this.length),this[n]},Buffer$1.prototype.readUInt16LE=function t(n,o){return o||checkOffset(n,2,this.length),this[n]|this[n+1]<<8},Buffer$1.prototype.readUInt16BE=function t(n,o){return o||checkOffset(n,2,this.length),this[n]<<8|this[n+1]},Buffer$1.prototype.readUInt32LE=function t(n,o){return o||checkOffset(n,4,this.length),(this[n]|this[n+1]<<8|this[n+2]<<16)+this[n+3]*16777216},Buffer$1.prototype.readUInt32BE=function t(n,o){return o||checkOffset(n,4,this.length),this[n]*16777216+(this[n+1]<<16|this[n+2]<<8|this[n+3])},Buffer$1.prototype.readIntLE=function t(n,o,s){n=n|0,o=o|0,s||checkOffset(n,o,this.length);for(var c=this[n],d=1,h=0;++h<o&&(d*=256);)c+=this[n+h]*d;return d*=128,c>=d&&(c-=Math.pow(2,8*o)),c},Buffer$1.prototype.readIntBE=function t(n,o,s){n=n|0,o=o|0,s||checkOffset(n,o,this.length);for(var c=o,d=1,h=this[n+--c];c>0&&(d*=256);)h+=this[n+--c]*d;return d*=128,h>=d&&(h-=Math.pow(2,8*o)),h},Buffer$1.prototype.readInt8=function t(n,o){return o||checkOffset(n,1,this.length),this[n]&128?(255-this[n]+1)*-1:this[n]},Buffer$1.prototype.readInt16LE=function t(n,o){o||checkOffset(n,2,this.length);var s=this[n]|this[n+1]<<8;return s&32768?s|4294901760:s},Buffer$1.prototype.readInt16BE=function t(n,o){o||checkOffset(n,2,this.length);var s=this[n+1]|this[n]<<8;return s&32768?s|4294901760:s},Buffer$1.prototype.readInt32LE=function t(n,o){return o||checkOffset(n,4,this.length),this[n]|this[n+1]<<8|this[n+2]<<16|this[n+3]<<24},Buffer$1.prototype.readInt32BE=function t(n,o){return o||checkOffset(n,4,this.length),this[n]<<24|this[n+1]<<16|this[n+2]<<8|this[n+3]},Buffer$1.prototype.readFloatLE=function t(n,o){return o||checkOffset(n,4,this.length),read(this,n,!0,23,4)},Buffer$1.prototype.readFloatBE=function t(n,o){return o||checkOffset(n,4,this.length),read(this,n,!1,23,4)},Buffer$1.prototype.readDoubleLE=function t(n,o){return o||checkOffset(n,8,this.length),read(this,n,!0,52,8)},Buffer$1.prototype.readDoubleBE=function t(n,o){return o||checkOffset(n,8,this.length),read(this,n,!1,52,8)};function checkInt(t,n,o,s,c,d){if(!internalIsBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>c||n<d)throw new RangeError('"value" argument is out of bounds');if(o+s>t.length)throw new RangeError("Index out of range")}Buffer$1.prototype.writeUIntLE=function t(n,o,s,c){if(n=+n,o=o|0,s=s|0,!c){var d=Math.pow(2,8*s)-1;checkInt(this,n,o,s,d,0)}var h=1,p=0;for(this[o]=n&255;++p<s&&(h*=256);)this[o+p]=n/h&255;return o+s},Buffer$1.prototype.writeUIntBE=function t(n,o,s,c){if(n=+n,o=o|0,s=s|0,!c){var d=Math.pow(2,8*s)-1;checkInt(this,n,o,s,d,0)}var h=s-1,p=1;for(this[o+h]=n&255;--h>=0&&(p*=256);)this[o+h]=n/p&255;return o+s},Buffer$1.prototype.writeUInt8=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,1,255,0),Buffer$1.TYPED_ARRAY_SUPPORT||(n=Math.floor(n)),this[o]=n&255,o+1};function objectWriteUInt16(t,n,o,s){n<0&&(n=65535+n+1);for(var c=0,d=Math.min(t.length-o,2);c<d;++c)t[o+c]=(n&255<<8*(s?c:1-c))>>>(s?c:1-c)*8}Buffer$1.prototype.writeUInt16LE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,2,65535,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o]=n&255,this[o+1]=n>>>8):objectWriteUInt16(this,n,o,!0),o+2},Buffer$1.prototype.writeUInt16BE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,2,65535,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o]=n>>>8,this[o+1]=n&255):objectWriteUInt16(this,n,o,!1),o+2};function objectWriteUInt32(t,n,o,s){n<0&&(n=4294967295+n+1);for(var c=0,d=Math.min(t.length-o,4);c<d;++c)t[o+c]=n>>>(s?c:3-c)*8&255}Buffer$1.prototype.writeUInt32LE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,4,4294967295,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o+3]=n>>>24,this[o+2]=n>>>16,this[o+1]=n>>>8,this[o]=n&255):objectWriteUInt32(this,n,o,!0),o+4},Buffer$1.prototype.writeUInt32BE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,4,4294967295,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255):objectWriteUInt32(this,n,o,!1),o+4},Buffer$1.prototype.writeIntLE=function t(n,o,s,c){if(n=+n,o=o|0,!c){var d=Math.pow(2,8*s-1);checkInt(this,n,o,s,d-1,-d)}var h=0,p=1,y=0;for(this[o]=n&255;++h<s&&(p*=256);)n<0&&y===0&&this[o+h-1]!==0&&(y=1),this[o+h]=(n/p>>0)-y&255;return o+s},Buffer$1.prototype.writeIntBE=function t(n,o,s,c){if(n=+n,o=o|0,!c){var d=Math.pow(2,8*s-1);checkInt(this,n,o,s,d-1,-d)}var h=s-1,p=1,y=0;for(this[o+h]=n&255;--h>=0&&(p*=256);)n<0&&y===0&&this[o+h+1]!==0&&(y=1),this[o+h]=(n/p>>0)-y&255;return o+s},Buffer$1.prototype.writeInt8=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,1,127,-128),Buffer$1.TYPED_ARRAY_SUPPORT||(n=Math.floor(n)),n<0&&(n=255+n+1),this[o]=n&255,o+1},Buffer$1.prototype.writeInt16LE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,2,32767,-32768),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o]=n&255,this[o+1]=n>>>8):objectWriteUInt16(this,n,o,!0),o+2},Buffer$1.prototype.writeInt16BE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,2,32767,-32768),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o]=n>>>8,this[o+1]=n&255):objectWriteUInt16(this,n,o,!1),o+2},Buffer$1.prototype.writeInt32LE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,4,2147483647,-2147483648),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o]=n&255,this[o+1]=n>>>8,this[o+2]=n>>>16,this[o+3]=n>>>24):objectWriteUInt32(this,n,o,!0),o+4},Buffer$1.prototype.writeInt32BE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,4,2147483647,-2147483648),n<0&&(n=4294967295+n+1),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255):objectWriteUInt32(this,n,o,!1),o+4};function checkIEEE754(t,n,o,s,c,d){if(o+s>t.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("Index out of range")}function writeFloat(t,n,o,s,c){return c||checkIEEE754(t,n,o,4),write(t,n,o,s,23,4),o+4}Buffer$1.prototype.writeFloatLE=function t(n,o,s){return writeFloat(this,n,o,!0,s)},Buffer$1.prototype.writeFloatBE=function t(n,o,s){return writeFloat(this,n,o,!1,s)};function writeDouble(t,n,o,s,c){return c||checkIEEE754(t,n,o,8),write(t,n,o,s,52,8),o+8}Buffer$1.prototype.writeDoubleLE=function t(n,o,s){return writeDouble(this,n,o,!0,s)},Buffer$1.prototype.writeDoubleBE=function t(n,o,s){return writeDouble(this,n,o,!1,s)},Buffer$1.prototype.copy=function t(n,o,s,c){if(s||(s=0),!c&&c!==0&&(c=this.length),o>=n.length&&(o=n.length),o||(o=0),c>0&&c<s&&(c=s),c===s||n.length===0||this.length===0)return 0;if(o<0)throw new RangeError("targetStart out of bounds");if(s<0||s>=this.length)throw new RangeError("sourceStart out of bounds");if(c<0)throw new RangeError("sourceEnd out of bounds");c>this.length&&(c=this.length),n.length-o<c-s&&(c=n.length-o+s);var d=c-s,h;if(this===n&&s<o&&o<c)for(h=d-1;h>=0;--h)n[h+o]=this[h+s];else if(d<1e3||!Buffer$1.TYPED_ARRAY_SUPPORT)for(h=0;h<d;++h)n[h+o]=this[h+s];else Uint8Array.prototype.set.call(n,this.subarray(s,s+d),o);return d},Buffer$1.prototype.fill=function t(n,o,s,c){if(typeof n=="string"){if(typeof o=="string"?(c=o,o=0,s=this.length):typeof s=="string"&&(c=s,s=this.length),n.length===1){var d=n.charCodeAt(0);d<256&&(n=d)}if(c!==void 0&&typeof c!="string")throw new TypeError("encoding must be a string");if(typeof c=="string"&&!Buffer$1.isEncoding(c))throw new TypeError("Unknown encoding: "+c)}else typeof n=="number"&&(n=n&255);if(o<0||this.length<o||this.length<s)throw new RangeError("Out of range index");if(s<=o)return this;o=o>>>0,s=s===void 0?this.length:s>>>0,n||(n=0);var h;if(typeof n=="number")for(h=o;h<s;++h)this[h]=n;else{var p=internalIsBuffer(n)?n:utf8ToBytes(new Buffer$1(n,c).toString()),y=p.length;for(h=0;h<s-o;++h)this[h+o]=p[h%y]}return this};var INVALID_BASE64_RE=/[^+\/0-9A-Za-z-_]/g;function base64clean(t){if(t=stringtrim(t).replace(INVALID_BASE64_RE,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function stringtrim(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function toHex(t){return t<16?"0"+t.toString(16):t.toString(16)}function utf8ToBytes(t,n){n=n||1/0;for(var o,s=t.length,c=null,d=[],h=0;h<s;++h){if(o=t.charCodeAt(h),o>55295&&o<57344){if(!c){if(o>56319){(n-=3)>-1&&d.push(239,191,189);continue}else if(h+1===s){(n-=3)>-1&&d.push(239,191,189);continue}c=o;continue}if(o<56320){(n-=3)>-1&&d.push(239,191,189),c=o;continue}o=(c-55296<<10|o-56320)+65536}else c&&(n-=3)>-1&&d.push(239,191,189);if(c=null,o<128){if((n-=1)<0)break;d.push(o)}else if(o<2048){if((n-=2)<0)break;d.push(o>>6|192,o&63|128)}else if(o<65536){if((n-=3)<0)break;d.push(o>>12|224,o>>6&63|128,o&63|128)}else if(o<1114112){if((n-=4)<0)break;d.push(o>>18|240,o>>12&63|128,o>>6&63|128,o&63|128)}else throw new Error("Invalid code point")}return d}function asciiToBytes(t){for(var n=[],o=0;o<t.length;++o)n.push(t.charCodeAt(o)&255);return n}function utf16leToBytes(t,n){for(var o,s,c,d=[],h=0;h<t.length&&!((n-=2)<0);++h)o=t.charCodeAt(h),s=o>>8,c=o%256,d.push(c),d.push(s);return d}function base64ToBytes(t){return toByteArray(base64clean(t))}function blitBuffer(t,n,o,s){for(var c=0;c<s&&!(c+o>=n.length||c>=t.length);++c)n[c+o]=t[c];return c}function isnan(t){return t!==t}function isBuffer(t){return t!=null&&(!!t._isBuffer||isFastBuffer(t)||isSlowBuffer(t))}function isFastBuffer(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function isSlowBuffer(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&isFastBuffer(t.slice(0,0))}var domain;function EventHandlers(){}EventHandlers.prototype=Object.create(null);function EventEmitter(){EventEmitter.init.call(this)}EventEmitter.EventEmitter=EventEmitter,EventEmitter.usingDomains=!1,EventEmitter.prototype.domain=void 0,EventEmitter.prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0,EventEmitter.defaultMaxListeners=10,EventEmitter.init=function(){this.domain=null,EventEmitter.usingDomains&&domain.active,(!this._events||this._events===Object.getPrototypeOf(this)._events)&&(this._events=new EventHandlers,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},EventEmitter.prototype.setMaxListeners=function t(n){if(typeof n!="number"||n<0||isNaN(n))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=n,this};function $getMaxListeners(t){return t._maxListeners===void 0?EventEmitter.defaultMaxListeners:t._maxListeners}EventEmitter.prototype.getMaxListeners=function t(){return $getMaxListeners(this)};function emitNone(t,n,o){if(n)t.call(o);else for(var s=t.length,c=arrayClone(t,s),d=0;d<s;++d)c[d].call(o)}function emitOne(t,n,o,s){if(n)t.call(o,s);else for(var c=t.length,d=arrayClone(t,c),h=0;h<c;++h)d[h].call(o,s)}function emitTwo(t,n,o,s,c){if(n)t.call(o,s,c);else for(var d=t.length,h=arrayClone(t,d),p=0;p<d;++p)h[p].call(o,s,c)}function emitThree(t,n,o,s,c,d){if(n)t.call(o,s,c,d);else for(var h=t.length,p=arrayClone(t,h),y=0;y<h;++y)p[y].call(o,s,c,d)}function emitMany(t,n,o,s){if(n)t.apply(o,s);else for(var c=t.length,d=arrayClone(t,c),h=0;h<c;++h)d[h].apply(o,s)}EventEmitter.prototype.emit=function t(n){var o,s,c,d,h,p,y,S=n==="error";if(p=this._events,p)S=S&&p.error==null;else if(!S)return!1;if(y=this.domain,S){if(o=arguments[1],y)o||(o=new Error('Uncaught, unspecified "error" event')),o.domainEmitter=this,o.domain=y,o.domainThrown=!1,y.emit("error",o);else{if(o instanceof Error)throw o;var P=new Error('Uncaught, unspecified "error" event. ('+o+")");throw P.context=o,P}return!1}if(s=p[n],!s)return!1;var L=typeof s=="function";switch(c=arguments.length,c){case 1:emitNone(s,L,this);break;case 2:emitOne(s,L,this,arguments[1]);break;case 3:emitTwo(s,L,this,arguments[1],arguments[2]);break;case 4:emitThree(s,L,this,arguments[1],arguments[2],arguments[3]);break;default:for(d=new Array(c-1),h=1;h<c;h++)d[h-1]=arguments[h];emitMany(s,L,this,d)}return!0};function _addListener(t,n,o,s){var c,d,h;if(typeof o!="function")throw new TypeError('"listener" argument must be a function');if(d=t._events,d?(d.newListener&&(t.emit("newListener",n,o.listener?o.listener:o),d=t._events),h=d[n]):(d=t._events=new EventHandlers,t._eventsCount=0),!h)h=d[n]=o,++t._eventsCount;else if(typeof h=="function"?h=d[n]=s?[o,h]:[h,o]:s?h.unshift(o):h.push(o),!h.warned&&(c=$getMaxListeners(t),c&&c>0&&h.length>c)){h.warned=!0;var p=new Error("Possible EventEmitter memory leak detected. "+h.length+" "+n+" listeners added. Use emitter.setMaxListeners() to increase limit");p.name="MaxListenersExceededWarning",p.emitter=t,p.type=n,p.count=h.length,emitWarning(p)}return t}function emitWarning(t){typeof console.warn=="function"?console.warn(t):console.log(t)}EventEmitter.prototype.addListener=function t(n,o){return _addListener(this,n,o,!1)},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.prependListener=function t(n,o){return _addListener(this,n,o,!0)};function _onceWrap(t,n,o){var s=!1;function c(){t.removeListener(n,c),s||(s=!0,o.apply(t,arguments))}return c.listener=o,c}EventEmitter.prototype.once=function t(n,o){if(typeof o!="function")throw new TypeError('"listener" argument must be a function');return this.on(n,_onceWrap(this,n,o)),this},EventEmitter.prototype.prependOnceListener=function t(n,o){if(typeof o!="function")throw new TypeError('"listener" argument must be a function');return this.prependListener(n,_onceWrap(this,n,o)),this},EventEmitter.prototype.removeListener=function t(n,o){var s,c,d,h,p;if(typeof o!="function")throw new TypeError('"listener" argument must be a function');if(c=this._events,!c)return this;if(s=c[n],!s)return this;if(s===o||s.listener&&s.listener===o)--this._eventsCount===0?this._events=new EventHandlers:(delete c[n],c.removeListener&&this.emit("removeListener",n,s.listener||o));else if(typeof s!="function"){for(d=-1,h=s.length;h-- >0;)if(s[h]===o||s[h].listener&&s[h].listener===o){p=s[h].listener,d=h;break}if(d<0)return this;if(s.length===1){if(s[0]=void 0,--this._eventsCount===0)return this._events=new EventHandlers,this;delete c[n]}else spliceOne(s,d);c.removeListener&&this.emit("removeListener",n,p||o)}return this},EventEmitter.prototype.removeAllListeners=function t(n){var o,s;if(s=this._events,!s)return this;if(!s.removeListener)return arguments.length===0?(this._events=new EventHandlers,this._eventsCount=0):s[n]&&(--this._eventsCount===0?this._events=new EventHandlers:delete s[n]),this;if(arguments.length===0){for(var c=Object.keys(s),d=0,h;d<c.length;++d)h=c[d],h!=="removeListener"&&this.removeAllListeners(h);return this.removeAllListeners("removeListener"),this._events=new EventHandlers,this._eventsCount=0,this}if(o=s[n],typeof o=="function")this.removeListener(n,o);else if(o)do this.removeListener(n,o[o.length-1]);while(o[0]);return this},EventEmitter.prototype.listeners=function t(n){var o,s,c=this._events;return c?(o=c[n],o?typeof o=="function"?s=[o.listener||o]:s=unwrapListeners(o):s=[]):s=[],s},EventEmitter.listenerCount=function(t,n){return typeof t.listenerCount=="function"?t.listenerCount(n):listenerCount$1.call(t,n)},EventEmitter.prototype.listenerCount=listenerCount$1;function listenerCount$1(t){var n=this._events;if(n){var o=n[t];if(typeof o=="function")return 1;if(o)return o.length}return 0}EventEmitter.prototype.eventNames=function t(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};function spliceOne(t,n){for(var o=n,s=o+1,c=t.length;s<c;o+=1,s+=1)t[o]=t[s];t.pop()}function arrayClone(t,n){for(var o=new Array(n);n--;)o[n]=t[n];return o}function unwrapListeners(t){for(var n=new Array(t.length),o=0;o<n.length;++o)n[o]=t[o].listener||t[o];return n}function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}var cachedSetTimeout=defaultSetTimout,cachedClearTimeout=defaultClearTimeout;typeof global$1.setTimeout=="function"&&(cachedSetTimeout=setTimeout),typeof global$1.clearTimeout=="function"&&(cachedClearTimeout=clearTimeout);function runTimeout(t){if(cachedSetTimeout===setTimeout)return setTimeout(t,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(t,0);try{return cachedSetTimeout(t,0)}catch{try{return cachedSetTimeout.call(null,t,0)}catch{return cachedSetTimeout.call(this,t,0)}}}function runClearTimeout(t){if(cachedClearTimeout===clearTimeout)return clearTimeout(t);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(t);try{return cachedClearTimeout(t)}catch{try{return cachedClearTimeout.call(null,t)}catch{return cachedClearTimeout.call(this,t)}}}var queue=[],draining=!1,currentQueue,queueIndex=-1;function cleanUpNextTick(){!draining||!currentQueue||(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var t=runTimeout(cleanUpNextTick);draining=!0;for(var n=queue.length;n;){for(currentQueue=queue,queue=[];++queueIndex<n;)currentQueue&¤tQueue[queueIndex].run();queueIndex=-1,n=queue.length}currentQueue=null,draining=!1,runClearTimeout(t)}}function nextTick(t){var n=new Array(arguments.length-1);if(arguments.length>1)for(var o=1;o<arguments.length;o++)n[o-1]=arguments[o];queue.push(new Item(t,n)),queue.length===1&&!draining&&runTimeout(drainQueue)}function Item(t,n){this.fun=t,this.array=n}Item.prototype.run=function(){this.fun.apply(null,this.array)};var title="browser",platform="browser",browser=!0,env={},argv=[],version="",versions={},release={},config={};function noop(){}var on=noop,addListener=noop,once=noop,off=noop,removeListener=noop,removeAllListeners=noop,emit=noop;function binding(t){throw new Error("process.binding is not supported")}function cwd(){return"/"}function chdir(t){throw new Error("process.chdir is not supported")}function umask(){return 0}var performance$1=global$1.performance||{},performanceNow=performance$1.now||performance$1.mozNow||performance$1.msNow||performance$1.oNow||performance$1.webkitNow||function(){return new Date().getTime()};function hrtime(t){var n=performanceNow.call(performance$1)*.001,o=Math.floor(n),s=Math.floor(n%1*1e9);return t&&(o=o-t[0],s=s-t[1],s<0&&(o--,s+=1e9)),[o,s]}var startTime=new Date;function uptime(){var t=new Date,n=t-startTime;return n/1e3}var process$1={nextTick,title,browser,env,argv,version,versions,on,addListener,once,off,removeListener,removeAllListeners,emit,binding,cwd,chdir,umask,hrtime,platform,release,config,uptime},inherits;typeof Object.create=="function"?inherits=function(n,o){n.super_=o,n.prototype=Object.create(o.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}})}:inherits=function(n,o){n.super_=o;var s=function(){};s.prototype=o.prototype,n.prototype=new s,n.prototype.constructor=n};var inherits$1=inherits,formatRegExp=/%[sdj%]/g;function format(t){if(!isString(t)){for(var n=[],o=0;o<arguments.length;o++)n.push(inspect(arguments[o]));return n.join(" ")}for(var o=1,s=arguments,c=s.length,d=String(t).replace(formatRegExp,function(p){if(p==="%%")return"%";if(o>=c)return p;switch(p){case"%s":return String(s[o++]);case"%d":return Number(s[o++]);case"%j":try{return JSON.stringify(s[o++])}catch{return"[Circular]"}default:return p}}),h=s[o];o<c;h=s[++o])isNull(h)||!isObject(h)?d+=" "+h:d+=" "+inspect(h);return d}function deprecate(t,n){if(isUndefined(global$1.process))return function(){return deprecate(t,n).apply(this,arguments)};if(process$1.noDeprecation===!0)return t;var o=!1;function s(){if(!o){if(process$1.throwDeprecation)throw new Error(n);process$1.traceDeprecation?console.trace(n):console.error(n),o=!0}return t.apply(this,arguments)}return s}var debugs={},debugEnviron;function debuglog(t){if(isUndefined(debugEnviron)&&(debugEnviron=process$1.env.NODE_DEBUG||""),t=t.toUpperCase(),!debugs[t])if(new RegExp("\\b"+t+"\\b","i").test(debugEnviron)){var n=0;debugs[t]=function(){var o=format.apply(null,arguments);console.error("%s %d: %s",t,n,o)}}else debugs[t]=function(){};return debugs[t]}function inspect(t,n){var o={seen:[],stylize:stylizeNoColor};return arguments.length>=3&&(o.depth=arguments[2]),arguments.length>=4&&(o.colors=arguments[3]),isBoolean(n)?o.showHidden=n:n&&_extend(o,n),isUndefined(o.showHidden)&&(o.showHidden=!1),isUndefined(o.depth)&&(o.depth=2),isUndefined(o.colors)&&(o.colors=!1),isUndefined(o.customInspect)&&(o.customInspect=!0),o.colors&&(o.stylize=stylizeWithColor),formatValue(o,t,o.depth)}inspect.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]},inspect.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function stylizeWithColor(t,n){var o=inspect.styles[n];return o?"\x1B["+inspect.colors[o][0]+"m"+t+"\x1B["+inspect.colors[o][1]+"m":t}function stylizeNoColor(t,n){return t}function arrayToHash(t){var n={};return t.forEach(function(o,s){n[o]=!0}),n}function formatValue(t,n,o){if(t.customInspect&&n&&isFunction(n.inspect)&&n.inspect!==inspect&&!(n.constructor&&n.constructor.prototype===n)){var s=n.inspect(o,t);return isString(s)||(s=formatValue(t,s,o)),s}var c=formatPrimitive(t,n);if(c)return c;var d=Object.keys(n),h=arrayToHash(d);if(t.showHidden&&(d=Object.getOwnPropertyNames(n)),isError(n)&&(d.indexOf("message")>=0||d.indexOf("description")>=0))return formatError(n);if(d.length===0){if(isFunction(n)){var p=n.name?": "+n.name:"";return t.stylize("[Function"+p+"]","special")}if(isRegExp(n))return t.stylize(RegExp.prototype.toString.call(n),"regexp");if(isDate(n))return t.stylize(Date.prototype.toString.call(n),"date");if(isError(n))return formatError(n)}var y="",S=!1,P=["{","}"];if(isArray(n)&&(S=!0,P=["[","]"]),isFunction(n)){var L=n.name?": "+n.name:"";y=" [Function"+L+"]"}if(isRegExp(n)&&(y=" "+RegExp.prototype.toString.call(n)),isDate(n)&&(y=" "+Date.prototype.toUTCString.call(n)),isError(n)&&(y=" "+formatError(n)),d.length===0&&(!S||n.length==0))return P[0]+y+P[1];if(o<0)return isRegExp(n)?t.stylize(RegExp.prototype.toString.call(n),"regexp"):t.stylize("[Object]","special");t.seen.push(n);var F;return S?F=formatArray(t,n,o,h,d):F=d.map(function(N){return formatProperty(t,n,o,h,N,S)}),t.seen.pop(),reduceToSingleString(F,y,P)}function formatPrimitive(t,n){if(isUndefined(n))return t.stylize("undefined","undefined");if(isString(n)){var o="'"+JSON.stringify(n).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(o,"string")}if(isNumber(n))return t.stylize(""+n,"number");if(isBoolean(n))return t.stylize(""+n,"boolean");if(isNull(n))return t.stylize("null","null")}function formatError(t){return"["+Error.prototype.toString.call(t)+"]"}function formatArray(t,n,o,s,c){for(var d=[],h=0,p=n.length;h<p;++h)hasOwnProperty(n,String(h))?d.push(formatProperty(t,n,o,s,String(h),!0)):d.push("");return c.forEach(function(y){y.match(/^\d+$/)||d.push(formatProperty(t,n,o,s,y,!0))}),d}function formatProperty(t,n,o,s,c,d){var h,p,y;if(y=Object.getOwnPropertyDescriptor(n,c)||{value:n[c]},y.get?y.set?p=t.stylize("[Getter/Setter]","special"):p=t.stylize("[Getter]","special"):y.set&&(p=t.stylize("[Setter]","special")),hasOwnProperty(s,c)||(h="["+c+"]"),p||(t.seen.indexOf(y.value)<0?(isNull(o)?p=formatValue(t,y.value,null):p=formatValue(t,y.value,o-1),p.indexOf(`
|
|
6745
|
+
`,uniforms:{...pick(P,["color","frustumLength","blackPoint","whitePoint","gamma"]),globeDepthTexture:()=>(y==null?void 0:y())??F._depthTexture}});if(c){const N=createBilateralFilterStage({prefix:t,outputType:h,useGlobeDepth:p,getGlobeDepthTexture:y,uniforms:{textureScale:n,...pick(P,["frustumLength","normalExponent","depthExponent"])}}),z=new Cesium$1.PostProcessStageComposite({name:`${t}_ambient_occlusion_generate_and_filter`,stages:[L,N]});return F.uniforms.ambientOcclusionTexture=z.name,new Cesium$1.PostProcessStageComposite({name:`${t}_ambient_occlusion`,stages:[z,F],inputPreviousStageTexture:!1,uniforms:createUniforms([{stage:L,uniforms:["intensity","maxRadius","bias","frustumLength","focalLength"]},{stage:N,uniforms:["frustumLength","normalExponent","depthExponent"]},{stage:F,uniforms:["color","blackPoint","whitePoint","gamma"]}])})}else return F.uniforms.ambientOcclusionTexture=L.name,new Cesium$1.PostProcessStageComposite({name:`${t}_ambient_occlusion`,stages:[L,F],inputPreviousStageTexture:!1,uniforms:createUniforms([{stage:L,uniforms:["intensity","maxRadius","bias","frustumLength","focalLength"]},{stage:F,uniforms:["color","blackPoint","whitePoint","gamma"]}])})}const AmbientOcclusionStage=({enabled:t=!0,textureScale:n,directions:o,steps:s,denoise:c,accurateNormalReconstruction:d,outputType:h,useGlobeDepth:p,...y})=>{const{viewer:S}=$e$1(),P=S==null?void 0:S.scene,L=useInstance({owner:P==null?void 0:P.postProcessStages,keys:[n,s,o,c,d,h,p],create:()=>{const F=createAmbientOcclusionStage({textureScale:n,steps:s,directions:o,denoise:c,accurateNormalReconstruction:d,outputType:h,useGlobeDepth:p,getGlobeDepthTexture:()=>P.context.uniformState.globeDepthTexture,uniforms:y});return F.enabled=t,F},transferOwnership:(F,N)=>(N==null||N.add(F),()=>{N==null||N.remove(F)})});return L.enabled=t,Object.assign(L.uniforms,y),P==null||P.requestRender(),usePreRender(()=>{const F=P==null?void 0:P.camera.frustum;if(F instanceof Cesium$1.PerspectiveFrustum){const N=1/Math.tan(F.fovy/2);L.uniforms.focalLength.x=N*F.aspectRatio,L.uniforms.focalLength.y=N}}),null},AmbientOcclusion=t=>{const n=$e$1(),[o,s]=React.useState(!1);return usePreRender(()=>{const c=n.scene;s(!(c!=null&&c.globe.depthTestAgainstTerrain));const{globeHeight:d}=c;if(!c||d==null)return;const h=c.camera.positionCartographic.height-d,p=c==null?void 0:c.camera.frustum;p instanceof Cesium$1.PerspectiveFrustum&&(c.camera.frustum.near=Cesium$1.Math.clamp(h-1,1,5)/Math.tan(p.fov/2))}),jsxRuntimeExports.jsx(AmbientOcclusionStage,{...t,useGlobeDepth:o})};var AmbientOcclusionOutputType=(t=>(t[t.Occlusion=1]="Occlusion",t[t.Normal=2]="Normal",t[t.Depth=3]="Depth",t[t.Weight=4]="Weight",t[t.Shade=5]="Shade",t))(AmbientOcclusionOutputType||{});const AMBIENT_OCCLUSION_QUALITY={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}},DEFAULT_SKETCH_COLOR="#00bebe",DEFAULT_EDIT_COLOR="#3B3CD0",SELECTED_EDIT_COLOR="#FF9900",ADDING_POINT_COLOR="#3B3CD0";let drawPointImage,editPointImage,selectedPointImage,addingPointImage;const ControlPoint=({position:t,clampToGround:n=!1,index:o,isEditing:s,isSelected:c,isAddingPoint:d,isExtrudedControlPoint:h,handleControlPointMouseEvent:p})=>{const y=React.useRef(t);y.current=t;const S=useConstant$2(()=>new CallbackProperty((N,z)=>"getValue"in y.current?y.current.getValue(N,z):y.current,!1)),P=React.useMemo(()=>({position:S,billboard:{image:s?d?getAddingPointImage():c?getSelectedPointImage():getEditPointImage():getDrawPointImage(),width:s?16:8,height:s?16:8,heightReference:n?HeightReference$1.CLAMP_TO_GROUND:HeightReference$1.NONE,disableDepthTestDistance:1/0}}),[n,S,d,s,c]),L=React.useCallback(()=>{p==null||p(o,!!h,"mousedown")},[o,h,p]),F=React.useCallback(()=>{p==null||p(o,!!h,"click")},[o,h,p]);return jsxRuntimeExports.jsx(Is$1,{...P,onMouseDown:L,onClick:F})};function getDrawPointImage(){if(drawPointImage!=null)return drawPointImage;drawPointImage=document.createElement("canvas"),drawPointImage.width=16,drawPointImage.height=16;const t=drawPointImage.getContext("2d");return invariant$1(t!=null),t.fillStyle="white",t.fillRect(3,3,10,10),t.strokeStyle="black",t.lineWidth=2,t.strokeRect(3,3,10,10),drawPointImage}function getEditPointImage(){return getImage(editPointImage,{size:32,color:"white",strokeColor:DEFAULT_EDIT_COLOR})}function getSelectedPointImage(){return getImage(selectedPointImage,{size:32,color:"white",strokeColor:SELECTED_EDIT_COLOR})}function getAddingPointImage(){if(addingPointImage!=null)return addingPointImage;addingPointImage=document.createElement("canvas"),addingPointImage.width=32,addingPointImage.height=32;const t=addingPointImage.getContext("2d");return invariant$1(t!=null),t.beginPath(),t.arc(16,16,12,0,2*Math.PI),t.fillStyle="white",t.fill(),t.strokeStyle=ADDING_POINT_COLOR,t.lineWidth=4,t.stroke(),t.beginPath(),t.moveTo(16,8),t.lineTo(16,24),t.stroke(),t.moveTo(8,16),t.lineTo(24,16),t.stroke(),addingPointImage}function getImage(t,n){if(t!=null)return t;t=document.createElement("canvas"),t.width=n.size,t.height=n.size;const o=t.getContext("2d");return invariant$1(o!=null),o.beginPath(),o.arc(n.size/2,n.size/2,n.size/2-4,0,2*Math.PI),o.fillStyle=n.color,o.fill(),o.strokeStyle=n.strokeColor,o.lineWidth=4,o.stroke(),t}function assignForwardedRef(t,n){if(typeof t=="function")return t(n),()=>{t(null)};if(t!=null)return t.current=n,()=>{t.current=null}}const Entity=React.memo(React.forwardRef(({entities:t,...n},o)=>{const{viewer:s}=$e$1(),c=s==null?void 0:s.scene,d=s==null?void 0:s.entities,h=t??d,[p,y]=React.useState(()=>new Entity$1(n));return React.useEffect(()=>{y(new Entity$1(n))},[n.id]),React.useEffect(()=>(h==null||h.add(p),()=>{h==null||h.remove(p),c==null||c.requestRender()}),[c,h,p]),React.useEffect(()=>assignForwardedRef(o,p),[o,p]),Object.assign(p,omit(n,"id")),c==null||c.requestRender(),null})),textStyle={padding:"5px",color:"#fff",backgroundColor:"#000",borderRadius:"5px",lineHeight:1},MeasurementText=({children:t})=>jsxRuntimeExports.jsx("div",{style:textStyle,children:t}),MotionConfigContext=React.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),MotionContext=React.createContext({}),PresenceContext=React.createContext(null),isBrowser=typeof document<"u",useIsomorphicLayoutEffect$1=isBrowser?React.useLayoutEffect:React.useEffect,LazyContext=React.createContext({strict:!1}),camelToDash=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),optimizedAppearDataId="framerAppearId",optimizedAppearDataAttribute="data-"+camelToDash(optimizedAppearDataId),MotionGlobalConfig={skipAnimations:!1,useManualTiming:!1};class Queue{constructor(){this.order=[],this.scheduled=new Set}add(n){if(!this.scheduled.has(n))return this.scheduled.add(n),this.order.push(n),!0}remove(n){const o=this.order.indexOf(n);o!==-1&&(this.order.splice(o,1),this.scheduled.delete(n))}clear(){this.order.length=0,this.scheduled.clear()}}function createRenderStep(t){let n=new Queue,o=new Queue,s=0,c=!1,d=!1;const h=new WeakSet,p={schedule:(y,S=!1,P=!1)=>{const L=P&&c,F=L?n:o;return S&&h.add(y),F.add(y)&&L&&c&&(s=n.order.length),y},cancel:y=>{o.remove(y),h.delete(y)},process:y=>{if(c){d=!0;return}if(c=!0,[n,o]=[o,n],o.clear(),s=n.order.length,s)for(let S=0;S<s;S++){const P=n.order[S];h.has(P)&&(p.schedule(P),t()),P(y)}c=!1,d&&(d=!1,p.process(y))}};return p}const stepsOrder=["read","resolveKeyframes","update","preRender","render","postRender"],maxElapsed=40;function createRenderBatcher(t,n){let o=!1,s=!0;const c={delta:0,timestamp:0,isProcessing:!1},d=stepsOrder.reduce((L,F)=>(L[F]=createRenderStep(()=>o=!0),L),{}),h=L=>{d[L].process(c)},p=()=>{const L=performance.now();o=!1,c.delta=s?1e3/60:Math.max(Math.min(L-c.timestamp,maxElapsed),1),c.timestamp=L,c.isProcessing=!0,stepsOrder.forEach(h),c.isProcessing=!1,o&&n&&(s=!1,t(p))},y=()=>{o=!0,s=!0,c.isProcessing||t(p)};return{schedule:stepsOrder.reduce((L,F)=>{const N=d[F];return L[F]=(z,W=!1,nt=!1)=>(o||y(),N.schedule(z,W,nt)),L},{}),cancel:L=>stepsOrder.forEach(F=>d[F].cancel(L)),state:c,steps:d}}const{schedule:microtask,cancel:cancelMicrotask}=createRenderBatcher(queueMicrotask,!1);function useVisualElement(t,n,o,s){const{visualElement:c}=React.useContext(MotionContext),d=React.useContext(LazyContext),h=React.useContext(PresenceContext),p=React.useContext(MotionConfigContext).reducedMotion,y=React.useRef();s=s||d.renderer,!y.current&&s&&(y.current=s(t,{visualState:n,parent:c,props:o,presenceContext:h,blockInitialAnimation:h?h.initial===!1:!1,reducedMotionConfig:p}));const S=y.current;React.useInsertionEffect(()=>{S&&S.update(o,h)});const P=React.useRef(!!(o[optimizedAppearDataAttribute]&&!window.HandoffComplete));return useIsomorphicLayoutEffect$1(()=>{S&&(microtask.postRender(S.render),P.current&&S.animationState&&S.animationState.animateChanges())}),React.useEffect(()=>{S&&(S.updateFeatures(),!P.current&&S.animationState&&S.animationState.animateChanges(),P.current&&(P.current=!1,window.HandoffComplete=!0))}),S}function isRefObject(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function useMotionRef(t,n,o){return React.useCallback(s=>{s&&t.mount&&t.mount(s),n&&(s?n.mount(s):n.unmount()),o&&(typeof o=="function"?o(s):isRefObject(o)&&(o.current=s))},[n])}function isVariantLabel(t){return typeof t=="string"||Array.isArray(t)}function isAnimationControls(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const variantPriorityOrder=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],variantProps=["initial",...variantPriorityOrder];function isControllingVariants(t){return isAnimationControls(t.animate)||variantProps.some(n=>isVariantLabel(t[n]))}function isVariantNode(t){return!!(isControllingVariants(t)||t.variants)}function getCurrentTreeVariants(t,n){if(isControllingVariants(t)){const{initial:o,animate:s}=t;return{initial:o===!1||isVariantLabel(o)?o:void 0,animate:isVariantLabel(s)?s:void 0}}return t.inherit!==!1?n:{}}function useCreateMotionContext(t){const{initial:n,animate:o}=getCurrentTreeVariants(t,React.useContext(MotionContext));return React.useMemo(()=>({initial:n,animate:o}),[variantLabelsAsDependency(n),variantLabelsAsDependency(o)])}function variantLabelsAsDependency(t){return Array.isArray(t)?t.join(" "):t}const featureProps={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"]},featureDefinitions={};for(const t in featureProps)featureDefinitions[t]={isEnabled:n=>featureProps[t].some(o=>!!n[o])};function loadFeatures(t){for(const n in t)featureDefinitions[n]={...featureDefinitions[n],...t[n]}}const LayoutGroupContext=React.createContext({}),SwitchLayoutGroupContext=React.createContext({}),motionComponentSymbol=Symbol.for("motionComponentSymbol");function createMotionComponent({preloadedFeatures:t,createVisualElement:n,useRender:o,useVisualState:s,Component:c}){t&&loadFeatures(t);function d(p,y){let S;const P={...React.useContext(MotionConfigContext),...p,layoutId:useLayoutId(p)},{isStatic:L}=P,F=useCreateMotionContext(p),N=s(p,L);if(!L&&isBrowser){F.visualElement=useVisualElement(c,N,P,n);const z=React.useContext(SwitchLayoutGroupContext),W=React.useContext(LazyContext).strict;F.visualElement&&(S=F.visualElement.loadFeatures(P,W,t,z))}return React__namespace.createElement(MotionContext.Provider,{value:F},S&&F.visualElement?React__namespace.createElement(S,{visualElement:F.visualElement,...P}):null,o(c,p,useMotionRef(N,F.visualElement,y),N,L,F.visualElement))}const h=React.forwardRef(d);return h[motionComponentSymbol]=c,h}function useLayoutId({layoutId:t}){const n=React.useContext(LayoutGroupContext).id;return n&&t!==void 0?n+"-"+t:t}function createMotionProxy(t){function n(s,c={}){return createMotionComponent(t(s,c))}if(typeof Proxy>"u")return n;const o=new Map;return new Proxy(n,{get:(s,c)=>(o.has(c)||o.set(c,n(c)),o.get(c))})}const lowercaseSVGElements=["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 isSVGComponent(t){return typeof t!="string"||t.includes("-")?!1:!!(lowercaseSVGElements.indexOf(t)>-1||/[A-Z]/u.test(t))}const scaleCorrectors={};function addScaleCorrector(t){Object.assign(scaleCorrectors,t)}const transformPropOrder=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],transformProps=new Set(transformPropOrder);function isForcedMotionValue(t,{layout:n,layoutId:o}){return transformProps.has(t)||t.startsWith("origin")||(n||o!==void 0)&&(!!scaleCorrectors[t]||t==="opacity")}const isMotionValue=t=>!!(t&&t.getVelocity),translateAlias={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},numTransforms=transformPropOrder.length;function buildTransform(t,{enableHardwareAcceleration:n=!0,allowTransformNone:o=!0},s,c){let d="";for(let h=0;h<numTransforms;h++){const p=transformPropOrder[h];if(t[p]!==void 0){const y=translateAlias[p]||p;d+=`${y}(${t[p]}) `}}return n&&!t.z&&(d+="translateZ(0)"),d=d.trim(),c?d=c(t,s?"":d):o&&s&&(d="none"),d}const checkStringStartsWith=t=>n=>typeof n=="string"&&n.startsWith(t),isCSSVariableName=checkStringStartsWith("--"),startsAsVariableToken=checkStringStartsWith("var(--"),isCSSVariableToken=t=>startsAsVariableToken(t)?singleCssVariableRegex.test(t.split("/*")[0].trim()):!1,singleCssVariableRegex=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,getValueAsType=(t,n)=>n&&typeof t=="number"?n.transform(t):t,clamp=(t,n,o)=>o>n?n:o<t?t:o,number={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},alpha={...number,transform:t=>clamp(0,1,t)},scale={...number,default:1},sanitize=t=>Math.round(t*1e5)/1e5,floatRegex=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,colorRegex=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,singleColorRegex=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;function isString$1(t){return typeof t=="string"}const createUnitType=t=>({test:n=>isString$1(n)&&n.endsWith(t)&&n.split(" ").length===1,parse:parseFloat,transform:n=>`${n}${t}`}),degrees=createUnitType("deg"),percent=createUnitType("%"),px=createUnitType("px"),vh=createUnitType("vh"),vw=createUnitType("vw"),progressPercentage={...percent,parse:t=>percent.parse(t)/100,transform:t=>percent.transform(t*100)},int={...number,transform:Math.round},numberValueTypes={borderWidth:px,borderTopWidth:px,borderRightWidth:px,borderBottomWidth:px,borderLeftWidth:px,borderRadius:px,radius:px,borderTopLeftRadius:px,borderTopRightRadius:px,borderBottomRightRadius:px,borderBottomLeftRadius:px,width:px,maxWidth:px,height:px,maxHeight:px,size:px,top:px,right:px,bottom:px,left:px,padding:px,paddingTop:px,paddingRight:px,paddingBottom:px,paddingLeft:px,margin:px,marginTop:px,marginRight:px,marginBottom:px,marginLeft:px,rotate:degrees,rotateX:degrees,rotateY:degrees,rotateZ:degrees,scale,scaleX:scale,scaleY:scale,scaleZ:scale,skew:degrees,skewX:degrees,skewY:degrees,distance:px,translateX:px,translateY:px,translateZ:px,x:px,y:px,z:px,perspective:px,transformPerspective:px,opacity:alpha,originX:progressPercentage,originY:progressPercentage,originZ:px,zIndex:int,backgroundPositionX:px,backgroundPositionY:px,fillOpacity:alpha,strokeOpacity:alpha,numOctaves:int};function buildHTMLStyles(t,n,o,s){const{style:c,vars:d,transform:h,transformOrigin:p}=t;let y=!1,S=!1,P=!0;for(const L in n){const F=n[L];if(isCSSVariableName(L)){d[L]=F;continue}const N=numberValueTypes[L],z=getValueAsType(F,N);if(transformProps.has(L)){if(y=!0,h[L]=z,!P)continue;F!==(N.default||0)&&(P=!1)}else L.startsWith("origin")?(S=!0,p[L]=z):c[L]=z}if(n.transform||(y||s?c.transform=buildTransform(t.transform,o,P,s):c.transform&&(c.transform="none")),S){const{originX:L="50%",originY:F="50%",originZ:N=0}=p;c.transformOrigin=`${L} ${F} ${N}`}}const createHtmlRenderState=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function copyRawValuesOnly(t,n,o){for(const s in n)!isMotionValue(n[s])&&!isForcedMotionValue(s,o)&&(t[s]=n[s])}function useInitialMotionValues({transformTemplate:t},n,o){return React.useMemo(()=>{const s=createHtmlRenderState();return buildHTMLStyles(s,n,{enableHardwareAcceleration:!o},t),Object.assign({},s.vars,s.style)},[n])}function useStyle(t,n,o){const s=t.style||{},c={};return copyRawValuesOnly(c,s,t),Object.assign(c,useInitialMotionValues(t,n,o)),c}function useHTMLProps(t,n,o){const s={},c=useStyle(t,n,o);return t.drag&&t.dragListener!==!1&&(s.draggable=!1,c.userSelect=c.WebkitUserSelect=c.WebkitTouchCallout="none",c.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(s.tabIndex=0),s.style=c,s}const validMotionProps=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","ignoreStrict","viewport"]);function isValidMotionProp(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||validMotionProps.has(t)}let shouldForward=t=>!isValidMotionProp(t);function loadExternalIsValidProp(t){t&&(shouldForward=n=>n.startsWith("on")?!isValidMotionProp(n):t(n))}try{loadExternalIsValidProp(require("@emotion/is-prop-valid").default)}catch(t){}function filterProps(t,n,o){const s={};for(const c in t)c==="values"&&typeof t.values=="object"||(shouldForward(c)||o===!0&&isValidMotionProp(c)||!n&&!isValidMotionProp(c)||t.draggable&&c.startsWith("onDrag"))&&(s[c]=t[c]);return s}function calcOrigin$1(t,n,o){return typeof t=="string"?t:px.transform(n+o*t)}function calcSVGTransformOrigin(t,n,o){const s=calcOrigin$1(n,t.x,t.width),c=calcOrigin$1(o,t.y,t.height);return`${s} ${c}`}const dashKeys={offset:"stroke-dashoffset",array:"stroke-dasharray"},camelKeys={offset:"strokeDashoffset",array:"strokeDasharray"};function buildSVGPath(t,n,o=1,s=0,c=!0){t.pathLength=1;const d=c?dashKeys:camelKeys;t[d.offset]=px.transform(-s);const h=px.transform(n),p=px.transform(o);t[d.array]=`${h} ${p}`}function buildSVGAttrs(t,{attrX:n,attrY:o,attrScale:s,originX:c,originY:d,pathLength:h,pathSpacing:p=1,pathOffset:y=0,...S},P,L,F){if(buildHTMLStyles(t,S,P,F),L){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:N,style:z,dimensions:W}=t;N.transform&&(W&&(z.transform=N.transform),delete N.transform),W&&(c!==void 0||d!==void 0||z.transform)&&(z.transformOrigin=calcSVGTransformOrigin(W,c!==void 0?c:.5,d!==void 0?d:.5)),n!==void 0&&(N.x=n),o!==void 0&&(N.y=o),s!==void 0&&(N.scale=s),h!==void 0&&buildSVGPath(N,h,p,y,!1)}const createSvgRenderState=()=>({...createHtmlRenderState(),attrs:{}}),isSVGTag=t=>typeof t=="string"&&t.toLowerCase()==="svg";function useSVGProps(t,n,o,s){const c=React.useMemo(()=>{const d=createSvgRenderState();return buildSVGAttrs(d,n,{enableHardwareAcceleration:!1},isSVGTag(s),t.transformTemplate),{...d.attrs,style:{...d.style}}},[n]);if(t.style){const d={};copyRawValuesOnly(d,t.style,t),c.style={...d,...c.style}}return c}function createUseRender(t=!1){return(o,s,c,{latestValues:d},h)=>{const y=(isSVGComponent(o)?useSVGProps:useHTMLProps)(s,d,h,o),S=filterProps(s,typeof o=="string",t),P=o!==React.Fragment?{...S,...y,ref:c}:{},{children:L}=s,F=React.useMemo(()=>isMotionValue(L)?L.get():L,[L]);return React.createElement(o,{...P,children:F})}}function renderHTML(t,{style:n,vars:o},s,c){Object.assign(t.style,n,c&&c.getProjectionStyles(s));for(const d in o)t.style.setProperty(d,o[d])}const camelCaseAttributes=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"]);function renderSVG(t,n,o,s){renderHTML(t,n,void 0,s);for(const c in n.attrs)t.setAttribute(camelCaseAttributes.has(c)?c:camelToDash(c),n.attrs[c])}function scrapeMotionValuesFromProps$1(t,n,o){var s;const{style:c}=t,d={};for(const h in c)(isMotionValue(c[h])||n.style&&isMotionValue(n.style[h])||isForcedMotionValue(h,t)||((s=o==null?void 0:o.getValue(h))===null||s===void 0?void 0:s.liveStyle)!==void 0)&&(d[h]=c[h]);return d}function scrapeMotionValuesFromProps(t,n,o){const s=scrapeMotionValuesFromProps$1(t,n,o);for(const c in t)if(isMotionValue(t[c])||isMotionValue(n[c])){const d=transformPropOrder.indexOf(c)!==-1?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c;s[d]=t[c]}return s}function resolveVariantFromProps(t,n,o,s={},c={}){return typeof n=="function"&&(n=n(o!==void 0?o:t.custom,s,c)),typeof n=="string"&&(n=t.variants&&t.variants[n]),typeof n=="function"&&(n=n(o!==void 0?o:t.custom,s,c)),n}function useConstant(t){const n=React.useRef(null);return n.current===null&&(n.current=t()),n.current}const isKeyframesTarget=t=>Array.isArray(t),isCustomValue=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),resolveFinalValueInKeyframes=t=>isKeyframesTarget(t)?t[t.length-1]||0:t;function resolveMotionValue(t){const n=isMotionValue(t)?t.get():t;return isCustomValue(n)?n.toValue():n}function makeState({scrapeMotionValuesFromProps:t,createRenderState:n,onMount:o},s,c,d){const h={latestValues:makeLatestValues(s,c,d,t),renderState:n()};return o&&(h.mount=p=>o(s,p,h)),h}const makeUseVisualState=t=>(n,o)=>{const s=React.useContext(MotionContext),c=React.useContext(PresenceContext),d=()=>makeState(t,n,s,c);return o?d():useConstant(d)};function makeLatestValues(t,n,o,s){const c={},d=s(t,{});for(const F in d)c[F]=resolveMotionValue(d[F]);let{initial:h,animate:p}=t;const y=isControllingVariants(t),S=isVariantNode(t);n&&S&&!y&&t.inherit!==!1&&(h===void 0&&(h=n.initial),p===void 0&&(p=n.animate));let P=o?o.initial===!1:!1;P=P||h===!1;const L=P?p:h;return L&&typeof L!="boolean"&&!isAnimationControls(L)&&(Array.isArray(L)?L:[L]).forEach(N=>{const z=resolveVariantFromProps(t,N);if(!z)return;const{transitionEnd:W,transition:nt,...Pe}=z;for(const se in Pe){let mt=Pe[se];if(Array.isArray(mt)){const kt=P?mt.length-1:0;mt=mt[kt]}mt!==null&&(c[se]=mt)}for(const se in W)c[se]=W[se]}),c}const noop$1=t=>t,{schedule:frame,cancel:cancelFrame,state:frameData,steps}=createRenderBatcher(typeof requestAnimationFrame<"u"?requestAnimationFrame:noop$1,!0),svgMotionConfig={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps,createRenderState:createSvgRenderState,onMount:(t,n,{renderState:o,latestValues:s})=>{frame.read(()=>{try{o.dimensions=typeof n.getBBox=="function"?n.getBBox():n.getBoundingClientRect()}catch{o.dimensions={x:0,y:0,width:0,height:0}}}),frame.render(()=>{buildSVGAttrs(o,s,{enableHardwareAcceleration:!1},isSVGTag(n.tagName),t.transformTemplate),renderSVG(n,o)})}})},htmlMotionConfig={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps:scrapeMotionValuesFromProps$1,createRenderState:createHtmlRenderState})};function createDomMotionConfig(t,{forwardMotionProps:n=!1},o,s){return{...isSVGComponent(t)?svgMotionConfig:htmlMotionConfig,preloadedFeatures:o,useRender:createUseRender(n),createVisualElement:s,Component:t}}function addDomEvent(t,n,o,s={passive:!0}){return t.addEventListener(n,o,s),()=>t.removeEventListener(n,o)}const isPrimaryPointer=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function extractEventInfo(t,n="page"){return{point:{x:t[n+"X"],y:t[n+"Y"]}}}const addPointerInfo=t=>n=>isPrimaryPointer(n)&&t(n,extractEventInfo(n));function addPointerEvent(t,n,o,s){return addDomEvent(t,n,addPointerInfo(o),s)}const combineFunctions=(t,n)=>o=>n(t(o)),pipe=(...t)=>t.reduce(combineFunctions);function createLock(t){let n=null;return()=>{const o=()=>{n=null};return n===null?(n=t,o):!1}}const globalHorizontalLock=createLock("dragHorizontal"),globalVerticalLock=createLock("dragVertical");function getGlobalLock(t){let n=!1;if(t==="y")n=globalVerticalLock();else if(t==="x")n=globalHorizontalLock();else{const o=globalHorizontalLock(),s=globalVerticalLock();o&&s?n=()=>{o(),s()}:(o&&o(),s&&s())}return n}function isDragActive(){const t=getGlobalLock(!0);return t?(t(),!1):!0}class Feature{constructor(n){this.isMounted=!1,this.node=n}update(){}}function addHoverEvent(t,n){const o="pointer"+(n?"enter":"leave"),s="onHover"+(n?"Start":"End"),c=(d,h)=>{if(d.pointerType==="touch"||isDragActive())return;const p=t.getProps();t.animationState&&p.whileHover&&t.animationState.setActive("whileHover",n),p[s]&&p[s](d,h)};return addPointerEvent(t.current,o,c,{passive:!t.getProps()[s]})}class HoverGesture extends Feature{mount(){this.unmount=pipe(addHoverEvent(this.node,!0),addHoverEvent(this.node,!1))}unmount(){}}class FocusGesture extends Feature{constructor(){super(...arguments),this.isActive=!1}onFocus(){let n=!1;try{n=this.node.current.matches(":focus-visible")}catch{n=!0}!n||!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=pipe(addDomEvent(this.node.current,"focus",()=>this.onFocus()),addDomEvent(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const isNodeOrChild=(t,n)=>n?t===n?!0:isNodeOrChild(t,n.parentElement):!1;function fireSyntheticPointerEvent(t,n){if(!n)return;const o=new PointerEvent("pointer"+t);n(o,extractEventInfo(o))}class PressGesture extends Feature{constructor(){super(...arguments),this.removeStartListeners=noop$1,this.removeEndListeners=noop$1,this.removeAccessibleListeners=noop$1,this.startPointerPress=(n,o)=>{if(this.isPressing)return;this.removeEndListeners();const s=this.node.getProps(),d=addPointerEvent(window,"pointerup",(p,y)=>{if(!this.checkPressEnd())return;const{onTap:S,onTapCancel:P,globalTapTarget:L}=this.node.getProps();!L&&!isNodeOrChild(this.node.current,p.target)?P&&P(p,y):S&&S(p,y)},{passive:!(s.onTap||s.onPointerUp)}),h=addPointerEvent(window,"pointercancel",(p,y)=>this.cancelPress(p,y),{passive:!(s.onTapCancel||s.onPointerCancel)});this.removeEndListeners=pipe(d,h),this.startPress(n,o)},this.startAccessiblePress=()=>{const n=d=>{if(d.key!=="Enter"||this.isPressing)return;const h=p=>{p.key!=="Enter"||!this.checkPressEnd()||fireSyntheticPointerEvent("up",(y,S)=>{const{onTap:P}=this.node.getProps();P&&P(y,S)})};this.removeEndListeners(),this.removeEndListeners=addDomEvent(this.node.current,"keyup",h),fireSyntheticPointerEvent("down",(p,y)=>{this.startPress(p,y)})},o=addDomEvent(this.node.current,"keydown",n),s=()=>{this.isPressing&&fireSyntheticPointerEvent("cancel",(d,h)=>this.cancelPress(d,h))},c=addDomEvent(this.node.current,"blur",s);this.removeAccessibleListeners=pipe(o,c)}}startPress(n,o){this.isPressing=!0;const{onTapStart:s,whileTap:c}=this.node.getProps();c&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),s&&s(n,o)}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!isDragActive()}cancelPress(n,o){if(!this.checkPressEnd())return;const{onTapCancel:s}=this.node.getProps();s&&s(n,o)}mount(){const n=this.node.getProps(),o=addPointerEvent(n.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(n.onTapStart||n.onPointerStart)}),s=addDomEvent(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=pipe(o,s)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const observerCallbacks=new WeakMap,observers=new WeakMap,fireObserverCallback=t=>{const n=observerCallbacks.get(t.target);n&&n(t)},fireAllObserverCallbacks=t=>{t.forEach(fireObserverCallback)};function initIntersectionObserver({root:t,...n}){const o=t||document;observers.has(o)||observers.set(o,{});const s=observers.get(o),c=JSON.stringify(n);return s[c]||(s[c]=new IntersectionObserver(fireAllObserverCallbacks,{root:t,...n})),s[c]}function observeIntersection(t,n,o){const s=initIntersectionObserver(n);return observerCallbacks.set(t,o),s.observe(t),()=>{observerCallbacks.delete(t),s.unobserve(t)}}const thresholdNames={some:0,all:1};class InViewFeature extends Feature{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:n={}}=this.node.getProps(),{root:o,margin:s,amount:c="some",once:d}=n,h={root:o?o.current:void 0,rootMargin:s,threshold:typeof c=="number"?c:thresholdNames[c]},p=y=>{const{isIntersecting:S}=y;if(this.isInView===S||(this.isInView=S,d&&!S&&this.hasEnteredView))return;S&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",S);const{onViewportEnter:P,onViewportLeave:L}=this.node.getProps(),F=S?P:L;F&&F(y)};return observeIntersection(this.node.current,h,p)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:n,prevProps:o}=this.node;["amount","margin","root"].some(hasViewportOptionChanged(n,o))&&this.startObserver()}unmount(){}}function hasViewportOptionChanged({viewport:t={}},{viewport:n={}}={}){return o=>t[o]!==n[o]}const gestureAnimations={inView:{Feature:InViewFeature},tap:{Feature:PressGesture},focus:{Feature:FocusGesture},hover:{Feature:HoverGesture}};function shallowCompare(t,n){if(!Array.isArray(n))return!1;const o=n.length;if(o!==t.length)return!1;for(let s=0;s<o;s++)if(n[s]!==t[s])return!1;return!0}function getCurrent(t){const n={};return t.values.forEach((o,s)=>n[s]=o.get()),n}function getVelocity$1(t){const n={};return t.values.forEach((o,s)=>n[s]=o.getVelocity()),n}function resolveVariant(t,n,o){const s=t.getProps();return resolveVariantFromProps(s,n,o!==void 0?o:s.custom,getCurrent(t),getVelocity$1(t))}const secondsToMilliseconds=t=>t*1e3,millisecondsToSeconds=t=>t/1e3,underDampedSpring={type:"spring",stiffness:500,damping:25,restSpeed:10},criticallyDampedSpring=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),keyframesTransition={type:"keyframes",duration:.8},ease={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},getDefaultTransition=(t,{keyframes:n})=>n.length>2?keyframesTransition:transformProps.has(t)?t.startsWith("scale")?criticallyDampedSpring(n[1]):underDampedSpring:ease;function isTransitionDefined({when:t,delay:n,delayChildren:o,staggerChildren:s,staggerDirection:c,repeat:d,repeatType:h,repeatDelay:p,from:y,elapsed:S,...P}){return!!Object.keys(P).length}function getValueTransition(t,n){return t[n]||t.default||t}const isNotNull=t=>t!==null;function getFinalKeyframe(t,{repeat:n,repeatType:o="loop"},s){const c=t.filter(isNotNull),d=n&&o!=="loop"&&n%2===1?0:c.length-1;return!d||s===void 0?c[d]:s}let now;function clearTime(){now=void 0}const time={now:()=>(now===void 0&&time.set(frameData.isProcessing||MotionGlobalConfig.useManualTiming?frameData.timestamp:performance.now()),now),set:t=>{now=t,queueMicrotask(clearTime)}},isZeroValueString=t=>/^0[^.\s]+$/u.test(t);function isNone(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||isZeroValueString(t):!0}let warning=noop$1,invariant=noop$1;process.env.NODE_ENV!=="production"&&(warning=(t,n)=>{!t&&typeof console<"u"&&console.warn(n)},invariant=(t,n)=>{if(!t)throw new Error(n)});const isNumericalString=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),splitCSSVariableRegex=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function parseCSSVariable(t){const n=splitCSSVariableRegex.exec(t);if(!n)return[,];const[,o,s,c]=n;return[`--${o??s}`,c]}const maxDepth=4;function getVariableValue(t,n,o=1){invariant(o<=maxDepth,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[s,c]=parseCSSVariable(t);if(!s)return;const d=window.getComputedStyle(n).getPropertyValue(s);if(d){const h=d.trim();return isNumericalString(h)?parseFloat(h):h}return isCSSVariableToken(c)?getVariableValue(c,n,o+1):c}const positionalKeys=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),isNumOrPxType=t=>t===number||t===px,getPosFromMatrix=(t,n)=>parseFloat(t.split(", ")[n]),getTranslateFromMatrix=(t,n)=>(o,{transform:s})=>{if(s==="none"||!s)return 0;const c=s.match(/^matrix3d\((.+)\)$/u);if(c)return getPosFromMatrix(c[1],n);{const d=s.match(/^matrix\((.+)\)$/u);return d?getPosFromMatrix(d[1],t):0}},transformKeys=new Set(["x","y","z"]),nonTranslationalTransformKeys=transformPropOrder.filter(t=>!transformKeys.has(t));function removeNonTranslationalTransform(t){const n=[];return nonTranslationalTransformKeys.forEach(o=>{const s=t.getValue(o);s!==void 0&&(n.push([o,s.get()]),s.set(o.startsWith("scale")?1:0))}),n}const positionalValues={width:({x:t},{paddingLeft:n="0",paddingRight:o="0"})=>t.max-t.min-parseFloat(n)-parseFloat(o),height:({y:t},{paddingTop:n="0",paddingBottom:o="0"})=>t.max-t.min-parseFloat(n)-parseFloat(o),top:(t,{top:n})=>parseFloat(n),left:(t,{left:n})=>parseFloat(n),bottom:({y:t},{top:n})=>parseFloat(n)+(t.max-t.min),right:({x:t},{left:n})=>parseFloat(n)+(t.max-t.min),x:getTranslateFromMatrix(4,13),y:getTranslateFromMatrix(5,14)};positionalValues.translateX=positionalValues.x,positionalValues.translateY=positionalValues.y;const testValueType=t=>n=>n.test(t),auto={test:t=>t==="auto",parse:t=>t},dimensionValueTypes=[number,px,percent,degrees,vw,vh,auto],findDimensionValueType=t=>dimensionValueTypes.find(testValueType(t)),toResolve=new Set;let isScheduled=!1,anyNeedsMeasurement=!1;function measureAllKeyframes(){if(anyNeedsMeasurement){const t=Array.from(toResolve).filter(s=>s.needsMeasurement),n=new Set(t.map(s=>s.element)),o=new Map;n.forEach(s=>{removeNonTranslationalTransform(s).length&&(o.set(s,removeNonTranslationalTransform(s)),s.render())}),t.forEach(s=>s.measureInitialState()),n.forEach(s=>{s.render()}),t.forEach(s=>s.measureEndState()),t.forEach(s=>{s.suspendedScrollY!==void 0&&window.scrollTo(0,s.suspendedScrollY)})}anyNeedsMeasurement=!1,isScheduled=!1,toResolve.forEach(t=>t.complete()),toResolve.clear()}function readAllKeyframes(){toResolve.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(anyNeedsMeasurement=!0)})}function flushKeyframeResolvers(){readAllKeyframes(),measureAllKeyframes()}class KeyframeResolver{constructor(n,o,s,c,d,h=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...n],this.onComplete=o,this.name=s,this.motionValue=c,this.element=d,this.isAsync=h}scheduleResolve(){this.isScheduled=!0,this.isAsync?(toResolve.add(this),isScheduled||(isScheduled=!0,frame.read(readAllKeyframes),frame.resolveKeyframes(measureAllKeyframes))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:n,name:o,element:s,motionValue:c}=this;for(let d=0;d<n.length;d++)if(n[d]===null)if(d===0){const h=c==null?void 0:c.get(),p=n[n.length-1];if(h!==void 0)n[0]=h;else if(s&&o){const y=s.readValue(o,p);y!=null&&(n[0]=y)}n[0]===void 0&&(n[0]=p),c&&h===void 0&&c.set(n[0])}else n[d]=n[d-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),toResolve.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,toResolve.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const isColorString=(t,n)=>o=>!!(isString$1(o)&&singleColorRegex.test(o)&&o.startsWith(t)||n&&Object.prototype.hasOwnProperty.call(o,n)),splitColor=(t,n,o)=>s=>{if(!isString$1(s))return s;const[c,d,h,p]=s.match(floatRegex);return{[t]:parseFloat(c),[n]:parseFloat(d),[o]:parseFloat(h),alpha:p!==void 0?parseFloat(p):1}},clampRgbUnit=t=>clamp(0,255,t),rgbUnit={...number,transform:t=>Math.round(clampRgbUnit(t))},rgba={test:isColorString("rgb","red"),parse:splitColor("red","green","blue"),transform:({red:t,green:n,blue:o,alpha:s=1})=>"rgba("+rgbUnit.transform(t)+", "+rgbUnit.transform(n)+", "+rgbUnit.transform(o)+", "+sanitize(alpha.transform(s))+")"};function parseHex(t){let n="",o="",s="",c="";return t.length>5?(n=t.substring(1,3),o=t.substring(3,5),s=t.substring(5,7),c=t.substring(7,9)):(n=t.substring(1,2),o=t.substring(2,3),s=t.substring(3,4),c=t.substring(4,5),n+=n,o+=o,s+=s,c+=c),{red:parseInt(n,16),green:parseInt(o,16),blue:parseInt(s,16),alpha:c?parseInt(c,16)/255:1}}const hex={test:isColorString("#"),parse:parseHex,transform:rgba.transform},hsla={test:isColorString("hsl","hue"),parse:splitColor("hue","saturation","lightness"),transform:({hue:t,saturation:n,lightness:o,alpha:s=1})=>"hsla("+Math.round(t)+", "+percent.transform(sanitize(n))+", "+percent.transform(sanitize(o))+", "+sanitize(alpha.transform(s))+")"},color={test:t=>rgba.test(t)||hex.test(t)||hsla.test(t),parse:t=>rgba.test(t)?rgba.parse(t):hsla.test(t)?hsla.parse(t):hex.parse(t),transform:t=>isString$1(t)?t:t.hasOwnProperty("red")?rgba.transform(t):hsla.transform(t)};function test(t){var n,o;return isNaN(t)&&isString$1(t)&&(((n=t.match(floatRegex))===null||n===void 0?void 0:n.length)||0)+(((o=t.match(colorRegex))===null||o===void 0?void 0:o.length)||0)>0}const NUMBER_TOKEN="number",COLOR_TOKEN="color",VAR_TOKEN="var",VAR_FUNCTION_TOKEN="var(",SPLIT_TOKEN="${}",complexRegex=/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 analyseComplexValue(t){const n=t.toString(),o=[],s={color:[],number:[],var:[]},c=[];let d=0;const p=n.replace(complexRegex,y=>(color.test(y)?(s.color.push(d),c.push(COLOR_TOKEN),o.push(color.parse(y))):y.startsWith(VAR_FUNCTION_TOKEN)?(s.var.push(d),c.push(VAR_TOKEN),o.push(y)):(s.number.push(d),c.push(NUMBER_TOKEN),o.push(parseFloat(y))),++d,SPLIT_TOKEN)).split(SPLIT_TOKEN);return{values:o,split:p,indexes:s,types:c}}function parseComplexValue(t){return analyseComplexValue(t).values}function createTransformer(t){const{split:n,types:o}=analyseComplexValue(t),s=n.length;return c=>{let d="";for(let h=0;h<s;h++)if(d+=n[h],c[h]!==void 0){const p=o[h];p===NUMBER_TOKEN?d+=sanitize(c[h]):p===COLOR_TOKEN?d+=color.transform(c[h]):d+=c[h]}return d}}const convertNumbersToZero=t=>typeof t=="number"?0:t;function getAnimatableNone$1(t){const n=parseComplexValue(t);return createTransformer(t)(n.map(convertNumbersToZero))}const complex={test,parse:parseComplexValue,createTransformer,getAnimatableNone:getAnimatableNone$1},maxDefaults=new Set(["brightness","contrast","saturate","opacity"]);function applyDefaultFilter(t){const[n,o]=t.slice(0,-1).split("(");if(n==="drop-shadow")return t;const[s]=o.match(floatRegex)||[];if(!s)return t;const c=o.replace(s,"");let d=maxDefaults.has(n)?1:0;return s!==o&&(d*=100),n+"("+d+c+")"}const functionRegex=/\b([a-z-]*)\(.*?\)/gu,filter={...complex,getAnimatableNone:t=>{const n=t.match(functionRegex);return n?n.map(applyDefaultFilter).join(" "):t}},defaultValueTypes={...numberValueTypes,color,backgroundColor:color,outlineColor:color,fill:color,stroke:color,borderColor:color,borderTopColor:color,borderRightColor:color,borderBottomColor:color,borderLeftColor:color,filter,WebkitFilter:filter},getDefaultValueType=t=>defaultValueTypes[t];function getAnimatableNone(t,n){let o=getDefaultValueType(t);return o!==filter&&(o=complex),o.getAnimatableNone?o.getAnimatableNone(n):void 0}function makeNoneKeyframesAnimatable(t,n,o){let s=0,c;for(;s<t.length&&!c;)typeof t[s]=="string"&&t[s]!=="none"&&t[s]!=="0"&&(c=t[s]),s++;if(c&&o)for(const d of n)t[d]=getAnimatableNone(o,c)}class DOMKeyframesResolver extends KeyframeResolver{constructor(n,o,s,c){super(n,o,s,c,c==null?void 0:c.owner,!0)}readKeyframes(){const{unresolvedKeyframes:n,element:o,name:s}=this;if(!o.current)return;super.readKeyframes();for(let y=0;y<n.length;y++){const S=n[y];if(typeof S=="string"&&isCSSVariableToken(S)){const P=getVariableValue(S,o.current);P!==void 0&&(n[y]=P)}}if(!positionalKeys.has(s)||n.length!==2)return this.resolveNoneKeyframes();const[c,d]=n,h=findDimensionValueType(c),p=findDimensionValueType(d);if(h!==p)if(isNumOrPxType(h)&&isNumOrPxType(p))for(let y=0;y<n.length;y++){const S=n[y];typeof S=="string"&&(n[y]=parseFloat(S))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:n,name:o}=this,s=[];for(let c=0;c<n.length;c++)isNone(n[c])&&s.push(c);s.length&&makeNoneKeyframesAnimatable(n,s,o)}measureInitialState(){const{element:n,unresolvedKeyframes:o,name:s}=this;if(!n.current)return;s==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=positionalValues[s](n.measureViewportBox(),window.getComputedStyle(n.current)),o[0]=this.measuredOrigin;const c=o[o.length-1];c!==void 0&&n.getValue(s,c).jump(c,!1)}measureEndState(){var n;const{element:o,name:s,unresolvedKeyframes:c}=this;if(!o.current)return;const d=o.getValue(s);d&&d.jump(this.measuredOrigin,!1);const h=c.length-1,p=c[h];c[h]=positionalValues[s](o.measureViewportBox(),window.getComputedStyle(o.current)),p!==null&&(this.finalKeyframe=p),!((n=this.removedTransforms)===null||n===void 0)&&n.length&&this.removedTransforms.forEach(([y,S])=>{o.getValue(y).set(S)}),this.resolveNoneKeyframes()}}function memo(t){let n;return()=>(n===void 0&&(n=t()),n)}const isAnimatable=(t,n)=>n==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(complex.test(t)||t==="0")&&!t.startsWith("url("));function hasKeyframesChanged(t){const n=t[0];if(t.length===1)return!0;for(let o=0;o<t.length;o++)if(t[o]!==n)return!0}function canAnimate(t,n,o,s){const c=t[0];if(c===null)return!1;const d=t[t.length-1],h=isAnimatable(c,n),p=isAnimatable(d,n);return warning(h===p,`You are trying to animate ${n} from "${c}" to "${d}". ${c} is not an animatable value - to enable this animation set ${c} to a value animatable to ${d} via the \`style\` property.`),!h||!p?!1:hasKeyframesChanged(t)||o==="spring"&&s}class BaseAnimation{constructor({autoplay:n=!0,delay:o=0,type:s="keyframes",repeat:c=0,repeatDelay:d=0,repeatType:h="loop",...p}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.options={autoplay:n,delay:o,type:s,repeat:c,repeatDelay:d,repeatType:h,...p},this.updateFinishedPromise()}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&flushKeyframeResolvers(),this._resolved}onKeyframesResolved(n,o){this.hasAttemptedResolve=!0;const{name:s,type:c,velocity:d,delay:h,onComplete:p,onUpdate:y,isGenerator:S}=this.options;if(!S&&!canAnimate(n,s,c,d))if(h)this.options.duration=0;else{y==null||y(getFinalKeyframe(n,this.options,o)),p==null||p(),this.resolveFinishedPromise();return}const P=this.initPlayback(n,o);P!==!1&&(this._resolved={keyframes:n,finalKeyframe:o,...P},this.onPostResolved())}onPostResolved(){}then(n,o){return this.currentFinishedPromise.then(n,o)}updateFinishedPromise(){this.currentFinishedPromise=new Promise(n=>{this.resolveFinishedPromise=n})}}function velocityPerSecond(t,n){return n?t*(1e3/n):0}const velocitySampleDuration=5;function calcGeneratorVelocity(t,n,o){const s=Math.max(n-velocitySampleDuration,0);return velocityPerSecond(o-t(s),n-s)}const safeMin=.001,minDuration=.01,maxDuration$1=10,minDamping=.05,maxDamping=1;function findSpring({duration:t=800,bounce:n=.25,velocity:o=0,mass:s=1}){let c,d;warning(t<=secondsToMilliseconds(maxDuration$1),"Spring duration must be 10 seconds or less");let h=1-n;h=clamp(minDamping,maxDamping,h),t=clamp(minDuration,maxDuration$1,millisecondsToSeconds(t)),h<1?(c=S=>{const P=S*h,L=P*t,F=P-o,N=calcAngularFreq(S,h),z=Math.exp(-L);return safeMin-F/N*z},d=S=>{const L=S*h*t,F=L*o+o,N=Math.pow(h,2)*Math.pow(S,2)*t,z=Math.exp(-L),W=calcAngularFreq(Math.pow(S,2),h);return(-c(S)+safeMin>0?-1:1)*((F-N)*z)/W}):(c=S=>{const P=Math.exp(-S*t),L=(S-o)*t+1;return-.001+P*L},d=S=>{const P=Math.exp(-S*t),L=(o-S)*(t*t);return P*L});const p=5/t,y=approximateRoot(c,d,p);if(t=secondsToMilliseconds(t),isNaN(y))return{stiffness:100,damping:10,duration:t};{const S=Math.pow(y,2)*s;return{stiffness:S,damping:h*2*Math.sqrt(s*S),duration:t}}}const rootIterations=12;function approximateRoot(t,n,o){let s=o;for(let c=1;c<rootIterations;c++)s=s-t(s)/n(s);return s}function calcAngularFreq(t,n){return t*Math.sqrt(1-n*n)}const durationKeys=["duration","bounce"],physicsKeys=["stiffness","damping","mass"];function isSpringType(t,n){return n.some(o=>t[o]!==void 0)}function getSpringOptions(t){let n={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!isSpringType(t,physicsKeys)&&isSpringType(t,durationKeys)){const o=findSpring(t);n={...n,...o,mass:1},n.isResolvedFromDuration=!0}return n}function spring({keyframes:t,restDelta:n,restSpeed:o,...s}){const c=t[0],d=t[t.length-1],h={done:!1,value:c},{stiffness:p,damping:y,mass:S,duration:P,velocity:L,isResolvedFromDuration:F}=getSpringOptions({...s,velocity:-millisecondsToSeconds(s.velocity||0)}),N=L||0,z=y/(2*Math.sqrt(p*S)),W=d-c,nt=millisecondsToSeconds(Math.sqrt(p/S)),Pe=Math.abs(W)<5;o||(o=Pe?.01:2),n||(n=Pe?.005:.5);let se;if(z<1){const mt=calcAngularFreq(nt,z);se=kt=>{const mn=Math.exp(-z*nt*kt);return d-mn*((N+z*nt*W)/mt*Math.sin(mt*kt)+W*Math.cos(mt*kt))}}else if(z===1)se=mt=>d-Math.exp(-nt*mt)*(W+(N+nt*W)*mt);else{const mt=nt*Math.sqrt(z*z-1);se=kt=>{const mn=Math.exp(-z*nt*kt),_i=Math.min(mt*kt,300);return d-mn*((N+z*nt*W)*Math.sinh(_i)+mt*W*Math.cosh(_i))/mt}}return{calculatedDuration:F&&P||null,next:mt=>{const kt=se(mt);if(F)h.done=mt>=P;else{let mn=N;mt!==0&&(z<1?mn=calcGeneratorVelocity(se,mt,kt):mn=0);const _i=Math.abs(mn)<=o,zi=Math.abs(d-kt)<=n;h.done=_i&&zi}return h.value=h.done?d:kt,h}}}function inertia({keyframes:t,velocity:n=0,power:o=.8,timeConstant:s=325,bounceDamping:c=10,bounceStiffness:d=500,modifyTarget:h,min:p,max:y,restDelta:S=.5,restSpeed:P}){const L=t[0],F={done:!1,value:L},N=Sa=>p!==void 0&&Sa<p||y!==void 0&&Sa>y,z=Sa=>p===void 0?y:y===void 0||Math.abs(p-Sa)<Math.abs(y-Sa)?p:y;let W=o*n;const nt=L+W,Pe=h===void 0?nt:h(nt);Pe!==nt&&(W=Pe-L);const se=Sa=>-W*Math.exp(-Sa/s),mt=Sa=>Pe+se(Sa),kt=Sa=>{const fa=se(Sa),La=mt(Sa);F.done=Math.abs(fa)<=S,F.value=F.done?Pe:La};let mn,_i;const zi=Sa=>{N(F.value)&&(mn=Sa,_i=spring({keyframes:[F.value,z(F.value)],velocity:calcGeneratorVelocity(mt,Sa,F.value),damping:c,stiffness:d,restDelta:S,restSpeed:P}))};return zi(0),{calculatedDuration:null,next:Sa=>{let fa=!1;return!_i&&mn===void 0&&(fa=!0,kt(Sa),zi(Sa)),mn!==void 0&&Sa>=mn?_i.next(Sa-mn):(!fa&&kt(Sa),F)}}}const calcBezier=(t,n,o)=>(((1-3*o+3*n)*t+(3*o-6*n))*t+3*n)*t,subdivisionPrecision=1e-7,subdivisionMaxIterations=12;function binarySubdivide(t,n,o,s,c){let d,h,p=0;do h=n+(o-n)/2,d=calcBezier(h,s,c)-t,d>0?o=h:n=h;while(Math.abs(d)>subdivisionPrecision&&++p<subdivisionMaxIterations);return h}function cubicBezier(t,n,o,s){if(t===n&&o===s)return noop$1;const c=d=>binarySubdivide(d,0,1,t,o);return d=>d===0||d===1?d:calcBezier(c(d),n,s)}const easeIn=cubicBezier(.42,0,1,1),easeOut=cubicBezier(0,0,.58,1),easeInOut=cubicBezier(.42,0,.58,1),isEasingArray=t=>Array.isArray(t)&&typeof t[0]!="number",mirrorEasing=t=>n=>n<=.5?t(2*n)/2:(2-t(2*(1-n)))/2,reverseEasing=t=>n=>1-t(1-n),circIn=t=>1-Math.sin(Math.acos(t)),circOut=reverseEasing(circIn),circInOut=mirrorEasing(circIn),backOut=cubicBezier(.33,1.53,.69,.99),backIn=reverseEasing(backOut),backInOut=mirrorEasing(backIn),anticipate=t=>(t*=2)<1?.5*backIn(t):.5*(2-Math.pow(2,-10*(t-1))),easingLookup={linear:noop$1,easeIn,easeInOut,easeOut,circIn,circInOut,circOut,backIn,backInOut,backOut,anticipate},easingDefinitionToFunction=t=>{if(Array.isArray(t)){invariant(t.length===4,"Cubic bezier arrays must contain four numerical values.");const[n,o,s,c]=t;return cubicBezier(n,o,s,c)}else if(typeof t=="string")return invariant(easingLookup[t]!==void 0,`Invalid easing type '${t}'`),easingLookup[t];return t},progress=(t,n,o)=>{const s=n-t;return s===0?1:(o-t)/s},mixNumber$1=(t,n,o)=>t+(n-t)*o;function hueToRgb(t,n,o){return o<0&&(o+=1),o>1&&(o-=1),o<1/6?t+(n-t)*6*o:o<1/2?n:o<2/3?t+(n-t)*(2/3-o)*6:t}function hslaToRgba({hue:t,saturation:n,lightness:o,alpha:s}){t/=360,n/=100,o/=100;let c=0,d=0,h=0;if(!n)c=d=h=o;else{const p=o<.5?o*(1+n):o+n-o*n,y=2*o-p;c=hueToRgb(y,p,t+1/3),d=hueToRgb(y,p,t),h=hueToRgb(y,p,t-1/3)}return{red:Math.round(c*255),green:Math.round(d*255),blue:Math.round(h*255),alpha:s}}const mixLinearColor=(t,n,o)=>{const s=t*t,c=o*(n*n-s)+s;return c<0?0:Math.sqrt(c)},colorTypes=[hex,rgba,hsla],getColorType=t=>colorTypes.find(n=>n.test(t));function asRGBA(t){const n=getColorType(t);invariant(!!n,`'${t}' is not an animatable color. Use the equivalent color code instead.`);let o=n.parse(t);return n===hsla&&(o=hslaToRgba(o)),o}const mixColor=(t,n)=>{const o=asRGBA(t),s=asRGBA(n),c={...o};return d=>(c.red=mixLinearColor(o.red,s.red,d),c.green=mixLinearColor(o.green,s.green,d),c.blue=mixLinearColor(o.blue,s.blue,d),c.alpha=mixNumber$1(o.alpha,s.alpha,d),rgba.transform(c))};function mixImmediate(t,n){return o=>o>0?n:t}function mixNumber(t,n){return o=>mixNumber$1(t,n,o)}function getMixer(t){return typeof t=="number"?mixNumber:typeof t=="string"?isCSSVariableToken(t)?mixImmediate:color.test(t)?mixColor:mixComplex:Array.isArray(t)?mixArray:typeof t=="object"?color.test(t)?mixColor:mixObject:mixImmediate}function mixArray(t,n){const o=[...t],s=o.length,c=t.map((d,h)=>getMixer(d)(d,n[h]));return d=>{for(let h=0;h<s;h++)o[h]=c[h](d);return o}}function mixObject(t,n){const o={...t,...n},s={};for(const c in o)t[c]!==void 0&&n[c]!==void 0&&(s[c]=getMixer(t[c])(t[c],n[c]));return c=>{for(const d in s)o[d]=s[d](c);return o}}function matchOrder(t,n){var o;const s=[],c={color:0,var:0,number:0};for(let d=0;d<n.values.length;d++){const h=n.types[d],p=t.indexes[h][c[h]],y=(o=t.values[p])!==null&&o!==void 0?o:0;s[d]=y,c[h]++}return s}const mixComplex=(t,n)=>{const o=complex.createTransformer(n),s=analyseComplexValue(t),c=analyseComplexValue(n);return s.indexes.var.length===c.indexes.var.length&&s.indexes.color.length===c.indexes.color.length&&s.indexes.number.length>=c.indexes.number.length?pipe(mixArray(matchOrder(s,c),c.values),o):(warning(!0,`Complex values '${t}' and '${n}' 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.`),mixImmediate(t,n))};function mix(t,n,o){return typeof t=="number"&&typeof n=="number"&&typeof o=="number"?mixNumber$1(t,n,o):getMixer(t)(t,n)}function createMixers(t,n,o){const s=[],c=o||mix,d=t.length-1;for(let h=0;h<d;h++){let p=c(t[h],t[h+1]);if(n){const y=Array.isArray(n)?n[h]||noop$1:n;p=pipe(y,p)}s.push(p)}return s}function interpolate(t,n,{clamp:o=!0,ease:s,mixer:c}={}){const d=t.length;if(invariant(d===n.length,"Both input and output ranges must be the same length"),d===1)return()=>n[0];if(d===2&&t[0]===t[1])return()=>n[1];t[0]>t[d-1]&&(t=[...t].reverse(),n=[...n].reverse());const h=createMixers(n,s,c),p=h.length,y=S=>{let P=0;if(p>1)for(;P<t.length-2&&!(S<t[P+1]);P++);const L=progress(t[P],t[P+1],S);return h[P](L)};return o?S=>y(clamp(t[0],t[d-1],S)):y}function fillOffset(t,n){const o=t[t.length-1];for(let s=1;s<=n;s++){const c=progress(0,n,s);t.push(mixNumber$1(o,1,c))}}function defaultOffset(t){const n=[0];return fillOffset(n,t.length-1),n}function convertOffsetToTimes(t,n){return t.map(o=>o*n)}function defaultEasing(t,n){return t.map(()=>n||easeInOut).splice(0,t.length-1)}function keyframes({duration:t=300,keyframes:n,times:o,ease:s="easeInOut"}){const c=isEasingArray(s)?s.map(easingDefinitionToFunction):easingDefinitionToFunction(s),d={done:!1,value:n[0]},h=convertOffsetToTimes(o&&o.length===n.length?o:defaultOffset(n),t),p=interpolate(h,n,{ease:Array.isArray(c)?c:defaultEasing(n,c)});return{calculatedDuration:t,next:y=>(d.value=p(y),d.done=y>=t,d)}}const maxGeneratorDuration=2e4;function calcGeneratorDuration(t){let n=0;const o=50;let s=t.next(n);for(;!s.done&&n<maxGeneratorDuration;)n+=o,s=t.next(n);return n>=maxGeneratorDuration?1/0:n}const frameloopDriver=t=>{const n=({timestamp:o})=>t(o);return{start:()=>frame.update(n,!0),stop:()=>cancelFrame(n),now:()=>frameData.isProcessing?frameData.timestamp:time.now()}},generators={decay:inertia,inertia,tween:keyframes,keyframes,spring},percentToProgress=t=>t/100;class MainThreadAnimation extends BaseAnimation{constructor({KeyframeResolver:n=KeyframeResolver,...o}){super(o),this.holdTime=null,this.startTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.state="idle";const{name:s,motionValue:c,keyframes:d}=this.options,h=(p,y)=>this.onKeyframesResolved(p,y);s&&c&&c.owner?this.resolver=c.owner.resolveKeyframes(d,h,s,c):this.resolver=new n(d,h,s,c),this.resolver.scheduleResolve()}initPlayback(n){const{type:o="keyframes",repeat:s=0,repeatDelay:c=0,repeatType:d,velocity:h=0}=this.options,p=generators[o]||keyframes;let y,S;p!==keyframes&&typeof n[0]!="number"&&(process.env.NODE_ENV!=="production"&&invariant(n.length===2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${n}`),y=pipe(percentToProgress,mix(n[0],n[1])),n=[0,100]);const P=p({...this.options,keyframes:n});d==="mirror"&&(S=p({...this.options,keyframes:[...n].reverse(),velocity:-h})),P.calculatedDuration===null&&(P.calculatedDuration=calcGeneratorDuration(P));const{calculatedDuration:L}=P,F=L+c,N=F*(s+1)-c;return{generator:P,mirroredGenerator:S,mapPercentToKeyframes:y,calculatedDuration:L,resolvedDuration:F,totalDuration:N}}onPostResolved(){const{autoplay:n=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!n?this.pause():this.state=this.pendingPlayState}tick(n,o=!1){const{resolved:s}=this;if(!s){const{keyframes:Sa}=this.options;return{done:!0,value:Sa[Sa.length-1]}}const{finalKeyframe:c,generator:d,mirroredGenerator:h,mapPercentToKeyframes:p,keyframes:y,calculatedDuration:S,totalDuration:P,resolvedDuration:L}=s;if(this.startTime===null)return d.next(0);const{delay:F,repeat:N,repeatType:z,repeatDelay:W,onUpdate:nt}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,n):this.speed<0&&(this.startTime=Math.min(n-P/this.speed,this.startTime)),o?this.currentTime=n:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(n-this.startTime)*this.speed;const Pe=this.currentTime-F*(this.speed>=0?1:-1),se=this.speed>=0?Pe<0:Pe>P;this.currentTime=Math.max(Pe,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=P);let mt=this.currentTime,kt=d;if(N){const Sa=Math.min(this.currentTime,P)/L;let fa=Math.floor(Sa),La=Sa%1;!La&&Sa>=1&&(La=1),La===1&&fa--,fa=Math.min(fa,N+1),!!(fa%2)&&(z==="reverse"?(La=1-La,W&&(La-=W/L)):z==="mirror"&&(kt=h)),mt=clamp(0,1,La)*L}const mn=se?{done:!1,value:y[0]}:kt.next(mt);p&&(mn.value=p(mn.value));let{done:_i}=mn;!se&&S!==null&&(_i=this.speed>=0?this.currentTime>=P:this.currentTime<=0);const zi=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&_i);return zi&&c!==void 0&&(mn.value=getFinalKeyframe(y,this.options,c)),nt&&nt(mn.value),zi&&this.finish(),mn}get duration(){const{resolved:n}=this;return n?millisecondsToSeconds(n.calculatedDuration):0}get time(){return millisecondsToSeconds(this.currentTime)}set time(n){n=secondsToMilliseconds(n),this.currentTime=n,this.holdTime!==null||this.speed===0?this.holdTime=n:this.driver&&(this.startTime=this.driver.now()-n/this.speed)}get speed(){return this.playbackSpeed}set speed(n){const o=this.playbackSpeed!==n;this.playbackSpeed=n,o&&(this.time=millisecondsToSeconds(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:n=frameloopDriver,onPlay:o}=this.options;this.driver||(this.driver=n(c=>this.tick(c))),o&&o();const s=this.driver.now();this.holdTime!==null?this.startTime=s-this.holdTime:(!this.startTime||this.state==="finished")&&(this.startTime=s),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var n;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(n=this.currentTime)!==null&&n!==void 0?n:0}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:n}=this.options;n&&n()}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:n}=this.options;n&&n()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(n){return this.startTime=0,this.tick(n,!0)}}const isBezierDefinition=t=>Array.isArray(t)&&typeof t[0]=="number";function isWaapiSupportedEasing(t){return!!(!t||typeof t=="string"&&supportedWaapiEasing[t]||isBezierDefinition(t)||Array.isArray(t)&&t.every(isWaapiSupportedEasing))}const cubicBezierAsString=([t,n,o,s])=>`cubic-bezier(${t}, ${n}, ${o}, ${s})`,supportedWaapiEasing={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:cubicBezierAsString([0,.65,.55,1]),circOut:cubicBezierAsString([.55,0,1,.45]),backIn:cubicBezierAsString([.31,.01,.66,-.59]),backOut:cubicBezierAsString([.33,1.53,.69,.99])};function mapEasingToNativeEasing(t){if(t)return isBezierDefinition(t)?cubicBezierAsString(t):Array.isArray(t)?t.map(mapEasingToNativeEasing):supportedWaapiEasing[t]}function animateStyle(t,n,o,{delay:s=0,duration:c=300,repeat:d=0,repeatType:h="loop",ease:p,times:y}={}){const S={[n]:o};y&&(S.offset=y);const P=mapEasingToNativeEasing(p);return Array.isArray(P)&&(S.easing=P),t.animate(S,{delay:s,duration:c,easing:Array.isArray(P)?"linear":P,fill:"both",iterations:d+1,direction:h==="reverse"?"alternate":"normal"})}const supportsWaapi=memo(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),acceleratedValues=new Set(["opacity","clipPath","filter","transform"]),sampleDelta=10,maxDuration=2e4;function requiresPregeneratedKeyframes(t){return t.type==="spring"||t.name==="backgroundColor"||!isWaapiSupportedEasing(t.ease)}function pregenerateKeyframes(t,n){const o=new MainThreadAnimation({...n,keyframes:t,repeat:0,delay:0,isGenerator:!0});let s={done:!1,value:t[0]};const c=[];let d=0;for(;!s.done&&d<maxDuration;)s=o.sample(d),c.push(s.value),d+=sampleDelta;return{times:void 0,keyframes:c,duration:d-sampleDelta,ease:"linear"}}class AcceleratedAnimation extends BaseAnimation{constructor(n){super(n);const{name:o,motionValue:s,keyframes:c}=this.options;this.resolver=new DOMKeyframesResolver(c,(d,h)=>this.onKeyframesResolved(d,h),o,s),this.resolver.scheduleResolve()}initPlayback(n,o){var s;let{duration:c=300,times:d,ease:h,type:p,motionValue:y,name:S}=this.options;if(!(!((s=y.owner)===null||s===void 0)&&s.current))return!1;if(requiresPregeneratedKeyframes(this.options)){const{onComplete:L,onUpdate:F,motionValue:N,...z}=this.options,W=pregenerateKeyframes(n,z);n=W.keyframes,n.length===1&&(n[1]=n[0]),c=W.duration,d=W.times,h=W.ease,p="keyframes"}const P=animateStyle(y.owner.current,S,n,{...this.options,duration:c,times:d,ease:h});return P.startTime=time.now(),this.pendingTimeline?(P.timeline=this.pendingTimeline,this.pendingTimeline=void 0):P.onfinish=()=>{const{onComplete:L}=this.options;y.set(getFinalKeyframe(n,this.options,o)),L&&L(),this.cancel(),this.resolveFinishedPromise()},{animation:P,duration:c,times:d,type:p,ease:h,keyframes:n}}get duration(){const{resolved:n}=this;if(!n)return 0;const{duration:o}=n;return millisecondsToSeconds(o)}get time(){const{resolved:n}=this;if(!n)return 0;const{animation:o}=n;return millisecondsToSeconds(o.currentTime||0)}set time(n){const{resolved:o}=this;if(!o)return;const{animation:s}=o;s.currentTime=secondsToMilliseconds(n)}get speed(){const{resolved:n}=this;if(!n)return 1;const{animation:o}=n;return o.playbackRate}set speed(n){const{resolved:o}=this;if(!o)return;const{animation:s}=o;s.playbackRate=n}get state(){const{resolved:n}=this;if(!n)return"idle";const{animation:o}=n;return o.playState}attachTimeline(n){if(!this._resolved)this.pendingTimeline=n;else{const{resolved:o}=this;if(!o)return noop$1;const{animation:s}=o;s.timeline=n,s.onfinish=null}return noop$1}play(){if(this.isStopped)return;const{resolved:n}=this;if(!n)return;const{animation:o}=n;o.playState==="finished"&&this.updateFinishedPromise(),o.play()}pause(){const{resolved:n}=this;if(!n)return;const{animation:o}=n;o.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;const{resolved:n}=this;if(!n)return;const{animation:o,keyframes:s,duration:c,type:d,ease:h,times:p}=n;if(!(o.playState==="idle"||o.playState==="finished")){if(this.time){const{motionValue:y,onUpdate:S,onComplete:P,...L}=this.options,F=new MainThreadAnimation({...L,keyframes:s,duration:c,type:d,ease:h,times:p,isGenerator:!0}),N=secondsToMilliseconds(this.time);y.setWithVelocity(F.sample(N-sampleDelta).value,F.sample(N).value,sampleDelta)}this.cancel()}}complete(){const{resolved:n}=this;n&&n.animation.finish()}cancel(){const{resolved:n}=this;n&&n.animation.cancel()}static supports(n){const{motionValue:o,name:s,repeatDelay:c,repeatType:d,damping:h,type:p}=n;return supportsWaapi()&&s&&acceleratedValues.has(s)&&o&&o.owner&&o.owner.current instanceof HTMLElement&&!o.owner.getProps().onUpdate&&!c&&d!=="mirror"&&h!==0&&p!=="inertia"}}const animateMotionValue=(t,n,o,s={},c,d)=>h=>{const p=getValueTransition(s,t)||{},y=p.delay||s.delay||0;let{elapsed:S=0}=s;S=S-secondsToMilliseconds(y);let P={keyframes:Array.isArray(o)?o:[null,o],ease:"easeOut",velocity:n.getVelocity(),...p,delay:-S,onUpdate:F=>{n.set(F),p.onUpdate&&p.onUpdate(F)},onComplete:()=>{h(),p.onComplete&&p.onComplete()},name:t,motionValue:n,element:d?void 0:c};isTransitionDefined(p)||(P={...P,...getDefaultTransition(t,P)}),P.duration&&(P.duration=secondsToMilliseconds(P.duration)),P.repeatDelay&&(P.repeatDelay=secondsToMilliseconds(P.repeatDelay)),P.from!==void 0&&(P.keyframes[0]=P.from);let L=!1;if((P.type===!1||P.duration===0&&!P.repeatDelay)&&(P.duration=0,P.delay===0&&(L=!0)),L&&!d&&n.get()!==void 0){const F=getFinalKeyframe(P.keyframes,p);if(F!==void 0){frame.update(()=>{P.onUpdate(F),P.onComplete()});return}}return!d&&AcceleratedAnimation.supports(P)?new AcceleratedAnimation(P):new MainThreadAnimation(P)};function isWillChangeMotionValue(t){return!!(isMotionValue(t)&&t.add)}function addUniqueItem(t,n){t.indexOf(n)===-1&&t.push(n)}function removeItem(t,n){const o=t.indexOf(n);o>-1&&t.splice(o,1)}class SubscriptionManager{constructor(){this.subscriptions=[]}add(n){return addUniqueItem(this.subscriptions,n),()=>removeItem(this.subscriptions,n)}notify(n,o,s){const c=this.subscriptions.length;if(c)if(c===1)this.subscriptions[0](n,o,s);else for(let d=0;d<c;d++){const h=this.subscriptions[d];h&&h(n,o,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const warned=new Set;function warnOnce(t,n,o){t||warned.has(n)||(console.warn(n),warned.add(n))}const MAX_VELOCITY_DELTA=30,isFloat=t=>!isNaN(parseFloat(t));class MotionValue{constructor(n,o={}){this.version="11.0.27",this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(s,c=!0)=>{const d=time.now();this.updatedAt!==d&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(s),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),c&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(n),this.canTrackVelocity=isFloat(this.current),this.owner=o.owner}setCurrent(n){this.current=n,this.updatedAt=time.now()}setPrevFrameValue(n=this.current){this.prevFrameValue=n,this.prevUpdatedAt=this.updatedAt}onChange(n){return process.env.NODE_ENV!=="production"&&warnOnce(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",n)}on(n,o){this.events[n]||(this.events[n]=new SubscriptionManager);const s=this.events[n].add(o);return n==="change"?()=>{s(),frame.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const n in this.events)this.events[n].clear()}attach(n,o){this.passiveEffect=n,this.stopPassiveEffect=o}set(n,o=!0){!o||!this.passiveEffect?this.updateAndNotify(n,o):this.passiveEffect(n,this.updateAndNotify)}setWithVelocity(n,o,s){this.set(o),this.prev=void 0,this.prevFrameValue=n,this.prevUpdatedAt=this.updatedAt-s}jump(n,o=!0){this.updateAndNotify(n),this.prev=n,this.prevUpdatedAt=this.prevFrameValue=void 0,o&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const n=time.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||n-this.updatedAt>MAX_VELOCITY_DELTA)return 0;const o=Math.min(this.updatedAt-this.prevUpdatedAt,MAX_VELOCITY_DELTA);return velocityPerSecond(parseFloat(this.current)-parseFloat(this.prevFrameValue),o)}start(n){return this.stop(),new Promise(o=>{this.hasAnimated=!0,this.animation=n(o),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.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function motionValue(t,n){return new MotionValue(t,n)}function setMotionValue(t,n,o){t.hasValue(n)?t.getValue(n).set(o):t.addValue(n,motionValue(o))}function setTarget(t,n){const o=resolveVariant(t,n);let{transitionEnd:s={},transition:c={},...d}=o||{};d={...d,...s};for(const h in d){const p=resolveFinalValueInKeyframes(d[h]);setMotionValue(t,h,p)}}function shouldBlockAnimation({protectedKeys:t,needsAnimating:n},o){const s=t.hasOwnProperty(o)&&n[o]!==!0;return n[o]=!1,s}function animateTarget(t,n,{delay:o=0,transitionOverride:s,type:c}={}){var d;let{transition:h=t.getDefaultTransition(),transitionEnd:p,...y}=n;const S=t.getValue("willChange");s&&(h=s);const P=[],L=c&&t.animationState&&t.animationState.getState()[c];for(const F in y){const N=t.getValue(F,(d=t.latestValues[F])!==null&&d!==void 0?d:null),z=y[F];if(z===void 0||L&&shouldBlockAnimation(L,F))continue;const W={delay:o,elapsed:0,...getValueTransition(h||{},F)};let nt=!1;if(window.HandoffAppearAnimations){const se=t.getProps()[optimizedAppearDataAttribute];if(se){const mt=window.HandoffAppearAnimations(se,F);mt!==null&&(W.elapsed=mt,nt=!0)}}N.start(animateMotionValue(F,N,z,t.shouldReduceMotion&&transformProps.has(F)?{type:!1}:W,t,nt));const Pe=N.animation;Pe&&(isWillChangeMotionValue(S)&&(S.add(F),Pe.then(()=>S.remove(F))),P.push(Pe))}return p&&Promise.all(P).then(()=>{frame.update(()=>{p&&setTarget(t,p)})}),P}function animateVariant(t,n,o={}){var s;const c=resolveVariant(t,n,o.type==="exit"?(s=t.presenceContext)===null||s===void 0?void 0:s.custom:void 0);let{transition:d=t.getDefaultTransition()||{}}=c||{};o.transitionOverride&&(d=o.transitionOverride);const h=c?()=>Promise.all(animateTarget(t,c,o)):()=>Promise.resolve(),p=t.variantChildren&&t.variantChildren.size?(S=0)=>{const{delayChildren:P=0,staggerChildren:L,staggerDirection:F}=d;return animateChildren(t,n,P+S,L,F,o)}:()=>Promise.resolve(),{when:y}=d;if(y){const[S,P]=y==="beforeChildren"?[h,p]:[p,h];return S().then(()=>P())}else return Promise.all([h(),p(o.delay)])}function animateChildren(t,n,o=0,s=0,c=1,d){const h=[],p=(t.variantChildren.size-1)*s,y=c===1?(S=0)=>S*s:(S=0)=>p-S*s;return Array.from(t.variantChildren).sort(sortByTreeOrder).forEach((S,P)=>{S.notify("AnimationStart",n),h.push(animateVariant(S,n,{...d,delay:o+y(P)}).then(()=>S.notify("AnimationComplete",n)))}),Promise.all(h)}function sortByTreeOrder(t,n){return t.sortNodePosition(n)}function animateVisualElement(t,n,o={}){t.notify("AnimationStart",n);let s;if(Array.isArray(n)){const c=n.map(d=>animateVariant(t,d,o));s=Promise.all(c)}else if(typeof n=="string")s=animateVariant(t,n,o);else{const c=typeof n=="function"?resolveVariant(t,n,o.custom):n;s=Promise.all(animateTarget(t,c,o))}return s.then(()=>{frame.postRender(()=>{t.notify("AnimationComplete",n)})})}const reversePriorityOrder=[...variantPriorityOrder].reverse(),numAnimationTypes=variantPriorityOrder.length;function animateList(t){return n=>Promise.all(n.map(({animation:o,options:s})=>animateVisualElement(t,o,s)))}function createAnimationState(t){let n=animateList(t);const o=createState();let s=!0;const c=y=>(S,P)=>{var L;const F=resolveVariant(t,P,y==="exit"?(L=t.presenceContext)===null||L===void 0?void 0:L.custom:void 0);if(F){const{transition:N,transitionEnd:z,...W}=F;S={...S,...W,...z}}return S};function d(y){n=y(t)}function h(y){const S=t.getProps(),P=t.getVariantContext(!0)||{},L=[],F=new Set;let N={},z=1/0;for(let nt=0;nt<numAnimationTypes;nt++){const Pe=reversePriorityOrder[nt],se=o[Pe],mt=S[Pe]!==void 0?S[Pe]:P[Pe],kt=isVariantLabel(mt),mn=Pe===y?se.isActive:null;mn===!1&&(z=nt);let _i=mt===P[Pe]&&mt!==S[Pe]&&kt;if(_i&&s&&t.manuallyAnimateOnMount&&(_i=!1),se.protectedKeys={...N},!se.isActive&&mn===null||!mt&&!se.prevProp||isAnimationControls(mt)||typeof mt=="boolean")continue;let Sa=checkVariantsDidChange(se.prevProp,mt)||Pe===y&&se.isActive&&!_i&&kt||nt>z&&kt,fa=!1;const La=Array.isArray(mt)?mt:[mt];let Ra=La.reduce(c(Pe),{});mn===!1&&(Ra={});const{prevResolvedValues:ma={}}=se,yt={...ma,...Ra},lt=pi=>{Sa=!0,F.has(pi)&&(fa=!0,F.delete(pi)),se.needsAnimating[pi]=!0;const ba=t.getValue(pi);ba&&(ba.liveStyle=!1)};for(const pi in yt){const ba=Ra[pi],Sc=ma[pi];if(N.hasOwnProperty(pi))continue;let ms=!1;isKeyframesTarget(ba)&&isKeyframesTarget(Sc)?ms=!shallowCompare(ba,Sc):ms=ba!==Sc,ms?ba!=null?lt(pi):F.add(pi):ba!==void 0&&F.has(pi)?lt(pi):se.protectedKeys[pi]=!0}se.prevProp=mt,se.prevResolvedValues=Ra,se.isActive&&(N={...N,...Ra}),s&&t.blockInitialAnimation&&(Sa=!1),Sa&&(!_i||fa)&&L.push(...La.map(pi=>({animation:pi,options:{type:Pe}})))}if(F.size){const nt={};F.forEach(Pe=>{const se=t.getBaseTarget(Pe),mt=t.getValue(Pe);mt&&(mt.liveStyle=!0),nt[Pe]=se===void 0?null:se}),L.push({animation:nt})}let W=!!L.length;return s&&(S.initial===!1||S.initial===S.animate)&&!t.manuallyAnimateOnMount&&(W=!1),s=!1,W?n(L):Promise.resolve()}function p(y,S){var P;if(o[y].isActive===S)return Promise.resolve();(P=t.variantChildren)===null||P===void 0||P.forEach(F=>{var N;return(N=F.animationState)===null||N===void 0?void 0:N.setActive(y,S)}),o[y].isActive=S;const L=h(y);for(const F in o)o[F].protectedKeys={};return L}return{animateChanges:h,setActive:p,setAnimateFunction:d,getState:()=>o}}function checkVariantsDidChange(t,n){return typeof n=="string"?n!==t:Array.isArray(n)?!shallowCompare(n,t):!1}function createTypeState(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function createState(){return{animate:createTypeState(!0),whileInView:createTypeState(),whileHover:createTypeState(),whileTap:createTypeState(),whileDrag:createTypeState(),whileFocus:createTypeState(),exit:createTypeState()}}class AnimationFeature extends Feature{constructor(n){super(n),n.animationState||(n.animationState=createAnimationState(n))}updateAnimationControlsSubscription(){const{animate:n}=this.node.getProps();this.unmount(),isAnimationControls(n)&&(this.unmount=n.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:n}=this.node.getProps(),{animate:o}=this.node.prevProps||{};n!==o&&this.updateAnimationControlsSubscription()}unmount(){}}let id$1=0;class ExitAnimationFeature extends Feature{constructor(){super(...arguments),this.id=id$1++}update(){if(!this.node.presenceContext)return;const{isPresent:n,onExitComplete:o}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||n===s)return;const c=this.node.animationState.setActive("exit",!n);o&&!n&&c.then(()=>o(this.id))}mount(){const{register:n}=this.node.presenceContext||{};n&&(this.unmount=n(this.id))}unmount(){}}const animations={animation:{Feature:AnimationFeature},exit:{Feature:ExitAnimationFeature}},distance=(t,n)=>Math.abs(t-n);function distance2D(t,n){const o=distance(t.x,n.x),s=distance(t.y,n.y);return Math.sqrt(o**2+s**2)}class PanSession{constructor(n,o,{transformPagePoint:s,contextWindow:c,dragSnapToOrigin:d=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const L=getPanInfo(this.lastMoveEventInfo,this.history),F=this.startEvent!==null,N=distance2D(L.offset,{x:0,y:0})>=3;if(!F&&!N)return;const{point:z}=L,{timestamp:W}=frameData;this.history.push({...z,timestamp:W});const{onStart:nt,onMove:Pe}=this.handlers;F||(nt&&nt(this.lastMoveEvent,L),this.startEvent=this.lastMoveEvent),Pe&&Pe(this.lastMoveEvent,L)},this.handlePointerMove=(L,F)=>{this.lastMoveEvent=L,this.lastMoveEventInfo=transformPoint(F,this.transformPagePoint),frame.update(this.updatePoint,!0)},this.handlePointerUp=(L,F)=>{this.end();const{onEnd:N,onSessionEnd:z,resumeAnimation:W}=this.handlers;if(this.dragSnapToOrigin&&W&&W(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const nt=getPanInfo(L.type==="pointercancel"?this.lastMoveEventInfo:transformPoint(F,this.transformPagePoint),this.history);this.startEvent&&N&&N(L,nt),z&&z(L,nt)},!isPrimaryPointer(n))return;this.dragSnapToOrigin=d,this.handlers=o,this.transformPagePoint=s,this.contextWindow=c||window;const h=extractEventInfo(n),p=transformPoint(h,this.transformPagePoint),{point:y}=p,{timestamp:S}=frameData;this.history=[{...y,timestamp:S}];const{onSessionStart:P}=o;P&&P(n,getPanInfo(p,this.history)),this.removeListeners=pipe(addPointerEvent(this.contextWindow,"pointermove",this.handlePointerMove),addPointerEvent(this.contextWindow,"pointerup",this.handlePointerUp),addPointerEvent(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(n){this.handlers=n}end(){this.removeListeners&&this.removeListeners(),cancelFrame(this.updatePoint)}}function transformPoint(t,n){return n?{point:n(t.point)}:t}function subtractPoint(t,n){return{x:t.x-n.x,y:t.y-n.y}}function getPanInfo({point:t},n){return{point:t,delta:subtractPoint(t,lastDevicePoint(n)),offset:subtractPoint(t,startDevicePoint(n)),velocity:getVelocity(n,.1)}}function startDevicePoint(t){return t[0]}function lastDevicePoint(t){return t[t.length-1]}function getVelocity(t,n){if(t.length<2)return{x:0,y:0};let o=t.length-1,s=null;const c=lastDevicePoint(t);for(;o>=0&&(s=t[o],!(c.timestamp-s.timestamp>secondsToMilliseconds(n)));)o--;if(!s)return{x:0,y:0};const d=millisecondsToSeconds(c.timestamp-s.timestamp);if(d===0)return{x:0,y:0};const h={x:(c.x-s.x)/d,y:(c.y-s.y)/d};return h.x===1/0&&(h.x=0),h.y===1/0&&(h.y=0),h}function calcLength(t){return t.max-t.min}function isNear(t,n=0,o=.01){return Math.abs(t-n)<=o}function calcAxisDelta(t,n,o,s=.5){t.origin=s,t.originPoint=mixNumber$1(n.min,n.max,t.origin),t.scale=calcLength(o)/calcLength(n),(isNear(t.scale,1,1e-4)||isNaN(t.scale))&&(t.scale=1),t.translate=mixNumber$1(o.min,o.max,t.origin)-t.originPoint,(isNear(t.translate)||isNaN(t.translate))&&(t.translate=0)}function calcBoxDelta(t,n,o,s){calcAxisDelta(t.x,n.x,o.x,s?s.originX:void 0),calcAxisDelta(t.y,n.y,o.y,s?s.originY:void 0)}function calcRelativeAxis(t,n,o){t.min=o.min+n.min,t.max=t.min+calcLength(n)}function calcRelativeBox(t,n,o){calcRelativeAxis(t.x,n.x,o.x),calcRelativeAxis(t.y,n.y,o.y)}function calcRelativeAxisPosition(t,n,o){t.min=n.min-o.min,t.max=t.min+calcLength(n)}function calcRelativePosition(t,n,o){calcRelativeAxisPosition(t.x,n.x,o.x),calcRelativeAxisPosition(t.y,n.y,o.y)}function applyConstraints(t,{min:n,max:o},s){return n!==void 0&&t<n?t=s?mixNumber$1(n,t,s.min):Math.max(t,n):o!==void 0&&t>o&&(t=s?mixNumber$1(o,t,s.max):Math.min(t,o)),t}function calcRelativeAxisConstraints(t,n,o){return{min:n!==void 0?t.min+n:void 0,max:o!==void 0?t.max+o-(t.max-t.min):void 0}}function calcRelativeConstraints(t,{top:n,left:o,bottom:s,right:c}){return{x:calcRelativeAxisConstraints(t.x,o,c),y:calcRelativeAxisConstraints(t.y,n,s)}}function calcViewportAxisConstraints(t,n){let o=n.min-t.min,s=n.max-t.max;return n.max-n.min<t.max-t.min&&([o,s]=[s,o]),{min:o,max:s}}function calcViewportConstraints(t,n){return{x:calcViewportAxisConstraints(t.x,n.x),y:calcViewportAxisConstraints(t.y,n.y)}}function calcOrigin(t,n){let o=.5;const s=calcLength(t),c=calcLength(n);return c>s?o=progress(n.min,n.max-s,t.min):s>c&&(o=progress(t.min,t.max-c,n.min)),clamp(0,1,o)}function rebaseAxisConstraints(t,n){const o={};return n.min!==void 0&&(o.min=n.min-t.min),n.max!==void 0&&(o.max=n.max-t.min),o}const defaultElastic=.35;function resolveDragElastic(t=defaultElastic){return t===!1?t=0:t===!0&&(t=defaultElastic),{x:resolveAxisElastic(t,"left","right"),y:resolveAxisElastic(t,"top","bottom")}}function resolveAxisElastic(t,n,o){return{min:resolvePointElastic(t,n),max:resolvePointElastic(t,o)}}function resolvePointElastic(t,n){return typeof t=="number"?t:t[n]||0}const createAxisDelta=()=>({translate:0,scale:1,origin:0,originPoint:0}),createDelta=()=>({x:createAxisDelta(),y:createAxisDelta()}),createAxis=()=>({min:0,max:0}),createBox=()=>({x:createAxis(),y:createAxis()});function eachAxis(t){return[t("x"),t("y")]}function convertBoundingBoxToBox({top:t,left:n,right:o,bottom:s}){return{x:{min:n,max:o},y:{min:t,max:s}}}function convertBoxToBoundingBox({x:t,y:n}){return{top:n.min,right:t.max,bottom:n.max,left:t.min}}function transformBoxPoints(t,n){if(!n)return t;const o=n({x:t.left,y:t.top}),s=n({x:t.right,y:t.bottom});return{top:o.y,left:o.x,bottom:s.y,right:s.x}}function isIdentityScale(t){return t===void 0||t===1}function hasScale({scale:t,scaleX:n,scaleY:o}){return!isIdentityScale(t)||!isIdentityScale(n)||!isIdentityScale(o)}function hasTransform(t){return hasScale(t)||has2DTranslate(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function has2DTranslate(t){return is2DTranslate(t.x)||is2DTranslate(t.y)}function is2DTranslate(t){return t&&t!=="0%"}function scalePoint(t,n,o){const s=t-o,c=n*s;return o+c}function applyPointDelta(t,n,o,s,c){return c!==void 0&&(t=scalePoint(t,c,s)),scalePoint(t,o,s)+n}function applyAxisDelta(t,n=0,o=1,s,c){t.min=applyPointDelta(t.min,n,o,s,c),t.max=applyPointDelta(t.max,n,o,s,c)}function applyBoxDelta(t,{x:n,y:o}){applyAxisDelta(t.x,n.translate,n.scale,n.originPoint),applyAxisDelta(t.y,o.translate,o.scale,o.originPoint)}function applyTreeDeltas(t,n,o,s=!1){const c=o.length;if(!c)return;n.x=n.y=1;let d,h;for(let p=0;p<c;p++){d=o[p],h=d.projectionDelta;const y=d.instance;y&&y.style&&y.style.display==="contents"||(s&&d.options.layoutScroll&&d.scroll&&d!==d.root&&transformBox(t,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),h&&(n.x*=h.x.scale,n.y*=h.y.scale,applyBoxDelta(t,h)),s&&hasTransform(d.latestValues)&&transformBox(t,d.latestValues))}n.x=snapToDefault(n.x),n.y=snapToDefault(n.y)}function snapToDefault(t){return Number.isInteger(t)||t>1.0000000000001||t<.999999999999?t:1}function translateAxis(t,n){t.min=t.min+n,t.max=t.max+n}function transformAxis(t,n,[o,s,c]){const d=n[c]!==void 0?n[c]:.5,h=mixNumber$1(t.min,t.max,d);applyAxisDelta(t,n[o],n[s],h,n.scale)}const xKeys$1=["x","scaleX","originX"],yKeys$1=["y","scaleY","originY"];function transformBox(t,n){transformAxis(t.x,n,xKeys$1),transformAxis(t.y,n,yKeys$1)}function measureViewportBox(t,n){return convertBoundingBoxToBox(transformBoxPoints(t.getBoundingClientRect(),n))}function measurePageBox(t,n,o){const s=measureViewportBox(t,o),{scroll:c}=n;return c&&(translateAxis(s.x,c.offset.x),translateAxis(s.y,c.offset.y)),s}const getContextWindow=({current:t})=>t?t.ownerDocument.defaultView:null,elementDragControls=new WeakMap;class VisualElementDragControls{constructor(n){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=createBox(),this.visualElement=n}start(n,{snapToCursor:o=!1}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const c=P=>{const{dragSnapToOrigin:L}=this.getProps();L?this.pauseAnimation():this.stopAnimation(),o&&this.snapToCursor(extractEventInfo(P,"page").point)},d=(P,L)=>{const{drag:F,dragPropagation:N,onDragStart:z}=this.getProps();if(F&&!N&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=getGlobalLock(F),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),eachAxis(nt=>{let Pe=this.getAxisMotionValue(nt).get()||0;if(percent.test(Pe)){const{projection:se}=this.visualElement;if(se&&se.layout){const mt=se.layout.layoutBox[nt];mt&&(Pe=calcLength(mt)*(parseFloat(Pe)/100))}}this.originPoint[nt]=Pe}),z&&z(P,L);const{animationState:W}=this.visualElement;W&&W.setActive("whileDrag",!0)},h=(P,L)=>{const{dragPropagation:F,dragDirectionLock:N,onDirectionLock:z,onDrag:W}=this.getProps();if(!F&&!this.openGlobalLock)return;const{offset:nt}=L;if(N&&this.currentDirection===null){this.currentDirection=getCurrentDirection(nt),this.currentDirection!==null&&z&&z(this.currentDirection);return}this.updateAxis("x",L.point,nt),this.updateAxis("y",L.point,nt),this.visualElement.render(),W&&W(P,L)},p=(P,L)=>this.stop(P,L),y=()=>eachAxis(P=>{var L;return this.getAnimationState(P)==="paused"&&((L=this.getAxisMotionValue(P).animation)===null||L===void 0?void 0:L.play())}),{dragSnapToOrigin:S}=this.getProps();this.panSession=new PanSession(n,{onSessionStart:c,onStart:d,onMove:h,onSessionEnd:p,resumeAnimation:y},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:S,contextWindow:getContextWindow(this.visualElement)})}stop(n,o){const s=this.isDragging;if(this.cancel(),!s)return;const{velocity:c}=o;this.startAnimation(c);const{onDragEnd:d}=this.getProps();d&&d(n,o)}cancel(){this.isDragging=!1;const{projection:n,animationState:o}=this.visualElement;n&&(n.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:s}=this.getProps();!s&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),o&&o.setActive("whileDrag",!1)}updateAxis(n,o,s){const{drag:c}=this.getProps();if(!s||!shouldDrag(n,c,this.currentDirection))return;const d=this.getAxisMotionValue(n);let h=this.originPoint[n]+s[n];this.constraints&&this.constraints[n]&&(h=applyConstraints(h,this.constraints[n],this.elastic[n])),d.set(h)}resolveConstraints(){var n;const{dragConstraints:o,dragElastic:s}=this.getProps(),c=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(n=this.visualElement.projection)===null||n===void 0?void 0:n.layout,d=this.constraints;o&&isRefObject(o)?this.constraints||(this.constraints=this.resolveRefConstraints()):o&&c?this.constraints=calcRelativeConstraints(c.layoutBox,o):this.constraints=!1,this.elastic=resolveDragElastic(s),d!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&eachAxis(h=>{this.getAxisMotionValue(h)&&(this.constraints[h]=rebaseAxisConstraints(c.layoutBox[h],this.constraints[h]))})}resolveRefConstraints(){const{dragConstraints:n,onMeasureDragConstraints:o}=this.getProps();if(!n||!isRefObject(n))return!1;const s=n.current;invariant(s!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:c}=this.visualElement;if(!c||!c.layout)return!1;const d=measurePageBox(s,c.root,this.visualElement.getTransformPagePoint());let h=calcViewportConstraints(c.layout.layoutBox,d);if(o){const p=o(convertBoxToBoundingBox(h));this.hasMutatedConstraints=!!p,p&&(h=convertBoundingBoxToBox(p))}return h}startAnimation(n){const{drag:o,dragMomentum:s,dragElastic:c,dragTransition:d,dragSnapToOrigin:h,onDragTransitionEnd:p}=this.getProps(),y=this.constraints||{},S=eachAxis(P=>{if(!shouldDrag(P,o,this.currentDirection))return;let L=y[P]||{};h&&(L={min:0,max:0});const F=c?200:1e6,N=c?40:1e7,z={type:"inertia",velocity:s?n[P]:0,bounceStiffness:F,bounceDamping:N,timeConstant:750,restDelta:1,restSpeed:10,...d,...L};return this.startAxisValueAnimation(P,z)});return Promise.all(S).then(p)}startAxisValueAnimation(n,o){const s=this.getAxisMotionValue(n);return s.start(animateMotionValue(n,s,0,o,this.visualElement))}stopAnimation(){eachAxis(n=>this.getAxisMotionValue(n).stop())}pauseAnimation(){eachAxis(n=>{var o;return(o=this.getAxisMotionValue(n).animation)===null||o===void 0?void 0:o.pause()})}getAnimationState(n){var o;return(o=this.getAxisMotionValue(n).animation)===null||o===void 0?void 0:o.state}getAxisMotionValue(n){const o="_drag"+n.toUpperCase(),s=this.visualElement.getProps(),c=s[o];return c||this.visualElement.getValue(n,(s.initial?s.initial[n]:void 0)||0)}snapToCursor(n){eachAxis(o=>{const{drag:s}=this.getProps();if(!shouldDrag(o,s,this.currentDirection))return;const{projection:c}=this.visualElement,d=this.getAxisMotionValue(o);if(c&&c.layout){const{min:h,max:p}=c.layout.layoutBox[o];d.set(n[o]-mixNumber$1(h,p,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:n,dragConstraints:o}=this.getProps(),{projection:s}=this.visualElement;if(!isRefObject(o)||!s||!this.constraints)return;this.stopAnimation();const c={x:0,y:0};eachAxis(h=>{const p=this.getAxisMotionValue(h);if(p){const y=p.get();c[h]=calcOrigin({min:y,max:y},this.constraints[h])}});const{transformTemplate:d}=this.visualElement.getProps();this.visualElement.current.style.transform=d?d({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),eachAxis(h=>{if(!shouldDrag(h,n,null))return;const p=this.getAxisMotionValue(h),{min:y,max:S}=this.constraints[h];p.set(mixNumber$1(y,S,c[h]))})}addListeners(){if(!this.visualElement.current)return;elementDragControls.set(this.visualElement,this);const n=this.visualElement.current,o=addPointerEvent(n,"pointerdown",y=>{const{drag:S,dragListener:P=!0}=this.getProps();S&&P&&this.start(y)}),s=()=>{const{dragConstraints:y}=this.getProps();isRefObject(y)&&(this.constraints=this.resolveRefConstraints())},{projection:c}=this.visualElement,d=c.addEventListener("measure",s);c&&!c.layout&&(c.root&&c.root.updateScroll(),c.updateLayout()),s();const h=addDomEvent(window,"resize",()=>this.scalePositionWithinConstraints()),p=c.addEventListener("didUpdate",({delta:y,hasLayoutChanged:S})=>{this.isDragging&&S&&(eachAxis(P=>{const L=this.getAxisMotionValue(P);L&&(this.originPoint[P]+=y[P].translate,L.set(L.get()+y[P].translate))}),this.visualElement.render())});return()=>{h(),o(),d(),p&&p()}}getProps(){const n=this.visualElement.getProps(),{drag:o=!1,dragDirectionLock:s=!1,dragPropagation:c=!1,dragConstraints:d=!1,dragElastic:h=defaultElastic,dragMomentum:p=!0}=n;return{...n,drag:o,dragDirectionLock:s,dragPropagation:c,dragConstraints:d,dragElastic:h,dragMomentum:p}}}function shouldDrag(t,n,o){return(n===!0||n===t)&&(o===null||o===t)}function getCurrentDirection(t,n=10){let o=null;return Math.abs(t.y)>n?o="y":Math.abs(t.x)>n&&(o="x"),o}class DragGesture extends Feature{constructor(n){super(n),this.removeGroupControls=noop$1,this.removeListeners=noop$1,this.controls=new VisualElementDragControls(n)}mount(){const{dragControls:n}=this.node.getProps();n&&(this.removeGroupControls=n.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||noop$1}unmount(){this.removeGroupControls(),this.removeListeners()}}const asyncHandler=t=>(n,o)=>{t&&t(n,o)};class PanGesture extends Feature{constructor(){super(...arguments),this.removePointerDownListener=noop$1}onPointerDown(n){this.session=new PanSession(n,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:getContextWindow(this.node)})}createPanHandlers(){const{onPanSessionStart:n,onPanStart:o,onPan:s,onPanEnd:c}=this.node.getProps();return{onSessionStart:asyncHandler(n),onStart:asyncHandler(o),onMove:s,onEnd:(d,h)=>{delete this.session,c&&c(d,h)}}}mount(){this.removePointerDownListener=addPointerEvent(this.node.current,"pointerdown",n=>this.onPointerDown(n))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function usePresence(){const t=React.useContext(PresenceContext);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:o,register:s}=t,c=React.useId();return React.useEffect(()=>s(c),[]),!n&&o?[!1,()=>o&&o(c)]:[!0]}const globalProjectionState={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function pixelsToPercent(t,n){return n.max===n.min?0:t/(n.max-n.min)*100}const correctBorderRadius={correct:(t,n)=>{if(!n.target)return t;if(typeof t=="string")if(px.test(t))t=parseFloat(t);else return t;const o=pixelsToPercent(t,n.target.x),s=pixelsToPercent(t,n.target.y);return`${o}% ${s}%`}},correctBoxShadow={correct:(t,{treeScale:n,projectionDelta:o})=>{const s=t,c=complex.parse(t);if(c.length>5)return s;const d=complex.createTransformer(t),h=typeof c[0]!="number"?1:0,p=o.x.scale*n.x,y=o.y.scale*n.y;c[0+h]/=p,c[1+h]/=y;const S=mixNumber$1(p,y,.5);return typeof c[2+h]=="number"&&(c[2+h]/=S),typeof c[3+h]=="number"&&(c[3+h]/=S),d(c)}};class MeasureLayoutWithContext extends React.Component{componentDidMount(){const{visualElement:n,layoutGroup:o,switchLayoutGroup:s,layoutId:c}=this.props,{projection:d}=n;addScaleCorrector(defaultScaleCorrectors),d&&(o.group&&o.group.add(d),s&&s.register&&c&&s.register(d),d.root.didUpdate(),d.addEventListener("animationComplete",()=>{this.safeToRemove()}),d.setOptions({...d.options,onExitComplete:()=>this.safeToRemove()})),globalProjectionState.hasEverUpdated=!0}getSnapshotBeforeUpdate(n){const{layoutDependency:o,visualElement:s,drag:c,isPresent:d}=this.props,h=s.projection;return h&&(h.isPresent=d,c||n.layoutDependency!==o||o===void 0?h.willUpdate():this.safeToRemove(),n.isPresent!==d&&(d?h.promote():h.relegate()||frame.postRender(()=>{const p=h.getStack();(!p||!p.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:n}=this.props.visualElement;n&&(n.root.didUpdate(),microtask.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:n,layoutGroup:o,switchLayoutGroup:s}=this.props,{projection:c}=n;c&&(c.scheduleCheckAfterUnmount(),o&&o.group&&o.group.remove(c),s&&s.deregister&&s.deregister(c))}safeToRemove(){const{safeToRemove:n}=this.props;n&&n()}render(){return null}}function MeasureLayout(t){const[n,o]=usePresence(),s=React.useContext(LayoutGroupContext);return React.createElement(MeasureLayoutWithContext,{...t,layoutGroup:s,switchLayoutGroup:React.useContext(SwitchLayoutGroupContext),isPresent:n,safeToRemove:o})}const defaultScaleCorrectors={borderRadius:{...correctBorderRadius,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:correctBorderRadius,borderTopRightRadius:correctBorderRadius,borderBottomLeftRadius:correctBorderRadius,borderBottomRightRadius:correctBorderRadius,boxShadow:correctBoxShadow},borders=["TopLeft","TopRight","BottomLeft","BottomRight"],numBorders=borders.length,asNumber=t=>typeof t=="string"?parseFloat(t):t,isPx=t=>typeof t=="number"||px.test(t);function mixValues(t,n,o,s,c,d){c?(t.opacity=mixNumber$1(0,o.opacity!==void 0?o.opacity:1,easeCrossfadeIn(s)),t.opacityExit=mixNumber$1(n.opacity!==void 0?n.opacity:1,0,easeCrossfadeOut(s))):d&&(t.opacity=mixNumber$1(n.opacity!==void 0?n.opacity:1,o.opacity!==void 0?o.opacity:1,s));for(let h=0;h<numBorders;h++){const p=`border${borders[h]}Radius`;let y=getRadius(n,p),S=getRadius(o,p);if(y===void 0&&S===void 0)continue;y||(y=0),S||(S=0),y===0||S===0||isPx(y)===isPx(S)?(t[p]=Math.max(mixNumber$1(asNumber(y),asNumber(S),s),0),(percent.test(S)||percent.test(y))&&(t[p]+="%")):t[p]=S}(n.rotate||o.rotate)&&(t.rotate=mixNumber$1(n.rotate||0,o.rotate||0,s))}function getRadius(t,n){return t[n]!==void 0?t[n]:t.borderRadius}const easeCrossfadeIn=compress(0,.5,circOut),easeCrossfadeOut=compress(.5,.95,noop$1);function compress(t,n,o){return s=>s<t?0:s>n?1:o(progress(t,n,s))}function copyAxisInto(t,n){t.min=n.min,t.max=n.max}function copyBoxInto(t,n){copyAxisInto(t.x,n.x),copyAxisInto(t.y,n.y)}function removePointDelta(t,n,o,s,c){return t-=n,t=scalePoint(t,1/o,s),c!==void 0&&(t=scalePoint(t,1/c,s)),t}function removeAxisDelta(t,n=0,o=1,s=.5,c,d=t,h=t){if(percent.test(n)&&(n=parseFloat(n),n=mixNumber$1(h.min,h.max,n/100)-h.min),typeof n!="number")return;let p=mixNumber$1(d.min,d.max,s);t===d&&(p-=n),t.min=removePointDelta(t.min,n,o,p,c),t.max=removePointDelta(t.max,n,o,p,c)}function removeAxisTransforms(t,n,[o,s,c],d,h){removeAxisDelta(t,n[o],n[s],n[c],n.scale,d,h)}const xKeys=["x","scaleX","originX"],yKeys=["y","scaleY","originY"];function removeBoxTransforms(t,n,o,s){removeAxisTransforms(t.x,n,xKeys,o?o.x:void 0,s?s.x:void 0),removeAxisTransforms(t.y,n,yKeys,o?o.y:void 0,s?s.y:void 0)}function isAxisDeltaZero(t){return t.translate===0&&t.scale===1}function isDeltaZero(t){return isAxisDeltaZero(t.x)&&isAxisDeltaZero(t.y)}function boxEquals(t,n){return t.x.min===n.x.min&&t.x.max===n.x.max&&t.y.min===n.y.min&&t.y.max===n.y.max}function boxEqualsRounded(t,n){return Math.round(t.x.min)===Math.round(n.x.min)&&Math.round(t.x.max)===Math.round(n.x.max)&&Math.round(t.y.min)===Math.round(n.y.min)&&Math.round(t.y.max)===Math.round(n.y.max)}function aspectRatio(t){return calcLength(t.x)/calcLength(t.y)}class NodeStack{constructor(){this.members=[]}add(n){addUniqueItem(this.members,n),n.scheduleRender()}remove(n){if(removeItem(this.members,n),n===this.prevLead&&(this.prevLead=void 0),n===this.lead){const o=this.members[this.members.length-1];o&&this.promote(o)}}relegate(n){const o=this.members.findIndex(c=>n===c);if(o===0)return!1;let s;for(let c=o;c>=0;c--){const d=this.members[c];if(d.isPresent!==!1){s=d;break}}return s?(this.promote(s),!0):!1}promote(n,o){const s=this.lead;if(n!==s&&(this.prevLead=s,this.lead=n,n.show(),s)){s.instance&&s.scheduleRender(),n.scheduleRender(),n.resumeFrom=s,o&&(n.resumeFrom.preserveOpacity=!0),s.snapshot&&(n.snapshot=s.snapshot,n.snapshot.latestValues=s.animationValues||s.latestValues),n.root&&n.root.isUpdating&&(n.isLayoutDirty=!0);const{crossfade:c}=n.options;c===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(n=>{const{options:o,resumingFrom:s}=n;o.onExitComplete&&o.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(n=>{n.instance&&n.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function buildProjectionTransform(t,n,o){let s="";const c=t.x.translate/n.x,d=t.y.translate/n.y,h=(o==null?void 0:o.z)||0;if((c||d||h)&&(s=`translate3d(${c}px, ${d}px, ${h}px) `),(n.x!==1||n.y!==1)&&(s+=`scale(${1/n.x}, ${1/n.y}) `),o){const{transformPerspective:S,rotate:P,rotateX:L,rotateY:F,skewX:N,skewY:z}=o;S&&(s=`perspective(${S}px) ${s}`),P&&(s+=`rotate(${P}deg) `),L&&(s+=`rotateX(${L}deg) `),F&&(s+=`rotateY(${F}deg) `),N&&(s+=`skewX(${N}deg) `),z&&(s+=`skewY(${z}deg) `)}const p=t.x.scale*n.x,y=t.y.scale*n.y;return(p!==1||y!==1)&&(s+=`scale(${p}, ${y})`),s||"none"}const compareByDepth=(t,n)=>t.depth-n.depth;class FlatTree{constructor(){this.children=[],this.isDirty=!1}add(n){addUniqueItem(this.children,n),this.isDirty=!0}remove(n){removeItem(this.children,n),this.isDirty=!0}forEach(n){this.isDirty&&this.children.sort(compareByDepth),this.isDirty=!1,this.children.forEach(n)}}function delay(t,n){const o=time.now(),s=({timestamp:c})=>{const d=c-o;d>=n&&(cancelFrame(s),t(d-n))};return frame.read(s,!0),()=>cancelFrame(s)}function record(t){window.MotionDebug&&window.MotionDebug.record(t)}function isSVGElement(t){return t instanceof SVGElement&&t.tagName!=="svg"}function animateSingleValue(t,n,o){const s=isMotionValue(t)?t:motionValue(t);return s.start(animateMotionValue("",s,n,o)),s.animation}const transformAxes=["","X","Y","Z"],hiddenVisibility={visibility:"hidden"},animationTarget=1e3;let id=0;const projectionFrameData={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function resetDistortingTransform(t,n,o,s){const{latestValues:c}=n;c[t]&&(o[t]=c[t],n.setStaticValue(t,0),s&&(s[t]=0))}function createProjectionNode({attachResizeListener:t,defaultParent:n,measureScroll:o,checkIsScrollRoot:s,resetTransform:c}){return class{constructor(h={},p=n==null?void 0:n()){this.id=id++,this.animationId=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.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,projectionFrameData.totalNodes=projectionFrameData.resolvedTargetDeltas=projectionFrameData.recalculatedProjection=0,this.nodes.forEach(propagateDirtyNodes),this.nodes.forEach(resolveTargetDelta),this.nodes.forEach(calcProjection),this.nodes.forEach(cleanDirtyNodes),record(projectionFrameData)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=h,this.root=p?p.root||p:this,this.path=p?[...p.path,p]:[],this.parent=p,this.depth=p?p.depth+1:0;for(let y=0;y<this.path.length;y++)this.path[y].shouldResetTransform=!0;this.root===this&&(this.nodes=new FlatTree)}addEventListener(h,p){return this.eventHandlers.has(h)||this.eventHandlers.set(h,new SubscriptionManager),this.eventHandlers.get(h).add(p)}notifyListeners(h,...p){const y=this.eventHandlers.get(h);y&&y.notify(...p)}hasListeners(h){return this.eventHandlers.has(h)}mount(h,p=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=isSVGElement(h),this.instance=h;const{layoutId:y,layout:S,visualElement:P}=this.options;if(P&&!P.current&&P.mount(h),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),p&&(S||y)&&(this.isLayoutDirty=!0),t){let L;const F=()=>this.root.updateBlockedByResize=!1;t(h,()=>{this.root.updateBlockedByResize=!0,L&&L(),L=delay(F,250),globalProjectionState.hasAnimatedSinceResize&&(globalProjectionState.hasAnimatedSinceResize=!1,this.nodes.forEach(finishAnimation))})}y&&this.root.registerSharedNode(y,this),this.options.animate!==!1&&P&&(y||S)&&this.addEventListener("didUpdate",({delta:L,hasLayoutChanged:F,hasRelativeTargetChanged:N,layout:z})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const W=this.options.transition||P.getDefaultTransition()||defaultLayoutTransition,{onLayoutAnimationStart:nt,onLayoutAnimationComplete:Pe}=P.getProps(),se=!this.targetLayout||!boxEqualsRounded(this.targetLayout,z)||N,mt=!F&&N;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||mt||F&&(se||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(L,mt);const kt={...getValueTransition(W,"layout"),onPlay:nt,onComplete:Pe};(P.shouldReduceMotion||this.options.layoutRoot)&&(kt.delay=0,kt.type=!1),this.startAnimation(kt)}else F||finishAnimation(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=z})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const h=this.getStack();h&&h.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,cancelFrame(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(resetSkewAndRotation),this.animationId++)}getTransformTemplate(){const{visualElement:h}=this.options;return h&&h.getProps().transformTemplate}willUpdate(h=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let P=0;P<this.path.length;P++){const L=this.path[P];L.shouldResetTransform=!0,L.updateScroll("snapshot"),L.options.layoutRoot&&L.willUpdate(!1)}const{layoutId:p,layout:y}=this.options;if(p===void 0&&!y)return;const S=this.getTransformTemplate();this.prevTransformTemplateValue=S?S(this.latestValues,""):void 0,this.updateSnapshot(),h&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(clearMeasurements);return}this.isUpdating||this.nodes.forEach(clearIsLayoutDirty),this.isUpdating=!1,window.HandoffCancelAllAnimations&&window.HandoffCancelAllAnimations(),this.nodes.forEach(resetTransformStyle),this.nodes.forEach(updateLayout),this.nodes.forEach(notifyLayoutUpdate),this.clearAllSnapshots();const p=time.now();frameData.delta=clamp(0,1e3/60,p-frameData.timestamp),frameData.timestamp=p,frameData.isProcessing=!0,steps.update.process(frameData),steps.preRender.process(frameData),steps.render.process(frameData),frameData.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,microtask.read(()=>this.update()))}clearAllSnapshots(){this.nodes.forEach(clearSnapshot),this.sharedNodes.forEach(removeLeadSnapshots)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,frame.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){frame.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let y=0;y<this.path.length;y++)this.path[y].updateScroll();const h=this.layout;this.layout=this.measure(!1),this.layoutCorrected=createBox(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:p}=this.options;p&&p.notify("LayoutMeasure",this.layout.layoutBox,h?h.layoutBox:void 0)}updateScroll(h="measure"){let p=!!(this.options.layoutScroll&&this.instance);this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===h&&(p=!1),p&&(this.scroll={animationId:this.root.animationId,phase:h,isRoot:s(this.instance),offset:o(this.instance)})}resetTransform(){if(!c)return;const h=this.isLayoutDirty||this.shouldResetTransform,p=this.projectionDelta&&!isDeltaZero(this.projectionDelta),y=this.getTransformTemplate(),S=y?y(this.latestValues,""):void 0,P=S!==this.prevTransformTemplateValue;h&&(p||hasTransform(this.latestValues)||P)&&(c(this.instance,S),this.shouldResetTransform=!1,this.scheduleRender())}measure(h=!0){const p=this.measurePageBox();let y=this.removeElementScroll(p);return h&&(y=this.removeTransform(y)),roundBox(y),{animationId:this.root.animationId,measuredBox:p,layoutBox:y,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:h}=this.options;if(!h)return createBox();const p=h.measureViewportBox(),{scroll:y}=this.root;return y&&(translateAxis(p.x,y.offset.x),translateAxis(p.y,y.offset.y)),p}removeElementScroll(h){const p=createBox();copyBoxInto(p,h);for(let y=0;y<this.path.length;y++){const S=this.path[y],{scroll:P,options:L}=S;if(S!==this.root&&P&&L.layoutScroll){if(P.isRoot){copyBoxInto(p,h);const{scroll:F}=this.root;F&&(translateAxis(p.x,-F.offset.x),translateAxis(p.y,-F.offset.y))}translateAxis(p.x,P.offset.x),translateAxis(p.y,P.offset.y)}}return p}applyTransform(h,p=!1){const y=createBox();copyBoxInto(y,h);for(let S=0;S<this.path.length;S++){const P=this.path[S];!p&&P.options.layoutScroll&&P.scroll&&P!==P.root&&transformBox(y,{x:-P.scroll.offset.x,y:-P.scroll.offset.y}),hasTransform(P.latestValues)&&transformBox(y,P.latestValues)}return hasTransform(this.latestValues)&&transformBox(y,this.latestValues),y}removeTransform(h){const p=createBox();copyBoxInto(p,h);for(let y=0;y<this.path.length;y++){const S=this.path[y];if(!S.instance||!hasTransform(S.latestValues))continue;hasScale(S.latestValues)&&S.updateSnapshot();const P=createBox(),L=S.measurePageBox();copyBoxInto(P,L),removeBoxTransforms(p,S.latestValues,S.snapshot?S.snapshot.layoutBox:void 0,P)}return hasTransform(this.latestValues)&&removeBoxTransforms(p,this.latestValues),p}setTargetDelta(h){this.targetDelta=h,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(h){this.options={...this.options,...h,crossfade:h.crossfade!==void 0?h.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!==frameData.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(h=!1){var p;const y=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=y.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=y.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=y.isSharedProjectionDirty);const S=!!this.resumingFrom||this!==y;if(!(h||S&&this.isSharedProjectionDirty||this.isProjectionDirty||!((p=this.parent)===null||p===void 0)&&p.isProjectionDirty||this.attemptToResolveRelativeTarget))return;const{layout:L,layoutId:F}=this.options;if(!(!this.layout||!(L||F))){if(this.resolvedRelativeTargetAt=frameData.timestamp,!this.targetDelta&&!this.relativeTarget){const N=this.getClosestProjectingParent();N&&N.layout&&this.animationProgress!==1?(this.relativeParent=N,this.forceRelativeParentToResolveTarget(),this.relativeTarget=createBox(),this.relativeTargetOrigin=createBox(),calcRelativePosition(this.relativeTargetOrigin,this.layout.layoutBox,N.layout.layoutBox),copyBoxInto(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=createBox(),this.targetWithTransforms=createBox()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),calcRelativeBox(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):copyBoxInto(this.target,this.layout.layoutBox),applyBoxDelta(this.target,this.targetDelta)):copyBoxInto(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const N=this.getClosestProjectingParent();N&&!!N.resumingFrom==!!this.resumingFrom&&!N.options.layoutScroll&&N.target&&this.animationProgress!==1?(this.relativeParent=N,this.forceRelativeParentToResolveTarget(),this.relativeTarget=createBox(),this.relativeTargetOrigin=createBox(),calcRelativePosition(this.relativeTargetOrigin,this.target,N.target),copyBoxInto(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}projectionFrameData.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||hasScale(this.parent.latestValues)||has2DTranslate(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var h;const p=this.getLead(),y=!!this.resumingFrom||this!==p;let S=!0;if((this.isProjectionDirty||!((h=this.parent)===null||h===void 0)&&h.isProjectionDirty)&&(S=!1),y&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(S=!1),this.resolvedRelativeTargetAt===frameData.timestamp&&(S=!1),S)return;const{layout:P,layoutId:L}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(P||L))return;copyBoxInto(this.layoutCorrected,this.layout.layoutBox);const F=this.treeScale.x,N=this.treeScale.y;applyTreeDeltas(this.layoutCorrected,this.treeScale,this.path,y),p.layout&&!p.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(p.target=p.layout.layoutBox,p.targetWithTransforms=createBox());const{target:z}=p;if(!z){this.projectionTransform&&(this.projectionDelta=createDelta(),this.projectionTransform="none",this.scheduleRender());return}this.projectionDelta||(this.projectionDelta=createDelta(),this.projectionDeltaWithTransform=createDelta());const W=this.projectionTransform;calcBoxDelta(this.projectionDelta,this.layoutCorrected,z,this.latestValues),this.projectionTransform=buildProjectionTransform(this.projectionDelta,this.treeScale),(this.projectionTransform!==W||this.treeScale.x!==F||this.treeScale.y!==N)&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",z)),projectionFrameData.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(h=!0){if(this.options.scheduleRender&&this.options.scheduleRender(),h){const p=this.getStack();p&&p.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}setAnimationOrigin(h,p=!1){const y=this.snapshot,S=y?y.latestValues:{},P={...this.latestValues},L=createDelta();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!p;const F=createBox(),N=y?y.source:void 0,z=this.layout?this.layout.source:void 0,W=N!==z,nt=this.getStack(),Pe=!nt||nt.members.length<=1,se=!!(W&&!Pe&&this.options.crossfade===!0&&!this.path.some(hasOpacityCrossfade));this.animationProgress=0;let mt;this.mixTargetDelta=kt=>{const mn=kt/1e3;mixAxisDelta(L.x,h.x,mn),mixAxisDelta(L.y,h.y,mn),this.setTargetDelta(L),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(calcRelativePosition(F,this.layout.layoutBox,this.relativeParent.layout.layoutBox),mixBox(this.relativeTarget,this.relativeTargetOrigin,F,mn),mt&&boxEquals(this.relativeTarget,mt)&&(this.isProjectionDirty=!1),mt||(mt=createBox()),copyBoxInto(mt,this.relativeTarget)),W&&(this.animationValues=P,mixValues(P,S,this.latestValues,mn,se,Pe)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=mn},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(h){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(cancelFrame(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=frame.update(()=>{globalProjectionState.hasAnimatedSinceResize=!0,this.currentAnimation=animateSingleValue(0,animationTarget,{...h,onUpdate:p=>{this.mixTargetDelta(p),h.onUpdate&&h.onUpdate(p)},onComplete:()=>{h.onComplete&&h.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 h=this.getStack();h&&h.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(animationTarget),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const h=this.getLead();let{targetWithTransforms:p,target:y,layout:S,latestValues:P}=h;if(!(!p||!y||!S)){if(this!==h&&this.layout&&S&&shouldAnimatePositionOnly(this.options.animationType,this.layout.layoutBox,S.layoutBox)){y=this.target||createBox();const L=calcLength(this.layout.layoutBox.x);y.x.min=h.target.x.min,y.x.max=y.x.min+L;const F=calcLength(this.layout.layoutBox.y);y.y.min=h.target.y.min,y.y.max=y.y.min+F}copyBoxInto(p,y),transformBox(p,P),calcBoxDelta(this.projectionDeltaWithTransform,this.layoutCorrected,p,P)}}registerSharedNode(h,p){this.sharedNodes.has(h)||this.sharedNodes.set(h,new NodeStack),this.sharedNodes.get(h).add(p);const S=p.options.initialPromotionConfig;p.promote({transition:S?S.transition:void 0,preserveFollowOpacity:S&&S.shouldPreserveFollowOpacity?S.shouldPreserveFollowOpacity(p):void 0})}isLead(){const h=this.getStack();return h?h.lead===this:!0}getLead(){var h;const{layoutId:p}=this.options;return p?((h=this.getStack())===null||h===void 0?void 0:h.lead)||this:this}getPrevLead(){var h;const{layoutId:p}=this.options;return p?(h=this.getStack())===null||h===void 0?void 0:h.prevLead:void 0}getStack(){const{layoutId:h}=this.options;if(h)return this.root.sharedNodes.get(h)}promote({needsReset:h,transition:p,preserveFollowOpacity:y}={}){const S=this.getStack();S&&S.promote(this,y),h&&(this.projectionDelta=void 0,this.needsReset=!0),p&&this.setOptions({transition:p})}relegate(){const h=this.getStack();return h?h.relegate(this):!1}resetSkewAndRotation(){const{visualElement:h}=this.options;if(!h)return;let p=!1;const{latestValues:y}=h;if((y.z||y.rotate||y.rotateX||y.rotateY||y.rotateZ||y.skewX||y.skewY)&&(p=!0),!p)return;const S={};y.z&&resetDistortingTransform("z",h,S,this.animationValues);for(let P=0;P<transformAxes.length;P++)resetDistortingTransform(`rotate${transformAxes[P]}`,h,S,this.animationValues),resetDistortingTransform(`skew${transformAxes[P]}`,h,S,this.animationValues);h.render();for(const P in S)h.setStaticValue(P,S[P]),this.animationValues&&(this.animationValues[P]=S[P]);h.scheduleRender()}getProjectionStyles(h){var p,y;if(!this.instance||this.isSVG)return;if(!this.isVisible)return hiddenVisibility;const S={visibility:""},P=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,S.opacity="",S.pointerEvents=resolveMotionValue(h==null?void 0:h.pointerEvents)||"",S.transform=P?P(this.latestValues,""):"none",S;const L=this.getLead();if(!this.projectionDelta||!this.layout||!L.target){const W={};return this.options.layoutId&&(W.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,W.pointerEvents=resolveMotionValue(h==null?void 0:h.pointerEvents)||""),this.hasProjected&&!hasTransform(this.latestValues)&&(W.transform=P?P({},""):"none",this.hasProjected=!1),W}const F=L.animationValues||L.latestValues;this.applyTransformsToTarget(),S.transform=buildProjectionTransform(this.projectionDeltaWithTransform,this.treeScale,F),P&&(S.transform=P(F,S.transform));const{x:N,y:z}=this.projectionDelta;S.transformOrigin=`${N.origin*100}% ${z.origin*100}% 0`,L.animationValues?S.opacity=L===this?(y=(p=F.opacity)!==null&&p!==void 0?p:this.latestValues.opacity)!==null&&y!==void 0?y:1:this.preserveOpacity?this.latestValues.opacity:F.opacityExit:S.opacity=L===this?F.opacity!==void 0?F.opacity:"":F.opacityExit!==void 0?F.opacityExit:0;for(const W in scaleCorrectors){if(F[W]===void 0)continue;const{correct:nt,applyTo:Pe}=scaleCorrectors[W],se=S.transform==="none"?F[W]:nt(F[W],L);if(Pe){const mt=Pe.length;for(let kt=0;kt<mt;kt++)S[Pe[kt]]=se}else S[W]=se}return this.options.layoutId&&(S.pointerEvents=L===this?resolveMotionValue(h==null?void 0:h.pointerEvents)||"":"none"),S}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(h=>{var p;return(p=h.currentAnimation)===null||p===void 0?void 0:p.stop()}),this.root.nodes.forEach(clearMeasurements),this.root.sharedNodes.clear()}}}function updateLayout(t){t.updateLayout()}function notifyLayoutUpdate(t){var n;const o=((n=t.resumeFrom)===null||n===void 0?void 0:n.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&o&&t.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:c}=t.layout,{animationType:d}=t.options,h=o.source!==t.layout.source;d==="size"?eachAxis(L=>{const F=h?o.measuredBox[L]:o.layoutBox[L],N=calcLength(F);F.min=s[L].min,F.max=F.min+N}):shouldAnimatePositionOnly(d,o.layoutBox,s)&&eachAxis(L=>{const F=h?o.measuredBox[L]:o.layoutBox[L],N=calcLength(s[L]);F.max=F.min+N,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[L].max=t.relativeTarget[L].min+N)});const p=createDelta();calcBoxDelta(p,s,o.layoutBox);const y=createDelta();h?calcBoxDelta(y,t.applyTransform(c,!0),o.measuredBox):calcBoxDelta(y,s,o.layoutBox);const S=!isDeltaZero(p);let P=!1;if(!t.resumeFrom){const L=t.getClosestProjectingParent();if(L&&!L.resumeFrom){const{snapshot:F,layout:N}=L;if(F&&N){const z=createBox();calcRelativePosition(z,o.layoutBox,F.layoutBox);const W=createBox();calcRelativePosition(W,s,N.layoutBox),boxEqualsRounded(z,W)||(P=!0),L.options.layoutRoot&&(t.relativeTarget=W,t.relativeTargetOrigin=z,t.relativeParent=L)}}}t.notifyListeners("didUpdate",{layout:s,snapshot:o,delta:y,layoutDelta:p,hasLayoutChanged:S,hasRelativeTargetChanged:P})}else if(t.isLead()){const{onExitComplete:s}=t.options;s&&s()}t.options.transition=void 0}function propagateDirtyNodes(t){projectionFrameData.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function cleanDirtyNodes(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function clearSnapshot(t){t.clearSnapshot()}function clearMeasurements(t){t.clearMeasurements()}function clearIsLayoutDirty(t){t.isLayoutDirty=!1}function resetTransformStyle(t){const{visualElement:n}=t.options;n&&n.getProps().onBeforeLayoutMeasure&&n.notify("BeforeLayoutMeasure"),t.resetTransform()}function finishAnimation(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function resolveTargetDelta(t){t.resolveTargetDelta()}function calcProjection(t){t.calcProjection()}function resetSkewAndRotation(t){t.resetSkewAndRotation()}function removeLeadSnapshots(t){t.removeLeadSnapshot()}function mixAxisDelta(t,n,o){t.translate=mixNumber$1(n.translate,0,o),t.scale=mixNumber$1(n.scale,1,o),t.origin=n.origin,t.originPoint=n.originPoint}function mixAxis(t,n,o,s){t.min=mixNumber$1(n.min,o.min,s),t.max=mixNumber$1(n.max,o.max,s)}function mixBox(t,n,o,s){mixAxis(t.x,n.x,o.x,s),mixAxis(t.y,n.y,o.y,s)}function hasOpacityCrossfade(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const defaultLayoutTransition={duration:.45,ease:[.4,0,.1,1]},userAgentContains=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),roundPoint=userAgentContains("applewebkit/")&&!userAgentContains("chrome/")?Math.round:noop$1;function roundAxis(t){t.min=roundPoint(t.min),t.max=roundPoint(t.max)}function roundBox(t){roundAxis(t.x),roundAxis(t.y)}function shouldAnimatePositionOnly(t,n,o){return t==="position"||t==="preserve-aspect"&&!isNear(aspectRatio(n),aspectRatio(o),.2)}const DocumentProjectionNode=createProjectionNode({attachResizeListener:(t,n)=>addDomEvent(t,"resize",n),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),rootProjectionNode={current:void 0},HTMLProjectionNode=createProjectionNode({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!rootProjectionNode.current){const t=new DocumentProjectionNode({});t.mount(window),t.setOptions({layoutScroll:!0}),rootProjectionNode.current=t}return rootProjectionNode.current},resetTransform:(t,n)=>{t.style.transform=n!==void 0?n:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),drag={pan:{Feature:PanGesture},drag:{Feature:DragGesture,ProjectionNode:HTMLProjectionNode,MeasureLayout}},prefersReducedMotion={current:null},hasReducedMotionListener={current:!1};function initPrefersReducedMotion(){if(hasReducedMotionListener.current=!0,!!isBrowser)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),n=()=>prefersReducedMotion.current=t.matches;t.addListener(n),n()}else prefersReducedMotion.current=!1}function updateMotionValuesFromProps(t,n,o){const{willChange:s}=n;for(const c in n){const d=n[c],h=o[c];if(isMotionValue(d))t.addValue(c,d),isWillChangeMotionValue(s)&&s.add(c),process.env.NODE_ENV==="development"&&warnOnce(d.version==="11.0.27",`Attempting to mix Framer Motion versions ${d.version} with 11.0.27 may not work as expected.`);else if(isMotionValue(h))t.addValue(c,motionValue(d,{owner:t})),isWillChangeMotionValue(s)&&s.remove(c);else if(h!==d)if(t.hasValue(c)){const p=t.getValue(c);p.liveStyle===!0?p.jump(d):p.hasAnimated||p.set(d)}else{const p=t.getStaticValue(c);t.addValue(c,motionValue(p!==void 0?p:d,{owner:t}))}}for(const c in o)n[c]===void 0&&t.removeValue(c);return n}const visualElementStore=new WeakMap,valueTypes=[...dimensionValueTypes,color,complex],findValueType=t=>valueTypes.find(testValueType(t)),featureNames=Object.keys(featureDefinitions),numFeatures=featureNames.length,propEventHandlers=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],numVariantProps=variantProps.length;function getClosestProjectingNode(t){if(t)return t.options.allowProjection!==!1?t.projection:getClosestProjectingNode(t.parent)}class VisualElement{constructor({parent:n,props:o,presenceContext:s,reducedMotionConfig:c,blockInitialAnimation:d,visualState:h},p={}){this.resolveKeyframes=(F,N,z,W)=>new this.KeyframeResolver(F,N,z,W,this),this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=KeyframeResolver,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},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.scheduleRender=()=>frame.render(this.render,!1,!0);const{latestValues:y,renderState:S}=h;this.latestValues=y,this.baseTarget={...y},this.initialValues=o.initial?{...y}:{},this.renderState=S,this.parent=n,this.props=o,this.presenceContext=s,this.depth=n?n.depth+1:0,this.reducedMotionConfig=c,this.options=p,this.blockInitialAnimation=!!d,this.isControllingVariants=isControllingVariants(o),this.isVariantNode=isVariantNode(o),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(n&&n.current);const{willChange:P,...L}=this.scrapeMotionValuesFromProps(o,{},this);for(const F in L){const N=L[F];y[F]!==void 0&&isMotionValue(N)&&(N.set(y[F],!1),isWillChangeMotionValue(P)&&P.add(F))}}scrapeMotionValuesFromProps(n,o,s){return{}}mount(n){this.current=n,visualElementStore.set(n,this),this.projection&&!this.projection.instance&&this.projection.mount(n),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((o,s)=>this.bindToMotionValue(s,o)),hasReducedMotionListener.current||initPrefersReducedMotion(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:prefersReducedMotion.current,process.env.NODE_ENV!=="production"&&warnOnce(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){visualElementStore.delete(this.current),this.projection&&this.projection.unmount(),cancelFrame(this.notifyUpdate),cancelFrame(this.render),this.valueSubscriptions.forEach(n=>n()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const n in this.events)this.events[n].clear();for(const n in this.features)this.features[n].unmount();this.current=null}bindToMotionValue(n,o){const s=transformProps.has(n),c=o.on("change",h=>{this.latestValues[n]=h,this.props.onUpdate&&frame.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0)}),d=o.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(n,()=>{c(),d(),o.owner&&o.stop()})}sortNodePosition(n){return!this.current||!this.sortInstanceNodePosition||this.type!==n.type?0:this.sortInstanceNodePosition(this.current,n.current)}loadFeatures({children:n,...o},s,c,d){let h,p;if(process.env.NODE_ENV!=="production"&&c&&s){const y="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";o.ignoreStrict?warning(!1,y):invariant(!1,y)}for(let y=0;y<numFeatures;y++){const S=featureNames[y],{isEnabled:P,Feature:L,ProjectionNode:F,MeasureLayout:N}=featureDefinitions[S];F&&(h=F),P(o)&&(!this.features[S]&&L&&(this.features[S]=new L(this)),N&&(p=N))}if((this.type==="html"||this.type==="svg")&&!this.projection&&h){this.projection=new h(this.latestValues,getClosestProjectingNode(this.parent));const{layoutId:y,layout:S,drag:P,dragConstraints:L,layoutScroll:F,layoutRoot:N}=o;this.projection.setOptions({layoutId:y,layout:S,alwaysMeasureLayout:!!P||L&&isRefObject(L),visualElement:this,scheduleRender:()=>this.scheduleRender(),animationType:typeof S=="string"?S:"both",initialPromotionConfig:d,layoutScroll:F,layoutRoot:N})}return p}updateFeatures(){for(const n in this.features){const o=this.features[n];o.isMounted?o.update():(o.mount(),o.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):createBox()}getStaticValue(n){return this.latestValues[n]}setStaticValue(n,o){this.latestValues[n]=o}update(n,o){(n.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=n,this.prevPresenceContext=this.presenceContext,this.presenceContext=o;for(let s=0;s<propEventHandlers.length;s++){const c=propEventHandlers[s];this.propEventSubscriptions[c]&&(this.propEventSubscriptions[c](),delete this.propEventSubscriptions[c]);const d=n["on"+c];d&&(this.propEventSubscriptions[c]=this.on(c,d))}this.prevMotionValues=updateMotionValuesFromProps(this,this.scrapeMotionValuesFromProps(n,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(n){return this.props.variants?this.props.variants[n]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}getVariantContext(n=!1){if(n)return this.parent?this.parent.getVariantContext():void 0;if(!this.isControllingVariants){const s=this.parent?this.parent.getVariantContext()||{}:{};return this.props.initial!==void 0&&(s.initial=this.props.initial),s}const o={};for(let s=0;s<numVariantProps;s++){const c=variantProps[s],d=this.props[c];(isVariantLabel(d)||d===!1)&&(o[c]=d)}return o}addVariantChild(n){const o=this.getClosestVariantNode();if(o)return o.variantChildren&&o.variantChildren.add(n),()=>o.variantChildren.delete(n)}addValue(n,o){o!==this.values.get(n)&&(this.removeValue(n),this.bindToMotionValue(n,o)),this.values.set(n,o),this.latestValues[n]=o.get()}removeValue(n){this.values.delete(n);const o=this.valueSubscriptions.get(n);o&&(o(),this.valueSubscriptions.delete(n)),delete this.latestValues[n],this.removeValueFromRenderState(n,this.renderState)}hasValue(n){return this.values.has(n)}getValue(n,o){if(this.props.values&&this.props.values[n])return this.props.values[n];let s=this.values.get(n);return s===void 0&&o!==void 0&&(s=motionValue(o===null?void 0:o,{owner:this}),this.addValue(n,s)),s}readValue(n,o){var s;let c=this.latestValues[n]!==void 0||!this.current?this.latestValues[n]:(s=this.getBaseTargetFromProps(this.props,n))!==null&&s!==void 0?s:this.readValueFromInstance(this.current,n,this.options);return c!=null&&(typeof c=="string"&&(isNumericalString(c)||isZeroValueString(c))?c=parseFloat(c):!findValueType(c)&&complex.test(o)&&(c=getAnimatableNone(n,o)),this.setBaseTarget(n,isMotionValue(c)?c.get():c)),isMotionValue(c)?c.get():c}setBaseTarget(n,o){this.baseTarget[n]=o}getBaseTarget(n){var o,s;const{initial:c}=this.props,d=typeof c=="string"||typeof c=="object"?(s=resolveVariantFromProps(this.props,c,(o=this.presenceContext)===null||o===void 0?void 0:o.custom))===null||s===void 0?void 0:s[n]:void 0;if(c&&d!==void 0)return d;const h=this.getBaseTargetFromProps(this.props,n);return h!==void 0&&!isMotionValue(h)?h:this.initialValues[n]!==void 0&&d===void 0?void 0:this.baseTarget[n]}on(n,o){return this.events[n]||(this.events[n]=new SubscriptionManager),this.events[n].add(o)}notify(n,...o){this.events[n]&&this.events[n].notify(...o)}}class DOMVisualElement extends VisualElement{constructor(){super(...arguments),this.KeyframeResolver=DOMKeyframesResolver}sortInstanceNodePosition(n,o){return n.compareDocumentPosition(o)&2?1:-1}getBaseTargetFromProps(n,o){return n.style?n.style[o]:void 0}removeValueFromRenderState(n,{vars:o,style:s}){delete o[n],delete s[n]}}function getComputedStyle(t){return window.getComputedStyle(t)}class HTMLVisualElement extends DOMVisualElement{constructor(){super(...arguments),this.type="html"}readValueFromInstance(n,o){if(transformProps.has(o)){const s=getDefaultValueType(o);return s&&s.default||0}else{const s=getComputedStyle(n),c=(isCSSVariableName(o)?s.getPropertyValue(o):s[o])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(n,{transformPagePoint:o}){return measureViewportBox(n,o)}build(n,o,s,c){buildHTMLStyles(n,o,s,c.transformTemplate)}scrapeMotionValuesFromProps(n,o,s){return scrapeMotionValuesFromProps$1(n,o,s)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:n}=this.props;isMotionValue(n)&&(this.childSubscription=n.on("change",o=>{this.current&&(this.current.textContent=`${o}`)}))}renderInstance(n,o,s,c){renderHTML(n,o,s,c)}}class SVGVisualElement extends DOMVisualElement{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1}getBaseTargetFromProps(n,o){return n[o]}readValueFromInstance(n,o){if(transformProps.has(o)){const s=getDefaultValueType(o);return s&&s.default||0}return o=camelCaseAttributes.has(o)?o:camelToDash(o),n.getAttribute(o)}measureInstanceViewportBox(){return createBox()}scrapeMotionValuesFromProps(n,o){return scrapeMotionValuesFromProps(n,o,this)}build(n,o,s,c){buildSVGAttrs(n,o,s,this.isSVGTag,c.transformTemplate)}renderInstance(n,o,s,c){renderSVG(n,o,s,c)}mount(n){this.isSVGTag=isSVGTag(n.tagName),super.mount(n)}}const createDomVisualElement=(t,n)=>isSVGComponent(t)?new SVGVisualElement(n,{enableHardwareAcceleration:!1}):new HTMLVisualElement(n,{allowProjection:t!==React.Fragment,enableHardwareAcceleration:!0}),layout={layout:{ProjectionNode:HTMLProjectionNode,MeasureLayout}},preloadedFeatures={...animations,...gestureAnimations,...drag,...layout},motion=createMotionProxy((t,n)=>createDomMotionConfig(t,n,preloadedFeatures,createDomVisualElement));function useMotionValue(t){const n=useConstant(()=>motionValue(t)),{isStatic:o}=React.useContext(MotionConfigContext);if(o){const[,s]=React.useState(t);React.useEffect(()=>n.on("change",s),[])}return n}function assignRef(t,n){return typeof t=="function"?t(n):t&&(t.current=n),t}function useCallbackRef(t,n){var o=React.useState(function(){return{value:t,callback:n,facade:{get current(){return o.value},set current(s){var c=o.value;c!==s&&(o.value=s,o.callback(s,c))}}}})[0];return o.callback=n,o.facade}var useIsomorphicLayoutEffect=typeof window<"u"?React__namespace.useLayoutEffect:React__namespace.useEffect,currentValues=new WeakMap;function useMergeRefs(t,n){var o=useCallbackRef(null,function(s){return t.forEach(function(c){return assignRef(c,s)})});return useIsomorphicLayoutEffect(function(){var s=currentValues.get(o);if(s){var c=new Set(s),d=new Set(t),h=o.current;c.forEach(function(p){d.has(p)||assignRef(p,null)}),d.forEach(function(p){c.has(p)||assignRef(p,h)})}currentValues.set(o,t)},[t]),o}const occluder=new EllipsoidalOccluder(Ellipsoid$1.WGS84,Cartesian3.ZERO),ScreenSpaceElement=React.forwardRef(({position:t,children:n,...o},s)=>{const c=useConstant$2(()=>new Cartesian3);t==null||t.clone(c);const d=useMotionValue(""),h=useMotionValue("none"),{toWindowPosition:p,getCamera:y,toXYZ:S,isPositionVisible:P}=useContext(),L=React.useRef(null);usePreRender(()=>{if(L.current==null)return;let N;try{const se=p==null?void 0:p([c.x,c.y,c.z]);N=new Cartesian2(se==null?void 0:se[0],se==null?void 0:se[1])}catch{h.set("none");return}const z=y==null?void 0:y();if(!z)return;const W=S==null?void 0:S(z==null?void 0:z.lng,z==null?void 0:z.lat,z==null?void 0:z.height);if(!W)return;if(occluder.cameraPosition=new Cartesian3(W[0],W[1],W[2]),N==null||N.x<0||N.y<0||N.x>window.innerWidth||N.y>window.innerHeight||!(P!=null&&P([c.x,c.y,c.z]))){h.set("none");return}const nt=`calc(${N.x}px - 50%)`,Pe=`calc(${N.y}px - 50%)`;d.set(`translate(${nt}, ${Pe})`),h.set("block")});const F=useMergeRefs([L,s]);return jsxRuntimeExports.jsx(motion.div,{ref:F,...o,style:{...o.style,transform:d,display:h,position:"absolute",pointerEvents:"none",left:0,top:0},children:n})});ScreenSpaceElement.displayName="ScreenSpaceElement";const MeasurementLine$1=({a:t,b:n,color:o})=>{const s=React.useRef([t,n]);s.current=[t,n];const c=useConstant$2(()=>new CallbackProperty(()=>s.current,!1)),d=React.useMemo(()=>({polyline:{positions:c,width:1.5,material:new PolylineDashMaterialProperty({color:o,dashLength:8})}}),[o,c]);return jsxRuntimeExports.jsx(Entity,{...d})},ExtrudedMeasurement=({a:t,b:n,extrudedHeight:o,color:s,showLine:c})=>{const d=useConstant$2(()=>new Cartesian3);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ScreenSpaceElement,{position:Cartesian3.midpoint(t,n,d),children:jsxRuntimeExports.jsx(MeasurementText,{children:o<1e3?`${o.toFixed(1)} m`:`${(o/1e3).toFixed(1)} km`})}),c&&jsxRuntimeExports.jsx(MeasurementLine$1,{a:t,b:n,color:s})]})},ExtrudedControlPoints=React.memo(({geometryOptions:{controlPoints:t,type:n},extrudedHeight:o,color:s,isEditing:c,extrudedPoint:d,centroidBasePoint:h,centroidExtrudedPoint:p,catchedExtrudedPoint:y,handleControlPointMouseEvent:S})=>{const P=t[t.length-1],L=d?new Cartesian3(...d):void 0,F=h?new Cartesian3(...h):void 0,N=p?new Cartesian3(...p):void 0;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[L&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ControlPoint,{index:-1,position:L,isEditing:c,isExtrudedControlPoint:!0,handleControlPointMouseEvent:S}),(!c||y)&&jsxRuntimeExports.jsx(ExtrudedMeasurement,{a:P,b:L,extrudedHeight:o,color:c?Color$1.fromCssColorString(DEFAULT_EDIT_COLOR):s,showLine:n!=="extrudedPolygon"})]}),F&&jsxRuntimeExports.jsx(ControlPoint,{index:-1,position:F,isEditing:c,isExtrudedControlPoint:!0}),N&&jsxRuntimeExports.jsx(ControlPoint,{index:-1,position:N,isEditing:c,isExtrudedControlPoint:!0})]})});ExtrudedControlPoints.displayName="ExtrudedControlPoints";const ExtrudedPolygonEntity=({id:t,hierarchy:n,extrudedHeight:o,color:s,disableShadow:c=!1,isEditing:d})=>{const h=React.useRef(n);h.current=n;const y=useConstant$2(()=>new CallbackProperty(()=>h.current,!1)),S=React.useRef(o);S.current=o;const L=useConstant$2(()=>new CallbackProperty(()=>S.current,!1)),F=React.useMemo(()=>({polygon:{hierarchy:y,heightReference:HeightReference$1.RELATIVE_TO_TERRAIN,extrudedHeight:L,extrudedHeightReference:HeightReference$1.RELATIVE_TO_TERRAIN,fill:!0,outline:!0,outlineWidth:1,outlineColor:d?Color$1.fromCssColorString(DEFAULT_EDIT_COLOR):s==null?void 0:s.withAlpha(1),material:new ColorMaterialProperty(d?s==null?void 0:s.withAlpha(.2):s),classificationType:ClassificationType$1.TERRAIN,shadows:c?ShadowMode$1.DISABLED:ShadowMode$1.ENABLED}}),[L,c,y,s,d]),{requestRender:N}=useContext();return N==null||N(),jsxRuntimeExports.jsx(Entity,{id:t,...F})},PolygonEntity=({dynamic:t=!1,hierarchy:n,color:o})=>{const s=React.useRef(n);s.current=n;const c=useConstant$2(()=>new CallbackProperty(()=>s.current,!1)),d=t?c:n,h=React.useMemo(()=>({polygon:{hierarchy:d,fill:!0,material:o==null?void 0:o.withAlpha(.5),classificationType:ClassificationType$1.TERRAIN}}),[o,d]),{requestRender:p}=useContext();return p==null||p(),jsxRuntimeExports.jsx(Entity,{...h})},PolylineEntity=({dynamic:t=!1,positions:n,color:o,isEditing:s})=>{const c=React.useRef(n);c.current=n;const d=useConstant$2(()=>new CallbackProperty(()=>c.current,!t)),h=t?d:n,p=React.useMemo(()=>({polyline:{positions:h,width:1.5,material:s?Color$1.fromCssColorString(DEFAULT_EDIT_COLOR):o,classificationType:ClassificationType$1.TERRAIN,clampToGround:!0}}),[o,h,s]),{requestRender:y}=useContext();return y==null||y(),jsxRuntimeExports.jsx(Entity,{...p})},cartesianScratch1$1=new Cartesian3,SurfaceAddingPoints=React.memo(({geometryOptions:{type:t,controlPoints:n},isEditing:o,handleAddControlPoint:s})=>{if(!["polyline","polygon","extrudedPolygon"].includes(t))return null;const c=[];for(let d=0;d<n.length-1;d++){const h=n[d+1],p=Cartesian3.midpoint(n[d],h,cartesianScratch1$1);c.push(p.clone())}if(t==="polygon"||t==="extrudedPolygon"){const d=Cartesian3.midpoint(n[n.length-1],n[0],cartesianScratch1$1);c.push(d.clone())}return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:c.map((d,h)=>jsxRuntimeExports.jsx(ControlPoint,{position:d,isAddingPoint:!0,index:h,clampToGround:!0,isEditing:o,handleControlPointMouseEvent:()=>s==null?void 0:s([d.x,d.y,d.z],h)},h))})});SurfaceAddingPoints.displayName="SurfaceAddingPoints";const MeasurementLine=({a:t,b:n,color:o})=>{const s=React.useRef([t,n]);s.current=[t,n];const c=useConstant$2(()=>new CallbackProperty(()=>s.current,!1)),d=React.useMemo(()=>({polyline:{positions:c,width:1.5,material:new PolylineDashMaterialProperty({color:o,dashLength:8}),classificationType:ClassificationType$1.TERRAIN,clampToGround:!0}}),[o,c]),{requestRender:h}=useContext();return h==null||h(),jsxRuntimeExports.jsx(Entity,{...d})},SurfaceMeasurement=({a:t,b:n,color:o,showLine:s=!1})=>{const c=useConstant$2(()=>new Cartesian3),{getSurfaceDistance:d}=useContext(),h=d==null?void 0:d(t,n);return h!==void 0?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ScreenSpaceElement,{position:Cartesian3.midpoint(t,n,c),children:jsxRuntimeExports.jsx(MeasurementText,{children:h<1e3?`${h.toFixed(1)} m`:`${(h/1e3).toFixed(1)} km`})}),s&&jsxRuntimeExports.jsx(MeasurementLine,{a:t,b:n,color:o})]}):null},cartesianScratch1=new Cartesian3,SurfaceControlPoints=React.memo(({geometryOptions:{type:t,controlPoints:n},color:o,isEditing:s,catchedControlPointIndex:c,selectedControlPointIndex:d,handleControlPointMouseEvent:h})=>{const p=[];if(n.length>=2)if(s){if(c!==void 0&&c!==-1)switch(t){case"polyline":c>0&&p.push({points:[n[c-1],n[c]],showLine:!1}),c<n.length-1&&p.push({points:[n[c],n[c+1]],showLine:!1});break;case"circle":case"extrudedCircle":c!==2&&p.push({points:[n[0],n[1]],showLine:!0});break;case"rectangle":case"extrudedRectangle":if(c<=1)p.push({points:[n[0],n[1]],showLine:!1});else if(c===2){const[y,S,P]=n,L=Cartesian3.midpoint(y,S,cartesianScratch1);p.push({points:[L,P],showLine:!0})}break;case"polygon":case"extrudedPolygon":p.push({points:[n[c],c===0?n[n.length-1]:n[c-1]],showLine:!1}),p.push({points:[n[c],c===n.length-1?n[0]:n[c+1]],showLine:!1});break}}else switch(t){case"rectangle":if(n.length===2)p.push({points:n,showLine:!0});else if(n.length===3){const[y,S,P]=n,L=Cartesian3.midpoint(y,S,cartesianScratch1);p.push({points:[L,P],showLine:!0})}break;default:p.push({points:n.slice(-2),showLine:t==="circle"});break}return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[n.map((y,S)=>jsxRuntimeExports.jsx(ControlPoint,{position:y,index:S,isSelected:d===S,clampToGround:!0,isEditing:s,handleControlPointMouseEvent:h},S)),p.map(({points:y,showLine:S},P)=>jsxRuntimeExports.jsx(SurfaceMeasurement,{a:y[0],b:y[1],color:s?Color$1.fromCssColorString(DEFAULT_EDIT_COLOR):o,showLine:S},P))]})});SurfaceControlPoints.displayName="SurfaceControlPoints";const SketchComponent=React.memo(({geometryOptions:t,extrudedHeight:n,disableShadow:o,color:s,isEditing:c,extrudedPoint:d,centroidBasePoint:h,centroidExtrudedPoint:p,catchedControlPointIndex:y,catchedExtrudedPoint:S,selectedControlPointIndex:P,handleControlPointMouseEvent:L,handleAddControlPoint:F})=>{const N=React.useMemo(()=>t?{...t,controlPoints:t==null?void 0:t.controlPoints.map(se=>new Cesium$1.Cartesian3(...se))}:null,[t]),z=React.useMemo(()=>N?createGeometry(N):null,[N]),{positionsArray:W,hierarchyArray:nt}=React.useMemo(()=>(z==null?void 0:z.type)==="Point"?{}:(z==null?void 0:z.type)==="LineString"?{positionsArray:convertGeometryToPositionsArray(z)}:z!=null?{positionsArray:convertGeometryToPositionsArray(z),hierarchyArray:convertPolygonToHierarchyArray(z)}:{},[z]),Pe=React.useMemo(()=>Color$1.fromCssColorString(s??DEFAULT_SKETCH_COLOR),[s]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[W==null?void 0:W.map((se,mt)=>jsxRuntimeExports.jsx(PolylineEntity,{dynamic:!0,positions:se,color:Pe,isEditing:c},mt)),nt==null?void 0:nt.map((se,mt)=>jsxRuntimeExports.jsx(PolygonEntity,{dynamic:!0,hierarchy:se,color:Pe},mt)),N!=null&&(!n||c)&&jsxRuntimeExports.jsx(SurfaceControlPoints,{geometryOptions:N,color:Pe,isEditing:c,catchedControlPointIndex:y,selectedControlPointIndex:P,handleControlPointMouseEvent:L}),N!=null&&c&&jsxRuntimeExports.jsx(SurfaceAddingPoints,{geometryOptions:N,isEditing:c,handleAddControlPoint:F}),N!=null&&n&&jsxRuntimeExports.jsx(ExtrudedControlPoints,{geometryOptions:N,extrudedHeight:n,extrudedPoint:d,centroidBasePoint:h,centroidExtrudedPoint:p,catchedExtrudedPoint:S,color:Pe,isEditing:c,handleControlPointMouseEvent:L}),n&&(nt==null?void 0:nt.map((se,mt)=>jsxRuntimeExports.jsx(ExtrudedPolygonEntity,{hierarchy:se,extrudedHeight:n,disableShadow:o,color:Pe,isEditing:c},mt)))]})});SketchComponent.displayName="SketchComponent";const Cesium=({className:t,style:n,property:o,time:s,camera:c,small:d,ready:h,children:p,selectedLayerId:y,isLayerDraggable:S,isLayerDragging:P,shouldRender:L,layerSelectionReason:F,meta:N,displayCredits:z,layersRef:W,featureFlags:nt,requestingRenderMode:Pe,timelineManagerRef:se,cameraForceHorizontalRoll:mt,onLayerSelect:kt,onCameraChange:mn,onLayerDrag:_i,onLayerDrop:zi,onLayerEdit:Sa,onLayerSelectWithRectStart:fa,onLayerSelectWithRectMove:La,onLayerSelectWithRectEnd:Ra,onMount:ma,onLayerVisibility:yt,onLayerLoad:lt,onCreditsUpdate:pi},ba)=>{var gd,pd,Zd,cf,sf,nf,df,Cf,mf,Sf,Pf,Af,Hf,_f,wf,Yf,Nf,vf,Ff,Xf,Wf,Qf,_m,Bf,$m,qf,qm,ep,Tf,rf,bf,If,Uf,jf,jm,sp,cp,fp,mp,al,tf,lf;const{cesium:Sc,mouseEventHandles:ms,cesiumIonAccessToken:Xs,context:Nl,layerSelectWithRectEventHandlers:pu,sceneLight:yu,sceneBackgroundColor:Ru,sceneMsaaSamples:Vd,sceneMode:Gd,cameraViewBoundaries:uf,cameraViewOuterBoundaries:ff,cameraViewBoundariesMaterial:pf,handleCameraChange:hf,handleCameraMoveEnd:of,handleUpdate:gf,handleClick:Ef,handleMount:xf,handleUnmount:Wa,handleTilesChange:af,handleTerrainProviderChange:Xd}=useHooks$1({ref:ba,property:o,time:s,selectedLayerId:y,selectionReason:F,meta:N,layersRef:W,featureFlags:nt,timelineManagerRef:se,isLayerDraggable:S,isLayerDragging:P,shouldRender:L,requestingRenderMode:Pe,camera:c,cameraForceHorizontalRoll:mt,onLayerDrag:_i,onLayerDrop:zi,onLayerSelect:kt,onLayerEdit:Sa,onLayerSelectWithRectStart:fa,onLayerSelectWithRectMove:La,onLayerSelectWithRectEnd:Ra,onLayerVisibility:yt,onLayerLoad:lt,onCameraChange:mn,onMount:ma,onCreditsUpdate:pi});return jsxRuntimeExports.jsxs(Aa$1,{ref:Sc,onUpdate:gf,className:t,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:z?void 0:creditContainer,style:{width:d?"300px":"auto",height:d?"300px":"100%",display:h?void 0:"none",cursor:P?"grab":void 0,...n},shadows:!!((pd=(gd=o==null?void 0:o.scene)==null?void 0:gd.shadow)!=null&&pd.enabled),onClick:Ef,onDoubleClick:ms.doubleClick,onMouseDown:ms.mouseDown,onMouseUp:ms.mouseUp,onRightClick:ms.rightClick,onRightDown:ms.rightDown,onRightUp:ms.rightUp,onMiddleClick:ms.middleClick,onMiddleDown:ms.middleDown,onMiddleUp:ms.middleUp,onMouseMove:ms.mouseMove,onMouseEnter:ms.mouseEnter,onMouseLeave:ms.mouseLeave,onWheel:ms.wheel,children:[jsxRuntimeExports.jsx(Event,{onMount:xf,onUnmount:Wa}),jsxRuntimeExports.jsx(ReearthClock,{timelineManagerRef:se}),jsxRuntimeExports.jsx(ImageryLayers,{tiles:o==null?void 0:o.tiles,cesiumIonAccessToken:Xs,onTilesChange:af}),jsxRuntimeExports.jsx(LabelImageryLayers,{tileLabels:o==null?void 0:o.tileLabels}),jsxRuntimeExports.jsx(Indicator,{property:o,timelineManagerRef:se}),jsxRuntimeExports.jsxs(ka$1,{useDefault:!0,children:[jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_CLICK}),jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_DOUBLE_CLICK})]}),jsxRuntimeExports.jsxs(ka$1,{children:[jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_DOWN,action:pu.start.handler}),jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_DOWN,modifier:Cesium$1.KeyboardEventModifier.SHIFT,action:pu.start.shift}),jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.MOUSE_MOVE,action:pu.move.handler}),jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.MOUSE_MOVE,modifier:Cesium$1.KeyboardEventModifier.SHIFT,action:pu.move.shift}),jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_UP,action:pu.end.handler}),jsxRuntimeExports.jsx(Ma$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_UP,modifier:Cesium$1.KeyboardEventModifier.SHIFT,action:pu.end.shift})]}),jsxRuntimeExports.jsx(Ta$1,{maximumZoomDistance:(cf=(Zd=o==null?void 0:o.camera)==null?void 0:Zd.limiter)!=null&&cf.enabled?((df=(nf=(sf=o.camera)==null?void 0:sf.limiter)==null?void 0:nf.targetArea)==null?void 0:df.height)??Number.POSITIVE_INFINITY:Number.POSITIVE_INFINITY,enableCollisionDetection:!((Cf=o==null?void 0:o.camera)!=null&&Cf.allowEnterGround)}),jsxRuntimeExports.jsx(Ps$1,{percentageChanged:.2,onChange:hf,onMoveEnd:of}),uf&&((Sf=(mf=o==null?void 0:o.camera)==null?void 0:mf.limiter)==null?void 0:Sf.showHelper)&&jsxRuntimeExports.jsx(Is$1,{children:jsxRuntimeExports.jsx(ua$1,{positions:uf,width:1,material:Cesium$1.Color.RED,arcType:Cesium$1.ArcType.RHUMB})}),ff&&((Af=(Pf=o==null?void 0:o.camera)==null?void 0:Pf.limiter)==null?void 0:Af.showHelper)&&jsxRuntimeExports.jsx(Is$1,{children:jsxRuntimeExports.jsx(ua$1,{positions:ff,width:1,material:pf,arcType:Cesium$1.ArcType.RHUMB})}),jsxRuntimeExports.jsx($a$1,{backgroundColor:Ru,light:yu,mode:Gd,msaaSamples:Vd,useDepthPicking:!1,useWebVR:!!((Hf=o==null?void 0:o.scene)!=null&&Hf.vr)||void 0,debugShowFramesPerSecond:!!((_f=o==null?void 0:o.debug)!=null&&_f.showFramesPerSecond),verticalExaggerationRelativeHeight:(wf=o==null?void 0:o.scene)==null?void 0:wf.verticalExaggerationRelativeHeight,verticalExaggeration:(Yf=o==null?void 0:o.scene)==null?void 0:Yf.verticalExaggeration}),jsxRuntimeExports.jsx(Oa$1,{show:((vf=(Nf=o==null?void 0:o.sky)==null?void 0:Nf.skyBox)==null?void 0:vf.show)??!0}),jsxRuntimeExports.jsx(Vs,{enabled:((Xf=(Ff=o==null?void 0:o.sky)==null?void 0:Ff.fog)==null?void 0:Xf.enabled)??!0,density:(Qf=(Wf=o==null?void 0:o.sky)==null?void 0:Wf.fog)==null?void 0:Qf.density}),jsxRuntimeExports.jsx(Ga$1,{show:((Bf=(_m=o==null?void 0:o.sky)==null?void 0:_m.sun)==null?void 0:Bf.show)??!0}),jsxRuntimeExports.jsx(ea,{show:((qf=($m=o==null?void 0:o.sky)==null?void 0:$m.moon)==null?void 0:qf.show)??!0}),jsxRuntimeExports.jsx(_a$2,{show:((ep=(qm=o==null?void 0:o.sky)==null?void 0:qm.skyAtmosphere)==null?void 0:ep.show)??!0,atmosphereLightIntensity:(rf=(Tf=o==null?void 0:o.sky)==null?void 0:Tf.skyAtmosphere)==null?void 0:rf.lightIntensity,saturationShift:(If=(bf=o==null?void 0:o.sky)==null?void 0:bf.skyAtmosphere)==null?void 0:If.saturationShift,brightnessShift:(jf=(Uf=o==null?void 0:o.sky)==null?void 0:Uf.skyAtmosphere)==null?void 0:jf.brightnessShift}),jsxRuntimeExports.jsx(Globe,{property:o,cesiumIonAccessToken:Xs,onTerrainProviderChange:Xd}),jsxRuntimeExports.jsx(context.Provider,{value:Nl,children:h?p:null}),jsxRuntimeExports.jsx(AmbientOcclusion,{...AMBIENT_OCCLUSION_QUALITY[((sp=(jm=o==null?void 0:o.render)==null?void 0:jm.ambientOcclusion)==null?void 0:sp.quality)||"low"],enabled:!!((fp=(cp=o==null?void 0:o.render)==null?void 0:cp.ambientOcclusion)!=null&&fp.enabled),intensity:((al=(mp=o==null?void 0:o.render)==null?void 0:mp.ambientOcclusion)==null?void 0:al.intensity)??100,outputType:(lf=(tf=o==null?void 0:o.render)==null?void 0:tf.ambientOcclusion)!=null&&lf.ambientOcclusionOnly?AmbientOcclusionOutputType.Occlusion:null})]})},creditContainer=document.createElement("div"),Component=React.forwardRef(Cesium),engine={component:Component,featureComponent:Feature$1,clusterComponent:Cluster,sketchComponent:SketchComponent,delegatedDataTypes:["czml","wms","mvt","3dtiles","osm-buildings","kml"]},engines={cesium:engine};function Error$1({error:t,resetErrorBoundary:n}){return jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h1",{children:"Oops! An Error Occurred"}),jsxRuntimeExports.jsx("p",{children:t.message}),jsxRuntimeExports.jsx("p",{children:jsxRuntimeExports.jsx("button",{style:{color:"#fff"},onClick:n,children:"Retry"})})]})}const version$1="0.0.7-alpha.38",useCoreAPI=({viewerProperty:t})=>{const n=React.useRef(t);n.current=t;const o=React.useMemo(()=>({get version(){return version$1},get viewerProperty(){return n.current}}),[]);React.useEffect(()=>{window.reearth_core=o},[o])},viewportMobileMaxWidth=768,useViewport=({wrapperRef:t})=>{const n=React.useMemo(()=>paramsToObject(new URLSearchParams(window.location.search)),[]),[o,s]=React.useState({width:void 0,height:void 0,isMobile:void 0,query:n});return React.useEffect(()=>{const c=new ResizeObserver(d=>{var S,P;const[h]=d;let p,y;if(h.contentBoxSize){const L=Array.isArray(h.contentBoxSize)?h.contentBoxSize[0]:h.contentBoxSize;p=L.inlineSize,y=L.blockSize}else h.contentRect?(p=h.contentRect.width,y=h.contentRect.height):(p=(S=t.current)==null?void 0:S.clientWidth,y=(P=t.current)==null?void 0:P.clientHeight);s(L=>({width:p,height:y,isMobile:p?p<=viewportMobileMaxWidth:void 0,query:L.query}))});return t.current&&c.observe(t.current),()=>{c.disconnect()}},[t]),o};function paramsToObject(t){const n={};for(const[o,s]of t)n[o]=s;return n}function useHooks({camera:t,interactionMode:n,zoomedLayerId:o,viewerProperty:s,onLayerSelect:c,onCameraChange:d,onInteractionModeChange:h,onZoomToLayer:p,onLayerDrop:y,onSketchTypeChangeProp:S},P){const L=React.useRef(null);React.useImperativeHandle(P,()=>L.current,[]);const F=React.useRef(null),N=useViewport({wrapperRef:F}),[z,W]=React.useState({}),[nt,Pe]=React.useState(),[se,mt]=React.useState(),kt=React.useCallback(async(_f,wf,Yf,Nf,vf)=>{var Qf,_m,Bf,$m,qf,qm,ep,Tf,rf,bf,If;const Ff=((Qf=z.layer)==null?void 0:Qf.layer.type)==="simple"&&(($m=(Bf=(_m=z.layer)==null?void 0:_m.layer)==null?void 0:Bf.data)==null?void 0:$m.isSketchLayer);if(z.layerId===_f&&z.featureId===wf&&!Ff)return;const Xf=await(Yf==null?void 0:Yf()),Wf=_f&&wf?(Ff?(qf=Xf==null?void 0:Xf.features)==null?void 0:qf.find(Uf=>Uf.id===wf):(Tf=(qm=L.current)==null?void 0:(ep=qm.engine).findComputedFeatureById)==null?void 0:Tf.call(ep,_f,wf))??(vf==null?void 0:vf.feature):void 0;Pe(_f&&wf?(If=(rf=L.current)==null?void 0:(bf=rf.engine).findFeatureById)==null?void 0:If.call(bf,_f,wf):void 0),mt(Wf),W(Uf=>Uf.layerId===_f&&Uf.featureId===wf?Uf:{layerId:_f,featureId:wf,layer:Xf,reason:Nf}),c==null||c(_f,Yf,Wf,Nf)},[z,c]),mn=React.useRef(),[_i,zi]=useValue(t,d),[Sa,fa]=React.useState(!1),La=React.useCallback(_f=>{fa(!!_f)},[]),[Ra,ma]=useValue(n||"default",h);React.useEffect(()=>{var _f,wf;Ra==="default"&&((wf=(_f=L==null?void 0:L.current)==null?void 0:_f.engine)==null||wf.setCursor("auto"))},[Ra]);const yt=INTERACTION_MODES[Ra??"default"],lt=React.useRef(),pi=React.useCallback(_f=>{lt.current=_f},[]),ba=React.useCallback(_f=>{var wf;(wf=lt.current)==null||wf.call(lt,_f)},[]),Sc=React.useRef(),ms=React.useCallback(_f=>{Sc.current=_f},[]),Xs=React.useCallback(_f=>{var wf;(wf=Sc.current)==null||wf.call(Sc,_f)},[]),Nl=React.useRef(),pu=React.useCallback(_f=>{Nl.current=_f},[]),yu=React.useCallback(_f=>{var wf;(wf=Nl.current)==null||wf.call(Nl,_f)},[]),Ru=React.useRef(),Vd=React.useCallback(_f=>{Ru.current=_f},[]),Gd=React.useCallback(_f=>{var wf;(wf=Ru.current)==null||wf.call(Ru,_f)},[]),uf=React.useRef(),ff=React.useCallback(_f=>{uf.current=_f},[]),pf=React.useCallback(_f=>{var wf;(wf=uf.current)==null||wf.call(uf,_f)},[]),hf=React.useRef(),of=React.useCallback(_f=>{hf.current=_f},[]),gf=React.useCallback(_f=>{var wf;(wf=hf.current)==null||wf.call(hf,_f)},[]),Ef=React.useRef([]),xf=React.useCallback(_f=>{Ef.current.push(_f)},[]),Wa=React.useCallback(_f=>{Ef.current.forEach(wf=>wf(_f))},[]),af=React.useRef([]),Xd=React.useCallback(_f=>{af.current.push(_f)},[]),gd=React.useCallback(_f=>{af.current.forEach(wf=>wf(_f))},[]),pd=React.useRef([]),Zd=React.useCallback(_f=>{pd.current.push(_f)},[]),cf=React.useCallback(_f=>{pd.current.forEach(wf=>wf(_f))},[]),sf=React.useRef([]),nf=React.useCallback(_f=>{sf.current.push(_f)},[]),df=React.useCallback((_f,wf)=>{sf.current.forEach(Yf=>Yf(_f)),S==null||S(_f,wf)},[S]);React.useEffect(()=>{var _f,wf;o&&((wf=(_f=L.current)==null?void 0:_f.engine)==null||wf.lookAtLayer(o),p==null||p(void 0))},[o,p]);const[Cf,mf]=React.useState(!1),Sf=React.useCallback(()=>{mf(!0)},[]),Pf=React.useCallback((_f,wf,Yf)=>{var Ff;mf(!1);const Nf=(Ff=L.current)==null?void 0:Ff.layers.findById(_f),vf=Nf!=null&&Nf.property.default.location?"default.location":Nf!=null&&Nf.property.default.position?"default.position":void 0;Yf&&Nf&&Nf.propertyId&&vf&&(y==null||y(Nf.propertyId,vf,Yf))},[y,L]),Af=React.useMemo(()=>({interactionMode:Ra,selectedLayer:z,selectedComputedFeature:se,viewport:N,handleCameraForceHorizontalRollChange:La,handleInteractionModeChange:ma,onSketchPluginFeatureCreate:xf,onSketchPluginFeatureUpdate:Xd,onSketchPluginFeatureDelete:Zd,onSketchTypeChange:nf,onLayerVisibility:ms,onLayerLoad:pu,onLayerEdit:pi,onLayerSelectWithRectStart:Vd,onLayerSelectWithRectMove:ff,onLayerSelectWithRectEnd:of}),[Ra,z,se,N,ma,La,pi,xf,Xd,Zd,nf,ms,pu,Vd,ff,of]),Hf=React.useMemo(()=>({position:"relative",width:"100%",height:"100%",overflow:"hidden"}),[]);return useCoreAPI({viewerProperty:s}),{mapRef:L,wrapperRef:F,selectedFeature:nt,camera:_i,featureFlags:yt,isLayerDragging:Cf,timelineManagerRef:mn,cameraForceHorizontalRoll:Sa,coreContextValue:Af,containerStyle:Hf,overriddenInteractionMode:Ra,handleLayerSelect:kt,handleLayerDrag:Sf,handleLayerDrop:Pf,handleLayerEdit:ba,handleCameraChange:zi,handleInteractionModeChange:ma,handleSketchPluginFeatureCreate:Wa,handleSketchPluginFeatureUpdate:gd,handleSketchPluginFeatureDelete:cf,handleSketchTypeChange:df,handleLayerVisibility:Xs,handleLayerLoad:yu,handleLayerSelectWithRectStart:Gd,handleLayerSelectWithRectMove:pf,handleLayerSelectWithRectEnd:gf}}function useValue(t,n){const[o,s]=React.useState(t),c=React.useCallback(d=>{d&&(s(d),n==null||n(d))},[n]);return React.useEffect(()=>{s(t)},[t]),[o,c]}const CoreVisualizer=React.memo(React.forwardRef(({engine:t,isBuilt:n,isEditable:o,viewerProperty:s,layers:c,clusters:d,small:h,ready:p,hiddenLayers:y,camera:S,time:P,interactionMode:L,shouldRender:F,meta:N,displayCredits:z=!0,style:W,zoomedLayerId:nt,children:Pe,onLayerDrop:se,onLayerSelect:mt,onCameraChange:kt,onZoomToLayer:mn,onInteractionModeChange:_i,onMount:zi,onSketchTypeChangeProp:Sa,onSketchFeatureCreate:fa,onSketchFeatureUpdate:La,onSketchFeatureDelete:Ra,onAPIReady:ma,onCreditsUpdate:yt},lt)=>{const{mapRef:pi,wrapperRef:ba,selectedFeature:Sc,camera:ms,featureFlags:Xs,isLayerDragging:Nl,timelineManagerRef:pu,cameraForceHorizontalRoll:yu,coreContextValue:Ru,containerStyle:Vd,overriddenInteractionMode:Gd,handleLayerSelect:uf,handleLayerDrag:ff,handleLayerDrop:pf,handleLayerEdit:hf,handleCameraChange:of,handleInteractionModeChange:gf,handleSketchPluginFeatureCreate:Ef,handleSketchPluginFeatureUpdate:xf,handleSketchPluginFeatureDelete:Wa,handleSketchTypeChange:af,handleLayerVisibility:Xd,handleLayerLoad:gd,handleLayerSelectWithRectStart:pd,handleLayerSelectWithRectMove:Zd,handleLayerSelectWithRectEnd:cf}=useHooks({camera:S,interactionMode:L,zoomedLayerId:nt,viewerProperty:s,onLayerSelect:mt,onCameraChange:kt,onZoomToLayer:mn,onLayerDrop:se,onInteractionModeChange:_i,onSketchTypeChangeProp:Sa},lt);return jsxRuntimeExports.jsx(ErrorBoundary,{FallbackComponent:Error$1,children:jsxRuntimeExports.jsx(VisualizerProvider,{mapRef:pi,children:jsxRuntimeExports.jsxs("div",{ref:ba,style:Vd,children:[jsxRuntimeExports.jsx(Map$1,{ref:pi,isBuilt:n,isEditable:o,engine:t,layers:c,engines,camera:ms,cameraForceHorizontalRoll:yu,clusters:d,hiddenLayers:y,isLayerDragging:Nl,isLayerDraggable:o,meta:N,displayCredits:z,style:W,featureFlags:Xs,shouldRender:F,property:s,time:P,small:h,ready:p,timelineManagerRef:pu,interactionMode:Gd,selectedFeature:Sc,onCameraChange:of,onLayerDrag:ff,onLayerDrop:pf,onLayerSelect:uf,onLayerEdit:hf,overrideInteractionMode:gf,onSketchFeatureCreate:fa,onSketchPluginFeatureCreate:Ef,onSketchFeatureUpdate:La,onSketchPluginFeatureUpdate:xf,onSketchFeatureDelete:Ra,onSketchPluginFeatureDelete:Wa,onSketchTypeChange:af,onMount:zi,onLayerVisibility:Xd,onLayerLoad:gd,onLayerSelectWithRectStart:pd,onLayerSelectWithRectMove:Zd,onLayerSelectWithRectEnd:cf,onAPIReady:ma,onCreditsUpdate:yt}),jsxRuntimeExports.jsx(coreContext.Provider,{value:Ru,children:Pe})]})})})}));var global$1=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},lookup=[],revLookup=[],Arr=typeof Uint8Array<"u"?Uint8Array:Array,inited=!1;function init(){inited=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=0,o=t.length;n<o;++n)lookup[n]=t[n],revLookup[t.charCodeAt(n)]=n;revLookup[45]=62,revLookup[95]=63}function toByteArray(t){inited||init();var n,o,s,c,d,h,p=t.length;if(p%4>0)throw new Error("Invalid string. Length must be a multiple of 4");d=t[p-2]==="="?2:t[p-1]==="="?1:0,h=new Arr(p*3/4-d),s=d>0?p-4:p;var y=0;for(n=0,o=0;n<s;n+=4,o+=3)c=revLookup[t.charCodeAt(n)]<<18|revLookup[t.charCodeAt(n+1)]<<12|revLookup[t.charCodeAt(n+2)]<<6|revLookup[t.charCodeAt(n+3)],h[y++]=c>>16&255,h[y++]=c>>8&255,h[y++]=c&255;return d===2?(c=revLookup[t.charCodeAt(n)]<<2|revLookup[t.charCodeAt(n+1)]>>4,h[y++]=c&255):d===1&&(c=revLookup[t.charCodeAt(n)]<<10|revLookup[t.charCodeAt(n+1)]<<4|revLookup[t.charCodeAt(n+2)]>>2,h[y++]=c>>8&255,h[y++]=c&255),h}function tripletToBase64(t){return lookup[t>>18&63]+lookup[t>>12&63]+lookup[t>>6&63]+lookup[t&63]}function encodeChunk(t,n,o){for(var s,c=[],d=n;d<o;d+=3)s=(t[d]<<16)+(t[d+1]<<8)+t[d+2],c.push(tripletToBase64(s));return c.join("")}function fromByteArray(t){inited||init();for(var n,o=t.length,s=o%3,c="",d=[],h=16383,p=0,y=o-s;p<y;p+=h)d.push(encodeChunk(t,p,p+h>y?y:p+h));return s===1?(n=t[o-1],c+=lookup[n>>2],c+=lookup[n<<4&63],c+="=="):s===2&&(n=(t[o-2]<<8)+t[o-1],c+=lookup[n>>10],c+=lookup[n>>4&63],c+=lookup[n<<2&63],c+="="),d.push(c),d.join("")}function read(t,n,o,s,c){var d,h,p=c*8-s-1,y=(1<<p)-1,S=y>>1,P=-7,L=o?c-1:0,F=o?-1:1,N=t[n+L];for(L+=F,d=N&(1<<-P)-1,N>>=-P,P+=p;P>0;d=d*256+t[n+L],L+=F,P-=8);for(h=d&(1<<-P)-1,d>>=-P,P+=s;P>0;h=h*256+t[n+L],L+=F,P-=8);if(d===0)d=1-S;else{if(d===y)return h?NaN:(N?-1:1)*(1/0);h=h+Math.pow(2,s),d=d-S}return(N?-1:1)*h*Math.pow(2,d-s)}function write(t,n,o,s,c,d){var h,p,y,S=d*8-c-1,P=(1<<S)-1,L=P>>1,F=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,N=s?0:d-1,z=s?1:-1,W=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(p=isNaN(n)?1:0,h=P):(h=Math.floor(Math.log(n)/Math.LN2),n*(y=Math.pow(2,-h))<1&&(h--,y*=2),h+L>=1?n+=F/y:n+=F*Math.pow(2,1-L),n*y>=2&&(h++,y/=2),h+L>=P?(p=0,h=P):h+L>=1?(p=(n*y-1)*Math.pow(2,c),h=h+L):(p=n*Math.pow(2,L-1)*Math.pow(2,c),h=0));c>=8;t[o+N]=p&255,N+=z,p/=256,c-=8);for(h=h<<c|p,S+=c;S>0;t[o+N]=h&255,N+=z,h/=256,S-=8);t[o+N-z]|=W*128}var toString={}.toString,isArray$1=Array.isArray||function(t){return toString.call(t)=="[object Array]"},INSPECT_MAX_BYTES=50;Buffer$1.TYPED_ARRAY_SUPPORT=global$1.TYPED_ARRAY_SUPPORT!==void 0?global$1.TYPED_ARRAY_SUPPORT:!0,kMaxLength();function kMaxLength(){return Buffer$1.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function createBuffer(t,n){if(kMaxLength()<n)throw new RangeError("Invalid typed array length");return Buffer$1.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(n),t.__proto__=Buffer$1.prototype):(t===null&&(t=new Buffer$1(n)),t.length=n),t}function Buffer$1(t,n,o){if(!Buffer$1.TYPED_ARRAY_SUPPORT&&!(this instanceof Buffer$1))return new Buffer$1(t,n,o);if(typeof t=="number"){if(typeof n=="string")throw new Error("If encoding is specified then the first argument must be a string");return allocUnsafe(this,t)}return from(this,t,n,o)}Buffer$1.poolSize=8192,Buffer$1._augment=function(t){return t.__proto__=Buffer$1.prototype,t};function from(t,n,o,s){if(typeof n=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&n instanceof ArrayBuffer?fromArrayBuffer(t,n,o,s):typeof n=="string"?fromString(t,n,o):fromObject(t,n)}Buffer$1.from=function(t,n,o){return from(null,t,n,o)},Buffer$1.TYPED_ARRAY_SUPPORT&&(Buffer$1.prototype.__proto__=Uint8Array.prototype,Buffer$1.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&Buffer$1[Symbol.species]);function assertSize(t){if(typeof t!="number")throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function alloc(t,n,o,s){return assertSize(n),n<=0?createBuffer(t,n):o!==void 0?typeof s=="string"?createBuffer(t,n).fill(o,s):createBuffer(t,n).fill(o):createBuffer(t,n)}Buffer$1.alloc=function(t,n,o){return alloc(null,t,n,o)};function allocUnsafe(t,n){if(assertSize(n),t=createBuffer(t,n<0?0:checked(n)|0),!Buffer$1.TYPED_ARRAY_SUPPORT)for(var o=0;o<n;++o)t[o]=0;return t}Buffer$1.allocUnsafe=function(t){return allocUnsafe(null,t)},Buffer$1.allocUnsafeSlow=function(t){return allocUnsafe(null,t)};function fromString(t,n,o){if((typeof o!="string"||o==="")&&(o="utf8"),!Buffer$1.isEncoding(o))throw new TypeError('"encoding" must be a valid string encoding');var s=byteLength(n,o)|0;t=createBuffer(t,s);var c=t.write(n,o);return c!==s&&(t=t.slice(0,c)),t}function fromArrayLike(t,n){var o=n.length<0?0:checked(n.length)|0;t=createBuffer(t,o);for(var s=0;s<o;s+=1)t[s]=n[s]&255;return t}function fromArrayBuffer(t,n,o,s){if(n.byteLength,o<0||n.byteLength<o)throw new RangeError("'offset' is out of bounds");if(n.byteLength<o+(s||0))throw new RangeError("'length' is out of bounds");return o===void 0&&s===void 0?n=new Uint8Array(n):s===void 0?n=new Uint8Array(n,o):n=new Uint8Array(n,o,s),Buffer$1.TYPED_ARRAY_SUPPORT?(t=n,t.__proto__=Buffer$1.prototype):t=fromArrayLike(t,n),t}function fromObject(t,n){if(internalIsBuffer(n)){var o=checked(n.length)|0;return t=createBuffer(t,o),t.length===0||n.copy(t,0,0,o),t}if(n){if(typeof ArrayBuffer<"u"&&n.buffer instanceof ArrayBuffer||"length"in n)return typeof n.length!="number"||isnan(n.length)?createBuffer(t,0):fromArrayLike(t,n);if(n.type==="Buffer"&&isArray$1(n.data))return fromArrayLike(t,n.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function checked(t){if(t>=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return t|0}Buffer$1.isBuffer=isBuffer;function internalIsBuffer(t){return!!(t!=null&&t._isBuffer)}Buffer$1.compare=function t(n,o){if(!internalIsBuffer(n)||!internalIsBuffer(o))throw new TypeError("Arguments must be Buffers");if(n===o)return 0;for(var s=n.length,c=o.length,d=0,h=Math.min(s,c);d<h;++d)if(n[d]!==o[d]){s=n[d],c=o[d];break}return s<c?-1:c<s?1:0},Buffer$1.isEncoding=function t(n){switch(String(n).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}},Buffer$1.concat=function t(n,o){if(!isArray$1(n))throw new TypeError('"list" argument must be an Array of Buffers');if(n.length===0)return Buffer$1.alloc(0);var s;if(o===void 0)for(o=0,s=0;s<n.length;++s)o+=n[s].length;var c=Buffer$1.allocUnsafe(o),d=0;for(s=0;s<n.length;++s){var h=n[s];if(!internalIsBuffer(h))throw new TypeError('"list" argument must be an Array of Buffers');h.copy(c,d),d+=h.length}return c};function byteLength(t,n){if(internalIsBuffer(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var o=t.length;if(o===0)return 0;for(var s=!1;;)switch(n){case"ascii":case"latin1":case"binary":return o;case"utf8":case"utf-8":case void 0:return utf8ToBytes(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return o*2;case"hex":return o>>>1;case"base64":return base64ToBytes(t).length;default:if(s)return utf8ToBytes(t).length;n=(""+n).toLowerCase(),s=!0}}Buffer$1.byteLength=byteLength;function slowToString(t,n,o){var s=!1;if((n===void 0||n<0)&&(n=0),n>this.length||((o===void 0||o>this.length)&&(o=this.length),o<=0)||(o>>>=0,n>>>=0,o<=n))return"";for(t||(t="utf8");;)switch(t){case"hex":return hexSlice(this,n,o);case"utf8":case"utf-8":return utf8Slice(this,n,o);case"ascii":return asciiSlice(this,n,o);case"latin1":case"binary":return latin1Slice(this,n,o);case"base64":return base64Slice(this,n,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,n,o);default:if(s)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),s=!0}}Buffer$1.prototype._isBuffer=!0;function swap(t,n,o){var s=t[n];t[n]=t[o],t[o]=s}Buffer$1.prototype.swap16=function t(){var n=this.length;if(n%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var o=0;o<n;o+=2)swap(this,o,o+1);return this},Buffer$1.prototype.swap32=function t(){var n=this.length;if(n%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var o=0;o<n;o+=4)swap(this,o,o+3),swap(this,o+1,o+2);return this},Buffer$1.prototype.swap64=function t(){var n=this.length;if(n%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var o=0;o<n;o+=8)swap(this,o,o+7),swap(this,o+1,o+6),swap(this,o+2,o+5),swap(this,o+3,o+4);return this},Buffer$1.prototype.toString=function t(){var n=this.length|0;return n===0?"":arguments.length===0?utf8Slice(this,0,n):slowToString.apply(this,arguments)},Buffer$1.prototype.equals=function t(n){if(!internalIsBuffer(n))throw new TypeError("Argument must be a Buffer");return this===n?!0:Buffer$1.compare(this,n)===0},Buffer$1.prototype.inspect=function t(){var n="",o=INSPECT_MAX_BYTES;return this.length>0&&(n=this.toString("hex",0,o).match(/.{2}/g).join(" "),this.length>o&&(n+=" ... ")),"<Buffer "+n+">"},Buffer$1.prototype.compare=function t(n,o,s,c,d){if(!internalIsBuffer(n))throw new TypeError("Argument must be a Buffer");if(o===void 0&&(o=0),s===void 0&&(s=n?n.length:0),c===void 0&&(c=0),d===void 0&&(d=this.length),o<0||s>n.length||c<0||d>this.length)throw new RangeError("out of range index");if(c>=d&&o>=s)return 0;if(c>=d)return-1;if(o>=s)return 1;if(o>>>=0,s>>>=0,c>>>=0,d>>>=0,this===n)return 0;for(var h=d-c,p=s-o,y=Math.min(h,p),S=this.slice(c,d),P=n.slice(o,s),L=0;L<y;++L)if(S[L]!==P[L]){h=S[L],p=P[L];break}return h<p?-1:p<h?1:0};function bidirectionalIndexOf(t,n,o,s,c){if(t.length===0)return-1;if(typeof o=="string"?(s=o,o=0):o>2147483647?o=2147483647:o<-2147483648&&(o=-2147483648),o=+o,isNaN(o)&&(o=c?0:t.length-1),o<0&&(o=t.length+o),o>=t.length){if(c)return-1;o=t.length-1}else if(o<0)if(c)o=0;else return-1;if(typeof n=="string"&&(n=Buffer$1.from(n,s)),internalIsBuffer(n))return n.length===0?-1:arrayIndexOf(t,n,o,s,c);if(typeof n=="number")return n=n&255,Buffer$1.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?c?Uint8Array.prototype.indexOf.call(t,n,o):Uint8Array.prototype.lastIndexOf.call(t,n,o):arrayIndexOf(t,[n],o,s,c);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(t,n,o,s,c){var d=1,h=t.length,p=n.length;if(s!==void 0&&(s=String(s).toLowerCase(),s==="ucs2"||s==="ucs-2"||s==="utf16le"||s==="utf-16le")){if(t.length<2||n.length<2)return-1;d=2,h/=2,p/=2,o/=2}function y(N,z){return d===1?N[z]:N.readUInt16BE(z*d)}var S;if(c){var P=-1;for(S=o;S<h;S++)if(y(t,S)===y(n,P===-1?0:S-P)){if(P===-1&&(P=S),S-P+1===p)return P*d}else P!==-1&&(S-=S-P),P=-1}else for(o+p>h&&(o=h-p),S=o;S>=0;S--){for(var L=!0,F=0;F<p;F++)if(y(t,S+F)!==y(n,F)){L=!1;break}if(L)return S}return-1}Buffer$1.prototype.includes=function t(n,o,s){return this.indexOf(n,o,s)!==-1},Buffer$1.prototype.indexOf=function t(n,o,s){return bidirectionalIndexOf(this,n,o,s,!0)},Buffer$1.prototype.lastIndexOf=function t(n,o,s){return bidirectionalIndexOf(this,n,o,s,!1)};function hexWrite(t,n,o,s){o=Number(o)||0;var c=t.length-o;s?(s=Number(s),s>c&&(s=c)):s=c;var d=n.length;if(d%2!==0)throw new TypeError("Invalid hex string");s>d/2&&(s=d/2);for(var h=0;h<s;++h){var p=parseInt(n.substr(h*2,2),16);if(isNaN(p))return h;t[o+h]=p}return h}function utf8Write(t,n,o,s){return blitBuffer(utf8ToBytes(n,t.length-o),t,o,s)}function asciiWrite(t,n,o,s){return blitBuffer(asciiToBytes(n),t,o,s)}function latin1Write(t,n,o,s){return asciiWrite(t,n,o,s)}function base64Write(t,n,o,s){return blitBuffer(base64ToBytes(n),t,o,s)}function ucs2Write(t,n,o,s){return blitBuffer(utf16leToBytes(n,t.length-o),t,o,s)}Buffer$1.prototype.write=function t(n,o,s,c){if(o===void 0)c="utf8",s=this.length,o=0;else if(s===void 0&&typeof o=="string")c=o,s=this.length,o=0;else if(isFinite(o))o=o|0,isFinite(s)?(s=s|0,c===void 0&&(c="utf8")):(c=s,s=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var d=this.length-o;if((s===void 0||s>d)&&(s=d),n.length>0&&(s<0||o<0)||o>this.length)throw new RangeError("Attempt to write outside buffer bounds");c||(c="utf8");for(var h=!1;;)switch(c){case"hex":return hexWrite(this,n,o,s);case"utf8":case"utf-8":return utf8Write(this,n,o,s);case"ascii":return asciiWrite(this,n,o,s);case"latin1":case"binary":return latin1Write(this,n,o,s);case"base64":return base64Write(this,n,o,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,n,o,s);default:if(h)throw new TypeError("Unknown encoding: "+c);c=(""+c).toLowerCase(),h=!0}},Buffer$1.prototype.toJSON=function t(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function base64Slice(t,n,o){return n===0&&o===t.length?fromByteArray(t):fromByteArray(t.slice(n,o))}function utf8Slice(t,n,o){o=Math.min(t.length,o);for(var s=[],c=n;c<o;){var d=t[c],h=null,p=d>239?4:d>223?3:d>191?2:1;if(c+p<=o){var y,S,P,L;switch(p){case 1:d<128&&(h=d);break;case 2:y=t[c+1],(y&192)===128&&(L=(d&31)<<6|y&63,L>127&&(h=L));break;case 3:y=t[c+1],S=t[c+2],(y&192)===128&&(S&192)===128&&(L=(d&15)<<12|(y&63)<<6|S&63,L>2047&&(L<55296||L>57343)&&(h=L));break;case 4:y=t[c+1],S=t[c+2],P=t[c+3],(y&192)===128&&(S&192)===128&&(P&192)===128&&(L=(d&15)<<18|(y&63)<<12|(S&63)<<6|P&63,L>65535&&L<1114112&&(h=L))}}h===null?(h=65533,p=1):h>65535&&(h-=65536,s.push(h>>>10&1023|55296),h=56320|h&1023),s.push(h),c+=p}return decodeCodePointsArray(s)}var MAX_ARGUMENTS_LENGTH=4096;function decodeCodePointsArray(t){var n=t.length;if(n<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,t);for(var o="",s=0;s<n;)o+=String.fromCharCode.apply(String,t.slice(s,s+=MAX_ARGUMENTS_LENGTH));return o}function asciiSlice(t,n,o){var s="";o=Math.min(t.length,o);for(var c=n;c<o;++c)s+=String.fromCharCode(t[c]&127);return s}function latin1Slice(t,n,o){var s="";o=Math.min(t.length,o);for(var c=n;c<o;++c)s+=String.fromCharCode(t[c]);return s}function hexSlice(t,n,o){var s=t.length;(!n||n<0)&&(n=0),(!o||o<0||o>s)&&(o=s);for(var c="",d=n;d<o;++d)c+=toHex(t[d]);return c}function utf16leSlice(t,n,o){for(var s=t.slice(n,o),c="",d=0;d<s.length;d+=2)c+=String.fromCharCode(s[d]+s[d+1]*256);return c}Buffer$1.prototype.slice=function t(n,o){var s=this.length;n=~~n,o=o===void 0?s:~~o,n<0?(n+=s,n<0&&(n=0)):n>s&&(n=s),o<0?(o+=s,o<0&&(o=0)):o>s&&(o=s),o<n&&(o=n);var c;if(Buffer$1.TYPED_ARRAY_SUPPORT)c=this.subarray(n,o),c.__proto__=Buffer$1.prototype;else{var d=o-n;c=new Buffer$1(d,void 0);for(var h=0;h<d;++h)c[h]=this[h+n]}return c};function checkOffset(t,n,o){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+n>o)throw new RangeError("Trying to access beyond buffer length")}Buffer$1.prototype.readUIntLE=function t(n,o,s){n=n|0,o=o|0,s||checkOffset(n,o,this.length);for(var c=this[n],d=1,h=0;++h<o&&(d*=256);)c+=this[n+h]*d;return c},Buffer$1.prototype.readUIntBE=function t(n,o,s){n=n|0,o=o|0,s||checkOffset(n,o,this.length);for(var c=this[n+--o],d=1;o>0&&(d*=256);)c+=this[n+--o]*d;return c},Buffer$1.prototype.readUInt8=function t(n,o){return o||checkOffset(n,1,this.length),this[n]},Buffer$1.prototype.readUInt16LE=function t(n,o){return o||checkOffset(n,2,this.length),this[n]|this[n+1]<<8},Buffer$1.prototype.readUInt16BE=function t(n,o){return o||checkOffset(n,2,this.length),this[n]<<8|this[n+1]},Buffer$1.prototype.readUInt32LE=function t(n,o){return o||checkOffset(n,4,this.length),(this[n]|this[n+1]<<8|this[n+2]<<16)+this[n+3]*16777216},Buffer$1.prototype.readUInt32BE=function t(n,o){return o||checkOffset(n,4,this.length),this[n]*16777216+(this[n+1]<<16|this[n+2]<<8|this[n+3])},Buffer$1.prototype.readIntLE=function t(n,o,s){n=n|0,o=o|0,s||checkOffset(n,o,this.length);for(var c=this[n],d=1,h=0;++h<o&&(d*=256);)c+=this[n+h]*d;return d*=128,c>=d&&(c-=Math.pow(2,8*o)),c},Buffer$1.prototype.readIntBE=function t(n,o,s){n=n|0,o=o|0,s||checkOffset(n,o,this.length);for(var c=o,d=1,h=this[n+--c];c>0&&(d*=256);)h+=this[n+--c]*d;return d*=128,h>=d&&(h-=Math.pow(2,8*o)),h},Buffer$1.prototype.readInt8=function t(n,o){return o||checkOffset(n,1,this.length),this[n]&128?(255-this[n]+1)*-1:this[n]},Buffer$1.prototype.readInt16LE=function t(n,o){o||checkOffset(n,2,this.length);var s=this[n]|this[n+1]<<8;return s&32768?s|4294901760:s},Buffer$1.prototype.readInt16BE=function t(n,o){o||checkOffset(n,2,this.length);var s=this[n+1]|this[n]<<8;return s&32768?s|4294901760:s},Buffer$1.prototype.readInt32LE=function t(n,o){return o||checkOffset(n,4,this.length),this[n]|this[n+1]<<8|this[n+2]<<16|this[n+3]<<24},Buffer$1.prototype.readInt32BE=function t(n,o){return o||checkOffset(n,4,this.length),this[n]<<24|this[n+1]<<16|this[n+2]<<8|this[n+3]},Buffer$1.prototype.readFloatLE=function t(n,o){return o||checkOffset(n,4,this.length),read(this,n,!0,23,4)},Buffer$1.prototype.readFloatBE=function t(n,o){return o||checkOffset(n,4,this.length),read(this,n,!1,23,4)},Buffer$1.prototype.readDoubleLE=function t(n,o){return o||checkOffset(n,8,this.length),read(this,n,!0,52,8)},Buffer$1.prototype.readDoubleBE=function t(n,o){return o||checkOffset(n,8,this.length),read(this,n,!1,52,8)};function checkInt(t,n,o,s,c,d){if(!internalIsBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>c||n<d)throw new RangeError('"value" argument is out of bounds');if(o+s>t.length)throw new RangeError("Index out of range")}Buffer$1.prototype.writeUIntLE=function t(n,o,s,c){if(n=+n,o=o|0,s=s|0,!c){var d=Math.pow(2,8*s)-1;checkInt(this,n,o,s,d,0)}var h=1,p=0;for(this[o]=n&255;++p<s&&(h*=256);)this[o+p]=n/h&255;return o+s},Buffer$1.prototype.writeUIntBE=function t(n,o,s,c){if(n=+n,o=o|0,s=s|0,!c){var d=Math.pow(2,8*s)-1;checkInt(this,n,o,s,d,0)}var h=s-1,p=1;for(this[o+h]=n&255;--h>=0&&(p*=256);)this[o+h]=n/p&255;return o+s},Buffer$1.prototype.writeUInt8=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,1,255,0),Buffer$1.TYPED_ARRAY_SUPPORT||(n=Math.floor(n)),this[o]=n&255,o+1};function objectWriteUInt16(t,n,o,s){n<0&&(n=65535+n+1);for(var c=0,d=Math.min(t.length-o,2);c<d;++c)t[o+c]=(n&255<<8*(s?c:1-c))>>>(s?c:1-c)*8}Buffer$1.prototype.writeUInt16LE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,2,65535,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o]=n&255,this[o+1]=n>>>8):objectWriteUInt16(this,n,o,!0),o+2},Buffer$1.prototype.writeUInt16BE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,2,65535,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o]=n>>>8,this[o+1]=n&255):objectWriteUInt16(this,n,o,!1),o+2};function objectWriteUInt32(t,n,o,s){n<0&&(n=4294967295+n+1);for(var c=0,d=Math.min(t.length-o,4);c<d;++c)t[o+c]=n>>>(s?c:3-c)*8&255}Buffer$1.prototype.writeUInt32LE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,4,4294967295,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o+3]=n>>>24,this[o+2]=n>>>16,this[o+1]=n>>>8,this[o]=n&255):objectWriteUInt32(this,n,o,!0),o+4},Buffer$1.prototype.writeUInt32BE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,4,4294967295,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255):objectWriteUInt32(this,n,o,!1),o+4},Buffer$1.prototype.writeIntLE=function t(n,o,s,c){if(n=+n,o=o|0,!c){var d=Math.pow(2,8*s-1);checkInt(this,n,o,s,d-1,-d)}var h=0,p=1,y=0;for(this[o]=n&255;++h<s&&(p*=256);)n<0&&y===0&&this[o+h-1]!==0&&(y=1),this[o+h]=(n/p>>0)-y&255;return o+s},Buffer$1.prototype.writeIntBE=function t(n,o,s,c){if(n=+n,o=o|0,!c){var d=Math.pow(2,8*s-1);checkInt(this,n,o,s,d-1,-d)}var h=s-1,p=1,y=0;for(this[o+h]=n&255;--h>=0&&(p*=256);)n<0&&y===0&&this[o+h+1]!==0&&(y=1),this[o+h]=(n/p>>0)-y&255;return o+s},Buffer$1.prototype.writeInt8=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,1,127,-128),Buffer$1.TYPED_ARRAY_SUPPORT||(n=Math.floor(n)),n<0&&(n=255+n+1),this[o]=n&255,o+1},Buffer$1.prototype.writeInt16LE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,2,32767,-32768),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o]=n&255,this[o+1]=n>>>8):objectWriteUInt16(this,n,o,!0),o+2},Buffer$1.prototype.writeInt16BE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,2,32767,-32768),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o]=n>>>8,this[o+1]=n&255):objectWriteUInt16(this,n,o,!1),o+2},Buffer$1.prototype.writeInt32LE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,4,2147483647,-2147483648),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o]=n&255,this[o+1]=n>>>8,this[o+2]=n>>>16,this[o+3]=n>>>24):objectWriteUInt32(this,n,o,!0),o+4},Buffer$1.prototype.writeInt32BE=function t(n,o,s){return n=+n,o=o|0,s||checkInt(this,n,o,4,2147483647,-2147483648),n<0&&(n=4294967295+n+1),Buffer$1.TYPED_ARRAY_SUPPORT?(this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255):objectWriteUInt32(this,n,o,!1),o+4};function checkIEEE754(t,n,o,s,c,d){if(o+s>t.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("Index out of range")}function writeFloat(t,n,o,s,c){return c||checkIEEE754(t,n,o,4),write(t,n,o,s,23,4),o+4}Buffer$1.prototype.writeFloatLE=function t(n,o,s){return writeFloat(this,n,o,!0,s)},Buffer$1.prototype.writeFloatBE=function t(n,o,s){return writeFloat(this,n,o,!1,s)};function writeDouble(t,n,o,s,c){return c||checkIEEE754(t,n,o,8),write(t,n,o,s,52,8),o+8}Buffer$1.prototype.writeDoubleLE=function t(n,o,s){return writeDouble(this,n,o,!0,s)},Buffer$1.prototype.writeDoubleBE=function t(n,o,s){return writeDouble(this,n,o,!1,s)},Buffer$1.prototype.copy=function t(n,o,s,c){if(s||(s=0),!c&&c!==0&&(c=this.length),o>=n.length&&(o=n.length),o||(o=0),c>0&&c<s&&(c=s),c===s||n.length===0||this.length===0)return 0;if(o<0)throw new RangeError("targetStart out of bounds");if(s<0||s>=this.length)throw new RangeError("sourceStart out of bounds");if(c<0)throw new RangeError("sourceEnd out of bounds");c>this.length&&(c=this.length),n.length-o<c-s&&(c=n.length-o+s);var d=c-s,h;if(this===n&&s<o&&o<c)for(h=d-1;h>=0;--h)n[h+o]=this[h+s];else if(d<1e3||!Buffer$1.TYPED_ARRAY_SUPPORT)for(h=0;h<d;++h)n[h+o]=this[h+s];else Uint8Array.prototype.set.call(n,this.subarray(s,s+d),o);return d},Buffer$1.prototype.fill=function t(n,o,s,c){if(typeof n=="string"){if(typeof o=="string"?(c=o,o=0,s=this.length):typeof s=="string"&&(c=s,s=this.length),n.length===1){var d=n.charCodeAt(0);d<256&&(n=d)}if(c!==void 0&&typeof c!="string")throw new TypeError("encoding must be a string");if(typeof c=="string"&&!Buffer$1.isEncoding(c))throw new TypeError("Unknown encoding: "+c)}else typeof n=="number"&&(n=n&255);if(o<0||this.length<o||this.length<s)throw new RangeError("Out of range index");if(s<=o)return this;o=o>>>0,s=s===void 0?this.length:s>>>0,n||(n=0);var h;if(typeof n=="number")for(h=o;h<s;++h)this[h]=n;else{var p=internalIsBuffer(n)?n:utf8ToBytes(new Buffer$1(n,c).toString()),y=p.length;for(h=0;h<s-o;++h)this[h+o]=p[h%y]}return this};var INVALID_BASE64_RE=/[^+\/0-9A-Za-z-_]/g;function base64clean(t){if(t=stringtrim(t).replace(INVALID_BASE64_RE,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function stringtrim(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function toHex(t){return t<16?"0"+t.toString(16):t.toString(16)}function utf8ToBytes(t,n){n=n||1/0;for(var o,s=t.length,c=null,d=[],h=0;h<s;++h){if(o=t.charCodeAt(h),o>55295&&o<57344){if(!c){if(o>56319){(n-=3)>-1&&d.push(239,191,189);continue}else if(h+1===s){(n-=3)>-1&&d.push(239,191,189);continue}c=o;continue}if(o<56320){(n-=3)>-1&&d.push(239,191,189),c=o;continue}o=(c-55296<<10|o-56320)+65536}else c&&(n-=3)>-1&&d.push(239,191,189);if(c=null,o<128){if((n-=1)<0)break;d.push(o)}else if(o<2048){if((n-=2)<0)break;d.push(o>>6|192,o&63|128)}else if(o<65536){if((n-=3)<0)break;d.push(o>>12|224,o>>6&63|128,o&63|128)}else if(o<1114112){if((n-=4)<0)break;d.push(o>>18|240,o>>12&63|128,o>>6&63|128,o&63|128)}else throw new Error("Invalid code point")}return d}function asciiToBytes(t){for(var n=[],o=0;o<t.length;++o)n.push(t.charCodeAt(o)&255);return n}function utf16leToBytes(t,n){for(var o,s,c,d=[],h=0;h<t.length&&!((n-=2)<0);++h)o=t.charCodeAt(h),s=o>>8,c=o%256,d.push(c),d.push(s);return d}function base64ToBytes(t){return toByteArray(base64clean(t))}function blitBuffer(t,n,o,s){for(var c=0;c<s&&!(c+o>=n.length||c>=t.length);++c)n[c+o]=t[c];return c}function isnan(t){return t!==t}function isBuffer(t){return t!=null&&(!!t._isBuffer||isFastBuffer(t)||isSlowBuffer(t))}function isFastBuffer(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function isSlowBuffer(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&isFastBuffer(t.slice(0,0))}var domain;function EventHandlers(){}EventHandlers.prototype=Object.create(null);function EventEmitter(){EventEmitter.init.call(this)}EventEmitter.EventEmitter=EventEmitter,EventEmitter.usingDomains=!1,EventEmitter.prototype.domain=void 0,EventEmitter.prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0,EventEmitter.defaultMaxListeners=10,EventEmitter.init=function(){this.domain=null,EventEmitter.usingDomains&&domain.active,(!this._events||this._events===Object.getPrototypeOf(this)._events)&&(this._events=new EventHandlers,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},EventEmitter.prototype.setMaxListeners=function t(n){if(typeof n!="number"||n<0||isNaN(n))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=n,this};function $getMaxListeners(t){return t._maxListeners===void 0?EventEmitter.defaultMaxListeners:t._maxListeners}EventEmitter.prototype.getMaxListeners=function t(){return $getMaxListeners(this)};function emitNone(t,n,o){if(n)t.call(o);else for(var s=t.length,c=arrayClone(t,s),d=0;d<s;++d)c[d].call(o)}function emitOne(t,n,o,s){if(n)t.call(o,s);else for(var c=t.length,d=arrayClone(t,c),h=0;h<c;++h)d[h].call(o,s)}function emitTwo(t,n,o,s,c){if(n)t.call(o,s,c);else for(var d=t.length,h=arrayClone(t,d),p=0;p<d;++p)h[p].call(o,s,c)}function emitThree(t,n,o,s,c,d){if(n)t.call(o,s,c,d);else for(var h=t.length,p=arrayClone(t,h),y=0;y<h;++y)p[y].call(o,s,c,d)}function emitMany(t,n,o,s){if(n)t.apply(o,s);else for(var c=t.length,d=arrayClone(t,c),h=0;h<c;++h)d[h].apply(o,s)}EventEmitter.prototype.emit=function t(n){var o,s,c,d,h,p,y,S=n==="error";if(p=this._events,p)S=S&&p.error==null;else if(!S)return!1;if(y=this.domain,S){if(o=arguments[1],y)o||(o=new Error('Uncaught, unspecified "error" event')),o.domainEmitter=this,o.domain=y,o.domainThrown=!1,y.emit("error",o);else{if(o instanceof Error)throw o;var P=new Error('Uncaught, unspecified "error" event. ('+o+")");throw P.context=o,P}return!1}if(s=p[n],!s)return!1;var L=typeof s=="function";switch(c=arguments.length,c){case 1:emitNone(s,L,this);break;case 2:emitOne(s,L,this,arguments[1]);break;case 3:emitTwo(s,L,this,arguments[1],arguments[2]);break;case 4:emitThree(s,L,this,arguments[1],arguments[2],arguments[3]);break;default:for(d=new Array(c-1),h=1;h<c;h++)d[h-1]=arguments[h];emitMany(s,L,this,d)}return!0};function _addListener(t,n,o,s){var c,d,h;if(typeof o!="function")throw new TypeError('"listener" argument must be a function');if(d=t._events,d?(d.newListener&&(t.emit("newListener",n,o.listener?o.listener:o),d=t._events),h=d[n]):(d=t._events=new EventHandlers,t._eventsCount=0),!h)h=d[n]=o,++t._eventsCount;else if(typeof h=="function"?h=d[n]=s?[o,h]:[h,o]:s?h.unshift(o):h.push(o),!h.warned&&(c=$getMaxListeners(t),c&&c>0&&h.length>c)){h.warned=!0;var p=new Error("Possible EventEmitter memory leak detected. "+h.length+" "+n+" listeners added. Use emitter.setMaxListeners() to increase limit");p.name="MaxListenersExceededWarning",p.emitter=t,p.type=n,p.count=h.length,emitWarning(p)}return t}function emitWarning(t){typeof console.warn=="function"?console.warn(t):console.log(t)}EventEmitter.prototype.addListener=function t(n,o){return _addListener(this,n,o,!1)},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.prependListener=function t(n,o){return _addListener(this,n,o,!0)};function _onceWrap(t,n,o){var s=!1;function c(){t.removeListener(n,c),s||(s=!0,o.apply(t,arguments))}return c.listener=o,c}EventEmitter.prototype.once=function t(n,o){if(typeof o!="function")throw new TypeError('"listener" argument must be a function');return this.on(n,_onceWrap(this,n,o)),this},EventEmitter.prototype.prependOnceListener=function t(n,o){if(typeof o!="function")throw new TypeError('"listener" argument must be a function');return this.prependListener(n,_onceWrap(this,n,o)),this},EventEmitter.prototype.removeListener=function t(n,o){var s,c,d,h,p;if(typeof o!="function")throw new TypeError('"listener" argument must be a function');if(c=this._events,!c)return this;if(s=c[n],!s)return this;if(s===o||s.listener&&s.listener===o)--this._eventsCount===0?this._events=new EventHandlers:(delete c[n],c.removeListener&&this.emit("removeListener",n,s.listener||o));else if(typeof s!="function"){for(d=-1,h=s.length;h-- >0;)if(s[h]===o||s[h].listener&&s[h].listener===o){p=s[h].listener,d=h;break}if(d<0)return this;if(s.length===1){if(s[0]=void 0,--this._eventsCount===0)return this._events=new EventHandlers,this;delete c[n]}else spliceOne(s,d);c.removeListener&&this.emit("removeListener",n,p||o)}return this},EventEmitter.prototype.removeAllListeners=function t(n){var o,s;if(s=this._events,!s)return this;if(!s.removeListener)return arguments.length===0?(this._events=new EventHandlers,this._eventsCount=0):s[n]&&(--this._eventsCount===0?this._events=new EventHandlers:delete s[n]),this;if(arguments.length===0){for(var c=Object.keys(s),d=0,h;d<c.length;++d)h=c[d],h!=="removeListener"&&this.removeAllListeners(h);return this.removeAllListeners("removeListener"),this._events=new EventHandlers,this._eventsCount=0,this}if(o=s[n],typeof o=="function")this.removeListener(n,o);else if(o)do this.removeListener(n,o[o.length-1]);while(o[0]);return this},EventEmitter.prototype.listeners=function t(n){var o,s,c=this._events;return c?(o=c[n],o?typeof o=="function"?s=[o.listener||o]:s=unwrapListeners(o):s=[]):s=[],s},EventEmitter.listenerCount=function(t,n){return typeof t.listenerCount=="function"?t.listenerCount(n):listenerCount$1.call(t,n)},EventEmitter.prototype.listenerCount=listenerCount$1;function listenerCount$1(t){var n=this._events;if(n){var o=n[t];if(typeof o=="function")return 1;if(o)return o.length}return 0}EventEmitter.prototype.eventNames=function t(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};function spliceOne(t,n){for(var o=n,s=o+1,c=t.length;s<c;o+=1,s+=1)t[o]=t[s];t.pop()}function arrayClone(t,n){for(var o=new Array(n);n--;)o[n]=t[n];return o}function unwrapListeners(t){for(var n=new Array(t.length),o=0;o<n.length;++o)n[o]=t[o].listener||t[o];return n}function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}var cachedSetTimeout=defaultSetTimout,cachedClearTimeout=defaultClearTimeout;typeof global$1.setTimeout=="function"&&(cachedSetTimeout=setTimeout),typeof global$1.clearTimeout=="function"&&(cachedClearTimeout=clearTimeout);function runTimeout(t){if(cachedSetTimeout===setTimeout)return setTimeout(t,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(t,0);try{return cachedSetTimeout(t,0)}catch{try{return cachedSetTimeout.call(null,t,0)}catch{return cachedSetTimeout.call(this,t,0)}}}function runClearTimeout(t){if(cachedClearTimeout===clearTimeout)return clearTimeout(t);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(t);try{return cachedClearTimeout(t)}catch{try{return cachedClearTimeout.call(null,t)}catch{return cachedClearTimeout.call(this,t)}}}var queue=[],draining=!1,currentQueue,queueIndex=-1;function cleanUpNextTick(){!draining||!currentQueue||(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var t=runTimeout(cleanUpNextTick);draining=!0;for(var n=queue.length;n;){for(currentQueue=queue,queue=[];++queueIndex<n;)currentQueue&¤tQueue[queueIndex].run();queueIndex=-1,n=queue.length}currentQueue=null,draining=!1,runClearTimeout(t)}}function nextTick(t){var n=new Array(arguments.length-1);if(arguments.length>1)for(var o=1;o<arguments.length;o++)n[o-1]=arguments[o];queue.push(new Item(t,n)),queue.length===1&&!draining&&runTimeout(drainQueue)}function Item(t,n){this.fun=t,this.array=n}Item.prototype.run=function(){this.fun.apply(null,this.array)};var title="browser",platform="browser",browser=!0,env={},argv=[],version="",versions={},release={},config={};function noop(){}var on=noop,addListener=noop,once=noop,off=noop,removeListener=noop,removeAllListeners=noop,emit=noop;function binding(t){throw new Error("process.binding is not supported")}function cwd(){return"/"}function chdir(t){throw new Error("process.chdir is not supported")}function umask(){return 0}var performance$1=global$1.performance||{},performanceNow=performance$1.now||performance$1.mozNow||performance$1.msNow||performance$1.oNow||performance$1.webkitNow||function(){return new Date().getTime()};function hrtime(t){var n=performanceNow.call(performance$1)*.001,o=Math.floor(n),s=Math.floor(n%1*1e9);return t&&(o=o-t[0],s=s-t[1],s<0&&(o--,s+=1e9)),[o,s]}var startTime=new Date;function uptime(){var t=new Date,n=t-startTime;return n/1e3}var process$1={nextTick,title,browser,env,argv,version,versions,on,addListener,once,off,removeListener,removeAllListeners,emit,binding,cwd,chdir,umask,hrtime,platform,release,config,uptime},inherits;typeof Object.create=="function"?inherits=function(n,o){n.super_=o,n.prototype=Object.create(o.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}})}:inherits=function(n,o){n.super_=o;var s=function(){};s.prototype=o.prototype,n.prototype=new s,n.prototype.constructor=n};var inherits$1=inherits,formatRegExp=/%[sdj%]/g;function format(t){if(!isString(t)){for(var n=[],o=0;o<arguments.length;o++)n.push(inspect(arguments[o]));return n.join(" ")}for(var o=1,s=arguments,c=s.length,d=String(t).replace(formatRegExp,function(p){if(p==="%%")return"%";if(o>=c)return p;switch(p){case"%s":return String(s[o++]);case"%d":return Number(s[o++]);case"%j":try{return JSON.stringify(s[o++])}catch{return"[Circular]"}default:return p}}),h=s[o];o<c;h=s[++o])isNull(h)||!isObject(h)?d+=" "+h:d+=" "+inspect(h);return d}function deprecate(t,n){if(isUndefined(global$1.process))return function(){return deprecate(t,n).apply(this,arguments)};if(process$1.noDeprecation===!0)return t;var o=!1;function s(){if(!o){if(process$1.throwDeprecation)throw new Error(n);process$1.traceDeprecation?console.trace(n):console.error(n),o=!0}return t.apply(this,arguments)}return s}var debugs={},debugEnviron;function debuglog(t){if(isUndefined(debugEnviron)&&(debugEnviron=process$1.env.NODE_DEBUG||""),t=t.toUpperCase(),!debugs[t])if(new RegExp("\\b"+t+"\\b","i").test(debugEnviron)){var n=0;debugs[t]=function(){var o=format.apply(null,arguments);console.error("%s %d: %s",t,n,o)}}else debugs[t]=function(){};return debugs[t]}function inspect(t,n){var o={seen:[],stylize:stylizeNoColor};return arguments.length>=3&&(o.depth=arguments[2]),arguments.length>=4&&(o.colors=arguments[3]),isBoolean(n)?o.showHidden=n:n&&_extend(o,n),isUndefined(o.showHidden)&&(o.showHidden=!1),isUndefined(o.depth)&&(o.depth=2),isUndefined(o.colors)&&(o.colors=!1),isUndefined(o.customInspect)&&(o.customInspect=!0),o.colors&&(o.stylize=stylizeWithColor),formatValue(o,t,o.depth)}inspect.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]},inspect.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function stylizeWithColor(t,n){var o=inspect.styles[n];return o?"\x1B["+inspect.colors[o][0]+"m"+t+"\x1B["+inspect.colors[o][1]+"m":t}function stylizeNoColor(t,n){return t}function arrayToHash(t){var n={};return t.forEach(function(o,s){n[o]=!0}),n}function formatValue(t,n,o){if(t.customInspect&&n&&isFunction(n.inspect)&&n.inspect!==inspect&&!(n.constructor&&n.constructor.prototype===n)){var s=n.inspect(o,t);return isString(s)||(s=formatValue(t,s,o)),s}var c=formatPrimitive(t,n);if(c)return c;var d=Object.keys(n),h=arrayToHash(d);if(t.showHidden&&(d=Object.getOwnPropertyNames(n)),isError(n)&&(d.indexOf("message")>=0||d.indexOf("description")>=0))return formatError(n);if(d.length===0){if(isFunction(n)){var p=n.name?": "+n.name:"";return t.stylize("[Function"+p+"]","special")}if(isRegExp(n))return t.stylize(RegExp.prototype.toString.call(n),"regexp");if(isDate(n))return t.stylize(Date.prototype.toString.call(n),"date");if(isError(n))return formatError(n)}var y="",S=!1,P=["{","}"];if(isArray(n)&&(S=!0,P=["[","]"]),isFunction(n)){var L=n.name?": "+n.name:"";y=" [Function"+L+"]"}if(isRegExp(n)&&(y=" "+RegExp.prototype.toString.call(n)),isDate(n)&&(y=" "+Date.prototype.toUTCString.call(n)),isError(n)&&(y=" "+formatError(n)),d.length===0&&(!S||n.length==0))return P[0]+y+P[1];if(o<0)return isRegExp(n)?t.stylize(RegExp.prototype.toString.call(n),"regexp"):t.stylize("[Object]","special");t.seen.push(n);var F;return S?F=formatArray(t,n,o,h,d):F=d.map(function(N){return formatProperty(t,n,o,h,N,S)}),t.seen.pop(),reduceToSingleString(F,y,P)}function formatPrimitive(t,n){if(isUndefined(n))return t.stylize("undefined","undefined");if(isString(n)){var o="'"+JSON.stringify(n).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(o,"string")}if(isNumber(n))return t.stylize(""+n,"number");if(isBoolean(n))return t.stylize(""+n,"boolean");if(isNull(n))return t.stylize("null","null")}function formatError(t){return"["+Error.prototype.toString.call(t)+"]"}function formatArray(t,n,o,s,c){for(var d=[],h=0,p=n.length;h<p;++h)hasOwnProperty(n,String(h))?d.push(formatProperty(t,n,o,s,String(h),!0)):d.push("");return c.forEach(function(y){y.match(/^\d+$/)||d.push(formatProperty(t,n,o,s,y,!0))}),d}function formatProperty(t,n,o,s,c,d){var h,p,y;if(y=Object.getOwnPropertyDescriptor(n,c)||{value:n[c]},y.get?y.set?p=t.stylize("[Getter/Setter]","special"):p=t.stylize("[Getter]","special"):y.set&&(p=t.stylize("[Setter]","special")),hasOwnProperty(s,c)||(h="["+c+"]"),p||(t.seen.indexOf(y.value)<0?(isNull(o)?p=formatValue(t,y.value,null):p=formatValue(t,y.value,o-1),p.indexOf(`
|
|
6746
6746
|
`)>-1&&(d?p=p.split(`
|
|
6747
6747
|
`).map(function(S){return" "+S}).join(`
|
|
6748
6748
|
`).substr(2):p=`
|