@reearth/core 0.0.7-alpha.50 → 0.0.7-alpha.51

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 CHANGED
@@ -93657,7 +93657,7 @@ function Error$1({ error: t, resetErrorBoundary: n }) {
93657
93657
  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { style: { color: "#fff" }, onClick: n, children: "Retry" }) })
93658
93658
  ] });
93659
93659
  }
93660
- const version = "0.0.7-alpha.50", useCoreAPI = ({ viewerProperty: t }) => {
93660
+ const version = "0.0.7-alpha.51", useCoreAPI = ({ viewerProperty: t }) => {
93661
93661
  const n = useRef(t);
93662
93662
  n.current = t;
93663
93663
  const o = useMemo(
package/dist/core.umd.cjs CHANGED
@@ -6744,7 +6744,7 @@ vec3 getTurboColormap(const float v) {
6744
6744
  ${reconstructPosition}
6745
6745
  ${turboColorMap}
6746
6746
  ${ambientOcclusionModulate}
6747
- `,uniforms:{...pick(S,["color","frustumLength","blackPoint","whitePoint","gamma"]),globeDepthTexture:()=>(p==null?void 0:p())??L._depthTexture}});if(c){const N=createBilateralFilterStage({prefix:t,outputType:d,useGlobeDepth:h,getGlobeDepthTexture:p,uniforms:{textureScale:n,...pick(S,["frustumLength","normalExponent","depthExponent"])}}),z=new Cesium$1.PostProcessStageComposite({name:`${t}_ambient_occlusion_generate_and_filter`,stages:[P,N]});return L.uniforms.ambientOcclusionTexture=z.name,new Cesium$1.PostProcessStageComposite({name:`${t}_ambient_occlusion`,stages:[z,L],inputPreviousStageTexture:!1,uniforms:createUniforms([{stage:P,uniforms:["intensity","maxRadius","bias","frustumLength","focalLength"]},{stage:N,uniforms:["frustumLength","normalExponent","depthExponent"]},{stage:L,uniforms:["color","blackPoint","whitePoint","gamma"]}])})}else return L.uniforms.ambientOcclusionTexture=P.name,new Cesium$1.PostProcessStageComposite({name:`${t}_ambient_occlusion`,stages:[P,L],inputPreviousStageTexture:!1,uniforms:createUniforms([{stage:P,uniforms:["intensity","maxRadius","bias","frustumLength","focalLength"]},{stage:L,uniforms:["color","blackPoint","whitePoint","gamma"]}])})}const AmbientOcclusionStage=({enabled:t=!0,textureScale:n,directions:o,steps:s,denoise:c,accurateNormalReconstruction:l,outputType:d,useGlobeDepth:h,...p})=>{const{viewer:y}=ae$1(),S=y==null?void 0:y.scene,P=useInstance({owner:S==null?void 0:S.postProcessStages,keys:[n,s,o,c,l,d,h],create:()=>{const L=createAmbientOcclusionStage({textureScale:n,steps:s,directions:o,denoise:c,accurateNormalReconstruction:l,outputType:d,useGlobeDepth:h,getGlobeDepthTexture:()=>S.context.uniformState.globeDepthTexture,uniforms:p});return L.enabled=t,L},transferOwnership:(L,N)=>(N==null||N.add(L),()=>{N==null||N.remove(L)})});return P.enabled=t,Object.assign(P.uniforms,p),S==null||S.requestRender(),usePreRender(()=>{const L=S==null?void 0:S.camera.frustum;if(L instanceof Cesium$1.PerspectiveFrustum){const N=1/Math.tan(L.fovy/2);P.uniforms.focalLength.x=N*L.aspectRatio,P.uniforms.focalLength.y=N}}),null},AmbientOcclusion=t=>{const n=ae$1(),[o,s]=React.useState(!1);return usePreRender(()=>{const c=n.scene;s(!(c!=null&&c.globe.depthTestAgainstTerrain));const{globeHeight:l}=c;if(!c||l==null)return;const d=c.camera.positionCartographic.height-l,h=c==null?void 0:c.camera.frustum;h instanceof Cesium$1.PerspectiveFrustum&&(c.camera.frustum.near=Cesium$1.Math.clamp(d-1,1,5)/Math.tan(h.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:l,isExtrudedControlPoint:d,handleControlPointMouseEvent:h})=>{const p=React.useRef(t);p.current=t;const y=useConstant$2(()=>new CallbackProperty((N,z)=>"getValue"in p.current?p.current.getValue(N,z):p.current,!1)),S=React.useMemo(()=>({position:y,billboard:{image:s?l?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,y,l,s,c]),P=React.useCallback(()=>{h==null||h(o,!!d,"mousedown")},[o,d,h]),L=React.useCallback(()=>{h==null||h(o,!!d,"click")},[o,d,h]);return jsxRuntimeExports.jsx(Lr$1,{...S,onMouseDown:P,onClick:L})};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}=ae$1(),c=s==null?void 0:s.scene,l=s==null?void 0:s.entities,d=t??l,[h,p]=React.useState(()=>new Entity$1(n));return React.useEffect(()=>{p(new Entity$1(n))},[n.id]),React.useEffect(()=>(d==null||d.add(h),()=>{d==null||d.remove(h),c==null||c.requestRender()}),[c,d,h]),React.useEffect(()=>assignForwardedRef(o,h),[o,h]),Object.assign(h,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,l=!1;const d=new WeakSet,h={schedule:(p,y=!1,S=!1)=>{const P=S&&c,L=P?n:o;return y&&d.add(p),L.add(p)&&P&&c&&(s=n.order.length),p},cancel:p=>{o.remove(p),d.delete(p)},process:p=>{if(c){l=!0;return}if(c=!0,[n,o]=[o,n],o.clear(),s=n.order.length,s)for(let y=0;y<s;y++){const S=n.order[y];d.has(S)&&(h.schedule(S),t()),S(p)}c=!1,l&&(l=!1,h.process(p))}};return h}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},l=stepsOrder.reduce((P,L)=>(P[L]=createRenderStep(()=>o=!0),P),{}),d=P=>{l[P].process(c)},h=()=>{const P=performance.now();o=!1,c.delta=s?1e3/60:Math.max(Math.min(P-c.timestamp,maxElapsed),1),c.timestamp=P,c.isProcessing=!0,stepsOrder.forEach(d),c.isProcessing=!1,o&&n&&(s=!1,t(h))},p=()=>{o=!0,s=!0,c.isProcessing||t(h)};return{schedule:stepsOrder.reduce((P,L)=>{const N=l[L];return P[L]=(z,W=!1,ai=!1)=>(o||p(),N.schedule(z,W,ai)),P},{}),cancel:P=>stepsOrder.forEach(L=>l[L].cancel(P)),state:c,steps:l}}const{schedule:microtask,cancel:cancelMicrotask}=createRenderBatcher(queueMicrotask,!1);function useVisualElement(t,n,o,s){const{visualElement:c}=React.useContext(MotionContext),l=React.useContext(LazyContext),d=React.useContext(PresenceContext),h=React.useContext(MotionConfigContext).reducedMotion,p=React.useRef();s=s||l.renderer,!p.current&&s&&(p.current=s(t,{visualState:n,parent:c,props:o,presenceContext:d,blockInitialAnimation:d?d.initial===!1:!1,reducedMotionConfig:h}));const y=p.current;React.useInsertionEffect(()=>{y&&y.update(o,d)});const S=React.useRef(!!(o[optimizedAppearDataAttribute]&&!window.HandoffComplete));return useIsomorphicLayoutEffect$1(()=>{y&&(microtask.postRender(y.render),S.current&&y.animationState&&y.animationState.animateChanges())}),React.useEffect(()=>{y&&(y.updateFeatures(),!S.current&&y.animationState&&y.animationState.animateChanges(),S.current&&(S.current=!1,window.HandoffComplete=!0))}),y}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 l(h,p){let y;const S={...React.useContext(MotionConfigContext),...h,layoutId:useLayoutId(h)},{isStatic:P}=S,L=useCreateMotionContext(h),N=s(h,P);if(!P&&isBrowser){L.visualElement=useVisualElement(c,N,S,n);const z=React.useContext(SwitchLayoutGroupContext),W=React.useContext(LazyContext).strict;L.visualElement&&(y=L.visualElement.loadFeatures(S,W,t,z))}return React__namespace.createElement(MotionContext.Provider,{value:L},y&&L.visualElement?React__namespace.createElement(y,{visualElement:L.visualElement,...S}):null,o(c,h,useMotionRef(N,L.visualElement,p),N,P,L.visualElement))}const d=React.forwardRef(l);return d[motionComponentSymbol]=c,d}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 l="";for(let d=0;d<numTransforms;d++){const h=transformPropOrder[d];if(t[h]!==void 0){const p=translateAlias[h]||h;l+=`${p}(${t[h]}) `}}return n&&!t.z&&(l+="translateZ(0)"),l=l.trim(),c?l=c(t,s?"":l):o&&s&&(l="none"),l}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:l,transform:d,transformOrigin:h}=t;let p=!1,y=!1,S=!0;for(const P in n){const L=n[P];if(isCSSVariableName(P)){l[P]=L;continue}const N=numberValueTypes[P],z=getValueAsType(L,N);if(transformProps.has(P)){if(p=!0,d[P]=z,!S)continue;L!==(N.default||0)&&(S=!1)}else P.startsWith("origin")?(y=!0,h[P]=z):c[P]=z}if(n.transform||(p||s?c.transform=buildTransform(t.transform,o,S,s):c.transform&&(c.transform="none")),y){const{originX:P="50%",originY:L="50%",originZ:N=0}=h;c.transformOrigin=`${P} ${L} ${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 l=c?dashKeys:camelKeys;t[l.offset]=px.transform(-s);const d=px.transform(n),h=px.transform(o);t[l.array]=`${d} ${h}`}function buildSVGAttrs(t,{attrX:n,attrY:o,attrScale:s,originX:c,originY:l,pathLength:d,pathSpacing:h=1,pathOffset:p=0,...y},S,P,L){if(buildHTMLStyles(t,y,S,L),P){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||l!==void 0||z.transform)&&(z.transformOrigin=calcSVGTransformOrigin(W,c!==void 0?c:.5,l!==void 0?l:.5)),n!==void 0&&(N.x=n),o!==void 0&&(N.y=o),s!==void 0&&(N.scale=s),d!==void 0&&buildSVGPath(N,d,h,p,!1)}const createSvgRenderState=()=>({...createHtmlRenderState(),attrs:{}}),isSVGTag=t=>typeof t=="string"&&t.toLowerCase()==="svg";function useSVGProps(t,n,o,s){const c=React.useMemo(()=>{const l=createSvgRenderState();return buildSVGAttrs(l,n,{enableHardwareAcceleration:!1},isSVGTag(s),t.transformTemplate),{...l.attrs,style:{...l.style}}},[n]);if(t.style){const l={};copyRawValuesOnly(l,t.style,t),c.style={...l,...c.style}}return c}function createUseRender(t=!1){return(o,s,c,{latestValues:l},d)=>{const p=(isSVGComponent(o)?useSVGProps:useHTMLProps)(s,l,d,o),y=filterProps(s,typeof o=="string",t),S=o!==React.Fragment?{...y,...p,ref:c}:{},{children:P}=s,L=React.useMemo(()=>isMotionValue(P)?P.get():P,[P]);return React.createElement(o,{...S,children:L})}}function renderHTML(t,{style:n,vars:o},s,c){Object.assign(t.style,n,c&&c.getProjectionStyles(s));for(const l in o)t.style.setProperty(l,o[l])}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,l={};for(const d in c)(isMotionValue(c[d])||n.style&&isMotionValue(n.style[d])||isForcedMotionValue(d,t)||((s=o==null?void 0:o.getValue(d))===null||s===void 0?void 0:s.liveStyle)!==void 0)&&(l[d]=c[d]);return l}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 l=transformPropOrder.indexOf(c)!==-1?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c;s[l]=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,l){const d={latestValues:makeLatestValues(s,c,l,t),renderState:n()};return o&&(d.mount=h=>o(s,h,d)),d}const makeUseVisualState=t=>(n,o)=>{const s=React.useContext(MotionContext),c=React.useContext(PresenceContext),l=()=>makeState(t,n,s,c);return o?l():useConstant(l)};function makeLatestValues(t,n,o,s){const c={},l=s(t,{});for(const L in l)c[L]=resolveMotionValue(l[L]);let{initial:d,animate:h}=t;const p=isControllingVariants(t),y=isVariantNode(t);n&&y&&!p&&t.inherit!==!1&&(d===void 0&&(d=n.initial),h===void 0&&(h=n.animate));let S=o?o.initial===!1:!1;S=S||d===!1;const P=S?h:d;return P&&typeof P!="boolean"&&!isAnimationControls(P)&&(Array.isArray(P)?P:[P]).forEach(N=>{const z=resolveVariantFromProps(t,N);if(!z)return;const{transitionEnd:W,transition:ai,...mt}=z;for(const J in mt){let pi=mt[J];if(Array.isArray(pi)){const fa=S?pi.length-1:0;pi=pi[fa]}pi!==null&&(c[J]=pi)}for(const J in W)c[J]=W[J]}),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=(l,d)=>{if(l.pointerType==="touch"||isDragActive())return;const h=t.getProps();t.animationState&&h.whileHover&&t.animationState.setActive("whileHover",n),h[s]&&h[s](l,d)};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(),l=addPointerEvent(window,"pointerup",(h,p)=>{if(!this.checkPressEnd())return;const{onTap:y,onTapCancel:S,globalTapTarget:P}=this.node.getProps();!P&&!isNodeOrChild(this.node.current,h.target)?S&&S(h,p):y&&y(h,p)},{passive:!(s.onTap||s.onPointerUp)}),d=addPointerEvent(window,"pointercancel",(h,p)=>this.cancelPress(h,p),{passive:!(s.onTapCancel||s.onPointerCancel)});this.removeEndListeners=pipe(l,d),this.startPress(n,o)},this.startAccessiblePress=()=>{const n=l=>{if(l.key!=="Enter"||this.isPressing)return;const d=h=>{h.key!=="Enter"||!this.checkPressEnd()||fireSyntheticPointerEvent("up",(p,y)=>{const{onTap:S}=this.node.getProps();S&&S(p,y)})};this.removeEndListeners(),this.removeEndListeners=addDomEvent(this.node.current,"keyup",d),fireSyntheticPointerEvent("down",(h,p)=>{this.startPress(h,p)})},o=addDomEvent(this.node.current,"keydown",n),s=()=>{this.isPressing&&fireSyntheticPointerEvent("cancel",(l,d)=>this.cancelPress(l,d))},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:l}=n,d={root:o?o.current:void 0,rootMargin:s,threshold:typeof c=="number"?c:thresholdNames[c]},h=p=>{const{isIntersecting:y}=p;if(this.isInView===y||(this.isInView=y,l&&!y&&this.hasEnteredView))return;y&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",y);const{onViewportEnter:S,onViewportLeave:P}=this.node.getProps(),L=y?S:P;L&&L(p)};return observeIntersection(this.node.current,d,h)}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:l,repeatType:d,repeatDelay:h,from:p,elapsed:y,...S}){return!!Object.keys(S).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),l=n&&o!=="loop"&&n%2===1?0:c.length-1;return!l||s===void 0?c[l]: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 l=window.getComputedStyle(n).getPropertyValue(s);if(l){const d=l.trim();return isNumericalString(d)?parseFloat(d):d}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 l=s.match(/^matrix\((.+)\)$/u);return l?getPosFromMatrix(l[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,l,d=!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=l,this.isAsync=d}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 l=0;l<n.length;l++)if(n[l]===null)if(l===0){const d=c==null?void 0:c.get(),h=n[n.length-1];if(d!==void 0)n[0]=d;else if(s&&o){const p=s.readValue(o,h);p!=null&&(n[0]=p)}n[0]===void 0&&(n[0]=h),c&&d===void 0&&c.set(n[0])}else n[l]=n[l-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,l,d,h]=s.match(floatRegex);return{[t]:parseFloat(c),[n]:parseFloat(l),[o]:parseFloat(d),alpha:h!==void 0?parseFloat(h):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 l=0;const h=n.replace(complexRegex,p=>(color.test(p)?(s.color.push(l),c.push(COLOR_TOKEN),o.push(color.parse(p))):p.startsWith(VAR_FUNCTION_TOKEN)?(s.var.push(l),c.push(VAR_TOKEN),o.push(p)):(s.number.push(l),c.push(NUMBER_TOKEN),o.push(parseFloat(p))),++l,SPLIT_TOKEN)).split(SPLIT_TOKEN);return{values:o,split:h,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 l="";for(let d=0;d<s;d++)if(l+=n[d],c[d]!==void 0){const h=o[d];h===NUMBER_TOKEN?l+=sanitize(c[d]):h===COLOR_TOKEN?l+=color.transform(c[d]):l+=c[d]}return l}}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 l=maxDefaults.has(n)?1:0;return s!==o&&(l*=100),n+"("+l+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 l of n)t[l]=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 p=0;p<n.length;p++){const y=n[p];if(typeof y=="string"&&isCSSVariableToken(y)){const S=getVariableValue(y,o.current);S!==void 0&&(n[p]=S)}}if(!positionalKeys.has(s)||n.length!==2)return this.resolveNoneKeyframes();const[c,l]=n,d=findDimensionValueType(c),h=findDimensionValueType(l);if(d!==h)if(isNumOrPxType(d)&&isNumOrPxType(h))for(let p=0;p<n.length;p++){const y=n[p];typeof y=="string"&&(n[p]=parseFloat(y))}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 l=o.getValue(s);l&&l.jump(this.measuredOrigin,!1);const d=c.length-1,h=c[d];c[d]=positionalValues[s](o.measureViewportBox(),window.getComputedStyle(o.current)),h!==null&&(this.finalKeyframe=h),!((n=this.removedTransforms)===null||n===void 0)&&n.length&&this.removedTransforms.forEach(([p,y])=>{o.getValue(p).set(y)}),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 l=t[t.length-1],d=isAnimatable(c,n),h=isAnimatable(l,n);return warning(d===h,`You are trying to animate ${n} from "${c}" to "${l}". ${c} is not an animatable value - to enable this animation set ${c} to a value animatable to ${l} via the \`style\` property.`),!d||!h?!1:hasKeyframesChanged(t)||o==="spring"&&s}class BaseAnimation{constructor({autoplay:n=!0,delay:o=0,type:s="keyframes",repeat:c=0,repeatDelay:l=0,repeatType:d="loop",...h}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.options={autoplay:n,delay:o,type:s,repeat:c,repeatDelay:l,repeatType:d,...h},this.updateFinishedPromise()}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&flushKeyframeResolvers(),this._resolved}onKeyframesResolved(n,o){this.hasAttemptedResolve=!0;const{name:s,type:c,velocity:l,delay:d,onComplete:h,onUpdate:p,isGenerator:y}=this.options;if(!y&&!canAnimate(n,s,c,l))if(d)this.options.duration=0;else{p==null||p(getFinalKeyframe(n,this.options,o)),h==null||h(),this.resolveFinishedPromise();return}const S=this.initPlayback(n,o);S!==!1&&(this._resolved={keyframes:n,finalKeyframe:o,...S},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,l;warning(t<=secondsToMilliseconds(maxDuration$1),"Spring duration must be 10 seconds or less");let d=1-n;d=clamp(minDamping,maxDamping,d),t=clamp(minDuration,maxDuration$1,millisecondsToSeconds(t)),d<1?(c=y=>{const S=y*d,P=S*t,L=S-o,N=calcAngularFreq(y,d),z=Math.exp(-P);return safeMin-L/N*z},l=y=>{const P=y*d*t,L=P*o+o,N=Math.pow(d,2)*Math.pow(y,2)*t,z=Math.exp(-P),W=calcAngularFreq(Math.pow(y,2),d);return(-c(y)+safeMin>0?-1:1)*((L-N)*z)/W}):(c=y=>{const S=Math.exp(-y*t),P=(y-o)*t+1;return-.001+S*P},l=y=>{const S=Math.exp(-y*t),P=(o-y)*(t*t);return S*P});const h=5/t,p=approximateRoot(c,l,h);if(t=secondsToMilliseconds(t),isNaN(p))return{stiffness:100,damping:10,duration:t};{const y=Math.pow(p,2)*s;return{stiffness:y,damping:d*2*Math.sqrt(s*y),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],l=t[t.length-1],d={done:!1,value:c},{stiffness:h,damping:p,mass:y,duration:S,velocity:P,isResolvedFromDuration:L}=getSpringOptions({...s,velocity:-millisecondsToSeconds(s.velocity||0)}),N=P||0,z=p/(2*Math.sqrt(h*y)),W=l-c,ai=millisecondsToSeconds(Math.sqrt(h/y)),mt=Math.abs(W)<5;o||(o=mt?.01:2),n||(n=mt?.005:.5);let J;if(z<1){const pi=calcAngularFreq(ai,z);J=fa=>{const ma=Math.exp(-z*ai*fa);return l-ma*((N+z*ai*W)/pi*Math.sin(pi*fa)+W*Math.cos(pi*fa))}}else if(z===1)J=pi=>l-Math.exp(-ai*pi)*(W+(N+ai*W)*pi);else{const pi=ai*Math.sqrt(z*z-1);J=fa=>{const ma=Math.exp(-z*ai*fa),Sa=Math.min(pi*fa,300);return l-ma*((N+z*ai*W)*Math.sinh(Sa)+pi*W*Math.cosh(Sa))/pi}}return{calculatedDuration:L&&S||null,next:pi=>{const fa=J(pi);if(L)d.done=pi>=S;else{let ma=N;pi!==0&&(z<1?ma=calcGeneratorVelocity(J,pi,fa):ma=0);const Sa=Math.abs(ma)<=o,Ra=Math.abs(l-fa)<=n;d.done=Sa&&Ra}return d.value=d.done?l:fa,d}}}function inertia({keyframes:t,velocity:n=0,power:o=.8,timeConstant:s=325,bounceDamping:c=10,bounceStiffness:l=500,modifyTarget:d,min:h,max:p,restDelta:y=.5,restSpeed:S}){const P=t[0],L={done:!1,value:P},N=Vs=>h!==void 0&&Vs<h||p!==void 0&&Vs>p,z=Vs=>h===void 0?p:p===void 0||Math.abs(h-Vs)<Math.abs(p-Vs)?h:p;let W=o*n;const ai=P+W,mt=d===void 0?ai:d(ai);mt!==ai&&(W=mt-P);const J=Vs=>-W*Math.exp(-Vs/s),pi=Vs=>mt+J(Vs),fa=Vs=>{const La=J(Vs),Zs=pi(Vs);L.done=Math.abs(La)<=y,L.value=L.done?mt:Zs};let ma,Sa;const Ra=Vs=>{N(L.value)&&(ma=Vs,Sa=spring({keyframes:[L.value,z(L.value)],velocity:calcGeneratorVelocity(pi,Vs,L.value),damping:c,stiffness:l,restDelta:y,restSpeed:S}))};return Ra(0),{calculatedDuration:null,next:Vs=>{let La=!1;return!Sa&&ma===void 0&&(La=!0,fa(Vs),Ra(Vs)),ma!==void 0&&Vs>=ma?Sa.next(Vs-ma):(!La&&fa(Vs),L)}}}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 l,d,h=0;do d=n+(o-n)/2,l=calcBezier(d,s,c)-t,l>0?o=d:n=d;while(Math.abs(l)>subdivisionPrecision&&++h<subdivisionMaxIterations);return d}function cubicBezier(t,n,o,s){if(t===n&&o===s)return noop$1;const c=l=>binarySubdivide(l,0,1,t,o);return l=>l===0||l===1?l:calcBezier(c(l),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,l=0,d=0;if(!n)c=l=d=o;else{const h=o<.5?o*(1+n):o+n-o*n,p=2*o-h;c=hueToRgb(p,h,t+1/3),l=hueToRgb(p,h,t),d=hueToRgb(p,h,t-1/3)}return{red:Math.round(c*255),green:Math.round(l*255),blue:Math.round(d*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 l=>(c.red=mixLinearColor(o.red,s.red,l),c.green=mixLinearColor(o.green,s.green,l),c.blue=mixLinearColor(o.blue,s.blue,l),c.alpha=mixNumber$1(o.alpha,s.alpha,l),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((l,d)=>getMixer(l)(l,n[d]));return l=>{for(let d=0;d<s;d++)o[d]=c[d](l);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 l in s)o[l]=s[l](c);return o}}function matchOrder(t,n){var o;const s=[],c={color:0,var:0,number:0};for(let l=0;l<n.values.length;l++){const d=n.types[l],h=t.indexes[d][c[d]],p=(o=t.values[h])!==null&&o!==void 0?o:0;s[l]=p,c[d]++}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,l=t.length-1;for(let d=0;d<l;d++){let h=c(t[d],t[d+1]);if(n){const p=Array.isArray(n)?n[d]||noop$1:n;h=pipe(p,h)}s.push(h)}return s}function interpolate(t,n,{clamp:o=!0,ease:s,mixer:c}={}){const l=t.length;if(invariant(l===n.length,"Both input and output ranges must be the same length"),l===1)return()=>n[0];if(l===2&&t[0]===t[1])return()=>n[1];t[0]>t[l-1]&&(t=[...t].reverse(),n=[...n].reverse());const d=createMixers(n,s,c),h=d.length,p=y=>{let S=0;if(h>1)for(;S<t.length-2&&!(y<t[S+1]);S++);const P=progress(t[S],t[S+1],y);return d[S](P)};return o?y=>p(clamp(t[0],t[l-1],y)):p}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),l={done:!1,value:n[0]},d=convertOffsetToTimes(o&&o.length===n.length?o:defaultOffset(n),t),h=interpolate(d,n,{ease:Array.isArray(c)?c:defaultEasing(n,c)});return{calculatedDuration:t,next:p=>(l.value=h(p),l.done=p>=t,l)}}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:l}=this.options,d=(h,p)=>this.onKeyframesResolved(h,p);s&&c&&c.owner?this.resolver=c.owner.resolveKeyframes(l,d,s,c):this.resolver=new n(l,d,s,c),this.resolver.scheduleResolve()}initPlayback(n){const{type:o="keyframes",repeat:s=0,repeatDelay:c=0,repeatType:l,velocity:d=0}=this.options,h=generators[o]||keyframes;let p,y;h!==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}`),p=pipe(percentToProgress,mix(n[0],n[1])),n=[0,100]);const S=h({...this.options,keyframes:n});l==="mirror"&&(y=h({...this.options,keyframes:[...n].reverse(),velocity:-d})),S.calculatedDuration===null&&(S.calculatedDuration=calcGeneratorDuration(S));const{calculatedDuration:P}=S,L=P+c,N=L*(s+1)-c;return{generator:S,mirroredGenerator:y,mapPercentToKeyframes:p,calculatedDuration:P,resolvedDuration:L,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:Vs}=this.options;return{done:!0,value:Vs[Vs.length-1]}}const{finalKeyframe:c,generator:l,mirroredGenerator:d,mapPercentToKeyframes:h,keyframes:p,calculatedDuration:y,totalDuration:S,resolvedDuration:P}=s;if(this.startTime===null)return l.next(0);const{delay:L,repeat:N,repeatType:z,repeatDelay:W,onUpdate:ai}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,n):this.speed<0&&(this.startTime=Math.min(n-S/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 mt=this.currentTime-L*(this.speed>=0?1:-1),J=this.speed>=0?mt<0:mt>S;this.currentTime=Math.max(mt,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=S);let pi=this.currentTime,fa=l;if(N){const Vs=Math.min(this.currentTime,S)/P;let La=Math.floor(Vs),Zs=Vs%1;!Zs&&Vs>=1&&(Zs=1),Zs===1&&La--,La=Math.min(La,N+1),!!(La%2)&&(z==="reverse"?(Zs=1-Zs,W&&(Zs-=W/P)):z==="mirror"&&(fa=d)),pi=clamp(0,1,Zs)*P}const ma=J?{done:!1,value:p[0]}:fa.next(pi);h&&(ma.value=h(ma.value));let{done:Sa}=ma;!J&&y!==null&&(Sa=this.speed>=0?this.currentTime>=S:this.currentTime<=0);const Ra=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&Sa);return Ra&&c!==void 0&&(ma.value=getFinalKeyframe(p,this.options,c)),ai&&ai(ma.value),Ra&&this.finish(),ma}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:l=0,repeatType:d="loop",ease:h,times:p}={}){const y={[n]:o};p&&(y.offset=p);const S=mapEasingToNativeEasing(h);return Array.isArray(S)&&(y.easing=S),t.animate(y,{delay:s,duration:c,easing:Array.isArray(S)?"linear":S,fill:"both",iterations:l+1,direction:d==="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 l=0;for(;!s.done&&l<maxDuration;)s=o.sample(l),c.push(s.value),l+=sampleDelta;return{times:void 0,keyframes:c,duration:l-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,(l,d)=>this.onKeyframesResolved(l,d),o,s),this.resolver.scheduleResolve()}initPlayback(n,o){var s;let{duration:c=300,times:l,ease:d,type:h,motionValue:p,name:y}=this.options;if(!(!((s=p.owner)===null||s===void 0)&&s.current))return!1;if(requiresPregeneratedKeyframes(this.options)){const{onComplete:P,onUpdate:L,motionValue:N,...z}=this.options,W=pregenerateKeyframes(n,z);n=W.keyframes,n.length===1&&(n[1]=n[0]),c=W.duration,l=W.times,d=W.ease,h="keyframes"}const S=animateStyle(p.owner.current,y,n,{...this.options,duration:c,times:l,ease:d});return S.startTime=time.now(),this.pendingTimeline?(S.timeline=this.pendingTimeline,this.pendingTimeline=void 0):S.onfinish=()=>{const{onComplete:P}=this.options;p.set(getFinalKeyframe(n,this.options,o)),P&&P(),this.cancel(),this.resolveFinishedPromise()},{animation:S,duration:c,times:l,type:h,ease:d,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:l,ease:d,times:h}=n;if(!(o.playState==="idle"||o.playState==="finished")){if(this.time){const{motionValue:p,onUpdate:y,onComplete:S,...P}=this.options,L=new MainThreadAnimation({...P,keyframes:s,duration:c,type:l,ease:d,times:h,isGenerator:!0}),N=secondsToMilliseconds(this.time);p.setWithVelocity(L.sample(N-sampleDelta).value,L.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:l,damping:d,type:h}=n;return supportsWaapi()&&s&&acceleratedValues.has(s)&&o&&o.owner&&o.owner.current instanceof HTMLElement&&!o.owner.getProps().onUpdate&&!c&&l!=="mirror"&&d!==0&&h!=="inertia"}}const animateMotionValue=(t,n,o,s={},c,l)=>d=>{const h=getValueTransition(s,t)||{},p=h.delay||s.delay||0;let{elapsed:y=0}=s;y=y-secondsToMilliseconds(p);let S={keyframes:Array.isArray(o)?o:[null,o],ease:"easeOut",velocity:n.getVelocity(),...h,delay:-y,onUpdate:L=>{n.set(L),h.onUpdate&&h.onUpdate(L)},onComplete:()=>{d(),h.onComplete&&h.onComplete()},name:t,motionValue:n,element:l?void 0:c};isTransitionDefined(h)||(S={...S,...getDefaultTransition(t,S)}),S.duration&&(S.duration=secondsToMilliseconds(S.duration)),S.repeatDelay&&(S.repeatDelay=secondsToMilliseconds(S.repeatDelay)),S.from!==void 0&&(S.keyframes[0]=S.from);let P=!1;if((S.type===!1||S.duration===0&&!S.repeatDelay)&&(S.duration=0,S.delay===0&&(P=!0)),P&&!l&&n.get()!==void 0){const L=getFinalKeyframe(S.keyframes,h);if(L!==void 0){frame.update(()=>{S.onUpdate(L),S.onComplete()});return}}return!l&&AcceleratedAnimation.supports(S)?new AcceleratedAnimation(S):new MainThreadAnimation(S)};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 l=0;l<c;l++){const d=this.subscriptions[l];d&&d(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 l=time.now();this.updatedAt!==l&&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={},...l}=o||{};l={...l,...s};for(const d in l){const h=resolveFinalValueInKeyframes(l[d]);setMotionValue(t,d,h)}}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 l;let{transition:d=t.getDefaultTransition(),transitionEnd:h,...p}=n;const y=t.getValue("willChange");s&&(d=s);const S=[],P=c&&t.animationState&&t.animationState.getState()[c];for(const L in p){const N=t.getValue(L,(l=t.latestValues[L])!==null&&l!==void 0?l:null),z=p[L];if(z===void 0||P&&shouldBlockAnimation(P,L))continue;const W={delay:o,elapsed:0,...getValueTransition(d||{},L)};let ai=!1;if(window.HandoffAppearAnimations){const J=t.getProps()[optimizedAppearDataAttribute];if(J){const pi=window.HandoffAppearAnimations(J,L);pi!==null&&(W.elapsed=pi,ai=!0)}}N.start(animateMotionValue(L,N,z,t.shouldReduceMotion&&transformProps.has(L)?{type:!1}:W,t,ai));const mt=N.animation;mt&&(isWillChangeMotionValue(y)&&(y.add(L),mt.then(()=>y.remove(L))),S.push(mt))}return h&&Promise.all(S).then(()=>{frame.update(()=>{h&&setTarget(t,h)})}),S}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:l=t.getDefaultTransition()||{}}=c||{};o.transitionOverride&&(l=o.transitionOverride);const d=c?()=>Promise.all(animateTarget(t,c,o)):()=>Promise.resolve(),h=t.variantChildren&&t.variantChildren.size?(y=0)=>{const{delayChildren:S=0,staggerChildren:P,staggerDirection:L}=l;return animateChildren(t,n,S+y,P,L,o)}:()=>Promise.resolve(),{when:p}=l;if(p){const[y,S]=p==="beforeChildren"?[d,h]:[h,d];return y().then(()=>S())}else return Promise.all([d(),h(o.delay)])}function animateChildren(t,n,o=0,s=0,c=1,l){const d=[],h=(t.variantChildren.size-1)*s,p=c===1?(y=0)=>y*s:(y=0)=>h-y*s;return Array.from(t.variantChildren).sort(sortByTreeOrder).forEach((y,S)=>{y.notify("AnimationStart",n),d.push(animateVariant(y,n,{...l,delay:o+p(S)}).then(()=>y.notify("AnimationComplete",n)))}),Promise.all(d)}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(l=>animateVariant(t,l,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=p=>(y,S)=>{var P;const L=resolveVariant(t,S,p==="exit"?(P=t.presenceContext)===null||P===void 0?void 0:P.custom:void 0);if(L){const{transition:N,transitionEnd:z,...W}=L;y={...y,...W,...z}}return y};function l(p){n=p(t)}function d(p){const y=t.getProps(),S=t.getVariantContext(!0)||{},P=[],L=new Set;let N={},z=1/0;for(let ai=0;ai<numAnimationTypes;ai++){const mt=reversePriorityOrder[ai],J=o[mt],pi=y[mt]!==void 0?y[mt]:S[mt],fa=isVariantLabel(pi),ma=mt===p?J.isActive:null;ma===!1&&(z=ai);let Sa=pi===S[mt]&&pi!==y[mt]&&fa;if(Sa&&s&&t.manuallyAnimateOnMount&&(Sa=!1),J.protectedKeys={...N},!J.isActive&&ma===null||!pi&&!J.prevProp||isAnimationControls(pi)||typeof pi=="boolean")continue;let Vs=checkVariantsDidChange(J.prevProp,pi)||mt===p&&J.isActive&&!Sa&&fa||ai>z&&fa,La=!1;const Zs=Array.isArray(pi)?pi:[pi];let Xs=Zs.reduce(c(mt),{});ma===!1&&(Xs={});const{prevResolvedValues:Wa={}}=J,ea={...Wa,...Xs},ui=ba=>{Vs=!0,L.has(ba)&&(La=!0,L.delete(ba)),J.needsAnimating[ba]=!0;const ms=t.getValue(ba);ms&&(ms.liveStyle=!1)};for(const ba in ea){const ms=Xs[ba],yu=Wa[ba];if(N.hasOwnProperty(ba))continue;let pu=!1;isKeyframesTarget(ms)&&isKeyframesTarget(yu)?pu=!shallowCompare(ms,yu):pu=ms!==yu,pu?ms!=null?ui(ba):L.add(ba):ms!==void 0&&L.has(ba)?ui(ba):J.protectedKeys[ba]=!0}J.prevProp=pi,J.prevResolvedValues=Xs,J.isActive&&(N={...N,...Xs}),s&&t.blockInitialAnimation&&(Vs=!1),Vs&&(!Sa||La)&&P.push(...Zs.map(ba=>({animation:ba,options:{type:mt}})))}if(L.size){const ai={};L.forEach(mt=>{const J=t.getBaseTarget(mt),pi=t.getValue(mt);pi&&(pi.liveStyle=!0),ai[mt]=J===void 0?null:J}),P.push({animation:ai})}let W=!!P.length;return s&&(y.initial===!1||y.initial===y.animate)&&!t.manuallyAnimateOnMount&&(W=!1),s=!1,W?n(P):Promise.resolve()}function h(p,y){var S;if(o[p].isActive===y)return Promise.resolve();(S=t.variantChildren)===null||S===void 0||S.forEach(L=>{var N;return(N=L.animationState)===null||N===void 0?void 0:N.setActive(p,y)}),o[p].isActive=y;const P=d(p);for(const L in o)o[L].protectedKeys={};return P}return{animateChanges:d,setActive:h,setAnimateFunction:l,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:l=!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 P=getPanInfo(this.lastMoveEventInfo,this.history),L=this.startEvent!==null,N=distance2D(P.offset,{x:0,y:0})>=3;if(!L&&!N)return;const{point:z}=P,{timestamp:W}=frameData;this.history.push({...z,timestamp:W});const{onStart:ai,onMove:mt}=this.handlers;L||(ai&&ai(this.lastMoveEvent,P),this.startEvent=this.lastMoveEvent),mt&&mt(this.lastMoveEvent,P)},this.handlePointerMove=(P,L)=>{this.lastMoveEvent=P,this.lastMoveEventInfo=transformPoint(L,this.transformPagePoint),frame.update(this.updatePoint,!0)},this.handlePointerUp=(P,L)=>{this.end();const{onEnd:N,onSessionEnd:z,resumeAnimation:W}=this.handlers;if(this.dragSnapToOrigin&&W&&W(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const ai=getPanInfo(P.type==="pointercancel"?this.lastMoveEventInfo:transformPoint(L,this.transformPagePoint),this.history);this.startEvent&&N&&N(P,ai),z&&z(P,ai)},!isPrimaryPointer(n))return;this.dragSnapToOrigin=l,this.handlers=o,this.transformPagePoint=s,this.contextWindow=c||window;const d=extractEventInfo(n),h=transformPoint(d,this.transformPagePoint),{point:p}=h,{timestamp:y}=frameData;this.history=[{...p,timestamp:y}];const{onSessionStart:S}=o;S&&S(n,getPanInfo(h,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 l=millisecondsToSeconds(c.timestamp-s.timestamp);if(l===0)return{x:0,y:0};const d={x:(c.x-s.x)/l,y:(c.y-s.y)/l};return d.x===1/0&&(d.x=0),d.y===1/0&&(d.y=0),d}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 l,d;for(let h=0;h<c;h++){l=o[h],d=l.projectionDelta;const p=l.instance;p&&p.style&&p.style.display==="contents"||(s&&l.options.layoutScroll&&l.scroll&&l!==l.root&&transformBox(t,{x:-l.scroll.offset.x,y:-l.scroll.offset.y}),d&&(n.x*=d.x.scale,n.y*=d.y.scale,applyBoxDelta(t,d)),s&&hasTransform(l.latestValues)&&transformBox(t,l.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 l=n[c]!==void 0?n[c]:.5,d=mixNumber$1(t.min,t.max,l);applyAxisDelta(t,n[o],n[s],d,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=S=>{const{dragSnapToOrigin:P}=this.getProps();P?this.pauseAnimation():this.stopAnimation(),o&&this.snapToCursor(extractEventInfo(S,"page").point)},l=(S,P)=>{const{drag:L,dragPropagation:N,onDragStart:z}=this.getProps();if(L&&!N&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=getGlobalLock(L),!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(ai=>{let mt=this.getAxisMotionValue(ai).get()||0;if(percent.test(mt)){const{projection:J}=this.visualElement;if(J&&J.layout){const pi=J.layout.layoutBox[ai];pi&&(mt=calcLength(pi)*(parseFloat(mt)/100))}}this.originPoint[ai]=mt}),z&&z(S,P);const{animationState:W}=this.visualElement;W&&W.setActive("whileDrag",!0)},d=(S,P)=>{const{dragPropagation:L,dragDirectionLock:N,onDirectionLock:z,onDrag:W}=this.getProps();if(!L&&!this.openGlobalLock)return;const{offset:ai}=P;if(N&&this.currentDirection===null){this.currentDirection=getCurrentDirection(ai),this.currentDirection!==null&&z&&z(this.currentDirection);return}this.updateAxis("x",P.point,ai),this.updateAxis("y",P.point,ai),this.visualElement.render(),W&&W(S,P)},h=(S,P)=>this.stop(S,P),p=()=>eachAxis(S=>{var P;return this.getAnimationState(S)==="paused"&&((P=this.getAxisMotionValue(S).animation)===null||P===void 0?void 0:P.play())}),{dragSnapToOrigin:y}=this.getProps();this.panSession=new PanSession(n,{onSessionStart:c,onStart:l,onMove:d,onSessionEnd:h,resumeAnimation:p},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:y,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:l}=this.getProps();l&&l(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 l=this.getAxisMotionValue(n);let d=this.originPoint[n]+s[n];this.constraints&&this.constraints[n]&&(d=applyConstraints(d,this.constraints[n],this.elastic[n])),l.set(d)}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,l=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),l!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&eachAxis(d=>{this.getAxisMotionValue(d)&&(this.constraints[d]=rebaseAxisConstraints(c.layoutBox[d],this.constraints[d]))})}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 l=measurePageBox(s,c.root,this.visualElement.getTransformPagePoint());let d=calcViewportConstraints(c.layout.layoutBox,l);if(o){const h=o(convertBoxToBoundingBox(d));this.hasMutatedConstraints=!!h,h&&(d=convertBoundingBoxToBox(h))}return d}startAnimation(n){const{drag:o,dragMomentum:s,dragElastic:c,dragTransition:l,dragSnapToOrigin:d,onDragTransitionEnd:h}=this.getProps(),p=this.constraints||{},y=eachAxis(S=>{if(!shouldDrag(S,o,this.currentDirection))return;let P=p[S]||{};d&&(P={min:0,max:0});const L=c?200:1e6,N=c?40:1e7,z={type:"inertia",velocity:s?n[S]:0,bounceStiffness:L,bounceDamping:N,timeConstant:750,restDelta:1,restSpeed:10,...l,...P};return this.startAxisValueAnimation(S,z)});return Promise.all(y).then(h)}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,l=this.getAxisMotionValue(o);if(c&&c.layout){const{min:d,max:h}=c.layout.layoutBox[o];l.set(n[o]-mixNumber$1(d,h,.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(d=>{const h=this.getAxisMotionValue(d);if(h){const p=h.get();c[d]=calcOrigin({min:p,max:p},this.constraints[d])}});const{transformTemplate:l}=this.visualElement.getProps();this.visualElement.current.style.transform=l?l({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),eachAxis(d=>{if(!shouldDrag(d,n,null))return;const h=this.getAxisMotionValue(d),{min:p,max:y}=this.constraints[d];h.set(mixNumber$1(p,y,c[d]))})}addListeners(){if(!this.visualElement.current)return;elementDragControls.set(this.visualElement,this);const n=this.visualElement.current,o=addPointerEvent(n,"pointerdown",p=>{const{drag:y,dragListener:S=!0}=this.getProps();y&&S&&this.start(p)}),s=()=>{const{dragConstraints:p}=this.getProps();isRefObject(p)&&(this.constraints=this.resolveRefConstraints())},{projection:c}=this.visualElement,l=c.addEventListener("measure",s);c&&!c.layout&&(c.root&&c.root.updateScroll(),c.updateLayout()),s();const d=addDomEvent(window,"resize",()=>this.scalePositionWithinConstraints()),h=c.addEventListener("didUpdate",({delta:p,hasLayoutChanged:y})=>{this.isDragging&&y&&(eachAxis(S=>{const P=this.getAxisMotionValue(S);P&&(this.originPoint[S]+=p[S].translate,P.set(P.get()+p[S].translate))}),this.visualElement.render())});return()=>{d(),o(),l(),h&&h()}}getProps(){const n=this.visualElement.getProps(),{drag:o=!1,dragDirectionLock:s=!1,dragPropagation:c=!1,dragConstraints:l=!1,dragElastic:d=defaultElastic,dragMomentum:h=!0}=n;return{...n,drag:o,dragDirectionLock:s,dragPropagation:c,dragConstraints:l,dragElastic:d,dragMomentum:h}}}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:(l,d)=>{delete this.session,c&&c(l,d)}}}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 l=complex.createTransformer(t),d=typeof c[0]!="number"?1:0,h=o.x.scale*n.x,p=o.y.scale*n.y;c[0+d]/=h,c[1+d]/=p;const y=mixNumber$1(h,p,.5);return typeof c[2+d]=="number"&&(c[2+d]/=y),typeof c[3+d]=="number"&&(c[3+d]/=y),l(c)}};class MeasureLayoutWithContext extends React.Component{componentDidMount(){const{visualElement:n,layoutGroup:o,switchLayoutGroup:s,layoutId:c}=this.props,{projection:l}=n;addScaleCorrector(defaultScaleCorrectors),l&&(o.group&&o.group.add(l),s&&s.register&&c&&s.register(l),l.root.didUpdate(),l.addEventListener("animationComplete",()=>{this.safeToRemove()}),l.setOptions({...l.options,onExitComplete:()=>this.safeToRemove()})),globalProjectionState.hasEverUpdated=!0}getSnapshotBeforeUpdate(n){const{layoutDependency:o,visualElement:s,drag:c,isPresent:l}=this.props,d=s.projection;return d&&(d.isPresent=l,c||n.layoutDependency!==o||o===void 0?d.willUpdate():this.safeToRemove(),n.isPresent!==l&&(l?d.promote():d.relegate()||frame.postRender(()=>{const h=d.getStack();(!h||!h.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,l){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))):l&&(t.opacity=mixNumber$1(n.opacity!==void 0?n.opacity:1,o.opacity!==void 0?o.opacity:1,s));for(let d=0;d<numBorders;d++){const h=`border${borders[d]}Radius`;let p=getRadius(n,h),y=getRadius(o,h);if(p===void 0&&y===void 0)continue;p||(p=0),y||(y=0),p===0||y===0||isPx(p)===isPx(y)?(t[h]=Math.max(mixNumber$1(asNumber(p),asNumber(y),s),0),(percent.test(y)||percent.test(p))&&(t[h]+="%")):t[h]=y}(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,l=t,d=t){if(percent.test(n)&&(n=parseFloat(n),n=mixNumber$1(d.min,d.max,n/100)-d.min),typeof n!="number")return;let h=mixNumber$1(l.min,l.max,s);t===l&&(h-=n),t.min=removePointDelta(t.min,n,o,h,c),t.max=removePointDelta(t.max,n,o,h,c)}function removeAxisTransforms(t,n,[o,s,c],l,d){removeAxisDelta(t,n[o],n[s],n[c],n.scale,l,d)}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 l=this.members[c];if(l.isPresent!==!1){s=l;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,l=t.y.translate/n.y,d=(o==null?void 0:o.z)||0;if((c||l||d)&&(s=`translate3d(${c}px, ${l}px, ${d}px) `),(n.x!==1||n.y!==1)&&(s+=`scale(${1/n.x}, ${1/n.y}) `),o){const{transformPerspective:y,rotate:S,rotateX:P,rotateY:L,skewX:N,skewY:z}=o;y&&(s=`perspective(${y}px) ${s}`),S&&(s+=`rotate(${S}deg) `),P&&(s+=`rotateX(${P}deg) `),L&&(s+=`rotateY(${L}deg) `),N&&(s+=`skewX(${N}deg) `),z&&(s+=`skewY(${z}deg) `)}const h=t.x.scale*n.x,p=t.y.scale*n.y;return(h!==1||p!==1)&&(s+=`scale(${h}, ${p})`),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 l=c-o;l>=n&&(cancelFrame(s),t(l-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(d={},h=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=d,this.root=h?h.root||h:this,this.path=h?[...h.path,h]:[],this.parent=h,this.depth=h?h.depth+1:0;for(let p=0;p<this.path.length;p++)this.path[p].shouldResetTransform=!0;this.root===this&&(this.nodes=new FlatTree)}addEventListener(d,h){return this.eventHandlers.has(d)||this.eventHandlers.set(d,new SubscriptionManager),this.eventHandlers.get(d).add(h)}notifyListeners(d,...h){const p=this.eventHandlers.get(d);p&&p.notify(...h)}hasListeners(d){return this.eventHandlers.has(d)}mount(d,h=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=isSVGElement(d),this.instance=d;const{layoutId:p,layout:y,visualElement:S}=this.options;if(S&&!S.current&&S.mount(d),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),h&&(y||p)&&(this.isLayoutDirty=!0),t){let P;const L=()=>this.root.updateBlockedByResize=!1;t(d,()=>{this.root.updateBlockedByResize=!0,P&&P(),P=delay(L,250),globalProjectionState.hasAnimatedSinceResize&&(globalProjectionState.hasAnimatedSinceResize=!1,this.nodes.forEach(finishAnimation))})}p&&this.root.registerSharedNode(p,this),this.options.animate!==!1&&S&&(p||y)&&this.addEventListener("didUpdate",({delta:P,hasLayoutChanged:L,hasRelativeTargetChanged:N,layout:z})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const W=this.options.transition||S.getDefaultTransition()||defaultLayoutTransition,{onLayoutAnimationStart:ai,onLayoutAnimationComplete:mt}=S.getProps(),J=!this.targetLayout||!boxEqualsRounded(this.targetLayout,z)||N,pi=!L&&N;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||pi||L&&(J||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(P,pi);const fa={...getValueTransition(W,"layout"),onPlay:ai,onComplete:mt};(S.shouldReduceMotion||this.options.layoutRoot)&&(fa.delay=0,fa.type=!1),this.startAnimation(fa)}else L||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 d=this.getStack();d&&d.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:d}=this.options;return d&&d.getProps().transformTemplate}willUpdate(d=!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 S=0;S<this.path.length;S++){const P=this.path[S];P.shouldResetTransform=!0,P.updateScroll("snapshot"),P.options.layoutRoot&&P.willUpdate(!1)}const{layoutId:h,layout:p}=this.options;if(h===void 0&&!p)return;const y=this.getTransformTemplate();this.prevTransformTemplateValue=y?y(this.latestValues,""):void 0,this.updateSnapshot(),d&&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 h=time.now();frameData.delta=clamp(0,1e3/60,h-frameData.timestamp),frameData.timestamp=h,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 p=0;p<this.path.length;p++)this.path[p].updateScroll();const d=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:h}=this.options;h&&h.notify("LayoutMeasure",this.layout.layoutBox,d?d.layoutBox:void 0)}updateScroll(d="measure"){let h=!!(this.options.layoutScroll&&this.instance);this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===d&&(h=!1),h&&(this.scroll={animationId:this.root.animationId,phase:d,isRoot:s(this.instance),offset:o(this.instance)})}resetTransform(){if(!c)return;const d=this.isLayoutDirty||this.shouldResetTransform,h=this.projectionDelta&&!isDeltaZero(this.projectionDelta),p=this.getTransformTemplate(),y=p?p(this.latestValues,""):void 0,S=y!==this.prevTransformTemplateValue;d&&(h||hasTransform(this.latestValues)||S)&&(c(this.instance,y),this.shouldResetTransform=!1,this.scheduleRender())}measure(d=!0){const h=this.measurePageBox();let p=this.removeElementScroll(h);return d&&(p=this.removeTransform(p)),roundBox(p),{animationId:this.root.animationId,measuredBox:h,layoutBox:p,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:d}=this.options;if(!d)return createBox();const h=d.measureViewportBox(),{scroll:p}=this.root;return p&&(translateAxis(h.x,p.offset.x),translateAxis(h.y,p.offset.y)),h}removeElementScroll(d){const h=createBox();copyBoxInto(h,d);for(let p=0;p<this.path.length;p++){const y=this.path[p],{scroll:S,options:P}=y;if(y!==this.root&&S&&P.layoutScroll){if(S.isRoot){copyBoxInto(h,d);const{scroll:L}=this.root;L&&(translateAxis(h.x,-L.offset.x),translateAxis(h.y,-L.offset.y))}translateAxis(h.x,S.offset.x),translateAxis(h.y,S.offset.y)}}return h}applyTransform(d,h=!1){const p=createBox();copyBoxInto(p,d);for(let y=0;y<this.path.length;y++){const S=this.path[y];!h&&S.options.layoutScroll&&S.scroll&&S!==S.root&&transformBox(p,{x:-S.scroll.offset.x,y:-S.scroll.offset.y}),hasTransform(S.latestValues)&&transformBox(p,S.latestValues)}return hasTransform(this.latestValues)&&transformBox(p,this.latestValues),p}removeTransform(d){const h=createBox();copyBoxInto(h,d);for(let p=0;p<this.path.length;p++){const y=this.path[p];if(!y.instance||!hasTransform(y.latestValues))continue;hasScale(y.latestValues)&&y.updateSnapshot();const S=createBox(),P=y.measurePageBox();copyBoxInto(S,P),removeBoxTransforms(h,y.latestValues,y.snapshot?y.snapshot.layoutBox:void 0,S)}return hasTransform(this.latestValues)&&removeBoxTransforms(h,this.latestValues),h}setTargetDelta(d){this.targetDelta=d,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(d){this.options={...this.options,...d,crossfade:d.crossfade!==void 0?d.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(d=!1){var h;const p=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=p.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=p.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=p.isSharedProjectionDirty);const y=!!this.resumingFrom||this!==p;if(!(d||y&&this.isSharedProjectionDirty||this.isProjectionDirty||!((h=this.parent)===null||h===void 0)&&h.isProjectionDirty||this.attemptToResolveRelativeTarget))return;const{layout:P,layoutId:L}=this.options;if(!(!this.layout||!(P||L))){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 d;const h=this.getLead(),p=!!this.resumingFrom||this!==h;let y=!0;if((this.isProjectionDirty||!((d=this.parent)===null||d===void 0)&&d.isProjectionDirty)&&(y=!1),p&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(y=!1),this.resolvedRelativeTargetAt===frameData.timestamp&&(y=!1),y)return;const{layout:S,layoutId:P}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(S||P))return;copyBoxInto(this.layoutCorrected,this.layout.layoutBox);const L=this.treeScale.x,N=this.treeScale.y;applyTreeDeltas(this.layoutCorrected,this.treeScale,this.path,p),h.layout&&!h.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(h.target=h.layout.layoutBox,h.targetWithTransforms=createBox());const{target:z}=h;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!==L||this.treeScale.y!==N)&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",z)),projectionFrameData.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(d=!0){if(this.options.scheduleRender&&this.options.scheduleRender(),d){const h=this.getStack();h&&h.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}setAnimationOrigin(d,h=!1){const p=this.snapshot,y=p?p.latestValues:{},S={...this.latestValues},P=createDelta();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!h;const L=createBox(),N=p?p.source:void 0,z=this.layout?this.layout.source:void 0,W=N!==z,ai=this.getStack(),mt=!ai||ai.members.length<=1,J=!!(W&&!mt&&this.options.crossfade===!0&&!this.path.some(hasOpacityCrossfade));this.animationProgress=0;let pi;this.mixTargetDelta=fa=>{const ma=fa/1e3;mixAxisDelta(P.x,d.x,ma),mixAxisDelta(P.y,d.y,ma),this.setTargetDelta(P),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(calcRelativePosition(L,this.layout.layoutBox,this.relativeParent.layout.layoutBox),mixBox(this.relativeTarget,this.relativeTargetOrigin,L,ma),pi&&boxEquals(this.relativeTarget,pi)&&(this.isProjectionDirty=!1),pi||(pi=createBox()),copyBoxInto(pi,this.relativeTarget)),W&&(this.animationValues=S,mixValues(S,y,this.latestValues,ma,J,mt)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=ma},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(d){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,{...d,onUpdate:h=>{this.mixTargetDelta(h),d.onUpdate&&d.onUpdate(h)},onComplete:()=>{d.onComplete&&d.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 d=this.getStack();d&&d.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 d=this.getLead();let{targetWithTransforms:h,target:p,layout:y,latestValues:S}=d;if(!(!h||!p||!y)){if(this!==d&&this.layout&&y&&shouldAnimatePositionOnly(this.options.animationType,this.layout.layoutBox,y.layoutBox)){p=this.target||createBox();const P=calcLength(this.layout.layoutBox.x);p.x.min=d.target.x.min,p.x.max=p.x.min+P;const L=calcLength(this.layout.layoutBox.y);p.y.min=d.target.y.min,p.y.max=p.y.min+L}copyBoxInto(h,p),transformBox(h,S),calcBoxDelta(this.projectionDeltaWithTransform,this.layoutCorrected,h,S)}}registerSharedNode(d,h){this.sharedNodes.has(d)||this.sharedNodes.set(d,new NodeStack),this.sharedNodes.get(d).add(h);const y=h.options.initialPromotionConfig;h.promote({transition:y?y.transition:void 0,preserveFollowOpacity:y&&y.shouldPreserveFollowOpacity?y.shouldPreserveFollowOpacity(h):void 0})}isLead(){const d=this.getStack();return d?d.lead===this:!0}getLead(){var d;const{layoutId:h}=this.options;return h?((d=this.getStack())===null||d===void 0?void 0:d.lead)||this:this}getPrevLead(){var d;const{layoutId:h}=this.options;return h?(d=this.getStack())===null||d===void 0?void 0:d.prevLead:void 0}getStack(){const{layoutId:d}=this.options;if(d)return this.root.sharedNodes.get(d)}promote({needsReset:d,transition:h,preserveFollowOpacity:p}={}){const y=this.getStack();y&&y.promote(this,p),d&&(this.projectionDelta=void 0,this.needsReset=!0),h&&this.setOptions({transition:h})}relegate(){const d=this.getStack();return d?d.relegate(this):!1}resetSkewAndRotation(){const{visualElement:d}=this.options;if(!d)return;let h=!1;const{latestValues:p}=d;if((p.z||p.rotate||p.rotateX||p.rotateY||p.rotateZ||p.skewX||p.skewY)&&(h=!0),!h)return;const y={};p.z&&resetDistortingTransform("z",d,y,this.animationValues);for(let S=0;S<transformAxes.length;S++)resetDistortingTransform(`rotate${transformAxes[S]}`,d,y,this.animationValues),resetDistortingTransform(`skew${transformAxes[S]}`,d,y,this.animationValues);d.render();for(const S in y)d.setStaticValue(S,y[S]),this.animationValues&&(this.animationValues[S]=y[S]);d.scheduleRender()}getProjectionStyles(d){var h,p;if(!this.instance||this.isSVG)return;if(!this.isVisible)return hiddenVisibility;const y={visibility:""},S=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,y.opacity="",y.pointerEvents=resolveMotionValue(d==null?void 0:d.pointerEvents)||"",y.transform=S?S(this.latestValues,""):"none",y;const P=this.getLead();if(!this.projectionDelta||!this.layout||!P.target){const W={};return this.options.layoutId&&(W.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,W.pointerEvents=resolveMotionValue(d==null?void 0:d.pointerEvents)||""),this.hasProjected&&!hasTransform(this.latestValues)&&(W.transform=S?S({},""):"none",this.hasProjected=!1),W}const L=P.animationValues||P.latestValues;this.applyTransformsToTarget(),y.transform=buildProjectionTransform(this.projectionDeltaWithTransform,this.treeScale,L),S&&(y.transform=S(L,y.transform));const{x:N,y:z}=this.projectionDelta;y.transformOrigin=`${N.origin*100}% ${z.origin*100}% 0`,P.animationValues?y.opacity=P===this?(p=(h=L.opacity)!==null&&h!==void 0?h:this.latestValues.opacity)!==null&&p!==void 0?p:1:this.preserveOpacity?this.latestValues.opacity:L.opacityExit:y.opacity=P===this?L.opacity!==void 0?L.opacity:"":L.opacityExit!==void 0?L.opacityExit:0;for(const W in scaleCorrectors){if(L[W]===void 0)continue;const{correct:ai,applyTo:mt}=scaleCorrectors[W],J=y.transform==="none"?L[W]:ai(L[W],P);if(mt){const pi=mt.length;for(let fa=0;fa<pi;fa++)y[mt[fa]]=J}else y[W]=J}return this.options.layoutId&&(y.pointerEvents=P===this?resolveMotionValue(d==null?void 0:d.pointerEvents)||"":"none"),y}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(d=>{var h;return(h=d.currentAnimation)===null||h===void 0?void 0:h.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:l}=t.options,d=o.source!==t.layout.source;l==="size"?eachAxis(P=>{const L=d?o.measuredBox[P]:o.layoutBox[P],N=calcLength(L);L.min=s[P].min,L.max=L.min+N}):shouldAnimatePositionOnly(l,o.layoutBox,s)&&eachAxis(P=>{const L=d?o.measuredBox[P]:o.layoutBox[P],N=calcLength(s[P]);L.max=L.min+N,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[P].max=t.relativeTarget[P].min+N)});const h=createDelta();calcBoxDelta(h,s,o.layoutBox);const p=createDelta();d?calcBoxDelta(p,t.applyTransform(c,!0),o.measuredBox):calcBoxDelta(p,s,o.layoutBox);const y=!isDeltaZero(h);let S=!1;if(!t.resumeFrom){const P=t.getClosestProjectingParent();if(P&&!P.resumeFrom){const{snapshot:L,layout:N}=P;if(L&&N){const z=createBox();calcRelativePosition(z,o.layoutBox,L.layoutBox);const W=createBox();calcRelativePosition(W,s,N.layoutBox),boxEqualsRounded(z,W)||(S=!0),P.options.layoutRoot&&(t.relativeTarget=W,t.relativeTargetOrigin=z,t.relativeParent=P)}}}t.notifyListeners("didUpdate",{layout:s,snapshot:o,delta:p,layoutDelta:h,hasLayoutChanged:y,hasRelativeTargetChanged:S})}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 l=n[c],d=o[c];if(isMotionValue(l))t.addValue(c,l),isWillChangeMotionValue(s)&&s.add(c),process.env.NODE_ENV==="development"&&warnOnce(l.version==="11.0.27",`Attempting to mix Framer Motion versions ${l.version} with 11.0.27 may not work as expected.`);else if(isMotionValue(d))t.addValue(c,motionValue(l,{owner:t})),isWillChangeMotionValue(s)&&s.remove(c);else if(d!==l)if(t.hasValue(c)){const h=t.getValue(c);h.liveStyle===!0?h.jump(l):h.hasAnimated||h.set(l)}else{const h=t.getStaticValue(c);t.addValue(c,motionValue(h!==void 0?h:l,{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:l,visualState:d},h={}){this.resolveKeyframes=(L,N,z,W)=>new this.KeyframeResolver(L,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:p,renderState:y}=d;this.latestValues=p,this.baseTarget={...p},this.initialValues=o.initial?{...p}:{},this.renderState=y,this.parent=n,this.props=o,this.presenceContext=s,this.depth=n?n.depth+1:0,this.reducedMotionConfig=c,this.options=h,this.blockInitialAnimation=!!l,this.isControllingVariants=isControllingVariants(o),this.isVariantNode=isVariantNode(o),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(n&&n.current);const{willChange:S,...P}=this.scrapeMotionValuesFromProps(o,{},this);for(const L in P){const N=P[L];p[L]!==void 0&&isMotionValue(N)&&(N.set(p[L],!1),isWillChangeMotionValue(S)&&S.add(L))}}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",d=>{this.latestValues[n]=d,this.props.onUpdate&&frame.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0)}),l=o.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(n,()=>{c(),l(),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,l){let d,h;if(process.env.NODE_ENV!=="production"&&c&&s){const p="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,p):invariant(!1,p)}for(let p=0;p<numFeatures;p++){const y=featureNames[p],{isEnabled:S,Feature:P,ProjectionNode:L,MeasureLayout:N}=featureDefinitions[y];L&&(d=L),S(o)&&(!this.features[y]&&P&&(this.features[y]=new P(this)),N&&(h=N))}if((this.type==="html"||this.type==="svg")&&!this.projection&&d){this.projection=new d(this.latestValues,getClosestProjectingNode(this.parent));const{layoutId:p,layout:y,drag:S,dragConstraints:P,layoutScroll:L,layoutRoot:N}=o;this.projection.setOptions({layoutId:p,layout:y,alwaysMeasureLayout:!!S||P&&isRefObject(P),visualElement:this,scheduleRender:()=>this.scheduleRender(),animationType:typeof y=="string"?y:"both",initialPromotionConfig:l,layoutScroll:L,layoutRoot:N})}return h}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 l=n["on"+c];l&&(this.propEventSubscriptions[c]=this.on(c,l))}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],l=this.props[c];(isVariantLabel(l)||l===!1)&&(o[c]=l)}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,l=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&&l!==void 0)return l;const d=this.getBaseTargetFromProps(this.props,n);return d!==void 0&&!isMotionValue(d)?d:this.initialValues[n]!==void 0&&l===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),l=new Set(t),d=o.current;c.forEach(function(h){l.has(h)||assignRef(h,null)}),l.forEach(function(h){c.has(h)||assignRef(h,d)})}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 l=useMotionValue(""),d=useMotionValue("none"),{toWindowPosition:h,getCamera:p,toXYZ:y,isPositionVisible:S}=useContext(),P=React.useRef(null);usePreRender(()=>{if(P.current==null)return;let N;try{const J=h==null?void 0:h([c.x,c.y,c.z]);N=new Cartesian2(J==null?void 0:J[0],J==null?void 0:J[1])}catch{d.set("none");return}const z=p==null?void 0:p();if(!z)return;const W=y==null?void 0:y(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||!(S!=null&&S([c.x,c.y,c.z]))){d.set("none");return}const ai=`calc(${N.x}px - 50%)`,mt=`calc(${N.y}px - 50%)`;l.set(`translate(${ai}, ${mt})`),d.set("block")});const L=useMergeRefs([P,s]);return jsxRuntimeExports.jsx(motion.div,{ref:L,...o,style:{...o.style,transform:l,display:d,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)),l=React.useMemo(()=>({polyline:{positions:c,width:1.5,material:new PolylineDashMaterialProperty({color:o,dashLength:8})}}),[o,c]);return jsxRuntimeExports.jsx(Entity,{...l})},ExtrudedMeasurement=({a:t,b:n,extrudedHeight:o,color:s,showLine:c})=>{const l=useConstant$2(()=>new Cartesian3);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ScreenSpaceElement,{position:Cartesian3.midpoint(t,n,l),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:l,centroidBasePoint:d,centroidExtrudedPoint:h,catchedExtrudedPoint:p,handleControlPointMouseEvent:y})=>{const S=t[t.length-1],P=l?new Cartesian3(...l):void 0,L=d?new Cartesian3(...d):void 0,N=h?new Cartesian3(...h):void 0;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[P&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ControlPoint,{index:-1,position:P,isEditing:c,isExtrudedControlPoint:!0,handleControlPointMouseEvent:y}),(!c||p)&&jsxRuntimeExports.jsx(ExtrudedMeasurement,{a:S,b:P,extrudedHeight:o,color:c?Color$1.fromCssColorString(DEFAULT_EDIT_COLOR):s,showLine:n!=="extrudedPolygon"})]}),L&&jsxRuntimeExports.jsx(ControlPoint,{index:-1,position:L,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:l})=>{const d=React.useRef(n);d.current=n;const p=useConstant$2(()=>new CallbackProperty(()=>d.current,!1)),y=React.useRef(o);y.current=o;const P=useConstant$2(()=>new CallbackProperty(()=>y.current,!1)),L=React.useMemo(()=>({polygon:{hierarchy:p,heightReference:HeightReference$1.RELATIVE_TO_TERRAIN,extrudedHeight:P,extrudedHeightReference:HeightReference$1.RELATIVE_TO_TERRAIN,fill:!0,outline:!0,outlineWidth:1,outlineColor:l?Color$1.fromCssColorString(DEFAULT_EDIT_COLOR):s==null?void 0:s.withAlpha(1),material:new ColorMaterialProperty(l?s==null?void 0:s.withAlpha(.2):s),classificationType:ClassificationType$1.TERRAIN,shadows:c?ShadowMode$1.DISABLED:ShadowMode$1.ENABLED}}),[P,c,p,s,l]),{requestRender:N}=useContext();return N==null||N(),jsxRuntimeExports.jsx(Entity,{id:t,...L})},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)),l=t?c:n,d=React.useMemo(()=>({polygon:{hierarchy:l,fill:!0,material:o==null?void 0:o.withAlpha(.5),classificationType:ClassificationType$1.TERRAIN}}),[o,l]),{requestRender:h}=useContext();return h==null||h(),jsxRuntimeExports.jsx(Entity,{...d})},PolylineEntity=({dynamic:t=!1,positions:n,color:o,isEditing:s})=>{const c=React.useRef(n);c.current=n;const l=useConstant$2(()=>new CallbackProperty(()=>c.current,!t)),d=t?l:n,h=React.useMemo(()=>({polyline:{positions:d,width:1.5,material:s?Color$1.fromCssColorString(DEFAULT_EDIT_COLOR):o,classificationType:ClassificationType$1.TERRAIN,clampToGround:!0}}),[o,d,s]),{requestRender:p}=useContext();return p==null||p(),jsxRuntimeExports.jsx(Entity,{...h})},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 l=0;l<n.length-1;l++){const d=n[l+1],h=Cartesian3.midpoint(n[l],d,cartesianScratch1$1);c.push(h.clone())}if(t==="polygon"||t==="extrudedPolygon"){const l=Cartesian3.midpoint(n[n.length-1],n[0],cartesianScratch1$1);c.push(l.clone())}return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:c.map((l,d)=>jsxRuntimeExports.jsx(ControlPoint,{position:l,isAddingPoint:!0,index:d,clampToGround:!0,isEditing:o,handleControlPointMouseEvent:()=>s==null?void 0:s([l.x,l.y,l.z],d)},d))})});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)),l=React.useMemo(()=>({polyline:{positions:c,width:1.5,material:new PolylineDashMaterialProperty({color:o,dashLength:8}),classificationType:ClassificationType$1.TERRAIN,clampToGround:!0}}),[o,c]),{requestRender:d}=useContext();return d==null||d(),jsxRuntimeExports.jsx(Entity,{...l})},SurfaceMeasurement=({a:t,b:n,color:o,showLine:s=!1})=>{const c=useConstant$2(()=>new Cartesian3),{getSurfaceDistance:l}=useContext(),d=l==null?void 0:l(t,n);return d!==void 0?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ScreenSpaceElement,{position:Cartesian3.midpoint(t,n,c),children:jsxRuntimeExports.jsx(MeasurementText,{children:d<1e3?`${d.toFixed(1)} m`:`${(d/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:l,handleControlPointMouseEvent:d})=>{const h=[];if(n.length>=2)if(s){if(c!==void 0&&c!==-1)switch(t){case"polyline":c>0&&h.push({points:[n[c-1],n[c]],showLine:!1}),c<n.length-1&&h.push({points:[n[c],n[c+1]],showLine:!1});break;case"circle":case"extrudedCircle":c!==2&&h.push({points:[n[0],n[1]],showLine:!0});break;case"rectangle":case"extrudedRectangle":if(c<=1)h.push({points:[n[0],n[1]],showLine:!1});else if(c===2){const[p,y,S]=n,P=Cartesian3.midpoint(p,y,cartesianScratch1);h.push({points:[P,S],showLine:!0})}break;case"polygon":case"extrudedPolygon":h.push({points:[n[c],c===0?n[n.length-1]:n[c-1]],showLine:!1}),h.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)h.push({points:n,showLine:!0});else if(n.length===3){const[p,y,S]=n,P=Cartesian3.midpoint(p,y,cartesianScratch1);h.push({points:[P,S],showLine:!0})}break;default:h.push({points:n.slice(-2),showLine:t==="circle"});break}return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[n.map((p,y)=>jsxRuntimeExports.jsx(ControlPoint,{position:p,index:y,isSelected:l===y,clampToGround:!0,isEditing:s,handleControlPointMouseEvent:d},y)),h.map(({points:p,showLine:y},S)=>jsxRuntimeExports.jsx(SurfaceMeasurement,{a:p[0],b:p[1],color:s?Color$1.fromCssColorString(DEFAULT_EDIT_COLOR):o,showLine:y},S))]})});SurfaceControlPoints.displayName="SurfaceControlPoints";const SketchComponent=React.memo(({geometryOptions:t,extrudedHeight:n,disableShadow:o,color:s,isEditing:c,extrudedPoint:l,centroidBasePoint:d,centroidExtrudedPoint:h,catchedControlPointIndex:p,catchedExtrudedPoint:y,selectedControlPointIndex:S,handleControlPointMouseEvent:P,handleAddControlPoint:L})=>{const N=React.useMemo(()=>t?{...t,controlPoints:t==null?void 0:t.controlPoints.map(J=>new Cesium$1.Cartesian3(...J))}:null,[t]),z=React.useMemo(()=>N?createGeometry(N):null,[N]),{positionsArray:W,hierarchyArray:ai}=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]),mt=React.useMemo(()=>Color$1.fromCssColorString(s??DEFAULT_SKETCH_COLOR),[s]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[W==null?void 0:W.map((J,pi)=>jsxRuntimeExports.jsx(PolylineEntity,{dynamic:!0,positions:J,color:mt,isEditing:c},pi)),ai==null?void 0:ai.map((J,pi)=>jsxRuntimeExports.jsx(PolygonEntity,{dynamic:!0,hierarchy:J,color:mt},pi)),N!=null&&(!n||c)&&jsxRuntimeExports.jsx(SurfaceControlPoints,{geometryOptions:N,color:mt,isEditing:c,catchedControlPointIndex:p,selectedControlPointIndex:S,handleControlPointMouseEvent:P}),N!=null&&c&&jsxRuntimeExports.jsx(SurfaceAddingPoints,{geometryOptions:N,isEditing:c,handleAddControlPoint:L}),N!=null&&n&&jsxRuntimeExports.jsx(ExtrudedControlPoints,{geometryOptions:N,extrudedHeight:n,extrudedPoint:l,centroidBasePoint:d,centroidExtrudedPoint:h,catchedExtrudedPoint:y,color:mt,isEditing:c,handleControlPointMouseEvent:P}),n&&(ai==null?void 0:ai.map((J,pi)=>jsxRuntimeExports.jsx(ExtrudedPolygonEntity,{hierarchy:J,extrudedHeight:n,disableShadow:o,color:mt,isEditing:c},pi)))]})});SketchComponent.displayName="SketchComponent";const Cesium=({className:t,style:n,property:o,time:s,camera:c,small:l,ready:d,children:h,selectedLayerId:p,isLayerDraggable:y,isLayerDragging:S,shouldRender:P,layerSelectionReason:L,meta:N,displayCredits:z,layersRef:W,featureFlags:ai,requestingRenderMode:mt,timelineManagerRef:J,cameraForceHorizontalRoll:pi,onLayerSelect:fa,onCameraChange:ma,onLayerDrag:Sa,onLayerDrop:Ra,onLayerEdit:Vs,onLayerSelectWithRectStart:La,onLayerSelectWithRectMove:Zs,onLayerSelectWithRectEnd:Xs,onMount:Wa,onLayerVisibility:ea,onLayerLoad:ui,onCreditsUpdate:ba},ms)=>{var Xd,Gd,nf,uf,Vd,rf,sf,mf,ff,Cf,bf,If,zf,xf,Tf,Nf,Lf,Uf,Hf,Jf,Qf,wf,Vf,Df,Bf,Yf,qf,_m,Rf,of,vf,Mf,Ff,Gf,Kf,sp,lp,pp,gp,yp,$m,jm;const{cesium:yu,mouseEventHandles:pu,cesiumIonAccessToken:Nl,context:pd,layerSelectWithRectEventHandlers:Sc,sceneLight:Ru,sceneBackgroundColor:gd,sceneMsaaSamples:Zd,sceneMode:ef,cameraViewBoundaries:df,cameraViewOuterBoundaries:hf,cameraViewBoundariesMaterial:yf,handleCameraChange:pf,handleCameraMoveEnd:lf,handleUpdate:_f,handleClick:Ef,handleMount:Sf,handleUnmount:al,handleTilesChange:cf,handleTerrainProviderChange:tf}=useHooks$1({ref:ms,property:o,time:s,selectedLayerId:p,selectionReason:L,meta:N,layersRef:W,featureFlags:ai,timelineManagerRef:J,isLayerDraggable:y,isLayerDragging:S,shouldRender:P,requestingRenderMode:mt,camera:c,cameraForceHorizontalRoll:pi,onLayerDrag:Sa,onLayerDrop:Ra,onLayerSelect:fa,onLayerEdit:Vs,onLayerSelectWithRectStart:La,onLayerSelectWithRectMove:Zs,onLayerSelectWithRectEnd:Xs,onLayerVisibility:ea,onLayerLoad:ui,onCameraChange:ma,onMount:Wa,onCreditsUpdate:ba});return jsxRuntimeExports.jsxs(Ms$1,{ref:yu,onUpdate:_f,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:l?"300px":"auto",height:l?"300px":"100%",display:d?void 0:"none",cursor:S?"grab":void 0,...n},shadows:!!((Gd=(Xd=o==null?void 0:o.scene)==null?void 0:Xd.shadow)!=null&&Gd.enabled),onClick:Ef,onDoubleClick:pu.doubleClick,onMouseDown:pu.mouseDown,onMouseUp:pu.mouseUp,onRightClick:pu.rightClick,onRightDown:pu.rightDown,onRightUp:pu.rightUp,onMiddleClick:pu.middleClick,onMiddleDown:pu.middleDown,onMiddleUp:pu.middleUp,onMouseMove:pu.mouseMove,onMouseEnter:pu.mouseEnter,onMouseLeave:pu.mouseLeave,onWheel:pu.wheel,children:[jsxRuntimeExports.jsx(Event,{onMount:Sf,onUnmount:al}),jsxRuntimeExports.jsx(ReearthClock,{timelineManagerRef:J}),jsxRuntimeExports.jsx(ImageryLayers,{tiles:o==null?void 0:o.tiles,cesiumIonAccessToken:Nl,onTilesChange:cf}),jsxRuntimeExports.jsx(LabelImageryLayers,{tileLabels:o==null?void 0:o.tileLabels}),jsxRuntimeExports.jsx(Indicator,{property:o,timelineManagerRef:J}),jsxRuntimeExports.jsxs(ws$1,{useDefault:!0,children:[jsxRuntimeExports.jsx(Es$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_CLICK}),jsxRuntimeExports.jsx(Es$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_DOUBLE_CLICK})]}),jsxRuntimeExports.jsxs(ws$1,{children:[jsxRuntimeExports.jsx(Es$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_DOWN,action:Sc.start.handler}),jsxRuntimeExports.jsx(Es$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_DOWN,modifier:Cesium$1.KeyboardEventModifier.SHIFT,action:Sc.start.shift}),jsxRuntimeExports.jsx(Es$1,{type:Cesium$1.ScreenSpaceEventType.MOUSE_MOVE,action:Sc.move.handler}),jsxRuntimeExports.jsx(Es$1,{type:Cesium$1.ScreenSpaceEventType.MOUSE_MOVE,modifier:Cesium$1.KeyboardEventModifier.SHIFT,action:Sc.move.shift}),jsxRuntimeExports.jsx(Es$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_UP,action:Sc.end.handler}),jsxRuntimeExports.jsx(Es$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_UP,modifier:Cesium$1.KeyboardEventModifier.SHIFT,action:Sc.end.shift})]}),jsxRuntimeExports.jsx(Ss$1,{maximumZoomDistance:(uf=(nf=o==null?void 0:o.camera)==null?void 0:nf.limiter)!=null&&uf.enabled?((sf=(rf=(Vd=o.camera)==null?void 0:Vd.limiter)==null?void 0:rf.targetArea)==null?void 0:sf.height)??Number.POSITIVE_INFINITY:Number.POSITIVE_INFINITY,enableCollisionDetection:!((mf=o==null?void 0:o.camera)!=null&&mf.allowEnterGround)}),jsxRuntimeExports.jsx(hr$1,{percentageChanged:.2,onChange:pf,onMoveEnd:lf}),df&&((Cf=(ff=o==null?void 0:o.camera)==null?void 0:ff.limiter)==null?void 0:Cf.showHelper)&&jsxRuntimeExports.jsx(Lr$1,{children:jsxRuntimeExports.jsx(ns$1,{positions:df,width:1,material:Cesium$1.Color.RED,arcType:Cesium$1.ArcType.RHUMB})}),hf&&((If=(bf=o==null?void 0:o.camera)==null?void 0:bf.limiter)==null?void 0:If.showHelper)&&jsxRuntimeExports.jsx(Lr$1,{children:jsxRuntimeExports.jsx(ns$1,{positions:hf,width:1,material:yf,arcType:Cesium$1.ArcType.RHUMB})}),jsxRuntimeExports.jsx(Ps$1,{backgroundColor:gd,light:Ru,mode:ef,msaaSamples:Zd,useDepthPicking:!1,useWebVR:!!((zf=o==null?void 0:o.scene)!=null&&zf.vr)||void 0,debugShowFramesPerSecond:!!((xf=o==null?void 0:o.debug)!=null&&xf.showFramesPerSecond),verticalExaggerationRelativeHeight:(Tf=o==null?void 0:o.scene)==null?void 0:Tf.verticalExaggerationRelativeHeight,verticalExaggeration:(Nf=o==null?void 0:o.scene)==null?void 0:Nf.verticalExaggeration}),jsxRuntimeExports.jsx($s$1,{show:((Uf=(Lf=o==null?void 0:o.sky)==null?void 0:Lf.skyBox)==null?void 0:Uf.show)??!0}),jsxRuntimeExports.jsx(Gr$1,{enabled:((Jf=(Hf=o==null?void 0:o.sky)==null?void 0:Hf.fog)==null?void 0:Jf.enabled)??!0,density:(wf=(Qf=o==null?void 0:o.sky)==null?void 0:Qf.fog)==null?void 0:wf.density}),jsxRuntimeExports.jsx(Rs$1,{show:((Df=(Vf=o==null?void 0:o.sky)==null?void 0:Vf.sun)==null?void 0:Df.show)??!0}),jsxRuntimeExports.jsx(qr$1,{show:((Yf=(Bf=o==null?void 0:o.sky)==null?void 0:Bf.moon)==null?void 0:Yf.show)??!0}),jsxRuntimeExports.jsx(Ds$1,{show:((_m=(qf=o==null?void 0:o.sky)==null?void 0:qf.skyAtmosphere)==null?void 0:_m.show)??!0,atmosphereLightIntensity:(of=(Rf=o==null?void 0:o.sky)==null?void 0:Rf.skyAtmosphere)==null?void 0:of.lightIntensity,saturationShift:(Mf=(vf=o==null?void 0:o.sky)==null?void 0:vf.skyAtmosphere)==null?void 0:Mf.saturationShift,brightnessShift:(Gf=(Ff=o==null?void 0:o.sky)==null?void 0:Ff.skyAtmosphere)==null?void 0:Gf.brightnessShift}),jsxRuntimeExports.jsx(Globe,{property:o,cesiumIonAccessToken:Nl,onTerrainProviderChange:tf}),jsxRuntimeExports.jsx(context.Provider,{value:pd,children:d?h:null}),jsxRuntimeExports.jsx(AmbientOcclusion,{...AMBIENT_OCCLUSION_QUALITY[((sp=(Kf=o==null?void 0:o.render)==null?void 0:Kf.ambientOcclusion)==null?void 0:sp.quality)||"low"],enabled:!!((pp=(lp=o==null?void 0:o.render)==null?void 0:lp.ambientOcclusion)!=null&&pp.enabled),intensity:((yp=(gp=o==null?void 0:o.render)==null?void 0:gp.ambientOcclusion)==null?void 0:yp.intensity)??100,outputType:(jm=($m=o==null?void 0:o.render)==null?void 0:$m.ambientOcclusion)!=null&&jm.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.50",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(l=>{var y,S;const[d]=l;let h,p;if(d.contentBoxSize){const P=Array.isArray(d.contentBoxSize)?d.contentBoxSize[0]:d.contentBoxSize;h=P.inlineSize,p=P.blockSize}else d.contentRect?(h=d.contentRect.width,p=d.contentRect.height):(h=(y=t.current)==null?void 0:y.clientWidth,p=(S=t.current)==null?void 0:S.clientHeight);s(P=>({width:h,height:p,isMobile:h?h<=viewportMobileMaxWidth:void 0,query:P.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:l,onInteractionModeChange:d,onZoomToLayer:h,onLayerDrop:p,onSketchTypeChangeProp:y},S){const P=React.useRef(null);React.useImperativeHandle(S,()=>P.current,[]);const L=React.useRef(null),N=useViewport({wrapperRef:L}),[z,W]=React.useState({}),[ai,mt]=React.useState(),[J,pi]=React.useState(),fa=React.useCallback(async(xf,Tf,Nf,Lf,Uf)=>{var wf,Vf,Df,Bf,Yf,qf,_m,Rf,of,vf,Mf,Ff;const Hf=((Vf=(wf=z.layer)==null?void 0:wf.layer)==null?void 0:Vf.type)==="simple"&&((Yf=(Bf=(Df=z.layer)==null?void 0:Df.layer)==null?void 0:Bf.data)==null?void 0:Yf.isSketchLayer);if(z.layerId===xf&&z.featureId===Tf&&!Hf)return;const Jf=await(Nf==null?void 0:Nf()),Qf=xf&&Tf?(Hf?(qf=Jf==null?void 0:Jf.features)==null?void 0:qf.find(Gf=>Gf.id===Tf):(of=(_m=P.current)==null?void 0:(Rf=_m.engine).findComputedFeatureById)==null?void 0:of.call(Rf,xf,Tf))??(Uf==null?void 0:Uf.feature):void 0;mt(xf&&Tf?(Ff=(vf=P.current)==null?void 0:(Mf=vf.engine).findFeatureById)==null?void 0:Ff.call(Mf,xf,Tf):void 0),pi(Qf),W(Gf=>Gf.layerId===xf&&Gf.featureId===Tf?Gf:{layerId:xf,featureId:Tf,layer:Jf,reason:Lf}),c==null||c(xf,Nf,Qf,Lf)},[z,c]),ma=React.useRef(void 0),[Sa,Ra]=useValue(t,l),[Vs,La]=React.useState(!1),Zs=React.useCallback(xf=>{La(!!xf)},[]),[Xs,Wa]=useValue(n||"default",d);React.useEffect(()=>{var xf,Tf;Xs==="default"&&((Tf=(xf=P==null?void 0:P.current)==null?void 0:xf.engine)==null||Tf.setCursor("auto"))},[Xs]);const ea=INTERACTION_MODES[Xs??"default"],ui=React.useRef(void 0),ba=React.useCallback(xf=>{ui.current=xf},[]),ms=React.useCallback(xf=>{var Tf;(Tf=ui.current)==null||Tf.call(ui,xf)},[]),yu=React.useRef(void 0),pu=React.useCallback(xf=>{yu.current=xf},[]),Nl=React.useCallback(xf=>{var Tf;(Tf=yu.current)==null||Tf.call(yu,xf)},[]),pd=React.useRef(void 0),Sc=React.useCallback(xf=>{pd.current=xf},[]),Ru=React.useCallback(xf=>{var Tf;(Tf=pd.current)==null||Tf.call(pd,xf)},[]),gd=React.useRef(void 0),Zd=React.useCallback(xf=>{gd.current=xf},[]),ef=React.useCallback(xf=>{var Tf;(Tf=gd.current)==null||Tf.call(gd,xf)},[]),df=React.useRef(void 0),hf=React.useCallback(xf=>{df.current=xf},[]),yf=React.useCallback(xf=>{var Tf;(Tf=df.current)==null||Tf.call(df,xf)},[]),pf=React.useRef(void 0),lf=React.useCallback(xf=>{pf.current=xf},[]),_f=React.useCallback(xf=>{var Tf;(Tf=pf.current)==null||Tf.call(pf,xf)},[]),Ef=React.useRef([]),Sf=React.useCallback(xf=>{Ef.current.push(xf)},[]),al=React.useCallback(xf=>{Ef.current.forEach(Tf=>Tf(xf))},[]),cf=React.useRef([]),tf=React.useCallback(xf=>{cf.current.push(xf)},[]),Xd=React.useCallback(xf=>{cf.current.forEach(Tf=>Tf(xf))},[]),Gd=React.useRef([]),nf=React.useCallback(xf=>{Gd.current.push(xf)},[]),uf=React.useCallback(xf=>{Gd.current.forEach(Tf=>Tf(xf))},[]),Vd=React.useRef([]),rf=React.useCallback(xf=>{Vd.current.push(xf)},[]),sf=React.useCallback((xf,Tf)=>{Vd.current.forEach(Nf=>Nf(xf)),y==null||y(xf,Tf)},[y]);React.useEffect(()=>{var xf,Tf;o&&((Tf=(xf=P.current)==null?void 0:xf.engine)==null||Tf.lookAtLayer(o),h==null||h(void 0))},[o,h]);const[mf,ff]=React.useState(!1),Cf=React.useCallback(()=>{ff(!0)},[]),bf=React.useCallback((xf,Tf,Nf)=>{var Hf;ff(!1);const Lf=(Hf=P.current)==null?void 0:Hf.layers.findById(xf),Uf=Lf!=null&&Lf.property.default.location?"default.location":Lf!=null&&Lf.property.default.position?"default.position":void 0;Nf&&Lf&&Lf.propertyId&&Uf&&(p==null||p(Lf.propertyId,Uf,Nf))},[p,P]),If=React.useMemo(()=>({interactionMode:Xs,selectedLayer:z,selectedComputedFeature:J,viewport:N,handleCameraForceHorizontalRollChange:Zs,handleInteractionModeChange:Wa,onSketchPluginFeatureCreate:Sf,onSketchPluginFeatureUpdate:tf,onSketchPluginFeatureDelete:nf,onSketchTypeChange:rf,onLayerVisibility:pu,onLayerLoad:Sc,onLayerEdit:ba,onLayerSelectWithRectStart:Zd,onLayerSelectWithRectMove:hf,onLayerSelectWithRectEnd:lf}),[Xs,z,J,N,Wa,Zs,ba,Sf,tf,nf,rf,pu,Sc,Zd,hf,lf]),zf=React.useMemo(()=>({position:"relative",width:"100%",height:"100%",overflow:"hidden"}),[]);return useCoreAPI({viewerProperty:s}),{mapRef:P,wrapperRef:L,selectedFeature:ai,camera:Sa,featureFlags:ea,isLayerDragging:mf,timelineManagerRef:ma,cameraForceHorizontalRoll:Vs,coreContextValue:If,containerStyle:zf,overriddenInteractionMode:Xs,handleLayerSelect:fa,handleLayerDrag:Cf,handleLayerDrop:bf,handleLayerEdit:ms,handleCameraChange:Ra,handleInteractionModeChange:Wa,handleSketchPluginFeatureCreate:al,handleSketchPluginFeatureUpdate:Xd,handleSketchPluginFeatureDelete:uf,handleSketchTypeChange:sf,handleLayerVisibility:Nl,handleLayerLoad:Ru,handleLayerSelectWithRectStart:ef,handleLayerSelectWithRectMove:yf,handleLayerSelectWithRectEnd:_f}}function useValue(t,n){const[o,s]=React.useState(t),c=React.useCallback(l=>{l&&(s(l),n==null||n(l))},[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:l,small:d,ready:h,hiddenLayers:p,camera:y,time:S,interactionMode:P,shouldRender:L,meta:N,displayCredits:z=!0,style:W,zoomedLayerId:ai,children:mt,onLayerDrop:J,onLayerSelect:pi,onCameraChange:fa,onZoomToLayer:ma,onInteractionModeChange:Sa,onMount:Ra,onSketchTypeChangeProp:Vs,onSketchFeatureCreate:La,onSketchFeatureUpdate:Zs,onSketchFeatureDelete:Xs,onAPIReady:Wa,onCreditsUpdate:ea},ui)=>{const{mapRef:ba,wrapperRef:ms,selectedFeature:yu,camera:pu,featureFlags:Nl,isLayerDragging:pd,timelineManagerRef:Sc,cameraForceHorizontalRoll:Ru,coreContextValue:gd,containerStyle:Zd,overriddenInteractionMode:ef,handleLayerSelect:df,handleLayerDrag:hf,handleLayerDrop:yf,handleLayerEdit:pf,handleCameraChange:lf,handleInteractionModeChange:_f,handleSketchPluginFeatureCreate:Ef,handleSketchPluginFeatureUpdate:Sf,handleSketchPluginFeatureDelete:al,handleSketchTypeChange:cf,handleLayerVisibility:tf,handleLayerLoad:Xd,handleLayerSelectWithRectStart:Gd,handleLayerSelectWithRectMove:nf,handleLayerSelectWithRectEnd:uf}=useHooks({camera:y,interactionMode:P,zoomedLayerId:ai,viewerProperty:s,onLayerSelect:pi,onCameraChange:fa,onZoomToLayer:ma,onLayerDrop:J,onInteractionModeChange:Sa,onSketchTypeChangeProp:Vs},ui);return jsxRuntimeExports.jsx(ErrorBoundary,{FallbackComponent:Error$1,children:jsxRuntimeExports.jsx(VisualizerProvider,{mapRef:ba,children:jsxRuntimeExports.jsxs("div",{ref:ms,style:Zd,children:[jsxRuntimeExports.jsx(Map$1,{ref:ba,isBuilt:n,isEditable:o,engine:t,layers:c,engines,camera:pu,cameraForceHorizontalRoll:Ru,clusters:l,hiddenLayers:p,isLayerDragging:pd,isLayerDraggable:o,meta:N,displayCredits:z,style:W,featureFlags:Nl,shouldRender:L,property:s,time:S,small:d,ready:h,timelineManagerRef:Sc,interactionMode:ef,selectedFeature:yu,onCameraChange:lf,onLayerDrag:hf,onLayerDrop:yf,onLayerSelect:df,onLayerEdit:pf,overrideInteractionMode:_f,onSketchFeatureCreate:La,onSketchPluginFeatureCreate:Ef,onSketchFeatureUpdate:Zs,onSketchPluginFeatureUpdate:Sf,onSketchFeatureDelete:Xs,onSketchPluginFeatureDelete:al,onSketchTypeChange:cf,onMount:Ra,onLayerVisibility:tf,onLayerLoad:Xd,onLayerSelectWithRectStart:Gd,onLayerSelectWithRectMove:nf,onLayerSelectWithRectEnd:uf,onAPIReady:Wa,onCreditsUpdate:ea}),jsxRuntimeExports.jsx(coreContext.Provider,{value:gd,children:mt})]})})})}));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,l,d,h=t.length;if(h%4>0)throw new Error("Invalid string. Length must be a multiple of 4");l=t[h-2]==="="?2:t[h-1]==="="?1:0,d=new Arr(h*3/4-l),s=l>0?h-4:h;var p=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)],d[p++]=c>>16&255,d[p++]=c>>8&255,d[p++]=c&255;return l===2?(c=revLookup[t.charCodeAt(n)]<<2|revLookup[t.charCodeAt(n+1)]>>4,d[p++]=c&255):l===1&&(c=revLookup[t.charCodeAt(n)]<<10|revLookup[t.charCodeAt(n+1)]<<4|revLookup[t.charCodeAt(n+2)]>>2,d[p++]=c>>8&255,d[p++]=c&255),d}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=[],l=n;l<o;l+=3)s=(t[l]<<16)+(t[l+1]<<8)+t[l+2],c.push(tripletToBase64(s));return c.join("")}function fromByteArray(t){inited||init();for(var n,o=t.length,s=o%3,c="",l=[],d=16383,h=0,p=o-s;h<p;h+=d)l.push(encodeChunk(t,h,h+d>p?p:h+d));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+="="),l.push(c),l.join("")}function read(t,n,o,s,c){var l,d,h=c*8-s-1,p=(1<<h)-1,y=p>>1,S=-7,P=o?c-1:0,L=o?-1:1,N=t[n+P];for(P+=L,l=N&(1<<-S)-1,N>>=-S,S+=h;S>0;l=l*256+t[n+P],P+=L,S-=8);for(d=l&(1<<-S)-1,l>>=-S,S+=s;S>0;d=d*256+t[n+P],P+=L,S-=8);if(l===0)l=1-y;else{if(l===p)return d?NaN:(N?-1:1)*(1/0);d=d+Math.pow(2,s),l=l-y}return(N?-1:1)*d*Math.pow(2,l-s)}function write(t,n,o,s,c,l){var d,h,p,y=l*8-c-1,S=(1<<y)-1,P=S>>1,L=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,N=s?0:l-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?(h=isNaN(n)?1:0,d=S):(d=Math.floor(Math.log(n)/Math.LN2),n*(p=Math.pow(2,-d))<1&&(d--,p*=2),d+P>=1?n+=L/p:n+=L*Math.pow(2,1-P),n*p>=2&&(d++,p/=2),d+P>=S?(h=0,d=S):d+P>=1?(h=(n*p-1)*Math.pow(2,c),d=d+P):(h=n*Math.pow(2,P-1)*Math.pow(2,c),d=0));c>=8;t[o+N]=h&255,N+=z,h/=256,c-=8);for(d=d<<c|h,y+=c;y>0;t[o+N]=d&255,N+=z,d/=256,y-=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,l=0,d=Math.min(s,c);l<d;++l)if(n[l]!==o[l]){s=n[l],c=o[l];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),l=0;for(s=0;s<n.length;++s){var d=n[s];if(!internalIsBuffer(d))throw new TypeError('"list" argument must be an Array of Buffers');d.copy(c,l),l+=d.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,l){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),l===void 0&&(l=this.length),o<0||s>n.length||c<0||l>this.length)throw new RangeError("out of range index");if(c>=l&&o>=s)return 0;if(c>=l)return-1;if(o>=s)return 1;if(o>>>=0,s>>>=0,c>>>=0,l>>>=0,this===n)return 0;for(var d=l-c,h=s-o,p=Math.min(d,h),y=this.slice(c,l),S=n.slice(o,s),P=0;P<p;++P)if(y[P]!==S[P]){d=y[P],h=S[P];break}return d<h?-1:h<d?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 l=1,d=t.length,h=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;l=2,d/=2,h/=2,o/=2}function p(N,z){return l===1?N[z]:N.readUInt16BE(z*l)}var y;if(c){var S=-1;for(y=o;y<d;y++)if(p(t,y)===p(n,S===-1?0:y-S)){if(S===-1&&(S=y),y-S+1===h)return S*l}else S!==-1&&(y-=y-S),S=-1}else for(o+h>d&&(o=d-h),y=o;y>=0;y--){for(var P=!0,L=0;L<h;L++)if(p(t,y+L)!==p(n,L)){P=!1;break}if(P)return y}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 l=n.length;if(l%2!==0)throw new TypeError("Invalid hex string");s>l/2&&(s=l/2);for(var d=0;d<s;++d){var h=parseInt(n.substr(d*2,2),16);if(isNaN(h))return d;t[o+d]=h}return d}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 l=this.length-o;if((s===void 0||s>l)&&(s=l),n.length>0&&(s<0||o<0)||o>this.length)throw new RangeError("Attempt to write outside buffer bounds");c||(c="utf8");for(var d=!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(d)throw new TypeError("Unknown encoding: "+c);c=(""+c).toLowerCase(),d=!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 l=t[c],d=null,h=l>239?4:l>223?3:l>191?2:1;if(c+h<=o){var p,y,S,P;switch(h){case 1:l<128&&(d=l);break;case 2:p=t[c+1],(p&192)===128&&(P=(l&31)<<6|p&63,P>127&&(d=P));break;case 3:p=t[c+1],y=t[c+2],(p&192)===128&&(y&192)===128&&(P=(l&15)<<12|(p&63)<<6|y&63,P>2047&&(P<55296||P>57343)&&(d=P));break;case 4:p=t[c+1],y=t[c+2],S=t[c+3],(p&192)===128&&(y&192)===128&&(S&192)===128&&(P=(l&15)<<18|(p&63)<<12|(y&63)<<6|S&63,P>65535&&P<1114112&&(d=P))}}d===null?(d=65533,h=1):d>65535&&(d-=65536,s.push(d>>>10&1023|55296),d=56320|d&1023),s.push(d),c+=h}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="",l=n;l<o;++l)c+=toHex(t[l]);return c}function utf16leSlice(t,n,o){for(var s=t.slice(n,o),c="",l=0;l<s.length;l+=2)c+=String.fromCharCode(s[l]+s[l+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 l=o-n;c=new Buffer$1(l,void 0);for(var d=0;d<l;++d)c[d]=this[d+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],l=1,d=0;++d<o&&(l*=256);)c+=this[n+d]*l;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],l=1;o>0&&(l*=256);)c+=this[n+--o]*l;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],l=1,d=0;++d<o&&(l*=256);)c+=this[n+d]*l;return l*=128,c>=l&&(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,l=1,d=this[n+--c];c>0&&(l*=256);)d+=this[n+--c]*l;return l*=128,d>=l&&(d-=Math.pow(2,8*o)),d},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,l){if(!internalIsBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>c||n<l)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 l=Math.pow(2,8*s)-1;checkInt(this,n,o,s,l,0)}var d=1,h=0;for(this[o]=n&255;++h<s&&(d*=256);)this[o+h]=n/d&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 l=Math.pow(2,8*s)-1;checkInt(this,n,o,s,l,0)}var d=s-1,h=1;for(this[o+d]=n&255;--d>=0&&(h*=256);)this[o+d]=n/h&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,l=Math.min(t.length-o,2);c<l;++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,l=Math.min(t.length-o,4);c<l;++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 l=Math.pow(2,8*s-1);checkInt(this,n,o,s,l-1,-l)}var d=0,h=1,p=0;for(this[o]=n&255;++d<s&&(h*=256);)n<0&&p===0&&this[o+d-1]!==0&&(p=1),this[o+d]=(n/h>>0)-p&255;return o+s},Buffer$1.prototype.writeIntBE=function t(n,o,s,c){if(n=+n,o=o|0,!c){var l=Math.pow(2,8*s-1);checkInt(this,n,o,s,l-1,-l)}var d=s-1,h=1,p=0;for(this[o+d]=n&255;--d>=0&&(h*=256);)n<0&&p===0&&this[o+d+1]!==0&&(p=1),this[o+d]=(n/h>>0)-p&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,l){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 l=c-s,d;if(this===n&&s<o&&o<c)for(d=l-1;d>=0;--d)n[d+o]=this[d+s];else if(l<1e3||!Buffer$1.TYPED_ARRAY_SUPPORT)for(d=0;d<l;++d)n[d+o]=this[d+s];else Uint8Array.prototype.set.call(n,this.subarray(s,s+l),o);return l},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 l=n.charCodeAt(0);l<256&&(n=l)}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 d;if(typeof n=="number")for(d=o;d<s;++d)this[d]=n;else{var h=internalIsBuffer(n)?n:utf8ToBytes(new Buffer$1(n,c).toString()),p=h.length;for(d=0;d<s-o;++d)this[d+o]=h[d%p]}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,l=[],d=0;d<s;++d){if(o=t.charCodeAt(d),o>55295&&o<57344){if(!c){if(o>56319){(n-=3)>-1&&l.push(239,191,189);continue}else if(d+1===s){(n-=3)>-1&&l.push(239,191,189);continue}c=o;continue}if(o<56320){(n-=3)>-1&&l.push(239,191,189),c=o;continue}o=(c-55296<<10|o-56320)+65536}else c&&(n-=3)>-1&&l.push(239,191,189);if(c=null,o<128){if((n-=1)<0)break;l.push(o)}else if(o<2048){if((n-=2)<0)break;l.push(o>>6|192,o&63|128)}else if(o<65536){if((n-=3)<0)break;l.push(o>>12|224,o>>6&63|128,o&63|128)}else if(o<1114112){if((n-=4)<0)break;l.push(o>>18|240,o>>12&63|128,o>>6&63|128,o&63|128)}else throw new Error("Invalid code point")}return l}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,l=[],d=0;d<t.length&&!((n-=2)<0);++d)o=t.charCodeAt(d),s=o>>8,c=o%256,l.push(c),l.push(s);return l}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),l=0;l<s;++l)c[l].call(o)}function emitOne(t,n,o,s){if(n)t.call(o,s);else for(var c=t.length,l=arrayClone(t,c),d=0;d<c;++d)l[d].call(o,s)}function emitTwo(t,n,o,s,c){if(n)t.call(o,s,c);else for(var l=t.length,d=arrayClone(t,l),h=0;h<l;++h)d[h].call(o,s,c)}function emitThree(t,n,o,s,c,l){if(n)t.call(o,s,c,l);else for(var d=t.length,h=arrayClone(t,d),p=0;p<d;++p)h[p].call(o,s,c,l)}function emitMany(t,n,o,s){if(n)t.apply(o,s);else for(var c=t.length,l=arrayClone(t,c),d=0;d<c;++d)l[d].apply(o,s)}EventEmitter.prototype.emit=function t(n){var o,s,c,l,d,h,p,y=n==="error";if(h=this._events,h)y=y&&h.error==null;else if(!y)return!1;if(p=this.domain,y){if(o=arguments[1],p)o||(o=new Error('Uncaught, unspecified "error" event')),o.domainEmitter=this,o.domain=p,o.domainThrown=!1,p.emit("error",o);else{if(o instanceof Error)throw o;var S=new Error('Uncaught, unspecified "error" event. ('+o+")");throw S.context=o,S}return!1}if(s=h[n],!s)return!1;var P=typeof s=="function";switch(c=arguments.length,c){case 1:emitNone(s,P,this);break;case 2:emitOne(s,P,this,arguments[1]);break;case 3:emitTwo(s,P,this,arguments[1],arguments[2]);break;case 4:emitThree(s,P,this,arguments[1],arguments[2],arguments[3]);break;default:for(l=new Array(c-1),d=1;d<c;d++)l[d-1]=arguments[d];emitMany(s,P,this,l)}return!0};function _addListener(t,n,o,s){var c,l,d;if(typeof o!="function")throw new TypeError('"listener" argument must be a function');if(l=t._events,l?(l.newListener&&(t.emit("newListener",n,o.listener?o.listener:o),l=t._events),d=l[n]):(l=t._events=new EventHandlers,t._eventsCount=0),!d)d=l[n]=o,++t._eventsCount;else if(typeof d=="function"?d=l[n]=s?[o,d]:[d,o]:s?d.unshift(o):d.push(o),!d.warned&&(c=$getMaxListeners(t),c&&c>0&&d.length>c)){d.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+d.length+" "+n+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=t,h.type=n,h.count=d.length,emitWarning(h)}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,l,d,h;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(l=-1,d=s.length;d-- >0;)if(s[d]===o||s[d].listener&&s[d].listener===o){h=s[d].listener,l=d;break}if(l<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,l);c.removeListener&&this.emit("removeListener",n,h||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),l=0,d;l<c.length;++l)d=c[l],d!=="removeListener"&&this.removeAllListeners(d);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&&currentQueue[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,l=String(t).replace(formatRegExp,function(h){if(h==="%%")return"%";if(o>=c)return h;switch(h){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 h}}),d=s[o];o<c;d=s[++o])isNull(d)||!isObject(d)?l+=" "+d:l+=" "+inspect(d);return l}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 l=Object.keys(n),d=arrayToHash(l);if(t.showHidden&&(l=Object.getOwnPropertyNames(n)),isError(n)&&(l.indexOf("message")>=0||l.indexOf("description")>=0))return formatError(n);if(l.length===0){if(isFunction(n)){var h=n.name?": "+n.name:"";return t.stylize("[Function"+h+"]","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 p="",y=!1,S=["{","}"];if(isArray(n)&&(y=!0,S=["[","]"]),isFunction(n)){var P=n.name?": "+n.name:"";p=" [Function"+P+"]"}if(isRegExp(n)&&(p=" "+RegExp.prototype.toString.call(n)),isDate(n)&&(p=" "+Date.prototype.toUTCString.call(n)),isError(n)&&(p=" "+formatError(n)),l.length===0&&(!y||n.length==0))return S[0]+p+S[1];if(o<0)return isRegExp(n)?t.stylize(RegExp.prototype.toString.call(n),"regexp"):t.stylize("[Object]","special");t.seen.push(n);var L;return y?L=formatArray(t,n,o,d,l):L=l.map(function(N){return formatProperty(t,n,o,d,N,y)}),t.seen.pop(),reduceToSingleString(L,p,S)}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 l=[],d=0,h=n.length;d<h;++d)hasOwnProperty(n,String(d))?l.push(formatProperty(t,n,o,s,String(d),!0)):l.push("");return c.forEach(function(p){p.match(/^\d+$/)||l.push(formatProperty(t,n,o,s,p,!0))}),l}function formatProperty(t,n,o,s,c,l){var d,h,p;if(p=Object.getOwnPropertyDescriptor(n,c)||{value:n[c]},p.get?p.set?h=t.stylize("[Getter/Setter]","special"):h=t.stylize("[Getter]","special"):p.set&&(h=t.stylize("[Setter]","special")),hasOwnProperty(s,c)||(d="["+c+"]"),h||(t.seen.indexOf(p.value)<0?(isNull(o)?h=formatValue(t,p.value,null):h=formatValue(t,p.value,o-1),h.indexOf(`
6747
+ `,uniforms:{...pick(S,["color","frustumLength","blackPoint","whitePoint","gamma"]),globeDepthTexture:()=>(p==null?void 0:p())??L._depthTexture}});if(c){const N=createBilateralFilterStage({prefix:t,outputType:d,useGlobeDepth:h,getGlobeDepthTexture:p,uniforms:{textureScale:n,...pick(S,["frustumLength","normalExponent","depthExponent"])}}),z=new Cesium$1.PostProcessStageComposite({name:`${t}_ambient_occlusion_generate_and_filter`,stages:[P,N]});return L.uniforms.ambientOcclusionTexture=z.name,new Cesium$1.PostProcessStageComposite({name:`${t}_ambient_occlusion`,stages:[z,L],inputPreviousStageTexture:!1,uniforms:createUniforms([{stage:P,uniforms:["intensity","maxRadius","bias","frustumLength","focalLength"]},{stage:N,uniforms:["frustumLength","normalExponent","depthExponent"]},{stage:L,uniforms:["color","blackPoint","whitePoint","gamma"]}])})}else return L.uniforms.ambientOcclusionTexture=P.name,new Cesium$1.PostProcessStageComposite({name:`${t}_ambient_occlusion`,stages:[P,L],inputPreviousStageTexture:!1,uniforms:createUniforms([{stage:P,uniforms:["intensity","maxRadius","bias","frustumLength","focalLength"]},{stage:L,uniforms:["color","blackPoint","whitePoint","gamma"]}])})}const AmbientOcclusionStage=({enabled:t=!0,textureScale:n,directions:o,steps:s,denoise:c,accurateNormalReconstruction:l,outputType:d,useGlobeDepth:h,...p})=>{const{viewer:y}=ae$1(),S=y==null?void 0:y.scene,P=useInstance({owner:S==null?void 0:S.postProcessStages,keys:[n,s,o,c,l,d,h],create:()=>{const L=createAmbientOcclusionStage({textureScale:n,steps:s,directions:o,denoise:c,accurateNormalReconstruction:l,outputType:d,useGlobeDepth:h,getGlobeDepthTexture:()=>S.context.uniformState.globeDepthTexture,uniforms:p});return L.enabled=t,L},transferOwnership:(L,N)=>(N==null||N.add(L),()=>{N==null||N.remove(L)})});return P.enabled=t,Object.assign(P.uniforms,p),S==null||S.requestRender(),usePreRender(()=>{const L=S==null?void 0:S.camera.frustum;if(L instanceof Cesium$1.PerspectiveFrustum){const N=1/Math.tan(L.fovy/2);P.uniforms.focalLength.x=N*L.aspectRatio,P.uniforms.focalLength.y=N}}),null},AmbientOcclusion=t=>{const n=ae$1(),[o,s]=React.useState(!1);return usePreRender(()=>{const c=n.scene;s(!(c!=null&&c.globe.depthTestAgainstTerrain));const{globeHeight:l}=c;if(!c||l==null)return;const d=c.camera.positionCartographic.height-l,h=c==null?void 0:c.camera.frustum;h instanceof Cesium$1.PerspectiveFrustum&&(c.camera.frustum.near=Cesium$1.Math.clamp(d-1,1,5)/Math.tan(h.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:l,isExtrudedControlPoint:d,handleControlPointMouseEvent:h})=>{const p=React.useRef(t);p.current=t;const y=useConstant$2(()=>new CallbackProperty((N,z)=>"getValue"in p.current?p.current.getValue(N,z):p.current,!1)),S=React.useMemo(()=>({position:y,billboard:{image:s?l?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,y,l,s,c]),P=React.useCallback(()=>{h==null||h(o,!!d,"mousedown")},[o,d,h]),L=React.useCallback(()=>{h==null||h(o,!!d,"click")},[o,d,h]);return jsxRuntimeExports.jsx(Lr$1,{...S,onMouseDown:P,onClick:L})};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}=ae$1(),c=s==null?void 0:s.scene,l=s==null?void 0:s.entities,d=t??l,[h,p]=React.useState(()=>new Entity$1(n));return React.useEffect(()=>{p(new Entity$1(n))},[n.id]),React.useEffect(()=>(d==null||d.add(h),()=>{d==null||d.remove(h),c==null||c.requestRender()}),[c,d,h]),React.useEffect(()=>assignForwardedRef(o,h),[o,h]),Object.assign(h,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,l=!1;const d=new WeakSet,h={schedule:(p,y=!1,S=!1)=>{const P=S&&c,L=P?n:o;return y&&d.add(p),L.add(p)&&P&&c&&(s=n.order.length),p},cancel:p=>{o.remove(p),d.delete(p)},process:p=>{if(c){l=!0;return}if(c=!0,[n,o]=[o,n],o.clear(),s=n.order.length,s)for(let y=0;y<s;y++){const S=n.order[y];d.has(S)&&(h.schedule(S),t()),S(p)}c=!1,l&&(l=!1,h.process(p))}};return h}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},l=stepsOrder.reduce((P,L)=>(P[L]=createRenderStep(()=>o=!0),P),{}),d=P=>{l[P].process(c)},h=()=>{const P=performance.now();o=!1,c.delta=s?1e3/60:Math.max(Math.min(P-c.timestamp,maxElapsed),1),c.timestamp=P,c.isProcessing=!0,stepsOrder.forEach(d),c.isProcessing=!1,o&&n&&(s=!1,t(h))},p=()=>{o=!0,s=!0,c.isProcessing||t(h)};return{schedule:stepsOrder.reduce((P,L)=>{const N=l[L];return P[L]=(z,W=!1,ai=!1)=>(o||p(),N.schedule(z,W,ai)),P},{}),cancel:P=>stepsOrder.forEach(L=>l[L].cancel(P)),state:c,steps:l}}const{schedule:microtask,cancel:cancelMicrotask}=createRenderBatcher(queueMicrotask,!1);function useVisualElement(t,n,o,s){const{visualElement:c}=React.useContext(MotionContext),l=React.useContext(LazyContext),d=React.useContext(PresenceContext),h=React.useContext(MotionConfigContext).reducedMotion,p=React.useRef();s=s||l.renderer,!p.current&&s&&(p.current=s(t,{visualState:n,parent:c,props:o,presenceContext:d,blockInitialAnimation:d?d.initial===!1:!1,reducedMotionConfig:h}));const y=p.current;React.useInsertionEffect(()=>{y&&y.update(o,d)});const S=React.useRef(!!(o[optimizedAppearDataAttribute]&&!window.HandoffComplete));return useIsomorphicLayoutEffect$1(()=>{y&&(microtask.postRender(y.render),S.current&&y.animationState&&y.animationState.animateChanges())}),React.useEffect(()=>{y&&(y.updateFeatures(),!S.current&&y.animationState&&y.animationState.animateChanges(),S.current&&(S.current=!1,window.HandoffComplete=!0))}),y}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 l(h,p){let y;const S={...React.useContext(MotionConfigContext),...h,layoutId:useLayoutId(h)},{isStatic:P}=S,L=useCreateMotionContext(h),N=s(h,P);if(!P&&isBrowser){L.visualElement=useVisualElement(c,N,S,n);const z=React.useContext(SwitchLayoutGroupContext),W=React.useContext(LazyContext).strict;L.visualElement&&(y=L.visualElement.loadFeatures(S,W,t,z))}return React__namespace.createElement(MotionContext.Provider,{value:L},y&&L.visualElement?React__namespace.createElement(y,{visualElement:L.visualElement,...S}):null,o(c,h,useMotionRef(N,L.visualElement,p),N,P,L.visualElement))}const d=React.forwardRef(l);return d[motionComponentSymbol]=c,d}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 l="";for(let d=0;d<numTransforms;d++){const h=transformPropOrder[d];if(t[h]!==void 0){const p=translateAlias[h]||h;l+=`${p}(${t[h]}) `}}return n&&!t.z&&(l+="translateZ(0)"),l=l.trim(),c?l=c(t,s?"":l):o&&s&&(l="none"),l}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:l,transform:d,transformOrigin:h}=t;let p=!1,y=!1,S=!0;for(const P in n){const L=n[P];if(isCSSVariableName(P)){l[P]=L;continue}const N=numberValueTypes[P],z=getValueAsType(L,N);if(transformProps.has(P)){if(p=!0,d[P]=z,!S)continue;L!==(N.default||0)&&(S=!1)}else P.startsWith("origin")?(y=!0,h[P]=z):c[P]=z}if(n.transform||(p||s?c.transform=buildTransform(t.transform,o,S,s):c.transform&&(c.transform="none")),y){const{originX:P="50%",originY:L="50%",originZ:N=0}=h;c.transformOrigin=`${P} ${L} ${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 l=c?dashKeys:camelKeys;t[l.offset]=px.transform(-s);const d=px.transform(n),h=px.transform(o);t[l.array]=`${d} ${h}`}function buildSVGAttrs(t,{attrX:n,attrY:o,attrScale:s,originX:c,originY:l,pathLength:d,pathSpacing:h=1,pathOffset:p=0,...y},S,P,L){if(buildHTMLStyles(t,y,S,L),P){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||l!==void 0||z.transform)&&(z.transformOrigin=calcSVGTransformOrigin(W,c!==void 0?c:.5,l!==void 0?l:.5)),n!==void 0&&(N.x=n),o!==void 0&&(N.y=o),s!==void 0&&(N.scale=s),d!==void 0&&buildSVGPath(N,d,h,p,!1)}const createSvgRenderState=()=>({...createHtmlRenderState(),attrs:{}}),isSVGTag=t=>typeof t=="string"&&t.toLowerCase()==="svg";function useSVGProps(t,n,o,s){const c=React.useMemo(()=>{const l=createSvgRenderState();return buildSVGAttrs(l,n,{enableHardwareAcceleration:!1},isSVGTag(s),t.transformTemplate),{...l.attrs,style:{...l.style}}},[n]);if(t.style){const l={};copyRawValuesOnly(l,t.style,t),c.style={...l,...c.style}}return c}function createUseRender(t=!1){return(o,s,c,{latestValues:l},d)=>{const p=(isSVGComponent(o)?useSVGProps:useHTMLProps)(s,l,d,o),y=filterProps(s,typeof o=="string",t),S=o!==React.Fragment?{...y,...p,ref:c}:{},{children:P}=s,L=React.useMemo(()=>isMotionValue(P)?P.get():P,[P]);return React.createElement(o,{...S,children:L})}}function renderHTML(t,{style:n,vars:o},s,c){Object.assign(t.style,n,c&&c.getProjectionStyles(s));for(const l in o)t.style.setProperty(l,o[l])}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,l={};for(const d in c)(isMotionValue(c[d])||n.style&&isMotionValue(n.style[d])||isForcedMotionValue(d,t)||((s=o==null?void 0:o.getValue(d))===null||s===void 0?void 0:s.liveStyle)!==void 0)&&(l[d]=c[d]);return l}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 l=transformPropOrder.indexOf(c)!==-1?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c;s[l]=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,l){const d={latestValues:makeLatestValues(s,c,l,t),renderState:n()};return o&&(d.mount=h=>o(s,h,d)),d}const makeUseVisualState=t=>(n,o)=>{const s=React.useContext(MotionContext),c=React.useContext(PresenceContext),l=()=>makeState(t,n,s,c);return o?l():useConstant(l)};function makeLatestValues(t,n,o,s){const c={},l=s(t,{});for(const L in l)c[L]=resolveMotionValue(l[L]);let{initial:d,animate:h}=t;const p=isControllingVariants(t),y=isVariantNode(t);n&&y&&!p&&t.inherit!==!1&&(d===void 0&&(d=n.initial),h===void 0&&(h=n.animate));let S=o?o.initial===!1:!1;S=S||d===!1;const P=S?h:d;return P&&typeof P!="boolean"&&!isAnimationControls(P)&&(Array.isArray(P)?P:[P]).forEach(N=>{const z=resolveVariantFromProps(t,N);if(!z)return;const{transitionEnd:W,transition:ai,...mt}=z;for(const J in mt){let pi=mt[J];if(Array.isArray(pi)){const fa=S?pi.length-1:0;pi=pi[fa]}pi!==null&&(c[J]=pi)}for(const J in W)c[J]=W[J]}),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=(l,d)=>{if(l.pointerType==="touch"||isDragActive())return;const h=t.getProps();t.animationState&&h.whileHover&&t.animationState.setActive("whileHover",n),h[s]&&h[s](l,d)};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(),l=addPointerEvent(window,"pointerup",(h,p)=>{if(!this.checkPressEnd())return;const{onTap:y,onTapCancel:S,globalTapTarget:P}=this.node.getProps();!P&&!isNodeOrChild(this.node.current,h.target)?S&&S(h,p):y&&y(h,p)},{passive:!(s.onTap||s.onPointerUp)}),d=addPointerEvent(window,"pointercancel",(h,p)=>this.cancelPress(h,p),{passive:!(s.onTapCancel||s.onPointerCancel)});this.removeEndListeners=pipe(l,d),this.startPress(n,o)},this.startAccessiblePress=()=>{const n=l=>{if(l.key!=="Enter"||this.isPressing)return;const d=h=>{h.key!=="Enter"||!this.checkPressEnd()||fireSyntheticPointerEvent("up",(p,y)=>{const{onTap:S}=this.node.getProps();S&&S(p,y)})};this.removeEndListeners(),this.removeEndListeners=addDomEvent(this.node.current,"keyup",d),fireSyntheticPointerEvent("down",(h,p)=>{this.startPress(h,p)})},o=addDomEvent(this.node.current,"keydown",n),s=()=>{this.isPressing&&fireSyntheticPointerEvent("cancel",(l,d)=>this.cancelPress(l,d))},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:l}=n,d={root:o?o.current:void 0,rootMargin:s,threshold:typeof c=="number"?c:thresholdNames[c]},h=p=>{const{isIntersecting:y}=p;if(this.isInView===y||(this.isInView=y,l&&!y&&this.hasEnteredView))return;y&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",y);const{onViewportEnter:S,onViewportLeave:P}=this.node.getProps(),L=y?S:P;L&&L(p)};return observeIntersection(this.node.current,d,h)}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:l,repeatType:d,repeatDelay:h,from:p,elapsed:y,...S}){return!!Object.keys(S).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),l=n&&o!=="loop"&&n%2===1?0:c.length-1;return!l||s===void 0?c[l]: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 l=window.getComputedStyle(n).getPropertyValue(s);if(l){const d=l.trim();return isNumericalString(d)?parseFloat(d):d}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 l=s.match(/^matrix\((.+)\)$/u);return l?getPosFromMatrix(l[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,l,d=!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=l,this.isAsync=d}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 l=0;l<n.length;l++)if(n[l]===null)if(l===0){const d=c==null?void 0:c.get(),h=n[n.length-1];if(d!==void 0)n[0]=d;else if(s&&o){const p=s.readValue(o,h);p!=null&&(n[0]=p)}n[0]===void 0&&(n[0]=h),c&&d===void 0&&c.set(n[0])}else n[l]=n[l-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,l,d,h]=s.match(floatRegex);return{[t]:parseFloat(c),[n]:parseFloat(l),[o]:parseFloat(d),alpha:h!==void 0?parseFloat(h):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 l=0;const h=n.replace(complexRegex,p=>(color.test(p)?(s.color.push(l),c.push(COLOR_TOKEN),o.push(color.parse(p))):p.startsWith(VAR_FUNCTION_TOKEN)?(s.var.push(l),c.push(VAR_TOKEN),o.push(p)):(s.number.push(l),c.push(NUMBER_TOKEN),o.push(parseFloat(p))),++l,SPLIT_TOKEN)).split(SPLIT_TOKEN);return{values:o,split:h,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 l="";for(let d=0;d<s;d++)if(l+=n[d],c[d]!==void 0){const h=o[d];h===NUMBER_TOKEN?l+=sanitize(c[d]):h===COLOR_TOKEN?l+=color.transform(c[d]):l+=c[d]}return l}}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 l=maxDefaults.has(n)?1:0;return s!==o&&(l*=100),n+"("+l+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 l of n)t[l]=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 p=0;p<n.length;p++){const y=n[p];if(typeof y=="string"&&isCSSVariableToken(y)){const S=getVariableValue(y,o.current);S!==void 0&&(n[p]=S)}}if(!positionalKeys.has(s)||n.length!==2)return this.resolveNoneKeyframes();const[c,l]=n,d=findDimensionValueType(c),h=findDimensionValueType(l);if(d!==h)if(isNumOrPxType(d)&&isNumOrPxType(h))for(let p=0;p<n.length;p++){const y=n[p];typeof y=="string"&&(n[p]=parseFloat(y))}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 l=o.getValue(s);l&&l.jump(this.measuredOrigin,!1);const d=c.length-1,h=c[d];c[d]=positionalValues[s](o.measureViewportBox(),window.getComputedStyle(o.current)),h!==null&&(this.finalKeyframe=h),!((n=this.removedTransforms)===null||n===void 0)&&n.length&&this.removedTransforms.forEach(([p,y])=>{o.getValue(p).set(y)}),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 l=t[t.length-1],d=isAnimatable(c,n),h=isAnimatable(l,n);return warning(d===h,`You are trying to animate ${n} from "${c}" to "${l}". ${c} is not an animatable value - to enable this animation set ${c} to a value animatable to ${l} via the \`style\` property.`),!d||!h?!1:hasKeyframesChanged(t)||o==="spring"&&s}class BaseAnimation{constructor({autoplay:n=!0,delay:o=0,type:s="keyframes",repeat:c=0,repeatDelay:l=0,repeatType:d="loop",...h}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.options={autoplay:n,delay:o,type:s,repeat:c,repeatDelay:l,repeatType:d,...h},this.updateFinishedPromise()}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&flushKeyframeResolvers(),this._resolved}onKeyframesResolved(n,o){this.hasAttemptedResolve=!0;const{name:s,type:c,velocity:l,delay:d,onComplete:h,onUpdate:p,isGenerator:y}=this.options;if(!y&&!canAnimate(n,s,c,l))if(d)this.options.duration=0;else{p==null||p(getFinalKeyframe(n,this.options,o)),h==null||h(),this.resolveFinishedPromise();return}const S=this.initPlayback(n,o);S!==!1&&(this._resolved={keyframes:n,finalKeyframe:o,...S},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,l;warning(t<=secondsToMilliseconds(maxDuration$1),"Spring duration must be 10 seconds or less");let d=1-n;d=clamp(minDamping,maxDamping,d),t=clamp(minDuration,maxDuration$1,millisecondsToSeconds(t)),d<1?(c=y=>{const S=y*d,P=S*t,L=S-o,N=calcAngularFreq(y,d),z=Math.exp(-P);return safeMin-L/N*z},l=y=>{const P=y*d*t,L=P*o+o,N=Math.pow(d,2)*Math.pow(y,2)*t,z=Math.exp(-P),W=calcAngularFreq(Math.pow(y,2),d);return(-c(y)+safeMin>0?-1:1)*((L-N)*z)/W}):(c=y=>{const S=Math.exp(-y*t),P=(y-o)*t+1;return-.001+S*P},l=y=>{const S=Math.exp(-y*t),P=(o-y)*(t*t);return S*P});const h=5/t,p=approximateRoot(c,l,h);if(t=secondsToMilliseconds(t),isNaN(p))return{stiffness:100,damping:10,duration:t};{const y=Math.pow(p,2)*s;return{stiffness:y,damping:d*2*Math.sqrt(s*y),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],l=t[t.length-1],d={done:!1,value:c},{stiffness:h,damping:p,mass:y,duration:S,velocity:P,isResolvedFromDuration:L}=getSpringOptions({...s,velocity:-millisecondsToSeconds(s.velocity||0)}),N=P||0,z=p/(2*Math.sqrt(h*y)),W=l-c,ai=millisecondsToSeconds(Math.sqrt(h/y)),mt=Math.abs(W)<5;o||(o=mt?.01:2),n||(n=mt?.005:.5);let J;if(z<1){const pi=calcAngularFreq(ai,z);J=fa=>{const ma=Math.exp(-z*ai*fa);return l-ma*((N+z*ai*W)/pi*Math.sin(pi*fa)+W*Math.cos(pi*fa))}}else if(z===1)J=pi=>l-Math.exp(-ai*pi)*(W+(N+ai*W)*pi);else{const pi=ai*Math.sqrt(z*z-1);J=fa=>{const ma=Math.exp(-z*ai*fa),Sa=Math.min(pi*fa,300);return l-ma*((N+z*ai*W)*Math.sinh(Sa)+pi*W*Math.cosh(Sa))/pi}}return{calculatedDuration:L&&S||null,next:pi=>{const fa=J(pi);if(L)d.done=pi>=S;else{let ma=N;pi!==0&&(z<1?ma=calcGeneratorVelocity(J,pi,fa):ma=0);const Sa=Math.abs(ma)<=o,Ra=Math.abs(l-fa)<=n;d.done=Sa&&Ra}return d.value=d.done?l:fa,d}}}function inertia({keyframes:t,velocity:n=0,power:o=.8,timeConstant:s=325,bounceDamping:c=10,bounceStiffness:l=500,modifyTarget:d,min:h,max:p,restDelta:y=.5,restSpeed:S}){const P=t[0],L={done:!1,value:P},N=Vs=>h!==void 0&&Vs<h||p!==void 0&&Vs>p,z=Vs=>h===void 0?p:p===void 0||Math.abs(h-Vs)<Math.abs(p-Vs)?h:p;let W=o*n;const ai=P+W,mt=d===void 0?ai:d(ai);mt!==ai&&(W=mt-P);const J=Vs=>-W*Math.exp(-Vs/s),pi=Vs=>mt+J(Vs),fa=Vs=>{const La=J(Vs),Zs=pi(Vs);L.done=Math.abs(La)<=y,L.value=L.done?mt:Zs};let ma,Sa;const Ra=Vs=>{N(L.value)&&(ma=Vs,Sa=spring({keyframes:[L.value,z(L.value)],velocity:calcGeneratorVelocity(pi,Vs,L.value),damping:c,stiffness:l,restDelta:y,restSpeed:S}))};return Ra(0),{calculatedDuration:null,next:Vs=>{let La=!1;return!Sa&&ma===void 0&&(La=!0,fa(Vs),Ra(Vs)),ma!==void 0&&Vs>=ma?Sa.next(Vs-ma):(!La&&fa(Vs),L)}}}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 l,d,h=0;do d=n+(o-n)/2,l=calcBezier(d,s,c)-t,l>0?o=d:n=d;while(Math.abs(l)>subdivisionPrecision&&++h<subdivisionMaxIterations);return d}function cubicBezier(t,n,o,s){if(t===n&&o===s)return noop$1;const c=l=>binarySubdivide(l,0,1,t,o);return l=>l===0||l===1?l:calcBezier(c(l),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,l=0,d=0;if(!n)c=l=d=o;else{const h=o<.5?o*(1+n):o+n-o*n,p=2*o-h;c=hueToRgb(p,h,t+1/3),l=hueToRgb(p,h,t),d=hueToRgb(p,h,t-1/3)}return{red:Math.round(c*255),green:Math.round(l*255),blue:Math.round(d*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 l=>(c.red=mixLinearColor(o.red,s.red,l),c.green=mixLinearColor(o.green,s.green,l),c.blue=mixLinearColor(o.blue,s.blue,l),c.alpha=mixNumber$1(o.alpha,s.alpha,l),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((l,d)=>getMixer(l)(l,n[d]));return l=>{for(let d=0;d<s;d++)o[d]=c[d](l);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 l in s)o[l]=s[l](c);return o}}function matchOrder(t,n){var o;const s=[],c={color:0,var:0,number:0};for(let l=0;l<n.values.length;l++){const d=n.types[l],h=t.indexes[d][c[d]],p=(o=t.values[h])!==null&&o!==void 0?o:0;s[l]=p,c[d]++}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,l=t.length-1;for(let d=0;d<l;d++){let h=c(t[d],t[d+1]);if(n){const p=Array.isArray(n)?n[d]||noop$1:n;h=pipe(p,h)}s.push(h)}return s}function interpolate(t,n,{clamp:o=!0,ease:s,mixer:c}={}){const l=t.length;if(invariant(l===n.length,"Both input and output ranges must be the same length"),l===1)return()=>n[0];if(l===2&&t[0]===t[1])return()=>n[1];t[0]>t[l-1]&&(t=[...t].reverse(),n=[...n].reverse());const d=createMixers(n,s,c),h=d.length,p=y=>{let S=0;if(h>1)for(;S<t.length-2&&!(y<t[S+1]);S++);const P=progress(t[S],t[S+1],y);return d[S](P)};return o?y=>p(clamp(t[0],t[l-1],y)):p}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),l={done:!1,value:n[0]},d=convertOffsetToTimes(o&&o.length===n.length?o:defaultOffset(n),t),h=interpolate(d,n,{ease:Array.isArray(c)?c:defaultEasing(n,c)});return{calculatedDuration:t,next:p=>(l.value=h(p),l.done=p>=t,l)}}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:l}=this.options,d=(h,p)=>this.onKeyframesResolved(h,p);s&&c&&c.owner?this.resolver=c.owner.resolveKeyframes(l,d,s,c):this.resolver=new n(l,d,s,c),this.resolver.scheduleResolve()}initPlayback(n){const{type:o="keyframes",repeat:s=0,repeatDelay:c=0,repeatType:l,velocity:d=0}=this.options,h=generators[o]||keyframes;let p,y;h!==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}`),p=pipe(percentToProgress,mix(n[0],n[1])),n=[0,100]);const S=h({...this.options,keyframes:n});l==="mirror"&&(y=h({...this.options,keyframes:[...n].reverse(),velocity:-d})),S.calculatedDuration===null&&(S.calculatedDuration=calcGeneratorDuration(S));const{calculatedDuration:P}=S,L=P+c,N=L*(s+1)-c;return{generator:S,mirroredGenerator:y,mapPercentToKeyframes:p,calculatedDuration:P,resolvedDuration:L,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:Vs}=this.options;return{done:!0,value:Vs[Vs.length-1]}}const{finalKeyframe:c,generator:l,mirroredGenerator:d,mapPercentToKeyframes:h,keyframes:p,calculatedDuration:y,totalDuration:S,resolvedDuration:P}=s;if(this.startTime===null)return l.next(0);const{delay:L,repeat:N,repeatType:z,repeatDelay:W,onUpdate:ai}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,n):this.speed<0&&(this.startTime=Math.min(n-S/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 mt=this.currentTime-L*(this.speed>=0?1:-1),J=this.speed>=0?mt<0:mt>S;this.currentTime=Math.max(mt,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=S);let pi=this.currentTime,fa=l;if(N){const Vs=Math.min(this.currentTime,S)/P;let La=Math.floor(Vs),Zs=Vs%1;!Zs&&Vs>=1&&(Zs=1),Zs===1&&La--,La=Math.min(La,N+1),!!(La%2)&&(z==="reverse"?(Zs=1-Zs,W&&(Zs-=W/P)):z==="mirror"&&(fa=d)),pi=clamp(0,1,Zs)*P}const ma=J?{done:!1,value:p[0]}:fa.next(pi);h&&(ma.value=h(ma.value));let{done:Sa}=ma;!J&&y!==null&&(Sa=this.speed>=0?this.currentTime>=S:this.currentTime<=0);const Ra=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&Sa);return Ra&&c!==void 0&&(ma.value=getFinalKeyframe(p,this.options,c)),ai&&ai(ma.value),Ra&&this.finish(),ma}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:l=0,repeatType:d="loop",ease:h,times:p}={}){const y={[n]:o};p&&(y.offset=p);const S=mapEasingToNativeEasing(h);return Array.isArray(S)&&(y.easing=S),t.animate(y,{delay:s,duration:c,easing:Array.isArray(S)?"linear":S,fill:"both",iterations:l+1,direction:d==="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 l=0;for(;!s.done&&l<maxDuration;)s=o.sample(l),c.push(s.value),l+=sampleDelta;return{times:void 0,keyframes:c,duration:l-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,(l,d)=>this.onKeyframesResolved(l,d),o,s),this.resolver.scheduleResolve()}initPlayback(n,o){var s;let{duration:c=300,times:l,ease:d,type:h,motionValue:p,name:y}=this.options;if(!(!((s=p.owner)===null||s===void 0)&&s.current))return!1;if(requiresPregeneratedKeyframes(this.options)){const{onComplete:P,onUpdate:L,motionValue:N,...z}=this.options,W=pregenerateKeyframes(n,z);n=W.keyframes,n.length===1&&(n[1]=n[0]),c=W.duration,l=W.times,d=W.ease,h="keyframes"}const S=animateStyle(p.owner.current,y,n,{...this.options,duration:c,times:l,ease:d});return S.startTime=time.now(),this.pendingTimeline?(S.timeline=this.pendingTimeline,this.pendingTimeline=void 0):S.onfinish=()=>{const{onComplete:P}=this.options;p.set(getFinalKeyframe(n,this.options,o)),P&&P(),this.cancel(),this.resolveFinishedPromise()},{animation:S,duration:c,times:l,type:h,ease:d,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:l,ease:d,times:h}=n;if(!(o.playState==="idle"||o.playState==="finished")){if(this.time){const{motionValue:p,onUpdate:y,onComplete:S,...P}=this.options,L=new MainThreadAnimation({...P,keyframes:s,duration:c,type:l,ease:d,times:h,isGenerator:!0}),N=secondsToMilliseconds(this.time);p.setWithVelocity(L.sample(N-sampleDelta).value,L.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:l,damping:d,type:h}=n;return supportsWaapi()&&s&&acceleratedValues.has(s)&&o&&o.owner&&o.owner.current instanceof HTMLElement&&!o.owner.getProps().onUpdate&&!c&&l!=="mirror"&&d!==0&&h!=="inertia"}}const animateMotionValue=(t,n,o,s={},c,l)=>d=>{const h=getValueTransition(s,t)||{},p=h.delay||s.delay||0;let{elapsed:y=0}=s;y=y-secondsToMilliseconds(p);let S={keyframes:Array.isArray(o)?o:[null,o],ease:"easeOut",velocity:n.getVelocity(),...h,delay:-y,onUpdate:L=>{n.set(L),h.onUpdate&&h.onUpdate(L)},onComplete:()=>{d(),h.onComplete&&h.onComplete()},name:t,motionValue:n,element:l?void 0:c};isTransitionDefined(h)||(S={...S,...getDefaultTransition(t,S)}),S.duration&&(S.duration=secondsToMilliseconds(S.duration)),S.repeatDelay&&(S.repeatDelay=secondsToMilliseconds(S.repeatDelay)),S.from!==void 0&&(S.keyframes[0]=S.from);let P=!1;if((S.type===!1||S.duration===0&&!S.repeatDelay)&&(S.duration=0,S.delay===0&&(P=!0)),P&&!l&&n.get()!==void 0){const L=getFinalKeyframe(S.keyframes,h);if(L!==void 0){frame.update(()=>{S.onUpdate(L),S.onComplete()});return}}return!l&&AcceleratedAnimation.supports(S)?new AcceleratedAnimation(S):new MainThreadAnimation(S)};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 l=0;l<c;l++){const d=this.subscriptions[l];d&&d(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 l=time.now();this.updatedAt!==l&&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={},...l}=o||{};l={...l,...s};for(const d in l){const h=resolveFinalValueInKeyframes(l[d]);setMotionValue(t,d,h)}}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 l;let{transition:d=t.getDefaultTransition(),transitionEnd:h,...p}=n;const y=t.getValue("willChange");s&&(d=s);const S=[],P=c&&t.animationState&&t.animationState.getState()[c];for(const L in p){const N=t.getValue(L,(l=t.latestValues[L])!==null&&l!==void 0?l:null),z=p[L];if(z===void 0||P&&shouldBlockAnimation(P,L))continue;const W={delay:o,elapsed:0,...getValueTransition(d||{},L)};let ai=!1;if(window.HandoffAppearAnimations){const J=t.getProps()[optimizedAppearDataAttribute];if(J){const pi=window.HandoffAppearAnimations(J,L);pi!==null&&(W.elapsed=pi,ai=!0)}}N.start(animateMotionValue(L,N,z,t.shouldReduceMotion&&transformProps.has(L)?{type:!1}:W,t,ai));const mt=N.animation;mt&&(isWillChangeMotionValue(y)&&(y.add(L),mt.then(()=>y.remove(L))),S.push(mt))}return h&&Promise.all(S).then(()=>{frame.update(()=>{h&&setTarget(t,h)})}),S}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:l=t.getDefaultTransition()||{}}=c||{};o.transitionOverride&&(l=o.transitionOverride);const d=c?()=>Promise.all(animateTarget(t,c,o)):()=>Promise.resolve(),h=t.variantChildren&&t.variantChildren.size?(y=0)=>{const{delayChildren:S=0,staggerChildren:P,staggerDirection:L}=l;return animateChildren(t,n,S+y,P,L,o)}:()=>Promise.resolve(),{when:p}=l;if(p){const[y,S]=p==="beforeChildren"?[d,h]:[h,d];return y().then(()=>S())}else return Promise.all([d(),h(o.delay)])}function animateChildren(t,n,o=0,s=0,c=1,l){const d=[],h=(t.variantChildren.size-1)*s,p=c===1?(y=0)=>y*s:(y=0)=>h-y*s;return Array.from(t.variantChildren).sort(sortByTreeOrder).forEach((y,S)=>{y.notify("AnimationStart",n),d.push(animateVariant(y,n,{...l,delay:o+p(S)}).then(()=>y.notify("AnimationComplete",n)))}),Promise.all(d)}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(l=>animateVariant(t,l,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=p=>(y,S)=>{var P;const L=resolveVariant(t,S,p==="exit"?(P=t.presenceContext)===null||P===void 0?void 0:P.custom:void 0);if(L){const{transition:N,transitionEnd:z,...W}=L;y={...y,...W,...z}}return y};function l(p){n=p(t)}function d(p){const y=t.getProps(),S=t.getVariantContext(!0)||{},P=[],L=new Set;let N={},z=1/0;for(let ai=0;ai<numAnimationTypes;ai++){const mt=reversePriorityOrder[ai],J=o[mt],pi=y[mt]!==void 0?y[mt]:S[mt],fa=isVariantLabel(pi),ma=mt===p?J.isActive:null;ma===!1&&(z=ai);let Sa=pi===S[mt]&&pi!==y[mt]&&fa;if(Sa&&s&&t.manuallyAnimateOnMount&&(Sa=!1),J.protectedKeys={...N},!J.isActive&&ma===null||!pi&&!J.prevProp||isAnimationControls(pi)||typeof pi=="boolean")continue;let Vs=checkVariantsDidChange(J.prevProp,pi)||mt===p&&J.isActive&&!Sa&&fa||ai>z&&fa,La=!1;const Zs=Array.isArray(pi)?pi:[pi];let Xs=Zs.reduce(c(mt),{});ma===!1&&(Xs={});const{prevResolvedValues:Wa={}}=J,ea={...Wa,...Xs},ui=ba=>{Vs=!0,L.has(ba)&&(La=!0,L.delete(ba)),J.needsAnimating[ba]=!0;const ms=t.getValue(ba);ms&&(ms.liveStyle=!1)};for(const ba in ea){const ms=Xs[ba],yu=Wa[ba];if(N.hasOwnProperty(ba))continue;let pu=!1;isKeyframesTarget(ms)&&isKeyframesTarget(yu)?pu=!shallowCompare(ms,yu):pu=ms!==yu,pu?ms!=null?ui(ba):L.add(ba):ms!==void 0&&L.has(ba)?ui(ba):J.protectedKeys[ba]=!0}J.prevProp=pi,J.prevResolvedValues=Xs,J.isActive&&(N={...N,...Xs}),s&&t.blockInitialAnimation&&(Vs=!1),Vs&&(!Sa||La)&&P.push(...Zs.map(ba=>({animation:ba,options:{type:mt}})))}if(L.size){const ai={};L.forEach(mt=>{const J=t.getBaseTarget(mt),pi=t.getValue(mt);pi&&(pi.liveStyle=!0),ai[mt]=J===void 0?null:J}),P.push({animation:ai})}let W=!!P.length;return s&&(y.initial===!1||y.initial===y.animate)&&!t.manuallyAnimateOnMount&&(W=!1),s=!1,W?n(P):Promise.resolve()}function h(p,y){var S;if(o[p].isActive===y)return Promise.resolve();(S=t.variantChildren)===null||S===void 0||S.forEach(L=>{var N;return(N=L.animationState)===null||N===void 0?void 0:N.setActive(p,y)}),o[p].isActive=y;const P=d(p);for(const L in o)o[L].protectedKeys={};return P}return{animateChanges:d,setActive:h,setAnimateFunction:l,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:l=!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 P=getPanInfo(this.lastMoveEventInfo,this.history),L=this.startEvent!==null,N=distance2D(P.offset,{x:0,y:0})>=3;if(!L&&!N)return;const{point:z}=P,{timestamp:W}=frameData;this.history.push({...z,timestamp:W});const{onStart:ai,onMove:mt}=this.handlers;L||(ai&&ai(this.lastMoveEvent,P),this.startEvent=this.lastMoveEvent),mt&&mt(this.lastMoveEvent,P)},this.handlePointerMove=(P,L)=>{this.lastMoveEvent=P,this.lastMoveEventInfo=transformPoint(L,this.transformPagePoint),frame.update(this.updatePoint,!0)},this.handlePointerUp=(P,L)=>{this.end();const{onEnd:N,onSessionEnd:z,resumeAnimation:W}=this.handlers;if(this.dragSnapToOrigin&&W&&W(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const ai=getPanInfo(P.type==="pointercancel"?this.lastMoveEventInfo:transformPoint(L,this.transformPagePoint),this.history);this.startEvent&&N&&N(P,ai),z&&z(P,ai)},!isPrimaryPointer(n))return;this.dragSnapToOrigin=l,this.handlers=o,this.transformPagePoint=s,this.contextWindow=c||window;const d=extractEventInfo(n),h=transformPoint(d,this.transformPagePoint),{point:p}=h,{timestamp:y}=frameData;this.history=[{...p,timestamp:y}];const{onSessionStart:S}=o;S&&S(n,getPanInfo(h,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 l=millisecondsToSeconds(c.timestamp-s.timestamp);if(l===0)return{x:0,y:0};const d={x:(c.x-s.x)/l,y:(c.y-s.y)/l};return d.x===1/0&&(d.x=0),d.y===1/0&&(d.y=0),d}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 l,d;for(let h=0;h<c;h++){l=o[h],d=l.projectionDelta;const p=l.instance;p&&p.style&&p.style.display==="contents"||(s&&l.options.layoutScroll&&l.scroll&&l!==l.root&&transformBox(t,{x:-l.scroll.offset.x,y:-l.scroll.offset.y}),d&&(n.x*=d.x.scale,n.y*=d.y.scale,applyBoxDelta(t,d)),s&&hasTransform(l.latestValues)&&transformBox(t,l.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 l=n[c]!==void 0?n[c]:.5,d=mixNumber$1(t.min,t.max,l);applyAxisDelta(t,n[o],n[s],d,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=S=>{const{dragSnapToOrigin:P}=this.getProps();P?this.pauseAnimation():this.stopAnimation(),o&&this.snapToCursor(extractEventInfo(S,"page").point)},l=(S,P)=>{const{drag:L,dragPropagation:N,onDragStart:z}=this.getProps();if(L&&!N&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=getGlobalLock(L),!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(ai=>{let mt=this.getAxisMotionValue(ai).get()||0;if(percent.test(mt)){const{projection:J}=this.visualElement;if(J&&J.layout){const pi=J.layout.layoutBox[ai];pi&&(mt=calcLength(pi)*(parseFloat(mt)/100))}}this.originPoint[ai]=mt}),z&&z(S,P);const{animationState:W}=this.visualElement;W&&W.setActive("whileDrag",!0)},d=(S,P)=>{const{dragPropagation:L,dragDirectionLock:N,onDirectionLock:z,onDrag:W}=this.getProps();if(!L&&!this.openGlobalLock)return;const{offset:ai}=P;if(N&&this.currentDirection===null){this.currentDirection=getCurrentDirection(ai),this.currentDirection!==null&&z&&z(this.currentDirection);return}this.updateAxis("x",P.point,ai),this.updateAxis("y",P.point,ai),this.visualElement.render(),W&&W(S,P)},h=(S,P)=>this.stop(S,P),p=()=>eachAxis(S=>{var P;return this.getAnimationState(S)==="paused"&&((P=this.getAxisMotionValue(S).animation)===null||P===void 0?void 0:P.play())}),{dragSnapToOrigin:y}=this.getProps();this.panSession=new PanSession(n,{onSessionStart:c,onStart:l,onMove:d,onSessionEnd:h,resumeAnimation:p},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:y,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:l}=this.getProps();l&&l(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 l=this.getAxisMotionValue(n);let d=this.originPoint[n]+s[n];this.constraints&&this.constraints[n]&&(d=applyConstraints(d,this.constraints[n],this.elastic[n])),l.set(d)}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,l=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),l!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&eachAxis(d=>{this.getAxisMotionValue(d)&&(this.constraints[d]=rebaseAxisConstraints(c.layoutBox[d],this.constraints[d]))})}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 l=measurePageBox(s,c.root,this.visualElement.getTransformPagePoint());let d=calcViewportConstraints(c.layout.layoutBox,l);if(o){const h=o(convertBoxToBoundingBox(d));this.hasMutatedConstraints=!!h,h&&(d=convertBoundingBoxToBox(h))}return d}startAnimation(n){const{drag:o,dragMomentum:s,dragElastic:c,dragTransition:l,dragSnapToOrigin:d,onDragTransitionEnd:h}=this.getProps(),p=this.constraints||{},y=eachAxis(S=>{if(!shouldDrag(S,o,this.currentDirection))return;let P=p[S]||{};d&&(P={min:0,max:0});const L=c?200:1e6,N=c?40:1e7,z={type:"inertia",velocity:s?n[S]:0,bounceStiffness:L,bounceDamping:N,timeConstant:750,restDelta:1,restSpeed:10,...l,...P};return this.startAxisValueAnimation(S,z)});return Promise.all(y).then(h)}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,l=this.getAxisMotionValue(o);if(c&&c.layout){const{min:d,max:h}=c.layout.layoutBox[o];l.set(n[o]-mixNumber$1(d,h,.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(d=>{const h=this.getAxisMotionValue(d);if(h){const p=h.get();c[d]=calcOrigin({min:p,max:p},this.constraints[d])}});const{transformTemplate:l}=this.visualElement.getProps();this.visualElement.current.style.transform=l?l({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),eachAxis(d=>{if(!shouldDrag(d,n,null))return;const h=this.getAxisMotionValue(d),{min:p,max:y}=this.constraints[d];h.set(mixNumber$1(p,y,c[d]))})}addListeners(){if(!this.visualElement.current)return;elementDragControls.set(this.visualElement,this);const n=this.visualElement.current,o=addPointerEvent(n,"pointerdown",p=>{const{drag:y,dragListener:S=!0}=this.getProps();y&&S&&this.start(p)}),s=()=>{const{dragConstraints:p}=this.getProps();isRefObject(p)&&(this.constraints=this.resolveRefConstraints())},{projection:c}=this.visualElement,l=c.addEventListener("measure",s);c&&!c.layout&&(c.root&&c.root.updateScroll(),c.updateLayout()),s();const d=addDomEvent(window,"resize",()=>this.scalePositionWithinConstraints()),h=c.addEventListener("didUpdate",({delta:p,hasLayoutChanged:y})=>{this.isDragging&&y&&(eachAxis(S=>{const P=this.getAxisMotionValue(S);P&&(this.originPoint[S]+=p[S].translate,P.set(P.get()+p[S].translate))}),this.visualElement.render())});return()=>{d(),o(),l(),h&&h()}}getProps(){const n=this.visualElement.getProps(),{drag:o=!1,dragDirectionLock:s=!1,dragPropagation:c=!1,dragConstraints:l=!1,dragElastic:d=defaultElastic,dragMomentum:h=!0}=n;return{...n,drag:o,dragDirectionLock:s,dragPropagation:c,dragConstraints:l,dragElastic:d,dragMomentum:h}}}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:(l,d)=>{delete this.session,c&&c(l,d)}}}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 l=complex.createTransformer(t),d=typeof c[0]!="number"?1:0,h=o.x.scale*n.x,p=o.y.scale*n.y;c[0+d]/=h,c[1+d]/=p;const y=mixNumber$1(h,p,.5);return typeof c[2+d]=="number"&&(c[2+d]/=y),typeof c[3+d]=="number"&&(c[3+d]/=y),l(c)}};class MeasureLayoutWithContext extends React.Component{componentDidMount(){const{visualElement:n,layoutGroup:o,switchLayoutGroup:s,layoutId:c}=this.props,{projection:l}=n;addScaleCorrector(defaultScaleCorrectors),l&&(o.group&&o.group.add(l),s&&s.register&&c&&s.register(l),l.root.didUpdate(),l.addEventListener("animationComplete",()=>{this.safeToRemove()}),l.setOptions({...l.options,onExitComplete:()=>this.safeToRemove()})),globalProjectionState.hasEverUpdated=!0}getSnapshotBeforeUpdate(n){const{layoutDependency:o,visualElement:s,drag:c,isPresent:l}=this.props,d=s.projection;return d&&(d.isPresent=l,c||n.layoutDependency!==o||o===void 0?d.willUpdate():this.safeToRemove(),n.isPresent!==l&&(l?d.promote():d.relegate()||frame.postRender(()=>{const h=d.getStack();(!h||!h.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,l){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))):l&&(t.opacity=mixNumber$1(n.opacity!==void 0?n.opacity:1,o.opacity!==void 0?o.opacity:1,s));for(let d=0;d<numBorders;d++){const h=`border${borders[d]}Radius`;let p=getRadius(n,h),y=getRadius(o,h);if(p===void 0&&y===void 0)continue;p||(p=0),y||(y=0),p===0||y===0||isPx(p)===isPx(y)?(t[h]=Math.max(mixNumber$1(asNumber(p),asNumber(y),s),0),(percent.test(y)||percent.test(p))&&(t[h]+="%")):t[h]=y}(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,l=t,d=t){if(percent.test(n)&&(n=parseFloat(n),n=mixNumber$1(d.min,d.max,n/100)-d.min),typeof n!="number")return;let h=mixNumber$1(l.min,l.max,s);t===l&&(h-=n),t.min=removePointDelta(t.min,n,o,h,c),t.max=removePointDelta(t.max,n,o,h,c)}function removeAxisTransforms(t,n,[o,s,c],l,d){removeAxisDelta(t,n[o],n[s],n[c],n.scale,l,d)}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 l=this.members[c];if(l.isPresent!==!1){s=l;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,l=t.y.translate/n.y,d=(o==null?void 0:o.z)||0;if((c||l||d)&&(s=`translate3d(${c}px, ${l}px, ${d}px) `),(n.x!==1||n.y!==1)&&(s+=`scale(${1/n.x}, ${1/n.y}) `),o){const{transformPerspective:y,rotate:S,rotateX:P,rotateY:L,skewX:N,skewY:z}=o;y&&(s=`perspective(${y}px) ${s}`),S&&(s+=`rotate(${S}deg) `),P&&(s+=`rotateX(${P}deg) `),L&&(s+=`rotateY(${L}deg) `),N&&(s+=`skewX(${N}deg) `),z&&(s+=`skewY(${z}deg) `)}const h=t.x.scale*n.x,p=t.y.scale*n.y;return(h!==1||p!==1)&&(s+=`scale(${h}, ${p})`),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 l=c-o;l>=n&&(cancelFrame(s),t(l-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(d={},h=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=d,this.root=h?h.root||h:this,this.path=h?[...h.path,h]:[],this.parent=h,this.depth=h?h.depth+1:0;for(let p=0;p<this.path.length;p++)this.path[p].shouldResetTransform=!0;this.root===this&&(this.nodes=new FlatTree)}addEventListener(d,h){return this.eventHandlers.has(d)||this.eventHandlers.set(d,new SubscriptionManager),this.eventHandlers.get(d).add(h)}notifyListeners(d,...h){const p=this.eventHandlers.get(d);p&&p.notify(...h)}hasListeners(d){return this.eventHandlers.has(d)}mount(d,h=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=isSVGElement(d),this.instance=d;const{layoutId:p,layout:y,visualElement:S}=this.options;if(S&&!S.current&&S.mount(d),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),h&&(y||p)&&(this.isLayoutDirty=!0),t){let P;const L=()=>this.root.updateBlockedByResize=!1;t(d,()=>{this.root.updateBlockedByResize=!0,P&&P(),P=delay(L,250),globalProjectionState.hasAnimatedSinceResize&&(globalProjectionState.hasAnimatedSinceResize=!1,this.nodes.forEach(finishAnimation))})}p&&this.root.registerSharedNode(p,this),this.options.animate!==!1&&S&&(p||y)&&this.addEventListener("didUpdate",({delta:P,hasLayoutChanged:L,hasRelativeTargetChanged:N,layout:z})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const W=this.options.transition||S.getDefaultTransition()||defaultLayoutTransition,{onLayoutAnimationStart:ai,onLayoutAnimationComplete:mt}=S.getProps(),J=!this.targetLayout||!boxEqualsRounded(this.targetLayout,z)||N,pi=!L&&N;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||pi||L&&(J||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(P,pi);const fa={...getValueTransition(W,"layout"),onPlay:ai,onComplete:mt};(S.shouldReduceMotion||this.options.layoutRoot)&&(fa.delay=0,fa.type=!1),this.startAnimation(fa)}else L||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 d=this.getStack();d&&d.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:d}=this.options;return d&&d.getProps().transformTemplate}willUpdate(d=!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 S=0;S<this.path.length;S++){const P=this.path[S];P.shouldResetTransform=!0,P.updateScroll("snapshot"),P.options.layoutRoot&&P.willUpdate(!1)}const{layoutId:h,layout:p}=this.options;if(h===void 0&&!p)return;const y=this.getTransformTemplate();this.prevTransformTemplateValue=y?y(this.latestValues,""):void 0,this.updateSnapshot(),d&&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 h=time.now();frameData.delta=clamp(0,1e3/60,h-frameData.timestamp),frameData.timestamp=h,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 p=0;p<this.path.length;p++)this.path[p].updateScroll();const d=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:h}=this.options;h&&h.notify("LayoutMeasure",this.layout.layoutBox,d?d.layoutBox:void 0)}updateScroll(d="measure"){let h=!!(this.options.layoutScroll&&this.instance);this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===d&&(h=!1),h&&(this.scroll={animationId:this.root.animationId,phase:d,isRoot:s(this.instance),offset:o(this.instance)})}resetTransform(){if(!c)return;const d=this.isLayoutDirty||this.shouldResetTransform,h=this.projectionDelta&&!isDeltaZero(this.projectionDelta),p=this.getTransformTemplate(),y=p?p(this.latestValues,""):void 0,S=y!==this.prevTransformTemplateValue;d&&(h||hasTransform(this.latestValues)||S)&&(c(this.instance,y),this.shouldResetTransform=!1,this.scheduleRender())}measure(d=!0){const h=this.measurePageBox();let p=this.removeElementScroll(h);return d&&(p=this.removeTransform(p)),roundBox(p),{animationId:this.root.animationId,measuredBox:h,layoutBox:p,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:d}=this.options;if(!d)return createBox();const h=d.measureViewportBox(),{scroll:p}=this.root;return p&&(translateAxis(h.x,p.offset.x),translateAxis(h.y,p.offset.y)),h}removeElementScroll(d){const h=createBox();copyBoxInto(h,d);for(let p=0;p<this.path.length;p++){const y=this.path[p],{scroll:S,options:P}=y;if(y!==this.root&&S&&P.layoutScroll){if(S.isRoot){copyBoxInto(h,d);const{scroll:L}=this.root;L&&(translateAxis(h.x,-L.offset.x),translateAxis(h.y,-L.offset.y))}translateAxis(h.x,S.offset.x),translateAxis(h.y,S.offset.y)}}return h}applyTransform(d,h=!1){const p=createBox();copyBoxInto(p,d);for(let y=0;y<this.path.length;y++){const S=this.path[y];!h&&S.options.layoutScroll&&S.scroll&&S!==S.root&&transformBox(p,{x:-S.scroll.offset.x,y:-S.scroll.offset.y}),hasTransform(S.latestValues)&&transformBox(p,S.latestValues)}return hasTransform(this.latestValues)&&transformBox(p,this.latestValues),p}removeTransform(d){const h=createBox();copyBoxInto(h,d);for(let p=0;p<this.path.length;p++){const y=this.path[p];if(!y.instance||!hasTransform(y.latestValues))continue;hasScale(y.latestValues)&&y.updateSnapshot();const S=createBox(),P=y.measurePageBox();copyBoxInto(S,P),removeBoxTransforms(h,y.latestValues,y.snapshot?y.snapshot.layoutBox:void 0,S)}return hasTransform(this.latestValues)&&removeBoxTransforms(h,this.latestValues),h}setTargetDelta(d){this.targetDelta=d,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(d){this.options={...this.options,...d,crossfade:d.crossfade!==void 0?d.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(d=!1){var h;const p=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=p.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=p.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=p.isSharedProjectionDirty);const y=!!this.resumingFrom||this!==p;if(!(d||y&&this.isSharedProjectionDirty||this.isProjectionDirty||!((h=this.parent)===null||h===void 0)&&h.isProjectionDirty||this.attemptToResolveRelativeTarget))return;const{layout:P,layoutId:L}=this.options;if(!(!this.layout||!(P||L))){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 d;const h=this.getLead(),p=!!this.resumingFrom||this!==h;let y=!0;if((this.isProjectionDirty||!((d=this.parent)===null||d===void 0)&&d.isProjectionDirty)&&(y=!1),p&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(y=!1),this.resolvedRelativeTargetAt===frameData.timestamp&&(y=!1),y)return;const{layout:S,layoutId:P}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(S||P))return;copyBoxInto(this.layoutCorrected,this.layout.layoutBox);const L=this.treeScale.x,N=this.treeScale.y;applyTreeDeltas(this.layoutCorrected,this.treeScale,this.path,p),h.layout&&!h.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(h.target=h.layout.layoutBox,h.targetWithTransforms=createBox());const{target:z}=h;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!==L||this.treeScale.y!==N)&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",z)),projectionFrameData.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(d=!0){if(this.options.scheduleRender&&this.options.scheduleRender(),d){const h=this.getStack();h&&h.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}setAnimationOrigin(d,h=!1){const p=this.snapshot,y=p?p.latestValues:{},S={...this.latestValues},P=createDelta();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!h;const L=createBox(),N=p?p.source:void 0,z=this.layout?this.layout.source:void 0,W=N!==z,ai=this.getStack(),mt=!ai||ai.members.length<=1,J=!!(W&&!mt&&this.options.crossfade===!0&&!this.path.some(hasOpacityCrossfade));this.animationProgress=0;let pi;this.mixTargetDelta=fa=>{const ma=fa/1e3;mixAxisDelta(P.x,d.x,ma),mixAxisDelta(P.y,d.y,ma),this.setTargetDelta(P),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(calcRelativePosition(L,this.layout.layoutBox,this.relativeParent.layout.layoutBox),mixBox(this.relativeTarget,this.relativeTargetOrigin,L,ma),pi&&boxEquals(this.relativeTarget,pi)&&(this.isProjectionDirty=!1),pi||(pi=createBox()),copyBoxInto(pi,this.relativeTarget)),W&&(this.animationValues=S,mixValues(S,y,this.latestValues,ma,J,mt)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=ma},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(d){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,{...d,onUpdate:h=>{this.mixTargetDelta(h),d.onUpdate&&d.onUpdate(h)},onComplete:()=>{d.onComplete&&d.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 d=this.getStack();d&&d.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 d=this.getLead();let{targetWithTransforms:h,target:p,layout:y,latestValues:S}=d;if(!(!h||!p||!y)){if(this!==d&&this.layout&&y&&shouldAnimatePositionOnly(this.options.animationType,this.layout.layoutBox,y.layoutBox)){p=this.target||createBox();const P=calcLength(this.layout.layoutBox.x);p.x.min=d.target.x.min,p.x.max=p.x.min+P;const L=calcLength(this.layout.layoutBox.y);p.y.min=d.target.y.min,p.y.max=p.y.min+L}copyBoxInto(h,p),transformBox(h,S),calcBoxDelta(this.projectionDeltaWithTransform,this.layoutCorrected,h,S)}}registerSharedNode(d,h){this.sharedNodes.has(d)||this.sharedNodes.set(d,new NodeStack),this.sharedNodes.get(d).add(h);const y=h.options.initialPromotionConfig;h.promote({transition:y?y.transition:void 0,preserveFollowOpacity:y&&y.shouldPreserveFollowOpacity?y.shouldPreserveFollowOpacity(h):void 0})}isLead(){const d=this.getStack();return d?d.lead===this:!0}getLead(){var d;const{layoutId:h}=this.options;return h?((d=this.getStack())===null||d===void 0?void 0:d.lead)||this:this}getPrevLead(){var d;const{layoutId:h}=this.options;return h?(d=this.getStack())===null||d===void 0?void 0:d.prevLead:void 0}getStack(){const{layoutId:d}=this.options;if(d)return this.root.sharedNodes.get(d)}promote({needsReset:d,transition:h,preserveFollowOpacity:p}={}){const y=this.getStack();y&&y.promote(this,p),d&&(this.projectionDelta=void 0,this.needsReset=!0),h&&this.setOptions({transition:h})}relegate(){const d=this.getStack();return d?d.relegate(this):!1}resetSkewAndRotation(){const{visualElement:d}=this.options;if(!d)return;let h=!1;const{latestValues:p}=d;if((p.z||p.rotate||p.rotateX||p.rotateY||p.rotateZ||p.skewX||p.skewY)&&(h=!0),!h)return;const y={};p.z&&resetDistortingTransform("z",d,y,this.animationValues);for(let S=0;S<transformAxes.length;S++)resetDistortingTransform(`rotate${transformAxes[S]}`,d,y,this.animationValues),resetDistortingTransform(`skew${transformAxes[S]}`,d,y,this.animationValues);d.render();for(const S in y)d.setStaticValue(S,y[S]),this.animationValues&&(this.animationValues[S]=y[S]);d.scheduleRender()}getProjectionStyles(d){var h,p;if(!this.instance||this.isSVG)return;if(!this.isVisible)return hiddenVisibility;const y={visibility:""},S=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,y.opacity="",y.pointerEvents=resolveMotionValue(d==null?void 0:d.pointerEvents)||"",y.transform=S?S(this.latestValues,""):"none",y;const P=this.getLead();if(!this.projectionDelta||!this.layout||!P.target){const W={};return this.options.layoutId&&(W.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,W.pointerEvents=resolveMotionValue(d==null?void 0:d.pointerEvents)||""),this.hasProjected&&!hasTransform(this.latestValues)&&(W.transform=S?S({},""):"none",this.hasProjected=!1),W}const L=P.animationValues||P.latestValues;this.applyTransformsToTarget(),y.transform=buildProjectionTransform(this.projectionDeltaWithTransform,this.treeScale,L),S&&(y.transform=S(L,y.transform));const{x:N,y:z}=this.projectionDelta;y.transformOrigin=`${N.origin*100}% ${z.origin*100}% 0`,P.animationValues?y.opacity=P===this?(p=(h=L.opacity)!==null&&h!==void 0?h:this.latestValues.opacity)!==null&&p!==void 0?p:1:this.preserveOpacity?this.latestValues.opacity:L.opacityExit:y.opacity=P===this?L.opacity!==void 0?L.opacity:"":L.opacityExit!==void 0?L.opacityExit:0;for(const W in scaleCorrectors){if(L[W]===void 0)continue;const{correct:ai,applyTo:mt}=scaleCorrectors[W],J=y.transform==="none"?L[W]:ai(L[W],P);if(mt){const pi=mt.length;for(let fa=0;fa<pi;fa++)y[mt[fa]]=J}else y[W]=J}return this.options.layoutId&&(y.pointerEvents=P===this?resolveMotionValue(d==null?void 0:d.pointerEvents)||"":"none"),y}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(d=>{var h;return(h=d.currentAnimation)===null||h===void 0?void 0:h.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:l}=t.options,d=o.source!==t.layout.source;l==="size"?eachAxis(P=>{const L=d?o.measuredBox[P]:o.layoutBox[P],N=calcLength(L);L.min=s[P].min,L.max=L.min+N}):shouldAnimatePositionOnly(l,o.layoutBox,s)&&eachAxis(P=>{const L=d?o.measuredBox[P]:o.layoutBox[P],N=calcLength(s[P]);L.max=L.min+N,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[P].max=t.relativeTarget[P].min+N)});const h=createDelta();calcBoxDelta(h,s,o.layoutBox);const p=createDelta();d?calcBoxDelta(p,t.applyTransform(c,!0),o.measuredBox):calcBoxDelta(p,s,o.layoutBox);const y=!isDeltaZero(h);let S=!1;if(!t.resumeFrom){const P=t.getClosestProjectingParent();if(P&&!P.resumeFrom){const{snapshot:L,layout:N}=P;if(L&&N){const z=createBox();calcRelativePosition(z,o.layoutBox,L.layoutBox);const W=createBox();calcRelativePosition(W,s,N.layoutBox),boxEqualsRounded(z,W)||(S=!0),P.options.layoutRoot&&(t.relativeTarget=W,t.relativeTargetOrigin=z,t.relativeParent=P)}}}t.notifyListeners("didUpdate",{layout:s,snapshot:o,delta:p,layoutDelta:h,hasLayoutChanged:y,hasRelativeTargetChanged:S})}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 l=n[c],d=o[c];if(isMotionValue(l))t.addValue(c,l),isWillChangeMotionValue(s)&&s.add(c),process.env.NODE_ENV==="development"&&warnOnce(l.version==="11.0.27",`Attempting to mix Framer Motion versions ${l.version} with 11.0.27 may not work as expected.`);else if(isMotionValue(d))t.addValue(c,motionValue(l,{owner:t})),isWillChangeMotionValue(s)&&s.remove(c);else if(d!==l)if(t.hasValue(c)){const h=t.getValue(c);h.liveStyle===!0?h.jump(l):h.hasAnimated||h.set(l)}else{const h=t.getStaticValue(c);t.addValue(c,motionValue(h!==void 0?h:l,{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:l,visualState:d},h={}){this.resolveKeyframes=(L,N,z,W)=>new this.KeyframeResolver(L,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:p,renderState:y}=d;this.latestValues=p,this.baseTarget={...p},this.initialValues=o.initial?{...p}:{},this.renderState=y,this.parent=n,this.props=o,this.presenceContext=s,this.depth=n?n.depth+1:0,this.reducedMotionConfig=c,this.options=h,this.blockInitialAnimation=!!l,this.isControllingVariants=isControllingVariants(o),this.isVariantNode=isVariantNode(o),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(n&&n.current);const{willChange:S,...P}=this.scrapeMotionValuesFromProps(o,{},this);for(const L in P){const N=P[L];p[L]!==void 0&&isMotionValue(N)&&(N.set(p[L],!1),isWillChangeMotionValue(S)&&S.add(L))}}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",d=>{this.latestValues[n]=d,this.props.onUpdate&&frame.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0)}),l=o.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(n,()=>{c(),l(),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,l){let d,h;if(process.env.NODE_ENV!=="production"&&c&&s){const p="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,p):invariant(!1,p)}for(let p=0;p<numFeatures;p++){const y=featureNames[p],{isEnabled:S,Feature:P,ProjectionNode:L,MeasureLayout:N}=featureDefinitions[y];L&&(d=L),S(o)&&(!this.features[y]&&P&&(this.features[y]=new P(this)),N&&(h=N))}if((this.type==="html"||this.type==="svg")&&!this.projection&&d){this.projection=new d(this.latestValues,getClosestProjectingNode(this.parent));const{layoutId:p,layout:y,drag:S,dragConstraints:P,layoutScroll:L,layoutRoot:N}=o;this.projection.setOptions({layoutId:p,layout:y,alwaysMeasureLayout:!!S||P&&isRefObject(P),visualElement:this,scheduleRender:()=>this.scheduleRender(),animationType:typeof y=="string"?y:"both",initialPromotionConfig:l,layoutScroll:L,layoutRoot:N})}return h}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 l=n["on"+c];l&&(this.propEventSubscriptions[c]=this.on(c,l))}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],l=this.props[c];(isVariantLabel(l)||l===!1)&&(o[c]=l)}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,l=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&&l!==void 0)return l;const d=this.getBaseTargetFromProps(this.props,n);return d!==void 0&&!isMotionValue(d)?d:this.initialValues[n]!==void 0&&l===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),l=new Set(t),d=o.current;c.forEach(function(h){l.has(h)||assignRef(h,null)}),l.forEach(function(h){c.has(h)||assignRef(h,d)})}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 l=useMotionValue(""),d=useMotionValue("none"),{toWindowPosition:h,getCamera:p,toXYZ:y,isPositionVisible:S}=useContext(),P=React.useRef(null);usePreRender(()=>{if(P.current==null)return;let N;try{const J=h==null?void 0:h([c.x,c.y,c.z]);N=new Cartesian2(J==null?void 0:J[0],J==null?void 0:J[1])}catch{d.set("none");return}const z=p==null?void 0:p();if(!z)return;const W=y==null?void 0:y(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||!(S!=null&&S([c.x,c.y,c.z]))){d.set("none");return}const ai=`calc(${N.x}px - 50%)`,mt=`calc(${N.y}px - 50%)`;l.set(`translate(${ai}, ${mt})`),d.set("block")});const L=useMergeRefs([P,s]);return jsxRuntimeExports.jsx(motion.div,{ref:L,...o,style:{...o.style,transform:l,display:d,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)),l=React.useMemo(()=>({polyline:{positions:c,width:1.5,material:new PolylineDashMaterialProperty({color:o,dashLength:8})}}),[o,c]);return jsxRuntimeExports.jsx(Entity,{...l})},ExtrudedMeasurement=({a:t,b:n,extrudedHeight:o,color:s,showLine:c})=>{const l=useConstant$2(()=>new Cartesian3);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ScreenSpaceElement,{position:Cartesian3.midpoint(t,n,l),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:l,centroidBasePoint:d,centroidExtrudedPoint:h,catchedExtrudedPoint:p,handleControlPointMouseEvent:y})=>{const S=t[t.length-1],P=l?new Cartesian3(...l):void 0,L=d?new Cartesian3(...d):void 0,N=h?new Cartesian3(...h):void 0;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[P&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ControlPoint,{index:-1,position:P,isEditing:c,isExtrudedControlPoint:!0,handleControlPointMouseEvent:y}),(!c||p)&&jsxRuntimeExports.jsx(ExtrudedMeasurement,{a:S,b:P,extrudedHeight:o,color:c?Color$1.fromCssColorString(DEFAULT_EDIT_COLOR):s,showLine:n!=="extrudedPolygon"})]}),L&&jsxRuntimeExports.jsx(ControlPoint,{index:-1,position:L,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:l})=>{const d=React.useRef(n);d.current=n;const p=useConstant$2(()=>new CallbackProperty(()=>d.current,!1)),y=React.useRef(o);y.current=o;const P=useConstant$2(()=>new CallbackProperty(()=>y.current,!1)),L=React.useMemo(()=>({polygon:{hierarchy:p,heightReference:HeightReference$1.RELATIVE_TO_TERRAIN,extrudedHeight:P,extrudedHeightReference:HeightReference$1.RELATIVE_TO_TERRAIN,fill:!0,outline:!0,outlineWidth:1,outlineColor:l?Color$1.fromCssColorString(DEFAULT_EDIT_COLOR):s==null?void 0:s.withAlpha(1),material:new ColorMaterialProperty(l?s==null?void 0:s.withAlpha(.2):s),classificationType:ClassificationType$1.TERRAIN,shadows:c?ShadowMode$1.DISABLED:ShadowMode$1.ENABLED}}),[P,c,p,s,l]),{requestRender:N}=useContext();return N==null||N(),jsxRuntimeExports.jsx(Entity,{id:t,...L})},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)),l=t?c:n,d=React.useMemo(()=>({polygon:{hierarchy:l,fill:!0,material:o==null?void 0:o.withAlpha(.5),classificationType:ClassificationType$1.TERRAIN}}),[o,l]),{requestRender:h}=useContext();return h==null||h(),jsxRuntimeExports.jsx(Entity,{...d})},PolylineEntity=({dynamic:t=!1,positions:n,color:o,isEditing:s})=>{const c=React.useRef(n);c.current=n;const l=useConstant$2(()=>new CallbackProperty(()=>c.current,!t)),d=t?l:n,h=React.useMemo(()=>({polyline:{positions:d,width:1.5,material:s?Color$1.fromCssColorString(DEFAULT_EDIT_COLOR):o,classificationType:ClassificationType$1.TERRAIN,clampToGround:!0}}),[o,d,s]),{requestRender:p}=useContext();return p==null||p(),jsxRuntimeExports.jsx(Entity,{...h})},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 l=0;l<n.length-1;l++){const d=n[l+1],h=Cartesian3.midpoint(n[l],d,cartesianScratch1$1);c.push(h.clone())}if(t==="polygon"||t==="extrudedPolygon"){const l=Cartesian3.midpoint(n[n.length-1],n[0],cartesianScratch1$1);c.push(l.clone())}return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:c.map((l,d)=>jsxRuntimeExports.jsx(ControlPoint,{position:l,isAddingPoint:!0,index:d,clampToGround:!0,isEditing:o,handleControlPointMouseEvent:()=>s==null?void 0:s([l.x,l.y,l.z],d)},d))})});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)),l=React.useMemo(()=>({polyline:{positions:c,width:1.5,material:new PolylineDashMaterialProperty({color:o,dashLength:8}),classificationType:ClassificationType$1.TERRAIN,clampToGround:!0}}),[o,c]),{requestRender:d}=useContext();return d==null||d(),jsxRuntimeExports.jsx(Entity,{...l})},SurfaceMeasurement=({a:t,b:n,color:o,showLine:s=!1})=>{const c=useConstant$2(()=>new Cartesian3),{getSurfaceDistance:l}=useContext(),d=l==null?void 0:l(t,n);return d!==void 0?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ScreenSpaceElement,{position:Cartesian3.midpoint(t,n,c),children:jsxRuntimeExports.jsx(MeasurementText,{children:d<1e3?`${d.toFixed(1)} m`:`${(d/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:l,handleControlPointMouseEvent:d})=>{const h=[];if(n.length>=2)if(s){if(c!==void 0&&c!==-1)switch(t){case"polyline":c>0&&h.push({points:[n[c-1],n[c]],showLine:!1}),c<n.length-1&&h.push({points:[n[c],n[c+1]],showLine:!1});break;case"circle":case"extrudedCircle":c!==2&&h.push({points:[n[0],n[1]],showLine:!0});break;case"rectangle":case"extrudedRectangle":if(c<=1)h.push({points:[n[0],n[1]],showLine:!1});else if(c===2){const[p,y,S]=n,P=Cartesian3.midpoint(p,y,cartesianScratch1);h.push({points:[P,S],showLine:!0})}break;case"polygon":case"extrudedPolygon":h.push({points:[n[c],c===0?n[n.length-1]:n[c-1]],showLine:!1}),h.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)h.push({points:n,showLine:!0});else if(n.length===3){const[p,y,S]=n,P=Cartesian3.midpoint(p,y,cartesianScratch1);h.push({points:[P,S],showLine:!0})}break;default:h.push({points:n.slice(-2),showLine:t==="circle"});break}return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[n.map((p,y)=>jsxRuntimeExports.jsx(ControlPoint,{position:p,index:y,isSelected:l===y,clampToGround:!0,isEditing:s,handleControlPointMouseEvent:d},y)),h.map(({points:p,showLine:y},S)=>jsxRuntimeExports.jsx(SurfaceMeasurement,{a:p[0],b:p[1],color:s?Color$1.fromCssColorString(DEFAULT_EDIT_COLOR):o,showLine:y},S))]})});SurfaceControlPoints.displayName="SurfaceControlPoints";const SketchComponent=React.memo(({geometryOptions:t,extrudedHeight:n,disableShadow:o,color:s,isEditing:c,extrudedPoint:l,centroidBasePoint:d,centroidExtrudedPoint:h,catchedControlPointIndex:p,catchedExtrudedPoint:y,selectedControlPointIndex:S,handleControlPointMouseEvent:P,handleAddControlPoint:L})=>{const N=React.useMemo(()=>t?{...t,controlPoints:t==null?void 0:t.controlPoints.map(J=>new Cesium$1.Cartesian3(...J))}:null,[t]),z=React.useMemo(()=>N?createGeometry(N):null,[N]),{positionsArray:W,hierarchyArray:ai}=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]),mt=React.useMemo(()=>Color$1.fromCssColorString(s??DEFAULT_SKETCH_COLOR),[s]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[W==null?void 0:W.map((J,pi)=>jsxRuntimeExports.jsx(PolylineEntity,{dynamic:!0,positions:J,color:mt,isEditing:c},pi)),ai==null?void 0:ai.map((J,pi)=>jsxRuntimeExports.jsx(PolygonEntity,{dynamic:!0,hierarchy:J,color:mt},pi)),N!=null&&(!n||c)&&jsxRuntimeExports.jsx(SurfaceControlPoints,{geometryOptions:N,color:mt,isEditing:c,catchedControlPointIndex:p,selectedControlPointIndex:S,handleControlPointMouseEvent:P}),N!=null&&c&&jsxRuntimeExports.jsx(SurfaceAddingPoints,{geometryOptions:N,isEditing:c,handleAddControlPoint:L}),N!=null&&n&&jsxRuntimeExports.jsx(ExtrudedControlPoints,{geometryOptions:N,extrudedHeight:n,extrudedPoint:l,centroidBasePoint:d,centroidExtrudedPoint:h,catchedExtrudedPoint:y,color:mt,isEditing:c,handleControlPointMouseEvent:P}),n&&(ai==null?void 0:ai.map((J,pi)=>jsxRuntimeExports.jsx(ExtrudedPolygonEntity,{hierarchy:J,extrudedHeight:n,disableShadow:o,color:mt,isEditing:c},pi)))]})});SketchComponent.displayName="SketchComponent";const Cesium=({className:t,style:n,property:o,time:s,camera:c,small:l,ready:d,children:h,selectedLayerId:p,isLayerDraggable:y,isLayerDragging:S,shouldRender:P,layerSelectionReason:L,meta:N,displayCredits:z,layersRef:W,featureFlags:ai,requestingRenderMode:mt,timelineManagerRef:J,cameraForceHorizontalRoll:pi,onLayerSelect:fa,onCameraChange:ma,onLayerDrag:Sa,onLayerDrop:Ra,onLayerEdit:Vs,onLayerSelectWithRectStart:La,onLayerSelectWithRectMove:Zs,onLayerSelectWithRectEnd:Xs,onMount:Wa,onLayerVisibility:ea,onLayerLoad:ui,onCreditsUpdate:ba},ms)=>{var Xd,Gd,nf,uf,Vd,rf,sf,mf,ff,Cf,bf,If,zf,xf,Tf,Nf,Lf,Uf,Hf,Jf,Qf,wf,Vf,Df,Bf,Yf,qf,_m,Rf,of,vf,Mf,Ff,Gf,Kf,sp,lp,pp,gp,yp,$m,jm;const{cesium:yu,mouseEventHandles:pu,cesiumIonAccessToken:Nl,context:pd,layerSelectWithRectEventHandlers:Sc,sceneLight:Ru,sceneBackgroundColor:gd,sceneMsaaSamples:Zd,sceneMode:ef,cameraViewBoundaries:df,cameraViewOuterBoundaries:hf,cameraViewBoundariesMaterial:yf,handleCameraChange:pf,handleCameraMoveEnd:lf,handleUpdate:_f,handleClick:Ef,handleMount:Sf,handleUnmount:al,handleTilesChange:cf,handleTerrainProviderChange:tf}=useHooks$1({ref:ms,property:o,time:s,selectedLayerId:p,selectionReason:L,meta:N,layersRef:W,featureFlags:ai,timelineManagerRef:J,isLayerDraggable:y,isLayerDragging:S,shouldRender:P,requestingRenderMode:mt,camera:c,cameraForceHorizontalRoll:pi,onLayerDrag:Sa,onLayerDrop:Ra,onLayerSelect:fa,onLayerEdit:Vs,onLayerSelectWithRectStart:La,onLayerSelectWithRectMove:Zs,onLayerSelectWithRectEnd:Xs,onLayerVisibility:ea,onLayerLoad:ui,onCameraChange:ma,onMount:Wa,onCreditsUpdate:ba});return jsxRuntimeExports.jsxs(Ms$1,{ref:yu,onUpdate:_f,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:l?"300px":"auto",height:l?"300px":"100%",display:d?void 0:"none",cursor:S?"grab":void 0,...n},shadows:!!((Gd=(Xd=o==null?void 0:o.scene)==null?void 0:Xd.shadow)!=null&&Gd.enabled),onClick:Ef,onDoubleClick:pu.doubleClick,onMouseDown:pu.mouseDown,onMouseUp:pu.mouseUp,onRightClick:pu.rightClick,onRightDown:pu.rightDown,onRightUp:pu.rightUp,onMiddleClick:pu.middleClick,onMiddleDown:pu.middleDown,onMiddleUp:pu.middleUp,onMouseMove:pu.mouseMove,onMouseEnter:pu.mouseEnter,onMouseLeave:pu.mouseLeave,onWheel:pu.wheel,children:[jsxRuntimeExports.jsx(Event,{onMount:Sf,onUnmount:al}),jsxRuntimeExports.jsx(ReearthClock,{timelineManagerRef:J}),jsxRuntimeExports.jsx(ImageryLayers,{tiles:o==null?void 0:o.tiles,cesiumIonAccessToken:Nl,onTilesChange:cf}),jsxRuntimeExports.jsx(LabelImageryLayers,{tileLabels:o==null?void 0:o.tileLabels}),jsxRuntimeExports.jsx(Indicator,{property:o,timelineManagerRef:J}),jsxRuntimeExports.jsxs(ws$1,{useDefault:!0,children:[jsxRuntimeExports.jsx(Es$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_CLICK}),jsxRuntimeExports.jsx(Es$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_DOUBLE_CLICK})]}),jsxRuntimeExports.jsxs(ws$1,{children:[jsxRuntimeExports.jsx(Es$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_DOWN,action:Sc.start.handler}),jsxRuntimeExports.jsx(Es$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_DOWN,modifier:Cesium$1.KeyboardEventModifier.SHIFT,action:Sc.start.shift}),jsxRuntimeExports.jsx(Es$1,{type:Cesium$1.ScreenSpaceEventType.MOUSE_MOVE,action:Sc.move.handler}),jsxRuntimeExports.jsx(Es$1,{type:Cesium$1.ScreenSpaceEventType.MOUSE_MOVE,modifier:Cesium$1.KeyboardEventModifier.SHIFT,action:Sc.move.shift}),jsxRuntimeExports.jsx(Es$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_UP,action:Sc.end.handler}),jsxRuntimeExports.jsx(Es$1,{type:Cesium$1.ScreenSpaceEventType.LEFT_UP,modifier:Cesium$1.KeyboardEventModifier.SHIFT,action:Sc.end.shift})]}),jsxRuntimeExports.jsx(Ss$1,{maximumZoomDistance:(uf=(nf=o==null?void 0:o.camera)==null?void 0:nf.limiter)!=null&&uf.enabled?((sf=(rf=(Vd=o.camera)==null?void 0:Vd.limiter)==null?void 0:rf.targetArea)==null?void 0:sf.height)??Number.POSITIVE_INFINITY:Number.POSITIVE_INFINITY,enableCollisionDetection:!((mf=o==null?void 0:o.camera)!=null&&mf.allowEnterGround)}),jsxRuntimeExports.jsx(hr$1,{percentageChanged:.2,onChange:pf,onMoveEnd:lf}),df&&((Cf=(ff=o==null?void 0:o.camera)==null?void 0:ff.limiter)==null?void 0:Cf.showHelper)&&jsxRuntimeExports.jsx(Lr$1,{children:jsxRuntimeExports.jsx(ns$1,{positions:df,width:1,material:Cesium$1.Color.RED,arcType:Cesium$1.ArcType.RHUMB})}),hf&&((If=(bf=o==null?void 0:o.camera)==null?void 0:bf.limiter)==null?void 0:If.showHelper)&&jsxRuntimeExports.jsx(Lr$1,{children:jsxRuntimeExports.jsx(ns$1,{positions:hf,width:1,material:yf,arcType:Cesium$1.ArcType.RHUMB})}),jsxRuntimeExports.jsx(Ps$1,{backgroundColor:gd,light:Ru,mode:ef,msaaSamples:Zd,useDepthPicking:!1,useWebVR:!!((zf=o==null?void 0:o.scene)!=null&&zf.vr)||void 0,debugShowFramesPerSecond:!!((xf=o==null?void 0:o.debug)!=null&&xf.showFramesPerSecond),verticalExaggerationRelativeHeight:(Tf=o==null?void 0:o.scene)==null?void 0:Tf.verticalExaggerationRelativeHeight,verticalExaggeration:(Nf=o==null?void 0:o.scene)==null?void 0:Nf.verticalExaggeration}),jsxRuntimeExports.jsx($s$1,{show:((Uf=(Lf=o==null?void 0:o.sky)==null?void 0:Lf.skyBox)==null?void 0:Uf.show)??!0}),jsxRuntimeExports.jsx(Gr$1,{enabled:((Jf=(Hf=o==null?void 0:o.sky)==null?void 0:Hf.fog)==null?void 0:Jf.enabled)??!0,density:(wf=(Qf=o==null?void 0:o.sky)==null?void 0:Qf.fog)==null?void 0:wf.density}),jsxRuntimeExports.jsx(Rs$1,{show:((Df=(Vf=o==null?void 0:o.sky)==null?void 0:Vf.sun)==null?void 0:Df.show)??!0}),jsxRuntimeExports.jsx(qr$1,{show:((Yf=(Bf=o==null?void 0:o.sky)==null?void 0:Bf.moon)==null?void 0:Yf.show)??!0}),jsxRuntimeExports.jsx(Ds$1,{show:((_m=(qf=o==null?void 0:o.sky)==null?void 0:qf.skyAtmosphere)==null?void 0:_m.show)??!0,atmosphereLightIntensity:(of=(Rf=o==null?void 0:o.sky)==null?void 0:Rf.skyAtmosphere)==null?void 0:of.lightIntensity,saturationShift:(Mf=(vf=o==null?void 0:o.sky)==null?void 0:vf.skyAtmosphere)==null?void 0:Mf.saturationShift,brightnessShift:(Gf=(Ff=o==null?void 0:o.sky)==null?void 0:Ff.skyAtmosphere)==null?void 0:Gf.brightnessShift}),jsxRuntimeExports.jsx(Globe,{property:o,cesiumIonAccessToken:Nl,onTerrainProviderChange:tf}),jsxRuntimeExports.jsx(context.Provider,{value:pd,children:d?h:null}),jsxRuntimeExports.jsx(AmbientOcclusion,{...AMBIENT_OCCLUSION_QUALITY[((sp=(Kf=o==null?void 0:o.render)==null?void 0:Kf.ambientOcclusion)==null?void 0:sp.quality)||"low"],enabled:!!((pp=(lp=o==null?void 0:o.render)==null?void 0:lp.ambientOcclusion)!=null&&pp.enabled),intensity:((yp=(gp=o==null?void 0:o.render)==null?void 0:gp.ambientOcclusion)==null?void 0:yp.intensity)??100,outputType:(jm=($m=o==null?void 0:o.render)==null?void 0:$m.ambientOcclusion)!=null&&jm.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.51",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(l=>{var y,S;const[d]=l;let h,p;if(d.contentBoxSize){const P=Array.isArray(d.contentBoxSize)?d.contentBoxSize[0]:d.contentBoxSize;h=P.inlineSize,p=P.blockSize}else d.contentRect?(h=d.contentRect.width,p=d.contentRect.height):(h=(y=t.current)==null?void 0:y.clientWidth,p=(S=t.current)==null?void 0:S.clientHeight);s(P=>({width:h,height:p,isMobile:h?h<=viewportMobileMaxWidth:void 0,query:P.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:l,onInteractionModeChange:d,onZoomToLayer:h,onLayerDrop:p,onSketchTypeChangeProp:y},S){const P=React.useRef(null);React.useImperativeHandle(S,()=>P.current,[]);const L=React.useRef(null),N=useViewport({wrapperRef:L}),[z,W]=React.useState({}),[ai,mt]=React.useState(),[J,pi]=React.useState(),fa=React.useCallback(async(xf,Tf,Nf,Lf,Uf)=>{var wf,Vf,Df,Bf,Yf,qf,_m,Rf,of,vf,Mf,Ff;const Hf=((Vf=(wf=z.layer)==null?void 0:wf.layer)==null?void 0:Vf.type)==="simple"&&((Yf=(Bf=(Df=z.layer)==null?void 0:Df.layer)==null?void 0:Bf.data)==null?void 0:Yf.isSketchLayer);if(z.layerId===xf&&z.featureId===Tf&&!Hf)return;const Jf=await(Nf==null?void 0:Nf()),Qf=xf&&Tf?(Hf?(qf=Jf==null?void 0:Jf.features)==null?void 0:qf.find(Gf=>Gf.id===Tf):(of=(_m=P.current)==null?void 0:(Rf=_m.engine).findComputedFeatureById)==null?void 0:of.call(Rf,xf,Tf))??(Uf==null?void 0:Uf.feature):void 0;mt(xf&&Tf?(Ff=(vf=P.current)==null?void 0:(Mf=vf.engine).findFeatureById)==null?void 0:Ff.call(Mf,xf,Tf):void 0),pi(Qf),W(Gf=>Gf.layerId===xf&&Gf.featureId===Tf?Gf:{layerId:xf,featureId:Tf,layer:Jf,reason:Lf}),c==null||c(xf,Nf,Qf,Lf)},[z,c]),ma=React.useRef(void 0),[Sa,Ra]=useValue(t,l),[Vs,La]=React.useState(!1),Zs=React.useCallback(xf=>{La(!!xf)},[]),[Xs,Wa]=useValue(n||"default",d);React.useEffect(()=>{var xf,Tf;Xs==="default"&&((Tf=(xf=P==null?void 0:P.current)==null?void 0:xf.engine)==null||Tf.setCursor("auto"))},[Xs]);const ea=INTERACTION_MODES[Xs??"default"],ui=React.useRef(void 0),ba=React.useCallback(xf=>{ui.current=xf},[]),ms=React.useCallback(xf=>{var Tf;(Tf=ui.current)==null||Tf.call(ui,xf)},[]),yu=React.useRef(void 0),pu=React.useCallback(xf=>{yu.current=xf},[]),Nl=React.useCallback(xf=>{var Tf;(Tf=yu.current)==null||Tf.call(yu,xf)},[]),pd=React.useRef(void 0),Sc=React.useCallback(xf=>{pd.current=xf},[]),Ru=React.useCallback(xf=>{var Tf;(Tf=pd.current)==null||Tf.call(pd,xf)},[]),gd=React.useRef(void 0),Zd=React.useCallback(xf=>{gd.current=xf},[]),ef=React.useCallback(xf=>{var Tf;(Tf=gd.current)==null||Tf.call(gd,xf)},[]),df=React.useRef(void 0),hf=React.useCallback(xf=>{df.current=xf},[]),yf=React.useCallback(xf=>{var Tf;(Tf=df.current)==null||Tf.call(df,xf)},[]),pf=React.useRef(void 0),lf=React.useCallback(xf=>{pf.current=xf},[]),_f=React.useCallback(xf=>{var Tf;(Tf=pf.current)==null||Tf.call(pf,xf)},[]),Ef=React.useRef([]),Sf=React.useCallback(xf=>{Ef.current.push(xf)},[]),al=React.useCallback(xf=>{Ef.current.forEach(Tf=>Tf(xf))},[]),cf=React.useRef([]),tf=React.useCallback(xf=>{cf.current.push(xf)},[]),Xd=React.useCallback(xf=>{cf.current.forEach(Tf=>Tf(xf))},[]),Gd=React.useRef([]),nf=React.useCallback(xf=>{Gd.current.push(xf)},[]),uf=React.useCallback(xf=>{Gd.current.forEach(Tf=>Tf(xf))},[]),Vd=React.useRef([]),rf=React.useCallback(xf=>{Vd.current.push(xf)},[]),sf=React.useCallback((xf,Tf)=>{Vd.current.forEach(Nf=>Nf(xf)),y==null||y(xf,Tf)},[y]);React.useEffect(()=>{var xf,Tf;o&&((Tf=(xf=P.current)==null?void 0:xf.engine)==null||Tf.lookAtLayer(o),h==null||h(void 0))},[o,h]);const[mf,ff]=React.useState(!1),Cf=React.useCallback(()=>{ff(!0)},[]),bf=React.useCallback((xf,Tf,Nf)=>{var Hf;ff(!1);const Lf=(Hf=P.current)==null?void 0:Hf.layers.findById(xf),Uf=Lf!=null&&Lf.property.default.location?"default.location":Lf!=null&&Lf.property.default.position?"default.position":void 0;Nf&&Lf&&Lf.propertyId&&Uf&&(p==null||p(Lf.propertyId,Uf,Nf))},[p,P]),If=React.useMemo(()=>({interactionMode:Xs,selectedLayer:z,selectedComputedFeature:J,viewport:N,handleCameraForceHorizontalRollChange:Zs,handleInteractionModeChange:Wa,onSketchPluginFeatureCreate:Sf,onSketchPluginFeatureUpdate:tf,onSketchPluginFeatureDelete:nf,onSketchTypeChange:rf,onLayerVisibility:pu,onLayerLoad:Sc,onLayerEdit:ba,onLayerSelectWithRectStart:Zd,onLayerSelectWithRectMove:hf,onLayerSelectWithRectEnd:lf}),[Xs,z,J,N,Wa,Zs,ba,Sf,tf,nf,rf,pu,Sc,Zd,hf,lf]),zf=React.useMemo(()=>({position:"relative",width:"100%",height:"100%",overflow:"hidden"}),[]);return useCoreAPI({viewerProperty:s}),{mapRef:P,wrapperRef:L,selectedFeature:ai,camera:Sa,featureFlags:ea,isLayerDragging:mf,timelineManagerRef:ma,cameraForceHorizontalRoll:Vs,coreContextValue:If,containerStyle:zf,overriddenInteractionMode:Xs,handleLayerSelect:fa,handleLayerDrag:Cf,handleLayerDrop:bf,handleLayerEdit:ms,handleCameraChange:Ra,handleInteractionModeChange:Wa,handleSketchPluginFeatureCreate:al,handleSketchPluginFeatureUpdate:Xd,handleSketchPluginFeatureDelete:uf,handleSketchTypeChange:sf,handleLayerVisibility:Nl,handleLayerLoad:Ru,handleLayerSelectWithRectStart:ef,handleLayerSelectWithRectMove:yf,handleLayerSelectWithRectEnd:_f}}function useValue(t,n){const[o,s]=React.useState(t),c=React.useCallback(l=>{l&&(s(l),n==null||n(l))},[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:l,small:d,ready:h,hiddenLayers:p,camera:y,time:S,interactionMode:P,shouldRender:L,meta:N,displayCredits:z=!0,style:W,zoomedLayerId:ai,children:mt,onLayerDrop:J,onLayerSelect:pi,onCameraChange:fa,onZoomToLayer:ma,onInteractionModeChange:Sa,onMount:Ra,onSketchTypeChangeProp:Vs,onSketchFeatureCreate:La,onSketchFeatureUpdate:Zs,onSketchFeatureDelete:Xs,onAPIReady:Wa,onCreditsUpdate:ea},ui)=>{const{mapRef:ba,wrapperRef:ms,selectedFeature:yu,camera:pu,featureFlags:Nl,isLayerDragging:pd,timelineManagerRef:Sc,cameraForceHorizontalRoll:Ru,coreContextValue:gd,containerStyle:Zd,overriddenInteractionMode:ef,handleLayerSelect:df,handleLayerDrag:hf,handleLayerDrop:yf,handleLayerEdit:pf,handleCameraChange:lf,handleInteractionModeChange:_f,handleSketchPluginFeatureCreate:Ef,handleSketchPluginFeatureUpdate:Sf,handleSketchPluginFeatureDelete:al,handleSketchTypeChange:cf,handleLayerVisibility:tf,handleLayerLoad:Xd,handleLayerSelectWithRectStart:Gd,handleLayerSelectWithRectMove:nf,handleLayerSelectWithRectEnd:uf}=useHooks({camera:y,interactionMode:P,zoomedLayerId:ai,viewerProperty:s,onLayerSelect:pi,onCameraChange:fa,onZoomToLayer:ma,onLayerDrop:J,onInteractionModeChange:Sa,onSketchTypeChangeProp:Vs},ui);return jsxRuntimeExports.jsx(ErrorBoundary,{FallbackComponent:Error$1,children:jsxRuntimeExports.jsx(VisualizerProvider,{mapRef:ba,children:jsxRuntimeExports.jsxs("div",{ref:ms,style:Zd,children:[jsxRuntimeExports.jsx(Map$1,{ref:ba,isBuilt:n,isEditable:o,engine:t,layers:c,engines,camera:pu,cameraForceHorizontalRoll:Ru,clusters:l,hiddenLayers:p,isLayerDragging:pd,isLayerDraggable:o,meta:N,displayCredits:z,style:W,featureFlags:Nl,shouldRender:L,property:s,time:S,small:d,ready:h,timelineManagerRef:Sc,interactionMode:ef,selectedFeature:yu,onCameraChange:lf,onLayerDrag:hf,onLayerDrop:yf,onLayerSelect:df,onLayerEdit:pf,overrideInteractionMode:_f,onSketchFeatureCreate:La,onSketchPluginFeatureCreate:Ef,onSketchFeatureUpdate:Zs,onSketchPluginFeatureUpdate:Sf,onSketchFeatureDelete:Xs,onSketchPluginFeatureDelete:al,onSketchTypeChange:cf,onMount:Ra,onLayerVisibility:tf,onLayerLoad:Xd,onLayerSelectWithRectStart:Gd,onLayerSelectWithRectMove:nf,onLayerSelectWithRectEnd:uf,onAPIReady:Wa,onCreditsUpdate:ea}),jsxRuntimeExports.jsx(coreContext.Provider,{value:gd,children:mt})]})})})}));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,l,d,h=t.length;if(h%4>0)throw new Error("Invalid string. Length must be a multiple of 4");l=t[h-2]==="="?2:t[h-1]==="="?1:0,d=new Arr(h*3/4-l),s=l>0?h-4:h;var p=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)],d[p++]=c>>16&255,d[p++]=c>>8&255,d[p++]=c&255;return l===2?(c=revLookup[t.charCodeAt(n)]<<2|revLookup[t.charCodeAt(n+1)]>>4,d[p++]=c&255):l===1&&(c=revLookup[t.charCodeAt(n)]<<10|revLookup[t.charCodeAt(n+1)]<<4|revLookup[t.charCodeAt(n+2)]>>2,d[p++]=c>>8&255,d[p++]=c&255),d}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=[],l=n;l<o;l+=3)s=(t[l]<<16)+(t[l+1]<<8)+t[l+2],c.push(tripletToBase64(s));return c.join("")}function fromByteArray(t){inited||init();for(var n,o=t.length,s=o%3,c="",l=[],d=16383,h=0,p=o-s;h<p;h+=d)l.push(encodeChunk(t,h,h+d>p?p:h+d));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+="="),l.push(c),l.join("")}function read(t,n,o,s,c){var l,d,h=c*8-s-1,p=(1<<h)-1,y=p>>1,S=-7,P=o?c-1:0,L=o?-1:1,N=t[n+P];for(P+=L,l=N&(1<<-S)-1,N>>=-S,S+=h;S>0;l=l*256+t[n+P],P+=L,S-=8);for(d=l&(1<<-S)-1,l>>=-S,S+=s;S>0;d=d*256+t[n+P],P+=L,S-=8);if(l===0)l=1-y;else{if(l===p)return d?NaN:(N?-1:1)*(1/0);d=d+Math.pow(2,s),l=l-y}return(N?-1:1)*d*Math.pow(2,l-s)}function write(t,n,o,s,c,l){var d,h,p,y=l*8-c-1,S=(1<<y)-1,P=S>>1,L=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,N=s?0:l-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?(h=isNaN(n)?1:0,d=S):(d=Math.floor(Math.log(n)/Math.LN2),n*(p=Math.pow(2,-d))<1&&(d--,p*=2),d+P>=1?n+=L/p:n+=L*Math.pow(2,1-P),n*p>=2&&(d++,p/=2),d+P>=S?(h=0,d=S):d+P>=1?(h=(n*p-1)*Math.pow(2,c),d=d+P):(h=n*Math.pow(2,P-1)*Math.pow(2,c),d=0));c>=8;t[o+N]=h&255,N+=z,h/=256,c-=8);for(d=d<<c|h,y+=c;y>0;t[o+N]=d&255,N+=z,d/=256,y-=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,l=0,d=Math.min(s,c);l<d;++l)if(n[l]!==o[l]){s=n[l],c=o[l];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),l=0;for(s=0;s<n.length;++s){var d=n[s];if(!internalIsBuffer(d))throw new TypeError('"list" argument must be an Array of Buffers');d.copy(c,l),l+=d.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,l){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),l===void 0&&(l=this.length),o<0||s>n.length||c<0||l>this.length)throw new RangeError("out of range index");if(c>=l&&o>=s)return 0;if(c>=l)return-1;if(o>=s)return 1;if(o>>>=0,s>>>=0,c>>>=0,l>>>=0,this===n)return 0;for(var d=l-c,h=s-o,p=Math.min(d,h),y=this.slice(c,l),S=n.slice(o,s),P=0;P<p;++P)if(y[P]!==S[P]){d=y[P],h=S[P];break}return d<h?-1:h<d?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 l=1,d=t.length,h=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;l=2,d/=2,h/=2,o/=2}function p(N,z){return l===1?N[z]:N.readUInt16BE(z*l)}var y;if(c){var S=-1;for(y=o;y<d;y++)if(p(t,y)===p(n,S===-1?0:y-S)){if(S===-1&&(S=y),y-S+1===h)return S*l}else S!==-1&&(y-=y-S),S=-1}else for(o+h>d&&(o=d-h),y=o;y>=0;y--){for(var P=!0,L=0;L<h;L++)if(p(t,y+L)!==p(n,L)){P=!1;break}if(P)return y}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 l=n.length;if(l%2!==0)throw new TypeError("Invalid hex string");s>l/2&&(s=l/2);for(var d=0;d<s;++d){var h=parseInt(n.substr(d*2,2),16);if(isNaN(h))return d;t[o+d]=h}return d}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 l=this.length-o;if((s===void 0||s>l)&&(s=l),n.length>0&&(s<0||o<0)||o>this.length)throw new RangeError("Attempt to write outside buffer bounds");c||(c="utf8");for(var d=!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(d)throw new TypeError("Unknown encoding: "+c);c=(""+c).toLowerCase(),d=!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 l=t[c],d=null,h=l>239?4:l>223?3:l>191?2:1;if(c+h<=o){var p,y,S,P;switch(h){case 1:l<128&&(d=l);break;case 2:p=t[c+1],(p&192)===128&&(P=(l&31)<<6|p&63,P>127&&(d=P));break;case 3:p=t[c+1],y=t[c+2],(p&192)===128&&(y&192)===128&&(P=(l&15)<<12|(p&63)<<6|y&63,P>2047&&(P<55296||P>57343)&&(d=P));break;case 4:p=t[c+1],y=t[c+2],S=t[c+3],(p&192)===128&&(y&192)===128&&(S&192)===128&&(P=(l&15)<<18|(p&63)<<12|(y&63)<<6|S&63,P>65535&&P<1114112&&(d=P))}}d===null?(d=65533,h=1):d>65535&&(d-=65536,s.push(d>>>10&1023|55296),d=56320|d&1023),s.push(d),c+=h}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="",l=n;l<o;++l)c+=toHex(t[l]);return c}function utf16leSlice(t,n,o){for(var s=t.slice(n,o),c="",l=0;l<s.length;l+=2)c+=String.fromCharCode(s[l]+s[l+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 l=o-n;c=new Buffer$1(l,void 0);for(var d=0;d<l;++d)c[d]=this[d+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],l=1,d=0;++d<o&&(l*=256);)c+=this[n+d]*l;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],l=1;o>0&&(l*=256);)c+=this[n+--o]*l;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],l=1,d=0;++d<o&&(l*=256);)c+=this[n+d]*l;return l*=128,c>=l&&(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,l=1,d=this[n+--c];c>0&&(l*=256);)d+=this[n+--c]*l;return l*=128,d>=l&&(d-=Math.pow(2,8*o)),d},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,l){if(!internalIsBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>c||n<l)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 l=Math.pow(2,8*s)-1;checkInt(this,n,o,s,l,0)}var d=1,h=0;for(this[o]=n&255;++h<s&&(d*=256);)this[o+h]=n/d&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 l=Math.pow(2,8*s)-1;checkInt(this,n,o,s,l,0)}var d=s-1,h=1;for(this[o+d]=n&255;--d>=0&&(h*=256);)this[o+d]=n/h&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,l=Math.min(t.length-o,2);c<l;++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,l=Math.min(t.length-o,4);c<l;++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 l=Math.pow(2,8*s-1);checkInt(this,n,o,s,l-1,-l)}var d=0,h=1,p=0;for(this[o]=n&255;++d<s&&(h*=256);)n<0&&p===0&&this[o+d-1]!==0&&(p=1),this[o+d]=(n/h>>0)-p&255;return o+s},Buffer$1.prototype.writeIntBE=function t(n,o,s,c){if(n=+n,o=o|0,!c){var l=Math.pow(2,8*s-1);checkInt(this,n,o,s,l-1,-l)}var d=s-1,h=1,p=0;for(this[o+d]=n&255;--d>=0&&(h*=256);)n<0&&p===0&&this[o+d+1]!==0&&(p=1),this[o+d]=(n/h>>0)-p&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,l){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 l=c-s,d;if(this===n&&s<o&&o<c)for(d=l-1;d>=0;--d)n[d+o]=this[d+s];else if(l<1e3||!Buffer$1.TYPED_ARRAY_SUPPORT)for(d=0;d<l;++d)n[d+o]=this[d+s];else Uint8Array.prototype.set.call(n,this.subarray(s,s+l),o);return l},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 l=n.charCodeAt(0);l<256&&(n=l)}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 d;if(typeof n=="number")for(d=o;d<s;++d)this[d]=n;else{var h=internalIsBuffer(n)?n:utf8ToBytes(new Buffer$1(n,c).toString()),p=h.length;for(d=0;d<s-o;++d)this[d+o]=h[d%p]}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,l=[],d=0;d<s;++d){if(o=t.charCodeAt(d),o>55295&&o<57344){if(!c){if(o>56319){(n-=3)>-1&&l.push(239,191,189);continue}else if(d+1===s){(n-=3)>-1&&l.push(239,191,189);continue}c=o;continue}if(o<56320){(n-=3)>-1&&l.push(239,191,189),c=o;continue}o=(c-55296<<10|o-56320)+65536}else c&&(n-=3)>-1&&l.push(239,191,189);if(c=null,o<128){if((n-=1)<0)break;l.push(o)}else if(o<2048){if((n-=2)<0)break;l.push(o>>6|192,o&63|128)}else if(o<65536){if((n-=3)<0)break;l.push(o>>12|224,o>>6&63|128,o&63|128)}else if(o<1114112){if((n-=4)<0)break;l.push(o>>18|240,o>>12&63|128,o>>6&63|128,o&63|128)}else throw new Error("Invalid code point")}return l}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,l=[],d=0;d<t.length&&!((n-=2)<0);++d)o=t.charCodeAt(d),s=o>>8,c=o%256,l.push(c),l.push(s);return l}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),l=0;l<s;++l)c[l].call(o)}function emitOne(t,n,o,s){if(n)t.call(o,s);else for(var c=t.length,l=arrayClone(t,c),d=0;d<c;++d)l[d].call(o,s)}function emitTwo(t,n,o,s,c){if(n)t.call(o,s,c);else for(var l=t.length,d=arrayClone(t,l),h=0;h<l;++h)d[h].call(o,s,c)}function emitThree(t,n,o,s,c,l){if(n)t.call(o,s,c,l);else for(var d=t.length,h=arrayClone(t,d),p=0;p<d;++p)h[p].call(o,s,c,l)}function emitMany(t,n,o,s){if(n)t.apply(o,s);else for(var c=t.length,l=arrayClone(t,c),d=0;d<c;++d)l[d].apply(o,s)}EventEmitter.prototype.emit=function t(n){var o,s,c,l,d,h,p,y=n==="error";if(h=this._events,h)y=y&&h.error==null;else if(!y)return!1;if(p=this.domain,y){if(o=arguments[1],p)o||(o=new Error('Uncaught, unspecified "error" event')),o.domainEmitter=this,o.domain=p,o.domainThrown=!1,p.emit("error",o);else{if(o instanceof Error)throw o;var S=new Error('Uncaught, unspecified "error" event. ('+o+")");throw S.context=o,S}return!1}if(s=h[n],!s)return!1;var P=typeof s=="function";switch(c=arguments.length,c){case 1:emitNone(s,P,this);break;case 2:emitOne(s,P,this,arguments[1]);break;case 3:emitTwo(s,P,this,arguments[1],arguments[2]);break;case 4:emitThree(s,P,this,arguments[1],arguments[2],arguments[3]);break;default:for(l=new Array(c-1),d=1;d<c;d++)l[d-1]=arguments[d];emitMany(s,P,this,l)}return!0};function _addListener(t,n,o,s){var c,l,d;if(typeof o!="function")throw new TypeError('"listener" argument must be a function');if(l=t._events,l?(l.newListener&&(t.emit("newListener",n,o.listener?o.listener:o),l=t._events),d=l[n]):(l=t._events=new EventHandlers,t._eventsCount=0),!d)d=l[n]=o,++t._eventsCount;else if(typeof d=="function"?d=l[n]=s?[o,d]:[d,o]:s?d.unshift(o):d.push(o),!d.warned&&(c=$getMaxListeners(t),c&&c>0&&d.length>c)){d.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+d.length+" "+n+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=t,h.type=n,h.count=d.length,emitWarning(h)}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,l,d,h;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(l=-1,d=s.length;d-- >0;)if(s[d]===o||s[d].listener&&s[d].listener===o){h=s[d].listener,l=d;break}if(l<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,l);c.removeListener&&this.emit("removeListener",n,h||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),l=0,d;l<c.length;++l)d=c[l],d!=="removeListener"&&this.removeAllListeners(d);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&&currentQueue[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,l=String(t).replace(formatRegExp,function(h){if(h==="%%")return"%";if(o>=c)return h;switch(h){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 h}}),d=s[o];o<c;d=s[++o])isNull(d)||!isObject(d)?l+=" "+d:l+=" "+inspect(d);return l}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 l=Object.keys(n),d=arrayToHash(l);if(t.showHidden&&(l=Object.getOwnPropertyNames(n)),isError(n)&&(l.indexOf("message")>=0||l.indexOf("description")>=0))return formatError(n);if(l.length===0){if(isFunction(n)){var h=n.name?": "+n.name:"";return t.stylize("[Function"+h+"]","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 p="",y=!1,S=["{","}"];if(isArray(n)&&(y=!0,S=["[","]"]),isFunction(n)){var P=n.name?": "+n.name:"";p=" [Function"+P+"]"}if(isRegExp(n)&&(p=" "+RegExp.prototype.toString.call(n)),isDate(n)&&(p=" "+Date.prototype.toUTCString.call(n)),isError(n)&&(p=" "+formatError(n)),l.length===0&&(!y||n.length==0))return S[0]+p+S[1];if(o<0)return isRegExp(n)?t.stylize(RegExp.prototype.toString.call(n),"regexp"):t.stylize("[Object]","special");t.seen.push(n);var L;return y?L=formatArray(t,n,o,d,l):L=l.map(function(N){return formatProperty(t,n,o,d,N,y)}),t.seen.pop(),reduceToSingleString(L,p,S)}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 l=[],d=0,h=n.length;d<h;++d)hasOwnProperty(n,String(d))?l.push(formatProperty(t,n,o,s,String(d),!0)):l.push("");return c.forEach(function(p){p.match(/^\d+$/)||l.push(formatProperty(t,n,o,s,p,!0))}),l}function formatProperty(t,n,o,s,c,l){var d,h,p;if(p=Object.getOwnPropertyDescriptor(n,c)||{value:n[c]},p.get?p.set?h=t.stylize("[Getter/Setter]","special"):h=t.stylize("[Getter]","special"):p.set&&(h=t.stylize("[Setter]","special")),hasOwnProperty(s,c)||(d="["+c+"]"),h||(t.seen.indexOf(p.value)<0?(isNull(o)?h=formatValue(t,p.value,null):h=formatValue(t,p.value,o-1),h.indexOf(`
6748
6748
  `)>-1&&(l?h=h.split(`
6749
6749
  `).map(function(y){return" "+y}).join(`
6750
6750
  `).substr(2):h=`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reearth/core",
3
- "version": "0.0.7-alpha.50",
3
+ "version": "0.0.7-alpha.51",
4
4
  "author": "Re:Earth contributors <community@reearth.io>",
5
5
  "license": "Apache-2.0",
6
6
  "description": "A library that abstracts a map engine as one common API.",
@@ -119,8 +119,8 @@
119
119
  "jsdom": "22.1.0",
120
120
  "postcss": "8.5.6",
121
121
  "prettier": "3.1.0",
122
- "react": "19.0.0",
123
- "react-dom": "19.0.0",
122
+ "react": "19.0.1",
123
+ "react-dom": "19.0.1",
124
124
  "storybook": "8.4.7",
125
125
  "typescript": "5.2.2",
126
126
  "vite": "5.0.8",