{
  "version": 3,
  "sources": ["../../../../../node_modules/hsluv/dist/hsluv.cjs", "../../../../../node_modules/eventemitter3/index.js", "../../../../../node_modules/react-is/cjs/react-is.development.js", "../../../../../node_modules/react-is/index.js", "../../../../../node_modules/semver/internal/constants.js", "../../../../../node_modules/semver/internal/debug.js", "../../../../../node_modules/semver/internal/re.js", "../../../../../node_modules/semver/internal/parse-options.js", "../../../../../node_modules/semver/internal/identifiers.js", "../../../../../node_modules/semver/classes/semver.js", "../../../../../node_modules/semver/functions/parse.js", "../../../../../node_modules/semver/functions/valid.js", "../../../../../node_modules/semver/functions/clean.js", "../../../../../node_modules/semver/functions/inc.js", "../../../../../node_modules/semver/functions/diff.js", "../../../../../node_modules/semver/functions/major.js", "../../../../../node_modules/semver/functions/minor.js", "../../../../../node_modules/semver/functions/patch.js", "../../../../../node_modules/semver/functions/prerelease.js", "../../../../../node_modules/semver/functions/compare.js", "../../../../../node_modules/semver/functions/rcompare.js", "../../../../../node_modules/semver/functions/compare-loose.js", "../../../../../node_modules/semver/functions/compare-build.js", "../../../../../node_modules/semver/functions/sort.js", "../../../../../node_modules/semver/functions/rsort.js", "../../../../../node_modules/semver/functions/gt.js", "../../../../../node_modules/semver/functions/lt.js", "../../../../../node_modules/semver/functions/eq.js", "../../../../../node_modules/semver/functions/neq.js", "../../../../../node_modules/semver/functions/gte.js", "../../../../../node_modules/semver/functions/lte.js", "../../../../../node_modules/semver/functions/cmp.js", "../../../../../node_modules/semver/functions/coerce.js", "../../../../../node_modules/semver/internal/lrucache.js", "../../../../../node_modules/semver/classes/range.js", "../../../../../node_modules/semver/classes/comparator.js", "../../../../../node_modules/semver/functions/satisfies.js", "../../../../../node_modules/semver/ranges/to-comparators.js", "../../../../../node_modules/semver/ranges/max-satisfying.js", "../../../../../node_modules/semver/ranges/min-satisfying.js", "../../../../../node_modules/semver/ranges/min-version.js", "../../../../../node_modules/semver/ranges/valid.js", "../../../../../node_modules/semver/ranges/outside.js", "../../../../../node_modules/semver/ranges/gtr.js", "../../../../../node_modules/semver/ranges/ltr.js", "../../../../../node_modules/semver/ranges/intersects.js", "../../../../../node_modules/semver/ranges/simplify.js", "../../../../../node_modules/semver/ranges/subset.js", "../../../../../node_modules/semver/index.js", "../../../runtime/src/host/componentLoader/createErrorDefinition.ts", "../../../runtime/src/crossorigin/types.ts", "../../../runtime/src/crossorigin/localPackageFallbackIdentifier.ts", "../../../runtime/src/host/componentLoader/types.ts", "../../../runtime/src/host/componentLoader/componentLoader.ts", "../../../../library/src/render/utils/roundedNumber.ts", "../../../../library/src/render/types/Point.ts", "../../../../library/src/utils/safeWindow.ts", "../../../../library/src/render/types/RenderEnvironment.ts", "../../../../library/src/render/utils/degreesToRadians.ts", "../../../../library/src/render/types/Line.ts", "../../../../library/src/render/types/Rect.ts", "../../../../library/src/utils/deprecation.ts", "../../../../library/src/animation/Animatable/Observers.ts", "../../../../library/src/animation/Animatable/Animatable.ts", "../../../../library/src/utils/type-guards.ts", "../../../../library/src/render/utils/isFiniteNumber.ts", "../../../../library/src/render/types/Constraints.ts", "../../../../library/src/render/types/Color/CSSNames.ts", "../../../../library/src/render/types/Color/Utils.ts", "../../../../library/src/render/types/Color/types.ts", "../../../../library/src/render/types/Color/converters.ts", "../../../../library/src/render/types/Color/p3.ts", "../../../../library/src/render/types/Color/Color.ts", "../../../../library/src/render/presentation/Frame/index.tsx", "../../../../library/src/components/hoc/WithEvents.tsx", "../../../../library/src/core/EventEmitter.ts", "../../../../library/src/core/Time.ts", "../../../../library/src/core/Loop.ts", "../../../../library/src/utils/events.ts", "../../../../library/src/events/FramerEvent.ts", "../../../../library/src/components/hoc/WithDragging.tsx", "../../../../library/src/interpolation/Interpolation.ts", "../../../../library/src/interpolation/NumberInterpolation.ts", "../../../../library/src/animation/Animators/Integrator.ts", "../../../../library/src/animation/Animators/FrictionAnimator.ts", "../../../../library/src/animation/Animators/SpringCurveValueConverter.ts", "../../../../library/src/animation/Animators/SpringAnimator.ts", "../../../../library/src/animation/Animators/InertialScrollAnimator.ts", "../../../../library/src/animation/Drivers/AnimationDriver.ts", "../../../../library/src/animation/Drivers/MainLoopDriver.ts", "../../../../library/src/utils/asRecord.ts", "../../../../library/src/render/types/NewConstraints.tsx", "../../../../library/src/render/presentation/Frame/DeprecatedFrame.tsx", "../../../../library/src/data/ObservableObject.ts", "../../../../library/src/render/utils/corners.ts", "../../../../library/src/render/style/BorderComponent.tsx", "../../../../library/src/render/types/BackgroundImage.ts", "../../../../library/src/render/style/backgroundImageFromProps.ts", "../../../../library/src/render/utils/isMotionValue.ts", "../../../../library/src/utils/memoize.ts", "../../../../library/src/utils/string.ts", "../../../../library/src/render/types/Color/ConvertColor.ts", "../../../../library/src/render/utils/gradientColorStops.ts", "../../../../library/src/render/types/MultiStopGradient.ts", "../../../../library/src/render/types/SimpleGradient.ts", "../../../../library/src/render/types/LinearGradient.ts", "../../../../library/src/render/types/RadialGradient.ts", "../../../../library/src/render/traits/Background.ts", "../../../../library/src/render/traits/Blending.ts", "../../../../library/src/render/traits/Opacity.ts", "../../../../library/src/render/traits/Overflow.ts", "../../../../library/src/render/traits/Radius.ts", "../../../../library/src/render/traits/TextColor.ts", "../../../../library/src/render/types/Shadow.ts", "../../../../library/src/render/style/shadow.tsx", "../../../../library/src/render/utils/filtersForNode.ts", "../../../../library/src/render/style/collectVisualStyleFromProps.ts", "../../../../library/src/render/traits/Transform.ts", "../../../../library/src/render/utils/performanceDebugging.ts", "../../../../library/src/render/presentation/Layer.tsx", "../../../../library/src/render/utils/setLayerBacked.ts", "../../../../library/src/render/utils/useWebkitFixes.ts", "../../../../library/src/render/presentation/Frame/FrameWithMotion.tsx", "../../../../library/src/modules/useIsStaticRenderer.ts", "../../../../library/src/utils/isPropValid.ts", "../../../../library/src/render/style/BackgroundImageComponent.tsx", "../../../../library/src/render/style/getSrcSet.ts", "../../../../library/src/render/utils/getIntrinsicSizeForBackgroundImage.ts", "../../../../library/src/render/utils/htmlElementAsMotionComponent.ts", "../../../../library/src/modules/withCSS.tsx", "../../../../library/src/render/StyleSheetContext.ts", "../../../../library/src/render/utils/setDocumentStyles.ts", "../../../../library/src/modules/isFlexboxGapSupported.ts", "../../../../library/src/modules/workaroundFlexboxGapNotSupported.ts", "../../../../library/src/render/utils/injectDeprecatedRichTextRules.ts", "../../../../library/src/render/presentation/Forms/shared.ts", "../../../../library/src/render/utils/injectRichTextRules.ts", "../../../../library/src/render/utils/injectComponentCSSRules.ts", "../../../../library/src/render/utils/layoutHintDataPropsForCenter.ts", "../../../../library/src/render/utils/nodeIdFromString.ts", "../../../../library/src/render/utils/processOverrideForwarding.ts", "../../../../library/src/render/utils/transformTemplate.ts", "../../../../library/src/render/utils/useLayoutId.ts", "../../../../library/src/components/AnimateLayout/LayoutIdContext.tsx", "../../../../library/src/render/utils/useMeasureLayout.ts", "../../../../library/src/useIsomorphicLayoutEffect.ts", "../../../../library/src/render/presentation/ComponentContainerContext.tsx", "../../../../library/src/components/hoc/withMeasuredSize.tsx", "../../../../library/src/modules/useForceUpdate.ts", "../../../../library/src/render/utils/getMeasurableCodeComponentChildren.ts", "../../../../library/src/render/utils/extractStyleFromProps.ts", "../../../../library/src/render/presentation/Frame/getStyleForFrameProps.ts", "../../../../library/src/render/presentation/Frame/isDeprecatedFrameProps.ts", "../../../runtime/src/components/RenderPlaceholder.tsx", "../../../runtime/src/renderingTaskQueues/index.ts", "../../../runtime/src/sandbox/actions/actionControls.ts", "../../../runtime/src/utils/executionTimeBudgets.ts", "../../../runtime/src/utils/experiments.ts", "../../../runtime/src/utils/projectFeatures.ts", "../../../runtime/src/utils/initializeRuntime.ts", "../../../../library/src/components/useNavigation.ts", "../../../../library/src/components/NavigationContext.ts", "../../../../library/src/components/NavigatorMock.tsx", "../../../runtime/src/sandbox/actions/useNavigate.ts", "../../../runtime/src/sandbox/actions/useSetVariant.ts", "../../../runtime/src/utils/getPackageModuleInfo.ts", "../../../runtime/src/host/componentLoader/isEditorComponentLoader.ts", "../../src/utils/withClassDiscriminator.ts", "../../src/document/models/CanvasTree/traits/VariableReference.ts", "../../src/document/utils/domainValidation.ts", "../../src/document/utils/validateCustomCanonicalURL.ts", "../../src/document/models/CanvasTree/traits/FetchDataValue.ts", "../../src/utils/getKeys.ts", "../../src/utils/titleCase.ts", "../../src/document/models/CanvasTree/traits/utils/isVariableType.ts", "../../src/document/models/CanvasTree/traits/ValueTransform.ts", "../../src/document/models/CanvasTree/traits/ComputedValue.ts", "../../src/document/models/CanvasTree/traits/DynamicValue.ts", "../../src/document/models/CanvasTree/traits/WithCollectionDataSource.ts", "../../src/document/models/CanvasTree/traits/WithLayout.ts", "../../src/document/models/CanvasTree/traits/WithTemplate.ts", "../../src/document/models/CanvasTree/nodes/utils/nodeCheck.ts", "../../src/document/models/CanvasTree/traits/WithSize.ts", "../../../../library/src/index.ts", "../../../../library/src/router/lazy.tsx", "../../../../library/src/router/lazyModulesCache.ts", "../../../../library/src/router/lazyModulesCollector.ts", "../../../../library/src/router/useRouteElementId.ts", "../../../../library/src/router/useCurrentRoute.tsx", "../../../../library/src/router/RouterContext.tsx", "../../../../library/src/router/useGetRouteCallback.ts", "../../../../library/src/router/useRoute.ts", "../../../../library/src/router/utils.ts", "../../../../library/src/router/useCurrentPathVariables.tsx", "../../../../library/src/router/useRouteHandler.ts", "../../../../library/src/router/useRoutePreloader.ts", "../../../../library/src/modules/LibraryFeaturesContext.ts", "../../../../library/src/modules/cms/CollectionUtilsCache.tsx", "../../../../library/src/router/types.ts", "../../../../library/src/modules/LazyValue.ts", "../../../../../node_modules/devalue/index.js", "../../../../../node_modules/devalue/src/utils.js", "../../../../../node_modules/devalue/src/uneval.js", "../../../../../node_modules/devalue/src/base64.js", "../../../../../node_modules/devalue/src/constants.js", "../../../../../node_modules/devalue/src/parse.js", "../../../../../node_modules/devalue/src/stringify.js", "../../../../library/src/utils/sendTrackingEvent.ts", "../../../../library/src/modules/dataHandover/dataHandover.ts", "../../../../library/src/utils/yield.ts", "../../../../library/src/router/history.ts", "../../../../library/src/router/computeRelativePath.ts", "../../../../library/src/router/customNotFoundPagePaths.ts", "../../../../library/src/router/fillPathVariables.ts", "../../../../library/src/router/forwardQueryParams.ts", "../../../../library/src/router/getLocalizedNavigationPath.ts", "../../../../library/src/router/getSitePrefix.ts", "../../../../library/src/router/pageEffects/useViewTransition.ts", "../../../../library/src/router/pageEffects/PageEffectsContext.tsx", "../../../../library/src/router/pageEffects/getPageEffect.ts", "../../../../library/src/router/pageEffects/cssGeneration/linearEasing.ts", "../../../../library/src/router/pageEffects/cssGeneration/masks.ts", "../../../../library/src/router/pageEffects/cssGeneration/page.ts", "../../../../library/src/router/pageEffects/cssGeneration/index.ts", "../../../../library/src/router/pageEffects/viewTransition.ts", "../../../../library/src/router/routerDomUtils.ts", "../../../../library/src/router/useMonitorNextPaintAfterRender.ts", "../../../../library/src/utils/useAfterPaintEffect.ts", "../../../../library/src/modules/useTracking.ts", "../../../../library/src/utils/slugify.ts", "../../../../library/src/modules/NodeIdContext.tsx", "../../../../library/src/router/queryParameters.tsx", "../../../../library/src/modules/RenderTargetEnvironmentContext.tsx", "../../../../library/src/router/useLocale.ts", "../../../../library/src/router/getLocalesForCurrentRoute.ts", "../../../../library/src/router/useRouteAnchor.ts", "../../../../library/src/router/hydration/reactHydrationINPOptimizer.ts", "../../../../library/src/render/presentation/Forms/useReplayPreHydrationInput.ts", "../../../../library/src/router/hydration/hydrationTimings.ts", "../../../../library/src/router/hydration/onlyRunOnce.ts", "../../../../library/src/router/error-boundary/NotFoundErrorBoundary.tsx", "../../../../library/src/router/renderPage.tsx", "../../../../library/src/router/inferInitialRouteFromPath.ts", "../../../../library/src/router/routeVariants.ts", "../../../../library/src/router/useMetadata.ts", "../../../../library/src/animation/Animators/BezierAnimator.ts", "../../../../library/src/interpolation/ColorInterpolation.ts", "../../../../library/src/interpolation/NoInterpolation.ts", "../../../../library/src/interpolation/ObjectInterpolation.ts", "../../../../library/src/interpolation/ValueInterpolation.ts", "../../../../library/src/animation/Animators/PrecalculatedAnimator.ts", "../../../../library/src/animation/FramerAnimation.ts", "../../../../library/src/animation/Motion/autoValueHandlers.ts", "../../../../library/src/animation/Motion/MotionSetup.tsx", "../../../../library/src/animation/Motion/patchBorderRadiusScaleCorrector.ts", "../../../../library/src/animation/Motion/startAnimation.ts", "../../../../library/src/animation/animate.ts", "../../../../library/src/components/Device/Device.tsx", "../../../../library/src/components/Device/ErrorPlaceholder.tsx", "../../../../library/src/components/Device/DeviceCodeComponent.tsx", "../../../../library/src/utils/applyControlDefaultsToReactDefaultProps.ts", "../../../../library/src/utils/addPropertyControls.ts", "../../../../library/src/components/Device/presets.ts", "../../../../library/src/components/Device/DeviceCodeComponentProps.ts", "../../../../library/src/components/Device/usePrototypingMetaTags.ts", "../../../../library/src/components/EmptyState.tsx", "../../../../library/src/components/Navigation.tsx", "../../../../library/src/components/AnimateLayout/SharedLayoutRoot.tsx", "../../../../library/src/components/MagicMotionCrossfadeRoot.tsx", "../../../../library/src/components/NavigationContainer.tsx", "../../../../library/src/modules/useAppearEffect.ts", "../../../../library/src/modules/useSharedIntersectionObserver.ts", "../../../../library/src/components/utils/refHelper.ts", "../../../../library/src/components/AnimateLayout/SharedLayoutTree.tsx", "../../../../library/src/components/NavigationContainerContext.tsx", "../../../../library/src/components/NavigationTargetContext.tsx", "../../../../library/src/components/NavigationTransitions.ts", "../../../../library/src/components/reduceNavigationStateForAction.ts", "../../../../library/src/components/hoc/WithNavigator.tsx", "../../../../library/src/render/types/NavigationLink.ts", "../../../../library/src/components/AnimateLayout/AnimateSharedLayout.tsx", "../../../../library/src/components/Draggable.ts", "../../../../library/src/components/Pagination/InfiniteScroll.tsx", "../../../../library/src/components/Page/EmulatedPage.tsx", "../../../../library/src/components/Scroll/useWheelScroll.ts", "../../../../library/src/render/utils/debounce.ts", "../../../../library/src/components/utils/paddingFromProps.ts", "../../../../library/src/components/Stack/Stack.tsx", "../../../../library/src/components/Page/PageContainer.tsx", "../../../../library/src/components/Page/Page.tsx", "../../../../library/src/components/Screen.tsx", "../../../../library/src/events/recognizer/GestureRecognizer.ts", "../../../../library/src/events/recognizer/MouseWheelGestureRecognizer.ts", "../../../../library/src/events/recognizer/PanGestureRecognizer.ts", "../../../../library/src/events/recognizer/TapGestureRecognizer.ts", "../../../../library/src/events/FramerEventSession.ts", "../../../../library/src/events/recognizer/MouseEventListener.ts", "../../../../library/src/events/recognizer/TouchEventListener.ts", "../../../../library/src/events/FramerEventListener.ts", "../../../../library/src/components/Scroll/Scroll.tsx", "../../../../library/src/components/Scroll/EmulatedScroll.tsx", "../../../../library/src/components/Scroll/NativeScroll.tsx", "../../../../library/src/modules/cx.ts", "../../../../library/src/components/utils/useEmulatedTouchScroll.ts", "../../../../library/src/components/utils/animatePointWithInertia.ts", "../../../../library/src/components/utils/useUpdateScrollOffset.ts", "../../../../library/src/data/Data.ts", "../../../../library/src/data/PropertyStore.ts", "../../../../library/src/data/useData/index.ts", "../../../../library/src/data/useData/store.ts", "../../../../library/src/deprecated/DataObserver.tsx", "../../../../library/src/deprecated/WithOverride.tsx", "../../../../library/src/deprecated/convertColorProps.ts", "../../../../library/src/modules/withFX.tsx", "../../../../library/src/modules/hocOptions.ts", "../../../../library/src/modules/optimizeAppear.tsx", "../../../../library/src/modules/GeneratedComponentContext.ts", "../../../../library/src/modules/PropertyOverrides.tsx", "../../../../library/src/components/utils/cloneChildrenWithProps.tsx", "../../../../library/src/components/utils/useCloneChildrenWithPropsAndRef.tsx", "../../../../library/src/modules/useFXValues.ts", "../../../../library/src/modules/useLoopEffect.ts", "../../../../library/src/modules/useParallax.ts", "../../../../library/src/modules/parallaxTransform.ts", "../../../../library/src/modules/usePresenceAnimation.ts", "../../../../library/src/modules/useStyleAppearEffect.ts", "../../../../library/src/modules/calculateOffsetTop.ts", "../../../../library/src/modules/createTransformInputRange.ts", "../../../../library/src/modules/useScrollDirectionChange.ts", "../../../../library/src/modules/useStyleTransformEffect.ts", "../../../../library/src/deprecated/deprecatedEffects.ts", "../../../../library/src/modules/ComponentPresetsContext.tsx", "../../../../library/src/modules/ComponentViewportContext.tsx", "../../../../library/src/modules/Container.tsx", "../../../../library/src/render/utils/withGeneratedLayoutId.tsx", "../../../../library/src/modules/code-boundary/CodeComponentBoundary.tsx", "../../../../library/src/router/SuspenseThatPreservesDom.tsx", "../../../../library/src/router/error-boundary/SynchronousSuspenseErrorBoundary.tsx", "../../../../library/src/modules/code-boundary/NullFallback.tsx", "../../../../library/src/modules/code-boundary/collectErrorToAnalytics.tsx", "../../../../library/src/modules/code-boundary/logger.ts", "../../../../library/src/modules/code-boundary/shouldEnableCodeBoundaries.ts", "../../../../library/src/modules/code-boundary/DeprecatedContainerErrorBoundary.tsx", "../../../../library/src/modules/code-boundary/ExternalComponentContext.tsx", "../../../../library/src/modules/code-boundary/errorMessages.ts", "../../../../library/src/modules/code-boundary/shouldWrapWithBoundary.ts", "../../../../library/src/modules/code-boundary/maybeWrapComponentWithCodeBoundary.tsx", "../../../../library/src/modules/CustomCursor.tsx", "../../../../library/src/modules/Floating.tsx", "../../../../library/src/modules/Link/useReplaceNestedLinks.tsx", "../../../../library/src/modules/LinkToWebPage.ts", "../../../../library/src/modules/NestedLinksCollector.ts", "../../../../library/src/modules/useIsOnFramerCanvas.ts", "../../../../library/src/modules/Link/urlChecks.tsx", "../../../../library/src/modules/Link/getRouteFromPageLink.tsx", "../../../../library/src/modules/framerPageLink.ts", "../../../../library/src/modules/Link/linkFromFramerPageLink.tsx", "../../../../library/src/modules/InjectSelectionStyle.tsx", "../../../../library/src/render/types/Polygon.ts", "../../../../library/src/modules/floatingPositionSafeAreaStyle.ts", "../../../../library/src/modules/Instance.tsx", "../../../../library/src/modules/AutoBreakpointVariant.tsx", "../../../../library/src/modules/GracefullyDegradingErrorBoundary.tsx", "../../../../library/src/modules/Link/index.tsx", "../../../../library/src/render/utils/findAnchorElement.ts", "../../../../library/src/modules/ChildrenCanSuspend.tsx", "../../../../library/src/modules/Link/findMatchingRouteAttributes.tsx", "../../../../library/src/modules/Link/linkMatchesRoute.tsx", "../../../../library/src/modules/Link/pathVariables.tsx", "../../../../library/src/modules/Link/observeRouteForPreloading.ts", "../../../../library/src/modules/Link/types.ts", "../../../../library/src/modules/Link/propsForLink.tsx", "../../../../library/src/modules/Link/resolveSlugs.ts", "../../../../library/src/modules/resolveSlug.ts", "../../../../library/src/modules/Link/useTrackLinkClick.ts", "../../../../library/src/modules/Link/resolveLink.ts", "../../../../library/src/modules/Link/resolvePageScope.tsx", "../../../../library/src/modules/PageRoot.tsx", "../../../../library/src/render/presentation/Forms/FormContainer.tsx", "../../../../library/src/render/presentation/Forms/antibot.ts", "../../../../library/src/render/presentation/Forms/formData.ts", "../../../../library/src/render/presentation/Forms/honeypot.tsx", "../../../../library/src/render/presentation/Forms/trackFormSubmit.ts", "../../../../library/src/render/presentation/Forms/useCaptcha.ts", "../../../../library/src/router/Router.tsx", "../../../../shared/src/constants.ts", "../../../../library/src/modules/EditorBarLauncher.tsx", "../../../../library/src/components/IgnoreErrors.tsx", "../../../../library/src/modules/TriggerStateContext.tsx", "../../../../library/src/utils/triggerActionsStorage.ts", "../../../../library/src/utils/triggerActions.ts", "../../../../shared/src/ssg/constants.ts", "../../../../library/src/modules/custom-code/useLoadSnippets.ts", "../../../../library/src/modules/custom-code/context.tsx", "../../../../shared/src/custom-code/markers.ts", "../../../../library/src/utils/insertHTML.ts", "../../../../library/src/modules/custom-code/markers.ts", "../../../../library/src/modules/custom-code/loadSnippets.ts", "../../../../library/src/router/isSamePage.ts", "../../../../library/src/router/pageAnalytics.ts", "../../../../library/src/router/useForceUpdate.ts", "../../../../library/src/modules/FetchClient.tsx", "../../../../library/src/render/utils/preloadImage.ts", "../../../../library/src/utils/getPropertyByPath.ts", "../../../../library/src/modules/ResolveLinks.tsx", "../../../../library/src/modules/Fetcher.tsx", "../../../../library/src/modules/callEach.ts", "../../../../library/src/modules/cms/optimizer/Evaluate.ts", "../../../../library/src/modules/cms/types.ts", "../../../../library/src/modules/cms/DatabaseValue.ts", "../../../../library/src/modules/cms/DatabaseValueDefinition.ts", "../../../../library/src/modules/cms/CompatibilityDatabaseCollection.ts", "../../../../library/src/modules/cms/getCollectionId.ts", "../../../../library/src/modules/cms/getCollectionForLocale.ts", "../../../../library/src/modules/cms/optimizer/Cost.ts", "../../../../library/src/modules/cms/optimizer/Group.ts", "../../../../library/src/modules/cms/optimizer/nodes/AbstractNode.ts", "../../../../library/src/modules/cms/optimizer/nodes/relational/RelationalNode.ts", "../../../../library/src/modules/cms/optimizer/Hashable.ts", "../../../../library/src/modules/cms/optimizer/Resolver.ts", "../../../../library/src/modules/cms/optimizer/Metadata.ts", "../../../../library/src/modules/cms/optimizer/Ordering.ts", "../../../../library/src/modules/cms/optimizer/PhysicalProps.ts", "../../../../library/src/modules/cms/optimizer/Scope.ts", "../../../../library/src/modules/cms/optimizer/Relation.ts", "../../../../library/src/modules/cms/optimizer/nodes/relational/RelationalProject.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarNode.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarCase.ts", "../../../../library/src/modules/cms/optimizer/Builder.ts", "../../../../library/src/modules/cms/optimizer/nodes/relational/RelationalFilter.ts", "../../../../library/src/modules/cms/optimizer/nodes/relational/RelationalIndexLookup.ts", "../../../../library/src/modules/cms/optimizer/nodes/relational/RelationalIntersection.ts", "../../../../library/src/modules/cms/optimizer/nodes/relational/RelationalScan.ts", "../../../../library/src/modules/cms/optimizer/nodes/relational/RelationalUnion.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarAnd.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarConstant.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarContains.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarEndsWith.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarEquals.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarGreaterThan.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarGreaterThanOrEqual.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarLessThan.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarLessThanOrEqual.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarNotEquals.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarOr.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarStartsWith.ts", "../../../../library/src/modules/cms/optimizer/Explorer.ts", "../../../../library/src/modules/cms/optimizer/LogicalProps.ts", "../../../../library/src/modules/cms/optimizer/Memo.ts", "../../../../library/src/modules/cms/optimizer/nodes/relational/RelationalLeftJoin.ts", "../../../../library/src/modules/cms/optimizer/nodes/relational/RelationalLimit.ts", "../../../../library/src/modules/cms/optimizer/nodes/relational/RelationalOffset.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarArray.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarCast.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarFlatArray.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarIn.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarIndexOf.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarIntersection.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarLength.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarNot.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarNotIn.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarVariable.ts", "../../../../library/src/modules/cms/optimizer/Normalizer.ts", "../../../../library/src/modules/cms/optimizer/nodes/enforcer/EnforcerNode.ts", "../../../../library/src/modules/cms/optimizer/nodes/enforcer/EnforcerResolve.ts", "../../../../library/src/modules/cms/optimizer/nodes/enforcer/EnforcerSort.ts", "../../../../library/src/modules/cms/optimizer/nodes/relational/RelationalAssert.ts", "../../../../library/src/modules/cms/optimizer/Optimizer.ts", "../../../../library/src/modules/cms/stringifyQuery.ts", "../../../../library/src/modules/cms/QueryEngine.ts", "../../../../library/src/modules/cms/QueryCache.ts", "../../../../library/src/modules/cms/server-database/mock/executeServerDatabaseQuery.ts", "../../../../library/src/modules/cms/useFormSelectVariableBinding.tsx", "../../../../library/src/modules/useQueryData.ts", "../../../../library/src/utils/createTrigger.ts", "../../../../library/src/modules/TriggerSubscription.tsx", "../../../../library/src/modules/useActiveVariantCallback.ts", "../../../../library/src/modules/useAddVariantProps.ts", "../../../../library/src/modules/useBreakpointVariants.ts", "../../../../library/src/modules/useDataRecord.ts", "../../../../library/src/modules/useDynamicRefs.ts", "../../../../library/src/modules/useGamepad.ts", "../../../../library/src/modules/useHotkey.ts", "../../../../library/src/modules/useNavigate.tsx", "../../../../library/src/modules/useOnVariantChange.ts", "../../../../library/src/modules/useOverlayState.tsx", "../../../../library/src/modules/usePrototypeNavigate.tsx", "../../../../library/src/router/isRoute.ts", "../../../../library/src/components/utils/useLoadMorePaginatedQuery.tsx", "../../../../library/src/components/utils/useLoadMorePagination.tsx", "../../../../library/src/modules/useVariantState.ts", "../../../../library/src/modules/safeCSSValue.ts", "../../../../library/src/modules/code-boundary/withCodeBoundaryForOverrides.tsx", "../../../../library/src/modules/withStrokeFX.tsx", "../../../../library/src/render/presentation/Ticker.tsx", "../../../../library/src/render/utils/tickerUtils.ts", "../../../../library/src/render/presentation/BasicTicker.tsx", "../../../../library/src/render/presentation/motionplus/Ticker.tsx", "../../../../library/src/render/presentation/DraggableTicker.tsx", "../../../../library/src/render/presentation/TickerContext.tsx", "../../../../library/src/modules/withTickerFX.tsx", "../../../../library/src/modules/withFlowFX.tsx", "../../../../library/src/modules/withMappedReactProps.tsx", "../../../../library/src/render/presentation/Shader/WebGL2ShaderRenderer.ts", "../../../../library/src/render/presentation/Shader/uniformName.ts", "../../../../library/src/modules/defineShader.ts", "../../../../library/src/render/presentation/Shader/Shader.tsx", "../../../../library/src/render/presentation/Shader/ShaderFallbackImage.tsx", "../../../../library/src/render/presentation/Shader/ShaderSandboxFallbackImage.tsx", "../../../../library/src/render/utils/parseCSSVariable.ts", "../../../../library/src/render/presentation/Shader/shaderTextureCache.ts", "../../../../library/src/render/presentation/Shader/heightmap.ts", "../../../../library/src/render/presentation/Shader/helpers.ts", "../../../../library/src/render/presentation/Shader/ShaderWithFallbackOverlay.tsx", "../../../../library/src/render/presentation/Shader/ShaderCanvas.tsx", "../../../../library/src/render/presentation/Shader/defaultShaders.ts", "../../../../library/src/render/presentation/Shader/hooks.ts", "../../../../library/src/render/presentation/Shader/ShaderPoolContext.ts", "../../../../library/src/render/presentation/Shader/useShaderMouse.ts", "../../../../library/src/render/presentation/motionplus/usePointerPosition.ts", "../../../../library/src/render/presentation/Shader/useShaderPool.ts", "../../../../library/src/modules/withVariantAppearEffect.tsx", "../../../../library/src/modules/withVariantFX.tsx", "../../../../library/src/render/WindowContext.ts", "../../../../library/src/render/presentation/CustomProperties.tsx", "../../../../library/src/render/presentation/Forms/FormPlainTextInput.tsx", "../../../../library/src/render/presentation/Forms/useOptimisticValue.ts", "../../../../library/src/render/presentation/Forms/FormBooleanInput.tsx", "../../../../library/src/hooks/useBooleanLatch.ts", "../../../../library/src/render/presentation/Forms/FormSelect.tsx", "../../../../library/src/render/presentation/Image.tsx", "../../../../library/src/render/presentation/withLightbox.tsx", "../../../../library/src/render/presentation/useEscToClose.ts", "../../../../library/src/render/presentation/withColumnMasonryLayout.tsx", "../../../../library/src/render/presentation/RelativeDate.tsx", "../../../../library/src/render/presentation/formatRelativeDate.ts", "../../../../library/src/render/presentation/RichText.tsx", "../../../../library/src/render/presentation/DeprecatedRichText.tsx", "../../../../library/src/render/utils/dom.ts", "../../../../library/src/modules/replaceFramerPageLinks.ts", "../../../../library/src/render/utils/isShallowEqualArray.ts", "../../../../library/src/render/presentation/useTextEffect.tsx", "../../../../library/src/render/utils/patchAndWaitForChild.ts", "../../../../library/src/render/presentation/SVG.tsx", "../../../../library/src/render/utils/elementPropertiesForGradient.ts", "../../../../library/src/render/types/RelativeNumber.ts", "../../../../library/src/render/utils/imagePatternPropsForFill.tsx", "../../../../library/src/render/utils/imageUrlForAsset.ts", "../../../../library/src/render/presentation/ImagePatternElement.tsx", "../../../../library/src/render/presentation/SharedSVGManager.ts", "../../../../library/src/render/presentation/Text.tsx", "../../../../library/src/render/fonts/useFontLoadStatus.tsx", "../../../../library/src/render/presentation/TickerItem.tsx", "../../../../library/src/utils/internalId.ts", "../../../../library/src/render/types/randomID.ts", "../../../../library/src/render/types/PathSegment.ts", "../../../../library/src/render/traits/Path.ts", "../../../../library/src/render/types/svgElementAttributeDefaults.ts", "../../../../library/src/render/utils/createTransformValues.ts", "../../../../library/src/render/utils/transformString.ts", "../../../../library/src/render/presentation/GradientElement.tsx", "../../../../library/src/render/presentation/SVGRoot.tsx", "../../../../library/src/render/presentation/Vector.tsx", "../../../../library/src/render/presentation/VectorGroup.tsx", "../../../../library/src/render/traits/Shape.ts", "../../../../library/src/render/types/Size.ts", "../../../../library/src/render/utils/annotateTypeOnStringify.ts", "../../../../library/src/render/utils/getLoadingLazyAtYPosition.ts", "../../../../library/src/render/utils/gradientForShape.tsx", "../../../../library/src/render/utils/throttle.ts", "../../../../library/src/utils/addActionControls.ts", "../../../../library/src/utils/addFonts.ts", "../../../../library/src/utils/withPerformanceMarks.ts", "../../../../library/src/utils/environment.ts", "../../../../library/src/utils/network.ts", "../../../../library/src/utils/inspectObjectType.ts", "../../../../library/src/utils/inspect.ts", "../../../../library/src/utils/print.ts", "../../../../library/src/utils/useInitialRouteComponent.ts", "../../../../library/src/modules/loader/addLoader.ts", "../../../../library/src/modules/loader/forwardLoader.ts", "../../../../library/package.json", "../../../../library/src/version.ts", "../../../../library/src/animation/Motion/addChildHack.ts", "../../src/document/models/CanvasTree/traits/utils/CSSDimension.ts", "../../src/document/models/CanvasTree/traits/WithRootFontSize.ts", "../../src/document/models/CanvasTree/traits/WithTextStyle.ts", "../../../../../node_modules/js-base64/base64.mjs", "../../src/document/models/CanvasTree/traits/utils/Reduced.ts", "../../src/document/models/CanvasTree/utils/variableFont.ts", "../../src/utils/isFourNumberList.ts", "../../src/utils/normalizeEase.ts", "../../src/utils/updatable.ts", "../../src/document/models/Transition.ts", "../../src/document/models/CanvasTree/traits/WithVariant.ts", "../../src/document/models/CanvasTree/traits/utils/reduceProperty.ts", "../../src/document/models/CanvasTree/traits/WithCodeComponent.ts", "../../src/document/models/CanvasTree/traits/utils/hardCodedCodeComponentIdentifiers.ts", "../../src/document/models/CanvasTree/traits/utils/hardCodedCodeComponentIdentifierChecks.ts", "../../src/document/models/CanvasTree/traits/WithRadius.ts", "../../src/utils/isValidEnumValue.ts", "../../src/document/models/controlProps/isControlType.ts", "../../src/document/models/controlProps/RawControlProp.ts", "../../src/document/models/controlProps/FusedNumberControlPropValue.ts", "../../src/document/models/controlProps/WithControlIsFused.ts", "../../src/document/models/controlProps/ControlProp.ts", "../../src/document/models/CanvasTree/traits/utils/Link.ts", "../../src/document/models/Shadow.ts", "../../src/document/models/controlProps/controlPropKey.ts", "../../src/document/models/CanvasTree/nodes/ChildList.ts", "../../src/document/models/CanvasTree/nodes/TreeNodeClasses.ts", "../../src/document/models/CanvasTree/nodes/TreeNode.ts", "../../src/document/models/CanvasTree/drivers/DriverHooks.ts", "../../src/document/models/CanvasTree/nodes/NodeCache.ts", "../../src/document/models/CanvasTree/nodes/MutableNode.ts", "../../src/document/models/CanvasTree/traits/WithBoxShadow.ts", "../../src/document/models/CanvasTree/traits/WithShadow.ts", "../../src/document/models/CanvasTree/traits/WithTokenVariables.ts", "../../src/document/models/CanvasTree/utils/tokens.ts", "../../src/document/models/CanvasTree/traits/ResponsiveImage.ts", "../../src/document/models/EventAction.ts", "../../../../library/src/render/types/SupportedRelValue.ts", "../../src/document/models/SupportedRelValue.ts", "../../src/utils/commonValue.ts", "../../src/document/models/controlProps/BorderControlPropValue.ts", "../../src/document/components/chrome/properties/codeComponentRows/utils/isValidPropertyValue.ts", "../../src/document/models/CanvasTree/traits/utils/parseBoxShadowFromStyle.ts", "../../src/document/models/controlProps/BoxShadowControlPropValue.ts", "../../src/document/models/controlProps/WithControlAltText.ts", "../../src/document/models/controlProps/WithControlFocalPoint.ts", "../../src/utils/names.ts", "../../src/document/models/CanvasTree/traits/WithBlending.ts", "../../src/document/models/CanvasTree/traits/WithGridItemLayout.ts", "../../src/document/models/CanvasTree/traits/WithImageRendering.ts", "../../src/document/models/CanvasTree/traits/WithOverflow.ts", "../../src/document/models/CanvasTree/traits/WithOverscrollBehavior.ts", "../../src/document/models/CanvasTree/traits/WithPointerEvents.ts", "../../src/document/models/CanvasTree/traits/WithTickerEffect.ts", "../../src/document/models/CanvasTree/traits/WithUserSelect.ts", "../../src/document/models/CanvasTree/traits/forms/WithTextInputType.ts", "../../src/document/models/CanvasTree/utils/nodePropertyControlDefinitions.ts", "../../src/document/models/CanvasTree/traits/utils/codeComponentProps.ts", "../../src/document/models/CanvasTree/traits/WithVariables.ts", "../../src/document/utils/interFonts.ts", "../../src/document/models/CanvasTree/traits/WithRepeatArray.ts", "../../src/utils/repeaterUtils.ts", "../../../../shared/src/ssg/locale.ts", "../../src/utils/ranges.ts", "../../src/document/components/utils/valueToPath.ts", "../../src/web/pages/projects/components/Domains/validation/validatePathOrURL.ts", "../../src/web/pages/projects/components/Domains/validation/validateRouteNode.ts", "../../src/document/components/chrome/Pages/utils/commons.ts", "../../src/document/models/CanvasTree/traits/WithLocales.ts", "../../src/utils/parseHTML.ts", "../../src/utils/getHTMLTextContent.ts", "../../src/document/models/richText/richTextPlainText.ts", "../../src/document/models/LocalizedValue.ts", "../../src/document/components/chrome/localization/getValueForActiveLocale.ts", "../../src/document/components/chrome/shared/locales.ts", "../../src/utils/memoizeOne.ts", "../../src/utils/getRouterLocales.ts", "../../src/document/models/CanvasTree/nodes/RouteSegmentRootNode.utils.ts", "../../src/document/components/chrome/Pages/utils/getRouteSegmentNodeByWebPageId.ts", "../../src/utils/getCollectionForIdentifier.ts", "../../src/document/models/CanvasTree/traits/WithFloatingPosition.ts", "../../src/document/models/CanvasTree/nodes/ContentManagementNode.utils.ts", "../../../../../node_modules/comlink/src/comlink.ts", "../../../../../node_modules/@framerjs/framer-events/lib/esm/generated/UiLongFrame.js", "../../../../../node_modules/@framerjs/framer-events/lib/esm/generated/VekterStatistics.js", "../../src/document/stores/DebugStore.ts", "../../src/modules/importMapManager.ts", "../../../../../node_modules/scheduler/package.json", "../../src/modules/utils.ts", "../../src/utils/pathVariables.ts", "../../src/utils/getFirstObjectValue.ts", "../../src/document/components/utils/convertIdPathVariablesToReadable.ts", "../../src/document/components/utils/getWebPagePath.ts", "../../src/document/models/CanvasTree/traits/WithHTMLTextTag.ts", "../../src/document/models/CanvasTree/traits/WithPadding.ts", "../../src/document/models/CanvasTree/traits/WithRadiusPerCorner.ts", "../../src/code-generation/js/serializeJS.ts", "../../src/utils/join.ts", "../../src/code-generation/js/js.ts", "../../src/document/models/CanvasTree/traits/WithZIndex.ts", "../../../runtime/src/sandbox/componentLoader/types.ts", "../../../runtime/src/sandbox/componentLoader/verifyPropertyControls.ts", "../../../runtime/src/sandbox/actions/useDismissOverlay.ts", "../../../runtime/src/sandbox/actions/useLoadMore.ts", "../../../runtime/src/sandbox/actions/useLog.ts", "../../../runtime/src/sandbox/actions/useOpenURL.ts", "../../../runtime/src/sandbox/actions/useResetVariableValues.ts", "../../../runtime/src/sandbox/actions/useSetLocale.ts", "../../../runtime/src/sandbox/actions/useSetVariableValue.ts", "../../../runtime/src/sandbox/actions/useShowOverlay.ts", "../../../runtime/src/sandbox/actions/useShowRelativeOverlay.ts", "../../../runtime/src/sandbox/actions/useTriggerEvent.ts", "../../../runtime/src/sandbox/actions/defaultActionsMap.ts", "../../../runtime/src/sandbox/componentLoader/createErrorDefinition.ts", "../../../runtime/src/sandbox/componentLoader/extractFileNameFromIdentifier.ts", "../../../runtime/src/sandbox/componentLoader/BuiltInFramerComponentIdentifier.ts", "../../../runtime/src/host/componentLoader/defaultComponentDefinitions.ts", "../../../runtime/src/sandbox/componentLoader/collectEntities.ts", "../../../runtime/src/sandbox/componentLoader/warn.ts", "../../../runtime/src/sandbox/componentLoader/defaultComponentsMap.ts", "../../../runtime/src/sandbox/componentLoader/sandboxComponentLoader.ts", "../../src/document/models/richText/RichTextDocument.ts", "../../src/document/models/richText/richTextStorage.ts", "../../src/document/models/CanvasTree/nodes/utils/breakpointHelpers.ts", "../../src/document/models/CanvasTree/traits/WithBreakpointVariants.ts", "../../src/document/models/CanvasTree/traits/WithDOMLayout.ts", "../../src/utils/getActiveBreakpoint.ts", "../../src/document/models/CanvasTree/traits/WithLayoutTemplate.ts", "../../src/document/models/CanvasTree/traits/utils/rootFontSizeHelpers.ts", "../../src/document/models/controlProps/getControlProps.ts", "../../src/document/models/CanvasTree/traits/WithCursor.ts", "../../src/document/models/CanvasTree/traits/forms/WithFormInputFocusedStyles.ts", "../../src/document/models/CanvasTree/traits/utils/reduceShadows.ts", "../../src/document/models/CanvasTree/traits/utils/reduceFormInputFocusedStyles.ts", "../../src/prosemirror/variables.ts", "../../src/document/models/CanvasTree/utils/openType.ts", "../../src/document/models/CanvasTree/traits/WithCornerShape.ts", "../../src/code-generation/jsx/types.ts", "../../src/code-generation/utils/collector.ts", "../../src/utils/mapTuple.ts", "../../src/document/models/CanvasTree/traits/forms/WithFormInput.ts", "../../src/utils/enumControlUtils.ts", "../../src/utils/getValidDate.ts", "../../src/document/models/CanvasTree/traits/WithVariableProvider.ts", "../../src/document/models/CanvasTree/traits/utils/toDateStringTransformOptions.ts", "../../src/document/models/CanvasTree/traits/utils/valueTransformUtils.ts", "../../src/document/models/CanvasTree/traits/utils/applyValueTransform.ts", "../../src/document/models/CanvasTree/traits/utils/radius.ts", "../../src/document/models/CanvasTree/traits/collectStyles/collectCorner.ts", "../../src/document/models/CanvasTree/traits/utils/parseBorderRadiusFromStyle.ts", "../../src/document/models/CanvasTree/traits/utils/parseCornerShapeFromStyle.ts", "../../src/prosemirror/styles.ts", "../../src/utils/cached.ts", "../../src/text/inferFontCategory.ts", "../../src/text/range.ts", "../../src/text/sizeAdjustedFallback.ts", "../../src/text/index.ts", "../../src/document/models/controlProps/FontControlPropValue.ts", "../../src/document/models/controlProps/controlTypesAreCompatible.ts", "../../src/document/models/controlProps/hasControlValueLocalized.ts", "../../src/document/stores/TreeMode.ts", "../../src/document/models/CanvasTree/traits/WithControlProps.ts", "../../src/document/models/CanvasTree/traits/utils/computeValue.ts", "../../src/document/utils/FontPreviewTypes.ts", "../../src/code-generation/js/reserved.ts", "../../src/code-generation/utils/BindingCollector.ts", "../../src/document/models/CanvasTree/traits/WithAltText.ts", "../../src/document/models/controlProps/getControlPropValues.ts", "../../../../../node_modules/@emotion/hash/dist/emotion-hash.esm.js", "../../src/document/models/CanvasTree/traits/WithScrollTarget.ts", "../../src/code-generation/utils/elementIdPatternForNode.ts", "../../src/document/models/CanvasTree/traits/utils/ResolvedCollectionItemSelector.ts", "../../src/document/utils/getResolvedLinkToWebPage.ts", "../../src/code-generation/utils/ImportCollector.ts", "../../src/utils/boxShadowToCSS.ts", "../../src/code-generation/utils/CustomCursorCollector.ts", "../../src/code-generation/utils/LinkCollector.ts", "../../src/document/utils/getUnresolvedLinkToScrollSection.ts", "../../src/document/models/CanvasTree/traits/utils/getPixelDimensionsFromImageSrc.ts", "../../src/document/models/controlProps/getResolvedControlPropValues.ts"],
  "sourcesContent": ["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Hsluv = void 0;\nclass Hsluv {\n    constructor() {\n        // RGB\n        this.hex = '#000000';\n        this.rgb_r = 0;\n        this.rgb_g = 0;\n        this.rgb_b = 0;\n        // CIE XYZ\n        this.xyz_x = 0;\n        this.xyz_y = 0;\n        this.xyz_z = 0;\n        // CIE LUV\n        this.luv_l = 0;\n        this.luv_u = 0;\n        this.luv_v = 0;\n        // CIE LUV LCh\n        this.lch_l = 0;\n        this.lch_c = 0;\n        this.lch_h = 0;\n        // HSLuv\n        this.hsluv_h = 0;\n        this.hsluv_s = 0;\n        this.hsluv_l = 0;\n        // HPLuv\n        this.hpluv_h = 0;\n        this.hpluv_p = 0;\n        this.hpluv_l = 0;\n        // 6 lines in slope-intercept format: R < 0, R > 1, G < 0, G > 1, B < 0, B > 1\n        this.r0s = 0;\n        this.r0i = 0;\n        this.r1s = 0;\n        this.r1i = 0;\n        this.g0s = 0;\n        this.g0i = 0;\n        this.g1s = 0;\n        this.g1i = 0;\n        this.b0s = 0;\n        this.b0i = 0;\n        this.b1s = 0;\n        this.b1i = 0;\n    }\n    static fromLinear(c) {\n        if (c <= 0.0031308) {\n            return 12.92 * c;\n        }\n        else {\n            return 1.055 * Math.pow(c, 1 / 2.4) - 0.055;\n        }\n    }\n    static toLinear(c) {\n        if (c > 0.04045) {\n            return Math.pow((c + 0.055) / 1.055, 2.4);\n        }\n        else {\n            return c / 12.92;\n        }\n    }\n    static yToL(Y) {\n        if (Y <= Hsluv.epsilon) {\n            return Y / Hsluv.refY * Hsluv.kappa;\n        }\n        else {\n            return 116 * Math.pow(Y / Hsluv.refY, 1 / 3) - 16;\n        }\n    }\n    static lToY(L) {\n        if (L <= 8) {\n            return Hsluv.refY * L / Hsluv.kappa;\n        }\n        else {\n            return Hsluv.refY * Math.pow((L + 16) / 116, 3);\n        }\n    }\n    static rgbChannelToHex(chan) {\n        const c = Math.round(chan * 255);\n        const digit2 = c % 16;\n        const digit1 = (c - digit2) / 16 | 0;\n        return Hsluv.hexChars.charAt(digit1) + Hsluv.hexChars.charAt(digit2);\n    }\n    static hexToRgbChannel(hex, offset) {\n        const digit1 = Hsluv.hexChars.indexOf(hex.charAt(offset));\n        const digit2 = Hsluv.hexChars.indexOf(hex.charAt(offset + 1));\n        const n = digit1 * 16 + digit2;\n        return n / 255.0;\n    }\n    static distanceFromOriginAngle(slope, intercept, angle) {\n        const d = intercept / (Math.sin(angle) - slope * Math.cos(angle));\n        if (d < 0) {\n            return Infinity;\n        }\n        else {\n            return d;\n        }\n    }\n    static distanceFromOrigin(slope, intercept) {\n        return Math.abs(intercept) / Math.sqrt(Math.pow(slope, 2) + 1);\n    }\n    static min6(f1, f2, f3, f4, f5, f6) {\n        return Math.min(f1, Math.min(f2, Math.min(f3, Math.min(f4, Math.min(f5, f6)))));\n    }\n    rgbToHex() {\n        this.hex = \"#\";\n        this.hex += Hsluv.rgbChannelToHex(this.rgb_r);\n        this.hex += Hsluv.rgbChannelToHex(this.rgb_g);\n        this.hex += Hsluv.rgbChannelToHex(this.rgb_b);\n    }\n    hexToRgb() {\n        this.hex = this.hex.toLowerCase();\n        this.rgb_r = Hsluv.hexToRgbChannel(this.hex, 1);\n        this.rgb_g = Hsluv.hexToRgbChannel(this.hex, 3);\n        this.rgb_b = Hsluv.hexToRgbChannel(this.hex, 5);\n    }\n    xyzToRgb() {\n        this.rgb_r = Hsluv.fromLinear(Hsluv.m_r0 * this.xyz_x + Hsluv.m_r1 * this.xyz_y + Hsluv.m_r2 * this.xyz_z);\n        this.rgb_g = Hsluv.fromLinear(Hsluv.m_g0 * this.xyz_x + Hsluv.m_g1 * this.xyz_y + Hsluv.m_g2 * this.xyz_z);\n        this.rgb_b = Hsluv.fromLinear(Hsluv.m_b0 * this.xyz_x + Hsluv.m_b1 * this.xyz_y + Hsluv.m_b2 * this.xyz_z);\n    }\n    rgbToXyz() {\n        const lr = Hsluv.toLinear(this.rgb_r);\n        const lg = Hsluv.toLinear(this.rgb_g);\n        const lb = Hsluv.toLinear(this.rgb_b);\n        this.xyz_x = 0.41239079926595 * lr + 0.35758433938387 * lg + 0.18048078840183 * lb;\n        this.xyz_y = 0.21263900587151 * lr + 0.71516867876775 * lg + 0.072192315360733 * lb;\n        this.xyz_z = 0.019330818715591 * lr + 0.11919477979462 * lg + 0.95053215224966 * lb;\n    }\n    xyzToLuv() {\n        const divider = this.xyz_x + 15 * this.xyz_y + 3 * this.xyz_z;\n        let varU = 4 * this.xyz_x;\n        let varV = 9 * this.xyz_y;\n        if (divider !== 0) {\n            varU /= divider;\n            varV /= divider;\n        }\n        else {\n            varU = NaN;\n            varV = NaN;\n        }\n        this.luv_l = Hsluv.yToL(this.xyz_y);\n        if (this.luv_l === 0) {\n            this.luv_u = 0;\n            this.luv_v = 0;\n        }\n        else {\n            this.luv_u = 13 * this.luv_l * (varU - Hsluv.refU);\n            this.luv_v = 13 * this.luv_l * (varV - Hsluv.refV);\n        }\n    }\n    luvToXyz() {\n        if (this.luv_l === 0) {\n            this.xyz_x = 0;\n            this.xyz_y = 0;\n            this.xyz_z = 0;\n            return;\n        }\n        const varU = this.luv_u / (13 * this.luv_l) + Hsluv.refU;\n        const varV = this.luv_v / (13 * this.luv_l) + Hsluv.refV;\n        this.xyz_y = Hsluv.lToY(this.luv_l);\n        this.xyz_x = 0 - 9 * this.xyz_y * varU / ((varU - 4) * varV - varU * varV);\n        this.xyz_z = (9 * this.xyz_y - 15 * varV * this.xyz_y - varV * this.xyz_x) / (3 * varV);\n    }\n    luvToLch() {\n        this.lch_l = this.luv_l;\n        this.lch_c = Math.sqrt(this.luv_u * this.luv_u + this.luv_v * this.luv_v);\n        if (this.lch_c < 0.00000001) {\n            this.lch_h = 0;\n        }\n        else {\n            const hrad = Math.atan2(this.luv_v, this.luv_u);\n            this.lch_h = hrad * 180.0 / Math.PI;\n            if (this.lch_h < 0) {\n                this.lch_h = 360 + this.lch_h;\n            }\n        }\n    }\n    lchToLuv() {\n        const hrad = this.lch_h / 180.0 * Math.PI;\n        this.luv_l = this.lch_l;\n        this.luv_u = Math.cos(hrad) * this.lch_c;\n        this.luv_v = Math.sin(hrad) * this.lch_c;\n    }\n    calculateBoundingLines(l) {\n        const sub1 = Math.pow(l + 16, 3) / 1560896;\n        const sub2 = sub1 > Hsluv.epsilon ? sub1 : l / Hsluv.kappa;\n        const s1r = sub2 * (284517 * Hsluv.m_r0 - 94839 * Hsluv.m_r2);\n        const s2r = sub2 * (838422 * Hsluv.m_r2 + 769860 * Hsluv.m_r1 + 731718 * Hsluv.m_r0);\n        const s3r = sub2 * (632260 * Hsluv.m_r2 - 126452 * Hsluv.m_r1);\n        const s1g = sub2 * (284517 * Hsluv.m_g0 - 94839 * Hsluv.m_g2);\n        const s2g = sub2 * (838422 * Hsluv.m_g2 + 769860 * Hsluv.m_g1 + 731718 * Hsluv.m_g0);\n        const s3g = sub2 * (632260 * Hsluv.m_g2 - 126452 * Hsluv.m_g1);\n        const s1b = sub2 * (284517 * Hsluv.m_b0 - 94839 * Hsluv.m_b2);\n        const s2b = sub2 * (838422 * Hsluv.m_b2 + 769860 * Hsluv.m_b1 + 731718 * Hsluv.m_b0);\n        const s3b = sub2 * (632260 * Hsluv.m_b2 - 126452 * Hsluv.m_b1);\n        this.r0s = s1r / s3r;\n        this.r0i = s2r * l / s3r;\n        this.r1s = s1r / (s3r + 126452);\n        this.r1i = (s2r - 769860) * l / (s3r + 126452);\n        this.g0s = s1g / s3g;\n        this.g0i = s2g * l / s3g;\n        this.g1s = s1g / (s3g + 126452);\n        this.g1i = (s2g - 769860) * l / (s3g + 126452);\n        this.b0s = s1b / s3b;\n        this.b0i = s2b * l / s3b;\n        this.b1s = s1b / (s3b + 126452);\n        this.b1i = (s2b - 769860) * l / (s3b + 126452);\n    }\n    calcMaxChromaHpluv() {\n        const r0 = Hsluv.distanceFromOrigin(this.r0s, this.r0i);\n        const r1 = Hsluv.distanceFromOrigin(this.r1s, this.r1i);\n        const g0 = Hsluv.distanceFromOrigin(this.g0s, this.g0i);\n        const g1 = Hsluv.distanceFromOrigin(this.g1s, this.g1i);\n        const b0 = Hsluv.distanceFromOrigin(this.b0s, this.b0i);\n        const b1 = Hsluv.distanceFromOrigin(this.b1s, this.b1i);\n        return Hsluv.min6(r0, r1, g0, g1, b0, b1);\n    }\n    calcMaxChromaHsluv(h) {\n        const hueRad = h / 360 * Math.PI * 2;\n        const r0 = Hsluv.distanceFromOriginAngle(this.r0s, this.r0i, hueRad);\n        const r1 = Hsluv.distanceFromOriginAngle(this.r1s, this.r1i, hueRad);\n        const g0 = Hsluv.distanceFromOriginAngle(this.g0s, this.g0i, hueRad);\n        const g1 = Hsluv.distanceFromOriginAngle(this.g1s, this.g1i, hueRad);\n        const b0 = Hsluv.distanceFromOriginAngle(this.b0s, this.b0i, hueRad);\n        const b1 = Hsluv.distanceFromOriginAngle(this.b1s, this.b1i, hueRad);\n        return Hsluv.min6(r0, r1, g0, g1, b0, b1);\n    }\n    hsluvToLch() {\n        if (this.hsluv_l > 99.9999999) {\n            this.lch_l = 100;\n            this.lch_c = 0;\n        }\n        else if (this.hsluv_l < 0.00000001) {\n            this.lch_l = 0;\n            this.lch_c = 0;\n        }\n        else {\n            this.lch_l = this.hsluv_l;\n            this.calculateBoundingLines(this.hsluv_l);\n            const max = this.calcMaxChromaHsluv(this.hsluv_h);\n            this.lch_c = max / 100 * this.hsluv_s;\n        }\n        this.lch_h = this.hsluv_h;\n    }\n    lchToHsluv() {\n        if (this.lch_l > 99.9999999) {\n            this.hsluv_s = 0;\n            this.hsluv_l = 100;\n        }\n        else if (this.lch_l < 0.00000001) {\n            this.hsluv_s = 0;\n            this.hsluv_l = 0;\n        }\n        else {\n            this.calculateBoundingLines(this.lch_l);\n            const max = this.calcMaxChromaHsluv(this.lch_h);\n            this.hsluv_s = this.lch_c / max * 100;\n            this.hsluv_l = this.lch_l;\n        }\n        this.hsluv_h = this.lch_h;\n    }\n    hpluvToLch() {\n        if (this.hpluv_l > 99.9999999) {\n            this.lch_l = 100;\n            this.lch_c = 0;\n        }\n        else if (this.hpluv_l < 0.00000001) {\n            this.lch_l = 0;\n            this.lch_c = 0;\n        }\n        else {\n            this.lch_l = this.hpluv_l;\n            this.calculateBoundingLines(this.hpluv_l);\n            const max = this.calcMaxChromaHpluv();\n            this.lch_c = max / 100 * this.hpluv_p;\n        }\n        this.lch_h = this.hpluv_h;\n    }\n    lchToHpluv() {\n        if (this.lch_l > 99.9999999) {\n            this.hpluv_p = 0;\n            this.hpluv_l = 100;\n        }\n        else if (this.lch_l < 0.00000001) {\n            this.hpluv_p = 0;\n            this.hpluv_l = 0;\n        }\n        else {\n            this.calculateBoundingLines(this.lch_l);\n            const max = this.calcMaxChromaHpluv();\n            this.hpluv_p = this.lch_c / max * 100;\n            this.hpluv_l = this.lch_l;\n        }\n        this.hpluv_h = this.lch_h;\n    }\n    hsluvToRgb() {\n        this.hsluvToLch();\n        this.lchToLuv();\n        this.luvToXyz();\n        this.xyzToRgb();\n    }\n    hpluvToRgb() {\n        this.hpluvToLch();\n        this.lchToLuv();\n        this.luvToXyz();\n        this.xyzToRgb();\n    }\n    hsluvToHex() {\n        this.hsluvToRgb();\n        this.rgbToHex();\n    }\n    hpluvToHex() {\n        this.hpluvToRgb();\n        this.rgbToHex();\n    }\n    rgbToHsluv() {\n        this.rgbToXyz();\n        this.xyzToLuv();\n        this.luvToLch();\n        this.lchToHpluv();\n        this.lchToHsluv();\n    }\n    rgbToHpluv() {\n        this.rgbToXyz();\n        this.xyzToLuv();\n        this.luvToLch();\n        this.lchToHpluv();\n        this.lchToHpluv();\n    }\n    hexToHsluv() {\n        this.hexToRgb();\n        this.rgbToHsluv();\n    }\n    hexToHpluv() {\n        this.hexToRgb();\n        this.rgbToHpluv();\n    }\n}\nexports.Hsluv = Hsluv;\nHsluv.hexChars = \"0123456789abcdef\";\nHsluv.refY = 1.0;\nHsluv.refU = 0.19783000664283;\nHsluv.refV = 0.46831999493879;\nHsluv.kappa = 903.2962962;\nHsluv.epsilon = 0.0088564516;\nHsluv.m_r0 = 3.240969941904521;\nHsluv.m_r1 = -1.537383177570093;\nHsluv.m_r2 = -0.498610760293;\nHsluv.m_g0 = -0.96924363628087;\nHsluv.m_g1 = 1.87596750150772;\nHsluv.m_g2 = 0.041555057407175;\nHsluv.m_b0 = 0.055630079696993;\nHsluv.m_b1 = -0.20397695888897;\nHsluv.m_b2 = 1.056971514242878;\n", "'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n  , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n  Events.prototype = Object.create(null);\n\n  //\n  // This hack is needed because the `__proto__` property is still inherited in\n  // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n  //\n  if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n  this.fn = fn;\n  this.context = context;\n  this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n  if (typeof fn !== 'function') {\n    throw new TypeError('The listener must be a function');\n  }\n\n  var listener = new EE(fn, context || emitter, once)\n    , evt = prefix ? prefix + event : event;\n\n  if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n  else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n  else emitter._events[evt] = [emitter._events[evt], listener];\n\n  return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n  if (--emitter._eventsCount === 0) emitter._events = new Events();\n  else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n  this._events = new Events();\n  this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n  var names = []\n    , events\n    , name;\n\n  if (this._eventsCount === 0) return names;\n\n  for (name in (events = this._events)) {\n    if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n  }\n\n  if (Object.getOwnPropertySymbols) {\n    return names.concat(Object.getOwnPropertySymbols(events));\n  }\n\n  return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n  var evt = prefix ? prefix + event : event\n    , handlers = this._events[evt];\n\n  if (!handlers) return [];\n  if (handlers.fn) return [handlers.fn];\n\n  for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n    ee[i] = handlers[i].fn;\n  }\n\n  return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n  var evt = prefix ? prefix + event : event\n    , listeners = this._events[evt];\n\n  if (!listeners) return 0;\n  if (listeners.fn) return 1;\n  return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n  var evt = prefix ? prefix + event : event;\n\n  if (!this._events[evt]) return false;\n\n  var listeners = this._events[evt]\n    , len = arguments.length\n    , args\n    , i;\n\n  if (listeners.fn) {\n    if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n    switch (len) {\n      case 1: return listeners.fn.call(listeners.context), true;\n      case 2: return listeners.fn.call(listeners.context, a1), true;\n      case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n      case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n      case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n      case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n    }\n\n    for (i = 1, args = new Array(len -1); i < len; i++) {\n      args[i - 1] = arguments[i];\n    }\n\n    listeners.fn.apply(listeners.context, args);\n  } else {\n    var length = listeners.length\n      , j;\n\n    for (i = 0; i < length; i++) {\n      if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n      switch (len) {\n        case 1: listeners[i].fn.call(listeners[i].context); break;\n        case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n        case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n        case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n        default:\n          if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n            args[j - 1] = arguments[j];\n          }\n\n          listeners[i].fn.apply(listeners[i].context, args);\n      }\n    }\n  }\n\n  return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n  return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n  return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n  var evt = prefix ? prefix + event : event;\n\n  if (!this._events[evt]) return this;\n  if (!fn) {\n    clearEvent(this, evt);\n    return this;\n  }\n\n  var listeners = this._events[evt];\n\n  if (listeners.fn) {\n    if (\n      listeners.fn === fn &&\n      (!once || listeners.once) &&\n      (!context || listeners.context === context)\n    ) {\n      clearEvent(this, evt);\n    }\n  } else {\n    for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n      if (\n        listeners[i].fn !== fn ||\n        (once && !listeners[i].once) ||\n        (context && listeners[i].context !== context)\n      ) {\n        events.push(listeners[i]);\n      }\n    }\n\n    //\n    // Reset the array, or remove it completely if we have no more listeners.\n    //\n    if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n    else clearEvent(this, evt);\n  }\n\n  return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n  var evt;\n\n  if (event) {\n    evt = prefix ? prefix + event : event;\n    if (this._events[evt]) clearEvent(this, evt);\n  } else {\n    this._events = new Events();\n    this._eventsCount = 0;\n  }\n\n  return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n  module.exports = EventEmitter;\n}\n", "/**\n * @license React\n * react-is.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n  (function() {\n'use strict';\n\n// ATTENTION\n// When adding new symbols to this file,\n// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'\n// The Symbol used to tag the ReactElement-like types.\nvar REACT_ELEMENT_TYPE = Symbol.for('react.element');\nvar REACT_PORTAL_TYPE = Symbol.for('react.portal');\nvar REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');\nvar REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');\nvar REACT_PROFILER_TYPE = Symbol.for('react.profiler');\nvar REACT_PROVIDER_TYPE = Symbol.for('react.provider');\nvar REACT_CONTEXT_TYPE = Symbol.for('react.context');\nvar REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context');\nvar REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');\nvar REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');\nvar REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');\nvar REACT_MEMO_TYPE = Symbol.for('react.memo');\nvar REACT_LAZY_TYPE = Symbol.for('react.lazy');\nvar REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');\n\n// -----------------------------------------------------------------------------\n\nvar enableScopeAPI = false; // Experimental Create Event Handle API.\nvar enableCacheElement = false;\nvar enableTransitionTracing = false; // No known bugs, but needs performance testing\n\nvar enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber\n// stuff. Intended to enable React core members to more easily debug scheduling\n// issues in DEV builds.\n\nvar enableDebugTracing = false; // Track which Fiber(s) schedule render work.\n\nvar REACT_MODULE_REFERENCE;\n\n{\n  REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');\n}\n\nfunction isValidElementType(type) {\n  if (typeof type === 'string' || typeof type === 'function') {\n    return true;\n  } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).\n\n\n  if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing  || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden  || type === REACT_OFFSCREEN_TYPE || enableScopeAPI  || enableCacheElement  || enableTransitionTracing ) {\n    return true;\n  }\n\n  if (typeof type === 'object' && type !== null) {\n    if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object\n    // types supported by any Flight configuration anywhere since\n    // we don't know which Flight build this will end up being used\n    // with.\n    type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {\n      return true;\n    }\n  }\n\n  return false;\n}\n\nfunction typeOf(object) {\n  if (typeof object === 'object' && object !== null) {\n    var $$typeof = object.$$typeof;\n\n    switch ($$typeof) {\n      case REACT_ELEMENT_TYPE:\n        var type = object.type;\n\n        switch (type) {\n          case REACT_FRAGMENT_TYPE:\n          case REACT_PROFILER_TYPE:\n          case REACT_STRICT_MODE_TYPE:\n          case REACT_SUSPENSE_TYPE:\n          case REACT_SUSPENSE_LIST_TYPE:\n            return type;\n\n          default:\n            var $$typeofType = type && type.$$typeof;\n\n            switch ($$typeofType) {\n              case REACT_SERVER_CONTEXT_TYPE:\n              case REACT_CONTEXT_TYPE:\n              case REACT_FORWARD_REF_TYPE:\n              case REACT_LAZY_TYPE:\n              case REACT_MEMO_TYPE:\n              case REACT_PROVIDER_TYPE:\n                return $$typeofType;\n\n              default:\n                return $$typeof;\n            }\n\n        }\n\n      case REACT_PORTAL_TYPE:\n        return $$typeof;\n    }\n  }\n\n  return undefined;\n}\nvar ContextConsumer = REACT_CONTEXT_TYPE;\nvar ContextProvider = REACT_PROVIDER_TYPE;\nvar Element = REACT_ELEMENT_TYPE;\nvar ForwardRef = REACT_FORWARD_REF_TYPE;\nvar Fragment = REACT_FRAGMENT_TYPE;\nvar Lazy = REACT_LAZY_TYPE;\nvar Memo = REACT_MEMO_TYPE;\nvar Portal = REACT_PORTAL_TYPE;\nvar Profiler = REACT_PROFILER_TYPE;\nvar StrictMode = REACT_STRICT_MODE_TYPE;\nvar Suspense = REACT_SUSPENSE_TYPE;\nvar SuspenseList = REACT_SUSPENSE_LIST_TYPE;\nvar hasWarnedAboutDeprecatedIsAsyncMode = false;\nvar hasWarnedAboutDeprecatedIsConcurrentMode = false; // AsyncMode should be deprecated\n\nfunction isAsyncMode(object) {\n  {\n    if (!hasWarnedAboutDeprecatedIsAsyncMode) {\n      hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint\n\n      console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 18+.');\n    }\n  }\n\n  return false;\n}\nfunction isConcurrentMode(object) {\n  {\n    if (!hasWarnedAboutDeprecatedIsConcurrentMode) {\n      hasWarnedAboutDeprecatedIsConcurrentMode = true; // Using console['warn'] to evade Babel and ESLint\n\n      console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'and will be removed in React 18+.');\n    }\n  }\n\n  return false;\n}\nfunction isContextConsumer(object) {\n  return typeOf(object) === REACT_CONTEXT_TYPE;\n}\nfunction isContextProvider(object) {\n  return typeOf(object) === REACT_PROVIDER_TYPE;\n}\nfunction isElement(object) {\n  return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;\n}\nfunction isForwardRef(object) {\n  return typeOf(object) === REACT_FORWARD_REF_TYPE;\n}\nfunction isFragment(object) {\n  return typeOf(object) === REACT_FRAGMENT_TYPE;\n}\nfunction isLazy(object) {\n  return typeOf(object) === REACT_LAZY_TYPE;\n}\nfunction isMemo(object) {\n  return typeOf(object) === REACT_MEMO_TYPE;\n}\nfunction isPortal(object) {\n  return typeOf(object) === REACT_PORTAL_TYPE;\n}\nfunction isProfiler(object) {\n  return typeOf(object) === REACT_PROFILER_TYPE;\n}\nfunction isStrictMode(object) {\n  return typeOf(object) === REACT_STRICT_MODE_TYPE;\n}\nfunction isSuspense(object) {\n  return typeOf(object) === REACT_SUSPENSE_TYPE;\n}\nfunction isSuspenseList(object) {\n  return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;\n}\n\nexports.ContextConsumer = ContextConsumer;\nexports.ContextProvider = ContextProvider;\nexports.Element = Element;\nexports.ForwardRef = ForwardRef;\nexports.Fragment = Fragment;\nexports.Lazy = Lazy;\nexports.Memo = Memo;\nexports.Portal = Portal;\nexports.Profiler = Profiler;\nexports.StrictMode = StrictMode;\nexports.Suspense = Suspense;\nexports.SuspenseList = SuspenseList;\nexports.isAsyncMode = isAsyncMode;\nexports.isConcurrentMode = isConcurrentMode;\nexports.isContextConsumer = isContextConsumer;\nexports.isContextProvider = isContextProvider;\nexports.isElement = isElement;\nexports.isForwardRef = isForwardRef;\nexports.isFragment = isFragment;\nexports.isLazy = isLazy;\nexports.isMemo = isMemo;\nexports.isPortal = isPortal;\nexports.isProfiler = isProfiler;\nexports.isStrictMode = isStrictMode;\nexports.isSuspense = isSuspense;\nexports.isSuspenseList = isSuspenseList;\nexports.isValidElementType = isValidElementType;\nexports.typeOf = typeOf;\n  })();\n}\n", "'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n  module.exports = require('./cjs/react-is.production.min.js');\n} else {\n  module.exports = require('./cjs/react-is.development.js');\n}\n", "'use strict'\n\n// Note: this is the semver.org version of the spec that it implements\n// Not necessarily the package version of this code.\nconst SEMVER_SPEC_VERSION = '2.0.0'\n\nconst MAX_LENGTH = 256\nconst MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||\n/* istanbul ignore next */ 9007199254740991\n\n// Max safe segment length for coercion.\nconst MAX_SAFE_COMPONENT_LENGTH = 16\n\n// Max safe length for a build identifier. The max length minus 6 characters for\n// the shortest version with a build 0.0.0+BUILD.\nconst MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6\n\nconst RELEASE_TYPES = [\n  'major',\n  'premajor',\n  'minor',\n  'preminor',\n  'patch',\n  'prepatch',\n  'prerelease',\n]\n\nmodule.exports = {\n  MAX_LENGTH,\n  MAX_SAFE_COMPONENT_LENGTH,\n  MAX_SAFE_BUILD_LENGTH,\n  MAX_SAFE_INTEGER,\n  RELEASE_TYPES,\n  SEMVER_SPEC_VERSION,\n  FLAG_INCLUDE_PRERELEASE: 0b001,\n  FLAG_LOOSE: 0b010,\n}\n", "'use strict'\n\nconst debug = (\n  typeof process === 'object' &&\n  process.env &&\n  process.env.NODE_DEBUG &&\n  /\\bsemver\\b/i.test(process.env.NODE_DEBUG)\n) ? (...args) => console.error('SEMVER', ...args)\n  : () => {}\n\nmodule.exports = debug\n", "'use strict'\n\nconst {\n  MAX_SAFE_COMPONENT_LENGTH,\n  MAX_SAFE_BUILD_LENGTH,\n  MAX_LENGTH,\n} = require('./constants')\nconst debug = require('./debug')\nexports = module.exports = {}\n\n// The actual regexps go on exports.re\nconst re = exports.re = []\nconst safeRe = exports.safeRe = []\nconst src = exports.src = []\nconst safeSrc = exports.safeSrc = []\nconst t = exports.t = {}\nlet R = 0\n\nconst LETTERDASHNUMBER = '[a-zA-Z0-9-]'\n\n// Replace some greedy regex tokens to prevent regex dos issues. These regex are\n// used internally via the safeRe object since all inputs in this library get\n// normalized first to trim and collapse all extra whitespace. The original\n// regexes are exported for userland consumption and lower level usage. A\n// future breaking change could export the safer regex only with a note that\n// all input should have extra whitespace removed.\nconst safeRegexReplacements = [\n  ['\\\\s', 1],\n  ['\\\\d', MAX_LENGTH],\n  [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],\n]\n\nconst makeSafeRegex = (value) => {\n  for (const [token, max] of safeRegexReplacements) {\n    value = value\n      .split(`${token}*`).join(`${token}{0,${max}}`)\n      .split(`${token}+`).join(`${token}{1,${max}}`)\n  }\n  return value\n}\n\nconst createToken = (name, value, isGlobal) => {\n  const safe = makeSafeRegex(value)\n  const index = R++\n  debug(name, index, value)\n  t[name] = index\n  src[index] = value\n  safeSrc[index] = safe\n  re[index] = new RegExp(value, isGlobal ? 'g' : undefined)\n  safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined)\n}\n\n// The following Regular Expressions can be used for tokenizing,\n// validating, and parsing SemVer version strings.\n\n// ## Numeric Identifier\n// A single `0`, or a non-zero digit followed by zero or more digits.\n\ncreateToken('NUMERICIDENTIFIER', '0|[1-9]\\\\d*')\ncreateToken('NUMERICIDENTIFIERLOOSE', '\\\\d+')\n\n// ## Non-numeric Identifier\n// Zero or more digits, followed by a letter or hyphen, and then zero or\n// more letters, digits, or hyphens.\n\ncreateToken('NONNUMERICIDENTIFIER', `\\\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`)\n\n// ## Main Version\n// Three dot-separated numeric identifiers.\n\ncreateToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n                   `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n                   `(${src[t.NUMERICIDENTIFIER]})`)\n\ncreateToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n                        `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n                        `(${src[t.NUMERICIDENTIFIERLOOSE]})`)\n\n// ## Pre-release Version Identifier\n// A numeric identifier, or a non-numeric identifier.\n// Non-numeric identifiers include numeric identifiers but can be longer.\n// Therefore non-numeric identifiers must go first.\n\ncreateToken('PRERELEASEIDENTIFIER', `(?:${src[t.NONNUMERICIDENTIFIER]\n}|${src[t.NUMERICIDENTIFIER]})`)\n\ncreateToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NONNUMERICIDENTIFIER]\n}|${src[t.NUMERICIDENTIFIERLOOSE]})`)\n\n// ## Pre-release Version\n// Hyphen, followed by one or more dot-separated pre-release version\n// identifiers.\n\ncreateToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIER]})*))`)\n\ncreateToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)\n\n// ## Build Metadata Identifier\n// Any combination of digits, letters, or hyphens.\n\ncreateToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`)\n\n// ## Build Metadata\n// Plus sign, followed by one or more period-separated build metadata\n// identifiers.\n\ncreateToken('BUILD', `(?:\\\\+(${src[t.BUILDIDENTIFIER]\n}(?:\\\\.${src[t.BUILDIDENTIFIER]})*))`)\n\n// ## Full Version String\n// A main version, followed optionally by a pre-release version and\n// build metadata.\n\n// Note that the only major, minor, patch, and pre-release sections of\n// the version string are capturing groups.  The build metadata is not a\n// capturing group, because it should not ever be used in version\n// comparison.\n\ncreateToken('FULLPLAIN', `v?${src[t.MAINVERSION]\n}${src[t.PRERELEASE]}?${\n  src[t.BUILD]}?`)\n\ncreateToken('FULL', `^${src[t.FULLPLAIN]}$`)\n\n// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.\n// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty\n// common in the npm registry.\ncreateToken('LOOSEPLAIN', `[v=\\\\s]*${src[t.MAINVERSIONLOOSE]\n}${src[t.PRERELEASELOOSE]}?${\n  src[t.BUILD]}?`)\n\ncreateToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)\n\ncreateToken('GTLT', '((?:<|>)?=?)')\n\n// Something like \"2.*\" or \"1.2.x\".\n// Note that \"x.x\" is a valid xRange identifer, meaning \"any version\"\n// Only the first item is strictly required.\ncreateToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\\\*`)\ncreateToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\\\*`)\n\ncreateToken('XRANGEPLAIN', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIER]})` +\n                   `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n                   `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n                   `(?:${src[t.PRERELEASE]})?${\n                     src[t.BUILD]}?` +\n                   `)?)?`)\n\ncreateToken('XRANGEPLAINLOOSE', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n                        `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n                        `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n                        `(?:${src[t.PRERELEASELOOSE]})?${\n                          src[t.BUILD]}?` +\n                        `)?)?`)\n\ncreateToken('XRANGE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAIN]}$`)\ncreateToken('XRANGELOOSE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Coercion.\n// Extract anything that could conceivably be a part of a valid semver\ncreateToken('COERCEPLAIN', `${'(^|[^\\\\d])' +\n              '(\\\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +\n              `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +\n              `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`)\ncreateToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\\\d])`)\ncreateToken('COERCEFULL', src[t.COERCEPLAIN] +\n              `(?:${src[t.PRERELEASE]})?` +\n              `(?:${src[t.BUILD]})?` +\n              `(?:$|[^\\\\d])`)\ncreateToken('COERCERTL', src[t.COERCE], true)\ncreateToken('COERCERTLFULL', src[t.COERCEFULL], true)\n\n// Tilde ranges.\n// Meaning is \"reasonably at or greater than\"\ncreateToken('LONETILDE', '(?:~>?)')\n\ncreateToken('TILDETRIM', `(\\\\s*)${src[t.LONETILDE]}\\\\s+`, true)\nexports.tildeTrimReplace = '$1~'\n\ncreateToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Caret ranges.\n// Meaning is \"at least and backwards compatible with\"\ncreateToken('LONECARET', '(?:\\\\^)')\n\ncreateToken('CARETTRIM', `(\\\\s*)${src[t.LONECARET]}\\\\s+`, true)\nexports.caretTrimReplace = '$1^'\n\ncreateToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// A simple gt/lt/eq thing, or just \"\" to indicate \"any version\"\ncreateToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\\\s*(${src[t.LOOSEPLAIN]})$|^$`)\ncreateToken('COMPARATOR', `^${src[t.GTLT]}\\\\s*(${src[t.FULLPLAIN]})$|^$`)\n\n// An expression to strip any whitespace between the gtlt and the thing\n// it modifies, so that `> 1.2.3` ==> `>1.2.3`\ncreateToken('COMPARATORTRIM', `(\\\\s*)${src[t.GTLT]\n}\\\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)\nexports.comparatorTrimReplace = '$1$2$3'\n\n// Something like `1.2.3 - 1.2.4`\n// Note that these all use the loose form, because they'll be\n// checked against either the strict or loose comparator form\n// later.\ncreateToken('HYPHENRANGE', `^\\\\s*(${src[t.XRANGEPLAIN]})` +\n                   `\\\\s+-\\\\s+` +\n                   `(${src[t.XRANGEPLAIN]})` +\n                   `\\\\s*$`)\n\ncreateToken('HYPHENRANGELOOSE', `^\\\\s*(${src[t.XRANGEPLAINLOOSE]})` +\n                        `\\\\s+-\\\\s+` +\n                        `(${src[t.XRANGEPLAINLOOSE]})` +\n                        `\\\\s*$`)\n\n// Star ranges basically just allow anything at all.\ncreateToken('STAR', '(<|>)?=?\\\\s*\\\\*')\n// >=0.0.0 is like a star\ncreateToken('GTE0', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0\\\\s*$')\ncreateToken('GTE0PRE', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0-0\\\\s*$')\n", "'use strict'\n\n// parse out just the options we care about\nconst looseOption = Object.freeze({ loose: true })\nconst emptyOpts = Object.freeze({ })\nconst parseOptions = options => {\n  if (!options) {\n    return emptyOpts\n  }\n\n  if (typeof options !== 'object') {\n    return looseOption\n  }\n\n  return options\n}\nmodule.exports = parseOptions\n", "'use strict'\n\nconst numeric = /^[0-9]+$/\nconst compareIdentifiers = (a, b) => {\n  if (typeof a === 'number' && typeof b === 'number') {\n    return a === b ? 0 : a < b ? -1 : 1\n  }\n\n  const anum = numeric.test(a)\n  const bnum = numeric.test(b)\n\n  if (anum && bnum) {\n    a = +a\n    b = +b\n  }\n\n  return a === b ? 0\n    : (anum && !bnum) ? -1\n    : (bnum && !anum) ? 1\n    : a < b ? -1\n    : 1\n}\n\nconst rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)\n\nmodule.exports = {\n  compareIdentifiers,\n  rcompareIdentifiers,\n}\n", "'use strict'\n\nconst debug = require('../internal/debug')\nconst { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants')\nconst { safeRe: re, t } = require('../internal/re')\n\nconst parseOptions = require('../internal/parse-options')\nconst { compareIdentifiers } = require('../internal/identifiers')\nclass SemVer {\n  constructor (version, options) {\n    options = parseOptions(options)\n\n    if (version instanceof SemVer) {\n      if (version.loose === !!options.loose &&\n        version.includePrerelease === !!options.includePrerelease) {\n        return version\n      } else {\n        version = version.version\n      }\n    } else if (typeof version !== 'string') {\n      throw new TypeError(`Invalid version. Must be a string. Got type \"${typeof version}\".`)\n    }\n\n    if (version.length > MAX_LENGTH) {\n      throw new TypeError(\n        `version is longer than ${MAX_LENGTH} characters`\n      )\n    }\n\n    debug('SemVer', version, options)\n    this.options = options\n    this.loose = !!options.loose\n    // this isn't actually relevant for versions, but keep it so that we\n    // don't run into trouble passing this.options around.\n    this.includePrerelease = !!options.includePrerelease\n\n    const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])\n\n    if (!m) {\n      throw new TypeError(`Invalid Version: ${version}`)\n    }\n\n    this.raw = version\n\n    // these are actually numbers\n    this.major = +m[1]\n    this.minor = +m[2]\n    this.patch = +m[3]\n\n    if (this.major > MAX_SAFE_INTEGER || this.major < 0) {\n      throw new TypeError('Invalid major version')\n    }\n\n    if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {\n      throw new TypeError('Invalid minor version')\n    }\n\n    if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {\n      throw new TypeError('Invalid patch version')\n    }\n\n    // numberify any prerelease numeric ids\n    if (!m[4]) {\n      this.prerelease = []\n    } else {\n      this.prerelease = m[4].split('.').map((id) => {\n        if (/^[0-9]+$/.test(id)) {\n          const num = +id\n          if (num >= 0 && num < MAX_SAFE_INTEGER) {\n            return num\n          }\n        }\n        return id\n      })\n    }\n\n    this.build = m[5] ? m[5].split('.') : []\n    this.format()\n  }\n\n  format () {\n    this.version = `${this.major}.${this.minor}.${this.patch}`\n    if (this.prerelease.length) {\n      this.version += `-${this.prerelease.join('.')}`\n    }\n    return this.version\n  }\n\n  toString () {\n    return this.version\n  }\n\n  compare (other) {\n    debug('SemVer.compare', this.version, this.options, other)\n    if (!(other instanceof SemVer)) {\n      if (typeof other === 'string' && other === this.version) {\n        return 0\n      }\n      other = new SemVer(other, this.options)\n    }\n\n    if (other.version === this.version) {\n      return 0\n    }\n\n    return this.compareMain(other) || this.comparePre(other)\n  }\n\n  compareMain (other) {\n    if (!(other instanceof SemVer)) {\n      other = new SemVer(other, this.options)\n    }\n\n    if (this.major < other.major) {\n      return -1\n    }\n    if (this.major > other.major) {\n      return 1\n    }\n    if (this.minor < other.minor) {\n      return -1\n    }\n    if (this.minor > other.minor) {\n      return 1\n    }\n    if (this.patch < other.patch) {\n      return -1\n    }\n    if (this.patch > other.patch) {\n      return 1\n    }\n    return 0\n  }\n\n  comparePre (other) {\n    if (!(other instanceof SemVer)) {\n      other = new SemVer(other, this.options)\n    }\n\n    // NOT having a prerelease is > having one\n    if (this.prerelease.length && !other.prerelease.length) {\n      return -1\n    } else if (!this.prerelease.length && other.prerelease.length) {\n      return 1\n    } else if (!this.prerelease.length && !other.prerelease.length) {\n      return 0\n    }\n\n    let i = 0\n    do {\n      const a = this.prerelease[i]\n      const b = other.prerelease[i]\n      debug('prerelease compare', i, a, b)\n      if (a === undefined && b === undefined) {\n        return 0\n      } else if (b === undefined) {\n        return 1\n      } else if (a === undefined) {\n        return -1\n      } else if (a === b) {\n        continue\n      } else {\n        return compareIdentifiers(a, b)\n      }\n    } while (++i)\n  }\n\n  compareBuild (other) {\n    if (!(other instanceof SemVer)) {\n      other = new SemVer(other, this.options)\n    }\n\n    let i = 0\n    do {\n      const a = this.build[i]\n      const b = other.build[i]\n      debug('build compare', i, a, b)\n      if (a === undefined && b === undefined) {\n        return 0\n      } else if (b === undefined) {\n        return 1\n      } else if (a === undefined) {\n        return -1\n      } else if (a === b) {\n        continue\n      } else {\n        return compareIdentifiers(a, b)\n      }\n    } while (++i)\n  }\n\n  // preminor will bump the version up to the next minor release, and immediately\n  // down to pre-release. premajor and prepatch work the same way.\n  inc (release, identifier, identifierBase) {\n    if (release.startsWith('pre')) {\n      if (!identifier && identifierBase === false) {\n        throw new Error('invalid increment argument: identifier is empty')\n      }\n      // Avoid an invalid semver results\n      if (identifier) {\n        const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE])\n        if (!match || match[1] !== identifier) {\n          throw new Error(`invalid identifier: ${identifier}`)\n        }\n      }\n    }\n\n    switch (release) {\n      case 'premajor':\n        this.prerelease.length = 0\n        this.patch = 0\n        this.minor = 0\n        this.major++\n        this.inc('pre', identifier, identifierBase)\n        break\n      case 'preminor':\n        this.prerelease.length = 0\n        this.patch = 0\n        this.minor++\n        this.inc('pre', identifier, identifierBase)\n        break\n      case 'prepatch':\n        // If this is already a prerelease, it will bump to the next version\n        // drop any prereleases that might already exist, since they are not\n        // relevant at this point.\n        this.prerelease.length = 0\n        this.inc('patch', identifier, identifierBase)\n        this.inc('pre', identifier, identifierBase)\n        break\n      // If the input is a non-prerelease version, this acts the same as\n      // prepatch.\n      case 'prerelease':\n        if (this.prerelease.length === 0) {\n          this.inc('patch', identifier, identifierBase)\n        }\n        this.inc('pre', identifier, identifierBase)\n        break\n      case 'release':\n        if (this.prerelease.length === 0) {\n          throw new Error(`version ${this.raw} is not a prerelease`)\n        }\n        this.prerelease.length = 0\n        break\n\n      case 'major':\n        // If this is a pre-major version, bump up to the same major version.\n        // Otherwise increment major.\n        // 1.0.0-5 bumps to 1.0.0\n        // 1.1.0 bumps to 2.0.0\n        if (\n          this.minor !== 0 ||\n          this.patch !== 0 ||\n          this.prerelease.length === 0\n        ) {\n          this.major++\n        }\n        this.minor = 0\n        this.patch = 0\n        this.prerelease = []\n        break\n      case 'minor':\n        // If this is a pre-minor version, bump up to the same minor version.\n        // Otherwise increment minor.\n        // 1.2.0-5 bumps to 1.2.0\n        // 1.2.1 bumps to 1.3.0\n        if (this.patch !== 0 || this.prerelease.length === 0) {\n          this.minor++\n        }\n        this.patch = 0\n        this.prerelease = []\n        break\n      case 'patch':\n        // If this is not a pre-release version, it will increment the patch.\n        // If it is a pre-release it will bump up to the same patch version.\n        // 1.2.0-5 patches to 1.2.0\n        // 1.2.0 patches to 1.2.1\n        if (this.prerelease.length === 0) {\n          this.patch++\n        }\n        this.prerelease = []\n        break\n      // This probably shouldn't be used publicly.\n      // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.\n      case 'pre': {\n        const base = Number(identifierBase) ? 1 : 0\n\n        if (this.prerelease.length === 0) {\n          this.prerelease = [base]\n        } else {\n          let i = this.prerelease.length\n          while (--i >= 0) {\n            if (typeof this.prerelease[i] === 'number') {\n              this.prerelease[i]++\n              i = -2\n            }\n          }\n          if (i === -1) {\n            // didn't increment anything\n            if (identifier === this.prerelease.join('.') && identifierBase === false) {\n              throw new Error('invalid increment argument: identifier already exists')\n            }\n            this.prerelease.push(base)\n          }\n        }\n        if (identifier) {\n          // 1.2.0-beta.1 bumps to 1.2.0-beta.2,\n          // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0\n          let prerelease = [identifier, base]\n          if (identifierBase === false) {\n            prerelease = [identifier]\n          }\n          if (compareIdentifiers(this.prerelease[0], identifier) === 0) {\n            if (isNaN(this.prerelease[1])) {\n              this.prerelease = prerelease\n            }\n          } else {\n            this.prerelease = prerelease\n          }\n        }\n        break\n      }\n      default:\n        throw new Error(`invalid increment argument: ${release}`)\n    }\n    this.raw = this.format()\n    if (this.build.length) {\n      this.raw += `+${this.build.join('.')}`\n    }\n    return this\n  }\n}\n\nmodule.exports = SemVer\n", "'use strict'\n\nconst SemVer = require('../classes/semver')\nconst parse = (version, options, throwErrors = false) => {\n  if (version instanceof SemVer) {\n    return version\n  }\n  try {\n    return new SemVer(version, options)\n  } catch (er) {\n    if (!throwErrors) {\n      return null\n    }\n    throw er\n  }\n}\n\nmodule.exports = parse\n", "'use strict'\n\nconst parse = require('./parse')\nconst valid = (version, options) => {\n  const v = parse(version, options)\n  return v ? v.version : null\n}\nmodule.exports = valid\n", "'use strict'\n\nconst parse = require('./parse')\nconst clean = (version, options) => {\n  const s = parse(version.trim().replace(/^[=v]+/, ''), options)\n  return s ? s.version : null\n}\nmodule.exports = clean\n", "'use strict'\n\nconst SemVer = require('../classes/semver')\n\nconst inc = (version, release, options, identifier, identifierBase) => {\n  if (typeof (options) === 'string') {\n    identifierBase = identifier\n    identifier = options\n    options = undefined\n  }\n\n  try {\n    return new SemVer(\n      version instanceof SemVer ? version.version : version,\n      options\n    ).inc(release, identifier, identifierBase).version\n  } catch (er) {\n    return null\n  }\n}\nmodule.exports = inc\n", "'use strict'\n\nconst parse = require('./parse.js')\n\nconst diff = (version1, version2) => {\n  const v1 = parse(version1, null, true)\n  const v2 = parse(version2, null, true)\n  const comparison = v1.compare(v2)\n\n  if (comparison === 0) {\n    return null\n  }\n\n  const v1Higher = comparison > 0\n  const highVersion = v1Higher ? v1 : v2\n  const lowVersion = v1Higher ? v2 : v1\n  const highHasPre = !!highVersion.prerelease.length\n  const lowHasPre = !!lowVersion.prerelease.length\n\n  if (lowHasPre && !highHasPre) {\n    // Going from prerelease -> no prerelease requires some special casing\n\n    // If the low version has only a major, then it will always be a major\n    // Some examples:\n    // 1.0.0-1 -> 1.0.0\n    // 1.0.0-1 -> 1.1.1\n    // 1.0.0-1 -> 2.0.0\n    if (!lowVersion.patch && !lowVersion.minor) {\n      return 'major'\n    }\n\n    // If the main part has no difference\n    if (lowVersion.compareMain(highVersion) === 0) {\n      if (lowVersion.minor && !lowVersion.patch) {\n        return 'minor'\n      }\n      return 'patch'\n    }\n  }\n\n  // add the `pre` prefix if we are going to a prerelease version\n  const prefix = highHasPre ? 'pre' : ''\n\n  if (v1.major !== v2.major) {\n    return prefix + 'major'\n  }\n\n  if (v1.minor !== v2.minor) {\n    return prefix + 'minor'\n  }\n\n  if (v1.patch !== v2.patch) {\n    return prefix + 'patch'\n  }\n\n  // high and low are prereleases\n  return 'prerelease'\n}\n\nmodule.exports = diff\n", "'use strict'\n\nconst SemVer = require('../classes/semver')\nconst major = (a, loose) => new SemVer(a, loose).major\nmodule.exports = major\n", "'use strict'\n\nconst SemVer = require('../classes/semver')\nconst minor = (a, loose) => new SemVer(a, loose).minor\nmodule.exports = minor\n", "'use strict'\n\nconst SemVer = require('../classes/semver')\nconst patch = (a, loose) => new SemVer(a, loose).patch\nmodule.exports = patch\n", "'use strict'\n\nconst parse = require('./parse')\nconst prerelease = (version, options) => {\n  const parsed = parse(version, options)\n  return (parsed && parsed.prerelease.length) ? parsed.prerelease : null\n}\nmodule.exports = prerelease\n", "'use strict'\n\nconst SemVer = require('../classes/semver')\nconst compare = (a, b, loose) =>\n  new SemVer(a, loose).compare(new SemVer(b, loose))\n\nmodule.exports = compare\n", "'use strict'\n\nconst compare = require('./compare')\nconst rcompare = (a, b, loose) => compare(b, a, loose)\nmodule.exports = rcompare\n", "'use strict'\n\nconst compare = require('./compare')\nconst compareLoose = (a, b) => compare(a, b, true)\nmodule.exports = compareLoose\n", "'use strict'\n\nconst SemVer = require('../classes/semver')\nconst compareBuild = (a, b, loose) => {\n  const versionA = new SemVer(a, loose)\n  const versionB = new SemVer(b, loose)\n  return versionA.compare(versionB) || versionA.compareBuild(versionB)\n}\nmodule.exports = compareBuild\n", "'use strict'\n\nconst compareBuild = require('./compare-build')\nconst sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose))\nmodule.exports = sort\n", "'use strict'\n\nconst compareBuild = require('./compare-build')\nconst rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose))\nmodule.exports = rsort\n", "'use strict'\n\nconst compare = require('./compare')\nconst gt = (a, b, loose) => compare(a, b, loose) > 0\nmodule.exports = gt\n", "'use strict'\n\nconst compare = require('./compare')\nconst lt = (a, b, loose) => compare(a, b, loose) < 0\nmodule.exports = lt\n", "'use strict'\n\nconst compare = require('./compare')\nconst eq = (a, b, loose) => compare(a, b, loose) === 0\nmodule.exports = eq\n", "'use strict'\n\nconst compare = require('./compare')\nconst neq = (a, b, loose) => compare(a, b, loose) !== 0\nmodule.exports = neq\n", "'use strict'\n\nconst compare = require('./compare')\nconst gte = (a, b, loose) => compare(a, b, loose) >= 0\nmodule.exports = gte\n", "'use strict'\n\nconst compare = require('./compare')\nconst lte = (a, b, loose) => compare(a, b, loose) <= 0\nmodule.exports = lte\n", "'use strict'\n\nconst eq = require('./eq')\nconst neq = require('./neq')\nconst gt = require('./gt')\nconst gte = require('./gte')\nconst lt = require('./lt')\nconst lte = require('./lte')\n\nconst cmp = (a, op, b, loose) => {\n  switch (op) {\n    case '===':\n      if (typeof a === 'object') {\n        a = a.version\n      }\n      if (typeof b === 'object') {\n        b = b.version\n      }\n      return a === b\n\n    case '!==':\n      if (typeof a === 'object') {\n        a = a.version\n      }\n      if (typeof b === 'object') {\n        b = b.version\n      }\n      return a !== b\n\n    case '':\n    case '=':\n    case '==':\n      return eq(a, b, loose)\n\n    case '!=':\n      return neq(a, b, loose)\n\n    case '>':\n      return gt(a, b, loose)\n\n    case '>=':\n      return gte(a, b, loose)\n\n    case '<':\n      return lt(a, b, loose)\n\n    case '<=':\n      return lte(a, b, loose)\n\n    default:\n      throw new TypeError(`Invalid operator: ${op}`)\n  }\n}\nmodule.exports = cmp\n", "'use strict'\n\nconst SemVer = require('../classes/semver')\nconst parse = require('./parse')\nconst { safeRe: re, t } = require('../internal/re')\n\nconst coerce = (version, options) => {\n  if (version instanceof SemVer) {\n    return version\n  }\n\n  if (typeof version === 'number') {\n    version = String(version)\n  }\n\n  if (typeof version !== 'string') {\n    return null\n  }\n\n  options = options || {}\n\n  let match = null\n  if (!options.rtl) {\n    match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE])\n  } else {\n    // Find the right-most coercible string that does not share\n    // a terminus with a more left-ward coercible string.\n    // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'\n    // With includePrerelease option set, '1.2.3.4-rc' wants to coerce '2.3.4-rc', not '2.3.4'\n    //\n    // Walk through the string checking with a /g regexp\n    // Manually set the index so as to pick up overlapping matches.\n    // Stop when we get a match that ends at the string end, since no\n    // coercible string can be more right-ward without the same terminus.\n    const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL]\n    let next\n    while ((next = coerceRtlRegex.exec(version)) &&\n        (!match || match.index + match[0].length !== version.length)\n    ) {\n      if (!match ||\n            next.index + next[0].length !== match.index + match[0].length) {\n        match = next\n      }\n      coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length\n    }\n    // leave it in a clean state\n    coerceRtlRegex.lastIndex = -1\n  }\n\n  if (match === null) {\n    return null\n  }\n\n  const major = match[2]\n  const minor = match[3] || '0'\n  const patch = match[4] || '0'\n  const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : ''\n  const build = options.includePrerelease && match[6] ? `+${match[6]}` : ''\n\n  return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options)\n}\nmodule.exports = coerce\n", "'use strict'\n\nclass LRUCache {\n  constructor () {\n    this.max = 1000\n    this.map = new Map()\n  }\n\n  get (key) {\n    const value = this.map.get(key)\n    if (value === undefined) {\n      return undefined\n    } else {\n      // Remove the key from the map and add it to the end\n      this.map.delete(key)\n      this.map.set(key, value)\n      return value\n    }\n  }\n\n  delete (key) {\n    return this.map.delete(key)\n  }\n\n  set (key, value) {\n    const deleted = this.delete(key)\n\n    if (!deleted && value !== undefined) {\n      // If cache is full, delete the least recently used item\n      if (this.map.size >= this.max) {\n        const firstKey = this.map.keys().next().value\n        this.delete(firstKey)\n      }\n\n      this.map.set(key, value)\n    }\n\n    return this\n  }\n}\n\nmodule.exports = LRUCache\n", "'use strict'\n\nconst SPACE_CHARACTERS = /\\s+/g\n\n// hoisted class for cyclic dependency\nclass Range {\n  constructor (range, options) {\n    options = parseOptions(options)\n\n    if (range instanceof Range) {\n      if (\n        range.loose === !!options.loose &&\n        range.includePrerelease === !!options.includePrerelease\n      ) {\n        return range\n      } else {\n        return new Range(range.raw, options)\n      }\n    }\n\n    if (range instanceof Comparator) {\n      // just put it in the set and return\n      this.raw = range.value\n      this.set = [[range]]\n      this.formatted = undefined\n      return this\n    }\n\n    this.options = options\n    this.loose = !!options.loose\n    this.includePrerelease = !!options.includePrerelease\n\n    // First reduce all whitespace as much as possible so we do not have to rely\n    // on potentially slow regexes like \\s*. This is then stored and used for\n    // future error messages as well.\n    this.raw = range.trim().replace(SPACE_CHARACTERS, ' ')\n\n    // First, split on ||\n    this.set = this.raw\n      .split('||')\n      // map the range to a 2d array of comparators\n      .map(r => this.parseRange(r.trim()))\n      // throw out any comparator lists that are empty\n      // this generally means that it was not a valid range, which is allowed\n      // in loose mode, but will still throw if the WHOLE range is invalid.\n      .filter(c => c.length)\n\n    if (!this.set.length) {\n      throw new TypeError(`Invalid SemVer Range: ${this.raw}`)\n    }\n\n    // if we have any that are not the null set, throw out null sets.\n    if (this.set.length > 1) {\n      // keep the first one, in case they're all null sets\n      const first = this.set[0]\n      this.set = this.set.filter(c => !isNullSet(c[0]))\n      if (this.set.length === 0) {\n        this.set = [first]\n      } else if (this.set.length > 1) {\n        // if we have any that are *, then the range is just *\n        for (const c of this.set) {\n          if (c.length === 1 && isAny(c[0])) {\n            this.set = [c]\n            break\n          }\n        }\n      }\n    }\n\n    this.formatted = undefined\n  }\n\n  get range () {\n    if (this.formatted === undefined) {\n      this.formatted = ''\n      for (let i = 0; i < this.set.length; i++) {\n        if (i > 0) {\n          this.formatted += '||'\n        }\n        const comps = this.set[i]\n        for (let k = 0; k < comps.length; k++) {\n          if (k > 0) {\n            this.formatted += ' '\n          }\n          this.formatted += comps[k].toString().trim()\n        }\n      }\n    }\n    return this.formatted\n  }\n\n  format () {\n    return this.range\n  }\n\n  toString () {\n    return this.range\n  }\n\n  parseRange (range) {\n    // memoize range parsing for performance.\n    // this is a very hot path, and fully deterministic.\n    const memoOpts =\n      (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) |\n      (this.options.loose && FLAG_LOOSE)\n    const memoKey = memoOpts + ':' + range\n    const cached = cache.get(memoKey)\n    if (cached) {\n      return cached\n    }\n\n    const loose = this.options.loose\n    // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`\n    const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]\n    range = range.replace(hr, hyphenReplace(this.options.includePrerelease))\n    debug('hyphen replace', range)\n\n    // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`\n    range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)\n    debug('comparator trim', range)\n\n    // `~ 1.2.3` => `~1.2.3`\n    range = range.replace(re[t.TILDETRIM], tildeTrimReplace)\n    debug('tilde trim', range)\n\n    // `^ 1.2.3` => `^1.2.3`\n    range = range.replace(re[t.CARETTRIM], caretTrimReplace)\n    debug('caret trim', range)\n\n    // At this point, the range is completely trimmed and\n    // ready to be split into comparators.\n\n    let rangeList = range\n      .split(' ')\n      .map(comp => parseComparator(comp, this.options))\n      .join(' ')\n      .split(/\\s+/)\n      // >=0.0.0 is equivalent to *\n      .map(comp => replaceGTE0(comp, this.options))\n\n    if (loose) {\n      // in loose mode, throw out any that are not valid comparators\n      rangeList = rangeList.filter(comp => {\n        debug('loose invalid filter', comp, this.options)\n        return !!comp.match(re[t.COMPARATORLOOSE])\n      })\n    }\n    debug('range list', rangeList)\n\n    // if any comparators are the null set, then replace with JUST null set\n    // if more than one comparator, remove any * comparators\n    // also, don't include the same comparator more than once\n    const rangeMap = new Map()\n    const comparators = rangeList.map(comp => new Comparator(comp, this.options))\n    for (const comp of comparators) {\n      if (isNullSet(comp)) {\n        return [comp]\n      }\n      rangeMap.set(comp.value, comp)\n    }\n    if (rangeMap.size > 1 && rangeMap.has('')) {\n      rangeMap.delete('')\n    }\n\n    const result = [...rangeMap.values()]\n    cache.set(memoKey, result)\n    return result\n  }\n\n  intersects (range, options) {\n    if (!(range instanceof Range)) {\n      throw new TypeError('a Range is required')\n    }\n\n    return this.set.some((thisComparators) => {\n      return (\n        isSatisfiable(thisComparators, options) &&\n        range.set.some((rangeComparators) => {\n          return (\n            isSatisfiable(rangeComparators, options) &&\n            thisComparators.every((thisComparator) => {\n              return rangeComparators.every((rangeComparator) => {\n                return thisComparator.intersects(rangeComparator, options)\n              })\n            })\n          )\n        })\n      )\n    })\n  }\n\n  // if ANY of the sets match ALL of its comparators, then pass\n  test (version) {\n    if (!version) {\n      return false\n    }\n\n    if (typeof version === 'string') {\n      try {\n        version = new SemVer(version, this.options)\n      } catch (er) {\n        return false\n      }\n    }\n\n    for (let i = 0; i < this.set.length; i++) {\n      if (testSet(this.set[i], version, this.options)) {\n        return true\n      }\n    }\n    return false\n  }\n}\n\nmodule.exports = Range\n\nconst LRU = require('../internal/lrucache')\nconst cache = new LRU()\n\nconst parseOptions = require('../internal/parse-options')\nconst Comparator = require('./comparator')\nconst debug = require('../internal/debug')\nconst SemVer = require('./semver')\nconst {\n  safeRe: re,\n  t,\n  comparatorTrimReplace,\n  tildeTrimReplace,\n  caretTrimReplace,\n} = require('../internal/re')\nconst { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require('../internal/constants')\n\nconst isNullSet = c => c.value === '<0.0.0-0'\nconst isAny = c => c.value === ''\n\n// take a set of comparators and determine whether there\n// exists a version which can satisfy it\nconst isSatisfiable = (comparators, options) => {\n  let result = true\n  const remainingComparators = comparators.slice()\n  let testComparator = remainingComparators.pop()\n\n  while (result && remainingComparators.length) {\n    result = remainingComparators.every((otherComparator) => {\n      return testComparator.intersects(otherComparator, options)\n    })\n\n    testComparator = remainingComparators.pop()\n  }\n\n  return result\n}\n\n// comprised of xranges, tildes, stars, and gtlt's at this point.\n// already replaced the hyphen ranges\n// turn into a set of JUST comparators.\nconst parseComparator = (comp, options) => {\n  comp = comp.replace(re[t.BUILD], '')\n  debug('comp', comp, options)\n  comp = replaceCarets(comp, options)\n  debug('caret', comp)\n  comp = replaceTildes(comp, options)\n  debug('tildes', comp)\n  comp = replaceXRanges(comp, options)\n  debug('xrange', comp)\n  comp = replaceStars(comp, options)\n  debug('stars', comp)\n  return comp\n}\n\nconst isX = id => !id || id.toLowerCase() === 'x' || id === '*'\n\n// ~, ~> --> * (any, kinda silly)\n// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0\n// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0\n// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0\n// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0\n// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0\n// ~0.0.1 --> >=0.0.1 <0.1.0-0\nconst replaceTildes = (comp, options) => {\n  return comp\n    .trim()\n    .split(/\\s+/)\n    .map((c) => replaceTilde(c, options))\n    .join(' ')\n}\n\nconst replaceTilde = (comp, options) => {\n  const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]\n  return comp.replace(r, (_, M, m, p, pr) => {\n    debug('tilde', comp, _, M, m, p, pr)\n    let ret\n\n    if (isX(M)) {\n      ret = ''\n    } else if (isX(m)) {\n      ret = `>=${M}.0.0 <${+M + 1}.0.0-0`\n    } else if (isX(p)) {\n      // ~1.2 == >=1.2.0 <1.3.0-0\n      ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`\n    } else if (pr) {\n      debug('replaceTilde pr', pr)\n      ret = `>=${M}.${m}.${p}-${pr\n      } <${M}.${+m + 1}.0-0`\n    } else {\n      // ~1.2.3 == >=1.2.3 <1.3.0-0\n      ret = `>=${M}.${m}.${p\n      } <${M}.${+m + 1}.0-0`\n    }\n\n    debug('tilde return', ret)\n    return ret\n  })\n}\n\n// ^ --> * (any, kinda silly)\n// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0\n// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0\n// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0\n// ^1.2.3 --> >=1.2.3 <2.0.0-0\n// ^1.2.0 --> >=1.2.0 <2.0.0-0\n// ^0.0.1 --> >=0.0.1 <0.0.2-0\n// ^0.1.0 --> >=0.1.0 <0.2.0-0\nconst replaceCarets = (comp, options) => {\n  return comp\n    .trim()\n    .split(/\\s+/)\n    .map((c) => replaceCaret(c, options))\n    .join(' ')\n}\n\nconst replaceCaret = (comp, options) => {\n  debug('caret', comp, options)\n  const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]\n  const z = options.includePrerelease ? '-0' : ''\n  return comp.replace(r, (_, M, m, p, pr) => {\n    debug('caret', comp, _, M, m, p, pr)\n    let ret\n\n    if (isX(M)) {\n      ret = ''\n    } else if (isX(m)) {\n      ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`\n    } else if (isX(p)) {\n      if (M === '0') {\n        ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`\n      } else {\n        ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`\n      }\n    } else if (pr) {\n      debug('replaceCaret pr', pr)\n      if (M === '0') {\n        if (m === '0') {\n          ret = `>=${M}.${m}.${p}-${pr\n          } <${M}.${m}.${+p + 1}-0`\n        } else {\n          ret = `>=${M}.${m}.${p}-${pr\n          } <${M}.${+m + 1}.0-0`\n        }\n      } else {\n        ret = `>=${M}.${m}.${p}-${pr\n        } <${+M + 1}.0.0-0`\n      }\n    } else {\n      debug('no pr')\n      if (M === '0') {\n        if (m === '0') {\n          ret = `>=${M}.${m}.${p\n          }${z} <${M}.${m}.${+p + 1}-0`\n        } else {\n          ret = `>=${M}.${m}.${p\n          }${z} <${M}.${+m + 1}.0-0`\n        }\n      } else {\n        ret = `>=${M}.${m}.${p\n        } <${+M + 1}.0.0-0`\n      }\n    }\n\n    debug('caret return', ret)\n    return ret\n  })\n}\n\nconst replaceXRanges = (comp, options) => {\n  debug('replaceXRanges', comp, options)\n  return comp\n    .split(/\\s+/)\n    .map((c) => replaceXRange(c, options))\n    .join(' ')\n}\n\nconst replaceXRange = (comp, options) => {\n  comp = comp.trim()\n  const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]\n  return comp.replace(r, (ret, gtlt, M, m, p, pr) => {\n    debug('xRange', comp, ret, gtlt, M, m, p, pr)\n    const xM = isX(M)\n    const xm = xM || isX(m)\n    const xp = xm || isX(p)\n    const anyX = xp\n\n    if (gtlt === '=' && anyX) {\n      gtlt = ''\n    }\n\n    // if we're including prereleases in the match, then we need\n    // to fix this to -0, the lowest possible prerelease value\n    pr = options.includePrerelease ? '-0' : ''\n\n    if (xM) {\n      if (gtlt === '>' || gtlt === '<') {\n        // nothing is allowed\n        ret = '<0.0.0-0'\n      } else {\n        // nothing is forbidden\n        ret = '*'\n      }\n    } else if (gtlt && anyX) {\n      // we know patch is an x, because we have any x at all.\n      // replace X with 0\n      if (xm) {\n        m = 0\n      }\n      p = 0\n\n      if (gtlt === '>') {\n        // >1 => >=2.0.0\n        // >1.2 => >=1.3.0\n        gtlt = '>='\n        if (xm) {\n          M = +M + 1\n          m = 0\n          p = 0\n        } else {\n          m = +m + 1\n          p = 0\n        }\n      } else if (gtlt === '<=') {\n        // <=0.7.x is actually <0.8.0, since any 0.7.x should\n        // pass.  Similarly, <=7.x is actually <8.0.0, etc.\n        gtlt = '<'\n        if (xm) {\n          M = +M + 1\n        } else {\n          m = +m + 1\n        }\n      }\n\n      if (gtlt === '<') {\n        pr = '-0'\n      }\n\n      ret = `${gtlt + M}.${m}.${p}${pr}`\n    } else if (xm) {\n      ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`\n    } else if (xp) {\n      ret = `>=${M}.${m}.0${pr\n      } <${M}.${+m + 1}.0-0`\n    }\n\n    debug('xRange return', ret)\n\n    return ret\n  })\n}\n\n// Because * is AND-ed with everything else in the comparator,\n// and '' means \"any version\", just remove the *s entirely.\nconst replaceStars = (comp, options) => {\n  debug('replaceStars', comp, options)\n  // Looseness is ignored here.  star is always as loose as it gets!\n  return comp\n    .trim()\n    .replace(re[t.STAR], '')\n}\n\nconst replaceGTE0 = (comp, options) => {\n  debug('replaceGTE0', comp, options)\n  return comp\n    .trim()\n    .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')\n}\n\n// This function is passed to string.replace(re[t.HYPHENRANGE])\n// M, m, patch, prerelease, build\n// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5\n// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do\n// 1.2 - 3.4 => >=1.2.0 <3.5.0-0\n// TODO build?\nconst hyphenReplace = incPr => ($0,\n  from, fM, fm, fp, fpr, fb,\n  to, tM, tm, tp, tpr) => {\n  if (isX(fM)) {\n    from = ''\n  } else if (isX(fm)) {\n    from = `>=${fM}.0.0${incPr ? '-0' : ''}`\n  } else if (isX(fp)) {\n    from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`\n  } else if (fpr) {\n    from = `>=${from}`\n  } else {\n    from = `>=${from}${incPr ? '-0' : ''}`\n  }\n\n  if (isX(tM)) {\n    to = ''\n  } else if (isX(tm)) {\n    to = `<${+tM + 1}.0.0-0`\n  } else if (isX(tp)) {\n    to = `<${tM}.${+tm + 1}.0-0`\n  } else if (tpr) {\n    to = `<=${tM}.${tm}.${tp}-${tpr}`\n  } else if (incPr) {\n    to = `<${tM}.${tm}.${+tp + 1}-0`\n  } else {\n    to = `<=${to}`\n  }\n\n  return `${from} ${to}`.trim()\n}\n\nconst testSet = (set, version, options) => {\n  for (let i = 0; i < set.length; i++) {\n    if (!set[i].test(version)) {\n      return false\n    }\n  }\n\n  if (version.prerelease.length && !options.includePrerelease) {\n    // Find the set of versions that are allowed to have prereleases\n    // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0\n    // That should allow `1.2.3-pr.2` to pass.\n    // However, `1.2.4-alpha.notready` should NOT be allowed,\n    // even though it's within the range set by the comparators.\n    for (let i = 0; i < set.length; i++) {\n      debug(set[i].semver)\n      if (set[i].semver === Comparator.ANY) {\n        continue\n      }\n\n      if (set[i].semver.prerelease.length > 0) {\n        const allowed = set[i].semver\n        if (allowed.major === version.major &&\n            allowed.minor === version.minor &&\n            allowed.patch === version.patch) {\n          return true\n        }\n      }\n    }\n\n    // Version has a -pre, but it's not one of the ones we like.\n    return false\n  }\n\n  return true\n}\n", "'use strict'\n\nconst ANY = Symbol('SemVer ANY')\n// hoisted class for cyclic dependency\nclass Comparator {\n  static get ANY () {\n    return ANY\n  }\n\n  constructor (comp, options) {\n    options = parseOptions(options)\n\n    if (comp instanceof Comparator) {\n      if (comp.loose === !!options.loose) {\n        return comp\n      } else {\n        comp = comp.value\n      }\n    }\n\n    comp = comp.trim().split(/\\s+/).join(' ')\n    debug('comparator', comp, options)\n    this.options = options\n    this.loose = !!options.loose\n    this.parse(comp)\n\n    if (this.semver === ANY) {\n      this.value = ''\n    } else {\n      this.value = this.operator + this.semver.version\n    }\n\n    debug('comp', this)\n  }\n\n  parse (comp) {\n    const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]\n    const m = comp.match(r)\n\n    if (!m) {\n      throw new TypeError(`Invalid comparator: ${comp}`)\n    }\n\n    this.operator = m[1] !== undefined ? m[1] : ''\n    if (this.operator === '=') {\n      this.operator = ''\n    }\n\n    // if it literally is just '>' or '' then allow anything.\n    if (!m[2]) {\n      this.semver = ANY\n    } else {\n      this.semver = new SemVer(m[2], this.options.loose)\n    }\n  }\n\n  toString () {\n    return this.value\n  }\n\n  test (version) {\n    debug('Comparator.test', version, this.options.loose)\n\n    if (this.semver === ANY || version === ANY) {\n      return true\n    }\n\n    if (typeof version === 'string') {\n      try {\n        version = new SemVer(version, this.options)\n      } catch (er) {\n        return false\n      }\n    }\n\n    return cmp(version, this.operator, this.semver, this.options)\n  }\n\n  intersects (comp, options) {\n    if (!(comp instanceof Comparator)) {\n      throw new TypeError('a Comparator is required')\n    }\n\n    if (this.operator === '') {\n      if (this.value === '') {\n        return true\n      }\n      return new Range(comp.value, options).test(this.value)\n    } else if (comp.operator === '') {\n      if (comp.value === '') {\n        return true\n      }\n      return new Range(this.value, options).test(comp.semver)\n    }\n\n    options = parseOptions(options)\n\n    // Special cases where nothing can possibly be lower\n    if (options.includePrerelease &&\n      (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {\n      return false\n    }\n    if (!options.includePrerelease &&\n      (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {\n      return false\n    }\n\n    // Same direction increasing (> or >=)\n    if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {\n      return true\n    }\n    // Same direction decreasing (< or <=)\n    if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {\n      return true\n    }\n    // same SemVer and both sides are inclusive (<= or >=)\n    if (\n      (this.semver.version === comp.semver.version) &&\n      this.operator.includes('=') && comp.operator.includes('=')) {\n      return true\n    }\n    // opposite directions less than\n    if (cmp(this.semver, '<', comp.semver, options) &&\n      this.operator.startsWith('>') && comp.operator.startsWith('<')) {\n      return true\n    }\n    // opposite directions greater than\n    if (cmp(this.semver, '>', comp.semver, options) &&\n      this.operator.startsWith('<') && comp.operator.startsWith('>')) {\n      return true\n    }\n    return false\n  }\n}\n\nmodule.exports = Comparator\n\nconst parseOptions = require('../internal/parse-options')\nconst { safeRe: re, t } = require('../internal/re')\nconst cmp = require('../functions/cmp')\nconst debug = require('../internal/debug')\nconst SemVer = require('./semver')\nconst Range = require('./range')\n", "'use strict'\n\nconst Range = require('../classes/range')\nconst satisfies = (version, range, options) => {\n  try {\n    range = new Range(range, options)\n  } catch (er) {\n    return false\n  }\n  return range.test(version)\n}\nmodule.exports = satisfies\n", "'use strict'\n\nconst Range = require('../classes/range')\n\n// Mostly just for testing and legacy API reasons\nconst toComparators = (range, options) =>\n  new Range(range, options).set\n    .map(comp => comp.map(c => c.value).join(' ').trim().split(' '))\n\nmodule.exports = toComparators\n", "'use strict'\n\nconst SemVer = require('../classes/semver')\nconst Range = require('../classes/range')\n\nconst maxSatisfying = (versions, range, options) => {\n  let max = null\n  let maxSV = null\n  let rangeObj = null\n  try {\n    rangeObj = new Range(range, options)\n  } catch (er) {\n    return null\n  }\n  versions.forEach((v) => {\n    if (rangeObj.test(v)) {\n      // satisfies(v, range, options)\n      if (!max || maxSV.compare(v) === -1) {\n        // compare(max, v, true)\n        max = v\n        maxSV = new SemVer(max, options)\n      }\n    }\n  })\n  return max\n}\nmodule.exports = maxSatisfying\n", "'use strict'\n\nconst SemVer = require('../classes/semver')\nconst Range = require('../classes/range')\nconst minSatisfying = (versions, range, options) => {\n  let min = null\n  let minSV = null\n  let rangeObj = null\n  try {\n    rangeObj = new Range(range, options)\n  } catch (er) {\n    return null\n  }\n  versions.forEach((v) => {\n    if (rangeObj.test(v)) {\n      // satisfies(v, range, options)\n      if (!min || minSV.compare(v) === 1) {\n        // compare(min, v, true)\n        min = v\n        minSV = new SemVer(min, options)\n      }\n    }\n  })\n  return min\n}\nmodule.exports = minSatisfying\n", "'use strict'\n\nconst SemVer = require('../classes/semver')\nconst Range = require('../classes/range')\nconst gt = require('../functions/gt')\n\nconst minVersion = (range, loose) => {\n  range = new Range(range, loose)\n\n  let minver = new SemVer('0.0.0')\n  if (range.test(minver)) {\n    return minver\n  }\n\n  minver = new SemVer('0.0.0-0')\n  if (range.test(minver)) {\n    return minver\n  }\n\n  minver = null\n  for (let i = 0; i < range.set.length; ++i) {\n    const comparators = range.set[i]\n\n    let setMin = null\n    comparators.forEach((comparator) => {\n      // Clone to avoid manipulating the comparator's semver object.\n      const compver = new SemVer(comparator.semver.version)\n      switch (comparator.operator) {\n        case '>':\n          if (compver.prerelease.length === 0) {\n            compver.patch++\n          } else {\n            compver.prerelease.push(0)\n          }\n          compver.raw = compver.format()\n          /* fallthrough */\n        case '':\n        case '>=':\n          if (!setMin || gt(compver, setMin)) {\n            setMin = compver\n          }\n          break\n        case '<':\n        case '<=':\n          /* Ignore maximum versions */\n          break\n        /* istanbul ignore next */\n        default:\n          throw new Error(`Unexpected operation: ${comparator.operator}`)\n      }\n    })\n    if (setMin && (!minver || gt(minver, setMin))) {\n      minver = setMin\n    }\n  }\n\n  if (minver && range.test(minver)) {\n    return minver\n  }\n\n  return null\n}\nmodule.exports = minVersion\n", "'use strict'\n\nconst Range = require('../classes/range')\nconst validRange = (range, options) => {\n  try {\n    // Return '*' instead of '' so that truthiness works.\n    // This will throw if it's invalid anyway\n    return new Range(range, options).range || '*'\n  } catch (er) {\n    return null\n  }\n}\nmodule.exports = validRange\n", "'use strict'\n\nconst SemVer = require('../classes/semver')\nconst Comparator = require('../classes/comparator')\nconst { ANY } = Comparator\nconst Range = require('../classes/range')\nconst satisfies = require('../functions/satisfies')\nconst gt = require('../functions/gt')\nconst lt = require('../functions/lt')\nconst lte = require('../functions/lte')\nconst gte = require('../functions/gte')\n\nconst outside = (version, range, hilo, options) => {\n  version = new SemVer(version, options)\n  range = new Range(range, options)\n\n  let gtfn, ltefn, ltfn, comp, ecomp\n  switch (hilo) {\n    case '>':\n      gtfn = gt\n      ltefn = lte\n      ltfn = lt\n      comp = '>'\n      ecomp = '>='\n      break\n    case '<':\n      gtfn = lt\n      ltefn = gte\n      ltfn = gt\n      comp = '<'\n      ecomp = '<='\n      break\n    default:\n      throw new TypeError('Must provide a hilo val of \"<\" or \">\"')\n  }\n\n  // If it satisfies the range it is not outside\n  if (satisfies(version, range, options)) {\n    return false\n  }\n\n  // From now on, variable terms are as if we're in \"gtr\" mode.\n  // but note that everything is flipped for the \"ltr\" function.\n\n  for (let i = 0; i < range.set.length; ++i) {\n    const comparators = range.set[i]\n\n    let high = null\n    let low = null\n\n    comparators.forEach((comparator) => {\n      if (comparator.semver === ANY) {\n        comparator = new Comparator('>=0.0.0')\n      }\n      high = high || comparator\n      low = low || comparator\n      if (gtfn(comparator.semver, high.semver, options)) {\n        high = comparator\n      } else if (ltfn(comparator.semver, low.semver, options)) {\n        low = comparator\n      }\n    })\n\n    // If the edge version comparator has a operator then our version\n    // isn't outside it\n    if (high.operator === comp || high.operator === ecomp) {\n      return false\n    }\n\n    // If the lowest version comparator has an operator and our version\n    // is less than it then it isn't higher than the range\n    if ((!low.operator || low.operator === comp) &&\n        ltefn(version, low.semver)) {\n      return false\n    } else if (low.operator === ecomp && ltfn(version, low.semver)) {\n      return false\n    }\n  }\n  return true\n}\n\nmodule.exports = outside\n", "'use strict'\n\n// Determine if version is greater than all the versions possible in the range.\nconst outside = require('./outside')\nconst gtr = (version, range, options) => outside(version, range, '>', options)\nmodule.exports = gtr\n", "'use strict'\n\nconst outside = require('./outside')\n// Determine if version is less than all the versions possible in the range\nconst ltr = (version, range, options) => outside(version, range, '<', options)\nmodule.exports = ltr\n", "'use strict'\n\nconst Range = require('../classes/range')\nconst intersects = (r1, r2, options) => {\n  r1 = new Range(r1, options)\n  r2 = new Range(r2, options)\n  return r1.intersects(r2, options)\n}\nmodule.exports = intersects\n", "'use strict'\n\n// given a set of versions and a range, create a \"simplified\" range\n// that includes the same versions that the original range does\n// If the original range is shorter than the simplified one, return that.\nconst satisfies = require('../functions/satisfies.js')\nconst compare = require('../functions/compare.js')\nmodule.exports = (versions, range, options) => {\n  const set = []\n  let first = null\n  let prev = null\n  const v = versions.sort((a, b) => compare(a, b, options))\n  for (const version of v) {\n    const included = satisfies(version, range, options)\n    if (included) {\n      prev = version\n      if (!first) {\n        first = version\n      }\n    } else {\n      if (prev) {\n        set.push([first, prev])\n      }\n      prev = null\n      first = null\n    }\n  }\n  if (first) {\n    set.push([first, null])\n  }\n\n  const ranges = []\n  for (const [min, max] of set) {\n    if (min === max) {\n      ranges.push(min)\n    } else if (!max && min === v[0]) {\n      ranges.push('*')\n    } else if (!max) {\n      ranges.push(`>=${min}`)\n    } else if (min === v[0]) {\n      ranges.push(`<=${max}`)\n    } else {\n      ranges.push(`${min} - ${max}`)\n    }\n  }\n  const simplified = ranges.join(' || ')\n  const original = typeof range.raw === 'string' ? range.raw : String(range)\n  return simplified.length < original.length ? simplified : range\n}\n", "'use strict'\n\nconst Range = require('../classes/range.js')\nconst Comparator = require('../classes/comparator.js')\nconst { ANY } = Comparator\nconst satisfies = require('../functions/satisfies.js')\nconst compare = require('../functions/compare.js')\n\n// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:\n// - Every simple range `r1, r2, ...` is a null set, OR\n// - Every simple range `r1, r2, ...` which is not a null set is a subset of\n//   some `R1, R2, ...`\n//\n// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:\n// - If c is only the ANY comparator\n//   - If C is only the ANY comparator, return true\n//   - Else if in prerelease mode, return false\n//   - else replace c with `[>=0.0.0]`\n// - If C is only the ANY comparator\n//   - if in prerelease mode, return true\n//   - else replace C with `[>=0.0.0]`\n// - Let EQ be the set of = comparators in c\n// - If EQ is more than one, return true (null set)\n// - Let GT be the highest > or >= comparator in c\n// - Let LT be the lowest < or <= comparator in c\n// - If GT and LT, and GT.semver > LT.semver, return true (null set)\n// - If any C is a = range, and GT or LT are set, return false\n// - If EQ\n//   - If GT, and EQ does not satisfy GT, return true (null set)\n//   - If LT, and EQ does not satisfy LT, return true (null set)\n//   - If EQ satisfies every C, return true\n//   - Else return false\n// - If GT\n//   - If GT.semver is lower than any > or >= comp in C, return false\n//   - If GT is >=, and GT.semver does not satisfy every C, return false\n//   - If GT.semver has a prerelease, and not in prerelease mode\n//     - If no C has a prerelease and the GT.semver tuple, return false\n// - If LT\n//   - If LT.semver is greater than any < or <= comp in C, return false\n//   - If LT is <=, and LT.semver does not satisfy every C, return false\n//   - If LT.semver has a prerelease, and not in prerelease mode\n//     - If no C has a prerelease and the LT.semver tuple, return false\n// - Else return true\n\nconst subset = (sub, dom, options = {}) => {\n  if (sub === dom) {\n    return true\n  }\n\n  sub = new Range(sub, options)\n  dom = new Range(dom, options)\n  let sawNonNull = false\n\n  OUTER: for (const simpleSub of sub.set) {\n    for (const simpleDom of dom.set) {\n      const isSub = simpleSubset(simpleSub, simpleDom, options)\n      sawNonNull = sawNonNull || isSub !== null\n      if (isSub) {\n        continue OUTER\n      }\n    }\n    // the null set is a subset of everything, but null simple ranges in\n    // a complex range should be ignored.  so if we saw a non-null range,\n    // then we know this isn't a subset, but if EVERY simple range was null,\n    // then it is a subset.\n    if (sawNonNull) {\n      return false\n    }\n  }\n  return true\n}\n\nconst minimumVersionWithPreRelease = [new Comparator('>=0.0.0-0')]\nconst minimumVersion = [new Comparator('>=0.0.0')]\n\nconst simpleSubset = (sub, dom, options) => {\n  if (sub === dom) {\n    return true\n  }\n\n  if (sub.length === 1 && sub[0].semver === ANY) {\n    if (dom.length === 1 && dom[0].semver === ANY) {\n      return true\n    } else if (options.includePrerelease) {\n      sub = minimumVersionWithPreRelease\n    } else {\n      sub = minimumVersion\n    }\n  }\n\n  if (dom.length === 1 && dom[0].semver === ANY) {\n    if (options.includePrerelease) {\n      return true\n    } else {\n      dom = minimumVersion\n    }\n  }\n\n  const eqSet = new Set()\n  let gt, lt\n  for (const c of sub) {\n    if (c.operator === '>' || c.operator === '>=') {\n      gt = higherGT(gt, c, options)\n    } else if (c.operator === '<' || c.operator === '<=') {\n      lt = lowerLT(lt, c, options)\n    } else {\n      eqSet.add(c.semver)\n    }\n  }\n\n  if (eqSet.size > 1) {\n    return null\n  }\n\n  let gtltComp\n  if (gt && lt) {\n    gtltComp = compare(gt.semver, lt.semver, options)\n    if (gtltComp > 0) {\n      return null\n    } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) {\n      return null\n    }\n  }\n\n  // will iterate one or zero times\n  for (const eq of eqSet) {\n    if (gt && !satisfies(eq, String(gt), options)) {\n      return null\n    }\n\n    if (lt && !satisfies(eq, String(lt), options)) {\n      return null\n    }\n\n    for (const c of dom) {\n      if (!satisfies(eq, String(c), options)) {\n        return false\n      }\n    }\n\n    return true\n  }\n\n  let higher, lower\n  let hasDomLT, hasDomGT\n  // if the subset has a prerelease, we need a comparator in the superset\n  // with the same tuple and a prerelease, or it's not a subset\n  let needDomLTPre = lt &&\n    !options.includePrerelease &&\n    lt.semver.prerelease.length ? lt.semver : false\n  let needDomGTPre = gt &&\n    !options.includePrerelease &&\n    gt.semver.prerelease.length ? gt.semver : false\n  // exception: <1.2.3-0 is the same as <1.2.3\n  if (needDomLTPre && needDomLTPre.prerelease.length === 1 &&\n      lt.operator === '<' && needDomLTPre.prerelease[0] === 0) {\n    needDomLTPre = false\n  }\n\n  for (const c of dom) {\n    hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>='\n    hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<='\n    if (gt) {\n      if (needDomGTPre) {\n        if (c.semver.prerelease && c.semver.prerelease.length &&\n            c.semver.major === needDomGTPre.major &&\n            c.semver.minor === needDomGTPre.minor &&\n            c.semver.patch === needDomGTPre.patch) {\n          needDomGTPre = false\n        }\n      }\n      if (c.operator === '>' || c.operator === '>=') {\n        higher = higherGT(gt, c, options)\n        if (higher === c && higher !== gt) {\n          return false\n        }\n      } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) {\n        return false\n      }\n    }\n    if (lt) {\n      if (needDomLTPre) {\n        if (c.semver.prerelease && c.semver.prerelease.length &&\n            c.semver.major === needDomLTPre.major &&\n            c.semver.minor === needDomLTPre.minor &&\n            c.semver.patch === needDomLTPre.patch) {\n          needDomLTPre = false\n        }\n      }\n      if (c.operator === '<' || c.operator === '<=') {\n        lower = lowerLT(lt, c, options)\n        if (lower === c && lower !== lt) {\n          return false\n        }\n      } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) {\n        return false\n      }\n    }\n    if (!c.operator && (lt || gt) && gtltComp !== 0) {\n      return false\n    }\n  }\n\n  // if there was a < or >, and nothing in the dom, then must be false\n  // UNLESS it was limited by another range in the other direction.\n  // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0\n  if (gt && hasDomLT && !lt && gtltComp !== 0) {\n    return false\n  }\n\n  if (lt && hasDomGT && !gt && gtltComp !== 0) {\n    return false\n  }\n\n  // we needed a prerelease range in a specific tuple, but didn't get one\n  // then this isn't a subset.  eg >=1.2.3-pre is not a subset of >=1.0.0,\n  // because it includes prereleases in the 1.2.3 tuple\n  if (needDomGTPre || needDomLTPre) {\n    return false\n  }\n\n  return true\n}\n\n// >=1.2.3 is lower than >1.2.3\nconst higherGT = (a, b, options) => {\n  if (!a) {\n    return b\n  }\n  const comp = compare(a.semver, b.semver, options)\n  return comp > 0 ? a\n    : comp < 0 ? b\n    : b.operator === '>' && a.operator === '>=' ? b\n    : a\n}\n\n// <=1.2.3 is higher than <1.2.3\nconst lowerLT = (a, b, options) => {\n  if (!a) {\n    return b\n  }\n  const comp = compare(a.semver, b.semver, options)\n  return comp < 0 ? a\n    : comp > 0 ? b\n    : b.operator === '<' && a.operator === '<=' ? b\n    : a\n}\n\nmodule.exports = subset\n", "'use strict'\n\n// just pre-load all the stuff that index.js lazily exports\nconst internalRe = require('./internal/re')\nconst constants = require('./internal/constants')\nconst SemVer = require('./classes/semver')\nconst identifiers = require('./internal/identifiers')\nconst parse = require('./functions/parse')\nconst valid = require('./functions/valid')\nconst clean = require('./functions/clean')\nconst inc = require('./functions/inc')\nconst diff = require('./functions/diff')\nconst major = require('./functions/major')\nconst minor = require('./functions/minor')\nconst patch = require('./functions/patch')\nconst prerelease = require('./functions/prerelease')\nconst compare = require('./functions/compare')\nconst rcompare = require('./functions/rcompare')\nconst compareLoose = require('./functions/compare-loose')\nconst compareBuild = require('./functions/compare-build')\nconst sort = require('./functions/sort')\nconst rsort = require('./functions/rsort')\nconst gt = require('./functions/gt')\nconst lt = require('./functions/lt')\nconst eq = require('./functions/eq')\nconst neq = require('./functions/neq')\nconst gte = require('./functions/gte')\nconst lte = require('./functions/lte')\nconst cmp = require('./functions/cmp')\nconst coerce = require('./functions/coerce')\nconst Comparator = require('./classes/comparator')\nconst Range = require('./classes/range')\nconst satisfies = require('./functions/satisfies')\nconst toComparators = require('./ranges/to-comparators')\nconst maxSatisfying = require('./ranges/max-satisfying')\nconst minSatisfying = require('./ranges/min-satisfying')\nconst minVersion = require('./ranges/min-version')\nconst validRange = require('./ranges/valid')\nconst outside = require('./ranges/outside')\nconst gtr = require('./ranges/gtr')\nconst ltr = require('./ranges/ltr')\nconst intersects = require('./ranges/intersects')\nconst simplifyRange = require('./ranges/simplify')\nconst subset = require('./ranges/subset')\nmodule.exports = {\n  parse,\n  valid,\n  clean,\n  inc,\n  diff,\n  major,\n  minor,\n  patch,\n  prerelease,\n  compare,\n  rcompare,\n  compareLoose,\n  compareBuild,\n  sort,\n  rsort,\n  gt,\n  lt,\n  eq,\n  neq,\n  gte,\n  lte,\n  cmp,\n  coerce,\n  Comparator,\n  Range,\n  satisfies,\n  toComparators,\n  maxSatisfying,\n  minSatisfying,\n  minVersion,\n  validRange,\n  outside,\n  gtr,\n  ltr,\n  intersects,\n  simplifyRange,\n  subset,\n  SemVer,\n  re: internalRe.re,\n  src: internalRe.src,\n  tokens: internalRe.t,\n  SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,\n  RELEASE_TYPES: constants.RELEASE_TYPES,\n  compareIdentifiers: identifiers.compareIdentifiers,\n  rcompareIdentifiers: identifiers.rcompareIdentifiers,\n}\n", "import type { ErrorDefinition } from \"./types.ts\"\n\nexport function createErrorDefinition({\n\tidentifier,\n\tfile,\n\terror,\n\tcustom,\n}: {\n\tidentifier: string\n\tfile: string\n\terror: string\n\tcustom?: Partial<ErrorDefinition>\n}) {\n\tconst cleanedFile = cleanFilename(file)\n\tconst definition: ErrorDefinition = {\n\t\tdepth: identifier.startsWith(\".\") ? 0 : 1, // Assume a depth of 1 when non-local.\n\t\terror,\n\t\tfile,\n\t\tidentifier,\n\t\tname: cleanedFile,\n\t\tpackageIdentifier: \"<unknown>\",\n\t\tproperties: {},\n\t\ttype: \"component\",\n\t\tupdate: 0,\n\t\t...custom,\n\t}\n\treturn definition\n}\n\nfunction cleanFilename(filename: string) {\n\tif (!filename.startsWith(\"./\")) return filename\n\treturn filename.slice(2)\n}\n", "import { assertNever, shouldBeNever } from \"@framerjs/shared\"\n\nexport const enum SupportedLayoutOption {\n\t/** Supports any of the available layout options. */\n\tAny = \"any\",\n\t/** Supports any of the available layout options, but defaults to fixed instead of auto. */\n\tAnyPreferFixed = \"any-prefer-fixed\",\n\t/** Auto-sizes the element based on its content. */\n\tAuto = \"auto\",\n\t/** Uses a specific size value provided by the user. */\n\tFixed = \"fixed\",\n\t/** Legacy behavior from before auto sizing. Never specified by user. */\n\tLegacy = \"__legacy\",\n}\n\nexport function isSupportedLayoutOption(option: unknown): option is SupportedLayoutOption {\n\t// We cast the option here even if it might not be correct so we can use\n\t// exhaustive checks. Switch statements use strict equality checks so the\n\t// cases below are still correct.\n\tconst typedOption = option as SupportedLayoutOption\n\tswitch (typedOption) {\n\t\tcase SupportedLayoutOption.Any:\n\t\tcase SupportedLayoutOption.AnyPreferFixed:\n\t\tcase SupportedLayoutOption.Auto:\n\t\tcase SupportedLayoutOption.Fixed:\n\t\t\treturn true\n\t\tcase SupportedLayoutOption.Legacy:\n\t\t\t// We will not accept user input for this value, so we return false.\n\t\t\treturn false\n\t\tdefault: {\n\t\t\t// If the next line errors, an option is missing above.\n\t\t\tshouldBeNever(typedOption)\n\t\t\treturn false\n\t\t}\n\t}\n}\n\nexport function getDefaultLayoutOption(contractVersion: number): SupportedLayoutOption {\n\t// As of contract version 1 we default to \"any\".\n\treturn contractVersion > 0 ? SupportedLayoutOption.Any : SupportedLayoutOption.Legacy\n}\n\n/**\n * Returns true if the option both supports auto sizing and should default to auto sizing.\n */\nexport function prefersAutoSizing(option: SupportedLayoutOption) {\n\tswitch (option) {\n\t\tcase SupportedLayoutOption.Any:\n\t\tcase SupportedLayoutOption.Auto:\n\t\t\treturn true\n\t\tcase SupportedLayoutOption.AnyPreferFixed:\n\t\tcase SupportedLayoutOption.Fixed:\n\t\tcase SupportedLayoutOption.Legacy:\n\t\t\treturn false\n\t\tdefault:\n\t\t\tassertNever(option)\n\t}\n}\n\nexport function supportsAutoSizing(option: SupportedLayoutOption) {\n\tswitch (option) {\n\t\tcase SupportedLayoutOption.Any:\n\t\tcase SupportedLayoutOption.AnyPreferFixed:\n\t\tcase SupportedLayoutOption.Auto:\n\t\t\treturn true\n\t\tcase SupportedLayoutOption.Fixed:\n\t\tcase SupportedLayoutOption.Legacy:\n\t\t\treturn false\n\t\tdefault:\n\t\t\tassertNever(option)\n\t}\n}\n\nexport function supportsFixedSizing(option: SupportedLayoutOption) {\n\tswitch (option) {\n\t\tcase SupportedLayoutOption.Any:\n\t\tcase SupportedLayoutOption.AnyPreferFixed:\n\t\tcase SupportedLayoutOption.Fixed:\n\t\tcase SupportedLayoutOption.Legacy:\n\t\t\treturn true\n\t\tcase SupportedLayoutOption.Auto:\n\t\t\treturn false\n\t\tdefault:\n\t\t\tassertNever(option)\n\t}\n}\n\nexport const enum AnnotationKey {\n\tFramerDisableUnlink = \"framerDisableUnlink\",\n\tFramerDisplayContentsDiv = \"framerDisplayContentsDiv\",\n\tFramerCanvasComponentVariantDetails = \"framerCanvasComponentVariantDetails\",\n\tFramerComponentPresetProps = \"framerComponentPresetProps\",\n\tFramerComponentViewportWidth = \"framerComponentViewportWidth\",\n\tFramerContractVersion = \"framerContractVersion\",\n\tFramerData = \"framerData\",\n\tFramerEnumToDisplayNameUtils = \"framerEnumToDisplayNameUtils\",\n\tFramerAutoSizeImages = \"framerAutoSizeImages\",\n\tFramerCollectionUtils = \"framerCollectionUtils\",\n\tFramerCollectionId = \"framerCollectionId\",\n\tFramerRecordIdKey = \"framerRecordIdKey\",\n\tFramerRecordIndexKey = \"framerRecordIndexKey\",\n\tFramerRecordIncludedLocalesKey = \"framerRecordIncludedLocalesKey\",\n\tFramerIntrinsicHeight = \"framerIntrinsicHeight\",\n\tFramerIntrinsicWidth = \"framerIntrinsicWidth\",\n\tFramerPreviewPlugin = \"framerPreviewPlugin\",\n\tFramerPrototype = \"framerPrototype\",\n\tFramerResponsiveScreen = \"framerResponsiveScreen\",\n\tFramerLayoutTemplate = \"framerLayoutTemplate\",\n\tFramerScreen = \"framerScreen\",\n\tFramerSlug = \"framerSlug\",\n\tFramerSupportedLayoutHeight = \"framerSupportedLayoutHeight\",\n\tFramerSupportedLayoutWidth = \"framerSupportedLayoutWidth\",\n\tFramerImmutableVariables = \"framerImmutableVariables\",\n\tFramerVariables = \"framerVariables\",\n\tFramerBreakpoints = \"framerBreakpoints\",\n\tFramerDefaultVariant = \"framerDefaultVariant\",\n\tFramerHitTargets = \"framerHitTargets\",\n\tFramerAcceptsLayoutTemplate = \"framerAcceptsLayoutTemplate\",\n\tFramerScrollSections = \"framerScrollSections\",\n\tFramerTrackingIds = \"framerTrackingIds\",\n\tFramerVector = \"framerVector\",\n\tFramerVectorSet = \"framerVectorSet\",\n\tFramerVectorSets = \"framerVectorSets\",\n\tFramerRootFontSize = \"framerRootFontSize\",\n\tFramerColorSyntax = \"framerColorSyntax\",\n\tFramerDesign = \"framerDesign\",\n\t/** If page is ready for auto applying flow effect from the applied layout template */\n\tFramerLayoutTemplateFlowEffect = \"framerLayoutTemplateFlowEffect\",\n\t/** @deprecated Was replaced with FramerVariables. */\n\tFramerVariablesDeprecated = \"framervariables\",\n}\n\nexport type Annotations = Partial<Record<AnnotationKey, string>>\n\n/**\n * ParsedAnnotations have converted values to types via JSON.parse.\n */\nexport type ParsedAnnotations = Partial<Record<AnnotationKey, unknown>>\n\n/**\n * Variable name of an entity exported from a module, e.g. \"Button\"\n */\nexport type ExportSpecifier = \"default\" | \"*\" | string\n\n/**\n * Annotations for a module by each export identifier. For example a module that\n * has a default export and exports a typescript interface as \"Props\" will have\n * annotations for keys \"default\" and \"Props\".\n */\nexport type ParsedModuleAnnotations = Record<ExportSpecifier, ParsedAnnotations | undefined>\n\n/**\n * A module can have multiple exports, each with its own annotations.\n */\nexport type ModuleAnnotations = Record<ExportSpecifier, Annotations | undefined>\n\nexport type ExportedIdentifierType =\n\t| \"reactComponent\"\n\t| \"class\"\n\t| \"function\"\n\t| \"variable\"\n\t| \"tsType\"\n\t| \"override\"\n\t| \"reactHoc\"\n\t| \"data\"\n\t| \"shader\"\n\nexport function contractVersion(annotations: Annotations): number {\n\tconst stringVersion = annotations[AnnotationKey.FramerContractVersion]\n\tif (!stringVersion) return 0\n\tconst version = parseInt(stringVersion, 10)\n\tif (!Number.isFinite(version) || version < 0) return 0\n\treturn version\n}\n\nexport function hasAnnotation(\n\tannotations: Annotations | ParsedModuleAnnotations[ExportSpecifier] | null | undefined,\n\tkey: AnnotationKey,\n): boolean {\n\t// If an annotation has no value (e.g., \"@framerPreviewPlugin\"), its value\n\t// in the annotations map will be an empty string, which is falsy in JS, so\n\t// it's important that we do the `!== undefined` check.\n\treturn annotations?.[key] !== undefined\n}\n\nexport type ItemToSlug = Readonly<Record<string, string>>\n", "export const localPackageFallbackIdentifier = \"|local|\" // Contains characters that do not exist in normal names\n", "import type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport type { ShaderMouseDefault } from \"library/modules/defineShader.ts\"\nimport type { BufferDescriptor } from \"library/render/presentation/Shader/WebGL2ShaderRenderer.ts\"\nimport type { ComponentFontBundle } from \"library/utils/addFonts.ts\"\nimport type { Annotations, ItemToSlug } from \"../../crossorigin/index.ts\"\nimport { AnnotationKey, hasAnnotation } from \"../../crossorigin/index.ts\"\nimport type {\n\tSerializedVerifiedActionControls,\n\tSerializedVerifiedPropertyControls,\n} from \"../../sandbox/componentLoader/types.ts\"\n\nexport type PackageIdentifier = string\nexport type EntityIdentifier = string\ntype TokenIdentifier = string\n\n/**\n * Also see ComponentType in src/library/src/render/componentLoader/definition.ts.\n */\nexport type EntityType =\n\t| \"component\"\n\t| \"master\"\n\t| \"override\"\n\t| \"action\"\n\t| \"hoc\"\n\t| \"screen\"\n\t| \"responsiveScreen\"\n\t| \"prototype\"\n\t| \"data\"\n\t| \"shader\"\n\nexport interface EntityDefinition {\n\t/** Package depth of this component. 0 if part of project, 1 if a direct dependency, greater otherwise. */\n\tdepth: number\n\tfile: string\n\tidentifier: EntityIdentifier\n\tname: string\n\t/** Identifier of the package that contains this component (one package can contain multiple components). */\n\tpackageIdentifier: PackageIdentifier\n\ttype: EntityType\n\tproperties: SerializedVerifiedPropertyControls | SerializedVerifiedActionControls\n\tfonts?: ComponentFontBundle[]\n\t/**\n\t * Map of Framer metadata annotations extracted from JSDoc, e.g:\n\t * ```js\n\t * { \"framerVersion\": \"42\", \"framerVariables\": \"{}\", \"framerPreviewPlugin\": \"\" }\n\t * ```\n\t * NOTE! It might only be present for the module-backed exports.\n\t */\n\tannotations?: Annotations | null\n\t/** `performance.now()` at the time of the last update, inherited from `ModuleEntryCommon.update`. */\n\tupdate: number\n}\n\nexport interface ReactComponentDefinition extends EntityDefinition {\n\ttype: \"component\"\n\tproperties: SerializedVerifiedPropertyControls\n\tdefaultProps: { [propName: string]: unknown } | undefined\n}\n\nexport interface ActionDefinition extends EntityDefinition {\n\ttype: \"action\"\n\tproperties: SerializedVerifiedActionControls\n}\n\nexport interface ShaderDefinition extends EntityDefinition {\n\ttype: \"shader\"\n\tproperties: SerializedVerifiedPropertyControls\n\ttitle?: string\n\tfragment: string\n\tvertex?: string\n\theightmapSource?: string\n\tmouse?: ShaderMouseDefault\n\tbuffers?: readonly BufferDescriptor[]\n}\n\nexport function isShaderDefinition(d: EntityDefinition): d is ShaderDefinition {\n\treturn d.type === \"shader\"\n}\n\nexport function isReactComponentDefinition(d: EntityDefinition): d is ReactComponentDefinition {\n\treturn d.type === \"component\"\n}\n\nexport function isActionDefinition(d: EntityDefinition): d is ActionDefinition {\n\treturn d.type === \"action\"\n}\n\nexport function isPreviewPluginDefinition(d: EntityDefinition): d is ReactComponentDefinition {\n\treturn isReactComponentDefinition(d) && hasAnnotation(d.annotations, AnnotationKey.FramerPreviewPlugin)\n}\n\ninterface OverrideDefinition extends EntityDefinition {\n\ttype: \"override\"\n}\n\nexport function isOverrideDefinition(definition: EntityDefinition): definition is OverrideDefinition {\n\treturn definition.type === \"override\"\n}\n\ninterface HocDefinition extends EntityDefinition {\n\ttype: \"hoc\"\n}\n\nexport function isHocDefinition(d: EntityDefinition): d is HocDefinition {\n\treturn d.type === \"hoc\"\n}\n\nexport interface DataDefinition extends EntityDefinition {\n\ttype: \"data\"\n\tidentifier: ModuleExportIdentifierString\n\tproperties: SerializedVerifiedPropertyControls\n\titemToSlug?: ItemToSlug\n}\n\nexport function isDataDefinition(definition: EntityDefinition | null | undefined): definition is DataDefinition {\n\treturn !!definition && definition.type === \"data\"\n}\n\nexport interface ErrorDefinition extends EntityDefinition {\n\terror: string\n\tfileDoesNotExist?: boolean\n}\n\nexport function isErrorDefinition(def: EntityDefinition | ErrorDefinition | null | undefined): def is ErrorDefinition {\n\treturn !!def && (def as ErrorDefinition).error !== undefined\n}\n\nexport type DesignJSON =\n\t// Legacy design JSON value containing the entire document.json object.\n\t// biome-ignore lint/suspicious/noExplicitAny: @TODO add explanation\n\t| { root: any; version: number }\n\t// Filtered design component primary nodes from the document.json object, reducing the size by a lot.\n\t// biome-ignore lint/suspicious/noExplicitAny: @TODO add explanation\n\t| { components: any[]; tokens: TokenMap; version: number }\n\nexport interface PackageInfo {\n\tdepth: number\n\tdisplayName: string\n\tname: string\n\t// biome-ignore lint/suspicious/noExplicitAny: @TODO add explanation\n\tcomponentsJson?: any\n\tdesignJson?: DesignJSON\n}\n\nexport interface EntityMap {\n\t[name: string]: EntityDefinition\n}\n\nexport interface HostPackageMap {\n\t[name: string]: PackageInfo\n}\n\nexport interface TokenDefinition {\n\t__class: string\n\tid: TokenIdentifier\n\tname: string\n\tvalue: string\n}\n\nexport interface TokenMap {\n\t[tokenId: string]: TokenDefinition\n}\n\n// Utility types\n\n/**\n * Overrides the specified field types of the provided type\n */\nexport type OverrideType<T, O extends object> = Omit<T, keyof O> & O\n", "import {\n\tassert,\n\tModuleType,\n\terrorIdentifierFromModuleIdentifier,\n\tgetLogger,\n\tisLocalModuleIdentifier,\n\tparseModuleIdentifier,\n} from \"@framerjs/shared\"\nimport type { SerializedVerifiedPropertyControls } from \"../../sandbox/componentLoader/types.ts\"\nimport { createErrorDefinition } from \"./createErrorDefinition.ts\"\nimport type {\n\tActionDefinition,\n\tDataDefinition,\n\tEntityDefinition,\n\tEntityIdentifier,\n\tErrorDefinition,\n\tReactComponentDefinition,\n\tShaderDefinition,\n} from \"./types.ts\"\nimport {\n\tisActionDefinition,\n\tisDataDefinition,\n\tisErrorDefinition,\n\tisReactComponentDefinition,\n\tisShaderDefinition,\n} from \"./types.ts\"\n\ntype TestEntityDefinition<T extends EntityDefinition> = Pick<T, \"identifier\" | \"type\"> &\n\tOmit<Partial<T>, \"identifier\" | \"type\">\n\ntype AnyTestEntityDefinition =\n\t| TestEntityDefinition<EntityDefinition>\n\t| TestEntityDefinition<DataDefinition>\n\t| TestEntityDefinition<ReactComponentDefinition>\n\nconst log = getLogger(\"componentloader\")\n\nexport class ComponentLoader {\n\treadonly environment = \"editor\"\n\tactiveBundleHash: string | undefined = undefined\n\tmodulesRevision = -1\n\n\tprivate entities = new Map<string, EntityDefinition>()\n\n\tconstructor(source?: ComponentLoader) {\n\t\tif (source) {\n\t\t\tthis.entities = new Map(source.entities)\n\t\t\tthis.activeBundleHash = source.activeBundleHash\n\t\t\tthis.modulesRevision = source.modulesRevision\n\t\t}\n\t}\n\n\t/** @deprecated */\n\tlocalPackageIdentifier(): string {\n\t\treturn \"|local|\"\n\t}\n\n\tgetAllEntities(): Iterable<EntityDefinition> {\n\t\treturn this.entities.values()\n\t}\n\n\t*getAllLocalModules(): Iterable<EntityDefinition> {\n\t\tfor (const entity of this.entities.values()) {\n\t\t\tif (entity.packageIdentifier !== \"|local|\") continue\n\t\t\tyield entity\n\t\t}\n\t}\n\n\tsetModuleRevision(modulesRevision: number, lazyRevision: number) {\n\t\tthis.activeBundleHash = `${modulesRevision}_${lazyRevision}`\n\t\tthis.modulesRevision = modulesRevision\n\t}\n\n\tupdateEntity(entityId: EntityIdentifier, definition: EntityDefinition): void {\n\t\tlog.trace(\"updateEntity:\", entityId, definition)\n\t\tassert(definition.properties, \"Entities must have properties\", definition)\n\t\tthis.entities.set(entityId, definition)\n\t}\n\n\tdeleteEntity(entityId: EntityIdentifier): void {\n\t\tlog.trace(\"deleteEntity:\", entityId)\n\t\tthis.entities.delete(entityId)\n\t}\n\n\tcomponentForIdentifier(identifier: EntityIdentifier): EntityDefinition | null {\n\t\treturn this.entities.get(identifier) ?? null\n\t}\n\n\treactComponentForIdentifier(identifier: EntityIdentifier): ReactComponentDefinition | null {\n\t\tconst definition = this.componentForIdentifier(identifier)\n\t\tif (!definition || !isReactComponentDefinition(definition)) return null\n\t\treturn definition\n\t}\n\n\tshaderForIdentifier(identifier: EntityIdentifier): ShaderDefinition | null {\n\t\tconst definition = this.componentForIdentifier(identifier)\n\t\tif (!definition || !isShaderDefinition(definition)) return null\n\t\treturn definition\n\t}\n\n\tgetPropertyControlsForIdentifier(identifier: EntityIdentifier): SerializedVerifiedPropertyControls | null {\n\t\tconst definition = this.componentForIdentifier(identifier)\n\t\treturn definition?.properties ?? null\n\t}\n\n\tactionForIdentifier(identifier: EntityIdentifier): ActionDefinition | null {\n\t\tconst definition = this.componentForIdentifier(identifier)\n\t\tif (!definition || !isActionDefinition(definition)) return null\n\t\treturn definition\n\t}\n\n\tdataForIdentifier(identifier: EntityIdentifier | null | undefined): DataDefinition | null {\n\t\tif (!identifier) return null\n\t\tconst definition = this.componentForIdentifier(identifier)\n\t\tif (!definition || !isDataDefinition(definition)) return null\n\t\treturn definition\n\t}\n\n\t/** Returns all cms data entities. */\n\tgetData(): DataDefinition[] {\n\t\tconst definitions: DataDefinition[] = []\n\t\tfor (const entity of this.entities.values()) {\n\t\t\tif (!isDataDefinition(entity)) continue\n\t\t\tdefinitions.push(entity)\n\t\t}\n\t\treturn definitions\n\t}\n\n\terrorForIdentifier(identifier: EntityIdentifier): ErrorDefinition | null {\n\t\tconst entity = this.entities.get(identifier)\n\t\tif (entity) {\n\t\t\tif (isErrorDefinition(entity)) return entity\n\t\t\treturn null\n\t\t}\n\n\t\tconst parsedId = parseModuleIdentifier(identifier)\n\t\tif (!parsedId) {\n\t\t\treturn createErrorDefinition({\n\t\t\t\tidentifier,\n\t\t\t\tfile: identifier,\n\t\t\t\terror: \"Components that are not modules do not exist.\",\n\t\t\t})\n\t\t}\n\n\t\tconst errorIdentifier = errorIdentifierFromModuleIdentifier(parsedId)\n\t\tconst isError = parsedId.value === errorIdentifier\n\n\t\tconst errorEntity = this.entities.get(errorIdentifier)\n\t\tif (isErrorDefinition(errorEntity)) return errorEntity\n\n\t\tif (isLocalModuleIdentifier(parsedId) || isError) {\n\t\t\t// The component doesn't exist, return that as error.\n\t\t\tlet error = \"Component does not exist.\"\n\t\t\tif (isLocalModuleIdentifier(parsedId) && parsedId.type === ModuleType.Code) {\n\t\t\t\terror = \"Component file does not exist.\"\n\t\t\t}\n\t\t\treturn createErrorDefinition({ identifier, file: parsedId.value, error })\n\t\t}\n\n\t\treturn null\n\t}\n\n\treadonly testing = {\n\t\tsetEntity: (definition: AnyTestEntityDefinition) => {\n\t\t\tthis.entities.set(definition.identifier, definition as EntityDefinition)\n\t\t\tthis.activeBundleHash = Math.random().toString(36).substring(2)\n\t\t},\n\t\tclearEntities: () => {\n\t\t\tthis.entities.clear()\n\t\t\tthis.activeBundleHash = undefined\n\t\t},\n\t}\n}\n", "/** @internal */\nexport function roundedNumber(value: number, decimals: number): number {\n\tconst d = Math.round(Math.abs(decimals))\n\tconst multiplier = 10 ** d\n\treturn Math.round(value * multiplier) / multiplier\n}\n\n/** @internal */\nexport function roundedNumberString(value: number, decimals: number): string {\n\tconst result = value.toFixed(decimals)\n\treturn decimals === 0 ? result : `${+result}` // this drops any 0 at the end;\n}\n\n/** @internal */\nexport function roundWithOffset(value: number, offset: number): number {\n\tif (offset === 0) {\n\t\treturn Math.round(value)\n\t}\n\toffset -= offset | 0 // Remove everything before the comma\n\tif (offset < 0) {\n\t\toffset = 1 - offset\n\t}\n\treturn Math.round(value - offset) + offset\n}\n\n/** @internal */\nexport function roundToHalfPixel(value: number): number {\n\treturn Math.round(value * 2) / 2\n}\n", "import { roundWithOffset } from \"../utils/roundedNumber.ts\"\n\n/**\n * @public\n */\ninterface Point {\n\tx: number\n\ty: number\n}\n\n/**\n * @public\n */\nfunction Point(x: number, y: number): Point {\n\treturn { x, y }\n}\n\n/**\n * @public\n */\nnamespace Point {\n\t/** @internal */\n\texport const isQuadrilateralPoints = (points: Point[] | undefined): points is [Point, Point, Point, Point] => {\n\t\treturn points?.length === 4\n\t}\n\n\t/** @internal */\n\texport const add = (...args: Point[]): Point => {\n\t\treturn args.reduce(\n\t\t\t(previousValue, currentValue) => {\n\t\t\t\treturn { x: previousValue.x + currentValue.x, y: previousValue.y + currentValue.y }\n\t\t\t},\n\t\t\t{ x: 0, y: 0 },\n\t\t)\n\t}\n\n\t/** @internal */\n\texport const subtract = (a: Point, b: Point): Point => {\n\t\treturn { x: a.x - b.x, y: a.y - b.y }\n\t}\n\n\t/** @internal */\n\texport const multiply = (a: Point, b: number): Point => {\n\t\treturn { x: a.x * b, y: a.y * b }\n\t}\n\n\t/** @internal */\n\texport const divide = (a: Point, b: number): Point => {\n\t\treturn { x: a.x / b, y: a.y / b }\n\t}\n\n\t/** @internal */\n\texport const absolute = (point: Point): Point => {\n\t\treturn {\n\t\t\tx: Math.abs(point.x),\n\t\t\ty: Math.abs(point.y),\n\t\t}\n\t}\n\n\t/** @internal */\n\texport const reverse = (point: Point): Point => {\n\t\treturn {\n\t\t\tx: point.x * -1,\n\t\t\ty: point.y * -1,\n\t\t}\n\t}\n\n\t/** @internal */\n\texport const pixelAligned = (point: Point, offset: Point = { x: 0, y: 0 }): Point => {\n\t\treturn {\n\t\t\tx: roundWithOffset(point.x, offset.x),\n\t\t\ty: roundWithOffset(point.y, offset.y),\n\t\t}\n\t}\n\n\t/** @internal */\n\texport const distance = (a: Point, b: Point): number => {\n\t\tconst deltaX = Math.abs(a.x - b.x)\n\t\tconst deltaY = Math.abs(a.y - b.y)\n\t\treturn Math.sqrt(deltaX * deltaX + deltaY * deltaY)\n\t}\n\n\t/** @internal */\n\texport const angle = (a: Point, b: Point): number => {\n\t\treturn (Math.atan2(b.y - a.y, b.x - a.x) * 180) / Math.PI - 90\n\t}\n\n\t/**\n\t * Returns the angle (0~180\u00B0) between the x axis and the line formed by the given points, going clock-wise.\n\t *\n\t *              -90\u00B0\n\t *              \u2502\n\t *              \u2502\n\t *              \u2502\n\t *  180\u00B0 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500 0\u00B0\n\t *              \u2502\n\t *              \u2502\n\t *              \u2502\n\t *             90\u00B0\n\t *\n\t *\n\t *\n\t * @internal */\n\texport const angleFromX = (a: Point, b: Point): number => {\n\t\treturn (Math.atan2(b.y - a.y, b.x - a.x) * 180) / Math.PI\n\t}\n\n\t/** @public */\n\texport const isEqual = (a: Point, b: Point): boolean => {\n\t\treturn a.x === b.x && a.y === b.y\n\t}\n\n\t/** @internal */\n\texport const rotationNormalizer = () => {\n\t\tlet lastValue: number\n\n\t\treturn (value: number) => {\n\t\t\tif (typeof lastValue !== \"number\") {\n\t\t\t\tlastValue = value\n\t\t\t}\n\n\t\t\tconst diff = lastValue - value\n\t\t\tconst maxDiff = Math.abs(diff) + 180\n\t\t\tconst nTimes = Math.floor(maxDiff / 360)\n\n\t\t\tif (diff < 180) {\n\t\t\t\tvalue -= nTimes * 360\n\t\t\t}\n\t\t\tif (diff > 180) {\n\t\t\t\tvalue += nTimes * 360\n\t\t\t}\n\n\t\t\tlastValue = value\n\t\t\treturn value\n\t\t}\n\t}\n\n\t/** @internal */\n\texport function center(a: Point, b: Point) {\n\t\treturn {\n\t\t\tx: (a.x + b.x) / 2,\n\t\t\ty: (a.y + b.y) / 2,\n\t\t}\n\t}\n\n\t/** @internal */\n\texport function centroid(points: Point[]): Point {\n\t\tlet sumX = 0\n\t\tlet sumY = 0\n\n\t\tpoints.forEach(point => {\n\t\t\tsumX += point.x\n\t\t\tsumY += point.y\n\t\t})\n\n\t\tconst centroidX = sumX / points.length\n\t\tconst centroidY = sumY / points.length\n\n\t\treturn { x: centroidX, y: centroidY }\n\t}\n\n\t/** @internal */\n\texport function sortClockwise(points: Point[]): Point[] {\n\t\tconst centerPoint = Point.centroid(points)\n\t\tconst angles = new Map<Point, number>()\n\t\t// tan2 is slow. By precomputing the angles we limit the number of calls\n\t\t// to atan2 to the number of points. In a 4 point polygon, in Chrome,\n\t\t// this is >50% faster than simply calling atan2 for each point in the\n\t\t// sort function and doing no additional iterations.\n\t\tfor (let i = 0; i < points.length; i++) {\n\t\t\tconst point = points[i]\n\t\t\tif (!point) continue\n\t\t\tangles.set(point, Math.atan2(point.y - centerPoint.y, point.x - centerPoint.x))\n\t\t}\n\n\t\treturn points.sort((a, b) => (angles.get(a) ?? 0) - (angles.get(b) ?? 0))\n\t}\n}\n\nexport { Point }\n", "import type { ServerSafeWindow } from \"../global.d.ts\"\nimport { isWindow } from \"./utils.ts\"\n\nconst mockWindow: ServerSafeWindow = {\n\taddEventListener: () => {},\n\tremoveEventListener: () => {},\n\tdispatchEvent: () => false,\n\tResizeObserver: undefined,\n\tonpointerdown: false,\n\tonpointermove: false,\n\tonpointerup: false,\n\tontouchstart: false,\n\tontouchmove: false,\n\tontouchend: false,\n\tonmousedown: false,\n\tonmousemove: false,\n\tonmouseup: false,\n\tdevicePixelRatio: 1,\n\tscrollX: 0,\n\tscrollY: 0,\n\tlocation: {\n\t\thash: \"\",\n\t\thostname: \"\",\n\t\thref: \"\",\n\t\torigin: \"\",\n\t\tpathname: \"\",\n\t\tsearch: \"\",\n\t},\n\tdocument: {\n\t\tbaseURI: \"\",\n\t\tcookie: \"\",\n\t\treferrer: null,\n\t},\n\tsetTimeout: () => 0,\n\tclearTimeout: () => {},\n\tsetInterval: () => 0,\n\tclearInterval: () => {},\n\trequestAnimationFrame: () => 0,\n\tcancelAnimationFrame: () => {},\n\trequestIdleCallback: () => 0,\n\tgetSelection: () => null,\n\tmatchMedia: (query: string) => {\n\t\treturn {\n\t\t\tmatches: false,\n\t\t\tmedia: query,\n\t\t\tonchange: () => {},\n\t\t\taddEventListener: () => {},\n\t\t\tremoveEventListener: () => {},\n\t\t\taddListener: () => {},\n\t\t\tremoveListener: () => {},\n\t\t\tdispatchEvent: () => false,\n\t\t}\n\t},\n\tinnerHeight: 0,\n\tinnerWidth: 0,\n\tSVGSVGElement: {} as typeof SVGSVGElement,\n\tscheduler: undefined,\n\topen: function (\n\t\t_url?: string | URL | undefined,\n\t\t_target?: string | undefined,\n\t\t_features?: string | undefined,\n\t): void {},\n\t__framer_events: [],\n}\n\n/**\n * Creates a server-safe reference to `window`, returning a mock if none is available.\n *\n * @internal\n */\n// eslint-disable-next-line no-undef\nexport const safeWindow = !isWindow ? mockWindow : window\n", "import { safeWindow } from \"../../utils/safeWindow.ts\"\n\nenum RenderTargetName {\n\tcanvas = \"CANVAS\",\n\texport = \"EXPORT\",\n\tthumbnail = \"THUMBNAIL\",\n\tpreview = \"PREVIEW\",\n}\n\n/**\n * @internal\n */\nexport interface RenderEnvironment {\n\ttarget: RenderTargetName\n\tzoom: number\n}\n\n/**\n * The screenshot lambda runs the project on this host to force an export target state.\n * RenderEnvironment can change at runtime, but this shouldn\u2019t.\n *\n * @internal\n */\nexport function isScreenshotFramerHost() {\n\treturn safeWindow.location.origin === \"https://screenshot.framer.invalid\"\n}\n\n/**\n * @internal\n */\nexport const RenderEnvironment: RenderEnvironment = {\n\ttarget:\n\t\t// Enable the static renderer for screenshot lambdas.\n\t\tisScreenshotFramerHost() ? RenderTargetName.export : RenderTargetName.preview,\n\tzoom: 1,\n}\n\n/**\n * This is used to temporarily execute a task in a different render environment (for example during export)\n * @internal\n */\nexport function executeInRenderEnvironment<T>(customEnvironment: Partial<RenderEnvironment>, task: () => T): T {\n\t// Copy currentEnvironment\n\tconst previousEnvironment = Object.assign({}, RenderEnvironment)\n\t// Set the customEnvironment to the current environment\n\tObject.assign(RenderEnvironment, customEnvironment)\n\tconst result = task()\n\t// Reset the previous environment back on the currentEnvironment\n\tObject.assign(RenderEnvironment, previousEnvironment)\n\treturn result\n}\n\n/**\n * This function sets the global render environment Framer Core uses to render.\n * Because it sets global state, there should be only one thing responsable for calling it in every react app (e.g. Vekter and Preview)\n * @internal\n */\nexport function setGlobalRenderEnvironment(environment: Partial<RenderEnvironment>) {\n\tObject.assign(RenderEnvironment, environment)\n}\n\n/**\n * @internal\n */\nexport function useRenderEnvironment(target: RenderTargetName, zoom: number) {\n\tlet willChangeElements = false\n\n\tif (RenderEnvironment.target !== target) {\n\t\tRenderEnvironment.target = target\n\t\twillChangeElements = true\n\t}\n\n\tif (RenderEnvironment.zoom !== zoom) {\n\t\tRenderEnvironment.zoom = zoom\n\t}\n\n\treturn { willChangeElements }\n}\n\n/**\n * The `RenderTarget` represents the current environment in which a component\n * is running. This is most commonly either the editor canvas in Framer or in\n * the generated preview window.\n *\n * @remarks\n * Code components can use the `RenderTarget.current()` method to check for\n * the environment within their components and vary rendering accordingly. The\n * most common case would be to improve performance while rendering in the\n * Framer canvas where components that take too long to render will be replaced\n * with a placeholder. The `RenderTarget.hasRestrictions()` method can be used\n * to check explicitly for this case.\n *\n * @privateRemarks\n * This is a read-only equivalent of RenderEnvironment.target that is exposed\n * to components for context-dependent rendering\n *\n * @public\n */\nexport type RenderTarget = RenderTargetName\n// \u2191 For backwards compatibility, re-export the RenderTargetName enum under the name RenderTarget. This allows the code like\n//   const renderTarget: RenderTarget\n// work as it worked when RenderTarget was defined as an enum AND a namespace, merged together.\n// Confused how two definitions with the same name work? See https://stackoverflow.com/a/67697999\n\nexport const RenderTarget = {\n\t/**\n\t * The component is to be rendered for the Framer canvas.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   if (RenderTarget.current() === RenderTarget.canvas) {\n\t *     return <CanvasComponent />\n\t *   }\n\t *   return <DefaultComponent />\n\t * }\n\t * ```\n\t */\n\tcanvas: RenderTargetName.canvas,\n\t/**\n\t * The component is to be rendered for export.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   if (RenderTarget.current() === RenderTarget.export) {\n\t *     return <ExportComponent />\n\t *   }\n\t *   return <DefaultComponent />\n\t * }\n\t * ```\n\t */\n\texport: RenderTargetName.export,\n\t/**\n\t * The component is to be rendered as a preview thumbnail, for example in the\n\t * component panel.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   if (RenderTarget.current() === RenderTarget.thumbnail) {\n\t *     return <Thumbnail />\n\t *   }\n\t *   return <DefaultComponent />\n\t * }\n\t * ```\n\t */\n\tthumbnail: RenderTargetName.thumbnail,\n\t/**\n\t * The component is being rendered in the preview window.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   React.useEffect(() => {\n\t *     if (RenderTarget.current() === RenderTarget.preview) {\n\t *       // Do something in preview.\n\t *     }\n\t *   })\n\t *   return <DefaultComponent />\n\t * }\n\t * ```\n\t */\n\tpreview: RenderTargetName.preview,\n\n\t/**\n\t * Returns the current `RenderTarget` allowing components to apply\n\t * different behaviors depending on the environment.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   if (RenderTarget.current() === RenderTarget.thumbnail) {\n\t *     return <PreviewIcon />\n\t *   }\n\t *   return <Frame>...</Frame>\n\t * }\n\t * ```\n\t */\n\tcurrent: (): RenderTargetName => RenderEnvironment.target,\n\n\t/**\n\t * Returns true if the current `RenderTarget` has performance restrictions.\n\t * Use this to avoid doing heavy work in these contexts because they may\n\t * bail on the rendering if the component takes too long.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   if (RenderTarget.hasRestrictions()) {\n\t *     return <SomePlaceholder />\n\t *   }\n\t *   return <RichPreviewContent />\n\t * }\n\t * ```\n\t */\n\thasRestrictions: (): boolean => {\n\t\tconst target = RenderEnvironment.target\n\t\tif (target === RenderTargetName.canvas) return true\n\t\tif (target === RenderTargetName.export) return true\n\t\treturn false\n\t},\n}\n", "/** @internal */\nexport function degreesToRadians(degrees: number): number {\n\treturn degrees * (Math.PI / 180)\n}\n", "import { degreesToRadians } from \"../utils/degreesToRadians.ts\"\nimport { Point } from \"./Point.ts\"\n\n/**\n * @internal\n */\nexport interface Line {\n\ta: Point\n\tb: Point\n}\n\n/**\n * @internal\n */\nexport const Line = /* @__PURE__ */ (() => {\n\t/**\n\t * @internal\n\t */\n\tfunction Line(a: Point, b: Point): Line {\n\t\treturn { a, b }\n\t}\n\n\tLine.offset = (line: Line, offset: number) => {\n\t\tconst angle = Point.angleFromX(line.a, line.b)\n\t\tconst rad = degreesToRadians(angle)\n\t\tconst x = offset * Math.sin(rad)\n\t\tconst y = offset * Math.cos(rad)\n\t\treturn Line(\n\t\t\t{ x: line.a.x + x, y: line.a.y - y },\n\t\t\t{\n\t\t\t\tx: line.b.x + x,\n\t\t\t\ty: line.b.y - y,\n\t\t\t},\n\t\t)\n\t}\n\n\tLine.intersection = (lineA: Line, lineB: Line, segments?: boolean): Point | null => {\n\t\tconst x1 = lineA.a.x\n\t\tconst y1 = lineA.a.y\n\t\tconst x2 = lineA.b.x\n\t\tconst y2 = lineA.b.y\n\t\tconst x3 = lineB.a.x\n\t\tconst y3 = lineB.a.y\n\t\tconst x4 = lineB.b.x\n\t\tconst y4 = lineB.b.y\n\n\t\tconst a1 = (x4 - x3) * (y3 - y1) - (y4 - y3) * (x3 - x1)\n\t\tconst b1 = (x4 - x3) * (y2 - y1) - (y4 - y3) * (x2 - x1)\n\t\tconst c1 = (x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1)\n\n\t\t// Line segments are colinear\n\t\tif (a1 === 0 && b1 === 0) return null\n\t\t// Lines are parallel and non-intersecting.\n\t\tif (b1 === 0) return null\n\n\t\tconst alpha = a1 / b1\n\t\tconst beta = c1 / b1\n\n\t\t// If we are testing line segments (lines that are not extended\n\t\t// infinitely), return null if the line segments are not parallel but don't intersect.\n\t\tif (segments && (alpha < 0 || alpha > 1 || beta < 0 || beta > 1)) return null\n\n\t\treturn {\n\t\t\tx: x1 + alpha * (x2 - x1),\n\t\t\ty: y1 + alpha * (y2 - y1),\n\t\t}\n\t}\n\n\tLine.intersectionAngle = (lineA: Line, lineB: Line): number => {\n\t\tconst deltaAX = lineA.b.x - lineA.a.x\n\t\tconst deltaAY = lineA.b.y - lineA.a.y\n\t\tconst deltaBX = lineB.b.x - lineB.a.x\n\t\tconst deltaBY = lineB.b.y - lineB.a.y\n\t\tconst angle = Math.atan2(deltaAX * deltaBY - deltaAY * deltaBX, deltaAX * deltaBX + deltaAY * deltaBY)\n\t\treturn angle * (180 / Math.PI)\n\t}\n\n\tLine.isOrthogonal = (line: Line) => {\n\t\treturn line.a.x === line.b.x || line.a.y === line.b.y\n\t}\n\n\tLine.perpendicular = (line: Line, pointOnLine: Point) => {\n\t\tconst deltaX = line.a.x - line.b.x\n\t\tconst deltaY = line.a.y - line.b.y\n\t\tconst pointB = Point(pointOnLine.x - deltaY, pointOnLine.y + deltaX)\n\t\treturn Line(pointB, pointOnLine)\n\t}\n\n\tLine.projectPoint = (line: Line, point: Point) => {\n\t\tconst perp = Line.perpendicular(line, point)\n\t\treturn Line.intersection(line, perp)\n\t}\n\n\tLine.pointAtPercentDistance = (line: Line, distance: number): Point => {\n\t\tconst hypotenuse = Line.distance(line)\n\t\tconst r = (distance * hypotenuse) / hypotenuse\n\n\t\treturn {\n\t\t\tx: r * line.b.x + (1 - r) * line.a.x,\n\t\t\ty: r * line.b.y + (1 - r) * line.a.y,\n\t\t}\n\t}\n\n\tLine.distance = (line: Line): number => {\n\t\treturn Point.distance(line.a, line.b)\n\t}\n\n\treturn Line\n})()\n", "import { assert, assertNever } from \"../../utils/assert.ts\"\nimport { roundedNumber } from \"../utils/roundedNumber.ts\"\nimport { Line } from \"./Line.ts\"\nimport { Point } from \"./Point.ts\"\nimport type { Size } from \"./Size.ts\"\n\n/**\n * @public\n */\nexport interface Rect extends Point, Size {}\n\n/**\n * @public\n */\nexport const Rect = {\n\t/**\n\t *\n\t * @param rect -\n\t * @param other -\n\t * @returns if the input rectangles are equal in size and position\n\t * @public\n\t */\n\tequals: function (rect: Rect | null, other: Rect | null): boolean {\n\t\tif (rect === other) return true\n\t\tif (!rect || !other) return false\n\t\treturn rect.x === other.x && rect.y === other.y && rect.width === other.width && rect.height === other.height\n\t},\n\n\t/** @internal */\n\tfrom: (rect: Rect): Rect => {\n\t\treturn {\n\t\t\tx: rect.x,\n\t\t\ty: rect.y,\n\t\t\twidth: rect.width,\n\t\t\theight: rect.height,\n\t\t}\n\t},\n\n\t/** @internal */\n\tatOrigin: (size: Size): Rect => {\n\t\treturn {\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\twidth: size.width,\n\t\t\theight: size.height,\n\t\t}\n\t},\n\n\t/** @internal */\n\tfromTwoPoints: (a: Point, b: Point): Rect => {\n\t\treturn {\n\t\t\tx: Math.min(a.x, b.x),\n\t\t\ty: Math.min(a.y, b.y),\n\t\t\twidth: Math.abs(a.x - b.x),\n\t\t\theight: Math.abs(a.y - b.y),\n\t\t}\n\t},\n\n\t/** @internal */\n\tfromRect: (rect: ClientRect): Rect => {\n\t\treturn {\n\t\t\tx: rect.left,\n\t\t\ty: rect.top,\n\t\t\twidth: rect.right - rect.left,\n\t\t\theight: rect.bottom - rect.top,\n\t\t}\n\t},\n\n\t/** @internal */\n\tmultiply: (rect: Rect, n: number): Rect => {\n\t\treturn {\n\t\t\tx: rect.x * n,\n\t\t\ty: rect.y * n,\n\t\t\twidth: rect.width * n,\n\t\t\theight: rect.height * n,\n\t\t}\n\t},\n\n\t/** @internal */\n\tdivide: (rect: Rect, n: number): Rect => {\n\t\treturn Rect.multiply(rect, 1 / n)\n\t},\n\n\t/** @internal */\n\toffset: (rect: Rect, delta: Partial<Point>): Rect => {\n\t\tconst xOffset = typeof delta.x === \"number\" ? delta.x : 0\n\t\tconst yOffset = typeof delta.y === \"number\" ? delta.y : 0\n\t\treturn {\n\t\t\t...rect,\n\t\t\tx: rect.x + xOffset,\n\t\t\ty: rect.y + yOffset,\n\t\t}\n\t},\n\n\t/** @internal */\n\tinflate: (rect: Rect, value: number) => {\n\t\tif (value === 0) return rect\n\t\tconst doubleValue = 2 * value\n\t\treturn {\n\t\t\tx: rect.x - value,\n\t\t\ty: rect.y - value,\n\t\t\twidth: rect.width + doubleValue,\n\t\t\theight: rect.height + doubleValue,\n\t\t}\n\t},\n\n\t/** @internal */\n\tpixelAligned: (rect: Rect): Rect => {\n\t\tconst x = Math.round(rect.x)\n\t\tconst y = Math.round(rect.y)\n\t\tconst rectMaxX = Math.round(rect.x + rect.width)\n\t\tconst rectMaxY = Math.round(rect.y + rect.height)\n\t\tconst width = Math.max(rectMaxX - x, 0)\n\t\tconst height = Math.max(rectMaxY - y, 0)\n\t\treturn { x, y, width, height }\n\t},\n\n\t/** @internal */\n\thalfPixelAligned: (rect: Rect): Rect => {\n\t\tconst x = Math.round(rect.x * 2) / 2\n\t\tconst y = Math.round(rect.y * 2) / 2\n\t\tconst rectMaxX = Math.round((rect.x + rect.width) * 2) / 2\n\t\tconst rectMaxY = Math.round((rect.y + rect.height) * 2) / 2\n\t\tconst width = Math.max(rectMaxX - x, 1)\n\t\tconst height = Math.max(rectMaxY - y, 1)\n\t\treturn { x, y, width, height }\n\t},\n\n\t/** @internal */\n\tround: (rect: Rect, decimals = 0): Rect => {\n\t\tconst x = roundedNumber(rect.x, decimals)\n\t\tconst y = roundedNumber(rect.y, decimals)\n\t\tconst width = roundedNumber(rect.width, decimals)\n\t\tconst height = roundedNumber(rect.height, decimals)\n\t\treturn { x, y, width, height }\n\t},\n\n\t/** @internal */\n\troundToOutside: (rect: Rect): Rect => {\n\t\tconst x = Math.floor(rect.x)\n\t\tconst y = Math.floor(rect.y)\n\t\tconst rectMaxX = Math.ceil(rect.x + rect.width)\n\t\tconst rectMaxY = Math.ceil(rect.y + rect.height)\n\t\tconst width = Math.max(rectMaxX - x, 0)\n\t\tconst height = Math.max(rectMaxY - y, 0)\n\t\treturn { x, y, width, height }\n\t},\n\n\t/**\n\t * @param rect -\n\t * @internal\n\t */\n\tminX: (rect: Rect) => {\n\t\treturn rect.x\n\t},\n\n\t/**\n\t * @param rect -\n\t * @internal\n\t */\n\tmaxX: (rect: Rect) => {\n\t\treturn rect.x + rect.width\n\t},\n\n\t/**\n\t * @param rect -\n\t * @internal\n\t */\n\tminY: (rect: Rect) => {\n\t\treturn rect.y\n\t},\n\n\t/**\n\t * @param rect -\n\t * @internal\n\t */\n\tmaxY: (rect: Rect) => {\n\t\treturn rect.y + rect.height\n\t},\n\n\t/** @internal */\n\tpositions: (rect: Rect) => {\n\t\treturn {\n\t\t\tminX: rect.x,\n\t\t\tmidX: rect.x + rect.width / 2,\n\t\t\tmaxX: Rect.maxX(rect),\n\t\t\tminY: rect.y,\n\t\t\tmidY: rect.y + rect.height / 2,\n\t\t\tmaxY: Rect.maxY(rect),\n\t\t}\n\t},\n\n\t/**\n\t *\n\t * @param rect -\n\t * @internal\n\t */\n\tcenter: (rect: Rect) => {\n\t\treturn {\n\t\t\tx: rect.x + rect.width / 2,\n\t\t\ty: rect.y + rect.height / 2,\n\t\t}\n\t},\n\n\t/** @internal */\n\tboundingRectFromPoints: (points: Point[]) => {\n\t\tlet minX = Infinity\n\t\tlet maxX = -Infinity\n\t\tlet minY = Infinity\n\t\tlet maxY = -Infinity\n\n\t\tfor (let i = 0; i < points.length; i++) {\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: Performance.\n\t\t\tconst point = points[i]!\n\n\t\t\tminX = Math.min(minX, point.x)\n\t\t\tmaxX = Math.max(maxX, point.x)\n\n\t\t\tminY = Math.min(minY, point.y)\n\t\t\tmaxY = Math.max(maxY, point.y)\n\t\t}\n\n\t\treturn { x: minX, y: minY, width: maxX - minX, height: maxY - minY }\n\t},\n\n\t/**\n\t * Returns the precise box defined by the given points, starting from the top-left point. This produces the same\n\t * Rect as Rect.boundingRectFromPoints *only* when the rect described by the points is not rotated.\n\t *\n\t * @internal\n\t */\n\tfromPoints: (ps: [Point, Point, Point, Point]) => {\n\t\tconst [tl, tr, _, bl] = ps\n\t\tconst { x, y } = tl\n\t\tconst width = Point.distance(tl, tr)\n\t\tconst height = Point.distance(tl, bl)\n\t\treturn { x, y, width, height }\n\t},\n\n\t/**\n\t * Returns a rect containing all input rects\n\t * @param rect - a list of rectangles\n\t * @returns A rectangle that fits exactly around the input rects\n\t * @internal\n\t */\n\tmerge: (...rect: Rect[]): Rect => {\n\t\tconst min = {\n\t\t\tx: Math.min(...rect.map(Rect.minX)),\n\t\t\ty: Math.min(...rect.map(Rect.minY)),\n\t\t}\n\n\t\tconst max = {\n\t\t\tx: Math.max(...rect.map(Rect.maxX)),\n\t\t\ty: Math.max(...rect.map(Rect.maxY)),\n\t\t}\n\n\t\treturn Rect.fromTwoPoints(min, max)\n\t},\n\n\t/** @internal */\n\tintersection: (rect1: Rect, rect2: Rect): Rect => {\n\t\tconst x = Math.max(rect1.x, rect2.x)\n\t\tconst x2 = Math.min(rect1.x + rect1.width, rect2.x + rect2.width)\n\t\tconst y = Math.max(rect1.y, rect2.y)\n\t\tconst y2 = Math.min(rect1.y + rect1.height, rect2.y + rect2.height)\n\t\treturn { x, y, width: x2 - x, height: y2 - y }\n\t},\n\n\t/**\n\t * Returns all the corner points for a rect\n\t * @param rect -\n\t * @internal\n\t */\n\tpoints: (rect: Rect): [Point, Point, Point, Point] => {\n\t\treturn [\n\t\t\t{ x: Rect.minX(rect), y: Rect.minY(rect) },\n\t\t\t{ x: Rect.minX(rect), y: Rect.maxY(rect) },\n\t\t\t{ x: Rect.maxX(rect), y: Rect.minY(rect) },\n\t\t\t{ x: Rect.maxX(rect), y: Rect.maxY(rect) },\n\t\t]\n\t},\n\n\t/**\n\t * Returns all the corner points for a rect at the origin.\n\t * @internal\n\t */\n\tpointsAtOrigin: (rect: Pick<Rect, \"height\" | \"width\">): [Point, Point, Point, Point] => {\n\t\treturn [\n\t\t\t{ x: 0, y: 0 },\n\t\t\t{ x: rect.width, y: 0 },\n\t\t\t{ x: rect.width, y: rect.height },\n\t\t\t{ x: 0, y: rect.height },\n\t\t]\n\t},\n\n\t/** Takes a rect and transforms it by a matrix, resulting in the bounding rectangle of the\n\t * rotated and/or translated original.\n\t * @param rect - rectangle to transform\n\t * @param matrix - matrix to transform by\n\t * @returns The bounding rectangle of the rotated and/or translated rect.\n\t */\n\ttransform: (rect: Rect, matrix: DOMMatrixReadOnly): Rect => {\n\t\tconst { x: x1, y: y1 } = matrix.transformPoint({ x: rect.x, y: rect.y })\n\t\tconst { x: x2, y: y2 } = matrix.transformPoint({ x: rect.x + rect.width, y: rect.y })\n\t\tconst { x: x3, y: y3 } = matrix.transformPoint({ x: rect.x + rect.width, y: rect.y + rect.height })\n\t\tconst { x: x4, y: y4 } = matrix.transformPoint({ x: rect.x, y: rect.y + rect.height })\n\t\tconst x = Math.min(x1, x2, x3, x4)\n\t\tconst width = Math.max(x1, x2, x3, x4) - x\n\t\tconst y = Math.min(y1, y2, y3, y4)\n\t\tconst height = Math.max(y1, y2, y3, y4) - y\n\t\treturn { x, y, width, height }\n\t},\n\n\t/**\n\t * Checks if a rectangle contains a point\n\t * @param rect - The rectangle to check\n\t * @param point - The point to check\n\t * @returns true if the provided rectangle contains the provided point\n\t * @internal\n\t */\n\tcontainsPoint: (rect: Rect, point: Point) => {\n\t\tif (point.x < Rect.minX(rect)) {\n\t\t\treturn false\n\t\t}\n\t\tif (point.x > Rect.maxX(rect)) {\n\t\t\treturn false\n\t\t}\n\t\tif (point.y < Rect.minY(rect)) {\n\t\t\treturn false\n\t\t}\n\t\tif (point.y > Rect.maxY(rect)) {\n\t\t\treturn false\n\t\t}\n\t\tif (Number.isNaN(rect.x)) {\n\t\t\treturn false\n\t\t}\n\t\tif (Number.isNaN(rect.y)) {\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t},\n\n\t/**\n\t * Returns wether a rect contains another rect entirely\n\t * @param rectA -\n\t * @param rectB -\n\t * @returns true if rectA contains rectB\n\t */\n\tcontainsRect: (rectA: Rect, rectB: Rect) => {\n\t\tfor (const point of Rect.points(rectB)) {\n\t\t\tif (!Rect.containsPoint(rectA, point)) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\n\t\treturn true\n\t},\n\n\t/** @internal */\n\ttoCSS: (rect: Rect) => {\n\t\treturn {\n\t\t\tdisplay: \"block\",\n\t\t\ttransform: `translate(${rect.x}px, ${rect.y}px)`,\n\t\t\twidth: `${rect.width}px`,\n\t\t\theight: `${rect.height}px`,\n\t\t}\n\t},\n\n\t/** @internal */\n\tinset: (rect: Rect, n: number) => {\n\t\treturn {\n\t\t\tx: rect.x + n,\n\t\t\ty: rect.y + n,\n\t\t\twidth: Math.max(0, rect.width - 2 * n),\n\t\t\theight: Math.max(0, rect.height - 2 * n),\n\t\t}\n\t},\n\n\t/** @internal */\n\tintersects: (rectA: Rect, rectB: Rect): boolean => {\n\t\treturn !(\n\t\t\trectB.x >= Rect.maxX(rectA) ||\n\t\t\tRect.maxX(rectB) <= rectA.x ||\n\t\t\trectB.y >= Rect.maxY(rectA) ||\n\t\t\tRect.maxY(rectB) <= rectA.y\n\t\t)\n\t},\n\n\t/** @internal */\n\toverlapHorizontally: (rectA: Rect, rectB: Rect): boolean => {\n\t\tconst aMax = Rect.maxX(rectA)\n\t\tconst bMax = Rect.maxX(rectB)\n\t\treturn aMax > rectB.x && bMax > rectA.x\n\t},\n\n\t/** @internal */\n\toverlapVertically: (rectA: Rect, rectB: Rect): boolean => {\n\t\tconst aMax = Rect.maxY(rectA)\n\t\tconst bMax = Rect.maxY(rectB)\n\t\treturn aMax > rectB.y && bMax > rectA.y\n\t},\n\n\t/** @internal */\n\tdoesNotIntersect: (rect: Rect, rects: Rect[]): boolean => {\n\t\treturn (\n\t\t\trects.find(comparingRect => {\n\t\t\t\treturn Rect.intersects(comparingRect, rect)\n\t\t\t}) === undefined\n\t\t)\n\t},\n\n\t/**\n\t *\n\t * @param rectA -\n\t * @param rectB -\n\t * @returns if the input rectangles are equal in size and position\n\t * @public\n\t * @deprecated: please use Rect.equals instead\n\t */\n\tisEqual: (rectA: Rect | null, rectB: Rect | null) => {\n\t\treturn Rect.equals(rectA, rectB)\n\t},\n\n\t// @TODO: duplicate of points()\n\t/**\n\t * @returns [tl, tr, br, bl]\n\t * @internal\n\t */\n\tcornerPoints: (rect: Rect): [Point, Point, Point, Point] => {\n\t\tconst rectMinX = rect.x\n\t\tconst rectMaxX = rect.x + rect.width\n\t\tconst rectMinY = rect.y\n\t\tconst rectMaxY = rect.y + rect.height\n\t\tconst corner1 = { x: rectMinX, y: rectMinY }\n\t\tconst corner2 = { x: rectMaxX, y: rectMinY }\n\t\tconst corner3 = { x: rectMaxX, y: rectMaxY }\n\t\tconst corner4 = { x: rectMinX, y: rectMaxY }\n\t\treturn [corner1, corner2, corner3, corner4]\n\t},\n\n\t/** @internal */\n\tmidPoints: (rect: Rect): [Point, Point, Point, Point] => {\n\t\tconst rectMinX = rect.x\n\t\tconst rectMidX = rect.x + rect.width / 2\n\t\tconst rectMaxX = rect.x + rect.width\n\t\tconst rectMinY = rect.y\n\t\tconst rectMidY = rect.y + rect.height / 2\n\t\tconst rectMaxY = rect.y + rect.height\n\t\tconst top = { x: rectMidX, y: rectMinY }\n\t\tconst right = { x: rectMaxX, y: rectMidY }\n\t\tconst bottom = { x: rectMidX, y: rectMaxY }\n\t\tconst left = { x: rectMinX, y: rectMidY }\n\t\treturn [top, right, bottom, left]\n\t},\n\n\t/** @internal */\n\tpointDistance: (rect: Rect, point: Point) => {\n\t\tlet x = 0\n\t\tlet y = 0\n\t\tif (point.x < rect.x) {\n\t\t\tx = rect.x - point.x\n\t\t} else if (point.x > Rect.maxX(rect)) {\n\t\t\tx = point.x - Rect.maxX(rect)\n\t\t}\n\t\tif (point.y < rect.y) {\n\t\t\ty = rect.y - point.y\n\t\t} else if (point.y > Rect.maxY(rect)) {\n\t\t\ty = point.y - Rect.maxY(rect)\n\t\t}\n\t\treturn Point.distance({ x, y }, { x: 0, y: 0 })\n\t},\n\n\tdelta: (a: Rect, b: Rect): Point => {\n\t\tconst pointA = { x: Rect.minX(a), y: Rect.minY(a) }\n\t\tconst pointB = { x: Rect.minX(b), y: Rect.minY(b) }\n\t\treturn {\n\t\t\tx: pointA.x - pointB.x,\n\t\t\ty: pointA.y - pointB.y,\n\t\t}\n\t},\n\n\t/** @internal */\n\twithMinSize: (rect: Rect, minSize: Size): Rect => {\n\t\tconst { width: minWidth, height: minHeight } = minSize\n\t\tconst diffX = rect.width - minWidth\n\t\tconst diffY = rect.height - minHeight\n\t\treturn {\n\t\t\twidth: Math.max(rect.width, minWidth),\n\t\t\theight: Math.max(rect.height, minHeight),\n\t\t\tx: rect.width < minWidth ? rect.x + diffX / 2 : rect.x,\n\t\t\ty: rect.height < minHeight ? rect.y + diffY / 2 : rect.y,\n\t\t}\n\t},\n\n\t/**\n\t * Return false if any point is not inside or on the provided rect.\n\t * @internal\n\t */\n\tanyPointsOutsideRect: (rect: Rect, ps: Point[]): boolean => {\n\t\tconst rectMinX = Rect.minX(rect)\n\t\tconst rectMinY = Rect.minY(rect)\n\t\tconst rectMaxX = Rect.maxX(rect)\n\t\tconst rectMaxY = Rect.maxY(rect)\n\n\t\tfor (const point of ps) {\n\t\t\tif (point.x < rectMinX || point.x > rectMaxX) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif (point.y < rectMinY || point.y > rectMaxY) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\n\t\treturn false\n\t},\n\n\t/**\n\t * Returns the four edges of a rect as lines in the order of top, right, bottom, left.\n\t * @internal\n\t */\n\tedges: (rect: Rect): [Line, Line, Line, Line] => {\n\t\tconst [tl, tr, br, bl] = Rect.cornerPoints(rect)\n\t\treturn [Line(tl, tr), Line(tr, br), Line(br, bl), Line(bl, tl)]\n\t},\n\n\t/**\n\t * Return a new rect projected into a new position based on the anchor rect and the given direction/alignment.\n\t * @internal\n\t */\n\trebaseRectOnto: (\n\t\trect: Rect,\n\t\tanchorRect: Rect,\n\t\tdirection: \"top\" | \"right\" | \"bottom\" | \"left\",\n\t\talignment: \"start\" | \"center\" | \"end\",\n\t) => {\n\t\tconst rebasedRect = { ...rect }\n\n\t\t// rebase X axis\n\t\tswitch (direction) {\n\t\t\tcase \"bottom\":\n\t\t\tcase \"top\":\n\t\t\t\tswitch (alignment) {\n\t\t\t\t\tcase \"start\":\n\t\t\t\t\t\trebasedRect.x = anchorRect.x\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase \"center\":\n\t\t\t\t\t\trebasedRect.x = anchorRect.x + anchorRect.width / 2 - rect.width / 2\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase \"end\":\n\t\t\t\t\t\trebasedRect.x = anchorRect.x + anchorRect.width - rect.width\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tassertNever(alignment)\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase \"left\":\n\t\t\t\trebasedRect.x = anchorRect.x - rect.width\n\t\t\t\tbreak\n\t\t\tcase \"right\":\n\t\t\t\trebasedRect.x = anchorRect.x + anchorRect.width\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tassertNever(direction)\n\t\t}\n\n\t\t// rebase Y axis\n\t\tswitch (direction) {\n\t\t\tcase \"left\":\n\t\t\tcase \"right\":\n\t\t\t\tswitch (alignment) {\n\t\t\t\t\tcase \"start\":\n\t\t\t\t\t\trebasedRect.y = anchorRect.y\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase \"center\":\n\t\t\t\t\t\trebasedRect.y = anchorRect.y + anchorRect.height / 2 - rect.height / 2\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase \"end\":\n\t\t\t\t\t\trebasedRect.y = anchorRect.y + anchorRect.height - rect.height\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tassertNever(alignment)\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase \"top\":\n\t\t\t\trebasedRect.y = anchorRect.y - rect.height\n\t\t\t\tbreak\n\t\t\tcase \"bottom\":\n\t\t\t\trebasedRect.y = anchorRect.y + anchorRect.height\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tassertNever(direction)\n\t\t}\n\n\t\treturn rebasedRect\n\t},\n\n\t/**\n\t * Constrain a rect to a bound, offsetting its position to make the rect fit within the bound.\n\t * @internal\n\t */\n\tconstrain: (rect: Rect, bound?: Rect) => {\n\t\tif (!bound) return rect\n\n\t\t// check top\n\t\tlet y = Math.max(rect.y, bound.y)\n\t\t// check bottom\n\t\ty = Math.min(y, bound.y + bound.height - rect.height)\n\t\t// check left\n\t\tlet x = Math.max(rect.x, bound.x)\n\t\t// check right\n\t\tx = Math.min(x, bound.x + bound.width - rect.width)\n\n\t\treturn {\n\t\t\tx,\n\t\t\ty,\n\t\t\twidth: rect.width,\n\t\t\theight: rect.height,\n\t\t}\n\t},\n\n\t/**\n\t * Finds the closest edge of a rect to a point. Note that this does not check perpendicular\n\t * distances, so it might not be the technically closest edge, but rather a close approximation\n\t * or the visually closest edge. It achieves this by drawing a line from the center of the rect\n\t * to the point and checking if it intersects with any of the edges. Returns undefined if no\n\t * edge is intersected (e.g., if the point is inside the rect).\n\t * @internal\n\t */\n\tclosestEdge: (rect: Rect, point: Point): { edge: Line; name: \"top\" | \"right\" | \"bottom\" | \"left\" } | undefined => {\n\t\tconst center = Rect.center(rect)\n\t\tconst pointToCenterLine = Line(point, center)\n\t\tconst edges = Rect.edges(rect)\n\n\t\tfor (let i = 0; i < edges.length; i++) {\n\t\t\tconst edge = edges[i]\n\t\t\tif (!edge) continue\n\n\t\t\tif (Line.intersection(pointToCenterLine, edge, true)) {\n\t\t\t\tconst name = edgesInOrder[i]\n\t\t\t\tassert(name, \"Invalid edge name\", edgesInOrder)\n\t\t\t\treturn { edge, name }\n\t\t\t}\n\t\t}\n\t},\n\n\t/** @internal */\n\tclosestRect: (rects: Rect[], point: Point): { rect: Rect; index: number } => {\n\t\tlet index = 0\n\t\tlet rect = rects[0]\n\t\tassert(rect, \"Rect array is empty\")\n\t\tlet distance = Rect.pointDistance(rect, point)\n\n\t\tfor (let candidateIndex = 1; candidateIndex < rects.length; candidateIndex += 1) {\n\t\t\tconst candidateRect = rects[candidateIndex]\n\t\t\tassert(candidateRect)\n\t\t\tconst candidateDistance = Rect.pointDistance(candidateRect, point)\n\n\t\t\tif (candidateDistance < distance) {\n\t\t\t\tindex = candidateIndex\n\t\t\t\trect = candidateRect\n\t\t\t\tdistance = candidateDistance\n\t\t\t}\n\n\t\t\tif (distance === 0) break\n\t\t}\n\n\t\treturn { rect, index }\n\t},\n}\n\nconst edgesInOrder = /* @__PURE__ */ [\"top\", \"right\", \"bottom\", \"left\"] as const\n", "import { warnOnce } from \"./warnOnce.ts\"\n\nexport function deprecationWarning(removedItem: string, removalVersion: string, replacement?: string) {\n\tconst replacementText = replacement ? `, use ${replacement} instead` : \"\"\n\tconst warningText = `Deprecation warning: ${removedItem} will be removed in version ${removalVersion}${replacementText}.`\n\twarnOnce(warningText)\n}\n", "import type { Cancel, Change, TransactionId } from \"./Animatable.ts\"\n\n/**\n * @public\n */\nexport type UpdateFunction<Value> = (change: Change<Value> | undefined, transaction?: TransactionId) => void\n/**\n * @public\n */\nexport type FinishFunction = (transaction: TransactionId) => void\n/**\n * @public\n */\nexport type Observer<Value> =\n\t| {\n\t\t\tupdate: UpdateFunction<Value>\n\t\t\tfinish: FinishFunction\n\t  }\n\t| UpdateFunction<Value>\n\n/**\n * @public\n */\nexport interface UpdateObserver<Value> {\n\tonUpdate(handler: Observer<Value>): Cancel\n}\n\n/**\n * @internal\n */\nexport class Observers<Value> {\n\tprivate observers: Set<Observer<Value>> = new Set()\n\tprivate transactions: { [key: number]: Change<Value> } = {}\n\tadd(observer: Observer<Value>): Cancel {\n\t\tthis.observers.add(observer)\n\t\tlet isCalled = false\n\t\treturn () => {\n\t\t\tif (isCalled) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tisCalled = true\n\t\t\tthis.remove(observer)\n\t\t}\n\t}\n\n\tprivate remove(observer: Observer<Value>) {\n\t\tthis.observers.delete(observer)\n\t}\n\n\tnotify(change: Change<Value>, transaction?: TransactionId) {\n\t\tif (transaction) {\n\t\t\tconst accumulatedChange = this.transactions[transaction] || change\n\t\t\taccumulatedChange.value = change.value\n\t\t\tthis.transactions[transaction] = accumulatedChange\n\t\t} else {\n\t\t\tthis.callObservers(change)\n\t\t}\n\t}\n\n\tfinishTransaction(transaction: TransactionId) {\n\t\tconst accumulatedChange = this.transactions[transaction]\n\t\tdelete this.transactions[transaction]\n\t\treturn this.callObservers(accumulatedChange, transaction)\n\t}\n\n\tprivate callObservers(change: Change<Value> | undefined, transaction?: TransactionId) {\n\t\tconst finishObservers: FinishFunction[] = []\n\t\t// Make a copy and de-duplicate so we always call all handlers,\n\t\t// even if the handler array changes because of handler call\n\t\tnew Set(this.observers).forEach(observer => {\n\t\t\tif (typeof observer === \"function\") {\n\t\t\t\tobserver(change, transaction)\n\t\t\t} else {\n\t\t\t\tobserver.update(change, transaction)\n\t\t\t\tfinishObservers.push(observer.finish)\n\t\t\t}\n\t\t})\n\t\treturn finishObservers\n\t}\n}\n", "import type { MotionValue } from \"framer-motion\"\nimport type { Interpolation } from \"../../interpolation/Interpolation.ts\"\nimport { deprecationWarning } from \"../../utils/deprecation.ts\"\nimport type { FinishFunction, Observer, UpdateObserver } from \"./Observers.ts\"\nimport { Observers } from \"./Observers.ts\"\n\n/** @public */\nexport type Cancel = () => void\n\n/**\n * @public\n */\nexport type TransactionId = number\nexport interface Change<Value> {\n\tvalue: Value\n\toldValue?: Value\n}\n\nexport type ToAnimatable<PossiblyAnimatable> =\n\tPossiblyAnimatable extends Animatable<infer Value> ? Animatable<Value> : Animatable<PossiblyAnimatable>\n\nexport type FromAnimatable<PossiblyAnimatable> =\n\tPossiblyAnimatable extends Animatable<infer Value> ? Value : PossiblyAnimatable\n\nexport type ToAnimatableOrValue<PossiblyAnimatable> =\n\tPossiblyAnimatable extends Animatable<infer Value>\n\t\t? Value | Animatable<Value>\n\t\t: PossiblyAnimatable | Animatable<PossiblyAnimatable>\n\n/** @public */\nexport type AnimatableObject<T> = { [K in keyof T]: ToAnimatableOrValue<T[K]> }\n\n/**\n * @public\n * @deprecated\n */\nexport type DeprecatedAnimationTarget<Value> = Animatable<Value> | AnimatableObject<Value> | MotionValue<Value>\n\n/**\n * @public\n * @deprecated Use {@link useMotionValue} instead\n */\nexport interface Animatable<Value> extends UpdateObserver<Value> {\n\t/**\n\t * Get the current value out of this Animatable object\n\t * @remarks\n\t * ```jsx\n\t * const a = Animatable(0)\n\t * a.get() // returns 0\n\t * await animate(a, 42)\n\t * a.get() // returns 42\n\t * ```\n\t * @returns Current value\n\t * @public\n\t */\n\tget(): Value\n\t/**\n\t * Set a new value to a animatable object\n\t * @remarks\n\t * The passed value can be an Animatable value too\n\t * ```jsx\n\t * const a = Animatable(0)\n\t * const b = Animatable(100)\n\t * a.set(42)\n\t * a.get() // returns 42\n\t * a.set(b)\n\t * a.get() // returns 100\n\t * ```\n\t * @param value - New value to set to the animatable\n\t * @public\n\t */\n\tset(value: Value | Animatable<Value>): void\n\t/**\n\t * @public\n\t */\n\tset(value: Value | Animatable<Value>, transaction?: TransactionId): void\n\t/**\n\t * @internal\n\t */\n\tfinishTransaction(transaction: TransactionId): FinishFunction[]\n}\n\n/**\n * @public\n */\nexport const Animatable = /* @__PURE__ */ (() => {\n\t/**\n\t * Creates a Animatable object that can be animated. These objects can be passed into a {@link DeprecatedFrame} instead of a primitive like number\n\t * and afterwards animated with {@link (animate:function)}.\n\t * @remarks\n\t * ```jsx\n\t * const value = Animatable(0)\n\t * animate(value, 100)\n\t * ```\n\t * @param value - Value to animate\n\t * @returns Animatable value\n\t * @public\n\t * @deprecated Use {@link useMotionValue} instead\n\t */\n\tfunction Animatable<Value>(value: Value | Animatable<Value>): Animatable<Value> {\n\t\tdeprecationWarning(\"Animatable()\", \"2.0.0\", \"the new animation API (https://www.framer.com/api/animation/)\")\n\t\treturn isAnimatable(value) ? value : new AnimatableValue(value)\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tAnimatable.transaction = (\n\t\t// biome-ignore lint/suspicious/noExplicitAny: deprecated\n\t\tupdate: (updater: (animatable: Animatable<any>, value: any) => void, transactionId: TransactionId) => void,\n\t): void => {\n\t\tconst transactionId = Math.random()\n\t\t// biome-ignore lint/suspicious/noExplicitAny: deprecated\n\t\tconst updatedValues: Set<Animatable<any>> = new Set()\n\t\t// biome-ignore lint/suspicious/noExplicitAny: deprecated\n\t\tconst updater = (animatable: Animatable<any>, value: any): void => {\n\t\t\tanimatable.set(value, transactionId)\n\t\t\tupdatedValues.add(animatable)\n\t\t}\n\t\tupdate(updater, transactionId)\n\t\tconst finishObservers: FinishFunction[] = []\n\t\tupdatedValues.forEach(value => {\n\t\t\tfinishObservers.push(...value.finishTransaction(transactionId))\n\t\t})\n\t\tfinishObservers.forEach(finish => {\n\t\t\tfinish(transactionId)\n\t\t})\n\t}\n\n\t/**\n\t * @public\n\t */\n\tAnimatable.getNumber = (value: number | Animatable<number> | null | undefined, defaultValue: number = 0): number => {\n\t\treturn Animatable.get(value, defaultValue)\n\t}\n\n\t/** @internal */\n\tAnimatable.get = <Value>(value: Value | Animatable<Value> | null | undefined, defaultValue: Value): Value => {\n\t\tif (value === undefined || value === null) {\n\t\t\treturn defaultValue\n\t\t}\n\t\tif (isAnimatable(value)) {\n\t\t\treturn value.get()\n\t\t}\n\t\treturn value\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tAnimatable.objectToValues = <Object>(object: AnimatableObject<Object>): Object => {\n\t\tif (!object) {\n\t\t\treturn object\n\t\t}\n\t\t// biome-ignore lint/suspicious/noExplicitAny: deprecated\n\t\tconst result: any = {}\n\t\tfor (const key in object) {\n\t\t\tconst value = object[key]\n\t\t\tif (isAnimatable(value)) {\n\t\t\t\tresult[key] = value.get()\n\t\t\t} else {\n\t\t\t\tresult[key] = value\n\t\t\t}\n\t\t}\n\t\treturn result\n\t}\n\n\treturn Animatable\n})()\n\nconst onUpdateKey: keyof AnimatableValue = \"onUpdate\"\nconst finishTransactionKey: keyof AnimatableValue = \"finishTransaction\"\n\n/**\n * @internal\n * @deprecated\n */\n// biome-ignore lint/suspicious/noExplicitAny: deprecated\nexport function isAnimatable(value: any): value is Animatable<any> {\n\treturn (\n\t\tvalue !== null &&\n\t\ttypeof value === \"object\" &&\n\t\tonUpdateKey in value &&\n\t\tvalue[onUpdateKey] instanceof Function &&\n\t\tfinishTransactionKey in value &&\n\t\tvalue[finishTransactionKey] instanceof Function\n\t)\n}\n\nfunction animatableInterpolation<Value>(\n\tvalue: Animatable<Value>,\n\t// biome-ignore lint/suspicious/noExplicitAny: deprecated\n\tcurrentInterpolation: Interpolation<any>,\n): Interpolation<Animatable<Value>> {\n\treturn {\n\t\tinterpolate(from: Animatable<Value>, to: Animatable<Value>): (progress: number) => Animatable<Value> {\n\t\t\tconst fromValue = from.get()\n\t\t\tconst toValue = to.get()\n\t\t\tconst result = Animatable(fromValue)\n\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: deprecated\n\t\t\treturn (progress: number): Animatable<any> => {\n\t\t\t\tconst v = currentInterpolation.interpolate(fromValue, toValue)(progress)\n\t\t\t\tresult.set(v)\n\t\t\t\treturn result\n\t\t\t}\n\t\t},\n\t\tdifference(from: Animatable<Value>, to: Animatable<Value>): number {\n\t\t\tconst v = from.get()\n\t\t\treturn currentInterpolation.difference(v, to.get())\n\t\t},\n\t}\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: deprecated\nclass AnimatableValue<Value = any> implements Animatable<Value> {\n\tprivate observers = new Observers()\n\n\tconstructor(private value: Value) {}\n\n\tstatic interpolationFor<Value>(\n\t\t// biome-ignore lint/suspicious/noExplicitAny: deprecated\n\t\tvalue: any,\n\t\t// biome-ignore lint/suspicious/noExplicitAny: deprecated\n\t\tcurrentInterpolation: Interpolation<any>,\n\t): Interpolation<Animatable<Value>> | undefined {\n\t\tif (isAnimatable(value)) {\n\t\t\treturn animatableInterpolation<Value>(value, currentInterpolation)\n\t\t}\n\t}\n\n\tget(): Value {\n\t\treturn this.value\n\t}\n\n\tset(value: Value | Animatable<Value>, transaction?: TransactionId) {\n\t\tconst oldValue = this.value\n\t\tif (isAnimatable(value)) {\n\t\t\tvalue = value.get()\n\t\t}\n\t\tthis.value = value\n\t\tconst change = {\n\t\t\tvalue,\n\t\t\toldValue,\n\t\t}\n\t\tthis.observers.notify(change, transaction)\n\t}\n\n\tfinishTransaction(transaction: TransactionId) {\n\t\treturn this.observers.finishTransaction(transaction)\n\t}\n\n\tonUpdate(handler: Observer<Value>): Cancel {\n\t\treturn this.observers.add(handler)\n\t}\n}\n", "import type React from \"react\"\n\nexport type ReactElementType = string | React.JSXElementConstructor<any>\n\nfunction isEmpty(obj: any): boolean {\n\treturn !obj || (!Object.keys(obj).length && obj.constructor === Object)\n}\n\nexport function isReactElement<P, T extends ReactElementType = ReactElementType>(\n\ttest: React.ReactChild,\n): test is React.ReactElement<P, T> {\n\treturn typeof test !== \"string\" && typeof test !== \"number\"\n}\n\nexport function isReactChild(test: React.ReactNode): test is React.ReactChild {\n\treturn test !== null && typeof test !== \"undefined\" && typeof test !== \"boolean\" && !isEmpty(test)\n}\n", "/** @internal */\nexport function isFiniteNumber(value: any): value is number {\n\treturn Number.isFinite(value)\n}\n\n/** @internal */\nexport function finiteNumber(value: any): number | undefined {\n\treturn isFiniteNumber(value) ? value : undefined\n}\n", "import type React from \"react\"\nimport type { AnimatableObject } from \"../../animation/Animatable/Animatable.ts\"\nimport { Animatable, isAnimatable } from \"../../animation/Animatable/Animatable.ts\"\nimport { assertNever } from \"../../utils/assert.ts\"\nimport { isReactChild, isReactElement } from \"../../utils/type-guards.ts\"\nimport { isUndefined } from \"../../utils/utils.ts\"\nimport type { WithFractionOfFreeSpace } from \"../traits/FreeSpace.ts\"\nimport { isFiniteNumber } from \"../utils/isFiniteNumber.ts\"\nimport { Rect } from \"./Rect.ts\"\nimport type { Size } from \"./Size.ts\"\n\n/** @internal */\ninterface ParentSizeInfo {\n\tsizing: Size | AnimatableObject<Size> | null\n\tpositioning: Size | AnimatableObject<Size> | null\n\t/* used for vh constraints */\n\tviewport: Size | null\n}\n\n/** @internal */\nexport interface DefaultProps {\n\tparentSize: AnimatableObject<Size> // Should always be mirrored with the parentSize in ConstraintProperties\n}\n\n/**\n * These properties are used to layout elements within Framer\u2019s constraint system.\n * @privateRemarks Represents model property values for layout constraints. These may be internally inconsistent. Mask and Values are generated from these.\n * @public\n * */\nexport interface ConstraintProperties extends Partial<WithFractionOfFreeSpace> {\n\t/**\n\t * //TODO Should it be internal?\n\t * @internal\n\t */\n\tparentSize: Size | null\n\n\t/**\n\t * Pinned position from left\n\t * @public\n\t */\n\tleft: Animatable<number> | number | null\n\n\t/**\n\t * Pinned position from right\n\t * @public\n\t */\n\tright: Animatable<number> | number | null\n\n\t/**\n\t * Pinned position from top\n\t * @public\n\t */\n\ttop: Animatable<number> | number | null\n\n\t/**\n\t * Pinned position from bottom\n\t * @public\n\t */\n\tbottom: Animatable<number> | number | null\n\n\t/**\n\t * Center of horizontal position (X axis)\n\t * @public\n\t */\n\tcenterX: ConstraintPercentage\n\n\t/**\n\t * Center of vertical position (Y axis)\n\t * @public\n\t */\n\tcenterY: ConstraintPercentage\n\n\t/**\n\t * Element width\n\t * @public\n\t */\n\twidth: ConstraintDimension\n\n\t/**\n\t * Element height\n\t * @public\n\t */\n\theight: ConstraintDimension\n\n\t/**\n\t * Aspect Ratio to keep when resizing\n\t * @public\n\t */\n\taspectRatio: number | null\n\n\t/**\n\t * //TODO What is autoSize for? Internal?\n\t * @public\n\t */\n\tautoSize?: boolean\n}\n\nexport const constraintDefaults: ConstraintProperties = {\n\tleft: null,\n\tright: null,\n\ttop: null,\n\tbottom: null,\n\tcenterX: \"50%\",\n\tcenterY: \"50%\",\n\taspectRatio: null,\n\tparentSize: null,\n\twidth: 100,\n\theight: 100,\n}\n\n// Some property values can be defined using parent-relative percentages. Note: this used to be indicated using React.CSSPercentage.\n/** @public */\nexport type ConstraintPercentage = string\nexport type ConstraintAuto = \"auto\"\nexport type ConstraintFreespaceFraction = string\n\n/**\n * Dimensions can be numbers or strings: percentages, fractions of free space (fr), or auto\n * @public\n */\nexport type ConstraintDimension =\n\t| Animatable<number>\n\t| number\n\t| ConstraintPercentage\n\t| ConstraintAuto\n\t| ConstraintFreespaceFraction\n\n/** @internal */\nexport enum DimensionType {\n\tFixedNumber = 0,\n\tPercentage = 1,\n\t/** @internal */ Auto = 2,\n\tFractionOfFreeSpace = 3,\n\tViewport = 4,\n\t/** @internal */\n\tFitImage = 5,\n}\n\n/** @internal */\nexport type SizeConstraints = Partial<{\n\tminWidth: string | number\n\tmaxWidth: string | number\n\tminHeight: string | number\n\tmaxHeight: string | number\n}>\n\n// Represents a set of active layout constraints. In a better world, this would be an enum / option set.\n/** @internal */\nexport interface ConstraintMask extends SizeConstraints {\n\tleft: boolean\n\tright: boolean\n\ttop: boolean\n\tbottom: boolean\n\n\twidthType: DimensionType\n\theightType: DimensionType\n\n\taspectRatio: number | null\n\tfixedSize: boolean // usesIntrinsicSize?\n}\n\nexport function isAutoDimensionType(dimensionType: DimensionType | undefined) {\n\tif (isUndefined(dimensionType)) return false\n\treturn dimensionType === DimensionType.Auto || dimensionType === DimensionType.FitImage\n}\nexport function isConstraintSupportingChild<T extends { constraints: Partial<ConstraintProperties> }>(\n\tchild: React.ReactChild,\n): child is React.ReactElement<T> {\n\tif (!isReactChild(child) || !isReactElement(child)) {\n\t\treturn false\n\t}\n\t// Assume for now that all children support constraints (so they get passed parentSize)\n\treturn true\n}\n\n/** @internal */\nexport const ConstraintMask = {\n\t// Modifies the constraint mask to remove invalid (mutually exclusive) options and returns the original.\n\t// TODO: this removes major inconsistencies but probably needs to be merged with ConstraintSolver.\n\tquickfix: (constraints: ConstraintMask): ConstraintMask => {\n\t\tif (isAutoDimensionType(constraints.widthType) || isAutoDimensionType(constraints.heightType)) {\n\t\t\tconstraints.aspectRatio = null\n\t\t}\n\n\t\tif (isFiniteNumber(constraints.aspectRatio)) {\n\t\t\tif (constraints.left && constraints.right) {\n\t\t\t\tconstraints.widthType = DimensionType.FixedNumber\n\t\t\t}\n\t\t\tif (constraints.top && constraints.bottom) {\n\t\t\t\tconstraints.heightType = DimensionType.FixedNumber\n\t\t\t}\n\t\t\tif (constraints.left && constraints.right && constraints.top && constraints.bottom) {\n\t\t\t\tconstraints.bottom = false\n\t\t\t}\n\t\t\tif (constraints.widthType !== DimensionType.FixedNumber && constraints.heightType !== DimensionType.FixedNumber) {\n\t\t\t\tconstraints.heightType = DimensionType.FixedNumber\n\t\t\t}\n\t\t}\n\n\t\tif (constraints.left && constraints.right) {\n\t\t\tif (constraints.fixedSize || isAutoDimensionType(constraints.widthType) || isFiniteNumber(constraints.maxWidth)) {\n\t\t\t\tconstraints.right = false\n\t\t\t}\n\n\t\t\tconstraints.widthType = DimensionType.FixedNumber\n\t\t}\n\t\tif (constraints.top && constraints.bottom) {\n\t\t\tif (\n\t\t\t\tconstraints.fixedSize ||\n\t\t\t\tisAutoDimensionType(constraints.heightType) ||\n\t\t\t\tisFiniteNumber(constraints.maxHeight)\n\t\t\t) {\n\t\t\t\tconstraints.bottom = false\n\t\t\t}\n\n\t\t\tconstraints.heightType = DimensionType.FixedNumber\n\t\t}\n\n\t\treturn constraints\n\t},\n}\n\n// Represents concrete snapshot values for constraints. Constraints that aren't active in the corresponding ConstraintsMask should be assumed to contain garbage.\n/** @internal */\nexport interface ConstraintValuesBase {\n\tleft: number | null\n\tright: number | null\n\ttop: number | null\n\tbottom: number | null\n\tcenterAnchorX: number // [0...1]\n\tcenterAnchorY: number // [0...1]\n\twidthType: DimensionType\n\theightType: DimensionType\n\taspectRatio: number | null\n}\n\n/** @internal */\nexport interface ConstraintValues extends ConstraintValuesBase, SizeConstraints {\n\twidth: number\n\theight: number\n}\n\n/**\n * @internal\n */\nexport interface UserConstraintValues extends ConstraintValuesBase, SizeConstraints {\n\twidth: number | null\n\theight: number | null\n}\n\n/** @internal */\nexport function valueToDimensionType(value: string | number | Animatable<number> | undefined) {\n\tif (typeof value === \"string\") {\n\t\tconst trimmedValue = value.trim()\n\t\tif (trimmedValue === \"auto\") return DimensionType.Auto\n\t\tif (trimmedValue.endsWith(\"fr\")) return DimensionType.FractionOfFreeSpace\n\t\tif (trimmedValue.endsWith(\"%\")) return DimensionType.Percentage\n\t\tif (trimmedValue.endsWith(\"vw\") || trimmedValue.endsWith(\"vh\")) return DimensionType.Viewport\n\t}\n\treturn DimensionType.FixedNumber\n}\n\n/**\n * @internal\n */\nexport const ConstraintValues = {\n\t// Returns concrete current values given some ConstraintProperties.\n\tfromProperties: (props: Partial<ConstraintProperties> & { autoSize?: boolean }): UserConstraintValues => {\n\t\tconst { left, right, top, bottom, width, height, centerX, centerY, aspectRatio, autoSize } = props\n\t\tconst constraints = ConstraintMask.quickfix({\n\t\t\tleft: isFiniteNumber(left) || isAnimatable(left),\n\t\t\tright: isFiniteNumber(right) || isAnimatable(right),\n\t\t\ttop: isFiniteNumber(top) || isAnimatable(top),\n\t\t\tbottom: isFiniteNumber(bottom) || isAnimatable(bottom),\n\t\t\twidthType: valueToDimensionType(width),\n\t\t\theightType: valueToDimensionType(height),\n\t\t\taspectRatio: aspectRatio || null,\n\t\t\tfixedSize: autoSize === true,\n\t\t})\n\n\t\tlet widthValue: number | null = null\n\t\tlet heightValue: number | null = null\n\n\t\tlet widthType = DimensionType.FixedNumber\n\t\tlet heightType = DimensionType.FixedNumber\n\n\t\tif (constraints.widthType !== DimensionType.FixedNumber && typeof width === \"string\") {\n\t\t\tconst parsedWidth = parseFloat(width)\n\n\t\t\tif (width.endsWith(\"fr\")) {\n\t\t\t\twidthType = DimensionType.FractionOfFreeSpace\n\t\t\t\twidthValue = parsedWidth\n\t\t\t} else if (width === \"auto\") {\n\t\t\t\twidthType = DimensionType.Auto\n\t\t\t} else {\n\t\t\t\t// Percentage\n\t\t\t\twidthType = DimensionType.Percentage\n\t\t\t\twidthValue = parsedWidth / 100\n\t\t\t}\n\t\t} else if (width !== undefined && typeof width !== \"string\") {\n\t\t\twidthValue = Animatable.getNumber(width)\n\t\t}\n\n\t\tif (constraints.heightType !== DimensionType.FixedNumber && typeof height === \"string\") {\n\t\t\tconst parsedHeight = parseFloat(height)\n\n\t\t\tif (height.endsWith(\"fr\")) {\n\t\t\t\theightType = DimensionType.FractionOfFreeSpace\n\t\t\t\theightValue = parsedHeight\n\t\t\t} else if (height === \"auto\") {\n\t\t\t\theightType = DimensionType.Auto\n\t\t\t} else {\n\t\t\t\t// Percentage\n\t\t\t\theightType = DimensionType.Percentage\n\t\t\t\theightValue = parseFloat(height) / 100\n\t\t\t}\n\t\t} else if (height !== undefined && typeof height !== \"string\") {\n\t\t\theightValue = Animatable.getNumber(height)\n\t\t}\n\n\t\tlet centerAnchorX = 0.5\n\t\tlet centerAnchorY = 0.5\n\t\tif (centerX) {\n\t\t\tcenterAnchorX = parseFloat(centerX) / 100\n\t\t}\n\t\tif (centerY) {\n\t\t\tcenterAnchorY = parseFloat(centerY) / 100\n\t\t}\n\n\t\treturn {\n\t\t\tleft: constraints.left ? Animatable.getNumber(left) : null,\n\t\t\tright: constraints.right ? Animatable.getNumber(right) : null,\n\t\t\ttop: constraints.top ? Animatable.getNumber(top) : null,\n\t\t\tbottom: constraints.bottom ? Animatable.getNumber(bottom) : null,\n\t\t\twidthType,\n\t\t\theightType,\n\t\t\twidth: widthValue,\n\t\t\theight: heightValue,\n\t\t\taspectRatio: constraints.aspectRatio || null,\n\t\t\tcenterAnchorX: centerAnchorX,\n\t\t\tcenterAnchorY: centerAnchorY,\n\t\t}\n\t},\n\n\ttoSize: (\n\t\tvalues: UserConstraintValues,\n\t\tparentSizeInfo: ParentSizeInfo | null,\n\t\tautoSize: Size | null,\n\t\tfreeSpace: WithFractionOfFreeSpace | null,\n\t): Size => {\n\t\tlet width: number | null = null\n\t\tlet height: number | null = null\n\n\t\tconst parentWidth = parentSizeInfo?.sizing ? Animatable.getNumber(parentSizeInfo?.sizing.width) : null\n\t\tconst parentHeight = parentSizeInfo?.sizing ? Animatable.getNumber(parentSizeInfo?.sizing.height) : null\n\n\t\tconst hOpposingPinsOffset = pinnedOffset(values.left, values.right)\n\n\t\tif (parentWidth && isFiniteNumber(hOpposingPinsOffset)) {\n\t\t\twidth = parentWidth - hOpposingPinsOffset\n\t\t} else if (autoSize && isAutoDimensionType(values.widthType)) {\n\t\t\twidth = autoSize.width\n\t\t} else if (isFiniteNumber(values.width)) {\n\t\t\tswitch (values.widthType) {\n\t\t\t\tcase DimensionType.FixedNumber:\n\t\t\t\t\twidth = values.width\n\t\t\t\t\tbreak\n\t\t\t\tcase DimensionType.FractionOfFreeSpace:\n\t\t\t\t\t// set width/height to null if freeSpace is not available, so we would fallback to the default value\n\t\t\t\t\t// see: https://github.com/framer/FramerStudio/pull/3345\n\t\t\t\t\twidth = freeSpace\n\t\t\t\t\t\t? (freeSpace.freeSpaceInParent.width / freeSpace.freeSpaceUnitDivisor.width) * values.width\n\t\t\t\t\t\t: null\n\t\t\t\t\tbreak\n\t\t\t\tcase DimensionType.Percentage:\n\t\t\t\tcase DimensionType.Viewport:\n\t\t\t\t\tif (parentWidth) {\n\t\t\t\t\t\twidth = parentWidth * values.width\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tcase DimensionType.Auto:\n\t\t\t\tcase DimensionType.FitImage:\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(values.widthType)\n\t\t\t}\n\t\t}\n\n\t\tconst vOpposingPinsOffset = pinnedOffset(values.top, values.bottom)\n\n\t\tif (parentHeight && isFiniteNumber(vOpposingPinsOffset)) {\n\t\t\theight = parentHeight - vOpposingPinsOffset\n\t\t} else if (autoSize && isAutoDimensionType(values.heightType)) {\n\t\t\theight = autoSize.height\n\t\t} else if (isFiniteNumber(values.height)) {\n\t\t\tswitch (values.heightType) {\n\t\t\t\tcase DimensionType.FixedNumber:\n\t\t\t\t\theight = values.height\n\t\t\t\t\tbreak\n\t\t\t\tcase DimensionType.FractionOfFreeSpace:\n\t\t\t\t\t// set width/height to null if freeSpace is not available, so we would fallback to the default value\n\t\t\t\t\t// see: https://github.com/framer/FramerStudio/pull/3345\n\t\t\t\t\theight = freeSpace\n\t\t\t\t\t\t? (freeSpace.freeSpaceInParent.height / freeSpace.freeSpaceUnitDivisor.height) * values.height\n\t\t\t\t\t\t: null\n\t\t\t\t\tbreak\n\t\t\t\tcase DimensionType.Percentage:\n\t\t\t\tcase DimensionType.Viewport:\n\t\t\t\t\tif (parentHeight) {\n\t\t\t\t\t\theight = parentHeight * values.height\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tcase DimensionType.Auto:\n\t\t\t\tcase DimensionType.FitImage:\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(values.heightType)\n\t\t\t}\n\t\t}\n\n\t\treturn sizeAfterApplyingConstraintsAndAspectRatio(\n\t\t\twidth,\n\t\t\theight,\n\t\t\tvalues,\n\t\t\t{\n\t\t\t\theight: parentHeight ?? 0,\n\t\t\t\twidth: parentWidth ?? 0,\n\t\t\t},\n\t\t\tparentSizeInfo?.viewport,\n\t\t)\n\t},\n\n\t// Returns a parent-relative rect given concrete ConstraintValues.\n\ttoRect: (\n\t\tvalues: UserConstraintValues,\n\t\t// Normally we would use the same parentSize to calculate the node's size (width/height) and postiion (x/y), but\n\t\t// for non-position-fixed nodes using vw/vh, the size is based on the viewport size, while its position should\n\t\t// still be calculated via its parent's size.\n\t\tparentSizeInfo: ParentSizeInfo | null = null,\n\t\tautoSize: Size | null = null,\n\t\tpixelAlign: boolean = false,\n\t\t// This argument is actually never used, because fractional sizes are\n\t\t// always calculated by it's parent to static sizes\n\t\tfreeSpace: WithFractionOfFreeSpace | null = null,\n\t): Rect => {\n\t\tlet x = values.left || 0\n\t\tlet y = values.top || 0\n\n\t\tconst { width, height } = ConstraintValues.toSize(values, parentSizeInfo, autoSize, freeSpace)\n\n\t\tconst parentSizeForPositioning = parentSizeInfo?.positioning ?? null\n\t\tconst positioningParentWidth = parentSizeForPositioning\n\t\t\t? Animatable.getNumber(parentSizeForPositioning.width)\n\t\t\t: null\n\t\tconst positioningParentHeight = parentSizeForPositioning\n\t\t\t? Animatable.getNumber(parentSizeForPositioning.height)\n\t\t\t: null\n\n\t\tif (values.left !== null) {\n\t\t\tx = values.left\n\t\t} else if (positioningParentWidth && values.right !== null) {\n\t\t\tx = positioningParentWidth - values.right - width\n\t\t} else if (positioningParentWidth) {\n\t\t\tx = values.centerAnchorX * positioningParentWidth - width / 2\n\t\t}\n\n\t\tif (values.top !== null) {\n\t\t\ty = values.top\n\t\t} else if (positioningParentHeight && values.bottom !== null) {\n\t\t\ty = positioningParentHeight - values.bottom - height\n\t\t} else if (positioningParentHeight) {\n\t\t\ty = values.centerAnchorY * positioningParentHeight - height / 2\n\t\t}\n\n\t\tconst f: Rect = { x, y, width, height }\n\t\tif (pixelAlign) {\n\t\t\treturn Rect.pixelAligned(f)\n\t\t}\n\t\treturn f\n\t},\n}\n\nconst defaultWidth = 200\nconst defaultHeight = 200\n\nfunction getConstraintValue(\n\tconstraint: keyof SizeConstraints,\n\tvalue: string | number,\n\tparentSize: Size | null | undefined,\n\tviewport: Size | null | undefined,\n): number {\n\tif (typeof value === \"string\") {\n\t\tif (value.endsWith(\"%\") && parentSize) {\n\t\t\tswitch (constraint) {\n\t\t\t\tcase \"maxWidth\":\n\t\t\t\tcase \"minWidth\":\n\t\t\t\t\treturn (parseFloat(value) / 100) * parentSize.width\n\t\t\t\tcase \"maxHeight\":\n\t\t\t\tcase \"minHeight\":\n\t\t\t\t\treturn (parseFloat(value) / 100) * parentSize.height\n\n\t\t\t\tdefault:\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif (value.endsWith(\"vh\")) {\n\t\t\tif (!viewport) return constraintValueForUncalculatedViewport(constraint)\n\t\t\tswitch (constraint) {\n\t\t\t\tcase \"maxWidth\":\n\t\t\t\tcase \"minWidth\":\n\t\t\t\t\treturn (parseFloat(value) / 100) * viewport.width\n\t\t\t\tcase \"maxHeight\":\n\t\t\t\tcase \"minHeight\":\n\t\t\t\t\treturn (parseFloat(value) / 100) * viewport.height\n\n\t\t\t\tdefault:\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\treturn parseFloat(value)\n\t}\n\n\treturn value\n}\n\nfunction constraintValueForUncalculatedViewport(constraint: keyof SizeConstraints): number {\n\t// Unexpected, but we should not just parse the vh value to px value. If we can't calculated the vh\n\t// value, return Infinity so the constraint doesn't have an impact on the constrained rect.\n\tswitch (constraint) {\n\t\tcase \"minWidth\":\n\t\tcase \"minHeight\":\n\t\t\treturn Number.NEGATIVE_INFINITY\n\t\tcase \"maxWidth\":\n\t\tcase \"maxHeight\":\n\t\t\treturn Number.POSITIVE_INFINITY\n\t\tdefault:\n\t\t\tassertNever(constraint, \"unknown constraint key\")\n\t}\n}\n\nfunction constrainHeight(\n\theight: number,\n\tvalues: UserConstraintValues,\n\tparentSize: Size | undefined | null,\n\tviewport: Size | undefined | null,\n) {\n\tif (values.minHeight) {\n\t\theight = Math.max(getConstraintValue(\"minHeight\", values.minHeight, parentSize, viewport), height)\n\t}\n\tif (values.maxHeight) {\n\t\theight = Math.min(getConstraintValue(\"maxHeight\", values.maxHeight, parentSize, viewport), height)\n\t}\n\n\treturn height\n}\n\nfunction constrainWidth(\n\twidth: number,\n\tvalues: UserConstraintValues,\n\tparentSize: Size | undefined | null,\n\tviewport: Size | undefined | null,\n) {\n\tif (values.minWidth) {\n\t\twidth = Math.max(getConstraintValue(\"minWidth\", values.minWidth, parentSize, viewport), width)\n\t}\n\tif (values.maxWidth) {\n\t\twidth = Math.min(getConstraintValue(\"maxWidth\", values.maxWidth, parentSize, viewport), width)\n\t}\n\n\treturn width\n}\n\nfunction sizeAfterApplyingConstraintsAndAspectRatio(\n\twidth: number | null,\n\theight: number | null,\n\tvalues: UserConstraintValues,\n\tparentSize: Size | null | undefined,\n\tviewport: Size | null | undefined,\n): Size {\n\tlet w = constrainWidth(isFiniteNumber(width) ? width : defaultWidth, values, parentSize, viewport)\n\tlet h = constrainHeight(isFiniteNumber(height) ? height : defaultHeight, values, parentSize, viewport)\n\n\tif (isFiniteNumber(values.aspectRatio) && values.aspectRatio > 0) {\n\t\tif (isFiniteNumber(values.left) && isFiniteNumber(values.right)) {\n\t\t\th = w / values.aspectRatio\n\t\t} else if (isFiniteNumber(values.top) && isFiniteNumber(values.bottom)) {\n\t\t\tw = h * values.aspectRatio\n\t\t} else if (values.widthType !== DimensionType.FixedNumber) {\n\t\t\th = w / values.aspectRatio\n\t\t} else {\n\t\t\tw = h * values.aspectRatio\n\t\t}\n\t}\n\n\treturn {\n\t\twidth: w,\n\t\theight: h,\n\t}\n}\n\nfunction pinnedOffset(start: number | null, end: number | null) {\n\tif (!isFiniteNumber(start) || !isFiniteNumber(end)) return null\n\treturn start + end\n}\n", "export const cssNames: Record<string, string> = {\n\taliceblue: \"f0f8ff\",\n\tantiquewhite: \"faebd7\",\n\taqua: \"0ff\",\n\taquamarine: \"7fffd4\",\n\tazure: \"f0ffff\",\n\tbeige: \"f5f5dc\",\n\tbisque: \"ffe4c4\",\n\tblack: \"000\",\n\tblanchedalmond: \"ffebcd\",\n\tblue: \"00f\",\n\tblueviolet: \"8a2be2\",\n\tbrown: \"a52a2a\",\n\tburlywood: \"deb887\",\n\tburntsienna: \"ea7e5d\",\n\tcadetblue: \"5f9ea0\",\n\tchartreuse: \"7fff00\",\n\tchocolate: \"d2691e\",\n\tcoral: \"ff7f50\",\n\tcornflowerblue: \"6495ed\",\n\tcornsilk: \"fff8dc\",\n\tcrimson: \"dc143c\",\n\tcyan: \"0ff\",\n\tdarkblue: \"00008b\",\n\tdarkcyan: \"008b8b\",\n\tdarkgoldenrod: \"b8860b\",\n\tdarkgray: \"a9a9a9\",\n\tdarkgreen: \"006400\",\n\tdarkgrey: \"a9a9a9\",\n\tdarkkhaki: \"bdb76b\",\n\tdarkmagenta: \"8b008b\",\n\tdarkolivegreen: \"556b2f\",\n\tdarkorange: \"ff8c00\",\n\tdarkorchid: \"9932cc\",\n\tdarkred: \"8b0000\",\n\tdarksalmon: \"e9967a\",\n\tdarkseagreen: \"8fbc8f\",\n\tdarkslateblue: \"483d8b\",\n\tdarkslategray: \"2f4f4f\",\n\tdarkslategrey: \"2f4f4f\",\n\tdarkturquoise: \"00ced1\",\n\tdarkviolet: \"9400d3\",\n\tdeeppink: \"ff1493\",\n\tdeepskyblue: \"00bfff\",\n\tdimgray: \"696969\",\n\tdimgrey: \"696969\",\n\tdodgerblue: \"1e90ff\",\n\tfirebrick: \"b22222\",\n\tfloralwhite: \"fffaf0\",\n\tforestgreen: \"228b22\",\n\tfuchsia: \"f0f\",\n\tgainsboro: \"dcdcdc\",\n\tghostwhite: \"f8f8ff\",\n\tgold: \"ffd700\",\n\tgoldenrod: \"daa520\",\n\tgray: \"808080\",\n\tgreen: \"008000\",\n\tgreenyellow: \"adff2f\",\n\tgrey: \"808080\",\n\thoneydew: \"f0fff0\",\n\thotpink: \"ff69b4\",\n\tindianred: \"cd5c5c\",\n\tindigo: \"4b0082\",\n\tivory: \"fffff0\",\n\tkhaki: \"f0e68c\",\n\tlavender: \"e6e6fa\",\n\tlavenderblush: \"fff0f5\",\n\tlawngreen: \"7cfc00\",\n\tlemonchiffon: \"fffacd\",\n\tlightblue: \"add8e6\",\n\tlightcoral: \"f08080\",\n\tlightcyan: \"e0ffff\",\n\tlightgoldenrodyellow: \"fafad2\",\n\tlightgray: \"d3d3d3\",\n\tlightgreen: \"90ee90\",\n\tlightgrey: \"d3d3d3\",\n\tlightpink: \"ffb6c1\",\n\tlightsalmon: \"ffa07a\",\n\tlightseagreen: \"20b2aa\",\n\tlightskyblue: \"87cefa\",\n\tlightslategray: \"789\",\n\tlightslategrey: \"789\",\n\tlightsteelblue: \"b0c4de\",\n\tlightyellow: \"ffffe0\",\n\tlime: \"0f0\",\n\tlimegreen: \"32cd32\",\n\tlinen: \"faf0e6\",\n\tmagenta: \"f0f\",\n\tmaroon: \"800000\",\n\tmediumaquamarine: \"66cdaa\",\n\tmediumblue: \"0000cd\",\n\tmediumorchid: \"ba55d3\",\n\tmediumpurple: \"9370db\",\n\tmediumseagreen: \"3cb371\",\n\tmediumslateblue: \"7b68ee\",\n\tmediumspringgreen: \"00fa9a\",\n\tmediumturquoise: \"48d1cc\",\n\tmediumvioletred: \"c71585\",\n\tmidnightblue: \"191970\",\n\tmintcream: \"f5fffa\",\n\tmistyrose: \"ffe4e1\",\n\tmoccasin: \"ffe4b5\",\n\tnavajowhite: \"ffdead\",\n\tnavy: \"000080\",\n\toldlace: \"fdf5e6\",\n\tolive: \"808000\",\n\tolivedrab: \"6b8e23\",\n\torange: \"ffa500\",\n\torangered: \"ff4500\",\n\torchid: \"da70d6\",\n\tpalegoldenrod: \"eee8aa\",\n\tpalegreen: \"98fb98\",\n\tpaleturquoise: \"afeeee\",\n\tpalevioletred: \"db7093\",\n\tpapayawhip: \"ffefd5\",\n\tpeachpuff: \"ffdab9\",\n\tperu: \"cd853f\",\n\tpink: \"ffc0cb\",\n\tplum: \"dda0dd\",\n\tpowderblue: \"b0e0e6\",\n\tpurple: \"800080\",\n\trebeccapurple: \"663399\",\n\tred: \"f00\",\n\trosybrown: \"bc8f8f\",\n\troyalblue: \"4169e1\",\n\tsaddlebrown: \"8b4513\",\n\tsalmon: \"fa8072\",\n\tsandybrown: \"f4a460\",\n\tseagreen: \"2e8b57\",\n\tseashell: \"fff5ee\",\n\tsienna: \"a0522d\",\n\tsilver: \"c0c0c0\",\n\tskyblue: \"87ceeb\",\n\tslateblue: \"6a5acd\",\n\tslategray: \"708090\",\n\tslategrey: \"708090\",\n\tsnow: \"fffafa\",\n\tspringgreen: \"00ff7f\",\n\tsteelblue: \"4682b4\",\n\ttan: \"d2b48c\",\n\tteal: \"008080\",\n\tthistle: \"d8bfd8\",\n\ttomato: \"ff6347\",\n\tturquoise: \"40e0d0\",\n\tviolet: \"ee82ee\",\n\twheat: \"f5deb3\",\n\twhite: \"fff\",\n\twhitesmoke: \"f5f5f5\",\n\tyellow: \"ff0\",\n\tyellowgreen: \"9acd32\",\n}\n", "export function modulate(value: number, rangeA: [number, number], rangeB: [number, number], limit = false): number {\n\tconst [fromLow, fromHigh] = rangeA\n\tconst [toLow, toHigh] = rangeB\n\n\tconst fromDelta = fromHigh - fromLow\n\tif (fromDelta === 0) return (toHigh + toLow) / 2\n\tconst toDelta = toHigh - toLow\n\tif (toDelta === 0) return toLow\n\n\tconst result = toLow + ((value - fromLow) / fromDelta) * toDelta\n\tif (limit === true) {\n\t\tif (toLow < toHigh) {\n\t\t\tif (result < toLow) {\n\t\t\t\treturn toLow\n\t\t\t}\n\t\t\tif (result > toHigh) {\n\t\t\t\treturn toHigh\n\t\t\t}\n\t\t} else {\n\t\t\tif (result > toLow) {\n\t\t\t\treturn toLow\n\t\t\t}\n\t\t\tif (result < toHigh) {\n\t\t\t\treturn toHigh\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}\n\nexport function isNumeric(value: number): boolean {\n\treturn !Number.isNaN(value) && Number.isFinite(value)\n}\n\nexport function percentToFraction(val: string): number {\n\tconst digits = numberFromString(val)\n\tif (digits !== undefined) {\n\t\tif (val.includes(\"%\")) {\n\t\t\treturn digits / 100\n\t\t}\n\t\treturn digits\n\t}\n\treturn 0\n}\nexport function numberFromString(input: string): number | undefined {\n\t// eslint-disable-next-line redos-detector/no-unsafe-regex -- safe but matches a lot of things\n\tconst match = /\\d?\\.?\\d+/u.exec(input)\n\treturn match ? Number(match[0]) : undefined\n}\n", "// Used for inspection\n/** @public */\nexport enum ColorFormat {\n\tRGB = \"rgb\",\n\tHSL = \"hsl\",\n\tHSV = \"hsv\",\n\tHEX = \"hex\",\n\tNAME = \"name\",\n}\n\nexport interface ColorRGB {\n\tr: number\n\tg: number\n\tb: number\n}\n\n/** @public */\nexport type ColorRGBA = ColorRGB & {\n\ta: number\n}\n\n/** @public */\nexport type ColorTypeRGBA = ColorRGBA & {\n\tformat: ColorFormat\n}\n\n/** @public */\nexport interface ColorHSL {\n\th: number\n\ts: number\n\tl: number\n}\n\n/** @public */\nexport type ColorHSLA = ColorHSL & {\n\ta: number\n}\n\nexport type ColorTypeHSLA = ColorHSLA & {\n\tformat: ColorFormat\n}\n\n/** @public */\nexport interface ColorHSV {\n\th: number\n\ts: number\n\tv: number\n}\n\n/** @public */\nexport type ColorHSVA = ColorHSV & {\n\ta: number\n}\n\nexport type ColorTypeHSVA = ColorHSVA & {\n\tformat: ColorFormat\n}\n\nexport interface CompleteColor {\n\tformat: ColorFormat\n\tr: number\n\tg: number\n\tb: number\n\th: number\n\ts: number\n\tl: number\n\ta: number\n}\n\n/** @public */\nexport type IncomingColor = ColorRGB | ColorHSL | ColorRGBA | ColorHSLA | string\n\n/**\n * Various Color functions, such as {@link (Color:namespace).mix} and {@link\n * (Color:namespace).interpolate}, take an optional color model that\n * determines how two colors are mixed together.\n *\n * @remarks\n *\n * ```javascript\n * const newColor = Color.mix(Color(\"red\"), Color(\"blue\"), {model: ColorMixModelType.HSL})\n * ```\n *\n * @public\n */\nexport enum ColorMixModelType {\n\t/**\n\t * Use the {@link https://en.wikipedia.org/wiki/RGB_color_model | RGB color space} without an alpha value\n\t *\n\t * @remarks\n\t *\n\t * ```javascript\n\t * const newColor = Color.mix(Color(\"red\"), Color(\"blue\"), {model: ColorMixModelType.RGB})\n\t * ```\n\t *\n\t * @public\n\t */\n\tRGB = \"rgb\",\n\t/**\n\t * Use the {@link https://en.wikipedia.org/wiki/RGB_color_model | RGB color space} color space with an alpha value\n\t *\n\t * @remarks\n\t *\n\t * ```javascript\n\t * const newColor = Color.mix(Color(\"red\"), Color(\"blue\"), {model: ColorMixModelType.RGBA})\n\t * ```\n\t *\n\t * @public\n\t */\n\tRGBA = \"rgba\",\n\t/**\n\t * Use the {@link https://en.wikipedia.org/wiki/HSL_and_HSV | HSL} color space with an alpha value\n\t *\n\t * @remarks\n\t *\n\t * ```javascript\n\t * const newColor = Color.mix(Color(\"red\"), Color(\"blue\"), {model: ColorMixModelType.HSL})\n\t * ```\n\t *\n\t * @public\n\t */\n\tHSL = \"hsl\",\n\t/**\n\t * Use the {@link https://en.wikipedia.org/wiki/HSL_and_HSV | HSL} color space with an alpha value\n\t *\n\t * @remarks\n\t *\n\t * ```javascript\n\t * const newColor = Color.mix(Color(\"red\"), Color(\"blue\"), {model: ColorMixModelType.HSLA})\n\t * ```\n\t *\n\t * @public\n\t */\n\tHSLA = \"hsla\",\n\t/**\n\t * Use the {@link http://www.hsluv.org | HSLuv } human friendly color model\n\t *\n\t * @remarks\n\t *\n\t * ```javascript\n\t * const newColor = Color.mix(Color(\"red\"), Color(\"blue\"), {model: ColorMixModelType.HUSL})\n\t * ```\n\t *\n\t * @public\n\t */\n\tHUSL = \"husl\",\n}\n", "import { cssNames } from \"./CSSNames.ts\"\nimport { isNumeric, percentToFraction } from \"./Utils.ts\"\n/* eslint-disable regexp/no-useless-non-capturing-group */\n/* eslint-disable regexp/no-useless-escape */\nimport type { ColorHSL, ColorHSV, ColorRGB, ColorRGBA, ColorTypeHSLA, ColorTypeHSVA, ColorTypeRGBA } from \"./types.ts\"\nimport { ColorFormat } from \"./types.ts\"\n\n// Importing using `/* @__PURE__ */ require()` so that Hsluv can be tree-shaken properly.\nconst Hsluv: typeof import(\"hsluv\").Hsluv = /* @__PURE__ */ (() => require(\"hsluv\").Hsluv)()\n\nconst hsluvConverter = /* @__PURE__ */ new Hsluv()\n\nexport function rgbToHsluv(r: number, g: number, b: number): ColorHSL {\n\thsluvConverter.rgb_r = r / 255\n\thsluvConverter.rgb_g = g / 255\n\thsluvConverter.rgb_b = b / 255\n\thsluvConverter.rgbToHsluv()\n\treturn {\n\t\th: hsluvConverter.hsluv_h,\n\t\ts: hsluvConverter.hsluv_s,\n\t\tl: hsluvConverter.hsluv_l,\n\t}\n}\n\nexport function rgbaFromHusl(h: number, s: number, l: number, a = 1): ColorRGBA {\n\thsluvConverter.hsluv_h = h\n\thsluvConverter.hsluv_s = s\n\thsluvConverter.hsluv_l = l\n\thsluvConverter.hsluvToRgb()\n\treturn {\n\t\tr: hsluvConverter.rgb_r * 255,\n\t\tg: hsluvConverter.rgb_g * 255,\n\t\tb: hsluvConverter.rgb_b * 255,\n\t\ta: a,\n\t}\n}\nexport function hsvToStr(h: number, s: number, v: number, a?: number): string {\n\tconst _h = Math.round(h)\n\tconst _s = Math.round(s * 100)\n\tconst _v = Math.round(v * 100)\n\n\treturn a === undefined || a === 1\n\t\t? \"hsv(\" + _h + \", \" + _s + \"%, \" + _v + \"%)\"\n\t\t: \"hsva(\" + _h + \", \" + _s + \"%, \" + _v + \"%, \" + a + \")\"\n}\n\nexport function rgbToRgb(r: number, g: number, b: number): ColorRGB {\n\treturn {\n\t\tr: isNumeric(r) ? bound01(r, 255) * 255 : 0,\n\t\tg: isNumeric(g) ? bound01(g, 255) * 255 : 0,\n\t\tb: isNumeric(b) ? bound01(b, 255) * 255 : 0,\n\t}\n}\n\nexport function rgbToHex(r: number, g: number, b: number, allow3Char: boolean): string {\n\tconst hex: [string, string, string] = [\n\t\tpad2(Math.round(r).toString(16)),\n\t\tpad2(Math.round(g).toString(16)),\n\t\tpad2(Math.round(b).toString(16)),\n\t]\n\tif (\n\t\tallow3Char &&\n\t\thex[0].charAt(0) === hex[0].charAt(1) &&\n\t\thex[1].charAt(0) === hex[1].charAt(1) &&\n\t\thex[2].charAt(0) === hex[2].charAt(1)\n\t) {\n\t\treturn hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0)\n\t}\n\treturn hex.join(\"\")\n}\n\nexport function rgbToHsl(r: number | string, g: number | string, b: number | string): ColorHSL {\n\tlet l: number\n\tlet s: number\n\tconst _r: number = bound01(r, 255)\n\tconst _g: number = bound01(g, 255)\n\tconst _b: number = bound01(b, 255)\n\n\tconst max = Math.max(_r, _g, _b)\n\tconst min = Math.min(_r, _g, _b)\n\tlet h = (s = l = (max + min) / 2)\n\n\tif (max === min) {\n\t\th = s = 0\n\t} else {\n\t\tconst d = max - min\n\t\ts = l > 0.5 ? d / (2 - max - min) : d / (max + min)\n\t\tswitch (max) {\n\t\t\tcase _r:\n\t\t\t\th = (_g - _b) / d + (_g < _b ? 6 : 0)\n\t\t\t\tbreak\n\t\t\tcase _g:\n\t\t\t\th = (_b - _r) / d + 2\n\t\t\t\tbreak\n\t\t\tcase _b:\n\t\t\t\th = (_r - _g) / d + 4\n\t\t\t\tbreak\n\t\t}\n\t\th /= 6\n\t}\n\treturn { h: h * 360, s, l }\n}\n\nfunction hue2rgb(p: number, q: number, t: number): number {\n\tif (t < 0) {\n\t\tt += 1\n\t}\n\tif (t > 1) {\n\t\tt -= 1\n\t}\n\tif (t < 1 / 6) {\n\t\treturn p + (q - p) * 6 * t\n\t}\n\tif (t < 1 / 2) {\n\t\treturn q\n\t}\n\tif (t < 2 / 3) {\n\t\treturn p + (q - p) * (2 / 3 - t) * 6\n\t}\n\treturn p\n}\n\n// HSL to RGB\nexport function hslToRgb(h: number, s: number, l: number): ColorRGB {\n\tlet r: number\n\tlet g: number\n\tlet b: number\n\n\th = bound01(h, 360)\n\ts = bound01(s * 100, 100)\n\tl = bound01(l * 100, 100)\n\n\tif (s === 0) {\n\t\tr = g = b = l // Achromatic\n\t} else {\n\t\tconst q = l < 0.5 ? l * (1 + s) : l + s - l * s\n\t\tconst p = 2 * l - q\n\t\tr = hue2rgb(p, q, h + 1 / 3)\n\t\tg = hue2rgb(p, q, h)\n\t\tb = hue2rgb(p, q, h - 1 / 3)\n\t}\n\n\treturn { r: r * 255, g: g * 255, b: b * 255 }\n}\n\nexport function rgbToHsv(r: number, g: number, b: number): ColorHSV {\n\tr = bound01(r, 255)\n\tg = bound01(g, 255)\n\tb = bound01(b, 255)\n\n\tconst max = Math.max(r, g, b)\n\tconst min = Math.min(r, g, b)\n\tconst d = max - min\n\tlet h = 0\n\tconst s: number = max === 0 ? 0 : d / max\n\tconst v: number = max\n\n\tif (max === min) {\n\t\th = 0 // achromatic\n\t} else {\n\t\tswitch (max) {\n\t\t\tcase r:\n\t\t\t\th = (g - b) / d + (g < b ? 6 : 0)\n\t\t\t\tbreak\n\t\t\tcase g:\n\t\t\t\th = (b - r) / d + 2\n\t\t\t\tbreak\n\t\t\tcase b:\n\t\t\t\th = (r - g) / d + 4\n\t\t\t\tbreak\n\t\t}\n\t\th /= 6\n\t}\n\treturn { h, s, v }\n}\n\nexport function hsvToRgb(h: number, s: number, v: number): ColorRGB {\n\th = bound01(h, 360) * 6\n\ts = bound01(s * 100, 100)\n\tv = bound01(v * 100, 100)\n\n\tconst i = Math.floor(h)\n\tconst f = h - i\n\tconst p = v * (1 - s)\n\tconst q = v * (1 - f * s)\n\tconst t = v * (1 - (1 - f) * s)\n\tconst mod = i % 6\n\tconst r = [v, q, p, p, t, v][mod]\n\tconst g = [t, v, v, q, p, p][mod]\n\tconst b = [p, p, t, v, v, q][mod]\n\n\t// @ts-ignore: Suppress the noUncheckedIndexedAccess error on this line. The\n\t// modulo result should range from 0~5, so cannot go out of bound of the\n\t// array.\n\treturn { r: r * 255, g: g * 255, b: b * 255 }\n}\n\nfunction bound01(n: number | string, max: number | string): number {\n\tlet _max: number\n\tlet _n: number\n\tif (typeof max === \"string\") _max = parseFloat(max)\n\telse _max = max\n\n\tif (typeof n === \"string\") {\n\t\tif (isOnePointZero(n)) {\n\t\t\tn = \"100%\"\n\t\t}\n\t\tconst processPercent = isPercentage(n)\n\t\t_n = Math.min(_max, Math.max(0, parseFloat(n)))\n\n\t\t// Automatically convert percentage into number\n\t\tif (processPercent) {\n\t\t\t_n = Math.floor(_n * _max) / 100\n\t\t}\n\t} else {\n\t\t_n = n\n\t}\n\t// Handle floating point rounding errors\n\tif (Math.abs(_n - _max) < 0.000001) {\n\t\treturn 1\n\t}\n\t// Convert into [0, 1] range if it isn't already\n\treturn (_n % _max) / _max\n}\n\nfunction isOnePointZero(n: string | number) {\n\treturn typeof n === \"string\" && n.includes(\".\") && parseFloat(n) === 1\n}\n\nfunction isPercentage(n: string | number) {\n\treturn typeof n === \"string\" && n.includes(\"%\")\n}\n\nfunction pad2(char: string) {\n\tif (char.length === 1) {\n\t\treturn \"0\" + char\n\t} else {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-conversion -- creates a new string slice\n\t\treturn \"\" + char\n\t}\n}\n\nconst matchers = /* @__PURE__ */ (() => {\n\tconst cssInteger = \"[-\\\\+]?\\\\d+%?\"\n\tconst cssNumber = \"[-\\\\+]?\\\\d*\\\\.\\\\d+%?\"\n\tconst cssUnit = \"(?:\" + cssNumber + \")|(?:\" + cssInteger + \")\"\n\tconst permissiveMatch3 = \"[\\\\s|\\\\(]+(\" + cssUnit + \")[,|\\\\s]+(\" + cssUnit + \")[,|\\\\s]+(\" + cssUnit + \")\\\\s*\\\\)?\"\n\tconst permissiveMatch4 =\n\t\t\"[\\\\s|\\\\(]+(\" + cssUnit + \")[,|\\\\s]+(\" + cssUnit + \")[,|\\\\s]+(\" + cssUnit + \")[,|\\\\s]+(\" + cssUnit + \")\\\\s*\\\\)?\"\n\treturn {\n\t\trgb: new RegExp(\"rgb\" + permissiveMatch3),\n\t\trgba: new RegExp(\"rgba\" + permissiveMatch4),\n\t\thsl: new RegExp(\"hsl\" + permissiveMatch3),\n\t\thsla: new RegExp(\"hsla\" + permissiveMatch4),\n\t\thsv: new RegExp(\"hsv\" + permissiveMatch3),\n\t\thsva: new RegExp(\"hsva\" + permissiveMatch4),\n\t\thex3: /^([\\da-f])([\\da-f])([\\da-f])$/iu,\n\t\thex6: /^([\\da-f]{2})([\\da-f]{2})([\\da-f]{2})$/iu,\n\t\thex4: /^#?([\\da-f])([\\da-f])([\\da-f])([\\da-f])$/iu,\n\t\thex8: /^#?([\\da-f]{2})([\\da-f]{2})([\\da-f]{2})([\\da-f]{2})$/iu,\n\t}\n})()\n\nexport function stringToObject(inputColor: string): ColorTypeRGBA | ColorTypeHSLA | ColorTypeHSVA | false {\n\t// Early return for gradients\n\tif (inputColor.includes(\"gradient(\")) return false\n\n\t// Early return for variables\n\tif (inputColor.includes(\"var(\")) return false\n\n\tconst trimLeft = /^[\\s,#]+/u\n\n\tlet color = inputColor.replace(trimLeft, \"\").trimEnd().toLowerCase()\n\tconst namedColor = cssNames[color]\n\tif (namedColor) {\n\t\tcolor = namedColor\n\t}\n\tif (color === \"transparent\") {\n\t\treturn {\n\t\t\tr: 0,\n\t\t\tg: 0,\n\t\t\tb: 0,\n\t\t\ta: 0,\n\t\t\tformat: ColorFormat.NAME,\n\t\t}\n\t}\n\tlet match\n\tif ((match = matchers.rgb.exec(color))) {\n\t\treturn {\n\t\t\tr: parseInt(match[1] ?? \"\"),\n\t\t\tg: parseInt(match[2] ?? \"\"),\n\t\t\tb: parseInt(match[3] ?? \"\"),\n\t\t\ta: 1,\n\t\t\tformat: ColorFormat.RGB,\n\t\t} as ColorTypeRGBA\n\t}\n\tif ((match = matchers.rgba.exec(color))) {\n\t\treturn {\n\t\t\tr: parseInt(match[1] ?? \"\"),\n\t\t\tg: parseInt(match[2] ?? \"\"),\n\t\t\tb: parseInt(match[3] ?? \"\"),\n\t\t\ta: parseFloat(match[4] ?? \"\"),\n\t\t\tformat: ColorFormat.RGB,\n\t\t} as ColorTypeRGBA\n\t}\n\tif ((match = matchers.hsl.exec(color))) {\n\t\treturn {\n\t\t\th: parseInt(match[1] ?? \"\"),\n\t\t\ts: percentToFraction(match[2] ?? \"\"),\n\t\t\tl: percentToFraction(match[3] ?? \"\"),\n\t\t\ta: 1,\n\t\t\tformat: ColorFormat.HSL,\n\t\t} as ColorTypeHSLA\n\t}\n\tif ((match = matchers.hsla.exec(color))) {\n\t\treturn {\n\t\t\th: parseInt(match[1] ?? \"\"),\n\t\t\ts: percentToFraction(match[2] ?? \"\"),\n\t\t\tl: percentToFraction(match[3] ?? \"\"),\n\t\t\ta: parseFloat(match[4] ?? \"\"),\n\t\t\tformat: ColorFormat.HSL,\n\t\t} as ColorTypeHSLA\n\t}\n\tif ((match = matchers.hsv.exec(color))) {\n\t\treturn {\n\t\t\th: parseInt(match[1] ?? \"\"),\n\t\t\ts: percentToFraction(match[2] ?? \"\"),\n\t\t\tv: percentToFraction(match[3] ?? \"\"),\n\t\t\ta: 1,\n\t\t\tformat: ColorFormat.HSV,\n\t\t} as ColorTypeHSVA\n\t}\n\tif ((match = matchers.hsva.exec(color))) {\n\t\treturn {\n\t\t\th: parseInt(match[1] ?? \"\"),\n\t\t\ts: percentToFraction(match[2] ?? \"\"),\n\t\t\tv: percentToFraction(match[3] ?? \"\"),\n\t\t\ta: parseFloat(match[4] ?? \"\"),\n\t\t\tformat: ColorFormat.HSV,\n\t\t} as ColorTypeHSVA\n\t}\n\tif ((match = matchers.hex8.exec(color))) {\n\t\treturn {\n\t\t\tr: parseIntFromHex(match[1] ?? \"\"),\n\t\t\tg: parseIntFromHex(match[2] ?? \"\"),\n\t\t\tb: parseIntFromHex(match[3] ?? \"\"),\n\t\t\ta: convertHexToDecimal(match[4] ?? \"\"),\n\t\t\tformat: namedColor ? ColorFormat.NAME : ColorFormat.HEX,\n\t\t} as ColorTypeRGBA\n\t}\n\tif ((match = matchers.hex6.exec(color))) {\n\t\treturn {\n\t\t\tr: parseIntFromHex(match[1] ?? \"\"),\n\t\t\tg: parseIntFromHex(match[2] ?? \"\"),\n\t\t\tb: parseIntFromHex(match[3] ?? \"\"),\n\t\t\ta: 1,\n\t\t\tformat: namedColor ? ColorFormat.NAME : ColorFormat.HEX,\n\t\t} as ColorTypeRGBA\n\t}\n\tif ((match = matchers.hex4.exec(color))) {\n\t\treturn {\n\t\t\tr: parseIntFromHex(`${match[1]}${match[1]}`),\n\t\t\tg: parseIntFromHex(`${match[2]}${match[2]}`),\n\t\t\tb: parseIntFromHex(`${match[3]}${match[3]}`),\n\t\t\ta: convertHexToDecimal(match[4] + \"\" + match[4]),\n\t\t\tformat: namedColor ? ColorFormat.NAME : ColorFormat.HEX,\n\t\t} as ColorTypeRGBA\n\t}\n\tif ((match = matchers.hex3.exec(color))) {\n\t\treturn {\n\t\t\tr: parseIntFromHex(`${match[1]}${match[1]}`),\n\t\t\tg: parseIntFromHex(`${match[2]}${match[2]}`),\n\t\t\tb: parseIntFromHex(`${match[3]}${match[3]}`),\n\t\t\ta: 1,\n\t\t\tformat: namedColor ? ColorFormat.NAME : ColorFormat.HEX,\n\t\t} as ColorTypeRGBA\n\t} else {\n\t\treturn false\n\t}\n}\n\nfunction parseIntFromHex(hex: string): number {\n\treturn parseInt(hex, 16)\n}\n\nfunction convertHexToDecimal(h: string): number {\n\treturn parseIntFromHex(h) / 255\n}\n", "import type { ColorHSVA, ColorRGBA } from \"./types.ts\"\n\nconst p3Matcher =\n\t/^color\\(display-p3\\s+(?<r>\\d+\\.\\d+|\\d+|\\.\\d+)\\s+(?<g>\\d+\\.\\d+|\\d+|\\.\\d+)\\s+(?<b>\\d+\\.\\d+|\\d+|\\.\\d+)(?:\\s*\\/\\s*(?<a>\\d+\\.\\d+|\\d+|\\.\\d+))?\\)$/u\n\nexport function parseP3(color: string) {\n\tconst match = p3Matcher.exec(color)\n\tif (!match) return null\n\n\tconst { r = \"0\", g = \"0\", b = \"0\", a } = match.groups ?? {}\n\n\treturn {\n\t\tr: parseFloat(r),\n\t\tg: parseFloat(g),\n\t\tb: parseFloat(b),\n\t\ta: a ? parseFloat(a) : 1,\n\t}\n}\n\nfunction convertRGBChannelToLrgb(c = 0) {\n\tconst abs = Math.abs(c)\n\tif (abs <= 0.04045) return c / 12.92\n\treturn (Math.sign(c) || 1) * ((abs + 0.055) / 1.055) ** 2.4\n}\n\n/**\n * https://github.com/Evercoder/culori/blob/main/src/lrgb/convertLrgbToRgb.js\n */\nfunction convertRgbToLrgb({ r, g, b, a }: ColorRGBA) {\n\treturn {\n\t\tr: convertRGBChannelToLrgb(r),\n\t\tg: convertRGBChannelToLrgb(g),\n\t\tb: convertRGBChannelToLrgb(b),\n\t\ta,\n\t}\n}\n\nfunction convertLrgbChannelToRgb(c = 0) {\n\tconst abs = Math.abs(c)\n\tif (abs > 0.0031308) return (Math.sign(c) || 1) * (1.055 * abs ** (1 / 2.4) - 0.055)\n\treturn c * 12.92\n}\n\n/**\n * https://github.com/Evercoder/culori/blob/main/src/lrgb/convertRgbToLrgb.js\n */\nfunction convertLrgbToRgb({ r, g, b, a }: ColorRGBA) {\n\treturn {\n\t\tr: convertLrgbChannelToRgb(r),\n\t\tg: convertLrgbChannelToRgb(g),\n\t\tb: convertLrgbChannelToRgb(b),\n\t\ta,\n\t}\n}\n\ninterface XYZ65 {\n\tx: number\n\ty: number\n\tz: number\n\ta?: number\n}\n\n/**\n * https://github.com/Evercoder/culori/blob/main/src/p3/convertP3ToXyz65.js\n *\n * References:\n * https://drafts.csswg.org/css-color/#color-conversion-code\n * http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html\n */\nconst convertP3ToXyz65 = (color: ColorRGBA): XYZ65 => {\n\tconst { r, g, b, a } = convertRgbToLrgb(color)\n\treturn {\n\t\tx: 0.486570948648216 * r + 0.265667693169093 * g + 0.1982172852343625 * b,\n\t\ty: 0.2289745640697487 * r + 0.6917385218365062 * g + 0.079286914093745 * b,\n\t\tz: 0.0 * r + 0.0451133818589026 * g + 1.043944368900976 * b,\n\t\ta,\n\t}\n}\n\n/**\n * https://github.com/Evercoder/culori/blob/main/src/xyz65/convertXyz65ToRgb.js\n *\n * References:\n * https://drafts.csswg.org/css-color/#color-conversion-code\n * http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html\n * https://observablehq.com/@danburzo/color-matrix-calculator\n */\nconst convertXyz65ToRgb = ({ x = 0, y = 0, z = 0, a = 1 }: XYZ65) => {\n\treturn convertLrgbToRgb({\n\t\tr: x * 3.2409699419045226 - y * 1.5373831775700939 - 0.4986107602930034 * z,\n\t\tg: x * -0.9692436362808796 + y * 1.8759675015077204 + 0.0415550574071756 * z,\n\t\tb: x * 0.0556300796969936 - y * 0.2039769588889765 + 1.0569715142428784 * z,\n\t\ta,\n\t})\n}\n\n/**\n * https://github.com/Evercoder/culori/blob/main/src/xyz65/convertRgbToXyz65.js#L12\n *\n * References:\n * https://drafts.csswg.org/css-color/#color-conversion-code\n * http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html\n * https://observablehq.com/@danburzo/color-matrix-calculator\n */\nconst convertRgbToXyz65 = (color: ColorRGBA) => {\n\tconst { r, g, b, a } = convertRgbToLrgb(color)\n\treturn {\n\t\tx: 0.4123907992659593 * r + 0.357584339383878 * g + 0.1804807884018343 * b,\n\t\ty: 0.2126390058715102 * r + 0.715168678767756 * g + 0.0721923153607337 * b,\n\t\tz: 0.0193308187155918 * r + 0.119194779794626 * g + 0.9505321522496607 * b,\n\t\ta,\n\t}\n}\n\n/**\n * https://github.com/Evercoder/culori/blob/main/src/p3/convertXyz65ToP3.js\n *\n * References:\n * https://drafts.csswg.org/css-color/#color-conversion-code\n * http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html\n */\nconst convertXyz65ToP3 = ({ x = 0, y = 0, z = 0, a = 1 }: XYZ65) => {\n\treturn convertLrgbToRgb({\n\t\tr: x * 2.4934969119414263 - y * 0.9313836179191242 - 0.402710784450717 * z,\n\t\tg: x * -0.8294889695615749 + y * 1.7626640603183465 + 0.0236246858419436 * z,\n\t\tb: x * 0.0358458302437845 - y * 0.0761723892680418 + 0.9568845240076871 * z,\n\t\ta,\n\t})\n}\n\n/**\n * https://github.com/Evercoder/culori/blob/main/src/hsv/convertRgbToHsv.js\n *\n * Based on: https://en.wikipedia.org/wiki/HSL_and_HSV#Formal_derivation\n */\nexport function convertRGBToHSV({ r, g, b, a }: ColorRGBA): ColorHSVA {\n\tconst M = Math.max(r, g, b),\n\t\tm = Math.min(r, g, b)\n\tconst res: ColorHSVA = {\n\t\th: 0,\n\t\ts: M === 0 ? 0 : 1 - m / M,\n\t\tv: M,\n\t\ta,\n\t}\n\tif (M - m !== 0) {\n\t\tres.h =\n\t\t\t(M === r ? (g - b) / (M - m) + (g < b ? 6 : 0) : M === g ? (b - r) / (M - m) + 2 : (r - g) / (M - m) + 4) * 60\n\t}\n\treturn res\n}\n\nfunction normalizeHue(hue: number) {\n\treturn (hue = hue % 360) < 0 ? hue + 360 : hue\n}\n\n/**\n * https://github.com/Evercoder/culori/blob/main/src/hsv/convertHsvToRgb.js\n *\n * Based on: https://en.wikipedia.org/wiki/HSL_and_HSV#Converting_to_RGB\n */\nexport function convertHsvToRgb({ h = 0, s = 0, v = 0, a = 1 }: ColorHSVA) {\n\tconst hue = normalizeHue(h)\n\tconst f = Math.abs(((hue / 60) % 2) - 1)\n\tswitch (Math.floor(hue / 60)) {\n\t\tcase 0:\n\t\t\treturn { r: v, g: v * (1 - s * f), b: v * (1 - s), a }\n\t\tcase 1:\n\t\t\treturn { r: v * (1 - s * f), g: v, b: v * (1 - s), a }\n\t\tcase 2:\n\t\t\treturn { r: v * (1 - s), g: v, b: v * (1 - s * f), a }\n\t\tcase 3:\n\t\t\treturn { r: v * (1 - s), g: v * (1 - s * f), b: v, a }\n\t\tcase 4:\n\t\t\treturn { r: v * (1 - s * f), g: v * (1 - s), b: v, a }\n\t\tcase 5:\n\t\t\treturn { r: v, g: v * (1 - s), b: v * (1 - s * f), a }\n\t\tdefault:\n\t\t\treturn { r: v * (1 - s), g: v * (1 - s), b: v * (1 - s), a }\n\t}\n}\n\nexport function convertRgbToP3(color: ColorRGBA): ColorRGBA {\n\treturn convertXyz65ToP3(convertRgbToXyz65(color))\n}\n\nexport function convertP3ToRgb(color: ColorRGBA): ColorRGBA {\n\treturn convertXyz65ToRgb(convertP3ToXyz65(color))\n}\n", "import { interpolate } from \"framer-motion\"\nimport { isObject, isString } from \"../../../utils/utils.ts\"\nimport { cssNames } from \"./CSSNames.ts\"\nimport { isNumeric, modulate, numberFromString } from \"./Utils.ts\"\nimport {\n\thslToRgb,\n\thsvToRgb,\n\trgbToHex,\n\trgbToHsl,\n\trgbToHsl as rgbToHslConverter,\n\trgbToHsluv,\n\trgbToHsv,\n\trgbToRgb,\n\trgbaFromHusl,\n\tstringToObject,\n} from \"./converters.ts\"\nimport { convertHsvToRgb, convertP3ToRgb, convertRGBToHSV, convertRgbToP3, parseP3 } from \"./p3.ts\"\nimport type { ColorHSL, ColorHSLA, ColorHSVA, ColorRGB, ColorRGBA, CompleteColor, IncomingColor } from \"./types.ts\"\nimport { ColorFormat, ColorMixModelType } from \"./types.ts\"\n\n/** @public */\nexport interface ColorMixOptions {\n\tmodel?: ColorMixModelType\n}\n\n/**\n * P3 colors use a different sspace than srgb\n *\n * @TODO - Parse colors to 0-1 ranges, and use this class with the format.\n */\nexport class P3Color {\n\tformat = \"p3\" as const\n\tr: number\n\tg: number\n\tb: number\n\ta: number\n\n\tconstructor(color: ColorRGBA) {\n\t\tthis.r = color.r ?? 0\n\t\tthis.g = color.g ?? 0\n\t\tthis.b = color.b ?? 0\n\t\tthis.a = color.a ?? 1\n\t}\n\n\thsv(): ColorHSVA {\n\t\treturn convertRGBToHSV(this)\n\t}\n\n\trgb(): ColorRGBA {\n\t\treturn convertP3ToRgb(this)\n\t}\n\n\thsl(): ColorHSL {\n\t\treturn rgbToHsl(this.r, this.g, this.b)\n\t}\n\n\ttoString(space: \"p3\" | \"srgb\" = \"p3\", overrides?: Partial<ColorRGBA>): string {\n\t\tswitch (space) {\n\t\t\tcase \"p3\": {\n\t\t\t\tconst r = overrides?.r ?? this.r\n\t\t\t\tconst g = overrides?.g ?? this.g\n\t\t\t\tconst b = overrides?.b ?? this.b\n\t\t\t\tconst a = overrides?.a ?? this.a\n\n\t\t\t\treturn a === 1 ? `color(display-p3 ${r} ${g} ${b})` : `color(display-p3 ${r} ${g} ${b} / ${a})`\n\t\t\t}\n\t\t\tcase \"srgb\": {\n\t\t\t\tconst color = this.rgb()\n\t\t\t\tconst clampedR = Math.round(Math.max(0, Math.min(color.r, 1)) * 100) / 100\n\t\t\t\tconst clampedG = Math.round(Math.max(0, Math.min(color.g, 1)) * 100) / 100\n\t\t\t\tconst clampedB = Math.round(Math.max(0, Math.min(color.b, 1)) * 100) / 100\n\n\t\t\t\tconst r = overrides?.r ?? clampedR * 255\n\t\t\t\tconst g = overrides?.g ?? clampedG * 255\n\t\t\t\tconst b = overrides?.b ?? clampedB * 255\n\t\t\t\tconst a = overrides?.a ?? color.a ?? 1\n\n\t\t\t\treturn a === 1 ? `rgb(${r}, ${g}, ${b})` : `rgba(${r}, ${g}, ${b}, ${a})`\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic isP3String(color: string): boolean {\n\t\treturn color.startsWith(\"color(display-p3\")\n\t}\n\n\tstatic fromHSV(color: ColorHSVA, space: \"p3\" | \"srgb\" = \"p3\"): P3Color {\n\t\t// Imagine the HSV Color is in the P3 color space, so create a P3 color from its RGB\n\t\t// channels.\n\t\tswitch (space) {\n\t\t\tcase \"p3\":\n\t\t\t\treturn new P3Color(convertHsvToRgb(color))\n\t\t\tcase \"srgb\":\n\t\t\t\treturn new P3Color(convertRgbToP3(convertHsvToRgb(color)))\n\t\t}\n\t}\n\n\tstatic fromRGB(color: ColorRGBA): P3Color {\n\t\treturn new P3Color(\n\t\t\tconvertRgbToP3({\n\t\t\t\t// Converted an rgb value between 0-255 to a 0-1 decimal with 5 decimal places -> 0.78607.\n\t\t\t\tr: Math.round((color.r / 255) * 10_000) / 10_000,\n\t\t\t\tg: Math.round((color.g / 255) * 10_000) / 10_000,\n\t\t\t\tb: Math.round((color.b / 255) * 10_000) / 10_000,\n\t\t\t\ta: color.a ?? 1,\n\t\t\t}),\n\t\t)\n\t}\n\n\tstatic fromRGBString(color: string): P3Color | undefined {\n\t\tconst value = Color(color)\n\t\tif (!value) return undefined\n\t\treturn P3Color.fromRGB(value)\n\t}\n\n\tstatic fromString(color: string): P3Color | undefined {\n\t\tif (!P3Color.isP3String(color)) return undefined\n\t\tconst parsed = parseP3(color)\n\t\tif (!parsed) return undefined\n\t\treturn new P3Color({ r: parsed.r, g: parsed.g, b: parsed.b, a: parsed.a })\n\t}\n\n\tstatic srgbFromValue<T>(color: T): T | string {\n\t\tif (!isString(color) || !Color.isP3String(color)) return color\n\t\tconst value = P3Color.fromString(color)\n\t\tif (!value) return color\n\t\treturn value.toString(\"srgb\")\n\t}\n\n\tstatic multiplyAlpha(color: P3Color, alpha: number): P3Color {\n\t\treturn new P3Color({\n\t\t\tr: color.r,\n\t\t\tg: color.g,\n\t\t\tb: color.b,\n\t\t\ta: color.a * alpha,\n\t\t})\n\t}\n}\n\nexport function clampRGB<T>(color: T): T | string {\n\treturn P3Color.srgbFromValue(color)\n}\n\ntype Mixer = (from: string | Color, toColor: Color, options?: ColorMixOptions) => (p: number) => string\ntype MixerStateful = (toColor: Color, options?: ColorMixOptions) => (p: number) => string\n\n/**\n * @public\n */\nexport interface Color {\n\tr: number\n\tg: number\n\tb: number\n\th: number\n\ts: number\n\tl: number\n\ta: number\n\troundA: number\n\tformat: ColorFormat\n\tinitialValue?: string\n\tisValid?: boolean\n\tmix: Mixer | MixerStateful\n\ttoValue: () => string\n}\n\nconst cache = new Map<string, Color>()\n\n/**\n * The Color function can be used to define colors, either as a string value or as an object. All colors\n * are converted to a Color object with `r, g, b`, `h, s, l` and an `a` value.\n * There are also various helpers on the Color function for working with,\n * modifying and detecting colors.\n *\n * ```jsx\n * // HEX\n * const blue = Color(\"#0099FF\")\n *\n * // RGB\n * const blue = Color(\"rgb(0, 153, 255)\")\n * const blue = Color(0, 153, 255)\n * const blue = Color({r: 0, g: 153, b: 255})\n * const blue = Color({r: 0, g: 153, b: 255, a: 1})\n *\n * // HSL\n * const blue = Color(\"hsl(204, 100%, 50%)\")\n * const blue = Color({h: 204, s: 1, l: 0.5})\n * const blue = Color({h: 204, s: 1, l: 0.5, a: 1})\n * ```\n * @public\n */\nexport const Color = /* @__PURE__ */ (() => {\n\t/**\n\t * @public\n\t */\n\tfunction Color(color: IncomingColor | Color | number, r?: number, g?: number, b?: number): Color {\n\t\tif (typeof color === \"string\") {\n\t\t\tlet c = cache.get(color)\n\t\t\tif (c) return c\n\n\t\t\tc = createColor(color)\n\n\t\t\tif (c === undefined) return { ...Color(\"black\"), isValid: false }\n\t\t\tcache.set(color, c) // TODO: should be frozen?\n\t\t\treturn c\n\t\t}\n\t\tconst created = createColor(color, r, g, b)\n\t\treturn created !== undefined ? created : { ...Color(\"black\"), isValid: false }\n\t}\n\n\tfunction createColor(color: IncomingColor | Color | number, r?: number, g?: number, b?: number): Color | undefined {\n\t\tif (color === \"\") return undefined\n\t\tconst colorData = getCompleteColorStrategy(color, r, g, b)\n\n\t\tif (colorData) {\n\t\t\tconst newColor: Color = {\n\t\t\t\tr: colorData.r,\n\t\t\t\tg: colorData.g,\n\t\t\t\tb: colorData.b,\n\t\t\t\ta: colorData.a,\n\t\t\t\th: colorData.h,\n\t\t\t\ts: colorData.s,\n\t\t\t\tl: colorData.l,\n\t\t\t\tinitialValue: typeof color === \"string\" && colorData.format !== ColorFormat.HSV ? color : undefined,\n\t\t\t\troundA: Math.round(100 * colorData.a) / 100,\n\t\t\t\tformat: colorData.format,\n\t\t\t\tmix: Color.mix,\n\t\t\t\ttoValue: () => Color.toRgbString(newColor),\n\t\t\t}\n\n\t\t\treturn newColor\n\t\t} else {\n\t\t\treturn undefined\n\t\t}\n\t}\n\n\tconst ColorMixModel = {\n\t\tisRGB(colorModel: ColorMixModelType) {\n\t\t\treturn colorModel === ColorMixModelType.RGB || colorModel === ColorMixModelType.RGBA\n\t\t},\n\t\tisHSL(colorModel: ColorMixModelType) {\n\t\t\treturn colorModel === ColorMixModelType.HSL || colorModel === ColorMixModelType.HSLA\n\t\t},\n\t}\n\n\t/**\n\t * Formats a Color object into a readable string for debugging.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t *\n\t * Color.inspect(blue)\n\t * ```\n\t *\n\t * @param color - The Color object to format\n\t * @param initialValue - A canonical hex string to be used instead of an rgba() value.\n\t */\n\tColor.inspect = (color: Color, initialValue?: string): string => {\n\t\tif (color.format === ColorFormat.HSL) {\n\t\t\treturn `<${color.constructor.name} h:${color.h} s:${color.s} l:${color.l} a:${color.a}>`\n\t\t} else if (color.format === ColorFormat.HEX || color.format === ColorFormat.NAME) {\n\t\t\treturn `<${color.constructor.name} \"${initialValue}\">`\n\t\t} else {\n\t\t\treturn `<${color.constructor.name} r:${color.r} g:${color.g} b:${color.b} a:${color.a}>`\n\t\t}\n\t}\n\n\t/**\n\t * Checks if the value is a valid color object or color string. Returns true or false.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * Color.isColor(\"#0099FF\") // true\n\t * Color.isColor(Color(\"#0099FF\")) // true\n\t * ```\n\t *\n\t * @param color - The potential color value to validate\n\t */\n\tColor.isColor = (color: string | Color) => {\n\t\tif (typeof color === \"string\") {\n\t\t\treturn Color.isColorString(color)\n\t\t} else {\n\t\t\treturn Color.isColorObject(color)\n\t\t}\n\t}\n\n\t/**\n\t * Checks if the value is a valid color string. Returns true or false.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * Color.isColorString(\"#0099FF\") // true\n\t * ```\n\t *\n\t * @param color - A string representing a color\n\t */\n\tColor.isColorString = (colorString: string | object): boolean => {\n\t\tif (typeof colorString === \"string\") {\n\t\t\treturn stringToObject(colorString) !== false\n\t\t}\n\t\treturn false\n\t}\n\n\t/**\n\t * Checks if the value is a valid Color object. Returns true or false.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t *\n\t * Color.isColorObject(blue) // true\n\t * Color.isColorObject(\"#0099FF\") // false\n\t * ```\n\t *\n\t * @param color - An object representing a color.\n\t */\n\tColor.isColorObject = (color: unknown): color is object & Color => {\n\t\treturn (\n\t\t\tisObject(color) &&\n\t\t\ttypeof color.r === \"number\" &&\n\t\t\ttypeof color.g === \"number\" &&\n\t\t\ttypeof color.b === \"number\" &&\n\t\t\ttypeof color.h === \"number\" &&\n\t\t\ttypeof color.s === \"number\" &&\n\t\t\ttypeof color.l === \"number\" &&\n\t\t\ttypeof color.a === \"number\" &&\n\t\t\ttypeof color.roundA === \"number\" &&\n\t\t\ttypeof color.format === \"string\"\n\t\t)\n\t}\n\n\t/**\n\t * Formats a Color instance into an RGB string.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t *\n\t * Color.toString(blue) // \"rgb(0, 153, 255)\"\n\t * ```\n\t *\n\t * @param color - The color to format\n\t */\n\tColor.toString = (color: Color): string => {\n\t\treturn Color.toRgbString(color)\n\t}\n\n\t/**\n\t * Formats a Color instance into an hexidecimal value.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t *\n\t * Color.toHex(blue) // \"0099FF\"\n\t * Color.toHex(Color(\"#FFAAFF\"), true) // \"FAF\"\n\t * ```\n\t *\n\t * @param color - The color to format\n\t * @param allow3Char - If true will return short hand colors if possible (defaults to false).\n\t */\n\tColor.toHex = (color: Color, allow3Char: boolean = false): string => {\n\t\treturn rgbToHex(color.r, color.g, color.b, allow3Char)\n\t}\n\n\t/**\n\t * Formats a Color instance into an hexidecimal string.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t *\n\t * Color.toHexString(blue) // \"#0099FF\"\n\t * Color.toHexString(Color(\"#FFAAFF\"), true) // \"#FAF\"\n\t * ```\n\t *\n\t * @param color - The color to format\n\t * @param allow3Char - If true will return short hand colors if possible (defaults to false).\n\t */\n\tColor.toHexString = (color: Color, allow3Char: boolean = false): string => {\n\t\treturn `#${Color.toHex(color, allow3Char)}`\n\t}\n\n\tColor.isP3String = (color: unknown): color is string => {\n\t\tif (typeof color !== \"string\") return false\n\t\treturn P3Color.isP3String(color)\n\t}\n\n\t/**\n\t * Formats a Color instance into an RGB string.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t *\n\t * Color.toRgbString(blue) // \"rgb(0, 153, 255)\"\n\t * ```\n\t *\n\t * @param color - The color to format\n\t */\n\tColor.toRgbString = (color: Color): string => {\n\t\treturn color.a === 1\n\t\t\t? \"rgb(\" + Math.round(color.r) + \", \" + Math.round(color.g) + \", \" + Math.round(color.b) + \")\"\n\t\t\t: \"rgba(\" +\n\t\t\t\t\tMath.round(color.r) +\n\t\t\t\t\t\", \" +\n\t\t\t\t\tMath.round(color.g) +\n\t\t\t\t\t\", \" +\n\t\t\t\t\tMath.round(color.b) +\n\t\t\t\t\t\", \" +\n\t\t\t\t\tcolor.roundA +\n\t\t\t\t\t\")\"\n\t}\n\n\t/**\n\t * Formats a Color instance into an HUSL object.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t *\n\t * Color.toHusl(blue) // {h: 250, s: 100, l: 50, a: 1}\n\t * ```\n\t *\n\t * @param color - The color to format\n\t */\n\tColor.toHusl = (color: Color): ColorHSLA => {\n\t\treturn {\n\t\t\t...rgbToHsluv(color.r, color.g, color.b),\n\t\t\ta: color.roundA,\n\t\t}\n\t}\n\n\t/**\n\t * Formats a Color instance into an HSL string.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t *\n\t * Color.toHslString(blue) // \"hsl(204, 100%, 50%)\"\n\t * ```\n\t *\n\t * @param color - The color to format\n\t */\n\tColor.toHslString = (color: Color): string => {\n\t\tconst hsl = Color.toHsl(color)\n\t\tconst h = Math.round(hsl.h)\n\t\tconst s = Math.round(hsl.s * 100)\n\t\tconst l = Math.round(hsl.l * 100)\n\t\treturn color.a === 1\n\t\t\t? \"hsl(\" + h + \", \" + s + \"%, \" + l + \"%)\"\n\t\t\t: \"hsla(\" + h + \", \" + s + \"%, \" + l + \"%, \" + color.roundA + \")\"\n\t}\n\n\t/**\n\t * Formats a Color instance into an HSV object.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t *\n\t * Color.toHsv(blue) // {h: 204, s: 1, v: 1, a: 1}\"\n\t * ```\n\t *\n\t * @param color - The color to format\n\t */\n\tColor.toHsv = (color: Color): ColorHSVA => {\n\t\tconst hsv = rgbToHsv(color.r, color.g, color.b)\n\t\treturn { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: color.a }\n\t}\n\n\t/**\n\t * Formats a Color instance into an HSV string.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t *\n\t * Color.toHslString(blue) // \"hsv(204, 100%, 50%)\"\n\t * ```\n\t *\n\t * @param color - The color to format\n\t */\n\tColor.toHsvString = (color: Color): string => {\n\t\tconst hsv = rgbToHsv(color.r, color.g, color.b)\n\t\tconst h = Math.round(hsv.h * 360)\n\t\tconst s = Math.round(hsv.s * 100)\n\t\tconst v = Math.round(hsv.v * 100)\n\n\t\treturn color.a === 1\n\t\t\t? \"hsv(\" + h + \", \" + s + \"%, \" + v + \"%)\"\n\t\t\t: \"hsva(\" + h + \", \" + s + \"%, \" + v + \"%, \" + color.roundA + \")\"\n\t}\n\n\t/**\n\t * Formats a Color instance into {@link https://css-tricks.com/snippets/css/named-colors-and-hex-equivalents/ | CSS name}\n\t * or returns false if unspecified.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const green = Color(\"#8FBC8F\")\n\t *\n\t * Color.toName(green) // \"darkseagreen\"\n\t * ```\n\t *\n\t * @param color - The color to format\n\t */\n\tColor.toName = (color: Color): string | false => {\n\t\tif (color.a === 0) {\n\t\t\treturn \"transparent\"\n\t\t}\n\t\tif (color.a < 1) {\n\t\t\treturn false\n\t\t}\n\t\tconst hex = rgbToHex(color.r, color.g, color.b, true)\n\n\t\tfor (const key of Object.keys(cssNames)) {\n\t\t\tconst value = cssNames[key]\n\t\t\tif (value === hex) {\n\t\t\t\treturn key\n\t\t\t}\n\t\t}\n\n\t\treturn false\n\t}\n\n\t/**\n\t * Formats a color into an HSL object.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t *\n\t * Color.toHsl(blue) // {h: 204, s: 1, l: 0.5, a: 1}\n\t * ```\n\t *\n\t * @param color - The color to format\n\t */\n\tColor.toHsl = (color: Color): ColorHSLA => {\n\t\treturn {\n\t\t\th: Math.round(color.h),\n\t\t\ts: color.s,\n\t\t\tl: color.l,\n\t\t\ta: color.a,\n\t\t}\n\t}\n\n\t/**\n\t * Formats a color into an RGB object.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t *\n\t * Color.toRgb(blue) // {r: 40, g: 175, b: 250, a: 1}\n\t * ```\n\t *\n\t * @param color - The color to format\n\t */\n\tColor.toRgb = (color: Color): ColorRGBA => {\n\t\treturn {\n\t\t\tr: Math.round(color.r),\n\t\t\tg: Math.round(color.g),\n\t\t\tb: Math.round(color.b),\n\t\t\ta: color.a,\n\t\t}\n\t}\n\n\t/**\n\t * Returns a brightened color.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t * const brightblue = Color.lighten(blue, 20)\n\t * ```\n\t *\n\t * @param color - The color to brighten\n\t * @param amount - A number, from 0 to 100. Set to 10 by default.\n\t */\n\tColor.brighten = (color: Color, amount: number = 10): Color => {\n\t\tconst rgb = Color.toRgb(color)\n\t\trgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))))\n\t\trgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))))\n\t\trgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))))\n\t\treturn Color(rgb)\n\t}\n\n\t/**\n\t * Add white and return a lightened color.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t * const lightblue = Color.lighten(blue, 20)\n\t * ```\n\t *\n\t * @param color - The color to lighten\n\t * @param amount - A number, from 0 to 100. Set to 10 by default.\n\t */\n\tColor.lighten = (color: Color, amount: number = 10): Color => {\n\t\tconst hsl = Color.toHsl(color)\n\t\thsl.l += amount / 100\n\t\thsl.l = Math.min(1, Math.max(0, hsl.l))\n\t\treturn Color(hsl)\n\t}\n\n\t/**\n\t * Add black and return a darkened color.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t * const darkblue = Color.darken(blue, 20)\n\t * ```\n\t * @param color - The color to darken.\n\t * @param amount - A number, from 0 to 100. Set to 10 by default.\n\t */\n\tColor.darken = (color: Color, amount: number = 10): Color => {\n\t\tconst hsl = Color.toHsl(color)\n\t\thsl.l -= amount / 100\n\t\thsl.l = Math.min(1, Math.max(0, hsl.l))\n\t\treturn Color(hsl)\n\t}\n\n\t/**\n\t * Increase the saturation of a color.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t * const saturated = Color.saturate(blue, 100)\n\t * ```\n\t * @param color - The color to modify\n\t * @param amount - A number from 0 to 100. Set to 10 by default.\n\t */\n\tColor.saturate = (color: Color, amount: number = 10): Color => {\n\t\tconst hsl = Color.toHsl(color)\n\t\thsl.s += amount / 100\n\t\thsl.s = Math.min(1, Math.max(0, hsl.s))\n\t\treturn Color(hsl)\n\t}\n\n\t/**\n\t * Decrease the saturation of a color.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t * const desaturated = Color.desaturate(blue, 100)\n\t * ```\n\t * @param color - The color to modify\n\t * @param amount - A number from 0 to 100. Set to 10 by default.\n\t */\n\tColor.desaturate = (color: Color, amount: number = 10): Color => {\n\t\tconst hsl = Color.toHsl(color)\n\t\thsl.s -= amount / 100\n\t\thsl.s = Math.min(1, Math.max(0, hsl.s))\n\t\treturn Color(hsl)\n\t}\n\n\t/**\n\t * Return a fully desaturated color.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t * const gray = Color.grayscale(blue)\n\t * ```\n\t * @param color - The color to convert.\n\t */\n\tColor.grayscale = (color: Color): Color => {\n\t\treturn Color.desaturate(color, 100)\n\t}\n\n\t/**\n\t * Returns a new color for the rotated hue.\n\t * @param color - The color to manipulate\n\t * @param angle - The angle in degrees in which to rotate the hue.\n\t */\n\tColor.hueRotate = (color: Color, angle: number): Color => {\n\t\tconst hsl = Color.toHsl(color)\n\t\thsl.h += angle\n\t\thsl.h = hsl.h > 360 ? hsl.h - 360 : hsl.h\n\t\treturn Color(hsl)\n\t}\n\n\t/**\n\t * Set the alpha value, also known as opacity, of the color.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t *\n\t * const transparent = Color.alpha(blue, 0.1)\n\t * ```\n\t * @param color - The original color to modify.\n\t * @param alpha - A number from 1 to 0. Set to 1 by default.\n\t */\n\tColor.alpha = (color: Color, a: number = 1): Color => {\n\t\treturn Color({\n\t\t\tr: color.r,\n\t\t\tg: color.g,\n\t\t\tb: color.b,\n\t\t\ta: a,\n\t\t})\n\t}\n\n\t/**\n\t * Set the alpha value, also known as opacity, of the color to zero.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t *\n\t * const transparent = Color.alpha(blue)\n\t * ```\n\t * @param color - The original color to modify.\n\t */\n\tColor.transparent = (color: Color): Color => {\n\t\treturn Color.alpha(color, 0)\n\t}\n\n\t/**\n\t * Change the alpha value, also know as opacity, by a multiplier.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t * const transparent = Color.multiplyAlpha(blue, 0.5)\n\t * ```\n\t * @param color - The original color to modify.\n\t * @param alphaValue - A number between 1 and 0, defaults to 1,\n\t */\n\tColor.multiplyAlpha = (color: Color, alphaValue: number = 1): Color => {\n\t\treturn Color({\n\t\t\tr: color.r,\n\t\t\tg: color.g,\n\t\t\tb: color.b,\n\t\t\ta: color.a * alphaValue,\n\t\t})\n\t}\n\n\t/**\n\t * Alpha blends a top color over a bottom color and returns the resulting opaque color.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const red = Color(\"red\")\n\t * const blue = Color(\"blue\")\n\t * const blended = Color.alphaComposite(Color.alpha(red, 0.5), blue)\n\t * ```\n\t *\n\t * @param top - The foreground color layered on top.\n\t * @param bottom - The background color behind it.\n\t */\n\tColor.alphaComposite = (top: Color, bottom: Color): Color => {\n\t\tif (top.a === 1) {\n\t\t\treturn top\n\t\t}\n\n\t\tif (bottom.a < 1) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Bottom color must be fully opaque for alpha blending, you should check and determine your own strategy for resolving alpha bottom layers, ie. `Color.alphaComposite(bottom, Color('white'))`\",\n\t\t\t)\n\t\t}\n\n\t\tif (top.a === 0) {\n\t\t\treturn bottom\n\t\t}\n\n\t\treturn Color({\n\t\t\tr: Math.round(top.r * top.a + bottom.r * (1 - top.a)),\n\t\t\tg: Math.round(top.g * top.a + bottom.g * (1 - top.a)),\n\t\t\tb: Math.round(top.b * top.a + bottom.b * (1 - top.a)),\n\t\t\ta: 1,\n\t\t})\n\t}\n\n\t/**\n\t * Returns a function that can be used to transition a color from one value\n\t * to another. By default this will use the RGB `mix` model. Useful for providing to animation tools.\n\t *\n\t * ```jsx\n\t * const blend = Color.interpolate(Color(\"red\"), Color(\"blue\"))\n\t *\n\t * blend(0)   // Initial state (red)\n\t * blend(0.5) // Mid state (purple)\n\t * blend(1)   // Final state (blue)\n\t * ```\n\t * @param colorA - The starting color\n\t * @param colorB - The final color\n\t * @param model  - The model to use for the mix. One of {@link ColorMixModelType}\n\t */\n\tColor.interpolate = (\n\t\tcolorA: Color,\n\t\tcolorB: Color,\n\t\tmodel: ColorMixModelType = ColorMixModelType.RGB,\n\t): ((progress: number) => Color) => {\n\t\tif (!Color.isColorObject(colorA) || !Color.isColorObject(colorB)) {\n\t\t\tthrow new TypeError(\"Both arguments for Color.interpolate must be Color objects\")\n\t\t}\n\t\treturn (progress: number): Color => {\n\t\t\tconst color = Color.mixAsColor(colorA, colorB, progress, false, model)\n\t\t\treturn color\n\t\t}\n\t}\n\n\t/**\n\t * Create a function that will mix two colors together and output the result as an rgb string.\n\t *\n\t * @param colorA - The starting color\n\t * @param colorB - The final color\n\t * @param options - Options for the color mixer\n\t *\n\t * - `model`: The model to use for the mix. One of {@link ColorMixModelType}\n\t *\n\t * @public\n\t */\n\tColor.mix = (from: Color, toColor: Color, { model = ColorMixModelType.RGB } = {}) => {\n\t\tconst fromColor = typeof from === \"string\" ? Color(from) : from\n\t\tconst mixer = Color.interpolate(fromColor, toColor, model)\n\n\t\treturn (p: number) => Color.toRgbString(mixer(p))\n\t}\n\n\t/**\n\t * Blend two colors together, optionally based on user input. The fraction defines the\n\t * distribution between the two colors, and is set to 0.5 by default.\n\t * The `limit` defines if the color can transition beyond its range.\n\t * @remarks\n\t * ```jsx\n\t * // Mix red with yellow\n\t * const orange = Color.mix(\"red\", \"yellow\", 0.5)\n\t * ```\n\t *\n\t * ```jsx\n\t * Color.mix(\"red\", \"yellow\", 0.5, true, \"husl\")\n\t * ```\n\t *\n\t * @param colorA   - A color, the first one.\n\t * @param colorB   - A color, the second one.\n\t * @param fraction - An optional number, from 0 to 1, set to 0.5 by default.\n\t * @param limit    - An optional boolean, set to false by default.\n\t * @param model    - The model to use for the mix. One of {@link ColorMixModelType}\n\t */\n\tColor.mixAsColor = (\n\t\tcolorA: Color,\n\t\tcolorB: Color,\n\t\tfraction = 0.5,\n\t\tlimit = false,\n\t\tmodel: ColorMixModelType = ColorMixModelType.RGB,\n\t): Color => {\n\t\tlet result: Color | null = null\n\n\t\tif (ColorMixModel.isRGB(model)) {\n\t\t\t// rgb model\n\t\t\tresult = Color({\n\t\t\t\tr: modulate(fraction, [0, 1], [colorA.r, colorB.r], limit),\n\t\t\t\tg: modulate(fraction, [0, 1], [colorA.g, colorB.g], limit),\n\t\t\t\tb: modulate(fraction, [0, 1], [colorA.b, colorB.b], limit),\n\t\t\t\ta: modulate(fraction, [0, 1], [colorA.a, colorB.a], limit),\n\t\t\t})\n\t\t} else {\n\t\t\tlet hslA, hslB\n\t\t\tif (ColorMixModel.isHSL(model)) {\n\t\t\t\t// hsl model\n\t\t\t\thslA = Color.toHsl(colorA)\n\t\t\t\thslB = Color.toHsl(colorB)\n\t\t\t} else {\n\t\t\t\t// husl model\n\t\t\t\thslA = Color.toHusl(colorA)\n\t\t\t\thslB = Color.toHusl(colorB)\n\t\t\t}\n\n\t\t\tif (hslA.s === 0) {\n\t\t\t\thslA.h = hslB.h\n\t\t\t} else if (hslB.s === 0) {\n\t\t\t\thslB.h = hslA.h\n\t\t\t}\n\n\t\t\tconst fromH = hslA.h\n\t\t\tconst toH = hslB.h\n\t\t\tlet deltaH = toH - fromH\n\n\t\t\tif (deltaH > 180) {\n\t\t\t\tdeltaH = toH - 360 - fromH\n\t\t\t} else if (deltaH < -180) {\n\t\t\t\tdeltaH = toH + 360 - fromH\n\t\t\t}\n\n\t\t\tconst tween = {\n\t\t\t\th: modulate(fraction, [0, 1], [fromH, fromH + deltaH], limit),\n\t\t\t\ts: modulate(fraction, [0, 1], [hslA.s, hslB.s], limit),\n\t\t\t\tl: modulate(fraction, [0, 1], [hslA.l, hslB.l], limit),\n\t\t\t\ta: modulate(fraction, [0, 1], [colorA.a, colorB.a], limit),\n\t\t\t}\n\n\t\t\tif (ColorMixModel.isHSL(model)) {\n\t\t\t\t// hsl model\n\t\t\t\tresult = Color(tween)\n\t\t\t} else {\n\t\t\t\t// husl model\n\t\t\t\tresult = Color(rgbaFromHusl(tween.h, tween.s, tween.l, tween.a))\n\t\t\t}\n\t\t}\n\n\t\treturn result\n\t}\n\n\t/**\n\t * Returns a Color instance with a random color value set.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const random = Color.random()\n\t * ```\n\t *\n\t * @param alphaValue - An optional alpha value, set to 1 by default.\n\t */\n\tColor.random = (alphaValue = 1): Color => {\n\t\tfunction gen() {\n\t\t\treturn Math.floor(Math.random() * 255)\n\t\t}\n\t\treturn Color(\"rgba(\" + gen() + \", \" + gen() + \", \" + gen() + \", \" + alphaValue + \")\")\n\t}\n\n\t/**\n\t * Creates a greyscale color.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const gray = Color.gray(0.5)\n\t * ```\n\t *\n\t * @param amount - A number from 0 to 1 representing the amount of white.\n\t * @param alphaValue  - A number from 0 to 1 representing the alpha. Set to 1 by default.\n\t */\n\tColor.grey = (amount: number = 0.5, alphaValue: number = 1) => {\n\t\tamount = Math.floor(amount * 255)\n\t\treturn Color(\"rgba(\" + amount + \", \" + amount + \", \" + amount + \", \" + alphaValue + \")\")\n\t}\n\n\t/**\n\t * @internal\n\t * Alias for {@link (Color:namespace).grey}\n\t */\n\tColor.gray = Color.grey\n\n\t/** @internal */\n\tColor.rgbToHsl = (r: number, g: number, b: number): ColorHSL => {\n\t\treturn rgbToHslConverter(r, g, b)\n\t}\n\n\t/** @internal */\n\tColor.isValidColorProperty = (name: string, value: string): boolean => {\n\t\tconst isColorKey = name.toLowerCase().slice(-5) === \"color\" || name === \"fill\" || name === \"stroke\"\n\t\tif (isColorKey && typeof value === \"string\" && Color.isColorString(value)) {\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n\n\t/**\n\t * Calculates the color difference using {@link https://en.wikipedia.org/wiki/Color_difference#Euclidean |\n\t * Euclidean distance fitting human perception}. Returns a value between 0 and 765\n\t * @param colorA - A first color.\n\t * @param colorB - A second color.\n\t */\n\tColor.difference = (colorA: Color, colorB: Color): number => {\n\t\tconst _r = (colorA.r + colorB.r) / 2\n\t\tconst deltaR = colorA.r - colorB.r\n\t\tconst deltaG = colorA.g - colorB.g\n\t\tconst deltaB = colorA.b - colorB.b\n\t\tconst deltaR2 = Math.pow(deltaR, 2)\n\t\tconst deltaG2 = Math.pow(deltaG, 2)\n\t\tconst deltaB2 = Math.pow(deltaB, 2)\n\t\treturn Math.sqrt(2 * deltaR2 + 4 * deltaG2 + 3 * deltaB2 + (_r * (deltaR2 - deltaB2)) / 256)\n\t}\n\n\t/**\n\t * Checks whether two Color objects are equal.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * Color.equal(Color(\"red\"), Color(\"red\"))  // true\n\t * Color.equal(Color(\"red\"), Color(\"blue\")) // false\n\t *\n\t * Color.equal(Color(\"#0099FF\"), Color(\"009AFF\"))    // false\n\t * Color.equal(Color(\"#0099FF\"), Color(\"009AFF\"), 2) // true\n\t * ```\n\t *\n\t * @param colorA    - The first color\n\t * @param colorB    - The second color\n\t * @param tolerance - A tolerance for the difference between rgba values. Set to 0.1 by default.\n\t */\n\tColor.equal = (colorA: Color, colorB: Color, tolerance = 0.1): boolean => {\n\t\tif (Math.abs(colorA.r - colorB.r) >= tolerance) {\n\t\t\treturn false\n\t\t}\n\t\tif (Math.abs(colorA.g - colorB.g) >= tolerance) {\n\t\t\treturn false\n\t\t}\n\t\tif (Math.abs(colorA.b - colorB.b) >= tolerance) {\n\t\t\treturn false\n\t\t}\n\t\tif (Math.abs(colorA.a - colorB.a) * 256 >= tolerance) {\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t}\n\n\tconst channelToDecimal = interpolate([0, 255], [0, 1])\n\tfunction convertChannelToLinearRgb(channel: number) {\n\t\tchannel = channelToDecimal(channel)\n\t\tconst abs = Math.abs(channel)\n\t\tif (abs < 0.04045) return channel / 12.92\n\t\treturn (Math.sign(channel) || 1) * Math.pow((abs + 0.055) / 1.055, 2.4)\n\t}\n\n\t/*\n\t * WCAG luminance References:\n\t *\n\t * https://en.wikipedia.org/wiki/Relative_luminance\n\t * https://github.com/w3c/wcag/issues/236#issuecomment-379526596\n\t */\n\tColor.luminance = (color: Color): number => {\n\t\tconst { r, g, b } = Color.toRgb(color)\n\t\treturn (\n\t\t\t0.2126 * convertChannelToLinearRgb(r) +\n\t\t\t0.7152 * convertChannelToLinearRgb(g) +\n\t\t\t0.0722 * convertChannelToLinearRgb(b)\n\t\t)\n\t}\n\n\tColor.contrast = (a: Color, b: Color): number => {\n\t\tconst l1 = Color.luminance(a)\n\t\tconst l2 = Color.luminance(b)\n\t\treturn (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05)\n\t}\n\n\treturn Color\n})()\n\n// helpers\n\nfunction getCompleteColorStrategy(\n\tcolorOrR: IncomingColor | number,\n\tg?: number,\n\tb?: number,\n\ta: number = 1,\n): CompleteColor | undefined {\n\tlet completeColor: CompleteColor | undefined\n\t// RGB arguments have higher priority\n\tif (\n\t\ttypeof colorOrR === \"number\" &&\n\t\t!Number.isNaN(colorOrR) &&\n\t\ttypeof g === \"number\" &&\n\t\t!Number.isNaN(g) &&\n\t\ttypeof b === \"number\" &&\n\t\t!Number.isNaN(b)\n\t) {\n\t\t// color used as red - Color(255, 255, 255)\n\t\tconst _r = colorOrR\n\t\tconst _g = g\n\t\tconst _b = b\n\t\tconst _a = a\n\t\tcompleteColor = getCompleteColorFromRGB({ r: _r, g: _g, b: _b, a: _a })\n\t} else if (typeof colorOrR === \"string\") {\n\t\t// valid CSS color (including functions)\n\t\tcompleteColor = getCompleteColorFromString(colorOrR)\n\t} else if (typeof colorOrR === \"object\") {\n\t\t// biome-ignore lint/suspicious/noPrototypeBuiltins: <explanation>lint/suspicious/noPrototypeBuiltins: <explanation>\n\t\tif (colorOrR.hasOwnProperty(\"r\") && colorOrR.hasOwnProperty(\"g\") && colorOrR.hasOwnProperty(\"b\")) {\n\t\t\tcompleteColor = getCompleteColorFromRGB(colorOrR as ColorRGB)\n\t\t} else {\n\t\t\tcompleteColor = getCompleteColorFromHSL(colorOrR as ColorHSL)\n\t\t}\n\t}\n\n\treturn completeColor\n}\n\nfunction getCompleteColorFromString(color: string): CompleteColor | undefined {\n\tconst result = stringToObject(color)\n\tif (result) {\n\t\tif (result.format === ColorFormat.HSL) {\n\t\t\treturn getCompleteColorFromHSL(result as ColorHSLA)\n\t\t} else if (result.format === ColorFormat.HSV) {\n\t\t\treturn getCompleteColorFromHSV(result as ColorHSVA)\n\t\t} else {\n\t\t\treturn getCompleteColorFromRGB(result as ColorRGBA)\n\t\t}\n\t}\n}\n\nfunction getCompleteColorFromHSV(color: { h: number; s: number; v: number; a?: number }): CompleteColor | undefined {\n\tconst rgb: ColorRGB = hsvToRgb(color.h, color.s, color.v)\n\tconst hsl: ColorHSL = rgbToHslConverter(rgb.r, rgb.g, rgb.b)\n\treturn {\n\t\t...hsl,\n\t\t...rgb,\n\t\tformat: ColorFormat.RGB,\n\t\ta: color.a !== undefined ? correctAlpha(color.a) : 1,\n\t}\n}\n\nfunction getCompleteColorFromRGB(color: { r: number; g: number; b: number; a?: number }): CompleteColor | undefined {\n\tconst rgb: ColorRGB = rgbToRgb(color.r, color.g, color.b)\n\tconst hsl: ColorHSL = rgbToHslConverter(rgb.r, rgb.g, rgb.b)\n\treturn {\n\t\t...hsl,\n\t\t...rgb,\n\t\tformat: ColorFormat.RGB,\n\t\ta: color.a !== undefined ? correctAlpha(color.a) : 1,\n\t}\n}\n\nfunction getCompleteColorFromHSL(color: { h: number; s: number; l: number; a?: number }): CompleteColor {\n\tlet h: number\n\tlet s: number\n\tlet l: number\n\tlet rgb: ColorRGB = { r: 0, g: 0, b: 0 }\n\tlet hsl: ColorHSL = { h: 0, s: 0, l: 0 }\n\th = isNumeric(color.h) ? color.h : 0\n\th = (h + 360) % 360\n\ts = isNumeric(color.s) ? color.s : 1\n\tif (typeof color.s === \"string\") {\n\t\t// biome-ignore lint/style/noNonNullAssertion: should be defined.\n\t\ts = numberFromString(color.s as string)!\n\t}\n\tl = isNumeric(color.l) ? color.l : 0.5\n\tif (typeof color.l === \"string\") {\n\t\t// biome-ignore lint/style/noNonNullAssertion: should be defined.\n\t\tl = numberFromString(color.l as string)!\n\t}\n\trgb = hslToRgb(h, s, l)\n\thsl = {\n\t\th: h,\n\t\ts: s,\n\t\tl: l,\n\t}\n\n\treturn {\n\t\t...rgb,\n\t\t...hsl,\n\t\ta: color.a === undefined ? 1 : color.a,\n\t\tformat: ColorFormat.HSL,\n\t}\n}\nfunction correctAlpha(alphaValue: string | number) {\n\talphaValue = parseFloat(alphaValue as string)\n\tif (alphaValue < 0) {\n\t\talphaValue = 0\n\t}\n\tif (Number.isNaN(alphaValue) || alphaValue > 1) {\n\t\talphaValue = 1\n\t}\n\treturn alphaValue\n}\nfunction rgbToP3(color: ColorRGBA): string {\n\tthrow new Error(\"Function not implemented.\")\n}\n", "import type { RefObject } from \"react\"\nimport type React from \"react\"\nimport { forwardRef } from \"react\"\nimport type { WithEventsProperties } from \"../../../components/hoc/WithEvents.tsx\"\nimport { WithEvents } from \"../../../components/hoc/WithEvents.tsx\"\nimport { deprecatedParentSize, useParentSize } from \"../../types/NewConstraints.tsx\"\nimport type { Size } from \"../../types/Size.ts\"\nimport type { DeprecatedCoreFrameProps } from \"./DeprecatedFrame.tsx\"\nimport { DeprecatedFrame } from \"./DeprecatedFrame.tsx\"\nimport type { FrameProps } from \"./FrameWithMotion.tsx\"\nimport { FrameWithMotion } from \"./FrameWithMotion.tsx\"\nimport { isDeprecatedFrameProps } from \"./isDeprecatedFrameProps.ts\"\n// Re-exports\nexport type { DeprecatedCoreFrameProps, DeprecatedFrameProperties } from \"./DeprecatedFrame.tsx\"\nexport type { FrameProps } from \"./FrameWithMotion.tsx\"\nexport type { BaseFrameProps, CSSTransformProperties, FrameLayoutProperties, VisualProperties } from \"./types.ts\"\n\n// Public types\n/** @public */\nexport type DeprecatedFrameWithEventsProps = DeprecatedCoreFrameProps & WithEventsProperties\n/** @public */\nexport const DeprecatedFrameWithEvents: React.ComponentClass<Partial<DeprecatedFrameWithEventsProps>> =\n\t/* @__PURE__ */\n\tWithEvents(DeprecatedFrame)\n\n// const isPreview = RenderEnvironment.target === RenderTarget.preview\n\n// We need switcher component to useContext without conditions\n// THIS SHOULD NOT BE USED DIRECTLY IN LIBRARY NOR IN VEKTER\n// Only for backwards compatibility\n/** @public */\nexport const Frame = /* @__PURE__ */ (() => {\n\tconst FrameInner = forwardRef(function FrameInner(props: Partial<FrameProps>, ref: RefObject<HTMLDivElement> | null) {\n\t\tconst parentSize = useParentSize()\n\t\tif (isDeprecatedFrameProps(props)) {\n\t\t\tconst currentParentSize: Size | null = props.parentSize || deprecatedParentSize(parentSize)\n\n\t\t\t// We use here DeprecatedFrame WithEvents for simplicity\n\t\t\t//\n\t\t\t// @ts-expect-error forwardRef must return a forwardRef component, which\n\t\t\t// DeprecatedFrameWithEvents is not. It's only here for backwards compatibility, when we\n\t\t\t// did not have the ref prop, so it should be fine to ignore this error.\n\t\t\treturn <DeprecatedFrameWithEvents {...props} parentSize={currentParentSize} />\n\t\t}\n\t\treturn <FrameWithMotion {...props} ref={ref} />\n\t})\n\n\t// NOTE: Required for performance tests, see RenderPerformance.test.ts\n\tFrameInner[\"displayName\"] = \"Frame\"\n\n\treturn FrameInner\n})()\n", "import hoistNonReactStatic from \"hoist-non-react-statics\"\nimport React from \"react\"\nimport { FramerEvent } from \"../../events/FramerEvent.ts\"\nimport { DraggingContext } from \"./WithDragging.tsx\"\n\nexport type EventHandler = (event: FramerEvent) => void\n\nexport interface WithPanHandlers {\n\tonPanStart: EventHandler\n\tonPan: EventHandler\n\tonPanEnd: EventHandler\n}\n\nexport interface WithTapHandlers {\n\tonTapStart: EventHandler\n\tonTap: EventHandler\n\tonTapEnd: EventHandler\n}\n\nexport interface WithMouseHandlers {\n\tonMouseDown: EventHandler\n\tonClick: EventHandler\n\tonMouseUp: EventHandler\n\tonMouseEnter: EventHandler\n\tonMouseLeave: EventHandler\n}\n\nexport interface WithMouseWheelHandler {\n\tonMouseWheelStart: EventHandler\n\tonMouseWheel: EventHandler\n\tonMouseWheelEnd: EventHandler\n}\n\nexport interface WithEventsProperties\n\textends WithPanHandlers, WithTapHandlers, WithMouseHandlers, WithMouseWheelHandler {}\n\nexport interface WithElement {\n\telement: HTMLElement | null\n}\n\nexport interface MayHaveStyle {\n\tstyle?: React.CSSProperties\n}\n\nconst hoverProps = {\n\tonMouseEnter: \"mouseenter\",\n\tonMouseLeave: \"mouseleave\",\n}\n\nconst hoverEventKeys = /* @__PURE__ */ Object.keys(hoverProps)\n\ntype HoverEventPropKey = keyof typeof hoverProps\n\ntype PointerEventHandler = (e: MouseEvent | TouchEvent) => void\n\nconst eventHandlerMapping = {\n\tpanstart: [\"onPanStart\"],\n\tpan: [\"onPan\"],\n\tpanend: [\"onPanEnd\"],\n\ttapstart: [\"onTapStart\", \"onMouseDown\"],\n\ttap: [\"onTap\", \"onClick\"],\n\ttapend: [\"onTapEnd\", \"onMouseUp\"],\n\tmousewheelstart: [\"onMouseWheelStart\"],\n\tmousewheel: [\"onMouseWheel\"],\n\tmousewheelend: [\"onMouseWheelEnd\"],\n} as const\n\nconst tapEventKeys = new Set([\"tapstart\", \"tap\", \"tapend\"])\n\nexport function WithEvents<\n\tT,\n\tBaseProps extends React.ClassAttributes<T> & Partial<WithEventsProperties> & MayHaveStyle,\n>(BaseComponent: React.ComponentType<BaseProps>): React.ComponentClass<BaseProps & Partial<WithEventsProperties>> {\n\ttype BaseComponentTypeRef = React.RefObject<typeof BaseComponent & WithElement & MayHaveStyle>\n\n\tconst withEvents = class WithEventsHOC extends React.Component<BaseProps> {\n\t\tstatic defaultProps = Object.assign({}, BaseComponent.defaultProps as BaseProps)\n\n\t\t// This local variable is used to track if we should ignore a tap after a drag\n\t\t// It's not in a state because we want to change it from the render function (so not cause a render)\n\t\tshouldCancelTap = false\n\n\t\tactiveEventListeners = new Map<HoverEventPropKey, PointerEventHandler>()\n\n\t\tget element() {\n\t\t\treturn this.component.current && this.component.current.element\n\t\t}\n\n\t\tprivate hasFramerEventListener: boolean = false\n\n\t\tcomponent: BaseComponentTypeRef = React.createRef()\n\n\t\toverride componentDidMount() {\n\t\t\tthis.addEventListeners()\n\t\t}\n\n\t\toverride componentDidUpdate(prevProps: BaseProps) {\n\t\t\tthis.addEventListeners(prevProps)\n\t\t}\n\n\t\toverride componentWillUnmount() {\n\t\t\tthis.removeEventListeners()\n\t\t}\n\n\t\taddEventListeners(prevProps?: BaseProps) {\n\t\t\tif (this.element && !this.hasFramerEventListener) {\n\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: TODO: Fix this\n\t\t\t\tthis.element.addEventListener(\"FramerEvent\", ({ detail }: any) => {\n\t\t\t\t\tconst type = detail.type as keyof typeof eventHandlerMapping\n\t\t\t\t\tconst framerEvent = detail.event as FramerEvent\n\t\t\t\t\tthis.handleEvent(type, framerEvent)\n\t\t\t\t})\n\n\t\t\t\thoverEventKeys.forEach((eventName: HoverEventPropKey) => this.addHoverEvent(eventName))\n\n\t\t\t\tthis.hasFramerEventListener = true\n\t\t\t} else if (this.element && prevProps) {\n\t\t\t\thoverEventKeys.forEach((eventName: HoverEventPropKey) => this.checkHoverEvent(eventName, prevProps))\n\t\t\t} else if (!this.element) {\n\t\t\t\tthis.hasFramerEventListener = false\n\t\t\t}\n\t\t}\n\n\t\tremoveEventListeners() {\n\t\t\thoverEventKeys.forEach((eventName: HoverEventPropKey) => this.removeHoverEvent(eventName))\n\t\t}\n\n\t\taddHoverEvent(eventName: HoverEventPropKey) {\n\t\t\tconst originalEventListener = this.props[eventName]\n\n\t\t\tif (this.element && originalEventListener) {\n\t\t\t\tconst eventListener = (e: MouseEvent | TouchEvent) => {\n\t\t\t\t\tconst framerEvent = new FramerEvent(e)\n\t\t\t\t\toriginalEventListener(framerEvent)\n\t\t\t\t}\n\n\t\t\t\tthis.activeEventListeners.set(eventName, eventListener)\n\t\t\t\tconst domEventName = hoverProps[eventName]\n\t\t\t\tthis.element.addEventListener(domEventName, eventListener)\n\t\t\t}\n\t\t}\n\n\t\tremoveHoverEvent(eventName: HoverEventPropKey) {\n\t\t\tconst eventListener = this.activeEventListeners.get(eventName)\n\n\t\t\tif (this.element && eventListener) {\n\t\t\t\tconst domEventName = hoverProps[eventName]\n\t\t\t\tthis.element.removeEventListener(domEventName, eventListener)\n\t\t\t\tthis.activeEventListeners.delete(eventName)\n\t\t\t}\n\t\t}\n\n\t\tcheckHoverEvent(eventName: HoverEventPropKey, prevProps: BaseProps) {\n\t\t\tif (prevProps[eventName] !== this.props[eventName]) {\n\t\t\t\tthis.removeHoverEvent(eventName)\n\t\t\t\tthis.addHoverEvent(eventName)\n\t\t\t}\n\t\t}\n\n\t\thandleEvent(type: keyof typeof eventHandlerMapping, framerEvent: FramerEvent) {\n\t\t\tconst eventListenerKeys = eventHandlerMapping[type]\n\t\t\tif (!eventListenerKeys) return\n\n\t\t\teventListenerKeys.forEach(eventKey => {\n\t\t\t\tconst eventListener = this.props[eventKey]\n\t\t\t\tconst cancelEvent = this.shouldCancelTap && tapEventKeys.has(eventKey)\n\n\t\t\t\tif (eventListener && !cancelEvent) {\n\t\t\t\t\teventListener(framerEvent)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\n\t\toverride render() {\n\t\t\treturn (\n\t\t\t\t<DraggingContext.Consumer>\n\t\t\t\t\t{(value: { dragging: boolean }) => {\n\t\t\t\t\t\tthis.shouldCancelTap = value.dragging\n\t\t\t\t\t\treturn <BaseComponent {...this.props} ref={this.component} />\n\t\t\t\t\t}}\n\t\t\t\t</DraggingContext.Consumer>\n\t\t\t)\n\t\t}\n\t}\n\n\thoistNonReactStatic(withEvents, BaseComponent)\n\treturn withEvents\n}\n", "export type ListenerFn = (...args: unknown[]) => void\n\n// Importing using `/* @__PURE__ */ require()` so that EventEmitter can be tree-shaken properly.\nconst EventEmitter3: typeof import(\"eventemitter3\").EventEmitter = /* @__PURE__ */ (() =>\n\trequire(\"eventemitter3\").EventEmitter)()\n\nexport class EventEmitter<EventName extends string> {\n\tprivate _emitter = new EventEmitter3<string>()\n\n\teventNames() {\n\t\treturn this._emitter.eventNames()\n\t}\n\n\teventListeners() {\n\t\tconst listeners: { [index: string]: ListenerFn[] } = {}\n\n\t\tfor (const eventName of this._emitter.eventNames()) {\n\t\t\tlisteners[eventName] = this._emitter.listeners(eventName)\n\t\t}\n\n\t\treturn listeners\n\t}\n\n\ton(eventName: EventName, fn: ListenerFn) {\n\t\tthis.addEventListener(eventName, fn, false, false, this)\n\t}\n\n\toff(eventName: EventName, fn: ListenerFn) {\n\t\tthis.removeEventListeners(eventName, fn)\n\t}\n\n\tonce(eventName: EventName, fn: ListenerFn) {\n\t\tthis.addEventListener(eventName, fn, true, false, this)\n\t}\n\n\tunique(eventName: EventName, fn: ListenerFn) {\n\t\tthis.addEventListener(eventName, fn, false, true, this)\n\t}\n\n\taddEventListener(eventName: EventName, fn: ListenerFn, once: boolean, unique: boolean, context: unknown) {\n\t\tif (unique) {\n\t\t\tfor (const name of this._emitter.eventNames()) {\n\t\t\t\tif (fn === (this._emitter.listeners(name) as unknown)) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (once === true) {\n\t\t\tthis._emitter.once(eventName, fn, context)\n\t\t} else {\n\t\t\tthis._emitter.addListener(eventName, fn, context)\n\t\t}\n\t}\n\n\tremoveEventListeners(eventName?: EventName, fn?: ListenerFn): void {\n\t\tif (eventName) {\n\t\t\tthis._emitter.removeListener(eventName, fn)\n\t\t} else {\n\t\t\tthis.removeAllEventListeners()\n\t\t}\n\t}\n\n\tremoveAllEventListeners() {\n\t\tthis._emitter.removeAllListeners()\n\t}\n\n\tcountEventListeners(eventName?: EventName): number {\n\t\tif (eventName) {\n\t\t\treturn this._emitter.listeners(eventName).length\n\t\t} else {\n\t\t\tlet count = 0\n\n\t\t\tfor (const name of this._emitter.eventNames()) {\n\t\t\t\tcount += this._emitter.listeners(name).length\n\t\t\t}\n\n\t\t\treturn count\n\t\t}\n\t}\n\n\temit(eventName: EventName, ...args: unknown[]) {\n\t\tthis._emitter.emit(eventName, ...args)\n\t}\n}\n", "import { safeWindow } from \"../utils/safeWindow.ts\"\n\n// const performance = safeWindow.performance || {\n//   offset: Date.now(),\n//   now: () => Date.now() - this.offset\n// };\n\nconst _raf = (f: FrameRequestCallback) => {\n\tsetTimeout(f, 1 / 60)\n}\nconst __raf = /* @__PURE__ */ (() => safeWindow[\"requestAnimationFrame\"] || _raf)()\n\nexport const raf = (f: Function) => __raf(f as FrameRequestCallback)\n", "import { EventEmitter } from \"./EventEmitter.ts\"\nimport * as time from \"./Time.ts\"\n\nexport type LoopEventNames = \"render\" | \"update\" | \"finish\"\nexport type LoopDeltaCallback = (this: Loop, frame: number) => void\n\nlet LoopTimeStep = /* @__PURE__ */ (() => 1 / 60)()\n\n/**\n * @public\n */\nexport class Loop extends EventEmitter<LoopEventNames> {\n\tprivate _started = false\n\tprivate _frame = 0\n\tprivate _frameTasks: Function[] = []\n\n\t/**\n\t * To add a task to be done at the end of a frame.\n\t * Tasks added from a task will be ignored. These will run after loop events have been processed.\n\t * @internal\n\t */\n\taddFrameTask(task: Function) {\n\t\tthis._frameTasks.push(task)\n\t}\n\n\tprivate _processFrameTasks() {\n\t\tconst postEventTasks = this._frameTasks\n\t\tconst length = postEventTasks.length\n\t\tif (length === 0) return\n\n\t\tfor (let i = 0; i < length; i++) {\n\t\t\tpostEventTasks[i]?.()\n\t\t}\n\n\t\tpostEventTasks.length = 0\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tstatic set TimeStep(value: number) {\n\t\tLoopTimeStep = value\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tstatic get TimeStep() {\n\t\treturn LoopTimeStep\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tconstructor(start = false) {\n\t\tsuper()\n\t\tif (start) {\n\t\t\tthis.start()\n\t\t}\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tstart(): this {\n\t\tif (this._started) return this\n\n\t\tthis._frame = 0\n\t\tthis._started = true\n\t\ttime.raf(this.tick)\n\t\treturn this\n\t}\n\n\t/**\n\t * @internal\n\t * @deprecated Don\u2019t use `stop` as you could be stopping the MainLoop for others.\n\t */\n\tstop(): this {\n\t\tthis._started = false\n\t\treturn this\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tget frame() {\n\t\treturn this._frame\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tget time() {\n\t\treturn this._frame * LoopTimeStep\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tprivate tick = () => {\n\t\tif (!this._started) return\n\n\t\ttime.raf(this.tick)\n\n\t\tthis.emit(\"update\", this._frame, LoopTimeStep)\n\t\tthis.emit(\"render\", this._frame, LoopTimeStep)\n\t\tthis._processFrameTasks()\n\n\t\tthis._frame++\n\t}\n}\n\n/**\n * @internal\n *\n * This call is safe to be tree-shaken away as long as `new Loop()` is called with `start` set to `false` (or unset).\n */\nexport const MainLoop = /* @__PURE__ */ new Loop()\n", "import { safeWindow } from \"../utils/safeWindow.ts\"\n\ndeclare class WebKitPoint {\n\tx: number\n\ty: number\n\tconstructor(x: number, y: number)\n}\n\ndeclare global {\n\tinterface Window {\n\t\tWebKitPoint?: typeof WebKitPoint\n\t\twebkitConvertPointFromPageToNode?(node: Node, pt: WebKitPoint): WebKitPoint\n\t}\n}\n\nexport interface EventLike {\n\tpageX: number\n\tpageY: number\n\ttarget: EventTarget | null\n}\n\nexport function pointForEvent(event: EventLike, customTarget: EventTarget | null = null): { x: number; y: number } {\n\tlet target: HTMLElement | undefined\n\n\tif (customTarget instanceof HTMLElement) {\n\t\ttarget = customTarget\n\t}\n\n\tif (!target && event.target instanceof HTMLElement) {\n\t\ttarget = event.target\n\t}\n\n\tif (!target) {\n\t\treturn { x: event.pageX, y: event.pageY }\n\t}\n\n\t// Safari\n\tif (typeof safeWindow.webkitConvertPointFromPageToNode === \"function\") {\n\t\t// biome-ignore lint/style/noNonNullAssertion: it exists if the `in` check is true\n\t\tlet webkitPoint = new safeWindow.WebKitPoint!(event.pageX, event.pageY) // eslint-disable-line framer-studio/tscompat -- We check for support via the `typeof` check.\n\t\twebkitPoint = safeWindow.webkitConvertPointFromPageToNode(target, webkitPoint)\n\t\treturn { x: webkitPoint.x, y: webkitPoint.y }\n\t}\n\n\t// const t1 = performance.now()\n\n\t// All other browsers\n\t// TODO: This does not work with rotate yet\n\t// TODO: This doens't work with Chrome if the target is the Body tag.\n\tconst rect = target.getBoundingClientRect()\n\n\tconst width = parseFloat(target.style.width)\n\tconst height = parseFloat(target.style.height)\n\tconst scale = {\n\t\tx: width ? width / rect.width : 1,\n\t\ty: height ? height / rect.height : 1,\n\t}\n\n\tconst point = {\n\t\tx: scale.x * (event.pageX - rect.left - target.clientLeft + target.scrollLeft),\n\t\ty: scale.y * (event.pageY - rect.top - target.clientTop + target.scrollTop),\n\t}\n\n\treturn point\n}\n", "import { isTouch } from \"@framerjs/shared/src/environment.ts\"\nimport { MainLoop } from \"../core/Loop.ts\"\nimport { Point } from \"../render/types/Point.ts\"\nimport type { EventLike } from \"../utils/events.ts\"\nimport { pointForEvent } from \"../utils/events.ts\"\nimport type { FramerEventSession } from \"./FramerEventSession.ts\"\n\nexport type EventHandler = (event: FramerEvent) => void\n\n/**\n * @public\n */\nexport class FramerEvent {\n\t/**\n\t * @internal\n\t */\n\treadonly time = Date.now()\n\t/**\n\t * @internal\n\t */\n\treadonly loopTime = MainLoop.time\n\t/**\n\t * @internal\n\t */\n\treadonly point: Point\n\t/**\n\t * @internal\n\t */\n\treadonly devicePoint: Point\n\t/**\n\t * @internal\n\t */\n\treadonly target: EventTarget | null\n\t/**\n\t * @internal\n\t */\n\treadonly delta: Point\n\t/**\n\t * @internal\n\t */\n\tconstructor(\n\t\t/** @internal */ readonly originalEvent: MouseEvent | TouchEvent,\n\t\t/** @internal */ readonly session?: FramerEventSession,\n\t) {\n\t\tconst customTarget = (session && session.startEvent && session.startEvent.target) || originalEvent.target\n\t\tconst eventLike = FramerEvent.eventLikeFromOriginalEvent(originalEvent)\n\t\tthis.point = pointForEvent(eventLike, customTarget)\n\t\tconst deviceTarget = session && session.originElement ? session.originElement : document.body\n\t\tthis.devicePoint = pointForEvent(eventLike, deviceTarget)\n\t\tthis.target = originalEvent.target || null\n\t\tconst lastEvent = session && session.lastEvent\n\n\t\tif (originalEvent instanceof WheelEvent) {\n\t\t\tthis.delta = { x: originalEvent.deltaX, y: originalEvent.deltaY }\n\t\t} else if (lastEvent && this.devicePoint && lastEvent.devicePoint) {\n\t\t\tthis.delta = Point.subtract(this.devicePoint, lastEvent.devicePoint)\n\t\t} else {\n\t\t\tthis.delta = { x: 0, y: 0 }\n\t\t}\n\t}\n\n\tprivate static eventLikeFromOriginalEvent(originalEvent: MouseEvent | TouchEvent): EventLike {\n\t\tif (\"touches\" in originalEvent) {\n\t\t\t/* eslint-disable framer-studio/tscompat -- Safari desktop doesn't support TouchEvent. */\n\t\t\tlet touches = originalEvent.touches\n\n\t\t\tif (!touches || !touches.length) {\n\t\t\t\t// touchend events only have changed touches\n\t\t\t\tif (originalEvent.changedTouches && originalEvent.changedTouches.length) {\n\t\t\t\t\ttouches = originalEvent.changedTouches\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst firstTouch = touches[0]\n\t\t\tif (!touches || !firstTouch) {\n\t\t\t\treturn { pageX: 0, pageY: 0, target: null }\n\t\t\t}\n\t\t\t// We use the clientX first, because that one is not affected by the page's scrolling\n\t\t\t// (which influences the event position even if the body is position: fixed)\n\t\t\tconst pageX = firstTouch.clientX || firstTouch.screenX || firstTouch.pageX\n\t\t\tconst pageY = firstTouch.clientY || firstTouch.screenY || firstTouch.pageY\n\t\t\treturn {\n\t\t\t\tpageX,\n\t\t\t\tpageY,\n\t\t\t\ttarget: originalEvent.target,\n\t\t\t}\n\t\t\t/* eslint-enable framer-studio/tscompat */\n\t\t}\n\n\t\treturn originalEvent\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tvelocity(t: number) {\n\t\treturn this.session ? this.session.velocity(t) : { x: 0, y: 0 }\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tget offset() {\n\t\treturn this.session ? this.session.offset(this) : { x: 0, y: 0 }\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tget isLeftMouseClick(): boolean | undefined {\n\t\tif (isTouch()) {\n\t\t\treturn undefined\n\t\t}\n\t\tif (\"button\" in this.originalEvent && \"buttons\" in this.originalEvent && \"ctrlKey\" in this.originalEvent) {\n\t\t\treturn (this.originalEvent.button === 0 || this.originalEvent.buttons === 1) && !this.originalEvent.ctrlKey\n\t\t}\n\t\treturn false\n\t}\n}\n", "import hoistNonReactStatic from \"hoist-non-react-statics\"\nimport React from \"react\"\nimport type { Change, TransactionId } from \"../../animation/Animatable/Animatable.ts\"\nimport { Animatable, isAnimatable } from \"../../animation/Animatable/Animatable.ts\"\nimport { InertialScrollAnimator } from \"../../animation/Animators/InertialScrollAnimator.ts\"\nimport type { AnimationInterface } from \"../../animation/Drivers/AnimationDriver.ts\"\nimport { MainLoopAnimationDriver } from \"../../animation/Drivers/MainLoopDriver.ts\"\nimport type { EventHandler, FramerEvent } from \"../../events/FramerEvent.ts\"\nimport type { ConstraintPercentage } from \"../../render/types/Constraints.ts\"\nimport type { Point } from \"../../render/types/Point.ts\"\nimport { Rect } from \"../../render/types/Rect.ts\"\nimport { isFiniteNumber } from \"../../render/utils/isFiniteNumber.ts\"\nimport { asRecord } from \"../../utils/asRecord.ts\"\nimport { assert } from \"../../utils/assert.ts\"\nimport { clamp } from \"../../utils/math.ts\"\nimport type { WithMouseWheelHandler, WithPanHandlers } from \"./WithEvents.tsx\"\n\nexport const DraggingContext = /* @__PURE__ */ React.createContext({ dragging: false })\n\n/**\n * @internal\n */\nexport type Axis = \"x\" | \"y\"\n\nexport type Handler = () => void\nexport type DragHandler<Draggable> = (draggable: Draggable) => void\nexport type DragEventHandler<Draggable> = (event: FramerEvent, draggable: Draggable) => void\n/**\n * @internal\n */\nexport type ScrollAnimation = MainLoopAnimationDriver<InertialScrollAnimator, number, unknown>\nexport interface DragEvents<Draggable> {\n\tonMove: (point: Point, draggable: Draggable) => void\n\t/**\n\t * @internal\n\t */\n\tonDragDirectionLockStart: (axis: Axis, draggable: Draggable) => void\n\tonDragAnimationStart: (animation: { x: AnimationInterface; y: AnimationInterface }, draggable: Draggable) => void\n\tonDragAnimationEnd: (animation: { x: AnimationInterface; y: AnimationInterface }, draggable: Draggable) => void\n\n\tonDragSessionStart: DragEventHandler<Draggable>\n\tonDragSessionMove: DragEventHandler<Draggable>\n\tonDragSessionEnd: DragEventHandler<Draggable>\n\n\tonDragStart: DragEventHandler<Draggable>\n\tonDragWillMove: DragEventHandler<Draggable>\n\tonDragDidMove: DragEventHandler<Draggable>\n\tonDragEnd: DragEventHandler<Draggable>\n}\n\nexport interface DraggableSpecificProps<Draggable> extends Partial<DragEvents<Draggable>> {\n\tmomentum: boolean\n\tmomentumOptions: {\n\t\tfriction: number\n\t\ttolerance: number\n\t}\n\tmomentumVelocityMultiplier: number\n\tspeedX: number\n\tspeedY: number\n\tbounce: boolean\n\tbounceOptions: {\n\t\tfriction: number\n\t\ttension: number\n\t\ttolerance: number\n\t}\n\tdirectionLock: boolean\n\tdirectionLockThreshold: {\n\t\tx: number\n\t\ty: number\n\t}\n\toverdrag: boolean\n\toverdragScale: number\n\tpixelAlign: boolean\n\tvelocityTimeout: number\n\tvelocityScale: number\n\thorizontal: boolean\n\tvertical: boolean\n\tconstraints: Partial<Rect>\n\tmouseWheel: boolean\n}\n\nexport interface DraggableProps<Draggable> extends DraggableSpecificProps<Draggable> {\n\tenabled: boolean\n}\n\nexport interface WithDraggingComponentTypeConstraints extends WithPanHandlers, WithMouseWheelHandler {\n\tleft: number | Animatable<number> | null\n\ttop: number | Animatable<number> | null\n\twidth: number | ConstraintPercentage | Animatable<number>\n\theight: number | ConstraintPercentage | Animatable<number>\n}\n\ninterface DraggingState {\n\tisDragging: boolean\n}\n\nexport function WithDragging<TOriginalProps extends Partial<WithDraggingComponentTypeConstraints>>(\n\tComponent: React.ComponentType<TOriginalProps & Partial<DraggableProps<unknown>>>,\n): React.ComponentClass<TOriginalProps & Partial<DraggableProps<unknown>>> {\n\tclass WithDraggingHOC extends React.Component<Partial<DraggableProps<WithDraggingHOC>>, DraggingState> {\n\t\tstatic draggingDefaultProps: DraggableProps<WithDraggingHOC> = {\n\t\t\tmomentum: true,\n\t\t\tmomentumOptions: { friction: 2.1, tolerance: 1 },\n\t\t\tmomentumVelocityMultiplier: 800,\n\t\t\tspeedX: 1,\n\t\t\tspeedY: 1,\n\t\t\tbounce: true,\n\t\t\tbounceOptions: { friction: 40, tension: 200, tolerance: 1 },\n\t\t\tdirectionLock: false,\n\t\t\tdirectionLockThreshold: { x: 10, y: 10 },\n\t\t\toverdrag: true,\n\t\t\toverdragScale: 0.5,\n\t\t\tpixelAlign: true,\n\t\t\tvelocityTimeout: 100,\n\t\t\tvelocityScale: 890,\n\t\t\thorizontal: true,\n\t\t\tvertical: true,\n\t\t\tenabled: true,\n\t\t\tconstraints: {},\n\t\t\tmouseWheel: false,\n\t\t}\n\n\t\tstatic defaultProps: Partial<TOriginalProps> & DraggableProps<WithDraggingHOC> = Object.assign(\n\t\t\t{},\n\t\t\tComponent.defaultProps,\n\t\t\tWithDraggingHOC.draggingDefaultProps,\n\t\t)\n\n\t\toverride state: DraggingState = {\n\t\t\tisDragging: false,\n\t\t}\n\n\t\tx = Animatable(0)\n\t\ty = Animatable(0)\n\n\t\tdeclare props: TOriginalProps & DraggableProps<WithDraggingHOC>\n\n\t\tconstructor(props: Partial<DraggableProps<WithDraggingHOC>>, defaultProps: DraggableProps<WithDraggingHOC>) {\n\t\t\tsuper(props, defaultProps)\n\t\t\tconst x: number | Animatable<number> | null | undefined = this.props.left\n\t\t\tconst y: number | Animatable<number> | null | undefined = this.props.top\n\t\t\tif (!x) {\n\t\t\t\t// TODO: 0 should come from Component.defaultProps\n\t\t\t\tthis.x = Animatable(0)\n\t\t\t} else if (isAnimatable(x)) {\n\t\t\t\tthis.x = x\n\t\t\t} else {\n\t\t\t\tthis.x = Animatable(x)\n\t\t\t}\n\t\t\tif (!y) {\n\t\t\t\t// TODO: 0 should come from Component.defaultProps\n\t\t\t\tthis.y = Animatable(0)\n\t\t\t} else if (isAnimatable(y)) {\n\t\t\t\tthis.y = y\n\t\t\t} else {\n\t\t\t\tthis.y = Animatable(y)\n\t\t\t}\n\t\t\tthis.x.onUpdate(this.onChangePosition)\n\t\t\tthis.y.onUpdate(this.onChangePosition)\n\t\t\tconst constraints: Partial<Rect> | undefined = this.props.constraints\n\t\t\tif (constraints) {\n\t\t\t\tthis.constraints = constraints\n\t\t\t}\n\t\t}\n\n\t\toverride UNSAFE_componentWillReceiveProps(props: TOriginalProps & Partial<DraggableProps<WithDraggingHOC>>) {\n\t\t\tif (this.props.left !== props.left && isFiniteNumber(props.left)) {\n\t\t\t\tthis.x.set(props.left)\n\t\t\t}\n\t\t\tif (this.props.top !== props.top && isFiniteNumber(props.top)) {\n\t\t\t\tthis.y.set(props.top)\n\t\t\t}\n\t\t\tconst constraints: Partial<Rect> | undefined = props.constraints\n\t\t\tif (constraints) {\n\t\t\t\tthis.constraints = constraints\n\t\t\t}\n\t\t}\n\n\t\tonChangePosition = (change: Change<number>, transaction: TransactionId) => {\n\t\t\tif (change.value === change.oldValue) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (this.props.onMove) {\n\t\t\t\tthis.props.onMove(this.point, this)\n\t\t\t}\n\t\t}\n\n\t\tprivate get point(): Point {\n\t\t\treturn { x: this.x.get(), y: this.y.get() }\n\t\t}\n\n\t\tprivate setPoint(point: Point, axis: Axis | null = null) {\n\t\t\tswitch (axis) {\n\t\t\t\tcase \"x\":\n\t\t\t\t\tthis.x.set(point.x)\n\t\t\t\t\tbreak\n\t\t\t\tcase \"y\":\n\t\t\t\t\tthis.y.set(point.y)\n\t\t\t\t\tbreak\n\t\t\t\tcase null:\n\t\t\t\t\tthis.x.set(point.x)\n\t\t\t\t\tthis.y.set(point.y)\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tprivate getValue(axis: Axis): number {\n\t\t\tswitch (axis) {\n\t\t\t\tcase \"x\":\n\t\t\t\t\treturn this.x.get()\n\t\t\t\tcase \"y\":\n\t\t\t\t\treturn this.y.get()\n\t\t\t}\n\t\t}\n\t\tprivate get width(): number {\n\t\t\tconst width: number | ConstraintPercentage | Animatable<number> | undefined = this.props.width\n\t\t\tif (!width) {\n\t\t\t\t// TODO this should come from the Dragged props' defaults\n\t\t\t\treturn 100\n\t\t\t}\n\t\t\tif (isAnimatable(width)) {\n\t\t\t\treturn width.get()\n\t\t\t}\n\t\t\tif (typeof width === \"string\") {\n\t\t\t\treturn parseFloat(width)\n\t\t\t}\n\t\t\treturn width\n\t\t}\n\n\t\tprivate get height(): number {\n\t\t\tconst height: number | ConstraintPercentage | Animatable<number> | undefined = this.props.height\n\t\t\tif (!height) {\n\t\t\t\t// TODO this should come from the Dragged props' defaults\n\t\t\t\treturn 100\n\t\t\t}\n\t\t\tif (isAnimatable(height)) {\n\t\t\t\treturn height.get()\n\t\t\t}\n\t\t\tif (typeof height === \"string\") {\n\t\t\t\treturn parseFloat(height)\n\t\t\t}\n\t\t\treturn height\n\t\t}\n\t\tisMoving = false\n\t\tprivate isAnimating = false\n\t\tprivate directionLockAxis: Axis | null = null\n\t\tprivate layerStartPoint: Point | null = null\n\t\tprivate correctedLayerStartPoint: Point | null = null\n\t\tprivate previousPoint: Point | null = null\n\t\tprivate _constraints: Rect | null = null\n\t\tprivate animation: { x: ScrollAnimation; y: ScrollAnimation } | null = null\n\t\tprivate get constraints(): Partial<Rect> | null {\n\t\t\treturn this._constraints\n\t\t}\n\t\tprivate set constraints(value: Partial<Rect> | null) {\n\t\t\tif (value !== null && typeof value === \"object\") {\n\t\t\t\tthis._constraints = {\n\t\t\t\t\tx: value.x || 0,\n\t\t\t\t\ty: value.y || 0,\n\t\t\t\t\twidth: value.width || 0,\n\t\t\t\t\theight: value.height || 0,\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis._constraints = null\n\t\t\t}\n\t\t\tif (this._constraints) {\n\t\t\t\tthis.updateAnimationConstraints(this._constraints)\n\t\t\t}\n\t\t}\n\n\t\tget constraintsOffset(): Point {\n\t\t\tif (!this.constraints) {\n\t\t\t\treturn { x: 0, y: 0 }\n\t\t\t}\n\t\t\tconst { minX, minY, maxX, maxY } = this.calculateConstraints(this._constraints)\n\t\t\tconst point = this.point\n\t\t\tconst constrainedPoint = { x: clamp(point.x, minX, maxX), y: clamp(point.y, minY, maxY) }\n\t\t\tconst offset = { x: point.x - constrainedPoint.x, y: point.y - constrainedPoint.y }\n\t\t\treturn offset\n\t\t}\n\n\t\tget isBeyondConstraints() {\n\t\t\tconst constraintsOffset = this.constraintsOffset\n\t\t\tif (constraintsOffset.x !== 0) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif (constraintsOffset.y !== 0) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\n\t\tpanStart = (event: FramerEvent) => {\n\t\t\tif (!this.props.enabled) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// LayerDraggable._globalDidDrag = false\n\n\t\t\t// Only reset isMoving if this was not animating when we were clicking\n\t\t\t// so we can use it to detect a click versus a drag.\n\t\t\tthis.isMoving = this.isAnimating\n\n\t\t\t// Stop any animations influencing the position, but no others.\n\t\t\t// this.layer.animations().forEach(animation => {\n\t\t\t//     props = animation.props\n\t\t\t//     if (props.hasOwnProperty(\"x\") || props.hasOwnProperty(\"y\")) {\n\t\t\t//         return animation.stop()\n\t\t\t//     }\n\t\t\t// })\n\n\t\t\tthis.stopAnimation()\n\t\t\tthis.resetdirectionLock()\n\n\t\t\t// Store original layer position\n\t\t\tthis.layerStartPoint = this.point\n\t\t\tthis.correctedLayerStartPoint = this.point\n\n\t\t\t// // If we are beyond bounds, we need to correct for the scaled clamping from the last drag,\n\t\t\t// // hence the 1 / overdragScale\n\t\t\tif (this._constraints && this.props.bounce) {\n\t\t\t\tthis.correctedLayerStartPoint = this.constrainPosition(\n\t\t\t\t\tthis.correctedLayerStartPoint,\n\t\t\t\t\tthis._constraints,\n\t\t\t\t\t1 / this.props.overdragScale,\n\t\t\t\t)\n\t\t\t}\n\t\t\tthis.previousPoint = this.correctedLayerStartPoint\n\n\t\t\tif (!this.state.isDragging) {\n\t\t\t\tthis.setState({ isDragging: true })\n\t\t\t}\n\t\t\tif (this.props.onDragSessionStart) {\n\t\t\t\tthis.props.onDragSessionStart(event, this)\n\t\t\t}\n\t\t}\n\n\t\tpan = (event: FramerEvent) => {\n\t\t\tconst {\n\t\t\t\tenabled,\n\t\t\t\tspeedX,\n\t\t\t\tspeedY,\n\t\t\t\tdirectionLock,\n\t\t\t\toverdragScale,\n\t\t\t\tvertical,\n\t\t\t\thorizontal,\n\t\t\t\tpixelAlign,\n\t\t\t\tonDragStart,\n\t\t\t\tonDragWillMove,\n\t\t\t\tonDragDidMove,\n\t\t\t\tonDragSessionMove,\n\t\t\t} = this.props\n\n\t\t\tif (!enabled) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tassert(this.previousPoint !== null, \"previousPoint must be set in panStart()\")\n\t\t\tlet point = { ...this.previousPoint }\n\t\t\tpoint.x += event.delta.x * speedX\n\t\t\tpoint.y += event.delta.y * speedY\n\t\t\t// Save the point for the next update so we have the unrounded, unconstrained value\n\t\t\tthis.previousPoint = { ...point }\n\n\t\t\t// // Constraints and overdrag\n\t\t\tif (this._constraints) {\n\t\t\t\tpoint = this.constrainPosition(point, this._constraints, overdragScale)\n\t\t\t}\n\n\t\t\t// // Direction lock\n\t\t\tif (directionLock) {\n\t\t\t\tif (this.directionLockAxis === null) {\n\t\t\t\t\tconst offset = event.offset\n\t\t\t\t\toffset.x = offset.x * speedX\n\t\t\t\t\toffset.y = offset.y * speedY\n\t\t\t\t\tthis.updatedirectionLock(offset)\n\t\t\t\t\treturn\n\t\t\t\t} else {\n\t\t\t\t\tassert(this.layerStartPoint !== null, \"layerStartPoint must be set in panStart()\")\n\t\t\t\t\tif (this.directionLockAxis === \"y\") {\n\t\t\t\t\t\tpoint.x = this.layerStartPoint.x\n\t\t\t\t\t}\n\t\t\t\t\tif (this.directionLockAxis === \"x\") {\n\t\t\t\t\t\tpoint.y = this.layerStartPoint.y\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Update the dragging status\n\t\t\tif (!this.state.isDragging) {\n\t\t\t\tthis.setState({ isDragging: true })\n\t\t\t\tthis.isMoving = true\n\t\t\t\tif (onDragStart) {\n\t\t\t\t\tonDragStart(event, this)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (onDragWillMove) {\n\t\t\t\tonDragWillMove(event, this)\n\t\t\t}\n\n\t\t\t// // Align every drag to pixels\n\t\t\tif (pixelAlign) {\n\t\t\t\tpoint.x = Math.round(point.x)\n\t\t\t\tpoint.y = Math.round(point.y)\n\t\t\t}\n\t\t\tif (!horizontal && !vertical) {\n\t\t\t\t// Don't move over any axis\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tlet axis: Axis | null = null\n\t\t\tif (horizontal && !vertical) {\n\t\t\t\taxis = \"x\"\n\t\t\t} else if (vertical && !horizontal) {\n\t\t\t\taxis = \"y\"\n\t\t\t}\n\t\t\tthis.setPoint(point, axis)\n\n\t\t\tif (onDragDidMove) {\n\t\t\t\tonDragDidMove(event, this)\n\t\t\t}\n\n\t\t\tif (onDragSessionMove) {\n\t\t\t\tonDragSessionMove(event, this)\n\t\t\t}\n\t\t}\n\n\t\tpanEnd = (event: FramerEvent) => {\n\t\t\tif (!this.props.enabled) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// LayerDraggable._globalDidDrag = false\n\n\t\t\t// Start the simulation prior to emitting the DragEnd event.\n\t\t\t// This way, if the user calls layer.animate on DragEnd, the simulation will\n\t\t\t// be canceled by the user's animation (if the user animates x and/or y).\n\t\t\tthis.startAnimation(event)\n\n\t\t\tconst { onDragSessionEnd, onDragEnd } = this.props\n\t\t\tif (this.state.isDragging) {\n\t\t\t\tif (onDragEnd) {\n\t\t\t\t\tonDragEnd(event, this)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (onDragSessionEnd) {\n\t\t\t\tonDragSessionEnd(event, this)\n\t\t\t}\n\n\t\t\t// Set isDragging after DragEnd is fired, so that calls to calculateVelocity()\n\t\t\t// still returns dragging velocity - both in case the user calls calculateVelocity(),\n\t\t\t// (which would return a stale value before the simulation had finished one tick)\n\t\t\t// and because @_start currently calls calculateVelocity().\n\t\t\tif (this.state.isDragging) {\n\t\t\t\tthis.setState({ isDragging: false })\n\t\t\t}\n\n\t\t\t// reset isMoving if not animating, otherwise animation start/stop will reset it\n\t\t\tthis.isMoving = this.isAnimating\n\t\t}\n\n\t\t// Mouse Wheel\n\n\t\tmouseWheelStart = (event: FramerEvent) => {\n\t\t\tthis.correctedLayerStartPoint = this.point\n\t\t\tthis.previousPoint = this.correctedLayerStartPoint\n\t\t\tthis.stopAnimation()\n\t\t}\n\n\t\tmouseWheel = (event: FramerEvent) => {\n\t\t\tconst { enabled, speedX, speedY, vertical, horizontal, pixelAlign, onDragWillMove, onDragDidMove, mouseWheel } =\n\t\t\t\tthis.props\n\n\t\t\tif (!mouseWheel || !enabled) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tlet point = { ...this.point }\n\n\t\t\tpoint.x -= event.delta.x * speedX\n\t\t\tpoint.y -= event.delta.y * speedY\n\n\t\t\t// // Constraints and overdrag\n\t\t\tif (this._constraints) {\n\t\t\t\tpoint = this.constrainPosition(point, this._constraints, 0, false)\n\t\t\t}\n\n\t\t\tif (onDragWillMove) {\n\t\t\t\tonDragWillMove(event, this)\n\t\t\t}\n\n\t\t\t// // Align every drag to pixels\n\t\t\tif (pixelAlign) {\n\t\t\t\tpoint.x = Math.round(point.x)\n\t\t\t\tpoint.y = Math.round(point.y)\n\t\t\t}\n\t\t\tif (!horizontal && !vertical) {\n\t\t\t\t// Don't move over any axis\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tlet axis: Axis | null = null\n\t\t\tif (horizontal && !vertical) {\n\t\t\t\taxis = \"x\"\n\t\t\t} else if (vertical && !horizontal) {\n\t\t\t\taxis = \"y\"\n\t\t\t}\n\n\t\t\tthis.setPoint(point, axis)\n\n\t\t\tif (onDragDidMove) {\n\t\t\t\tonDragDidMove(event, this)\n\t\t\t}\n\t\t}\n\n\t\tmouseWheelEnd = (event: FramerEvent) => {}\n\n\t\tprivate clampAndScale(value: number, min: number, max: number, scale: number, scaleAllowed: boolean) {\n\t\t\tif (!scaleAllowed) {\n\t\t\t\treturn clamp(value, min, max)\n\t\t\t}\n\n\t\t\tif (value < min) {\n\t\t\t\tvalue = min + (value - min) * scale\n\t\t\t}\n\t\t\tif (value > max) {\n\t\t\t\tvalue = max + (value - max) * scale\n\t\t\t}\n\t\t\treturn value\n\t\t}\n\n\t\tprivate calculateConstraints(bounds: Rect | null) {\n\t\t\tif (!bounds) {\n\t\t\t\treturn { minX: Infinity, maxX: Infinity, minY: Infinity, maxY: Infinity }\n\t\t\t}\n\n\t\t\t// Correct the constraints if the layer size exceeds the constraints\n\t\t\tif (bounds.width < this.width) {\n\t\t\t\tbounds.width = this.width\n\t\t\t}\n\t\t\tif (bounds.height < this.height) {\n\t\t\t\tbounds.height = this.height\n\t\t\t}\n\n\t\t\tconst constraints = {\n\t\t\t\tminX: Rect.minX(bounds),\n\t\t\t\tmaxX: Rect.maxX(bounds),\n\t\t\t\tminY: Rect.minY(bounds),\n\t\t\t\tmaxY: Rect.maxY(bounds),\n\t\t\t}\n\n\t\t\t// It makes sense to take the dimensions of the object into account\n\t\t\tconstraints.maxX -= this.width\n\t\t\tconstraints.maxY -= this.height\n\n\t\t\treturn constraints\n\t\t}\n\n\t\tprivate constrainPosition(proposedPoint: Point, bounds: Rect, scale: number, overdrag = this.props.overdrag) {\n\t\t\tconst { maxX, maxY, minX, minY } = this.calculateConstraints(this._constraints)\n\n\t\t\tconst point = {\n\t\t\t\tx: this.clampAndScale(proposedPoint.x, minX, maxX, scale, overdrag),\n\t\t\t\ty: this.clampAndScale(proposedPoint.y, minY, maxY, scale, overdrag),\n\t\t\t}\n\n\t\t\tif (this.props.speedX === 0 || this.props.horizontal === false) {\n\t\t\t\tpoint.x = proposedPoint.x\n\t\t\t}\n\t\t\tif (this.props.speedY === 0 || this.props.vertical === false) {\n\t\t\t\tpoint.y = proposedPoint.y\n\t\t\t}\n\n\t\t\treturn point\n\t\t}\n\n\t\t/* private */ updatedirectionLock(correctedDelta: Point) {\n\t\t\tif (Math.abs(correctedDelta.y) > this.props.directionLockThreshold.y) {\n\t\t\t\tthis.directionLockAxis = \"y\"\n\t\t\t} else if (Math.abs(correctedDelta.x) > this.props.directionLockThreshold.x) {\n\t\t\t\tthis.directionLockAxis = \"x\"\n\t\t\t}\n\n\t\t\tif (this.directionLockAxis !== null) {\n\t\t\t\tif (this.props.onDragDirectionLockStart) {\n\t\t\t\t\tthis.props.onDragDirectionLockStart(this.directionLockAxis, this)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprivate resetdirectionLock() {\n\t\t\tthis.directionLockAxis = null\n\t\t}\n\n\t\t// Inertial scroll animation\n\n\t\tprivate setupAnimation() {\n\t\t\tif (this.animation) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tthis.animation = { x: this.setupAnimationForAxis(\"x\"), y: this.setupAnimationForAxis(\"y\") }\n\n\t\t\tthis.updateAnimationConstraints(this._constraints)\n\t\t}\n\n\t\tprivate setupAnimationForAxis(axis: Axis) {\n\t\t\tconst animator = new InertialScrollAnimator({\n\t\t\t\tmomentum: this.props.momentumOptions,\n\t\t\t\tbounce: this.props.bounceOptions,\n\t\t\t})\n\t\t\tconst updateCallback = (value: number) => {\n\t\t\t\tthis.onAnimationStep(axis, value)\n\t\t\t}\n\t\t\tconst doneCallback = () => {\n\t\t\t\tthis.onAnimationStop(axis)\n\t\t\t}\n\t\t\treturn new MainLoopAnimationDriver(animator, updateCallback, doneCallback)\n\t\t}\n\n\t\tprivate updateAnimationConstraints(constraints: Rect | null) {\n\t\t\t// This is where we let the animators know about our constraints\n\t\t\tif (!this.animation) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (constraints) {\n\t\t\t\tconst { minX, minY, maxX, maxY } = this.calculateConstraints(constraints)\n\t\t\t\tthis.animation.x.animator.setLimits(minX, maxX)\n\t\t\t\tthis.animation.y.animator.setLimits(minY, maxY)\n\t\t\t} else {\n\t\t\t\tthis.animation.x.animator.setLimits(-Infinity, Infinity)\n\t\t\t\tthis.animation.y.animator.setLimits(-Infinity, Infinity)\n\t\t\t}\n\t\t}\n\n\t\tprivate onAnimationStep = (axis: Axis, value: number) => {\n\t\t\tif (axis === \"x\" && this.props.horizontal === false) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (axis === \"y\" && this.props.vertical === false) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tlet delta = 0\n\t\t\tif (this.constraints) {\n\t\t\t\tif (this.props.bounce) {\n\t\t\t\t\tdelta = value - this.getValue(axis)\n\t\t\t\t} else {\n\t\t\t\t\tconst { minX, minY, maxX, maxY } = this.calculateConstraints(this._constraints)\n\t\t\t\t\tif (axis === \"x\") {\n\t\t\t\t\t\tdelta = clamp(value, minX, maxX) - this.getValue(axis)\n\t\t\t\t\t}\n\t\t\t\t\tif (axis === \"y\") {\n\t\t\t\t\t\tdelta = clamp(value, minY, maxY) - this.getValue(axis)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdelta = value - this.getValue(axis)\n\t\t\t}\n\n\t\t\tconst updatePoint = this.point\n\t\t\tif (axis === \"x\") {\n\t\t\t\tupdatePoint[axis] = updatePoint[axis] + delta\n\t\t\t}\n\t\t\tif (axis === \"y\") {\n\t\t\t\tupdatePoint[axis] = updatePoint[axis] + delta\n\t\t\t}\n\t\t\tthis.setPoint(updatePoint, axis)\n\t\t}\n\n\t\tprivate onAnimationStop = (axis: Axis) => {\n\t\t\tif (axis === \"x\" && this.props.horizontal === false) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (axis === \"y\" && this.props.vertical === false) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (!this.animation) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Round the end position to whole pixels\n\t\t\tif (this.props.pixelAlign) {\n\t\t\t\tconst point = this.point\n\t\t\t\tpoint.x = Math.round(point.x)\n\t\t\t\tpoint.y = Math.round(point.y)\n\t\t\t\tthis.setPoint(point, axis)\n\t\t\t}\n\n\t\t\t// See if both animators are stopped\n\t\t\tif (this.animation.x.isFinished() && this.animation.y.isFinished()) {\n\t\t\t\treturn this.stopAnimation()\n\t\t\t}\n\t\t}\n\n\t\tprivate startAnimation(event: FramerEvent) {\n\t\t\t// The types of animation that we can have are:\n\t\t\t// 1) Momentum inside constraints\n\t\t\t// 2) Momentum inside constraints to outside constraints bounce\n\t\t\t// 3) Release outside constraints bounce\n\t\t\t// 4) Momentum without constraints\n\n\t\t\tconst { momentum, bounce, momentumVelocityMultiplier, speedX, speedY, overdrag, onDragAnimationStart } =\n\t\t\t\tthis.props\n\t\t\tif (!(momentum || bounce)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (this.isBeyondConstraints === false && momentum === false) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (this.isBeyondConstraints === false && this.state.isDragging === false) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// If overdrag is disabled, we need to not have a bounce animation\n\t\t\t// when the cursor is outside of the dragging bounds for an axis.\n\t\t\tconst { minX, minY, maxX, maxY } = this.calculateConstraints(this._constraints)\n\n\t\t\tconst startAnimationX = overdrag === true || (this.point.x > minX && this.point.x < maxX)\n\t\t\tconst startAnimationY = overdrag === true || (this.point.y > minY && this.point.y < maxY)\n\n\t\t\tif (startAnimationX === startAnimationY && startAnimationY === false) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst velocity = event.velocity(0.1)\n\t\t\tlet velocityX = velocity.x * momentumVelocityMultiplier * speedX\n\t\t\tlet velocityY = velocity.y * momentumVelocityMultiplier * speedY\n\t\t\tif (this.directionLockAxis === \"x\") {\n\t\t\t\tvelocityY = 0\n\t\t\t}\n\t\t\tif (this.directionLockAxis === \"y\") {\n\t\t\t\tvelocityX = 0\n\t\t\t}\n\n\t\t\tthis.setupAnimation()\n\t\t\tthis.isAnimating = true\n\t\t\tthis.isMoving = true\n\n\t\t\tif (!this.animation) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.animation.x.animator.setState({ x: this.point.x, v: velocityX })\n\t\t\tif (startAnimationX) {\n\t\t\t\tthis.animation.x.play()\n\t\t\t}\n\n\t\t\tthis.animation.y.animator.setState({ x: this.point.y, v: velocityY })\n\t\t\tif (startAnimationY) {\n\t\t\t\tthis.animation.y.play()\n\t\t\t}\n\n\t\t\tif (onDragAnimationStart) {\n\t\t\t\tonDragAnimationStart(this.animation, this)\n\t\t\t}\n\t\t}\n\n\t\tstopAnimation = () => {\n\t\t\tthis.isAnimating = false\n\t\t\tthis.isMoving = false\n\n\t\t\tif (!this.animation) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tthis.animation.x.cancel()\n\t\t\tthis.animation.y.cancel()\n\n\t\t\tif (this.props.onDragAnimationEnd) {\n\t\t\t\tthis.props.onDragAnimationEnd(this.animation, this)\n\t\t\t}\n\t\t\tthis.animation = null\n\t\t}\n\n\t\tprivate wrapHandler(ownHandler: EventHandler, originalHandler: EventHandler | undefined) {\n\t\t\tif (!originalHandler) {\n\t\t\t\treturn ownHandler\n\t\t\t}\n\t\t\treturn (event: FramerEvent) => {\n\t\t\t\townHandler(event)\n\t\t\t\toriginalHandler(event)\n\t\t\t}\n\t\t}\n\n\t\toverride render() {\n\t\t\tconst originalProps = { ...this.props }\n\t\t\tObject.keys(WithDraggingHOC.draggingDefaultProps).forEach(key => {\n\t\t\t\tdelete asRecord(originalProps)[key]\n\t\t\t})\n\n\t\t\toriginalProps.onPanStart = this.wrapHandler(this.panStart, originalProps.onPanStart)\n\t\t\toriginalProps.onPan = this.wrapHandler(this.pan, originalProps.onPan)\n\t\t\toriginalProps.onPanEnd = this.wrapHandler(this.panEnd, originalProps.onPanEnd)\n\t\t\toriginalProps.onMouseWheelStart = this.wrapHandler(this.mouseWheelStart, originalProps.onMouseWheelStart)\n\t\t\toriginalProps.onMouseWheel = this.wrapHandler(this.mouseWheel, originalProps.onMouseWheel)\n\t\t\toriginalProps.onMouseWheelEnd = this.wrapHandler(this.mouseWheelEnd, originalProps.onMouseWheelEnd)\n\t\t\toriginalProps.left = this.x\n\t\t\toriginalProps.top = this.y\n\n\t\t\treturn (\n\t\t\t\t<DraggingContext.Provider value={{ dragging: this.state.isDragging }}>\n\t\t\t\t\t<Component {...originalProps} />\n\t\t\t\t</DraggingContext.Provider>\n\t\t\t)\n\t\t}\n\t}\n\n\tconst withDragging: React.ComponentClass<Partial<DraggableProps<unknown>>> = WithDraggingHOC\n\n\thoistNonReactStatic(withDragging, Component)\n\t// We are casting it here, because Typescript 3.7 gave us a bunch of trouble\n\t// when trying to make the component props actually have this type. Therefor\n\t// the type of the props of the component are without TOriginalProps, and we\n\t// cast it here to include it.\n\treturn withDragging as React.ComponentClass<TOriginalProps & Partial<DraggableProps<unknown>>, unknown>\n}\n", "/**\n * @internal\n */\nexport type Interpolator<Value> = (progress: number) => Value\n\n/**\n * @public\n */\nexport interface Interpolation<Value = any> {\n\t/**\n\t * @internal\n\t */\n\tinterpolate(from: Value, to: Value): Interpolator<Value>\n\t/**\n\t * difference(from, to) calculates a measure of difference between two values,\n\t * such that for every value of from, to and x holds:\n\t * interpolator = interpolate(from, to)\n\t * total = difference(from, to)\n\t * interpolator( difference(from, x) / total ) === x\n\t * @internal\n\t */\n\tdifference(from: Value, to: Value): number\n}\n\n/**\n * @internal\n */\nexport interface Interpolatable<Value> {\n\tinterpolationFor(value: Value, currentInterpolation: Interpolation): Interpolation<Value> | undefined\n}\n\n/**\n * @internal\n */\nexport function isInterpolatable<Value>(value: any): value is Interpolatable<Value> {\n\treturn typeof value === \"function\" && value.interpolationFor && typeof value.interpolationFor === \"function\"\n}\n\n/**\n * @public\n */\nexport const Interpolation = {\n\t/**\n\t * @param from -\n\t * @param to -\n\t * @internal\n\t */\n\thandleUndefined: <Value>(from: Value, to: Value): [Value, Value] => {\n\t\tif (from === undefined) {\n\t\t\tfrom = to\n\t\t}\n\t\tif (to === undefined) {\n\t\t\tto = from\n\t\t}\n\t\treturn [from, to]\n\t},\n}\n", "import { Interpolation } from \"./Interpolation.ts\"\n\nexport const NumberInterpolation: Interpolation<number> = {\n\tinterpolate(from: number, to: number): (progress: number) => number {\n\t\t;[from, to] = Interpolation.handleUndefined(from, to)\n\t\tconst a1 = from\n\t\tconst b1 = to - a1\n\t\treturn (progress: number): number => {\n\t\t\tconst value = a1 + b1 * progress\n\t\t\treturn value\n\t\t}\n\t},\n\tdifference(from: number, to: number): number {\n\t\treturn to - from\n\t},\n}\n", "/**\n * @internal\n */\nexport interface State {\n\tx: number\n\tv: number\n}\n\n/**\n * @internal\n */\nexport type AccelerationFunction = (state: State) => number\n\n/**\n * @internal\n */\ninterface Delta {\n\tdx: number\n\tdv: number\n}\n\n/**\n * @internal\n */\nexport class Integrator {\n\tprivate accelerationForState: AccelerationFunction\n\n\tpublic constructor(accelerationFunction: AccelerationFunction) {\n\t\tthis.accelerationForState = accelerationFunction\n\t}\n\n\tpublic integrateState(state: State, dt: number) {\n\t\tconst a = this.evaluateState(state)\n\t\tconst b = this.evaluateStateWithDerivative(state, dt * 0.5, a)\n\t\tconst c = this.evaluateStateWithDerivative(state, dt * 0.5, b)\n\t\tconst d = this.evaluateStateWithDerivative(state, dt, c)\n\n\t\tconst dxdt = (1.0 / 6.0) * (a.dx + 2.0 * (b.dx + c.dx) + d.dx)\n\t\tconst dvdt = (1.0 / 6.0) * (a.dv + 2.0 * (b.dv + c.dv) + d.dv)\n\n\t\tstate.x = state.x + dxdt * dt\n\t\tstate.v = state.v + dvdt * dt\n\n\t\treturn state\n\t}\n\n\tprivate evaluateState(initialState: State): Delta {\n\t\tconst dv = this.accelerationForState(initialState)\n\t\treturn { dx: initialState.v, dv: dv }\n\t}\n\n\tprivate evaluateStateWithDerivative(initialState: State, dt: number, derivative: Delta): Delta {\n\t\tconst state = {\n\t\t\tx: initialState.x + derivative.dx * dt,\n\t\t\tv: initialState.v + derivative.dv * dt,\n\t\t}\n\t\tconst output = {\n\t\t\tdx: state.v,\n\t\t\tdv: this.accelerationForState(state),\n\t\t}\n\t\treturn output\n\t}\n}\n", "import type { Animator } from \"./Animator.ts\"\nimport type { State } from \"./Integrator.ts\"\nimport { Integrator } from \"./Integrator.ts\"\n\nexport interface Options {\n\tvelocity: number\n\tfriction: number\n\ttolerance: number\n}\n/**\n * @internal\n * @deprecated\n */\nexport class FrictionAnimator implements Animator<number, Partial<Options>> {\n\toptions: Options\n\n\tprivate state: State\n\tprivate integrator: Integrator\n\tpublic constructor(options: Partial<Options>) {\n\t\tthis.options = {\n\t\t\tvelocity: 0,\n\t\t\tfriction: 2,\n\t\t\ttolerance: 1 / 10,\n\t\t}\n\t\tObject.assign(this.options, options)\n\t\tthis.state = {\n\t\t\tx: 0,\n\t\t\tv: this.options.velocity,\n\t\t}\n\n\t\tthis.integrator = new Integrator(state => -(this.options.friction * state.v))\n\t}\n\n\tpublic setFrom(value: number) {\n\t\tthis.state.x = value\n\t}\n\n\tpublic setTo(value: number) {}\n\n\tpublic setVelocity(velocity: number) {\n\t\tthis.state.v = velocity\n\t}\n\n\tpublic getState(): State {\n\t\treturn this.state\n\t}\n\n\tpublic isReady() {\n\t\treturn true\n\t}\n\n\tpublic next(delta: number): number {\n\t\tthis.state = this.integrator.integrateState(this.state, delta)\n\t\treturn this.state.x\n\t}\n\n\tpublic isFinished() {\n\t\treturn Math.abs(this.state.v) < this.options.tolerance\n\t}\n}\n", "const epsilon: number = 0.001\nconst minDuration: number = 0.01\nconst maxDuration: number = 10.0\nconst minDamping: number = /* @__PURE__ */ (() => Number.MIN_VALUE)()\nconst maxDamping: number = 1\ntype NumFunc = (num: number) => number\nexport interface CurveOptions {\n\ttension: number\n\tfriction: number\n\tvelocity: number\n}\n// Newton's method\nfunction approximateRoot(func: NumFunc, derivative: NumFunc, initialGuess: number, times: number = 12): number {\n\tlet result = initialGuess\n\tfor (let i = 1, end = times, asc = 1 <= end; asc ? i < end : i > end; asc ? i++ : i--) {\n\t\tresult = result - func(result) / derivative(result)\n\t}\n\treturn result\n}\n\nfunction angularFrequency(undampedFrequency: number, dampingRatio: number): number {\n\treturn undampedFrequency * Math.sqrt(1 - Math.pow(dampingRatio, 2))\n}\n\nexport const SpringCurveValueConverter = {\n\tcomputeDampingRatio: (tension: number, friction: number, mass: number = 1): number => {\n\t\treturn friction / (2 * Math.sqrt(mass * tension))\n\t},\n\n\t// Tries to compute the duration of a spring,\n\t// but can't for certain velocities and if dampingRatio >= 1\n\t// In those cases it will return null\n\tcomputeDuration: (tension: number, friction: number, velocity: number = 0, mass: number = 1): number | null => {\n\t\tlet duration\n\t\tconst dampingRatio = SpringCurveValueConverter.computeDampingRatio(tension, friction)\n\t\tconst undampedFrequency = Math.sqrt(tension / mass)\n\t\t// This is basically duration extracted out of the envelope functions\n\t\tif (dampingRatio < 1) {\n\t\t\tconst a = Math.sqrt(1 - Math.pow(dampingRatio, 2))\n\t\t\tconst b = velocity / (a * undampedFrequency)\n\t\t\tconst c = dampingRatio / a\n\t\t\tconst d = -((b - c) / epsilon)\n\t\t\tif (d <= 0) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tduration = Math.log(d) / (dampingRatio * undampedFrequency)\n\t\t} else {\n\t\t\treturn null\n\t\t}\n\t\treturn duration\n\t},\n\n\tcomputeDerivedCurveOptions: (\n\t\tdampingRatio: number,\n\t\tduration: number,\n\t\tvelocity: number = 0,\n\t\tmass: number = 1,\n\t): CurveOptions => {\n\t\tlet derivative: NumFunc, envelope: NumFunc\n\t\tdampingRatio = Math.max(Math.min(dampingRatio, maxDamping), minDamping)\n\t\tduration = Math.max(Math.min(duration, maxDuration), minDuration)\n\n\t\tif (dampingRatio < 1) {\n\t\t\tenvelope = function (envelopeUndampedFrequency) {\n\t\t\t\tconst exponentialDecay = envelopeUndampedFrequency * dampingRatio\n\t\t\t\tconst currentDisplacement = exponentialDecay * duration\n\t\t\t\tconst a = exponentialDecay - velocity\n\t\t\t\tconst b = angularFrequency(envelopeUndampedFrequency, dampingRatio)\n\t\t\t\tconst c = Math.exp(-currentDisplacement)\n\t\t\t\treturn epsilon - (a / b) * c\n\t\t\t}\n\n\t\t\tderivative = function (derivativeUndampedFrequency) {\n\t\t\t\tconst exponentialDecay = derivativeUndampedFrequency * dampingRatio\n\t\t\t\tconst currentDisplacement = exponentialDecay * duration\n\t\t\t\tconst d = currentDisplacement * velocity + velocity\n\t\t\t\tconst e = Math.pow(dampingRatio, 2) * Math.pow(derivativeUndampedFrequency, 2) * duration\n\t\t\t\tconst f = Math.exp(-currentDisplacement)\n\t\t\t\tconst g = angularFrequency(Math.pow(derivativeUndampedFrequency, 2), dampingRatio)\n\t\t\t\tconst factor = -envelope(derivativeUndampedFrequency) + epsilon > 0 ? -1 : 1\n\t\t\t\treturn (factor * ((d - e) * f)) / g\n\t\t\t}\n\t\t} else {\n\t\t\tenvelope = function (envelopeUndampedFrequency) {\n\t\t\t\tconst a = Math.exp(-envelopeUndampedFrequency * duration)\n\t\t\t\tconst b = (envelopeUndampedFrequency - velocity) * duration + 1\n\t\t\t\treturn -epsilon + a * b\n\t\t\t}\n\n\t\t\tderivative = function (derivativeUndampedFrequency) {\n\t\t\t\tconst a = Math.exp(-derivativeUndampedFrequency * duration)\n\t\t\t\tconst b = (velocity - derivativeUndampedFrequency) * Math.pow(duration, 2)\n\t\t\t\treturn a * b\n\t\t\t}\n\t\t}\n\n\t\tconst result = {\n\t\t\ttension: 100,\n\t\t\tfriction: 10,\n\t\t\tvelocity,\n\t\t}\n\n\t\tconst initialGuess = 5 / duration\n\t\tconst undampedFrequency = approximateRoot(envelope, derivative, initialGuess)\n\t\tif (!Number.isNaN(undampedFrequency)) {\n\t\t\tresult.tension = Math.pow(undampedFrequency, 2) * mass\n\t\t\tresult.friction = dampingRatio * 2 * Math.sqrt(mass * result.tension)\n\t\t}\n\t\treturn result\n\t},\n}\n", "import type { Interpolation, Interpolator } from \"../../interpolation/Interpolation.ts\"\nimport { assert } from \"../../utils/assert.ts\"\nimport type { Animator } from \"./Animator.ts\"\nimport type { State } from \"./Integrator.ts\"\nimport { Integrator } from \"./Integrator.ts\"\nimport { SpringCurveValueConverter } from \"./SpringCurveValueConverter.ts\"\n\nexport const SpringTensionFrictionDefaults: TensionFrictionSpringOptions = /* @__PURE__ */ (() => ({\n\ttension: 500,\n\tfriction: 10,\n\ttolerance: 1 / 10000,\n\tvelocity: 0,\n}))()\n\nexport const SpringDampingDurationDefaults: DampingDurationSpringOptions = {\n\tdampingRatio: 1,\n\tduration: 1,\n\tvelocity: 0,\n\tmass: 1,\n}\n\nexport interface TensionFrictionSpringOptions {\n\ttension: number\n\tfriction: number\n\ttolerance: number\n\tvelocity: number\n}\n\nexport interface DampingDurationSpringOptions {\n\tdampingRatio: number\n\tduration: number\n\tvelocity: number\n\tmass: number\n}\n\nexport type SpringOptions = TensionFrictionSpringOptions | DampingDurationSpringOptions\n\nfunction isDampingDurationSpringOptions(options: Partial<SpringOptions>): options is DampingDurationSpringOptions {\n\tif (!options) {\n\t\treturn false\n\t}\n\treturn (\n\t\ttypeof (options as Partial<DampingDurationSpringOptions>).dampingRatio === \"number\" ||\n\t\ttypeof (options as Partial<DampingDurationSpringOptions>).duration === \"number\" ||\n\t\ttypeof (options as Partial<DampingDurationSpringOptions>).mass === \"number\"\n\t)\n}\n\n/**\n * Animator class using a spring curve\n * @internal\n * @deprecated Use the `transition` prop instead\n */\nexport class SpringAnimator<Value> implements Animator<Value, SpringOptions> {\n\tprivate options: TensionFrictionSpringOptions\n\tprivate current: Value | undefined\n\tprivate destination: Value | undefined\n\n\tprivate difference: number | undefined\n\tprivate state: State\n\tprivate integrator: Integrator\n\tprivate interpolator: Interpolator<Value> | undefined\n\n\tpublic constructor(\n\t\toptions: Partial<SpringOptions>,\n\t\tprivate interpolation: Interpolation<Value>,\n\t) {\n\t\tlet _opt: Partial<TensionFrictionSpringOptions>\n\t\tif (isDampingDurationSpringOptions(options)) {\n\t\t\tconst toPass = { ...SpringDampingDurationDefaults, ...options }\n\t\t\t_opt = SpringCurveValueConverter.computeDerivedCurveOptions(\n\t\t\t\ttoPass.dampingRatio,\n\t\t\t\ttoPass.duration,\n\t\t\t\ttoPass.velocity,\n\t\t\t\ttoPass.mass,\n\t\t\t)\n\t\t} else {\n\t\t\t_opt = options as Partial<TensionFrictionSpringOptions>\n\t\t}\n\t\tthis.options = { ...SpringTensionFrictionDefaults, ..._opt }\n\n\t\tthis.state = {\n\t\t\tx: 0,\n\t\t\tv: this.options.velocity,\n\t\t}\n\n\t\tthis.integrator = new Integrator(state => -this.options.tension * state.x - this.options.friction * state.v)\n\t}\n\n\tpublic isReady() {\n\t\treturn this.interpolator !== undefined && this.difference !== undefined\n\t}\n\n\tpublic next(delta: number): Value {\n\t\tthis.state = this.integrator.integrateState(this.state, delta)\n\t\tassert(this.interpolator !== undefined, \"setFrom() or setTo() must be called before next()\")\n\t\tconst value = this.interpolator(this.progress())\n\t\treturn value\n\t}\n\n\tpublic isFinished() {\n\t\tconst positionNearZero = Math.abs(this.state.x) < this.options.tolerance\n\t\tconst velocityNearZero = Math.abs(this.state.v) < this.options.tolerance\n\t\treturn positionNearZero && velocityNearZero\n\t}\n\n\tpublic setFrom(value: Value) {\n\t\tthis.current = value\n\t\tthis.updateInterpolator()\n\t}\n\n\tpublic setVelocity(velocity: number) {\n\t\tthis.state.v = velocity\n\t}\n\n\tprogress(): number {\n\t\tassert(this.difference !== undefined, \"setTo() must be called before progress()\")\n\t\treturn 1 - this.state.x / this.difference\n\t}\n\n\t// The spring always settles to 0, so we create an interpolation to the destination\n\t// And calculate the progress based on the current state and the span of the interpolation\n\t// This lets us integrate over state.x, even though Value is generic\n\tpublic setTo(value: Value) {\n\t\tassert(this.current !== undefined, \"setFrom() must be called before setTo()\")\n\t\tthis.destination = value\n\t\tthis.difference = this.interpolation.difference(this.destination, this.current)\n\t\tthis.state.x = this.difference\n\t\tthis.updateInterpolator()\n\t}\n\n\t/** @internal */\n\tpublic getState(): State {\n\t\treturn this.state\n\t}\n\n\tupdateInterpolator() {\n\t\tif (this.current === undefined || this.destination === undefined) {\n\t\t\treturn\n\t\t}\n\t\tthis.interpolator = this.interpolation.interpolate(this.current, this.destination)\n\t}\n}\n", "import { NumberInterpolation } from \"../../interpolation/NumberInterpolation.ts\"\nimport type { Animator } from \"./Animator.ts\"\nimport { FrictionAnimator } from \"./FrictionAnimator.ts\"\nimport type { State } from \"./Integrator.ts\"\nimport { SpringAnimator } from \"./SpringAnimator.ts\"\n\nexport const Defaults = {\n\tvelocity: 0,\n\tmin: 0,\n\tmax: 0,\n\tmomentum: {\n\t\tfriction: 2,\n\t\ttolerance: 10,\n\t},\n\tbounce: {\n\t\ttension: 500,\n\t\tfriction: 10,\n\t\ttolerance: 1,\n\t},\n}\n\nexport type Options = typeof Defaults\n\n/**\n * @internal\n * @deprecated\n */\nexport class InertialScrollAnimator implements Animator<number, Options> {\n\tprivate options: Options\n\tprivate current: number | undefined\n\tprivate frictionAnimator: FrictionAnimator\n\tprivate springAnimator: SpringAnimator<number>\n\tprivate useSpring: boolean\n\tpublic constructor(options: Partial<Options>) {\n\t\tthis.options = Object.assign({ ...Defaults }, options)\n\n\t\tthis.frictionAnimator = new FrictionAnimator({\n\t\t\tfriction: this.options.momentum.friction,\n\t\t\ttolerance: this.options.momentum.tolerance,\n\t\t\tvelocity: this.options.velocity,\n\t\t})\n\n\t\tthis.springAnimator = new SpringAnimator(\n\t\t\t{\n\t\t\t\ttension: this.options.bounce.tension,\n\t\t\t\tfriction: this.options.bounce.friction,\n\t\t\t\ttolerance: this.options.bounce.tolerance,\n\t\t\t\tvelocity: this.options.velocity,\n\t\t\t},\n\t\t\tNumberInterpolation,\n\t\t)\n\t\tthis.useSpring = false\n\t}\n\n\tpublic isReady() {\n\t\treturn true\n\t}\n\n\tpublic next(delta: number): number {\n\t\tthis.current = this.currentAnimator.next(delta)\n\t\tif (!this.useSpring) {\n\t\t\tthis.tryTransitionToSpring()\n\t\t}\n\t\t// console.log(this.current, this.useSpring)\n\t\treturn this.current\n\t}\n\n\tget currentAnimator(): SpringAnimator<number> | FrictionAnimator {\n\t\tif (this.useSpring) {\n\t\t\treturn this.springAnimator\n\t\t}\n\t\treturn this.frictionAnimator\n\t}\n\n\tpublic isFinished(): boolean {\n\t\treturn this.currentAnimator.isFinished()\n\t}\n\n\tget state(): State {\n\t\treturn this.currentAnimator.getState()\n\t}\n\n\tpublic setFrom(value: number) {\n\t\tthis.setState({ x: value, v: this.state.v })\n\t}\n\n\tpublic setState(state: State) {\n\t\tthis.frictionAnimator.setFrom(state.x)\n\t\tthis.frictionAnimator.setVelocity(state.v)\n\n\t\tif (this.isValidState()) {\n\t\t\treturn this.tryTransitionToSpring()\n\t\t} else {\n\t\t\tlet bound: number = 0\n\t\t\tif (this.state.x <= this.options.min) {\n\t\t\t\tbound = this.options.min\n\t\t\t}\n\t\t\tif (this.state.x >= this.options.max) {\n\t\t\t\tbound = this.options.max\n\t\t\t}\n\t\t\treturn this.transitionToSpring(bound)\n\t\t}\n\t}\n\n\tpublic setTo(destination: number) {\n\t\tthis.frictionAnimator.setTo(destination)\n\t\tthis.springAnimator.setTo(destination)\n\t}\n\n\tpublic setLimits(min: number, max: number) {\n\t\tthis.options.min = min\n\t\tthis.options.max = max\n\t}\n\n\t// If the position is outside the min and max bounds, and traveling\n\t// further away, then transition from friction to spring animation\n\n\tprivate tryTransitionToSpring() {\n\t\tconst belowMinWithVelocity = this.state.x < this.options.min && this.state.v <= 0\n\t\tconst aboveMaxWithVelocity = this.state.x > this.options.max && this.state.v >= 0\n\n\t\tif (belowMinWithVelocity || aboveMaxWithVelocity) {\n\t\t\tlet bound: number\n\t\t\tif (belowMinWithVelocity) {\n\t\t\t\tbound = this.options.min\n\t\t\t} else {\n\t\t\t\tbound = this.options.max\n\t\t\t}\n\t\t\tthis.transitionToSpring(bound)\n\t\t} else {\n\t\t\tthis.useSpring = false\n\t\t}\n\t}\n\n\tprivate transitionToSpring(bound: number) {\n\t\tthis.springAnimator.setFrom(this.state.x)\n\t\tthis.springAnimator.setVelocity(this.state.v)\n\t\tthis.springAnimator.setTo(bound)\n\t\tthis.useSpring = true\n\t}\n\n\t// If the position is outside the min and max bounds, but traveling\n\t// back towards the bounds, check if the velocity is sufficient to\n\t// carry the position back within bounds. If it is, let friction do the\n\t// work. If not, the state is invalid, so use the spring.\n\n\tprivate isValidState(): boolean {\n\t\t// Note that if velocity is 0, the state is still valid (should use spring,\n\t\t// not friction), and we don't want to divide by 0 later in the check.\n\t\tconst belowMinTravelingBack = this.state.x < this.options.min && this.state.v > 0\n\t\tconst aboveMaxTravelingBack = this.state.x > this.options.max && this.state.v < 0\n\n\t\tif (belowMinTravelingBack || aboveMaxTravelingBack) {\n\t\t\tlet bound: number\n\t\t\tif (belowMinTravelingBack) {\n\t\t\t\tbound = this.options.min\n\t\t\t} else {\n\t\t\t\tbound = this.options.max\n\t\t\t}\n\n\t\t\tconst friction = this.frictionAnimator.options.friction\n\t\t\tconst solution = 1 - (friction * (bound - this.state.x)) / this.state.v\n\n\t\t\treturn solution > 0\n\t\t}\n\n\t\treturn true\n\t}\n\n\t// The math behind _isValidState:\n\t//\n\t// 1. Integrate the friction animator's acceleration to find velocity\n\t//\n\t//         a = - k * v\n\t//     dv/dt = - k * v\n\t// Int(dv/v) = - k * Int(dt)\n\t//      ln v = - k * t + C\n\t//\n\t// => Solve for C at t = 0\n\t//\n\t// ln v(0) = - k * 0 + C\n\t// ln v(0) = C\n\t//\n\t// => Plug C back into v(t)\n\t//\n\t//     ln v = - k * t + ln v(0)\n\t// e^(ln v) = e^(- k * t) + e^(ln v(0))\n\t//        v = v(0) * e^(- k * t)\n\t//\n\t// 2. Integrate velocity to find position\n\t//\n\t// Int(v) = v(0) * Int(e^(- k * t))\n\t//      x = - v(0) * e^(-k * t) / k + C\n\t//\n\t// => Solve for C at t = 0\n\t//\n\t//            x(0) = - v(0) * e^(-k * 0) / k + C\n\t//            x(0) = - v(0) / k + C\n\t// x(0) + v(0) / k = C\n\t//\n\t// => Plug C back into x(t)\n\t//\n\t// x = - v(0) * e^(-k * t) / k + x(0) + v(0) / k\n\t//\n\t// 3. Check if a (real) solution exists for t for position x\n\t//\n\t//                                x = - v(0) * e^(-k * t) / k + x(0) + v(0) / k\n\t//                         x - x(0) = - v(0) * e^(-k * t) / k + v(0) / k\n\t//                   k * (x - x(0)) = - v(0) * e^(-k * t) + v(0)\n\t//            k * (x - x(0)) - v(0) = - v(0) * e^(-k * t)\n\t// (k * (x - x(0)) - v(0)) / - v(0) = e^(-k * t)\n\t//       1 - (k * (x - x(0)) / v(0) = e^(-k * t)\n\t//   ln(1 - (k * (x - x(0)) / v(0)) = -k * t\n\t//\n\t// Therefore, a real solution exists if 1 - (k * (x - x(0)) / v(0) > 0\n}\n", "import type { Animator as AnimatorInterface } from \"../Animators/Animator.ts\"\n\n/**\n * @internal\n */\n// biome-ignore lint/suspicious/noExplicitAny: deprecated\nexport interface DriverClass<AnimatorClass extends AnimatorInterface<Value, Options>, Value, Options = any> {\n\tnew (\n\t\tanimator: AnimatorClass,\n\t\tupdateCallback: (value: Value) => void,\n\t\tdoneCallback?: (isFinished: boolean) => void,\n\t): AnimationDriver<AnimatorClass, Value, Options>\n}\n\n/**\n * @public\n */\nexport interface AnimationInterface {\n\t/**\n\t * @internal\n\t */\n\tplay(): void\n\tcancel(): void\n\t/**\n\t * @internal\n\t */\n\tfinish(): void\n\tisFinished(): boolean\n}\n\n/**\n * @internal\n */\nexport abstract class AnimationDriver<\n\tAnimatorClass extends AnimatorInterface<Value, Options>,\n\tValue,\n\tOptions,\n> implements AnimationInterface {\n\tconstructor(\n\t\tpublic animator: AnimatorClass,\n\t\tprotected updateCallback: (value: Value) => void,\n\t\tprotected finishedCallback?: (isFinished: boolean) => void,\n\t) {\n\t\tif (!this.animator.isReady()) {\n\t\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\t\tconsole.warn(\"AnimationDriver initialized with animator that isn't ready\")\n\t\t}\n\t}\n\n\tabstract play(): void\n\n\tprotected update = (frame: number, elapsed: number) => {\n\t\tif (this.animator.isFinished()) {\n\t\t\tthis.finish()\n\t\t} else {\n\t\t\tconst value = this.animator.next(elapsed)\n\t\t\tthis.updateCallback(value)\n\t\t}\n\t}\n\n\tabstract cancel(): void\n\n\tfinish(): void {\n\t\tif (this.finishedCallback) {\n\t\t\tthis.finishedCallback(this.animator.isFinished())\n\t\t}\n\t}\n\n\tisFinished(): boolean {\n\t\treturn this.animator.isFinished()\n\t}\n}\n", "import { MainLoop } from \"../../core/Loop.ts\"\nimport { RenderEnvironment, RenderTarget } from \"../../render/types/RenderEnvironment.ts\"\nimport type { Animator as AnimatorInterface } from \"../Animators/Animator.ts\"\nimport { AnimationDriver } from \"./AnimationDriver.ts\"\n\n/**\n * @internal\n */\nexport class MainLoopAnimationDriver<\n\tAnimator extends AnimatorInterface<Value, Options>,\n\tValue,\n\tOptions,\n> extends AnimationDriver<Animator, Value, Options> {\n\tplay() {\n\t\tif (RenderEnvironment.target !== RenderTarget.preview) {\n\t\t\t// If we're not in preview mode, don't use the animator,\n\t\t\t// but just call the done callback directly\n\t\t\tthis.finishedCallback && this.finishedCallback(false)\n\t\t\treturn\n\t\t}\n\t\tMainLoop.on(\"update\", this.update)\n\t}\n\n\tcancel() {\n\t\tMainLoop.off(\"update\", this.update)\n\t}\n\n\toverride finish() {\n\t\tMainLoop.off(\"update\", this.update)\n\t\tsuper.finish()\n\t}\n}\n", "/** No-op operation that casts an object to a record */\nexport const asRecord = <O extends object>(object: O) => object as Record<string | number | symbol, O[keyof O]>\n", "import type { MotionValue } from \"framer-motion\"\nimport React from \"react\"\nimport { isFiniteNumber } from \"../utils/isFiniteNumber.ts\"\nimport type { SizeConstraints, UserConstraintValues } from \"./Constraints.ts\"\nimport { ConstraintMask, ConstraintValues, DimensionType, valueToDimensionType } from \"./Constraints.ts\"\nimport type { Rect } from \"./Rect.ts\"\nimport type { Size } from \"./Size.ts\"\n\n// Constraint system that can switch between DOM and Constraint layout\n\nexport interface PositionProperties {\n\ttop: number | string\n\tright: number | string\n\tbottom: number | string\n\tleft: number | string\n\tcenter: \"x\" | \"y\" | boolean\n}\n\n/** @internal */\nexport interface SizeProperties extends SizeConstraints {\n\twidth: number | string\n\theight: number | string\n\tsize: number | string\n}\n\n/** @public */\nexport interface PositionStickyProperties {\n\t/** @internal */\n\tpositionSticky?: boolean\n\t/** @internal */\n\tpositionStickyTop?: number\n\t/** @internal */\n\tpositionStickyRight?: number\n\t/** @internal */\n\tpositionStickyBottom?: number\n\t/** @internal */\n\tpositionStickyLeft?: number\n}\n\nexport interface PositionFixedProperties {\n\t/** @internal */\n\tpositionFixed?: boolean\n}\n\nexport interface PositionAbsoluteProperties {\n\t/** @internal */\n\tpositionAbsolute?: boolean\n}\n\nexport interface LayoutProperties\n\textends\n\t\tPositionProperties,\n\t\tPositionStickyProperties,\n\t\tPositionFixedProperties,\n\t\tPositionAbsoluteProperties,\n\t\tSizeProperties {\n\t/** @internal */\n\twidthType?: DimensionType\n\t/** @internal */\n\theightType?: DimensionType\n}\n\nexport interface CustomConstraintProperties {\n\t/**\n\t * Aspect Ratio to keep when resizing\n\t * @public\n\t */\n\taspectRatio?: number | null\n\n\t/**\n\t * Used for Text and Graphics containers\n\t * @public\n\t */\n\tautoSize?: boolean\n\n\t/**\n\t * Use Vekter constraint layout system, disable DOM layout\n\t * @public\n\t */\n\tenabled: boolean\n\n\tintrinsicWidth?: number\n\tintrinsicHeight?: number\n}\n\nexport interface ConstraintConfiguration {\n\t/** @internal */\n\t_constraints: CustomConstraintProperties\n}\n\n/** @internal */\nexport interface NewConstraintProperties extends Partial<LayoutProperties>, ConstraintConfiguration {}\n\n// The old constraint system does not allow for strings, so this function checks if the layout props contain string values\n// In certain centering cases we can convert the strings to the old constraint system, so that logic is captured here\nfunction containsInvalidStringValues(props: Partial<NewConstraintProperties>): boolean {\n\t// We never allow right or bottom to be strings\n\tif (typeof props.right === \"string\") return true\n\tif (typeof props.bottom === \"string\") return true\n\n\t// Only allow a string for left, if it is part of the centering logic\n\tif (typeof props.left === \"string\" && (!props.center || props.center === \"y\")) {\n\t\t// We are not centering or only centering in the opposite direction\n\t\treturn true\n\t}\n\n\t// Only allow a string for top, if it is part of the centering logic\n\tif (typeof props.top === \"string\" && (!props.center || props.center === \"x\")) {\n\t\t// We are not centering or only centering in the opposite direction\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n/** @internal */\nexport function constraintsEnabled(props: Partial<NewConstraintProperties>): props is NewConstraintProperties {\n\tif (!props._constraints) return false\n\tif (containsInvalidStringValues(props)) return false\n\treturn props._constraints.enabled\n}\n\nfunction sizeFromFiniteNumberProps(props: Partial<NewConstraintProperties>): Size | null {\n\tconst { size } = props\n\tlet { width, height } = props\n\tif (isFiniteNumber(size)) {\n\t\tif (width === undefined) {\n\t\t\twidth = size\n\t\t}\n\t\tif (height === undefined) {\n\t\t\theight = size\n\t\t}\n\t}\n\tif (isFiniteNumber(width) && isFiniteNumber(height)) {\n\t\treturn {\n\t\t\twidth: width,\n\t\t\theight: height,\n\t\t}\n\t}\n\treturn null\n}\n\nfunction rectFromFiniteNumberProps(props: Partial<NewConstraintProperties>): Rect | null {\n\tconst size = sizeFromFiniteNumberProps(props)\n\tif (size === null) {\n\t\treturn null\n\t}\n\tconst { left, top } = props\n\tif (isFiniteNumber(left) && isFiniteNumber(top)) {\n\t\treturn {\n\t\t\tx: left,\n\t\t\ty: top,\n\t\t\t...size,\n\t\t}\n\t}\n\treturn null\n}\n\n/** @internal */\nexport function calculateRect(\n\tprops: Partial<NewConstraintProperties & Partial<{ size: number | string }>>,\n\tparentSize: ParentSize,\n\tpixelAlign: boolean = true,\n): Rect | null {\n\tif (props.positionFixed || props.positionAbsolute) return null\n\n\tconst parentSizeDisabled =\n\t\tparentSize === ParentSizeState.Disabled || parentSize === ParentSizeState.DisabledForCurrentLevel\n\n\tif (!constraintsEnabled(props) || parentSizeDisabled) {\n\t\treturn rectFromFiniteNumberProps(props)\n\t}\n\n\tconst constraintValues = getConstraintValues(props)\n\tconst enabledParentSize = deprecatedParentSize(parentSize)\n\t// We convert viewport sizing to fixed sizing when rendering with library components, so parentSizeForSizing and\n\t// parentSizeForPositioning are the same. Same for viewport, we convert vh min/max to fixed values when rendering\n\t// with library components.\n\tconst parentSizeInfo = enabledParentSize\n\t\t? { sizing: enabledParentSize, positioning: enabledParentSize, viewport: null }\n\t\t: null\n\treturn ConstraintValues.toRect(constraintValues, parentSizeInfo, null, pixelAlign, null)\n}\n\n/** @internal */\nexport function getConstraintValues(props: NewConstraintProperties): UserConstraintValues {\n\tconst { left, right, top, bottom, center, _constraints, size } = props\n\tlet { width, height } = props\n\tif (width === undefined) {\n\t\twidth = size\n\t}\n\tif (height === undefined) {\n\t\theight = size\n\t}\n\tconst { aspectRatio, autoSize } = _constraints\n\tconst constraintMask = ConstraintMask.quickfix({\n\t\tleft: isFiniteNumber(left),\n\t\tright: isFiniteNumber(right),\n\t\ttop: isFiniteNumber(top),\n\t\tbottom: isFiniteNumber(bottom),\n\t\twidthType: valueToDimensionType(width),\n\t\theightType: valueToDimensionType(height),\n\t\taspectRatio: aspectRatio || null,\n\t\tfixedSize: autoSize === true,\n\t})\n\n\tlet widthValue: number | null = null\n\tlet heightValue: number | null = null\n\n\tlet widthType = DimensionType.FixedNumber\n\tlet heightType = DimensionType.FixedNumber\n\n\tif (constraintMask.widthType !== DimensionType.FixedNumber && typeof width === \"string\") {\n\t\tconst parsedWidth = parseFloat(width)\n\n\t\tif (width.endsWith(\"fr\")) {\n\t\t\twidthType = DimensionType.FractionOfFreeSpace\n\t\t\twidthValue = parsedWidth\n\t\t} else if (width === \"auto\") {\n\t\t\twidthType = DimensionType.Auto\n\t\t} else {\n\t\t\t// Percentage\n\t\t\twidthType = DimensionType.Percentage\n\t\t\twidthValue = parsedWidth / 100\n\t\t}\n\t} else if (width !== undefined && typeof width !== \"string\") {\n\t\twidthValue = width\n\t}\n\n\tif (constraintMask.heightType !== DimensionType.FixedNumber && typeof height === \"string\") {\n\t\tconst parsedHeight = parseFloat(height)\n\n\t\tif (height.endsWith(\"fr\")) {\n\t\t\theightType = DimensionType.FractionOfFreeSpace\n\t\t\theightValue = parsedHeight\n\t\t} else if (height === \"auto\") {\n\t\t\theightType = DimensionType.Auto\n\t\t} else {\n\t\t\t// Percentage\n\t\t\theightType = DimensionType.Percentage\n\t\t\theightValue = parseFloat(height) / 100\n\t\t}\n\t} else if (height !== undefined && typeof height !== \"string\") {\n\t\theightValue = height\n\t}\n\n\tlet centerAnchorX = 0.5\n\tlet centerAnchorY = 0.5\n\t// XXX: is this\n\tif (center === true || center === \"x\") {\n\t\tconstraintMask.left = false\n\t\tif (typeof left === \"string\") {\n\t\t\tcenterAnchorX = parseFloat(left) / 100\n\t\t}\n\t}\n\tif (center === true || center === \"y\") {\n\t\tconstraintMask.top = false\n\t\tif (typeof top === \"string\") {\n\t\t\tcenterAnchorY = parseFloat(top) / 100\n\t\t}\n\t}\n\n\treturn {\n\t\t// Because we check isFiniteNumber when creating the masks,\n\t\t// We know that left, right, top and bottom are numbers if the mask is true for the corresponding value\n\t\t// We need to cast this because typescript does not understand that\n\t\tleft: constraintMask.left ? (left as number) : null,\n\t\tright: constraintMask.right ? (right as number) : null,\n\t\ttop: constraintMask.top ? (top as number) : null,\n\t\tbottom: constraintMask.bottom ? (bottom as number) : null,\n\t\twidthType,\n\t\theightType,\n\t\twidth: widthValue,\n\t\theight: heightValue,\n\t\taspectRatio: constraintMask.aspectRatio || null,\n\t\tcenterAnchorX: centerAnchorX,\n\t\tcenterAnchorY: centerAnchorY,\n\t\tminHeight: props.minHeight,\n\t\tmaxHeight: props.maxHeight,\n\t\tminWidth: props.minWidth,\n\t\tmaxWidth: props.maxWidth,\n\t}\n}\n\nexport enum ParentSizeState {\n\tUnknown, // There is no known ParentSize\n\tDisabled, // ParentSize should not be used for layout in the entire subtree\n\tDisabledForCurrentLevel, // ParentSize should not be used for layout in the current level of the hierarchy\n}\nexport type ParentSize = Size | ParentSizeState\n\n// Only exported for use in class components, otherwise use one of the hooks below\nexport const ConstraintsContext = /* @__PURE__ */ React.createContext<{\n\tparentSize: ParentSize\n}>({\n\tparentSize: ParentSizeState.Unknown,\n})\n\nexport function deprecatedParentSize(parentSize: ParentSize): Size | null {\n\tif (\n\t\tparentSize === ParentSizeState.Unknown ||\n\t\tparentSize === ParentSizeState.Disabled ||\n\t\tparentSize === ParentSizeState.DisabledForCurrentLevel\n\t) {\n\t\treturn null\n\t}\n\treturn parentSize\n}\n\n/** @internal */\nexport function useParentSize(): ParentSize {\n\treturn React.useContext(ConstraintsContext).parentSize\n}\n\nexport function isSize(o: ParentSize): o is Size {\n\treturn typeof o === \"object\"\n}\n\n/** @internal */\nexport const ProvideParentSize: React.FunctionComponent<{\n\tchildren?: React.ReactNode\n\tparentSize: ParentSize\n}> = props => {\n\tconst currentParentSize = useParentSize()\n\tconst { parentSize, children } = props\n\n\t// We are generating the memoKeys in runtime and react doesn't like it,\n\t// but it should be safe to ignore.\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: see above\n\tconst value = React.useMemo(\n\t\t() => ({ parentSize }),\n\n\t\t[getParentWidth(parentSize), getParentHeight(parentSize)],\n\t)\n\n\tif (currentParentSize === ParentSizeState.Disabled) {\n\t\treturn children ? <>{children}</> : null\n\t}\n\n\treturn <ConstraintsContext.Provider value={value}>{children}</ConstraintsContext.Provider>\n}\n\nfunction getParentWidth(parentSize: ParentSize): ParentSizeState | number {\n\treturn isSize(parentSize) ? parentSize.width : parentSize\n}\n\nfunction getParentHeight(parentSize: ParentSize): ParentSizeState | number {\n\treturn isSize(parentSize) ? parentSize.height : parentSize\n}\n\nexport const ConsumeParentSize = /* @__PURE__ */ (() => ConstraintsContext.Consumer)()\n\nexport function useProvideParentSize(node: React.ReactNode, parentSize: ParentSize): React.ReactNode {\n\treturn <ProvideParentSize parentSize={parentSize}>{node}</ProvideParentSize>\n}\n\nexport function useConstraints(props: Partial<NewConstraintProperties>): Rect | null {\n\tconst parentSize = useParentSize()\n\tconst calculatedRect = calculateRect(props, parentSize, true)\n\treturn calculatedRect\n}\n\nexport function isAutoSized({\n\twidth,\n\theight,\n}: {\n\twidth?: string | number | MotionValue\n\theight?: string | number | MotionValue\n}) {\n\treturn width === \"auto\" || width === \"min-content\" || height === \"auto\" || height === \"min-content\"\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport React from \"react\"\nimport type { AnimatableObject, Cancel, Change } from \"../../../animation/Animatable/index.ts\"\nimport { Animatable, isAnimatable } from \"../../../animation/Animatable/index.ts\"\nimport { ObservableObject } from \"../../../data/ObservableObject.ts\"\nimport { asRecord } from \"../../../utils/asRecord.ts\"\nimport type { BorderStyle } from \"../../style/BorderComponent.tsx\"\nimport { Border } from \"../../style/BorderComponent.tsx\"\nimport { backgroundImageFromProps } from \"../../style/backgroundImageFromProps.ts\"\nimport type { DeprecatedVisualProperties } from \"../../style/collectVisualStyleFromProps.ts\"\nimport { collectVisualStyleFromProps } from \"../../style/collectVisualStyleFromProps.ts\"\nimport type { BackgroundProperties, DeprecatedBackgroundProperties } from \"../../traits/Background.ts\"\nimport type { DeprecatedTransformProperties } from \"../../traits/Transform.ts\"\nimport { collectTransformFromProps, transformDefaults } from \"../../traits/Transform.ts\"\nimport type { ImageFit } from \"../../types/BackgroundImage.ts\"\nimport { BackgroundImage } from \"../../types/BackgroundImage.ts\"\nimport { Color } from \"../../types/Color/Color.ts\"\nimport type { ConstraintProperties } from \"../../types/Constraints.ts\"\nimport { ConstraintValues, constraintDefaults, isConstraintSupportingChild } from \"../../types/Constraints.ts\"\nimport { ConstraintsContext, ParentSizeState, ProvideParentSize } from \"../../types/NewConstraints.tsx\"\nimport type { Rect } from \"../../types/Rect.ts\"\nimport { RenderEnvironment, RenderTarget } from \"../../types/RenderEnvironment.ts\"\nimport type { Size } from \"../../types/Size.ts\"\nimport { isFiniteNumber } from \"../../utils/isFiniteNumber.ts\"\nimport { countNodeRender } from \"../../utils/performanceDebugging.ts\"\nimport type { LayerProps } from \"../Layer.tsx\"\nimport { Layer } from \"../Layer.tsx\"\n\n/** @internal */\nexport function cssBackgroundSize(size: ImageFit | undefined) {\n\tswitch (size) {\n\t\tcase \"fit\":\n\t\t\treturn \"contain\"\n\t\tcase \"stretch\":\n\t\t\treturn \"100% 100%\"\n\t\tdefault:\n\t\t\treturn \"cover\"\n\t}\n}\n\nfunction collectBackgroundImageFromProps(\n\tprops: Partial<DeprecatedBackgroundProperties & BackgroundProperties>,\n\tstyle: React.CSSProperties,\n): void {\n\tconst image = backgroundImageFromProps(props)\n\n\tif (image) {\n\t\tstyle.backgroundImage = `url(\"${image.src}\")`\n\t\tstyle.backgroundSize = cssBackgroundSize(image.fit)\n\t\tstyle.backgroundRepeat = \"no-repeat\"\n\t\tstyle.backgroundPosition = \"center\"\n\t}\n}\n\n/** @public */\nexport interface DeprecatedFrameProperties\n\textends ConstraintProperties, DeprecatedTransformProperties, DeprecatedVisualProperties {\n\t/**\n\t * Determines whether the Frame is current visible. Set to `true` by default.\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   return <Frame visible={false} />\n\t * }\n\t * ```\n\t */\n\tvisible: boolean\n\t/**\n\t * An optional name for the Frame.\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   return <Frame name=\"MyFrame\" />\n\t * }\n\t * ```\n\t */\n\tname?: string\n\t/**\n\t * Set to `true` to enable backface-visibility.\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   return <Frame backfaceVisibility={true} />\n\t * }\n\t * ```\n\t */\n\tbackfaceVisible?: boolean | Animatable<boolean>\n\t/**\n\t * Set the perspective on the z-plane.\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   return <Frame perspective={100px} />\n\t * }\n\t * ```\n\t */\n\tperspective?: number | Animatable<number>\n\t/**\n\t * Set to `true` to preserve 3D.\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   return <Frame preserve3d={true} />\n\t * }\n\t * ```\n\t */\n\tpreserve3d?: boolean | Animatable<boolean>\n\t/**\n\t * A border width for the frame. Can be either a single number for all sides or\n\t * an object describing each side. Set to `0` by default.\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   return <Frame borderWidth={{top: 10, bottom: 10}} />\n\t * }\n\t * ```\n\t */\n\tborderWidth: number | Partial<{ top: number; bottom: number; left: number; right: number }>\n\t/**\n\t * A border color for the Frame. Set to `\"#222\"` by default.\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   return <Frame borderColor=\"red\" />\n\t * }\n\t * ```\n\t */\n\tborderColor: string\n\t/**\n\t * A border style for the Frame. One of `\"solid\", \"dashed\", \"dotted\"` or `\"double\"`. Set to `\"solid\"` by default.\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   return <Frame borderStyle=\"dotted\" />\n\t * }\n\t * ```\n\t */\n\tborderStyle: BorderStyle\n\t/**\n\t * Additional CSSProperties to apply to the frame. Usage is exactly the same as with the\n\t * standard React style prop.\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   return <Frame style={{color: \"red\", backgroundColor: \"blue\"}} />\n\t * }\n\t * ```\n\t */\n\tstyle?: React.CSSProperties\n\t/**\n\t * An optional className for the Frame.\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   return <Frame className=\"my-frame\" />\n\t * }\n\t * ```\n\t */\n\tclassName?: string\n\t/** @internal */\n\t_initialStyle?: Partial<MotionStyle>\n}\n\nfunction toPixelString(value: number | string | undefined): string | undefined {\n\treturn isFiniteNumber(value) ? `${value}px` : value\n}\n\nfunction applyLayoutProp(\n\tstyle: React.CSSProperties,\n\tprops: DeprecatedCoreFrameProps,\n\tkey: keyof DeprecatedCoreFrameProps,\n) {\n\tif (props[key] !== undefined) {\n\t\tconst value = Animatable.get(props[key], undefined)\n\t\tasRecord(style)[key] = toPixelString(value as number | string)\n\t}\n}\n\ninterface DeprecatedFrameState {\n\tsize: AnimatableObject<Size> | Size | null\n}\n\n/** @public */\nexport interface DeprecatedCoreFrameProps extends DeprecatedFrameProperties, LayerProps {}\n\ndeclare class DeprecatedFrameType extends Layer<DeprecatedCoreFrameProps, DeprecatedFrameState> {\n\tcontext: React.ContextType<typeof ConstraintsContext>\n\tstatic supportsConstraints: boolean\n\tstatic defaultFrameSpecificProps: DeprecatedFrameProperties\n\tstatic readonly defaultProps: DeprecatedCoreFrameProps\n\tstatic rect(props: Partial<ConstraintProperties>): Rect\n\tget rect(): Rect\n\telement: HTMLDivElement | null\n\timageDidChange: boolean\n\tstate: DeprecatedFrameState\n\tstatic getDerivedStateFromProps(\n\t\tnextProps: Partial<DeprecatedCoreFrameProps>,\n\t\tprevState: DeprecatedFrameState,\n\t): DeprecatedFrameState | null\n\tstatic updatedSize(\n\t\tprops: Partial<DeprecatedCoreFrameProps>,\n\t\tstate: DeprecatedFrameState,\n\t): AnimatableObject<Size> | Size\n\tgetStyle(): React.CSSProperties\n\tpropsObserver?: AnimatableObject<DeprecatedCoreFrameProps>\n\tpropsObserverCancel?: Cancel\n\tsizeObserver?: AnimatableObject<Size>\n\tsizeObserverCancel?: Cancel\n\tlayoutChildren():\n\t\t| (\n\t\t\t\t| // biome-ignore lint/suspicious/noExplicitAny: deprecated code\n\t\t\t\t  React.ReactElement<any, string | React.JSXElementConstructor<any>>\n\t\t\t\t| React.FunctionComponentElement<{\n\t\t\t\t\t\t_forwardedOverrides: {\n\t\t\t\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: deprecated code\n\t\t\t\t\t\t\t[key: string]: any\n\t\t\t\t\t\t}\n\t\t\t\t  }>\n\t\t  )[]\n\t\t| null\n\t\t| undefined\n}\n\n/**\n * @public\n */\nexport const DeprecatedFrame: typeof DeprecatedFrameType = /* @__PURE__ */ (() => {\n\tclass DeprecatedFrameInner extends Layer<DeprecatedCoreFrameProps, DeprecatedFrameState> {\n\t\tdeclare context: React.ContextType<typeof ConstraintsContext>\n\n\t\tstatic supportsConstraints = true\n\t\tstatic defaultFrameSpecificProps: DeprecatedFrameProperties = {\n\t\t\t...constraintDefaults,\n\t\t\t...transformDefaults,\n\t\t\topacity: 1,\n\t\t\tbackground: Color(\"rgba(0, 170, 255, 0.3)\"),\n\t\t\tvisible: true,\n\t\t\tborderWidth: 0,\n\t\t\tborderColor: \"#222\",\n\t\t\tborderStyle: \"solid\",\n\t\t}\n\n\t\tstatic override readonly defaultProps: DeprecatedCoreFrameProps = {\n\t\t\t...Layer.defaultProps,\n\t\t\t...DeprecatedFrameInner.defaultFrameSpecificProps,\n\t\t}\n\n\t\tstatic rect(props: Partial<ConstraintProperties>): Rect {\n\t\t\tconst constraintValues = ConstraintValues.fromProperties(props)\n\t\t\tconst parentSizeInfo = props.parentSize\n\t\t\t\t? {\n\t\t\t\t\t\tsizing: props.parentSize,\n\t\t\t\t\t\tpositioning: props.parentSize,\n\t\t\t\t\t\tviewport: null,\n\t\t\t\t\t}\n\t\t\t\t: null\n\t\t\treturn ConstraintValues.toRect(constraintValues, parentSizeInfo, null, true)\n\t\t}\n\n\t\tget rect() {\n\t\t\treturn DeprecatedFrameInner.rect(this.props)\n\t\t}\n\n\t\telement: HTMLDivElement | null = null\n\t\timageDidChange = false\n\n\t\toverride state: DeprecatedFrameState = {\n\t\t\tsize: null,\n\t\t}\n\n\t\tstatic getDerivedStateFromProps(\n\t\t\tnextProps: Partial<DeprecatedCoreFrameProps>,\n\t\t\tprevState: DeprecatedFrameState,\n\t\t): DeprecatedFrameState | null {\n\t\t\tconst size = DeprecatedFrameInner.updatedSize(nextProps, prevState)\n\t\t\tconst { target } = RenderEnvironment\n\t\t\tconst nextBackgroundImageSrc =\n\t\t\t\tnextProps.background && BackgroundImage.isImageObject(nextProps.background) ? nextProps.background.src : null\n\t\t\tif (nextBackgroundImageSrc) {\n\t\t\t\treturn {\n\t\t\t\t\tsize: size,\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (prevState.size) {\n\t\t\t\tif (target === RenderTarget.preview) {\n\t\t\t\t\treturn null\n\t\t\t\t}\n\t\t\t\tif (prevState.size.width === size.width && prevState.size.height === size.height) {\n\t\t\t\t\treturn null\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tsize: size,\n\t\t\t}\n\t\t}\n\n\t\tstatic updatedSize(\n\t\t\tprops: Partial<DeprecatedCoreFrameProps>,\n\t\t\tstate: DeprecatedFrameState,\n\t\t): AnimatableObject<Size> | Size {\n\t\t\tconst rect = DeprecatedFrameInner.rect(props)\n\t\t\tlet size = state.size\n\t\t\tconst newSize = { width: rect.width, height: rect.height }\n\t\t\tconst { target } = RenderEnvironment\n\t\t\tif (!size) {\n\t\t\t\tif (target === RenderTarget.preview) {\n\t\t\t\t\tsize = ObservableObject(newSize, true)\n\t\t\t\t} else {\n\t\t\t\t\tsize = newSize\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (isAnimatable(size.width) && isAnimatable(size.height)) {\n\t\t\t\t\tsize.width.set(newSize.width)\n\t\t\t\t\tsize.height.set(newSize.height)\n\t\t\t\t} else {\n\t\t\t\t\tsize = newSize\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn size\n\t\t}\n\n\t\tgetStyle(): React.CSSProperties {\n\t\t\tconst rect = this.rect\n\t\t\tconst style: React.CSSProperties = {\n\t\t\t\tdisplay: \"block\",\n\t\t\t\tposition: \"absolute\",\n\t\t\t\twidth: `${rect.width}px`,\n\t\t\t\theight: `${rect.height}px`,\n\t\t\t\tpointerEvents: undefined, // TODO: this should be \"none\" for non-event consuming instances, for performance.\n\t\t\t\tuserSelect: \"none\",\n\t\t\t}\n\t\t\tlet left = Animatable.get<string | number | undefined>(this.props.left, undefined)\n\t\t\tlet top = Animatable.get<string | number | undefined>(this.props.top, undefined)\n\n\t\t\tObject.assign(style, this.props._initialStyle)\n\t\t\tconst hasParentSize = this.context.parentSize !== ParentSizeState.Disabled\n\n\t\t\tconst perspective = Animatable.get(this.props.perspective, undefined)\n\t\t\tstyle.perspective = perspective\n\t\t\tstyle.WebkitPerspective = perspective\n\n\t\t\tlet backfaceVisibility: \"visible\" | \"hidden\" | undefined = undefined\n\t\t\tconst backfaceVisible = Animatable.get(this.props.backfaceVisible, undefined)\n\n\t\t\tif (backfaceVisible === true) {\n\t\t\t\tbackfaceVisibility = \"visible\"\n\t\t\t} else if (backfaceVisible === false) {\n\t\t\t\tbackfaceVisibility = \"hidden\"\n\t\t\t}\n\t\t\tstyle.backfaceVisibility = backfaceVisibility\n\t\t\tstyle.WebkitBackfaceVisibility = backfaceVisibility\n\n\t\t\tconst preserve3d = Animatable.get(this.props.preserve3d, undefined)\n\t\t\tif (preserve3d === true) {\n\t\t\t\tstyle.transformStyle = \"preserve-3d\"\n\t\t\t} else if (preserve3d === false) {\n\t\t\t\tstyle.transformStyle = \"flat\"\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * If we don't have ParentSizeState, we can't correctly figure out x/y position based\n\t\t\t * on the parent size and this component's width/height. So we can apply right and bottom\n\t\t\t * directly and let the DOM layout figure out the rest.\n\t\t\t */\n\t\t\tif (!hasParentSize) {\n\t\t\t\tapplyLayoutProp(style, this.props, \"right\")\n\t\t\t\tapplyLayoutProp(style, this.props, \"bottom\")\n\n\t\t\t\t// If `left` and `top` have been provided here as a percentage from Vekter,\n\t\t\t\t// these percentages are calculated from the center of the div\n\t\t\t\tconst width = Animatable.get<string | number | undefined>(this.props.width, undefined)\n\t\t\t\tconst stringWidth = toPixelString(width)\n\t\t\t\tconst height = Animatable.get<string | number | undefined>(this.props.height, undefined)\n\t\t\t\tconst stringHeight = toPixelString(height)\n\t\t\t\tif (typeof left === \"string\" && left.endsWith(\"%\") && this.props.right === null) {\n\t\t\t\t\tleft = `calc(${left} - calc(${stringWidth}} / 2))`\n\t\t\t\t\tstyle.width = stringWidth\n\t\t\t\t}\n\n\t\t\t\tif (typeof top === \"string\" && top.endsWith(\"%\") && this.props.bottom === null) {\n\t\t\t\t\ttop = `calc(${top} - calc(${stringHeight} / 2))`\n\t\t\t\t\tstyle.height = stringHeight\n\t\t\t\t}\n\n\t\t\t\t// If pinned to both, reset physical dimensions\n\t\t\t\tif (top !== undefined && style.bottom !== undefined) {\n\t\t\t\t\tstyle.height = undefined\n\t\t\t\t\ttop = toPixelString(Animatable.get(this.props.top, undefined))\n\t\t\t\t} else {\n\t\t\t\t\tstyle.height = stringHeight\n\t\t\t\t}\n\t\t\t\tif (left !== undefined && style.right !== undefined) {\n\t\t\t\t\tstyle.width = undefined\n\t\t\t\t\tleft = toPixelString(Animatable.get(this.props.left, undefined))\n\t\t\t\t} else {\n\t\t\t\t\tstyle.width = stringWidth\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst transformRect: { x: string | number; y: string | number } & Size = { ...rect }\n\t\t\tif (typeof left !== \"undefined\") {\n\t\t\t\ttransformRect.x = left\n\t\t\t}\n\t\t\tif (typeof top !== \"undefined\") {\n\t\t\t\ttransformRect.y = top\n\t\t\t}\n\t\t\tcollectTransformFromProps(this.props, transformRect, style)\n\t\t\tcollectVisualStyleFromProps(this.props, style)\n\t\t\tcollectBackgroundImageFromProps(this.props, style)\n\t\t\tLayer.applyWillChange(this.props, style, false)\n\n\t\t\t// TODO disable style overrides in strict mode\n\t\t\tif (this.props.style) {\n\t\t\t\tObject.assign(style, this.props.style)\n\t\t\t}\n\n\t\t\treturn style\n\t\t}\n\n\t\tprivate updateStyle = () => {\n\t\t\tif (!this.element) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tObject.assign(this.element.style, this.getStyle())\n\t\t}\n\n\t\tprivate setElement = (element: HTMLDivElement | null) => {\n\t\t\tthis.element = element\n\t\t\tthis.setLayerElement(element)\n\t\t}\n\n\t\t// XXX internal state\n\t\tpropsObserver?: AnimatableObject<DeprecatedCoreFrameProps>\n\t\tpropsObserverCancel?: Cancel\n\n\t\tsizeObserver?: AnimatableObject<Size>\n\t\tsizeObserverCancel?: Cancel\n\n\t\toverride componentDidMount() {\n\t\t\tconst { target } = RenderEnvironment\n\t\t\tif (target === RenderTarget.preview) {\n\t\t\t\tthis.propsObserver = ObservableObject(this.props, true)\n\t\t\t\tthis.propsObserverCancel = ObservableObject.addObserver(this.propsObserver, this.onPropsChange)\n\t\t\t\tif (\n\t\t\t\t\tthis.props.parentSize &&\n\t\t\t\t\tisAnimatable(this.props.parentSize.width) &&\n\t\t\t\t\tisAnimatable(this.props.parentSize.height)\n\t\t\t\t) {\n\t\t\t\t\tthis.sizeObserver = ObservableObject(this.props.parentSize, true)\n\t\t\t\t\tthis.sizeObserverCancel = ObservableObject.addObserver(this.sizeObserver, this.onSizeChange)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\toverride componentDidUpdate() {\n\t\t\tconst { target } = RenderEnvironment\n\t\t\tthis.propsObserverCancel && this.propsObserverCancel()\n\t\t\tthis.sizeObserverCancel && this.sizeObserverCancel()\n\t\t\tif (target === RenderTarget.preview) {\n\t\t\t\tthis.propsObserver = ObservableObject(this.props, true)\n\t\t\t\tthis.propsObserverCancel = ObservableObject.addObserver(this.propsObserver, this.onPropsChange)\n\t\t\t\tif (\n\t\t\t\t\tthis.props.parentSize &&\n\t\t\t\t\tisAnimatable(this.props.parentSize.width) &&\n\t\t\t\t\tisAnimatable(this.props.parentSize.height)\n\t\t\t\t) {\n\t\t\t\t\tthis.sizeObserver = ObservableObject(this.props.parentSize, true)\n\t\t\t\t\tthis.sizeObserverCancel = ObservableObject.addObserver(this.sizeObserver, this.onSizeChange)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprotected onPropsChange = (props: Change<AnimatableObject<DeprecatedCoreFrameProps>>) => {\n\t\t\tconst rect = DeprecatedFrameInner.rect(Animatable.objectToValues(props.value))\n\t\t\tif (this.state.size && isAnimatable(this.state.size.width) && isAnimatable(props.value.width)) {\n\t\t\t\tthis.state.size.width.set(rect.width)\n\t\t\t}\n\t\t\tif (this.state.size && isAnimatable(this.state.size.height) && isAnimatable(props.value.height)) {\n\t\t\t\tthis.state.size.height.set(rect.height)\n\t\t\t}\n\t\t\tthis.updateStyle()\n\t\t}\n\n\t\tprotected onSizeChange = () => {\n\t\t\tthis.updateStyle()\n\t\t}\n\n\t\toverride componentWillUnmount() {\n\t\t\tthis.propsObserverCancel && this.propsObserverCancel()\n\t\t\tthis.propsObserverCancel = undefined\n\t\t\tthis.sizeObserverCancel && this.sizeObserverCancel()\n\t\t\tthis.sizeObserverCancel = undefined\n\t\t}\n\n\t\toverride render() {\n\t\t\tcountNodeRender()\n\t\t\tconst { visible, id, className } = this.props\n\t\t\tif (!visible) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\tconst style = this.getStyle()\n\t\t\tconst rect = this.rect\n\t\t\tconst parentSize = { width: rect.width, height: rect.height }\n\n\t\t\treturn (\n\t\t\t\t<div id={id} style={style} ref={this.setElement} className={className}>\n\t\t\t\t\t<ProvideParentSize parentSize={parentSize}>{this.layoutChildren()}</ProvideParentSize>\n\t\t\t\t\t<Border {...this.props} />\n\t\t\t\t</div>\n\t\t\t)\n\t\t}\n\n\t\tlayoutChildren() {\n\t\t\tconst _forwardedOverrides: { [key: string]: unknown } | undefined = this.props._forwardedOverrides\n\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: deprecated code\n\t\t\tlet children = React.Children.map(this.props.children, (child: React.ReactElement<any>) => {\n\t\t\t\tif (isConstraintSupportingChild(child)) {\n\t\t\t\t\treturn React.cloneElement(child, {\n\t\t\t\t\t\tparentSize: this.state.size,\n\t\t\t\t\t\t_forwardedOverrides,\n\t\t\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: deprecated code\n\t\t\t\t\t} as any)\n\t\t\t\t} else if (_forwardedOverrides && child) {\n\t\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: deprecated code\n\t\t\t\t\treturn React.cloneElement(child as any, { _forwardedOverrides })\n\t\t\t\t} else {\n\t\t\t\t\treturn child\n\t\t\t\t}\n\t\t\t})\n\n\t\t\t// We wrap raw strings in a default style to display\n\t\t\tif (children && children.length === 1 && typeof children[0] === \"string\") {\n\t\t\t\tchildren = [<Center key=\"0\">{children}</Center>]\n\t\t\t}\n\t\t\treturn children\n\t\t}\n\t}\n\n\tDeprecatedFrameInner.contextType = ConstraintsContext\n\n\treturn DeprecatedFrameInner\n})()\n\nexport function Center(props: { children?: React.ReactNode; style?: React.CSSProperties }) {\n\tconst style = Object.assign(\n\t\t{},\n\t\t{\n\t\t\theight: \"100%\",\n\t\t\tdisplay: \"flex\",\n\t\t\talignItems: \"center\",\n\t\t\tjustifyContent: \"center\",\n\t\t\tfontFamily: \"Helvetica\",\n\t\t},\n\t\tprops.style || {},\n\t)\n\n\treturn <div style={style}>{props.children}</div>\n}\n", "import type { AnimatableObject, Cancel, Change, TransactionId } from \"../animation/Animatable/Animatable.ts\"\nimport { Animatable, isAnimatable } from \"../animation/Animatable/Animatable.ts\"\nimport type { Observer } from \"../animation/Animatable/Observers.ts\"\nimport { Observers } from \"../animation/Animatable/Observers.ts\"\nimport { asRecord } from \"../utils/asRecord.ts\"\n\nconst hasOwnProperty = (obj: object, prop: PropertyKey) => Object.prototype.hasOwnProperty.call(obj, prop)\n\nconst $private = /* @__PURE__ */ Symbol(\"private\")\n\ntype ObservedObject<T> = object & {\n\t[$private]: {\n\t\treset: () => void\n\t\tmakeAnimatables: boolean\n\t\tobserveAnimatables: boolean\n\t\tobservers: Observers<T>\n\t\ttransactions: Set<number>\n\t}\n}\n\n/**\n * @internal\n */\nexport const ObservableObject = /* @__PURE__ */ (() => {\n\t/**\n\t * @internal\n\t */\n\tfunction ObservableObject<T extends object = object>(\n\t\tinitial: Partial<T> | object = {},\n\t\tmakeAnimatables = false,\n\t\tobserveAnimatables = true,\n\t) {\n\t\tconst unproxiedState: ObservedObject<T> = {\n\t\t\t[$private]: {\n\t\t\t\tmakeAnimatables,\n\t\t\t\tobserveAnimatables,\n\t\t\t\tobservers: new Observers<T>(),\n\t\t\t\treset() {\n\t\t\t\t\tfor (const key in state) {\n\t\t\t\t\t\tif (hasOwnProperty(state, key)) {\n\t\t\t\t\t\t\tconst value = hasOwnProperty(initial, key) ? asRecord(initial)[key] : undefined\n\t\t\t\t\t\t\tif (value !== undefined) {\n\t\t\t\t\t\t\t\tstate[key] = value\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdelete state[key]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\ttransactions: new Set<number>(),\n\t\t\t},\n\t\t}\n\t\tconst state = new Proxy(unproxiedState, sharedProxyHandler) as AnimatableObject<T>\n\t\tObject.assign(state, initial)\n\t\treturn state\n\t}\n\n\tObservableObject.resetObject = <T extends object>(target: T) => {\n\t\treturn (target as ObservedObject<T>)[$private].reset()\n\t}\n\n\tObservableObject.addObserver = <T extends object>(target: T, observer: Observer<T>): Cancel => {\n\t\treturn (target as ObservedObject<T>)[$private].observers.add(observer)\n\t}\n\n\treturn ObservableObject\n})()\n\nclass ObservableObjectProxyHandler<T extends ObservedObject<T>> implements ProxyHandler<T> {\n\tset = (target: T, key: PropertyKey, value: any, receiver: any): boolean => {\n\t\tif (key === $private) {\n\t\t\treturn false\n\t\t}\n\t\tconst privateObject = target[$private]\n\n\t\tlet animatable: Animatable<any> | undefined\n\t\tlet rawValue: any\n\n\t\tif (isAnimatable(value)) {\n\t\t\tanimatable = value\n\t\t\trawValue = animatable.get()\n\t\t} else {\n\t\t\trawValue = value\n\t\t}\n\n\t\t// With the animatable flag, make every value animatable\n\t\tif (privateObject.makeAnimatables && typeof value !== \"function\" && typeof value !== \"object\" && !animatable) {\n\t\t\tanimatable = Animatable(value)\n\t\t}\n\n\t\tif (privateObject.observeAnimatables && animatable) {\n\t\t\tconst transactions = privateObject.transactions\n\t\t\tanimatable.onUpdate({\n\t\t\t\tupdate: (change: Change<any>, transaction?: TransactionId) => {\n\t\t\t\t\tif (transaction) {\n\t\t\t\t\t\ttransactions.add(transaction)\n\t\t\t\t\t}\n\t\t\t\t\tprivateObject.observers.notify({ value: receiver }, transaction)\n\t\t\t\t},\n\t\t\t\tfinish: (transaction: TransactionId) => {\n\t\t\t\t\tif (transactions.delete(transaction)) {\n\t\t\t\t\t\tprivateObject.observers.finishTransaction(transaction)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\n\t\tlet result = false\n\t\tlet changed = true\n\t\tconst targetValue = asRecord(target)[key]\n\t\tif (targetValue !== undefined) {\n\t\t\t// If the key already exists handle it differently\n\t\t\tif (isAnimatable(targetValue)) {\n\t\t\t\tchanged = targetValue.get() !== rawValue\n\t\t\t\ttargetValue.set(rawValue)\n\t\t\t} else {\n\t\t\t\tchanged = targetValue !== rawValue\n\t\t\t\tasRecord(target)[key] = rawValue\n\t\t\t}\n\t\t\tconst rawValueIsObject = rawValue !== null && typeof rawValue === \"object\"\n\t\t\tif (Array.isArray(rawValue) || rawValueIsObject) changed = true\n\t\t\tresult = true\n\t\t} else {\n\t\t\t// Use the animatable value if it exists\n\t\t\tif (animatable) {\n\t\t\t\tvalue = animatable\n\t\t\t}\n\t\t\tresult = Reflect.set(target, key, value)\n\t\t}\n\t\tif (changed) {\n\t\t\tprivateObject.observers.notify({ value: receiver })\n\t\t}\n\t\treturn result\n\t}\n\n\tget = (target: T, key: PropertyKey, receiver: any) => {\n\t\tif (key === $private) {\n\t\t\treturn asRecord(target)[key]\n\t\t}\n\t\tconst value = Reflect.get(target, key, receiver)\n\t\t// Bind functions to the receiver, so we can use `this`\n\t\treturn typeof value === \"function\" ? value.bind(receiver) : value\n\t}\n\n\tdeleteProperty(target: T, key: PropertyKey) {\n\t\tconst result = Reflect.deleteProperty(target, key)\n\t\ttarget[$private].observers.notify({ value: target })\n\t\treturn result\n\t}\n\n\townKeys(target: T) {\n\t\tconst keys = Reflect.ownKeys(target)\n\t\tconst privateIndex = keys.indexOf($private)\n\t\tif (privateIndex !== -1) {\n\t\t\tkeys.splice(privateIndex, 1)\n\t\t}\n\t\treturn keys\n\t}\n\n\tgetOwnPropertyDescriptor(target: T, key: PropertyKey) {\n\t\tif (key === $private) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn Reflect.getOwnPropertyDescriptor(target, key)\n\t}\n}\n\n// Shared handler\nconst sharedProxyHandler = /* @__PURE__ */ new ObservableObjectProxyHandler()\n", "import type { CSSProperties } from \"react\"\n\nexport const cornerPropertiesToInherit = {\n\tborderRadius: \"inherit\",\n\tcornerShape: \"inherit\",\n} as const satisfies CSSProperties\n", "import type { MotionStyle, MotionValue } from \"framer-motion\"\nimport { motion } from \"framer-motion\"\nimport type React from \"react\"\nimport { cornerPropertiesToInherit } from \"../utils/corners.ts\"\n\n/** @public */\nexport type BorderStyle = \"solid\" | \"dashed\" | \"dotted\" | \"double\"\n/** @internal */\nexport interface BorderComponentProps {\n\tborderWidth: number | Partial<{ top: number; bottom: number; left: number; right: number }>\n\tborderColor: string\n\tborderStyle: BorderStyle\n\tborder?: string | MotionValue<string>\n\tlayoutId?: string | undefined\n}\n/** @internal */\nexport function collectBorderStyleForProps(\n\tprops: Partial<BorderComponentProps>,\n\tstyle: React.CSSProperties,\n\tcollapseEqualBorders: boolean = true,\n) {\n\tconst { borderWidth, borderStyle, borderColor } = props\n\tif (!borderWidth) {\n\t\treturn\n\t}\n\tlet borderTop: number | undefined\n\tlet borderBottom: number | undefined\n\tlet borderLeft: number | undefined\n\tlet borderRight: number | undefined\n\tif (typeof borderWidth === \"number\") {\n\t\tborderTop = borderBottom = borderLeft = borderRight = borderWidth\n\t} else {\n\t\tborderTop = borderWidth.top || 0\n\t\tborderBottom = borderWidth.bottom || 0\n\t\tborderLeft = borderWidth.left || 0\n\t\tborderRight = borderWidth.right || 0\n\t}\n\tif (borderTop === 0 && borderBottom === 0 && borderLeft === 0 && borderRight === 0) {\n\t\treturn\n\t}\n\n\t// Equal border\n\tif (collapseEqualBorders && borderTop === borderBottom && borderTop === borderLeft && borderTop === borderRight) {\n\t\tstyle.border = `${borderTop}px ${borderStyle} ${borderColor}`\n\t\treturn\n\t}\n\n\tstyle.borderStyle = props.borderStyle\n\tstyle.borderColor = props.borderColor\n\tstyle.borderTopWidth = `${borderTop}px`\n\tstyle.borderBottomWidth = `${borderBottom}px`\n\tstyle.borderLeftWidth = `${borderLeft}px`\n\tstyle.borderRightWidth = `${borderRight}px`\n}\n\nexport function Border(props: Partial<BorderComponentProps>): JSX.Element | null {\n\tconst layoutId = props.layoutId ? `${props.layoutId}-border` : undefined\n\n\tif (!props.borderWidth) {\n\t\treturn null\n\t}\n\tconst style: React.CSSProperties = {\n\t\tposition: \"absolute\",\n\t\tleft: 0,\n\t\tright: 0,\n\t\ttop: 0,\n\t\tbottom: 0,\n\t\t...cornerPropertiesToInherit,\n\t\tpointerEvents: \"none\",\n\t}\n\n\tif (props.border) {\n\t\t;(style as MotionStyle).border = props.border\n\t\treturn <motion.div style={style} />\n\t}\n\n\tcollectBorderStyleForProps(props, style, false)\n\n\treturn <motion.div data-frame-border style={style} layoutId={layoutId} />\n}\n", "import type { AssetSize } from \"@framerjs/assets\"\nimport type { RelativeNumber } from \"./RelativeNumber.ts\"\n\n/** @public */\nexport type ImageFit = \"fill\" | \"fit\" | \"stretch\" | \"tile\"\n\n/** @public */\nexport interface BackgroundImage {\n\t// We set this to undefined to render a placeholder image.\n\tsrc: string | undefined\n\talt?: string\n\t/** @deprecated - only be present in code generated before ~Nov 2025; Image components generate `srcSet`s now */\n\tsrcSet?: string | undefined\n\tnodeFixedSize?: { width: number; height: number } | undefined\n\tpreferredSize?: AssetSize\n\tsizes?: string\n\tpixelWidth?: number\n\tpixelHeight?: number\n\tintrinsicWidth?: number\n\tintrinsicHeight?: number\n\tpositionX?: \"left\" | \"center\" | \"right\" | RelativeNumber\n\tpositionY?: \"top\" | \"center\" | \"bottom\" | RelativeNumber\n\tfit?: ImageFit\n\n\t// Used the scale the background when the ImageFit is set to \"tiled\"\n\tbackgroundSize?: number\n\tloading?: \"lazy\" | \"eager\"\n\t// As of Oct 2024, fetchPriority is not used anywhere by the codegen,\n\t// but we\u2019re supporting it because users have repeatedly asked for it.\n\t// We\u2019re also likely to use it in the future when https://github.com/framer/company/issues/29868 ships.\n\tfetchPriority?: \"high\" | \"low\"\n}\n\nconst key: keyof BackgroundImage = \"src\"\n\n/** @public */\nexport const BackgroundImage = {\n\tisImageObject: function (image: unknown): image is object & BackgroundImage {\n\t\tif (!image || typeof image === \"string\") return false\n\t\treturn typeof image === \"object\" && key in image\n\t},\n}\n\n/** @internal */\nexport type FitImageDimensionType = \"width\" | \"height\"\n", "import { Animatable } from \"../../animation/Animatable/Animatable.ts\"\nimport { isString } from \"../../utils/utils.ts\"\nimport type { LayerProps } from \"../presentation/Layer.tsx\"\nimport type { Background, BackgroundProperties, DeprecatedBackgroundProperties } from \"../traits/Background.ts\"\nimport { BackgroundImage } from \"../types/BackgroundImage.ts\"\n\nfunction applyForwardOverrides(\n\tbackground: BackgroundImage,\n\tprops: Partial<DeprecatedBackgroundProperties & LayerProps>,\n): BackgroundImage {\n\tconst { _forwardedOverrideId, _forwardedOverrides, id } = props\n\tconst forwardedOverrideId = _forwardedOverrideId ?? id\n\tconst src = _forwardedOverrides && forwardedOverrideId ? _forwardedOverrides[forwardedOverrideId] : undefined\n\tif (src && typeof src === \"string\") {\n\t\tbackground = { ...background, src }\n\t}\n\treturn background\n}\n\n/** @internal */\nexport function backgroundImageFromProps(\n\tprops: Partial<DeprecatedBackgroundProperties & BackgroundProperties>,\n): BackgroundImage | undefined {\n\tconst { background, image } = props\n\tif (image !== undefined && background && !BackgroundImage.isImageObject(background)) {\n\t\t// Give precedence to background prop that is not set to an image\n\t\treturn\n\t}\n\tlet backgroundImage: Background | null = null\n\n\tif (isString(image)) {\n\t\tbackgroundImage = { alt: \"\", src: image }\n\t} else {\n\t\tbackgroundImage = Animatable.get(background, null)\n\t}\n\tif (!BackgroundImage.isImageObject(backgroundImage)) {\n\t\treturn\n\t}\n\treturn applyForwardOverrides(backgroundImage, props)\n}\n", "import { MotionValue } from \"framer-motion\"\n\n/** @internal */\nexport const isMotionValue = (v: any): v is MotionValue => v instanceof MotionValue\n", "function manageCache(cache: Map<any, any>, maxEntries: number) {\n\tconst size = cache.size\n\tif (size < maxEntries) return\n\n\t// randomly start at 0 or 1, delete every other key in a fast way\n\tlet i = Math.round(Math.random())\n\tfor (const key of cache.keys()) {\n\t\tif ((++i & 0x1) === 0x1) continue\n\t\tcache.delete(key)\n\t}\n}\n\n// cache a mapping of arguments to created values in an automatically managed cache\n/** @internal */\nexport function memoize<K, V>(maxEntries: number, cache: Map<K, V>, key: K, create: (key: K) => V) {\n\tconst r = cache.get(key)\n\tif (r) return r\n\n\tmanageCache(cache, maxEntries)\n\tconst g = create(key)\n\tcache.set(key, g)\n\treturn g\n}\n", "// https://stackoverflow.com/a/7616484\nexport const hash = (value: string) => {\n\tlet hasher = 0,\n\t\ti,\n\t\tchr\n\tif (value.length === 0) return hasher\n\tfor (i = 0; i < value.length; i++) {\n\t\tchr = value.charCodeAt(i)\n\t\thasher = (hasher << 5) - hasher + chr\n\t\thasher |= 0 // Convert to 32bit integer\n\t}\n\treturn hasher\n}\n", "import { Color } from \"./Color.ts\"\nimport { hsvToStr, stringToObject } from \"./converters.ts\"\nimport type { ColorHSL, ColorHSLA, ColorHSV, ColorHSVA, ColorRGB, ColorRGBA } from \"./types.ts\"\n\n/**\n * @internal\n */\nexport const ConvertColor = {\n\thueRotate: (color: string, angle: number) => {\n\t\treturn Color.toHslString(Color.hueRotate(Color(color), angle))\n\t},\n\n\tsetAlpha: (color: string, alpha: number) => {\n\t\treturn Color.toRgbString(Color.alpha(Color(color), alpha))\n\t},\n\n\tgetAlpha: (color: string) => {\n\t\tconst obj = stringToObject(color)\n\t\treturn obj ? obj.a : 1\n\t},\n\n\tmultiplyAlpha: (color: string, alpha: number) => {\n\t\treturn Color.toRgbString(Color.multiplyAlpha(Color(color), alpha))\n\t},\n\n\t/**\n\t * @internal\n\t */\n\ttoHexValue: (color: string) => {\n\t\treturn Color.toHex(Color(color)).toUpperCase()\n\t},\n\n\ttoHex: (color: string) => {\n\t\treturn Color.toHexString(Color(color)).toUpperCase()\n\t},\n\n\ttoRgb: (color: string) => {\n\t\treturn Color.toRgb(Color(color))\n\t},\n\n\ttoRgbString: (color: string) => {\n\t\treturn Color.toRgbString(Color(color))\n\t},\n\n\ttoHSV: (color: string) => {\n\t\treturn Color.toHsv(Color(color))\n\t},\n\n\ttoHSL: (color: string): ColorHSLA => {\n\t\treturn Color.toHsl(Color(color))\n\t},\n\n\ttoHslString: (color: string) => {\n\t\treturn Color.toHslString(Color(color))\n\t},\n\n\ttoHsvString: (color: string) => {\n\t\treturn Color.toHsvString(Color(color))\n\t},\n\n\thsvToHSLString: (hsv: ColorHSV | ColorHSVA): string => {\n\t\treturn Color.toHslString(Color(hsvToStr(hsv.h, hsv.s, hsv.v, (hsv as ColorHSVA).a)))\n\t},\n\n\t/**\n\t * @internal\n\t */\n\thsvToHexValue: (hsv: ColorHSV | ColorHSVA): string => {\n\t\treturn Color.toHex(Color(hsvToStr(hsv.h, hsv.s, hsv.v, (hsv as ColorHSVA).a))).toUpperCase()\n\t},\n\n\thsvToHex: (hsv: ColorHSV | ColorHSVA): string => {\n\t\treturn Color.toHexString(Color(hsvToStr(hsv.h, hsv.s, hsv.v, (hsv as ColorHSVA).a))).toUpperCase()\n\t},\n\n\thsvToRgbString: (hsv: ColorHSV | ColorHSVA): string => {\n\t\treturn Color.toRgbString(Color(hsvToStr(hsv.h, hsv.s, hsv.v, (hsv as ColorHSVA).a)))\n\t},\n\n\thsvToString: (hsv: ColorHSV | ColorHSVA): string => {\n\t\treturn hsvToStr(hsv.h, hsv.s, hsv.v)\n\t},\n\n\trgbaToString: (color: ColorRGB | ColorRGBA) => {\n\t\treturn Color.toRgbString(Color(color))\n\t},\n\n\t/**\n\t * @internal\n\t */\n\trgbToHexValue: (color: ColorRGB | ColorRGBA) => {\n\t\treturn Color.toHex(Color(color))\n\t},\n\n\trgbToHexString: (color: ColorRGB | ColorRGBA) => {\n\t\treturn Color.toHexString(Color(color))\n\t},\n\n\thslToString: (color: ColorHSL | ColorHSLA) => {\n\t\treturn Color.toHslString(Color(color))\n\t},\n\n\thslToRgbString: (color: ColorHSL | ColorHSLA) => {\n\t\treturn Color.toRgbString(Color(color))\n\t},\n\n\ttoColorPickerSquare: (h: number) => {\n\t\treturn Color.toRgbString(Color({ h, s: 1, l: 0.5, a: 1 }))\n\t},\n\n\tisValid: (color: string): boolean => {\n\t\treturn Color(color).isValid !== false\n\t},\n\n\tequals: (a: Color | string, b: Color | string): boolean => {\n\t\t// P3 Color strings are directly comparable without conversion.\n\t\tif (Color.isP3String(a) || Color.isP3String(b)) return a === b\n\n\t\tif (typeof a === \"string\") {\n\t\t\ta = Color(a)\n\t\t}\n\t\tif (typeof b === \"string\") {\n\t\t\tb = Color(b)\n\t\t}\n\t\treturn Color.equal(a, b)\n\t},\n\n\ttoHexOrRgbaString: (input: string) => {\n\t\tconst color = Color(input)\n\t\treturn color.a !== 1 ? Color.toRgbString(color) : Color.toHexString(color)\n\t},\n\n\t/**\n\t * Converts a color to a string to consistent formats for animating.\n\t */\n\ttoFormatString: (color: string) => {\n\t\tif (Color.isP3String(color)) return color\n\t\treturn Color.toRgbString(Color(color))\n\t},\n}\n", "import { memoize } from \"../../utils/memoize.ts\"\nimport { hash as stringHash } from \"../../utils/string.ts\"\nimport { ConvertColor } from \"../types/Color/ConvertColor.ts\"\nimport type { GradientColorStop } from \"../types/GradientColorStop.ts\"\nimport type { MultiStopGradient } from \"../types/MultiStopGradient.ts\"\nimport type { SimpleGradient } from \"../types/SimpleGradient.ts\"\n\nconst CSSVariableRegExp = /var\\(.+\\)/u\n\nconst colorCache = new Map<[string, number], string>()\nfunction cachedMultiplyAlpha(s: string, a: number): string {\n\tconst key: [string, number] = [s, a]\n\tif (CSSVariableRegExp.test(s)) {\n\t\treturn s\n\t}\n\treturn memoize(1000, colorCache, key, () => ConvertColor.multiplyAlpha(s, a))\n}\n\n/**\n * @param alpha - is optional because SVGs define the alpha as a seperate property\n * @internal\n */\nexport function gradientColorStops(\n\tgradient: SimpleGradient | MultiStopGradient,\n\talpha = 1,\n): readonly GradientColorStop[] {\n\tlet stops: readonly GradientColorStop[]\n\tif (\"stops\" in gradient) {\n\t\tstops = gradient.stops\n\t} else {\n\t\tstops = [\n\t\t\t{ value: gradient.start, position: 0 },\n\t\t\t{ value: gradient.end, position: 1 },\n\t\t]\n\t}\n\n\tif (alpha === 1) {\n\t\treturn stops\n\t} else {\n\t\treturn stops.map(stop => ({ ...stop, value: cachedMultiplyAlpha(stop.value, alpha) }))\n\t}\n}\n\nexport function gradientColorStopsHash(gradient: SimpleGradient | MultiStopGradient, alpha: number) {\n\tlet result = 0\n\tgradientColorStops(gradient, alpha).forEach((stop: GradientColorStop) => {\n\t\tresult ^= stringHash(stop.value) ^ stop.position\n\t})\n\treturn result\n}\n", "import type { GradientColorStop } from \"./GradientColorStop.ts\"\n\n/**\n * @public\n */\nexport interface MultiStopGradient {\n\tstops: readonly GradientColorStop[]\n}\n\nconst multiStopGradientKeys: (keyof MultiStopGradient)[] = [\"stops\"]\n\nexport function isMultiStopGradient(value: any): value is MultiStopGradient {\n\treturn value && multiStopGradientKeys.every(key => key in value)\n}\n", "/**\n * @public\n */\nexport interface SimpleGradient {\n\tstart: string\n\tend: string\n}\n\nconst simpleGradientKeys: (keyof SimpleGradient)[] = [\"start\", \"end\"]\n\nexport function isSimpleGradient(value: any): value is SimpleGradient {\n\treturn value && simpleGradientKeys.every(key => key in value)\n}\n", "import { isObject } from \"../../utils/utils.ts\"\nimport { gradientColorStops, gradientColorStopsHash } from \"../utils/gradientColorStops.ts\"\nimport type { MultiStopGradient } from \"./MultiStopGradient.ts\"\nimport { isMultiStopGradient } from \"./MultiStopGradient.ts\"\nimport type { SimpleGradient } from \"./SimpleGradient.ts\"\nimport { isSimpleGradient } from \"./SimpleGradient.ts\"\n/**\n * @public\n */\nexport interface LinearGradientBase {\n\talpha: number\n\tangle: number\n}\n\n/**\n * @public\n */\nexport type LinearGradient = LinearGradientBase & (SimpleGradient | MultiStopGradient)\n\nconst linearGradientKeys: (keyof LinearGradientBase)[] = [\"angle\", \"alpha\"]\n\n/**\n * @public\n */\nexport const LinearGradient = {\n\t/**\n\t * @param value -\n\t */\n\tisLinearGradient: (value: unknown): value is LinearGradient => {\n\t\treturn (\n\t\t\tisObject(value) &&\n\t\t\tlinearGradientKeys.every(key => key in value) &&\n\t\t\t(isSimpleGradient(value) || isMultiStopGradient(value))\n\t\t)\n\t},\n\n\t/** @internal */\n\thash: (linearGradient: LinearGradient): number => {\n\t\treturn linearGradient.angle ^ gradientColorStopsHash(linearGradient, linearGradient.alpha)\n\t},\n\n\t/** @internal */\n\ttoCSS: (\n\t\tlinearGradient: LinearGradient,\n\t\toverrideAngle?: number,\n\t\tgetStopValue?: (value: string) => string | undefined,\n\t) => {\n\t\tconst stops = gradientColorStops(linearGradient, linearGradient.alpha)\n\t\tconst angle = overrideAngle !== undefined ? overrideAngle : linearGradient.angle\n\t\t// Ensure integer angles in CSS output, matching `GradientAngleTool.update()`.\n\t\tconst roundedAngle = Math.round(angle)\n\t\tconst cssStops = stops.map(stop => `${getStopValue?.(stop.value) ?? stop.value} ${stop.position * 100}%`)\n\t\treturn `linear-gradient(${roundedAngle}deg, ${cssStops.join(\", \")})`\n\t},\n}\n", "import { isObject } from \"../../utils/utils.ts\"\nimport { gradientColorStops, gradientColorStopsHash } from \"../utils/gradientColorStops.ts\"\nimport type { MultiStopGradient } from \"./MultiStopGradient.ts\"\nimport { isMultiStopGradient } from \"./MultiStopGradient.ts\"\nimport type { SimpleGradient } from \"./SimpleGradient.ts\"\nimport { isSimpleGradient } from \"./SimpleGradient.ts\"\n\n/**\n * @public\n */\nexport interface RadialGradientBase {\n\talpha: number\n\twidthFactor: number\n\theightFactor: number\n\tcenterAnchorX: number\n\tcenterAnchorY: number\n}\n\n/**\n * @public\n */\nexport type RadialGradient = RadialGradientBase & (SimpleGradient | MultiStopGradient)\n\nconst radialGradientKeys: (keyof RadialGradientBase)[] = [\n\t\"widthFactor\",\n\t\"heightFactor\",\n\t\"centerAnchorX\",\n\t\"centerAnchorY\",\n\t\"alpha\",\n]\n\n/**\n * @public\n */\nexport const RadialGradient = {\n\t/**\n\t * @param value -\n\t * @public\n\t */\n\tisRadialGradient: (value: unknown): value is RadialGradient => {\n\t\treturn (\n\t\t\tisObject(value) &&\n\t\t\tradialGradientKeys.every(key => key in value) &&\n\t\t\t(isSimpleGradient(value) || isMultiStopGradient(value))\n\t\t)\n\t},\n\n\t/** @internal */\n\thash: (radialGradient: RadialGradient): number => {\n\t\treturn (\n\t\t\tradialGradient.centerAnchorX ^\n\t\t\tradialGradient.centerAnchorY ^\n\t\t\tradialGradient.widthFactor ^\n\t\t\tradialGradient.heightFactor ^\n\t\t\tgradientColorStopsHash(radialGradient, radialGradient.alpha)\n\t\t)\n\t},\n\n\t/** @internal */\n\ttoCSS: (radialGradient: RadialGradient, getStopValue?: (value: string) => string | undefined) => {\n\t\tconst { alpha, widthFactor, heightFactor, centerAnchorX, centerAnchorY } = radialGradient\n\t\tconst stops = gradientColorStops(radialGradient, alpha)\n\n\t\t// When both gradient stops are at 100% the gradient is a circle. This however\n\t\t// is not supported by Safari, so we need to make sure that one of the stops\n\t\t// is not at 100%. We do this by setting the stop before the last stop to slightly less than 100%.\n\t\tconst cssStops = stops.map((stop, index) => {\n\t\t\tconst nextStop = stops[index + 1]\n\t\t\tconst position = stop.position === 1 && nextStop?.position === 1 ? stop.position - 0.0001 : stop.position\n\t\t\treturn `${getStopValue?.(stop.value) ?? stop.value} ${position * 100}%`\n\t\t})\n\t\treturn `radial-gradient(${widthFactor * 100}% ${heightFactor * 100}% at ${centerAnchorX * 100}% ${\n\t\t\tcenterAnchorY * 100\n\t\t}%, ${cssStops.join(\", \")})`\n\t},\n}\n", "import type { MotionStyle, MotionValue } from \"framer-motion\"\nimport { Animatable } from \"../../animation/Animatable/Animatable.ts\"\nimport { isMotionValue } from \"../../render/utils/isMotionValue.ts\"\nimport type { BackgroundImage } from \"../types/BackgroundImage.ts\"\nimport { Color } from \"../types/Color/Color.ts\"\nimport type { Gradient } from \"../types/Gradient.ts\"\nimport { LinearGradient, RadialGradient } from \"../types/Gradient.ts\"\n\n/** @public */\nexport type Background = Color | Gradient | BackgroundImage | MotionValue<string> | string\n\nexport interface DeprecatedBackgroundProperties {\n\tbackground: Animatable<Background> | Background | null\n\n\t/**\n\t * @internal\n\t */\n\tbackgroundColor: string | Color\n}\n\n/** @public */\nexport interface BackgroundProperties {\n\t/**\n\t * Set the background of a `Frame`. Supports color strings, color objects and images by using `src`. Set to a semi-transparent blue color by default.\n\t * This will override the values set by the `image` property. To use a color and a image, use `backgroundColor` instead\n\t * ```jsx\n\t * <Frame background=\"#09F\"/>\n\t * <Frame background={Color({r: 255, g: 0, b: 102})} />\n\t * <Frame background={{ alpha: 1, angle: 75, start: \"#09F\", end: \"#F09\"}} />\n\t * <Frame background={{ src: \"https://example.com/logo.png\"}} />\n\t * ```\n\t * @public\n\t */\n\tbackground: Background | null\n\n\t/**\n\t * Set the background color of a `Frame`. Supports color strings and objects. Use this property to set a background color alongside the `image` property.\n\t * ```jsx\n\t * <Frame backgroundColor=\"#09F\"/>\n\t * <Frame backgroundColor={Color({r: 255, g: 0, b: 102})} />\n\t * ```\n\t * @public\n\t */\n\tbackgroundColor: string | Color\n\n\t/**\n\t * Sets a background image of a `Frame`. Will wrap the passed value in a `url('')` if needed.\n\t * @remarks\n\t * ```jsx\n\t * <Frame image=\"https://source.unsplash.com/random\" />\n\t * ```\n\t * @public\n\t */\n\timage: string\n}\n\n// Note: this does not include background images\nexport function collectBackgroundFromProps(\n\t{ background, backgroundColor }: Partial<DeprecatedBackgroundProperties | BackgroundProperties>,\n\tstyle: MotionStyle,\n) {\n\tif (backgroundColor) {\n\t\tif (typeof backgroundColor === \"string\" || isMotionValue(backgroundColor)) {\n\t\t\tstyle.backgroundColor = backgroundColor\n\t\t} else if (Color.isColorObject(background)) {\n\t\t\tstyle.backgroundColor = background.initialValue || Color.toRgbString(background)\n\t\t}\n\t} else if (background) {\n\t\tbackground = Animatable.get(background, null)\n\t\tif (typeof background === \"string\" || isMotionValue(background)) {\n\t\t\tstyle.background = background\n\t\t} else if (LinearGradient.isLinearGradient(background)) {\n\t\t\tstyle.background = LinearGradient.toCSS(background)\n\t\t} else if (RadialGradient.isRadialGradient(background)) {\n\t\t\tstyle.background = RadialGradient.toCSS(background)\n\t\t} else if (Color.isColorObject(background)) {\n\t\t\tstyle.backgroundColor = background.initialValue || Color.toRgbString(background)\n\t\t}\n\t}\n}\n", "import type { MotionStyle } from \"framer-motion\"\n\n/** @public */\nexport interface BlendingProperties {\n\tblendingMode: BlendingMode\n}\n\n/** @public */\nexport type BlendingMode =\n\t| \"normal\"\n\t| \"multiply\"\n\t| \"screen\"\n\t| \"plus-lighter\"\n\t| \"overlay\"\n\t| \"darken\"\n\t| \"lighten\"\n\t| \"color-dodge\"\n\t| \"color-burn\"\n\t| \"hard-light\"\n\t| \"soft-light\"\n\t| \"difference\"\n\t| \"exclusion\"\n\t| \"hue\"\n\t| \"saturation\"\n\t| \"color\"\n\t| \"luminosity\"\n\n/** @internal */\nexport function collectBlendingFromProps(node: Partial<BlendingProperties>, style: MotionStyle) {\n\tif (!node.blendingMode || node.blendingMode === \"normal\") return\n\tstyle.mixBlendMode = node.blendingMode\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport { Animatable } from \"../../animation/Animatable/Animatable.ts\"\n\n/** @public */\nexport interface WithOpacity {\n\topacity: number | Animatable<number>\n}\n\nconst key: keyof WithOpacity = \"opacity\"\n\n/** @internal */\nexport function withOpacity(target: any): target is WithOpacity {\n\treturn key in target\n}\n\n/** @internal */\nexport function collectOpacityFromProps(props: Partial<WithOpacity>, style: MotionStyle) {\n\tif (!withOpacity(props)) return\n\tconst opacity = Animatable.getNumber(props.opacity)\n\tif (opacity === 1) return\n\tstyle.opacity = opacity\n}\n", "import type { MotionStyle } from \"framer-motion\"\n\nexport type Overflow = \"visible\" | \"hidden\" | \"clip\" | \"scroll\" | \"auto\"\n\nexport interface OverflowProperties {\n\toverflow: Overflow\n}\n\nexport function collectOverflowFromProps(props: Partial<OverflowProperties>, style: MotionStyle) {\n\tif (props.overflow) {\n\t\tstyle.overflow = props.overflow\n\t}\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport { Animatable, isAnimatable } from \"../../animation/Animatable/Animatable.ts\"\nimport { isFiniteNumber } from \"../utils/isFiniteNumber.ts\"\n\nexport type RadiusValue = number | Animatable<number> | string\n\n/** @public */\nexport interface RadiusProperties {\n\tradius:\n\t\t| RadiusValue\n\t\t| Partial<{\n\t\t\t\ttopLeft: RadiusValue\n\t\t\t\ttopRight: RadiusValue\n\t\t\t\tbottomLeft: RadiusValue\n\t\t\t\tbottomRight: RadiusValue\n\t\t  }>\n}\n\nconst key: keyof RadiusProperties = \"radius\"\n\nfunction hasRadius(props: Partial<RadiusProperties>): props is RadiusProperties {\n\treturn key in props\n}\n\n/**\n * Takes a border-radius value supporting a range of types and returns\n * a string representation for use in CSS.\n * NOTE: We always return a string so that we support both React.CSSProperties\n * as well as the CSSStyleDeclaration interface.\n */\nfunction getRadiusValue(value: RadiusValue | undefined): string {\n\t// Coerce value into a number by default. This handles strings containing\n\t// numbers eg. \"123.456\" and acutal numbers.\n\tlet num: number = Number(value)\n\n\t// If value is a string and failed to coerce it's likely an alternative\n\t// representation such as \"10%\" or \"1em\" so return that immediately.\n\tif (typeof value === \"string\" && Number.isNaN(num)) {\n\t\treturn value\n\t} else if (isAnimatable(value)) {\n\t\t// Otherwise it's an animatable object, so extract the value.\n\t\tnum = Animatable.getNumber(value)\n\t}\n\n\t// Return NaN or 0 as 0 without px units to keep things clean.\n\treturn num ? `${num}px` : \"0\"\n}\n\nfunction hasRadiusValue(value: string) {\n\treturn value && value !== \"0\"\n}\n\n/**\n * We assign the borderRadius to each corner individually to make it easier to animate between\n * different frames.\n */\nexport function collectRadiusFromProps(props: Partial<RadiusProperties>, style: MotionStyle) {\n\tif (!hasRadius(props)) return\n\tconst { radius } = props\n\tif (typeof radius === \"string\" || isAnimatable(radius) || isFiniteNumber(radius)) {\n\t\tconst radiusValue = getRadiusValue(radius)\n\t\tif (hasRadiusValue(radiusValue)) {\n\t\t\tstyle.borderTopLeftRadius =\n\t\t\t\tstyle.borderTopRightRadius =\n\t\t\t\tstyle.borderBottomRightRadius =\n\t\t\t\tstyle.borderBottomLeftRadius =\n\t\t\t\t\tradiusValue\n\t\t}\n\t} else if (radius) {\n\t\tconst topLeft = getRadiusValue(radius.topLeft)\n\t\tconst topRight = getRadiusValue(radius.topRight)\n\t\tconst bottomRight = getRadiusValue(radius.bottomRight)\n\t\tconst bottomLeft = getRadiusValue(radius.bottomLeft)\n\t\tif (\n\t\t\thasRadiusValue(topLeft) ||\n\t\t\thasRadiusValue(topRight) ||\n\t\t\thasRadiusValue(bottomRight) ||\n\t\t\thasRadiusValue(bottomLeft)\n\t\t) {\n\t\t\tstyle.borderTopLeftRadius = topLeft\n\t\t\tstyle.borderTopRightRadius = topRight\n\t\t\tstyle.borderBottomRightRadius = bottomRight\n\t\t\tstyle.borderBottomLeftRadius = bottomLeft\n\t\t}\n\t}\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport { Color } from \"../types/Color/Color.ts\"\n\n/** @public */\nexport interface TextColorProperties {\n\tcolor: Color | string\n}\n\nexport function collectTextColorFromProps(props: Partial<TextColorProperties>, style: MotionStyle) {\n\tconst { color } = props\n\tif (typeof color === \"string\") {\n\t\tstyle.color = color\n\t} else if (Color.isColorObject(color)) {\n\t\tstyle.color = color.initialValue || Color.toRgbString(color)\n\t}\n}\n", "/** @public */\nexport interface Shadow {\n\tcolor: string\n\tx: number\n\ty: number\n\tblur: number\n}\n\nexport const shadowKeys: (keyof Shadow)[] = [\"color\", \"x\", \"y\", \"blur\"]\n\n/** @public */\nexport const Shadow = {\n\tis: (shadow: any): shadow is Shadow => {\n\t\treturn shadow && shadowKeys.every(key => key in shadow)\n\t},\n}\n\nexport interface RealisticShadow {\n\ttype: \"realistic\"\n\tdiffusion: number\n\tfocus: number\n}\n\n/** @public */\nexport interface BoxShadow {\n\ttype?: \"box\" | \"realistic\"\n\tinset: boolean\n\tcolor: string\n\tx: number\n\ty: number\n\tblur: number\n\tspread: number\n\tdiffusion: number\n\tfocus: number\n}\n\nexport const boxShadowKeys: (keyof BoxShadow)[] = [\"x\", \"y\", \"color\", \"inset\", \"blur\", \"spread\"]\n\n/** @public */\nexport const BoxShadow = {\n\tis: (shadow: any): shadow is BoxShadow => {\n\t\treturn shadow && boxShadowKeys.every(key => key in shadow)\n\t},\n\n\ttoCSS: (shadow: BoxShadow) => {\n\t\tconst inset = shadow.inset ? \"inset \" : \"\"\n\t\treturn `${inset}${shadow.x}px ${shadow.y}px ${shadow.blur}px ${shadow.spread}px ${shadow.color}`\n\t},\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport { distance, interpolate, mix } from \"framer-motion\"\nimport type React from \"react\"\nimport { asRecord } from \"../../utils/asRecord.ts\"\nimport type { InternalID } from \"../../utils/internalId.ts\"\nimport type { BoxShadowProperties, TextShadowProperties } from \"../traits/Shadow.ts\"\nimport { Rect } from \"../types/Rect.ts\"\nimport { RenderTarget } from \"../types/RenderEnvironment.ts\"\nimport type { Shadow } from \"../types/Shadow.ts\"\nimport { BoxShadow } from \"../types/Shadow.ts\"\nimport { isFiniteNumber } from \"../utils/isFiniteNumber.ts\"\n\nexport function shadowsAsFilter(shadows: readonly Shadow[]): string[] {\n\tconst filters: string[] = []\n\tif (shadows && shadows.length) {\n\t\tconst dropShadows = shadows.map((shadowItem: Shadow): string => {\n\t\t\treturn `drop-shadow(${shadowItem.x}px ${shadowItem.y}px ${shadowItem.blur}px ${shadowItem.color})`\n\t\t})\n\t\tfilters.push(...dropShadows)\n\t}\n\treturn filters\n}\n\nexport function collectTextShadowsForProps(props: Partial<TextShadowProperties>, style: MotionStyle) {\n\tif (!props.shadows || props.shadows.length === 0) return\n\tconst textShadow = props.shadows\n\t\t.map((shadow: Shadow) => {\n\t\t\treturn `${shadow.x}px ${shadow.y}px ${shadow.blur}px ${shadow.color}`\n\t\t})\n\t\t.join(\", \")\n\tif (!textShadow) return\n\tstyle.textShadow = textShadow\n}\n\nexport function collectBoxShadowsForProps(props: Partial<BoxShadowProperties>, style: MotionStyle) {\n\tif (!props.shadows || props.shadows.length === 0) return\n\tconst boxShadow = props.shadows.map((shadowItem: BoxShadow) => BoxShadow.toCSS(shadowItem)).join(\", \")\n\tif (!boxShadow) return\n\tstyle.boxShadow = boxShadow\n}\n\n/** @internal */\nexport function shadowForShape(\n\tboxShadows: BoxShadow[],\n\trect: Rect,\n\tshapeId: InternalID,\n\tfillEnabled: boolean,\n\tstrokeEnabled: boolean,\n\tstrokeWidth: number | undefined,\n\tstrokeClipId: InternalID,\n\tsvgStrokeAttributes: React.SVGAttributes<SVGElement>,\n) {\n\tconst definition: JSX.Element[] = []\n\tlet outsetElement: JSX.Element | null = null\n\tlet insetElement: JSX.Element | null = null\n\tlet maskElement: JSX.Element | null = null\n\tconst needsStrokeClip = false\n\tconst shadows: BoxShadow[] = []\n\tconst insetShadows: BoxShadow[] = []\n\n\t// The canvas renderer relies on setting this class to show / hide shadows at different zoom levels\n\tconst svgShadowClass = \"svg-shadow\"\n\tconst svgShadowProps = RenderTarget.current() === RenderTarget.canvas ? { className: svgShadowClass } : {}\n\n\tfor (const shadow of boxShadows) {\n\t\tshadow.inset ? insetShadows.push(shadow) : shadows.push(shadow)\n\t}\n\n\tif (shadows.length > 0) {\n\t\tshadows.reverse()\n\t\tconst outsideShadowId = shapeId.add(\"_shadow_out\")\n\n\t\tconst normalizedFrame = Rect.atOrigin(rect)\n\t\tconst shadowRects: Rect[] = [normalizedFrame]\n\n\t\tfor (const shadow of shadows) {\n\t\t\tconst shadowFrame = localShadowFrame(shadow, normalizedFrame, true)\n\t\t\tif (shadowFrame === null) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tshadowRects.push(shadowFrame)\n\t\t}\n\n\t\tlet maxBlur = 0\n\t\tconst filterElements: JSX.Element[] = []\n\t\tconst mergeElements: JSX.Element[] = []\n\t\tfor (let i = 0, il = shadows.length; i < il; i++) {\n\t\t\tconst shadow = shadows[i]\n\t\t\tif (!shadow) continue\n\t\t\tconst shadowElements = outerShadowElements(shapeId, shadow, i)\n\t\t\tmaxBlur = Math.max(maxBlur, shadow.blur)\n\t\t\tfilterElements.push(shadowElements.filterElements)\n\t\t\tmergeElements.push(shadowElements.mergeElement)\n\t\t}\n\n\t\tlet expandStrokeWidth = strokeWidth\n\t\tif (!isFiniteNumber(expandStrokeWidth)) expandStrokeWidth = 0\n\t\tlet miter = svgStrokeAttributes.strokeMiterlimit\n\t\tif (!isFiniteNumber(miter)) miter = 4\n\n\t\tlet shadowRect = Rect.merge(...shadowRects)\n\t\tshadowRect = Rect.inflate(shadowRect, ((expandStrokeWidth * miter) / 2 + maxBlur) * 1.1)\n\n\t\t// calculate percentage of shadow frame compared to node frame\n\t\tconst width = rect.width + (strokeWidth ? strokeWidth / 2 : 0)\n\t\tconst height = rect.height + (strokeWidth ? strokeWidth / 2 : 0)\n\t\tconst filterX = (shadowRect.x / width) * 100\n\t\tconst filterY = (shadowRect.y / height) * 100\n\t\tconst filterWidth = (shadowRect.width / width) * 100\n\t\tconst filterHeight = (shadowRect.height / height) * 100\n\n\t\tconst svgRect = {\n\t\t\tx: `${filterX.toFixed(1)}%`,\n\t\t\ty: `${filterY.toFixed(1)}%`,\n\t\t\twidth: `${filterWidth.toFixed(1)}%`,\n\t\t\theight: `${filterHeight.toFixed(1)}%`,\n\t\t}\n\t\tdefinition.push(\n\t\t\t<filter\n\t\t\t\tkey={outsideShadowId.id}\n\t\t\t\tid={outsideShadowId.id}\n\t\t\t\tfilterUnits=\"objectBoundingBox\"\n\t\t\t\t{...svgRect}\n\t\t\t\t{...svgShadowProps}\n\t\t\t>\n\t\t\t\t{filterElements}\n\t\t\t\t{shadows.length > 1 ? <feMerge>{mergeElements}</feMerge> : null}\n\t\t\t</filter>,\n\t\t)\n\n\t\tconst maskId = shapeId.add(\"mask\")\n\n\t\tmaskElement = (\n\t\t\t<mask id={maskId.id} {...svgRect}>\n\t\t\t\t<rect {...svgRect} fill=\"white\" />\n\t\t\t\t<use href={shapeId.link} fill=\"black\" fillOpacity={fillEnabled ? undefined : 0} />\n\t\t\t</mask>\n\t\t)\n\n\t\toutsetElement = (\n\t\t\t<g filter={outsideShadowId.urlLink} {...svgShadowProps} mask={maskId.urlLink}>\n\t\t\t\t<use\n\t\t\t\t\t{...svgStrokeAttributes}\n\t\t\t\t\tfill=\"black\"\n\t\t\t\t\tfillOpacity={fillEnabled ? undefined : 0}\n\t\t\t\t\tstroke=\"black\"\n\t\t\t\t\tstrokeOpacity={strokeEnabled ? undefined : 0}\n\t\t\t\t\tstrokeWidth={strokeEnabled ? strokeWidth : 0}\n\t\t\t\t\txlinkHref={shapeId.link}\n\t\t\t\t\tclipPath={strokeClipId.urlLink}\n\t\t\t\t/>\n\t\t\t</g>\n\t\t)\n\t}\n\n\tif (insetShadows.length) {\n\t\tinsetShadows.reverse()\n\t\tconst insideShadowId = shapeId.add(\"_shadow_inside\")\n\n\t\tconst normalizedFrame = Rect.atOrigin(rect)\n\t\tconst shadowFrames: Rect[] = [normalizedFrame]\n\n\t\tfor (const shadow of insetShadows) {\n\t\t\tconst shadowFrame = localShadowFrame(shadow, normalizedFrame, true)\n\n\t\t\tif (shadowFrame === null) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tshadowFrames.push(shadowFrame)\n\t\t}\n\n\t\tconst shadowRect = Rect.merge(...shadowFrames)\n\n\t\t// calculate percentage of shadow frame compared to node frame\n\t\tconst width = rect.width + (strokeWidth ? strokeWidth / 2 : 0.1)\n\t\tconst height = rect.height + (strokeWidth ? strokeWidth / 2 : 0.1)\n\t\tconst filterX = (shadowRect.x / width) * 100\n\t\tconst filterY = (shadowRect.y / height) * 100\n\t\tconst filterWidth = (shadowRect.width / width) * 100\n\t\tconst filterHeight = (shadowRect.height / height) * 100\n\n\t\tconst filterElements: JSX.Element[] = []\n\t\tconst mergeElements: JSX.Element[] = []\n\n\t\tfor (let i = 0, il = insetShadows.length; i < il; i++) {\n\t\t\tconst shadow = insetShadows[i]\n\t\t\tif (!shadow) continue\n\t\t\tconst shadowElements = innerShadowElements(shapeId, shadow, i)\n\t\t\tfilterElements.push(shadowElements.filterElements)\n\t\t\tmergeElements.push(shadowElements.mergeElement)\n\t\t}\n\n\t\tdefinition.push(\n\t\t\t<filter\n\t\t\t\tkey={insideShadowId.id}\n\t\t\t\tid={insideShadowId.id}\n\t\t\t\tx={`${filterX.toFixed(1)}%`}\n\t\t\t\ty={`${filterY.toFixed(1)}%`}\n\t\t\t\twidth={`${filterWidth.toFixed(1)}%`}\n\t\t\t\theight={`${filterHeight.toFixed(1)}%`}\n\t\t\t\tfilterUnits=\"objectBoundingBox\"\n\t\t\t\t{...svgShadowProps}\n\t\t\t>\n\t\t\t\t{filterElements}\n\t\t\t\t{insetShadows.length > 1 ? <feMerge>{mergeElements}</feMerge> : null}\n\t\t\t</filter>,\n\t\t)\n\n\t\t// if we rendered at lower resolution, we need a clip path ...\n\t\tlet clipPath: string | undefined\n\t\tif (needsStrokeClip) {\n\t\t\tclipPath = strokeClipId.urlLink\n\t\t}\n\n\t\tinsetElement = (\n\t\t\t<use\n\t\t\t\tfill=\"black\"\n\t\t\t\tfillOpacity=\"1\"\n\t\t\t\tfilter={insideShadowId.urlLink}\n\t\t\t\txlinkHref={shapeId.link}\n\t\t\t\tclipPath={clipPath}\n\t\t\t\t{...svgShadowProps}\n\t\t\t/>\n\t\t)\n\t}\n\n\treturn { definition, outsetElement, insetElement, needsStrokeClip, maskElement }\n}\n\nfunction outerShadowElements(shapeID: InternalID, shadow: BoxShadow, index: number) {\n\tconst shadowKey = shapeID.add(\"_outer_shadow\" + index)\n\n\tconst filterElements = (\n\t\t<OuterShadowFilterElements key={shadowKey.id + \"-filters\"} shadow={shadow} shadowKey={shadowKey} />\n\t)\n\n\tconst mergeElement = <feMergeNode key={shadowKey.id + \"-merge\"} in={shadowKey.id} />\n\treturn { filterElements, mergeElement }\n}\n\n// Matching rendering with code-generated shadows: https://bit.ly/4dkxNy0\nconst OuterShadowFilterElements: React.FunctionComponent<{\n\tshadow: BoxShadow\n\tshadowKey: InternalID\n}> = props => {\n\tconst { shadow, shadowKey } = props\n\n\tconst offsetId = shadowKey.add(\"offset\").id\n\tconst blurId = shadowKey.add(\"blur\").id\n\tconst floodId = shadowKey.add(\"flood\").id\n\n\treturn (\n\t\t<>\n\t\t\t<feOffset dx={shadow.x} dy={shadow.y} in=\"SourceAlpha\" result={offsetId} />\n\t\t\t<feGaussianBlur stdDeviation={shadow.blur / 2} in={offsetId} result={blurId} />\n\t\t\t<feFlood floodColor={shadow.color} result={floodId} />\n\t\t\t<feComposite in={floodId} in2={blurId} operator=\"in\" result={shadowKey.id} />\n\t\t</>\n\t)\n}\n\nfunction innerShadowElements(shapeID: InternalID, shadow: BoxShadow, index: number) {\n\tconst shadowKey = shapeID.add(\"_inside_shadow\" + index)\n\n\tconst filterElements = (\n\t\t<InnerShadowFilterElements key={shadowKey.id + \"-filters\"} shadow={shadow} shadowKey={shadowKey} />\n\t)\n\tconst mergeElement = <feMergeNode key={shadowKey.id + \"-merge\"} in={shadowKey.id} />\n\treturn { filterElements, mergeElement }\n}\n\nconst InnerShadowFilterElements: React.FunctionComponent<{\n\tshadow: BoxShadow\n\tshadowKey: InternalID\n}> = props => {\n\tconst { shadow, shadowKey } = props\n\tconst blurId = shadowKey.add(\"blur\").id\n\tconst offsetId = shadowKey.add(\"offset\").id\n\tconst compositeId = shadowKey.add(\"composite\").id\n\tconst floodId = shadowKey.add(\"flood\").id\n\n\treturn (\n\t\t<>\n\t\t\t<feGaussianBlur stdDeviation={shadow.blur / 2} in=\"SourceAlpha\" result={blurId} />\n\t\t\t<feOffset dx={shadow.x} dy={shadow.y} in={blurId} result={offsetId} />\n\t\t\t<feComposite in={offsetId} in2=\"SourceAlpha\" operator=\"arithmetic\" k2=\"-1\" k3=\"1\" result={compositeId} />\n\t\t\t<feFlood floodColor={shadow.color} result={floodId} />\n\t\t\t<feComposite in={floodId} in2={compositeId} operator=\"in\" result={shadowKey.id} />\n\t\t</>\n\t)\n}\n\nexport function calcMaxRealisticShadowBlur(distance: number, focus: number) {\n\treturn interpolate([0, 0.5, 1], [distance * 5, distance, 0])(focus)\n}\n\nconst maxSpread = 5\nexport function calcRealisticShadowSpread(diffusion: number) {\n\treturn mix(-maxSpread, 0, diffusion)\n}\n\n/** @internal */\nexport function localShadowFrame(shadow: BoxShadow | Shadow, frame: Rect, isSVG: boolean = false) {\n\tif (!isSVG && asRecord(shadow)[\"inset\"]) return null\n\n\tlet growth = shadow.blur\n\n\tlet minX: number\n\tlet maxX: number\n\tlet minY: number\n\tlet maxY: number\n\n\tif (isSVG) {\n\t\tminX = -Math.abs(shadow.x) - growth\n\t\tmaxX = Math.abs(shadow.x) + frame.width + growth\n\t\tminY = -Math.abs(shadow.y) - growth\n\t\tmaxY = Math.abs(shadow.y) + frame.height + growth\n\t} else if (BoxShadow.is(shadow) && shadow.type === \"realistic\") {\n\t\tgrowth =\n\t\t\t\"focus\" in shadow && \"diffusion\" in shadow\n\t\t\t\t? calcMaxRealisticShadowBlur(distance(shadow.x, shadow.y), shadow.focus) +\n\t\t\t\t\tcalcRealisticShadowSpread(shadow.diffusion)\n\t\t\t\t: 0\n\n\t\tif (shadow.x >= 0) {\n\t\t\tminX = 0 - growth\n\t\t\tmaxX = shadow.x + frame.width + growth\n\t\t} else {\n\t\t\tminX = shadow.x - growth\n\t\t\tmaxX = frame.width + growth\n\t\t}\n\n\t\tif (shadow.y >= 0) {\n\t\t\tminY = 0 - growth\n\t\t\tmaxY = shadow.y + frame.height + growth\n\t\t} else {\n\t\t\tminY = shadow.y - growth\n\t\t\tmaxY = frame.height + growth\n\t\t}\n\t} else {\n\t\tif (\"spread\" in shadow) {\n\t\t\tgrowth += shadow.spread\n\t\t}\n\t\tminX = shadow.x - growth\n\t\tmaxX = shadow.x + frame.width + growth\n\t\tminY = shadow.y - growth\n\t\tmaxY = shadow.y + frame.height + growth\n\t}\n\tif (maxX <= minX || maxY <= minY) return null\n\treturn { x: minX, y: minY, width: maxX - minX, height: maxY - minY }\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport { shadowsAsFilter } from \"../style/shadow.tsx\"\nimport type { BackgroundFilterProperties } from \"../traits/BackdropFilters.ts\"\nimport type { FilterProperties } from \"../traits/Filters.ts\"\nimport { isFiniteNumber } from \"./isFiniteNumber.ts\"\n\nexport function collectLayerFilters(props: Partial<FilterProperties>, style: MotionStyle) {\n\tconst filters: string[] = []\n\n\t/**\n\t * number-percentage types are set as numbers, as when filters are read from the DOM\n\t * they are returned as numbers rather than percetages. This makes it simpler for Motion\n\t * to animate from filters read from the DOM.\n\t */\n\tif (isFiniteNumber(props.brightness)) {\n\t\tfilters.push(`brightness(${props.brightness / 100})`)\n\t}\n\tif (isFiniteNumber(props.contrast)) {\n\t\tfilters.push(`contrast(${props.contrast / 100})`)\n\t}\n\tif (isFiniteNumber(props.grayscale)) {\n\t\tfilters.push(`grayscale(${props.grayscale / 100})`)\n\t}\n\tif (isFiniteNumber(props.hueRotate)) {\n\t\tfilters.push(`hue-rotate(${props.hueRotate}deg)`)\n\t}\n\tif (isFiniteNumber(props.invert)) {\n\t\tfilters.push(`invert(${props.invert / 100})`)\n\t}\n\tif (isFiniteNumber(props.saturate)) {\n\t\tfilters.push(`saturate(${props.saturate / 100})`)\n\t}\n\tif (isFiniteNumber(props.sepia)) {\n\t\tfilters.push(`sepia(${props.sepia / 100})`)\n\t}\n\tif (isFiniteNumber(props.blur)) {\n\t\tfilters.push(`blur(${props.blur}px)`)\n\t}\n\tif (props.dropShadows) {\n\t\tfilters.push(...shadowsAsFilter(props.dropShadows))\n\t}\n\n\tif (filters.length === 0) return\n\tstyle.filter = style.WebkitFilter = filters.join(\" \")\n}\n\nexport function collectBackgroundFilters(props: Partial<BackgroundFilterProperties>, style: MotionStyle) {\n\tif (isFiniteNumber(props.backgroundBlur)) {\n\t\tstyle.backdropFilter = style.WebkitBackdropFilter = `blur(${props.backgroundBlur}px)`\n\t}\n}\n\n/** @internal */\nexport function collectFiltersFromProps(\n\tprops: Partial<FilterProperties & BackgroundFilterProperties>,\n\tstyle: MotionStyle,\n): void {\n\tcollectBackgroundFilters(props, style)\n\tcollectLayerFilters(props, style)\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport type React from \"react\"\nimport type { BackgroundFilterProperties } from \"../traits/BackdropFilters.ts\"\nimport type { BackgroundProperties } from \"../traits/Background.ts\"\nimport { collectBackgroundFromProps } from \"../traits/Background.ts\"\nimport type { BlendingProperties } from \"../traits/Blending.ts\"\nimport { collectBlendingFromProps } from \"../traits/Blending.ts\"\nimport type { FilterProperties } from \"../traits/Filters.ts\"\nimport type { WithOpacity } from \"../traits/Opacity.ts\"\nimport { collectOpacityFromProps } from \"../traits/Opacity.ts\"\nimport type { OverflowProperties } from \"../traits/Overflow.ts\"\nimport { collectOverflowFromProps } from \"../traits/Overflow.ts\"\nimport type { RadiusProperties } from \"../traits/Radius.ts\"\nimport { collectRadiusFromProps } from \"../traits/Radius.ts\"\nimport type { BoxShadowProperties } from \"../traits/Shadow.ts\"\nimport type { TextColorProperties } from \"../traits/TextColor.ts\"\nimport { collectTextColorFromProps } from \"../traits/TextColor.ts\"\nimport { collectFiltersFromProps } from \"../utils/filtersForNode.ts\"\nimport { collectBoxShadowsForProps, collectTextShadowsForProps } from \"./shadow.tsx\"\n\n/** @public */\nexport type DeprecatedVisualProperties = Partial<\n\tBackgroundProperties &\n\t\tRadiusProperties &\n\t\tFilterProperties &\n\t\tBackgroundFilterProperties &\n\t\tBlendingProperties &\n\t\tOverflowProperties &\n\t\tBoxShadowProperties &\n\t\tWithOpacity &\n\t\tTextColorProperties\n>\n\n/** @internal */\nexport function collectVisualStyleFromProps(\n\tprops: DeprecatedVisualProperties,\n\tstyle: React.CSSProperties | MotionStyle,\n\tisTextNode: boolean = false,\n) {\n\tcollectBackgroundFromProps(props, style)\n\tcollectRadiusFromProps(props, style)\n\tcollectFiltersFromProps(props, style)\n\tcollectBlendingFromProps(props, style)\n\tcollectOverflowFromProps(props, style)\n\tcollectOpacityFromProps(props, style)\n\tcollectTextColorFromProps(props, style)\n\tif (isTextNode) {\n\t\tcollectTextShadowsForProps(props, style)\n\t} else {\n\t\tcollectBoxShadowsForProps(props, style)\n\t}\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport { resolveMotionValue } from \"framer-motion\"\nimport type React from \"react\"\nimport { Animatable } from \"../../animation/Animatable/Animatable.ts\"\nimport type { Size } from \"../../render/types/Size.ts\"\nimport { isFiniteNumber } from \"../../render/utils/isFiniteNumber.ts\"\nimport { RenderEnvironment, RenderTarget } from \"../types/RenderEnvironment.ts\"\n\nconst getNumber = /* @__PURE__ */ (() => Animatable.getNumber)()\n\nexport interface DeprecatedTransformProperties {\n\tz: Animatable<number> | number\n\trotation: Animatable<number> | number\n\trotationX: Animatable<number> | number\n\trotationY: Animatable<number> | number\n\trotationZ: Animatable<number> | number\n\tscale: Animatable<number> | number\n\tscaleX: Animatable<number> | number\n\tscaleY: Animatable<number> | number\n\tscaleZ: Animatable<number> | number\n\tskew: Animatable<number> | number\n\tskewX: Animatable<number> | number\n\tskewY: Animatable<number> | number\n\toriginX: Animatable<number> | number\n\toriginY: Animatable<number> | number\n\toriginZ: Animatable<number> | number\n}\n\nexport const transformDefaults: DeprecatedTransformProperties = {\n\tz: 0,\n\trotation: 0,\n\trotationX: 0,\n\trotationY: 0,\n\trotationZ: 0,\n\tscale: 1,\n\tscaleX: 1,\n\tscaleY: 1,\n\tscaleZ: 1,\n\tskew: 0,\n\tskewX: 0,\n\tskewY: 0,\n\toriginX: 0.5,\n\toriginY: 0.5,\n\toriginZ: 0,\n}\n\nfunction getRotation(rotation: number | Animatable<number>, rotate: number | string): number {\n\tif (typeof rotate === \"string\") {\n\t\trotate = parseFloat(rotate)\n\t}\n\treturn isFiniteNumber(rotate) ? rotate : getNumber(rotation)\n}\n\nexport function collectTransformFromProps(\n\tprops: DeprecatedTransformProperties,\n\trect: { x: number | string; y: number | string } & Size,\n\tstyle: React.CSSProperties,\n) {\n\tconst motionStyle = style as MotionStyle\n\t// 3d properties\n\tconst x = typeof rect.x === \"number\" ? `${rect.x}px` : rect.x\n\tconst y = typeof rect.y === \"number\" ? `${rect.y}px` : rect.y\n\tconst z = getNumber(props.z)\n\tconst scaleZ = getNumber(props.scaleZ)\n\tconst originZ = getNumber(props.originZ)\n\tconst rotationZ = getRotation(props.rotationZ, resolveMotionValue(motionStyle.rotateZ))\n\tconst rotationX = getRotation(props.rotationX, resolveMotionValue(motionStyle.rotateX))\n\tconst rotationY = getRotation(props.rotationY, resolveMotionValue(motionStyle.rotateY))\n\tconst scale = getNumber(props.scale)\n\tconst scaleX = getNumber(props.scaleX)\n\tconst scaleY = getNumber(props.scaleY)\n\tconst skew = getNumber(props.skew)\n\tconst skewX = getNumber(props.skewX)\n\tconst skewY = getNumber(props.skewY)\n\tconst rotation = getRotation(props.rotation, resolveMotionValue(motionStyle.rotate))\n\n\t// while exporting, using 3d transforms reduces artefacts in filters\n\tconst force3d = RenderEnvironment.target === RenderTarget.export\n\n\tif (force3d || z !== 0 || scaleZ !== 1 || originZ !== 0 || rotationZ !== 0 || rotationX !== 0 || rotationY !== 0) {\n\t\tstyle.transform = `\n            ${`translate3d(${x}, ${y}, ${z}px)`}\n            scale3d(${scaleX * scale}, ${scaleY * scale}, ${scaleZ})\n            skew(${skew}deg,${skew}deg)\n            skewX(${skewX}deg)\n            skewY(${skewY}deg)\n            translateZ(${originZ}px)\n            rotateX(${rotationX}deg)\n            rotateY(${rotationY}deg)\n            rotateZ(${(rotation + rotationZ).toFixed(4)}deg)\n            translateZ(${-originZ}px)`\n\t} else {\n\t\tstyle.transform = `\n            ${`translate(${x}, ${y})`}\n            scale(${scaleX * scale}, ${scaleY * scale})\n            skew(${skew}deg,${skew}deg)\n            skewX(${skewX}deg)\n            skewY(${skewY}deg)\n            rotate(${rotation.toFixed(4)}deg)`\n\t}\n\n\tconst transformOrigin = `${getNumber(props.originX) * 100}% ${getNumber(props.originY) * 100}%`\n\tstyle.transformOrigin = transformOrigin\n\tstyle.WebkitTransformOrigin = transformOrigin\n}\n", "import { asRecord } from \"../../utils/asRecord.ts\"\nimport { safeWindow } from \"../../utils/safeWindow.ts\"\n\nexport function countNodeRender() {\n\tif (process.env.NODE_ENV === \"production\") return\n\tconst perf = asRecord(safeWindow)[\"perf\"]\n\tif (!perf) return\n\t;(perf as any).nodeRender()\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport type React from \"react\"\nimport type { ReactNode } from \"react\"\nimport { Component } from \"react\"\nimport { asRecord } from \"../../utils/asRecord.ts\"\nimport type { Rect } from \"../types/Rect.ts\"\nimport { isEqual } from \"../utils/isEqual.ts\"\nimport { forceLayerBackingWithCSSProperties, forceLayerBackingWithMotionStyle } from \"../utils/setLayerBacked.ts\"\nimport { resetSetStyle } from \"../utils/useWebkitFixes.ts\"\n\n/** @public */\nexport interface IdentityProps {\n\t/** An unique id for the layer */\n\tid?: string\n\tduplicatedFrom?: string[]\n}\n\nexport interface WillChangeTransformProp {\n\t/** @deprecated */\n\twillChangeTransform?: boolean\n}\n\n/** @public */\nexport interface DOMLayoutProps {\n\t/** @internal */\n\t_needsMeasure?: boolean\n\t/** @internal */\n\t_usesDOMRect?: boolean\n\t/** @internal */\n\t_domRect?: Rect | null\n}\n\n/** @public */\nexport interface LayerProps extends IdentityProps, WillChangeTransformProp, DOMLayoutProps {\n\tchildren?: ReactNode\n\tkey?: React.Attributes[\"key\"]\n\t/**\n\t * @internal a stable identifier to use when generating layoutIds based on\n\t * duplicatedFrom.\n\t */\n\tlayoutIdKey?: string\n\t/**\n\t * @internal the prefixed node id, used for the forwarded overrides look up\n\t */\n\t_forwardedOverrideId?: string\n\t/** @internal */\n\t_forwardedOverrides?: { [key: string]: unknown }\n\t/** @internal */\n\t_index?: number\n\t/** @internal */\n}\n\n// Confused how two definitions with the same name work? See https://stackoverflow.com/a/67697999\n// Note that `Layer` in `InstanceType<typeof Layer>` refers to the constant, not the type.\n/** @public */\nexport type Layer = InstanceType<typeof Layer>\n/** @public */\nexport const Layer = /* @__PURE__ */ (() => {\n\t// We\u2019re wrapping the whole Layer class with `@__PURE__` because esbuild\n\t// can\u2019t compile static class properties in a tree-shakeable way: https://github.com/evanw/esbuild/issues/3765.\n\t// The wrapper allows them to stay in the IIFE and be tree-shaken.\n\t// If/when esbuild fixes that issue, we can remove `export type Layer`\n\t// and `export const Layer` and just export the class directly.\n\tclass Layer<P extends Partial<LayerProps>, S> extends Component<P, S> {\n\t\tstatic readonly defaultProps: LayerProps = {}\n\n\t\tstatic applyWillChange(props: WillChangeTransformProp, style: MotionStyle, usingMotionStyle: boolean) {\n\t\t\tif (props.willChangeTransform) {\n\t\t\t\tif (usingMotionStyle) {\n\t\t\t\t\tforceLayerBackingWithMotionStyle(style)\n\t\t\t\t} else {\n\t\t\t\t\tforceLayerBackingWithCSSProperties(style)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/** @private (Just using `private` breaks compilation unless using `stripInternal`) */\n\t\tlayerElement: HTMLElement | SVGElement | null = null\n\n\t\tsetLayerElement = (element: HTMLElement | SVGElement | null) => {\n\t\t\tthis.layerElement = element\n\t\t}\n\n\t\t/** @internal */\n\t\toverride shouldComponentUpdate(nextProps: P, nextState: S) {\n\t\t\treturn nextProps._needsMeasure || this.state !== nextState || !isEqual(this.props, nextProps)\n\t\t}\n\n\t\t/** @internal */\n\t\toverride componentDidUpdate(prevProps: P) {\n\t\t\t// Workarounds for WebKit bugs\n\n\t\t\t// Some styles have to be toggled to take effect in certain situations.\n\t\t\t// Not using type safety, uses lots of internal knowledge for efficiency\n\t\t\t// To use this as a hook, see useWebKitFixes\n\n\t\t\tif (asRecord(this.props)[\"clip\"] && asRecord(this.props)[\"radius\"] === 0 && asRecord(prevProps)[\"radius\"] !== 0) {\n\t\t\t\tresetSetStyle(this.layerElement, \"overflow\", \"hidden\", false)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn Layer\n})()\n", "import { isFramerX, isSafari, isTest } from \"@framerjs/shared/src/environment.ts\"\nimport type { MotionStyle } from \"framer-motion\"\nimport type { CSSProperties } from \"react\"\nimport { isString } from \"../../utils/utils.ts\"\nimport { RenderTarget } from \"../types/RenderEnvironment.ts\"\n\n/**\n * This file contains a bunch of helpers to force browser to render elements\n * with layer backing (GPU accelleration)\n */\n\n/**\n * The string in this smallValue is very specifically \"0.000001px\".\n *\n * - Safari before Catalina will change 1e-7 into 0.0000001px\n * - Safari in Catalina will change 0.0000001px into 1e-7\n *\n * So this value should be \"0.000001px\" (1e-6) and not smaller, because\n * otherwise it will break the string replacement for removing the translateZ\n * hack.\n */\nconst smallValue = \"0.000001px\"\nexport const translateZ = /* @__PURE__ */ (() => ` translateZ(${smallValue})`)()\n// We only apply this hack on the canvas and in Safari or FramerX\nconst useTranslateZHack = /* @__PURE__ */ (() => isFramerX() || isSafari() || isTest())()\n\n/**\n * Forces layer backing during rendering with a motion style\n */\nexport function forceLayerBackingWithMotionStyle(motionStyle: MotionStyle): void {\n\t// This forces 3d acceleration on Chrome\n\tmotionStyle.willChange = \"transform\"\n\n\t// We only want to use the translateZ hack on the canvas\n\tconst onCanvas = RenderTarget.current() === RenderTarget.canvas\n\n\tif (useTranslateZHack && onCanvas) {\n\t\tmotionStyle.translateZ = smallValue\n\t}\n}\n\n/**\n * Forces layer backing during rendering with React's CSS properties\n *\n * @internal\n */\nexport function forceLayerBackingWithCSSProperties(cssProperties: CSSProperties | MotionStyle) {\n\t// This forces 3d acceleration on Chrome\n\tcssProperties.willChange = \"transform\"\n\tsetTranslateZHack(cssProperties, true)\n}\n\n/**\n * Forces layer backing by changing the style of an HTML Element that is already\n * rendered to the DOM\n * @param element The HTML element to force the layer backing on\n * @param enabled Whether to enable forced layer backing. If `true` the styles\n * will be modified to force layer backing. If `false` those styles will be\n * removed from the element\n */\nexport function forceLayerBackingOnElement(element: HTMLElement, enabled: boolean) {\n\tif (enabled) {\n\t\tconst willChange = element.style.willChange || \"\"\n\t\tif (willChange !== \"transform\") {\n\t\t\t// This forces 3d acceleration on Chrome\n\t\t\telement.style.willChange = \"transform\"\n\t\t}\n\t} else {\n\t\telement.style.removeProperty(\"will-change\")\n\t}\n\tsetTranslateZHack(element.style, enabled)\n}\n\n/**\n * Within Safari we can force gpu layers (avoid dumping them) by adding a small\n * translateZ value:\n * https://github.com/WebKit/webkit/blob/6ddbf54e861f9df5e0171422c32cc6173120f717/LayoutTests/compositing/layer-creation/compositing-policy.html#L23\n * So to prevent this memory heuristic to trigger, we also rig those layers with\n * a tiny translateZ property.\n */\n\nfunction setTranslateZHack(style: CSSStyleDeclaration | CSSProperties | MotionStyle, enabled: boolean) {\n\tconst onCanvas = RenderTarget.current() === RenderTarget.canvas\n\tif (!useTranslateZHack || !onCanvas) {\n\t\t// We only want to use the translateZ hack in Safari and FramerX on the canvas\n\t\treturn\n\t}\n\tconst transform = isString(style.transform) ? style.transform || \"\" : \"\"\n\tif (enabled) {\n\t\tconst hasTranslateZ = transform.includes(translateZ)\n\t\tif (!hasTranslateZ) {\n\t\t\tstyle.transform = transform + translateZ\n\t\t}\n\t} else {\n\t\tstyle.transform = transform.replace(translateZ, \"\")\n\t}\n}\n", "import { asRecord } from \"../../utils/asRecord.ts\"\nimport { isNull, isNumber, isString } from \"../../utils/utils.ts\"\n\n/** @internal */\nexport function resetSetStyle(\n\telement: HTMLElement | SVGElement | null,\n\tkey: string,\n\ttoValue: unknown,\n\tmicrotask: boolean = true,\n) {\n\tif (!element) {\n\t\treturn\n\t}\n\n\tconst style = asRecord(element.style)\n\tconst value = toValue ? toValue : style[key]\n\tconst reset = () => {\n\t\tif (!isValidCSSStyleValue(value)) return\n\t\tstyle[key] = value\n\t}\n\tstyle[key] = null\n\tif (microtask) {\n\t\tvoid Promise.resolve().then(reset)\n\t} else {\n\t\tsetTimeout(reset, 0)\n\t}\n}\n\nfunction isValidCSSStyleValue(value: unknown): value is string | number | null {\n\treturn isString(value) || isNumber(value) || isNull(value)\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport { isValidMotionProp, resolveMotionValue } from \"framer-motion\"\nimport type { RefObject } from \"react\"\nimport React, { forwardRef, useContext, useRef } from \"react\"\nimport { isStaticRenderer } from \"../../../modules/useIsStaticRenderer.ts\"\nimport { asRecord } from \"../../../utils/asRecord.ts\"\nimport { isPropValid } from \"../../../utils/isPropValid.ts\"\nimport { runtime } from \"../../../utils/runtimeInjection.ts\"\nimport { BackgroundImageComponent } from \"../../style/BackgroundImageComponent.tsx\"\nimport type { ImageAltProps } from \"../../style/BackgroundImageComponent.tsx\"\nimport { Border } from \"../../style/BorderComponent.tsx\"\nimport { backgroundImageFromProps } from \"../../style/backgroundImageFromProps.ts\"\nimport type { BackgroundProperties } from \"../../traits/Background.ts\"\nimport type { FitImageDimensionType } from \"../../types/BackgroundImage.ts\"\nimport { DimensionType } from \"../../types/Constraints.ts\"\nimport type { ConstraintConfiguration, NewConstraintProperties, ParentSize } from \"../../types/NewConstraints.tsx\"\nimport {\n\tParentSizeState,\n\tconstraintsEnabled,\n\tisAutoSized,\n\tuseConstraints,\n\tuseProvideParentSize,\n} from \"../../types/NewConstraints.tsx\"\nimport type { Rect } from \"../../types/Rect.ts\"\nimport { RenderTarget } from \"../../types/RenderEnvironment.ts\"\nimport { getIntrinsicSizeForBackgroundImage } from \"../../utils/getIntrinsicSizeForBackgroundImage.ts\"\nimport { htmlElementAsMotionComponent } from \"../../utils/htmlElementAsMotionComponent.ts\"\nimport { withLibraryCSS } from \"../../utils/injectComponentCSSRules.ts\"\nimport { layoutHintDataPropsForCenter } from \"../../utils/layoutHintDataPropsForCenter.ts\"\nimport { nodeIdFromString } from \"../../utils/nodeIdFromString.ts\"\nimport { countNodeRender } from \"../../utils/performanceDebugging.ts\"\nimport { processOverrideForwarding } from \"../../utils/processOverrideForwarding.ts\"\nimport { transformTemplate } from \"../../utils/transformTemplate.ts\"\nimport { useLayoutId } from \"../../utils/useLayoutId.ts\"\nimport { useMeasureLayout } from \"../../utils/useMeasureLayout.ts\"\nimport { ComponentContainerContext } from \"../ComponentContainerContext.tsx\"\nimport type { LayerProps } from \"../Layer.tsx\"\nimport { Layer } from \"../Layer.tsx\"\nimport { getStyleForFrameProps, hasLeftAndRight, hasTopAndBottom } from \"./getStyleForFrameProps.ts\"\nimport type {\n\tBaseFrameProps,\n\tCSSTransformProperties,\n\tFrameLayoutProperties,\n\tMotionDivProps,\n\tVisualProperties,\n} from \"./types.ts\"\n\nfunction hasEvents(props: Partial<FrameProps>) {\n\tfor (const key in props) {\n\t\tif (\n\t\t\tkey === \"drag\" ||\n\t\t\tkey.startsWith(\"while\") ||\n\t\t\t(typeof asRecord(props)[key] === \"function\" && key.startsWith(\"on\") && !key.includes(\"Animation\"))\n\t\t) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\nconst pointerEvents = [\n\t\"onClick\",\n\t\"onDoubleClick\",\n\t\"onMouse\",\n\t\"onMouseDown\",\n\t\"onMouseUp\",\n\t\"onTapDown\",\n\t\"onTap\",\n\t\"onTapUp\",\n\t\"onPointer\",\n\t\"onPointerDown\",\n\t\"onPointerUp\",\n\t\"onTouch\",\n\t\"onTouchDown\",\n\t\"onTouchUp\",\n]\nconst pointerEventsSet = /* @__PURE__ */ (() =>\n\tnew Set([\n\t\t...pointerEvents,\n\t\t...pointerEvents.map(event => `${event}Capture`), // Add capture event variants\n\t]))()\n\nfunction getCursorFromEvents(props: Partial<FrameProps>) {\n\tif (props.drag) {\n\t\treturn \"grab\"\n\t}\n\n\tfor (const key in props) {\n\t\tif (pointerEventsSet.has(key)) {\n\t\t\treturn \"pointer\"\n\t\t}\n\t}\n\n\treturn undefined\n}\n\nconst overflowKey: keyof React.CSSProperties = \"overflow\"\nfunction hasScrollableContent(props: Partial<FrameProps>): boolean {\n\tif (hasScrollingOverflow(props)) return true\n\tif (!props.style) return false\n\tif (hasScrollingOverflow(props.style)) return true\n\treturn false\n}\n\nfunction hasScrollingOverflow(props: Partial<Record<typeof overflowKey, unknown>>) {\n\tif (overflowKey in props && (props[overflowKey] === \"scroll\" || props[overflowKey] === \"auto\")) return true\n\treturn false\n}\n\n/** @internal */\nexport function unwrapFrameProps(\n\tframeProps: Partial<FrameLayoutProperties & ConstraintConfiguration>,\n): Partial<NewConstraintProperties> {\n\tconst {\n\t\tleft,\n\t\ttop,\n\t\tbottom,\n\t\tright,\n\t\twidth,\n\t\theight,\n\t\tcenter,\n\t\t_constraints,\n\t\tsize,\n\t\twidthType,\n\t\theightType,\n\t\tpositionFixed,\n\t\tpositionAbsolute,\n\t} = frameProps\n\n\tconst minWidth = resolveMotionValue(frameProps.minWidth)\n\tconst minHeight = resolveMotionValue(frameProps.minHeight)\n\tconst maxWidth = resolveMotionValue(frameProps.maxWidth)\n\tconst maxHeight = resolveMotionValue(frameProps.maxHeight)\n\n\tconst constraintProps: Partial<NewConstraintProperties> = {\n\t\ttop: resolveMotionValue(top),\n\t\tleft: resolveMotionValue(left),\n\t\tbottom: resolveMotionValue(bottom),\n\t\tright: resolveMotionValue(right),\n\t\twidth: resolveMotionValue(width),\n\t\theight: resolveMotionValue(height),\n\t\tsize: resolveMotionValue(size),\n\t\tcenter,\n\t\t_constraints,\n\t\twidthType,\n\t\theightType,\n\t\tpositionFixed,\n\t\tpositionAbsolute,\n\t\tminWidth,\n\t\tminHeight,\n\t\tmaxWidth,\n\t\tmaxHeight,\n\t}\n\treturn constraintProps\n}\n\n/** @public */\nexport interface FrameProps\n\textends\n\t\tImageAltProps,\n\t\tBackgroundProperties,\n\t\tVisualProperties,\n\t\tOmit<MotionDivProps, \"color\" | \"children\">,\n\t\tCSSTransformProperties,\n\t\tLayerProps,\n\t\tFrameLayoutProperties,\n\t\tConstraintConfiguration,\n\t\tBaseFrameProps {\n\tcomponentType?: string\n\tas?: keyof HTMLElementTagNameMap | \"svg\"\n\t/** @internal */\n\t__layoutId?: string | undefined\n\t/** @internal */\n\t__fromCanvasComponent?: boolean\n\t/** @internal */\n\t__portal?: React.ReactNode\n\t/** @internal */\n\tfitImageDimension?: FitImageDimensionType\n}\n\nexport const defaultFrameRect = { x: 0, y: 0, width: 200, height: 200 }\n\nexport function useStyleAndRect(props: Partial<FrameProps>): [MotionStyle, Rect | null] {\n\tconst inCodeComponent = useContext(ComponentContainerContext)\n\n\tconst { style, _initialStyle, __fromCanvasComponent, size } = props\n\tconst unwrappedProps = unwrapFrameProps(props)\n\tconst constraintsRect = useConstraints(unwrappedProps)\n\n\tconst defaultStyle: MotionStyle = {\n\t\tdisplay: \"block\",\n\t\tflex: style?.flex ?? \"0 0 auto\",\n\t\tuserSelect: RenderTarget.current() !== RenderTarget.preview ? \"none\" : undefined,\n\t}\n\n\tif (!props.__fromCanvasComponent) {\n\t\t// XXX: this is hack until we find a better solution\n\t\tdefaultStyle.backgroundColor = props.background === undefined ? \"rgba(0, 170, 255, 0.3)\" : undefined\n\t}\n\n\t// To support setting overflow: auto on stacks in generated code, especially\n\t// in responsive screens, we need to ensure that pointerEvents: \"none\" is\n\t// not set if the Frame has no interaction events. There is no other way to\n\t// check in generated responsive screens, because overflow is set via css\n\t// classes, not inline style.\n\tconst shouldDisablePointerEvents = !hasEvents(props) && !props.__fromCanvasComponent && !hasScrollableContent(props)\n\tconst safeToEditPointerEvents = props.style ? !(\"pointerEvents\" in props.style) : true\n\tif (shouldDisablePointerEvents && safeToEditPointerEvents) {\n\t\tdefaultStyle.pointerEvents = \"none\"\n\t}\n\n\tconst addTextCentering =\n\t\tReact.Children.count(props.children) > 0 &&\n\t\tReact.Children.toArray(props.children).every(child => {\n\t\t\treturn typeof child === \"string\" || typeof child === \"number\"\n\t\t})\n\tconst centerTextStyle = addTextCentering && {\n\t\tdisplay: \"flex\",\n\t\talignItems: \"center\",\n\t\tjustifyContent: \"center\",\n\t\ttextAlign: \"center\",\n\t}\n\n\tconst propsStyle = getStyleForFrameProps(props)\n\n\tif (size === undefined && !__fromCanvasComponent) {\n\t\tif (!hasLeftAndRight(propsStyle)) {\n\t\t\tdefaultStyle.width = defaultFrameRect.width\n\t\t}\n\n\t\tif (!hasTopAndBottom(propsStyle)) {\n\t\t\tdefaultStyle.height = defaultFrameRect.height\n\t\t}\n\t}\n\n\tif (unwrappedProps.minWidth !== undefined) {\n\t\tdefaultStyle.minWidth = unwrappedProps.minWidth\n\t}\n\n\tif (unwrappedProps.minHeight !== undefined) {\n\t\tdefaultStyle.minHeight = unwrappedProps.minHeight\n\t}\n\n\tlet constraintsStyle: MotionStyle = {}\n\n\tif (constraintsEnabled(unwrappedProps)) {\n\t\t// When we have an auto-sized dimension, the constraints rect will be\n\t\t// based on stale cached values, so we won't use it.\n\t\tif (constraintsRect && !isAutoSized(props)) {\n\t\t\tconstraintsStyle = {\n\t\t\t\tleft: constraintsRect.x,\n\t\t\t\ttop: constraintsRect.y,\n\t\t\t\twidth: constraintsRect.width,\n\t\t\t\theight: constraintsRect.height,\n\t\t\t\tright: undefined,\n\t\t\t\tbottom: undefined,\n\t\t\t}\n\t\t}\n\t}\n\n\t// In theory we should not have constraints and props styles at the same time\n\t// because we use constraints internally in vekter and top level props are only for usage from customer code\n\t//\n\t// In practice we have it with code overrides\n\t// But we take `propsStyle` priority in any case now\n\tObject.assign(defaultStyle, centerTextStyle, _initialStyle, propsStyle, constraintsStyle, style)\n\t// React styling library doesn't work well when combining long-hand and short-hand values, so we just use short-hand values always\n\tObject.assign(defaultStyle, {\n\t\toverflowX: defaultStyle.overflowX ?? defaultStyle.overflow,\n\t\toverflowY: defaultStyle.overflowY ?? defaultStyle.overflow,\n\t\toverflow: undefined,\n\t})\n\n\tLayer.applyWillChange(props, defaultStyle, true)\n\n\tlet resultStyle = defaultStyle\n\tif (!defaultStyle.transform) {\n\t\t// Reset the transform explicitly, because Framer Motion will not treat undefined values as 0 and still generate a transform\n\t\tresultStyle = { x: 0, y: 0, ...defaultStyle }\n\t}\n\n\tconst isRenderingStaticContent = isStaticRenderer()\n\tif (props.positionSticky) {\n\t\tif (!isRenderingStaticContent || runtime.isOnPageCanvas || inCodeComponent) {\n\t\t\tresultStyle.position = \"sticky\"\n\t\t\tresultStyle.willChange = \"transform\"\n\t\t\tresultStyle.top = props.positionStickyTop\n\t\t\tresultStyle.right = props.positionStickyRight\n\t\t\tresultStyle.bottom = props.positionStickyBottom\n\t\t\tresultStyle.left = props.positionStickyLeft\n\t\t}\n\t} else if (isRenderingStaticContent) {\n\t\tif (props.positionFixed) {\n\t\t\t// on-page editing requires \"position: fixed\" as a published website\n\t\t\tresultStyle.position = runtime.isOnPageCanvas ? \"fixed\" : \"absolute\"\n\t\t} else if (props.positionAbsolute) {\n\t\t\tresultStyle.position = \"absolute\"\n\t\t}\n\t}\n\n\t// Work around a framer-motion bug where key: undefined style values which\n\t// are moved to transforms add `fn(undefined)` to the transform string. Issue:\n\t// https://github.com/framer/company/issues/25915.\n\tif (\"rotate\" in resultStyle && resultStyle.rotate === undefined) {\n\t\tdelete resultStyle.rotate\n\t}\n\n\treturn [resultStyle, constraintsRect]\n}\n\n// These properties are considered valid React DOM props because they're valid\n// SVG props, so we need to manually exclude them.\nconst filteredProps = new Set([\n\t\"width\",\n\t\"height\",\n\t\"opacity\",\n\t\"overflow\",\n\t\"radius\",\n\t\"background\",\n\t\"color\",\n\t\"x\",\n\t\"y\",\n\t\"z\",\n\t\"rotate\",\n\t\"rotateX\",\n\t\"rotateY\",\n\t\"rotateZ\",\n\t\"scale\",\n\t\"scaleX\",\n\t\"scaleY\",\n\t\"skew\",\n\t\"skewX\",\n\t\"skewY\",\n\t\"originX\",\n\t\"originY\",\n\t\"originZ\",\n])\n\nfunction getMotionProps(props: Partial<FrameProps>): MotionDivProps {\n\tconst motionProps: Record<string, unknown> = {}\n\n\tfor (const key in props) {\n\t\tconst isValid = isValidMotionProp(key) || isPropValid(key)\n\t\tif (isValid && !filteredProps.has(key)) {\n\t\t\tmotionProps[key] = asRecord(props)[key]\n\t\t} else if (key === \"positionTransition\" || key === \"layoutTransition\") {\n\t\t\t/** Support legacy layout animation props */\n\t\t\tmotionProps[\"layout\"] = true\n\t\t\tif (typeof asRecord(props)[key] !== \"boolean\" && !props.transition) {\n\t\t\t\tmotionProps[\"transition\"] = asRecord(props)[key]\n\t\t\t}\n\t\t}\n\t}\n\n\treturn motionProps\n}\n\nfunction hasDataFramerName(props: Partial<FrameProps>) {\n\treturn \"data-framer-name\" in props\n}\n\n/** @internal */\nconst VisibleFrame = /* @__PURE__ */ forwardRef(function VisibleFrame(\n\tprops: Partial<FrameProps>,\n\tforwardedRef: RefObject<HTMLDivElement> | null,\n) {\n\tconst { name, center, border, _border, __portal } = props\n\tconst { props: propsWithOverrides, children } = processOverrideForwarding(props)\n\tconst motionProps = getMotionProps(propsWithOverrides)\n\tconst layoutId = useLayoutId(props)\n\tconst cursor = getCursorFromEvents(props)\n\tconst fallbackRef = useRef<HTMLDivElement>(null)\n\tconst ref = forwardedRef ?? fallbackRef\n\n\tconst dataProps = {\n\t\t\"data-framer-component-type\": props.componentType ?? \"Frame\",\n\t\t\"data-framer-cursor\": cursor,\n\t\t\"data-framer-highlight\": cursor === \"pointer\" ? true : undefined,\n\t\t\"data-layoutid\": layoutId,\n\t\t\"data-framer-offset-parent-id\": asRecord(props)[\"data-framer-offset-parent-id\"],\n\t}\n\n\t// Vekter provides the `data-framer-name` prop. However to maintain api\n\t// compatibility when Frame is used in code, set `data-framer-name` if\n\t// `name` is provided and `data-framer-name` is not.\n\tif (!hasDataFramerName(props) && name) {\n\t\tasRecord(dataProps)[\"data-framer-name\"] = name\n\t}\n\n\tconst [currentStyle, rect] = useStyleAndRect(propsWithOverrides)\n\n\tconst unwrappedProps = unwrapFrameProps(propsWithOverrides)\n\tconst autoSized = isAutoSized(unwrappedProps)\n\n\tif (center && !(rect && !autoSized && constraintsEnabled(unwrappedProps))) {\n\t\tif (!motionProps.transformTemplate) motionProps.transformTemplate = transformTemplate(center)\n\t\tObject.assign(dataProps, layoutHintDataPropsForCenter(center))\n\t} else if (!motionProps.transformTemplate) {\n\t\tmotionProps.transformTemplate = undefined\n\t}\n\n\tuseMeasureLayout(props, ref)\n\n\tconst backgroundImage = backgroundImageFromProps(props)\n\n\t// The parentSize resolved here won't be used if a parent further up the\n\t// tree disabled parent size resolution (e.g. when rendering inside a code component)\n\tconst inCodeComponent = useContext(ComponentContainerContext)\n\tconst parentSize = resolveParentSize(propsWithOverrides, unwrappedProps, rect, inCodeComponent)\n\tconst wrappedContent = useProvideParentSize(\n\t\t<>\n\t\t\t{backgroundImage ? (\n\t\t\t\t<BackgroundImageComponent\n\t\t\t\t\talt={props.alt ?? \"\"}\n\t\t\t\t\timage={backgroundImage}\n\t\t\t\t\tcontainerSize={rect ?? undefined}\n\t\t\t\t\tnodeId={props.id && nodeIdFromString(props.id)}\n\t\t\t\t\tlayoutId={layoutId}\n\t\t\t\t/>\n\t\t\t) : null}\n\n\t\t\t{children}\n\n\t\t\t<Border {..._border} border={border} layoutId={layoutId} />\n\t\t</>,\n\t\tparentSize,\n\t)\n\n\tconst MotionComponent = htmlElementAsMotionComponent(props.as)\n\n\tconst intrinsicSize = getIntrinsicSizeForBackgroundImage(backgroundImage)\n\tif (props.fitImageDimension && intrinsicSize) {\n\t\tcurrentStyle[props.fitImageDimension] = \"auto\"\n\t\tcurrentStyle.aspectRatio = intrinsicSize.width / intrinsicSize.height\n\t}\n\n\treturn (\n\t\t<MotionComponent {...dataProps} {...motionProps} layoutId={layoutId} style={currentStyle} ref={ref}>\n\t\t\t{wrappedContent}\n\t\t\t{__portal}\n\t\t</MotionComponent>\n\t)\n})\n\n/** @internal */\nconst FrameWithMotionInner = /* @__PURE__ */ forwardRef<HTMLDivElement, Partial<FrameProps>>(\n\tfunction FrameWithMotion(props, ref) {\n\t\tcountNodeRender()\n\t\tconst { visible = true } = props\n\t\tif (!visible) return null\n\n\t\treturn <VisibleFrame {...props} ref={ref} />\n\t},\n)\n\n/** @internal */\nexport const FrameWithMotion = /* @__PURE__ */ withLibraryCSS(FrameWithMotionInner)\n\nfunction resolveParentSize(\n\tprops: Partial<FrameProps>,\n\tunwrappedProps: Partial<NewConstraintProperties>,\n\trect: Rect | null,\n\tinCodeComponent: boolean,\n): ParentSize {\n\tif (inCodeComponent) {\n\t\tconst parentSize = rect ? { width: rect.width, height: rect.height } : ParentSizeState.Disabled\n\t\treturn parentSize\n\t}\n\n\tconst { _usesDOMRect } = props\n\tconst {\n\t\twidthType = DimensionType.FixedNumber,\n\t\theightType = DimensionType.FixedNumber,\n\t\twidth,\n\t\theight,\n\t} = unwrappedProps\n\n\t// The constraints rect might be based on stale layout information, or\n\t// return defaults if this is a DOM layout node, so we won't use it unless\n\t// `usesDOMRect` is also false\n\tif (rect && !_usesDOMRect) {\n\t\treturn rect\n\t}\n\n\t// Even if we can't resolve a full rect (e.g. when the node relies on DOM\n\t// layout for positioning), we might still be able to provide a size if this\n\t// is a fixed-size node\n\tif (\n\t\twidthType === DimensionType.FixedNumber &&\n\t\theightType === DimensionType.FixedNumber &&\n\t\ttypeof width === \"number\" &&\n\t\ttypeof height === \"number\"\n\t) {\n\t\treturn { width, height }\n\t}\n\n\t// If this is a DOM layout node, or position fixed, we need to return\n\t// DisabledForCurrentLevel, instead of Disabled, because that way children\n\t// will still render using DOM layout, but we won't prevent any descendants\n\t// from using a resolved parent size further down the hierarchy\n\tif (_usesDOMRect || props.positionFixed || props.positionAbsolute) {\n\t\treturn ParentSizeState.DisabledForCurrentLevel\n\t}\n\n\t// If all else fails, return unknown\n\treturn ParentSizeState.Unknown\n}\n", "import { useState } from \"react\"\nimport { RenderTarget } from \"../render/types/RenderEnvironment.ts\"\n\n/**\n * Returns true if the caller is executed in a Framer Canvas or Export Canvas environment, or false\n * otherwise. This function could be used outside of a React component; the value it returns will\n * never change.\n *\n * @public\n */\nexport function isStaticRenderer() {\n\tconst currentTarget = RenderTarget.current()\n\treturn currentTarget === RenderTarget.canvas || currentTarget === RenderTarget.export\n}\n\n/**\n * Returns a constant value based on whether the caller is mounted in a Framer Canvas or Export\n * Canvas environment.\n *\n * If you need to use this outside of React, use `isStaticRenderer()` instead.\n *\n * @public\n */\nexport function useIsStaticRenderer() {\n\t// Even though `isStaticRenderer` returns a constant value and can be easily used inside React\n\t// components, we still offer the non-hook version of it for consistency with existing APIs. To\n\t// make sure this hook isn\u2019t used outside of React and actually follows rules of hooks, we call\n\t// a useState inside it.\n\tconst [isStatic] = useState(() => isStaticRenderer())\n\treturn isStatic\n}\n", "/**\n * @license Emotion v11.0.0\n * MIT License\n *\n * Copyright (c) Emotion team and other contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n/*\n * The code below is copied from the emotion repo to reduce external\n * dependencies and to have control over the build output.\n */\n\n// https://github.com/emotion-js/emotion/blob/%40emotion/is-prop-valid%401.2.0/packages/memoize/src/index.js\nfunction memoize<V>(fn: (arg: string) => V): (arg: string) => V {\n\tconst cache = Object.create(Object.prototype)\n\n\treturn (arg: string) => {\n\t\tif (cache[arg] === undefined) cache[arg] = fn(arg)\n\t\treturn cache[arg]\n\t}\n}\n\n// https://github.com/emotion-js/emotion/blob/%40emotion/is-prop-valid%401.2.0/packages/is-prop-valid/src/props.js\nconst reactPropsRegex =\n\t/^(?:children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|[dkrxyz]|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y1|y2|yChannelSelector|zoomAndPan|for|class|autofocus|(?:[Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*)$/u // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23\n\n// https://github.com/emotion-js/emotion/blob/%40emotion/is-prop-valid%401.2.0/packages/is-prop-valid/src/index.js\nexport const isPropValid = /* #__PURE__ */ memoize(\n\tprop =>\n\t\treactPropsRegex.test(prop) ||\n\t\t(prop.charCodeAt(0) === 111 /* o */ && prop.charCodeAt(1) === 110 /* n */ && prop.charCodeAt(2) < 91) /* Z+1 */,\n)\n", "import { motion } from \"framer-motion\"\nimport React, { useCallback, type HTMLAttributes } from \"react\"\nimport { runtime } from \"../../utils/runtimeInjection.ts\"\nimport { encodeSVGForCSS, isNumber, isString } from \"../../utils/utils.ts\"\nimport type { BackgroundImage, ImageFit } from \"../types/BackgroundImage.ts\"\nimport { RenderTarget } from \"../types/RenderEnvironment.ts\"\nimport type { Size } from \"../types/Size.ts\"\nimport { cornerPropertiesToInherit } from \"../utils/corners.ts\"\nimport { roundToHalfPixel } from \"../utils/roundedNumber.ts\"\nimport { getSrcSet } from \"./getSrcSet.ts\"\n\nconst wrapperStyle: React.CSSProperties = /* @__PURE__ */ (() => ({\n\tposition: \"absolute\",\n\t...cornerPropertiesToInherit,\n\ttop: 0,\n\tright: 0,\n\tbottom: 0,\n\tleft: 0,\n}))()\n\nfunction getPlaceholderStyle(): React.CSSProperties {\n\treturn {\n\t\tbackgroundRepeat: \"repeat\",\n\t\tbackgroundPosition: \"left top\",\n\t\tbackgroundSize: \"64px auto\",\n\t\tbackgroundImage: encodeSVGForCSS(runtime.imagePlaceholderSvg),\n\t}\n}\n\nfunction cssObjectFit(imageFit?: ImageFit) {\n\tswitch (imageFit) {\n\t\tcase \"fit\":\n\t\t\treturn \"contain\"\n\t\tcase \"stretch\":\n\t\t\treturn \"fill\"\n\t\tdefault:\n\t\t\treturn \"cover\"\n\t}\n}\n\nfunction cssObjectPosition(positionX: BackgroundImage[\"positionX\"], positionY: BackgroundImage[\"positionY\"]): string {\n\tconst x = positionX ?? \"center\"\n\tconst y = positionY ?? \"center\"\n\tif (x === \"center\" && y === \"center\") return \"center\"\n\treturn x + \" \" + y\n}\n\nfunction getImageStyle(image: BackgroundImage): React.CSSProperties {\n\treturn {\n\t\tdisplay: \"block\",\n\t\twidth: \"100%\",\n\t\theight: \"100%\",\n\t\t...cornerPropertiesToInherit,\n\t\tobjectPosition: cssObjectPosition(image.positionX, image.positionY),\n\t\tobjectFit: cssObjectFit(image.fit),\n\t}\n}\n\nexport interface ImageAltProps {\n\t/**\n\t * Previously, alt was set on the BackgroundImage object. This caused issues\n\t * where the entire object would need to be replaced in order to update the\n\t * alt attribute. Now we provide a specific prop for the alt attribute so it\n\t * can change even if the background object does not and vice versa. This\n\t * needs to be optional so that old sites and Smart Components generated\n\t * with alt in the BackgroundImage object do not error. Those sites and\n\t * Smart Components will correctly fallback to BackgroundImage.alt.\n\t */\n\talt?: string\n}\n\ninterface InnerImageProps extends ImageAltProps {\n\timage: BackgroundImage\n\tcontainerSize?: Size\n\tnodeId?: string\n\tdraggable?: HTMLAttributes<HTMLDivElement>[\"draggable\"]\n\tavoidAsyncDecoding?: boolean\n}\n\n/**\n * This defines the following behavior:\n * - While the image is loading, or JS hasn\u2019t loaded yet: render with decoding=\"async\" (unless\n *   forced otherwise)\n * - Once the image is loaded: switch to decoding=\"auto\"\n *\n * This ensures images don\u2019t introduce animation jank when they are mounted for the first time, but\n * also don\u2019t experience white flashes [1] when their `src` changes later (eg due to a resize or a\n * `sizes` change).\n * [1] https://framer-team.slack.com/archives/C01B14R6E22/p1736530731563399\n */\nfunction useDecodingAttribute(avoidAsyncDecoding: boolean | undefined) {\n\tconst currentDecoding = React.useRef<\"sync\" | \"async\" | \"auto\">(avoidAsyncDecoding ? \"auto\" : \"async\")\n\n\tconst switchDecodingToAuto = useCallback((node: HTMLImageElement) => {\n\t\tcurrentDecoding.current = \"auto\"\n\t\tnode.decoding = \"auto\"\n\t}, [])\n\n\tconst onImageLoad = useCallback(\n\t\t(event: React.SyntheticEvent<HTMLImageElement>) => {\n\t\t\tswitchDecodingToAuto(event.currentTarget)\n\t\t},\n\t\t[switchDecodingToAuto],\n\t)\n\n\tconst onImageMount = useCallback(\n\t\t(node: HTMLImageElement | null) => {\n\t\t\tif (node?.complete) switchDecodingToAuto(node)\n\t\t},\n\t\t[switchDecodingToAuto],\n\t)\n\n\treturn { decoding: currentDecoding.current, onImageLoad, onImageMount }\n}\n\nfunction StaticImage({ image, containerSize, nodeId, alt, draggable, avoidAsyncDecoding }: InnerImageProps) {\n\tconst source = runtime.useImageSource(image, containerSize, nodeId)\n\tconst imageStyle = getImageStyle(image)\n\n\tconst { decoding, onImageLoad, onImageMount } = useDecodingAttribute(avoidAsyncDecoding)\n\n\tconst { srcSet, src } = !(\"srcSet\" in image)\n\t\t? getSrcSet(image.nodeFixedSize, image, source)\n\t\t: { src: source, srcSet: image.srcSet }\n\n\treturn (\n\t\t// eslint-disable-next-line framer-studio/require-async-decoding -- we conditionally apply it\n\t\t<img\n\t\t\t// Ignoring hydration warning; during hydration, `sizes` and `loading` attributes might differ\n\t\t\t// from what React sets because we rewrite them in `rewriteResponsiveImages` in SSG.\n\t\t\tsuppressHydrationWarning\n\t\t\tref={onImageMount}\n\t\t\tdecoding={decoding}\n\t\t\t// @ts-expect-error React 18 expects `fetchpriority` but TS only supports `fetchPriority`: https://github.com/facebook/react/issues/25682, https://github.com/facebook/react/issues/28946\n\t\t\t// eslint-disable-next-line react/no-unknown-property\n\t\t\tfetchpriority={image.fetchPriority}\n\t\t\t// ! important: DO NOT alter the order of `loading`, `sizes`, `srcset` and `src` attributes.\n\t\t\t// see https://github.com/framer/company/issues/29035.\n\t\t\tloading={image.loading}\n\t\t\twidth={image.pixelWidth}\n\t\t\theight={image.pixelHeight}\n\t\t\tsizes={srcSet ? image.sizes : undefined}\n\t\t\t// We don't need to resolve srcSet with useImageSource,\n\t\t\t// because these are currently only used in generated\n\t\t\t// components, where resolution happens during\n\t\t\t// code-generation.\n\t\t\tsrcSet={srcSet}\n\t\t\tsrc={src}\n\t\t\t// ! end of order-sensitive attributes.\n\n\t\t\tonLoad={onImageLoad}\n\t\t\talt={alt ?? image.alt ?? \"\"}\n\t\t\tstyle={imageStyle}\n\t\t\tdraggable={draggable}\n\t\t/>\n\t)\n}\n\nfunction CanvasImage({ image, containerSize, nodeId }: InnerImageProps) {\n\tconst wrapperRef = React.useRef<HTMLDivElement>(null)\n\tconst imageElement = runtime.useImageElement(image, containerSize, nodeId)\n\tconst imageStyle = getImageStyle(image)\n\n\t// This is not compatible with server side rendering, but that's ok, this is only meant when\n\t// rendering vekter's canvas.\n\tReact.useLayoutEffect(() => {\n\t\tconst wrapper = wrapperRef.current\n\n\t\tif (wrapper === null) return\n\t\twrapper.appendChild(imageElement)\n\n\t\treturn () => {\n\t\t\twrapper.removeChild(imageElement)\n\t\t}\n\t}, [imageElement])\n\n\tObject.assign(imageElement.style, imageStyle)\n\n\treturn <div ref={wrapperRef} style={{ display: \"contents\", ...cornerPropertiesToInherit }} />\n}\n\nfunction OptimizedCanvasImage({ nodeId, image, containerSize }: InnerImageProps) {\n\tconst wrapperRef = React.useRef<HTMLDivElement>(null)\n\tconst source = runtime.useImageSource(image, containerSize, nodeId)\n\n\tReact.useLayoutEffect(() => {\n\t\tconst wrapper = wrapperRef.current\n\t\tif (wrapper === null) return\n\n\t\tconst imageStyle = getImageStyle(image)\n\t\truntime.renderOptimizedCanvasImage(wrapper, source, imageStyle, nodeId)\n\t}, [nodeId, image, source])\n\n\treturn <div ref={wrapperRef} style={{ display: \"contents\", ...cornerPropertiesToInherit }} />\n}\n\ninterface Props extends InnerImageProps {\n\tlayoutId?: string\n}\n\nexport function BackgroundImageComponent({ layoutId, image, ...props }: Props) {\n\tif (layoutId) {\n\t\tlayoutId += \"-background\"\n\t}\n\n\tlet fallbackWrapperStyles: React.CSSProperties | null = null\n\n\tlet needsMotion = !!layoutId\n\tlet imageNode: React.ReactNode = null\n\tif (isString(image.src)) {\n\t\tif (image.fit === \"tile\" && image.pixelWidth && image.pixelHeight) {\n\t\t\t// If the fit is set to 'tile' then we want to use\n\t\t\t// a css background instead of an img element\n\t\t\t// so we set the imageNode to null and apply the relevant\n\t\t\t// background image properties to the wrapper element.\n\t\t\tconst backgroundSize = isNumber(image.backgroundSize) ? image.backgroundSize : 1\n\n\t\t\tconst tileSize = {\n\t\t\t\twidth: Math.round(backgroundSize * image.pixelWidth),\n\t\t\t\theight: Math.round(backgroundSize * image.pixelHeight),\n\t\t\t}\n\n\t\t\t// image.backgroundSize is a floating point number like 0.05\n\t\t\t// so we need to multiply it by the pixelWidth to get the pixel\n\t\t\t// value for the backgroundSize so that the size of the tile is\n\t\t\t// a function of the image width + background size percentage.\n\t\t\t// e.g image is 64px/64px and backgroundSize is 0.05, the tile size\n\t\t\t// should be 3.2px\n\t\t\t// We divide the pixel width by 2 because we assume that most designers\n\t\t\t// will be working with 2x (retina) assets.\n\t\t\t// And finally we round it to half pixel to avoid sub-pixel rendering issues when the fill image is an SVG.\n\t\t\tconst roundedBackgroundSize = roundToHalfPixel(backgroundSize * (image.pixelWidth / 2))\n\t\t\t// biome-ignore lint/correctness/useHookAtTopLevel: This is ok since this function acts just like a util to get the source.\n\t\t\tconst imageSource = runtime.useImageSource(image, tileSize)\n\t\t\tfallbackWrapperStyles = {\n\t\t\t\t...wrapperStyle,\n\t\t\t\tbackgroundImage: `url(${imageSource})`,\n\t\t\t\tbackgroundRepeat: \"repeat\",\n\t\t\t\tbackgroundPosition: cssObjectPosition(image.positionX, image.positionY),\n\t\t\t\topacity: undefined,\n\t\t\t\tborder: 0,\n\t\t\t\tbackgroundSize: `${roundedBackgroundSize}px auto`,\n\t\t\t}\n\n\t\t\timageNode = null\n\n\t\t\t// TODO: Currently we opt out this branch from the optimization, as we don't know if the styles need animation or not.\n\t\t\tneedsMotion = true\n\t\t} else if (RenderTarget.current() !== RenderTarget.canvas) {\n\t\t\timageNode = (\n\t\t\t\t<StaticImage\n\t\t\t\t\timage={image}\n\t\t\t\t\t// We don\u2019t want async decoding when exporting images. https://github.com/framer/FramerStudio/pull/19956\n\t\t\t\t\tavoidAsyncDecoding={RenderTarget.current() === RenderTarget.export}\n\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t\t)\n\t\t} else if (\n\t\t\t// biome-ignore lint/correctness/useHookAtTopLevel: This is ok since this function acts just like a util to get the source.\n\t\t\truntime.canRenderOptimizedCanvasImage(runtime.useImageSource(image))\n\t\t) {\n\t\t\timageNode = <OptimizedCanvasImage image={image} {...props} />\n\t\t} else {\n\t\t\timageNode = <CanvasImage image={image} {...props} />\n\t\t}\n\t}\n\n\tconst style = imageNode ? wrapperStyle : (fallbackWrapperStyles ?? { ...wrapperStyle, ...getPlaceholderStyle() })\n\n\treturn needsMotion ? (\n\t\t<motion.div layoutId={layoutId} style={style} data-framer-background-image-wrapper>\n\t\t\t{imageNode}\n\t\t</motion.div>\n\t) : (\n\t\t<div style={style} data-framer-background-image-wrapper>\n\t\t\t{imageNode}\n\t\t</div>\n\t)\n}\n", "import { FixedSizeScaleVariants, getVariantsDimensions } from \"@framerjs/assets/src/getVariantsDimensions.ts\"\nimport type { VariantDimensions } from \"@framerjs/assets/src/types/Asset.ts\"\nimport type { BackgroundImage } from \"../types/BackgroundImage.ts\"\n\nfunction urlWithScaleDownTo(url: string, scaleDownTo: number | null): string {\n\ttry {\n\t\tconst urlObj = new URL(url)\n\t\tif (scaleDownTo) {\n\t\t\turlObj.searchParams.set(\"scale-down-to\", `${scaleDownTo}`)\n\t\t} else {\n\t\t\t// Some old codegenned image sources still include `?scale-down-to` parameter.\n\t\t\t// Let\u2019s delete it explicitly to make sure we serve the full variant.\n\t\t\turlObj.searchParams.delete(\"scale-down-to\")\n\t\t}\n\t\treturn urlObj.toString()\n\t} catch {\n\t\t// new URL() might throw. To avoid crashing the whole site when this happens, let\u2019s just fall back to the original URL.\n\t\treturn url\n\t}\n}\n\n// Variants smaller than 512 (16,32,64 respectively)\n// should not appear in the `srcset`\n// as they are used for tiling backgrounds only.\nexport const MinVariantSizeForSourceSet = 512\n\nfunction getResponsiveSrcSet(\n\tsource: string,\n\timage: BackgroundImage,\n\tvariants: VariantDimensions[] | undefined,\n): string | undefined {\n\tif (!variants || variants.length === 0) return undefined\n\tif (!image.pixelWidth) return undefined\n\n\tconst srcSet: string[] = []\n\n\tfor (const variant of variants) {\n\t\tif (variant.width < MinVariantSizeForSourceSet) continue\n\n\t\tconst url = urlWithScaleDownTo(source, variant.maxSideSize)\n\t\tsrcSet.push(`${url} ${variant.width}w`)\n\t}\n\t// Other code might assume the original image is last in the `srcset`]\n\tsrcSet.push(`${urlWithScaleDownTo(source, null)} ${image.pixelWidth}w`)\n\n\treturn srcSet.join(\", \") || undefined\n}\n\n// Examples: calculating scale-down-to for fixed-size images\n//\n// When image is smaller than node (needs upscaling):\n//   Image: 100\u00D7200, Node: 200\u00D7400 \u2192 Scale ratio = max(2, 2) = 2 \u2192 scale-down-to = 400\n//   Image: 100\u00D7200, Node: 400\u00D7200 \u2192 Scale ratio = max(4, 1) = 4 \u2192 scale-down-to = 800\n//   Image: 100\u00D7200, Node: 300\u00D7300 \u2192 Scale ratio = max(3, 1.5) = 3 \u2192 scale-down-to = 600\n//\n// When image is larger than node (needs downscaling):\n//   Image: 1000\u00D72000, Node: 200\u00D7400 \u2192 Scale ratio = max(0.2, 0.2) = 0.2 \u2192 scale-down-to = 400\n//   Image: 1000\u00D72000, Node: 400\u00D7200 \u2192 Scale ratio = max(0.4, 0.1) = 0.4 \u2192 scale-down-to = 800\n//\n// We need to use the maximum scale ratio to ensure the image covers the entire container.\n// This ensures no blurry edges when aspect ratios differ.\nfunction getFixedSrcSets(\n\tsource: string,\n\timage: BackgroundImage,\n\tnodeFixedSize: BackgroundImage[\"nodeFixedSize\"],\n): { src: string; scale: number }[] | undefined {\n\tif (!image.pixelWidth || !image.pixelHeight) return undefined\n\tif (!nodeFixedSize?.width || !nodeFixedSize?.height) return undefined\n\tconst srcSet: { src: string; scale: number }[] = []\n\n\tconst imageMaxSide = Math.max(image.pixelWidth, image.pixelHeight)\n\n\t// The node dimensions determine how much we will need to scale\n\t// Use the maximum scale ratio to ensure full coverage\n\tconst scaleRatio = Math.max(nodeFixedSize.width / image.pixelWidth, nodeFixedSize.height / image.pixelHeight)\n\n\tfor (const variant of FixedSizeScaleVariants) {\n\t\t// The intrinsic size is used for the scale-down-to param\n\t\tconst scaleMaxSideSizeTo = Math.round(imageMaxSide * variant * scaleRatio)\n\t\tconst url = urlWithScaleDownTo(source, scaleMaxSideSizeTo)\n\t\tsrcSet.push({\n\t\t\tsrc: url,\n\t\t\tscale: variant,\n\t\t})\n\t}\n\n\treturn srcSet\n}\n\nexport function getSrcSet(\n\tnodeFixedSize: BackgroundImage[\"nodeFixedSize\"],\n\timage: BackgroundImage,\n\tsource: string,\n): { src: string | undefined; srcSet: string | undefined } {\n\tif (![\"auto\", \"lossless\"].includes(image.preferredSize ?? \"\")) {\n\t\treturn { src: source, srcSet: undefined }\n\t}\n\tif (nodeFixedSize) {\n\t\tconst fixedSrcSets = getFixedSrcSets(source, image, nodeFixedSize)\n\t\tif (!fixedSrcSets?.length) return { src: source, srcSet: undefined }\n\n\t\tconst [x1, ...rest] = fixedSrcSets\n\t\treturn { src: x1?.src, srcSet: rest.map(({ src, scale }) => `${src} ${scale}x`).join(\", \") }\n\t} else {\n\t\tconst variants = getVariantsDimensions(image.pixelWidth, image.pixelHeight)\n\t\treturn { src: source, srcSet: getResponsiveSrcSet(source, image, variants) }\n\t}\n}\n", "import type { BackgroundImage } from \"../types/BackgroundImage.ts\"\n\nexport function getIntrinsicSizeForBackgroundImage(background: BackgroundImage | undefined) {\n\tif (!background) return undefined\n\n\tif (background.pixelHeight && background.pixelWidth) {\n\t\treturn { width: background.pixelWidth, height: background.pixelHeight }\n\t}\n\n\t// If there is no src then the image will fallback to a placeholder so we provide a default to avoid layout collapse\n\tif (background.src === undefined) return { width: 1, height: 1 }\n\n\t// Should fallback to measuring the image size\n\treturn undefined\n}\n", "import { motion } from \"framer-motion\"\n\n/** Get a motion component based on a HTML element name, if undefined it will default to motion.div */\nexport function htmlElementAsMotionComponent(asElem: undefined | keyof HTMLElementTagNameMap | \"svg\") {\n\t// Filter out new elements defined in HTMLElementTagNameMap, but not known to Motion/React yet\n\treturn asElem && asElem !== \"search\" && asElem !== \"slot\" && asElem !== \"template\"\n\t\t? (motion[asElem] as (typeof motion)[\"div\"])\n\t\t: motion[\"div\"]\n}\n", "import { isBrowser } from \"@framerjs/shared/src/environment.ts\"\nimport React, { useInsertionEffect } from \"react\"\nimport type { StylesheetContextValue } from \"../render/StyleSheetContext.ts\"\nimport { StyleSheetContext } from \"../render/StyleSheetContext.ts\"\nimport { RenderTarget } from \"../render/types/RenderEnvironment.ts\"\nimport * as CSS from \"../render/utils/setDocumentStyles.ts\"\nimport { isFunction } from \"../utils/utils.ts\"\n\nconst framerPostSSRCSSSelector = \"style[data-framer-css-ssr-minified]\"\n\n// Figure out which elements had their styles server-rendered \u2013 and avoid injecting their styles again.\n// We\u2019re doing this for a) performance, b) DX (this reduces the number of duplicated styles in DevTools).\n// (Using /* #__PURE__ */ to make sure this gets removed from the bundle when `withCSS` is tree-shaken away: https://www.notion.so/framer/Preventing-side-effects-in-library-modules-tree-shaking-54ab6ebf7256459a816a0c689f476fd1?pvs=4.)\nconst componentsWithServerRenderedStyles: Set<string> = /* #__PURE__ */ (() => {\n\tif (!isBrowser()) return new Set()\n\n\tconst componentsWithSSRStylesAttr = document\n\t\t.querySelector(framerPostSSRCSSSelector)\n\t\t?.getAttribute(\"data-framer-components\")\n\n\tif (!componentsWithSSRStylesAttr) return new Set()\n\n\treturn new Set(componentsWithSSRStylesAttr.split(\" \"))\n})()\n\n/**\n * Marks <style> tags that are created by Framer and must be minified and moved to <head> during SSG.\n * We don\u2019t minify and move non-Framer <style> tags because that\u2019d cause hydration mismatches (e.g.\n * when a <style> tag is added by a code component.)\n *\n * @deprecated This is no longer used by withCSS, but we still use it tag some global styles.\n *\n * @internal\n */\nexport const framerCSSMarker = \"data-framer-css-ssr\"\n\n/**\n * Render a React component with css that will be injected into the document's\n * head when the component is first rendered. The escapedCSS argument can either\n * be a string where each line is a css rule, or an array of css rule strings.\n *\n * @public\n */\nexport const withCSS = <T extends object>(\n\tComponent: React.ComponentType<T>,\n\tescapedCSS: ((target: RenderTarget, props?: T) => string[]) | string[] | string,\n\tcomponentSerializationId: string,\n) =>\n\tReact.forwardRef((props: T, ref) => {\n\t\tconst { sheet, cache } = React.useContext<StylesheetContextValue | undefined>(StyleSheetContext) ?? {}\n\t\t// This might be `undefined` in older components that got published before https://github.com/framer/FramerStudio/pull/13459,\n\t\t// or for code components / overrides, where it was left out before making the arg mandatory.\n\t\tconst id: string | undefined = componentSerializationId\n\n\t\tif (!isBrowser()) {\n\t\t\tif (isFunction(escapedCSS)) escapedCSS = escapedCSS(RenderTarget.current(), props)\n\t\t\tconst concatenatedCSS = Array.isArray(escapedCSS) ? escapedCSS.join(\"\\n\") : escapedCSS\n\t\t\tcssCollector.add(concatenatedCSS, id)\n\t\t}\n\n\t\t// biome-ignore lint/correctness/useExhaustiveDependencies: has been like this for a long time\n\t\tuseInsertionEffect(() => {\n\t\t\t// If the styles already exist in the head due to SSG, avoid re-adding them to improve hydration performance.\n\t\t\tif (id && componentsWithServerRenderedStyles.has(id)) return\n\t\t\tconst css = isFunction(escapedCSS)\n\t\t\t\t? escapedCSS(RenderTarget.current(), props)\n\t\t\t\t: Array.isArray(escapedCSS)\n\t\t\t\t\t? escapedCSS\n\t\t\t\t\t: escapedCSS.split(\"\\n\")\n\t\t\tcss.forEach(rule => rule && CSS.injectCSSRule(rule, sheet, cache))\n\t\t}, [])\n\n\t\treturn <Component {...props} ref={ref} />\n\t})\n\nclass CSSCollector {\n\tprivate styles: Set<string> = new Set()\n\tprivate componentIds: Set<string> = new Set()\n\n\tadd(css: string, componentId: string | undefined) {\n\t\tthis.styles.add(css)\n\t\tif (componentId) this.componentIds.add(componentId)\n\t}\n\n\tgetStyles(): Iterable<string, unknown, unknown> {\n\t\treturn this.styles\n\t}\n\n\tgetComponentIds(): Iterable<string, unknown, unknown> {\n\t\treturn this.componentIds\n\t}\n\n\tclear() {\n\t\tthis.styles.clear()\n\t\tthis.componentIds.clear()\n\t}\n}\n\nexport const cssCollector = /* @__PURE__ */ new CSSCollector()\n", "import React from \"react\"\n\n/** @internal */\nexport interface StylesheetContextValue {\n\treadonly sheet: CSSStyleSheet\n\treadonly cache: Set<string>\n}\n\n/** @internal */\nexport const StyleSheetContext = /* @__PURE__ */ React.createContext<StylesheetContextValue | undefined>(undefined)\n", "const defaultCache = new Set<string>()\nlet defaultSheet: CSSStyleSheet | undefined\n\n/**\n * Add CSS to the document.\n *\n * @param cssRule - CSS rule to add to the document\n */\nexport function injectCSSRule(cssRule: string, sheet: CSSStyleSheet | undefined, cache: Set<string> = defaultCache) {\n\tif (!cssRule || cache.has(cssRule) || typeof document === \"undefined\") return\n\n\tcache.add(cssRule)\n\n\tif (!sheet) {\n\t\tif (!defaultSheet) {\n\t\t\tconst styleElement = document.createElement(\"style\")\n\t\t\tstyleElement.setAttribute(\"type\", \"text/css\")\n\t\t\tstyleElement.setAttribute(\"data-framer-css\", \"true\")\n\n\t\t\t// document.head technically may in fact be null:\n\t\t\t// https://html.spec.whatwg.org/multipage/dom.html#dom-document-head-dev\n\t\t\tif (!document.head) {\n\t\t\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\t\t\tconsole.warn(\"not injecting CSS: the document is missing a <head> element\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tdocument.head.appendChild(styleElement)\n\n\t\t\tif (styleElement.sheet) {\n\t\t\t\tdefaultSheet = styleElement.sheet\n\t\t\t} else {\n\t\t\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\t\t\tconsole.warn(\"not injecting CSS: injected <style> element does not have a sheet\", styleElement)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tsheet = defaultSheet\n\t}\n\n\ttry {\n\t\tsheet.insertRule(cssRule, sheet.cssRules.length)\n\t} catch {\n\t\t// Assume that errors are from malformed rules, or rules that are not\n\t\t// valid in the current browser, and swallow the error.\n\t\t//\n\t\t// For example, `input[type=\"range\"]::-moz-range-thumb` will error in\n\t\t// Chrome, but not Firefox.\n\t}\n}\n", "let isFlexboxGapSupportedCached: boolean | undefined\n\n/* @internal */\nexport function isFlexboxGapSupported() {\n\tif (isFlexboxGapSupportedCached !== undefined) {\n\t\treturn isFlexboxGapSupportedCached\n\t}\n\n\t// Source: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/css/flexgap.js\n\t// create flex container with row-gap set\n\tconst flex = document.createElement(\"div\")\n\tObject.assign(flex.style, {\n\t\tposition: \"absolute\", // avoid layout shift\n\t\tdisplay: \"flex\",\n\t\tflexDirection: \"column\",\n\t\trowGap: \"1px\",\n\t})\n\n\t// create two elements inside it\n\tflex.appendChild(document.createElement(\"div\"))\n\tflex.appendChild(document.createElement(\"div\"))\n\n\t// append to the DOM (needed to obtain scrollHeight)\n\tdocument.body.appendChild(flex)\n\tconst isSupported = flex.scrollHeight === 1 // flex container should be 1px high from the row-gap\n\tif (flex.parentNode) {\n\t\tflex.parentNode.removeChild(flex)\n\t}\n\n\tisFlexboxGapSupportedCached = isSupported\n\treturn isSupported\n}\n", "import { isFlexboxGapSupported } from \"./isFlexboxGapSupported.ts\"\n\n/**\n * @internal\n */\nexport const flexboxGapNotSupportedClass = \"flexbox-gap-not-supported\"\n\nlet initialized = false\n/**\n * @internal\n */\nexport function installFlexboxGapWorkaroundIfNeeded() {\n\tif (initialized) return\n\tinitialized = true\n\tif (isFlexboxGapSupported()) return\n\tdocument.body.classList.add(flexboxGapNotSupportedClass)\n}\n", "const richTextStylesRule = `\n[data-framer-component-type=\"DeprecatedRichText\"] p,\n[data-framer-component-type=\"DeprecatedRichText\"] div,\n[data-framer-component-type=\"DeprecatedRichText\"] h1,\n[data-framer-component-type=\"DeprecatedRichText\"] h2,\n[data-framer-component-type=\"DeprecatedRichText\"] h3,\n[data-framer-component-type=\"DeprecatedRichText\"] h4,\n[data-framer-component-type=\"DeprecatedRichText\"] h5,\n[data-framer-component-type=\"DeprecatedRichText\"] h6,\n[data-framer-component-type=\"DeprecatedRichText\"] li,\n[data-framer-component-type=\"DeprecatedRichText\"] ol,\n[data-framer-component-type=\"DeprecatedRichText\"] ul,\n[data-framer-component-type=\"DeprecatedRichText\"] span:not([data-text-fill]) {\n    font-family: var(--framer-font-family, Inter, Inter Placeholder, sans-serif);\n    font-style: var(--framer-font-style, normal);\n    font-weight: var(--framer-font-weight, 400);\n    color: var(--framer-text-color, #000);\n    font-size: var(--framer-font-size, 16px);\n    letter-spacing: var(--framer-letter-spacing, 0);\n    text-transform: var(--framer-text-transform, none);\n    text-decoration: var(--framer-text-decoration, none);\n    line-height: var(--framer-line-height, 1.2em);\n    text-align: var(--framer-text-alignment, start);\n}\n`\n\nconst richTextParagraphSpacingStylesRule = `\n[data-framer-component-type=\"DeprecatedRichText\"] p:not(:first-child),\n[data-framer-component-type=\"DeprecatedRichText\"] div:not(:first-child),\n[data-framer-component-type=\"DeprecatedRichText\"] h1:not(:first-child),\n[data-framer-component-type=\"DeprecatedRichText\"] h2:not(:first-child),\n[data-framer-component-type=\"DeprecatedRichText\"] h3:not(:first-child),\n[data-framer-component-type=\"DeprecatedRichText\"] h4:not(:first-child),\n[data-framer-component-type=\"DeprecatedRichText\"] h5:not(:first-child),\n[data-framer-component-type=\"DeprecatedRichText\"] h6:not(:first-child),\n[data-framer-component-type=\"DeprecatedRichText\"] ol:not(:first-child),\n[data-framer-component-type=\"DeprecatedRichText\"] ul:not(:first-child),\n[data-framer-component-type=\"DeprecatedRichText\"] .framer-image:not(:first-child) {\n    margin-top: var(--framer-paragraph-spacing, 0);\n}\n`\n\nconst richTextBackgroundMaskStylesRule = `\n[data-framer-component-type=\"DeprecatedRichText\"] span[data-text-fill] {\n    display: inline-block;\n    background-clip: text;\n    -webkit-background-clip: text;\n    -webkit-text-fill-color: transparent;\n}\n`\n\nconst richTextLinkStylesRule = `\n[data-framer-component-type=\"DeprecatedRichText\"] a,\n[data-framer-component-type=\"DeprecatedRichText\"] a span:not([data-text-fill]) {\n    font-family: var(--framer-link-font-family, var(--framer-font-family, Inter, Inter Placeholder, sans-serif));\n    font-style: var(--framer-link-font-style, var(--framer-font-style, normal));\n    font-weight: var(--framer-link-font-weight, var(--framer-font-weight, 400));\n    color: var(--framer-link-text-color, var(--framer-text-color, #000));\n    font-size: var(--framer-link-font-size, var(--framer-font-size, 16px));\n    text-transform: var(--framer-link-text-transform, var(--framer-text-transform, none));\n    text-decoration: var(--framer-link-text-decoration, var(--framer-text-decoration, none));\n}\n`\n\nconst richTextLinkHoverStylesRule = `\n[data-framer-component-type=\"DeprecatedRichText\"] a:hover,\n[data-framer-component-type=\"DeprecatedRichText\"] a:hover span:not([data-text-fill]) {\n    font-family: var(--framer-link-hover-font-family, var(--framer-link-font-family, var(--framer-font-family, Inter, Inter Placeholder, sans-serif)));\n    font-style: var(--framer-link-hover-font-style, var(--framer-link-font-style, var(--framer-font-style, normal)));\n    font-weight: var(--framer-link-hover-font-weight, var(--framer-link-font-weight, var(--framer-font-weight, 400)));\n    color: var(--framer-link-hover-text-color, var(--framer-link-text-color, var(--framer-text-color, #000)));\n    font-size: var(--framer-link-hover-font-size, var(--framer-link-font-size, var(--framer-font-size, 16px)));\n    text-transform: var(--framer-link-hover-text-transform, var(--framer-link-text-transform, var(--framer-text-transform, none)));\n    text-decoration: var(--framer-link-hover-text-decoration, var(--framer-link-text-decoration, var(--framer-text-decoration, none)));\n}\n`\n\nconst richTextLinkCurrentStylesRule = `\n[data-framer-component-type=\"DeprecatedRichText\"] a[data-framer-page-link-current],\n[data-framer-component-type=\"DeprecatedRichText\"] a[data-framer-page-link-current] span:not([data-text-fill]):not([data-nested-link]) {\n    font-family: var(--framer-link-current-font-family, var(--framer-link-font-family, var(--framer-font-family, Inter, Inter Placeholder, sans-serif)));\n    font-style: var(--framer-link-current-font-style, var(--framer-link-font-style, var(--framer-font-style, normal)));\n    font-weight: var(--framer-link-current-font-weight, var(--framer-link-font-weight, var(--framer-font-weight, 400)));\n    color: var(--framer-link-current-text-color, var(--framer-link-text-color, var(--framer-text-color, #000)));\n    font-size: var(--framer-link-current-font-size, var(--framer-link-font-size, var(--framer-font-size, 16px)));\n    text-transform: var(--framer-link-current-text-transform, var(--framer-link-text-transform, var(--framer-text-transform, none)));\n    text-decoration: var(--framer-link-current-text-decoration, var(--framer-link-text-decoration, var(--framer-text-decoration, none)));\n}\n`\n\nconst richTextLinkCurrentHoverStylesRule = `\n[data-framer-component-type=\"DeprecatedRichText\"] a[data-framer-page-link-current]:hover,\n[data-framer-component-type=\"DeprecatedRichText\"] a[data-framer-page-link-current]:hover span:not([data-text-fill]):not([data-nested-link]) {\n    font-family: var(--framer-link-hover-font-family, var(--framer-link-current-font-family, var(--framer-link-font-family, var(--framer-font-family, Inter, Inter Placeholder, sans-serif))));\n    font-style: var(--framer-link-hover-font-style, var(--framer-link-current-font-style, var(--framer-link-font-style, var(--framer-font-style, normal))));\n    font-weight: var(--framer-link-hover-font-weight, var(--framer-link-current-font-weight, var(--framer-link-font-weight, var(--framer-font-weight, 400))));\n    color: var(--framer-link-hover-text-color, var(--framer-link-current-text-color, var(--framer-link-text-color, var(--framer-text-color, #000))));\n    font-size: var(--framer-link-hover-font-size, var(--framer-link-current-font-size, var(--framer-link-font-size, var(--framer-font-size, 16px))));\n    text-transform: var(--framer-link-hover-text-transform, var(--framer-link-current-text-transform, var(--framer-link-text-transform, var(--framer-text-transform, none))));\n    text-decoration: var(--framer-link-hover-text-decoration, var(--framer-link-current-text-decoration, var(--framer-link-text-decoration, var(--framer-text-decoration, none))));\n}\n`\n\nconst richTextBoldStylesRule = `\n[data-framer-component-type=\"DeprecatedRichText\"] strong {\n    font-weight: bolder;\n}\n`\n\nconst richTextItalicStylesRule = `\n[data-framer-component-type=\"DeprecatedRichText\"] em {\n    font-style: italic;\n}\n`\n\n// Sync with RichTextEditorWithToolbar.styles.ts\nconst richTextImageRule = `\n[data-framer-component-type=\"DeprecatedRichText\"] .framer-image {\n    display: block;\n    max-width: 100%;\n    height: auto;\n}\n`\n\nconst richTextBlockElementResetRule = `\n[data-framer-component-type=\"DeprecatedRichText\"] p,\n[data-framer-component-type=\"DeprecatedRichText\"] div,\n[data-framer-component-type=\"DeprecatedRichText\"] h1,\n[data-framer-component-type=\"DeprecatedRichText\"] h2,\n[data-framer-component-type=\"DeprecatedRichText\"] h3,\n[data-framer-component-type=\"DeprecatedRichText\"] h4,\n[data-framer-component-type=\"DeprecatedRichText\"] h5,\n[data-framer-component-type=\"DeprecatedRichText\"] h6 {\n    margin: 0;\n    padding: 0;\n}\n`\n\nconst richTextStylesPresetResetRule = `\n[data-framer-component-type=\"DeprecatedRichText\"] .text-styles-preset-reset {\n    --framer-font-family: Inter, Inter Placeholder, sans-serif;\n    --framer-font-style: normal;\n    --framer-font-weight: 500;\n    --framer-text-color: #000;\n    --framer-font-size: 16px;\n    --framer-letter-spacing: 0;\n    --framer-text-transform: none;\n    --framer-text-decoration: none;\n    --framer-line-height: 1.2em;\n    --framer-text-alignment: start;\n    --framer-font-open-type-features: normal;\n    --font-variation-settings: normal;\n}\n`\n\nconst richTextStylesList = `\n[data-framer-component-type=\"DeprecatedRichText\"] ul,\n[data-framer-component-type=\"DeprecatedRichText\"] ol {\n    display: table;\n    width: 100%;\n    padding-left: 0;\n    margin: 0;\n}\n`\n\nconst richTextStylesListItem = `\n[data-framer-component-type=\"DeprecatedRichText\"] li {\n    display: table-row;\n    counter-increment: list-item;\n    list-style: none;\n}\n`\n\nconst richTextStylesNumberedListMarker = `\n[data-framer-component-type=\"DeprecatedRichText\"] ol > li::before {\n    display: table-cell;\n    width: 2.25ch;\n    box-sizing: border-box;\n    padding-right: 0.75ch;\n    content: counter(list-item) \".\";\n    white-space: nowrap;\n}\n`\n\nconst richTextStylesBulletedListMarker = `\n[data-framer-component-type=\"DeprecatedRichText\"] ul > li::before {\n    display: table-cell;\n    width: 2.25ch;\n    box-sizing: border-box;\n    padding-right: 0.75ch;\n    content: \"\u2022\";\n}\n`\n\nexport const deprecatedRichTextCSSRules = [\n\t`[data-framer-component-type=\"DeprecatedRichText\"] { cursor: inherit; }`,\n\trichTextStylesPresetResetRule,\n\trichTextBlockElementResetRule,\n\trichTextStylesRule,\n\trichTextParagraphSpacingStylesRule,\n\trichTextBackgroundMaskStylesRule,\n\trichTextLinkStylesRule,\n\trichTextLinkHoverStylesRule,\n\trichTextLinkCurrentStylesRule,\n\trichTextLinkCurrentHoverStylesRule,\n\trichTextBoldStylesRule,\n\trichTextItalicStylesRule,\n\trichTextImageRule,\n\trichTextStylesList,\n\trichTextStylesListItem,\n\trichTextStylesNumberedListMarker,\n\trichTextStylesBulletedListMarker,\n]\n", "import type { CSSProperties } from \"react\"\nimport React from \"react\"\nimport { assert } from \"../../../utils/assert.ts\"\n\n/**\n * FormInputStyleVariableNames represents all of the known\n * CSS variables available to be set for inputs within a form.\n * @internal\n */\nexport enum FormInputStyleVariableNames {\n\tPadding = \"--framer-input-padding\",\n\t// We collect the per corner radius values and have separate CSS variables for each corner\n\t// in order to maintain some compatibility with the existing collectRadius function.\n\tBorderRadiusTopLeft = \"--framer-input-border-radius-top-left\",\n\tBorderRadiusTopRight = \"--framer-input-border-radius-top-right\",\n\tBorderRadiusBottomRight = \"--framer-input-border-radius-bottom-right\",\n\tBorderRadiusBottomLeft = \"--framer-input-border-radius-bottom-left\",\n\tCornerShape = \"--framer-input-corner-shape\",\n\tBorderColor = \"--framer-input-border-color\",\n\tBorderTopWidth = \"--framer-input-border-top-width\",\n\tBorderRightWidth = \"--framer-input-border-right-width\",\n\tBorderBottomWidth = \"--framer-input-border-bottom-width\",\n\tBorderLeftWidth = \"--framer-input-border-left-width\",\n\tBorderStyle = \"--framer-input-border-style\",\n\tBackground = \"--framer-input-background\",\n\tFontFamily = \"--framer-input-font-family\",\n\tFontWeight = \"--framer-input-font-weight\",\n\tFontSize = \"--framer-input-font-size\",\n\tFontColor = \"--framer-input-font-color\",\n\tFontStyle = \"--framer-input-font-style\",\n\tFontLetterSpacing = \"--framer-input-font-letter-spacing\",\n\tFontTextAlignment = \"--framer-input-font-text-alignment\",\n\tFontLineHeight = \"--framer-input-font-line-height\",\n\tFontOpenType = \"--framer-input-font-open-type-features\",\n\tFontVariationAxes = \"--framer-input-font-variation-axes\",\n\n\tPlaceholderColor = \"--framer-input-placeholder-color\",\n\tBoxShadow = \"--framer-input-box-shadow\",\n\n\t// Focused style variables\n\tFocusedBorderColor = \"--framer-input-focused-border-color\",\n\tFocusedBorderWidth = \"--framer-input-focused-border-width\",\n\tFocusedBorderStyle = \"--framer-input-focused-border-style\",\n\tFocusedBackground = \"--framer-input-focused-background\",\n\tFocusedBoxShadow = \"--framer-input-focused-box-shadow\",\n\tFocusedTransition = \"--framer-input-focused-transition\",\n\n\t// Boolean input style variables\n\tBooleanCheckedBackground = \"--framer-input-boolean-checked-background\",\n\tBooleanCheckedBorderColor = \"--framer-input-boolean-checked-border-color\",\n\tBooleanCheckedBorderWidth = \"--framer-input-boolean-checked-border-width\",\n\tBooleanCheckedBorderStyle = \"--framer-input-boolean-checked-border-style\",\n\tBooleanCheckedBoxShadow = \"--framer-input-boolean-checked-box-shadow\",\n\tBooleanCheckedTransition = \"--framer-input-boolean-checked-transition\",\n\n\tInvalidTextColor = \"--framer-input-invalid-text-color\",\n\n\t// Icon\n\tIconBackgroundImage = \"--framer-input-icon-image\",\n\tIconMaskImage = \"--framer-input-icon-mask-image\",\n\tIconColor = \"--framer-input-icon-color\",\n\tIconContent = \"--framer-input-icon-content\",\n\n\tWrapperHeight = \"--framer-input-wrapper-height\",\n}\n\n// Alias the enum locally to avoid long css rules.\nconst Var = FormInputStyleVariableNames\n\nexport const inputClassName = \"framer-form-input\"\nexport const inputWrapperClassName = \"framer-form-input-wrapper\"\nexport const emptyValueClassName = \"framer-form-input-empty\"\n\nexport const forcedFocusClassName = \"framer-form-input-forced-focus\"\nexport const forcedCheckedClassName = \"framer-form-input-forced-checked\"\n\nfunction cssValue(value: string | number) {\n\tif (typeof value === \"number\") return value\n\tif (value.startsWith(\"--\")) return css.variable(value)\n\tif (value === \"\") return '\"\"'\n\treturn value\n}\n\ntype VendorPrefixDeclaration = Record<`-${string}`, string>\ntype CSSDeclaration = { [K in keyof CSSProperties]: CSSProperties[K] | string } & VendorPrefixDeclaration\n\n/** Tools for generating css for form inputs. */\nexport const css = /* @__PURE__ */ (() => {\n\t/**\n\t * A lightweight camelCase to kebab-case CSS templating function. References to a css variable\n\t * will be automatically wrapped in var().\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-shadow -- Can't rename either\n\tfunction css(selector: string, declaration: CSSDeclaration) {\n\t\tlet output = \" \"\n\t\tfor (const key in declaration) {\n\t\t\tconst value = declaration[key as keyof typeof declaration]\n\t\t\tassert(value !== undefined, \"Encountered `undefined` in CSSDeclaration\")\n\t\t\toutput += `${key.replace(/([A-Z])/gu, \"-$1\").toLowerCase()}: ${cssValue(value)}; `\n\t\t}\n\t\treturn selector + \" {\" + output + \"}\"\n\t}\n\n\t/**\n\t * Create a reference to a css variable with optional fallbacks. Variable fallbacks will be\n\t * nested as expected.\n\t */\n\tcss.variable = (...variables: [...string[], string] | [string, ...string[]]): string => {\n\t\tconst lastItem = variables[variables.length - 1]\n\t\tassert(lastItem !== undefined, \"Zero variables passed to `css.variable`\")\n\t\tlet value = lastItem.startsWith(\"--\") ? `var(${lastItem})` : lastItem\n\t\tfor (let index = variables.length - 2; index >= 0; index--) {\n\t\t\tconst element = variables[index]\n\t\t\tvalue = `var(${element}, ${value})`\n\t\t}\n\t\treturn value\n\t}\n\n\treturn css\n})()\n\nexport const sharedInputCSS = /* @__PURE__ */ (() => [\n\tcss(`.${inputClassName}`, {\n\t\tpadding: css.variable(Var.Padding),\n\t\tbackground: \"transparent\",\n\t\tfontFamily: css.variable(Var.FontFamily),\n\t\tfontWeight: css.variable(Var.FontWeight),\n\t\tfontSize: css.variable(Var.FontSize),\n\t\tfontStyle: css.variable(Var.FontStyle),\n\t\tcolor: css.variable(Var.FontColor),\n\t\tfontFeatureSettings: css.variable(Var.FontOpenType),\n\t\tfontVariationSettings: css.variable(Var.FontVariationAxes),\n\t\tborder: \"none\",\n\t\ttextOverflow: \"ellipsis\",\n\t\twhiteSpace: \"nowrap\",\n\t\toverflow: \"hidden\",\n\t\twidth: \"100%\",\n\t\theight: css.variable(Var.WrapperHeight, \"100%\"),\n\t\tletterSpacing: css.variable(Var.FontLetterSpacing),\n\t\ttextAlign: css.variable(Var.FontTextAlignment),\n\t\tlineHeight: css.variable(Var.FontLineHeight),\n\t}),\n\tcss(`.${inputClassName}:focus-visible`, { outline: \"none\" }),\n])()\n\nexport const inputWrapperCSS = /* @__PURE__ */ (() => [css(`.${inputWrapperClassName}`, { overflow: \"hidden\" })])()\n\nexport const inputBorderAllSides = /* @__PURE__ */ `var(${Var.BorderTopWidth}) var(${Var.BorderRightWidth}) var(${Var.BorderBottomWidth}) var(${Var.BorderLeftWidth})`\n\n// We can't use normal CSS borders on focus, because different border widths between normal and\n// focused states could cause the elements to jump (due to overall size constraints of\n// the element changing). Instead we use a different element to display the focused border,\n// which is absolutely positioned over the input, with all pointer events disabled.\n// The result is that borders are applied like an inset box shadow so that the overall size of\n// the input never changes, and doesn't cause any jumps.\n// This approach is roughly analogous to how borders are implemented for frames.\nexport const inputBorderCSS = /* @__PURE__ */ (() => [\n\t`.${inputWrapperClassName}:after {\n        content: \"\";\n        pointer-events: none;\n        box-sizing: border-box;\n        position: absolute;\n        top: 0;\n        left: 0;\n        width: 100%;\n        height: 100%;\n        border-top-left-radius: var(${Var.BorderRadiusTopLeft});\n        border-top-right-radius: var(${Var.BorderRadiusTopRight});\n        border-bottom-right-radius: var(${Var.BorderRadiusBottomRight});\n        border-bottom-left-radius: var(${Var.BorderRadiusBottomLeft});\n        corner-shape: var(${Var.CornerShape});\n        border-color: var(${Var.BorderColor});\n        border-top-width: var(${Var.BorderTopWidth});\n        border-right-width: var(${Var.BorderRightWidth});\n        border-bottom-width: var(${Var.BorderBottomWidth});\n        border-left-width: var(${Var.BorderLeftWidth});\n        border-style: var(${Var.BorderStyle});\n        transition: var(${Var.FocusedTransition});\n        transition-property: border-color, border-width, border-style, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, corner-shape;\n    }`,\n])()\n\nconst customValidityKey = \"customError\" satisfies keyof ValidityState\nconst validKey = \"valid\" satisfies keyof ValidityState\n\nfunction isRelevantValidityStateKey(key: string): key is keyof Omit<ValidityState, \"valid\" | \"customError\"> {\n\treturn key !== customValidityKey && key !== validKey\n}\n\n/**\n * Check the native validity of an input returning true as soon as we detect an\n * invalid state, skipping \"valid\", and \"customError\" which will always be true\n * because we set an empty string custom error to hide native warnings.\n */\nfunction isInvalid(validity: ValidityState): boolean {\n\tfor (const key in validity) {\n\t\tif (!isRelevantValidityStateKey(key)) continue\n\t\tif (validity?.[key] === true) return true\n\t}\n\treturn false\n}\n\n/**\n * In some browsers, when a form is submitted, inputs with invalid values will\n * show a native warning. This is great for simple inputs. However in the case\n * where a designer has designed their own invalid state, these warnings can be\n * overwhelming. To avoid them, this hook allows setting a custom validity\n * warning when the form is submitted and the calling input is invalid. Then the\n * input will listen to onChange, and as soon as the input becomes valid again,\n * will call a provided onValid callback. This allows designers to control the\n * complete lifecycle of an input.\n */\nexport function useCustomValidity(\n\tonValid?: () => void,\n\tonInvalid?: (e: React.FormEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => void,\n\tonChange?: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => void,\n\tonBlur?: (e: React.FormEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => void,\n\tonFocus?: (e: React.FormEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => void,\n) {\n\tconst isValidRef = React.useRef<boolean | null>(null)\n\n\tconst handleInvalid = React.useCallback(\n\t\t(e: React.FormEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => {\n\t\t\tif (!onInvalid) return\n\t\t\t// If we have already become invalid, don't call the onInvalid\n\t\t\t// callback over and over again.\n\t\t\tif (isValidRef.current === false) return\n\n\t\t\tisValidRef.current = false\n\n\t\t\t// Set and report a custom invalid state to prevent the default\n\t\t\t// browser warnings.\n\t\t\te.currentTarget.setCustomValidity(\" \")\n\t\t\te.currentTarget.reportValidity()\n\n\t\t\tonInvalid(e)\n\t\t},\n\t\t[onInvalid],\n\t)\n\n\tconst handleChange = React.useCallback(\n\t\t(e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => {\n\t\t\tonChange?.(e)\n\t\t\tif (!onInvalid && !onValid) return\n\n\t\t\tconst validity = e.target.validity\n\t\t\tif (isValidRef.current === false && !isInvalid(validity)) {\n\t\t\t\t// Clear the invalid state.\n\t\t\t\te.currentTarget.setCustomValidity(\"\")\n\t\t\t\te.target.reportValidity()\n\n\t\t\t\tisValidRef.current = true\n\t\t\t\tonValid?.()\n\t\t\t}\n\t\t},\n\t\t[onInvalid, onValid, onChange],\n\t)\n\n\tconst handleBlur = React.useCallback(\n\t\t(e: React.FormEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => {\n\t\t\tif (!onInvalid) {\n\t\t\t\tonBlur?.(e)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (isValidRef.current === false) return\n\t\t\tconst validity = e.currentTarget.validity\n\n\t\t\tif (isInvalid(validity)) {\n\t\t\t\thandleInvalid(e)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// If the input has an onInvalid callback, only blur if the input is\n\t\t\t// valid. In Framer, this will only be the case when an onInvalid\n\t\t\t// variant is setup, and we want to allow showing an invalid input\n\t\t\t// on blur. Of course, technically this means that a code override\n\t\t\t// on an input won't call `onBlur` in all cases if the underlying\n\t\t\t// input has an onInvalid handler. In this case, to work around this\n\t\t\t// behavior, the user would need to either set onInvalid to\n\t\t\t// undefined, or use document.addEventListener to handle all blurs.\n\t\t\tonBlur?.(e)\n\t\t},\n\t\t[handleInvalid, onBlur, onInvalid],\n\t)\n\n\treturn React.useMemo(() => {\n\t\treturn {\n\t\t\tonInvalid: handleInvalid,\n\t\t\tonChange: handleChange,\n\t\t\tonBlur: handleBlur,\n\t\t\tonFocus,\n\t\t} as const\n\t}, [handleInvalid, handleChange, handleBlur, onFocus])\n}\n\nexport const rightIconSpacing = 10\nexport const iconSpacing = 8\nexport const iconSize = 16\n\nexport const iconImageCSS: CSSDeclaration = /* @__PURE__ */ (() => ({\n\tbackgroundRepeat: \"no-repeat\",\n\tbackgroundSize: `${iconSize}px`,\n\tmaskRepeat: \"no-repeat\",\n\tmaskSize: `${iconSize}px`,\n\tbackgroundColor: css.variable(Var.IconColor),\n}))()\n\nexport const inputIconCSSDeclaration: CSSDeclaration = /* @__PURE__ */ (() => ({\n\tcontent: \"\",\n\tdisplay: \"block\",\n\tposition: \"absolute\",\n\tright: 0,\n\ttop: 0,\n\tbottom: 0,\n\twidth: `${iconSize}px`,\n\tboxSizing: \"content-box\",\n\tpadding: css.variable(Var.Padding),\n\tborder: \"none\",\n\tpointerEvents: \"none\",\n\t...iconImageCSS,\n}))()\n", "import type { MotionStyle } from \"framer-motion\"\nimport { css } from \"../../render/presentation/Forms/shared.ts\"\n\nfunction createRGBVariableFallbacks(variables: string[], fallback: string) {\n\treturn css.variable(...variables.flatMap(variable => [`${variable}-rgb`, variable]), fallback)\n}\n\nexport const defaultRichTextContainerStyle = {\n\tdisplay: \"flex\",\n\tflexDirection: \"column\",\n\tjustifyContent: \"flex-start\",\n} as const satisfies MotionStyle\n\nconst defaultTextFillStyle = {\n\tdisplay: \"inline-block\",\n} as const satisfies MotionStyle\n\nconst defaultImageStyle = {\n\tdisplay: \"block\",\n} as const satisfies MotionStyle\n\n/**\n * Components might be wrapped in a .ssr-variant in server-side rendering if they have property overrides.\n * We need to consider this when selecting direct children.\n * We might have the same problem with layouting styles outside rich text too, but so far haven't noticed.\n */\nfunction selectComponentChild(parentSelector: string, childSelector: string) {\n\treturn `${parentSelector} > ${childSelector}, ${parentSelector} > .ssr-variant > ${childSelector}`\n}\n\nexport const richTextCSSRules = /* @__PURE__ */ (() => [\n\t/**\n\t * RichTextContainer styles can get overridden by other static or inline styles collected in\n\t * style collectors, as well as styles defined directly in the @link{RichText.tsx} component.\n\t *\n\t * NOTE: `display: flex` can get overridden with `display: -webkit-box` in\n\t * @link{collectTextTruncation.ts} if the text is truncated. In this case, the flex-specific\n\t * properties are not supported, e.g. `justify-content`. This is ok because truncated text has\n\t * auto height and doesn't support vertical alignment. In any case, keep this in mind when\n\t * using other flex-specific properties.\n\t * */\n\n\t/* css */ `\n        [data-framer-component-type=\"RichTextContainer\"] {\n            display: ${defaultRichTextContainerStyle.display};\n            flex-direction: ${defaultRichTextContainerStyle.flexDirection};\n            justify-content: ${defaultRichTextContainerStyle.justifyContent};\n            outline: none;\n            flex-shrink: 0;\n        }\n    `,\n\n\t/* css */ `\n        p.framer-text,\n        div.framer-text,\n        figure.framer-text,\n        h1.framer-text,\n        h2.framer-text,\n        h3.framer-text,\n        h4.framer-text,\n        h5.framer-text,\n        h6.framer-text,\n        ol.framer-text,\n        ul.framer-text {\n            margin: 0;\n            padding: 0;\n        }\n    `,\n\n\t/* css */ `\n        p.framer-text,\n        div.framer-text,\n        h1.framer-text,\n        h2.framer-text,\n        h3.framer-text,\n        h4.framer-text,\n        h5.framer-text,\n        h6.framer-text,\n        li.framer-text,\n        ol.framer-text,\n        ul.framer-text,\n        mark.framer-text,\n        span.framer-text:not([data-text-fill]) {\n            font-family: var(--framer-font-family-preview, var(--framer-blockquote-font-family, var(--framer-font-family, Inter, Inter Placeholder, sans-serif)));\n            font-style: var(--framer-font-style-preview, var(--framer-blockquote-font-style, var(--framer-font-style, normal)));\n            font-weight: var(--framer-font-weight-preview, var(--framer-blockquote-font-weight, var(--framer-font-weight, 400)));\n            color: var(--framer-blockquote-text-color, var(--framer-text-color, #000));\n            font-size: calc(var(--framer-blockquote-font-size, var(--framer-font-size, 16px)) * var(--framer-font-size-scale, 1));\n            letter-spacing: var(--framer-blockquote-letter-spacing, var(--framer-letter-spacing, 0));\n            text-transform: var(--framer-blockquote-text-transform, var(--framer-text-transform, none));\n            text-decoration-line: var(--framer-blockquote-text-decoration, var(--framer-text-decoration, initial));\n            text-decoration-style: var(--framer-blockquote-text-decoration-style, var(--framer-text-decoration-style, initial));\n            text-decoration-color: var(--framer-blockquote-text-decoration-color, var(--framer-text-decoration-color, initial));\n            text-decoration-thickness: var(--framer-blockquote-text-decoration-thickness, var(--framer-text-decoration-thickness, initial));\n            text-decoration-skip-ink: var(--framer-blockquote-text-decoration-skip-ink, var(--framer-text-decoration-skip-ink, initial));\n            text-underline-offset: var(--framer-blockquote-text-decoration-offset, var(--framer-text-decoration-offset, initial));\n            line-height: var(--framer-blockquote-line-height, var(--framer-line-height, 1.2em));\n            text-align: var(--framer-blockquote-text-alignment, var(--framer-text-alignment, start));\n            -webkit-text-stroke-width: var(--framer-text-stroke-width, initial);\n            -webkit-text-stroke-color: var(--framer-text-stroke-color, initial);\n            -moz-font-feature-settings: var(--framer-font-open-type-features, initial);\n            -webkit-font-feature-settings: var(--framer-font-open-type-features, initial);\n            font-feature-settings: var(--framer-font-open-type-features, initial);\n            font-variation-settings: var(--framer-font-variation-axes-preview, var(--framer-font-variation-axes, normal));\n            text-wrap: var(--framer-text-wrap-override, var(--framer-text-wrap));\n        }\n    `,\n\t/* css */ `\n        mark.framer-text,\n        p.framer-text,\n        div.framer-text,\n        h1.framer-text,\n        h2.framer-text,\n        h3.framer-text,\n        h4.framer-text,\n        h5.framer-text,\n        h6.framer-text,\n        li.framer-text,\n        ol.framer-text,\n        ul.framer-text {\n            background-color: var(--framer-blockquote-text-background-color, var(--framer-text-background-color, initial));\n            border-radius: var(--framer-blockquote-text-background-radius, var(--framer-text-background-radius, initial));\n            corner-shape: var(--framer-blockquote-text-background-corner-shape, var(--framer-text-background-corner-shape, initial));\n            padding: var(--framer-blockquote-text-background-padding, var(--framer-text-background-padding, initial));\n        }\n    `,\n\t/* css */ `\n        @supports not (color: color(display-p3 1 1 1)) {\n            p.framer-text,\n            div.framer-text,\n            h1.framer-text,\n            h2.framer-text,\n            h3.framer-text,\n            h4.framer-text,\n            h5.framer-text,\n            h6.framer-text,\n            li.framer-text,\n            ol.framer-text,\n            ul.framer-text,\n            span.framer-text:not([data-text-fill]) {\n                color: ${createRGBVariableFallbacks([\"--framer-blockquote-text-color\", \"--framer-text-color\"], \"#000\")};\n                -webkit-text-stroke-color: ${createRGBVariableFallbacks([\"--framer-text-stroke-color\"], \"initial\")};\n            }\n\n            mark.framer-text {\n                background-color: ${createRGBVariableFallbacks([\"--framer-blockquote-text-background-color\", \"--framer-text-background-color\"], \"initial\")};\n            }\n        }\n    `,\n\n\t/* css */ `\n        .framer-fit-text .framer-text {\n            white-space: nowrap;\n            white-space-collapse: preserve;\n        }\n    `,\n\n\t/* css */ `\n        strong.framer-text {\n            font-family: var(--framer-blockquote-font-family-bold, var(--framer-font-family-bold));\n            font-style: var(--framer-blockquote-font-style-bold, var(--framer-font-style-bold));\n            font-weight: var(--framer-blockquote-font-weight-bold, var(--framer-font-weight-bold, bolder));\n            font-variation-settings: var(--framer-blockquote-font-variation-axes-bold, var(--framer-font-variation-axes-bold));\n        }\n    `,\n\n\t/* css */ `\n        em.framer-text {\n            font-family: var(--framer-blockquote-font-family-italic, var(--framer-font-family-italic));\n            font-style: var(--framer-blockquote-font-style-italic, var(--framer-font-style-italic, italic));\n            font-weight: var(--framer-blockquote-font-weight-italic, var(--framer-font-weight-italic));\n            font-variation-settings: var(--framer-blockquote-font-variation-axes-italic, var(--framer-font-variation-axes-italic));\n        }\n    `,\n\n\t/* css */ `\n        em.framer-text > strong.framer-text {\n            font-family: var(--framer-blockquote-font-family-bold-italic, var(--framer-font-family-bold-italic));\n            font-style: var(--framer-blockquote-font-style-bold-italic, var(--framer-font-style-bold-italic, italic));\n            font-weight: var(--framer-blockquote-font-weight-bold-italic, var(--framer-font-weight-bold-italic, bolder));\n            font-variation-settings: var(--framer-blockquote-font-variation-axes-bold-italic, var(--framer-font-variation-axes-bold-italic));\n        }\n    `,\n\n\t/* css */ `\n        p.framer-text:not(:first-child),\n        div.framer-text:not(:first-child),\n        h1.framer-text:not(:first-child),\n        h2.framer-text:not(:first-child),\n        h3.framer-text:not(:first-child),\n        h4.framer-text:not(:first-child),\n        h5.framer-text:not(:first-child),\n        h6.framer-text:not(:first-child),\n        ol.framer-text:not(:first-child),\n        ul.framer-text:not(:first-child),\n        blockquote.framer-text:not(:first-child),\n        table.framer-text:not(:first-child),\n        figure.framer-text:not(:first-child),\n        .framer-image.framer-text:not(:first-child) {\n            margin-top: var(--framer-blockquote-paragraph-spacing, var(--framer-paragraph-spacing, 0));\n        }\n    `,\n\n\t// The first child of a list item is a paragraph. If the second child is a\n\t// nested list we don't want it to have paragraph spacing.\n\t/* css */ `\n        li.framer-text > ul.framer-text:nth-child(2),\n        li.framer-text > ol.framer-text:nth-child(2) {\n            margin-top: 0;\n        }\n    `,\n\n\t// background-clip: text clips to the physical dimensions of text as appose\n\t// to the rendered dimensions. normal text will bleed out side these\n\t// constraints but since this is just a clipping mask over the area the text\n\t// takes up we have cases where the text will get clipped. That is why we\n\t// need to expand the area that the gradient applies to to allow users to\n\t// use low line-heights. This will result in gradients not aligning\n\t// perfectly to the edges of the text. but this is a acceptable trade off at\n\t// this point. For now we increase the area of the clipping mask on the\n\t// bottom (for descenders) and the right for italic or wide fonts.\n\t/* css */ `\n        .framer-text[data-text-fill] {\n            display: ${defaultTextFillStyle.display};\n            background-clip: text;\n            -webkit-background-clip: text;\n            /* make this a transparent color if you want to visualise the clipping  */\n            -webkit-text-fill-color: transparent;\n            padding: max(0em, calc(calc(1.3em - var(--framer-blockquote-line-height, var(--framer-line-height, 1.3em))) / 2));\n            margin: min(0em, calc(calc(1.3em - var(--framer-blockquote-line-height, var(--framer-line-height, 1.3em))) / -2));\n        }\n    `,\n\n\t/* css */ `\n        code.framer-text,\n        code.framer-text span.framer-text:not([data-text-fill]) {\n            font-family: var(--framer-code-font-family, var(--framer-font-family, Inter, Inter Placeholder, sans-serif));\n            font-style: var(--framer-blockquote-font-style, var(--framer-code-font-style, var(--framer-font-style, normal)));\n            font-weight: var(--framer-blockquote-font-weight, var(--framer-code-font-weight, var(--framer-font-weight, 400)));\n            color: var(--framer-blockquote-text-color, var(--framer-code-text-color, var(--framer-text-color, #000)));\n            font-size: calc(var(--framer-blockquote-font-size, var(--framer-font-size, 16px)) * var(--framer-font-size-scale, 1));\n            letter-spacing: var(--framer-blockquote-letter-spacing, var(--framer-letter-spacing, 0));\n            line-height: var(--framer-blockquote-line-height, var(--framer-line-height, 1.2em));\n        }\n    `,\n\n\t/* css */ `\n        @supports not (color: color(display-p3 1 1 1)) {\n            code.framer-text,\n            code.framer-text span.framer-text:not([data-text-fill]) {\n                color: ${createRGBVariableFallbacks([\"--framer-blockquote-text-color\", \"--framer-code-text-color\", \"--framer-text-color\"], \"#000\")};\n            }\n        }\n    `,\n\n\t/* css */ `\n        blockquote.framer-text {\n            margin-block-start: initial;\n            margin-block-end: initial;\n            margin-inline-start: initial;\n            margin-inline-end: initial;\n            unicode-bidi: initial;\n        }\n    `,\n\n\t/* css */ `\n        a.framer-text,\n        a.framer-text span.framer-text:not([data-text-fill]),\n        span.framer-text[data-nested-link],\n        span.framer-text[data-nested-link] span.framer-text:not([data-text-fill]) {\n            /* Ensure the color is inherited from the link style rather than the parent text for nested spans */\n            color: inherit;\n            font-family: var(--framer-font-family-preview, var(--framer-blockquote-font-family, var(--framer-link-font-family, var(--framer-font-family, Inter, Inter Placeholder, sans-serif))));\n            font-style: var(--framer-font-style-preview, var(--framer-blockquote-font-style, var(--framer-link-font-style, var(--framer-font-style, normal))));\n            font-weight: var(--framer-font-weight-preview, var(--framer-blockquote-font-weight, var(--framer-link-font-weight, var(--framer-font-weight, 400))));\n            font-size: calc(var(--framer-blockquote-font-size, var(--framer-font-size, 16px)) * var(--framer-font-size-scale, 1));\n            text-transform: var(--framer-blockquote-text-transform, var(--framer-link-text-transform, var(--framer-text-transform, none)));\n            /* Cursor inherit to overwrite the user agent stylesheet on rich text links. */\n            cursor: var(--framer-custom-cursors, pointer);\n            /* Don't inherit background styles from any parent text style. */\n            background-color: initial;\n            border-radius: var(--framer-link-text-background-radius, initial);\n            corner-shape: var(--framer-link-text-background-corner-shape, initial);\n            padding: var(--framer-link-text-background-padding, initial);\n        }\n    `,\n\n\t// Animateable link styles can't be applied to the nested spans of links because it breaks animations\n\t/* css */ `\n        a.framer-text,\n        span.framer-text[data-nested-link] {\n            color: var(--framer-blockquote-text-color, var(--framer-link-text-color, var(--framer-text-color, #000)));\n            text-decoration-line: var(--framer-blockquote-text-decoration, var(--framer-link-text-decoration, var(--framer-text-decoration, initial)));\n            text-decoration-style: var(--framer-blockquote-text-decoration-style, var(--framer-link-text-decoration-style, var(--framer-text-decoration-style, initial)));\n            text-decoration-color: var(--framer-blockquote-text-decoration-color, var(--framer-link-text-decoration-color, var(--framer-text-decoration-color, initial)));\n            text-decoration-thickness: var(--framer-blockquote-text-decoration-thickness, var(--framer-link-text-decoration-thickness, var(--framer-text-decoration-thickness, initial)));\n            text-decoration-skip-ink: var(--framer-blockquote-text-decoration-skip-ink, var(--framer-link-text-decoration-skip-ink, var(--framer-text-decoration-skip-ink, initial)));\n            text-underline-offset: var(--framer-blockquote-text-decoration-offset, var(--framer-link-text-decoration-offset, var(--framer-text-decoration-offset, initial)));\n            /* Don't inherit background styles from any parent text style. */\n            background-color: var(--framer-link-text-background-color, initial);\n        }\n    `,\n\n\t/* css */ `\n        @supports not (color: color(display-p3 1 1 1)) {\n            a.framer-text,\n            span.framer-text[data-nested-link] {\n                color: ${createRGBVariableFallbacks([\"--framer-blockquote-text-color\", \"--framer-link-text-color\", \"--framer-text-color\"], \"#000\")};\n                background-color: ${createRGBVariableFallbacks([\"--framer-link-text-background-color\"], \"initial\")};\n                text-decoration-color: ${createRGBVariableFallbacks([\"--framer-link-text-decoration-color\", \"--framer-text-decoration-color\"], \"currentcolor\")};\n            }\n        }\n    `,\n\n\t/* css */ `\n    code.framer-text a.framer-text,\n    code.framer-text a.framer-text span.framer-text:not([data-text-fill]),\n    code.framer-text span.framer-text[data-nested-link],\n    code.framer-text span.framer-text[data-nested-link] span.framer-text:not([data-text-fill]) {\n        font-family: var(--framer-code-font-family, var(--framer-font-family, Inter, Inter Placeholder, sans-serif));\n        font-style: var(--framer-blockquote-font-style, var(--framer-code-font-style, var(--framer-font-style, normal)));\n        font-weight: var(--framer-blockquote-font-weight, var(--framer-code-font-weight, var(--framer-font-weight, 400)));\n        color: inherit;\n        font-size: calc(var(--framer-blockquote-font-size, var(--framer-font-size, 16px)) * var(--framer-font-size-scale, 1));\n    }\n`,\n\n\t/* css */ `\n    code.framer-text a.framer-text,\n    code.framer-text span.framer-text[data-nested-link] {\n        color: var(--framer-blockquote-text-color, var(--framer-link-text-color, var(--framer-code-text-color, var(--framer-text-color, #000))));\n    }\n`,\n\n\t/* css */ `\n    @supports not (color: color(display-p3 1 1 1)) {\n        code.framer-text a.framer-text,\n        code.framer-text a.framer-text span.framer-text:not([data-text-fill]),\n        code.framer-text span.framer-text[data-nested-link],\n        code.framer-text span.framer-text[data-nested-link] span.framer-text:not([data-text-fill]) {\n            color: ${createRGBVariableFallbacks([\"--framer-blockquote-text-color\", \"--framer-link-text-color\", \"--framer-code-text-color\", \"--framer-text-color\"], \"#000\")};\n        }\n    }\n`,\n\n\t/* css */ `\n        a.framer-text:hover,\n        a.framer-text:hover span.framer-text:not([data-text-fill]),\n        span.framer-text[data-nested-link]:hover,\n        span.framer-text[data-nested-link]:hover span.framer-text:not([data-text-fill]) {\n            font-family: var(--framer-font-family-preview, var(--framer-link-hover-font-family, var(--framer-blockquote-font-family, var(--framer-link-font-family, var(--framer-font-family, Inter, Inter Placeholder, sans-serif)))));\n            font-style: var(--framer-font-style-preview, var(--framer-link-hover-font-style, var(--framer-blockquote-font-style, var(--framer-link-font-style, var(--framer-font-style, normal)))));\n            font-weight: var(--framer-font-weight-preview, var(--framer-link-hover-font-weight, var(--framer-blockquote-font-weight, var(--framer-link-font-weight, var(--framer-font-weight, 400)))));\n            font-size: calc(var(--framer-link-hover-font-size, var(--framer-blockquote-font-size, var(--framer-font-size, 16px))) * var(--framer-font-size-scale, 1));\n            text-transform: var(--framer-link-hover-text-transform, var(--framer-blockquote-text-transform, var(--framer-link-text-transform, var(--framer-text-transform, none))));\n            border-radius: var(--framer-link-hover-text-background-radius, var(--framer-link-text-background-radius, var(--framer-text-background-radius, initial)));\n            corner-shape: var(--framer-link-hover-text-background-corner-shape, var(--framer-link-text-background-corner-shape, var(--framer-text-background-corner-shape, initial)));\n            padding: var(--framer-link-hover-text-background-padding, var(--framer-link-text-background-padding, var(--framer-text-background-padding, initial)));\n        }\n    `,\n\n\t/* css */ `\n        a.framer-text:hover,\n        span.framer-text[data-nested-link]:hover {\n            color: var(--framer-link-hover-text-color, var(--framer-blockquote-text-color, var(--framer-link-text-color, var(--framer-text-color, #000))));\n            text-decoration-line: var(--framer-link-hover-text-decoration, var(--framer-blockquote-text-decoration, var(--framer-link-text-decoration, var(--framer-text-decoration, initial))));\n            text-decoration-style: var(--framer-link-hover-text-decoration-style, var(--framer-blockquote-text-decoration-style, var(--framer-link-text-decoration-style, var(--framer-text-decoration-style, initial))));\n            text-decoration-color: var(--framer-link-hover-text-decoration-color, var(--framer-blockquote-text-decoration-color, var(--framer-link-text-decoration-color, var(--framer-text-decoration-color, initial))));\n            text-decoration-thickness: var(--framer-link-hover-text-decoration-thickness, var(--framer-blockquote-text-decoration-thickness, var(--framer-link-text-decoration-thickness, var(--framer-text-decoration-thickness, initial))));\n            text-decoration-skip-ink: var(--framer-link-hover-text-decoration-skip-ink, var(--framer-blockquote-text-decoration-skip-ink, var(--framer-link-text-decoration-skip-ink, var(--framer-text-decoration-skip-ink, initial))));\n            text-underline-offset: var(--framer-link-hover-text-decoration-offset, var(--framer-blockquote-text-decoration-offset, var(--framer-link-text-decoration-offset, var(--framer-text-decoration-offset, initial))));\n            background-color: var(--framer-link-hover-text-background-color, var(--framer-link-text-background-color, var(--framer-text-background-color, initial)));\n        }\n    `,\n\n\t/* css */ `\n    @supports not (color: color(display-p3 1 1 1)) {\n        a.framer-text:hover,\n        span.framer-text[data-nested-link]:hover {\n            color: ${createRGBVariableFallbacks([\"--framer-link-hover-text-color\", \"--framer-blockquote-text-color\", \"--framer-link-text-color\", \"--framer-text-color\"], \"#000\")};\n            background-color: ${createRGBVariableFallbacks([\"--framer-link-hover-text-background-color\", \"--framer-link-text-background-color\", \"--framer-text-background-color\"], \"initial\")};\n            text-decoration-color: ${createRGBVariableFallbacks([\"--framer-link-hover-text-decoration-color\", \"--framer-link-text-decoration-color\", \"--framer-text-decoration-color\"], \"currentcolor\")};\n        }\n    }\n    `,\n\n\t/* css */ `\n        code.framer-text a.framer-text:hover,\n        code.framer-text span.framer-text[data-nested-link]:hover {\n            color: var(--framer-link-hover-text-color, var(--framer-blockquote-text-color, var(--framer-link-text-color, var(--framer-code-text-color, var(--framer-text-color, #000)))));\n        }\n    `,\n\n\t/* css */ `\n    @supports not (color: color(display-p3 1 1 1)) {\n        code.framer-text a.framer-text:hover,\n        code.framer-text span.framer-text[data-nested-link]:hover {\n            color: ${createRGBVariableFallbacks([\"--framer-link-hover-text-color\", \"--framer-blockquote-text-color\", \"--framer-link-text-color\", \"--framer-code-text-color\", \"--framer-text-color\"], \"#000\")};\n        }\n    }\n   `,\n\n\t/* css */ `\n        a.framer-text[data-framer-page-link-current],\n        a.framer-text[data-framer-page-link-current] span.framer-text:not([data-text-fill]),\n        span.framer-text[data-framer-page-link-current],\n        span.framer-text[data-framer-page-link-current] span.framer-text:not([data-text-fill]) {\n            font-family: var(--framer-font-family-preview, var(--framer-link-current-font-family, var(--framer-link-font-family, var(--framer-font-family, Inter, Inter Placeholder, sans-serif))));\n            font-style: var(--framer-font-style-preview, var(--framer-link-current-font-style, var(--framer-link-font-style, var(--framer-font-style, normal))));\n            font-weight: var(--framer-font-weight-preview, var(--framer-link-current-font-weight, var(--framer-link-font-weight, var(--framer-font-weight, 400))));\n            font-size: calc(var(--framer-link-current-font-size, var(--framer-link-font-size, var(--framer-font-size, 16px))) * var(--framer-font-size-scale, 1));\n            text-transform: var(--framer-link-current-text-transform, var(--framer-link-text-transform, var(--framer-text-transform, none)));\n            border-radius: var(--framer-link-current-text-background-radius, var(--framer-link-text-background-radius, initial));\n            corner-shape: var(--framer-link-current-text-background-corner-shape, var(--framer-link-text-background-corner-shape, initial));\n            padding: var(--framer-link-current-text-background-padding, var(--framer-link-text-background-padding, initial));\n        }\n    `,\n\n\t/* css */ `\n        a.framer-text[data-framer-page-link-current],\n        span.framer-text[data-framer-page-link-current] {\n            color: var(--framer-link-current-text-color, var(--framer-link-text-color, var(--framer-text-color, #000)));\n            text-decoration-line: var(--framer-link-current-text-decoration, var(--framer-link-text-decoration, var(--framer-text-decoration, initial)));\n            text-decoration-style: var(--framer-link-current-text-decoration-style, var(--framer-link-text-decoration-style, var(--framer-text-decoration-style, initial)));\n            text-decoration-color: var(--framer-link-current-text-decoration-color, var(--framer-link-text-decoration-color, var(--framer-text-decoration-color, initial)));\n            text-decoration-thickness: var(--framer-link-current-text-decoration-thickness, var(--framer-link-text-decoration-thickness, var(--framer-text-decoration-thickness, initial)));\n            text-decoration-skip-ink: var(--framer-link-current-text-decoration-skip-ink, var(--framer-link-text-decoration-skip-ink, var(--framer-text-decoration-skip-ink, initial)));\n            text-underline-offset: var(--framer-link-current-text-decoration-offset, var(--framer-link-text-decoration-offset, var(--framer-text-decoration-offset, initial)));\n            background-color: var(--framer-link-current-text-background-color, var(--framer-link-text-background-color, var(--framer-text-background-color, initial)));\n        }\n    `,\n\n\t/* css */ `\n        @supports not (color: color(display-p3 1 1 1)) {\n            a.framer-text[data-framer-page-link-current],\n            span.framer-text[data-framer-page-link-current]{\n                color: ${createRGBVariableFallbacks([\"--framer-link-current-text-color\", \"--framer-link-text-color\", \"--framer-text-color\"], \"#000\")};\n                background-color: ${createRGBVariableFallbacks([\"--framer-link-current-text-background-color\", \"--framer-link-text-background-color\", \"--framer-text-background-color\"], \"initial\")};\n                text-decoration-color: ${createRGBVariableFallbacks([\"--framer-link-current-text-decoration-color\", \"--framer-link-text-decoration-color\", \"--framer-text-decoration-color\"], \"currentcolor\")};\n            }\n        }\n    `,\n\n\t/* css */ `\n        code.framer-text a.framer-text[data-framer-page-link-current],\n        code.framer-text a.framer-text[data-framer-page-link-current] span.framer-text:not([data-text-fill]),\n        code.framer-text span.framer-text[data-framer-page-link-current],\n        code.framer-text span.framer-text[data-framer-page-link-current] span.framer-text:not([data-text-fill]) {\n            font-family: var(--framer-code-font-family, var(--framer-font-family, Inter, Inter Placeholder, sans-serif));\n            font-style: var(--framer-code-font-style, var(--framer-font-style, normal));\n            font-weight: var(--framer-code-font-weight, var(--framer-font-weight, 400));\n            color: inherit;\n            font-size: calc(var(--framer-link-current-font-size, var(--framer-link-font-size, var(--framer-font-size, 16px))) * var(--framer-font-size-scale, 1));\n        }\n    `,\n\n\t/* css */ `\n        code.framer-text a.framer-text[data-framer-page-link-current],\n        code.framer-text span.framer-text[data-framer-page-link-current] {\n            color: var(--framer-link-current-text-color, var(--framer-link-text-color, var(--framer-code-text-color, var(--framer-text-color, #000))));\n        }\n    `,\n\n\t/* css */ `\n        @supports not (color: color(display-p3 1 1 1)) {\n            code.framer-text a.framer-text[data-framer-page-link-current],\n            code.framer-text a.framer-text[data-framer-page-link-current] span.framer-text:not([data-text-fill]),\n            code.framer-text span.framer-text[data-framer-page-link-current],\n            code.framer-text span.framer-text[data-framer-page-link-current] span.framer-text:not([data-text-fill]) {\n                color: ${createRGBVariableFallbacks([\"--framer-link-current-text-color\", \"--framer-link-text-color\", \"--framer-code-text-color\", \"--framer-text-color\"], \"#000\")};\n                background-color: ${createRGBVariableFallbacks([\"--framer-link-current-text-background-color\", \"--framer-link-text-background-color\", \"--framer-text-background-color\"], \"initial\")};\n            }\n        }\n    `,\n\n\t/* css */ `\n        a.framer-text[data-framer-page-link-current]:hover,\n        a.framer-text[data-framer-page-link-current]:hover span.framer-text:not([data-text-fill]),\n        span.framer-text[data-framer-page-link-current]:hover,\n        span.framer-text[data-framer-page-link-current]:hover span.framer-text:not([data-text-fill]) {\n            color: inherit;\n            font-family: var(--framer-font-family-preview, var(--framer-link-hover-font-family, var(--framer-link-current-font-family, var(--framer-link-font-family, var(--framer-font-family, Inter, Inter Placeholder, sans-serif)))));\n            font-style: var(--framer-font-style-preview, var(--framer-link-hover-font-style, var(--framer-link-current-font-style, var(--framer-link-font-style, var(--framer-font-style, normal)))));\n            font-weight: var(--framer-font-weight-preview, var(--framer-link-hover-font-weight, var(--framer-link-current-font-weight, var(--framer-link-font-weight, var(--framer-font-weight, 400)))));\n            font-size: calc(var(--framer-link-hover-font-size, var(--framer-link-current-font-size, var(--framer-link-font-size, var(--framer-font-size, 16px)))) * var(--framer-font-size-scale, 1));\n            text-transform: var(--framer-link-hover-text-transform, var(--framer-link-current-text-transform, var(--framer-link-text-transform, var(--framer-text-transform, none))));\n            border-radius: var(--framer-link-hover-text-background-radius, var(--framer-link-current-text-background-radius, var(--framer-link-text-background-radius, initial)));\n            corner-shape: var(--framer-link-hover-text-background-corner-shape, var(--framer-link-current-text-background-corner-shape, var(--framer-link-text-background-corner-shape, initial)));\n            padding: var(--framer-link-hover-text-background-padding, var(--framer-link-current-text-background-padding, var(--framer-link-text-background-padding, initial)));\n        }\n    `,\n\n\t/* css */ `\n        a.framer-text[data-framer-page-link-current]:hover,\n        span.framer-text[data-framer-page-link-current]:hover {\n            color: var(--framer-link-hover-text-color, var(--framer-link-current-text-color, var(--framer-link-text-color, var(--framer-text-color, #000))));\n            text-decoration-line: var(--framer-link-hover-text-decoration, var(--framer-link-current-text-decoration, var(--framer-link-text-decoration, var(--framer-text-decoration, initial))));\n            text-decoration-style: var(--framer-link-hover-text-decoration-style, var(--framer-link-current-text-decoration-style, var(--framer-link-text-decoration-style, var(--framer-text-decoration-style, initial))));\n            text-decoration-color: var(--framer-link-hover-text-decoration-color, var(--framer-link-current-text-decoration-color, var(--framer-link-text-decoration-color, var(--framer-text-decoration-color, initial))));\n            text-decoration-thickness: var(--framer-link-hover-text-decoration-thickness, var(--framer-link-current-text-decoration-thickness, var(--framer-link-text-decoration-thickness, var(--framer-text-decoration-thickness, initial))));\n            text-decoration-skip-ink: var(--framer-link-hover-text-decoration-skip-ink, var(--framer-link-current-text-decoration-skip-ink, var(--framer-link-text-decoration-skip-ink, var(--framer-text-decoration-skip-ink, initial))));\n            text-underline-offset: var(--framer-link-hover-text-decoration-offset, var(--framer-link-current-text-decoration-offset, var(--framer-link-text-decoration-offset, var(--framer-text-decoration-offset, initial))));\n            background-color: var(--framer-link-hover-text-background-color, var(--framer-link-current-text-background-color, var(--framer-link-text-background-color, initial)));\n        }\n    `,\n\n\t/* css */ `\n        @supports not (color: color(display-p3 1 1 1)) {\n            a.framer-text[data-framer-page-link-current]:hover,\n            span.framer-text[data-framer-page-link-current]:hover {\n                color: ${createRGBVariableFallbacks([\"--framer-link-hover-text-color\", \"--framer-link-current-text-color\", \"--framer-link-text-color\", \"--framer-code-text-color\", \"--framer-text-color\"], \"#000\")};\n                background-color: ${createRGBVariableFallbacks([\"--framer-link-hover-text-background-color\", \"--framer-link-current-text-background-color\", \"--framer-link-text-background-color\"], \"initial\")};\n                text-decoration-color: ${createRGBVariableFallbacks([\"--framer-link-hover-text-decoration-color\", \"--framer-link-current-text-decoration-color\", \"--framer-link-text-decoration-color\", \"--framer-text-decoration-color\"], \"currentcolor\")};\n            }\n        }\n    `,\n\n\t/* css */ `\n        code.framer-text a.framer-text[data-framer-page-link-current]:hover,\n        code.framer-text span.framer-text[data-framer-page-link-current]:hover {\n            color: var(--framer-link-hover-text-color, var(--framer-link-current-text-color, var(--framer-link-text-color, var(--framer-code-text-color, var(--framer-text-color, #000)))));\n        }\n    `,\n\n\t/* css */ `\n        @supports not (color: color(display-p3 1 1 1)) {\n            code.framer-text a.framer-text[data-framer-page-link-current]:hover,\n            code.framer-text a.framer-text[data-framer-page-link-current]:hover span.framer-text:not([data-text-fill]),\n            code.framer-text span.framer-text[data-framer-page-link-current]:hover,\n            code.framer-text span.framer-text[data-framer-page-link-current]:hover span.framer-text:not([data-text-fill]) {\n                color: ${createRGBVariableFallbacks([\"--framer-link-hover-text-color\", \"--framer-link-current-text-color\", \"--framer-link-text-color\", \"--framer-code-text-color\", \"--framer-text-color\"], \"#000\")};\n                background-color: ${createRGBVariableFallbacks([\"--framer-link-hover-text-background-color\", \"--framer-link-current-text-background-color\", \"--framer-link-text-background-color\"], \"initial\")};\n            }\n        }\n    `,\n\n\t/* css */ `\n        .framer-image.framer-text {\n            display: ${defaultImageStyle.display};\n            max-width: 100%;\n            height: auto;\n        }\n    `,\n\n\t/* css */ `\n        .text-styles-preset-reset.framer-text {\n            --framer-font-family: Inter, Inter Placeholder, sans-serif;\n            --framer-font-style: normal;\n            --framer-font-weight: 500;\n            --framer-text-color: #000;\n            --framer-font-size: 16px;\n            --framer-letter-spacing: 0;\n            --framer-text-transform: none;\n            --framer-text-decoration: none;\n            --framer-text-decoration-style: none;\n            --framer-text-decoration-color: none;\n            --framer-text-decoration-thickness: none;\n            --framer-text-decoration-skip-ink: none;\n            --framer-text-decoration-offset: none;\n            --framer-line-height: 1.2em;\n            --framer-text-alignment: start;\n            --framer-font-open-type-features: normal;\n            --framer-text-background-color: initial;\n            --framer-text-background-radius: initial;\n            --framer-text-background-corner-shape: initial;\n            --framer-text-background-padding: initial;\n        }\n    `,\n\n\t/* css */ `\n        ol.framer-text {\n            --list-style-type: decimal;\n        }\n    `,\n\n\t// Why all the `position: relative` and `position: absolute` and `::before` tricks?\n\t// We want ul\u2019s disks and ol\u2019s numbers to be left-aligned at the start of the line.\n\t// There\u2019s no way to do that with ::marker styles alone, so we have to resort to this trick.\n\t/* css */ `\n        ul.framer-text,\n        ol.framer-text {\n            padding-inline-start: 0;\n            position: relative;\n        }\n    `,\n\n\t/* css */ `\n        li.framer-text {\n            counter-increment: list-item;\n            list-style: none;\n            padding-inline-start: 2ch;\n        }\n    `,\n\n\t// font-variant-numeric: tabular-nums enables monospaced numbers (which is neat in a vertical list of numbers)\n\t// and makes `li`s match the default browser styles better.\n\t/* css */ `\n        ol.framer-text > li.framer-text::before {\n            position: absolute;\n            inset-inline-start: 0;\n            content: counter(list-item, var(--list-style-type)) \".\";\n            font-variant-numeric: tabular-nums;\n        }\n    `,\n\n\t// Why this? Due to `position: absolute` (see above), if a list has a lot of items, the numbers\n\t// might start overlapping the text content. This compensates for that. The trick is based on\n\t// https://alistapart.com/article/quantity-queries-for-css/#section6. The trick doesn\u2019t account\n\t// for lists longer than 1,000,000 items, but if you have a list of 1,000,000 items, you\u2019ll have\n\t// other problems \u00AF\\_(\u30C4)_/\u00AF\n\t/* css */ `\n        ol.framer-text > li.framer-text:nth-last-child(n + 10),\n        ol.framer-text > li.framer-text:nth-last-child(n + 10) ~ li {\n            padding-inline-start: 3ch;\n        }\n    `,\n\n\t/* css */ `\n        ol.framer-text > li.framer-text:nth-last-child(n + 100),\n        ol.framer-text > li.framer-text:nth-last-child(n + 100) ~ li {\n            padding-inline-start: 4ch;\n        }\n    `,\n\n\t/* css */ `\n        ol.framer-text > li.framer-text:nth-last-child(n + 1000),\n        ol.framer-text > li.framer-text:nth-last-child(n + 1000) ~ li {\n            padding-inline-start: 5ch;\n        }\n    `,\n\n\t/* css */ `\n        ol.framer-text > li.framer-text:nth-last-child(n + 10000),\n        ol.framer-text > li.framer-text:nth-last-child(n + 10000) ~ li {\n            padding-inline-start: 6ch;\n        }\n    `,\n\n\t/* css */ `\n        ol.framer-text > li.framer-text:nth-last-child(n + 100000),\n        ol.framer-text > li.framer-text:nth-last-child(n + 100000) ~ li {\n            padding-inline-start: 7ch;\n        }\n    `,\n\n\t/* css */ `\n        ol.framer-text > li.framer-text:nth-last-child(n + 1000000),\n        ol.framer-text > li.framer-text:nth-last-child(n + 1000000) ~ li {\n            padding-inline-start: 8ch;\n        }\n    `,\n\n\t/* css */ `\n        ul.framer-text > li.framer-text::before {\n            position: absolute;\n            inset-inline-start: 0;\n            content: \"\u2022\";\n        }\n    `,\n\n\t/* css */ `\n        .framer-table-wrapper {\n            overflow-x: auto;\n        }\n    `,\n\n\t/* css */ `\n        table.framer-text,\n        .framer-table-wrapper table.framer-text {\n            border-collapse: separate;\n            border-spacing: 0;\n            table-layout: auto;\n            word-break: normal;\n            width: 100%;\n        }\n    `,\n\n\t/* css */ `\n        td.framer-text,\n        th.framer-text {\n            min-width: 16ch;\n            vertical-align: top;\n        }\n    `,\n\n\t// Modules can have highly specific three-class selectors in case of PropertyOverrides, so dimension styles will only work with !important\n\n\t/* css */ `\n        ${selectComponentChild('.framer-text-module[data-width=\"fill\"]', \":first-child\")} {\n            width: 100% !important;\n        }\n    `,\n])()\n\n/**\n * Safari <=16 doesn't support text truncation (-webkit-line-clamp) of elements with block-level\n * ancestors. To workaround this, we render all ancestors as inline elements, so that the browser\n * can truncate the text as it would normally.\n *\n * Then we add a line break after each of the elements that we rendered inline, to retain as much of\n * the original structure as possible. It is not perfect, but it gets us most of functionality and\n * appearance for Safari <=16 users.\n *\n * We use CSS variables that are only defined when the text is truncated, so that the fix is only\n * applied to truncated text. This is better than using data attributes to target text truncated\n * nodes, because it doesn't cause unnecessary SSG variants/branches to be generated.\n *\n * @see https://stackoverflow.com/questions/70897195/line-clamp-webkit-not-working-in-safari\n * @see https://framer-team.slack.com/archives/C01B14R6E22/p1756882450581289\n * @see https://framer-team.slack.com/archives/CR3CYA1D4/p1757005728045899\n * */\n\nexport const textTruncationDisplayInlineVariableForSafari16 = \"--text-truncation-display-inline-for-safari-16\"\nexport const textTruncationDisplayNoneVariableForSafari16 = \"--text-truncation-display-none-for-safari-16\"\nexport const textTruncationLineBreakVariableForSafari16 = \"--text-truncation-line-break-for-safari-16\"\n\nconst blockLikeElementSelectors = [\n\t\"div.framer-text\",\n\t\"p.framer-text\",\n\t\"h1.framer-text\",\n\t\"h2.framer-text\",\n\t\"h3.framer-text\",\n\t\"h4.framer-text\",\n\t\"h5.framer-text\",\n\t\"h6.framer-text\",\n\t\"ol.framer-text\",\n\t\"ul.framer-text\",\n\t\"li.framer-text\",\n\t\"blockquote.framer-text\",\n\t\".framer-text.framer-image\",\n]\n\nconst anySafariVersion = \"(background: -webkit-named-image(i))\"\nconst safari17OrGreater = \"(contain-intrinsic-size: inherit)\"\n\nexport const safari16TextTruncationFix = /* @__PURE__ */ (() => [\n\t`@supports ${anySafariVersion} and (not ${safari17OrGreater}) {\n        /* Render block-like elements inline when text is truncated, otherwise default to user agent (revert)  */\n        ${blockLikeElementSelectors.join(\", \")} { display: var(${textTruncationDisplayInlineVariableForSafari16}, revert) }\n\n        /* Add a line break after each block-like element that we render inline, to resemble the block-like behavior */\n        ${blockLikeElementSelectors.map(selector => `${selector}::after`).join(\", \")} { content: var(${textTruncationLineBreakVariableForSafari16}); white-space: pre; }\n\n        /* Don't render modules (e.g. videos, code-blocks), or tables when text is truncated, because often these can't be truncated and their children might be block elements */\n        .framer-text.framer-text-module,\n        .framer-text.framer-table-wrapper { display: var(${textTruncationDisplayNoneVariableForSafari16}, revert) }\n\n        /* Render text-fill elements inline when text is truncated, otherwise default to their default value (e.g. inline-block) */\n        p.framer-text[data-text-fill] { display: var(${textTruncationDisplayInlineVariableForSafari16}, ${defaultTextFillStyle.display}) }\n    }`,\n])()\n", "import { withCSS } from \"../../modules/withCSS.tsx\"\nimport { flexboxGapNotSupportedClass } from \"../../modules/workaroundFlexboxGapNotSupported.ts\"\nimport { RenderTarget } from \"../../render/types/RenderEnvironment.ts\"\nimport { deprecatedRichTextCSSRules } from \"./injectDeprecatedRichTextRules.ts\"\nimport { richTextCSSRules, safari16TextTruncationFix } from \"./injectRichTextRules.ts\"\nimport * as CSS from \"./setDocumentStyles.ts\"\n\nconst componentCSSRules: string[] = [`[data-framer-component-type] { position: absolute; }`]\n\n// A note about text CSS. Older Framer projects generated text like this:\n//\n//     <div><!-- wrapper -->\n//       <div><!-- first line (\"block\" in DraftJS parlance) -->\n//         <span style=\"bold\">Hello </span><span>world</span><br>\n//       </div>\n//       <div><!-- second line, etc. --></div>\n//     </div>\n//\n// Newer projects generate text like this:\n//\n//     <span><!-- wrapper, can pick from span (default), p, h1-h6 -->\n//       <span><!-- first line (\"block\" in DraftJS parlance) -->\n//         <span style=\"bold\">Hello </span><span>world</span><br>\n//       </span>\n//       <span><!-- second line, etc. --></span>\n//     </span>\n//\n// All of this might further be wrapped in an <a>, e.g.:\n//\n//     <!-- after introducing semantic tags -->\n//     <a>\n//       <h1><!-- wrapper -->\n//         <span><!-- block -->\n//           <span style=\"bold\">Hello </span><span>world</span><br>\n//         </span>\n//       </h1>\n//     </a>\n//\n//     <!-- before introducing semantic tags -->\n//     <a><!-- is also the wrapper -->\n//       <div><!-- block -->\n//         <span style=\"bold\">Hello </span><span>world</span><br>\n//       </div>\n//     </a>\n//\n// And the inline spans can also be <a> instead, e.g.:\n//\n//     <span><!-- wrapper -->\n//       <span><!-- block -->\n//         <span style=\"bold\">Hello </span><a>world</a><br>\n//       </span>\n//     </span>\n//\n// The library CSS needs to support all of that.\n\nconst textAlignmentRule = `\n[data-framer-component-type=\"Text\"] > * {\n    text-align: var(--framer-text-alignment, start);\n}`\n\nconst textBlockSpanRule = `\n[data-framer-component-type=\"Text\"] span span,\n[data-framer-component-type=\"Text\"] p span,\n[data-framer-component-type=\"Text\"] h1 span,\n[data-framer-component-type=\"Text\"] h2 span,\n[data-framer-component-type=\"Text\"] h3 span,\n[data-framer-component-type=\"Text\"] h4 span,\n[data-framer-component-type=\"Text\"] h5 span,\n[data-framer-component-type=\"Text\"] h6 span {\n    display: block;\n}`\n\nconst textInlineSpanRule = `\n[data-framer-component-type=\"Text\"] span span span,\n[data-framer-component-type=\"Text\"] p span span,\n[data-framer-component-type=\"Text\"] h1 span span,\n[data-framer-component-type=\"Text\"] h2 span span,\n[data-framer-component-type=\"Text\"] h3 span span,\n[data-framer-component-type=\"Text\"] h4 span span,\n[data-framer-component-type=\"Text\"] h5 span span,\n[data-framer-component-type=\"Text\"] h6 span span {\n    display: unset;\n}`\n\nconst renderTextStylesRule = `\n[data-framer-component-type=\"Text\"] div div span,\n[data-framer-component-type=\"Text\"] a div span,\n[data-framer-component-type=\"Text\"] span span span,\n[data-framer-component-type=\"Text\"] p span span,\n[data-framer-component-type=\"Text\"] h1 span span,\n[data-framer-component-type=\"Text\"] h2 span span,\n[data-framer-component-type=\"Text\"] h3 span span,\n[data-framer-component-type=\"Text\"] h4 span span,\n[data-framer-component-type=\"Text\"] h5 span span,\n[data-framer-component-type=\"Text\"] h6 span span,\n[data-framer-component-type=\"Text\"] a {\n    font-family: var(--font-family);\n    font-style: var(--font-style);\n    font-weight: min(calc(var(--framer-font-weight-increase, 0) + var(--font-weight, 400)), 900);\n    color: var(--text-color);\n    letter-spacing: var(--letter-spacing);\n    font-size: var(--font-size);\n    text-transform: var(--text-transform);\n    --text-decoration: var(--framer-text-decoration-style, solid) var(--framer-text-decoration, none) var(--framer-text-decoration-color, currentcolor) var(--framer-text-decoration-thickness, auto);\n    --text-decoration-skip-ink: var(--framer-text-decoration-skip-ink);\n    --text-underline-offset: var(--framer-text-decoration-offset);\n    line-height: var(--line-height);\n}`\n\nconst textStylesRule = `\n[data-framer-component-type=\"Text\"] div div span,\n[data-framer-component-type=\"Text\"] a div span,\n[data-framer-component-type=\"Text\"] span span span,\n[data-framer-component-type=\"Text\"] p span span,\n[data-framer-component-type=\"Text\"] h1 span span,\n[data-framer-component-type=\"Text\"] h2 span span,\n[data-framer-component-type=\"Text\"] h3 span span,\n[data-framer-component-type=\"Text\"] h4 span span,\n[data-framer-component-type=\"Text\"] h5 span span,\n[data-framer-component-type=\"Text\"] h6 span span,\n[data-framer-component-type=\"Text\"] a {\n    --font-family: var(--framer-font-family);\n    --font-style: var(--framer-font-style);\n    --font-weight: var(--framer-font-weight);\n    --text-color: var(--framer-text-color);\n    --letter-spacing: var(--framer-letter-spacing);\n    --font-size: var(--framer-font-size);\n    --text-transform: var(--framer-text-transform);\n    --text-decoration: var(--framer-text-decoration-style, solid) var(--framer-text-decoration, none) var(--framer-text-decoration-color, currentcolor) var(--framer-text-decoration-thickness, auto);\n    --text-decoration-skip-ink: var(--framer-text-decoration-skip-ink);\n    --text-underline-offset: var(--framer-text-decoration-offset);\n    --line-height: var(--framer-line-height);\n}`\n\nconst linkStylesRule = `\n[data-framer-component-type=\"Text\"] a,\n[data-framer-component-type=\"Text\"] a div span,\n[data-framer-component-type=\"Text\"] a span span span,\n[data-framer-component-type=\"Text\"] a p span span,\n[data-framer-component-type=\"Text\"] a h1 span span,\n[data-framer-component-type=\"Text\"] a h2 span span,\n[data-framer-component-type=\"Text\"] a h3 span span,\n[data-framer-component-type=\"Text\"] a h4 span span,\n[data-framer-component-type=\"Text\"] a h5 span span,\n[data-framer-component-type=\"Text\"] a h6 span span {\n    --font-family: var(--framer-link-font-family, var(--framer-font-family));\n    --font-style: var(--framer-link-font-style, var(--framer-font-style));\n    --font-weight: var(--framer-link-font-weight, var(--framer-font-weight));\n    --text-color: var(--framer-link-text-color, var(--framer-text-color));\n    --font-size: var(--framer-link-font-size, var(--framer-font-size));\n    --text-transform: var(--framer-link-text-transform, var(--framer-text-transform));\n    --text-decoration: var(--framer-link-text-decoration-style, var(--framer-text-decoration-style, solid)) var(--framer-link-text-decoration, var(--framer-text-decoration, none)) var(--framer-link-text-decoration-color, var(--framer-text-decoration-color, currentcolor)) var(--framer-link-text-decoration-thickness, var(--framer-text-decoration-thickness, auto));\n    --text-decoration-skip-ink: var(--framer-link-text-decoration-skip-ink, var(--framer-text-decoration-skip-ink));\n    --text-underline-offset: var(--framer-link-text-decoration-offset, var(--framer-text-decoration-offset));\n}`\n\nconst linkHoverStylesRule = `\n[data-framer-component-type=\"Text\"] a:hover,\n[data-framer-component-type=\"Text\"] a div span:hover,\n[data-framer-component-type=\"Text\"] a span span span:hover,\n[data-framer-component-type=\"Text\"] a p span span:hover,\n[data-framer-component-type=\"Text\"] a h1 span span:hover,\n[data-framer-component-type=\"Text\"] a h2 span span:hover,\n[data-framer-component-type=\"Text\"] a h3 span span:hover,\n[data-framer-component-type=\"Text\"] a h4 span span:hover,\n[data-framer-component-type=\"Text\"] a h5 span span:hover,\n[data-framer-component-type=\"Text\"] a h6 span span:hover {\n    --font-family: var(--framer-link-hover-font-family, var(--framer-link-font-family, var(--framer-font-family)));\n    --font-style: var(--framer-link-hover-font-style, var(--framer-link-font-style, var(--framer-font-style)));\n    --font-weight: var(--framer-link-hover-font-weight, var(--framer-link-font-weight, var(--framer-font-weight)));\n    --text-color: var(--framer-link-hover-text-color, var(--framer-link-text-color, var(--framer-text-color)));\n    --font-size: var(--framer-link-hover-font-size, var(--framer-link-font-size, var(--framer-font-size)));\n    --text-transform: var(--framer-link-hover-text-transform, var(--framer-link-text-transform, var(--framer-text-transform)));\n    --text-decoration: var(--framer-link-hover-text-decoration-style, var(--framer-link-text-decoration-style, var(--framer-text-decoration-style, solid))) var(--framer-link-hover-text-decoration, var(--framer-link-text-decoration, var(--framer-text-decoration, none))) var(--framer-link-hover-text-decoration-color, var(--framer-link-text-decoration-color, var(--framer-text-decoration-color, currentcolor))) var(--framer-link-hover-text-decoration-thickness, var(--framer-link-text-decoration-thickness, var(--framer-text-decoration-thickness, auto)));\n    --text-decoration-skip-ink: var(--framer-link-hover-text-decoration-skip-ink, var(--framer-link-text-decoration-skip-ink, var(--framer-text-decoration-skip-ink)));\n    --text-underline-offset: var(--framer-link-hover-text-decoration-offset, var(--framer-link-text-decoration-offset, var(--framer-text-decoration-offset)));\n}`\n\nconst linkCurrentStylesRule = `\n[data-framer-component-type=\"Text\"].isCurrent a,\n[data-framer-component-type=\"Text\"].isCurrent a div span,\n[data-framer-component-type=\"Text\"].isCurrent a span span span,\n[data-framer-component-type=\"Text\"].isCurrent a p span span,\n[data-framer-component-type=\"Text\"].isCurrent a h1 span span,\n[data-framer-component-type=\"Text\"].isCurrent a h2 span span,\n[data-framer-component-type=\"Text\"].isCurrent a h3 span span,\n[data-framer-component-type=\"Text\"].isCurrent a h4 span span,\n[data-framer-component-type=\"Text\"].isCurrent a h5 span span,\n[data-framer-component-type=\"Text\"].isCurrent a h6 span span {\n    --font-family: var(--framer-link-current-font-family, var(--framer-link-font-family, var(--framer-font-family)));\n    --font-style: var(--framer-link-current-font-style, var(--framer-link-font-style, var(--framer-font-style)));\n    --font-weight: var(--framer-link-current-font-weight, var(--framer-link-font-weight, var(--framer-font-weight)));\n    --text-color: var(--framer-link-current-text-color, var(--framer-link-text-color, var(--framer-text-color)));\n    --font-size: var(--framer-link-current-font-size, var(--framer-link-font-size, var(--framer-font-size)));\n    --text-transform: var(--framer-link-current-text-transform, var(--framer-link-text-transform, var(--framer-text-transform)));\n    --text-decoration: var(--framer-link-current-text-decoration-style, var(--framer-link-text-decoration-style, var(--framer-text-decoration-style, solid))) var(--framer-link-current-text-decoration, var(--framer-link-text-decoration, var(--framer-text-decoration, none))) var(--framer-link-current-text-decoration-color, var(--framer-link-text-decoration-color, var(--framer-text-decoration-color, currentcolor))) var(--framer-link-current-text-decoration-thickness, var(--framer-link-text-decoration-thickness, var(--framer-text-decoration-thickness, auto)));\n    --text-decoration-skip-ink: var(--framer-link-current-text-decoration-skip-ink, var(--framer-link-text-decoration-skip-ink, var(--framer-text-decoration-skip-ink)));\n    --text-underline-offset: var(--framer-link-current-text-decoration-offset, var(--framer-link-text-decoration-offset, var(--framer-text-decoration-offset)));\n}`\n\n// [data-framer-component-text-autosized] is no longer used, but still supported\n// included to maintain backwards compatibility for smart components that were\n// generated before it was removed:\n// https://github.com/framer/FramerStudio/pull/8270.\nconst textCSSRules = [\n\t`[data-framer-component-type=\"Text\"] { cursor: inherit; }`,\n\t`[data-framer-component-text-autosized] * { white-space: pre; }`,\n\ttextAlignmentRule,\n\ttextBlockSpanRule,\n\ttextInlineSpanRule,\n\trenderTextStylesRule,\n\ttextStylesRule,\n\tlinkStylesRule,\n\tlinkHoverStylesRule,\n\tlinkCurrentStylesRule,\n]\n\n/**\n * In generated code sticky is set via CSS, we don't want to set `position:\n * relative` here since it has a higher precedence. Code-gen stack children will\n * receive their `position: relative` through style overrides.\n */\nconst stackPositionRule = `\n:not([data-framer-generated]) > [data-framer-stack-content-wrapper] > *,\n:not([data-framer-generated]) > [data-framer-stack-content-wrapper] > [data-framer-component-type],\n:not([data-framer-generated]) > [data-framer-stack-content-wrapper] > [data-framer-legacy-stack-gap-enabled] > *,\n:not([data-framer-generated]) > [data-framer-stack-content-wrapper] > [data-framer-legacy-stack-gap-enabled] > [data-framer-component-type] {\n    position: relative;\n}`\n\n/**\n * Our isFlexboxGapSupported helper relies on DOM measurement, which is not 100%\n * reliable, it could return false while the user agent actually supports gap,\n * for example, if the document is not visible at the time the check runs.\n * Therefore we need to make sure if it determines gap is not supported, we\n * don't use the gap CSS at all, otherwise we end up with double gaps. We could\n * remove the unset rule when we have a proper way to test flexbox gap support.\n * see: https://github.com/framer/company/issues/23712\n * Since the gap variable is available for all stack descendants, we also need\n * to make sure `gap` is used for the ones that's using flexbox gap (has their\n * own --stack-native-gap set), that way nested stacks with different gap\n * settings would work as expected.\n */\nconst nativeStackGapRules: string[] = /* @__PURE__ */ (() => [\n\t`[data-framer-stack-content-wrapper][data-framer-stack-gap-enabled=\"true\"] {\n        row-gap: var(--stack-native-row-gap);\n        column-gap: var(--stack-native-column-gap);\n    }`,\n\t`.${flexboxGapNotSupportedClass} [data-framer-stack-content-wrapper][data-framer-stack-gap-enabled=\"true\"] {\n        row-gap: unset;\n        column-gap: unset;\n    }`,\n])()\n\nconst stackGapRule = /* @__PURE__ */ (() => `\n.${flexboxGapNotSupportedClass} [data-framer-legacy-stack-gap-enabled=\"true\"] > *, [data-framer-legacy-stack-gap-enabled=\"true\"][data-framer-stack-flexbox-gap=\"false\"] {\n    margin-top: calc(var(--stack-gap-y) / 2);\n    margin-bottom: calc(var(--stack-gap-y) / 2);\n    margin-right: calc(var(--stack-gap-x) / 2);\n    margin-left: calc(var(--stack-gap-x) / 2);\n}\n`)()\n\n/* This should take the language direction into account */\nconst stackDirectionRuleVertical = /* @__PURE__ */ (() => `\n.${flexboxGapNotSupportedClass}\n[data-framer-stack-direction-reverse=\"false\"]\n[data-framer-legacy-stack-gap-enabled=\"true\"]\n> *:first-child,\n[data-framer-stack-direction-reverse=\"false\"]\n[data-framer-legacy-stack-gap-enabled=\"true\"][data-framer-stack-flexbox-gap=\"false\"]\n> *:first-child,\n.${flexboxGapNotSupportedClass}\n[data-framer-stack-direction-reverse=\"true\"]\n[data-framer-legacy-stack-gap-enabled=\"true\"]\n> *:last-child,\n[data-framer-stack-direction-reverse=\"true\"]\n[data-framer-legacy-stack-gap-enabled=\"true\"][data-framer-stack-flexbox-gap=\"false\"]\n> *:last-child {\n    margin-top: 0;\n    margin-left: 0;\n}`)()\n\n/* This should take the language direction into account */\nconst stackDirectionRuleHorizontal = /* @__PURE__ */ (() => `\n.${flexboxGapNotSupportedClass}\n[data-framer-stack-direction-reverse=\"false\"]\n[data-framer-legacy-stack-gap-enabled=\"true\"]\n> *:last-child,\n[data-framer-stack-direction-reverse=\"false\"]\n[data-framer-legacy-stack-gap-enabled=\"true\"][data-framer-stack-flexbox-gap=\"false\"]\n> *:last-child,\n.${flexboxGapNotSupportedClass}\n[data-framer-stack-direction-reverse=\"true\"]\n[data-framer-legacy-stack-gap-enabled=\"true\"]\n> *:first-child,\n[data-framer-stack-direction-reverse=\"true\"]\n[data-framer-legacy-stack-gap-enabled=\"true\"][data-framer-stack-flexbox-gap=\"false\"]\n> *:first-child {\n    margin-right: 0;\n    margin-bottom: 0;\n}`)()\n\nconst stackCSSRules: string[] = /* @__PURE__ */ (() => [\n\tstackPositionRule,\n\tstackGapRule,\n\t...nativeStackGapRules,\n\tstackDirectionRuleVertical,\n\tstackDirectionRuleHorizontal,\n])()\n\nconst navigationCSSRules: string[] = [\n\t`\nNavigationContainer\n[data-framer-component-type=\"NavigationContainer\"] > *,\n[data-framer-component-type=\"NavigationContainer\"] > [data-framer-component-type] {\n    position: relative;\n}`,\n]\n\nconst scrollCSSRules: string[] = [\n\t`[data-framer-component-type=\"Scroll\"]::-webkit-scrollbar { display: none; }`,\n\t`[data-framer-component-type=\"ScrollContentWrapper\"] > * { position: relative; }`,\n]\n\nconst nativeScrollCSSRules: string[] = [\n\t`[data-framer-component-type=\"NativeScroll\"] { -webkit-overflow-scrolling: touch; }`,\n\t`[data-framer-component-type=\"NativeScroll\"] > * { position: relative; }`,\n\t`[data-framer-component-type=\"NativeScroll\"].direction-both { overflow-x: auto; overflow-y: auto; }`,\n\t`[data-framer-component-type=\"NativeScroll\"].direction-vertical { overflow-x: hidden; overflow-y: auto; }`,\n\t`[data-framer-component-type=\"NativeScroll\"].direction-horizontal { overflow-x: auto; overflow-y: hidden; }`,\n\t`[data-framer-component-type=\"NativeScroll\"].direction-vertical > * { width: 100% !important; }`,\n\t`[data-framer-component-type=\"NativeScroll\"].direction-horizontal > * { height: 100% !important; }`,\n\t`[data-framer-component-type=\"NativeScroll\"].scrollbar-hidden::-webkit-scrollbar { display: none; }`,\n]\n\nconst deviceComponentCSSRules: string[] = [\n\t`[data-framer-component-type=\"DeviceComponent\"].no-device > * { width: 100% !important; height: 100% !important; }`,\n]\n\nconst pageContentWrapperWrapperCSSRules: string[] = [\n\t`[data-framer-component-type=\"PageContentWrapper\"] > *, [data-framer-component-type=\"PageContentWrapper\"] > [data-framer-component-type] { position: relative; }`,\n]\n\nconst presenceCSS: string[] = [\n\t`[data-is-present=\"false\"], [data-is-present=\"false\"] * { pointer-events: none !important; }`,\n]\n\n/**\n * Framer Motion has a lengthy cross-fade when doing shared layout animations to cover up morphing\n * between the lead and follow layers. When building a lightbox, this is undesirable because we only\n * want to see the high resolution image for the entire enter AND exit animation.\n *\n * Using this !important rule allows us to achieve this without complicated/custom framer-motion\n * animation overrides - retaining the lead image at full opacity for its entire existence.\n */\nconst lightboxCSS: string[] = [`.framer-lightbox-container { opacity: 1 !important; pointer-events: auto !important; }`]\n\nconst cursorCSS: string[] = [\n\t`[data-framer-cursor=\"pointer\"] { cursor: pointer; }`,\n\t`[data-framer-cursor=\"grab\"] { cursor: grab; }`,\n\t`[data-framer-cursor=\"grab\"]:active { cursor: grabbing; }`,\n]\n\nconst frameCSS: string[] = [\n\t// Non-sites prototyping projects render with FrameWithMotion and Stacks. In\n\t// that context this rule ensures pointer events work in a specific way\n\t// designed for prototypes that we don't care about anymore in sites. We\n\t// can't remove it for legacy reasons, but sites will never render any\n\t// elements that are impacted by this rule. However, users can still use the\n\t// <Frame> api in code, at which point this rule will kick in. We don't\n\t// encourage the use of this API anymore, and bugs that come from this will\n\t// be the user's concern.\n\t`[data-framer-component-type=\"Frame\"] *, [data-framer-component-type=\"Stack\"] * { pointer-events: auto; }`,\n\t// This is fully deprecated, and will never exist in code that is generated\n\t// after 24/01/2023. There will be existing code-generated that depends on\n\t// this rule existing, so we can't remove it.\n\t`[data-framer-generated] * { pointer-events: unset }`,\n]\n\nconst resetCSS: string[] = [\n\t`[data-reset=\"button\"] {\n        border-width: 0;\n        padding: 0;\n        background: none;\n}`,\n]\n\nconst hideScrollbars: string[] = [\n\t`[data-hide-scrollbars=\"true\"]::-webkit-scrollbar { width: 0px; height: 0px; }`,\n\t`[data-hide-scrollbars=\"true\"]::-webkit-scrollbar-thumb { background: transparent; }`,\n\t`[data-hide-scrollbars=\"true\"] { scrollbar-width: none; }`,\n]\n\nexport const willChangeOverrideCSSVariable = \"--framer-will-change-override\"\n\n/**\n * Smart Components and Layout Templates are serialized to javascript and instances are rendered on\n * the canvas. Elements in these components may include effects, which need to be layerised in the\n * published site and preview, but not on the the canvas. This variable can be set to \"none\" on the\n * canvas, to disable layerisation.\n */\nexport const willChangeEffectOverrideCSSVariable = \"--framer-will-change-effect-override\"\n\nexport const willChangeFilterOverrideCSSVariable = \"--framer-will-change-filter-override\"\n\nconst anySafariVersion = \"(background: -webkit-named-image(i))\"\nconst safari16OrGreater = \"(grid-template-rows: subgrid)\"\n// See: https://webkit.org/blog/17333/webkit-features-in-safari-26-0/\nconst safari26OrGreater = \"(position-area: top right)\"\n\n// For Safari 15, if overflow hidden is set, and there is a border radius, the\n// element must be layer backed. Otherwise the border radius will be ignored by\n// child elements that are themselves layer backed. This can be some component\n// with will-change set, but also happens when children animate. Note this was\n// fixed with Safari 16. We use @supports rules to conservatively apply this\n// only to Safari <16.\nconst willChangeTransformRules = (isPreview: boolean) =>\n\tisPreview\n\t\t? [\n\t\t\t\t`body { ${willChangeOverrideCSSVariable}: none; }`,\n\t\t\t\t`@supports ${anySafariVersion} and (not ${safari16OrGreater}) { body { ${willChangeOverrideCSSVariable}: transform; } }`,\n\t\t\t]\n\t\t: [`body { ${willChangeOverrideCSSVariable}: none; ${willChangeEffectOverrideCSSVariable}: none; }`]\n\nconst willChangeFilterRules = (isPreview: boolean) =>\n\tisPreview\n\t\t? [\n\t\t\t\t`body { ${willChangeFilterOverrideCSSVariable}: none; }`,\n\t\t\t\t`@supports ${anySafariVersion} and (not ${safari26OrGreater}) { body { ${willChangeFilterOverrideCSSVariable}: filter; } }`,\n\t\t\t]\n\t\t: [`body { ${willChangeFilterOverrideCSSVariable}: none; }`]\n\n/**\n * Add propagation-blocking if we're not on the canvas. If we add this while on the canvas,\n * strange behaviour can appear in the Component panel, with the drag event being blocked.\n */\nconst frameCSSRules = (isPreview: boolean): string[] => {\n\treturn isPreview ? frameCSS : []\n}\n\nconst svgCSSRules: string[] = [`.svgContainer svg { display: block; }`]\n\n/** CSS custom property used for overflow: clip fallback. */\nexport const overflowClipFallbackCSSVariable = \"--overflow-clip-fallback\"\n\n/**\n * Safari 15 does not support the overflow: clip property, so when `overflow: clip` is not\n * supported, we set `--overflow-clip-fallback: hidden`, which is then used in:\n *\n * ```css\n * overflow: var(--overflow-clip-fallback, clip)\n * ```\n *\n * This allows us to remove this fallback later, without having to regenerate all the existing\n * modules, since they will default to `clip` if `--overflow-clip-fallback` is not set.\n *\n * Note: we use `@supports` to set `--overflow-clip-fallback` because `var()` fallbacks don't work\n * for invalid/unsupported values, only for undefined css variables, which means the following would\n * NOT work:\n *\n * ```css\n * --clip: clip\n * overflow: var(--clip, hidden)\n * ```\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_cascading_variables/Using_CSS_custom_properties#invalid_custom_properties\n */\nconst overflowClipFallbackCSSRules: string[] = /* @__PURE__ */ (() => [\n\t`@supports (not (overflow: clip)) {\n        :root { ${overflowClipFallbackCSSVariable}: hidden; }\n    }`,\n])()\n\nexport const oneIfCornerShapeSupportedCSSVariable = \"--one-if-corner-shape-supported\"\n\nconst cornerShapeCSSRules: string[] = /* @__PURE__ */ (() => [\n\t`@supports (corner-shape: superellipse(2)) { :root { ${oneIfCornerShapeSupportedCSSVariable}: 1 } }`,\n])()\n\nconst combineCSSRules = (isPreview: boolean): string[] => [\n\t...willChangeTransformRules(isPreview),\n\t...willChangeFilterRules(isPreview),\n\t...componentCSSRules,\n\t...textCSSRules,\n\t...richTextCSSRules,\n\t...deprecatedRichTextCSSRules,\n\t...stackCSSRules,\n\t...navigationCSSRules,\n\t...scrollCSSRules,\n\t...nativeScrollCSSRules,\n\t...pageContentWrapperWrapperCSSRules,\n\t...deviceComponentCSSRules,\n\t...presenceCSS,\n\t...cursorCSS,\n\t...frameCSSRules(isPreview),\n\t...svgCSSRules,\n\t...resetCSS,\n\t...hideScrollbars,\n\t...overflowClipFallbackCSSRules,\n\t...lightboxCSS,\n\t...safari16TextTruncationFix,\n\t...cornerShapeCSSRules,\n]\n\n// Only generate preview and non preview styles once\n/** @internal */\nexport const combinedCSSRules = /* @__PURE__ */ combineCSSRules(false)\n\n/** @internal */\nexport const combinedCSSRulesForPreview = /* @__PURE__ */ combineCSSRules(true)\n\nexport function getCombinedCSSRules() {\n\treturn RenderTarget.current() === RenderTarget.preview ? combinedCSSRulesForPreview : combinedCSSRules\n}\n\nexport function withLibraryCSS<T extends object>(Component: React.ComponentType<T>) {\n\treturn withCSS(Component, getCombinedCSSRules, \"framer-lib-combinedCSSRules\")\n}\n\n/** @internal */\nexport function injectComponentCSSRulesWithSheet(sheet: CSSStyleSheet, cache: Set<string>) {\n\tconst styles = RenderTarget.current() === RenderTarget.preview ? combinedCSSRulesForPreview : combinedCSSRules\n\tfor (const rule of styles) {\n\t\tCSS.injectCSSRule(rule, sheet, cache)\n\t}\n}\n", "import * as environment from \"@framerjs/shared/src/environment.ts\"\nimport { RenderTarget } from \"../types/RenderEnvironment.ts\"\n\nconst isChrome = /* @__PURE__ */ environment.isChrome()\n\ninterface LayoutHintDataProps {\n\t\"data-framer-layout-hint-center-x\"?: boolean\n\t\"data-framer-layout-hint-center-y\"?: boolean\n}\n\nexport function collectLayoutHintDataProps(props: LayoutHintDataProps, center: boolean | \"x\" | \"y\" | undefined) {\n\tprops[\"data-framer-layout-hint-center-x\"] = center === true || center === \"x\" ? true : undefined\n\tprops[\"data-framer-layout-hint-center-y\"] = center === true || center === \"y\" ? true : undefined\n}\n\n/**\n * Returns a set of layout hint data props, which will be used to correctly\n * infer the correct translation offset when measuring DOM nodes in Chrome.\n *\n * Important: To be used ONLY when a transform template is set. Transform\n * templates use a -50% translation to center elements. When measuring DOM\n * nodes, we use the resulting computed style transform to differentiate between\n * a translation (transform) offset and a position (layout) offset. When\n * reporting the -50% value in the resulting transform matrix, Chrome will\n * report the 50% as based on the _painted_ rect of the element, but will\n * actually use the actual computed width, which might not be the same as the\n * painted width, when determining where to paint the element. To get to the\n * \"real\" offset, we use the layout hints to tell the measuring code that it\n * should just throw away the information reported in the transform matrix and\n * make its own calculation based on the computed size.\n *\n * This function has no effect outside of Chrome or the Canvas RenderTarget.\n *\n * @internal\n * @param center\n */\n\nexport function layoutHintDataPropsForCenter(center: boolean | \"x\" | \"y\" | undefined) {\n\tconst props: LayoutHintDataProps = {}\n\n\tif (!center || !isChrome || RenderTarget.current() !== RenderTarget.canvas) {\n\t\treturn props\n\t}\n\n\tcollectLayoutHintDataProps(props, center)\n\n\treturn props\n}\n", "/** Copy of nodeIDFromString() in Vekter NodeID.ts module */\nexport function nodeIdFromString(str: string): string {\n\treturn str.replace(/^id_/u, \"\").replace(/\\\\/gu, \"\")\n}\n", "import React from \"react\"\n\n/**\n * Modifies children to forward overrides of design components to their childern.\n */\ninterface ProcessOverrideForwardingReturnType {\n\tprops: any\n\tchildren: React.ReactNode | undefined\n}\n\nexport function processOverrideForwarding(props: any, children?: React.ReactNode): ProcessOverrideForwardingReturnType {\n\tif (!children) {\n\t\tchildren = props.children\n\t\tif (!children) return { props, children }\n\t}\n\n\tconst _forwardedOverrides: { [key: string]: any } | undefined = props._forwardedOverrides\n\n\tif (!_forwardedOverrides) return { props, children }\n\n\tchildren = React.Children.map(children, (child: React.ReactNode) => {\n\t\tif (!React.isValidElement(child)) return child\n\t\treturn React.cloneElement(child as any, { _forwardedOverrides })\n\t})\n\n\treturn { props, children }\n}\n", "/** @public */\nexport function transformTemplate(center?: boolean | \"x\" | \"y\") {\n\treturn (_: any, generated: string) => {\n\t\tif (center === true) {\n\t\t\treturn `translate(-50%, -50%) ${generated}`\n\t\t} else {\n\t\t\tif (center === \"x\") {\n\t\t\t\treturn `translateX(-50%) ${generated}`\n\t\t\t} else if (center === \"y\") {\n\t\t\t\treturn `translateY(-50%) ${generated}`\n\t\t\t}\n\t\t}\n\t\treturn generated || \"none\"\n\t}\n}\n", "import type { MotionProps } from \"framer-motion\"\nimport { useContext, useMemo } from \"react\"\nimport { LayoutIdContext } from \"../../components/AnimateLayout/LayoutIdContext.tsx\"\n\ninterface UseMagicMotionProps {\n\tlayoutId?: string\n\t/**\n\t * An id to use as the basis of generated layout ids. This will usually be\n\t * the node id. If a layoutIdKey is not provided we will not attempt to\n\t * generate a layoutId.\n\t */\n\tlayoutIdKey?: string\n\tname?: string\n\tduplicatedFrom?: string[]\n\t__fromCodeComponentNode?: boolean\n\tdrag?: MotionProps[\"drag\"]\n}\n\n/**\n * @internal\n */\nexport function useLayoutId(\n\tprops: UseMagicMotionProps,\n\t{ specificLayoutId, postfix }: { specificLayoutId?: string; postfix?: string } = {},\n): string | undefined {\n\tconst { name, layoutIdKey, duplicatedFrom, __fromCodeComponentNode = false, drag } = props\n\tconst { getLayoutId, enabled } = useContext(LayoutIdContext)\n\n\treturn useMemo<string | undefined>(() => {\n\t\t// If automatic layoutId's are disabled, but a Frame is used in code, and provides a layoutId, always use it.\n\t\tif (!enabled) return props.layoutId\n\n\t\tconst existingLayoutId = specificLayoutId || props.layoutId\n\n\t\t// If no existing layoutId is provided, we do not generate a layoutId if:\n\t\t// - No id is provided (a requirement for generating layoutIds)\n\t\t// - The layer is not draggable, because magic motion and dragging are not supported (drag)\n\t\t// - The layer should not be animated with magic motion (layoutIdKey)\n\t\t// - The layer is the direct child of a ComponentContainer (Scroll/Page should always use specificLayoutId)\n\t\tif (!existingLayoutId) {\n\t\t\tif (drag || !layoutIdKey || __fromCodeComponentNode) return undefined\n\t\t}\n\n\t\t// If provided, use an existing layoutId, otherwise generate one with the LayoutIdContext.\n\t\tconst layoutIdCandidate = existingLayoutId || getLayoutId({ id: layoutIdKey, name, duplicatedFrom })\n\n\t\t// If for some reason we can't generate a layoutId, don't provide a layoutId.\n\t\tif (!layoutIdCandidate) return undefined\n\n\t\t// If we have provided a postfix, postfix whatever layoutId we've decided to use with the string, and return it.\n\t\treturn postfix ? `${layoutIdCandidate}-${postfix}` : layoutIdCandidate\n\t}, [enabled]) // Must return a stable value as layoutIds must be stable between all renders.\n}\n", "import React, { useCallback, useContext, useMemo, useRef } from \"react\"\nimport { assert } from \"../../utils/assert.ts\"\n\n/**\n * @internal\n */\nexport interface GetLayoutId {\n\tid?: string\n\tname?: string\n\tduplicatedFrom?: string[]\n}\n\n/**\n * @internal\n */\nexport const LayoutIdContext = /* @__PURE__ */ React.createContext<{\n\tgetLayoutId: (args: GetLayoutId) => string | null\n\tpersistLayoutIdCache: () => void\n\t/**\n\t * Sometimes we overwrite getLayoutId to always return null, to prevent\n\t * layoutId generation for descendents. If we want to re-enable that\n\t * layoutId generation later in the tree, we need a reference to the\n\t * original function to restore.\n\t */\n\ttop: boolean\n\tenabled?: boolean\n}>({\n\tgetLayoutId: args => null,\n\tpersistLayoutIdCache: () => {},\n\ttop: false,\n\tenabled: true,\n})\n\ninterface Cache {\n\tbyId: Record<string, string>\n\tbyName: Record<string, string>\n\tbyLastId: Record<string, string>\n\tbyPossibleId: Record<string, string>\n\tbyLastName: Record<string, string>\n\tbyLayoutId: Record<string, string>\n\tcount: {\n\t\tbyId: Record<string, number>\n\t\tbyName: Record<string, number>\n\t}\n}\n\n/**\n * @internal\n */\nexport function LayoutIdProvider({ children }: { children: React.ReactNode }) {\n\tconst context = useContext(LayoutIdContext)\n\n\t// Since Code Components on the canvas can use Navigation, we need to ensure\n\t// that only the root LayoutIdContext is generating layoutIds so that the\n\t// cache is shared across all screens.\n\tif (context.top) return <>{children}</>\n\n\t// biome-ignore lint/correctness/useHookAtTopLevel: `context.top` is stable\n\tconst cache = useRef<Cache>({\n\t\t// When we provide a layoutId for a node based on it's first\n\t\t// duplicatedFrom id, we save it's layoutId mapped to it's actual id.\n\t\t// Future screen's nodes will check this cache first, to see if they've\n\t\t// previously been assigned a layoutId, or if any of there other\n\t\t// duplicatedFrom ids matched a node that was previously assigned a\n\t\t// layoutId.\n\t\tbyId: {},\n\t\tbyName: {},\n\t\t// When we navigate from screens that were duplicated from a future\n\t\t// screen, to that future screen, we want to do a reverse lookup on the\n\t\t// last duplicatedFrom id, rather than the id. We need to keep them\n\t\t// separate so they don't overlap.\n\t\tbyLastId: {},\n\t\tbyPossibleId: {},\n\t\tbyLastName: {},\n\t\tbyLayoutId: {},\n\t\t// When we don't have a cached layoutId for all duplicatedFrom ids, we\n\t\t// need to increment and save it so that we don't create clashing\n\t\t// layoutIds. We also need to reset name counts between screens, so we\n\t\t// record those separately.\n\t\tcount: {\n\t\t\tbyId: {},\n\t\t\tbyName: {},\n\t\t},\n\t})\n\n\t// biome-ignore lint/correctness/useHookAtTopLevel: `context.top` is stable\n\tconst screen = useRef<Omit<Cache, \"count\">>({\n\t\tbyId: {},\n\t\tbyName: {},\n\t\tbyLastId: {},\n\t\tbyPossibleId: {},\n\t\tbyLastName: {},\n\t\tbyLayoutId: {},\n\t})\n\n\t// Keep track of which layoutIds have been used on the current screen so\n\t// that we avoid reassigning them, and instead, use other methods to\n\t// generate a unique id.\n\t// biome-ignore lint/correctness/useHookAtTopLevel: `context.top` is stable\n\tconst usedIds = useRef(new Set<string>()).current\n\n\t// This function is quite abstract so I've done my best to annotate why\n\t// checks are happening. A lot of the complexity comes from handling named\n\t// and unnamed layers differently.\n\t// biome-ignore lint/correctness/useHookAtTopLevel: `context.top` is stable\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: has been like this for 4 years\n\tconst getLayoutId = useCallback(({ id, name, duplicatedFrom }: GetLayoutId) => {\n\t\t// Code components that use Frame's should not receive a layout id\n\t\t// from our context. However this will be bypassed if end-users add an\n\t\t// id to their Frame in code.\n\t\tif (!id) return null\n\t\tconst cacheKey = name ? \"byName\" : \"byId\"\n\n\t\t// If we've previously recorded an layout id for this node, reuse it\n\t\t// and return early.\n\t\tconst previousId = cache.current[cacheKey][id]\n\t\tif (previousId) return previousId\n\n\t\t// If the node is an original node (hasn't been duplicated from another\n\t\t// node), we use it's name or id, unless it's name or id was already\n\t\t// used on this screen, or used by a node that wasn't last duplicated\n\t\t// from this node on the previous screen (suggesting another node on\n\t\t// this screen will need to use this id in a future call).\n\t\tconst nodeIdentifier = name || id\n\t\tif (\n\t\t\t!duplicatedFrom &&\n\t\t\t!usedIds.has(nodeIdentifier) &&\n\t\t\t(!cache.current.byLayoutId[nodeIdentifier] || cache.current.byLayoutId[nodeIdentifier] === nodeIdentifier)\n\t\t) {\n\t\t\tif (cache.current.count[cacheKey][nodeIdentifier] === undefined) {\n\t\t\t\tcache.current.count[cacheKey][nodeIdentifier] = 0\n\t\t\t\tcache.current.byLayoutId[nodeIdentifier] = nodeIdentifier\n\t\t\t\tscreen.current[cacheKey][id] = nodeIdentifier\n\t\t\t}\n\n\t\t\tusedIds.add(nodeIdentifier)\n\t\t\treturn nodeIdentifier\n\t\t}\n\n\t\t// If a node is duplicated, check if an layout id was assigned to it\n\t\t// on the last screen. Use that layout id if it's not already been\n\t\t// used on this screen. This ensures that nodes duplicated from a\n\t\t// specific layer on one screen, preserve their connection even if they\n\t\t// are in a different hierarchical order on the current screen. This is\n\t\t// not relevant for design components since their layers are always in\n\t\t// the same order. We also check for matches against `byLastId`, but\n\t\t// only use them after we explicitly check `id`.\n\t\tlet possibleMatch: [string, string] | undefined = undefined\n\t\tif (duplicatedFrom?.length) {\n\t\t\tfor (let index = duplicatedFrom.length - 1; index >= 0; index--) {\n\t\t\t\tconst duplicatedId = duplicatedFrom[index]\n\t\t\t\tassert(!!duplicatedId, `duplicatedId must be defined`)\n\t\t\t\tconst match = cache.current[cacheKey][duplicatedId]\n\t\t\t\tconst byLastIdMatch = cache.current.byLastId[duplicatedId]\n\n\t\t\t\t// In the event that no match is found for the duplicatedFrom id\n\t\t\t\t// in the `byId` or `byName` cache, it's possible we will need\n\t\t\t\t// to loop through the duplicatedFrom ids again, to check if\n\t\t\t\t// there is a match against the `byLastId` cache. Rather than\n\t\t\t\t// performing that loop again, we can save the first successful\n\t\t\t\t// match here, and use it when it's the correct option later.\n\t\t\t\t// This is safe because we will only use this match if there is\n\t\t\t\t// no match against `byId` or `byName`, meaning we will always\n\t\t\t\t// have looped through all of the duplicatedFrom ids.\n\t\t\t\tif (byLastIdMatch && !possibleMatch) {\n\t\t\t\t\tconst matchedLayoutId = cache.current.byLayoutId[byLastIdMatch]\n\t\t\t\t\tconst shouldUseNamedLastIdMatch = !matchedLayoutId || matchedLayoutId === name\n\n\t\t\t\t\tif (byLastIdMatch && !usedIds.has(byLastIdMatch) && (name ? shouldUseNamedLastIdMatch : true)) {\n\t\t\t\t\t\tpossibleMatch = [byLastIdMatch, duplicatedId]\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// If the match from the previous screen is a name match, ensure it is was assigned to the exact same name.\n\t\t\t\tconst previousLayoutId = match ? cache.current.byLayoutId[match] : undefined\n\t\t\t\tconst shouldUseNamedMatch = !previousLayoutId || previousLayoutId === name\n\n\t\t\t\tif (match && !usedIds.has(match) && (name ? shouldUseNamedMatch : true)) {\n\t\t\t\t\tscreen.current[cacheKey][id] = match\n\t\t\t\t\tscreen.current.byLastId[duplicatedId] = match\n\n\t\t\t\t\tusedIds.add(match)\n\t\t\t\t\treturn match\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// In cases where we're starting on a screen that uses frames duplicated\n\t\t// from a future screen, when we arrive on the future screen, we need to\n\t\t// make sure we preserve that connection. This handles direct\n\t\t// relationships. For example starting on a frame that was duplicated\n\t\t// directly from the previous frame, and transitioning to that previous\n\t\t// frame.\n\t\tconst last = cache.current.byLastId[id]\n\t\tif (last && !usedIds.has(last)) {\n\t\t\tusedIds.add(last)\n\t\t\tscreen.current.byId[id] = last\n\t\t\treturn last\n\t\t}\n\n\t\t// If we set a possible match by checking duplicatedFrom ids against\n\t\t// `byLastId`, and we weren't able to find a match against the `byId` or\n\t\t// `byName`, or by directly looking up the node's id against `byLastId`,\n\t\t// use a possible match if it was set.\n\t\tif (possibleMatch) {\n\t\t\tconst [match, duplicatedId] = possibleMatch\n\n\t\t\tscreen.current[cacheKey][id] = match\n\t\t\tscreen.current.byLastId[duplicatedId] = match\n\n\t\t\tusedIds.add(match)\n\t\t\treturn match\n\t\t}\n\n\t\t// In cases where we're starting on a screen that uses frames duplicated\n\t\t// from a future screen, when we arrive on the future screen, we need to\n\t\t// make sure we preserve that connection. This handles indirect\n\t\t// relationships. For example starting on the last frame duplicated many\n\t\t// times from an initial frame, and transitioning directly to that\n\t\t// initial frame.\n\t\tconst possible = cache.current.byPossibleId[id]\n\t\tif (possible && !usedIds.has(possible)) {\n\t\t\tusedIds.add(possible)\n\t\t\tscreen.current.byId[id] = possible\n\t\t\treturn possible\n\t\t}\n\n\t\tconst rootDuplicatedId = duplicatedFrom?.[0]\n\n\t\t// If a node hasn't been assigned a layout id on a previous screen,\n\t\t// or if that layout id has already been used, or if this is the\n\t\t// first screen, generate a unique layout id by incrementing a\n\t\t// counter for that name or duplicatedId.\n\t\tconst identifier = name || rootDuplicatedId || id\n\t\tconst value = (cache.current.count[cacheKey][identifier] ?? -1) + 1\n\n\t\tconst { layoutId, value: nextValue } = nextLayoutId(identifier, value, usedIds)\n\n\t\tcache.current.count[cacheKey][identifier] = nextValue\n\t\tscreen.current[cacheKey][id] = layoutId\n\n\t\tif (duplicatedFrom?.length) {\n\t\t\t// TODO: Should name use it's own map?\n\t\t\tif (!name) {\n\t\t\t\tconst lastId = duplicatedFrom[duplicatedFrom.length - 1]\n\t\t\t\tif (lastId) {\n\t\t\t\t\tscreen.current.byLastId[lastId] = layoutId\n\t\t\t\t}\n\n\t\t\t\tif (duplicatedFrom.length > 1) {\n\t\t\t\t\t// Skipping the most recent duplicatedFrom, and only setting\n\t\t\t\t\t// it if there isn't already one set. This isn't a perfect\n\t\t\t\t\t// heuristic since it allows layout hierarchy to influence\n\t\t\t\t\t// matches, since we have to assign on a\n\t\t\t\t\t// first-come-first-serve basis.\n\t\t\t\t\tfor (let index = 0; index < duplicatedFrom.length - 1; index++) {\n\t\t\t\t\t\tconst possibleId = duplicatedFrom[index]\n\t\t\t\t\t\tif (possibleId === undefined) continue\n\t\t\t\t\t\tif (!screen.current.byPossibleId[possibleId]) {\n\t\t\t\t\t\t\tscreen.current.byPossibleId[possibleId] = layoutId\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tscreen.current.byLayoutId[layoutId] = nodeIdentifier\n\n\t\tusedIds.add(layoutId)\n\n\t\treturn layoutId\n\t}, [])\n\n\t// biome-ignore lint/correctness/useHookAtTopLevel: `context.top` is stable\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: has been like this for 4 years\n\tconst persistLayoutIdCache = useCallback(() => {\n\t\tcache.current = {\n\t\t\tbyId: {\n\t\t\t\t...cache.current.byId,\n\t\t\t\t...screen.current.byId,\n\t\t\t},\n\t\t\tbyLastId: {\n\t\t\t\t...cache.current.byLastId,\n\t\t\t\t...screen.current.byLastId,\n\t\t\t},\n\t\t\tbyPossibleId: {\n\t\t\t\t...cache.current.byPossibleId,\n\t\t\t\t...screen.current.byPossibleId,\n\t\t\t},\n\t\t\tbyName: {\n\t\t\t\t...cache.current.byName,\n\t\t\t\t...screen.current.byName,\n\t\t\t},\n\t\t\tbyLastName: { ...cache.current.byLastName, ...screen.current.byLastName },\n\t\t\tbyLayoutId: { ...cache.current.byLayoutId, ...screen.current.byLayoutId },\n\n\t\t\t// Unlike the count.byId, we need to reset the count.byName because\n\t\t\t// named layers might not have duplicatedFrom ids (e.g. imported\n\t\t\t// from Figma). When we can use duplicatedFrom ids to check if an id\n\t\t\t// was assigned on a previous screen, we don't increment the count,\n\t\t\t// which means that the count only increments for new items, and\n\t\t\t// only increments on a new screen if the node is new. Since named\n\t\t\t// layers need to always match in some way between screens, we reset\n\t\t\t// the count so that the second named layer on a second screen is\n\t\t\t// always name-1 if it doesn't have any duplicatedFrom ids.\n\t\t\tcount: {\n\t\t\t\t...cache.current.count,\n\t\t\t\tbyName: {},\n\t\t\t},\n\t\t}\n\n\t\tscreen.current = {\n\t\t\tbyId: {},\n\t\t\tbyName: {},\n\t\t\tbyLastId: {},\n\t\t\tbyPossibleId: {},\n\t\t\tbyLastName: {},\n\t\t\tbyLayoutId: {},\n\t\t}\n\n\t\tusedIds.clear()\n\t}, [])\n\n\t// Bind the context value to a ref so that it doesn't change between\n\t// renders, which cases all subscribed descendants to update.\n\t// biome-ignore lint/correctness/useHookAtTopLevel: `context.top` is stable\n\tconst contextValue = useRef({\n\t\tgetLayoutId,\n\t\tpersistLayoutIdCache,\n\t\ttop: true,\n\t\tenabled: true,\n\t}).current\n\n\treturn <LayoutIdContext.Provider value={contextValue}>{children}</LayoutIdContext.Provider>\n}\n\nfunction nextLayoutId(identifier: string, initialValue: number, usedIds: Set<string>) {\n\tlet value = initialValue\n\t// We expect 0 to be falsy here so that generated ids match with\n\t// original ids.\n\tlet layoutId = value ? `${identifier}-${value}` : identifier\n\twhile (usedIds.has(layoutId)) {\n\t\tvalue++\n\t\tlayoutId = `${identifier}-${value}`\n\t}\n\n\treturn { layoutId, value }\n}\n\n/**\n * Enable or disable the automatic generation of layout ids for canvas layers.\n * By default layout ids are generated for all layers created on the Framer\n * canvas. However, layout ids are not generated for any layer that is a\n * descendant of a code component. Sometimes you will want to enable layout id\n * generation for descendants of your code components when they use children,\n * slots, or import design components, and you want those layers to animate with\n * magic motion transitions.\n *\n * You can enable that behavior by wrapping your code component like this\n * ```typescript\n * <AutomaticLayoutIds enabled>\n *  <YourComponent/>\n * </AutomaticLayoutIds>\n * ```\n * @public\n */\nexport function AutomaticLayoutIds({ enabled = true, ...props }: React.PropsWithChildren<{ enabled?: boolean }>) {\n\tconst context = useContext(LayoutIdContext)\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: has been like this for 4 years\n\tconst contextValue = useMemo(() => {\n\t\treturn {\n\t\t\t...context,\n\t\t\tenabled,\n\t\t}\n\t}, [enabled])\n\n\treturn <LayoutIdContext.Provider {...props} value={contextValue} />\n}\n", "import type { RefObject } from \"react\"\nimport { useContext } from \"react\"\nimport { useIsomorphicLayoutEffect } from \"../../useIsomorphicLayoutEffect.ts\"\nimport { runtime } from \"../../utils/runtimeInjection.ts\"\nimport { ComponentContainerContext } from \"../presentation/ComponentContainerContext.tsx\"\nimport { RenderTarget } from \"../types/RenderEnvironment.ts\"\nimport { getMeasurableCodeComponentChildren } from \"./getMeasurableCodeComponentChildren.ts\"\nimport { nodeIdFromString } from \"./nodeIdFromString.ts\"\n\n// Returns all children that need to be considered for layout measurements of\n// this node. This is usually used to skip over invisible, or border elements\n// since they don't contribute to the layout of the node. Elements returned from\n// this function will also be used in calculating the content size for \"Fit Content\".\ntype GetChildrenFn = (element: Element) => Element[]\n\n/**\n * Adds the element and its children to the layout measure queue\n *\n * @internal\n */\nexport function useMeasureLayout(\n\tprops: { id?: string; visible?: boolean; _needsMeasure?: boolean },\n\tref: RefObject<Element | null>,\n\tgetChildren: GetChildrenFn = () => [],\n\toptions: { skipHook?: boolean } = {},\n) {\n\tconst { id, visible, _needsMeasure } = props\n\tconst { skipHook = false } = options\n\tconst inCodeComponent = useContext(ComponentContainerContext)\n\tconst onCanvas = RenderTarget.current() === RenderTarget.canvas\n\n\tuseIsomorphicLayoutEffect(() => {\n\t\t// must be on the canvas, not in a code component, and must not be\n\t\t// explicitly skipped through skipHook\n\t\tif (!onCanvas || inCodeComponent || skipHook) {\n\t\t\treturn\n\t\t}\n\n\t\t// must have a valid ref, id, be visible and need measure\n\t\tif (!(ref.current && id && visible && _needsMeasure)) {\n\t\t\treturn\n\t\t}\n\n\t\truntime.queueMeasureRequest(nodeIdFromString(id), ref.current, getChildren(ref.current))\n\t})\n}\n\n/**\n * Attempts to find the closest component container ancestor to a reference\n * element, and add a layout measure request for it. Used when an element inside\n * a code component has caused a layout shift outside of the normal render loop\n * (such as when fonts load), and needs to trigger a re-measure of its container.\n *\n * @param element\n * @internal\n */\nexport function measureClosestComponentContainer(element: Element) {\n\tconst container = element.closest(\"[data-framer-component-container]\")\n\tif (!container) return\n\n\truntime.queueMeasureRequest(nodeIdFromString(container.id), container, getMeasurableCodeComponentChildren(container))\n}\n", "import { useEffect, useLayoutEffect } from \"react\"\n\n/**\n * Swaps `useLayoutEffect` for `useEffect` on the server to avoid React warnings.\n * NOTE! The effect won't run on the server.\n */\nexport const useIsomorphicLayoutEffect = typeof document !== \"undefined\" ? useLayoutEffect : useEffect\n", "import React from \"react\"\n\n/**\n * React context used to determine if we're inside a code component.\n * @internal\n */\nexport const ComponentContainerContext = /* @__PURE__ */ React.createContext(false)\n", "import { isBrowser } from \"@framerjs/shared/src/environment.ts\"\nimport React, { useEffect } from \"react\"\nimport { useForceUpdate } from \"../../modules/useForceUpdate.ts\"\nimport type { Size } from \"../../render/types/Size.ts\"\nimport { useIsomorphicLayoutEffect } from \"../../useIsomorphicLayoutEffect.ts\"\n\nconst DEFAULT_SIZE = 200\n\ntype ObserverCallback = (size: Size) => void\nclass SharedObserver {\n\t// Note: we don\u2019t want to use #-style private fields here because (as of esbuild 0.17)\n\t// they leave non-tree-shakeable symbols in the bundle: https://framer-team.slack.com/archives/C05V49Q4NJ2/p1715653184830179\n\tprivate sharedResizeObserver\n\tprivate callbacks = new WeakMap<Element, ObserverCallback>()\n\n\tconstructor() {\n\t\tthis.sharedResizeObserver = new ResizeObserver(this.updateResizedElements.bind(this))\n\t}\n\n\tprivate updateResizedElements(entries: ResizeObserverEntry[]) {\n\t\tfor (const entry of entries) {\n\t\t\tconst callbackForElement = this.callbacks.get(entry.target)\n\t\t\tif (callbackForElement) callbackForElement(entry.contentRect)\n\t\t}\n\t}\n\n\tobserveElementWithCallback(element: Element, callback: ObserverCallback) {\n\t\tthis.sharedResizeObserver.observe(element)\n\t\tthis.callbacks.set(element, callback)\n\t}\n\n\tunobserve(element: Element) {\n\t\tthis.sharedResizeObserver.unobserve(element)\n\t\tthis.callbacks.delete(element)\n\t}\n}\n\nconst sharedResizeObserver = /* @__PURE__ */ (() => (isBrowser() ? new SharedObserver() : undefined))()\n\nexport function useRerenderOnResize(ref: React.RefObject<Element> | undefined): void {\n\tconst update = useForceUpdate()\n\n\tuseEffect(() => {\n\t\tconst element = ref?.current\n\t\tif (!element) return\n\t\tsharedResizeObserver?.observeElementWithCallback(ref.current, update)\n\n\t\treturn () => {\n\t\t\tsharedResizeObserver?.unobserve(element)\n\t\t}\n\t}, [ref, update])\n}\n\n/**\n * Uses a globally shared resize observer, and returns an updated\n * size object when the element's size changes. This is the recommended way to\n * use a Resize Observer: https://github.com/WICG/resize-observer/issues/59.\n * @deprecated only used in the deprecated `withMeasuredSize` HoC\n */\nfunction useMeasuredSize(ref: React.MutableRefObject<HTMLDivElement | null>) {\n\tconst forceUpdate = useForceUpdate()\n\tconst size = React.useRef<Size | null>(null)\n\n\tfunction updateSize(newSize: Size) {\n\t\t// Ignore 0 entries, usually indicative of an element that is hidden, or\n\t\t// nested inside a hidden element. This is common on the canvas where\n\t\t// elements out of the viewport will be contained in an element with\n\t\t// `display: none`. We could technically check the bounding client rect\n\t\t// to make sure the element isn't visible, but that would force a style\n\t\t// recalc and negate any performance benefits of skipping the update\n\t\tif (newSize.width === 0 && newSize.height === 0) return\n\n\t\tif (!size.current || newSize.height !== size.current.height || newSize.width !== size.current.width) {\n\t\t\tsize.current = { width: newSize.width, height: newSize.height }\n\t\t\t// This may need startTransition to avoid synchronous, blocking re-renders.\n\t\t\t// However, this hook is deprecated. Let's not modify the behavior.\n\t\t\t// eslint-disable-next-line framer-studio/no-setstate-without-transition -- deprecated hook\n\t\t\tforceUpdate()\n\t\t}\n\t}\n\n\t// On mount, immediately measure and set a size. This will defer paint until\n\t// no more updates are scheduled. Additionally add our element to the shared\n\t// ResizeObserver with a callback to perform when the element resizes.\n\t// Finally, remove the element from the observer when the component is unmounted.\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: has always been this way\n\tuseIsomorphicLayoutEffect(() => {\n\t\tif (!ref.current) return\n\t\tconst { offsetWidth, offsetHeight } = ref.current\n\n\t\t// Defer paint until initial size is added.\n\t\tupdateSize({\n\t\t\twidth: offsetWidth,\n\t\t\theight: offsetHeight,\n\t\t})\n\n\t\t// Resize observer will race to add the initial size, but since the size\n\t\t// is set above, it won't trigger a render on mount since it should\n\t\t// match the measured size. Future executions of the callback will\n\t\t// trigger renders if the size changes.\n\t\t// biome-ignore lint/style/noNonNullAssertion: we know it exists\n\t\tsharedResizeObserver!.observeElementWithCallback(ref.current, updateSize)\n\n\t\treturn () => {\n\t\t\tif (!ref.current) return\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: we know it exists\n\t\t\tsharedResizeObserver!.unobserve(ref.current)\n\t\t}\n\t}, [])\n\n\treturn size.current\n}\n\n/**\n * @internal\n */\nexport const SIZE_COMPATIBILITY_WRAPPER_ATTRIBUTE = \"data-framer-size-compatibility-wrapper\"\n\ninterface OptionalSizeProps {\n\twidth?: number | string\n\theight?: number | string\n}\n\n/**\n * A HoC to enhance code components that depend on being rendered with exact\n * width and height props with width and height props determined via a shared\n * ResizeObserver.\n *\n * @FIXME Do not depend on this HoC. The current plan is to turn it into a no-op\n * after a deprecation period. If we need to provide this functionality to\n * customers after we migrate to a modules-first ecosystem, then we can provide\n * a new copy of this HoC or the `useMeasuredSize` hook, and recommend use\n * without a module version, allowing everyone to share the same ResizeObserver\n * on a single canvas.\n *\n * @internal\n */\nexport const withMeasuredSize =\n\t<T extends OptionalSizeProps>(Component: React.ComponentType<T>) =>\n\t(props: T) => {\n\t\tconst ref = React.useRef<HTMLDivElement>(null)\n\t\tconst size = useMeasuredSize(ref)\n\t\tconst dataProps = { [SIZE_COMPATIBILITY_WRAPPER_ATTRIBUTE]: true }\n\n\t\t// The initial render will be delayed until the measured size is available.\n\t\tconst shouldRender = Boolean(size)\n\n\t\t// In the export case, we'll sometimes be provided with explicit width and\n\t\t// height to use as fallback. This is a temporary measure and will only\n\t\t// happen when the used width / height is a fixed number. This code should\n\t\t// be removed once we're no longer using `renderToStaticMarkup` for export.\n\t\tconst fallbackWidth = props.width ?? DEFAULT_SIZE\n\t\tconst fallbackHeight = props.height ?? DEFAULT_SIZE\n\n\t\treturn (\n\t\t\t<div style={{ width: \"100%\", height: \"100%\", pointerEvents: \"none\" }} ref={ref} {...dataProps}>\n\t\t\t\t{shouldRender && (\n\t\t\t\t\t<Component {...props} width={size?.width ?? fallbackWidth} height={size?.height ?? fallbackHeight} />\n\t\t\t\t)}\n\t\t\t</div>\n\t\t)\n\t}\n", "import React from \"react\"\n\n/**\n * @public\n */\nexport function useForceUpdate() {\n\tconst [_, setForcedRenderCount] = React.useState(0)\n\n\t// startTransition is disabled here because usage of `useForceUpdate`\n\t// without startTransition Is linted independently.\n\t// eslint-disable-next-line framer-studio/no-setstate-without-transition\n\treturn React.useCallback(() => setForcedRenderCount(v => v + 1), [])\n}\n", "import { SIZE_COMPATIBILITY_WRAPPER_ATTRIBUTE } from \"../../components/hoc/withMeasuredSize.tsx\"\n\n/**\n * @internal\n *\n * Returns a plain array of references to all children, which should be\n * considered for content size calculations on this node (e.g. when running \"Fit\n * Content\" on it)\n *\n * @param element the element of the component container\n */\nexport function getMeasurableCodeComponentChildren(element: Element) {\n\t// Skip over withMeasuredSize compatibility wrapper\n\tconst childrenCollection =\n\t\telement.firstElementChild && element.firstElementChild.hasAttribute(SIZE_COMPATIBILITY_WRAPPER_ATTRIBUTE)\n\t\t\t? element.firstElementChild.children\n\t\t\t: element.children\n\n\treturn [...childrenCollection].filter(isMeasurable).map(unwrapInlinedDisplayContents)\n}\n\n/**\n * Rough check if an element of a HTMLCollection has measurable layout (can be\n * rendered as anything other than \"display: none\") _without_ querying its\n * computed styles, because we want to avoid a style recalculation penalty.\n *\n * @param element an HTMLCollection node\n */\n\nfunction isMeasurable(element: Node) {\n\t// Filter out certain HTMLElement subclasses that don't represent measurable elements\n\tif (\n\t\telement instanceof HTMLBaseElement ||\n\t\telement instanceof HTMLHeadElement ||\n\t\telement instanceof HTMLLinkElement ||\n\t\telement instanceof HTMLMetaElement ||\n\t\telement instanceof HTMLScriptElement ||\n\t\telement instanceof HTMLStyleElement ||\n\t\telement instanceof HTMLTitleElement\n\t) {\n\t\treturn false\n\t}\n\n\treturn element instanceof HTMLElement || element instanceof SVGElement\n}\n\n/**\n * Checks if an element has \"display: contents\" in its inline styles, and if\n * yes, returns the first measurable descendant. We intentionally _only_ check\n * the inlined display style, because reading it should not cause a style recalc\n * and it covers the use cases we have right now - wrapper divs around smart\n * components.\n *\n * @param element\n * @returns\n */\n\nfunction unwrapInlinedDisplayContents(element: Element): Element {\n\tif (!(element instanceof HTMLElement)) return element\n\tif (element.children.length === 0) return element\n\tif (element.style.display !== \"contents\") return element\n\n\tconst firstMeasurableChild = [...element.children].find(isMeasurable)\n\tif (firstMeasurableChild) {\n\t\treturn unwrapInlinedDisplayContents(firstMeasurableChild)\n\t}\n\n\treturn element\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport type { FrameProps } from \"../presentation/Frame/FrameWithMotion.tsx\"\n\nexport function extractStyleFromProps(\n\tprops: Partial<FrameProps>,\n\tname: keyof FrameProps,\n\tstyleRef: MotionStyle,\n\tinto?: keyof MotionStyle,\n): void {\n\tif (into === undefined) {\n\t\tinto = name as keyof MotionStyle\n\t}\n\tif (props[name] !== undefined) {\n\t\t// biome-ignore lint/suspicious/noExplicitAny: The anys look odd, but this prevents TypeScript from doing very expensive type intersection checks (500ms+). As the arguments are still type-safe, this is ok.\n\t\t;(styleRef as Record<string, any>)[into as any] = (props as any)[name as any]\n\t\treturn\n\t}\n}\n", "import { type MotionStyle, isMotionValue, transformValue } from \"framer-motion\"\nimport type { CSSProperties } from \"react\"\nimport { collectBackgroundFromProps } from \"../../traits/Background.ts\"\nimport { extractStyleFromProps } from \"../../utils/extractStyleFromProps.ts\"\nimport type { FrameProps } from \"./FrameWithMotion.tsx\"\n\nexport function hasLeftAndRight(style?: MotionStyle): boolean {\n\tif (!style) return false\n\treturn style.left !== undefined && style.right !== undefined\n}\n\nexport function hasTopAndBottom(style?: MotionStyle): boolean {\n\tif (!style) return false\n\treturn style.top !== undefined && style.bottom !== undefined\n}\n\nexport function getStyleForFrameProps(props?: Partial<FrameProps>): MotionStyle {\n\tif (!props) {\n\t\treturn {}\n\t}\n\n\tconst style: MotionStyle = {}\n\n\t// Styles\n\tif (props.preserve3d === true) {\n\t\tstyle.transformStyle = \"preserve-3d\"\n\t} else if (props.preserve3d === false) {\n\t\tstyle.transformStyle = \"flat\"\n\t}\n\tif (props.backfaceVisible === true) {\n\t\tstyle.backfaceVisibility = \"visible\"\n\t} else if (props.backfaceVisible === false) {\n\t\tstyle.backfaceVisibility = \"hidden\"\n\t}\n\tif (style.backfaceVisibility) {\n\t\tstyle.WebkitBackfaceVisibility = style.backfaceVisibility\n\t}\n\tif (props.perspective !== undefined) {\n\t\tstyle.perspective = style.WebkitPerspective = props.perspective\n\t}\n\t// Generated Component instances set left and top via CSS. But can still be\n\t// centered with a centering transform.\n\tif (!props.__fromCanvasComponent) {\n\t\tif (props.center === true) {\n\t\t\tstyle.left = \"50%\"\n\t\t\tstyle.top = \"50%\"\n\t\t} else {\n\t\t\tif (props.center === \"x\") {\n\t\t\t\tstyle.left = \"50%\"\n\t\t\t} else if (props.center === \"y\") {\n\t\t\t\tstyle.top = \"50%\"\n\t\t\t}\n\t\t}\n\t}\n\n\tconst { cornerShape } = props\n\tif (isMotionValue(cornerShape)) {\n\t\tstyle.cornerShape = transformValue(() => `superellipse(${cornerShape.get()})`)\n\t} else if (cornerShape !== undefined) {\n\t\tstyle.cornerShape = `superellipse(${cornerShape})`\n\t}\n\n\textractStyleFromProps(props, \"size\", style)\n\textractStyleFromProps(props, \"width\", style)\n\textractStyleFromProps(props, \"height\", style)\n\textractStyleFromProps(props, \"minWidth\", style)\n\textractStyleFromProps(props, \"minHeight\", style)\n\textractStyleFromProps(props, \"top\", style)\n\textractStyleFromProps(props, \"right\", style)\n\textractStyleFromProps(props, \"bottom\", style)\n\textractStyleFromProps(props, \"left\", style)\n\textractStyleFromProps(props, \"position\", style)\n\textractStyleFromProps(props, \"overflow\", style)\n\textractStyleFromProps(props, \"opacity\", style)\n\t// avoid \"double border\" issues\n\tif (!props._border || !props._border.borderWidth) extractStyleFromProps(props, \"border\", style)\n\textractStyleFromProps(props, \"borderRadius\", style)\n\textractStyleFromProps(props, \"radius\", style, \"borderRadius\")\n\textractStyleFromProps(props, \"color\", style)\n\textractStyleFromProps(props, \"shadow\", style, \"boxShadow\")\n\textractStyleFromProps(props, \"x\", style)\n\textractStyleFromProps(props, \"y\", style)\n\textractStyleFromProps(props, \"z\", style)\n\textractStyleFromProps(props, \"rotate\", style)\n\textractStyleFromProps(props, \"rotateX\", style)\n\textractStyleFromProps(props, \"rotateY\", style)\n\textractStyleFromProps(props, \"rotateZ\", style)\n\textractStyleFromProps(props, \"scale\", style)\n\textractStyleFromProps(props, \"scaleX\", style)\n\textractStyleFromProps(props, \"scaleY\", style)\n\textractStyleFromProps(props, \"skew\", style)\n\textractStyleFromProps(props, \"skewX\", style)\n\textractStyleFromProps(props, \"skewY\", style)\n\textractStyleFromProps(props, \"originX\", style)\n\textractStyleFromProps(props, \"originY\", style)\n\textractStyleFromProps(props, \"originZ\", style)\n\tcollectBackgroundFromProps(props, style as CSSProperties)\n\n\treturn style\n}\n", "import { isAnimatable } from \"../../../animation/Animatable/Animatable.ts\"\nimport type { FrameProps } from \"./FrameWithMotion.tsx\"\nimport type { DeprecatedFrameWithEventsProps } from \"./types.ts\"\n\ntype FrameWithMotionPropsKey = keyof FrameProps\ntype Diff<T, U> = T extends U ? never : T\ntype FrameWithMotionOnlyKeys = Diff<FrameWithMotionPropsKey, keyof DeprecatedFrameWithEventsProps>\n\n// Complete list of FrameWithMotion props keys\nconst frameWithMotionPropsFields: FrameWithMotionOnlyKeys[] = [\n\t\"_border\",\n\t\"_constraints\",\n\t\"animate\",\n\t\"initial\",\n\t\"variants\",\n\t\"transition\",\n\t\"inherit\",\n\t\"center\",\n\t\"initial\",\n\t\"transformTemplate\",\n\t\"animate\",\n\t\"variants\",\n\t\"transition\",\n\t\"onUpdate\",\n\t\"onAnimationComplete\",\n\t\"onPanSessionStart\",\n\t\"onTapCancel\",\n\t\"whileTap\",\n\t\"whileHover\",\n\t\"onHoverStart\",\n\t\"onHoverEnd\",\n\t\"drag\",\n\t\"dragDirectionLock\",\n\t\"dragPropagation\",\n\t\"dragConstraints\",\n\t\"dragElastic\",\n\t\"dragMomentum\",\n\t\"dragTransition\",\n\t\"onDragStart\",\n\t\"onDragEnd\",\n\t\"onDrag\",\n\t\"onDirectionLock\",\n\t\"onDragTransitionEnd\",\n\t\"x\",\n\t\"y\",\n\t\"rotate\",\n\t\"rotateX\",\n\t\"rotateY\",\n\t\"rotateZ\",\n\t\"position\",\n\t\"border\",\n\t\"borderRadius\",\n\t\"cornerShape\",\n\t\"shadow\",\n\t\"size\",\n]\n\ntype DeprecatedFramePropsKey = keyof DeprecatedFrameWithEventsProps\nconst deprecatedFramePropsFields: DeprecatedFramePropsKey[] = [\n\t\"autoSize\",\n\t\"aspectRatio\",\n\t\"borderWidth\",\n\t\"borderStyle\",\n\t\"borderColor\",\n\t\"centerX\",\n\t\"centerY\",\n]\n\n/**\n * This function guard will define is props meant to be used with old frame or with new one\n * @param props Old or new props for the frame\n */\nexport function isDeprecatedFrameProps(\n\tprops: Record<string, unknown>,\n): props is Partial<DeprecatedFrameWithEventsProps> {\n\t// If we are using animatables, definitely use a DeprecatedFrame\n\tfor (const propKey in props) {\n\t\tif (isAnimatable(props[propKey])) return true\n\t}\n\n\t// It is a new frame API props\n\tfor (const field of frameWithMotionPropsFields) {\n\t\t// biome-ignore lint/suspicious/noPrototypeBuiltins: <explanation>\n\t\tif (props.hasOwnProperty(field)) return false\n\t}\n\n\t// It is definitely an old API\n\tfor (const field of deprecatedFramePropsFields) {\n\t\t// biome-ignore lint/suspicious/noPrototypeBuiltins: <explanation>\n\t\tif (props.hasOwnProperty(field)) return true\n\t}\n\n\t// Fallback to new Frame API\n\treturn false\n}\n", "import { assertNever } from \"@framerjs/shared\"\nimport { Frame } from \"library/render/presentation/Frame/index.tsx\"\nimport type React from \"react\"\nimport { useEffect, useState } from \"react\"\nimport { RenderingTaskPriority, renderingTaskQueues } from \"../renderingTaskQueues/index.ts\"\n\nconst taskQueue = renderingTaskQueues.getTaskQueue(\"placeholders\", {\n\tdelay: 1000,\n\tpriority: RenderingTaskPriority.Placeholders,\n\tmaxBatchSize: 500,\n})\n\nenum PlaceholderType {\n\tLoading,\n\tError,\n}\n\nconst baseStyle: React.CSSProperties = {\n\tbackground: undefined,\n\tdisplay: \"flex\",\n\tflexDirection: \"column\",\n\tjustifyContent: \"center\",\n\talignItems: \"center\",\n\tlineHeight: \"1.4em\",\n\ttextOverflow: \"ellipsis\",\n\toverflow: \"hidden\",\n\tminHeight: 0,\n}\n\nconst textStyle: React.CSSProperties = {\n\toverflow: \"hidden\",\n\twhiteSpace: \"nowrap\",\n\ttextOverflow: \"ellipsis\",\n\tmaxWidth: \"100%\",\n\tflexShrink: 0,\n\tpadding: `0 10px`,\n}\n\nconst titleStyle: React.CSSProperties = {\n\t...textStyle,\n\t// TODO: Use Fresco tokens for this.\n\tfontWeight: 500,\n}\n\nconst messageStyle: React.CSSProperties = {\n\t...textStyle,\n\twhiteSpace: \"pre\",\n\tmaxHeight: \"calc(50% - calc(20px * var(--framerInternalCanvas-canvasPlaceholderContentScaleFactor, 1)))\",\n\tWebkitMaskImage: \"linear-gradient(to bottom, black 80%, transparent 100%)\",\n}\n\n/** A count of placeholders that are currently waiting to settle. */\nlet settlingPlaceholderCount = 0\nlet settlingPlaceholderPromise = Promise.resolve()\nlet settlingPlaceholderPromiseResolve: (() => void) | undefined\n\n/**\n * Either increments or decrements the global settling placeholder counter.\n * If the count hits 0, all pending promises will be resolved.\n */\nfunction changeCount(delta: -1 | 1) {\n\tconst originalCount = settlingPlaceholderCount\n\tsettlingPlaceholderCount += delta\n\tif (originalCount > 0 && settlingPlaceholderCount === 0) {\n\t\t// There are no longer placeholders settling. Schedule the resolution\n\t\t// next frame because sometimes one frame can go from 1 to 0 to 1 again.\n\t\tconst resolve = settlingPlaceholderPromiseResolve\n\t\tif (resolve) {\n\t\t\trequestAnimationFrame(() => {\n\t\t\t\tif (settlingPlaceholderCount > 0) {\n\t\t\t\t\t// There are more placeholders still settling, so schedule\n\t\t\t\t\t// resolution after the new one.\n\t\t\t\t\tif (resolve !== settlingPlaceholderPromiseResolve) {\n\t\t\t\t\t\tvoid settlingPlaceholderPromise.then(resolve)\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// This shouldn't happen, but fall back if it does.\n\t\t\t\t\t\tresolve()\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tresolve()\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t} else if (originalCount === 0 && settlingPlaceholderCount > 0) {\n\t\tsettlingPlaceholderPromise = new Promise(resolve => {\n\t\t\tsettlingPlaceholderPromiseResolve = resolve\n\t\t})\n\t}\n}\n\n/**\n * Get a promise that will resolve once all unsettled placeholders\n * currently on screen have settled. If all placeholders have settled\n * (either by being replaced with the actual component, or showing an\n * error) the promise will be immediately resolved. Note that calling\n * this too soon (before the placeholders have been added) will also\n * result in an immediately resolved promise.\n */\nexport function waitUntilPlaceholdersSettled(): Promise<void> {\n\treturn settlingPlaceholderPromise\n}\n\n// A similar component exists in Library:\n// src/library/src/components/Device/DevicePlaceholder.tsx. Consider updating\n// styles there too if changing styles here.\nexport function RenderPlaceholder(props: { error?: { title?: string; message: string }; style?: React.CSSProperties }) {\n\tif (process.env.NODE_ENV !== \"production\" && window[\"perf\"]) window[\"perf\"].nodeRender()\n\tlet type: PlaceholderType = PlaceholderType.Loading\n\tlet title: string | undefined\n\tlet message: string | undefined\n\n\tif (props.error) {\n\t\ttype = PlaceholderType.Error\n\t\ttitle = props.error.title\n\t\tmessage = props.error.message\n\t}\n\n\t// Wait a bit before considering the placeholder \"settled\". Only show\n\t// error state etc. once it settles to avoid flashing errors.\n\tconst [isSettled, setIsSettled] = useState(false)\n\tuseEffect(() => {\n\t\tconst task = taskQueue.add(() => setIsSettled(true))\n\t\treturn () => task.cancel()\n\t}, [type])\n\n\t// Increment the global counter if this placeholder is not settled, then\n\t// decrement it again once the placeholder settles or gets unmounted.\n\tuseEffect(() => {\n\t\tif (isSettled) return\n\t\tchangeCount(1)\n\t\treturn () => {\n\t\t\tchangeCount(-1)\n\t\t}\n\t}, [isSettled])\n\n\treturn (\n\t\t<Frame className={className(type)} style={{ ...baseStyle, ...props.style }} width=\"100%\" height=\"100%\">\n\t\t\t<div className={isSettled ? \"text\" : \"pending text\"} style={titleStyle}>\n\t\t\t\t{placeholderTitle(type, title)}\n\t\t\t</div>\n\t\t\t{message && (\n\t\t\t\t<div className={isSettled ? \"text\" : \"pending text\"} style={messageStyle}>\n\t\t\t\t\t{message}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</Frame>\n\t)\n}\n\nfunction className(type: PlaceholderType): string {\n\tswitch (type) {\n\t\tcase PlaceholderType.Error:\n\t\t\treturn \"framerInternalUI-errorPlaceholder\"\n\t\tcase PlaceholderType.Loading:\n\t\t\treturn \"framerInternalUI-componentPlaceholder\"\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n\nfunction placeholderTitle(type: PlaceholderType, title: string | undefined) {\n\tswitch (type) {\n\t\tcase PlaceholderType.Loading:\n\t\t\treturn \"Loading\"\n\t\tcase PlaceholderType.Error:\n\t\t\treturn title ?? \"Error\"\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n", "import { TaskQueueRunner } from \"@framerjs/shared\"\nexport const renderingTaskQueues = new TaskQueueRunner()\n\nexport enum RenderingTaskPriority {\n\tAll = 0,\n\tCachedNodeProxies,\n\tPlaceholders,\n\tImageLoading,\n\tHighest,\n}\n", "import type { Action, ActionControls } from \"library/render/types/Action.ts\"\nimport type { ActionInfo } from \"library/utils/addActionControls.ts\"\n\n/**\n * Used to get and set action metadata\n * @private\n */\nconst actionControlsKey = Symbol(\"actionControls\")\n\n/**\n * Provide a title and controls for an action, used by Framer X\n * @param action - a reference to an {@link Action}\n * @param title - the display title of the action\n * @param controls - the action controls\n * @internal\n */\n// biome-ignore lint/suspicious/noExplicitAny: @TODO add explanation\nexport function addActionControls<Options extends { [key: string]: any }>(\n\taction: Action<Options>,\n\ttitle: string,\n\tcontrols: ActionControls<Options>,\n) {\n\tconst info: ActionInfo = { title, controls }\n\t// biome-ignore lint/suspicious/noExplicitAny: @TODO add explanation\n\t;(action as any)[actionControlsKey] = info\n}\n\n/**\n * Retrieve the title and controls of an action\n * @param action - a reference to an {@link Action}\n * @returns an object containing the title and controls, or undefined\n * @internal\n */\n// biome-ignore lint/suspicious/noExplicitAny: @TODO add explanation\nexport function getActionControls<Options extends { [key: string]: any }>(\n\taction: Action<Options>,\n): Partial<ActionInfo> | undefined {\n\t// biome-ignore lint/suspicious/noExplicitAny: @TODO add explanation\n\treturn (action as any)[actionControlsKey]\n}\n", "import { getLogger } from \"@framerjs/shared\"\nimport { useLayoutEffect } from \"react\"\n\nconst log = getLogger(\"TimeBudget\")\n\nexport class BudgetError extends Error {}\n\ninterface TimeBudgetOptions {\n\tthrows?: boolean\n}\n\nexport class TimeBudget {\n\t#current = Infinity\n\t#deadline = Infinity\n\t#limits = new Map<string, number>()\n\n\t#throws: boolean\n\n\tconstructor(\n\t\tprivate readonly name: string,\n\t\t{ throws = true }: TimeBudgetOptions = {},\n\t) {\n\t\tthis.#limits.set(\"default\", Infinity)\n\t\tthis.#throws = throws\n\t}\n\n\tprivate updateCurrent() {\n\t\tconst values = this.#limits.values()\n\t\tthis.#current = Math.max(...values)\n\t}\n\n\tget current() {\n\t\treturn this.#current\n\t}\n\n\tsetDefault(ms: number) {\n\t\tthis.addScope(\"default\", ms)\n\t}\n\n\taddScope(name: string, ms: number) {\n\t\tconst oldLimit = this.#current\n\t\tthis.#limits.set(name, ms)\n\t\t// Only reset the deadline if the new limit is higher than the old limit.\n\t\tif (oldLimit < ms || oldLimit === Infinity) {\n\t\t\tthis.updateCurrent()\n\t\t\tthis.resetDeadline()\n\t\t}\n\t}\n\n\tremoveScope(name: string) {\n\t\tthis.#limits.delete(name)\n\t\tthis.updateCurrent()\n\t}\n\n\textendDeadlineBy(ms: number) {\n\t\tthis.#deadline += ms\n\t}\n\n\tresetDeadline() {\n\t\tthis.#deadline = Date.now() + this.#current\n\t}\n\n\tcheckDeadline() {\n\t\tconst now = Date.now()\n\n\t\tif (now > this.#deadline) {\n\t\t\tconst message = `${this.name} exceeded time limit of ${this.#current}ms by ${now - this.#deadline}ms.`\n\t\t\tif (this.#throws) {\n\t\t\t\tthrow new BudgetError(message)\n\t\t\t} else {\n\t\t\t\tlog.warn(message)\n\t\t\t}\n\t\t}\n\t}\n}\n\nconst frameBudget = new TimeBudget(\"Frame\", { throws: false })\nconst componentBudget = new TimeBudget(\"Component\")\n\nexport const executionTimeBudgets = {\n\tframe: frameBudget,\n\tcomponent: componentBudget,\n}\n\n// We only do the more elaborate checks every so often.\nconst COUNTER_START_VALUE = 200\n\n// Quick check counter:\nlet budgetCounter = COUNTER_START_VALUE\n// Reset counters and deadlines on every frame.\nlet shouldResetFrameBudget = true\n// Only use the frame budget when we are rendering the code component.\nlet isFramerRender = false\n\n// Called when we load each file to increase the global time limit slightly.\nfunction increaseFrameBudget() {\n\tframeBudget.extendDeadlineBy(frameBudget.current / 2)\n}\n\n// Called in checkBudget to reset the frame budget on the next frame.\nfunction requestFrameBudgetReset() {\n\tif (!shouldResetFrameBudget) return\n\n\tshouldResetFrameBudget = false\n\tframeBudget.resetDeadline()\n\n\t// requestAnimationFrame doesn't run if the window is in the background.\n\tsetTimeout(() => {\n\t\tshouldResetFrameBudget = true\n\t}, 0)\n}\n\n// Called whenever we render or re-render a component to reset the counters and deadlines.\nfunction resetComponentBudget() {\n\trequestFrameBudgetReset()\n\n\tbudgetCounter = COUNTER_START_VALUE\n\tcomponentBudget.resetDeadline()\n}\n\n// All component code (but not their libraries) will call this per function or loop entry.\n// We only do an expensive check once in a while and otherwise just skip the calls.\nfunction checkBudget() {\n\tif (--budgetCounter < 0) checkBudgetFull()\n}\n\nfunction checkBudgetFull() {\n\trequestFrameBudgetReset()\n\tbudgetCounter = COUNTER_START_VALUE\n\n\t// Only check the component budget if framer initiated the render.\n\tif (isFramerRender) {\n\t\tcomponentBudget.checkDeadline()\n\t}\n\n\tframeBudget.checkDeadline()\n}\n\nexport function initializeExecutionTimeBudgets(frameLimit: number = 5000, componentLimit: number = 5000) {\n\tframeBudget.setDefault(frameLimit)\n\tcomponentBudget.setDefault(componentLimit)\n\n\tinstallExecutionTimeBudgets()\n}\n\nfunction installExecutionTimeBudgets() {\n\t// Install the checks on the window so we can access them from the instrumenting code that is inserted by the build service.\n\t// biome-ignore lint/suspicious/noExplicitAny: only used by tooling\n\tconst globalWindow = window as any\n\tglobalWindow.__checkBudget__ = checkBudget\n\tglobalWindow.__checkComponentBudget__ = resetComponentBudget\n\tglobalWindow.__checkFileBudget__ = increaseFrameBudget\n}\n\nexport function useExecutionTimeBudgetsWhileRendering() {\n\tinstallExecutionTimeBudgets()\n\n\tisFramerRender = true\n\tuseLayoutEffect(() => {\n\t\tisFramerRender = false\n\t})\n}\n", "// A subset of the FeatureSet in Vekter. We probably want this to be a shared type eventually.\nlet featureSet: { isOn(name: string): boolean } | undefined\n\nexport function isOn(name: string) {\n\treturn featureSet?.isOn(name) ?? false\n}\n\n// This function is used in initializeRuntime.ts.\nexport function setFeatureSet(fs: typeof featureSet) {\n\tfeatureSet = fs\n}\n", "// A subset of the FeatureSet in Vekter. We probably want this to be a shared type eventually.\nlet featureSet: { isOn(name: string): boolean } | undefined\n\nexport function isOn(name: string) {\n\treturn featureSet?.isOn(name) ?? false\n}\n\n// This function is used in initializeRuntime.ts.\nexport function setFeatureSet(fs: typeof featureSet) {\n\tfeatureSet = fs\n}\n", "import { warnOnce } from \"@framerjs/shared\"\nimport { fontStore } from \"library/render/fonts/fontStore.ts\"\nimport type { Runtime } from \"library/utils/runtimeInjection.ts\"\nimport { _injectRuntime } from \"library/utils/runtimeInjection.ts\"\nimport { RenderPlaceholder } from \"../components/RenderPlaceholder.tsx\"\nimport { addActionControls } from \"../sandbox/actions/actionControls.ts\"\nimport { initializeExecutionTimeBudgets } from \"./executionTimeBudgets.ts\"\nimport * as experiments from \"./experiments.ts\"\nimport * as projectFeatures from \"./projectFeatures.ts\"\n\nconst runtime: Partial<Runtime> = {\n\taddActionControls,\n\tassetResolver: () => {\n\t\twarnOnce(\"Using default assetResolver from runtime. Override by providing an assetResolver to initializeRuntime()\")\n\t\treturn undefined\n\t},\n\tqueueMeasureRequest: () => {\n\t\twarnOnce(\n\t\t\t\"Using default queueMeasureRequest from runtime. Override by providing queueMeasureRequest to initializeRuntime()\",\n\t\t)\n\t},\n\tfetchGoogleFontsList: () => {\n\t\twarnOnce(\n\t\t\t\"Using default fetchGoogleFontsList from runtime. Override by providing a fetchGoogleFontsList function to initializeRuntime()\",\n\t\t)\n\t\treturn Promise.resolve({ staticFonts: [], variableFonts: [] })\n\t},\n\tfetchFontshareFontsList: () => {\n\t\twarnOnce(\n\t\t\t\"Using default fetchFontshareFontsList from runtime. Override by providing a fetchFontshareFontsList function to initializeRuntime()\",\n\t\t)\n\t\treturn Promise.resolve([])\n\t},\n\tfetchBuiltInFontsList: () => {\n\t\twarnOnce(\n\t\t\t\"Using default fetchBuiltInFontsList from runtime. Override by providing a fetchBuiltInFontsList function to initializeRuntime()\",\n\t\t)\n\t\treturn Promise.resolve([])\n\t},\n\tRenderPlaceholder,\n}\n\ninterface Options extends Partial<Runtime> {\n\tenableFontStore?: boolean\n\texecutionTimeBudgets?: {\n\t\tframe?: number\n\t\tcomponent?: number\n\t}\n\texperiments?: { isOn(name: string): boolean }\n\tprojectFeatures?: { isOn(name: string): boolean }\n}\n\nexport function initializeRuntime({\n\texecutionTimeBudgets,\n\texperiments: experimentsFeatureSet,\n\tprojectFeatures: projectFeaturesFeatureSet,\n\tenableFontStore,\n\t...runtimeOverride\n}: Options = {}) {\n\tif (typeof _injectRuntime !== \"function\") {\n\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\tconsole.warn(\"Trying to initializeRuntime without _injectRuntime function from Framer Library\")\n\t\treturn\n\t}\n\tinitializeExecutionTimeBudgets(executionTimeBudgets?.frame, executionTimeBudgets?.component)\n\tif (experimentsFeatureSet) {\n\t\texperiments.setFeatureSet(experimentsFeatureSet)\n\t}\n\tif (projectFeaturesFeatureSet) {\n\t\tprojectFeatures.setFeatureSet(projectFeaturesFeatureSet)\n\t}\n\n\tif (typeof enableFontStore === \"boolean\") {\n\t\tfontStore.enabled = enableFontStore\n\t}\n\n\t_injectRuntime({ ...runtime, ...runtimeOverride })\n}\n", "import { useContext } from \"react\"\nimport type { NavigationInterface } from \"./Navigation.tsx\"\nimport { NavigationContext } from \"./NavigationContext.ts\"\n\n/**\n * @returns NavigationInterface {@link NavigationInterface}\n * @public\n */\nexport function useNavigation(): NavigationInterface {\n\treturn useContext(NavigationContext)\n}\n", "import { createContext } from \"react\"\nimport type { NavigationInterface } from \"./Navigation.tsx\"\nimport { navigatorMock } from \"./NavigatorMock.tsx\"\n\n/**\n * @internal\n */\nexport const NavigationContext = /* @__PURE__ */ createContext<NavigationInterface>(navigatorMock)\n", "import { warnOnce } from \"../utils/warnOnce.ts\"\nimport type { NavigationInterface } from \"./Navigation.tsx\"\n\nclass NavigatorMock implements NavigationInterface {\n\twarning = () => {\n\t\twarnOnce(\"The Navigator API is only available inside of Framer: https://www.framer.com/\")\n\t}\n\n\tgoBack = () => this.warning()\n\tinstant = () => this.warning()\n\tfade = () => this.warning()\n\tpush = () => this.warning()\n\tmodal = () => this.warning()\n\toverlay = () => this.warning()\n\tflip = () => this.warning()\n\tcustomTransition = () => this.warning()\n\tmagicMotion = () => this.warning()\n}\n\n/**\n * @internal\n */\nexport const navigatorMock = /* @__PURE__ */ new NavigatorMock()\n", "import type { Transition } from \"framer-motion\"\nimport { useNavigation } from \"library/components/useNavigation.ts\"\nimport type { ActionHandler } from \"library/render/types/Action.ts\"\nimport type { SegmentedControlIcon } from \"library/render/types/PropertyControls.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport type React from \"react\"\nimport { addActionControls } from \"./actionControls.ts\"\n\nexport type NavigateActionTransitionType = \"push\" | \"instant\" | \"fade\" | \"modal\" | \"overlay\" | \"flip\" | \"magicMotion\"\nexport type NavigateActionAppearsFrom = \"left\" | \"right\" | \"top\" | \"bottom\"\nconst transitions: NavigateActionTransitionType[] = [\n\t\"instant\",\n\t\"magicMotion\",\n\t\"push\",\n\t\"modal\",\n\t\"overlay\",\n\t\"fade\",\n\t\"flip\",\n]\n\nfunction camelCaseToTitleCase(name: string): string {\n\tconst result = name.replace(/([A-Z])/gu, \" $1\")\n\treturn result.charAt(0).toUpperCase() + result.slice(1)\n}\n\nexport function transitionToTitle(transition: NavigateActionTransitionType) {\n\tif (transition === \"magicMotion\") {\n\t\treturn \"Magic\"\n\t}\n\treturn camelCaseToTitleCase(transition)\n}\n\nconst transitionTitles: string[] = transitions.map(transitionToTitle)\n\nconst transitionIcons = transitions.map(\n\ttransition => `navigation-transition-${transition}` as const,\n) satisfies SegmentedControlIcon[]\nconst appearsFromOptions: NavigateActionAppearsFrom[] = [\"right\", \"left\", \"bottom\", \"top\"]\n\n/* Note this structure is inspected by the Preview in createActionsOverride to determine\n * if an action has a target when of type \"next\" before the event is added to the component,\n * which may need updating if this changes */\nexport interface NavigateOptions {\n\ttype: \"previous\" | \"next\"\n\ttarget: React.ReactNode | undefined\n\ttransition: NavigateActionTransitionType\n\tappearsFrom: NavigateActionAppearsFrom\n\tbackdropColor: string\n\tanimation: Transition\n}\n\n/**\n * Note: this hook is copied by `useNavigate` in the framer library to provide\n * support for navigating compiled screens. In the future, when prototypes are\n * previewed purely as generated code, we can remove this hook, and rely purely\n * on the library hook, or in future an independent module.\n */\nexport function useNavigate(options: NavigateOptions): ActionHandler {\n\tconst navigation = useNavigation()\n\tif (!navigation) {\n\t\treturn () => {}\n\t}\n\treturn () => {\n\t\tif (options.type === \"previous\") {\n\t\t\tnavigation.goBack()\n\t\t\treturn false\n\t\t}\n\t\tconst { target, appearsFrom, backdropColor, animation } = options\n\t\tif (!target) return\n\n\t\tswitch (options.transition) {\n\t\t\tcase \"instant\":\n\t\t\t\tnavigation.instant(target)\n\t\t\t\tbreak\n\t\t\tcase \"fade\":\n\t\t\t\tnavigation.fade(target, { animation })\n\t\t\t\tbreak\n\t\t\tcase \"push\":\n\t\t\t\tnavigation.push(target, { appearsFrom, animation })\n\t\t\t\tbreak\n\t\t\tcase \"modal\":\n\t\t\t\tnavigation.modal(target, { backdropColor, animation })\n\t\t\t\tbreak\n\t\t\tcase \"overlay\":\n\t\t\t\tnavigation.overlay(target, { appearsFrom, backdropColor, animation })\n\t\t\t\tbreak\n\t\t\tcase \"flip\":\n\t\t\t\tnavigation.flip(target, { appearsFrom, animation })\n\t\t\t\tbreak\n\t\t\tcase \"magicMotion\":\n\t\t\t\tnavigation.magicMotion(target, { animation })\n\t\t\t\tbreak\n\t\t}\n\n\t\t// Return false to prevent smart components from proceeding with their event execution.\n\t\treturn false\n\t}\n}\n\ninterface NavigateActionControlTypes {\n\ttype: ControlType.Enum\n\ttarget: ControlType.Slot\n\ttransition: ControlType.Enum\n\tappearsFrom: ControlType.Enum\n\tbackdropColor: ControlType.Color\n\tanimation: ControlType.Transition\n}\n\nexport const navigateActionControlTypes: NavigateActionControlTypes = {\n\ttype: ControlType.Enum,\n\ttarget: ControlType.Slot,\n\ttransition: ControlType.Enum,\n\tappearsFrom: ControlType.Enum,\n\tbackdropColor: ControlType.Color,\n\tanimation: ControlType.Transition,\n}\n\nexport const navigateActionDefaults: NavigateOptions = {\n\ttype: \"next\",\n\ttarget: undefined,\n\ttransition: \"instant\",\n\tappearsFrom: \"right\",\n\tbackdropColor: \"rgba(4,4,15,.4)\",\n\tanimation: {\n\t\ttype: \"spring\",\n\t\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t\t// @ts-ignore We\u2019re mixing in a default `ease` value for when the `type` is changed to \"tween\"\n\t\tease: [0.44, 0, 0.56, 1],\n\t\tduration: undefined,\n\t\tdelay: 0,\n\t\tstiffness: 500,\n\t\tdamping: 60,\n\t\tmass: 1,\n\t},\n}\n\naddActionControls(useNavigate, \"Interaction\", {\n\ttype: {\n\t\ttype: navigateActionControlTypes.type,\n\t\toptions: [\"previous\", \"next\"],\n\t\toptionTitles: [\"Previous\", \"Next\"],\n\t\tdefaultValue: navigateActionDefaults.type,\n\t\tdisplaySegmentedControl: true,\n\t\ttitle: \"Target\",\n\t},\n\ttarget: {\n\t\ttype: navigateActionControlTypes.target,\n\t\ttitle: \" \",\n\t\thidden: isPrevious,\n\t},\n\ttransition: {\n\t\ttype: navigateActionControlTypes.transition,\n\t\toptions: transitions,\n\t\toptionTitles: transitionTitles,\n\t\toptionIcons: transitionIcons,\n\t\tdefaultValue: navigateActionDefaults.transition,\n\t\ttitle: \"Animate\",\n\t\thidden: isPrevious,\n\t\tdisplaySegmentedControl: true,\n\t\tsegmentedControlDirection: \"vertical\",\n\t},\n\tanimation: {\n\t\ttype: ControlType.Transition,\n\t\ttitle: \"Animation\",\n\t\tdefaultValue: navigateActionDefaults.animation,\n\t\thidden: isNavigationAnimationHidden,\n\t},\n\tappearsFrom: {\n\t\ttype: navigateActionControlTypes.appearsFrom,\n\t\toptions: appearsFromOptions,\n\t\tdefaultValue: navigateActionDefaults.appearsFrom,\n\t\toptionTitles: [\"Left\", \"Right\", \"Up\", \"Down\"],\n\t\tdisplaySegmentedControl: true,\n\t\ttitle: \"Direction\",\n\t\thidden: info => {\n\t\t\tif (isPrevious(info)) return true\n\t\t\tswitch (info.transition) {\n\t\t\t\tcase \"flip\":\n\t\t\t\tcase \"overlay\":\n\t\t\t\tcase \"push\":\n\t\t\t\t\treturn false\n\t\t\t\tdefault:\n\t\t\t\t\treturn true\n\t\t\t}\n\t\t},\n\t},\n\tbackdropColor: {\n\t\ttype: navigateActionControlTypes.backdropColor,\n\t\ttitle: \"Backdrop\",\n\t\tdefaultValue: navigateActionDefaults.backdropColor,\n\t\thidden: info => {\n\t\t\tif (isPrevious(info)) return true\n\t\t\tswitch (info.transition) {\n\t\t\t\tcase \"overlay\":\n\t\t\t\tcase \"modal\":\n\t\t\t\t\treturn false\n\t\t\t\tdefault:\n\t\t\t\t\treturn true\n\t\t\t}\n\t\t},\n\t},\n})\n\nexport function isNavigationAnimationHidden(navigationInfo: Partial<NavigateOptions>) {\n\treturn navigationInfo.transition === \"instant\" || navigationInfo.type === \"previous\"\n}\n\nfunction isPrevious(info: Partial<NavigateOptions>): boolean {\n\treturn info.type === \"previous\"\n}\n", "import type { ActionControls, ActionHandler } from \"library/render/types/Action.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { addActionControls } from \"./actionControls.ts\"\n\nexport type SetVariantType = \"cycle\" | \"set\"\n\nexport interface SetVariantOptions {\n\ttype: SetVariantType\n\tvariantId: string | undefined // only if type === set\n\tpauseOffscreen: boolean\n}\n\nexport function useSetVariant(): ActionHandler {\n\treturn () => {}\n}\n\ninterface SetVariantActionControlTypes {\n\ttype: ControlType.Enum\n\tvariantId: ControlType.String\n\tpauseOffscreen: ControlType.Boolean\n}\n\nexport const setVariantActionControlTypes: SetVariantActionControlTypes = {\n\ttype: ControlType.Enum,\n\tvariantId: ControlType.String,\n\tpauseOffscreen: ControlType.Boolean,\n}\n\nexport const setVariantActionDefaults: SetVariantOptions = {\n\ttype: \"set\",\n\tvariantId: undefined,\n\tpauseOffscreen: true,\n}\n\nexport const setVariantActionControls: ActionControls<SetVariantOptions> = {\n\tpauseOffscreen: {\n\t\ttitle: \"Off Screen\",\n\t\ttype: setVariantActionControlTypes.pauseOffscreen,\n\t\tenabledTitle: \"Pause\",\n\t\tdisabledTitle: \"Play\",\n\t\tdefaultValue: setVariantActionDefaults.pauseOffscreen,\n\t\thidden: (_, rootProps) => rootProps.eventKey !== \"onAppear\",\n\t},\n\ttype: {\n\t\ttitle: \"Transition\",\n\t\ttype: setVariantActionControlTypes.type,\n\t\toptions: [\"set\", \"cycle\"] satisfies SetVariantType[],\n\t\toptionTitles: [\"Once\", \"Cycle\"],\n\t\tdisplaySegmentedControl: true,\n\t\tdefaultValue: setVariantActionDefaults.type,\n\t},\n\tvariantId: {\n\t\ttype: setVariantActionControlTypes.variantId,\n\t\thidden: props => props.type === \"cycle\",\n\t},\n}\n\naddActionControls(useSetVariant, \"Set Variant\", setVariantActionControls)\n", "import { getServiceMap } from \"@framerjs/shared\"\n\nexport interface PackageModuleInfo {\n\tentityId: string\n\texportIdentifier: string\n\tmoduleURL: string\n\tpackageName: string\n}\n\nconst PACKAGE_MODULE_IDENTIFIER_REGEX = /^(?:(@[^/]+\\/[^/]+)\\/(?:\\.\\/)?|\\.\\/)(.*?)\\.[jt]sx?_(.*)$/u\n\nexport function getPackageModuleInfo(identifier: string): PackageModuleInfo | undefined {\n\tconst cdnPrefix = `${getServiceMap().modulesShortLink}/store`\n\tconst match = PACKAGE_MODULE_IDENTIFIER_REGEX.exec(identifier)\n\tif (!match || !match[2] || !match[3]) return\n\n\t// Example: @framer/framer.pkgName\n\tlet packageName = match[1]\n\t// Support both ways to refer to a local component.\n\tif (!packageName || packageName === \"|local|\") {\n\t\t// Make the local identifier URL-friendly.\n\t\tpackageName = \"@framer/local\"\n\t}\n\t// Example: path/Filename\n\tconst filenameWithoutExtension = match[2]\n\t// Example: ExportIdentifier\n\tconst exportIdentifier = match[3]\n\treturn {\n\t\tentityId: `${packageName}/${filenameWithoutExtension}.js_${exportIdentifier}`,\n\t\texportIdentifier,\n\t\tmoduleURL: `${cdnPrefix}/${packageName}/${filenameWithoutExtension}.js?${exportIdentifier}`,\n\t\tpackageName,\n\t}\n}\n", "import type { AnyComponentLoader } from \"../../types.ts\"\nimport type { ComponentLoader } from \"./componentLoader.ts\"\n\nexport function isEditorComponentLoader(componentLoader: AnyComponentLoader): componentLoader is ComponentLoader {\n\treturn componentLoader.environment === \"editor\"\n}\n", "/**\n * This enum defines the list of all class discriminators.\n * Using an enum provides a) protection against typos;\n * b) protection against duplicates (if you create another class called `Color`\n * and try to add it into enum, TS will warn you that the enum member already exists.)\n */\nexport enum ClassDiscriminator {\n\tAbTestsEntityTypeRootNode = \"AbTestsEntityTypeRootNode\",\n\tAgentDragSelectTool = \"AgentDragSelectTool\",\n\tAgentPanelTool = \"AgentPanelTool\",\n\tAgentSelectTool = \"AgentSelectTool\",\n\tAnalyticsScopeNode = \"AnalyticsScopeNode\",\n\tBlockquoteEntityTypeRootNode = \"BlockquoteEntityTypeRootNode\",\n\tBlockquoteStylePresetNode = \"BlockquoteStylePresetNode\",\n\tBooleanShapeNode = \"BooleanShapeNode\",\n\tBoxShadow = \"BoxShadow\",\n\tBranchNode = \"BranchNode\",\n\tBranchesNode = \"BranchesNode\",\n\tCanvasNode = \"CanvasNode\",\n\tCanvasPageNode = \"CanvasPageNode\",\n\tCanvasScopeNode = \"CanvasScopeNode\",\n\tChatTool = \"ChatTool\",\n\tCMSEntityTypeRootNode = \"CMSEntityTypeRootNode\",\n\tCodeComponentNode = \"CodeComponentNode\",\n\tCodeFileEntityTypeRootNode = \"CodeFileEntityTypeRootNode\",\n\tCollectionReferenceVariableEditTool = \"CollectionReferenceVariableEditTool\",\n\tCollectionItemNode = \"CollectionItemNode\",\n\tCollectionNode = \"CollectionNode\",\n\tColor = \"Color\",\n\tColorEntityTypeRootNode = \"ColorEntityTypeRootNode\",\n\tColorStyleTokenListNode = \"ColorStyleTokenListNode\",\n\tColorStyleTokenNode = \"ColorStyleTokenNode\",\n\tComponentEntityTypeRootNode = \"ComponentEntityTypeRootNode\",\n\tComponentPresetNode = \"ComponentPresetNode\",\n\tConicGradient = \"ConicGradient\",\n\tContentManagementNode = \"ContentManagementNode\",\n\tContentManagementEntityTypeRootNode = \"ContentManagementEntityTypeRootNode\",\n\tCreateCodeComponentBaseTool = \"CreateCodeComponentBaseTool\",\n\tCreateFrameBaseTool = \"CreateFrameBaseTool\",\n\tCreateShapeBaseTool = \"CreateShapeBaseTool\",\n\tCreateTextTool = \"CreateTextTool\",\n\tCustomCodeScopeNode = \"CustomCodeScopeNode\",\n\tCustomCodeNode = \"CustomCodeNode\",\n\tDateVariableEditTool = \"DateVariableEditTool\",\n\tDesignPageNode = \"DesignPageNode\",\n\tEntityFolderNode = \"EntityFolderNode\",\n\tEntityReferenceNode = \"EntityReferenceNode\",\n\tEntityRootNode = \"EntityRootNode\",\n\tEnumVariableEditTool = \"EnumVariableEditTool\",\n\tErrorListNode = \"ErrorListNode\",\n\tErrorNode = \"ErrorNode\",\n\tExportOptions = \"ExportOptions\",\n\tExternalModuleNode = \"ExternalModuleNode\",\n\tExternalModulesListNode = \"ExternalModulesListNode\",\n\tFeedbackTool = \"FeedbackTool\",\n\tFormBooleanInputNode = \"FormBooleanInputNode\",\n\tFormPlainTextInputNode = \"FormPlainTextInputNode\",\n\tFormSelectNode = \"FormSelectNode\",\n\tFrameNode = \"FrameNode\",\n\tFunnelNode = \"FunnelNode\",\n\tFunnelsEntityTypeRootNode = \"FunnelsEntityTypeRootNode\",\n\tFunnelStepActionNode = \"FunnelStepActionNode\",\n\tFunnelStepNode = \"FunnelStepNode\",\n\tGapTool = \"GapTool\",\n\tGradientColorStop = \"GradientColorStop\",\n\tGradientToolManagerTool = \"GradientToolManagerTool\",\n\tGuideMoveTool = \"GuideMoveTool\",\n\tHeaderRouteNode = \"HeaderRouteNode\",\n\tHighlightStackItemTool = \"HighlightStackItemTool\",\n\tHighlightTool = \"HighlightTool\",\n\tImageStylePresetNode = \"ImageStylePresetNode\",\n\tInitialTool = \"InitialTool\",\n\tInlineCodeEntityTypeRootNode = \"InlineCodeEntityTypeRootNode\",\n\tInlineCodeStylePresetNode = \"InlineCodeStylePresetNode\",\n\tLayoutTemplateEntityTypeRootNode = \"LayoutTemplateEntityTypeRootNode\",\n\tLayoutTemplateNode = \"LayoutTemplateNode\",\n\tLineAnchorMoveTool = \"LineAnchorMoveTool\",\n\tLinearGradient = \"LinearGradient\",\n\tLinkEntityTypeRootNode = \"LinkEntityTypeRootNode\",\n\tLinkStylePresetNode = \"LinkStylePresetNode\",\n\tLinkTool = \"LinkTool\",\n\tLoadingShieldTool = \"LoadingShieldTool\",\n\tLocalizationGlossaryNode = \"LocalizationGlossaryNode\",\n\tLocalizationGlossaryItemNode = \"LocalizationGlossaryItemNode\",\n\tLocalModuleNode = \"LocalModuleNode\",\n\tLocalModulesListNode = \"LocalModulesListNode\",\n\tMoveTool = \"MoveTool\",\n\tMutableNode = \"MutableNode\",\n\tOvalShapeNode = \"OvalShapeNode\",\n\tOverlayNode = \"OverlayNode\",\n\tPaddingTool = \"PaddingTool\",\n\tPageLinkTool = \"PageLinkTool\",\n\tPanTool = \"PanTool\",\n\tPathCurveBendTool = \"PathCurveBendTool\",\n\tPathDefaultTool = \"PathDefaultTool\",\n\tPathNode = \"PathNode\",\n\tPathSegment = \"PathSegment\",\n\tPathSegmentAdditionTool = \"PathSegmentAdditionTool\",\n\tPathSegmentHandleMoveTool = \"PathSegmentHandleMoveTool\",\n\tPathSegmentMoveTool = \"PathSegmentMoveTool\",\n\tPathSegmentSelectTool = \"PathSegmentSelectTool\",\n\tPolygonShapeNode = \"PolygonShapeNode\",\n\tPresetsListNode = \"PresetsListNode\",\n\tPreviewSettings = \"PreviewSettings\",\n\tProxyRouteNode = \"ProxyRouteNode\",\n\tRadialGradient = \"RadialGradient\",\n\tRadiusTool = \"RadiusTool\",\n\tRecoveryTool = \"RecoveryTool\",\n\tRectangleShapeNode = \"RectangleShapeNode\",\n\tRedirectRouteNode = \"RedirectRouteNode\",\n\tResizeTool = \"ResizeTool\",\n\tRewriteRouteNode = \"RewriteRouteNode\",\n\tRichTextEditTool = \"RichTextEditTool\",\n\tRichTextNode = \"RichTextNode\",\n\tRichTextVariableEditTool = \"RichTextVariableEditTool\",\n\tRootNode = \"RootNode\",\n\tRotateTool = \"RotateTool\",\n\tRouteNode = \"RouteNode\",\n\tRouteLocaleNode = \"RouteLocaleNode\",\n\tRouteSegmentNode = \"RouteSegmentNode\",\n\tRouteSegmentRootNode = \"RouteSegmentRootNode\",\n\tRoutesNode = \"RoutesNode\",\n\tSampleColorTool = \"SampleColorTool\",\n\tScaleTool = \"ScaleTool\",\n\tScopeNode = \"ScopeNode\",\n\tSelectTool = \"SelectTool\",\n\tShaderNode = \"ShaderNode\",\n\tShadow = \"Shadow\",\n\tShapeContainerNode = \"ShapeContainerNode\",\n\tShapeGroupNode = \"ShapeGroupNode\",\n\tSlotConnectTool = \"SlotConnectTool\",\n\tSlotNode = \"SlotNode\",\n\tSlotPropertyNode = \"SlotPropertyNode\",\n\tSmartComponentNode = \"SmartComponentNode\",\n\tStarShapeNode = \"StarShapeNode\",\n\tStringVariableEditTool = \"StringVariableEditTool\",\n\tStyledTextDraft = \"StyledTextDraft\",\n\tSVGNode = \"SVGNode\",\n\tTableStylePresetNode = \"TableStylePresetNode\",\n\tTestTool = \"TestTool\",\n\tTextEditTool = \"TextEditTool\",\n\tTextEntityTypeRootNode = \"TextEntityTypeRootNode\",\n\tTextNode = \"TextNode\",\n\tTextStylePresetNode = \"TextStylePresetNode\",\n\tVectorSetEntityTypeRootNode = \"VectorSetEntityTypeRootNode\",\n\tVectorSetNode = \"VectorSetNode\",\n\tVekterGradientTool = \"VekterGradientTool\",\n\tVekterPathEngine = \"VekterPathEngine\",\n\tVekterTool = \"VekterTool\",\n\tViewportResizeTool = \"ViewportResizeTool\",\n\tWebPageNode = \"WebPageNode\",\n\tZoomSelectTool = \"ZoomSelectTool\",\n\tZoomTool = \"ZoomTool\",\n}\n\ntype ClassDiscriminatorList = keyof typeof ClassDiscriminator\n\n// Define helper types to make `withClassDiscriminator` more readable\nclass EmptyClass {}\ntype EmptyClassType = typeof EmptyClass\ntype AnyClassType = new (...args: any[]) => {}\n\n/**\n * A mixin that adds the `__class` property into classes.\n *\n * We use the `__class` property to reliably get the stringified class discriminator (e.g., in serialization).\n * `(class {}).name` is unreliable because bundlers may rename functions and classes.\n *\n * Note: this mixin won\u2019t work with children of abstract classes due to TS limitations. For abstract classes, you\u2019ll have to use `patchClassName`\n * and do a bit of extra work. See `withClassDiscriminator` docs.\n *\n * @example\n * // With a parent class\n * class RootNode extends withClassDiscriminator(\"RootNode\", CanvasNode) { ... }\n *\n * // Without a parent class\n * class MutableNode extends withClassDiscriminator(\"MutableNode\") { ... }\n */\nexport function withClassDiscriminator<BaseClassType extends AnyClassType = EmptyClassType>(\n\tclassDiscriminator: ClassDiscriminatorList,\n\tBase: BaseClassType = class {} as BaseClassType,\n) {\n\t// NOTE: this function\u2019s implementation is carefully replicated in Library \u2192 PathSegment.\n\t// If making changes here, make sure to copy them there as well.\n\t// (We can\u2019t simply move `withClassDiscriminator` to library and avoid code duplication;\n\t// see https://github.com/framer/FramerStudio/pull/5874#issuecomment-655517491.)\n\n\tclass WithClassDiscriminator extends Base {\n\t\treadonly __class: ClassDiscriminator = ClassDiscriminator[classDiscriminator]\n\n\t\t// Add a displayName for easier debugging\n\t\tstatic displayName = `WithClassDiscriminatorMixin(${classDiscriminator})`\n\t}\n\n\t// Also: forcefully put `__class` into prototype, so that code that needs to work with classes\n\t// (instead of instances) can also access the class discriminator\n\t;(WithClassDiscriminator.prototype as any).__class = classDiscriminator\n\n\treturn WithClassDiscriminator\n}\n\n/**\n * A function that helps to add the `__class` property where `withClassDiscriminator` is not supported\n * (e.g., when you\u2019re extending an abstract class.)\n *\n * Apart from calling this function, you\u2019ll also have to add the `__class` property manually,\n * like in the example.\n *\n * @example\n * class StyledTextDraft extends StyledText<EditorState> {\n *   // Add this \u2193\n *   readonly __class: ClassDiscriminator = ClassDiscriminator.StyledTextDraft\n * }\n *\n * // And this \u2193\n * patchClassDiscriminator(StyledTextDraft)\n */\nexport function patchClassDiscriminator<ClassType extends AnyClassType>(\n\tClass: ClassType,\n\tclassDiscriminator: ClassDiscriminatorList,\n): void {\n\tClass.prototype.__class = classDiscriminator\n\t;(Class as any).displayName = `WithClassDiscriminatorMixin(${classDiscriminator})`\n}\n", "import { isObject } from \"utils/typeChecks.ts\"\nimport type { NodeID } from \"../nodes/NodeID.ts\"\nimport type { VariableID } from \"./WithVariables.ts\"\n\nconst variableReferenceKey: keyof VariableReference = \"type\"\nconst variableReferenceValue: VariableReference[\"type\"] = \"variableReference\"\n\n/**\n * Reference to an in scope variable. Either a component variable or a variable coming from some\n * data source like a CMS collection.\n */\nexport interface VariableReference {\n\treadonly type: \"variableReference\"\n\tid: VariableID\n\tproviderId?: NodeID\n}\n\nexport function isVariableReference(value: unknown): value is VariableReference {\n\treturn isObject(value) && variableReferenceKey in value && value[variableReferenceKey] === variableReferenceValue\n}\n\nexport function createVariableReference(variableId: VariableID, providerId: NodeID): VariableReference {\n\treturn {\n\t\ttype: variableReferenceValue,\n\t\tid: variableId,\n\t\tproviderId,\n\t}\n}\n\n/** Use createVariableReference if possible, providerId is only optional because we didn't add this info initially. */\nexport function instantiateExistingVariableReference(\n\tvariableId: VariableID,\n\tproviderId: NodeID | undefined,\n): VariableReference {\n\treturn {\n\t\ttype: variableReferenceValue,\n\t\tid: variableId,\n\t\tproviderId,\n\t}\n}\n\nexport function isVariableReferenceEqual(a: VariableReference, b: unknown): boolean {\n\tif (!isVariableReference(b)) return false\n\treturn a.id === b.id && a.providerId === b.providerId\n}\n\nconst inlineTransformProviderId = \"transform\" as const\n\n/**\n * A special variable reference with a constant providerId of `transform`. This is used to identify\n * the mapped variable in an arrayToArray transform. We can't use the provider of the array itself\n * because there the array item variables aren't available yet.\n */\nexport interface InlineTransformVariableReference extends VariableReference {\n\tproviderId: typeof inlineTransformProviderId\n}\n\nexport function isInlineTransformVariableReference(value: unknown): value is InlineTransformVariableReference {\n\treturn isVariableReference(value) && value.providerId === inlineTransformProviderId\n}\n\nexport function createInlineTransformVariableReference(variableId: VariableID): InlineTransformVariableReference {\n\treturn {\n\t\ttype: variableReferenceValue,\n\t\tid: variableId,\n\t\tproviderId: inlineTransformProviderId,\n\t}\n}\n", "/**\n * Matches an Internationalized Domain Name (IDN) label\n * (e.g., the \"happy-llama\" bit inside \"happy-llama.framer.website\")\n * for any Unicode language (including RTL-languages) by using Unicode property escapes\n * - `\\p{L}` matches alphanumerics (Lowercase, Uppercase, Lt, Lm, Lo, Nl, Other_Alphabetic)\n * - `\\p{M}` matches combining marks (Mn, Mc, Me)\n * - `-` matches dashes\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Unicode_character_class_escape}\n * @see {@link https://unicode.org/reports/tr44/#Alphabetic}\n * @see {@link https://unicode.org/reports/tr44/#General_Category_Values}\n */\nconst idnLabelAlphanumericDashesRegex = /^(?![\\p{L}\\p{M}\\d-]*-$)(?!-)[\\p{L}\\p{M}\\d-]+$/u\n\n/**\n * Matches an Internationalized Domain Name (IDN) for any Unicode language [e.g. www.domain.com]\n * This checks for a full domain separated with \".\"\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Unicode_character_class_escape}\n * @see {@link https://unicode.org/reports/tr44/#Alphabetic}\n * @see {@link https://unicode.org/reports/tr44/#General_Category_Values}\n */\nconst idnAlphanumericDashesRegex = /^(?:[\\p{L}\\p{M}\\d](?:[\\p{L}\\p{M}\\d-]*[\\p{L}\\p{M}\\d])?\\.)+[\\p{L}\\p{M}]+$/u\n\nexport enum Option {\n\tFreeDomain = \"free-domain\",\n\tDomainToBuy = \"domain-to-buy\",\n\tOwnDomain = \"own-domain\",\n}\n\nexport enum DomainHostnameErrorType {\n\tEmpty = \"Empty\",\n\tInvalidPhrase = \"InvalidPhrase\",\n\tInvalidCharacter = \"InvalidCharacter\",\n}\n\n/** validateDomainName checks the full domain (www.{label}.com) or just the label for subdomains\n *\n * @param value the domain or domain label\n * @param isSubdomain checks label if true, domain if not\n * @returns DomainHostnameErrorType or null for valid domains\n */\nexport function validateDomainName(value: string, isSubdomain: boolean): DomainHostnameErrorType | null {\n\tif (!value) return DomainHostnameErrorType.Empty\n\n\tif (isSubdomain && value === \"www\") return DomainHostnameErrorType.InvalidPhrase\n\n\tconst regex = isSubdomain ? idnLabelAlphanumericDashesRegex : idnAlphanumericDashesRegex\n\n\tif (!regex.exec(value)) return DomainHostnameErrorType.InvalidCharacter\n\n\treturn null\n}\n\n// This checks if the value is a valid url with a protocol.\nexport function isValidURL(value: string, onlyHttp = false): boolean {\n\ttry {\n\t\tconst url = new URL(value)\n\n\t\tif (url.protocol === \"http:\" || url.protocol === \"https:\") {\n\t\t\t// Localhost doesn't require a top level domain.\n\t\t\tif (url.hostname === \"localhost\") return true\n\t\t\t// Chrome accepts \"https://bla bla.com\" as a valid URL, so we manually double-check the\n\t\t\t// hostname. According to the spec, it should only be letters, digits, and hyphens, and\n\t\t\t// dots as the separator.\n\t\t\treturn idnAlphanumericDashesRegex.test(url.hostname)\n\t\t}\n\n\t\treturn !onlyHttp\n\t} catch {\n\t\treturn false\n\t}\n}\n\n/**\n * Check if it's a valid host+pathname combo, e.g., \"framer.com\" or\n * \"framer.com/templates\". This is helpful if you want to auto-complete the\n * protocol, presumably with \"https://\".\n *\n * We require that the host has at least one dot in it, to exclude cases like\n * \"blog\" => \"https://blog\". While theoretically valid, it's rarely valid in\n * practice.\n */\nexport function isValidURLWithoutProtocol(urlString: string): boolean {\n\tconst urlWithoutSearchOrHash = urlString.split(/#|\\?/u)[0]\n\tif (!urlWithoutSearchOrHash) return false\n\n\tconst [host, pathnameWithoutSlash = \"\"] = urlWithoutSearchOrHash.split(\"/\", 2)\n\tconst pathname = \"/\" + pathnameWithoutSlash\n\tconst url = new URL(\"https://example.com\")\n\turl.host = host\n\turl.pathname = pathname\n\treturn Boolean(url.hostname.match(/.+\\..+/)) && url.href === `https://${host}/${pathnameWithoutSlash}`\n}\n", "import { isValidURL } from \"document/utils/domainValidation.ts\"\n\ntype ValidationResult = { result: \"ok\"; normalizedValue: string } | { result: \"error\"; message: string }\n\nexport function validateCustomCanonicalURL(value: string): ValidationResult {\n\tvalue = value.trim()\n\n\tif (!value) {\n\t\treturn { result: \"error\", message: \"Please enter a valid URL\" }\n\t}\n\n\tif (isValidURL(value, true)) {\n\t\treturn { result: \"ok\", normalizedValue: value }\n\t}\n\n\t// Try and validate with protocol.\n\tif (isValidURL(`https://${value}`)) {\n\t\treturn { result: \"ok\", normalizedValue: `https://${value}` }\n\t}\n\n\treturn { result: \"error\", message: \"Please enter a valid URL\" }\n}\n", "import { assert } from \"@framerjs/shared\"\nimport type {\n\tBooleanControlProp,\n\tColorControlProp,\n\tImageControlProp,\n\tLinkControlProp,\n\tNumberControlProp,\n\tStringControlProp,\n} from \"document/models/controlProps/ControlProp.ts\"\nimport { validateCustomCanonicalURL } from \"document/utils/validateCustomCanonicalURL.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isEqual } from \"library/render/utils/isEqual.ts\"\nimport { pathVariablesRegExpGlobal } from \"library/router/pathVariables.ts\"\nimport { isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { DynamicValue } from \"./DynamicValue.ts\"\nimport type { VariableReference } from \"./VariableReference.ts\"\n\nexport type FetchDataValueResolver = (value: FetchDataValue) => unknown\n\ntype VariableValue = string | VariableReference\n\nexport type FetchDataControlProp =\n\t| StringControlProp\n\t| NumberControlProp\n\t| BooleanControlProp\n\t| ImageControlProp\n\t| LinkControlProp\n\t| ColorControlProp\n\nexport interface FetchDataValue {\n\ttype: \"fetchDataValue\"\n\turl: string\n\tcacheDuration: number\n\tresultKeyPath: string\n\tvariables: Record<string, VariableValue>\n\t// The ControlProp determines the output type of the resolved value and its fallback value.\n\tcontrolProp?: FetchDataControlProp\n\terrorControlProp?: StringControlProp\n\tcredentials?: RequestCredentials\n\n\t/** @deprecated */\n\tfallbackValue?: string | boolean | number | DynamicValue\n\t/** @deprecated */\n\treadonly resultOutputType?: ControlType.String | ControlType.Boolean | ControlType.Number\n}\n\nexport type SafeFetchDataValue = Required<Pick<FetchDataValue, \"controlProp\">> &\n\tOmit<FetchDataValue, \"control\" | \"fallbackValue\" | \"resultOutputType\">\n\nconst typeKey: keyof FetchDataValue = \"type\"\nconst typeValue: FetchDataValue[\"type\"] = \"fetchDataValue\"\n\nexport function isFetchDataValue(value: unknown): value is FetchDataValue {\n\treturn isObject(value) && typeKey in value && value[typeKey] === typeValue\n}\n\nexport function isConfiguredFetchDataValue(value: FetchDataValue): boolean {\n\tif (validateCustomCanonicalURL(value.url).result === \"error\") return false\n\n\treturn true\n}\n\nexport function patchFetchValue(value: FetchDataValue): SafeFetchDataValue {\n\tif (value.controlProp) {\n\t\treturn value as SafeFetchDataValue\n\t}\n\n\treturn {\n\t\tcacheDuration: value.cacheDuration,\n\t\tresultKeyPath: value.resultKeyPath,\n\t\ttype: \"fetchDataValue\",\n\t\turl: value.url,\n\t\tvariables: value.variables,\n\t\tcontrolProp: {\n\t\t\ttype: value.resultOutputType,\n\t\t\tvalue: value.fallbackValue,\n\t\t} as FetchDataControlProp,\n\t\terrorControlProp: undefined,\n\t}\n}\n\nexport function getFetchFallbackValue(value: FetchDataValue): FetchDataControlProp[\"value\"] {\n\tif (value.controlProp) {\n\t\treturn value.controlProp.value\n\t}\n\n\tconst fallback = value.fallbackValue\n\n\t// TODO: Remove fallbackValue in favor of controlProp.value\n\tassert(!isUndefined(fallback), \"fallbackValue must be defined\")\n\n\treturn fallback\n}\n\nexport function createFetchDataValue(controlProp: FetchDataControlProp): FetchDataValue {\n\treturn {\n\t\ttype: \"fetchDataValue\",\n\t\turl: \"\",\n\t\tcredentials: \"same-origin\",\n\t\tresultKeyPath: \"\",\n\t\tcontrolProp: controlProp,\n\t\terrorControlProp:\n\t\t\tcontrolProp.type === ControlType.String\n\t\t\t\t? {\n\t\t\t\t\t\ttype: ControlType.String,\n\t\t\t\t\t\tvalue: \"Error\",\n\t\t\t\t\t}\n\t\t\t\t: undefined,\n\t\tvariables: {},\n\t\tcacheDuration: 0,\n\t}\n}\n\nexport function isFetchDataValueEqual(a: FetchDataValue, b: unknown): boolean {\n\tif (!isFetchDataValue(b)) return false\n\n\tif (a.url !== b.url) return false\n\tif (a.resultKeyPath !== b.resultKeyPath) return false\n\tif (a.cacheDuration !== b.cacheDuration) return false\n\tif (a.fallbackValue !== b.fallbackValue) return false\n\n\tconst aUsedVariableNames = collectVariablesFromURL(a.url)\n\tconst bUsedVariableNames = collectVariablesFromURL(b.url)\n\n\tif (aUsedVariableNames.length !== bUsedVariableNames.length) return false\n\tfor (const key in a.variables) {\n\t\tif (!isEqual(a.variables[key], b.variables[key])) return false\n\t}\n\n\treturn true\n}\n\nexport function fillVariablesInURL(value: FetchDataValue, resolveVariable: (variable: VariableReference) => string) {\n\tconst validatedUrl = validateCustomCanonicalURL(value.url)\n\tif (validatedUrl.result !== \"ok\") return value.url\n\n\tconst normalizedUrl = validatedUrl.normalizedValue\n\tconst filled = normalizedUrl.replaceAll(pathVariablesRegExpGlobal, (_, variableName) => {\n\t\tconst variable = value.variables[variableName]\n\t\tif (!variable) {\n\t\t\t// Variables _could_ be empty for example when used in query params. So fallback to empty stringf if not explicitly defined.\n\t\t\treturn \"\"\n\t\t}\n\n\t\tif (isString(variable)) {\n\t\t\treturn variable\n\t\t}\n\n\t\treturn resolveVariable(variable)\n\t})\n\n\treturn filled\n}\n\nexport function collectVariablesFromURL(url: string) {\n\tconst matches = url.matchAll(pathVariablesRegExpGlobal)\n\n\tconst variables = new Set<string>()\n\tfor (const match of matches) {\n\t\tconst variable = match[1]\n\t\tif (!variable) continue\n\n\t\tif (variable.length === 0) continue\n\t\tvariables.add(variable)\n\t}\n\n\treturn Array.from(variables)\n}\n\nexport const fetchPresetURLs = [\n\t\"https://api.fetch.tools/weather?city=:city\",\n\t\"https://api.fetch.tools/views\",\n\t\"https://api.fetch.tools/location\",\n\t\"https://api.fetch.tools/emoji\",\n]\n", "/**\n * A convenience alternative to the following:\n *\n * ```ts\n * const keys = Object.keys(foo) as (keyof typeof foo)[]\n * ```\n *\n * **Use with caution!** [There's a reason why TypeScript doesn't do this out of the\n * box](https://stackoverflow.com/a/55012175/242684).\n */\nexport function getKeys<K extends string>(value: Record<K, unknown>): readonly K[] {\n\treturn Object.keys(value) as K[]\n}\n", "import { capitalizeFirstLetter } from \"./capitalizeFirstLetter.ts\"\n\n/** Chunks a string into meaningful groups of characters (words, acronyms or numbers) */\n/** \\p{Uppercase_Letter}{2,}: Extracts uppercase groups with a minimum length of 2 */\n/**            (Min. length of 2 to avoid conflicts with capitalized words) */\n/** \\p{Uppercase_Letter}\\p{Lowercase_Letter}+: Extracts capitalized groups */\n/** \\p{Lowercase_Letter}+: Extracts lowercase groups */\n/** \\p{Uppercase_Letter}: Extracts uppercase groups with a length of 1 */\n/** \\d+: Extracts number groups */\nconst groupsRegex =\n\t/\\p{Uppercase_Letter}{2,}|\\p{Uppercase_Letter}\\p{Lowercase_Letter}+|\\p{Lowercase_Letter}+|\\p{Uppercase_Letter}|\\d+/gu\n\nexport function titleCase(value: string): string {\n\tconst groups = value.match(groupsRegex)\n\n\treturn groups?.map(group => capitalizeFirstLetter(group)).join(\" \") ?? value\n}\n", "import { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { objectKeys } from \"library/utils/objectKeys.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport type { VariableType } from \"../WithVariables.ts\"\n\nconst allVariableTypes: Record<VariableType, true> = {\n\t[ControlType.Array]: true,\n\t[ControlType.Boolean]: true,\n\t[ControlType.Color]: true,\n\t[ControlType.EventHandler]: true,\n\t[ControlType.Image]: true,\n\t[ControlType.Number]: true,\n\t[ControlType.String]: true,\n\t[ControlType.RichText]: true,\n\t[ControlType.Link]: true,\n\t[ControlType.LinkRelValues]: true,\n\t[ControlType.Date]: true,\n\t[ControlType.Enum]: true,\n\t[ControlType.File]: true,\n\t[ControlType.ScrollSectionRef]: true,\n\t[ControlType.CustomCursor]: true,\n\t[ControlType.Cursor]: true,\n\t[ControlType.Transition]: true,\n\t[ControlType.Border]: true,\n\t[ControlType.BoxShadow]: true,\n\t[ControlType.Gap]: true,\n\t[ControlType.Padding]: true,\n\t[ControlType.BorderRadius]: true,\n\t[ControlType.CollectionReference]: true,\n\t[ControlType.Location]: true,\n\t[ControlType.MultiCollectionReference]: true,\n\t[ControlType.TrackingId]: true,\n\t[ControlType.VectorSetItem]: true,\n\tcontrolReference: true,\n\tnodePropertyControlReference: true,\n\tslug: true,\n}\n\nexport function isVariableType(type: unknown): type is VariableType {\n\treturn isString(type) && Object.hasOwn(allVariableTypes, type)\n}\n\nexport function variableTypesMatching<T extends VariableType>(filter: (type: VariableType) => type is T): T[] {\n\treturn objectKeys(allVariableTypes).filter(filter)\n}\n", "import { assert, assertNever } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { EnumValueType } from \"document/components/chrome/properties/codeComponentRows/utils/isValidPropertyValue.ts\"\nimport type { LocalizedValues } from \"document/models/LocalizedValue.ts\"\nimport type { ImageControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { objectKeys } from \"library/utils/objectKeys.ts\"\nimport { getKeys } from \"utils/getKeys.ts\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { isNull, isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { NodeID } from \"../nodes/NodeID.ts\"\nimport type {\n\tFourPixelNumberShorthand,\n\tRelativeOrFourPixelNumberShorthand,\n\tTwoPixelNumberShorthand,\n} from \"./NumberShorthand.ts\"\nimport type { InlineTransformVariableReference, VariableReference } from \"./VariableReference.ts\"\nimport { isVariableReference } from \"./VariableReference.ts\"\nimport type { VariableType } from \"./WithVariables.ts\"\nimport type { Link } from \"./utils/Link.ts\"\nimport type { OmitEvery } from \"./utils/OmitEvery.ts\"\nimport { isVariableType } from \"./utils/isVariableType.ts\"\nimport type {\n\tDateDisplayOption,\n\tDateFormatOption,\n\tDateStyleOption,\n\tRelativeDateFormatOption,\n\tRelativeDateStyleOption,\n} from \"./utils/toDateStringTransformOptions.ts\"\n\nexport type ValueTransformType = VariableType | ControlType.ResponsiveImage\n\nconst nonVariableTransformTypes: Record<Exclude<ValueTransformType, VariableType>, true> = {\n\t[ControlType.ResponsiveImage]: true,\n}\n\nexport function isValueTransformType(type: unknown): type is ValueTransformType {\n\tif (isVariableType(type)) return true\n\treturn isString(type) && type in nonVariableTransformTypes\n}\n\nconst typeKey: keyof ValueTransform = \"type\"\nconst typeValue: ValueTransform[\"type\"] = \"valueTransform\"\n\nconst queryableValueTransformNameList = [\n\t\"contains\",\n\t\"containsAny\",\n\t\"containsAll\",\n\t\"startsWith\",\n\t\"endsWith\",\n\t\"equals\",\n\t\"isSet\",\n\t\"greaterThan\",\n\t\"lessThan\",\n\t\"negate\",\n\t\"toBoolean\",\n\t\"isBefore\",\n\t\"isAfter\",\n\t\"isBetweenDates\",\n\t\"isIncludedIn\",\n\t\"convertFromEnum\",\n\t\"convertFromString\",\n] as const satisfies readonly ValueTransformName[]\n\nexport type QueryableValueTransformName = (typeof queryableValueTransformNameList)[number]\n\nexport const queryableValueTransformName: ReadonlySet<ValueTransformName> = new Set(queryableValueTransformNameList)\n\n/** Constant value transforms generate a single function. */\nexport type ValueTransformConstantName =\n\t| \"equals\"\n\t| \"startsWith\"\n\t| \"endsWith\"\n\t| \"contains\"\n\t| \"containsAny\"\n\t| \"containsAll\"\n\t| \"isSet\"\n\t| \"greaterThan\"\n\t| \"lessThan\"\n\t| \"negate\"\n\t| \"numberToPixelString\"\n\t| \"radiusForCorner\"\n\t| \"percentageToCornerShape\"\n\t| \"isBefore\"\n\t| \"isAfter\"\n\t| \"isBetweenDates\"\n\t| \"numberToString\"\n\t| \"extractDateSegment\"\n\t| \"toString\"\n\t| \"toNumber\"\n\t| \"toBoolean\"\n\t| \"reverseArray\"\n\t| \"offsetAndLimitArray\"\n\t| \"arrayLength\"\n\t| \"prefix\"\n\t| \"suffix\"\n\t| \"toResponsiveImage\"\n\t| \"toImageSrc\"\n\t| \"toZIndex\"\n\t| \"toAxisOverflow\"\n\t| \"toOverflowWithClipFallback\"\n\t| \"jsonStringify\"\n\t| \"htmlEscape\"\n\t| \"htmlUnescape\"\n\t| \"addImageAlt\"\n\t| \"isIncludedIn\"\n\t| \"isOdd\"\n\t| \"isEven\"\n\t| \"getGridColumnCSSValue\"\n\t| \"getGridRowCSSValue\"\n\t| \"getNumericColumnGap\"\n\t| \"toggleInList\"\n\n/** Dynamic value transforms generate a different function depending on the transform options. */\nexport type ValueTransformDynamicName =\n\t| \"enumToDisplayName\"\n\t| \"convertFromEnum\"\n\t| \"convertFromBoolean\"\n\t| \"convertFromString\"\n\t| \"arrayToArray\"\n\t| \"toDateString\"\n\nexport type ValueTransformName = ValueTransformConstantName | ValueTransformDynamicName\n\nconst valueTransformConstantNameRecord: Record<ValueTransformConstantName, true> = {\n\tisSet: true,\n\tequals: true,\n\tstartsWith: true,\n\tendsWith: true,\n\tcontains: true,\n\tcontainsAny: true,\n\tcontainsAll: true,\n\tgreaterThan: true,\n\tlessThan: true,\n\tnegate: true,\n\tnumberToPixelString: true,\n\tradiusForCorner: true,\n\tpercentageToCornerShape: true,\n\tisBefore: true,\n\tisAfter: true,\n\tisBetweenDates: true,\n\ttoString: true,\n\tnumberToString: true,\n\textractDateSegment: true,\n\ttoNumber: true,\n\ttoBoolean: true,\n\treverseArray: true,\n\toffsetAndLimitArray: true,\n\tarrayLength: true,\n\tprefix: true,\n\tsuffix: true,\n\ttoResponsiveImage: true,\n\ttoImageSrc: true,\n\ttoZIndex: true,\n\ttoAxisOverflow: true,\n\ttoOverflowWithClipFallback: true,\n\tjsonStringify: true,\n\thtmlEscape: true,\n\thtmlUnescape: true,\n\taddImageAlt: true,\n\tisIncludedIn: true,\n\tisEven: true,\n\tisOdd: true,\n\tgetGridColumnCSSValue: true,\n\tgetGridRowCSSValue: true,\n\tgetNumericColumnGap: true,\n\ttoggleInList: true,\n}\n\nexport function isQueryableValueTransformName(name: ValueTransformName): name is QueryableValueTransformName {\n\treturn queryableValueTransformName.has(name)\n}\n\nexport function isValueTransformConstantName(name: string): name is ValueTransformConstantName {\n\treturn Object.hasOwn(valueTransformConstantNameRecord, name)\n}\n\nconst valueTransformDynamicNameRecord: Record<ValueTransformDynamicName, true> = {\n\tenumToDisplayName: true,\n\tconvertFromEnum: true,\n\tconvertFromBoolean: true,\n\tconvertFromString: true,\n\tarrayToArray: true,\n\ttoDateString: true,\n}\n\nexport function isValueTransformDynamicName(name: string): name is ValueTransformDynamicName {\n\treturn Object.hasOwn(valueTransformDynamicNameRecord, name)\n}\n\n/** This is the order how they are presented in the UI. */\nconst allValueTransformsInOrderOfImportance: Readonly<Record<ValueTransformName, true>> = {\n\tisSet: true,\n\tconvertFromEnum: true,\n\tconvertFromBoolean: true,\n\tconvertFromString: true,\n\tenumToDisplayName: true,\n\tequals: true,\n\tstartsWith: true,\n\tendsWith: true,\n\tcontains: true,\n\tcontainsAny: true,\n\tcontainsAll: true,\n\tgreaterThan: true,\n\tlessThan: true,\n\tisEven: true,\n\tisOdd: true,\n\tnegate: true,\n\tnumberToPixelString: true,\n\tradiusForCorner: true,\n\tpercentageToCornerShape: true,\n\tisBefore: true,\n\tisAfter: true,\n\tisBetweenDates: true,\n\ttoString: true,\n\tnumberToString: true,\n\ttoDateString: true,\n\ttoNumber: true,\n\ttoBoolean: true,\n\treverseArray: true,\n\toffsetAndLimitArray: true,\n\tarrayLength: true,\n\tprefix: true,\n\tsuffix: true,\n\ttoResponsiveImage: true,\n\ttoImageSrc: true,\n\ttoZIndex: true,\n\ttoAxisOverflow: true,\n\ttoOverflowWithClipFallback: true,\n\tjsonStringify: true,\n\thtmlEscape: true,\n\thtmlUnescape: true,\n\taddImageAlt: true,\n\tisIncludedIn: true,\n\tarrayToArray: true,\n\tgetGridColumnCSSValue: true,\n\tgetGridRowCSSValue: true,\n\tgetNumericColumnGap: true,\n\textractDateSegment: true,\n\ttoggleInList: true,\n}\n\nconst allValueTransformNames: readonly ValueTransformName[] = getKeys(allValueTransformsInOrderOfImportance)\n\nexport const getEnabledValueTransformNames = () => allValueTransformNames\n\ntype NonNullKeysOf<T, K extends keyof T> = { [P in K]: T[P] extends null ? never : P }[K]\n\n/** Transform names that can be picked from the UI */\nexport type PublicValueTransformName = NonNullKeysOf<typeof valueTransformInputTypes, ValueTransformName>\n\nexport function isPublicValueTransformName(name: ValueTransformName): name is PublicValueTransformName {\n\tconst inputTypes = valueTransformInputTypes[name]\n\tconst isInternal =\n\t\t// Transform is known, but not public\n\t\tisNull(inputTypes) ||\n\t\t// Transform is unknown (rolled back document, multiplayer mixed version, etc.)\n\t\tisUndefined(inputTypes)\n\n\treturn !isInternal\n}\n\n/** Queryable transform names that can be picked from the UI */\nexport type CollectionFilterTransformName = NonNullKeysOf<typeof valueTransformInputTypes, QueryableValueTransformName>\n\nexport type CollectionFilterTransform = Extract<ValueTransform, { name: CollectionFilterTransformName }>\n\nexport function isCollectionFilterTransform(transform: ValueTransform): transform is CollectionFilterTransform {\n\treturn isQueryableValueTransformName(transform.name) && getInputTypesForValueTransformName(transform.name) !== null\n}\n\n/** Value transforms might be unknown after a rolling back a release */\nexport function isKnownValueTransformName(name: string): name is ValueTransformName {\n\treturn isValueTransformConstantName(name) || isValueTransformDynamicName(name)\n}\n\nexport type ValueTransform =\n\t| ValueTransformIsBefore\n\t| ValueTransformIsAfter\n\t| ValueTransformIsBetweenDates\n\t| ValueTransformEquals\n\t| ValueTransformStartsWith\n\t| ValueTransformEndsWith\n\t| ValueTransformContains\n\t| ValueTransformContainsAny\n\t| ValueTransformContainsAll\n\t| ValueTransformIsSet\n\t| ValueTransformGreaterThan\n\t| ValueTransformLessThan\n\t| ValueTransformNegate\n\t| ValueTransformNumberToString\n\t| ValueTransformNumberToPixelString\n\t| ValueTransformRadiusForCorner\n\t| ValueTransformPercentageToCornerShape\n\t| ValueTransformToString\n\t| ValueTransformToNumber\n\t| ValueTransformToBoolean\n\t| ValueTransformToDateString\n\t| ValueTransformReverseArray\n\t| ValueTransformOffsetAndLimitArray\n\t| ValueTransformArrayLength\n\t| ValueTransformArrayToArray\n\t| ValueTransformToResponsiveImage\n\t| ValueTransformToImageSrc\n\t| ValueTransformToZIndex\n\t| ValueTransformToOverflow\n\t| ValueTransformToOverflowWithClipFallback\n\t| ValueTransformPrefix\n\t| ValueTransformSuffix\n\t| ValueTransformJsonStringify\n\t| ValueTransformHtmlEscape\n\t| ValueTransformHtmlUnescape\n\t| ValueTransformEnumToDisplayName\n\t| ValueTransformConvertFromEnum\n\t| ValueTransformConvertFromBoolean\n\t| ValueTransformConvertFromString\n\t| ValueTransformAddImageAlt\n\t| ValueTransformIsIncludedIn\n\t| ValueTransformIsEven\n\t| ValueTransformIsOdd\n\t| ValueTransformGetGridColumnCSSValue\n\t| ValueTransformGetGridRowCSSValue\n\t| ValueTransformGetNumericColumnGap\n\t| ValueTransformExtractDateSegment\n\t| ValueTransformToggleInList\n\nexport type ValueTransformWithoutIdAndType<T = ValueTransform> = OmitEvery<T, \"id\" | \"type\">\n\ntype AtLeastOneValueTransformName = [ValueTransformName, ...ValueTransformName[]]\ntype AtLeastOneValueTransformNameReadonly = readonly [ValueTransformName, ...ValueTransformName[]]\ntype AtLeastOneValueTransformTypeReadonly = readonly [ValueTransformType, ...ValueTransformType[]]\n\ntype ValueTransformInputTypes = Readonly<Record<ValueTransformName, AtLeastOneValueTransformTypeReadonly | null>>\n\nconst isSetTransformInputTypes = [\n\tControlType.Boolean,\n\tControlType.Number,\n\tControlType.String,\n\tControlType.Image,\n\tControlType.Date,\n\tControlType.ResponsiveImage,\n\tControlType.Link,\n\tControlType.File,\n\tControlType.RichText,\n\tControlType.Array,\n\tControlType.CollectionReference,\n\tControlType.MultiCollectionReference,\n] as const satisfies ValueTransformType[]\n\ntype IsSetTransformInputType = (typeof isSetTransformInputTypes)[number]\n\nexport function isSetTransformInputType(type: ControlType): type is IsSetTransformInputType {\n\treturn isSetTransformInputTypes.includes(type as IsSetTransformInputType)\n}\n\nconst valueTransformInputTypes = {\n\tcontains: [ControlType.String, ControlType.MultiCollectionReference],\n\tcontainsAny: [ControlType.MultiCollectionReference],\n\tcontainsAll: [ControlType.MultiCollectionReference],\n\tendsWith: [ControlType.String],\n\tstartsWith: [ControlType.String],\n\tprefix: [ControlType.String],\n\tsuffix: [ControlType.String],\n\tequals: [\n\t\tControlType.String,\n\t\tControlType.Boolean,\n\t\tControlType.Number,\n\t\tControlType.Enum,\n\t\tControlType.Date,\n\t\tControlType.CollectionReference,\n\t],\n\tisSet: isSetTransformInputTypes,\n\tgreaterThan: [ControlType.Number],\n\tlessThan: [ControlType.Number],\n\tnegate: [ControlType.Boolean],\n\tisBefore: [ControlType.Date],\n\tisAfter: [ControlType.Date],\n\tisBetweenDates: [ControlType.Date],\n\ttoDateString: [ControlType.Date],\n\ttoString: [ControlType.Number],\n\tnumberToString: [ControlType.Number],\n\tisEven: [ControlType.Number],\n\tisOdd: [ControlType.Number],\n\tenumToDisplayName: [ControlType.Enum],\n\tconvertFromEnum: [ControlType.Enum],\n\tconvertFromBoolean: [ControlType.Boolean],\n\tisIncludedIn: [ControlType.CollectionReference],\n\tconvertFromString: [ControlType.String],\n\tarrayLength: [ControlType.Array],\n\textractDateSegment: [ControlType.Date],\n\ttoggleInList: [ControlType.MultiCollectionReference],\n\t// These return null because they can't be picked from the UI (yet)\n\tarrayToArray: null,\n\treverseArray: null,\n\toffsetAndLimitArray: null,\n\ttoBoolean: null,\n\ttoNumber: null,\n\ttoResponsiveImage: null,\n\ttoImageSrc: null,\n\ttoZIndex: null,\n\ttoAxisOverflow: null,\n\ttoOverflowWithClipFallback: null,\n\tjsonStringify: null,\n\thtmlEscape: null,\n\thtmlUnescape: null,\n\taddImageAlt: null,\n\tnumberToPixelString: null,\n\tradiusForCorner: null,\n\tpercentageToCornerShape: null,\n\tgetGridColumnCSSValue: null,\n\tgetGridRowCSSValue: null,\n\tgetNumericColumnGap: null,\n} as const satisfies ValueTransformInputTypes\n\nconst getInputTypeToValueTransforms = (() => {\n\tlet lazyResult: Map<ValueTransformType, AtLeastOneValueTransformName> | null = null\n\n\treturn (): ReadonlyMap<ValueTransformType, AtLeastOneValueTransformNameReadonly> => {\n\t\tif (lazyResult) return lazyResult\n\n\t\tlazyResult = new Map()\n\n\t\t// Make sure we list transforms in the same order as the main list\n\t\tfor (const valueTransformName of getEnabledValueTransformNames()) {\n\t\t\tconst inputTypes = valueTransformInputTypes[valueTransformName]\n\t\t\tif (!inputTypes) continue\n\n\t\t\tfor (const inputType of inputTypes) {\n\t\t\t\tconst existingTransformList = lazyResult.get(inputType)\n\t\t\t\tif (existingTransformList) {\n\t\t\t\t\texistingTransformList.push(valueTransformName)\n\t\t\t\t} else {\n\t\t\t\t\tlazyResult.set(inputType, [valueTransformName])\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn lazyResult\n\t}\n})()\n\nexport function getValueTransformNamesForInputType(\n\tinputType: ValueTransformType,\n): AtLeastOneValueTransformNameReadonly | undefined {\n\treturn getInputTypeToValueTransforms().get(inputType)\n}\n\nexport function inputTypeCanBeTransformed(type: ValueTransformType): boolean {\n\tconst valueTransforms = getValueTransformNamesForInputType(type)\n\treturn Boolean(valueTransforms && valueTransforms.length > 0)\n}\n\nexport function getInputTypesForValueTransformName(\n\tvalueTransformName: ValueTransformName,\n): AtLeastOneValueTransformTypeReadonly | null {\n\treturn valueTransformInputTypes[valueTransformName]\n}\n\ntype ValueParameterKeysOf<T extends CollectionFilterTransform> = Exclude<keyof T, keyof ValueTransformBase>\n\ntype CollectionFilterTransformValueTypes = {\n\t[T in CollectionFilterTransform as T[\"name\"]]?: Readonly<\n\t\tRecord<ValueParameterKeysOf<T>, AtLeastOneValueTransformTypeReadonly>\n\t>\n}\n\nconst collectionFilterTransformValueTypes: CollectionFilterTransformValueTypes = {\n\tcontains: { value: [ControlType.String, ControlType.CollectionReference] },\n\tcontainsAny: { value: [ControlType.MultiCollectionReference] },\n\tcontainsAll: { value: [ControlType.MultiCollectionReference] },\n\tendsWith: { value: [ControlType.String] },\n\tstartsWith: { value: [ControlType.String] },\n\tequals: {\n\t\tvalue: [\n\t\t\tControlType.String,\n\t\t\tControlType.Boolean,\n\t\t\tControlType.Number,\n\t\t\tControlType.Enum,\n\t\t\tControlType.Date,\n\t\t\tControlType.CollectionReference,\n\t\t],\n\t},\n\tgreaterThan: { value: [ControlType.Number] },\n\tlessThan: { value: [ControlType.Number] },\n\tisBefore: { value: [ControlType.Date] },\n\tisAfter: { value: [ControlType.Date] },\n\tisBetweenDates: { start: [ControlType.Date], end: [ControlType.Date] },\n\tisIncludedIn: { value: [ControlType.MultiCollectionReference] },\n}\n\nexport function getCollectionFilterTransformValueTypes<T extends CollectionFilterTransformName>(transformName: T) {\n\treturn collectionFilterTransformValueTypes[transformName]\n}\n\ntype ValueTransformOutputTypes = Readonly<Record<ValueTransformName, AtLeastOneValueTransformTypeReadonly>>\n\nexport const valueTransformOutputTypes = {\n\tcontains: [ControlType.Boolean],\n\tcontainsAny: [ControlType.Boolean],\n\tcontainsAll: [ControlType.Boolean],\n\tendsWith: [ControlType.Boolean],\n\tequals: [ControlType.Boolean],\n\tstartsWith: [ControlType.Boolean],\n\tisSet: [ControlType.Boolean],\n\tgreaterThan: [ControlType.Boolean],\n\tlessThan: [ControlType.Boolean],\n\tnegate: [ControlType.Boolean],\n\tisBefore: [ControlType.Boolean],\n\tisAfter: [ControlType.Boolean],\n\tisBetweenDates: [ControlType.Boolean],\n\ttoString: [ControlType.String],\n\ttoDateString: [ControlType.String],\n\tnumberToString: [ControlType.String],\n\tprefix: [ControlType.String],\n\tsuffix: [ControlType.String],\n\ttoNumber: [ControlType.Number],\n\ttoBoolean: [ControlType.Boolean],\n\treverseArray: [ControlType.Array],\n\toffsetAndLimitArray: [ControlType.Array],\n\tarrayToArray: [ControlType.Array],\n\tarrayLength: [ControlType.Number],\n\tisEven: [ControlType.Boolean],\n\tisOdd: [ControlType.Boolean],\n\ttoResponsiveImage: [ControlType.ResponsiveImage],\n\ttoImageSrc: [ControlType.Image],\n\ttoZIndex: [ControlType.Number],\n\ttoAxisOverflow: [ControlType.String],\n\ttoOverflowWithClipFallback: [ControlType.String],\n\tjsonStringify: [ControlType.String],\n\thtmlEscape: [ControlType.String],\n\thtmlUnescape: [ControlType.String],\n\tenumToDisplayName: [ControlType.String],\n\tconvertFromEnum: [\n\t\tControlType.String,\n\t\tControlType.Boolean,\n\t\tControlType.Enum,\n\t\tControlType.Number,\n\t\tControlType.Gap,\n\t\tControlType.Padding,\n\t\tControlType.BorderRadius,\n\t\tControlType.Color,\n\t\tControlType.Link,\n\t],\n\tconvertFromBoolean: [\n\t\tControlType.String,\n\t\tControlType.Enum,\n\t\tControlType.Number,\n\t\tControlType.Gap,\n\t\tControlType.Padding,\n\t\tControlType.BorderRadius,\n\t\tControlType.Color,\n\t\tControlType.Link,\n\t],\n\tconvertFromString: [\n\t\tControlType.String,\n\t\tControlType.Boolean,\n\t\tControlType.Enum,\n\t\tControlType.Number,\n\t\tControlType.Gap,\n\t\tControlType.Padding,\n\t\tControlType.BorderRadius,\n\t\tControlType.Color,\n\t\tControlType.Link,\n\t],\n\taddImageAlt: [ControlType.ResponsiveImage],\n\tnumberToPixelString: [ControlType.String],\n\tradiusForCorner: [ControlType.String],\n\tpercentageToCornerShape: [ControlType.Number],\n\tisIncludedIn: [ControlType.Boolean],\n\tgetGridColumnCSSValue: [ControlType.String],\n\tgetGridRowCSSValue: [ControlType.String],\n\tgetNumericColumnGap: [ControlType.Number],\n\textractDateSegment: [ControlType.Number],\n\ttoggleInList: [ControlType.MultiCollectionReference],\n} as const satisfies ValueTransformOutputTypes\n\nconst getOutputTypeToValueTransforms = (() => {\n\tlet lazyResult: Map<ValueTransformType, AtLeastOneValueTransformName> | null = null\n\treturn (): ReadonlyMap<ValueTransformType, AtLeastOneValueTransformNameReadonly> => {\n\t\tif (lazyResult) return lazyResult\n\n\t\tlazyResult = new Map()\n\n\t\t// Make sure we list transforms in the same order as the main list\n\t\tfor (const valueTransformName of getEnabledValueTransformNames()) {\n\t\t\tconst outputTypes = valueTransformOutputTypes[valueTransformName]\n\t\t\tfor (const outputType of outputTypes) {\n\t\t\t\tconst existingTransformList = lazyResult.get(outputType)\n\t\t\t\tif (existingTransformList) {\n\t\t\t\t\texistingTransformList.push(valueTransformName)\n\t\t\t\t} else {\n\t\t\t\t\tlazyResult.set(outputType, [valueTransformName])\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn lazyResult\n\t}\n})()\n\nexport function getValueTransformNamesForOutputType(\n\toutputType: ValueTransformType,\n): AtLeastOneValueTransformNameReadonly | undefined {\n\treturn getOutputTypeToValueTransforms().get(outputType)\n}\n\nexport function getOutputTypesForValueTransformName(\n\tvalueTransformName: ValueTransformName,\n): AtLeastOneValueTransformTypeReadonly {\n\treturn valueTransformOutputTypes[valueTransformName]\n}\n\nexport function getOutputTypeForValueTransform(valueTransform: ValueTransform): ValueTransformType {\n\tswitch (valueTransform.name) {\n\t\tcase \"convertFromEnum\":\n\t\tcase \"convertFromBoolean\":\n\t\tcase \"convertFromString\":\n\t\t\treturn valueTransform.outputType\n\t\tdefault: {\n\t\t\tconst outputTypes = getOutputTypesForValueTransformName(valueTransform.name)\n\t\t\tassert(outputTypes.length === 1)\n\t\t\tconst outputType = outputTypes[0]\n\t\t\tassert(outputType, \"Value transform output type must be defined\")\n\t\t\treturn outputType\n\t\t}\n\t}\n}\n\nexport function getUsedVariableReferencesFromValueTransform(transform: ValueTransform): VariableReference[] {\n\tconst result: VariableReference[] = []\n\tconst transformName = transform.name\n\n\tif (!isKnownValueTransformName(transform.name)) return result\n\n\tswitch (transformName) {\n\t\tcase \"contains\":\n\t\tcase \"containsAny\":\n\t\tcase \"containsAll\":\n\t\tcase \"endsWith\":\n\t\tcase \"equals\":\n\t\tcase \"startsWith\":\n\t\tcase \"prefix\":\n\t\tcase \"suffix\":\n\t\tcase \"greaterThan\":\n\t\tcase \"lessThan\":\n\t\tcase \"isBefore\":\n\t\tcase \"isAfter\":\n\t\tcase \"isIncludedIn\":\n\t\tcase \"toggleInList\":\n\t\t\tif (isVariableReference(transform.value)) {\n\t\t\t\tresult.push(transform.value)\n\t\t\t}\n\t\t\tbreak\n\t\tcase \"isBetweenDates\":\n\t\t\tif (isVariableReference(transform.start)) {\n\t\t\t\tresult.push(transform.start)\n\t\t\t}\n\t\t\tif (isVariableReference(transform.end)) {\n\t\t\t\tresult.push(transform.end)\n\t\t\t}\n\t\t\tbreak\n\t\tcase \"convertFromEnum\":\n\t\tcase \"convertFromString\":\n\t\t\tif (isVariableReference(transform.default)) {\n\t\t\t\tresult.push(transform.default)\n\t\t\t}\n\t\t\ttransform.cases.forEach(caseOption => {\n\t\t\t\tif (isVariableReference(caseOption.to)) {\n\t\t\t\t\tresult.push(caseOption.to)\n\t\t\t\t}\n\t\t\t})\n\t\t\tbreak\n\t\tcase \"convertFromBoolean\":\n\t\t\tif (isVariableReference(transform.truthy)) {\n\t\t\t\tresult.push(transform.truthy)\n\t\t\t}\n\t\t\tif (isVariableReference(transform.falsy)) {\n\t\t\t\tresult.push(transform.falsy)\n\t\t\t}\n\t\t\tif (transform.fallback && isVariableReference(transform.fallback.value)) {\n\t\t\t\tresult.push(transform.fallback.value)\n\t\t\t}\n\t\t\tbreak\n\t\tcase \"isSet\":\n\t\tcase \"negate\":\n\t\tcase \"toString\":\n\t\tcase \"toDateString\":\n\t\tcase \"toNumber\":\n\t\tcase \"toBoolean\":\n\t\tcase \"reverseArray\":\n\t\tcase \"offsetAndLimitArray\":\n\t\tcase \"arrayLength\":\n\t\tcase \"arrayToArray\":\n\t\tcase \"isEven\":\n\t\tcase \"isOdd\":\n\t\tcase \"numberToString\":\n\t\tcase \"toResponsiveImage\":\n\t\tcase \"toImageSrc\":\n\t\tcase \"toZIndex\":\n\t\tcase \"toAxisOverflow\":\n\t\tcase \"toOverflowWithClipFallback\":\n\t\tcase \"jsonStringify\":\n\t\tcase \"htmlEscape\":\n\t\tcase \"htmlUnescape\":\n\t\tcase \"enumToDisplayName\":\n\t\tcase \"addImageAlt\":\n\t\tcase \"numberToPixelString\":\n\t\tcase \"radiusForCorner\":\n\t\tcase \"percentageToCornerShape\":\n\t\tcase \"getGridColumnCSSValue\":\n\t\tcase \"getGridRowCSSValue\":\n\t\tcase \"getNumericColumnGap\":\n\t\tcase \"extractDateSegment\":\n\t\t\tbreak\n\t\tdefault:\n\t\t\tassertNever(transformName, `getValueTransformVariables(), should handle value transforms: ${transformName}`)\n\t}\n\n\treturn result\n}\n\n/** These transforms become more confusing when the input boolean is already negated. */\nexport const valueTransformsNotWantingNegatedInputVariable: Set<ValueTransformName> = new Set([\n\t// The convert option already has clear names for truthy / falsy. Negating the input makes this\n\t// confusing.\n\t\"convertFromBoolean\",\n\t// These transforms can already be negated themselves. No need to negate the input variable.\n\t\"equals\",\n\t\"isSet\",\n])\n\ntype NegatableValueTransformNames = Extract<\n\tValueTransformName,\n\t\"equals\" | \"contains\" | \"startsWith\" | \"endsWith\" | \"isSet\" | \"greaterThan\" | \"lessThan\" | \"isIncludedIn\"\n>\n\nexport const negatedValueTransformNames: Readonly<Record<NegatableValueTransformNames, string>> = {\n\tisSet: Dictionary.IsntSet,\n\tequals: \"Doesn\u2019t Equal\",\n\tstartsWith: \"Doesn\u2019t Start With\",\n\tendsWith: \"Doesn\u2019t End With\",\n\tcontains: \"Doesn\u2019t Contain\",\n\tgreaterThan: \"Less Than or Equal\",\n\tlessThan: \"Greater Than or Equal\",\n\tisIncludedIn: \"Isn\u2019t Included In\",\n}\n\nexport function valueTransformConsumesNegated(\n\tvalueTransformName: ValueTransformName,\n): valueTransformName is NegatableValueTransformNames {\n\treturn Object.hasOwn(negatedValueTransformNames, valueTransformName)\n}\n\nexport function getValueTransformTitle(valueTransformName: ValueTransformName, isNegated: boolean): string {\n\tif (isNegated) {\n\t\tassert(valueTransformConsumesNegated(valueTransformName))\n\t\treturn negatedValueTransformNames[valueTransformName]\n\t}\n\n\tswitch (valueTransformName) {\n\t\tcase \"negate\":\n\t\t\treturn \"Invert\"\n\t\tcase \"toDateString\":\n\t\t\treturn \"Format\"\n\t\tcase \"extractDateSegment\":\n\t\t\treturn \"Extract\"\n\t\tcase \"toString\":\n\t\t\treturn \"As Plain Text\"\n\t\tcase \"numberToString\":\n\t\t\treturn \"Format Number\"\n\t\tcase \"reverseArray\":\n\t\t\treturn Dictionary.Reverse\n\t\tcase \"arrayLength\":\n\t\t\treturn \"Count\"\n\t\tcase \"enumToDisplayName\":\n\t\t\treturn \"Display Option\"\n\t\tcase \"convertFromEnum\":\n\t\tcase \"convertFromBoolean\":\n\t\tcase \"convertFromString\":\n\t\t\treturn \"Convert\"\n\t\tdefault:\n\t\t\treturn titleCase(valueTransformName)\n\t}\n}\n\nconst repeatableTransforms: ReadonlySet<ValueTransformName> = new Set([\"prefix\", \"suffix\"])\n\n/** For some transforms it is useful to add multiple. */\nexport function isRepeatableValueTransform(valueTransformName: ValueTransformName): boolean {\n\treturn repeatableTransforms.has(valueTransformName)\n}\n\nexport function valueTransformOnlyAllowedIfItMatchesOutputType(valueTransformName: ValueTransformName): boolean {\n\treturn isRepeatableValueTransform(valueTransformName)\n}\n\n/** Returns the range of the selected transform including all follow-up negate transforms if those are consumed. */\nexport function getValueTransformRange(\n\ttransforms: readonly ValueTransform[],\n\ttransformId: NodeID,\n): { start: number; length: number } | null {\n\tconst index = transforms.findIndex(transform => transform.id === transformId)\n\tconst transform = transforms[index]\n\tif (!transform) return null\n\n\tlet length = 1\n\n\t// Add all follow-up negate transforms\n\tif (valueTransformConsumesNegated(transform.name)) {\n\t\tfor (let i = index + 1, il = transforms.length; i < il; i++) {\n\t\t\tconst nextTransform = transforms[i]\n\t\t\tif (nextTransform?.name !== \"negate\") break\n\t\t\tlength++\n\t\t}\n\t}\n\n\treturn { start: index, length }\n}\n\ninterface ValueTransformBase {\n\tid: NodeID\n\ttype: \"valueTransform\"\n\tname: ValueTransformName\n}\n\nexport function isValueTransform(value: unknown): value is ValueTransform {\n\treturn isObject(value) && value[typeKey] === typeValue\n}\n\nexport function isValueTransformEqual(a: ValueTransform, b: unknown): boolean {\n\tif (!isValueTransform(b)) return false\n\tif (a.name !== b.name) return false\n\n\tfor (const key of objectKeys(a)) {\n\t\tif (key === \"id\") continue\n\t\tif (a[key] !== b[key]) return false\n\t}\n\treturn true\n}\n\nexport interface ValueTransformEquals extends ValueTransformBase {\n\tname: \"equals\"\n\tvalue: string | number | boolean | null | undefined | VariableReference\n}\n\nexport interface ValueTransformStartsWith extends ValueTransformBase {\n\tname: \"startsWith\"\n\tvalue: string | VariableReference\n}\n\nexport interface ValueTransformEndsWith extends ValueTransformBase {\n\tname: \"endsWith\"\n\tvalue: string | VariableReference\n}\n\nexport interface ValueTransformContains extends ValueTransformBase {\n\tname: \"contains\"\n\tvalue: string | VariableReference\n}\n\nexport interface ValueTransformContainsAny extends ValueTransformBase {\n\tname: \"containsAny\"\n\tvalue: readonly string[] | VariableReference\n}\n\nexport interface ValueTransformContainsAll extends ValueTransformBase {\n\tname: \"containsAll\"\n\tvalue: readonly string[] | VariableReference\n}\n\nexport interface ValueTransformIsSet extends ValueTransformBase {\n\tname: \"isSet\"\n}\n\nexport interface ValueTransformGreaterThan extends ValueTransformBase {\n\tname: \"greaterThan\"\n\tvalue: number | VariableReference\n}\n\nexport interface ValueTransformLessThan extends ValueTransformBase {\n\tname: \"lessThan\"\n\tvalue: number | VariableReference\n}\n\nexport interface ValueTransformNegate extends ValueTransformBase {\n\tname: \"negate\"\n}\n\nexport interface ValueTransformIsBefore extends ValueTransformBase {\n\tname: \"isBefore\"\n\tvalue: string | VariableReference | undefined\n}\n\nexport interface ValueTransformIsAfter extends ValueTransformBase {\n\tname: \"isAfter\"\n\tvalue: string | VariableReference | undefined\n}\n\nexport interface ValueTransformIsBetweenDates extends ValueTransformBase {\n\tname: \"isBetweenDates\"\n\tstart: string | VariableReference | undefined\n\tend: string | VariableReference | undefined\n}\n\nexport interface ValueTransformIsIncludedIn extends ValueTransformBase {\n\tname: \"isIncludedIn\"\n\tvalue: string[] | VariableReference | undefined\n}\n\ninterface ValueTransformIsEven extends ValueTransformBase {\n\tname: \"isEven\"\n}\n\ninterface ValueTransformIsOdd extends ValueTransformBase {\n\tname: \"isOdd\"\n}\n\ninterface ValueTransformGetGridColumnCSSValue extends ValueTransformBase {\n\tname: \"getGridColumnCSSValue\"\n}\n\ninterface ValueTransformGetGridRowCSSValue extends ValueTransformBase {\n\tname: \"getGridRowCSSValue\"\n}\n\ninterface ValueTransformGetNumericColumnGap extends ValueTransformBase {\n\tname: \"getNumericColumnGap\"\n}\n\ninterface ValueTransformToggleInList extends ValueTransformBase {\n\tname: \"toggleInList\"\n\tvalue: string | VariableReference\n}\n\nexport const numberToStringNotationOptions = [\"standard\", \"compact\"] as const\nexport const numberToStringCompactDisplayOptions = [\"short\", \"long\"] as const\nexport const numberToStringStyles = [\"decimal\", \"currency\", \"unit\"] as const\nexport const numberToStringCurrencyDisplayOptions = [\"symbol\", \"narrowSymbol\", \"code\", \"name\"] as const\nexport const numberToStringUnitDisplayOptions = [\"short\", \"narrow\", \"long\"] as const\n\nexport interface ValueTransformNumberToString extends ValueTransformBase {\n\tname: \"numberToString\"\n\t// This locale has not always been optional and is often stored as an empty string\n\tlocale?: string\n\tgrouping: \"auto\" | true | false\n\tnotation: (typeof numberToStringNotationOptions)[number]\n\tcompactDisplay: (typeof numberToStringCompactDisplayOptions)[number]\n\tstyle: (typeof numberToStringStyles)[number]\n\tcurrency: string\n\tcurrencyDisplay: (typeof numberToStringCurrencyDisplayOptions)[number]\n\tunit: string\n\tunitDisplay: (typeof numberToStringUnitDisplayOptions)[number]\n\n\tminimumIntegerDigits?: number /* 1 to 21 */\n\tminimumFractionDigits?: number /* 0 to 20 */\n\tmaximumFractionDigits?: number /* 0 to 20 */\n}\n\ninterface ValueTransformNumberToPixelString extends ValueTransformBase {\n\tname: \"numberToPixelString\"\n}\n\ninterface ValueTransformRadiusForCorner extends ValueTransformBase {\n\tname: \"radiusForCorner\"\n}\n\ninterface ValueTransformPercentageToCornerShape extends ValueTransformBase {\n\tname: \"percentageToCornerShape\"\n}\n\ninterface ValueTransformToString extends ValueTransformBase {\n\tname: \"toString\"\n}\n\ninterface ValueTransformToNumber extends ValueTransformBase {\n\tname: \"toNumber\"\n}\n\ninterface ValueTransformToBoolean extends ValueTransformBase {\n\tname: \"toBoolean\"\n}\n\n/*\n * @important: We code-generate `<time dateTime={date_variable}>` for this transform, which expects\n * an ISO string. When changing this transform, make sure it stays like that.\n */\nexport interface ValueTransformToDateString extends ValueTransformBase {\n\tname: \"toDateString\"\n\t// This locale has not always been optional and is often stored as an empty string\n\tlocale?: string\n\tdisplay?: DateDisplayOption\n\tformat?: DateFormatOption\n\tdateStyle: DateStyleOption\n\t// NOTE: Only used by relative date transform.\n\tcapitalize?: boolean\n}\n\nexport interface ValueTransformToRelativeDateString extends Omit<ValueTransformToDateString, \"format\"> {\n\tdisplay: \"relative\"\n\tformat: RelativeDateFormatOption\n\tdateStyle: RelativeDateStyleOption\n}\n\nexport const dateSegmentOptions = [\"year\", \"month\", \"day\", \"hour12\", \"hour24\", \"minute\"] as const\n\nexport type DateSegment = (typeof dateSegmentOptions)[number]\n\nexport interface ValueTransformExtractDateSegment extends ValueTransformBase {\n\tname: \"extractDateSegment\"\n\tsegment: DateSegment\n}\n\ninterface ValueTransformReverseArray extends ValueTransformBase {\n\tname: \"reverseArray\"\n}\n\ninterface ValueTransformOffsetAndLimitArray extends ValueTransformBase {\n\tname: \"offsetAndLimitArray\"\n\tstartOffset: number\n\tlimit: number | undefined\n}\n\ninterface ValueTransformArrayLength extends ValueTransformBase {\n\tname: \"arrayLength\"\n}\n\nexport type TransformArrayToArrayMapping = Record<\n\tstring,\n\tImageControlProp & { value: InlineTransformVariableReference }\n>\n\n/**\n * Defines a mapping which is used to transform one array into another.\n *\n * Typically the mapping is of the form targetItemFieldId => inputItemFieldId:\n * For example, a CMS repeater passing an array of images to a code component:\n *\n *     ```\n *     {\n *         \"targetCodeComponentFieldId\": {\n *             type: ControlType.Image,\n *             value: {\n *                 type: \"variableReference\",\n *                 id: \"cmsGalleryImageFieldId\",\n *                 providerId: \"transform\"\n *             }\n *         }\n *     }\n *     ```\n */\nexport interface ValueTransformArrayToArray extends ValueTransformBase {\n\tname: \"arrayToArray\"\n\tmapping: TransformArrayToArrayMapping\n}\n\ninterface ValueTransformPrefix extends ValueTransformBase {\n\tname: \"prefix\"\n\tvalue: string | VariableReference\n\tvalueLocalized?: LocalizedValues\n}\n\ninterface ValueTransformSuffix extends ValueTransformBase {\n\tname: \"suffix\"\n\tvalue: string | VariableReference\n\tvalueLocalized?: LocalizedValues\n}\n\ninterface ValueTransformToResponsiveImage extends ValueTransformBase {\n\tname: \"toResponsiveImage\"\n}\n\ninterface ValueTransformToImageSrc extends ValueTransformBase {\n\tname: \"toImageSrc\"\n}\n\ninterface ValueTransformToZIndex extends ValueTransformBase {\n\tname: \"toZIndex\"\n}\n\ninterface ValueTransformToOverflow extends ValueTransformBase {\n\tname: \"toAxisOverflow\"\n}\n\ninterface ValueTransformToOverflowWithClipFallback extends ValueTransformBase {\n\tname: \"toOverflowWithClipFallback\"\n}\n\ninterface ValueTransformJsonStringify extends ValueTransformBase {\n\tname: \"jsonStringify\"\n}\n\ninterface ValueTransformHtmlEscape extends ValueTransformBase {\n\tname: \"htmlEscape\"\n}\n\ninterface ValueTransformHtmlUnescape extends ValueTransformBase {\n\tname: \"htmlUnescape\"\n}\n\ninterface ValueTransformAddImageAlt extends ValueTransformBase {\n\tname: \"addImageAlt\"\n}\n\nexport interface ValueTransformEnumToDisplayName extends ValueTransformBase {\n\tname: \"enumToDisplayName\"\n}\n\nexport type ConvertFromEnumOutputType = Extract<\n\tValueTransformType,\n\t(typeof valueTransformOutputTypes)[\"convertFromEnum\"][number]\n>\n\nexport type ConvertFromEnumOrStringOutputValueType =\n\t| string\n\t| boolean\n\t| EnumValueType\n\t| Link\n\t| TwoPixelNumberShorthand\n\t| FourPixelNumberShorthand\n\t| RelativeOrFourPixelNumberShorthand\n\nexport interface ConvertFromEnumCase {\n\tid: NodeID\n\tfrom: string\n\tto: ConvertFromEnumOrStringOutputValueType | VariableReference\n\ttoLocalized?: LocalizedValues\n}\n\nexport interface ValueTransformConvertFromEnum extends ValueTransformBase {\n\tname: \"convertFromEnum\"\n\toutputType: ConvertFromEnumOutputType\n\tcases: ConvertFromEnumCase[]\n\tdefault: ConvertFromEnumOrStringOutputValueType | VariableReference\n\tdefaultLocalized?: LocalizedValues\n}\n\nexport type ConvertFromStringOutputType = Extract<\n\tValueTransformType,\n\t(typeof valueTransformOutputTypes)[\"convertFromString\"][number]\n>\n\nexport interface ConvertFromStringCase {\n\tid: NodeID\n\tfrom: string\n\tto: ConvertFromEnumOrStringOutputValueType | VariableReference\n\ttoLocalized?: LocalizedValues\n}\n\nexport interface ValueTransformConvertFromString extends ValueTransformBase {\n\tname: \"convertFromString\"\n\toutputType: ConvertFromStringOutputType\n\tcases: ConvertFromStringCase[]\n\tdefault: ConvertFromEnumOrStringOutputValueType | VariableReference\n\tdefaultLocalized?: LocalizedValues\n}\n\nexport type ConvertFromBooleanOutputType = Extract<\n\tValueTransformType,\n\t(typeof valueTransformOutputTypes)[\"convertFromBoolean\"][number]\n>\n\nexport type ConvertFromBooleanOutputValueType =\n\t| string\n\t| EnumValueType\n\t| Link\n\t| TwoPixelNumberShorthand\n\t| FourPixelNumberShorthand\n\t| RelativeOrFourPixelNumberShorthand\n\ninterface ConvertFromBooleanFallback {\n\tvalue: ConvertFromBooleanOutputValueType | VariableReference\n\tvalueLocalized?: LocalizedValues\n}\n\nexport interface ValueTransformConvertFromBoolean extends ValueTransformBase {\n\tname: \"convertFromBoolean\"\n\toutputType: ConvertFromBooleanOutputType\n\ttruthy: ConvertFromBooleanOutputValueType | VariableReference\n\ttruthyLocalized?: LocalizedValues\n\tfalsy: ConvertFromBooleanOutputValueType | VariableReference\n\tfalsyLocalized?: LocalizedValues\n\n\t// This fallback was added after the initial release to support special casing optional boolean\n\t// variables. If it's set, we will use it when the input value is `undefined`.\n\tfallback?: ConvertFromBooleanFallback\n}\n", "import { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isObject, isString } from \"utils/typeChecks.ts\"\nimport type { FetchDataValue } from \"./FetchDataValue.ts\"\nimport { isFetchDataValue, isFetchDataValueEqual } from \"./FetchDataValue.ts\"\nimport type { ValueTransform, ValueTransformToRelativeDateString } from \"./ValueTransform.ts\"\nimport { isValueTransformEqual } from \"./ValueTransform.ts\"\nimport type { VariableReference } from \"./VariableReference.ts\"\nimport { isVariableReference, isVariableReferenceEqual } from \"./VariableReference.ts\"\n\nconst typeKey: keyof ComputedValue = \"type\"\nconst typeValue: ComputedValue[\"type\"] = \"computedValue\"\n\nexport type ComputedValueOutputType =\n\t| ControlType.Array\n\t| ControlType.Boolean\n\t| ControlType.Number\n\t| ControlType.String\n\t| ControlType.Enum\n\t| ControlType.Color\n\t| ControlType.Link\n\t| ControlType.Gap\n\t| ControlType.Padding\n\t| ControlType.BorderRadius\n\t| ControlType.Image\n\t| ControlType.MultiCollectionReference\n\nconst outputTypes: Record<ComputedValueOutputType, true> = {\n\t[ControlType.Array]: true,\n\t[ControlType.Boolean]: true,\n\t[ControlType.Number]: true,\n\t[ControlType.String]: true,\n\t[ControlType.Enum]: true,\n\t[ControlType.Color]: true,\n\t[ControlType.Link]: true,\n\t[ControlType.Gap]: true,\n\t[ControlType.Padding]: true,\n\t[ControlType.BorderRadius]: true,\n\t[ControlType.Image]: true,\n\t[ControlType.MultiCollectionReference]: true,\n}\n\nexport function isComputedValueOutputType(value: unknown): value is ComputedValueOutputType {\n\treturn isString(value) && Object.hasOwn(outputTypes, value)\n}\n\ninterface ComputedValueCommon {\n\ttype: \"computedValue\"\n\toutputType: ComputedValueOutputType\n\ttransforms: readonly ValueTransform[]\n}\n\n/**\n * A computed value that transforms a referenced variable into a certain output type.\n */\nexport interface ComputedValueFromVariable extends ComputedValueCommon {\n\tstartValue: VariableReference\n}\n\n/**\n * A computed value that transforms a fetched value into a certain output type.\n */\nexport interface ComputedValueFromFetchDataValue extends ComputedValueCommon {\n\tstartValue: FetchDataValue\n}\n\nexport type ComputedValue = ComputedValueFromVariable | ComputedValueFromFetchDataValue\n\nexport function isComputedValue(value: unknown): value is ComputedValue {\n\treturn isObject(value) && typeKey in value && value[typeKey] === typeValue\n}\n\nexport function isComputedValueFromFetchData(value: unknown): value is ComputedValueFromFetchDataValue {\n\treturn isComputedValue(value) && isFetchDataValue(value.startValue)\n}\n\nexport function isComputedValueFromVariableReference(value: unknown): value is ComputedValueFromVariable {\n\treturn isComputedValue(value) && isVariableReference(value.startValue)\n}\n\ninterface RelativeDateComputedValue extends Omit<ComputedValue, \"transforms\"> {\n\ttransforms: [ValueTransformToRelativeDateString]\n}\n\nexport function isRelativeDateComputedValue(value: unknown): value is RelativeDateComputedValue {\n\treturn (\n\t\tisComputedValue(value) &&\n\t\tvalue.transforms.length === 1 &&\n\t\tvalue.transforms[0]?.name === \"toDateString\" &&\n\t\tvalue.transforms[0]?.display === \"relative\"\n\t)\n}\n\nexport function isNonRelativeDateStringComputedValue(value: unknown): value is ComputedValue {\n\treturn (\n\t\tisComputedValue(value) &&\n\t\tvalue.transforms.some(transform => transform.name === \"toDateString\" && transform.display !== \"relative\")\n\t)\n}\n\nexport function isComputedValueEqual(a: ComputedValue, b: unknown): boolean {\n\tif (!isComputedValue(b)) return false\n\tif (a.outputType !== b.outputType) return false\n\n\tif (a.startValue.type !== b.startValue.type) return false\n\n\tif (isVariableReference(a.startValue) && !isVariableReferenceEqual(a.startValue, b.startValue)) return false\n\tif (isFetchDataValue(a.startValue) && !isFetchDataValueEqual(a.startValue, b.startValue)) return false\n\n\tif (a.transforms.length !== b.transforms.length) return false\n\treturn a.transforms.every((transform, idx) => isValueTransformEqual(transform, b.transforms[idx]))\n}\n\nexport function createComputedValue(\n\toutputType: ComputedValueOutputType,\n\tstartValue: FetchDataValue,\n\ttransforms: readonly ValueTransform[],\n): ComputedValueFromFetchDataValue\nexport function createComputedValue(\n\toutputType: ComputedValueOutputType,\n\tstartValue: VariableReference,\n\ttransforms: readonly ValueTransform[],\n): ComputedValueFromVariable\nexport function createComputedValue(\n\toutputType: ComputedValueOutputType,\n\tstartValue: VariableReference | FetchDataValue,\n\ttransforms: readonly ValueTransform[],\n): ComputedValue {\n\tif (isVariableReference(startValue)) {\n\t\treturn {\n\t\t\ttype: typeValue,\n\t\t\toutputType,\n\t\t\tstartValue,\n\t\t\ttransforms,\n\t\t}\n\t}\n\n\treturn {\n\t\ttype: typeValue,\n\t\toutputType,\n\t\tstartValue,\n\t\ttransforms,\n\t}\n}\n", "import type { ComputedValue } from \"./ComputedValue.ts\"\nimport { isComputedValue, isComputedValueEqual } from \"./ComputedValue.ts\"\nimport type { VariableReference } from \"./VariableReference.ts\"\nimport { isVariableReference, isVariableReferenceEqual } from \"./VariableReference.ts\"\n\n/**\n * A value that can be either a `VariableReference` or a `ComputedValue`.\n *\n * NOTE: Only use `DynamicValue` if you are sure you want to support both `VariableReference` and\n *       `ComputedValue`. If a property only supports one of them via the UI, use the specific type\n *       instead. Otherwise we lose type safety and an invalid value might be assigned for example\n *       when detaching a component, where the component properties are directly assigned to the\n *       flattened layers.\n */\nexport type DynamicValue = VariableReference | ComputedValue\n\nexport function isDynamicValue(value: unknown): value is DynamicValue {\n\treturn isVariableReference(value) || isComputedValue(value)\n}\n\nexport function isDynamicValueEqual(a: DynamicValue, b: unknown): boolean {\n\tif (isVariableReference(a)) return isVariableReferenceEqual(a, b)\n\n\treturn isComputedValueEqual(a, b)\n}\n\nexport type NonDynamicValue<T> = T extends DynamicValue ? Exclude<T, DynamicValue> : T\nexport type NonDynamicValueRecord<T> = {\n\t[Key in keyof T]-?: NonDynamicValue<T[Key]>\n}\n\nexport function isNonDynamicValue<T>(value: T): value is NonDynamicValue<T> {\n\treturn !isDynamicValue(value)\n}\n", "import type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport type { NonUndefinedRecord } from \"utils/NonUndefined.ts\"\nimport type { NodeChange } from \"../TreeDiff.ts\"\nimport type { AnyScopeNode, CanvasNode } from \"../index.ts\"\n\n/**\n * Trait for CMS collection data sources.\n *\n * This trait was initially supposed to support other types of CMS data sources like\n * \"records\", but this feature was not implemented as of writing this.\n */\n\nexport interface WithCollectionDataSource {\n\tdataIdentifier: ModuleExportIdentifierString | undefined\n}\n\nexport const collectionDataSourceDefaults: WithCollectionDataSource = {\n\tdataIdentifier: undefined,\n}\n\nconst key: keyof WithCollectionDataSource = \"dataIdentifier\"\n\nexport function withCollectionDataSource<T extends CanvasNode | AnyScopeNode>(\n\tnode: T,\n): node is T & WithCollectionDataSource {\n\treturn key in node\n}\n\nexport type HasCollectionDataSource = NonUndefinedRecord<WithCollectionDataSource>\n\nexport function hasCollectionDataSource<T extends CanvasNode | AnyScopeNode>(\n\tnode: T | null | undefined,\n): node is T & HasCollectionDataSource {\n\treturn !!node && withCollectionDataSource(node) && !!node.dataIdentifier\n}\n\nexport function hasCollectionDataSourceAncestor(node: CanvasNode, options?: { includeSelf?: boolean }): boolean {\n\tif (options?.includeSelf && hasCollectionDataSource(node)) return true\n\n\tfor (const ancestor of node.ancestors()) {\n\t\tif (hasCollectionDataSource(ancestor)) return true\n\t}\n\treturn false\n}\n\nexport function hasCollectionDataSourceChanged(changes: NodeChange[]): boolean {\n\treturn changes.some(change => key in change.to)\n}\n", "import { assertNever } from \"@framerjs/shared\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { StackAlignment, StackDirection, StackDistribution } from \"library/components/Stack/types.ts\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { DynamicValue } from \"./DynamicValue.ts\"\nimport { isDynamicValue } from \"./DynamicValue.ts\"\nimport type { TwoPixelNumberShorthand } from \"./NumberShorthand.ts\"\n\ninterface StackLayout {\n\tstackDirection: StackDirection | DynamicValue | undefined\n\tstackDistribution: StackDistribution | DynamicValue | undefined\n\tstackAlignment: StackAlignment | DynamicValue | undefined\n\tstackWrapEnabled: boolean | undefined\n}\n\nconst gridContentAlignmentOptions = [\"start\", \"center\", \"end\"] as const\nexport type GridContentAlignment = (typeof gridContentAlignmentOptions)[number]\n\nexport function isGridContentAlignment(value: unknown): value is GridContentAlignment {\n\tif (!isString(value)) return false\n\treturn gridContentAlignmentOptions.includes(value as GridContentAlignment)\n}\n\nconst gridColumnWidthTypeOptions = [\"fixed\", \"minmax\"] as const\ntype GridColumnWidthType = (typeof gridColumnWidthTypeOptions)[number]\n\nexport function isGridColumnWidthType(value: unknown): value is GridColumnWidthType {\n\tif (!isString(value)) return false\n\treturn gridColumnWidthTypeOptions.includes(value as GridColumnWidthType)\n}\n\nconst gridRowHeightTypeOptions = [\"fixed\", \"auto\", \"fit\"] as const\nexport type GridRowHeightType = (typeof gridRowHeightTypeOptions)[number]\n\nexport function isGridRowHeightType(value: unknown): value is GridRowHeightType {\n\tif (!isString(value)) return false\n\treturn gridRowHeightTypeOptions.includes(value as GridRowHeightType)\n}\n\n/**\n * Once the native CSS masonry layout is generally available, a new option for \"nativeMasonry\" or similar should be added\n * to `gridTypes` and `columnMasonryGridType` should be deprecated.\n */\nexport const columnMasonryGridType = \"columnMasonry\" as const\nconst gridTypes = [columnMasonryGridType] as const\nexport type GridType = (typeof gridTypes)[number]\n\ninterface GridLayout {\n\tgridColumnCount: number | \"auto-fill\" | undefined\n\tgridRowCount: number | undefined\n\tgridAlignment: GridContentAlignment | undefined\n\tgridColumnWidthType: GridColumnWidthType | undefined\n\tgridColumnWidth: number | undefined\n\tgridColumnMinWidth: number | undefined\n\tgridRowHeightType: GridRowHeightType | undefined\n\tgridRowHeight: number | undefined\n\tgridType: GridType | undefined /* undefined means default grid type */\n}\n\nexport const layoutTypes = [\"stack\", \"grid\"] as const\nexport type LayoutType = (typeof layoutTypes)[number]\n\nexport interface WithLayout extends StackLayout, GridLayout {\n\tlayout: LayoutType | undefined\n\tgap: TwoPixelNumberShorthand | number | DynamicValue | undefined\n}\n\ninterface HasAnyLayout {\n\tlayout: LayoutType\n}\n\nexport interface HasStackLayout extends StackLayout, Pick<WithLayout, \"gap\"> {\n\tlayout: \"stack\"\n}\n\nexport interface HasGridLayout extends GridLayout, Pick<WithLayout, \"gap\"> {\n\tlayout: \"grid\"\n}\n\ninterface HasColumnMasonryLayout extends GridLayout, Pick<WithLayout, \"gap\"> {\n\tlayout: \"grid\"\n\tgridType: \"columnMasonry\"\n}\n\nexport const layoutDefaults: WithLayout = {\n\tlayout: undefined,\n\tgap: undefined,\n\tstackAlignment: undefined,\n\tstackDirection: undefined,\n\tstackDistribution: undefined,\n\tstackWrapEnabled: undefined,\n\tgridColumnCount: undefined,\n\tgridRowCount: undefined,\n\tgridAlignment: undefined,\n\tgridColumnWidthType: undefined,\n\tgridColumnWidth: undefined,\n\tgridColumnMinWidth: undefined,\n\tgridRowHeightType: undefined,\n\tgridRowHeight: undefined,\n\tgridType: undefined,\n}\n\nexport const defaultStackDirection: StackDirection = \"horizontal\"\nexport const defaultStackDistribution: StackDistribution = \"center\"\nexport const defaultStackAlignment: StackAlignment = \"center\"\n\nconst layoutKey: Extract<keyof WithLayout, \"layout\"> = \"layout\"\nexport function withLayout<N extends CanvasNode>(node: N): node is N & WithLayout {\n\treturn layoutKey in node\n}\n\nexport function isLayoutType(layout: unknown): layout is LayoutType {\n\tif (!isString(layout)) return false\n\treturn layoutTypes.includes(layout as LayoutType)\n}\n\nconst distributionsWithGap: StackDistribution[] = [\"start\", \"end\", \"center\"]\nexport function supportGap<T extends CanvasNode>(node: T) {\n\tif (!withLayout(node)) return false\n\tif (node.layout !== \"stack\" || !node.stackDistribution) return false\n\tif (isDynamicValue(node.stackDistribution)) return true\n\treturn distributionsWithGap.includes(node.stackDistribution)\n}\n\nexport function hasAnyLayout<T extends CanvasNode>(node: T): node is T & WithLayout & HasAnyLayout {\n\t// Breakpoints with an applied layout template should be considered to have\n\t// layout no matter what their properties are.\n\treturn withLayout(node) && !isUndefined(node.layout)\n}\n\nexport function hasStackLayout<T extends CanvasNode>(node: T): node is T & WithLayout & HasStackLayout {\n\t// Breakpoints with an applied layout template should be considered to have\n\t// stack layout no matter what their properties are.\n\treturn hasAnyLayout(node) && node.layout === \"stack\"\n}\n\nexport function hasGridLayout<T extends CanvasNode>(node: T): node is T & WithLayout & HasGridLayout {\n\t// Breakpoints with an applied layout template should be considered to have\n\t// stack layout no matter what their properties are.\n\treturn hasAnyLayout(node) && node.layout === \"grid\"\n}\n\nexport function hasColumnMasonryLayout<T extends CanvasNode>(node: T): node is T & WithLayout & HasColumnMasonryLayout {\n\treturn hasGridLayout(node) && node.gridType === columnMasonryGridType\n}\n\nexport function objectWithLayout<N extends Record<string, unknown>>(object: N): object is N & { layout: unknown } {\n\treturn layoutKey in object\n}\n\nexport function toStackDirection(value: unknown): StackDirection | undefined {\n\tif (isStackDirection(value)) return value\n\tif (!isString(value)) return undefined\n\tswitch (value) {\n\t\tcase \"row\":\n\t\t\treturn \"horizontal\"\n\t\tcase \"column\":\n\t\t\treturn \"vertical\"\n\t\tdefault:\n\t\t\treturn undefined\n\t}\n}\n\nexport const stackDirections: StackDirection[] = [\"horizontal\", \"vertical\"]\nexport function isStackDirection(value: unknown): value is StackDirection {\n\treturn isString(value) && (stackDirections as string[]).includes(value)\n}\n\ntype FlexDirection = \"row\" | \"column\"\n\nexport function toFlexDirection<T>(\n\tvalue: T,\n): (T extends StackDirection ? Exclude<T, StackDirection> : T) | FlexDirection {\n\tif (!isStackDirection(value)) return value as Exclude<T, StackDirection>\n\tswitch (value) {\n\t\tcase \"horizontal\":\n\t\t\treturn \"row\"\n\t\tcase \"vertical\":\n\t\t\treturn \"column\"\n\t\tdefault:\n\t\t\tassertNever(value)\n\t}\n}\n\nconst flexDistributions = [\"flex-start\", \"flex-end\", \"center\", \"space-between\", \"space-around\", \"space-evenly\"] as const\n\ntype FlexJustify = (typeof flexDistributions)[number]\nfunction isFlexJustify(value: unknown): value is FlexJustify {\n\treturn isString(value) && (flexDistributions as readonly string[]).includes(value)\n}\n\nexport const stackDistributions: StackDistribution[] = [\n\t\"start\",\n\t\"center\",\n\t\"end\",\n\t\"space-between\",\n\t\"space-around\",\n\t\"space-evenly\",\n]\n\nexport function isStackDistribution(value: unknown): value is StackDistribution {\n\treturn isString(value) && (stackDistributions as string[]).includes(value)\n}\n\nexport function toFlexJustify<T>(value: T) {\n\tif (!isStackDistribution(value)) return value\n\n\tswitch (value) {\n\t\tcase \"start\":\n\t\t\treturn \"flex-start\"\n\t\tcase \"end\":\n\t\t\treturn \"flex-end\"\n\t\tdefault:\n\t\t\treturn value\n\t}\n}\n\nexport function toStackDistribution(value: unknown): StackDistribution | undefined {\n\tif (isStackDistribution(value)) return value\n\tif (!isFlexJustify(value)) return undefined\n\tswitch (value) {\n\t\tcase \"flex-start\":\n\t\t\treturn \"start\"\n\t\tcase \"flex-end\":\n\t\t\treturn \"end\"\n\t\tdefault:\n\t\t\treturn value\n\t}\n}\n\nconst flexAlignments = [\"flex-start\", \"flex-end\", \"center\"] as const\ntype FlexAlignment = (typeof flexAlignments)[number]\nfunction isFlexAlign(value: unknown): value is FlexAlignment {\n\treturn isString(value) && (flexAlignments as readonly string[]).includes(value)\n}\n\nexport const stackAlignments: StackAlignment[] = [\"start\", \"center\", \"end\"]\n\nexport function isStackAlignment(value: unknown): value is StackAlignment {\n\tif (!isString(value)) return false\n\treturn (stackAlignments as string[]).includes(value)\n}\n\nfunction toStackAlignment(value: unknown): StackAlignment | undefined {\n\tif (isStackAlignment(value)) return value\n\tif (!isFlexAlign(value)) return undefined\n\tswitch (value) {\n\t\tcase \"flex-start\":\n\t\t\treturn \"start\"\n\t\tcase \"flex-end\":\n\t\t\treturn \"end\"\n\t\tdefault:\n\t\t\treturn value\n\t}\n}\n\nexport function toFlexAlign<T>(value: T) {\n\tif (isFlexAlign(value)) return value\n\tif (!isStackAlignment(value)) return value\n\n\tswitch (value) {\n\t\tcase \"start\":\n\t\t\treturn \"flex-start\"\n\t\tcase \"end\":\n\t\t\treturn \"flex-end\"\n\t\tdefault:\n\t\t\treturn value\n\t}\n}\n\nexport function maybeConvertFlexValueToVekterValue<K extends string | number | symbol>(key: K, value: unknown) {\n\tswitch (key) {\n\t\tcase \"stackDirection\":\n\t\t\treturn toStackDirection(value)\n\t\tcase \"stackDistribution\":\n\t\t\treturn toStackDistribution(value)\n\t\tcase \"stackAlignment\":\n\t\t\treturn toStackAlignment(value)\n\t\tdefault:\n\t\t\treturn value\n\t}\n}\n\nexport function getLayoutType(node: CanvasNode | null | undefined): LayoutType | null {\n\tif (!node || !withLayout(node)) return null\n\treturn node.layout ?? null\n}\n", "import type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { AnyCanvasNode } from \"../nodes/CanvasNode.ts\"\n\nexport interface ReplicaNodeOverrides {\n\t[key: string]: any\n\n\t/**\n\t * _deleted contains an array of property keys that have been set to undefined.\n\t * The reason we store the deleted props as an array is because undefined is dropped\n\t * when serializing to JSON. This way we can still know which properties were deleted.\n\t */\n\t_deleted?: string[]\n}\n\nexport interface ReplicaOverrides {\n\t[key: NodeID]: ReplicaNodeOverrides\n}\n\nexport interface ReplicaInfo {\n\t// The masterid is the reference to the node that is the master of this replica\n\tmaster: NodeID\n\toverrides: ReplicaOverrides\n\tinheritsFrom?: NodeID\n}\n\n// we misuse the isExternalMaster field to also hide local masters\nexport const HIDDEN_MASTER = \"hidden master\"\n\nexport interface WithTemplate {\n\tisMaster: boolean\n\tisExternalMaster: string | null\n\treplicaInfo: ReplicaInfo | null\n}\n\nexport interface IsMaster {\n\tisMaster: true\n\tisExternalMaster: string | null\n}\n\nexport interface IsReplicaOrReplicaChild {\n\tisMaster: false\n\t// originalid is the reference to the same node in the master tree\n\toriginalid: NodeID\n}\n\nexport interface IsReplica extends IsReplicaOrReplicaChild {\n\treplicaInfo: ReplicaInfo\n}\n\nexport interface IsNotReplica {\n\tisMaster: boolean\n\toriginalid: null\n\treplicaInfo: null | undefined\n}\n\nexport interface IsReplicaChild extends IsReplicaOrReplicaChild {\n\treplicaInfo: null\n}\n\nexport interface WithInheritedOverrides extends IsReplica {\n\treplicaInfo: Required<ReplicaInfo>\n}\n\nexport const templateDefaults: WithTemplate = {\n\tisMaster: false,\n\tisExternalMaster: null,\n\treplicaInfo: null,\n}\n\nconst key: keyof WithTemplate = \"isMaster\"\n\nexport function withTemplate<T extends AnyCanvasNode>(node: T): node is T & WithTemplate {\n\treturn key in node\n}\n\nexport function isMaster<T extends CanvasNode>(node: T): node is T & IsMaster {\n\treturn withTemplate(node) && node.isMaster\n}\n\n// both external masters, and explicitly deleted local masters are hidden\nexport function isHiddenMaster<T extends CanvasNode>(node: T): node is T & IsMaster {\n\treturn withTemplate(node) && Boolean(node.isExternalMaster)\n}\n\nexport function isExternalMaster<T extends CanvasNode>(node: T): node is T & IsMaster {\n\tconst externalMaster = withTemplate(node) ? node.isExternalMaster : null\n\treturn Boolean(externalMaster) && externalMaster !== HIDDEN_MASTER\n}\n\nexport function isInternalHiddenMaster<T extends CanvasNode>(node: T): node is T & IsMaster {\n\treturn withTemplate(node) ? node.isExternalMaster === HIDDEN_MASTER : false\n}\n\nexport function isReplica<T extends AnyCanvasNode>(node: T | null | undefined): node is T & IsReplica {\n\tif (!node) return false\n\treturn withTemplate(node) && !!node.replicaInfo\n}\n\nexport function isNotReplica<T extends CanvasNode>(node: T | null | undefined): node is T & IsNotReplica {\n\tif (!node) return false\n\treturn !isReplica(node)\n}\n\nexport function withInheritedOverrides<T extends CanvasNode>(node: T): node is T & WithInheritedOverrides {\n\treturn isReplica(node) && !!node.replicaInfo.inheritsFrom\n}\n\nexport function isReplicaChild<T extends CanvasNode>(node: T): node is T & IsReplicaChild {\n\treturn !!node.originalid && !isReplica(node)\n}\n\nexport function isReplicaOrReplicaChild<T extends CanvasNode>(node: T): node is T & IsReplicaOrReplicaChild {\n\treturn !!node.originalid\n}\n\nexport function isMasterChild(node: CanvasNode): boolean {\n\tfor (const ancestor of node.ancestors()) {\n\t\tif (isMaster(ancestor)) return true\n\t}\n\n\treturn false\n}\n\nexport function isMasterOrMasterChild(node: CanvasNode): boolean {\n\treturn isMaster(node) || isMasterChild(node)\n}\n\nexport function getMasterAncestor(\n\tnode: CanvasNode,\n\t{ includeSelf } = { includeSelf: true },\n): (CanvasNode & IsMaster) | null {\n\tif (includeSelf && isMaster(node)) return node\n\tfor (const ancestor of node.ancestors()) {\n\t\tif (isMaster(ancestor)) return ancestor\n\t}\n\treturn null\n}\n\nexport function isMasterOrReplicaChild(node: CanvasNode): boolean {\n\treturn isReplicaChild(node) || isMasterChild(node)\n}\n", "import type {\n\tAnyScopeNode,\n\tMaybeAnyScope,\n\tMaybeLoadedScopeNode,\n\tMaybeShallowScopeNode,\n} from \"document/models/CanvasTree/index.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { DynamicValue } from \"../../traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"../../traits/DynamicValue.ts\"\nimport { hasCollectionDataSource } from \"../../traits/WithCollectionDataSource.ts\"\nimport { hasAnyLayout, hasGridLayout, hasStackLayout } from \"../../traits/WithLayout.ts\"\nimport type { IsNotReplica, IsReplica } from \"../../traits/WithTemplate.ts\"\nimport { isNotReplica, isReplica } from \"../../traits/WithTemplate.ts\"\nimport type {\n\tAnyAnalyticsScopeNode,\n\tLoadedAnalyticsScopeNode,\n\tShallowAnalyticsScopeNode,\n} from \"../AnalyticsScopeNode.ts\"\nimport type { BlockquoteStylePresetNode } from \"../BlockquoteStylePresetNode.ts\"\nimport type { MaybeAnyCanvasNode, MaybeCanvasNode } from \"../CanvasNode.ts\"\nimport type { AnyCanvasPageNode, LoadedCanvasPageNode, ShallowCanvasPageNode } from \"../CanvasPageNode.ts\"\nimport type CodeComponentNode from \"../CodeComponentNode.ts\"\nimport type { CollectionItemNode } from \"../CollectionItemNode.ts\"\nimport type { CollectionNode } from \"../CollectionNode.ts\"\nimport type { ColorStyleTokenListNode } from \"../ColorStyleTokenListNode.ts\"\nimport type { ColorStyleTokenNode } from \"../ColorStyleTokenNode.ts\"\nimport type { ComponentPresetNode } from \"../ComponentPresetNode.ts\"\nimport type {\n\tAnyContentManagementNode,\n\tLoadedContentManagementNode,\n\tShallowContentManagementNode,\n} from \"../ContentManagementNode.ts\"\nimport type { AnyDesignPageNode, LoadedDesignPageNode, ShallowDesignPageNode } from \"../DesignPageNode.ts\"\nimport type { EntityFolderNode } from \"../EntityFolderNode.ts\"\nimport type { EntityReferenceNode } from \"../EntityReferenceNode.ts\"\nimport type { EntityRootNode } from \"../EntityRootNode.ts\"\nimport type { ErrorListNode } from \"../ErrorListNode.ts\"\nimport type { ErrorNode } from \"../ErrorNode.ts\"\nimport type { ExternalModuleNode, ExternalModulesListNode } from \"../ExternalModuleNode.ts\"\nimport type {\n\tArrayRepeater,\n\tCollectionRepeater,\n\tDataRepeater,\n\tdefault as FrameNode,\n\tGridComponentNode,\n\tStackComponentNode,\n} from \"../FrameNode.ts\"\nimport type { FunnelNode } from \"../FunnelNode.ts\"\nimport type { FunnelStepActionNode } from \"../FunnelStepActionNode.ts\"\nimport type { FunnelStepNode } from \"../FunnelStepNode.ts\"\nimport type { HeaderRouteNode } from \"../HeaderRouteNode.ts\"\nimport type { ImageStylePresetNode } from \"../ImageStylePresetNode.ts\"\nimport type { InlineCodeStylePresetNode } from \"../InlineCodeStylePresetNode.ts\"\nimport type {\n\tAnyLayoutTemplateNode,\n\tLoadedLayoutTemplateNode,\n\tShallowLayoutTemplateNode,\n} from \"../LayoutTemplateNode.ts\"\nimport type { LinkStylePresetNode } from \"../LinkStylePresetNode.ts\"\nimport type { LocalizationGlossaryItemNode } from \"../LocalizationGlossaryItemNode.ts\"\nimport type {\n\tAnyLocalizationGlossaryNode,\n\tLoadedLocalizationGlossaryNode,\n\tShallowLocalizationGlossaryNode,\n} from \"../LocalizationGlossaryNode.ts\"\nimport type { OverlayNode } from \"../OverlayNode.ts\"\nimport type { PresetsListNode } from \"../PresetsListNode.ts\"\nimport type { ProxyRouteNode } from \"../ProxyRouteNode.ts\"\nimport type { RedirectRouteNode } from \"../RedirectRouteNode.ts\"\nimport type { RewriteRouteNode } from \"../RewriteRouteNode.ts\"\nimport type { RichTextNode } from \"../RichTextNode.ts\"\nimport type { RootNode } from \"../RootNode.ts\"\nimport type { RouteSegmentNode } from \"../RouteSegmentNode.ts\"\nimport type { RouteSegmentRootNode } from \"../RouteSegmentRootNode.ts\"\nimport type { AnyRoutesNode, LoadedRoutesNode, ShallowRoutesNode } from \"../RoutesNode.ts\"\nimport type { SVGNode } from \"../SVGNode.ts\"\nimport type ShaderNode from \"../ShaderNode.ts\"\nimport type ShapeContainerNode from \"../ShapeContainerNode.ts\"\nimport type ShapeGroupNode from \"../ShapeGroupNode.ts\"\nimport type { SlotNode } from \"../SlotNode.ts\"\nimport type { SlotPropertyNode } from \"../SlotPropertyNode.ts\"\nimport type {\n\tAnySmartComponentNode,\n\tLoadedSmartComponentNode,\n\tShallowSmartComponentNode,\n} from \"../SmartComponentNode.ts\"\nimport type { TableStylePresetNode } from \"../TableStylePresetNode.ts\"\nimport type { TextNode } from \"../TextNode.ts\"\nimport type { TextStylePresetNode } from \"../TextStylePresetNode.ts\"\nimport type { AnyVectorSetNode, LoadedVectorSetNode, ShallowVectorSetNode } from \"../VectorSetNode.ts\"\nimport type { AnyWebPageNode, LoadedWebPageNode, ShallowWebPageNode } from \"../WebPageNode.ts\"\nimport type { BranchNode } from \"../branches/BranchNode.ts\"\nimport type { BranchesNode } from \"../branches/BranchesNode.ts\"\nimport type { CustomCodeNode } from \"../custom-code/CustomCodeNode.ts\"\nimport type {\n\tAnyCustomCodeScopeNode,\n\tLoadedCustomCodeScopeNode,\n\tShallowCustomCodeScopeNode,\n} from \"../custom-code/CustomCodeScopeNode.ts\"\nimport type { FormBooleanInputNode } from \"../forms/FormBooleanInputNode.ts\"\nimport type { FormPlainTextInputNode } from \"../forms/FormPlainTextInputNode.ts\"\nimport type { FormSelectNode } from \"../forms/FormSelectNode.ts\"\nimport type { BooleanShapeNode } from \"../shapes/BooleanShapeNode.ts\"\nimport type { OvalShapeNode } from \"../shapes/OvalShapeNode.ts\"\nimport type { PathNode } from \"../shapes/PathNode.ts\"\nimport type { PolygonShapeNode } from \"../shapes/PolygonShapeNode.ts\"\nimport type { RectangleShapeNode } from \"../shapes/RectangleShapeNode.ts\"\nimport type { StarShapeNode } from \"../shapes/StarShapeNode.ts\"\n\nexport function isRootNode(node: MaybeCanvasNode | AnyScopeNode): node is RootNode {\n\treturn node?.__class === ClassDiscriminator.RootNode\n}\n\n// FrameNode (sub) types\n\nexport function isFrameNode<T extends MaybeAnyCanvasNode>(node: T): node is NonNullable<T> & FrameNode {\n\treturn node?.__class === ClassDiscriminator.FrameNode\n}\n\nexport function isStackComponent(node: MaybeCanvasNode): node is StackComponentNode {\n\treturn isFrameNode(node) && hasStackLayout(node)\n}\n\nexport function isGridComponent(node: MaybeCanvasNode): node is GridComponentNode {\n\treturn isFrameNode(node) && hasGridLayout(node)\n}\n\nexport function isStackOrGridComponent(node: MaybeCanvasNode): node is StackComponentNode | GridComponentNode {\n\treturn isFrameNode(node) && hasAnyLayout(node)\n}\n\nexport function isCollectionRepeater(node: MaybeCanvasNode): node is CollectionRepeater {\n\tif (!node) return false\n\tif (!isStackComponent(node) && !isGridComponent(node)) return false\n\treturn hasCollectionDataSource(node)\n}\n\nexport function isArrayRepeater(node: MaybeCanvasNode): node is ArrayRepeater {\n\tif (!node) return false\n\tif (!isStackComponent(node) && !isGridComponent(node)) return false\n\tif (hasCollectionDataSource(node)) return false\n\treturn Boolean(node.dataRepeaterArray)\n}\n\nexport function isDataRepeater(node: MaybeCanvasNode): node is DataRepeater {\n\tif (!node) return false\n\treturn isCollectionRepeater(node) || isArrayRepeater(node)\n}\n\n// Scopes\ntype UnknownNode =\n\t| {\n\t\t\t__class: ClassDiscriminator\n\t  }\n\t| null\n\t| undefined\n\nexport function isSmartComponentNode<T extends MaybeLoadedScopeNode>(node: T): node is LoadedSmartComponentNode & T\nexport function isSmartComponentNode<T extends MaybeCanvasNode>(\n\tnode: T,\n\tindex: number,\n\t...otherArgs: unknown[]\n): node is never\nexport function isSmartComponentNode(node: unknown, isAnyScope: true): node is AnySmartComponentNode\nexport function isSmartComponentNode<T extends MaybeAnyScope>(node: T): node is AnySmartComponentNode & T\nexport function isSmartComponentNode<T extends MaybeShallowScopeNode>(node: T): node is ShallowSmartComponentNode & T\nexport function isSmartComponentNode<T extends MaybeCanvasNode>(node: T): node is ShallowSmartComponentNode & T\nexport function isSmartComponentNode(node: UnknownNode): node is AnySmartComponentNode {\n\treturn node?.__class === ClassDiscriminator.SmartComponentNode\n}\n\nexport function isLayoutTemplateNode<T extends MaybeLoadedScopeNode>(node: T): node is LoadedLayoutTemplateNode & T\nexport function isLayoutTemplateNode<T extends MaybeCanvasNode>(\n\tnode: T,\n\tindex: number,\n\t...otherArgs: unknown[]\n): node is never\nexport function isLayoutTemplateNode(node: unknown, isAnyScope: true): node is AnyLayoutTemplateNode\nexport function isLayoutTemplateNode<T extends MaybeAnyScope>(node: T): node is AnyLayoutTemplateNode & T\nexport function isLayoutTemplateNode<T extends MaybeShallowScopeNode>(node: T): node is ShallowLayoutTemplateNode & T\nexport function isLayoutTemplateNode<T extends MaybeCanvasNode>(node: T): node is ShallowLayoutTemplateNode & T\nexport function isLayoutTemplateNode(node: UnknownNode): node is AnyLayoutTemplateNode {\n\treturn node?.__class === ClassDiscriminator.LayoutTemplateNode\n}\n\nexport function isVectorSetNode<T extends MaybeLoadedScopeNode>(node: T): node is LoadedVectorSetNode & T\nexport function isVectorSetNode<T extends MaybeCanvasNode>(\n\tnode: T,\n\tindex: number,\n\t...otherArgs: unknown[]\n): node is never\nexport function isVectorSetNode(node: unknown, isAnyScope: true): node is AnyVectorSetNode\nexport function isVectorSetNode<T extends MaybeAnyScope>(node: T): node is AnyVectorSetNode & T\nexport function isVectorSetNode<T extends MaybeShallowScopeNode>(node: T): node is ShallowVectorSetNode & T\nexport function isVectorSetNode<T extends MaybeCanvasNode>(node: T): node is ShallowVectorSetNode & T\nexport function isVectorSetNode(node: UnknownNode): node is AnyVectorSetNode {\n\treturn node?.__class === ClassDiscriminator.VectorSetNode\n}\n\nexport function isWebPageNode<T extends MaybeLoadedScopeNode>(node: T): node is LoadedWebPageNode & T\nexport function isWebPageNode<T extends MaybeCanvasNode>(node: T, index: number, ...otherArgs: unknown[]): node is never\nexport function isWebPageNode(node: unknown, isAnyScope: true): node is AnyWebPageNode\nexport function isWebPageNode<T extends MaybeAnyScope>(node: T): node is AnyWebPageNode & T\nexport function isWebPageNode<T extends MaybeShallowScopeNode>(node: T): node is ShallowWebPageNode & T\nexport function isWebPageNode<T extends MaybeCanvasNode>(node: T): node is ShallowWebPageNode & T\nexport function isWebPageNode(node: UnknownNode): node is AnyWebPageNode {\n\treturn node?.__class === ClassDiscriminator.WebPageNode\n}\n\nexport function isKitPageNode<T extends MaybeLoadedScopeNode>(\n\tnode: T,\n): node is LoadedWebPageNode & T & { kitPage: true }\nexport function isKitPageNode<T extends MaybeCanvasNode>(node: T, index: number, ...otherArgs: unknown[]): node is never\nexport function isKitPageNode(node: unknown, isAnyScope: true): node is AnyWebPageNode & { kitPage: true }\nexport function isKitPageNode<T extends MaybeAnyScope>(node: T): node is AnyWebPageNode & T & { kitPage: true }\nexport function isKitPageNode<T extends MaybeShallowScopeNode>(\n\tnode: T,\n): node is ShallowWebPageNode & T & { kitPage: true }\nexport function isKitPageNode<T extends MaybeCanvasNode>(node: T): node is ShallowWebPageNode & T & { kitPage: true }\nexport function isKitPageNode(node: UnknownNode): node is AnyWebPageNode & { kitPage: true } {\n\treturn Boolean(isWebPageNode(node, true) && node.kitPage)\n}\n\nexport function isDesignPageNode<T extends MaybeLoadedScopeNode>(node: T): node is LoadedDesignPageNode & T\nexport function isDesignPageNode<T extends MaybeCanvasNode>(\n\tnode: T,\n\tindex: number,\n\t...otherArgs: unknown[]\n): node is never\nexport function isDesignPageNode(node: unknown, isAnyScope: true): node is AnyDesignPageNode\nexport function isDesignPageNode<T extends MaybeAnyScope>(node: T): node is AnyDesignPageNode & T\nexport function isDesignPageNode<T extends MaybeShallowScopeNode>(node: T): node is ShallowDesignPageNode & T\nexport function isDesignPageNode<T extends MaybeCanvasNode>(node: T): node is ShallowDesignPageNode & T\nexport function isDesignPageNode(node: UnknownNode): node is AnyDesignPageNode {\n\treturn node?.__class === ClassDiscriminator.DesignPageNode\n}\n\nexport function isCanvasPageNode<T extends MaybeLoadedScopeNode>(node: T): node is LoadedCanvasPageNode & T\nexport function isCanvasPageNode<T extends MaybeCanvasNode>(\n\tnode: T,\n\tindex: number,\n\t...otherArgs: unknown[]\n): node is never\nexport function isCanvasPageNode(node: unknown, isAnyScope: true): node is AnyCanvasPageNode\nexport function isCanvasPageNode<T extends MaybeAnyScope>(node: T): node is AnyCanvasPageNode & T\nexport function isCanvasPageNode<T extends MaybeShallowScopeNode>(node: T): node is ShallowCanvasPageNode & T\nexport function isCanvasPageNode<T extends MaybeCanvasNode>(node: T): node is ShallowCanvasPageNode & T\nexport function isCanvasPageNode(node: UnknownNode): node is AnyCanvasPageNode {\n\treturn node?.__class === ClassDiscriminator.CanvasPageNode\n}\n\nexport function isContentManagementNode<T extends MaybeLoadedScopeNode>(\n\tnode: T,\n): node is LoadedContentManagementNode & T\nexport function isContentManagementNode<T extends MaybeCanvasNode>(\n\tnode: T,\n\tindex: number,\n\t...otherArgs: unknown[]\n): node is never\nexport function isContentManagementNode<T extends MaybeShallowScopeNode>(\n\tnode: T,\n): node is ShallowContentManagementNode & T\nexport function isContentManagementNode<T extends MaybeAnyScope>(node: T): node is AnyContentManagementNode & T\nexport function isContentManagementNode<T extends MaybeCanvasNode>(node: T): node is ShallowContentManagementNode & T\nexport function isContentManagementNode(node: UnknownNode): node is AnyContentManagementNode {\n\treturn node?.__class === ClassDiscriminator.ContentManagementNode\n}\n\n// Text\n\nexport function isTextNode(node: MaybeCanvasNode): node is TextNode<any> {\n\treturn node?.__class === ClassDiscriminator.TextNode\n}\n\nexport function isRichTextNode(node: MaybeCanvasNode): node is RichTextNode {\n\treturn node?.__class === ClassDiscriminator.RichTextNode\n}\n\n// Other\n\nexport function isCodeComponentNode(node: MaybeCanvasNode): node is CodeComponentNode {\n\treturn node?.__class === ClassDiscriminator.CodeComponentNode\n}\n\nexport function isShaderNode(node: MaybeCanvasNode): node is ShaderNode {\n\treturn node?.__class === ClassDiscriminator.ShaderNode\n}\n\nexport function isOverlayNode(node: MaybeCanvasNode): node is OverlayNode {\n\treturn node?.__class === ClassDiscriminator.OverlayNode\n}\n\nexport function isSVGNode(node: MaybeCanvasNode): node is SVGNode {\n\treturn node?.__class === ClassDiscriminator.SVGNode\n}\n\n// CMS\nexport function isCollectionNode(node: MaybeCanvasNode): node is CollectionNode {\n\treturn node?.__class === ClassDiscriminator.CollectionNode\n}\n\nexport function isCollectionItemNode(node: MaybeCanvasNode): node is CollectionItemNode {\n\treturn node?.__class === ClassDiscriminator.CollectionItemNode\n}\n\n// Branch metadata (root-level container)\nexport function isBranchNode(node: MaybeCanvasNode): node is BranchNode {\n\treturn node?.__class === ClassDiscriminator.BranchNode\n}\n\nexport function isBranchesNode(node: MaybeCanvasNode): node is BranchesNode {\n\treturn node?.__class === ClassDiscriminator.BranchesNode\n}\n\n// Shapes\n\nexport function isShapeContainerNode(node: MaybeAnyCanvasNode): node is ShapeContainerNode {\n\treturn node?.__class === ClassDiscriminator.ShapeContainerNode\n}\n\nexport function isBooleanShapeNode(node: MaybeCanvasNode): node is BooleanShapeNode {\n\treturn node?.__class === ClassDiscriminator.BooleanShapeNode\n}\n\nexport function isShapeGroupNode(node: MaybeCanvasNode): node is ShapeGroupNode {\n\treturn node?.__class === ClassDiscriminator.ShapeGroupNode\n}\n\nexport function isPathNode(node: MaybeCanvasNode): node is PathNode {\n\treturn node?.__class === ClassDiscriminator.PathNode\n}\n\nexport function isRectangleShapeNode(node: MaybeCanvasNode): node is RectangleShapeNode {\n\treturn node?.__class === ClassDiscriminator.RectangleShapeNode\n}\n\nexport function isStarShapeNode(node: MaybeCanvasNode): node is StarShapeNode {\n\treturn node?.__class === ClassDiscriminator.StarShapeNode\n}\n\nexport function isOvalShapeNode(node: MaybeCanvasNode): node is OvalShapeNode {\n\treturn node?.__class === ClassDiscriminator.OvalShapeNode\n}\n\nexport function isPolygonShapeNode(node: MaybeCanvasNode): node is PolygonShapeNode {\n\treturn node?.__class === ClassDiscriminator.PolygonShapeNode\n}\n\n// Routes\n\nexport function isRoutesNode<T extends MaybeLoadedScopeNode>(node: T): node is LoadedRoutesNode & T\nexport function isRoutesNode<T extends MaybeCanvasNode>(node: T, index: number, ...otherArgs: unknown[]): node is never\nexport function isRoutesNode<T extends MaybeShallowScopeNode>(node: T): node is ShallowRoutesNode & T\nexport function isRoutesNode<T extends MaybeAnyScope>(node: T): node is AnyRoutesNode & T\nexport function isRoutesNode<T extends MaybeCanvasNode>(node: T): node is ShallowRoutesNode & T\nexport function isRoutesNode(node: UnknownNode): node is AnyRoutesNode {\n\treturn node?.__class === ClassDiscriminator.RoutesNode\n}\n\nexport function isRedirectRouteNode(node: MaybeCanvasNode): node is RedirectRouteNode {\n\treturn node?.__class === ClassDiscriminator.RedirectRouteNode\n}\n\nexport function isProxyRouteNode(node: MaybeCanvasNode): node is ProxyRouteNode {\n\treturn node?.__class === ClassDiscriminator.ProxyRouteNode\n}\n\nexport function isRewriteRouteNode(node: MaybeCanvasNode): node is RewriteRouteNode {\n\treturn node?.__class === ClassDiscriminator.RewriteRouteNode\n}\n\nexport function isHeaderRouteNode(node: MaybeCanvasNode): node is HeaderRouteNode {\n\treturn node?.__class === ClassDiscriminator.HeaderRouteNode\n}\n\n// Color Styles\nexport function isColorStyleTokenNode(node: MaybeCanvasNode): node is ColorStyleTokenNode {\n\treturn node?.__class === ClassDiscriminator.ColorStyleTokenNode\n}\n\nexport function isColorStyleTokenListNode(node: MaybeCanvasNode): node is ColorStyleTokenListNode {\n\treturn node?.__class === ClassDiscriminator.ColorStyleTokenListNode\n}\n\n// Errors\nexport function isErrorListNode(node: MaybeCanvasNode): node is ErrorListNode {\n\treturn node?.__class === ClassDiscriminator.ErrorListNode\n}\n\nexport function isErrorNode(node: MaybeCanvasNode): node is ErrorNode {\n\treturn node?.__class === ClassDiscriminator.ErrorNode\n}\n\n// Forms\nexport function isFormPlainTextInputNode<T extends MaybeCanvasNode>(\n\tnode: T,\n): node is NonNullable<T> & FormPlainTextInputNode {\n\treturn node?.__class === ClassDiscriminator.FormPlainTextInputNode\n}\n\nexport function isFormBooleanInputNode(node: MaybeCanvasNode): node is FormBooleanInputNode {\n\treturn node?.__class === ClassDiscriminator.FormBooleanInputNode\n}\n\nexport function isFormSelectNode(node: MaybeCanvasNode): node is FormSelectNode {\n\treturn node?.__class === ClassDiscriminator.FormSelectNode\n}\n\n// Presets\n\nexport function isComponentPresetNode(node: MaybeCanvasNode): node is ComponentPresetNode {\n\treturn node?.__class === ClassDiscriminator.ComponentPresetNode\n}\n\nexport function isPresetsListNode(node: MaybeCanvasNode): node is PresetsListNode {\n\treturn node?.__class === ClassDiscriminator.PresetsListNode\n}\n\nexport function isTextStylePresetNode(node: MaybeCanvasNode): node is TextStylePresetNode {\n\treturn node?.__class === ClassDiscriminator.TextStylePresetNode\n}\n\nexport type TextStylePresetPrimaryNode = TextStylePresetNode & IsNotReplica\n\nexport function isTextStylePresetPrimaryNode(node: MaybeCanvasNode): node is TextStylePresetPrimaryNode {\n\treturn isTextStylePresetNode(node) && isNotReplica(node)\n}\n\nexport type TextStylePresetBreakpointNode = TextStylePresetNode & IsReplica\n\nexport function isTextStylePresetBreakpointNode(node: MaybeCanvasNode): node is TextStylePresetBreakpointNode {\n\treturn isTextStylePresetNode(node) && isReplica(node)\n}\n\nexport function isLinkStylePresetNode(node: MaybeCanvasNode): node is LinkStylePresetNode {\n\treturn node?.__class === ClassDiscriminator.LinkStylePresetNode\n}\n\nexport function isBlockquoteStylePresetNode(node: MaybeCanvasNode): node is BlockquoteStylePresetNode {\n\treturn node?.__class === ClassDiscriminator.BlockquoteStylePresetNode\n}\n\nexport function isTableStylePresetNode(node: MaybeCanvasNode): node is TableStylePresetNode {\n\treturn node?.__class === ClassDiscriminator.TableStylePresetNode\n}\n\ntype BlockquoteStylePresetPrimaryNode = BlockquoteStylePresetNode & IsNotReplica\n\nexport function isBlockquoteStylePresetPrimaryNode(node: MaybeCanvasNode): node is BlockquoteStylePresetPrimaryNode {\n\treturn isBlockquoteStylePresetNode(node) && isNotReplica(node)\n}\n\nexport function isStylePresetBreakpoint(\n\tnode: MaybeCanvasNode,\n): node is (TextStylePresetNode | BlockquoteStylePresetNode) & IsReplica {\n\treturn isReplica(node) && (isTextStylePresetNode(node) || isBlockquoteStylePresetNode(node))\n}\n\nexport function isImageStylePresetNode(node: MaybeCanvasNode): node is ImageStylePresetNode {\n\treturn node?.__class === ClassDiscriminator.ImageStylePresetNode\n}\n\nexport function isInlineCodeStylePresetNode(node: MaybeCanvasNode): node is InlineCodeStylePresetNode {\n\treturn node?.__class === ClassDiscriminator.InlineCodeStylePresetNode\n}\n\nexport function isRouteSegmentNode(node: MaybeCanvasNode): node is RouteSegmentNode {\n\treturn node?.__class === ClassDiscriminator.RouteSegmentNode\n}\n\nexport function isRouteSegmentRootNode(node: MaybeCanvasNode): node is RouteSegmentRootNode {\n\treturn node?.__class === ClassDiscriminator.RouteSegmentRootNode\n}\n\nexport function isSlotNode<T extends MaybeCanvasNode>(node: T): node is NonNullable<T> & SlotNode {\n\treturn node?.__class === ClassDiscriminator.SlotNode\n}\n\nexport function isSlotPropertyNode<T extends MaybeCanvasNode>(node: T): node is NonNullable<T> & SlotPropertyNode {\n\treturn node?.__class === ClassDiscriminator.SlotPropertyNode\n}\n\nexport function isEntityRootNode<T extends MaybeCanvasNode>(node: T): node is NonNullable<T> & EntityRootNode {\n\treturn node?.__class === ClassDiscriminator.EntityRootNode\n}\n\nexport function isEntityFolderNode<T extends MaybeCanvasNode>(node: T): node is NonNullable<T> & EntityFolderNode {\n\treturn node?.__class === ClassDiscriminator.EntityFolderNode\n}\n\nexport function isEntityReferenceNode<T extends MaybeCanvasNode>(\n\tnode: T,\n): node is NonNullable<T> & EntityReferenceNode {\n\treturn node?.__class === ClassDiscriminator.EntityReferenceNode\n}\n\nexport function isExternalModulesListNode<T extends MaybeCanvasNode>(\n\tnode: T,\n): node is NonNullable<T> & ExternalModulesListNode {\n\treturn node?.__class === ClassDiscriminator.ExternalModulesListNode\n}\n\nexport function isExternalModuleNode<T extends MaybeCanvasNode>(node: T): node is NonNullable<T> & ExternalModuleNode {\n\treturn node?.__class === ClassDiscriminator.ExternalModuleNode\n}\n\n// Analytics\n\nexport function isAnalyticsScopeNode<T extends MaybeLoadedScopeNode>(node: T): node is LoadedAnalyticsScopeNode & T\nexport function isAnalyticsScopeNode<T extends MaybeCanvasNode>(\n\tnode: T,\n\tindex: number,\n\t...otherArgs: unknown[]\n): node is never\nexport function isAnalyticsScopeNode<T extends MaybeShallowScopeNode>(node: T): node is ShallowAnalyticsScopeNode & T\nexport function isAnalyticsScopeNode<T extends MaybeAnyScope>(node: T): node is AnyAnalyticsScopeNode & T\nexport function isAnalyticsScopeNode<T extends MaybeCanvasNode>(node: T): node is ShallowAnalyticsScopeNode & T\nexport function isAnalyticsScopeNode(node: UnknownNode): node is AnyAnalyticsScopeNode {\n\treturn node?.__class === ClassDiscriminator.AnalyticsScopeNode\n}\n\nexport function isLocalizationGlossaryNode<T extends MaybeLoadedScopeNode>(\n\tnode: T,\n): node is LoadedLocalizationGlossaryNode & T\nexport function isLocalizationGlossaryNode<T extends MaybeCanvasNode>(\n\tnode: T,\n\tindex: number,\n\t...otherArgs: unknown[]\n): node is never\nexport function isLocalizationGlossaryNode<T extends MaybeAnyScope>(node: T): node is AnyLocalizationGlossaryNode & T\nexport function isLocalizationGlossaryNode<T extends MaybeShallowScopeNode>(\n\tnode: T,\n): node is ShallowLocalizationGlossaryNode & T\nexport function isLocalizationGlossaryNode<T extends MaybeCanvasNode>(\n\tnode: T,\n): node is ShallowLocalizationGlossaryNode & T\nexport function isLocalizationGlossaryNode(node: UnknownNode): node is AnyLocalizationGlossaryNode {\n\treturn node?.__class === ClassDiscriminator.LocalizationGlossaryNode\n}\n\nexport function isLocalizationGlossaryItemNode<T extends MaybeCanvasNode>(\n\tnode: T,\n): node is NonNullable<T> & LocalizationGlossaryItemNode {\n\treturn node?.__class === ClassDiscriminator.LocalizationGlossaryItemNode\n}\n\nexport function isFunnelNode<T extends MaybeCanvasNode>(node: T): node is NonNullable<T> & FunnelNode {\n\treturn node?.__class === ClassDiscriminator.FunnelNode\n}\n\nexport function isFunnelStepNode<T extends MaybeCanvasNode>(node: T): node is NonNullable<T> & FunnelStepNode {\n\treturn node?.__class === ClassDiscriminator.FunnelStepNode\n}\n\nexport function isFunnelStepActionNode<T extends MaybeCanvasNode>(\n\tnode: T,\n): node is NonNullable<T> & FunnelStepActionNode {\n\treturn node?.__class === ClassDiscriminator.FunnelStepActionNode\n}\n\nexport function isVectorInstance(node: MaybeCanvasNode): node is CodeComponentNode & { isVectorInstance: true } {\n\tif (!node) return false\n\treturn isCodeComponentNode(node) && node.isVectorInstance\n}\n\nexport function isDynamicVectorInstance(\n\tnode: MaybeCanvasNode,\n): node is CodeComponentNode & { dynamicVectorSetIdentifier: DynamicValue } {\n\tif (!isVectorInstance(node)) return false\n\treturn isDynamicValue(node.dynamicVectorSetIdentifier)\n}\n\n/*\n * Custom Code\n */\nexport function isCustomCodeScopeNode<T extends MaybeLoadedScopeNode>(node: T): node is LoadedCustomCodeScopeNode & T\nexport function isCustomCodeScopeNode(node: unknown, isAnyScope: true): node is AnyCustomCodeScopeNode\nexport function isCustomCodeScopeNode<T extends MaybeCanvasNode>(\n\tnode: T,\n\tindex: number,\n\t...otherArgs: unknown[]\n): node is never\nexport function isCustomCodeScopeNode<T extends MaybeShallowScopeNode>(node: T): node is ShallowCustomCodeScopeNode & T\nexport function isCustomCodeScopeNode<T extends MaybeAnyScope>(node: T): node is AnyCustomCodeScopeNode & T\nexport function isCustomCodeScopeNode<T extends MaybeCanvasNode>(node: T): node is ShallowCustomCodeScopeNode & T\nexport function isCustomCodeScopeNode(node: UnknownNode): node is AnyCustomCodeScopeNode {\n\treturn node?.__class === ClassDiscriminator.CustomCodeScopeNode\n}\n\nexport function isCustomCodeNode<T extends MaybeCanvasNode>(node: T): node is NonNullable<T> & CustomCodeNode {\n\treturn node?.__class === ClassDiscriminator.CustomCodeNode\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isSlotPropertyNode } from \"../nodes/utils/nodeCheck.ts\"\n\nexport interface WithSize {\n\twidth: number\n\theight: number\n}\n\nexport const sizeDefaults: WithSize = {\n\twidth: 100,\n\theight: 100,\n}\n\nexport const pathSizeDefaults: WithSize = {\n\twidth: 1,\n\theight: 1,\n}\n\nconst key: keyof WithSize = \"width\"\n\nexport function withSize<T extends CanvasNode>(node: T): node is T & WithSize {\n\tif (isSlotPropertyNode(node)) return false\n\treturn key in node\n}\n", "/**\n * Main entrypoint bundled with published sites and the app runtime.\n * When adding exports, you must also update `src/app/vekter/static/scripts/framer.esm.js`.\n * Exported functions/props MUST use jsdoc:\n * - `@public` if also exported in `indexEditor.ts`\n * - `@internal` otherwise\n *\n * ! Important: **Removing or changing behavior of `index.ts` exports can (and will!) break published Framer sites**. This means whatever you add can in 99.999% of times NEVER be removed.\n * Best practices:\n * - Be mindful when you add `@public` exports. Do code authors really need it?\n * - Exports that should not be updated any longer shall be marked with `@deprecated <reason>`, because code-generated components might still make use of it\n * - When changing function arguments, ensure they're always backwards compatible\n * - Only add exports to `index.ts` if they're needed from code-generated components or on published sites. In other cases (e.g. regular code in vekter), import the needed file directly.\n *\n * Somewhen in the future, the intention is to break this up and create a series of specific\n * entrypoints for `sites`, `sandbox` and further more to remove unnecessary\n * internal API's from the library.\n *\n * See also\n * https://www.notion.so/framer/Framer-Library-Know-How-916501891bf24593a2cc2ea7cfbeeebe\n *\n * @internal\n * @module\n */\n\n// biome-ignore lint/performance/noBarrelFile: this is the entrypoint to the library bundled with sites\nexport { lazy } from \"./router/lazy.tsx\"\nexport { useRouteElementId } from \"./router/useRouteElementId.ts\"\nexport { useCurrentPathVariables } from \"./router/useCurrentPathVariables.tsx\"\nexport { useRouteHandler } from \"./router/useRouteHandler.ts\"\nexport { pushLoadMoreHistory } from \"./router/history.ts\"\nexport { useRouter } from \"./router/RouterContext.tsx\"\nexport { useTracking, type TrackCustomEvent } from \"./modules/useTracking.ts\"\nexport {\n\tuseBooleanQueryParam,\n\tuseDateQueryParam,\n\tuseEnumQueryParam,\n\tuseNumberQueryParam,\n\tuseStringQueryParam,\n\tuseCollectionReferenceQueryParam,\n\tuseMultiCollectionReferenceQueryParam,\n} from \"./router/queryParameters.tsx\"\nexport { useRouteAnchor } from \"./router/useRouteAnchor.ts\"\nexport { useCurrentRoute, useCurrentRouteId } from \"./router/useCurrentRoute.tsx\"\nexport {\n\tuseLayoutDirection,\n\tuseLocale,\n\tuseLocaleCode,\n\tuseLocaleInfo,\n\tuseLocalesForCurrentRoute,\n\tuseLocalizationInfo,\n} from \"./router/useLocale.ts\"\nexport { useRoute } from \"./router/useRoute.ts\"\nexport { turnOffReactEventHandling } from \"./router/hydration/reactHydrationINPOptimizer.ts\"\nexport { markHydrationStart } from \"./router/hydration/hydrationTimings.ts\"\nexport { PageEffectsProvider, usePageEffects } from \"./router/pageEffects/PageEffectsContext.tsx\"\nexport { NotFoundError } from \"./router/error-boundary/NotFoundErrorBoundary.tsx\"\nexport { inferInitialRouteFromPath } from \"./router/inferInitialRouteFromPath.ts\"\nexport { patchRoutesForABTesting } from \"./router/routeVariants.ts\"\nexport type { Locale, LocaleId, LocaleInfo } from \"./router/types.ts\"\nexport { useMetadata } from \"./router/useMetadata.ts\"\n// biome-ignore lint/performance/noReExportAll: Motion, duplicated in `indexEditor.ts`\nexport * from \"framer-motion\"\nexport {\n\tDeprecatedLayoutGroupContext as LayoutGroupContext,\n\tuseDeprecatedAnimatedState as useAnimatedState,\n\tuseDeprecatedInvertedScale as useInvertedScale,\n} from \"framer-motion\"\nexport { Animatable, isAnimatable } from \"./animation/Animatable/Animatable.ts\"\nexport type { AnimatableObject, Cancel, DeprecatedAnimationTarget } from \"./animation/Animatable/Animatable.ts\"\nexport { BezierAnimator, SpringAnimator } from \"./animation/Animators/index.ts\"\nexport { FramerAnimation } from \"./animation/FramerAnimation.ts\"\nexport { MotionSetup } from \"./animation/Motion/MotionSetup.tsx\"\nexport { patchBorderRadiusScaleCorrector } from \"./animation/Motion/patchBorderRadiusScaleCorrector.ts\"\nexport { startAnimation } from \"./animation/Motion/startAnimation.ts\"\nexport { animate } from \"./animation/animate.ts\"\nexport { AutomaticLayoutIds, LayoutIdContext } from \"./components/AnimateLayout/LayoutIdContext.tsx\"\n// These are only used by DeviceNode and should be removed when that is removed\nexport { convertPropsToDeviceOptions, getComponentSize } from \"./components/Device/index.ts\"\nexport { EmptyState } from \"./components/EmptyState.tsx\"\nexport { NavigationCallbackProvider, NavigationConsumer } from \"./components/Navigation.tsx\"\nexport type { NavigationInterface, NavigationProps } from \"./components/Navigation.tsx\"\nexport type {\n\tFadeTransitionOptions,\n\tFlipTransitionOptions,\n\tModalTransitionOptions,\n\tNavigationTransition,\n\tNavigationTransitionAnimation,\n\tNavigationTransitionAppearsFrom,\n\tNavigationTransitionBackdropColor,\n\tNavigationTransitionPosition,\n\tNavigationTransitionSide,\n\tOverlayTransitionOptions,\n\tPushTransitionOptions,\n} from \"./components/NavigationTransitions.ts\"\nexport type { StackAlignment, StackDirection, StackDistribution } from \"./components/Stack/types.ts\"\nexport { WithNavigator } from \"./components/hoc/WithNavigator.tsx\"\nexport { withMeasuredSize } from \"./components/hoc/withMeasuredSize.tsx\"\nexport {\n\tAnimateSharedLayout,\n\tDevice,\n\tDeviceCodeComponent,\n\tDraggable,\n\tErrorPlaceholder,\n\twithInfiniteScroll,\n\tNavigation,\n\tPage,\n\tScroll,\n\tStack,\n\tdefaultDeviceProps,\n\tdevicePresets,\n\tfraction,\n\tgetDevicePreset,\n\tisFractionDimension,\n\tisGapEnabled,\n\ttoFlexDirection,\n\ttoJustifyOrAlignment,\n\tuseIsInCurrentNavigationTarget,\n\tuseOnCurrentTargetChange,\n} from \"./components/index.ts\"\nexport type {\n\tDeviceCodeComponentProps,\n\tDeviceColor,\n\tDeviceOptions,\n\tDevicePreset,\n\tDevicePresetID,\n\tDeviceProps,\n\tEmulatedScrollProps,\n\tNativeScrollProps,\n\tPageAlignment,\n\tPageEffect,\n\tPageEffectInfo,\n\tPageEvents,\n\tPageProperties,\n\tPageProps,\n\tScrollConfig,\n\tScrollEvents,\n\tScrollProps,\n\tStackProperties,\n\tStackSpecificProps,\n} from \"./components/index.ts\"\nexport { useNavigation } from \"./components/useNavigation.ts\"\nexport { makePaddingString, paddingFromProps, parsePaddingString } from \"./components/utils/paddingFromProps.ts\"\nexport { useConstant } from \"./components/utils/useConstant.ts\"\nexport { Data } from \"./data/Data.ts\"\nexport { ObservableObject } from \"./data/ObservableObject.ts\"\nexport { PropertyStore } from \"./data/PropertyStore.ts\"\nexport { DataContext, createData } from \"./data/useData/index.ts\"\nexport { DataObserver, DataObserverContext, useObserveData } from \"./deprecated/DataObserver.tsx\"\nexport { WithOverride } from \"./deprecated/WithOverride.tsx\"\nexport type { Override, OverrideFunction, OverrideObject } from \"./deprecated/WithOverride.tsx\"\nexport { withParallaxTransform, withStyleAppearEffect } from \"./deprecated/deprecatedEffects.ts\"\nexport { FramerEvent, FramerEventListener, FramerEventSession } from \"./events/index.ts\"\nexport { AnyInterpolation, ValueInterpolation } from \"./interpolation/index.ts\"\nexport { ComponentPresetsConsumer, ComponentPresetsProvider } from \"./modules/ComponentPresetsContext.tsx\"\nexport { ComponentViewportProvider, useComponentViewport } from \"./modules/ComponentViewportContext.tsx\"\nexport { Container, SmartComponentScopedContainer } from \"./modules/Container.tsx\"\nexport { CustomCursorHost, useCustomCursors } from \"./modules/CustomCursor.tsx\"\nexport { Floating } from \"./modules/Floating.tsx\"\nexport { Instance } from \"./modules/Instance.tsx\"\nexport { GeneratedComponentContext } from \"./modules/GeneratedComponentContext.ts\"\nexport { AutoBreakpointVariant } from \"./modules/AutoBreakpointVariant.tsx\"\nexport { InjectSelectionStyle } from \"./modules/InjectSelectionStyle.tsx\"\nexport { GracefullyDegradingErrorBoundary } from \"./modules/GracefullyDegradingErrorBoundary.tsx\"\nexport { LazyValue } from \"./modules/LazyValue.ts\"\nexport { LibraryFeaturesProvider } from \"./modules/LibraryFeaturesContext.ts\"\nexport { Link } from \"./modules/Link/index.tsx\"\nexport { AnchorLinkTarget } from \"./modules/Link/types.ts\"\nexport { PathVariablesContext } from \"./modules/Link/pathVariables.tsx\"\nexport { ResetOuterLinkContext } from \"./modules/Link/useReplaceNestedLinks.tsx\"\nexport { propsForLink } from \"./modules/Link/propsForLink.tsx\"\nexport { resolveLink } from \"./modules/Link/resolveLink.ts\"\nexport { resolvePageScope } from \"./modules/Link/resolvePageScope.tsx\"\nexport { nestedLinksCollector } from \"./modules/NestedLinksCollector.ts\"\nexport { handoverCollector } from \"./modules/dataHandover/dataHandover.ts\"\nexport { lazyModulesCollector } from \"./router/lazyModulesCollector.ts\"\nexport { PageRoot } from \"./modules/PageRoot.tsx\"\nexport { PropertyOverrides, SSRVariants } from \"./modules/PropertyOverrides.tsx\"\nexport { ResolveLinks } from \"./modules/ResolveLinks.tsx\"\nexport { Fetcher } from \"./modules/Fetcher.tsx\"\nexport { usePrefetch } from \"./modules/FetchClient.tsx\"\nexport { callEach } from \"./modules/callEach.ts\"\nexport { QueryEngine } from \"./modules/cms/QueryEngine.ts\"\nexport { QueryCache } from \"./modules/cms/QueryCache.ts\"\nexport { CollectionUtilsCache } from \"./modules/cms/CollectionUtilsCache.tsx\"\nexport { executeServerDatabaseQuery } from \"./modules/cms/server-database/mock/executeServerDatabaseQuery.ts\"\nexport { useFormSelectVariableBinding } from \"./modules/cms/useFormSelectVariableBinding.tsx\"\nexport { ChildrenCanSuspend } from \"./modules/ChildrenCanSuspend.tsx\"\nexport { cx } from \"./modules/cx.ts\"\nexport {\n\tcreateFramerPageLink,\n\tisFramerPageLink,\n\tparseFramerPageLink,\n\tshouldOpenLinkInNewTab,\n} from \"./modules/framerPageLink.ts\"\nexport type { FramerPageLinkAttributes } from \"./modules/framerPageLink.ts\"\nexport {\n\tframerAppearAnimationScriptKey,\n\tframerAppearEffects,\n\tframerAppearIdKey,\n\tframerAppearTransformTemplateToken,\n\twithOptimizedAppearEffect,\n\toptimizeAppear,\n\toptimizeAppearTransformTemplate,\n} from \"./modules/optimizeAppear.tsx\"\nexport { createTrigger } from \"./utils/createTrigger.ts\"\nexport { isEmptyTrigger } from \"./utils/triggerActions.ts\"\nexport { TriggerSubscription, useTriggers } from \"./modules/TriggerSubscription.tsx\"\nexport { useActiveTargetCallback, useActiveVariantCallback } from \"./modules/useActiveVariantCallback.ts\"\nexport { useAddVariantProps } from \"./modules/useAddVariantProps.ts\"\nexport {\n\tremoveHiddenBreakpointLayers,\n\tremoveHiddenBreakpointLayersV2,\n\tuseBreakpointVariants,\n\tuseHydratedBreakpointVariants,\n} from \"./modules/useBreakpointVariants.ts\"\nexport { useDataRecord } from \"./modules/useDataRecord.ts\"\nexport { useDynamicRefs, useSiteRefs } from \"./modules/useDynamicRefs.ts\"\nexport { GamepadContext, isFramerGamepadKeydownData, useGamepad } from \"./modules/useGamepad.ts\"\nexport type { FramerGamepadKeydownData } from \"./modules/useGamepad.ts\"\nexport { useHotkey } from \"./modules/useHotkey.ts\"\nexport { useIsOnFramerCanvas } from \"./modules/useIsOnFramerCanvas.ts\"\nexport { isStaticRenderer, useIsStaticRenderer } from \"./modules/useIsStaticRenderer.ts\"\nexport { useNavigate } from \"./modules/useNavigate.tsx\"\nexport { useOnAppear, useOnVariantChange } from \"./modules/useOnVariantChange.ts\"\nexport { useOverlayState } from \"./modules/useOverlayState.tsx\"\nexport { usePrototypeNavigate } from \"./modules/usePrototypeNavigate.tsx\"\nexport {\n\tgetWhereExpressionFromPathVariables,\n\tuseQueryData,\n\tusePreloadQuery,\n\tqueryCache,\n} from \"./modules/useQueryData.ts\"\nexport { useLoadMorePaginatedQuery } from \"./components/utils/useLoadMorePaginatedQuery.tsx\"\nexport { useLoadMorePagination } from \"./components/utils/useLoadMorePagination.tsx\"\nexport { CycleVariantState, VariantSelector, useVariantState } from \"./modules/useVariantState.ts\"\nexport { withCSS, framerCSSMarker, cssCollector } from \"./modules/withCSS.tsx\"\nexport { safeCSSValue } from \"./modules/safeCSSValue.ts\"\nexport { withCodeBoundaryForOverrides } from \"./modules/code-boundary/withCodeBoundaryForOverrides.tsx\"\nexport { withFX } from \"./modules/withFX.tsx\"\nexport { withV1StrokeFX } from \"./modules/withStrokeFX.tsx\"\nexport { withTickerFX } from \"./modules/withTickerFX.tsx\"\nexport { withFlowFX } from \"./modules/withFlowFX.tsx\"\nexport { withMappedReactProps } from \"./modules/withMappedReactProps.tsx\"\nexport { defineShader, isShaderConfig } from \"./modules/defineShader.ts\"\nexport type {\n\tShaderConfig,\n\tShaderControls,\n\tShaderControlDescription,\n\tShaderResolutionScale,\n} from \"./modules/defineShader.ts\"\nexport { Shader } from \"./render/presentation/Shader/Shader.tsx\"\nexport { withVariantAppearEffect } from \"./modules/withVariantAppearEffect.tsx\"\nexport { withVariantFX } from \"./modules/withVariantFX.tsx\"\nexport { installFlexboxGapWorkaroundIfNeeded } from \"./modules/workaroundFlexboxGapNotSupported.ts\"\nexport { StyleSheetContext } from \"./render/StyleSheetContext.ts\"\nexport type { StylesheetContextValue } from \"./render/StyleSheetContext.ts\"\nexport { WindowContext, useProvidedWindow } from \"./render/WindowContext.ts\"\nexport { systemFontFamilyName } from \"./render/fonts/LocalFontSource.ts\"\nexport { fontStore } from \"./render/fonts/fontStore.ts\"\nexport { loadFont } from \"./render/fonts/loadFont.ts\"\nexport { FontSourceNames } from \"./render/fonts/types.ts\"\nexport type {\n\tFont,\n\tFontFamily,\n\tFontFamilyLocator,\n\tFontSelector,\n\tFontSourceName,\n\tReadonlyFont,\n\tReadonlyFontFamily,\n\tWebFontFamilyLocator,\n} from \"./render/fonts/types.ts\"\nexport { ComponentContainerContext } from \"./render/presentation/ComponentContainerContext.tsx\"\nexport { CustomProperties } from \"./render/presentation/CustomProperties.tsx\"\nexport { cssBackgroundSize } from \"./render/presentation/Frame/DeprecatedFrame.tsx\"\nexport { DeprecatedFrameWithEvents, Frame } from \"./render/presentation/Frame/index.tsx\"\nexport { FrameWithMotion } from \"./render/presentation/Frame/FrameWithMotion.tsx\"\nexport { FormContainer } from \"./render/presentation/Forms/FormContainer.tsx\"\nexport { FormPlainTextInput } from \"./render/presentation/Forms/FormPlainTextInput.tsx\"\nexport { FormBooleanInput } from \"./render/presentation/Forms/FormBooleanInput.tsx\"\nexport { FormSelect } from \"./render/presentation/Forms/FormSelect.tsx\"\nexport type {\n\tBaseFrameProps,\n\tCSSTransformProperties,\n\tDeprecatedCoreFrameProps,\n\tDeprecatedFrameProperties,\n\tDeprecatedFrameWithEventsProps,\n\tFrameLayoutProperties,\n\tFrameProps,\n\tVisualProperties,\n} from \"./render/presentation/Frame/index.tsx\"\nexport type { DeprecatedFrame } from \"./render/presentation/Frame/DeprecatedFrame.tsx\"\nexport { Image } from \"./render/presentation/Image.tsx\"\nexport { Layer } from \"./render/presentation/Layer.tsx\"\nexport type { DOMLayoutProps, IdentityProps, LayerProps } from \"./render/presentation/Layer.tsx\"\nexport { withColumnMasonryLayout } from \"./render/presentation/withColumnMasonryLayout.tsx\"\nexport { RelativeDate } from \"./render/presentation/RelativeDate.tsx\"\nexport { RichText } from \"./render/presentation/RichText.tsx\"\nexport type { RichTextProps } from \"./render/presentation/RichText.tsx\"\nexport { SVG } from \"./render/presentation/SVG.tsx\"\nexport type { SVGProperties } from \"./render/presentation/SVG.tsx\"\nexport { sharedSVGManager, useSVGTemplate } from \"./render/presentation/SharedSVGManager.ts\"\nexport { Text } from \"./render/presentation/Text.tsx\"\nexport { TickerItem } from \"./render/presentation/TickerItem.tsx\"\nexport type { TextAlignment, TextProperties, TextVerticalAlignment } from \"./render/presentation/Text.tsx\"\nexport { Vector } from \"./render/presentation/Vector.tsx\"\nexport type { VectorProperties } from \"./render/presentation/Vector.tsx\"\nexport { VectorGroup } from \"./render/presentation/VectorGroup.tsx\"\nexport type { VectorGroupProperties } from \"./render/presentation/VectorGroup.tsx\"\nexport type { BorderComponentProps, BorderStyle } from \"./render/style/BorderComponent.tsx\"\nexport { backgroundImageFromProps } from \"./render/style/backgroundImageFromProps.ts\"\nexport { collectVisualStyleFromProps } from \"./render/style/collectVisualStyleFromProps.ts\"\nexport type { DeprecatedVisualProperties } from \"./render/style/collectVisualStyleFromProps.ts\"\nexport { localShadowFrame } from \"./render/style/shadow.tsx\"\nexport type { BackgroundFilterProperties } from \"./render/traits/BackdropFilters.ts\"\nexport type { Background, BackgroundProperties } from \"./render/traits/Background.ts\"\nexport type { BlendingMode, BlendingProperties } from \"./render/traits/Blending.ts\"\nexport type { BoxShadowProperties } from \"./render/traits/BoxShadow.ts\"\nexport type { FillProperties } from \"./render/traits/Fill.ts\"\nexport type { FilterNumberProperties, FilterProperties } from \"./render/traits/Filters.ts\"\nexport type { WithFractionOfFreeSpace } from \"./render/traits/FreeSpace.ts\"\nexport { withOpacity } from \"./render/traits/Opacity.ts\"\nexport type { WithOpacity } from \"./render/traits/Opacity.ts\"\nexport { isStraightCurve, pathDefaults, toSVGPath, withPath } from \"./render/traits/Path.ts\"\nexport type { WithPath, WithPaths } from \"./render/traits/Path.ts\"\nexport type { RadiusProperties } from \"./render/traits/Radius.ts\"\nexport { withShape } from \"./render/traits/Shape.ts\"\nexport type { WithShape } from \"./render/traits/Shape.ts\"\nexport type { TextColorProperties } from \"./render/traits/TextColor.ts\"\nexport type { Action, ActionControlDescription, ActionControls, ActionHandler } from \"./render/types/Action.ts\"\nexport { BackgroundImage } from \"./render/types/BackgroundImage.ts\"\nexport type { ImageFit } from \"./render/types/BackgroundImage.ts\"\nexport { modulate } from \"./render/types/Color/Utils.ts\"\nexport { Color, ConvertColor } from \"./render/types/Color/index.ts\"\nexport type { ColorMixOptions } from \"./render/types/Color/index.ts\"\nexport { ColorFormat, ColorMixModelType } from \"./render/types/Color/types.ts\"\nexport type { ColorHSL, ColorHSLA, ColorHSVA, ColorRGBA, IncomingColor } from \"./render/types/Color/types.ts\"\nexport { ConstraintMask, ConstraintValues, DimensionType, valueToDimensionType } from \"./render/types/Constraints.ts\"\nexport type { ConstraintPercentage, ConstraintProperties, DefaultProps } from \"./render/types/Constraints.ts\"\nexport { LinearGradient, RadialGradient } from \"./render/types/Gradient.ts\"\nexport type { Gradient, LinearGradientBase, RadialGradientBase } from \"./render/types/Gradient.ts\"\nexport { Line } from \"./render/types/Line.ts\"\nexport { NavigateTo, NavigationTransitionType } from \"./render/types/NavigationLink.ts\"\nexport type { NavigationLink, NavigationTarget, NavigationTransitionDirection } from \"./render/types/NavigationLink.ts\"\nexport { ParentSizeState, calculateRect, constraintsEnabled } from \"./render/types/NewConstraints.tsx\"\nexport type { NewConstraintProperties, PositionStickyProperties } from \"./render/types/NewConstraints.tsx\"\nexport { PathSegment } from \"./render/types/PathSegment.ts\"\nexport type { PathSegments } from \"./render/types/PathSegments.ts\"\nexport { Point } from \"./render/types/Point.ts\"\nexport { ControlType } from \"./render/types/PropertyControls.ts\"\nexport type {\n\tArrayControlDescription,\n\tArrayItemControlDescription,\n\tBaseControlDescription,\n\tBooleanControlDescription,\n\tBorderControlDescription,\n\tBoxShadowControlDescription,\n\tColorControlDescription,\n\tComponentInstanceDescription,\n\tControlDescription,\n\tDateControlDescription,\n\tEnumControlDescription,\n\tEventHandlerControlDescription,\n\tFileControlDescription,\n\tFusedNumberControlDescription,\n\tImageControlDescription,\n\tKeyable,\n\tNumberControlDescription,\n\tObjectControlDescription,\n\tObjectPropertyControlDescription,\n\tPageScopeControlDescription,\n\tPropertyControls,\n\tSegmentedControlIcon,\n\tSegmentedEnumControlDescription,\n\tStringControlDescription,\n\tTransitionControlDescription,\n} from \"./render/types/PropertyControls.ts\"\nexport { Rect } from \"./render/types/Rect.ts\"\nexport { Polygon } from \"./render/types/Polygon.ts\"\nexport { isRelativeNumber } from \"./render/types/RelativeNumber.ts\"\nexport type { RelativeNumber } from \"./render/types/RelativeNumber.ts\"\nexport {\n\tRenderTarget,\n\texecuteInRenderEnvironment,\n\tsetGlobalRenderEnvironment,\n\tuseRenderEnvironment,\n} from \"./render/types/RenderEnvironment.ts\"\nexport { BoxShadow, Shadow } from \"./render/types/Shadow.ts\"\nexport { Size } from \"./render/types/Size.ts\"\nexport type { LineCap, LineJoin } from \"./render/types/Stroke.ts\"\nexport type { StrokeAlignment } from \"./render/types/StrokeAlignment.ts\"\nexport type { TransformValues } from \"./render/types/TransformValues.ts\"\nexport { annotateTypeOnStringify, isOfAnnotatedType } from \"./render/utils/annotateTypeOnStringify.ts\"\nexport { debounce } from \"./render/utils/debounce.ts\"\nexport { DOM, dispatchKeyDownEvent, frameFromElement, frameFromElements } from \"./render/utils/dom.ts\"\nexport type { LinearGradientElementProperties } from \"./render/utils/elementPropertiesForGradient.ts\"\nexport { getLoadingLazyAtYPosition } from \"./render/utils/getLoadingLazyAtYPosition.ts\"\nexport { getMeasurableCodeComponentChildren } from \"./render/utils/getMeasurableCodeComponentChildren.ts\"\nexport { preloadImage } from \"./render/utils/preloadImage.ts\"\nexport { gradientForShape } from \"./render/utils/gradientForShape.tsx\"\nexport { imagePatternPropsForFill } from \"./render/utils/imagePatternPropsForFill.tsx\"\nexport { imageUrlForAsset } from \"./render/utils/imageUrlForAsset.ts\"\nexport { combinedCSSRulesForPreview } from \"./render/utils/injectComponentCSSRules.ts\"\nexport { isEqual } from \"./render/utils/isEqual.ts\"\nexport { finiteNumber, isFiniteNumber } from \"./render/utils/isFiniteNumber.ts\"\nexport { isMotionValue } from \"./render/utils/isMotionValue.ts\"\nexport { isShallowEqualArray } from \"./render/utils/isShallowEqualArray.ts\"\nexport { roundWithOffset, roundedNumber, roundedNumberString } from \"./render/utils/roundedNumber.ts\"\nexport { forceLayerBackingWithCSSProperties } from \"./render/utils/setLayerBacked.ts\"\nexport { throttle } from \"./render/utils/throttle.ts\"\nexport { transformString } from \"./render/utils/transformString.ts\"\nexport { transformTemplate } from \"./render/utils/transformTemplate.ts\"\nexport { useMeasureLayout } from \"./render/utils/useMeasureLayout.ts\"\nexport { withGeneratedLayoutId } from \"./render/utils/withGeneratedLayoutId.tsx\"\nexport { degreesToRadians } from \"./render/utils/degreesToRadians.ts\"\nexport { addActionControls } from \"./utils/addActionControls.ts\"\nexport type { ActionInfo } from \"./utils/addActionControls.ts\"\nexport { addFonts, getFonts, getFontsFromComponentPreset, getFontsFromSharedStyle } from \"./utils/addFonts.ts\"\nexport type { ComponentFont } from \"./utils/addFonts.ts\"\nexport { addPropertyControls, getPropertyControls } from \"./utils/addPropertyControls.ts\"\nexport { withPerformanceMarks } from \"./utils/withPerformanceMarks.ts\"\nexport { clampRGB } from \"./render/types/Color/Color.ts\"\n// XXX: Workaround for https://github.com/microsoft/rushstack/issues/1029\n//\n// When fixed, replace with `export { environment } from \"./utils.js\"`, and remove\n// the `environment` export from ./utils/environment.ts\nexport { environment } from \"./utils/environment.ts\"\nexport { InternalID } from \"./utils/internalId.ts\"\nexport { memoize } from \"./utils/memoize.ts\"\nexport { loadJSON } from \"./utils/network.ts\"\nexport { print } from \"./utils/print.ts\"\nexport { _injectRuntime } from \"./utils/runtimeInjection.ts\"\nexport type { Runtime } from \"./utils/runtimeInjection.ts\"\nexport { useInitialRouteComponent } from \"./utils/useInitialRouteComponent.ts\"\nexport { yieldToMain } from \"./utils/yield.ts\"\nexport { initLazyModulesCache } from \"./router/lazyModulesCache.ts\"\nexport { forwardLoader } from \"./modules/loader/forwardLoader.ts\"\nexport { addLoader } from \"./modules/loader/addLoader.ts\"\n\nexport { version } from \"./version.ts\"\nexport { MainLoop } from \"./core/Loop.ts\"\n\nimport \"./animation/Motion/addChildHack.ts\"\nimport { MainLoop } from \"./core/Loop.ts\"\n\n// Only start the loop if this is the library\nif (process.env.BUILD_NAME === \"framer\") {\n\tMainLoop.start()\n}\n", "import { forwardRef, isValidElement, useEffect } from \"react\"\nimport { isPromise } from \"../utils/utils.ts\"\nimport { lazyModulesCache } from \"./lazyModulesCache.ts\"\nimport { lazyModulesCollector } from \"./lazyModulesCollector.ts\"\nimport type { ComponentWithPreload, MaybePromise } from \"./types.ts\"\n\n// biome-ignore lint/suspicious/noExplicitAny: any is intended\nconst preloadKey: keyof ComponentWithPreload<any> = \"preload\"\n\n/**\n * @internal\n */\nexport function isLazyComponentType<T extends React.ComponentType>(\n\tcomponentType?: unknown,\n): componentType is ComponentWithPreload<T> {\n\treturn (\n\t\ttypeof componentType === \"object\" &&\n\t\tcomponentType !== null &&\n\t\t!isValidElement(componentType) &&\n\t\tpreloadKey in componentType\n\t)\n}\n\ntype Module<T> = Record<string, T> | { default: T }\n\nfunction getLoadedComponent<T>(module: Module<T>, moduleName: string): T {\n\tif (moduleName in module) {\n\t\treturn module[moduleName as keyof Module<T>]\n\t}\n\tthrow new Error(`Module does not contain export '${moduleName}'`)\n}\n\n/**\n * Returns a React component with a `preload` function that can be used to preload the component before it's mounted.\n *\n * @param factory Must be a function that returns the `import(...)` promise. It's important to keep this outside of `lazy` so that esbuild can statically analyze the bundle (e.g. `import(importUrl)` breaks it).\n * @param moduleName The name of the export to use from the module (default: \"default\")\n * @param cacheHash Optional hash of the module filename, used for cache optimization. During build, this is automatically injected as a compact hash of the filename extracted from the original HTTPS URL (e.g., \"YouTube.js\" \u2192 hash).\n * @internal\n */\nexport function lazy<T extends React.ComponentType>(\n\tfactory: () => Promise<Module<T>>,\n\tmoduleName = \"default\",\n\tcacheHash?: string,\n): ComponentWithPreload<T> {\n\t// biome-ignore lint/suspicious/noConfusingVoidType: void is correct here\n\tlet factoryPromise: Promise<void | T> | undefined\n\tlet LoadedComponent: T | undefined\n\n\tlet error: Error | undefined\n\n\tconst updateFromCache = () => {\n\t\tif (LoadedComponent || !cacheHash || !lazyModulesCache.has(cacheHash)) return\n\n\t\tconst maybeModule = lazyModulesCache.get(cacheHash) as MaybePromise<Module<T>>\n\t\tif (isPromise(maybeModule)) {\n\t\t\tvoid load(() => maybeModule)\n\t\t} else {\n\t\t\tLoadedComponent = getLoadedComponent(maybeModule, moduleName)\n\t\t}\n\t}\n\n\tconst load = (factoryFn: () => Promise<Module<T>>) => {\n\t\tif (LoadedComponent) return Promise.resolve(LoadedComponent)\n\n\t\tif (!factoryPromise) {\n\t\t\tfactoryPromise = factoryFn()\n\t\t\t\t.then(module => {\n\t\t\t\t\tconst component = getLoadedComponent(module, moduleName)\n\t\t\t\t\tLoadedComponent = component\n\t\t\t\t\treturn component\n\t\t\t\t})\n\t\t\t\t.catch(err => {\n\t\t\t\t\t// A preload is optional in most cases, so we don't want to handle the error\n\t\t\t\t\t// here. We record it instead and during render handle it.\n\t\t\t\t\terror = err\n\t\t\t\t})\n\t\t}\n\n\t\treturn factoryPromise\n\t}\n\n\tlet hasRendered = false\n\n\tconst Component = forwardRef(function LazyWithPreload(\n\t\tprops: JSX.LibraryManagedAttributes<T, object>,\n\t\tref: React.Ref<React.ComponentRef<T>>,\n\t) {\n\t\tuseEffect(() => {\n\t\t\thasRendered = true\n\t\t}, [])\n\n\t\tif (error) {\n\t\t\tthrow error\n\t\t}\n\n\t\tupdateFromCache()\n\n\t\t// Collect the URL hash for SSG to track which lazy modules are used\n\t\tif (cacheHash !== undefined && lazyModulesCollector !== undefined) {\n\t\t\tlazyModulesCollector.add(cacheHash)\n\t\t}\n\n\t\t// We prefer manually throwing here over `React.lazy` as the native lazy method will\n\t\t// *always* Suspend during the 1st render, even if the component has already loaded.\n\t\tif (!LoadedComponent) {\n\t\t\tthrow load(factory)\n\t\t}\n\n\t\treturn <LoadedComponent ref={ref} {...props} />\n\t}) as unknown as ComponentWithPreload<T>\n\n\tComponent.preload = () => {\n\t\tupdateFromCache()\n\t\treturn load(factory)\n\t}\n\n\tComponent.getStatus = () => {\n\t\treturn {\n\t\t\thasLoaded: LoadedComponent !== undefined,\n\t\t\thasRendered,\n\t\t}\n\t}\n\n\treturn Component\n}\n", "import { isWindow, noop } from \"../utils/utils.ts\"\n\n/**\n * Module-scoped cache for lazy-loaded modules handed over from SSG.\n * This cache is populated before hydration starts, allowing lazy components\n * to load synchronously during hydration.\n *\n * @internal\n */\nexport const lazyModulesCache: Map<string, unknown | Promise<unknown>> = new Map()\n\n/**\n * Initialize lazy modules cache by preloading modules from link tags.\n * Should be called during hydration to populate the cache.\n * @internal\n */\nexport function initLazyModulesCache() {\n\tif (!isWindow) return\n\n\tconst lazyPreloadLinks = document.querySelectorAll('[rel=\"modulepreload\"][data-framer-lazy]')\n\n\tfor (const link of lazyPreloadLinks) {\n\t\tconst hash = link.getAttribute(\"data-framer-lazy\")\n\t\tconst url = link.getAttribute(\"href\")\n\t\tif (!hash || !url) continue\n\n\t\tconst promise = import(url)\n\t\t\t.then(module => {\n\t\t\t\tlazyModulesCache.set(hash, module)\n\t\t\t\treturn module\n\t\t\t})\n\t\t\t.catch(error => {\n\t\t\t\t// Remove failed entries to allow retry\n\t\t\t\tlazyModulesCache.delete(hash)\n\n\t\t\t\t// biome-ignore lint/suspicious/noConsole: intentional\n\t\t\t\tconsole.warn(`Failed to import lazy module: ${url}`, error)\n\n\t\t\t\tthrow error\n\t\t\t})\n\n\t\t// Prevent unhandled rejection warnings - errors will be handled by lazy components\n\t\tpromise.catch(noop)\n\n\t\tlazyModulesCache.set(hash, promise)\n\t}\n}\n\nexport const testing = {\n\tclear() {\n\t\tlazyModulesCache.clear()\n\t},\n}\n", "import { isWindow } from \"../utils/utils.ts\"\n\n/**\n * @internal\n */\nexport const lazyModulesCollector = /* @__PURE__ */ isWindow ? undefined : new Set<string>()\n", "import React from \"react\"\nimport { useCurrentRoute } from \"./useCurrentRoute.tsx\"\nimport { useRoute } from \"./useRoute.ts\"\nimport { getRouteElementId } from \"./utils.ts\"\n\nexport function useRouteElementId(id: string, targetRouteId?: string) {\n\tconst currentRoute = useCurrentRoute()\n\tconst route = useRoute(targetRouteId) ?? currentRoute\n\n\treturn React.useMemo(() => {\n\t\tif (!route) return id\n\t\treturn getRouteElementId(route, id)\n\t}, [id, route])\n}\n", "import React, { useContext, useMemo } from \"react\"\nimport { isEqual } from \"../render/utils/isEqual.ts\"\nimport { useRouter } from \"./RouterContext.tsx\"\nimport type { ActiveRoute, RouteId } from \"./types.ts\"\n\ninterface CurrentRouteContextValue {\n\trouteId?: RouteId\n\tpathVariables?: Record<string, unknown>\n}\nconst CurrentRouteContext = /* @__PURE__ */ (() => React.createContext<CurrentRouteContextValue>({}))()\n\n/**\n * @FIXME - Now that we support ControlType.Link any user code component could\n * choose to use the value of a ControlType.Link prop as a string that is\n * rendered on the canvas. To ensure that framer page link values used in this\n * way look as expected, we need to provide the entire router on the canvas so\n * that any framer-page consumed in this way are properly resolved to paths.\n *\n * Component to only provide the current routeId. Used by the CanvasRenderer\n * component to provide the current routeId on the canvas\n * @returns\n */\nexport function CurrentRouteProvider({\n\trouteId,\n\tpathVariables,\n\tchildren,\n}: React.PropsWithChildren<{ routeId?: RouteId; pathVariables?: Record<string, unknown> }>) {\n\tconst value = useMemo(() => ({ routeId, pathVariables }), [routeId, pathVariables])\n\treturn <CurrentRouteContext.Provider value={value}>{children}</CurrentRouteContext.Provider>\n}\n\nexport function useCurrentRoute(): ActiveRoute | undefined {\n\tconst router = useRouter()\n\tconst override = useContext(CurrentRouteContext)\n\tconst id = override?.routeId ?? router.currentRouteId\n\tconst pathVariables = override?.routeId ? override.pathVariables : router.currentPathVariables\n\tconst route = id ? router.getRoute?.(id) : undefined\n\n\treturn useMemo(() => {\n\t\tif (!id || !route) return undefined\n\n\t\treturn {\n\t\t\t...route,\n\t\t\tid,\n\t\t\tpathVariables,\n\t\t} satisfies ActiveRoute\n\t}, [id, pathVariables, route])\n}\n\n/**\n * When effects need to rerun when the route changes, using the routeId is not enough as the id can\n * stay the same but the path variables can change.\n */\nexport function useCurrentRouteKey() {\n\tconst currentRoute = useCurrentRoute()\n\tif (!currentRoute) return undefined\n\treturn `${currentRoute.id}-${JSON.stringify(currentRoute.pathVariables)}`\n}\n\n/** @deprecated Prefer `useCurrentRoute` instead. */\nexport function useCurrentRouteId(): RouteId | undefined {\n\treturn useCurrentRoute()?.id\n}\n\n/**\n * Execute a side-effect *during render* when the route changes. This includes when the slug of a collection detail\n * page changes.\n */\nexport function useOnRouteChange(cb: (route: ActiveRoute) => void) {\n\tconst currentRoute = useCurrentRoute()\n\tconst lastRoute = React.useRef<ActiveRoute | undefined>(currentRoute)\n\n\tif (isEqual(lastRoute.current, currentRoute) || !currentRoute) return\n\n\t// Writing to the ref here is safe, as it's guarded by the check above, as we run the side-effect only once.\n\tlastRoute.current = currentRoute\n\tcb(currentRoute)\n}\n", "import React, { useMemo } from \"react\"\nimport type { RouterAPI, Routes } from \"./types.ts\"\nimport { useGetRouteCallback } from \"./useGetRouteCallback.ts\"\n\nconst RouterContext = /* @__PURE__ */ (() => React.createContext<Partial<RouterAPI>>({}))()\n\n/**\n * @public\n */\nexport function RouterAPIProvider({ api, children }: React.PropsWithChildren<{ api: RouterAPI }>) {\n\treturn <RouterContext.Provider value={api}>{children}</RouterContext.Provider>\n}\n\n/**\n * @public\n */\nexport function useRouter(): Partial<RouterAPI> {\n\treturn React.useContext(RouterContext)\n}\n\n/**\n *\n * Component to only provide the routes. Used by the Navigation component to\n * still be able to look up routes by id\n * @returns\n */\nexport function RoutesProvider({ routes, children }: React.PropsWithChildren<{ routes: Routes }>) {\n\tconst getRoute = useGetRouteCallback(routes)\n\tconst api = useMemo(() => ({ getRoute }), [getRoute])\n\treturn <RouterContext.Provider value={api}>{children}</RouterContext.Provider>\n}\n", "import React from \"react\"\nimport type { Route, RouteId, RouterAPI, Routes } from \"./types.ts\"\n\nexport function useGetRouteCallback(routes: Routes): RouterAPI[\"getRoute\"] {\n\treturn React.useCallback((routeId: RouteId): Route | undefined => routes[routeId], [routes])\n}\n", "import { useRouter } from \"./RouterContext.tsx\"\nimport type { Route, RouteId } from \"./types.ts\"\n\nexport function useRoute(routeId: RouteId | undefined): Route | undefined {\n\tconst routerAPI = useRouter()\n\tif (!routeId) return undefined\n\treturn routerAPI.getRoute?.(routeId)\n}\n", "import type { Hash, Route } from \"./types.ts\"\n\n/**\n * Retrieve the human readable element id from the Route definition, if it\n * exists.\n *\n * @internal\n */\nexport function getRouteElementId(route?: Route, hash?: Hash) {\n\tif (hash && route) {\n\t\tif (route.elements && hash in route.elements) {\n\t\t\treturn route.elements[hash]\n\t\t} else {\n\t\t\treturn hash\n\t\t}\n\t}\n\n\treturn undefined\n}\n\nexport const EMPTY_ARRAY = [] as const\n\nexport function monitorINPRelatedInputs(signal?: AbortSignal) {\n\t// We omit \"click\" as either of the pointer events comes before.\n\tconst inpRelatedInputs = [\"pointerdown\", \"pointerup\", \"keydown\", \"keyup\"]\n\n\tconst inpRelatedInputHandler = (event: Event) => {\n\t\tconst type = event.type\n\t\tif (!inpRelatedInputs.includes(type)) return\n\t\tperformance.mark(`framer-navigation-input`, {\n\t\t\tdetail: {\n\t\t\t\ttype,\n\t\t\t},\n\t\t})\n\t}\n\n\tfor (let i = 0; i < inpRelatedInputs.length; i++) {\n\t\t// biome-ignore lint/style/noNonNullAssertion: it exists\n\t\tdocument.addEventListener(inpRelatedInputs[i]!, inpRelatedInputHandler, { signal })\n\t}\n\n\treturn () => {\n\t\tfor (let i = 0; i < inpRelatedInputs.length; i++) {\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: it exists\n\t\t\tdocument.removeEventListener(inpRelatedInputs[i]!, inpRelatedInputHandler)\n\t\t}\n\t}\n}\n", "import { useCurrentRoute } from \"./useCurrentRoute.tsx\"\n\n/** @deprecated Prefer `useCurrentRoute` instead. */\nexport function useCurrentPathVariables(): Record<string, unknown> | undefined {\n\treturn useCurrentRoute()?.pathVariables\n}\n", "import React from \"react\"\nimport { useRouter } from \"./RouterContext.tsx\"\nimport type { RouteId } from \"./types.ts\"\nimport { useRoutePreloader } from \"./useRoutePreloader.ts\"\n\nexport function useRouteHandler(routeId: RouteId, preload: boolean = false, elementId?: string): () => void {\n\tconst { navigate } = useRouter()\n\n\tuseRoutePreloader([routeId], preload)\n\n\t// FIXME: This doesn't support using path variables from the current scope (e.g. Repeater).\n\tconst handler = React.useCallback(() => navigate?.(routeId, elementId), [navigate, elementId, routeId])\n\treturn handler\n}\n", "import { useCallback, useEffect } from \"react\"\nimport { useLibraryFeatures } from \"../modules/LibraryFeaturesContext.ts\"\nimport { type CollectionUtilsCacheContextValue, useCollectionUtils } from \"../modules/cms/CollectionUtilsCache.tsx\"\nimport type { ComponentLoader, LoaderContext } from \"../modules/loader/loaderTypes.ts\"\nimport { isBot } from \"../utils/utils.ts\"\nimport { yieldToMain } from \"../utils/yield.ts\"\nimport { useRouter } from \"./RouterContext.tsx\"\nimport { isLazyComponentType } from \"./lazy.tsx\"\nimport type { Locale, Route, RouteId } from \"./types.ts\"\n\n// we don't want to cause preloads for bots executing JS.\n// ref: https://github.com/framer/company/issues/25235\nexport const shouldPreloadBasedOnUA = !isBot\n\n/**\n * Context for preloading a route's data.\n */\nexport interface PreloadRouteContext {\n\trouteId: RouteId\n\tpathVariables?: LinkContext[\"pathVariables\"]\n\tlocale?: LinkContext[\"locale\"]\n\tcollectionUtils?: CollectionUtilsCacheContextValue\n\tsignal?: AbortSignal\n}\n\nexport interface LinkContext {\n\tpathVariables?: Record<string, unknown>\n\tlocale?: Locale\n}\n\n/**\n * Hook that returns a preload function with locale and collectionUtils already bound.\n * Use this instead of calling preloadRoute directly to ensure proper context.\n *\n * @example\n * const preload = usePreloadRoute()\n * preload(route, routeId, pathVariables) // preloads code + data\n * preload(route) // preloads code only\n */\nexport function usePreloadRoute(): (\n\trouteId: RouteId,\n\tlinkContext: LinkContext,\n\tyieldBeforePreload?: boolean,\n\tshouldLoadRouteData?: boolean,\n) => Promise<void> | undefined {\n\tconst collectionUtils = useCollectionUtils()\n\tconst { autobahnNavigation: autobahnNavigationEnabled } = useLibraryFeatures()\n\tconst { getRoute } = useRouter()\n\n\treturn useCallback(\n\t\t(routeId, linkContext, yieldBeforePreload = true, shouldLoadRouteData = true) => {\n\t\t\tif (!routeId || !getRoute) return\n\n\t\t\tconst route = getRoute(routeId)\n\t\t\tconst { pathVariables, locale } = linkContext\n\t\t\treturn preloadRoute(\n\t\t\t\troute,\n\t\t\t\t{ routeId, pathVariables, locale, collectionUtils },\n\t\t\t\tyieldBeforePreload,\n\t\t\t\tshouldLoadRouteData && autobahnNavigationEnabled,\n\t\t\t)\n\t\t},\n\t\t[getRoute, collectionUtils, autobahnNavigationEnabled],\n\t)\n}\n\n/**\n * @deprecated see https://framer-team.slack.com/archives/CR3CYA1D4/p1714029035087469.\n */\nexport function useRoutePreloader(routeIds: RouteId[], enabled = true) {\n\tconst preload = usePreloadRoute()\n\n\tuseEffect(() => {\n\t\tif (!enabled || !shouldPreloadBasedOnUA) return\n\n\t\t// To ensure that the navigate action is not delayed by having to\n\t\t// fetch the source code of the target page, we preload the target page\n\t\t// of the navigate action after the component mounts.\n\t\tfor (const routeId of routeIds) {\n\t\t\tvoid preload(routeId, {})\n\t\t}\n\t}, [routeIds, enabled, preload])\n}\n\n/**\n * Preloads a route's component module and optionally its data.\n *\n * @param route - The route to preload\n * @param context - Optional context for data preloading (routeId, pathVariables, locale, collectionUtils)\n */\nexport async function preloadRoute(\n\troute?: Route,\n\tcontext?: PreloadRouteContext,\n\tyieldBeforePreload = true,\n\tshouldLoadRouteData = true,\n): Promise<void> {\n\tif (!shouldPreloadBasedOnUA || !route) return\n\n\tconst component = route.page\n\tif (!component || !isLazyComponentType(component)) return\n\n\t// by yielding first, we make sure chained `import` tasks do not create long tasks, see: https://github.com/whatwg/html/issues/4400\n\tif (yieldBeforePreload) {\n\t\tawait yieldToMain()\n\t}\n\n\ttry {\n\t\t// Preload the component module (code)\n\t\tconst loadedComponent = await component.preload()\n\n\t\t// Preload data if component has a loader and context is provided\n\t\tif (shouldLoadRouteData && context && loadedComponent) {\n\t\t\tawait loadRouteData(loadedComponent, context)\n\t\t}\n\t} catch (e) {\n\t\t// biome-ignore lint/suspicious/noConsole: debug log\n\t\tif (process.env.NODE_ENV !== \"production\") console.warn(\"Preload failed\", route, e)\n\t\t// we can just swallow the error here, preloading routes is not critical.\n\t}\n}\n\n/**\n * Preloads a component's data using its loader.\n * This is called after the component module is loaded.\n */\nasync function loadRouteData(\n\tcomponent: React.ComponentType<unknown> & { loader?: ComponentLoader },\n\tcontext: PreloadRouteContext,\n): Promise<void> {\n\tconst loader = component.loader\n\tif (!loader?.load) return\n\n\tconst loaderContext: LoaderContext = {\n\t\tsignal: context.signal ?? new AbortController().signal,\n\t\tpathVariables: context.pathVariables ?? {},\n\t\trouteId: context.routeId,\n\t\tlocale: context.locale,\n\t\tcollectionUtils: context.collectionUtils,\n\t}\n\n\ttry {\n\t\t// Call the loader - it returns Promise.allSettled so individual failures don't break\n\t\tawait loader.load({}, loaderContext)\n\t} catch (e) {\n\t\t// biome-ignore lint/suspicious/noConsole: debug log\n\t\tif (process.env.NODE_ENV !== \"production\") console.warn(\"Route data preload failed\", e)\n\t\t// Don't block navigation on data preload failures\n\t}\n}\n", "import React from \"react\"\n\nexport interface LibraryFeatures {\n\teditorBarDisableFrameAncestorsSecurity?: boolean\n\tmotionDivToDiv?: boolean\n\tyieldOnTap?: boolean\n\tsynchronousNavigationOnDesktop?: boolean\n\tonPageMoveTool?: boolean\n\tonPageLocalizationSupport?: boolean\n\tautobahnNavigation?: boolean\n\tdisableCustomCode?: boolean\n}\n\nexport const LibraryFeaturesContext = /* @__PURE__ */ React.createContext<LibraryFeatures | undefined>(undefined)\nLibraryFeaturesContext.displayName = \"LibraryFeaturesContext\"\nexport const LibraryFeaturesProvider = /* @__PURE__ */ (() => LibraryFeaturesContext.Provider)()\n\nexport const useLibraryFeatures = (): LibraryFeatures => {\n\tconst context = React.useContext(LibraryFeaturesContext)\n\treturn context ?? {}\n}\n", "import { createContext, useContext, useMemo } from \"react\"\nimport {\n\ttype CollectionUtils,\n\ttype Locale,\n\ttype MaybePromise,\n\ttype UtilsByCollectionId,\n\ttype UtilsFactory,\n\tdefaultLocaleId,\n} from \"../../router/types.ts\"\nimport { assert } from \"../../utils/assert.ts\"\nimport { getPleaseReportMessage, isPromise } from \"../../utils/utils.ts\"\nimport { LazyValue } from \"../LazyValue.ts\"\nimport { HandoverDataType, getHandoverData, handoverCollector, hasHandoverData } from \"../dataHandover/dataHandover.ts\"\n\nconst handoverDataType = /* @__PURE__ */ (() => HandoverDataType.CollectionUtilsCache)()\n\nfunction getLocaleKey(locale: Locale | undefined) {\n\treturn locale?.id ?? defaultLocaleId\n}\n\nfunction makeHandoverKey(method: string, collectionId: string, localeKey: string, id: string) {\n\treturn `${method}|${collectionId}|${localeKey}|${id}`\n}\n\n/**\n * @internal\n */\nexport interface CollectionModule {\n\t[exportIdentifier: string]: CollectionUtils\n}\n\nlet utilsCache = new WeakMap<UtilsFactory, CollectionUtilsCache>()\n\nfunction getCollectionUtilsCache(collectionUtils: UtilsByCollectionId | undefined) {\n\treturn (collectionId: string) => {\n\t\tif (!collectionUtils) return\n\n\t\tconst utilsFactory = collectionUtils[collectionId]\n\t\tif (!utilsFactory) return undefined\n\n\t\tif (utilsCache.has(utilsFactory)) return utilsCache.get(utilsFactory)\n\n\t\tconst cache = new CollectionUtilsCache(utilsFactory, collectionId)\n\t\tutilsCache.set(utilsFactory, cache)\n\t\treturn cache\n\t}\n}\n\nexport type CollectionUtilsCacheContextValue = { get: ReturnType<typeof getCollectionUtilsCache> } | undefined\nconst CollectionUtilsCacheContext = /* @__PURE__ */ createContext<CollectionUtilsCacheContextValue>(undefined)\n\nexport function CollectionUtilsCacheProvider({\n\tchildren,\n\tcollectionUtils,\n}: {\n\tchildren: React.ReactNode\n\tcollectionUtils: UtilsByCollectionId | undefined\n}) {\n\tconst getCollectionUtilsCacheMemoized = useMemo(() => {\n\t\treturn {\n\t\t\tget: getCollectionUtilsCache(collectionUtils),\n\t\t}\n\t}, [collectionUtils])\n\n\treturn (\n\t\t<CollectionUtilsCacheContext.Provider value={getCollectionUtilsCacheMemoized}>\n\t\t\t{children}\n\t\t</CollectionUtilsCacheContext.Provider>\n\t)\n}\n\nexport function useCollectionUtils(): CollectionUtilsCacheContextValue | undefined {\n\treturn useContext(CollectionUtilsCacheContext)\n}\n\n/**\n * This is a type that is used to ensure that the CollectionUtilsCache implements the\n * CollectionUtils interface. With the difference, only-async functions become a MaybePromise.\n */\ntype ICollectionUtilsCache = {\n\t[K in keyof CollectionUtils]: K extends \"getSlugByRecordId\" | \"getRecordIdBySlug\"\n\t\t? (...args: Parameters<CollectionUtils[K]>) => MaybePromise<Awaited<ReturnType<CollectionUtils[K]>>>\n\t\t: CollectionUtils[K]\n}\n\n/**\n * Manages collection utils caches and makes the CollectionUtils functions server-client-handover aware.\n * When updating the implementation, keep in mind the collection utils generation in `exportToHTML`.\n *\n * Every instance manages its own slug/recordId cache, but they share a global collection utils\n * import cache.\n */\nexport class CollectionUtilsCache implements ICollectionUtilsCache {\n\tprivate readonly module: LazyValue<CollectionUtils | undefined>\n\n\t/**\n\t * Stores returned values from CollectionUtils.\n\t * The values must be cached so that they can be returned synchronously when a React component unsuspends.\n\t */\n\tprivate readonly cacheMap = new Map<string, LazyValue<string | undefined> | undefined>()\n\n\tconstructor(\n\t\tutilFactory: () => Promise<CollectionUtils> | undefined,\n\t\tprivate readonly collectionId: string,\n\t) {\n\t\tthis.module = new LazyValue(async () => {\n\t\t\ttry {\n\t\t\t\tconst utils = await utilFactory()\n\t\t\t\tassert(utils, \"Couldn't find CollectionUtils\")\n\t\t\t\treturn utils\n\t\t\t} catch (error) {\n\t\t\t\t// biome-ignore lint/suspicious/noConsole: Actionable error\n\t\t\t\tconsole.error(getPleaseReportMessage(\"Failed to import collection module.\", error))\n\n\t\t\t\t// If CollectionUtils aren't found the page shouldn't crash.\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t})\n\t}\n\n\tprivate callUtilsMethod<T extends keyof CollectionUtils>(\n\t\tmethod: T,\n\t\tid: string,\n\t\tlocale: Locale | undefined,\n\t): MaybePromise<string | undefined> {\n\t\tconst localeKey = getLocaleKey(locale)\n\t\tconst entryKey = makeHandoverKey(method, this.collectionId, localeKey, id)\n\n\t\tif (this.cacheMap.has(entryKey)) {\n\t\t\tconst cached = this.cacheMap.get(entryKey)\n\t\t\tconst value = cached?.readMaybeAsync()\n\n\t\t\t// On cache hit during SSG, populate handover collector with cached value.\n\t\t\tif (handoverCollector !== undefined) {\n\t\t\t\tif (isPromise(value)) {\n\t\t\t\t\treturn value.then(result => {\n\t\t\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: we check for it above; during SSG, handoverCollector cannot be undefined.\n\t\t\t\t\t\thandoverCollector!.set(handoverDataType, entryKey, result)\n\t\t\t\t\t\treturn result\n\t\t\t\t\t})\n\t\t\t\t}\n\n\t\t\t\thandoverCollector.set(handoverDataType, entryKey, value)\n\t\t\t}\n\n\t\t\treturn value\n\t\t}\n\n\t\tif (hasHandoverData(handoverDataType, entryKey)) {\n\t\t\tconst data = getHandoverData(handoverDataType, entryKey)\n\t\t\tthis.cacheMap.set(entryKey, new LazyValue(() => data))\n\t\t\treturn data\n\t\t}\n\n\t\tconst maybeUtils = this.module.readMaybeAsync()\n\t\tconst utilsIsPromise = isPromise(maybeUtils)\n\n\t\tlet maybeResult: Promise<string | undefined> | undefined\n\t\ttry {\n\t\t\tmaybeResult = utilsIsPromise\n\t\t\t\t? maybeUtils.then(utils => utils?.[method](id, locale))\n\t\t\t\t: maybeUtils?.[method](id, locale)\n\t\t} catch (error) {\n\t\t\t// biome-ignore lint/suspicious/noConsole: Actionable error\n\t\t\tconsole.error(getPleaseReportMessage(\"Failed to call CollectionUtils method.\", error))\n\t\t\tmaybeResult = undefined\n\t\t}\n\n\t\tif (maybeResult === undefined) {\n\t\t\tif (handoverCollector !== undefined) {\n\t\t\t\thandoverCollector.set(handoverDataType, entryKey, maybeResult)\n\t\t\t}\n\t\t\tthis.cacheMap.set(entryKey, maybeResult)\n\t\t\treturn\n\t\t}\n\n\t\tconst lazyValue = new LazyValue<string | undefined>(() =>\n\t\t\tmaybeResult\n\t\t\t\t.then(result => {\n\t\t\t\t\tif (handoverCollector !== undefined) {\n\t\t\t\t\t\thandoverCollector.set(handoverDataType, entryKey, result)\n\t\t\t\t\t}\n\t\t\t\t\treturn result\n\t\t\t\t})\n\t\t\t\t.catch(error => {\n\t\t\t\t\t// biome-ignore lint/suspicious/noConsole: Actionable error\n\t\t\t\t\tconsole.error(getPleaseReportMessage(\"Failed to call CollectionUtils method.\", error))\n\t\t\t\t\treturn undefined\n\t\t\t\t}),\n\t\t)\n\n\t\tthis.cacheMap.set(entryKey, lazyValue)\n\t\treturn lazyValue.readMaybeAsync()\n\t}\n\n\tgetSlugByRecordId(recordId: string, locale: Locale | undefined): MaybePromise<string | undefined> {\n\t\treturn this.callUtilsMethod(\"getSlugByRecordId\", recordId, locale)\n\t}\n\n\tgetRecordIdBySlug(slug: string, locale: Locale | undefined): MaybePromise<string | undefined> {\n\t\treturn this.callUtilsMethod(\"getRecordIdBySlug\", slug, locale)\n\t}\n}\n\nexport const testing = {\n\tclear() {\n\t\tutilsCache = new WeakMap()\n\t},\n}\n", "import type { PageviewEventData } from \"../utils/sendTrackingEvent.ts\"\nimport type { MonitorNextPaintAfterRender } from \"./useMonitorNextPaintAfterRender.ts\"\n\nexport type RouteId = string\nexport type RoutePath = string\nexport type ElementId = string\nexport type Hash = ElementId | string\n\n/**\n * @public\n * A unique id for a locale.\n */\nexport type LocaleId = string\n\nexport const defaultLocaleId: LocaleId = \"default\"\n\n/**\n * @public\n * The direction of the text, either \"ltr\" (left-to-right) or \"rtl\" (right-to-left).\n */\nexport type TextDirection = \"ltr\" | \"rtl\"\n\nexport interface RouteStatus {\n\thasLoaded: boolean\n\thasRendered: boolean\n}\n\n/**\n * @public\n */\n// biome-ignore lint/suspicious/noExplicitAny: intended\nexport type ComponentWithPreload<T extends React.ComponentType<any>> = T & {\n\t// biome-ignore lint/suspicious/noConfusingVoidType: void is correct here\n\tpreload: () => Promise<void | T>\n\tgetStatus: () => RouteStatus\n\tcacheHash?: string\n}\n\n/**\n * @public\n */\n// biome-ignore lint/suspicious/noExplicitAny: intended\nexport type RouteComponent<P = any> =\n\t| React.ReactElement<P>\n\t| React.ComponentType<P>\n\t| ComponentWithPreload<React.ComponentType<P>>\n\n/**\n * @public\n */\nexport type Elements = Record<ElementId, string>\n\n/**\n * @public\n */\nexport interface RouteInfo {\n\tpath?: RoutePath\n\tpathLocalized?: Record<LocaleId, RoutePath>\n\telements?: Elements\n\tcollectionId?: string\n\tincludedLocales?: LocaleId[]\n\tabTestId?: string\n\tabTestingParentId?: string\n\tabTestingVariantId?: string\n}\n\nexport type UtilsFactory = () => Promise<CollectionUtils> | undefined\n\nexport type UtilsByCollectionId = Record<string, UtilsFactory>\n\nexport type MaybePromise<T> = T | Promise<T>\n\nexport interface CollectionUtils {\n\tgetSlugByRecordId: (id: string, locale: Locale | undefined) => Promise<string | undefined>\n\tgetRecordIdBySlug: (slug: string, locale: Locale | undefined) => Promise<string | undefined>\n}\n\n/**\n * @public\n */\nexport interface Route extends RouteInfo {\n\tpage: RouteComponent\n}\n\n/**\n * @public\n */\nexport interface ActiveRoute extends Route {\n\tid: RouteId\n\tpathVariables: Record<string, unknown> | undefined\n}\n\n/**\n * @public\n */\nexport type Routes = Record<RouteId, Route>\n\n/**\n * @public\n */\nexport type RouteHandler = () => void\n\nexport interface RouterAPI {\n\tnavigate(\n\t\trouteId: RouteId,\n\t\telementId?: Hash,\n\t\tpathVariables?: Record<string, unknown>,\n\t\tsmoothScroll?: boolean,\n\t\tbeforeUrlUpdate?: () => void,\n\t): void\n\tgetRoute(routeId: RouteId): Route | undefined\n\tcurrentRouteId: RouteId\n\tcurrentPathVariables?: Record<string, unknown>\n\troutes: Routes\n\t/**\n\t * @deprecated Prefer `useCollectionUtils`.\n\t */\n\tcollectionUtils?: UtilsByCollectionId\n\tpreserveQueryParams?: boolean\n\t/**\n\t * This is a mutable reference to the pageview event data.\n\t * The data may be kept in a promise, because we need to resolve\n\t * collection item data in `useSendPageView`.\n\t */\n\tpageviewEventData: React.MutableRefObject<PageviewEventData | Promise<PageviewEventData> | undefined>\n\tsiteCanonicalURL?: string\n\tisInitialNavigation: boolean\n}\n\n/**\n * @public\n * A unique locale with an id, code (e.g. \"en-US\"), name, slug, and optional fallback.\n */\nexport interface Locale {\n\t/** Unique id. */\n\treadonly id: LocaleId\n\t/** Language and optional region code (e.g. \"en-US\"). */\n\treadonly code: string\n\t/** Display name, for example used by the locale picker component. */\n\treadonly name: string\n\t/** Locale slug is inserted as the first path segment when non empty. */\n\treadonly slug: string\n\t/** Optional fallback locale, used when resolving localized values. */\n\treadonly fallback?: Locale\n\t/** Either \"ltr\" (left-to-right) or \"rtl\" (right-to-left). */\n\treadonly textDirection?: TextDirection\n}\n\n/**\n * @public\n * @deprecated Use `LocaleInfo` instead.\n */\nexport interface LocalizationInfo {\n\treadonly activeLocalization: Locale | null\n\treadonly localizations: readonly Locale[]\n\treadonly setLocalization: (localization: Locale) => void\n}\n\n/**\n * @public\n * The active locale, all of the available locales, and a way to change the active locale.\n */\nexport interface LocaleInfo {\n\t/** The locale currently active. */\n\treadonly activeLocale: Locale | null\n\t/** All of the available locales. */\n\treadonly locales: readonly Locale[]\n\t/** Update the active locale by passing in either a locale or locale id. */\n\treadonly setLocale: (locale: Locale | LocaleId) => Promise<void>\n}\n\nexport interface PaginationInfo {\n\tcurrentPage: number\n\ttotalPages: number\n\tisLoading: boolean\n}\n\nexport type UpdateURL = () => Promise<void>\n\nexport interface NavigationPerformanceDetail {\n\tcached?: boolean\n\tpreloaded?: boolean\n\tpopstate?: boolean\n\tlocalized?: boolean\n}\n\nexport type SetCurrentRouteId = (\n\trouteId: RouteId,\n\tlocaleId: LocaleId | undefined,\n\thash: string | undefined,\n\tpathnameWithHash: string,\n\tpathVariables: Record<string, unknown> | undefined,\n\tisHistoryTransition: boolean,\n\tnextRender: ReturnType<MonitorNextPaintAfterRender<NavigationPerformanceDetail>>,\n\tsmoothScroll?: boolean,\n\tupdateURL?: (ignorePushStateWrapper?: boolean) => ReturnType<UpdateURL>,\n) => void\n", "import { lazyModulesCache } from \"../router/lazyModulesCache.ts\"\nimport { lazyModulesCollector } from \"../router/lazyModulesCollector.ts\"\nimport type { MaybePromise } from \"../router/types.ts\"\nimport { isPromise } from \"../utils/utils.ts\"\n\nconst PromiseState = {\n\tPending: \"pending\",\n\tFulfilled: \"fulfilled\",\n\tRejected: \"rejected\",\n} as const\n\n/**\n * LazyValue is a PromiseLike class that can resolve or reject lazily.\n * Designed with the same API as https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled.\n */\nexport class LazyValue<Value = void> implements PromiseLike<Value> {\n\tstatic is<Value>(value: unknown): value is LazyValue<Value> {\n\t\treturn value instanceof LazyValue\n\t}\n\n\tprivate promiseState: (typeof PromiseState)[keyof typeof PromiseState] = PromiseState.Pending\n\tprivate preloadPromise?: Promise<void>\n\n\tvalue!: Value\n\treason!: unknown\n\n\t/**\n\t * Gets the status and preloads the value if it's not already preloaded.\n\t */\n\tget status() {\n\t\t// React reads `status` when using the React 19+ `use` hook. So it should kick-off the preload.\n\t\t// https://deepwiki.com/search/how-is-the-use-hook-implemente_51724b79-78a2-4359-83b7-94f75ffd3789\n\t\tvoid this.preload()\n\t\treturn this.state\n\t}\n\n\tget state() {\n\t\treturn this.promiseState\n\t}\n\n\t/**\n\t * @param resolver Function that returns the value or promise\n\t * @param cacheHash Optional hash of the module filename, used for cache optimization. During build, this is automatically injected as a compact hash of the filename extracted from the original HTTPS URL (e.g., \"YouTube.js\" \u2192 hash).\n\t */\n\tconstructor(\n\t\tprivate readonly resolver: () => MaybePromise<Value>,\n\t\tprivate readonly cacheHash?: string,\n\t) {}\n\n\t// biome-ignore lint/suspicious/noThenProperty: This is a PromiseLike class.\n\tthen<TResult1 = Value, TResult2 = never>(\n\t\tonfulfilled?: null | ((value: Value) => MaybePromise<TResult1>),\n\t\tonrejected?: null | ((reason: unknown) => MaybePromise<TResult2>),\n\t): Promise<TResult1 | TResult2> {\n\t\t// If already fulfilled/rejected, return resolved/rejected promise\n\t\tif (this.promiseState === PromiseState.Fulfilled) {\n\t\t\treturn Promise.resolve(this.value).then(onfulfilled, onrejected)\n\t\t}\n\n\t\tif (this.promiseState === PromiseState.Rejected) {\n\t\t\treturn Promise.reject(this.reason).then(onfulfilled, onrejected)\n\t\t}\n\n\t\treturn this.readAsync().then(onfulfilled, onrejected)\n\t}\n\n\t/**\n\t * Preload the value so it can be read() later.\n\t *\n\t * @returns The promise that resolves or rejects. `undefined` if the value has already been preloaded or is synchronously readable.\n\t */\n\tpreload(): Promise<void> | undefined {\n\t\t// The value was already preloaded.\n\t\tif (this.promiseState !== PromiseState.Pending) return\n\n\t\t// The value is currently preloading.\n\t\tif (this.preloadPromise) return this.preloadPromise\n\n\t\tif (this.cacheHash !== undefined && lazyModulesCollector !== undefined) {\n\t\t\tlazyModulesCollector.add(this.cacheHash)\n\t\t}\n\n\t\tconst fulfill = (value: Value) => {\n\t\t\tthis.promiseState = PromiseState.Fulfilled\n\t\t\tthis.value = value\n\t\t}\n\n\t\tconst reject = (reason: unknown) => {\n\t\t\tthis.promiseState = PromiseState.Rejected\n\t\t\tthis.reason = reason\n\t\t}\n\n\t\tlet maybeValue: MaybePromise<Value>\n\t\ttry {\n\t\t\tmaybeValue =\n\t\t\t\tthis.cacheHash && lazyModulesCache.has(this.cacheHash)\n\t\t\t\t\t? (lazyModulesCache.get(this.cacheHash) as MaybePromise<Value>)\n\t\t\t\t\t: this.resolver()\n\t\t} catch (e) {\n\t\t\treject(e)\n\t\t\treturn\n\t\t}\n\n\t\t// The value is not a promise and is synchronously available\n\t\tif (!isPromise(maybeValue)) {\n\t\t\tfulfill(maybeValue)\n\t\t\treturn\n\t\t}\n\n\t\tconst valuePromise = maybeValue.then(fulfill, reject)\n\t\tthis.preloadPromise = valuePromise\n\t\treturn valuePromise\n\t}\n\n\t/** Synchronously read the value after calling preload() before. */\n\tread = (): Value => {\n\t\tif (this.promiseState === PromiseState.Fulfilled) {\n\t\t\treturn this.value\n\t\t}\n\n\t\tif (this.promiseState === PromiseState.Rejected) {\n\t\t\tthrow this.reason\n\t\t}\n\n\t\tthrow new Error(\"Need to call preload() before read()\")\n\t}\n\n\t/**\n\t * @deprecated Use readMaybeAsync() instead.\n\t * @important Don't remove it - was used in code-gen before October 2025.\n\t */\n\tasync readAsync(): Promise<Value> {\n\t\treturn this.readMaybeAsync()\n\t}\n\n\t/**\n\t * Loads the value if it's not already loaded.\n\t *\n\t * @returns The value or a promise that resolves to the value.\n\t */\n\treadMaybeAsync(): MaybePromise<Value> {\n\t\tconst preloadPromise = this.preload()\n\t\tif (preloadPromise) return preloadPromise.then(this.read)\n\n\t\treturn this.read()\n\t}\n\n\t/**\n\t * FIXME: With React 19, mark this as deprecated and use the official `use` hook instead (just pass in the LazyValue instance).\n\t */\n\tuse(): Value {\n\t\tconst promise = this.preload()\n\t\tif (promise) throw promise\n\n\t\treturn this.read()\n\t}\n}\n", "export { uneval } from './src/uneval.js';\nexport { parse, unflatten } from './src/parse.js';\nexport { stringify } from './src/stringify.js';\nexport { DevalueError } from './src/utils.js';\n", "/** @type {Record<string, string>} */\nexport const escaped = {\n\t'<': '\\\\u003C',\n\t'\\\\': '\\\\\\\\',\n\t'\\b': '\\\\b',\n\t'\\f': '\\\\f',\n\t'\\n': '\\\\n',\n\t'\\r': '\\\\r',\n\t'\\t': '\\\\t',\n\t'\\u2028': '\\\\u2028',\n\t'\\u2029': '\\\\u2029'\n};\n\nexport class DevalueError extends Error {\n\t/**\n\t * @param {string} message\n\t * @param {string[]} keys\n\t * @param {any} [value] - The value that failed to be serialized\n\t * @param {any} [root] - The root value being serialized\n\t */\n\tconstructor(message, keys, value, root) {\n\t\tsuper(message);\n\t\tthis.name = 'DevalueError';\n\t\tthis.path = keys.join('');\n\t\tthis.value = value;\n\t\tthis.root = root;\n\t}\n}\n\n/** @param {any} thing */\nexport function is_primitive(thing) {\n\treturn Object(thing) !== thing;\n}\n\nconst object_proto_names = /* @__PURE__ */ Object.getOwnPropertyNames(\n\tObject.prototype\n)\n\t.sort()\n\t.join('\\0');\n\n/** @param {any} thing */\nexport function is_plain_object(thing) {\n\tconst proto = Object.getPrototypeOf(thing);\n\n\treturn (\n\t\tproto === Object.prototype ||\n\t\tproto === null ||\n\t\tObject.getPrototypeOf(proto) === null ||\n\t\tObject.getOwnPropertyNames(proto).sort().join('\\0') === object_proto_names\n\t);\n}\n\n/** @param {any} thing */\nexport function get_type(thing) {\n\treturn Object.prototype.toString.call(thing).slice(8, -1);\n}\n\n/** @param {string} char */\nfunction get_escaped_char(char) {\n\tswitch (char) {\n\t\tcase '\"':\n\t\t\treturn '\\\\\"';\n\t\tcase '<':\n\t\t\treturn '\\\\u003C';\n\t\tcase '\\\\':\n\t\t\treturn '\\\\\\\\';\n\t\tcase '\\n':\n\t\t\treturn '\\\\n';\n\t\tcase '\\r':\n\t\t\treturn '\\\\r';\n\t\tcase '\\t':\n\t\t\treturn '\\\\t';\n\t\tcase '\\b':\n\t\t\treturn '\\\\b';\n\t\tcase '\\f':\n\t\t\treturn '\\\\f';\n\t\tcase '\\u2028':\n\t\t\treturn '\\\\u2028';\n\t\tcase '\\u2029':\n\t\t\treturn '\\\\u2029';\n\t\tdefault:\n\t\t\treturn char < ' '\n\t\t\t\t? `\\\\u${char.charCodeAt(0).toString(16).padStart(4, '0')}`\n\t\t\t\t: '';\n\t}\n}\n\n/** @param {string} str */\nexport function stringify_string(str) {\n\tlet result = '';\n\tlet last_pos = 0;\n\tconst len = str.length;\n\n\tfor (let i = 0; i < len; i += 1) {\n\t\tconst char = str[i];\n\t\tconst replacement = get_escaped_char(char);\n\t\tif (replacement) {\n\t\t\tresult += str.slice(last_pos, i) + replacement;\n\t\t\tlast_pos = i + 1;\n\t\t}\n\t}\n\n\treturn `\"${last_pos === 0 ? str : result + str.slice(last_pos)}\"`;\n}\n\n/** @param {Record<string | symbol, any>} object */\nexport function enumerable_symbols(object) {\n\treturn Object.getOwnPropertySymbols(object).filter(\n\t\t(symbol) => Object.getOwnPropertyDescriptor(object, symbol).enumerable\n\t);\n}\n\nconst is_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;\n\n/** @param {string} key */\nexport function stringify_key(key) {\n\treturn is_identifier.test(key) ? '.' + key : '[' + JSON.stringify(key) + ']';\n}\n\n/** @param {string} s */\nfunction is_valid_array_index(s) {\n\tif (s.length === 0) return false;\n\tif (s.length > 1 && s.charCodeAt(0) === 48) return false; // leading zero\n\tfor (let i = 0; i < s.length; i++) {\n\t\tconst c = s.charCodeAt(i);\n\t\tif (c < 48 || c > 57) return false;\n\t}\n\t// by this point we know it's a string of digits, but it has to be within the range of valid array indices\n\tconst n = +s;\n\tif (n >= 2 ** 32 - 1) return false;\n\tif (n < 0) return false;\n\treturn true;\n}\n\n/**\n * Finds the populated indices of an array.\n * @param {unknown[]} array\n */\nexport function valid_array_indices(array) {\n\tconst keys = Object.keys(array);\n\tfor (var i = keys.length - 1; i >= 0; i--) {\n\t\tif (is_valid_array_index(keys[i])) {\n\t\t\tbreak;\n\t\t}\n\t}\n\tkeys.length = i + 1;\n\treturn keys;\n}\n", "import {\n\tDevalueError,\n\tenumerable_symbols,\n\tescaped,\n\tget_type,\n\tis_plain_object,\n\tis_primitive,\n\tstringify_key,\n\tstringify_string,\n\tvalid_array_indices\n} from './utils.js';\n\nconst chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$';\nconst unsafe_chars = /[<\\b\\f\\n\\r\\t\\0\\u2028\\u2029]/g;\nconst reserved =\n\t/^(?:do|if|in|for|int|let|new|try|var|byte|case|char|else|enum|goto|long|this|void|with|await|break|catch|class|const|final|float|short|super|throw|while|yield|delete|double|export|import|native|return|switch|throws|typeof|boolean|default|extends|finally|package|private|abstract|continue|debugger|function|volatile|interface|protected|transient|implements|instanceof|synchronized)$/;\n\n/**\n * Turn a value into the JavaScript that creates an equivalent value\n * @param {any} value\n * @param {(value: any, uneval: (value: any) => string) => string | void} [replacer]\n */\nexport function uneval(value, replacer) {\n\tconst counts = new Map();\n\n\t/** @type {string[]} */\n\tconst keys = [];\n\n\tconst custom = new Map();\n\n\t/** @param {any} thing */\n\tfunction walk(thing) {\n\t\tif (!is_primitive(thing)) {\n\t\t\tif (counts.has(thing)) {\n\t\t\t\tcounts.set(thing, counts.get(thing) + 1);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tcounts.set(thing, 1);\n\n\t\t\tif (replacer) {\n\t\t\t\tconst str = replacer(thing, (value) => uneval(value, replacer));\n\n\t\t\t\tif (typeof str === 'string') {\n\t\t\t\t\tcustom.set(thing, str);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (typeof thing === 'function') {\n\t\t\t\tthrow new DevalueError(`Cannot stringify a function`, keys, thing, value);\n\t\t\t}\n\n\t\t\tconst type = get_type(thing);\n\n\t\t\tswitch (type) {\n\t\t\t\tcase 'Number':\n\t\t\t\tcase 'BigInt':\n\t\t\t\tcase 'String':\n\t\t\t\tcase 'Boolean':\n\t\t\t\tcase 'Date':\n\t\t\t\tcase 'RegExp':\n\t\t\t\tcase 'URL':\n\t\t\t\tcase 'URLSearchParams':\n\t\t\t\t\treturn;\n\n\t\t\t\tcase 'Array':\n\t\t\t\t\t/** @type {any[]} */ (thing).forEach((value, i) => {\n\t\t\t\t\t\tkeys.push(`[${i}]`);\n\t\t\t\t\t\twalk(value);\n\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Set':\n\t\t\t\t\tArray.from(thing).forEach(walk);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Map':\n\t\t\t\t\tfor (const [key, value] of thing) {\n\t\t\t\t\t\tkeys.push(\n\t\t\t\t\t\t\t`.get(${is_primitive(key) ? stringify_primitive(key) : '...'})`\n\t\t\t\t\t\t);\n\t\t\t\t\t\twalk(value);\n\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Int8Array':\n\t\t\t\tcase 'Uint8Array':\n\t\t\t\tcase 'Uint8ClampedArray':\n\t\t\t\tcase 'Int16Array':\n\t\t\t\tcase 'Uint16Array':\n\t\t\t\tcase 'Int32Array':\n\t\t\t\tcase 'Uint32Array':\n\t\t\t\tcase 'Float32Array':\n\t\t\t\tcase 'Float64Array':\n\t\t\t\tcase 'BigInt64Array':\n\t\t\t\tcase 'BigUint64Array':\n\t\t\t\t\twalk(thing.buffer);\n\t\t\t\t\treturn;\n\n\t\t\t\tcase 'ArrayBuffer':\n\t\t\t\t\treturn;\n\n\t\t\t\tcase 'Temporal.Duration':\n\t\t\t\tcase 'Temporal.Instant':\n\t\t\t\tcase 'Temporal.PlainDate':\n\t\t\t\tcase 'Temporal.PlainTime':\n\t\t\t\tcase 'Temporal.PlainDateTime':\n\t\t\t\tcase 'Temporal.PlainMonthDay':\n\t\t\t\tcase 'Temporal.PlainYearMonth':\n\t\t\t\tcase 'Temporal.ZonedDateTime':\n\t\t\t\t\treturn;\n\n\t\t\t\tdefault:\n\t\t\t\t\tif (!is_plain_object(thing)) {\n\t\t\t\t\t\tthrow new DevalueError(\n\t\t\t\t\t\t\t`Cannot stringify arbitrary non-POJOs`,\n\t\t\t\t\t\t\tkeys,\n\t\t\t\t\t\t\tthing,\n\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (enumerable_symbols(thing).length > 0) {\n\t\t\t\t\t\tthrow new DevalueError(\n\t\t\t\t\t\t\t`Cannot stringify POJOs with symbolic keys`,\n\t\t\t\t\t\t\tkeys,\n\t\t\t\t\t\t\tthing,\n\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (const key of Object.keys(thing)) {\n\t\t\t\t\t\tif (key === '__proto__') {\n\t\t\t\t\t\t\tthrow new DevalueError(\n\t\t\t\t\t\t\t\t`Cannot stringify objects with __proto__ keys`,\n\t\t\t\t\t\t\t\tkeys,\n\t\t\t\t\t\t\t\tthing,\n\t\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tkeys.push(stringify_key(key));\n\t\t\t\t\t\twalk(thing[key]);\n\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\twalk(value);\n\n\tconst names = new Map();\n\n\tArray.from(counts)\n\t\t.filter((entry) => entry[1] > 1)\n\t\t.sort((a, b) => b[1] - a[1])\n\t\t.forEach((entry, i) => {\n\t\t\tnames.set(entry[0], get_name(i));\n\t\t});\n\n\t/**\n\t * @param {any} thing\n\t * @returns {string}\n\t */\n\tfunction stringify(thing) {\n\t\tif (names.has(thing)) {\n\t\t\treturn names.get(thing);\n\t\t}\n\n\t\tif (is_primitive(thing)) {\n\t\t\treturn stringify_primitive(thing);\n\t\t}\n\n\t\tif (custom.has(thing)) {\n\t\t\treturn custom.get(thing);\n\t\t}\n\n\t\tconst type = get_type(thing);\n\n\t\tswitch (type) {\n\t\t\tcase 'Number':\n\t\t\tcase 'String':\n\t\t\tcase 'Boolean':\n\t\t\t\treturn `Object(${stringify(thing.valueOf())})`;\n\n\t\t\tcase 'RegExp':\n\t\t\t\treturn `new RegExp(${stringify_string(thing.source)}, \"${\n\t\t\t\t\tthing.flags\n\t\t\t\t}\")`;\n\n\t\t\tcase 'Date':\n\t\t\t\treturn `new Date(${thing.getTime()})`;\n\n\t\t\tcase 'URL':\n\t\t\t\treturn `new URL(${stringify_string(thing.toString())})`;\n\n\t\t\tcase 'URLSearchParams':\n\t\t\t\treturn `new URLSearchParams(${stringify_string(thing.toString())})`;\n\n\t\t\tcase 'Array': {\n\t\t\t\t// For dense arrays (no holes), we iterate normally.\n\t\t\t\t// When we encounter the first hole, we call Object.keys\n\t\t\t\t// to determine the sparseness, then decide between:\n\t\t\t\t//   - Array literal with holes: [,\"a\",,] (default)\n\t\t\t\t//   - Object.assign: Object.assign(Array(n),{...}) (for very sparse arrays)\n\t\t\t\t// Only the Object.assign path avoids iterating every slot, which\n\t\t\t\t// is what protects against the DoS of e.g. `arr[1000000] = 1`.\n\t\t\t\tlet has_holes = false;\n\n\t\t\t\tlet result = '[';\n\n\t\t\t\tfor (let i = 0; i < thing.length; i += 1) {\n\t\t\t\t\tif (i > 0) result += ',';\n\n\t\t\t\t\tif (Object.hasOwn(thing, i)) {\n\t\t\t\t\t\tresult += stringify(thing[i]);\n\t\t\t\t\t} else if (!has_holes) {\n\t\t\t\t\t\t// Decide between array literal and Object.assign.\n\t\t\t\t\t\t//\n\t\t\t\t\t\t// Array literal: holes are consecutive commas.\n\t\t\t\t\t\t// For example, [, \"a\", ,] is written as [,\"a\",,].\n\t\t\t\t\t\t// Each hole costs 1 char (a comma).\n\t\t\t\t\t\t//\n\t\t\t\t\t\t// Object.assign: populated indices are listed explicitly.\n\t\t\t\t\t\t// For example, [, \"a\", ,] would be written as\n\t\t\t\t\t\t// Object.assign(Array(3),{1:\"a\"}). This avoids paying\n\t\t\t\t\t\t// per-hole, but has a large fixed overhead for the\n\t\t\t\t\t\t// \"Object.assign(Array(n),{...})\" wrapper, and each\n\t\t\t\t\t\t// element costs extra chars for its index and colon.\n\t\t\t\t\t\t//\n\t\t\t\t\t\t// The serialized values are the same size either way, so\n\t\t\t\t\t\t// the choice comes down to the structural overhead:\n\t\t\t\t\t\t//\n\t\t\t\t\t\t//   Array literal overhead:\n\t\t\t\t\t\t//     1 char per element or hole (comma separators)\n\t\t\t\t\t\t//     + 2 chars for \"[\" and \"]\"\n\t\t\t\t\t\t//     = L + 2\n\t\t\t\t\t\t//\n\t\t\t\t\t\t//   Object.assign overhead:\n\t\t\t\t\t\t//     \"Object.assign(Array(\" \u2014 20 chars\n\t\t\t\t\t\t//     + length              \u2014 d chars\n\t\t\t\t\t\t//     + \"),{\"               \u2014 3 chars\n\t\t\t\t\t\t//     + for each populated element:\n\t\t\t\t\t\t//       index + \":\" + \",\"   \u2014 (d + 2) chars\n\t\t\t\t\t\t//     + \"})\"                \u2014 2 chars\n\t\t\t\t\t\t//     = (25 + d) + P * (d + 2)\n\t\t\t\t\t\t//\n\t\t\t\t\t\t// where L is the array length, P is the number of\n\t\t\t\t\t\t// populated elements, and d is the number of digits\n\t\t\t\t\t\t// in L (an upper bound on the digits in any index).\n\t\t\t\t\t\t//\n\t\t\t\t\t\t// Object.assign is cheaper when:\n\t\t\t\t\t\t//   (25 + d) + P * (d + 2) < L + 2\n\t\t\t\t\t\tconst populated_keys = valid_array_indices(/** @type {any[]} */ (thing));\n\t\t\t\t\t\tconst population = populated_keys.length;\n\t\t\t\t\t\tconst d = String(thing.length).length;\n\n\t\t\t\t\t\tconst hole_cost = thing.length + 2;\n\t\t\t\t\t\tconst sparse_cost = (25 + d) + population * (d + 2);\n\n\t\t\t\t\t\tif (hole_cost > sparse_cost) {\n\t\t\t\t\t\t\tconst entries = populated_keys\n\t\t\t\t\t\t\t\t.map((k) => `${k}:${stringify(thing[k])}`)\n\t\t\t\t\t\t\t\t.join(',');\n\t\t\t\t\t\t\treturn `Object.assign(Array(${thing.length}),{${entries}})`;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Re-process this index as a hole in the array literal\n\t\t\t\t\t\thas_holes = true;\n\t\t\t\t\t\ti -= 1;\n\t\t\t\t\t}\n\t\t\t\t\t// else: already decided on array literal, hole is just an empty slot\n\t\t\t\t\t// (the comma separator is all we need \u2014 no content for this position)\n\t\t\t\t}\n\n\t\t\t\tconst tail = thing.length === 0 || thing.length - 1 in thing ? '' : ',';\n\t\t\t\treturn result + tail + ']';\n\t\t\t}\n\n\t\t\tcase 'Set':\n\t\t\tcase 'Map':\n\t\t\t\treturn `new ${type}([${Array.from(thing).map(stringify).join(',')}])`;\n\n\t\t\tcase 'Int8Array':\n\t\t\tcase 'Uint8Array':\n\t\t\tcase 'Uint8ClampedArray':\n\t\t\tcase 'Int16Array':\n\t\t\tcase 'Uint16Array':\n\t\t\tcase 'Int32Array':\n\t\t\tcase 'Uint32Array':\n\t\t\tcase 'Float32Array':\n\t\t\tcase 'Float64Array':\n\t\t\tcase 'BigInt64Array':\n\t\t\tcase 'BigUint64Array': {\n\t\t\t\tlet str = `new ${type}`;\n\n\t\t\t\tif (counts.get(thing.buffer) === 1) {\n\t\t\t\t\tconst array = new thing.constructor(thing.buffer);\n\t\t\t\t\tstr += `([${array}])`;\n\t\t\t\t} else {\n\t\t\t\t\tstr += `([${stringify(thing.buffer)}])`;\n\t\t\t\t}\n\n\t\t\t\tconst a = thing.byteOffset;\n\t\t\t\tconst b = a + thing.byteLength;\n\n\t\t\t\t// handle subarrays\n\t\t\t\tif (a > 0 || b !== thing.buffer.byteLength) {\n\t\t\t\t\tconst m = +/(\\d+)/.exec(type)[1] / 8;\n\t\t\t\t\tstr += `.subarray(${a / m},${b / m})`;\n\t\t\t\t}\n\n\t\t\t\treturn str;\n\t\t\t}\n\n\t\t\tcase 'ArrayBuffer': {\n\t\t\t\tconst ui8 = new Uint8Array(thing);\n\t\t\t\treturn `new Uint8Array([${ui8.toString()}]).buffer`;\n\t\t\t}\n\n\t\t\tcase 'Temporal.Duration':\n\t\t\tcase 'Temporal.Instant':\n\t\t\tcase 'Temporal.PlainDate':\n\t\t\tcase 'Temporal.PlainTime':\n\t\t\tcase 'Temporal.PlainDateTime':\n\t\t\tcase 'Temporal.PlainMonthDay':\n\t\t\tcase 'Temporal.PlainYearMonth':\n\t\t\tcase 'Temporal.ZonedDateTime':\n\t\t\t\treturn `${type}.from(${stringify_string(thing.toString())})`;\n\n\t\t\tdefault:\n\t\t\t\tconst keys = Object.keys(thing);\n\t\t\t\tconst obj = keys\n\t\t\t\t\t.map((key) => `${safe_key(key)}:${stringify(thing[key])}`)\n\t\t\t\t\t.join(',');\n\t\t\t\tconst proto = Object.getPrototypeOf(thing);\n\t\t\t\tif (proto === null) {\n\t\t\t\t\treturn keys.length > 0\n\t\t\t\t\t\t? `{${obj},__proto__:null}`\n\t\t\t\t\t\t: `{__proto__:null}`;\n\t\t\t\t}\n\n\t\t\t\treturn `{${obj}}`;\n\t\t}\n\t}\n\n\tconst str = stringify(value);\n\n\tif (names.size) {\n\t\t/** @type {string[]} */\n\t\tconst params = [];\n\n\t\t/** @type {string[]} */\n\t\tconst statements = [];\n\n\t\t/** @type {string[]} */\n\t\tconst values = [];\n\n\t\tnames.forEach((name, thing) => {\n\t\t\tparams.push(name);\n\n\t\t\tif (custom.has(thing)) {\n\t\t\t\tvalues.push(/** @type {string} */ (custom.get(thing)));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (is_primitive(thing)) {\n\t\t\t\tvalues.push(stringify_primitive(thing));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst type = get_type(thing);\n\n\t\t\tswitch (type) {\n\t\t\t\tcase 'Number':\n\t\t\t\tcase 'String':\n\t\t\t\tcase 'Boolean':\n\t\t\t\t\tvalues.push(`Object(${stringify(thing.valueOf())})`);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'RegExp':\n\t\t\t\t\tvalues.push(thing.toString());\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Date':\n\t\t\t\t\tvalues.push(`new Date(${thing.getTime()})`);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Array':\n\t\t\t\t\tvalues.push(`Array(${thing.length})`);\n\t\t\t\t\t/** @type {any[]} */ (thing).forEach((v, i) => {\n\t\t\t\t\t\tstatements.push(`${name}[${i}]=${stringify(v)}`);\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Set':\n\t\t\t\t\tvalues.push(`new Set`);\n\t\t\t\t\tstatements.push(\n\t\t\t\t\t\t`${name}.${Array.from(thing)\n\t\t\t\t\t\t\t.map((v) => `add(${stringify(v)})`)\n\t\t\t\t\t\t\t.join('.')}`\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Map':\n\t\t\t\t\tvalues.push(`new Map`);\n\t\t\t\t\tstatements.push(\n\t\t\t\t\t\t`${name}.${Array.from(thing)\n\t\t\t\t\t\t\t.map(([k, v]) => `set(${stringify(k)}, ${stringify(v)})`)\n\t\t\t\t\t\t\t.join('.')}`\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'ArrayBuffer':\n\t\t\t\t\tvalues.push(\n\t\t\t\t\t\t`new Uint8Array([${new Uint8Array(thing).join(',')}]).buffer`\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tvalues.push(\n\t\t\t\t\t\tObject.getPrototypeOf(thing) === null ? 'Object.create(null)' : '{}'\n\t\t\t\t\t);\n\t\t\t\t\tObject.keys(thing).forEach((key) => {\n\t\t\t\t\t\tstatements.push(\n\t\t\t\t\t\t\t`${name}${safe_prop(key)}=${stringify(thing[key])}`\n\t\t\t\t\t\t);\n\t\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\tstatements.push(`return ${str}`);\n\n\t\treturn `(function(${params.join(',')}){${statements.join(\n\t\t\t';'\n\t\t)}}(${values.join(',')}))`;\n\t} else {\n\t\treturn str;\n\t}\n}\n\n/** @param {number} num */\nfunction get_name(num) {\n\tlet name = '';\n\n\tdo {\n\t\tname = chars[num % chars.length] + name;\n\t\tnum = ~~(num / chars.length) - 1;\n\t} while (num >= 0);\n\n\treturn reserved.test(name) ? `${name}0` : name;\n}\n\n/** @param {string} c */\nfunction escape_unsafe_char(c) {\n\treturn escaped[c] || c;\n}\n\n/** @param {string} str */\nfunction escape_unsafe_chars(str) {\n\treturn str.replace(unsafe_chars, escape_unsafe_char);\n}\n\n/** @param {string} key */\nfunction safe_key(key) {\n\treturn /^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(key)\n\t\t? key\n\t\t: escape_unsafe_chars(JSON.stringify(key));\n}\n\n/** @param {string} key */\nfunction safe_prop(key) {\n\treturn /^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(key)\n\t\t? `.${key}`\n\t\t: `[${escape_unsafe_chars(JSON.stringify(key))}]`;\n}\n\n/** @param {any} thing */\nfunction stringify_primitive(thing) {\n\tif (typeof thing === 'string') return stringify_string(thing);\n\tif (thing === void 0) return 'void 0';\n\tif (thing === 0 && 1 / thing < 0) return '-0';\n\tconst str = String(thing);\n\tif (typeof thing === 'number') return str.replace(/^(-)?0\\./, '$1.');\n\tif (typeof thing === 'bigint') return thing + 'n';\n\treturn str;\n}\n", "/**\n * Base64 Encodes an arraybuffer\n * @param {ArrayBuffer} arraybuffer\n * @returns {string}\n */\nexport function encode64(arraybuffer) {\n  const dv = new DataView(arraybuffer);\n  let binaryString = \"\";\n\n  for (let i = 0; i < arraybuffer.byteLength; i++) {\n    binaryString += String.fromCharCode(dv.getUint8(i));\n  }\n\n  return binaryToAscii(binaryString);\n}\n\n/**\n * Decodes a base64 string into an arraybuffer\n * @param {string} string\n * @returns {ArrayBuffer}\n */\nexport function decode64(string) {\n  const binaryString = asciiToBinary(string);\n  const arraybuffer = new ArrayBuffer(binaryString.length);\n  const dv = new DataView(arraybuffer);\n\n  for (let i = 0; i < arraybuffer.byteLength; i++) {\n    dv.setUint8(i, binaryString.charCodeAt(i));\n  }\n\n  return arraybuffer;\n}\n\nconst KEY_STRING =\n  \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n\n/**\n * Substitute for atob since it's deprecated in node.\n * Does not do any input validation.\n *\n * @see https://github.com/jsdom/abab/blob/master/lib/atob.js\n *\n * @param {string} data\n * @returns {string}\n */\nfunction asciiToBinary(data) {\n  if (data.length % 4 === 0) {\n    data = data.replace(/==?$/, \"\");\n  }\n\n  let output = \"\";\n  let buffer = 0;\n  let accumulatedBits = 0;\n\n  for (let i = 0; i < data.length; i++) {\n    buffer <<= 6;\n    buffer |= KEY_STRING.indexOf(data[i]);\n    accumulatedBits += 6;\n    if (accumulatedBits === 24) {\n      output += String.fromCharCode((buffer & 0xff0000) >> 16);\n      output += String.fromCharCode((buffer & 0xff00) >> 8);\n      output += String.fromCharCode(buffer & 0xff);\n      buffer = accumulatedBits = 0;\n    }\n  }\n  if (accumulatedBits === 12) {\n    buffer >>= 4;\n    output += String.fromCharCode(buffer);\n  } else if (accumulatedBits === 18) {\n    buffer >>= 2;\n    output += String.fromCharCode((buffer & 0xff00) >> 8);\n    output += String.fromCharCode(buffer & 0xff);\n  }\n  return output;\n}\n\n/**\n * Substitute for btoa since it's deprecated in node.\n * Does not do any input validation.\n *\n * @see https://github.com/jsdom/abab/blob/master/lib/btoa.js\n *\n * @param {string} str\n * @returns {string}\n */\nfunction binaryToAscii(str) {\n  let out = \"\";\n  for (let i = 0; i < str.length; i += 3) {\n    /** @type {[number, number, number, number]} */\n    const groupsOfSix = [undefined, undefined, undefined, undefined];\n    groupsOfSix[0] = str.charCodeAt(i) >> 2;\n    groupsOfSix[1] = (str.charCodeAt(i) & 0x03) << 4;\n    if (str.length > i + 1) {\n      groupsOfSix[1] |= str.charCodeAt(i + 1) >> 4;\n      groupsOfSix[2] = (str.charCodeAt(i + 1) & 0x0f) << 2;\n    }\n    if (str.length > i + 2) {\n      groupsOfSix[2] |= str.charCodeAt(i + 2) >> 6;\n      groupsOfSix[3] = str.charCodeAt(i + 2) & 0x3f;\n    }\n    for (let j = 0; j < groupsOfSix.length; j++) {\n      if (typeof groupsOfSix[j] === \"undefined\") {\n        out += \"=\";\n      } else {\n        out += KEY_STRING[groupsOfSix[j]];\n      }\n    }\n  }\n  return out;\n}\n", "export const UNDEFINED = -1;\nexport const HOLE = -2;\nexport const NAN = -3;\nexport const POSITIVE_INFINITY = -4;\nexport const NEGATIVE_INFINITY = -5;\nexport const NEGATIVE_ZERO = -6;\nexport const SPARSE = -7;\n", "import { decode64 } from './base64.js';\nimport {\n\tHOLE,\n\tNAN,\n\tNEGATIVE_INFINITY,\n\tNEGATIVE_ZERO,\n\tPOSITIVE_INFINITY,\n\tSPARSE,\n\tUNDEFINED\n} from './constants.js';\n\n/**\n * Revive a value serialized with `devalue.stringify`\n * @param {string} serialized\n * @param {Record<string, (value: any) => any>} [revivers]\n */\nexport function parse(serialized, revivers) {\n\treturn unflatten(JSON.parse(serialized), revivers);\n}\n\n/**\n * Revive a value flattened with `devalue.stringify`\n * @param {number | any[]} parsed\n * @param {Record<string, (value: any) => any>} [revivers]\n */\nexport function unflatten(parsed, revivers) {\n\tif (typeof parsed === 'number') return hydrate(parsed, true);\n\n\tif (!Array.isArray(parsed) || parsed.length === 0) {\n\t\tthrow new Error('Invalid input');\n\t}\n\n\tconst values = /** @type {any[]} */ (parsed);\n\n\tconst hydrated = Array(values.length);\n\n\t/**\n\t * A set of values currently being hydrated with custom revivers,\n\t * used to detect invalid cyclical dependencies\n\t * @type {Set<number> | null}\n\t */\n\tlet hydrating = null;\n\n\t/**\n\t * @param {number} index\n\t * @returns {any}\n\t */\n\tfunction hydrate(index, standalone = false) {\n\t\tif (index === UNDEFINED) return undefined;\n\t\tif (index === NAN) return NaN;\n\t\tif (index === POSITIVE_INFINITY) return Infinity;\n\t\tif (index === NEGATIVE_INFINITY) return -Infinity;\n\t\tif (index === NEGATIVE_ZERO) return -0;\n\n\t\tif (standalone || typeof index !== 'number') {\n\t\t\tthrow new Error(`Invalid input`);\n\t\t}\n\n\t\tif (index in hydrated) return hydrated[index];\n\n\t\tconst value = values[index];\n\n\t\tif (!value || typeof value !== 'object') {\n\t\t\thydrated[index] = value;\n\t\t} else if (Array.isArray(value)) {\n\t\t\tif (typeof value[0] === 'string') {\n\t\t\t\tconst type = value[0];\n\n\t\t\t\tconst reviver =\n\t\t\t\t\trevivers && Object.hasOwn(revivers, type)\n\t\t\t\t\t\t? revivers[type]\n\t\t\t\t\t\t: undefined;\n\n\t\t\t\tif (reviver) {\n\t\t\t\t\tlet i = value[1];\n\t\t\t\t\tif (typeof i !== 'number') {\n\t\t\t\t\t\t// if it's not a number, it was serialized by a builtin reviver\n\t\t\t\t\t\t// so we need to munge it into the format expected by a custom reviver\n\t\t\t\t\t\ti = values.push(value[1]) - 1;\n\t\t\t\t\t}\n\n\t\t\t\t\thydrating ??= new Set();\n\n\t\t\t\t\tif (hydrating.has(i)) {\n\t\t\t\t\t\tthrow new Error('Invalid circular reference');\n\t\t\t\t\t}\n\n\t\t\t\t\thydrating.add(i);\n\t\t\t\t\thydrated[index] = reviver(hydrate(i));\n\t\t\t\t\thydrating.delete(i);\n\n\t\t\t\t\treturn hydrated[index];\n\t\t\t\t}\n\n\t\t\t\tswitch (type) {\n\t\t\t\t\tcase 'Date':\n\t\t\t\t\t\thydrated[index] = new Date(value[1]);\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'Set':\n\t\t\t\t\t\tconst set = new Set();\n\t\t\t\t\t\thydrated[index] = set;\n\t\t\t\t\t\tfor (let i = 1; i < value.length; i += 1) {\n\t\t\t\t\t\t\tset.add(hydrate(value[i]));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'Map':\n\t\t\t\t\t\tconst map = new Map();\n\t\t\t\t\t\thydrated[index] = map;\n\t\t\t\t\t\tfor (let i = 1; i < value.length; i += 2) {\n\t\t\t\t\t\t\tmap.set(hydrate(value[i]), hydrate(value[i + 1]));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'RegExp':\n\t\t\t\t\t\thydrated[index] = new RegExp(value[1], value[2]);\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'Object':\n\t\t\t\t\t\tconst object = Object(value[1]);\n\n\t\t\t\t\t\tif (Object.hasOwn(object, '__proto__')) {\n\t\t\t\t\t\t\tthrow new Error('Cannot parse an object with a `__proto__` property');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\thydrated[index] = object;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'BigInt':\n\t\t\t\t\t\thydrated[index] = BigInt(value[1]);\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'null':\n\t\t\t\t\t\tconst obj = Object.create(null);\n\t\t\t\t\t\thydrated[index] = obj;\n\t\t\t\t\t\tfor (let i = 1; i < value.length; i += 2) {\n\t\t\t\t\t\t\tif (value[i] === '__proto__') {\n\t\t\t\t\t\t\t\tthrow new Error('Cannot parse an object with a `__proto__` property');\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tobj[value[i]] = hydrate(value[i + 1]);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'Int8Array':\n\t\t\t\t\tcase 'Uint8Array':\n\t\t\t\t\tcase 'Uint8ClampedArray':\n\t\t\t\t\tcase 'Int16Array':\n\t\t\t\t\tcase 'Uint16Array':\n\t\t\t\t\tcase 'Int32Array':\n\t\t\t\t\tcase 'Uint32Array':\n\t\t\t\t\tcase 'Float32Array':\n\t\t\t\t\tcase 'Float64Array':\n\t\t\t\t\tcase 'BigInt64Array':\n\t\t\t\t\tcase 'BigUint64Array': {\n\t\t\t\t\t\tif (values[value[1]][0] !== 'ArrayBuffer') {\n\t\t\t\t\t\t\t// without this, if we receive malformed input we could\n\t\t\t\t\t\t\t// end up trying to hydrate in a circle or allocate\n\t\t\t\t\t\t\t// huge amounts of memory when we call `new TypedArrayConstructor(buffer)`\n\t\t\t\t\t\t\tthrow new Error('Invalid data');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst TypedArrayConstructor = globalThis[type];\n\t\t\t\t\t\tconst buffer = hydrate(value[1]);\n\t\t\t\t\t\tconst typedArray = new TypedArrayConstructor(buffer);\n\n\t\t\t\t\t\thydrated[index] =\n\t\t\t\t\t\t\tvalue[2] !== undefined\n\t\t\t\t\t\t\t\t? typedArray.subarray(value[2], value[3])\n\t\t\t\t\t\t\t\t: typedArray;\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tcase 'ArrayBuffer': {\n\t\t\t\t\t\tconst base64 = value[1];\n\t\t\t\t\t\tif (typeof base64 !== 'string') {\n\t\t\t\t\t\t\tthrow new Error('Invalid ArrayBuffer encoding');\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst arraybuffer = decode64(base64);\n\t\t\t\t\t\thydrated[index] = arraybuffer;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tcase 'Temporal.Duration':\n\t\t\t\t\tcase 'Temporal.Instant':\n\t\t\t\t\tcase 'Temporal.PlainDate':\n\t\t\t\t\tcase 'Temporal.PlainTime':\n\t\t\t\t\tcase 'Temporal.PlainDateTime':\n\t\t\t\t\tcase 'Temporal.PlainMonthDay':\n\t\t\t\t\tcase 'Temporal.PlainYearMonth':\n\t\t\t\t\tcase 'Temporal.ZonedDateTime': {\n\t\t\t\t\t\tconst temporalName = type.slice(9);\n\t\t\t\t\t\t// @ts-expect-error TS doesn't know about Temporal yet\n\t\t\t\t\t\thydrated[index] = Temporal[temporalName].from(value[1]);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tcase 'URL': {\n\t\t\t\t\t\tconst url = new URL(value[1]);\n\t\t\t\t\t\thydrated[index] = url;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tcase 'URLSearchParams': {\n\t\t\t\t\t\tconst url = new URLSearchParams(value[1]);\n\t\t\t\t\t\thydrated[index] = url;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthrow new Error(`Unknown type ${type}`);\n\t\t\t\t}\n\t\t\t} else if (value[0] === SPARSE) {\n\t\t\t\t// Sparse array encoding: [SPARSE, length, idx, val, idx, val, ...]\n\t\t\t\tconst len = value[1];\n\n\t\t\t\tif (!Number.isInteger(len) || len < 0) {\n\t\t\t\t\tthrow new Error('Invalid input');\n\t\t\t\t}\n\n\t\t\t\tconst array = new Array(len);\n\t\t\t\thydrated[index] = array;\n\n\t\t\t\tfor (let i = 2; i < value.length; i += 2) {\n\t\t\t\t\tconst idx = value[i];\n\n\t\t\t\t\tif (!Number.isInteger(idx) || idx < 0 || idx >= len) {\n\t\t\t\t\t\tthrow new Error('Invalid input');\n\t\t\t\t\t}\n\n\t\t\t\t\tarray[idx] = hydrate(value[i + 1]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst array = new Array(value.length);\n\t\t\t\thydrated[index] = array;\n\n\t\t\t\tfor (let i = 0; i < value.length; i += 1) {\n\t\t\t\t\tconst n = value[i];\n\t\t\t\t\tif (n === HOLE) continue;\n\n\t\t\t\t\tarray[i] = hydrate(n);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t/** @type {Record<string, any>} */\n\t\t\tconst object = {};\n\t\t\thydrated[index] = object;\n\n\t\t\tfor (const key of Object.keys(value)) {\n\t\t\t\tif (key === '__proto__') {\n\t\t\t\t\tthrow new Error('Cannot parse an object with a `__proto__` property');\n\t\t\t\t}\n\n\t\t\t\tconst n = value[key];\n\t\t\t\tobject[key] = hydrate(n);\n\t\t\t}\n\t\t}\n\n\t\treturn hydrated[index];\n\t}\n\n\treturn hydrate(0);\n}\n", "import {\n\tDevalueError,\n\tenumerable_symbols,\n\tget_type,\n\tis_plain_object,\n\tis_primitive,\n\tstringify_key,\n\tstringify_string,\n\tvalid_array_indices\n} from './utils.js';\nimport {\n\tHOLE,\n\tNAN,\n\tNEGATIVE_INFINITY,\n\tNEGATIVE_ZERO,\n\tPOSITIVE_INFINITY,\n\tSPARSE,\n\tUNDEFINED\n} from './constants.js';\nimport { encode64 } from './base64.js';\n\n/**\n * Turn a value into a JSON string that can be parsed with `devalue.parse`\n * @param {any} value\n * @param {Record<string, (value: any) => any>} [reducers]\n */\nexport function stringify(value, reducers) {\n\t/** @type {any[]} */\n\tconst stringified = [];\n\n\t/** @type {Map<any, number>} */\n\tconst indexes = new Map();\n\n\t/** @type {Array<{ key: string, fn: (value: any) => any }>} */\n\tconst custom = [];\n\tif (reducers) {\n\t\tfor (const key of Object.getOwnPropertyNames(reducers)) {\n\t\t\tcustom.push({ key, fn: reducers[key] });\n\t\t}\n\t}\n\n\t/** @type {string[]} */\n\tconst keys = [];\n\n\tlet p = 0;\n\n\t/** @param {any} thing */\n\tfunction flatten(thing) {\n\t\tif (thing === undefined) return UNDEFINED;\n\t\tif (Number.isNaN(thing)) return NAN;\n\t\tif (thing === Infinity) return POSITIVE_INFINITY;\n\t\tif (thing === -Infinity) return NEGATIVE_INFINITY;\n\t\tif (thing === 0 && 1 / thing < 0) return NEGATIVE_ZERO;\n\n\t\tif (indexes.has(thing)) return indexes.get(thing);\n\n\t\tconst index = p++;\n\t\tindexes.set(thing, index);\n\n\t\tfor (const { key, fn } of custom) {\n\t\t\tconst value = fn(thing);\n\t\t\tif (value) {\n\t\t\t\tstringified[index] = `[\"${key}\",${flatten(value)}]`;\n\t\t\t\treturn index;\n\t\t\t}\n\t\t}\n\n\t\tif (typeof thing === 'function') {\n\t\t\tthrow new DevalueError(`Cannot stringify a function`, keys, thing, value);\n\t\t}\n\n\t\tlet str = '';\n\n\t\tif (is_primitive(thing)) {\n\t\t\tstr = stringify_primitive(thing);\n\t\t} else {\n\t\t\tconst type = get_type(thing);\n\n\t\t\tswitch (type) {\n\t\t\t\tcase 'Number':\n\t\t\t\tcase 'String':\n\t\t\t\tcase 'Boolean':\n\t\t\t\t\tstr = `[\"Object\",${stringify_primitive(thing)}]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'BigInt':\n\t\t\t\t\tstr = `[\"BigInt\",${thing}]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Date':\n\t\t\t\t\tconst valid = !isNaN(thing.getDate());\n\t\t\t\t\tstr = `[\"Date\",\"${valid ? thing.toISOString() : ''}\"]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'URL':\n\t\t\t\t\tstr = `[\"URL\",${stringify_string(thing.toString())}]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'URLSearchParams':\n\t\t\t\t\tstr = `[\"URLSearchParams\",${stringify_string(thing.toString())}]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'RegExp':\n\t\t\t\t\tconst { source, flags } = thing;\n\t\t\t\t\tstr = flags\n\t\t\t\t\t\t? `[\"RegExp\",${stringify_string(source)},\"${flags}\"]`\n\t\t\t\t\t\t: `[\"RegExp\",${stringify_string(source)}]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Array': {\n\t\t\t\t\t// For dense arrays (no holes), we iterate normally.\n\t\t\t\t\t// When we encounter the first hole, we call Object.keys\n\t\t\t\t\t// to determine the sparseness, then decide between:\n\t\t\t\t\t//   - HOLE encoding: [-2, val, -2, ...] (default)\n\t\t\t\t\t//   - Sparse encoding: [-7, length, idx, val, ...] (for very sparse arrays)\n\t\t\t\t\t// Only the sparse path avoids iterating every slot, which\n\t\t\t\t\t// is what protects against the DoS of e.g. `arr[1000000] = 1`.\n\t\t\t\t\tlet mostly_dense = false;\n\n\t\t\t\t\tstr = '[';\n\n\t\t\t\t\tfor (let i = 0; i < thing.length; i += 1) {\n\t\t\t\t\t\tif (i > 0) str += ',';\n\n\t\t\t\t\t\tif (Object.hasOwn(thing, i)) {\n\t\t\t\t\t\t\tkeys.push(`[${i}]`);\n\t\t\t\t\t\t\tstr += flatten(thing[i]);\n\t\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t\t} else if (mostly_dense) {\n\t\t\t\t\t\t\t// Use dense encoding. The heuristic guarantees the\n\t\t\t\t\t\t\t// array is only mildly sparse, so iterating over every\n\t\t\t\t\t\t\t// slot is fine.\n\t\t\t\t\t\t\tstr += HOLE;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Decide between HOLE encoding and sparse encoding.\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t// HOLE encoding: each hole is serialized as the HOLE\n\t\t\t\t\t\t\t// sentinel (-2). For example, [, \"a\", ,] becomes\n\t\t\t\t\t\t\t// [-2, 0, -2]. Each hole costs 3 chars (\"-2\" + comma).\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t// Sparse encoding: lists only populated indices.\n\t\t\t\t\t\t\t// For example, [, \"a\", ,] becomes [-7, 3, 1, 0] \u2014 the\n\t\t\t\t\t\t\t// -7 sentinel, the array length (3), then index-value\n\t\t\t\t\t\t\t// pairs. This avoids paying per-hole, but each element\n\t\t\t\t\t\t\t// costs extra chars to write its index.\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t// The values are the same size either way, so the\n\t\t\t\t\t\t\t// choice comes down to structural overhead:\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t//   HOLE overhead:\n\t\t\t\t\t\t\t//     3 chars per hole (\"-2\" + comma)\n\t\t\t\t\t\t\t//     = (L - P) * 3\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t//   Sparse overhead:\n\t\t\t\t\t\t\t//     \"-7,\"          \u2014 3 chars (sparse sentinel + comma)\n\t\t\t\t\t\t\t//     + length + \",\" \u2014 (d + 1) chars (array length + comma)\n\t\t\t\t\t\t\t//     + per element: index + \",\" \u2014 (d + 1) chars\n\t\t\t\t\t\t\t//     = (4 + d) + P * (d + 1)\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t// where L is the array length, P is the number of\n\t\t\t\t\t\t\t// populated elements, and d is the number of digits\n\t\t\t\t\t\t\t// in L (an upper bound on the digits in any index).\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t// Sparse encoding is cheaper when:\n\t\t\t\t\t\t\t//   (4 + d) + P * (d + 1) < (L - P) * 3\n\t\t\t\t\t\t\tconst populated_keys = valid_array_indices(/** @type {any[]} */ (thing));\n\t\t\t\t\t\t\tconst population = populated_keys.length;\n\t\t\t\t\t\t\tconst d = String(thing.length).length;\n\n\t\t\t\t\t\t\tconst hole_cost = (thing.length - population) * 3;\n\t\t\t\t\t\t\tconst sparse_cost = 4 + d + population * (d + 1);\n\n\t\t\t\t\t\t\tif (hole_cost > sparse_cost) {\n\t\t\t\t\t\t\t\tstr = '[' + SPARSE + ',' + thing.length;\n\t\t\t\t\t\t\t\tfor (let j = 0; j < populated_keys.length; j++) {\n\t\t\t\t\t\t\t\t\tconst key = populated_keys[j];\n\t\t\t\t\t\t\t\t\tkeys.push(`[${key}]`);\n\t\t\t\t\t\t\t\t\tstr += ',' + key + ',' + flatten(thing[key]);\n\t\t\t\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmostly_dense = true;\n\t\t\t\t\t\t\t\tstr += HOLE;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tstr += ']';\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase 'Set':\n\t\t\t\t\tstr = '[\"Set\"';\n\n\t\t\t\t\tfor (const value of thing) {\n\t\t\t\t\t\tstr += `,${flatten(value)}`;\n\t\t\t\t\t}\n\n\t\t\t\t\tstr += ']';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Map':\n\t\t\t\t\tstr = '[\"Map\"';\n\n\t\t\t\t\tfor (const [key, value] of thing) {\n\t\t\t\t\t\tkeys.push(\n\t\t\t\t\t\t\t`.get(${is_primitive(key) ? stringify_primitive(key) : '...'})`\n\t\t\t\t\t\t);\n\t\t\t\t\t\tstr += `,${flatten(key)},${flatten(value)}`;\n\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t}\n\n\t\t\t\t\tstr += ']';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Int8Array':\n\t\t\t\tcase 'Uint8Array':\n\t\t\t\tcase 'Uint8ClampedArray':\n\t\t\t\tcase 'Int16Array':\n\t\t\t\tcase 'Uint16Array':\n\t\t\t\tcase 'Int32Array':\n\t\t\t\tcase 'Uint32Array':\n\t\t\t\tcase 'Float32Array':\n\t\t\t\tcase 'Float64Array':\n\t\t\t\tcase 'BigInt64Array':\n\t\t\t\tcase 'BigUint64Array': {\n\t\t\t\t\t/** @type {import(\"./types.js\").TypedArray} */\n\t\t\t\t\tconst typedArray = thing;\n\t\t\t\t\tstr = '[\"' + type + '\",' + flatten(typedArray.buffer);\n\n\t\t\t\t\tconst a = thing.byteOffset;\n\t\t\t\t\tconst b = a + thing.byteLength;\n\n\t\t\t\t\t// handle subarrays\n\t\t\t\t\tif (a > 0 || b !== typedArray.buffer.byteLength) {\n\t\t\t\t\t\tconst m = +/(\\d+)/.exec(type)[1] / 8;\n\t\t\t\t\t\tstr += `,${a / m},${b / m}`;\n\t\t\t\t\t}\n\n\t\t\t\t\tstr += ']';\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase 'ArrayBuffer': {\n\t\t\t\t\t/** @type {ArrayBuffer} */\n\t\t\t\t\tconst arraybuffer = thing;\n\t\t\t\t\tconst base64 = encode64(arraybuffer);\n\n\t\t\t\t\tstr = `[\"ArrayBuffer\",\"${base64}\"]`;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase 'Temporal.Duration':\n\t\t\t\tcase 'Temporal.Instant':\n\t\t\t\tcase 'Temporal.PlainDate':\n\t\t\t\tcase 'Temporal.PlainTime':\n\t\t\t\tcase 'Temporal.PlainDateTime':\n\t\t\t\tcase 'Temporal.PlainMonthDay':\n\t\t\t\tcase 'Temporal.PlainYearMonth':\n\t\t\t\tcase 'Temporal.ZonedDateTime':\n\t\t\t\t\tstr = `[\"${type}\",${stringify_string(thing.toString())}]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tif (!is_plain_object(thing)) {\n\t\t\t\t\t\tthrow new DevalueError(\n\t\t\t\t\t\t\t`Cannot stringify arbitrary non-POJOs`,\n\t\t\t\t\t\t\tkeys,\n\t\t\t\t\t\t\tthing,\n\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (enumerable_symbols(thing).length > 0) {\n\t\t\t\t\t\tthrow new DevalueError(\n\t\t\t\t\t\t\t`Cannot stringify POJOs with symbolic keys`,\n\t\t\t\t\t\t\tkeys,\n\t\t\t\t\t\t\tthing,\n\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (Object.getPrototypeOf(thing) === null) {\n\t\t\t\t\t\tstr = '[\"null\"';\n\t\t\t\t\t\tfor (const key of Object.keys(thing)) {\n\t\t\t\t\t\t\tif (key === '__proto__') {\n\t\t\t\t\t\t\t\tthrow new DevalueError(\n\t\t\t\t\t\t\t\t\t`Cannot stringify objects with __proto__ keys`,\n\t\t\t\t\t\t\t\t\tkeys,\n\t\t\t\t\t\t\t\t\tthing,\n\t\t\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tkeys.push(stringify_key(key));\n\t\t\t\t\t\t\tstr += `,${stringify_string(key)},${flatten(thing[key])}`;\n\t\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstr += ']';\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstr = '{';\n\t\t\t\t\t\tlet started = false;\n\t\t\t\t\t\tfor (const key of Object.keys(thing)) {\n\t\t\t\t\t\t\tif (key === '__proto__') {\n\t\t\t\t\t\t\t\tthrow new DevalueError(\n\t\t\t\t\t\t\t\t\t`Cannot stringify objects with __proto__ keys`,\n\t\t\t\t\t\t\t\t\tkeys,\n\t\t\t\t\t\t\t\t\tthing,\n\t\t\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (started) str += ',';\n\t\t\t\t\t\t\tstarted = true;\n\t\t\t\t\t\t\tkeys.push(stringify_key(key));\n\t\t\t\t\t\t\tstr += `${stringify_string(key)}:${flatten(thing[key])}`;\n\t\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstr += '}';\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tstringified[index] = str;\n\t\treturn index;\n\t}\n\n\tconst index = flatten(value);\n\n\t// special case \u2014\u00A0value is represented as a negative index\n\tif (index < 0) return `${index}`;\n\n\treturn `[${stringified.join(',')}]`;\n}\n\n/**\n * @param {any} thing\n * @returns {string}\n */\nfunction stringify_primitive(thing) {\n\tconst type = typeof thing;\n\tif (type === 'string') return stringify_string(thing);\n\tif (thing instanceof String) return stringify_string(thing.toString());\n\tif (thing === void 0) return UNDEFINED.toString();\n\tif (thing === 0 && 1 / thing < 0) return NEGATIVE_ZERO.toString();\n\tif (type === 'bigint') return `[\"BigInt\",\"${thing}\"]`;\n\treturn String(thing);\n}\n", "import { safeWindow } from \"./safeWindow.ts\"\nimport { isString } from \"./utils.ts\"\n\n/**\n * Bump this when changing the schema of the pageview event or\n * any event that inherits from PageviewEventData.\n */\nexport const pageviewEventVersion = 2\n\nexport type PageviewEventData = {\n\t// Version of the event data\n\tversion: number\n\t// Framer specific properties\n\tabTestId: string | undefined\n\tframerSiteId: string | null\n\troutePath: string\n\tcollectionItemId: string | null\n\tframerLocale: string | null\n\twebPageId: string | null\n\t// Browser environment properties\n\treferrer: string | null\n\turl: string\n\thostname: string\n\tpathname: string\n\tsearch: string | null\n\thash: string | null\n\ttimezone: string | null\n\tlocale: string | null\n}\n\nexport type LinkClickEventData = PageviewEventData & {\n\tnodeId: string | null\n\thref: string | null\n\ttrackingId: string | null\n\ttargetRoutePath: string | null\n\ttargetCollectionItemId: string | null\n\ttargetWebPageId: string | null\n}\n\nexport type FormSubmitEventData = PageviewEventData & {\n\tnodeId: string | null\n\ttrackingId: string | null\n}\n\nexport type CustomEventData = PageviewEventData & {\n\tnodeId: string | null\n\ttrackingId: string | null\n}\n\nexport type TriggerInvokeEventData = PageviewEventData & {\n\tnodeId: string | null\n\ttrackingId: string | null\n}\n\ntype SiteLoadErrorEventData = {\n\tmessage: string\n\tstack?: string | null\n}\n\ntype SiteLoadRecoverableErrorEventData = {\n\tmessage: string\n\tstack?: string | null\n\tcomponentStack?: string | null\n}\n\ninterface EventData {\n\tpublished_site_click: LinkClickEventData\n\tpublished_site_pageview: PageviewEventData\n\tpublished_site_load_error: SiteLoadErrorEventData\n\tpublished_site_load_recoverable_error: SiteLoadRecoverableErrorEventData\n\tpublished_site_form_submit: FormSubmitEventData\n\tpublished_site_custom_event: CustomEventData\n\tpublished_site_trigger_invoke: TriggerInvokeEventData\n}\n\nexport function sendTrackingEvent<T extends keyof EventData>(\n\teventType: T,\n\teventData: EventData[T],\n\tsendOn: \"lazy\" | \"eager\" = \"lazy\",\n): void {\n\tsafeWindow.__framer_events?.push([eventType, eventData, sendOn])\n\n\tswitch (eventType) {\n\t\tcase \"published_site_click\": {\n\t\t\tconst { trackingId, href } = eventData as EventData[\"published_site_click\"]\n\t\t\tif (trackingId) {\n\t\t\t\tdocument.dispatchEvent(new CustomEvent(\"framer:click\", { detail: { trackingId, href } }))\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tcase \"published_site_form_submit\": {\n\t\t\tconst { trackingId } = eventData as EventData[\"published_site_form_submit\"]\n\t\t\tif (trackingId) {\n\t\t\t\tdocument.dispatchEvent(new CustomEvent(\"framer:formsubmit\", { detail: { trackingId } }))\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\t// NOTE: keep in sync with exportToHTML.ts, the initial pageview is sent from there\n\t\tcase \"published_site_pageview\": {\n\t\t\tconst { framerLocale } = eventData as EventData[\"published_site_pageview\"]\n\t\t\tdocument.dispatchEvent(new CustomEvent(\"framer:pageview\", { detail: { framerLocale } }))\n\t\t\tbreak\n\t\t}\n\t\tcase \"published_site_trigger_invoke\": {\n\t\t\tconst { trackingId } = eventData as EventData[\"published_site_trigger_invoke\"]\n\t\t\tif (trackingId) {\n\t\t\t\tdocument.dispatchEvent(new CustomEvent(\"framer:triggerinvoke\", { detail: { trackingId } }))\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n}\n\n// Tracking IDs must be lowercase alphanumeric with hyphens as separators only.\n// Empty string is allowed (converted to null trackingId when sent).\nconst validTrackingIdRegExp = /^[a-z0-9]+(?:-[a-z0-9]+)*$/u\n\nexport function isValidTrackingId(trackingId: unknown): boolean {\n\treturn isString(trackingId) && (trackingId === \"\" || validTrackingIdRegExp.test(trackingId))\n}\n", "import { parse, stringify } from \"devalue\"\nimport { sendTrackingEvent } from \"../../utils/sendTrackingEvent.ts\"\nimport { getPleaseReportMessage, isWindow, requestIdleCallback } from \"../../utils/utils.ts\"\nimport type { SerializableQueryResult } from \"../cms/QueryEngine.ts\"\n\nexport const HandoverDataType = {\n\tQueryCache: 0,\n\tCollectionUtilsCache: 1,\n} as const\n\n/**\n * Supported types: https://github.com/rich-harris/devalue. Including cyclic references, Infinity, NaN, -0, undefined.\n */\ninterface HandoverTypes {\n\t[HandoverDataType.QueryCache]: SerializableQueryResult\n\t[HandoverDataType.CollectionUtilsCache]: string | undefined\n}\n\ntype HandoverDataTypeKey = keyof HandoverTypes\n\ntype HandoverPayload = {\n\t[K in HandoverDataTypeKey]: Map<string, HandoverTypes[K]>\n}\n\nlet hydratedData: HandoverPayload | undefined\n\nfunction createEmptyPayload(): HandoverPayload {\n\treturn {\n\t\t[HandoverDataType.QueryCache]: new Map(),\n\t\t[HandoverDataType.CollectionUtilsCache]: new Map(),\n\t}\n}\n\nfunction parseHandoverData(): HandoverPayload | undefined {\n\tif (\n\t\t!isWindow ||\n\t\t// some tests set window, but don't set document.\n\t\t(process.env.NODE_ENV === \"test\" && typeof document !== \"object\")\n\t) {\n\t\treturn\n\t}\n\n\tif (hydratedData !== undefined) return hydratedData\n\n\tlet script = document.getElementById(\"__framer__handoverData\") as HTMLScriptElement | null\n\tif (!script) return\n\n\ttry {\n\t\thydratedData = parse(script.text) ?? createEmptyPayload()\n\t} catch (error) {\n\t\thydratedData = createEmptyPayload()\n\t\t// biome-ignore lint/suspicious/noConsole: intentional warning for debugging hydration\n\t\tconsole.warn(\"Failed to parse handover data. Falling back to network.\", error)\n\t}\n\n\t// Free up memory.\n\trequestIdleCallback(() => {\n\t\tscript?.remove()\n\t\tscript = null\n\t})\n\n\treturn hydratedData\n}\n\nexport function handleHydrationError(error: unknown, key: string) {\n\t// biome-ignore lint/suspicious/noConsole: This is an actionable warning.\n\tconsole.warn(\n\t\tgetPleaseReportMessage(\n\t\t\t`Failed to resolve raw query result from DOM during hydration for: ${key}. This might make the page load slightly slower.`,\n\t\t),\n\t)\n\n\tconst sampleRate = Math.random()\n\n\t// 1% sample rate to avoid flooding the data pipeline\n\tif (sampleRate < 0.01) {\n\t\tconst stack = error instanceof Error && typeof error.stack === \"string\" ? error.stack : null\n\t\tsendTrackingEvent(\"published_site_load_error\", {\n\t\t\tmessage: String(error),\n\t\t\tstack,\n\t\t})\n\t}\n}\n\nexport function hasHandoverData<T extends HandoverDataTypeKey>(dataType: T, key: string): boolean {\n\tconst data = parseHandoverData()\n\tif (!data) return false\n\treturn data[dataType].has(key)\n}\n\n/**\n * Consumes `key` from `dataType` of handed over data.\n * Set `remove` to true if the you write handover data to another cache manager.\n *\n * The returned value is undefined if the key or dataType is not found, but also *can* be undefined if the value is actually undefined.\n * @see {@link hasHandoverData} to check if the key is present.\n */\nexport function getHandoverData<T extends HandoverDataTypeKey>(dataType: T, key: string): HandoverTypes[T] | undefined {\n\tconst data = parseHandoverData()\n\tif (!data) return\n\tconst map = data[dataType]\n\tif (!map.has(key)) return\n\n\tconst value = map.get(key)\n\tmap.delete(key)\n\treturn value\n}\n\nclass HandoverCollector {\n\tprivate payload: HandoverPayload = createEmptyPayload()\n\tprivate isEmpty = true\n\n\tset<T extends HandoverDataTypeKey>(dataType: T, key: string, value: HandoverTypes[T]) {\n\t\tthis.payload[dataType].set(key, value)\n\t\tthis.isEmpty = false\n\t}\n\n\thas<T extends HandoverDataTypeKey>(dataType: T, key: string): boolean {\n\t\treturn this.payload[dataType].has(key)\n\t}\n\n\tget<T extends HandoverDataTypeKey>(dataType: T, key: string): HandoverTypes[T] | undefined {\n\t\treturn this.payload[dataType].get(key)\n\t}\n\n\t/**\n\t * Serializes the handover data to a string safe to use inside `<script>` tags.\n\t */\n\ttoString(): string | undefined {\n\t\tif (this.isEmpty) return undefined\n\t\ttry {\n\t\t\treturn stringify(this.payload)\n\t\t} catch (error) {\n\t\t\t// biome-ignore lint/suspicious/noConsole: Handover is an optimization, so if it fails, it's not the end of the world.\n\t\t\tconsole.error(\"Failed to serialize handover data.\", error)\n\t\t\treturn undefined\n\t\t}\n\t}\n\n\tclear() {\n\t\tfor (const map of Object.values(this.payload)) {\n\t\t\tmap.clear()\n\t\t}\n\t\tthis.isEmpty = true\n\t}\n}\n\nexport const handoverCollector = /* @__PURE__ */ (() => (isWindow ? undefined : new HandoverCollector()))()\n\nexport const testing = {\n\tsetData(data: typeof hydratedData) {\n\t\thydratedData = data\n\t},\n\tHandoverCollector,\n}\n", "import { frame } from \"framer-motion\"\nimport { safeWindow } from \"./safeWindow.ts\"\nimport { noop } from \"./utils.ts\"\n\ninterface SchedulerOptions {\n\t/**\n\t * 'user-blocking' will resolve within a microtask in older browsers.\n\t * @see https://www.notion.so/framer/All-things-performance-of-Sites-1bbadf6e8c9680768a4ff2aa05f93c0a#1bbadf6e8c968089a1cafabd7d49c7de for examples for each priority.\n\t */\n\tpriority?: \"user-blocking\" | \"user-visible\" | \"background\"\n\tsignal?: AbortSignal\n}\n\nconst canUseYield = /* @__PURE__ */ (() => safeWindow.scheduler && \"yield\" in safeWindow.scheduler)()\nconst canUsePostTask = /* @__PURE__ */ (() => safeWindow.scheduler && \"postTask\" in safeWindow.scheduler)()\n\n/** A set to keep track of all unresolved yield promises */\nconst pendingResolvers = new Set<VoidFunction>()\n\n/** Resolves all unresolved yield promises and clears the set. */\nfunction resolvePendingPromises() {\n\tfor (const resolve of pendingResolvers) resolve()\n\tpendingResolvers.clear()\n}\n\n/**\n * Returns a promise that, if the document is visible, will resolve _earliest_ after the next paint.\n * If the document is not visible or the tab becomes hidden, the promise is resolved immediately.\n *\n * \u201Cunless urgent\u201D: If the document changes to hidden prior to the promise resolving,\n * we assume it\u2019s about to be closed, so we resolve the promise synchronously (\"urgently\").\n * This gives it a chance to complete its work before the document is destroyed.\n * (We also resolve immediately if the document is already hidden, but that\u2019s simply\n * because when the document is backgrounded, there\u2019s no chance of INP events.)\n *\n * Modified from Philip Walton's original snippet.\n * See also https://kurtextrem.de/posts/improve-inp#exit-event-handlers-yieldunlessurgent\n */\nfunction yieldUnlessUrgent(options?: SchedulerOptions): Promise<void> {\n\treturn new Promise<void>(resolve => {\n\t\tpendingResolvers.add(resolve)\n\t\tif (document.hidden) {\n\t\t\t// Page is hidden, let's resolve all promises immediately\n\t\t\tresolvePendingPromises()\n\t\t\treturn\n\t\t}\n\n\t\t// visibilitychange + pagehide is needed to reliably (\u00B197%) detect when the page is hidden cross-browser\n\t\t// see https://nicj.net/beaconing-in-practice-fetchlater/#beaconing-in-practice-fetchlater-onload-or-pagehide-or-visibilitychange\n\t\t// (note: as we pass the same listener fn every time, the listener is only ever added once)\n\t\tdocument.addEventListener(\"visibilitychange\", resolvePendingPromises)\n\t\tdocument.addEventListener(\"pagehide\", resolvePendingPromises)\n\n\t\t// await-interaction-response without a setTimeout fallback, as the fallbacks are the event listeners above\n\t\tframe.read(() => {\n\t\t\tconst resolveFn = () => {\n\t\t\t\tpendingResolvers.delete(resolve)\n\n\t\t\t\tif (options?.signal?.aborted) return\n\t\t\t\tresolve()\n\t\t\t}\n\n\t\t\tvoid schedulerYield(options).then(resolveFn)\n\t\t})\n\t\treturn\n\t})\n}\n\n/**\n * Similar to `yieldToMain`, but waits for the next paint before resolving (with a fallback of 100ms if the animation frame never fires).\n * Compared to `yieldToMain`, it guarantees improved INP, but might make processing a little slower. Use only if necessary.\n * @see yieldToMain\n */\nfunction interactionResponse(options?: SchedulerOptions): Promise<void> {\n\treturn new Promise<void>(resolve => {\n\t\tsetTimeout(resolve, 100) // Fallback for the case where the animation frame never fires.\n\t\tframe.read(\n\t\t\t() => {\n\t\t\t\tvoid schedulerYield(options).then(resolve)\n\t\t\t},\n\t\t\tfalse,\n\t\t\t// In some cases, interactionResponse might be called in a rAF. This means, we should right away call `schedulerYield`, as the next paint follows immediately.\n\t\t\ttrue,\n\t\t)\n\t})\n}\n\nfunction schedulerYield(options?: SchedulerOptions): Promise<void> {\n\tconst priority = options?.priority\n\tconst canUseModernAPI = canUseYield || canUsePostTask\n\tif (!canUseModernAPI) {\n\t\t// Resolve synchronously if we can't use the modern APIs for user-blocking tasks\n\t\tif (priority === \"user-blocking\") {\n\t\t\t// `setTimeout` could suffer from being delayed for longer: https://developer.chrome.com/blog/introducing-scheduler-yield-origin-trial#the_problem_with_current_yielding_strategies\n\t\t\t// so for browsers not supporting yield, we guarantee execution for high priority actions, but this does not create space for a paint opportunity as trade-off.\n\t\t\t// We use a microtask to ensure we don't start relying on sync behaviors somewhere.\n\t\t\treturn Promise.resolve()\n\t\t}\n\n\t\treturn new Promise<void>(resolve => {\n\t\t\tsetTimeout(resolve, priority === \"background\" ? 1 : 0)\n\t\t})\n\t}\n\n\tif (priority === \"background\") {\n\t\t// If it isn't important, we can use a timeout with lowest prio (delay=1) instead.\n\t\treturn new Promise<void>(resolve => {\n\t\t\tsetTimeout(resolve, 1)\n\t\t})\n\t}\n\n\tif (canUseYield) {\n\t\t// biome-ignore lint/style/noNonNullAssertion: we know it exists at this point\n\t\treturn safeWindow.scheduler!.yield!(options).catch(noop)\n\t}\n\n\t// biome-ignore lint/style/noNonNullAssertion: we know it exists at this point\n\treturn safeWindow.scheduler!.postTask!(() => {}, options).catch(noop)\n}\n\nexport type YieldOptions = SchedulerOptions &\n\t(\n\t\t| {\n\t\t\t\t/**\n\t\t\t\t * @see `yield` \u2014 {@link yieldToMain} yield to the main thread before continuing execution (scheduler.yield/postTask/setTimeout).\n\t\t\t\t * @see `paint` \u2014 {@link interactionResponse} awaits the next paint and then yields before continuing execution.\n\t\t\t\t *\n\t\t\t\t * See also https://kurtextrem.de/posts/improve-inp.\n\t\t\t\t */\n\t\t\t\tcontinueAfter?: \"yield\" | \"paint\"\n\t\t\t\tensureContinueBeforeUnload?: false\n\t\t  }\n\t\t| {\n\t\t\t\t/**\n\t\t\t\t * If true, the promise is guaranteed to resolve right before the user closes the tab and runs earliest after the next paint.\n\t\t\t\t * @see {@link yieldUnlessUrgent} - https://kurtextrem.de/posts/improve-inp#exit-event-handlers-yieldunlessurgent\n\t\t\t\t */\n\t\t\t\tensureContinueBeforeUnload: true\n\t\t\t\tcontinueAfter: \"paint\"\n\t\t  }\n\t)\n\n/**\n * Yields to main thread before continuing execution.\n *\n * Options:\n * @param options.priority {@link YieldOptions.priority}: if not set, might implicitly inherit the priority, see [spec](https://github.com/WICG/scheduling-apis/blob/main/explainers/yield-and-continuation.md#:~:text=highest%20scheduler%20priority.-,scheduler.yield(),-If%20a%20priority).\n * @param options.continueAfter {@link YieldOptions.continueAfter} `\"yield\"` is the default. `\"paint\"` guarantees continuation only happens after the next paint.\n * @param options.ensureContinueBeforeUnload {@link YieldOptions.ensureContinueBeforeUnload} ensures the promise is resolved right before the user closes the tab if it hasn't resolved before.\n *\n * Note: If `ensureContinueBeforeUnload: true` is passed, you must set `continueAfter: \"paint\"`, as this is the only supported combination currently.\n *\n * @usage `options.continueAfter: \"paint\"` for user interaction handlers (like `onTap`, `onClick`, etc.) to keep INP low.\n * @usage `options.ensureContinueBeforeUnload: true` for code that should execute eventually (analytics, storing form data, etc.).\n */\nexport function yieldToMain(options?: YieldOptions): Promise<void> {\n\tconst { continueAfter, ensureContinueBeforeUnload, ...schedulerOptions } = options ?? {}\n\tif (ensureContinueBeforeUnload) {\n\t\treturn yieldUnlessUrgent(schedulerOptions)\n\t}\n\n\tif (continueAfter === \"paint\") {\n\t\treturn interactionResponse(schedulerOptions)\n\t}\n\n\treturn schedulerYield(schedulerOptions)\n}\n", "import type { MutableRefObject } from \"react\"\nimport { useCallback, useEffect, useLayoutEffect, useRef } from \"react\"\nimport { useCollectionUtils } from \"../modules/cms/CollectionUtilsCache.tsx\"\nimport { sendTrackingEvent } from \"../utils/sendTrackingEvent.ts\"\nimport { isObject, isString, isWindow } from \"../utils/utils.ts\"\nimport { computeRelativePath } from \"./computeRelativePath.ts\"\nimport { customNotFoundPagePaths } from \"./customNotFoundPagePaths.ts\"\nimport { fillPathVariables } from \"./fillPathVariables.ts\"\nimport { forwardCurrentQueryParams } from \"./forwardQueryParams.ts\"\nimport type { GetNavigationPathOptions } from \"./getLocalizedNavigationPath.ts\"\nimport { getLocalizedNavigationPath } from \"./getLocalizedNavigationPath.ts\"\nimport { getSitePrefix } from \"./getSitePrefix.ts\"\nimport { useViewTransition } from \"./pageEffects/useViewTransition.ts\"\nimport { pathVariablesRegExpGlobal } from \"./pathVariables.ts\"\nimport { announceNavigation, updateCanonicalURL } from \"./routerDomUtils.ts\"\nimport type {\n\tLocale,\n\tLocaleId,\n\tNavigationPerformanceDetail,\n\tPaginationInfo,\n\tRoute,\n\tRouteId,\n\tSetCurrentRouteId,\n\tUpdateURL,\n} from \"./types.ts\"\nimport { useMonitorNextPaintAfterRender } from \"./useMonitorNextPaintAfterRender.ts\"\nimport { getRouteElementId, monitorINPRelatedInputs } from \"./utils.ts\"\n\nexport async function pushRouteState(\n\trouteId: RouteId,\n\troute: Route,\n\t{\n\t\tcurrentRoutePath,\n\t\tcurrentRoutePathLocalized,\n\t\tcurrentPathVariables,\n\t\thash,\n\t\tpathVariables,\n\t\tlocaleId,\n\t\tpreserveQueryParams,\n\t\tsiteCanonicalURL,\n\t}: RoutePathOptions,\n\tisNavigationTransition = false,\n): ReturnType<UpdateURL> {\n\tconst { path } = route\n\tif (!path) return\n\n\t// Use a relative path if possible, because the site might be served\n\t// at a sub-path, e.g.:\n\t// - site served at www.framer.com/sites/my-site/\n\t// - current URL: www.framer.com/sites/my-site/one\n\t// - pushing /two would result in www.framer.com/two\n\t// - computing a relative path \"./two\" and pushing that works better\n\tconst newPath = getPathForRoute(route, {\n\t\tcurrentRoutePath,\n\t\tcurrentRoutePathLocalized,\n\t\tcurrentPathVariables,\n\t\thash,\n\t\tpathVariables,\n\t\tpreserveQueryParams,\n\t\tsiteCanonicalURL,\n\t\tlocaleId,\n\t})\n\n\t// When navigating between two items of the same dynamic route, `getPathForRoute` preserves\n\t// active filter params in the new URL. The `queryParamBackAnchorSearch` field tracks the\n\t// pre-filter search and is what `forwardCurrentQueryParams` uses to know which params are\n\t// \"filter params\" and should be stripped on cross-route navigation. If we drop it here, a\n\t// later cross-route link click from the new entry would forward the full filter query to\n\t// unrelated routes.\n\tconst isSameRouteNavigation = currentRoutePath !== undefined && currentRoutePath === path\n\tconst previousState = isHistoryState(window.history.state) ? window.history.state : undefined\n\tconst queryParamBackAnchorSearch = isSameRouteNavigation ? previousState?.queryParamBackAnchorSearch : undefined\n\n\ttry {\n\t\treturn await pushHistoryState(\n\t\t\t{ routeId, hash, pathVariables, localeId, queryParamBackAnchorSearch },\n\t\t\tnewPath,\n\t\t\tisNavigationTransition,\n\t\t)\n\t} catch {\n\t\t// pushState can throw on null origins, e.g., when browsing\n\t\t// an exported prototype on file://, or in sandboxed iframes\n\t}\n}\n\nexport interface HistoryState {\n\trouteId: RouteId\n\thash?: string\n\tpathVariables?: Record<string, unknown>\n\tlocaleId?: LocaleId\n\t/** The search string before the first filter push, used to detect when all filters are cleared. */\n\tqueryParamBackAnchorSearch?: string\n\tpaginationInfo?: {\n\t\t[hash: string]: PaginationInfo\n\t}\n}\n\nexport function isHistoryState(data: unknown): data is HistoryState {\n\tconst routeIdKey: keyof HistoryState = \"routeId\"\n\treturn isObject(data) && isString(data[routeIdKey])\n}\n\nexport function replaceHistoryState(data: HistoryState, url?: string, ignoreReplaceStateWrapper = false): void {\n\tperformance.mark(\"framer-history-replace\")\n\n\tif (url) {\n\t\tupdateCanonicalURL(url, window.location.href)\n\t}\n\n\t// @ts-expect-error -- we walk the prototype chain to skip any proxies/wrappers on replaceState.\n\tconst replaceState = ignoreReplaceStateWrapper ? window.history.__proto__.replaceState : window.history.replaceState\n\treplaceState.call(window.history, data, \"\", url)\n}\n\nlet maybeHasPopstateBug = true\nconst isImpactedPopstateBugChromiumVersion = /* #__PURE__ */ (() => {\n\tif (typeof navigator === \"undefined\") return false\n\t// we can't use `navigator.userAgentData` here since some default Edge settings will just return an empty object.\n\tconst userAgent = navigator.userAgent\n\tconst chromePos = userAgent.indexOf(\"Chrome/\")\n\tconst chromiumVersion = +userAgent.slice(chromePos + 7, userAgent.indexOf(\".\", chromePos)) // 'Chrome'.length = 7, so we extract what follows 'Chrome/' in the user agent str before the next dot\n\t// In Chromium < 128, `intercept()` triggers `popstate`. Fixed in Chromium 128, so only Chromium versions 102-127 are affected (supports navigation API & has the popstate bug)\n\t// see https://issues.chromium.org/issues/352436133\n\treturn chromiumVersion > 101 && chromiumVersion < 128\n})()\n\n/**\n * Pushes a new history state to the browser's history after yielding to the main thread.\n * If it's important that the URL state is updated before re-rendering UI, use `await pushHistoryState(...)`\n * If not, use `void pushHistoryState(...)` so that the history state update is done asynchronously.\n *\n * @param isNavigationTransition - Set this if this pushState is part of a Navigation API transition, i.e., one where we want to show the native loading spinner. Navigation transitions in Chrome < 128 incorrectly trigger popstate handlers, which can cause duplicate tracking events if a tracking library is hooking into both popstate and pushState. With this flag set, we'll apply a mitigation to make sure only one of those gets called.\n */\nexport async function pushHistoryState(\n\tdata: HistoryState,\n\turl: string,\n\tisNavigationTransition = false,\n): ReturnType<UpdateURL> {\n\tperformance.mark(\"framer-history-push\")\n\n\t// needed so that browsers use the correct URL for the share sheet - https://github.com/framer/company/issues/29317\n\tupdateCanonicalURL(url, window.location.href)\n\n\tif (!isNavigationTransition) {\n\t\t// if it's not part of a transition, it means we never call `intercept()`, so we don't have to account for the chromium bug mentioned below\n\t\twindow.history.pushState(data, \"\", url)\n\t\treturn\n\t}\n\n\t// we rely on the event / error log *if* another browser happens to implement the same bug at some point\n\t// but if we know the browser doesn't have this behavior, we can just skip the check on the next invocation\n\tlet popstateCalled = false,\n\t\tpopstateListener: Parameters<typeof window.addEventListener>[1]\n\tif (maybeHasPopstateBug) {\n\t\tpopstateListener = () => {\n\t\t\tpopstateCalled = true\n\n\t\t\tif (isImpactedPopstateBugChromiumVersion) return\n\n\t\t\t// This is a safe-guard if another browser vendor happens to 'implement' the same bug at some point.\n\t\t\tconst msg = \"Popstate called after intercept(). Please report this to the Framer team.\"\n\t\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\t\tconsole.error(msg)\n\t\t\tsendTrackingEvent(\"published_site_load_recoverable_error\", {\n\t\t\t\tmessage: msg,\n\t\t\t})\n\t\t}\n\t\twindow.addEventListener(\"popstate\", popstateListener, { once: true })\n\t}\n\n\tif (isImpactedPopstateBugChromiumVersion && maybeHasPopstateBug) {\n\t\t// @ts-expect-error -- we walk the prototype chain to skip any proxies/wrappers on pushState, which avoids duplicate tracking calls, as the call of the `popstate` event triggers tracking calls\n\t\twindow.history.__proto__.pushState.call(window.history, data, \"\", url)\n\t} else {\n\t\twindow.history.pushState(data, \"\", url)\n\t}\n\n\tif (maybeHasPopstateBug) {\n\t\tqueueMicrotask(() => {\n\t\t\tif (popstateCalled) return\n\n\t\t\tmaybeHasPopstateBug = false\n\t\t\twindow.removeEventListener(\"popstate\", popstateListener)\n\t\t\treturn\n\t\t})\n\t}\n}\n\nexport function useReplaceInitialState({\n\tdisabled,\n\trouteId,\n\tinitialPathVariables,\n\tinitialLocaleId,\n}: {\n\tdisabled?: boolean\n\trouteId: RouteId\n\tinitialPathVariables?: Record<string, unknown>\n\tinitialLocaleId?: LocaleId\n}) {\n\t// we need to use layout effect here to ensure that the initial state is set before any other state changes happen.\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: We explicitly want this to only happen once on load, because we should not touch the history state afterwards\n\tuseLayoutEffect(() => {\n\t\tif (disabled) return\n\n\t\tperformance.mark(\"framer-history-set-initial-state\")\n\t\tconst currentState = isObject(window.history.state) ? window.history.state : {}\n\t\tconst initialHash = window.location.hash ? window.location.hash.slice(1) : undefined\n\t\t// Make sure the initial route is set correctly. history.replaceState\n\t\t// can only throw if the `url` parameter is set, so no try/catch needed here\n\t\treplaceHistoryState(\n\t\t\t{\n\t\t\t\t...currentState,\n\t\t\t\trouteId,\n\t\t\t\thash: initialHash,\n\t\t\t\tpathVariables: initialPathVariables,\n\t\t\t\tlocaleId: initialLocaleId,\n\t\t\t},\n\t\t\tundefined,\n\t\t\ttrue,\n\t\t)\n\t}, [])\n}\n\n// \"navigation\" is a name that might be used by custom code or element IDs\n// so to be safe we check for the existence of the `back` function (which is part of the Navigation API and has the shortest name)\n// This check doesn't prevent people from breaking the Navigation API by overriding the global `window.navigation` object,\n// but it prevents errors from `<div id=\"navigation\">` elements.\n// As the Navigation API is only used for progressive enhancement, that's ok.\nconst supportsNavigationAPI = /* #__PURE__ */ (() => isWindow && typeof window.navigation?.back === \"function\")()\n\nexport function usePopStateHandler(currentRouteId: MutableRefObject<RouteId>, setCurrentRouteId: SetCurrentRouteId) {\n\tconst startViewTransition = useViewTransition()\n\tconst monitorNextPaintAfterRender = useMonitorNextPaintAfterRender<NavigationPerformanceDetail>(\"framer-route-change\")\n\n\tconst viewTransitionReady = useRef<{ resolve: VoidFunction; reject: VoidFunction } | undefined>(undefined)\n\n\tconst popStateHandler = useCallback(\n\t\tasync ({ state }: PopStateEvent) => {\n\t\t\t// popstate can be triggered after `pushState` due to a chromium bug: https://issues.chromium.org/issues/352436133\n\t\t\t// so we we should ignore if it's not a traverse action, where popstate fires after `intercept`.\n\t\t\tif (window.navigation?.transition && window.navigation?.transition?.navigationType !== \"traverse\") return\n\n\t\t\tif (!isObject(state)) return\n\t\t\tconst { routeId, hash, pathVariables, localeId } = state\n\t\t\tif (!isString(routeId)) return\n\n\t\t\t// ! Always keep the following lines first after the checks above:\n\t\t\tconst nextRender = monitorNextPaintAfterRender({\n\t\t\t\tpopstate: true,\n\t\t\t})\n\t\t\tconst stopMonitoringINPRelatedInputs = monitorINPRelatedInputs()\n\t\t\tvoid nextRender.promise.finally(stopMonitoringINPRelatedInputs)\n\n\t\t\tconst changeRoute = () => {\n\t\t\t\tsetCurrentRouteId(\n\t\t\t\t\trouteId,\n\t\t\t\t\tisString(localeId) ? localeId : undefined,\n\t\t\t\t\tisString(hash) ? hash : undefined,\n\t\t\t\t\twindow.location.pathname + window.location.search + window.location.hash,\n\t\t\t\t\tisObject(pathVariables) ? pathVariables : undefined,\n\t\t\t\t\ttrue,\n\t\t\t\t\tnextRender,\n\t\t\t\t\tfalse,\n\t\t\t\t)\n\t\t\t}\n\t\t\t// </!>\n\n\t\t\tconst viewTransition = await startViewTransition(currentRouteId.current, routeId, changeRoute)\n\t\t\tconst navigationTransition = window.navigation?.transition\n\n\t\t\t// If there's no page effect for this transition, we need\n\t\t\t// to immediately resolve the promise that is awaited in\n\t\t\t// the intercept handler for navigation events, otherwise\n\t\t\t// the page will show an infinite loading spinner!\n\t\t\tawait (viewTransition?.updateCallbackDone ?? Promise.resolve())\n\t\t\t\t.then(viewTransitionReady.current?.resolve)\n\t\t\t\t.catch(viewTransitionReady.current?.reject)\n\n\t\t\t// Await navigation to finish to make sure the navigation is complete before triggering side-effects\n\t\t\t// This avoids race conditions in Edge et al. where the announcement happens milliseconds\n\t\t\t// before the loading spinner disappears, and the screen reader reads \u201CLoading complete\u201D\n\t\t\t// instead of the announcement\n\t\t\tawait nextRender.promise\n\t\t\ttry {\n\t\t\t\tawait navigationTransition?.finished\n\t\t\t} catch (error: unknown) {\n\t\t\t\t// One known way this can reject is when the network is down.\n\t\t\t\t// Network down is not an issue on popstate, so we keep it a warning.\n\t\t\t\t// biome-ignore lint/suspicious/noConsole:\n\t\t\t\tconsole.warn(\"Popstate transition failed\", error)\n\t\t\t}\n\n\t\t\tannounceNavigation()\n\t\t\tupdateCanonicalURL(window.location.href)\n\t\t},\n\t\t[currentRouteId, monitorNextPaintAfterRender, setCurrentRouteId, startViewTransition],\n\t)\n\n\t// Intercept traversals via the Navigation API. If there's a view transition currently\n\t// being prepared (established via the popstate handler) we want to wait to restore\n\t// the popped state's scroll position until after the page has been updated.\n\t// Arguably the behaviour this is fixing is a bug https://bugs.chromium.org/p/chromium/issues/detail?id=1504749#c4\n\t// and may be fixed in the future.\n\tconst traversalHandler = useCallback((event: NavigationEventMap[\"navigate\"]) => {\n\t\tif (event.navigationType !== \"traverse\" || !event.canIntercept) return\n\n\t\tevent.intercept({\n\t\t\tasync handler() {\n\t\t\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\t\t\tviewTransitionReady.current = { resolve, reject }\n\t\t\t\t})\n\t\t\t\tviewTransitionReady.current = undefined\n\t\t\t},\n\t\t\tscroll: \"after-transition\",\n\t\t})\n\t}, [])\n\n\tuseEffect(() => {\n\t\twindow.addEventListener(\"popstate\", popStateHandler)\n\t\tif (supportsNavigationAPI) window.navigation.addEventListener(\"navigate\", traversalHandler)\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener(\"popstate\", popStateHandler)\n\t\t\tif (supportsNavigationAPI) window.navigation.removeEventListener(\"navigate\", traversalHandler)\n\t\t}\n\t}, [popStateHandler, traversalHandler])\n}\n\ninterface RoutePathOptions {\n\tcurrentRoutePath: string | undefined\n\tcurrentRoutePathLocalized?: Record<string, string>\n\tcurrentPathVariables: Record<string, unknown> | undefined\n\thash?: string\n\tpathVariables?: Record<string, unknown>\n\thashVariables?: Record<string, unknown>\n\trelative?: boolean\n\tlocaleId?: string\n\tpreserveQueryParams: boolean | undefined\n\t/**\n\t * Resolve and return only the hash part of the link, useful when getting\n\t * the value of an element id.\n\t */\n\tonlyHash?: boolean\n\tsiteCanonicalURL: string | undefined\n}\n\nexport function getHashForRoute(\n\thash: string | undefined,\n\troute: Route | undefined,\n\thashVariables?: Record<string, unknown>,\n) {\n\tconst resolvedHash = getRouteElementId(route, hash)\n\tif (!resolvedHash) return undefined\n\tconst variables = Object.assign({}, route?.elements, hashVariables)\n\treturn resolvedHash.replace(pathVariablesRegExpGlobal, (m, p1) => variables[p1] ?? m)\n}\n\nexport function getPathForRoute(\n\troute: Route | undefined,\n\t{\n\t\tcurrentRoutePath,\n\t\tcurrentRoutePathLocalized,\n\t\tcurrentPathVariables,\n\t\thash,\n\t\tpathVariables,\n\t\thashVariables,\n\t\trelative = true,\n\t\tpreserveQueryParams,\n\t\tonlyHash = false,\n\t\tsiteCanonicalURL,\n\t\tlocaleId,\n\t}: RoutePathOptions,\n): string {\n\tconst resolvedHash = getHashForRoute(hash, route, hashVariables)\n\tif (onlyHash) return resolvedHash ?? \"\"\n\n\tlet currentPath = currentRoutePath ?? \"/\"\n\tif (currentRoutePathLocalized && localeId) {\n\t\tcurrentPath = currentRoutePathLocalized[localeId] ?? currentPath\n\t}\n\tif (currentPathVariables) {\n\t\tcurrentPath = currentPath.replace(pathVariablesRegExpGlobal, (m, p1) => String(currentPathVariables[p1] || m))\n\t}\n\n\tconst targetPathLocalized = localeId ? route?.pathLocalized?.[localeId] : undefined\n\tconst targetPath = targetPathLocalized ?? route?.path ?? \"/\"\n\n\tlet path = targetPath\n\tif (pathVariables) {\n\t\tpath = path.replace(pathVariablesRegExpGlobal, (m, p1) => String(pathVariables[p1] || m))\n\t}\n\n\tconst isSamePageHashNavigation = Boolean(currentPath === path && resolvedHash)\n\t// Navigating between different items of the same dynamic route \u2014 e.g. clicking a\n\t// \"next item\" link between CMS detail pages of `/blog/[slug]`. We compare the path\n\t// templates so the URL still keeps any active dynamic filter params; without this\n\t// the filter widgets would stay applied locally while the URL has dropped the params,\n\t// resulting in a desync that is also un-shareable.\n\tconst isSameDynamicRouteNavigation =\n\t\t!isSamePageHashNavigation &&\n\t\tpathVariables !== undefined &&\n\t\tcurrentRoutePath !== undefined &&\n\t\troute?.path !== undefined &&\n\t\tcurrentRoutePath === route.path &&\n\t\tcurrentPath !== path\n\n\tif (relative) {\n\t\tif (customNotFoundPagePaths.has(currentPath) && typeof window !== \"undefined\") {\n\t\t\t// Relative navigations from a 404 page need special treatment, because currentPath is /404 (or similar),\n\t\t\t// but in reality the 404 page can be served from anywhere, e.g., /doesnt/exist. Under normal circumstances,\n\t\t\t// this would lead to an incorrect relative path, e.g., going from /404 to /about = ./about, but if the\n\t\t\t// actual path is /doesnt/exist, then we end up at /doesnt/about.\n\t\t\t//\n\t\t\t// One of the reasons we don't use window.location.pathname by default is to correctly navigate on sites\n\t\t\t// hosted at a prefix, so let's make our best effort to retain that.\n\t\t\t//\n\t\t\t// Note that the the `typeof window !== \"undefined\"` check means we have a divergent behavior between the\n\t\t\t// server and the client. To alleviate that, we have fixRelativeLinks.ts, which will converge them on load.\n\t\t\tconst sitePrefix = getSitePrefix(siteCanonicalURL)\n\t\t\tpath = computeRelativePath(window.location.pathname, sitePrefix + path)\n\t\t} else {\n\t\t\tpath = computeRelativePath(currentPath, path)\n\t\t}\n\t}\n\n\t// Navigating to a scroll section on the same page should always retain query params, and so\n\t// should navigation between different items of the same dynamic route.\n\tconst ignoreBackAnchor = isSamePageHashNavigation || isSameDynamicRouteNavigation\n\tif (preserveQueryParams || ignoreBackAnchor) {\n\t\tpath = forwardCurrentQueryParams(path, ignoreBackAnchor)\n\t}\n\t// Append the hash *after* the query params.\n\tif (resolvedHash) {\n\t\tpath = `${path}#${resolvedHash}`\n\t}\n\n\treturn path\n}\n\n/**\n * If a slug is missing when switching locales it could be this item is hidden\n * in said locale. Customers can add redirects for these paths to redirect to\n * other pages, but redirects are client side only. We check if such a redirect\n * exists and if so we do a full page reload to the next page instead of client\n * side navigation.\n */\nasync function handleRedirectForMissingSlugs(\n\troute: Route,\n\tpathVariables: Record<string, unknown> | undefined,\n\tnextLocale: Locale,\n): Promise<boolean> {\n\tif (!route.path) return false\n\tif (!pathVariables) return false\n\n\tconst prefix = nextLocale.slug ? `/${nextLocale.slug}` : \"\"\n\tconst nextLocaleWithDefaultSlugPath = `${prefix}${fillPathVariables(route.path, pathVariables)}`\n\n\tconst response = await fetch(nextLocaleWithDefaultSlugPath, {\n\t\tmethod: \"HEAD\",\n\t\tredirect: \"manual\",\n\t})\n\n\tconst isRedirect = response.type === \"opaqueredirect\"\n\tif (isRedirect) {\n\t\twindow.location.href = window.location.origin + nextLocaleWithDefaultSlugPath\n\t\treturn true\n\t}\n\n\treturn false\n}\n\nexport function useSwitchLocale() {\n\tconst collectionUtils = useCollectionUtils()\n\treturn useCallback(\n\t\t(options: Omit<GetNavigationPathOptions, \"collectionUtils\">) => {\n\t\t\treturn switchLocale({ ...options, collectionUtils })\n\t\t},\n\t\t[collectionUtils],\n\t)\n}\n\nexport async function switchLocale(options: GetNavigationPathOptions) {\n\tconst result = await getLocalizedNavigationPath(options)\n\tif (!result) return\n\n\ttry {\n\t\tlocalStorage.preferredLocale = options.nextLocale.code\n\t} catch {\n\t\t// Failing to set this is ok, we just won't be able to auto-redirect the user on future\n\t\t// visits if the site has \"Automatic Locale\" enabled.\n\t}\n\n\ttry {\n\t\tif (!isString(result.path)) {\n\t\t\tthrow new Error(\"Expected result.path to be a string\")\n\t\t}\n\n\t\tif (result.isMissingInLocale) {\n\t\t\tconst hasRedirect = await handleRedirectForMissingSlugs(options.route, result.pathVariables, options.nextLocale)\n\n\t\t\tif (hasRedirect) return\n\t\t}\n\t} catch {\n\t\t// pushState can throw on null origins, e.g., when browsing\n\t\t// an exported prototype on file://, or in sandboxed iframes\n\t}\n\n\treturn result\n}\n\nexport function pushLoadMoreHistory(hash: string, paginationInfo: PaginationInfo) {\n\ttry {\n\t\tconst currentHistoryState: HistoryState = window.history.state\n\t\tif (!isHistoryState(currentHistoryState)) return\n\n\t\t// if we don't have the paginationInfo for this hash, it means this is the initial load after a navigation.\n\t\t// thus, we want to skip any replaceState wrappers to avoid repeated GTM page views.\n\t\t// see https://framer-team.slack.com/archives/C01B14R6E22/p1720777938284699?thread_ts=1720519780.513099&cid=C01B14R6E22\n\t\tconst isInitialLoad =\n\t\t\tcurrentHistoryState?.paginationInfo === undefined || currentHistoryState.paginationInfo[hash] === undefined\n\n\t\tconst newPaginationInfo = { ...currentHistoryState.paginationInfo, [hash]: paginationInfo }\n\t\treplaceHistoryState({ ...currentHistoryState, paginationInfo: newPaginationInfo }, undefined, isInitialLoad)\n\t} catch {\n\t\t// pushState can throw on null origins, e.g., when browsing\n\t\t// an exported prototype on file://, or in sandboxed iframes\n\t}\n}\n\n/**\n * Starts a native loading spinner that stops when `promise` resolves or if aborted.\n */\nexport function useNativeLoadingSpinner(): (\n\tpromise: Promise<void>,\n\tupdateURL: (isNavigationTransition?: boolean) => ReturnType<UpdateURL>,\n\tcontroller?: AbortController,\n) => void {\n\tconst navigationPromise = useRef<Promise<void>>(Promise.resolve())\n\tconst navigationController = useRef<AbortController>()\n\n\tconst navigateListener = useCallback((navigateEvent: NavigateEvent) => {\n\t\t// we don't want to intercept browser back/forward navigation here (as it's handled by the popstate handler)\n\t\tif (navigateEvent.navigationType === \"traverse\" || !navigateEvent.canIntercept) return\n\n\t\tconst controller = navigationController.current\n\t\tcontroller?.signal.addEventListener(\"abort\", () => {\n\t\t\tcontroller.abort(\"user aborted\")\n\t\t})\n\n\t\tnavigateEvent.intercept({\n\t\t\thandler: () => navigationPromise.current,\n\t\t})\n\t}, [])\n\n\treturn useCallback(\n\t\t(promise, updateURL, controller) => {\n\t\t\tif (!supportsNavigationAPI) {\n\t\t\t\tvoid updateURL()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tnavigationPromise.current = promise\n\t\t\tnavigationController.current = controller\n\t\t\twindow.navigation.addEventListener(\"navigate\", navigateListener)\n\n\t\t\t// Due to a Chromium bug in < v128, `intercept()` triggers `popstate`, see https://issues.chromium.org/issues/352436133.\n\t\t\t// As GTM tacks page views based on `pushState` wrappers and `popstate` events,\n\t\t\t// we want to use the proto chain here, so we avoid triggering the `pushstate` wrapper.\n\t\t\t// see also https://framer-team.slack.com/archives/C01B14R6E22/p1720519780513099\n\t\t\tvoid updateURL(true)\n\n\t\t\tvoid promise.finally(() => {\n\t\t\t\t// only once the navigation is finished, we no longer want to intercept navigation events.\n\t\t\t\twindow.navigation.removeEventListener(\"navigate\", navigateListener)\n\t\t\t})\n\t\t},\n\t\t[navigateListener],\n\t)\n}\n", "export function computeRelativePath(from: string, to: string) {\n\tif (!from.startsWith(\"/\") || !to.startsWith(\"/\")) {\n\t\tthrow new Error(\"from/to paths are expected to be absolute\")\n\t}\n\n\tconst [fromDir] = getDirAndFile(from)\n\tconst [toDir, toFile] = getDirAndFile(to)\n\n\t// Note: relative() only operates on directories.\n\tlet relativePath = relative(fromDir, toDir)\n\n\t// Make sure all our relative path starts with \".\" or \"/\", since that's how\n\t// we determine if a URL is internal. See `isInternalURL`:\n\t// https://github.com/framer/FramerStudio/blob/cf100be43e6a912b5a63b9992752f0adb2619b19/src/library/src/modules/Link.tsx#L24\n\tif (relativePath === \"\") relativePath = \".\"\n\n\tif (!relativePath.startsWith(\".\") && !relativePath.startsWith(\"/\")) {\n\t\trelativePath = \"./\" + relativePath\n\t}\n\t// Note: relative() never returns a path with a trailing slash.\n\treturn relativePath + \"/\" + toFile\n}\n\n/**\n * Takes a URL path and returns the \"directory\" part and the \"file\" part.\n *\n * For example:\n * - `getDirAndFile(\"/one/two\") === [\"/one/\", \"two\"]`\n * - `getDirAndFile(\"/one/two/\") === [\"/one/two/\", \"\"]`\n *\n * This matters for the purposes of the `.` and `..` \"operators\", which consider\n * the \"directories\" and not \"files\".\n *\n * (There are no actual \"directories\" and \"files\" in URL paths, only path\n *  segments, so these are metaphorical, hence the quotes. The metaphor holds\n *  quite well in practice!)\n */\nfunction getDirAndFile(path: string): [string, string] {\n\tconst index = path.lastIndexOf(\"/\")\n\treturn [path.substring(0, index + 1), path.substring(index + 1)]\n}\n\n// #region Code ported from Node.js.\n\nconst CHAR_DOT = 46\nconst CHAR_FORWARD_SLASH = 47\n\nconst StringPrototypeCharCodeAt = (str: string, index: number) => str.charCodeAt(index)\nconst StringPrototypeLastIndexOf = (str: string, searchString: string) => str.lastIndexOf(searchString)\nconst StringPrototypeSlice = (str: string, start?: number, end?: number) => str.slice(start, end)\n\n/**\n * `path.relative`, ported from Node.js.\n *\n * Alterations are marked with the /* comments.\n *\n * https://nodejs.org/docs/latest-v14.x/api/path.html#path_path_relative_from_to\n * https://github.com/nodejs/node/blob/dd52c05046bcc65746e26e2de65699dffcd454ee/lib/path.js#L1190\n */\nfunction relative(from: string, to: string) {\n\t/*\n    validateString(from, \"from\")\n    validateString(to, \"to\")\n     */\n\n\tif (from === to) return \"\"\n\n\t/*\n    // Trim leading forward slashes.\n    from = posix.resolve(from)\n    to = posix.resolve(to)\n     */\n\n\t/*\n    This mimics what posix.resolve does when called with a single, absolute path:\n    https://github.com/nodejs/node/blob/dd52c05046bcc65746e26e2de65699dffcd454ee/lib/path.js#L1091\n     */\n\tfrom = \"/\" + normalizeString(from)\n\tto = \"/\" + normalizeString(to)\n\n\tif (from === to) return \"\"\n\n\tconst fromStart = 1\n\tconst fromEnd = from.length\n\tconst fromLen = fromEnd - fromStart\n\tconst toStart = 1\n\tconst toLen = to.length - toStart\n\n\t// Compare paths to find the longest common path from root\n\tconst length = fromLen < toLen ? fromLen : toLen\n\tlet lastCommonSep = -1\n\tlet i = 0\n\tfor (; i < length; i++) {\n\t\tconst fromCode = StringPrototypeCharCodeAt(from, fromStart + i)\n\t\tif (fromCode !== StringPrototypeCharCodeAt(to, toStart + i)) break\n\t\telse if (fromCode === CHAR_FORWARD_SLASH) lastCommonSep = i\n\t}\n\tif (i === length) {\n\t\tif (toLen > length) {\n\t\t\tif (StringPrototypeCharCodeAt(to, toStart + i) === CHAR_FORWARD_SLASH) {\n\t\t\t\t// We get here if `from` is the exact base path for `to`.\n\t\t\t\t// For example: from='/foo/bar'; to='/foo/bar/baz'\n\t\t\t\treturn StringPrototypeSlice(to, toStart + i + 1)\n\t\t\t}\n\t\t\tif (i === 0) {\n\t\t\t\t// We get here if `from` is the root\n\t\t\t\t// For example: from='/'; to='/foo'\n\t\t\t\treturn StringPrototypeSlice(to, toStart + i)\n\t\t\t}\n\t\t} else if (fromLen > length) {\n\t\t\tif (StringPrototypeCharCodeAt(from, fromStart + i) === CHAR_FORWARD_SLASH) {\n\t\t\t\t// We get here if `to` is the exact base path for `from`.\n\t\t\t\t// For example: from='/foo/bar/baz'; to='/foo/bar'\n\t\t\t\tlastCommonSep = i\n\t\t\t} else if (i === 0) {\n\t\t\t\t// We get here if `to` is the root.\n\t\t\t\t// For example: from='/foo/bar'; to='/'\n\t\t\t\tlastCommonSep = 0\n\t\t\t}\n\t\t}\n\t}\n\n\tlet out = \"\"\n\t// Generate the relative path based on the path difference between `to`\n\t// and `from`.\n\tfor (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {\n\t\tif (i === fromEnd || StringPrototypeCharCodeAt(from, i) === CHAR_FORWARD_SLASH) {\n\t\t\tout += out.length === 0 ? \"..\" : \"/..\"\n\t\t}\n\t}\n\n\t// Lastly, append the rest of the destination (`to`) path that comes after\n\t// the common path parts.\n\treturn `${out}${StringPrototypeSlice(to, toStart + lastCommonSep)}`\n}\n\nconst allowAboveRoot = false\nconst separator = \"/\"\nconst isPathSeparator = (code: number) => code === CHAR_FORWARD_SLASH\n\n/**\n * Ported from Node.js. This is an internal function of the `path` module. The\n * last three arguments are hard-coded above to fit our needs.\n *\n * https://github.com/nodejs/node/blob/dd52c05046bcc65746e26e2de65699dffcd454ee/lib/path.js#L66\n */\nfunction normalizeString(path: string) {\n\tlet res = \"\"\n\tlet lastSegmentLength = 0\n\tlet lastSlash = -1\n\tlet dots = 0\n\tlet code = 0\n\tfor (let i = 0; i <= path.length; ++i) {\n\t\tif (i < path.length) code = StringPrototypeCharCodeAt(path, i)\n\t\telse if (isPathSeparator(code)) break\n\t\telse code = CHAR_FORWARD_SLASH\n\n\t\tif (isPathSeparator(code)) {\n\t\t\tif (lastSlash === i - 1 || dots === 1) {\n\t\t\t\t// NOOP\n\t\t\t} else if (dots === 2) {\n\t\t\t\tif (\n\t\t\t\t\tres.length < 2 ||\n\t\t\t\t\tlastSegmentLength !== 2 ||\n\t\t\t\t\tStringPrototypeCharCodeAt(res, res.length - 1) !== CHAR_DOT ||\n\t\t\t\t\tStringPrototypeCharCodeAt(res, res.length - 2) !== CHAR_DOT\n\t\t\t\t) {\n\t\t\t\t\tif (res.length > 2) {\n\t\t\t\t\t\tconst lastSlashIndex = StringPrototypeLastIndexOf(res, separator)\n\t\t\t\t\t\tif (lastSlashIndex === -1) {\n\t\t\t\t\t\t\tres = \"\"\n\t\t\t\t\t\t\tlastSegmentLength = 0\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tres = StringPrototypeSlice(res, 0, lastSlashIndex)\n\t\t\t\t\t\t\tlastSegmentLength = res.length - 1 - StringPrototypeLastIndexOf(res, separator)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlastSlash = i\n\t\t\t\t\t\tdots = 0\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t} else if (res.length !== 0) {\n\t\t\t\t\t\tres = \"\"\n\t\t\t\t\t\tlastSegmentLength = 0\n\t\t\t\t\t\tlastSlash = i\n\t\t\t\t\t\tdots = 0\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (allowAboveRoot) {\n\t\t\t\t\tres += res.length > 0 ? `${separator}..` : \"..\"\n\t\t\t\t\tlastSegmentLength = 2\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (res.length > 0) res += `${separator}${StringPrototypeSlice(path, lastSlash + 1, i)}`\n\t\t\t\telse res = StringPrototypeSlice(path, lastSlash + 1, i)\n\t\t\t\tlastSegmentLength = i - lastSlash - 1\n\t\t\t}\n\t\t\tlastSlash = i\n\t\t\tdots = 0\n\t\t} else if (code === CHAR_DOT && dots !== -1) {\n\t\t\t++dots\n\t\t} else {\n\t\t\tdots = -1\n\t\t}\n\t}\n\treturn res\n}\n\n// #endregion\n", "// This is used in the tracking backend to count 404 pages, see:\n// https://github.com/framer/tinybird/blob/826b76e284c303270c3767517b6e7d8e1adbdaa0/endpoints/site_not_found_pages_ep.pipe#L26\nexport const customNotFoundPagePaths = new Set([`/404.html`, `/404`, `/404/`])\n\n// \"404\", \"404.html\"\nexport const customNotFoundPageSegments = /* @__PURE__ */ (() =>\n\tnew Set(Array.from(customNotFoundPagePaths).map(path => path.replaceAll(\"/\", \"\"))))()\n", "import { pathVariablesRegExpGlobal } from \"./pathVariables.ts\"\n\nexport function fillPathVariables(path: string, variables: Record<string, unknown>): string {\n\treturn path.replace(pathVariablesRegExpGlobal, (match, name) => {\n\t\tconst value = variables[name]\n\t\tif (typeof value !== \"string\" || value.length === 0) return match\n\t\treturn encodeURIComponent(value)\n\t})\n}\n", "import type { HistoryState } from \"./history.ts\"\n\n/**\n * \u26A0\uFE0F\n *\n * Please be careful about adding dependencies and non-shakable code[^1] to this file, as it's being used in\n * rewriteLinksWithQueryParams.ts, which ends up inlined into the published site's HTML!\n *\n * [^1]: As defined by esbuild, so probably more than you think: https://esbuild.github.io/api/#tree-shaking-and-side-effects\n */\n\n/**\n * Forwards query params from the current `location` URL to the given `href`, merging them if necessary.\n *\n * When merging, params in the `href` take precedence.\n *\n * When `history.state.queryParamBackAnchorSearch` is a string (pre-filter search), uses that instead\n * of `location.search` so links preserve only pre-filter params and not dynamic filter params.\n *\n * When `ignoreBackAnchor` is set, always uses `location.search` instead of `queryParamBackAnchorSearch`.\n * This is used for same-page hash navigation, which should keep active filter params.\n *\n * Safe for server-side rendering, in which case it'll return `href` as-is.\n */\nexport function forwardCurrentQueryParams(href: string, ignoreBackAnchor = false): string {\n\tlet queryParamsString = \"\"\n\tif (typeof window !== \"undefined\") {\n\t\tif (ignoreBackAnchor) {\n\t\t\tqueryParamsString = window.location.search\n\t\t} else {\n\t\t\tconst backAnchor = (window.history?.state as HistoryState | null)?.queryParamBackAnchorSearch\n\t\t\tif (backAnchor === undefined) {\n\t\t\t\tqueryParamsString = window.location.search\n\t\t\t} else {\n\t\t\t\tqueryParamsString = backAnchor === \"\" ? \"\" : `?${backAnchor}`\n\t\t\t}\n\t\t}\n\t}\n\tif (!queryParamsString) {\n\t\treturn href\n\t}\n\treturn forwardQueryParams(queryParamsString, href)\n}\n\nconst FRAMER_VARIANT_KEY = \"framer_variant\"\n\n/**\n * Forwards query params given by the `queryParamsString` to the given `href`, merging them if necessary.\n *\n * When merging, params in the `href` take precedence.\n *\n * @param queryParamsString Usually `window.location.search`, should include the leading `?` if not empty\n */\nexport function forwardQueryParams(queryParamsString: string, href: string): string {\n\tconst startOfHash = href.indexOf(\"#\")\n\tconst hrefWithoutHash = startOfHash === -1 ? href : href.substring(0, startOfHash)\n\tconst hash = startOfHash === -1 ? \"\" : href.substring(startOfHash)\n\n\tconst startOfSearch = hrefWithoutHash.indexOf(\"?\")\n\tconst baseUrl = startOfSearch === -1 ? hrefWithoutHash : hrefWithoutHash.substring(0, startOfSearch)\n\tconst searchString = startOfSearch === -1 ? \"\" : hrefWithoutHash.substring(startOfSearch)\n\n\t// Merge current params into new params, skipping duplicates and `framer_variant`\n\tconst newSearchParams = new URLSearchParams(searchString)\n\tconst currentSearchParams = new URLSearchParams(queryParamsString)\n\tfor (const [key, value] of currentSearchParams) {\n\t\tif (newSearchParams.has(key)) continue\n\t\tif (key === FRAMER_VARIANT_KEY) continue\n\t\tnewSearchParams.append(key, value)\n\t}\n\n\tconst newSearchString = newSearchParams.toString()\n\tif (newSearchString === \"\") {\n\t\treturn hrefWithoutHash + hash\n\t}\n\n\treturn baseUrl + \"?\" + newSearchString + hash\n}\n", "import type { CollectionUtilsCacheContextValue } from \"../modules/cms/CollectionUtilsCache.tsx\"\nimport { isPromise, isString } from \"../utils/utils.ts\"\nimport { forwardCurrentQueryParams } from \"./forwardQueryParams.ts\"\nimport { pathVariablesRegExpGlobal } from \"./pathVariables.ts\"\nimport type { Locale, Route } from \"./types.ts\"\n\nexport interface GetLocalizedNavigationPathResult {\n\tpath: string | undefined\n\tpathVariables: Record<string, unknown> | undefined\n\t// If a slug is missing for a locale, it is hidden for the locale a\n\t// user is switching to. We keep track of this to detect any redirects later\n\tisMissingInLocale: boolean\n}\n\n/**\n * Replaces path variables in a path with their (potentially) localized counterparts\n */\nasync function replacePathVariables(\n\tpath: string,\n\tcurrentLocale: Locale | null,\n\tnextLocale: Locale,\n\tdefaultLocale: Locale | undefined,\n\tcollectionId: string,\n\tpathVariables: Record<string, unknown>,\n\tcollectionUtils: CollectionUtilsCacheContextValue,\n): Promise<GetLocalizedNavigationPathResult> {\n\tlet resultPath = path\n\tlet isMissingInLocale: boolean = false\n\n\tconst resultPathVariables = { ...pathVariables }\n\n\tconst matches = Array.from(resultPath.matchAll(pathVariablesRegExpGlobal))\n\n\t// Collect replacements for all pathVariables first\n\tconst replacements = await Promise.all(\n\t\tmatches.map(async match => {\n\t\t\tconst pathVariableWithDelimiter = match?.[0]\n\t\t\tconst pathVariableValue = match?.[1]\n\n\t\t\tif (!pathVariableWithDelimiter || !pathVariableValue) {\n\t\t\t\tthrow new Error(\"Failed to replace path variables: unexpected regex match group\")\n\t\t\t}\n\n\t\t\tconst currentSlug = pathVariables[pathVariableValue]\n\t\t\tif (!currentSlug || !isString(currentSlug)) {\n\t\t\t\tthrow new Error(`No slug found for path variable ${pathVariableValue}`)\n\t\t\t}\n\n\t\t\tconst utils = collectionUtils?.get(collectionId)\n\t\t\tif (!utils || !currentLocale) {\n\t\t\t\treturn currentSlug\n\t\t\t}\n\n\t\t\tconst maybeRecordId = utils.getRecordIdBySlug(currentSlug, currentLocale)\n\t\t\tconst recordId = isPromise(maybeRecordId) ? await maybeRecordId : maybeRecordId\n\t\t\tif (!recordId) return currentSlug\n\n\t\t\tconst maybeNextSlug = utils.getSlugByRecordId(recordId, nextLocale)\n\t\t\tconst nextSlug = isPromise(maybeNextSlug) ? await maybeNextSlug : maybeNextSlug\n\t\t\tif (!nextSlug) {\n\t\t\t\tisMissingInLocale = true\n\t\t\t\tconst maybeDefaultLocaleSlug = utils.getSlugByRecordId(recordId, defaultLocale)\n\t\t\t\tconst defaultLocaleSlug = isPromise(maybeDefaultLocaleSlug)\n\t\t\t\t\t? await maybeDefaultLocaleSlug\n\t\t\t\t\t: maybeDefaultLocaleSlug\n\t\t\t\tif (defaultLocaleSlug) {\n\t\t\t\t\tresultPathVariables[pathVariableValue] = defaultLocaleSlug\n\t\t\t\t}\n\n\t\t\t\treturn defaultLocaleSlug ?? currentSlug\n\t\t\t}\n\n\t\t\tresultPathVariables[pathVariableValue] = nextSlug\n\n\t\t\treturn nextSlug\n\t\t}),\n\t)\n\n\tlet lastIndex = 0\n\tlet replacedPath = \"\"\n\tlet hasMatch = false\n\n\t// Apply the replacements\n\tfor (let i = 0; i < matches.length; i++) {\n\t\tconst match = matches[i]\n\t\tconst replacement = replacements[i]\n\n\t\tif (!match || !replacement) continue\n\n\t\treplacedPath += resultPath.substring(lastIndex, match.index)\n\t\tlastIndex = (match.index ?? 0) + (match[0]?.length ?? 0)\n\n\t\treplacedPath += replacements[i]\n\t\thasMatch = true\n\t}\n\n\tif (hasMatch) {\n\t\t// Add any remaining text after the last variable\n\t\treplacedPath += resultPath.substring(lastIndex)\n\n\t\tresultPath = replacedPath\n\t}\n\n\treturn {\n\t\tpath: resultPath,\n\t\tpathVariables: resultPathVariables,\n\t\tisMissingInLocale,\n\t}\n}\n\ntype CurrentLocale = Locale\ntype NextLocale = Locale\n\nexport interface GetNavigationPathOptions {\n\tdefaultLocale: Locale | undefined\n\tcurrentLocale: CurrentLocale | null\n\tnextLocale: NextLocale\n\troute: Route\n\trouteId: string\n\tpathVariables: Record<string, unknown> | undefined\n\tcollectionUtils: CollectionUtilsCacheContextValue\n\tpreserveQueryParams: boolean | undefined\n}\n\n/**\n * Generates a new path and its associated pathVariables for navigation to the\n * next locale. This is needed because slug translation can result in different\n * paths for different locales.\n */\nexport async function getLocalizedNavigationPath({\n\tcurrentLocale,\n\tnextLocale,\n\tdefaultLocale,\n\troute,\n\tpathVariables,\n\tcollectionUtils,\n\tpreserveQueryParams,\n}: GetNavigationPathOptions): Promise<GetLocalizedNavigationPathResult> {\n\tconst { path: basePath, pathLocalized } = route\n\n\tconst path = pathLocalized?.[nextLocale.id] ?? basePath\n\n\tlet result: GetLocalizedNavigationPathResult = {\n\t\tpath,\n\t\tpathVariables,\n\t\tisMissingInLocale: false,\n\t}\n\n\tif (!path) return result\n\n\tif (pathVariables && route.collectionId) {\n\t\ttry {\n\t\t\tconst pathReplacement = await replacePathVariables(\n\t\t\t\tpath,\n\t\t\t\tcurrentLocale,\n\t\t\t\tnextLocale,\n\t\t\t\tdefaultLocale,\n\t\t\t\troute.collectionId,\n\t\t\t\tpathVariables,\n\t\t\t\tcollectionUtils,\n\t\t\t)\n\n\t\t\tresult = pathReplacement\n\t\t} catch {\n\t\t\t// Don't act and stay on the same route if we fail to replace the path variables\n\t\t\t// TODO: tracking?\n\t\t}\n\t}\n\n\tif (nextLocale.slug) {\n\t\tresult.path = \"/\" + nextLocale.slug + result.path\n\t}\n\n\tif (preserveQueryParams && result.path) {\n\t\tresult.path = forwardCurrentQueryParams(result.path, true)\n\t}\n\n\treturn result\n}\n", "/**\n * If this site is hosted (reverse-proxied) at a prefix, e.g., https://www.framer.com/sites, and the user is visiting\n * the site as such (as opposed to, e.g., accessing the site via its staging domain), returns that prefix, e.g., /sites,\n * always without a trailing slash. Otherwise, returns an empty string. Note that the last two qualities mean you can\n * trivially concatenate the result with a route path (which always starts with a slash) to get the full path.\n *\n * Because we use the canonical URL to determine the prefix, it requires it to be configured correctly (via custom AKA\n * advanced canonical URL) for reverse-proxied sites.\n */\nexport function getSitePrefix(siteCanonicalURL: string | undefined): string {\n\tif (!siteCanonicalURL) return \"\"\n\n\tlet url: URL\n\ttry {\n\t\turl = new URL(siteCanonicalURL)\n\t} catch {\n\t\treturn \"\"\n\t}\n\n\tif (url.pathname === \"/\" || window.location.origin !== url.origin) return \"\"\n\n\treturn url.pathname.endsWith(\"/\") ? url.pathname.slice(0, -1) : url.pathname\n}\n", "import { useCallback, useEffect, useRef } from \"react\"\nimport { usePageEffects } from \"./PageEffectsContext.tsx\"\nimport { getPageEffectForRoute } from \"./getPageEffect.ts\"\nimport type { ViewTransition } from \"./viewTransition.ts\"\nimport { startViewTransition } from \"./viewTransition.ts\"\n\nexport function useViewTransition(): (\n\tcurrentRouteId: string,\n\tnextRouteId: string,\n\tupdate: VoidFunction,\n\tsignal?: AbortSignal,\n) => Promise<ViewTransition | undefined> | ViewTransition | undefined {\n\tconst sitePageEffects = usePageEffects()\n\n\tconst resolveHasPainted = useRef<VoidFunction | undefined>(undefined)\n\tuseEffect(() => {\n\t\tif (resolveHasPainted.current) {\n\t\t\tresolveHasPainted.current()\n\t\t\tresolveHasPainted.current = undefined\n\t\t}\n\t})\n\n\treturn useCallback(\n\t\t(currentRouteId, nextRouteId, update, signal): Promise<ViewTransition | undefined> | undefined => {\n\t\t\tconst pageEffect = getPageEffectForRoute(currentRouteId, nextRouteId, sitePageEffects)\n\t\t\tif (pageEffect) {\n\t\t\t\tconst hasPainted = new Promise<void>(resolve => {\n\t\t\t\t\tresolveHasPainted.current = resolve\n\t\t\t\t})\n\n\t\t\t\treturn startViewTransition(\n\t\t\t\t\tasync () => {\n\t\t\t\t\t\tupdate()\n\t\t\t\t\t\tawait hasPainted\n\t\t\t\t\t},\n\t\t\t\t\tpageEffect,\n\t\t\t\t\tsignal,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tupdate()\n\t\t},\n\t\t[sitePageEffects],\n\t)\n}\n", "import React from \"react\"\nimport type { PageEffect, RoutePageEffects } from \"./types.ts\"\n\nexport interface SitePageEffects {\n\tglobal: PageEffect | undefined\n\troutes: {\n\t\t[routeId: string]: RoutePageEffects\n\t}\n}\n\nconst defaultSitePageEffects = { global: undefined, routes: {} }\n\nexport const PageEffectsContext = /* @__PURE__ */ React.createContext<SitePageEffects>(defaultSitePageEffects)\n\nexport function PageEffectsProvider({ children, value }: React.PropsWithChildren<{ value: SitePageEffects }>) {\n\treturn <PageEffectsContext.Provider value={value}>{children}</PageEffectsContext.Provider>\n}\n\nexport function usePageEffects() {\n\treturn React.useContext(PageEffectsContext)\n}\n", "import type { SitePageEffects } from \"./PageEffectsContext.tsx\"\nimport type { PageEffect } from \"./types.ts\"\n\nexport function getPageEffectForRoute(\n\tcurrentRouteId: string,\n\tnextRouteId: string,\n\t{ global, routes }: SitePageEffects,\n): PageEffect | undefined {\n\treturn routes[currentRouteId]?.[nextRouteId] || global\n}\n", "export interface AnimationState<V> {\n\tvalue: V\n\tdone: boolean\n}\n\nexport interface KeyframeGenerator<V> {\n\tnext: (t: number) => AnimationState<V>\n}\n\nconst step = 10 // ms\nconst maxDuration = 10000 // ms\nexport function createLinearEasing(generator: KeyframeGenerator<number>) {\n\tlet time = step\n\tlet state = generator.next(0)\n\tconst keyframes = [state.value]\n\n\twhile (!state.done && time < maxDuration) {\n\t\tstate = generator.next(time)\n\t\tkeyframes.push(state.value)\n\t\ttime += step\n\t}\n\n\t/**\n\t * If generating an animation that didn't actually move,\n\t * generate a second keyframe so we have an origin and target.\n\t */\n\tif (keyframes.length === 1) keyframes.push(state.value)\n\n\treturn {\n\t\teasing: `linear(${keyframes.join(\",\")})`,\n\t\tduration: time - step,\n\t}\n}\n", "import type { BlindsMask, CircleMask, ConicMask, InsetMask, Mask, PageTransitionUnit, WipeMask } from \"../types.ts\"\n\nexport interface MaskGenerator<MaskType = Mask> {\n\tmakeKeyframe?: (mask: Mask & MaskType, progress: \"start\" | \"end\", page: \"exit\" | \"enter\") => string\n\tmakeStyles?: (mask: Mask & MaskType, page: \"exit\" | \"enter\") => string\n\tmakePropertyRules?: (mask: Mask & MaskType) => string\n}\n\nconst cssVariable = (name: string) => `--view-transition-${name}`\n\nfunction parseUnit(value: PageTransitionUnit): [number, \"%\" | \"px\"] {\n\treturn [parseFloat(value), value.endsWith(\"px\") ? \"px\" : \"%\"]\n}\n\nfunction calcMaskPosition(mask: InsetMask | CircleMask) {\n\tconst { innerWidth, innerHeight } = window\n\n\tconst [x, xUnit] = parseUnit(mask.x)\n\tconst [y, yUnit] = parseUnit(mask.y)\n\n\treturn {\n\t\tx: xUnit === \"px\" ? x : innerWidth * (x / 100),\n\t\ty: yUnit === \"px\" ? y : innerHeight * (y / 100),\n\t}\n}\n\nconst conic: MaskGenerator<ConicMask> = {\n\tmakeKeyframe: (mask, progress, page) => {\n\t\tlet percentage = 0\n\n\t\tif (\n\t\t\t(page === \"exit\" && mask.angularDirection === \"clockwise\" && progress === \"start\") ||\n\t\t\t(page === \"exit\" && mask.angularDirection === \"counter-clockwise\" && progress === \"end\") ||\n\t\t\t(page === \"enter\" && mask.angularDirection === \"counter-clockwise\" && progress === \"start\") ||\n\t\t\t(page === \"enter\" && mask.angularDirection === \"clockwise\" && progress === \"end\")\n\t\t) {\n\t\t\tpercentage = (mask.sweepAngle / 360) * 100\n\t\t}\n\n\t\treturn `${cssVariable(\"conic-offset\")}: ${percentage}%;`\n\t},\n\tmakeStyles: (mask, page) => {\n\t\tconst offsetToken = `var(${cssVariable(\"conic-offset\")})`\n\t\tconst isTransparentToBlack =\n\t\t\t(page === \"exit\" && mask.angularDirection === \"clockwise\") ||\n\t\t\t(page === \"enter\" && mask.angularDirection === \"counter-clockwise\")\n\t\tconst firstColor = isTransparentToBlack ? \"transparent\" : \"black\"\n\t\tconst secondColor = isTransparentToBlack ? \"black\" : \"transparent\"\n\n\t\tlet gradient = `conic-gradient(from `\n\t\tgradient += `${mask.angle}deg at ${mask.x} ${mask.y}, `\n\t\tgradient += `${firstColor} 0%, ${firstColor} ${offsetToken}, `\n\t\tgradient += `${secondColor} ${offsetToken}, ${secondColor} 100%)`\n\n\t\treturn `mask-image: ${gradient}; -webkit-mask-image: ${gradient};`\n\t},\n\tmakePropertyRules: () => `\n        @property ${cssVariable(\"conic-offset\")} {\n            syntax: '<percentage>';\n            initial-value: 0%;\n            inherits: false;\n        }\n    `,\n}\n\nconst circle: MaskGenerator<CircleMask> = {\n\tmakeKeyframe: (mask, progress) => {\n\t\tconst { x, y } = calcMaskPosition(mask)\n\t\tif (progress === \"start\") {\n\t\t\treturn `clip-path: circle(0 at ${x}px ${y}px);`\n\t\t} else {\n\t\t\tconst endRadius = Math.hypot(Math.max(x, window.innerWidth - x), Math.max(y, window.innerHeight - y))\n\t\t\treturn `clip-path: circle(${endRadius}px at ${x}px ${y}px);`\n\t\t}\n\t},\n}\n\nconst inset: MaskGenerator<InsetMask> = {\n\tmakeKeyframe: (mask, progress) => {\n\t\tconst { x, y } = calcMaskPosition(mask)\n\t\tconst bottom = window.innerHeight - y\n\t\tconst right = window.innerWidth - x\n\n\t\treturn progress === \"start\"\n\t\t\t? `clip-path: inset(${y}px ${right}px ${bottom}px ${x}px round ${mask.round}px);`\n\t\t\t: `clip-path: inset(0 round 0);`\n\t},\n}\n\nconst blinds: MaskGenerator<BlindsMask> = {\n\tmakeKeyframe: (mask, progress, page) => {\n\t\tconst [, unit] = parseUnit(mask.width)\n\t\tlet width = `0${unit}`\n\n\t\tif ((progress === \"start\" && page === \"exit\") || (progress === \"end\" && page === \"enter\")) {\n\t\t\twidth = mask.width\n\t\t}\n\n\t\treturn `${cssVariable(\"blinds-width\")}: ${width};`\n\t},\n\tmakeStyles: (mask, page) => {\n\t\tconst widthToken = `var(${cssVariable(\"blinds-width\")})`\n\t\tconst firstColor = page === \"exit\" ? \"transparent\" : \"black\"\n\t\tconst secondColor = page === \"exit\" ? \"black\" : \"transparent\"\n\n\t\tlet gradient = `repeating-linear-gradient(`\n\t\tgradient += mask.angle + 90 + \"deg, \"\n\t\tgradient += `${firstColor} 0px, ${firstColor} ${widthToken}, `\n\t\tgradient += `${secondColor} ${widthToken}, ${secondColor} ${mask.width})`\n\n\t\treturn `mask-image: ${gradient}; -webkit-mask-image: ${gradient};`\n\t},\n\tmakePropertyRules: () => {\n\t\treturn `\n            @property ${cssVariable(\"blinds-width\")} {\n                syntax: '<length-percentage>';\n                initial-value: 0px;\n                inherits: false;\n            }\n        `\n\t},\n}\n\nconst wipe: MaskGenerator<WipeMask> = {\n\tmakeKeyframe: (_mask, progress, page) => {\n\t\tconst offset = (progress === \"start\" && page === \"exit\") || (progress === \"end\" && page === \"enter\") ? 1 : 0\n\t\treturn `${cssVariable(\"wipe-offset\")}: ${offset};`\n\t},\n\tmakeStyles: (mask, page) => {\n\t\tconst offsetToken = `var(${cssVariable(\"wipe-offset\")})`\n\t\tconst firstColor = page === \"exit\" ? \"transparent\" : \"black\"\n\t\tconst secondColor = page === \"exit\" ? \"black\" : \"transparent\"\n\n\t\tlet gradient = `linear-gradient(`\n\t\tgradient += mask.angle + 90 + \"deg, \"\n\n\t\tgradient += `${firstColor} calc(calc(0% - ${mask.width}) + calc(calc(100% + ${mask.width}) * ${offsetToken})), `\n\t\tgradient += `${secondColor} calc(calc(100% + ${mask.width}) * ${offsetToken}))`\n\n\t\treturn `mask-image: ${gradient}; -webkit-mask-image: ${gradient};`\n\t},\n\tmakePropertyRules: () => {\n\t\treturn `\n            @property ${cssVariable(\"wipe-offset\")} {\n                syntax: '<number>';\n                initial-value: 0;\n                inherits: false;\n            }\n        `\n\t},\n}\n\nexport const maskGenerators = { circle, conic, inset, blinds, wipe } as const\n", "import { spring } from \"framer-motion\"\nimport type { Mask, PageTransition } from \"../types.ts\"\nimport { createLinearEasing } from \"./linearEasing.ts\"\nimport type { MaskGenerator } from \"./masks.ts\"\nimport { maskGenerators } from \"./masks.ts\"\n\nexport type TransitionValues = Omit<PageTransition, \"transition\" | \"rotate3d\">\n\nconst restState: TransitionValues = {\n\topacity: 1,\n\tx: \"0px\",\n\ty: \"0px\",\n\tscale: 1,\n\trotate: 0,\n\trotateX: 0,\n\trotateY: 0,\n\tmask: undefined,\n}\n\nexport function valuesToCSSKeyframes(\n\tvalues: TransitionValues,\n\tprogress: \"start\" | \"end\",\n\tpage: \"exit\" | \"enter\",\n\tmaskGenerator?: MaskGenerator<typeof values.mask>,\n) {\n\tlet keyframes = `\n      opacity: ${values.opacity};\n      transform: translate(${values.x}, ${values.y}) scale(${values.scale}) rotateX(${values.rotateX}deg) rotateY(${values.rotateY}deg) rotateZ(${values.rotate}deg);\n    `\n\n\tif (values.mask) {\n\t\tkeyframes += maskGenerator?.makeKeyframe?.(values.mask, progress, page) || \"\"\n\t}\n\n\treturn keyframes\n}\n\nfunction getMaskGenerator<T extends Mask[\"type\"]>(type?: T): undefined | MaskGenerator<Extract<Mask, { type: T }>> {\n\treturn type ? maskGenerators[type] : undefined\n}\n\nexport function createPageTransitionRules(page: \"enter\" | \"exit\", { transition, ...values }: PageTransition): string {\n\tconst name = \"view-transition-\" + page\n\tconst settings = { duration: \"0s\", easing: \"linear\" }\n\n\tif (transition.type === \"tween\") {\n\t\tsettings.duration = transition.duration + \"s\"\n\t\tsettings.easing = `cubic-bezier(${transition.ease.join(\",\")})`\n\t} else if (isSpringTransition(transition)) {\n\t\tconst { easing, duration } = createLinearEasing(\n\t\t\tspring({\n\t\t\t\tkeyframes: [0, 1],\n\t\t\t\t...getSpringOptions(transition),\n\t\t\t\trestDelta: 0.001,\n\t\t\t\trestSpeed: 0.0001,\n\t\t\t}),\n\t\t)\n\n\t\tsettings.duration = duration + \"ms\"\n\t\tsettings.easing = easing\n\t}\n\n\tconst maskGenerator = getMaskGenerator(values?.mask?.type)\n\n\tlet startKeyframes = valuesToCSSKeyframes(values, \"start\", page, maskGenerator)\n\tlet endKeyframes = valuesToCSSKeyframes({ ...restState, mask: values.mask }, \"end\", page, maskGenerator)\n\n\tif (page === \"exit\") {\n\t\t;[startKeyframes, endKeyframes] = [endKeyframes, startKeyframes]\n\t}\n\n\treturn `\n        ${values.mask && maskGenerator?.makePropertyRules ? maskGenerator.makePropertyRules(values.mask) : \"\"}\n\n        @keyframes ${name} {\n            0% {\n                ${startKeyframes}\n            }\n\n            100% {\n                ${endKeyframes}\n            }\n        }\n\n        ::view-transition-${page === \"enter\" ? \"new\" : \"old\"}(root) {\n            animation-name: ${name};\n            animation-duration: ${settings.duration};\n            animation-delay: ${transition.delay}s;\n            animation-timing-function: ${settings.easing};\n            animation-fill-mode: both;\n            ${values.mask && maskGenerator?.makeStyles ? maskGenerator.makeStyles(values.mask, page) : \"\"}\n        }\n    `\n}\n\nfunction isSpringTransition(\n\ttransition: PageTransition[\"transition\"],\n): transition is PageTransition[\"transition\"] & { type: \"spring\" } {\n\treturn transition.type === \"spring\"\n}\n\nfunction getSpringOptions(transition: PageTransition[\"transition\"] & { type: \"spring\" }) {\n\tif (transition.durationBasedSpring) {\n\t\treturn {\n\t\t\tduration: transition.duration * 1000,\n\t\t\tbounce: transition.bounce,\n\t\t}\n\t}\n\n\treturn {\n\t\tstiffness: transition.stiffness,\n\t\tdamping: transition.damping,\n\t\tmass: transition.mass,\n\t}\n}\n", "import { frame } from \"framer-motion\"\nimport { requestIdleCallback } from \"../../../utils/utils.ts\"\nimport type { PageEffect, PageTransition } from \"../types.ts\"\nimport { createPageTransitionRules } from \"./page.ts\"\n\nconst VIEW_TRANSITION_STYLES_ID = \"view-transition-styles\"\n\nconst defaultPageTransition: PageTransition = {\n\tx: \"0px\",\n\ty: \"0px\",\n\tscale: 1,\n\topacity: 1,\n\trotate3d: false,\n\trotate: 0,\n\trotateX: 0,\n\trotateY: 0,\n\tmask: undefined,\n\ttransition: {\n\t\ttype: \"tween\",\n\t\tdelay: 0,\n\t\tduration: 0.2,\n\t\tease: [0.27, 0, 0.51, 1],\n\t\tstiffness: 400,\n\t\tdamping: 30,\n\t\tmass: 1,\n\t},\n}\n\nexport function createViewTransitionStylesheet({ exit = defaultPageTransition, enter }: PageEffect) {\n\tconst styleElement = document.createElement(\"style\")\n\tstyleElement.id = VIEW_TRANSITION_STYLES_ID\n\n\tlet styleContent = `\n        @media (prefers-reduced-motion) {\n            ::view-transition-group(*),\n            ::view-transition-old(*),\n            ::view-transition-new(*) {\n                animation: none !important;\n            }\n        }\n    `\n\n\t/**\n\t * mix-blend-mode: plus-lighter allows the crossfade of two elements without\n\t * dips in overall luminence. But is unnecessary or looks unpleasent when\n\t * combined with masks, when there's no crossfade, or if the crossfading element\n\t * animations are offset by delay.\n\t */\n\tconst disableMixPlusLighter =\n\t\texit.mask || enter.mask || exit.opacity || enter.opacity || exit.transition.delay || enter.transition.delay\n\n\tif (disableMixPlusLighter) {\n\t\tstyleContent += `\n            ::view-transition-old(*),\n            ::view-transition-new(*) {\n                mix-blend-mode: normal;\n            }\n        `\n\t}\n\n\t/**\n\t * Disable backface visibility to better support 3D rotate.\n\t */\n\tstyleContent += `\n        ::view-transition-old(*),\n        ::view-transition-new(*) {\n            backface-visibility: hidden;\n        }\n    `\n\n\tstyleContent += createPageTransitionRules(\"exit\", exit)\n\tstyleContent += createPageTransitionRules(\"enter\", enter)\n\tstyleElement.textContent = styleContent\n\tdocument.head.appendChild(styleElement)\n}\n\nexport function removeViewTransitionStylesheet() {\n\trequestIdleCallback(() => {\n\t\tframe.render(() => {\n\t\t\tperformance.mark(\"framer-vt-remove\")\n\t\t\tconst element = document.getElementById(VIEW_TRANSITION_STYLES_ID)\n\t\t\tif (element) {\n\t\t\t\tdocument.head.removeChild(element)\n\t\t\t}\n\t\t})\n\t})\n}\n", "import { frame } from \"framer-motion\"\nimport { createViewTransitionStylesheet, removeViewTransitionStylesheet } from \"./cssGeneration/index.ts\"\nimport type { PageEffect } from \"./types.ts\"\n\nexport type UpdateView = () => void | Promise<void>\n\nexport interface ViewTransition {\n\tfinished: Promise<void>\n\tready: Promise<void>\n\tupdateCallbackDone: Promise<void>\n\tskipTransition: () => void\n}\n\nconst noop = () => {}\n\nexport function supportsViewTransitions() {\n\t// eslint-disable-next-line framer-studio/tscompat -- We check for support here.\n\treturn Boolean(document.startViewTransition)\n}\n\nexport function addVTStylesheetAfterInRender(effect: PageEffect) {\n\treturn new Promise<void>(resolve => {\n\t\tframe.render(() => {\n\t\t\t// we wrap this in a rAF, as it writes to DOM.\n\t\t\tperformance.mark(\"framer-vt-style\")\n\t\t\tcreateViewTransitionStylesheet(effect)\n\t\t\tresolve()\n\t\t})\n\t})\n}\n\nexport async function startViewTransition(\n\tupdateView: UpdateView,\n\teffect: PageEffect,\n\tsignal?: AbortSignal,\n): Promise<ViewTransition | undefined> {\n\tif (!supportsViewTransitions()) {\n\t\tvoid updateView()\n\t\treturn\n\t}\n\t/* eslint-disable framer-studio/tscompat -- We check for support above. */\n\n\t// batch style recalcs caused by the DOM insert of styles\n\tawait addVTStylesheetAfterInRender(effect)\n\tif (signal?.aborted) return\n\n\tperformance.mark(\"framer-vt\")\n\tconst transition = document.startViewTransition(async () => {\n\t\tperformance.mark(\"framer-vt-freeze\")\n\n\t\tif (signal?.aborted) return\n\t\t// we can skip the view transition (React render is already on-going)\n\t\telse signal?.addEventListener(\"abort\", () => transition.skipTransition())\n\n\t\tawait updateView()\n\t})\n\n\ttransition.updateCallbackDone\n\t\t.then(() => {\n\t\t\tperformance.mark(\"framer-vt-unfreeze\")\n\t\t})\n\t\t.catch(noop)\n\n\tPromise.all([transition.ready, transition.finished])\n\t\t.then(() => {\n\t\t\tperformance.mark(\"framer-vt-finished\")\n\t\t\tremoveViewTransitionStylesheet()\n\t\t})\n\t\t// Catch the transition so that if it fails to prepare or to finish\n\t\t// there won't be a fail state or blocking error.\n\t\t.catch(noop)\n\n\treturn transition\n}\n", "import { requestIdleCallback } from \"../utils/utils.ts\"\n\n/**\n * Updated the canonical meta tag, so that browsers use the correct URL for the share sheet - https://github.com/framer/company/issues/29317\n */\nexport function updateCanonicalURL(url: string, prevUrl?: string) {\n\trequestIdleCallback(() => {\n\t\tconst canonical = document.querySelector(\"link[rel='canonical']\")\n\t\tif (!canonical) return\n\t\tconst newURL = new URL(url, prevUrl)\n\t\tnewURL.search = \"\"\n\t\tcanonical.setAttribute(\"href\", newURL.toString())\n\t})\n}\n\n// eslint-disable-next-line spaced-comment -- license comment\n//! Credit to Astro | MIT License\nlet announceDiv: HTMLDivElement | undefined\nexport const announceNavigation = () => {\n\tif (!announceDiv) {\n\t\tannounceDiv = document.createElement(\"div\")\n\t\tannounceDiv.setAttribute(\"aria-live\", \"assertive\")\n\t\tannounceDiv.setAttribute(\"aria-atomic\", \"true\")\n\n\t\t// from https://www.scottohara.me/blog/2023/03/21/visually-hidden-hack.html\n\t\tannounceDiv.style.position = \"absolute\"\n\t\tannounceDiv.style.transform = \"scale(0)\"\n\n\t\tdocument.body.append(announceDiv)\n\t}\n\n\tsetTimeout(() => {\n\t\t// biome-ignore lint/style/noNonNullAssertion: we create announceDiv above\n\t\tannounceDiv!.textContent = document.title\n\n\t\t// Much thought went into this magic number; the gist is that screen readers\n\t\t// need to see that the element changed and might not do so if it happens\n\t\t// too quickly.\n\t}, 60)\n}\n", "import { useCallback, useRef } from \"react\"\nimport { useAfterPaintEffect } from \"../utils/useAfterPaintEffect.ts\"\n\nexport type MonitorNextPaintAfterRender<T> = (measureDetail?: T) => {\n\tpromise: Promise<void>\n\tmeasureDetail: T | undefined\n\tignore: VoidFunction | null\n}\n\n/**\n * Monitor the length of time it takes for the component to rerender and paint.\n */\nexport function useMonitorNextPaintAfterRender<T>(label: string): MonitorNextPaintAfterRender<T> {\n\tconst resolveHasPainted = useRef<VoidFunction | undefined>(undefined)\n\tuseAfterPaintEffect(\n\t\t() => {\n\t\t\tif (resolveHasPainted.current) {\n\t\t\t\tresolveHasPainted.current()\n\t\t\t\tresolveHasPainted.current = undefined\n\t\t\t}\n\t\t},\n\t\tundefined,\n\t\t// user-blocking ensures we get the correct timings here. Other priorities might delay this effect a little bit.\n\t\t{ priority: \"user-blocking\" },\n\t)\n\n\treturn useCallback<MonitorNextPaintAfterRender<T>>(\n\t\tmeasureDetail => {\n\t\t\tconst hasPainted = new Promise<void>(resolve => {\n\t\t\t\tresolveHasPainted.current = resolve\n\t\t\t})\n\n\t\t\tif (!label) return { promise: hasPainted, measureDetail, ignore: null }\n\n\t\t\tconst startLabel = `${label}-start`\n\t\t\tconst endLabel = `${label}-end`\n\t\t\tlet ignore = false\n\n\t\t\tperformance.mark(startLabel)\n\t\t\thasPainted\n\t\t\t\t.finally(() => {\n\t\t\t\t\t// we explicitly don't clear the previous startLabel here, as perf.measure always uses the latest startLabel anyway\n\t\t\t\t\tif (ignore) return\n\n\t\t\t\t\tperformance.mark(endLabel)\n\t\t\t\t\tperformance.measure(label, {\n\t\t\t\t\t\tstart: startLabel,\n\t\t\t\t\t\tend: endLabel,\n\t\t\t\t\t\tdetail: measureDetail,\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t\t.catch(e => {\n\t\t\t\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\t\t\t\tconsole.error(e)\n\t\t\t\t})\n\n\t\t\treturn {\n\t\t\t\tpromise: hasPainted,\n\t\t\t\tmeasureDetail,\n\t\t\t\tignore: () => {\n\t\t\t\t\tignore = true\n\t\t\t\t\tresolveHasPainted.current?.()\n\t\t\t\t\tresolveHasPainted.current = undefined\n\t\t\t\t},\n\t\t\t}\n\t\t},\n\t\t[label],\n\t)\n}\n", "import { useLayoutEffect } from \"react\"\nimport { yieldToMain } from \"./yield.ts\"\nimport type { YieldOptions } from \"./yield.ts\"\n\n/**\n * Runs `fn` after the next paint. Similar to `useEffect`, but guarantees to run after the next paint (both cleanup and effect).\n * @see https://thoughtspile.github.io/2021/11/15/unintentional-layout-effect/ - use this when effects run after state updates in event handlers\n *\n * @param useEffectFn pass `useEffect` for less important updates (those will mostly run after the 2nd paint instead)\n */\nexport function useAfterPaintEffect(\n\teffectFn: Parameters<typeof useLayoutEffect>[0],\n\tdeps: Parameters<typeof useLayoutEffect>[1],\n\toptions?: YieldOptions,\n\tuseEffectFn = useLayoutEffect,\n) {\n\tuseEffectFn(() => {\n\t\tconst runAfterPaint = async (fn: typeof effectFn | (() => void)) => {\n\t\t\tawait yieldToMain({ ...options, continueAfter: \"paint\" })\n\t\t\treturn fn()\n\t\t}\n\t\tconst runPromise = runAfterPaint(effectFn)\n\n\t\treturn () => {\n\t\t\tvoid (async () => {\n\t\t\t\tconst cleanup = await runPromise\n\t\t\t\tif (!cleanup) return\n\t\t\t\tvoid runAfterPaint(cleanup)\n\t\t\t})()\n\t\t}\n\t}, deps)\n}\n", "import { useCallback, useContext } from \"react\"\nimport { useRouter } from \"../router/RouterContext.tsx\"\nimport { type PageviewEventData, isValidTrackingId, sendTrackingEvent } from \"../utils/sendTrackingEvent.ts\"\nimport { trimDashes } from \"../utils/slugify.ts\"\nimport { NodeIdContext } from \"./NodeIdContext.tsx\"\n\nconst nonSlugCharactersRegExp = /[^\\p{Letter}\\p{Number}()]+/gu\nexport function getTrackingId(value: string): string {\n\treturn trimDashes(value.toLowerCase().replace(nonSlugCharactersRegExp, \"-\"))\n}\n\n/**\n * @public\n */\ntype AlphaNumericChar =\n\t| \"a\"\n\t| \"b\"\n\t| \"c\"\n\t| \"d\"\n\t| \"e\"\n\t| \"f\"\n\t| \"g\"\n\t| \"h\"\n\t| \"i\"\n\t| \"j\"\n\t| \"k\"\n\t| \"l\"\n\t| \"m\"\n\t| \"n\"\n\t| \"o\"\n\t| \"p\"\n\t| \"q\"\n\t| \"r\"\n\t| \"s\"\n\t| \"t\"\n\t| \"u\"\n\t| \"v\"\n\t| \"w\"\n\t| \"x\"\n\t| \"y\"\n\t| \"z\"\n\t| \"0\"\n\t| \"1\"\n\t| \"2\"\n\t| \"3\"\n\t| \"4\"\n\t| \"5\"\n\t| \"6\"\n\t| \"7\"\n\t| \"8\"\n\t| \"9\"\n\n/**\n * @public\n */\ntype IsAlphaNumeric<S extends string> = S extends `${infer Head}${infer Tail}`\n\t? Head extends AlphaNumericChar\n\t\t? IsAlphaNumeric<Tail>\n\t\t: false\n\t: true\n\n/**\n * @public\n */\ntype ValidTrackingId<S extends string> = S extends `-${string}` | `${string}-` | `${string}--${string}` | \"\"\n\t? `Error: Invalid hyphen usage or empty string.`\n\t: S extends `${infer P1}-${infer P2}`\n\t\t? IsAlphaNumeric<P1> extends true\n\t\t\t? // Check if the recursive call on P2 is valid\n\t\t\t\tValidTrackingId<P2> extends P2\n\t\t\t\t? // If P2 is valid, the whole string S is valid.\n\t\t\t\t\tS\n\t\t\t\t: // Otherwise, propagate the error from P2's validation.\n\t\t\t\t\tValidTrackingId<P2>\n\t\t\t: `Error: The part '${P1}' should only contain lowercase alphanumeric characters (a to z, 0 to 9). Example: 'my-id' is correct, 'My-ID' is not.`\n\t\t: IsAlphaNumeric<S> extends true\n\t\t\t? S\n\t\t\t: `Error: The part '${S}' should only contain lowercase alphanumeric characters (a to z, 0 to 9). Example: 'my-id' is correct, 'My-ID' is not.`\n\n/**\n * Function type for tracking custom events with a valid tracking ID.\n * Throws an error if the tracking ID is invalid.\n *\n * @param trackingId - Valid format: lowercase alphanumeric + hyphens as separators\n * - No leading/trailing hyphens or consecutive hyphens\n * - Examples: \"button-click\", \"form-submit\", \"video-play\", \"nav-item-1\"\n *\n * @public\n */\nexport type TrackCustomEvent = <T extends string>(\n\ttrackingId: ValidTrackingId<T> extends T ? T : ValidTrackingId<T>,\n) => void\n\n/**\n * React hook for tracking custom events on published Framer sites.\n *\n * @returns {TrackCustomEvent} Function that sends tracking events with valid IDs.\n * Throws an error if the tracking ID is invalid.\n *\n * Tracking ID rules:\n * - Lowercase letters (a-z) and numbers (0-9) only\n * - Hyphens (-) as separators (no leading/trailing or consecutive hyphens)\n * - Valid: \"button-click\", \"form-submit\", \"video-play\", \"nav-item-1\"\n * - Invalid: \"Button-Click\", \"form--submit\", \"-button-click\", \"button_utils\"\n *\n * @example\n *\n * ```\n * function MyButton() {\n *     const trackEvent = useTracking()\n *     return <button onClick={() => trackEvent(\"button-click\")}>Click me</button>\n * }\n * ```\n *\n * @public\n */\nexport function useTracking(): TrackCustomEvent {\n\tconst router = useRouter()\n\tconst nodeId = useContext(NodeIdContext)\n\n\treturn useCallback(\n\t\ttrackingId => {\n\t\t\tif (!router.pageviewEventData?.current) return\n\n\t\t\t// Validate tracking ID\n\t\t\tif (!isValidTrackingId(trackingId)) {\n\t\t\t\tthrow new Error(`Invalid tracking ID: ${trackingId}`)\n\t\t\t}\n\n\t\t\t// We assume router.pageviewEventData is set at this point.\n\t\t\t// It looks like a race-condition in theory, but isn't in practice: The routers\n\t\t\t// `useEffect` runs pretty early during page load and we disable Reacts\n\t\t\t// event replaying system for improved INP in\n\t\t\t// src/library/src/router/hydration/reactHydrationINPOptimizer.ts\n\t\t\t// This means, this callback in practice doesn't trigger before the useEffect has run.\n\t\t\tif (router.pageviewEventData.current instanceof Promise) {\n\t\t\t\tvoid router.pageviewEventData.current.then(eventData => sendCustomTrackingEvent(eventData, nodeId, trackingId))\n\t\t\t} else {\n\t\t\t\tsendCustomTrackingEvent(router.pageviewEventData.current, nodeId, trackingId)\n\t\t\t}\n\t\t},\n\t\t[router, nodeId],\n\t)\n}\n\nfunction sendCustomTrackingEvent(eventData: PageviewEventData, nodeId: null | string, trackingId: string) {\n\tsendTrackingEvent(\n\t\t\"published_site_custom_event\",\n\t\t{\n\t\t\t...eventData,\n\t\t\tnodeId,\n\t\t\t// Don't attach a tracking ID if it's empty\n\t\t\ttrackingId: trackingId || null,\n\t\t},\n\t\t\"eager\",\n\t)\n}\n", "// Note: We don't use the \"slugify\" package here because we want a very specific\n// behavior for our CMS and web pages. Make sure to pick the right slugify\n// function for your use case!\n\n// Characters that are problematic in URLs and should be replaced with dashes:\n// - Whitespace (\\s)\n// - URL reserved delimiters: ? # [ ] @\n// - Characters with special meaning: ! $ & ' * + , ; : = \" < > % { } | \\ ^ ` /\n//   - : denotes paths on MacOS / reserved for drive letters on Windows\n// All other characters (including unicode letters, numbers, symbols) are kept.\nconst unsafeSlugCharactersRegExp = /[\\s?#[\\]@!$&'*+,;:=\"<>%{}|\\\\^`/]+/gu\n\n/**\n * Trim leading and trailing dashes from a string.\n * We can't use a regexp, because matching e.g. /-+$/gu leads to polynomial backtracking with e.g. '-'.repeat(54773) + '\\x00-'\n */\nexport function trimDashes(str: string): string {\n\tlet start = 0\n\tlet end = str.length\n\twhile (start < end && str[start] === \"-\") start++\n\twhile (end > start && str[end - 1] === \"-\") end--\n\treturn str.slice(start, end)\n}\n\n/**\n * Takes a freeform string and converts it to a URL-safe slug.\n * Replaces problematic URL characters and combinations with dashes while preserving:\n * - Unicode letters and numbers\n * - Unicode symbols (\u00B1, \u00A7, etc.)\n * - URL-safe punctuation: - . ~ ( ) _\n */\nexport function slugify(value: string): string {\n\treturn trimDashes(value.trim().toLowerCase().replace(unsafeSlugCharactersRegExp, \"-\"))\n}\n", "import React from \"react\"\n\n/**\n * React context used to track the current node ID in the component hierarchy.\n * This is used by the `useTracking` hook to associate events with specific nodes.\n * @internal\n */\nexport const NodeIdContext = /* @__PURE__ */ React.createContext<string | null>(null)\n", "import {\n\ttype PropsWithChildren,\n\tcreateContext,\n\tstartTransition,\n\tuseCallback,\n\tuseContext,\n\tuseDeferredValue,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n\tuseSyncExternalStore,\n\tuseEffect,\n} from \"react\"\nimport { useRenderTargetEnvironment } from \"../modules/RenderTargetEnvironmentContext.tsx\"\nimport { useCollectionUtils } from \"../modules/cms/CollectionUtilsCache.tsx\"\nimport { isEqual } from \"../render/utils/isEqual.ts\"\nimport { assert } from \"../utils/assert.ts\"\nimport { useMemoOne } from \"../utils/useMemoOne.ts\"\nimport { isArray, isBoolean, isNumber, isPromise, isString, isUndefined } from \"../utils/utils.ts\"\nimport { yieldToMain } from \"../utils/yield.ts\"\nimport { useRouter } from \"./RouterContext.tsx\"\nimport { type HistoryState, pushHistoryState, replaceHistoryState } from \"./history.ts\"\nimport type { Locale, MaybePromise } from \"./types.ts\"\nimport { useLocaleInfo } from \"./useLocale.ts\"\nimport { EMPTY_ARRAY } from \"./utils.ts\"\n\nconst urlSearchStringSubscribers = new Set<() => void>()\n\nfunction getURLSearchStringSnapshot() {\n\treturn window.location.search\n}\n\nfunction getServerURLSearchStringSnapshot() {\n\treturn \"\"\n}\n\nfunction subscribeToURLSearchString(callback: () => void) {\n\turlSearchStringSubscribers.add(callback)\n\twindow.addEventListener(\"popstate\", callback)\n\n\treturn () => {\n\t\turlSearchStringSubscribers.delete(callback)\n\t\twindow.removeEventListener(\"popstate\", callback)\n\t}\n}\n\nfunction notifyURLSearchStringSubscribers() {\n\tfor (const subscriber of urlSearchStringSubscribers) subscriber()\n}\n\nconst URLSearchParamsContext = /* @__PURE__ */ (() => {\n\tconst Context = createContext<{\n\t\turlSearchParams: URLSearchParams\n\t\treplaceSearchParams: (replacer: (currentParams: URLSearchParams) => URLSearchParams) => Promise<void>\n\t}>({\n\t\turlSearchParams: new URLSearchParams(),\n\t\treplaceSearchParams: async () => {},\n\t})\n\tContext.displayName = \"URLSearchParamsContext\"\n\treturn Context\n})()\n\nexport function URLSearchParamsProvider({ children }: PropsWithChildren) {\n\tconst renderTargetEnvironment = useRenderTargetEnvironment()\n\tconst isPreview = renderTargetEnvironment === \"preview\"\n\tconst [previewURLSearchString, setPreviewURLSearchString] = useState(\"\")\n\t// eslint-disable-next-line framer-studio/no-usesyncexternalstore -- fine here, because we use useDeferredValue to defer + `useMemoOne` to memoize the value\n\tconst siteURLSearchString = useSyncExternalStore(\n\t\tsubscribeToURLSearchString,\n\t\tgetURLSearchStringSnapshot,\n\t\tgetServerURLSearchStringSnapshot,\n\t)\n\tconst deferredURLSearchString = useDeferredValue(siteURLSearchString)\n\n\t// The router navigates between routes via `pushState`, which doesn't fire `popstate`. Without\n\t// an event we can subscribe to, but reading its context still re-renders this provider after\n\t// router-driven URL changes so the external store can pick up the latest location.search.\n\tuseRouter()\n\n\tconst urlSearchString = isPreview ? previewURLSearchString : deferredURLSearchString\n\n\tconst replaceSearchParams = useCallback(\n\t\tasync (replacer: (currentParams: URLSearchParams) => URLSearchParams) => {\n\t\t\tif (isPreview) {\n\t\t\t\tstartTransition(() => {\n\t\t\t\t\tsetPreviewURLSearchString(currentSearchString => {\n\t\t\t\t\t\tconst currentParams = new URLSearchParams(currentSearchString)\n\t\t\t\t\t\treturn replacer(currentParams).toString()\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tawait yieldToMain({ continueAfter: \"paint\" })\n\n\t\t\tconst currentHistoryState: HistoryState = window.history.state\n\t\t\tconst url = new URL(window.location.href)\n\t\t\tconst newSearchString = replacer(url.searchParams).toString()\n\t\t\turl.search = newSearchString\n\n\t\t\t// First filter change: pushState so browser back clears all filters.\n\t\t\t// Intermediate changes: replaceState so they collapse into one history step.\n\t\t\t// When all filters are cleared: pushState so back/forward toggles between\n\t\t\t// \"filters on\" and \"filters off\" instead of leaving identical ghost entries.\n\t\t\t// We store the pre-push search string so we can detect full clear, even when\n\t\t\t// non-filter params like utm_source keep the URL non-empty.\n\t\t\tconst originalSearch = currentHistoryState?.queryParamBackAnchorSearch\n\t\t\tconst currentSearch = window.location.search.slice(1)\n\t\t\tconst isFirstFilterChange = originalSearch === undefined && newSearchString !== currentSearch\n\t\t\tconst filtersCleared = originalSearch !== undefined && newSearchString === originalSearch\n\t\t\tconst nextHistoryState: HistoryState = {\n\t\t\t\t...currentHistoryState,\n\t\t\t\tqueryParamBackAnchorSearch: filtersCleared\n\t\t\t\t\t? undefined\n\t\t\t\t\t: (originalSearch ?? (isFirstFilterChange ? currentSearch : undefined)),\n\t\t\t}\n\n\t\t\tconst urlString = url.toString()\n\t\t\tif (isFirstFilterChange || filtersCleared) {\n\t\t\t\tawait pushHistoryState(nextHistoryState, urlString)\n\t\t\t} else {\n\t\t\t\treplaceHistoryState(nextHistoryState, urlString)\n\t\t\t}\n\t\t\tnotifyURLSearchStringSubscribers()\n\t\t},\n\t\t[isPreview],\n\t)\n\n\tconst value = useMemoOne(\n\t\t() => ({\n\t\t\turlSearchParams: new URLSearchParams(urlSearchString),\n\t\t\treplaceSearchParams,\n\t\t}),\n\t\t[urlSearchString, replaceSearchParams],\n\t)\n\n\treturn <URLSearchParamsContext.Provider value={value}>{children}</URLSearchParamsContext.Provider>\n}\n\ntype UseQueryParamResult<T> = [T, (newValue: T) => Promise<void>]\nexport type OptionalFlag = boolean | undefined\nexport type OptionalValue<T, Optional extends OptionalFlag> = Optional extends true ? T | undefined : T\n\ninterface UseStringArrayQueryParamOptions {\n\tparameterName: string\n}\n\nfunction useStringArrayQueryParam({\n\tparameterName,\n}: UseStringArrayQueryParamOptions): [readonly string[], (newValues: readonly string[]) => Promise<void>] {\n\t// We don't support changing the parameter name after the initial render, so ignore updates.\n\tconst parameterNameRef = useRef(parameterName)\n\n\tconst { urlSearchParams, replaceSearchParams } = useContext(URLSearchParamsContext)\n\n\tconst value = useMemo<readonly string[]>(() => {\n\t\treturn urlSearchParams.getAll(parameterNameRef.current)\n\t}, [urlSearchParams])\n\n\tconst setValue = useCallback(\n\t\tasync (newValues: readonly string[]) => {\n\t\t\tif (!isArray(newValues)) return\n\n\t\t\tawait replaceSearchParams(currentSearchParams => {\n\t\t\t\tconst name = parameterNameRef.current\n\t\t\t\tconst next = new URLSearchParams()\n\n\t\t\t\tlet inserted = false\n\n\t\t\t\tfor (const [key, originalValue] of currentSearchParams.entries()) {\n\t\t\t\t\tif (key !== name) {\n\t\t\t\t\t\tnext.append(key, originalValue)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tif (inserted) continue\n\t\t\t\t\tinserted = true\n\n\t\t\t\t\tfor (const newValue of newValues) {\n\t\t\t\t\t\tif (!isString(newValue)) continue\n\t\t\t\t\t\tnext.append(name, newValue)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (!inserted) {\n\t\t\t\t\tfor (const newValue of newValues) {\n\t\t\t\t\t\tif (!isString(newValue)) continue\n\t\t\t\t\t\tnext.append(name, newValue)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn next\n\t\t\t})\n\t\t},\n\t\t[replaceSearchParams],\n\t)\n\n\treturn [value, setValue]\n}\n\ninterface UseStringQueryParamOptions<Optional extends OptionalFlag = undefined> {\n\tinitialValue: OptionalValue<string, Optional>\n\tparameterName: string\n\toptional?: Optional\n}\n\nexport function useStringQueryParam<Optional extends OptionalFlag = undefined>({\n\tinitialValue,\n\tparameterName,\n\toptional,\n}: UseStringQueryParamOptions<Optional>): UseQueryParamResult<OptionalValue<string, Optional>> {\n\tconst initialValueRef = useRef(optional ? undefined : isString(initialValue) ? initialValue : \"\")\n\tconst [arrayValue, setArrayValue] = useStringArrayQueryParam({ parameterName })\n\n\tconst value = useMemo<OptionalValue<string, Optional>>(() => {\n\t\tif (arrayValue.length === 0) return initialValueRef.current as OptionalValue<string, Optional>\n\t\treturn arrayValue[0] ?? \"\"\n\t}, [arrayValue])\n\n\tconst setValue = useCallback(\n\t\tasync (newValue: OptionalValue<string, Optional>) => {\n\t\t\tconst initial = initialValueRef.current\n\t\t\tif (newValue === initial) return setArrayValue(EMPTY_ARRAY)\n\t\t\tif (!isString(newValue)) return\n\t\t\treturn setArrayValue([newValue])\n\t\t},\n\t\t[setArrayValue],\n\t)\n\n\treturn [value, setValue]\n}\n\nconst BOOLEAN_YES = \"yes\"\nconst BOOLEAN_NO = \"no\"\n\ninterface UseBooleanQueryParamOptions<Optional extends OptionalFlag = undefined> {\n\tinitialValue: OptionalValue<boolean, Optional>\n\tparameterName: string\n\toptional?: Optional\n}\n\nexport function useBooleanQueryParam<Optional extends OptionalFlag = undefined>({\n\tinitialValue,\n\tparameterName,\n\toptional,\n}: UseBooleanQueryParamOptions<Optional>): UseQueryParamResult<OptionalValue<boolean, Optional>> {\n\tconst initialValueRef = useRef<OptionalValue<string, Optional>>(\n\t\t(optional ? undefined : initialValue ? BOOLEAN_YES : BOOLEAN_NO) as OptionalValue<string, Optional>,\n\t)\n\n\tconst [stringValue, setStringValue] = useStringQueryParam({\n\t\tinitialValue: initialValueRef.current,\n\t\tparameterName,\n\t\toptional,\n\t})\n\n\tconst value = useMemo<OptionalValue<boolean, Optional>>(() => {\n\t\tif (stringValue === BOOLEAN_YES) return true\n\t\tif (stringValue === BOOLEAN_NO) return false\n\t\tif (isUndefined(stringValue)) return undefined as OptionalValue<boolean, Optional>\n\t\tif (initialValueRef.current === BOOLEAN_YES) return true\n\t\tif (initialValueRef.current === BOOLEAN_NO) return false\n\t\treturn undefined as OptionalValue<boolean, Optional>\n\t}, [stringValue])\n\n\tconst setValue = useCallback(\n\t\tasync (newValue: OptionalValue<boolean, Optional>) => {\n\t\t\tif (isUndefined(newValue)) return setStringValue(undefined as OptionalValue<string, Optional>)\n\t\t\tif (!isBoolean(newValue)) return\n\t\t\treturn setStringValue(newValue ? BOOLEAN_YES : BOOLEAN_NO)\n\t\t},\n\t\t[setStringValue],\n\t)\n\n\treturn [value, setValue]\n}\n\nfunction parseNumberQueryParam(value: string): number | undefined {\n\t// If the value contains both comma and dot, it's invalid.\n\tconst includesComma = value.includes(\",\")\n\tconst includesDot = value.includes(\".\")\n\tif (includesComma && includesDot) return undefined\n\n\tconst normalizedValue = includesComma ? value.replace(\",\", \".\") : value\n\tconst parsed = Number(normalizedValue)\n\n\tif (!isNumber(parsed)) return undefined\n\treturn parsed\n}\n\nfunction serializeNumberQueryParam(value: number): string {\n\treturn String(value)\n}\n\ninterface UseNumberQueryParamOptions<Optional extends OptionalFlag = undefined> {\n\tinitialValue: OptionalValue<number, Optional>\n\tparameterName: string\n\toptional?: Optional\n}\n\nexport function useNumberQueryParam<Optional extends OptionalFlag = undefined>({\n\tinitialValue,\n\tparameterName,\n\toptional,\n}: UseNumberQueryParamOptions<Optional>): UseQueryParamResult<OptionalValue<number, Optional>> {\n\tconst initialNumberValueRef = useRef(\n\t\t(optional ? undefined : isNumber(initialValue) ? initialValue : 0) as OptionalValue<number, Optional>,\n\t)\n\tconst initialStringValueRef = useRef<OptionalValue<string, Optional>>(\n\t\tisNumber(initialNumberValueRef.current)\n\t\t\t? serializeNumberQueryParam(initialNumberValueRef.current)\n\t\t\t: (undefined as OptionalValue<string, Optional>),\n\t)\n\n\tconst [stringValue, setStringValue] = useStringQueryParam({\n\t\tinitialValue: initialStringValueRef.current,\n\t\tparameterName,\n\t\toptional,\n\t})\n\n\tconst value = useMemo(() => {\n\t\tif (isUndefined(stringValue)) return undefined as OptionalValue<number, Optional>\n\t\tconst parsed = parseNumberQueryParam(stringValue)\n\t\tif (isNumber(parsed)) return parsed\n\t\treturn initialNumberValueRef.current\n\t}, [stringValue])\n\n\tconst setValue = useCallback(\n\t\tasync (newValue: OptionalValue<number, Optional>) => {\n\t\t\tif (!isNumber(newValue)) return setStringValue(undefined as OptionalValue<string, Optional>)\n\t\t\treturn setStringValue(serializeNumberQueryParam(newValue))\n\t\t},\n\t\t[setStringValue],\n\t)\n\n\treturn [value, setValue]\n}\n\nconst dateOnlyLength = 10 // 2025-01-01\nconst dateTimeLength = 16 // 2025-01-01T00:00\nconst isoDateTimeCompletionTemplate = \"0000-00-00T00:00:00.000Z\"\n\nfunction getCompleteDateTime(value: string): string | undefined {\n\ttry {\n\t\tconst completeDate = value + isoDateTimeCompletionTemplate.slice(value.length)\n\t\tconst date = new Date(completeDate)\n\n\t\t// Check if the date is valid.\n\t\tif (Number.isNaN(date.getTime())) return undefined\n\n\t\t// Check if the date is valid according to the ISO 8601 format. Checking against the ISO\n\t\t// string prevents having to parse the value manually.\n\t\tif (!date.toISOString().startsWith(value)) return undefined\n\n\t\treturn completeDate\n\t} catch {\n\t\treturn undefined\n\t}\n}\n\nfunction parseDateQueryParam(value: string): string | undefined {\n\tif (\n\t\tvalue.length === dateOnlyLength ||\n\t\tvalue.length === dateTimeLength ||\n\t\tvalue.length === isoDateTimeCompletionTemplate.length\n\t) {\n\t\treturn getCompleteDateTime(value)\n\t}\n\n\treturn undefined\n}\n\nfunction serializeDateQueryParam(value: string, displayTime: boolean): string | undefined {\n\tconst completeDate = getCompleteDateTime(value)\n\tif (!completeDate) return undefined\n\n\tif (!displayTime) return completeDate.slice(0, dateOnlyLength)\n\treturn completeDate.slice(0, dateTimeLength)\n}\n\ninterface UseDateQueryParamOptions<Optional extends OptionalFlag = undefined> {\n\tinitialValue: OptionalValue<string | undefined, Optional>\n\tparameterName: string\n\tdisplayTime?: boolean\n\toptional?: Optional\n}\n\nexport function useDateQueryParam<Optional extends OptionalFlag = undefined>({\n\tinitialValue,\n\tparameterName,\n\tdisplayTime,\n\toptional,\n}: UseDateQueryParamOptions<Optional>): UseQueryParamResult<OptionalValue<string, Optional>> {\n\tconst displayTimeRef = useRef(isBoolean(displayTime) ? displayTime : false)\n\tconst initialStringValueRef = useRef(\n\t\toptional || !isString(initialValue) ? undefined : serializeDateQueryParam(initialValue, displayTimeRef.current),\n\t)\n\n\tconst [stringValue, setStringValue] = useStringQueryParam({\n\t\tinitialValue: initialStringValueRef.current,\n\t\tparameterName,\n\t\toptional: isUndefined(initialStringValueRef.current),\n\t})\n\n\tconst value = useMemo<OptionalValue<string, Optional>>(() => {\n\t\tif (isUndefined(stringValue)) return undefined as OptionalValue<string, Optional>\n\t\tconst date = parseDateQueryParam(stringValue) as OptionalValue<string, Optional>\n\t\tif (isString(date)) return date\n\t\tconst initialDate = initialStringValueRef.current\n\t\tif (!isString(initialDate)) return undefined as OptionalValue<string, Optional>\n\t\treturn parseDateQueryParam(initialDate) as OptionalValue<string, Optional>\n\t}, [stringValue])\n\n\tconst setValue = useCallback(\n\t\tasync (newValue: OptionalValue<string, Optional>): Promise<void> => {\n\t\t\tif (isUndefined(newValue)) return setStringValue(undefined as OptionalValue<string, Optional>)\n\t\t\tif (!isString(newValue)) return\n\t\t\tconst serializedDate = serializeDateQueryParam(newValue, displayTimeRef.current)\n\t\t\tif (!isString(serializedDate)) return\n\t\t\treturn setStringValue(serializedDate)\n\t\t},\n\t\t[setStringValue],\n\t)\n\n\treturn [value, setValue]\n}\n\ninterface UseCollectionReferenceQueryParamOptions<Optional extends OptionalFlag = undefined> {\n\tcollectionId: string\n\tinitialValue: OptionalValue<string | undefined, Optional>\n\tparameterName: string\n\toptional?: Optional\n}\n\nexport function useCollectionReferenceQueryParam<Optional extends OptionalFlag = undefined>({\n\tcollectionId,\n\tinitialValue,\n\tparameterName,\n\toptional,\n}: UseCollectionReferenceQueryParamOptions<Optional>): UseQueryParamResult<string | undefined> {\n\tconst collectionUtils = useCollectionUtils()\n\tconst locale = useLocaleInfo().activeLocale ?? undefined\n\n\tconst initialValueRef = useRef(optional ? undefined : initialValue)\n\n\tconst [slug, setSlug] = useStringQueryParam({\n\t\tinitialValue: undefined,\n\t\tparameterName,\n\t\toptional: true,\n\t})\n\n\tconst id = useMemo(() => {\n\t\tif (!isString(slug)) return initialValueRef.current\n\t\tconst cache = getCollectionUtilsCache(collectionUtils, collectionId)\n\t\treturn use(cache.getRecordIdBySlug(slug, locale))\n\t}, [collectionUtils, collectionId, locale, slug])\n\n\tconst setId = useCallback(\n\t\tasync (newId: OptionalValue<string, Optional>) => {\n\t\t\tif (isUndefined(newId)) return setSlug(undefined)\n\t\t\tconst cache = getCollectionUtilsCache(collectionUtils, collectionId)\n\t\t\tconst newSlug = await cache.getSlugByRecordId(newId, locale)\n\t\t\tif (!isString(newSlug)) return\n\t\t\tawait setSlug(newSlug)\n\t\t},\n\t\t[collectionUtils, collectionId, locale, setSlug],\n\t)\n\n\treturn [id, setId]\n}\n\ninterface UseMultiCollectionReferenceQueryParamOptions<Optional extends OptionalFlag = undefined> {\n\tcollectionId: string\n\tinitialValue: OptionalValue<readonly string[], Optional>\n\tparameterName: string\n\toptional?: Optional\n}\n\nexport function useMultiCollectionReferenceQueryParam<Optional extends OptionalFlag = undefined>({\n\tcollectionId,\n\tinitialValue,\n\tparameterName,\n\toptional,\n}: UseMultiCollectionReferenceQueryParamOptions<Optional>): UseQueryParamResult<\n\tOptionalValue<readonly string[], Optional>\n> {\n\ttype ValueType = OptionalValue<readonly string[], Optional>\n\n\tconst collectionUtils = useCollectionUtils()\n\tconst locale = useLocaleInfo().activeLocale ?? undefined\n\n\tconst initialArrayValue = useRef<ValueType>(\n\t\t(optional ? undefined : isArray(initialValue) ? initialValue : EMPTY_ARRAY) as ValueType,\n\t)\n\n\tconst [slugs, setSlugs] = useStringArrayQueryParam({ parameterName })\n\n\tconst ids = useMemo<OptionalValue<readonly string[], Optional>>(() => {\n\t\tif (slugs.length === 0) return initialArrayValue.current\n\n\t\tconst cache = getCollectionUtilsCache(collectionUtils, collectionId)\n\t\t// TODO: make CollectionUtilsCache be able to resolve these in a single query\n\t\tconst maybePromises = slugs.filter(isNonEmptyString).map(slug => cache.getRecordIdBySlug(slug, locale))\n\n\t\tconst supportsOptional = isUndefined(initialArrayValue.current)\n\n\t\t// biome-ignore lint/correctness/useHookAtTopLevel: not a hook\n\t\tconst resolvedIds = useAll(maybePromises).filter(isString)\n\t\tif (resolvedIds.length === 0 && supportsOptional) return undefined as OptionalValue<readonly string[], Optional>\n\t\treturn resolvedIds as OptionalValue<readonly string[], Optional>\n\t}, [collectionUtils, collectionId, locale, slugs])\n\n\tconst setIds = useCallback(\n\t\tasync (newIds: OptionalValue<readonly string[], Optional>) => {\n\t\t\tif (isUndefined(newIds)) return setSlugs(EMPTY_ARRAY)\n\t\t\tif (!isArray(newIds)) return\n\n\t\t\tconst initialArray = initialArrayValue.current\n\t\t\tif (newIds.length === 0 && isArray(initialArray) && !isEqual(newIds, initialArray)) {\n\t\t\t\treturn setSlugs([\"\"])\n\t\t\t}\n\n\t\t\tconst cache = getCollectionUtilsCache(collectionUtils, collectionId)\n\t\t\tconst newSlugs = await Promise.all(newIds.map(id => cache.getSlugByRecordId(id, locale)))\n\t\t\tawait setSlugs(newSlugs.filter(isString))\n\t\t},\n\t\t[collectionUtils, collectionId, locale, setSlugs],\n\t)\n\n\treturn [ids, setIds]\n}\n\nfunction isNonEmptyString(value: unknown): value is Exclude<string, \"\"> {\n\treturn isString(value) && value !== \"\"\n}\n\nexport interface UseEnumQueryParamOptions<Optional extends OptionalFlag = undefined> {\n\tinitialValue: OptionalValue<string, Optional>\n\tparameterName: string\n\toptions: readonly string[] | undefined\n\tgetOptionTitle: ((id: string, locale?: Locale) => string | undefined) | undefined\n\toptional?: Optional\n}\n\nconst noOpGetOptionTitle = () => undefined\n\nexport function useEnumQueryParam<Optional extends OptionalFlag = undefined>({\n\tinitialValue,\n\tparameterName,\n\toptions = EMPTY_ARRAY,\n\tgetOptionTitle = noOpGetOptionTitle,\n\toptional,\n}: UseEnumQueryParamOptions<Optional>): UseQueryParamResult<OptionalValue<string, Optional>> {\n\tuseEffect(() => {\n\t\tif (options === EMPTY_ARRAY || getOptionTitle === noOpGetOptionTitle) {\n\t\t\t// biome-ignore lint/suspicious/noConsole: intentional\n\t\t\tconsole.warn(\n\t\t\t\t\"[useEnumQueryParam]\",\n\t\t\t\t`The URL variable \\`${parameterName}\\` is misconfigured because the referenced Option field was removed from the collection. Filters using this variable are disabled, and updating the variable will have no effect.`,\n\t\t\t)\n\t\t}\n\t}, [options, getOptionTitle, parameterName])\n\n\tconst locale = useLocaleInfo().activeLocale ?? undefined\n\n\tconst titleToIdMap = useMemo(() => {\n\t\tconst map = new Map<string, string>()\n\n\t\tfor (const id of options) {\n\t\t\tconst title = getOptionTitle(id, locale)\n\t\t\tif (!title) continue\n\t\t\tmap.set(title, id)\n\t\t}\n\n\t\treturn map\n\t}, [locale, options, getOptionTitle])\n\n\tconst initialTitle = useMemo(() => {\n\t\tif (!initialValue) return undefined as OptionalValue<string, Optional>\n\t\tif (!options.includes(initialValue)) return undefined as OptionalValue<string, Optional>\n\t\treturn getOptionTitle(initialValue, locale) || \"\"\n\t}, [locale, initialValue, options, getOptionTitle])\n\n\tconst [titleValue, setTitleValue] = useStringQueryParam({\n\t\tinitialValue: initialTitle,\n\t\tparameterName,\n\t\toptional,\n\t})\n\n\tconst value = useMemo<OptionalValue<string, Optional>>(() => {\n\t\tconst validInitialId =\n\t\t\tinitialValue && options.includes(initialValue) ? initialValue : (undefined as OptionalValue<string, Optional>)\n\n\t\tif (isUndefined(titleValue)) {\n\t\t\treturn undefined as OptionalValue<string, Optional>\n\t\t}\n\t\tif (!titleValue) return validInitialId\n\n\t\tconst resolvedId = titleToIdMap.get(titleValue)\n\t\tif (!resolvedId) {\n\t\t\t// This can only happen if the URL parameters are invalid\n\t\t\t// (maybe the user manually changed it, maybe the enum option got deleted but the user had saved the URL)\n\t\t\tif (optional) return undefined as OptionalValue<string, Optional>\n\t\t\treturn validInitialId\n\t\t}\n\n\t\treturn resolvedId as OptionalValue<string, Optional>\n\t}, [titleValue, titleToIdMap, initialValue, options, optional])\n\n\tconst setValue = useCallback(\n\t\tasync (newValue: OptionalValue<string, Optional>): Promise<void> => {\n\t\t\tif (isUndefined(newValue)) {\n\t\t\t\treturn setTitleValue(undefined as OptionalValue<string, Optional>)\n\t\t\t}\n\n\t\t\tconst title = getOptionTitle(newValue, locale)\n\t\t\tif (title) {\n\t\t\t\treturn setTitleValue(title)\n\t\t\t}\n\t\t},\n\t\t[setTitleValue, locale, getOptionTitle],\n\t)\n\n\treturn [value, setValue]\n}\n\nfunction getCollectionUtilsCache(collectionUtils: ReturnType<typeof useCollectionUtils>, collectionId: string) {\n\tconst collectionUtilsCache = collectionUtils?.get(collectionId)\n\tassert(collectionUtilsCache, \"CollectionUtilsCache not found for collectionId:\", collectionId)\n\treturn collectionUtilsCache\n}\n\n// eslint-disable-next-line @eslint-react/hooks-extra/no-redundant-custom-hook,@eslint-react/hooks-extra/no-unnecessary-use-prefix\nfunction use<T>(maybePromise: MaybePromise<T>): T {\n\tif (isPromise(maybePromise)) throw maybePromise\n\treturn maybePromise\n}\n\n// eslint-disable-next-line @eslint-react/hooks-extra/no-redundant-custom-hook,@eslint-react/hooks-extra/no-unnecessary-use-prefix\nfunction useAll<T>(maybePromises: readonly MaybePromise<T>[]): readonly T[] {\n\tfor (const maybePromise of maybePromises) {\n\t\tif (isPromise(maybePromise)) {\n\t\t\tthrow Promise.all(maybePromises)\n\t\t}\n\t}\n\n\treturn maybePromises as readonly T[]\n}\n", "import type { PropsWithChildren } from \"react\"\nimport { createContext, useContext } from \"react\"\n\n/**\n * As opposed to {@link RenderTarget.preview}, which is true for both the in-editor preview AND published sites,\n * RenderTargetEnvironment is our internal way to differentiate them.\n *\n * We do not want to give this ability to the public because for their use cases, their sites should behave the same in\n * both environments.\n *\n * Use {@link useRenderTargetEnvironment} to read this value.\n *\n * @internal\n */\nexport type RenderTargetEnvironment = \"preview\" | \"site\"\n\nconst RenderTargetEnvironmentContext = /* @__PURE__ */ (() => {\n\tconst Context = createContext<RenderTargetEnvironment>(\"preview\")\n\tContext.displayName = \"RenderTargetEnvironmentContext\"\n\treturn Context\n})()\n\n/**\n * @internal\n */\nexport function RenderTargetEnvironmentProvider({\n\tchildren,\n\tvalue,\n}: PropsWithChildren<{ value: RenderTargetEnvironment }>) {\n\treturn <RenderTargetEnvironmentContext.Provider value={value}>{children}</RenderTargetEnvironmentContext.Provider>\n}\n\n/**\n * Returns whether the current RenderTarget is the in-app preview or the live site.\n *\n * @internal\n */\nexport function useRenderTargetEnvironment() {\n\treturn useContext(RenderTargetEnvironmentContext)\n}\n", "import React from \"react\"\nimport { useCollectionUtils } from \"../modules/cms/CollectionUtilsCache.tsx\"\nimport { useRouter } from \"./RouterContext.tsx\"\nimport { getLocalesForCurrentRoute } from \"./getLocalesForCurrentRoute.ts\"\nimport type { Locale, LocaleInfo, LocalizationInfo, TextDirection } from \"./types.ts\"\n\nconst noopAsync = async () => {}\n\nconst defaultLocaleInfo: LocaleInfo = {\n\tactiveLocale: null,\n\tlocales: [],\n\tsetLocale: noopAsync,\n}\n\nexport const LocaleInfoContext = /* @__PURE__ */ (() => {\n\tconst Context = React.createContext<LocaleInfo>(defaultLocaleInfo)\n\tContext.displayName = \"LocaleInfoContext\"\n\treturn Context\n})()\n\n/**\n * @public\n * @returns The active locale, all of the available locales, and a way to change the active locale.\n */\nexport function useLocaleInfo(): LocaleInfo {\n\treturn React.useContext(LocaleInfoContext)\n}\n\n/**\n * @public\n * @returns The locales that are available for the current route.\n */\nexport function useLocalesForCurrentRoute(): readonly Locale[] {\n\tconst { currentRouteId, routes, currentPathVariables } = useRouter()\n\tconst { activeLocale, locales } = useLocaleInfo()\n\tconst [localesForCurrentRoute, setLocalesForCurrentRoute] = React.useState<readonly Locale[]>(() =>\n\t\tactiveLocale ? [activeLocale] : [],\n\t)\n\n\tconst currentRoute = currentRouteId ? routes?.[currentRouteId] : undefined\n\n\tconst collectionUtils = useCollectionUtils()\n\n\t// Each route may be hidden for certain locales, when the route changes\n\t// we need to recompute the selectable locales\n\tReact.useEffect(() => {\n\t\tlet active = true\n\n\t\tgetLocalesForCurrentRoute(activeLocale, locales, currentRoute, currentPathVariables, collectionUtils)\n\t\t\t.then(localesSubset => {\n\t\t\t\tif (!active) return\n\t\t\t\tReact.startTransition(() => {\n\t\t\t\t\tif (localesSubset) {\n\t\t\t\t\t\tsetLocalesForCurrentRoute(localesSubset)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsetLocalesForCurrentRoute(activeLocale ? [activeLocale] : [])\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t})\n\t\t\t.catch(() => {}) // Swallow any errors\n\n\t\treturn () => {\n\t\t\tactive = false\n\t\t}\n\t}, [activeLocale, locales, collectionUtils, currentRoute, currentPathVariables])\n\n\treturn localesForCurrentRoute\n}\n\n/**\n * Only used in code generation within our code on alpha.\n * @deprecated Use `useLocaleInfo` instead.\n */\nexport function useLocalizationInfo(): LocalizationInfo {\n\tconst { activeLocale, locales, setLocale } = useLocaleInfo()\n\treturn {\n\t\tactiveLocalization: activeLocale,\n\t\tlocalizations: locales,\n\t\tsetLocalization: setLocale,\n\t}\n}\n\n/**\n * @public\n * @returns The current locale code, which is a combination of the language and optional region,\n * e.g. \"en-US\".\n */\nexport function useLocaleCode(): string {\n\treturn useLocaleInfo().activeLocale?.code ?? \"en-US\"\n}\n\n/**\n * Used in code generation of user code.\n * @deprecated Use `useLocaleCode` instead.\n */\nexport function useLocale(): string {\n\treturn useLocaleCode()\n}\n\n/** @private */\nexport const LayoutDirectionContext = /* @__PURE__ */ (() => {\n\tconst Context = React.createContext<TextDirection>(\"ltr\")\n\tContext.displayName = \"LayoutDirectionContext\"\n\treturn Context\n})()\n\n/**\n * @public\n * @returns The current layout direction, either \"ltr\" (left-to-right) or \"rtl\" (right-to-left).\n */\nexport function useLayoutDirection(): TextDirection {\n\treturn React.useContext(LayoutDirectionContext)\n}\n", "import type { CollectionUtilsCacheContextValue } from \"../modules/cms/CollectionUtilsCache.tsx\"\nimport { isPromise, isString } from \"../utils/utils.ts\"\nimport { pathVariablesRegExpGlobal } from \"./pathVariables.ts\"\nimport type { Locale, LocaleId, Route } from \"./types.ts\"\n\ntype Slug = string\n\nexport async function getLocalesForCurrentRoute(\n\tactiveLocale: Locale | null,\n\tlocales: readonly Locale[],\n\tcurrentRoute: Route | undefined,\n\tpathVariables: Record<string, unknown> | undefined,\n\tcollectionUtils: CollectionUtilsCacheContextValue,\n): Promise<readonly Locale[]> {\n\tif (!currentRoute) return locales\n\n\tconst slugByLocaleIfCollectionPage = await getSlugByLocaleIfCollectionPage(\n\t\tactiveLocale,\n\t\tlocales,\n\t\tcurrentRoute,\n\t\tpathVariables,\n\t\tcollectionUtils,\n\t)\n\n\tconst includedLocalesForCurrentRoute = currentRoute.includedLocales\n\n\tconst localesForCurrentRoute: Locale[] = []\n\n\tfor (const locale of locales) {\n\t\t// Included locales are optional, if undefined all are included.\n\t\tif (includedLocalesForCurrentRoute) {\n\t\t\tif (!includedLocalesForCurrentRoute.includes(locale.id)) continue\n\t\t}\n\n\t\t// `slugByLocaleIfCollectionPage` is only defined if the current route is a collection page.\n\t\tif (slugByLocaleIfCollectionPage) {\n\t\t\tconst hasSlug = slugByLocaleIfCollectionPage.has(locale.id)\n\t\t\tif (!hasSlug) continue\n\t\t}\n\n\t\tlocalesForCurrentRoute.push(locale)\n\t}\n\n\treturn localesForCurrentRoute\n}\n\n/** Returns a lookup if the route has slugs, otherwise returns `null` */\nasync function getSlugByLocaleIfCollectionPage(\n\tactiveLocale: Locale | null,\n\tlocales: readonly Locale[],\n\tcurrentRoute: Route,\n\tpathVariables: Record<string, unknown> | undefined,\n\tcollectionUtils: CollectionUtilsCacheContextValue,\n): Promise<ReadonlyMap<LocaleId, Slug> | null> {\n\tconst { collectionId } = currentRoute\n\tif (!collectionId) return null\n\n\tif (!activeLocale) return null\n\tif (!pathVariables) return null\n\n\tconst { path } = currentRoute\n\tif (!path) return null\n\n\tconst matches = Array.from(path.matchAll(pathVariablesRegExpGlobal))\n\n\t// We currently only support one slug per path, but to be future proof we take the last match\n\tconst lastMatch = matches.pop()\n\tif (!lastMatch) return null\n\n\tconst pathVariableWithDelimiter = lastMatch?.[0]\n\tconst pathVariableValue = lastMatch?.[1]\n\n\tif (!pathVariableWithDelimiter || !pathVariableValue) {\n\t\tthrow new Error(\"Failed to replace path variables: unexpected regex match group\")\n\t}\n\n\tconst currentSlug = pathVariables[pathVariableValue]\n\tif (!currentSlug || !isString(currentSlug)) {\n\t\tthrow new Error(`No slug found for path variable ${pathVariableValue}`)\n\t}\n\n\tconst utils = collectionUtils?.get(collectionId)\n\tif (!utils) return null\n\n\tconst maybeRecordId = utils.getRecordIdBySlug(currentSlug, activeLocale)\n\tconst recordId = isPromise(maybeRecordId) ? await maybeRecordId : maybeRecordId\n\tif (!recordId) return null\n\n\tconst slugById: Map<LocaleId, Slug> = new Map()\n\n\tawait Promise.all(\n\t\tlocales.map(async (locale): Promise<void> => {\n\t\t\tconst maybeSlug = utils.getSlugByRecordId(recordId, locale)\n\t\t\tconst slug = isPromise(maybeSlug) ? await maybeSlug : maybeSlug\n\n\t\t\t// Ignore locales that don't have a slug.\n\t\t\tif (!slug) return\n\n\t\t\tslugById.set(locale.id, slug)\n\t\t}),\n\t)\n\n\treturn slugById\n}\n", "import React from \"react\"\nimport { useRouter } from \"./RouterContext.tsx\"\nimport { getPathForRoute } from \"./history.ts\"\nimport type { ElementId, Hash, RouteId } from \"./types.ts\"\nimport { useCurrentRouteId } from \"./useCurrentRoute.tsx\"\nimport { useLocaleInfo } from \"./useLocale.ts\"\nimport { useRoute } from \"./useRoute.ts\"\nimport { useRoutePreloader } from \"./useRoutePreloader.ts\"\n\ntype RouteAnchorProps = Pick<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"href\" | \"onClick\"> &\n\tReact.RefAttributes<HTMLAnchorElement>\n\ninterface Options {\n\thash?: Hash\n\t/** @deprecated */\n\telementId?: ElementId\n}\n\n/**\n * @deprecated no longer used; kept for backwards compatibility. Prefer {@link useRouteHandler} instead.\n */\nexport function useRouteAnchor(routeId: RouteId, { elementId, hash: linkHash }: Options = {}): RouteAnchorProps {\n\tconst { navigate, currentPathVariables, preserveQueryParams, siteCanonicalURL } = useRouter()\n\tconst { activeLocale } = useLocaleInfo()\n\tconst route = useRoute(routeId)\n\tconst currentRouteId = useCurrentRouteId()\n\tconst currentRoute = useRoute(currentRouteId ?? \"\")\n\n\tuseRoutePreloader([routeId], true)\n\n\tconst hash = linkHash ?? elementId\n\tconst href = React.useMemo(\n\t\t() =>\n\t\t\tgetPathForRoute(route, {\n\t\t\t\tcurrentRoutePath: currentRoute?.path,\n\t\t\t\tcurrentRoutePathLocalized: currentRoute?.pathLocalized,\n\t\t\t\tcurrentPathVariables,\n\t\t\t\thash,\n\t\t\t\tpreserveQueryParams,\n\t\t\t\tsiteCanonicalURL,\n\t\t\t\tlocaleId: activeLocale?.id,\n\t\t\t}),\n\t\t[currentRoute, currentPathVariables, hash, preserveQueryParams, route, siteCanonicalURL, activeLocale?.id],\n\t)\n\n\tconst navigateToRoute = React.useCallback(() => navigate?.(routeId, hash), [hash, navigate, routeId])\n\tconst onClick = React.useCallback(\n\t\t(event: React.MouseEvent<HTMLAnchorElement>) => {\n\t\t\tevent.preventDefault()\n\t\t\tnavigateToRoute()\n\t\t},\n\t\t[navigateToRoute],\n\t)\n\treturn { onClick, href }\n}\n", "// FIXME: Remove this once we have a better solution for preventing slow INP: https://github.com/framer/company/issues/29153\n// \u271D and holy water for us for writing this code.\n\nimport { useEffect } from \"react\"\nimport { isReplayEvent } from \"../../render/presentation/Forms/useReplayPreHydrationInput.ts\"\n\n// Whenever a user clicks in a Suspense boundary during concurrent hydration, React will prioritize it, see: https://3perf.com/talks/react-concurrency/#slide-29.\n// However, due to the mentioned bug we actually don't want this, because it causes very bad INP as hydration repeats N times for N events, which means hydration can become ultra slow (as seen by Debugbear / CrUX data).\n// So by preventing any events from reaching React during hydration, we:\n// - prevent the hydration from potentially becoming synchronous, at the expense of slightly slower hydration (due to concurrency, see also the 3perf link)\n// - avoid the repeated hydration bug\n// Users can still click on links during hydration, so they can effectively navigate (MPA navigation).\n// After hydration, we're undoing this prevention. See also SuspenseThatPreservesDom.tsx <OnHydrationEnd />.\n\n// source: https://github.com/facebook/react/blob/b5e5ce8e0a899345dab1ce71c74bc1d1c28c6a0d/packages/react-dom-bindings/src/events/ReactDOMEventReplaying.js#L85\nlet eventsToStop: string[] | undefined = [\n\t\"mousedown\",\n\t\"mouseup\",\n\t\"touchcancel\",\n\t\"touchend\",\n\t\"touchstart\",\n\t\"auxclick\",\n\t\"dblclick\",\n\t\"pointercancel\",\n\t\"pointerdown\",\n\t\"pointerup\",\n\t\"dragend\",\n\t\"dragstart\",\n\t\"drop\",\n\t\"compositionend\",\n\t\"compositionstart\",\n\t\"keydown\",\n\t\"keypress\",\n\t\"keyup\",\n\t\"input\",\n\t\"textInput\", // Intentionally camelCase\n\t\"copy\",\n\t\"cut\",\n\t\"paste\",\n\t\"click\",\n\t\"change\",\n\t\"contextmenu\",\n\t\"reset\",\n]\n\nconst stopFn = (event: Event) => {\n\tif (!(event.target as HTMLElement)?.closest?.(\"#main\")) return // event did not happen inside the react root\n\tif (isReplayEvent(event)) return // our custom replay event shouldn't be stopped\n\n\tevent.stopPropagation() // <-- this prevents React from receiving the event\n\t// we don't call e.preventDefault() because we want to allow the browser to handle the event\n\t// e.g. clicking on a link should trigger an MPA style navigation (sucks but better than freezing)\n\n\tperformance.mark(\"framer-react-event-handling-prevented\")\n}\n\nlet shouldTurnOnEventHandling = false\nexport function turnOffReactEventHandling() {\n\tif (!eventsToStop) return\n\tshouldTurnOnEventHandling = true\n\n\tperformance.mark(\"framer-react-event-handling-start\")\n\n\tconst options = { capture: true }\n\tconst body = document.body\n\teventsToStop.forEach(event => body.addEventListener(event, stopFn, options))\n}\n\nexport function TurnOnReactEventHandling(): null {\n\tuseEffect(() => {\n\t\tif (!shouldTurnOnEventHandling || !eventsToStop) return\n\n\t\tconst options = { capture: true }\n\t\tconst body = document.body\n\t\teventsToStop.forEach(event => body.removeEventListener(event, stopFn, options))\n\n\t\t// allow GC of the array\n\t\teventsToStop = undefined\n\n\t\tperformance.mark(\"framer-react-event-handling-end\")\n\t}, [])\n\treturn null\n}\n", "import { type ChangeEvent, useEffect, useRef, useSyncExternalStore } from \"react\"\nimport { isWindow, noopSubscribe, returnFalse } from \"../../../utils/utils.ts\"\n\n// React doesn't replay `onChange` events that happened before hydration. In other words, if a user\n// types \"a\" into an input, and then the page is hydrated, the input will show \"a\" as the value, but\n// the `onChange` event will not be fired even if the value is different to the passed value/defaultValue.\n// So React correctly retains user input, but we still need to fire `onChange` because e.g. query\n// params need to be updated.\n// Curiously, React does have a native solution for this:\n// https://github.com/facebook/react/blob/d4a325df/packages/react-dom-bindings/src/events/ReactDOMEventReplaying.js#L428-L451\n// ... but it's only enabled in Meta's React Native build (as of 2026-02-17).\n\nconst replayMarker = \"__f_replay\"\nconst replayMarkerIgnore = \"__f_replay_ignore\"\n\nfunction changeEvent() {\n\tconst event = new Event(\"change\", { bubbles: true })\n\t// @ts-ignore - React expects only `Event` objects so add a custom property to a regular `Event` object.\n\tevent[replayMarker] = 1\n\treturn event\n}\n\nfunction clickEvent() {\n\tconst event = new MouseEvent(\"click\", { bubbles: true })\n\t// @ts-ignore - React expects only `Event` objects so add a custom property to a regular `Event` object.\n\tevent[replayMarker] = 1\n\treturn event\n}\n\nfunction getValuePropFromElement<T extends HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>(element: T) {\n\tif (element instanceof HTMLInputElement && (element.type === \"checkbox\" || element.type === \"radio\")) {\n\t\treturn \"checked\"\n\t}\n\treturn \"value\"\n}\n\nexport function isReplayEvent(event: Event) {\n\treturn replayMarker in event && event[replayMarker] === 1\n}\n\nexport function shouldIgnoreReplayEvent(\n\tevent: ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>,\n) {\n\treturn replayMarkerIgnore in event.nativeEvent && event.nativeEvent[replayMarkerIgnore] === 1\n}\n\nconst isHydrationFn = () => isWindow\n\nexport function useReplayPreHydrationInput<T extends HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement, V>(\n\tvalue: V | undefined,\n) {\n\tconst didReplayRef = useRef(false)\n\tconst elementRef = useRef<T>(null)\n\n\t// eslint-disable-next-line framer-studio/no-usesyncexternalstore -- fine here, because nothing depends on the return value\n\tconst isHydration = useSyncExternalStore(noopSubscribe, returnFalse, isHydrationFn)\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: The effect should only run during hydration.\n\tuseEffect(() => {\n\t\tif (!isHydration) return\n\n\t\tconst element = elementRef.current\n\t\tif (didReplayRef.current || !element) return\n\t\tdidReplayRef.current = true\n\n\t\tconst valueProp = getValuePropFromElement(element)\n\t\tconst currentDOMValue = element[valueProp as keyof typeof element]\n\t\tif (currentDOMValue === value) return\n\n\t\t// For radios, we only dispatch a click event if the radio got checked.\n\t\tif (element.type === \"radio\" && currentDOMValue === true) {\n\t\t\t;(element as HTMLInputElement).checked = false\n\t\t\telement.dispatchEvent(clickEvent())\n\t\t\treturn\n\t\t}\n\n\t\t// For checkboxes, click twice to replay the pre-hydration change: first click (with\n\t\t// `__f_replay` marker) resets to React's intended value and is ignored by the onChange\n\t\t// handler, second click replays the user's action to update DOM and React state.\n\t\tif (valueProp === \"checked\") {\n\t\t\tconst event = clickEvent()\n\t\t\t// @ts-ignore - React expects only `Event` objects so add a custom property to a regular `Event` object.\n\t\t\tevent[replayMarkerIgnore] = 1\n\t\t\telement.dispatchEvent(event)\n\t\t\telement.dispatchEvent(clickEvent())\n\t\t\treturn\n\t\t}\n\n\t\t// For selects, dispatching a change event is enough to trigger a React change event.\n\t\tif (element.nodeName === \"SELECT\") {\n\t\t\telement.dispatchEvent(changeEvent())\n\t\t\treturn\n\t\t}\n\n\t\t// For text inputs, React only calls `onChange` if it sees the value has changed\n\t\tconst nativeInputValueSetter = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(element), valueProp)?.set\n\t\tif (!nativeInputValueSetter) return\n\n\t\t// Set a different value to make React think the value has changed.\n\t\tnativeInputValueSetter.call(element, \"\")\n\n\t\tconst event = changeEvent()\n\t\t// @ts-ignore - React expects only `Event` objects so add a custom property to a regular `Event` object.\n\t\tevent[replayMarkerIgnore] = 1\n\t\telement.dispatchEvent(event)\n\n\t\t// React batches events, so we need to queue a microtask to make sure the event is seen only\n\t\t// after React \"completes\" the batching.\n\t\tqueueMicrotask(() => {\n\t\t\t// Set back to the intended value\n\t\t\tnativeInputValueSetter.call(element, currentDOMValue)\n\t\t\telement.dispatchEvent(changeEvent())\n\t\t})\n\t}, [isHydration])\n\n\treturn elementRef\n}\n", "/* eslint-disable @typescript-eslint/naming-convention */\n\nimport { frame } from \"framer-motion\"\nimport { useEffect, useInsertionEffect, useLayoutEffect } from \"react\"\nimport { yieldToMain } from \"../../utils/yield.ts\"\nimport { onlyRunOnce } from \"./onlyRunOnce.ts\"\n\nfunction measureSafe(name: string, start: string | undefined, end?: string) {\n\ttry {\n\t\tperformance.measure(name, start, end)\n\t} catch (e) {\n\t\t// biome-ignore lint/suspicious/noConsole: this doesn't break anything, but should still be logged.\n\t\tconsole.warn(`Could not measure ${name}`, e)\n\t}\n}\n\nconst enum MarkNames {\n\tHydration = \"framer-hydration\",\n\tHydration_Start = \"framer-hydration-start\",\n\n\t//\n\t// During hydration, the page goes through the following stages:\n\t// 1) rendering the React tree (executing all React components)\n\t// 2) committing: mutation effects (updating the DOM)\n\t// 3) committing: running all updated useInsertionEffect hooks\n\t// 4) committing: running all updated useLayoutEffect hooks\n\t// 5) running browser rendering\n\t//   5.1) running requestAnimationFrame callbacks (which is still JS, but one not directly related to React)\n\t//   5.2) running layout, style, paint and composite stages\n\t// 6) committing: running all updated useEffect hooks\n\t//\n\t// Note that React might sometimes schedule step 6 before step 5 if e.g. layout effects trigger a state update,\n\t// or if a user interacts with the page: https://jser.dev/2023-08-09-effects-run-paint/\n\t//\n\t// The timings below correspond to these main stages of hydration.\n\t//\n\tReactRender = \"framer-hydration-render\",\n\tReactRender_Start = \"framer-hydration-render-start\",\n\tReactRender_End = \"framer-hydration-render-end\",\n\n\tMutationEffects = \"framer-hydration-commit\",\n\n\tUseInsertionEffects = \"framer-hydration-insertion-effects\",\n\tUseInsertionEffects_Start = \"framer-hydration-insertion-effects-start\",\n\t/** Indicates that the router insertion effects have started running. */\n\tUseInsertionEffect_RouterStart = \"framer-hydration-router-insertion-effect\",\n\tUseInsertionEffects_End = \"framer-hydration-insertion-effects-end\",\n\n\tUseLayoutEffects = \"framer-hydration-layout-effects\",\n\tUseLayoutEffects_Start = \"framer-hydration-layout-effects-start\",\n\t/** Indicates that the router layout effects have started running. */\n\tUseLayoutEffect_RouterStart = \"framer-hydration-router-layout-effect\",\n\tUseLayoutEffects_End = \"framer-hydration-layout-effects-end\",\n\n\t// The browser render stage is split into multiple substeps because we want to measure these individual substeps.\n\t/** A performance mark for when the browser starts running requestAnimationFrame callbacks. This indicates that stages 2-4 (and, possibly, 6) are done. */\n\tBrowserRender_RafStart = \"framer-hydration-browser-render-start\",\n\t/** A performance mark for when all requestAnimationFrame callbacks scheduled during hydration have finished running. */\n\tBrowserRender_RafEnd = \"framer-hydration-browser-raf-end\",\n\t/** A performance measure indicating how long requestAnimationFrames took to run. */\n\tBrowserRender_RafDuration = \"framer-hydration-raf\",\n\t/** This performance mark is unused because it\u2019s effectively the same as @see BrowserRender_RafEnd. */\n\tBrowserRender_LayoutStylePaintStart = \"_unused\",\n\t/** A performance mark for when the first paint happens after committing (stages 2-4 and, possibly, 6). */\n\tBrowserRender_LayoutStylePaintEnd = \"framer-hydration-first-paint\",\n\t/** A performance measure indicating how long the layout, style, paint and composite stages of browser rendering took: https://web.dev/articles/rendering-performance#the_pixel_pipeline. */\n\tBrowserRender_LayoutStylePaintDuration = \"framer-hydration-browser-render\",\n\n\tUseEffects = \"framer-hydration-effects\",\n\tUseEffects_Start = \"framer-hydration-effects-start\",\n\t/** Indicates that the router passive effects have started running. */\n\tUseEffects_RouterStart = \"framer-hydration-router-effect\",\n\tUseEffects_End = \"framer-hydration-effects-end\",\n\n\t//\n\t// Some other notable events that also happen during the page lifecycle\n\t//\n\t/** A performance measure indicating the time from the hydration start to the end of stage 5. */\n\tTimeToFirstPaint = \"framer-hydration-time-to-first-paint\",\n\t/**\n\t * A performance mark indicating that the passive effects ran synchronously after the mutation effects \u2013 i.e. that stage 6 happened before stage 5.\n\t * This could happen if e.g. layout effects schedule a state update, or if a user interacts with the page: https://jser.dev/2023-08-09-effects-run-paint/\n\t */\n\tUseEffectsAreSynchronous = \"framer-hydration-effects-sync\",\n\t/**\n\t * UHO: Unattributed hydration overhead, which measures the time between before the first paint and start of first paint.\n\t * This timing might also measure some other requestAnimationFrame callbacks.\n\t */\n\tUnattributedHydrationOverhead = \"framer-hydration-uho\",\n}\n\nclass HydrationMarker {\n\t@onlyRunOnce\n\tprivate markRenderStart(): void {\n\t\tperformance.mark(MarkNames.Hydration_Start)\n\t}\n\t@onlyRunOnce\n\tprivate markRenderEnd(): void {\n\t\tperformance.mark(MarkNames.ReactRender_End)\n\t\tmeasureSafe(MarkNames.ReactRender, MarkNames.Hydration_Start, MarkNames.ReactRender_End)\n\t}\n\n\t@onlyRunOnce\n\tprivate markUseInsertionEffectsStart(): void {\n\t\tperformance.mark(MarkNames.UseInsertionEffects_Start)\n\t}\n\t@onlyRunOnce\n\tprivate markUseInsertionEffectRouterStart(): void {\n\t\tperformance.mark(MarkNames.UseInsertionEffect_RouterStart)\n\t}\n\t@onlyRunOnce\n\tprivate markUseInsertionEffectsEnd(): void {\n\t\tperformance.mark(MarkNames.UseInsertionEffects_End)\n\t\tmeasureSafe(MarkNames.UseInsertionEffects, MarkNames.UseInsertionEffects_Start, MarkNames.UseInsertionEffects_End)\n\t}\n\n\t@onlyRunOnce\n\tprivate markUseLayoutEffectsStart(): void {\n\t\tperformance.mark(MarkNames.UseLayoutEffects_Start)\n\t}\n\t@onlyRunOnce\n\tprivate markRouterUseLayoutEffectStart(): void {\n\t\tperformance.mark(MarkNames.UseLayoutEffect_RouterStart)\n\t}\n\t@onlyRunOnce\n\tprivate markUseLayoutEffectsEnd(): void {\n\t\tperformance.mark(MarkNames.UseLayoutEffects_End)\n\t\tmeasureSafe(MarkNames.UseLayoutEffects, MarkNames.UseLayoutEffects_Start, MarkNames.UseLayoutEffects_End)\n\t}\n\n\t@onlyRunOnce\n\tprivate markUseEffectsStart(): void {\n\t\tperformance.mark(MarkNames.UseEffects_Start)\n\t}\n\t@onlyRunOnce\n\tprivate markUseEffectsRouterStart(): void {\n\t\tperformance.mark(MarkNames.UseEffects_RouterStart)\n\t}\n\t@onlyRunOnce\n\tprivate markUseEffectsAreSynchronous(): void {\n\t\tperformance.mark(MarkNames.UseEffectsAreSynchronous)\n\t}\n\t@onlyRunOnce\n\tprivate markUseEffectsEnd(): void {\n\t\tperformance.mark(MarkNames.UseEffects_End)\n\t\t// We want to measure *only* how long the mount effects take.\n\t\t// So if there was a paint before those, we measure from the paint on, else, straight after the layout effects end.\n\t\t// see: https://jser.dev/2023-08-09-effects-run-paint/ for more info when useEffect runs before paint:\n\t\t// - on user interaction\n\t\t// - useLayoutEffect causes state updates\n\t\tmeasureSafe(\n\t\t\tMarkNames.UseEffects,\n\t\t\tperformance.getEntriesByName(MarkNames.BrowserRender_LayoutStylePaintEnd)[0]?.name ??\n\t\t\t\tperformance.getEntriesByName(MarkNames.UseEffects_Start)[0]?.name,\n\t\t\tMarkNames.UseEffects_End,\n\t\t)\n\t}\n\n\t@onlyRunOnce\n\tprivate markRafStart(): void {\n\t\tthis.browserRendering.hasStarted = true\n\t\tperformance.mark(MarkNames.BrowserRender_RafStart)\n\t}\n\t@onlyRunOnce\n\tprivate markRafEnd(): void {\n\t\tperformance.mark(MarkNames.BrowserRender_RafEnd)\n\t\tmeasureSafe(MarkNames.BrowserRender_RafDuration, MarkNames.BrowserRender_RafStart, MarkNames.BrowserRender_RafEnd)\n\t}\n\t@onlyRunOnce\n\tprivate markLayoutStylePaintEnd(): void {\n\t\tperformance.mark(MarkNames.BrowserRender_LayoutStylePaintEnd)\n\t\tmeasureSafe(MarkNames.TimeToFirstPaint, MarkNames.Hydration_Start, MarkNames.BrowserRender_LayoutStylePaintEnd)\n\n\t\tmeasureSafe(\n\t\t\tMarkNames.BrowserRender_LayoutStylePaintDuration,\n\t\t\tMarkNames.BrowserRender_RafEnd,\n\t\t\tMarkNames.BrowserRender_LayoutStylePaintEnd,\n\t\t)\n\t}\n\n\t@onlyRunOnce\n\tprivate measureMutationEffects(): void {\n\t\t// FIXME: this makes no sense, mutation effects (DOM commit) should happen before layout effects. https://github.com/framer/FramerStudio/pull/20046#discussion_r1881263771\n\t\tmeasureSafe(MarkNames.MutationEffects, MarkNames.UseLayoutEffects_End, MarkNames.UseEffects_Start)\n\t}\n\n\t@onlyRunOnce\n\tprivate measureUnattributedHydrationOverhead(): void {\n\t\tmeasureSafe(\n\t\t\tMarkNames.UnattributedHydrationOverhead,\n\t\t\t// If effects have run before the start of the render pipeline, we measure from the effects end.\n\t\t\t// If not, the paint will happen before effects run, so we measure from the layout effects end.\n\t\t\tperformance.getEntriesByName(MarkNames.UseEffects_End)[0]?.name ??\n\t\t\t\tperformance.getEntriesByName(MarkNames.UseLayoutEffects_End)[0]?.name,\n\t\t\tMarkNames.BrowserRender_RafStart,\n\t\t)\n\t}\n\n\trender = {\n\t\tmarkStart: () => this.markRenderStart(),\n\t\tmarkEnd: () => this.markRenderEnd(),\n\t}\n\n\tmutationEffects = {\n\t\tmeasure: () => this.measureMutationEffects(),\n\t}\n\n\tuseInsertionEffects = {\n\t\tmarkStart: () => this.markUseInsertionEffectsStart(),\n\t\tmarkRouterStart: () => this.markUseInsertionEffectRouterStart(),\n\t\tmarkEnd: () => this.markUseInsertionEffectsEnd(),\n\t}\n\n\tuseLayoutEffects = {\n\t\tmarkStart: () => this.markUseLayoutEffectsStart(),\n\t\tmarkRouterStart: () => this.markRouterUseLayoutEffectStart(),\n\t\tmarkEnd: () => this.markUseLayoutEffectsEnd(),\n\t}\n\n\tuseEffects = {\n\t\tmarkStart: () => this.markUseEffectsStart(),\n\t\tmarkRouterStart: () => this.markUseEffectsRouterStart(),\n\t\tmarkEnd: () => this.markUseEffectsEnd(),\n\t\tmarkAreSynchronous: () => this.markUseEffectsAreSynchronous(),\n\t}\n\n\tbrowserRendering = {\n\t\thasStarted: false,\n\t\trequestAnimationFrame: {\n\t\t\tmarkStart: () => this.markRafStart(),\n\t\t\tmarkEnd: () => this.markRafEnd(),\n\t\t},\n\t\tlayoutStylePaint: {\n\t\t\tmarkEnd: () => this.markLayoutStylePaintEnd(),\n\t\t},\n\t}\n\n\tunattributedHydrationOverhead = {\n\t\tmeasure: () => this.measureUnattributedHydrationOverhead(),\n\t}\n}\n\n/**\n * Hydration marker is defined only when the page is hydrated. It will be undefined when the page is\n * client-side-rendered (e.g. because it\u2019s unoptimized), because we only want to measure hydration timings.\n */\nlet hydrationMarker: HydrationMarker | undefined\n\nexport function markHydrationStart() {\n\thydrationMarker = new HydrationMarker()\n\thydrationMarker.render.markStart()\n}\n\nexport function useMarkRouterEffects() {\n\tuseInsertionEffect(() => {\n\t\thydrationMarker?.useInsertionEffects.markRouterStart()\n\t}, [])\n\n\tuseLayoutEffect(() => {\n\t\thydrationMarker?.useLayoutEffects.markRouterStart()\n\t}, [])\n\n\tuseEffect(() => {\n\t\thydrationMarker?.useEffects.markRouterStart()\n\t}, [])\n}\n\n/* Tracks if the tab was opened in background, which causes rAFs to run late: https://framer-team.slack.com/archives/C05V49Q4NJ2/p1733747876734559 */\nlet wasInBackground = false\n\nfunction useMarkSuspenseEffectsStart() {\n\tuseInsertionEffect(() => {\n\t\t// We mark hydration render here, because we fetch & suspend the tree during hydration.\n\t\t// Previously, we did this in `Router`. While technically correct, it is not reflecting\n\t\t// the correct timing for us, as pretty much nothing is interactive, because we suspend\n\t\t// the rest of the tree during hydration for data fetching.\n\t\t// We do this in an insertion effect to exclude the time it took to commit & paint the DOM.\n\t\thydrationMarker?.render.markEnd()\n\t\thydrationMarker?.useInsertionEffects.markStart()\n\t}, [])\n\n\tuseLayoutEffect(() => {\n\t\thydrationMarker?.useLayoutEffects.markStart()\n\n\t\tif (document.visibilityState !== \"visible\") {\n\t\t\twasInBackground = true\n\t\t\treturn\n\t\t}\n\t\tframe.read(() => {\n\t\t\thydrationMarker?.browserRendering.requestAnimationFrame.markStart()\n\t\t\thydrationMarker?.unattributedHydrationOverhead.measure()\n\t\t})\n\t}, [])\n\n\tuseEffect(() => {\n\t\thydrationMarker?.useEffects.markStart()\n\n\t\tif (!hydrationMarker?.browserRendering.hasStarted) {\n\t\t\t// If paint hasn't started yet, we can measure the time it took to commit the DOM.\n\t\t\thydrationMarker?.mutationEffects.measure()\n\t\t\t// This indicates that the effects running now are synchronous.\n\t\t\thydrationMarker?.useEffects.markAreSynchronous()\n\t\t}\n\t}, [])\n}\n\n/**\n * Use this component as last child of the most top-level Suspense as a good-enough 'callback' for the end of hydration.\n * This works, because it's the last child of the `<Suspense>` boundary so the effects are only called once the boundary resolves.\n */\nfunction useMarkSuspenseEffectEnd() {\n\tuseInsertionEffect(() => {\n\t\thydrationMarker?.useInsertionEffects.markEnd()\n\t}, [])\n\n\tuseLayoutEffect(() => {\n\t\thydrationMarker?.useLayoutEffects.markEnd()\n\n\t\tif (wasInBackground || document.visibilityState !== \"visible\") return\n\t\tframe.read(() => {\n\t\t\thydrationMarker?.browserRendering.requestAnimationFrame.markEnd()\n\n\t\t\tvoid yieldToMain().then(() => {\n\t\t\t\thydrationMarker?.browserRendering.layoutStylePaint.markEnd()\n\t\t\t})\n\t\t})\n\t}, [])\n\n\tuseEffect(() => {\n\t\thydrationMarker?.useEffects.markEnd()\n\t}, [])\n}\n\n/**\n * Use this component as the firstmost sibling of a component that suspends.\n * It marks start timings of effects that run after the other sibling unsuspends,\n * as React executes components from inside out (= most nested first).\n */\nfunction MarkSuspenseEffectsStart(): null {\n\tuseMarkSuspenseEffectsStart()\n\treturn null\n}\n\n/**\n * Use this component as last child of the most top-level Suspense as a good-enough 'callback' for the end of hydration.\n * This works, because it's the last child of the `<Suspense>` boundary so the effects are only called once the boundary resolves.\n */\nfunction MarkSuspenseEffectsEnd(): null {\n\tuseMarkSuspenseEffectEnd()\n\treturn null\n}\n\nexport const MarkSuspenseEffects = { Start: MarkSuspenseEffectsStart, End: MarkSuspenseEffectsEnd }\n", "/** A decorator that ensures a method is only run once. It returns undefined if the method has already run. */\nexport function onlyRunOnce<This, Args extends unknown[], Return>(\n\toriginalMethod: (this: This, ...args: Args) => Return,\n): (this: This, ...args: Args) => Return | undefined {\n\tlet hasRun = false\n\treturn function (this: This, ...args: Args) {\n\t\tif (hasRun) return\n\t\thasRun = true\n\t\treturn originalMethod.apply(this, args)\n\t}\n}\n", "import type React from \"react\"\nimport { Component } from \"react\"\nimport { renderPage } from \"../renderPage.tsx\"\n\nexport class NotFoundError extends Error {}\n\ninterface Props {\n\tchildren?: React.ReactNode\n\tnotFoundPage?: React.ComponentType\n\tdefaultPageStyle: React.CSSProperties\n\tforceUpdateKey: number\n}\n\ninterface State {\n\terror?: unknown\n\tforceUpdateKey: number\n}\n\n/**\n * This error boundary catches and forwards errors, unless the error is `NotFoundError`, where it will render the 404 page.\n */\nexport class NotFoundErrorBoundary extends Component<Props, State> {\n\tconstructor(props: Props) {\n\t\tsuper(props)\n\t\tthis.state = { error: undefined, forceUpdateKey: props.forceUpdateKey }\n\t}\n\n\tstatic getDerivedStateFromError(error: unknown) {\n\t\treturn { error }\n\t}\n\n\t/** Resets the error when forceUpdateKey gets bumped. */\n\tstatic getDerivedStateFromProps(nextProps: Readonly<Props>, prevState: State) {\n\t\tif (nextProps.forceUpdateKey !== prevState.forceUpdateKey) {\n\t\t\tconst newState: Partial<State> = {\n\t\t\t\tforceUpdateKey: nextProps.forceUpdateKey,\n\t\t\t}\n\t\t\tif (prevState.error) {\n\t\t\t\tnewState.error = undefined\n\t\t\t}\n\t\t\treturn newState\n\t\t}\n\t\treturn null\n\t}\n\n\toverride render() {\n\t\tif (this.state.error === undefined) {\n\t\t\treturn this.props.children\n\t\t}\n\n\t\tif (!(this.state.error instanceof NotFoundError)) {\n\t\t\tthrow this.state.error\n\t\t}\n\n\t\tconst { notFoundPage, defaultPageStyle } = this.props\n\t\tif (!notFoundPage) {\n\t\t\tthrow this.state.error\n\t\t}\n\n\t\treturn renderPage(notFoundPage, defaultPageStyle)\n\t}\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport React from \"react\"\nimport type { RouteComponent } from \"./types.ts\"\n\nexport function renderPage(Page: RouteComponent<{ style?: MotionStyle }>, defaultPageStyle: React.CSSProperties) {\n\t// Note: `data-framer-root` must match the selector in ssg/src/ssg-sandbox-renderer/worker/generatePage.ts\n\tconst props = { style: defaultPageStyle, \"data-framer-root\": \"\" }\n\treturn React.isValidElement(Page) ? React.cloneElement(Page, props) : <Page {...props} />\n}\n", "import { emptyArray } from \"@framerjs/shared/src/emptyArray.ts\"\nimport { assert } from \"../utils/assert.ts\"\nimport { pathVariablesRegExpGlobal } from \"./pathVariables.ts\"\nimport type { Locale, LocaleId, RouteId, Routes } from \"./types.ts\"\ninterface PathRoute {\n\tpath: string\n\tdepth: number\n\trouteId: string\n}\ninterface RouteInfoCache {\n\tpathRoutes: Record<string, PathRoute>\n\tpathRoutesLocalized: Record<LocaleId, Record<string, PathRoute>>\n\tpaths: PathRoute[]\n\tpathsLocalized: Record<LocaleId, PathRoute[]>\n\tlastRoutes: Routes | undefined\n}\n\nlet routeInfoCache: Readonly<RouteInfoCache> | undefined\n\nfunction getRouteInfoMemo(routes: Routes) {\n\t// Routes should always be equal by referential identity on a deployed site,\n\t// but should change in the framer preview when new routes are added or the\n\t// preview is rerendered. This should prevent needing to iterate through all\n\t// the routes every time any link is rendered on any page.\n\tif (routeInfoCache?.lastRoutes !== routes) {\n\t\tconst pathRoutes: RouteInfoCache[\"pathRoutes\"] = {}\n\t\tconst pathRoutesLocalized: RouteInfoCache[\"pathRoutesLocalized\"] = {}\n\t\tlet paths: RouteInfoCache[\"paths\"] = []\n\t\tconst pathsLocalized: RouteInfoCache[\"pathsLocalized\"] = {}\n\t\tconst lastRoutes: RouteInfoCache[\"lastRoutes\"] = routes\n\n\t\tfor (const routeId in routes) {\n\t\t\tconst route = routes[routeId]\n\t\t\tassert(route, \"route must be defined\")\n\t\t\tconst { path, pathLocalized } = route\n\n\t\t\tif (!path) continue\n\n\t\t\tconst depth = pathDepth(path)\n\t\t\tpathRoutes[path] = { path, depth, routeId }\n\n\t\t\tif (!pathLocalized) continue\n\n\t\t\tfor (const localeId in pathLocalized) {\n\t\t\t\tconst localizedPath = pathLocalized[localeId]\n\t\t\t\tassert(localizedPath, \"localizedPath must be defined\")\n\n\t\t\t\tconst localizedDepth = pathDepth(localizedPath)\n\n\t\t\t\tconst byLocale = (pathRoutesLocalized[localeId] ||= {})\n\t\t\t\tbyLocale[localizedPath] = {\n\t\t\t\t\tpath: localizedPath,\n\t\t\t\t\tdepth: localizedDepth,\n\t\t\t\t\trouteId,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpaths = Object.values(pathRoutes)\n\t\t// Sort by depth in descending order (deepest first).\n\t\tpaths.sort(({ depth: depth1 }, { depth: depth2 }) => depth2 - depth1)\n\n\t\tfor (const localeId in pathRoutesLocalized) {\n\t\t\tconst routesByPathLocalized = pathRoutesLocalized[localeId]\n\t\t\tif (!routesByPathLocalized) continue\n\n\t\t\tconst pathsForLocale = Object.values(routesByPathLocalized)\n\t\t\t// Sort by depth in descending order (deepest first).\n\t\t\tpathsForLocale.sort(({ depth: depth1 }, { depth: depth2 }) => depth2 - depth1)\n\t\t\tpathsLocalized[localeId] = pathsForLocale\n\t\t}\n\n\t\trouteInfoCache = {\n\t\t\tpathRoutes,\n\t\t\tpathRoutesLocalized,\n\t\t\tpaths,\n\t\t\tpathsLocalized,\n\t\t\tlastRoutes,\n\t\t}\n\t}\n\n\treturn {\n\t\tpathRoutes: routeInfoCache.pathRoutes,\n\t\tpaths: routeInfoCache.paths,\n\t\tpathRoutesLocalized: routeInfoCache.pathRoutesLocalized,\n\t\tpathsLocalized: routeInfoCache.pathsLocalized,\n\t}\n}\n\n/**\n * @deprecated\n * Use {@link inferInitialRouteFromPathAndLocales} instead.\n * Matching of localized paths without providing locales is not supported.\n * */\nexport function inferInitialRouteFromPath(\n\troutes: Routes,\n\tlocationPath: string,\n\tfallback: boolean = true,\n\tlocales: readonly Locale[] = emptyArray(),\n) {\n\treturn inferInitialRouteFromPathAndLocales(routes, locationPath, locales, fallback)\n}\n\nexport function inferInitialRouteFromPathAndLocales(\n\troutes: Routes,\n\tlocationPath: string,\n\tlocales: readonly Locale[],\n\tfallback: boolean = true,\n): { routeId: RouteId; localeId?: LocaleId; pathVariables?: Record<string, string> } {\n\tconst { pathRoutes, paths, pathRoutesLocalized, pathsLocalized } = getRouteInfoMemo(routes)\n\n\tlet activeLocale: Locale | undefined\n\tlet localeId: LocaleId | undefined\n\tlet hasNonDefaultLocale: boolean = false\n\n\tif (locales.length > 0) {\n\t\tconst firstPathSegment = locationPath.split(\"/\").find(Boolean)\n\t\tif (firstPathSegment) {\n\t\t\tactiveLocale = locales.find(({ slug }) => slug === firstPathSegment)\n\t\t\tif (activeLocale) {\n\t\t\t\tlocaleId = activeLocale.id\n\t\t\t\tlocationPath = locationPath.substring(activeLocale.slug.length + 1)\n\t\t\t\thasNonDefaultLocale = true\n\t\t\t}\n\t\t}\n\t\tif (!localeId) {\n\t\t\tconst defaultLocale = locales.find(({ slug }) => slug === \"\")\n\t\t\tif (defaultLocale) {\n\t\t\t\tlocaleId = defaultLocale.id\n\t\t\t}\n\t\t}\n\t}\n\n\t// Try to match the path directly to the map of route paths. This avoids\n\t// needing to iterate through every path for every rendered link on every\n\t// page.\n\n\t// If there is an exact match, confirm whether there should be path\n\t// variables. This could only happen in an extreme edge case where the\n\t// provided locationPath is `/blog/:slug`, the route path is\n\t// `/blog/:slug` and `:slug` is a valid path variable value. Otherwise\n\t// pathVariables will be `undefined` because you cannot exact match\n\t// `/blog/puppy` to `/blog/:slug`\n\n\tif (localeId && hasNonDefaultLocale) {\n\t\tconst localizedMap = pathRoutesLocalized[localeId]\n\t\tconst exactMatchForLocale = localizedMap ? localizedMap[locationPath] : undefined\n\t\tif (exactMatchForLocale) {\n\t\t\tconst match = matchPath(locationPath, exactMatchForLocale.path)\n\t\t\tif (match.isMatch) {\n\t\t\t\treturn { routeId: exactMatchForLocale.routeId, localeId, pathVariables: match.pathVariables }\n\t\t\t}\n\t\t}\n\t}\n\n\tconst exactMatch = pathRoutes[locationPath]\n\tif (exactMatch) {\n\t\tconst match = matchPath(locationPath, exactMatch.path)\n\t\tif (match.isMatch) return { routeId: exactMatch.routeId, localeId, pathVariables: match.pathVariables }\n\t}\n\n\t// If the path is not an exact match, it must be an invalid path, or include\n\t// path variables. Iterate through the routes and validate if there is a\n\t// match when replacing placeholders with values.\n\n\tif (localeId && hasNonDefaultLocale) {\n\t\tconst localizedList = pathsLocalized[localeId]\n\t\tif (localizedList) {\n\t\t\tfor (const { path, routeId } of localizedList) {\n\t\t\t\tconst match = matchPath(locationPath, path)\n\t\t\t\tif (match.isMatch) {\n\t\t\t\t\treturn { routeId, localeId, pathVariables: match.pathVariables }\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const { path, routeId } of paths) {\n\t\tconst match = matchPath(locationPath, path)\n\t\tif (match.isMatch) {\n\t\t\treturn { routeId, localeId, pathVariables: match.pathVariables }\n\t\t}\n\t}\n\t// If the function has not been flagged to fallback to the root route, or\n\t// the first route, throw an error to allow callers to know there was no\n\t// match.\n\tif (!fallback) throw new Error(\"No exact match found for path\")\n\n\tconst rootPath = pathRoutes[\"/\"]\n\tif (rootPath) return { routeId: rootPath.routeId, localeId }\n\n\t// No root path? Oh boy, let's try to render _something_.\n\tconst firstRoute = Object.keys(routes)[0]\n\tif (!firstRoute) throw new Error(\"Router should not have undefined routes\")\n\treturn { routeId: firstRoute, localeId }\n}\n\n/**\n * - \"/\" => 0\n * - \"/news\" => 1\n * - \"/news/\" => 1\n * - \"/news/michael-jackson-lives\" => 2\n */\nfunction pathDepth(path: string) {\n\tconst pathWithTrimmedSlashes = path.replace(/^\\/|\\/$/gu, \"\")\n\tif (pathWithTrimmedSlashes === \"\") return 0\n\treturn pathWithTrimmedSlashes.split(\"/\").length\n}\n\nfunction matchPath(\n\tpath: string,\n\troutePath: string,\n): { isMatch: false } | { isMatch: true; pathVariables?: Record<string, string> } {\n\t// Turn `/blog/:date/:slug` into a regexp: `/blog/([^/]+)/([^/]+)$`\n\t//\n\t// For maximum compatibility, we don't use named capture groups, and instead\n\t// manually collect the variable keys into pathVariablesKeys.\n\t//\n\t// Also note that we anchor the regexp at the end, but not at the start, to\n\t// support hosting sites at a prefix.\n\tconst pathVariablesKeys: string[] = []\n\tconst safeRoutePath = escapeStringRegExp(routePath)\n\tconst routePathRegExpString = safeRoutePath.replace(pathVariablesRegExpGlobal, (_, name) => {\n\t\tpathVariablesKeys.push(name)\n\t\treturn \"([^/]+)\"\n\t})\n\tconst routePathRegExp = new RegExp(routePathRegExpString + \"$\")\n\n\tconst matches = path.match(routePathRegExp)\n\tif (!matches) return { isMatch: false }\n\n\t// No submatches = no path variables\n\tif (matches.length === 1) return { isMatch: true }\n\n\tconst pathVariables: Record<string, string> = {}\n\tconst pathVariablesValues = matches.slice(1)\n\tfor (let i = 0; i < pathVariablesKeys.length; ++i) {\n\t\tconst key = pathVariablesKeys[i]\n\t\tif (key === undefined) continue\n\t\tconst value = pathVariablesValues[i]\n\t\tconst existingValue: string | undefined = pathVariables[key]\n\t\t// If a variable appears twice, e.g.:\n\t\t//\n\t\t//     /blog/archive-:year/:category/:year-:month-:day/:slug\n\t\t//\n\t\t// then we require that it has an identical value throughout, e.g.:\n\t\t//\n\t\t//     matches:\n\t\t//     - /blog/archive-2022/tech/2022-03-08/hello-world\n\t\t//\n\t\t//     doesn't match:\n\t\t//     - /blog/archive-1410/tech/2022-03-08/hello-world\n\t\tif (existingValue) {\n\t\t\tif (existingValue !== value) {\n\t\t\t\treturn { isMatch: false }\n\t\t\t} else {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tif (value === undefined) {\n\t\t\tthrow new Error(\"Path variable values cannot be undefined\")\n\t\t}\n\t\tpathVariables[key] = value\n\t}\n\n\treturn { isMatch: true, pathVariables }\n}\n\nfunction escapeStringRegExp(string: string) {\n\treturn string.replace(/[|\\\\{}()[\\]^$+*?.]/gu, \"\\\\$&\").replace(/-/gu, \"\\\\x2d\")\n}\n", "import type { Routes } from \"./types.ts\"\n\n/**\n * Exported for testing purposes\n */\nexport function getVariantsFromServerTiming() {\n\tif (\"PerformanceServerTiming\" in window) {\n\t\tconst serverTiming = (performance.getEntriesByType(\"navigation\")[0] as PerformanceNavigationTiming | undefined)\n\t\t\t?.serverTiming\n\t\tif (!serverTiming || serverTiming.length === 0) return new URLSearchParams()\n\n\t\t// eslint-disable-next-line framer-studio/tscompat -- We check for support via the `in` condition.\n\t\tconst entry = serverTiming.find(it => it.name === \"abtests\")\n\t\tif (!entry) return new URLSearchParams()\n\n\t\t// eslint-disable-next-line framer-studio/tscompat -- We check for support via the `in` condition.\n\t\treturn new URLSearchParams(entry.description)\n\t}\n\n\treturn new URLSearchParams()\n}\n\nfunction patchRoute(routes: Routes, abTestId: string, abTestingVariantId: string) {\n\tconst route = routes[abTestingVariantId]\n\tif (!route) return\n\n\t// This can either be the variant or the control page route\n\tconst routeId = route.abTestingParentId ?? abTestingVariantId\n\tif (!routes[routeId]) return\n\n\tconst { abTestingParentId: _, ...patchingRoute } = route\n\n\t// Make the scroll sections work for variant pages\n\tconst elements =\n\t\troutes[routeId].elements || route.elements ? { ...routes[routeId].elements, ...route.elements } : undefined\n\n\troutes[routeId] = {\n\t\t...patchingRoute,\n\t\telements,\n\t\tabTestingVariantId,\n\t\tabTestId,\n\t}\n}\n\nfunction patchRoutesFromSearchParams(routes: Routes, variants: URLSearchParams) {\n\tfor (const [abTestId, abTestingVariantId] of variants) {\n\t\tpatchRoute(routes, abTestId, abTestingVariantId)\n\t}\n}\n\n/**\n * This function removes all routes that are route variants.\n *\n * A route variant is a route that has an abTestingParentId.\n * All patched control routes have the abTestingVariantId and doesn't have abTestingParentId.\n *\n * NOTE: This function is important as the route variants have the same path as the control route, breaking the `inferInitialRouteFromPath` function.\n */\nfunction removeRoutesVariants(routes: Routes) {\n\tfor (const routeId in routes) {\n\t\tif (routes[routeId]?.abTestingParentId) {\n\t\t\tdelete routes[routeId]\n\t\t}\n\t}\n}\n\n/**\n * This function patches the initial route with the variant route.\n * This is needed in case of browsers not supporting the server-timing header (Safari older than 16.4).\n * If we don't patch it this way, the page will flicker rendering the variant route from SSG and then hydrate with the control route.\n */\nfunction patchInitialRoute(routes: Routes, routeId: string) {\n\tif (!routes[routeId]) return\n\tif (!routes[routeId].abTestingParentId) return\n\n\tconst parentId = routes[routeId].abTestingParentId\n\tconst { abTestingParentId: _, ...route } = routes[routeId]\n\n\t// Make the scroll sections work for variant pages\n\tconst elements =\n\t\troutes[parentId]?.elements || route.elements ? { ...routes[parentId]?.elements, ...route.elements } : undefined\n\n\troutes[parentId] = {\n\t\t...route,\n\t\telements,\n\t\tabTestingVariantId: routeId,\n\t}\n}\n\n/**\n * Patches the routes based on route variants provided by the server-timing header or the cookie (testing purposes).\n * It replaces the original route with the variant route, most importantly the page component, and also sets the abTestingVariantId.\n *\n * The logic in this patching is the following:\n * 1. Patch the initial route in case it's a variant route\n * 2. Retrieve the assignments from the server-timing header and cookie\n * 3. The incoming value is a map of abTestId -> variantId\n * 4. For each entry in the map:\n *    a. Retrieve the original routeId from the variant route\n *    b. Retrieve the variant route\n *    c. Replace the original route with the variant route\n * 5. Remove all variant routes to not mess with the inferInitialRouteFromPath function\n * 6. Return the resolved initial route id, so if the initial route is a variant route, it will resolve to the control route, that was already patched\n *\n * The `abTestId` and `abTestingVariantId` are set here and used in the tracking events.\n *\n * With this patching logic, the entire site won't have to know about the variant routes,\n * the pages will navigate normally \"thinking\" that they are the original route, but rendering the variant route.\n */\nexport function patchRoutesForABTesting(routes: Routes, initialRouteId?: string): string | undefined {\n\t// Skip this during SSG\n\tif (typeof window === \"undefined\") return initialRouteId\n\n\t// This is used to change the initial route id if the initial route is a variant route\n\t// As the entire navigation logic relies on the control route id, and if the variant route id is propagated to the application, it will break the navigation\n\tlet resolvedInitialRouteId = initialRouteId\n\tif (initialRouteId) {\n\t\t// This replaces the initial route with the variant route if it's a variant route\n\t\t// Becoming safe to remove the variant routes later on\n\t\tpatchInitialRoute(routes, initialRouteId)\n\n\t\tconst parentRouteId = routes[initialRouteId]?.abTestingParentId\n\t\tif (parentRouteId) {\n\t\t\tresolvedInitialRouteId = parentRouteId\n\t\t}\n\t}\n\n\tpatchRoutesFromSearchParams(routes, getVariantsFromServerTiming())\n\n\tremoveRoutesVariants(routes)\n\n\treturn resolvedInitialRouteId\n}\n", "import * as React from \"react\"\n\nexport interface Metadata {\n\ttitle?: string\n\trobots?: string\n\tviewport?: string\n}\n\n/** @public */\nexport function useMetadata(metadata: Metadata) {\n\t// Place metadata-dependent functionality here, unless ...\n\tReact.useEffect(() => {\n\t\tif (metadata.robots) {\n\t\t\tlet robotsTag = document.querySelector('meta[name=\"robots\"]')\n\t\t\tif (robotsTag) {\n\t\t\t\trobotsTag.setAttribute(\"content\", metadata.robots)\n\t\t\t} else {\n\t\t\t\trobotsTag = document.createElement(\"meta\")\n\t\t\t\trobotsTag.setAttribute(\"name\", \"robots\")\n\t\t\t\trobotsTag.setAttribute(\"content\", metadata.robots)\n\t\t\t\tdocument.head.appendChild(robotsTag)\n\t\t\t}\n\t\t}\n\t}, [metadata.robots])\n\n\t// ... it touches style or layout related DOM elements or attributes, like setting styles, classes, css variables,\n\t// etc. We want those to run before the DOM commit to reduce the amount of style/layout runs.\n\tReact.useInsertionEffect(() => {\n\t\t// The tab title is very visible on desktops, so we want it to update ASAP during navigation, otherwise it might\n\t\t// update after the loading spinner stops, which results in bad UX.\n\t\tdocument.title = metadata.title || \"\"\n\t\tif (metadata.viewport) {\n\t\t\tdocument.querySelector('meta[name=\"viewport\"]')?.setAttribute(\"content\", metadata.viewport)\n\t\t}\n\t}, [metadata.title, metadata.viewport])\n}\n", "import type { Interpolation, Interpolator } from \"../../interpolation/Interpolation.ts\"\nimport { Point } from \"../../render/types/Point.ts\"\nimport { assert } from \"../../utils/assert.ts\"\nimport type { Animator } from \"./Animator.ts\"\n\n/**\n * @public\n */\nexport enum Bezier {\n\tLinear = \"linear\",\n\tEase = \"ease\",\n\tEaseIn = \"ease-in\",\n\tEaseOut = \"ease-out\",\n\tEaseInOut = \"ease-in-out\",\n}\n\nexport const BezierDefaults: BezierOptions = {\n\tcurve: Bezier.Ease,\n\tduration: 1,\n}\n\nfunction controlPointsForCurve(curve: Bezier): ControlPoints {\n\tswitch (curve) {\n\t\tcase Bezier.Linear:\n\t\t\treturn [0, 0, 1, 1]\n\t\tcase Bezier.Ease:\n\t\t\treturn [0.25, 0.1, 0.25, 1]\n\t\tcase Bezier.EaseIn:\n\t\t\treturn [0.42, 0, 1, 1]\n\t\tcase Bezier.EaseOut:\n\t\t\treturn [0, 0, 0.58, 1]\n\t\tcase Bezier.EaseInOut:\n\t\t\treturn [0.42, 0, 0.58, 1]\n\t}\n}\n\nexport type ControlPoints = [number, number, number, number]\nexport type Curve = ControlPoints | Bezier\nexport interface BezierOptions {\n\tcurve: Curve\n\tduration: number\n}\n\n/**\n * Animator class using a bezier curve.\n * @internal\n * @deprecated Use the `transition` prop instead\n */\nexport class BezierAnimator<Value> implements Animator<Value, BezierOptions> {\n\tprivate unitBezier: UnitBezier\n\tprivate options: BezierOptions\n\n\tcurrent: Value | undefined\n\tdestination: Value | undefined\n\tinterpolator: Interpolator<Value> | undefined\n\tprogress = 0\n\tconstructor(\n\t\toptions: Partial<BezierOptions>,\n\t\tprivate interpolation: Interpolation<Value>,\n\t) {\n\t\tthis.options = { ...BezierDefaults, ...options }\n\t\tlet controlPoints: ControlPoints\n\t\tif (typeof this.options.curve === \"string\") {\n\t\t\tcontrolPoints = controlPointsForCurve(this.options.curve)\n\t\t} else {\n\t\t\tcontrolPoints = this.options.curve\n\t\t}\n\t\tconst [p1x, p1y, p2x, p2y] = controlPoints\n\t\tthis.unitBezier = new UnitBezier(Point(p1x, p1y), Point(p2x, p2y))\n\t}\n\n\tsetFrom(value: Value) {\n\t\tthis.current = value\n\t\tthis.updateInterpolator()\n\t}\n\n\tsetTo(value: Value) {\n\t\tthis.destination = value\n\t\tthis.updateInterpolator()\n\t}\n\n\tisReady(): boolean {\n\t\treturn this.interpolator !== undefined\n\t}\n\n\tupdateInterpolator() {\n\t\tif (this.current === undefined || this.destination === undefined) {\n\t\t\treturn\n\t\t}\n\t\tthis.interpolator = this.interpolation.interpolate(this.current, this.destination)\n\t}\n\n\tnext = (delta: number): Value => {\n\t\tconst { duration } = this.options\n\t\tthis.progress += delta / duration\n\t\tconst value = this.unitBezier.solve(this.progress, this.solveEpsilon(duration))\n\t\tassert(this.interpolator !== undefined, \"setFrom() or setTo() must be called before next()\")\n\t\tthis.current = this.interpolator(value)\n\t\treturn this.current\n\t}\n\n\tisFinished(): boolean {\n\t\treturn this.progress >= 1\n\t}\n\n\tsolveEpsilon(duration: number) {\n\t\treturn 1.0 / (200.0 * duration)\n\t}\n}\n\n// Based on WebKit implementation from https://github.com/WebKit/webkit/blob/master/PerformanceTests/MotionMark/resources/extensions.js#L379\nclass UnitBezier {\n\tprivate a: Point\n\tprivate b: Point\n\tprivate c: Point\n\n\tconstructor(point1: Point, point2: Point) {\n\t\t// Calculate the polynomial coefficients, implicit first and last control points are (0,0) and (1,1).\n\t\tthis.c = Point.multiply(point1, 3)\n\t\tthis.b = Point.subtract(Point.multiply(Point.subtract(point2, point1), 3), this.c)\n\t\tthis.a = Point.subtract(Point.subtract(Point(1, 1), this.c), this.b)\n\t}\n\tsolve(x: number, epsilon: number): number {\n\t\treturn this.sampleY(this.solveForT(x, epsilon))\n\t}\n\n\tsampleX(t: number): number {\n\t\t// `ax t^3 + bx t^2 + cx t' expanded using Horner's rule.\n\t\treturn ((this.a.x * t + this.b.x) * t + this.c.x) * t\n\t}\n\n\tsampleY(t: number): number {\n\t\treturn ((this.a.y * t + this.b.y) * t + this.c.y) * t\n\t}\n\n\tsampleDerivativeX(t: number): number {\n\t\treturn (3 * this.a.x * t + 2 * this.b.x) * t + this.c.x\n\t}\n\n\tsolveForT(x: number, epsilon: number): number {\n\t\tlet t0, t1, t2, x2, d2, i\n\t\tt2 = x\n\t\tfor (i = 0; i < 8; ++i) {\n\t\t\tx2 = this.sampleX(t2) - x\n\t\t\tif (Math.abs(x2) < epsilon) return t2\n\t\t\td2 = this.sampleDerivativeX(t2)\n\t\t\tif (Math.abs(d2) < epsilon) break\n\t\t\tt2 = t2 - x2 / d2\n\t\t}\n\n\t\tt0 = 0\n\t\tt1 = 1\n\t\tt2 = x\n\n\t\tif (t2 < t0) return t0\n\t\tif (t2 > t1) return t1\n\n\t\twhile (t0 < t1) {\n\t\t\tx2 = this.sampleX(t2)\n\t\t\tif (Math.abs(x2 - x) < epsilon) return t2\n\t\t\tif (x > x2) t0 = t2\n\t\t\telse t1 = t2\n\t\t\tt2 = (t1 - t0) * 0.5 + t0\n\t\t}\n\n\t\treturn t2\n\t}\n}\n", "import { Color } from \"../render/types/Color/Color.ts\"\nimport type { IncomingColor } from \"../render/types/Color/types.ts\"\nimport { ColorMixModelType } from \"../render/types/Color/types.ts\"\nimport { Interpolation } from \"./Interpolation.ts\"\n\nexport const ColorInterpolation: (type?: ColorMixModelType) => Interpolation<Color> = (\n\ttype: ColorMixModelType = ColorMixModelType.HUSL,\n) => {\n\treturn {\n\t\tinterpolate(from: IncomingColor, to: IncomingColor): (progress: number) => Color {\n\t\t\t;[from, to] = Interpolation.handleUndefined(from, to)\n\t\t\treturn Color.interpolate(Color(from), Color(to), type)\n\t\t},\n\t\tdifference(from: IncomingColor, to: IncomingColor): number {\n\t\t\treturn Color.difference(Color(from), Color(to))\n\t\t},\n\t}\n}\n", "import { Interpolation } from \"./Interpolation.ts\"\n\nexport const NoInterpolation: Interpolation<any> = {\n\tinterpolate(from: any, to: any): (progress: number) => any {\n\t\t;[from, to] = Interpolation.handleUndefined(from, to)\n\t\treturn (progress: number): number => {\n\t\t\treturn progress < 0.5 ? from : to\n\t\t}\n\t},\n\tdifference(from: any, to: any): number {\n\t\treturn from === to ? 0 : 1\n\t},\n}\n", "import type { Interpolator } from \"./Interpolation.ts\"\nimport { Interpolation } from \"./Interpolation.ts\"\n\nexport const ObjectInterpolation = <Value>(\n\tvalueInterpolation: Interpolation<Value>,\n): Interpolation<{ [key: string]: Value }> => {\n\ttype Type<T> = Record<keyof T, Value>\n\n\treturn {\n\t\tinterpolate<T>(from: Type<T>, to: Type<T>): (progress: number) => Type<T> {\n\t\t\t;[from, to] = Interpolation.handleUndefined(from, to)\n\t\t\t// We can't use a spread operator here because TypeScript doesn't understand the types\n\t\t\tconst result: Type<T> = Object.assign({}, from)\n\t\t\tconst interpolations: { [Key in keyof Type<T>]: Interpolator<Value> } = {} as any\n\t\t\tconst keys = new Set()\n\t\t\tfor (const key in from) {\n\t\t\t\tinterpolations[key] = valueInterpolation.interpolate(from[key], to[key])\n\t\t\t\tkeys.add(key)\n\t\t\t}\n\n\t\t\tfor (const key in to) {\n\t\t\t\tif (!keys.has(key)) {\n\t\t\t\t\tinterpolations[key] = valueInterpolation.interpolate(from[key], to[key])\n\t\t\t\t\tkeys.add(key)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn (progress: number): Type<T> => {\n\t\t\t\tfor (const key in interpolations) {\n\t\t\t\t\tresult[key] = interpolations[key](progress)\n\t\t\t\t}\n\t\t\t\treturn result\n\t\t\t}\n\t\t},\n\t\tdifference<T>(from: Type<T>, to: Type<T>): number {\n\t\t\t// calculate Eucleadean distance\n\t\t\tlet sum = 0\n\t\t\tfor (const key in from) {\n\t\t\t\tconst difference = valueInterpolation.difference(from[key], to[key])\n\t\t\t\tsum += Math.pow(difference, 2)\n\t\t\t}\n\t\t\treturn Math.sqrt(sum)\n\t\t},\n\t}\n}\n", "import { Color } from \"../render/types/Color/Color.ts\"\nimport { ColorMixModelType } from \"../render/types/Color/types.ts\"\nimport { ColorInterpolation } from \"./ColorInterpolation.ts\"\nimport { Interpolation, isInterpolatable } from \"./Interpolation.ts\"\nimport { NoInterpolation } from \"./NoInterpolation.ts\"\nimport { NumberInterpolation } from \"./NumberInterpolation.ts\"\nimport { ObjectInterpolation } from \"./ObjectInterpolation.ts\"\n\nexport interface InterpolationOptions {\n\tcolorModel: ColorMixModelType\n}\n\nconst DefaultInterpolationOptions: InterpolationOptions = {\n\tcolorModel: ColorMixModelType.HUSL,\n}\n\n/**\n * @internal\n */\nexport class ValueInterpolation implements Interpolation {\n\tprivate options: InterpolationOptions\n\t/**\n\t * @internal\n\t */\n\tconstructor(options: Partial<InterpolationOptions> = DefaultInterpolationOptions) {\n\t\tthis.options = { ...DefaultInterpolationOptions, ...options }\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tprotected interPolationForValue(value: any): Interpolation {\n\t\tconst type = typeof value\n\t\tif (type === \"number\") {\n\t\t\treturn NumberInterpolation\n\t\t} else if (type === \"boolean\" || type === \"function\") {\n\t\t\treturn NoInterpolation\n\t\t} else if (Color.isColor(value)) {\n\t\t\treturn ColorInterpolation(this.options.colorModel)\n\t\t} else if (type === \"object\") {\n\t\t\tif (value === null) {\n\t\t\t\treturn NoInterpolation\n\t\t\t}\n\t\t\tconst constructor = value.constructor\n\t\t\tif (constructor && isInterpolatable(constructor)) {\n\t\t\t\tconst interpolation = constructor.interpolationFor(value, this)\n\t\t\t\tif (interpolation && interpolation !== this && interpolation.constructor !== ValueInterpolation) {\n\t\t\t\t\treturn interpolation\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn ObjectInterpolation(this)\n\t\t}\n\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\tconsole.warn(`No interpolation defined for ${value}`)\n\t\treturn NoInterpolation\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tinterpolate = <T>(from: T, to: T): ((progress: number) => T) => {\n\t\t;[from, to] = Interpolation.handleUndefined(from, to)\n\t\treturn this.interPolationForValue(from).interpolate(from, to)\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tdifference = <T>(from: T, to: T): number => {\n\t\tconst interpolation = this.interPolationForValue(from)\n\t\treturn interpolation.difference(from, to)\n\t}\n}\n\n/**\n * @internal\n */\nexport const AnyInterpolation = /* @__PURE__ */ new ValueInterpolation()\n", "import { assert } from \"../../utils/assert.ts\"\nimport type { Animator } from \"./Animator.ts\"\n\nexport const Defaults = /* @__PURE__ */ (() => ({\n\tdelta: 1 / 60,\n\tmaxValues: 10000,\n}))()\n\nexport type PrecalculationOptions = typeof Defaults\n\nexport interface RequiredOptions<Value> {\n\tanimator: Animator<Value>\n}\n\nexport type Options<Value> = Partial<PrecalculationOptions> & RequiredOptions<Value>\n\n/**\n * @internal\n * @deprecated\n */\nexport class PrecalculatedAnimator<Value> implements Animator<Value, Options<Value>> {\n\tprivate animator: Animator<Value>\n\tvalues: Value[] | undefined\n\tprivate currentTime = 0\n\tprivate totalTime: number | undefined\n\tprivate options: PrecalculationOptions & RequiredOptions<Value>\n\tconstructor(options: Options<Value>) {\n\t\tthis.options = { ...Defaults, ...options }\n\t\tthis.animator = options.animator\n\t}\n\n\tprivate preCalculate() {\n\t\tif (!this.animator.isReady()) {\n\t\t\treturn\n\t\t}\n\t\tconst { delta } = this.options\n\t\tthis.values = []\n\t\twhile (!this.animator.isFinished() && this.values.length < this.options.maxValues) {\n\t\t\tlet value = this.animator.next(this.options.delta)\n\t\t\tif (typeof value === \"object\" && value) {\n\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: deprecated component\n\t\t\t\tconst object = value as any\n\t\t\t\tconst copy = { ...object }\n\t\t\t\tvalue = copy as Value\n\t\t\t}\n\t\t\tthis.values.push(value)\n\t\t}\n\t\tthis.totalTime = this.values.length * delta\n\t}\n\n\tprivate indexForTime(time: number): number {\n\t\tassert(this.values !== undefined, \"values must be set before calling indexForTime()\")\n\t\tassert(this.totalTime !== undefined, \"totalTime must be set before calling indexForTime()\")\n\t\treturn Math.max(0, Math.min(this.values.length - 1, Math.round(this.values.length * (time / this.totalTime)) - 1))\n\t}\n\n\tprivate valueForTime(time: number): Value {\n\t\tassert(this.values !== undefined, \"values must be set before calling valueForTime()\")\n\t\tconst index = this.indexForTime(time)\n\t\t// indexForTime ensures the next index stays in bound, so it is safe to\n\t\t// cast the return type here.\n\t\tconst value = this.values[index] as Value\n\t\treturn value\n\t}\n\n\tsetFrom(value: Value): void {\n\t\tthis.animator.setFrom(value)\n\t\tthis.preCalculate()\n\t}\n\n\tsetTo(end: Value): void {\n\t\tthis.animator.setTo(end)\n\t\tthis.preCalculate()\n\t}\n\n\tisReady(): boolean {\n\t\tassert(this.totalTime !== undefined, \"totalTime must be set before calling isReady()\")\n\t\treturn this.values !== undefined && this.values.length > 0 && this.totalTime > 0\n\t}\n\n\tnext(delta: number): Value {\n\t\tthis.currentTime += delta\n\t\treturn this.valueForTime(this.currentTime)\n\t}\n\n\tisFinished(): boolean {\n\t\tassert(this.totalTime !== undefined, \"totalTime must be set before calling isFinished()\")\n\t\treturn this.totalTime === 0 || this.currentTime >= this.totalTime\n\t}\n\n\tget endValue(): Value {\n\t\tthis.preCalculate()\n\t\tassert(this.totalTime !== undefined, \"expecting totalTime to be set after calling preCalculate()\")\n\t\tconst value = this.valueForTime(this.totalTime)\n\t\tassert(this.values !== undefined, \"expecting values to be set after calling preCalculate()\")\n\t\treturn this.values.length > 0 ? value : this.animator.next(0)\n\t}\n}\n", "import type { Interpolation, InterpolationOptions } from \"../interpolation/index.ts\"\nimport { ValueInterpolation } from \"../interpolation/index.ts\"\nimport { ColorMixModelType } from \"../render/types/Color/types.ts\"\nimport { isMotionValue } from \"../render/utils/isMotionValue.ts\"\nimport type { DeprecatedAnimationTarget } from \"./Animatable/Animatable.ts\"\nimport { Animatable, isAnimatable } from \"./Animatable/Animatable.ts\"\nimport type { AnimatorClass, Animator as AnimatorInterface } from \"./Animators/Animator.ts\"\nimport { BezierAnimator } from \"./Animators/BezierAnimator.ts\"\nimport { PrecalculatedAnimator } from \"./Animators/PrecalculatedAnimator.ts\"\nimport type { AnimationDriver, DriverClass } from \"./Drivers/AnimationDriver.ts\"\nimport { MainLoopAnimationDriver } from \"./Drivers/MainLoopDriver.ts\"\n\ntype TargetObject<T> = { [K in keyof T]: T[K] | Animatable<T[K]> }\n\nexport type FramerAnimationState = \"idle\" | \"running\" | \"finished\"\n\n/**\n * @deprecated Use {@link FrameProps.transition} instead\n */\nexport interface DeprecatedAnimationOptions<Value> extends InterpolationOptions {\n\t/**\n\t * @internal\n\t */\n\tcustomInterpolation?: Interpolation<Value>\n\t/**\n\t * @internal\n\t */\n\tprecalculate: boolean\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: deprecated const\nconst DefaultDeprecatedAnimationOptions: DeprecatedAnimationOptions<any> = {\n\tprecalculate: false,\n\tcolorModel: ColorMixModelType.HUSL,\n}\n\n/**\n * The animation object returned by the {@link (animate:function)} functions\n * @remarks\n * Can be used to control a animation or wait for it to finish. You never create a FramerAnimation yourself, but store the return type from the animate function.\n * ```jsx\n * const animation = animate.ease(value, 100)\n * await animation.finished()\n * const animation = animate.spring(value, 200)\n * animation.cancel()\n * ```\n * @privateRemarks\n * This could be called just Animation, but it's type would clash with\n * javascript's native Animation: https://developer.mozilla.org/en-US/docs/Web/API/Animation\n * So if you forget the import, you would get weird errors.\n *\n * Also, this class follows the native Animation as much as possible.\n * @public\n * @deprecated Use the {@link useAnimation} hook instead\n */\nexport class FramerAnimation<Value, AnimatorOptions> {\n\t/**\n\t * @internal\n\t */\n\tprivate driver: AnimationDriver<AnimatorInterface<Value, AnimatorOptions>, Value, AnimatorOptions>\n\t/**\n\t * @internal\n\t */\n\tconstructor(\n\t\ttarget: DeprecatedAnimationTarget<Value>,\n\t\tfrom: Value,\n\t\tto: Value,\n\t\tanimatorClass?: AnimatorClass<Value, AnimatorOptions>,\n\t\toptions?: Partial<AnimatorOptions & DeprecatedAnimationOptions<Value>>,\n\t\tdriverClass: DriverClass<\n\t\t\tAnimatorInterface<Value, AnimatorOptions>,\n\t\t\tValue,\n\t\t\tAnimatorOptions\n\t\t> = MainLoopAnimationDriver,\n\t) {\n\t\tthis.resetFinishedPromise()\n\t\tconst deprecatedAnimationOptions: DeprecatedAnimationOptions<Value> = { ...DefaultDeprecatedAnimationOptions }\n\t\tconst animatorOptions: Partial<AnimatorOptions> = {}\n\t\tif (options) {\n\t\t\tObject.assign(deprecatedAnimationOptions, options)\n\t\t\tObject.assign(animatorOptions, options)\n\t\t}\n\t\tlet interpolation: Interpolation<Value>\n\t\tif (deprecatedAnimationOptions.customInterpolation) {\n\t\t\tinterpolation = deprecatedAnimationOptions.customInterpolation\n\t\t} else {\n\t\t\tinterpolation = new ValueInterpolation(options)\n\t\t}\n\t\tlet animator: AnimatorInterface<Value, AnimatorOptions>\n\t\tif (!animatorClass) {\n\t\t\tanimator = new BezierAnimator({}, interpolation)\n\t\t} else {\n\t\t\tanimator = new animatorClass(animatorOptions, interpolation)\n\t\t}\n\t\tif (deprecatedAnimationOptions.precalculate) {\n\t\t\tanimator = new PrecalculatedAnimator({ animator })\n\t\t}\n\t\tanimator.setFrom(from)\n\t\tanimator.setTo(to)\n\t\tconst updateCallback = (value: Value) => {\n\t\t\tFramerAnimation.driverCallbackHandler(target, value)\n\t\t}\n\n\t\tconst finishedCallback = (isFinished: boolean) => {\n\t\t\tif (isFinished) {\n\t\t\t\tFramerAnimation.driverCallbackHandler(target, to)\n\t\t\t\tif (this.playStateSource === \"running\") {\n\t\t\t\t\tthis.playStateValue = \"finished\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis.driver = new driverClass(animator, updateCallback, finishedCallback)\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tprivate static driverCallbackHandler<Value>(target: DeprecatedAnimationTarget<Value>, value: Value) {\n\t\tif (isAnimatable(target) || isMotionValue(target)) {\n\t\t\ttarget.set(value)\n\t\t} else {\n\t\t\tconst targetObject = target as TargetObject<Value>\n\t\t\tAnimatable.transaction(update => {\n\t\t\t\tfor (const key in targetObject) {\n\t\t\t\t\tconst targetValue = targetObject[key]\n\t\t\t\t\tif (isAnimatable(targetValue)) {\n\t\t\t\t\t\tupdate(targetValue, value[key])\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttargetObject[key] = value[key]\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tprivate playStateSource: FramerAnimationState = \"idle\"\n\n\t/**\n\t * @internal\n\t */\n\tprivate get playStateValue(): FramerAnimationState {\n\t\treturn this.playStateSource\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tprivate set playStateValue(value: FramerAnimationState) {\n\t\tif (value !== this.playStateSource) {\n\t\t\tconst oldValue = value\n\t\t\tthis.playStateSource = value\n\t\t\tswitch (value) {\n\t\t\t\tcase \"idle\":\n\t\t\t\t\tif (oldValue === \"running\") {\n\t\t\t\t\t\tthis.oncancel && this.oncancel()\n\t\t\t\t\t}\n\t\t\t\t\tthis.readyResolve && this.readyResolve()\n\t\t\t\t\tthis.resetReadyPromise()\n\t\t\t\t\tbreak\n\t\t\t\tcase \"finished\":\n\t\t\t\t\tif (oldValue === \"idle\") {\n\t\t\t\t\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\t\t\t\t\tconsole.warn(\"Bad state transition\")\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tthis.onfinish && this.onfinish()\n\t\t\t\t\tthis.finishedResolve && this.finishedResolve()\n\t\t\t\t\tbreak\n\t\t\t\tcase \"running\":\n\t\t\t\t\tthis.resetReadyPromise()\n\t\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif (oldValue === \"finished\") {\n\t\t\t\tthis.resetFinishedPromise()\n\t\t\t}\n\n\t\t\tif (value === \"finished\") {\n\t\t\t\t// Jump to idle state:\n\t\t\t\tthis.playStateValue = \"idle\"\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tget playState(): FramerAnimationState {\n\t\treturn this.playStateValue\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tonfinish: undefined | (() => void)\n\t/**\n\t * @internal\n\t */\n\toncancel: undefined | (() => void)\n\n\t/**\n\t * @internal\n\t */\n\tprivate readyPromise: Promise<void> = Promise.resolve()\n\n\t/**\n\t * @internal\n\t */\n\tprivate readyResolve: null | (() => void) = null\n\n\t/**\n\t * @internal\n\t */\n\tprivate resetReadyPromise() {\n\t\tthis.readyResolve = null\n\t\tthis.readyPromise = new Promise((resolve, reject) => {\n\t\t\tthis.readyResolve = resolve\n\t\t})\n\t}\n\n\t/**\n     * Wait for the animation to be ready to play.\n     * @remarks\n     * ```jsx\n     * const animation = animate.ease(value, 100)\n     * animation.ready().then(() => {\n     *    // Animation is ready\n     * })\n\n     * // async/await syntax\n     * const animation = animate.ease(value, 100)\n     * await animation.ready()\n     * // Animation is ready\n     * ```\n     * @returns Promise that is resolved when the animation is ready to play\n     * @public\n     */\n\tget ready(): Promise<void> {\n\t\treturn this.readyPromise\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tprivate finishedPromise: Promise<void> = Promise.resolve()\n\t/**\n\t * @internal\n\t */\n\tprivate finishedResolve: null | (() => void) = null\n\t/**\n\t * @internal\n\t */\n\t// biome-ignore lint/suspicious/noExplicitAny: deprecated\n\tprivate finishedReject: null | ((reason: any) => void) = null\n\t/**\n\t * @internal\n\t */\n\tprivate resetFinishedPromise() {\n\t\tthis.finishedResolve = null\n\t\tthis.finishedReject = null\n\t\tthis.finishedPromise = new Promise((resolve, reject) => {\n\t\t\tthis.finishedResolve = resolve\n\t\t\tthis.finishedReject = reject\n\t\t})\n\t\tthis.finishedPromise.catch(reason => {\n\t\t\t// Eat the exception that will occur when no 'reject' handler\n\t\t\t// is set.\n\t\t})\n\t}\n\n\t/**\n\t * Wait for the animation to be finished.\n\t * @remarks\n\t * ```jsx\n\t * // async/await syntax\n\t * const animation = animate.ease(value, 100)\n\t * await animation.finished()\n\t * // Animation is finished\n\t *\n\t *\n\t * const animation = animate.ease(value, 100)\n\t * animation.ready().then(() => {\n\t *    // Animation is finished\n\t * })\n\t * ```\n\t * @returns Promise that is resolved when the animation is ready to play\n\t * @public\n\t */\n\tget finished(): Promise<void> {\n\t\treturn this.finishedPromise\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tplay() {\n\t\tthis.playStateValue = \"running\"\n\t\tthis.driver.play()\n\t}\n\n\t/**\n\t * Cancels the animation if it is still running.\n\t * @remarks\n\t * ```jsx\n\t * const animation = animate.ease(value, 100, {duration: 3})\n\t * setTimeout(() => animation.cancel(), 500)\n\t * ```\n\t * @public\n\t */\n\tcancel() {\n\t\tif (this.playStateValue !== \"running\") {\n\t\t\treturn\n\t\t}\n\n\t\tthis.driver.cancel()\n\t\tif (this.playState !== \"idle\") {\n\t\t\tconst reason = \"AbortError\"\n\t\t\tthis.finishedReject && this.finishedReject(reason)\n\t\t}\n\t\tthis.playStateValue = \"idle\"\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tfinish() {\n\t\tif (this.playStateSource === \"running\") {\n\t\t\tthis.playStateValue = \"finished\"\n\t\t\tthis.driver.finish()\n\t\t}\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tisFinished() {\n\t\treturn this.playStateValue === \"finished\"\n\t}\n}\n", "import type { AnyResolvedKeyframe, IProjectionNode } from \"framer-motion\"\n\nexport const correctBorderScale = (axis: \"x\" | \"y\") => ({\n\tcorrect: (latest: AnyResolvedKeyframe, { projectionDelta, treeScale }: IProjectionNode): AnyResolvedKeyframe => {\n\t\tif (typeof latest === \"string\") latest = parseFloat(latest)\n\t\tif (latest === 0) return \"0px\"\n\t\tlet corrected = latest\n\t\tif (projectionDelta && treeScale) {\n\t\t\tcorrected = Math.round(latest / projectionDelta[axis].scale / treeScale[axis])\n\t\t\tcorrected = Math.max(corrected, 1)\n\t\t}\n\t\treturn corrected + \"px\"\n\t},\n})\n", "import { addScaleCorrector } from \"framer-motion\"\nimport type { PropsWithChildren } from \"react\"\nimport { correctBorderScale } from \"./autoValueHandlers.ts\"\n\naddScaleCorrector({\n\tborderTopWidth: correctBorderScale(\"y\"),\n\tborderLeftWidth: correctBorderScale(\"x\"),\n\tborderRightWidth: correctBorderScale(\"x\"),\n\tborderBottomWidth: correctBorderScale(\"y\"),\n})\n\n/** @public */\nexport function MotionSetup({ children }: PropsWithChildren) {\n\treturn <>{children}</>\n}\n", "import { type AnyResolvedKeyframe, type Axis, type IProjectionNode, addScaleCorrector, px } from \"framer-motion\"\nimport { isUndefined } from \"../../utils/utils.ts\"\n\nexport function patchBorderRadiusScaleCorrector() {\n\tif (isPatched) return\n\tisPatched = true\n\taddScaleCorrector(borderRadiusCorrectors)\n}\n\nlet isPatched = false\n\nconst calcPrefix = \"calc(\"\nconst separator = \"*\"\n\n// https://github.com/motiondivision/motion/blob/78681bc6fe9c1297eacec6f634bd3f13328d64a7/packages/framer-motion/src/projection/styles/scale-border-radius.ts\nconst correctBorderRadius = {\n\tcorrect: (latest: AnyResolvedKeyframe, node: IProjectionNode): AnyResolvedKeyframe => {\n\t\tif (!node.target) return latest\n\n\t\tif (typeof latest === \"string\") {\n\t\t\tif (latest.startsWith(calcPrefix)) {\n\t\t\t\tconst [candidate, ...rest] = latest.slice(calcPrefix.length).split(separator)\n\t\t\t\tif (isUndefined(candidate) || !px.test(candidate.trim())) return latest\n\t\t\t\tconst pixels = parseFloat(candidate)\n\t\t\t\tconst x = pixelsToPercent(pixels, node.target.x)\n\t\t\t\tconst y = pixelsToPercent(pixels, node.target.y)\n\t\t\t\treturn `${reWrapInCalc(x, rest)} ${reWrapInCalc(y, rest)}`\n\t\t\t}\n\n\t\t\tif (px.test(latest)) {\n\t\t\t\tlatest = parseFloat(latest)\n\t\t\t} else {\n\t\t\t\treturn latest\n\t\t\t}\n\t\t}\n\n\t\tconst x = pixelsToPercent(latest, node.target.x)\n\t\tconst y = pixelsToPercent(latest, node.target.y)\n\n\t\treturn `${x}% ${y}%`\n\t},\n}\n\nconst borderRadiusCorrectors = /* @__PURE__ */ (() => ({\n\tborderRadius: {\n\t\t...correctBorderRadius,\n\t\tapplyTo: [\"borderTopLeftRadius\", \"borderTopRightRadius\", \"borderBottomLeftRadius\", \"borderBottomRightRadius\"],\n\t},\n\tborderTopLeftRadius: correctBorderRadius,\n\tborderTopRightRadius: correctBorderRadius,\n\tborderBottomLeftRadius: correctBorderRadius,\n\tborderBottomRightRadius: correctBorderRadius,\n}))()\n\nfunction pixelsToPercent(pixels: number, axis: Axis): number {\n\tif (axis.max === axis.min) return 0\n\treturn (pixels / (axis.max - axis.min)) * 100\n}\n\nfunction reWrapInCalc(percentage: number, rest: string[]): string {\n\treturn `${calcPrefix}${percentage}%${separator}${rest.join(separator)}`\n}\n", "import type { MotionValue, ValueAnimationTransition } from \"framer-motion\"\nimport { animate } from \"framer-motion\"\nimport { warnOnce } from \"../../utils/warnOnce.ts\"\n\n/**\n * @deprecated\n * @internal\n */\nexport function startAnimation<V extends string | number>(\n\t_key: string,\n\tvalue: MotionValue<V>,\n\ttarget: V | V[],\n\ttransition: ValueAnimationTransition<V> = {},\n) {\n\twarnOnce(\n\t\t`\"startAnimation\" is unsupported. Use \"animate\" instead: https://www.framer.com/api/motion/utilities/#animate`,\n\t)\n\n\treturn new Promise<void>(resolve => {\n\t\t// @TODO: Ignored for now, but should re-check later.\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\tanimate(value, target, {\n\t\t\t...transition,\n\t\t\tonComplete: () => resolve(),\n\t\t} as ValueAnimationTransition<V>)\n\t})\n}\n", "import type { AnimationPlaybackControls, MotionValue, Spring, Transition, Tween } from \"framer-motion\"\nimport { animate as motionAnimate } from \"framer-motion\"\nimport { isMotionValue } from \"../render/utils/isMotionValue.ts\"\nimport { deprecationWarning } from \"../utils/deprecation.ts\"\nimport type { DeprecatedAnimationTarget } from \"./Animatable/Animatable.ts\"\nimport { Animatable, isAnimatable } from \"./Animatable/Animatable.ts\"\nimport type { AnimatorClass } from \"./Animators/Animator.ts\"\nimport type { BezierOptions, SpringOptions } from \"./Animators/index.ts\"\nimport { Bezier, BezierAnimator, SpringAnimator } from \"./Animators/index.ts\"\nimport type { DeprecatedAnimationOptions } from \"./FramerAnimation.ts\"\nimport { FramerAnimation } from \"./FramerAnimation.ts\"\n\n/**\n * Animate an {@link (Animatable:interface)} value to a new value.\n * @remarks\n * Recommended use is to use convenience functions from the `animate` namespace\n * instead of passing an animator. Only use this for low-level animation tweaking.\n *\n * ```jsx\n * const value = Animatable(0)\n * animate(value, 100)\n *\n * const value = Animatable({x: 0, y: 0})\n * animate(value, {x: 100, y: 100})\n * ```\n *\n * @param from - The animatable value or object to start from\n * @param to - Value to animate to\n * @param animator - Animator class to use.\n * @param options - Animation options\n * @returns Instance of {@link FramerAnimation} that can be used to control the animation\n * @public\n * @deprecated Use the {@link AnimationProps.animate} prop on {@link Frame} instead.\n */\nexport function deprecatedAnimate<Value, Options>(\n\tfrom: DeprecatedAnimationTarget<Value>,\n\tto: Value,\n\tanimator?: AnimatorClass<Value, Options>,\n\toptions?: Partial<Options & DeprecatedAnimationOptions<Value>>,\n): FramerAnimation<Value, Options> {\n\tdeprecationWarning(\"animate()\", \"2.0.0\", \"the new animation API (https://www.framer.com/api/animation/)\")\n\tconst target = from\n\tlet fromValue: Value\n\tif (isAnimatable(from) || isMotionValue(from)) {\n\t\tfromValue = from.get()\n\t} else {\n\t\tfromValue = Animatable.objectToValues(from)\n\t}\n\tconst animation = new FramerAnimation(target, fromValue, to, animator, options)\n\tanimation.play()\n\treturn animation\n}\n\ntype AnimationOptions<V> = (Tween | Spring) &\n\tAnimationPlaybackLifecycles<V> & { delay?: number; type?: \"tween\" | \"spring\" }\n\nexport type EaseOptions = Omit<BezierOptions, \"curve\">\n\ninterface AnimationPlaybackLifecycles<V> {\n\tonUpdate?: (latest: V) => void\n\tonPlay?: () => void\n\tonComplete?: () => void\n\tonRepeat?: () => void\n\tonStop?: () => void\n}\n\n/**\n * @public\n * @deprecated Use the {@link MotionProps.animate} prop on {@link Frame} instead.\n */\nexport const animate = /* @__PURE__ */ (() => {\n\t// TODO: When removing support for the deprecated API, simply delete this entire file as `framer-motion` is exported in its entirety.\n\t/**\n\t * Animate a single value or a `MotionValue`.\n\t *\n\t * The first argument is either a `MotionValue` to animate, or an initial animation value.\n\t *\n\t * The second is either a value to animate to, or an array of keyframes to animate through.\n\t *\n\t * The third argument can be either tween or spring options, and optional lifecycle methods: `onUpdate`, `onPlay`, `onComplete`, `onRepeat` and `onStop`.\n\t *\n\t * Returns `PlaybackControls`, currently just a `stop` method.\n\t *\n\t * ```javascript\n\t * const x = useMotionValue(0)\n\t *\n\t * useEffect(() => {\n\t *   const controls = animate(x, 100, {\n\t *     type: \"spring\",\n\t *     stiffness: 2000,\n\t *     onComplete: v => {}\n\t *   })\n\t *\n\t *   return controls.stop\n\t * })\n\t * ```\n\t *\n\t * @public\n\t *\n\t * @deprecated\n\t */\n\tfunction animate<Value, Options>(\n\t\tfrom: Animatable<Value>,\n\t\tto: Value,\n\t\tanimator?: AnimatorClass<Value, Options>,\n\t\toptions?: Partial<Options & DeprecatedAnimationOptions<Value>>,\n\t): FramerAnimation<Value, Options>\n\t/** @public */\n\tfunction animate<V>(\n\t\tfrom: MotionValue<V> | V,\n\t\tto: V | V[],\n\t\ttransition?: Transition & AnimationPlaybackLifecycles<V>,\n\t): AnimationPlaybackControls\n\t/** @public */\n\tfunction animate<V extends string | number, O>(\n\t\tfrom: Animatable<V> | MotionValue<V> | V,\n\t\tto: V | V[],\n\t\tanimatorOrTransition?: AnimatorClass<V, O> | (Transition & AnimationPlaybackLifecycles<V>),\n\t\toptions?: Partial<O & DeprecatedAnimationOptions<V>>,\n\t): FramerAnimation<V | V[], O> | AnimationPlaybackControls {\n\t\treturn isAnimatable(from)\n\t\t\t? deprecatedAnimate(from, to, animatorOrTransition as AnimatorClass<V | V[], O>, options)\n\t\t\t: motionAnimate(from, to, animatorOrTransition as AnimationOptions<V>)\n\t}\n\n\t/**\n\t * Animate value with a spring curve\n\t * @remarks\n\t * ```jsx\n\t * const value = Animatable(0)\n\t * animate.spring(value, 100, {tension: 100, friction: 100})\n\t *\n\t * animate.spring(value, 100, {dampingRatio: 0.5, duration: 1})\n\t * ```\n\t * @param from - Value to animate\n\t * @param to - Value to animate to\n\t * @param options - Options for the spring\n\t * These can be either `tension`, `friction`, `velocity` and `tolerance` _or_ `dampingRatio`, `duration`, `velocity` and `mass`\n\t * @returns Instance of {@link FramerAnimation} that can be used to control the animation\n\t * @deprecated Use {@link MotionProps.animate} on {@link Frame} instead.\n\t */\n\tanimate.spring = <Value>(\n\t\tfrom: Animatable<Value>,\n\t\tto: Value,\n\t\toptions?: Partial<SpringOptions & DeprecatedAnimationOptions<Value>>,\n\t): FramerAnimation<Value, SpringOptions> => {\n\t\treturn animate<Value, SpringOptions>(from, to, SpringAnimator, options)\n\t}\n\n\t/**\n\t * Animate value with a bezier curve\n\t * @remarks\n\t * ```jsx\n\t * const value = Animatable(0)\n\t * animate.bezier(value, 100, {duration: 1, curve: Bezier.EaseIn})\n\t *\n\t * animate.bezier(value, 100, {duration: 1, curve: [0.3, 0.1, 0.4, 1]})\n\t * ```\n\t * @param from - Value to animate\n\t * @param to - Value to animate to\n\t * @param options - Options for the bezier curve\n\t *\n\t * - `duration` Duration of the animation\n\t * - `curve` One of the `Bezier` enum values or an array with 4 control points\n\t *\n\t * @returns Instance of {@link FramerAnimation} that can be used to control the animation\n\t * @deprecated Use {@link MotionProps.animate} on {@link Frame} instead.\n\t */\n\tanimate.bezier = <Value>(\n\t\tfrom: Animatable<Value>,\n\t\tto: Value,\n\t\toptions?: Partial<BezierOptions & DeprecatedAnimationOptions<Value>>,\n\t): FramerAnimation<Value, BezierOptions> => {\n\t\treturn animate<Value, BezierOptions>(from, to, BezierAnimator, options)\n\t}\n\n\t/**\n\t * Animate value with a linear animation\n\t * @remarks\n\t * ```jsx\n\t * const value = Animatable(0)\n\t * animate.linear(value, 100)\n\t *\n\t * animate.linear(value, 100, {duration: 1})\n\t * ```\n\t * @param from  - Value to animate\n\t * @param to - Value to animate to\n\t * @param options - The options for the animation\n\t *\n\t * - `duration` - Duration of the animation\n\t *\n\t * @returns Instance of {@link FramerAnimation} that can be used to control the animation\n\t * @deprecated Use {@link MotionProps.animate} on {@link Frame} instead.\n\t */\n\tanimate.linear = <Value>(\n\t\tfrom: Animatable<Value>,\n\t\tto: Value,\n\t\toptions?: Partial<EaseOptions & DeprecatedAnimationOptions<Value>>,\n\t): FramerAnimation<Value, BezierOptions> => {\n\t\treturn animate.bezier(from, to, { ...options, curve: Bezier.Linear })\n\t}\n\n\t/**\n\t * Animate value with a ease animation\n\t * @remarks\n\t * ```jsx\n\t * const value = Animatable(0)\n\t * animate.ease(value, 100)\n\t *\n\t * animate.ease(value, 100, {duration: 1})\n\t * ```\n\t * @param from  - Value to animate\n\t * @param to - Value to animate to\n\t * @param options - The options for the animation\n\t *\n\t * - `duration` - Duration of the animation\n\t *\n\t * @returns Instance of {@link FramerAnimation} that can be used to control the animation\n\t * @deprecated Use {@link MotionProps.animate} on {@link Frame} instead.\n\t */\n\tanimate.ease = <Value>(\n\t\tfrom: Animatable<Value>,\n\t\tto: Value,\n\t\toptions?: Partial<EaseOptions & DeprecatedAnimationOptions<Value>>,\n\t): FramerAnimation<Value, BezierOptions> => {\n\t\treturn animate.bezier(from, to, { ...options, curve: Bezier.Ease })\n\t}\n\n\t/**\n\t * Animate value with a ease in animation\n\t * @remarks\n\t * ```jsx\n\t * const value = Animatable(0)\n\t * animate.easeIn(value, 100)\n\t *\n\t * animate.easeIn(value, 100, {duration: 1})\n\t * ```\n\t * @param from  - Value to animate\n\t * @param to - Value to animate to\n\t * @param options - The options for the animation\n\t *\n\t * - `duration` - Duration of the animation\n\t *\n\t * @returns Instance of {@link FramerAnimation} that can be used to control the animation\n\t * @deprecated Use {@link MotionProps.animate} on {@link Frame} instead.\n\t */\n\tanimate.easeIn = <Value>(\n\t\tfrom: Animatable<Value>,\n\t\tto: Value,\n\t\toptions?: Partial<EaseOptions & DeprecatedAnimationOptions<Value>>,\n\t): FramerAnimation<Value, BezierOptions> => {\n\t\treturn animate.bezier(from, to, { ...options, curve: Bezier.EaseIn })\n\t}\n\n\t/**\n\t * Animate value with a ease out animation\n\t * @remarks\n\t * ```jsx\n\t * const value = Animatable(0)\n\t * animate.easeOut(value, 100)\n\t *\n\t * animate.easeOUt(value, 100, {duration: 1})\n\t * ```\n\t * @param from  - Value to animate\n\t * @param to - Value to animate to\n\t * @param options - The options for the animation\n\t *\n\t * - `duration` - Duration of the animation\n\t *\n\t * @returns Instance of {@link FramerAnimation} that can be used to control the animation\n\t * @deprecated Use {@link MotionProps.animate} on {@link Frame} instead.\n\t */\n\tanimate.easeOut = <Value>(\n\t\tfrom: Animatable<Value>,\n\t\tto: Value,\n\t\toptions?: Partial<EaseOptions & DeprecatedAnimationOptions<Value>>,\n\t): FramerAnimation<Value, BezierOptions> => {\n\t\treturn animate.bezier(from, to, { ...options, curve: Bezier.EaseOut })\n\t}\n\n\t/**\n\t * Animate value with a ease in out animation\n\t * @remarks\n\t * ```jsx\n\t * const value = Animatable(0)\n\t * animate.easeInOut(value, 100)\n\t *\n\t * animate.easeInOut(value, 100, {duration: 1})\n\t * ```\n\t * @param from  - Value to animate\n\t * @param to - Value to animate to\n\t * @param options - The options for the animation\n\t *\n\t * - `duration` - Duration of the animation\n\t *\n\t * @returns Instance of {@link FramerAnimation} that can be used to control the animation\n\t * @deprecated Use {@link MotionProps.animate} on {@link Frame} instead.\n\t */\n\tanimate.easeInOut = <Value>(\n\t\tfrom: Animatable<Value>,\n\t\tto: Value,\n\t\toptions?: Partial<EaseOptions & DeprecatedAnimationOptions<Value>>,\n\t): FramerAnimation<Value, BezierOptions> => {\n\t\treturn animate.bezier(from, to, { ...options, curve: Bezier.EaseInOut })\n\t}\n\n\treturn animate\n})()\n", "import { MotionConfig } from \"framer-motion\"\nimport type { CSSProperties } from \"react\"\nimport React, { Component } from \"react\"\nimport { useConstant } from \"../../components/utils/useConstant.ts\"\nimport type { Point } from \"../../render/types/Point.ts\"\nimport { safeWindow } from \"../../utils/safeWindow.ts\"\nimport { ErrorPlaceholder } from \"./ErrorPlaceholder.tsx\"\n\n// This is the \"plain\" component part of the Device Component.\n\n/**\n * @internal\n */\nexport interface DeviceOptions {\n\tdeviceWidth: number\n\tdeviceHeight: number\n\tscreenMaxHeight?: string | number\n\tnoPadding?: boolean\n\tappearance:\n\t\t| {\n\t\t\t\ttype: \"clay\"\n\t\t\t\tbezelRadius?: string\n\t\t\t\tbezelColor?: string\n\t\t\t\tbezelShadeColor?: string\n\t\t  }\n\t\t| {\n\t\t\t\ttype: \"realistic\"\n\t\t\t\timageUrl: string\n\t\t\t\timageWidth: number\n\t\t\t\timageHeight: number\n\t\t\t\trotateImage?: boolean\n\t\t  }\n\t\t| {\n\t\t\t\ttype: \"external-clay\"\n\t\t\t\timageUrl: string\n\t\t\t\timageWidth: number\n\t\t\t\timageHeight: number\n\t\t\t\trotateImage?: boolean\n\t\t  }\n\t\t| { type: \"none\" }\n\tscreenWidth: number\n\tscreenHeight: number\n\tscreenOffsetTop?: number\n\tscreenOffsetLeft?: number\n\tscreenRadius?: string\n\tscreenMaskImage?: string\n\tscreenColor?: string\n\tshadow?: string\n\thand?: {\n\t\timageUrl: string\n\t\toffsetLeft?: number\n\t\toffsetRight?: number\n\t\toffsetBottom?: number\n\t}\n\tbackground?: string\n\ttransparentBackground?: boolean\n\ttheme?: \"dark\" | \"light\"\n\n\t// FIXME: This doesn't really belong here, as the colorId is already baked\n\t// into the realistic imageUrl. We should consider refactoring the code that\n\t// uses this property, and then removing it.\n\tcolorId?: string\n}\n\ninterface ResizeObserver {\n\tobserve(target: Element): void\n\tunobserve(target: Element): void\n\tdisconnect(): void\n}\n\ninterface ScaleData {\n\tscale: number\n\tscreenScalePixelFix: number\n\tscaledComponentWidth: number\n\tscaledComponentHeight: number\n\tscaledDeviceWidth: number\n\tscaledDeviceHeight: number\n}\n\n/**\n * @internal\n */\nexport interface DeviceProps {\n\toverrideTheme?: \"dark\" | \"light\"\n\tcanResize?: boolean\n\tchildren?: React.ReactNode\n\tdeviceOptions?: DeviceOptions\n\t/**\n\t * - setting width + height will scale the component to that size\n\t * - \"dynamic\" will scale the component to the size of its container\n\t * - leaving this undefined will render the component at its intrinsic size\n\t */\n\tscaleTo?: { width: number; height: number } | \"dynamic\"\n\tResizeObserver?: {\n\t\tprototype: ResizeObserver\n\t\tnew (callback: () => void): ResizeObserver\n\t}\n}\n\nfunction getScaleData(deviceOptions: DeviceOptions, containerSize: { width: number; height: number }): ScaleData {\n\tconst { componentWidth, componentHeight } = getComponentSize(deviceOptions)\n\tconst scaleX = containerSize.width / componentWidth\n\tconst scaleY = containerSize.height / componentHeight\n\tconst scale = Math.min(scaleX, scaleY, 1)\n\n\t// temp fix for leaking pixel, see more https://github.com/framer/company/issues/20377\n\tlet screenScalePixelFix = 1\n\tif (scale < 1) {\n\t\tconst actualScreenWidth = deviceOptions.screenWidth * scale\n\t\tconst desiredScreenWidth = actualScreenWidth + 1\n\t\tconst screenScaleX = desiredScreenWidth / actualScreenWidth\n\t\tconst actualScreenHeight = deviceOptions.screenHeight * scale\n\t\tconst desiredScreenHeight = actualScreenHeight + 1\n\t\tconst screenScaleY = desiredScreenHeight / actualScreenHeight\n\t\tconst screenScale = Math.max(screenScaleX, screenScaleY)\n\t\tscreenScalePixelFix = screenScale\n\t}\n\n\treturn {\n\t\tscale,\n\t\tscreenScalePixelFix,\n\t\tscaledComponentWidth: componentWidth * scale,\n\t\tscaledComponentHeight: componentHeight * scale,\n\t\tscaledDeviceWidth: deviceOptions.deviceWidth * scale,\n\t\tscaledDeviceHeight: deviceOptions.deviceHeight * scale,\n\t}\n}\nexport function getColorsFromTheme(theme?: \"dark\" | \"light\", type?: DeviceOptions[\"appearance\"][\"type\"]) {\n\tif (type === \"none\") return {}\n\tif (!theme) return {}\n\tconst isDarkTheme = theme === \"dark\"\n\treturn {\n\t\tshadowColor: isDarkTheme ? \"rgba(0, 0, 0, 0.55)\" : \"rgba(0, 0, 0, 0.15)\",\n\t\tbezelColor: isDarkTheme ? \"#222\" : \"#fff\",\n\t\tbezelShadeColor: isDarkTheme ? \"#000\" : \"rgba(0, 0, 0, 0.2)\",\n\t\tscreenColor: isDarkTheme ? \"#333\" : \"#eee\",\n\t}\n}\n\ninterface State {\n\tlastError?: {\n\t\tcomponentStack: string[] | undefined\n\t\terror: Error\n\t}\n}\n\nexport class ErrorBoundary extends Component<{ children?: React.ReactNode }, State> {\n\toverride state: State = {}\n\toverride componentDidCatch(error: Error, info: React.ErrorInfo) {\n\t\tlet stack = info.componentStack?.split(\"\\n\").filter(line => line.length !== 0)\n\t\tlet currentIndex = 0\n\t\tif (stack) {\n\t\t\tfor (const line of stack) {\n\t\t\t\tif (line.startsWith(`    in ${this.constructor.name}`)) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcurrentIndex++\n\t\t\t}\n\t\t\tstack = stack.slice(0, currentIndex)\n\t\t}\n\n\t\tthis.setState({\n\t\t\tlastError: {\n\t\t\t\terror,\n\t\t\t\tcomponentStack: stack,\n\t\t\t},\n\t\t})\n\t}\n\n\toverride componentDidUpdate(_: unknown, prevState: State) {\n\t\tif (this.state.lastError === undefined) return\n\t\t// If `state.lastError` didn't change since the last render it means\n\t\t// that the the component was rendered due to a parent render or\n\t\t// change of props. In both these cases we want to let the wrapped\n\t\t// component try to render itself again and possibly fix the error,\n\t\t// so we clear `state.lastError`.\n\t\tif (prevState.lastError === this.state.lastError) this.setState({ lastError: undefined })\n\t}\n\toverride render() {\n\t\t// If there is an error caught by componentDidCatch, render an error\n\t\t// placeholder to prevent the error from being rethrown and crashing\n\t\t// the entire sandbox. Errors will be dismissed by\n\t\t// componentDidUpdate when the component ceases crashing as the\n\t\t// result of the file or props being updated.\n\t\tif (this.state.lastError) {\n\t\t\treturn <ErrorPlaceholder error={this.state.lastError.error.message} file=\"Prototype\" />\n\t\t}\n\n\t\treturn this.props.children\n\t}\n}\n\n/**\n * @internal\n */\nexport function Device({\n\tcanResize = false,\n\tchildren,\n\tResizeObserver = safeWindow.ResizeObserver,\n\t...options\n}: DeviceProps) {\n\t// Store options in a ref so that we can access the latest values without\n\t// invalidating our memoized resize observer callback.\n\tconst optionsRef = React.useRef<Partial<DeviceProps> | undefined>(undefined)\n\tif (optionsRef.current === undefined) optionsRef.current = options\n\n\tconst deviceAppearance = options.deviceOptions?.appearance.type\n\n\t// Scale data must be kept on a ref so that we can access it in\n\t// `invertScale` without updating state.\n\tconst scaleDataRef = React.useRef<ScaleData>()\n\tconst containerRef = React.useRef<HTMLDivElement | null>(null)\n\tconst deviceRef = React.useRef<HTMLDivElement>(null)\n\tconst screenRef = React.useRef<HTMLDivElement>(null)\n\n\tconst updateImperativeScale = React.useCallback(({ scale, screenScalePixelFix }: ScaleData) => {\n\t\tif (!scaleDataRef.current || !deviceRef.current || !screenRef.current) return\n\n\t\tdeviceRef.current.style.transform = `scale(${scale})`\n\t\tscreenRef.current.style.transform = `scale(${screenScalePixelFix})`\n\t}, [])\n\n\tif (scaleDataRef.current === undefined && options.deviceOptions && options.scaleTo && options.scaleTo !== \"dynamic\") {\n\t\tconst scale = (scaleDataRef.current = getScaleData(options.deviceOptions, options.scaleTo))\n\t\tupdateImperativeScale(scale)\n\t}\n\n\t// To ensure magic motion transitions in descendants of the Device are properly\n\t// transformed, we must communicate the scale applied to the device\n\t// component when performing calculations.\n\tconst invertScale = React.useCallback((point: Point) => {\n\t\tif (!scaleDataRef.current) return point\n\t\tconst { scale = 1 } = scaleDataRef.current\n\t\treturn { x: point.x / scale, y: point.y / scale }\n\t}, [])\n\n\tconst updateScale = React.useCallback(() => {\n\t\tconst { deviceOptions, scaleTo } = optionsRef.current ?? {}\n\t\tif (!deviceOptions || !scaleTo || scaleTo !== \"dynamic\" || !containerRef.current) return\n\t\tif (containerRef.current.offsetWidth === 0 || containerRef.current.offsetHeight === 0) return\n\n\t\tconst scaleData = (scaleDataRef.current = getScaleData(deviceOptions, {\n\t\t\twidth: containerRef.current.offsetWidth,\n\t\t\theight: containerRef.current.offsetHeight,\n\t\t}))\n\n\t\tupdateImperativeScale(scaleData)\n\t}, [updateImperativeScale])\n\n\t// Create an observer. The callback will be a noop if `scaleTo` is not set\n\t// to \"dynamic\".\n\tconst observer: ResizeObserver | undefined = useConstant(() => {\n\t\tif (!ResizeObserver) {\n\t\t\treturn\n\t\t}\n\t\treturn new ResizeObserver(() => updateScale())\n\t})\n\n\t// Keep the options ref up to date so that the an event from the observer,\n\t// and updateScale, always use the latest prop values.\n\tReact.useLayoutEffect(() => {\n\t\toptionsRef.current = {\n\t\t\tdeviceOptions: options.deviceOptions,\n\t\t\toverrideTheme: options.overrideTheme,\n\t\t\tscaleTo: options.scaleTo,\n\t\t}\n\t}, [options.deviceOptions, options.overrideTheme, options.scaleTo])\n\n\t// Before paint, calculate the scale and imperatively set it on the element\n\t// if `scaleTo` is \"dynamic\".\n\tReact.useLayoutEffect(() => {\n\t\tupdateScale()\n\t}, [updateScale])\n\n\t// After mount, connect the observer to the container. On unmount,\n\t// disconnect the observer.\n\tReact.useEffect(() => {\n\t\tif (!observer || !containerRef.current) return\n\n\t\tobserver.observe(containerRef.current)\n\n\t\treturn () => observer.disconnect()\n\t}, [])\n\n\tconst { containerStyle, handStyle, deviceStyle, deviceImageStyle, screenStyle } = getDeviceStyle(options)\n\tconst resizeStyles = canResize\n\t\t? {\n\t\t\t\tdisplay: \"flex\",\n\t\t\t\tjustifyContent: \"center\",\n\t\t\t\talignItems: \"center\",\n\t\t\t\theight: \"100%\",\n\t\t\t}\n\t\t: {}\n\n\tconst screenBackground = options.deviceOptions?.transparentBackground ? \"transparent\" : \"white\"\n\treturn (\n\t\t<div style={{ ...containerStyle, ...resizeStyles }} ref={containerRef}>\n\t\t\t<div style={{ ...deviceStyle }} ref={deviceRef}>\n\t\t\t\t{handStyle && <div style={handStyle} />}\n\t\t\t\t{deviceAppearance === \"external-clay\" && deviceImageStyle && <div style={deviceImageStyle} />}\n\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\t...screenStyle,\n\t\t\t\t\t\tpointerEvents: undefined,\n\t\t\t\t\t\tbackgroundColor: children ? screenBackground : screenStyle.backgroundColor,\n\t\t\t\t\t}}\n\t\t\t\t\tref={screenRef}\n\t\t\t\t>\n\t\t\t\t\t<MotionConfig transformPagePoint={invertScale}>\n\t\t\t\t\t\t<ErrorBoundary>{children}</ErrorBoundary>\n\t\t\t\t\t</MotionConfig>\n\t\t\t\t</div>\n\t\t\t\t{deviceAppearance === \"realistic\" && deviceImageStyle && <div style={deviceImageStyle} />}\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n\nconst DEVICE_PADDING = 45\n\nconst HAND_IMG_WIDTH = 2400\nconst HAND_IMG_HEIGHT = 3740\nconst HAND_IMG_GAP_WIDTH = 859\nconst HAND_IMG_GAP_LEFT = 772\n// 992 is the actual measurement, but we subtract some buffer, determined empirically\nconst HAND_IMG_GAP_BOTTOM = /* @__PURE__ */ (() => 992 - 5)()\n\nconst noDeviceSize = { componentWidth: 500, componentHeight: 500 }\n/**\n * @internal\n */\nexport function getComponentSize(options?: Pick<DeviceOptions, \"deviceWidth\" | \"deviceHeight\" | \"noPadding\">): {\n\tcomponentWidth: number\n\tcomponentHeight: number\n} {\n\tif (!options) return noDeviceSize\n\tconst { deviceWidth, deviceHeight, noPadding } = options\n\tconst padding = noPadding ? 0 : DEVICE_PADDING * 2\n\treturn {\n\t\tcomponentWidth: deviceWidth + padding,\n\t\tcomponentHeight: deviceHeight + padding,\n\t}\n}\n\ninterface DeviceStyle {\n\tcontainerStyle: CSSProperties\n\thandStyle?: CSSProperties\n\tdeviceStyle: CSSProperties\n\tdeviceImageStyle?: CSSProperties\n\tscreenStyle: CSSProperties\n}\n\nfunction getDeviceStyle({ scaleTo, deviceOptions, overrideTheme }: Partial<DeviceProps> = {}): DeviceStyle {\n\tconst noDeviceStyle: DeviceStyle = { containerStyle: {}, deviceStyle: {}, screenStyle: {} }\n\tif (!deviceOptions) return noDeviceStyle\n\n\tconst { componentWidth, componentHeight } = getComponentSize(deviceOptions)\n\tconst overriddenColors = getColorsFromTheme(overrideTheme, deviceOptions.appearance.type)\n\tconst {\n\t\tdeviceWidth,\n\t\tdeviceHeight,\n\t\tappearance,\n\t\tscreenWidth,\n\t\tscreenHeight,\n\t\tscreenMaxHeight,\n\t\tscreenOffsetTop,\n\t\tscreenOffsetLeft,\n\t\tscreenRadius,\n\t\tscreenMaskImage,\n\t\tscreenColor,\n\t\tshadow,\n\t\tbackground,\n\t\thand,\n\t} = deviceOptions\n\n\tconst boxShadows: string[] = []\n\t// At this time, we only support shadow for clay devices.\n\tif (appearance.type === \"clay\" && shadow) {\n\t\tboxShadows.push(shadow)\n\t}\n\n\tlet bezelStyle: CSSProperties | undefined = undefined\n\tif (appearance.type === \"clay\") {\n\t\tbezelStyle = {\n\t\t\tborderRadius: appearance.bezelRadius,\n\t\t\tbackgroundColor: overriddenColors.bezelColor || appearance.bezelColor,\n\t\t}\n\t\tif (overriddenColors.bezelShadeColor || appearance.bezelShadeColor) {\n\t\t\tboxShadows.push(`inset 0 0 15px ${overriddenColors.bezelShadeColor || appearance.bezelShadeColor}`)\n\t\t}\n\t}\n\n\tconst handOffsetLeft = hand?.offsetLeft ?? 0\n\tconst handOffsetRight = hand?.offsetRight ?? 0\n\tconst handOffsetBottom = hand?.offsetBottom ?? 0\n\tconst handScale = (deviceWidth - handOffsetLeft - handOffsetRight) / HAND_IMG_GAP_WIDTH\n\n\treturn {\n\t\tcontainerStyle: {\n\t\t\twidth: scaleTo ? \"100%\" : componentWidth,\n\t\t\theight: scaleTo ? \"100%\" : componentHeight,\n\t\t\tflex: \"1 1 0\",\n\t\t\tdisplay: \"flex\",\n\t\t\talignItems: \"center\",\n\t\t\tjustifyContent: \"center\",\n\t\t\toverflow: \"hidden\",\n\t\t\tbackground,\n\t\t},\n\t\thandStyle: hand && {\n\t\t\twidth: HAND_IMG_WIDTH * handScale,\n\t\t\theight: HAND_IMG_HEIGHT * handScale,\n\t\t\tposition: \"absolute\",\n\t\t\tpointerEvents: \"none\",\n\t\t\tbackgroundImage: `url(\"${hand.imageUrl}\")`,\n\t\t\tbackgroundSize: \"contain\",\n\t\t\tbackgroundRepeat: \"no-repeat\",\n\t\t\tleft: -HAND_IMG_GAP_LEFT * handScale + handOffsetLeft,\n\t\t\tbottom: -HAND_IMG_GAP_BOTTOM * handScale + handOffsetBottom,\n\t\t},\n\t\tdeviceStyle: {\n\t\t\twidth: deviceWidth,\n\t\t\theight: deviceHeight,\n\t\t\tflexShrink: 0,\n\t\t\tposition: \"absolute\",\n\t\t\tboxShadow: boxShadows.join(\",\"),\n\t\t\t...bezelStyle,\n\t\t},\n\t\tdeviceImageStyle:\n\t\t\tappearance.type === \"realistic\" || appearance.type === \"external-clay\"\n\t\t\t\t? {\n\t\t\t\t\t\twidth: appearance.imageWidth,\n\t\t\t\t\t\theight: appearance.imageHeight,\n\t\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\t\tpointerEvents: \"none\",\n\t\t\t\t\t\toverflow: \"hidden\",\n\t\t\t\t\t\tbackgroundImage: `url(\"${appearance.imageUrl}\")`,\n\t\t\t\t\t\tbackgroundPosition: \"top left\",\n\t\t\t\t\t\tbackgroundRepeat: \"no-repeat\",\n\t\t\t\t\t\tbackgroundSize: `${appearance.imageWidth}px ${appearance.imageHeight}px`,\n\t\t\t\t\t\t// Rotate 90 degrees counter-clockwise around (0,0), then move the\n\t\t\t\t\t\t// result down into the viewport (rightmost transform is applied first).\n\t\t\t\t\t\ttransformOrigin: \"top left\",\n\t\t\t\t\t\ttransform: appearance.rotateImage ? `translateY(${appearance.imageWidth}px) rotate(-90deg)` : undefined,\n\t\t\t\t\t}\n\t\t\t\t: undefined,\n\t\tscreenStyle: {\n\t\t\twidth: screenWidth,\n\t\t\theight: screenHeight,\n\t\t\tmaxHeight: screenMaxHeight,\n\t\t\tposition: \"absolute\",\n\t\t\ttop: screenOffsetTop,\n\t\t\tleft: screenOffsetLeft,\n\t\t\tdisplay: \"flex\",\n\t\t\talignItems: \"center\",\n\t\t\tjustifyContent: \"center\",\n\t\t\toverflow: \"hidden\",\n\t\t\tborderRadius: screenRadius,\n\t\t\tbackgroundColor: overriddenColors.screenColor || screenColor,\n\t\t\t...(screenMaskImage && {\n\t\t\t\tmaskImage: screenMaskImage,\n\t\t\t\tWebkitMaskImage: screenMaskImage,\n\t\t\t\tmaskSize: \"contain\",\n\t\t\t\tWebkitMaskSize: \"contain\",\n\t\t\t}),\n\t\t},\n\t}\n}\n", "import type React from \"react\"\n\nenum PlaceholderType {\n\tLoading,\n\tError,\n}\n\nconst baseStyle: React.CSSProperties = {\n\tbackground: undefined,\n\tdisplay: \"flex\",\n\tflexDirection: \"column\",\n\tjustifyContent: \"center\",\n\talignItems: \"center\",\n\tlineHeight: \"1.4em\",\n\ttextOverflow: \"ellipsis\",\n\toverflow: \"hidden\",\n\tminHeight: 0,\n\twidth: \"100%\",\n\theight: \"100%\",\n}\n\nconst errorStyle: React.CSSProperties = /* @__PURE__ */ (() => ({\n\t...baseStyle,\n\tborder: \"1px solid rgba(149, 149, 149, 0.15)\",\n\tborderRadius: 6,\n\tfontSize: \"12px\",\n\tbackgroundColor: \"rgba(149, 149, 149, 0.1)\",\n\tcolor: \"#a5a5a5\",\n}))()\n\nconst textStyle: React.CSSProperties = {\n\toverflow: \"hidden\",\n\twhiteSpace: \"nowrap\",\n\ttextOverflow: \"ellipsis\",\n\tmaxWidth: \"100%\",\n\tflexShrink: 0,\n\tpadding: `0 10px`,\n}\n\nconst titleStyle: React.CSSProperties = /* @__PURE__ */ (() => ({\n\t...textStyle,\n\t// TODO: Use Fresco tokens for this.\n\tfontWeight: 500,\n}))()\n\nconst messageStyle: React.CSSProperties = /* @__PURE__ */ (() => ({\n\t...textStyle,\n\twhiteSpace: \"pre\",\n\tmaxHeight: \"calc(50% - calc(20px * var(--framerInternalCanvas-canvasPlaceholderContentScaleFactor, 1)))\",\n\tWebkitMaskImage: \"linear-gradient(to bottom, black 80%, transparent 100%)\",\n}))()\n\n// This is a stripped down version of `RenderPlaceholder` from\n// `src/app/runtime/src/components/RenderPlaceholder.tsx`. We may want to keep\n// styles in sync.\n/** @internal */\nexport function ErrorPlaceholder(props: { error: unknown; file?: string }) {\n\tconst { error, file } = props\n\tconst title = file ? `Error in ${stripSlash(file)}` : \"Error\"\n\tconst message = error instanceof Error ? error.message : \"\" + error\n\n\treturn (\n\t\t<div style={errorStyle}>\n\t\t\t<div className=\"text\" style={titleStyle}>\n\t\t\t\t{title}\n\t\t\t</div>\n\t\t\t{message && (\n\t\t\t\t<div className=\"text\" style={messageStyle}>\n\t\t\t\t\t{message}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n\nfunction stripSlash(title: string) {\n\tif (title.startsWith(\"./\")) {\n\t\treturn title.replace(\"./\", \"\")\n\t}\n\treturn title\n}\n", "import React from \"react\"\nimport { ParentSizeState, ProvideParentSize } from \"../../render/types/NewConstraints.tsx\"\nimport { ControlType } from \"../../render/types/PropertyControls.ts\"\nimport type { Size } from \"../../render/types/Size.ts\"\nimport { withLibraryCSS } from \"../../render/utils/injectComponentCSSRules.ts\"\nimport { addPropertyControls } from \"../../utils/addPropertyControls.ts\"\nimport { Device, getComponentSize } from \"./Device.tsx\"\nimport type { DeviceCodeComponentProps } from \"./DeviceCodeComponentProps.ts\"\nimport {\n\tcolorIdForTheme,\n\tconvertPropsToDeviceOptions,\n\tdefaultDeviceProps,\n\tsupportsHand,\n} from \"./DeviceCodeComponentProps.ts\"\nimport type { DevicePresetID } from \"./presets.ts\"\nimport { deviceCodeComponentPresetIds, devicePresets, getDevicePreset } from \"./presets.ts\"\nimport { usePrototypingMetaTags } from \"./usePrototypingMetaTags.ts\"\n\n// This is the \"code component\" part of the Device Component, i.e., the one that\n// we register with the component loader, and expose its props to the public as\n// property controls. Because of the latter, we need to be a bit more careful\n// about changing its props.\n//\n// Note that this module depends on the library, while the \"plain\" one doesn't.\n\n/**\n * @internal\n */\nconst DeviceCodeComponentInner: React.FunctionComponent<DeviceCodeComponentProps & Partial<Size>> =\n\t/* #__PURE__ */ withLibraryCSS(({ children, ...props }) => {\n\t\tusePrototypingMetaTags()\n\n\t\tconst deviceOptions = convertPropsToDeviceOptions(props, { forceOldClay: true })\n\n\t\tif (!deviceOptions) {\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tdata-framer-component-type=\"DeviceComponent\"\n\t\t\t\t\tclassName=\"no-device\"\n\t\t\t\t\tstyle={{ width: \"100%\", height: \"100%\" }}\n\t\t\t\t>\n\t\t\t\t\t<ProvideParentSize parentSize={ParentSizeState.Disabled}>{children}</ProvideParentSize>\n\t\t\t\t</div>\n\t\t\t)\n\t\t}\n\n\t\tconst child = Array.isArray(children) ? children[0] : children\n\t\tconst resizedChild =\n\t\t\tchild && React.isValidElement(child)\n\t\t\t\t? React.cloneElement(child as React.ReactElement<Size>, {\n\t\t\t\t\t\twidth: deviceOptions.screenWidth,\n\t\t\t\t\t\theight: deviceOptions.screenHeight,\n\t\t\t\t\t})\n\t\t\t\t: null\n\n\t\treturn (\n\t\t\t<Device scaleTo=\"dynamic\" deviceOptions={deviceOptions}>\n\t\t\t\t{resizedChild}\n\t\t\t</Device>\n\t\t)\n\t})\n\nexport const DeviceCodeComponent = /* @__PURE__ */ (() => {\n\tconst { componentWidth: defaultWidth, componentHeight: defaultHeight } = getComponentSize(\n\t\tconvertPropsToDeviceOptions(defaultDeviceProps, { forceOldClay: true }),\n\t)\n\tDeviceCodeComponentInner.defaultProps = {\n\t\twidth: defaultWidth,\n\t\theight: defaultHeight,\n\t\t...defaultDeviceProps,\n\t}\n\n\tconst deviceCodeComponentPresets = devicePresets.filter(preset => deviceCodeComponentPresetIds.includes(preset.id))\n\n\taddPropertyControls(DeviceCodeComponentInner, {\n\t\tchildren: {\n\t\t\ttitle: \"Content\",\n\t\t\ttype: ControlType.Slot,\n\t\t\tmaxCount: 1,\n\t\t},\n\t\tpreset: {\n\t\t\ttype: ControlType.Enum,\n\t\t\toptions: [\"no-device\", \"custom\"].concat(deviceCodeComponentPresets.map(preset => preset.id)),\n\t\t\toptionTitles: [\"No Device\", \"Custom\"].concat(deviceCodeComponentPresets.map(preset => preset.title)),\n\t\t},\n\t\tcustomWidth: {\n\t\t\ttitle: \"Width\",\n\t\t\ttype: ControlType.Number,\n\t\t\tmin: 0,\n\t\t\tdisplayStepper: true,\n\t\t\thidden: props => props.preset !== \"custom\",\n\t\t},\n\t\tcustomHeight: {\n\t\t\ttitle: \"Height\",\n\t\t\ttype: ControlType.Number,\n\t\t\tmin: 0,\n\t\t\tdisplayStepper: true,\n\t\t\thidden: props => props.preset !== \"custom\",\n\t\t},\n\t\tcustomBezel: {\n\t\t\ttitle: \"Bezel\",\n\t\t\ttype: ControlType.FusedNumber,\n\t\t\tmin: 0,\n\t\t\ttoggleKey: \"isMixedBezel\",\n\t\t\ttoggleTitles: [\"a\", \"b\"],\n\t\t\tvalueKeys: [\"bezelTop\", \"bezelRight\", \"bezelBottom\", \"bezelLeft\"],\n\t\t\tvalueLabels: [\"T\", \"R\", \"B\", \"L\"],\n\t\t\thidden: props => props.preset !== \"custom\",\n\t\t},\n\t\tcustomBezelRadius: {\n\t\t\ttitle: \"Bezel Radius\",\n\t\t\ttype: ControlType.Number,\n\t\t\tmin: 0,\n\t\t\tdisplayStepper: true,\n\t\t\thidden: props => props.preset !== \"custom\",\n\t\t},\n\t\tcustomScreenRadius: {\n\t\t\ttitle: \"Screen Radius\",\n\t\t\ttype: ControlType.Number,\n\t\t\tmin: 0,\n\t\t\tdisplayStepper: true,\n\t\t\thidden: props => props.preset !== \"custom\",\n\t\t},\n\t\torientation: {\n\t\t\ttype: ControlType.Enum,\n\t\t\tdisplaySegmentedControl: true,\n\t\t\toptions: [\"portrait\", \"landscape\"],\n\t\t\toptionTitles: [\"Portrait\", \"Landscape\"],\n\t\t\toptionIcons: [\"orientation-portrait\", \"orientation-landscape\"],\n\t\t\thidden: props => !!props.preset && !supportsOrientation(props.preset),\n\t\t},\n\t\tskin: {\n\t\t\ttitle: \"Device\",\n\t\t\ttype: ControlType.Enum,\n\t\t\tdisplaySegmentedControl: true,\n\t\t\toptions: [\"realistic\", \"clay\"],\n\t\t\toptionTitles: [\"Realistic\", \"Clay\"],\n\t\t\tdefaultValue: \"clay\",\n\t\t\thidden: props => !!props.preset && !supportsRealisticSkin(props.preset),\n\t\t},\n\t\ttheme: {\n\t\t\ttype: ControlType.Enum,\n\t\t\tdisplaySegmentedControl: true,\n\t\t\toptions: [\"light\", \"dark\"],\n\t\t\toptionTitles: [\"Light\", \"Dark\"],\n\t\t\thidden: props => !!props.preset && !supportsThemes(props.preset, props.skin),\n\t\t},\n\t\tshadow: {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tenabledTitle: \"On\",\n\t\t\tdisabledTitle: \"Off\",\n\t\t\thidden: ({ skin, preset }) => (preset !== \"custom\" && skin === \"realistic\") || preset === \"no-device\",\n\t\t},\n\t\thand: {\n\t\t\ttype: ControlType.Enum,\n\t\t\toptions: [null, \"hand-1\", \"hand-2\"],\n\t\t\toptionTitles: [\"None\", \"Model 1\", \"Model 2\"],\n\t\t\thidden: props => !supportsHand(props),\n\t\t},\n\t\tbackgroundColor: {\n\t\t\ttype: ControlType.Color,\n\t\t\ttitle: \"Background\",\n\t\t\toptional: true,\n\t\t\thidden: ({ preset }) => preset === \"no-device\",\n\t\t},\n\t})\n\n\treturn DeviceCodeComponentInner\n})()\n\nfunction supportsOrientation(presetId: DevicePresetID | \"custom\" | \"no-device\"): boolean {\n\tif (presetId === \"no-device\") return false\n\tif (presetId === \"custom\") return true\n\n\tconst preset = getDevicePreset(presetId)\n\treturn !preset.disableRotation\n}\n\nfunction supportsRealisticSkin(presetId: DevicePresetID | \"custom\" | \"no-device\"): boolean {\n\tif (presetId === \"custom\" || presetId === \"no-device\") return false\n\n\tconst preset = getDevicePreset(presetId)\n\treturn !!preset.realisticImage\n}\n\nfunction supportsThemes(\n\tpresetId: DevicePresetID | \"custom\" | \"no-device\",\n\tskin: \"realistic\" | \"clay\" | undefined,\n): boolean {\n\tif (presetId === \"no-device\") return false\n\tif (presetId === \"custom\" || skin !== \"realistic\") return true\n\n\tconst preset = getDevicePreset(presetId)\n\tconst realisticImage = preset.realisticImage\n\tif (realisticImage === undefined) {\n\t\t// Note: if there's no realistic image, Device Component will fall back to\n\t\t// the clay appearance, which supports themes.\n\t\treturn true\n\t}\n\tif (colorIdForTheme(\"dark\", realisticImage.availableColors) !== undefined) {\n\t\t// We assume here that every \"dark\" theme also supports a light theme (which is currently the case)\n\t\treturn true\n\t}\n\treturn false\n}\n", "import type React from \"react\"\nimport type { ColorControlDescription, ControlDescription, PropertyControls } from \"../render/types/PropertyControls.ts\"\nimport { ControlType } from \"../render/types/PropertyControls.ts\"\nimport { isArray, isBoolean, isFunction, isNumber, isObject, isString, isUndefined } from \"./utils.ts\"\n\nfunction isReactComponent(component: unknown): component is React.ComponentType {\n\t// Before we were using `instanceof React.Component` instead of `isObject` but unfortunately\n\t// that check isn't compatible with `React.forwardRef`.\n\treturn isObject(component) || isFunction(component)\n}\n\nconst optionalKey: keyof Pick<ColorControlDescription, \"optional\"> = \"optional\"\n\nfunction controlIsOptional(control: PropertyControls[string]): boolean {\n\treturn !!control && optionalKey in control && control[optionalKey] === true\n}\n\nfunction shouldBeNever(_: never) {}\n\nfunction getControlDefaultValue(control: ControlDescription): unknown {\n\ttry {\n\t\tswitch (control.type) {\n\t\t\tcase ControlType.String:\n\t\t\tcase ControlType.CollectionReference:\n\t\t\tcase ControlType.Color:\n\t\t\tcase ControlType.Date:\n\t\t\tcase ControlType.Link:\n\t\t\tcase ControlType.BoxShadow:\n\t\t\tcase ControlType.Padding:\n\t\t\tcase ControlType.BorderRadius:\n\t\t\tcase ControlType.Gap:\n\t\t\t\treturn isString(control.defaultValue) ? control.defaultValue : undefined\n\t\t\tcase ControlType.Boolean:\n\t\t\t\treturn isBoolean(control.defaultValue) ? control.defaultValue : undefined\n\t\t\tcase ControlType.Enum:\n\t\t\t\tif (isUndefined(control.defaultValue)) return undefined\n\t\t\t\treturn control.options.includes(control.defaultValue) ? control.defaultValue : undefined\n\t\t\tcase ControlType.FusedNumber:\n\t\t\tcase ControlType.Number:\n\t\t\t\treturn isNumber(control.defaultValue) ? control.defaultValue : undefined\n\t\t\tcase ControlType.Transition:\n\t\t\t\treturn isObject(control.defaultValue) ? control.defaultValue : undefined\n\t\t\tcase ControlType.Border:\n\t\t\t\treturn isObject(control.defaultValue) ? control.defaultValue : undefined\n\t\t\tcase ControlType.Font:\n\t\t\tcase ControlType.Location:\n\t\t\t\treturn isObject(control.defaultValue) ? control.defaultValue : undefined\n\t\t\tcase ControlType.LinkRelValues:\n\t\t\t\treturn isArray(control.defaultValue) ? control.defaultValue : undefined\n\t\t\tcase ControlType.MultiCollectionReference:\n\t\t\t\treturn isArray(control.defaultValue) ? control.defaultValue : undefined\n\t\t\tcase ControlType.Object: {\n\t\t\t\tconst value = isObject(control.defaultValue) ? control.defaultValue : {}\n\n\t\t\t\tif (isObject(control.controls)) {\n\t\t\t\t\tapplyControlDefaultsToDefaultProps(value, control.controls)\n\t\t\t\t}\n\n\t\t\t\treturn value\n\t\t\t}\n\t\t\tcase ControlType.Array:\n\t\t\t\treturn isArray(control.defaultValue) ? control.defaultValue : undefined\n\t\t\tcase ControlType.File:\n\t\t\tcase ControlType.Image:\n\t\t\tcase ControlType.RichText:\n\t\t\tcase ControlType.PageScope:\n\t\t\tcase ControlType.EventHandler:\n\t\t\tcase ControlType.ChangeHandler:\n\t\t\tcase ControlType.SegmentedEnum:\n\t\t\tcase ControlType.ResponsiveImage:\n\t\t\tcase ControlType.ComponentInstance:\n\t\t\tcase ControlType.Slot:\n\t\t\tcase ControlType.ScrollSectionRef:\n\t\t\tcase ControlType.CustomCursor:\n\t\t\tcase ControlType.Cursor:\n\t\t\tcase ControlType.TrackingId:\n\t\t\tcase ControlType.VectorSetItem:\n\t\t\t\treturn undefined // No default\n\n\t\t\tdefault:\n\t\t\t\t// We are not asserting because we never want this to crash. It's run while a user is coding.\n\t\t\t\tshouldBeNever(control)\n\t\t\t\treturn undefined\n\t\t}\n\t} catch {\n\t\treturn undefined\n\t}\n}\n\nfunction applyControlDefaultsToDefaultProps(defaultProps: Record<string, unknown>, controls: PropertyControls) {\n\tfor (const controlKey in controls) {\n\t\tconst control = controls[controlKey]\n\t\tif (!control) continue\n\n\t\t// Ignore if a value is already set\n\t\tconst currentDefault = defaultProps[controlKey]\n\t\tif (!isUndefined(currentDefault)) continue\n\n\t\t// Ignore if the value needs to support undefined\n\t\tif (controlIsOptional(control)) continue\n\n\t\t// Get default value from control\n\t\tconst defaultValue = getControlDefaultValue(control)\n\t\tif (isUndefined(defaultValue)) continue\n\n\t\tdefaultProps[controlKey] = defaultValue\n\t}\n}\n\nfunction getDefaultProps(component: React.ComponentType): Record<string, unknown> {\n\tif (isObject(component.defaultProps)) {\n\t\treturn component.defaultProps\n\t}\n\tconst defaultProps = {}\n\tcomponent.defaultProps = defaultProps\n\treturn defaultProps\n}\n\nexport function applyControlDefaultsToReactDefaultProps(component: unknown, controls: PropertyControls) {\n\tif (!isReactComponent(component)) return\n\tconst defaultProps = getDefaultProps(component)\n\tapplyControlDefaultsToDefaultProps(defaultProps, controls)\n}\n", "import type React from \"react\"\nimport type { AnyCollection } from \"../modules/cms/types.ts\"\nimport type { PropertyControls } from \"../render/types/PropertyControls.ts\"\nimport { applyControlDefaultsToReactDefaultProps } from \"./applyControlDefaultsToReactDefaultProps.ts\"\n\ntype HigherOrderComponent<Props> = (Component: React.ComponentType<Props>, props?: Props) => React.ComponentType<Props>\n\n/**\n * Extends component with property controls\n *\n * ```typescript\n * export const MyComponent = props => <h1>{props.header}</h1>\n *\n * addPropertyControls(MyComponent, {\n *   header:  { type: ControlType.String, title: \"Header\" },\n * })\n *\n * ```\n * @public\n */\nexport function addPropertyControls<Props = any>(\n\tcomponent: React.ComponentType<Props> | React.ForwardRefExoticComponent<Props> | HigherOrderComponent<Props>,\n\tpropertyControls: PropertyControls<Props>,\n) {\n\tObject.assign(component, { propertyControls })\n\tapplyControlDefaultsToReactDefaultProps(component, propertyControls)\n}\n\n/**\n * Get the property controls for a component\n * @param component - The component to retrieve the property controls for\n * @returns The property controls for the given component\n * @internal\n */\nexport function getPropertyControls<Props = any>(\n\tcomponent: React.ComponentType<Props> | React.ForwardRefExoticComponent<Props> | AnyCollection,\n): PropertyControls<Props> | undefined {\n\t// We need to cast the component here because the function accepts any component type by design\n\treturn (component as any).propertyControls\n}\n", "// You should probably never remove presets from here, or we risk breaking\n// projects, unless we also migrate the obsolete presets.\n/**\n * @internal\n */\nexport type DevicePresetID =\n\t// Phones\n\t| \"iphone-11\"\n\t| \"iphone-12-pro\"\n\t| \"iphone-12-pro-max\"\n\t| \"iphone-12\"\n\t| \"iphone-12-mini\"\n\t| \"iphone-11-pro\"\n\t| \"iphone-11-pro-max\"\n\t| \"iphone-8\"\n\t| \"iphone-8-plus\"\n\t| \"iphone-se\"\n\t| \"samsung-note-10\"\n\t| \"samsung-galaxy-s7\"\n\t| \"pixel-4\"\n\t| \"pixel-4-xl\"\n\t| \"pixel-5\"\n\t// Desktops and Laptops\n\t| \"macbook-air\"\n\t| \"macbook-pro-13\"\n\t| \"macbook-pro-16\"\n\t| \"imac-21-5\"\n\t| \"imac-27\"\n\t| \"pro-display-xdr\"\n\t| \"dell-xps\"\n\t| \"surface-book\"\n\t// Tablets\n\t| \"ipad\"\n\t| \"ipad-mini\"\n\t| \"ipad-air\"\n\t| \"ipad-pro-11\"\n\t| \"ipad-pro-12-9\"\n\t| \"surface-3\"\n\t| \"surface-pro-4\"\n\t// Watches\n\t| \"apple-watch-44\"\n\t| \"apple-watch-40\"\n\t// TVs\n\t| \"tv-4k\"\n\t| \"tv-full-hd\"\n\t// Deprecated\n\t| \"720p\"\n\t| \"900p\"\n\t| \"1080p\"\n\t| \"1440p\"\n\t| \"4k\"\n\nexport const defaultPresetId: DevicePresetID = \"iphone-12-pro\"\n/**\n * @internal\n */\nexport interface DeviceColor {\n\tcolorValue: string\n\ttitle: string\n\tid: string\n}\n/**\n * @internal\n */\nexport interface DevicePreset {\n\tid: DevicePresetID\n\ttitle: string\n\n\tdisableRotation?: boolean\n\n\tscreenWidth: number\n\tscreenHeight: number\n\tscreenRadius?: number\n\tscreenMask?: string\n\n\tclayBezelTop?: number\n\tclayBezelRight?: number\n\tclayBezelBottom?: number\n\tclayBezelLeft?: number\n\tclayBezelRadius?: number\n\texternalClay?: {\n\t\twidth: number\n\t\theight: number\n\t\tscreenOffsetTop: number\n\t\tscreenOffsetLeft: number\n\t}\n\n\trealisticImage?: {\n\t\twidth: number\n\t\theight: number\n\t\tscreenOffsetTop: number\n\t\tscreenOffsetLeft: number\n\t\tavailableColors?: DeviceColor[]\n\t\thandOffset?: {\n\t\t\tleft?: number\n\t\t\tright?: number\n\t\t\tbottom?: number\n\t\t}\n\t}\n}\n\n// Phones ------------------------------------------------------------------------------------------------------------------------\nconst presetsBase = /* @__PURE__ */ (() => ({\n\tiPhonePro: {\n\t\t// Screen mask takes care of the rounded screen corners for iPhones Pro,\n\t\t// and actually using a radius here produces visual artifacts in Chrome.\n\t\tscreenRadius: /* 38 */ 0,\n\t\tclayBezelLeft: 21,\n\t\tclayBezelRight: 21,\n\t\tclayBezelTop: 21,\n\t\tclayBezelBottom: 21,\n\t\tclayBezelRadius: 38 + 21,\n\t},\n\tiPhone8: {\n\t\tscreenRadius: 0,\n\t\tclayBezelLeft: 24,\n\t\tclayBezelRight: 24,\n\t\tclayBezelTop: 96,\n\t\tclayBezelBottom: 96,\n\t\tclayBezelRadius: 38 * 1.5,\n\t},\n\tiPadPro: {\n\t\tscreenRadius: 25,\n\t\tclayBezelLeft: 38,\n\t\tclayBezelRight: 38,\n\t\tclayBezelTop: 38,\n\t\tclayBezelBottom: 38,\n\t\tclayBezelRadius: 25 + 38,\n\t},\n\tdesktop: {\n\t\tclayBezelLeft: 20,\n\t\tclayBezelRight: 20,\n\t\tclayBezelTop: 20,\n\t\tclayBezelBottom: 20,\n\t\tclayBezelRadius: 20,\n\t},\n}))()\n\n/**\n * @internal\n */\nexport const devicePresets: DevicePreset[] = /* @__PURE__ */ (() => [\n\t{\n\t\tid: \"iphone-12\",\n\t\ttitle: \"iPhone 12\",\n\t\tscreenRadius: 0,\n\t\tclayBezelLeft: 22,\n\t\tclayBezelRight: 22,\n\t\tclayBezelTop: 22,\n\t\tclayBezelBottom: 22,\n\t\tclayBezelRadius: 66,\n\t\tscreenWidth: 390,\n\t\tscreenHeight: 844,\n\t\texternalClay: {\n\t\t\twidth: 500,\n\t\t\theight: 974,\n\t\t\tscreenOffsetTop: 65,\n\t\t\tscreenOffsetLeft: 55,\n\t\t},\n\t\tscreenMask:\n\t\t\t'<g style=\"transform: scale(0.5);\"><path d=\"M171.2 0c2.3 0 4 .5 5.4 1.3 1.6 1 2.8 2.2 3.7 3.8.8 1.6 1.2 2.3 1.2 4.9 0 12 2.2 19 6.2 26.5s9.8 13.3 17.3 17.4c7.5 4 15.8 6.1 30.6 6.1h311.5c14.3 0 22.5-2.2 29.9-6.1 7.5-4 13.3-10 17.3-17.4 4-7.5 6.2-14.5 6.2-26.5 0-2.6.4-3.2 1.1-4.9.8-1.6 2-2.9 3.4-3.8 1.4-.8 3.2-1.3 5.4-1.3h54.2c40.1 0 54.7 4.2 69.4 12a81.8 81.8 0 0134 34c7.8 14.7 12 29.3 12 69.4v1457.2c0 40.1-4.2 54.7-12 69.4a81.8 81.8 0 01-34 34c-14.7 7.8-29.3 12-69.4 12H115.4c-40.1 0-54.7-4.2-69.4-12a81.8 81.8 0 01-34-34c-7.8-14.7-12-29.3-12-69.4V115.4C0 75.3 4.2 60.7 12 46a81.8 81.8 0 0134-34C60.7 4.2 75.3 0 115.4 0h55.4z\" fill=\"#000\" fill-rule=\"evenodd\"/></g>',\n\t\trealisticImage: {\n\t\t\twidth: 490,\n\t\t\theight: 944,\n\t\t\tscreenOffsetLeft: 50,\n\t\t\tscreenOffsetTop: 50,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"black\", title: \"Black\", colorValue: \"#2E2C36\" },\n\t\t\t\t{ id: \"white\", title: \"White\", colorValue: \"#F7F3F0\" },\n\t\t\t\t{ id: \"blue\", title: \"Blue\", colorValue: \"#14496D\" },\n\t\t\t\t{ id: \"green\", title: \"Green\", colorValue: \"#DAF0D9\" },\n\t\t\t\t{ id: \"red\", title: \"Red\", colorValue: \"#DB4141\" },\n\t\t\t],\n\t\t\thandOffset: { left: 29, right: 29, bottom: 29 },\n\t\t},\n\t},\n\t{\n\t\tid: \"iphone-12-mini\",\n\t\ttitle: \"iPhone 12 Mini\",\n\t\tscreenRadius: 0,\n\t\tclayBezelLeft: 22,\n\t\tclayBezelRight: 22,\n\t\tclayBezelTop: 22,\n\t\tclayBezelBottom: 22,\n\t\tclayBezelRadius: 66,\n\t\tscreenWidth: 360,\n\t\tscreenHeight: 780,\n\t\texternalClay: {\n\t\t\twidth: 450,\n\t\t\theight: 890,\n\t\t\tscreenOffsetTop: 55,\n\t\t\tscreenOffsetLeft: 45,\n\t\t},\n\t\tscreenMask:\n\t\t\t'<g style=\"transform: scale(0.5);\"><path d=\"M142 18c0 19 14 47 43 48h349c31 0 44-29 44-48 0-12 4-18 14-18h18c38 0 52 4 66 11 14 8 25 19 33 33v1c7 14 11 28 11 65v1340c0 38-4 52-11 66-8 14-19 25-33 33h-1c-14 7-28 11-65 11H110c-38 0-52-4-66-11-14-8-25-19-33-33v-1c-7-13-11-27-11-64V110c0-38 4-52 11-66 8-14 19-25 33-33h1C58 4 72 0 109 0h16c11 0 17 6 17 18z\" fill=\"#000\" fill-rule=\"evenodd\"/></g>',\n\t\trealisticImage: {\n\t\t\twidth: 460,\n\t\t\theight: 880,\n\t\t\tscreenOffsetLeft: 50,\n\t\t\tscreenOffsetTop: 50,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"black\", title: \"Black\", colorValue: \"#2E2C36\" },\n\t\t\t\t{ id: \"white\", title: \"White\", colorValue: \"#F7F3F0\" },\n\t\t\t\t{ id: \"blue\", title: \"Blue\", colorValue: \"#14496D\" },\n\t\t\t\t{ id: \"green\", title: \"Green\", colorValue: \"#DAF0D9\" },\n\t\t\t\t{ id: \"red\", title: \"Red\", colorValue: \"#DB4141\" },\n\t\t\t],\n\t\t\thandOffset: { left: 31.5, right: 30.5 /* 1t */, bottom: 30 },\n\t\t},\n\t},\n\t{\n\t\tid: \"iphone-12-pro\",\n\t\ttitle: \"iPhone 12 Pro\",\n\t\tscreenRadius: 0,\n\t\tclayBezelLeft: 22,\n\t\tclayBezelRight: 22,\n\t\tclayBezelTop: 22,\n\t\tclayBezelBottom: 22,\n\t\tclayBezelRadius: 66,\n\t\tscreenWidth: 390,\n\t\tscreenHeight: 844,\n\t\texternalClay: {\n\t\t\twidth: 494,\n\t\t\theight: 968,\n\t\t\tscreenOffsetTop: 62,\n\t\t\tscreenOffsetLeft: 52,\n\t\t},\n\t\tscreenMask:\n\t\t\t'<g style=\"transform: scale(0.5);\"><path d=\"M171.2 0c2.3 0 4 .5 5.4 1.3 1.6 1 2.8 2.2 3.7 3.8.8 1.6 1.2 2.3 1.2 4.9 0 12 2.2 19 6.2 26.5s9.8 13.3 17.3 17.4c7.5 4 15.8 6.1 30.6 6.1h311.5c14.3 0 22.5-2.2 29.9-6.1 7.5-4 13.3-10 17.3-17.4 4-7.5 6.2-14.5 6.2-26.5 0-2.6.4-3.2 1.1-4.9.8-1.6 2-2.9 3.4-3.8 1.4-.8 3.2-1.3 5.4-1.3h54.2c40.1 0 54.7 4.2 69.4 12a81.8 81.8 0 0134 34c7.8 14.7 12 29.3 12 69.4v1457.2c0 40.1-4.2 54.7-12 69.4a81.8 81.8 0 01-34 34c-14.7 7.8-29.3 12-69.4 12H115.4c-40.1 0-54.7-4.2-69.4-12a81.8 81.8 0 01-34-34c-7.8-14.7-12-29.3-12-69.4V115.4C0 75.3 4.2 60.7 12 46a81.8 81.8 0 0134-34C60.7 4.2 75.3 0 115.4 0h55.4z\" fill=\"#000\" fill-rule=\"evenodd\"/></g>',\n\t\trealisticImage: {\n\t\t\twidth: 490,\n\t\t\theight: 944,\n\t\t\tscreenOffsetLeft: 50,\n\t\t\tscreenOffsetTop: 50,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"graphite\", title: \"Graphite\", colorValue: \"#585753\" },\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#E5E6E1\" },\n\t\t\t\t{ id: \"pacific-blue\", title: \"Pacific Blue\", colorValue: \"#415D6C\" },\n\t\t\t\t{ id: \"gold\", title: \"Gold\", colorValue: \"#FCECD5\" },\n\t\t\t],\n\t\t\thandOffset: { left: 29, right: 29, bottom: 29 },\n\t\t},\n\t},\n\t{\n\t\tid: \"iphone-12-pro-max\",\n\t\ttitle: \"iPhone 12 Pro Max\",\n\t\tscreenRadius: 50, // to prevent leaking pixel in the corners, see https://github.com/framer/company/issues/20429\n\t\tclayBezelLeft: 22,\n\t\tclayBezelRight: 22,\n\t\tclayBezelTop: 22,\n\t\tclayBezelBottom: 22,\n\t\tclayBezelRadius: 66,\n\t\tscreenWidth: 428,\n\t\tscreenHeight: 926,\n\t\texternalClay: {\n\t\t\twidth: 532,\n\t\t\theight: 1050,\n\t\t\tscreenOffsetTop: 62,\n\t\t\tscreenOffsetLeft: 52,\n\t\t},\n\t\tscreenMask:\n\t\t\t'<path d=\"M102 0c6 0 7 3 7 9 0 10 7 23 24 23h164c13 0 22-12 22-23 0-6 1-9 7-9h34c24 0 32 2 41 7s15 11 20 20 7 17 7 41v790c0 24-2 32-7 41s-11 15-20 20-17 7-41 7H68c-24 0-32-2-41-7s-15-11-20-20-7-17-7-41V68c0-24 2-32 7-41S18 12 27 7s17-7 41-7h34z\" fill=\"#000\" fill-rule=\"evenodd\"/>',\n\t\trealisticImage: {\n\t\t\twidth: 528,\n\t\t\theight: 1026,\n\t\t\tscreenOffsetLeft: 50,\n\t\t\tscreenOffsetTop: 50,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"graphite\", title: \"Graphite\", colorValue: \"#585753\" },\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#E5E6E1\" },\n\t\t\t\t{ id: \"pacific-blue\", title: \"Pacific Blue\", colorValue: \"#415D6C\" },\n\t\t\t\t{ id: \"gold\", title: \"Gold\", colorValue: \"#FCECD5\" },\n\t\t\t],\n\t\t\thandOffset: { left: 28.5, right: 28, bottom: 29 },\n\t\t},\n\t},\n\t{\n\t\tid: \"iphone-11\",\n\t\ttitle: \"iPhone 11\",\n\t\t// Screen mask takes care of the rounded screen corners for iPhones Pro,\n\t\t// and actually using a radius here produces visual artifacts in Chrome.\n\t\tscreenRadius: /* 38 */ 0,\n\t\tclayBezelLeft: 35.5,\n\t\tclayBezelRight: 35.5,\n\t\tclayBezelTop: 35.5,\n\t\tclayBezelBottom: 35.5,\n\t\tclayBezelRadius: 77,\n\t\tscreenWidth: 414,\n\t\tscreenHeight: 896,\n\t\texternalClay: {\n\t\t\twidth: 524,\n\t\t\theight: 1026,\n\t\t\tscreenOffsetTop: 65,\n\t\t\tscreenOffsetLeft: 55,\n\t\t},\n\t\tscreenMask:\n\t\t\t'<path d=\"M85.5 0C89.1 0 92 3 92 6.5c.3 6 1.5 10 3.4 13.5 2.2 4.1 5.5 7.4 9.6 9.6 4.2 2.2 8.9 3.4 17 3.4h170c8.1 0 12.8-1.2 17-3.4 4.1-2.2 7.4-5.5 9.6-9.6A31 31 0 00322 6.5c0-3.6 3-6.5 6.5-6.5h32.3c18.5 0 25.2 2 32 5.5 6.7 3.7 12 9 15.7 15.7 3.6 6.8 5.5 13.5 5.5 32v789.6c0 18.5-2 25.2-5.5 32-3.7 6.7-9 12-15.7 15.7-6.8 3.6-13.5 5.5-32 5.5H53.2c-18.5 0-25.2-2-32-5.5-6.7-3.7-12-9-15.7-15.7C2 868 0 861.3 0 842.8V53.2c0-18.5 2-25.2 5.5-32 3.7-6.7 9-12 15.7-15.7C28 2 34.7 0 53.2 0h32.3z\" fill=\"#000\" fill-rule=\"nonzero\"/>',\n\t\trealisticImage: {\n\t\t\twidth: 514,\n\t\t\theight: 996,\n\t\t\tscreenOffsetLeft: 50,\n\t\t\tscreenOffsetTop: 50,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"black\", title: \"Black\", colorValue: \"#202120\" },\n\t\t\t\t{ id: \"white\", title: \"White\", colorValue: \"#F9F6EF\" },\n\t\t\t\t{ id: \"purple\", title: \"Purple\", colorValue: \"#D1CDDB\" },\n\t\t\t\t{ id: \"green\", title: \"Green\", colorValue: \"#ADE0CD\" },\n\t\t\t\t{ id: \"red\", title: \"Red\", colorValue: \"#B90D2E\" },\n\t\t\t\t{ id: \"yellow\", title: \"Yellow\", colorValue: \"#FFE680\" },\n\t\t\t],\n\t\t\thandOffset: { left: 14.5, right: 14.5, bottom: 14.5 },\n\t\t},\n\t},\n\t{\n\t\tid: \"iphone-11-pro\",\n\t\ttitle: \"iPhone 11 Pro\",\n\t\t...presetsBase.iPhonePro,\n\t\tscreenWidth: 375,\n\t\tscreenHeight: 812,\n\t\texternalClay: {\n\t\t\twidth: 485,\n\t\t\theight: 942,\n\t\t\tscreenOffsetTop: 65,\n\t\t\tscreenOffsetLeft: 55,\n\t\t},\n\t\tscreenMask:\n\t\t\t'<path d=\"M292 8.668V9c0 9.266-7.07 21-23.332 21h-162C90.402 30 83.332 18.266 83.332 9v-.332c0-4.285 0-8.668-7.664-8.668H43.332C16.312 0 0 16.313 0 43.332v725.336C0 795.688 16.313 812 43.332 812h288.336c27.02 0 43.332-16.313 43.332-43.332V43.332C375 16.312 358.687 0 331.668 0h-32C292 0 292 4.383 292 8.668zm0 0\"/>',\n\t\trealisticImage: {\n\t\t\twidth: 475,\n\t\t\theight: 912,\n\t\t\tscreenOffsetLeft: 50,\n\t\t\tscreenOffsetTop: 50,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"space-grey\", title: \"Space Grey\", colorValue: \"#52514F\" },\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#EBEBE3\" },\n\t\t\t\t{ id: \"gold\", title: \"Gold\", colorValue: \"#FBD7BD\" },\n\t\t\t\t{ id: \"midnight-green\", title: \"Midnight Green\", colorValue: \"#4F5850\" },\n\t\t\t],\n\t\t\thandOffset: { left: 24.5 /* 1t */, right: 24.5 /* 1t */, bottom: 23.5 },\n\t\t},\n\t},\n\t{\n\t\tid: \"iphone-11-pro-max\",\n\t\ttitle: \"iPhone 11 Pro Max\",\n\t\t...presetsBase.iPhonePro,\n\t\tscreenWidth: 414,\n\t\tscreenHeight: 896,\n\t\texternalClay: {\n\t\t\twidth: 524,\n\t\t\theight: 1026,\n\t\t\tscreenOffsetTop: 65,\n\t\t\tscreenOffsetLeft: 55,\n\t\t},\n\t\tscreenMask:\n\t\t\t'<path d=\"M96 0c3.313 0 5.91 2.688 6 6 .18 6.645 1.191 10.148 2.938 13.41 1.917 3.586 4.73 6.402 8.316 8.317 3.586 1.918 7.441 2.941 15.445 2.941h156.602c8.004 0 11.86-1.023 15.445-2.941 3.586-1.915 6.399-4.73 8.317-8.317 1.746-3.265 2.746-6.758 2.937-13.41.094-3.313 2.688-6 6-6h46.004c17.387 0 23.687 1.809 30.043 5.21 6.355 3.4 11.344 8.388 14.742 14.743C412.191 26.31 414 32.61 414 49.996v796.008c0 17.387-1.809 23.687-5.21 30.043-3.4 6.355-8.388 11.344-14.743 14.742-6.356 3.402-12.656 5.211-30.043 5.211H49.996c-17.387 0-23.687-1.809-30.043-5.21-6.355-3.4-11.344-8.388-14.742-14.743C1.809 869.69 0 863.39 0 846.004V49.996C0 32.61 1.809 26.31 5.21 19.953c3.4-6.355 8.388-11.344 14.743-14.742C26.31 1.809 32.61 0 49.996 0zm0 0\"/>',\n\t\trealisticImage: {\n\t\t\twidth: 514,\n\t\t\theight: 996,\n\t\t\tscreenOffsetLeft: 50,\n\t\t\tscreenOffsetTop: 50,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"space-grey\", title: \"Space Grey\", colorValue: \"#52514F\" },\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#EBEBE3\" },\n\t\t\t\t{ id: \"gold\", title: \"Gold\", colorValue: \"#FBD7BD\" },\n\t\t\t\t{ id: \"midnight-green\", title: \"Midnight Green\", colorValue: \"#4F5850\" },\n\t\t\t],\n\t\t\thandOffset: { left: 23.5, right: 24.5, bottom: 24 },\n\t\t},\n\t},\n\t{\n\t\tid: \"iphone-8\",\n\t\ttitle: \"iPhone 8\",\n\t\t...presetsBase.iPhone8,\n\t\tscreenWidth: 375,\n\t\tscreenHeight: 667,\n\t\texternalClay: {\n\t\t\twidth: 491,\n\t\t\theight: 971,\n\t\t\tscreenOffsetLeft: 58,\n\t\t\tscreenOffsetTop: 152,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 475,\n\t\t\theight: 927,\n\t\t\tscreenOffsetLeft: 50,\n\t\t\tscreenOffsetTop: 130,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"space-grey\", title: \"Space Grey\", colorValue: \"#28282A\" },\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#DFE1E2\" },\n\t\t\t\t{ id: \"gold\", title: \"Gold\", colorValue: \"#F6E6DB\" },\n\t\t\t],\n\t\t\thandOffset: { left: 22, right: 22, bottom: 18.5 },\n\t\t},\n\t},\n\t{\n\t\tid: \"iphone-8-plus\",\n\t\ttitle: \"iPhone 8 Plus\",\n\t\t...presetsBase.iPhone8,\n\t\tscreenWidth: 414,\n\t\tscreenHeight: 736,\n\t\texternalClay: {\n\t\t\twidth: 530,\n\t\t\theight: 1064,\n\t\t\tscreenOffsetLeft: 58,\n\t\t\tscreenOffsetTop: 164,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 514,\n\t\t\theight: 996,\n\t\t\tscreenOffsetLeft: 50,\n\t\t\tscreenOffsetTop: 130,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"space-grey\", title: \"Space Grey\", colorValue: \"#28282A\" },\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#DFE1E2\" },\n\t\t\t\t{ id: \"gold\", title: \"Gold\", colorValue: \"#F6E6DB\" },\n\t\t\t],\n\t\t\thandOffset: { left: 21, right: 20.5 /* 1t */, bottom: 19 },\n\t\t},\n\t},\n\t{\n\t\tid: \"iphone-se\",\n\t\ttitle: \"iPhone SE\",\n\t\tscreenWidth: 320,\n\t\tscreenHeight: 568,\n\t\tscreenRadius: 0,\n\t\tclayBezelLeft: 20,\n\t\tclayBezelRight: 20,\n\t\tclayBezelTop: 112,\n\t\tclayBezelBottom: 112,\n\t\tclayBezelRadius: 38 * 1.5,\n\t\texternalClay: {\n\t\t\twidth: 436,\n\t\t\theight: 872,\n\t\t\tscreenOffsetLeft: 58,\n\t\t\tscreenOffsetTop: 152,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 420,\n\t\t\theight: 828,\n\t\t\tscreenOffsetLeft: 50,\n\t\t\tscreenOffsetTop: 130,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"space-grey\", title: \"Space Grey\", colorValue: \"#C3C4C8\" },\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#E1E2E4\" },\n\t\t\t\t{ id: \"gold\", title: \"Gold\", colorValue: \"#EFD8BD\" },\n\t\t\t\t{ id: \"rose-gold\", title: \"Rose Gold\", colorValue: \"#F7CFCA\" },\n\t\t\t],\n\t\t\thandOffset: { left: 22, right: 22, bottom: 26.5 },\n\t\t},\n\t},\n\t{\n\t\tid: \"samsung-galaxy-s7\",\n\t\ttitle: \"Samsung Galaxy S7\",\n\t\tscreenRadius: 0,\n\t\tclayBezelLeft: 22,\n\t\tclayBezelRight: 22,\n\t\tclayBezelTop: 22,\n\t\tclayBezelBottom: 22,\n\t\tclayBezelRadius: 66,\n\t\tscreenWidth: 360,\n\t\tscreenHeight: 640,\n\t\texternalClay: {\n\t\t\twidth: 454,\n\t\t\theight: 880,\n\t\t\tscreenOffsetTop: 120,\n\t\t\tscreenOffsetLeft: 47,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 440,\n\t\t\theight: 860,\n\t\t\tscreenOffsetLeft: 40,\n\t\t\tscreenOffsetTop: 110,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"black\", title: \"Black\", colorValue: \"#2E2C36\" },\n\t\t\t\t{ id: \"white\", title: \"White\", colorValue: \"#F7F3F0\" },\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#E5E6E1\" },\n\t\t\t\t{ id: \"gold\", title: \"Gold\", colorValue: \"#FCECD5\" },\n\t\t\t],\n\t\t\thandOffset: { left: 26 /* 1t */, right: 25.5 /* 1t */, bottom: 32 },\n\t\t},\n\t},\n\t// deprecated\n\t{\n\t\tid: \"samsung-note-10\",\n\t\ttitle: \"Samsung Note 10\",\n\t\tscreenWidth: 360,\n\t\tscreenHeight: 760,\n\t\tscreenRadius: 10,\n\t\tclayBezelLeft: 7,\n\t\tclayBezelRight: 7,\n\t\tclayBezelTop: 15,\n\t\tclayBezelBottom: 15,\n\t\tclayBezelRadius: 15,\n\t},\n\t{\n\t\tid: \"pixel-5\",\n\t\ttitle: \"Google Pixel 5\",\n\t\tscreenRadius: 31,\n\t\tclayBezelLeft: 22,\n\t\tclayBezelRight: 22,\n\t\tclayBezelTop: 22,\n\t\tclayBezelBottom: 22,\n\t\tclayBezelRadius: 66,\n\t\tscreenWidth: 360,\n\t\tscreenHeight: 780,\n\t\texternalClay: {\n\t\t\twidth: 460,\n\t\t\theight: 900,\n\t\t\tscreenOffsetTop: 60,\n\t\t\tscreenOffsetLeft: 50,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 920 / 2,\n\t\t\theight: 1760 / 2,\n\t\t\tscreenOffsetLeft: 100 / 2,\n\t\t\tscreenOffsetTop: 100 / 2,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"just-black\", title: \"Just Black\", colorValue: \"#2E2C36\" },\n\t\t\t\t{ id: \"sorta-sage\", title: \"Sorta Sage\", colorValue: \"#B7C9C0\" },\n\t\t\t],\n\t\t\thandOffset: { left: 31.5, right: 31 /* 1t */, bottom: 31 /* 1t */ },\n\t\t},\n\t},\n\t{\n\t\tid: \"pixel-4\",\n\t\ttitle: \"Google Pixel 4\",\n\t\tscreenWidth: 360,\n\t\tscreenHeight: 760,\n\t\tscreenRadius: 34,\n\t\tclayBezelLeft: 10,\n\t\tclayBezelRight: 10,\n\t\tclayBezelTop: 50,\n\t\tclayBezelBottom: 25,\n\t\tclayBezelRadius: 50,\n\t\texternalClay: {\n\t\t\twidth: 460,\n\t\t\theight: 938,\n\t\t\tscreenOffsetLeft: 50,\n\t\t\tscreenOffsetTop: 89,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 460,\n\t\t\theight: 920,\n\t\t\tscreenOffsetLeft: 50,\n\t\t\tscreenOffsetTop: 80,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"clearly-white\", title: \"Clearly White\", colorValue: \"#EAEDF2\" },\n\t\t\t\t{ id: \"just-black\", title: \"Just Black\", colorValue: \"#1A1A1A\" },\n\t\t\t\t{ id: \"oh-so-orange\", title: \"Oh So Orange\", colorValue: \"#FF7A68\" },\n\t\t\t],\n\t\t\thandOffset: { left: 35.5, right: 35.5 /* 1t */, bottom: 57 /* 1t */ },\n\t\t},\n\t},\n\n\t// Desktop ------------------------------------------------------------------------------------------------------------------------\n\t{\n\t\tid: \"macbook-air\",\n\t\ttitle: \"MacBook Air\",\n\t\tscreenWidth: 1440,\n\t\tscreenHeight: 900,\n\t\tdisableRotation: true,\n\t\texternalClay: {\n\t\t\twidth: 1890,\n\t\t\theight: 1125,\n\t\t\tscreenOffsetLeft: 225,\n\t\t\tscreenOffsetTop: 98,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 3848 / 2,\n\t\t\theight: 2240 / 2,\n\t\t\tscreenOffsetLeft: 484 / 2,\n\t\t\tscreenOffsetTop: 196 / 2,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#E5E6E1\" },\n\t\t\t\t{ id: \"space-grey\", title: \"Space Grey\", colorValue: \"#B1B5B7\" },\n\t\t\t\t{ id: \"gold\", title: \"Gold\", colorValue: \"#FCECD5\" },\n\t\t\t],\n\t\t},\n\t},\n\t{\n\t\tid: \"macbook-pro-13\",\n\t\ttitle: `MacBook Pro 13\"`,\n\t\tscreenWidth: 1440,\n\t\tscreenHeight: 900,\n\t\tdisableRotation: true,\n\t\texternalClay: {\n\t\t\twidth: 1914,\n\t\t\theight: 1169,\n\t\t\tscreenOffsetLeft: 236,\n\t\t\tscreenOffsetTop: 109,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 3916 / 2,\n\t\t\theight: 2330 / 2,\n\t\t\tscreenOffsetLeft: 518 / 2,\n\t\t\tscreenOffsetTop: 218 / 2,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#E5E6E1\" },\n\t\t\t\t{ id: \"space-grey\", title: \"Space Grey\", colorValue: \"#B1B5B7\" },\n\t\t\t],\n\t\t},\n\t},\n\t{\n\t\tid: \"macbook-pro-16\",\n\t\ttitle: `MacBook Pro 16\"`,\n\t\tscreenWidth: 1536,\n\t\tscreenHeight: 960,\n\t\tdisableRotation: true,\n\t\texternalClay: {\n\t\t\twidth: 1984,\n\t\t\theight: 1179,\n\t\t\tscreenOffsetLeft: 225,\n\t\t\tscreenOffsetTop: 78,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 4032 / 2,\n\t\t\theight: 2348 / 2,\n\t\t\tscreenOffsetLeft: 480 / 2,\n\t\t\tscreenOffsetTop: 148 / 2,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#E5E6E1\" },\n\t\t\t\t{ id: \"space-grey\", title: \"Space Grey\", colorValue: \"#B1B5B7\" },\n\t\t\t],\n\t\t},\n\t},\n\t{\n\t\tid: \"imac-21-5\",\n\t\ttitle: `iMac 21.5\"`,\n\t\tscreenWidth: 2048,\n\t\tscreenHeight: 1152,\n\t\tdisableRotation: true,\n\t\texternalClay: {\n\t\t\twidth: 2288,\n\t\t\theight: 1892,\n\t\t\tscreenOffsetLeft: 120,\n\t\t\tscreenOffsetTop: 120,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 4562 / 2,\n\t\t\theight: 3796 / 2,\n\t\t\tscreenOffsetLeft: 232 / 2,\n\t\t\tscreenOffsetTop: 244 / 2,\n\t\t},\n\t},\n\t{\n\t\tid: \"imac-27\",\n\t\ttitle: `iMac 27\"`,\n\t\tscreenWidth: 2560,\n\t\tscreenHeight: 1440,\n\t\tdisableRotation: true,\n\t\texternalClay: {\n\t\t\twidth: 2848,\n\t\t\theight: 2351,\n\t\t\tscreenOffsetLeft: 144,\n\t\t\tscreenOffsetTop: 151,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 5676 / 2,\n\t\t\theight: 4720 / 2,\n\t\t\tscreenOffsetLeft: 278 / 2,\n\t\t\tscreenOffsetTop: 292 / 2,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#E5E6E1\" },\n\t\t\t\t{ id: \"pro\", title: \"Pro\", colorValue: \"#5F5E63\" },\n\t\t\t],\n\t\t},\n\t},\n\t{\n\t\tid: \"pro-display-xdr\",\n\t\ttitle: `Pro Display XDR`,\n\t\tscreenWidth: 3008,\n\t\tscreenHeight: 1692,\n\t\tdisableRotation: true,\n\t\texternalClay: {\n\t\t\twidth: 3148,\n\t\t\theight: 2325,\n\t\t\tscreenOffsetLeft: 70,\n\t\t\tscreenOffsetTop: 60,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 6276 / 2,\n\t\t\theight: 4695 / 2,\n\t\t\tscreenOffsetLeft: 130 / 2,\n\t\t\tscreenOffsetTop: 130 / 2,\n\t\t},\n\t},\n\t{\n\t\tid: \"dell-xps\",\n\t\ttitle: `Dell XPS`,\n\t\tscreenWidth: 1920,\n\t\tscreenHeight: 1080,\n\t\tdisableRotation: true,\n\t\texternalClay: {\n\t\t\twidth: 2624,\n\t\t\theight: 1381,\n\t\t\tscreenOffsetLeft: 352,\n\t\t\tscreenOffsetTop: 57,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 5412 / 2,\n\t\t\theight: 2746 / 2,\n\t\t\tscreenOffsetLeft: 786 / 2,\n\t\t\tscreenOffsetTop: 108 / 2,\n\t\t},\n\t},\n\t{\n\t\tid: \"surface-book\",\n\t\ttitle: `Microsoft Surface Book`,\n\t\tscreenWidth: 1500,\n\t\tscreenHeight: 1000,\n\t\tdisableRotation: true,\n\t\texternalClay: {\n\t\t\twidth: 2089,\n\t\t\theight: 1234,\n\t\t\tscreenOffsetLeft: 296,\n\t\t\tscreenOffsetTop: 93,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 4200 / 2,\n\t\t\theight: 2508 / 2,\n\t\t\tscreenOffsetLeft: 600 / 2,\n\t\t\tscreenOffsetTop: 210 / 2,\n\t\t},\n\t},\n\n\t// Tablets ------------------------------------------------------------------------------------------------------------------------\n\t{\n\t\tid: \"ipad\",\n\t\ttitle: \"iPad\",\n\t\tscreenRadius: 0,\n\t\tscreenWidth: 810,\n\t\tscreenHeight: 1080,\n\t\tclayBezelLeft: 30,\n\t\tclayBezelRight: 30,\n\t\tclayBezelTop: 95,\n\t\tclayBezelBottom: 95,\n\t\tclayBezelRadius: 0,\n\t\texternalClay: {\n\t\t\twidth: 966,\n\t\t\theight: 1378,\n\t\t\tscreenOffsetLeft: 78,\n\t\t\tscreenOffsetTop: 149,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 1920 / 2,\n\t\t\theight: 2720 / 2,\n\t\t\tscreenOffsetLeft: 75,\n\t\t\tscreenOffsetTop: 140,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"space-grey\", title: \"Space Grey\", colorValue: \"#C3C4C8\" },\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#E1E2E4\" },\n\t\t\t\t{ id: \"gold\", title: \"Gold\", colorValue: \"#EFD8BD\" },\n\t\t\t],\n\t\t},\n\t},\n\t{\n\t\tid: \"ipad-mini\",\n\t\ttitle: \"iPad Mini\",\n\t\tscreenRadius: 0,\n\t\tclayBezelLeft: 49,\n\t\tclayBezelRight: 49,\n\t\tclayBezelTop: 49,\n\t\tclayBezelBottom: 49,\n\t\tclayBezelRadius: 49,\n\t\tscreenWidth: 768,\n\t\tscreenHeight: 1024,\n\t\texternalClay: {\n\t\t\twidth: 924,\n\t\t\theight: 1384,\n\t\t\tscreenOffsetLeft: 78,\n\t\t\tscreenOffsetTop: 180,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 1856 / 2,\n\t\t\theight: 2728 / 2,\n\t\t\tscreenOffsetLeft: 160 / 2,\n\t\t\tscreenOffsetTop: 340 / 2,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"space-grey\", title: \"Space Grey\", colorValue: \"#C3C4C8\" },\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#E1E2E4\" },\n\t\t\t\t{ id: \"gold\", title: \"Gold\", colorValue: \"#EFD8BD\" },\n\t\t\t],\n\t\t},\n\t},\n\t{\n\t\tid: \"ipad-air\",\n\t\ttitle: \"iPad Air\",\n\t\tscreenRadius: 18,\n\t\tclayBezelLeft: 49,\n\t\tclayBezelRight: 49,\n\t\tclayBezelTop: 49,\n\t\tclayBezelBottom: 49,\n\t\tclayBezelRadius: 49,\n\t\tscreenWidth: 820,\n\t\tscreenHeight: 1180,\n\t\texternalClay: {\n\t\t\twidth: 994,\n\t\t\theight: 1374,\n\t\t\tscreenOffsetLeft: 87,\n\t\t\tscreenOffsetTop: 97,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 1960 / 2,\n\t\t\theight: 2680 / 2,\n\t\t\tscreenOffsetLeft: 160 / 2,\n\t\t\tscreenOffsetTop: 160 / 2,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"space-grey\", title: \"Space Grey\", colorValue: \"#C3C4C8\" },\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#E1E2E4\" },\n\t\t\t\t{ id: \"rose-gold\", title: \"Rose Gold\", colorValue: \"#ECCBC4\" },\n\t\t\t\t{ id: \"blue\", title: \"Blue\", colorValue: \"#CBDAE6\" },\n\t\t\t\t{ id: \"green\", title: \"Green\", colorValue: \"#DAF0D9\" },\n\t\t\t],\n\t\t},\n\t},\n\t{\n\t\tid: \"ipad-pro-11\",\n\t\ttitle: \"iPad Pro 11\u2033\",\n\t\tscreenRadius: 17,\n\t\tclayBezelLeft: 49,\n\t\tclayBezelRight: 49,\n\t\tclayBezelTop: 49,\n\t\tclayBezelBottom: 49,\n\t\tclayBezelRadius: 49,\n\t\tscreenWidth: 834,\n\t\tscreenHeight: 1194,\n\t\texternalClay: {\n\t\t\twidth: 990,\n\t\t\theight: 1370,\n\t\t\tscreenOffsetLeft: 78,\n\t\t\tscreenOffsetTop: 88,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 1968 / 2,\n\t\t\theight: 2688 / 2,\n\t\t\tscreenOffsetLeft: 75,\n\t\t\tscreenOffsetTop: 75,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"space-grey\", title: \"Space Grey\", colorValue: \"#C3C4C8\" },\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#E1E2E4\" },\n\t\t\t],\n\t\t},\n\t},\n\t{\n\t\tid: \"ipad-pro-12-9\",\n\t\ttitle: \"iPad Pro 12.9\u2033\",\n\t\t...presetsBase.iPadPro,\n\t\tscreenRadius: 17,\n\t\tscreenWidth: 1024,\n\t\tscreenHeight: 1366,\n\t\texternalClay: {\n\t\t\twidth: 1180,\n\t\t\theight: 1542,\n\t\t\tscreenOffsetLeft: 78,\n\t\t\tscreenOffsetTop: 88,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 2348 / 2,\n\t\t\theight: 3032 / 2,\n\t\t\tscreenOffsetLeft: 75,\n\t\t\tscreenOffsetTop: 75,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"space-grey\", title: \"Space Grey\", colorValue: \"#C3C4C8\" },\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#E1E2E4\" },\n\t\t\t],\n\t\t},\n\t},\n\t{\n\t\tid: \"surface-3\",\n\t\ttitle: \"Microsoft Surface 3\",\n\t\tscreenRadius: 0,\n\t\tclayBezelLeft: 49,\n\t\tclayBezelRight: 49,\n\t\tclayBezelTop: 49,\n\t\tclayBezelBottom: 49,\n\t\tclayBezelRadius: 49,\n\t\tscreenWidth: 960,\n\t\tscreenHeight: 640,\n\t\texternalClay: {\n\t\t\twidth: 1184,\n\t\t\theight: 864,\n\t\t\tscreenOffsetLeft: 112,\n\t\t\tscreenOffsetTop: 112,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 2280 / 2,\n\t\t\theight: 1580 / 2,\n\t\t\tscreenOffsetLeft: 180 / 2,\n\t\t\tscreenOffsetTop: 150 / 2,\n\t\t},\n\t},\n\t{\n\t\tid: \"surface-pro-4\",\n\t\ttitle: \"Microsoft Surface Pro 4\",\n\t\tscreenRadius: 0,\n\t\tclayBezelLeft: 49,\n\t\tclayBezelRight: 49,\n\t\tclayBezelTop: 49,\n\t\tclayBezelBottom: 49,\n\t\tclayBezelRadius: 49,\n\t\tscreenWidth: 1368,\n\t\tscreenHeight: 912,\n\t\texternalClay: {\n\t\t\twidth: 1592,\n\t\t\theight: 1136,\n\t\t\tscreenOffsetLeft: 112,\n\t\t\tscreenOffsetTop: 112,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 3176 / 2,\n\t\t\theight: 2224 / 2,\n\t\t\tscreenOffsetLeft: 220 / 2,\n\t\t\tscreenOffsetTop: 200 / 2,\n\t\t},\n\t},\n\n\t// Watches ------------------------------------------------------------------------------------------------------------------------\n\t{\n\t\tid: \"apple-watch-44\",\n\t\ttitle: `Apple Watch 44mm`,\n\t\tscreenRadius: 33,\n\t\tscreenWidth: 184,\n\t\tscreenHeight: 224,\n\t\tdisableRotation: true,\n\t\texternalClay: {\n\t\t\twidth: 298,\n\t\t\theight: 502,\n\t\t\tscreenOffsetLeft: 57,\n\t\t\tscreenOffsetTop: 129,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 548 / 2,\n\t\t\theight: 908 / 2,\n\t\t\tscreenOffsetLeft: 90 / 2,\n\t\t\tscreenOffsetTop: 230 / 2,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"black\", title: \"Black\", colorValue: \"#2E2C36\" },\n\t\t\t\t{ id: \"white\", title: \"White\", colorValue: \"#F7F3F0\" },\n\t\t\t\t{ id: \"yellow\", title: \"Yellow\", colorValue: \"#FDDC6C\" },\n\t\t\t\t{ id: \"orange\", title: \"Orange\", colorValue: \"#F35C56\" },\n\t\t\t],\n\t\t},\n\t},\n\t{\n\t\tid: \"apple-watch-40\",\n\t\ttitle: `Apple Watch 40mm`,\n\t\tscreenRadius: 27,\n\t\tscreenWidth: 162,\n\t\tscreenHeight: 197,\n\t\tdisableRotation: true,\n\t\texternalClay: {\n\t\t\twidth: 280,\n\t\t\theight: 463,\n\t\t\tscreenOffsetLeft: 59,\n\t\t\tscreenOffsetTop: 124,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 504 / 2,\n\t\t\theight: 854 / 2,\n\t\t\tscreenOffsetLeft: 90 / 2,\n\t\t\tscreenOffsetTop: 230 / 2,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"black\", title: \"Black\", colorValue: \"#2E2C36\" },\n\t\t\t\t{ id: \"white\", title: \"White\", colorValue: \"#F7F3F0\" },\n\t\t\t\t{ id: \"yellow\", title: \"Yellow\", colorValue: \"#FDDC6C\" },\n\t\t\t\t{ id: \"orange\", title: \"Orange\", colorValue: \"#F35C56\" },\n\t\t\t],\n\t\t},\n\t},\n\n\t// TVs ------------------------------------------------------------------------------------------------------------------------\n\t{\n\t\tid: \"tv-full-hd\",\n\t\ttitle: `Full HD`,\n\t\tscreenRadius: 0,\n\t\tscreenWidth: 1920,\n\t\tscreenHeight: 1080,\n\t\texternalClay: {\n\t\t\twidth: 1968,\n\t\t\theight: 1168,\n\t\t\tscreenOffsetLeft: 24,\n\t\t\tscreenOffsetTop: 12,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 4040 / 2,\n\t\t\theight: 2360 / 2,\n\t\t\tscreenOffsetLeft: 100 / 2,\n\t\t\tscreenOffsetTop: 100 / 2,\n\t\t},\n\t},\n\t{\n\t\tid: \"tv-4k\",\n\t\ttitle: `4K`,\n\t\tscreenRadius: 0,\n\t\tscreenWidth: 3840,\n\t\tscreenHeight: 2160,\n\t\texternalClay: {\n\t\t\twidth: 3908,\n\t\t\theight: 2308,\n\t\t\tscreenOffsetLeft: 34,\n\t\t\tscreenOffsetTop: 24,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 7960 / 2,\n\t\t\theight: 4600 / 2,\n\t\t\tscreenOffsetLeft: 140 / 2,\n\t\t\tscreenOffsetTop: 140 / 2,\n\t\t},\n\t},\n\n\t// Old devices ------------------------------------------------------------------------------------------------------------------------\n\n\t// deprecated\n\t{\n\t\tid: \"720p\",\n\t\ttitle: \"720p\",\n\t\t...presetsBase.desktop,\n\t\tscreenWidth: 720,\n\t\tscreenHeight: 1280,\n\t},\n\n\t// deprecated\n\t{\n\t\tid: \"900p\",\n\t\ttitle: \"900p\",\n\t\t...presetsBase.desktop,\n\t\tscreenWidth: 900,\n\t\tscreenHeight: 1440,\n\t},\n\n\t// deprecated\n\t{\n\t\tid: \"1080p\",\n\t\ttitle: \"1080p\",\n\t\t...presetsBase.desktop,\n\t\tscreenWidth: 1080,\n\t\tscreenHeight: 1920,\n\t},\n\n\t// deprecated\n\t{\n\t\tid: \"1440p\",\n\t\ttitle: \"1440p\",\n\t\t...presetsBase.desktop,\n\t\tscreenWidth: 1440,\n\t\tscreenHeight: 2560,\n\t},\n\n\t// deprecated\n\t{\n\t\tid: \"4k\",\n\t\ttitle: \"4K\",\n\t\t...presetsBase.desktop,\n\t\tscreenWidth: 2160,\n\t\tscreenHeight: 3840,\n\t},\n])()\n\nexport const deviceCodeComponentPresetIds = [\n\t\"iphone-12\",\n\t\"iphone-12-mini\",\n\t\"iphone-12-pro\",\n\t\"iphone-11\",\n\t\"iphone-11-pro\",\n\t\"iphone-11-pro-max\",\n\t\"iphone-8\",\n\t\"iphone-8-plus\",\n\t\"iphone-se\",\n\t\"samsung-note-10\",\n\t\"pixel-4\",\n\t\"ipad\",\n\t\"ipad-pro-11\",\n\t\"ipad-pro-12-9\",\n\t\"720p\",\n\t\"900p\",\n\t\"1080p\",\n\t\"1440p\",\n\t\"4k\",\n]\n\nexport const deviceCodeComponentPresets = /* @__PURE__ */ devicePresets.filter(preset =>\n\tdeviceCodeComponentPresetIds.includes(preset.id),\n)\n\nconst devicePresetsMap = /* @__PURE__ */ devicePresets.reduce(\n\t(map, preset) => {\n\t\tmap[preset.id] = preset\n\t\treturn map\n\t},\n\t{} as Record<DevicePresetID, DevicePreset>,\n)\n\n/**\n * @internal\n */\nexport function getDevicePreset(presetId: DevicePresetID): DevicePreset {\n\treturn devicePresetsMap[presetId] ?? devicePresetsMap[defaultPresetId]\n}\n", "import type React from \"react\"\nimport { encodeSVGForCSS } from \"../../utils/utils.ts\"\nimport type { DeviceOptions } from \"./Device.tsx\"\nimport { getColorsFromTheme } from \"./Device.tsx\"\nimport type { DeviceColor, DevicePreset, DevicePresetID } from \"./presets.ts\"\nimport { defaultPresetId, getDevicePreset } from \"./presets.ts\"\n\n// Props for the DeviceCodeComponent. This is split into a separate module so\n// that you can import the props interface and the funtion to convert props to\n// DeviceOptions, without pulling the Framer library, on which the code\n// component module depends.\n\n/**\n * @internal\n */\nexport interface DeviceCodeComponentProps {\n\tchildren: React.ReactNode[]\n\n\tpreset: DevicePresetID | \"custom\" | \"no-device\"\n\tcustomWidth: number\n\tcustomHeight: number\n\tcustomBezel: number\n\tisMixedBezel: boolean\n\tbezelTop: number\n\tbezelRight: number\n\tbezelBottom: number\n\tbezelLeft: number\n\tcustomBezelRadius: number\n\tcustomScreenRadius: number\n\torientation: \"portrait\" | \"landscape\"\n\tskin?: \"realistic\" | \"clay\"\n\ttheme: \"light\" | \"dark\"\n\tshadow: boolean\n\thand?: string\n\tbackgroundColor?: string\n\tcolorId?: string\n}\n\n/**\n * @internal\n */\nexport const defaultDeviceProps: Omit<DeviceCodeComponentProps, \"children\"> = {\n\tpreset: defaultPresetId,\n\tcustomWidth: 375,\n\tcustomHeight: 800,\n\tcustomBezel: 20,\n\tisMixedBezel: false,\n\tbezelTop: 20,\n\tbezelRight: 20,\n\tbezelBottom: 20,\n\tbezelLeft: 20,\n\tcustomBezelRadius: 20,\n\tcustomScreenRadius: 0,\n\torientation: \"portrait\",\n\tskin: \"clay\",\n\ttheme: \"dark\",\n\tshadow: true,\n\tbackgroundColor: undefined,\n}\n\ninterface ConvertPropsToDeviceOptions extends Omit<DeviceCodeComponentProps, \"children\"> {\n\trotated?: boolean\n}\n\n/**\n * @internal\n */\nexport function convertPropsToDeviceOptions(\n\tprops: ConvertPropsToDeviceOptions,\n\t{ forceOldClay = false }: { forceOldClay?: boolean } = {},\n): DeviceOptions | undefined {\n\tif (props.preset === \"no-device\") {\n\t\treturn\n\t}\n\tlet preset: Omit<DevicePreset, \"id\" | \"title\">\n\tif (props.preset === \"custom\") {\n\t\tpreset = {\n\t\t\tscreenWidth: props.customWidth,\n\t\t\tscreenHeight: props.customHeight,\n\t\t\tscreenRadius: props.customScreenRadius,\n\t\t\tclayBezelTop: props.isMixedBezel ? props.bezelTop : props.customBezel,\n\t\t\tclayBezelRight: props.isMixedBezel ? props.bezelRight : props.customBezel,\n\t\t\tclayBezelBottom: props.isMixedBezel ? props.bezelBottom : props.customBezel,\n\t\t\tclayBezelLeft: props.isMixedBezel ? props.bezelLeft : props.customBezel,\n\t\t\tclayBezelRadius: props.customBezelRadius,\n\t\t}\n\t} else {\n\t\tpreset = getDevicePreset(props.preset)\n\t}\n\tconst colors = getColorsFromTheme(props.theme)\n\tconst shadowColor = colors.shadowColor\n\tconst shadow = props.shadow ? `0 10px 30px ${shadowColor}` : undefined\n\n\tconst rotate = !preset.disableRotation && (props.orientation === \"landscape\" || props.rotated)\n\n\tlet deviceWidth: number\n\tlet deviceHeight: number\n\tlet screenOffsetTop: number\n\tlet screenOffsetLeft: number\n\tlet colorId = props.colorId\n\tlet appearance: DeviceOptions[\"appearance\"]\n\tif ((props.skin === undefined || props.skin === \"realistic\") && preset.realisticImage && props.preset) {\n\t\tdeviceWidth = preset.realisticImage.width\n\t\tdeviceHeight = preset.realisticImage.height\n\t\tscreenOffsetTop = preset.realisticImage.screenOffsetTop\n\t\tscreenOffsetLeft = preset.realisticImage.screenOffsetLeft\n\t\tcolorId = colorId ?? colorIdForTheme(props.theme, preset.realisticImage.availableColors)\n\t\tappearance = {\n\t\t\ttype: \"realistic\",\n\t\t\timageUrl: colorId\n\t\t\t\t? `https://preview.framercdn.com/images/devices/${props.preset}-${colorId}.png`\n\t\t\t\t: `https://preview.framercdn.com/images/devices/${props.preset}.png`,\n\t\t\timageWidth: preset.realisticImage.width,\n\t\t\timageHeight: preset.realisticImage.height,\n\t\t\trotateImage: rotate,\n\t\t}\n\t} else {\n\t\tdeviceWidth = preset.screenWidth + (preset.clayBezelLeft ?? 0) + (preset.clayBezelRight ?? 0)\n\t\tdeviceHeight = preset.screenHeight + (preset.clayBezelTop ?? 0) + (preset.clayBezelBottom ?? 0)\n\t\tscreenOffsetTop = preset.clayBezelTop ?? 0\n\t\tscreenOffsetLeft = preset.clayBezelLeft ?? 0\n\n\t\t// use external clay if available\n\t\tif (preset.externalClay && !forceOldClay) {\n\t\t\tdeviceWidth = preset.externalClay.width\n\t\t\tdeviceHeight = preset.externalClay.height\n\t\t\tscreenOffsetTop = preset.externalClay.screenOffsetTop\n\t\t\tscreenOffsetLeft = preset.externalClay.screenOffsetLeft\n\t\t\tappearance = {\n\t\t\t\ttype: \"external-clay\",\n\t\t\t\timageUrl: `https://preview.framercdn.com/images/devices/${props.preset}-${props.theme}.svg`,\n\t\t\t\timageWidth: preset.externalClay.width,\n\t\t\t\timageHeight: preset.externalClay.height,\n\t\t\t\trotateImage: rotate,\n\t\t\t}\n\t\t} else {\n\t\t\tappearance = {\n\t\t\t\ttype: \"clay\",\n\t\t\t\tbezelRadius: preset.clayBezelRadius !== undefined ? `${preset.clayBezelRadius}px` : undefined,\n\t\t\t\tbezelColor: colors.bezelColor,\n\t\t\t\tbezelShadeColor: colors.bezelShadeColor,\n\t\t\t}\n\t\t}\n\t}\n\n\tlet screenWidth = preset.screenWidth\n\tlet screenHeight = preset.screenHeight\n\n\tif (rotate) {\n\t\t// Computer screenOffsetRight pre-rotation, this will become the top\n\t\t// offset post-rotation.\n\t\tconst screenOffsetRight = deviceWidth - screenWidth - screenOffsetLeft\n\t\t;[deviceWidth, deviceHeight] = [deviceHeight, deviceWidth]\n\t\t;[screenWidth, screenHeight] = [screenHeight, screenWidth]\n\t\t;[screenOffsetTop, screenOffsetLeft] = [screenOffsetRight, screenOffsetTop]\n\t}\n\n\tconst handOffset = preset.realisticImage?.handOffset\n\n\treturn {\n\t\tdeviceWidth,\n\t\tdeviceHeight,\n\t\tappearance,\n\t\tscreenWidth,\n\t\tscreenHeight,\n\t\tscreenOffsetTop,\n\t\tscreenOffsetLeft,\n\t\tscreenRadius: preset.screenRadius !== undefined ? `${preset.screenRadius}px` : undefined,\n\t\tscreenMaskImage:\n\t\t\tappearance.type !== \"realistic\" && preset.screenMask\n\t\t\t\t? makeScreenMaskImage({\n\t\t\t\t\t\tmask: preset.screenMask,\n\t\t\t\t\t\t// width/height of the mask = screen width/height pre-rotation\n\t\t\t\t\t\twidth: preset.screenWidth,\n\t\t\t\t\t\theight: preset.screenHeight,\n\t\t\t\t\t\trotate,\n\t\t\t\t\t})\n\t\t\t\t: undefined,\n\t\tscreenColor: colors.screenColor,\n\t\tshadow,\n\t\thand:\n\t\t\tprops.hand !== undefined && supportsHand(props)\n\t\t\t\t? {\n\t\t\t\t\t\timageUrl: `https://preview.framercdn.com/images/hands/${props.hand}.png`,\n\t\t\t\t\t\toffsetLeft: handOffset?.left,\n\t\t\t\t\t\toffsetRight: handOffset?.right,\n\t\t\t\t\t\toffsetBottom: handOffset?.bottom,\n\t\t\t\t\t}\n\t\t\t\t: undefined,\n\t\tbackground: props.backgroundColor,\n\t\ttheme: props.theme,\n\t\tcolorId,\n\t}\n}\n\nfunction makeScreenMaskImage({\n\tmask,\n\twidth,\n\theight,\n\trotate = false,\n}: {\n\tmask: string\n\twidth: number\n\theight: number\n\trotate?: boolean\n}) {\n\tconst transform = rotate\n\t\t? // Rotate 90 degrees counter-clockwise around (0,0), then move the\n\t\t\t// result down into the viewport (rightmost transform is applied first).\n\t\t\t`transform=\"translate(0 ${width}) rotate(-90)\"`\n\t\t: \"\"\n\treturn encodeSVGForCSS(\n\t\t`<svg xmlns=\"http://www.w3.org/2000/svg\" viewport=\"0 0 ${width} ${height}\" preserveAspectRatio=\"none\"><g x=\"0\" y=\"0\" ${transform}>${mask}</g></svg>`,\n\t)\n}\n\nconst lightColors = new Set([\"white\", \"silver\", \"clearly-white\", \"sorta-sage\"])\nconst darkColors = new Set([\"black\", \"space-grey\", \"graphite\", \"just-black\", \"pro\"])\n\n/** @internal */\nexport function colorIdForTheme(\n\ttheme: \"light\" | \"dark\",\n\tavailableColors: DeviceColor[] | undefined,\n): string | undefined {\n\tif (!availableColors) return\n\tconst colors = theme === \"light\" ? lightColors : darkColors\n\tfor (const color of availableColors) {\n\t\tif (colors.has(color.id)) {\n\t\t\treturn color.id\n\t\t}\n\t}\n\t// If we can't find a color matching the theme, pick the first one\n\treturn availableColors[0]?.id\n}\n\nexport function supportsHand({ preset: presetId, skin, orientation = \"portrait\" }: Partial<DeviceCodeComponentProps>) {\n\tif (!presetId || presetId === \"custom\" || presetId === \"no-device\" || orientation === \"landscape\") return false\n\tconst preset = getDevicePreset(presetId)\n\treturn skin !== \"clay\" && preset.realisticImage?.handOffset !== undefined\n}\n", "import React from \"react\"\n\nfunction applyMetaTag(name: string, props: Record<string, string>) {\n\tlet tag = document.querySelector(`meta[name=\"${name}\"]`)\n\n\tif (!tag) {\n\t\ttag = document.createElement(\"meta\")\n\t\tdocument.getElementsByTagName(\"head\")[0]?.appendChild(tag)\n\t\ttag.setAttribute(\"name\", name)\n\t}\n\n\tfor (const [k, v] of Object.entries(props)) {\n\t\ttag.setAttribute(k, v)\n\t}\n}\n\nexport function usePrototypingMetaTags() {\n\t// Inject meta tags so mobile browser UI gets hidden when opening it on a phone\n\tReact.useEffect(() => {\n\t\tapplyMetaTag(\"mobile-web-app-capable\", { content: \"yes\" })\n\t\tapplyMetaTag(\"apple-mobile-web-app-capable\", { content: \"yes\" })\n\t\tapplyMetaTag(\"apple-mobile-web-app-status-bar-style\", {\n\t\t\tcontent: \"black-translucent\",\n\t\t})\n\t\tapplyMetaTag(\"viewport\", {\n\t\t\tcontent: \"viewport-fit=cover, user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1\",\n\t\t})\n\t}, [])\n}\n", "import React from \"react\"\nimport { FrameWithMotion } from \"../render/presentation/Frame/FrameWithMotion.tsx\"\nimport { RenderEnvironment, RenderTarget } from \"../render/types/RenderEnvironment.ts\"\n\nexport interface Props {\n\tchildren: React.ReactNode\n\tsize: { width?: string | number; height?: string | number }\n\ttitle?: string\n\tdescription?: React.ReactNode\n\thide?: boolean\n\tinsideUserCodeComponent?: boolean\n\tposition?: React.CSSProperties[\"position\"]\n}\n\n/** @internal */\nexport function EmptyState({\n\ttitle = \"\",\n\tdescription = \"Click and drag the connector to any frame on the canvas \u2192\",\n\tchildren,\n\tsize,\n\thide,\n\tinsideUserCodeComponent = false,\n\tposition = \"absolute\",\n}: Props) {\n\tconst { target } = RenderEnvironment\n\tconst childCount = React.Children.count(children)\n\n\tif (insideUserCodeComponent && childCount === 0) {\n\t\treturn <FrameWithMotion {...size} data-name=\"placeholder\" />\n\t}\n\n\tif (target !== RenderTarget.canvas) return null\n\tif (hide) return null\n\tif (childCount !== 0) return null\n\n\treturn (\n\t\t<FrameWithMotion\n\t\t\tkey=\"empty-state\"\n\t\t\tclassName=\"framerInternalUI-canvasPlaceholder\"\n\t\t\ttop={0}\n\t\t\tleft={0}\n\t\t\tbottom={0}\n\t\t\tright={0}\n\t\t\tstyle={{ position, ...size }}\n\t\t>\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tdisplay: \"flex\",\n\t\t\t\t\talignItems: \"center\",\n\t\t\t\t\tlineHeight: \"1.4\",\n\t\t\t\t\theight: \"100%\",\n\t\t\t\t\twidth: \"100%\",\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tdisplay: \"flex\",\n\t\t\t\t\t\talignItems: \"center\",\n\t\t\t\t\t\tjustifyContent: \"center\",\n\t\t\t\t\t\tflexDirection: \"column\",\n\t\t\t\t\t\twidth: \"100%\",\n\t\t\t\t\t\t// Use a mask to fade out the right edge of the content as it gets cropped.\n\t\t\t\t\t\tWebkitMaskImage: `linear-gradient(90deg, black, black calc(100% - 12px * ${scaleFactor}), transparent)`,\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<Title>{title}</Title>\n\t\t\t\t\t<Description>{description}</Description>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</FrameWithMotion>\n\t)\n}\n\nconst scaleFactor = \"var(--framerInternalCanvas-canvasPlaceholderContentScaleFactor, 1)\"\n\nexport function Title({ children }: { children?: React.ReactNode }) {\n\treturn (\n\t\t<span\n\t\t\tstyle={{\n\t\t\t\tdisplay: \"flex\",\n\t\t\t\tflexDirection: \"column\",\n\t\t\t\ttextAlign: \"center\",\n\t\t\t\tflexGrow: 1,\n\t\t\t\tflexShrink: 0,\n\t\t\t\tfontWeight: 600,\n\t\t\t\tmarginBottom: \"5px\",\n\t\t\t}}\n\t\t>\n\t\t\t{children}\n\t\t</span>\n\t)\n}\n\nfunction Description({ children }: { children?: React.ReactNode }) {\n\treturn (\n\t\t<span\n\t\t\tstyle={{\n\t\t\t\tdisplay: \"flex\",\n\t\t\t\tflexDirection: \"column\",\n\t\t\t\ttextAlign: \"center\",\n\t\t\t\tflexGrow: 1,\n\t\t\t\tflexShrink: 0,\n\t\t\t\tfontWeight: 400,\n\t\t\t\tmaxWidth: \"200px\",\n\t\t\t}}\n\t\t>\n\t\t\t{children}\n\t\t</span>\n\t)\n}\n", "import type { Transition } from \"framer-motion\"\nimport { AnimatePresence, useInstantLayoutTransition, useResetProjection } from \"framer-motion\"\nimport React, { Component } from \"react\"\nimport type { FrameProps } from \"../render/presentation/Frame/FrameWithMotion.tsx\"\nimport { FrameWithMotion } from \"../render/presentation/Frame/FrameWithMotion.tsx\"\nimport { withLibraryCSS } from \"../render/utils/injectComponentCSSRules.ts\"\nimport { assert } from \"../utils/assert.ts\"\nimport { isReactChild, isReactElement } from \"../utils/type-guards.ts\"\nimport { isObject } from \"../utils/utils.ts\"\nimport { LayoutIdProvider } from \"./AnimateLayout/LayoutIdContext.tsx\"\nimport { SharedLayoutRoot } from \"./AnimateLayout/SharedLayoutRoot.tsx\"\nimport { MagicMotionCrossfadeRoot } from \"./MagicMotionCrossfadeRoot.tsx\"\nimport { NavigationContainer } from \"./NavigationContainer.tsx\"\nimport { NavigationContext } from \"./NavigationContext.ts\"\nimport type {\n\tFadeTransitionOptions,\n\tFlipTransitionOptions,\n\tModalTransitionOptions,\n\tNavigationTransition,\n\tNavigationTransitionAnimation,\n\tNavigationTransitionBackdropColor,\n\tOverlayTransitionOptions,\n\tPushTransitionOptions,\n} from \"./NavigationTransitions.ts\"\nimport { TransitionDefaults, flipTransition, overlayTransition, pushTransition } from \"./NavigationTransitions.ts\"\nimport type { HistoryItem, NavigationAction, NavigationState, StackState } from \"./reduceNavigationStateForAction.ts\"\nimport { defaultState, reduceNavigationStateForAction } from \"./reduceNavigationStateForAction.ts\"\n\n/**\n * The navigator allows control over the built-in navigation component in Framer.\n * @public\n */\nexport interface NavigationInterface {\n\t/**\n\t * Go back to the previous screen. If a stack of overlays is presented, all overlays are dismissed.\n\t * @public\n\t * */\n\tgoBack: () => void\n\t/**\n\t * Show new screen instantly.\n\t * @param component - The incoming component\n\t * @public\n\t */\n\tinstant: (component: React.ReactNode) => void\n\t/**\n\t * Fade in new screen.\n\t * @param component - The incoming component\n\t * @param options - {@link FadeTransitionOptions}\n\t * @public\n\t */\n\tfade: (component: React.ReactNode, options?: FadeTransitionOptions) => void\n\t/**\n\t * Push new screen. Defaults from right to left, the direction can be changed using the {@link NavigationTransitionOptions}.\n\t * @param component - The incoming component\n\t * @param options - {@link PushTransitionOptions}\n\t * @public\n\t */\n\tpush: (component: React.ReactNode, options?: PushTransitionOptions) => void\n\t/**\n\t * Present modal overlay in the center.\n\t * @param component - The incoming component\n\t * @param options - {@link ModalTransitionOptions}\n\t * @public\n\t */\n\tmodal: (component: React.ReactNode, options?: ModalTransitionOptions) => void\n\t/**\n\t * Present overlay from one of four edges. The direction can be changed using the {@link NavigationTransitionOptions}.\n\t * @param component - The incoming component\n\t * @param options - {@link OverlayTransitionOptions}\n\t * @public\n\t */\n\toverlay: (component: React.ReactNode, options?: OverlayTransitionOptions) => void\n\t/**\n\t * Flip incoming and outgoing screen in 3D. The flip direction can be changed using the {@link NavigationTransitionOptions}.\n\t * @param component - The incoming component\n\t * @param options - {@link FlipTransitionOptions}\n\t * @public\n\t */\n\tflip: (component: React.ReactNode, options?: FlipTransitionOptions) => void\n\t/**\n\t * Present a screen using a custom {@link NavigationTransition}.\n\t * @param component - The incoming component\n\t * @param transition - {@link NavigationTransition}\n\t * @public\n\t */\n\tcustomTransition: (component: React.ReactNode, transition: NavigationTransition) => void\n\t/**\n\t * Animate layers with matching magicIds between screens. Layers are assigned matching IDs if they share a name, or were copied from one another.\n\t * The transition can be changed using a custom {@link NavigationTransition}.\n\t * @param component - The incoming component\n\t * @param transition - {@link NavigationTransition}\n\t * @public\n\t */\n\tmagicMotion: (component: React.ReactNode, transition: NavigationTransition) => void\n}\n\n/**\n * Provides {@link NavigationInterface} that can be used to start transitions in Framer.\n * @public\n */\nexport const NavigationConsumer = /* @__PURE__ */ (() => NavigationContext.Consumer)()\n\ntype NavigationCallback = (key: string) => void\nconst NavigationCallbackContext = /* @__PURE__ */ React.createContext<NavigationCallback | undefined>(undefined)\n/**\n * @internal\n */\nexport const NavigationCallbackProvider = /* @__PURE__ */ (() => NavigationCallbackContext.Provider)()\n\n/**\n * @internal\n */\nexport const IsInitialNavigationContext = /* @__PURE__ */ React.createContext<boolean | undefined>(undefined)\n\n/**\n * @internal\n */\nexport interface NavigationProps {\n\t/** @deprecated - still used by the old library */\n\twidth?: number\n\t/** @deprecated - still used by the old library */\n\theight?: number\n\tstyle?: React.CSSProperties\n\t/** @internal */\n\tenabled?: boolean\n}\n\ninterface LayoutProjectionHelpers {\n\tresetProjection?: () => void\n\tskipLayoutAnimation?: (cb?: () => void) => void\n}\n\n/**\n * @internal export for testing only\n *\n * We\u2019re wrapping the whole Navigation class with `@__PURE__` because esbuild\n * can\u2019t compile static class properties in a tree-shakeable way: https://github.com/evanw/esbuild/issues/3765.\n * The wrapper allows them to stay in the IIFE and be tree-shaken.\n * If/when esbuild fixes that issue, we can remove `export type NavigationClass`\n * and just export the class directly.\n */\nconst Navigation = /* @__PURE__ */ (() => {\n\treturn class Navigation\n\t\textends Component<NavigationProps & LayoutProjectionHelpers & { children?: React.ReactNode }, NavigationState>\n\t\timplements NavigationInterface\n\t{\n\t\t#lastEventTimeStamp: number | null = null\n\n\t\toverride state: NavigationState = defaultState()\n\n\t\tstatic defaultProps: NavigationProps = {\n\t\t\tenabled: true,\n\t\t}\n\n\t\tstatic override contextType = NavigationCallbackContext\n\t\tdeclare context: React.ContextType<typeof NavigationCallbackContext>\n\n\t\tconstructor(props: NavigationProps & LayoutProjectionHelpers) {\n\t\t\tsuper(props)\n\n\t\t\tconst component = this.props.children\n\t\t\tif (!component || !isReactChild(component) || !isReactElement(component)) return\n\t\t\tconst transition = { ...TransitionDefaults.Instant }\n\t\t\tconst key = component.key?.toString() || `stack-${this.state.historyItemId + 1}`\n\t\t\tconst action = { type: \"add\", key, transition, component } as const\n\n\t\t\tconst newState = reduceNavigationStateForAction(this.state, action)\n\t\t\tif (!newState) return\n\t\t\tthis.state = newState\n\t\t}\n\n\t\toverride componentDidMount() {\n\t\t\tconst historyItem = this.state.history[this.state.current]\n\t\t\t// Because this.state.history is only properly setup in the constructor\n\t\t\t// when `this.props.children` is set (to support SSG in the past), we\n\t\t\t// need to be prepared to have historyItem be undefined on mount.\n\t\t\tif (!historyItem) return\n\t\t\tthis.context?.(historyItem.key)\n\t\t}\n\n\t\toverride UNSAFE_componentWillReceiveProps(props: NavigationProps & { children?: React.ReactNode }) {\n\t\t\tconst component: React.ReactNode = props[\"children\"]\n\t\t\tif (!isReactChild(component) || !isReactElement(component)) return\n\n\t\t\tconst key = component.key?.toString()\n\n\t\t\tif (!key) return\n\n\t\t\tif (this.state.history.length === 0) {\n\t\t\t\tthis.#transition(component, TransitionDefaults.Instant)\n\t\t\t} else {\n\t\t\t\tthis.#navigationAction({ type: \"update\", key, component })\n\t\t\t}\n\t\t}\n\n\t\toverride componentWillUnmount() {\n\t\t\tthis.props.resetProjection?.()\n\t\t}\n\n\t\t#getStackState(options: { overCurrentContext: boolean }): StackState {\n\t\t\tconst { current, previous, currentOverlay, previousOverlay } = this.state\n\t\t\tif (options.overCurrentContext) {\n\t\t\t\treturn {\n\t\t\t\t\tcurrent: currentOverlay,\n\t\t\t\t\tprevious: previousOverlay,\n\t\t\t\t\thistory: this.state.overlayStack,\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tcurrent,\n\t\t\t\tprevious,\n\t\t\t\thistory: this.state.history,\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * To prevent bubbling events from triggering multiple transitions,\n\t\t * we ensure that the current event has a different timestamp then the event that triggered the last transition.\n\t\t * We use Window.event to ensure that even transitions invoked by code components - and may not pass a reference to the event - are caught.\n\t\t * This works better than measuring the time of transition calls with performance.now()\n\t\t * because the time between calls can get longer and longer as more screens are added to the stack,\n\t\t * preventing a deterministic time between transitions to be used to determine if they were triggered at the same time or not.\n\t\t */\n\t\t#isSameEventTransition() {\n\t\t\t// If for some reason window.event is undefined, don't block transitions.\n\t\t\tif (!globalThis.event) return false\n\t\t\treturn this.#lastEventTimeStamp === globalThis.event.timeStamp\n\t\t}\n\n\t\t#navigationAction = (action: NavigationAction) => {\n\t\t\t// If Navigation is disabled and this is not the first navigation event, ignore the action\n\t\t\tif (!this.props.enabled && this.state.history.length > 0) return\n\n\t\t\tconst newState = reduceNavigationStateForAction(this.state, action)\n\t\t\tif (!newState) return\n\n\t\t\t// Block layout animation in motion when using non-magic-motion transitions.\n\t\t\t// We trigger the transition as a callback to ensure the blocking happens first.\n\t\t\tconst { skipLayoutAnimation } = this.props\n\t\t\tconst historyItem = newState.history[newState.current]\n\n\t\t\t// Since the \"lead\" always determines which layers can animate,\n\t\t\t// and when a \"transition back\" is performed the \"lead\" is the new current container,\n\t\t\t// we need to ensure that calculations are performed by the new current container\n\t\t\t// as if it was being transitioned to with magic motion.\n\t\t\t// Since this.state.previousTransition is null unless we are animating a magic motion removal,\n\t\t\t// this is a safe way to infer this case.\n\t\t\tconst withMagicMotion =\n\t\t\t\t(action.type === \"add\" && action.transition.withMagicMotion) ||\n\t\t\t\t(action.type === \"forward\" && historyItem?.transition.withMagicMotion) ||\n\t\t\t\t(action.type === \"remove\" && !!newState.previousTransition)\n\n\t\t\tconst updateState = () => {\n\t\t\t\tthis.setState(newState)\n\t\t\t\tif (historyItem?.key) {\n\t\t\t\t\tthis.context?.(historyItem.key)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (skipLayoutAnimation && !withMagicMotion) {\n\t\t\t\tskipLayoutAnimation(updateState)\n\t\t\t} else {\n\t\t\t\tupdateState()\n\t\t\t}\n\t\t}\n\n\t\t#transition(\n\t\t\tcomponent: React.ReactNode,\n\t\t\ttransitionTraits: NavigationTransition,\n\t\t\ttransitionOptions?: NavigationTransitionAnimation & NavigationTransitionBackdropColor,\n\t\t) {\n\t\t\tif (this.#isSameEventTransition()) return\n\t\t\tthis.#lastEventTimeStamp = globalThis.event?.timeStamp || null\n\n\t\t\tif (!component || !isReactChild(component) || !isReactElement(component)) return\n\n\t\t\tconst transition = { ...transitionTraits, ...transitionOptions }\n\t\t\tconst overCurrentContext = !!transition.overCurrentContext\n\n\t\t\tif (overCurrentContext) return this.#navigationAction({ type: \"addOverlay\", transition, component })\n\n\t\t\t// If for some reason Navigation is being used in code, and a component instance isn't supplied,\n\t\t\t// generate a unique key to ensure the screen is added.\n\t\t\tconst key = component.key?.toString() || `stack-${this.state.historyItemId + 1}`\n\n\t\t\tthis.#navigationAction({ type: \"add\", key, transition, component })\n\t\t}\n\n\t\tgoBack = () => {\n\t\t\tif (this.#isSameEventTransition()) return\n\t\t\tthis.#lastEventTimeStamp = globalThis.event?.timeStamp || null\n\n\t\t\tif (this.state.currentOverlay !== -1) return this.#navigationAction({ type: \"removeOverlay\" })\n\n\t\t\treturn this.#navigationAction({ type: \"remove\" })\n\t\t}\n\n\t\tinstant(component: React.ReactNode) {\n\t\t\tthis.#transition(component, TransitionDefaults.Instant, undefined)\n\t\t}\n\n\t\tfade(component: React.ReactNode, options?: FadeTransitionOptions) {\n\t\t\tthis.#transition(component, TransitionDefaults.Fade, options)\n\t\t}\n\n\t\tpush(component: React.ReactNode, options?: PushTransitionOptions) {\n\t\t\tthis.#transition(component, pushTransition(options), options)\n\t\t}\n\n\t\tmodal(component: React.ReactNode, options?: ModalTransitionOptions) {\n\t\t\tthis.#transition(component, TransitionDefaults.Modal, options)\n\t\t}\n\n\t\toverlay(component: React.ReactNode, options?: OverlayTransitionOptions) {\n\t\t\tthis.#transition(component, overlayTransition(options), options)\n\t\t}\n\n\t\tflip(component: React.ReactNode, options?: FlipTransitionOptions) {\n\t\t\tthis.#transition(component, flipTransition(options), options)\n\t\t}\n\n\t\tmagicMotion(component: React.ReactNode, options?: NavigationTransitionAnimation) {\n\t\t\tthis.#transition(component, TransitionDefaults.MagicMotion, options)\n\t\t}\n\n\t\tcustomTransition(component: React.ReactNode, transition: NavigationTransition) {\n\t\t\tthis.#transition(component, transition)\n\t\t}\n\n\t\toverride render() {\n\t\t\tconst stackState = this.#getStackState({ overCurrentContext: false })\n\t\t\tconst overlayStackState = this.#getStackState({ overCurrentContext: true })\n\t\t\tconst activeOverlay = activeOverlayItem(overlayStackState)\n\t\t\tconst isOverlayVisible = overlayStackState.current > -1\n\n\t\t\t// Describes whether this is the first render of Navigation and its\n\t\t\t// initial content. Mostly useful for dealing with SSR and hydration,\n\t\t\t// which is why it's also accessible via IsInitialNavigationContext.\n\t\t\t//\n\t\t\t// We implement this as a history.length check, as it should only ever\n\t\t\t// be 1 right after mount, since back transitions don't pop the history\n\t\t\t// stack.\n\t\t\t//\n\t\t\t// It is expected to only ever change once, from `true` to `false`, on\n\t\t\t// the first transition after mount. This is important to make sure that\n\t\t\t// anything using the IsInitialNavigationContext doesn't unnecessarily\n\t\t\t// re-render.\n\t\t\tconst isInitial = this.state.history.length === 1\n\n\t\t\tconst contentContainers: JSX.Element[] = []\n\t\t\tfor (const [key, component] of Object.entries(this.state.containers)) {\n\t\t\t\tconst index = this.state.containerIndex[key]\n\t\t\t\tassert(index !== undefined, \"Container's index must be registered\")\n\t\t\t\tconst visualIndex = this.state.containerVisualIndex[key]\n\t\t\t\tassert(visualIndex !== undefined, \"Container's visual index must be registered\")\n\t\t\t\tconst removed = this.state.containerIsRemoved[key]\n\t\t\t\tconst historyItem = this.state.history[index]\n\t\t\t\tconst transitionProps = this.state.transitionForContainer[key]\n\t\t\t\tconst isCurrent = index === this.state.current\n\n\t\t\t\tconst isPrevious = index === this.state.previous\n\t\t\t\tconst areMagicMotionLayersPresent = isCurrent ? false : removed\n\n\t\t\t\t// Since the \"lead\" always determines which layers can animate, and\n\t\t\t\t// when a \"transition back\" is performed the \"lead\" is the new\n\t\t\t\t// current container, we need to ensure that calculations are\n\t\t\t\t// performed by the new current container as if it was being\n\t\t\t\t// transitioned to with magic motion.\n\t\t\t\t//\n\t\t\t\t// Since this.state.previousTransition is null unless we are\n\t\t\t\t// animating a magic motion removal, this is a safe way to infer\n\t\t\t\t// this case.\n\t\t\t\tconst withMagicMotion =\n\t\t\t\t\thistoryItem?.transition?.withMagicMotion || (isCurrent && !!this.state.previousTransition)\n\n\t\t\t\tcontentContainers.push(\n\t\t\t\t\t<NavigationContainer\n\t\t\t\t\t\tkey={key}\n\t\t\t\t\t\tid={key}\n\t\t\t\t\t\tindex={visualIndex}\n\t\t\t\t\t\tisInitial={isInitial}\n\t\t\t\t\t\tisCurrent={isCurrent}\n\t\t\t\t\t\tisPrevious={isPrevious}\n\t\t\t\t\t\tisOverlayed={isOverlayVisible}\n\t\t\t\t\t\tvisible={isCurrent || isPrevious}\n\t\t\t\t\t\tposition={historyItem?.transition?.position}\n\t\t\t\t\t\tinstant={isInstantContainerTransition(index, stackState)}\n\t\t\t\t\t\ttransitionProps={transitionProps}\n\t\t\t\t\t\tanimation={animationPropsForContainer(index, stackState)}\n\t\t\t\t\t\tbackfaceVisible={getBackfaceVisibleForScreen(index, stackState)}\n\t\t\t\t\t\texitAnimation={historyItem?.transition?.animation}\n\t\t\t\t\t\texitBackfaceVisible={historyItem?.transition?.backfaceVisible}\n\t\t\t\t\t\texitProps={historyItem?.transition?.enter}\n\t\t\t\t\t\twithMagicMotion={withMagicMotion}\n\t\t\t\t\t\tareMagicMotionLayersPresent={areMagicMotionLayersPresent ? false : undefined}\n\t\t\t\t\t>\n\t\t\t\t\t\t<MagicMotionCrossfadeRoot>\n\t\t\t\t\t\t\t{containerContent({\n\t\t\t\t\t\t\t\tcomponent,\n\t\t\t\t\t\t\t\ttransition: historyItem?.transition,\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</MagicMotionCrossfadeRoot>\n\t\t\t\t\t</NavigationContainer>,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tconst overlayContainers = this.state.overlayStack.map((item, stackIndex) => {\n\t\t\t\treturn (\n\t\t\t\t\t<NavigationContainer\n\t\t\t\t\t\tisLayeredContainer\n\t\t\t\t\t\tkey={item.key}\n\t\t\t\t\t\tisCurrent={stackIndex === this.state.currentOverlay}\n\t\t\t\t\t\tposition={item.transition.position}\n\t\t\t\t\t\tinitialProps={initialPropsForOverlay(stackIndex, overlayStackState)}\n\t\t\t\t\t\ttransitionProps={transitionPropsForOverlay(stackIndex, overlayStackState)}\n\t\t\t\t\t\tinstant={isInstantContainerTransition(stackIndex, overlayStackState, true)}\n\t\t\t\t\t\tanimation={animationPropsForContainer(stackIndex, overlayStackState)}\n\t\t\t\t\t\texitProps={item.transition.enter}\n\t\t\t\t\t\tvisible={containerIsVisible(stackIndex, overlayStackState)}\n\t\t\t\t\t\tbackdropColor={backdropColorForTransition(item.transition)}\n\t\t\t\t\t\tbackfaceVisible={getBackfaceVisibleForOverlay(stackIndex, overlayStackState)}\n\t\t\t\t\t\tonTapBackdrop={backdropTapAction(item.transition, this.goBack)}\n\t\t\t\t\t\tindex={this.state.current + 1 + stackIndex}\n\t\t\t\t\t>\n\t\t\t\t\t\t{containerContent({\n\t\t\t\t\t\t\tcomponent: item.component,\n\t\t\t\t\t\t\ttransition: item.transition,\n\t\t\t\t\t\t})}\n\t\t\t\t\t</NavigationContainer>\n\t\t\t\t)\n\t\t\t})\n\n\t\t\treturn (\n\t\t\t\t<FrameWithMotion\n\t\t\t\t\tdata-framer-component-type=\"NavigationRoot\"\n\t\t\t\t\ttop={0}\n\t\t\t\t\tleft={0}\n\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\theight=\"100%\"\n\t\t\t\t\tposition=\"relative\"\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\toverflow: \"hidden\",\n\t\t\t\t\t\tbackgroundColor: \"unset\",\n\t\t\t\t\t\tpointerEvents: undefined,\n\t\t\t\t\t\t...this.props.style,\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<NavigationContext.Provider value={this}>\n\t\t\t\t\t\t<IsInitialNavigationContext.Provider value={isInitial}>\n\t\t\t\t\t\t\t<NavigationContainer\n\t\t\t\t\t\t\t\tisLayeredContainer\n\t\t\t\t\t\t\t\tposition={undefined}\n\t\t\t\t\t\t\t\tinitialProps={{}}\n\t\t\t\t\t\t\t\tinstant={false}\n\t\t\t\t\t\t\t\ttransitionProps={transitionPropsForStackWrapper(activeOverlay)}\n\t\t\t\t\t\t\t\tanimation={animationForStackWrapper(activeOverlay)}\n\t\t\t\t\t\t\t\tbackfaceVisible={backfaceVisibleForStackWrapper(activeOverlay)}\n\t\t\t\t\t\t\t\tvisible\n\t\t\t\t\t\t\t\tbackdropColor={undefined}\n\t\t\t\t\t\t\t\tonTapBackdrop={undefined}\n\t\t\t\t\t\t\t\tindex={0}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<LayoutIdProvider>\n\t\t\t\t\t\t\t\t\t<SharedLayoutRoot>\n\t\t\t\t\t\t\t\t\t\t<AnimatePresence presenceAffectsLayout={false}>{contentContainers}</AnimatePresence>\n\t\t\t\t\t\t\t\t\t</SharedLayoutRoot>\n\t\t\t\t\t\t\t\t</LayoutIdProvider>\n\t\t\t\t\t\t\t</NavigationContainer>\n\t\t\t\t\t\t\t<AnimatePresence>{overlayContainers}</AnimatePresence>\n\t\t\t\t\t\t</IsInitialNavigationContext.Provider>\n\t\t\t\t\t</NavigationContext.Provider>\n\t\t\t\t</FrameWithMotion>\n\t\t\t)\n\t\t}\n\t}\n})()\n\nconst animationDefault: Transition = {\n\tstiffness: 500,\n\tdamping: 50,\n\trestDelta: 1,\n\ttype: \"spring\",\n}\n\ninterface ActiveOverlay {\n\tcurrentOverlayItem: HistoryItem | undefined\n\tpreviousOverlayItem: HistoryItem | undefined\n}\n\nfunction activeOverlayItem(overlayStack: StackState): ActiveOverlay {\n\tlet currentOverlayItem: HistoryItem | undefined\n\tlet previousOverlayItem: HistoryItem | undefined\n\tif (overlayStack.current !== -1) {\n\t\tcurrentOverlayItem = overlayStack.history[overlayStack.current]\n\t} else {\n\t\tpreviousOverlayItem = overlayStack.history[overlayStack.previous]\n\t}\n\treturn { currentOverlayItem, previousOverlayItem }\n}\n\nfunction transitionPropsForStackWrapper({ currentOverlayItem }: ActiveOverlay) {\n\treturn currentOverlayItem && currentOverlayItem.transition.exit\n}\n\nfunction animationForStackWrapper({ currentOverlayItem, previousOverlayItem }: ActiveOverlay): Transition {\n\tif (currentOverlayItem && currentOverlayItem.transition.animation) {\n\t\treturn currentOverlayItem.transition.animation\n\t}\n\tif (previousOverlayItem && previousOverlayItem.transition.animation) {\n\t\treturn previousOverlayItem.transition.animation\n\t}\n\treturn animationDefault\n}\n\nfunction backfaceVisibleForStackWrapper({ currentOverlayItem, previousOverlayItem }: ActiveOverlay) {\n\tif (currentOverlayItem) return currentOverlayItem.transition.backfaceVisible\n\treturn previousOverlayItem && previousOverlayItem.transition.backfaceVisible\n}\n\nfunction backdropColorForTransition(transition: NavigationTransition): string | undefined {\n\tif (transition.backdropColor) return transition.backdropColor\n\tif (transition.overCurrentContext) return \"rgba(4,4,15,.4)\" // iOS dim color\n\treturn undefined\n}\n\nfunction getBackfaceVisibleForOverlay(containerIndex: number, stackState: StackState): boolean | undefined {\n\tconst { current, history } = stackState\n\tif (containerIndex === current) {\n\t\t// current\n\t\tconst navigationItem = history[containerIndex]\n\t\tif (navigationItem && navigationItem.transition) {\n\t\t\treturn navigationItem.transition.backfaceVisible\n\t\t}\n\t\treturn true\n\t} else if (containerIndex < current) {\n\t\t// old\n\t\tconst navigationItem = history[containerIndex + 1]\n\t\tif (navigationItem && navigationItem.transition) {\n\t\t\treturn navigationItem.transition.backfaceVisible\n\t\t}\n\t\treturn true\n\t} else {\n\t\t// future\n\t\tconst navigationItem = history[containerIndex]\n\t\tif (navigationItem && navigationItem.transition) {\n\t\t\treturn navigationItem.transition.backfaceVisible\n\t\t}\n\t\treturn true\n\t}\n}\n\nfunction initialPropsForOverlay(containerIndex: number, stackState: StackState): Partial<FrameProps> | undefined {\n\tconst navigationItem = stackState.history[containerIndex]\n\n\tif (navigationItem) return navigationItem.transition.enter\n}\n\nfunction getBackfaceVisibleForScreen(screenIndex: number, stackState: StackState): boolean | undefined {\n\tconst { current, previous, history } = stackState\n\n\t// Entering going backwards || exiting going forward\n\tif ((screenIndex === previous && current > previous) || (screenIndex === current && current < previous)) {\n\t\treturn history[screenIndex + 1]?.transition?.backfaceVisible\n\t}\n\n\t// Entering going forward, exiting going backwards, or all other screens.\n\treturn history[screenIndex]?.transition?.backfaceVisible\n}\n\nfunction transitionPropsForOverlay(overlayIndex: number, stackState: StackState): Partial<FrameProps> | undefined {\n\tconst { current, history } = stackState\n\n\tif (overlayIndex === current) {\n\t\t// current\n\t\treturn\n\t} else if (overlayIndex < current) {\n\t\t// old\n\t\tconst navigationItem = history[overlayIndex + 1]\n\t\tif (navigationItem && navigationItem.transition) {\n\t\t\treturn navigationItem.transition.exit\n\t\t}\n\t} else {\n\t\t// future\n\t\tconst navigationItem = history[overlayIndex]\n\t\tif (navigationItem && navigationItem.transition) {\n\t\t\treturn navigationItem.transition.enter\n\t\t}\n\t}\n}\n\nfunction animationPropsForContainer(containerIndex: number, stackState: StackState): Transition {\n\tconst { current, previous, history } = stackState\n\tconst containerCurrent = previous > current ? previous : current\n\tif (containerIndex < containerCurrent) {\n\t\t// old\n\t\tconst navigationItem = history[containerIndex + 1]\n\t\tif (navigationItem && navigationItem.transition.animation) {\n\t\t\treturn navigationItem.transition.animation\n\t\t}\n\t} else if (containerIndex !== containerCurrent) {\n\t\t// future\n\t\tconst navigationItem = history[containerIndex]\n\t\tif (navigationItem && navigationItem.transition.animation) {\n\t\t\treturn navigationItem.transition.animation\n\t\t}\n\t} else {\n\t\t// current\n\t\tconst navigationItem = history[containerIndex]\n\t\tif (navigationItem?.transition.animation) {\n\t\t\treturn navigationItem.transition.animation\n\t\t}\n\t}\n\n\treturn animationDefault\n}\n\nfunction isInstantContainerTransition(\n\tcontainerIndex: number,\n\tstackState: StackState,\n\toverCurrentContext?: boolean,\n): boolean {\n\tconst { current, previous, history } = stackState\n\tif (overCurrentContext && history.length > 1) return true\n\tif (containerIndex !== previous && containerIndex !== current) return true\n\tif (current === previous) return true\n\treturn false\n}\n\nfunction containerIsVisible(containerIndex: number, stackState: StackState) {\n\tconst { current, previous } = stackState\n\tif (containerIndex > current && containerIndex > previous) return false\n\tif (containerIndex === current) return true\n\n\treturn false\n}\n\nfunction containerContent(item: { component: React.ReactNode; transition: NavigationTransition | undefined }) {\n\tconst content = React.Children.map(\n\t\titem.component,\n\t\t// biome-ignore lint/suspicious/noExplicitAny: deprecated component\n\t\t(child: React.ReactElement<{ [key: string]: any } | undefined>) => {\n\t\t\tif (!isReactChild(child) || !isReactElement(child) || !child.props) {\n\t\t\t\treturn child\n\t\t\t}\n\n\t\t\tconst props: {\n\t\t\t\twidth?: number | string\n\t\t\t\theight?: number | string\n\t\t\t\tminHeight?: number | string\n\t\t\t\tstyle: React.CSSProperties\n\t\t\t} = {\n\t\t\t\tstyle: child.props.style ?? {},\n\t\t\t}\n\n\t\t\tconst position = item?.transition?.position\n\t\t\tconst shouldStretchWidth = !position || (position.left !== undefined && position.right !== undefined)\n\t\t\tconst shouldStretchHeight = !position || (position.top !== undefined && position.bottom !== undefined)\n\n\t\t\tconst canStretchStyle = \"style\" in child.props ? isObject(child.props.style) : true\n\t\t\tif (shouldStretchWidth) {\n\t\t\t\tconst canStretchWidth = \"width\" in child.props\n\t\t\t\tif (canStretchWidth) props.width = \"100%\"\n\t\t\t\tif (canStretchStyle) props.style.width = \"100%\"\n\t\t\t}\n\t\t\tif (shouldStretchHeight) {\n\t\t\t\tconst canStretchHeight = \"height\" in child.props\n\t\t\t\tif (canStretchHeight) props.height = \"100%\"\n\t\t\t\tif (canStretchStyle) props.style.height = \"100%\"\n\t\t\t}\n\n\t\t\treturn React.cloneElement(child, props)\n\t\t},\n\t)\n\treturn content\n}\n\nfunction backdropTapAction(transition: NavigationTransition, goBackAction: () => void) {\n\tif (transition.goBackOnTapOutside !== false) return goBackAction\n}\n\n/**\n * @internal\n */\nfunction NavigationWrapper(props: NavigationProps & { children?: React.ReactNode }) {\n\tconst resetProjection = useResetProjection()\n\tconst skipLayoutAnimation = useInstantLayoutTransition()\n\n\treturn (\n\t\t<Navigation {...props} resetProjection={resetProjection} skipLayoutAnimation={skipLayoutAnimation}>\n\t\t\t{props.children}\n\t\t</Navigation>\n\t)\n}\n\nconst NavigationExport = /* @__PURE__ */ withLibraryCSS(NavigationWrapper)\n\n// Confused how two exports with the same name work? See https://stackoverflow.com/a/67697999\nexport type NavigationClass = InstanceType<typeof Navigation>\nexport { NavigationExport as Navigation, Navigation as NavigationClass }\n", "import type { IProjectionNode, Transition } from \"framer-motion\"\nimport React, { Component } from \"react\"\nimport type { LayoutTree } from \"./SharedLayoutTree.tsx\"\n\n/**\n * @internal\n */\nexport const TREE_ROOT_ID = \"__LAYOUT_TREE_ROOT\"\n\n/**\n * @internal\n */\nexport interface SharedLayoutContextProps {\n\tschedulePromoteTree: (tree: LayoutTree, transition: Transition | undefined, shouldAnimate: boolean) => void\n\tscheduleProjectionDidUpdate: () => void\n\tinitLead: (tree: LayoutTree, shouldAnimate: boolean) => void\n}\n\n/**\n * @internal\n */\nexport const SharedLayoutContext = /* @__PURE__ */ React.createContext<SharedLayoutContextProps>({\n\tschedulePromoteTree: () => {},\n\tscheduleProjectionDidUpdate: () => {},\n\tinitLead: () => {},\n})\n\n/**\n * @internal\n * Orchestrates the promotion of the descendent SharedLayoutTrees:\n * 1. When a LayoutTree mounts as a lead, it will call `initLead` to set itself\n * as the current lead without scheduling a promotion (nodes are promoted on\n * mount automatically in Motion).\n *\n * 2. When a LayoutTree becomes the lead tree, it schedules a promotion in its\n * shouldComponentUpdate lifecycle method. SharedLayoutRoot will kickoff the\n * promotion in its getSnapshotBeforeUpdate lifecycle method, when all of its\n * descendent SharedLayoutTrees finish taking snapshots.\n *\n * 3. When a LayoutTree becomes the lead tree using an non-magic-motion\n * transition, we block its React render. SharedLayoutRoot will also schedule a\n * manual projection tree update to run later in its componentDidUpdate method\n * so that we could perform cleanups correctly.\n */\nexport class SharedLayoutRoot extends Component<{ children?: React.ReactNode }> {\n\tprivate shouldAnimate: boolean = false\n\tprivate transition: Transition | undefined\n\tprivate lead: LayoutTree | undefined\n\tprivate follow: LayoutTree | undefined\n\n\tprivate scheduledPromotion: boolean = false\n\tprivate scheduledDidUpdate: boolean = false\n\n\t// Runs after all descendent SharedLayoutTree finish taking snapshots in\n\t// their getSnapshotBeforeUpdate lifecycle method.\n\toverride getSnapshotBeforeUpdate() {\n\t\tif (!this.scheduledPromotion || !this.lead || !this.follow) return null\n\n\t\tconst needsReset = this.lead?.layoutMaybeMutated && !this.shouldAnimate\n\n\t\tthis.lead.projectionNodes.forEach((projectionNode: IProjectionNode) => {\n\t\t\tprojectionNode?.promote({\n\t\t\t\tneedsReset,\n\t\t\t\ttransition: this.shouldAnimate ? this.transition : undefined,\n\t\t\t\tpreserveFollowOpacity: projectionNode.options.layoutId === TREE_ROOT_ID && !this.follow?.isExiting,\n\t\t\t})\n\t\t})\n\n\t\tif (this.shouldAnimate) {\n\t\t\t// The follow tree is going to be mutated by Magic Motion. If next\n\t\t\t// time it is promoted with an instant transition, we promote it\n\t\t\t// with needsReset to reset it to its identical layout.\n\t\t\tthis.follow.layoutMaybeMutated = true\n\t\t} else {\n\t\t\t// When promoting a tree with an instant transition we block the React\n\t\t\t// update in SharedLayoutTree, so here we schedule a didUpdate manually\n\t\t\t// on the projection tree root so we can perform cleanup & unblock the\n\t\t\t// next layout update.\n\t\t\tthis.scheduleProjectionDidUpdate()\n\t\t}\n\n\t\tthis.lead.layoutMaybeMutated = false\n\t\tthis.transition = undefined\n\t\tthis.scheduledPromotion = false\n\n\t\treturn null\n\t}\n\n\toverride componentDidUpdate() {\n\t\tif (!this.lead) return null\n\t\tif (this.scheduledDidUpdate) {\n\t\t\t// Manually trigger a didUpdate once on the projection tree root\n\t\t\tthis.lead.rootProjectionNode?.root?.didUpdate()\n\t\t\tthis.scheduledDidUpdate = false\n\t\t}\n\t}\n\n\tscheduleProjectionDidUpdate = () => {\n\t\tthis.scheduledDidUpdate = true\n\t}\n\n\t// schedule a promotion to run later in getSnapshotBeforeUpdate\n\tschedulePromoteTree = (tree: LayoutTree, transition: Transition | undefined, shouldAnimate: boolean) => {\n\t\tthis.follow = this.lead\n\t\tthis.shouldAnimate = shouldAnimate\n\t\tthis.lead = tree\n\t\tthis.transition = transition\n\t\tthis.scheduledPromotion = true\n\t}\n\n\tinitLead = (tree: LayoutTree, shouldAnimate: boolean) => {\n\t\tthis.follow = this.lead\n\t\tthis.lead = tree\n\n\t\tif (this.follow && shouldAnimate) {\n\t\t\tthis.follow.layoutMaybeMutated = true\n\t\t}\n\t}\n\n\tsharedLayoutContext = {\n\t\tschedulePromoteTree: this.schedulePromoteTree,\n\t\tscheduleProjectionDidUpdate: this.scheduleProjectionDidUpdate,\n\t\tinitLead: this.initLead,\n\t}\n\n\toverride render() {\n\t\treturn (\n\t\t\t<SharedLayoutContext.Provider value={this.sharedLayoutContext}>\n\t\t\t\t{this.props.children}\n\t\t\t</SharedLayoutContext.Provider>\n\t\t)\n\t}\n}\n", "import { motion } from \"framer-motion\"\nimport type React from \"react\"\nimport { TREE_ROOT_ID } from \"./AnimateLayout/SharedLayoutRoot.tsx\"\n\nconst rootStyles: React.CSSProperties = {\n\twidth: \"100%\",\n\theight: \"100%\",\n\tbackgroundColor: \"none\",\n}\n\n/**\n * @internal\n * When performing a magic motion transition, if the two ground frames don't\n * have matching layoutId, we still want the roots to cross-fade into each other.\n * To implement this, we wrap the content of a navigation screen in a root\n * component that's using a constant layoutId.\n */\nexport function MagicMotionCrossfadeRoot(props: { children?: React.ReactNode }) {\n\treturn (\n\t\t<motion.div layoutId={TREE_ROOT_ID} style={rootStyles}>\n\t\t\t{props.children}\n\t\t</motion.div>\n\t)\n}\n", "import type { MotionValue, Transition } from \"framer-motion\"\nimport { PresenceContext, useAnimation } from \"framer-motion\"\nimport React, { useContext, useEffect, useRef } from \"react\"\nimport { ViewportContext } from \"../modules/useAppearEffect.ts\"\nimport { FrameWithMotion } from \"../render/presentation/Frame/FrameWithMotion.tsx\"\nimport type { DeprecatedFrameWithEventsProps, FrameProps } from \"../render/presentation/Frame/index.tsx\"\nimport { isFiniteNumber } from \"../render/utils/isFiniteNumber.ts\"\nimport { LayoutIdContext } from \"./AnimateLayout/LayoutIdContext.tsx\"\nimport { SharedLayoutTree } from \"./AnimateLayout/SharedLayoutTree.tsx\"\nimport { NavigationContainerContext } from \"./NavigationContainerContext.tsx\"\nimport { NavigationTargetWrapper } from \"./NavigationTargetContext.tsx\"\nimport type { NavigationTransitionPosition } from \"./NavigationTransitions.ts\"\n\nexport interface Props {\n\tindex: number\n\tisLayeredContainer?: boolean\n\tposition: NavigationTransitionPosition | undefined\n\tisInitial?: boolean\n\n\tinitialProps?: Partial<FrameProps> | undefined\n\ttransitionProps: Partial<FrameProps> | undefined\n\texitProps?: Partial<FrameProps> | undefined\n\n\tinstant: boolean\n\tanimation: Transition\n\texitAnimation?: Transition\n\n\tvisible: boolean\n\tbackfaceVisible?: boolean\n\texitBackfaceVisible?: boolean\n\n\tonTapBackdrop?: (() => void) | undefined\n\tbackdropColor?: string | undefined\n\n\twithMagicMotion?: boolean\n\n\tareMagicMotionLayersPresent?: false | undefined\n\tisPrevious?: boolean\n\tisCurrent?: boolean\n\n\t// The value can be outdated when *not* isCurrent, due to memoization\n\tisOverlayed?: boolean\n\n\tchildren: React.ReactNode\n\tid?: string\n}\n\nexport type AnimatingProperties = Partial<DeprecatedFrameWithEventsProps> & { dimOpacity: number }\n\nexport const NavigationContainer = /* @__PURE__ */ React.memo(function NavigationContainer({\n\tisLayeredContainer,\n\tisCurrent,\n\tisPrevious,\n\tisOverlayed = false,\n\tvisible,\n\ttransitionProps,\n\tchildren,\n\tbackdropColor,\n\tonTapBackdrop,\n\tbackfaceVisible,\n\texitBackfaceVisible,\n\tanimation,\n\texitAnimation,\n\tinstant,\n\tinitialProps,\n\texitProps,\n\tposition = { top: 0, right: 0, bottom: 0, left: 0 },\n\twithMagicMotion,\n\tindex,\n\tareMagicMotionLayersPresent,\n\tid,\n\tisInitial,\n}: Props) {\n\tconst animate = useAnimation()\n\tconst presence = useContext(PresenceContext)\n\tconst { persistLayoutIdCache } = useContext(LayoutIdContext)\n\n\tconst previousState = useRef<{\n\t\twasCurrent: boolean | undefined\n\t\twasPrevious: boolean\n\t\twasBeingRemoved: boolean\n\t\twasReset: boolean\n\t\torigins: OriginProps\n\t}>({\n\t\twasCurrent: undefined,\n\t\twasPrevious: false,\n\t\twasBeingRemoved: false,\n\t\twasReset: true,\n\t\torigins: getOriginProps({}, initialProps, transitionProps),\n\t})\n\n\tconst viewportRef = useRef<HTMLDivElement | null>(null)\n\n\tconst isBeingRemoved = presence !== null && !presence.isPresent\n\n\t// When a container mounts, persist the old layoutId cache.\n\tif (isCurrent && previousState.current.wasCurrent === undefined) persistLayoutIdCache()\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>\n\tuseEffect(() => {\n\t\t// Overlays do not use animationControls to animate, don't provide isCurrent or isPrevious,\n\t\t// and don't need to update lastStateRef.\n\t\t// `animate` is mocked as undefined for tests.\n\t\tif (isLayeredContainer || !animate) return\n\n\t\tif (isBeingRemoved) {\n\t\t\tpreviousState.current = {\n\t\t\t\t...previousState.current,\n\t\t\t\twasBeingRemoved: isBeingRemoved,\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tconst { wasPrevious, wasCurrent } = previousState.current\n\n\t\tconst shouldAnimateIn =\n\t\t\t(isCurrent && !wasCurrent) ||\n\t\t\t// If the screen was being removed as a result of a \"go back\" transition, but that removal is interrupted,\n\t\t\t// resulting in this screen being restored to the current screen, we need to trigger an animation.\n\t\t\t(!isBeingRemoved && previousState.current.wasBeingRemoved && isCurrent)\n\t\tconst shouldAnimateOut = isPrevious && !wasPrevious\n\n\t\tconst origins = getOriginProps(previousState.current.origins, initialProps, transitionProps)\n\n\t\tlet wasReset = previousState.current.wasReset\n\n\t\tif (shouldAnimateIn || shouldAnimateOut) {\n\t\t\tanimate.stop()\n\t\t\tvoid animate.start({\n\t\t\t\tzIndex: index,\n\t\t\t\t...origins,\n\t\t\t\t// @TODO: Ignored for now, but should re-check later.\n\t\t\t\t...transitionProps,\n\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: has been this way from before the biome introduction\n\t\t\t} as any)\n\n\t\t\twasReset = false\n\t\t} else if (wasReset === false) {\n\t\t\tanimate.stop()\n\t\t\t// Set an identity transform to reset exit animations on NavigationContainer's that may need to be animated in again later.\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: has been this way from before the biome introduction\n\t\t\tanimate.set({ zIndex: index, ...allAnimatableProperties, opacity: 0 } as any)\n\n\t\t\twasReset = true\n\t\t}\n\n\t\tpreviousState.current = {\n\t\t\twasCurrent: !!isCurrent,\n\t\t\twasPrevious: !!isPrevious,\n\t\t\twasBeingRemoved: false,\n\t\t\twasReset,\n\t\t\torigins,\n\t\t}\n\n\t\t// We only need to update when the NavigationContainer's position in the stack changes, or it is removed.\n\t}, [isCurrent, isPrevious, isBeingRemoved])\n\n\tconst transition: Transition = instant\n\t\t? { type: false }\n\t\t: \"velocity\" in animation\n\t\t\t? { ...animation, velocity: 0 }\n\t\t\t: animation\n\tconst exitTransition: Transition = instant ? { type: false } : exitAnimation || animation\n\n\tconst layout: Partial<FrameProps> = { ...position }\n\tif (layout.left === undefined || layout.right === undefined) layout.width = \"auto\"\n\tif (layout.top === undefined || layout.bottom === undefined) layout.height = \"auto\"\n\n\tconst needsPerspective = contains3Dprops(transitionProps) || contains3Dprops(initialProps)\n\n\t// `perspective: 0` coupled with `backgroundColor: transparent`, combine in Firefox to cause the root element and it's children\n\t// to not be rendered until the tab is refocused. Unsetting `perspective` all together when it's not required, solves this.\n\tconst perspective = needsPerspective && (isLayeredContainer || isCurrent || isPrevious) ? 1200 : undefined\n\n\tconst identity = { ...allAnimatableProperties, ...previousState.current.origins }\n\n\tconst animations = isLayeredContainer\n\t\t? {\n\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: has been this way from before the biome introduction\n\t\t\t\tinitial: { ...identity, ...initialProps } as any,\n\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: has been this way from before the biome introduction\n\t\t\t\tanimate: { ...identity, ...transitionProps, transition } as any, // Overlay animations are sometimes instant\n\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: has been this way from before the biome introduction\n\t\t\t\texit: { ...identity, ...exitProps, transition: animation } as any, // Overlay exits are always animated\n\t\t\t}\n\t\t: {\n\t\t\t\tanimate,\n\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: has been this way from before the biome introduction\n\t\t\t\texit: { ...identity, ...exitProps, transition: exitTransition } as any,\n\t\t\t}\n\n\tconst isPresent = !(isBeingRemoved || areMagicMotionLayersPresent === false)\n\n\t// Available for descendant components to know if this is the active screen, we check for isPresent because the screen might be unmounted\n\tconst isCurrentTarget = !!isCurrent && isPresent\n\n\t// The very first item on the navigation stack should always render with\n\t// opacity 1, for SSR reasons.\n\t//\n\t// TODO: We can probably remove this if/when we create a web-specific\n\t// navigation component.\n\tconst forceOpacity = isCurrent && isInitial\n\n\treturn (\n\t\t<FrameWithMotion\n\t\t\tdata-framer-component-type=\"NavigationContainerWrapper\"\n\t\t\twidth=\"100%\"\n\t\t\theight=\"100%\"\n\t\t\tstyle={{\n\t\t\t\tposition: \"absolute\",\n\t\t\t\ttransformStyle: \"flat\",\n\t\t\t\tbackgroundColor: \"transparent\",\n\t\t\t\toverflow: \"hidden\",\n\t\t\t\t// Unlike Overlays, Screens set zIndex via animation controls to ensure it's set in parallel with the animation being played.\n\t\t\t\t// However, when a screen exits, it needs to preserve it's zIndex, which can't be applied through an `exit` animation,\n\t\t\t\t// and might be impacted by the layer created by `perspective`.\n\t\t\t\tzIndex: isLayeredContainer || isBeingRemoved || (isCurrent && withMagicMotion) ? index : undefined,\n\t\t\t\tpointerEvents: undefined,\n\t\t\t\tvisibility: visible ? \"visible\" : \"hidden\",\n\t\t\t\tperspective,\n\t\t\t}}\n\t\t>\n\t\t\t{isLayeredContainer && (\n\t\t\t\t<FrameWithMotion\n\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\theight=\"100%\"\n\t\t\t\t\tdata-framer-component-type=\"NavigationContainerBackdrop\"\n\t\t\t\t\ttransition={animation}\n\t\t\t\t\tinitial={{ opacity: instant && visible ? 1 : 0 }} // To prevent flashing\n\t\t\t\t\tanimate={{ opacity: 1 }}\n\t\t\t\t\texit={{ opacity: 0 }}\n\t\t\t\t\tbackgroundColor={backdropColor ? backdropColor : \"transparent\"}\n\t\t\t\t\tonTap={!isBeingRemoved ? onTapBackdrop : undefined}\n\t\t\t\t/>\n\t\t\t)}\n\n\t\t\t<FrameWithMotion\n\t\t\t\t{...layout}\n\t\t\t\t{...animations}\n\t\t\t\ttransition={{\n\t\t\t\t\tdefault: transition,\n\t\t\t\t\toriginX: { type: false },\n\t\t\t\t\toriginY: { type: false },\n\t\t\t\t\toriginZ: { type: false },\n\t\t\t\t}}\n\t\t\t\tbackgroundColor=\"transparent\"\n\t\t\t\tbackfaceVisible={!isBeingRemoved ? backfaceVisible : exitBackfaceVisible}\n\t\t\t\tdata-framer-component-type=\"NavigationContainer\"\n\t\t\t\tdata-framer-is-current-navigation-target={!!isCurrent}\n\t\t\t\tstyle={{\n\t\t\t\t\tpointerEvents: undefined,\n\t\t\t\t\t// When we mount a new screen that is going to be animated in with animation controls,\n\t\t\t\t\t// we need to ensure that the screen is hidden until the animation starts.\n\t\t\t\t\topacity: forceOpacity || isLayeredContainer || (isCurrent && withMagicMotion) ? 1 : 0,\n\t\t\t\t}}\n\t\t\t\tdata-is-present={isPresent ? undefined : false}\n\t\t\t\tref={viewportRef}\n\t\t\t>\n\t\t\t\t<ViewportContext.Provider value={viewportRef}>\n\t\t\t\t\t<NavigationContainerContext.Provider value={isCurrentTarget}>\n\t\t\t\t\t\t<NavigationTargetWrapper isCurrent={isCurrentTarget} isOverlayed={isOverlayed}>\n\t\t\t\t\t\t\t<SharedLayoutTree\n\t\t\t\t\t\t\t\tisLead={isCurrent}\n\t\t\t\t\t\t\t\tanimatesLayout={!!withMagicMotion}\n\t\t\t\t\t\t\t\ttransition={transition}\n\t\t\t\t\t\t\t\tisExiting={!isPresent}\n\t\t\t\t\t\t\t\tisOverlayed={isOverlayed}\n\t\t\t\t\t\t\t\tid={id}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t\t</SharedLayoutTree>\n\t\t\t\t\t\t</NavigationTargetWrapper>\n\t\t\t\t\t</NavigationContainerContext.Provider>\n\t\t\t\t</ViewportContext.Provider>\n\t\t\t</FrameWithMotion>\n\t\t</FrameWithMotion>\n\t)\n}, shouldUsePreviousValue)\n\nfunction shouldUsePreviousValue(prevProps: Props, nextProps: Props) {\n\tif (nextProps.isCurrent === undefined) return false\n\tif (prevProps.isCurrent !== nextProps.isCurrent) return false\n\tif (prevProps.isPrevious !== nextProps.isPrevious) return false\n\t// Only re-render when isCurrent and isOverlayed changes\n\tif (nextProps.isCurrent && prevProps.isOverlayed !== nextProps.isOverlayed) return false\n\treturn true\n}\n\ntype OriginProps = Partial<{\n\toriginX: number | string | MotionValue\n\toriginY: number | string | MotionValue\n\toriginZ: number | string | MotionValue\n}>\n\nfunction getOriginProps(\n\tcurrentOriginProps: OriginProps,\n\tinitialProps: OriginProps | undefined,\n\ttransitionProps: OriginProps | undefined,\n): OriginProps {\n\tconst result: OriginProps = { ...currentOriginProps }\n\n\tif (initialProps) {\n\t\tif (isFiniteNumber(initialProps.originX)) result.originX = initialProps.originX\n\t\tif (isFiniteNumber(initialProps.originY)) result.originY = initialProps.originY\n\t\tif (isFiniteNumber(initialProps.originZ)) result.originZ = initialProps.originZ\n\t}\n\n\tif (transitionProps) {\n\t\tif (isFiniteNumber(transitionProps.originX)) result.originX = transitionProps.originX\n\t\tif (isFiniteNumber(transitionProps.originY)) result.originY = transitionProps.originY\n\t\tif (isFiniteNumber(transitionProps.originZ)) result.originZ = transitionProps.originZ\n\t}\n\n\treturn result\n}\n\n//\n// biome-ignore lint/suspicious/noExplicitAny: TODO: Refactor `any` to support `Partial<FrameProps>` | { [prop]: number | string, transition: { [prop]: { from: number | string } } }\nfunction contains3Dprops(containerProps: any | undefined) {\n\tif (!containerProps) return false\n\n\tconst containsProps = \"rotateX\" in containerProps || \"rotateY\" in containerProps || \"z\" in containerProps\n\tif (!containsProps) return false\n\n\tconst toPropsContain3d = containerProps.rotateX !== 0 || containerProps.rotateY !== 0 || containerProps.z !== 0\n\tconst fromPropsContain3d =\n\t\tcontainerProps?.transition?.rotateX.from !== 0 ||\n\t\tcontainerProps?.transition?.rotateY.from !== 0 ||\n\t\tcontainerProps?.transition?.z.from !== 0\n\n\treturn toPropsContain3d || fromPropsContain3d\n}\n\nexport const allAnimatableProperties: Partial<FrameProps> = {\n\tx: 0,\n\ty: 0,\n\tz: 0,\n\trotate: 0,\n\trotateX: 0,\n\trotateY: 0,\n\trotateZ: 0,\n\tscale: 1,\n\tscaleX: 1,\n\tscaleY: 1,\n\tscaleZ: 1,\n\tskew: 0,\n\tskewX: 0,\n\tskewY: 0,\n\toriginX: 0.5,\n\toriginY: 0.5,\n\toriginZ: 0,\n\topacity: 1,\n}\n", "import React from \"react\"\nimport type { MutableRefCallback } from \"../components/utils/refHelper.ts\"\nimport { safeWindow } from \"../utils/safeWindow.ts\"\nimport { useSharedIntersectionObserver } from \"./useSharedIntersectionObserver.ts\"\n\n/**\n * Rather than rely on the intersectionRatio provided by an\n * IntersectionObserverEntry, we run the observer on every percent of\n * intersection, and calculate our own intersection percentage based purely off\n * of height.\n */\nconst thresholds = /* @__PURE__ */ new Array(100).fill(undefined).map((_, i) => i * 0.01)\n\n/**\n * @internal\n */\nexport const ViewportContext = /* @__PURE__ */ React.createContext<React.RefObject<HTMLElement> | null>(null)\n\nexport function useAppearEffect(\n\tref: MutableRefCallback<HTMLElement>,\n\tappearCallback: (isInView: boolean) => void,\n\toptions: {\n\t\tanimateOnce?: boolean\n\t\tthreshold?: { x?: number; y?: number }\n\t\trootMargin?: string | undefined\n\t\tenabled?: boolean\n\t},\n) {\n\tconst internalState = React.useRef({\n\t\tisInView: false,\n\t\thasAnimatedOnce: false,\n\t})\n\n\tconst { enabled, animateOnce, threshold, rootMargin = `0px 0px 0px 0px` } = options\n\n\tconst callback = React.useCallback(\n\t\t(entry: IntersectionObserverEntry) => {\n\t\t\tconst { isInView, hasAnimatedOnce } = internalState.current\n\n\t\t\tconst isIntersecting = isIntersectingWithThreshold(entry, threshold?.y ?? 0)\n\n\t\t\tif (isIntersecting && !isInView) {\n\t\t\t\tif (animateOnce && hasAnimatedOnce) return\n\t\t\t\tinternalState.current.hasAnimatedOnce = true\n\t\t\t\tinternalState.current.isInView = true\n\t\t\t\tappearCallback(true)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (!isIntersecting && isInView) {\n\t\t\t\tinternalState.current.isInView = false\n\t\t\t\tif (animateOnce) return\n\t\t\t\tappearCallback(false)\n\t\t\t\treturn\n\t\t\t}\n\t\t},\n\t\t[animateOnce, threshold?.y, appearCallback],\n\t)\n\n\tuseSharedIntersectionObserver(ref, callback, {\n\t\tthreshold: thresholds,\n\t\trootMargin,\n\t\tenabled: enabled ?? true,\n\t})\n}\n\n/**\n * Calculate the vertical intersection ratio, as a percentage of the target\n * element's height, or the window height, whichever is smaller. This ensures\n * that items that are larger than the size of the viewport are always able to\n * trigger the intersection at any threshold (0, 0.5 or 1).\n */\nfunction calculatedIntersection(intersectionRect: DOMRectReadOnly, boundingClientRect: DOMRectReadOnly): number {\n\t// Don't divide by 0.\n\tif (boundingClientRect.height === 0) return 0\n\treturn intersectionRect.height / Math.min(boundingClientRect.height, safeWindow.innerHeight)\n}\n\nfunction isIntersectingWithThreshold(\n\t{ boundingClientRect, intersectionRect, isIntersecting }: IntersectionObserverEntry,\n\tthreshold: number,\n) {\n\t// If the element is scaled to 0, return true if the element is\n\t// intersecting. The observer is capable of determining this.\n\tif (boundingClientRect.height === 0) return isIntersecting\n\treturn isIntersecting && calculatedIntersection(intersectionRect, boundingClientRect) >= threshold\n}\n", "import type { RefObject } from \"react\"\nimport { createContext, useContext } from \"react\"\nimport type { MutableRefCallback } from \"../components/utils/refHelper.ts\"\nimport { useRefEffect } from \"../components/utils/refHelper.ts\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\nimport { noop } from \"../utils/utils.ts\"\n\ntype IntersectionObserverSingleCallback = (entry: IntersectionObserverEntry, observer: IntersectionObserver) => void\n\nclass SharedIntersectionObserver {\n\t// Note: we don\u2019t want to use #-style private fields here because (as of esbuild 0.17)\n\t// they leave non-tree-shakeable symbols in the bundle: https://framer-team.slack.com/archives/C05V49Q4NJ2/p1715653184830179\n\tprivate sharedIntersectionObserver\n\tprivate callbacks = new WeakMap<Element, IntersectionObserverSingleCallback>()\n\n\tconstructor(options: IntersectionObserverInit) {\n\t\tthis.sharedIntersectionObserver = new IntersectionObserver(this.intersectionObserverCallback.bind(this), options)\n\t}\n\n\tprivate intersectionObserverCallback(entries: IntersectionObserverEntry[], observer: IntersectionObserver) {\n\t\tfor (const entry of entries) {\n\t\t\tconst callbackForElement = this.callbacks.get(entry.target)\n\t\t\tif (callbackForElement) callbackForElement(entry, observer)\n\t\t}\n\t}\n\n\tobserveElementWithCallback(element: HTMLElement, callback: IntersectionObserverSingleCallback) {\n\t\tif (!this.sharedIntersectionObserver) return\n\t\tthis.sharedIntersectionObserver.observe(element)\n\t\tthis.callbacks.set(element, callback)\n\t}\n\n\tunobserve(element: HTMLElement) {\n\t\tif (!this.sharedIntersectionObserver) return\n\t\tthis.sharedIntersectionObserver.unobserve(element)\n\t\tthis.callbacks.delete(element)\n\t}\n\tget root() {\n\t\treturn this.sharedIntersectionObserver?.root\n\t}\n}\n\ntype SharedObserverMap = Map<string, SharedIntersectionObserver>\nexport const SharedIntersectionObserverContext = /* @__PURE__ */ createContext<SharedObserverMap>(new Map())\n\ninterface IntersectionObserverOptions {\n\troot?: RefObject<Element | Document> | null\n\trootMargin?: string\n\tthreshold?: number | number[]\n\tenabled?: boolean\n}\n\nexport function observeElement(\n\tobservers: SharedObserverMap,\n\tkey: string,\n\telement: HTMLElement,\n\troot: RefObject<Element | Document> | null | undefined,\n\tcallback: IntersectionObserverSingleCallback,\n\trootMargin?: string,\n\tthreshold?: number | number[],\n) {\n\tlet observer = observers.get(key)\n\tif (!observer || observer.root !== root?.current) {\n\t\tobserver = new SharedIntersectionObserver({ root: root?.current, rootMargin, threshold })\n\t\tobservers.set(key, observer)\n\t}\n\n\tobserver.observeElementWithCallback(element, callback)\n\treturn () => {\n\t\tobserver.unobserve(element)\n\t}\n}\n\n/**\n * This hook returns a ref callback that can be used to observe an element.\n * It returns a cleanup function that should be called when `element` becomes `null`.\n *\n * @important Does not re-register the observer if options or callback changes.\n * @internal\n */\nfunction _useSharedIntersectionObserver(\n\tref: MutableRefCallback<HTMLElement>,\n\tcallback: IntersectionObserverSingleCallback,\n\toptions: IntersectionObserverOptions,\n) {\n\tconst key = useConstant(() => `${options.rootMargin}`)\n\tconst observers = useContext(SharedIntersectionObserverContext)\n\tconst { enabled, root, rootMargin, threshold } = options\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: observers are static\n\tuseRefEffect(\n\t\tref,\n\t\t(element: HTMLElement | null) => {\n\t\t\tif (!enabled) return\n\t\t\t// we don't want to re-run on cleanup. We return a cleanup function.\n\t\t\tif (element === null) return\n\n\t\t\treturn observeElement(observers, key, element, root, callback, rootMargin, threshold)\n\t\t},\n\t\t[enabled, callback, root, rootMargin, threshold],\n\t)\n}\n\n/**\n * If the client doesn't support the Intersection Observer we can save some performance.\n * @internal\n */\nexport const useSharedIntersectionObserver =\n\ttypeof IntersectionObserver === \"undefined\" ? noop : _useSharedIntersectionObserver\n", "import type * as React from \"react\"\nimport { useRef } from \"react\"\nimport { useMemoOne } from \"../../utils/useMemoOne.ts\"\nimport { isFunction, isObject } from \"../../utils/utils.ts\"\nimport { useConstant } from \"./useConstant.ts\"\n\n/**\n * Sets the ref to the given value or calls any ref functions.\n */\nexport function setRef<T>(ref: MaybeRef<T>, value: T) {\n\tif (isFunction(ref)) {\n\t\tref(value)\n\t} else if (isMutableRef(ref)) {\n\t\tref.current = value\n\t}\n}\n\nexport function isMutableRef<T>(ref: MaybeRef<T | null>): ref is React.MutableRefObject<T | null> {\n\treturn isObject(ref) && \"current\" in ref\n}\n\nexport function refHasValue<T>(ref: MaybeRef<T | null>): ref is React.MutableRefObject<T> {\n\treturn isMutableRef(ref) && ref.current !== null\n}\n\nexport type Ref<T> = React.MutableRefObject<T> | React.LegacyRef<T>\nexport type MaybeRef<T> = Ref<T> | undefined | null\n\ntype MaybeCleanup = ReturnType<Parameters<typeof React.useEffect>[0]>\ntype RefCallbackEffect<T> = (instance: T | null) => MaybeCleanup\n\n/**\n * @private only use `MutableRefCallback`.\n */\ninterface IRefWithCallback<T> extends React.MutableRefObject<T> {\n\tobserve: (fn: RefCallbackEffect<T>) => void\n\tunobserve: (fn: RefCallbackEffect<T> | undefined) => void\n\t// this tagged type ensures only the correct ref is passed to useRefEffect; a whitespace at the beginning hides it from autocomplete.\n\treadonly \" tag\": \"RefWithCallback\"\n}\n\nexport type MutableRefCallback<T> = IRefWithCallback<T | null>\n\nfunction useStableRefWithObserver<T>() {\n\t// TODO: In some cases, we only pass one callback (e.g. Link), so having a set and map is an overhead. If we ever need to optimize for memory, this is a starting point.\n\tconst callbacks = useConstant(() => new Set<RefCallbackEffect<T>>())\n\tconst cleanups = useConstant(() => new Map<RefCallbackEffect<T>, MaybeCleanup>())\n\n\treturn useConstant(\n\t\t() =>\n\t\t\t(ref: React.MutableRefObject<T | null>, refCallback?: React.RefCallback<T>): MutableRefCallback<T> => {\n\t\t\t\treturn {\n\t\t\t\t\tget current(): T | null {\n\t\t\t\t\t\treturn ref.current\n\t\t\t\t\t},\n\t\t\t\t\tset current(value) {\n\t\t\t\t\t\tif (value === ref.current) return // React doesn't execute callbacks if the value stays the same.\n\t\t\t\t\t\tref.current = value\n\n\t\t\t\t\t\t// If passed, we call the callback ref first to match native React behavior:\n\t\t\t\t\t\t// it calls from children to parents. https://codesandbox.io/p/sandbox/react-ref-order-raf-4wfcx4?file=/src/App.js\n\t\t\t\t\t\t// TODO: With React 19, ref callbacks can return a cleanup. When upgrading, we should add the returned cleanup to the `cleanups` map.\n\t\t\t\t\t\tif (refCallback) refCallback(value)\n\n\t\t\t\t\t\t// TODO: With React 19, we should rather return this as the cleanup fn instead.\n\t\t\t\t\t\t// We run the cleanups first whenever the ref changes.\n\t\t\t\t\t\tcleanups.forEach((cleanup, callback) => {\n\t\t\t\t\t\t\tif (cleanup) {\n\t\t\t\t\t\t\t\tcleanup()\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcallback(null)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\tif (value === null) {\n\t\t\t\t\t\t\t// Ensure there are no dangling cleanups / callbacks after unmount.\n\t\t\t\t\t\t\tcleanups.clear()\n\t\t\t\t\t\t\tcallbacks.clear()\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcallbacks.forEach(callback => {\n\t\t\t\t\t\t\tconst cleanup = callback(value)\n\t\t\t\t\t\t\tcleanups.set(callback, cleanup)\n\t\t\t\t\t\t})\n\t\t\t\t\t},\n\t\t\t\t\t/**\n\t\t\t\t\t * Adds `fn` to the list of callbacks to be called when the ref is updated.\n\t\t\t\t\t * Executes `fn` immediately if the ref already has a value.\n\t\t\t\t\t */\n\t\t\t\t\tobserve(fn: RefCallbackEffect<T | null>) {\n\t\t\t\t\t\tcallbacks.add(fn)\n\n\t\t\t\t\t\t// If the ref has a value, we call the callback immediately.\n\t\t\t\t\t\tconst value = ref.current\n\t\t\t\t\t\tif (value) {\n\t\t\t\t\t\t\tconst cleanup = fn(value)\n\t\t\t\t\t\t\tcleanups.set(fn, cleanup)\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t/**\n\t\t\t\t\t * Removes `fn` from the list of callbacks.\n\t\t\t\t\t * Runs the cleanup for `fn` if it has been called before.\n\t\t\t\t\t */\n\t\t\t\t\tunobserve(fn: RefCallbackEffect<T | null> | undefined) {\n\t\t\t\t\t\tif (!fn) return\n\n\t\t\t\t\t\tcallbacks.delete(fn)\n\t\t\t\t\t\tif (!cleanups.has(fn)) return\n\n\t\t\t\t\t\tconst cleanupFn = cleanups.get(fn)\n\t\t\t\t\t\tif (cleanupFn) {\n\t\t\t\t\t\t\tcleanupFn()\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tfn(null)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcleanups.delete(fn)\n\t\t\t\t\t},\n\t\t\t\t} as MutableRefCallback<T>\n\t\t\t},\n\t)\n}\n\n/**\n * Returns a ref-look-alike (current can be read and set as refs returned from `useRef`), but also allows multiple callbacks to be registered.\n * @see {@link useRefEffect} for a way to use the callback\n */\nexport function useObserverRef<T>(forwardedRef: MaybeRef<T>): MutableRefCallback<T> {\n\tconst fallbackRef = useRef<T | null>(null)\n\tconst createStableRefWithObserver = useStableRefWithObserver<T>()\n\n\t// The forwarded ref can have different shapes in React: MutableRef (objects), ref callback (functions), undefined (none passed). We need to handle all of them here:\n\t// Note: `forwardedRef` is stable. So we return a constant ref, too.\n\treturn useConstant(() => {\n\t\t// Case A: the ref is a mutable ref (object). We use it to store the node + attach a callback.\n\t\tif (isMutableRef(forwardedRef)) return createStableRefWithObserver(forwardedRef)\n\n\t\t// Case B: ref callback (function). We use the fallback ref to store the node + forward the provided ref callback.\n\t\t// TODO: We could assign a symbol to the returned observer ref and then check for that here to avoid creating nested observer refs.\n\t\tif (isFunction(forwardedRef)) return createStableRefWithObserver(fallbackRef, forwardedRef)\n\n\t\t// Case C: no ref provided\n\t\t// Some HOCs use forwarded refs to manipulate the DOM directly, so we need to return a ref object instead of a ref callback to allow for them to work.\n\t\treturn createStableRefWithObserver(fallbackRef)\n\t})\n}\n\n/**\n * Use this hook as replacement for `use(Layout)Effect` when dealing with refs in HOCs.\n * This is required, as `useEffect`s might run before the ref is attached (e.g. when a child is a Link component).\n *\n * Lifecycle:\n * - Callbacks are executed *before* (regular) layout effects. So if you want to replace `useEffect`, use the await-interaction-response pattern (so that it awaits a paint).\n * - `ref.current` updates (non-null): re-runs `effect`\n * - `ref.current` becomes null (on unmount): runs cleanup\n *\n * Cleanup if `effect` has at least run once:\n * - If `effect` it returned a function: the returned fn is called with `undefined` as parameter.\n * - If `effect` it returned undefined: `effect` is called with `null` as parameter.\n *\n * `deps` change: cleanup runs first, then the effect.\n *\n * @param ref Must stay a stable {@link useObserverRef} across renders.\n * @param effect Must be pure (calling effect+cleanup twice should yield the same result as calling it once). Not needed to be wrapped in `useCallback`.\n */\nexport function useRefEffect<T>(\n\tref: MutableRefCallback<T> | undefined,\n\teffect: RefCallbackEffect<T | null>,\n\tdeps?: React.DependencyList,\n): void {\n\tconst effectRef = useRef<RefCallbackEffect<T | null>>()\n\t// undefined on first call, and then used as a flag to know if we need to call the effect again\n\tconst depsChangedRef = useRef<undefined | boolean>()\n\n\tuseMemoOne(\n\t\t() => {\n\t\t\t// On initial call, we don't want to update the flag\n\t\t\t// This ensures we know depsChangedRef is only called when the deps change\n\t\t\tif (depsChangedRef.current !== undefined) {\n\t\t\t\tdepsChangedRef.current = true\n\t\t\t}\n\n\t\t\t// Mirrors useEffect() without deps by using a new object\n\t\t},\n\t\tdeps ?? [{}],\n\t)\n\n\tif (!ref) return\n\n\tconst depsChanged = depsChangedRef.current\n\tif (depsChanged === false) return\n\n\t// `depsChangedRef` should always be false after every invocation, as it is used as a local flag to check if deps have changed in *this* invocation.\n\t// Initially, it is `undefined`, so on first call, this activates the dependency tracking.\n\tdepsChangedRef.current = false\n\n\tref.unobserve(effectRef.current) // use(Layout)Effect runs the cleanup first when deps change, so we also run the cleanup first.\n\tref.observe(effect) // Register the next effect closure and run effect if ref has a value.\n\teffectRef.current = effect\n}\n", "import type {\n\tIProjectionNode,\n\tSwitchLayoutGroupContext as SwitchLayoutGroupContextType,\n\tTransition,\n} from \"framer-motion\"\nimport { SwitchLayoutGroupContext } from \"framer-motion\"\nimport React, { Component } from \"react\"\nimport type { SharedLayoutContextProps } from \"./SharedLayoutRoot.tsx\"\nimport { SharedLayoutContext, TREE_ROOT_ID } from \"./SharedLayoutRoot.tsx\"\n\n/**\n * @internal\n */\nexport interface LayoutTreeProps {\n\t/**\n\t * Mark the tree as being the lead tree. The lead tree in the NavigationStack will perform a\n\t * shared layout animation if `animatesLayout` is true.\n\t */\n\tisLead?: boolean\n\t/**\n\t * Mark the tree as being removed.\n\t * For example if the parent NavigationContainer is being removed, or is simulating removal.\n\t */\n\tisExiting?: boolean\n\t/**\n\t * If there is an overlay visible.\n\t */\n\tisOverlayed?: boolean\n\t/**\n\t * If performing a layout animation, use this transition.\n\t */\n\ttransition?: Transition\n\t/**\n\t * Should updating `isLead` to `true` trigger a shared layout animation.\n\t */\n\tanimatesLayout?: boolean\n\tchildren?: React.ReactNode\n\tid?: string\n}\n\ninterface ContextLayoutTreeProps extends LayoutTreeProps {\n\tsharedLayoutContext: SharedLayoutContextProps\n}\n\n/**\n * @internal\n */\nexport class LayoutTree extends Component<ContextLayoutTreeProps> {\n\t/**\n\t * SharedLayoutTrees need to reset the projections styles previously applied\n\t * on their boxes if they are becoming lead but not animating.\n\t */\n\tlayoutMaybeMutated: boolean = false\n\n\t/**\n\t * A list of projection nodes in the tree\n\t */\n\tprojectionNodes = new Map<string, IProjectionNode>()\n\n\t/**\n\t * The projection node with the smallest depth in the tree's children.\n\t */\n\trootProjectionNode?: IProjectionNode\n\n\t/**\n\t * When a tree is tagged as being removed, either by usePresence, or by\n\t * Navigation, we set it on `this` in shouldComponentUpdate so that it's\n\t * accessible by SharedLayoutRoot before the LayoutTree has updated.\n\t */\n\tisExiting?: boolean\n\n\toverride componentDidMount() {\n\t\t/**\n\t\t * Nodes are automatically promoted in Motion when they mount. We need\n\t\t * to let SharedLayoutRoot know about the first lead without scheduling\n\t\t * a promotion.\n\t\t */\n\t\tif (this.props.isLead) {\n\t\t\tthis.props.sharedLayoutContext.initLead(this, !!this.props.animatesLayout)\n\t\t}\n\t}\n\n\toverride shouldComponentUpdate(nextProps: ContextLayoutTreeProps) {\n\t\tconst { isLead, isExiting, isOverlayed, animatesLayout, transition, sharedLayoutContext } = nextProps\n\t\tthis.isExiting = isExiting\n\t\t/**\n\t\t * Since Navigation wraps it's child NavigationContainers in a NavigationContainer,\n\t\t * we need to ensure that we don't prevent updates if we are not handling layout animations.\n\t\t */\n\t\tif (isLead === undefined) return true\n\n\t\tconst hasBecomeLead = !this.props.isLead && isLead\n\t\tconst hasExitBeenCancelled = this.props.isExiting && !isExiting\n\t\tconst shouldPromote = hasBecomeLead || hasExitBeenCancelled\n\t\tconst shouldDemote = !!this.props.isLead && !isLead\n\t\tconst overlayChanged = this.props.isOverlayed !== isOverlayed\n\n\t\tif (shouldPromote || shouldDemote) {\n\t\t\tthis.projectionNodes.forEach(projection => projection?.willUpdate())\n\t\t}\n\n\t\tif (shouldPromote) {\n\t\t\tsharedLayoutContext.schedulePromoteTree(this, transition, !!animatesLayout)\n\t\t} else if (overlayChanged) {\n\t\t\t/**\n\t\t\t * When performing an overlay transition, we block the layout update\n\t\t\t * in Motion, but we don't promote the tree since the lead doesn't\n\t\t\t * change. Therefore, we still need to schedule a didUpdate manually\n\t\t\t * to unblock the layout update for the next layout animation.\n\t\t\t */\n\t\t\tsharedLayoutContext.scheduleProjectionDidUpdate()\n\t\t}\n\n\t\treturn !!shouldPromote && !!animatesLayout\n\t}\n\n\tshouldPreserveFollowOpacity = (child: IProjectionNode) => {\n\t\treturn child.options.layoutId === TREE_ROOT_ID && !this.props.isExiting\n\t}\n\n\tswitchLayoutGroupContext: SwitchLayoutGroupContextType = {\n\t\tregister: child => this.addChild(child),\n\t\tderegister: child => this.removeChild(child),\n\t\t// Configs to use for the initial promotion on mount in Motion\n\t\ttransition: this.props.isLead !== undefined && this.props.animatesLayout ? this.props.transition : undefined,\n\t\tshouldPreserveFollowOpacity: this.shouldPreserveFollowOpacity,\n\t}\n\n\taddChild(child: IProjectionNode): void {\n\t\tconst layoutId = child.options.layoutId\n\n\t\tif (layoutId) {\n\t\t\tthis.projectionNodes.set(layoutId, child)\n\t\t\tthis.setRootChild(child)\n\t\t}\n\t}\n\n\t/**\n\t * As children are added, make sure that `this.rootProjectionNode` is always the\n\t * child with the smallest depth.\n\t */\n\tsetRootChild(child: IProjectionNode) {\n\t\tif (!this.rootProjectionNode) return (this.rootProjectionNode = child)\n\n\t\tthis.rootProjectionNode = this.rootProjectionNode.depth < child.depth ? this.rootProjectionNode : child\n\t}\n\n\tremoveChild(child: IProjectionNode) {\n\t\tconst layoutId = child.options.layoutId\n\n\t\tif (layoutId) {\n\t\t\tthis.projectionNodes.delete(layoutId)\n\t\t}\n\t}\n\n\toverride render() {\n\t\treturn (\n\t\t\t<SwitchLayoutGroupContext.Provider value={this.switchLayoutGroupContext}>\n\t\t\t\t{this.props.children}\n\t\t\t</SwitchLayoutGroupContext.Provider>\n\t\t)\n\t}\n}\n\nexport const SharedLayoutTree = (props: LayoutTreeProps) => {\n\tconst sharedLayoutContext = React.useContext(SharedLayoutContext)\n\treturn <LayoutTree {...props} sharedLayoutContext={sharedLayoutContext} />\n}\n", "import React, { useContext } from \"react\"\n\n/**\n * @internal\n */\nexport const NavigationContainerContext = /* @__PURE__ */ React.createContext<boolean>(true)\n\n/**\n * Used to know if a code component is a child of the current screen.\n * This can be useful for resetting timers or interactions that need to trigger on every navigation.\n * @public\n */\nexport function useIsInCurrentNavigationTarget() {\n\t// isInCurrentNavigationTarget is `true` if the NavigationContainerContext at the root of each screen is the current screen.\n\tconst isInCurrentNavigationTarget = useContext(NavigationContainerContext)\n\n\treturn isInCurrentNavigationTarget\n}\n", "import type React from \"react\"\nimport { createContext, useCallback, useContext, useEffect, useRef } from \"react\"\nimport { isFunction } from \"../utils/utils.ts\"\nimport { useMap } from \"./utils/useMap.ts\"\n\ntype Cleanup = () => void\n// biome-ignore lint/suspicious/noConfusingVoidType: has been like this for 4 years\ntype IsCurrentCallback = (isCurrent: boolean, isOverlayed: boolean) => void | Cleanup\n\nconst NavigationTargetContext = /* @__PURE__ */ createContext<{\n\tregister: (fn: IsCurrentCallback) => void\n\tderegister: (fn: IsCurrentCallback) => void\n}>({ register: () => {}, deregister: () => {} })\n\ntype Props = React.PropsWithChildren<{ isCurrent: boolean; isOverlayed: boolean }>\n\n/**\n * @internal\n *\n * Run the registered callback when the current navigation target changes\n * @param isCurrent If the ground node is present as the current target in the preview\n */\nexport const NavigationTargetWrapper = ({ isCurrent, isOverlayed, children }: Props) => {\n\tconst callbacks = useMap<IsCurrentCallback, Cleanup | undefined>()\n\n\tconst register = useCallback(\n\t\t(fn: IsCurrentCallback) => {\n\t\t\tif (callbacks.has(fn)) {\n\t\t\t\t// Should never happen\n\t\t\t\t// biome-ignore lint/suspicious/noConsole: intentional\n\t\t\t\tconsole.warn(\"NavigationTargetWrapper: already registered\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tcallbacks.set(fn, undefined)\n\t\t},\n\t\t[callbacks /* constant, so should never change */],\n\t)\n\n\tconst deregister = useCallback(\n\t\t(fn: IsCurrentCallback) => {\n\t\t\t// Cleanup before removing the callback\n\t\t\tconst cleanup = callbacks.get(fn)\n\t\t\tcleanup?.()\n\t\t\tcallbacks.delete(fn)\n\t\t},\n\t\t[callbacks /* constant, so should never change */],\n\t)\n\n\tconst value = useRef({ register, deregister }).current\n\n\tuseEffect(() => {\n\t\tcallbacks.forEach((_, cb) => {\n\t\t\tconst newCleanup = cb(isCurrent, isOverlayed)\n\t\t\tcallbacks.set(cb, isFunction(newCleanup) ? newCleanup : undefined)\n\t\t})\n\t\treturn () => {\n\t\t\tcallbacks.forEach((cleanup, cb) => {\n\t\t\t\tif (!cleanup) return\n\t\t\t\t// Cleanup and remove cleanup callback so we never call it more than once\n\t\t\t\tcleanup()\n\t\t\t\tcallbacks.set(cb, undefined)\n\t\t\t})\n\t\t}\n\t}, [isCurrent, isOverlayed, callbacks /* constant, so should never change */])\n\n\treturn <NavigationTargetContext.Provider value={value}>{children}</NavigationTargetContext.Provider>\n}\n\n/**\n * @internal\n *\n * Register the callback on mount to the NavigationTargetWrapper, deregister it on unmount.\n * The callback will be fired when the current target changes. The callback allows a cleanup callback to be returned.\n * The cleanup will fire before the next update and on unmount.\n * @param callback A callback that receives the `isCurrent` state of the NavigateTargetWrapper\n * @param deps If present, callback will be renewed when the dependencies change.\n */\nexport function useOnCurrentTargetChange(callback: IsCurrentCallback, deps: React.DependencyList = []) {\n\tconst { register, deregister } = useContext(NavigationTargetContext)\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: callback should not change while previewing\n\tuseEffect(() => {\n\t\tif (!callback) return\n\t\tregister(callback)\n\t\treturn () => deregister(callback)\n\t}, [register, deregister, ...deps])\n}\n", "import type { Transition } from \"framer-motion\"\nimport type { FrameLayoutProperties, FrameProps } from \"../render/presentation/Frame/index.tsx\"\n\n/**\n * @public\n */\nexport type NavigationTransitionSide = \"left\" | \"right\" | \"top\" | \"bottom\"\n\n/**\n * @public\n */\nexport type NavigationTransitionPosition = Partial<\n\tPick<FrameLayoutProperties, \"top\" | \"right\" | \"bottom\" | \"left\" | \"center\">\n>\n\n/**\n * @public\n */\nexport interface NavigationTransitionAnimation {\n\t/**\n\t * The animation defaults.\n\t */\n\tanimation?: Transition\n}\n\n/**\n * @public\n */\nexport interface NavigationTransitionBackdropColor {\n\t/**\n\t * Defines the backdrop color when the incoming screen is rendered over the current context. Defaults to the iOS dim color.\n\t */\n\tbackdropColor?: string\n}\n\n/**\n * @public\n */\nexport interface NavigationTransitionAppearsFrom extends NavigationTransitionAnimation {\n\t/**\n\t * Defines which side the target will appear from.\n\t * @remarks\n\t *\n\t * - `\"left\"`\n\t * - `\"right\"`\n\t * - `\"top\"`\n\t * - `\"bottom\"`\n\t */\n\tappearsFrom?: NavigationTransitionSide\n}\n\n/**\n * @public\n */\nexport type FadeTransitionOptions = NavigationTransitionAnimation\n\n/**\n * @public\n */\nexport interface PushTransitionOptions extends NavigationTransitionAnimation, NavigationTransitionAppearsFrom {}\n\n/**\n * @public\n */\nexport interface ModalTransitionOptions extends NavigationTransitionAnimation, NavigationTransitionBackdropColor {}\n\n/**\n * @public\n */\nexport interface OverlayTransitionOptions\n\textends NavigationTransitionAnimation, NavigationTransitionAppearsFrom, NavigationTransitionBackdropColor {}\n\n/**\n * @public\n */\nexport interface FlipTransitionOptions extends NavigationTransitionAnimation, NavigationTransitionAppearsFrom {}\n\n/**\n * Can be used to define a custom navigation transition.\n * @public\n */\nexport interface NavigationTransition extends NavigationTransitionAnimation, NavigationTransitionBackdropColor {\n\t/**\n\t * Defines the begin state of the incoming screen wrapper.\n\t */\n\tenter?: Partial<FrameProps>\n\t/**\n\t * Defines the end state of the outgoing screen wrapper.\n\t */\n\texit?: Partial<FrameProps>\n\t/**\n\t * Defines the position and size of the incoming screen wrapper. Defaults to top, right, bottom, and left of 0.\n\t */\n\tposition?: NavigationTransitionPosition\n\t/**\n\t * Defines whether the incoming screen should render over the current context, like an overlay or modal. Defaults to false.\n\t */\n\toverCurrentContext?: boolean\n\t/**\n\t * Defines whether a tap in the background should dismiss the screen presented over the current context. Defaults to true.\n\t */\n\tgoBackOnTapOutside?: boolean\n\t/**\n\t * Defines whether the backface of the incoming and outgoing screens should be visible, necessary for certain 3D transitions. Defaults to true.\n\t */\n\tbackfaceVisible?: boolean\n\t/**\n\t * Defines whether the incoming and outgoing screens should auto animate their children. Defaults to false.\n\t */\n\twithMagicMotion?: boolean\n}\n\n/**\n * @internal\n */\nexport const TransitionDefaults = {\n\tFade: {\n\t\texit: { opacity: 0 },\n\t\tenter: { opacity: 0 },\n\t} satisfies NavigationTransition,\n\n\tPushLeft: {\n\t\texit: { x: \"-30%\" },\n\t\tenter: { x: \"100%\" },\n\t} satisfies NavigationTransition,\n\n\tPushRight: {\n\t\texit: { x: \"30%\" },\n\t\tenter: { x: \"-100%\" },\n\t} satisfies NavigationTransition,\n\n\tPushUp: {\n\t\texit: { y: \"-30%\" },\n\t\tenter: { y: \"100%\" },\n\t} satisfies NavigationTransition,\n\n\tPushDown: {\n\t\texit: { y: \"30%\" },\n\t\tenter: { y: \"-100%\" },\n\t} satisfies NavigationTransition,\n\n\tInstant: {\n\t\tanimation: { type: false },\n\t\tenter: { opacity: 0 },\n\t} satisfies NavigationTransition,\n\n\tModal: {\n\t\toverCurrentContext: true,\n\t\tgoBackOnTapOutside: true,\n\t\tposition: { center: true },\n\t\tenter: { opacity: 0, scale: 1.2 },\n\t} satisfies NavigationTransition,\n\n\tOverlayLeft: {\n\t\toverCurrentContext: true,\n\t\tgoBackOnTapOutside: true,\n\t\tposition: { right: 0, top: 0, bottom: 0 },\n\t\tenter: { x: \"100%\" },\n\t} satisfies NavigationTransition,\n\n\tOverlayRight: {\n\t\toverCurrentContext: true,\n\t\tgoBackOnTapOutside: true,\n\t\tposition: { left: 0, top: 0, bottom: 0 },\n\t\tenter: { x: \"-100%\" },\n\t} satisfies NavigationTransition,\n\n\tOverlayUp: {\n\t\toverCurrentContext: true,\n\t\tgoBackOnTapOutside: true,\n\t\tposition: { bottom: 0, left: 0, right: 0 },\n\t\tenter: { y: \"100%\" },\n\t} satisfies NavigationTransition,\n\n\tOverlayDown: {\n\t\toverCurrentContext: true,\n\t\tgoBackOnTapOutside: true,\n\t\tposition: { top: 0, left: 0, right: 0 },\n\t\tenter: { y: \"-100%\" },\n\t} satisfies NavigationTransition,\n\n\tFlipLeft: {\n\t\tbackfaceVisible: false,\n\t\texit: { rotateY: -180 },\n\t\tenter: { rotateY: 180 },\n\t} satisfies NavigationTransition,\n\n\tFlipRight: {\n\t\tbackfaceVisible: false,\n\t\texit: { rotateY: 180 },\n\t\tenter: { rotateY: -180 },\n\t} satisfies NavigationTransition,\n\n\tFlipUp: {\n\t\tbackfaceVisible: false,\n\t\texit: { rotateX: 180 },\n\t\tenter: { rotateX: -180 },\n\t} satisfies NavigationTransition,\n\n\tFlipDown: {\n\t\tbackfaceVisible: false,\n\t\texit: { rotateX: -180 },\n\t\tenter: { rotateX: 180 },\n\t} satisfies NavigationTransition,\n\n\tMagicMotion: {\n\t\twithMagicMotion: true,\n\t} satisfies NavigationTransition,\n} as const\n\n/**\n * @internal\n */\nexport function pushTransition(options: NavigationTransitionAppearsFrom | undefined): NavigationTransition {\n\tconst side: NavigationTransitionSide = options && options.appearsFrom ? options.appearsFrom : \"right\"\n\tswitch (side) {\n\t\tcase \"right\":\n\t\t\treturn TransitionDefaults.PushLeft\n\t\tcase \"left\":\n\t\t\treturn TransitionDefaults.PushRight\n\t\tcase \"bottom\":\n\t\t\treturn TransitionDefaults.PushUp\n\t\tcase \"top\":\n\t\t\treturn TransitionDefaults.PushDown\n\t}\n}\n\n/**\n * @internal\n */\nexport function overlayTransition(options: NavigationTransitionAppearsFrom | undefined): NavigationTransition {\n\tconst side: NavigationTransitionSide = options && options.appearsFrom ? options.appearsFrom : \"bottom\"\n\tswitch (side) {\n\t\tcase \"right\":\n\t\t\treturn TransitionDefaults.OverlayLeft\n\t\tcase \"left\":\n\t\t\treturn TransitionDefaults.OverlayRight\n\t\tcase \"bottom\":\n\t\t\treturn TransitionDefaults.OverlayUp\n\t\tcase \"top\":\n\t\t\treturn TransitionDefaults.OverlayDown\n\t}\n}\n\n/**\n * @internal\n */\nexport function flipTransition(options: NavigationTransitionAppearsFrom | undefined): NavigationTransition {\n\tconst side: NavigationTransitionSide = options && options.appearsFrom ? options.appearsFrom : \"bottom\"\n\tswitch (side) {\n\t\tcase \"right\":\n\t\t\treturn TransitionDefaults.FlipLeft\n\t\tcase \"left\":\n\t\t\treturn TransitionDefaults.FlipRight\n\t\tcase \"bottom\":\n\t\t\treturn TransitionDefaults.FlipUp\n\t\tcase \"top\":\n\t\t\treturn TransitionDefaults.FlipDown\n\t}\n}\n", "import type { Transition } from \"framer-motion\"\nimport type React from \"react\"\nimport { asRecord } from \"../utils/asRecord.ts\"\nimport { assert } from \"../utils/assert.ts\"\nimport { objectKeys } from \"../utils/objectKeys.ts\"\nimport { isObject, isString } from \"../utils/utils.ts\"\nimport { allAnimatableProperties } from \"./NavigationContainer.tsx\"\nimport type { NavigationTransition } from \"./NavigationTransitions.ts\"\n\n/**\n * @internal\n */\nexport interface NavigationState {\n\t/** The index of the currently visible container. */\n\tcurrent: number\n\t/** The index of the last visible container. */\n\tprevious: number\n\t/** The index of the currently visible overlay. */\n\tcurrentOverlay: number\n\t/** The index of the last visible overlay. */\n\tpreviousOverlay: number\n\t/** An array of HistoryItems who's components are rendered as overlays. */\n\toverlayStack: HistoryItem[]\n\t/**\n\t * A reference to the last transition used when adding screens with magic motion.\n\t * Used to ensure the correct transition is used when navigating back.\n\t */\n\tpreviousTransition: NavigationTransition | null\n\t/**\n\t * An array of HistoryItems that records the order containers are navigated to,\n\t * the transitions used for each navigation, and the visual index the container was rendered at.\n\t * Used to enable navigating backwards through the history.\n\t */\n\thistory: HistoryItem[]\n\t/**\n\t * A record mapping a container's `key` to the component rendered by a container.\n\t * Used to stably render a single instance of each component.\n\t * The visual order is determined by `containerIndex` and `containerVisualIndex`.\n\t * Whether or not a container is the visible screen is determined by whether or not\n\t * the value of the container's `containerIndex` matches the value of `current`.\n\t */\n\tcontainers: Record<ContainerKey, React.ReactNode>\n\t/**\n\t * A record mapping a container's `key` to the current index of the container in the history.\n\t * Used to associated a single component with multiple transitions or positions in the stack.\n\t */\n\tcontainerIndex: Record<ContainerKey, number>\n\t/**\n\t * A record mapping a container's `key` to the current visual index of the container in the history.\n\t * This can sometimes differ from `containerIndex` when we navigate to an existing navigation target with a magic motion transition,\n\t * when it will be lower than the `containerIndex`. This enables smarter layering during magic motion transitions.\n\t */\n\tcontainerVisualIndex: Record<ContainerKey, number>\n\t/**\n\t * A record mapping a container's `key` to whether the container should appear to be removed by a magic motion transition.\n\t * Usually this is only true for containers that have been navigated away from by removing them.\n\t * Sometimes this is true when a container has been navigated away from by navigating forward to an existing container with magic motion.\n\t * This ensures that an animation plays in both these scenarios.\n\t */\n\tcontainerIsRemoved: Record<ContainerKey, boolean>\n\t/**\n\t * A record mapping a container's `key` to the most recent sequenced animation it should appear to animate in or out with.\n\t * This record is not updated unless the container is the `current` or `previous` screen, to ensure running animations play out.\n\t */\n\ttransitionForContainer: Record<ContainerKey, Record<string, any>>\n\t/**\n\t * When we navigate away from a container by removing it with magic motion, sometimes we cannot mark a container as removed to trigger an animation, as it was already removed.\n\t * In that scenario we need to increment it's visual index to trigger an animation, even though we are navigating backwards through history. For that we need to track a\n\t * visual index that is incremented while traveling backwards.\n\t */\n\tvisualIndex: number\n\t/** Used to generate unique overlay ids. */\n\toverlayItemId: number\n\t/** Used to generate unique history ids in the scenario where a React component is not provided, for example via code. */\n\thistoryItemId: number\n}\n\nexport const defaultState = (): NavigationState => ({\n\tcurrent: -1,\n\tprevious: -1,\n\tcurrentOverlay: -1,\n\tpreviousOverlay: -1,\n\n\tvisualIndex: 0,\n\toverlayItemId: 0,\n\thistoryItemId: 0,\n\n\thistory: [],\n\toverlayStack: [],\n\n\tcontainers: {},\n\tcontainerIndex: {},\n\tcontainerVisualIndex: {},\n\tcontainerIsRemoved: {},\n\ttransitionForContainer: {},\n\n\tpreviousTransition: null,\n})\n\n/**\n * @internal\n */\nexport interface StackState {\n\tcurrent: number\n\tprevious: number\n\thistory: HistoryItem[]\n}\n\n/**\n * @internal\n */\ntype ContainerKey = string\n\n/**\n * @internal\n */\nexport interface HistoryItem {\n\tkey: ContainerKey\n\ttransition: NavigationTransition\n\tcomponent?: React.ReactNode\n\tvisualIndex?: number\n}\n\n/**\n * @internal\n */\nexport function isPartialHistoryItem(item: unknown): item is Omit<HistoryItem, \"component\"> {\n\treturn !!item && isObject(item) && isString(item.key)\n}\n\n/**\n * @internal\n */\nexport type NavigationAction =\n\t| {\n\t\t\ttype: \"add\"\n\t\t\tkey: ContainerKey\n\t\t\ttransition: NavigationTransition\n\t\t\tcomponent: React.ReactNode\n\t  }\n\t| { type: \"addOverlay\"; transition: NavigationTransition; component: React.ReactNode }\n\t| { type: \"remove\" }\n\t| { type: \"removeOverlay\" }\n\t| { type: \"update\"; key: ContainerKey; component: React.ReactNode }\n\t| { type: \"back\" }\n\t| { type: \"forward\" }\n\n/**\n * @internal\n */\nexport function reduceNavigationStateForAction(\n\tstate: NavigationState,\n\taction: NavigationAction,\n): NavigationState | undefined {\n\tswitch (action.type) {\n\t\tcase \"addOverlay\":\n\t\t\treturn addOverlay(state, action.transition, action.component)\n\t\tcase \"removeOverlay\":\n\t\t\treturn removeOverlay(state)\n\t\tcase \"add\":\n\t\t\treturn add(state, action.key, action.transition, action.component)\n\t\tcase \"remove\":\n\t\t\treturn remove(state)\n\t\tcase \"update\":\n\t\t\treturn updateComponent(state, action.key, action.component)\n\t\tcase \"back\":\n\t\t\treturn back(state)\n\t\tcase \"forward\":\n\t\t\treturn forward(state)\n\t\tdefault:\n\t\t\treturn\n\t}\n}\n\nfunction updateComponent(currentState: NavigationState, key: ContainerKey, component: React.ReactNode) {\n\treturn {\n\t\t...currentState,\n\t\tcontainers: {\n\t\t\t...currentState.containers,\n\t\t\t[key]: component,\n\t\t},\n\t}\n}\n\n/**\n * Add a new navigation target as an overlay.\n */\nfunction addOverlay(currentState: NavigationState, transition: NavigationTransition, component: React.ReactNode) {\n\tconst currentOverlay = currentState.overlayStack[currentState.currentOverlay]\n\n\tif (currentOverlay && currentOverlay.component === component) return\n\n\tconst overlayItemId = currentState.overlayItemId + 1\n\tconst overlayStack = [\n\t\t...currentState.overlayStack,\n\t\t{\n\t\t\tkey: `stack-${overlayItemId}`,\n\t\t\tcomponent,\n\t\t\ttransition,\n\t\t},\n\t]\n\treturn {\n\t\t...currentState,\n\t\toverlayStack,\n\t\toverlayItemId,\n\t\tcurrentOverlay: Math.max(0, Math.min(currentState.currentOverlay + 1, overlayStack.length - 1)),\n\t\tpreviousOverlay: currentState.currentOverlay,\n\t}\n}\n\n/**\n * Dismiss all overlays.\n */\nfunction removeOverlay(currentState: NavigationState) {\n\treturn {\n\t\t...currentState,\n\t\toverlayStack: [],\n\t\tcurrentOverlay: -1,\n\t\tpreviousOverlay: currentState.currentOverlay,\n\t}\n}\n\n/** Navigate to a new or existing navigation target with an animated transition. */\nfunction add(\n\tcurrentState: NavigationState,\n\tkey: ContainerKey,\n\ttransition: NavigationTransition,\n\tcomponent: React.ReactNode,\n) {\n\tif (!currentState.containers[key]) currentState.containers[key] = component\n\n\t// Restart history from current, erasing navigations that we have \"gone back\" from.\n\t// It's ok to mutate currentState because we always return a copy so there is no risk of mutations between actions.\n\tcurrentState.history = currentState.history.slice(0, currentState.current + 1)\n\tcurrentState.visualIndex = Math.max(currentState.history.length, 0)\n\n\tconst currentItem = currentState.history[currentState.history.length - 1]\n\tconst isCurrentScreen = currentItem && currentItem.key === key\n\n\t// In the rare case where a navigation from an overlay, to the screen under the overlay is triggered,\n\t// just dismiss the overlay.\n\tcurrentState.overlayStack = []\n\tif (isCurrentScreen && currentState.currentOverlay > -1) {\n\t\treturn {\n\t\t\t...currentState,\n\t\t\tcurrentOverlay: -1,\n\t\t\tpreviousOverlay: currentState.currentOverlay,\n\t\t}\n\t}\n\n\t// Don't push the same screen twice.\n\tif (isCurrentScreen) return\n\n\t// Calculate whether magic motion transitions should appear as if they are navigating backwards.\n\tconst nextIndex = currentState.containerVisualIndex[key]\n\tconst removed = currentState.containerIsRemoved[key]\n\tconst shouldMoveForward =\n\t\tcurrentItem?.key && transition.withMagicMotion\n\t\t\t? isNextTargetForward(key, nextIndex, removed, currentState.history)\n\t\t\t: true\n\n\tcurrentState.history.push({\n\t\tkey,\n\t\ttransition,\n\t\tvisualIndex: shouldMoveForward ? Math.max(currentState.visualIndex, 0) : currentState.containerVisualIndex[key],\n\t})\n\n\tconst current = currentState.current + 1\n\tconst previous = currentState.current\n\n\t// If we've gone backwards through history, but are now navigating forwards again,\n\t// we need to ensure that there are no clashing indexes from previous forward navigations\n\t// stored in the `containerIndex` record by setting clashes to their most recent history index.\n\tfor (const containerKey in currentState.containerIndex) {\n\t\tif (currentState.containerIndex[containerKey] === current) {\n\t\t\tcurrentState.containerIndex[containerKey] = findLatestHistoryIndex(containerKey, currentState.history)\n\t\t}\n\t}\n\n\tcurrentState.containerIndex[key] = current\n\n\tconst { containerVisualIndex, containerIsRemoved } = magicMotionPropsForAdd(currentState, key, shouldMoveForward)\n\n\tconst transitionForContainer = updateTransitions(\n\t\tcurrent,\n\t\tprevious,\n\t\tcurrentState.history,\n\t\tcurrentState.containerIndex,\n\t\tcurrentState.transitionForContainer,\n\t)\n\n\treturn {\n\t\t...currentState,\n\t\tcurrent,\n\t\tprevious,\n\t\tcontainerVisualIndex,\n\t\tcontainerIsRemoved,\n\t\ttransitionForContainer,\n\t\tpreviousTransition: null,\n\t\tcurrentOverlay: -1,\n\t\thistoryItemId: currentState.historyItemId + 1,\n\t\tpreviousOverlay: currentState.currentOverlay,\n\t}\n}\n\n/**\n * @FIXME -- This simple function supports browser back by not removing pages.\n * This allows subsequent forward actions to navigate to an already mounted\n * component. This may have unintended effects when interacting with magic\n * motion however. Since magic motion between framer web pages will have dubious\n * value, this hasn't been implemented.\n */\nfunction back(currentState: NavigationState) {\n\tconst containers = { ...currentState.containers }\n\tconst nextState = remove(currentState)\n\tif (!nextState) return\n\n\tnextState.containers = containers\n\treturn nextState\n}\n\nfunction forward(currentState: NavigationState) {\n\tconst nextItem = currentState.history[currentState.current + 1]\n\tif (!nextItem) return\n\tconst { key, transition, component } = nextItem\n\n\tconst history = [...currentState.history]\n\tconst nextState = add(currentState, key, transition, component)\n\tif (!nextState) return\n\n\tnextState.history = history\n\n\treturn nextState\n}\n\n/**\n * Navigate away from the screen that was most recently navigated to, to the previous screen.\n * Animations will play in reverse.\n */\nfunction remove(currentState: NavigationState) {\n\tconst history = [...currentState.history.slice(0, currentState.current + 1)]\n\n\t// Don't remove the last component.\n\tif (history.length === 1) return\n\n\tconst currentItem = history.pop()\n\tif (!currentItem) return\n\n\tconst target = history[history.length - 1]\n\tassert(target, \"The navigation history must have at least one component\")\n\t// Ensure the target container is updated to be layered under the current container.\n\t// If it has been previously navigated away from, it will need to be updated.\n\t// It's ok to mutate currentState because we always return a copy so there is no risk of mutations between actions.\n\tcurrentState.containerIndex[target.key] = history.length - 1\n\n\tconst shouldRemoveContainer = history.every(item => item.key !== currentItem.key)\n\tif (shouldRemoveContainer) {\n\t\t// Remove the container from the cache, triggering it's removal from the DOM.\n\t\tdelete currentState.containers[currentItem.key]\n\t}\n\n\tconst current = currentState.current - 1\n\tconst previous = currentState.current\n\n\tconst { containerIsRemoved, containerVisualIndex, previousTransition, visualIndex } = magicMotionPropsForRemove(\n\t\tcurrentState,\n\t\ttarget,\n\t\tcurrentItem,\n\t)\n\n\tconst transitionForContainer = updateTransitions(\n\t\tcurrent,\n\t\tprevious,\n\t\tcurrentState.history,\n\t\tcurrentState.containerIndex,\n\t\tcurrentState.transitionForContainer,\n\t)\n\n\treturn {\n\t\t...currentState,\n\t\tcurrent,\n\t\tprevious,\n\t\tcontainerIsRemoved,\n\t\tcontainerVisualIndex,\n\t\tpreviousTransition,\n\t\tvisualIndex,\n\t\ttransitionForContainer,\n\t}\n}\n\n/**\n * When transitioning forwards to an existing container, update navigation state to optimize magic motion sequences.\n * In cases where we are about to navigate to a screen we have already navigated to with a magic motion transition,\n * we optimize the animation experience by simulating a back transition to solve layering issues.\n */\nfunction magicMotionPropsForAdd(currentState: NavigationState, nextKey: ContainerKey, shouldMoveForward: boolean) {\n\tconst update: Pick<NavigationState, \"containerVisualIndex\" | \"containerIsRemoved\"> = {\n\t\tcontainerVisualIndex: { ...currentState.containerVisualIndex },\n\t\tcontainerIsRemoved: { ...currentState.containerIsRemoved },\n\t}\n\n\tif (shouldMoveForward) {\n\t\t// If we have calculated that the transition should appear to move forward, the default behavior,\n\t\t// we update properties on the current and target component to animate it in.\n\t\t// Ensuring it's a valid target for measurements, and that it is not removed.\n\t\tupdate.containerVisualIndex[nextKey] = currentState.history.length - 1\n\t\tupdate.containerIsRemoved[nextKey] = false\n\t} else {\n\t\t// If we have calculated that the transition should appear to move backwards, to optimize for magic motion layering,\n\t\t// we need to set all components visited since visiting the target as removed,\n\t\t// and also ensure that components visited since visiting the target, that are not the outgoing screen,\n\t\t// can not provide bounding boxes when calculating the magic motion transition.\n\t\tconst nextVisualIndex = currentState.containerVisualIndex[nextKey]\n\t\tfor (const [key, visualIndex] of Object.entries(currentState.containerVisualIndex)) {\n\t\t\tif (nextVisualIndex !== undefined && visualIndex > nextVisualIndex) {\n\t\t\t\tupdate.containerIsRemoved[key] = true\n\t\t\t}\n\t\t}\n\t}\n\n\treturn update\n}\n\n/**\n * When transitioning back to a previous container, update navigation state to optimize magic motion sequences.\n * In cases where we have navigated forward via magic motion transitions that appear to add and remove screens,\n * while continuing to add to the history, we need to replicate the opposite navigations when transitioning back.\n */\nfunction magicMotionPropsForRemove(currentState: NavigationState, target: HistoryItem, currentItem: HistoryItem) {\n\t// Ensure the current and next components are valid magic motion targets.\n\tconst validTargets = [target.key, currentItem.key]\n\tconst nextValidTarget = currentState.history[currentState.history.length - 2]\n\tconst previousTransition = currentState.previousTransition === null ? null : { ...currentState.previousTransition }\n\n\tconst update: Pick<\n\t\tNavigationState,\n\t\t\"containerIsRemoved\" | \"containerVisualIndex\" | \"previousTransition\" | \"visualIndex\"\n\t> = {\n\t\tcontainerIsRemoved: { ...currentState.containerIsRemoved },\n\t\tcontainerVisualIndex: { ...currentState.containerVisualIndex },\n\t\tpreviousTransition,\n\t\tvisualIndex: currentState.visualIndex,\n\t}\n\n\t// Optionally prepare the next potential screen to as a valid magic motion target,\n\t// to ensure successive magic motion back transitions are already measured.\n\tif (nextValidTarget) validTargets.push(nextValidTarget.key)\n\n\t// Decide if we should appear to remove or add the next component by detecting if it was previously simulated as a backwards transition,\n\t// based on the differences between its visual index, and what its visual index should be if it hadn't been simulated as a backwards transition.\n\tconst targetVisualIndex = currentState.containerVisualIndex[target.key]\n\tconst currentVisualIndex = currentState.containerVisualIndex[currentItem.key]\n\n\tconst shouldRemoveLastKey =\n\t\t(targetVisualIndex !== undefined && currentVisualIndex !== undefined && targetVisualIndex <= currentVisualIndex) ||\n\t\t(target.visualIndex !== undefined && target.visualIndex < currentState.history.length - 1)\n\n\tconst nextIndex = target.visualIndex\n\tif (shouldRemoveLastKey) {\n\t\t// Set the last key to be removed, and set the next keys visualIndex to what it was set to last time we were at this point in history.\n\t\t// This is the normal behaviour when transitioning backwards.\n\t\tupdate.containerIsRemoved[currentItem.key] = true\n\t\tupdate.containerVisualIndex[target.key] = nextIndex !== undefined ? nextIndex : currentState.history.length - 1\n\t} else {\n\t\t// If we shouldn't remove the last key, we need to simulate a forward transition.\n\t\t// We do this by incrementing the visualIndex counter, and update the next items visual index to trigger an animation.\n\t\tupdate.visualIndex = currentState.visualIndex + 1\n\t\tupdate.containerVisualIndex[target.key] = currentState.visualIndex + 1\n\t}\n\n\t// If a transition is with magic motion, we save the transition properties to pass to AnimateSharedLayout.\n\tif (currentItem.transition.withMagicMotion) update.previousTransition = currentItem.transition || null\n\n\t// The new current component should never appear to be removed.\n\tcurrentState.containerIsRemoved[target.key] = false\n\n\treturn update\n}\n\nfunction findLatestHistoryIndex(key: ContainerKey, history: HistoryItem[]) {\n\tfor (let index = history.length; index > history.length; index--) {\n\t\tif (history[index]?.key === key) return index\n\t}\n\n\treturn -1\n}\n\nfunction updateTransitions(\n\tcurrent: number,\n\tprevious: number,\n\thistory: NavigationState[\"history\"],\n\tcontainerIndex: NavigationState[\"containerIndex\"],\n\ttransitionForContainer: NavigationState[\"transitionForContainer\"],\n) {\n\t// Set or update the transition for a container if it becomes the current or previous screen.\n\t// We don't update if the container is not the current or previous Screen, to allow running animations to play out.\n\tconst transitions = { ...transitionForContainer }\n\tfor (const [key, screenIndex] of Object.entries(containerIndex)) {\n\t\tconst transition = transitionForScreen(screenIndex, { current, previous, history })\n\t\tif (transition) {\n\t\t\ttransitions[key] = transition\n\t\t}\n\t}\n\n\treturn transitions\n}\n\nfunction isNextTargetForward(\n\tkey: ContainerKey,\n\tindex: number | undefined,\n\tremoved: boolean | undefined,\n\thistory: HistoryItem[],\n) {\n\t// If the target layer is currently removed, or a brand new layer that\n\t// doesn't have a visual index, we always move forward to it.\n\tif (removed || index === undefined) return true\n\n\t// A target layer that is visually 0 indexed will always be the first in the stack.\n\tif (index === 0) return false\n\n\t// Go forward if the next instance of the target is forward from the current visual index.\n\tconst forwardHistory = history.slice(index, history.length)\n\tif (forwardHistory.findIndex(item => item.key === key) > -1) return true\n\n\t// Bo backwards if the next instance is backwards from the current visual index.\n\tconst backwardsHistory = history.slice(0, index - 1)\n\tif (backwardsHistory.findIndex(item => item.key === key) > -1) return false\n\n\t// By default transitions appear to transition forwards.\n\treturn true\n}\n\nfunction transitionForScreen(screenIndex: number, stackState: StackState) {\n\tconst { current, previous, history } = stackState\n\n\t// If a screen has already exited, or entered and is underneath the stack,\n\t// don't update it's animation, allowing any current animations to play out.\n\tif (screenIndex !== current && screenIndex !== previous) return undefined\n\n\t// Entering going forward\n\tif (screenIndex === current && current > previous) {\n\t\tconst item = history[screenIndex]\n\t\treturn sequence(\"enter\", item?.transition.enter, item?.transition.animation)\n\t}\n\n\t// Exiting going forward\n\tif (screenIndex === previous && current > previous) {\n\t\tconst item = history[screenIndex + 1]\n\t\treturn sequence(\"exit\", item?.transition.exit, item?.transition.animation)\n\t}\n\n\t// Entering going backwards\n\tif (screenIndex === current && current < previous) {\n\t\tconst item = history[screenIndex + 1]\n\t\treturn sequence(\"enter\", item?.transition.exit, item?.transition.animation)\n\t}\n\n\t// Exiting going backwards\n\tif (screenIndex === previous && current < previous) {\n\t\tconst item = history[screenIndex]\n\t\treturn sequence(\"exit\", item?.transition.enter, item?.transition.animation)\n\t}\n}\n\nconst allAnimatableKeys = /* @__PURE__ */ objectKeys(allAnimatableProperties)\nfunction sequence(direction: \"enter\" | \"exit\", transition?: any, animation?: Transition) {\n\tconst value: typeof allAnimatableProperties = {}\n\tconst from: Record<string, unknown> = {}\n\n\t// Create an identity animation.\n\tallAnimatableKeys.forEach(property => {\n\t\tvalue[property] = allAnimatableProperties[property]\n\t\tfrom[property] = {\n\t\t\t...animation,\n\t\t\tfrom: allAnimatableProperties[property],\n\t\t}\n\t})\n\n\t// If a transition is provided, add the desired transition properties to the identity animation.\n\tif (transition) {\n\t\tObject.keys(transition).forEach(property => {\n\t\t\tif (transition[property] === undefined) return\n\n\t\t\tconst transitionTo = transition[property]\n\t\t\tconst transitionFrom =\n\t\t\t\ttypeof transition[property] === \"string\"\n\t\t\t\t\t? `${asRecord(allAnimatableProperties)[property]}%`\n\t\t\t\t\t: asRecord(allAnimatableProperties)[property]\n\n\t\t\tasRecord(value)[property] = direction === \"enter\" ? transitionFrom : transitionTo\n\t\t\tfrom[property] = {\n\t\t\t\t...animation,\n\t\t\t\tfrom: direction === \"enter\" ? transitionTo : transitionFrom,\n\t\t\t\tvelocity: 0,\n\t\t\t}\n\t\t})\n\t}\n\n\t// Always return at least the identity animation.\n\treturn {\n\t\t...value,\n\t\ttransition: {\n\t\t\t...from,\n\t\t},\n\t}\n}\n", "import hoistNonReactStatic from \"hoist-non-react-statics\"\nimport React from \"react\"\nimport type {\n\tNavigationTransitionBackdropColor,\n\tNavigationTransitionSide,\n} from \"../../components/NavigationTransitions.ts\"\nimport type { NavigationTransitionDirection } from \"../../render/types/NavigationLink.ts\"\nimport { NavigationTransitionType } from \"../../render/types/NavigationLink.ts\"\nimport { NavigationContext } from \"../NavigationContext.ts\"\n\n/**\n * @internal\n * @deprecated - Will be replaced. Use navigation action instead.\n */\nexport function WithNavigator<T, BaseProps extends React.ClassAttributes<T>>(\n\tBaseComponent: React.ComponentType<BaseProps & { onTap?: any }>,\n\tnavigationTransition: string,\n\tnavigationTransitionDirection: NavigationTransitionDirection,\n\tNavigationTarget: (() => React.ReactNode) | undefined,\n\tnavigationTransitionOptions?: NavigationTransitionBackdropColor,\n): React.ComponentClass<BaseProps> {\n\tconst InternalWithNavigator = class extends React.Component<BaseProps> {\n\t\toverride render() {\n\t\t\treturn (\n\t\t\t\t<NavigationContext.Consumer>\n\t\t\t\t\t{navigation => {\n\t\t\t\t\t\tconst navigate = () => {\n\t\t\t\t\t\t\tif (navigationTransition === \"goBack\") {\n\t\t\t\t\t\t\t\tnavigation.goBack()\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!NavigationTarget) return\n\n\t\t\t\t\t\t\tconst component = NavigationTarget()\n\t\t\t\t\t\t\tconst appearsFrom = transitionDirectionToSide(navigationTransitionDirection)\n\n\t\t\t\t\t\t\tswitch (navigationTransition) {\n\t\t\t\t\t\t\t\tcase NavigationTransitionType.instant:\n\t\t\t\t\t\t\t\t\tnavigation.instant(component)\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\tcase NavigationTransitionType.fade:\n\t\t\t\t\t\t\t\t\tnavigation.fade(component)\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\tcase NavigationTransitionType.modal:\n\t\t\t\t\t\t\t\t\tnavigation.modal(component, navigationTransitionOptions)\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\tcase NavigationTransitionType.push:\n\t\t\t\t\t\t\t\t\tnavigation.push(component, { appearsFrom })\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\tcase NavigationTransitionType.overlay:\n\t\t\t\t\t\t\t\t\tnavigation.overlay(component, {\n\t\t\t\t\t\t\t\t\t\t...navigationTransitionOptions,\n\t\t\t\t\t\t\t\t\t\tappearsFrom,\n\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\tcase NavigationTransitionType.flip:\n\t\t\t\t\t\t\t\t\tnavigation.flip(component, { appearsFrom })\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\tcase NavigationTransitionType.magicMotion:\n\t\t\t\t\t\t\t\t\tnavigation.magicMotion(component, {})\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Invoke the component\u2019s normal onTap handler as well as the navigation function.\n\t\t\t\t\t\tconst { onTap, ...props } = this.props as any\n\t\t\t\t\t\tif (onTap) {\n\t\t\t\t\t\t\tprops.onTap = (...args: unknown[]) => {\n\t\t\t\t\t\t\t\tonTap.apply(this, args)\n\t\t\t\t\t\t\t\tnavigate.apply(this, args)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tprops.onTap = navigate\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn <BaseComponent {...props} />\n\t\t\t\t\t}}\n\t\t\t\t</NavigationContext.Consumer>\n\t\t\t)\n\t\t}\n\t}\n\n\thoistNonReactStatic(InternalWithNavigator, BaseComponent)\n\treturn InternalWithNavigator\n}\n\n// Convert deprecated transitionDirection to transitionSide\nfunction transitionDirectionToSide(direction: NavigationTransitionDirection): NavigationTransitionSide {\n\tswitch (direction) {\n\t\tcase \"left\":\n\t\t\treturn \"right\"\n\t\tcase \"right\":\n\t\t\treturn \"left\"\n\t\tcase \"up\":\n\t\t\treturn \"bottom\"\n\t\tcase \"down\":\n\t\t\treturn \"top\"\n\t}\n}\n", "import type { NavigationTransitionBackdropColor } from \"../../components/NavigationTransitions.ts\"\n\n/**\n * @internal\n * @deprecated\n */\nexport enum NavigateTo {\n\tPrevious = \"@Previous\",\n}\n\n/**\n * @internal\n * @deprecated\n */\nexport type NavigationTarget = string | NavigateTo.Previous\n\n/**\n * @internal\n * @deprecated\n */\nexport enum NavigationTransitionType {\n\tpush = \"push\",\n\tinstant = \"instant\",\n\tfade = \"fade\",\n\tmodal = \"modal\",\n\toverlay = \"overlay\",\n\tflip = \"flip\",\n\tmagicMotion = \"magicMotion\",\n}\n\n/**\n * @internal\n * @deprecated\n */\nexport type NavigationTransitionDirection = \"left\" | \"right\" | \"up\" | \"down\"\n\n/**\n * @internal\n * @deprecated\n */\nexport interface NavigationLink {\n\tnavigationTarget: NavigationTarget\n\tnavigationTransition: NavigationTransitionType\n\tnavigationTransitionDirection: NavigationTransitionDirection\n\tnavigationTransitionOverrides?: NavigationTransitionBackdropColor\n}\n", "/**\n * @public\n * @deprecated Since Framer Motion 5 AnimateSharedLayout is no longer required for shared layout transitions.\n * You can use the `layoutId` prop and components will animate from one to another.\n * If you need to group components that affect each other's layout or scope shared layout animation, consider using `LayoutGroup` instead.\n */\nexport const AnimateSharedLayout = (props: any) => props.children\n", "import type React from \"react\"\nimport type { DeprecatedFrameWithEventsProps } from \"../render/presentation/Frame/index.tsx\"\nimport { DeprecatedFrameWithEvents } from \"../render/presentation/Frame/index.tsx\"\nimport type { DraggableProps } from \"./hoc/WithDragging.tsx\"\nimport { WithDragging } from \"./hoc/WithDragging.tsx\"\n\n/** @public */\nexport const Draggable: React.ComponentClass<\n\tPartial<DeprecatedFrameWithEventsProps> & Partial<DraggableProps<typeof DeprecatedFrameWithEvents>>\n> = /* @__PURE__ */ WithDragging(DeprecatedFrameWithEvents)\n", "import { frame } from \"framer-motion\"\nimport React, { useEffect, useRef } from \"react\"\nimport { useSharedIntersectionObserver } from \"../../modules/useSharedIntersectionObserver.ts\"\nimport type { PaginationInfo } from \"../../router/types.ts\"\nimport { type MutableRefCallback, useObserverRef } from \"../utils/refHelper.ts\"\n\nexport interface UseInfiniteScrollProps {\n\tref: MutableRefCallback<HTMLElement | null>\n\tloadMore: () => void\n\trootMargin?: string\n\tthreshold?: number | number[]\n\tpaginationInfo: PaginationInfo\n}\n\nfunction useInfiniteScroll({ ref: observerRef, loadMore, rootMargin = \"0px\", paginationInfo }: UseInfiniteScrollProps) {\n\tconst isVisibleRef = useRef(false)\n\tconst callback = React.useCallback(\n\t\t(entry: IntersectionObserverEntry) => {\n\t\t\tif (!entry.isIntersecting) {\n\t\t\t\tisVisibleRef.current = false\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tisVisibleRef.current = true\n\t\t\tloadMore()\n\t\t\treturn\n\t\t},\n\t\t[loadMore],\n\t)\n\n\t// The IO doesn't fire again if the spinner is still visible, so whenever we change the page,\n\t// we need to check if the element is still visible.\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: see above\n\tuseEffect(() => {\n\t\t// the IntersectionObserver fires with low prio, so let's wait 2 frames to make sure the\n\t\t// visibility status is correct.\n\t\tframe.postRender(() => {\n\t\t\tframe.render(() => {\n\t\t\t\tif (isVisibleRef.current) {\n\t\t\t\t\tloadMore()\n\t\t\t\t}\n\t\t\t})\n\t\t})\n\t}, [paginationInfo.currentPage, loadMore])\n\n\tuseSharedIntersectionObserver(observerRef, callback, {\n\t\trootMargin,\n\t\tenabled: paginationInfo.currentPage < paginationInfo.totalPages,\n\t})\n}\n\ntype WithInfiniteScrollProps<P> = P & {\n\t__paginationInfo: PaginationInfo\n\t__loadMore: () => void\n}\n\n/** @public */\nexport function withInfiniteScroll<P>(Component: React.ComponentType<P>) {\n\treturn React.forwardRef(\n\t\t(\n\t\t\t{ __paginationInfo, __loadMore, ...props }: WithInfiniteScrollProps<P>,\n\t\t\tref: React.MutableRefObject<HTMLElement>,\n\t\t) => {\n\t\t\tconst infiniteScrollRef = useObserverRef(ref)\n\n\t\t\tuseInfiniteScroll({\n\t\t\t\trootMargin: \"500px\",\n\t\t\t\tloadMore: __loadMore,\n\t\t\t\tref: infiniteScrollRef,\n\t\t\t\tpaginationInfo: __paginationInfo,\n\t\t\t})\n\n\t\t\treturn <Component {...(props as P)} ref={infiniteScrollRef} />\n\t\t},\n\t)\n}\n", "import { isTest } from \"@framerjs/shared/src/environment.ts\"\nimport type { MotionValue, PanInfo } from \"framer-motion\"\nimport { animate, animateValue, motionValue, useMotionValue } from \"framer-motion\"\nimport React, { startTransition } from \"react\"\nimport type { FrameProps } from \"../../render/presentation/Frame/FrameWithMotion.tsx\"\nimport { FrameWithMotion } from \"../../render/presentation/Frame/FrameWithMotion.tsx\"\nimport type { Rect } from \"../../render/types/Rect.ts\"\nimport { RenderTarget } from \"../../render/types/RenderEnvironment.ts\"\nimport type { Size } from \"../../render/types/Size.ts\"\nimport { withLibraryCSS } from \"../../render/utils/injectComponentCSSRules.ts\"\nimport { isFiniteNumber } from \"../../render/utils/isFiniteNumber.ts\"\nimport { isMotionValue } from \"../../render/utils/isMotionValue.ts\"\nimport { useLayoutId } from \"../../render/utils/useLayoutId.ts\"\nimport { useIsomorphicLayoutEffect } from \"../../useIsomorphicLayoutEffect.ts\"\nimport { isReactChild, isReactElement } from \"../../utils/type-guards.ts\"\nimport { warnOnce } from \"../../utils/warnOnce.ts\"\nimport { EmptyState } from \"../EmptyState.tsx\"\nimport { useWheelScroll } from \"../Scroll/useWheelScroll.ts\"\nimport type { PaddingProps } from \"../utils/paddingFromProps.ts\"\nimport { makePaddingString, paddingFromProps } from \"../utils/paddingFromProps.ts\"\nimport { PageContainer, pageContentWrapperType } from \"./PageContainer.tsx\"\nimport type {\n\tCustomPageEffect,\n\tPageDirection,\n\tPageEffect,\n\tPageEffectInfo,\n\tPageEffectValues,\n\tPageProperties,\n\tPageProps,\n} from \"./types.ts\"\n\n/**\n * The Page component allows you to create horizontally or vertically swipeable areas. It can be\n * imported from the Framer Library and used in code components. Add children to create pages to\n * swipe between. These children will be stretched to the size of the page component by default,\n * but can also be set to auto to maintain their original size.\n *\n * @remarks\n * ```jsx\n * import React from \"react\"\n * import { Frame, Page } from \"framer\"\n * export class Page extends React.Component {\n *   render() {\n *     return (\n *       <Page>\n *         <Frame />\n *       </Page>\n *     )\n *   }\n * }\n * ```\n * @public\n * @deprecated The option to add those to \"Canvas\" pages has been removed as of May 2025, but pages using this might exist in the wild.\n */\nconst PageInner = /* @__PURE__ */ React.forwardRef<HTMLDivElement, Partial<PageProps>>(function Page(\n\tprops,\n\tforwardedRef: React.RefObject<HTMLDivElement> | null,\n) {\n\tconst {\n\t\tdirection = \"horizontal\",\n\t\tcontentWidth = \"stretch\",\n\t\tcontentHeight = \"stretch\",\n\t\talignment = \"start\",\n\t\tcurrentPage = 0,\n\t\tanimateCurrentPageUpdate = true,\n\t\tgap: gapValue = 10,\n\t\tpadding: _padding = 0,\n\t\tmomentum = false,\n\t\tdragEnabled = true,\n\t\tdefaultEffect: _defaultEffect = \"none\",\n\t\tbackground = \"transparent\",\n\t\toverflow = \"hidden\",\n\t\t__fromCodeComponentNode,\n\t\teffect: _effect,\n\t\tchildren,\n\t\tcontentOffsetX,\n\t\tcontentOffsetY,\n\t\tonChangePage,\n\t\tonScrollStart,\n\t\tonScroll,\n\t\tonDragStart,\n\t\tonDrag,\n\t\tonDragEnd,\n\t\tdirectionLock,\n\t\tonScrollEnd,\n\t\tonDirectionLock: _onDirectionLock,\n\t\tonUpdate: _onUpdate,\n\t\twheelEnabled = false,\n\t\tlayoutId: specificLayoutId,\n\t\t...rest\n\t} = props\n\n\tconst layoutId = useLayoutId(props, { specificLayoutId, postfix: \"page\" })\n\tconst containerProps = { ...rest, background }\n\tconst hasMountedRef = React.useRef(false)\n\n\tconst hasFixedSize =\n\t\tRenderTarget.hasRestrictions() &&\n\t\tprops.__fromCodeComponentNode &&\n\t\tisFiniteNumber(containerProps.width) &&\n\t\tisFiniteNumber(containerProps.height)\n\n\tif (!hasFixedSize && __fromCodeComponentNode && !containerProps.__fromCanvasComponent) {\n\t\tcontainerProps.width = \"100%\"\n\t\tcontainerProps.height = \"100%\"\n\t\tcontainerProps._constraints = { enabled: true }\n\t}\n\n\tconst { initial, prev } = React.useRef({\n\t\tinitial: { x: 0, y: 0 },\n\t\tprev: { x: 0, y: 0 },\n\t}).current\n\n\tconst isHorizontal = direction === \"horizontal\"\n\tlet gap = gapValue\n\tif (gap < 0) {\n\t\twarnOnce(`The 'gap' property of Page component can not be negative, but is ${gapValue}.`)\n\t\tgap = 0\n\t}\n\n\tconst pageCount = React.Children.count(children)\n\n\tconst maxOffsetRef = React.useRef(0)\n\tconst constraints = React.useRef({ top: 0, left: 0, right: 0, bottom: 0 })\n\n\tconst fallbackContainerRef = React.useRef<HTMLDivElement>(null)\n\tconst containerRef = forwardedRef || fallbackContainerRef\n\n\tconst scrollableRef = React.useRef<HTMLDivElement>(null)\n\n\tconst pageEffectValuesRef = React.useRef<({ [key: string]: MotionValue } | undefined)[]>([])\n\tconst pageRectsRef = React.useRef<Rect[]>([])\n\n\t// On the Framer Canvas we need to use `useMotionValue` because it falls\n\t// back to a React state update in static mode, allowing the component to\n\t// update. Since you cannot conditionally render a hook, we use 0 as the\n\t// default value if the React prop is **already** a motion value, and then\n\t// simply do not use the returned motion value.\n\tconst internalX = useMotionValue(isMotionValue(contentOffsetX) ? 0 : (contentOffsetX ?? 0))\n\tconst internalY = useMotionValue(isMotionValue(contentOffsetY) ? 0 : (contentOffsetY ?? 0))\n\n\tconst contentOffsetRef = React.useRef<{ x: MotionValue<number>; y: MotionValue<number> }>({\n\t\tx: isMotionValue(contentOffsetX) ? contentOffsetX : internalX,\n\t\ty: isMotionValue(contentOffsetY) ? contentOffsetY : internalY,\n\t})\n\tconst currentContentPageRef = React.useRef<number>(currentPage)\n\tconst propsBoundedCurrentPageRef = React.useRef(currentPage) // Bounded version of props.currentPage\n\tconst latestPropsRef = React.useRef(props)\n\tlatestPropsRef.current = props\n\n\tconst lastDirectionRef = React.useRef(props.direction)\n\n\tconst snapToPage = useSnapToPage(currentContentPageRef, contentOffsetRef, isHorizontal)\n\n\tconst [_, setForceUpdateCount] = React.useState(0)\n\n\tconst containerSizeRef = React.useRef({ width: 200, height: 200 })\n\n\tif (hasFixedSize && isFiniteNumber(containerProps.width) && isFiniteNumber(containerProps.height)) {\n\t\tcontainerSizeRef.current.width = containerProps.width\n\t\tcontainerSizeRef.current.height = containerProps.height\n\t}\n\n\tconst updateOnResize = React.useCallback(() => {\n\t\tif (!hasFixedSize) startTransition(() => setForceUpdateCount(v => v + 1))\n\t}, [hasFixedSize])\n\n\t// Setup a listener on the window's size. If it changes, and we are in\n\t// preview, we may need to render to trigger motion's onLayoutMeasure to\n\t// update the constraints.\n\tReact.useEffect(() => {\n\t\tif (RenderTarget.current() !== RenderTarget.preview) return\n\n\t\tglobalThis.addEventListener(\"resize\", updateOnResize)\n\n\t\treturn () => {\n\t\t\tglobalThis.removeEventListener(\"resize\", updateOnResize)\n\t\t}\n\t}, [updateOnResize])\n\n\tconst applyEffects = () => {\n\t\tpageEffectValuesRef.current.forEach((effectDictionary, index) => {\n\t\t\tconst values = effectValues(index, latestPropsRef, pageRectsRef, contentOffsetRef, maxOffsetRef)\n\t\t\tif (!effectDictionary || !values) return\n\t\t\tfor (const [key, value] of Object.entries(values)) {\n\t\t\t\tconst effectValue = effectDictionary[key]\n\t\t\t\tif (isMotionValue(effectValue)) {\n\t\t\t\t\t// Because these are the actual Animatable values passed to the Frame\n\t\t\t\t\t// Updating their value will modify the Frame\n\t\t\t\t\teffectValue.set(value)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n\n\tconst updateMaxOffsetFromPageContents = (containerSize: Size) => {\n\t\tconst newPageContentRects = getPageContentRects(containerRef, containerSize, direction, gap)\n\t\tif (newPageContentRects) pageRectsRef.current = newPageContentRects\n\t\tconst newMaxOffset = getMaxOffset(containerSizeRef.current, pageRectsRef.current, direction, latestPropsRef.current)\n\n\t\tif (newMaxOffset !== maxOffsetRef.current) {\n\t\t\tmaxOffsetRef.current = newMaxOffset\n\n\t\t\tconstraints.current.top = -newMaxOffset\n\t\t\tconstraints.current.left = -newMaxOffset\n\n\t\t\t/**\n\t\t\t * @FIXME Without this forced render, if you resize Page on the\n\t\t\t * canvas when it's current page is not 0, you will see flashes of\n\t\t\t * the previous page. This happens when the MotionValue for the x or\n\t\t\t * y offset is out of sync with the size of the Page and the Page\n\t\t\t * contents, which manifests as the current page not being\n\t\t\t * transformed far enough from the start point.\n\t\t\t *\n\t\t\t * Unfortunately, it's not 100% clear why this force render is\n\t\t\t * required.\n\t\t\t *\n\t\t\t * Since the offset is a Motion Value, its updates are not tied to\n\t\t\t * React renders, so it stays up to date based on a 60fps render\n\t\t\t * cycle run by framer-motion. However, this setState is called\n\t\t\t * inside a useLayoutEffect hook. If an update is scheduled during a\n\t\t\t * useLayoutEffect hook, painting is deferred until no more updates\n\t\t\t * are scheduled. In the case of this function, the first\n\t\t\t * useLayoutEffect after a resize will trigger this React render,\n\t\t\t * painting will be deferred, and the same useLayoutEffect will run\n\t\t\t * a second time, finally calling this function a second time. On\n\t\t\t * the second invocation of this function, since we cache the\n\t\t\t * previous maxOffset to a ref, this state update will not get\n\t\t\t * called. Since no updates are scheduled in the second render,\n\t\t\t * React will finally paint the update.\n\t\t\t *\n\t\t\t * Since this bug only happens in Safari in some circumstances when\n\t\t\t * resizing on the canvas at 60fps, it's possible that there is a\n\t\t\t * case where when we do not defer painting in the first\n\t\t\t * useLayoutEffect, the React render and the MotionValue update are\n\t\t\t * not in sync, causing a brief flash.\n\t\t\t *\n\t\t\t * However, if we can figure out a way to ensure those updates\n\t\t\t * happen in sync, we should remove this React render as it is\n\t\t\t * unnecessary and will only hinder performance when used elsewhere,\n\t\t\t * such as generated components where you can resize a Page while\n\t\t\t * performing a page transition.\n\t\t\t */\n\n\t\t\t// This may need startTransition to avoid synchronous, blocking re-renders.\n\t\t\t// However, this component is deprecated. Let's not modify the behavior.\n\t\t\t// eslint-disable-next-line framer-studio/no-setstate-without-transition -- deprecated component + this is for canvas only\n\t\t\tif (RenderTarget.current() === RenderTarget.canvas) setForceUpdateCount(v => v + 1)\n\t\t}\n\t}\n\n\t// Measure the container size, and return the size if it has changed.\n\tconst measureContainerSize = (): Size | null => {\n\t\tconst element = containerRef.current\n\t\tif (!element) return null\n\n\t\tconst { offsetWidth, offsetHeight } = element\n\n\t\tconst currentSize = containerSizeRef.current\n\t\tif (offsetWidth !== currentSize.width || offsetHeight !== currentSize.height) {\n\t\t\tcontainerSizeRef.current = {\n\t\t\t\twidth: offsetWidth,\n\t\t\t\theight: offsetHeight,\n\t\t\t}\n\t\t\treturn containerSizeRef.current\n\t\t}\n\n\t\treturn null\n\t}\n\n\tconst updateAndSnapToPage = (newPage: number, mount: boolean = false) => {\n\t\tconst newBoundedCurrentPage = getBoundedCurrentPage(newPage, pageCount)\n\t\tconst boundedCurrentPageDidChange = newBoundedCurrentPage !== propsBoundedCurrentPageRef.current\n\n\t\tif (boundedCurrentPageDidChange) {\n\t\t\tpropsBoundedCurrentPageRef.current = newBoundedCurrentPage\n\t\t\tupdateCurrentPage(newBoundedCurrentPage, currentContentPageRef, !mount ? onChangePage : undefined)\n\t\t}\n\n\t\t// Finally, even if the current page did not change, the offset may\n\t\t// have. Snap the current page to the latest offset.\n\t\tconst offset = offsetForPage(newBoundedCurrentPage, pageCount, pageRectsRef, isHorizontal, maxOffsetRef)\n\t\tconst animated = animateCurrentPageUpdate && RenderTarget.current() !== RenderTarget.canvas && !mount\n\t\tsnapToPage(newBoundedCurrentPage, offset, { animated })\n\t}\n\n\t// Handle setting up MotionValue handlers, performing initial measurements,\n\t// and setting the initial dragConstraints on mount. Finally snap to the\n\t// current page without an animation. Mount does not trigger motion's\n\t// onLayoutMeasure handler.\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: Has always been like this\n\tuseIsomorphicLayoutEffect(() => {\n\t\tif (hasMountedRef.current) return\n\n\t\t/**\n\t\t * Defer the measurement of drag constraints until the next animation frame.\n\t\t * When the preview is closed and reopened, it's switched from display: none\n\t\t * to display: block. When an element is the child of display: none its measurements\n\t\t * return `0`. When this layout effect fires, the preview iframe *is* set to\n\t\t * display: block but in a twist of browser render scheduling this hasn't yet\n\t\t * affected the iframe contents. So by deferring to the following animation frame\n\t\t * we allow the iframe contents to take on dimension again.\n\t\t * Fixes: https://github.com/framer/company/issues/23200\n\t\t */\n\t\trequestAnimationFrame(() => {\n\t\t\t// If the Page has been mounted with a non-default current page, update\n\t\t\t// the ref on mount so that the useEffect that watches changes to the\n\t\t\t// currentPage prop doesn't fire incorrectly on subsequent renders.\n\t\t\tcurrentContentPageRef.current = currentPage\n\n\t\t\tconst contentOffset = contentOffsetRef.current\n\n\t\t\tcontentOffset.x.on(\"change\", applyEffects)\n\t\t\tcontentOffset.y.on(\"change\", applyEffects)\n\n\t\t\tapplyEffects()\n\n\t\t\thasMountedRef.current = true\n\n\t\t\tconst containerSize = measureContainerSize() ?? containerSizeRef.current\n\n\t\t\tupdateMaxOffsetFromPageContents(containerSize)\n\n\t\t\tupdateAndSnapToPage(currentContentPageRef.current, true)\n\t\t})\n\t}, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n\t// Handle user update to the currentPage from React props. This runs after\n\t// onLayoutMeasure, so the current offsets will already be set based on any\n\t// updates to the children or container sizes. Must only fire when\n\t// currentPage changes.\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: Has always been like this\n\tReact.useEffect(() => {\n\t\tif (currentPage !== currentContentPageRef.current) updateAndSnapToPage(currentPage)\n\t}, [currentPage]) // eslint-disable-line react-hooks/exhaustive-deps\n\n\t// Measure the container size, and measure the children sizes when motion\n\t// flags that it's performing a measure with any transforms removed.\n\tconst handleMeasureLifecycle = () => {\n\t\t// Measure the container, update the ref, and return the Size if it has changed.\n\t\tconst newContainerSize = measureContainerSize()\n\n\t\t// Get the rects of each PageContainer, and calculate and update drag\n\t\t// constraints based on the current container size.\n\t\tupdateMaxOffsetFromPageContents(newContainerSize ?? containerSizeRef.current)\n\n\t\t// Calculate if the Page's offset transform needs to be updated\n\t\t// to either keep the current page centered, or snap to a new page.\n\t\tupdateAndSnapToPage(currentContentPageRef.current)\n\n\t\t// Finally, if the measured size or direction has changed, ensure that the offset for the\n\t\t// opposite direction is reset to 0. E.g. if the direction is\n\t\t// horizontal, reset the vertical scroll to 0.\n\t\tif (newContainerSize || direction !== lastDirectionRef.current) {\n\t\t\tif (direction === \"horizontal\") {\n\t\t\t\tcontentOffsetRef.current.y.set(0)\n\t\t\t} else {\n\t\t\t\tcontentOffsetRef.current.x.set(0)\n\t\t\t}\n\n\t\t\tlastDirectionRef.current = direction\n\t\t}\n\t}\n\n\t// Motion's onLayoutMeasure is not called on the canvas, so if we are on\n\t// the canvas, we trigger the same callback we pass to onLayoutMeasure here\n\t// in a useLayoutEffect. This is fine because we don't have to worry about\n\t// un-setting parent transforms for measurements on the canvas.\n\tuseIsomorphicLayoutEffect(() => {\n\t\tif (RenderTarget.current() !== RenderTarget.canvas) return\n\t\thandleMeasureLifecycle()\n\t})\n\n\tconst onDragStartHandler = (event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo) => {\n\t\tif (onScrollStart) onScrollStart(info)\n\t\tif (onDragStart) onDragStart(event, info)\n\t\tprev.x = initial.x = info.point.x\n\t\tprev.y = initial.y = info.point.y\n\t}\n\n\tconst onDragHandler = (event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo) => {\n\t\tif (onScroll) onScroll(info)\n\t\tif (onDrag) onDrag(event, info)\n\t\tprev.x = info.point.x\n\t\tprev.y = info.point.y\n\t}\n\n\tconst onDragTransitionEnd = () => {\n\t\tif (props.onDragTransitionEnd) props.onDragTransitionEnd()\n\t\tif (onScrollEnd) {\n\t\t\tconst { x, y } = contentOffsetRef.current\n\t\t\tconst point = { x: x.get(), y: y.get() }\n\t\t\tonScrollEnd({\n\t\t\t\tpoint,\n\t\t\t\tvelocity: { x: x.getVelocity(), y: y.getVelocity() },\n\t\t\t\toffset: { x: point.x - initial.x, y: point.y - initial.y },\n\t\t\t\tdelta: { x: point.x - prev.x, y: point.y - prev.y },\n\t\t\t})\n\t\t}\n\t}\n\n\tconst onDragEndHandler = async (event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo) => {\n\t\tconst contentOffset = isHorizontal ? contentOffsetRef.current.x : contentOffsetRef.current.y\n\t\tcontentOffset.stop()\n\n\t\tconst startPosition = contentOffset.get()\n\t\tconst axis = isHorizontal ? \"x\" : \"y\"\n\t\tconst velocity = info.velocity[axis]\n\t\tlet index = nearestPageIndex(pageRectsRef.current, startPosition, startPosition, isHorizontal, momentum)\n\n\t\tif (velocity) {\n\t\t\t/**\n\t\t\t * TODO: This is a bit hacky. We're hijacking the inertia animation for the modifyTarget functionality. Maybe this is information we can\n\t\t\t * pass through the `onDragEnd` event handler if `dragMomentum` is `true`.\n\t\t\t */\n\t\t\tanimateValue({\n\t\t\t\ttype: \"inertia\",\n\t\t\t\tkeyframes: [startPosition],\n\t\t\t\tvelocity,\n\t\t\t\tmodifyTarget: (endPosition: number) => {\n\t\t\t\t\tindex = nearestPageIndex(pageRectsRef.current, startPosition, endPosition, isHorizontal, momentum)\n\t\t\t\t\treturn endPosition\n\t\t\t\t},\n\t\t\t}).stop()\n\t\t}\n\n\t\tupdateCurrentPage(index, currentContentPageRef, onChangePage)\n\n\t\tconst offset = offsetForPage(index, pageCount, pageRectsRef, isHorizontal, maxOffsetRef)\n\t\tif (onDragEnd) onDragEnd(event, info)\n\t\tconst handler = contentOffsetRef.current[axis]\n\n\t\thandler.set(startPosition)\n\t\t// @TODO: Ignored for now, but should re-check later.\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\tanimate(handler, offset, {\n\t\t\ttype: \"spring\",\n\t\t\tvelocity,\n\t\t\tstiffness: 500,\n\t\t\tdamping: 50,\n\t\t\tonComplete: onDragTransitionEnd,\n\t\t})\n\t}\n\n\tpageEffectValuesRef.current = []\n\n\tconst childComponents = React.Children.map(children, (child: React.ReactElement<Partial<FrameProps>>, index) => {\n\t\tif (!isReactChild(child) || !isReactElement(child)) {\n\t\t\treturn child\n\t\t}\n\n\t\t// biome-ignore lint/suspicious/noExplicitAny: needed to match `cloneElement`\n\t\tconst update: { [key: string]: any } = {\n\t\t\tright: undefined,\n\t\t\tbottom: undefined,\n\t\t\ttop: undefined,\n\t\t\tleft: undefined,\n\t\t\t_constraints: {\n\t\t\t\tenabled: false,\n\t\t\t},\n\t\t\tstyle: undefined,\n\t\t}\n\n\t\tif (containerProps.__fromCanvasComponent) {\n\t\t\tupdate.style = child.props.style ?? {}\n\t\t\tif (contentWidth === \"stretch\") update.style.width = \"100%\"\n\t\t\tif (contentHeight === \"stretch\") update.style.height = \"100%\"\n\t\t} else {\n\t\t\tif (contentWidth === \"stretch\") update.width = \"100%\"\n\t\t\tif (contentHeight === \"stretch\") update.height = \"100%\"\n\t\t}\n\n\t\tlet effectDictionary: { [key: string]: MotionValue } | undefined\n\n\t\tconst values = effectValues(index, latestPropsRef, pageRectsRef, contentOffsetRef, maxOffsetRef)\n\n\t\tif (values) {\n\t\t\t// We use motion values so we can set them in the onMove function\n\t\t\teffectDictionary = {}\n\t\t\tfor (const key in values) {\n\t\t\t\teffectDictionary[key] = motionValue(values[key])\n\t\t\t}\n\t\t}\n\n\t\tpageEffectValuesRef.current.push(effectDictionary)\n\n\t\treturn (\n\t\t\t<PageContainer\n\t\t\t\t// biome-ignore lint/suspicious/noArrayIndexKey: has always been like this\n\t\t\t\tkey={index}\n\t\t\t\teffect={effectDictionary}\n\t\t\t\tdragEnabled={dragEnabled}\n\t\t\t\tdirection={direction}\n\t\t\t\tcontentHeight={contentHeight}\n\t\t\t\tcontentWidth={contentWidth}\n\t\t\t\talignment={alignment}\n\t\t\t\tgap={gap}\n\t\t\t\tisLastPage={index === pageCount - 1}\n\t\t\t\tcontentOffsetRef={contentOffsetRef}\n\t\t\t\tconstraintsRef={constraints}\n\t\t\t\tdirectionLock={directionLock}\n\t\t\t\tonDragStart={onDragStartHandler}\n\t\t\t\tonDrag={onDragHandler}\n\t\t\t\tonDragEnd={onDragEndHandler}\n\t\t\t\tlayoutId={layoutId ? `${layoutId}-${index}` : undefined}\n\t\t\t>\n\t\t\t\t{React.cloneElement(child, update)}\n\t\t\t</PageContainer>\n\t\t)\n\t})\n\n\tuseWheelScroll(scrollableRef, {\n\t\tenabled: wheelEnabled,\n\t\tinitial,\n\t\tprev,\n\t\tdirection,\n\t\tconstraints,\n\t\toffsetX: contentOffsetRef.current.x,\n\t\toffsetY: contentOffsetRef.current.y,\n\t\tonScrollStart,\n\t\tonScroll,\n\t\tonScrollEnd,\n\t})\n\n\treturn (\n\t\t<FrameWithMotion\n\t\t\tdata-framer-component-type=\"PageWrapper\"\n\t\t\tpreserve3d={false}\n\t\t\tperspective={hasEffect(props) ? 1200 : undefined}\n\t\t\t{...containerProps}\n\t\t\t// Overflow is managed via a property control.\n\t\t\tstyle={{ pointerEvents: undefined, ...containerProps.style, overflow: overflow }}\n\t\t\tlayoutId={layoutId}\n\t\t\tref={containerRef}\n\t\t\tonLayoutMeasure={handleMeasureLifecycle}\n\t\t>\n\t\t\t<FrameWithMotion\n\t\t\t\tdata-framer-component-type=\"Page\"\n\t\t\t\tref={scrollableRef}\n\t\t\t\tbackground={null}\n\t\t\t\tx={contentOffsetRef.current.x}\n\t\t\t\ty={contentOffsetRef.current.y}\n\t\t\t\twidth=\"100%\"\n\t\t\t\theight=\"100%\"\n\t\t\t\tpreserve3d\n\t\t\t\tlayout\n\t\t\t\tlayoutId={layoutId !== undefined ? layoutId + \"-page\" : undefined}\n\t\t\t\tstyle={{\n\t\t\t\t\tpadding: makePaddingString(paddingFromProps(props)),\n\t\t\t\t\tdisplay: \"flex\",\n\t\t\t\t\tflexDirection: isHorizontal ? \"row\" : \"column\",\n\t\t\t\t\tpointerEvents: props.style?.pointerEvents,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<EmptyState\n\t\t\t\t\ttitle=\"Page\"\n\t\t\t\t\tdescription=\"Click and drag the connector to any frame on the canvas \u2192\"\n\t\t\t\t\tsize={containerSizeRef.current}\n\t\t\t\t\tinsideUserCodeComponent={!__fromCodeComponentNode}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</EmptyState>\n\t\t\t\t{childComponents}\n\t\t\t</FrameWithMotion>\n\t\t</FrameWithMotion>\n\t)\n})\n\nexport const Page = /* @__PURE__ */ withLibraryCSS(PageInner)\n\n// Effects\n\nfunction cubeEffect(info: PageEffectInfo) {\n\tconst { normalizedOffset, direction } = info\n\tconst isHorizontal = direction === \"horizontal\"\n\n\treturn {\n\t\toriginX: normalizedOffset < 0 ? 1 : 0,\n\t\toriginY: normalizedOffset < 0 ? 1 : 0,\n\t\trotateY: isHorizontal ? Math.min(Math.max(-90, normalizedOffset * 90), 90) : 0,\n\t\trotateX: isHorizontal ? 0 : Math.min(Math.max(-90, normalizedOffset * -90), 90),\n\t\tbackfaceVisibility: \"hidden\",\n\t\tWebkitBackfaceVisibility: \"hidden\",\n\t}\n}\n\nfunction coverflowEffect(info: PageEffectInfo) {\n\tconst { normalizedOffset, direction } = info\n\tconst isHorizontal = direction === \"horizontal\"\n\n\treturn {\n\t\trotateY: isHorizontal ? Math.min(45, Math.max(-45, normalizedOffset * -45)) : 0,\n\t\trotateX: isHorizontal ? 0 : Math.min(45, Math.max(-45, normalizedOffset * 45)),\n\t\toriginX: isHorizontal ? (normalizedOffset < 0 ? 0 : 1) : 0.5,\n\t\toriginY: isHorizontal ? 0.5 : normalizedOffset < 0 ? 0 : 1,\n\t\tx: isHorizontal ? `${normalizedOffset * -25}%` : 0,\n\t\ty: isHorizontal ? 0 : `${normalizedOffset * -25}%`,\n\t\tz: -Math.abs(normalizedOffset),\n\t\tscale: 1 - Math.abs(normalizedOffset / 10),\n\t}\n}\n\nfunction calcPileAxisOffset(offset: number, length: number) {\n\treturn offset * length - offset * 8\n}\n\nfunction pileEffect(info: PageEffectInfo) {\n\tconst { normalizedOffset, direction, size } = info\n\tconst isHorizontal = direction === \"horizontal\"\n\tconst absoluteOffset = Math.abs(normalizedOffset)\n\n\treturn {\n\t\tx: normalizedOffset < 0 && isHorizontal ? calcPileAxisOffset(absoluteOffset, size.width) : 0,\n\t\ty: normalizedOffset < 0 && !isHorizontal ? calcPileAxisOffset(absoluteOffset, size.height) : 0,\n\t\tscale: normalizedOffset < 0 ? 1 - absoluteOffset / 50 : 1,\n\t}\n}\n\nfunction wheelEffect(info: PageEffectInfo) {\n\tconst { normalizedOffset, direction, size } = info\n\tconst isHorizontal = direction === \"horizontal\"\n\n\tconst originZ = ((isHorizontal ? size.width : size.height) * 18) / (2 * Math.PI)\n\tconst rotateX = isHorizontal ? 0 : normalizedOffset * -20\n\tconst rotateY = isHorizontal ? normalizedOffset * 20 : 0\n\tconst y = isHorizontal ? 0 : normalizedOffset * -size.height\n\tconst x = isHorizontal ? normalizedOffset * -size.width : 0\n\n\treturn {\n\t\topacity: 1 - Math.abs(normalizedOffset) / 4,\n\t\ttransform: `translate(${x}px, ${y}px) translateZ(-${originZ}px) rotateX(${rotateX}deg) rotateY(${rotateY}deg) translateZ(${originZ}px)`,\n\t}\n}\n\nfunction getDefaultEffect(type: PageEffect | undefined): CustomPageEffect | null {\n\tswitch (type) {\n\t\tcase \"cube\":\n\t\t\treturn cubeEffect\n\t\tcase \"coverflow\":\n\t\t\treturn coverflowEffect\n\t\tcase \"pile\":\n\t\t\treturn pileEffect\n\t\tcase \"wheel\":\n\t\t\treturn wheelEffect\n\t\tdefault:\n\t\t\treturn null\n\t}\n}\n\nfunction nearestPageIndex(\n\tpageRects: Rect[],\n\tstartPosition: number,\n\tendPosition: number,\n\tisHorizontalDirection: boolean,\n\tallowSkippingPages: boolean,\n): number {\n\tconst distanceToStart = function (rect: Rect): number {\n\t\tconst rectPosition = isHorizontalDirection ? rect.x : rect.y\n\t\treturn Math.abs(rectPosition + startPosition)\n\t}\n\n\tconst distanceToEnd = function (rect: Rect): number {\n\t\tconst rectPosition = isHorizontalDirection ? rect.x : rect.y\n\t\treturn Math.abs(rectPosition + endPosition)\n\t}\n\n\tif (allowSkippingPages) {\n\t\tconst closestPages = [...pageRects].sort((a, b) => distanceToEnd(a) - distanceToEnd(b))\n\t\tif (!closestPages[0]) return -1\n\t\treturn pageRects.indexOf(closestPages[0])\n\t} else {\n\t\tconst closestToStart = [...pageRects].sort((a, b) => distanceToStart(a) - distanceToStart(b))\n\t\tif (closestToStart.length === 1 && closestToStart[0]) return pageRects.indexOf(closestToStart[0])\n\n\t\tconst pageA = closestToStart[0]\n\t\tconst pageB = closestToStart[1]\n\t\tif (!pageA || !pageB) return -1\n\n\t\tconst closestPages = [pageA, pageB].sort((a, b) => distanceToEnd(a) - distanceToEnd(b))\n\t\tif (!closestPages[0]) return -1\n\t\treturn pageRects.indexOf(closestPages[0])\n\t}\n}\n\nfunction getPageContentRects(\n\tcontainerRef: React.RefObject<HTMLDivElement>,\n\tcontainerSize: Size,\n\tdirection: PageDirection,\n\tgap: number,\n): Rect[] | undefined {\n\tconst containerElement = containerRef.current\n\tif (!containerElement) return\n\n\tconst contentWrappers: HTMLElement[] = []\n\n\tcontainerElement.firstChild?.childNodes.forEach(node => {\n\t\tconst childNode = node.firstChild\n\t\tif (!(childNode instanceof HTMLElement)) return\n\t\tconst componentType = childNode.getAttribute(\"data-framer-component-type\")\n\t\tif (componentType === pageContentWrapperType) {\n\t\t\tcontentWrappers.push(childNode)\n\t\t}\n\t})\n\n\tconst sizes: (Size | null)[] = []\n\tcontentWrappers.forEach(contentWrapper => {\n\t\tif (contentWrapper instanceof HTMLElement && contentWrapper.firstChild instanceof HTMLElement) {\n\t\t\tlet width = contentWrapper.firstChild.offsetWidth\n\t\t\tlet height = contentWrapper.firstChild.offsetHeight\n\t\t\tif (isTest()) {\n\t\t\t\twidth = 100\n\t\t\t\theight = 100\n\t\t\t}\n\t\t\tsizes.push({ width, height })\n\t\t} else {\n\t\t\tsizes.push(null)\n\t\t}\n\t})\n\n\tlet maxX = 0\n\tlet maxY = 0\n\n\tconst isHorizontal = direction === \"horizontal\"\n\n\treturn sizes.map(queriedSize => {\n\t\tconst size = queriedSize || containerSize\n\t\tconst x = maxX\n\t\tconst y = maxY\n\t\tif (isHorizontal) {\n\t\t\tmaxX += size.width + gap\n\t\t} else {\n\t\t\tmaxY += size.height + gap\n\t\t}\n\t\treturn { ...size, x, y }\n\t})\n}\n\nfunction getMaxOffset(\n\tcontainerSize: Size,\n\tpageContentRects: Rect[],\n\tdirection: PageDirection,\n\tpaddingProps: PaddingProps,\n): number {\n\tconst lastPageRect = pageContentRects[pageContentRects.length - 1]\n\tif (!lastPageRect) return 0\n\n\tconst paddingSides = paddingFromProps(paddingProps)\n\tconst isHorizontal = direction === \"horizontal\"\n\tconst paddingStart = isHorizontal ? paddingSides.left : paddingSides.top\n\tconst paddingEnd = isHorizontal ? paddingSides.right : paddingSides.bottom\n\tconst pageWidth = isHorizontal ? lastPageRect.width : lastPageRect.height\n\tconst containerWidth = isHorizontal ? containerSize.width : containerSize.height\n\tconst freeSpace = containerWidth - paddingStart - paddingEnd - pageWidth\n\tconst target = isHorizontal ? lastPageRect.x : lastPageRect.y\n\t// Scroll offset can't be negative, if it is accidentally negative, it will incorrectly offset the page contents from the starting point.\n\tif (freeSpace <= 0) return Math.max(target, 0)\n\treturn Math.max(target - freeSpace, 0)\n}\n\nfunction offsetForPage(\n\tindex: number,\n\tpageCount: number,\n\tpageRectsRef: React.MutableRefObject<Rect[]>,\n\tisHorizontal: boolean,\n\tmaxOffsetRef: React.MutableRefObject<number>,\n) {\n\tconst pageIndex = Math.max(0, Math.min(pageCount - 1, index))\n\tconst currentPageRect = pageRectsRef.current[pageIndex]\n\n\tif (!currentPageRect) {\n\t\treturn 0\n\t}\n\tif (isHorizontal) {\n\t\treturn -Math.min(currentPageRect.x, maxOffsetRef.current)\n\t} else {\n\t\treturn -Math.min(currentPageRect.y, maxOffsetRef.current)\n\t}\n}\n\nfunction useSnapToPage(\n\tcurrentContentPageRef: React.MutableRefObject<number>,\n\tcontentOffsetRef: React.MutableRefObject<{ x: MotionValue<number>; y: MotionValue<number> }>,\n\tisHorizontal: boolean,\n) {\n\treturn (pageIndex: number, offset: number, options?: { animated: boolean }) => {\n\t\tcurrentContentPageRef.current = pageIndex\n\t\tconst contentOffset = isHorizontal ? contentOffsetRef.current.x : contentOffsetRef.current.y\n\n\t\tif (!options || !options.animated) {\n\t\t\tcontentOffset.set(offset)\n\t\t\treturn\n\t\t} // else\n\n\t\tconst axis = isHorizontal ? \"x\" : \"y\"\n\n\t\tconst value = contentOffsetRef.current[axis]\n\t\tvalue.set(contentOffset.get())\n\t\t// @TODO: Ignored for now, but should re-check later.\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\tanimate(value, offset, {\n\t\t\ttype: \"spring\",\n\t\t\tvelocity: contentOffset.getVelocity(),\n\t\t\tstiffness: 500,\n\t\t\tdamping: 50,\n\t\t})\n\t}\n}\n\n// The current page property is capped to the number of children when positive, and cycles from last when negative\nfunction getBoundedCurrentPage(pageIndex: number, pageCount: number) {\n\treturn pageIndex >= 0 ? Math.min(pageIndex, pageCount - 1) : ((pageIndex % pageCount) + pageCount) % pageCount\n}\n\nfunction effectValues(\n\tindex: number,\n\tlatestPropsRef: React.MutableRefObject<Partial<PageProps>>,\n\tpageRectsRef: React.MutableRefObject<Rect[]>,\n\tcontentOffsetRef: React.MutableRefObject<{ x: MotionValue<number>; y: MotionValue<number> }>,\n\tmaxOffsetRef: React.MutableRefObject<number>,\n): PageEffectValues | null {\n\tconst {\n\t\tdirection: latestDirection = \"horizontal\",\n\t\tdefaultEffect: latestDefaultEffect,\n\t\teffect: latestEffect,\n\t\tgap: latestGap = 10,\n\t} = latestPropsRef.current\n\tconst latestIsHorizontal = latestDirection === \"horizontal\"\n\n\tconst pageRect: {\n\t\tx: number\n\t\ty: number\n\t\twidth: number\n\t\theight: number\n\t} = pageRectsRef.current[index] || {\n\t\tx: latestIsHorizontal ? index * 200 + latestGap : 0,\n\t\ty: latestIsHorizontal ? 0 : index * 200 + latestGap,\n\t\twidth: 200,\n\t\theight: 200,\n\t}\n\n\tconst effectFunction = latestEffect || getDefaultEffect(latestDefaultEffect)\n\tif (!effectFunction) return null\n\n\tlet offset: number\n\tlet normalizedOffset: number\n\tconst contentOffset = contentOffsetRef.current\n\tconst maxScrollOffset = maxOffsetRef.current\n\tif (latestIsHorizontal) {\n\t\toffset = Math.min(pageRect.x, maxScrollOffset) + (contentOffset ? contentOffset.x.get() : 0)\n\t\tnormalizedOffset = offset / (pageRect.width + latestGap)\n\t} else {\n\t\toffset = Math.min(pageRect.y, maxScrollOffset) + (contentOffset ? contentOffset.y.get() : 0)\n\t\tnormalizedOffset = offset / (pageRect.height + latestGap)\n\t}\n\n\tconst size = { width: pageRect.width, height: pageRect.height }\n\n\treturn effectFunction({\n\t\toffset,\n\t\tnormalizedOffset,\n\t\tsize,\n\t\tindex,\n\t\tdirection: latestDirection,\n\t\tgap: latestGap,\n\t\tpageCount: pageRectsRef.current.length,\n\t})\n}\n\nfunction hasEffect(props: Partial<PageProperties>) {\n\treturn !!props.effect || !!getDefaultEffect(props.defaultEffect)\n}\n\nfunction updateCurrentPage(\n\tnewPageIndex: number,\n\tcurrentContentPageRef: React.MutableRefObject<number>,\n\tonChangePage: ((currentIndex: number, previousIndex: number) => void) | undefined,\n) {\n\tif (currentContentPageRef.current === newPageIndex) return\n\tif (onChangePage) onChangePage(newPageIndex, currentContentPageRef.current)\n\tcurrentContentPageRef.current = newPageIndex\n}\n", "import type { MotionValue, PanInfo, Point } from \"framer-motion\"\nimport { useDomEvent } from \"framer-motion\"\nimport type { RefObject } from \"react\"\nimport { useCallback, useRef } from \"react\"\nimport { debounce } from \"../../render/utils/debounce.ts\"\nimport { clamp } from \"../../utils/math.ts\"\n\ninterface WheelScrollOptions {\n\tenabled: boolean\n\tinitial: Point\n\tprev: Point\n\tdirection: \"horizontal\" | \"vertical\" | \"both\"\n\tconstraints: RefObject<{ top: number; right: number; bottom: number; left: number }>\n\toffsetX: MotionValue<number>\n\toffsetY: MotionValue<number>\n\tonScrollStart: ((info: PanInfo) => void) | undefined\n\tonScroll: ((info: PanInfo) => void) | undefined\n\tonScrollEnd: ((info: PanInfo) => void) | undefined\n}\n\nexport function useWheelScroll(\n\tref: RefObject<Element>,\n\t{\n\t\tenabled,\n\t\tinitial,\n\t\tprev,\n\t\tdirection,\n\t\tconstraints,\n\t\toffsetX,\n\t\toffsetY,\n\t\tonScrollStart,\n\t\tonScroll,\n\t\tonScrollEnd,\n\t}: WheelScrollOptions,\n) {\n\tconst isWheelScrollActive = useRef(false)\n\n\tconst getPointData = useCallback(() => {\n\t\tconst point = getPoint(offsetX, offsetY)\n\n\t\tconst data = {\n\t\t\tpoint,\n\t\t\tvelocity: { x: offsetX.getVelocity(), y: offsetY.getVelocity() },\n\t\t\toffset: { x: point.x - initial.x, y: point.y - initial.y },\n\t\t\tdelta: { x: point.x - prev.x, y: point.y - prev.y },\n\t\t}\n\n\t\tprev.x = point.x\n\t\tprev.y = point.y\n\n\t\treturn data\n\t}, [])\n\n\tlet handler: EventListener | undefined\n\tif (enabled) {\n\t\tfunction clampX(v: number) {\n\t\t\treturn constraints.current === null ? v : clamp(v, constraints.current.left, constraints.current.right)\n\t\t}\n\n\t\tfunction clampY(v: number) {\n\t\t\treturn constraints.current === null ? v : clamp(v, constraints.current.top, constraints.current.bottom)\n\t\t}\n\n\t\tfunction updateX(delta: number) {\n\t\t\toffsetX.stop()\n\t\t\toffsetX.set(clampX(offsetX.get() - delta))\n\t\t}\n\n\t\tfunction updateY(delta: number) {\n\t\t\toffsetY.stop()\n\t\t\toffsetY.set(clampY(offsetY.get() - delta))\n\t\t}\n\n\t\tconst debouncedOnScrollEnd = debounce(() => {\n\t\t\tonScrollEnd && onScrollEnd(getPointData())\n\t\t\tisWheelScrollActive.current = false\n\t\t}, 200)\n\n\t\thandler = (e: WheelEvent) => {\n\t\t\te.preventDefault()\n\n\t\t\tif (!isWheelScrollActive.current) {\n\t\t\t\tconst x = offsetX.get()\n\t\t\t\tconst y = offsetY.get()\n\t\t\t\tinitial.x = x\n\t\t\t\tinitial.y = y\n\t\t\t\tprev.x = x\n\t\t\t\tprev.y = y\n\t\t\t\tonScrollStart && onScrollStart(getPointData())\n\t\t\t\tisWheelScrollActive.current = true\n\t\t\t}\n\n\t\t\tswitch (direction) {\n\t\t\t\tcase \"horizontal\":\n\t\t\t\t\tupdateX(e.deltaX)\n\t\t\t\t\tbreak\n\t\t\t\tcase \"vertical\":\n\t\t\t\t\tupdateY(e.deltaY)\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\tupdateX(e.deltaX)\n\t\t\t\t\tupdateY(e.deltaY)\n\t\t\t}\n\n\t\t\tonScroll && onScroll(getPointData())\n\t\t\tdebouncedOnScrollEnd()\n\t\t}\n\t}\n\n\t// Appending event directly to DOM as React doesn't have an API for non-passive wheel events.\n\tuseDomEvent(ref, \"wheel\", handler, { passive: false })\n}\n\nfunction getPoint(x: MotionValue<number>, y: MotionValue<number>): Point {\n\treturn { x: x.get(), y: y.get() }\n}\n", "import { safeWindow } from \"../../utils/safeWindow.ts\"\n\ninterface DebouncedFunction<T extends any[]> {\n\t(...args: T): void\n\tcancel: () => void\n}\n\n/** @internal */\nexport function debounce<T extends any[]>(fn: (...args: T) => void, time: number): DebouncedFunction<T> {\n\tlet timeout: number | undefined\n\tconst debounced = (...args: T) => {\n\t\tsafeWindow.clearTimeout(timeout)\n\t\ttimeout = safeWindow.setTimeout(fn, time, ...args)\n\t}\n\n\tconst cancel = () => {\n\t\tsafeWindow.clearTimeout(timeout)\n\t}\n\n\tdebounced.cancel = cancel\n\treturn debounced\n}\n", "import { parseNumberRounded } from \"@framerjs/shared/src/parseNumberRounded.ts\"\nimport { isFiniteNumber } from \"../../render/utils/isFiniteNumber.ts\"\n\nexport interface PaddingProps {\n\tpadding?: number\n\tpaddingPerSide?: boolean\n\tpaddingTop?: number\n\tpaddingRight?: number\n\tpaddingBottom?: number\n\tpaddingLeft?: number\n}\n\n/**\n * @internal\n */\nexport function hasPaddingPerSide(props: Partial<PaddingProps>) {\n\tconst { paddingPerSide, paddingTop, paddingBottom, paddingLeft, paddingRight } = props\n\treturn (\n\t\tpaddingPerSide !== false &&\n\t\t(paddingTop !== undefined || paddingBottom !== undefined || paddingLeft !== undefined || paddingRight !== undefined)\n\t)\n}\n\n/**\n * @internal\n */\nexport function paddingFromProps(props: Partial<PaddingProps>) {\n\tconst { padding = 0, paddingTop, paddingBottom, paddingLeft, paddingRight } = props\n\tif (hasPaddingPerSide(props)) {\n\t\treturn {\n\t\t\ttop: paddingTop !== undefined ? paddingTop : padding,\n\t\t\tbottom: paddingBottom !== undefined ? paddingBottom : padding,\n\t\t\tleft: paddingLeft !== undefined ? paddingLeft : padding,\n\t\t\tright: paddingRight !== undefined ? paddingRight : padding,\n\t\t}\n\t}\n\treturn {\n\t\ttop: padding,\n\t\tbottom: padding,\n\t\tleft: padding,\n\t\tright: padding,\n\t}\n}\n\n/**\n * @internal\n */\nexport function makePaddingString({\n\ttop,\n\tleft,\n\tbottom,\n\tright,\n}: {\n\tleft: number\n\ttop: number\n\tbottom: number\n\tright: number\n}) {\n\t// If all sides are the same, return a single value\n\tif (top === right && right === bottom && bottom === left) {\n\t\treturn `${top}px`\n\t}\n\treturn `${top}px ${right}px ${bottom}px ${left}px`\n}\n\n/**\n * Accepts a string (like \"5px 10px 15px 20px\" or \"5px 0 5px\" or \"none\" or similar). Returns parsed\n * top, right, bottom, left values. Intended as a (slightly more flexible) reverse of `makePaddingString`.\n * @internal\n */\nexport function parsePaddingString(\n\tpadding: string,\n): { top: number; right: number; bottom: number; left: number } | null {\n\tif (padding === \"none\") return null\n\n\tconst parts = padding\n\t\t.trim()\n\t\t.split(/\\s+/)\n\t\t.map(v => parseNumberRounded(v))\n\n\tconst [part1, part2, part3, part4] = parts\n\n\tswitch (parts.length) {\n\t\tcase 1:\n\t\t\tif (!isFiniteNumber(part1)) return null\n\t\t\treturn { top: part1, right: part1, bottom: part1, left: part1 }\n\t\tcase 2:\n\t\t\tif (!isFiniteNumber(part1) || !isFiniteNumber(part2)) return null\n\t\t\treturn { top: part1, right: part2, bottom: part1, left: part2 }\n\t\tcase 3:\n\t\t\tif (!isFiniteNumber(part1) || !isFiniteNumber(part2) || !isFiniteNumber(part3)) return null\n\t\t\treturn { top: part1, right: part2, bottom: part3, left: part2 }\n\t\tcase 4:\n\t\t\tif (!isFiniteNumber(part1) || !isFiniteNumber(part2) || !isFiniteNumber(part3) || !isFiniteNumber(part4)) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\treturn { top: part1, right: part2, bottom: part3, left: part4 }\n\t\tdefault:\n\t\t\treturn null\n\t}\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport { motion } from \"framer-motion\"\nimport React from \"react\"\nimport type { FrameProps } from \"../../render/presentation/Frame/FrameWithMotion.tsx\"\nimport { FrameWithMotion, unwrapFrameProps } from \"../../render/presentation/Frame/FrameWithMotion.tsx\"\nimport type { WillChangeTransformProp } from \"../../render/presentation/Layer.tsx\"\nimport { Layer } from \"../../render/presentation/Layer.tsx\"\nimport { DimensionType } from \"../../render/types/Constraints.ts\"\nimport type { ParentSize } from \"../../render/types/NewConstraints.tsx\"\nimport { ParentSizeState, constraintsEnabled, useProvideParentSize } from \"../../render/types/NewConstraints.tsx\"\nimport { ControlType } from \"../../render/types/PropertyControls.ts\"\nimport { isFiniteNumber } from \"../../render/utils/isFiniteNumber.ts\"\nimport { processOverrideForwarding } from \"../../render/utils/processOverrideForwarding.ts\"\nimport { useLayoutId } from \"../../render/utils/useLayoutId.ts\"\nimport { addPropertyControls } from \"../../utils/addPropertyControls.ts\"\nimport { asRecord } from \"../../utils/asRecord.ts\"\nimport { isReactChild, isReactElement } from \"../../utils/type-guards.ts\"\nimport { hasPaddingPerSide, makePaddingString, paddingFromProps } from \"../utils/paddingFromProps.ts\"\nimport type { StackAlignment, StackDirection, StackDistribution, StackSpecificProps } from \"./types.ts\"\n\n/**\n * The Stack component will automatically distribute its contents based on its\n * properties. The Stack component takes the same props as the {@link Frame} component\n * as well as a few additional interface defined below.\n *\n * @remarks\n * ```jsx\n * function MyComponent() {\n *   return (\n *     <Stack>\n *       <Frame />\n *       <Frame />\n *       <Frame />\n *     </Stack>\n *   )\n * }\n * ```\n * @public\n * @deprecated\n */\nexport interface StackProperties extends StackSpecificProps, FrameProps, WillChangeTransformProp {\n\tas?: keyof HTMLElementTagNameMap\n\tchildren?: React.ReactNode\n\t/** @internal */\n\tparentSize?: ParentSize\n\tclassName?: string\n\t/* If useFlexboxGap is set to true, Stack will try to use the native flexbox `gap` property for the gaps, otherwise it will fallback to using margins. Defaults to true. */\n\tuseFlexboxGap?: boolean\n}\n\ntype FlexDirection = \"column\" | \"row\" | \"column-reverse\" | \"row-reverse\"\n\n/**\n * @public\n * @deprecated The `Stack` component is being deprecated and will no longer be maintained in future releases. We recommend using flexbox instead for layout needs: {@link https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Flexbox}\n */\nexport const Stack: React.ForwardRefExoticComponent<Partial<StackProperties> & React.RefAttributes<HTMLDivElement>> =\n\t/* @__PURE__ */ (() => {\n\t\tconst StackInner = React.forwardRef<HTMLDivElement, Partial<StackProperties>>(\n\t\t\tfunction StackInner(stackProps, forwardedRef) {\n\t\t\t\tconst {\n\t\t\t\t\tas = \"div\",\n\t\t\t\t\tdirection = \"vertical\",\n\t\t\t\t\tdistribution = \"start\",\n\t\t\t\t\talignment = \"center\",\n\t\t\t\t\tgap = 10,\n\t\t\t\t\twrap = false,\n\t\t\t\t\tuseFlexboxGap: externalUseFlexboxGap = true,\n\t\t\t\t\tchildren,\n\t\t\t\t\tstyle: styleProp,\n\t\t\t\t\tclassName,\n\t\t\t\t\twillChangeTransform,\n\t\t\t\t\t__fromCodeComponentNode,\n\t\t\t\t\tparentSize,\n\t\t\t\t\t__contentWrapperStyle,\n\t\t\t\t\t...containerProps\n\t\t\t\t} = stackProps\n\n\t\t\t\t// Only the native gap implementation works correctly with flexbox wrap\n\t\t\t\tconst useFlexboxGap = externalUseFlexboxGap || wrap\n\n\t\t\t\t/**\n\t\t\t\t * As of Safari 15.1, Webkit does not redraw the gaps correctly when the\n\t\t\t\t * value updates, a forced reflow is needed as a workaround.\n\t\t\t\t * For layout transition, we try to trigger the reflow in the\n\t\t\t\t * onBeforeMeasureLayout lifecycle, so that motion could capture the\n\t\t\t\t * forced layout change when it measures the new layout.\n\t\t\t\t * Besides, we still need a layout effect to trigger the reflow, in case\n\t\t\t\t * onBeforeMeasureLayout isn't called (e.g. updating gap on the canvas).\n\t\t\t\t * https://bugs.webkit.org/show_bug.cgi?id=233252\n\t\t\t\t */\n\t\t\t\tconst stackRef = React.useRef<HTMLElement | HTMLDivElement>(null)\n\n\t\t\t\tconst flexDirection = toFlexDirection(direction)\n\t\t\t\tconst isReverse = isReverseDirection(flexDirection)\n\t\t\t\tconst justifyContent = toJustifyOrAlignment(distribution)\n\t\t\t\tconst padding =\n\t\t\t\t\thasPaddingPerSide(containerProps) || containerProps.padding\n\t\t\t\t\t\t? makePaddingString(paddingFromProps(containerProps))\n\t\t\t\t\t\t: undefined\n\n\t\t\t\tconst style: MotionStyle = { ...styleProp }\n\t\t\t\tLayer.applyWillChange({ willChangeTransform }, style, true)\n\n\t\t\t\tif (__fromCodeComponentNode && !constraintsEnabled(unwrapFrameProps(containerProps))) {\n\t\t\t\t\tcontainerProps.width = \"100%\"\n\t\t\t\t\tcontainerProps.height = \"100%\"\n\t\t\t\t\tcontainerProps._constraints = { enabled: true }\n\t\t\t\t}\n\n\t\t\t\tconst layoutId = useLayoutId(stackProps)\n\n\t\t\t\tconst { children: _children, props } = processOverrideForwarding(containerProps, children)\n\n\t\t\t\tconst widthType =\n\t\t\t\t\tcontainerProps.widthType ?? (containerProps.width === \"auto\" ? DimensionType.Auto : DimensionType.FixedNumber)\n\t\t\t\tconst heightType =\n\t\t\t\t\tcontainerProps.heightType ??\n\t\t\t\t\t(containerProps.height === \"auto\" ? DimensionType.Auto : DimensionType.FixedNumber)\n\n\t\t\t\tconst fractionChildren = handleFraction(_children, direction, widthType, heightType)\n\t\t\t\tconst gapChildren = wrapInGapElementForLegacyGap(\n\t\t\t\t\tfractionChildren,\n\t\t\t\t\tgap,\n\t\t\t\t\tflexDirection,\n\t\t\t\t\tjustifyContent,\n\t\t\t\t\tuseFlexboxGap,\n\t\t\t\t\twrap,\n\t\t\t\t)\n\t\t\t\t// Stack children should ignore the viewport size\n\t\t\t\tconst content = useProvideParentSize(gapChildren, parentSize ?? ParentSizeState.Disabled)\n\n\t\t\t\tconst attributes: Record<string, unknown> = {\n\t\t\t\t\t\"data-framer-component-type\": \"Stack\",\n\t\t\t\t}\n\n\t\t\t\tconst fromCanvasComponent = containerProps.__fromCanvasComponent\n\t\t\t\tif (fromCanvasComponent) attributes[\"data-framer-generated\"] = true\n\n\t\t\t\t// When auto-sized, Stacks will use `width/height: min-content`, instead\n\t\t\t\t// of `width/height: auto`, so text children are sufficiently\n\t\t\t\t// constrained in width when using \"Fill Parent\" sizing. WebKit, however\n\t\t\t\t// (as of March, 2021) has buggy support for `min-content` and will stop\n\t\t\t\t// respecting `border-box` box-sizing when min-content is applied to an\n\t\t\t\t// absolutely positioned element (see\n\t\t\t\t// https://bugs.webkit.org/show_bug.cgi?id=219944). This is a problem,\n\t\t\t\t// because stacks have padding, so ignoring the correct box-sizing would\n\t\t\t\t// also lead to unexpected element sizes. To work around this, we wrap\n\t\t\t\t// the stack's content in a separate element, which will stretch to the\n\t\t\t\t// full size of the stack and leave the outer element's padding at its\n\t\t\t\t// default (0).\n\t\t\t\t//\n\t\t\t\t// There's an edge case that results from the use of a `min-content`\n\t\t\t\t// wrapper around an `align-self: stretch` text node. The text node will\n\t\t\t\t// not be able to shrink beyond the width of its first character, which\n\t\t\t\t// means that there's an implicit min-width of the entire container\n\t\t\t\t// that's set by the width of the first character. The real-world\n\t\t\t\t// implications of this seem relatively small, so we don't do any\n\t\t\t\t// special handling for that case.\n\t\t\t\t//\n\t\t\t\t// As of November 2021, this issue is still outstanding in Safari.\n\t\t\t\t// Unfortunately however, there has not been an open ticket since\n\t\t\t\t// December 16, 2020. A new ticket with this specific reproduction has\n\t\t\t\t// been opened at: https://bugs.webkit.org/show_bug.cgi?id=232816\n\n\t\t\t\tconst alignItems = toJustifyOrAlignment(alignment)\n\n\t\t\t\tconst contentWrapperStyle: MotionStyle = {\n\t\t\t\t\tdisplay: \"flex\",\n\t\t\t\t\tflexDirection,\n\t\t\t\t\tflexWrap: wrap ? \"wrap\" : \"nowrap\",\n\t\t\t\t\tjustifyContent: justifyContent,\n\t\t\t\t\talignItems,\n\t\t\t\t\talignContent: alignItems,\n\t\t\t\t\tpadding,\n\t\t\t\t\t...__contentWrapperStyle,\n\t\t\t\t}\n\n\t\t\t\t// The actual gap property is added in the injected component CSS rules,\n\t\t\t\t// that way we can also unset it if the user agent does not support gap\n\t\t\t\t// and the fallback styles are used.\n\t\t\t\tconst gapEnabled = isGapEnabled(gap, justifyContent, wrap)\n\t\t\t\tif (useFlexboxGap && gapEnabled) {\n\t\t\t\t\tconst gapSupportedInMainAxis = isGapSupportedInMainAxis(justifyContent)\n\t\t\t\t\tif (gapSupportedInMainAxis || direction !== \"horizontal\") {\n\t\t\t\t\t\tasRecord(contentWrapperStyle)[\"--stack-native-column-gap\"] = `${gap}px`\n\t\t\t\t\t}\n\t\t\t\t\tif (gapSupportedInMainAxis || direction !== \"vertical\") {\n\t\t\t\t\t\tasRecord(contentWrapperStyle)[\"--stack-native-row-gap\"] = `${gap}px`\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (contentWrapperStyle.width === undefined) {\n\t\t\t\t\tcontentWrapperStyle.width = widthType === DimensionType.Auto ? \"min-content\" : \"100%\"\n\t\t\t\t}\n\t\t\t\tif (contentWrapperStyle.height === undefined) {\n\t\t\t\t\tcontentWrapperStyle.height = heightType === DimensionType.Auto ? \"min-content\" : \"100%\"\n\t\t\t\t}\n\t\t\t\tif (fromCanvasComponent) {\n\t\t\t\t\tif (styleProp?.width) contentWrapperStyle.width = styleProp?.width\n\t\t\t\t\tif (styleProp?.height) contentWrapperStyle.height = styleProp?.height\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t<FrameWithMotion\n\t\t\t\t\t\tas={as}\n\t\t\t\t\t\tbackground={fromCanvasComponent ? undefined : \"none\"}\n\t\t\t\t\t\t{...props}\n\t\t\t\t\t\tlayoutId={layoutId}\n\t\t\t\t\t\tref={useForwardedRef(forwardedRef, stackRef)}\n\t\t\t\t\t\t{...attributes}\n\t\t\t\t\t\tstyle={style}\n\t\t\t\t\t\tclassName={className}\n\t\t\t\t\t\tlayoutScroll\n\t\t\t\t\t>\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tdata-framer-stack-content-wrapper\n\t\t\t\t\t\t\tdata-framer-stack-direction-reverse={isReverse}\n\t\t\t\t\t\t\tdata-framer-stack-gap-enabled={gapEnabled}\n\t\t\t\t\t\t\tstyle={contentWrapperStyle}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{content}\n\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t</FrameWithMotion>\n\t\t\t\t)\n\t\t\t},\n\t\t)\n\n\t\tStackInner.defaultProps = {\n\t\t\tdistribution: \"start\",\n\t\t}\n\n\t\tStackInner.displayName = \"Stack\"\n\n\t\taddPropertyControls(StackInner, {\n\t\t\tdirection: {\n\t\t\t\ttype: ControlType.SegmentedEnum,\n\t\t\t\toptions: [\"horizontal\", \"vertical\"],\n\t\t\t\ttitle: \"Direction\",\n\t\t\t\tdefaultValue: \"vertical\",\n\t\t\t},\n\t\t\tdistribution: {\n\t\t\t\ttype: ControlType.Enum,\n\t\t\t\toptions: [\"start\", \"center\", \"end\", \"space-between\", \"space-around\", \"space-evenly\"],\n\t\t\t\toptionTitles: [\"Start\", \"Center\", \"End\", \"Space Between\", \"Space Around\", \"Space Evenly\"],\n\t\t\t\ttitle: \"Distribute\",\n\t\t\t\tdefaultValue: \"space-around\",\n\t\t\t},\n\t\t\talignment: {\n\t\t\t\ttype: ControlType.SegmentedEnum,\n\t\t\t\toptions: [\"start\", \"center\", \"end\"],\n\t\t\t\ttitle: \"Align\",\n\t\t\t\tdefaultValue: \"center\",\n\t\t\t},\n\t\t\tgap: {\n\t\t\t\ttype: ControlType.Number,\n\t\t\t\tmin: 0,\n\t\t\t\ttitle: \"Gap\",\n\t\t\t\thidden: props => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\tprops.distribution !== undefined &&\n\t\t\t\t\t\t[\"space-between\", \"space-around\", \"space-evenly\"].includes(props.distribution)\n\t\t\t\t\t)\n\t\t\t\t},\n\t\t\t\tdefaultValue: 10,\n\t\t\t},\n\t\t\tpadding: {\n\t\t\t\ttype: ControlType.FusedNumber,\n\t\t\t\ttoggleKey: \"paddingPerSide\",\n\t\t\t\ttoggleTitles: [\"Padding\", \"Padding per side\"],\n\t\t\t\tvalueKeys: [\"paddingTop\", \"paddingRight\", \"paddingBottom\", \"paddingLeft\"],\n\t\t\t\tvalueLabels: [\"t\", \"r\", \"b\", \"l\"],\n\t\t\t\tmin: 0,\n\t\t\t\ttitle: \"Padding\",\n\t\t\t\tdefaultValue: 0,\n\t\t\t},\n\t\t})\n\n\t\treturn StackInner\n\t})()\n\n/**\n * @internal\n */\nexport function isFractionDimension(dimension: unknown): dimension is string {\n\treturn typeof dimension === \"string\" && dimension.endsWith(\"fr\")\n}\n\n/**\n * @internal\n */\nexport function fraction(dimension: string) {\n\tconst value = parseFloat(dimension)\n\treturn isFiniteNumber(value) ? value : 0\n}\n\nfunction handleFraction(\n\tchildren: React.ReactNode,\n\tdirection: StackDirection,\n\twidthType: DimensionType,\n\theightType: DimensionType,\n) {\n\treturn React.Children.map(children, child => {\n\t\tif (!isReactChild(child) || !isReactElement(child)) return\n\t\tconst isVertical = direction === \"vertical\"\n\t\tconst style: MotionStyle = {}\n\t\tlet hasFraction = false\n\t\tconst { style: propsStyle, size } = child.props as Partial<{\n\t\t\tstyle?: MotionStyle\n\t\t\tsize?: number | string\n\t\t}>\n\t\tlet { width, height } = child.props as Partial<{\n\t\t\twidth?: number | string\n\t\t\theight?: number | string\n\t\t}>\n\n\t\t// convert size to width and height if they are not set already\n\t\tif (size !== undefined) {\n\t\t\tif (width === undefined) width = size\n\t\t\tif (height === undefined) height = size\n\t\t}\n\n\t\tlet newWidth = width\n\t\tlet newHeight = height\n\t\tif (isFractionDimension(width)) {\n\t\t\thasFraction = true\n\t\t\thasFraction = true\n\t\t\tif (isVertical) {\n\t\t\t\t// \"Fill parent\" on an auto-sized axis\n\t\t\t\tif (widthType === DimensionType.Auto) {\n\t\t\t\t\tstyle.alignSelf = \"stretch\"\n\t\t\t\t\tnewWidth = \"auto\"\n\t\t\t\t} else {\n\t\t\t\t\tnewWidth = `${fraction(width) * 100}%`\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnewWidth = 1\n\t\t\t\tstyle.flexGrow = fraction(width)\n\t\t\t\tstyle.flexBasis = 0\n\t\t\t}\n\t\t\tstyle.width = newWidth\n\t\t}\n\n\t\tif (isFractionDimension(height)) {\n\t\t\thasFraction = true\n\t\t\tif (isVertical) {\n\t\t\t\tnewHeight = 1\n\t\t\t\tstyle.flexGrow = fraction(height)\n\t\t\t\tstyle.flexBasis = 0\n\t\t\t} else {\n\t\t\t\t// \"Fill parent\" on an auto-sized axis\n\t\t\t\tif (heightType === DimensionType.Auto) {\n\t\t\t\t\tstyle.alignSelf = \"stretch\"\n\t\t\t\t\tnewHeight = \"auto\"\n\t\t\t\t} else {\n\t\t\t\t\tnewHeight = `${fraction(height) * 100}%`\n\t\t\t\t}\n\t\t\t}\n\t\t\tstyle.height = newHeight\n\t\t}\n\n\t\tif (!hasFraction) return child\n\n\t\tconst nextStyle = { ...propsStyle, ...style }\n\t\treturn React.cloneElement(child, {\n\t\t\twidth: newWidth,\n\t\t\theight: newHeight,\n\t\t\tstyle: nextStyle,\n\t\t} as React.BaseHTMLAttributes<HTMLDivElement>)\n\t})\n}\n\nfunction isGapSupportedInMainAxis(justifyContent: React.CSSProperties[\"justifyContent\"]): boolean {\n\tif (!justifyContent) return false\n\treturn ![\"space-between\", \"space-around\", \"space-evenly\", \"stretch\"].includes(justifyContent)\n}\n\n/**\n * @internal\n */\nexport function isGapEnabled(\n\tgap: number | undefined,\n\tjustifyContent: React.CSSProperties[\"justifyContent\"],\n\twrap: boolean,\n): boolean {\n\tif (!gap) {\n\t\treturn false\n\t}\n\tif (!wrap && !isGapSupportedInMainAxis(justifyContent)) {\n\t\treturn false\n\t}\n\treturn true\n}\n\nfunction wrapInGapElementForLegacyGap(\n\tchildren: React.ReactNode,\n\tgap: number | undefined,\n\tdirection: FlexDirection,\n\tjustifyContent: React.CSSProperties[\"justifyContent\"],\n\tuseFlexboxGap: boolean,\n\twrap: boolean,\n) {\n\tconst gapStyle: React.CSSProperties = {\n\t\t// We need the wrapper to have `display: contents` to prevent the child\n\t\t// margins from collapsing when using the fallback gap solution.\n\t\t// https://codesandbox.io/s/dreamy-haslett-01ie5?file=/src/styles.css\n\t\tdisplay: \"contents\",\n\t}\n\n\tconst gapEnabled = isGapEnabled(gap, justifyContent, wrap)\n\tif (gapEnabled) {\n\t\tconst isVertical = isVerticalDirection(direction)\n\t\tasRecord(gapStyle)[\"--stack-gap-x\"] = `${isVertical ? 0 : gap}px`\n\t\tasRecord(gapStyle)[\"--stack-gap-y\"] = `${isVertical ? gap : 0}px`\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tdata-framer-legacy-stack-gap-enabled={gapEnabled}\n\t\t\tdata-framer-stack-flexbox-gap={useFlexboxGap}\n\t\t\tstyle={gapStyle}\n\t\t>\n\t\t\t{children}\n\t\t</div>\n\t)\n}\n\n/**\n * @internal\n */\nexport function toFlexDirection(direction: StackDirection): FlexDirection {\n\tswitch (direction) {\n\t\tcase \"vertical\":\n\t\t\treturn \"column\"\n\t\tcase \"horizontal\":\n\t\t\treturn \"row\"\n\t\tdefault:\n\t\t\treturn direction\n\t}\n}\n\nfunction isVerticalDirection(direction: FlexDirection) {\n\treturn direction === \"column\" || direction === \"column-reverse\"\n}\n\nfunction isReverseDirection(direction: FlexDirection) {\n\tswitch (direction) {\n\t\tcase \"column-reverse\":\n\t\tcase \"row-reverse\":\n\t\t\treturn true\n\t\tdefault:\n\t\t\treturn false\n\t}\n}\n\n/** @internal */\nexport function toJustifyOrAlignment(distribution: StackDistribution | StackAlignment) {\n\tswitch (distribution) {\n\t\tcase \"start\":\n\t\t\treturn \"flex-start\"\n\t\tcase \"end\":\n\t\t\treturn \"flex-end\"\n\t\tdefault:\n\t\t\treturn distribution\n\t}\n}\n\n/**\n * Utils\n */\n\n// Assign the element to both the forwardedRef and an inner ref.\nfunction useForwardedRef<T>(forwardedRef: React.ForwardedRef<T>, innerRef: React.MutableRefObject<T>) {\n\treturn (element: T) => {\n\t\tinnerRef.current = element\n\n\t\tif (typeof forwardedRef === \"function\") {\n\t\t\tforwardedRef(element)\n\t\t} else if (forwardedRef) {\n\t\t\tforwardedRef.current = element\n\t\t}\n\t}\n}\n", "import type { MotionValue, PanInfo } from \"framer-motion\"\nimport type React from \"react\"\nimport { FrameWithMotion } from \"../../render/presentation/Frame/FrameWithMotion.tsx\"\nimport { toJustifyOrAlignment } from \"../Stack/Stack.tsx\"\nimport type { PageAlignment, PageContentDimension } from \"./types.ts\"\n\ninterface PageContainerProps {\n\teffect: { [key: string]: MotionValue } | undefined\n\tchildren?: React.ReactNode\n\tdragEnabled: boolean\n\tdirection: \"horizontal\" | \"vertical\"\n\tcontentWidth: PageContentDimension | number\n\tcontentHeight: PageContentDimension | number\n\talignment?: PageAlignment\n\tgap: number\n\tisLastPage: boolean\n\tcontentOffsetRef: React.MutableRefObject<{ x: MotionValue<number>; y: MotionValue<number> }>\n\tconstraintsRef: React.MutableRefObject<{ top: number; left: number; right: number; bottom: number }>\n\tdirectionLock: boolean | undefined\n\tlayoutId: string | undefined\n\tonDragStart: (event: MouseEvent | TouchEvent, info: PanInfo) => void\n\tonDrag: (event: MouseEvent | TouchEvent, info: PanInfo) => void\n\tonDragEnd: (event: MouseEvent | TouchEvent, info: PanInfo) => void\n}\n\nexport const pageContentWrapperType = \"PageContentWrapper\"\n\nexport function PageContainer({\n\tchildren,\n\teffect,\n\tdragEnabled,\n\tdirection,\n\tcontentHeight,\n\tcontentWidth,\n\talignment,\n\tgap,\n\tisLastPage,\n\tcontentOffsetRef,\n\tconstraintsRef,\n\tdirectionLock,\n\tonDragStart,\n\tonDrag,\n\tonDragEnd,\n\tlayoutId,\n}: PageContainerProps) {\n\tconst isHorizontalDirection = direction === \"horizontal\"\n\tconst dragAxis = isHorizontalDirection ? \"x\" : \"y\"\n\tconst hasHorizontalGap = isHorizontalDirection && !isLastPage && gap\n\tconst hasVerticalGap = !isHorizontalDirection && !isLastPage && gap\n\tconst hasAutoWidth = contentWidth !== \"stretch\" && isHorizontalDirection\n\tconst hasAutoHeight = contentHeight !== \"stretch\" && !isHorizontalDirection\n\tconst wrapperWidth = hasAutoWidth ? \"auto\" : \"100%\"\n\tconst wrapperHeight = hasAutoHeight ? \"auto\" : \"100%\"\n\tconst containerWidth = hasHorizontalGap && wrapperWidth === \"100%\" ? `calc(100% + ${gap}px)` : wrapperWidth\n\tconst containerHeight = hasVerticalGap && wrapperHeight === \"100%\" ? `calc(100% + ${gap}px)` : wrapperHeight\n\n\treturn (\n\t\t<FrameWithMotion\n\t\t\tposition=\"relative\"\n\t\t\tdata-framer-component-type=\"PageContainer\"\n\t\t\twidth={containerWidth}\n\t\t\theight={containerHeight}\n\t\t\tlayoutId={layoutId ? `${layoutId}-container` : undefined}\n\t\t\tbackgroundColor=\"transparent\"\n\t\t\tdrag={dragEnabled ? dragAxis : false}\n\t\t\tdragDirectionLock={directionLock}\n\t\t\t_dragX={contentOffsetRef.current.x}\n\t\t\t_dragY={contentOffsetRef.current.y}\n\t\t\tdragConstraints={constraintsRef.current}\n\t\t\tonDrag={onDrag}\n\t\t\tonDragStart={onDragStart}\n\t\t\tonDragEnd={onDragEnd}\n\t\t\tpreserve3d\n\t\t\tstyle={{\n\t\t\t\tpointerEvents: undefined,\n\t\t\t\tpaddingRight: hasHorizontalGap ? gap : 0,\n\t\t\t\tpaddingBottom: hasVerticalGap ? gap : 0,\n\t\t\t}}\n\t\t>\n\t\t\t<FrameWithMotion\n\t\t\t\tposition=\"relative\"\n\t\t\t\tdata-framer-component-type={pageContentWrapperType}\n\t\t\t\twidth={wrapperWidth}\n\t\t\t\theight={wrapperHeight}\n\t\t\t\tpreserve3d={false}\n\t\t\t\tbackgroundColor=\"transparent\"\n\t\t\t\tkey={effect ? Object.keys(effect).join(\"\") : \"\"}\n\t\t\t\tstyle={{\n\t\t\t\t\t...effect,\n\t\t\t\t\tpointerEvents: undefined,\n\t\t\t\t\tdisplay: \"flex\",\n\t\t\t\t\tflexDirection: isHorizontalDirection ? \"row\" : \"column\",\n\t\t\t\t\talignItems: alignment && toJustifyOrAlignment(alignment),\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</FrameWithMotion>\n\t\t</FrameWithMotion>\n\t)\n}\n", "import { ControlType } from \"../../render/types/PropertyControls.ts\"\nimport { addPropertyControls } from \"../../utils/addPropertyControls.ts\"\nimport { Page as EmulatedPage } from \"./EmulatedPage.tsx\"\nimport type { PageAlignment, PageContentDimension, PageEffect } from \"./types.ts\"\n\n/**\n * @deprecated Creating new Page components in Framer is no longer supported as of July 2025.\n * Existing Page components will continue to work, but please use alternative solutions for new\n * projects.\n */\nexport const Page = /* @__PURE__ */ (() => {\n\tconst ContentDimension: { Auto: PageContentDimension; Stretch: PageContentDimension } = {\n\t\tAuto: \"auto\",\n\t\tStretch: \"stretch\",\n\t}\n\n\tconst pageContentDimensionOptions: PageContentDimension[] = [ContentDimension.Auto, ContentDimension.Stretch]\n\tconst pageContentDimensionTitles = /* @__PURE__ */ pageContentDimensionOptions.map(option => {\n\t\tswitch (option) {\n\t\t\tcase ContentDimension.Auto:\n\t\t\t\treturn \"Auto\"\n\t\t\tcase ContentDimension.Stretch:\n\t\t\t\treturn \"Stretch\"\n\t\t}\n\t}) as string[]\n\n\tconst pageEffectOptions: PageEffect[] = [\"none\", \"cube\", \"coverflow\", \"wheel\", \"pile\"]\n\tconst pageEffectTitles = /* @__PURE__ */ pageEffectOptions.map(option => {\n\t\tswitch (option) {\n\t\t\tcase \"none\":\n\t\t\t\treturn \"None\"\n\t\t\tcase \"cube\":\n\t\t\t\treturn \"Cube\"\n\t\t\tcase \"coverflow\":\n\t\t\t\treturn \"Cover Flow\"\n\t\t\tcase \"wheel\":\n\t\t\t\treturn \"Wheel\"\n\t\t\tcase \"pile\":\n\t\t\t\treturn \"Pile\"\n\t\t}\n\t})\n\n\tconst pageAlignmentOptions: PageAlignment[] = [\"start\", \"center\", \"end\"]\n\tconst genericAlignmentTitles = /* @__PURE__ */ pageAlignmentOptions.map(option => {\n\t\tswitch (option) {\n\t\t\tcase \"start\":\n\t\t\t\treturn \"Start\"\n\t\t\tcase \"center\":\n\t\t\t\treturn \"Center\"\n\t\t\tcase \"end\":\n\t\t\t\treturn \"End\"\n\t\t}\n\t})\n\n\t// These were the original defaults before we applied control defaults to defaultProps. To keep the\n\t// behavior consistent from code we are overriding the defaults that are different.\n\tEmulatedPage.defaultProps = {\n\t\tgap: 10,\n\t\tdirectionLock: false,\n\t}\n\n\taddPropertyControls(EmulatedPage, {\n\t\tdirection: {\n\t\t\ttype: ControlType.Enum,\n\t\t\toptions: [\"horizontal\", \"vertical\"],\n\t\t\ttitle: \"Direction\",\n\t\t\tdefaultValue: \"horizontal\",\n\t\t\tdisplaySegmentedControl: true,\n\t\t\toptionIcons: [\"direction-horizontal\", \"direction-vertical\"],\n\t\t},\n\t\tdirectionLock: {\n\t\t\ttype: ControlType.Boolean,\n\t\t\ttitle: \"Lock\",\n\t\t\tenabledTitle: \"1 Axis\",\n\t\t\tdisabledTitle: \"Off\",\n\t\t\tdefaultValue: true,\n\t\t},\n\t\tcontentWidth: {\n\t\t\ttype: ControlType.Enum,\n\t\t\toptions: pageContentDimensionOptions,\n\t\t\toptionTitles: pageContentDimensionTitles,\n\t\t\ttitle: \"Width\",\n\t\t\tdefaultValue: ContentDimension.Stretch,\n\t\t\tdisplaySegmentedControl: true,\n\t\t},\n\t\tcontentHeight: {\n\t\t\ttype: ControlType.Enum,\n\t\t\toptions: pageContentDimensionOptions,\n\t\t\toptionTitles: pageContentDimensionTitles,\n\t\t\ttitle: \"Height\",\n\t\t\tdefaultValue: ContentDimension.Stretch,\n\t\t\tdisplaySegmentedControl: true,\n\t\t},\n\t\talignment: {\n\t\t\ttype: ControlType.Enum,\n\t\t\toptions: pageAlignmentOptions,\n\t\t\toptionTitles: genericAlignmentTitles,\n\t\t\ttitle: \"Align\",\n\t\t\thidden(props) {\n\t\t\t\tconst { direction, contentWidth, contentHeight } = props\n\t\t\t\tconst isHorizontalDirection = direction === \"horizontal\"\n\t\t\t\tconst crossDimension = isHorizontalDirection ? contentHeight : contentWidth\n\t\t\t\treturn crossDimension === ContentDimension.Stretch\n\t\t\t},\n\t\t\tdefaultValue: \"start\",\n\t\t\tdisplaySegmentedControl: true,\n\t\t\toptionIcons: {\n\t\t\t\tdirection: {\n\t\t\t\t\thorizontal: [\"align-top\", \"align-middle\", \"align-bottom\"],\n\t\t\t\t\tvertical: [\"align-left\", \"align-center\", \"align-right\"],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tgap: {\n\t\t\ttype: ControlType.Number,\n\t\t\tmin: 0,\n\t\t\ttitle: \"Gap\",\n\t\t\tdefaultValue: 0,\n\t\t},\n\t\tpadding: {\n\t\t\ttype: ControlType.FusedNumber,\n\t\t\ttoggleKey: \"paddingPerSide\",\n\t\t\ttoggleTitles: [\"Padding\", \"Padding per side\"],\n\t\t\tvalueKeys: [\"paddingTop\", \"paddingRight\", \"paddingBottom\", \"paddingLeft\"],\n\t\t\tvalueLabels: [\"T\", \"R\", \"B\", \"L\"],\n\t\t\tmin: 0,\n\t\t\ttitle: \"Padding\",\n\t\t\tdefaultValue: 0,\n\t\t},\n\t\toverflow: {\n\t\t\ttype: ControlType.Enum,\n\t\t\ttitle: \"Overflow\",\n\t\t\tdefaultValue: \"hidden\",\n\t\t\toptions: [\"visible\", \"hidden\"],\n\t\t\toptionTitles: [\"Visible\", \"Hidden\"],\n\t\t\tdisplaySegmentedControl: true,\n\t\t},\n\t\tcurrentPage: {\n\t\t\ttype: ControlType.Number,\n\t\t\tmin: 0,\n\t\t\ttitle: \"Current\",\n\t\t\tdisplayStepper: true,\n\t\t\tdefaultValue: 0,\n\t\t},\n\t\tmomentum: {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tenabledTitle: \"On\",\n\t\t\tdisabledTitle: \"Off\",\n\t\t\ttitle: \"Momentum\",\n\t\t\tdefaultValue: false,\n\t\t},\n\t\tdragEnabled: {\n\t\t\ttype: ControlType.Boolean,\n\t\t\ttitle: \"Drag\",\n\t\t\tenabledTitle: \"On\",\n\t\t\tdisabledTitle: \"Off\",\n\t\t\tdefaultValue: true,\n\t\t},\n\t\twheelEnabled: {\n\t\t\ttype: ControlType.Boolean,\n\t\t\ttitle: \"Wheel\",\n\t\t\tenabledTitle: \"On\",\n\t\t\tdisabledTitle: \"Off\",\n\t\t\tdefaultValue: false,\n\t\t},\n\t\tdefaultEffect: {\n\t\t\ttype: ControlType.Enum,\n\t\t\toptions: pageEffectOptions,\n\t\t\toptionTitles: pageEffectTitles,\n\t\t\ttitle: \"Effect\",\n\t\t\tdefaultValue: \"none\",\n\t\t},\n\t\tchildren: {\n\t\t\ttype: ControlType.Array,\n\t\t\ttitle: \"Content\",\n\t\t\tcontrol: { type: ControlType.ComponentInstance, title: \"Page\" },\n\t\t},\n\t})\n\t// @ts-expect-error Property supportsConstraints does not exist on type\n\tEmulatedPage.supportsConstraints = true\n\n\treturn EmulatedPage\n})()\n", "import React, { Component } from \"react\"\nimport { FramerEventSession } from \"../events/FramerEventSession.ts\"\nimport type { FramerEvent } from \"../events/index.ts\"\nimport { FramerEventListener } from \"../events/index.ts\"\nimport { FrameWithMotion } from \"../render/presentation/Frame/FrameWithMotion.tsx\"\n\nexport interface ScreenProperties {\n\twidth: number\n\theight: number\n\tscale?: number\n\tcolor?: string\n}\n\n/** @internal */\nexport class Screen extends Component<ScreenProperties & { children?: React.ReactNode }> {\n\tsession = new FramerEventSession(this.dispatcher)\n\tprivate elementRef = React.createRef<HTMLDivElement>()\n\n\toverride componentDidMount() {\n\t\tif (this.elementRef.current) {\n\t\t\tthis.session.originElement = this.elementRef.current\n\t\t}\n\t}\n\n\toverride render() {\n\t\tconst { width, height, scale, color = \"none\", children } = this.props\n\n\t\tconst frame = (\n\t\t\t<FrameWithMotion\n\t\t\t\tref={this.elementRef}\n\t\t\t\twidth={width}\n\t\t\t\theight={height}\n\t\t\t\tstyle={{ originX: 0, originY: 0, scale, backgroundColor: color }}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</FrameWithMotion>\n\t\t)\n\n\t\treturn <FramerEventListener session={this.session}>{frame}</FramerEventListener>\n\t}\n\n\tprivate dispatcher(type: string, event: FramerEvent, target: EventTarget) {\n\t\ttarget.dispatchEvent(new CustomEvent(\"FramerEvent\", { bubbles: true, detail: { type: type, event: event } }))\n\t}\n}\n", "import type { FramerEvent } from \"../FramerEvent.ts\"\nimport type { FramerEventSession } from \"../FramerEventSession.ts\"\n\n/**\n * @internal\n */\nexport enum State {\n\tPossible = 1 << 1, // 2\n\tBegan = 1 << 2, // 4\n\tChanged = 1 << 3, // 8\n\tEnded = 1 << 4, // 16\n\tFailed = 1 << 5, // 32\n\tCancelled = 1 << 6, // 64\n\tRecognized = 1 << 7, // 128\n}\n\nfunction stateName(state: State): string {\n\tswitch (state) {\n\t\tcase State.Possible:\n\t\t\treturn \"Possible\"\n\t\tcase State.Began:\n\t\t\treturn \"Began\"\n\t\tcase State.Changed:\n\t\t\treturn \"Changed\"\n\t\tcase State.Ended:\n\t\t\treturn \"Ended\"\n\t\tcase State.Failed:\n\t\t\treturn \"Failed\"\n\t\tcase State.Cancelled:\n\t\t\treturn \"Cancelled\"\n\t\tcase State.Recognized:\n\t\t\treturn \"Recognized\"\n\t\tdefault:\n\t\t\treturn \"Unknown\"\n\t}\n}\n\nfunction containsBitmask(value: number, bitmask: number): boolean {\n\treturn (value & bitmask) !== 0\n}\n\n/**\n * @internal\n */\nexport abstract class GestureRecognizer {\n\tprivate _state: State = State.Possible\n\n\tget state(): State {\n\t\treturn this._state\n\t}\n\tprivate setState(state: State) {\n\t\tthis._state = state\n\t}\n\thandler: GestureHandler | null = null\n\tpreventers: GestureRecognizer[] = []\n\tget isPrevented(): boolean {\n\t\tlet prevented = false\n\t\tfor (const recognizer of this.preventers) {\n\t\t\tif (recognizer.state & (State.Began | State.Changed | State.Ended)) {\n\t\t\t\tprevented = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\treturn prevented\n\t}\n\n\tabstract pointerSessionBegan(session: FramerEventSession, event: FramerEvent): void\n\tabstract pointerSessionMoved(session: FramerEventSession, event: FramerEvent): void\n\tabstract pointerSessionEnded(session: FramerEventSession, event: FramerEvent): void\n\n\tcanBePreventedBy(recognizer: GestureRecognizer) {\n\t\tthis.preventers.push(recognizer)\n\t}\n\n\thasState(bitmask: State) {\n\t\treturn containsBitmask(this.state, bitmask)\n\t}\n\n\tstateSwitch(newState: State) {\n\t\tlet allowedStates: State | 0\n\t\tswitch (this.state) {\n\t\t\tcase State.Possible:\n\t\t\t\tallowedStates = State.Began | State.Recognized | State.Failed\n\t\t\t\tbreak\n\t\t\tcase State.Began:\n\t\t\t\tallowedStates = State.Changed | State.Cancelled | State.Ended\n\t\t\t\tbreak\n\t\t\tcase State.Changed:\n\t\t\t\tallowedStates = State.Changed | State.Cancelled | State.Ended\n\t\t\t\tbreak\n\t\t\tcase State.Recognized:\n\t\t\tcase State.Ended:\n\t\t\tcase State.Cancelled:\n\t\t\tcase State.Failed:\n\t\t\t\tallowedStates = State.Possible\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tallowedStates = 0\n\t\t}\n\t\tif (!containsBitmask(newState, allowedStates)) {\n\t\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\t\tconsole.warn(`Unallowed state change from ${stateName(this.state)} to ${stateName(newState)}`)\n\t\t\treturn\n\t\t}\n\t\tthis.setState(newState)\n\t}\n\n\tcancel() {\n\t\tif (this.hasState(State.Began | State.Changed)) {\n\t\t\tthis.setState(State.Cancelled)\n\t\t}\n\t\tthis.reset()\n\t}\n\n\treset() {\n\t\tif (!this.hasState(State.Possible)) {\n\t\t\tthis.stateSwitch(State.Possible)\n\t\t}\n\t}\n}\n\n/**\n * @internal\n */\nexport interface GestureHandler {\n\tgestureBegan: (type: string, event: FramerEvent, target: EventTarget | null) => void\n\tgestureChanged: (type: string, event: FramerEvent, target: EventTarget | null) => void\n\tgestureEnded: (type: string, event: FramerEvent, target: EventTarget | null) => void\n}\n", "import { debounce } from \"../../render/utils/debounce.ts\"\nimport type { FramerEvent } from \"../FramerEvent.ts\"\nimport type { FramerEventSession } from \"../FramerEventSession.ts\"\nimport { GestureRecognizer, State } from \"./GestureRecognizer.ts\"\n\n/**\n * @internal\n */\nexport class MouseWheelGestureRecognizer extends GestureRecognizer {\n\tprivate startEvent: FramerEvent | null = null\n\treadonly eventType = \"mousewheel\"\n\n\tpointerSessionBegan(session: FramerEventSession, event: FramerEvent) {}\n\tpointerSessionMoved(session: FramerEventSession, event: FramerEvent) {}\n\tpointerSessionEnded(session: FramerEventSession, event: FramerEvent) {}\n\n\tmouseWheel(session: FramerEventSession, event: FramerEvent) {\n\t\tif (!this.handler) return\n\n\t\tif (this.hasState(State.Possible)) {\n\t\t\tthis.startEvent = event\n\t\t\tthis.stateSwitch(State.Began)\n\t\t\tthis.handler.gestureBegan(this.eventType, event, this.startEvent.target)\n\t\t\treturn\n\t\t}\n\n\t\tif (this.hasState(State.Began | State.Changed) && this.startEvent) {\n\t\t\tthis.stateSwitch(State.Changed)\n\t\t\tthis.handler.gestureChanged(this.eventType, event, this.startEvent.target)\n\t\t}\n\t\tthis.onMouseWheelEnd(event)\n\t}\n\n\tprivate onMouseWheelEnd = debounce((event: FramerEvent) => {\n\t\tif (this.handler && this.startEvent) {\n\t\t\tthis.stateSwitch(State.Ended)\n\t\t\tthis.handler.gestureEnded(this.eventType, event, this.startEvent.target)\n\t\t\tthis.startEvent = null\n\t\t\tthis.reset()\n\t\t}\n\t}, 300)\n}\n", "import type { FramerEvent } from \"../FramerEvent.ts\"\nimport type { FramerEventSession } from \"../FramerEventSession.ts\"\nimport { GestureRecognizer, State } from \"./GestureRecognizer.ts\"\n\n/**\n * @internal\n */\nexport class PanGestureRecognizer extends GestureRecognizer {\n\tprivate startEvent: FramerEvent | null = null\n\treadonly eventType = \"pan\"\n\n\tpointerSessionBegan(session: FramerEventSession, event: FramerEvent) {\n\t\tthis.recognize(session, event)\n\t}\n\tpointerSessionMoved(session: FramerEventSession, event: FramerEvent) {\n\t\tthis.recognize(session, event)\n\t}\n\tpointerSessionEnded(session: FramerEventSession, event: FramerEvent) {\n\t\tthis.panend(event)\n\t}\n\n\trecognize(session: FramerEventSession, event: FramerEvent) {\n\t\tif (Math.abs(event.delta.x) > 0 || Math.abs(event.delta.y) > 0) {\n\t\t\tif (this.startEvent) {\n\t\t\t\tthis.pan(event)\n\t\t\t} else {\n\t\t\t\tthis.panstart(event)\n\t\t\t}\n\t\t}\n\t}\n\n\toverride reset() {\n\t\tthis.startEvent = null\n\t\tsuper.reset()\n\t}\n\n\tpanstart(event: FramerEvent) {\n\t\tif (!this.hasState(State.Possible) || (event.isLeftMouseClick !== undefined && !event.isLeftMouseClick)) {\n\t\t\treturn\n\t\t}\n\t\tthis.stateSwitch(State.Began)\n\t\tthis.startEvent = event\n\t\tif (this.handler && this.startEvent.target) {\n\t\t\tthis.handler.gestureBegan(this.eventType, event, this.startEvent.target)\n\t\t}\n\t}\n\n\tpan(event: FramerEvent) {\n\t\tif (!this.hasState(State.Began | State.Changed)) {\n\t\t\treturn\n\t\t}\n\t\tif (!this.startEvent) {\n\t\t\treturn\n\t\t}\n\t\tthis.stateSwitch(State.Changed)\n\t\tif (this.handler && this.startEvent.target) {\n\t\t\tthis.handler.gestureChanged(this.eventType, event, this.startEvent.target)\n\t\t}\n\t}\n\n\tpanend(event: FramerEvent) {\n\t\tif (!this.hasState(State.Began | State.Changed)) {\n\t\t\treturn\n\t\t}\n\t\tif (!this.startEvent) {\n\t\t\treturn\n\t\t}\n\t\tthis.stateSwitch(State.Ended)\n\t\tif (this.handler && this.startEvent.target) {\n\t\t\tthis.handler.gestureEnded(this.eventType, event, this.startEvent.target)\n\t\t}\n\t}\n}\n", "import type { FramerEvent } from \"../FramerEvent.ts\"\nimport type { FramerEventSession } from \"../FramerEventSession.ts\"\nimport { GestureRecognizer, State } from \"./GestureRecognizer.ts\"\n\n/**\n * @internal\n */\nexport class TapGestureRecognizer extends GestureRecognizer {\n\treadonly eventType = \"tap\"\n\n\tpointerSessionBegan(session: FramerEventSession, event: FramerEvent) {\n\t\tif (this.handler && (event.isLeftMouseClick === undefined || event.isLeftMouseClick)) {\n\t\t\tthis.handler.gestureBegan(this.eventType, event, null)\n\t\t}\n\t}\n\tpointerSessionMoved(session: FramerEventSession, event: FramerEvent) {}\n\tpointerSessionEnded(session: FramerEventSession, event: FramerEvent) {\n\t\tif (this.isPrevented) {\n\t\t\tthis.stateSwitch(State.Failed)\n\t\t} else if (!session.startEvent || session.startEvent.target === event.target) {\n\t\t\tthis.stateSwitch(State.Recognized)\n\t\t\tif (this.handler) {\n\t\t\t\tthis.handler.gestureChanged(this.eventType, event, null)\n\t\t\t}\n\t\t} else {\n\t\t\tthis.stateSwitch(State.Failed)\n\t\t}\n\t\tif (this.handler) {\n\t\t\tthis.handler.gestureEnded(this.eventType, event, null)\n\t\t}\n\t}\n}\n", "import { Loop, MainLoop } from \"../core/Loop.ts\"\nimport type { Point } from \"../render/types/Point.ts\"\nimport type { FramerEvent } from \"./FramerEvent.ts\"\nimport type { GestureHandler, GestureRecognizer } from \"./recognizer/GestureRecognizer.ts\"\nimport { MouseWheelGestureRecognizer } from \"./recognizer/MouseWheelGestureRecognizer.ts\"\nimport { PanGestureRecognizer } from \"./recognizer/PanGestureRecognizer.ts\"\nimport { TapGestureRecognizer } from \"./recognizer/TapGestureRecognizer.ts\"\n\nexport type EventDispatcher = (type: string, event: FramerEvent, target: EventTarget) => void\n\nexport type NativeEvent = MouseEvent | TouchEvent\n\n/**\n * @internal\n */\nexport class FramerEventSession implements GestureHandler {\n\tprivate events: FramerEvent[] = []\n\tprivate recognizers: GestureRecognizer[] = []\n\tprivate mouseWheelRecognizer = new MouseWheelGestureRecognizer()\n\tprivate dispatcher: EventDispatcher\n\t/**\n\t * @internal\n\t */\n\toriginElement: HTMLElement\n\n\tget isStarted(): boolean {\n\t\treturn this.events.length !== 0\n\t}\n\n\tget startEvent(): FramerEvent | undefined {\n\t\treturn this.isStarted ? this.events[0] : undefined\n\t}\n\n\tget lastEvent(): FramerEvent | undefined {\n\t\treturn this.events[this.events.length - 1]\n\t}\n\n\tconstructor(dispatcher: EventDispatcher, customOrigin?: HTMLElement) {\n\t\tthis.dispatcher = dispatcher\n\t\tif (customOrigin) {\n\t\t\tthis.originElement = customOrigin\n\t\t} else {\n\t\t\tthis.originElement = document.body\n\t\t}\n\t\tconst pan = new PanGestureRecognizer()\n\t\tconst tap = new TapGestureRecognizer()\n\t\tpan.handler = this\n\t\ttap.handler = this\n\t\tthis.mouseWheelRecognizer.handler = this\n\t\tthis.recognizers = [tap, pan]\n\t}\n\n\t// Event handling\n\n\tprivate processEvent(event: FramerEvent): FramerEvent {\n\t\t// const event = new FramerEvent(originalEvent, this)\n\t\tthis.events.push(event)\n\t\treturn event\n\t}\n\n\tpointerDown(event: FramerEvent) {\n\t\tif (this.isStarted) {\n\t\t\treturn\n\t\t}\n\n\t\tthis.processEvent(event)\n\t\tthis.recognizers.map(r => {\n\t\t\tr.cancel()\n\t\t\tr.pointerSessionBegan(this, event)\n\t\t})\n\t}\n\n\tpointerMove(event: FramerEvent) {\n\t\tif (!this.isStarted) {\n\t\t\treturn\n\t\t}\n\n\t\tthis.processEvent(event)\n\t\tthis.recognizers.map(r => {\n\t\t\tr.pointerSessionMoved(this, event)\n\t\t})\n\t}\n\n\tpointerUp(event: FramerEvent) {\n\t\tif (!this.isStarted) {\n\t\t\treturn\n\t\t}\n\t\tthis.processEvent(event)\n\t\tthis.recognizers.map(r => {\n\t\t\tr.pointerSessionEnded(this, event)\n\t\t})\n\t\tthis.clearEvents()\n\t\tthis.recognizers.map(r => {\n\t\t\tr.reset()\n\t\t})\n\t}\n\n\tmouseWheel(event: FramerEvent) {\n\t\tthis.processEvent(event)\n\t\tthis.mouseWheelRecognizer.mouseWheel(this, event)\n\t\tthis.clearEvents()\n\t}\n\n\tprivate clearEvents() {\n\t\tthis.events = []\n\t}\n\n\tprivate dispatch(type: string, event: FramerEvent, target: EventTarget | null = null) {\n\t\tconst dispatchTarget = target || (this.startEvent && this.startEvent.target) || event.target\n\t\tif (dispatchTarget) {\n\t\t\tthis.dispatcher(type, event, dispatchTarget)\n\t\t}\n\t}\n\n\t// Gesture Handler\n\n\tgestureBegan(type: string, event: FramerEvent, target: EventTarget | null) {\n\t\tthis.dispatch(`${type}start`, event, target)\n\t}\n\n\tgestureChanged(type: string, event: FramerEvent, target: EventTarget | null) {\n\t\tthis.dispatch(type, event, target)\n\t}\n\tgestureEnded(type: string, event: FramerEvent, target: EventTarget | null) {\n\t\tthis.dispatch(`${type}end`, event, target)\n\t}\n\n\t// Calculatinos\n\n\t/**\n\t * Average velocity over last n seconds in pixels per second.\n\t * @param n - number of events to use for calculation\n\t */\n\tvelocity(t = Loop.TimeStep * 2): Point {\n\t\tif (!this.isStarted || this.events.length < 2) {\n\t\t\treturn { x: 0, y: 0 }\n\t\t}\n\n\t\tconst events = this.events\n\t\tlet i = events.length - 1\n\t\tlet event: FramerEvent | null = null\n\n\t\twhile (i >= 0) {\n\t\t\tevent = events[i] ?? null\n\t\t\tif (!event || MainLoop.time - event.loopTime > t) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\ti--\n\t\t}\n\n\t\tif (!event) {\n\t\t\treturn { x: 0, y: 0 }\n\t\t}\n\n\t\tconst current = events[events.length - 1]\n\t\tif (!current) {\n\t\t\treturn { x: 0, y: 0 }\n\t\t}\n\n\t\tconst time = (MainLoop.time - event.loopTime) * 1000\n\t\tif (time === 0) {\n\t\t\treturn { x: 0, y: 0 }\n\t\t}\n\n\t\tconst velocity = {\n\t\t\tx: (current.devicePoint.x - event.devicePoint.x) / time,\n\t\t\ty: (current.devicePoint.y - event.devicePoint.y) / time,\n\t\t}\n\n\t\tif (velocity.x === Infinity) {\n\t\t\tvelocity.x = 0\n\t\t}\n\t\tif (velocity.y === Infinity) {\n\t\t\tvelocity.y = 0\n\t\t}\n\n\t\treturn velocity\n\t}\n\n\toffset(event: FramerEvent): Point {\n\t\tif (!this.startEvent) {\n\t\t\treturn { x: 0, y: 0 }\n\t\t}\n\n\t\t// TODO: externalize:\n\t\tconst subtract = (pointA: Point, pointB: Point): Point => {\n\t\t\treturn {\n\t\t\t\tx: pointA.x - pointB.x,\n\t\t\t\ty: pointA.y - pointB.y,\n\t\t\t}\n\t\t}\n\n\t\treturn subtract(event.devicePoint, this.startEvent.devicePoint)\n\t}\n}\n", "import type React from \"react\"\nimport { Component } from \"react\"\nimport { safeWindow } from \"../../utils/safeWindow.ts\"\nimport { FramerEvent } from \"../FramerEvent.ts\"\nimport type { FramerEventSession } from \"../FramerEventSession.ts\"\n\nexport interface MouseProps {\n\tsession: FramerEventSession\n}\n/**\n * @internal\n */\nexport class MouseEventListener extends Component<MouseProps & { children?: React.ReactNode }> {\n\t/**\n\t * @internal\n\t */\n\toverride render() {\n\t\treturn this.props.children\n\t}\n\n\t/**\n\t * @internal\n\t */\n\toverride componentDidMount() {\n\t\tsafeWindow.addEventListener(\"mousedown\", this.domMouseDown)\n\t\tsafeWindow.addEventListener(\"wheel\", this.domMouseWheel)\n\t}\n\n\t/**\n\t * @internal\n\t */\n\toverride componentWillUnmount() {\n\t\tsafeWindow.removeEventListener(\"mousemove\", this.domMouseMove)\n\t\tsafeWindow.removeEventListener(\"mousedown\", this.domMouseDown)\n\t\tsafeWindow.removeEventListener(\"mouseup\", this.domMouseUp)\n\t\tsafeWindow.removeEventListener(\"wheel\", this.domMouseWheel)\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tdomMouseDown = (originalEvent: MouseEvent) => {\n\t\tsafeWindow.addEventListener(\"mousemove\", this.domMouseMove)\n\t\tsafeWindow.addEventListener(\"mouseup\", this.domMouseUp)\n\t\tconst event = new FramerEvent(originalEvent, this.props.session)\n\t\tthis.props.session.pointerDown(event)\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tdomMouseMove = (originalEvent: MouseEvent) => {\n\t\tconst leftMouseButtonOnlyDown =\n\t\t\toriginalEvent.buttons === undefined ? originalEvent.which === 1 : originalEvent.buttons === 1\n\n\t\t// mousemoves should only be registred when left mouse button is down\n\t\tif (!leftMouseButtonOnlyDown) {\n\t\t\tthis.domMouseUp(originalEvent)\n\t\t\treturn\n\t\t}\n\n\t\tconst event = new FramerEvent(originalEvent, this.props.session)\n\t\tthis.props.session.pointerMove(event)\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tdomMouseUp = (originalEvent: MouseEvent) => {\n\t\tsafeWindow.removeEventListener(\"mousemove\", this.domMouseMove)\n\t\tsafeWindow.removeEventListener(\"mouseup\", this.domMouseUp)\n\t\tconst event = new FramerEvent(originalEvent, this.props.session)\n\t\tthis.props.session.pointerUp(event)\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tdomMouseWheel = (originalEvent: MouseEvent) => {\n\t\tconst event = new FramerEvent(originalEvent, this.props.session)\n\t\tthis.props.session.mouseWheel(event)\n\t}\n}\n", "import type React from \"react\"\nimport { Component } from \"react\"\nimport { safeWindow } from \"../../utils/safeWindow.ts\"\nimport { FramerEvent } from \"../FramerEvent.ts\"\nimport type { FramerEventSession } from \"../FramerEventSession.ts\"\n\nexport interface Props {\n\tsession: FramerEventSession\n}\n\n/**\n * @internal\n */\nexport class TouchEventListener extends Component<Props & { children?: React.ReactNode }> {\n\t/**\n\t * @internal\n\t */\n\toverride render() {\n\t\treturn this.props.children\n\t}\n\n\t/**\n\t * @internal\n\t */\n\toverride componentDidMount() {\n\t\tsafeWindow.addEventListener(\"touchstart\", this.domTouchStart)\n\t}\n\n\t/**\n\t * @internal\n\t */\n\toverride componentWillUnmount() {\n\t\tsafeWindow.removeEventListener(\"touchstart\", this.domTouchStart)\n\t\tsafeWindow.removeEventListener(\"touchmove\", this.domTouchMove)\n\t\tsafeWindow.removeEventListener(\"touchend\", this.domTouchEnd)\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tdomTouchStart = (originalEvent: TouchEvent) => {\n\t\tsafeWindow.addEventListener(\"touchmove\", this.domTouchMove)\n\t\tsafeWindow.addEventListener(\"touchend\", this.domTouchEnd)\n\t\tconst event = new FramerEvent(originalEvent, this.props.session)\n\t\tthis.props.session.pointerDown(event)\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tdomTouchMove = (originalEvent: TouchEvent) => {\n\t\tconst event = new FramerEvent(originalEvent, this.props.session)\n\t\tthis.props.session.pointerMove(event)\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tdomTouchEnd = (originalEvent: TouchEvent) => {\n\t\tsafeWindow.removeEventListener(\"touchmove\", this.domTouchMove)\n\t\tsafeWindow.removeEventListener(\"touchend\", this.domTouchEnd)\n\t\tconst event = new FramerEvent(originalEvent, this.props.session)\n\t\tthis.props.session.pointerUp(event)\n\t}\n}\n", "import { isTouch } from \"@framerjs/shared/src/environment.ts\"\nimport { MouseEventListener } from \"./recognizer/MouseEventListener.ts\"\nimport { TouchEventListener } from \"./recognizer/TouchEventListener.ts\"\n\n/** @internal */\nexport const FramerEventListener = /* @__PURE__ */ isTouch() ? TouchEventListener : MouseEventListener\n", "import React, { type ForwardRefExoticComponent, type RefAttributes } from \"react\"\nimport { ControlType } from \"../../render/types/PropertyControls.ts\"\nimport { addPropertyControls } from \"../../utils/addPropertyControls.ts\"\nimport { EmulatedScroll } from \"./EmulatedScroll.tsx\"\nimport { NativeScroll } from \"./NativeScroll.tsx\"\nimport type { EmulatedScrollProps, NativeScrollProps, ScrollProps } from \"./types.ts\"\n\n/**\n * @public\n * @deprecated Creating new Scroll components in Framer is no longer supported as of July 2025.\n * Existing Scroll components will continue to work, but please use alternative solutions for new\n * projects.\n */\nexport const Scroll = /* @__PURE__ */ ((): ForwardRefExoticComponent<\n\tOmit<EmulatedScrollProps | NativeScrollProps, \"ref\"> & RefAttributes<HTMLDivElement> // type produced by make update-editor-types is unstable if not explicit\n> => {\n\tconst ScrollInner = React.forwardRef<HTMLDivElement, ScrollProps>(function ScrollInner(props, forwardedRef) {\n\t\tif (props.native) {\n\t\t\treturn <NativeScroll ref={forwardedRef} {...props} />\n\t\t} else {\n\t\t\treturn <EmulatedScroll ref={forwardedRef} {...props} />\n\t\t}\n\t})\n\n\tScrollInner.defaultProps = {\n\t\tdirectionLock: false,\n\t}\n\n\taddPropertyControls(ScrollInner, {\n\t\tnative: {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tdefaultValue: false,\n\t\t},\n\t\tdirection: {\n\t\t\ttype: ControlType.SegmentedEnum,\n\t\t\ttitle: \"Direction\",\n\t\t\toptions: [\"vertical\", \"horizontal\", \"both\"],\n\t\t\tdefaultValue: \"vertical\",\n\t\t},\n\t\tcontentOffsetX: {\n\t\t\ttype: ControlType.Number,\n\t\t\ttitle: \"Offset X\",\n\t\t\tdefaultValue: 0,\n\t\t\tmin: 0,\n\t\t\tstep: 10,\n\t\t\tdisplayStepper: true,\n\t\t\thidden: ({ direction }) => direction === \"vertical\",\n\t\t},\n\t\tcontentOffsetY: {\n\t\t\ttype: ControlType.Number,\n\t\t\ttitle: \"Offset Y\",\n\t\t\tdefaultValue: 0,\n\t\t\tmin: 0,\n\t\t\tstep: 10,\n\t\t\tdisplayStepper: true,\n\t\t\thidden: ({ direction }) => direction === \"horizontal\",\n\t\t},\n\t\tdirectionLock: {\n\t\t\ttype: ControlType.Boolean,\n\t\t\ttitle: \"Lock\",\n\t\t\tenabledTitle: \"1 Axis\",\n\t\t\tdisabledTitle: \"Off\",\n\t\t\tdefaultValue: true,\n\t\t\thidden: ({ native }) => native === true,\n\t\t},\n\t\tdragEnabled: {\n\t\t\ttype: ControlType.Boolean,\n\t\t\ttitle: \"Drag\",\n\t\t\tenabledTitle: \"On\",\n\t\t\tdisabledTitle: \"Off\",\n\t\t\tdefaultValue: true,\n\t\t},\n\t\toverdragEnabled: {\n\t\t\ttype: ControlType.Boolean,\n\t\t\ttitle: \"Overdrag\",\n\t\t\tenabledTitle: \"On\",\n\t\t\tdisabledTitle: \"Off\",\n\t\t\tdefaultValue: true,\n\t\t\thidden: ({ native }) => native === true,\n\t\t},\n\t\twheelEnabled: {\n\t\t\ttype: ControlType.Boolean,\n\t\t\ttitle: \"Wheel\",\n\t\t\tenabledTitle: \"On\",\n\t\t\tdisabledTitle: \"Off\",\n\t\t\tdefaultValue: true,\n\t\t\thidden: ({ native }) => native === true,\n\t\t},\n\t\tscrollBarVisible: {\n\t\t\ttype: ControlType.Boolean,\n\t\t\ttitle: \"Scroll Bar\",\n\t\t\tenabledTitle: \"Visible\",\n\t\t\tdisabledTitle: \"Hidden\",\n\t\t\tdefaultValue: false,\n\t\t\thidden: ({ native }) => native === false,\n\t\t},\n\t\tresetOffset: {\n\t\t\ttype: ControlType.Boolean,\n\t\t\ttitle: \"Reset\",\n\t\t\tdefaultValue: false,\n\t\t},\n\t})\n\n\t// @ts-expect-error Property supportsConstraints does not exist on type\n\tScrollInner.supportsConstraints = true\n\n\treturn ScrollInner\n})()\n", "import type { BoundingBox, DraggableProps, MotionValue, PanInfo } from \"framer-motion\"\nimport { frame, useDragControls, useMotionValue } from \"framer-motion\"\nimport React, { useCallback, useMemo, useRef } from \"react\"\nimport { FrameWithMotion } from \"../../render/presentation/Frame/FrameWithMotion.tsx\"\nimport { RenderTarget } from \"../../render/types/RenderEnvironment.ts\"\nimport { withLibraryCSS } from \"../../render/utils/injectComponentCSSRules.ts\"\nimport { isFiniteNumber } from \"../../render/utils/isFiniteNumber.ts\"\nimport { isMotionValue } from \"../../render/utils/isMotionValue.ts\"\nimport { useLayoutId } from \"../../render/utils/useLayoutId.ts\"\nimport { useIsomorphicLayoutEffect } from \"../../useIsomorphicLayoutEffect.ts\"\nimport { EmptyState } from \"../EmptyState.tsx\"\nimport { useIsInCurrentNavigationTarget } from \"../NavigationContainerContext.tsx\"\nimport type { EmulatedScrollProps } from \"./types.ts\"\nimport { useWheelScroll } from \"./useWheelScroll.ts\"\n\nconst directionMap: { [key: string]: DraggableProps[\"drag\"] } = {\n\thorizontal: \"x\",\n\tvertical: \"y\",\n\tboth: true,\n}\n\nfunction convertScrollDirectionToDrag(scrollDirection?: \"horizontal\" | \"vertical\" | \"both\") {\n\treturn scrollDirection ? directionMap[scrollDirection] : scrollDirection\n}\n\nconst useUpdateChildSize = ({\n\tdragDirection,\n\tchildren,\n\tfromCanvasComponent,\n}: {\n\tdragDirection: \"both\" | \"horizontal\" | \"vertical\"\n\tchildren: React.ReactNode\n\tfromCanvasComponent?: boolean\n}): React.ReactNode | React.ReactNode[] => {\n\treturn useMemo((): React.ReactNode | React.ReactChild[] => {\n\t\treturn React.Children.map(children, (child: React.ReactChild) => {\n\t\t\tif (child === null || typeof child !== \"object\" || typeof child.type === \"string\") {\n\t\t\t\treturn child\n\t\t\t}\n\n\t\t\tconst updatedSize: Partial<{ width: number | string; height: number | string }> = {}\n\t\t\tswitch (dragDirection) {\n\t\t\t\tcase \"vertical\":\n\t\t\t\t\tupdatedSize.width = \"100%\"\n\t\t\t\t\tbreak\n\t\t\t\tcase \"horizontal\":\n\t\t\t\t\tupdatedSize.height = \"100%\"\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\treturn child\n\t\t\t}\n\n\t\t\tconst update = fromCanvasComponent ? { style: Object.assign({}, child.props.style, updatedSize) } : updatedSize\n\t\t\treturn React.cloneElement(child, update)\n\t\t})\n\t}, [dragDirection, children, fromCanvasComponent])\n}\n\nconst numberFromOptionalMotionValue = (value: number | MotionValue<number>): number => {\n\treturn typeof value === \"number\" ? value : value.get()\n}\n/**\n * @private\n * @deprecated Part of canvas page components.\n */\nconst EmulatedScrollInner = /* @__PURE__ */ React.forwardRef<HTMLDivElement, EmulatedScrollProps>(\n\tfunction EmulatedScroll(props, forwardedRef: React.RefObject<HTMLDivElement> | null) {\n\t\tconst {\n\t\t\tdirection = \"vertical\",\n\t\t\tdirectionLock = false,\n\t\t\tdragEnabled = true,\n\t\t\tdragElastic,\n\t\t\tdragMomentum,\n\t\t\tdragTransition,\n\t\t\twheelEnabled = true,\n\t\t\tcontentOffsetX = 0,\n\t\t\tcontentOffsetY = 0,\n\t\t\tcontentWidth,\n\t\t\tcontentHeight,\n\t\t\tonScrollStart,\n\t\t\tonScroll,\n\t\t\tonScrollEnd,\n\t\t\tonDragStart,\n\t\t\tonDrag,\n\t\t\tonDragEnd,\n\t\t\tonUpdate,\n\t\t\tonDirectionLock,\n\t\t\tstyle,\n\t\t\tchildren,\n\t\t\tscrollAnimate,\n\t\t\tresetOffset,\n\t\t\toverdragEnabled = true,\n\t\t\tlayoutId: specificLayoutId,\n\t\t\tnative: _native,\n\t\t\t...containerProps\n\t\t} = props\n\n\t\tconst layoutId = useLayoutId(props, { specificLayoutId, postfix: \"scroll\" })\n\t\tconst defaultX = useMotionValue(typeof contentOffsetX === \"number\" ? contentOffsetX : 0)\n\t\tconst defaultY = useMotionValue(typeof contentOffsetY === \"number\" ? contentOffsetY : 0)\n\t\tconst x = isMotionValue(contentOffsetX) ? contentOffsetX : defaultX\n\t\tconst y = isMotionValue(contentOffsetY) ? contentOffsetY : defaultY\n\t\tconst measuredConstraints = useRef<null | BoundingBox>(null)\n\t\tconst dragControls = useDragControls()\n\t\tconst isInTarget = useIsInCurrentNavigationTarget()\n\t\tconst wasInTargetRef = useRef(true)\n\n\t\tfunction setMeasureDragConstraints(constraints: BoundingBox) {\n\t\t\tconstraints = offsetToZero(constraints)\n\n\t\t\tif (contentWidth !== undefined) constraints.left = -contentWidth\n\t\t\tif (contentHeight !== undefined) constraints.top = -contentHeight\n\n\t\t\treturn (measuredConstraints.current = constraints)\n\t\t}\n\n\t\tconst { initial, prev } = useRef({\n\t\t\tinitial: { x: 0, y: 0 },\n\t\t\tprev: { x: 0, y: 0 },\n\t\t}).current\n\n\t\tconst isPreview = RenderTarget.current() === RenderTarget.preview\n\n\t\tconst containerFallbackRef = useRef<HTMLDivElement>(null)\n\t\tconst containerRef = forwardedRef || containerFallbackRef\n\n\t\tconst contentRef = useRef<HTMLDivElement>(null)\n\t\tconst lastOffsetRef = useRef<{\n\t\t\tmaxXOffset: number\n\t\t\tmaxYOffset: number\n\t\t\toffsetX: number\n\t\t\toffsetY: number\n\t\t\tx: number\n\t\t\ty: number\n\t\t} | null>(null)\n\n\t\tfunction shouldResetScroll(inTarget: boolean) {\n\t\t\tconst hasEnteredTarget = inTarget && wasInTargetRef.current === false\n\t\t\treturn resetOffset && hasEnteredTarget\n\t\t}\n\n\t\tfunction measureAndUpdateScrollOffset(): void {\n\t\t\tif (!contentRef.current || !containerRef.current) return\n\n\t\t\t// If the component is flagged to reset its scroll offset to its initial\n\t\t\t// values when it appears, check if the scroll was previously not\n\t\t\t// visible, and has become visible, and if so flag that we must reset\n\t\t\t// the scroll offset.\n\t\t\tconst mustReset = shouldResetScroll(isInTarget)\n\t\t\twasInTargetRef.current = isInTarget\n\n\t\t\t// If the offset properties are not set, we don't need to measure and\n\t\t\t// update scroll offset.\n\t\t\tconst previous = lastOffsetRef.current\n\t\t\tif (previous === null && contentOffsetX === undefined && contentOffsetY === undefined) return\n\n\t\t\t// Check if the values of the offset props have changed, requiring\n\t\t\t// scroll position to be updated. We only do this when the props are\n\t\t\t// numbers, because if they are motionValues, the offset has already\n\t\t\t// been changed by the motionValues themselves.\n\t\t\tconst shouldUpdateOffset =\n\t\t\t\tprevious === null ||\n\t\t\t\t(!isMotionValue(contentOffsetX) && contentOffsetX !== previous.offsetX) ||\n\t\t\t\t(!isMotionValue(contentOffsetY) && contentOffsetY !== previous.offsetY)\n\n\t\t\t// Check if the new maximum scroll offset has changed as a result of the\n\t\t\t// container or the scrollable content resizing.\n\t\t\tconst currentMaxXOffset = contentRef.current.offsetWidth - containerRef.current.offsetWidth\n\t\t\tconst currentMaxYOffset = contentRef.current.offsetHeight - containerRef.current.offsetHeight\n\t\t\tconst hasSizeChanged = currentMaxXOffset !== previous?.maxXOffset || currentMaxYOffset !== previous?.maxYOffset\n\n\t\t\t// Check if the actual scroll offset has changed via user interaction\n\t\t\t// relative to the last offset set via this function.\n\t\t\tconst hasScrollOffsetChanged = previous?.x !== x.get() || previous?.y !== y.get()\n\n\t\t\t// If the size has changed, but the user hasn't scrolled away from the\n\t\t\t// last set scroll offset, we expect the resize not to result in an\n\t\t\t// incorrect scroll position. For instance, the maximum scrollable size\n\t\t\t// could shrink, meaning that a scroll offset that was previously\n\t\t\t// acceptable now results in undesirable overscroll. In this case we\n\t\t\t// need to reset to an acceptable offset.\n\t\t\tconst shouldStayPinned = hasSizeChanged && !hasScrollOffsetChanged\n\n\t\t\tif (mustReset || shouldUpdateOffset || shouldStayPinned) {\n\t\t\t\tconst currentOffsetX = direction !== \"vertical\" ? numberFromOptionalMotionValue(contentOffsetX) : 0\n\t\t\t\tconst currentOffsetY = direction !== \"horizontal\" ? numberFromOptionalMotionValue(contentOffsetY) : 0\n\t\t\t\tconst nextXOffset = -Math.min(currentOffsetX, currentMaxXOffset)\n\t\t\t\tconst nextYOffset = -Math.min(currentOffsetY, currentMaxYOffset)\n\n\t\t\t\tx.set(nextXOffset)\n\t\t\t\ty.set(nextYOffset)\n\n\t\t\t\tlastOffsetRef.current = {\n\t\t\t\t\tmaxXOffset: currentMaxXOffset,\n\t\t\t\t\tmaxYOffset: currentMaxYOffset,\n\t\t\t\t\toffsetX: currentOffsetX,\n\t\t\t\t\toffsetY: currentOffsetY,\n\t\t\t\t\tx: nextXOffset,\n\t\t\t\t\ty: nextYOffset,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// onBeforeLayoutMeasure is not called on the canvas, so handle updating\n\t\t// scroll offset on the canvas on any update with a layout effect.\n\t\tuseIsomorphicLayoutEffect(() => {\n\t\t\tif (RenderTarget.current() !== RenderTarget.canvas) return\n\n\t\t\tmeasureAndUpdateScrollOffset()\n\t\t})\n\n\t\t// onBeforeLayoutMeasure is not called on mount, so handle updating scroll\n\t\t// on mount in the preview.\n\t\t// biome-ignore lint/correctness/useExhaustiveDependencies: deprecated component\n\t\tuseIsomorphicLayoutEffect(() => {\n\t\t\tif (RenderTarget.current() === RenderTarget.canvas) return\n\n\t\t\tmeasureAndUpdateScrollOffset()\n\t\t}, [])\n\n\t\t// isInTarget can change without motion calling measure on the element. To\n\t\t// solve that case, we run an effect when isInTarget changes, and call\n\t\t// measureAndUpdate if we need to reset. Since an effect runs after motion's\n\t\t// measurements phase, this will only run if we haven't already reset during\n\t\t// the render phase.\n\t\t// biome-ignore lint/correctness/useExhaustiveDependencies: deprecated component\n\t\tReact.useEffect(() => {\n\t\t\tif (shouldResetScroll(isInTarget)) measureAndUpdateScrollOffset()\n\n\t\t\t// Always unset isInTarget to false on a change.\n\t\t\t// measureAndUpdateScrollOffset may not be called when navigating off\n\t\t\t// screen.\n\t\t\tif (isInTarget === false) wasInTargetRef.current = false\n\t\t}, [isInTarget])\n\n\t\tconst getLatestPoint = () => ({ x: x.get(), y: y.get() })\n\n\t\t// biome-ignore lint/correctness/useExhaustiveDependencies: deprecated component\n\t\tconst resetInitialPoint = useCallback(() => {\n\t\t\tconst point = getLatestPoint()\n\t\t\tinitial.x = point.x\n\t\t\tinitial.y = point.y\n\t\t\tprev.x = point.x\n\t\t\tprev.y = point.y\n\t\t}, [])\n\n\t\t// biome-ignore lint/correctness/useExhaustiveDependencies: deprecated component\n\t\tconst getPointData = useCallback(() => {\n\t\t\tconst point = getLatestPoint()\n\n\t\t\tconst data = {\n\t\t\t\tpoint,\n\t\t\t\tvelocity: { x: x.getVelocity(), y: y.getVelocity() },\n\t\t\t\toffset: { x: point.x - initial.x, y: point.y - initial.y },\n\t\t\t\tdelta: { x: point.x - prev.x, y: point.y - prev.y },\n\t\t\t}\n\n\t\t\tprev.x = point.x\n\t\t\tprev.y = point.y\n\n\t\t\treturn data\n\t\t}, [x, y])\n\n\t\tconst updateScrollListeners = useCallback(() => {\n\t\t\tonUpdate && onUpdate({ x: x.get(), y: y.get() })\n\t\t\tonScroll && onScroll(getPointData())\n\t\t}, [onScroll, onUpdate, getPointData, x, y])\n\n\t\tconst scheduleUpdateScrollListeners = useCallback(() => {\n\t\t\tframe.update(updateScrollListeners, false, true)\n\t\t}, [updateScrollListeners])\n\n\t\tconst onMotionDragStart = (event: MouseEvent | TouchEvent, info: PanInfo) => {\n\t\t\tresetInitialPoint()\n\t\t\tonDragStart && onDragStart(event, info)\n\t\t\tonScrollStart && onScrollStart(info)\n\t\t}\n\n\t\tconst onMotionDragTransitionEnd = () => onScrollEnd && onScrollEnd(getPointData())\n\t\tconst onWheelScrollStart = (info: PanInfo) => {\n\t\t\tonScrollStart?.(info)\n\t\t}\n\n\t\tuseWheelScroll(containerRef, {\n\t\t\tenabled: wheelEnabled,\n\t\t\tinitial,\n\t\t\tprev,\n\t\t\tdirection,\n\t\t\toffsetX: x,\n\t\t\toffsetY: y,\n\t\t\tonScrollStart: onWheelScrollStart,\n\t\t\tonScroll,\n\t\t\tonScrollEnd,\n\t\t\tconstraints: measuredConstraints,\n\t\t})\n\n\t\tconst overdragX = useMotionValue(0)\n\t\tconst overdragY = useMotionValue(0)\n\n\t\t// biome-ignore lint/correctness/useExhaustiveDependencies: deprecated component\n\t\tuseIsomorphicLayoutEffect(() => {\n\t\t\tconst setScrollX = (xValue: number) => {\n\t\t\t\tconst element = containerRef.current\n\t\t\t\tif (!(element instanceof HTMLDivElement)) return\n\t\t\t\telement.scrollLeft = -xValue\n\n\t\t\t\tconst constraints = measuredConstraints.current\n\t\t\t\tif (constraints && overdragEnabled) {\n\t\t\t\t\tlet overdragXValue = 0\n\t\t\t\t\tif (xValue > constraints.right) overdragXValue = xValue\n\t\t\t\t\tif (xValue < constraints.left) overdragXValue = xValue - constraints.left\n\t\t\t\t\toverdragX.set(overdragXValue)\n\t\t\t\t}\n\n\t\t\t\tscheduleUpdateScrollListeners()\n\t\t\t}\n\n\t\t\tconst currentX = x.get()\n\t\t\tif (currentX !== 0) setScrollX(currentX)\n\n\t\t\treturn x.on(\"change\", setScrollX)\n\t\t}, [x, overdragX, scheduleUpdateScrollListeners, overdragEnabled])\n\n\t\t// biome-ignore lint/correctness/useExhaustiveDependencies: deprecated component\n\t\tuseIsomorphicLayoutEffect(() => {\n\t\t\tconst setScrollY = (yValue: number) => {\n\t\t\t\tconst element = containerRef.current\n\t\t\t\tif (!(element instanceof HTMLDivElement)) return\n\n\t\t\t\telement.scrollTop = -yValue\n\n\t\t\t\tconst constraints = measuredConstraints.current\n\n\t\t\t\tif (constraints && overdragEnabled) {\n\t\t\t\t\tlet overdragYValue = 0\n\n\t\t\t\t\tif (yValue > constraints.bottom) overdragYValue = yValue\n\t\t\t\t\tif (yValue < constraints.top) overdragYValue = yValue - constraints.top\n\t\t\t\t\toverdragY.set(overdragYValue)\n\t\t\t\t}\n\n\t\t\t\tscheduleUpdateScrollListeners()\n\t\t\t}\n\n\t\t\tconst currentY = y.get()\n\t\t\tif (currentY !== 0) setScrollY(currentY)\n\n\t\t\treturn y.on(\"change\", setScrollY)\n\t\t}, [y, overdragY, scheduleUpdateScrollListeners, overdragEnabled])\n\n\t\t// biome-ignore lint/correctness/useExhaustiveDependencies: deprecated component\n\t\tconst nativeOnScroll = React.useCallback(() => {\n\t\t\tconst element = containerRef.current\n\t\t\tif (!(element instanceof HTMLDivElement)) return\n\t\t\t// we ignore native scroll changes when we are dragging or finishing a drag animation\n\t\t\tconst xDelta = Math.abs(x.get() + element.scrollLeft)\n\t\t\tconst yDelta = Math.abs(y.get() + element.scrollTop)\n\t\t\tif (xDelta > 1) x.set(-element.scrollLeft)\n\t\t\tif (yDelta > 1) y.set(-element.scrollTop)\n\t\t}, [x, y])\n\n\t\tconst isEmpty = React.Children.count(children) === 0\n\t\tconst width = direction !== \"vertical\" && !isEmpty ? \"auto\" : \"100%\"\n\t\tconst height = direction !== \"horizontal\" && !isEmpty ? \"auto\" : \"100%\"\n\t\tconst size = !containerProps.__fromCanvasComponent\n\t\t\t? {\n\t\t\t\t\twidth: containerProps.__fromCodeComponentNode ? \"100%\" : containerProps.width,\n\t\t\t\t\theight: containerProps.__fromCodeComponentNode ? \"100%\" : containerProps.height,\n\t\t\t\t}\n\t\t\t: {}\n\n\t\treturn (\n\t\t\t<FrameWithMotion\n\t\t\t\tdata-framer-component-type=\"Scroll\"\n\t\t\t\tbackground=\"none\" // need to set here to prevent default background from Frame\n\t\t\t\t{...containerProps}\n\t\t\t\t{...size}\n\t\t\t\tstyle={{\n\t\t\t\t\t...style,\n\t\t\t\t\twillChange: isPreview ? \"transform\" : undefined, // allows the scroll content to be hardware accelerated\n\t\t\t\t\toverflow: \"hidden\",\n\t\t\t\t}}\n\t\t\t\tonScroll={nativeOnScroll}\n\t\t\t\tpreserve3d={containerProps.preserve3d}\n\t\t\t\tref={containerRef}\n\t\t\t\tlayoutId={layoutId}\n\t\t\t\tlayoutScroll\n\t\t\t\tonBeforeLayoutMeasure={measureAndUpdateScrollOffset}\n\t\t\t>\n\t\t\t\t<FrameWithMotion\n\t\t\t\t\tdata-framer-component-type=\"ScrollContentWrapper\"\n\t\t\t\t\tanimate={scrollAnimate}\n\t\t\t\t\tdrag={dragEnabled && convertScrollDirectionToDrag(direction)}\n\t\t\t\t\tdragDirectionLock={directionLock}\n\t\t\t\t\tdragElastic={dragElastic}\n\t\t\t\t\tdragMomentum={dragMomentum}\n\t\t\t\t\tdragTransition={dragTransition}\n\t\t\t\t\tdragConstraints={containerRef}\n\t\t\t\t\tdragControls={dragControls}\n\t\t\t\t\tonDragStart={onMotionDragStart}\n\t\t\t\t\tonDrag={onDrag}\n\t\t\t\t\tonDragEnd={onDragEnd}\n\t\t\t\t\tonDragTransitionEnd={onMotionDragTransitionEnd}\n\t\t\t\t\tonDirectionLock={onDirectionLock}\n\t\t\t\t\tonMeasureDragConstraints={setMeasureDragConstraints}\n\t\t\t\t\twidth={width}\n\t\t\t\t\theight={height}\n\t\t\t\t\t_dragX={x}\n\t\t\t\t\t_dragY={y}\n\t\t\t\t\tposition=\"relative\"\n\t\t\t\t\tx={overdragEnabled ? overdragX : undefined}\n\t\t\t\t\ty={overdragEnabled ? overdragY : undefined}\n\t\t\t\t\tref={contentRef}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tdisplay: isEmpty ? \"block\" : \"inline-block\",\n\t\t\t\t\t\twillChange: isPreview ? \"transform\" : undefined, // makes the scroll content hardware accelerated\n\t\t\t\t\t\tbackgroundColor: \"transparent\",\n\t\t\t\t\t\toverflow: \"visible\",\n\t\t\t\t\t\tminWidth: \"100%\",\n\t\t\t\t\t\tminHeight: \"100%\",\n\t\t\t\t\t}}\n\t\t\t\t\tpreserve3d={containerProps.preserve3d}\n\t\t\t\t>\n\t\t\t\t\t<EmptyState\n\t\t\t\t\t\tsize={{\n\t\t\t\t\t\t\twidth: isFiniteNumber(containerProps.width) ? containerProps.width : \"100%\",\n\t\t\t\t\t\t\theight: isFiniteNumber(containerProps.height) ? containerProps.height : \"100%\",\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tinsideUserCodeComponent={!containerProps.__fromCodeComponentNode}\n\t\t\t\t\t\ttitle=\"Scroll\"\n\t\t\t\t\t\tdescription=\"Click and drag the connector to any frame on the canvas \u2192\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</EmptyState>\n\t\t\t\t\t{useUpdateChildSize({\n\t\t\t\t\t\tdragDirection: direction,\n\t\t\t\t\t\tchildren,\n\t\t\t\t\t\tfromCanvasComponent: containerProps.__fromCanvasComponent,\n\t\t\t\t\t})}\n\t\t\t\t</FrameWithMotion>\n\t\t\t</FrameWithMotion>\n\t\t)\n\t},\n)\n\nexport const EmulatedScroll = /* @__PURE__ */ withLibraryCSS(EmulatedScrollInner)\n\n/**\n * Because we're overriding the usual drag x/y with scrollTop and scrollLeft\n * our constraints calculations need rebasing to 0\n */\nfunction offsetToZero({ top, left, right, bottom }: BoundingBox) {\n\tconst width = right - left\n\tconst height = bottom - top\n\n\treturn {\n\t\ttop: -height,\n\t\tleft: -width,\n\t\tright: 0,\n\t\tbottom: 0,\n\t}\n}\n", "import React from \"react\"\nimport { cx } from \"../../modules/cx.ts\"\nimport { FrameWithMotion } from \"../../render/presentation/Frame/FrameWithMotion.tsx\"\nimport { withLibraryCSS } from \"../../render/utils/injectComponentCSSRules.ts\"\nimport { isFiniteNumber } from \"../../render/utils/isFiniteNumber.ts\"\nimport { isMotionValue } from \"../../render/utils/isMotionValue.ts\"\nimport { useLayoutId } from \"../../render/utils/useLayoutId.ts\"\nimport { useIsomorphicLayoutEffect } from \"../../useIsomorphicLayoutEffect.ts\"\nimport { EmptyState } from \"../EmptyState.tsx\"\nimport { useIsInCurrentNavigationTarget } from \"../NavigationContainerContext.tsx\"\nimport { useEmulateTouchScroll } from \"../utils/useEmulatedTouchScroll.ts\"\nimport { useUpdateScrollOffset } from \"../utils/useUpdateScrollOffset.ts\"\nimport type { NativeScrollProps } from \"./types.ts\"\n\n/**\n * @private\n */\nconst NativeScrollInner = /* @__PURE__ */ React.forwardRef<HTMLDivElement, NativeScrollProps>(function NativeScroll(\n\tprops,\n\tforwardedRef: React.RefObject<HTMLDivElement> | null,\n) {\n\tconst {\n\t\tdirection = \"vertical\",\n\t\tscrollBarVisible = false,\n\t\tdragEnabled = true,\n\t\tcontentOffsetX = 0,\n\t\tcontentOffsetY = 0,\n\t\tcontentWidth: _contentWidth,\n\t\tcontentHeight: _contentHeight,\n\t\tchildren,\n\t\tresetOffset,\n\t\tonScroll,\n\t\tclassName,\n\t\t// Not (yet) supported\n\t\tdirectionLock: _directionLock = false,\n\t\twheelEnabled: _wheelEnabled = true,\n\t\tscrollAnimate: _scrollAnimate,\n\t\tdragTransition: _dragTransition,\n\t\tdragMomentum: _dragMomentum,\n\t\tdragElastic: _dragElastic,\n\t\toverdragEnabled: _overdragEnabled = true,\n\t\tonScrollStart: _onScrollStart,\n\t\tonScrollEnd: _onScrollEnd,\n\t\tonDragStart: _onDragStart,\n\t\tonDrag: _onDrag,\n\t\tonDragEnd: _onDragEnd,\n\t\tonUpdate: _onUpdate,\n\t\tonDirectionLock: _onDirectionLock,\n\t\tlayoutId: specificLayoutId,\n\t\tnative: _native,\n\t\t// Rest\n\t\t...containerProps\n\t} = props\n\n\tconst layoutId = useLayoutId(props, { specificLayoutId, postfix: \"scroll\" })\n\n\tconst fallbackRef = React.useRef<HTMLDivElement>(null)\n\tconst ref = forwardedRef || fallbackRef\n\n\tconst { cancelEmulatedTouchScrollAnimation } = useEmulateTouchScroll(ref, direction, dragEnabled)\n\n\tconst isInTarget = useIsInCurrentNavigationTarget()\n\tconst previousIsInTargetRef = React.useRef(isInTarget)\n\n\tconst updateScrollOffsetHandler = () => {\n\t\tif (!resetOffset) return\n\t\tconst previousIsTarget = previousIsInTargetRef.current\n\t\tpreviousIsInTargetRef.current = isInTarget\n\t\tconst shouldResetOffset = isInTarget && !previousIsTarget\n\t\tif (!shouldResetOffset) return\n\t\tconst element = ref.current\n\t\tif (!element) return\n\t\tif (direction !== \"vertical\") {\n\t\t\tcancelEmulatedTouchScrollAnimation?.()\n\t\t\telement.scrollLeft = Math.abs(isMotionValue(contentOffsetX) ? contentOffsetX.get() : contentOffsetX)\n\t\t}\n\t\tif (direction !== \"horizontal\") {\n\t\t\tcancelEmulatedTouchScrollAnimation?.()\n\t\t\telement.scrollTop = Math.abs(isMotionValue(contentOffsetY) ? contentOffsetY.get() : contentOffsetY)\n\t\t}\n\t}\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: We only want to update the scroll offset when isInTarget changes\n\tuseIsomorphicLayoutEffect(updateScrollOffsetHandler, [isInTarget])\n\n\tuseUpdateScrollOffset(ref, \"scrollLeft\", contentOffsetX, cancelEmulatedTouchScrollAnimation)\n\tuseUpdateScrollOffset(ref, \"scrollTop\", contentOffsetY, cancelEmulatedTouchScrollAnimation)\n\n\tconst size = !containerProps.__fromCanvasComponent\n\t\t? {\n\t\t\t\twidth: containerProps.__fromCodeComponentNode ? \"100%\" : containerProps.width,\n\t\t\t\theight: containerProps.__fromCodeComponentNode ? \"100%\" : containerProps.height,\n\t\t\t}\n\t\t: {}\n\n\treturn (\n\t\t<FrameWithMotion\n\t\t\tref={ref}\n\t\t\tdata-framer-component-type=\"NativeScroll\"\n\t\t\tbackground=\"none\" // need to set here to prevent default background from Frame\n\t\t\t{...containerProps}\n\t\t\t{...size}\n\t\t\tonScroll={onScroll}\n\t\t\tlayoutId={layoutId}\n\t\t\tonBeforeLayoutMeasure={updateScrollOffsetHandler}\n\t\t\tlayoutScroll\n\t\t\tclassName={cx(className, `direction-${direction}`, !scrollBarVisible && \"scrollbar-hidden\")}\n\t\t>\n\t\t\t<EmptyState\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: probably old component\n\t\t\t\t// biome-ignore lint/correctness/noChildrenProp: probably old component\n\t\t\t\tchildren={children}\n\t\t\t\tsize={{\n\t\t\t\t\twidth: isFiniteNumber(containerProps.width) ? containerProps.width : \"100%\",\n\t\t\t\t\theight: isFiniteNumber(containerProps.height) ? containerProps.height : \"100%\",\n\t\t\t\t}}\n\t\t\t\tinsideUserCodeComponent={!containerProps.__fromCodeComponentNode}\n\t\t\t\ttitle=\"Scroll\"\n\t\t\t\tdescription=\"Click and drag the connector to any frame on the canvas \u2192\"\n\t\t\t/>\n\t\t\t{children}\n\t\t</FrameWithMotion>\n\t)\n})\n\nexport const NativeScroll = /* @__PURE__ */ withLibraryCSS(NativeScrollInner)\n", "type ClassName = string | false | void | null | 0\n/**\n * Combine values and create a className string. Falsy values are not included.\n *\n * This helper is commonly exported by css-in-js libraries like Linaria, or\n * Emotion as cx. This is the implementation from Linaria:\n * https://github.com/callstack/linaria/blob/master/packages/core/src/cx.ts.\n *\n * We need it here so we can use it in es-modules.\n *\n * @public\n */\nexport function cx(...classNames: ClassName[]): string {\n\treturn classNames.filter(Boolean).join(\" \")\n}\n", "// We disable the rule of hooks because we early return when not in the preview\n// or on a touch device. This early return will be constistent per environment.\n/* eslint-disable react-hooks/rules-of-hooks */\n\nimport { isCommandKeyPressed, isSafari, isTouch } from \"@framerjs/shared/src/environment.ts\"\nimport React, { useEffect } from \"react\"\nimport { Point } from \"../../render/types/Point.ts\"\nimport { RenderTarget } from \"../../render/types/RenderEnvironment.ts\"\nimport { safeWindow } from \"../../utils/safeWindow.ts\"\nimport { animatePointWithInertia } from \"./animatePointWithInertia.ts\"\n\nconst scrollThreshold = 3\n\nconst isTouchDevice = /* @__PURE__ */ isTouch()\nconst isSafariBrowser = /* @__PURE__ */ isSafari()\n\ntype Direction = \"horizontal\" | \"vertical\" | \"both\"\n\nfunction getTouchAction(element: Element): string | null {\n\tif (!(element instanceof HTMLElement)) return null\n\treturn element.style.touchAction\n}\n\nfunction canPanInDirection(element: Element, direction: Direction) {\n\tswitch (direction) {\n\t\tcase \"horizontal\":\n\t\t\treturn getTouchAction(element) === \"pan-x\"\n\t\tcase \"vertical\":\n\t\t\treturn getTouchAction(element) === \"pan-y\"\n\t\tdefault:\n\t\t\treturn false\n\t}\n}\n\nfunction isInteractiveElement(element: Element): boolean {\n\tconst tag = element.tagName.toLowerCase()\n\tif (tag === \"input\") return true\n\tif (tag === \"text\") return true\n\tif (tag === \"textarea\") return true\n\treturn false\n}\n\nfunction canStartScrollFromElement(element: EventTarget | null, direction: Direction): boolean {\n\tif (!(element instanceof Element)) return false\n\tif (isInteractiveElement(element)) return false\n\n\tif (element.hasAttribute(\"draggable\")) {\n\t\tif (!canPanInDirection(element, direction)) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}\n\nfunction getEventPoint(event: MouseEvent) {\n\treturn {\n\t\tx: event.pageX,\n\t\ty: event.pageY,\n\t}\n}\n\nfunction setPointerEvents(element: HTMLElement | SVGElement, value: string) {\n\tif (element?.style) {\n\t\telement.style[\"pointerEvents\"] = value\n\t}\n}\n\nfunction getPointerEvents(element: HTMLElement | SVGElement) {\n\treturn element?.style?.[\"pointerEvents\"]\n}\n\nenum TouchScrollPhase {\n\tIdle,\n\tTouchDown,\n\tDrag,\n\tDragLocked, // Can't be dragged because of direction lock\n\tDragAnimation,\n\tInterrupted, // Touch down while a drag animation was running\n}\n\ntype PointerEventValue = string\n\nconst emptyObject = /* @__PURE__ */ Object.freeze({})\n\nexport function useEmulateTouchScroll(\n\tref: React.RefObject<HTMLDivElement>,\n\tdirection: Direction,\n\tenabled: boolean,\n): { cancelEmulatedTouchScrollAnimation?: () => void } {\n\tif (isTouchDevice) return emptyObject\n\tif (RenderTarget.current() !== RenderTarget.preview) return emptyObject\n\n\t// biome-ignore lint/correctness/useHookAtTopLevel: the return condition will never change\n\tconst scrollAnimationControlsRef = React.useRef<{ stop: () => void } | null>(null)\n\n\t// biome-ignore lint/correctness/useHookAtTopLevel: the return condition will never change\n\tuseEffect(() => {\n\t\tif (!ref.current) return\n\t\tconst element = ref.current\n\n\t\tlet phase = TouchScrollPhase.Idle\n\n\t\tlet targets: [HTMLElement | SVGElement, PointerEventValue][] | null = null\n\t\tlet downPoint: null | Point = null\n\t\tlet scrollOffsetStart: Point | null = null\n\n\t\tlet mouseMoveEvents: MouseEvent[] = []\n\n\t\tfunction onMouseMove(event: MouseEvent) {\n\t\t\tswitch (phase) {\n\t\t\t\tcase TouchScrollPhase.Idle:\n\t\t\t\tcase TouchScrollPhase.DragAnimation:\n\t\t\t\tcase TouchScrollPhase.DragLocked:\n\t\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// If command is pressed we fallback to normal behavior\n\t\t\tif (isCommandKeyPressed(event)) return\n\n\t\t\tconst point = getEventPoint(event)\n\t\t\tif (!downPoint) return\n\n\t\t\t// Calculate the offset so we can use it in the callback\n\t\t\tconst offset = Point.subtract(point, downPoint)\n\n\t\t\t// If we didn't scroll before and reached the threshold\n\t\t\tif (phase === TouchScrollPhase.TouchDown || phase === TouchScrollPhase.Interrupted) {\n\t\t\t\tconst deltaX = Math.abs(offset.x)\n\t\t\t\tconst deltaY = Math.abs(offset.y)\n\t\t\t\tif ((deltaX > scrollThreshold || deltaY > scrollThreshold) && deltaX !== deltaY) {\n\t\t\t\t\tconst scrollDirection = deltaX > deltaY ? \"horizontal\" : \"vertical\"\n\t\t\t\t\tconst shouldIgnoreBecauseOfDirectionLock =\n\t\t\t\t\t\t(direction === \"horizontal\" && scrollDirection === \"vertical\") ||\n\t\t\t\t\t\t(direction === \"vertical\" && scrollDirection === \"horizontal\")\n\t\t\t\t\tif (shouldIgnoreBecauseOfDirectionLock) {\n\t\t\t\t\t\tphase = TouchScrollPhase.DragLocked\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tphase = TouchScrollPhase.Drag\n\n\t\t\t\t\t// We disable events on the clicked target so we avoid clicks if you mean to scroll\n\t\t\t\t\ttargets?.forEach(([target]) => setPointerEvents(target, \"none\"))\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// We need this in Safari to avoid scroll from text selection near borders\n\t\t\t// Unfortunately we'll have to do this for all events and this could break\n\t\t\t// in subtle ways.\n\t\t\tif (isSafariBrowser) event.preventDefault()\n\n\t\t\t// Don't do anything if we didn't reach the threshold\n\t\t\tif (phase !== TouchScrollPhase.Drag) return\n\n\t\t\t// Don't start selecting text too\n\t\t\tsafeWindow.getSelection()?.empty()\n\n\t\t\tmouseMoveEvents = getRecentEvents([...mouseMoveEvents, event])\n\n\t\t\t// Update offset\n\t\t\tif (scrollOffsetStart) {\n\t\t\t\tif (direction !== \"vertical\") element.scrollLeft = scrollOffsetStart.x - offset.x\n\t\t\t\tif (direction !== \"horizontal\") element.scrollTop = scrollOffsetStart.y - offset.y\n\t\t\t}\n\t\t}\n\n\t\tfunction onMouseUp(event: MouseEvent) {\n\t\t\tsafeWindow.removeEventListener(\"mousemove\", onMouseMove, false)\n\t\t\tsafeWindow.removeEventListener(\"mouseup\", onMouseUp)\n\t\t\t// Make sure to restore events back on the element if we removed them\n\t\t\tif (phase === TouchScrollPhase.Drag && targets) {\n\t\t\t\ttargets.forEach(([target, originalPointerEventsValue]) =>\n\t\t\t\t\tsetPointerEvents(target, originalPointerEventsValue || \"auto\"),\n\t\t\t\t)\n\t\t\t}\n\t\t\ttargets = null\n\n\t\t\tconst velocity = calculateVelocity({ mouseMoveEvents, mouseUpEvent: event })\n\n\t\t\tdownPoint = null\n\n\t\t\tif (phase === TouchScrollPhase.Drag) {\n\t\t\t\t// Scroll\n\t\t\t\t// Unlike page snapping we only have to animate the scroll if we started a drag\n\t\t\t\tconst shouldAnimateY = direction !== \"horizontal\" && velocity.y !== 0\n\t\t\t\tconst shouldAnimateX = direction !== \"vertical\" && velocity.x !== 0\n\t\t\t\tif (!shouldAnimateY && !shouldAnimateX) {\n\t\t\t\t\tphase = TouchScrollPhase.Idle\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tphase = TouchScrollPhase.DragAnimation\n\n\t\t\t\tscrollAnimationControlsRef.current = animatePointWithInertia({\n\t\t\t\t\tfrom: { x: element.scrollLeft, y: element.scrollTop },\n\t\t\t\t\tvelocity: {\n\t\t\t\t\t\tx: shouldAnimateX ? velocity.x : 0,\n\t\t\t\t\t\ty: shouldAnimateY ? velocity.y : 0,\n\t\t\t\t\t},\n\t\t\t\t\tonUpdate: position => {\n\t\t\t\t\t\tif (shouldAnimateX) element.scrollLeft = position.x\n\t\t\t\t\t\tif (shouldAnimateY) element.scrollTop = position.y\n\t\t\t\t\t},\n\t\t\t\t\tonStop: () => {\n\t\t\t\t\t\tif (phase !== TouchScrollPhase.Interrupted) {\n\t\t\t\t\t\t\tphase = TouchScrollPhase.Idle\n\t\t\t\t\t\t}\n\t\t\t\t\t\tscrollAnimationControlsRef.current = null\n\t\t\t\t\t},\n\t\t\t\t\tonComplete: () => {\n\t\t\t\t\t\tif (phase !== TouchScrollPhase.DragAnimation) {\n\t\t\t\t\t\t\tthrow Error(\"On animation completion we should still be in the animation phase\")\n\t\t\t\t\t\t}\n\t\t\t\t\t\tphase = TouchScrollPhase.Idle\n\t\t\t\t\t\tscrollAnimationControlsRef.current = null\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tphase = TouchScrollPhase.Idle\n\t\t\t}\n\t\t}\n\n\t\tfunction onMouseWheel() {\n\t\t\t// Stop any running animations when using mouse wheel or trackpad\n\t\t\tscrollAnimationControlsRef.current?.stop()\n\t\t}\n\n\t\tfunction onMouseDown(event: PointerEvent) {\n\t\t\tif (!enabled) return\n\n\t\t\t// If command or control was entered we fallback to normal behavior\n\t\t\tif (isCommandKeyPressed(event)) return\n\n\t\t\tif (!canStartScrollFromElement(event.target, direction)) {\n\t\t\t\t// Stop any running scroll animation\n\t\t\t\tif (phase === TouchScrollPhase.DragAnimation) {\n\t\t\t\t\tphase = TouchScrollPhase.Idle\n\t\t\t\t\tscrollAnimationControlsRef.current?.stop()\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst previousPhase = phase\n\t\t\tphase =\n\t\t\t\tpreviousPhase === TouchScrollPhase.DragAnimation ? TouchScrollPhase.Interrupted : TouchScrollPhase.TouchDown\n\n\t\t\tdownPoint = getEventPoint(event)\n\t\t\ttargets = document\n\t\t\t\t.elementsFromPoint(downPoint.x, downPoint.y)\n\t\t\t\t.filter(\n\t\t\t\t\t(targetEl): targetEl is HTMLElement | SVGElement =>\n\t\t\t\t\t\ttargetEl instanceof HTMLElement || targetEl instanceof SVGElement,\n\t\t\t\t)\n\t\t\t\t.map(targetEl => [targetEl, getPointerEvents(targetEl)])\n\t\t\tscrollOffsetStart = { x: element.scrollLeft, y: element.scrollTop }\n\t\t\tmouseMoveEvents = []\n\n\t\t\tif (scrollAnimationControlsRef.current) {\n\t\t\t\tif (previousPhase !== TouchScrollPhase.DragAnimation) {\n\t\t\t\t\tthrow Error(\"When stopping a drag animation we need to be animating\")\n\t\t\t\t}\n\t\t\t\tscrollAnimationControlsRef.current.stop()\n\t\t\t}\n\n\t\t\tsafeWindow.addEventListener(\"mousemove\", onMouseMove)\n\t\t\tsafeWindow.addEventListener(\"mouseup\", onMouseUp)\n\t\t\telement.addEventListener(\"mousewheel\", onMouseWheel)\n\t\t}\n\n\t\t// Set up a the base handler on the scrollable element\n\t\telement.addEventListener(\"mousedown\", onMouseDown)\n\n\t\treturn () => {\n\t\t\t// Clean up all event handlers on unmount\n\t\t\telement.removeEventListener(\"mousedown\", onMouseDown)\n\t\t\telement.removeEventListener(\"mousewheel\", onMouseWheel)\n\t\t\tsafeWindow.removeEventListener(\"mousemove\", onMouseMove)\n\t\t\tsafeWindow.removeEventListener(\"mouseup\", onMouseUp)\n\n\t\t\t// Stop any running scroll animations\n\t\t\tphase = TouchScrollPhase.Interrupted\n\t\t\tscrollAnimationControlsRef.current?.stop()\n\t\t}\n\t}, [ref, direction, enabled])\n\n\t// biome-ignore lint/correctness/useHookAtTopLevel: the return condition will never change\n\treturn React.useMemo(() => {\n\t\treturn {\n\t\t\tcancelEmulatedTouchScrollAnimation: () => {\n\t\t\t\tscrollAnimationControlsRef.current?.stop()\n\t\t\t},\n\t\t}\n\t}, [])\n}\n\n// Keep events that are younger than 4 / 60 s\nconst timeDelta = /* @__PURE__ */ (() => (4 / 60) * 1000)()\n\nfunction getRecentEvents(events: MouseEvent[]) {\n\t// There is no API to get the time origin of event timestamps, as a workaround\n\t// we create a custom event and read the timestamp\n\tconst currentTime = new CustomEvent(\"getTime\").timeStamp\n\tconst maxAge = currentTime - timeDelta\n\treturn events.filter(event => event.timeStamp > maxAge)\n}\n\nconst zeroPoint: Point = { x: 0, y: 0 }\n\nexport function calculateVelocity({\n\tmouseMoveEvents,\n\tmouseUpEvent,\n}: {\n\tmouseMoveEvents: MouseEvent[]\n\tmouseUpEvent: MouseEvent\n}): Point {\n\tconst recentMouseMoveEvents = getRecentEvents(mouseMoveEvents)\n\tconst oldestMouseMoveEvent = recentMouseMoveEvents[0]\n\tif (!oldestMouseMoveEvent) return zeroPoint\n\n\tconst deltaX = mouseUpEvent.clientX - oldestMouseMoveEvent.clientX\n\tconst deltaY = mouseUpEvent.clientY - oldestMouseMoveEvent.clientY\n\tconst time = mouseUpEvent.timeStamp - oldestMouseMoveEvent.timeStamp\n\n\tif (time === 0) return zeroPoint\n\n\treturn {\n\t\tx: (deltaX / time) * 1000,\n\t\ty: (deltaY / time) * 1000,\n\t}\n}\n", "import { animateValue, frame } from \"framer-motion\"\nimport type { Point } from \"../../render/types/Point.ts\"\n\nenum AnimationPhase {\n\tNone,\n\tRunning,\n\tCompleted,\n\tCancelled,\n}\n\nfunction isRunningAnimation(...phases: AnimationPhase[]): boolean {\n\tlet runningAny = false\n\tlet cancelledAny = false\n\tphases.forEach(phase => {\n\t\trunningAny = runningAny || phase === AnimationPhase.Running\n\t\tcancelledAny = cancelledAny || phase === AnimationPhase.Cancelled\n\t})\n\n\treturn runningAny && !cancelledAny\n}\n\nfunction didFinishAnimations(...phases: AnimationPhase[]): boolean {\n\treturn phases.every(phase => phase === AnimationPhase.None || phase === AnimationPhase.Completed)\n}\n\nconst timeConstant = 400\n\nexport function animatePointWithInertia({\n\tfrom,\n\tvelocity,\n\tonUpdate,\n\tonComplete,\n\tonStop,\n}: {\n\tfrom: Point\n\tvelocity: Point\n\tonUpdate: (value: Point) => void\n\tonComplete: () => void\n\tonStop: () => void\n}): { stop: () => void } {\n\tconst latest = from\n\tlet animationPhaseX = AnimationPhase.None\n\tlet animationPhaseY = AnimationPhase.None\n\tconst animations: { stop: () => void }[] = []\n\n\tconst updateHandler = () => {\n\t\tif (isRunningAnimation(animationPhaseX, animationPhaseY)) {\n\t\t\tonUpdate(latest)\n\t\t}\n\t}\n\n\tconst completionHandler = () => {\n\t\tif (didFinishAnimations(animationPhaseX, animationPhaseY)) {\n\t\t\tonComplete()\n\t\t}\n\t}\n\n\tif (velocity.x) {\n\t\tanimationPhaseX = AnimationPhase.Running\n\t\tanimations.push(\n\t\t\tanimateValue({\n\t\t\t\tkeyframes: [from.x],\n\t\t\t\tvelocity: -velocity.x,\n\t\t\t\ttimeConstant,\n\t\t\t\tonUpdate: value => {\n\t\t\t\t\tlatest.x = value\n\t\t\t\t\tframe.update(updateHandler, false, true)\n\t\t\t\t},\n\t\t\t\tonComplete: () => {\n\t\t\t\t\tif (animationPhaseX !== AnimationPhase.Running) {\n\t\t\t\t\t\tthrow Error(\"animation x should be running when completing\")\n\t\t\t\t\t}\n\t\t\t\t\tanimationPhaseX = AnimationPhase.Completed\n\t\t\t\t\tcompletionHandler()\n\t\t\t\t},\n\t\t\t}),\n\t\t)\n\t}\n\n\tif (velocity.y) {\n\t\tanimationPhaseY = AnimationPhase.Running\n\t\tanimations.push(\n\t\t\tanimateValue({\n\t\t\t\tkeyframes: [from.y],\n\t\t\t\tvelocity: -velocity.y,\n\t\t\t\ttimeConstant,\n\t\t\t\tonUpdate: value => {\n\t\t\t\t\tlatest.y = value\n\t\t\t\t\tframe.update(updateHandler, false, true)\n\t\t\t\t},\n\t\t\t\tonComplete: () => {\n\t\t\t\t\tif (animationPhaseY !== AnimationPhase.Running) {\n\t\t\t\t\t\tthrow Error(\"animation y should be running when completing\")\n\t\t\t\t\t}\n\t\t\t\t\tanimationPhaseY = AnimationPhase.Completed\n\t\t\t\t\tcompletionHandler()\n\t\t\t\t},\n\t\t\t}),\n\t\t)\n\t}\n\n\tif (!isRunningAnimation(animationPhaseX, animationPhaseY)) {\n\t\tcompletionHandler()\n\t}\n\n\treturn {\n\t\tstop: () => {\n\t\t\tif (!isRunningAnimation(animationPhaseX, animationPhaseY)) return\n\t\t\tanimations.forEach(animation => animation.stop())\n\t\t\tanimationPhaseX = animationPhaseX === AnimationPhase.Running ? AnimationPhase.Cancelled : animationPhaseX\n\t\t\tanimationPhaseY = animationPhaseY === AnimationPhase.Running ? AnimationPhase.Cancelled : animationPhaseY\n\t\t\tonStop()\n\t\t},\n\t}\n}\n", "import type { MotionValue } from \"framer-motion\"\nimport type { RefObject } from \"react\"\nimport { isFiniteNumber } from \"../../render/utils/isFiniteNumber.ts\"\nimport { isMotionValue } from \"../../render/utils/isMotionValue.ts\"\nimport { useIsomorphicLayoutEffect } from \"../../useIsomorphicLayoutEffect.ts\"\n\nexport function useUpdateScrollOffset(\n\tref: RefObject<HTMLDivElement>,\n\tside: \"scrollTop\" | \"scrollLeft\",\n\toffset: number | MotionValue<number>,\n\tcancelEmulatedTouchScrollAnimation?: () => void,\n) {\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: We only want to update on contentOffset changes\n\tuseIsomorphicLayoutEffect(() => {\n\t\tif (isMotionValue(offset)) {\n\t\t\tconst updateScrollLeft = () => {\n\t\t\t\tcancelEmulatedTouchScrollAnimation?.()\n\t\t\t\tconst element = ref.current\n\t\t\t\tif (element) element[side] = Math.abs(offset.get())\n\t\t\t}\n\t\t\tupdateScrollLeft()\n\t\t\treturn offset.on(\"change\", updateScrollLeft)\n\t\t} else if (isFiniteNumber(offset)) {\n\t\t\tconst element = ref.current\n\t\t\tif (!element) return\n\t\t\tcancelEmulatedTouchScrollAnimation?.()\n\t\t\telement[side] = Math.abs(offset)\n\t\t}\n\t}, [offset])\n}\n", "import type { Cancel } from \"../animation/Animatable/Animatable.ts\"\nimport type { Observer } from \"../animation/Animatable/Observers.ts\"\nimport { ObservableObject } from \"./ObservableObject.ts\"\n\n/**\n * @internal\n */\nconst data = /* @__PURE__ */ (() => {\n\t/**\n\t * Allows data to be shared between Frames using Code Overrides.\n\t * Any changes to the `Data` instance will cause the preview to update and code\n\t * overrides will re-render. In this example, we\u2019re updating the `scale` property on `press`, setting it to `0.5`.\n\t * ```jsx\n\t * import { Data, Override } from \"framer\"\n\t *\n\t * const data = Data({\n\t *    scale: 0.5,\n\t * })\n\t *\n\t * export function WhileTap(): Override {\n\t *    return {\n\t *        whileTap: {\n\t *            scale: data.scale,\n\t *        },\n\t *    }\n\t * }\n\t *\n\t * ```\n\t * @param initial - The initial value of the data to be set.\n\t * @returns the data object for use across components.\n\t * @public\n\t */\n\tfunction Data<T extends object = object>(initial: Partial<T> | object = {}): T {\n\t\t// Because of the second boolean is set to false we already know that everything will have the same type as the input\n\t\tconst _data: T = ObservableObject(initial, false, false) as any\n\t\tData.addData(_data)\n\t\treturn _data\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tData._stores = [] as object[]\n\t/** @internal */\n\tData.addData = (_data: object) => {\n\t\tData._stores.push(_data)\n\t}\n\t/** @internal */\n\tData.reset = () => {\n\t\tData._stores.forEach(target => ObservableObject.resetObject(target))\n\t}\n\t/** @internal */\n\tData.addObserver = <T extends object>(target: T, observer: Observer<T>): Cancel => {\n\t\treturn ObservableObject.addObserver(target, observer)\n\t}\n\n\treturn Data\n})()\n\nexport const Data = data\n", "import type { AnimatableObject, Cancel } from \"../animation/Animatable/Animatable.ts\"\nimport type { Observer } from \"../animation/Animatable/Observers.ts\"\nimport { deprecationWarning } from \"../utils/deprecation.ts\"\nimport { ObservableObject } from \"./ObservableObject.ts\"\n\n/**\n * @internal\n * @deprecated Use Data instead\n */\nexport const PropertyStore = /* @__PURE__ */ (() => {\n\t/**\n\t * @internal\n\t * @deprecated Use Data instead\n\t */\n\tfunction PropertyStore<T extends object = object>(\n\t\tinitial: Partial<T> | object = {},\n\t\tmakeAnimatables = false,\n\t): AnimatableObject<T> {\n\t\tdeprecationWarning(\"PropertyStore\", \"1.0.0\", \"Data() or ObservableObject()\")\n\t\treturn ObservableObject(initial, makeAnimatables)\n\t}\n\n\tPropertyStore.addObserver = <T extends object>(target: T, observer: Observer<T>): Cancel => {\n\t\treturn ObservableObject.addObserver(target, observer)\n\t}\n\n\treturn PropertyStore\n})()\n", "import { createContext, useContext, useEffect, useMemo, useState } from \"react\"\nimport { createStore } from \"./store.ts\"\nimport type { ActionMap, BoundActionMap, DataHook, SetState, Store } from \"./types.ts\"\n\nconst defaultId = /* @__PURE__ */ Symbol(\"default\")\n\n/**\n * @internal\n * @deprecated ancient (2019?) and does not seem to be used.\n */\nexport const DataContext = /* @__PURE__ */ createContext(defaultId)\n\n/**\n * Creates a hook that shares data between components.\n *\n * By default, all calls to the returned hook will call into the same data store. By\n * passing a `storeId` to the returned hook, separate instances of the store can be created.\n *\n * ```jsx\n * import { createData } from 'framer'\n *\n * const useCount = createData(0)\n *\n * // In a component\n * function MyComponent({ storeId = 'default' }) {\n *   const [count, setCount] = useCount(storeId)\n *\n *   function increment() {\n *     setCount(count + 1)\n *   }\n *\n *   return <Frame onClick={increment}>{count}</Frame>\n * }\n *\n * // In an override\n * function MyOverride({ storeId = 'default' }): Override {\n *   const [count, setCount] = useCount(storeId)\n *\n *   return {\n *     children: count,\n *     onClick: () => setCount(count + 1)\n *   }\n * }\n * ```\n *\n * @param defaultState - The default state ot use\n *\n * @internal\n * @deprecated ancient (2019?) and does not seem to be used.\n */\nexport function createData<State>(defaultState: State): DataHook<State, SetState<State>>\n/**\n * By passing an object of named functions as the second argument to `createData`, actions\n * can be created to specify specific ways in which components can update the data.\n *\n * ```jsx\n * const useCount = createData(0, {\n *   add: (state, data: number) => state + data\n * })\n *\n * function MyOverride(): Override {\n *   const [count, actions] = useCount()\n *\n *   return {\n *     children: count,\n *     onClick: () => actions.add(5)\n *   }\n * }\n * ```\n *\n * @param defaultState - The default state to use\n * @param actions - A set of actions that can be performed on the data\n *\n * @internal\n * @deprecated ancient (2019?) and does not seem to be used.\n */\n\nexport function createData<State, Actions extends ActionMap<State>>(\n\tdefaultState: State,\n\tactions: Actions,\n): DataHook<State, BoundActionMap<State, Actions>>\nexport function createData<State, Actions extends ActionMap<State>>(defaultState: State, actions?: Actions) {\n\tconst stores = new Map<symbol | string, Store<State, Actions>>()\n\n\tconst useData = (id: string | symbol, initialState?: State) => {\n\t\tconst contextId = useContext(DataContext)\n\t\tid = id || contextId\n\n\t\t// biome-ignore lint/correctness/useExhaustiveDependencies: deprecated code\n\t\tconst store = useMemo(() => {\n\t\t\t// If no store with this ID exists, create it.\n\t\t\tif (!stores.has(id)) {\n\t\t\t\tstores.set(id, createStore(initialState || defaultState, actions))\n\t\t\t}\n\n\t\t\treturn stores.get(id) as Store<State, Actions>\n\t\t}, [id])\n\n\t\t// Just use a version number to set state rather than replicating the actual data\n\t\t// for every subscribed component.\n\t\tconst [, notifyUpdates] = useState(store.getVersion())\n\n\t\tconst storeValueAtHookCallTime = useMemo(() => store.get(), [store])\n\n\t\t// Subscribe to changes from this store.\n\t\tuseEffect(() => {\n\t\t\tconst unsubscribe = store.subscribe(notifyUpdates)\n\n\t\t\t// if the store value was updated between calling `useData` and\u2260\n\t\t\t// execution of this `useEffect` callback, e.g. in one of the other subscribers\n\t\t\t// `useEffect(() => { setStoreValue(99) }, [])`\n\t\t\t// make sure we notify the newly created subscriber about that change\n\t\t\tif (storeValueAtHookCallTime !== store.get()) {\n\t\t\t\t// This may need startTransition to avoid synchronous, blocking re-renders.\n\t\t\t\t// However, this component is ancient (2019?) and does not seem to be used. Let's not modify the behavior.\n\t\t\t\t// eslint-disable-next-line framer-studio/no-setstate-without-transition -- deprecated hook\n\t\t\t\tnotifyUpdates(store.getVersion())\n\t\t\t}\n\n\t\t\treturn unsubscribe\n\t\t}, [store, storeValueAtHookCallTime])\n\n\t\treturn [store.get(), store.getActions()]\n\t}\n\n\treturn useData\n}\n", "import type { ActionMap, BoundActionMap, Store, Subscriber } from \"./types.ts\"\n\n/**\n * Take the user-defined `actions` map and return a version of the same functions\n * that update the store.\n *\n * @param get - Store data getter\n * @param set - Store data setter\n * @param actions - The actions to bind to the store\n */\nfunction bindActionsToStore<State, Actions extends ActionMap<State>>(\n\tget: Store<State, Actions>[\"get\"],\n\tset: Store<State, Actions>[\"set\"],\n\tactions: Actions,\n): BoundActionMap<State, Actions> {\n\tconst boundActions: Partial<BoundActionMap<State, Actions>> = {}\n\n\tfor (const key in actions) {\n\t\tconst action = actions[key]\n\t\tif (!action) continue\n\t\tboundActions[key] = (data: any) => set(action(get(), data))\n\t}\n\n\treturn boundActions as BoundActionMap<State, Actions>\n}\n\n/**\n * A data store instance. `useData` can create and access multiple different data stores depending\n * on the `storeId` passed to it (if any).\n *\n * @param initialState - The initial state of the store.\n * @param unboundActions - Optional map of actions to make available for manipulating the data store.\n */\nexport function createStore<State, Actions extends ActionMap<State>>(\n\tinitialState: State,\n\tunboundActions?: Actions,\n): Store<State, Actions> {\n\tlet state = initialState\n\tlet version = 0\n\tconst subscribers = new Set()\n\tconst notifySubscriber = (sub: Subscriber) => sub(version)\n\n\tconst get = () => state\n\tconst set = (latestState: State) => {\n\t\tversion++\n\t\tstate = latestState\n\t\tsubscribers.forEach(notifySubscriber)\n\t}\n\n\tconst actions = unboundActions ? bindActionsToStore(get, set, unboundActions) : set\n\n\treturn {\n\t\tget,\n\t\tset,\n\t\tgetVersion: () => version,\n\t\tgetActions: () => actions,\n\t\tsubscribe: sub => {\n\t\t\tsubscribers.add(sub)\n\t\t\treturn () => subscribers.delete(sub)\n\t\t},\n\t}\n}\n", "import React, { Component } from \"react\"\nimport type { Cancel } from \"../animation/Animatable/Animatable.ts\"\nimport { MainLoop } from \"../core/Loop.ts\"\nimport { Data } from \"../data/Data.ts\"\n\n/**\n * @deprecated\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport type Props = {}\n/**\n * @deprecated\n * @internal\n */\nexport interface State {\n\tupdate: number\n}\nconst initialState = { update: 0 }\n\n/**\n * @deprecated\n * @internal\n */\nexport const DataObserverContext = /* @__PURE__ */ React.createContext({ update: NaN })\n\n/**\n * Makes the component re-render when `Data` changes\n * @returns `true` if observing succeeds (context is provided), `false` when it fails\n * @public\n */\nexport function useObserveData() {\n\tconst context = React.useContext(DataObserverContext)\n\treturn !Number.isNaN(context.update)\n}\n\n/**\n * @deprecated\n * @internal\n */\nexport class DataObserver extends Component<Props & { children?: React.ReactNode }, State> {\n\tobservers: Cancel[] = []\n\toverride state = initialState\n\n\ttaskAdded = false\n\tframeTask = () => {\n\t\t// eslint-disable-next-line @eslint-react/no-access-state-in-setstate -- deprecated component\n\t\tthis.setState({ update: this.state.update + 1 })\n\t\tthis.taskAdded = false // Set after updating state, else the component might become unresponsive\n\t}\n\n\tobserver = () => {\n\t\tif (this.taskAdded) return\n\t\tthis.taskAdded = true\n\t\tMainLoop.addFrameTask(this.frameTask)\n\t}\n\n\toverride componentWillUnmount() {\n\t\tthis.observers.map(cancel => cancel())\n\t\tData.reset()\n\t}\n\n\toverride render() {\n\t\tconst { children } = this.props\n\t\tthis.observers.map(cancel => cancel())\n\t\tthis.observers = []\n\t\tData._stores.forEach((d: object) => {\n\t\t\tconst observer = Data.addObserver(d, this.observer)\n\t\t\tthis.observers.push(observer)\n\t\t})\n\t\treturn <DataObserverContext.Provider value={{ ...this.state }}>{children}</DataObserverContext.Provider>\n\t}\n}\n", "import hoistNonReactStatic from \"hoist-non-react-statics\"\nimport type React from \"react\"\nimport { useContext } from \"react\"\nimport type { FrameProps } from \"../render/presentation/Frame/FrameWithMotion.tsx\"\nimport { DataObserverContext } from \"./DataObserver.tsx\"\nimport { convertColorProps } from \"./convertColorProps.ts\"\n\n/** @public */\nexport type OverrideObject<T extends object = any> = Partial<T>\n/** @public */\nexport type OverrideFunction<P extends object = any> = (props: P) => Partial<P>\n/** @public */\nexport type Override<T extends object = FrameProps & { [key: string]: any }> = OverrideObject<T> | OverrideFunction<T>\n\n/**\n * @deprecated No longer used by Framer because built into preview. From version ## TODO: add correct version\n * @internal\n */\nexport function WithOverride<T extends object>(\n\tComponent: React.ComponentType<T>,\n\toverride: Override<T>,\n): React.ComponentType<T> {\n\tconst useOverride =\n\t\ttypeof override === \"function\"\n\t\t\t? (props: T) => override(convertColorProps(props))\n\t\t\t: () => convertColorProps(override)\n\n\tconst ComponentWithOverride = function (props: T) {\n\t\tuseContext(DataObserverContext)\n\t\tconst overrideProps = useOverride(props)\n\t\tconst { style, ...rest } = props as any\n\t\treturn <Component {...rest} {...overrideProps} _initialStyle={style} />\n\t}\n\thoistNonReactStatic(ComponentWithOverride, Component)\n\tComponentWithOverride[\"displayName\"] = `WithOverride(${Component.displayName || Component.name})`\n\treturn ComponentWithOverride\n}\n", "import type { MotionValue } from \"framer-motion\"\nimport type { BackgroundProperties } from \"../render/traits/Background.ts\"\nimport type { TextColorProperties } from \"../render/traits/TextColor.ts\"\nimport type { BackgroundImage } from \"../render/types/BackgroundImage.ts\"\nimport { Color } from \"../render/types/Color/Color.ts\"\nimport { LinearGradient, RadialGradient } from \"../render/types/Gradient.ts\"\nimport { isMotionValue } from \"../render/utils/isMotionValue.ts\"\n\nfunction convertColorObject(\n\tprop?: string | Color | LinearGradient | RadialGradient | BackgroundImage | MotionValue<string> | null,\n) {\n\tif (typeof prop === \"string\" || isMotionValue(prop)) {\n\t\treturn prop\n\t} else if (LinearGradient.isLinearGradient(prop)) {\n\t\treturn LinearGradient.toCSS(prop)\n\t} else if (RadialGradient.isRadialGradient(prop)) {\n\t\treturn RadialGradient.toCSS(prop)\n\t} else if (Color.isColorObject(prop)) {\n\t\treturn Color.toRgbString(prop)\n\t}\n\treturn prop\n}\n\nexport function convertColorProps<T extends Partial<TextColorProperties & BackgroundProperties>>(props: T): T {\n\tif (props.background || props.color) {\n\t\tconst converted = Object.assign({}, props)\n\n\t\tif (props.background) {\n\t\t\tconverted.background = convertColorObject(props.background)\n\t\t}\n\t\tif (props.color) {\n\t\t\tconverted.color = convertColorObject(props.color) as string | Color\n\t\t}\n\n\t\treturn converted\n\t}\n\n\treturn props\n}\n", "import type { MotionProps, MotionStyle } from \"framer-motion\"\nimport { MotionValue, isMotionValue, optimizedAppearDataAttribute, useTransform } from \"framer-motion\"\nimport type { RefObject } from \"react\"\nimport React from \"react\"\nimport { useRerenderOnResize } from \"../components/hoc/withMeasuredSize.tsx\"\nimport { useObserverRef } from \"../components/utils/refHelper.ts\"\nimport { asRecord } from \"../utils/asRecord.ts\"\nimport { objectKeys } from \"../utils/objectKeys.ts\"\nimport { isNumber, isObject, isString, isUndefined } from \"../utils/utils.ts\"\nimport type { Prefixed } from \"./hocOptions.ts\"\nimport { stripPrefixFromPrefixedKey } from \"./hocOptions.ts\"\nimport { getDisabledFXPropsInStaticRenderer } from \"./optimizeAppear.tsx\"\nimport type { FXValues } from \"./useFXValues.ts\"\nimport { isFXValuesKey } from \"./useFXValues.ts\"\nimport type { LoopEffectOptions } from \"./useLoopEffect.ts\"\nimport { loopOptionsKeys, useLoop } from \"./useLoopEffect.ts\"\nimport type { ParallaxTransformOptions } from \"./useParallax.ts\"\nimport { parallaxOptionsKeys, useParallax } from \"./useParallax.ts\"\nimport type { PresenceEffectOptions } from \"./usePresenceAnimation.ts\"\nimport { presenceOptionsKeys, usePresenceAnimation } from \"./usePresenceAnimation.ts\"\nimport type { StyleAppearEffectOptions } from \"./useStyleAppearEffect.ts\"\nimport { styleAppearOptionsKeys, useStyleAppearEffect } from \"./useStyleAppearEffect.ts\"\nimport type { StyleTransformEffectOptions } from \"./useStyleTransformEffect.ts\"\nimport { styleTransformOptionsKeys, useStyleTransform } from \"./useStyleTransformEffect.ts\"\n\nconst groups = {\n\tparallax: parallaxOptionsKeys,\n\tstyleAppear: styleAppearOptionsKeys,\n\tstyleTransform: styleTransformOptionsKeys,\n\tloop: loopOptionsKeys,\n\tpresence: presenceOptionsKeys,\n} as const\n\nconst groupValues = /* @__PURE__ */ objectKeys(groups)\n\ninterface Output<T> {\n\tparallax: Partial<ParallaxTransformOptions>\n\tstyleAppear: Partial<StyleAppearEffectOptions>\n\tstyleTransform: Partial<StyleTransformEffectOptions>\n\tpresence: Partial<PresenceEffectOptions>\n\tloop: Partial<LoopEffectOptions>\n\tforwardedProps: T\n\ttargetOpacityValue?: number\n\twithPerspective?: boolean\n\tinSmartComponent?: boolean\n}\n\n// Allowing effects to be enabled or disabled was a new feature. Since code was\n// generated without this boolean, and `undefined` should be treated as `false`,\n// we must check if the key exists in the props, and if it doesn't, consider the\n// effect enabled. We also check a secondary key that historically was always\n// included with an enabled effect. If that key doesn't exist, the effect wasn't\n// enabled.\nfunction backwardsCompatibleEnabledCheck(\n\tkey: \"parallaxTransformEnabled\",\n\tsecondaryKey: keyof ParallaxTransformOptions,\n\tobject: Partial<ParallaxTransformOptions>,\n): boolean\nfunction backwardsCompatibleEnabledCheck(\n\tkey: \"styleAppearEffectEnabled\",\n\tsecondaryKey: keyof StyleAppearEffectOptions,\n\tobject: Partial<StyleAppearEffectOptions>,\n): boolean\nfunction backwardsCompatibleEnabledCheck(key: string, secondaryKey: string, object: Record<string, unknown>): boolean {\n\treturn (!(key in object) && secondaryKey in object) || object[key] === true\n}\n\ninterface FXOptions {\n\t__targetOpacity?: number\n\t__perspectiveFX?: boolean\n\t__smartComponentFX?: boolean\n}\n\n/**\n * Iterate through an object of React component props, extracting key-values\n * that are prefixed with the framer prefix set in hocOptions.ts. Depending on\n * which effect the prefixed key belongs to, store the values to a group for\n * that effect, and store the non-prefixed key values to an object of props to\n * be forwarded to the wrapped component.\n *\n * This is similar to hocOptions.ts:extractPrefixedProps().\n */\nfunction extractFXOptions<T extends {}>(\n\tprops: Partial<MotionProps> &\n\t\tPartial<Prefixed<ParallaxTransformOptions & StyleAppearEffectOptions & LoopEffectOptions>> &\n\t\tFXOptions &\n\t\tT,\n): Output<T> {\n\tconst result: Output<T> = {\n\t\tparallax: {},\n\t\tstyleAppear: {},\n\t\tstyleTransform: {},\n\t\tpresence: {\n\t\t\tanimate: props.animate,\n\t\t\tinitial: props.initial,\n\t\t\texit: props.exit,\n\t\t},\n\t\tloop: {},\n\t\tforwardedProps: {} as T,\n\t\ttargetOpacityValue: props.__targetOpacity,\n\t\twithPerspective: props.__perspectiveFX,\n\t\tinSmartComponent: props.__smartComponentFX,\n\t}\n\n\tfor (const key in props) {\n\t\tif (key === \"__targetOpacity\" || key === \"__perspectiveFX\" || key === \"__smartComponentFX\") continue\n\n\t\tconst strippedKey = stripPrefixFromPrefixedKey(key)\n\t\tif (strippedKey) {\n\t\t\tfor (const group of groupValues) {\n\t\t\t\tconst keys = groups[group]\n\n\t\t\t\t// TODO: Ugly cast but TypeScript can\u2019t figure this out\n\t\t\t\tif ((keys as Set<string> | undefined)?.has(strippedKey)) {\n\t\t\t\t\t// TODO: Still too complex for TypeScript, so casting is needed\n\t\t\t\t\t;(result[group] as Record<string, unknown>)[strippedKey] = asRecord(props)[key]\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// TODO: Get around casting here? T is arbitrary so we really don\u2019t have any info\n\t\t\t;(result.forwardedProps as Record<string, unknown>)[key] = asRecord(props)[key]\n\t\t}\n\t}\n\n\tresult.parallax.parallaxTransformEnabled = backwardsCompatibleEnabledCheck(\n\t\t\"parallaxTransformEnabled\",\n\t\t\"speed\",\n\t\tresult.parallax,\n\t)\n\n\tresult.styleAppear.styleAppearEffectEnabled = backwardsCompatibleEnabledCheck(\n\t\t\"styleAppearEffectEnabled\",\n\t\t\"animateOnce\",\n\t\tresult.styleAppear,\n\t)\n\n\treturn result\n}\n\nexport const add = (values: number[]) => values.reduce((sum, value) => (sum += value), 0)\nexport const multiply = (values: number[]) => values.reduce((sum, value) => (sum = sum * value), 1)\n\nconst reactRefObjectKey: keyof RefObject<unknown> = \"current\"\n\nfunction isReactRefObject(value: unknown): value is RefObject<unknown> {\n\treturn isObject(value) && reactRefObjectKey in value\n}\n\nfunction addMotionValueStyle(style: MotionStyle | undefined, values: Record<keyof FXValues, MotionValue[]>) {\n\tif (!style || !isObject(style)) return values\n\n\tfor (const key in style) {\n\t\tconst value = style[key as keyof MotionStyle]\n\t\tif (!isMotionValue(value) || !isFXValuesKey(key)) continue\n\t\tif (!isNumber(value.get())) continue\n\t\tvalues[key].push(value)\n\t}\n}\n\nfunction isVariantOrVariantList(value: unknown) {\n\treturn isString(value) || Array.isArray(value)\n}\n\ntype FXProps = Partial<Prefixed<ParallaxTransformOptions & StyleAppearEffectOptions & StyleTransformEffectOptions>> &\n\tPartial<MotionProps> & {\n\t\t__withFX?: boolean\n\t\t__perspectiveFX?: boolean\n\t\t__targetOpacity?: number\n\t\t__smartComponentFX?: boolean\n\t} & Record<string, unknown>\n\nexport const withFX = <T extends FXProps>(Component: React.ComponentType<T>) =>\n\tReact.forwardRef((props: T, forwardedRef: React.RefObject<HTMLElement> | null) => {\n\t\t// Legacy effects were multiple stacked HOCs. To avoid maintaining them,\n\t\t// we aliased their exports to `withFX`. Now, to prevent the effects\n\t\t// from running twice, we pass a `__withFX` from the outer HOC to the\n\t\t// inner which disables the inner withFX HOC.\n\t\t//\n\t\t// This doesn't violate the rule of hooks because it will always be\n\t\t// stable. Rule lint/correctness/useHookAtTopLevel disabled in biome.jsonc for file.\n\t\t//\n\t\tif (props.__withFX) {\n\t\t\treturn <Component {...props} animate={undefined} initial={undefined} exit={undefined} ref={forwardedRef} />\n\t\t}\n\n\t\tconst disabledProps = getDisabledFXPropsInStaticRenderer(props)\n\t\tif (disabledProps) {\n\t\t\treturn <Component {...props} {...disabledProps} ref={forwardedRef} />\n\t\t}\n\n\t\tconst {\n\t\t\tparallax = {},\n\t\t\tstyleAppear = {},\n\t\t\tstyleTransform = {},\n\t\t\tpresence = {},\n\t\t\tloop = {},\n\t\t\tforwardedProps,\n\t\t\ttargetOpacityValue,\n\t\t\twithPerspective,\n\t\t\tinSmartComponent = false,\n\t\t} = extractFXOptions(props)\n\n\t\tconst observerRef = useObserverRef(forwardedRef)\n\n\t\t// Updates motion values.\n\t\tconst { values: presenceEffectValues, style: presenceEffectStyle } = usePresenceAnimation(\n\t\t\tpresence,\n\t\t\tobserverRef,\n\t\t\tinSmartComponent,\n\t\t\tprops.style,\n\t\t\tprops[optimizedAppearDataAttribute],\n\t\t)\n\t\tconst { values: parallaxValues, style: parallaxStyle } = useParallax(parallax, observerRef, props.style?.visibility)\n\t\tconst { values: transformValues, style: scrollStyle } = useStyleTransform(styleTransform, observerRef)\n\t\tconst { values: appearEffectValues, style: scrollAppearStyle } = useStyleAppearEffect(styleAppear, observerRef)\n\t\tconst { values: loopValues, style: loopStyle } = useLoop(loop, observerRef)\n\n\t\tconst fxValues = React.useMemo(() => {\n\t\t\t// Create a new motion value for the memo to make sure the target opacity is always up to date as a motion value.\n\t\t\tconst layerOpacity = new MotionValue(targetOpacityValue ?? 1)\n\n\t\t\treturn {\n\t\t\t\tscale: [appearEffectValues.scale, loopValues.scale, presenceEffectValues.scale, transformValues.scale],\n\t\t\t\topacity: [\n\t\t\t\t\tappearEffectValues.opacity,\n\t\t\t\t\tloopValues.opacity,\n\t\t\t\t\tpresenceEffectValues.opacity,\n\t\t\t\t\tlayerOpacity,\n\t\t\t\t\ttransformValues.opacity,\n\t\t\t\t],\n\t\t\t\tx: [appearEffectValues.x, loopValues.x, presenceEffectValues.x, transformValues.x],\n\t\t\t\ty: [appearEffectValues.y, loopValues.y, parallaxValues.y, presenceEffectValues.y, transformValues.y],\n\t\t\t\trotate: [appearEffectValues.rotate, loopValues.rotate, presenceEffectValues.rotate, transformValues.rotate],\n\t\t\t\trotateX: [\n\t\t\t\t\tappearEffectValues.rotateX,\n\t\t\t\t\tloopValues.rotateX,\n\t\t\t\t\tpresenceEffectValues.rotateX,\n\t\t\t\t\ttransformValues.rotateX,\n\t\t\t\t],\n\t\t\t\trotateY: [\n\t\t\t\t\tappearEffectValues.rotateY,\n\t\t\t\t\tloopValues.rotateY,\n\t\t\t\t\tpresenceEffectValues.rotateY,\n\t\t\t\t\ttransformValues.rotateY,\n\t\t\t\t],\n\t\t\t\tskewX: [appearEffectValues.skewX, loopValues.skewX, presenceEffectValues.skewX, transformValues.skewX],\n\t\t\t\tskewY: [appearEffectValues.skewY, loopValues.skewY, presenceEffectValues.skewY, transformValues.skewY],\n\t\t\t\t/** @deprecated */\n\t\t\t\ttransformPerspective: [\n\t\t\t\t\ttransformValues.transformPerspective,\n\t\t\t\t\tappearEffectValues.transformPerspective,\n\t\t\t\t\t// We stopped animating transformPerspective with `withFX`\n\t\t\t\t\t// before introducing `useLoop` etc, so it does not have a\n\t\t\t\t\t// value here on purpose.\n\t\t\t\t],\n\t\t\t}\n\t\t}, [targetOpacityValue, transformValues, parallaxValues, appearEffectValues, loopValues, presenceEffectValues])\n\n\t\t// If a motion value is provided in style, include the value in the\n\t\t// transforms. This allows external control over any of these\n\t\t// properties.\n\t\taddMotionValueStyle(props.style, fxValues)\n\n\t\t// Scale & Opacity are multiplicative.\n\t\tconst scale = useTransform(fxValues.scale, multiply)\n\t\tconst opacity = useTransform(fxValues.opacity, multiply)\n\n\t\t// Remaining effects are additive\n\t\tconst x = useTransform(fxValues.x, add)\n\t\tconst y = useTransform(fxValues.y, add)\n\t\tconst rotate = useTransform(fxValues.rotate, add)\n\t\tconst rotateX = useTransform(fxValues.rotateX, add)\n\t\tconst rotateY = useTransform(fxValues.rotateY, add)\n\t\tconst skewX = useTransform(fxValues.skewX, add)\n\t\tconst skewY = useTransform(fxValues.skewY, add)\n\t\t/** @deprecated */\n\t\tconst transformPerspective = useTransform(fxValues.transformPerspective, add)\n\n\t\t// If a ref is being used as drag constraints for this element, rerender\n\t\t// the component if the drag constraint ref element is resized. This\n\t\t// ensures that the constraints are recalculated correctly.\n\t\tconst { drag, dragConstraints } = forwardedProps\n\t\tuseRerenderOnResize(drag && isReactRefObject(dragConstraints) ? dragConstraints : undefined)\n\t\tconst motionValueStyle: MotionStyle = {\n\t\t\topacity,\n\t\t\tscale,\n\t\t\tx,\n\t\t\ty,\n\t\t\trotate,\n\t\t\trotateX,\n\t\t\trotateY,\n\t\t\tskewX,\n\t\t\tskewY,\n\t\t}\n\n\t\t// We removed perspective from effects, instead allowing it to be\n\t\t// defined by css and included in a transform template. Old effects\n\t\t// still need a perspective added however.\n\t\tif (isUndefined(withPerspective)) motionValueStyle.transformPerspective = transformPerspective\n\n\t\t// Remove gesture handlers if we are in a smart component and not on the\n\t\t// ground node (which requires/provides initial/animate for variants).\n\t\tconst animate = isVariantOrVariantList(props.animate) ? props.animate : undefined\n\t\tconst initial = isVariantOrVariantList(props.initial) ? props.initial : undefined\n\t\tconst exit = isVariantOrVariantList(props.exit) ? props.exit : undefined\n\t\tconst motionGestures = inSmartComponent && !presence.presenceInitial ? { initial, animate, exit } : {}\n\n\t\treturn (\n\t\t\t<Component\n\t\t\t\t{...forwardedProps}\n\t\t\t\t{...motionGestures}\n\t\t\t\t__withFX\n\t\t\t\tstyle={{\n\t\t\t\t\t...props.style,\n\t\t\t\t\t...parallaxStyle,\n\t\t\t\t\t...scrollStyle,\n\t\t\t\t\t...loopStyle,\n\t\t\t\t\t...motionValueStyle,\n\t\t\t\t\t...scrollAppearStyle,\n\t\t\t\t\t...presenceEffectStyle,\n\t\t\t\t}}\n\t\t\t\tvalues={presenceEffectValues}\n\t\t\t\tref={observerRef}\n\t\t\t/>\n\t\t)\n\t})\n", "const prefix = \"__framer__\"\nconst prefixLength = /* @__PURE__ */ (() => prefix.length)()\n\nexport type Prefixed<Type extends object> = {\n\t[Property in keyof Type as `${typeof prefix}${string & Property}`]: Type[Property]\n}\n\nexport function extractPrefixedProps<Props extends object, Rest extends Record<string, unknown>>(\n\tprops: Prefixed<Props> & Rest,\n\tkeys: Set<string>,\n): [Props, Rest] {\n\tconst result: Record<string, unknown> = {}\n\tconst rest: Record<string, unknown> = {}\n\tfor (const key in props) {\n\t\tconst strippedKey = stripPrefixFromPrefixedKey(key)\n\t\tif (strippedKey && keys.has(strippedKey)) {\n\t\t\tresult[strippedKey] = props[key]\n\t\t\tcontinue\n\t\t}\n\n\t\trest[key] = props[key]\n\t}\n\t// Treat them like records, but return with the \u201Ccorrect\u201D types\n\treturn [result as Props, rest as Rest]\n}\n\nexport function stripPrefixFromPrefixedKey(key: string): string | undefined {\n\tif (key.startsWith(prefix)) {\n\t\treturn key.substr(prefixLength)\n\t}\n\n\treturn undefined\n}\n", "import { isBrowser } from \"@framerjs/shared/src/environment.ts\"\nimport type { MotionProps } from \"framer-motion\"\nimport React from \"react\"\nimport { assert } from \"../utils/assert.ts\"\nimport { isFunction, isObject, isString } from \"../utils/utils.ts\"\nimport { GeneratedComponentContext } from \"./GeneratedComponentContext.ts\"\nimport { SSRParentVariantsContext, variantHashFromClassName } from \"./PropertyOverrides.tsx\"\nimport { isStaticRenderer } from \"./useIsStaticRenderer.ts\"\n\n// The types here are duplicated in ssg/src/generateSite/animation/types.ts, please make sure the types are synced if\n// you are to make changes.\ninterface Target {\n\t[prop: string]: number\n}\n\ninterface Spring {\n\ttype: \"spring\"\n\tdelay: number\n\tstiffness: number\n\tdamping: number\n\tmass: number\n}\n\ninterface Tween {\n\ttype: \"tween\"\n\tdelay: number\n\tduration: number\n\tease: [number, number, number, number]\n}\n\ntype Transition = Spring | Tween\n\ntype TargetAndTransition = Target & {\n\ttransition: Transition\n}\ninterface Animation {\n\tinitial?: Target\n\tanimate?: TargetAndTransition\n\ttransformTemplate?: string\n\t/**\n\t * Legacy code generation has special behavior when there is a single\n\t * breakpoint which can never be active. To ensure only legacy code has this\n\t * behavior we flag it rather than try to infer it.\n\t */\n\tlegacy?: boolean\n}\nconst defaultVariantKey = \"default\"\nconst defaultVariants = new Set([defaultVariantKey])\n\ntype NodeId = string\n\ninterface GeneratedComponentInfo {\n\tprimaryVariantId: NodeId\n\tvariantClassNames: Record<NodeId, string>\n}\n\nclass AnimationCollector {\n\tprivate entries = new Map<NodeId, { [variantHash: string]: Animation | null }>()\n\n\t/** @deprecated */\n\tset(nodeId: NodeId, prop: \"initial\" | \"animate\", value: TargetAndTransition, variantHash: string | undefined): void\n\t/** @deprecated */\n\tset(nodeId: NodeId, prop: \"transformTemplate\", value: string): void\n\t/** @deprecated */\n\tset(\n\t\tnodeId: NodeId,\n\t\tprop: \"initial\" | \"animate\" | \"transformTemplate\",\n\t\tvalue: TargetAndTransition | string,\n\t\tvariantHash?: string | undefined,\n\t): void {\n\t\tswitch (prop) {\n\t\t\tcase \"transformTemplate\": {\n\t\t\t\tassert(typeof value === \"string\", `transformTemplate must be a string, received: ${value}`)\n\t\t\t\tthis.setHash(nodeId, variantHash, { transformTemplate: value, legacy: true })\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase \"initial\":\n\t\t\tcase \"animate\": {\n\t\t\t\tassert(typeof value === \"object\", `${prop} must be a valid object, received: ${value}`)\n\t\t\t\tthis.setHash(nodeId, variantHash, { [prop]: value, legacy: true })\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\tprivate setHash(\n\t\tid: string,\n\t\tvariantHash: string | undefined = defaultVariantKey,\n\t\tvalue: Record<string, unknown> | null,\n\t) {\n\t\tconst existing = this.entries.get(id) ?? {}\n\t\tconst existingValue = existing[variantHash] ?? {}\n\t\texisting[variantHash] = value === null ? null : { ...existingValue, ...value }\n\t\tthis.entries.set(id, existing)\n\t}\n\n\t#variantHashes: Record<NodeId, string | undefined> = {}\n\tprivate variantHash(variantId: NodeId, info: GeneratedComponentInfo | undefined) {\n\t\tif (variantId === info?.primaryVariantId) return defaultVariantKey\n\t\t// Avoid splitting the same string over and over and reuse the value\n\t\t// from memory.\n\t\tconst existing = this.#variantHashes[variantId]\n\t\tif (existing) return existing\n\n\t\t// Get the class name from the context.\n\t\tconst className = info?.variantClassNames[variantId]\n\t\tif (!className) return defaultVariantKey\n\n\t\t// Split it to determine the stable hash.\n\t\treturn (this.#variantHashes[variantId] = variantHashFromClassName(className))\n\t}\n\n\tsetAll(\n\t\tid: string,\n\t\tvariants: Set<string> | undefined = defaultVariants,\n\t\tprops: Record<string, unknown> | null,\n\t\tinfo: GeneratedComponentInfo | undefined,\n\t) {\n\t\tif (props === null) {\n\t\t\tfor (const variantId of variants) {\n\t\t\t\tthis.setHash(id, this.variantHash(variantId, info), null)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tconst transformTemplate = isFunction(props.transformTemplate)\n\t\t\t? props.transformTemplate?.({}, framerAppearTransformTemplateToken)\n\t\t\t: undefined\n\n\t\tconst initial = props.__framer__presenceInitial ?? props.initial\n\t\tconst animate = props.__framer__presenceAnimate ?? props.animate\n\n\t\tconst config = {\n\t\t\tinitial: isObject(initial) ? initial : undefined,\n\t\t\tanimate: isObject(animate) ? animate : undefined,\n\t\t\ttransformTemplate: isString(transformTemplate) ? transformTemplate : undefined,\n\t\t}\n\n\t\tfor (const variantId of variants) this.setHash(id, this.variantHash(variantId, info), config)\n\t}\n\n\tclear() {\n\t\tthis.entries.clear()\n\t}\n\n\ttoObject() {\n\t\treturn Object.fromEntries(this.entries)\n\t}\n}\n\n/**\n * @internal\n */\nexport const framerAppearEffects = /* @__PURE__ */ new AnimationCollector()\n\n/**\n * @internal\n */\nexport function withOptimizedAppearEffect<T, P extends MotionProps & { optimized?: boolean | undefined }>(\n\tComponent: React.ComponentType<React.PropsWithoutRef<P> & React.RefAttributes<T>>,\n): React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<T>> {\n\treturn React.forwardRef<T, P>(({ optimized, ...props }, ref) => {\n\t\tconst generatedComponentContext = React.useContext(GeneratedComponentContext)\n\t\tconst variants = React.useContext(SSRParentVariantsContext)?.variants\n\t\tconst id = props[framerAppearIdKey]\n\t\tif (id && !isBrowser()) {\n\t\t\tframerAppearEffects.setAll(\n\t\t\t\tid,\n\t\t\t\tvariants,\n\t\t\t\t// A layer may have an optimization id, and an `animate` prop,\n\t\t\t\t// but not require optimization. For example in the case of a\n\t\t\t\t// layer where one variant has an appear effect, and another\n\t\t\t\t// variant has a scroll appear effect, the scroll appear effect\n\t\t\t\t// should not be optimized.\n\t\t\t\toptimized ? props : null,\n\t\t\t\tgeneratedComponentContext,\n\t\t\t)\n\t\t}\n\n\t\tconst disabledProps = getDisabledFXPropsInStaticRenderer(props)\n\t\treturn <Component ref={ref} {...(props as React.PropsWithoutRef<P>)} {...disabledProps} />\n\t})\n}\n\n/**\n * @internal\n */\nexport const optimizeAppear = (\n\tprop: \"initial\" | \"animate\",\n\tid: string,\n\tanimateTargetAndTransition: TargetAndTransition,\n\tvariantHash: string,\n) => {\n\tif (!isBrowser()) {\n\t\t// Collect the appear animation settings for the SSGed page\n\t\tframerAppearEffects.set(id, prop, animateTargetAndTransition, variantHash)\n\t}\n\n\treturn animateTargetAndTransition\n}\n\n/**\n * @internal\n */\nexport const framerAppearTransformTemplateToken = \"__Appear_Animation_Transform__\"\n\n/**\n * @internal\n */\nexport const optimizeAppearTransformTemplate = (\n\tid: string,\n\tfn: (_transformProperties: unknown, generatedString: string) => string,\n) => {\n\tif (!isBrowser()) {\n\t\tconst template: string | undefined = fn?.({}, framerAppearTransformTemplateToken)\n\t\tif (template === undefined) return fn\n\t\tframerAppearEffects.set(id, \"transformTemplate\", template)\n\t}\n\n\treturn fn\n}\n\n/**\n * The dataset key we assign to every node that needs an appear animation. Its value is a unique hashed id, so the\n * appear animation script in SSG can correctly find the nodes that need to be animated, no matter how we alter the ids\n * later on in code-gen/rendering.\n * @internal\n */\nexport const framerAppearIdKey = \"data-framer-appear-id\"\n\n/**\n * The dataset key we assign to the appear animation script tag in the HTML template. SSG uses this key as a selector to\n * inject the animation script.\n * @internal\n */\nexport const framerAppearAnimationScriptKey = \"data-framer-appear-animation\"\n\ninterface DisabledAnimationProps {\n\tanimate: string | string[] | undefined\n\tinitial: string | string[] | undefined\n\texit: undefined\n}\n\n/**\n * Disable animations on the component when we're on the canvas to prevent any values from impacting\n * the design. Don't always unset `animate` or `initial` as if these are already set in a smart\n * component, we will break the active variant.\n *\n * @internal\n */\nexport const getDisabledFXPropsInStaticRenderer = <T extends Partial<MotionProps>>(\n\tprops: T,\n): DisabledAnimationProps | undefined => {\n\tconst isRenderingStaticContent = isStaticRenderer()\n\tif (!isRenderingStaticContent) return undefined\n\n\treturn {\n\t\tanimate: isVariantOrVariantList(props.animate) ? props.animate : undefined,\n\t\tinitial: isVariantOrVariantList(props.initial) ? props.initial : undefined,\n\t\texit: undefined,\n\t}\n}\n\nfunction isVariantOrVariantList(value: unknown) {\n\treturn isString(value) || Array.isArray(value)\n}\n", "import React from \"react\"\n\ntype VariantID = string\ntype NodeID = string\nexport type UnknownProps = Record<string, unknown>\n\nexport interface GeneratedComponentContextValue {\n\tprimaryVariantId: string\n\tvariantProps?: Record<VariantID, Record<NodeID, UnknownProps>>\n\tvariantClassNames: Record<string, string>\n\tactiveVariantId?: string\n\thumanReadableVariantMap?: Record<string, string>\n\t/**\n\t * Layout Template components set this to true. This allows a Web Page\n\t * component to read if they are in a Layout Template. Web Pages will set\n\t * the value back to undefined for their descendants.\n\t */\n\tisLayoutTemplate?: boolean\n}\n\n/** @internal */\nexport const GeneratedComponentContext = /* @__PURE__ */ React.createContext<\n\tGeneratedComponentContextValue | undefined\n>(undefined)\n", "import { isBrowser } from \"@framerjs/shared/src/environment.ts\"\nimport React from \"react\"\nimport { cloneChildrenWithProps } from \"../components/utils/cloneChildrenWithProps.tsx\"\nimport { useCloneChildrenWithPropsAndRef } from \"../components/utils/useCloneChildrenWithPropsAndRef.tsx\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\nimport { isEqual } from \"../render/utils/isEqual.ts\"\nimport { assert, assertNever } from \"../utils/assert.ts\"\nimport { useMemoOne } from \"../utils/useMemoOne.ts\"\nimport { noopSubscribe, returnFalse, returnTrue } from \"../utils/utils.ts\"\nimport type { UnknownProps } from \"./GeneratedComponentContext.ts\"\nimport { GeneratedComponentContext } from \"./GeneratedComponentContext.ts\"\nimport { withCSS } from \"./withCSS.tsx\"\n\nexport const SSRParentVariantsContext = /* @__PURE__ */ React.createContext<\n\t| {\n\t\t\tprimaryVariantId: string\n\t\t\tvariants: Set<string> | undefined\n\t  }\n\t| undefined\n>(undefined)\n\nconst SSRVariantClassName = \"ssr-variant\"\nconst SSRVariantGroupSeparatorClassName = \"ssr-variant-group-separator\"\n\ntype Overrides = Record<string, Record<string, unknown>>\n\nfunction renderBranchedChildrenFromPropertyOverrides(\n\toverrides: Overrides,\n\tchildren: React.ReactNode,\n\tprops: Record<string, unknown>,\n\tvariantClassNames: Record<string, string>,\n\tprimaryVariantId: string,\n\tparentVariants: Set<string> | undefined,\n\tcloneChildren: (children: unknown, props?: Record<string, unknown>) => JSX.Element,\n\tactiveVariantId: string | undefined,\n) {\n\tconst childrenArray = React.Children.toArray(children)\n\tconst child = childrenArray[0]\n\n\tif (childrenArray.length !== 1 || !React.isValidElement(child)) {\n\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\tconsole.warn(\"PropertyOverrides: expected exactly one React element for a child\", children)\n\t\treturn cloneChildren(children, props)\n\t}\n\n\tconst branches: { variants: string[]; propOverrides?: UnknownProps }[] = []\n\tconst nonOverriddenVariants: string[] = []\n\n\t// Iterate through all variants, skipping the primary variant.\n\tfor (const [variantId] of Object.entries(variantClassNames)) {\n\t\tif (variantId === primaryVariantId) continue\n\t\tconst propOverrides = overrides[variantId]\n\t\t// There may not be overrides for a specific variant, or they may be\n\t\t// effectively the same as the primary element.\n\t\tif (!propOverrides || !arePropOverridesEffectivelyDifferent(child.props, propOverrides)) {\n\t\t\tnonOverriddenVariants.push(variantId)\n\t\t\tcontinue\n\t\t}\n\n\t\tconst effectiveVariants = intersection([variantId], parentVariants)\n\t\tif (effectiveVariants.length) branches.push({ variants: effectiveVariants, propOverrides })\n\t}\n\n\tif (branches.length === 0) return cloneChildren(child, props)\n\n\tconst remainingVariants = [primaryVariantId, ...nonOverriddenVariants]\n\tconst effectiveRemainingVariants = intersection(remainingVariants, parentVariants)\n\tif (effectiveRemainingVariants.length) branches.unshift({ variants: effectiveRemainingVariants })\n\n\tconst renderedBranches: JSX.Element[] = []\n\tfor (const { variants, propOverrides } of branches) {\n\t\t// If given, we only render the active variant's branch.\n\t\tif (activeVariantId && !variants.includes(activeVariantId)) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// When rendering a single active branch (post-hydration), use a stable\n\t\t// key so that switching breakpoints updates the existing React subtree\n\t\t// in-place instead of unmounting/remounting it. This preserves DOM\n\t\t// state such as <video> playback and fullscreen.\n\t\tconst key = activeVariantId ? \"active-branch\" : variants.join(\"+\")\n\t\tlet element = (\n\t\t\t// We could omit the SSRParentVariantsContext if variants is the same as parentVariants, but that'd require\n\t\t\t// comparing arrays, so it might not really be an optimization. And since it's just a context, it doesn't\n\t\t\t// affect the size of the generated HTML.\n\t\t\t<SSRParentVariantsContext.Provider key={key} value={{ primaryVariantId, variants: new Set(variants) }}>\n\t\t\t\t{cloneChildren(child, propOverrides ? { ...props, ...propOverrides } : props)}\n\t\t\t</SSRParentVariantsContext.Provider>\n\t\t)\n\t\tconst hiddenClassNames = generateHiddenClassNames(variants, parentVariants, variantClassNames)\n\t\tif (hiddenClassNames.length) {\n\t\t\tassert(branches.length > 1, \"Must branch out when there are hiddenClassNames\")\n\t\t\telement = (\n\t\t\t\t<div\n\t\t\t\t\tkey={key}\n\t\t\t\t\tclassName={`${SSRVariantClassName} ${hiddenClassNames.join(\" \")}`}\n\t\t\t\t\t// Due to SSR variant deduping (`deduplicateSSRVariantBranches.ts`), the server version\n\t\t\t\t\t// of this branch might have fewer class names than its client-rendered version: https://github.com/framer/FramerStudio/pull/28328#discussion_r2838759641\n\t\t\t\t\t// Generally, this is not an issue:\n\t\t\t\t\t// - .hidden-* classes become no-op after hydration (see `removeHiddenBreakpointLayersV2()`)\n\t\t\t\t\t// - React 18-19 ignores attribute mismatches in production (neither patches them up\n\t\t\t\t\t//   nor restarts hydration due to them), so they won\u2019t lead to worse performance.\n\t\t\t\t\t// This comment is here only to suppress the warning that React would emit if you published\n\t\t\t\t\t// a site with dev React.\n\t\t\t\t\tsuppressHydrationWarning\n\t\t\t\t>\n\t\t\t\t\t{element}\n\t\t\t\t</div>\n\t\t\t)\n\t\t} else {\n\t\t\tassert(branches.length === 1, \"Cannot branch out when hiddenClassNames is empty\")\n\t\t}\n\t\trenderedBranches.push(element)\n\t}\n\n\tassert(\n\t\t!activeVariantId || renderedBranches.length === 1,\n\t\t\"Must render exactly one branch when activeVariantId is given\",\n\t)\n\n\t// During SSR (render-all-branches mode), mark the end of this PropertyOverrides\n\t// chain so SSG deduplication can avoid merging chains of adjacent <PropertyOverrides>.\n\tif (!activeVariantId) {\n\t\treturn [\n\t\t\t...renderedBranches,\n\t\t\t<div key=\"property-overrides-separator\" className={SSRVariantGroupSeparatorClassName} />,\n\t\t]\n\t}\n\n\treturn renderedBranches\n}\n\ninterface SSRVariantsProps extends Record<string, unknown> {\n\tid: string\n}\n\n/**\n * @deprecated\n * @internal\n */\nexport const SSRVariants = /* @__PURE__ */ React.forwardRef<HTMLElement, React.PropsWithChildren<SSRVariantsProps>>(\n\tfunction SSRVariants({ id: _nodeId, children, ...props }, ref) {\n\t\tconst cloneWithRefs = useCloneChildrenWithPropsAndRef(ref)\n\t\tif (isBrowser()) {\n\t\t\treturn cloneWithRefs(children, props)\n\t\t}\n\n\t\t// SSRVariants got deprecated and removed from code generation on May 20, 2022:\n\t\t// https://github.com/framer/FramerStudio/pull/11594\n\t\t//\n\t\t// Then on July 11, with the introduction of metadata modules, we bumped code gen version for web pages:\n\t\t// https://github.com/framer/FramerStudio/pull/12059\n\t\t//\n\t\t// Bumping code gen version forces web pages to be re-generated on the next publish, so we're guaranteed that\n\t\t// SSRVariants is no longer being used on published sites.\n\t\t//\n\t\t// Note however that SSRVariants can still be used on the canvas and in the in-app preview by old projects that\n\t\t// haven't published after July 2022, so we still need to support the isBrowser() code path above.\n\t\tthrow new Error(\"SSRVariants is no longer supported outside canvas and preview\")\n\t},\n)\n\nexport function variantHashFromClassName(className: string) {\n\treturn className.split(\"-\")[2]\n}\n\nfunction generateHiddenClassNames(\n\tshowOnlyInVariantIds: string[],\n\tparentVariants: Set<string> | undefined,\n\tvariantClassNames: Record<string, string>,\n) {\n\tconst classNames: string[] = []\n\tfor (const [variantId, variantClassName] of Object.entries(variantClassNames)) {\n\t\tconst alreadyHiddenInParent = parentVariants && !parentVariants.has(variantId)\n\t\tif (showOnlyInVariantIds.includes(variantId) || alreadyHiddenInParent) continue\n\t\tclassNames.push(`hidden-${variantHashFromClassName(variantClassName)}`)\n\t}\n\treturn classNames\n}\n\n/**\n * There's no point rendering a branch if there's no overlap between its\n * variants, and the parent variants.\n *\n * Example 1: if we're currently in a branch that's gonna be visible on mobile\n * only, there's no point rendering a branch that should be tablet-only.\n *\n * Example 2: if we're currently in a branch that's gonna be visible on desktop\n * and tablet, then we should render a branch that's gonna be visible on tablet\n * and mobile.\n *\n * In other words, we're simply looking for an intersection between the two\n * arrays.\n *\n * If we're currently at the top level (parentVariants is undefined), then we\n * need to render all the branches.\n */\nfunction intersection(variants: string[], parentVariants: Set<string> | undefined) {\n\tif (!parentVariants) return variants\n\treturn variants.filter(variant => parentVariants.has(variant))\n}\n\nfunction arePropOverridesEffectivelyDifferent(props: UnknownProps, propOverrides: UnknownProps) {\n\tfor (const key of Object.keys(propOverrides)) {\n\t\tif (!isEqual(props[key], propOverrides[key], true)) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\nfunction propsForBreakpoint(variant: string | undefined, props: Record<string, unknown>, overrides?: Overrides) {\n\tif (!overrides || !variant) return props\n\treturn { ...props, ...overrides[variant] }\n}\n\ninterface Props extends Record<string, unknown> {\n\toverrides: Overrides\n\tbreakpoint: string\n}\n\nconst enum Action {\n\tPassThrough,\n\tRenderActiveBranch,\n\tRenderAllBranches,\n}\n\n/**\n * This is a wrapper for components that have some of their props overridden in different breakpoints.\n *\n * It'll make sure that the component is rendered with props appropriate for the breakpoint, i.e., taking the overrides\n * into account.\n *\n * It also handles SSR + hydration. During SSR, we'll render all the versions of the component into the HTML, with\n * appropriate `hidden-xxx` classes to make sure that on the client, only the version for the correct breakpoint is\n * being shown. Before hydration, we expect all the hidden/non-active breakpoints to be removed from the DOM, which is\n * currently being done by a small inline script injected during SSG. During hydration, we only render the active\n * breakpoint, but we keep the `hidden-xxx`/`ssr-variant` container, because we don't want the shown DOM elements to\n * move around, as that could affect our LCP scores. If we removed/unwrapped the container, the benchmarks might think\n * that the LCP has changed.\n *\n * @internal\n */\nconst PropertyOverridesWithoutCSS = /* @__PURE__ */ React.forwardRef<HTMLElement, React.PropsWithChildren<Props>>(\n\tfunction PropertyOverrides(props, ref) {\n\t\tconst cloneWithRefs = useCloneChildrenWithPropsAndRef(ref)\n\t\tconst ancestorCtx = React.useContext(SSRParentVariantsContext)\n\n\t\t// We want the \"action\" to stay constant during the life of the component, because if we started with hydration,\n\t\t// and thus are rendering the `ssr-variant` container, we don't want a re-render to remove that container, since\n\t\t// if that happened during load, it could affect LCP.\n\t\tconst isHydrationOrSSR = React.useSyncExternalStore(noopSubscribe, returnFalse, returnTrue)\n\t\tconst action = useConstant(() => {\n\t\t\tif (isHydrationOrSSR) {\n\t\t\t\tif (isBrowser()) {\n\t\t\t\t\t// Hydration\n\t\t\t\t\treturn Action.RenderActiveBranch\n\t\t\t\t} else {\n\t\t\t\t\t// SSR\n\t\t\t\t\treturn Action.RenderAllBranches\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Regular render, e.g. on navigation\n\t\t\t\treturn Action.PassThrough\n\t\t\t}\n\t\t})\n\n\t\tconst generatedComponentContext = React.useContext(GeneratedComponentContext)\n\n\t\t// The memo is needed, because of the `useSyncExternalStore` hook, which otherwise causes a synchronous re-render\n\t\t// which in turn might produce Suspense and hydration related errors, as it might synchronously update children that\n\t\t// currently are suspended and not hydrated yet.\n\t\t// As `action` is constant, the synchronous re-render will not actually do anything when paired with `useMemo`.\n\t\t// (see also comment above the `useConstant` call why this is intended)\n\t\treturn useMemoOne(() => {\n\t\t\tconst { breakpoint, overrides, children, ...restProps } = props\n\n\t\t\tif (!generatedComponentContext) {\n\t\t\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\t\t\tconsole.warn(\"PropertyOverrides is missing GeneratedComponentContext\")\n\t\t\t\treturn cloneWithRefs(children, restProps)\n\t\t\t}\n\t\t\tconst { primaryVariantId, variantClassNames } = generatedComponentContext\n\n\t\t\t// When we leave a Layout Template and enter into a Web Page, we reset the parent variants\n\t\t\t// to ensure we render all visible variants, not just the intersection with the Layout\n\t\t\t// Template variants (which will be none)\n\t\t\tconst parentVariants = ancestorCtx?.primaryVariantId === primaryVariantId ? ancestorCtx?.variants : undefined\n\n\t\t\tswitch (action) {\n\t\t\t\tcase Action.PassThrough:\n\t\t\t\t\treturn cloneWithRefs(children, propsForBreakpoint(breakpoint, restProps, overrides))\n\t\t\t\tcase Action.RenderActiveBranch:\n\t\t\t\t\treturn renderBranchedChildrenFromPropertyOverrides(\n\t\t\t\t\t\toverrides,\n\t\t\t\t\t\tchildren,\n\t\t\t\t\t\trestProps,\n\t\t\t\t\t\tvariantClassNames,\n\t\t\t\t\t\tprimaryVariantId,\n\t\t\t\t\t\tparentVariants,\n\t\t\t\t\t\tcloneWithRefs,\n\t\t\t\t\t\tbreakpoint, // only render the single, active branch\n\t\t\t\t\t)\n\t\t\t\tcase Action.RenderAllBranches:\n\t\t\t\t\treturn renderBranchedChildrenFromPropertyOverrides(\n\t\t\t\t\t\toverrides,\n\t\t\t\t\t\tchildren,\n\t\t\t\t\t\trestProps,\n\t\t\t\t\t\tvariantClassNames,\n\t\t\t\t\t\tprimaryVariantId,\n\t\t\t\t\t\tparentVariants,\n\t\t\t\t\t\t// On the server, we use plain cloneChildrenWithProps instead of useCloneChildrenWithPropsAndRef,\n\t\t\t\t\t\t// because we can't clone one ref to multiple branched-out elements (useCloneChildrenWithPropsAndRef\n\t\t\t\t\t\t// even guards against it), but luckily, refs mean nothing on the server anyway.\n\t\t\t\t\t\tcloneChildrenWithProps,\n\t\t\t\t\t\tundefined, // render all branches\n\t\t\t\t\t)\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(action)\n\t\t\t}\n\t\t}, [generatedComponentContext, ancestorCtx, cloneWithRefs, props])\n\t},\n)\n\nexport const PropertyOverrides = /* @__PURE__ */ (() =>\n\twithCSS(PropertyOverridesWithoutCSS, `.${SSRVariantClassName} { display: contents }`, \"PropertyOverrides\"))()\n", "import * as React from \"react\"\n\n/**\n * Clone children and add props to them and wrap them with Fragment making it easier to use.\n * */\nexport function cloneChildrenWithProps(children: React.ReactNode, props: Record<string, unknown>): JSX.Element\n\n/**\n * Returns the cloned children with the props added to them as a real type of React.Children.map\n * */\nexport function cloneChildrenWithProps<T, C>(\n\tchildren: T,\n\tprops: Record<string, unknown>,\n\tasNode: true,\n): ReturnType<typeof React.Children.map<T, C>>\n\nexport function cloneChildrenWithProps(children: React.ReactNode, props: Record<string, unknown>, asNode?: true) {\n\tconst cloned = React.Children.map(children, child => {\n\t\tif (React.isValidElement(child)) {\n\t\t\treturn React.cloneElement(child, props)\n\t\t}\n\t\treturn child\n\t})\n\tif (asNode) return cloned\n\n\treturn <>{cloned}</>\n}\n", "import * as React from \"react\"\nimport { isFunction } from \"../../utils/utils.ts\"\nimport type { Ref } from \"./refHelper.ts\"\nimport { setRef } from \"./refHelper.ts\"\nimport { useConstant } from \"./useConstant.ts\"\n\ninterface State {\n\tforwardedRef: React.ForwardedRef<unknown> | undefined\n\tchildRef: Ref<unknown> | undefined\n\tref: Ref<unknown> | null | undefined\n}\n\n/**\n * This hook creates a clone function to clone children with parent-forwarded props and ref.\n * It forwards the refs and props to the children in a safe way.\n * Clone function is stateful and should only be called once during the render cycle.\n * If you need to clone children multiple times, you should create a new instance of the hook.\n * */\nexport function useCloneChildrenWithPropsAndRef(forwardedRef?: React.ForwardedRef<unknown>) {\n\tconst hook = useConstant(() => createHook(forwardedRef))\n\n\thook.useSetup(forwardedRef)\n\n\treturn hook.cloneAsElement\n}\n\nfunction createHook(forwardedRef?: React.ForwardedRef<unknown>) {\n\tconst state: State = {\n\t\tforwardedRef,\n\t\tchildRef: null,\n\t\tref: null,\n\t}\n\n\tstate.ref = createRefFunction(state)\n\n\tconst updateIfNeeded = (nextForwardedRef?: React.ForwardedRef<unknown>, ref?: Ref<unknown>) => {\n\t\t// If we don't have a ref, and it didn't change, we don't need to re-create the callback\n\t\t//   we can simply re-use childRef\n\t\tif (!state.forwardedRef && state.forwardedRef === nextForwardedRef) {\n\t\t\tstate.ref = ref\n\t\t\treturn\n\t\t}\n\n\t\tlet shouldUpdate = false\n\n\t\t// There is an edge case here when childRef is changed but forwardRef stays the same.\n\t\t//   We are recreating callback in this case, which results in extra updates to forwardRef.\n\t\t//   It is an acceptable limitation compared to the complexity needed to fix this properly\n\t\tif (state.childRef !== ref) {\n\t\t\tstate.childRef = ref\n\t\t\tshouldUpdate = true\n\t\t}\n\n\t\tif (state.forwardedRef !== nextForwardedRef) {\n\t\t\tstate.forwardedRef = nextForwardedRef\n\t\t\tshouldUpdate = true\n\t\t}\n\n\t\tif (!shouldUpdate) return\n\n\t\tstate.ref = createRefFunction(state)\n\t}\n\n\tlet preventNextCall = false\n\n\tfunction cloneChildrenWithPropsAndRef<T>(\n\t\tchildren: T,\n\t\tprops?: Record<string, unknown> | ((props: Record<string, unknown>) => Record<string, unknown>),\n\t) {\n\t\tif (preventNextCall) {\n\t\t\tthrow new ReferenceError(\n\t\t\t\t\"useCloneChildrenWithPropsAndRef: You should not call cloneChildrenWithPropsAndRef more than once during the render cycle.\",\n\t\t\t)\n\t\t}\n\t\tpreventNextCall = true\n\n\t\tif (React.Children.count(children) > 1 && forwardedRef) {\n\t\t\tif (process.env.NODE_ENV !== \"production\") {\n\t\t\t\tthrow new ReferenceError(\n\t\t\t\t\t\"useCloneChildrenWithPropsAndRef: You should not have more than one child when using a forwarded ref.\",\n\t\t\t\t)\n\t\t\t}\n\t\t\tstate.forwardedRef = undefined\n\t\t\tstate.ref = state.childRef\n\t\t}\n\n\t\treturn React.Children.map(children, child => {\n\t\t\tif (React.isValidElement(child)) {\n\t\t\t\t// React assigns ref to child.ref, it doesn't exist in `child.props`\n\t\t\t\tconst ownRef = \"ref\" in child ? (child.ref as Ref<unknown>) : undefined\n\n\t\t\t\tupdateIfNeeded(state.forwardedRef, ownRef)\n\n\t\t\t\tconst newProps = isFunction(props) ? props(child.props as Record<string, unknown>) : props\n\t\t\t\treturn React.cloneElement(child, state.ref !== ownRef ? { ...newProps, ref: state.ref } : newProps)\n\t\t\t}\n\t\t\treturn child\n\t\t})\n\t}\n\n\tconst cloneAsElement = function cloneAsElement<T>(children: T, props?: Record<string, unknown>) {\n\t\treturn <>{cloneChildrenWithPropsAndRef(children, props)}</>\n\t}\n\n\t/**\n\t * Clones children and adds props and refs and returns them as a real type of React.Children.map\n\t * */\n\tcloneAsElement.cloneAsArray = cloneChildrenWithPropsAndRef\n\n\treturn {\n\t\t// used during render phase to sync props with state\n\t\tuseSetup: (newRef?: React.ForwardedRef<unknown>) => {\n\t\t\tpreventNextCall = false\n\t\t\tupdateIfNeeded(newRef, state.childRef)\n\t\t},\n\t\t/**\n\t\t * Clones children and adds props and refs and returns them as a JSX.Element\n\t\t * Making it easier to use as it wraps them in a Fragment.\n\t\t * */\n\t\tcloneAsElement,\n\t}\n}\n\nfunction createRefFunction(state: State): Ref<unknown> | undefined {\n\tif (!state.forwardedRef) return state.childRef\n\tconst { forwardedRef: prevForwardedRef, childRef: prevChildRef } = state\n\n\treturn (value: unknown) => {\n\t\tsetRef(prevChildRef, value)\n\t\tsetRef(prevForwardedRef, value)\n\t}\n}\n", "import type { MotionValue } from \"framer-motion\"\nimport { motionValue } from \"framer-motion\"\nimport React from \"react\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\nimport { isUndefined } from \"../utils/utils.ts\"\n\nexport const effectValuesKeys = [\n\t\"opacity\",\n\t\"x\",\n\t\"y\",\n\t\"scale\",\n\t\"rotate\",\n\t\"rotateX\",\n\t\"rotateY\",\n\t\"skewX\",\n\t\"skewY\",\n\t/** @deprecated */\n\t\"transformPerspective\",\n] as const\n\n/**\n * All effects that can be composed operate on a single set of motion values, by\n * adding or multiplying their values with other effect values. FXValues is the\n * shared interface that can be animated.\n */\nexport type FXValues = Record<(typeof effectValuesKeys)[number], MotionValue<number>>\n\nexport const makeFXValues = (defaults?: Partial<Record<keyof FXValues, number>>) => {\n\treturn {\n\t\tx: motionValue(defaults?.x ?? 0),\n\t\ty: motionValue(defaults?.y ?? 0),\n\t\topacity: motionValue(defaults?.opacity ?? 1),\n\t\tscale: motionValue(defaults?.scale ?? 1),\n\t\trotate: motionValue(defaults?.rotate ?? 0),\n\t\trotateX: motionValue(defaults?.rotateX ?? 0),\n\t\trotateY: motionValue(defaults?.rotateY ?? 0),\n\t\tskewX: motionValue(defaults?.skewX ?? 0),\n\t\tskewY: motionValue(defaults?.skewY ?? 0),\n\t\t/** @deprecated */\n\t\ttransformPerspective: motionValue(defaults?.transformPerspective ?? 0),\n\t} as const\n}\n\nexport const defaultFXValues: Record<keyof FXValues, number> = {\n\tx: 0,\n\ty: 0,\n\tscale: 1,\n\topacity: 1,\n\trotate: 0,\n\trotateX: 0,\n\trotateY: 0,\n\tskewX: 0,\n\tskewY: 0,\n\t/** @deprecated */\n\ttransformPerspective: 0,\n}\n\n/** @internal */\nexport function isFXValuesKey(key: string): key is keyof FXValues {\n\treturn key in defaultFXValues\n}\n\nexport const effectEnabledStyle: React.CSSProperties = {\n\twillChange: \"transform\",\n} as const\nObject.freeze(effectEnabledStyle)\nexport const effectDisabledStyle = {}\nObject.freeze(effectDisabledStyle)\n\n/**\n * Create the fx values object, resetting the motion values to defaults when the\n * effect is disabled.\n */\nexport function useFXValues(values?: Partial<Record<keyof FXValues, number>>, enabled?: boolean) {\n\tconst effect = useConstant(() => ({ values: makeFXValues(enabled ? values : undefined) }))\n\n\tReact.useEffect(() => {\n\t\tif (enabled) return\n\n\t\tfor (const key of effectValuesKeys) {\n\t\t\tconst value = defaultFXValues[key]\n\t\t\tif (isUndefined(value)) continue\n\t\t\teffect.values[key].set(value)\n\t\t}\n\t}, [enabled])\n\n\treturn effect\n}\n", "import type { MotionStyle, Transition, ValueAnimationTransition } from \"framer-motion\"\nimport { animate, useReducedMotionConfig } from \"framer-motion\"\nimport { startTransition, useCallback, useEffect, useMemo, useRef, useState } from \"react\"\nimport type { MutableRefCallback } from \"../components/utils/refHelper.ts\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\nimport type { Prefixed } from \"./hocOptions.ts\"\nimport type { FXValues } from \"./useFXValues.ts\"\nimport {\n\tdefaultFXValues,\n\teffectDisabledStyle,\n\teffectEnabledStyle,\n\teffectValuesKeys,\n\tmakeFXValues,\n} from \"./useFXValues.ts\"\nimport { useSharedIntersectionObserver } from \"./useSharedIntersectionObserver.ts\"\n\nexport interface LoopEffectOptions {\n\tloopEffectEnabled: boolean | undefined\n\tloopTransition: Transition | undefined\n\tloopRepeatType: Extract<NonNullable<Transition[\"repeatType\"]>, \"mirror\" | \"loop\"> | undefined\n\tloopRepeatDelay: number | undefined\n\tloop: Partial<Record<keyof FXValues, number>> | undefined\n\tloopPauseOffscreen: boolean | undefined\n}\n\nexport type PrefixedLoopEffectOptions = Prefixed<LoopEffectOptions>\n\nexport const loopOptionsKeys = new Set<keyof LoopEffectOptions>([\n\t\"loopEffectEnabled\",\n\t\"loopTransition\",\n\t\"loop\",\n\t\"loopRepeatType\",\n\t\"loopRepeatDelay\",\n\t\"loopPauseOffscreen\",\n])\n\n// A delay utility that cleans up any timeouts when unmounted.\nconst useDelay = () => {\n\tconst timeoutRef = useRef<number | undefined>()\n\tuseEffect(() => {\n\t\treturn () => {\n\t\t\tclearTimeout(timeoutRef.current)\n\t\t}\n\t}, [])\n\n\treturn async (d: number) =>\n\t\tnew Promise(resolve => {\n\t\t\ttimeoutRef.current = setTimeout(() => {\n\t\t\t\tresolve(true)\n\t\t\t}, d * 1000) as unknown as number\n\t\t})\n}\n\nexport function useLoop(\n\t{\n\t\tloopEffectEnabled,\n\t\tloopRepeatDelay,\n\t\tloopTransition,\n\t\tloopRepeatType,\n\t\tloop,\n\t\tloopPauseOffscreen,\n\t}: Partial<LoopEffectOptions>,\n\tref: MutableRefCallback<HTMLElement>,\n): {\n\tvalues: FXValues\n\tstyle: MotionStyle\n} {\n\tconst shouldReduceMotion = useReducedMotionConfig()\n\tconst values = useConstant(makeFXValues)\n\tconst mirrorStateRef = useRef(false)\n\tconst delay = useDelay()\n\t// biome-ignore lint/suspicious/noConfusingVoidType: void is the return type of Promise.all\n\tconst animationPromiseRef = useRef<Promise<(void | undefined)[]> | null>(null)\n\n\tconst animateValues = useCallback(async () => {\n\t\tif (!loop) return\n\t\tconst transition = loopTransition || undefined\n\n\t\tconst mirror = mirrorStateRef.current && loopRepeatType === \"mirror\"\n\t\tconst to = mirror ? defaultFXValues : loop\n\t\tconst from = mirror ? loop : defaultFXValues\n\n\t\tmirrorStateRef.current = !mirrorStateRef.current\n\n\t\tanimationPromiseRef.current = Promise.all(\n\t\t\teffectValuesKeys.map(key => {\n\t\t\t\tif (shouldReduceMotion && key !== \"opacity\") return\n\n\t\t\t\t// Jump to new value and reset velocity to 0\n\t\t\t\tvalues[key].jump(from[key] ?? defaultFXValues[key])\n\n\t\t\t\treturn new Promise<void>(resolve => {\n\t\t\t\t\tconst opts: ValueAnimationTransition = {\n\t\t\t\t\t\t...transition,\n\t\t\t\t\t\tonComplete: () => resolve(),\n\t\t\t\t\t}\n\n\t\t\t\t\tconst target = to[key] ?? from[key]\n\t\t\t\t\tif (typeof target === \"number\") {\n\t\t\t\t\t\tanimate(values[key], target, opts)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}),\n\t\t)\n\t\treturn animationPromiseRef.current\n\t}, [loop, loopRepeatType, loopTransition, shouldReduceMotion])\n\n\tconst [isRunning, setIsRunning] = useState(false)\n\tconst shouldRunRef = useRef(false) // the refs purpose is to stop the running `animateLoop`\n\n\tconst animateLoop = useCallback(async () => {\n\t\tif (!loopEffectEnabled || !shouldRunRef.current) return\n\t\tawait animateValues()\n\t\tawait delay(loopRepeatDelay ?? 0)\n\t\tvoid animateLoop()\n\t}, [animateValues, delay, loopEffectEnabled, loopRepeatDelay])\n\n\tconst start = useCallback(() => {\n\t\tif (shouldRunRef.current) return // already running\n\n\t\tshouldRunRef.current = true\n\t\tstartTransition(() => setIsRunning(true)) // force re-render to apply `style` prop updates\n\n\t\tvoid animateLoop()\n\t}, [animateLoop])\n\n\tconst stop = useCallback((overrideRunRef = true) => {\n\t\t// Stop animations first\n\t\teffectValuesKeys.forEach(key => {\n\t\t\tvalues[key].stop()\n\t\t})\n\t\teffectValuesKeys.forEach(key => {\n\t\t\tvalues[key].set(defaultFXValues[key])\n\t\t})\n\n\t\tmirrorStateRef.current = false\n\n\t\tif (overrideRunRef) {\n\t\t\tshouldRunRef.current = false\n\t\t\tstartTransition(() => setIsRunning(false)) // force re-render to apply `style` prop updates\n\t\t}\n\t}, [])\n\n\tconst hasLoop = loopEffectEnabled && loop\n\n\tconst startStopTabVisibilityListener = useCallback(() => {\n\t\tif (document.hidden) {\n\t\t\t// stop without overriding the ref, so that we know if we should start it again when the page becomes visible.\n\t\t\tstop(false)\n\t\t} else if (shouldRunRef.current) {\n\t\t\tshouldRunRef.current = false // needed so that start works\n\t\t\tstart()\n\t\t}\n\t}, [start, stop])\n\n\tuseEffect(() => {\n\t\tif (!hasLoop) return\n\t\tdocument.addEventListener(\"visibilitychange\", startStopTabVisibilityListener)\n\t\treturn () => {\n\t\t\tdocument.removeEventListener(\"visibilitychange\", startStopTabVisibilityListener)\n\t\t}\n\t}, [hasLoop, startStopTabVisibilityListener])\n\n\tuseEffect(() => {\n\t\t// the IntersectionObserver handles starting the animation\n\t\tif (hasLoop && loopPauseOffscreen) return\n\n\t\tif (hasLoop) {\n\t\t\tstart()\n\t\t} else {\n\t\t\tstop()\n\t\t}\n\t}, [start, stop, loopPauseOffscreen, hasLoop])\n\n\t// Cleanup on unmount\n\tuseEffect(() => {\n\t\treturn () => stop()\n\t}, [stop])\n\n\tconst isIntersectingRef = useRef(false)\n\tconst stopAfterAnimationEnds = useCallback(async () => {\n\t\t// No animation running\n\t\tif (!animationPromiseRef.current) return\n\n\t\tawait animationPromiseRef.current\n\n\t\t// If meanwhile the element is intersecting again, we do nothing.\n\t\tif (isIntersectingRef.current) return\n\n\t\tstop()\n\t}, [stop])\n\n\t/**\n\t * This is only called 1x when the observed ref is intersecting or stops intersecting (due to the implicit `threshold: 0` option on the IO)\n\t */\n\tconst startAndStopBasedOnIntersection = useCallback(\n\t\t(entry: IntersectionObserverEntry) => {\n\t\t\tif (entry.isIntersecting) {\n\t\t\t\tisIntersectingRef.current = true\n\t\t\t\tstart()\n\t\t\t} else {\n\t\t\t\tisIntersectingRef.current = false\n\t\t\t\t// If there is an animation running, it could move out of the viewport. So we wait for it to end before stopping.\n\t\t\t\tvoid stopAfterAnimationEnds()\n\t\t\t}\n\t\t},\n\t\t[start, stopAfterAnimationEnds],\n\t)\n\n\tuseSharedIntersectionObserver(ref, startAndStopBasedOnIntersection, {\n\t\tenabled: hasLoop && loopPauseOffscreen,\n\t})\n\n\tconst addWillChange = isRunning || !loopPauseOffscreen\n\treturn useMemo(() => {\n\t\treturn {\n\t\t\tvalues,\n\t\t\tstyle: hasLoop && addWillChange ? effectEnabledStyle : effectDisabledStyle,\n\t\t}\n\t}, [hasLoop, addWillChange])\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport { frame, useMotionValue, useReducedMotionConfig, useScroll, useTransform } from \"framer-motion\"\nimport React, { useContext } from \"react\"\nimport { type MutableRefCallback, useRefEffect } from \"../components/utils/refHelper.ts\"\nimport { useOnRouteChange } from \"../router/useCurrentRoute.tsx\"\nimport type { Prefixed } from \"./hocOptions.ts\"\nimport { parallaxTransform } from \"./parallaxTransform.ts\"\nimport { type FXValues, effectDisabledStyle, effectEnabledStyle } from \"./useFXValues.ts\"\nimport { SharedIntersectionObserverContext, observeElement } from \"./useSharedIntersectionObserver.ts\"\n\nexport interface ParallaxTransformOptions {\n\tspeed: number\n\tadjustPosition: boolean\n\toffset: number\n\tparallaxTransformEnabled: boolean | undefined\n}\n\nexport type PrefixedParallaxTransformOptions = Prefixed<ParallaxTransformOptions>\n\nexport const parallaxOptionsKeys = new Set<keyof ParallaxTransformOptions>([\n\t\"speed\",\n\t\"adjustPosition\",\n\t\"offset\",\n\t\"parallaxTransformEnabled\",\n])\n\ninterface Output {\n\tvalues: Pick<FXValues, \"y\">\n\tstyle: MotionStyle | undefined\n}\n\nexport function useParallax(\n\toptions: Partial<ParallaxTransformOptions>,\n\tref: MutableRefCallback<HTMLElement>,\n\tvisibilityStyle?: MotionStyle[\"visibility\"],\n): Output {\n\tconst { speed = 100, offset = 0, adjustPosition = false, parallaxTransformEnabled } = options\n\tconst originalPosition = React.useRef<number | null>(null)\n\tconst shouldReduceMotion = useReducedMotionConfig()\n\n\tconst transform = React.useCallback(\n\t\t(yValue: number) => {\n\t\t\t// Don't set any transform if we do not have a offsetTop yet.\n\t\t\t// This allows us to capture the boundingRect inside\n\t\t\t// useLayoutEffect without any transform\n\t\t\tif (originalPosition.current === null) return 0\n\t\t\t// Optimization: If the speed is nominal, don't transform\n\t\t\tif (speed === 100) return 0\n\t\t\treturn parallaxTransform(yValue, originalPosition.current, speed, offset, adjustPosition)\n\t\t},\n\t\t[speed, offset, adjustPosition],\n\t)\n\n\t/**\n\t * Merge scroll-derived Y with the any animations the element might be running.\n\t */\n\tconst { scrollY } = useScroll()\n\tconst parallaxY = useTransform(scrollY, transform)\n\n\t// When the adjusting the elements' position based on its original\n\t// position, we set it's visibility to hidden until we have\n\t// retrieved the original position. We reset this value in the\n\t// useLayoutEffect above. This avoids the element 'jumping' when\n\t// using SSG.\n\t//\n\t// We use `visibility` instead of `display` here, because we need the\n\t// element to receive a layout so we can call\n\t// `getBoundingClientRect()` to get it's position.\n\tconst visibility = useMotionValue(adjustPosition && originalPosition.current === null ? \"hidden\" : visibilityStyle)\n\tconst defaultValue = useMotionValue(0)\n\n\tconst observers = useContext(SharedIntersectionObserverContext)\n\n\t/**\n\t * Get the element that is having the parallax applied's offset from\n\t * the top of the viewport when it mounts. We use this to do\n\t * calculations later.\n\t *\n\t * @FIXME: This breaks if the element changes layout unrelated to\n\t * the parallax transform, for example when switching breakpoints.\n\t */\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: The effect should only execute on mount, when the parallax transform is enabled, and when adjustPosition changes.\n\tuseRefEffect(\n\t\tref,\n\t\telement => {\n\t\t\t// We don't want to run anything on cleanup or if the parallax transform is disabled.\n\t\t\tif (element === null || !parallaxTransformEnabled) return\n\n\t\t\t// \"undefined\" is the key the entry where no root margin has been passed -> all elements that have no root margin share that observer.\n\t\t\t// null is the document root.\n\t\t\tconst unobserve = observeElement(observers, \"undefined\", element, null, entry => {\n\t\t\t\toriginalPosition.current = entry.boundingClientRect.top\n\t\t\t\tframe.update(() => {\n\t\t\t\t\tparallaxY.set(transform(scrollY.get()))\n\t\t\t\t\tif (adjustPosition) {\n\t\t\t\t\t\tvisibility.set(visibilityStyle ?? \"initial\")\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\tunobserve()\n\t\t\t})\n\t\t\treturn unobserve\n\t\t},\n\t\t[adjustPosition, parallaxTransformEnabled],\n\t)\n\n\tuseOnRouteChange(() => {\n\t\tif (!parallaxTransformEnabled) return\n\t\tparallaxY.set(0)\n\t})\n\n\treturn {\n\t\tvalues: {\n\t\t\ty: shouldReduceMotion || !parallaxTransformEnabled ? defaultValue : parallaxY,\n\t\t},\n\t\tstyle: parallaxTransformEnabled\n\t\t\t? {\n\t\t\t\t\t...effectEnabledStyle,\n\t\t\t\t\tvisibility,\n\t\t\t\t}\n\t\t\t: effectDisabledStyle,\n\t}\n}\n", "export function parallaxTransform(\n\tscrollY: number,\n\toriginalPosition: number,\n\tspeed: number,\n\toffset: number,\n\tadjustPosition: boolean,\n) {\n\t// 1x speed means the element stays at its original position, so to get a\n\t// value we can use to multiply the current scroll with, we need to subtract\n\t// 1 for it to be 0, resulting in the scroll position having no influence on\n\t// the element.\n\tconst speedFactor = speed / 100 - 1\n\t// The initial position of the element is adjusted, so that when scrolling\n\t// with the speedFactor, the elemant will be at its original position when\n\t// hitting the top of the viewport.\n\t//\n\t// The offset can be used to adjust the position where the element reach at\n\t// its original position.\n\tconst initialPosition = adjustPosition ? (originalPosition - offset) * speedFactor : 0\n\t// The scroll offset is the parallax adjustment that is applied to the\n\t// element. When the speedFactor is 0, it does not move, when it is 1 the\n\t// element moves twice as fast as the scrolling and when it is -1 it goes in\n\t// the reverse direction of the scrolling (staying fixed on the page)\n\tconst scrollOffset = -scrollY * speedFactor\n\treturn initialPosition + scrollOffset\n}\n", "import {\n\ttype MotionProps,\n\ttype MotionStyle,\n\ttype TargetAndTransition,\n\ttype ValueAnimationTransition,\n\tanimate,\n\tframe,\n\tisMotionValue,\n\tusePresence,\n\tuseReducedMotionConfig,\n\tvisualElementStore,\n} from \"framer-motion\"\nimport { useMemo, useRef } from \"react\"\nimport type { MutableRefCallback } from \"../components/utils/refHelper.ts\"\nimport { useRefEffect } from \"../components/utils/refHelper.ts\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\nimport { isEqual } from \"../render/utils/isEqual.ts\"\nimport { safeWindow } from \"../utils/safeWindow.ts\"\nimport { isNumber, isObject, isString } from \"../utils/utils.ts\"\nimport type { FXValues } from \"./useFXValues.ts\"\nimport {\n\tdefaultFXValues,\n\teffectDisabledStyle,\n\teffectEnabledStyle,\n\teffectValuesKeys,\n\tisFXValuesKey,\n\tmakeFXValues,\n} from \"./useFXValues.ts\"\n\ntype EffectOrMotionProp<T> =\n\t| (Partial<Record<keyof FXValues, number>> & { transition: ValueAnimationTransition<number> })\n\t| T\n\nfunction isTargetAndTransition(value: unknown): value is TargetAndTransition {\n\treturn typeof value === \"object\" && value !== null\n}\n\nfunction getTransition(value: EffectOrMotionProp<MotionProps[\"animate\"]>) {\n\tif (!isTargetAndTransition(value)) return undefined\n\treturn value?.transition\n}\n\nfunction runEffectAnimation(\n\ttarget: EffectOrMotionProp<MotionProps[\"animate\"]>,\n\teffect: { values: FXValues },\n\tshouldReduceMotion: boolean | null,\n\tref: MutableRefCallback<HTMLElement>,\n\tappearId?: unknown,\n\tinstant?: boolean,\n) {\n\tconst transition = getTransition(target)\n\n\treturn Promise.all(\n\t\teffectValuesKeys.map(key => {\n\t\t\treturn new Promise<void>(resolve => {\n\t\t\t\tif (shouldReduceMotion && key !== \"opacity\") return resolve()\n\n\t\t\t\tconst motionValue = effect.values[key]\n\n\t\t\t\tmotionValue.stop()\n\n\t\t\t\tlet value = !isTargetAndTransition(target) ? defaultFXValues[key] : (target?.[key] ?? defaultFXValues[key])\n\t\t\t\tif (isMotionValue(value)) value = value.get()\n\t\t\t\tif (!isNumber(value)) return resolve()\n\n\t\t\t\t// Update the base target for this value. The base target is the\n\t\t\t\t// value that Motion will animate to if a value disappears from\n\t\t\t\t// all props. For example, if we have `whileHover` set but the\n\t\t\t\t// value isn't defined in `animate`.\n\t\t\t\t//\n\t\t\t\t// This is usually not necessary but this composed MotionValue\n\t\t\t\t// is opaque to Framer Motion.\n\t\t\t\tconst visualElement = visualElementStore.get(ref.current)\n\t\t\t\tif (visualElement) visualElement.setBaseTarget(key, value)\n\n\t\t\t\t// If this is the first time a value is being animated, check to\n\t\t\t\t// see if we're handling off from an existing animation.\n\t\t\t\tlet startTime: number | undefined\n\t\t\t\tif (isString(appearId) && !motionValue?.hasAnimated && safeWindow.MotionHandoffAnimation) {\n\t\t\t\t\tconst handoffAnimationStartTime = safeWindow.MotionHandoffAnimation(appearId, key, frame)\n\t\t\t\t\tif (handoffAnimationStartTime) {\n\t\t\t\t\t\tstartTime = handoffAnimationStartTime\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (instant) {\n\t\t\t\t\tmotionValue.set(value)\n\t\t\t\t} else {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\t\t\t\tanimate(motionValue, value, {\n\t\t\t\t\t\t...transition,\n\t\t\t\t\t\tvelocity: 0,\n\t\t\t\t\t\tstartTime,\n\t\t\t\t\t\tonComplete: () => resolve(),\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t})\n\t\t}),\n\t)\n}\n\nexport interface PresenceEffectOptions {\n\tinitial?: EffectOrMotionProp<MotionProps[\"initial\"]>\n\tanimate?: EffectOrMotionProp<MotionProps[\"animate\"]>\n\texit?: EffectOrMotionProp<MotionProps[\"exit\"]>\n\n\t// Prefixed props\n\tpresenceInitial?: EffectOrMotionProp<MotionProps[\"initial\"]>\n\tpresenceAnimate?: EffectOrMotionProp<MotionProps[\"animate\"]>\n\tpresenceExit?: EffectOrMotionProp<MotionProps[\"exit\"]>\n}\n\n/**\n * Extract prefixed keys. These will only be present if the ground node of a\n * Smart Component has an appear effect. This is necessary so we don't conflict\n * with props that control the active variant.\n */\nexport const presenceOptionsKeys = new Set<keyof PresenceEffectOptions>([\n\t\"presenceInitial\",\n\t\"presenceAnimate\",\n\t\"presenceExit\",\n])\n\nexport function usePresenceAnimation(\n\t{\n\t\tinitial: motionInitial,\n\t\tanimate: motionAnimate,\n\t\texit: motionExit,\n\t\tpresenceInitial,\n\t\tpresenceAnimate,\n\t\tpresenceExit,\n\t}: PresenceEffectOptions,\n\tref: MutableRefCallback<HTMLElement>,\n\tenabled: boolean,\n\tstyle?: MotionStyle,\n\tappearId?: unknown,\n) {\n\tconst initial = presenceInitial ?? motionInitial\n\tconst animateConfig = presenceAnimate ?? motionAnimate\n\tconst exit = presenceExit ?? motionExit\n\tconst [isPresent, safeToRemove] = usePresence()\n\tconst internalState = useRef({\n\t\tlastPresence: false,\n\t\tlastAnimate: animateConfig,\n\t\thasMounted: false,\n\t\trunning: false,\n\t})\n\n\tconst effect = useConstant(() => {\n\t\t// By falling back to style when initial is not defined, we create a\n\t\t// type too complex for typescript to understand. the types here could\n\t\t// be provided by a user, casting to unknown values solves the complex\n\t\t// type, but also forces us to narrow the type properly at runtime.\n\t\tconst base = (initial ?? style) as Record<string, unknown>\n\t\tif (!isObject(base)) return { values: makeFXValues() }\n\t\tconst defaults: Record<string, number> = {}\n\t\tfor (const key in base) {\n\t\t\tconst value = isObject(base) ? base[key] : undefined\n\t\t\tif (!isNumber(value)) continue\n\t\t\tdefaults[key] = value\n\t\t}\n\n\t\treturn { values: makeFXValues(defaults) }\n\t})\n\n\t// On mount, and whenever animateConfig is removed, make sure that Motion\n\t// knows that the value we provided as a motion value may not be the base.\n\t// We need to run when the animate prop is removed to tell Motion what the\n\t// new base for the motion values are.\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: This hook must only run on mount and when the animateConfig changes.\n\tuseRefEffect(\n\t\tref,\n\t\t(element: HTMLElement | null) => {\n\t\t\tconst { hasMounted } = internalState.current\n\t\t\tif (hasMounted && animateConfig) return\n\n\t\t\tconst visualElement = visualElementStore.get(element)\n\t\t\tif (!visualElement) return\n\n\t\t\tObject.assign(internalState.current, { hasMounted: true })\n\t\t\tfor (const key in effect.values) {\n\t\t\t\tif (!isFXValuesKey(key)) continue\n\t\t\t\tconst value = style?.[key]\n\t\t\t\tvisualElement.setBaseTarget(key, isNumber(value) ? value : defaultFXValues[key])\n\t\t\t}\n\t\t},\n\t\t[animateConfig],\n\t)\n\n\tconst shouldReduceMotion = useReducedMotionConfig()\n\tuseRefEffect(ref, (element: HTMLElement | null) => {\n\t\tif (!enabled) {\n\t\t\t// By calling the usePresence hook, motion will now only allow the\n\t\t\t// component to be removed from the DOM if we call safeToRemove, so\n\t\t\t// if this effect is not enabled, call safeToRemove immediately.\n\t\t\tsafeToRemove?.()\n\t\t\treturn\n\t\t}\n\t\tif (element === null) return\n\n\t\tif (isPresent !== internalState.current.lastPresence) {\n\t\t\t// If the presence of the motion element has changed, try to run an\n\t\t\t// animation.\n\t\t\tObject.assign(internalState.current, { lastPresence: isPresent })\n\t\t\tif (isPresent) {\n\t\t\t\tif (initial && animateConfig) {\n\t\t\t\t\tObject.assign(internalState.current, { running: true })\n\t\t\t\t\tvoid runEffectAnimation(animateConfig, effect, shouldReduceMotion, ref, appearId).then(() =>\n\t\t\t\t\t\tObject.assign(internalState.current, { running: false }),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t} else if (exit) {\n\t\t\t\tObject.assign(internalState.current, { running: true })\n\t\t\t\tvoid runEffectAnimation(exit, effect, shouldReduceMotion, ref, appearId)\n\t\t\t\t\t.then(() => Object.assign(internalState.current, { running: false }))\n\t\t\t\t\t.then(() => safeToRemove())\n\t\t\t} else {\n\t\t\t\tsafeToRemove()\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\t// Otherwise, if the animate prop has changed, update values to\n\t\t// reflect the new config. If the animation is not running, and we\n\t\t// have previously mounted, instantly set all the motion values to\n\t\t// the new target. This happens when the appear animation happens on\n\t\t// some other variant than the current one.\n\t\tconst { lastAnimate, running } = internalState.current\n\t\tconst hasAnimateChanged = !isEqual(animateConfig, lastAnimate)\n\t\tif (!hasAnimateChanged || !animateConfig) return\n\t\tObject.assign(internalState.current, { lastAnimate: animateConfig })\n\t\tvoid runEffectAnimation(animateConfig, effect, shouldReduceMotion, ref, appearId, !running).then(() =>\n\t\t\tObject.assign(internalState.current, { running: false }),\n\t\t)\n\t})\n\n\tconst effectEnabled = enabled && animateConfig\n\n\treturn useMemo(() => {\n\t\treturn { values: effect.values, style: effectEnabled ? effectEnabledStyle : effectDisabledStyle }\n\t}, [effectEnabled])\n}\n", "import type { TargetAndTransition, Transition, ValueAnimationTransition } from \"framer-motion\"\nimport { animate, scroll, transform, useReducedMotionConfig, visualElementStore } from \"framer-motion\"\nimport React, { useMemo } from \"react\"\nimport type { MutableRefCallback } from \"../components/utils/refHelper.ts\"\nimport { useCurrentRouteKey, useOnRouteChange } from \"../router/useCurrentRoute.tsx\"\nimport { asRecord } from \"../utils/asRecord.ts\"\nimport { isNumber } from \"../utils/utils.ts\"\nimport type { EffectScrollTarget } from \"./createTransformInputRange.ts\"\nimport { createTransformInputRange } from \"./createTransformInputRange.ts\"\nimport type { Prefixed } from \"./hocOptions.ts\"\nimport { useAppearEffect } from \"./useAppearEffect.ts\"\nimport type { FXValues } from \"./useFXValues.ts\"\nimport {\n\tdefaultFXValues,\n\teffectDisabledStyle,\n\teffectEnabledStyle,\n\teffectValuesKeys,\n\tuseFXValues,\n} from \"./useFXValues.ts\"\nimport { useScrollDirectionChange } from \"./useScrollDirectionChange.ts\"\n\ninterface StyleEffect extends Record<keyof FXValues, number> {\n\ttransition?: Transition\n}\nexport interface StyleAppearEffectOptions {\n\tstyleAppearEffectEnabled: boolean | undefined\n\tthreshold: number | undefined\n\tanimateOnce: boolean\n\t/**\n\t * Because we are using framer-motion variants with an `initial` value to\n\t * allow us to avoid problems with static generation, we need to know what\n\t * the target opacity or rotate should be, since it may not always be 1, and can't be\n\t * read from the DOM. This is because the DOM will have already been written\n\t * with the above `opacity` value at mount.\n\t */\n\ttargetOpacity: number | undefined\n\topacity: number | undefined\n\tx: number | undefined\n\ty: number | undefined\n\tscale: number | undefined\n\ttransition: Transition | undefined\n\trotate: number | undefined\n\trotateX: number | undefined\n\trotateY: number | undefined\n\tperspective: number | undefined\n\n\tenter: Readonly<StyleEffect>\n\texit: Readonly<StyleEffect>\n\tanimate: Partial<Readonly<StyleEffect>>\n\n\ttargets?: EffectStyleScrollTarget[]\n\tscrollDirection?: EffectStyleScrollTarget\n}\n\ntype EffectStyleScrollTarget = EffectScrollTarget<StyleEffect>\n\nexport type PrefixedStyleAppearEffectOptions = Prefixed<StyleAppearEffectOptions>\n\nexport const styleAppearOptionsKeys = new Set<keyof StyleAppearEffectOptions>([\n\t\"threshold\",\n\t\"animateOnce\",\n\t\"opacity\",\n\t\"targetOpacity\",\n\t\"x\",\n\t\"y\",\n\t\"scale\",\n\t\"transition\",\n\t\"rotate\",\n\t\"rotateX\",\n\t\"rotateY\",\n\t\"perspective\",\n\t\"enter\",\n\t\"exit\",\n\t\"animate\",\n\t\"styleAppearEffectEnabled\",\n\t\"targets\",\n\t\"scrollDirection\",\n])\n\ninterface InternalState extends Record<string, unknown> {\n\tisPlaying: boolean\n\tscheduledAppearState: undefined | boolean\n\tlastAppearState: boolean | string\n}\n\ninterface InputOutputRanges {\n\tinputRange: number[]\n\toutputRange: string[]\n}\n\nconst defaultOutputRange = [\"animate\", \"animate\"]\nconst defaultRanges: InputOutputRanges = { inputRange: [], outputRange: [] }\n\n// The input and output ranges must match. Since the API to generate the input\n// range creates tuples for the start and end of a 'section', we also create\n// tuples for our variants, except for Exit, since that has no defined end.\nfunction createInputOutputRange(\n\ttargets: EffectStyleScrollTarget[],\n\tthreshold: number,\n\thasExit: boolean,\n): InputOutputRanges {\n\tconst inputRange = createTransformInputRange(targets, threshold)\n\tconst outputRange = [...defaultOutputRange]\n\n\tconst firstRange = inputRange[0]\n\tif (!isNumber(firstRange)) return defaultRanges\n\tif (firstRange > 1) {\n\t\tinputRange.unshift(0, firstRange - 1)\n\t\toutputRange.unshift(\"initial\", \"initial\")\n\t}\n\n\tif (hasExit) {\n\t\tconst idx = inputRange.length - 1\n\t\tconst last = inputRange[idx]\n\t\tif (!isNumber(last)) return defaultRanges\n\t\tinputRange.push(last + 1)\n\t\toutputRange.push(\"exit\")\n\t}\n\n\treturn {\n\t\tinputRange,\n\t\toutputRange,\n\t}\n}\n\nfunction makeStyle(defaults?: Partial<StyleEffect>): Readonly<StyleEffect> {\n\treturn {\n\t\tx: defaults?.x ?? defaultFXValues.x,\n\t\ty: defaults?.y ?? defaultFXValues.y,\n\t\tscale: defaults?.scale ?? defaultFXValues.scale,\n\t\topacity: defaults?.opacity ?? defaultFXValues.opacity,\n\t\ttransformPerspective: defaults?.transformPerspective ?? defaultFXValues.transformPerspective,\n\t\trotate: defaults?.rotate ?? defaultFXValues.rotate,\n\t\trotateX: defaults?.rotateX ?? defaultFXValues.rotateX,\n\t\trotateY: defaults?.rotateY ?? defaultFXValues.rotateY,\n\t\tskewX: defaults?.skewX ?? defaultFXValues.skewX,\n\t\tskewY: defaults?.skewY ?? defaultFXValues.skewY,\n\t\ttransition: defaults?.transition ?? undefined,\n\t}\n}\n\nfunction useAnimationVariants({\n\topacity,\n\ttargetOpacity,\n\tperspective: transformPerspective,\n\tenter,\n\texit,\n\tanimate: animateVariant,\n\t...defaultStyles\n}: Partial<StyleAppearEffectOptions>) {\n\treturn React.useMemo(\n\t\t() =>\n\t\t\t({\n\t\t\t\tinitial:\n\t\t\t\t\tenter ??\n\t\t\t\t\tmakeStyle({\n\t\t\t\t\t\t...defaultStyles,\n\t\t\t\t\t\topacity: opacity ?? targetOpacity ?? 1,\n\t\t\t\t\t\ttransformPerspective,\n\t\t\t\t\t}),\n\t\t\t\tanimate:\n\t\t\t\t\tanimateVariant ??\n\t\t\t\t\tmakeStyle({\n\t\t\t\t\t\topacity: targetOpacity,\n\t\t\t\t\t}),\n\t\t\t\texit: exit ?? makeStyle(),\n\t\t\t}) as const,\n\t\t// biome-ignore lint/correctness/useExhaustiveDependencies: `defaultStyles` makes this memo re-run on every render, but that appears to be fine.\n\t\t[animateVariant, defaultStyles, enter, exit, opacity, targetOpacity, transformPerspective],\n\t)\n}\n\nexport function useStyleAppearEffect(\n\toptions: Partial<StyleAppearEffectOptions>,\n\tref: MutableRefCallback<HTMLElement>,\n): { values: FXValues; style: React.CSSProperties } {\n\tconst shouldReduceMotion = useReducedMotionConfig()\n\tconst variants = useAnimationVariants(options)\n\tconst enabled = options.styleAppearEffectEnabled\n\tconst effect = useFXValues(enabled ? variants.initial : variants.animate, enabled)\n\n\tconst playState = React.useRef<InternalState>({\n\t\tisPlaying: false,\n\t\tscheduledAppearState: undefined,\n\t\tlastAppearState: !options.styleAppearEffectEnabled,\n\t})\n\n\tconst currentRouteKey = useCurrentRouteKey()\n\n\t/**\n\t * Record the promise of the last animation so we can await it.\n\t */\n\t// biome-ignore lint/suspicious/noConfusingVoidType: void is correct here since we return `Promise<void>`'s\n\tconst animation = React.useRef<Promise<void[]>>()\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: All dependencies are object values or stable.\n\tconst runAnimation = React.useCallback(\n\t\tasync ({ transition, ...target }: TargetAndTransition, fromInitial?: boolean) => {\n\t\t\t// Use a transition from the TransitionAndTarget, or use the\n\t\t\t// `animate` transition if provided, finally falling back to a\n\t\t\t// legacy `options.transition` for previously generated effects.\n\t\t\tconst transitionWithFallback = transition ?? variants.animate.transition ?? options.transition\n\n\t\t\t// Wait for currently running animations to finish.\n\t\t\tawait animation.current\n\n\t\t\tconst visualElement = visualElementStore.get(ref.current)\n\n\t\t\t// Start animations, optionally starting from the initial values.\n\t\t\t// eslint-disable-next-line require-atomic-updates -- non-atomic updates to react refs are fine.\n\t\t\tanimation.current = Promise.all(\n\t\t\t\teffectValuesKeys.map((key: keyof FXValues) => {\n\t\t\t\t\tif (fromInitial) effect.values[key].set(variants.initial[key] ?? defaultFXValues[key])\n\n\t\t\t\t\tconst toValue = target[key] ?? defaultFXValues[key]\n\n\t\t\t\t\t/**\n\t\t\t\t\t * Update the base target for this value. The base target is the value that\n\t\t\t\t\t * Motion will animate to if a value disappears from all props. For example,\n\t\t\t\t\t * if we have `whileHover` set but the value isn't defined in `animate`.\n\t\t\t\t\t *\n\t\t\t\t\t * This is usually not necessary but this composed MotionValue is opaque to\n\t\t\t\t\t * Framer Motion.\n\t\t\t\t\t */\n\t\t\t\t\tif (visualElement && typeof toValue !== \"object\") {\n\t\t\t\t\t\tvisualElement.setBaseTarget(key, toValue)\n\t\t\t\t\t}\n\n\t\t\t\t\treturn new Promise<void>(resolve => {\n\t\t\t\t\t\tif (shouldReduceMotion && key !== \"opacity\") {\n\t\t\t\t\t\t\tif (isNumber(toValue)) effect.values[key].set(toValue)\n\t\t\t\t\t\t\tresolve()\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst opts: ValueAnimationTransition = {\n\t\t\t\t\t\t\t\trestDelta: key === \"scale\" ? 0.001 : undefined,\n\t\t\t\t\t\t\t\t...transitionWithFallback,\n\t\t\t\t\t\t\t\tonComplete: () => resolve(),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// @TODO: Ignored for now, but should re-check later.\n\t\t\t\t\t\t\tif (typeof toValue === \"number\") {\n\t\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\t\t\t\t\t\t\tanimate(effect.values[key], toValue, opts)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t}),\n\t\t\t)\n\t\t},\n\t\t[],\n\t)\n\n\t// If we are animating based on this element's visibility in the viewport,\n\t// we use an Intersection Observer.\n\tconst hasAnimatedOnce = options.animateOnce && playState.current.lastAppearState === true\n\tconst animateWithIntersectionObserver =\n\t\t!options.targets && options.styleAppearEffectEnabled && !options.scrollDirection && !hasAnimatedOnce\n\n\tuseAppearEffect(\n\t\tref,\n\t\t(appears: boolean) => {\n\t\t\tconst { isPlaying, lastAppearState } = playState.current\n\n\t\t\tif (isPlaying) {\n\t\t\t\tplayState.current.scheduledAppearState = appears\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tplayState.current.scheduledAppearState = undefined\n\t\t\tplayState.current.lastAppearState = appears\n\n\t\t\tif (lastAppearState === appears) return\n\n\t\t\tvoid runAnimation(appears ? variants.animate : variants.exit, appears)\n\t\t},\n\t\t{\n\t\t\tenabled: animateWithIntersectionObserver,\n\t\t\tanimateOnce: !!options.animateOnce,\n\t\t\tthreshold: {\n\t\t\t\ty: options.threshold,\n\t\t\t},\n\t\t},\n\t)\n\n\t// If we are animating based on another layers offset from the top of the\n\t// browser viewport, we use motionone's `scroll` polyfill for the scroll\n\t// timeline API.\n\tconst animateWithScrollInfo = options.targets && enabled && !options.scrollDirection\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: All dependencies are object values or stable.\n\tReact.useEffect(() => {\n\t\tif (!animateWithScrollInfo) return\n\n\t\t// Track if we have animated to a variant. This allows us to avoid\n\t\t// running that animation more than once if  \"animateOnce\" is true. We\n\t\t// must initialize the object with `initial: true` to prevent animating\n\t\t// from `animate` --> `initial` when `replay` is false.\n\t\tconst playedState: Record<string, boolean> = { initial: true }\n\n\t\t// Reset state when the route changes.\n\t\tconst _ = currentRouteKey\n\n\t\tlet lastVariant = \"initial\"\n\n\t\treturn scroll((_, { y: scrollY }) => {\n\t\t\tconst { targets } = options\n\t\t\tif (!targets) return\n\n\t\t\t// It can be that this function fires after scroll target refs have\n\t\t\t// been dehydrated. Check the first target to see if it is still\n\t\t\t// hydrated and bail if not.\n\t\t\tif (!targets[0] || (targets[0].ref && !targets[0].ref.current)) return\n\n\t\t\tconst { inputRange, outputRange } = createInputOutputRange(\n\t\t\t\ttargets,\n\t\t\t\t(options.threshold ?? 0) * scrollY.containerLength,\n\t\t\t\t!!options.exit,\n\t\t\t)\n\n\t\t\t// The input range can be empty if a ref is missing or unset.\n\t\t\t// Transform ranges must have the same number of entries. If target\n\t\t\t// refs are missing these ranges may not match. In which case do not\n\t\t\t// run the effect.\n\t\t\tif (inputRange.length === 0 || inputRange.length !== outputRange.length) return\n\n\t\t\tconst variant = transform(scrollY.current, inputRange, outputRange)\n\n\t\t\t// If we are only allowed to animate to a variant once, return early\n\t\t\t// if we have animated to it before.\n\t\t\tif (options.animateOnce && playedState[variant]) return\n\t\t\tplayedState[variant] = true\n\n\t\t\t// Prevent unnecessary animations by early returning if the\n\t\t\t// currently active variant is the last variant animated to.\n\t\t\tif (lastVariant === variant) return\n\t\t\tlastVariant = variant\n\t\t\tconst variantAnimation = asRecord(variants)[variant]\n\t\t\tif (!variantAnimation) return\n\t\t\tvoid runAnimation(variantAnimation)\n\t\t})\n\t}, [currentRouteKey, animateWithScrollInfo])\n\n\tuseScrollDirectionChange(options.scrollDirection, target => void runAnimation(target ?? variants.animate), {\n\t\tenabled,\n\t\trepeat: !options.animateOnce,\n\t})\n\n\tuseOnRouteChange(() => {\n\t\tif (!enabled) return\n\t\tif (!options.targets && !options.scrollDirection) return\n\t\tfor (const key of effectValuesKeys) {\n\t\t\teffect.values[key].set(variants.initial?.[key] ?? defaultFXValues[key])\n\t\t}\n\t})\n\n\treturn useMemo(() => {\n\t\treturn { values: effect.values, style: enabled ? effectEnabledStyle : effectDisabledStyle }\n\t}, [enabled])\n}\n", "/**\n * OffsetTop must be calculated by looping. See motionone:\n * https://github.com/motiondivision/motionone/blob/main/packages/dom/src/gestures/scroll/offsets/inset.ts\n */\nexport function calcOffsetTop(element: Element, container: HTMLElement) {\n\tlet top = 0\n\n\tlet current: Element | null = element\n\twhile (current && current !== container) {\n\t\tif (!(current instanceof HTMLElement)) break\n\n\t\ttop += current.offsetTop\n\t\tcurrent = current.offsetParent\n\t}\n\n\treturn top\n}\n", "import type React from \"react\"\nimport { calcOffsetTop } from \"./calculateOffsetTop.ts\"\n\nexport type ScrollDirection = \"up\" | \"down\"\n\nexport interface EffectScrollTarget<T> {\n\tref?: React.RefObject<HTMLElement>\n\toffset?: number\n\tdirection?: ScrollDirection\n\ttarget: T\n}\n\n/**\n * When scrolling directly to an element with element.scrollIntoView(), the\n * scroll progress will be exactly 0, but users expect that to trigger the\n * animation. We add -1 offset to ensure that the progress is guaranteed to be >\n * 0 if scrolled to with this API.\n */\nconst scrollObserverOffset = 1\n\nexport function createTransformInputRange(\n\ttransformTargets: EffectScrollTarget<unknown>[],\n\tthreshold: number = 0,\n\t/**\n\t * A callback to be executed once for every transform target with the index\n\t * of the target. This callback will be called in reverse index order, so\n\t * callee's may need to use `unshift` to build the right output range.\n\t */\n\tcallback?: (index: number) => void,\n) {\n\t// Starting from the last transform target, record the offsetTop of each\n\t// ref. This is used to compare while iterating from last to first.\n\tconst starts: number[] = []\n\n\t// Build an array of input ranges in px values from the top of the page.\n\t// These are pairs where each pair is the offset from the top of the page to\n\t// the element, and the offset from the top of the page to the end of the\n\t// element, or the top of the next element, whichever is smaller. There may\n\t// be dead space between these pairs, or they may be sequential. e.g.\n\t// [ 200, 500, 800, 900 ]\n\tconst inputRange: number[] = []\n\n\tfor (let index = transformTargets.length; index >= 0; index--) {\n\t\tconst { ref: targetRef, offset } = transformTargets[index] ?? {}\n\t\tif (!targetRef || !targetRef.current) continue\n\n\t\tconst offsetTop = calcOffsetTop(targetRef.current, document.documentElement)\n\t\tconst top = offsetTop - scrollObserverOffset - (offset ?? 0) - threshold\n\t\tconst height = targetRef.current?.clientHeight ?? 0\n\n\t\t// The end is which ever is higher up the page, the end of this\n\t\t// element, or the start of the next.\n\t\tconst previousTop = starts[starts.length - 1]\n\t\tconst end = Math.max(top + height, 0)\n\n\t\t// Track this start offset. We will use it to compare the next target.\n\t\tstarts.push(top)\n\n\t\tinputRange.unshift(Math.max(top, 0), previousTop === undefined ? end : Math.min(end, Math.max(previousTop - 1, 0)))\n\n\t\t// In cases where performance is important, instead of iterating through\n\t\t// targets a second time, we can execute a callback with the current\n\t\t// index.\n\t\tcallback?.(index)\n\t}\n\n\treturn inputRange\n}\n", "import { scroll } from \"framer-motion\"\nimport React from \"react\"\nimport { useCurrentRouteKey } from \"../router/useCurrentRoute.tsx\"\nimport type { EffectScrollTarget, ScrollDirection } from \"./createTransformInputRange.ts\"\n\nfunction currentScrollDirection(offset: number, lastOffset: number = 0): ScrollDirection {\n\tif (offset < lastOffset) return \"up\"\n\treturn \"down\"\n}\n\nconst scrollDirectionThreshold = 4\n\ninterface Options {\n\trepeat?: boolean\n\tenabled?: boolean\n}\n\nexport function useScrollDirectionChange<T extends EffectScrollTarget<unknown>>(\n\tscrollDirection: T | undefined,\n\tcb: (value: T[\"target\"] | undefined) => void,\n\toptions: Options = {},\n) {\n\tconst { direction, target } = scrollDirection ?? {}\n\tconst { repeat = true, enabled = true } = options\n\tconst currentRouteKey = useCurrentRouteKey()\n\tReact.useEffect(() => {\n\t\tif (!direction || !enabled) return\n\n\t\t// Reset the effect state when the route changes.\n\t\tconst _ = currentRouteKey\n\n\t\t// Track the last y offset to determine when the scroll direction\n\t\t// changes.\n\t\tlet lastOffset: number | undefined = undefined\n\t\t// When the direction changes, record the current offset so that we can\n\t\t// trigger the effect only when the scroll has continued past this point\n\t\t// by a threshold.\n\t\tlet directionChangeOffset: number = 0\n\t\t// Track the current direction so that we can trigger an effect when it\n\t\t// changes.\n\t\tlet lastDirection: ScrollDirection | undefined = undefined\n\t\t// Track the target that the effect is currently animated too, so that\n\t\t// we can only update the target when it changes.\n\t\tlet currentTarget: T[\"target\"] | undefined = undefined\n\t\treturn scroll((_, { y: scrollY }) => {\n\t\t\tif (!repeat && currentTarget === target) return\n\n\t\t\t// Don't allow overscroll to impact the direction calculations.\n\t\t\tif (scrollY.current > scrollY.scrollLength) return\n\t\t\tif (scrollY.current < 0) return\n\n\t\t\tconst d = currentScrollDirection(scrollY.current, lastOffset)\n\t\t\tlastOffset = scrollY.current\n\n\t\t\tconst hasDirectionChanged = d !== lastDirection\n\t\t\tlastDirection = d\n\n\t\t\tif (hasDirectionChanged) {\n\t\t\t\tdirectionChangeOffset = scrollY.current\n\t\t\t} else {\n\t\t\t\tconst delta = Math.abs(scrollY.current - directionChangeOffset)\n\t\t\t\tif (delta < scrollDirectionThreshold) return\n\t\t\t\tconst nextTarget = d === direction ? target : undefined\n\t\t\t\tif (nextTarget !== currentTarget) cb(nextTarget)\n\t\t\t\tcurrentTarget = nextTarget\n\t\t\t}\n\t\t})\n\t}, [currentRouteKey, direction, repeat, target, enabled, cb])\n}\n", "import type { MotionStyle, MotionValue, SpringOptions } from \"framer-motion\"\nimport { animateValue, frame, scroll, transform, useReducedMotionConfig } from \"framer-motion\"\nimport React, { useLayoutEffect } from \"react\"\nimport type { MutableRefCallback } from \"../components/utils/refHelper.ts\"\nimport { useRefEffect } from \"../components/utils/refHelper.ts\"\nimport { useCurrentRouteKey, useOnRouteChange } from \"../router/useCurrentRoute.tsx\"\nimport { objectKeys } from \"../utils/objectKeys.ts\"\nimport type { EffectScrollTarget } from \"./createTransformInputRange.ts\"\nimport { createTransformInputRange } from \"./createTransformInputRange.ts\"\nimport type { Prefixed } from \"./hocOptions.ts\"\nimport type { FXValues } from \"./useFXValues.ts\"\nimport {\n\tdefaultFXValues,\n\teffectDisabledStyle,\n\teffectEnabledStyle,\n\teffectValuesKeys,\n\tuseFXValues,\n} from \"./useFXValues.ts\"\n\nexport interface StyleTransformEffectOptions {\n\tstyleTransformEffectEnabled: boolean | undefined\n\ttransformViewportThreshold: number | undefined\n\tspring: SpringOptions\n\ttransformTrigger: \"onScroll\" | \"onInView\" | \"onScrollTarget\" | undefined\n\ttransformTargets: EffectStyleScrollTarget[] | undefined\n}\n\nexport type PrefixedStyleTransformEffectOptions = Prefixed<StyleTransformEffectOptions>\n\nexport const styleTransformOptionsKeys = new Set<keyof StyleTransformEffectOptions>([\n\t\"transformViewportThreshold\",\n\t\"styleTransformEffectEnabled\",\n\t\"transformTargets\",\n\t\"spring\",\n\t\"transformTrigger\",\n])\n\nconst defaultValues = (\n\ttransformTargets: EffectStyleScrollTarget[] | undefined,\n\tshouldReduceMotion: boolean | null,\n): Partial<Record<keyof FXValues, number>> | undefined => {\n\tconst initial = transformTargets?.[0]?.target\n\treturn shouldReduceMotion ? { opacity: initial?.opacity ?? 1 } : initial\n}\n\nconst defaultRanges = (): Record<keyof FXValues, number[]> => ({\n\topacity: [],\n\tx: [],\n\ty: [],\n\tscale: [],\n\trotate: [],\n\trotateX: [],\n\trotateY: [],\n\tskewX: [],\n\tskewY: [],\n\ttransformPerspective: [],\n})\n\n// Add spring animations to motion values. This uses a private motion API to\n// replicate `useScroll`, but in an optional way that allows the user to decide\n// when to enable or disable the spring effect.\nfunction useAttachOptionalSpring(\n\tvalues: Record<keyof FXValues, MotionValue<number>>,\n\tspring: SpringOptions | undefined,\n) {\n\tconst springs = React.useRef({} as Record<keyof FXValues, ReturnType<typeof animateValue>>)\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: We already check for json stringified spring\n\tReact.useEffect(() => {\n\t\tif (spring === undefined) return\n\n\t\tfor (const key of objectKeys(values)) {\n\t\t\tconst m: MotionValue<number> = values[key]\n\n\t\t\tlet latestSetter: (value: number) => void\n\t\t\tlet latestValue: number\n\n\t\t\tfunction startAnimation() {\n\t\t\t\tconst active = springs.current[key]\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-misused-promises -- wrong inferred type\n\t\t\t\tif (active) active.stop()\n\n\t\t\t\tsprings.current[key] = animateValue({\n\t\t\t\t\tkeyframes: [m.get(), latestValue],\n\t\t\t\t\tvelocity: m.getVelocity(),\n\t\t\t\t\t...spring,\n\t\t\t\t\trestDelta: 0.001,\n\t\t\t\t\tonUpdate: latestSetter,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\t// @ts-expect-error - this is a private API.\n\t\t\tm.attach((v, set) => {\n\t\t\t\tlatestValue = v\n\t\t\t\tlatestSetter = set\n\t\t\t\tframe.postRender(startAnimation)\n\t\t\t\treturn m.get()\n\t\t\t})\n\t\t}\n\t}, [JSON.stringify(spring)])\n}\n\ntype EffectStyleScrollTarget = EffectScrollTarget<Record<keyof FXValues, number>>\n\nfunction createInputOutputRanges(transformTargets: EffectStyleScrollTarget[], threshold: number) {\n\t// Build an object mapping style keys to their output range. e.g. {opacity:\n\t// [ 0, 0.5, 0.5, 1 ] }. These are pairs, where the first entry is the\n\t// proceeding transformTarget's to, and the second entry is the current\n\t// transformTarget's to. This ensures that we don't update the motion value\n\t// if there is dead space between input offsets.\n\tconst effectKeyOutputRange = defaultRanges()\n\tconst inputRange = createTransformInputRange(transformTargets, threshold, index => {\n\t\tconst previousTarget = transformTargets[index - 1]?.target\n\t\tconst currentTarget = transformTargets[index]?.target\n\t\tfor (const key of effectValuesKeys) {\n\t\t\teffectKeyOutputRange[key]?.unshift(previousTarget?.[key] ?? 0, currentTarget?.[key] ?? 0)\n\t\t}\n\t})\n\n\treturn { inputRange, effectKeyOutputRange }\n}\n\nfunction createPageOutputRange(transformTargets: EffectStyleScrollTarget[]) {\n\tconst keyOutputRange = defaultRanges()\n\n\tfor (const { target } of transformTargets) {\n\t\tfor (const key of effectValuesKeys) keyOutputRange[key]?.push(target[key])\n\t}\n\n\treturn keyOutputRange\n}\n\nconst pageInputRange = [0, 1]\n\nexport function useStyleTransform(\n\t{\n\t\ttransformTrigger,\n\t\tstyleTransformEffectEnabled,\n\t\ttransformTargets,\n\t\tspring,\n\t\ttransformViewportThreshold = 0,\n\t}: Partial<StyleTransformEffectOptions>,\n\tref: MutableRefCallback<HTMLElement>,\n): { values: FXValues; style: MotionStyle | undefined } {\n\tconst shouldReduceMotion = useReducedMotionConfig()\n\tconst effect = useFXValues(defaultValues(transformTargets, shouldReduceMotion), styleTransformEffectEnabled)\n\tconst effectDisabled = !styleTransformEffectEnabled || !transformTargets\n\tconst triggerOnScroll = transformTrigger === \"onScrollTarget\"\n\tconst currentRouteKey = useCurrentRouteKey()\n\n\tuseLayoutEffect(() => {\n\t\tif (effectDisabled || !triggerOnScroll) return\n\n\t\t// create offsets based on the provided targets.\n\t\treturn scroll((_, { y: scrollY }) => {\n\t\t\t// It can be that this function fires after scroll target refs have been\n\t\t\t// dehydrated. Check the first target to see if it is still hydrated and\n\t\t\t// bail if not.\n\t\t\tif (!transformTargets[0] || (transformTargets[0].ref && !transformTargets[0].ref.current)) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst { inputRange: scrollYInputRange, effectKeyOutputRange } = createInputOutputRanges(\n\t\t\t\ttransformTargets,\n\t\t\t\ttransformViewportThreshold * scrollY.containerLength,\n\t\t\t)\n\n\t\t\t// The input range can be empty if a ref is missing or unset.\n\t\t\tif (scrollYInputRange.length === 0) return\n\n\t\t\t// Finally, transform all of the values.\n\t\t\tfor (const key of effectValuesKeys) {\n\t\t\t\tif (shouldReduceMotion && key !== \"opacity\") continue\n\t\t\t\t// Transform ranges must have the same number of entries.\n\t\t\t\tif (scrollYInputRange.length !== effectKeyOutputRange[key].length) continue\n\n\t\t\t\t// If a value is undefined, we don't interpolate it\n\t\t\t\tif (effectKeyOutputRange[key][0] === undefined) continue\n\n\t\t\t\teffect.values[key].set(transform(scrollY.current, scrollYInputRange, effectKeyOutputRange[key]))\n\t\t\t}\n\t\t})\n\t}, [shouldReduceMotion, triggerOnScroll, transformViewportThreshold, transformTargets, effectDisabled])\n\n\tuseRefEffect(\n\t\tref,\n\t\t(element: HTMLElement | null) => {\n\t\t\tif (effectDisabled || triggerOnScroll || element === null) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Reset state when the route changes.\n\t\t\tconst _ = currentRouteKey\n\n\t\t\tconst outputRange = createPageOutputRange(transformTargets)\n\n\t\t\t// If the effect isn't controlled by target refs, we can scroll\n\t\t\t// based on the page, using motionone's built in offsets.\n\t\t\treturn scroll(\n\t\t\t\t(_, { y: scrollY }) => {\n\t\t\t\t\tfor (const key of effectValuesKeys) {\n\t\t\t\t\t\tif (shouldReduceMotion && key !== \"opacity\") continue\n\t\t\t\t\t\t// Transform ranges must have the same number of\n\t\t\t\t\t\t// entries. If target refs are missing these ranges may\n\t\t\t\t\t\t// not match.\n\t\t\t\t\t\tif (pageInputRange.length !== outputRange[key].length) continue\n\n\t\t\t\t\t\tif (outputRange[key][0] === undefined) continue\n\n\t\t\t\t\t\teffect.values[key].set(transform(scrollY.progress, pageInputRange, outputRange[key]))\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\ttransformTrigger === \"onInView\"\n\t\t\t\t\t? {\n\t\t\t\t\t\t\ttarget: element ?? undefined,\n\t\t\t\t\t\t\toffset: [\"start end\", \"end end\"],\n\t\t\t\t\t\t}\n\t\t\t\t\t: undefined,\n\t\t\t)\n\t\t},\n\t\t[currentRouteKey, shouldReduceMotion, transformTrigger, triggerOnScroll, transformTargets, effectDisabled],\n\t)\n\n\tuseAttachOptionalSpring(effect.values, spring)\n\n\tuseOnRouteChange(() => {\n\t\tif (effectDisabled) return\n\t\tconst values = defaultValues(transformTargets, shouldReduceMotion)\n\t\tfor (const key of effectValuesKeys) {\n\t\t\teffect.values[key].set(values?.[key] ?? defaultFXValues[key])\n\t\t}\n\t})\n\n\treturn React.useMemo(() => {\n\t\treturn {\n\t\t\tvalues: effect.values,\n\t\t\tstyle: styleTransformEffectEnabled ? effectEnabledStyle : effectDisabledStyle,\n\t\t}\n\t}, [styleTransformEffectEnabled])\n}\n", "import { withFX } from \"../modules/withFX.tsx\"\n\n/**\n * @public\n * @deprecated\n */\nexport const withParallaxTransform = withFX\n/**\n * @public\n * @deprecated\n */\nexport const withStyleAppearEffect = withFX\n", "import type React from \"react\"\nimport { createContext, useContext, useRef } from \"react\"\nimport { isEqual } from \"../render/utils/isEqual.ts\"\n\ntype PresetProps = Record<string, unknown>\ntype ComponentPresets = Record<string, PresetProps>\n\n/**\n * This context is used to pass down component presets from the RichTextNode to\n * the component embeds in rich text in the CMS.\n */\n\nconst Context = /* @__PURE__ */ createContext<ComponentPresets>({})\n\ninterface ProviderProps {\n\tpresets: ComponentPresets\n\tchildren?: React.ReactNode\n}\n\nexport function ComponentPresetsProvider({ presets, children }: ProviderProps) {\n\tconst lastPresets = useRef<ComponentPresets>(presets)\n\n\tif (!isEqual(presets, lastPresets.current, false)) {\n\t\tlastPresets.current = presets\n\t}\n\n\treturn <Context.Provider value={lastPresets.current}>{children}</Context.Provider>\n}\n\ninterface ConsumerProps {\n\tcomponentIdentifier: string\n\tchildren: (props: PresetProps) => React.ReactNode\n}\n\nexport function ComponentPresetsConsumer({ componentIdentifier, children }: ConsumerProps) {\n\tconst componentPresets = useContext(Context)\n\tconst presetProps = componentPresets[componentIdentifier] ?? {}\n\n\treturn children(presetProps)\n}\n", "import React from \"react\"\nimport { useCloneChildrenWithPropsAndRef } from \"../components/utils/useCloneChildrenWithPropsAndRef.tsx\"\n\nexport interface ComponentViewport {\n\twidth?: string\n\theight?: number\n\ty?: number\n}\n\nconst ComponentViewportContext = /* @__PURE__ */ React.createContext<ComponentViewport>({})\n\nexport function useComponentViewport() {\n\treturn React.useContext(ComponentViewportContext)\n}\n\n/**\n * This context wraps all instances of smart components. It exposes the smart\n * component\u2019s dimensions so that the component can learn them during run time.\n * Unless the component doesn\u2019t declare that it supports this mechanism (via the\n * `@framerComponentViewportWidth` annotation) \u2013 in which case the dimensions\n * are set to `undefined`.\n * https://github.com/framer/FramerStudio/pull/16570#discussion_r1484244932\n */\nexport const ComponentViewportProvider = /* @__PURE__ */ React.forwardRef(function ComponentViewportProvider(\n\t{ width, height, y, children, ...rest }: React.PropsWithChildren<ComponentViewport>,\n\tref,\n) {\n\tconst componentViewport = React.useMemo(() => {\n\t\treturn { width, height, y }\n\t}, [width, height, y])\n\tconst cloneWithPropsAndRef = useCloneChildrenWithPropsAndRef(ref)\n\n\treturn (\n\t\t<ComponentViewportContext.Provider value={componentViewport}>\n\t\t\t{cloneWithPropsAndRef(children, rest)}\n\t\t</ComponentViewportContext.Provider>\n\t)\n})\n", "import { LayoutGroup, type MotionProps, type MotionStyle } from \"framer-motion\"\nimport React from \"react\"\nimport { AutomaticLayoutIds } from \"../components/AnimateLayout/LayoutIdContext.tsx\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\nimport { ComponentContainerContext } from \"../render/presentation/ComponentContainerContext.tsx\"\nimport { htmlElementAsMotionComponent } from \"../render/utils/htmlElementAsMotionComponent.ts\"\nimport { withGeneratedLayoutId } from \"../render/utils/withGeneratedLayoutId.tsx\"\nimport { NodeIdContext } from \"./NodeIdContext.tsx\"\nimport { useMaybeWrapComponentWithCodeBoundary } from \"./code-boundary/maybeWrapComponentWithCodeBoundary.tsx\"\n\ntype ContainerProps = {\n\tas?: keyof HTMLElementTagNameMap\n\tclassName?: string\n\tstyle?: MotionStyle | React.CSSProperties\n\t/** Whether the component container should be a motion.element or a plain HTML element. (Undefined if false or if codegenned before Jan 2025.) */\n\trendersWithMotion?: true\n\t/** The ID of the scope (web page or smart component) where the component instance is rendered. (Undefined if codegenned before Jan 2025.) */\n\tscopeId?: string\n\t/** The ID of the node that corresponds to the component instance. (Undefined if codegenned before Jan 2025.) */\n\tnodeId?: string\n\t/** Whether the component instance is authored by a user (= is a code component, not a smart one). (Undefined if false or if codegenned before Jan 2025.) */\n\tisAuthoredByUser?: true\n\t/** Whether the component we\u2019re wrapping is coming from the same project (true), or from somewhere else (undefined). (Undefined if false or if codegenned before Jan 2025.) */\n\tisModuleExternal?: true\n\t/** Whether the component is inside another component\u2019s slot. (Undefined if false or if codegenned before Jan 2025.) */\n\tinComponentSlot?: true\n\t// \u2193 Narrow the definition of `style` based on `rendersWithMotion`\n} & ({ rendersWithMotion: true; style?: MotionStyle } | { rendersWithMotion?: false; style?: React.CSSProperties }) &\n\tPick<MotionProps, \"layout\" | \"layoutId\" | \"layoutDependency\">\n\nconst ContainerInner = /* @__PURE__ */ React.forwardRef<HTMLDivElement, React.PropsWithChildren<ContainerProps>>(\n\tfunction ContainerInner(\n\t\t{ children, layoutId, as, scopeId, nodeId, isAuthoredByUser, isModuleExternal, inComponentSlot, ...props },\n\t\tref,\n\t) {\n\t\tconst outerLayoutId = useConstant(() => (layoutId ? `${layoutId}-container` : undefined))\n\t\tconst MotionComponent = htmlElementAsMotionComponent(as)\n\n\t\tconst clonedChildren = React.Children.map(children, child => {\n\t\t\treturn React.isValidElement<{ layoutId: string | null | undefined }>(child)\n\t\t\t\t? React.cloneElement(child, { layoutId })\n\t\t\t\t: child\n\t\t})\n\n\t\tconst childrenWithCodeBoundary = useMaybeWrapComponentWithCodeBoundary(\n\t\t\tclonedChildren,\n\t\t\tscopeId,\n\t\t\tnodeId,\n\t\t\tisAuthoredByUser,\n\t\t\tisModuleExternal,\n\t\t\tinComponentSlot,\n\t\t)\n\n\t\treturn (\n\t\t\t<MotionComponent layoutId={outerLayoutId} {...props} ref={ref}>\n\t\t\t\t<ComponentContainerContext.Provider value>\n\t\t\t\t\t<NodeIdContext.Provider value={nodeId ?? null}>\n\t\t\t\t\t\t<AutomaticLayoutIds enabled={false}>\n\t\t\t\t\t\t\t{/*\n                                    When the container is a direct descendent of a layout group effect we need to inherit that layout group\n                                    to support layout animations between sibling smart component instances. Otherwise only the id is inherited\n                                    to limit performance impact.\n                                */}\n\t\t\t\t\t\t\t<LayoutGroup id={layoutId ?? \"\"} inherit={props.layout ? true : \"id\"}>\n\t\t\t\t\t\t\t\t{childrenWithCodeBoundary}\n\t\t\t\t\t\t\t</LayoutGroup>\n\t\t\t\t\t\t</AutomaticLayoutIds>\n\t\t\t\t\t</NodeIdContext.Provider>\n\t\t\t\t</ComponentContainerContext.Provider>\n\t\t\t</MotionComponent>\n\t\t)\n\t},\n)\n\n/**\n * A container for smart & code components.\n * @internal\n */\nexport const Container = /* @__PURE__ */ withGeneratedLayoutId(ContainerInner)\n\n/**\n * A container for smart & code components that\u2019s used instead of @see Container when the component is inside a smart component.\n * @internal\n */\nexport const SmartComponentScopedContainer = /* @__PURE__ */ React.forwardRef<\n\tHTMLDivElement,\n\tReact.PropsWithChildren<ContainerProps>\n>(function SmartComponentScopedContainer(props, ref) {\n\tconst {\n\t\tas,\n\t\tchildren,\n\t\t// Code boundary-specific props\n\t\tscopeId,\n\t\tnodeId,\n\t\tisAuthoredByUser,\n\t\trendersWithMotion,\n\t\tisModuleExternal,\n\t\tinComponentSlot,\n\t\t// Other props, including some possibly used-passed ones\n\t\t...otherProps\n\t} = props\n\n\tconst childrenWithCodeBoundary = useMaybeWrapComponentWithCodeBoundary(\n\t\tchildren,\n\t\tscopeId,\n\t\tnodeId,\n\t\tisAuthoredByUser,\n\t\tisModuleExternal,\n\t\tinComponentSlot,\n\t)\n\n\t// Generally, this component could render any HTML element. Ideally, it would\u2019ve been typed as such, too \u2013\n\t// e.g. the type of `ref` would match the type of `props.as`. Instead, we\u2019re type-casting everything to `div`.\n\t// Why?\n\t//\n\t// 1) Properly typing everything seems to bring an immense amount of complexity, due to multiple issues\n\t//    with TypeScript turning union types into intersection types: https://framer-team.slack.com/archives/C3L0MQQ6L/p1732651329585059?thread_ts=1732651034.235219&cid=C3L0MQQ6L\n\t//    and with TypeScript erroring with TS2590 when you use JSX over React.createElement: https://framer-team.slack.com/archives/C3L0MQQ6L/p1732705478561269?thread_ts=1732651034.235219&cid=C3L0MQQ6L\n\t//    I\u2019d rather keep it straightforward and easy to maintain.\n\t// 2) Properly typing everything doesn\u2019t even bring that much value, as this component is never\n\t//    called directly by other code \u2013 it\u2019s only used in codegen.\n\t//\n\t// Note that type-casting to `div` isn\u2019t unheard of \u2013 e.g. `htmlElementAsMotionComponent` does it too.\n\tconst tagName = (props.as ?? \"div\") as \"div\"\n\n\tif (props.rendersWithMotion) {\n\t\tconst Component = htmlElementAsMotionComponent(tagName)\n\t\treturn (\n\t\t\t<NodeIdContext.Provider value={nodeId ?? null}>\n\t\t\t\t<Component\n\t\t\t\t\t{...otherProps}\n\t\t\t\t\tref={ref}\n\t\t\t\t\t// Passing `props.style` explicitly to allow TypeScript to narrow the type of `props.style` according\n\t\t\t\t\t// to the value of `props.rendersWithMotion`.\n\t\t\t\t\tstyle={props.style}\n\t\t\t\t>\n\t\t\t\t\t{childrenWithCodeBoundary}\n\t\t\t\t</Component>\n\t\t\t</NodeIdContext.Provider>\n\t\t)\n\t} else {\n\t\tconst Component = tagName\n\t\t// Omit Motion-specific props (if provided)\n\t\tconst { layoutId, layoutDependency, ...plainHTMLRenderableProps } = otherProps\n\t\treturn (\n\t\t\t<NodeIdContext.Provider value={nodeId ?? null}>\n\t\t\t\t{/* Passing `props.style` explicitly to allow TypeScript to narrow the type of `props.style` according\n                 to the value of `props.rendersWithMotion`. */}\n\t\t\t\t<Component {...plainHTMLRenderableProps} ref={ref} style={props.style}>\n\t\t\t\t\t{childrenWithCodeBoundary}\n\t\t\t\t</Component>\n\t\t\t</NodeIdContext.Provider>\n\t\t)\n\t}\n})\n", "import React from \"react\"\nimport { useLayoutId } from \"./useLayoutId.ts\"\n\n/**\n * Higher Order Component to provide a generated layoutId to the wrapped\n * component in the Framer preview, but preserving any user-specified layoutId\n * prop.\n *\n * @internal\n */\nexport const withGeneratedLayoutId = <T extends object>(Component: React.ComponentType<T>) =>\n\tReact.forwardRef((props: T, ref) => {\n\t\tconst layoutId = useLayoutId(props)\n\n\t\treturn <Component layoutId={layoutId} {...props} layoutIdKey={undefined} duplicatedFrom={undefined} ref={ref} />\n\t})\n", "import type { ErrorInfo, ReactNode } from \"react\"\nimport { Component, Suspense } from \"react\"\nimport { SuspenseThatPreservesDom } from \"../../router/SuspenseThatPreservesDom.tsx\"\nimport { nullFallback } from \"./NullFallback.tsx\"\nimport { collectErrorToAnalytics } from \"./collectErrorToAnalytics.tsx\"\nimport { logError } from \"./logger.ts\"\nimport { shouldEnableCodeBoundaries } from \"./shouldEnableCodeBoundaries.ts\"\n\ninterface CodeComponentBoundaryProps {\n\tchildren: ReactNode\n\tfallback: ReactNode\n\tgetErrorMessage: () => string\n}\n\n/**\n * A code boundary for code components. Ensures any errors thrown by code components\n * (either during SSR, or during client render) don\u2019t crash the whole page \u2013 and, instead,\n * just disable the code component (rendering `fallback` instead).\n *\n * The fallback is normally `null` (= the component is disabled completely), except when\n * the boundary is used by a code override \u2013 in which case, the fallback is the component\n * without the override.\n */\nexport function CodeComponentBoundary({ getErrorMessage, fallback, children }: CodeComponentBoundaryProps) {\n\tif (!shouldEnableCodeBoundaries()) {\n\t\treturn children\n\t}\n\n\treturn (\n\t\t<ServerSideErrorBoundary fallback={fallback}>\n\t\t\t<ClientSideErrorBoundary fallback={fallback} getErrorMessage={getErrorMessage}>\n\t\t\t\t{children}\n\t\t\t</ClientSideErrorBoundary>\n\t\t</ServerSideErrorBoundary>\n\t)\n}\n\n/**\n * Catches errors thrown by a code component during client rendering \u2013 and renders `fallback` (normally null) instead.\n */\nclass ClientSideErrorBoundary extends Component<\n\t{\n\t\tgetErrorMessage: () => string\n\t\tchildren: ReactNode\n\t\tfallback: ReactNode\n\t},\n\t{ hasError: boolean }\n> {\n\toverride state = { hasError: false }\n\n\tstatic getDerivedStateFromError() {\n\t\treturn { hasError: true }\n\t}\n\n\toverride componentDidCatch(error: unknown, errorInfo: ErrorInfo | undefined) {\n\t\tlogError(this.props.getErrorMessage(), errorInfo?.componentStack)\n\n\t\tcollectErrorToAnalytics(error, errorInfo)\n\t}\n\n\toverride render() {\n\t\tconst { children, fallback = nullFallback } = this.props\n\t\tconst { hasError } = this.state\n\n\t\treturn hasError ? fallback : children\n\t}\n}\n\n/**\n * Catches errors thrown by a code component during server rendering \u2013 and renders `fallback` (normally null) instead.\n *\n * This component is separate from `ClientSideErrorBoundary` because, as of React 18, React doesn\u2019t trigger\n * `getDerivedStateFromError`/`componentDidCatch` on the server. Instead, it renders a Suspense fallback\n * and re-tries rendering on the client.\n */\nfunction ServerSideErrorBoundary({ children, fallback = nullFallback }: { children: ReactNode; fallback: ReactNode }) {\n\treturn typeof window === \"undefined\" ? (\n\t\t// On the server, Suspense fallback is activated by errors. So we use the actual Suspense,\n\t\t// and render the actual error fallback if Suspense activates.\n\t\t<Suspense fallback={fallback}>{children}</Suspense>\n\t) : (\n\t\t// On the client, Suspense fallback is activated by data fetching. So we use SuspenseThatPreservesDom,\n\t\t// because we don\u2019t want to render a fallback if the boundary gets inadvertently activated.\n\t\t//\n\t\t// \u201CWhy won\u2019t you just render plain children without Suspense?\u201D Because that would cause a hydration mismatch\n\t\t// (the server has Suspense, the client doesn\u2019t).\n\t\t<SuspenseThatPreservesDom>{children}</SuspenseThatPreservesDom>\n\t)\n}\n", "import type React from \"react\"\nimport { Suspense, createContext, useContext } from \"react\"\nimport { shouldSuspenseBoundariesBeActive } from \"./error-boundary/SynchronousSuspenseErrorBoundary.tsx\"\n\nconst suspendPromise = /* @__PURE__ */ (() => (typeof window !== \"undefined\" ? new Promise<void>(() => {}) : null))()\n\nfunction Suspend(): React.ReactNode | never {\n\t// on the server, we never want to suspend on the fallback.\n\t// for the opt-out case: see SuspenseErrorBoundary's render function\n\tif (typeof window === \"undefined\" || shouldSuspenseBoundariesBeActive) {\n\t\treturn (\n\t\t\t<div\n\t\t\t\thidden\n\t\t\t\t// biome-ignore lint/security/noDangerouslySetInnerHtml: intentional, need to emit an HTML comment\n\t\t\t\tdangerouslySetInnerHTML={{ __html: \"<!-- SuspenseThatPreservesDOM fallback rendered -->\" }}\n\t\t\t/>\n\t\t)\n\t}\n\n\t// there is no reliable way to cleanup this promise after a suspended tree is rendered\n\t// e.g. `useEffect` will not be called again after the unsuspension.\n\t// the overhead of keeping one dangling promise around for is minimal (around 20 bytes).\n\tthrow suspendPromise\n}\nconst suspend = <Suspend />\n\nconst DisableSuspenseSuspenseThatPreservesDomContext = createContext(false)\nDisableSuspenseSuspenseThatPreservesDomContext.displayName = \"DisableSuspenseSuspenseThatPreservesDomContext\"\n\n/**\n * On the on-page canvas, we want to use `OnPageSuspense` instead. If we don't disable\n * `SuspenseThatPreservesDom` then `OnPageSuspense` catches the always pending promise. This will\n * cause the on-page canvas to never render.\n */\nexport function DisableSuspenseSuspenseThatPreservesDom({ children }: React.PropsWithChildren) {\n\treturn (\n\t\t<DisableSuspenseSuspenseThatPreservesDomContext.Provider value={true}>\n\t\t\t{children}\n\t\t</DisableSuspenseSuspenseThatPreservesDomContext.Provider>\n\t)\n}\n\n/**\n * This is a Suspense boundary that\u2019s usually inactive but can be toggled active. \u201CInactive\u201D means\n * that it effectively functions as a no-op component that simply renders its children. This is\n * opposed to regular Suspense boundaries, which are \u201Cactive\u201D because they render a fallback when\n * something inside them suspends.\n *\n * For why this exists and how we\u2019re using this, see\n * https://www.notion.so/framer/SuspenseThatPreservesDOM-1b0adf6e8c968089ae0dc158fc514e6b?pvs=4\n */\nexport function SuspenseThatPreservesDom({ children }: { children: React.ReactNode }) {\n\tconst isSuspenseBoundaryDisabled = useContext(DisableSuspenseSuspenseThatPreservesDomContext)\n\n\tif (isSuspenseBoundaryDisabled) {\n\t\treturn <>{children}</>\n\t}\n\n\treturn <Suspense fallback={suspend}>{children}</Suspense>\n}\n", "import type React from \"react\"\nimport type { ErrorInfo } from \"react\"\nimport { Component } from \"react\"\nimport { sendTrackingEvent } from \"../../utils/sendTrackingEvent.ts\"\nimport { getPleaseReportMessage } from \"../../utils/utils.ts\"\n\ninterface Props {\n\tchildren: React.ReactNode\n}\n\ninterface State {\n\terror?: unknown\n}\n\nexport let shouldSuspenseBoundariesBeActive = false\nexport const testing = {\n\tresetShouldSuspenseBoundariesBeActive() {\n\t\tshouldSuspenseBoundariesBeActive = false\n\t},\n}\n\n/**\n * This is an error boundary that catches React error #426 (https://react.dev/errors/426) \u2013\n * \u201CA component suspended while responding to synchronous input\u201D \u2013 and prevents it from crashing the\n * app when there are no active\u00B9 Suspense boundaries around the component that suspended.\n *\n * It does that by activating\u00B9 all SuspenseThatPreservesDOM boundaries. Critically, this relies on\n * an implicit assumption that there is at least one SuspenseThatPreservesDOM boundary around the\n * suspended component. This is true as of Mar 2025 (we have a bunch of granular\n * SuspenseThatPreserveDOM boundaries around the tree, and also a top-level catch-all\n * SuspenseThatPreserveDOM boundary in Router), but this might change.\n * - We don\u2019t have any hard logic or tests that enforces this assumption, but we do have a helpful\n *   log (in componentDidCatch) that hints what happened if the app still crashes despite activating\n *   all SuspenseThatPreservesDOM boundaries.\n * - If this assumption does ever change, and #426 starts causing crashes, the easy workaround is to\n *   wrap `return this.props.children` in a regular <Suspense> boundary.\n *\n * For more details about what this is and why it exists, see\n * https://www.notion.so/framer/SuspenseThatPreservesDOM-1b0adf6e8c968089ae0dc158fc514e6b?pvs=4\n *\n * \u00B9 \u2014 \u201CActive\u201D and \u201Cinactive\u201D are concrete terms; see\n * https://www.notion.so/framer/SuspenseThatPreservesDOM-1b0adf6e8c968089ae0dc158fc514e6b?pvs=4\n */\nexport class SynchronousSuspenseErrorBoundary extends Component<Props, State> {\n\toverride state: State = { error: undefined }\n\n\tstatic getDerivedStateFromError(error: unknown) {\n\t\treturn { error }\n\t}\n\n\t// Note: SynchronousSuspenseErrorBoundary is relying on some narrow implementation details of React\n\t// which we don\u2019t fully understand: https://www.notion.so/framer/SuspenseThatPreservesDOM-1b0adf6e8c968089ae0dc158fc514e6b?pvs=4#1d1adf6e8c96801a9ef2d6f2f0c27f8c\n\t//\n\t// As a side effect, `componentDidCatch` is usually *never* executed. If you do see the log below,\n\t// it means that you\u2019re experiencing a scenario not covered by our tests.\n\toverride componentDidCatch(error: unknown, errorInfo: undefined | ErrorInfo) {\n\t\tif (!isSuspense426Error(error)) return\n\n\t\tconst componentStack = errorInfo?.componentStack\n\n\t\t// biome-ignore lint/suspicious/noConsole: intentional\n\t\tconsole.error(\n\t\t\t\"Caught an error in SynchronousSuspenseErrorBoundary:\\n\\n\",\n\t\t\terror,\n\t\t\t\"\\n\\nComponent stack:\\n\",\n\t\t\tcomponentStack,\n\t\t\t\"\\n\\nThis error indicates a state update wasn\u2019t wrapped with `startTransition`. \" +\n\t\t\t\t\"Some of the UI might flash as a result. \" +\n\t\t\t\tgetPleaseReportMessage(\n\t\t\t\t\t\"If you are the author of this website, update external components and check recently added custom code or code overrides.\",\n\t\t\t\t),\n\t\t)\n\n\t\tconst stack = error instanceof Error && typeof error.stack === \"string\" ? error.stack : undefined\n\t\tsendTrackingEvent(\"published_site_load_recoverable_error\", {\n\t\t\tmessage: String(error),\n\t\t\tstack,\n\t\t\t// only log componentStack if we don't have a stack\n\t\t\tcomponentStack: stack ? undefined : componentStack,\n\t\t})\n\t}\n\n\toverride render() {\n\t\tconst error = this.state.error\n\t\tif (error === undefined) return this.props.children\n\n\t\tif (!isSuspense426Error(error)) throw error\n\n\t\t// Turn SuspenseThatPreservesDom boundaries into regular boundaries...\n\t\tshouldSuspenseBoundariesBeActive = true\n\n\t\t// ...and re-render the same content. The component that previously suspended will re-suspend again,\n\t\t// but now, that will simply make the nearest SuspenseThatPreservesDom boundary to render a fallback\n\t\t// instead of ignoring the suspension.\n\t\treturn this.props.children\n\t}\n}\n\n/**\n * This function detects when React throws https://react.dev/errors/426:\n *\n * > A component suspended while responding to synchronous input. This will cause the UI to be\n * > replaced with a loading indicator. To fix, updates that suspend should be wrapped with startTransition.\n *\n * This error is thrown when a setState update that\u2019s not wrapped in a startTransition causes some component\n * to suspend, *and* there are no active <Suspense> boundaries around that component to render a fallback.\n * Unless caught by an error boundary, it\u2019s a non-recoverable crash.\n */\nfunction isSuspense426Error(error: unknown): error is Error {\n\tconst unminifiedMessage = \"A component suspended while responding to synchronous input.\"\n\tconst minifiedMessage = \"Minified React error #426\"\n\n\treturn (\n\t\terror instanceof Error && (error.message.includes(unminifiedMessage) || error.message.includes(minifiedMessage))\n\t)\n}\n", "// biome-ignore lint/correctness/noUnusedImports: build fails without React imported\nimport React from \"react\"\n\nfunction NullFallback() {\n\treturn (\n\t\t<div\n\t\t\thidden\n\t\t\t// biome-ignore lint/security/noDangerouslySetInnerHtml: needed for the comment\n\t\t\tdangerouslySetInnerHTML={{ __html: \"<!-- Code boundary fallback rendered -->\" }}\n\t\t/>\n\t)\n}\n\n/** This is used as a code boundary fallback, to make it very clear why something hides when we hide it. */\nexport const nullFallback = <NullFallback />\n", "import type { ErrorInfo } from \"react\"\nimport { sendTrackingEvent } from \"../../utils/sendTrackingEvent.ts\"\nimport { isWindow } from \"../../utils/utils.ts\"\n\nexport function collectErrorToAnalytics(error: unknown, errorInfo?: ErrorInfo) {\n\tif (!isWindow) return\n\t// we only want to collect 1%, because this can be quite noisy (floods the data pipeline)\n\tif (Math.random() > 0.01) return\n\n\tconst stack = error instanceof Error && typeof error.stack === \"string\" ? error.stack : null\n\tconst componentStack = errorInfo?.componentStack\n\n\tsendTrackingEvent(\"published_site_load_recoverable_error\", {\n\t\tmessage: String(error),\n\t\tstack,\n\t\t// only log componentStack if we don't have a stack\n\t\tcomponentStack: stack ? undefined : componentStack,\n\t})\n}\n", "export function logError(...args: unknown[]) {\n\t// Reduce the console noise in Jest tests\n\tif (process.env.NODE_ENV === \"test\") return\n\n\t// biome-ignore lint/suspicious/noConsole: intentional logging\n\tconsole.error(...args)\n}\n", "import { RenderTarget } from \"../../render/types/RenderEnvironment.ts\"\n\nexport function shouldEnableCodeBoundaries() {\n\t// Code boundaries are disabled on the canvas because the canvas has a separate mechanism for handling them [1].\n\t//\n\t// \u201CHold on, but aren\u2019t code boundaries only used in code generation, not on canvas?\u201D True, but code-generated\n\t// code is still often evaluated on the canvas \u2013 e.g. when you render a smart component instance.\n\t//\n\t// [1]: https://github.com/framer/FramerStudio/pull/19170#discussion_r1836711927\n\treturn RenderTarget.current() !== RenderTarget.canvas\n}\n", "import type { ErrorInfo, ReactNode } from \"react\"\nimport { Component } from \"react\"\nimport { collectErrorToAnalytics } from \"./collectErrorToAnalytics.tsx\"\n\ninterface Props {\n\tchildren?: ReactNode\n}\n\ninterface State {\n\thasError: boolean\n}\n\n/**\n * A previous, deprecated version of the code boundary. Replaced by ./CodeComponentBoundary.tsx.\n * For more details, see https://www.notion.so/framer/Code-Boundaries-153adf6e8c96803dbd27ffe5cfd1e874?pvs=4#157adf6e8c9680a593cad4dfc6dd9cec\n * @deprecated\n */\nexport class DeprecatedContainerErrorBoundary extends Component<Props, State> {\n\toverride state = { hasError: false }\n\n\t// We use `componentDidCatch` instead of `static getDerivedStateFromError()` because the latter could also catch hydration errors.\n\t// Hydration errors are recoverable by React, so we don't want to hide the coponent in that case (since the tree will not unmount).\n\toverride componentDidCatch(error: unknown, errorInfo: undefined | ErrorInfo) {\n\t\tconst componentStack = errorInfo?.componentStack\n\t\t// biome-ignore lint/suspicious/noConsole: intentional\n\t\tconsole.error(\n\t\t\t\"Error in component (see previous log). This component has been hidden. Please check any custom code or code overrides to fix.\",\n\t\t\tcomponentStack,\n\t\t)\n\t\tthis.setState({ hasError: true })\n\n\t\tcollectErrorToAnalytics(error, errorInfo)\n\t}\n\n\toverride render() {\n\t\tconst { children } = this.props\n\t\tconst { hasError } = this.state\n\n\t\treturn hasError ? null : children\n\t}\n}\n", "import type { ExternalComponent } from \"@framerjs/shared/src/ssg/externalComponent.ts\"\nimport React from \"react\"\n\nconst ExternalComponentContext = /* @__PURE__ */ (() => React.createContext<ExternalComponent | undefined>(undefined))()\n\n/**\n * In Framer, a component can be project-local (if it\u2019s defined in the same project it\u2019s used in),\n * or project-external (if it comes from a different project).\n *\n * This hook returns how deeply nested the component is inside project-external components,\n * plus the scope of the nearest external component. For example, if you have:\n *\n * /some-web-page          (defined in projectId: AAA, scopeId: not applicable)\n *   <HeroComponent>       (defined in projectId: AAA, scopeId: /some-web-page)\n *     <DesignSystemHero>  (defined in projectId: BBB [note: external!], scopeId: <HeroComponent>)\n *       <HeroMobile>      (defined in projectId: BBB, scopeId: <DesignSystemHero>)\n *         <Ticker>        (defined in projectId: CCC [note: external!], scopeId: <HeroMobile>)\n *           <TickerSlot>  (defined in projectId: BBB, scopeId: <HeroMobile>)\n *\n * then calling `useNearestExternalComponent()` inside `<TickerSlot>` will return `{ level:2, scopeId: HeroMobile }`.\n */\nexport function useNearestExternalComponent(): ExternalComponent | undefined {\n\treturn React.useContext(ExternalComponentContext)\n}\n\n/**\n * Retrieves the top-most external component in the tree.\n */\nexport function useFurthestExternalComponent(): ExternalComponent | undefined {\n\tconst nearestExternalComponent = useNearestExternalComponent()\n\tconst furthestExternalComponent = React.useMemo(() => {\n\t\tif (!nearestExternalComponent) return undefined\n\n\t\tlet item = nearestExternalComponent\n\t\twhile (item.parent && item.parent.level > 0) {\n\t\t\titem = item.parent\n\t\t}\n\t\treturn item\n\t}, [nearestExternalComponent])\n\n\treturn furthestExternalComponent\n}\n\n/**\n * As of Dec 2024, this component is used to wrap project-external components. Wrapping happens every time\n * an external component is encountered, even if it\u2019s already nested inside other external component.\n *\n * For example, if you have:\n *\n * /page                       (defined in projectId: AAA)\n *   <HeroComponent>           (defined in projectId: AAA)\n *     <DesignSystemHero />    (defined in projectId: BBB)\n *       <HeroMobile />        (defined in projectId: BBB)\n *         <Ticker>            (defined in projectId: CCC)\n *           <TickerSlot />    (defined in projectId: BBB)\n *\n * then <DesignSystemHero> and <Ticker> will each be wrapped in an `IsExternalComponent` boundary, since they\u2019re\n * external to projects they\u2019re used in.\n */\nexport function IsExternalComponent({\n\tchildren,\n\tscopeId,\n\tnodeId,\n}: {\n\tchildren: React.ReactNode\n\tscopeId: string\n\tnodeId: string\n}) {\n\tconst parent = useNearestExternalComponent()\n\n\tconst newValue = React.useMemo(\n\t\t() => ({ level: (parent?.level ?? 0) + 1, scopeId, nodeId, parent }),\n\t\t[scopeId, nodeId, parent],\n\t)\n\treturn <ExternalComponentContext.Provider value={newValue}>{children}</ExternalComponentContext.Provider>\n}\n", "const CRASH_ERROR_MESSAGE_PREFIX = \"code-crash:\"\n\nfunction formatCodeCrashLocationFromSourceNode(scopeId: string, nodeId: string) {\n\treturn `${CRASH_ERROR_MESSAGE_PREFIX}${scopeId}:${nodeId}`\n}\n\nexport function parseSourceNodeFromCodeCrashLocation(crashLocation: string) {\n\tif (!crashLocation.startsWith(CRASH_ERROR_MESSAGE_PREFIX)) return null\n\n\tconst partsArray = crashLocation.split(\":\")\n\tif (partsArray.length !== 3) return null\n\n\tconst [, scopeId, nodeId] = partsArray\n\tif (!scopeId || !nodeId) return null\n\n\treturn { scopeId, nodeId }\n}\n\nexport function getErrorMessageForComponent(scopeId: string, nodeId: string) {\n\treturn getErrorMessageFor(\"component\", scopeId, nodeId)\n}\n\nexport function getErrorMessageForOverride(scopeId: string, nodeId: string) {\n\treturn getErrorMessageFor(\"override\", scopeId, nodeId)\n}\n\nexport function getErrorMessageFor(element: \"component\" | \"override\", scopeId: string, nodeId: string) {\n\treturn (\n\t\t`A code ${element} crashed while rendering due to the error above. ` +\n\t\t`To find and fix it, open the project in the editor \u2192 open Quick Actions (press Cmd+K or Ctrl+K) \u2192 paste this: ${formatCodeCrashLocationFromSourceNode(scopeId, nodeId)} \u2192 click \u201CShow Layer\u201D.`\n\t)\n}\n", "import { isUndefined } from \"../../utils/utils.ts\"\n\n/**\n * We want to apply a code boundary around two kinds of component instances:\n * 1) all local instances of local code components\n * 2) all local instances of external components (both code and smart)\n *\n * All other components won\u2019t get a code boundary \u2013 and will, therefore, propagate\n * their errors upwards to either 1) or 2).\n *\n * For why we\u2019re treating external components like that, see https://www.notion.so/framer/Code-Boundaries-153adf6e8c96803dbd27ffe5cfd1e874#153adf6e8c9680689438dbe7cf310461\n */\nexport function shouldWrapComponentWithBoundary(\n\tscopeIdOfThisComponent: string,\n\tscopeIdOfNearestExternalComponent: string | undefined,\n\texternalComponentLevel: number | undefined,\n\tisAuthoredByUser: boolean,\n\tisExternalComponent: boolean,\n\tinComponentSlot: boolean,\n) {\n\tconst isLocalComponentInstance = isNodeLocalToProject(\n\t\tscopeIdOfThisComponent,\n\t\tscopeIdOfNearestExternalComponent,\n\t\texternalComponentLevel,\n\t\tinComponentSlot,\n\t)\n\n\t// Note that the boolean expression below can be simplified, but I\u2019m keeping it\n\t// explicit to match cases from the design doc.\n\treturn (\n\t\t// case 1: all (local instances) of (local) (code components)\n\t\t(isLocalComponentInstance && !isExternalComponent && isAuthoredByUser) ||\n\t\t// case 2: all (local instances) of (external components)\n\t\t(isLocalComponentInstance && isExternalComponent)\n\t)\n}\n\n/**\n * We want to apply a code boundary only to overrides that wrap project-local frames.\n *\n * All overrides applied inside external components will not get a code boundary \u2013\n * and will, therefore, propagate their errors upwards to the external component.\n *\n * For why we\u2019re treating external components like that, see https://www.notion.so/framer/Code-Boundaries-153adf6e8c96803dbd27ffe5cfd1e874#153adf6e8c9680689438dbe7cf310461\n */\nexport function shouldWrapOverrideWithBoundary(\n\tscopeIdOfNodeWithOverride: string,\n\tscopeIdOfNearestExternalComponent: string | undefined,\n\texternalComponentLevel: number | undefined,\n\tinComponentSlot: boolean,\n) {\n\treturn isNodeLocalToProject(\n\t\tscopeIdOfNodeWithOverride,\n\t\tscopeIdOfNearestExternalComponent,\n\t\texternalComponentLevel,\n\t\tinComponentSlot,\n\t)\n}\n\nfunction isNodeLocalToProject(\n\tscopeIdOfThisNode: string,\n\tscopeIdOfNearestExternalComponent: string | undefined,\n\texternalComponentLevel: number | undefined,\n\tinComponentSlot: boolean,\n) {\n\t// We know a component instance is local when it\u2019s not nested inside any external component.\n\tif (isUndefined(externalComponentLevel)) return true\n\n\t// \u201CTicker edge case\u201D:\n\t//\n\t// Imagine a Framer customer has a website page that uses Ticker. The page will look like this:\n\t//\n\t// \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\t// \u2502 Web page                 \u2502\n\t// \u2502                          \u2502          xxxx\n\t// \u2502                          \u2502\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500> x  x\n\t// \u2502                          \u2502\u2502         xxxx\n\t// \u2502                          \u2502\u2502\n\t// \u2502     oooooooooooooooo     \u2502\u2502\n\t// \u2502     o Ticker       o     \u2502\u2502         xxxxxxx\n\t// \u2502     o              o     \u2502\u2502 \u250C\u2500\u2500\u2500\u2500\u2500> x     x\n\t// \u2502     o xxxx xxxxxxx o     \u2502\u2502 \u2502       xxxxxxx\n\t// \u2502     o x  x x     x o\u2500\u2500\u2500\u2500\u2500\u253C\u2534\u2500\u2518\n\t// \u2502     o xxxx xxxxxxx o     \u2502\n\t// \u2502     o              o     \u2502\n\t// \u2502     oooooooooooooooo     \u2502\n\t// \u2502                          \u2502\n\t// \u2502                          \u2502\n\t// \u2502                          \u2502\n\t// \u2502                          \u2502\n\t// \u2502                          \u2502\n\t// \u2502                          \u2502\n\t// \u2502                          \u2502\n\t// \u2502                          \u2502\n\t// \u2502                          \u2502\n\t// \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n\t//\n\t// Here, the ooo... rectangle is a Ticker (which is an external component), and xxx...\n\t// rectangles are ticker slots (which are local to the project).\n\t//\n\t// To the user, ticker slots live in the same project the web page lives. If some component\n\t// inside a ticker slot crashes, obviously, only that component should be disabled.\n\t//\n\t// However, to React, the component tree looks different:\n\t// <WebPage>\n\t//   <div className=\"something-whatever\">\n\t//     <IsExternalComponent>\n\t//       <Ticker>\n\t//         <div className=\"ticker-slot-1\">\n\t//           <TickerSlot1 />\n\t//         </div>\n\t//         <div className=\"ticker-slot-2\">\n\t//           <TickerSlot2 />\n\t//         </div>\n\t//       </Ticker>\n\t//     </IsExternalComponent>\n\t//   </div>\n\t// </WebPage>\n\t//\n\t// To React, ticker slots live *inside* Ticker. And therefore, because Ticker is external\n\t// and is wrapped with <IsExternalComponent>, they live with `externalComponentLevel === 1`,\n\t// not `externalComponentLevel === 0`. This means checking just `externalComponentLevel === 0`\n\t// is not sufficient.\n\t//\n\t// This is the \u201CTicker edge case\u201D. Any external component with slots will have this problem.\n\t// Thus, we also need to check one more scenario.\n\n\tconst nodeIsDefinedInSameScopeAsExternalComponent = scopeIdOfThisNode === scopeIdOfNearestExternalComponent\n\n\tif (\n\t\t// We know a component instance is local when it\u2019s nested inside one external component,\n\t\texternalComponentLevel === 1 &&\n\t\t// and it lives in a slot,\n\t\tinComponentSlot &&\n\t\t// and it\u2019s a slot of *that sole external component* (and not some other local component\n\t\t// with slots that lives inside the external component).\n\t\tnodeIsDefinedInSameScopeAsExternalComponent\n\t) {\n\t\treturn true\n\t}\n\n\treturn false\n}\n", "import type React from \"react\"\nimport { isUndefined } from \"../../utils/utils.ts\"\nimport { useLibraryFeatures } from \"../LibraryFeaturesContext.ts\"\nimport { CodeComponentBoundary } from \"./CodeComponentBoundary.tsx\"\nimport { DeprecatedContainerErrorBoundary } from \"./DeprecatedContainerErrorBoundary.tsx\"\nimport { IsExternalComponent, useNearestExternalComponent } from \"./ExternalComponentContext.tsx\"\nimport { getErrorMessageForComponent } from \"./errorMessages.ts\"\nimport { shouldWrapComponentWithBoundary } from \"./shouldWrapWithBoundary.ts\"\n\n/**\n * Wraps passed children (which are presumed to be a smart or code component) with a code boundary, if necessary.\n */\nexport function useMaybeWrapComponentWithCodeBoundary(\n\tchildren: React.ReactNode,\n\tscopeId?: string,\n\tnodeId?: string,\n\t/** @see ContainerProps.isAuthoredByUser */\n\tisAuthoredByUser?: boolean,\n\t/** @see ContainerProps.isModuleExternal */\n\tisModuleExternal?: boolean,\n\t/** @see ContainerProps.inComponentSlot */\n\tinComponentSlot?: boolean,\n) {\n\tconst nearestExternalComponent = useNearestExternalComponent()\n\tconst { disableCustomCode } = useLibraryFeatures()\n\n\tif (\n\t\t// Those props will either be all undefined, which means the Container hasn\u2019t yet been\n\t\t// re-serialized since we introduced code boundaries, and we should use the old\n\t\t// ContainerErrorBoundary \u2013 or all defined, which means we have enough information to use\n\t\t// the new boundary.\n\t\tisUndefined(scopeId) ||\n\t\tisUndefined(nodeId)\n\t) {\n\t\treturn <DeprecatedContainerErrorBoundary>{children}</DeprecatedContainerErrorBoundary>\n\t}\n\n\tif (disableCustomCode && isAuthoredByUser) {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tpadding: \"12px 16px\",\n\t\t\t\t\t// Standard error box styles\n\t\t\t\t\tborderWidth: 1,\n\t\t\t\t\tborderRadius: 6,\n\t\t\t\t\tborderStyle: \"solid\",\n\t\t\t\t\tborderColor: \"rgba(149, 149, 149, 0.15)\",\n\t\t\t\t\tbackgroundColor: \"rgba(149, 149, 149, 0.1)\",\n\t\t\t\t\tfontSize: 12,\n\t\t\t\t\tcolor: \"#a5a5a5\",\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\tCode component disabled\n\t\t\t</div>\n\t\t)\n\t}\n\n\tconst shouldWrapWithBoundary = shouldWrapComponentWithBoundary(\n\t\tscopeId,\n\t\tnearestExternalComponent?.scopeId,\n\t\tnearestExternalComponent?.level,\n\t\tisAuthoredByUser ?? false,\n\t\tisModuleExternal ?? false,\n\t\tinComponentSlot ?? false,\n\t)\n\n\tif (shouldWrapWithBoundary) {\n\t\tchildren = (\n\t\t\t<CodeComponentBoundary getErrorMessage={getErrorMessageForComponent.bind(null, scopeId, nodeId)} fallback={null}>\n\t\t\t\t{children}\n\t\t\t</CodeComponentBoundary>\n\t\t)\n\t}\n\n\tif (isModuleExternal) {\n\t\tchildren = (\n\t\t\t<IsExternalComponent scopeId={scopeId} nodeId={nodeId}>\n\t\t\t\t{children}\n\t\t\t</IsExternalComponent>\n\t\t)\n\t}\n\n\treturn children\n}\n", "import type { MotionProps, Point, SpringOptions } from \"framer-motion\"\nimport {\n\tanimate,\n\tcancelFrame,\n\tframe,\n\tuseMotionValue,\n\tuseReducedMotionConfig,\n\tuseSpring,\n\tuseTransform,\n} from \"framer-motion\"\nimport type { CSSProperties, JSXElementConstructor, PropsWithChildren } from \"react\"\nimport {\n\tSuspense,\n\tcreateContext,\n\tmemo,\n\tstartTransition,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseId,\n\tuseLayoutEffect,\n\tuseRef,\n\tuseState,\n} from \"react\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\nimport { assertNever } from \"../utils/assert.ts\"\nimport { safeWindow } from \"../utils/safeWindow.ts\"\nimport { isEmptyObject } from \"../utils/utils.ts\"\nimport type { Alignment, Placement } from \"./floatingPositionSafeAreaStyle.ts\"\nimport { useForceUpdate } from \"./useForceUpdate.ts\"\nimport { withCSS } from \"./withCSS.tsx\"\n\ntype CustomCursorHash = string\n\ninterface CursorDefinition {\n\tcomponent: JSXElementConstructor<MotionProps & { variant: string | undefined; ref: unknown; className?: string }>\n\toffset: Point | null\n\ttransition: SpringOptions | undefined\n\tvariant: string | undefined\n\tplacement: Placement | undefined\n\talignment: Alignment | undefined\n}\n\ntype RegisterCursors = (cursors: Record<CustomCursorHash, CursorDefinition>) => void\ntype Unregister = () => void\n\ninterface Context {\n\tonRegisterCursors: (callback: RegisterCursors) => Unregister\n\tregisterCursors: (cursors: Record<CustomCursorHash, CursorDefinition>, id: string) => void\n}\n\nconst CustomCursorContext = /* @__PURE__ */ createContext<Context>({\n\tonRegisterCursors: () => () => {},\n\tregisterCursors: () => {},\n})\n\nconst replaceCursorClassName = /* @__PURE__ */ \"framer-cursor-none\"\nconst cursorComponentClassName = /* @__PURE__ */ \"framer-pointer-events-none\"\n\nfunction getActiveDefinitions(\n\tmap: Map<string, CustomCursorHash[]>,\n\tpreviousDefinitions: Record<CustomCursorHash, CursorDefinition>,\n\tnewDefinitions: Record<CustomCursorHash, CursorDefinition>,\n): Record<CustomCursorHash, CursorDefinition> {\n\tconst allCursors: Record<CustomCursorHash, CursorDefinition> = {}\n\tfor (const [, hashes] of map) {\n\t\tfor (const hash of hashes) {\n\t\t\tconst value = allCursors[hash] ?? previousDefinitions[hash] ?? newDefinitions[hash]\n\t\t\tif (value) allCursors[hash] = value\n\t\t}\n\t}\n\treturn allCursors\n}\n\n/**\n * Wrap the entire website in a context that provides an event-emitter which\n * facilitates:\n *  1. Web pages to record their cursors to the global list\n *  2. The Custom Cursor implementation to update whenever the list changes.\n *\n * This is slight overkill, as there should only ever be 1\n * <CustomCursorComponent/>, but this architecture ensures that future changes\n * can't accidentally rerender the entire webpage at 60fps, which would be a huge\n * performance hit.\n */\nconst CustomCursorContextProvider = /* @__PURE__ */ memo(function CustomCursorList({ children }: PropsWithChildren) {\n\tconst value = useConstant(() => {\n\t\tconst events = new Set<RegisterCursors>()\n\t\tlet allCursors: Record<CustomCursorHash, CursorDefinition> = {}\n\t\t// Track hashes registered by calling hooks. When the hook unmounts, we\n\t\t// remove it from the map. Subsequent calls to registerCursors will\n\t\t// garbage collect unused cursor definitions. When all hashes are\n\t\t// unregistered, CustomCursor can improve performance by not listening\n\t\t// to mouse moves and checking for cursor attribute.\n\t\tconst byCaller = new Map<string, CustomCursorHash[]>()\n\t\treturn {\n\t\t\tonRegisterCursors: (callback: RegisterCursors): Unregister => {\n\t\t\t\tcallback(allCursors)\n\t\t\t\tevents.add(callback)\n\t\t\t\treturn () => events.delete(callback)\n\t\t\t},\n\t\t\tregisterCursors: (cursors: Record<CustomCursorHash, CursorDefinition>, id: string) => {\n\t\t\t\tbyCaller.set(id, Object.keys(cursors))\n\n\t\t\t\tallCursors = getActiveDefinitions(byCaller, allCursors, cursors)\n\n\t\t\t\tfor (const callback of events) callback(allCursors)\n\n\t\t\t\treturn () => {\n\t\t\t\t\tbyCaller.delete(id)\n\t\t\t\t}\n\t\t\t},\n\t\t}\n\t})\n\n\t// Don't show custom cursors when the user has the reduced motion\n\t// accessibility option enabled, and the creator of the website has flagged\n\t// that they wish to hide cursors in this case.\n\tconst shouldReduceMotion = useReducedMotionConfig()\n\n\treturn (\n\t\t<CustomCursorContext.Provider value={value}>\n\t\t\t{children}\n\t\t\t{!shouldReduceMotion && <CustomCursorComponent />}\n\t\t</CustomCursorContext.Provider>\n\t)\n})\n\nexport const CustomCursorHost = /* @__PURE__ */ (() =>\n\twithCSS(\n\t\tCustomCursorContextProvider,\n\t\t[\n\t\t\t`.${replaceCursorClassName}, .${replaceCursorClassName} * { cursor: none !important; }`,\n\t\t\t`.${cursorComponentClassName}, .${cursorComponentClassName} * { pointer-events: none !important; }`,\n\t\t],\n\t\t\"framer-lib-cursors-host\",\n\t))()\n\nconst staticCursorStyle: CSSProperties = /* @__PURE__ */ (() => ({\n\tposition: \"fixed\",\n\ttop: 0,\n\tleft: 0,\n\tzIndex: 12 + 1, // Max framer z-index + 1\n\tpointerEvents: \"none\",\n}))()\n\nfunction customCursorReplacesNativeCursor(cursor: CursorDefinition | null | undefined): boolean {\n\tif (!cursor) return false\n\tif (cursor.placement || cursor.alignment) return false\n\treturn true\n}\n\nfunction valueForCursorAlignment(alignment: Alignment): string {\n\tswitch (alignment) {\n\t\tcase \"start\":\n\t\t\treturn \"0%\"\n\t\tcase \"center\":\n\t\t\treturn \"-50%\"\n\t\tcase \"end\":\n\t\t\treturn \"-100%\"\n\t\tdefault:\n\t\t\tassertNever(alignment)\n\t}\n}\n\nfunction getCenteringTransform(placement: Placement | undefined, alignment: Alignment | undefined = \"center\"): string {\n\tswitch (placement) {\n\t\tcase \"top\":\n\t\t\treturn `${valueForCursorAlignment(alignment)}, -100%`\n\t\tcase \"right\":\n\t\t\treturn `0%, ${valueForCursorAlignment(alignment)}`\n\t\tcase \"bottom\":\n\t\t\treturn `${valueForCursorAlignment(alignment)}, 0%`\n\t\tcase \"left\":\n\t\t\treturn `-100%, ${valueForCursorAlignment(alignment)}`\n\t\tdefault:\n\t\t\treturn \"-50%, -50%\"\n\t}\n}\n\nexport const portalIdAttribute = \"data-framer-portal-id\"\n\n/**\n * Get the custom cursor based on the element under the pointer. Elements in a\n * Framer site specify the cursor via an attribute that sets a hash of all of\n * the cursor settings. This hash corresponds to an entry that contains the\n * settings and component and is reported to the CustomCursorContext by the web\n * page that requires it on mount.\n *\n * Using a data-attribute and elementFromPoint has several benefits over the\n * alternative (which is wrapping each layer that sets or modifies a custom\n * cursor in a Higher Order Component that tracks mouseenter/exit) for several\n * reasons:\n * 1. It allows us to easily provide custom cursors to layers that may or may\n *    not support this higher order component. For example, in the future we can\n *    introduce a ControlType.CustomCursor that will allow any layer in a Smart\n *    Component to update the cursor without the layer in that Smart Component\n *    needing to change its behavior.\n * 2. It means we do not have to maintain a state machine or \"stack\" of layers\n *    that have recorded the cursor has entered/exited since ancestors don't\n *    report a mouseleave when the cursor moves into a descendant). Such a stack\n *    may be prone to errors if the window is blurred or the user switches tabs,\n *    or in cases where the DOM isn't setup as expected.\n * 3. It means that the cursor hit detection is done by the browser, which means\n *    it is more likely to match the native cursor.\n *\n * Their are 2 downsides to this approach:\n * 1. We must call elementFromPoint once per mousemove animation frame (at\n *    least) and iterate through the entries until we find an element with an\n *    attribute. This is theoretically expensive in a project where many\n *    elements are stacked on top of each other. However in practice, this\n *    number is rarely in the large double digits, so doesn't represent a real\n *    performance issue at this time.\n * 2. If the browser does not trigger a mousemove event, the cursor will not\n *    update even if content underneath changes.\n *\n * It may be possible to cache the results of this function by using\n * document.elementFromPoint and returning the last result for that top element.\n * However, this can be problematic if the top element doesn't change, but\n * elements underneath do. For that reason that optimization hasn't been\n * included at this time.\n *\n * It's important to note that elementFromPoint triggers style recalculation\n * and can trigger layout. It's important this is called in the read phase to\n * reduce the likelihood of this happening.\n */\nfunction getCursorHash(x: number, y: number): CustomCursorHash | null | undefined {\n\tlet el = document.elementFromPoint(x, y)\n\twhile (el) {\n\t\tif (el === document.body) return undefined\n\t\tconst value = el.getAttribute(\"data-framer-cursor\")\n\t\tif (value) return value\n\t\tif (el.hasAttribute(portalIdAttribute)) {\n\t\t\tconst id = el.getAttribute(portalIdAttribute)\n\t\t\tel = el.parentElement\n\t\t\tif (id) el = document.getElementById(id) ?? el\n\t\t} else {\n\t\t\tel = el.parentElement\n\t\t}\n\t}\n\treturn undefined\n}\n\ninterface State {\n\tcursors: Record<CustomCursorHash, CursorDefinition>\n\tcursorHash: CustomCursorHash | null | undefined\n}\n\nconst CustomCursorComponent = /* @__PURE__ */ memo(function CustomCursorComponent() {\n\tconst { onRegisterCursors } = useContext(CustomCursorContext)\n\t// By default, we don't SSR anything as mobile devices usually have less power than those that have pointers.\n\tconst [hasHoverCapability, setHasHoverCapability] = useState(false)\n\n\tconst pointerX = useMotionValue(0)\n\tconst pointerY = useMotionValue(0)\n\tconst opacity = useMotionValue(0)\n\n\tconst cursorRef = useRef<HTMLElement>(null)\n\tconst internalState = useRef<State>({ cursors: {}, cursorHash: undefined })\n\tconst forceRender = useForceUpdate()\n\n\tuseLayoutEffect(() => {\n\t\tconst noHoverMQ = safeWindow.matchMedia(\"(any-hover: none)\")\n\t\tfunction updateRender(e: MediaQueryListEvent) {\n\t\t\tif (e.matches) {\n\t\t\t\tstartTransition(() => setHasHoverCapability(false))\n\t\t\t} else {\n\t\t\t\t// Enabling via startTransition here would make UX worse.\n\t\t\t\t// eslint-disable-next-line framer-studio/no-setstate-without-transition\n\t\t\t\tsetHasHoverCapability(true)\n\t\t\t}\n\t\t}\n\t\tnoHoverMQ.addEventListener(\"change\", updateRender)\n\n\t\tif (!noHoverMQ.matches) {\n\t\t\t// Enabling via startTransition here would make UX worse.\n\t\t\t// eslint-disable-next-line framer-studio/no-setstate-without-transition\n\t\t\tsetHasHoverCapability(true)\n\t\t}\n\n\t\treturn () => {\n\t\t\tnoHoverMQ.removeEventListener(\"change\", updateRender)\n\t\t}\n\t}, [])\n\n\tuseEffect(() => {\n\t\tif (!hasHoverCapability) return\n\n\t\tlet x = 0\n\t\tlet y = 0\n\n\t\tfunction updateValues() {\n\t\t\tpointerX.set(x)\n\t\t\tpointerY.set(y)\n\n\t\t\t// Fade in the cursor as soon as it moves. This is a noop if the\n\t\t\t// opacity is already 1, so we don't have to track any state.\n\t\t\t// @TODO: Ignored for now, but should re-check later.\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\t\tanimate(opacity, 1, { type: \"tween\", duration: 0.2 })\n\t\t}\n\n\t\t// Hit test what is under the cursor every frame in the read phase. This\n\t\t// reduces the chances that the DOM has changed, and reduces the\n\t\t// likelihood that document.elementFromPoint triggers layout. If the\n\t\t// cursor needs to change, schedule a rerender in the update phase.\n\t\t// Testing in every frame allows the custom cursor to update to elements\n\t\t// changing underneath it without the user moving the cursor.\n\t\tconst updateVariant = () => {\n\t\t\tif (isEmptyObject(internalState.current.cursors)) return\n\n\t\t\tconst hash = getCursorHash(x, y)\n\t\t\tif (hash !== internalState.current.cursorHash) {\n\t\t\t\tinternalState.current.cursorHash = hash\n\n\t\t\t\t// startTransition here would make UX worse.\n\t\t\t\t// eslint-disable-next-line framer-studio/no-setstate-without-transition\n\t\t\t\tframe.update(() => forceRender())\n\t\t\t}\n\t\t}\n\n\t\tfunction updateCursor(e: PointerEvent) {\n\t\t\t// Devices like iPads could provide a hover capability by e.g. plugging in a mouse. But if it's not used, we cancel the rAF loop.\n\t\t\tif (e.pointerType === \"touch\") {\n\t\t\t\tcancelFrame(updateVariant)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tframe.read(updateVariant, true)\n\t\t\tx = e.clientX\n\t\t\ty = e.clientY\n\t\t\tframe.update(updateValues)\n\t\t}\n\n\t\t// Rethrow events dispatched to the document to the cursor component.\n\t\t// This allows pressed variants to be triggered, or changing the cursor\n\t\t// variant on click.\n\t\tfunction fireEventToTarget(e: PointerEvent) {\n\t\t\tif (e.target === cursorRef.current || !cursorRef.current) return\n\n\t\t\tconst event = new PointerEvent(e.type, {\n\t\t\t\tbubbles: true,\n\t\t\t\tcancelable: e.cancelable,\n\t\t\t\tpointerType: e.pointerType,\n\t\t\t\tpointerId: e.pointerId,\n\t\t\t\tcomposed: e.composed,\n\t\t\t\tisPrimary: e.isPrimary,\n\t\t\t\tbuttons: e.buttons,\n\t\t\t\tbutton: e.button,\n\t\t\t})\n\n\t\t\t// This rethrown event must be dispatched in the following frame to\n\t\t\t// ensure that any motion elements under the mouse that may have an\n\t\t\t// onTap handler execute correctly. Motion's onTap handler is\n\t\t\t// cancelled if another pointerup event is dispatched to an\n\t\t\t// unrelated element. This works in conjunction with the prop\n\t\t\t// `globalTapTarget` which allows the cursor component to also\n\t\t\t// properly control its tap events even though the pointer up is not\n\t\t\t// dispatched to the cursor (as it has pointer events disabled).\n\t\t\tframe.update(() => {\n\t\t\t\tcursorRef.current?.dispatchEvent(event)\n\t\t\t})\n\t\t}\n\n\t\tsafeWindow.addEventListener(\"pointermove\", updateCursor)\n\n\t\tdocument.addEventListener(\"pointerdown\", fireEventToTarget)\n\t\tdocument.addEventListener(\"pointerup\", fireEventToTarget)\n\n\t\tframe.read(updateVariant, true)\n\n\t\treturn () => {\n\t\t\tsafeWindow.removeEventListener(\"pointermove\", updateCursor)\n\n\t\t\tdocument.removeEventListener(\"pointerdown\", fireEventToTarget)\n\t\t\tdocument.removeEventListener(\"pointerup\", fireEventToTarget)\n\n\t\t\tcancelFrame(updateVariant)\n\t\t}\n\n\t\t// These effect dependencies are static. The effect should only be run\n\t\t// on mount/unmount.\n\t}, [opacity, pointerX, pointerY, forceRender, hasHoverCapability])\n\n\t// Hide the custom cursor when the user blurs the browser, or mouse leaves\n\t// the window to prevent a detached cursor from being left in the mouse's\n\t// last known position, resulting in a \"snap\" to a new position as the\n\t// cursor returns to the window in a different location.\n\tuseEffect(() => {\n\t\tif (!hasHoverCapability) return\n\n\t\tfunction hideCursor() {\n\t\t\tvoid animate(opacity, 0, { type: \"tween\", duration: 0.2 })\n\t\t}\n\n\t\tdocument.addEventListener(\"mouseleave\", hideCursor)\n\t\tsafeWindow.addEventListener(\"blur\", hideCursor)\n\n\t\treturn () => {\n\t\t\tdocument.removeEventListener(\"mouseleave\", hideCursor)\n\t\t\tsafeWindow.removeEventListener(\"blur\", hideCursor)\n\t\t}\n\t}, [opacity, hasHoverCapability])\n\n\t// Whenever any web page registers new cursors, record them to the internal\n\t// state of this component, and ensure that the rendered cursor is update to\n\t// reflect changes to the list.\n\tuseLayoutEffect(() => {\n\t\tfunction updateCursors(newCursors: Record<CustomCursorHash, CursorDefinition>) {\n\t\t\tinternalState.current.cursors = newCursors\n\n\t\t\t// Update the active cursor if the webpage changes the cursor.\n\t\t\tinternalState.current.cursorHash = !isEmptyObject(newCursors)\n\t\t\t\t? getCursorHash(pointerX.get(), pointerY.get())\n\t\t\t\t: null\n\n\t\t\t// It's important to always force a render when a web page reports\n\t\t\t// cursors, even if the cursorHash may not have changed. This can\n\t\t\t// happen when the hash is set before the configuration is reported\n\t\t\t// by the web page.\n\n\t\t\t// Enabling startTransition here would make UX worse.\n\t\t\t// eslint-disable-next-line framer-studio/no-setstate-without-transition\n\t\t\tforceRender()\n\t\t}\n\n\t\tconst unregister = onRegisterCursors(updateCursors)\n\n\t\treturn () => {\n\t\t\tunregister()\n\t\t\tdocument.body.classList.toggle(replaceCursorClassName, false)\n\t\t}\n\n\t\t// These effect dependencies are static. The effect should only be run\n\t\t// on mount/unmount.\n\t}, [pointerX, pointerY, onRegisterCursors, forceRender])\n\n\tconst { cursors, cursorHash } = internalState.current\n\tconst cursor = cursorHash ? cursors[cursorHash] : null\n\tconst replaceNativeCursor = customCursorReplacesNativeCursor(cursor)\n\n\t// Ensure the cursor is hidden whenever the cursor is configured in that\n\t// way. This must happen in an effect in case the cursor hash is set before\n\t// the cursors are registered by the current web page.\n\tuseLayoutEffect(() => {\n\t\tif (!hasHoverCapability) return\n\n\t\tdocument.body.classList.toggle(replaceCursorClassName, replaceNativeCursor)\n\t}, [replaceNativeCursor, hasHoverCapability])\n\n\tconst Cursor = cursor?.component\n\n\tconst springRaw = cursor?.transition ?? { duration: 0 }\n\t// useSpring -> attachFollow -> JSAnimation -> findSpring expects duration\n\t// in milliseconds, but SpringOptions documents it in seconds. Convert here.\n\tconst spring: SpringOptions =\n\t\tspringRaw.duration !== undefined ? { ...springRaw, duration: springRaw.duration * 1000 } : springRaw\n\tconst sprungX = useSpring(pointerX, spring)\n\tconst sprungY = useSpring(pointerY, spring)\n\n\tconst x = useTransform(() => sprungX.get() + (cursor?.offset?.x ?? 0))\n\tconst y = useTransform(() => sprungY.get() + (cursor?.offset?.y ?? 0))\n\n\tconst alignment = cursor?.alignment\n\tconst placement = cursor?.placement\n\n\tconst transformTemplate = useCallback(\n\t\t(_: unknown, t: string) => `translate(${getCenteringTransform(placement, alignment)}) ${t}`,\n\t\t[alignment, placement],\n\t)\n\n\tif (!hasHoverCapability || !cursor || !Cursor) return null\n\n\treturn (\n\t\t<Suspense>\n\t\t\t<Cursor\n\t\t\t\ttransformTemplate={transformTemplate}\n\t\t\t\tstyle={{\n\t\t\t\t\t...staticCursorStyle,\n\t\t\t\t\tx,\n\t\t\t\t\ty,\n\t\t\t\t\topacity,\n\t\t\t\t}}\n\t\t\t\tglobalTapTarget\n\t\t\t\tvariant={cursor?.variant}\n\t\t\t\tref={cursorRef}\n\t\t\t\tclassName={cursorComponentClassName}\n\t\t\t/>\n\t\t</Suspense>\n\t)\n})\n\n/**\n * Allow web pages to register their custom cursors to the global context so\n * that the same cursor can be used across pages without flashes of missing\n * cursors.\n */\nexport function useCustomCursors(webPageCursors: Record<CustomCursorHash, CursorDefinition>): void {\n\tconst { registerCursors } = useContext(CustomCursorContext)\n\tconst cursors = useConstant(() => webPageCursors)\n\tconst id = useId()\n\n\tuseLayoutEffect(() => {\n\t\treturn registerCursors(cursors, id)\n\t}, [registerCursors, id])\n}\n", "import type { MotionProps, MotionStyle, MotionValue } from \"framer-motion\"\nimport { cancelFrame, frame, motion, motionValue, usePresence } from \"framer-motion\"\nimport React, { useContext } from \"react\"\nimport ReactDOM from \"react-dom\"\nimport { refHasValue } from \"../components/utils/refHelper.ts\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\nimport { ResetOuterLinkContext } from \"../modules/Link/useReplaceNestedLinks.tsx\"\nimport { ComponentContainerContext } from \"../render/presentation/ComponentContainerContext.tsx\"\nimport type { Point } from \"../render/types/Point.ts\"\nimport type { Rect } from \"../render/types/Rect.ts\"\nimport type { Size } from \"../render/types/Size.ts\"\nimport { safeWindow } from \"../utils/safeWindow.ts\"\nimport { isReactChild, isReactElement } from \"../utils/type-guards.ts\"\nimport { isObject, isString, isUndefined } from \"../utils/utils.ts\"\nimport { InjectSelectionStyle } from \"./InjectSelectionStyle.tsx\"\nimport type { Alignment, Placement } from \"./floatingPositionSafeAreaStyle.ts\"\nimport {\n\tfloatingPositionSafeAreaStyle,\n\tgetSafePlacementFloatingPositionRect,\n\tmotionOriginFromFloatingPosition,\n} from \"./floatingPositionSafeAreaStyle.ts\"\n\ninterface AncestorInfo {\n\tposition: \"fixed\" | \"absolute\"\n\tscrolls: boolean\n}\n\n/**\n * If the Floating layer is in a fixed position context, the best rendering will\n * be achieved by rendering the Floating layer with fixed positioning. As soon\n * as we detect that an ancestor is fixed, we can opt into that. Otherwise using\n * absolute positioning.\n *\n * At the same time, we can check for any ancestors that aren't the body element\n * that are scrollable. When the Floating layer is in a scrollable container, we\n * need to do extra work to ensure that even if those containers are scrolled,\n * the relative overlay stays pinned to its anchor. This is some overhead so we\n * only do it when we need to.\n */\nfunction domReadGetAncestorInfo(anchorRef: React.MutableRefObject<HTMLElement>): AncestorInfo {\n\tlet el: HTMLElement | null = anchorRef.current\n\n\tconst info: AncestorInfo = {\n\t\tposition: \"absolute\",\n\t\tscrolls: false,\n\t}\n\n\twhile (el) {\n\t\tif (el?.tagName === \"BODY\") return info\n\t\tif (getComputedStyle(el)?.position === \"fixed\") info.position = \"fixed\"\n\t\tif (el.scrollWidth > el.clientWidth || el.scrollHeight > el.clientHeight) info.scrolls = true\n\t\tif (info.scrolls && info.position === \"fixed\") return info\n\t\tel = el.parentElement\n\t}\n\n\treturn info\n}\n\nfunction domReadStartAnimationFrameLoop(onRead: VoidFunction) {\n\tframe.read(onRead, true)\n\treturn () => cancelFrame(onRead)\n}\n\n/**\n * Create a function that can be called to update the style and shape of the\n * safe area. We store the last mouse position inline so that we can update the\n * safe area to stay near the mouse when the anchor moves.\n */\nfunction domWriteCreateUpdateSafeArea(safeAreaRef: React.MutableRefObject<HTMLElement | null>) {\n\tlet x: number = 0\n\tlet y: number = 0\n\n\treturn (anchorRect: Rect, calculatedRect: Rect, placement: Placement, event?: MouseEvent) => {\n\t\tif (!safeAreaRef.current?.style) return\n\n\t\tx = event?.clientX ?? x\n\t\ty = event?.clientY ?? y\n\n\t\tObject.assign(safeAreaRef.current.style, floatingPositionSafeAreaStyle(x, y, placement, anchorRect, calculatedRect))\n\t}\n}\n\nfunction domWriteUpdatePosition(\n\tfloatingPositionRef: React.MutableRefObject<HTMLElement | null>,\n\tposition: \"fixed\" | \"absolute\",\n\trect: Rect,\n\tscrollX: number,\n\tscrollY: number,\n) {\n\tif (!floatingPositionRef.current) return\n\n\tObject.assign(floatingPositionRef.current.style, {\n\t\tposition,\n\t\tvisibility: \"visible\",\n\t\t// Append \"px\" because we are assigning this object straight to style.\n\t\tleft: (rect?.x ?? 0) + scrollX + \"px\",\n\t\ttop: (rect?.y ?? 0) + scrollY + \"px\",\n\t})\n}\n\nconst FloatingStackingContext = /* @__PURE__ */ (() => {\n\tconst Context = React.createContext<Set<HTMLElement>>(new Set())\n\tContext.displayName = \"FloatingStackingContext\"\n\treturn Context\n})()\n\n/**\n * For the best UX, when triggered on hover, the Floating layer is only\n * dismissed when the mouse is not inside the floating element, the anchor, or\n * the safe area.\n *\n * Additionally support hiding Floating layers with the \"Escape\" key when they\n * do not have a safe area.\n */\nfunction useDismissFloatingLayer(\n\tanchorRef: React.MutableRefObject<HTMLElement | null>,\n\tfloatingPositionRef: React.MutableRefObject<HTMLElement | null>,\n\tsafeAreaRef: React.MutableRefObject<HTMLDivElement | null>,\n\t{ safeArea, onDismiss }: { safeArea: boolean; onDismiss: () => void | (() => Promise<void>) },\n) {\n\tconst descendantStackingContext = useConstant(() => new Set<HTMLElement>())\n\tconst ancestorStackingContext = React.useContext(FloatingStackingContext)\n\n\tconst [isPresent, safeToRemove] = usePresence()\n\n\t// Toggle the `pointer-events` style of the floating element to prevent it\n\t// from unintentionally showing the floating layer while an exit animation\n\t// is playing. Ensure that `pointer-events` is reset when `isPresent` is\n\t// true in the case of a cancelled animation.\n\t//\n\t// Additionally track the visibility of the element in its ancestors\n\t// context. This tells any ancestor Floating layers that they have\n\t// descendant Floating layers that have to be dismissed before they can be\n\t// dismissed.\n\tReact.useEffect(() => {\n\t\tif (isPresent) {\n\t\t\tif (!floatingPositionRef.current) return\n\t\t\tfloatingPositionRef.current.style.pointerEvents = \"\"\n\t\t\tancestorStackingContext.add(floatingPositionRef.current)\n\t\t} else {\n\t\t\tif (!floatingPositionRef.current) return\n\t\t\tfloatingPositionRef.current.style.pointerEvents = \"none\"\n\t\t\tancestorStackingContext.delete(floatingPositionRef.current)\n\t\t\t// Tell `framer-motion` that it can safely remove this Floating\n\t\t\t// Layer as soon as any exit animations have completed.\n\t\t\tsafeToRemove()\n\t\t}\n\t}, [isPresent, safeToRemove, floatingPositionRef, ancestorStackingContext])\n\n\tReact.useEffect(() => {\n\t\tif (!safeArea) {\n\t\t\tconst handleEscape = (e: KeyboardEvent) => {\n\t\t\t\tif (e.key !== \"Escape\") return\n\t\t\t\tonDismiss()\n\t\t\t}\n\t\t\tsafeWindow.addEventListener(\"keyup\", handleEscape)\n\t\t\treturn () => safeWindow.removeEventListener(\"keyup\", handleEscape)\n\t\t}\n\n\t\tlet latestEvent: MouseEvent | undefined\n\n\t\tfunction maybeDismiss() {\n\t\t\tif (!latestEvent || descendantStackingContext.size !== 0) return\n\t\t\tfor (const element of document.elementsFromPoint(latestEvent.x, latestEvent.y)) {\n\t\t\t\tif (element === anchorRef.current) return\n\t\t\t\tif (element === floatingPositionRef.current) return\n\t\t\t\tif (element === safeAreaRef.current) return\n\t\t\t}\n\n\t\t\tonDismiss()\n\t\t}\n\n\t\tfunction scheduleMaybeDismiss(event: MouseEvent) {\n\t\t\tlatestEvent = event\n\t\t\tframe.read(maybeDismiss)\n\t\t}\n\n\t\tsafeWindow.addEventListener(\"mousemove\", scheduleMaybeDismiss)\n\n\t\treturn () => {\n\t\t\tsafeWindow.removeEventListener(\"mousemove\", scheduleMaybeDismiss)\n\t\t}\n\t}, [onDismiss, safeArea, anchorRef, safeAreaRef, floatingPositionRef])\n\n\treturn descendantStackingContext\n}\n\nfunction makeGetSafePlacementFloatingPositionRect({\n\tplacement,\n\talignment,\n\toffset,\n\tcollisionDetectionSize,\n\tcollisionDetectionPadding,\n}: {\n\tplacement: Placement\n\talignment: Alignment\n\toffset: Point\n\t/**\n\t * If the floating layer should avoid collision with the window, provide the\n\t * window bounds as a Size.\n\t */\n\tcollisionDetectionSize?: Size\n\tcollisionDetectionPadding?: number\n}) {\n\treturn (anchor: Rect, element: Rect) =>\n\t\tgetSafePlacementFloatingPositionRect(\n\t\t\tanchor,\n\t\t\telement,\n\t\t\tplacement,\n\t\t\talignment,\n\t\t\toffset,\n\t\t\tcollisionDetectionSize,\n\t\t\tcollisionDetectionPadding,\n\t\t)\n}\n\n/**\n * Determine the motion transform origin for the floating layer based on its\n * placement and alignment. This can change if we have to flip the placement to\n * avoid collision with the window.\n */\nfunction useDynamicMotionOrigin(initialPlacement: Placement, alignment: Alignment) {\n\treturn useConstant(() => {\n\t\tconst { originX, originY } = motionOriginFromFloatingPosition(initialPlacement, alignment)\n\t\tconst origin = { x: motionValue(originX), y: motionValue(originY) }\n\n\t\treturn [\n\t\t\torigin,\n\t\t\t(placement: Placement) => {\n\t\t\t\tconst values = motionOriginFromFloatingPosition(placement, alignment)\n\t\t\t\torigin.x.set(values.originX)\n\t\t\t\torigin.y.set(values.originY)\n\t\t\t},\n\t\t] as const\n\t})\n}\n\n/**\n * Clone the child of the floating layer to assign transform origin motion\n * values. This ensures that any animations performed by the floating layer will\n * always appear to originate from the trigger even if we have flipped the\n * placement to avoid collision with the window.\n */\nfunction childrenWithOrigin(\n\tchild: React.ReactNode,\n\t{ x, y }: { x: MotionValue<number>; y: MotionValue<number> },\n): React.ReactNode | null {\n\tif (!child || !isReactChild(child) || !isReactElement(child)) return null\n\tif (!isObject(child.props.style) && !isUndefined(child.props.style)) return null\n\n\tconst style: MotionStyle = {\n\t\t...child.props.style,\n\t\toriginX: x,\n\t\toriginY: y,\n\t}\n\n\treturn React.cloneElement(child as React.ReactElement<{ style: MotionStyle }>, { style })\n}\n\ninterface FloatingProps extends MotionProps {\n\talignment: Alignment\n\tplacement: Placement\n\toffsetX: number\n\toffsetY: number\n\tanchorRef: React.MutableRefObject<HTMLElement | null>\n\tsafeArea: boolean\n\tclassName: string\n\t/** @deprecated */\n\tportalSelector?: string\n\tzIndex: number | undefined\n\tcollisionDetection?: boolean\n\tcollisionDetectionPadding?: number\n\tonDismiss: () => void | (() => Promise<void>)\n}\n\n// These Selectors are serialized into Web Pages and Layout Templates. They\n// cannot be changed without potentially breaking existing sites.\nexport const overlayContainerId = \"overlay\"\nexport const templateOverlayContainerId = \"template-overlay\"\n\nfunction getPortalContainer(deprecatedSelector: string | undefined, inComponent: boolean) {\n\t// If the component that is rendering the Floating layer is in any component\n\t// (not a Web Page) or doesn't provide a selector, then its safe to render\n\t// it into the appropriate portal container, because it brings its own\n\t// serialization class name.\n\tif (inComponent || isUndefined(deprecatedSelector)) {\n\t\tconst container =\n\t\t\tdocument.querySelector(`#${templateOverlayContainerId}`) ?? document.querySelector(`#${overlayContainerId}`)\n\t\tif (container) return container\n\t}\n\n\t// Otherwise the Floating layer can only be rendered into the provided\n\t// selector element.\n\tconst container = isString(deprecatedSelector) ? document.querySelector(deprecatedSelector) : undefined\n\tif (container) return container\n\n\treturn document.body\n}\n\nexport function Floating({\n\talignment,\n\tplacement,\n\tsafeArea,\n\toffsetX,\n\toffsetY,\n\tanchorRef,\n\tclassName,\n\tchildren,\n\tportalSelector,\n\tzIndex,\n\tcollisionDetection = false,\n\tcollisionDetectionPadding,\n\tonDismiss,\n\t...rest\n}: React.PropsWithChildren<FloatingProps>) {\n\tconst floatingPositionRef = React.useRef<HTMLDivElement>(null)\n\tconst safeAreaRef = React.useRef<HTMLDivElement>(null)\n\tconst contentRef = React.useRef<HTMLDivElement>(null)\n\tconst [origin, updateOrigin] = useDynamicMotionOrigin(placement, alignment)\n\n\t// Calculate the position of the Floating layer, as well as the shape of the\n\t// safe area whenever show, or the placement, alignment or offset changes.\n\t//\n\t// If we detect the element is in a scrollable ancestor that isn't the body\n\t// element, we start a requestAnimationFrame loop that ensures the Floating\n\t// layer stays pinned to its anchor.\n\t//\n\t// Finally, if the Floating layer has a safe area, we bind a function to\n\t// mouse move on the anchor that will update the shape of the safe area to\n\t// ensure the mouse can always safely travel to either of the closest\n\t// corners of the Floating layer.\n\tReact.useLayoutEffect(() => {\n\t\tif (!refHasValue(anchorRef) || !contentRef.current || !placement || !alignment) return\n\n\t\tconst offset: Point = {\n\t\t\tx: offsetX ?? 0,\n\t\t\ty: offsetY ?? 0,\n\t\t}\n\n\t\t// Partially apply the arguments to update the rect to ensure arguments\n\t\t// are consistently applied.\n\t\tlet cleanup: VoidFunction | undefined\n\t\tlet cleanupHasRun = false\n\t\tlet initialUpdateHasRun = false\n\t\tlet anchorRect: Rect\n\t\tlet safePlacement: Placement\n\t\tlet calculatedRect: Rect\n\t\tlet latestEvent: MouseEvent | undefined\n\t\tlet updateSafeArea: ReturnType<typeof domWriteCreateUpdateSafeArea>\n\t\tlet scrollX = 0\n\t\tlet scrollY = 0\n\n\t\tconst ancestorInfo = domReadGetAncestorInfo(anchorRef)\n\t\tconst position = ancestorInfo.position\n\n\t\tconst elementRect = contentRef.current.getBoundingClientRect()\n\n\t\tconst getSafePlacementRect = makeGetSafePlacementFloatingPositionRect({\n\t\t\tplacement,\n\t\t\talignment,\n\t\t\toffset,\n\t\t\tcollisionDetectionSize: collisionDetection\n\t\t\t\t? { width: safeWindow.innerWidth, height: safeWindow.innerHeight }\n\t\t\t\t: undefined,\n\t\t\tcollisionDetectionPadding,\n\t\t})\n\n\t\tconst onRender = () => {\n\t\t\tif (cleanupHasRun) return\n\t\t\tdomWriteUpdatePosition(floatingPositionRef, position, calculatedRect, scrollX, scrollY)\n\t\t\tif (safeArea) updateSafeArea(anchorRect, calculatedRect, safePlacement, latestEvent)\n\t\t\tlatestEvent = undefined\n\t\t}\n\n\t\tconst initialRender = () => {\n\t\t\tupdateSafeArea = domWriteCreateUpdateSafeArea(safeAreaRef)\n\n\t\t\tif (latestEvent) {\n\t\t\t\tonRender()\n\t\t\t} else {\n\t\t\t\tdomWriteUpdatePosition(floatingPositionRef, position, calculatedRect, scrollX, scrollY)\n\t\t\t}\n\n\t\t\tinitialUpdateHasRun = true\n\t\t}\n\n\t\tconst onUpdate = () => {\n\t\t\tif (cleanupHasRun) return\n\t\t\tupdateOrigin(safePlacement)\n\t\t}\n\n\t\tconst domReadUpdateSafePlacementAndRect = () => {\n\t\t\tif (!getSafePlacementRect || cleanupHasRun) return\n\n\t\t\tif (position === \"fixed\") {\n\t\t\t\tscrollX = 0\n\t\t\t\tscrollY = 0\n\t\t\t} else {\n\t\t\t\tscrollX = safeWindow.scrollX\n\t\t\t\tscrollY = safeWindow.scrollY\n\t\t\t}\n\n\t\t\tanchorRect = anchorRef.current.getBoundingClientRect()\n\t\t\tconst safePlacementAndRect = getSafePlacementRect(anchorRect, elementRect)\n\t\t\tsafePlacement = safePlacementAndRect[0]\n\t\t\tcalculatedRect = safePlacementAndRect[1]\n\t\t}\n\n\t\tdomReadUpdateSafePlacementAndRect()\n\t\tonUpdate()\n\t\tinitialRender()\n\n\t\tif (ancestorInfo.scrolls) {\n\t\t\t// Start a read/write loop to ensure the Floating layer stays pinned to its anchor,\n\t\t\t// returning a function to cancel the loop when the overlay is dismissed.\n\t\t\tcleanup = domReadStartAnimationFrameLoop(domReadUpdateSafePlacementAndRect)\n\t\t}\n\n\t\tif (!safeArea) {\n\t\t\treturn () => {\n\t\t\t\tcleanup?.()\n\t\t\t\tcleanupHasRun = true\n\t\t\t}\n\t\t}\n\n\t\tconst handleMouseMove = (event: MouseEvent) => {\n\t\t\tlatestEvent = event\n\n\t\t\t// We take care of the safe area in the initial render, so we don't need to run the same\n\t\t\t// logic again before that.\n\t\t\tif (!initialUpdateHasRun) return\n\n\t\t\tframe.read(domReadUpdateSafePlacementAndRect, false, true)\n\t\t\tframe.update(onUpdate, false, true)\n\t\t\tframe.render(onRender, false, true)\n\t\t}\n\n\t\tconst anchor = anchorRef.current\n\t\tanchor.addEventListener(\"mousemove\", handleMouseMove)\n\n\t\treturn () => {\n\t\t\tanchor.removeEventListener(\"mousemove\", handleMouseMove)\n\t\t\tcleanup?.()\n\t\t\tcleanupHasRun = true\n\t\t}\n\t}, [\n\t\tsafeArea,\n\t\tplacement,\n\t\talignment,\n\t\toffsetX,\n\t\toffsetY,\n\t\tanchorRef,\n\t\tcollisionDetection,\n\t\tcollisionDetectionPadding,\n\t\tupdateOrigin,\n\t])\n\n\tconst descendantContext = useDismissFloatingLayer(anchorRef, floatingPositionRef, safeAreaRef, {\n\t\tsafeArea,\n\t\tonDismiss,\n\t})\n\n\tconst inComponent = useContext(ComponentContainerContext)\n\n\treturn ReactDOM.createPortal(\n\t\t<motion.div\n\t\t\tref={floatingPositionRef}\n\t\t\tclassName={className}\n\t\t\tstyle={{\n\t\t\t\t// Start from the top left of the screen to prevent jumps.\n\t\t\t\ttop: 0,\n\t\t\t\tleft: 0,\n\t\t\t\t// Initially rendered as hidden, but the layout effect will set\n\t\t\t\t// to visible when the position is calculated.\n\t\t\t\tvisibility: \"hidden\",\n\t\t\t\twidth: \"auto\",\n\t\t\t\theight: \"auto\",\n\t\t\t\tposition: \"absolute\",\n\t\t\t\tzIndex,\n\t\t\t}}\n\t\t\t{...rest}\n\t\t>\n\t\t\t{safeArea ? (\n\t\t\t\t<div ref={safeAreaRef} style={{ position: \"absolute\" }} data-safearea />\n\t\t\t) : (\n\t\t\t\t// biome-ignore lint/a11y/useKeyWithClickEvents: overlays don't support key events yet.\n\t\t\t\t<div style={{ position: \"fixed\", inset: 0 }} aria-hidden onClick={onDismiss} />\n\t\t\t)}\n\t\t\t<FloatingStackingContext.Provider value={descendantContext}>\n\t\t\t\t{/* Reset the outer link context (and don\u2019t do nested link replacement) since the overlay\n                    is in a portal, and there would be no ancestor link causing the \u201Cinvalid DOM nesting\u201D issue. */}\n\t\t\t\t<ResetOuterLinkContext>\n\t\t\t\t\t<InjectSelectionStyle triggerId={anchorRef.current?.id ?? undefined}>\n\t\t\t\t\t\t<div ref={contentRef}>{childrenWithOrigin(children, origin)}</div>\n\t\t\t\t\t</InjectSelectionStyle>\n\t\t\t\t</ResetOuterLinkContext>\n\t\t\t</FloatingStackingContext.Provider>\n\t\t</motion.div>,\n\t\tgetPortalContainer(portalSelector, inComponent),\n\t)\n}\n", "import { isCommandKeyPressed } from \"@framerjs/shared/src/environment.ts\"\nimport type { NestedLinkInfo } from \"@framerjs/shared/src/ssg/nestedLinkInfo.ts\"\nimport { isMotionComponent, motion, unwrapMotionComponent } from \"framer-motion\"\nimport type { ComponentType, HTMLProps, ReactHTMLElement, ReactNode } from \"react\"\nimport type React from \"react\"\nimport { Children, createContext, createElement, isValidElement, useCallback, useContext, useMemo } from \"react\"\nimport type { MutableRefCallback } from \"../../components/utils/refHelper.ts\"\nimport { useRefEffect } from \"../../components/utils/refHelper.ts\"\nimport { useRouter } from \"../../router/RouterContext.tsx\"\nimport { useCurrentRoute } from \"../../router/useCurrentRoute.tsx\"\nimport { useLocaleInfo } from \"../../router/useLocale.ts\"\nimport { assert } from \"../../utils/assert.ts\"\nimport { isUndefined } from \"../../utils/utils.ts\"\nimport type { LinkToWebPage } from \"../LinkToWebPage.ts\"\nimport { isLinkToWebPage } from \"../LinkToWebPage.ts\"\nimport { nestedLinksCollector } from \"../NestedLinksCollector.ts\"\nimport { useFurthestExternalComponent } from \"../code-boundary/ExternalComponentContext.tsx\"\nimport { useIsOnFramerCanvas } from \"../useIsOnFramerCanvas.ts\"\nimport { getRouteFromPageLink } from \"./getRouteFromPageLink.tsx\"\nimport { linkFromFramerPageLink } from \"./linkFromFramerPageLink.tsx\"\nimport type { PropsAddedByLinkInternal } from \"./types.ts\"\n\ntype PartialNestedLinkInfo = Omit<NestedLinkInfo, \"nodeId\"> & { nodeId: string | undefined }\nconst OuterLinkContext = /* @__PURE__ */ createContext<PartialNestedLinkInfo | undefined>(undefined)\n\nexport function ResetOuterLinkContext({ children }: { children: ReactNode }) {\n\treturn <OuterLinkContext.Provider value={undefined}>{children}</OuterLinkContext.Provider>\n}\n\n/**\n * NOTE: Any change to this function should have a QA for this project https://development.framer.com/projects/Nested-Links--ozJyj13jPMDAbU9zv9WB-1rkcd\n */\nexport function useReplaceNestedLinks(\n\tchildren: ReactNode,\n\tscopeId: string | undefined,\n\tnodeId: string | undefined,\n\thref: string | LinkToWebPage | undefined,\n\tpropsAddedByLink: Partial<PropsAddedByLinkInternal>,\n\tobserverRef: MutableRefCallback<HTMLAnchorElement>,\n) {\n\tconst outerLink = useContext(OuterLinkContext)\n\tconst furthestExternalComponent = useFurthestExternalComponent()\n\tconst innerLink: PartialNestedLinkInfo = useMemo(\n\t\t() => ({ scopeId, nodeId, furthestExternalComponent }),\n\t\t[scopeId, nodeId, furthestExternalComponent],\n\t)\n\n\tconst router = useRouter()\n\tconst currentRoute = useCurrentRoute()\n\tconst { locales } = useLocaleInfo()\n\n\tconst route = useMemo(() => {\n\t\tconst pageLink = isLinkToWebPage(href) ? href : linkFromFramerPageLink(href)\n\t\tif (!pageLink) return\n\n\t\treturn getRouteFromPageLink(pageLink, router, currentRoute, locales)\n\t}, [currentRoute, href, router, locales])\n\n\tconst isOnFramerCanvas = useIsOnFramerCanvas()\n\tconst shouldReplaceLink = Boolean(!isOnFramerCanvas && outerLink?.nodeId && innerLink.nodeId)\n\n\t// This way we are still able to properly handle the click event for this nested link\n\tconst onClick = useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tif (!propsAddedByLink.href) return\n\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\n\t\t\t// CMD or CTRL + click\n\t\t\tif (isCommandKeyPressed(event)) {\n\t\t\t\topenExternalLink(propsAddedByLink.href, \"\", \"_blank\")\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// It's a link that points to a router within the site\n\t\t\tif (route) {\n\t\t\t\tpropsAddedByLink.navigate?.()\n\t\t\t} else {\n\t\t\t\topenExternalLink(propsAddedByLink.href, propsAddedByLink.rel, propsAddedByLink.target)\n\t\t\t}\n\t\t},\n\t\t[propsAddedByLink, route],\n\t)\n\n\t// middle mouse button click\n\tconst onAuxClick = useCallback(\n\t\t(event: MouseEvent) => {\n\t\t\tif (!propsAddedByLink.href) return\n\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\n\t\t\topenExternalLink(propsAddedByLink.href, \"\", \"_blank\")\n\t\t},\n\t\t[propsAddedByLink],\n\t)\n\n\tconst onKeyDown = useCallback(\n\t\t(event: KeyboardEvent) => {\n\t\t\tif (!propsAddedByLink.href) return\n\t\t\tif (event.key !== \"Enter\") return\n\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\n\t\t\t// It's a link that points to a router within the site\n\t\t\tif (route) {\n\t\t\t\tpropsAddedByLink.navigate?.()\n\t\t\t} else {\n\t\t\t\topenExternalLink(propsAddedByLink.href, propsAddedByLink.rel, propsAddedByLink.target)\n\t\t\t}\n\t\t},\n\t\t[propsAddedByLink, route],\n\t)\n\n\tuseRefEffect(\n\t\tobserverRef,\n\t\t(node: HTMLAnchorElement | null) => {\n\t\t\tif (node === null) return\n\t\t\t// This will indicate `ssg/src/ssg-sandbox-renderer/worker/nestedLinks.ts` to stop handling the events and let the react handlers do their job\n\t\t\tif (!shouldReplaceLink) return\n\t\t\tnode.dataset.hydrated = \"true\"\n\t\t},\n\t\t[shouldReplaceLink],\n\t)\n\n\tlet replacedChildren = children\n\tif (shouldReplaceLink) {\n\t\t// Collect nested links for reporting\n\t\tChildren.forEach(children, child => {\n\t\t\tif (!isChildReplaceable(child)) return\n\n\t\t\tassert(\n\t\t\t\tlinkInfoIsCollectable(outerLink),\n\t\t\t\t\"outerLink must have nodeId defined at this point; this was verified with `shouldReplaceLink` above\",\n\t\t\t)\n\t\t\tassert(\n\t\t\t\tlinkInfoIsCollectable(innerLink),\n\t\t\t\t\"innerLink must have nodeId defined at this point; this was verified with `shouldReplaceLink` above\",\n\t\t\t)\n\n\t\t\tnestedLinksCollector.collectNestedLink(outerLink, innerLink)\n\t\t})\n\n\t\t// Replace nested links (<a> \u2192 <span>)\n\t\treplacedChildren = Children.map(children, (child: ReactHTMLElement<HTMLAnchorElement>) => {\n\t\t\tif (!isChildReplaceable(child)) return child\n\n\t\t\tconst tag = maybeReplaceAnchorWithSpan(child.type)\n\t\t\tconst { children: childChildren, ...childProps } = child.props as HTMLProps<HTMLAnchorElement>\n\n\t\t\tconst props = {\n\t\t\t\t...childProps,\n\t\t\t\t// This attribute is used in `ssg/src/ssg-sandbox-renderer/worker/nestedLinks.ts` to handle the nested links clicks\n\t\t\t\t\"data-nested-link\": true,\n\t\t\t\trole: \"link\",\n\t\t\t\ttabIndex: 0,\n\t\t\t\tonClick,\n\t\t\t\tonAuxClick,\n\t\t\t\tonKeyDown,\n\t\t\t\tas: childProps.as && maybeReplaceAnchorWithSpan(childProps.as),\n\t\t\t}\n\n\t\t\tconst ref = \"ref\" in child ? child.ref : undefined\n\n\t\t\treturn createElement(\n\t\t\t\ttag,\n\t\t\t\t// We need to pass the ref here again, otherwise it will be lost\n\t\t\t\t{ ...props, ref } as Record<string, unknown>,\n\t\t\t\tchildChildren,\n\t\t\t)\n\t\t})\n\t}\n\n\treturn <OuterLinkContext.Provider value={innerLink}>{replacedChildren}</OuterLinkContext.Provider>\n}\n\nfunction linkInfoIsCollectable(linkInfo?: PartialNestedLinkInfo): linkInfo is NestedLinkInfo {\n\treturn !isUndefined(linkInfo?.nodeId)\n}\n\n/**\n * This function checks if a child of Link is replaceable by a span. We support replacing\n * - motion.a \u2192 motion.span\n * - a \u2192 span\n * - <Image as=\"a\"> \u2192 <Image as=\"span\">\n * but there might be other scenarios we haven\u2019t designed for.\n */\nfunction isChildReplaceable(child: ReactNode) {\n\treturn (\n\t\tisValidElement(child) &&\n\t\t(maybeReplaceAnchorWithSpan(child.type) !== child.type ||\n\t\t\tmaybeReplaceAnchorWithSpan(child.props.as) !== child.props.as)\n\t)\n}\n\nfunction openExternalLink(href: string, rel?: string, target?: string) {\n\tconst link = document.createElement(\"a\")\n\tlink.href = href\n\tif (rel) {\n\t\tlink.rel = rel\n\t}\n\tif (target) {\n\t\tlink.target = target\n\t}\n\tdocument.body.appendChild(link)\n\tlink.click()\n\tlink.remove()\n}\n\nfunction maybeReplaceAnchorWithSpan(component: string | ComponentType<unknown>) {\n\tif (component === \"a\") return \"span\"\n\tif (isMotionComponent(component) && unwrapMotionComponent(component) === \"a\") return motion.span\n\treturn component\n}\n", "// This is similar to the Vekter model `Link.ts`. Please keep these in sync.\nexport interface LinkToWebPage {\n\twebPageId: string\n\thash?: string\n\tpathVariables?: Record<string, string>\n\thashVariables?: Record<string, string>\n\tunresolvedPathSlugs?: Record<string, UnresolvedSlug>\n\tunresolvedHashSlugs?: Record<string, UnresolvedSlug>\n}\n\nconst linkKey: keyof LinkToWebPage = \"webPageId\"\nexport function isLinkToWebPage(link: unknown): link is LinkToWebPage {\n\treturn Boolean(link && typeof link === \"object\" && linkKey in link)\n}\n\nexport interface UnresolvedSlug {\n\tcollectionId: string\n\tcollectionItemId: string\n}\n", "import { isTest } from \"@framerjs/shared/src/environment.ts\"\nimport type { NestedLinkInfo } from \"@framerjs/shared/src/ssg/nestedLinkInfo.ts\"\nimport { assert } from \"../utils/assert.ts\"\nimport { isWindow } from \"../utils/utils.ts\"\n\ntype NestedLinkInfoKey = `${string}:${string}:${string}:${string}`\nfunction linkInfoKey(link: NestedLinkInfo): NestedLinkInfoKey {\n\treturn `${link.scopeId}:${link.nodeId}:${link.furthestExternalComponent?.scopeId}:${link.furthestExternalComponent?.nodeId}`\n}\n\n/**\n * Collector for detected nested links.\n *\n * There are 3 possible kinds of nested links:\n * 1. A link inside another in the same project\n * 2. A link inside an external component that is wrapped in a link in the page\n * 3. A link inside an external component that is wrapped in a link in this external component\n *\n * Which means that we may have 3 possible error messages:\n * 1. A message that will contain the nested link layer and the parent link layer\n * 2. A message that will contain the nested external component layer and the parent link layer\n * 3. A message that will only contain the nested external component layer\n */\nclass NestedLinksCollector {\n\tprivate collectedLinks = new Map<NestedLinkInfoKey, NestedLinkInfo>()\n\tprivate nestingInfo = new Map<NestedLinkInfoKey, Set<NestedLinkInfoKey>>()\n\n\tclear() {\n\t\tthis.collectedLinks.clear()\n\t\tthis.nestingInfo.clear()\n\t}\n\n\t/**\n\t * Returns a Map of outer links to their inner links.\n\t *\n\t * NOTE: This function is called in the SSG renderer sandbox (<root>/src/ssg/src/ssg-sandbox-renderer/sandbox/worker/renderer.ts)\n\t */\n\tgetLinks() {\n\t\tconst result = new Map<NestedLinkInfo, NestedLinkInfo[]>()\n\n\t\tfor (const [outerLinkKey, innerLinkKeys] of this.nestingInfo) {\n\t\t\tconst outerLinkInfo = this.collectedLinks.get(outerLinkKey)\n\t\t\tassert(outerLinkInfo, `Outer link not found: ${outerLinkKey}`)\n\n\t\t\tconst links = Array.from(innerLinkKeys).map(innerLinkKey => {\n\t\t\t\tconst innerLinkInfo = this.collectedLinks.get(innerLinkKey)\n\t\t\t\tassert(innerLinkInfo, `Inner link not found: ${innerLinkKey}`)\n\t\t\t\treturn innerLinkInfo\n\t\t\t})\n\n\t\t\tresult.set(outerLinkInfo, links)\n\t\t}\n\n\t\treturn result\n\t}\n\n\tcollectNestedLink(outerLink: NestedLinkInfo, innerLink: NestedLinkInfo) {\n\t\tif ((isWindow && !isTest()) || !outerLink.nodeId || !innerLink.nodeId) {\n\t\t\treturn\n\t\t}\n\n\t\tthis.collectedLinks.set(linkInfoKey(outerLink), outerLink)\n\t\tthis.collectedLinks.set(linkInfoKey(innerLink), innerLink)\n\n\t\tconst outerLinkNestingInfo = this.nestingInfo.get(linkInfoKey(outerLink)) ?? new Set()\n\t\touterLinkNestingInfo.add(linkInfoKey(innerLink))\n\t\tthis.nestingInfo.set(linkInfoKey(outerLink), outerLinkNestingInfo)\n\t}\n}\n\n/**\n * @internal\n */\nexport const nestedLinksCollector = /* @__PURE__ */ new NestedLinksCollector()\n", "import { RenderTarget } from \"../render/types/RenderEnvironment.ts\"\n/**\n * Returns a constant value based on whether the caller is mounted in a Framer\n * Canvas environment.\n *\n * @public\n */\nexport function useIsOnFramerCanvas() {\n\treturn RenderTarget.current() === RenderTarget.canvas\n}\n", "export function isInternalURL(href: string | undefined) {\n\tif (href === undefined) return false\n\t// If updating this, please also update the selectors in rewriteLinksWithQueryParams.ts.\n\tif (href.startsWith(\"#\") || href.startsWith(\"/\") || href.startsWith(\".\")) return true\n\treturn false\n}\n\nexport function isValidURL(href: string, isInternal: boolean) {\n\ttry {\n\t\tconst url = new URL(href)\n\t\treturn Boolean(url.protocol) // in theory this should always be true, but just in case?\n\t} catch {\n\t\t// Ignore thrown errors.\n\t}\n\treturn isInternal\n}\n", "import { inferInitialRouteFromPath } from \"../../router/inferInitialRouteFromPath.ts\"\nimport type { ActiveRoute, Locale, Route, RouterAPI } from \"../../router/types.ts\"\nimport { isString } from \"../../utils/utils.ts\"\nimport type { LinkToWebPage } from \"../LinkToWebPage.ts\"\nimport { isInternalURL } from \"./urlChecks.tsx\"\n\nexport function getRouteFromPageLink(\n\tpageLink: string | LinkToWebPage,\n\trouter: Partial<RouterAPI>,\n\tcurrentRoute: ActiveRoute | undefined,\n\tlocales?: readonly Locale[],\n): Route | undefined {\n\tif (isString(pageLink)) {\n\t\tconst isInternal = isInternalURL(pageLink)\n\n\t\tif (!router.routes || !router.getRoute || !currentRoute || !isInternal) {\n\t\t\treturn\n\t\t}\n\n\t\t// see propsForRoutePath for why we have those checks in place. We target only internal links (routes) here, so no need for errors.\n\t\tconst [pathnameWithQueryParams] = pageLink.split(\"#\", 2)\n\t\tif (pathnameWithQueryParams === undefined) return\n\n\t\tconst [pathname] = pathnameWithQueryParams.split(\"?\", 2)\n\t\tif (pathname === undefined) return\n\n\t\tconst { routeId } = inferInitialRouteFromPath(router.routes, pathname, undefined, locales)\n\t\treturn router.getRoute(routeId)\n\t}\n\n\tconst { webPageId } = pageLink\n\treturn router.getRoute?.(webPageId)\n}\n", "import type { RouterAPI } from \"../router/types.ts\"\nimport { isString } from \"../utils/utils.ts\"\n\n/**\n * @internal\n * @deprecated\n */\nexport interface FramerPageLinkCollectionItemAttribute {\n\tcollection: string\n\tcollectionItemId: string\n\tpathVariables: Record<string, string>\n}\n\n/**\n * @internal\n * @deprecated\n */\nexport interface FramerPageLinkAttributes {\n\telement?: string | null\n\tcollectionItem?: FramerPageLinkCollectionItemAttribute\n}\n\nconst elementKey: keyof FramerPageLinkAttributes = \"element\"\nconst collectionKey: keyof FramerPageLinkCollectionItemAttribute = \"collection\"\nconst collectionItemIdKey: keyof FramerPageLinkCollectionItemAttribute = \"collectionItemId\"\nconst pathVariablesKey: keyof FramerPageLinkCollectionItemAttribute = \"pathVariables\"\n\n// This includes the comma that separates the media type from the data.\nconst mediaType = \"framer/page-link,\"\n/**\n * @internal\n * @deprecated\n */\nexport type FramerLink = `data:${typeof mediaType}${string}`\n/**\n * @internal\n * @deprecated\n */\nexport function isFramerPageLink(value: unknown): value is FramerLink {\n\treturn isString(value) && value.startsWith(`data:${mediaType}`)\n}\n\n/**\n * @internal\n * @deprecated\n */\nexport function createFramerPageLink(targetId: string | null = null, options: FramerPageLinkAttributes = {}): string {\n\tconst target = targetId ? targetId : \"none\"\n\tconst link = new URL(`data:${mediaType}${target}`)\n\n\tif (options.element) {\n\t\tlink.searchParams.append(elementKey, options.element)\n\t}\n\n\tif (options.collectionItem) {\n\t\tlink.searchParams.append(collectionKey, options.collectionItem.collection)\n\t\tlink.searchParams.append(collectionItemIdKey, options.collectionItem.collectionItemId)\n\t\tlink.searchParams.append(pathVariablesKey, new URLSearchParams(options.collectionItem.pathVariables).toString())\n\t}\n\n\treturn link.href\n}\n\n/**\n * @internal\n * @deprecated\n */\nexport interface PageLinkParsedResult {\n\ttarget: string | null\n\telement: string | null | undefined\n\tcollectionItem: FramerPageLinkCollectionItemAttribute | undefined\n}\n\n/**\n * @internal\n * @deprecated\n */\nexport function parseFramerPageLink(link: unknown): PageLinkParsedResult | undefined {\n\tif (!isFramerPageLink(link)) return\n\n\ttry {\n\t\tconst url = new URL(link)\n\t\tconst target = url.pathname.substring(mediaType.length)\n\t\tconst searchParams = url.searchParams\n\n\t\tconst element = searchParams.has(elementKey) ? searchParams.get(elementKey) : undefined\n\t\tlet collectionItem: FramerPageLinkCollectionItemAttribute | undefined\n\n\t\tconst collection = searchParams.get(collectionKey)\n\t\tconst collectionItemId = searchParams.get(collectionItemIdKey)\n\t\tconst pathVariablesValue = searchParams.get(pathVariablesKey)\n\n\t\tif (collection && collectionItemId && pathVariablesValue) {\n\t\t\tconst pathVariables = Object.fromEntries(new URLSearchParams(pathVariablesValue).entries())\n\t\t\tcollectionItem = {\n\t\t\t\tcollection,\n\t\t\t\tcollectionItemId,\n\t\t\t\tpathVariables,\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\ttarget: target === \"none\" ? null : target,\n\t\t\t/**\n\t\t\t * For historical reason we used to set \"element=none\" into the\n\t\t\t * datalink, we no longer do that today, but we still keep this code\n\t\t\t * so we could parse legacy links correctly.\n\t\t\t */\n\t\t\telement: element === \"none\" ? undefined : element,\n\t\t\tcollectionItem,\n\t\t}\n\t} catch {\n\t\treturn\n\t}\n}\n\n/**\n * @internal\n * @deprecated\n */\nexport function shouldOpenLinkInNewTab(link: unknown) {\n\treturn !isFramerPageLink(link)\n}\n\n/**\n * @internal\n * @deprecated\n */\nexport const enum PageLinkAttribute {\n\tPage = \"data-framer-page-link-target\",\n\tElement = \"data-framer-page-link-element\",\n\tPathVariables = \"data-framer-page-link-path-variables\",\n\tCurrent = \"data-framer-page-link-current\",\n}\n\n/** @internal @deprecated */\nexport function navigateFromAttributes(\n\tnavigate: RouterAPI[\"navigate\"],\n\telement: HTMLAnchorElement,\n\timplicitPathVariables?: Record<string, unknown>,\n): boolean {\n\t// These attributes are set by `replaceFramerPageLinks`.\n\tlet routeId = element.getAttribute(PageLinkAttribute.Page)\n\tlet elementId: string | undefined\n\tlet pathVariables: Record<string, unknown> | undefined\n\tif (routeId) {\n\t\telementId = element.getAttribute(PageLinkAttribute.Element) ?? undefined\n\t\tconst pathVariablesRaw = element.getAttribute(PageLinkAttribute.PathVariables)\n\t\tif (pathVariablesRaw) {\n\t\t\tpathVariables = Object.fromEntries(new URLSearchParams(pathVariablesRaw).entries())\n\t\t}\n\t} else {\n\t\t// Just in case for some reason the link on the element wasn't resolved, try to parse it.\n\t\tconst href = element.getAttribute(\"href\")\n\t\tif (!href) return false\n\t\tconst link = parseFramerPageLink(href)\n\t\tif (!link || !link.target) return false\n\t\trouteId = link.target\n\t\telementId = link.element ?? undefined\n\t\tpathVariables = link.collectionItem?.pathVariables\n\t}\n\n\tconst smoothScroll = elementId ? element.dataset.framerSmoothScroll !== undefined : undefined\n\tnavigate(routeId, elementId, Object.assign({}, implicitPathVariables, pathVariables), smoothScroll)\n\treturn true\n}\n", "import type { LinkToWebPage } from \"../LinkToWebPage.ts\"\nimport { type FramerPageLinkCollectionItemAttribute, isFramerPageLink, parseFramerPageLink } from \"../framerPageLink.ts\"\n\n/**\n * Convert a deprecated framer page link string (data:framer/page-link,augiA20Il) into the same shape as a ComplexLink from\n * Vekter.\n *\n * @internal\n */\nexport function linkFromFramerPageLink(link: string | undefined): LinkToWebPage | string | undefined {\n\tif (!isFramerPageLink(link)) return link\n\tconst parsed = parseFramerPageLink(link)\n\tif (!parsed) return undefined\n\tconst { target, element, collectionItem } = parsed\n\tif (!target) return undefined\n\n\treturn {\n\t\twebPageId: target,\n\t\thash: element ?? undefined,\n\t\tpathVariables: createVariablesFromPageLinkCollectionItem(collectionItem),\n\t}\n}\n\nfunction createVariablesFromPageLinkCollectionItem(\n\tcollectionItem: FramerPageLinkCollectionItemAttribute | undefined,\n): Record<string, string> | undefined {\n\tif (!collectionItem) return undefined\n\n\tconst variables: Record<string, string> = {}\n\tfor (const pathVariablesKey in collectionItem.pathVariables) {\n\t\tconst value = collectionItem.pathVariables[pathVariablesKey]\n\t\tif (value) variables[pathVariablesKey] = value\n\t}\n\treturn variables\n}\n", "import { frame } from \"framer-motion\"\nimport React from \"react\"\nimport { withCSS } from \"./withCSS.tsx\"\n\nexport interface TextSelectionColors {\n\tcolor?: string\n\tbackgroundColor?: string\n}\n\ninterface InjectSelectionStyleProps {\n\ttriggerId?: string\n\tchildren: React.ReactNode\n}\n\nconst textSelectionColorVariable = \"--text-selection-color\"\nconst textSelectionBackgroundColorVariable = \"--text-selection-background-color\"\n\nfunction updateTextSelectionStyles(triggerId?: string): TextSelectionColors | undefined {\n\tif (!triggerId) return\n\n\tframe.read(() => {\n\t\tconst el = document.getElementById(triggerId)\n\t\tif (!el) return\n\n\t\tconst styles = getComputedStyle(el)\n\t\tconst textSelectionColor = styles.getPropertyValue(\"--selection-color\").trim()\n\t\tconst textSelectionBackgroundColor = styles.getPropertyValue(\"--selection-background-color\").trim()\n\n\t\t// Set the text selection style variables on all matching elements. In the case of relative overlay, this will be the first portal child. In the case of fixed overlay, this will be both the overlay and any other children of the portal.\n\t\tframe.render(() => {\n\t\t\tconst overlayPortal = document.querySelectorAll<HTMLElement>(`[data-framer-portal-id=\"${triggerId}\"]`)\n\t\t\tif (overlayPortal.length === 0) return\n\n\t\t\tif (textSelectionColor) {\n\t\t\t\toverlayPortal.forEach(el => el.style.setProperty(textSelectionColorVariable, textSelectionColor))\n\t\t\t}\n\n\t\t\tif (textSelectionBackgroundColor) {\n\t\t\t\toverlayPortal.forEach(el =>\n\t\t\t\t\tel.style.setProperty(textSelectionBackgroundColorVariable, textSelectionBackgroundColor),\n\t\t\t\t)\n\t\t\t}\n\t\t})\n\t})\n}\n\nfunction getTextSelectionStylesFromTrigger(triggerId?: string): [string] {\n\treturn [\n\t\t`[data-framer-portal-id=\"${triggerId}\"] * ::selection {\n    color: var(${textSelectionColorVariable});\n    background-color: var(${textSelectionBackgroundColorVariable});\n}`,\n\t]\n}\n\nfunction InjectSelectionStyleWithoutCSS({ triggerId, children }: InjectSelectionStyleProps) {\n\tReact.useLayoutEffect(() => {\n\t\tif (triggerId) updateTextSelectionStyles(triggerId)\n\t}, [triggerId])\n\n\treturn children\n}\n\nexport const InjectSelectionStyle = /* @__PURE__ */ (() =>\n\twithCSS(\n\t\tInjectSelectionStyleWithoutCSS,\n\t\t(_target, props) => getTextSelectionStylesFromTrigger(props?.triggerId),\n\t\t\"InjectSelectionStyle\",\n\t))()\n", "import { Line } from \"./Line.ts\"\nimport { Point } from \"./Point.ts\"\nimport { Rect } from \"./Rect.ts\"\n\n/**\n * @internal\n */\nexport const Polygon = {\n\t/**\n\t * Determine if the vertices are ordered clockwise or counter-clockwise. This works for simple\n\t * (non-self-intersecting) convex polygons. If the polygon is collapsed into a line (signedArea = 0), we consider it\n\t * clockwise for it works with how Framer draws the polygons.\n\t * See: https://paulbourke.net/geometry/polygonmesh/\n\t * @internal */\n\tisClockwise: (points: Point[]) => {\n\t\treturn Polygon.signedArea(points) <= 0\n\t},\n\n\t/**\n\t * Calculate the signed area to determine if the vertices go clockwise or counter clockwise. We flip all the y\n\t * values because the y axis in our canvas coordinate is fipped.\n\t * See: https://mathworld.wolfram.com/PolygonArea.html\n\t * @internal */\n\tsignedArea: (points: Point[]) => {\n\t\tlet sum = 0\n\t\tconst len = points.length\n\t\tfor (let i = 0; i < len; i++) {\n\t\t\tconst pointA = points[i]\n\t\t\tconst pointB = points[(i + 1) % len]\n\t\t\tif (!pointA || !pointB) continue\n\n\t\t\tsum += pointA.x * -pointB.y - pointB.x * -pointA.y\n\t\t}\n\t\treturn (1 / 2) * sum\n\t},\n\n\t/**\n\t * Determine if some Point lies inside (or on) the polygon formed by other\n\t * Points. The other points must be provided in a clockwise/counter\n\t * clockwise order otherwise the line segments we create to test the polygon\n\t * will not be representative.\n\t *\n\t * Solution for convex polygons based on:\n\t * https://www.eecs.umich.edu/courses/eecs380/HANDOUTS/PROJ2/InsidePoly.html\n\t *\n\t * We create a line segment for each side of the polygon. The point we are\n\t * testing must be on or on the same side of each line segment.\n\t *\n\t * @internal\n\t */\n\tcontainsPoint: (polygonPoints: Point[], point: Point) => {\n\t\tlet sign: boolean | undefined = undefined\n\t\tfor (let i = 0; i < polygonPoints.length; i++) {\n\t\t\t// If the first point on the line we are testing is one of the\n\t\t\t// polygon points, we consider it inside.\n\t\t\tif (Point.isEqual(polygonPoints[i]!, point)) return true\n\n\t\t\t// Form a segment between the i'th point\n\t\t\tconst x1 = polygonPoints[i]?.x ?? 0\n\t\t\tconst y1 = polygonPoints[i]?.y ?? 0\n\n\t\t\t// And the i+1'th, or if i is the last, with the first point\n\t\t\tconst i2 = (i + 1) % polygonPoints.length\n\n\t\t\tif (Point.isEqual(polygonPoints[i2]!, point)) return true\n\n\t\t\tconst x2 = polygonPoints[i2]?.x ?? 0\n\t\t\tconst y2 = polygonPoints[i2]?.y ?? 0\n\n\t\t\t// Compute the cross product\n\t\t\tconst d = (point.x - x1) * (y2 - y1) - (point.y - y1) * (x2 - x1)\n\t\t\t// The point is on the line, consider it on the same side.\n\t\t\tif (d === 0) continue\n\n\t\t\tconst localSign = d > 0\n\t\t\t// Initialize the sign if it hasn't been set.\n\t\t\tsign ??= localSign\n\n\t\t\t// If the sign changes, then the point is on a different side.\n\t\t\tif (sign !== localSign) return false\n\t\t}\n\n\t\t// If no change in direction, then on same side of all segments, and thus inside\n\t\treturn true\n\t},\n\n\t/** @internal */\n\tintersects: (pointsA: Point[], pointsB: Point[]) => {\n\t\tif (pointsA.length < 1 || pointsB.length < 1) return false\n\n\t\t// Fast track: if the bounding boxes don't intersect, two polygons can't intersect.\n\t\tconst boundingRectA = Rect.boundingRectFromPoints(pointsA)\n\t\tconst boundingRectB = Rect.boundingRectFromPoints(pointsB)\n\t\tif (!Rect.intersects(boundingRectA, boundingRectB)) return false\n\n\t\t// Check if any edges intersect with another.\n\t\tconst edgesA: Line[] = []\n\t\tconst pointsALength = pointsA.length\n\t\tpointsA.forEach((point, index) => {\n\t\t\tconst nextPoint = pointsA[(index + 1) % pointsALength]\n\t\t\tif (!nextPoint) return\n\n\t\t\tedgesA.push(Line(point, nextPoint))\n\t\t})\n\n\t\tconst edgesB: Line[] = []\n\t\tconst pointsBLength = pointsB.length\n\t\tpointsB.forEach((point, index) => {\n\t\t\tconst nextPoint = pointsB[(index + 1) % pointsBLength]\n\t\t\tif (!nextPoint) return\n\n\t\t\tedgesB.push(Line(point, nextPoint))\n\t\t})\n\n\t\tfor (const edgeA of edgesA) {\n\t\t\tfor (const edgeB of edgesB) {\n\t\t\t\tconst intersection = Line.intersection(edgeA, edgeB, true)\n\t\t\t\tif (intersection) return true\n\t\t\t}\n\t\t}\n\n\t\t// Check if one is fully inside the other: if rect A contains rect B, one of the points on B must be in rect A (and vice versa)\n\t\t// The non-null assertion is safe because we already check the length at the beginning.\n\t\tif (Polygon.containsPoint(pointsB, pointsA[0]!)) return true\n\t\tif (Polygon.containsPoint(pointsA, pointsB[0]!)) return true\n\n\t\treturn false\n\t},\n\n\t/** @internal */\n\tcontains: (pointsA: Point[], pointsB: Point[]) => {\n\t\tfor (let i = 0; i < pointsB.length; i++) {\n\t\t\tif (!Polygon.containsPoint(pointsA, pointsB[i]!)) return false\n\t\t}\n\n\t\treturn true\n\t},\n\n\t/** @internal */\n\tclipToRect: (points: Point[], rect: Rect) => {\n\t\tconst edges = Rect.edges(rect)\n\n\t\t// When finding intersection points, we may have the same point multiple\n\t\t// times. Creating duplicate points means we will have to calculate the\n\t\t// same angle when organizing these points in a clockwise order. So we\n\t\t// avoid that by using a set of string representations of the points.\n\t\tconst seen = new Set<string>()\n\t\tconst count = points.length\n\n\t\tconst clippedPoints: Point[] = []\n\t\tconst originalPoints: Point[] = []\n\n\t\t// Next find points on the polygon inside the rect, otherwise the\n\t\t// intersection points of lines drawn between each polygon point, and\n\t\t// the edges of the clipping rect.\n\t\tfor (let i = 0; i < count; i++) {\n\t\t\tconst point = points[i]!\n\t\t\tconst nextPoint = points[(i + 1) % count]!\n\n\t\t\t// If the point lies in the rect, no need to clip it. Rect.contains\n\t\t\t// point is also very fast so we should use it.\n\t\t\tif (Rect.containsPoint(rect, point)) {\n\t\t\t\tconst intersectionKey = keyForPoint(point)\n\t\t\t\tseen.add(intersectionKey)\n\t\t\t\toriginalPoints.push(point)\n\t\t\t\t// If the next point is also inside the rect, we can continue as\n\t\t\t\t// we don't need to create a clipped point between these points.\n\t\t\t\tif (Rect.containsPoint(rect, nextPoint)) continue\n\t\t\t}\n\n\t\t\t// Otherwise we need to create points for each intersection of the\n\t\t\t// line formed between the point and the next point, and each edge\n\t\t\t// of the rectangle. This can form up to 2 points. We need to check\n\t\t\t// for intersection even if both points of the line aren't inside\n\t\t\t// the rect, as the line formed by the points may pass through 1 or\n\t\t\t// more edges of the rectangle.\n\t\t\tconst line = Line(point, nextPoint)\n\n\t\t\tedges.forEach(edge => {\n\t\t\t\tconst intersection = Line.intersection(line, edge, true)\n\t\t\t\tif (!intersection) return\n\n\t\t\t\tconst intersectionKey = keyForPoint(intersection)\n\t\t\t\tif (seen.has(intersectionKey)) return\n\n\t\t\t\tseen.add(intersectionKey)\n\t\t\t\tclippedPoints.push(intersection)\n\t\t\t})\n\t\t}\n\n\t\t// If we didn't clip any points, return the original points. That way we\n\t\t// don't waste cycles sorting them which can be slow.\n\t\tif (clippedPoints.length === 0) return originalPoints\n\n\t\t// Finally quickly add points of the clipping rect that are inside the\n\t\t// polygon. This ensures that removing a point outside of the rect\n\t\t// doesn't create lines that travel back through the rect to the next\n\t\t// point.\n\t\tRect.points(rect).forEach(point => {\n\t\t\tif (!Polygon.containsPoint(points, point)) return\n\t\t\tseen.add(keyForPoint(point))\n\t\t\tclippedPoints.push(point)\n\t\t})\n\n\t\treturn Point.sortClockwise([...originalPoints, ...clippedPoints])\n\t},\n}\n\nfunction keyForPoint(point: Point) {\n\treturn `${point?.x}-${point?.y}`\n}\n", "import type { Point } from \"../render/types/Point.ts\"\nimport { Polygon } from \"../render/types/Polygon.ts\"\nimport { Rect } from \"../render/types/Rect.ts\"\nimport type { Size } from \"../render/types/Size.ts\"\nimport { assertNever } from \"../utils/assert.ts\"\n\nexport type Placement = \"top\" | \"right\" | \"bottom\" | \"left\"\nexport type Alignment = \"start\" | \"center\" | \"end\"\n\nfunction invertPlacement(placement: Placement): Placement {\n\tswitch (placement) {\n\t\tcase \"top\":\n\t\t\treturn \"bottom\"\n\t\tcase \"right\":\n\t\t\treturn \"left\"\n\t\tcase \"bottom\":\n\t\t\treturn \"top\"\n\t\tcase \"left\":\n\t\t\treturn \"right\"\n\t\tdefault:\n\t\t\tassertNever(placement)\n\t}\n}\n\nfunction preferredOffset(point: number, length: number, max: number, collisionDetectionPadding: number = 0): number {\n\tconst min = Math.max(point, collisionDetectionPadding)\n\t// If the initial left point is smaller than the minimum left (0 or the\n\t// collision padding) return the min left to pin the floating element to the\n\t// left of the window.\n\tif (point < min) return min\n\t// Otherwise if the initial left point plus the size of the floating element\n\t// would cause part of the floating element to be off screen, return a left\n\t// value pinned to the right of the window.\n\tconst size = length + collisionDetectionPadding\n\tif (min + size > max) return max - size\n\n\t// Otherwise return the minimum left value, this should always be `point`.\n\treturn min\n}\n\nfunction collisionAxis(placement: Placement, rect: Rect, windowSize: Size): \"x\" | \"y\" | undefined {\n\tswitch (placement) {\n\t\tcase \"top\":\n\t\tcase \"bottom\":\n\t\t\tif (rect.y < 0 || rect.y + rect.height > windowSize.height) return \"y\"\n\t\t\treturn undefined\n\t\tcase \"left\":\n\t\tcase \"right\":\n\t\t\tif (rect.x < 0 || rect.x + rect.width > windowSize.width) return \"x\"\n\t\t\treturn undefined\n\t\tdefault:\n\t\t\tassertNever(placement)\n\t}\n}\n\nfunction getPlacementAndOffsetAvoidingScreenCollision(\n\trect: Rect,\n\tplacement: Placement,\n\toffset: Point,\n\twindowSize: Size,\n): { x: number; y: number; placement: Placement } {\n\tswitch (collisionAxis(placement, rect, windowSize)) {\n\t\tcase \"x\":\n\t\t\treturn {\n\t\t\t\tplacement: invertPlacement(placement),\n\t\t\t\tx: offset.x * -1,\n\t\t\t\ty: offset.y,\n\t\t\t}\n\t\tcase \"y\":\n\t\t\treturn {\n\t\t\t\tplacement: invertPlacement(placement),\n\t\t\t\tx: offset.x,\n\t\t\t\ty: offset.y * -1,\n\t\t\t}\n\t\tdefault:\n\t\t\treturn {\n\t\t\t\tplacement,\n\t\t\t\tx: offset.x,\n\t\t\t\ty: offset.y,\n\t\t\t}\n\t}\n}\n\nexport function getSafePlacementFloatingPositionRect(\n\tanchor: Rect,\n\telement: Rect,\n\tplacement: Placement,\n\talignment: Alignment,\n\toffset: Point,\n\t/**\n\t * If the floating layer should avoid collision with the window, provide the\n\t * window bounds as a Size.\n\t */\n\tcollisionDetectionSize?: Size,\n\tcollisionDetectionPadding?: number,\n): [Placement, Rect] {\n\tconst rebasedRect = Rect.rebaseRectOnto(element, anchor, placement, alignment)\n\tconst preferredRect: Rect = {\n\t\tx: rebasedRect.x + offset.x,\n\t\ty: rebasedRect.y + offset.y,\n\t\twidth: element.width,\n\t\theight: element.height,\n\t}\n\n\tif (!collisionDetectionSize) return [placement, preferredRect]\n\n\tconst {\n\t\tx,\n\t\ty,\n\t\tplacement: safePlacement,\n\t} = getPlacementAndOffsetAvoidingScreenCollision(preferredRect, placement, offset, collisionDetectionSize)\n\n\tconst rebasedCollisionRect = Rect.rebaseRectOnto(element, anchor, safePlacement, alignment)\n\n\treturn [\n\t\tsafePlacement,\n\t\t{\n\t\t\tx: preferredOffset(\n\t\t\t\trebasedCollisionRect.x + x,\n\t\t\t\telement.width,\n\t\t\t\tcollisionDetectionSize.width,\n\t\t\t\tcollisionDetectionPadding,\n\t\t\t),\n\t\t\ty: preferredOffset(\n\t\t\t\trebasedCollisionRect.y + y,\n\t\t\t\telement.height,\n\t\t\t\tcollisionDetectionSize.height,\n\t\t\t\tcollisionDetectionPadding,\n\t\t\t),\n\t\t\twidth: element.width,\n\t\t\theight: element.height,\n\t\t},\n\t]\n}\n\n/**\n *  Check if point a is inside a polygon formed of point b and other points. I\n *  so, use b, otherwise use a.\n */\nfunction preferredPoint(a: Point, b: Point, points: Point[]) {\n\tif (Polygon.containsPoint([b, ...points], a)) return b\n\treturn a\n}\n\n/**\n * Prevent the point of the polygon that is under the cursor from being closer\n * than 5px to the edge of the anchor on the axis of the Floating layers\n * placement. This ensures that the polygon can't be too shallow to be useful.\n */\nconst minInset = 5\nexport function safeAreaPolygonConstraints(rect: Rect) {\n\treturn {\n\t\tconstrainX: (value: number) => Math.min(Math.max(value, rect.x + minInset), rect.x + rect.width - minInset),\n\t\tconstrainY: (value: number) => Math.min(Math.max(value, rect.y + minInset), rect.y + rect.height - minInset),\n\t} as const\n}\n\nconst mouseOffset = 4\n\n/**\n * Create the points of a triangle between the mouse cursor, and one side\n * (determined by the placement) of the rect. The lines from the cursor point to\n * the side points should not intersect the provided rect.\n */\nexport function polygonPoints(\n\t{ x, y }: Point,\n\tplacement: Placement,\n\trect: Rect,\n\t{ constrainX, constrainY }: ReturnType<typeof safeAreaPolygonConstraints>,\n): Point[] {\n\tconst [tl, bl, tr, br] = Rect.points(rect)\n\n\tswitch (placement) {\n\t\tcase \"left\": {\n\t\t\tconst mousePoint: Point = { x: constrainX(x - mouseOffset), y }\n\t\t\treturn [mousePoint, preferredPoint(br, bl, [mousePoint, tr]), preferredPoint(tr, tl, [mousePoint, br])]\n\t\t}\n\t\tcase \"right\": {\n\t\t\tconst mousePoint: Point = { x: constrainX(x + mouseOffset), y }\n\t\t\treturn [mousePoint, preferredPoint(bl, br, [mousePoint, tl]), preferredPoint(tl, tr, [mousePoint, bl])]\n\t\t}\n\t\tcase \"top\": {\n\t\t\tconst mousePoint: Point = { x, y: constrainY(y - mouseOffset) }\n\t\t\treturn [mousePoint, preferredPoint(bl, tl, [mousePoint, br]), preferredPoint(br, tr, [mousePoint, bl])]\n\t\t}\n\t\tcase \"bottom\": {\n\t\t\tconst mousePoint: Point = { x, y: constrainY(y + mouseOffset) }\n\t\t\treturn [mousePoint, preferredPoint(tl, bl, [mousePoint, tr]), preferredPoint(tr, br, [mousePoint, tl])]\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(placement)\n\t}\n}\n\n/**\n * Create a css inset value for the safe area based on the placement of the\n * floating element, and the delta between the floating element and anchor\n * elements. The safe area is rendered inside the floating element, so the\n * offset should only be <= 0 to move the safe area in line with the anchor.\n */\nfunction safeAreaInset(placement: Placement, delta: Point): string {\n\tswitch (placement) {\n\t\tcase \"left\":\n\t\t\treturn `${Math.min(delta.y, 0)}px auto auto 0px`\n\t\tcase \"right\":\n\t\t\treturn `${Math.min(delta.y, 0)}px 0px auto auto`\n\t\tcase \"top\":\n\t\t\treturn `0px auto auto ${Math.min(delta.x, 0)}px`\n\t\tcase \"bottom\":\n\t\t\treturn `auto auto 0px ${Math.min(delta.x, 0)}px`\n\t\tdefault:\n\t\t\tassertNever(placement)\n\t}\n}\n\nexport function floatingPositionSafeAreaStyle(\n\tx: number,\n\ty: number,\n\tplacement: Placement,\n\tanchorRect: Rect,\n\tfloatingRect: Rect,\n): Partial<CSSStyleDeclaration> {\n\tconst minX = Math.min(floatingRect.x, anchorRect.x)\n\tconst minY = Math.min(floatingRect.y, anchorRect.y)\n\tconst rect = Rect.merge(anchorRect, floatingRect)\n\n\t// The points returned from `polygonPoints` are relative to the client, but\n\t// we will be drawing a polygon inside of a div, so we need to offset all of\n\t// the points so that the top right of the safe area is 0x0.\n\tconst points = polygonPoints({ x, y }, placement, floatingRect, safeAreaPolygonConstraints(anchorRect))\n\t\t.map(point => `${point.x - minX}px ${point.y - minY}px`)\n\t\t.join(\", \")\n\n\treturn {\n\t\theight: `${rect.height}px`,\n\t\twidth: `${rect.width}px`,\n\t\tclipPath: `polygon(${points})`,\n\t\tinset: safeAreaInset(placement, Rect.delta(anchorRect, floatingRect)),\n\t}\n}\n\nfunction valueForFloatingAlignment(alignment: Alignment): number {\n\tswitch (alignment) {\n\t\tcase \"start\":\n\t\t\treturn 0\n\t\tcase \"center\":\n\t\t\treturn 0.5\n\t\tcase \"end\":\n\t\t\treturn 1\n\t\tdefault:\n\t\t\tassertNever(alignment)\n\t}\n}\n\n/**\n * Convert Placement and Alignment to framer-motion's originX/originY so that\n * the Floating element always appears to animate from the anchor.\n */\nexport function motionOriginFromFloatingPosition(\n\tplacement: Placement | undefined = \"bottom\",\n\talignment: Alignment | undefined = \"center\",\n): { originX: number; originY: number } {\n\tswitch (placement) {\n\t\tcase \"top\":\n\t\t\treturn { originX: valueForFloatingAlignment(alignment), originY: 1 }\n\t\tcase \"right\":\n\t\t\treturn { originX: 0, originY: valueForFloatingAlignment(alignment) }\n\t\tcase \"bottom\":\n\t\t\treturn { originX: valueForFloatingAlignment(alignment), originY: 0 }\n\t\tcase \"left\":\n\t\t\treturn { originX: 1, originY: valueForFloatingAlignment(alignment) }\n\t\tdefault:\n\t\t\tassertNever(placement)\n\t}\n}\n", "import React from \"react\"\n\nexport const Instance = /* @__PURE__ */ React.forwardRef(function Instance(\n\t{ Component, ...props }: Record<string, unknown> & { Component: React.ComponentType<Record<string, unknown>> },\n\tref: React.Ref<unknown>,\n) {\n\treturn Component ? <Component {...props} ref={ref} /> : null\n})\n", "import { createElement, useContext } from \"react\"\nimport { GeneratedComponentContext } from \"./GeneratedComponentContext.ts\"\nimport { PropertyOverrides } from \"./PropertyOverrides.tsx\"\n\ninterface Props {\n\tcomponent: React.ComponentType<Record<string, unknown>>\n\tprops: Record<string, unknown>\n}\n\n/**\n * Automatically applies the active breakpoint variant name to embedded component instances\n * (e.g. components rendered from Rich Text) if they do not have a variant set.\n *\n * @internal\n */\nexport function AutoBreakpointVariant({ component, props }: Props) {\n\tconst generatedComponentContext = useContext(GeneratedComponentContext)\n\n\tconst element = createElement(component, props)\n\n\tif (\"variant\" in props && props.variant != null) {\n\t\treturn element\n\t}\n\n\tif (!generatedComponentContext) return element\n\n\tconst { activeVariantId, humanReadableVariantMap } = generatedComponentContext\n\n\tif (!activeVariantId || !humanReadableVariantMap) {\n\t\treturn element\n\t}\n\n\tconst overrides: Record<string, Record<string, unknown>> = {}\n\tfor (const [name, id] of Object.entries(humanReadableVariantMap)) {\n\t\toverrides[id] = { variant: name }\n\t}\n\n\treturn (\n\t\t<PropertyOverrides overrides={overrides} breakpoint={activeVariantId}>\n\t\t\t{element}\n\t\t</PropertyOverrides>\n\t)\n}\n", "import type React from \"react\"\nimport { Component } from \"react\"\nimport { sendTrackingEvent } from \"../utils/sendTrackingEvent.ts\"\nimport { getPleaseReportMessage, isBot } from \"../utils/utils.ts\"\n\ninterface Props {\n\tchildren: React.ReactNode\n}\n\ninterface State {\n\terror?: unknown\n}\n\n/**\n * Top-level error boundary that gracefully degrades to a non-interactive fallback UI. See also https://github.com/framer/company/issues/31364.\n * Inspired by https://github.com/uncurated-tests/graceful-degradation-hydration-error/blob/main/app/gracefully-degrading-error-boundary.tsx\n * @internal\n */\nexport class GracefullyDegradingErrorBoundary extends Component<Props, State> {\n\toverride state: State = { error: undefined }\n\n\tprivate message = \"Made UI non-interactive due to an error.\"\n\tprivate messageFatal = \"Fatal error.\"\n\n\tstatic getDerivedStateFromError(error: unknown) {\n\t\treturn { error }\n\t}\n\n\toverride componentDidCatch(error: unknown) {\n\t\twindow.__framer_hadFatalError = true\n\n\t\tif (\"cause\" in (error as Error)) {\n\t\t\t// eslint-disable-next-line framer-studio/tscompat -- This is a safe unwrap.\n\t\t\terror = (error as Error).cause // unwrap the error\n\t\t}\n\n\t\t// biome-ignore lint/suspicious/noConsole: intentional\n\t\tconsole.error(getPleaseReportMessage(isBot ? this.message : this.messageFatal, error))\n\n\t\tconst sampleRate = Math.random()\n\n\t\t// when code boundaries are released, make sure we don't flood immediately. Bump 25% -> 50% -> 100%.\n\t\tif (sampleRate > 0.5) return\n\t\tconst stack = error instanceof Error && typeof error.stack === \"string\" ? error.stack : null\n\t\tsendTrackingEvent(\"published_site_load_error\", {\n\t\t\tmessage: String(error),\n\t\t\tstack,\n\t\t})\n\t}\n\n\toverride render() {\n\t\tconst error = this.state.error\n\t\tif (!error) return this.props.children\n\n\t\t/**\n\t\t * At this point, we know that nothing interactive can happen anymore, so we can run side-effects (reading from the DOM) in render.\n\t\t *\n\t\t * As a side-note, we don't need to handle recoverable hydration errors here, because recoverable errors, such as hydration mismatches, are handled by React and skip error boundaries.\n\t\t * So we only need to handle fatal errors. A fatal error is an error outside of hydration, where React would unmount the root. An example would be a runtime TypeError.\n\t\t */\n\n\t\t// eslint-disable-next-line framer-studio/tscompat -- This is a safe unwrap.\n\t\tconst unwrappedError = \"cause\" in (error as Error) ? (error as Error).cause : error\n\t\tconst closingHTMLComment = /-->/gu // The only thing we need to escape in an HTML comment, is the closing tag.\n\t\tconst closingHTMLCommentReplacement = \"--!>\"\n\t\tconst dom = isBot\n\t\t\t? document.getElementById(\"main\")?.innerHTML || \"\"\n\t\t\t: // @FIXME: We should have a UI for fatal error recovery.\n\t\t\t\t// We don't have a UI for fatal error recovery currently, so we just render nothing for regular users. If we were to throw, React would unmount too.\n\t\t\t\t// We do render instead of throwing, so that:\n\t\t\t\t// - `componentDidCatch` runs (if we throw here, it does not)\n\t\t\t\t// - we can skip logging `Recoverable error during hydration`, because we know it was fatal.\n\t\t\t\t\"\"\n\n\t\treturn (\n\t\t\t// This has the caveat that we will slightly modify the DOM, but it appears to be fine in this case.\n\t\t\t// The alternative would be to queue a new task that runs after and then set the innerHTML (= avoids the dummy-div), but that means we'll have DOM -> no DOM -> DOM transitions. With the div, we have DOM -> DOM and remove possible race-conditions.\n\t\t\t<div\n\t\t\t\tstyle={{ display: \"contents\" }}\n\t\t\t\tsuppressHydrationWarning\n\t\t\t\t// biome-ignore lint/security/noDangerouslySetInnerHtml: React would unmount the root on errors, but we must ensure that bots can still read the SSR'd content.\n\t\t\t\tdangerouslySetInnerHTML={{\n\t\t\t\t\t__html:\n\t\t\t\t\t\t`<!-- DOM replaced by GracefullyDegradingErrorBoundary due to \"${(unwrappedError as Error).message.replace(closingHTMLComment, closingHTMLCommentReplacement)}\". ${getPleaseReportMessage()}: -->` +\n\t\t\t\t\t\t`<!-- Stack: ${(error as Error).stack?.replace(closingHTMLComment, \"--!>\")} -->` +\n\t\t\t\t\t\tdom,\n\t\t\t\t}}\n\t\t\t/>\n\t\t)\n\t}\n}\n", "import { isCommandKeyPressed, isIOS } from \"@framerjs/shared/src/environment.ts\"\nimport type { TapInfo } from \"framer-motion\"\nimport type { PropsWithChildren, RefAttributes } from \"react\"\nimport type React from \"react\"\nimport { forwardRef, isValidElement, useMemo } from \"react\"\nimport {\n\ttype MaybeRef,\n\ttype MutableRefCallback,\n\tuseObserverRef,\n\tuseRefEffect,\n} from \"../../components/utils/refHelper.ts\"\nimport { useCloneChildrenWithPropsAndRef } from \"../../components/utils/useCloneChildrenWithPropsAndRef.tsx\"\nimport { findAnchorElement } from \"../../render/utils/findAnchorElement.ts\"\nimport { useRouter } from \"../../router/RouterContext.tsx\"\nimport { getPathForRoute } from \"../../router/history.ts\"\nimport type { ActiveRoute, Locale, RouterAPI } from \"../../router/types.ts\"\nimport { useCurrentRoute } from \"../../router/useCurrentRoute.tsx\"\nimport { useLocaleInfo } from \"../../router/useLocale.ts\"\nimport { usePreloadRoute } from \"../../router/useRoutePreloader.ts\"\nimport { isBot, isEmptyObject, isFunction, isObject, isPromise, isString } from \"../../utils/utils.ts\"\nimport { yieldToMain } from \"../../utils/yield.ts\"\nimport { withChildrenCanSuspend } from \"../ChildrenCanSuspend.tsx\"\nimport { isLinkToWebPage } from \"../LinkToWebPage.ts\"\nimport { useIsOnFramerCanvas } from \"../useIsOnFramerCanvas.ts\"\nimport {\n\tfindMatchingRouteAttributesForResolvedPath,\n\tfindMatchingRouteAttributesForWebPageLink,\n} from \"./findMatchingRouteAttributes.tsx\"\nimport { linkFromFramerPageLink } from \"./linkFromFramerPageLink.tsx\"\nimport { linkMatchesRoute } from \"./linkMatchesRoute.tsx\"\nimport { observeRouteForPreloading } from \"./observeRouteForPreloading.ts\"\nimport { useImplicitPathVariables } from \"./pathVariables.tsx\"\nimport { type PropsForLinkOptions, getTargetAttrValue, propsForLink } from \"./propsForLink.tsx\"\nimport { useResolveSlugsWithSuspense } from \"./resolveSlugs.ts\"\nimport { AnchorLinkTarget, type LinkProps, type PropsAddedByLink, type PropsAddedByLinkInternal } from \"./types.ts\"\nimport { useReplaceNestedLinks } from \"./useReplaceNestedLinks.tsx\"\nimport { type TrackLinkClick, useTrackLinkClick } from \"./useTrackLinkClick.ts\"\n\nfunction performNavigation(\n\trouter: Partial<RouterAPI>,\n\trouteId: string,\n\tpreload: PropsAddedByLinkInternal[\"preload\"],\n\telementId?: string,\n\tcombinedPathVariables?: Record<string, unknown>,\n\tsmoothScroll?: boolean,\n\tbeforeUrlUpdate?: () => void,\n) {\n\tvoid preload()\n\trouter.navigate?.(routeId, elementId, combinedPathVariables, smoothScroll, beforeUrlUpdate)\n}\n\nfunction createOnClickLinkHandler(\n\thref: string,\n\ttrackLinkClick: TrackLinkClick,\n\tnavigate: PropsAddedByLinkInternal[\"navigate\"],\n) {\n\treturn async (event: React.MouseEvent | MouseEvent | React.PointerEvent | PointerEvent) => {\n\t\t// If command is pressed when clicking a link we want to open a new tab instead\n\t\tconst usedCommandKey = isCommandKeyPressed(event)\n\n\t\t/**\n\t\t * Note: in the preview iframe we hijack all anchor link\n\t\t * clicks and modify the target based on the href, so that\n\t\t * we won't try to open an external links in the preview\n\t\t * iframe, for example. (see src/app/vekter/src/preview-next/utils/interceptAnchorLinks.ts)\n\t\t */\n\t\t// We don't need SPA routing when opening links in a new tab\n\t\tconst anchorElement = findAnchorElement(event.target)\n\t\tconst isExternalLink = !anchorElement || anchorElement.getAttribute(\"target\") === AnchorLinkTarget._blank\n\t\tconst shouldPerformNavigation = !usedCommandKey && !isExternalLink\n\n\t\tconst track = () => void trackLinkClick(href)\n\t\tif (!shouldPerformNavigation) {\n\t\t\t// Yield before running tracking code to keep INP low; user-blocking so this queues before any other tasks\n\t\t\tawait yieldToMain({ priority: \"user-blocking\", ensureContinueBeforeUnload: true, continueAfter: \"paint\" })\n\t\t\ttrack()\n\t\t\treturn\n\t\t}\n\n\t\tevent.preventDefault()\n\t\tnavigate(track)\n\t}\n}\n\ntype Props = PropsWithChildren<LinkProps> & RefAttributes<unknown>\n\nfunction propsForRoutePath(\n\thref: string,\n\trouter: Partial<RouterAPI>,\n\tcurrentRoute: ActiveRoute | undefined,\n\tlinkOptions: PropsForLinkOptions & { smoothScroll: boolean | undefined },\n\tpreload: ReturnType<typeof usePreloadRoute>,\n\tlocaleId?: string,\n\tlocales?: readonly Locale[],\n\timplicitPathVariables?: Record<string, unknown>,\n): Partial<PropsAddedByLinkInternal> {\n\tif (!currentRoute) return propsForLink(href, linkOptions)\n\n\tconst matchedRoute = findMatchingRouteAttributesForResolvedPath(router, href, implicitPathVariables, locales)\n\t// If we couldn't find a matching route, we will assume the href is an external link.\n\tif (!matchedRoute) return propsForLink(href, linkOptions)\n\n\tconst { routeId, route, elementId, pathVariables, locale } = matchedRoute\n\tif (!route) return propsForLink(href, linkOptions)\n\n\t// Make the link relative to the current path if we can.\n\tconst path = getPathForRoute(route, {\n\t\t// If the link is resolved, we trust that the slugs are resolved.\n\t\tcurrentRoutePath: currentRoute.path,\n\t\tcurrentRoutePathLocalized: currentRoute.pathLocalized,\n\t\tcurrentPathVariables: currentRoute.pathVariables,\n\t\t// The hash value is already fully resolved so we don't need to\n\t\t// provide any hashVariables.\n\t\thash: elementId,\n\t\tpathVariables,\n\t\tpreserveQueryParams: router.preserveQueryParams && !isBot, // don't preserve query params for bots\n\t\tsiteCanonicalURL: router.siteCanonicalURL,\n\t\tlocaleId,\n\t})\n\n\tconst anchorTarget = getTargetAttrValue(linkOptions.openInNewTab, true)\n\tconst isBlankTarget = anchorTarget === AnchorLinkTarget._blank\n\tconst linkContext = { pathVariables, locale }\n\tconst navigate = (beforeUrlUpdate?: () => void) =>\n\t\tperformNavigation(\n\t\t\trouter,\n\t\t\trouteId,\n\t\t\t() => preload(routeId, linkContext, false, !isBlankTarget),\n\t\t\telementId,\n\t\t\tpathVariables,\n\t\t\tlinkOptions.smoothScroll,\n\t\t\tbeforeUrlUpdate,\n\t\t)\n\n\treturn {\n\t\thref: path,\n\t\ttarget: anchorTarget,\n\t\tonClick: createOnClickLinkHandler(path, linkOptions.trackLinkClick, navigate),\n\t\tnavigate,\n\t\t\"data-framer-page-link-current\":\n\t\t\t(currentRoute &&\n\t\t\t\tlinkMatchesRoute(\n\t\t\t\t\tcurrentRoute,\n\t\t\t\t\t{ webPageId: routeId, hash: elementId, pathVariables },\n\t\t\t\t\timplicitPathVariables,\n\t\t\t\t)) ||\n\t\t\tundefined,\n\n\t\tpreload: () => preload(routeId, linkContext, true, !isBlankTarget),\n\t\t_routeId: routeId,\n\t\t_pathVariables: pathVariables,\n\t\t_locale: locale,\n\t} satisfies PropsAddedByLinkInternal\n}\n\n/**\n * NOTE: Any change to this component should have a QA for this project https://development.framer.com/projects/Nested-Links--ozJyj13jPMDAbU9zv9WB-1rkcd\n */\n/** @public */\nexport const Link = /* @__PURE__ */ withChildrenCanSuspend<unknown, Props>(\n\t/* @__PURE__ */\n\tforwardRef(function Link(\n\t\t{\n\t\t\tchildren,\n\t\t\thref,\n\t\t\topenInNewTab,\n\t\t\tsmoothScroll,\n\t\t\tclickTrackingId,\n\t\t\trelValues,\n\t\t\tpreserveParams,\n\t\t\tnodeId,\n\t\t\tscopeId,\n\t\t\tmotionChild,\n\t\t\t...restProps\n\t\t}: Props,\n\t\tforwardedRef,\n\t) {\n\t\tconst router = useRouter()\n\t\tconst currentRoute = useCurrentRoute()\n\t\tconst implicitPathVariables = useImplicitPathVariables()\n\t\tconst { activeLocale, locales } = useLocaleInfo()\n\t\tconst resolveSlugsWithSuspense = useResolveSlugsWithSuspense()\n\t\tconst preload = usePreloadRoute()\n\t\tconst isOnFramerCanvas = useIsOnFramerCanvas()\n\n\t\tconst trackLinkClick = useTrackLinkClick({\n\t\t\tnodeId,\n\t\t\tclickTrackingId,\n\t\t\trouter,\n\t\t\thref,\n\t\t\tactiveLocale,\n\t\t})\n\n\t\tconst propsAddedByLink = useMemo((): Partial<PropsAddedByLinkInternal> => {\n\t\t\tif (!href) return {}\n\n\t\t\tconst pageLink = isLinkToWebPage(href) ? href : linkFromFramerPageLink(href)\n\t\t\tif (!pageLink) return {}\n\n\t\t\tif (isString(pageLink)) {\n\t\t\t\treturn propsForRoutePath(\n\t\t\t\t\tpageLink,\n\t\t\t\t\trouter,\n\t\t\t\t\tcurrentRoute,\n\t\t\t\t\t{ openInNewTab, trackLinkClick, rel: relValues?.join(\" \"), preserveParams, smoothScroll },\n\t\t\t\t\tpreload,\n\t\t\t\t\tactiveLocale?.id,\n\t\t\t\t\tlocales,\n\t\t\t\t\timplicitPathVariables,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tconst { unresolvedPathSlugs, unresolvedHashSlugs } = pageLink\n\t\t\tconst maybeResolvedSlugs = resolveSlugsWithSuspense(unresolvedPathSlugs, unresolvedHashSlugs, activeLocale)\n\n\t\t\t// FIXME: With React 19, use the `use` hook instead.\n\t\t\tif (isPromise(maybeResolvedSlugs)) {\n\t\t\t\tthrow maybeResolvedSlugs\n\t\t\t}\n\n\t\t\tconst maybeRouteAttributes = findMatchingRouteAttributesForWebPageLink(\n\t\t\t\trouter,\n\t\t\t\tcurrentRoute,\n\t\t\t\tpageLink,\n\t\t\t\tactiveLocale,\n\t\t\t\tmaybeResolvedSlugs,\n\t\t\t\timplicitPathVariables,\n\t\t\t)\n\n\t\t\tconst { routeId, href: resolvedHref, elementId, pathVariables, locale } = maybeRouteAttributes\n\n\t\t\tconst anchorTarget = getTargetAttrValue(openInNewTab, true)\n\t\t\tconst isBlankTarget = anchorTarget === AnchorLinkTarget._blank\n\t\t\tconst linkContext = { pathVariables, locale }\n\t\t\tconst navigate = (beforeUrlUpdate?: () => void) =>\n\t\t\t\tperformNavigation(\n\t\t\t\t\trouter,\n\t\t\t\t\trouteId,\n\t\t\t\t\t() => preload(routeId, linkContext, false, !isBlankTarget),\n\t\t\t\t\telementId,\n\t\t\t\t\tpathVariables,\n\t\t\t\t\tsmoothScroll,\n\t\t\t\t\tbeforeUrlUpdate,\n\t\t\t\t)\n\t\t\treturn {\n\t\t\t\thref: resolvedHref,\n\t\t\t\ttarget: anchorTarget,\n\t\t\t\tonClick: createOnClickLinkHandler(resolvedHref, trackLinkClick, navigate),\n\t\t\t\t\"data-framer-page-link-current\":\n\t\t\t\t\t(currentRoute && linkMatchesRoute(currentRoute, pageLink, implicitPathVariables)) || undefined,\n\n\t\t\t\tnavigate,\n\t\t\t\tpreload: () => preload(routeId, linkContext, true, !isBlankTarget),\n\t\t\t\t_routeId: routeId,\n\t\t\t\t_pathVariables: pathVariables,\n\t\t\t\t_locale: locale,\n\t\t\t} satisfies PropsAddedByLinkInternal\n\t\t}, [\n\t\t\thref,\n\t\t\trouter,\n\t\t\tactiveLocale,\n\t\t\timplicitPathVariables,\n\t\t\topenInNewTab,\n\t\t\tcurrentRoute,\n\t\t\tsmoothScroll,\n\t\t\ttrackLinkClick,\n\t\t\trelValues,\n\t\t\tlocales,\n\t\t\tpreserveParams,\n\t\t\tresolveSlugsWithSuspense,\n\t\t\tpreload,\n\t\t])\n\n\t\tconst hasRef = isValidElement(children) && \"ref\" in children\n\t\tconst observerRef = useObserverRef(hasRef ? (children.ref as MaybeRef<HTMLAnchorElement>) : undefined)\n\n\t\t// FIXME: Figure out why we are omitting navigate in propsAddedByLinkExceptNavigate; might be unnecessary\n\t\tconst {\n\t\t\tnavigate,\n\t\t\tpreload: preloadFn,\n\t\t\t_routeId,\n\t\t\t_pathVariables,\n\t\t\t_locale,\n\t\t\t...restPropsAddedByLink\n\t\t} = propsAddedByLink\n\n\t\tuseRefEffect(\n\t\t\tobserverRef,\n\t\t\t(node: HTMLAnchorElement | null) => {\n\t\t\t\tif (node === null || !_routeId || !preloadFn || isOnFramerCanvas) return\n\n\t\t\t\treturn observeRouteForPreloading?.(\n\t\t\t\t\tnode,\n\t\t\t\t\tpreloadFn,\n\t\t\t\t\t`${_routeId}:${_locale?.id}:${JSON.stringify(_pathVariables)}`,\n\t\t\t\t)\n\t\t\t},\n\t\t\t[preloadFn, _routeId, _pathVariables, _locale],\n\t\t)\n\n\t\t// `navigate` is only set for internal navigation\n\t\tconst isInternalNavigation = Boolean(navigate)\n\t\t// It must be the `forwardedRef`, not `observerRef` \u2013 otherwise the appear animation effect will not work.\n\t\t// FIXME: Figure out why and simplify\n\t\tconst clone = useCloneChildrenWithPropsAndRef(forwardedRef)\n\t\tconst replacedChildren = clone.cloneAsArray(children, childProps =>\n\t\t\tcloneChildPropsWithAggregatedEvents(\n\t\t\t\tchildProps,\n\t\t\t\t{\n\t\t\t\t\t...restProps,\n\t\t\t\t\t...rebindEventHandlersIfNeeded(restPropsAddedByLink, motionChild, isInternalNavigation),\n\t\t\t\t},\n\t\t\t\tobserverRef,\n\t\t\t),\n\t\t)\n\n\t\treturn useReplaceNestedLinks(replacedChildren, scopeId, nodeId, href, propsAddedByLink, observerRef)\n\t}),\n)\n\nfunction cloneChildPropsWithAggregatedEvents(\n\tchildProps: Record<string, unknown>,\n\tlinkProps: PropsAddedByLink,\n\tobserverRef: MutableRefCallback<HTMLAnchorElement>,\n) {\n\tconst mergedStyle = mergeStyles(childProps.style, linkProps.style)\n\n\tconst aggregatedProps = {\n\t\t...childProps,\n\t\t...linkProps,\n\t\t...(mergedStyle && { style: mergedStyle }),\n\t\tref: observerRef,\n\t}\n\tconst { onTap, onClick } = linkProps\n\tif (!onTap && !onClick) {\n\t\treturn aggregatedProps\n\t}\n\n\tconst { onClick: childOnClick, onTap: childOnTap } = childProps\n\n\t// If Link is hijacking onClick/onTap, aggregate with the ones coming from the child\n\t// props. For example, the child might be a variant that uses onTap for press variant.\n\treturn {\n\t\t...aggregatedProps,\n\t\tonClick:\n\t\t\tonClick || childOnClick\n\t\t\t\t? (event: React.MouseEvent) => {\n\t\t\t\t\t\tif (isFunction(childOnClick)) {\n\t\t\t\t\t\t\tchildOnClick?.(event)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonClick?.(event)\n\t\t\t\t\t}\n\t\t\t\t: undefined,\n\t\tonTap:\n\t\t\tonTap || childOnTap\n\t\t\t\t? (event: PointerEvent, info: TapInfo) => {\n\t\t\t\t\t\tif (isFunction(childOnTap)) {\n\t\t\t\t\t\t\tchildOnTap?.(event, info)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonTap?.(event, info)\n\t\t\t\t\t}\n\t\t\t\t: undefined,\n\t}\n}\n\n// Merges two style objects. Only returns a style object if at least one of the inputs has meaningful styles.\nfunction mergeStyles(childStyle: unknown, linkStyle: React.CSSProperties | undefined): React.CSSProperties | undefined {\n\tconst maybeChildStyle = isObject(childStyle) ? childStyle : undefined\n\tconst hasChildStyles = maybeChildStyle && !isEmptyObject(maybeChildStyle)\n\tconst hasLinkStyles = linkStyle && !isEmptyObject(linkStyle)\n\n\tif (!hasChildStyles && !hasLinkStyles) return undefined\n\n\treturn { ...maybeChildStyle, ...linkStyle }\n}\n\n// There's a long standing iOS/iPadOS bug where onClick is not triggered if the element is\n// unmounted by an onTap (variant transition). Hence on iOS we switch to use onTap. We can't\n// use onTap directly because we're not certain that the descendant would be a motion\n// component, so we have to bind the event listeners ourselves using `press`.\n// https://github.com/framer/company/issues/31758\n//\n// This should only be applied for internal navigation. External links use onClick\n// for click tracking and rely on default browser link handling - converting these\n// to onTap and inserting onClick with preventDefault would break that functionality.\nfunction rebindEventHandlersIfNeeded(\n\tlinkProps: PropsAddedByLink,\n\tmotionChild: boolean | undefined,\n\tisInternalNavigation: boolean,\n): PropsAddedByLink {\n\tconst shouldReplaceClickWithTap = Boolean(motionChild && isIOS())\n\tif (!shouldReplaceClickWithTap) return linkProps\n\n\tconst { onClick, ...restProps } = linkProps\n\t// If we're not binding onClick at all, just let browsers deal with the native navigation.\n\tif (!onClick) return linkProps\n\n\tif (isInternalNavigation) {\n\t\treturn {\n\t\t\t...restProps,\n\t\t\tonTap: onClick,\n\t\t\t// When the link is an internal link, we're already doing SPA routing in onClick\n\t\t\t// prevent the default click behavior so that we don't trigger a native anchor link navigation again.\n\t\t\tonClick: preventClickOnNativeAnchorLink,\n\t\t}\n\t}\n\n\t// External links don't do SPA routing, thus no need for preventDefault.\n\treturn { ...restProps, onTap: onClick }\n}\n\nfunction preventClickOnNativeAnchorLink(event: React.MouseEvent) {\n\tconst anchorElement = findAnchorElement(event.target)\n\tif (!anchorElement || anchorElement.getAttribute(\"target\") === AnchorLinkTarget._blank) return\n\n\tevent.preventDefault()\n}\n", "/**\n * Search the closest anchor element ancestor of the given target.\n * @param target The starting element.\n * @param withinElement If an element is given, the search will stop when it\n * hits the element. Otherwise, it will try to get the closest anchor element.\n */\nexport function findAnchorElement(target: unknown, withinElement?: HTMLElement | null): HTMLAnchorElement | null {\n\tif (target instanceof HTMLAnchorElement) {\n\t\treturn target\n\t}\n\n\tif (target instanceof Element) {\n\t\tif (target === withinElement) {\n\t\t\treturn null\n\t\t}\n\n\t\treturn findAnchorElement(target.parentElement, withinElement)\n\t}\n\n\treturn null\n}\n", "import type { ComponentType, ReactNode } from \"react\"\nimport { forwardRef } from \"react\"\nimport { SuspenseThatPreservesDom } from \"../router/SuspenseThatPreservesDom.tsx\"\n\nexport function ChildrenCanSuspend({ children }: { children: ReactNode }) {\n\treturn <SuspenseThatPreservesDom>{children}</SuspenseThatPreservesDom>\n}\n\nexport function withChildrenCanSuspend<T, P extends {}>(\n\tComponent: ComponentType<P>,\n): ReturnType<typeof forwardRef<T, P>> {\n\treturn forwardRef<T, P>(function withChildrenCanSuspendInner(props, ref) {\n\t\treturn (\n\t\t\t<ChildrenCanSuspend>\n\t\t\t\t<Component {...props} ref={ref} />\n\t\t\t</ChildrenCanSuspend>\n\t\t)\n\t})\n}\n", "import { getPathForRoute } from \"../../router/history.ts\"\nimport { inferInitialRouteFromPath } from \"../../router/inferInitialRouteFromPath.ts\"\nimport type { ActiveRoute, Locale, Route, RouterAPI } from \"../../router/types.ts\"\nimport { assert } from \"../../utils/assert.ts\"\nimport type { LinkToWebPage } from \"../LinkToWebPage.ts\"\nimport type { ResolvedSlugs } from \"./resolveSlugs.ts\"\nimport { isInternalURL } from \"./urlChecks.tsx\"\n\nexport function findMatchingRouteAttributesForWebPageLink(\n\trouter: Partial<RouterAPI>,\n\tcurrentRoute: ActiveRoute | undefined,\n\tpageLink: LinkToWebPage,\n\tactiveLocale: Locale | null,\n\tresolvedSlugs: ResolvedSlugs,\n\timplicitPathVariables?: Record<string, unknown>,\n): RouteAttributes {\n\tconst { webPageId, hash, pathVariables, hashVariables } = pageLink\n\n\treturn getRouteAttributes(\n\t\trouter,\n\t\tcurrentRoute,\n\t\twebPageId,\n\t\thash,\n\t\timplicitPathVariables,\n\t\tpathVariables,\n\t\thashVariables,\n\t\tresolvedSlugs,\n\t\tactiveLocale,\n\t)\n}\n\nexport function findMatchingRouteAttributesForResolvedPath(\n\trouter: Partial<RouterAPI>,\n\tpath: string,\n\timplicitPathVariables?: Record<string, unknown>,\n\tlocales?: readonly Locale[],\n): RouteAttributes | undefined {\n\tif (!router.routes || !router.getRoute) {\n\t\treturn\n\t}\n\n\tconst isInternal = isInternalURL(path)\n\tif (!isInternal) {\n\t\treturn\n\t}\n\n\ttry {\n\t\tconst [pathnameWithQueryParams, hash] = path.split(\"#\", 2)\n\t\tassert(pathnameWithQueryParams !== undefined, \"A href must have a defined pathname.\")\n\t\tconst [pathname] = pathnameWithQueryParams.split(\"?\", 2)\n\t\tassert(pathname !== undefined, \"A href must have a defined pathname.\")\n\t\tconst { routeId, pathVariables, localeId } = inferInitialRouteFromPath(router.routes, pathname, undefined, locales)\n\t\tconst route = router.getRoute(routeId)\n\t\tif (route) {\n\t\t\tconst combinedPathVariables = Object.assign({}, implicitPathVariables, pathVariables)\n\t\t\tconst locale = localeId ? locales?.find(({ id }) => id === localeId) : undefined\n\n\t\t\treturn {\n\t\t\t\trouteId,\n\t\t\t\troute,\n\t\t\t\thref: path,\n\t\t\t\t// If the link is resolved (in ResolveLink), we trust that the hash is also resolved. Otherwise, it\n\t\t\t\t// should be resolved by getHashForRoute.\n\t\t\t\telementId: hash,\n\t\t\t\tpathVariables: combinedPathVariables,\n\t\t\t\tlocale,\n\t\t\t}\n\t\t}\n\t} catch {\n\t\t// Fall through, we could not match the path to a path defined in our\n\t\t// routes. We will assume the href is an external link.\n\t}\n}\n\ninterface RouteAttributes {\n\trouteId: string\n\troute: Route | undefined\n\thref: string\n\telementId?: string\n\tpathVariables?: Record<string, unknown>\n\tlocale?: Locale\n}\n\nfunction getRouteAttributes(\n\trouter: Partial<RouterAPI>,\n\tcurrentRoute: ActiveRoute | undefined,\n\trouteId: string,\n\thash: string | undefined,\n\timplicitPathVariables: Record<string, unknown> | undefined,\n\tpathVariables: Record<string, unknown> | undefined,\n\thashVariables: Record<string, unknown> | undefined,\n\tresolvedSlugs: ResolvedSlugs | undefined,\n\tactiveLocale?: Locale | null,\n) {\n\tconst combinedPathVariables = { ...implicitPathVariables, ...pathVariables, ...resolvedSlugs?.path }\n\tconst combinedHashVariables = { ...implicitPathVariables, ...hashVariables, ...resolvedSlugs?.hash }\n\n\tconst route = router.getRoute?.(routeId)\n\tconst resolvedHref = getPathForRoute(route, {\n\t\tcurrentRoutePath: currentRoute?.path,\n\t\tcurrentRoutePathLocalized: currentRoute?.pathLocalized,\n\t\tcurrentPathVariables: currentRoute?.pathVariables,\n\t\thash: hash,\n\t\tpathVariables: combinedPathVariables,\n\t\thashVariables: combinedHashVariables,\n\t\tpreserveQueryParams: router.preserveQueryParams,\n\t\tsiteCanonicalURL: router.siteCanonicalURL,\n\t\tlocaleId: activeLocale?.id,\n\t})\n\n\tconst resolvedHash = resolvedHref.split(\"#\", 2)[1]\n\n\treturn {\n\t\trouteId,\n\t\troute,\n\t\thref: resolvedHref,\n\t\telementId: resolvedHash,\n\t\tpathVariables: combinedPathVariables,\n\t\tlocale: activeLocale ?? undefined,\n\t}\n}\n", "import { useContext } from \"react\"\nimport type { ActiveRoute } from \"../../router/types.ts\"\nimport { useCurrentRoute } from \"../../router/useCurrentRoute.tsx\"\nimport { isString } from \"../../utils/utils.ts\"\nimport { isLinkToWebPage } from \"../LinkToWebPage.ts\"\nimport type { LinkToWebPage } from \"../LinkToWebPage.ts\"\nimport { linkFromFramerPageLink } from \"./linkFromFramerPageLink.tsx\"\nimport { PathVariablesContext, pathVariablesRegExp } from \"./pathVariables.tsx\"\n\n/**\n * @param route The current route to compare against.\n * @param link The link that may point at the current page.\n * @param implicitPathVariables Path variables that will be used by default if\n * not explicitly defined in the link.\n */\nexport function linkMatchesRoute(\n\troute: ActiveRoute,\n\t{\n\t\twebPageId,\n\t\thash,\n\t\tpathVariables,\n\t}: Omit<LinkToWebPage, \"pathVariables\"> & { pathVariables?: Record<string, unknown> },\n\timplicitPathVariables?: Record<string, unknown>,\n): boolean {\n\tif (webPageId !== route.id) return false\n\t// If we allowed page links to be active when they had an element, all page\n\t// links that were to an element on the current page would always be active.\n\t// We don't want that, so for now, we ignore links with elements. In future,\n\t// maybe we can build a feature so that links to an element on the current\n\t// page are only active when the element is in view.\n\tif (hash) return false\n\t// If there's path variables provided via a context, we should only return\n\t// true when the context matches the path variable in the current route.\n\tif (route.path && route.pathVariables) {\n\t\tconst combinedPathVariable = Object.assign({}, implicitPathVariables, pathVariables)\n\t\tfor (const [, key] of route.path.matchAll(pathVariablesRegExp)) {\n\t\t\tif (!key) return false\n\t\t\tif (route.pathVariables[key] !== combinedPathVariable[key]) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\treturn true\n}\n\n/**\n * @internal\n */\nexport function useLinkMatchesRoute(link: unknown): boolean {\n\tconst route = useCurrentRoute()\n\tconst contextPathVariables = useContext(PathVariablesContext)\n\tif (!route) return false\n\tconst pageLink = isString(link) ? linkFromFramerPageLink(link) : link\n\treturn isLinkToWebPage(pageLink) ? linkMatchesRoute(route, pageLink, contextPathVariables) : false\n}\n", "import { createContext, useContext } from \"react\"\nimport { useCurrentRoute } from \"../../router/useCurrentRoute.tsx\"\n\n// Note: This regular expression should match all other places in our code base.\nexport const pathVariablesRegExp = /:([a-z]\\w*)/gi\n\n/** @internal */\nexport const PathVariablesContext = /* @__PURE__ */ createContext<Record<string, unknown> | undefined>(undefined)\n\n/**\n * Implicit path variables (defaults to use for links) are provided\u2026\n *\n * - via the PathVariablesContext, for use with repeaters\n *\n *   e.g. a link to /blog/:slug, repeated multiple times with different :slug\n *   variables\n *\n * - via the current dynamic page\n *\n *   e.g. a page links to itself (permalink? scroll target?)\n *\n * XXX: You never know which route these path variables are intended for, so\n * it's possible to have a mismatch. Should this hook accept a route ID?\n *\n * @internal\n */\nexport function useImplicitPathVariables() {\n\tconst contextPathVariables = useContext(PathVariablesContext)\n\tconst currentPathVariables = useCurrentRoute()?.pathVariables\n\tconst pathVariables = contextPathVariables || currentPathVariables\n\treturn pathVariables\n}\n", "import { shouldPreloadBasedOnUA } from \"../../router/useRoutePreloader.ts\"\nimport type { PropsAddedByLinkInternal } from \"./types.ts\"\n\ndeclare global {\n\tinterface NetworkInformation {\n\t\teffectiveType?: string\n\t\tsaveData?: boolean\n\t\taddEventListener?: (type: string, listener: (event: Event) => void) => void\n\t}\n\n\tinterface Navigator {\n\t\tconnection?: NetworkInformation\n\t\tmozConnection?: NetworkInformation\n\t\twebkitConnection?: NetworkInformation\n\t\tdeviceMemory?: number\n\t}\n}\n\n/**\n * Context stored for each observed element to enable data preloading.\n */\nexport interface ObservedRouteContext {\n\tid: string\n\tpreload: () => void | Promise<void>\n}\n\nconst PRELOAD_AFTER_MS = 500 // ms\nconst OBSERVER_THRESHOLD = 0.9 // 90% in viewport\nconst LOW_MEMORY_THRESHOLD = 1.7 // GB\nconst MAX_CONCURRENT_PRELOADS_SLOW_NETWORK = 4\nconst MAX_CONCURRENT_PRELOADS_FAST_NETWORK = Infinity\nexport const nodeToRoute = new WeakMap<Element, ObservedRouteContext | undefined>()\nexport const preloadedRoutes = new Set<string>()\nexport const routeToNodesInViewport = new Map<string, Set<Element>>()\n\n// see https://www.notion.so/framer/RFC-Preloading-Routes-V2-9feb51be6e8042a0b82bdc0a0ce0dab0\nexport function getObserveRouteForPreloadingFn() {\n\t// eslint-disable-next-line compat/compat\n\tconst connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection || {}\n\t// eslint-disable-next-line compat/compat\n\tconst lowDeviceMemory = navigator.deviceMemory && navigator.deviceMemory > LOW_MEMORY_THRESHOLD\n\n\t// eslint-disable-next-line framer-studio/no-implicit-undefined-let -- assigned in updateConnection\n\tlet effectiveType: string, preloadDisabled: boolean, maxPreloadAmount: number\n\tfunction updateConnection() {\n\t\teffectiveType = connection.effectiveType || \"\"\n\t\t// for 2G/slow-2G, preloads might compete with e.g. images when users scroll down, so we don't want to take away network capacity by preloading.\n\t\t// we could check for `navigator.onLine` too, but that's not reliable: https://jfhr.me/how-to-really-know-if-your-webapp-is-online/\n\t\tpreloadDisabled = connection.saveData || effectiveType.includes(\"2g\")\n\t\t// 3G is slower than 4G, so we don't want to preload too much at once to avoid saturating the network.\n\t\tmaxPreloadAmount =\n\t\t\teffectiveType === \"3g\" || lowDeviceMemory\n\t\t\t\t? MAX_CONCURRENT_PRELOADS_SLOW_NETWORK\n\t\t\t\t: MAX_CONCURRENT_PRELOADS_FAST_NETWORK\n\t}\n\n\tconnection.addEventListener?.(\"change\", updateConnection)\n\tupdateConnection()\n\n\tconst observer = new IntersectionObserver(onPreloadIntersectionChange, { threshold: OBSERVER_THRESHOLD })\n\n\tlet activePreloadsAmount = 0\n\tasync function preloadTimeout(context: ObservedRouteContext, target: Element) {\n\t\t// limitation: if network changes while a node is in viewport, we will not preload it (we'll preload only when it exits and re-enters the viewport again).\n\t\t// TODO: when we add a queue (line 82), we could handle this case too (manage a queue while internet is slow).\n\t\tif (preloadDisabled) return\n\n\t\tconst { id, preload } = context\n\t\tconst nodesInViewport = routeToNodesInViewport.get(id)\n\t\t// we don't clear timeouts but still want to prevent preloading routes more than once.\n\t\t// so we don't do anything if no more nodes that relate to the route are in viewport,\n\t\t// or if the preload has been started already.\n\t\tif (!nodesInViewport?.size || preloadedRoutes.has(id)) return\n\n\t\t++activePreloadsAmount\n\t\tpreloadedRoutes.add(id)\n\n\t\tconst preloadPromise = preload()?.catch(() => {\n\t\t\tif (process.env.NODE_ENV !== \"production\") {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Error in preloadRoute during preloadTimeout. This should never happen as it introduces bugs. Please make sure preloadRoute does not throw.\",\n\t\t\t\t)\n\t\t\t}\n\t\t})\n\n\t\t// unobserve all nodes related to the route and clear the set.\n\t\tobserver.unobserve(target)\n\t\tnodeToRoute.delete(target)\n\t\tfor (const node of nodesInViewport) {\n\t\t\tobserver.unobserve(node)\n\t\t\tnodeToRoute.delete(node)\n\t\t}\n\t\tnodesInViewport.clear()\n\t\trouteToNodesInViewport.delete(id)\n\n\t\tawait preloadPromise\n\t\t--activePreloadsAmount\n\t}\n\n\tfunction onPreloadIntersectionChange(entries: IntersectionObserverEntry[]) {\n\t\tfor (const entry of entries) {\n\t\t\tconst target = entry.target\n\t\t\tconst context = nodeToRoute.get(target)\n\n\t\t\tif (!context || preloadedRoutes.has(context.id)) {\n\t\t\t\t// we could use WeakRefs and store all routeToNodes (not only those in the viewport) but Safari 13.1 doesn't support it.\n\t\t\t\t// However, trading less complexity with paying a small fee of observing some nodes a bit too long (they have been preloaded already) seems to be a good tradeoff.\n\t\t\t\tobserver.unobserve(target)\n\t\t\t\tnodeToRoute.delete(target)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst preloadId = context.id\n\t\t\tconst nodes = routeToNodesInViewport.get(preloadId)\n\t\t\tconst amountOfNodesInViewport = routeToNodesInViewport.get(preloadId)?.size ?? 0\n\n\t\t\tif (entry.isIntersecting) {\n\t\t\t\t// TODO: Refac to use a queue / p-limit instead of this check\n\t\t\t\t// currently, we might lose preloads here (should be preloaded, but we don't, as limit is reached).\n\t\t\t\t// so only on the next out of viewport -> in viewport, the route is considered again.\n\t\t\t\tif (activePreloadsAmount >= maxPreloadAmount) continue\n\n\t\t\t\tif (nodes) nodes.add(target)\n\t\t\t\telse routeToNodesInViewport.set(preloadId, new Set([target]))\n\n\t\t\t\tsetTimeout(preloadTimeout, PRELOAD_AFTER_MS, context, target)\n\t\t\t} else {\n\t\t\t\tif (nodes) nodes.delete(target)\n\t\t\t\t// if the size is 0 or 1 (as the current node has exited the viewport), we can remove the route.\n\t\t\t\tif (amountOfNodesInViewport <= 1) routeToNodesInViewport.delete(preloadId)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn (node: Element, preload: PropsAddedByLinkInternal[\"preload\"], id: string) => {\n\t\t// we already preloaded this route, so no need to observe the node.\n\t\tif (preloadedRoutes.has(id)) return\n\t\tnodeToRoute.set(node, { id, preload })\n\t\tobserver.observe(node)\n\n\t\treturn () => {\n\t\t\tnodeToRoute.delete(node)\n\t\t\tobserver.unobserve(node)\n\t\t}\n\t}\n}\n\nexport const observeRouteForPreloading =\n\t// this also guards `window`\n\t!shouldPreloadBasedOnUA || typeof IntersectionObserver === \"undefined\"\n\t\t? null\n\t\t: /* @__PURE__ */ getObserveRouteForPreloadingFn()\n", "import type { TapHandlers } from \"framer-motion\"\nimport type { CSSProperties } from \"react\"\nimport type { SupportedLinkRelValue } from \"../../render/types/SupportedRelValue.ts\"\nimport type { Locale } from \"../../router/types.ts\"\nimport type { LinkToWebPage } from \"../LinkToWebPage.ts\"\nimport type { ObservedRouteContext } from \"./observeRouteForPreloading.ts\"\n\nexport interface LinkProps {\n\thref: string | LinkToWebPage | undefined\n\t/**\n\t * Which browsing context to display the linked URL. If not provided, the\n\t * Link component will only open the link in a new tab if the href is an\n\t * external URL.\n\t */\n\topenInNewTab?: boolean\n\tsmoothScroll?: boolean\n\tclickTrackingId?: string\n\trelValues?: readonly SupportedLinkRelValue[]\n\tpreserveParams?: boolean\n\tnodeId?: string\n\tscopeId?: string\n\t/**\n\t * Indicates whether `motion.a` is used for the child component, allowing the use of `onTap`\n\t * instead of `onClick` on the link.\n\t */\n\tmotionChild?: boolean\n\tstyle?: CSSProperties\n}\n\nexport interface PropsAddedByLink {\n\thref?: string\n\ttarget?: string\n\trel?: string\n\tonClick?: (\n\t\tevent: React.MouseEvent | MouseEvent | React.PointerEvent | PointerEvent | React.TouchEvent | TouchEvent,\n\t) => void\n\tonTap?: TapHandlers[\"onTap\"]\n\t// TODO: Rollup fails when we import PageLinkAttribute in this file.\n\t\"data-framer-page-link-current\"?: true | undefined\n\tstyle?: CSSProperties\n}\n\n/** Props for internal (same-site) links. */\nexport interface PropsAddedByLinkInternal extends PropsAddedByLink {\n\tnavigate: (beforeUrlUpdate?: () => void) => void\n\tpreload: ObservedRouteContext[\"preload\"]\n\n\t/** @internal */\n\t_routeId: string\n\t/** @internal */\n\t_pathVariables?: Record<string, unknown>\n\t/** @internal */\n\t_locale?: Locale\n}\n\n/** @internal */\nexport enum AnchorLinkTarget {\n\t_blank = \"_blank\",\n\t_self = \"_self\",\n}\n", "import type { AnchorHTMLAttributes } from \"react\"\nimport { forwardCurrentQueryParams } from \"../../router/forwardQueryParams.ts\"\nimport { AnchorLinkTarget } from \"./types.ts\"\nimport { isInternalURL, isValidURL } from \"./urlChecks.tsx\"\nimport type { TrackLinkClick } from \"./useTrackLinkClick.ts\"\n\ntype LinkAttributes = Pick<AnchorHTMLAttributes<HTMLAnchorElement>, \"href\" | \"rel\" | \"target\" | \"onClick\"> & {\n\t\"data-framer-preserve-params\"?: boolean\n}\nexport interface PropsForLinkOptions {\n\topenInNewTab: boolean | undefined\n\ttrackLinkClick: TrackLinkClick\n\trel: string | undefined\n\tpreserveParams: boolean | undefined\n}\n\nexport function propsForLink(href: string, options?: PropsForLinkOptions): LinkAttributes {\n\tconst isInternal = isInternalURL(href)\n\n\tconst props: LinkAttributes = {\n\t\thref: href === \"\" || isValidURL(href, isInternal) ? href : `https://${href}`,\n\t\ttarget: getTargetAttrValue(options?.openInNewTab, isInternal),\n\t\trel: !isInternal ? combineRels(\"noopener\", options?.rel) : undefined,\n\t}\n\n\tif (options?.preserveParams) {\n\t\tprops.href = forwardCurrentQueryParams(props.href ?? href)\n\t\t// required for rewriteLinksWithQueryParams.ts to work and params to be preserved in SSGd pages\n\t\tprops[\"data-framer-preserve-params\"] = true\n\t}\n\n\tif (options?.trackLinkClick) {\n\t\tprops.onClick = () => {\n\t\t\tvoid options.trackLinkClick(href)\n\t\t}\n\t}\n\n\treturn props\n}\n\nexport function getTargetAttrValue(\n\topenInNewTab: boolean | undefined,\n\tisInternal: boolean,\n): AnchorLinkTarget | undefined {\n\tif (openInNewTab !== undefined) {\n\t\t// `_self` is the browser default, we can just omit the attribute\n\t\treturn openInNewTab ? AnchorLinkTarget._blank : undefined\n\t}\n\n\t// If the target prop is not set, fallback to the default behavior based on the link\n\treturn isInternal ? undefined : AnchorLinkTarget._blank\n}\n\nfunction combineRels(rel: string | undefined, otherRel: string | undefined) {\n\tif (rel && !otherRel) return rel\n\tif (!rel && otherRel) return otherRel\n\tif (rel && otherRel) return `${rel} ${otherRel}`\n\treturn undefined\n}\n", "import { useCallback } from \"react\"\nimport type { LocaleInfo } from \"../../router/types.ts\"\nimport { assert } from \"../../utils/assert.ts\"\nimport { isPromise } from \"../../utils/utils.ts\"\nimport type { LinkToWebPage } from \"../LinkToWebPage.ts\"\nimport { type CollectionUtilsCacheContextValue, useCollectionUtils } from \"../cms/CollectionUtilsCache.tsx\"\nimport { resolveSlug } from \"../resolveSlug.ts\"\n\nexport async function resolveSlugs(\n\tunresolvedPathSlugs: LinkToWebPage[\"unresolvedPathSlugs\"],\n\tunresolvedHashSlugs: LinkToWebPage[\"unresolvedHashSlugs\"],\n\tactiveLocale: LocaleInfo[\"activeLocale\"],\n\tcollectionUtils: CollectionUtilsCacheContextValue,\n): Promise<ResolvedSlugs> {\n\tasync function handleSlugs(\n\t\tunresolvedSlugs: LinkToWebPage[\"unresolvedPathSlugs\"],\n\t): Promise<Record<string, string | undefined>> {\n\t\tif (!unresolvedSlugs) return {}\n\n\t\tconst result: Record<string, string | undefined> = {}\n\n\t\tfor (const slugKey in unresolvedSlugs) {\n\t\t\tconst unresolvedSlug = unresolvedSlugs[slugKey]\n\t\t\tassert(unresolvedSlug, \"unresolvedSlug should be defined\")\n\n\t\t\tconst maybeSlug = resolveSlug(unresolvedSlug, collectionUtils, activeLocale)\n\t\t\tconst value = isPromise(maybeSlug) ? await maybeSlug : maybeSlug\n\t\t\tif (value) {\n\t\t\t\tresult[slugKey] = value\n\t\t\t}\n\t\t}\n\n\t\treturn result\n\t}\n\n\tconst [pathResult, slugResult] = await Promise.allSettled([\n\t\thandleSlugs(unresolvedPathSlugs),\n\t\thandleSlugs(unresolvedHashSlugs),\n\t])\n\n\treturn {\n\t\tpath: pathResult.status === \"fulfilled\" ? pathResult.value : undefined,\n\t\thash: slugResult.status === \"fulfilled\" ? slugResult.value : undefined,\n\t}\n}\n\nexport function resolveSlugsWithSuspense(\n\tunresolvedPathSlugs: LinkToWebPage[\"unresolvedPathSlugs\"],\n\tunresolvedHashSlugs: LinkToWebPage[\"unresolvedHashSlugs\"],\n\tactiveLocale: LocaleInfo[\"activeLocale\"],\n\tcollectionUtils: CollectionUtilsCacheContextValue,\n\tpromises: Promise<string | undefined>[] = [],\n): ResolvedSlugs | Promise<PromiseSettledResult<string | undefined>[]> {\n\tfunction handleSlugs(unresolvedSlugs: LinkToWebPage[\"unresolvedPathSlugs\"]) {\n\t\tif (!unresolvedSlugs) return\n\n\t\tconst result: Record<string, string | undefined> = {}\n\n\t\tfor (const slugKey in unresolvedSlugs) {\n\t\t\tconst unresolvedSlug = unresolvedSlugs[slugKey]\n\t\t\tif (!unresolvedSlug) continue\n\n\t\t\tconst maybeSlug = resolveSlug(unresolvedSlug, collectionUtils, activeLocale)\n\t\t\tif (isPromise(maybeSlug)) {\n\t\t\t\tpromises.push(maybeSlug)\n\t\t\t} else if (maybeSlug) {\n\t\t\t\tresult[slugKey] = maybeSlug\n\t\t\t}\n\t\t}\n\n\t\treturn result\n\t}\n\n\tconst result: ResolvedSlugs = {\n\t\tpath: handleSlugs(unresolvedPathSlugs),\n\t\thash: handleSlugs(unresolvedHashSlugs),\n\t}\n\n\tif (promises.length > 0) {\n\t\treturn Promise.allSettled(promises)\n\t}\n\n\treturn result\n}\n\nexport function useResolveSlugsWithSuspense() {\n\tconst collectionUtils = useCollectionUtils()\n\treturn useCallback(\n\t\t(\n\t\t\tunresolvedPathSlugs: LinkToWebPage[\"unresolvedPathSlugs\"],\n\t\t\tunresolvedHashSlugs: LinkToWebPage[\"unresolvedHashSlugs\"],\n\t\t\tactiveLocale: LocaleInfo[\"activeLocale\"],\n\t\t\tpromises: Promise<string | undefined>[] = [],\n\t\t) => {\n\t\t\treturn resolveSlugsWithSuspense(unresolvedPathSlugs, unresolvedHashSlugs, activeLocale, collectionUtils, promises)\n\t\t},\n\t\t[collectionUtils],\n\t)\n}\n\nexport interface ResolvedSlugs {\n\tpath: Record<string, string | undefined> | undefined\n\thash: Record<string, string | undefined> | undefined\n}\n", "import type { LocaleInfo } from \"../router/types.ts\"\nimport { getPleaseReportMessage, isPromise } from \"../utils/utils.ts\"\nimport type { UnresolvedSlug } from \"./LinkToWebPage.ts\"\nimport type { CollectionUtilsCache, CollectionUtilsCacheContextValue } from \"./cms/CollectionUtilsCache.tsx\"\n\ntype MaybeSlug = ReturnType<CollectionUtilsCache[\"getRecordIdBySlug\"]>\n\nfunction handleResolveSlugError(error?: unknown, fallbackMessage?: string) {\n\t// We don't want the page to crash when resolving of a slug fails\n\t// TODO: use (lightweight) logging/metrics for errors here in user sites instead of console.\n\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\tconsole.warn(\n\t\tgetPleaseReportMessage(\n\t\t\t`Failed to resolve slug: ${error instanceof Error ? error.message : (fallbackMessage ?? \"Unknown error\")}`,\n\t\t),\n\t)\n\n\treturn undefined\n}\n\nexport function resolveSlug(\n\tunresolvedSlug: UnresolvedSlug,\n\tcollectionUtils: CollectionUtilsCacheContextValue,\n\tactiveLocale: LocaleInfo[\"activeLocale\"],\n): MaybeSlug {\n\ttry {\n\t\tconst utils = collectionUtils?.get(unresolvedSlug.collectionId)\n\t\tif (!utils) {\n\t\t\treturn handleResolveSlugError(\n\t\t\t\tundefined,\n\t\t\t\t`Couldn't find collection utils for collection id: \"${unresolvedSlug.collectionId}\"`,\n\t\t\t)\n\t\t}\n\n\t\tconst maybeSlug = utils.getSlugByRecordId(unresolvedSlug.collectionItemId, activeLocale ?? undefined)\n\t\tif (isPromise(maybeSlug)) {\n\t\t\treturn maybeSlug.catch(handleResolveSlugError)\n\t\t}\n\t\treturn maybeSlug\n\t} catch (error) {\n\t\thandleResolveSlugError(error)\n\t}\n}\n", "import { useCallback } from \"react\"\nimport type { Locale, RouterAPI } from \"../../router/types.ts\"\nimport { safeWindow } from \"../../utils/safeWindow.ts\"\nimport { sendTrackingEvent } from \"../../utils/sendTrackingEvent.ts\"\nimport { isPromise, isString } from \"../../utils/utils.ts\"\nimport { type LinkToWebPage, isLinkToWebPage } from \"../LinkToWebPage.ts\"\nimport { useCollectionUtils } from \"../cms/CollectionUtilsCache.tsx\"\nimport { linkFromFramerPageLink } from \"./linkFromFramerPageLink.tsx\"\n\nexport type TrackLinkClick = (absoluteHref: string | undefined) => Promise<void>\n\ninterface TrackLinkClickDeps {\n\tnodeId: string | undefined\n\tclickTrackingId: string | undefined\n\trouter: Partial<RouterAPI>\n\thref: string | LinkToWebPage | undefined\n\tactiveLocale: Locale | null\n}\n\nexport function useTrackLinkClick({\n\tnodeId,\n\tclickTrackingId,\n\trouter,\n\thref,\n\tactiveLocale,\n}: TrackLinkClickDeps): TrackLinkClick {\n\tconst collectionUtils = useCollectionUtils()\n\treturn useCallback(\n\t\tasync (hrefAttribute: string | undefined) => {\n\t\t\tif (!router.pageviewEventData?.current) return\n\t\t\t// We assume router.pageviewEventData is set at this point.\n\t\t\t// It looks like a race-condition in theory, but isn't in practice: The routers\n\t\t\t// `useEffect` runs pretty early during page load and we disable Reacts\n\t\t\t// event replaying system for improved INP in\n\t\t\t// src/library/src/router/hydration/reactHydrationINPOptimizer.ts\n\t\t\t// This means, this callback in practice doesn't trigger before the useEffect has run.\n\t\t\tconst pageviewEventData =\n\t\t\t\trouter.pageviewEventData.current instanceof Promise\n\t\t\t\t\t? await router.pageviewEventData.current\n\t\t\t\t\t: router.pageviewEventData.current\n\t\t\tconst pageLink = isLinkToWebPage(href) ? href : linkFromFramerPageLink(href)\n\n\t\t\tif (!isLinkToWebPage(pageLink)) {\n\t\t\t\t// Track the external link click right away\n\t\t\t\treturn sendTrackingEvent(\n\t\t\t\t\t\"published_site_click\",\n\t\t\t\t\t{\n\t\t\t\t\t\t...pageviewEventData,\n\t\t\t\t\t\thref: hrefAttribute ? makeUrlAbsolute(hrefAttribute) : null,\n\t\t\t\t\t\tnodeId: nodeId ?? null,\n\t\t\t\t\t\ttrackingId: clickTrackingId || null,\n\t\t\t\t\t\ttargetRoutePath: null,\n\t\t\t\t\t\ttargetWebPageId: null,\n\t\t\t\t\t\ttargetCollectionItemId: null,\n\t\t\t\t\t},\n\t\t\t\t\t\"eager\",\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tconst targetWebPageId = pageLink.webPageId\n\t\t\tconst targetRoute = router?.getRoute?.(targetWebPageId)\n\t\t\tconst targetRoutePath = targetRoute?.path ?? null\n\t\t\tlet targetCollectionItemId: string | null = null\n\t\t\tif (targetRoute?.collectionId && pageLink.pathVariables) {\n\t\t\t\t// Resolve the collection item ID\n\t\t\t\tconst utils = collectionUtils?.get(targetRoute.collectionId)\n\t\t\t\tif (!utils) return\n\n\t\t\t\tconst [slug] = Object.values(pageLink.pathVariables)\n\t\t\t\tif (isString(slug)) {\n\t\t\t\t\tconst maybeCollectionItemId = utils.getRecordIdBySlug(slug, activeLocale || undefined)\n\t\t\t\t\tconst collectionItemId = isPromise(maybeCollectionItemId)\n\t\t\t\t\t\t? await maybeCollectionItemId\n\t\t\t\t\t\t: maybeCollectionItemId\n\t\t\t\t\ttargetCollectionItemId = collectionItemId ?? null\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn sendTrackingEvent(\n\t\t\t\t\"published_site_click\",\n\t\t\t\t{\n\t\t\t\t\t...pageviewEventData,\n\t\t\t\t\thref: hrefAttribute ? makeUrlAbsolute(hrefAttribute) : null,\n\t\t\t\t\tnodeId: nodeId ?? null,\n\t\t\t\t\ttrackingId: clickTrackingId ?? null,\n\t\t\t\t\ttargetRoutePath,\n\t\t\t\t\ttargetWebPageId,\n\t\t\t\t\ttargetCollectionItemId,\n\t\t\t\t},\n\t\t\t\t\"eager\",\n\t\t\t)\n\t\t},\n\t\t[nodeId, clickTrackingId, router, href, activeLocale, collectionUtils],\n\t)\n}\n\n/**\n * Returns absolute path for links on the same domain, or the original URL if it's external.\n */\nfunction makeUrlAbsolute(href: string) {\n\ttry {\n\t\tconst url = new URL(href, safeWindow.document.baseURI)\n\t\treturn url.origin === safeWindow.location.origin ? url.pathname + url.search + url.hash : url.href\n\t} catch {\n\t\treturn href\n\t}\n}\n", "import { getPathForRoute } from \"../../router/history.ts\"\nimport type { Locale, RouterAPI } from \"../../router/types.ts\"\nimport { isPromise, isString } from \"../../utils/utils.ts\"\nimport type { LinkToWebPage } from \"../LinkToWebPage.ts\"\nimport { isLinkToWebPage } from \"../LinkToWebPage.ts\"\nimport { linkFromFramerPageLink } from \"./linkFromFramerPageLink.tsx\"\nimport { propsForLink } from \"./propsForLink.tsx\"\nimport type { resolveSlugsWithSuspense } from \"./resolveSlugs.ts\"\n\n/** @internal */\nexport function resolveLink(\n\thref: LinkToWebPage | string | undefined,\n\trouter: Partial<RouterAPI>,\n\timplicitPathVariables?: Record<string, unknown>,\n\tactiveLocale?: Locale | null,\n): string | undefined {\n\treturn resolveLinkInternal(href, router, implicitPathVariables, undefined, activeLocale)\n}\n\n/** @internal */\nexport function resolveLinkInternal(\n\thref: LinkToWebPage | string | undefined,\n\trouter: Partial<RouterAPI>,\n\timplicitPathVariables?: Record<string, unknown>,\n\t/**\n\t * Resolve and return only the hash part of the link, useful when getting\n\t * the value of an element id.\n\t */\n\tonlyHash?: boolean,\n\tactiveLocale?: Locale | null | undefined,\n\tresolveSlugs?: (\n\t\tunresolvedPathSlugs: LinkToWebPage[\"unresolvedPathSlugs\"],\n\t\tunresolvedHashSlugs: LinkToWebPage[\"unresolvedHashSlugs\"],\n\t) => ReturnType<typeof resolveSlugsWithSuspense>,\n): string | undefined {\n\t// Parsing framer page links means this function is stuck in library.\n\tconst pageLink = isLinkToWebPage(href) ? href : linkFromFramerPageLink(href)\n\tif (!isLinkToWebPage(pageLink)) return isString(href) ? propsForLink(href).href : undefined\n\t// Bail out, we can't convert an object to a string path.\n\tif (!router.getRoute || !router.currentRouteId) return undefined\n\n\tconst currentRoute = router.getRoute(router.currentRouteId)\n\tconst { webPageId, hash, pathVariables, hashVariables, unresolvedHashSlugs, unresolvedPathSlugs } = pageLink\n\tconst route = router.getRoute(webPageId)\n\n\tconst resolvedSlugs =\n\t\tunresolvedPathSlugs || unresolvedHashSlugs ? resolveSlugs?.(unresolvedPathSlugs, unresolvedHashSlugs) : undefined\n\n\t// Skip further work if we're waiting for slugs to be resolved\n\tif (isPromise(resolvedSlugs)) return\n\n\tconst combinedPathVariables = Object.assign(\n\t\t{},\n\t\trouter.currentPathVariables,\n\t\timplicitPathVariables,\n\t\tpathVariables,\n\t\tresolvedSlugs?.path,\n\t)\n\tconst combinedHashVariables = Object.assign(\n\t\t{},\n\t\trouter.currentPathVariables,\n\t\timplicitPathVariables,\n\t\thashVariables,\n\t\tresolvedSlugs?.hash,\n\t)\n\n\tconst path = getPathForRoute(route, {\n\t\tcurrentRoutePath: currentRoute?.path,\n\t\tcurrentRoutePathLocalized: currentRoute?.pathLocalized,\n\t\tcurrentPathVariables: router.currentPathVariables,\n\t\thash,\n\t\tpathVariables: combinedPathVariables,\n\t\thashVariables: combinedHashVariables,\n\t\trelative: false,\n\t\tpreserveQueryParams: router.preserveQueryParams,\n\t\tonlyHash,\n\t\tsiteCanonicalURL: router.siteCanonicalURL,\n\t\tlocaleId: activeLocale?.id,\n\t})\n\n\tif (onlyHash) return path\n\n\tconst slugPrefix = activeLocale?.slug ? `/${activeLocale.slug}` : \"\"\n\n\treturn slugPrefix + path\n}\n", "import { getPathForRoute } from \"../../router/history.ts\"\nimport type { LocaleId, RouterAPI } from \"../../router/types.ts\"\nimport type { LinkToWebPage } from \"../LinkToWebPage.ts\"\n\n/** @public */\nexport function resolvePageScope(\n\tpageLink: LinkToWebPage,\n\trouter: Partial<RouterAPI>,\n\tlocaleId?: LocaleId,\n): string | undefined {\n\t// Bail out, we can't convert an object to a string path.\n\tif (!router.getRoute || !router.currentRouteId) return undefined\n\n\tconst currentRoute = router.getRoute(router.currentRouteId)\n\tconst { webPageId } = pageLink\n\tconst route = router.getRoute(webPageId)\n\n\treturn getPathForRoute(route, {\n\t\tcurrentRoutePath: currentRoute?.path,\n\t\tcurrentRoutePathLocalized: currentRoute?.pathLocalized,\n\t\tcurrentPathVariables: router.currentPathVariables,\n\t\trelative: false,\n\t\tpreserveQueryParams: false,\n\t\tsiteCanonicalURL: undefined,\n\t\tlocaleId,\n\t})\n}\n", "import { MotionConfig, MotionGlobalConfig, WillChangeMotionValue } from \"framer-motion\"\nimport React from \"react\"\nimport { Navigation } from \"../components/Navigation.tsx\"\nimport { MainLoop } from \"../core/Loop.ts\"\nimport { DataObserver } from \"../deprecated/DataObserver.tsx\"\nimport { FormContext } from \"../render/presentation/Forms/FormContainer.tsx\"\nimport { Router } from \"../router/Router.tsx\"\nimport { RoutesProvider } from \"../router/RouterContext.tsx\"\nimport { FetchClientProvider } from \"./FetchClient.tsx\"\nimport type { PageRootProps } from \"./PageRootProps.ts\"\nimport { RenderTargetEnvironmentProvider } from \"./RenderTargetEnvironmentContext.tsx\"\nimport { CollectionUtilsCacheProvider } from \"./cms/CollectionUtilsCache.tsx\"\nimport { SnippetsProvider } from \"./custom-code/context.tsx\"\n\n// This makes sure that motion will add the `will-change` property to anything that animates. See\n// https://github.com/motiondivision/motion/pull/3129 for more details. Previously motion would\n// always do this, but that got removed in 11.13, but we still need that behaviour so this will make\n// sure it keeps behaving the same as before.\nMotionGlobalConfig.WillChange = WillChangeMotionValue\n\n/**\n * @description Router Component\n * Safari iOS has a weird bug that will make `font-size` scale-up in the presence\n * of a unit width/height + `overflow: hidden` + an element in the DOM that has\n * opacity 0 and is set to opacity 1 in JS, just like in the case of our effects\n * with Motion. We set the width of published sites to auto to fix the issue. It\n * must explicitly be set on published sites because the same fix brakes the\n * preview.\n * Webkit issue: https://bugs.webkit.org/show_bug.cgi?id=240653\n * */\n\n/** @public */\nexport function PageRoot(props: PageRootProps) {\n\tconst {\n\t\tRootComponent,\n\t\tisWebsite,\n\t\tenvironment,\n\t\trouteId,\n\t\tframerSiteId,\n\t\tpathVariables,\n\t\troutes,\n\t\tcollectionUtils,\n\t\tnotFoundPage,\n\t\tisReducedMotion = false,\n\t\tskipAnimations = false,\n\t\tincludeDataObserver = false,\n\t\tlocaleId,\n\t\tlocales,\n\t\tpreserveQueryParams,\n\t\tEditorBar,\n\t\tdefaultPageStyle,\n\t\tdisableHistory,\n\t\tLayoutTemplate,\n\t\tsiteCanonicalURL,\n\t\tadaptLayoutToTextDirection,\n\t\tloadSnippetsModule,\n\t\tinitialCollectionItemId,\n\t} = props\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: must only run the first time the site is mounted\n\tReact.useEffect(() => {\n\t\tif (isWebsite) return\n\t\t// Required by DataObserver\n\t\tMainLoop.start()\n\t}, [])\n\n\tif (isWebsite) {\n\t\treturn (\n\t\t\t<RenderTargetEnvironmentProvider value={environment ?? \"preview\"}>\n\t\t\t\t<MotionConfig\n\t\t\t\t\treducedMotion={skipAnimations ? \"always\" : isReducedMotion ? \"user\" : \"never\"}\n\t\t\t\t\tskipAnimations={skipAnimations}\n\t\t\t\t>\n\t\t\t\t\t<CollectionUtilsCacheProvider collectionUtils={collectionUtils}>\n\t\t\t\t\t\t<FetchClientProvider>\n\t\t\t\t\t\t\t<FormContext.Provider value={framerSiteId}>\n\t\t\t\t\t\t\t\t<SnippetsProvider loadSnippetsModule={loadSnippetsModule}>\n\t\t\t\t\t\t\t\t\t<Router\n\t\t\t\t\t\t\t\t\t\tinitialRoute={routeId}\n\t\t\t\t\t\t\t\t\t\tinitialPathVariables={pathVariables}\n\t\t\t\t\t\t\t\t\t\tinitialLocaleId={localeId}\n\t\t\t\t\t\t\t\t\t\tinitialCollectionItemId={initialCollectionItemId}\n\t\t\t\t\t\t\t\t\t\troutes={routes}\n\t\t\t\t\t\t\t\t\t\tcollectionUtils={collectionUtils}\n\t\t\t\t\t\t\t\t\t\tnotFoundPage={notFoundPage}\n\t\t\t\t\t\t\t\t\t\tlocales={locales}\n\t\t\t\t\t\t\t\t\t\tdefaultPageStyle={defaultPageStyle ?? { minHeight: \"100vh\", width: \"auto\" }}\n\t\t\t\t\t\t\t\t\t\tpreserveQueryParams={preserveQueryParams}\n\t\t\t\t\t\t\t\t\t\tEditorBar={EditorBar}\n\t\t\t\t\t\t\t\t\t\tdisableHistory={disableHistory}\n\t\t\t\t\t\t\t\t\t\tLayoutTemplate={LayoutTemplate}\n\t\t\t\t\t\t\t\t\t\tsiteCanonicalURL={siteCanonicalURL}\n\t\t\t\t\t\t\t\t\t\tadaptLayoutToTextDirection={adaptLayoutToTextDirection}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</SnippetsProvider>\n\t\t\t\t\t\t\t</FormContext.Provider>\n\t\t\t\t\t\t</FetchClientProvider>\n\t\t\t\t\t</CollectionUtilsCacheProvider>\n\t\t\t\t</MotionConfig>\n\t\t\t</RenderTargetEnvironmentProvider>\n\t\t)\n\t} else {\n\t\t// Using (deprecated `Data` requires a DataObserver, but we should *not*\n\t\t// add a DataObserver for code that uses `useStore`, because then it\n\t\t// will not fall back onto using \u201Cnormal\u201D React useState.\n\t\tconst Wrapper = includeDataObserver ? DataObserver : React.Fragment\n\n\t\t// For navigation we still need to provide the routes, because\n\t\t// `usePrototypeNavigate` uses `getRoute` to get the component for a\n\t\t// specific target id\n\t\treturn (\n\t\t\t<Wrapper>\n\t\t\t\t<RoutesProvider routes={routes}>\n\t\t\t\t\t<Navigation>\n\t\t\t\t\t\t{React.isValidElement(RootComponent)\n\t\t\t\t\t\t\t? RootComponent\n\t\t\t\t\t\t\t: React.createElement(\n\t\t\t\t\t\t\t\t\t// @ts-expect-error to figure out how to type this properly, as tests are using different\n\t\t\t\t\t\t\t\t\t// $$typeof symbol and isValidElement fails\n\t\t\t\t\t\t\t\t\tRootComponent,\n\t\t\t\t\t\t\t\t\t{ key: routeId },\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t</Navigation>\n\t\t\t\t</RoutesProvider>\n\t\t\t</Wrapper>\n\t\t)\n\t}\n}\n", "import { motion } from \"framer-motion\"\nimport type { FormEvent } from \"react\"\nimport React, { startTransition, useContext } from \"react\"\nimport {\n\tfindMatchingRouteAttributesForResolvedPath,\n\tfindMatchingRouteAttributesForWebPageLink,\n} from \"../../../modules/Link/findMatchingRouteAttributes.tsx\"\nimport { useImplicitPathVariables } from \"../../../modules/Link/pathVariables.tsx\"\nimport { resolveSlugs } from \"../../../modules/Link/resolveSlugs.ts\"\nimport { isValidURL } from \"../../../modules/Link/urlChecks.tsx\"\nimport type { LinkToWebPage } from \"../../../modules/LinkToWebPage.ts\"\nimport { isLinkToWebPage } from \"../../../modules/LinkToWebPage.ts\"\nimport { useCollectionUtils } from \"../../../modules/cms/CollectionUtilsCache.tsx\"\nimport { useRouter } from \"../../../router/RouterContext.tsx\"\nimport { useCurrentRoute } from \"../../../router/useCurrentRoute.tsx\"\nimport { useLocaleInfo } from \"../../../router/useLocale.ts\"\nimport { assert, assertNever } from \"../../../utils/assert.ts\"\nimport { safeWindow } from \"../../../utils/safeWindow.ts\"\nimport { isObject, isString } from \"../../../utils/utils.ts\"\nimport { yieldToMain } from \"../../../utils/yield.ts\"\nimport { calculateProofOfWork } from \"./antibot.ts\"\nimport { addUTMTagsToFormData, getEncodedFormFieldsHeader } from \"./formData.ts\"\nimport { HoneypotFields, useHoneypotFields } from \"./honeypot.tsx\"\nimport { trackFormSubmit } from \"./trackFormSubmit.ts\"\nimport type { FormContainerProps } from \"./types.ts\"\nimport { useCaptcha } from \"./useCaptcha.ts\"\n\ntype Action =\n\t| { type: \"submit\" }\n\t| { type: \"success\" }\n\t| { type: \"error\" }\n\t| { type: \"incomplete\" }\n\t| { type: \"complete\" }\n\ninterface FormState {\n\tstate: \"pending\" | \"success\" | \"error\" | \"incomplete\" | \"complete\"\n}\n\nconst pendingState: FormState = { state: \"pending\" }\nconst successState: FormState = { state: \"success\" }\nconst incompleteState: FormState = { state: \"incomplete\" }\nconst completeState: FormState = { state: \"complete\" }\nconst errorState: FormState = { state: \"error\" }\n\nfunction formReducer({ state }: FormState, { type }: Action): FormState {\n\tswitch (type) {\n\t\tcase \"complete\":\n\t\t\tif (state === \"error\") return errorState\n\t\t\treturn completeState\n\t\tcase \"incomplete\":\n\t\t\tif (state === \"error\") return errorState\n\t\t\treturn incompleteState\n\t\tcase \"submit\":\n\t\t\treturn pendingState\n\t\tcase \"success\":\n\t\t\treturn successState\n\t\tcase \"error\":\n\t\t\treturn errorState\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n\nfunction stateCanSubmitForm({ state }: FormState) {\n\treturn state === \"incomplete\" || state === \"complete\"\n}\n\nfunction preventDefault(e: FormEvent<HTMLFormElement>) {\n\te.preventDefault()\n}\n\n// Modern browsers (aka safari) might block popups triggered asynchronously, so we open the link in the current tab.\nfunction openExternalLinkInCurrentTab(\n\tlink: string,\n\tformRef: React.RefObject<HTMLFormElement> | ((instance: HTMLFormElement | null) => void),\n) {\n\tconst href = isValidURL(link, false) ? link : `https://${link}`\n\n\t// We use an anchor element (as opposed to window.open), because the preview app hijacks all anchor link clicks\n\t// and modifies the target based on the href, so that we won't try to open an external links in the preview iframe.\n\t// see src/app/vekter/src/preview-next/utils/interceptAnchorLinks.ts\n\tconst linkElement = document.createElement(\"a\")\n\tlinkElement.href = href\n\tlinkElement.target = \"_self\"\n\tlinkElement.style.display = \"none\"\n\n\t// We are appending the (invisible) link element to the form, instead of document.body, because the link must live\n\t// under the PreviewRenderer where we hijack anchor link clicks in the preview iframe.\n\tif (!(\"current\" in formRef && formRef.current)) return\n\tformRef.current.appendChild(linkElement)\n\n\tlinkElement.click()\n\tlinkElement.remove()\n}\n\n/** @internal */\nexport const FormContext = React.createContext<string | undefined>(undefined)\n\n/** @internal */\nexport const FormContainer = /* @__PURE__ */ React.forwardRef<\n\tHTMLFormElement,\n\tFormContainerProps & {\n\t\t/** Careful: changing the state here will require the child components to be regenerated.  */\n\t\tchildren: (state: { state: FormState[\"state\"] }) => React.ReactElement\n\t}\n>(function FormContainer(\n\t{\n\t\taction,\n\t\tchildren,\n\t\tredirectUrl,\n\t\tonSuccess,\n\t\tonError,\n\t\tonLoading,\n\t\tsubmitTrackingId,\n\t\tnodeId,\n\t\tformCaptchaProvider,\n\t\tformCaptchaSiteKey,\n\t\t...props\n\t},\n\tforwardedRef,\n) {\n\tconst fallbackRef = React.useRef<HTMLFormElement>(null)\n\tconst ref = forwardedRef ?? fallbackRef\n\tconst shouldUseHoneypot = !(formCaptchaProvider && formCaptchaSiteKey)\n\tconst {\n\t\tstates: honeypotStateRefs,\n\t\tconvertHoneypotFieldsForSubmission,\n\t\treplaceHoneypotWithMetadata,\n\t} = useHoneypotFields(shouldUseHoneypot)\n\tconst router = useRouter()\n\tconst currentRoute = useCurrentRoute()\n\tconst implicitPathVariables = useImplicitPathVariables()\n\tconst collectionUtils = useCollectionUtils()\n\n\tconst { executeChallenge } = useCaptcha({ provider: formCaptchaProvider, siteKey: formCaptchaSiteKey })\n\n\t// Assume that a form has at least one unfilled, required input field.\n\t// Technically this is possible to not be the cause if all required inputs\n\t// are prefilled with defaultValue. That edge-case should be rare, and isn't\n\t// worth walking the dom on mount to verify. The only impact this would have\n\t// on a design is if you used a prefilled input AND a submit button with an\n\t// \"incomplete\" variant that made it unclickable. In that case, the user can\n\t// probably just remove their \"incomplete\" variant.\n\tconst [state, dispatch] = React.useReducer(formReducer, incompleteState)\n\tconst { activeLocale, locales } = useLocaleInfo()\n\tconst projectHash = useContext(FormContext)\n\t// We are using a ref to store the callbacks so we can access the latest\n\t// values of them in a long-lived event handler that needs to access the\n\t// latest values after a react render has changed these values. @FIXME -\n\t// This technically isn't React 19 compliant, but probably isn't a problem\n\t// since it isn't render related, just using a ref as a stable pointer.\n\tconst callbacks = React.useRef({ onSuccess, onError, onLoading })\n\tcallbacks.current = { onSuccess, onError, onLoading }\n\n\tconst submissionInProgressRef = React.useRef(false)\n\n\tasync function redirectTo(link: string | LinkToWebPage) {\n\t\tif (isString(link)) {\n\t\t\tconst matchingRoute = findMatchingRouteAttributesForResolvedPath(router, link, implicitPathVariables, locales)\n\t\t\t// If we couldn't find a matching route, we assume it's an external link.\n\t\t\tif (!matchingRoute) {\n\t\t\t\topenExternalLinkInCurrentTab(link, ref)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst { routeId, elementId, pathVariables } = matchingRoute\n\t\t\trouter.navigate?.(routeId, elementId, pathVariables)\n\t\t\treturn\n\t\t}\n\n\t\tassert(isLinkToWebPage(link), \"Expected link to be either a LinkToWebPage or a string\", link)\n\n\t\tconst resolvedSlugs = await resolveSlugs(\n\t\t\tlink.unresolvedPathSlugs,\n\t\t\tlink.unresolvedHashSlugs,\n\t\t\tactiveLocale,\n\t\t\tcollectionUtils,\n\t\t)\n\t\tconst matchingRoute = findMatchingRouteAttributesForWebPageLink(\n\t\t\trouter,\n\t\t\tcurrentRoute,\n\t\t\tlink,\n\t\t\tactiveLocale,\n\t\t\tresolvedSlugs,\n\t\t\timplicitPathVariables,\n\t\t)\n\n\t\tconst { routeId, elementId, pathVariables } = matchingRoute\n\t\trouter.navigate?.(routeId, elementId, pathVariables)\n\t}\n\n\tconst handleSubmit = async (event: React.SyntheticEvent<HTMLFormElement>) => {\n\t\tevent.preventDefault()\n\n\t\tif (!action || !projectHash || submissionInProgressRef.current) return\n\t\tsubmissionInProgressRef.current = true\n\n\t\tconvertHoneypotFieldsForSubmission()\n\n\t\t// collect form data as it has been submitted\n\t\tconst data = new FormData(event.currentTarget)\n\n\t\t// await next paint before doing more stuff -> improves INP\n\t\tawait yieldToMain({ priority: \"user-visible\", continueAfter: \"paint\" })\n\n\t\treplaceHoneypotWithMetadata(data)\n\n\t\tstartTransition(() => dispatch({ type: \"submit\" }))\n\n\t\taddUTMTagsToFormData(data, safeWindow.document)\n\n\t\tfor (const [key, value] of data) {\n\t\t\t// We don't want to include File objects in the FormData\n\t\t\t// as we do not support them on the backend yet.\n\t\t\tif (value instanceof File) data.delete(key)\n\t\t}\n\n\t\ttry {\n\t\t\tcallbacks.current.onLoading?.()\n\n\t\t\ttrackFormSubmit({\n\t\t\t\trouter,\n\t\t\t\tnodeId,\n\t\t\t\tsubmitTrackingId,\n\t\t\t\tactiveLocale,\n\t\t\t})\n\t\t\t// submitForm will throw an error if the response is not ok\n\t\t\t// and of course fetch throws on a network error by default.\n\t\t\tawait submitForm(action, data, projectHash, executeChallenge)\n\n\t\t\tstartTransition(() => dispatch({ type: \"success\" }))\n\t\t\tcallbacks.current.onSuccess?.()\n\n\t\t\tif (redirectUrl) {\n\t\t\t\tawait redirectTo(redirectUrl)\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tstartTransition(() => dispatch({ type: \"error\" }))\n\t\t\tcallbacks.current.onError?.()\n\n\t\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\t\tconsole.error(error)\n\t\t}\n\n\t\tsubmissionInProgressRef.current = false\n\t}\n\n\tconst handleKeyDown = (event: React.KeyboardEvent<HTMLFormElement>) => {\n\t\tconst { target: input, currentTarget: form, key } = event\n\t\tconst isTextArea = input instanceof HTMLTextAreaElement\n\n\t\t// If the target is a textarea, we don't want to submit the form on enter.\n\t\tif (isTextArea) return\n\n\t\tif (key === \"Enter\" && form.checkValidity()) {\n\t\t\tevent.preventDefault()\n\t\t\tvoid handleSubmit(event)\n\t\t}\n\t}\n\n\tconst checkValidity = async (e: React.FormEvent<HTMLFormElement>) => {\n\t\t// capture current target here so React's synthetic event system doesn't unset it when we execute the transition\n\t\tconst target = e.currentTarget\n\t\t// await next paint and then dispatch the update as transition -> improves INP\n\t\tawait yieldToMain({ priority: \"background\", continueAfter: \"paint\" })\n\t\tstartTransition(() => dispatch({ type: anyEmptyRequiredFields(target) ? \"incomplete\" : \"complete\" }))\n\t}\n\n\treturn (\n\t\t<motion.form\n\t\t\t{...props}\n\t\t\tonSubmit={stateCanSubmitForm(state) ? handleSubmit : preventDefault}\n\t\t\tonKeyDown={handleKeyDown}\n\t\t\tonChange={checkValidity}\n\t\t\tref={ref}\n\t\t>\n\t\t\t{children(state)}\n\t\t\t{shouldUseHoneypot && <HoneypotFields states={honeypotStateRefs} />}\n\t\t</motion.form>\n\t)\n})\n\nfunction anyEmptyRequiredFields(element: Element): boolean {\n\tif (element.children.length === 0) return false\n\n\tfor (const child of element.children) {\n\t\tif (\n\t\t\tchild instanceof HTMLInputElement ||\n\t\t\tchild instanceof HTMLTextAreaElement ||\n\t\t\tchild instanceof HTMLSelectElement\n\t\t) {\n\t\t\tif (child.required && child.value === \"\") return true\n\t\t} else {\n\t\t\tconst result = anyEmptyRequiredFields(child)\n\t\t\tif (result) return true\n\t\t}\n\t}\n\n\treturn false\n}\n\nasync function submitForm(\n\taction: string,\n\tdata: FormData,\n\tprojectHash: string,\n\texecuteChallenge: (action: string) => Promise<string | undefined>,\n) {\n\tconst proofOfWork = await calculateProofOfWork()\n\n\tif (!proofOfWork) {\n\t\tthrow new Error(\"Failed to calculate proof of work\")\n\t}\n\n\tconst captchaToken = await executeChallenge(\"submit\")\n\n\tconst headers: Record<string, string> = {\n\t\t\"Framer-Site-Id\": projectHash,\n\t\t\"Framer-POW\": proofOfWork.secret,\n\t\t\"Framer-Form-Fields\": getEncodedFormFieldsHeader(data),\n\t}\n\n\tif (captchaToken) {\n\t\theaders[\"Framer-Captcha-Response\"] = captchaToken\n\t}\n\n\tconst response = await fetch(action, {\n\t\tbody: data,\n\t\tmethod: \"POST\",\n\t\theaders,\n\t})\n\n\tif (response.ok) {\n\t\treturn response\n\t} else {\n\t\tconst body = await response.json()\n\t\tconst error = \"Failed to submit form\"\n\t\tif (responseHasError(body)) {\n\t\t\tthrow new Error(`${error} - ${body.error.message}`)\n\t\t}\n\t\tthrow new Error(error)\n\t}\n}\n\nfunction responseHasError(response: unknown): response is { error: { message: string } } {\n\treturn (\n\t\ttypeof response === \"object\" &&\n\t\tresponse !== null &&\n\t\t\"error\" in response &&\n\t\tisObject(response.error) &&\n\t\t\"message\" in response.error &&\n\t\ttypeof response.error.message === \"string\"\n\t)\n}\n", "const salt = \"framer\"\nconst difficulty = 3\nconst tokenLength = 30\n// maximum time in milliseconds (10 seconds). It allows slow mobile device to calculate PoW\n// in most cases, calculation takes less than a second.\nconst maxTime = 10000\n\ninterface ProofOfWork {\n\tsecret: string\n\thash: string\n}\n\nfunction createWorkerTask() {\n\treturn function () {\n\t\tasync function sha256(text: string) {\n\t\t\tconst buffer = new TextEncoder().encode(text)\n\t\t\tconst hashBuffer = await crypto.subtle.digest(\"SHA-256\", buffer)\n\t\t\treturn Array.from(new Uint8Array(hashBuffer))\n\t\t\t\t.map(b => b.toString(16).padStart(2, \"0\"))\n\t\t\t\t.join(\"\")\n\t\t}\n\n\t\tfunction randomCharacters(count: number) {\n\t\t\tconst characters = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\"\n\t\t\tlet result = \"\"\n\t\t\tconst charactersLength = characters.length\n\t\t\tfor (let i = 0; i < count; i++) {\n\t\t\t\tresult += characters.charAt(Math.floor(Math.random() * charactersLength))\n\t\t\t}\n\t\t\treturn result\n\t\t}\n\n\t\t// eslint-disable-next-line no-restricted-globals -- this is inside a web worker\n\t\taddEventListener(\"message\", async event => {\n\t\t\tconst { salt, difficulty, tokenLength, maxTime } = event.data\n\t\t\tconst target = \"0\".repeat(difficulty)\n\t\t\tconst startTime = performance.now()\n\n\t\t\tlet processing = true\n\t\t\twhile (processing) {\n\t\t\t\tconst timestamp = performance.now()\n\t\t\t\t// Check if we've exceeded the maximum time\n\t\t\t\tif (timestamp - startTime > maxTime) {\n\t\t\t\t\tprocessing = false\n\t\t\t\t\tpostMessage({ success: false })\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tconst nonce = randomCharacters(tokenLength)\n\t\t\t\tconst secret = `${Date.now()}:${nonce}`\n\t\t\t\tconst hash = await sha256(salt + secret)\n\n\t\t\t\tif (hash.startsWith(target)) {\n\t\t\t\t\tpostMessage({ success: true, secret, hash })\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}.toString()\n}\n\nexport async function calculateProofOfWork(): Promise<ProofOfWork | undefined> {\n\treturn new Promise((resolve, reject) => {\n\t\t// Web Worker is used to keep the browser responsive and prevent animations from stalling\n\t\tconst webWorkerURL = URL.createObjectURL(\n\t\t\tnew Blob([\"(\", createWorkerTask(), \")()\"], {\n\t\t\t\ttype: \"application/javascript\",\n\t\t\t}),\n\t\t)\n\n\t\tconst worker = new Worker(webWorkerURL)\n\n\t\tworker.onmessage = event => {\n\t\t\tworker.terminate()\n\t\t\tURL.revokeObjectURL(webWorkerURL)\n\n\t\t\tif (event.data.success) {\n\t\t\t\tresolve({ secret: event.data.secret, hash: event.data.hash })\n\t\t\t} else {\n\t\t\t\tresolve(undefined)\n\t\t\t}\n\t\t}\n\n\t\tworker.onerror = event => {\n\t\t\tworker.terminate()\n\t\t\tURL.revokeObjectURL(webWorkerURL)\n\t\t\treject(event)\n\t\t}\n\n\t\t// Execute Web Worker task\n\t\tworker.postMessage({\n\t\t\tsalt,\n\t\t\tdifficulty,\n\t\t\ttokenLength,\n\t\t\tmaxTime,\n\t\t})\n\t})\n}\n", "export function getEncodedFormFieldsHeader(data: FormData) {\n\treturn Array.from(data.keys()).map(encodeURIComponent).join(\",\")\n}\n\ninterface HasCookie {\n\tcookie: string\n}\n\n/**\n    Includes UTM tags from the `framerFormsUTMTags` cookie, that is set in\n    src/app/vekter/src/export/bundled/captureFormsUTMTagsInCookie.ts\n*/\nexport function addUTMTagsToFormData(data: FormData, document: HasCookie) {\n\ttry {\n\t\t// RegExp inlined from src/app/vekter/src/web/lib/cookies.ts\n\t\tconst matches = document.cookie.match(\"(^|;) ?framerFormsUTMTags=([^;]*)(;|$)\")\n\t\tif (matches !== null && matches[2]) {\n\t\t\tconst parsed = JSON.parse(decodeURIComponent(matches[2]))\n\t\t\tif (!parsed || typeof parsed !== \"object\") return\n\t\t\t;[\"utm_source\", \"utm_medium\", \"utm_campaign\", \"utm_term\", \"utm_content\", \"gclid\"].forEach(key => {\n\t\t\t\tif (typeof parsed[key] === \"string\") data.append(key, parsed[key])\n\t\t\t})\n\t\t}\n\t} catch (e) {\n\t\t// Ignore errors reading or decoding the cookie\n\t}\n}\n", "import React from \"react\"\nimport { FormContext } from \"./FormContainer.tsx\"\n\nconst HONEYPOT_VERSION = \"3\"\nconst HONEYPOT_FIELD_NAME = \"__framer\"\nconst COMMON_FIELD_NAMES = [\n\t\"website\",\n\t\"company\",\n\t\"message\",\n\t\"subject\",\n\t\"title\",\n\t\"description\",\n\t\"feedback\",\n\t\"notes\",\n\t\"details\",\n\t\"remarks\",\n\t\"comments\",\n]\n\nconst MODULE_LOAD_TIME = /* @__PURE__ */ (() => Date.now())()\n\nconst FIELD_DATA_ENUM = {\n\tname: 0,\n\tvalue: 1,\n\tsetAttribute: 2,\n\tvalueProperty: 3,\n\tisInputEventTrusted: 4,\n\tinputChangeTimeSinceModuleLoad: 5,\n\twasFilledBeforeHydration: 6,\n} as const\n\nconst METADATA_KEYS_ENUM = {\n\tfieldData: 0,\n\tfieldCount: 1,\n\tfieldFilledCount: 2,\n\thpVersion: 3,\n\tsiteId: 4,\n\ttimeToSubmissionSinceModuleLoad: 5,\n} as const\n\nconst getTimeSinceModuleLoadInSeconds = (): string => {\n\treturn ((Date.now() - MODULE_LOAD_TIME) / 1000).toFixed(2)\n}\n\ninterface HoneypotMethodsUsed {\n\tsetAttribute: boolean\n\tvalueProperty: boolean\n\tisInputEventTrusted?: boolean\n\tinputChangeTimeSinceModuleLoad?: string\n\twasFilledBeforeHydration?: boolean\n}\n\ninterface HoneypotInputStateRef {\n\tinputRef: React.RefObject<HTMLInputElement>\n\toriginalName: string\n\tmethodsUsed: HoneypotMethodsUsed\n}\n\nconst HoneypotInput = /* @__PURE__ */ ({ inputStateRef }: { inputStateRef: HoneypotInputStateRef }) => {\n\tconst { inputRef, originalName } = inputStateRef\n\n\t// Check if input already has a value before hydration\n\tReact.useLayoutEffect(() => {\n\t\tconst honeypotInput = inputRef.current\n\t\tif (!honeypotInput) return\n\n\t\tconst methodsUsed = inputStateRef.methodsUsed\n\n\t\tif (honeypotInput.value) {\n\t\t\tmethodsUsed.wasFilledBeforeHydration = true\n\t\t}\n\t}, [inputRef, inputStateRef])\n\n\tReact.useEffect(() => {\n\t\tconst myInput = inputRef.current\n\t\tif (!myInput) return\n\n\t\tconst methodsUsed = inputStateRef.methodsUsed\n\n\t\tconst originalSetAttributeMethod = Element.prototype.setAttribute\n\t\tconst originalSetAttribute = originalSetAttributeMethod.bind(myInput)\n\t\tmyInput.setAttribute = function (attrName: string, attrValue: string) {\n\t\t\tif (attrName === \"value\") {\n\t\t\t\tmethodsUsed.setAttribute = true\n\t\t\t\tmethodsUsed.inputChangeTimeSinceModuleLoad = getTimeSinceModuleLoadInSeconds()\n\t\t\t}\n\t\t\toriginalSetAttribute(attrName, attrValue)\n\t\t}\n\n\t\tconst originalDescriptor = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, \"value\")\n\t\tif (originalDescriptor) {\n\t\t\tObject.defineProperty(myInput, \"value\", {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tget: function () {\n\t\t\t\t\treturn originalDescriptor.get?.call(this) ?? \"\"\n\t\t\t\t},\n\t\t\t\tset: function (newValue: string) {\n\t\t\t\t\tmethodsUsed.valueProperty = true\n\t\t\t\t\tmethodsUsed.inputChangeTimeSinceModuleLoad = getTimeSinceModuleLoadInSeconds()\n\t\t\t\t\toriginalDescriptor.set?.call(this, newValue)\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\n\t\tconst handleInput = (event: Event) => {\n\t\t\tmethodsUsed.isInputEventTrusted = event.isTrusted\n\t\t\tmethodsUsed.inputChangeTimeSinceModuleLoad = getTimeSinceModuleLoadInSeconds()\n\t\t}\n\t\tmyInput.addEventListener(\"input\", handleInput)\n\n\t\treturn () => {\n\t\t\tmyInput.setAttribute = originalSetAttributeMethod.bind(myInput)\n\t\t\tif (originalDescriptor) {\n\t\t\t\tObject.defineProperty(myInput, \"value\", originalDescriptor)\n\t\t\t}\n\t\t\tmyInput.removeEventListener(\"input\", handleInput)\n\t\t}\n\t}, [inputRef, inputStateRef])\n\n\treturn (\n\t\t<input\n\t\t\tref={inputRef}\n\t\t\ttype=\"text\"\n\t\t\tname={originalName}\n\t\t\tsuppressHydrationWarning={true}\n\t\t\ttabIndex={-1}\n\t\t\tautoComplete=\"one-time-code\" // https://www.nikolailehbr.ink/blog/prevent-form-spamming-honeypot#use-autocompleteone-time-code\n\t\t\taria-hidden=\"true\"\n\t\t\tstyle={{\n\t\t\t\tposition: \"absolute\",\n\t\t\t\ttransform: \"scale(0)\",\n\t\t\t}}\n\t\t\tdefaultValue=\"\"\n\t\t\tdata-1p-ignore\n\t\t\tdata-lpignore=\"true\"\n\t\t\tdata-form-type=\"other\"\n\t\t\tdata-bwignore\n\t\t/>\n\t)\n}\n\nexport function useHoneypotFields(isEnabled: boolean) {\n\tconst framerSiteId = React.useContext(FormContext)\n\n\tconst states: HoneypotInputStateRef[] = React.useMemo(\n\t\t() =>\n\t\t\tisEnabled\n\t\t\t\t? COMMON_FIELD_NAMES.map(fieldName => {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tinputRef: React.createRef<HTMLInputElement>(),\n\t\t\t\t\t\t\toriginalName: fieldName,\n\t\t\t\t\t\t\tmethodsUsed: {\n\t\t\t\t\t\t\t\tsetAttribute: false,\n\t\t\t\t\t\t\t\tvalueProperty: false,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t: [],\n\t\t[isEnabled],\n\t)\n\n\t/**\n\t * FormData includes honeypot fields and we should mark these with unique names to prevent possible duplicate names\n\t */\n\tconst convertHoneypotFieldsForSubmission = React.useCallback(() => {\n\t\tstates.forEach(state => {\n\t\t\tconst currentHoneypotInput = state.inputRef.current\n\t\t\tif (currentHoneypotInput) {\n\t\t\t\tcurrentHoneypotInput.name = `${HONEYPOT_FIELD_NAME}_${state.originalName}`\n\t\t\t}\n\t\t})\n\t}, [states])\n\n\tconst replaceHoneypotWithMetadata = React.useCallback(\n\t\t(formData: FormData) => {\n\t\t\tif (!isEnabled) return\n\n\t\t\tconst honeypotCount = states.length\n\t\t\tlet honeypotFilled = 0\n\t\t\tconst filledFieldsData: string[] = []\n\n\t\t\tstates.forEach(state => {\n\t\t\t\tconst currentHoneypotInput = state.inputRef.current\n\n\t\t\t\tif (currentHoneypotInput) {\n\t\t\t\t\tconst currentName = currentHoneypotInput.name\n\t\t\t\t\tconst currentValue = currentHoneypotInput.value\n\n\t\t\t\t\tif (currentValue) {\n\t\t\t\t\t\thoneypotFilled++\n\n\t\t\t\t\t\t// Gather all metadata for this filled honeypot input\n\t\t\t\t\t\tconst fieldData = {\n\t\t\t\t\t\t\t[FIELD_DATA_ENUM.name]: state.originalName,\n\t\t\t\t\t\t\t[FIELD_DATA_ENUM.value]: currentValue,\n\t\t\t\t\t\t\t[FIELD_DATA_ENUM.setAttribute]: state.methodsUsed.setAttribute,\n\t\t\t\t\t\t\t[FIELD_DATA_ENUM.valueProperty]: state.methodsUsed.valueProperty,\n\t\t\t\t\t\t\t[FIELD_DATA_ENUM.isInputEventTrusted]: state.methodsUsed.isInputEventTrusted,\n\t\t\t\t\t\t\t[FIELD_DATA_ENUM.inputChangeTimeSinceModuleLoad]: state.methodsUsed.inputChangeTimeSinceModuleLoad,\n\t\t\t\t\t\t\t[FIELD_DATA_ENUM.wasFilledBeforeHydration]: state.methodsUsed.wasFilledBeforeHydration,\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfilledFieldsData.push(JSON.stringify(fieldData))\n\t\t\t\t\t}\n\n\t\t\t\t\tformData.delete(currentName)\n\t\t\t\t\tcurrentHoneypotInput.name = state.originalName\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tformData.append(`${HONEYPOT_FIELD_NAME}_${METADATA_KEYS_ENUM.fieldData}`, `[${filledFieldsData.join(\",\")}]`)\n\t\t\tformData.append(`${HONEYPOT_FIELD_NAME}_${METADATA_KEYS_ENUM.fieldCount}`, honeypotCount.toString())\n\t\t\tformData.append(`${HONEYPOT_FIELD_NAME}_${METADATA_KEYS_ENUM.fieldFilledCount}`, honeypotFilled.toString())\n\t\t\tformData.append(`${HONEYPOT_FIELD_NAME}_${METADATA_KEYS_ENUM.hpVersion}`, HONEYPOT_VERSION)\n\t\t\tformData.append(`${HONEYPOT_FIELD_NAME}_${METADATA_KEYS_ENUM.siteId}`, framerSiteId || \"\")\n\t\t\tformData.append(\n\t\t\t\t`${HONEYPOT_FIELD_NAME}_${METADATA_KEYS_ENUM.timeToSubmissionSinceModuleLoad}`,\n\t\t\t\tgetTimeSinceModuleLoadInSeconds(),\n\t\t\t)\n\t\t},\n\t\t[isEnabled, states, framerSiteId],\n\t)\n\n\treturn {\n\t\tstates,\n\t\tconvertHoneypotFieldsForSubmission,\n\t\treplaceHoneypotWithMetadata,\n\t}\n}\n\nexport function HoneypotFields({ states }: { states: HoneypotInputStateRef[] }) {\n\treturn (\n\t\t<>\n\t\t\t{states.map(stateRef => (\n\t\t\t\t// Names are unique at the moment, so using the originalName is fine\n\t\t\t\t<HoneypotInput key={`hp_${stateRef.originalName}`} inputStateRef={stateRef} />\n\t\t\t))}\n\t\t</>\n\t)\n}\n", "import type { Locale, RouterAPI } from \"../../../router/types.ts\"\nimport { type PageviewEventData, sendTrackingEvent } from \"../../../utils/sendTrackingEvent.ts\"\n\ninterface TrackFormSubmitParams {\n\tnodeId: string | undefined\n\tsubmitTrackingId: string | undefined\n\tactiveLocale: Locale | null\n\trouter: Partial<RouterAPI>\n}\n\nexport function trackFormSubmit({ router, nodeId, submitTrackingId }: TrackFormSubmitParams) {\n\tif (!router?.pageviewEventData?.current) return\n\n\tif (router.pageviewEventData.current instanceof Promise) {\n\t\tvoid router.pageviewEventData.current.then(pageviewEventData => {\n\t\t\tsendFormSubmitTrackingEvent(pageviewEventData, nodeId, submitTrackingId)\n\t\t})\n\t} else {\n\t\tsendFormSubmitTrackingEvent(router.pageviewEventData.current, nodeId, submitTrackingId)\n\t}\n}\n\nfunction sendFormSubmitTrackingEvent(\n\tpageviewEventData: PageviewEventData,\n\tnodeId: string | undefined,\n\ttrackingId: string | undefined,\n) {\n\treturn sendTrackingEvent(\n\t\t\"published_site_form_submit\",\n\t\t{\n\t\t\t...pageviewEventData,\n\t\t\tnodeId: nodeId ?? null,\n\t\t\ttrackingId: trackingId || null,\n\t\t},\n\t\t\"eager\",\n\t)\n}\n", "import React from \"react\"\nimport { requestIdleCallback } from \"../../../utils/utils.ts\"\nimport type { CaptchaProvider } from \"./types.ts\"\n\ndeclare global {\n\tinterface Window {\n\t\tgrecaptcha?: {\n\t\t\tready: (callback: () => void) => void\n\t\t\texecute: (siteKey: string, options?: { action: string }) => Promise<string>\n\t\t}\n\t}\n}\n\nconst RECAPTCHA_SCRIPT_URL = \"https://www.google.com/recaptcha/api.js\"\n\nfunction getRecaptchaScriptUrl(siteKey: string): string {\n\treturn `${RECAPTCHA_SCRIPT_URL}?render=${encodeURIComponent(siteKey)}&badge=bottomleft`\n}\n\n/** Module-level map so multiple forms with the same site key share one load. */\nconst captchaScriptPromises = new Map<string, Promise<void>>()\n\nfunction loadRecaptchaScript(siteKey: string): Promise<void> {\n\tconst existing = captchaScriptPromises.get(siteKey)\n\tif (existing) return existing\n\n\t// Check if the script was already injected outside of our control.\n\tconst scriptUrl = getRecaptchaScriptUrl(siteKey)\n\tif (document.querySelector(`script[src=\"${scriptUrl}\"]`)) {\n\t\tconst resolved = Promise.resolve()\n\t\tcaptchaScriptPromises.set(siteKey, resolved)\n\t\treturn resolved\n\t}\n\n\tconst promise = new Promise<void>((resolve, reject) => {\n\t\tconst script = document.createElement(\"script\")\n\t\tscript.src = scriptUrl\n\t\tscript.onload = () => resolve()\n\t\tscript.onerror = () => {\n\t\t\t// Reset so a retry is possible on next submission.\n\t\t\tcaptchaScriptPromises.delete(siteKey)\n\t\t\tscript.remove()\n\t\t\treject(new Error(\"Failed to load captcha script\"))\n\t\t}\n\t\tdocument.head.appendChild(script)\n\t})\n\n\tcaptchaScriptPromises.set(siteKey, promise)\n\treturn promise\n}\n\nfunction executeRecaptcha(siteKey: string, _action: string): Promise<string> {\n\treturn new Promise<string>((resolve, reject) => {\n\t\tconst { grecaptcha } = window\n\t\tif (!grecaptcha) {\n\t\t\treject(new Error(\"Captcha script not available\"))\n\t\t\treturn\n\t\t}\n\n\t\tgrecaptcha.ready(() => {\n\t\t\tgrecaptcha.execute(siteKey).then(resolve, reject)\n\t\t})\n\t})\n}\n\ninterface UseCaptchaOptions {\n\tprovider: CaptchaProvider | undefined\n\tsiteKey: string | undefined\n}\n\ninterface UseCaptchaResult {\n\t/** Call at submission time to retrieve a captcha token. Returns undefined when no captcha provider is configured. */\n\texecuteChallenge: (action: string) => Promise<string | undefined>\n}\n\nexport function useCaptcha({ provider, siteKey }: UseCaptchaOptions): UseCaptchaResult {\n\tReact.useEffect(() => {\n\t\tif (provider === \"recaptcha_v3\" && siteKey) {\n\t\t\trequestIdleCallback(() => {\n\t\t\t\tloadRecaptchaScript(siteKey).catch(() => {\n\t\t\t\t\t// executeChallenge will surface the error at submission time.\n\t\t\t\t})\n\t\t\t})\n\t\t}\n\t}, [provider, siteKey])\n\n\tconst executeChallenge = React.useCallback(\n\t\tasync (action: string): Promise<string | undefined> => {\n\t\t\tif (provider !== \"recaptcha_v3\" || !siteKey) return undefined\n\n\t\t\tawait loadRecaptchaScript(siteKey)\n\t\t\treturn executeRecaptcha(siteKey, action)\n\t\t},\n\t\t[provider, siteKey],\n\t)\n\n\treturn { executeChallenge }\n}\n", "import { isDesktop } from \"@framerjs/shared/src/environment.ts\"\nimport type { CSSProperties, PropsWithChildren } from \"react\"\nimport type React from \"react\"\nimport { Fragment, startTransition, useCallback, useEffect, useLayoutEffect, useMemo, useRef } from \"react\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\nimport { CustomCursorHost } from \"../modules/CustomCursor.tsx\"\nimport { EditorBarLauncher } from \"../modules/EditorBarLauncher.tsx\"\nimport { useLibraryFeatures } from \"../modules/LibraryFeaturesContext.ts\"\nimport type { PageRootProps } from \"../modules/PageRootProps.ts\"\nimport { TriggerStateProvider } from \"../modules/TriggerStateContext.tsx\"\nimport { useLoadSnippets } from \"../modules/custom-code/useLoadSnippets.ts\"\nimport { isObject, isString, noop } from \"../utils/utils.ts\"\nimport { yieldToMain } from \"../utils/yield.ts\"\nimport { RouterAPIProvider } from \"./RouterContext.tsx\"\nimport { SuspenseThatPreservesDom } from \"./SuspenseThatPreservesDom.tsx\"\nimport { NotFoundErrorBoundary } from \"./error-boundary/NotFoundErrorBoundary.tsx\"\nimport { SynchronousSuspenseErrorBoundary } from \"./error-boundary/SynchronousSuspenseErrorBoundary.tsx\"\nimport { fillPathVariables } from \"./fillPathVariables.ts\"\nimport { getSitePrefix } from \"./getSitePrefix.ts\"\nimport {\n\tgetPathForRoute,\n\tisHistoryState,\n\tpushHistoryState,\n\tpushRouteState,\n\tuseNativeLoadingSpinner,\n\tusePopStateHandler,\n\tuseReplaceInitialState,\n\tuseSwitchLocale,\n} from \"./history.ts\"\nimport { MarkSuspenseEffects, useMarkRouterEffects } from \"./hydration/hydrationTimings.ts\"\nimport { TurnOnReactEventHandling } from \"./hydration/reactHydrationINPOptimizer.ts\"\nimport { isSamePage } from \"./isSamePage.ts\"\nimport { isLazyComponentType } from \"./lazy.tsx\"\nimport { useSendPageView } from \"./pageAnalytics.ts\"\nimport { useViewTransition } from \"./pageEffects/useViewTransition.ts\"\nimport { pathVariablesRegExpGlobal } from \"./pathVariables.ts\"\nimport { URLSearchParamsProvider } from \"./queryParameters.tsx\"\nimport { renderPage } from \"./renderPage.tsx\"\nimport { announceNavigation } from \"./routerDomUtils.ts\"\nimport type {\n\tLocale,\n\tLocaleId,\n\tLocaleInfo,\n\tNavigationPerformanceDetail,\n\tRoute,\n\tRouteId,\n\tRouterAPI,\n\tRoutes,\n\tSetCurrentRouteId,\n\tUpdateURL,\n} from \"./types.ts\"\nimport { defaultLocaleId } from \"./types.ts\"\nimport { useForceUpdate } from \"./useForceUpdate.ts\"\nimport { useGetRouteCallback } from \"./useGetRouteCallback.ts\"\nimport { LayoutDirectionContext, LocaleInfoContext } from \"./useLocale.ts\"\nimport { type MonitorNextPaintAfterRender, useMonitorNextPaintAfterRender } from \"./useMonitorNextPaintAfterRender.ts\"\nimport { EMPTY_ARRAY, getRouteElementId, monitorINPRelatedInputs } from \"./utils.ts\"\n\ninterface Props extends Pick<\n\tPageRootProps,\n\t| \"collectionUtils\"\n\t| \"notFoundPage\"\n\t| \"preserveQueryParams\"\n\t| \"LayoutTemplate\"\n\t| \"EditorBar\"\n\t| \"siteCanonicalURL\"\n\t| \"disableHistory\"\n\t| \"locales\"\n\t| \"adaptLayoutToTextDirection\"\n\t| \"initialCollectionItemId\"\n> {\n\troutes: Routes\n\tinitialRoute: RouteId\n\tinitialPathVariables?: Record<string, unknown>\n\tinitialLocaleId?: LocaleId\n\tdefaultPageStyle: CSSProperties\n}\n\nfunction updateScrollPosition(\n\thash: string | undefined,\n\tsmoothScroll: boolean | undefined,\n\tisHistoryTransition: boolean,\n) {\n\tconst element = hash && document.getElementById(hash)\n\tif (element) {\n\t\tscrollElementIntoView(element, smoothScroll)\n\t\treturn\n\t}\n\n\tif (isHistoryTransition) return\n\n\twindow.scrollTo(0, 0)\n}\n\nfunction useScheduleRenderSideEffects(dep: number) {\n\tconst actions = useRef<(() => void)[]>([])\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: explicit dependencies are needed to schedule the side effects\n\tuseLayoutEffect(() => {\n\t\tif (!actions.current?.length) return\n\t\tactions.current.forEach(action => action())\n\t\tactions.current = []\n\t}, [dep])\n\n\treturn useCallback((cb: () => void) => {\n\t\tactions.current.push(cb)\n\t}, [])\n}\n\ntype StartNavigation = (\n\ttransitionFn: (signal?: AbortSignal) => void,\n\tnextRender: ReturnType<MonitorNextPaintAfterRender<NavigationPerformanceDetail>>,\n\tupdateURL?: UpdateURL,\n\tisAbortable?: boolean,\n) => Promise<void>\n\nfunction executeBeforeUrlUpdateOnce(beforeUrlUpdate: VoidFunction | undefined) {\n\tif (!beforeUrlUpdate) return noop\n\n\tlet beforeUrlUpdateExecuted = false\n\treturn () => {\n\t\tif (beforeUrlUpdateExecuted) return\n\t\tbeforeUrlUpdateExecuted = true\n\t\tbeforeUrlUpdate?.()\n\t}\n}\n\n/**\n * Wrapper around navigation transitions (React, not view transitions). Add side-effects of the navigation transition here.\n * @return The returned callback returns a promise that resolves when the URL navigation is complete, including rendering and URL update.\n */\nfunction useNavigationTransition(): StartNavigation {\n\tconst startNativeSpinner = useNativeLoadingSpinner()\n\tconst navigationController = useRef<AbortController | undefined>(undefined)\n\n\treturn useCallback<StartNavigation>(\n\t\tasync (transitionFn, nextRender, updateURL, isAbortable = true) => {\n\t\t\tconst hasUpdateURL = updateURL !== undefined\n\n\t\t\t// abort previous navigation\n\t\t\t// React batches transitions, so we do not need any special handling for React.\n\t\t\tnavigationController.current?.abort()\n\t\t\tconst controller = isAbortable ? new AbortController() : undefined\n\t\t\tnavigationController.current = controller\n\n\t\t\tconst signal = controller?.signal\n\t\t\tconst stopMonitoringINPRelatedInputs = monitorINPRelatedInputs(signal)\n\t\t\tvoid nextRender.promise.finally(stopMonitoringINPRelatedInputs)\n\n\t\t\tif (!hasUpdateURL) {\n\t\t\t\tnavigationController.current = undefined\n\t\t\t\ttransitionFn(signal)\n\t\t\t\treturn nextRender.promise\n\t\t\t}\n\n\t\t\t// Perform the actual navigation (React update)\n\t\t\t// TODO: ideally this should run before the native spinner, but the browser schedules it after - for now ok, because the style recalc from\n\t\t\t// the transition CSS is somewhat expensive: https://framer-team.slack.com/archives/C05V49Q4NJ2/p1720012284107269\n\t\t\ttransitionFn(signal)\n\n\t\t\tlet resolveNavigationPromise: () => void\n\t\t\tconst navigationPromise = new Promise<void>((resolve, reject) => {\n\t\t\t\tresolveNavigationPromise = resolve\n\n\t\t\t\t// reject the navigation promise if the navigation is aborted by a more recent transition\n\t\t\t\tsignal?.addEventListener(\"abort\", reject)\n\t\t\t}).catch(noop)\n\n\t\t\t// enable the native spinner + update URL\n\t\t\t// updateURL must be called before the next paint after render otherwise the browser native scroll restoration\n\t\t\t// will save the restore position as 0,0 and backwards navigation will not restore the correct position\n\t\t\tstartNativeSpinner(navigationPromise, updateURL, controller)\n\n\t\t\tawait nextRender.promise\n\t\t\tif (signal?.aborted) return // after any async work, check if the navigation was aborted\n\n\t\t\tconst navigationTransition = window.navigation?.transition\n\n\t\t\t// we now stop the spinner\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: The promise constructor runs synchronously, so the variable is set at this point.\n\t\t\tresolveNavigationPromise!()\n\n\t\t\t// Await navigation to finish to make sure the navigation is complete before triggering side-effects\n\t\t\t// This avoids race conditions in Edge et al. where the announcement happens milliseconds\n\t\t\t// before the loading spinner disappears, and the screen reader reads \u201CLoading complete\u201D\n\t\t\t// instead of the announcement\n\t\t\ttry {\n\t\t\t\tawait navigationTransition?.finished\n\t\t\t} catch (error: unknown) {\n\t\t\t\t// One known way this can reject is when the network is down.\n\t\t\t\t// TODO: We should have a graceful (UI) way to handle network down errors.\n\t\t\t\t// For that purpose, we should track if there are any loading errors when importing pages/loading CMS data.\n\t\t\t\t// Currently, we don't do that, so we keep this an error, as we don't know if the react render has happened correctly or not.\n\t\t\t\t// biome-ignore lint/suspicious/noConsole:\n\t\t\t\tconsole.error(\"Navigation transition failed\", error)\n\t\t\t}\n\n\t\t\t// after the navigation transition has finished, check if the navigation was aborted\n\t\t\tif (signal?.aborted) return\n\n\t\t\tannounceNavigation()\n\t\t},\n\t\t[startNativeSpinner],\n\t)\n}\n\nexport function Router({\n\tdefaultPageStyle,\n\tdisableHistory,\n\tinitialPathVariables,\n\tinitialRoute,\n\tnotFoundPage,\n\tcollectionUtils,\n\troutes,\n\tinitialLocaleId,\n\tinitialCollectionItemId,\n\tlocales = EMPTY_ARRAY,\n\tpreserveQueryParams = false,\n\tLayoutTemplate,\n\tEditorBar,\n\tsiteCanonicalURL,\n\tadaptLayoutToTextDirection,\n}: PropsWithChildren<Props>) {\n\tuseMarkRouterEffects()\n\n\tuseReplaceInitialState({\n\t\tdisabled: disableHistory,\n\t\trouteId: initialRoute,\n\t\tinitialPathVariables,\n\t\tinitialLocaleId,\n\t})\n\n\tconst startViewTransition = useViewTransition()\n\tconst [dep, forceUpdate] = useForceUpdate()\n\tconst scheduleSideEffect = useScheduleRenderSideEffects(dep)\n\tconst startNavigation = useNavigationTransition()\n\tconst monitorNextPaintAfterRender = useMonitorNextPaintAfterRender<NavigationPerformanceDetail>(\"framer-route-change\")\n\tconst { synchronousNavigationOnDesktop } = useLibraryFeatures()\n\tconst transitionFn = useMemo(() => {\n\t\tif (!synchronousNavigationOnDesktop || !isDesktop()) {\n\t\t\treturn startTransition\n\t\t}\n\t\treturn (fn: () => void) => fn()\n\t}, [synchronousNavigationOnDesktop])\n\tconst loadSnippets = useLoadSnippets()\n\n\tconst isInitialNavigationRef = useRef(true)\n\n\tconst currentPathnameWithHashRef = useRef<string>()\n\tconst currentRouteRef = useRef(initialRoute)\n\tconst currentPathVariablesRef = useRef(initialPathVariables)\n\tconst currentLocaleIdRef = useRef<LocaleId | undefined>(initialLocaleId)\n\n\tconst currentLocaleId = currentLocaleIdRef.current\n\tconst activeLocale = useMemo((): Locale | null => {\n\t\treturn (\n\t\t\tlocales.find(({ id }) => {\n\t\t\t\tif (!currentLocaleId) return id === defaultLocaleId\n\t\t\t\treturn id === currentLocaleId\n\t\t\t}) ?? null\n\t\t)\n\t}, [currentLocaleId, locales])\n\n\tconst textDirection = activeLocale?.textDirection ?? \"ltr\"\n\tconst layoutDirection = adaptLayoutToTextDirection ? textDirection : \"ltr\"\n\n\tuseLayoutEffect(() => {\n\t\tif (!adaptLayoutToTextDirection) return\n\t\tdocument.documentElement.setAttribute(\"dir\", textDirection)\n\t}, [textDirection, adaptLayoutToTextDirection])\n\n\tconst switchLocale = useSwitchLocale()\n\tconst localeInfo = useMemo((): LocaleInfo => {\n\t\treturn {\n\t\t\tactiveLocale,\n\t\t\tlocales,\n\t\t\tsetLocale: async (localeOrLocaleId: Locale | LocaleId) => {\n\t\t\t\tconst nextRender = monitorNextPaintAfterRender({\n\t\t\t\t\tlocalized: true,\n\t\t\t\t})\n\n\t\t\t\t// Await a paint to keep INP low before running the rest of the code (especially the `history.pushState`)\n\t\t\t\tawait yieldToMain({ priority: \"user-blocking\", continueAfter: \"paint\" })\n\n\t\t\t\tlet localeId: string | undefined\n\n\t\t\t\tif (isString(localeOrLocaleId)) {\n\t\t\t\t\tlocaleId = localeOrLocaleId\n\t\t\t\t} else if (isObject(localeOrLocaleId)) {\n\t\t\t\t\tlocaleId = localeOrLocaleId.id\n\t\t\t\t}\n\n\t\t\t\tconst defaultLocale = locales.find(({ id }) => id === defaultLocaleId)\n\n\t\t\t\tconst nextLocale = locales.find(({ id }) => id === localeId)\n\t\t\t\tif (!nextLocale) return\n\n\t\t\t\tconst currentRouteId = currentRouteRef.current\n\t\t\t\tconst currentRoute = routes[currentRouteId]\n\t\t\t\tif (!currentRoute) return\n\n\t\t\t\ttry {\n\t\t\t\t\tconst localeResult = await switchLocale({\n\t\t\t\t\t\tcurrentLocale: activeLocale,\n\t\t\t\t\t\tnextLocale,\n\t\t\t\t\t\troute: currentRoute,\n\t\t\t\t\t\trouteId: currentRouteId,\n\t\t\t\t\t\tdefaultLocale,\n\t\t\t\t\t\tpathVariables: currentPathVariablesRef.current,\n\t\t\t\t\t\tpreserveQueryParams,\n\t\t\t\t\t})\n\t\t\t\t\tif (!localeResult) return\n\n\t\t\t\t\tconst currentStatePaginationInfo = isHistoryState(window.history.state)\n\t\t\t\t\t\t? window.history.state.paginationInfo\n\t\t\t\t\t\t: undefined\n\t\t\t\t\tconst currentPath = localeResult.path\n\n\t\t\t\t\tisInitialNavigationRef.current = false\n\n\t\t\t\t\t// eslint-disable-next-line require-atomic-updates -- the ref is stable from React.\n\t\t\t\t\tcurrentPathVariablesRef.current = localeResult.pathVariables\n\t\t\t\t\tcurrentLocaleIdRef.current = nextLocale.id\n\n\t\t\t\t\tconst updateURL = async (ignorePushStateWrapper = false) => {\n\t\t\t\t\t\tif (!currentPath) return\n\n\t\t\t\t\t\treturn pushHistoryState(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\trouteId: currentRouteId,\n\t\t\t\t\t\t\t\tpathVariables: localeResult.pathVariables,\n\t\t\t\t\t\t\t\tlocaleId: nextLocale.id,\n\t\t\t\t\t\t\t\tpaginationInfo: currentStatePaginationInfo,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tcurrentPath,\n\t\t\t\t\t\t\tignorePushStateWrapper,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\n\t\t\t\t\tvoid startNavigation(\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\tvoid startViewTransition(\n\t\t\t\t\t\t\t\tcurrentRouteId,\n\t\t\t\t\t\t\t\tcurrentRouteId,\n\t\t\t\t\t\t\t\t() => transitionFn(forceUpdate),\n\t\t\t\t\t\t\t\t// no signal here, because we update the refs above immediately\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t},\n\t\t\t\t\t\tnextRender,\n\t\t\t\t\t\tupdateURL,\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t)\n\t\t\t\t} catch {\n\t\t\t\t\t// This should not happen because switchLocale already provides a fallback when there are async errors\n\t\t\t\t}\n\t\t\t},\n\t\t}\n\t}, [\n\t\tactiveLocale,\n\t\tforceUpdate,\n\t\tlocales,\n\t\tpreserveQueryParams,\n\t\troutes,\n\t\tstartNavigation,\n\t\tstartViewTransition,\n\t\tmonitorNextPaintAfterRender,\n\t\ttransitionFn,\n\t\tswitchLocale,\n\t])\n\n\tconst setCurrentRouteId = useCallback<SetCurrentRouteId>(\n\t\t(\n\t\t\trouteId,\n\t\t\tlocaleId,\n\t\t\thash,\n\t\t\tpathnameWithHash,\n\t\t\tpathVariables,\n\t\t\tisHistoryTransition,\n\t\t\tnextRender,\n\t\t\tsmoothScroll = false,\n\t\t\tupdateURL,\n\t\t) => {\n\t\t\tisInitialNavigationRef.current = false\n\n\t\t\tconst currentRouteId = currentRouteRef.current\n\t\t\tcurrentRouteRef.current = routeId\n\t\t\tcurrentPathVariablesRef.current = pathVariables\n\t\t\tcurrentLocaleIdRef.current = localeId\n\n\t\t\t// Update the current path so that it is in sync with the route state\n\t\t\t// when we track pagevews in `useSendPageView`\n\t\t\tcurrentPathnameWithHashRef.current = pathnameWithHash\n\n\t\t\tscheduleSideEffect(() => {\n\t\t\t\t// After the render is complete, reset scroll position, or\n\t\t\t\t// scroll to the active element.\n\t\t\t\tupdateScrollPosition(hash, smoothScroll, isHistoryTransition)\n\t\t\t})\n\n\t\t\t// History transitions are handled by the popstate handler\n\t\t\tif (isHistoryTransition) {\n\t\t\t\ttransitionFn(forceUpdate)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tvoid startNavigation(\n\t\t\t\tsignal => {\n\t\t\t\t\tvoid startViewTransition(currentRouteId, routeId, () => transitionFn(forceUpdate), signal)\n\t\t\t\t},\n\t\t\t\tnextRender,\n\t\t\t\tupdateURL,\n\t\t\t\ttrue,\n\t\t\t)\n\t\t},\n\t\t[forceUpdate, scheduleSideEffect, startNavigation, startViewTransition, transitionFn],\n\t)\n\n\tusePopStateHandler(currentRouteRef, setCurrentRouteId)\n\n\tconst navigate = useCallback<RouterAPI[\"navigate\"]>(\n\t\tasync (routeId, hash, pathVariables, smoothScroll, beforeUrlUpdate) => {\n\t\t\tconst newRoute = routes[routeId] as Route | undefined\n\n\t\t\tconst routeStatus = isLazyComponentType(newRoute?.page) ? newRoute.page.getStatus() : undefined\n\t\t\tconst hasRendered = routeStatus?.hasRendered\n\t\t\tconst nextRender = monitorNextPaintAfterRender({\n\t\t\t\tcached: hasRendered,\n\t\t\t\tpreloaded: hasRendered ? undefined : routeStatus?.hasLoaded,\n\t\t\t})\n\n\t\t\tconst executeBeforeUrlUpdate = executeBeforeUrlUpdateOnce(beforeUrlUpdate)\n\n\t\t\t// We queue `executeBeforeUrlUpdate` with guaranteed execution to ensure it'll still execute even if the user closes the tab before the URL is about to be updated.\n\t\t\t// We explicitly don't `await` here, because we want to ensure the promise is executed eventually, but not block on it.\n\t\t\t// This also means this might run any time before the URL update, and not just exactly before it. But that's fine here, too.\n\t\t\tvoid yieldToMain({ priority: \"background\", ensureContinueBeforeUnload: true, continueAfter: \"paint\" }).then(\n\t\t\t\texecuteBeforeUrlUpdate,\n\t\t\t)\n\n\t\t\t// Await a paint to reduce the chance of INP being increased by synchronous work that is outside of our control (e.g. GTM, tiktok analytics etc.).\n\t\t\t// The difference here is, we don't really care about running the rest of this code, as the tab is (probably) being closed.\n\t\t\t// Only `beforeUrlUpdate` is important, and we've already queued that using `yieldToMain` above.\n\t\t\tawait yieldToMain({ priority: \"user-blocking\", continueAfter: \"paint\" })\n\n\t\t\tif (pathVariables) {\n\t\t\t\t// Clean up the path variables to only include the ones that are actually used.\n\t\t\t\tconst inUse = new Set<string>()\n\t\t\t\tconst path = newRoute?.path ?? \"/\"\n\t\t\t\tfor (const match of path.matchAll(pathVariablesRegExpGlobal)) {\n\t\t\t\t\tconst usedVariable = match[1]\n\t\t\t\t\tif (usedVariable === undefined) {\n\t\t\t\t\t\tthrow new Error(\"A matching path variable should not be undefined\")\n\t\t\t\t\t}\n\t\t\t\t\tinUse.add(usedVariable)\n\t\t\t\t}\n\t\t\t\tpathVariables = Object.fromEntries(Object.entries(pathVariables).filter(([key]) => inUse.has(key)))\n\t\t\t}\n\n\t\t\t// Scroll if on the same page.\n\t\t\tconst routeElementId = getRouteElementId(newRoute, hash)\n\t\t\tconst currentPathVariables = currentPathVariablesRef.current\n\t\t\tconst currentRouteLocaleId = currentLocaleIdRef.current\n\t\t\tif (\n\t\t\t\tisSamePage(\n\t\t\t\t\t{ routeId: currentRouteRef.current, pathVariables: currentPathVariables },\n\t\t\t\t\t{ routeId, pathVariables },\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\t// If the route is the same, we don't want to measure the time it takes to navigate to the same page.\n\t\t\t\tnextRender.ignore?.()\n\n\t\t\t\tconst route = routes[routeId]\n\t\t\t\tif (window.history.state?.hash !== hash && !disableHistory && route) {\n\t\t\t\t\texecuteBeforeUrlUpdate()\n\t\t\t\t\tawait pushRouteState(routeId, route, {\n\t\t\t\t\t\tcurrentRoutePath: route.path,\n\t\t\t\t\t\tcurrentPathVariables,\n\t\t\t\t\t\tpathVariables,\n\t\t\t\t\t\thash,\n\t\t\t\t\t\tlocaleId: currentRouteLocaleId,\n\t\t\t\t\t\tpreserveQueryParams,\n\t\t\t\t\t\tsiteCanonicalURL,\n\t\t\t\t\t\tcurrentRoutePathLocalized: route.pathLocalized,\n\t\t\t\t\t})\n\t\t\t\t}\n\n\t\t\t\t// only update the scroll position after potentially awaiting the URL update\n\t\t\t\t// this is needed so that the scroll restoration always works correctly\n\t\t\t\tupdateScrollPosition(routeElementId, smoothScroll, false)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (!newRoute) return\n\n\t\t\tconst currentRoute = routes[currentRouteRef.current] as Route | undefined\n\t\t\tconst updateURL = async (ignorePushStateWrapper = false) => {\n\t\t\t\texecuteBeforeUrlUpdate()\n\t\t\t\treturn pushRouteState(\n\t\t\t\t\trouteId,\n\t\t\t\t\tnewRoute,\n\t\t\t\t\t{\n\t\t\t\t\t\tcurrentRoutePath: currentRoute?.path,\n\t\t\t\t\t\tcurrentPathVariables,\n\t\t\t\t\t\tcurrentRoutePathLocalized: currentRoute?.pathLocalized,\n\t\t\t\t\t\thash,\n\t\t\t\t\t\tpathVariables,\n\t\t\t\t\t\tlocaleId: currentRouteLocaleId,\n\t\t\t\t\t\tpreserveQueryParams,\n\t\t\t\t\t\tsiteCanonicalURL,\n\t\t\t\t\t},\n\t\t\t\t\tignorePushStateWrapper,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tconst pathnameWithHash =\n\t\t\t\tgetSitePrefix(siteCanonicalURL) +\n\t\t\t\tgetPathForRoute(newRoute, {\n\t\t\t\t\tcurrentRoutePath: currentRoute?.path,\n\t\t\t\t\tcurrentRoutePathLocalized: currentRoute?.pathLocalized,\n\t\t\t\t\tcurrentPathVariables,\n\t\t\t\t\thash,\n\t\t\t\t\tpathVariables,\n\t\t\t\t\tlocaleId: currentRouteLocaleId,\n\t\t\t\t\tpreserveQueryParams,\n\t\t\t\t\tsiteCanonicalURL,\n\t\t\t\t\trelative: false, // We need an absolute path for the hash\n\t\t\t\t})\n\n\t\t\tsetCurrentRouteId(\n\t\t\t\trouteId,\n\t\t\t\tcurrentRouteLocaleId,\n\t\t\t\trouteElementId,\n\t\t\t\tpathnameWithHash,\n\t\t\t\tpathVariables,\n\t\t\t\tfalse,\n\t\t\t\tnextRender,\n\t\t\t\tsmoothScroll,\n\t\t\t\tdisableHistory ? undefined : updateURL,\n\t\t\t)\n\t\t},\n\t\t[routes, setCurrentRouteId, disableHistory, preserveQueryParams, siteCanonicalURL, monitorNextPaintAfterRender],\n\t)\n\tconst getRoute = useGetRouteCallback(routes)\n\tconst currentRouteId = currentRouteRef.current\n\tconst currentPathnameWithHash = currentPathnameWithHashRef.current\n\tconst currentPathVariables = currentPathVariablesRef.current\n\tconst currentRoute = routes[currentRouteId]\n\tconst currentRoutePath = currentRoute?.path\n\tconst pageviewEventData = useSendPageView(\n\t\tcurrentRoute,\n\t\tcurrentRouteId,\n\t\tcurrentPathnameWithHash,\n\t\tcurrentPathVariables,\n\t\tactiveLocale,\n\t\tinitialCollectionItemId,\n\t)\n\tconst isInitialNavigation = isInitialNavigationRef.current\n\n\tuseEffect(() => {\n\t\tvoid loadSnippets(currentRouteId, currentPathVariables ?? {}, localeInfo.activeLocale, isInitialNavigation)\n\t}, [loadSnippets, currentRouteId, currentPathVariables, localeInfo, isInitialNavigation])\n\n\tconst api = useMemo(\n\t\t(): RouterAPI => ({\n\t\t\tnavigate,\n\t\t\tgetRoute,\n\t\t\tcurrentRouteId,\n\t\t\tcurrentPathVariables,\n\t\t\troutes,\n\t\t\tcollectionUtils,\n\t\t\tpreserveQueryParams,\n\t\t\tpageviewEventData,\n\t\t\tsiteCanonicalURL,\n\t\t\tisInitialNavigation,\n\t\t}),\n\t\t[\n\t\t\tnavigate,\n\t\t\tgetRoute,\n\t\t\tcurrentRouteId,\n\t\t\tcurrentPathVariables,\n\t\t\troutes,\n\t\t\tcollectionUtils,\n\t\t\tpreserveQueryParams,\n\t\t\tsiteCanonicalURL,\n\t\t\tpageviewEventData,\n\t\t\tisInitialNavigation,\n\t\t],\n\t)\n\n\tif (!currentRoute) {\n\t\tthrow new Error(`Router cannot find route for ${currentRouteId}`)\n\t}\n\n\tconst pageExistsInCurrentLocale =\n\t\t!activeLocale || !currentRoute.includedLocales || currentRoute.includedLocales.includes(activeLocale.id)\n\n\t// Used to unmount the current page when switching between CMS detail pages from the same\n\t// collection. These detail pages use the same component and share the same same path. Not\n\t// unmounting causes issues like React state not resetting, and appear animations not playing.\n\tconst pathWithFilledVariables =\n\t\tcurrentRoutePath && currentPathVariables\n\t\t\t? fillPathVariables(currentRoutePath, currentPathVariables)\n\t\t\t: currentRoutePath\n\n\t// We want the page to remount when the locale or collection item changes. This prevents\n\t// unexpected animations and transitions from running, and appear animations not playing.\n\tconst remountKey = String(currentLocaleId) + pathWithFilledVariables\n\n\tconst templatePageStyle = useConstant<React.CSSProperties>(() => ({ ...defaultPageStyle, display: \"contents\" }))\n\n\treturn (\n\t\t<RouterAPIProvider api={api}>\n\t\t\t<LocaleInfoContext.Provider value={localeInfo}>\n\t\t\t\t<LayoutDirectionContext.Provider value={layoutDirection}>\n\t\t\t\t\t<CustomCursorHost>\n\t\t\t\t\t\t<URLSearchParamsProvider>\n\t\t\t\t\t\t\t<TriggerStateProvider currentRoutePath={pathWithFilledVariables} routerAPI={api}>\n\t\t\t\t\t\t\t\t{/* Rendering the editorBar outside SuspenseThatPreservesDom makes it load faster */}\n\t\t\t\t\t\t\t\t{EditorBar && <EditorBarLauncher EditorBar={EditorBar} fast />}\n\n\t\t\t\t\t\t\t\t<SynchronousSuspenseErrorBoundary>\n\t\t\t\t\t\t\t\t\t<SuspenseThatPreservesDom>\n\t\t\t\t\t\t\t\t\t\t<NotFoundErrorBoundary\n\t\t\t\t\t\t\t\t\t\t\tnotFoundPage={notFoundPage}\n\t\t\t\t\t\t\t\t\t\t\tdefaultPageStyle={defaultPageStyle}\n\t\t\t\t\t\t\t\t\t\t\tforceUpdateKey={dep}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{/* always keep MarkSuspenseEffects.Start as the first child of the error boundary */}\n\t\t\t\t\t\t\t\t\t\t\t<MarkSuspenseEffects.Start />\n\n\t\t\t\t\t\t\t\t\t\t\t<WithLayoutTemplate\n\t\t\t\t\t\t\t\t\t\t\t\tLayoutTemplate={LayoutTemplate}\n\t\t\t\t\t\t\t\t\t\t\t\t// If the route had been replaced with an AB testing variant,\n\t\t\t\t\t\t\t\t\t\t\t\t// we need to take the webPageId from the variant,\n\t\t\t\t\t\t\t\t\t\t\t\t// see `patchRoutesForABTesting`\n\t\t\t\t\t\t\t\t\t\t\t\twebPageId={currentRoute?.abTestingVariantId ?? currentRouteId}\n\t\t\t\t\t\t\t\t\t\t\t\tstyle={defaultPageStyle}\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{inLayoutTemplate => {\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Fragment key={remountKey}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{pageExistsInCurrentLocale\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? renderPage(currentRoute.page, inLayoutTemplate ? templatePageStyle : defaultPageStyle)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: // LAYOUT_TEMPLATE @TODO: display: content for not found page?\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnotFoundPage && renderPage(notFoundPage, defaultPageStyle)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t</WithLayoutTemplate>\n\t\t\t\t\t\t\t\t\t\t</NotFoundErrorBoundary>\n\n\t\t\t\t\t\t\t\t\t\t{EditorBar && <EditorBarLauncher EditorBar={EditorBar} />}\n\n\t\t\t\t\t\t\t\t\t\t{/* always keep the following two as the last child of the SuspenseThatPreservesDom */}\n\t\t\t\t\t\t\t\t\t\t<TurnOnReactEventHandling />\n\t\t\t\t\t\t\t\t\t\t<MarkSuspenseEffects.End />\n\t\t\t\t\t\t\t\t\t</SuspenseThatPreservesDom>\n\t\t\t\t\t\t\t\t</SynchronousSuspenseErrorBoundary>\n\t\t\t\t\t\t\t</TriggerStateProvider>\n\t\t\t\t\t\t</URLSearchParamsProvider>\n\t\t\t\t\t</CustomCursorHost>\n\t\t\t\t</LayoutDirectionContext.Provider>\n\t\t\t</LocaleInfoContext.Provider>\n\t\t</RouterAPIProvider>\n\t)\n}\n\ninterface WithLayoutTemplateProps {\n\twebPageId: string\n\tstyle?: React.CSSProperties\n\tLayoutTemplate:\n\t\t| React.ComponentType<{\n\t\t\t\twebPageId: string\n\t\t\t\tstyle?: React.CSSProperties\n\t\t\t\tchildren: (inLayoutTemplate: boolean) => React.ReactNode\n\t\t  }>\n\t\t| undefined\n\tchildren: (inLayoutTemplate: boolean) => React.ReactNode\n}\n\nfunction WithLayoutTemplate({ LayoutTemplate, webPageId, style, children }: WithLayoutTemplateProps) {\n\tif (!LayoutTemplate) return children(false)\n\n\treturn (\n\t\t<LayoutTemplate webPageId={webPageId} style={style}>\n\t\t\t{children}\n\t\t</LayoutTemplate>\n\t)\n}\n\nfunction scrollElementIntoView(element: HTMLElement, smoothScroll: boolean | undefined) {\n\t// When using smooth scrolling, we need to include both the\n\t// `block` and `inline` option even though they are using the\n\t// default value. This fixes a weird bug where smooth scrolling\n\t// moves the whole preview viewport when the status bar is\n\t// hidden.\n\tconst scrollIntoViewOptions: ScrollIntoViewOptions | undefined = smoothScroll\n\t\t? { behavior: \"smooth\", block: \"start\", inline: \"nearest\" }\n\t\t: undefined\n\telement.scrollIntoView(scrollIntoViewOptions)\n}\n", "export const FORCE_SHOW_EDITORBAR_LOCALSTORAGE_KEY = \"__framer_force_showing_editorbar_since\" as const\nexport const EDITOR_BUTTON_POSITION_LOCALSTORAGE_KEY = \"__framer_editor_button_position\" as const\nexport const MAX_Z_INDEX = \"2147483647\"\n", "import { FORCE_SHOW_EDITORBAR_LOCALSTORAGE_KEY } from \"@framerjs/shared/src/constants.ts\"\nimport { Suspense, useContext, useMemo, useSyncExternalStore } from \"react\"\nimport { IgnoreErrors } from \"../components/IgnoreErrors.tsx\"\nimport { FormContext } from \"../render/presentation/Forms/FormContainer.tsx\"\nimport { noopSubscribe, returnFalse } from \"../utils/utils.ts\"\nimport { useLibraryFeatures } from \"./LibraryFeaturesContext.ts\"\nimport type { PageRootProps } from \"./PageRootProps.ts\"\n\nexport interface EditorBarProps {\n\tframerSiteId: string\n\tfeatures?: Record<string, boolean>\n}\n\nconst isPrioritized = () => {\n\ttry {\n\t\treturn !!localStorage[FORCE_SHOW_EDITORBAR_LOCALSTORAGE_KEY]\n\t} catch (e) {\n\t\treturn false\n\t}\n}\nconst isntPrioritized = () => !isPrioritized()\n\nexport function EditorBarLauncher({\n\tEditorBar,\n\tfast = false,\n}: {\n\tEditorBar: PageRootProps[\"EditorBar\"]\n\tfast?: boolean\n}) {\n\tconst libraryFeatures = useLibraryFeatures()\n\tconst framerSiteId = useContext(FormContext)\n\n\t// eslint-disable-next-line framer-studio/no-usesyncexternalstore -- safe here\n\tconst enabled = useSyncExternalStore(noopSubscribe, fast ? isPrioritized : isntPrioritized, returnFalse)\n\n\tconst editorBarFeatures = useMemo(() => {\n\t\tconst features: Record<string, boolean> = {}\n\t\tlet key: keyof typeof libraryFeatures\n\t\tfor (key in libraryFeatures) {\n\t\t\t// biome-ignore lint/suspicious/noPrototypeBuiltins: Object.hasOwn not supported in library\n\t\t\tif (libraryFeatures.hasOwnProperty(key) && (key.startsWith(\"editorBar\") || key.startsWith(\"onPage\"))) {\n\t\t\t\tfeatures[key] = libraryFeatures[key] as boolean\n\t\t\t}\n\t\t}\n\t\treturn features\n\t}, [libraryFeatures])\n\n\tif (!EditorBar || !framerSiteId || !enabled) return null\n\n\treturn (\n\t\t<IgnoreErrors>\n\t\t\t<Suspense>\n\t\t\t\t<EditorBar framerSiteId={framerSiteId} features={editorBarFeatures} />\n\t\t\t</Suspense>\n\t\t</IgnoreErrors>\n\t)\n}\n", "import type { PropsWithChildren } from \"react\"\nimport { Component } from \"react\"\n\ninterface State {\n\terror?: unknown\n}\n\nexport class IgnoreErrors extends Component<PropsWithChildren, State> {\n\toverride state = { error: undefined }\n\n\tstatic getDerivedStateFromError(error: unknown) {\n\t\treturn { error }\n\t}\n\n\toverride render() {\n\t\tif (this.state.error) return null\n\t\treturn this.props.children\n\t}\n}\n", "import { createContext, useContext, useEffect, useRef, useState } from \"react\"\nimport { fillPathVariables } from \"../router/fillPathVariables.ts\"\nimport type { RouterAPI } from \"../router/types.ts\"\nimport { assert } from \"../utils/assert.ts\"\nimport { type PageviewEventData, isValidTrackingId, sendTrackingEvent } from \"../utils/sendTrackingEvent.ts\"\nimport { TriggerState, type TriggerStateInitial } from \"../utils/triggerActions.ts\"\nimport { isStaticRenderer } from \"./useIsStaticRenderer.ts\"\n\ninterface TriggerStateContextValue {\n\tgetInitialState: () => TriggerStateInitial\n\ttriggerStateRef: React.MutableRefObject<TriggerState | null>\n}\n\nconst TriggerStateContext = /* @__PURE__ */ (() => {\n\tconst Context = createContext<TriggerStateContextValue | undefined>(undefined)\n\tContext.displayName = \"TriggerStateContext\"\n\treturn Context\n})()\n\ninterface TriggerStateProviderProps {\n\tcurrentRoutePath: string | undefined\n\t/** Should only be undefined if no router is available, e.g. in the component preview */\n\trouterAPI: RouterAPI | undefined\n\tchildren: React.ReactNode\n}\n\nexport function TriggerStateProvider({ currentRoutePath, routerAPI, children }: TriggerStateProviderProps) {\n\tconst visitedPagesRef = useRef<Set<string>>()\n\tconst routeChangeHandlerRef = useRef<Parameters<TriggerStateInitial[\"setRouteChangeHandler\"]>[0]>()\n\tconst routerAPIRef = useRef<RouterAPI | undefined>(routerAPI)\n\tconst triggerStateRef = useRef<TriggerState | null>(null)\n\trouterAPIRef.current = routerAPI\n\n\tuseEffect(() => {\n\t\tif (!currentRoutePath) return\n\n\t\tvisitedPagesRef.current ??= new Set()\n\t\tvisitedPagesRef.current.add(currentRoutePath)\n\n\t\trouteChangeHandlerRef.current?.(currentRoutePath)\n\t}, [currentRoutePath])\n\n\tconst [initialState] = useState<TriggerStateContextValue>(() => ({\n\t\tgetInitialState: (): TriggerStateInitial => ({\n\t\t\tvisitedPages: visitedPagesRef.current ?? new Set(),\n\t\t\tgetCurrentRoutePath: () =>\n\t\t\t\trouterAPIRef.current\n\t\t\t\t\t? resolveRoutePath(\n\t\t\t\t\t\t\trouterAPIRef.current,\n\t\t\t\t\t\t\trouterAPIRef.current.currentRouteId,\n\t\t\t\t\t\t\trouterAPIRef.current.currentPathVariables,\n\t\t\t\t\t\t)\n\t\t\t\t\t: \"\",\n\t\t\tresolveRoute: linkToWebPage =>\n\t\t\t\trouterAPIRef.current\n\t\t\t\t\t? resolveRoutePath(routerAPIRef.current, linkToWebPage.webPageId, linkToWebPage.pathVariables)\n\t\t\t\t\t: \"\",\n\t\t\tsetRouteChangeHandler: (handler: (currentPath: string) => void) => {\n\t\t\t\trouteChangeHandlerRef.current = handler\n\t\t\t},\n\t\t\tsendTrackingEvent: async (event: Parameters<TriggerStateInitial[\"sendTrackingEvent\"]>[0]) => {\n\t\t\t\tif (!routerAPIRef.current) return\n\t\t\t\tvoid sendTrackingEventForTriggerInvoke(routerAPIRef.current.pageviewEventData.current, event)\n\t\t\t},\n\t\t}),\n\t\ttriggerStateRef,\n\t}))\n\n\treturn <TriggerStateContext.Provider value={initialState}>{children}</TriggerStateContext.Provider>\n}\n\nasync function sendTrackingEventForTriggerInvoke(\n\tmaybePageViewEventData: PageviewEventData | Promise<PageviewEventData | undefined> | undefined,\n\tevent: Parameters<TriggerStateInitial[\"sendTrackingEvent\"]>[0],\n) {\n\tif (!isValidTrackingId(event.trackingId)) return\n\n\tconst pageViewEventData =\n\t\tmaybePageViewEventData instanceof Promise ? await maybePageViewEventData : maybePageViewEventData\n\tif (!pageViewEventData) return\n\n\tsendTrackingEvent(\n\t\t\"published_site_trigger_invoke\",\n\t\t{\n\t\t\t...pageViewEventData,\n\t\t\t...event,\n\t\t\t// Don't attach a tracking ID if it's empty\n\t\t\ttrackingId: event.trackingId || null,\n\t\t},\n\t\t\"lazy\",\n\t)\n}\n\nfunction resolveRoutePath(routerAPI: RouterAPI, routeId: string, pathVariables?: Record<string, unknown>) {\n\tconst route = routerAPI.getRoute(routeId)\n\tif (!route || !route.path) return \"\"\n\treturn pathVariables ? fillPathVariables(route.path, pathVariables) : route.path\n}\n\nexport function useTriggerState() {\n\tconst triggerStateContext = useContext(TriggerStateContext)\n\tconst triggerState = getTriggerState(triggerStateContext)\n\treturn triggerState\n}\n\nfunction getTriggerState(triggerStateContext?: TriggerStateContextValue) {\n\tif (typeof window === \"undefined\" || !window.document || isStaticRenderer()) return null\n\tassert(triggerStateContext, \"TriggerStateProvider is missing\")\n\n\tconst { getInitialState, triggerStateRef } = triggerStateContext\n\tif (triggerStateRef.current instanceof TriggerState) {\n\t\treturn triggerStateRef.current\n\t}\n\n\t// lazily initialize the trigger state so it can be tree shaken for any sites without triggers\n\ttriggerStateRef.current = new TriggerState(getInitialState())\n\treturn triggerStateRef.current\n}\n\nexport const testing = {\n\tTriggerStateContext,\n}\n", "import { debounce } from \"../render/utils/debounce.ts\"\nimport type { WindowWithTriggerEvents } from \"./createTrigger.ts\"\nimport type { TriggerEventHistoryType } from \"./triggerActions.ts\"\n\nconst triggerHistoryStorageKey = \"framer:trigger-history:v1\"\nconst triggerHistoryStorageVersion = 1\n\nexport const TriggerActionsStorageSymbol = /** @__PURE__ */ Symbol(\"TriggerStorage\")\nexport class TriggerActionsStorage {\n\tprivate readonly eventsToTrack: Set<string> = new Set()\n\tprivate readonly historyEvents = new Map<string, number>()\n\tprivate readonly persistHistory = debounce(() => this.flushHistoryToStorage(), 250)\n\tconstructor() {\n\t\tif (typeof window === \"undefined\" || !window.document) return\n\n\t\tthis.eventsToTrack = getTriggerEventsToTrack()\n\n\t\tthis.initializeHistoryListeners()\n\t\tthis.loadHistoryFromStorage()\n\t}\n\n\tprivate initializeHistoryListeners() {\n\t\tif (typeof window === \"undefined\" || !window.document) return\n\t\twindow.document.addEventListener(\"framer:click\", this.onClickEvent)\n\t\twindow.document.addEventListener(\"framer:formsubmit\", this.onFormSubmitEvent)\n\t\twindow.addEventListener(\"storage\", this.onStorageEvent)\n\t}\n\n\tprivate onClickEvent = (event: Event) => {\n\t\tconst detail = (event as CustomEvent<{ trackingId?: string }>).detail\n\t\tif (!detail?.trackingId) return\n\t\tthis.recordHistoryEvent(\"click\", detail.trackingId)\n\t}\n\n\tprivate onFormSubmitEvent = (event: Event) => {\n\t\tconst detail = (event as CustomEvent<{ trackingId?: string }>).detail\n\t\tif (!detail?.trackingId) return\n\t\tthis.recordHistoryEvent(\"form_submit\", detail.trackingId)\n\t}\n\n\tonTriggerInvoke(triggerTargetId: string) {\n\t\tthis.recordHistoryEvent(\"trigger_invoke\", triggerTargetId)\n\t}\n\n\tprivate onStorageEvent = (event: StorageEvent) => {\n\t\tif (event.key !== triggerHistoryStorageKey) return\n\t\tconst parsed = parseHistoryStorage(event.newValue)\n\t\tif (parsed) {\n\t\t\tupdateMap(this.historyEvents, parsed)\n\t\t}\n\t}\n\n\tprivate recordHistoryEvent(eventType: TriggerEventHistoryType, id: string) {\n\t\tif (!this.eventsToTrack.has(getKey(eventType, id))) return\n\n\t\tthis.historyEvents.set(getKey(eventType, id), Date.now())\n\t\tthis.persistHistory()\n\t}\n\n\tprivate loadHistoryFromStorage() {\n\t\tif (typeof window === \"undefined\") return\n\t\ttry {\n\t\t\tconst parsed = parseHistoryStorage(window.localStorage.getItem(triggerHistoryStorageKey))\n\t\t\tif (parsed) {\n\t\t\t\tupdateMap(this.historyEvents, parsed)\n\t\t\t}\n\t\t} catch {\n\t\t\t// localStorage may be unavailable\n\t\t}\n\t}\n\n\tprivate flushHistoryToStorage() {\n\t\tif (typeof window === \"undefined\") return\n\t\ttry {\n\t\t\twindow.localStorage.setItem(\n\t\t\t\ttriggerHistoryStorageKey,\n\t\t\t\tJSON.stringify({\n\t\t\t\t\tversion: triggerHistoryStorageVersion,\n\t\t\t\t\tevents: Object.fromEntries(this.historyEvents.entries()),\n\t\t\t\t}),\n\t\t\t)\n\t\t} catch {\n\t\t\t// localStorage may be unavailable or full; ignore and keep in-memory history\n\t\t}\n\t}\n\n\thasSeenEvent(eventType: TriggerEventHistoryType, id: string, sinceMs?: number): boolean {\n\t\tconst key = getKey(eventType, id)\n\t\tconst now = Date.now()\n\t\tconst seenAt = this.historyEvents.get(key)\n\t\tif (seenAt === undefined) return false\n\t\tif (!sinceMs) return true\n\n\t\treturn seenAt + sinceMs >= now\n\t}\n}\n\nfunction parseHistoryStorage(raw: string | null): Map<string, number> | undefined {\n\tif (!raw) return undefined\n\ttry {\n\t\tconst parsed = JSON.parse(raw) as { version?: number; events?: Record<string, number> }\n\t\tif (parsed?.version !== triggerHistoryStorageVersion || !parsed.events) return undefined\n\t\treturn new Map(Object.entries(parsed.events))\n\t} catch {\n\t\treturn undefined\n\t}\n}\n\nfunction updateMap(map: Map<string, number>, incoming: Map<string, number>) {\n\tfor (const [key, value] of incoming.entries()) {\n\t\t// Skip events with a newer recorded timestamp\n\t\tif ((map.get(key) ?? 0) >= value) continue\n\t\tmap.set(key, value)\n\t}\n}\n\nfunction getKey(eventType: TriggerEventHistoryType, id: string) {\n\treturn `${eventType}:${id}`\n}\n\nfunction getTriggerEventsToTrack(): Set<string> {\n\tif (typeof window === \"undefined\" || !window.document || !(TriggerActionsStorageSymbol in window)) return new Set()\n\tconst safeWindow = window as WindowWithTriggerEvents\n\treturn new Set(safeWindow[TriggerActionsStorageSymbol])\n}\n", "import type { LinkToWebPage } from \"../modules/LinkToWebPage.ts\"\nimport { debounce } from \"../render/utils/debounce.ts\"\nimport { assert, assertNever } from \"./assert.ts\"\nimport type { TriggerInvokeEventData } from \"./sendTrackingEvent.ts\"\nimport { TriggerActionsStorage } from \"./triggerActionsStorage.ts\"\nimport { noop } from \"./utils.ts\"\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- needs to match Record<string, SerializableValue> DeclarationCollector.dedupe\ntype TriggerInteractionBase = { id: string; operator: \"and\" | \"or\" }\ntype TriggerInteractions =\n\t| { type: \"delay\"; delayMs: number; delayType: \"site\" | \"page\" }\n\t| { type: \"scrollPercentage\"; scrollPercentage: number }\n\t| { type: \"exit\"; exitType: \"mouseleave\" | \"visibilitychange\" | \"all\" }\nexport type TriggerInteraction = TriggerInteractionBase & TriggerInteractions\nexport type TypedTriggerInteraction<T extends TriggerInteraction[\"type\"]> = Extract<TriggerInteraction, { type: T }>\nexport type TriggerInvokeAction = { type: \"showOverlay\" } | { type: \"setComponentVariant\"; variant: string }\n\nexport type TriggerEventHistoryType = \"click\" | \"form_submit\" | \"trigger_invoke\"\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- needs to match Record<string, SerializableValue> DeclarationCollector.dedupe\nexport type TriggerEventHistoryRule = {\n\tid: string\n\teventType: TriggerEventHistoryType\n\teventId: string\n\truleType: \"seen\" | \"not-seen\"\n\twithinMs?: number\n}\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- needs to match Record<string, SerializableValue> DeclarationCollector.dedupe\nexport type KeyValueRule = {\n\tid: string\n\tkey: string\n\ttype: \"set\" | \"not-set\" | \"equals\"\n\tvalue?: string\n}\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- needs to match Record<string, SerializableValue> DeclarationCollector.dedupe\nexport type RouteRule = {\n\tid: string\n\troute: Pick<LinkToWebPage, \"webPageId\" | \"pathVariables\"> | undefined\n\twildcard?: boolean\n}\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- needs to match Record<string, SerializableValue> DeclarationCollector.dedupe\nexport type ScheduleRule = {\n\t/** ISO 8601 format without timezone offset, e.g. \"2026-01-02T15:00:00\" */\n\tstartAt?: string\n\t/** ISO 8601 format without timezone offset, e.g. \"2026-01-02T15:00:00\" */\n\tendAt?: string\n\t/** The offset from UTC, e.g. \"+02:00\" for startAt. If empty the schedule is evaluated as local time. */\n\tstartAtOffset?: string\n\t/**\n\t * The offset from UTC, e.g. \"+02:00\" for endAt. If empty the schedule is evaluated as local time.\n\t * It must be separate because the end and start could span DST boundaries.\n\t */\n\tendAtOffset?: string\n\t/** Required to identify the timezone in the UI, the true offset is embedded in the date strings */\n\ttimezone?: string\n}\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- needs to match Record<string, SerializableValue> DeclarationCollector.dedupe\nexport type Trigger = {\n\tinteractions: TriggerInteraction[]\n\ttrackingId: string\n\t// static checks like route matching can be added here when they are implemented, dynamic checks are added as TriggerConditions\n\tcookies?: { operator: \"and\" | \"or\"; rules: KeyValueRule[] }\n\turlParams?: { operator: \"and\" | \"or\"; rules: KeyValueRule[] }\n\tpageCount?: number\n\tincludeRoutes?: RouteRule[]\n\texcludeRoutes?: RouteRule[]\n\tschedule?: ScheduleRule\n\t/** Rules involving visitor's history with the site */\n\teventHistory?: TriggerEventHistoryRule[]\n}\n\ninterface TriggerEntry {\n\tstatus: \"pending\" | \"triggered\" | \"inactive\"\n\ttargetId: string\n\ttrigger: Trigger\n\tunsubscribeHandlers: Set<VoidFunction>\n\tcallback?: VoidFunction\n}\n\nconst cookieRegex = /^(?<key>[^=]*)=(?<value>.*)$/u\n\nexport interface TriggerStateInitial {\n\t/** For any pages that were already visited before the trigger state was initialized. */\n\tvisitedPages: Set<string>\n\t/** To get the current route id when matching paths. */\n\tgetCurrentRoutePath: () => string\n\t/** To resolve a link to a web page to a path to then do path matching. Doesn't resolve locale specific paths because we match with the default locale. */\n\tresolveRoute: (linkToWebPage: LinkToWebPage) => string\n\t/** To track number of pages visited. */\n\tsetRouteChangeHandler: (handler: (currentPath: string) => void) => void\n\tsendTrackingEvent: (event: Pick<TriggerInvokeEventData, \"trackingId\" | \"nodeId\">) => void\n}\n\ntype EmittableEventType = Extract<TriggerInteraction[\"type\"], \"exit\" | \"scrollPercentage\">\ntype EmittableEventPayload = Extract<TriggerInteractions, { type: EmittableEventType }>\ntype EmitFunction = (eventPayload: EmittableEventPayload) => void\n\nexport class TriggerState {\n\tprivate readonly triggers = new Map<string, TriggerEntry>()\n\tprivate readonly events = new Map<EmittableEventType, { handlers: Set<EmitFunction>; cleanup?: VoidFunction }>()\n\tprivate readonly initializedAtMs = Date.now()\n\tprivate lastRouteChangeAtMs = Date.now()\n\tprivate readonly visitedPages: TriggerStateInitial[\"visitedPages\"]\n\tprivate maxScrollPercentage = getScrollPercentage()\n\tprivate onTriggerListeners = new Set<(triggerId: string) => void>()\n\tprivate readonly delayTimeouts = new Map<string, ReturnType<typeof setTimeout>>()\n\tprivate readonly resolveRoute: TriggerStateInitial[\"resolveRoute\"]\n\tprivate readonly getCurrentRoutePath: TriggerStateInitial[\"getCurrentRoutePath\"]\n\tprivate readonly sendTrackingEvent: TriggerStateInitial[\"sendTrackingEvent\"]\n\tprivate readonly storage = new TriggerActionsStorage()\n\n\tconstructor(initial: TriggerStateInitial) {\n\t\tthis.visitedPages = new Set(initial.visitedPages)\n\t\tthis.resolveRoute = initial.resolveRoute\n\t\tthis.getCurrentRoutePath = initial.getCurrentRoutePath\n\t\tinitial.setRouteChangeHandler(this.onRouteChange)\n\t\tthis.sendTrackingEvent = initial.sendTrackingEvent\n\t}\n\n\tget invokedTriggers() {\n\t\treturn new Set(\n\t\t\t[...this.triggers.entries()]\n\t\t\t\t.filter(([, triggerEntry]) => triggerEntry.status === \"triggered\")\n\t\t\t\t.map(([trigger]) => trigger),\n\t\t)\n\t}\n\n\taddOnTriggerListener(listener: (triggerId: string) => void) {\n\t\tthis.onTriggerListeners.add(listener)\n\t}\n\n\tremoveOnTriggerListener(listener: (triggerId: string) => void) {\n\t\tthis.onTriggerListeners.delete(listener)\n\t}\n\n\tsubscribe(triggerId: string, targetId: string, trigger: Trigger, callback?: () => void) {\n\t\tif (isEmptyTrigger(trigger)) return noop\n\n\t\tconst triggerEntry = this.triggers.get(triggerId) ?? {\n\t\t\tstatus: \"pending\",\n\t\t\ttargetId,\n\t\t\ttrigger,\n\t\t\tunsubscribeHandlers: new Set(),\n\t\t}\n\n\t\tif (triggerEntry.status === \"triggered\") return noop\n\n\t\ttriggerEntry.callback = callback\n\t\ttriggerEntry.status = \"pending\"\n\t\tthis.triggers.set(triggerId, triggerEntry)\n\n\t\tif (this.evaluate(triggerId)) {\n\t\t\tthis.invoke(triggerId)\n\t\t} else {\n\t\t\tthis.register(triggerId)\n\t\t}\n\n\t\treturn () => {\n\t\t\tthis.unsubscribe(triggerId)\n\t\t}\n\t}\n\n\tunsubscribe(triggerId: string) {\n\t\tconst triggerEntry = this.triggers.get(triggerId)\n\t\tif (!triggerEntry) return\n\t\tif (triggerEntry.status === \"triggered\") return\n\n\t\ttriggerEntry.callback = undefined\n\t\ttriggerEntry.status = \"inactive\"\n\n\t\tclearTimeout(this.delayTimeouts.get(triggerId))\n\t\tthis.delayTimeouts.delete(triggerId)\n\n\t\tfor (const unsubscribe of triggerEntry.unsubscribeHandlers) {\n\t\t\tunsubscribe()\n\t\t}\n\t}\n\n\tprivate on(\n\t\tevent: EmittableEventType,\n\t\tinitialize: (emit: EmitFunction) => undefined | VoidFunction,\n\t\ttriggerId: string,\n\t) {\n\t\tconst triggerEntry = this.triggers.get(triggerId)\n\t\tif (!triggerEntry || triggerEntry.status !== \"pending\") return\n\n\t\tconst handler = (eventPayload: EmittableEventPayload) => {\n\t\t\tif (triggerEntry?.status !== \"pending\") return\n\n\t\t\t// evaluate so it will trigger if this event is what is being waited on\n\t\t\tthis.evaluateAndInvoke(triggerId, eventPayload)\n\t\t}\n\n\t\tlet state = this.events.get(event)\n\t\tif (!state) {\n\t\t\tstate = {\n\t\t\t\thandlers: new Set(),\n\t\t\t\tcleanup: initialize(eventPayload => {\n\t\t\t\t\tthis.events.get(event)?.handlers?.forEach(triggerHandler => triggerHandler(eventPayload))\n\t\t\t\t}),\n\t\t\t}\n\t\t\tthis.events.set(event, state)\n\t\t}\n\t\tstate.handlers.add(handler)\n\n\t\ttriggerEntry.unsubscribeHandlers.add(() => {\n\t\t\tthis.off(event, handler)\n\t\t})\n\t}\n\n\tprivate off(event: EmittableEventType, handler: EmitFunction) {\n\t\tconst state = this.events.get(event)\n\t\tif (!state) return\n\n\t\tstate.handlers.delete(handler)\n\n\t\tif (state.handlers.size !== 0) return\n\n\t\tthis.events.delete(event)\n\t\tstate.cleanup?.()\n\t}\n\n\tonRouteChange = (currentPath: string) => {\n\t\tthis.visitedPages.add(currentPath)\n\t\tthis.lastRouteChangeAtMs = Date.now()\n\t\tthis.reevaluatePendingTriggers()\n\t}\n\n\treevaluatePendingTriggers() {\n\t\tfor (const [triggerId, triggerEntry] of this.triggers.entries()) {\n\t\t\tif (triggerEntry.status === \"pending\") {\n\t\t\t\tthis.evaluateAndInvoke(triggerId)\n\t\t\t}\n\t\t}\n\t}\n\n\tevaluate(triggerId: string, eventPayload?: EmittableEventPayload) {\n\t\tconst triggerEntry = this.triggers.get(triggerId)\n\t\tassert(triggerEntry, \"Trigger should be available in triggers map before evaluation\")\n\t\tif (triggerEntry?.status === \"triggered\") return true\n\t\tif (!this.evaluateStaticRules(triggerEntry)) return false\n\n\t\tconst firstCondition = triggerEntry.trigger.interactions[0]\n\t\t// With no conditions the trigger is true because the static rules are already evaluated\n\t\tif (!firstCondition) return true\n\n\t\tlet operator: \"and\" | \"or\" = firstCondition.operator\n\t\tlet result: boolean = this.evaluateCondition(firstCondition, eventPayload)\n\n\t\t// evaluate from left to right (rather than logical order)\n\t\tfor (let i = 1; i < triggerEntry.trigger.interactions.length; i++) {\n\t\t\tconst condition = triggerEntry.trigger.interactions[i]\n\t\t\tassert(condition, \"Condition should be available in conditions array\")\n\n\t\t\tconst evaluatedCondition = this.evaluateCondition(condition, eventPayload)\n\n\t\t\tresult = operator === \"or\" ? result || evaluatedCondition : result && evaluatedCondition\n\t\t\toperator = condition.operator\n\t\t}\n\n\t\treturn result\n\t}\n\n\tprivate evaluateCondition(condition: TriggerInteraction, eventPayload?: EmittableEventPayload): boolean {\n\t\tswitch (condition.type) {\n\t\t\tcase \"delay\": {\n\t\t\t\tconst initial = condition.delayType === \"site\" ? this.initializedAtMs : this.lastRouteChangeAtMs\n\t\t\t\treturn Date.now() - initial >= condition.delayMs\n\t\t\t}\n\t\t\tcase \"scrollPercentage\":\n\t\t\t\tthis.maxScrollPercentage = Math.max(this.maxScrollPercentage, getScrollPercentage())\n\t\t\t\treturn this.maxScrollPercentage >= condition.scrollPercentage\n\t\t\tcase \"exit\":\n\t\t\t\tif (eventPayload?.type !== \"exit\") return false\n\t\t\t\treturn condition.exitType === \"all\"\n\t\t\t\t\t? Boolean(eventPayload.exitType)\n\t\t\t\t\t: eventPayload.exitType === condition.exitType\n\t\t\tdefault:\n\t\t\t\tassertNever(condition)\n\t\t}\n\t}\n\n\tprivate evaluateStaticRules(triggerEntry: TriggerEntry): boolean {\n\t\tif (triggerEntry.trigger.cookies && !this.evaluateCookies(triggerEntry.trigger.cookies)) return false\n\t\tif (triggerEntry.trigger.urlParams && !this.evaluateUrlParams(triggerEntry.trigger.urlParams)) return false\n\t\tif (triggerEntry.trigger.pageCount && this.visitedPages.size < triggerEntry.trigger.pageCount) return false\n\t\tif (!this.evaluateRouteRules(triggerEntry.trigger.includeRoutes, triggerEntry.trigger.excludeRoutes)) return false\n\t\tif (triggerEntry.trigger.schedule && !this.evaluateScheduleRules(triggerEntry.trigger.schedule)) return false\n\t\tif (triggerEntry.trigger.eventHistory && !this.evaluateEventHistoryRules(triggerEntry.trigger.eventHistory)) {\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t}\n\n\tprivate evaluateEventHistoryRules(eventHistory: Exclude<Trigger[\"eventHistory\"], undefined>): boolean {\n\t\tif (!eventHistory.length) return true\n\n\t\tfor (const rule of eventHistory) {\n\t\t\tconst seen = this.storage.hasSeenEvent(rule.eventType, rule.eventId, rule.withinMs)\n\t\t\tif (rule.ruleType === \"seen\" ? !seen : seen) return false\n\t\t}\n\n\t\treturn true\n\t}\n\n\tprivate evaluateCookies(cookies: Exclude<Trigger[\"cookies\"], undefined>): boolean {\n\t\tif (cookies.rules.length === 0) return true\n\t\tif (typeof window === \"undefined\" || !window.document) return false\n\n\t\tconst cookieStrings = (window.document.cookie ?? \"\")\n\t\t\t.split(\";\")\n\t\t\t.map(cookie => cookie.trim())\n\t\t\t.filter(Boolean)\n\n\t\tconst operatorFunction = cookies.operator === \"and\" ? \"every\" : \"some\"\n\n\t\treturn cookies.rules[operatorFunction](rule => {\n\t\t\tif (!rule.key) return false\n\t\t\tswitch (rule.type) {\n\t\t\t\tcase \"set\":\n\t\t\t\t\treturn cookieStrings.find(cookie => cookie.startsWith(`${rule.key}=`)) !== undefined\n\t\t\t\tcase \"not-set\":\n\t\t\t\t\treturn !cookieStrings.some(cookie => cookie.startsWith(`${rule.key}=`))\n\t\t\t\tcase \"equals\": {\n\t\t\t\t\tconst result = cookieRegex.exec(cookieStrings.find(cookie => cookie.startsWith(`${rule.key}=`)) ?? \"\")\n\t\t\t\t\treturn result?.groups?.value === rule.value\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n\n\tprivate evaluateUrlParams(params: Exclude<Trigger[\"urlParams\"], undefined>): boolean {\n\t\tif (params.rules.length === 0) return true\n\t\tif (typeof window === \"undefined\" || !window.location) return false\n\n\t\tconst urlParams = new URLSearchParams(window.location.search ?? \"\")\n\n\t\tconst operatorFunction = params.operator === \"and\" ? \"every\" : \"some\"\n\n\t\treturn params.rules[operatorFunction](rule => {\n\t\t\tif (!rule.key) return false\n\t\t\tswitch (rule.type) {\n\t\t\t\tcase \"set\":\n\t\t\t\t\treturn urlParams.has(rule.key)\n\t\t\t\tcase \"not-set\":\n\t\t\t\t\treturn !urlParams.has(rule.key)\n\t\t\t\tcase \"equals\": {\n\t\t\t\t\tconst value = urlParams.get(rule.key)\n\t\t\t\t\treturn value === rule.value\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n\n\tprivate evaluateRouteRules(includeRoutes: RouteRule[] | undefined, excludeRoutes: RouteRule[] | undefined): boolean {\n\t\tif (!includeRoutes?.length && !excludeRoutes?.length) return true\n\t\tconst currentPath = this.getCurrentRoutePath()\n\t\tif (!currentPath) return false\n\n\t\tfor (const routeRule of excludeRoutes ?? []) {\n\t\t\tif (!routeRule.route) continue\n\t\t\tconst targetPath = this.resolveRoute(routeRule.route)\n\t\t\tconst matches = routeRule.wildcard ? currentPath.startsWith(targetPath) : currentPath === targetPath\n\t\t\tif (matches) return false\n\t\t}\n\n\t\tfor (const routeRule of includeRoutes ?? []) {\n\t\t\tif (!routeRule.route) continue\n\t\t\tconst targetPath = this.resolveRoute(routeRule.route)\n\t\t\tconst matches = routeRule.wildcard ? currentPath.startsWith(targetPath) : currentPath === targetPath\n\t\t\tif (matches) return true\n\t\t}\n\n\t\t// if no include paths are specified, return true if no exclude paths matched\n\t\treturn !includeRoutes?.length\n\t}\n\n\tprivate evaluateScheduleRules(schedule: ScheduleRule | undefined): boolean {\n\t\tif (!schedule) return true\n\n\t\tconst now = new Date()\n\t\tif (schedule.startAt && new Date(`${schedule.startAt}${schedule.startAtOffset ?? \"\"}`) > now) return false\n\t\tif (schedule.endAt && new Date(`${schedule.endAt}${schedule.endAtOffset ?? \"\"}`) < now) return false\n\n\t\treturn true\n\t}\n\n\tevaluateAndInvoke(triggerId: string, eventPayload?: EmittableEventPayload) {\n\t\tif (this.evaluate(triggerId, eventPayload)) {\n\t\t\tthis.invoke(triggerId)\n\t\t}\n\t}\n\n\tinvoke(triggerId: string, options: { callCallback?: boolean } = { callCallback: true }) {\n\t\tconst triggerEntry = this.triggers.get(triggerId)\n\t\tif (!triggerEntry || triggerEntry.status !== \"pending\") return\n\n\t\ttriggerEntry.status = \"triggered\"\n\n\t\tfor (const listener of this.onTriggerListeners) {\n\t\t\tlistener(triggerId)\n\t\t}\n\n\t\tif (options.callCallback) {\n\t\t\ttriggerEntry.callback?.()\n\t\t\tthis.trackInvoke(triggerEntry)\n\t\t}\n\t}\n\n\tprivate trackInvoke(triggerEntry: TriggerEntry) {\n\t\tthis.storage.onTriggerInvoke(triggerEntry.targetId)\n\t\t// We delay the tracking event to ensure that the pageview data has had a chance to update if the trigger was\n\t\t// invoked immediately on route change or initial render\n\t\tsetTimeout(() => {\n\t\t\tthis.sendTrackingEvent({\n\t\t\t\ttrackingId: triggerEntry.trigger.trackingId,\n\t\t\t\tnodeId: parseTriggerTargetId(triggerEntry.targetId).nodeId ?? null,\n\t\t\t})\n\t\t}, 20)\n\t}\n\n\tprivate register(triggerId: string) {\n\t\tconst triggerEntry = this.triggers.get(triggerId)\n\t\tif (!triggerEntry || triggerEntry.status !== \"pending\") return\n\n\t\t// somehow schedule the next evaluation, each condition type will be different\n\t\tfor (const condition of triggerEntry.trigger.interactions) {\n\t\t\tswitch (condition.type) {\n\t\t\t\tcase \"delay\":\n\t\t\t\t\t{\n\t\t\t\t\t\tconst initial = condition.delayType === \"site\" ? this.initializedAtMs : this.lastRouteChangeAtMs\n\t\t\t\t\t\tclearTimeout(this.delayTimeouts.get(triggerId))\n\t\t\t\t\t\tthis.delayTimeouts.set(\n\t\t\t\t\t\t\ttriggerId,\n\t\t\t\t\t\t\tsetTimeout(\n\t\t\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t\t\tthis.evaluateAndInvoke(triggerId)\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tinitial + condition.delayMs - Date.now(),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tcase \"scrollPercentage\":\n\t\t\t\t\tthis.on(\"scrollPercentage\", initializeScrollPercentageListener, triggerId)\n\t\t\t\t\tbreak\n\t\t\t\tcase \"exit\":\n\t\t\t\t\tthis.on(\"exit\", initializeExitListener, triggerId)\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(condition)\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction initializeExitListener(emit: EmitFunction) {\n\tif (typeof window === \"undefined\") return\n\n\tconst visibilityChangeHandler = () => {\n\t\tif (document.hidden) emit({ type: \"exit\", exitType: \"visibilitychange\" })\n\t}\n\twindow.document.addEventListener(\"visibilitychange\", visibilityChangeHandler)\n\tconst mouseLeaveHandler = () => emit({ type: \"exit\", exitType: \"mouseleave\" })\n\twindow.document.documentElement.addEventListener(\"mouseleave\", mouseLeaveHandler)\n\n\treturn () => {\n\t\twindow.document.removeEventListener(\"visibilitychange\", visibilityChangeHandler)\n\t\twindow.document.documentElement.removeEventListener(\"mouseleave\", mouseLeaveHandler)\n\t}\n}\n\nfunction initializeScrollPercentageListener(emit: EmitFunction) {\n\tif (typeof window === \"undefined\") return\n\tconst debouncedEmit = debounce(() => emit({ type: \"scrollPercentage\", scrollPercentage: getScrollPercentage() }), 100)\n\twindow.document.addEventListener(\"scroll\", debouncedEmit)\n\n\treturn () => {\n\t\twindow.document.removeEventListener(\"scroll\", debouncedEmit)\n\t}\n}\n\nfunction getScrollPercentage() {\n\tif (typeof window === \"undefined\" || !window.document) return 0\n\treturn (window.scrollY / (window.document.documentElement.scrollHeight - window.innerHeight)) * 100 || 0\n}\n\nconst interactionTitles: Record<TriggerInteraction[\"type\"], string> = {\n\tdelay: \"Time\",\n\tscrollPercentage: \"Scroll\",\n\texit: \"Exit\",\n}\n\nexport function getTriggerTitle(trigger: Trigger): string {\n\tif (trigger.interactions?.length > 0) {\n\t\treturn trigger.interactions.map(condition => interactionTitles[condition.type]).join(\", \")\n\t}\n\n\tconst param = trigger.urlParams?.rules?.[0]\n\tif (param?.key && param.type !== \"not-set\") {\n\t\treturn `?${param.type === \"equals\" ? `${param.key}=${param.value}` : param.key}`\n\t}\n\n\tconst cookie = trigger.cookies?.rules?.[0]\n\tif (cookie?.key && cookie.type !== \"not-set\") {\n\t\treturn cookie.type === \"equals\" ? `${cookie.key}=${cookie.value}` : cookie.key\n\t}\n\n\tif (trigger.pageCount) {\n\t\treturn trigger.pageCount === 1 ? \"1 page\" : `${trigger.pageCount} pages`\n\t}\n\n\treturn isEmptyTrigger(trigger) ? \"Empty\" : \"Condition\"\n}\n\nexport function isEmptyTrigger(trigger: Trigger): boolean {\n\treturn (\n\t\ttrigger.interactions.length === 0 &&\n\t\t!trigger.cookies?.rules.length &&\n\t\t!trigger.urlParams?.rules.length &&\n\t\t!trigger.pageCount &&\n\t\t!trigger.includeRoutes?.length &&\n\t\t!trigger.excludeRoutes?.length &&\n\t\t!trigger.schedule?.startAt &&\n\t\t!trigger.schedule?.endAt &&\n\t\t// a trigger is still empty if it only has a trigger_invoke event history rule\n\t\t!trigger.eventHistory?.some(rule => rule.eventType !== \"trigger_invoke\")\n\t)\n}\n\nconst targetIdActionSuffixes = {\n\tshowOverlay: \"ovl\",\n\tsetComponentVariant: \"cv\",\n} as const\n\nexport function getTriggerTargetId(nodeId: string, action: TriggerInvokeAction[\"type\"]) {\n\treturn [nodeId, targetIdActionSuffixes[action]].join(\"-\")\n}\n\nfunction parseTriggerTargetId(targetId: string) {\n\tconst [nodeId, actionSuffix] = targetId.split(\"-\")\n\treturn { nodeId, actionSuffix }\n}\n", "export const mainTagId = \"main\"\n\nexport const importMapDataAttr = \"data-framer-importmap\"\nexport const esModuleShimsDataAttr = \"data-framer-es-module-shims\"\n\nexport const bundleDataAttr = \"data-framer-bundle\"\nexport const mainBundleName = \"main\"\n\nexport const hydrateV2DataAttr = \"data-framer-hydrate-v2\"\nexport const hydrateV2DatasetKey = \"framerHydrateV2\"\n\nexport const generatedPageDataAttr = \"data-framer-generated-page\"\nexport const generatedPageDatasetKey = \"framerGeneratedPage\"\n\nexport const searchIndexMetaName = \"framer-search-index\"\nexport const searchIndexMetaSelector = `meta[name=\"${searchIndexMetaName}\"]`\n\nexport const searchIndexFallbackMetaName = \"framer-search-index-fallback\"\n\n// #region Custom HTML\nexport const startOfHeadStartMarker = \"<!-- Start of headStart -->\"\nexport const endOfHeadStartMarker = \"<!-- End of headStart -->\"\n\nexport const startOfHeadEndMarker = \"<!-- Start of headEnd -->\"\nexport const endOfHeadEndMarker = \"<!-- End of headEnd -->\"\n\nexport const startOfBodyStartMarker = \"<!-- Start of bodyStart -->\"\nexport const endOfBodyStartMarker = \"<!-- End of bodyStart -->\"\n\nexport const startOfBodyEndMarker = \"<!-- Start of bodyEnd -->\"\nexport const endOfBodyEndMarker = \"<!-- End of bodyEnd -->\"\n// #endregion\n", "import type { CustomCodePlacement } from \"@framerjs/shared/src/custom-code/types.ts\"\nimport { generatedPageDatasetKey, mainTagId } from \"@framerjs/shared/src/ssg/constants.ts\"\nimport { useCallback } from \"react\"\nimport type { Locale } from \"../../router/types.ts\"\nimport { useSnippets } from \"./context.tsx\"\nimport { loadSnippets } from \"./loadSnippets.ts\"\n\nexport function useLoadSnippets() {\n\tconst loadSnippetsModule = useSnippets()\n\n\treturn useCallback(\n\t\tasync (\n\t\t\tpageId: string,\n\t\t\tpathVariables: Record<string, unknown>,\n\t\t\tactiveLocale: Locale | null,\n\t\t\tisInitialNavigation: boolean,\n\t\t) => {\n\t\t\t// If we don't have a snippets module loader, there's nothing to do\n\t\t\tif (!loadSnippetsModule) return\n\n\t\t\tconst mainTag = document.getElementById(mainTagId)\n\t\t\tconst isGeneratedPage = mainTag && mainTag.dataset[generatedPageDatasetKey] !== undefined\n\n\t\t\t// In this case, the snippets were already loaded via SSG\n\t\t\tif (isInitialNavigation && isGeneratedPage) return\n\n\t\t\tconst { getSnippets, snippetsSorting } = await loadSnippetsModule.readMaybeAsync()\n\n\t\t\tconst snippets = await getSnippets(pageId, pathVariables, activeLocale)\n\n\t\t\tfor (const key in snippets) {\n\t\t\t\tconst placement = key as CustomCodePlacement\n\t\t\t\tconst snippetsForPlacement = snippets[placement]\n\t\t\t\tconst sorting = snippetsSorting[placement]\n\n\t\t\t\tawait loadSnippets(placement, snippetsForPlacement, sorting)\n\t\t\t}\n\t\t},\n\t\t[loadSnippetsModule],\n\t)\n}\n", "import type { SnippetsModule } from \"@framerjs/shared/src/custom-code/types.ts\"\nimport React from \"react\"\nimport type { LazyValue } from \"../LazyValue.ts\"\n\nconst SnippetsContext = /* @__PURE__ */ (() => React.createContext<LazyValue<SnippetsModule> | undefined>(undefined))()\n\nexport function SnippetsProvider({\n\tchildren,\n\tloadSnippetsModule,\n}: {\n\tchildren: React.ReactNode\n\tloadSnippetsModule?: LazyValue<SnippetsModule>\n}) {\n\treturn <SnippetsContext.Provider value={loadSnippetsModule}>{children}</SnippetsContext.Provider>\n}\n\nexport function useSnippets() {\n\treturn React.useContext(SnippetsContext)\n}\n", "export function getSnippetMarkers(id: string) {\n\treturn {\n\t\tstart: `<!-- Snippet: ${id} -->`,\n\t\tend: `<!-- SnippetEnd: ${id} -->`,\n\t}\n}\n", "import { assert, assertNever } from \"./assert.ts\"\n\ntype Position = \"beforebegin\" | \"afterbegin\" | \"beforeend\" | \"afterend\"\n\n/**\n * Inserts `html` into the document relative to `referenceNode`.\n *\n * Will block parsing on sync scripts, mimicking the browser's parser.\n */\nexport async function insertHTML(html: string, referenceNode: Node, position: Position = \"beforeend\") {\n\tlet insertionParent: Node, insertionPoint: Node | null\n\tswitch (position) {\n\t\tcase \"beforebegin\":\n\t\t\tassert(referenceNode.parentNode, \"Can't use 'beforebegin' with a referenceNode at the top level\")\n\t\t\tinsertionParent = referenceNode.parentNode\n\t\t\tinsertionPoint = referenceNode\n\t\t\tbreak\n\t\tcase \"afterend\":\n\t\t\tassert(referenceNode.parentNode, \"Can't use 'afterend' with a referenceNode at the top level\")\n\t\t\tinsertionParent = referenceNode.parentNode\n\t\t\tinsertionPoint = referenceNode.nextSibling\n\t\t\tbreak\n\t\tcase \"afterbegin\":\n\t\t\tinsertionParent = referenceNode\n\t\t\tinsertionPoint = referenceNode.firstChild\n\t\t\tbreak\n\t\tcase \"beforeend\":\n\t\t\tinsertionParent = referenceNode\n\t\t\tinsertionPoint = null // append\n\t\t\tbreak\n\t\tdefault:\n\t\t\tassertNever(position)\n\t}\n\n\tconst range = document.createRange()\n\trange.selectNodeContents(insertionParent) // sets the parser context to e.g. <head>\n\tconst fragment = range.createContextualFragment(html)\n\n\t// Another way to do it, if `createContextualFragment` ever causes issues:\n\t//\n\t//     const template = document.createElement(\"template\")\n\t//     template.innerHTML = html\n\t//     // use `template.content` instead of `fragment`\n\t//\n\t// Keep in mind:\n\t//\n\t// - Template parses the HTML as-is, whereas createContextualFragment will e.g. automatically wrap <tr> in <tbody>,\n\t//   etc., like the browser would when parsing the initial document. We're trying to mimic the latter, so we prefer\n\t//   createContextualFragment.\n\t//\n\t// - Template seems to mark scripts as \"already started\", so cloning and inserting them into the actual document\n\t//   won't run them. So if you need to switch to template, you'll also need to adjust handleScript below to instead\n\t//   create a fresh script element and manually copy its attributes and content.\n\n\t// Depth-first stream of `fragment` into the real DOM.\n\tawait pump(fragment, insertionParent, insertionPoint)\n}\n\nasync function pump(sourceNode: Node, targetParent: Node, beforeNode: Node | null) {\n\tfor (let node = sourceNode.firstChild; node; node = node.nextSibling) {\n\t\tif (node instanceof HTMLScriptElement) {\n\t\t\tconst needsWait = handleScript(node, targetParent, beforeNode)\n\t\t\tif (needsWait !== undefined) {\n\t\t\t\t// In case `needsWait` is undefined, we can skip a microtick.\n\t\t\t\tawait needsWait\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tconst clone = node.cloneNode(false) // shallow copy\n\t\ttargetParent.insertBefore(clone, beforeNode)\n\n\t\tif (node.firstChild) {\n\t\t\t// Recurse into children, keeping them *inside* the freshly-cloned node.\n\t\t\tawait pump(node, clone, null)\n\t\t}\n\t}\n}\n\nfunction handleScript(node: HTMLScriptElement, parent: Node, beforeNode: Node | null) {\n\t// FIXME: JSDOM doesn't execute scripts if not cloned. In browsers, scripts created by `createContextualFragment`\n\t// just work correctly.\n\tconst script = node.cloneNode(true) as HTMLScriptElement\n\n\t// This doesn't work *exactly* like the spec to keep things simple, but it should be close enough.\n\t// For example, we don't check the type \"classic\", or we honor defer/async even on inline scripts, etc.\n\t// See https://html.spec.whatwg.org/multipage/scripting.html#prepare-the-script-element, points 32-34.\n\tif (\n\t\t!node.hasAttribute(\"src\") || // external\n\t\tnode.hasAttribute(\"async\") || // async\n\t\tnode.hasAttribute(\"defer\") || // defer\n\t\tnode.getAttribute(\"type\")?.toLowerCase() === \"module\" // module\n\t) {\n\t\t// Browser should take care of putting async/defer/module scripts in the correct queue, e.g.\n\t\t// - async goes to https://html.spec.whatwg.org/multipage/scripting.html#set-of-scripts-that-will-execute-as-soon-as-possible\n\t\t// - defer goes to https://html.spec.whatwg.org/multipage/scripting.html#list-of-scripts-that-will-execute-in-order-as-soon-as-possible\n\t\t// Noteworthy here is, inline deferred (non-async) module scripts won't synchronously\n\t\t// execute, but they will still execute in-order. This is likely not a problem, as\n\t\t// `<script type=\"module\">console.log(\"foo\")</script><script>console.log(\"bar\")</script>`\n\t\t// logs \"bar\" and \"foo\" in that order when loading the page (= the order of execution is expected).\n\t\t//\n\t\t// Additionally, this implementation slightly differs in how `defer` and `DOMContentLoaded`\n\t\t// usually interact. The reason is, `insertHTML` is most likely to be used after DOMContentLoaded\n\t\t// has run as it depends on hydration. When comparing the browser behavior\n\t\t// (https://developer.mozilla.org/en-US/docs/Web/API/Document/DOMContentLoaded_event) and\n\t\t// our implementation, we have the following differences:\n\t\t// - Deferred scripts will *not* wait for stylesheets to be loaded, and *neither* block the\n\t\t//   DOMContentLoaded event, *nor* execute before right before it.\n\t\t// - Scripts which aren't deferred or async (e.g., <script>) will *not* wait for\n\t\t//   already-parsed stylesheets to load.\n\t\tparent.insertBefore(script, beforeNode)\n\t} else {\n\t\treturn execExternalBlockingScript(script, parent, beforeNode)\n\t}\n}\n\nfunction execExternalBlockingScript(script: HTMLScriptElement, parent: Node, beforeNode: Node | null) {\n\treturn new Promise<Event | OnErrorEventHandler | string>(resolve => {\n\t\t// Errors should not stop us. The browser should log its own error.\n\t\tscript.onload = script.onerror = resolve\n\t\tparent.insertBefore(script, beforeNode)\n\t})\n}\n", "import { getSnippetMarkers } from \"@framerjs/shared/src/custom-code/markers.ts\"\nimport type { CustomCodePlacement } from \"@framerjs/shared/src/custom-code/types.ts\"\nimport {\n\tendOfBodyEndMarker,\n\tendOfBodyStartMarker,\n\tendOfHeadEndMarker,\n\tendOfHeadStartMarker,\n\tstartOfBodyEndMarker,\n\tstartOfBodyStartMarker,\n\tstartOfHeadEndMarker,\n\tstartOfHeadStartMarker,\n} from \"@framerjs/shared/src/ssg/constants.ts\"\n\ninterface CommentMarker {\n\tstart: ChildNode | null\n\tend: ChildNode | null\n}\n\nexport function findMarkers(placement: CustomCodePlacement): CommentMarker {\n\tlet startMarker: string\n\tlet endMarker: string\n\n\tswitch (placement) {\n\t\tcase \"bodyStart\":\n\t\t\tstartMarker = startOfBodyStartMarker\n\t\t\tendMarker = endOfBodyStartMarker\n\t\t\tbreak\n\t\tcase \"bodyEnd\":\n\t\t\tstartMarker = startOfBodyEndMarker\n\t\t\tendMarker = endOfBodyEndMarker\n\t\t\tbreak\n\t\tcase \"headStart\":\n\t\t\tstartMarker = startOfHeadStartMarker\n\t\t\tendMarker = endOfHeadStartMarker\n\t\t\tbreak\n\t\tcase \"headEnd\":\n\t\t\tstartMarker = startOfHeadEndMarker\n\t\t\tendMarker = endOfHeadEndMarker\n\t\t\tbreak\n\t}\n\n\tconst element = placement === \"bodyStart\" || placement === \"bodyEnd\" ? document.body : document.head\n\tlet start: ChildNode | null = null\n\tlet end: ChildNode | null = null\n\n\tfor (const node of element.childNodes) {\n\t\tif (node.nodeType !== Node.COMMENT_NODE) {\n\t\t\tcontinue\n\t\t}\n\n\t\tconst comment = `<!--${node.nodeValue}-->`\n\t\tif (comment === startMarker) {\n\t\t\tstart = node\n\t\t} else if (comment === endMarker) {\n\t\t\tend = node\n\t\t}\n\t}\n\n\treturn { start, end }\n}\n\nexport function findSnippetMarkerNodes(\n\tsnippetId: string,\n\tstartMarker: ChildNode | null,\n\tendMarker: ChildNode | null,\n): CommentMarker {\n\tif (!startMarker || !endMarker) {\n\t\treturn { start: null, end: null }\n\t}\n\n\tlet start: ChildNode | null = null\n\tlet end: ChildNode | null = null\n\n\tconst { start: startComment, end: endComment } = getSnippetMarkers(snippetId)\n\n\tlet node: ChildNode | null = startMarker.nextSibling\n\twhile (node && node !== endMarker) {\n\t\tif (node.nodeType !== Node.COMMENT_NODE) {\n\t\t\tnode = node.nextSibling\n\t\t\tcontinue\n\t\t}\n\n\t\tconst comment = `<!--${node.nodeValue}-->`\n\t\tif (comment === startComment) {\n\t\t\tstart = node\n\t\t} else if (comment === endComment) {\n\t\t\tend = node\n\t\t\tbreak\n\t\t}\n\n\t\tnode = node.nextSibling\n\t}\n\n\treturn { start, end }\n}\n", "import { getSnippetMarkers } from \"@framerjs/shared/src/custom-code/markers.ts\"\nimport type { CustomCodePlacement, Snippet } from \"@framerjs/shared/src/custom-code/types.ts\"\nimport { insertHTML } from \"../../utils/insertHTML.ts\"\nimport { findMarkers, findSnippetMarkerNodes } from \"./markers.ts\"\n\nexport async function loadSnippets(placement: CustomCodePlacement, snippets: Snippet[], sorting: string[]) {\n\tif (snippets.length === 0) return\n\n\tconst { start, end } = findMarkers(placement)\n\tconst placementParent = placement === \"bodyStart\" || placement === \"bodyEnd\" ? document.body : document.head\n\n\tfor (const snippet of snippets) {\n\t\tconst { start: startSnippetMarker, end: endSnippetMarker } = findSnippetMarkerNodes(snippet.id, start, end)\n\t\tconst isLoaded = startSnippetMarker && endSnippetMarker\n\t\tif (isLoaded && snippet.loadMode === \"once\") {\n\t\t\tcontinue\n\t\t}\n\n\t\tremoveSnippetElements(startSnippetMarker, endSnippetMarker)\n\n\t\t// If it's already loaded, insert the snippet content right before its end marker\n\t\tif (isLoaded) {\n\t\t\tawait insertHTML(snippet.code, endSnippetMarker, \"beforebegin\")\n\t\t\tcontinue\n\t\t}\n\n\t\tconst { start: codeStart, end: codeEnd } = getSnippetMarkers(snippet.id)\n\t\tconst code = `${codeStart}\\n${snippet.code}\\n${codeEnd}`\n\n\t\tconst insertReference = findInsertReferece(snippet.id, sorting, start, end)\n\t\tif (insertReference) {\n\t\t\tawait insertHTML(code, insertReference, \"afterend\")\n\t\t} else {\n\t\t\t// If we haven't found the snippet that should be before the current one\n\t\t\t// we insert it at the beginning of its placement marker, with a fallback to the beginning of its parent element\n\t\t\tconst node = start ?? placementParent\n\n\t\t\t// afterend in case we have a comment marker, so we insert after the comment\n\t\t\t// beforeend so that we insert inside the parent, not after and outside of it\n\t\t\tconst position = start ? \"afterend\" : \"beforeend\"\n\n\t\t\tawait insertHTML(code, node, position)\n\t\t}\n\t}\n}\n\nfunction removeSnippetElements(start: ChildNode | null, end: ChildNode | null) {\n\tif (!start || !end) return\n\n\tlet node: ChildNode | null | undefined = start.nextSibling\n\twhile (node && node !== end) {\n\t\tconst nextNode: ChildNode | null | undefined = node.nextSibling\n\t\tif (isRemovableNode(node)) {\n\t\t\tnode.remove()\n\t\t}\n\n\t\tnode = nextNode\n\t}\n}\n\nfunction isRemovableNode(node: ChildNode) {\n\tif (node.nodeType !== Node.ELEMENT_NODE) return true\n\n\tif (node.nodeName === \"SCRIPT\") {\n\t\tconst script = node as HTMLScriptElement\n\t\tconst type = script.type\n\n\t\t// In short, we want to\n\t\t// Keep:\n\t\t//  <script></script>\n\t\t//  <script src>\n\t\t//  <script type=\"application/javascript\">\n\t\t//  <script type=\"module\">\n\t\t// Remove:\n\t\t//  <script type=\"application/ld+json\">\n\t\t//  <script type=\"foo\">\n\t\tif (!type || type === \"text/javascript\" || type === \"module\") return false\n\t}\n\n\treturn true\n}\n\n/**\n * Searches the first reference point in the document for the given snippet id.\n *\n * This is necessary as there might be snippets that aren't loaded yet, but they are the previous items in the sorting array.\n */\nfunction findInsertReferece(snippetId: string, sorting: string[], start: ChildNode | null, end: ChildNode | null) {\n\tconst startIndex = sorting.indexOf(snippetId) - 1\n\tif (startIndex < 0) return null\n\n\tfor (let i = startIndex; i >= 0; i--) {\n\t\tconst item = sorting[i]\n\t\tif (!item) continue\n\n\t\tconst reference = findSnippetMarkerNodes(item, start, end).end\n\t\tif (reference) return reference\n\t}\n\n\treturn null\n}\n", "interface PageDescriptor {\n\trouteId: string\n\tpathVariables?: Record<string, unknown>\n}\n\nexport function isSamePage(a: PageDescriptor, b: PageDescriptor): boolean {\n\tif (a.routeId !== b.routeId) return false\n\tif (a.pathVariables === b.pathVariables) return true\n\n\tconst aPathVariables = a.pathVariables || {}\n\tconst bPathVariables = b.pathVariables || {}\n\treturn (\n\t\taPathVariables.length === bPathVariables.length &&\n\t\tObject.keys(aPathVariables).every(key => aPathVariables[key] === bPathVariables[key])\n\t)\n}\n", "import { useContext, useEffect, useRef } from \"react\"\nimport { useCollectionUtils } from \"../modules/cms/CollectionUtilsCache.tsx\"\nimport { FormContext } from \"../render/presentation/Forms/FormContainer.tsx\"\nimport { safeWindow } from \"../utils/safeWindow.ts\"\nimport type { PageviewEventData } from \"../utils/sendTrackingEvent.ts\"\nimport { pageviewEventVersion, sendTrackingEvent } from \"../utils/sendTrackingEvent.ts\"\nimport { isPromise, isString, requestIdleCallback } from \"../utils/utils.ts\"\nimport type { Locale, Route, RouteId } from \"./types.ts\"\n\nlet timezone: string | null = null\nlet visitorLocale: string | null = null\n\nfunction setTimezoneAndLocaleForTracking() {\n\tconst resolvedDateTimeOptions = Intl.DateTimeFormat().resolvedOptions()\n\ttimezone = resolvedDateTimeOptions.timeZone\n\tvisitorLocale = resolvedDateTimeOptions.locale\n}\n// Lazily initialize timezone and locale as `Intl.(...).resolvedOptions()` can be slow at times.\n// `sendTrackingEvent` is in an INP hotpath, so lazily reading it before a user clicks speeds it up.\nrequestIdleCallback(setTimezoneAndLocaleForTracking)\n\nexport const useSendPageView = (\n\tcurrentRoute: Route | undefined,\n\tcurrentRouteId: RouteId,\n\tcurrentPathnameWithHash: string | undefined,\n\tcurrentPathVariables: Record<string, unknown> | undefined,\n\tactiveLocale: Locale | null,\n\tinitialCollectionItemId?: string | null,\n) => {\n\tconst framerSiteId = useContext(FormContext)\n\tconst pageviewEventData = useRef<Promise<PageviewEventData> | PageviewEventData>()\n\tconst collectionUtils = useCollectionUtils()\n\n\t// Used to prevent sending pageview events for the first route\n\t// as the first pageview event is sent from the script generated by `exportToHTML.ts`\n\tconst skipFirstPageView = useRef(true)\n\n\tuseEffect(() => {\n\t\tfunction getFullPageviewEventData(): Promise<PageviewEventData> | PageviewEventData {\n\t\t\tif (!timezone || !visitorLocale) setTimezoneAndLocaleForTracking()\n\n\t\t\t// The current pathname is set when the current route changes.\n\t\t\t// For the initial route, we use the window location.\n\t\t\tconst currentLocation = currentPathnameWithHash\n\t\t\t\t? new URL(safeWindow.location.origin + currentPathnameWithHash)\n\t\t\t\t: safeWindow.location\n\n\t\t\tconst eventData: PageviewEventData = {\n\t\t\t\tversion: pageviewEventVersion,\n\t\t\t\tabTestId: currentRoute?.abTestId,\n\t\t\t\tframerSiteId: framerSiteId ?? null,\n\t\t\t\t// If we are in a variant route, let's use the variant ID as the route ID instead, so that the analytics panel will be able to show the correct tracking data.\n\t\t\t\twebPageId: currentRoute?.abTestingVariantId ?? currentRouteId,\n\t\t\t\troutePath: currentRoute?.path || \"/\",\n\t\t\t\tcollectionItemId: null,\n\t\t\t\tframerLocale: activeLocale?.code || null,\n\t\t\t\treferrer: null, // The first pageview event will always be sent before hydration, in a script in `exportToHTML.ts`.\n\t\t\t\turl: currentLocation.href,\n\t\t\t\thostname: currentLocation.hostname,\n\t\t\t\t// Capture the current location before the user moves to a new page to prevent\n\t\t\t\t// tracking wrong pathnames due to a race condition caused by async operations\n\t\t\t\t// when resolving the collection item ID below\n\t\t\t\tpathname: currentLocation.pathname,\n\t\t\t\tsearch: currentLocation.search || null,\n\t\t\t\thash: currentLocation.hash || null,\n\t\t\t\ttimezone,\n\t\t\t\tlocale: visitorLocale,\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * If the collectionItemId is not provided in the hydration data\n\t\t\t * (undefined), we load the id below.\n\t\t\t * Otherwise, `null` means we don't have a collectionItemId, because this is not a CMS page.\n\t\t\t */\n\t\t\tconst hydratedCollectionItemId =\n\t\t\t\tskipFirstPageView.current && initialCollectionItemId !== undefined ? initialCollectionItemId : undefined\n\t\t\treturn currentRoute?.collectionId && currentPathVariables\n\t\t\t\t? (async () => {\n\t\t\t\t\t\tlet collectionItemId: string | null = hydratedCollectionItemId ?? null\n\t\t\t\t\t\tif (hydratedCollectionItemId === undefined) {\n\t\t\t\t\t\t\tconst utils = currentRoute.collectionId && collectionUtils?.get(currentRoute.collectionId)\n\t\t\t\t\t\t\tconst [slug] = Object.values(currentPathVariables)\n\t\t\t\t\t\t\tif (utils && isString(slug)) {\n\t\t\t\t\t\t\t\tconst maybeCollectionItemId = utils.getRecordIdBySlug(slug, activeLocale || undefined)\n\t\t\t\t\t\t\t\tconst _collectionItemId = isPromise(maybeCollectionItemId)\n\t\t\t\t\t\t\t\t\t? await maybeCollectionItemId\n\t\t\t\t\t\t\t\t\t: maybeCollectionItemId\n\t\t\t\t\t\t\t\tcollectionItemId = _collectionItemId ?? null\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn { ...eventData, collectionItemId }\n\t\t\t\t\t})()\n\t\t\t\t: eventData\n\t\t}\n\n\t\tvoid (async () => {\n\t\t\t// Assign the pageview event data even when not sending the event as we return the ref below, which is used elsewhere in the codebase.\n\t\t\tconst eventDataOrPromise = (pageviewEventData.current = getFullPageviewEventData())\n\t\t\tconst eventData = eventDataOrPromise instanceof Promise ? await eventDataOrPromise : eventDataOrPromise\n\t\t\t// Capture the resolved pageview event data, so that we don't need to await it again when sending tracking events.\n\t\t\tpageviewEventData.current = eventData\n\n\t\t\t// Prevent sending pageview events for the first route as this first pageview event is sent from the script generated by `exportToHTML.ts`\n\t\t\tif (skipFirstPageView.current) {\n\t\t\t\tskipFirstPageView.current = false\n\t\t\t} else {\n\t\t\t\tsendTrackingEvent(\"published_site_pageview\", eventData, \"eager\")\n\t\t\t}\n\t\t})()\n\n\t\tconst listener = async (event: PageTransitionEvent) => {\n\t\t\t// Send another pageview if the page is restored from bfcache.\n\t\t\t// https://web.dev/articles/bfcache#analytics\n\t\t\tif (event.persisted) {\n\t\t\t\t// Assign the pageview event data even when not sending the event as we return the ref below, which is used elsewhere in the codebase.\n\t\t\t\tconst eventDataOrPromise = (pageviewEventData.current = getFullPageviewEventData())\n\t\t\t\tconst eventData = eventDataOrPromise instanceof Promise ? await eventDataOrPromise : eventDataOrPromise\n\t\t\t\t// Capture the resolved pageview event data so that we don't need to await it again when sending tracking events.\n\t\t\t\tpageviewEventData.current = eventData\n\t\t\t\tsendTrackingEvent(\"published_site_pageview\", eventData, \"eager\")\n\t\t\t}\n\t\t}\n\n\t\twindow.addEventListener(\"pageshow\", listener)\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener(\"pageshow\", listener)\n\t\t}\n\t}, [\n\t\tcurrentRoute,\n\t\tcurrentRouteId,\n\t\tcurrentPathnameWithHash,\n\t\tcurrentPathVariables,\n\t\tactiveLocale,\n\t\tframerSiteId,\n\t\tcollectionUtils,\n\t\tinitialCollectionItemId,\n\t])\n\n\treturn pageviewEventData\n}\n", "import React from \"react\"\n\nexport function useForceUpdate() {\n\tconst [_, setForcedRenderCount] = React.useState(0)\n\n\t// useForceUpdate is linted separately by the lint rult\n\t// eslint-disable-next-line framer-studio/no-setstate-without-transition\n\treturn [_, React.useCallback(() => setForcedRenderCount(v => v + 1), [])] as const\n}\n", "import { isBrowser } from \"@framerjs/shared/src/environment.ts\"\nimport type { PropsWithChildren } from \"react\"\nimport * as React from \"react\"\nimport { ControlType } from \"../render/types/PropertyControls.ts\"\nimport { RenderTarget } from \"../render/types/RenderEnvironment.ts\"\nimport { debounce } from \"../render/utils/debounce.ts\"\nimport { isEqual } from \"../render/utils/isEqual.ts\"\nimport { preloadImage } from \"../render/utils/preloadImage.ts\"\nimport { getPropertyByPath } from \"../utils/getPropertyByPath.ts\"\nimport { safeWindow } from \"../utils/safeWindow.ts\"\nimport { useMemoOne } from \"../utils/useMemoOne.ts\"\nimport { isBoolean, isNumber, isString, isUndefined } from \"../utils/utils.ts\"\nimport { isValidURL } from \"./Link/urlChecks.tsx\"\n\nexport type FetchResult =\n\t| {\n\t\t\tstatus: \"loading\"\n\t\t\tdata: undefined\n\t  }\n\t| {\n\t\t\tstatus: \"success\"\n\t\t\tdata: unknown\n\t  }\n\t| {\n\t\t\tstatus: \"error\"\n\t\t\terror: unknown\n\t\t\tdata: undefined\n\t  }\n\n// A request can consist of a URL + some options such as credentials (and potentially more in the future such as headers)\n// A combination of these options is used to create a cache key\ntype RequestCacheKey = string\n\nexport function getRequestCacheKey(value: Pick<FetchRequestConfig, \"url\" | \"credentials\">) {\n\treturn `${value.credentials}:${value.url}`\n}\n\n/**\n * This configuration object is serialized during Codegen in\n * `serializeFetchData.ts` It is important that they stay in sync\n */\nexport interface FetchRequestConfig {\n\turl: string\n\tcacheDuration: number\n\tfallbackValue: unknown\n\terrorFallbackValue?: unknown\n\tresultKeyPath: string\n\tresultOutputType:\n\t\t| ControlType.String\n\t\t| ControlType.Boolean\n\t\t| ControlType.Number\n\t\t| ControlType.Image\n\t\t| ControlType.Link\n\t\t| ControlType.Color\n\tcredentials?: RequestCredentials\n}\n\nconst loadingFetchResult: FetchResult = {\n\tstatus: \"loading\",\n\tdata: undefined,\n}\n\nfunction isNumberString(value: unknown) {\n\treturn isString(value) && !Number.isNaN(Number(value))\n}\n\nexport function isValidFetchDataValueResult(type: FetchRequestConfig[\"resultOutputType\"], value: unknown) {\n\tswitch (type) {\n\t\tcase ControlType.String:\n\t\t\treturn isString(value) || isNumber(value)\n\t\tcase ControlType.Color:\n\t\t\treturn isString(value)\n\t\tcase ControlType.Boolean:\n\t\t\treturn isBoolean(value)\n\t\tcase ControlType.Number:\n\t\t\treturn isNumber(value) || isNumberString(value)\n\t\tcase ControlType.Link:\n\t\tcase ControlType.Image:\n\t\t\treturn isString(value) && isValidURL(value, false)\n\t\tdefault: {\n\t\t\tconst _: never = type\n\t\t\treturn false\n\t\t}\n\t}\n}\n\n/** @internal */\nexport function resolveFetchDataValue(\n\tresult: FetchResult,\n\trequest: Pick<FetchRequestConfig, \"resultOutputType\" | \"resultKeyPath\" | \"fallbackValue\">,\n): unknown {\n\tif (result.status === \"loading\") {\n\t\treturn request.fallbackValue\n\t}\n\n\tif (result.status === \"error\") {\n\t\tthrow result.error\n\t}\n\n\tconst resolvedValue = getPropertyByPath(result.data, request.resultKeyPath)\n\n\tif (isUndefined(resolvedValue)) {\n\t\tthrow new Error(`Key '${request.resultKeyPath}' not found in response`)\n\t}\n\n\tif (!isValidFetchDataValueResult(request.resultOutputType, resolvedValue)) {\n\t\tthrow new Error(`Resolved value '${resolvedValue}' is not valid for type '${request.resultOutputType}'`)\n\t}\n\n\treturn resolvedValue\n}\n\ntype CacheEntry = [storedAt: number, cacheDuration: number, data: unknown]\n\n// Fetch requests are cached and keyed by their URL. We cache for a minimum duration to avoid\n// refetching data to the same endpoint for the scenarios where:\n// - Hydration kicks off fetches staggered over time\n// - \"Waterfall\" fetches where a Fetch to the same endpoint is only rendered after a previous fetch\n//   succeeded.\n//\n// We also can't just cache indefinitely because we want fresh data when the user navigates to a new\n// page or opens an overlay on the same route. So we cache for a minimum duration to avoid\n// refetching the same data in the typical \"user loads a page\" scenario\nconst minimumCacheDurationMs = 5000\n\nfunction isCacheExpired(insertionTimestamp: number, cacheDuration: number): boolean {\n\tif (RenderTarget.current() === RenderTarget.canvas) {\n\t\t// On the Canvas we only fetch once per session to keep canvas nodes and components in sync.\n\t\treturn false\n\t}\n\n\tconst cacheDurationMs = Math.max(cacheDuration * 1000, minimumCacheDurationMs)\n\tconst currentTimestamp = Date.now()\n\tconst expirationTimestamp = insertionTimestamp + cacheDurationMs\n\treturn currentTimestamp >= expirationTimestamp\n}\n\nconst noop = /** @__PURE__ */ () => {}\n\nexport class FetchClient {\n\tstatic cacheKey = \"framer-fetch-client-cache\"\n\n\t// A map of FetchResult values for each URL\n\tresponseValues: Map<RequestCacheKey, FetchResult> = new Map()\n\n\t// A map of URLs to their subscribers\n\t#subscribers: Map<RequestCacheKey, Set<VoidFunction>> = new Map()\n\n\t// A set of requests that have been preloaded by a loading variant\n\t#preloadedRequests: Set<RequestCacheKey> = new Set()\n\n\t// Map for how long to cache the response for (in seconds)\n\t#shortestCacheDurations: Map<RequestCacheKey, number> = new Map()\n\n\t// Map containing a timestamp when a URL was inserted into the cache\n\t#cachedAt: Map<RequestCacheKey, number> = new Map()\n\n\t// Map of promises for requests that are currently in flight\n\t#ongoingFetches: Map<RequestCacheKey, Promise<void>> = new Map()\n\n\t// An ID for an interval that checks for stale queries and refetches\n\t#staleQueriesInterval: Map<RequestCacheKey, number> = new Map()\n\n\tunmount() {\n\t\tfor (const [key, interval] of this.#staleQueriesInterval) {\n\t\t\tclearInterval(interval)\n\t\t\tthis.#staleQueriesInterval.delete(key)\n\t\t}\n\t}\n\n\tprivate stopQueryRefetching(request: FetchRequestConfig) {\n\t\tconst cacheKey = getRequestCacheKey(request)\n\t\tconst interval = this.#staleQueriesInterval.get(cacheKey)\n\n\t\tif (interval) {\n\t\t\tclearInterval(interval)\n\t\t\tthis.#staleQueriesInterval.delete(cacheKey)\n\t\t}\n\t}\n\n\t/**\n\t * Start an interval for the given request to refresh the value\n\t * depending on the shortest configured cache duration for that request.\n\t */\n\tprivate startQueryRefetching(request: FetchRequestConfig) {\n\t\tconst cacheKey = getRequestCacheKey(request)\n\n\t\tconst currentIntervalForRequest = this.#staleQueriesInterval.get(cacheKey)\n\t\tconst shortestCacheDuration = this.#shortestCacheDurations.get(cacheKey)\n\n\t\tif (currentIntervalForRequest) return\n\t\tif (!shortestCacheDuration) return\n\n\t\tconst interval = safeWindow.setInterval(() => {\n\t\t\tif (document.visibilityState === \"hidden\") return\n\n\t\t\tconst cachedAt = this.#cachedAt.get(cacheKey)\n\n\t\t\tif (!shortestCacheDuration || !cachedAt) return\n\n\t\t\tvoid this.fetchWithCache({\n\t\t\t\t...request,\n\t\t\t\tcacheDuration: shortestCacheDuration,\n\t\t\t})\n\t\t}, shortestCacheDuration)\n\n\t\tthis.#staleQueriesInterval.set(cacheKey, interval)\n\t}\n\n\thydrateCache() {\n\t\ttry {\n\t\t\tconst rawData = localStorage.getItem(FetchClient.cacheKey)\n\t\t\tif (!rawData) return\n\n\t\t\tconst data = JSON.parse(rawData)\n\t\t\tif (typeof data !== \"object\") throw new Error(\"Invalid cache data\")\n\n\t\t\tfor (const cacheKey in data) {\n\t\t\t\tconst cached = data[cacheKey]\n\t\t\t\tif (!Array.isArray(cached) || cached.length !== 3) throw new Error(\"Invalid cache data\")\n\n\t\t\t\tconst [storedAt, cacheDuration, cachedData] = cached\n\t\t\t\tif (isCacheExpired(storedAt, cacheDuration)) continue\n\n\t\t\t\tthis.#cachedAt.set(cacheKey, storedAt)\n\t\t\t\tthis.#shortestCacheDurations.set(cacheKey, cacheDuration)\n\t\t\t\tthis.responseValues.set(cacheKey, { status: \"success\", data: cachedData })\n\t\t\t}\n\t\t} catch (error) {\n\t\t\ttry {\n\t\t\t\tlocalStorage.removeItem(FetchClient.cacheKey)\n\t\t\t} catch {\n\t\t\t\t// Guard just in case. removeItem _should_ not throw but it should always no-op\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate setResponseValue(cacheKey: RequestCacheKey, value: FetchResult) {\n\t\tthis.responseValues.set(cacheKey, value)\n\n\t\tthis.persistCache()\n\n\t\tconst subscribers = this.#subscribers.get(cacheKey)\n\t\tif (!subscribers) return\n\n\t\tfor (const subscriber of subscribers) {\n\t\t\tsubscriber()\n\t\t}\n\t}\n\n\tprivate persistCache = debounce(() => {\n\t\tconst data: Record<string, CacheEntry> = {}\n\n\t\tfor (const [url, responseValue] of this.responseValues) {\n\t\t\tif (!responseValue) continue\n\t\t\tif (responseValue.status !== \"success\") continue\n\n\t\t\tconst cacheConfig = this.#shortestCacheDurations.get(url)\n\t\t\tif (!cacheConfig || cacheConfig === 0) continue\n\n\t\t\tconst storedAt = this.#cachedAt.get(url)\n\t\t\tif (!storedAt) continue\n\n\t\t\tif (storedAt && isCacheExpired(storedAt, cacheConfig)) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tdata[url] = [storedAt, cacheConfig, responseValue.data]\n\t\t}\n\n\t\ttry {\n\t\t\tlocalStorage.setItem(FetchClient.cacheKey, JSON.stringify(data))\n\t\t} catch {\n\t\t\t// Guard against QuotaExceededError: https://developer.mozilla.org/en-US/docs/Web/API/Storage/setItem#quotaexceedederror\n\t\t}\n\t}, 500)\n\n\tasync prefetch(request: FetchRequestConfig) {\n\t\t// Fetches are not performed in SSG and render with fallback.\n\t\tif (!isBrowser()) return\n\n\t\tif (!isValidURL(request.url, false)) return\n\n\t\tconst cacheKey = getRequestCacheKey(request)\n\t\tthis.#preloadedRequests.add(cacheKey)\n\n\t\tawait this.fetchWithCache(request)\n\t\tconst result = this.getValue(cacheKey)\n\n\t\tif (!result || result.status === \"loading\") {\n\t\t\tthrow new Error(\"Unexpected result status for prefetch\")\n\t\t}\n\n\t\tconst subscribers = this.#subscribers.get(cacheKey)\n\t\tfor (const subscriber of subscribers ?? []) {\n\t\t\tsubscriber()\n\t\t}\n\n\t\tconst resolvedValue = resolveFetchDataValue(result, request)\n\t\tif (request.resultOutputType === ControlType.Image && isString(resolvedValue)) {\n\t\t\t// Image preloads that result in an error are ignored.\n\t\t\tawait preloadImage(resolvedValue).catch(noop)\n\t\t}\n\n\t\treturn resolvedValue\n\t}\n\n\tasync fetchWithCache(request: Pick<FetchRequestConfig, \"url\" | \"cacheDuration\" | \"credentials\">) {\n\t\t// Fetches are not performed in SSG and render with fallback.\n\t\tif (!isBrowser()) return\n\n\t\tconst cacheKey = getRequestCacheKey(request)\n\n\t\tconst ongoingFetch = this.#ongoingFetches.get(cacheKey)\n\t\tif (ongoingFetch) return ongoingFetch\n\n\t\tconst cachedAt = this.#cachedAt.get(cacheKey)\n\t\tconst hasExpiredCache = cachedAt && isCacheExpired(cachedAt, request.cacheDuration)\n\t\tif (this.responseValues.has(cacheKey) && !hasExpiredCache) {\n\t\t\treturn\n\t\t}\n\n\t\tconst currentValue = this.responseValues.get(cacheKey)\n\t\tif (!currentValue) {\n\t\t\tthis.setResponseValue(cacheKey, loadingFetchResult)\n\t\t}\n\n\t\tconst doFetch = async () => {\n\t\t\ttry {\n\t\t\t\tconst response = await fetch(request.url, {\n\t\t\t\t\tmethod: \"GET\",\n\t\t\t\t\tcredentials: request.credentials,\n\t\t\t\t})\n\t\t\t\tif (!response.ok) {\n\t\t\t\t\tthis.setResponseValue(cacheKey, {\n\t\t\t\t\t\tstatus: \"error\",\n\t\t\t\t\t\terror: new Error(\"Invalid Response Status\"),\n\t\t\t\t\t\tdata: undefined,\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tconst value = await response.json()\n\n\t\t\t\tthis.setResponseValue(cacheKey, { status: \"success\", data: value })\n\t\t\t\tthis.#cachedAt.set(cacheKey, Date.now())\n\t\t\t} catch (error) {\n\t\t\t\tthis.setResponseValue(cacheKey, { status: \"error\", error, data: undefined })\n\t\t\t}\n\t\t}\n\n\t\tconst promise = doFetch()\n\t\tthis.#ongoingFetches.set(cacheKey, promise)\n\n\t\tvoid promise.finally(() => {\n\t\t\tthis.#ongoingFetches.delete(cacheKey)\n\t\t})\n\n\t\treturn promise\n\t}\n\n\tgetValue(cacheKey: RequestCacheKey, onlyIfPrefetched = false) {\n\t\tif (onlyIfPrefetched && !this.#preloadedRequests.has(cacheKey)) return undefined\n\t\treturn this.responseValues.get(cacheKey)\n\t}\n\n\tsubscribe(request: FetchRequestConfig, callback: VoidFunction, skipFetchRequest = false) {\n\t\tconst { url, cacheDuration } = request\n\t\tif (!isValidURL(url, false)) return noop\n\n\t\tconst cacheKey = getRequestCacheKey(request)\n\n\t\t// In the UI it is possible to have different cache durations for the same URL.\n\t\t// We will use the shortest duration for the cache.\n\t\tconst cacheDurationForUrl = this.#shortestCacheDurations.get(cacheKey)\n\t\tif (!cacheDurationForUrl || cacheDuration < cacheDurationForUrl) {\n\t\t\tthis.#shortestCacheDurations.set(cacheKey, cacheDuration)\n\t\t}\n\n\t\tif (!skipFetchRequest) {\n\t\t\tthis.startQueryRefetching(request)\n\t\t\tvoid this.fetchWithCache(request)\n\t\t}\n\n\t\tconst subscribers = this.#subscribers.get(cacheKey) ?? new Set<VoidFunction>()\n\t\tsubscribers.add(callback)\n\t\tthis.#subscribers.set(cacheKey, subscribers)\n\n\t\treturn () => {\n\t\t\tconst nextSubscribers = this.#subscribers.get(cacheKey)\n\t\t\tif (!nextSubscribers) return\n\n\t\t\tnextSubscribers.delete(callback)\n\t\t\tif (nextSubscribers.size === 0) {\n\t\t\t\tthis.#subscribers.delete(cacheKey)\n\t\t\t}\n\n\t\t\tif (this.#subscribers.size === 0) {\n\t\t\t\tthis.stopQueryRefetching(request)\n\t\t\t}\n\t\t}\n\t}\n}\n\nconst FetchClientContext = /** @__PURE__ */ React.createContext<FetchClient | undefined>(undefined)\nconst IsRestoringCacheContext = /** @__PURE__ */ React.createContext<boolean>(true)\n\nexport const FetchClientProvider = /** @__PURE__ */ ({\n\tchildren,\n\tclient: initialClient,\n}: PropsWithChildren<{ client?: FetchClient }>) => {\n\tconst [client] = React.useState(() => initialClient ?? new FetchClient())\n\tconst [isRestoring, setIsRestoring] = React.useState(true)\n\tReact.useEffect(() => {\n\t\tclient.hydrateCache()\n\n\t\tReact.startTransition(() => {\n\t\t\tsetIsRestoring(false)\n\t\t})\n\t\treturn () => client.unmount()\n\t}, [client])\n\n\treturn (\n\t\t<IsRestoringCacheContext.Provider value={isRestoring}>\n\t\t\t<FetchClientContext.Provider value={client}>{children}</FetchClientContext.Provider>\n\t\t</IsRestoringCacheContext.Provider>\n\t)\n}\n\ninterface RequestsObserverResult {\n\tstatus: FetchResult[\"status\"]\n\tdata: unknown[]\n}\n\ninterface SetRequestsOptions {\n\tonlyPrefetched?: boolean\n}\n\n/**\n * The RequestsObserver is used to track the state of a list of fetch requests.\n * It combines the results into a stable identity and notifies subscribers when\n * any of the requests changee.\n */\nexport class RequestsObserver {\n\t// a map of subscriptions on the FetchClient\n\t#subscriptions: Map<RequestCacheKey, VoidFunction> = new Map()\n\n\t// A set of subscribers to requests of the observer\n\t#subscribers: Set<VoidFunction> = new Set()\n\n\t// The results of the susbcribed requests\n\t#results: RequestsObserverResult\n\n\t// getServerSnapshot is also called on the Client while the tree is hydrating.\n\t// It is important to always return the same value or hydration warnings will occur.\n\treadonly #SSRResults: RequestsObserverResult\n\n\t// When the RequestsObserver mounts we allow reading prefetched values.\n\t// This is to support Text FX on mount for requests that were prefetched.\n\t#onlyPrefetched = true\n\n\tconstructor(\n\t\tprivate client: FetchClient,\n\t\tprivate requests: FetchRequestConfig[],\n\t) {\n\t\tthis.setRequests(requests, { onlyPrefetched: true })\n\n\t\tthis.#SSRResults = { status: \"loading\", data: requests.map(request => request.fallbackValue) }\n\t\tthis.#results = this.#SSRResults\n\t}\n\n\tsetRequests(requests: FetchRequestConfig[], { onlyPrefetched = false }: SetRequestsOptions) {\n\t\tconst lastRequests = this.requests\n\t\tthis.requests = requests\n\t\tconst requestsByCacheKey = new Map(requests.map(request => [getRequestCacheKey(request), request]))\n\t\tconst nextSubscribedKeys = Array.from(requestsByCacheKey.keys())\n\n\t\tconst hasOnlyPrefetchedChange = this.#onlyPrefetched !== onlyPrefetched\n\t\tif (!onlyPrefetched) this.#onlyPrefetched = false\n\n\t\tconst hasSubscriptionChange =\n\t\t\tnextSubscribedKeys.length !== this.#subscriptions.size ||\n\t\t\tnextSubscribedKeys.some(url => !this.#subscriptions.has(url))\n\n\t\tif (!hasSubscriptionChange && !hasOnlyPrefetchedChange) {\n\t\t\t// In the canvas context it is possible that fallback values change.\n\t\t\t// In those cases we want to call getSnapshot again to resolve values with new fallback values\n\t\t\tif (!isEqual(lastRequests, requests)) {\n\t\t\t\tthis.updateResults()\n\t\t\t}\n\n\t\t\treturn\n\t\t}\n\n\t\tfor (const url of this.#subscriptions.keys()) {\n\t\t\tthis.#subscriptions.get(url)?.()\n\t\t\tthis.#subscriptions.delete(url)\n\t\t}\n\n\t\tfor (const cacheKey of nextSubscribedKeys) {\n\t\t\tconst requestConfig = requestsByCacheKey.get(cacheKey)\n\t\t\tif (!requestConfig) continue\n\n\t\t\tconst unsubscribe = this.client.subscribe(requestConfig, this.updateResults, onlyPrefetched)\n\t\t\tthis.#subscriptions.set(cacheKey, unsubscribe)\n\t\t}\n\n\t\tif (this.#subscribers.size === 0) return\n\n\t\tthis.updateResults()\n\t}\n\n\tupdateResults = () => {\n\t\tconst data: unknown[] = []\n\t\tconst statuses = new Set()\n\t\tconst errors: unknown[] = []\n\n\t\tfor (const request of this.requests) {\n\t\t\tconst cachekey = getRequestCacheKey(request)\n\n\t\t\tconst value = this.client.getValue(cachekey, this.#onlyPrefetched)\n\t\t\tif (!value) {\n\t\t\t\tstatuses.add(\"loading\")\n\t\t\t\tdata.push(request.fallbackValue)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tstatuses.add(value.status)\n\n\t\t\ttry {\n\t\t\t\tconst resolvedValue = resolveFetchDataValue(value, request)\n\t\t\t\tdata.push(resolvedValue)\n\t\t\t} catch (error) {\n\t\t\t\tdata.push(!isUndefined(request.errorFallbackValue) ? request.errorFallbackValue : request.fallbackValue)\n\t\t\t\terrors.push(error)\n\t\t\t}\n\t\t}\n\n\t\tconst status = statuses.has(\"error\") ? \"error\" : statuses.has(\"loading\") ? \"loading\" : \"success\"\n\t\tconst result: RequestsObserverResult = { status: status, data: data }\n\n\t\tif (!isEqual(result, this.#results)) {\n\t\t\tthis.#results = result\n\n\t\t\tif (errors.length > 0 && !statuses.has(\"loading\") && this.#subscribers.size > 0) {\n\t\t\t\t// biome-ignore lint/suspicious/noConsole: Users want to see fetch errors in the console.\n\t\t\t\tconsole.error(\"Fetch failed: \" + errors.join(\"\\n\"))\n\t\t\t}\n\t\t}\n\n\t\tfor (const subscriber of this.#subscribers) {\n\t\t\tsubscriber()\n\t\t}\n\t}\n\n\tunmount() {\n\t\tfor (const unsubscribe of this.#subscribers) {\n\t\t\tunsubscribe()\n\t\t}\n\n\t\tfor (const unsubscribe of this.#subscriptions.values()) {\n\t\t\tunsubscribe()\n\t\t}\n\t}\n\n\tsubscribe = (callback: VoidFunction) => {\n\t\tthis.#subscribers.add(callback)\n\n\t\tthis.updateResults()\n\n\t\treturn () => {\n\t\t\tthis.#subscribers.delete(callback)\n\t\t}\n\t}\n\n\tgetServerResults = () => {\n\t\treturn this.#SSRResults\n\t}\n\n\tgetResults = () => {\n\t\treturn this.#results\n\t}\n}\n\nexport const testing = {\n\tRequestsObserver,\n}\n\nexport interface FetcherProps {\n\trequests: FetchRequestConfig[]\n\tdisabled?: boolean\n\tchildren: (resolvedValues: unknown[], status: FetchResult[\"status\"]) => React.ReactElement\n}\n\nexport function useFetchRequestsForChildren(\n\trequests: FetcherProps[\"requests\"],\n\tdisabled: FetcherProps[\"disabled\"],\n\tchildren: FetcherProps[\"children\"],\n) {\n\tconst fetchClient = React.useContext(FetchClientContext)\n\tif (!fetchClient) {\n\t\tthrow new Error(\"useFetchRequest must be used within a FetchClientProvider\")\n\t}\n\tconst isRestoringCache = React.useContext(IsRestoringCacheContext)\n\tconst [observer] = React.useState(() => new RequestsObserver(fetchClient, requests))\n\n\tReact.useLayoutEffect(() => {\n\t\tif (disabled) return\n\n\t\t// Mainly in the Canvas can request configurations change, for example\n\t\t// fallback values may be updated. This ensures that the component\n\t\t// rerenders with these new values. It also ensures that Fetches that\n\t\t// were not prefetched are only kicked off after the component is\n\t\t// mounted.\n\t\tobserver.setRequests(requests, { onlyPrefetched: false })\n\t}, [requests, observer, disabled])\n\n\tReact.useEffect(() => {\n\t\treturn () => observer.unmount()\n\t}, [observer])\n\n\tconst subscribe = React.useCallback(\n\t\t(onChange: VoidFunction) => {\n\t\t\t// When the observer is restoring cache we don't yet subscribe to\n\t\t\t// any actual values The reason is that during hydration we don't\n\t\t\t// want to receive values from localStorage cache As values changes\n\t\t\t// during hydration will cause hydration warnings Also when the\n\t\t\t// observer is disabled from the outside (such as inside loading\n\t\t\t// variants) we don't subscribe to any values and will always return\n\t\t\t// the fallback value\n\t\t\t//\n\t\t\t// NOTE: Text Effects will not work on Fetches that have a cache\n\t\t\t// time and do not have a loading variant. The recommendation in\n\t\t\t// this case is to use a component with a loading variant. The\n\t\t\t// reason being that we cannot support this without causing\n\t\t\t// hydration errors as the initial render will always be with the fallback value.\n\t\t\tif (isRestoringCache || disabled) return noop\n\n\t\t\treturn observer.subscribe(onChange)\n\t\t},\n\t\t[disabled, observer, isRestoringCache],\n\t)\n\n\tconst synchronousData = React.useSyncExternalStore(subscribe, observer.getResults, observer.getServerResults)\n\tconst deferredData = React.useDeferredValue(synchronousData)\n\n\t// The memo ensures any consumer of the hook only re-renders when the deferred value changes,\n\t// so its rendering is concurrent (suspense safe) even though it depends on an external store.\n\treturn useMemoOne(() => children(deferredData.data, deferredData.status), [deferredData, children])\n}\n\nexport function usePrefetch() {\n\tconst fetchClient = React.useContext(FetchClientContext)\n\tif (!fetchClient) {\n\t\tthrow new Error(\"useFetchRequest must be used within a FetchClientProvider\")\n\t}\n\n\treturn React.useCallback((request: FetchRequestConfig) => fetchClient.prefetch(request), [fetchClient])\n}\n", "/** @internal */\nexport function preloadImage(url: string): Promise<void> {\n\treturn new Promise<void>((resolve, reject) => {\n\t\ttry {\n\t\t\t// Don't attempt to preload images that are not valid URLs.\n\t\t\tnew URL(url)\n\n\t\t\tconst image = new Image()\n\n\t\t\timage.onload = () => resolve()\n\t\t\timage.onerror = reject\n\t\t\timage.src = url\n\t\t} catch (error) {\n\t\t\treject(error)\n\t\t}\n\t})\n}\n", "function isObjectOrArray(value: unknown): value is Record<string, unknown> | unknown[] {\n\treturn typeof value === \"object\" && value !== null\n}\n\nexport function getPropertyByPath(input: unknown, keyPath: string): unknown {\n\tif (keyPath === \"\") {\n\t\treturn input\n\t}\n\n\t// Splits a string like foo.bar[0].baz into [\"foo\", \"bar\", \"0\", \"baz\"]\n\tconst keyParts = keyPath.split(/[.[\\]]+/u).filter(part => part.length > 0)\n\n\tlet current = input\n\tfor (const part of keyParts) {\n\t\tif (!isObjectOrArray(current)) {\n\t\t\treturn undefined\n\t\t}\n\n\t\tcurrent = (current as Record<string, unknown>)[part]\n\t}\n\n\treturn current\n}\n", "import type { ReactElement } from \"react\"\nimport { forwardRef } from \"react\"\nimport { useCloneChildrenWithPropsAndRef } from \"../components/utils/useCloneChildrenWithPropsAndRef.tsx\"\nimport { useRouter } from \"../router/RouterContext.tsx\"\nimport { useLocaleInfo } from \"../router/useLocale.ts\"\nimport { isObject, isString } from \"../utils/utils.ts\"\nimport { withChildrenCanSuspend } from \"./ChildrenCanSuspend.tsx\"\nimport { resolveLinkInternal } from \"./Link/resolveLink.ts\"\nimport { useResolveSlugsWithSuspense } from \"./Link/resolveSlugs.ts\"\nimport type { LinkToWebPage } from \"./LinkToWebPage.ts\"\nimport { isLinkToWebPage } from \"./LinkToWebPage.ts\"\n\nexport interface UnresolvedLink {\n\thref: string | LinkToWebPage\n\timplicitPathVariables?: Record<string, unknown>\n\t/**\n\t * An UnresolvedLink that is a scroll target ref key will only resole the\n\t * hash.\n\t */\n\trefKey?: true\n}\nconst hrefKey = \"href\" satisfies keyof UnresolvedLink\nexport function isUnresolvedLink(value: unknown): value is UnresolvedLink {\n\tif (!isObject(value)) return false\n\treturn hrefKey in value && isLinkToWebPage(value.href)\n}\n\ninterface ResolveLinksProps {\n\tlinks: (UnresolvedLink | string | undefined)[]\n\tchildren: (resolvedLinks: (string | undefined)[]) => ReactElement\n}\n\n/**\n * The ResolveLinks component is given an array of links that have unresolved\n * slug values. The component is responsible for loading the slug values in\n * parallel and suspending until all the values are resolved.\n *\n * During code generation, all links with unresolved slugs will be collected\n * separately and wrapped into a ResolveLinks component. A function as child\n * pattern is used to provide a binding to access the resolved versions of the\n * links.\n * @public\n */\nexport const ResolveLinks = /* @__PURE__ */ withChildrenCanSuspend<unknown, ResolveLinksProps>(\n\t/* @__PURE__ */\n\tforwardRef(function ResolveLinksInner({ links, children, ...rest }: ResolveLinksProps, ref) {\n\t\tconst router = useRouter()\n\t\tconst { activeLocale } = useLocaleInfo()\n\t\tconst cloneWithPropsAndRef = useCloneChildrenWithPropsAndRef(ref)\n\t\tconst resolveSlugsWithSuspense = useResolveSlugsWithSuspense()\n\n\t\tconst promises: Promise<string | undefined>[] = []\n\n\t\tconst resolvedLinks = links.map(link => {\n\t\t\tif (!link) return undefined\n\t\t\tif (isString(link)) return resolveLinkInternal(link, router, undefined, undefined, activeLocale)\n\n\t\t\treturn resolveLinkInternal(\n\t\t\t\tlink.href,\n\t\t\t\trouter,\n\t\t\t\tlink.implicitPathVariables,\n\t\t\t\tlink.refKey,\n\t\t\t\tactiveLocale,\n\t\t\t\t(unresolvedPathSlugs, unresolvedHashSlugs) => {\n\t\t\t\t\treturn resolveSlugsWithSuspense(unresolvedPathSlugs, unresolvedHashSlugs, activeLocale, promises)\n\t\t\t\t},\n\t\t\t)\n\t\t})\n\n\t\tif (promises.length > 0) {\n\t\t\tthrow Promise.allSettled(promises)\n\t\t}\n\n\t\tconst childrenWithLinks = children(resolvedLinks)\n\n\t\treturn cloneWithPropsAndRef(childrenWithLinks, rest)\n\t}),\n)\n", "import * as React from \"react\"\nimport { useCloneChildrenWithPropsAndRef } from \"../components/utils/useCloneChildrenWithPropsAndRef.tsx\"\nimport type { FetcherProps } from \"./FetchClient.tsx\"\nimport { useFetchRequestsForChildren } from \"./FetchClient.tsx\"\n\nexport const Fetcher = /* @__PURE__ */ React.forwardRef(function Fetcher(\n\t{ requests, disabled, children, ...rest }: FetcherProps,\n\tref,\n) {\n\tconst cloneWithPropsAndRef = useCloneChildrenWithPropsAndRef(ref)\n\tconst childrenWithValues = useFetchRequestsForChildren(requests, disabled, children)\n\treturn cloneWithPropsAndRef(childrenWithValues, rest)\n})\n", "/**\n * @internal\n */\nexport const callEach = (...fns: (Function | undefined)[]) => fns.forEach(fn => fn && fn())\n", "import { assert } from \"../../../utils/assert.ts\"\nimport { isGenerator } from \"../../../utils/utils.ts\"\n\n/**\n * Most of our scalar and relational nodes can be evaluated synchronously. To\n * avoid wrapping everything in promises, we use generators to evaluate nodes.\n * Nodes can be evaluated synchronously, unless they yield a promise. If they\n * yield a promise, we await it and return the result back to the caller. In our\n * experiments, generators are up to 80x faster than async functions for\n * synchronous nodes. The alternative would be to use callbacks everywhere, but\n * that makes the code a lot harder to read and understand.\n */\n// biome-ignore lint/suspicious/noExplicitAny: Unfortunately TypeScript doesn't allow us to type this better.\nexport type Evaluate<Value = unknown> = Generator<unknown, Value, any>\n\ntype MaybeEvaluate<Value = unknown> = Value | Evaluate<Value>\n\ntype UnboxValue<Value> = Value extends Evaluate<infer Return> ? Return : Value\n\ntype Evaluated<Values> = {\n\t[Key in keyof Values]: UnboxValue<Values[Key]>\n}\n\n/**\n * Runs a generator and returns the final value. Throws an error if the\n * generator yields.\n */\nexport function evaluateSync<Value>(generator: Evaluate<Value>) {\n\tconst state = generator.next()\n\tassert(state.done, \"Generator must not yield\")\n\treturn state.value\n}\n\n/**\n * Runs a generator and returns the final value. Any value yielded by the\n * generator will be awaited and returned to the generator.\n */\nexport async function evaluateAsync<Value>(generator: Evaluate<Value>, state = generator.next()) {\n\twhile (!state.done) {\n\t\tconst value = await state.value\n\t\tstate = generator.next(value)\n\t}\n\n\treturn state.value\n}\n\n/**\n * Runs a generator and returns the final value. Returns a promise if the generator yields.\n * Otherwise returns the final value directly.\n */\nexport function evaluateMaybeAsync<Value>(generator: Evaluate<Value>) {\n\tconst state = generator.next()\n\tif (state.done) return state.value\n\n\treturn evaluateAsync(generator, state)\n}\n\n/**\n * Runs multiple generators inside an object concurrently and returns a new\n * object with the returned values.\n */\nexport function* evaluateObject<Values extends Record<string, MaybeEvaluate>>(values: Values) {\n\tconst result: Record<string, unknown> = {}\n\n\tconst keys = Object.keys(values)\n\tconst promises: Promise<unknown>[] = []\n\n\tfor (const key of keys) {\n\t\tconst generator = values[key]\n\n\t\tif (isGenerator(generator)) {\n\t\t\tconst state = generator.next()\n\n\t\t\tif (state.done) {\n\t\t\t\tresult[key] = state.value\n\t\t\t} else {\n\t\t\t\tpromises.push(\n\t\t\t\t\tevaluateAsync(generator, state).then(value => {\n\t\t\t\t\t\tresult[key] = value\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t}\n\t\t} else {\n\t\t\tresult[key] = generator\n\t\t}\n\t}\n\n\tif (promises.length > 0) {\n\t\tyield Promise.all(promises)\n\t}\n\n\treturn result as Evaluated<Values>\n}\n\n/**\n * Runs multiple generators inside an array concurrently and returns a new array\n * with the returned values.\n */\nexport function* evaluateArray<Values extends MaybeEvaluate[]>(values: Values) {\n\tconst result: unknown[] = []\n\n\tconst keys = values.keys()\n\tconst promises: Promise<unknown>[] = []\n\n\tfor (const key of keys) {\n\t\tconst generator = values[key]\n\n\t\tif (isGenerator(generator)) {\n\t\t\tconst state = generator.next()\n\n\t\t\tif (state.done) {\n\t\t\t\tresult[key] = state.value\n\t\t\t} else {\n\t\t\t\tpromises.push(\n\t\t\t\t\tevaluateAsync(generator, state).then(value => {\n\t\t\t\t\t\tresult[key] = value\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t}\n\t\t} else {\n\t\t\tresult[key] = generator\n\t\t}\n\t}\n\n\tif (promises.length > 0) {\n\t\tyield Promise.all(promises)\n\t}\n\n\treturn result as Evaluated<Values>\n}\n", "import type { ReactNode } from \"react\"\nimport type { Locale } from \"../../router/types.ts\"\nimport { isArray, isFunction, isObject } from \"../../utils/utils.ts\"\nimport type { DatabaseValue } from \"./DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"./DatabaseValueDefinition.ts\"\n\n/**\n * This file defines query types to query the CMS. The query is defined in an\n * AST form of the SQLite select statement https://sqlite.org/lang_select.html.\n *\n * Currently, not every feature is implemented. When implementing a new feature\n * it's best to look at the SQLite documentation and add the necessary AST\n * nodes.\n *\n * Features that are not supported by SQLite can be implemented by using a\n * function call. For example STARTS_WITH(title, \"Hello\"), ENDS_WITH(title,\n * \"world\"), and CONTAINS(answer, \"42\").\n *\n * WARNING: The types in this file have to be backwards compatible. The types\n * are used by code generation inside GeneratedCollection.ts and\n * serializeDatabase.ts. This means that if we change the types and the code\n * generation we still have to be able to read the old types because the\n * generated code is only updated after a change to the CMS.\n */\n\n/**\n * An identifier that can be resolved within a specific context. Currently, only\n * fields (columns) of an item (row) can be resolved:\n * - id\n * - name\n * - title\n */\nexport interface Identifier {\n\ttype: \"Identifier\"\n\t// There is a special identifier called \"index\" that contains the index of a\n\t// node in the collection.\n\tname: string\n\tcollection?: string\n}\n\n/**\n * A literal value:\n * - true\n * - \"string\"\n * - 123\n */\nexport interface LiteralValue {\n\ttype: \"LiteralValue\"\n\tvalue: unknown\n}\n\n/**\n * A function call:\n * - STARTS_WITH(title, \"Hello\")\n * - ENDS_WITH(title, \"world\")\n * - CONTAINS(name, \"Smith\")\n */\nexport interface FunctionCall {\n\ttype: \"FunctionCall\"\n\tfunctionName: string\n\targuments: Expression[]\n}\n\nexport enum FunctionName {\n\tContains = \"CONTAINS\",\n\tStartsWith = \"STARTS_WITH\",\n\tEndsWith = \"ENDS_WITH\",\n\tLength = \"LENGTH\",\n\tIndexOf = \"INDEX_OF\",\n\tArray = \"ARRAY\",\n\tFlatArray = \"FLAT_ARRAY\",\n\tIntersect = \"INTERSECT\",\n}\n\n/**\n * A case expression:\n * CASE city\n *   WHEN \"Amsterdam\" THEN 921402\n *   WHEN \"Berlin\" THEN 3677472\n *   ELSE 0\n * END\n */\nexport interface Case {\n\ttype: \"Case\"\n\tvalue?: Expression\n\tconditions: Condition[]\n\telse?: Expression\n}\n\nexport interface Condition {\n\ttype: \"Condition\"\n\twhen: Expression\n\tthen: Expression\n}\n\n/**\n * A unary operation:\n * - NOT true\n * - NOT featured\n */\nexport interface UnaryOperation {\n\ttype: \"UnaryOperation\"\n\toperator: UnaryOperator\n\tvalue: Expression\n}\n\nexport enum UnaryOperator {\n\tNot = \"not\",\n}\n\n/**\n * A binary operation:\n * - true AND true\n * - true OR false\n * - true == true.\n * - 13.37 < 1337\n */\nexport interface BinaryOperation {\n\ttype: \"BinaryOperation\"\n\toperator: BinaryOperator\n\tleft: Expression\n\tright: Expression\n}\n\nexport enum BinaryOperator {\n\tAnd = \"and\",\n\tOr = \"or\",\n\tEquals = \"==\",\n\tNotEquals = \"!=\",\n\tLessThan = \"<\",\n\tLessThanOrEqual = \"<=\",\n\tGreaterThan = \">\",\n\tGreaterThanOrEqual = \">=\",\n\tIn = \"in\",\n}\n\n/**\n * A type cast:\n * - CAST(0 as BOOLEAN)\n * - CAST(42 as STRING)\n * - CAST(\"42\" as NUMBER)\n */\nexport interface TypeCast {\n\ttype: \"TypeCast\"\n\tdataType: string\n\tvalue: Expression\n}\n\nexport enum DataType {\n\tBoolean = \"BOOLEAN\",\n\tDate = \"DATE\",\n\tNumber = \"NUMBER\",\n\tString = \"STRING\",\n}\n\nexport type Expression =\n\t| Identifier\n\t| LiteralValue\n\t| FunctionCall\n\t| Case\n\t| UnaryOperation\n\t| BinaryOperation\n\t| TypeCast\n\t| Select\n\nexport type SelectExpression = Expression & {\n\talias?: string\n}\n\nexport enum OrderDirection {\n\tAscending = \"asc\",\n\tDescending = \"desc\",\n}\n\nexport type OrderExpression = Expression & {\n\tdirection?: OrderDirection\n}\n\nexport type AnyCollection = AnyLegacyCollection | AnyDatabaseCollection\n\nexport function isAnyCollection(value: unknown): value is AnyCollection {\n\treturn isAnyLegacyCollection(value) || isAnyDatabaseCollection(value)\n}\n\nexport interface Collection {\n\ttype: \"Collection\"\n\tdata: AnyCollection\n\talias?: string\n}\n\nexport interface Join {\n\ttype: /* \"Join\" | */ \"LeftJoin\" /* | \"RightJoin\" | \"FullJoin\" */\n\tleft: From\n\tright: From\n\tconstraint: Expression\n}\n\nexport type From = Collection | Join\n\nexport interface Select {\n\ttype: \"Select\"\n\tfrom: From\n\tselect: SelectExpression[]\n\twhere?: Expression\n\torderBy?: OrderExpression[]\n\tlimit?: Expression\n\toffset?: Expression\n}\n\nexport type Query = Omit<Select, \"type\">\n\n// Legacy Collections\n\nexport type LegacyCollectionItem = Record<string, unknown>\nexport type LegacyCollectionItems = LegacyCollectionItem[]\n\nexport type LegacyCollection = LegacyCollectionItems & {\n\tdisplayName: string\n}\n\nexport function isLegacyCollection(value: unknown): value is LegacyCollection {\n\treturn isArray(value) && value.every(isObject)\n}\n\nexport interface LegacyLocalizedCollection {\n\tread(locale?: Locale | null): LegacyCollectionItems\n\tpreload(locale?: Locale | null): Promise<void> | undefined\n\tdisplayName: string\n}\n\nexport function isLegacyLocalizedCollection(value: unknown): value is LegacyLocalizedCollection {\n\treturn isObject(value) && isFunction(value.read) && isFunction(value.preload)\n}\n\nexport type AnyLegacyCollection = LegacyCollection | LegacyLocalizedCollection\n\nexport function isAnyLegacyCollection(value: unknown): value is AnyLegacyCollection {\n\treturn isLegacyCollection(value) || isLegacyLocalizedCollection(value)\n}\n\n// Database Collections\n\nexport type DatabaseItemPointer = string\nexport type DatabaseRichTextPointer = unknown\nexport type DatabaseVectorSetItemPointer = unknown\n\nexport interface DatabaseItem {\n\treadonly pointer: DatabaseItemPointer\n\t// This is a partial data item. It doesn't necessarily contain all the\n\t// fields of the item. E.g. an index will only fill out the fields that are\n\t// contained in the index.\n\treadonly data: Record<string, DatabaseValue>\n}\n\nexport interface DatabaseSchema {\n\treadonly [name: string]: DatabaseValueDefinition\n}\n\nexport enum DatabaseCollationType {\n\tCaseInsensitive = 0,\n\tCaseSensitive = 1,\n}\n\nexport type DatabaseCollation =\n\t| {\n\t\t\treadonly type: DatabaseCollationType.CaseSensitive\n\t  }\n\t| {\n\t\t\treadonly type: DatabaseCollationType.CaseInsensitive\n\t  }\n\n// TODO: How to handle null values?\nexport enum DatabaseIndexLookupType {\n\tAll = \"All\",\n\tEquals = \"Equals\",\n\tNotEquals = \"NotEquals\",\n\tLessThan = \"LessThan\",\n\tGreaterThan = \"GreaterThan\",\n\tContains = \"Contains\",\n\tStartsWith = \"StartsWith\",\n\tEndsWith = \"EndsWith\",\n}\n\nexport interface DatabaseIndexLookupAll {\n\treadonly type: DatabaseIndexLookupType.All\n}\n\nexport interface DatabaseIndexLookupEquals {\n\treadonly type: DatabaseIndexLookupType.Equals\n\treadonly value: DatabaseValue\n}\n\nexport interface DatabaseIndexLookupNotEquals {\n\treadonly type: DatabaseIndexLookupType.NotEquals\n\treadonly value: DatabaseValue\n}\n\nexport interface DatabaseIndexLookupLessThan {\n\treadonly type: DatabaseIndexLookupType.LessThan\n\treadonly value: DatabaseValue\n\treadonly inclusive: boolean\n}\n\nexport interface DatabaseIndexLookupGreaterThan {\n\treadonly type: DatabaseIndexLookupType.GreaterThan\n\treadonly value: DatabaseValue\n\treadonly inclusive: boolean\n}\n\nexport interface DatabaseIndexLookupContains {\n\treadonly type: DatabaseIndexLookupType.Contains\n\treadonly value: DatabaseValue\n}\n\nexport interface DatabaseIndexLookupStartsWith {\n\treadonly type: DatabaseIndexLookupType.StartsWith\n\treadonly value: DatabaseValue\n}\n\nexport interface DatabaseIndexLookupEndsWith {\n\treadonly type: DatabaseIndexLookupType.EndsWith\n\treadonly value: DatabaseValue\n}\n\nexport type DatabaseIndexLookup =\n\t| DatabaseIndexLookupAll\n\t| DatabaseIndexLookupEquals\n\t| DatabaseIndexLookupNotEquals\n\t| DatabaseIndexLookupLessThan\n\t| DatabaseIndexLookupGreaterThan\n\t| DatabaseIndexLookupContains\n\t| DatabaseIndexLookupStartsWith\n\t| DatabaseIndexLookupEndsWith\n\nexport interface DatabaseIndex {\n\t/**\n\t * The schema of the fields that are populated on each `DatabaseItem` by\n\t * `lookupItems`. This has to be a subset of `DatabaseCollection.schema`.\n\t */\n\treadonly schema: DatabaseSchema\n\t/**\n\t * The fields that are stored in the index. Lookup queries can query the\n\t * index based on these fields.\n\t */\n\treadonly fields: Expression[]\n\t/**\n\t * Additional constraints that are applied to the index. E.g an index that\n\t * contains the name of all authors from Amsterdam, would have `fields` set\n\t * to [`name`] and `where` set to `city == 'Amsterdam'`.\n\t */\n\treadonly where?: Expression\n\t/**\n\t * The order that items are returned from `lookupItems`. If the field is\n\t * empty the order is not deterministic.\n\t */\n\treadonly orderBy?: OrderExpression[]\n\t/**\n\t * Different indexes support different lookup types. Dictionary indexes\n\t * support all lookup types but future indexes might only support a subset.\n\t */\n\treadonly supportedLookupTypes: DatabaseIndexLookupType[]\n\t/**\n\t * Returns all items that match the given query. The query needs to be the\n\t * same length as the `fields` array.\n\t */\n\tlookupItems(query: DatabaseIndexLookup[]): Promise<DatabaseItem[]>\n}\n\nexport interface DatabaseCollection {\n\treadonly id?: string\n\t/**\n\t * The schema of the DatabaseItem that is returned by `scanItems` and\n\t * `resolveItems`.\n\t */\n\treadonly schema: DatabaseSchema\n\t/**\n\t * All indexes that are available for the collection.\n\t */\n\treadonly indexes: DatabaseIndex[]\n\t/**\n\t * Resolves a rich text by its pointer. We don't directly store rich text in\n\t * the binary files.\n\t */\n\tresolveRichText(pointer: DatabaseRichTextPointer): ReactNode | Promise<ReactNode>\n\t/**\n\t * Resolves a vector set item by its pointer. We don't directly store vector\n\t * set items in the binary files.\n\t */\n\tresolveVectorSetItem?(pointer: DatabaseVectorSetItemPointer): ReactNode | Promise<ReactNode>\n\t/**\n\t * Scans the whole collection and returns all items.\n\t */\n\tscanItems(): Promise<DatabaseItem[]>\n\t/**\n\t * Returns the items at the given pointer. The returned items have to be in\n\t * the same order as the pointers.\n\t */\n\tresolveItems(pointers: DatabaseItemPointer[]): Promise<DatabaseItem[]>\n\t/**\n\t * Compares two items based on the order in the CMS.\n\t */\n\tcompareItems(left: DatabaseItem, right: DatabaseItem): number\n}\n\nexport function isDatabaseCollection(value: unknown): value is DatabaseCollection {\n\treturn isObject(value) && isObject(value.schema)\n}\n\nexport interface DatabaseCollectionByLocaleId {\n\treadonly default: DatabaseCollection\n\treadonly [localeId: string]: DatabaseCollection\n}\n\nexport interface LocalizedDatabaseCollection {\n\treadonly id?: string\n\treadonly displayName: string\n\treadonly collectionByLocaleId: DatabaseCollectionByLocaleId\n}\n\nexport function isLocalizedDatabaseCollection(value: unknown): value is LocalizedDatabaseCollection {\n\treturn isObject(value) && isObject(value.collectionByLocaleId)\n}\n\ntype AnyDatabaseCollection = DatabaseCollection | LocalizedDatabaseCollection\n\nexport function isAnyDatabaseCollection(value: unknown): value is AnyDatabaseCollection {\n\treturn isDatabaseCollection(value) || isLocalizedDatabaseCollection(value)\n}\n", "import { ControlType } from \"../../render/types/PropertyControls.ts\"\nimport { assert, assertNever } from \"../../utils/assert.ts\"\nimport { isArray, isBoolean, isNull, isNumber, isString, isValidDate } from \"../../utils/utils.ts\"\nimport type { LinkToWebPage } from \"../LinkToWebPage.ts\"\nimport type {\n\tDatabaseArrayValueDefinition,\n\tDatabaseObjectValueDefinition,\n\tDatabaseValueDefinition,\n} from \"./DatabaseValueDefinition.ts\"\nimport type { DatabaseCollation, DatabaseRichTextPointer, DatabaseVectorSetItemPointer } from \"./types.ts\"\nimport { DatabaseCollationType } from \"./types.ts\"\n\n// The types in this file are very similar to ControlProps but are used to pass\n// values from the `QueryEngine` to a collection module and back. We have to\n// wrap the values in a type because we need to be able to distinguish between a\n// string that is a date and a string that is an enum value.\n\n/**\n * DatabaseArrayValue\n */\n\nexport interface DatabaseArrayValue {\n\treadonly type: ControlType.Array\n\treadonly value: DatabaseValue[]\n}\n\nfunction compareArray(left: DatabaseArrayValue, right: DatabaseArrayValue, collation: DatabaseCollation): number {\n\tconst leftLength = left.value.length\n\tconst rightLength = right.value.length\n\n\tif (leftLength < rightLength) return -1\n\tif (leftLength > rightLength) return 1\n\n\tfor (let i = 0; i < leftLength; i++) {\n\t\t// biome-ignore lint/style/noNonNullAssertion: Guaranteed by the loop.\n\t\tconst leftItem = left.value[i]!\n\t\t// biome-ignore lint/style/noNonNullAssertion: Guaranteed by the loop.\n\t\tconst rightItem = right.value[i]!\n\n\t\tconst result = compare(leftItem, rightItem, collation)\n\t\tif (result !== 0) return result\n\t}\n\n\treturn 0\n}\n\nfunction castArray(value: DatabaseValue, definition: DatabaseArrayValueDefinition): DatabaseArrayValue | null {\n\tswitch (value?.type) {\n\t\tcase ControlType.Array: {\n\t\t\tconst result = value.value.map(item => {\n\t\t\t\treturn DatabaseValue.cast(item, definition.definition)\n\t\t\t})\n\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Array,\n\t\t\t\tvalue: result,\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null\n}\n\n/**\n * DatabaseBooleanValue\n */\n\nexport interface DatabaseBooleanValue {\n\treadonly type: ControlType.Boolean\n\treadonly value: boolean\n}\n\nfunction compareBoolean(left: DatabaseBooleanValue, right: DatabaseBooleanValue): number {\n\tif (left.value < right.value) return -1\n\tif (left.value > right.value) return 1\n\treturn 0\n}\n\nfunction castBoolean(value: DatabaseValue): DatabaseBooleanValue | null {\n\tswitch (value?.type) {\n\t\tcase ControlType.Boolean: {\n\t\t\treturn value\n\t\t}\n\n\t\tcase ControlType.Number:\n\t\tcase ControlType.String: {\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Boolean,\n\t\t\t\tvalue: Boolean(value.value),\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null\n}\n\nexport function valueToBoolean(value: DatabaseValue) {\n\tconst cast = castBoolean(value)\n\treturn cast?.value ?? false\n}\n\n/**\n * DatabaseColorValue\n */\n\nexport interface DatabaseColorValue {\n\treadonly type: ControlType.Color\n\treadonly value: string\n}\n\nfunction compareColor(left: DatabaseColorValue, right: DatabaseColorValue): number {\n\tif (left.value < right.value) return -1\n\tif (left.value > right.value) return 1\n\treturn 0\n}\n\nfunction castColor(value: DatabaseValue): DatabaseColorValue | null {\n\tswitch (value?.type) {\n\t\tcase ControlType.Color: {\n\t\t\treturn value\n\t\t}\n\t}\n\n\treturn null\n}\n\n/**\n * DatabaseDateValue\n */\n\nexport interface DatabaseDateValue {\n\treadonly type: ControlType.Date\n\treadonly value: string\n}\n\nfunction compareDate(left: DatabaseDateValue, right: DatabaseDateValue): number {\n\tconst leftDate = new Date(left.value)\n\tconst rightDate = new Date(right.value)\n\tif (leftDate < rightDate) return -1\n\tif (leftDate > rightDate) return 1\n\treturn 0\n}\n\nfunction castDate(value: DatabaseValue): DatabaseDateValue | null {\n\tswitch (value?.type) {\n\t\tcase ControlType.Date: {\n\t\t\treturn value\n\t\t}\n\n\t\tcase ControlType.Number:\n\t\tcase ControlType.String: {\n\t\t\tconst date = new Date(value.value)\n\n\t\t\tif (isValidDate(date)) {\n\t\t\t\treturn {\n\t\t\t\t\ttype: ControlType.Date,\n\t\t\t\t\tvalue: date.toISOString(),\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn null\n\t\t}\n\t}\n\n\treturn null\n}\n\n/**\n * DatabaseEnumValue\n */\n\nexport interface DatabaseEnumValue {\n\treadonly type: ControlType.Enum\n\treadonly value: string\n}\n\nfunction compareEnum(left: DatabaseEnumValue, right: DatabaseEnumValue): number {\n\tif (left.value < right.value) return -1\n\tif (left.value > right.value) return 1\n\treturn 0\n}\n\nfunction castEnum(value: DatabaseValue): DatabaseEnumValue | null {\n\tswitch (value?.type) {\n\t\tcase ControlType.Enum: {\n\t\t\treturn value\n\t\t}\n\n\t\tcase ControlType.String: {\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Enum,\n\t\t\t\tvalue: value.value,\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null\n}\n\n/**\n * DatabaseFileValue\n */\n\nexport interface DatabaseFileValue {\n\treadonly type: ControlType.File\n\treadonly value: string\n}\n\nfunction compareFile(left: DatabaseFileValue, right: DatabaseFileValue): number {\n\tif (left.value < right.value) return -1\n\tif (left.value > right.value) return 1\n\treturn 0\n}\n\nfunction castFile(value: DatabaseValue): DatabaseFileValue | null {\n\tswitch (value?.type) {\n\t\tcase ControlType.File: {\n\t\t\treturn value\n\t\t}\n\t}\n\n\treturn null\n}\n\n/**\n * DatabaseLinkValue\n */\n\nexport interface DatabaseLinkValue {\n\treadonly type: ControlType.Link\n\treadonly value: string | LinkToWebPage\n}\n\nfunction compareLink(left: DatabaseLinkValue, right: DatabaseLinkValue): number {\n\tconst leftEncoded = JSON.stringify(left.value)\n\tconst rightEncoded = JSON.stringify(right.value)\n\tif (leftEncoded < rightEncoded) return -1\n\tif (leftEncoded > rightEncoded) return 1\n\treturn 0\n}\n\nfunction castLink(value: DatabaseValue): DatabaseLinkValue | null {\n\tswitch (value?.type) {\n\t\tcase ControlType.Link: {\n\t\t\treturn value\n\t\t}\n\n\t\tcase ControlType.String: {\n\t\t\ttry {\n\t\t\t\tconst { protocol } = new URL(value.value)\n\n\t\t\t\tif (protocol === \"http:\" || protocol === \"https:\") {\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: ControlType.Link,\n\t\t\t\t\t\tvalue: value.value,\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn null\n\t\t\t} catch {\n\t\t\t\treturn null\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null\n}\n\n/**\n * DatabaseNumberValue\n */\n\nexport interface DatabaseNumberValue {\n\treadonly type: ControlType.Number\n\treadonly value: number\n}\n\nfunction compareNumber(left: DatabaseNumberValue, right: DatabaseNumberValue): number {\n\tif (left.value < right.value) return -1\n\tif (left.value > right.value) return 1\n\treturn 0\n}\n\nfunction castNumber(value: DatabaseValue): DatabaseNumberValue | null {\n\tswitch (value?.type) {\n\t\tcase ControlType.Number:\n\t\tcase ControlType.String: {\n\t\t\tconst number = Number(value.value)\n\n\t\t\tif (Number.isFinite(number)) {\n\t\t\t\treturn {\n\t\t\t\t\ttype: ControlType.Number,\n\t\t\t\t\tvalue: number,\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn null\n\t\t}\n\t}\n\n\treturn null\n}\n\nexport function valueToNumber(value: DatabaseValue) {\n\tconst cast = castNumber(value)\n\treturn cast?.value ?? null\n}\n\n/**\n * DatabaseObjectValue\n */\n\nexport interface DatabaseObjectValue {\n\treadonly type: ControlType.Object\n\treadonly value: Record<string, DatabaseValue>\n}\n\nfunction compareObject(left: DatabaseObjectValue, right: DatabaseObjectValue, collation: DatabaseCollation): number {\n\tconst leftKeys = Object.keys(left.value).sort()\n\tconst rightKeys = Object.keys(right.value).sort()\n\n\tif (leftKeys.length < rightKeys.length) return -1\n\tif (leftKeys.length > rightKeys.length) return 1\n\n\tfor (let i = 0; i < leftKeys.length; i++) {\n\t\t// biome-ignore lint/style/noNonNullAssertion: Guaranteed by the loop.\n\t\tconst leftKey = leftKeys[i]!\n\t\t// biome-ignore lint/style/noNonNullAssertion: Guaranteed by the loop.\n\t\tconst rightKey = rightKeys[i]!\n\n\t\tif (leftKey < rightKey) return -1\n\t\tif (leftKey > rightKey) return 1\n\n\t\tconst leftValue = left.value[leftKey] ?? null\n\t\tconst rightValue = right.value[rightKey] ?? null\n\n\t\tconst result = compare(leftValue, rightValue, collation)\n\t\tif (result !== 0) return result\n\t}\n\n\treturn 0\n}\n\nfunction castObject(value: DatabaseValue, definition: DatabaseObjectValueDefinition): DatabaseObjectValue | null {\n\tswitch (value?.type) {\n\t\tcase ControlType.Object: {\n\t\t\tconst result: Record<string, DatabaseValue> = {}\n\t\t\tconst definitionEntries = Object.entries(definition.definitions)\n\n\t\t\tfor (const [key, itemDefinition] of definitionEntries) {\n\t\t\t\tconst item = value.value[key] ?? null\n\t\t\t\tresult[key] = DatabaseValue.cast(item, itemDefinition)\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Object,\n\t\t\t\tvalue: result,\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null\n}\n\n/**\n * DatabaseResponsiveImageValue\n */\n\nexport interface DatabaseResponsiveImageValue {\n\treadonly type: ControlType.ResponsiveImage\n\treadonly value: object\n}\n\nfunction compareResponsiveImage(left: DatabaseResponsiveImageValue, right: DatabaseResponsiveImageValue): number {\n\tconst leftEncoded = JSON.stringify(left.value)\n\tconst rightEncoded = JSON.stringify(right.value)\n\tif (leftEncoded < rightEncoded) return -1\n\tif (leftEncoded > rightEncoded) return 1\n\treturn 0\n}\n\nfunction castResponsiveImage(value: DatabaseValue): DatabaseResponsiveImageValue | null {\n\tswitch (value?.type) {\n\t\tcase ControlType.ResponsiveImage: {\n\t\t\treturn value\n\t\t}\n\t}\n\n\treturn null\n}\n\n/**\n * DatabaseRichTextValue\n */\n\nexport interface DatabaseRichTextValue {\n\treadonly type: ControlType.RichText\n\treadonly value: DatabaseRichTextPointer\n}\n\nfunction compareRichText(left: DatabaseRichTextValue, right: DatabaseRichTextValue): number {\n\tconst leftValue = left.value as number\n\tconst rightValue = right.value as number\n\tif (leftValue < rightValue) return -1\n\tif (leftValue > rightValue) return 1\n\treturn 0\n}\n\nfunction castRichText(value: DatabaseValue): DatabaseRichTextValue | null {\n\tswitch (value?.type) {\n\t\tcase ControlType.RichText: {\n\t\t\treturn value\n\t\t}\n\t}\n\n\treturn null\n}\n\nexport interface DatabaseVectorSetItemValue {\n\treadonly type: ControlType.VectorSetItem\n\treadonly value: DatabaseVectorSetItemPointer\n}\n\nfunction compareVectorSetItem(left: DatabaseVectorSetItemValue, right: DatabaseVectorSetItemValue): number {\n\tconst leftValue = left.value as number\n\tconst rightValue = right.value as number\n\tif (leftValue < rightValue) return -1\n\tif (leftValue > rightValue) return 1\n\treturn 0\n}\n\nfunction castVectorSetItem(value: DatabaseValue): DatabaseVectorSetItemValue | null {\n\tswitch (value?.type) {\n\t\tcase ControlType.VectorSetItem: {\n\t\t\treturn value\n\t\t}\n\t}\n\n\treturn null\n}\n\n/**\n * DatabaseStringValue\n */\n\nexport interface DatabaseStringValue {\n\treadonly type: ControlType.String\n\treadonly value: string\n}\n\nfunction compareString(left: DatabaseStringValue, right: DatabaseStringValue, collation: DatabaseCollation): number {\n\tlet leftValue = left.value\n\tlet rightValue = right.value\n\n\tif (collation.type === DatabaseCollationType.CaseInsensitive) {\n\t\tleftValue = left.value.toLowerCase()\n\t\trightValue = right.value.toLowerCase()\n\t}\n\n\tif (leftValue < rightValue) return -1\n\tif (leftValue > rightValue) return 1\n\treturn 0\n}\n\nfunction castString(value: DatabaseValue): DatabaseStringValue | null {\n\tswitch (value?.type) {\n\t\tcase ControlType.String: {\n\t\t\treturn value\n\t\t}\n\n\t\tcase ControlType.Number: {\n\t\t\treturn {\n\t\t\t\ttype: ControlType.String,\n\t\t\t\tvalue: String(value.value),\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null\n}\n\nexport function valueToString(value: DatabaseValue) {\n\tconst cast = castString(value)\n\treturn cast?.value ?? null\n}\n\n/**\n * @important Types must be JSON serializable.\n */\nexport type DatabaseValue =\n\t| DatabaseArrayValue\n\t| DatabaseBooleanValue\n\t| DatabaseColorValue\n\t| DatabaseDateValue\n\t| DatabaseEnumValue\n\t| DatabaseFileValue\n\t| DatabaseLinkValue\n\t| DatabaseNumberValue\n\t| DatabaseObjectValue\n\t| DatabaseResponsiveImageValue\n\t| DatabaseRichTextValue\n\t| DatabaseStringValue\n\t| DatabaseVectorSetItemValue\n\t| null\n\nexport const DatabaseValue = {\n\t/**\n\t * Casts a value to a different type.\n\t */\n\tcast(value: DatabaseValue, definition: DatabaseValueDefinition): DatabaseValue {\n\t\tswitch (definition.type) {\n\t\t\tcase ControlType.Array:\n\t\t\t\treturn castArray(value, definition)\n\t\t\tcase ControlType.Boolean:\n\t\t\t\treturn castBoolean(value)\n\t\t\tcase ControlType.Color:\n\t\t\t\treturn castColor(value)\n\t\t\tcase ControlType.Date:\n\t\t\t\treturn castDate(value)\n\t\t\tcase ControlType.Enum:\n\t\t\t\treturn castEnum(value)\n\t\t\tcase ControlType.File:\n\t\t\t\treturn castFile(value)\n\t\t\tcase ControlType.Link:\n\t\t\t\treturn castLink(value)\n\t\t\tcase ControlType.Number:\n\t\t\t\treturn castNumber(value)\n\t\t\tcase ControlType.Object:\n\t\t\t\treturn castObject(value, definition)\n\t\t\tcase ControlType.ResponsiveImage:\n\t\t\t\treturn castResponsiveImage(value)\n\t\t\tcase ControlType.RichText:\n\t\t\t\treturn castRichText(value)\n\t\t\tcase ControlType.String:\n\t\t\t\treturn castString(value)\n\t\t\tcase ControlType.VectorSetItem:\n\t\t\t\treturn castVectorSetItem(value)\n\t\t\tcase \"unknown\":\n\t\t\t\treturn value\n\t\t\tdefault:\n\t\t\t\tassertNever(definition, \"Unsupported cast\")\n\t\t}\n\t},\n\n\t/**\n\t * Parses a JavaScript variable into a DatabaseValue.\n\t */\n\tparse(value: unknown): DatabaseValue {\n\t\tif (isBoolean(value)) {\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Boolean,\n\t\t\t\tvalue,\n\t\t\t}\n\t\t}\n\n\t\tif (isValidDate(value)) {\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Date,\n\t\t\t\tvalue: value.toISOString(),\n\t\t\t}\n\t\t}\n\n\t\tif (isNumber(value)) {\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Number,\n\t\t\t\tvalue,\n\t\t\t}\n\t\t}\n\n\t\tif (isString(value)) {\n\t\t\treturn {\n\t\t\t\ttype: ControlType.String,\n\t\t\t\tvalue,\n\t\t\t}\n\t\t}\n\n\t\tif (isArray(value)) {\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Array,\n\t\t\t\tvalue: value.map(DatabaseValue.parse),\n\t\t\t}\n\t\t}\n\n\t\treturn null\n\t},\n\n\t/**\n\t * Checks if the left value is equal to the right value. Returns false if\n\t * the values are not of the same type.\n\t */\n\tequal(left: DatabaseValue, right: DatabaseValue, collation: DatabaseCollation) {\n\t\tif (left?.type !== right?.type) {\n\t\t\treturn false\n\t\t}\n\n\t\treturn compare(left, right, collation) === 0\n\t},\n\n\t/**\n\t * Checks if the left value is less than the right value. Returns false if\n\t * the values are not of the same type.\n\t */\n\tlessThan(left: DatabaseValue, right: DatabaseValue, collation: DatabaseCollation) {\n\t\tif (left?.type !== right?.type) {\n\t\t\treturn false\n\t\t}\n\n\t\treturn compare(left, right, collation) < 0\n\t},\n\n\t/**\n\t * Checks if the left value is less than or equal to the right value.\n\t * Returns false if the values are not of the same type.\n\t */\n\tlessThanOrEqual(left: DatabaseValue, right: DatabaseValue, collation: DatabaseCollation) {\n\t\tif (left?.type !== right?.type) {\n\t\t\treturn false\n\t\t}\n\n\t\treturn compare(left, right, collation) <= 0\n\t},\n\n\t/**\n\t * Checks if the left value is greater than the right value. Returns false\n\t * if the values are not of the same type.\n\t */\n\tgreaterThan(left: DatabaseValue, right: DatabaseValue, collation: DatabaseCollation) {\n\t\tif (left?.type !== right?.type) {\n\t\t\treturn false\n\t\t}\n\n\t\treturn compare(left, right, collation) > 0\n\t},\n\n\t/**\n\t * Checks if the left value is greater than or equal to the right value.\n\t * Returns false if the values are not of the same type.\n\t */\n\tgreaterThanOrEqual(left: DatabaseValue, right: DatabaseValue, collation: DatabaseCollation) {\n\t\tif (left?.type !== right?.type) {\n\t\t\treturn false\n\t\t}\n\n\t\treturn compare(left, right, collation) >= 0\n\t},\n\n\t/**\n\t * Checks if the left value is in the right value. Returns false if the\n\t * right value is not an array.\n\t */\n\tin(left: DatabaseValue, right: DatabaseValue, collation: DatabaseCollation) {\n\t\tif (right?.type !== ControlType.Array) return false\n\n\t\treturn right.value.some(item => {\n\t\t\treturn DatabaseValue.equal(item, left, collation)\n\t\t})\n\t},\n\n\t/**\n\t * Get the index of the first occurrence of `target` in `source`.\n\t *\n\t * If source has duplicates, the index of the first occurrence is always returned.\n\t */\n\tindexOf(source: DatabaseValue, target: DatabaseValue, collation: DatabaseCollation) {\n\t\tif (source?.type !== ControlType.Array) return -1\n\n\t\treturn source.value.findIndex(item => {\n\t\t\treturn DatabaseValue.equal(item, target, collation)\n\t\t})\n\t},\n\n\tcontains(source: DatabaseValue, target: DatabaseValue, collation: DatabaseCollation) {\n\t\tlet sourceValue = valueToString(source)\n\t\tlet targetValue = valueToString(target)\n\n\t\tif (isNull(sourceValue)) return false\n\t\tif (isNull(targetValue)) return false\n\n\t\tif (collation.type === DatabaseCollationType.CaseInsensitive) {\n\t\t\tsourceValue = sourceValue.toLowerCase()\n\t\t\ttargetValue = targetValue.toLowerCase()\n\t\t}\n\n\t\treturn sourceValue.includes(targetValue)\n\t},\n\n\tstartsWith(source: DatabaseValue, target: DatabaseValue, collation: DatabaseCollation) {\n\t\tlet sourceValue = valueToString(source)\n\t\tlet targetValue = valueToString(target)\n\n\t\tif (isNull(sourceValue)) return false\n\t\tif (isNull(targetValue)) return false\n\n\t\tif (collation.type === DatabaseCollationType.CaseInsensitive) {\n\t\t\tsourceValue = sourceValue.toLowerCase()\n\t\t\ttargetValue = targetValue.toLowerCase()\n\t\t}\n\n\t\treturn sourceValue.startsWith(targetValue)\n\t},\n\n\tendsWith(source: DatabaseValue, target: DatabaseValue, collation: DatabaseCollation) {\n\t\tlet sourceValue = valueToString(source)\n\t\tlet targetValue = valueToString(target)\n\n\t\tif (isNull(sourceValue)) return false\n\t\tif (isNull(targetValue)) return false\n\n\t\tif (collation.type === DatabaseCollationType.CaseInsensitive) {\n\t\t\tsourceValue = sourceValue.toLowerCase()\n\t\t\ttargetValue = targetValue.toLowerCase()\n\t\t}\n\n\t\treturn sourceValue.endsWith(targetValue)\n\t},\n\n\tlength(value: DatabaseValue) {\n\t\tswitch (value?.type) {\n\t\t\tcase ControlType.Array:\n\t\t\t\treturn value.value.length\n\t\t}\n\n\t\treturn 0\n\t},\n\n\tstringify(value: DatabaseValue): string {\n\t\tif (value === null) {\n\t\t\treturn \"null\"\n\t\t}\n\n\t\tswitch (value.type) {\n\t\t\tcase ControlType.Array:\n\t\t\t\treturn `[${value.value.map(DatabaseValue.stringify).join(\", \")}]`\n\t\t\tcase ControlType.Boolean:\n\t\t\tcase ControlType.Number:\n\t\t\t\treturn String(value.value)\n\t\t\tcase ControlType.String:\n\t\t\t\treturn `'${value.value}'`\n\t\t\tcase ControlType.Enum:\n\t\t\t\treturn `'${value.value}' /* Enum */`\n\t\t\tcase ControlType.Color:\n\t\t\t\treturn `'${value.value}' /* Color */`\n\t\t\tcase ControlType.Date:\n\t\t\t\treturn `'${value.value}' /* Date */`\n\t\t\tcase ControlType.RichText:\n\t\t\t\treturn \"RichText\"\n\t\t\tcase ControlType.VectorSetItem:\n\t\t\t\treturn \"VectorSetItem\"\n\t\t\tcase ControlType.ResponsiveImage:\n\t\t\t\treturn \"ResponsiveImage\"\n\t\t\tcase ControlType.File:\n\t\t\t\treturn \"File\"\n\t\t\tcase ControlType.Link:\n\t\t\t\treturn isString(value.value) ? `'${value.value}' /* Link */` : \"Link\"\n\t\t\tcase ControlType.Object:\n\t\t\t\treturn \"Object\"\n\t\t\tdefault:\n\t\t\t\tassertNever(value)\n\t\t}\n\t},\n}\n\n/**\n * Compares two DatabaseValue of the same type. Returns a negative number if\n * the left value is less than the right value, a positive number if the\n * left value is greater than the right value, and 0 if they are equal.\n */\nfunction compare(left: DatabaseValue, right: DatabaseValue, collation: DatabaseCollation): number {\n\tif (isNull(left) || isNull(right)) {\n\t\tassert(left === right)\n\t\treturn 0\n\t}\n\n\tswitch (left.type) {\n\t\tcase ControlType.Array: {\n\t\t\tassert(left.type === right.type)\n\t\t\treturn compareArray(left, right, collation)\n\t\t}\n\n\t\tcase ControlType.Boolean: {\n\t\t\tassert(left.type === right.type)\n\t\t\treturn compareBoolean(left, right)\n\t\t}\n\n\t\tcase ControlType.Color: {\n\t\t\tassert(left.type === right.type)\n\t\t\treturn compareColor(left, right)\n\t\t}\n\n\t\tcase ControlType.Date: {\n\t\t\tassert(left.type === right.type)\n\t\t\treturn compareDate(left, right)\n\t\t}\n\n\t\tcase ControlType.Enum: {\n\t\t\tassert(left.type === right.type)\n\t\t\treturn compareEnum(left, right)\n\t\t}\n\n\t\tcase ControlType.File: {\n\t\t\tassert(left.type === right.type)\n\t\t\treturn compareFile(left, right)\n\t\t}\n\n\t\tcase ControlType.Link: {\n\t\t\tassert(left.type === right.type)\n\t\t\treturn compareLink(left, right)\n\t\t}\n\n\t\tcase ControlType.Number: {\n\t\t\tassert(left.type === right.type)\n\t\t\treturn compareNumber(left, right)\n\t\t}\n\n\t\tcase ControlType.Object: {\n\t\t\tassert(left.type === right.type)\n\t\t\treturn compareObject(left, right, collation)\n\t\t}\n\n\t\tcase ControlType.ResponsiveImage: {\n\t\t\tassert(left.type === right.type)\n\t\t\treturn compareResponsiveImage(left, right)\n\t\t}\n\n\t\tcase ControlType.RichText: {\n\t\t\tassert(left.type === right.type)\n\t\t\treturn compareRichText(left, right)\n\t\t}\n\n\t\tcase ControlType.VectorSetItem: {\n\t\t\tassert(left.type === right.type)\n\t\t\treturn compareVectorSetItem(left, right)\n\t\t}\n\n\t\tcase ControlType.String: {\n\t\t\tassert(left.type === right.type)\n\t\t\treturn compareString(left, right, collation)\n\t\t}\n\n\t\tdefault: {\n\t\t\tassertNever(left)\n\t\t}\n\t}\n}\n", "import type { ControlType } from \"../../render/types/PropertyControls.ts\"\n\n// The types in this file are very similar to ControlDescriptions but are used\n// to define the fields of a DatabaseCollectionModule and its indexes.\n\ninterface BaseDatabaseValueDefinition {\n\treadonly isNullable: boolean\n}\n\nexport interface DatabaseArrayValueDefinition extends BaseDatabaseValueDefinition {\n\treadonly type: ControlType.Array\n\treadonly definition: DatabaseValueDefinition\n}\n\nexport interface DatabaseBooleanValueDefinition extends BaseDatabaseValueDefinition {\n\treadonly type: ControlType.Boolean\n}\n\nexport interface DatabaseColorValueDefinition extends BaseDatabaseValueDefinition {\n\treadonly type: ControlType.Color\n}\n\nexport interface DatabaseDateValueDefinition extends BaseDatabaseValueDefinition {\n\treadonly type: ControlType.Date\n}\n\nexport interface DatabaseEnumValueDefinition extends BaseDatabaseValueDefinition {\n\treadonly type: ControlType.Enum\n}\n\nexport interface DatabaseFileValueDefinition extends BaseDatabaseValueDefinition {\n\treadonly type: ControlType.File\n}\n\nexport interface DatabaseLinkValueDefinition extends BaseDatabaseValueDefinition {\n\treadonly type: ControlType.Link\n}\n\nexport interface DatabaseNumberValueDefinition extends BaseDatabaseValueDefinition {\n\treadonly type: ControlType.Number\n}\n\nexport interface DatabaseObjectValueDefinition extends BaseDatabaseValueDefinition {\n\treadonly type: ControlType.Object\n\treadonly definitions: Record<string, DatabaseValueDefinition>\n}\n\nexport interface DatabaseResponsiveImageValueDefinition extends BaseDatabaseValueDefinition {\n\treadonly type: ControlType.ResponsiveImage\n}\n\nexport interface DatabaseRichTextValueDefinition extends BaseDatabaseValueDefinition {\n\treadonly type: ControlType.RichText\n}\n\nexport interface DatabaseStringValueDefinition extends BaseDatabaseValueDefinition {\n\treadonly type: ControlType.String\n}\n\nexport interface DatabaseVectorSetItemValueDefinition extends BaseDatabaseValueDefinition {\n\treadonly type: ControlType.VectorSetItem\n}\n\n/**\n * An internal value definition that is used to represent an unknown value. This\n * is used to represent constants before the `Normalizer` casts them to a more\n * specific type.\n */\nexport interface DatabaseUnknownValueDefinition extends BaseDatabaseValueDefinition {\n\t/** @internal */\n\treadonly type: \"unknown\"\n}\n\nexport const unknownDefinition: DatabaseUnknownValueDefinition = {\n\ttype: \"unknown\",\n\tisNullable: true,\n}\n\nexport type DatabaseValueDefinition =\n\t| DatabaseArrayValueDefinition\n\t| DatabaseBooleanValueDefinition\n\t| DatabaseColorValueDefinition\n\t| DatabaseDateValueDefinition\n\t| DatabaseEnumValueDefinition\n\t| DatabaseFileValueDefinition\n\t| DatabaseLinkValueDefinition\n\t| DatabaseNumberValueDefinition\n\t| DatabaseObjectValueDefinition\n\t| DatabaseResponsiveImageValueDefinition\n\t| DatabaseRichTextValueDefinition\n\t| DatabaseStringValueDefinition\n\t| DatabaseVectorSetItemValueDefinition\n\t// Internal types\n\t| DatabaseUnknownValueDefinition\n", "import type { ReactNode } from \"react\"\nimport { ControlType } from \"../../render/types/PropertyControls.ts\"\nimport type { Mutable } from \"../../utils/Mutable.ts\"\nimport { getPropertyControls } from \"../../utils/addPropertyControls.ts\"\nimport { assert } from \"../../utils/assert.ts\"\nimport { isNullish, isUndefined } from \"../../utils/utils.ts\"\nimport { LazyValue } from \"../LazyValue.ts\"\nimport type { DatabaseValue } from \"./DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"./DatabaseValueDefinition.ts\"\nimport type { MaybeLocale } from \"./QueryEngine.ts\"\nimport type {\n\tAnyLegacyCollection,\n\tDatabaseCollection,\n\tDatabaseIndex,\n\tDatabaseItem,\n\tDatabaseItemPointer,\n\tDatabaseSchema,\n\tLegacyCollectionItems,\n} from \"./types.ts\"\nimport { isLegacyLocalizedCollection } from \"./types.ts\"\n\nasync function getCollectionItems(\n\tcollection: AnyLegacyCollection,\n\tlocale: MaybeLocale,\n): Promise<LegacyCollectionItems> {\n\tif (isLegacyLocalizedCollection(collection)) {\n\t\tawait collection.preload(locale)\n\t\treturn collection.read(locale)\n\t}\n\n\treturn collection\n}\n\nexport class CompatibilityDatabaseCollection implements DatabaseCollection {\n\treadonly schema: DatabaseSchema\n\treadonly indexes: DatabaseIndex[] = []\n\n\tconstructor(\n\t\treadonly collection: AnyLegacyCollection,\n\t\treadonly locale: MaybeLocale,\n\t) {\n\t\tconst propertyControls = getPropertyControls(collection)\n\t\tassert(propertyControls, \"Collection does not have properties\")\n\n\t\tconst schema: Mutable<DatabaseSchema> = {\n\t\t\tid: {\n\t\t\t\ttype: ControlType.String,\n\t\t\t\tisNullable: false,\n\t\t\t},\n\t\t}\n\n\t\tconst controlEntries = Object.entries(propertyControls)\n\t\tfor (const [key, controlDescription] of controlEntries) {\n\t\t\tif (!controlDescription) continue\n\n\t\t\tconst type = controlDescription.type as DatabaseValueDefinition[\"type\"]\n\n\t\t\tassert(type !== ControlType.Array, \"Array properties are not supported\")\n\t\t\tassert(type !== ControlType.Object, \"Object properties are not supported\")\n\n\t\t\tschema[key] = {\n\t\t\t\ttype,\n\t\t\t\tisNullable: true,\n\t\t\t}\n\t\t}\n\n\t\tthis.schema = schema\n\t}\n\n\tprivate getDatabaseItem(item: Record<string, unknown>, pointer: DatabaseItemPointer) {\n\t\tconst data: Record<string, DatabaseValue> = {}\n\t\tconst itemIndex = Number(pointer)\n\n\t\tfor (const key in this.schema) {\n\t\t\tconst value = item[key]\n\t\t\tif (isNullish(value)) continue\n\n\t\t\tconst definition = this.schema[key]\n\t\t\tif (isUndefined(definition)) continue\n\n\t\t\tassert(definition.type !== \"unknown\", \"Invalid definition type\")\n\n\t\t\t// For rich text, serialize the pointer as a structured object\n\t\t\tif (definition.type === ControlType.RichText) {\n\t\t\t\tdata[key] = {\n\t\t\t\t\ttype: definition.type,\n\t\t\t\t\tvalue: { itemIndex, key },\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tdata[key] = {\n\t\t\t\ttype: definition.type,\n\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: Existing.\n\t\t\t\tvalue: value as any,\n\t\t\t}\n\t\t}\n\n\t\treturn { pointer, data }\n\t}\n\n\tasync resolveRichText(pointer: { itemIndex: number; key: string }) {\n\t\tconst { itemIndex, key } = pointer\n\t\tconst items = await getCollectionItems(this.collection, this.locale)\n\t\tconst richText = items[itemIndex]?.[key] as ReactNode | LazyValue<ReactNode>\n\n\t\tif (LazyValue.is(richText)) {\n\t\t\treturn richText.readMaybeAsync()\n\t\t}\n\t\treturn richText\n\t}\n\n\tasync scanItems() {\n\t\tconst items = await getCollectionItems(this.collection, this.locale)\n\n\t\treturn items.map((item, index) => {\n\t\t\tconst pointer = String(index)\n\t\t\treturn this.getDatabaseItem(item, pointer)\n\t\t})\n\t}\n\n\tasync resolveItems(pointers: DatabaseItemPointer[]) {\n\t\tconst items = await getCollectionItems(this.collection, this.locale)\n\n\t\treturn pointers.map(pointer => {\n\t\t\tconst index = Number(pointer)\n\t\t\tconst item = items[index]\n\t\t\tassert(item, \"Can't find collection item\")\n\t\t\treturn this.getDatabaseItem(item, pointer)\n\t\t})\n\t}\n\n\tcompareItems(left: DatabaseItem, right: DatabaseItem) {\n\t\treturn Number(left.pointer) - Number(right.pointer)\n\t}\n}\n", "import { type AnyCollection, isAnyDatabaseCollection } from \"./types.ts\"\n\n// The ModulesRuntime can import a collection multiple times, e.g. when a component that is used in the collection changes.\n// In that case, we cannot use the collection id to cache the query, because the e.g. the component could have changed.\n// So we first time we see a different Collection module reference, we start generating random ids in a weak map below.\nconst persistedCollectionIdToSeenCollectionRef = new Map<string, WeakRef<AnyCollection>>()\n// We need stable collection ids so that the query can be cached and we don't suspend infinitely.\n// Only when the reference of the Collection module updates, we store a new id so that e.g. the preview updates correctly.\nconst collectionRefToStableCollectionId = new WeakMap<AnyCollection, string>()\n\nconst prefix = \"$r_\"\n\nexport function hasRandomCollectionId(id: string) {\n\treturn id.includes(prefix)\n}\n\nfunction getPersistedCollectionId(collection: AnyCollection): string | undefined {\n\tif (!isAnyDatabaseCollection(collection)) return undefined\n\tif (!collection.id) return undefined\n\n\tconst existingCollectionRef = persistedCollectionIdToSeenCollectionRef.get(collection.id)\n\tif (!existingCollectionRef) {\n\t\tpersistedCollectionIdToSeenCollectionRef.set(collection.id, new WeakRef(collection))\n\t\treturn collection.id\n\t}\n\n\tif (existingCollectionRef.deref() === collection) {\n\t\treturn collection.id\n\t}\n\n\t// New Collection ref, don't use the persisted id anymore\n\treturn undefined\n}\nexport function getCollectionId(collection: AnyCollection) {\n\tconst persistedId = getPersistedCollectionId(collection)\n\tif (persistedId) return persistedId\n\n\tconst stableCollectionId = collectionRefToStableCollectionId.get(collection)\n\tif (stableCollectionId) return stableCollectionId\n\n\t// Isomorphic way to get a good enough random ID. We don't use a UUID, because crypto.randomUUID is not\n\t// available in all browsers Framer sites support.\n\tconst id = `${prefix}${Math.random().toString(16).slice(2)}`\n\tcollectionRefToStableCollectionId.set(collection, id)\n\treturn id\n}\n", "import { defaultLocaleId } from \"../../router/types.ts\"\nimport { assertNever } from \"../../utils/assert.ts\"\nimport { CompatibilityDatabaseCollection } from \"./CompatibilityDatabaseCollection.ts\"\nimport type { MaybeLocale } from \"./QueryEngine.ts\"\nimport { getCollectionId } from \"./getCollectionId.ts\"\nimport {\n\ttype AnyCollection,\n\ttype DatabaseCollection,\n\tisAnyLegacyCollection,\n\tisDatabaseCollection,\n\tisLocalizedDatabaseCollection,\n} from \"./types.ts\"\n\nconst compatibilityCache = new Map<string, CompatibilityDatabaseCollection>()\n\nexport function getCollectionForLocale(data: AnyCollection, locale: MaybeLocale): DatabaseCollection {\n\tif (isAnyLegacyCollection(data)) {\n\t\tconst collectionId = getCollectionId(data)\n\t\tconst localeId = locale?.id ?? defaultLocaleId\n\t\tconst cacheKey = collectionId + localeId\n\n\t\tconst cached = compatibilityCache.get(cacheKey)\n\t\tif (cached) return cached\n\n\t\tconst collection = new CompatibilityDatabaseCollection(data, locale)\n\t\tcompatibilityCache.set(cacheKey, collection)\n\n\t\treturn collection\n\t}\n\n\tif (isDatabaseCollection(data)) {\n\t\treturn data\n\t}\n\n\tif (isLocalizedDatabaseCollection(data)) {\n\t\twhile (locale) {\n\t\t\tconst collection = data.collectionByLocaleId[locale.id]\n\t\t\tif (collection) return collection\n\t\t\tlocale = locale.fallback\n\t\t}\n\n\t\treturn data.collectionByLocaleId.default\n\t}\n\n\tassertNever(data, \"Unsupported collection type\")\n}\n", "/**\n * Returns the estimated network latency in ms.\n */\nfunction getNetworkLatency() {\n\treturn 25\n}\n\n/**\n * Returns the estimated network speed in bytes per ms.\n */\nfunction getNetworkSpeed() {\n\treturn 100 /* Mbit/s */ * 125\n}\n\nexport const KB = 1_000\nexport const MB = 1_000_000\n\nexport class Cost {\n\tconstructor(\n\t\t/**\n\t\t * The estimated network time required to execute the node in ms.\n\t\t */\n\t\tprivate network: number,\n\t) {}\n\n\tstatic estimate(totalRequests: number, transferredBytes: number) {\n\t\tconst latency = getNetworkLatency()\n\t\tconst speed = getNetworkSpeed()\n\t\tconst network = totalRequests * latency + transferredBytes / speed\n\t\treturn new Cost(network)\n\t}\n\n\tstatic max(left: Cost, right: Cost) {\n\t\tconst network = Math.max(left.network, right.network)\n\t\treturn new Cost(network)\n\t}\n\n\tstatic compare(left: Cost, right: Cost) {\n\t\tif (left.network < right.network) return -1\n\t\tif (left.network > right.network) return 1\n\t\treturn 0\n\t}\n\n\tadd(cost: Cost) {\n\t\tthis.network += cost.network\n\t\treturn this\n\t}\n\n\ttoString() {\n\t\treturn `${this.network}ms`\n\t}\n}\n", "import type { Opaque } from \"../../../utils/Opaque.ts\"\nimport { assert } from \"../../../utils/assert.ts\"\nimport { Cost } from \"./Cost.ts\"\nimport type { Hash } from \"./Hashable.ts\"\nimport type { RelationalProps } from \"./LogicalProps.ts\"\nimport type { RequiredProps } from \"./PhysicalProps.ts\"\nimport type { RelationalNode } from \"./nodes/relational/RelationalNode.ts\"\n\nexport type GroupId = Opaque<number, \"GroupId\">\nexport function GroupId(id: number) {\n\treturn id as GroupId\n}\n\n/**\n * A group contains a list of nodes that are logically equivalent. This means\n * that all nodes in the group return the same set of tuples, but the order of\n * the tuples may be different. After a group is optimized for a set of physical\n * props, it stores the best node and its cost in the winners map.\n */\nexport class Group {\n\t/**\n\t * A list of all nodes in the group. All nodes must have compatible\n\t * relational props.\n\t */\n\treadonly nodes: RelationalNode[] = []\n\n\t/**\n\t * A map of all winners in the group by their hash.\n\t */\n\treadonly winners = new Map<Hash, Winner>()\n\n\tconstructor(\n\t\t/**\n\t\t * The id of the group. This is used to uniquely identify the group in\n\t\t * the memo.\n\t\t */\n\t\treadonly id: GroupId,\n\t\t/**\n\t\t * The relational props of the group. All nodes in the group must have\n\t\t * equivalent relational props.\n\t\t */\n\t\treadonly relational: RelationalProps,\n\t) {}\n\n\t/**\n\t * Adds a node to the group. Throws an error if the node is already in a\n\t * group.\n\t */\n\taddNode(node: RelationalNode) {\n\t\tthis.nodes.push(node)\n\t\tnode.setGroup(this)\n\t}\n\n\t/**\n\t * Returns the winner for the given required physical props. The winner\n\t * stores the best node and its cost. This is used to find the best node in\n\t * the group.\n\t */\n\tgetWinner(required: RequiredProps) {\n\t\tconst hash = required.getHash()\n\n\t\tconst existing = this.winners.get(hash)\n\t\tif (existing) return existing\n\n\t\tconst winner = new Winner()\n\t\tthis.winners.set(hash, winner)\n\t\treturn winner\n\t}\n\n\t/**\n\t * Returns the optimized version of the node. The optimized version is the\n\t * node with the lowest cost with all children replaced with their optimized\n\t * versions. This is used to create the final optimized query plan.\n\t */\n\tgetOptimized(required: RequiredProps) {\n\t\tconst winner = this.getWinner(required)\n\t\tassert(winner.node, \"Group not optimized\")\n\n\t\tconst optimizer = winner.node.getOptimized(required)\n\t\toptimizer.setGroup(this)\n\t\treturn optimizer\n\t}\n}\n\n/**\n * The winner stores the best node and its cost of the group for a given set of\n * required physical props.\n */\nexport class Winner {\n\tnode: RelationalNode | undefined\n\tcost = new Cost(Infinity)\n\n\treadonly nodes: RelationalNode[] = []\n\n\tupdate(node: RelationalNode, cost: Cost) {\n\t\tthis.nodes.push(node)\n\n\t\tif (Cost.compare(cost, this.cost) < 0) {\n\t\t\tthis.node = node\n\t\t\tthis.cost = cost\n\t\t}\n\t}\n}\n", "import type { Hash, Hashable } from \"../Hashable.ts\"\n\nexport abstract class AbstractNode implements Hashable {\n\tconstructor(\n\t\t/**\n\t\t * Indicates whether the node can be evaluated synchronously.\n\t\t * Synchronous nodes are not allowed to yield values when they are\n\t\t * evaluated with the `evaluate()` method.\n\t\t */\n\t\treadonly isSynchronous: boolean,\n\t) {}\n\n\t/**\n\t * Returns a \"hash\" that uniquely identifies the node. This hash is used to\n\t * determine if two nodes are equivalent.\n\t */\n\tabstract getHash(): Hash\n}\n", "import { assert } from \"../../../../../utils/assert.ts\"\nimport type { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateAsync, evaluateSync } from \"../../Evaluate.ts\"\nimport type { Group } from \"../../Group.ts\"\nimport type { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Ordering } from \"../../Ordering.ts\"\nimport type { RequiredProps } from \"../../PhysicalProps.ts\"\nimport type { Relation, Tuple } from \"../../Relation.ts\"\nimport { AbstractNode } from \"../AbstractNode.ts\"\n\nexport abstract class RelationalNode extends AbstractNode {\n\tprivate group: Group | undefined\n\n\t/**\n\t * Returns the group that the node belongs to. Throws an error if the node\n\t * is not in a group. This should only happen in the constructor because\n\t * every node is added to a group right after creation.\n\t */\n\tgetGroup() {\n\t\tassert(this.group, \"Node must be in a group\")\n\t\treturn this.group\n\t}\n\n\t/**\n\t * Adds the node to the given group. Throws an error if the node is already\n\t * in a group.\n\t */\n\tsetGroup(group: Group) {\n\t\tassert(!this.group, \"Node is already in a group\")\n\t\tthis.group = group\n\t}\n\n\t/**\n\t * Evaluates the node and all children synchronously. Throws an error if the\n\t * node is not synchronous.\n\t */\n\tevaluateSync() {\n\t\tconst generator = this.evaluate(undefined)\n\t\treturn evaluateSync(generator)\n\t}\n\n\t/**\n\t * Evaluates the node and all children asynchronously.\n\t */\n\tevaluateAsync() {\n\t\tconst generator = this.evaluate(undefined)\n\t\treturn evaluateAsync(generator)\n\t}\n\n\t/**\n\t * Returns the output fields of the node.\n\t */\n\tabstract getOutputFields(): Fields\n\n\t/**\n\t * Checks if the nodes provides the required ordering. If the node can't\n\t * provide the ordering we need to add an `EnforcerSort`.\n\t */\n\tabstract canProvideOrdering(ordering: Ordering): boolean\n\n\t/**\n\t * Checks if the node provides the required resolved fields. If the node\n\t * can't provide the resolved fields we need to add an `EnforcerResolve`.\n\t */\n\tabstract canProvideResolvedFields(resolvedFields: Fields): boolean\n\n\t/**\n\t * Optimizes all children and calculates the cost of the node.\n\t */\n\tabstract optimize(optimizer: Optimizer, required: RequiredProps): Cost\n\n\t/**\n\t * Returns an optimized version of the node with all children replaced by\n\t * their lowest cost alternatives.\n\t */\n\tabstract getOptimized(required: RequiredProps): RelationalNode\n\n\t/**\n\t * Evaluates the node and all children. This returns a generator so the\n\t * implementation can be either synchronous or asynchronous as indicated by\n\t * the `isSynchronous` property.\n\t */\n\tabstract evaluate(context: Tuple | undefined): Evaluate<Relation>\n}\n", "import type { Opaque } from \"../../../utils/Opaque.ts\"\nimport { assert } from \"../../../utils/assert.ts\"\nimport { isFunction, isObject } from \"../../../utils/utils.ts\"\nimport { Group } from \"./Group.ts\"\nimport { CollectionMetadata, FieldMetadata, IndexMetadata } from \"./Metadata.ts\"\nimport { RelationalNode } from \"./nodes/relational/RelationalNode.ts\"\n\nexport type Hash = Opaque<string, \"Hash\">\nfunction Hash(value: string): Hash {\n\treturn value as Hash\n}\n\n/**\n * Checks if a value is a hashable object.\n */\nfunction isHashable(value: unknown): value is Hashable {\n\treturn isObject(value) && isFunction(value.getHash)\n}\n\nexport interface Hashable {\n\t/**\n\t * Returns a hash that is used to compare objects for equality. The memo is\n\t * using this to check for duplicate nodes, and the group is using this to\n\t * get the winner for the required physical props.\n\t */\n\tgetHash(): Hash\n}\n\n/**\n * Calculates a hash for a list of values.\n */\nexport function calculateHash(name: string, ...values: unknown[]): Hash {\n\tconst hashes = values.map(value => {\n\t\t// TODO: Can we do this with TypeScript instead?\n\t\tconst isCollectionMetadata = value instanceof CollectionMetadata\n\t\tassert(!isCollectionMetadata, \"Pass CollectionMetadata.id instead\")\n\n\t\tconst isFieldMetadata = value instanceof FieldMetadata\n\t\tassert(!isFieldMetadata, \"Pass FieldMetadata.id instead\")\n\n\t\tconst isIndexMetadata = value instanceof IndexMetadata\n\t\tassert(!isIndexMetadata, \"Pass IndexMetadata.id instead\")\n\n\t\tconst isRelationalNode = value instanceof RelationalNode\n\t\tassert(!isRelationalNode, \"Pass RelationalNode.group.id instead\")\n\n\t\tconst isGroup = value instanceof Group\n\t\tassert(!isGroup, \"Pass Group.id instead\")\n\n\t\tif (isHashable(value)) {\n\t\t\treturn value.getHash()\n\t\t}\n\n\t\treturn JSON.stringify(value)\n\t})\n\n\treturn Hash(`${name}(${hashes.join(\", \")})`)\n}\n", "import type { ReactNode } from \"react\"\nimport { ControlType } from \"../../../render/types/PropertyControls.ts\"\nimport { assert } from \"../../../utils/assert.ts\"\nimport { isArray, isObject, isPromiseLike, isString } from \"../../../utils/utils.ts\"\nimport type {\n\tDatabaseArrayValue,\n\tDatabaseObjectValue,\n\tDatabaseRichTextValue,\n\tDatabaseValue,\n\tDatabaseVectorSetItemValue,\n} from \"../DatabaseValue.ts\"\nimport type { MaybeLocale, QueryExecutionOptions } from \"../QueryEngine.ts\"\nimport { getCollectionForLocale } from \"../getCollectionForLocale.ts\"\nimport { getCollectionId } from \"../getCollectionId.ts\"\nimport {\n\ttype DatabaseCollection,\n\ttype DatabaseRichTextPointer,\n\ttype DatabaseVectorSetItemPointer,\n\ttype Query,\n\tisAnyCollection,\n} from \"../types.ts\"\nimport { type Evaluate, evaluateArray, evaluateObject } from \"./Evaluate.ts\"\n\ninterface WrappedRichTextPointer {\n\tcollectionId: string\n\tpointer: DatabaseRichTextPointer\n}\n\nexport function wrapRichTextPointer(collection: DatabaseCollection, pointer: DatabaseRichTextPointer) {\n\treturn {\n\t\tcollectionId: getCollectionId(collection),\n\t\tpointer,\n\t}\n}\n\nfunction isWrappedRichTextPointer(value: DatabaseRichTextPointer): value is WrappedRichTextPointer {\n\treturn isObject(value) && isString(value.collectionId)\n}\n\ninterface WrappedVectorSetItemPointer {\n\tcollectionId: string\n\tpointer: DatabaseVectorSetItemPointer\n}\n\nexport function wrapVectorSetItemPointer(collection: DatabaseCollection, pointer: DatabaseVectorSetItemPointer) {\n\treturn {\n\t\tcollectionId: getCollectionId(collection),\n\t\tpointer,\n\t}\n}\n\nfunction isWrappedVectorSetItemPointer(value: DatabaseVectorSetItemPointer): value is WrappedVectorSetItemPointer {\n\treturn isObject(value) && isString(value.collectionId)\n}\n\nexport class Resolver {\n\treadonly collections: Map<string, DatabaseCollection>\n\n\tconstructor(\n\t\tquery: Query,\n\t\tlocale: MaybeLocale,\n\t\tprivate readonly options: QueryExecutionOptions = {},\n\t) {\n\t\tthis.collections = getCollectionsFromQuery(query, locale)\n\t}\n\n\tprivate *resolveArrayValue(value: DatabaseArrayValue): Evaluate<unknown[]> {\n\t\treturn yield* evaluateArray(\n\t\t\tvalue.value.map(item => {\n\t\t\t\treturn this.resolveValue(item)\n\t\t\t}),\n\t\t)\n\t}\n\n\tprivate *resolveObjectValue(value: DatabaseObjectValue): Evaluate<Record<string, unknown>> {\n\t\tconst result: Record<string, Evaluate<unknown>> = {}\n\n\t\tfor (const key in value.value) {\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: We are iterating over they keys.\n\t\t\tconst item = value.value[key]!\n\t\t\tresult[key] = this.resolveValue(item)\n\t\t}\n\n\t\treturn yield* evaluateObject(result)\n\t}\n\n\tprivate readonly richTextCache = new WeakMap<\n\t\tDatabaseCollection,\n\t\tMap<DatabaseRichTextPointer, unknown | Promise<unknown>>\n\t>()\n\n\tprivate loadRichTextValue(value: DatabaseRichTextValue): unknown | Promise<unknown> {\n\t\tconst wrapped = value.value\n\t\tassert(isWrappedRichTextPointer(wrapped), \"Rich text pointer must be wrapped\")\n\n\t\tconst collection = this.collections.get(wrapped.collectionId)\n\t\tassert(collection, \"Can't find collection for rich text pointer\")\n\n\t\tconst cache = this.richTextCache.get(collection) ?? new Map()\n\t\tthis.richTextCache.set(collection, cache)\n\n\t\tconst cached = cache.get(wrapped.pointer)\n\t\tif (cached) return cached\n\n\t\tconst result = this.options.richTextMode === \"raw\" ? wrapped.pointer : collection.resolveRichText(wrapped.pointer)\n\t\tcache.set(wrapped.pointer, result)\n\n\t\treturn result\n\t}\n\n\tpreloadRichTextValue(value: DatabaseRichTextValue) {\n\t\tvoid this.loadRichTextValue(value)\n\t}\n\n\tprivate *resolveRichTextValue(value: DatabaseRichTextValue): Evaluate<unknown> {\n\t\tconst result = this.loadRichTextValue(value)\n\t\tif (isPromiseLike(result)) return yield result\n\n\t\treturn result\n\t}\n\n\tprivate readonly vectorSetItemCache = new WeakMap<\n\t\tDatabaseCollection,\n\t\tMap<DatabaseVectorSetItemPointer, ReactNode | Promise<ReactNode>>\n\t>()\n\n\tprivate loadVectorSetItemValue(value: DatabaseVectorSetItemValue): ReactNode | Promise<ReactNode> {\n\t\tconst wrapped = value.value\n\t\tassert(isWrappedVectorSetItemPointer(wrapped), \"Vector set item pointer must be wrapped\")\n\n\t\tconst collection = this.collections.get(wrapped.collectionId)\n\t\tassert(collection, \"Can't find collection for vector set item pointer\")\n\t\tassert(collection.resolveVectorSetItem, \"Can't resolve vector set item pointer\")\n\n\t\tconst cache = this.vectorSetItemCache.get(collection) ?? new Map()\n\t\tthis.vectorSetItemCache.set(collection, cache)\n\n\t\tconst cached = cache.get(wrapped.pointer)\n\t\tif (cached) return cached\n\n\t\tconst result = collection.resolveVectorSetItem(wrapped.pointer)\n\t\tcache.set(wrapped.pointer, result)\n\n\t\treturn result\n\t}\n\n\tpreloadVectorSetItemValue(value: DatabaseVectorSetItemValue) {\n\t\tvoid this.loadVectorSetItemValue(value)\n\t}\n\n\tprivate *resolveVectorSetItemValue(value: DatabaseVectorSetItemValue): Evaluate<ReactNode> {\n\t\tconst result = this.loadVectorSetItemValue(value)\n\t\tif (isPromiseLike(result)) return yield result\n\n\t\treturn result\n\t}\n\n\t*resolveValue(value: DatabaseValue): Evaluate<unknown> {\n\t\tswitch (value?.type) {\n\t\t\tcase ControlType.Array:\n\t\t\t\treturn yield* this.resolveArrayValue(value)\n\n\t\t\tcase ControlType.Object:\n\t\t\t\treturn yield* this.resolveObjectValue(value)\n\n\t\t\tcase ControlType.RichText:\n\t\t\t\treturn yield* this.resolveRichTextValue(value)\n\n\t\t\tcase ControlType.VectorSetItem:\n\t\t\t\treturn yield* this.resolveVectorSetItemValue(value)\n\t\t}\n\n\t\treturn value?.value ?? null\n\t}\n}\n\nfunction getCollectionsFromQuery(query: Query, locale: MaybeLocale) {\n\tconst collections = new Map<string, DatabaseCollection>()\n\n\tfunction collect(value: unknown) {\n\t\tif (isObject(value)) {\n\t\t\tif (value.type === \"Collection\" && isAnyCollection(value.data)) {\n\t\t\t\tconst collection = getCollectionForLocale(value.data, locale)\n\t\t\t\tconst collectionId = getCollectionId(collection)\n\t\t\t\tcollections.set(collectionId, collection)\n\t\t\t} else {\n\t\t\t\tfor (const key in value) {\n\t\t\t\t\tconst property = value[key]\n\t\t\t\t\tcollect(property)\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (isArray(value)) {\n\t\t\tfor (const item of value) {\n\t\t\t\tcollect(item)\n\t\t\t}\n\t\t}\n\t}\n\n\tcollect(query)\n\n\treturn collections\n}\n", "import { ControlType } from \"../../../render/types/PropertyControls.ts\"\nimport type { Opaque } from \"../../../utils/Opaque.ts\"\nimport { assert } from \"../../../utils/assert.ts\"\nimport type { DatabaseValue } from \"../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../DatabaseValueDefinition.ts\"\nimport type { DatabaseCollection, DatabaseIndex, DatabaseItem } from \"../types.ts\"\nimport type { Hashable } from \"./Hashable.ts\"\nimport { calculateHash } from \"./Hashable.ts\"\nimport type { Ordering } from \"./Ordering.ts\"\nimport { wrapRichTextPointer, wrapVectorSetItemPointer } from \"./Resolver.ts\"\nimport type { ScalarNode } from \"./nodes/scalar/ScalarNode.ts\"\n\n/**\n * We have a special identifier called \"index\" to sort items based on the order\n * defined in the CMS. The index can only be used by the `EnforcerSort` node.\n */\nexport const VIRTUAL_INDEX_FIELD = \"index\"\n\nabstract class Metadata<T extends { id: number }> extends Set<T> implements Hashable {\n\tabstract name: string\n\n\tmerge(other: Metadata<T>) {\n\t\tfor (const item of other) {\n\t\t\tthis.add(item)\n\t\t}\n\t}\n\n\tequals(other: Metadata<T>) {\n\t\tif (this === other) return true\n\t\tif (this.size !== other.size) return false\n\n\t\tfor (const item of this) {\n\t\t\tif (!other.has(item)) return false\n\t\t}\n\n\t\treturn true\n\t}\n\n\tsubsetOf(other: Metadata<T>) {\n\t\tif (this === other) return true\n\t\tif (this.size > other.size) return false\n\n\t\tfor (const item of this) {\n\t\t\tif (!other.has(item)) return false\n\t\t}\n\n\t\treturn true\n\t}\n\n\tgetHash() {\n\t\tconst ids: number[] = []\n\n\t\tfor (const item of this) {\n\t\t\tids.push(item.id)\n\t\t}\n\n\t\t// Sort the items to ensure the hash is independent the insertion order.\n\t\tids.sort((a, b) => a - b)\n\n\t\treturn calculateHash(this.name, ...ids)\n\t}\n}\n\nexport type CollectionId = Opaque<number, \"CollectionId\">\nexport function CollectionId(id: number) {\n\treturn id as CollectionId\n}\n\nexport class CollectionMetadata {\n\treadonly indexes = new Indexes()\n\treadonly fields = new Fields()\n\n\tconstructor(\n\t\treadonly id: CollectionId,\n\t\t/**\n\t\t * The name of the field. This is only used for debugging and shouldn't\n\t\t * be used to resolve a field by its collection. To resolve a field by a\n\t\t * collection, use the `ScopeField.collectionName` instead.\n\t\t */\n\t\treadonly name: string | undefined,\n\t\t/**\n\t\t * The data from the CMS module for the collection.\n\t\t */\n\t\treadonly data: DatabaseCollection,\n\t) {}\n}\n\nexport class Collections extends Metadata<CollectionMetadata> {\n\treadonly name = \"Collections\"\n}\n\nexport type IndexId = Opaque<number, \"IndexId\">\nexport function IndexId(id: number) {\n\treturn id as IndexId\n}\n\nexport class IndexMetadata {\n\treadonly resolvedFields = new Fields()\n\n\tconstructor(\n\t\treadonly id: IndexId,\n\t\t/**\n\t\t * The data from the CMS module for the index.\n\t\t */\n\t\treadonly data: DatabaseIndex,\n\t\t/**\n\t\t * The collection that the index belongs to.\n\t\t */\n\t\treadonly collection: CollectionMetadata,\n\t\t/**\n\t\t * The lookup nodes of the index. They are used by the explorer to check\n\t\t * if the index can be used for a `RelationalIndexLookup` or\n\t\t * `RelationalLookupJoin`.\n\t\t */\n\t\treadonly lookupNodes: ScalarNode[],\n\t\t/**\n\t\t * The general constraint of the index. This is used by the explorer to\n\t\t * check if an index can be used instead of a `RelationalScan` or\n\t\t * `RelationalFilter`.\n\t\t */\n\t\treadonly constraint: ScalarNode | undefined,\n\t\t/**\n\t\t * The ordering of the index. This is used to check if an index can\n\t\t * provide the required ordering.\n\t\t */\n\t\treadonly ordering: Ordering,\n\t) {\n\t\t// Find all fields that are returned from the index. This is used to\n\t\t// check if an index can provide the required resolved fields.\n\t\tfor (const fieldName in data.schema) {\n\t\t\tfor (const field of collection.fields) {\n\t\t\t\tif (field.name === fieldName) {\n\t\t\t\t\tthis.resolvedFields.add(field)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport class Indexes extends Metadata<IndexMetadata> {\n\treadonly name = \"Indexes\"\n}\n\nexport type FieldId = Opaque<number, \"FieldId\">\nexport function FieldId(id: number) {\n\treturn id as FieldId\n}\n\nexport class FieldMetadata {\n\tconstructor(\n\t\treadonly id: FieldId,\n\t\t/**\n\t\t * The name of the field. This is only used for debugging and shouldn't\n\t\t * be used to resolve a field by its name. To resolve a field by name,\n\t\t * use the `ScopeField.name` instead.\n\t\t */\n\t\treadonly name: string | undefined,\n\t\t/**\n\t\t * The type definition of the field. Used by the normalizer to cast\n\t\t * constants to a specific type.\n\t\t */\n\t\treadonly definition: DatabaseValueDefinition,\n\t\t/**\n\t\t * The collection that the field belongs to. This is used to resolve a\n\t\t * field by the `EnforcerResolve`.\n\t\t */\n\t\treadonly collection: CollectionMetadata | undefined,\n\t) {}\n\n\tgetValue(item: DatabaseItem): DatabaseValue {\n\t\tassert(this.name, \"Can only get value of field with a name\")\n\t\tconst value = item.data[this.name]\n\n\t\tswitch (value?.type) {\n\t\t\tcase ControlType.RichText: {\n\t\t\t\tassert(this.collection, \"Rich text field must have a collection\")\n\n\t\t\t\treturn {\n\t\t\t\t\ttype: ControlType.RichText,\n\t\t\t\t\tvalue: wrapRichTextPointer(this.collection.data, value.value),\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcase ControlType.VectorSetItem: {\n\t\t\t\tassert(this.collection, \"Vector set item field must have a collection\")\n\n\t\t\t\treturn {\n\t\t\t\t\ttype: ControlType.VectorSetItem,\n\t\t\t\t\tvalue: wrapVectorSetItemPointer(this.collection.data, value.value),\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn value ?? null\n\t}\n}\n\nexport class Fields extends Metadata<FieldMetadata> {\n\treadonly name = \"Fields\"\n}\n", "import { OrderDirection } from \"../types.ts\"\nimport type { Hashable } from \"./Hashable.ts\"\nimport { calculateHash } from \"./Hashable.ts\"\nimport type { FieldMetadata, Fields } from \"./Metadata.ts\"\nimport { VIRTUAL_INDEX_FIELD } from \"./Metadata.ts\"\n\nexport class OrderingField implements Hashable {\n\tconstructor(\n\t\treadonly field: FieldMetadata,\n\t\treadonly direction: OrderDirection = OrderDirection.Ascending,\n\t) {}\n\n\tgetHash() {\n\t\treturn calculateHash(\"OrderingField\", this.field.id, this.direction)\n\t}\n}\n\n/**\n * Ordering describes how a relation should be sorted. If the ordering is empty,\n * the relation can be sorted in any order.\n */\nexport class Ordering implements Hashable {\n\treadonly fields: OrderingField[] = []\n\n\tconstructor(ordering?: Ordering) {\n\t\tif (ordering) {\n\t\t\tthis.merge(ordering)\n\t\t}\n\t}\n\n\tget length() {\n\t\treturn this.fields.length\n\t}\n\n\tgetHash() {\n\t\treturn calculateHash(\"Ordering\", ...this.fields)\n\t}\n\n\tpush(field: OrderingField) {\n\t\tthis.fields.push(field)\n\t}\n\n\tmerge(ordering: Ordering) {\n\t\tthis.fields.push(...ordering.fields)\n\t}\n\n\tequals(other: Ordering) {\n\t\tif (this === other) return true\n\t\tif (this.length !== other.length) return false\n\n\t\treturn this.getHash() === other.getHash()\n\t}\n\n\tprovidedByFields(fields: Fields) {\n\t\tfor (const { field } of this.fields) {\n\t\t\tif (fields.has(field)) continue\n\t\t\tif (field.name === VIRTUAL_INDEX_FIELD) continue\n\n\t\t\treturn false\n\t\t}\n\n\t\treturn true\n\t}\n}\n", "import type { Hashable } from \"./Hashable.ts\"\nimport { calculateHash } from \"./Hashable.ts\"\nimport type { Fields } from \"./Metadata.ts\"\nimport type { Ordering } from \"./Ordering.ts\"\nimport type { RelationalNode } from \"./nodes/relational/RelationalNode.ts\"\n\n/**\n * Required props describe the physical properties of the relation returned by a\n * relational node. Physical properties include the ordering of the relation and\n * the set of fields that have to be resolved. When a relational node can't\n * provide a required property, we wrap it with an `EnforcerNode` in the\n * optimizer.\n *\n * Physical properties are built top down. We start with a set of required\n * properties for the root node, and then recursively build up the required\n * properties for the child nodes as we optimize the query plan.\n *\n * Some nodes can pass the required properties to their children, while others\n * will add more to them. For example, a `RelationalFilter` node doesn't change\n * the ordering of the input node, but it requires that all fields referenced by\n * the predicate are resolved.\n */\nexport class RequiredProps implements Hashable {\n\tconstructor(\n\t\treadonly ordering: Ordering,\n\t\treadonly resolvedFields: Fields,\n\t) {}\n\n\tgetHash() {\n\t\treturn calculateHash(\"RequiredProps\", this.ordering, this.resolvedFields)\n\t}\n\n\t/**\n\t * Required props with no ordering and no resolved fields are considered\n\t * minimal. Every node can provide them.\n\t */\n\tget isMinimal() {\n\t\treturn this.ordering.length === 0 && this.resolvedFields.size === 0\n\t}\n\n\t/**\n\t * Checks if the node can provide the required props. If it can't, we need\n\t * to add enforcers that provides them.\n\t *\n\t * Some nodes don't provide the required props directly, but can pass them\n\t * through to their children. E.g. a `RelationalFilter` returns the relation\n\t * in the same order and with the same resolved fields as its input. These\n\t * nodes should return `true` and pass the required props to their children.\n\t */\n\tcanProvide(node: RelationalNode) {\n\t\treturn this.canProvideOrdering(node) && this.canProvideResolvedFields(node)\n\t}\n\n\t/**\n\t * Checks if the given node can provide the required ordering. If it can't,\n\t * we need to add an `EnforcerSort` node that provides it.\n\t */\n\tprivate canProvideOrdering(node: RelationalNode) {\n\t\t// All nodes can provide an arbitrary ordering.\n\t\tif (this.ordering.length === 0) return true\n\t\treturn node.canProvideOrdering(this.ordering)\n\t}\n\n\t/**\n\t * Checks if the given node can provide the required resolved fields. If it\n\t * can't, we need to add an `EnforcerResolve` node that provides it.\n\t */\n\tprivate canProvideResolvedFields(node: RelationalNode) {\n\t\t// All nodes can provide no resolved fields.\n\t\tif (this.resolvedFields.size === 0) return true\n\t\treturn node.canProvideResolvedFields(this.resolvedFields)\n\t}\n}\n", "import { assert } from \"../../../utils/assert.ts\"\nimport type { FieldMetadata } from \"./Metadata.ts\"\nimport { Fields } from \"./Metadata.ts\"\nimport { Ordering } from \"./Ordering.ts\"\nimport { RequiredProps } from \"./PhysicalProps.ts\"\nimport type { RelationalNode } from \"./nodes/relational/RelationalNode.ts\"\n\nexport type NamedFields = Record<string, FieldMetadata>\n\ninterface ScopeField {\n\t/**\n\t * The underlying field that is referenced by this scope field.\n\t */\n\treadonly field: FieldMetadata\n\t/**\n\t * The name of the field in the scope. This can be different from the name\n\t * in the `FieldMetadata` because fields can be renamed in the projection.\n\t */\n\treadonly name: string\n\t/**\n\t * The name of the collection that the fields belongs to. This can also be\n\t * different from the name in the `FieldMetadata` because fields can be\n\t * renamed in the projection.\n\t */\n\treadonly collectionName?: string\n}\n\n/**\n * The builder uses the scope to track available fields in the query. It's\n * similar to the concept of a scope in a programming language.\n *\n * Take the following query as an example:\n * ```\n * SELECT id AS article_id FROM articles\n * ORDER BY articles.title, article_id;\n * ```\n *\n * This query has two separate scopes:\n * - The first scope is for the `FROM` clause. The scope contains all fields of\n *   the articles collection.\n * - The second scope is for the `SELECT` clause. It contains the fields in the\n *   select list.\n *\n * Because the `ORDER BY` clause has access to the \"select\" scope, it can\n * resolve the `article_id` field. It can also resolve the `articles.title`\n * field because the \"from\" scope is the parent of the \"select\" scope.\n */\nexport class Scope {\n\t/**\n\t * The last node built in the scope.\n\t */\n\tprivate node: RelationalNode | undefined\n\n\t/**\n\t * Returns the last node built in the scope and removes it from the scope.\n\t * Throws an error if no node was built in the scope yet.\n\t */\n\ttakeNode() {\n\t\tconst node = this.node\n\t\tassert(node, \"Node is missing\")\n\t\tthis.node = undefined\n\t\treturn node\n\t}\n\n\t/**\n\t * Sets the last node built in the scope. Throws an error if there is\n\t * already a node in the scope.\n\t */\n\tsetNode(node: RelationalNode) {\n\t\tassert(!this.node, \"Node already set\")\n\t\tthis.node = node\n\t}\n\n\t/**\n\t * The required ordering of the scope.\n\t */\n\tprivate ordering: Ordering | undefined\n\n\tsetOrdering(ordering: Ordering) {\n\t\tthis.ordering = ordering\n\t}\n\n\t/**\n\t * A list of all fields available in the scope.\n\t */\n\tprivate readonly fields: ScopeField[] = []\n\n\tconstructor(\n\t\t/**\n\t\t * The parent scope of the current scope. All fields available in the\n\t\t * parent scope are also available in the current scope.\n\t\t */\n\t\treadonly parent?: Scope,\n\t) {}\n\n\t/**\n\t * Create a new scope with the this scope as its parent.\n\t */\n\tpush() {\n\t\treturn new Scope(this)\n\t}\n\n\t/**\n\t * Creates a new scope with the parent of the this scope as its parent.\n\t */\n\treplace() {\n\t\treturn new Scope(this.parent)\n\t}\n\n\t/**\n\t * Adds a field to this scope. Any fields that are added will be available\n\t * in the this scope and all of its children.\n\t */\n\taddField(scopeField: ScopeField) {\n\t\tthis.fields.push(scopeField)\n\t}\n\n\t/**\n\t * Merges all fields from the given scope into the this scope.\n\t */\n\taddFieldsFromScope(scope: Scope) {\n\t\tfor (const scopeField of scope.fields) {\n\t\t\tthis.addField(scopeField)\n\t\t}\n\t}\n\n\t/**\n\t * Resolves a field from this scope. If the field is not found, the parent\n\t * scope is checked. If the name of a field is ambiguous, an error is\n\t * thrown.\n\t */\n\tresolveField(name: string, collection: string | undefined): ScopeField | undefined {\n\t\tconst candidates: ScopeField[] = []\n\n\t\tfor (const field of this.fields) {\n\t\t\tif (field.name !== name) continue\n\t\t\tif (collection && field.collectionName !== collection) continue\n\n\t\t\tcandidates.push(field)\n\t\t}\n\n\t\tif (candidates.length === 1) {\n\t\t\treturn candidates[0]\n\t\t}\n\n\t\tif (candidates.length > 1) {\n\t\t\tthrow new Error(\"Ambiguous fields\")\n\t\t}\n\n\t\treturn this.parent?.resolveField(name, collection)\n\t}\n\n\t/**\n\t * Checks if the scope or any parent scope has the given scope field.\n\t */\n\thas(scopeField: ScopeField): boolean {\n\t\tif (this.fields.includes(scopeField)) {\n\t\t\treturn true\n\t\t}\n\n\t\treturn this.parent?.has(scopeField) ?? false\n\t}\n\n\t/**\n\t * Returns the required ordering for the scope.\n\t */\n\tgetRequiredOrdering() {\n\t\treturn this.ordering ?? new Ordering()\n\t}\n\n\t/**\n\t * Returns the required resolved fields for the scope.\n\t */\n\tgetRequiredResolvedFields() {\n\t\tconst resolvedFields = new Fields()\n\n\t\tfor (const { field } of this.fields) {\n\t\t\tif (field.collection) {\n\t\t\t\tresolvedFields.add(field)\n\t\t\t}\n\t\t}\n\n\t\treturn resolvedFields\n\t}\n\n\t/**\n\t * Returns the set of required physical props for this scope. This is used\n\t * to create the required props for the root node in the optimizer.\n\t */\n\tgetRequiredProps() {\n\t\tconst ordering = this.getRequiredOrdering()\n\t\tconst resolvedFields = this.getRequiredResolvedFields()\n\t\treturn new RequiredProps(ordering, resolvedFields)\n\t}\n\n\t/**\n\t * Returns a map of the fields in this scope, with their scope names as\n\t * keys. This is used to create the final `QueryResult` with the correct\n\t * field names.\n\t */\n\tgetNamedFields() {\n\t\tconst namedFields: NamedFields = {}\n\n\t\tfor (const { name, field } of this.fields) {\n\t\t\tnamedFields[name] = field\n\t\t}\n\n\t\treturn namedFields\n\t}\n\n\t/**\n\t * Returns the single field from this scope if it only contains one field.\n\t * Throws an error if there are more than one fields.\n\t */\n\tgetSingleField(): FieldMetadata {\n\t\tassert(this.fields.length === 1, \"Scope must contain exactly one field\")\n\n\t\tconst scopeField = this.fields[0]\n\t\tassert(scopeField, \"Field must exist\")\n\n\t\treturn scopeField.field\n\t}\n}\n", "import type { DatabaseValue } from \"../DatabaseValue.ts\"\nimport type { DatabaseItemPointer } from \"../types.ts\"\nimport type { CollectionMetadata, FieldMetadata } from \"./Metadata.ts\"\nimport { Fields } from \"./Metadata.ts\"\n\n/**\n * A tuple is a single item in a relation. It contains the values for each field\n * and the pointers for each collection.\n */\nexport class Tuple {\n\treadonly pointers = new Map<CollectionMetadata, DatabaseItemPointer>()\n\treadonly values = new Map<FieldMetadata, DatabaseValue>()\n\n\tgetKey() {\n\t\tconst result: string[] = []\n\n\t\tfor (const [collection, pointer] of this.pointers) {\n\t\t\tresult.push(`${collection.id}-${pointer}`)\n\t\t}\n\n\t\treturn result.sort().join(\"-\")\n\t}\n\n\taddValue(field: FieldMetadata, value: DatabaseValue) {\n\t\tthis.values.set(field, value)\n\t}\n\n\tgetValue(field: FieldMetadata) {\n\t\treturn this.values.get(field) ?? null\n\t}\n\n\tmergeValues(tuple: Tuple) {\n\t\tfor (const [field, value] of tuple.values) {\n\t\t\tthis.addValue(field, value)\n\t\t}\n\t}\n\n\taddPointer(collection: CollectionMetadata, pointer: DatabaseItemPointer) {\n\t\tthis.pointers.set(collection, pointer)\n\t}\n\n\tgetPointer(collection: CollectionMetadata) {\n\t\treturn this.pointers.get(collection)\n\t}\n\n\tmergePointers(tuple: Tuple) {\n\t\tfor (const [collection, pointer] of tuple.pointers) {\n\t\t\tthis.addPointer(collection, pointer)\n\t\t}\n\t}\n\n\tmerge(tuple: Tuple) {\n\t\tthis.mergeValues(tuple)\n\t\tthis.mergePointers(tuple)\n\t}\n}\n\n/**\n * A relation is the list of tuples returned by a relational node. We use the\n * name relation to distinguish them from the raw items returned by the CMS\n * module.\n */\nexport class Relation {\n\tconstructor(\n\t\treadonly fields: Fields,\n\t\treadonly tuples: Tuple[] = [],\n\t) {}\n\n\tpush(tuple: Tuple) {\n\t\tthis.tuples.push(tuple)\n\t}\n\n\tfilter(predicate: (tuple: Tuple, index: number) => boolean) {\n\t\tconst tuples = this.tuples.filter(predicate)\n\t\treturn new Relation(this.fields, tuples)\n\t}\n\n\tmap(fields: Fields, callback: (tuple: Tuple, index: number) => Tuple) {\n\t\tconst tuples = this.tuples.map(callback)\n\t\treturn new Relation(fields, tuples)\n\t}\n\n\tsort(callback: (left: Tuple, right: Tuple) => number) {\n\t\tconst tuples = Array.from(this.tuples).sort(callback)\n\t\treturn new Relation(this.fields, tuples)\n\t}\n\n\tslice(start: number, end?: number) {\n\t\tconst tuples = this.tuples.slice(start, end)\n\t\treturn new Relation(this.fields, tuples)\n\t}\n\n\tunion(other: Relation) {\n\t\tconst fields = new Fields()\n\n\t\tfor (const field of this.fields) {\n\t\t\tif (other.fields.has(field)) {\n\t\t\t\tfields.add(field)\n\t\t\t}\n\t\t}\n\n\t\tconst keys = new Set<string>()\n\t\tconst result = new Relation(fields)\n\n\t\tfor (const tuple of this.tuples) {\n\t\t\tconst key = tuple.getKey()\n\t\t\tkeys.add(key)\n\t\t\tresult.push(tuple)\n\t\t}\n\n\t\tfor (const tuple of other.tuples) {\n\t\t\tconst key = tuple.getKey()\n\t\t\tif (keys.has(key)) continue\n\t\t\tresult.push(tuple)\n\t\t}\n\n\t\treturn result\n\t}\n\n\tintersection(other: Relation) {\n\t\tconst fields = new Fields()\n\n\t\tfor (const field of this.fields) {\n\t\t\tif (other.fields.has(field)) {\n\t\t\t\tfields.add(field)\n\t\t\t}\n\t\t}\n\n\t\tconst keys = new Set<string>()\n\t\tconst result = new Relation(fields)\n\n\t\tfor (const tuple of this.tuples) {\n\t\t\tconst key = tuple.getKey()\n\t\t\tkeys.add(key)\n\t\t}\n\n\t\tfor (const tuple of other.tuples) {\n\t\t\tconst key = tuple.getKey()\n\t\t\tif (!keys.has(key)) continue\n\t\t\tresult.push(tuple)\n\t\t}\n\n\t\treturn result\n\t}\n}\n", "import { assert } from \"../../../../../utils/assert.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateArray, evaluateObject } from \"../../Evaluate.ts\"\nimport type { Group } from \"../../Group.ts\"\nimport type { Hashable } from \"../../Hashable.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport type { FieldMetadata } from \"../../Metadata.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Ordering } from \"../../Ordering.ts\"\nimport { RequiredProps } from \"../../PhysicalProps.ts\"\nimport type { Relation } from \"../../Relation.ts\"\nimport { Tuple } from \"../../Relation.ts\"\nimport type { ScalarNode } from \"../scalar/ScalarNode.ts\"\nimport { RelationalNode } from \"./RelationalNode.ts\"\n\nexport class ProjectionField implements Hashable {\n\tconstructor(\n\t\treadonly input: ScalarNode,\n\t\treadonly field: FieldMetadata,\n\t) {}\n\n\tgetHash() {\n\t\treturn calculateHash(\"ProjectionField\", this.input, this.field.id)\n\t}\n}\n\nexport class RelationalProject extends RelationalNode {\n\treadonly inputGroup: Group\n\n\tconstructor(\n\t\treadonly input: RelationalNode,\n\t\treadonly projections: ProjectionField[],\n\t\treadonly passthrough: Fields,\n\t) {\n\t\tlet isSynchronous = input.isSynchronous\n\n\t\tfor (const projection of projections) {\n\t\t\tisSynchronous &&= projection.input.isSynchronous\n\t\t}\n\n\t\tsuper(isSynchronous)\n\n\t\tthis.inputGroup = input.getGroup()\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"RelationalProject\", this.inputGroup.id, ...this.projections, this.passthrough)\n\t}\n\n\toverride getOutputFields() {\n\t\tconst fields = new Fields()\n\t\tfields.merge(this.passthrough)\n\n\t\tfor (const projection of this.projections) {\n\t\t\tfields.add(projection.field)\n\t\t}\n\n\t\treturn fields\n\t}\n\n\toverride canProvideOrdering(ordering: Ordering) {\n\t\tconst projectionFields = new Fields()\n\n\t\tfor (const projection of this.projections) {\n\t\t\tprojectionFields.add(projection.field)\n\t\t}\n\n\t\t// If the ordering depends on a projection field, we can't sort before evaluating the projection.\n\t\tfor (const { field } of ordering.fields) {\n\t\t\tif (projectionFields.has(field)) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\n\t\treturn true\n\t}\n\n\toverride canProvideResolvedFields() {\n\t\treturn true\n\t}\n\n\tprivate getInputRequiredProps(required: RequiredProps) {\n\t\tconst resolvedFields = new Fields(required.resolvedFields)\n\n\t\tfor (const projection of this.projections) {\n\t\t\tresolvedFields.merge(projection.input.referencedFields)\n\t\t\tresolvedFields.delete(projection.field)\n\t\t}\n\n\t\treturn new RequiredProps(required.ordering, resolvedFields)\n\t}\n\n\toverride optimize(optimizer: Optimizer, required: RequiredProps) {\n\t\tconst inputRequired = this.getInputRequiredProps(required)\n\t\tconst inputCost = optimizer.optimizeGroup(this.inputGroup, inputRequired)\n\n\t\tlet projectionsCost = new Cost(0)\n\t\tfor (const projection of this.projections) {\n\t\t\tconst projectionCost = projection.input.optimize(optimizer)\n\t\t\tprojectionsCost = Cost.max(projectionsCost, projectionCost)\n\t\t}\n\n\t\treturn new Cost(0).add(Cost.max(inputCost, projectionsCost))\n\t}\n\n\toverride getOptimized(required: RequiredProps) {\n\t\tconst inputRequired = this.getInputRequiredProps(required)\n\t\tconst input = this.inputGroup.getOptimized(inputRequired)\n\n\t\tconst projections = this.projections.map(projection => {\n\t\t\tconst projectionInput = projection.input.getOptimized()\n\t\t\treturn new ProjectionField(projectionInput, projection.field)\n\t\t})\n\n\t\treturn new RelationalProject(input, projections, this.passthrough)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined): Evaluate<Relation> {\n\t\tconst outputFields = this.getOutputFields()\n\n\t\tconst input = yield* this.input.evaluate(context)\n\n\t\tconst projectedValues = yield* evaluateArray(\n\t\t\tinput.tuples.map(tuple =>\n\t\t\t\tevaluateArray(\n\t\t\t\t\tthis.projections.map(projection =>\n\t\t\t\t\t\tevaluateObject({\n\t\t\t\t\t\t\tfield: projection.field,\n\t\t\t\t\t\t\tvalue: projection.input.evaluate(context, tuple),\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t),\n\t\t)\n\n\t\treturn input.map(outputFields, (tuple, index) => {\n\t\t\tconst result = new Tuple()\n\t\t\tresult.mergePointers(tuple)\n\n\t\t\tfor (const field of this.passthrough) {\n\t\t\t\tconst value = tuple.getValue(field)\n\t\t\t\tresult.addValue(field, value)\n\t\t\t}\n\n\t\t\tconst projections = projectedValues[index]\n\t\t\tassert(projections, \"Projections must exist\")\n\n\t\t\tfor (const { field, value } of projections) {\n\t\t\t\tresult.addValue(field, value)\n\t\t\t}\n\n\t\t\treturn result\n\t\t})\n\t}\n}\n", "import type { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport type { DatabaseCollation } from \"../../../types.ts\"\nimport { DatabaseCollationType } from \"../../../types.ts\"\nimport type { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateAsync, evaluateSync } from \"../../Evaluate.ts\"\nimport type { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { AbstractNode } from \"../AbstractNode.ts\"\n\nexport const collation: DatabaseCollation = {\n\ttype: DatabaseCollationType.CaseInsensitive,\n}\n\nexport abstract class ScalarNode extends AbstractNode {\n\tabstract readonly definition: DatabaseValueDefinition\n\n\tconstructor(\n\t\t/**\n\t\t * Contains all fields from the current scope that are referenced by\n\t\t * this node or its descendants.\n\t\t */\n\t\treadonly referencedFields: Fields,\n\t\t/**\n\t\t * Contains all fields from the parent scope that are referenced by this\n\t\t * node or its descendants.\n\t\t */\n\t\treadonly referencedOuterFields: Fields,\n\t\t/**\n\t\t * Most scalar nodes with the exception of `ScalarSubquery` can be\n\t\t * evaluated synchronously. Synchronous nodes can be pre-evaluated in\n\t\t * the normalizer if they don't reference any fields.\n\t\t */\n\t\toverride readonly isSynchronous: boolean,\n\t) {\n\t\tsuper(isSynchronous)\n\t}\n\n\t/**\n\t * Evaluates the node and all children synchronously. Throws an error if the\n\t * node is not synchronous.\n\t */\n\tevaluateSync() {\n\t\tconst generator = this.evaluate(undefined, undefined)\n\t\treturn evaluateSync(generator)\n\t}\n\n\t/**\n\t * Evaluates the node and all children asynchronously.\n\t */\n\tevaluateAsync() {\n\t\tconst generator = this.evaluate(undefined, undefined)\n\t\treturn evaluateAsync(generator)\n\t}\n\n\t/**\n\n     * Optimizes all children and calculates the cost of the node.\n     */\n\tabstract optimize(optimizer: Optimizer): Cost\n\n\t/**\n\t * Returns an optimized version of the node with all children replaced by\n\t * their lowest cost alternatives.\n\t */\n\tabstract getOptimized(): ScalarNode\n\n\t/**\n\t * Evaluates the node and all children. This returns a generator so the\n\t * implementation can be either synchronous or asynchronous as indicated by\n\t * the `isSynchronous` property.\n\t */\n\tabstract evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue>\n}\n", "import { DatabaseValue, valueToBoolean } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport type { DatabaseCollation } from \"../../../types.ts\"\nimport { DatabaseCollationType } from \"../../../types.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateArray, evaluateObject } from \"../../Evaluate.ts\"\nimport type { Hashable } from \"../../Hashable.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nconst collation: DatabaseCollation = {\n\ttype: DatabaseCollationType.CaseInsensitive,\n}\n\nexport class CaseCondition implements Hashable {\n\tconstructor(\n\t\treadonly when: ScalarNode,\n\t\treadonly then: ScalarNode,\n\t) {}\n\n\tgetHash() {\n\t\treturn calculateHash(\"CaseCondition\", this.when, this.then)\n\t}\n}\n\nexport class ScalarCase extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: \"unknown\",\n\t\tisNullable: true,\n\t}\n\n\tconstructor(\n\t\treadonly input: ScalarNode | undefined,\n\t\treadonly conditions: CaseCondition[],\n\t\treadonly otherwise: ScalarNode | undefined,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\tconst referencedOuterFields = new Fields()\n\n\t\tlet isSynchronous = true\n\n\t\tif (input) {\n\t\t\treferencedFields.merge(input.referencedFields)\n\t\t\treferencedOuterFields.merge(input.referencedOuterFields)\n\t\t\tisSynchronous &&= input.isSynchronous\n\t\t}\n\n\t\tfor (const { when, then } of conditions) {\n\t\t\treferencedFields.merge(when.referencedFields)\n\t\t\treferencedOuterFields.merge(when.referencedOuterFields)\n\t\t\tisSynchronous &&= when.isSynchronous\n\n\t\t\treferencedFields.merge(then.referencedFields)\n\t\t\treferencedOuterFields.merge(then.referencedOuterFields)\n\t\t\tisSynchronous &&= then.isSynchronous\n\t\t}\n\n\t\tif (otherwise) {\n\t\t\treferencedFields.merge(otherwise.referencedFields)\n\t\t\treferencedOuterFields.merge(otherwise.referencedOuterFields)\n\t\t\tisSynchronous &&= otherwise.isSynchronous\n\t\t}\n\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarCase\", this.input, ...this.conditions, this.otherwise)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tthis.input?.optimize(optimizer)\n\n\t\tfor (const condition of this.conditions) {\n\t\t\tcondition.when.optimize(optimizer)\n\t\t\tcondition.then.optimize(optimizer)\n\t\t}\n\n\t\tthis.otherwise?.optimize(optimizer)\n\n\t\t// TODO: Calculate cost based on inputs\n\t\treturn new Cost(0)\n\t}\n\n\toverride getOptimized() {\n\t\tconst input = this.input?.getOptimized()\n\n\t\tconst conditions = this.conditions.map(condition => {\n\t\t\tconst when = condition.when.getOptimized()\n\t\t\tconst then = condition.then.getOptimized()\n\t\t\treturn new CaseCondition(when, then)\n\t\t})\n\n\t\tconst otherwise = this.otherwise?.getOptimized()\n\n\t\treturn new ScalarCase(input, conditions, otherwise)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { input, conditions, otherwise } = yield* evaluateObject({\n\t\t\tinput: this.input?.evaluate(context, tuple) ?? null,\n\t\t\tconditions: evaluateArray(\n\t\t\t\tthis.conditions.map(condition =>\n\t\t\t\t\tevaluateObject({\n\t\t\t\t\t\twhen: condition.when.evaluate(context, tuple),\n\t\t\t\t\t\t// biome-ignore lint/suspicious/noThenProperty: Existing name.\n\t\t\t\t\t\tthen: condition.then.evaluate(context, tuple),\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t),\n\t\t\totherwise: this.otherwise?.evaluate(context, tuple) ?? null,\n\t\t})\n\n\t\tif (this.input) {\n\t\t\tfor (const { when, then } of conditions) {\n\t\t\t\tif (DatabaseValue.equal(input, when, collation)) {\n\t\t\t\t\treturn then\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfor (const { when, then } of conditions) {\n\t\t\t\tif (valueToBoolean(when)) {\n\t\t\t\t\treturn then\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn otherwise\n\t}\n}\n", "import { ControlType } from \"../../../render/types/PropertyControls.ts\"\nimport { assert, assertNever } from \"../../../utils/assert.ts\"\nimport { isUndefined } from \"../../../utils/utils.ts\"\nimport { DatabaseValue } from \"../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../DatabaseValueDefinition.ts\"\nimport { unknownDefinition } from \"../DatabaseValueDefinition.ts\"\nimport type { MaybeLocale } from \"../QueryEngine.ts\"\nimport { getCollectionForLocale } from \"../getCollectionForLocale.ts\"\nimport type {\n\tBinaryOperation,\n\tCase,\n\tCollection,\n\tExpression,\n\tFrom,\n\tFunctionCall,\n\tIdentifier,\n\tJoin,\n\tLiteralValue,\n\tQuery,\n\tSelect,\n\tSelectExpression,\n\tTypeCast,\n\tUnaryOperation,\n} from \"../types.ts\"\nimport { BinaryOperator, DataType, FunctionName, UnaryOperator } from \"../types.ts\"\nimport {\n\tCollectionId,\n\tCollectionMetadata,\n\tFieldId,\n\tFieldMetadata,\n\tFields,\n\tIndexId,\n\tIndexMetadata,\n\tVIRTUAL_INDEX_FIELD,\n} from \"./Metadata.ts\"\nimport type { Normalizer } from \"./Normalizer.ts\"\nimport { Ordering, OrderingField } from \"./Ordering.ts\"\nimport { Scope } from \"./Scope.ts\"\nimport type { RelationalNode } from \"./nodes/relational/RelationalNode.ts\"\nimport { ProjectionField } from \"./nodes/relational/RelationalProject.ts\"\nimport { CaseCondition } from \"./nodes/scalar/ScalarCase.ts\"\nimport type { ScalarNode } from \"./nodes/scalar/ScalarNode.ts\"\n\n/**\n * The builder creates the initial normalized query plan for a query. While\n * doing that, it populates the memo.\n *\n * Like programming languages, SQL has a concept of \"scope\". The builder is\n * responsible for creating the correct scope for each part in the query.\n *\n * For example, in the following query:\n * ```\n * SELECT articles.title AS title, authors.name AS author\n * FROM articles JOIN authors ON articles.author_id = authors.id\n * ORDER BY author, title;\n * ```\n *\n * The builder will start with the `FROM` clause. It builds the left and right\n * side of the join, and creates a scope for each of the two collections. The\n * fields of both scopes are added to the \"from\" scope. This scope is then used\n * to resolve fields in the `ON` clause of the join.\n *\n * The builder continues with the `SELECT` clause, and creates a new scope for\n * the projection. Because the \"from\" scope is the parent, all fields of it are\n * also available in the \"projection\" scope. Every field in the `SELECT` clause is\n * added to the \"projection\" scope, which is then used to build the `ORDER BY`\n * clause.\n */\nexport class Builder {\n\tprivate collectionId = 0\n\tprivate indexId = 0\n\tprivate fieldId = 0\n\n\t/**\n\t * A stack of the subqueries that are currently being built. We use this to\n\t * calculate fields that come from the enclosing scope or from inside the\n\t * subquery.\n\t */\n\tprivate subqueries: Subquery[] = []\n\n\tconstructor(\n\t\treadonly normalizer: Normalizer,\n\t\treadonly query: Query,\n\t\treadonly locale: MaybeLocale,\n\t) {}\n\n\tbuild() {\n\t\tconst inScope = new Scope()\n\t\treturn this.buildQuery(inScope, this.query)\n\t}\n\n\tprivate buildQuery(inScope: Scope, query: Query) {\n\t\tconst select: Select = { type: \"Select\", ...query }\n\t\treturn this.buildSelect(inScope, select)\n\t}\n\n\tprivate buildSelect(inScope: Scope, select: Select) {\n\t\tconst fromScope = this.buildFrom(inScope, select.from)\n\t\tconst defaultOrdering = fromScope.getRequiredOrdering()\n\n\t\tif (select.where) {\n\t\t\tconst input = fromScope.takeNode()\n\t\t\tconst predicate = this.buildExpression(fromScope, select.where)\n\t\t\tconst node = this.normalizer.newRelationalFilter(input, predicate)\n\t\t\tfromScope.setNode(node)\n\t\t}\n\n\t\tconst orderProjections: ProjectionField[] = []\n\t\tconst orderFields = new Fields()\n\t\tlet ordering: Ordering\n\n\t\tif (select.orderBy) {\n\t\t\tordering = new Ordering()\n\n\t\t\tfor (const order of select.orderBy) {\n\t\t\t\tif (order.type === \"Identifier\") {\n\t\t\t\t\tconst scopeField = fromScope.resolveField(order.name, order.collection)\n\t\t\t\t\tif (isUndefined(scopeField)) continue\n\n\t\t\t\t\torderFields.add(scopeField.field)\n\n\t\t\t\t\tconst orderingField = new OrderingField(scopeField.field, order.direction)\n\t\t\t\t\tordering.push(orderingField)\n\t\t\t\t} else {\n\t\t\t\t\tconst expression = this.buildExpression(fromScope, order)\n\n\t\t\t\t\tconst fieldId = FieldId(this.fieldId++)\n\t\t\t\t\tconst field = new FieldMetadata(fieldId, undefined, expression.definition, undefined)\n\n\t\t\t\t\tconst projection = new ProjectionField(expression, field)\n\t\t\t\t\torderProjections.push(projection)\n\n\t\t\t\t\tconst orderingField = new OrderingField(field, order.direction)\n\t\t\t\t\tordering.push(orderingField)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tordering.merge(defaultOrdering)\n\t\t} else {\n\t\t\tordering = defaultOrdering\n\t\t}\n\n\t\tconst projectionScope = this.buildSelectList(fromScope, select.select, orderFields, orderProjections)\n\t\tprojectionScope.setOrdering(ordering)\n\n\t\tif (select.offset) {\n\t\t\tconst input = projectionScope.takeNode()\n\t\t\tconst offset = this.buildExpression(inScope, select.offset)\n\t\t\tconst node = this.normalizer.newRelationalOffset(input, offset, ordering)\n\t\t\tprojectionScope.setNode(node)\n\t\t}\n\n\t\tif (select.limit) {\n\t\t\tconst input = projectionScope.takeNode()\n\t\t\tconst limit = this.buildExpression(inScope, select.limit)\n\t\t\tconst node = this.normalizer.newRelationalLimit(input, limit, ordering)\n\t\t\tprojectionScope.setNode(node)\n\t\t}\n\n\t\treturn projectionScope\n\t}\n\n\tprivate buildSelectList(\n\t\tinScope: Scope,\n\t\tselects: SelectExpression[],\n\t\torderFields: Fields,\n\t\torderProjections: ProjectionField[],\n\t) {\n\t\tconst outScope = inScope.push()\n\n\t\tconst passthrough = new Fields(orderFields)\n\t\tconst projections: ProjectionField[] = [...orderProjections]\n\n\t\tfor (const select of selects) {\n\t\t\tif (select.type === \"Identifier\") {\n\t\t\t\tconst scopeField = inScope.resolveField(select.name, select.collection)\n\t\t\t\t// TODO: What if the field is not found?\n\t\t\t\tif (isUndefined(scopeField)) continue\n\n\t\t\t\tpassthrough.add(scopeField.field)\n\n\t\t\t\toutScope.addField({ ...scopeField, name: select.alias ?? scopeField.name })\n\t\t\t} else {\n\t\t\t\tconst expression = this.buildExpression(inScope, select)\n\t\t\t\tassert(select.alias, \"Subqueries should have an alias\")\n\n\t\t\t\t// Create a unique id for the field.\n\t\t\t\tconst fieldId = FieldId(this.fieldId++)\n\t\t\t\tconst fieldName = select.alias\n\t\t\t\t// Store the field in the metadata.\n\t\t\t\tconst field = new FieldMetadata(fieldId, fieldName, expression.definition, undefined)\n\n\t\t\t\tconst projection = new ProjectionField(expression, field)\n\t\t\t\tprojections.push(projection)\n\n\t\t\t\t// Add the field to the scope to resolve identifiers later.\n\t\t\t\toutScope.addField({\n\t\t\t\t\tfield,\n\t\t\t\t\tname: fieldName,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\tconst input = inScope.takeNode()\n\t\tconst node = this.normalizer.newRelationalProject(input, projections, passthrough)\n\t\toutScope.setNode(node)\n\n\t\treturn outScope\n\t}\n\n\tprivate buildFrom(inScope: Scope, from: From) {\n\t\tswitch (from.type) {\n\t\t\tcase \"Collection\":\n\t\t\t\treturn this.buildCollection(inScope, from)\n\n\t\t\tcase \"LeftJoin\":\n\t\t\t\treturn this.buildJoin(inScope, from)\n\n\t\t\tdefault:\n\t\t\t\tassertNever(from, \"Unsupported from type\")\n\t\t}\n\t}\n\n\tprivate buildCollection(inScope: Scope, from: Collection) {\n\t\tconst outScope = inScope.push()\n\n\t\tconst collectionData = getCollectionForLocale(from.data, this.locale)\n\t\tconst collectionName = from.alias\n\n\t\t// Create a unique id for the collection.\n\t\tconst collectionId = CollectionId(this.collectionId++)\n\t\t// Store the collection in the metadata.\n\t\tconst collection = new CollectionMetadata(collectionId, collectionName, collectionData)\n\n\t\tfor (const [fieldName, definition] of Object.entries(collectionData.schema)) {\n\t\t\t// Create a unique id for the field.\n\t\t\tconst fieldId = FieldId(this.fieldId++)\n\t\t\t// Store the field in the metadata.\n\t\t\tconst field = new FieldMetadata(fieldId, fieldName, definition, collection)\n\n\t\t\t// Add the field to the scope to resolve identifiers later.\n\t\t\toutScope.addField({\n\t\t\t\tfield,\n\t\t\t\tname: fieldName,\n\t\t\t\tcollectionName,\n\t\t\t})\n\n\t\t\t// Add the field to the collection.\n\t\t\tcollection.fields.add(field)\n\t\t}\n\n\t\t// Create a virtual index field that can be only used in the `ORDER BY`\n\t\t// clause by the `EnforcerSort` node.\n\t\t{\n\t\t\tconst definition: DatabaseValueDefinition = { type: ControlType.Number, isNullable: false }\n\t\t\t// Create a unique id for the field.\n\t\t\tconst fieldId = FieldId(this.fieldId++)\n\t\t\t// Store the field in the metadata.\n\t\t\tconst field = new FieldMetadata(fieldId, VIRTUAL_INDEX_FIELD, definition, collection)\n\n\t\t\t// Add the field to the scope to resolve identifiers later.\n\t\t\toutScope.addField({\n\t\t\t\tfield,\n\t\t\t\tname: VIRTUAL_INDEX_FIELD,\n\t\t\t\tcollectionName,\n\t\t\t})\n\n\t\t\t// Store the default ordering of the collection in the scope.\n\t\t\tconst ordering = new Ordering()\n\t\t\tconst orderingField = new OrderingField(field)\n\t\t\tordering.push(orderingField)\n\t\t\toutScope.setOrdering(ordering)\n\t\t}\n\n\t\tfor (const indexData of collectionData.indexes) {\n\t\t\t// Create lookup nodes of the index. They are used by the explorer\n\t\t\t// to check if the index can be used for a `RelationalIndexLookup`\n\t\t\t// or `RelationalLookupJoin`.\n\t\t\tconst lookupNodes: ScalarNode[] = []\n\t\t\tfor (const expression of indexData.fields) {\n\t\t\t\tconst node = this.buildExpression(outScope, expression)\n\t\t\t\tlookupNodes.push(node)\n\t\t\t}\n\n\t\t\t// Create the constraint of the index. This is used by the explorer\n\t\t\t// to check if an index can be used instead of a `RelationalScan` or\n\t\t\t// `RelationalFilter`.\n\t\t\tlet constraint: ScalarNode | undefined\n\t\t\tif (indexData.where) {\n\t\t\t\tconstraint = this.buildExpression(outScope, indexData.where)\n\t\t\t}\n\n\t\t\t// Create the ordering of the index. This is used to check if an\n\t\t\t// index can provide the required ordering.\n\t\t\tconst ordering = new Ordering()\n\t\t\t// TODO: Add ordering to the metadata.\n\n\t\t\t// Create a unique id for the index.\n\t\t\tconst indexId = IndexId(this.indexId++)\n\t\t\t// Store the index in the metadata.\n\t\t\tconst index = new IndexMetadata(indexId, indexData, collection, lookupNodes, constraint, ordering)\n\n\t\t\t// Add the index to the collection.\n\t\t\tcollection.indexes.add(index)\n\t\t}\n\n\t\tconst node = this.normalizer.newRelationalScan(collection)\n\t\toutScope.setNode(node)\n\n\t\treturn outScope\n\t}\n\n\tprivate buildJoin(inScope: Scope, from: Join) {\n\t\tconst leftScope = this.buildFrom(inScope, from.left)\n\t\tconst rightScope = this.buildFrom(inScope, from.right)\n\n\t\t// Store the default ordering of the join in the scope.\n\t\tconst ordering = new Ordering()\n\t\tconst leftOrdering = leftScope.getRequiredOrdering()\n\t\tordering.merge(leftOrdering)\n\t\tconst rightOrdering = rightScope.getRequiredOrdering()\n\t\tordering.merge(rightOrdering)\n\n\t\tconst outScope = inScope.push()\n\t\toutScope.addFieldsFromScope(leftScope)\n\t\toutScope.addFieldsFromScope(rightScope)\n\t\toutScope.setOrdering(ordering)\n\n\t\tconst constraint = this.buildExpression(outScope, from.constraint)\n\n\t\tconst left = leftScope.takeNode()\n\t\tconst right = rightScope.takeNode()\n\n\t\tlet node: RelationalNode\n\n\t\tswitch (from.type) {\n\t\t\tcase \"LeftJoin\":\n\t\t\t\tnode = this.normalizer.newRelationalLeftJoin(left, right, constraint)\n\t\t\t\tbreak\n\n\t\t\tdefault:\n\t\t\t\tassertNever(from.type, \"Unsupported join type\")\n\t\t}\n\n\t\toutScope.setNode(node)\n\n\t\treturn outScope\n\t}\n\n\tprivate buildExpression(inScope: Scope, expression: Expression): ScalarNode {\n\t\tswitch (expression.type) {\n\t\t\tcase \"Identifier\":\n\t\t\t\treturn this.buildIdentifier(inScope, expression)\n\n\t\t\tcase \"LiteralValue\":\n\t\t\t\treturn this.buildLiteralValue(expression)\n\n\t\t\tcase \"FunctionCall\":\n\t\t\t\treturn this.buildFunctionCall(inScope, expression)\n\n\t\t\tcase \"Case\":\n\t\t\t\treturn this.buildCase(inScope, expression)\n\n\t\t\tcase \"UnaryOperation\":\n\t\t\t\treturn this.buildUnaryOperation(inScope, expression)\n\n\t\t\tcase \"BinaryOperation\":\n\t\t\t\treturn this.buildBinaryOperation(inScope, expression)\n\n\t\t\tcase \"TypeCast\":\n\t\t\t\treturn this.buildTypeCast(inScope, expression)\n\n\t\t\tcase \"Select\":\n\t\t\t\tthrow new Error(\"Subqueries are only supported inside subquery function calls\")\n\n\t\t\tdefault:\n\t\t\t\tassertNever(expression, \"Unsupported expression\")\n\t\t}\n\t}\n\n\tprivate buildIdentifier(inScope: Scope, expression: Identifier): ScalarNode {\n\t\tconst scopeField = inScope.resolveField(expression.name, expression.collection)\n\n\t\tif (scopeField) {\n\t\t\tlet isOuterField = false\n\n\t\t\t// TODO: This is a bit wasteful, because we traverse through all\n\t\t\t// parent scopes in `.has()`. This is because every subquery can\n\t\t\t// consist of multiple scopes (the from scope and projection scope).\n\t\t\t// If we reduce this to a single scope, we could avoid walking all\n\t\t\t// parents.\n\t\t\tfor (const subquery of this.subqueries) {\n\t\t\t\tif (isOuterField) {\n\t\t\t\t\tsubquery.referencedOuterFields.add(scopeField.field)\n\t\t\t\t} else {\n\t\t\t\t\tisOuterField = subquery.inScope.has(scopeField)\n\n\t\t\t\t\tif (isOuterField) {\n\t\t\t\t\t\tsubquery.referencedFields.add(scopeField.field)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn this.normalizer.newScalarVariable(scopeField.field, isOuterField)\n\t\t}\n\n\t\treturn this.normalizer.newScalarConstant(unknownDefinition, null)\n\t}\n\n\tprivate buildLiteralValue(expression: LiteralValue): ScalarNode {\n\t\tconst value = DatabaseValue.parse(expression.value)\n\n\t\t// Always create a `ScalarConstant` node with an unknown type. They are\n\t\t// cast to a more specific type in `Normalizer.removeUnknown`.\n\t\treturn this.normalizer.newScalarConstant(unknownDefinition, value)\n\t}\n\n\tprivate buildFunctionCall(inScope: Scope, expression: FunctionCall): ScalarNode {\n\t\tconst getArgument = (index: number) => {\n\t\t\tconst argument = expression.arguments[index]\n\t\t\tassert(argument, \"Missing argument\")\n\t\t\treturn this.buildExpression(inScope, argument)\n\t\t}\n\n\t\tconst functionName = expression.functionName as FunctionName\n\n\t\tswitch (functionName) {\n\t\t\tcase FunctionName.Contains: {\n\t\t\t\tconst source = getArgument(0)\n\t\t\t\tconst target = getArgument(1)\n\t\t\t\treturn this.normalizer.newScalarContains(source, target)\n\t\t\t}\n\n\t\t\tcase FunctionName.StartsWith: {\n\t\t\t\tconst source = getArgument(0)\n\t\t\t\tconst target = getArgument(1)\n\t\t\t\treturn this.normalizer.newScalarStartsWith(source, target)\n\t\t\t}\n\n\t\t\tcase FunctionName.EndsWith: {\n\t\t\t\tconst source = getArgument(0)\n\t\t\t\tconst target = getArgument(1)\n\t\t\t\treturn this.normalizer.newScalarEndsWith(source, target)\n\t\t\t}\n\n\t\t\tcase FunctionName.Length: {\n\t\t\t\tconst array = getArgument(0)\n\t\t\t\treturn this.normalizer.newScalarLength(array)\n\t\t\t}\n\n\t\t\tcase FunctionName.IndexOf: {\n\t\t\t\tconst source = getArgument(0)\n\t\t\t\tconst target = getArgument(1)\n\t\t\t\treturn this.normalizer.newScalarIndexOf(source, target)\n\t\t\t}\n\n\t\t\tcase FunctionName.Array: {\n\t\t\t\tconst subquery = expression.arguments[0]\n\t\t\t\tassert(subquery, \"Missing argument\")\n\t\t\t\tassert(subquery.type === \"Select\", \"Subqueries require a select expression\")\n\t\t\t\treturn this.buildSubqueryArray(inScope, subquery)\n\t\t\t}\n\n\t\t\tcase FunctionName.FlatArray: {\n\t\t\t\tconst subquery = expression.arguments[0]\n\t\t\t\tassert(subquery, \"Missing argument\")\n\t\t\t\tassert(subquery.type === \"Select\", \"Subqueries require a select expression\")\n\t\t\t\treturn this.buildSubqueryFlatArray(inScope, subquery)\n\t\t\t}\n\n\t\t\tcase FunctionName.Intersect: {\n\t\t\t\tconst source = getArgument(0)\n\t\t\t\tconst target = getArgument(1)\n\t\t\t\treturn this.normalizer.newScalarIntersection(source, target)\n\t\t\t}\n\n\t\t\tdefault:\n\t\t\t\tassertNever(functionName, \"Unsupported function name\")\n\t\t}\n\t}\n\n\tprivate buildSubqueryArray(inScope: Scope, expression: Select): ScalarNode {\n\t\ttry {\n\t\t\tconst subquery = new Subquery(inScope)\n\t\t\tthis.subqueries.push(subquery)\n\n\t\t\tconst outScope = this.buildSelect(inScope, expression)\n\t\t\tconst input = outScope.takeNode()\n\t\t\tconst namedFields = outScope.getNamedFields()\n\t\t\tconst ordering = outScope.getRequiredOrdering()\n\t\t\tconst referencedFields = subquery.referencedFields\n\t\t\tconst referencedOuterFields = subquery.referencedOuterFields\n\n\t\t\treturn this.normalizer.newScalarArray(input, namedFields, ordering, referencedFields, referencedOuterFields)\n\t\t} finally {\n\t\t\tthis.subqueries.pop()\n\t\t}\n\t}\n\n\tprivate buildSubqueryFlatArray(inScope: Scope, expression: Select): ScalarNode {\n\t\ttry {\n\t\t\tconst subquery = new Subquery(inScope)\n\t\t\tthis.subqueries.push(subquery)\n\n\t\t\tconst outScope = this.buildSelect(inScope, expression)\n\t\t\tconst input = outScope.takeNode()\n\t\t\tconst field = outScope.getSingleField()\n\t\t\tconst ordering = outScope.getRequiredOrdering()\n\t\t\tconst referencedFields = subquery.referencedFields\n\t\t\tconst referencedOuterFields = subquery.referencedOuterFields\n\n\t\t\treturn this.normalizer.newScalarFlatArray(input, field, ordering, referencedFields, referencedOuterFields)\n\t\t} finally {\n\t\t\tthis.subqueries.pop()\n\t\t}\n\t}\n\n\tprivate buildCase(inScope: Scope, expression: Case): ScalarNode {\n\t\tlet input: ScalarNode | undefined\n\t\tif (expression.value) {\n\t\t\tinput = this.buildExpression(inScope, expression.value)\n\t\t}\n\n\t\tconst conditions = expression.conditions.map(condition => {\n\t\t\tconst when = this.buildExpression(inScope, condition.when)\n\t\t\tconst then = this.buildExpression(inScope, condition.then)\n\t\t\treturn new CaseCondition(when, then)\n\t\t})\n\n\t\tlet otherwise: ScalarNode | undefined\n\t\tif (expression.else) {\n\t\t\totherwise = this.buildExpression(inScope, expression.else)\n\t\t}\n\n\t\treturn this.normalizer.newScalarCase(input, conditions, otherwise)\n\t}\n\n\tprivate buildUnaryOperation(inScope: Scope, expression: UnaryOperation): ScalarNode {\n\t\tconst input = this.buildExpression(inScope, expression.value)\n\n\t\tswitch (expression.operator) {\n\t\t\tcase UnaryOperator.Not:\n\t\t\t\treturn this.normalizer.newScalarNot(input)\n\n\t\t\tdefault:\n\t\t\t\tassertNever(expression.operator, \"Unsupported unary operator\")\n\t\t}\n\t}\n\n\tprivate buildBinaryOperation(inScope: Scope, expression: BinaryOperation): ScalarNode {\n\t\tconst left = this.buildExpression(inScope, expression.left)\n\t\tconst right = this.buildExpression(inScope, expression.right)\n\n\t\tswitch (expression.operator) {\n\t\t\tcase BinaryOperator.And:\n\t\t\t\treturn this.normalizer.newScalarAnd(left, right)\n\n\t\t\tcase BinaryOperator.Or:\n\t\t\t\treturn this.normalizer.newScalarOr(left, right)\n\n\t\t\tcase BinaryOperator.Equals:\n\t\t\t\treturn this.normalizer.newScalarEquals(left, right)\n\n\t\t\tcase BinaryOperator.NotEquals:\n\t\t\t\treturn this.normalizer.newScalarNotEquals(left, right)\n\n\t\t\tcase BinaryOperator.LessThan:\n\t\t\t\treturn this.normalizer.newScalarLessThan(left, right)\n\n\t\t\tcase BinaryOperator.LessThanOrEqual:\n\t\t\t\treturn this.normalizer.newScalarLessThanOrEqual(left, right)\n\n\t\t\tcase BinaryOperator.GreaterThan:\n\t\t\t\treturn this.normalizer.newScalarGreaterThan(left, right)\n\n\t\t\tcase BinaryOperator.GreaterThanOrEqual:\n\t\t\t\treturn this.normalizer.newScalarGreaterThanOrEqual(left, right)\n\n\t\t\tcase BinaryOperator.In:\n\t\t\t\treturn this.normalizer.newScalarIn(left, right)\n\n\t\t\tdefault:\n\t\t\t\tassertNever(expression.operator, \"Unsupported binary operator\")\n\t\t}\n\t}\n\n\tprivate buildTypeCast(inScope: Scope, expression: TypeCast): ScalarNode {\n\t\tconst input = this.buildExpression(inScope, expression.value)\n\n\t\tswitch (expression.dataType) {\n\t\t\tcase DataType.Boolean: {\n\t\t\t\tconst definition: DatabaseValueDefinition = { type: ControlType.Boolean, isNullable: true }\n\t\t\t\treturn this.normalizer.newScalarCast(input, definition)\n\t\t\t}\n\n\t\t\tcase DataType.Date: {\n\t\t\t\tconst definition: DatabaseValueDefinition = { type: ControlType.Date, isNullable: true }\n\t\t\t\treturn this.normalizer.newScalarCast(input, definition)\n\t\t\t}\n\n\t\t\tcase DataType.Number: {\n\t\t\t\tconst definition: DatabaseValueDefinition = { type: ControlType.Number, isNullable: true }\n\t\t\t\treturn this.normalizer.newScalarCast(input, definition)\n\t\t\t}\n\n\t\t\tcase DataType.String: {\n\t\t\t\tconst definition: DatabaseValueDefinition = { type: ControlType.String, isNullable: true }\n\t\t\t\treturn this.normalizer.newScalarCast(input, definition)\n\t\t\t}\n\n\t\t\tdefault:\n\t\t\t\tthrow new Error(\"Unsupported data type\")\n\t\t}\n\t}\n}\n\nclass Subquery {\n\t/**\n\t * A list of fields that are referenced from `inScope` of the subquery.\n\t *\n\t * To evaluate a subquery, we need to know which fields are coming from\n\t * outside the subquery and which fields are coming from inside the\n\t * subquery. For example, in the following query:\n\t *\n\t * ```\n\t * SELECT title, (\n\t *     SELECT name FROM articles\n\t *     WHERE id = author_id\n\t * ) AS author FROM articles\n\t * ```\n\t *\n\t * The `name` and `id` fields are coming from the inside the subquery, but\n\t * the `author_id` field is coming from the parent scope. We need to resolve\n\t * `author_id` before we can evaluate the subquery.\n\t */\n\treadonly referencedFields = new Fields()\n\n\t/**\n\t * A list of fields that are referenced from the `inScope` of the parent\n\t * subquery.\n\t */\n\treadonly referencedOuterFields = new Fields()\n\n\tconstructor(\n\t\t/**\n\t\t * The parent scope of the subquery.\n\t\t */\n\t\treadonly inScope: Scope,\n\t) {}\n}\n", "import { valueToBoolean } from \"../../../DatabaseValue.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateArray } from \"../../Evaluate.ts\"\nimport type { Group } from \"../../Group.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport { RequiredProps } from \"../../PhysicalProps.ts\"\nimport type { Relation, Tuple } from \"../../Relation.ts\"\nimport type { ScalarNode } from \"../scalar/ScalarNode.ts\"\nimport { RelationalNode } from \"./RelationalNode.ts\"\n\nexport class RelationalFilter extends RelationalNode {\n\treadonly inputGroup: Group\n\n\tconstructor(\n\t\treadonly input: RelationalNode,\n\t\treadonly predicate: ScalarNode,\n\t) {\n\t\tsuper(input.isSynchronous && predicate.isSynchronous)\n\n\t\tthis.inputGroup = input.getGroup()\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"RelationalFilter\", this.inputGroup.id, this.predicate)\n\t}\n\n\toverride getOutputFields() {\n\t\treturn this.inputGroup.relational.outputFields\n\t}\n\n\toverride canProvideOrdering() {\n\t\treturn true\n\t}\n\n\toverride canProvideResolvedFields() {\n\t\treturn true\n\t}\n\n\tprivate getInputRequiredProps(required: RequiredProps) {\n\t\tconst resolvedFields = new Fields(required.resolvedFields)\n\t\tresolvedFields.merge(this.predicate.referencedFields)\n\n\t\treturn new RequiredProps(required.ordering, resolvedFields)\n\t}\n\n\toverride optimize(optimizer: Optimizer, required: RequiredProps) {\n\t\tconst inputRequired = this.getInputRequiredProps(required)\n\t\tconst inputCost = optimizer.optimizeGroup(this.inputGroup, inputRequired)\n\n\t\tconst predicateCost = this.predicate.optimize(optimizer)\n\n\t\treturn new Cost(0).add(Cost.max(inputCost, predicateCost))\n\t}\n\n\toverride getOptimized(required: RequiredProps) {\n\t\tconst inputRequired = this.getInputRequiredProps(required)\n\t\tconst input = this.inputGroup.getOptimized(inputRequired)\n\n\t\tconst predicate = this.predicate.getOptimized()\n\n\t\treturn new RelationalFilter(input, predicate)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined): Evaluate<Relation> {\n\t\tconst input = yield* this.input.evaluate(context)\n\n\t\tconst predicates = yield* evaluateArray(\n\t\t\tinput.tuples.map(tuple => {\n\t\t\t\treturn this.predicate.evaluate(context, tuple)\n\t\t\t}),\n\t\t)\n\n\t\treturn input.filter((_, index) => {\n\t\t\tconst predicate = predicates[index] ?? null\n\t\t\treturn valueToBoolean(predicate)\n\t\t})\n\t}\n}\n", "import type { DatabaseIndexLookup, DatabaseItem } from \"../../../types.ts\"\nimport { DatabaseIndexLookupType } from \"../../../types.ts\"\nimport { Cost, KB } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport type { Fields, IndexMetadata } from \"../../Metadata.ts\"\nimport type { Ordering } from \"../../Ordering.ts\"\nimport { Relation, Tuple } from \"../../Relation.ts\"\nimport { RelationalNode } from \"./RelationalNode.ts\"\n\nexport class RelationalIndexLookup extends RelationalNode {\n\tconstructor(\n\t\treadonly index: IndexMetadata,\n\t\treadonly query: DatabaseIndexLookup[],\n\t) {\n\t\tsuper(false)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"RelationalIndexLookup\", this.index.id, ...this.query)\n\t}\n\n\toverride getOutputFields() {\n\t\treturn this.index.collection.fields\n\t}\n\n\toverride canProvideOrdering(ordering: Ordering) {\n\t\treturn ordering.equals(this.index.ordering)\n\t}\n\n\toverride canProvideResolvedFields(resolvedFields: Fields) {\n\t\treturn resolvedFields.subsetOf(this.index.resolvedFields)\n\t}\n\n\toverride optimize() {\n\t\tconst isFullScan = this.query.every(lookup => lookup.type === DatabaseIndexLookupType.All)\n\t\treturn Cost.estimate(1, isFullScan ? 100 * KB : 50 * KB)\n\t}\n\n\toverride getOptimized() {\n\t\treturn new RelationalIndexLookup(this.index, this.query)\n\t}\n\n\toverride *evaluate(): Evaluate<Relation> {\n\t\tconst index = this.index\n\t\tconst collection = index.collection\n\t\tconst outputFields = this.getOutputFields()\n\n\t\tconst items: DatabaseItem[] = yield index.data.lookupItems(this.query)\n\n\t\tconst tuples = items.map(item => {\n\t\t\tconst tuple = new Tuple()\n\n\t\t\tfor (const field of index.resolvedFields) {\n\t\t\t\tconst value = field.getValue(item)\n\t\t\t\ttuple.addPointer(collection, item.pointer)\n\t\t\t\ttuple.addValue(field, value)\n\t\t\t}\n\n\t\t\treturn tuple\n\t\t})\n\n\t\treturn new Relation(outputFields, tuples)\n\t}\n}\n", "import { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport type { Group } from \"../../Group.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport { Ordering } from \"../../Ordering.ts\"\nimport { RequiredProps } from \"../../PhysicalProps.ts\"\nimport type { Relation, Tuple } from \"../../Relation.ts\"\nimport { RelationalNode } from \"./RelationalNode.ts\"\n\nexport class RelationalIntersection extends RelationalNode {\n\treadonly leftGroup: Group\n\treadonly rightGroup: Group\n\n\tconstructor(\n\t\treadonly left: RelationalNode,\n\t\treadonly right: RelationalNode,\n\t) {\n\t\tsuper(left.isSynchronous && right.isSynchronous)\n\n\t\tthis.leftGroup = left.getGroup()\n\t\tthis.rightGroup = right.getGroup()\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"RelationalIntersection\", this.leftGroup.id, this.rightGroup.id)\n\t}\n\n\toverride getOutputFields() {\n\t\tconst outputFields = new Fields()\n\n\t\tconst leftOutputFields = this.leftGroup.relational.outputFields\n\t\tconst rightOutputFields = this.rightGroup.relational.outputFields\n\n\t\tfor (const field of leftOutputFields) {\n\t\t\tif (rightOutputFields.has(field)) {\n\t\t\t\toutputFields.add(field)\n\t\t\t}\n\t\t}\n\n\t\treturn outputFields\n\t}\n\n\toverride canProvideOrdering() {\n\t\treturn false\n\t}\n\n\toverride canProvideResolvedFields() {\n\t\treturn true\n\t}\n\n\tprivate getChildRequiredProps(required: RequiredProps) {\n\t\tconst ordering = new Ordering()\n\t\treturn new RequiredProps(ordering, required.resolvedFields)\n\t}\n\n\toverride optimize(optimizer: Optimizer, required: RequiredProps) {\n\t\tconst leftRequired = this.getChildRequiredProps(required)\n\t\tconst leftCost = optimizer.optimizeGroup(this.leftGroup, leftRequired)\n\n\t\tconst rightRequired = this.getChildRequiredProps(required)\n\t\tconst rightCost = optimizer.optimizeGroup(this.rightGroup, rightRequired)\n\n\t\treturn Cost.max(leftCost, rightCost)\n\t}\n\n\toverride getOptimized(required: RequiredProps) {\n\t\tconst leftRequired = this.getChildRequiredProps(required)\n\t\tconst left = this.leftGroup.getOptimized(leftRequired)\n\n\t\tconst rightRequired = this.getChildRequiredProps(required)\n\t\tconst right = this.rightGroup.getOptimized(rightRequired)\n\n\t\treturn new RelationalIntersection(left, right)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined): Evaluate<Relation> {\n\t\tconst { left, right } = yield* evaluateObject({\n\t\t\tleft: this.left.evaluate(context),\n\t\t\tright: this.right.evaluate(context),\n\t\t})\n\n\t\treturn left.intersection(right)\n\t}\n}\n", "import type { DatabaseItem } from \"../../../types.ts\"\nimport { Cost, KB } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport type { CollectionMetadata, Fields } from \"../../Metadata.ts\"\nimport { Relation, Tuple } from \"../../Relation.ts\"\nimport { RelationalNode } from \"./RelationalNode.ts\"\n\nexport class RelationalScan extends RelationalNode {\n\tconstructor(readonly collection: CollectionMetadata) {\n\t\tsuper(false)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"RelationalScan\", this.collection.id)\n\t}\n\n\toverride getOutputFields() {\n\t\treturn this.collection.fields\n\t}\n\n\toverride canProvideOrdering() {\n\t\treturn false\n\t}\n\n\toverride canProvideResolvedFields(resolvedFields: Fields) {\n\t\treturn resolvedFields.subsetOf(this.collection.fields)\n\t}\n\n\toverride optimize() {\n\t\treturn Cost.estimate(1, 200 * KB)\n\t}\n\n\toverride getOptimized() {\n\t\treturn new RelationalScan(this.collection)\n\t}\n\n\toverride *evaluate(): Evaluate<Relation> {\n\t\tconst collection = this.collection\n\t\tconst outputFields = this.getOutputFields()\n\n\t\tconst items: DatabaseItem[] = yield collection.data.scanItems()\n\n\t\tconst tuples = items.map(item => {\n\t\t\tconst tuple = new Tuple()\n\n\t\t\tfor (const field of outputFields) {\n\t\t\t\tconst value = field.getValue(item)\n\t\t\t\ttuple.addPointer(collection, item.pointer)\n\t\t\t\ttuple.addValue(field, value)\n\t\t\t}\n\n\t\t\treturn tuple\n\t\t})\n\n\t\treturn new Relation(outputFields, tuples)\n\t}\n}\n", "import { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport type { Group } from \"../../Group.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport { Ordering } from \"../../Ordering.ts\"\nimport { RequiredProps } from \"../../PhysicalProps.ts\"\nimport type { Relation, Tuple } from \"../../Relation.ts\"\nimport { RelationalNode } from \"./RelationalNode.ts\"\n\nexport class RelationalUnion extends RelationalNode {\n\treadonly leftGroup: Group\n\treadonly rightGroup: Group\n\n\tconstructor(\n\t\treadonly left: RelationalNode,\n\t\treadonly right: RelationalNode,\n\t) {\n\t\tsuper(left.isSynchronous && right.isSynchronous)\n\n\t\tthis.leftGroup = left.getGroup()\n\t\tthis.rightGroup = right.getGroup()\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"RelationalUnion\", this.leftGroup.id, this.rightGroup.id)\n\t}\n\n\toverride getOutputFields() {\n\t\tconst outputFields = new Fields()\n\n\t\tconst leftOutputFields = this.leftGroup.relational.outputFields\n\t\tconst rightOutputFields = this.rightGroup.relational.outputFields\n\n\t\tfor (const field of leftOutputFields) {\n\t\t\tif (rightOutputFields.has(field)) {\n\t\t\t\toutputFields.add(field)\n\t\t\t}\n\t\t}\n\n\t\treturn outputFields\n\t}\n\n\toverride canProvideOrdering() {\n\t\treturn false\n\t}\n\n\toverride canProvideResolvedFields() {\n\t\treturn true\n\t}\n\n\tprivate getChildRequiredProps(required: RequiredProps) {\n\t\tconst ordering = new Ordering()\n\t\treturn new RequiredProps(ordering, required.resolvedFields)\n\t}\n\n\toverride optimize(optimizer: Optimizer, required: RequiredProps) {\n\t\tconst leftRequired = this.getChildRequiredProps(required)\n\t\tconst leftCost = optimizer.optimizeGroup(this.leftGroup, leftRequired)\n\n\t\tconst rightRequired = this.getChildRequiredProps(required)\n\t\tconst rightCost = optimizer.optimizeGroup(this.rightGroup, rightRequired)\n\n\t\treturn Cost.max(leftCost, rightCost)\n\t}\n\n\toverride getOptimized(required: RequiredProps) {\n\t\tconst leftRequired = this.getChildRequiredProps(required)\n\t\tconst left = this.leftGroup.getOptimized(leftRequired)\n\n\t\tconst rightRequired = this.getChildRequiredProps(required)\n\t\tconst right = this.rightGroup.getOptimized(rightRequired)\n\n\t\treturn new RelationalUnion(left, right)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined): Evaluate<Relation> {\n\t\tconst { left, right } = yield* evaluateObject({\n\t\t\tleft: this.left.evaluate(context),\n\t\t\tright: this.right.evaluate(context),\n\t\t})\n\n\t\treturn left.union(right)\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport type { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport { valueToBoolean } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nexport class ScalarAnd extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Boolean,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(\n\t\treadonly left: ScalarNode,\n\t\treadonly right: ScalarNode,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\treferencedFields.merge(left.referencedFields)\n\t\treferencedFields.merge(right.referencedFields)\n\n\t\tconst referencedOuterFields = new Fields()\n\t\treferencedOuterFields.merge(left.referencedOuterFields)\n\t\treferencedOuterFields.merge(right.referencedOuterFields)\n\n\t\tconst isSynchronous = left.isSynchronous && right.isSynchronous\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarAnd\", this.left, this.right)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst leftCost = this.left.optimize(optimizer)\n\t\tconst rightCost = this.right.optimize(optimizer)\n\n\t\treturn Cost.max(leftCost, rightCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst left = this.left.getOptimized()\n\t\tconst right = this.right.getOptimized()\n\n\t\treturn new ScalarAnd(left, right)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { left, right } = yield* evaluateObject({\n\t\t\tleft: this.left.evaluate(context, tuple),\n\t\t\tright: this.right.evaluate(context, tuple),\n\t\t})\n\n\t\treturn {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tvalue: valueToBoolean(left) && valueToBoolean(right),\n\t\t}\n\t}\n}\n", "import { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport { unknownDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nexport class ScalarConstant extends ScalarNode {\n\tconstructor(\n\t\treadonly definition: DatabaseValueDefinition,\n\t\treadonly value: DatabaseValue,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\tconst referencedOuterFields = new Fields()\n\n\t\tsuper(referencedFields, referencedOuterFields, true)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarConstant\", this.definition, this.value)\n\t}\n\n\toverride optimize() {\n\t\treturn new Cost(0)\n\t}\n\n\toverride getOptimized() {\n\t\treturn this\n\t}\n\n\t// biome-ignore lint/correctness/useYield: Required by the super class.\n\toverride *evaluate(): Evaluate<DatabaseValue> {\n\t\treturn this.value\n\t}\n}\n\n/**\n * Creates a `ScalarConstant` node for testing.\n */\nexport function createScalarConstant(value: unknown) {\n\tconst databaseValue = DatabaseValue.parse(value)\n\treturn new ScalarConstant(unknownDefinition, databaseValue)\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport type { DatabaseCollation } from \"../../../types.ts\"\nimport { DatabaseCollationType } from \"../../../types.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nconst collation: DatabaseCollation = {\n\ttype: DatabaseCollationType.CaseInsensitive,\n}\n\nexport class ScalarContains extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Boolean,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(\n\t\treadonly source: ScalarNode,\n\t\treadonly target: ScalarNode,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\treferencedFields.merge(source.referencedFields)\n\t\treferencedFields.merge(target.referencedFields)\n\n\t\tconst referencedOuterFields = new Fields()\n\t\treferencedOuterFields.merge(source.referencedOuterFields)\n\t\treferencedOuterFields.merge(target.referencedOuterFields)\n\n\t\tconst isSynchronous = source.isSynchronous && target.isSynchronous\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarContains\", this.source, this.target)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst sourceCost = this.source.optimize(optimizer)\n\t\tconst targetCost = this.target.optimize(optimizer)\n\n\t\treturn Cost.max(sourceCost, targetCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst source = this.source.getOptimized()\n\t\tconst target = this.target.getOptimized()\n\n\t\treturn new ScalarContains(source, target)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { source, target } = yield* evaluateObject({\n\t\t\tsource: this.source.evaluate(context, tuple),\n\t\t\ttarget: this.target.evaluate(context, tuple),\n\t\t})\n\n\t\treturn {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tvalue: DatabaseValue.contains(source, target, collation),\n\t\t}\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport type { DatabaseCollation } from \"../../../types.ts\"\nimport { DatabaseCollationType } from \"../../../types.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nconst collation: DatabaseCollation = {\n\ttype: DatabaseCollationType.CaseInsensitive,\n}\n\nexport class ScalarEndsWith extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Boolean,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(\n\t\treadonly source: ScalarNode,\n\t\treadonly target: ScalarNode,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\treferencedFields.merge(source.referencedFields)\n\t\treferencedFields.merge(target.referencedFields)\n\n\t\tconst referencedOuterFields = new Fields()\n\t\treferencedOuterFields.merge(source.referencedOuterFields)\n\t\treferencedOuterFields.merge(target.referencedOuterFields)\n\n\t\tconst isSynchronous = source.isSynchronous && target.isSynchronous\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarEndsWith\", this.source, this.target)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst sourceCost = this.source.optimize(optimizer)\n\t\tconst targetCost = this.target.optimize(optimizer)\n\n\t\treturn Cost.max(sourceCost, targetCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst source = this.source.getOptimized()\n\t\tconst target = this.target.getOptimized()\n\n\t\treturn new ScalarEndsWith(source, target)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { source, target } = yield* evaluateObject({\n\t\t\tsource: this.source.evaluate(context, tuple),\n\t\t\ttarget: this.target.evaluate(context, tuple),\n\t\t})\n\n\t\treturn {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tvalue: DatabaseValue.endsWith(source, target, collation),\n\t\t}\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode, collation } from \"./ScalarNode.ts\"\n\nexport class ScalarEquals extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Boolean,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(\n\t\treadonly left: ScalarNode,\n\t\treadonly right: ScalarNode,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\treferencedFields.merge(left.referencedFields)\n\t\treferencedFields.merge(right.referencedFields)\n\n\t\tconst referencedOuterFields = new Fields()\n\t\treferencedOuterFields.merge(left.referencedOuterFields)\n\t\treferencedOuterFields.merge(right.referencedOuterFields)\n\n\t\tconst isSynchronous = left.isSynchronous && right.isSynchronous\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarEquals\", this.left, this.right)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst leftCost = this.left.optimize(optimizer)\n\t\tconst rightCost = this.right.optimize(optimizer)\n\n\t\treturn Cost.max(leftCost, rightCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst left = this.left.getOptimized()\n\t\tconst right = this.right.getOptimized()\n\n\t\treturn new ScalarEquals(left, right)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { left, right } = yield* evaluateObject({\n\t\t\tleft: this.left.evaluate(context, tuple),\n\t\t\tright: this.right.evaluate(context, tuple),\n\t\t})\n\n\t\treturn {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tvalue: DatabaseValue.equal(left, right, collation),\n\t\t}\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode, collation } from \"./ScalarNode.ts\"\n\nexport class ScalarGreaterThan extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Boolean,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(\n\t\treadonly left: ScalarNode,\n\t\treadonly right: ScalarNode,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\treferencedFields.merge(left.referencedFields)\n\t\treferencedFields.merge(right.referencedFields)\n\n\t\tconst referencedOuterFields = new Fields()\n\t\treferencedOuterFields.merge(left.referencedOuterFields)\n\t\treferencedOuterFields.merge(right.referencedOuterFields)\n\n\t\tconst isSynchronous = left.isSynchronous && right.isSynchronous\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarGreaterThan\", this.left, this.right)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst leftCost = this.left.optimize(optimizer)\n\t\tconst rightCost = this.right.optimize(optimizer)\n\n\t\treturn Cost.max(leftCost, rightCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst left = this.left.getOptimized()\n\t\tconst right = this.right.getOptimized()\n\n\t\treturn new ScalarGreaterThan(left, right)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { left, right } = yield* evaluateObject({\n\t\t\tleft: this.left.evaluate(context, tuple),\n\t\t\tright: this.right.evaluate(context, tuple),\n\t\t})\n\n\t\treturn {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tvalue: DatabaseValue.greaterThan(left, right, collation),\n\t\t}\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode, collation } from \"./ScalarNode.ts\"\n\nexport class ScalarGreaterThanOrEqual extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Boolean,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(\n\t\treadonly left: ScalarNode,\n\t\treadonly right: ScalarNode,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\treferencedFields.merge(left.referencedFields)\n\t\treferencedFields.merge(right.referencedFields)\n\n\t\tconst referencedOuterFields = new Fields()\n\t\treferencedOuterFields.merge(left.referencedOuterFields)\n\t\treferencedOuterFields.merge(right.referencedOuterFields)\n\n\t\tconst isSynchronous = left.isSynchronous && right.isSynchronous\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarGreaterThanOrEqual\", this.left, this.right)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst leftCost = this.left.optimize(optimizer)\n\t\tconst rightCost = this.right.optimize(optimizer)\n\n\t\treturn Cost.max(leftCost, rightCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst left = this.left.getOptimized()\n\t\tconst right = this.right.getOptimized()\n\n\t\treturn new ScalarGreaterThanOrEqual(left, right)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { left, right } = yield* evaluateObject({\n\t\t\tleft: this.left.evaluate(context, tuple),\n\t\t\tright: this.right.evaluate(context, tuple),\n\t\t})\n\n\t\treturn {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tvalue: DatabaseValue.greaterThanOrEqual(left, right, collation),\n\t\t}\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode, collation } from \"./ScalarNode.ts\"\n\nexport class ScalarLessThan extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Boolean,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(\n\t\treadonly left: ScalarNode,\n\t\treadonly right: ScalarNode,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\treferencedFields.merge(left.referencedFields)\n\t\treferencedFields.merge(right.referencedFields)\n\n\t\tconst referencedOuterFields = new Fields()\n\t\treferencedOuterFields.merge(left.referencedOuterFields)\n\t\treferencedOuterFields.merge(right.referencedOuterFields)\n\n\t\tconst isSynchronous = left.isSynchronous && right.isSynchronous\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarLessThan\", this.left, this.right)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst leftCost = this.left.optimize(optimizer)\n\t\tconst rightCost = this.right.optimize(optimizer)\n\n\t\treturn Cost.max(leftCost, rightCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst left = this.left.getOptimized()\n\t\tconst right = this.right.getOptimized()\n\n\t\treturn new ScalarLessThan(left, right)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { left, right } = yield* evaluateObject({\n\t\t\tleft: this.left.evaluate(context, tuple),\n\t\t\tright: this.right.evaluate(context, tuple),\n\t\t})\n\n\t\treturn {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tvalue: DatabaseValue.lessThan(left, right, collation),\n\t\t}\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode, collation } from \"./ScalarNode.ts\"\n\nexport class ScalarLessThanOrEqual extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Boolean,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(\n\t\treadonly left: ScalarNode,\n\t\treadonly right: ScalarNode,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\treferencedFields.merge(left.referencedFields)\n\t\treferencedFields.merge(right.referencedFields)\n\n\t\tconst referencedOuterFields = new Fields()\n\t\treferencedOuterFields.merge(left.referencedOuterFields)\n\t\treferencedOuterFields.merge(right.referencedOuterFields)\n\n\t\tconst isSynchronous = left.isSynchronous && right.isSynchronous\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarLessThanOrEqual\", this.left, this.right)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst leftCost = this.left.optimize(optimizer)\n\t\tconst rightCost = this.right.optimize(optimizer)\n\n\t\treturn Cost.max(leftCost, rightCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst left = this.left.getOptimized()\n\t\tconst right = this.right.getOptimized()\n\n\t\treturn new ScalarLessThanOrEqual(left, right)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { left, right } = yield* evaluateObject({\n\t\t\tleft: this.left.evaluate(context, tuple),\n\t\t\tright: this.right.evaluate(context, tuple),\n\t\t})\n\n\t\treturn {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tvalue: DatabaseValue.lessThanOrEqual(left, right, collation),\n\t\t}\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode, collation } from \"./ScalarNode.ts\"\n\nexport class ScalarNotEquals extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Boolean,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(\n\t\treadonly left: ScalarNode,\n\t\treadonly right: ScalarNode,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\treferencedFields.merge(left.referencedFields)\n\t\treferencedFields.merge(right.referencedFields)\n\n\t\tconst referencedOuterFields = new Fields()\n\t\treferencedOuterFields.merge(left.referencedOuterFields)\n\t\treferencedOuterFields.merge(right.referencedOuterFields)\n\n\t\tconst isSynchronous = left.isSynchronous && right.isSynchronous\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarNotEquals\", this.left, this.right)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst leftCost = this.left.optimize(optimizer)\n\t\tconst rightCost = this.right.optimize(optimizer)\n\n\t\treturn Cost.max(leftCost, rightCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst left = this.left.getOptimized()\n\t\tconst right = this.right.getOptimized()\n\n\t\treturn new ScalarNotEquals(left, right)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { left, right } = yield* evaluateObject({\n\t\t\tleft: this.left.evaluate(context, tuple),\n\t\t\tright: this.right.evaluate(context, tuple),\n\t\t})\n\n\t\treturn {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tvalue: !DatabaseValue.equal(left, right, collation),\n\t\t}\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport type { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport { valueToBoolean } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nexport class ScalarOr extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Boolean,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(\n\t\treadonly left: ScalarNode,\n\t\treadonly right: ScalarNode,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\treferencedFields.merge(left.referencedFields)\n\t\treferencedFields.merge(right.referencedFields)\n\n\t\tconst referencedOuterFields = new Fields()\n\t\treferencedOuterFields.merge(left.referencedOuterFields)\n\t\treferencedOuterFields.merge(right.referencedOuterFields)\n\n\t\tconst isSynchronous = left.isSynchronous && right.isSynchronous\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarOr\", this.left, this.right)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst leftCost = this.left.optimize(optimizer)\n\t\tconst rightCost = this.right.optimize(optimizer)\n\n\t\treturn Cost.max(leftCost, rightCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst left = this.left.getOptimized()\n\t\tconst right = this.right.getOptimized()\n\n\t\treturn new ScalarOr(left, right)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { left, right } = yield* evaluateObject({\n\t\t\tleft: this.left.evaluate(context, tuple),\n\t\t\tright: this.right.evaluate(context, tuple),\n\t\t})\n\n\t\treturn {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tvalue: valueToBoolean(left) || valueToBoolean(right),\n\t\t}\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport type { DatabaseCollation } from \"../../../types.ts\"\nimport { DatabaseCollationType } from \"../../../types.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nconst collation: DatabaseCollation = {\n\ttype: DatabaseCollationType.CaseInsensitive,\n}\n\nexport class ScalarStartsWith extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Boolean,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(\n\t\treadonly source: ScalarNode,\n\t\treadonly target: ScalarNode,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\treferencedFields.merge(source.referencedFields)\n\t\treferencedFields.merge(target.referencedFields)\n\n\t\tconst referencedOuterFields = new Fields()\n\t\treferencedOuterFields.merge(source.referencedOuterFields)\n\t\treferencedOuterFields.merge(target.referencedOuterFields)\n\n\t\tconst isSynchronous = source.isSynchronous && target.isSynchronous\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarStartsWith\", this.source, this.target)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst sourceCost = this.source.optimize(optimizer)\n\t\tconst targetCost = this.target.optimize(optimizer)\n\n\t\treturn Cost.max(sourceCost, targetCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst source = this.source.getOptimized()\n\t\tconst target = this.target.getOptimized()\n\n\t\treturn new ScalarStartsWith(source, target)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { source, target } = yield* evaluateObject({\n\t\t\tsource: this.source.evaluate(context, tuple),\n\t\t\ttarget: this.target.evaluate(context, tuple),\n\t\t})\n\n\t\treturn {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tvalue: DatabaseValue.startsWith(source, target, collation),\n\t\t}\n\t}\n}\n", "import type { DatabaseIndexLookup } from \"../types.ts\"\nimport { DatabaseIndexLookupType } from \"../types.ts\"\nimport type { Memo } from \"./Memo.ts\"\nimport type { Normalizer } from \"./Normalizer.ts\"\nimport { RelationalFilter } from \"./nodes/relational/RelationalFilter.ts\"\nimport { RelationalIndexLookup } from \"./nodes/relational/RelationalIndexLookup.ts\"\nimport { RelationalIntersection } from \"./nodes/relational/RelationalIntersection.ts\"\nimport type { RelationalNode } from \"./nodes/relational/RelationalNode.ts\"\nimport { RelationalScan } from \"./nodes/relational/RelationalScan.ts\"\nimport { RelationalUnion } from \"./nodes/relational/RelationalUnion.ts\"\nimport { ScalarAnd } from \"./nodes/scalar/ScalarAnd.ts\"\nimport { ScalarConstant } from \"./nodes/scalar/ScalarConstant.ts\"\nimport { ScalarContains } from \"./nodes/scalar/ScalarContains.ts\"\nimport { ScalarEndsWith } from \"./nodes/scalar/ScalarEndsWith.ts\"\nimport { ScalarEquals } from \"./nodes/scalar/ScalarEquals.ts\"\nimport { ScalarGreaterThan } from \"./nodes/scalar/ScalarGreaterThan.ts\"\nimport { ScalarGreaterThanOrEqual } from \"./nodes/scalar/ScalarGreaterThanOrEqual.ts\"\nimport { ScalarLessThan } from \"./nodes/scalar/ScalarLessThan.ts\"\nimport { ScalarLessThanOrEqual } from \"./nodes/scalar/ScalarLessThanOrEqual.ts\"\nimport { ScalarNotEquals } from \"./nodes/scalar/ScalarNotEquals.ts\"\nimport { ScalarOr } from \"./nodes/scalar/ScalarOr.ts\"\nimport { ScalarStartsWith } from \"./nodes/scalar/ScalarStartsWith.ts\"\n\n/**\n * The explorer is responsible for generating non-normalized alternative query plans. For example,\n * the initial normalized query plan can only contain a single filter, but we could split it into\n * multiple filters so we can apply other optimizations to some parts of the query.\n */\nexport class Explorer {\n\treadonly memo: Memo\n\n\tconstructor(readonly normalizer: Normalizer) {\n\t\tthis.memo = normalizer.memo\n\t}\n\n\texplore(before: RelationalNode) {\n\t\tconst group = before.getGroup()\n\n\t\t// Split filters.\n\t\tif (before instanceof RelationalFilter) {\n\t\t\tif (before.predicate instanceof ScalarAnd) {\n\t\t\t\tconst left = this.normalizer.newRelationalFilter(before.input, before.predicate.left)\n\t\t\t\tconst right = this.normalizer.newRelationalFilter(before.input, before.predicate.right)\n\t\t\t\tconst after = new RelationalIntersection(left, right)\n\t\t\t\tthis.memo.addRelational(after, group)\n\t\t\t}\n\n\t\t\tif (before.predicate instanceof ScalarOr) {\n\t\t\t\tconst left = this.normalizer.newRelationalFilter(before.input, before.predicate.left)\n\t\t\t\tconst right = this.normalizer.newRelationalFilter(before.input, before.predicate.right)\n\t\t\t\tconst after = new RelationalUnion(left, right)\n\t\t\t\tthis.memo.addRelational(after, group)\n\t\t\t}\n\t\t}\n\n\t\t// Generate generic index scans.\n\t\tif (before instanceof RelationalScan) {\n\t\t\tfor (const index of before.collection.indexes) {\n\t\t\t\t// We can't replace the scan with an index lookup if the index\n\t\t\t\t// has a constraint because the index will not return all items.\n\t\t\t\tif (index.constraint) continue\n\n\t\t\t\tconst query = createIndexQueryAll(index.lookupNodes.length)\n\t\t\t\tconst after = new RelationalIndexLookup(index, query)\n\t\t\t\tthis.memo.addRelational(after, group)\n\t\t\t}\n\t\t}\n\n\t\t// Generate index lookups.\n\t\tif (before instanceof RelationalFilter) {\n\t\t\tfor (const input of before.inputGroup.nodes) {\n\t\t\t\tif (input instanceof RelationalScan) {\n\t\t\t\t\tfor (const index of input.collection.indexes) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tbefore.predicate instanceof ScalarEquals &&\n\t\t\t\t\t\t\tbefore.predicate.left === index.lookupNodes[0] &&\n\t\t\t\t\t\t\tbefore.predicate.right instanceof ScalarConstant &&\n\t\t\t\t\t\t\tindex.data.supportedLookupTypes.includes(DatabaseIndexLookupType.Equals)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconst query = createIndexQueryAll(index.lookupNodes.length)\n\n\t\t\t\t\t\t\t// NOTE: We have some old collection modules that\n\t\t\t\t\t\t\t// only support the first lookup to be something\n\t\t\t\t\t\t\t// other than `DatabaseIndexLookupType.All`\n\t\t\t\t\t\t\tquery[0] = {\n\t\t\t\t\t\t\t\ttype: DatabaseIndexLookupType.Equals,\n\t\t\t\t\t\t\t\tvalue: before.predicate.right.value,\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst after = new RelationalIndexLookup(index, query)\n\t\t\t\t\t\t\tthis.memo.addRelational(after, group)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tbefore.predicate instanceof ScalarNotEquals &&\n\t\t\t\t\t\t\tbefore.predicate.left === index.lookupNodes[0] &&\n\t\t\t\t\t\t\tbefore.predicate.right instanceof ScalarConstant &&\n\t\t\t\t\t\t\tindex.data.supportedLookupTypes.includes(DatabaseIndexLookupType.NotEquals)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconst query = createIndexQueryAll(index.lookupNodes.length)\n\n\t\t\t\t\t\t\tquery[0] = {\n\t\t\t\t\t\t\t\ttype: DatabaseIndexLookupType.NotEquals,\n\t\t\t\t\t\t\t\tvalue: before.predicate.right.value,\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst after = new RelationalIndexLookup(index, query)\n\t\t\t\t\t\t\tthis.memo.addRelational(after, group)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tbefore.predicate instanceof ScalarLessThan &&\n\t\t\t\t\t\t\tbefore.predicate.left === index.lookupNodes[0] &&\n\t\t\t\t\t\t\tbefore.predicate.right instanceof ScalarConstant &&\n\t\t\t\t\t\t\tindex.data.supportedLookupTypes.includes(DatabaseIndexLookupType.LessThan)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconst query = createIndexQueryAll(index.lookupNodes.length)\n\n\t\t\t\t\t\t\tquery[0] = {\n\t\t\t\t\t\t\t\ttype: DatabaseIndexLookupType.LessThan,\n\t\t\t\t\t\t\t\tvalue: before.predicate.right.value,\n\t\t\t\t\t\t\t\tinclusive: false,\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst after = new RelationalIndexLookup(index, query)\n\t\t\t\t\t\t\tthis.memo.addRelational(after, group)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tbefore.predicate instanceof ScalarLessThanOrEqual &&\n\t\t\t\t\t\t\tbefore.predicate.left === index.lookupNodes[0] &&\n\t\t\t\t\t\t\tbefore.predicate.right instanceof ScalarConstant &&\n\t\t\t\t\t\t\tindex.data.supportedLookupTypes.includes(DatabaseIndexLookupType.LessThan)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconst query = createIndexQueryAll(index.lookupNodes.length)\n\n\t\t\t\t\t\t\tquery[0] = {\n\t\t\t\t\t\t\t\ttype: DatabaseIndexLookupType.LessThan,\n\t\t\t\t\t\t\t\tvalue: before.predicate.right.value,\n\t\t\t\t\t\t\t\tinclusive: true,\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst after = new RelationalIndexLookup(index, query)\n\t\t\t\t\t\t\tthis.memo.addRelational(after, group)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tbefore.predicate instanceof ScalarGreaterThan &&\n\t\t\t\t\t\t\tbefore.predicate.left === index.lookupNodes[0] &&\n\t\t\t\t\t\t\tbefore.predicate.right instanceof ScalarConstant &&\n\t\t\t\t\t\t\tindex.data.supportedLookupTypes.includes(DatabaseIndexLookupType.GreaterThan)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconst query = createIndexQueryAll(index.lookupNodes.length)\n\n\t\t\t\t\t\t\tquery[0] = {\n\t\t\t\t\t\t\t\ttype: DatabaseIndexLookupType.GreaterThan,\n\t\t\t\t\t\t\t\tvalue: before.predicate.right.value,\n\t\t\t\t\t\t\t\tinclusive: false,\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst after = new RelationalIndexLookup(index, query)\n\t\t\t\t\t\t\tthis.memo.addRelational(after, group)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tbefore.predicate instanceof ScalarGreaterThanOrEqual &&\n\t\t\t\t\t\t\tbefore.predicate.left === index.lookupNodes[0] &&\n\t\t\t\t\t\t\tbefore.predicate.right instanceof ScalarConstant &&\n\t\t\t\t\t\t\tindex.data.supportedLookupTypes.includes(DatabaseIndexLookupType.GreaterThan)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconst query = createIndexQueryAll(index.lookupNodes.length)\n\n\t\t\t\t\t\t\tquery[0] = {\n\t\t\t\t\t\t\t\ttype: DatabaseIndexLookupType.GreaterThan,\n\t\t\t\t\t\t\t\tvalue: before.predicate.right.value,\n\t\t\t\t\t\t\t\tinclusive: true,\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst after = new RelationalIndexLookup(index, query)\n\t\t\t\t\t\t\tthis.memo.addRelational(after, group)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tbefore.predicate instanceof ScalarContains &&\n\t\t\t\t\t\t\tbefore.predicate.source === index.lookupNodes[0] &&\n\t\t\t\t\t\t\tbefore.predicate.target instanceof ScalarConstant &&\n\t\t\t\t\t\t\tindex.data.supportedLookupTypes.includes(DatabaseIndexLookupType.Contains)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconst query = createIndexQueryAll(index.lookupNodes.length)\n\n\t\t\t\t\t\t\tquery[0] = {\n\t\t\t\t\t\t\t\ttype: DatabaseIndexLookupType.Contains,\n\t\t\t\t\t\t\t\tvalue: before.predicate.target.value,\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst after = new RelationalIndexLookup(index, query)\n\t\t\t\t\t\t\tthis.memo.addRelational(after, group)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tbefore.predicate instanceof ScalarStartsWith &&\n\t\t\t\t\t\t\tbefore.predicate.source === index.lookupNodes[0] &&\n\t\t\t\t\t\t\tbefore.predicate.target instanceof ScalarConstant &&\n\t\t\t\t\t\t\tindex.data.supportedLookupTypes.includes(DatabaseIndexLookupType.StartsWith)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconst query = createIndexQueryAll(index.lookupNodes.length)\n\n\t\t\t\t\t\t\tquery[0] = {\n\t\t\t\t\t\t\t\ttype: DatabaseIndexLookupType.StartsWith,\n\t\t\t\t\t\t\t\tvalue: before.predicate.target.value,\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst after = new RelationalIndexLookup(index, query)\n\t\t\t\t\t\t\tthis.memo.addRelational(after, group)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tbefore.predicate instanceof ScalarEndsWith &&\n\t\t\t\t\t\t\tbefore.predicate.source === index.lookupNodes[0] &&\n\t\t\t\t\t\t\tbefore.predicate.target instanceof ScalarConstant &&\n\t\t\t\t\t\t\tindex.data.supportedLookupTypes.includes(DatabaseIndexLookupType.EndsWith)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconst query = createIndexQueryAll(index.lookupNodes.length)\n\n\t\t\t\t\t\t\tquery[0] = {\n\t\t\t\t\t\t\t\ttype: DatabaseIndexLookupType.EndsWith,\n\t\t\t\t\t\t\t\tvalue: before.predicate.target.value,\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst after = new RelationalIndexLookup(index, query)\n\t\t\t\t\t\t\tthis.memo.addRelational(after, group)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction createIndexQueryAll(length: number) {\n\tconst lookup: DatabaseIndexLookup = { type: DatabaseIndexLookupType.All }\n\treturn new Array(length).fill(lookup)\n}\n", "import type { Fields } from \"./Metadata.ts\"\n\n/**\n * Relational props describe the logical properties of the relation returned by\n * a relational node. While each node in a group can return the fields and\n * tuples in a different order and use a different algorithm to calculate them,\n * all nodes must return the same set of data. For example, a hash join and a\n * merge join will return the same set of tuples, but the order of the tuples\n * may be different.\n */\nexport class RelationalProps {\n\tconstructor(\n\t\t/**\n\t\t * The fields that are returned by the relational node. Fields that are\n\t\t * included in the output are not necessarily resolved yet. The set of\n\t\t * resolved fields are a physical property of the relational node.\n\t\t */\n\t\treadonly outputFields: Fields,\n\t) {}\n\n\t/**\n\t * Checks if the given relational properties are compatible with this.\n\t */\n\tisCompatible(other: RelationalProps) {\n\t\treturn this.outputFields.equals(other.outputFields)\n\t}\n}\n", "import { assert } from \"../../../utils/assert.ts\"\nimport { Group, GroupId } from \"./Group.ts\"\nimport type { Hash } from \"./Hashable.ts\"\nimport { RelationalProps } from \"./LogicalProps.ts\"\nimport type { AbstractNode } from \"./nodes/AbstractNode.ts\"\nimport type { RelationalNode } from \"./nodes/relational/RelationalNode.ts\"\nimport type { ScalarNode } from \"./nodes/scalar/ScalarNode.ts\"\n\n/**\n * The memo is a directed acyclic graph of every possible query plan. It\n * contains a list of groups, with all nodes in a group being logically\n * equivalent.\n *\n * The nodes in memo are also known as multi-expressions or memo-expression,\n * because the children of a node can be part of a group themselves.\n *\n * Nodes can be either relational (e.g. scan, join) or scalar (e.g. <, >). A\n * traditional cascades query optimizer differentiates between logical nodes and\n * physical nodes. A logical node is a node that describes what needs to be\n * done, while a physical implementation of the node is the actual algorithm.\n * For example, a logical join can be implemented by a physical nested loop join\n * or physical hash join. We took the same approach as CockroachDB, where every\n * node is both a logical and physical expression. This means even the initial\n * unoptimized query plan can be executed.\n *\n * Scalar nodes are not part of a group, because we don't generate logically\n * equivalent alternatives for them. We only store the normalized version in the\n * memo. This is because the performance difference of two logically equivalent\n * scalar nodes is negligible. But the performance difference of two relation\n * nodes might be significant.\n */\nexport class Memo {\n\t/**\n\t * A map of all nodes in the memo by their hash. This allows to easily find\n\t * duplicated nodes and their groups.\n\t */\n\tprivate readonly nodes = new Map<Hash, AbstractNode>()\n\n\t/**\n\t * A list of all groups in the memo. The id of a group is the index of the\n\t * group in this list.\n\t */\n\tprivate readonly groups: Group[] = []\n\n\t/**\n\t * Adds a new group with the given relational props to the memo. All nodes\n\t * in the group must have the same props. It's expected that the normalized\n\t * node is immediately added to the group after creating it.\n\t */\n\tprivate addGroup(relationalProps: RelationalProps) {\n\t\tconst id = GroupId(this.groups.length)\n\t\tconst group = new Group(id, relationalProps)\n\t\tthis.groups.push(group)\n\t\treturn group\n\t}\n\n\t/**\n\t * Adds a relational node to the memo and the group. If the node is already\n\t * in the memo, it returns the existing node. If no group is given, it\n\t * creates a new group with the given relational props of the node.\n\t */\n\taddRelational<Node extends RelationalNode>(node: Node, group?: Group) {\n\t\tconst hash = node.getHash()\n\n\t\t// If the node is already in the memo, return the existing node.\n\t\tconst existing = this.nodes.get(hash)\n\t\tif (existing) return existing as Node\n\n\t\t// Add the node to the memo.\n\t\tthis.nodes.set(hash, node)\n\n\t\t// Add the node to the group or create a new one if no group is given.\n\t\tconst outputFields = node.getOutputFields()\n\t\tconst relational = new RelationalProps(outputFields)\n\t\tgroup ??= this.addGroup(relational)\n\t\tgroup.addNode(node)\n\n\t\t// Every node in the group must have compatible relational props.\n\t\tassert(relational.isCompatible(group.relational), \"Group has inconsistent relational props\")\n\n\t\treturn node\n\t}\n\n\t/**\n\t * Adds a scalar node to the memo. If the node is already in the memo, it\n\t * returns the existing node.\n\t */\n\taddScalar<Node extends ScalarNode>(node: Node) {\n\t\tconst hash = node.getHash()\n\n\t\t// If the node is already in the memo, return the existing node.\n\t\tconst existing = this.nodes.get(hash)\n\t\tif (existing) return existing as Node\n\n\t\t// Add the node to the memo.\n\t\tthis.nodes.set(hash, node)\n\t\treturn node\n\t}\n}\n", "import { valueToBoolean } from \"../../../DatabaseValue.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport type { Group } from \"../../Group.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport { Ordering } from \"../../Ordering.ts\"\nimport { RequiredProps } from \"../../PhysicalProps.ts\"\nimport { Relation, Tuple } from \"../../Relation.ts\"\nimport { ScalarEquals } from \"../scalar/ScalarEquals.ts\"\nimport type { ScalarNode } from \"../scalar/ScalarNode.ts\"\nimport { RelationalNode } from \"./RelationalNode.ts\"\n\nexport class RelationalLeftJoin extends RelationalNode {\n\treadonly leftGroup: Group\n\treadonly rightGroup: Group\n\n\tconstructor(\n\t\treadonly left: RelationalNode,\n\t\treadonly right: RelationalNode,\n\t\treadonly constraint: ScalarNode,\n\t) {\n\t\tsuper(left.isSynchronous && right.isSynchronous && constraint.isSynchronous)\n\n\t\tthis.leftGroup = left.getGroup()\n\t\tthis.rightGroup = right.getGroup()\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"RelationalLeftJoin\", this.leftGroup.id, this.rightGroup.id, this.constraint)\n\t}\n\n\toverride getOutputFields() {\n\t\tconst outputFields = new Fields()\n\t\toutputFields.merge(this.leftGroup.relational.outputFields)\n\t\toutputFields.merge(this.rightGroup.relational.outputFields)\n\t\treturn outputFields\n\t}\n\n\toverride canProvideOrdering() {\n\t\treturn false\n\t}\n\n\toverride canProvideResolvedFields() {\n\t\treturn true\n\t}\n\n\tprivate getChildRequiredProps(group: Group, required: RequiredProps) {\n\t\tconst resolvedFields = new Fields()\n\t\tconst outputFields = group.relational.outputFields\n\n\t\tfor (const field of required.resolvedFields) {\n\t\t\tif (outputFields.has(field)) {\n\t\t\t\tresolvedFields.add(field)\n\t\t\t}\n\t\t}\n\n\t\tfor (const field of this.constraint.referencedFields) {\n\t\t\tif (outputFields.has(field)) {\n\t\t\t\tresolvedFields.add(field)\n\t\t\t}\n\t\t}\n\n\t\tconst ordering = new Ordering()\n\t\treturn new RequiredProps(ordering, resolvedFields)\n\t}\n\n\toverride optimize(optimizer: Optimizer, required: RequiredProps) {\n\t\tconst leftRequired = this.getChildRequiredProps(this.leftGroup, required)\n\t\tconst leftCost = optimizer.optimizeGroup(this.leftGroup, leftRequired)\n\n\t\tconst rightRequired = this.getChildRequiredProps(this.rightGroup, required)\n\t\tconst rightCost = optimizer.optimizeGroup(this.rightGroup, rightRequired)\n\n\t\tconst constraintCost = this.constraint.optimize(optimizer)\n\n\t\treturn Cost.max(Cost.max(leftCost, rightCost), constraintCost)\n\t}\n\n\toverride getOptimized(required: RequiredProps) {\n\t\tconst leftRequired = this.getChildRequiredProps(this.leftGroup, required)\n\t\tconst left = this.leftGroup.getOptimized(leftRequired)\n\n\t\tconst rightRequired = this.getChildRequiredProps(this.rightGroup, required)\n\t\tconst right = this.rightGroup.getOptimized(rightRequired)\n\n\t\tconst constraint = this.constraint.getOptimized()\n\n\t\treturn new RelationalLeftJoin(left, right, constraint)\n\t}\n\n\t/** Optimized path for equality constraints that runs in O(n + m) time. */\n\tprivate *evaluateScalarEquals(\n\t\tleft: Relation,\n\t\tright: Relation,\n\t\tleftConstraint: ScalarNode,\n\t\trightConstraint: ScalarNode,\n\t\tcontext: Tuple | undefined,\n\t) {\n\t\tconst joinKeyMap = new Map<string, Tuple[]>()\n\n\t\tfor (const rightTuple of right.tuples) {\n\t\t\tconst rightValue = yield* rightConstraint.evaluate(context, rightTuple)\n\t\t\tconst key = JSON.stringify(rightValue?.value ?? null)\n\n\t\t\tconst tuplesForKey = joinKeyMap.get(key) ?? []\n\n\t\t\ttuplesForKey.push(rightTuple)\n\t\t\tjoinKeyMap.set(key, tuplesForKey)\n\t\t}\n\n\t\tconst outputFields = this.getOutputFields()\n\t\tconst result = new Relation(outputFields)\n\n\t\tfor (const leftTuple of left.tuples) {\n\t\t\tconst leftValue = yield* leftConstraint.evaluate(context, leftTuple)\n\t\t\tconst key = JSON.stringify(leftValue?.value ?? null)\n\n\t\t\tconst matches = joinKeyMap.get(key) ?? []\n\n\t\t\tif (matches.length === 0) {\n\t\t\t\tresult.push(leftTuple)\n\t\t\t} else {\n\t\t\t\tfor (const rightTuple of matches) {\n\t\t\t\t\tconst joinedTuple = new Tuple()\n\t\t\t\t\tjoinedTuple.merge(leftTuple)\n\t\t\t\t\tjoinedTuple.merge(rightTuple)\n\t\t\t\t\tresult.push(joinedTuple)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn result\n\t}\n\n\toverride *evaluate(context: Tuple | undefined): Evaluate<Relation> {\n\t\tconst { left, right } = yield* evaluateObject({\n\t\t\tleft: this.left.evaluate(context),\n\t\t\tright: this.right.evaluate(context),\n\t\t})\n\n\t\tif (this.constraint instanceof ScalarEquals) {\n\t\t\tif (\n\t\t\t\tthis.constraint.left.referencedFields.subsetOf(this.leftGroup.relational.outputFields) &&\n\t\t\t\tthis.constraint.right.referencedFields.subsetOf(this.rightGroup.relational.outputFields)\n\t\t\t) {\n\t\t\t\treturn yield* this.evaluateScalarEquals(left, right, this.constraint.left, this.constraint.right, context)\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tthis.constraint.right.referencedFields.subsetOf(this.leftGroup.relational.outputFields) &&\n\t\t\t\tthis.constraint.left.referencedFields.subsetOf(this.rightGroup.relational.outputFields)\n\t\t\t) {\n\t\t\t\treturn yield* this.evaluateScalarEquals(left, right, this.constraint.right, this.constraint.left, context)\n\t\t\t}\n\t\t}\n\n\t\tconst outputFields = this.getOutputFields()\n\t\tconst result = new Relation(outputFields)\n\n\t\tfor (const leftTuple of left.tuples) {\n\t\t\tlet hasMatch = false\n\n\t\t\tfor (const rightTuple of right.tuples) {\n\t\t\t\tconst tuple = new Tuple()\n\t\t\t\ttuple.merge(leftTuple)\n\t\t\t\ttuple.merge(rightTuple)\n\n\t\t\t\t// TODO: Run the constraint in parallel\n\t\t\t\tconst value = yield* this.constraint.evaluate(context, tuple)\n\t\t\t\tif (valueToBoolean(value)) {\n\t\t\t\t\tresult.push(tuple)\n\t\t\t\t\thasMatch = true\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!hasMatch) {\n\t\t\t\tresult.push(leftTuple)\n\t\t\t}\n\t\t}\n\n\t\treturn result\n\t}\n}\n", "import { valueToNumber } from \"../../../DatabaseValue.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport type { Group } from \"../../Group.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Ordering } from \"../../Ordering.ts\"\nimport { RequiredProps } from \"../../PhysicalProps.ts\"\nimport type { Relation, Tuple } from \"../../Relation.ts\"\nimport type { ScalarNode } from \"../scalar/ScalarNode.ts\"\nimport { RelationalNode } from \"./RelationalNode.ts\"\n\nexport class RelationalLimit extends RelationalNode {\n\treadonly inputGroup: Group\n\n\tconstructor(\n\t\treadonly input: RelationalNode,\n\t\treadonly limit: ScalarNode,\n\t\treadonly ordering: Ordering,\n\t) {\n\t\tsuper(input.isSynchronous && limit.isSynchronous)\n\n\t\tthis.inputGroup = input.getGroup()\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"RelationalLimit\", this.inputGroup.id, this.limit)\n\t}\n\n\toverride getOutputFields() {\n\t\treturn this.inputGroup.relational.outputFields\n\t}\n\n\toverride canProvideOrdering(ordering: Ordering) {\n\t\treturn ordering.equals(this.ordering)\n\t}\n\n\toverride canProvideResolvedFields() {\n\t\treturn true\n\t}\n\n\tprivate getInputRequiredProps(required: RequiredProps) {\n\t\tconst resolvedFields = new Fields(required.resolvedFields)\n\t\tresolvedFields.merge(this.limit.referencedFields)\n\n\t\treturn new RequiredProps(this.ordering, resolvedFields)\n\t}\n\n\toverride optimize(optimizer: Optimizer, required: RequiredProps) {\n\t\tconst inputRequired = this.getInputRequiredProps(required)\n\t\tconst inputCost = optimizer.optimizeGroup(this.inputGroup, inputRequired)\n\n\t\tconst limitCost = this.limit.optimize(optimizer)\n\n\t\treturn new Cost(0).add(Cost.max(inputCost, limitCost))\n\t}\n\n\toverride getOptimized(required: RequiredProps) {\n\t\tconst inputRequired = this.getInputRequiredProps(required)\n\t\tconst input = this.inputGroup.getOptimized(inputRequired)\n\n\t\tconst limit = this.limit.getOptimized()\n\n\t\treturn new RelationalLimit(input, limit, this.ordering)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined): Evaluate<Relation> {\n\t\tconst { input, limit } = yield* evaluateObject({\n\t\t\tinput: this.input.evaluate(context),\n\t\t\tlimit: this.limit.evaluate(context, undefined),\n\t\t})\n\n\t\tconst value = valueToNumber(limit) ?? Infinity\n\t\tif (value === Infinity) return input\n\n\t\treturn input.slice(0, value)\n\t}\n}\n", "import { valueToNumber } from \"../../../DatabaseValue.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport type { Group } from \"../../Group.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Ordering } from \"../../Ordering.ts\"\nimport { RequiredProps } from \"../../PhysicalProps.ts\"\nimport type { Relation, Tuple } from \"../../Relation.ts\"\nimport type { ScalarNode } from \"../scalar/ScalarNode.ts\"\nimport { RelationalNode } from \"./RelationalNode.ts\"\n\nexport class RelationalOffset extends RelationalNode {\n\treadonly inputGroup: Group\n\n\tconstructor(\n\t\treadonly input: RelationalNode,\n\t\treadonly offset: ScalarNode,\n\t\treadonly ordering: Ordering,\n\t) {\n\t\tsuper(input.isSynchronous && offset.isSynchronous)\n\n\t\tthis.inputGroup = input.getGroup()\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"RelationalOffset\", this.inputGroup.id, this.offset)\n\t}\n\n\toverride getOutputFields() {\n\t\treturn this.inputGroup.relational.outputFields\n\t}\n\n\toverride canProvideOrdering(ordering: Ordering) {\n\t\treturn ordering.equals(this.ordering)\n\t}\n\n\toverride canProvideResolvedFields() {\n\t\treturn true\n\t}\n\n\tprivate getInputRequiredProps(required: RequiredProps) {\n\t\tconst resolvedFields = new Fields(required.resolvedFields)\n\t\tresolvedFields.merge(this.offset.referencedFields)\n\n\t\treturn new RequiredProps(this.ordering, resolvedFields)\n\t}\n\n\toverride optimize(optimizer: Optimizer, required: RequiredProps) {\n\t\tconst inputRequired = this.getInputRequiredProps(required)\n\t\tconst inputCost = optimizer.optimizeGroup(this.inputGroup, inputRequired)\n\n\t\tconst offsetCost = this.offset.optimize(optimizer)\n\n\t\treturn new Cost(0).add(Cost.max(inputCost, offsetCost))\n\t}\n\n\toverride getOptimized(required: RequiredProps) {\n\t\tconst inputRequired = this.getInputRequiredProps(required)\n\t\tconst input = this.inputGroup.getOptimized(inputRequired)\n\n\t\tconst offset = this.offset.getOptimized()\n\n\t\treturn new RelationalOffset(input, offset, this.ordering)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined): Evaluate<Relation> {\n\t\tconst { input, offset } = yield* evaluateObject({\n\t\t\tinput: this.input.evaluate(context),\n\t\t\toffset: this.offset.evaluate(context, undefined),\n\t\t})\n\n\t\tconst value = valueToNumber(offset) ?? 0\n\t\tif (value === 0) return input\n\n\t\treturn input.slice(value)\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { isUndefined } from \"../../../../../utils/utils.ts\"\nimport type { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport type { Group } from \"../../Group.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport type { FieldId } from \"../../Metadata.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Ordering } from \"../../Ordering.ts\"\nimport { RequiredProps } from \"../../PhysicalProps.ts\"\nimport { Tuple } from \"../../Relation.ts\"\nimport type { NamedFields } from \"../../Scope.ts\"\nimport type { RelationalNode } from \"../relational/RelationalNode.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nexport class ScalarArray extends ScalarNode {\n\treadonly inputGroup: Group\n\treadonly definition: DatabaseValueDefinition\n\n\tconstructor(\n\t\treadonly input: RelationalNode,\n\t\treadonly namedFields: NamedFields,\n\t\treadonly ordering: Ordering,\n\t\toverride readonly referencedFields: Fields,\n\t\toverride readonly referencedOuterFields: Fields,\n\t) {\n\t\tsuper(referencedFields, referencedOuterFields, input.isSynchronous)\n\n\t\tthis.inputGroup = input.getGroup()\n\n\t\tconst itemDefinitions: Record<string, DatabaseValueDefinition> = {}\n\n\t\tconst namedFieldEntries = Object.entries(namedFields)\n\t\tfor (const [name, field] of namedFieldEntries) {\n\t\t\titemDefinitions[name] = field.definition\n\t\t}\n\n\t\tthis.definition = {\n\t\t\ttype: ControlType.Array,\n\t\t\tisNullable: false,\n\t\t\tdefinition: {\n\t\t\t\ttype: ControlType.Object,\n\t\t\t\tisNullable: false,\n\t\t\t\tdefinitions: itemDefinitions,\n\t\t\t},\n\t\t}\n\t}\n\n\toverride getHash() {\n\t\tconst namedFieldIds: Record<string, FieldId> = {}\n\t\tconst namedFieldEntries = Object.entries(this.namedFields)\n\n\t\tfor (const [name, field] of namedFieldEntries) {\n\t\t\tnamedFieldIds[name] = field.id\n\t\t}\n\n\t\treturn calculateHash(\n\t\t\t\"ScalarArray\",\n\t\t\tthis.inputGroup.id,\n\t\t\tnamedFieldIds,\n\t\t\tthis.ordering,\n\t\t\tthis.referencedFields,\n\t\t\tthis.referencedOuterFields,\n\t\t)\n\t}\n\n\tprivate getInputRequiredProps() {\n\t\tconst resolvedFields = new Fields()\n\n\t\tconst fields = Object.values(this.namedFields)\n\t\tfor (const field of fields) {\n\t\t\tif (isUndefined(field.collection)) continue\n\t\t\tresolvedFields.add(field)\n\t\t}\n\n\t\treturn new RequiredProps(this.ordering, resolvedFields)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst inputRequired = this.getInputRequiredProps()\n\t\tconst inputCost = optimizer.optimizeGroup(this.inputGroup, inputRequired)\n\n\t\treturn new Cost(0).add(inputCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst inputRequired = this.getInputRequiredProps()\n\t\tconst input = this.inputGroup.getOptimized(inputRequired)\n\n\t\treturn new ScalarArray(input, this.namedFields, this.ordering, this.referencedFields, this.referencedOuterFields)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst inputContext = new Tuple()\n\t\tif (context) inputContext.merge(context)\n\t\tif (tuple) inputContext.merge(tuple)\n\n\t\tconst relation = yield* this.input.evaluate(inputContext)\n\t\tconst namedFieldEntries = Object.entries(this.namedFields)\n\n\t\treturn {\n\t\t\ttype: ControlType.Array,\n\t\t\tvalue: relation.tuples.map(relationTuple => {\n\t\t\t\tconst value: Record<string, DatabaseValue> = {}\n\n\t\t\t\tfor (const [name, field] of namedFieldEntries) {\n\t\t\t\t\tvalue[name] = relationTuple.getValue(field)\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\ttype: ControlType.Object,\n\t\t\t\t\tvalue,\n\t\t\t\t}\n\t\t\t}),\n\t\t}\n\t}\n}\n", "import { assert } from \"../../../../../utils/assert.ts\"\nimport { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nexport class ScalarCast extends ScalarNode {\n\tconstructor(\n\t\treadonly input: ScalarNode,\n\t\treadonly definition: DatabaseValueDefinition,\n\t) {\n\t\tsuper(input.referencedFields, input.referencedOuterFields, input.isSynchronous)\n\n\t\tassert(definition.isNullable, \"Unsupported non-nullable cast\")\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarCast\", this.input, this.definition)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\treturn this.input.optimize(optimizer)\n\t}\n\n\toverride getOptimized() {\n\t\tconst input = this.input.getOptimized()\n\t\treturn new ScalarCast(input, this.definition)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst input = yield* this.input.evaluate(context, tuple)\n\t\treturn DatabaseValue.cast(input, this.definition)\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { isUndefined } from \"../../../../../utils/utils.ts\"\nimport type { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport type { Group } from \"../../Group.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport type { FieldMetadata } from \"../../Metadata.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Ordering } from \"../../Ordering.ts\"\nimport { RequiredProps } from \"../../PhysicalProps.ts\"\nimport { Tuple } from \"../../Relation.ts\"\nimport type { RelationalNode } from \"../relational/RelationalNode.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nexport class ScalarFlatArray extends ScalarNode {\n\treadonly inputGroup: Group\n\treadonly definition: DatabaseValueDefinition\n\n\tconstructor(\n\t\treadonly input: RelationalNode,\n\t\treadonly field: FieldMetadata,\n\t\treadonly ordering: Ordering,\n\t\toverride readonly referencedFields: Fields,\n\t\toverride readonly referencedOuterFields: Fields,\n\t) {\n\t\tsuper(referencedFields, referencedOuterFields, input.isSynchronous)\n\n\t\tthis.inputGroup = input.getGroup()\n\n\t\tthis.definition = {\n\t\t\ttype: ControlType.Array,\n\t\t\tisNullable: false,\n\t\t\tdefinition: field.definition,\n\t\t}\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\n\t\t\t\"ScalarFlatArray\",\n\t\t\tthis.inputGroup.id,\n\t\t\tthis.field.id,\n\t\t\tthis.ordering,\n\t\t\tthis.referencedFields,\n\t\t\tthis.referencedOuterFields,\n\t\t)\n\t}\n\n\tprivate getInputRequiredProps() {\n\t\tconst resolvedFields = new Fields()\n\n\t\tif (!isUndefined(this.field.collection)) {\n\t\t\tresolvedFields.add(this.field)\n\t\t}\n\n\t\treturn new RequiredProps(this.ordering, resolvedFields)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst inputRequired = this.getInputRequiredProps()\n\t\tconst inputCost = optimizer.optimizeGroup(this.inputGroup, inputRequired)\n\n\t\treturn new Cost(0).add(inputCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst inputRequired = this.getInputRequiredProps()\n\t\tconst input = this.inputGroup.getOptimized(inputRequired)\n\n\t\treturn new ScalarFlatArray(input, this.field, this.ordering, this.referencedFields, this.referencedOuterFields)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst inputContext = new Tuple()\n\t\tif (context) inputContext.merge(context)\n\t\tif (tuple) inputContext.merge(tuple)\n\n\t\tconst relation = yield* this.input.evaluate(inputContext)\n\n\t\treturn {\n\t\t\ttype: ControlType.Array,\n\t\t\tvalue: relation.tuples.map(relationTuple => {\n\t\t\t\treturn relationTuple.getValue(this.field)\n\t\t\t}),\n\t\t}\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport type { DatabaseCollation } from \"../../../types.ts\"\nimport { DatabaseCollationType } from \"../../../types.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nconst collation: DatabaseCollation = {\n\ttype: DatabaseCollationType.CaseInsensitive,\n}\n\nexport class ScalarIn extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Boolean,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(\n\t\treadonly left: ScalarNode,\n\t\treadonly right: ScalarNode,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\treferencedFields.merge(left.referencedFields)\n\t\treferencedFields.merge(right.referencedFields)\n\n\t\tconst referencedOuterFields = new Fields()\n\t\treferencedOuterFields.merge(left.referencedOuterFields)\n\t\treferencedOuterFields.merge(right.referencedOuterFields)\n\n\t\tconst isSynchronous = left.isSynchronous && right.isSynchronous\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarIn\", this.left, this.right)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst leftCost = this.left.optimize(optimizer)\n\t\tconst rightCost = this.right.optimize(optimizer)\n\n\t\treturn Cost.max(leftCost, rightCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst left = this.left.getOptimized()\n\t\tconst right = this.right.getOptimized()\n\n\t\treturn new ScalarIn(left, right)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { left, right } = yield* evaluateObject({\n\t\t\tleft: this.left.evaluate(context, tuple),\n\t\t\tright: this.right.evaluate(context, tuple),\n\t\t})\n\n\t\treturn {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tvalue: DatabaseValue.in(left, right, collation),\n\t\t}\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport type { DatabaseCollation } from \"../../../types.ts\"\nimport { DatabaseCollationType } from \"../../../types.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nconst collation: DatabaseCollation = {\n\ttype: DatabaseCollationType.CaseSensitive,\n}\n\nexport class ScalarIndexOf extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Number,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(\n\t\treadonly source: ScalarNode,\n\t\treadonly target: ScalarNode,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\treferencedFields.merge(source.referencedFields)\n\t\treferencedFields.merge(target.referencedFields)\n\n\t\tconst referencedOuterFields = new Fields()\n\t\treferencedOuterFields.merge(source.referencedOuterFields)\n\t\treferencedOuterFields.merge(target.referencedOuterFields)\n\n\t\tconst isSynchronous = source.isSynchronous && target.isSynchronous\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarIndexOf\", this.source, this.target)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst sourceCost = this.source.optimize(optimizer)\n\t\tconst targetCost = this.target.optimize(optimizer)\n\n\t\treturn Cost.max(sourceCost, targetCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst source = this.source.getOptimized()\n\t\tconst target = this.target.getOptimized()\n\n\t\treturn new ScalarIndexOf(source, target)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { source, target } = yield* evaluateObject({\n\t\t\tsource: this.source.evaluate(context, tuple),\n\t\t\ttarget: this.target.evaluate(context, tuple),\n\t\t})\n\n\t\treturn {\n\t\t\ttype: ControlType.Number,\n\t\t\tvalue: DatabaseValue.indexOf(source, target, collation),\n\t\t}\n\t}\n}\n", "import { assert } from \"@framerjs/shared/src/assert.ts\"\nimport { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport type { DatabaseStringValue, DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport type { Hash } from \"../../Hashable.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nexport class ScalarIntersection extends ScalarNode {\n\toverride readonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Array,\n\t\tdefinition: {\n\t\t\ttype: ControlType.String,\n\t\t\tisNullable: false,\n\t\t},\n\t\tisNullable: false,\n\t}\n\n\tconstructor(\n\t\tpublic readonly left: ScalarNode,\n\t\tpublic readonly right: ScalarNode,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\treferencedFields.merge(left.referencedFields)\n\t\treferencedFields.merge(right.referencedFields)\n\n\t\tconst referencedOuterFields = new Fields()\n\t\treferencedOuterFields.merge(left.referencedOuterFields)\n\t\treferencedOuterFields.merge(right.referencedOuterFields)\n\n\t\tconst isSynchronous = left.isSynchronous && right.isSynchronous\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash(): Hash {\n\t\treturn calculateHash(\"ScalarIntersection\", this.left, this.right)\n\t}\n\n\toverride optimize(optimizer: Optimizer): Cost {\n\t\tconst leftCost = this.left.optimize(optimizer)\n\t\tconst rightCost = this.right.optimize(optimizer)\n\n\t\treturn Cost.max(leftCost, rightCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst left = this.left.getOptimized()\n\t\tconst right = this.right.getOptimized()\n\n\t\treturn new ScalarIntersection(left, right)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { left, right } = yield* evaluateObject({\n\t\t\tleft: this.left.evaluate(context, tuple),\n\t\t\tright: this.right.evaluate(context, tuple),\n\t\t})\n\n\t\tconst leftSet = databaseValueToSet(left)\n\t\tconst rightSet = databaseValueToSet(right)\n\t\tconst intersection: DatabaseStringValue[] = []\n\n\t\tconst shortestSet = leftSet.size < rightSet.size ? leftSet : rightSet\n\t\tconst longestSet = shortestSet === leftSet ? rightSet : leftSet\n\n\t\tfor (const item of shortestSet) {\n\t\t\tif (longestSet.has(item)) {\n\t\t\t\tintersection.push({\n\t\t\t\t\ttype: ControlType.String,\n\t\t\t\t\tvalue: item,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\ttype: ControlType.Array,\n\t\t\tvalue: intersection,\n\t\t}\n\t}\n}\n\nfunction databaseValueToSet(value: DatabaseValue) {\n\tconst set = new Set<string>()\n\n\tif (!value) return set\n\tassert(value.type === ControlType.Array, \"ScalarIntersection expects an array, got:\", value.type)\n\n\tfor (const item of value.value) {\n\t\tif (!item) continue\n\t\tassert(\n\t\t\titem.type === ControlType.String,\n\t\t\t\"ScalarIntersection expects an array of strings, got an array with:\",\n\t\t\titem.type,\n\t\t)\n\n\t\tset.add(item.value)\n\t}\n\n\treturn set\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nexport class ScalarLength extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Number,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(readonly input: ScalarNode) {\n\t\tsuper(input.referencedFields, input.referencedOuterFields, input.isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarLength\", this.input)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\treturn this.input.optimize(optimizer)\n\t}\n\n\toverride getOptimized() {\n\t\tconst input = this.input.getOptimized()\n\t\treturn new ScalarLength(input)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst input = yield* this.input.evaluate(context, tuple)\n\n\t\treturn {\n\t\t\ttype: ControlType.Number,\n\t\t\tvalue: DatabaseValue.length(input),\n\t\t}\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport type { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport { valueToBoolean } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nexport class ScalarNot extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Boolean,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(readonly input: ScalarNode) {\n\t\tsuper(input.referencedFields, input.referencedOuterFields, input.isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarNot\", this.input)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\treturn this.input.optimize(optimizer)\n\t}\n\n\toverride getOptimized() {\n\t\tconst input = this.input.getOptimized()\n\t\treturn new ScalarNot(input)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst input = yield* this.input.evaluate(context, tuple)\n\n\t\treturn {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tvalue: !valueToBoolean(input),\n\t\t}\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport type { DatabaseCollation } from \"../../../types.ts\"\nimport { DatabaseCollationType } from \"../../../types.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nconst collation: DatabaseCollation = {\n\ttype: DatabaseCollationType.CaseInsensitive,\n}\n\nexport class ScalarNotIn extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Boolean,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(\n\t\treadonly left: ScalarNode,\n\t\treadonly right: ScalarNode,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\treferencedFields.merge(left.referencedFields)\n\t\treferencedFields.merge(right.referencedFields)\n\n\t\tconst referencedOuterFields = new Fields()\n\t\treferencedOuterFields.merge(left.referencedOuterFields)\n\t\treferencedOuterFields.merge(right.referencedOuterFields)\n\n\t\tconst isSynchronous = left.isSynchronous && right.isSynchronous\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarNotIn\", this.left, this.right)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst leftCost = this.left.optimize(optimizer)\n\t\tconst rightCost = this.right.optimize(optimizer)\n\n\t\treturn Cost.max(leftCost, rightCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst left = this.left.getOptimized()\n\t\tconst right = this.right.getOptimized()\n\n\t\treturn new ScalarNotIn(left, right)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { left, right } = yield* evaluateObject({\n\t\t\tleft: this.left.evaluate(context, tuple),\n\t\t\tright: this.right.evaluate(context, tuple),\n\t\t})\n\n\t\treturn {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tvalue: !DatabaseValue.in(left, right, collation),\n\t\t}\n\t}\n}\n", "import { assert } from \"../../../../../utils/assert.ts\"\nimport type { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport { unknownDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { FieldId, FieldMetadata, Fields, VIRTUAL_INDEX_FIELD } from \"../../Metadata.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nexport class ScalarVariable extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition\n\n\tconstructor(\n\t\treadonly field: FieldMetadata,\n\t\treadonly isOuterField: boolean,\n\t) {\n\t\t// The virtual index field can only be used for ordering.\n\t\tassert(field.name !== VIRTUAL_INDEX_FIELD, \"Invalid field name\")\n\n\t\tconst referencedFields = new Fields()\n\t\tconst referencedOuterFields = new Fields()\n\n\t\tif (isOuterField) {\n\t\t\treferencedOuterFields.add(field)\n\t\t} else {\n\t\t\treferencedFields.add(field)\n\t\t}\n\n\t\tsuper(referencedFields, referencedOuterFields, true)\n\n\t\tthis.definition = field.definition\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarVariable\", this.field.id, this.isOuterField)\n\t}\n\n\toverride optimize() {\n\t\treturn new Cost(0)\n\t}\n\n\toverride getOptimized() {\n\t\treturn this\n\t}\n\n\t// biome-ignore lint/correctness/useYield: Required by the super class.\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tif (this.isOuterField) {\n\t\t\tassert(context, \"Context must exist\")\n\t\t\treturn context.getValue(this.field)\n\t\t}\n\n\t\tassert(tuple, \"Tuple must exist\")\n\t\treturn tuple.getValue(this.field)\n\t}\n}\n\nexport function createScalarVariable(fieldId: number, isOuterField: boolean = true) {\n\treturn new ScalarVariable(new FieldMetadata(FieldId(fieldId), \"Field\", unknownDefinition, undefined), isOuterField)\n}\n", "import { ControlType } from \"../../../render/types/PropertyControls.ts\"\nimport type { DatabaseValue } from \"../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../DatabaseValueDefinition.ts\"\nimport type { DatabaseIndexLookup } from \"../types.ts\"\nimport type { Memo } from \"./Memo.ts\"\nimport type { CollectionMetadata, FieldMetadata, Fields, IndexMetadata } from \"./Metadata.ts\"\nimport type { Ordering } from \"./Ordering.ts\"\nimport type { NamedFields } from \"./Scope.ts\"\nimport { RelationalFilter } from \"./nodes/relational/RelationalFilter.ts\"\nimport { RelationalIndexLookup } from \"./nodes/relational/RelationalIndexLookup.ts\"\nimport { RelationalLeftJoin } from \"./nodes/relational/RelationalLeftJoin.ts\"\nimport { RelationalLimit } from \"./nodes/relational/RelationalLimit.ts\"\nimport type { RelationalNode } from \"./nodes/relational/RelationalNode.ts\"\nimport { RelationalOffset } from \"./nodes/relational/RelationalOffset.ts\"\nimport type { ProjectionField } from \"./nodes/relational/RelationalProject.ts\"\nimport { RelationalProject } from \"./nodes/relational/RelationalProject.ts\"\nimport { RelationalScan } from \"./nodes/relational/RelationalScan.ts\"\nimport { ScalarAnd } from \"./nodes/scalar/ScalarAnd.ts\"\nimport { ScalarArray } from \"./nodes/scalar/ScalarArray.ts\"\nimport { CaseCondition, ScalarCase } from \"./nodes/scalar/ScalarCase.ts\"\nimport { ScalarCast } from \"./nodes/scalar/ScalarCast.ts\"\nimport { ScalarConstant } from \"./nodes/scalar/ScalarConstant.ts\"\nimport { ScalarContains } from \"./nodes/scalar/ScalarContains.ts\"\nimport { ScalarEndsWith } from \"./nodes/scalar/ScalarEndsWith.ts\"\nimport { ScalarEquals } from \"./nodes/scalar/ScalarEquals.ts\"\nimport { ScalarFlatArray } from \"./nodes/scalar/ScalarFlatArray.ts\"\nimport { ScalarGreaterThan } from \"./nodes/scalar/ScalarGreaterThan.ts\"\nimport { ScalarGreaterThanOrEqual } from \"./nodes/scalar/ScalarGreaterThanOrEqual.ts\"\nimport { ScalarIn } from \"./nodes/scalar/ScalarIn.ts\"\nimport { ScalarIndexOf } from \"./nodes/scalar/ScalarIndexOf.ts\"\nimport { ScalarIntersection } from \"./nodes/scalar/ScalarIntersection.ts\"\nimport { ScalarLength } from \"./nodes/scalar/ScalarLength.ts\"\nimport { ScalarLessThan } from \"./nodes/scalar/ScalarLessThan.ts\"\nimport { ScalarLessThanOrEqual } from \"./nodes/scalar/ScalarLessThanOrEqual.ts\"\nimport type { ScalarNode } from \"./nodes/scalar/ScalarNode.ts\"\nimport { ScalarNot } from \"./nodes/scalar/ScalarNot.ts\"\nimport { ScalarNotEquals } from \"./nodes/scalar/ScalarNotEquals.ts\"\nimport { ScalarNotIn } from \"./nodes/scalar/ScalarNotIn.ts\"\nimport { ScalarOr } from \"./nodes/scalar/ScalarOr.ts\"\nimport { ScalarStartsWith } from \"./nodes/scalar/ScalarStartsWith.ts\"\nimport { ScalarVariable } from \"./nodes/scalar/ScalarVariable.ts\"\n\n/**\n * The normalizer converts nodes into their normalized form and inserts them\n * into the memo. This is the most common way to insert a node into the memo.\n *\n * If a normalized node is already in the memo, it will be returned instead.\n * Otherwise, a new memo group is created and the node is inserted into it as\n * its first and only child. The explorer will then create logically equivalent\n * nodes and add them into the same group.\n */\nexport class Normalizer {\n\tconstructor(readonly memo: Memo) {}\n\n\tprivate finishRelational(node: RelationalNode) {\n\t\treturn this.memo.addRelational(node)\n\t}\n\n\tnewRelationalScan(collection: CollectionMetadata): RelationalNode {\n\t\tconst node = new RelationalScan(collection)\n\t\treturn this.finishRelational(node)\n\t}\n\n\tnewRelationalIndexLookup(index: IndexMetadata, query: DatabaseIndexLookup[]): RelationalNode {\n\t\tconst node = new RelationalIndexLookup(index, query)\n\t\treturn this.finishRelational(node)\n\t}\n\n\tnewRelationalLeftJoin(left: RelationalNode, right: RelationalNode, constraint: ScalarNode): RelationalNode {\n\t\tconst node = new RelationalLeftJoin(left, right, constraint)\n\t\treturn this.finishRelational(node)\n\t}\n\n\tnewRelationalRightJoin(left: RelationalNode, right: RelationalNode, constraint: ScalarNode): RelationalNode {\n\t\t// Replace `RelationalRightJoin` with `RelationalLeftJoin`.\n\t\treturn this.newRelationalLeftJoin(right, left, constraint)\n\t}\n\n\tnewRelationalFilter(input: RelationalNode, predicate: ScalarNode): RelationalNode {\n\t\t// Ignore filters that are always true.\n\t\tif (\n\t\t\tpredicate instanceof ScalarConstant &&\n\t\t\tpredicate.value?.type === ControlType.Boolean &&\n\t\t\tpredicate.value.value === true\n\t\t) {\n\t\t\treturn input\n\t\t}\n\n\t\t// Push `RelationalFilter` through `RelationalLeftJoin`.\n\t\tif (\n\t\t\tinput instanceof RelationalLeftJoin &&\n\t\t\t// Check that the predicate doesn't depend on any joined field.\n\t\t\tpredicate.referencedFields.subsetOf(input.leftGroup.relational.outputFields)\n\t\t) {\n\t\t\tconst pushedFilter = this.newRelationalFilter(input.left, predicate)\n\t\t\treturn this.newRelationalLeftJoin(pushedFilter, input.right, input.constraint)\n\t\t}\n\n\t\tconst node = new RelationalFilter(input, predicate)\n\t\treturn this.finishRelational(node)\n\t}\n\n\tnewRelationalProject(input: RelationalNode, projections: ProjectionField[], passthrough: Fields): RelationalNode {\n\t\tconst node = new RelationalProject(input, projections, passthrough)\n\t\treturn this.finishRelational(node)\n\t}\n\n\tnewRelationalLimit(input: RelationalNode, limit: ScalarNode, ordering: Ordering): RelationalNode {\n\t\t// Push `RelationalLimit` through `RelationalProject`.\n\t\tif (\n\t\t\tinput instanceof RelationalProject &&\n\t\t\t// Check that the limit doesn't depend on any projected field.\n\t\t\tlimit.referencedFields.subsetOf(input.inputGroup.relational.outputFields) &&\n\t\t\t// Check that the ordering doesn't depend on any projected field.\n\t\t\tordering.providedByFields(input.inputGroup.relational.outputFields)\n\t\t) {\n\t\t\tconst pushedLimit = this.newRelationalLimit(input.input, limit, ordering)\n\t\t\treturn this.newRelationalProject(pushedLimit, input.projections, input.passthrough)\n\t\t}\n\n\t\tconst node = new RelationalLimit(input, limit, ordering)\n\t\treturn this.finishRelational(node)\n\t}\n\n\tnewRelationalOffset(input: RelationalNode, offset: ScalarNode, ordering: Ordering): RelationalNode {\n\t\tconst node = new RelationalOffset(input, offset, ordering)\n\t\treturn this.finishRelational(node)\n\t}\n\n\tprivate finishScalar(node: ScalarNode) {\n\t\tconst isConstant = node instanceof ScalarConstant\n\n\t\t// Pre-compute nodes that don't depend on any variable.\n\t\tif (\n\t\t\t!isConstant &&\n\t\t\tnode.isSynchronous &&\n\t\t\tnode.referencedFields.size === 0 &&\n\t\t\tnode.referencedOuterFields.size === 0\n\t\t) {\n\t\t\tconst value = node.evaluateSync()\n\t\t\treturn this.newScalarConstant(node.definition, value)\n\t\t}\n\n\t\treturn this.memo.addScalar(node)\n\t}\n\n\t/**\n\t * When we create `ScalarConstant` nodes, we always give them an unknown\n\t * type definition. Before we compare them to other nodes, we need to cast\n\t * them to a specific type.\n\t *\n\t * For example, in the following query:\n\t * ```\n\t * SELECT id FROM cars WHERE type = \"coupe\"\n\t * ```\n\t *\n\t * If the `type` field is an enum, and we parse the `\"coupe\"` constant as a\n\t * string, the where clause will always be false because an enum can't be\n\t * equal to a string. But if we cast the string to an enum type first, the\n\t * where clause will work as expected.\n\t */\n\tprivate removeUnknown(node: ScalarNode, definition: DatabaseValueDefinition) {\n\t\t// The node already has a specific type.\n\t\tif (node.definition.type !== \"unknown\") return node\n\t\t// We don't know a more specific type.\n\t\tif (definition.type === \"unknown\") return node\n\n\t\tconst nullableDefinition: DatabaseValueDefinition = { ...definition, isNullable: true }\n\t\treturn this.newScalarCast(node, nullableDefinition)\n\t}\n\n\tnewScalarVariable(field: FieldMetadata, isOuterField: boolean): ScalarNode {\n\t\tconst node = new ScalarVariable(field, isOuterField)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarConstant(definition: DatabaseValueDefinition, value: DatabaseValue): ScalarNode {\n\t\tconst node = new ScalarConstant(definition, value)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarNot(input: ScalarNode): ScalarNode {\n\t\t// Normalize `NOT NOT $1` to `CAST($1 AS BOOLEAN)`\n\t\tif (input instanceof ScalarNot) {\n\t\t\tif (input.input.definition.type === ControlType.Boolean) {\n\t\t\t\treturn input.input\n\t\t\t}\n\n\t\t\tconst definition: DatabaseValueDefinition = { type: ControlType.Boolean, isNullable: true }\n\t\t\treturn this.newScalarCast(input.input, definition)\n\t\t}\n\n\t\t// Normalize `NOT $1 == $2` to `$1 != $2`\n\t\tif (input instanceof ScalarEquals) {\n\t\t\treturn this.newScalarNotEquals(input.left, input.right)\n\t\t}\n\n\t\t// Normalize `NOT $1 != $2` to `$1 == $2`\n\t\tif (input instanceof ScalarNotEquals) {\n\t\t\treturn this.newScalarEquals(input.left, input.right)\n\t\t}\n\n\t\t// Normalize `NOT $1 < $2` to `$1 >= $2`\n\t\tif (input instanceof ScalarLessThan) {\n\t\t\treturn this.newScalarGreaterThanOrEqual(input.left, input.right)\n\t\t}\n\n\t\t// Normalize `NOT $1 <= $2` to `$1 > $2`\n\t\tif (input instanceof ScalarLessThanOrEqual) {\n\t\t\treturn this.newScalarGreaterThan(input.left, input.right)\n\t\t}\n\n\t\t// Normalize `NOT $1 > $2` to `$1 <= $2`\n\t\tif (input instanceof ScalarGreaterThan) {\n\t\t\treturn this.newScalarLessThanOrEqual(input.left, input.right)\n\t\t}\n\n\t\t// Normalize `NOT $1 >= $2` to `$1 < $2`\n\t\tif (input instanceof ScalarGreaterThanOrEqual) {\n\t\t\treturn this.newScalarLessThan(input.left, input.right)\n\t\t}\n\n\t\t// Normalize `NOT ($1 AND $2)` to `(NOT $1) OR (NOT $2)`\n\t\tif (input instanceof ScalarAnd) {\n\t\t\tconst left = this.newScalarNot(input.left)\n\t\t\tconst right = this.newScalarNot(input.right)\n\t\t\treturn this.newScalarOr(left, right)\n\t\t}\n\n\t\t// Normalize `NOT ($1 OR $2)` to `(NOT $1) AND (NOT $2)`\n\t\tif (input instanceof ScalarOr) {\n\t\t\tconst left = this.newScalarNot(input.left)\n\t\t\tconst right = this.newScalarNot(input.right)\n\t\t\treturn this.newScalarAnd(left, right)\n\t\t}\n\n\t\tconst node = new ScalarNot(input)\n\t\treturn this.finishScalar(node)\n\t}\n\n\t// TODO: Normalize `$1 AND ($2 AND $c)` to `($1 AND $2) AND $c`\n\tnewScalarAnd(left: ScalarNode, right: ScalarNode): ScalarNode {\n\t\t// Normalize `$1 AND true` to `$1`\n\t\tif (right instanceof ScalarConstant && right.value?.type === ControlType.Boolean && right.value.value === true) {\n\t\t\treturn left\n\t\t}\n\n\t\t// Normalize `true AND $1` to `$1`\n\t\tif (left instanceof ScalarConstant && left.value?.type === ControlType.Boolean && left.value.value === true) {\n\t\t\treturn right\n\t\t}\n\n\t\t// Normalize `$1 AND false` to `false`\n\t\tif (right instanceof ScalarConstant && right.value?.type === ControlType.Boolean && right.value.value === false) {\n\t\t\treturn right\n\t\t}\n\n\t\t// Normalize `false AND $1` to `false`\n\t\tif (left instanceof ScalarConstant && left.value?.type === ControlType.Boolean && left.value.value === false) {\n\t\t\treturn left\n\t\t}\n\n\t\tconst node = new ScalarAnd(left, right)\n\t\treturn this.finishScalar(node)\n\t}\n\n\t// TODO: Normalize `$1 OR ($2 OR $c)` to `($1 OR $2) OR $c`\n\tnewScalarOr(left: ScalarNode, right: ScalarNode): ScalarNode {\n\t\t// Normalize `$1 OR true` to `true`\n\t\tif (right instanceof ScalarConstant && right.value?.type === ControlType.Boolean && right.value.value === true) {\n\t\t\treturn right\n\t\t}\n\n\t\t// Normalize `true OR $1` to `true`\n\t\tif (left instanceof ScalarConstant && left.value?.type === ControlType.Boolean && left.value.value === true) {\n\t\t\treturn left\n\t\t}\n\n\t\t// Normalize `$1 OR false` to `$1`\n\t\tif (right instanceof ScalarConstant && right.value?.type === ControlType.Boolean && right.value.value === false) {\n\t\t\treturn left\n\t\t}\n\n\t\t// Normalize `false OR $1` to `$1`\n\t\tif (left instanceof ScalarConstant && left.value?.type === ControlType.Boolean && left.value.value === false) {\n\t\t\treturn right\n\t\t}\n\n\t\tconst node = new ScalarOr(left, right)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarEquals(left: ScalarNode, right: ScalarNode): ScalarNode {\n\t\tconst isLeftVariable = left instanceof ScalarVariable\n\t\tconst isRightVariable = right instanceof ScalarVariable\n\n\t\t// Normalize `$1 == a` to `a == $1`\n\t\tif (isRightVariable && !isLeftVariable) {\n\t\t\treturn this.newScalarEquals(right, left)\n\t\t}\n\n\t\tleft = this.removeUnknown(left, right.definition)\n\t\tright = this.removeUnknown(right, left.definition)\n\n\t\tconst node = new ScalarEquals(left, right)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarNotEquals(left: ScalarNode, right: ScalarNode): ScalarNode {\n\t\tconst isLeftVariable = left instanceof ScalarVariable\n\t\tconst isRightVariable = right instanceof ScalarVariable\n\n\t\t// Normalize `$1 != a` to `a != $1`\n\t\tif (isRightVariable && !isLeftVariable) {\n\t\t\treturn this.newScalarNotEquals(right, left)\n\t\t}\n\n\t\tleft = this.removeUnknown(left, right.definition)\n\t\tright = this.removeUnknown(right, left.definition)\n\n\t\tconst node = new ScalarNotEquals(left, right)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarLessThan(left: ScalarNode, right: ScalarNode): ScalarNode {\n\t\tconst isLeftVariable = left instanceof ScalarVariable\n\t\tconst isRightVariable = right instanceof ScalarVariable\n\n\t\t// Normalize `$1 < a` to `a > $1`\n\t\tif (isRightVariable && !isLeftVariable) {\n\t\t\treturn this.newScalarGreaterThan(right, left)\n\t\t}\n\n\t\tleft = this.removeUnknown(left, right.definition)\n\t\tright = this.removeUnknown(right, left.definition)\n\n\t\tconst node = new ScalarLessThan(left, right)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarLessThanOrEqual(left: ScalarNode, right: ScalarNode): ScalarNode {\n\t\tconst isLeftVariable = left instanceof ScalarVariable\n\t\tconst isRightVariable = right instanceof ScalarVariable\n\n\t\t// Normalize `$1 <= a` to `a >= $1`\n\t\tif (isRightVariable && !isLeftVariable) {\n\t\t\treturn this.newScalarGreaterThanOrEqual(right, left)\n\t\t}\n\n\t\tleft = this.removeUnknown(left, right.definition)\n\t\tright = this.removeUnknown(right, left.definition)\n\n\t\tconst node = new ScalarLessThanOrEqual(left, right)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarGreaterThan(left: ScalarNode, right: ScalarNode): ScalarNode {\n\t\tconst isLeftVariable = left instanceof ScalarVariable\n\t\tconst isRightVariable = right instanceof ScalarVariable\n\n\t\t// Normalize `$1 > a` to `a < $1`\n\t\tif (isRightVariable && !isLeftVariable) {\n\t\t\treturn this.newScalarLessThan(right, left)\n\t\t}\n\n\t\tleft = this.removeUnknown(left, right.definition)\n\t\tright = this.removeUnknown(right, left.definition)\n\n\t\tconst node = new ScalarGreaterThan(left, right)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarGreaterThanOrEqual(left: ScalarNode, right: ScalarNode): ScalarNode {\n\t\tconst isLeftVariable = left instanceof ScalarVariable\n\t\tconst isRightVariable = right instanceof ScalarVariable\n\n\t\t// Normalize `$1 >= a` to `a <= $1`\n\t\tif (isRightVariable && !isLeftVariable) {\n\t\t\treturn this.newScalarLessThanOrEqual(right, left)\n\t\t}\n\n\t\tleft = this.removeUnknown(left, right.definition)\n\t\tright = this.removeUnknown(right, left.definition)\n\n\t\tconst node = new ScalarGreaterThanOrEqual(left, right)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarIn(left: ScalarNode, right: ScalarNode): ScalarNode {\n\t\tif (right.definition.type === ControlType.Array) {\n\t\t\tleft = this.removeUnknown(left, right.definition.definition)\n\t\t}\n\n\t\tconst arrayDefinition: DatabaseValueDefinition = {\n\t\t\ttype: ControlType.Array,\n\t\t\tisNullable: true,\n\t\t\tdefinition: left.definition,\n\t\t}\n\n\t\tright = this.removeUnknown(right, arrayDefinition)\n\n\t\tconst node = new ScalarIn(left, right)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarNotIn(left: ScalarNode, right: ScalarNode): ScalarNode {\n\t\tif (right.definition.type === ControlType.Array) {\n\t\t\tleft = this.removeUnknown(left, right.definition.definition)\n\t\t}\n\n\t\tconst arrayDefinition: DatabaseValueDefinition = {\n\t\t\ttype: ControlType.Array,\n\t\t\tisNullable: true,\n\t\t\tdefinition: left.definition,\n\t\t}\n\n\t\tright = this.removeUnknown(right, arrayDefinition)\n\n\t\tconst node = new ScalarNotIn(left, right)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarCase(\n\t\tinput: ScalarNode | undefined,\n\t\tconditions: CaseCondition[],\n\t\totherwise: ScalarNode | undefined,\n\t): ScalarNode {\n\t\tif (input) {\n\t\t\tconst castConditions: CaseCondition[] = []\n\n\t\t\tfor (const { when, then } of conditions) {\n\t\t\t\tconst castWhen = this.removeUnknown(when, input.definition)\n\t\t\t\tconst castCondition = new CaseCondition(castWhen, then)\n\t\t\t\tcastConditions.push(castCondition)\n\t\t\t}\n\n\t\t\tconditions = castConditions\n\t\t}\n\n\t\tconst node = new ScalarCase(input, conditions, otherwise)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarContains(source: ScalarNode, target: ScalarNode): ScalarNode {\n\t\tconst node = new ScalarContains(source, target)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarStartsWith(source: ScalarNode, target: ScalarNode): ScalarNode {\n\t\tconst node = new ScalarStartsWith(source, target)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarEndsWith(source: ScalarNode, target: ScalarNode): ScalarNode {\n\t\tconst node = new ScalarEndsWith(source, target)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarLength(array: ScalarNode): ScalarNode {\n\t\tconst node = new ScalarLength(array)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarIndexOf(source: ScalarNode, target: ScalarNode): ScalarNode {\n\t\tconst node = new ScalarIndexOf(source, target)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarArray(\n\t\tinput: RelationalNode,\n\t\tnamedFields: NamedFields,\n\t\tordering: Ordering,\n\t\treferencedFields: Fields,\n\t\treferencedOuterFields: Fields,\n\t): ScalarNode {\n\t\tconst node = new ScalarArray(input, namedFields, ordering, referencedFields, referencedOuterFields)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarFlatArray(\n\t\tinput: RelationalNode,\n\t\tfield: FieldMetadata,\n\t\tordering: Ordering,\n\t\treferencedFields: Fields,\n\t\treferencedOuterFields: Fields,\n\t): ScalarNode {\n\t\tconst node = new ScalarFlatArray(input, field, ordering, referencedFields, referencedOuterFields)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarIntersection(left: ScalarNode, right: ScalarNode): ScalarNode {\n\t\tconst node = new ScalarIntersection(left, right)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarCast(input: ScalarNode, definition: DatabaseValueDefinition): ScalarNode {\n\t\t// Replace `CAST($1 AS TYPE)` with `$1`\n\t\tif (input.definition.type === definition.type) {\n\t\t\treturn input\n\t\t}\n\n\t\tconst node = new ScalarCast(input, definition)\n\t\treturn this.finishScalar(node)\n\t}\n}\n", "import { RelationalNode } from \"../relational/RelationalNode.ts\"\n\n/**\n * An enforcer node is a node that can always provide a specific physical\n * property. This is used by the optimizer to ensure physical properties for\n * nodes that don't provide them already.\n */\nexport abstract class EnforcerNode extends RelationalNode {}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { assert } from \"../../../../../utils/assert.ts\"\nimport type { DatabaseItem, DatabaseItemPointer } from \"../../../types.ts\"\nimport { Cost, KB } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport type { Group } from \"../../Group.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport type { CollectionMetadata } from \"../../Metadata.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport { RequiredProps } from \"../../PhysicalProps.ts\"\nimport type { Relation } from \"../../Relation.ts\"\nimport { Tuple } from \"../../Relation.ts\"\nimport type { Resolver } from \"../../Resolver.ts\"\nimport type { RelationalNode } from \"../relational/RelationalNode.ts\"\nimport { EnforcerNode } from \"./EnforcerNode.ts\"\n\n/**\n * The resolve enforcer is used to resolved fields that are required by its\n * parent node. For example, a `RelationalIndexLookup` returns fields that are\n * not resolved. This means some fields are theoretically available, but they\n * are not loaded yet because they are not stored in the index. If required,\n * these fields can be resolved by fetching them from the database collection.\n */\nexport class EnforcerResolve extends EnforcerNode {\n\treadonly inputGroup: Group\n\n\tconstructor(\n\t\treadonly input: RelationalNode,\n\t\treadonly fields: Fields,\n\t\treadonly resolver: Resolver,\n\t) {\n\t\tsuper(false)\n\n\t\tthis.inputGroup = input.getGroup()\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"EnforcerResolve\", this.inputGroup.id, this.fields)\n\t}\n\n\toverride getOutputFields() {\n\t\treturn this.inputGroup.relational.outputFields\n\t}\n\n\toverride canProvideOrdering() {\n\t\treturn true\n\t}\n\n\toverride canProvideResolvedFields(resolvedFields: Fields) {\n\t\treturn resolvedFields.subsetOf(this.fields)\n\t}\n\n\tprivate getInputRequiredProps(required: RequiredProps) {\n\t\tconst resolvedFields = new Fields()\n\t\treturn new RequiredProps(required.ordering, resolvedFields)\n\t}\n\n\toverride optimize(optimizer: Optimizer, required: RequiredProps) {\n\t\tconst inputRequired = this.getInputRequiredProps(required)\n\t\tconst inputCost = optimizer.optimizeGroup(this.inputGroup, inputRequired)\n\n\t\treturn Cost.estimate(0, 100 * KB).add(inputCost)\n\t}\n\n\toverride getOptimized(required: RequiredProps) {\n\t\tconst inputRequired = this.getInputRequiredProps(required)\n\t\tconst input = this.inputGroup.getOptimized(inputRequired)\n\n\t\treturn new EnforcerResolve(input, this.fields, this.resolver)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined): Evaluate<Relation> {\n\t\tconst input = yield* this.input.evaluate(context)\n\n\t\t// Resolve can't add any new fields to the input because that would\n\t\t// change the relational props. It can only resolve fields that are\n\t\t// already in the input but not resolved yet.\n\t\tassert(this.fields.subsetOf(input.fields), \"Fields can't be resolved\")\n\n\t\t// Collect all collections for the fields that have to be resolved.\n\t\tconst collections = new Set<CollectionMetadata>()\n\t\tfor (const field of this.fields) {\n\t\t\tassert(field.collection, \"Collection required to resolve field\")\n\t\t\tcollections.add(field.collection)\n\t\t}\n\n\t\t// Optimistically start resolving rich text and vector set item values for fields that are\n\t\t// required. This allows us to parallelize resolving rich text and vectors, with resolving\n\t\t// items.\n\t\tfor (const tuple of input.tuples) {\n\t\t\tfor (const field of this.fields) {\n\t\t\t\tconst value = tuple.getValue(field)\n\t\t\t\tif (value?.type === ControlType.RichText) {\n\t\t\t\t\tthis.resolver.preloadRichTextValue(value)\n\t\t\t\t} else if (value?.type === ControlType.VectorSetItem) {\n\t\t\t\t\tthis.resolver.preloadVectorSetItemValue(value)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Resolve all items for the collections. The items should include all\n\t\t// fields that have to be resolved.\n\t\tconst collectionItems: [CollectionMetadata, DatabaseItem[]][] = yield Promise.all(\n\t\t\tArray.from(collections).map(async collection => {\n\t\t\t\t// Collect all pointers for the input tuples.\n\t\t\t\tconst pointers: DatabaseItemPointer[] = []\n\t\t\t\tfor (const tuple of input.tuples) {\n\t\t\t\t\tconst pointer = tuple.getPointer(collection)\n\t\t\t\t\t// If the condition of a left or right join wasn't met, the\n\t\t\t\t\t// tuple will not have a pointer for the collection.\n\t\t\t\t\tif (pointer) pointers.push(pointer)\n\t\t\t\t}\n\n\t\t\t\t// Resolve all items for the pointers.\n\t\t\t\tconst items = await collection.data.resolveItems(pointers)\n\t\t\t\tassert(items.length === pointers.length, \"Invalid number of items\")\n\n\t\t\t\treturn [collection, items] as const\n\t\t\t}),\n\t\t)\n\n\t\t// Merge the resolved items into the existing tuples.\n\t\treturn input.map(input.fields, tuple => {\n\t\t\tconst result = new Tuple()\n\t\t\tresult.merge(tuple)\n\n\t\t\tfor (const [collection, items] of collectionItems) {\n\t\t\t\tconst pointer = tuple.getPointer(collection)\n\t\t\t\tif (!pointer) continue\n\n\t\t\t\tconst item = items.shift()\n\t\t\t\tassert(item, \"Item not found\")\n\n\t\t\t\t// Check if the pointer matches the item pointer.\n\t\t\t\tassert(item.pointer === pointer, \"Pointer mismatch\")\n\n\t\t\t\t// Merge the resolved values into the tuple.\n\t\t\t\tfor (const field of collection.fields) {\n\t\t\t\t\tconst value = field.getValue(item)\n\t\t\t\t\tresult.addValue(field, value)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn result\n\t\t})\n\t}\n}\n", "import { assert } from \"../../../../../utils/assert.ts\"\nimport { isNull, isUndefined } from \"../../../../../utils/utils.ts\"\nimport { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseCollation, DatabaseItem } from \"../../../types.ts\"\nimport { DatabaseCollationType, OrderDirection } from \"../../../types.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport type { Group } from \"../../Group.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields, VIRTUAL_INDEX_FIELD } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport { Ordering } from \"../../Ordering.ts\"\nimport { RequiredProps } from \"../../PhysicalProps.ts\"\nimport type { Relation, Tuple } from \"../../Relation.ts\"\nimport type { RelationalNode } from \"../relational/RelationalNode.ts\"\nimport { EnforcerNode } from \"./EnforcerNode.ts\"\n\nconst collation: DatabaseCollation = {\n\ttype: DatabaseCollationType.CaseInsensitive,\n}\n\nexport class EnforcerSort extends EnforcerNode {\n\treadonly inputGroup: Group\n\n\tconstructor(\n\t\treadonly input: RelationalNode,\n\t\treadonly ordering: Ordering,\n\t) {\n\t\tsuper(input.isSynchronous)\n\n\t\tthis.inputGroup = input.getGroup()\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"EnforcerSort\", this.inputGroup.id, this.ordering)\n\t}\n\n\toverride getOutputFields() {\n\t\treturn this.inputGroup.relational.outputFields\n\t}\n\n\toverride canProvideOrdering(ordering: Ordering) {\n\t\treturn ordering.equals(this.ordering)\n\t}\n\n\toverride canProvideResolvedFields() {\n\t\treturn true\n\t}\n\n\tprivate getInputRequiredProps(required: RequiredProps) {\n\t\tconst resolvedFields = new Fields(required.resolvedFields)\n\n\t\tfor (const { field } of this.ordering.fields) {\n\t\t\tif (field.name === VIRTUAL_INDEX_FIELD) continue\n\t\t\tif (isUndefined(field.collection)) continue\n\t\t\tresolvedFields.add(field)\n\t\t}\n\n\t\tconst ordering = new Ordering()\n\t\treturn new RequiredProps(ordering, resolvedFields)\n\t}\n\n\toverride optimize(optimizer: Optimizer, required: RequiredProps) {\n\t\tconst inputRequired = this.getInputRequiredProps(required)\n\t\tconst inputCost = optimizer.optimizeGroup(this.inputGroup, inputRequired)\n\n\t\treturn new Cost(0).add(inputCost)\n\t}\n\n\toverride getOptimized(required: RequiredProps) {\n\t\tconst inputRequired = this.getInputRequiredProps(required)\n\t\tconst input = this.inputGroup.getOptimized(inputRequired)\n\n\t\treturn new EnforcerSort(input, this.ordering)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined): Evaluate<Relation> {\n\t\tconst input = yield* this.input.evaluate(context)\n\n\t\treturn input.sort((leftTuple, rightTuple) => {\n\t\t\tfor (const { field, direction } of this.ordering.fields) {\n\t\t\t\tconst isAscending = direction === OrderDirection.Ascending\n\n\t\t\t\tif (field.name === VIRTUAL_INDEX_FIELD) {\n\t\t\t\t\tconst collection = field.collection\n\t\t\t\t\tassert(collection, \"Collection required for sorting\")\n\n\t\t\t\t\tconst leftPointer = leftTuple.getPointer(collection)\n\t\t\t\t\tassert(leftPointer, \"Pointer required for sorting\")\n\t\t\t\t\tconst leftItem: DatabaseItem = { pointer: leftPointer, data: {} }\n\n\t\t\t\t\tconst rightPointer = rightTuple.getPointer(collection)\n\t\t\t\t\tassert(rightPointer, \"Pointer required for sorting\")\n\t\t\t\t\tconst rightItem: DatabaseItem = { pointer: rightPointer, data: {} }\n\n\t\t\t\t\tconst order = collection.data.compareItems(leftItem, rightItem)\n\t\t\t\t\treturn isAscending ? order : -order\n\t\t\t\t}\n\n\t\t\t\tconst leftValue = leftTuple.getValue(field)\n\t\t\t\tconst rightValue = rightTuple.getValue(field)\n\n\t\t\t\tif (DatabaseValue.equal(leftValue, rightValue, collation)) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif (isNull(leftValue) || DatabaseValue.lessThan(leftValue, rightValue, collation)) {\n\t\t\t\t\treturn isAscending ? -1 : 1\n\t\t\t\t}\n\n\t\t\t\tif (isNull(rightValue) || DatabaseValue.greaterThan(leftValue, rightValue, collation)) {\n\t\t\t\t\treturn isAscending ? 1 : -1\n\t\t\t\t}\n\n\t\t\t\tthrow new Error(\"Invalid comparison\")\n\t\t\t}\n\n\t\t\treturn 0\n\t\t})\n\t}\n}\n", "import { assert } from \"../../../../../utils/assert.ts\"\nimport { DatabaseValue } from \"../../../../cms/DatabaseValue.ts\"\nimport type { DatabaseCollation } from \"../../../../cms/types.ts\"\nimport { DatabaseCollationType } from \"../../../../cms/types.ts\"\nimport type { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport type { Hash } from \"../../Hashable.ts\"\nimport type { Fields } from \"../../Metadata.ts\"\nimport type { RequiredProps } from \"../../PhysicalProps.ts\"\nimport type { Relation, Tuple } from \"../../Relation.ts\"\nimport { RelationalNode } from \"./RelationalNode.ts\"\n\nconst collation: DatabaseCollation = {\n\ttype: DatabaseCollationType.CaseSensitive,\n}\n\n/**\n * This node is only used for testing. It ensures that all nodes in a group\n * return the same result.\n */\nexport class RelationalAssert extends RelationalNode {\n\tconstructor(\n\t\treadonly input: RelationalNode,\n\t\treadonly required: RequiredProps,\n\t\treadonly cache: Map<string | undefined, Relation>,\n\t) {\n\t\tsuper(input.isSynchronous)\n\t}\n\n\toverride getHash(): Hash {\n\t\tthrow new Error(\"Not implemented\")\n\t}\n\n\toverride getOutputFields(): Fields {\n\t\tthrow new Error(\"Not implemented\")\n\t}\n\n\toverride canProvideOrdering(): boolean {\n\t\tthrow new Error(\"Not implemented\")\n\t}\n\n\toverride canProvideResolvedFields(): boolean {\n\t\tthrow new Error(\"Not implemented\")\n\t}\n\n\toverride optimize(): Cost {\n\t\tthrow new Error(\"Not implemented\")\n\t}\n\n\toverride getOptimized(required: RequiredProps) {\n\t\tconst input = this.input.getOptimized(required)\n\n\t\treturn new RelationalAssert(input, this.required, this.cache)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined): Evaluate<Relation> {\n\t\tconst cacheKey = context?.getKey()\n\t\tconst cached = this.cache.get(cacheKey)\n\t\tif (cached) return cached\n\n\t\tconst expected = yield* this.input.evaluate(context)\n\t\tthis.cache.set(cacheKey, expected)\n\n\t\tconst tuples = new Map<string, Tuple>()\n\t\tconst indexes = new Map<string, number>()\n\n\t\tfor (const [index, tuple] of expected.tuples.entries()) {\n\t\t\tconst key = tuple.getKey()\n\n\t\t\ttuples.set(key, tuple)\n\t\t\tindexes.set(key, index)\n\t\t}\n\n\t\tconst group = this.getGroup()\n\t\tconst winner = group.getWinner(this.required)\n\n\t\tfor (const node of winner.nodes) {\n\t\t\tconst optimized = node.getOptimized(this.required)\n\t\t\tconst received = yield* optimized.evaluate(context)\n\n\t\t\tassert(expected.fields.equals(received.fields), \"Different fields\")\n\t\t\tassert(expected.tuples.length === received.tuples.length, \"Different tuples\")\n\n\t\t\tfor (const [receivedIndex, receivedTuple] of received.tuples.entries()) {\n\t\t\t\tconst key = receivedTuple.getKey()\n\n\t\t\t\tconst expectedTuple = tuples.get(key)\n\t\t\t\tassert(expectedTuple, \"Missing tuple\")\n\n\t\t\t\tfor (const field of this.required.resolvedFields) {\n\t\t\t\t\tconst receivedValue = receivedTuple.getValue(field)\n\t\t\t\t\tconst expectedValue = expectedTuple.getValue(field)\n\n\t\t\t\t\tassert(DatabaseValue.equal(receivedValue, expectedValue, collation), \"Different value\")\n\t\t\t\t}\n\n\t\t\t\tif (this.required.ordering.length > 0) {\n\t\t\t\t\tconst expectedIndex = indexes.get(key)\n\t\t\t\t\tassert(receivedIndex === expectedIndex, \"Different order\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn expected\n\t}\n}\n", "import { assert } from \"../../../utils/assert.ts\"\nimport type { MaybeLocale } from \"../QueryEngine.ts\"\nimport type { Query } from \"../types.ts\"\nimport { Builder } from \"./Builder.ts\"\nimport type { Cost } from \"./Cost.ts\"\nimport { Explorer } from \"./Explorer.ts\"\nimport type { Group, Winner } from \"./Group.ts\"\nimport { Memo } from \"./Memo.ts\"\nimport { Normalizer } from \"./Normalizer.ts\"\nimport type { RequiredProps } from \"./PhysicalProps.ts\"\nimport type { Relation } from \"./Relation.ts\"\nimport type { Resolver } from \"./Resolver.ts\"\nimport { EnforcerResolve } from \"./nodes/enforcer/EnforcerResolve.ts\"\nimport { EnforcerSort } from \"./nodes/enforcer/EnforcerSort.ts\"\nimport { RelationalAssert } from \"./nodes/relational/RelationalAssert.ts\"\nimport type { RelationalNode } from \"./nodes/relational/RelationalNode.ts\"\n\n/**\n * The optimizer is responsible for creating the best query plan for a given\n * query. It is heavily inspired by the CockroachDB query optimizer and you will\n * find a lot of similarities between the two.\n *\n * This optimizer and the Cockroach optimizer are based on the Cascades query\n * optimizer which itself is based on the Volcano query optimizer. To learn more\n * about query optimizers here is a list of resources that helped me:\n * - The first 30 pages of this paper:\n *   https://15721.courses.cs.cmu.edu/spring2020/papers/20-optimizer2/xu-columbia-thesis1998.pdf\n * - This YouTube video starting at 1:00:01 and the next video:\n *   https://www.youtube.com/watch?v=DwX0X8CyBSg\n * - This blog post but unfortunately the series looks abandoned:\n *   https://xuanwo.io/2024/02-what-i-talk-about-when-i-talk-about-query-optimizer-part-1/\n * - The Cockroach repo (some code is auto generated by the build process):\n *   https://github.com/cockroachdb/cockroach\n * - This walkthrough of the Cockroach optimizer:\n *   https://github.com/cockroachdb/cockroach/blob/master/docs/tech-notes/life_of_a_query.md#logical-planning-and-optimization\n * - The EvaDB repo which is written in Python:\n *   https://github.com/georgia-tech-db/evadb\n *\n * This is how the optimizer works:\n *\n * We start by creating an initial query plan for a given query in the builder.\n * The query plan is a tree of different nodes (Cascades calls them expressions)\n * that describe what needs to be done to execute the query.\n *\n * For example, the following query:\n * ```\n * SELECT articles.title, authors.name\n * FROM articles\n * LEFT JOIN authors\n * ON articles.author_id = authors.id\n * WHERE articles.published = true\n * ORDER BY articles.title\n * ```\n *\n * Can be represented by the following query plan:\n * ```\n *      Filter(articles.published = true)\n *                      |\n *  LeftJoin(articles.author_id = authors.id)\n *        /                          \\\n *  Scan(articles)              Scan(authors)\n * ```\n *\n * Notice that the query plan doesn't include a node for the `ORDER BY` clause.\n * This is because ordering is a physical property of the relational node. Two\n * nodes can be logically equivalent if they return the same result, but in a\n * different order. The physical properties then describe additional properties\n * of the result.\n *\n * The general idea of the optimizer is to create alternative versions of the\n * initial query plan and finding the best one with a cost function. The hard\n * part is to avoid exponential complexity.\n *\n *\n * The main data structure of the optimizer is the memo. It's a directed acyclic\n * graph of all possible query plans. Because it's a graph, we can avoid\n * optimizing nodes that have already been optimized. This works by grouping\n * nodes that return the same result. It's called a memo because it memoizes the\n * optimization results. If a group was already optimized, we can return the\n * previous optimization result.\n *\n * The nodes in the memo are also known as multi-expressions because their\n * children are part of a group themselves. This means a single node is actually\n * representing multiple different query plans.\n *\n * The builder adds the normalized nodes of the initial query plan to the memo.\n * For example, the query plan above is represented by the following groups in\n * the memo:\n * ```\n * G1: Filter(G2)\n * G2: LeftJoin(G3, G4)\n * G3: Scan(articles)\n * G4: Scan(authors)\n * ```\n *\n * After the initial query plan is created, the optimizer starts by optimizing\n * the root group #1 with the root required physical props. In our case, the\n * physical props require the result to be sorted by the `articles.title` field.\n *\n * To optimize the root group, the optimizer iterates over all the nodes in the\n * group. For each node, the optimizer checks if it can provide the required\n * physical props. Because the filter node doesn't change the ordering of its\n * input, it can pass down the required ordering to it. But the cost of the\n * filter node can't be calculated yet without knowing the cost of its input, so\n * we need to recursively optimize the input group #2 of the filter.\n *\n * To optimize it, the same steps are applied. However, the left join cannot\n * provide the ordering, so the optimizer needs to add a sort enforcer. An\n * enforcer is a node that can always provide the required properties. The sort\n * enforcer recursively optimizes the group #2 again, but this time without the\n * required ordering. The left join can meet the reduced requirements, but to\n * calculate the cost, we again need to optimize the inputs of it.\n *\n * To optimize the input groups #3 and #4, the optimizer applies the same steps\n * again. Because the scan operator doesn't have any inputs, we can cost it and\n * store the result in the memo:\n * ```\n * G1: Filter(G2)\n * G2: LeftJoin(G3, G4)\n * G3: Scan(articles)\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Scan(articles)\n *     \u2514\u2500\u2500 cost: 10\n * G4: Scan(authors)\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Scan(authors)\n *     \u2514\u2500\u2500 cost: 10\n * ```\n *\n * After optimizing the inputs of the left join and costing it, the optimizer\n * creates alternative nodes that are logically equivalent to the original node.\n * In the case of the left join, the explorer creates a logically equivalent\n * right join. The new node is added to the same group as the original node:\n * ```\n * G1: Filter(G2)\n * G2: LeftJoin(G3, G4), RightJoin(G4, G3)\n * G3: Scan(articles)\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Scan(articles)\n *     \u2514\u2500\u2500 cost: 10\n * G4: Scan(authors)\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Scan(authors)\n *     \u2514\u2500\u2500 cost: 10\n * ```\n *\n * To cost the right join, the optimizer needs to optimize its inputs first.\n * Luckily, the inputs are already optimized, so we don't need to do anything\n * and can return the memoized best node and its cost instead.\n *\n * After the optimizer has optimized all nodes in the group #2, it can store the\n * best node in the memo:\n * ```\n * G1: Filter(G2)\n * G2: LeftJoin(G3, G4), RightJoin(G4, G3)\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: LeftJoin(G3, G4)\n *     \u2514\u2500\u2500 cost: 20\n * G3: Scan(articles)\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Scan(articles)\n *     \u2514\u2500\u2500 cost: 10\n * G4: Scan(authors)\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Scan(authors)\n *     \u2514\u2500\u2500 cost: 10\n * ```\n *\n * But remember that the filter node passed down the ordering requirement. We\n * need to finish optimization of the group #2 with the additional ordering\n * requirement:\n * ```\n * G1: Filter(G2)\n * G2: LeftJoin(G3, G4), RightJoin(G4, G3)\n * \u251C\u2500\u2500 [ordering: articles.title]\n * \u2502   \u251C\u2500\u2500 best: Sort(G2)\n * \u2502   \u2514\u2500\u2500 cost: 30\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: LeftJoin(G3, G4)\n *     \u2514\u2500\u2500 cost: 25\n * G3: Scan(articles)\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Scan(articles)\n *     \u2514\u2500\u2500 cost: 10\n * G4: Scan(authors)\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Scan(authors)\n *     \u2514\u2500\u2500 cost: 10\n * ```\n *\n * Now we can bubble up again and also finish optimization of the root group #1:\n * ```\n * G1: Filter(G2)\n * \u2514\u2500\u2500 [ordering: articles.title]\n *     \u251C\u2500\u2500 best: Filter(G2)\n *     \u2514\u2500\u2500 cost: 40\n * G2: LeftJoin(G3, G4), RightJoin(G4, G3)\n * \u251C\u2500\u2500 [ordering: articles.title]\n * \u2502   \u251C\u2500\u2500 best: Sort(G2)\n * \u2502   \u2514\u2500\u2500 cost: 35\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: LeftJoin(G3, G4)\n *     \u2514\u2500\u2500 cost: 25\n * G3: Scan(articles)\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Scan(articles)\n *     \u2514\u2500\u2500 cost: 10\n * G4: Scan(authors)\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Scan(authors)\n *     \u2514\u2500\u2500 cost: 10\n * ```\n *\n * But the optimizer is not done yet. It also tries a top level sort enforcer\n * because that could be a better plan. It does so by recursively optimizing the\n * root group #1 without the ordering requirement:\n * ```\n * G1: Filter(G2)\n * \u251C\u2500\u2500 [ordering: articles.title]\n * \u2502   \u251C\u2500\u2500 best: Filter(G2)\n * \u2502   \u2514\u2500\u2500 cost: 40\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Filter(G2)\n *     \u2514\u2500\u2500 cost: 25\n * G2: LeftJoin(G3, G4), RightJoin(G4, G3)\n * \u251C\u2500\u2500 [ordering: articles.title]\n * \u2502   \u251C\u2500\u2500 best: Sort(G2)\n * \u2502   \u2514\u2500\u2500 cost: 35\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: LeftJoin(G3, G4)\n *     \u2514\u2500\u2500 cost: 25\n * G3: Scan(articles)\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Scan(articles)\n *     \u2514\u2500\u2500 cost: 10\n * G4: Scan(authors)\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Scan(authors)\n *     \u2514\u2500\u2500 cost: 10\n * ```\n *\n * Turns out that the sort enforcer of group #1 has to sort fewer items than the\n * sort enforcer of group #2. So the overall cost of the query plan with the top\n * level sort enforcer is lower than the query plan without it:\n * ```\n * G1: Filter(G2)\n * \u251C\u2500\u2500 [ordering: articles.title]\n * \u2502   \u251C\u2500\u2500 best: Sort(G1)\n * \u2502   \u2514\u2500\u2500 cost: 40\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Filter(G2)\n *     \u2514\u2500\u2500 cost: 25\n * G2: LeftJoin(G3, G4), RightJoin(G4, G3)\n * \u251C\u2500\u2500 [ordering: articles.title]\n * \u2502   \u251C\u2500\u2500 best: Sort(G2)\n * \u2502   \u2514\u2500\u2500 cost: 35\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: LeftJoin(G3, G4)\n *     \u2514\u2500\u2500 cost: 25\n * G3: Scan(articles)\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Scan(articles)\n *     \u2514\u2500\u2500 cost: 10\n * G4: Scan(authors)\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Scan(authors)\n *     \u2514\u2500\u2500 cost: 10\n * ```\n *\n * As the final step, the optimizer creates the optimized root node, with all\n * its children replaced by their best nodes.\n */\nexport class Optimizer {\n\treadonly memo = new Memo()\n\treadonly normalizer = new Normalizer(this.memo)\n\treadonly explorer = new Explorer(this.normalizer)\n\n\tconstructor(\n\t\treadonly query: Query,\n\t\treadonly locale: MaybeLocale,\n\t\treadonly resolver: Resolver,\n\t) {}\n\n\toptimize() {\n\t\tconst builder = new Builder(this.normalizer, this.query, this.locale)\n\t\tconst outScope = builder.build()\n\n\t\tconst root = outScope.takeNode()\n\t\tconst group = root.getGroup()\n\t\tconst required = outScope.getRequiredProps()\n\n\t\tthis.optimizeGroup(group, required)\n\n\t\tconst optimized = group.getOptimized(required)\n\t\tconst namedFields = outScope.getNamedFields()\n\n\t\treturn [optimized, namedFields] as const\n\t}\n\n\toptimizeGroup(group: Group, required: RequiredProps): Cost {\n\t\tconst winner = group.getWinner(required)\n\t\tif (winner.node) return winner.cost\n\n\t\t// Create enforcers for the group. This is needed in case no node in the\n\t\t// group can provide all required props. It can also happen that adding\n\t\t// an enforcer will create a better plan.\n\t\tconst normalized = group.nodes[0]\n\n\t\tassert(normalized, \"Normalized node not found\")\n\t\tthis.createEnforcer(winner, normalized, required)\n\n\t\tfor (const node of group.nodes) {\n\t\t\t// Only optimize the node when it can provide all required props.\n\t\t\tif (required.canProvide(node)) {\n\t\t\t\tconst cost = node.optimize(this, required)\n\t\t\t\twinner.update(node, cost)\n\t\t\t}\n\n\t\t\t// Only explore the node when `optimizeGroup` will not recurse\n\t\t\t// through `createEnforcer`.\n\t\t\tif (required.isMinimal) {\n\t\t\t\tthis.explorer.explore(node)\n\t\t\t}\n\t\t}\n\n\t\t// In tests we wrap each group in a `RelationalAssert` to ensure that\n\t\t// every node in the group returns the same result.\n\t\tif (process.env.NODE_ENV === \"test\") {\n\t\t\tassert(winner.node, \"Group not optimized\")\n\t\t\tconst cache = new Map<string | undefined, Relation>()\n\t\t\twinner.node = new RelationalAssert(winner.node, required, cache)\n\t\t}\n\n\t\treturn winner.cost\n\t}\n\n\tcreateEnforcer(winner: Winner, node: RelationalNode, required: RequiredProps) {\n\t\tif (required.resolvedFields.size > 0) {\n\t\t\tconst enforcer = new EnforcerResolve(node, required.resolvedFields, this.resolver)\n\t\t\tconst cost = enforcer.optimize(this, required)\n\t\t\twinner.update(enforcer, cost)\n\t\t}\n\n\t\tif (required.ordering.length > 0) {\n\t\t\tconst enforcer = new EnforcerSort(node, required.ordering)\n\t\t\tconst cost = enforcer.optimize(this, required)\n\t\t\twinner.update(enforcer, cost)\n\t\t}\n\t}\n}\n", "import { assertNever } from \"../../utils/assert.ts\"\nimport type {\n\tBinaryOperation,\n\tCase,\n\tCollection,\n\tExpression,\n\tFrom,\n\tFunctionCall,\n\tIdentifier,\n\tJoin,\n\tLiteralValue,\n\tQuery,\n\tTypeCast,\n\tUnaryOperation,\n} from \"./types.ts\"\nimport { OrderDirection, isDatabaseCollection } from \"./types.ts\"\n\nfunction stringifyIdentifier(expression: Identifier) {\n\tif (expression.collection) {\n\t\treturn `\"${expression.collection}\".\"${expression.name}\"`\n\t}\n\n\treturn `\"${expression.name}\"`\n}\n\nfunction stringifyLiteralValue(expression: LiteralValue) {\n\tif (typeof expression.value === \"string\") {\n\t\treturn `'${expression.value}'`\n\t}\n\n\treturn expression.value\n}\n\nfunction stringifyFunctionCall(expression: FunctionCall) {\n\treturn `${expression.functionName}(${expression.arguments.map(argument => stringifyExpression(argument)).join(\", \")})`\n}\n\nfunction stringifyCaseExpression(expression: Case) {\n\tlet caseString = \"CASE\"\n\n\tif (expression.value) {\n\t\tcaseString += ` ${stringifyExpression(expression.value)}`\n\t}\n\n\tfor (const condition of expression.conditions) {\n\t\tcaseString += ` WHEN ${stringifyExpression(condition.when)} THEN ${stringifyExpression(condition.then)}`\n\t}\n\n\tif (expression.else) {\n\t\tcaseString += ` ELSE ${stringifyExpression(expression.else)}`\n\t}\n\n\tcaseString += \" END\"\n\n\treturn caseString\n}\n\nfunction stringifyUnaryOperation(expression: UnaryOperation) {\n\tconst value = stringifyExpression(expression.value)\n\tconst operator = expression.operator.toUpperCase()\n\n\treturn `${operator} ${value}`\n}\n\n// Note that this does not add any brackets for nested binary operations. We\n// don't currently support creating nested queries like that, but if we ever do\n// then we'll need to do work out operator precedence and add brackets as\n// necessary.\nfunction stringifyBinaryOperation(expression: BinaryOperation) {\n\tconst left = stringifyExpression(expression.left)\n\tconst right = stringifyExpression(expression.right)\n\tconst operator = expression.operator.toUpperCase()\n\n\treturn `${left} ${operator} ${right}`\n}\n\nfunction stringifyTypeCast(expression: TypeCast) {\n\treturn `CAST(${stringifyExpression(expression.value)} as ${expression.dataType})`\n}\n\nexport function stringifyExpression(expression: Expression): unknown {\n\tswitch (expression.type) {\n\t\tcase \"Identifier\":\n\t\t\treturn stringifyIdentifier(expression)\n\t\tcase \"LiteralValue\":\n\t\t\treturn stringifyLiteralValue(expression)\n\t\tcase \"FunctionCall\":\n\t\t\treturn stringifyFunctionCall(expression)\n\t\tcase \"Case\":\n\t\t\treturn stringifyCaseExpression(expression)\n\t\tcase \"UnaryOperation\":\n\t\t\treturn stringifyUnaryOperation(expression)\n\t\tcase \"BinaryOperation\":\n\t\t\treturn stringifyBinaryOperation(expression)\n\t\tcase \"TypeCast\":\n\t\t\treturn stringifyTypeCast(expression)\n\t\tcase \"Select\":\n\t\t\treturn `${stringifyQuery(expression)}`\n\t\tdefault: {\n\t\t\tassertNever(expression)\n\t\t}\n\t}\n}\n\nfunction stringifyCollection(collection: Collection) {\n\tif (isDatabaseCollection(collection.data)) {\n\t\treturn \"Collection\"\n\t}\n\n\tif (collection.alias) {\n\t\treturn `\"${collection.data.displayName}\" AS \"${collection.alias}\"`\n\t}\n\n\treturn `\"${collection.data.displayName}\"`\n}\n\nfunction stringifyJoin(join: Join) {\n\tlet result = `${stringifyFrom(join.left)} LEFT JOIN ${stringifyFrom(join.right)}`\n\n\tif (join.constraint) {\n\t\tresult += ` ON ${stringifyExpression(join.constraint)}`\n\t}\n\n\treturn result\n}\n\nfunction stringifyFrom(from: From): string {\n\tswitch (from.type) {\n\t\tcase \"Collection\":\n\t\t\treturn stringifyCollection(from)\n\t\tcase \"LeftJoin\":\n\t\t\treturn stringifyJoin(from)\n\t\tdefault:\n\t\t\tassertNever(from)\n\t}\n}\n\nfunction autoIndentSql(sql: string) {\n\tlet formattedSql = \"\"\n\tconst tokens = sql.split(/\\s+/u)\n\n\ttokens.forEach(token => {\n\t\tif (token === \"\") return\n\n\t\tif ([\"SELECT\", \"FROM\", \"WHERE\", \"ORDER\", \"LIMIT\", \"OFFSET\"].includes(token)) {\n\t\t\tformattedSql += `\\n${token}`\n\t\t} else if ([\"AND\", \"OR\"].includes(token)) {\n\t\t\tformattedSql += `\\n\\t${token}`\n\t\t} else {\n\t\t\tformattedSql += ` ${token}`\n\t\t}\n\t})\n\n\treturn formattedSql.trim()\n}\n\nexport function stringifyQuery(query: Query) {\n\tlet queryString = \"\"\n\n\tqueryString += `SELECT ${query.select\n\t\t.map(selectExpression => {\n\t\t\tconst expressionString = stringifyExpression(selectExpression)\n\t\t\tif (selectExpression.alias) {\n\t\t\t\treturn `${expressionString} AS \"${selectExpression.alias}\"`\n\t\t\t}\n\n\t\t\treturn expressionString\n\t\t})\n\t\t.join(\", \")}`\n\n\tqueryString += ` FROM ${stringifyFrom(query.from)}`\n\n\tif (query.where) {\n\t\tqueryString += ` WHERE ${stringifyExpression(query.where)}`\n\t}\n\n\tif (query.orderBy) {\n\t\tqueryString += ` ORDER BY ${query.orderBy\n\t\t\t.map(orderExpression => {\n\t\t\t\treturn `${stringifyExpression(orderExpression)} ${orderExpression.direction ?? OrderDirection.Ascending}`\n\t\t\t})\n\t\t\t.join(\", \")}`\n\t}\n\n\tif (query.limit) {\n\t\tqueryString += ` LIMIT ${stringifyExpression(query.limit)}`\n\t}\n\n\tif (query.offset) {\n\t\tqueryString += ` OFFSET ${stringifyExpression(query.offset)}`\n\t}\n\n\treturn autoIndentSql(queryString)\n}\n", "import type { Locale } from \"../../router/types.ts\"\nimport { getLogger } from \"../../utils/getLogger.ts\"\nimport { isPromise } from \"../../utils/utils.ts\"\nimport type { DatabaseValue } from \"./DatabaseValue.ts\"\nimport { type Evaluate, evaluateArray, evaluateMaybeAsync, evaluateObject } from \"./optimizer/Evaluate.ts\"\nimport { Optimizer } from \"./optimizer/Optimizer.ts\"\nimport { Resolver } from \"./optimizer/Resolver.ts\"\nimport { stringifyQuery } from \"./stringifyQuery.ts\"\nimport type { Query } from \"./types.ts\"\n\nconst log = /* @__PURE__ */ getLogger(\"query-engine\")\n\nexport type QueryResult = Record<string, unknown>[]\nexport type MaybeLocale = Locale | null | undefined\nexport type SerializableQueryResult = Record<string, DatabaseValue>[]\n\nexport type QueryRichTextMode =\n\t/** The default mode is to resolve rich text as React Nodes. */\n\t| \"react-node\"\n\t/** The raw mode returns the collection-defined raw pointer value for rich text */\n\t| \"raw\"\n\nexport interface QueryExecutionOptions {\n\trichTextMode?: QueryRichTextMode\n}\n\nexport class QueryEngine {\n\tprivate async evalQuery(\n\t\tquery: Query,\n\t\tlocale: MaybeLocale,\n\t\tincludeRaw: false,\n\t\toptions?: QueryExecutionOptions,\n\t): Promise<QueryResult>\n\tprivate async evalQuery(\n\t\tquery: Query,\n\t\tlocale: MaybeLocale,\n\t\tincludeRaw: true,\n\t\toptions?: QueryExecutionOptions,\n\t): Promise<[QueryResult, SerializableQueryResult]>\n\tprivate async evalQuery(\n\t\tquery: Query,\n\t\tlocale: MaybeLocale,\n\t\tincludeRaw: boolean,\n\t\toptions: QueryExecutionOptions = {},\n\t): Promise<[QueryResult, SerializableQueryResult] | QueryResult> {\n\t\tif (log.enabled) {\n\t\t\tlog.debug(`Query:\\n${stringifyQuery(query)}`)\n\t\t}\n\n\t\tconst resolver = new Resolver(query, locale, options)\n\t\tconst optimizer = new Optimizer(query, locale, resolver)\n\t\tconst [root, namedFields] = optimizer.optimize()\n\n\t\tconst relation = await root.evaluateAsync()\n\t\tconst namedFieldEntries = Object.entries(namedFields)\n\t\tconst rawResults: SerializableQueryResult = []\n\n\t\tconst maybeEvaluatedPromise = evaluateMaybeAsync(\n\t\t\tevaluateArray(\n\t\t\t\trelation.tuples.map(tuple => {\n\t\t\t\t\tconst object: Record<string, Evaluate<unknown>> = {}\n\t\t\t\t\tconst rawObject: Record<string, DatabaseValue> = {}\n\n\t\t\t\t\tfor (const [fieldName, field] of namedFieldEntries) {\n\t\t\t\t\t\tconst value = tuple.getValue(field)\n\t\t\t\t\t\tobject[fieldName] = resolver.resolveValue(value)\n\n\t\t\t\t\t\tif (includeRaw) {\n\t\t\t\t\t\t\trawObject[fieldName] = value\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (includeRaw) {\n\t\t\t\t\t\trawResults.push(rawObject)\n\t\t\t\t\t}\n\t\t\t\t\treturn evaluateObject(object)\n\t\t\t\t}),\n\t\t\t),\n\t\t)\n\n\t\tif (includeRaw) {\n\t\t\treturn [isPromise(maybeEvaluatedPromise) ? await maybeEvaluatedPromise : maybeEvaluatedPromise, rawResults]\n\t\t}\n\t\treturn maybeEvaluatedPromise\n\t}\n\n\tasync serializeableQuery(query: Query, locale: MaybeLocale): Promise<[QueryResult, SerializableQueryResult]> {\n\t\treturn this.evalQuery(query, locale, true)\n\t}\n\n\tasync query(query: Query, locale: MaybeLocale, options?: QueryExecutionOptions): Promise<QueryResult> {\n\t\treturn this.evalQuery(query, locale, false, options)\n\t}\n\n\tresolveSerializableQueryResult(\n\t\traw: SerializableQueryResult,\n\t\tquery: Query,\n\t\tlocale: MaybeLocale,\n\t): QueryResult | Promise<QueryResult> {\n\t\t// TODO: This is used for the handover. We need JSON.stringify to get the cache key, so we could\n\t\t// process the query upfront, replace collections with their ids and then call the query.\n\t\t// This way JSON.stringify would be faster:\n\t\t// https://v8.dev/blog/json-stringify#:~:text=expensive%20copy%20operations.-,Limitations,-The%20new%20fast\n\t\t// and we would only need to iterate through the collections once instead of 2x (server) or 3x (client).\n\t\tconst resolver = new Resolver(query, locale)\n\n\t\treturn evaluateMaybeAsync(\n\t\t\tevaluateArray(\n\t\t\t\traw.map(item => {\n\t\t\t\t\tconst object: Record<string, Evaluate<unknown>> = {}\n\n\t\t\t\t\tlet key: keyof typeof item\n\t\t\t\t\tfor (key in item) {\n\t\t\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: by design, accessing existing key\n\t\t\t\t\t\tconst value = item[key]!\n\t\t\t\t\t\tobject[key] = resolver.resolveValue(value)\n\t\t\t\t\t}\n\n\t\t\t\t\treturn evaluateObject(object)\n\t\t\t\t}),\n\t\t\t),\n\t\t)\n\t}\n}\n", "import { isObject } from \"../../utils/utils.ts\"\nimport { LazyValue } from \"../LazyValue.ts\"\nimport {\n\tHandoverDataType,\n\tgetHandoverData,\n\thandleHydrationError,\n\thandoverCollector,\n} from \"../dataHandover/dataHandover.ts\"\nimport type { MaybeLocale, QueryEngine, QueryResult, SerializableQueryResult } from \"./QueryEngine.ts\"\nimport { getCollectionId, hasRandomCollectionId } from \"./getCollectionId.ts\"\nimport type { Collection, Query } from \"./types.ts\"\nimport { isAnyCollection } from \"./types.ts\"\n\nconst handoverDataType = /* @__PURE__ */ (() => HandoverDataType.QueryCache)()\n\nfunction isCollection(value: unknown): value is Collection {\n\treturn isObject(value) && value.type === \"Collection\"\n}\n\n/**\n * Every instance manages its own cache and size.\n */\nexport class QueryCache {\n\tprivate readonly cache = new Map<string, LazyValue<QueryResult>>()\n\t/** Server-only cache for serialized results to avoid re-serializing on cache hits */\n\tprivate readonly serializedCache =\n\t\thandoverCollector !== undefined ? new Map<string, SerializableQueryResult>() : undefined\n\n\tconstructor(\n\t\tprivate readonly queryEngine: QueryEngine,\n\t\tprivate readonly maxSize = Infinity,\n\t) {}\n\n\tprivate prune() {\n\t\tif (this.cache.size <= this.maxSize) return\n\n\t\tfor (const [key, value] of this.cache) {\n\t\t\tif (this.cache.size <= this.maxSize) break\n\t\t\tif (value.state === \"pending\") continue\n\n\t\t\tthis.cache.delete(key)\n\t\t\tthis.serializedCache?.delete(key)\n\t\t}\n\t}\n\n\tget(query: Query, locale: MaybeLocale) {\n\t\tconst key = getCacheKey(query, locale)\n\n\t\tconst existing = this.cache.get(key)\n\t\tif (existing) {\n\t\t\t// Re-insert the item at the end of the cache.\n\t\t\tthis.cache.delete(key)\n\t\t\tthis.cache.set(key, existing)\n\n\t\t\t// On cache hit during SSR, populate handover collector with cached value. We only need\n\t\t\t// to do this for non-pending promises. For pending ones, the `then()` from `resolver()`\n\t\t\t// will populate the handover collector.\n\t\t\tif (\n\t\t\t\thandoverCollector !== undefined &&\n\t\t\t\tthis.serializedCache !== undefined &&\n\t\t\t\t!hasRandomCollectionId(key) &&\n\t\t\t\texisting.state === \"fulfilled\"\n\t\t\t) {\n\t\t\t\tconst cachedSerialized = this.serializedCache.get(key)\n\t\t\t\tif (cachedSerialized !== undefined) {\n\t\t\t\t\thandoverCollector.set(handoverDataType, key, cachedSerialized)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn existing\n\t\t}\n\n\t\tconst resolver = (): QueryResult | Promise<QueryResult> => {\n\t\t\tconst containsRandomCollectionId = hasRandomCollectionId(key)\n\n\t\t\t// We exclude collections with random ids, because we cannot hand them over\n\t\t\t// (as the id on the server won't match the id on the client).\n\t\t\tconst handoverResult = containsRandomCollectionId ? undefined : getHandoverData(handoverDataType, key)\n\t\t\tif (handoverResult) {\n\t\t\t\ttry {\n\t\t\t\t\treturn this.queryEngine.resolveSerializableQueryResult(handoverResult, query, locale)\n\t\t\t\t} catch (error) {\n\t\t\t\t\thandleHydrationError(error, key)\n\t\t\t\t\t// Fall through to network (as handoverResult stays null)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// We do not hand over slug or recordId queries, because we also hand them over in CollectionUtilsCache.\n\t\t\tif (handoverCollector !== undefined && !containsRandomCollectionId) {\n\t\t\t\treturn this.queryEngine.serializeableQuery(query, locale).then(([queryResult, serializableResult]) => {\n\t\t\t\t\tthis.serializedCache?.set(key, serializableResult)\n\t\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: handoverCollector is only undefined in the browser\n\t\t\t\t\thandoverCollector!.set(handoverDataType, key, serializableResult)\n\t\t\t\t\treturn queryResult\n\t\t\t\t})\n\t\t\t}\n\n\t\t\treturn this.queryEngine.query(query, locale)\n\t\t}\n\t\tconst value = new LazyValue(resolver)\n\t\tthis.cache.set(key, value)\n\t\tthis.prune()\n\t\treturn value\n\t}\n}\n\nfunction replaceCollection(_: string, value: unknown) {\n\tif (isCollection(value) && isAnyCollection(value.data)) return getCollectionId(value.data)\n\n\treturn value\n}\n\nfunction getCacheKey(query: Query, locale: MaybeLocale): string {\n\tconst localeId = locale?.id ?? \"default\"\n\n\treturn JSON.stringify(query, replaceCollection) + localeId\n}\n\nexport const testing = {\n\tgetCacheKey,\n}\n", "import type { ServerDatabaseQueryResponse } from \"../types.ts\"\n\n/**\n * @internal\n */\nexport async function executeServerDatabaseQuery(sql: string): Promise<ServerDatabaseQueryResponse> {\n\tconst { executeServerDatabaseQuery: executeServerDatabaseQueryWithSqlite } = await import(\"./SqliteDatabase.ts\")\n\treturn executeServerDatabaseQueryWithSqlite(sql)\n}\n", "import { type ChangeEvent, startTransition, useCallback, useMemo, useRef } from \"react\"\nimport type { FormSelectOption } from \"../../render/presentation/Forms/FormSelect.tsx\"\nimport { ControlType } from \"../../render/types/PropertyControls.ts\"\nimport type { OptionalFlag, OptionalValue } from \"../../router/queryParameters.tsx\"\nimport type { Locale } from \"../../router/types.ts\"\nimport { useLocaleInfo } from \"../../router/useLocale.ts\"\nimport { isBoolean, isString } from \"../../utils/utils.ts\"\nimport { useQueryData } from \"../useQueryData.ts\"\nimport type { AnyCollection, Query } from \"./types.ts\"\n\nconst ALL_ELEMENTS_VALUE = \"__all__\"\nconst BOOLEAN_TRUE_VALUE = \"__true__\"\nconst BOOLEAN_FALSE_VALUE = \"__false__\"\n\ntype FormSelectVariableType = ControlType.CollectionReference | ControlType.Boolean | ControlType.Enum\n\ntype WithAllItemsLabel<Optional extends OptionalFlag> = Optional extends true\n\t? { allItemsLabel: string }\n\t: { allItemsLabel?: never }\n\ntype FormSelectVariableBindingBaseOptions<Optional extends OptionalFlag> = {\n\tsetValue: (nextValue: OptionalValue<string | boolean, Optional>) => void\n\tvalue: string | boolean | undefined\n\tvariableType: FormSelectVariableType\n} & WithAllItemsLabel<Optional>\n\ntype FormSelectVariableBindingCollectionOptions<Optional extends OptionalFlag> =\n\tFormSelectVariableBindingBaseOptions<Optional> & {\n\t\tvariableType: ControlType.CollectionReference\n\t\tcollectionData: AnyCollection\n\t\tisOptional: Optional\n\t\tslugId: string\n\t\ttitleId?: string\n\t}\n\ntype FormSelectVariableBindingBooleanOptions<Optional extends OptionalFlag> =\n\tFormSelectVariableBindingBaseOptions<Optional> & {\n\t\tvariableType: ControlType.Boolean\n\t\tbooleanTrueLabel?: string\n\t\tbooleanFalseLabel?: string\n\t\tisOptional: Optional\n\t}\n\ntype FormSelectVariableBindingEnumOptions<Optional extends OptionalFlag> =\n\tFormSelectVariableBindingBaseOptions<Optional> & {\n\t\tvariableType: ControlType.Enum\n\t\toptions: readonly string[] | undefined\n\t\tgetOptionTitle: ((id: string, locale: Locale | null) => string | undefined) | undefined\n\t\tisOptional: Optional\n\t}\n\ntype FormSelectVariableBindingOptions<Optional extends OptionalFlag> =\n\t| FormSelectVariableBindingCollectionOptions<Optional>\n\t| FormSelectVariableBindingBooleanOptions<Optional>\n\t| FormSelectVariableBindingEnumOptions<Optional>\n\ntype FormSelectVariableBindingResult = [\n\tselectValue: string,\n\tselectOptions: FormSelectOption[] | undefined,\n\tonChange: (event: ChangeEvent) => void,\n]\n\nconst variableBindingHooks = {\n\t[ControlType.Boolean]: useFormSelectBooleanVariableBinding,\n\t[ControlType.CollectionReference]: useFormSelectCollectionVariableBinding,\n\t[ControlType.Enum]: useFormSelectEnumVariableBinding,\n}\n\nexport function useFormSelectVariableBinding<Optional extends OptionalFlag>(\n\toptions: FormSelectVariableBindingOptions<Optional>,\n): FormSelectVariableBindingResult {\n\tconst variableTypeRef = useRef(options.variableType)\n\ttype HookOptions = FormSelectVariableBindingBooleanOptions<Optional> &\n\t\tFormSelectVariableBindingCollectionOptions<Optional> &\n\t\tFormSelectVariableBindingEnumOptions<Optional>\n\treturn variableBindingHooks[variableTypeRef.current](options as HookOptions)\n}\n\nfunction useFormSelectBooleanVariableBinding<Optional extends OptionalFlag>({\n\tallItemsLabel,\n\tbooleanTrueLabel,\n\tbooleanFalseLabel,\n\tisOptional,\n\tsetValue,\n\tvalue,\n}: FormSelectVariableBindingBooleanOptions<Optional>): FormSelectVariableBindingResult {\n\tconst selectValue = useMemo(() => {\n\t\tif (value === true) return BOOLEAN_TRUE_VALUE\n\t\tif (value === false) return BOOLEAN_FALSE_VALUE\n\t\treturn isOptional ? ALL_ELEMENTS_VALUE : BOOLEAN_TRUE_VALUE\n\t}, [isOptional, value])\n\n\tconst selectOptions = useMemo(\n\t\t() =>\n\t\t\twithAllOption(\n\t\t\t\t[\n\t\t\t\t\t{\n\t\t\t\t\t\tdisabled: false,\n\t\t\t\t\t\ttitle: booleanTrueLabel,\n\t\t\t\t\t\ttype: \"option\",\n\t\t\t\t\t\tvalue: BOOLEAN_TRUE_VALUE,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisabled: false,\n\t\t\t\t\t\ttitle: booleanFalseLabel,\n\t\t\t\t\t\ttype: \"option\",\n\t\t\t\t\t\tvalue: BOOLEAN_FALSE_VALUE,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tisOptional,\n\t\t\t\tallItemsLabel,\n\t\t\t\tfalse,\n\t\t\t),\n\t\t[allItemsLabel, booleanTrueLabel, booleanFalseLabel, isOptional],\n\t)\n\n\tconst onChange = useCallback(\n\t\t(event: ChangeEvent) => {\n\t\t\tif (!(event.target instanceof HTMLSelectElement)) return\n\n\t\t\tconst selectedValue = event.target.value\n\t\t\tstartTransition(() => {\n\t\t\t\tif (selectedValue === ALL_ELEMENTS_VALUE) {\n\t\t\t\t\tsetValue(undefined as OptionalValue<boolean, Optional>)\n\t\t\t\t} else if (selectedValue === BOOLEAN_TRUE_VALUE) {\n\t\t\t\t\tsetValue(true as OptionalValue<boolean, Optional>)\n\t\t\t\t} else if (selectedValue === BOOLEAN_FALSE_VALUE) {\n\t\t\t\t\tsetValue(false as OptionalValue<boolean, Optional>)\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\t\t[setValue],\n\t)\n\n\treturn [selectValue, selectOptions, onChange]\n}\n\nfunction useFormSelectCollectionVariableBinding<Optional extends OptionalFlag>({\n\tallItemsLabel,\n\tcollectionData,\n\tisOptional,\n\tslugId,\n\ttitleId,\n\tsetValue,\n\tvalue: rawValue,\n}: FormSelectVariableBindingCollectionOptions<Optional>): FormSelectVariableBindingResult {\n\tconst selectOptions = useCollectionSelectOptions({\n\t\tcollectionData,\n\t\tslugId,\n\t\ttitleId,\n\t})\n\n\tconst value = isBoolean(rawValue) ? undefined : rawValue\n\n\treturn useStringSelectBinding({\n\t\tallItemsLabel,\n\t\tisOptional,\n\t\tselectOptions,\n\t\tsetValue,\n\t\tvalue,\n\t})\n}\n\nfunction useFormSelectEnumVariableBinding<Optional extends OptionalFlag>({\n\tallItemsLabel,\n\toptions: enumOptions,\n\tgetOptionTitle,\n\tisOptional,\n\tsetValue,\n\tvalue: rawValue,\n}: FormSelectVariableBindingEnumOptions<Optional>): FormSelectVariableBindingResult {\n\tconst { activeLocale } = useLocaleInfo()\n\n\tconst selectOptions = useMemo(() => {\n\t\tif (!enumOptions) return undefined\n\n\t\treturn enumOptions.map(\n\t\t\t(enumId): FormSelectOption => ({\n\t\t\t\ttype: \"option\",\n\t\t\t\tvalue: enumId,\n\t\t\t\ttitle: getOptionTitle?.(enumId, activeLocale) ?? \"\",\n\t\t\t}),\n\t\t)\n\t}, [activeLocale, enumOptions, getOptionTitle])\n\n\tconst value = isString(rawValue) ? rawValue : undefined\n\n\treturn useStringSelectBinding({\n\t\tallItemsLabel,\n\t\tisOptional,\n\t\tselectOptions,\n\t\tsetValue,\n\t\tvalue,\n\t})\n}\n\nfunction useCollectionSelectOptions({\n\tcollectionData,\n\tslugId,\n\ttitleId,\n}: {\n\tcollectionData: AnyCollection\n\tslugId: string\n\ttitleId?: string\n}): FormSelectOption[] | undefined {\n\tconst query: Query = useMemo(\n\t\t() => ({\n\t\t\tfrom: {\n\t\t\t\ttype: \"Collection\",\n\t\t\t\tdata: collectionData,\n\t\t\t},\n\t\t\tselect: [\n\t\t\t\t{ type: \"Identifier\", name: \"id\" },\n\t\t\t\t{ type: \"Identifier\" as const, name: slugId },\n\t\t\t\t...(titleId ? [{ type: \"Identifier\" as const, name: titleId }] : []),\n\t\t\t],\n\t\t}),\n\t\t[collectionData, slugId, titleId],\n\t)\n\n\tconst records = useQueryData(query)\n\n\treturn useMemo(() => {\n\t\tif (!Array.isArray(records) || records.length === 0) return undefined\n\n\t\treturn records\n\t\t\t.filter(record => typeof record?.id === \"string\")\n\t\t\t.flatMap(record => {\n\t\t\t\tconst id = record.id as string\n\n\t\t\t\tconst title = titleId && isString(record[titleId]) ? record[titleId] : undefined\n\t\t\t\tconst slug = isString(record[slugId]) ? record[slugId] : undefined\n\n\t\t\t\tconst displayTitle = title || slug\n\t\t\t\tif (!displayTitle) return []\n\n\t\t\t\treturn [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"option\",\n\t\t\t\t\t\tvalue: id,\n\t\t\t\t\t\ttitle: displayTitle,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t})\n\t}, [records, titleId, slugId])\n}\n\nfunction useStringSelectBinding<Optional extends OptionalFlag>({\n\tallItemsLabel,\n\tisOptional,\n\tselectOptions,\n\tsetValue,\n\tvalue,\n}: {\n\tallItemsLabel: string | undefined\n\tisOptional: Optional\n\tselectOptions: FormSelectOption[] | undefined\n\tsetValue: (nextValue: OptionalValue<string, Optional>) => void\n\tvalue: string | undefined\n}): FormSelectVariableBindingResult {\n\tconst selectValue = value === undefined ? ALL_ELEMENTS_VALUE : value\n\n\tconst selectOptionsIncludingOptional = useMemo(\n\t\t() => withAllOption(selectOptions, isOptional, allItemsLabel),\n\t\t[allItemsLabel, isOptional, selectOptions],\n\t)\n\n\tconst onChange = useCallback(\n\t\t(event: ChangeEvent) => {\n\t\t\tif (!(event.target instanceof HTMLSelectElement)) return\n\n\t\t\tconst selectedValue = event.target.value\n\t\t\tstartTransition(() => {\n\t\t\t\tif (selectedValue === ALL_ELEMENTS_VALUE) {\n\t\t\t\t\tsetValue(undefined as OptionalValue<string, Optional>)\n\t\t\t\t} else {\n\t\t\t\t\tsetValue(selectedValue as OptionalValue<string, Optional>)\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\t\t[setValue],\n\t)\n\n\treturn [selectValue, selectOptionsIncludingOptional, onChange]\n}\n\nfunction withAllOption(\n\toptions: FormSelectOption[] | undefined,\n\tisOptional: OptionalFlag,\n\tallItemsLabel: string | undefined,\n\tincludeDivider = true,\n): FormSelectOption[] | undefined {\n\tif (isOptional !== true || !allItemsLabel) return options\n\n\tconst allOption: FormSelectOption = {\n\t\ttitle: allItemsLabel,\n\t\ttype: \"option\",\n\t\tvalue: ALL_ELEMENTS_VALUE,\n\t}\n\n\tif (!options || options.length === 0) return [allOption]\n\n\tif (includeDivider) return [allOption, { type: \"divider\" }, ...options]\n\n\treturn [allOption, ...options]\n}\n", "import { useCallback } from \"react\"\nimport type { MaybePromise } from \"../router/types.ts\"\nimport { useLocaleInfo } from \"../router/useLocale.ts\"\nimport { isObject, isUndefined } from \"../utils/utils.ts\"\nimport { QueryCache } from \"./cms/QueryCache.ts\"\nimport { QueryEngine, type QueryResult } from \"./cms/QueryEngine.ts\"\nimport type { Expression, Query } from \"./cms/types.ts\"\nimport { BinaryOperator, DataType } from \"./cms/types.ts\"\n\nconst queryEngine = /* @__PURE__ */ new QueryEngine()\n\n/**\n * Singleton query cache used by useQueryData and loaders.\n * @internal\n */\nexport const queryCache = /* @__PURE__ */ new QueryCache(queryEngine)\n\n/** @internal */\nexport function useQueryData(query: Query) {\n\tconst { activeLocale } = useLocaleInfo()\n\tconst cached = queryCache.get(query, activeLocale)\n\n\treturn cached.use()\n}\n\n/** @internal */\nexport function useQueryCount(query: Query) {\n\tconst countQuery = { ...query, select: [] }\n\tconst collection = useQueryData(countQuery)\n\treturn collection.length\n}\n\n/**\n * @internal\n */\nexport function usePreloadQuery(): (query: Query) => MaybePromise<QueryResult> {\n\tconst { activeLocale } = useLocaleInfo()\n\n\treturn useCallback(\n\t\t(query: Query) => {\n\t\t\treturn queryCache.get(query, activeLocale).readMaybeAsync()\n\t\t},\n\t\t[activeLocale],\n\t)\n}\n\n/** Utility function to create a WHERE expression from path variables. */\nexport function getWhereExpressionFromPathVariables(\n\tpathVariables: Record<string, unknown> | undefined,\n\tcollection?: string,\n): Expression {\n\tconst entries = Object.entries(pathVariables ?? {}).filter(([, value]) => {\n\t\tif (isUndefined(value)) return false\n\t\tif (isObject(value)) return false\n\t\treturn true\n\t})\n\n\tconst expressions = entries.map(\n\t\t([name, value]): Expression => ({\n\t\t\ttype: \"BinaryOperation\",\n\t\t\toperator: BinaryOperator.Equals,\n\t\t\tleft: {\n\t\t\t\ttype: \"TypeCast\",\n\t\t\t\tvalue: {\n\t\t\t\t\ttype: \"Identifier\",\n\t\t\t\t\tname,\n\t\t\t\t\tcollection,\n\t\t\t\t},\n\t\t\t\tdataType: DataType.String,\n\t\t\t},\n\t\t\tright: {\n\t\t\t\ttype: \"LiteralValue\",\n\t\t\t\tvalue: String(value),\n\t\t\t},\n\t\t}),\n\t)\n\n\tif (expressions.length === 0) {\n\t\treturn {\n\t\t\ttype: \"LiteralValue\",\n\t\t\tvalue: false,\n\t\t}\n\t}\n\n\treturn expressions.reduce(\n\t\t(result: Expression, expression: Expression): Expression => ({\n\t\t\ttype: \"BinaryOperation\",\n\t\t\toperator: BinaryOperator.And,\n\t\t\tleft: result,\n\t\t\tright: expression,\n\t\t}),\n\t)\n}\n", "import type { Trigger } from \"./triggerActions.ts\"\nimport { TriggerActionsStorageSymbol } from \"./triggerActionsStorage.ts\"\n\nexport interface WindowWithTriggerEvents extends Window {\n\t[TriggerActionsStorageSymbol]?: Set<string>\n}\n\n/**\n * Trigger definitions are wrapped in this function so any dependent events are collected when the module is imported.\n * The function has no usage when used in any other way because the events will have been used to create TriggerActionsStorage already.\n * This allows us to collect all tracking events that we need to consume for all triggers in the bundle.\n */\nexport function createTrigger(input: Trigger): Trigger {\n\tif (typeof window === \"undefined\" || !window.document) return input\n\tconst safeWindow = window as WindowWithTriggerEvents\n\n\tfor (const rule of input.eventHistory ?? []) {\n\t\tif (!rule.eventId) continue\n\n\t\tsafeWindow[TriggerActionsStorageSymbol] ??= new Set()\n\t\tsafeWindow[TriggerActionsStorageSymbol].add(`${rule.eventType}:${rule.eventId}`)\n\t}\n\n\treturn input\n}\n", "import { startTransition, useEffect, useMemo, useState } from \"react\"\nimport type { Trigger } from \"../utils/triggerActions.ts\"\nimport { useStableCallback } from \"../utils/useStableCallback.ts\"\nimport { noop } from \"../utils/utils.ts\"\nimport { useTriggerState } from \"./TriggerStateContext.tsx\"\n\ninterface TriggerSubscriptionProps {\n\ttriggerId: string\n\ttargetId: string\n\ttrigger: Trigger\n\t/**\n\t * Callback to call when the trigger is triggered.\n\t */\n\tcallback?: () => void\n\t/**\n\t * If this prop becomes true at any point the trigger is considered to be triggered manually.\n\t * For example if an overlay is manually opened we don't want the trigger to open the overlay again,\n\t * so we pass the overlay visibility in to this prop.\n\t */\n\ttriggeredExternally?: boolean\n}\nexport function TriggerSubscription({\n\ttriggerId,\n\ttargetId,\n\ttrigger,\n\tcallback,\n\ttriggeredExternally,\n}: TriggerSubscriptionProps) {\n\tconst triggerState = useTriggerState()\n\tconst stableCallback = useStableCallback(callback ?? noop)\n\n\tuseEffect(() => {\n\t\tconst unsubscribe = triggerState?.subscribe(triggerId, targetId, trigger, stableCallback)\n\t\treturn unsubscribe\n\t}, [triggerState?.subscribe, triggerId, targetId, trigger, stableCallback])\n\tuseEffect(() => {\n\t\tif (triggeredExternally) {\n\t\t\ttriggerState?.invoke(triggerId, { callCallback: false })\n\t\t}\n\t}, [triggerState, triggerId, triggeredExternally])\n\treturn null\n}\n\nexport function useTriggers() {\n\tconst triggerState = useTriggerState()\n\tconst [invokedTriggers, setInvokedTriggers] = useState<Set<string>>(() => triggerState?.invokedTriggers ?? new Set())\n\tuseEffect(() => {\n\t\tif (!triggerState) return\n\n\t\tconst onTrigger = () => {\n\t\t\tstartTransition(() => {\n\t\t\t\tsetInvokedTriggers(triggerState.invokedTriggers)\n\t\t\t})\n\t\t}\n\t\ttriggerState.addOnTriggerListener(onTrigger)\n\n\t\t// eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect -- catch triggers invoked before first effect call\n\t\tstartTransition(() => {\n\t\t\tsetInvokedTriggers(current =>\n\t\t\t\tcurrent.size !== triggerState.invokedTriggers.size ? triggerState.invokedTriggers : current,\n\t\t\t)\n\t\t})\n\n\t\treturn () => {\n\t\t\ttriggerState.removeOnTriggerListener(onTrigger)\n\t\t}\n\t}, [triggerState])\n\n\tconst result = useMemo(\n\t\t() => ({\n\t\t\thasTriggered: (triggerId: string) => {\n\t\t\t\treturn invokedTriggers.has(triggerId)\n\t\t\t},\n\t\t}),\n\t\t[invokedTriggers],\n\t)\n\n\treturn result\n}\n", "import { useEffect, useRef } from \"react\"\nimport { useOnCurrentTargetChange } from \"../components/NavigationTargetContext.tsx\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\n\ntype Timer = ReturnType<typeof globalThis.setTimeout>\n\ntype RejectCallback = (reason: string) => void\n\nfunction rejectPending(pendingTimers: Set<Timer>, pendingPromises: Set<RejectCallback>) {\n\tpendingTimers.forEach(t => clearTimeout(t))\n\tpendingTimers.clear()\n\n\tpendingPromises.forEach(reject => reject?.(\"Callback cancelled by variant change\"))\n\tpendingPromises.clear()\n}\n\nfunction createSet<T>() {\n\treturn new Set<T>()\n}\n\n/**\n * Create callbacks that can be cancelled if the component is unmounted, the\n * active variant changes, or the component moves out of the target screen in a\n * Framer prototype.\n *\n * @public\n */\nexport function useActiveVariantCallback(baseVariant: string | undefined) {\n\tconst pendingPromises = useConstant<Set<RejectCallback>>(createSet)\n\tconst pendingTimers = useConstant<Set<Timer>>(createSet)\n\n\t// If the component moves out of the current screen in a Framer prototype,\n\t// or the current screen is being unmounted via an AnimatePresence animation\n\t// cancel all pending events.\n\tuseOnCurrentTargetChange(() => {\n\t\treturn () => rejectPending(pendingTimers, pendingPromises)\n\t})\n\n\t// If the component is unmounted, cancel all pending events.\n\tuseEffect(() => {\n\t\treturn () => rejectPending(pendingTimers, pendingPromises)\n\t}, [])\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: If the base variant of the component changes, cancel all pending events.\n\tuseEffect(() => {\n\t\trejectPending(pendingTimers, pendingPromises)\n\t}, [baseVariant])\n\n\treturn useRef({\n\t\t/**\n\t\t * Create a callback that can be cancelled if the base variant changes.\n\t\t */\n\t\tactiveVariantCallback:\n\t\t\t(callback: (...args: unknown[]) => Promise<boolean | undefined>) =>\n\t\t\tasync (...args: unknown[]) => {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tpendingPromises.add(reject)\n\t\t\t\t\tvoid callback(...args).then(resolve)\n\t\t\t\t}).catch(() => {\n\t\t\t\t\t// Swallow errors caused by rejecting this promise. It doesn't catch errors caused by the callback.\n\t\t\t\t})\n\t\t\t},\n\n\t\t/**\n\t\t * Execute a callback after a defined period of time. The callback will not\n\t\t * be called if pending events are cancelled because the timeout will be\n\t\t * cancelled.\n\t\t */\n\t\tdelay: async (callback: () => void, msDelay: number) => {\n\t\t\tawait new Promise(resolve => {\n\t\t\t\tpendingTimers.add(globalThis.setTimeout(() => resolve(true), msDelay))\n\t\t\t})\n\t\t\tcallback()\n\t\t},\n\t}).current\n}\n\n/**\n * Create callbacks that can be cancelled if the component is unmounted, or the\n * component moves out of the target screen in a Framer prototype.\n *\n * @internal\n */\nexport function useActiveTargetCallback() {\n\tconst value = useActiveVariantCallback(undefined)\n\n\treturn useRef({\n\t\tactiveTargetCallback: value.activeVariantCallback,\n\t\tdelay: value.delay,\n\t}).current\n}\n", "import React from \"react\"\n\n/**\n * Variant / Node Id / React Prop / Val\n *\n * @public\n */\nexport type VariantProps = Record<string, Record<string, Record<string, unknown>>>\n\n/**\n * Returns combines React props from a hash map based on the active variants.\n *\n * @public\n */\nexport function useAddVariantProps(\n\tbaseVariant: string | undefined,\n\tgestureVariant: string | undefined,\n\tvariantProps: VariantProps,\n): (id: string) => Record<string, unknown> {\n\treturn React.useCallback(\n\t\t(id: string) => {\n\t\t\tif (!variantProps) return {}\n\t\t\tif (!baseVariant) return {}\n\n\t\t\t// Create an object with all valid props for the target node. Values\n\t\t\t// in higher priority variants override same values in lower\n\t\t\t// priority variants.\n\t\t\tif (gestureVariant) {\n\t\t\t\treturn Object.assign({}, variantProps[baseVariant]?.[id], variantProps[gestureVariant]?.[id])\n\t\t\t}\n\n\t\t\treturn variantProps[baseVariant]?.[id] || {}\n\t\t},\n\t\t[baseVariant, gestureVariant, variantProps],\n\t)\n}\n", "import { isBrowser } from \"@framerjs/shared/src/environment.ts\"\nimport { useInstantTransition } from \"framer-motion\"\nimport { startTransition, useCallback, useContext, useEffect, useRef } from \"react\"\nimport { IsInitialNavigationContext } from \"../components/Navigation.tsx\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\nimport { isScreenshotFramerHost } from \"../render/types/RenderEnvironment.ts\"\nimport { useIsomorphicLayoutEffect } from \"../useIsomorphicLayoutEffect.ts\"\nimport { safeWindow } from \"../utils/safeWindow.ts\"\nimport { supportsRequestIdleCallback } from \"../utils/utils.ts\"\nimport { useForceUpdate } from \"./useForceUpdate.ts\"\nimport { useIsStaticRenderer } from \"./useIsStaticRenderer.ts\"\n\n/** @internal */\ninterface Breakpoint {\n\tmin?: number\n\tmax?: number\n}\n\n/**\n * Breakpoint as it's defined in the metadata module for a web page.\n */\ninterface MetadataBreakpoint {\n\thash: string\n\tmediaQuery?: string\n}\n\nfunction createMediaQueriesFromBreakpoints(breakpoints: Record<string, Breakpoint>): Record<string, string> {\n\tconst mediaQueries: Record<string, string> = {}\n\tfor (const [variant, query] of Object.entries(breakpoints)) {\n\t\tconst { min = 0, max } = query\n\t\tconst mediaQuery: string[] = []\n\t\tif (min) mediaQuery.push(`(min-width: ${min}px)`)\n\t\tif (max) mediaQuery.push(`(max-width: ${max}px)`)\n\t\tif (mediaQuery.length) mediaQueries[variant] = mediaQuery.join(\" and \")\n\t}\n\n\treturn mediaQueries\n}\n\nfunction activeMediaQueryFromWindow(mediaQueries: Record<string, string>) {\n\tfor (const [variant, query] of Object.entries(mediaQueries)) {\n\t\tconst mql = safeWindow.matchMedia(query)\n\t\tif (mql.matches) return variant\n\t}\n}\n\nfunction activeBreakpointHashesFromWindow(breakpoints: MetadataBreakpoint[]): string[] | undefined {\n\tconst matches: string[] = []\n\tfor (const { hash, mediaQuery } of breakpoints) {\n\t\tif (!mediaQuery) continue\n\t\tconst mql = safeWindow.matchMedia(mediaQuery)\n\t\tif (mql.matches) matches.push(hash)\n\t}\n\n\tif (matches.length > 0) return matches\n\n\tconst defaultHash = breakpoints[0]?.hash\n\tif (!defaultHash) return undefined\n\n\t// Fall back to the first (primary) breakpoint. This generally happens when\n\t// breakpoints.length === 1, in which case the only breakpoint doesn't have\n\t// a media query.\n\treturn [defaultHash]\n}\n\n/**\n * @internal\n *\n * Return the active breakpoint variant based on javascript media queries.\n * Additionally, initially return the primary breakpoint value, and update to\n * the active breakpoint in a layout effect to avoid hydration errors for\n * components whose react props differ from the primary breakpoint.\n */\nexport function useHydratedBreakpointVariants(\n\tinitial: string,\n\tmediaQueries: Record<string, string>,\n\thydratedWithInitial = true,\n): [string | undefined, string | undefined] {\n\tconst isInitialNavigation = useContext(IsInitialNavigationContext)\n\tconst isStaticRenderer = useIsStaticRenderer()\n\tconst isScreenshotHost = isScreenshotFramerHost()\n\tconst usesMediaQueries = isBrowser() && (!isStaticRenderer || isScreenshotHost)\n\tconst baseVariant = useRef(usesMediaQueries ? (activeMediaQueryFromWindow(mediaQueries) ?? initial) : initial)\n\tconst basePropsVariant = useRef(hydratedWithInitial && isInitialNavigation ? initial : baseVariant.current)\n\tconst forceUpdate = useForceUpdate()\n\n\tconst instantTransition = useInstantTransition()\n\tconst setActiveVariantInstant = useCallback(\n\t\t(variant: string) => {\n\t\t\t// Make sure we're actually changing the variant.\n\t\t\t//\n\t\t\t// If we were to re-render with no variant change, React will bail\n\t\t\t// out of re-rendering, and instantTransition will instead apply to\n\t\t\t// the _next_ transition.\n\t\t\tif (variant !== baseVariant.current || variant !== basePropsVariant.current) {\n\t\t\t\tfunction updateStateAndRerender() {\n\t\t\t\t\tbaseVariant.current = basePropsVariant.current = variant\n\t\t\t\t\t// When switching between breakpoints that feature a\n\t\t\t\t\t// collection, it's possible that `useQueryData` needs to\n\t\t\t\t\t// load more data (by throwing a promise). We don't use the\n\t\t\t\t\t// React Suspense component, because we don't show a loading\n\t\t\t\t\t// spinner, so we need to start a transition.\n\t\t\t\t\tstartTransition(() => {\n\t\t\t\t\t\tforceUpdate()\n\t\t\t\t\t})\n\t\t\t\t}\n\n\t\t\t\tif (isStaticRenderer) {\n\t\t\t\t\t// There's no root projection node on the canvas, so instantTransition won't fire the callback.\n\t\t\t\t\tupdateStateAndRerender()\n\t\t\t\t} else {\n\t\t\t\t\tinstantTransition(() => {\n\t\t\t\t\t\tupdateStateAndRerender()\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[instantTransition, forceUpdate, isStaticRenderer],\n\t)\n\n\t// On the canvas, updates the internal state when the external variant variant changes. This is particularly\n\t// necessary for layout template instances with nested components that change variants in different breakpoints.\n\tuseIsomorphicLayoutEffect(() => {\n\t\tif (!isStaticRenderer) return\n\t\tif (isScreenshotHost) {\n\t\t\tsetActiveVariantInstant(activeMediaQueryFromWindow(mediaQueries) ?? initial)\n\t\t\treturn\n\t\t}\n\t\tsetActiveVariantInstant(initial)\n\t}, [initial, isScreenshotHost, isStaticRenderer, mediaQueries, setActiveVariantInstant])\n\n\t// If this is an initial navigation, we started with the initial breakpoint\n\t// to avoid hydration errors, but then we want to immediately re-render with\n\t// the correct breakpoint.\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: This hook should only ever run once.\n\tuseIsomorphicLayoutEffect(() => {\n\t\tif (!hydratedWithInitial || isInitialNavigation !== true) return\n\n\t\tsetActiveVariantInstant(baseVariant.current)\n\t}, [])\n\n\t// In the preview, after mount, add event listeners to media queries to\n\t// update the active variant when they match. Finally, cleanup the listeners\n\t// when the component is unmounted.\n\tuseEffect(() => {\n\t\tif (!usesMediaQueries || isScreenshotHost) return\n\n\t\tconst callbacks: [MediaQueryList, (event: MediaQueryListEvent) => void][] = []\n\t\tfor (const [variant, query] of Object.entries(mediaQueries)) {\n\t\t\tconst mql = safeWindow.matchMedia(query)\n\n\t\t\tconst callback = (event: MediaQueryListEvent) => {\n\t\t\t\tif (event.matches) setActiveVariantInstant(variant)\n\t\t\t}\n\n\t\t\taddMQLCallback(mql, callback)\n\n\t\t\tcallbacks.push([mql, callback])\n\t\t}\n\n\t\treturn () => callbacks.forEach(([mql, callback]) => removeMQLCallback(mql, callback))\n\t}, [isScreenshotHost, mediaQueries, setActiveVariantInstant, usesMediaQueries])\n\n\treturn [baseVariant.current, basePropsVariant.current]\n}\n\nfunction addMQLCallback(mql: MediaQueryList, callback: (event: MediaQueryListEvent) => void) {\n\tif (mql.addEventListener) {\n\t\tmql.addEventListener(\"change\", callback)\n\t} else {\n\t\t// Safari < 14 doesn't support addEventListener on MediaQueryList\n\t\tmql.addListener(callback)\n\t}\n}\n\nfunction removeMQLCallback(mql: MediaQueryList, callback: (event: MediaQueryListEvent) => void) {\n\tif (mql.removeEventListener) {\n\t\tmql.removeEventListener(\"change\", callback)\n\t} else {\n\t\t// Safari < 14 doesn't support removeEventListener on MediaQueryList\n\t\tmql.removeListener(callback)\n\t}\n}\n\n/**\n * @internal\n *\n * Compatibility wrapper for old generated screens which pass an unused second\n * width argument, breakpoints as maps of raw number values, and expect to\n * receive a single return value.\n */\nexport function useBreakpointVariants(\n\tinitial: string,\n\t_width: number | undefined,\n\tbreakpoints: Record<string, Breakpoint>,\n) {\n\tconst mediaQueries = useConstant(() => createMediaQueriesFromBreakpoints(breakpoints))\n\n\tconst [initialVariant] = useHydratedBreakpointVariants(initial, mediaQueries, true)\n\n\treturn initialVariant\n}\n\n/**\n * @internal\n *\n * @deprecated This function used to be called at the top level of old generated web page components, so we need to keep\n * it for backward compatibility. These days, it does nothing, and we instead remove hidden breakpoint layers using the\n * \"v2\" function below, which is being called in the main site script, right before hydration.\n */\nexport function removeHiddenBreakpointLayers(\n\t_initial: string,\n\t_mediaQueries: Record<string, string>,\n\t_variantClassNames: Record<string, string>,\n) {}\n\nconst framerBreakpointCSSSelector = \"style[data-framer-breakpoint-css]\"\n\n/** A fallback for when requestIdleCallback is not available (as of 2024, all Safari versions). */\nfunction requestIdleCallbackFallback(callback: () => void) {\n\tsetTimeout(callback, 1)\n}\n\n/**\n * During SSR, if a component differs between breakpoints in a way that can't be expressed purely with CSS, we render\n * (via PropertyOverrides) all its variants into the HTML, with a bit of CSS so that at runtime the browser only shows\n * the correct breakpoint.\n *\n * But then, we need to clean this up before hydration kicks in, otherwise we'll get a hydration error, because the\n * client doesn't expect all those extra (hidden) breakpoints that are still in the DOM.\n *\n * This is expected to be called in the main site script, right before hydration, see exportToHTML.ts.\n */\nexport function removeHiddenBreakpointLayersV2(breakpoints: MetadataBreakpoint[]) {\n\tconst suspenseBoundaries = new Set<Node>()\n\tconst activeBreakpointHashes = activeBreakpointHashesFromWindow(breakpoints)\n\tif (activeBreakpointHashes) {\n\t\tfor (const hash of activeBreakpointHashes) {\n\t\t\tfor (const hiddenLayer of document.querySelectorAll(\".hidden-\" + hash)) {\n\t\t\t\tif (isSuspenseBoundaryStart(hiddenLayer.previousSibling)) {\n\t\t\t\t\tsuspenseBoundaries.add(hiddenLayer.previousSibling)\n\t\t\t\t}\n\t\t\t\thiddenLayer.parentNode?.removeChild(hiddenLayer)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Make all .hidden-* classes no-op because breakpoint switching will be handled solely by React now.\n\t// If we don\u2019t do that, we might experience brief flashes when a breakpoint changes: https://github.com/framer/company/issues/30202\n\tconst requestIdleCallback = supportsRequestIdleCallback ? safeWindow.requestIdleCallback : requestIdleCallbackFallback\n\trequestIdleCallback(() => {\n\t\tdocument.querySelector(framerBreakpointCSSSelector)?.remove()\n\t})\n\n\t// We need to remove empty ssr-variant containers, to support overrides on elements that are hidden in certain\n\t// breakpoints. This is because PropertyOverrides and per-breakpoint visibility are handled by two separate\n\t// mechanisms, so we may end up in a situation where we have e.g. a desktop ssr-variant for an element that's hidden\n\t// on desktop. After removing the hidden layer, we end up with an empty ssr-variant container that's not expected to\n\t// be there on the client.\n\t//\n\t// In the generated code, it looks somewhat like this:\n\t//\n\t//     const isDisplayed () => { return variant === \"MOBILE\" || !isBrowser() }\n\t//     ...\n\t//     {isDisplayed() &&\n\t//       <PropertyOverrides overrides={{MOBILE: { ... }}}>\n\t//         <div className=\"hidden-DESKTOP\">...</div>\n\t//       </PropertyOverrides>}\n\t//\n\t// During SSR, this will render:\n\t//\n\t//     <!-- desktop -->\n\t//     <div class=\"ssr-variant hidden-MOBILE\"><div className=\"hidden-DESKTOP\">...</div></div>\n\t//     <!-- mobile -->\n\t//     <div class=\"ssr-variant hidden-DESKTOP\"><div className=\"hidden-DESKTOP\">...</div></div>\n\t//\n\t// If you now load this on desktop, and we remove all the hidden-DESKTOP layers, we'd be left with an empty\n\t// \"ssr-variant hidden-MOBILE\" container that we won't expect during hydration due to the isDisplayed check.\n\t//\n\t// Real-world example: (look for the Ellipse 191 layer)\n\t// https://framerusercontent.com/modules/gQYlHwIfnAKA7DBb0Yx7/NOL46sZ1lI4d4dQelccR/augiA20Il.tsx\n\tfor (const ssrVariant of document.querySelectorAll(\".ssr-variant:empty\")) {\n\t\tif (isSuspenseBoundaryStart(ssrVariant.previousSibling)) {\n\t\t\tsuspenseBoundaries.add(ssrVariant.previousSibling)\n\t\t}\n\t\tssrVariant.parentNode?.removeChild(ssrVariant)\n\t}\n\n\t// Remove empty suspense boundaries comment nodes\n\tfor (const suspenseBoundary of suspenseBoundaries) {\n\t\tif (isSuspenseBoundaryEnd(suspenseBoundary.nextSibling)) {\n\t\t\tsuspenseBoundary.parentNode?.removeChild(suspenseBoundary.nextSibling)\n\t\t\tsuspenseBoundary.parentNode?.removeChild(suspenseBoundary)\n\t\t}\n\t}\n}\n\nfunction isSuspenseBoundaryStart(node: Node | null): node is Node {\n\treturn node?.nodeType === Node.COMMENT_NODE && node.textContent === \"$\"\n}\n\nfunction isSuspenseBoundaryEnd(node: Node | null): node is Node {\n\treturn node?.nodeType === Node.COMMENT_NODE && node.textContent === \"/$\"\n}\n", "import { useMemo } from \"react\"\nimport { isObject } from \"../utils/utils.ts\"\n\n/**\n * Returns a record from the collection which matches all the given variables.\n *\n * @internal\n * @deprecated Use useQueryData instead.\n */\nexport function useDataRecord(\n\tcollection: Record<string, unknown>[],\n\tvariables: Record<string, unknown> | undefined,\n): Record<string, unknown> | null {\n\treturn useMemo(() => {\n\t\tif (!Array.isArray(collection)) {\n\t\t\treturn null\n\t\t}\n\t\tif (!variables) {\n\t\t\treturn null\n\t\t}\n\t\tconst pageRecord = collection.find(record => {\n\t\t\treturn Object.entries(variables).every(([key, value]) => {\n\t\t\t\tconst recordValue = record[key]\n\t\t\t\t// null, undefined, and objects never match\n\t\t\t\tif (value === undefined || recordValue === undefined || isObject(value) || isObject(recordValue)) {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t\treturn String(value) === String(recordValue)\n\t\t\t})\n\t\t})\n\t\treturn pageRecord ?? null\n\t}, [collection, variables])\n}\n", "import React, { createRef, useMemo } from \"react\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\nimport { getPathForRoute } from \"../router/history.ts\"\nimport { useCurrentRoute } from \"../router/useCurrentRoute.tsx\"\nimport { useLocaleInfo } from \"../router/useLocale.ts\"\n\nexport function useDynamicRefs<T>(): (key: string) => React.RefObject<T> {\n\tconst map = useConstant(() => new Map<string, React.RefObject<T>>())\n\treturn React.useCallback((key: string): React.RefObject<T> => {\n\t\tconst existing = map.get(key)\n\t\tif (existing) return existing\n\t\tconst ref = createRef<T>()\n\t\tmap.set(key, ref)\n\t\treturn ref\n\t}, [])\n}\n\nconst map = new Map<string, React.RefObject<HTMLElement>>()\n\n/**\n * When a Scroll Section is provided to a Layout Template as a property by a Web\n * Page, we need to create the ref on a context so that it is available in the\n * parent Layout Template.\n */\nexport function useSiteRefs<T extends HTMLElement>(): (key: string) => React.RefObject<T> | undefined {\n\tconst route = useCurrentRoute()\n\tconst { activeLocale } = useLocaleInfo()\n\tconst path = useMemo(() => {\n\t\treturn getPathForRoute(route, {\n\t\t\tcurrentRoutePath: route?.path,\n\t\t\tcurrentRoutePathLocalized: route?.pathLocalized,\n\t\t\tcurrentPathVariables: route?.pathVariables,\n\t\t\tpreserveQueryParams: false,\n\t\t\trelative: false,\n\t\t\tsiteCanonicalURL: undefined,\n\t\t\tlocaleId: activeLocale?.id,\n\t\t})\n\t}, [route, activeLocale?.id])\n\n\treturn React.useCallback(\n\t\t(key: string | undefined): React.RefObject<T> | undefined => {\n\t\t\tif (!key) return\n\t\t\tconst computedKey = `${path}-${key}`\n\t\t\tconst existing = map.get(computedKey)\n\t\t\tif (existing) return existing as React.RefObject<T>\n\t\t\tconst ref = createRef<T>()\n\t\t\tmap.set(computedKey, ref)\n\t\t\treturn ref\n\t\t},\n\t\t[path],\n\t)\n}\n", "import React from \"react\"\nimport { useOnCurrentTargetChange } from \"../components/NavigationTargetContext.tsx\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\nimport { safeWindow } from \"../utils/safeWindow.ts\"\nimport { isObject } from \"../utils/utils.ts\"\n\n/** @internal */\nexport interface FramerGamepadKeydownData {\n\tinputs: string[]\n\tid: string\n\tmapping: Gamepad[\"mapping\"]\n}\n\n/** @internal */\nexport function isFramerGamepadKeydownData(value: unknown): value is FramerGamepadKeydownData {\n\treturn isObject(value) && value.mapping !== undefined\n}\n\n/** @internal */\nexport type GamepadKeydownHandler = (data: FramerGamepadKeydownData) => void\n\nfunction gamepadInputsHaveChanged(previous: string[], current: string[]) {\n\tif (previous.length !== current.length) return true\n\tif (!previous.every((item, i) => current[i] === item)) return true\n\treturn false\n}\n\n/**\n * Exported for testing.\n * @internal\n */\nexport function createGamepadPoller() {\n\tconst handlers = new Set<GamepadKeydownHandler>()\n\n\tlet isConnected = false\n\tlet isPolling: number | null = null\n\tlet lastKeys: string[] = []\n\n\tconst startPolling = () => {\n\t\tconst input = getGamepadInputs()\n\t\t// Don't do anything if no gamepad is connected\n\t\tif (!input) return\n\n\t\tconst { gamepad, inputs } = input\n\t\tconst { mapping, id } = gamepad\n\n\t\t// Each frame only knows its own last pressed key. If two continuous\n\t\t// frames both have gamepad events binding on the same key, we don't\n\t\t// want to fire two events in a row.\n\t\tif (gamepadInputsHaveChanged(lastKeys, inputs)) handlers.forEach(handler => handler({ inputs, mapping, id }))\n\n\t\tlastKeys = inputs\n\t\tisPolling = safeWindow.requestAnimationFrame(startPolling)\n\t}\n\n\tconst handleConnection = () => {\n\t\tif (isConnected || isPolling) return\n\t\tstartPolling()\n\t\tisConnected = true\n\t}\n\n\tconst stopPolling = () => {\n\t\tif (!isPolling) return\n\t\tsafeWindow.cancelAnimationFrame(isPolling)\n\t\tisPolling = null\n\t}\n\n\tconst handleDisconnection = () => {\n\t\tif (!isConnected) return\n\t\tstopPolling()\n\t\tisConnected = false\n\t}\n\n\tconst setupAndStartPolling = () => {\n\t\tif (isPolling) return\n\n\t\tconst gamepad = getGamepadInputs()\n\t\tif (!gamepad) {\n\t\t\t// @NOTE: gamepadconnected only exists on window\n\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/Window/gamepadconnected_event\n\t\t\tsafeWindow.addEventListener(\"gamepadconnected\", handleConnection)\n\t\t\treturn\n\t\t}\n\n\t\t// Even if we haven't connected yet, we need to make sure we disconnect\n\t\t// in the future.\n\t\tsafeWindow.addEventListener(\"gamepaddisconnected\", handleDisconnection)\n\n\t\tisConnected = true\n\t\tstartPolling()\n\t}\n\n\tconst cleanupAndStopPolling = () => {\n\t\tif (!isPolling) return\n\n\t\t// If the gamepad is already connected, then this event has no use\n\t\t// anymore; if the gamepad is not connected yet, we will only listen to\n\t\t// it when start polling. So we should remove the event listener anyway.\n\t\tsafeWindow.removeEventListener(\"gamepadconnected\", handleConnection)\n\t\tsafeWindow.removeEventListener(\"gamepaddisconnected\", handleDisconnection)\n\n\t\tstopPolling()\n\t}\n\n\treturn {\n\t\tregister(callback: (input: FramerGamepadKeydownData) => void) {\n\t\t\tif (handlers.size === 0) setupAndStartPolling()\n\t\t\thandlers.add(callback)\n\t\t},\n\t\tunregister(callback: (input: FramerGamepadKeydownData) => void) {\n\t\t\thandlers.delete(callback)\n\t\t\tif (handlers.size === 0) cleanupAndStopPolling()\n\t\t},\n\t}\n}\n\nconst gamepadPoller = /* @__PURE__ */ createGamepadPoller()\n\n/** @internal */\nexport const GamepadContext = /* @__PURE__ */ React.createContext(gamepadPoller)\n\n/**\n * Return the first gamepad that has input together with the input keys. If\n * there's no input, return the first available gamepad. If there's no gamepad\n * connected, return null.\n */\nfunction getGamepadInputs(): { gamepad: Gamepad; inputs: string[] } | null {\n\tlet firstConnectedGamepad: Gamepad | null = null\n\tconst gamepads = navigator.getGamepads()\n\tfor (const gamepad of gamepads) {\n\t\tif (!gamepad) continue\n\n\t\tif (!firstConnectedGamepad) firstConnectedGamepad = gamepad\n\n\t\tconst inputs = [...scanPressedAxis(gamepad), ...scanPressedButtons(gamepad)]\n\n\t\tif (inputs.length > 0) return { gamepad, inputs }\n\t}\n\n\tif (firstConnectedGamepad) return { gamepad: firstConnectedGamepad, inputs: [] }\n\treturn null\n}\n\nfunction scanPressedAxis(gamepad: Gamepad): string[] {\n\tconst axes: string[] = []\n\tfor (const [idx, axis] of gamepad.axes.entries()) {\n\t\t// Normally axis 0&1 are allocated for the left stick, and 3&4 for the\n\t\t// right stick. Depending on the browser, some controllers can have more\n\t\t// than 4 axes. For example, in safari, a PS5 Dualsense controller has\n\t\t// its axis 4&5 for the left/right triggers, that are set to -1 when\n\t\t// idling. We don't want these axes to be taken as pressed.\n\t\tif (idx > 3) continue\n\t\tif (axis <= -0.5) axes.push(`Axis ${idx}-`)\n\t\tif (axis > 0.5) axes.push(`Axis ${idx}+`)\n\t}\n\n\treturn axes\n}\n\nfunction scanPressedButtons(gamepad: Gamepad): string[] {\n\tconst buttons: string[] = []\n\tfor (const [idx, button] of gamepad.buttons.entries()) {\n\t\tif (isButtonPressed(button)) buttons.push(`Button ${idx}`)\n\t}\n\treturn buttons\n}\n\nfunction isButtonPressed(button: GamepadButton): boolean {\n\t// button.value represents the current state of analog buttons\n\treturn button.pressed === true || button.value > 0\n}\n\n/**\n * Register a callback to be executed when a gamepad button is pressed and the\n * registering component is in the current Framer navigation target. Optionally\n * provide a specific gamepad mapping, or flag the hook to operate on keyup.\n *\n *  @public\n */\nexport function useGamepad(\n\tinput: string,\n\tcallback: () => void,\n\t{ mapping, on }: { mapping?: string; on?: \"keyup\" | \"keydown\" } = {},\n) {\n\tconst context = React.useContext(GamepadContext)\n\tconst settings = useConstant(() => ({\n\t\tmapping: mapping ?? \"standard\",\n\t\ton: on ?? \"keydown\",\n\t}))\n\tconst stateRef = React.useRef({\n\t\tpressed: false,\n\t\thandler: callback,\n\t})\n\n\tconst cb = React.useCallback(\n\t\t(gamepad: FramerGamepadKeydownData) => {\n\t\t\tconst { pressed, handler } = stateRef.current\n\t\t\tif (gamepad.inputs.includes(input) && settings.mapping === gamepad.mapping) {\n\t\t\t\tsettings.on === \"keydown\" && handler()\n\t\t\t\tstateRef.current.pressed = true\n\t\t\t} else if (pressed) {\n\t\t\t\tsettings.on === \"keyup\" && handler()\n\t\t\t\tstateRef.current.pressed = false\n\t\t\t}\n\t\t},\n\t\t[input, settings],\n\t)\n\n\tuseOnCurrentTargetChange((isInTarget, isOverlayed) => {\n\t\tconst isActive = isInTarget && !isOverlayed\n\t\tif (isActive) {\n\t\t\tcontext.register(cb)\n\t\t} else {\n\t\t\tcontext.unregister(cb)\n\t\t}\n\n\t\t// Unregister the callback when the screen unmounts. This is probably\n\t\t// unnecessary since we unregister the callback when the component\n\t\t// unmounts, but may catch instances where the screen is being unmounted\n\t\t// with AnimatePresence and hasn't yet been removed from the react tree.\n\t\treturn () => context.unregister(cb)\n\t}, [])\n\n\t// Unregister the callback when unmounted.\n\tReact.useEffect(() => {\n\t\treturn () => context.unregister(cb)\n\t}, [cb, context])\n\n\t// Maintain an up to date reference to the provided callback. This prevents\n\t// users from being forced to create a memoized callback with useCallback\n\t// and React refs.\n\tReact.useEffect(() => {\n\t\tstateRef.current.handler = callback\n\t}, [callback])\n}\n", "import React from \"react\"\nimport { useOnCurrentTargetChange } from \"../components/NavigationTargetContext.tsx\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\nimport { asRecord } from \"../utils/asRecord.ts\"\n\ninterface Modifiers {\n\taltKey: boolean\n\tctrlKey: boolean\n\tmetaKey: boolean\n\tshiftKey: boolean\n\t[key: string]: unknown\n}\n\ninterface Shortcut extends Modifiers {\n\tkey: string\n}\n\nconst modifierDefaults: Modifiers = {\n\taltKey: false,\n\tctrlKey: false,\n\tmetaKey: false,\n\tshiftKey: false,\n}\n\nfunction createShortcutDefinition(shortcut: string): Shortcut | undefined {\n\tconst keys = shortcut.split(\"+\")\n\tconst key = keys.pop()\n\n\tif (!key) return undefined\n\n\tconst modifiers: Partial<Modifiers> = {}\n\n\tfor (const modifier of keys) {\n\t\tmodifiers[`${modifier}Key`] = true\n\t}\n\n\treturn {\n\t\t...modifierDefaults,\n\t\t...modifiers,\n\t\tkey,\n\t}\n}\n\n/** @internal */\nexport function useHotkey(shortcut: string, callback: () => void) {\n\tconst inTarget = React.useRef<boolean>(true)\n\tconst shortcutDefinition = useConstant(() => createShortcutDefinition(shortcut))\n\n\tuseOnCurrentTargetChange((isCurrentTarget, isOverlayed) => {\n\t\tinTarget.current = isCurrentTarget && !isOverlayed\n\t\treturn () => (inTarget.current = false)\n\t})\n\n\tconst eventHandler = React.useCallback(\n\t\t(event: KeyboardEvent) => {\n\t\t\tif (!shortcutDefinition) return\n\t\t\tif (!inTarget.current) return\n\t\t\tif (!Object.keys(shortcutDefinition).every(key => shortcutDefinition[key] === asRecord(event)[key])) return\n\n\t\t\tevent.preventDefault()\n\t\t\tcallback()\n\t\t},\n\t\t[shortcutDefinition, callback],\n\t)\n\n\tReact.useEffect(() => {\n\t\tdocument.addEventListener(\"keydown\", eventHandler)\n\t\treturn () => document.removeEventListener(\"keydown\", eventHandler)\n\t}, [eventHandler])\n}\n", "import { useRouter } from \"../router/RouterContext.tsx\"\nimport { useIsOnFramerCanvas } from \"./useIsOnFramerCanvas.ts\"\n\n/**\n * A wrapper around the Router API to provide backwards compatibilty for\n * generated components that depend on the `useNavigate` export from \"framer\",\n * instead of the `useRoute` that is currently used\n *\n * @internal\n */\nexport function useNavigate() {\n\tconst { navigate } = useRouter()\n\tconst onCanvas = useIsOnFramerCanvas()\n\n\tif (!navigate) return () => {}\n\n\treturn (target: string) => {\n\t\tif (onCanvas) return\n\t\tnavigate(target)\n\t\t// Return false to prevent smart components from proceeding with their event execution.\n\t\treturn false\n\t}\n}\n", "// rules-of-hooks is disabled for this file so that we avoid calling pointless\n// useEffects on the framer canvas.\n/* eslint-disable react-hooks/rules-of-hooks */\nimport React from \"react\"\nimport { useOnCurrentTargetChange } from \"../components/NavigationTargetContext.tsx\"\nimport { isStaticRenderer } from \"./useIsStaticRenderer.ts\"\n\ntype CallbackMap = Record<string, (() => void) | undefined>\nfunction callbackForVariant(map: CallbackMap, variant: string) {\n\tif (map[variant]) return map[variant]\n\tif (variant in map) return undefined\n\treturn map.default\n}\n\n/**\n * Executes a callback when the base variant changes. Events will not be\n * executed on the Framer canvas.\n *\n * @public\n */\nexport function useOnVariantChange(variant: string, callbackMap: CallbackMap) {\n\tconst isRenderingStaticContent = isStaticRenderer()\n\tif (isRenderingStaticContent) return\n\n\t// It is safe to call hooks conditionally here because the check above will never change.\n\t// Disabled rule for file in biome.jsonc.\n\tconst isActiveScreenRef = React.useRef(true)\n\t// Prevent the callback map from unintentionally triggering useEffect calls.\n\tconst callbackMapRef = React.useRef(callbackMap)\n\n\tuseOnCurrentTargetChange((isCurrent, isOverlayed) => {\n\t\tconst isActiveScreen = isCurrent && !isOverlayed\n\t\tif (!isActiveScreenRef.current && isActiveScreen) {\n\t\t\tconst callback = callbackForVariant(callbackMapRef.current, variant)\n\t\t\tif (callback) callback()\n\t\t}\n\t\tisActiveScreenRef.current = isActiveScreen\n\t}, [])\n\n\tReact.useEffect(() => {\n\t\tif (isActiveScreenRef.current) {\n\t\t\tconst callback = callbackForVariant(callbackMapRef.current, variant)\n\t\t\tif (callback) callback()\n\t\t}\n\t}, [variant])\n}\n\n/**\n * A simplified version of useOnVariantChange, that takes a single callback,\n * cancelling it only if the navigation target changes.\n *\n * @internal\n */\nexport function useOnAppear(callback: () => void) {\n\tuseOnVariantChange(\"default\", { default: callback })\n}\n", "import { frame } from \"framer-motion\"\nimport React, { startTransition } from \"react\"\nimport { safeWindow } from \"../utils/safeWindow.ts\"\nimport { yieldToMain } from \"../utils/yield.ts\"\n\nfunction setOverflow(blockDocumentScrolling: boolean, show: boolean) {\n\tif (blockDocumentScrolling === false) return\n\n\t// Even if we yield before, we still want to make sure the DOM update happens at the end of the rAF queue,\n\t// so that if any other rAF reads from the DOM, it won't force a reflow (= which makes the operation more expensive).\n\tframe.render(() => {\n\t\tconst htmlStyle = document.documentElement.style\n\t\tif (show) {\n\t\t\thtmlStyle.setProperty(\"overflow\", \"hidden\")\n\t\t} else {\n\t\t\thtmlStyle.removeProperty(\"overflow\")\n\t\t}\n\t})\n}\n\n/**\n * When managing hiding/showing overlays, we want to prevent accidental body\n * scrolling beneath the overlay. This hook decorates a normal React useState\n * hook with solving this problem.\n *\n * Additionally, we allow the overlay to be dismissed by the escape key\n * when explicitly enabled.\n *\n * @public\n */\nexport function useOverlayState({\n\tblockDocumentScrolling = true,\n\tdismissWithEsc = false,\n}: { blockDocumentScrolling?: boolean; dismissWithEsc?: boolean } = {}): readonly [\n\tboolean,\n\t(show: boolean) => Promise<void>,\n] {\n\tconst [showOverlay, setShowOverlay] = React.useState(false)\n\n\tconst callback = React.useCallback(\n\t\tasync (show: boolean) => {\n\t\t\t// Await paint in response to user interaction to improve INP\n\t\t\tawait yieldToMain({ priority: \"user-blocking\", continueAfter: \"paint\" })\n\n\t\t\tstartTransition(() => setShowOverlay(show))\n\n\t\t\tsetOverflow(blockDocumentScrolling, show)\n\t\t},\n\t\t[blockDocumentScrolling],\n\t)\n\n\t// Ensure overflow is cleaned up when the hook is destroyed.\n\tReact.useEffect(\n\t\t() => () => {\n\t\t\t// Unmounting might happen in response to an user interaction, so we await the next paint\n\t\t\tvoid yieldToMain({ priority: \"user-blocking\", continueAfter: \"paint\" }).then(() => {\n\t\t\t\tsetOverflow(blockDocumentScrolling, false)\n\t\t\t})\n\t\t},\n\t\t[blockDocumentScrolling],\n\t)\n\n\t// Ensure the overlay is dismissed when the escape key is pressed.\n\tReact.useEffect(() => {\n\t\tif (!dismissWithEsc) return\n\n\t\tconst handleEscapeKeyDown = (event: KeyboardEvent) => {\n\t\t\tif (event.key !== \"Escape\") return\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\tvoid callback(false)\n\t\t}\n\n\t\tsafeWindow.addEventListener(\"keydown\", handleEscapeKeyDown)\n\t\treturn () => safeWindow.removeEventListener(\"keydown\", handleEscapeKeyDown)\n\t}, [dismissWithEsc, callback])\n\n\treturn [showOverlay, callback] as const\n}\n", "import type { Transition } from \"framer-motion\"\nimport React from \"react\"\nimport { useNavigation } from \"../components/useNavigation.ts\"\nimport { useRouter } from \"../router/RouterContext.tsx\"\nimport { isRoute } from \"../router/isRoute.ts\"\nimport type { ComponentWithPreload, Route, RouteComponent } from \"../router/types.ts\"\nimport { isObject, isString } from \"../utils/utils.ts\"\nimport { useIsOnFramerCanvas } from \"./useIsOnFramerCanvas.ts\"\n\n/**\n * @internal\n */\nexport interface NavigateOptions {\n\ttransition?: \"push\" | \"instant\" | \"fade\" | \"modal\" | \"overlay\" | \"flip\" | \"magicMotion\"\n\tappearsFrom?: \"left\" | \"right\" | \"top\" | \"bottom\"\n\tbackdropColor?: string\n\tanimation?: Transition\n}\n\ninterface Options {\n\t/**\n\t * useNavigate allows preloading targets of the calling component. These\n\t * targets can either be strings that are valid keys in the `routes` prop of\n\t * a wrapping Navigation component, or a React Component type reference.\n\t *\n\t * If the entry is a string, useNavigate will attempt to retrieve a\n\t * reference to a React component from the Navigation context.\n\t */\n\tpreload?: (string | RouteComponent)[]\n}\n\n/**\n * If it is a lazy import, we need to call React.createElement to ensure it is\n * mountable. The value returned from the router can either be a valid React\n * element, for instance if created with React.createElement or written in JSX,\n * or it can be a React.ComponentType, in which case we have to explicitly call\n * React.CreateElement before returning.\n */\nasync function componentForRoute(\n\troute: Route | undefined,\n\t// biome-ignore lint/suspicious/noExplicitAny: outdated component\n): Promise<React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined> {\n\tif (!isRoute(route)) return\n\tconst { page: routeComponent } = route\n\tif (!routeComponent) return\n\n\tif (React.isValidElement(routeComponent)) return routeComponent\n\n\tif (withPreload(routeComponent)) await routeComponent.preload()\n\n\t// @ts-expect-error to figure out how to type this properly, as tests are using different $$typeof symbol and\n\t// isValidElement fails\n\treturn React.createElement(routeComponent, { key: route.path })\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: outdated component\nconst preloadKey: keyof ComponentWithPreload<any> = \"preload\"\nexport function withPreload(component: unknown): component is ComponentWithPreload<React.ComponentType> {\n\treturn !!component && isObject(component) && preloadKey in component\n}\n\n/**\n * A relative duplicate of useNavigate from runtime to support navigation in\n * combined screens. Additionally supports a preload argument that allows target\n * screens that are lazy imported to be requested before they are navigated to.\n *\n * @internal\n */\nexport function usePrototypeNavigate({ preload }: Options = {}) {\n\tconst navigation = useNavigation()\n\tconst { getRoute } = useRouter()\n\tconst onCanvas = useIsOnFramerCanvas()\n\n\t// On mount, attempt to preload future navigation targets. If the target is\n\t// a route string, first retrieve the component for that route from the\n\t// routes context.\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: outdated component\n\tReact.useEffect(() => {\n\t\tif (!navigation || onCanvas) return\n\t\tpreload?.forEach(componentOrRoute => {\n\t\t\tlet component: RouteComponent | undefined\n\t\t\tif (isString(componentOrRoute)) {\n\t\t\t\tconst route = getRoute?.(componentOrRoute)\n\t\t\t\tif (isRoute(route)) {\n\t\t\t\t\tcomponent = route.page\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tcomponent = componentOrRoute\n\t\t\t}\n\t\t\tif (component && withPreload(component)) void component.preload()\n\t\t})\n\t}, [])\n\n\tif (!navigation) return () => {}\n\n\treturn async (target: React.ReactElement | string | \"previous\", options: NavigateOptions = {}) => {\n\t\tif (onCanvas) return\n\n\t\tif (target === \"previous\") {\n\t\t\tnavigation.goBack()\n\t\t\treturn false\n\t\t}\n\n\t\t// If we are navigating to a route by an id, retrieve the React\n\t\t// component, and ensure it is a React element.\n\t\tconst Component =\n\t\t\ttypeof target === \"string\"\n\t\t\t\t? await componentForRoute(getRoute?.(target)).catch(() => {}) // Swallow any errors.\n\t\t\t\t: React.isValidElement(target)\n\t\t\t\t\t? target\n\t\t\t\t\t: null\n\n\t\tif (!Component) return\n\n\t\tconst { appearsFrom, backdropColor, animation } = options\n\n\t\tconst transitionType = options.transition || \"instant\"\n\t\tswitch (transitionType) {\n\t\t\tcase \"instant\":\n\t\t\t\tnavigation.instant(Component)\n\t\t\t\tbreak\n\t\t\tcase \"fade\":\n\t\t\t\tnavigation.fade(Component, { animation })\n\t\t\t\tbreak\n\t\t\tcase \"push\":\n\t\t\t\tnavigation.push(Component, { appearsFrom, animation })\n\t\t\t\tbreak\n\t\t\tcase \"flip\":\n\t\t\t\tnavigation.flip(Component, { appearsFrom, animation })\n\t\t\t\tbreak\n\t\t\tcase \"magicMotion\":\n\t\t\t\tnavigation.magicMotion(Component, { animation })\n\t\t\t\tbreak\n\t\t\t// Overlay stack navigation doesn't support updating the browser's\n\t\t\t// path.\n\t\t\tcase \"modal\":\n\t\t\t\tnavigation.modal(Component, { backdropColor, animation })\n\t\t\t\tbreak\n\t\t\tcase \"overlay\":\n\t\t\t\tnavigation.overlay(Component, { appearsFrom, backdropColor, animation })\n\t\t\t\tbreak\n\t\t}\n\n\t\t// Return false to prevent smart components from proceeding with their event execution.\n\t\treturn false\n\t}\n}\n", "import { isObject } from \"../utils/utils.ts\"\nimport type { Route } from \"./types.ts\"\n\nconst key: keyof Route = \"page\"\n\n/**\n * @internal\n */\nexport function isRoute(route: unknown): route is Route {\n\treturn isObject(route) && key in route && route.page !== undefined\n}\n", "import { useMemo } from \"react\"\nimport type { Query } from \"../../modules/cms/types.ts\"\nimport { useQueryCount } from \"../../modules/useQueryData.ts\"\nimport { useLoadMorePagination } from \"./useLoadMorePagination.tsx\"\n\nexport function useLoadMorePaginatedQuery(query: Query, pageSize: number, hash: string) {\n\tconst count = useQueryCount(query)\n\n\tconst { paginationInfo, loadMore } = useLoadMorePagination(count, pageSize, hash, true)\n\n\tconst paginatedQuery = useMemo<Query>(() => {\n\t\tlet limit = pageSize * paginationInfo.currentPage\n\n\t\tif (query.limit) {\n\t\t\tif (query.limit.type !== \"LiteralValue\" || typeof query.limit.value !== \"number\") {\n\t\t\t\tthrow new Error(\"Unexpected type for query limit\")\n\t\t\t}\n\t\t\tlimit = Math.min(limit, query.limit.value)\n\t\t}\n\n\t\treturn { ...query, limit: { type: \"LiteralValue\", value: limit } }\n\t}, [query, pageSize, paginationInfo])\n\n\treturn { paginatedQuery, paginationInfo, loadMore }\n}\n", "import { startTransition, useCallback, useEffect, useMemo, useRef, useState, useTransition } from \"react\"\nimport { useIsOnFramerCanvas } from \"../../modules/useIsOnFramerCanvas.ts\"\nimport { pushLoadMoreHistory } from \"../../router/history.ts\"\nimport type { PaginationInfo } from \"../../router/types.ts\"\nimport { yieldToMain } from \"../../utils/yield.ts\"\nimport type { UseInfiniteScrollProps } from \"../Pagination/InfiniteScroll.tsx\"\n\nexport function useLoadMorePagination(\n\ttotalSize: number,\n\tpageSize: number,\n\thash: string,\n\tpaginateWithSuspendedLoadingState: boolean = false,\n): {\n\tpaginationInfo: PaginationInfo\n\tloadMore: UseInfiniteScrollProps[\"loadMore\"]\n} {\n\tconst [isPending, startLoadingTransition] = useTransition()\n\tconst totalPages = Math.ceil(totalSize / pageSize)\n\n\tconst [currentPage, setCurrentPage] = useState<number>(\n\t\tglobalThis?.history?.state?.paginationInfo?.[hash]?.currentPage ?? 1,\n\t)\n\t// The ref is used to prevent a race-condition, where `loadMore` is called before the component\n\t// unsuspends, because React would discard the render and re-start the transition if state is\n\t// set during the transition.\n\t// This prevents a loop if `setCurrentPage(maxPage)` is called multiple times.\n\tconst currentPageRef = useRef<number>(currentPage)\n\n\tconst paginationInfo = useMemo<PaginationInfo>(() => {\n\t\treturn {\n\t\t\tcurrentPage,\n\t\t\ttotalPages,\n\t\t\tisLoading: isPending,\n\t\t}\n\t}, [currentPage, totalPages, isPending])\n\n\tuseEffect(() => {\n\t\tpushLoadMoreHistory(hash, paginationInfo)\n\t}, [hash, paginationInfo])\n\n\tconst onCanvas = useIsOnFramerCanvas()\n\tconst loadMore = useCallback(async () => {\n\t\tif (onCanvas) return\n\t\tif (currentPageRef.current >= totalPages) return\n\n\t\t// Await next paint before doing more stuff -> improves INP\n\t\tawait yieldToMain({ priority: \"user-blocking\", continueAfter: \"paint\" })\n\t\tif (currentPageRef.current >= totalPages) return // check again after yielding\n\n\t\tconst renderNextPage = (startTransition: typeof startLoadingTransition) => {\n\t\t\tstartTransition(() => {\n\t\t\t\tsetCurrentPage(_currentPage => {\n\t\t\t\t\tconst nextPage = Math.min(_currentPage + 1, totalPages)\n\t\t\t\t\tcurrentPageRef.current = nextPage\n\t\t\t\t\treturn nextPage\n\t\t\t\t})\n\t\t\t})\n\t\t}\n\n\t\t// We explicitly don't use `startLoadingTransition` here, because we can skip the `isPending` update when not using Suspense.\n\t\tif (!paginateWithSuspendedLoadingState) return renderNextPage(startTransition)\n\t\treturn renderNextPage(startLoadingTransition)\n\t}, [totalPages, paginateWithSuspendedLoadingState])\n\n\treturn { paginationInfo, loadMore }\n}\n", "import type { TapHandlers, Transition } from \"framer-motion\"\nimport { type DOMAttributes, startTransition, useCallback, useContext, useEffect, useMemo, useRef } from \"react\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\nimport { assert } from \"../utils/assert.ts\"\nimport { isBot } from \"../utils/utils.ts\"\nimport { yieldToMain } from \"../utils/yield.ts\"\nimport { useLibraryFeatures } from \"./LibraryFeaturesContext.ts\"\nimport { cx } from \"./cx.ts\"\nimport type { VariantProps } from \"./useAddVariantProps.ts\"\nimport { useAddVariantProps } from \"./useAddVariantProps.ts\"\nimport { useForceUpdate } from \"./useForceUpdate.ts\"\nimport { useIsOnFramerCanvas } from \"./useIsOnFramerCanvas.ts\"\nimport { SharedIntersectionObserverContext, observeElement } from \"./useSharedIntersectionObserver.ts\"\n\nfunction createGestureVariant(variant: string, type: \"hover\" | \"pressed\" | \"loading\" | \"error\") {\n\treturn `${variant}-${type}`\n}\n\nfunction nextVariant(allVariants: string[], currentVariant: string): string {\n\tconst index = allVariants.indexOf(currentVariant)\n\tlet nextIndex = index + 1\n\tif (nextIndex >= allVariants.length) {\n\t\tnextIndex = 0\n\t}\n\t// We ensure the index could not go out of bound with the code above, the\n\t// assert here is just to appease Typescript.\n\tconst nextVariant = allVariants[nextIndex]\n\tassert(nextVariant !== undefined, \"nextVariant should be defined\")\n\treturn nextVariant\n}\n\nfunction activeTransition(transitions: Record<string, Partial<Transition>> | undefined, variant: string) {\n\tif (!transitions) return undefined\n\n\tif (variant) {\n\t\tconst variantTransition = transitions[variant]\n\t\tif (variantTransition) return variantTransition\n\t}\n\n\treturn transitions.default\n}\n\ntype GestureState = Partial<{\n\tisHovered: boolean\n\tisPressed: boolean\n\tisLoading: boolean\n\tisError: boolean\n}>\n\n// EnabledGestures and EnabledVariantGestures are mirrored from Framer in VariantsStore.ts\ninterface EnabledGestures {\n\thover: boolean\n\tpressed: boolean\n\tloading: boolean\n\terror: boolean\n}\n\nexport type GestureHandlers = Pick<\n\tTapHandlers & DOMAttributes<HTMLDivElement>,\n\t\"onTap\" | \"onTapStart\" | \"onTapCancel\" | \"onMouseEnter\" | \"onMouseLeave\"\n>\n\ntype EnabledVariantGestures = Record<string, EnabledGestures>\ntype VariantNames = string[]\ninterface VariantState {\n\tvariants: VariantNames\n\tbaseVariant: string | undefined\n\tgestureVariant: string | undefined\n\tclassNames: string\n\ttransition: Partial<Transition> | undefined\n\tgestureHandlers: GestureHandlers\n\tsetVariant: (variant: string | typeof CycleVariantState, pauseOffscreen?: boolean) => void\n\tsetGestureState: (gestureState: GestureState) => void\n\tclearLoadingGesture: () => void\n\taddVariantProps?: (id: string) => Record<string, unknown>\n}\n\n/**\n * @internal\n */\nexport const enum VariantSelector {\n\tVariant = \"v\",\n}\n\nfunction getGesture(\n\tenabledGestures: EnabledGestures | undefined,\n\tisHovered: boolean,\n\tisPressed: boolean,\n\tisLoading: boolean,\n\tisError: boolean,\n): \"hover\" | \"pressed\" | \"loading\" | \"error\" | undefined {\n\tconst { hover, pressed, loading, error } = enabledGestures || {}\n\tif (error && isError) return \"error\"\n\tif (loading && isLoading) return \"loading\"\n\tif (pressed && isPressed) return \"pressed\"\n\tif (hover && isHovered) return \"hover\"\n}\n\nfunction createVariantClassName(baseVariant: string, variantClassNames: Record<string, string>) {\n\tconst mappedClassName = variantClassNames[baseVariant]\n\tif (mappedClassName) return mappedClassName\n\n\treturn `framer-${VariantSelector.Variant}-${baseVariant}`\n}\n\nfunction safeBaseVariant(targetVariant: string | undefined, fallbackVariant: string, validBaseVariants: Set<string>) {\n\tif (!targetVariant) return fallbackVariant\n\tif (validBaseVariants.has(targetVariant)) return targetVariant\n\treturn fallbackVariant\n}\n\ninterface InternalState {\n\tisHovered: boolean\n\tisHoveredHasUpdated: boolean\n\tisPressed: boolean\n\tisPressedHasUpdated: boolean\n\tisError: boolean\n\thasPressedVariants: boolean\n\tbaseVariant: string\n\tdefaultVariant: string\n\tlastVariant?: string\n\tgestureVariant?: string\n\tenabledGestures?: EnabledVariantGestures\n\tcycleOrder?: string[]\n\ttransitions?: Record<string, Partial<Transition>>\n\tloadedBaseVariant: Record<string, boolean>\n}\n\n/**\n * Flag setVariantState as cycling variants.\n * @public\n */\nexport const CycleVariantState = /* @__PURE__ */ Symbol(\"cycle\")\n\n/**\n * Runs the specified callback if the page is visible. If not, it will wait until the page becomes visible.\n */\nfunction useRunCallbackIfPageIsVisible(): (callback: VoidFunction) => void {\n\tconst listenerRef = useRef<() => void>()\n\tconst callbackRef = useRef<VoidFunction>()\n\n\tconst clean = useCallback(() => {\n\t\tif (!listenerRef.current) return\n\t\tdocument.removeEventListener(\"visibilitychange\", listenerRef.current)\n\t\tlistenerRef.current = undefined\n\t\tcallbackRef.current = undefined\n\t}, [])\n\n\tuseEffect(() => {\n\t\t// cleanup effect for the event listener\n\t\treturn () => {\n\t\t\tclean()\n\t\t}\n\t}, [clean])\n\n\treturn useCallback(\n\t\tcallback => {\n\t\t\tif (!document.hidden) {\n\t\t\t\tcallback()\n\t\t\t\tclean()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tcallbackRef.current = callback // update the callback\n\t\t\tif (listenerRef.current) return // Don't add duplicate listeners\n\n\t\t\tconst listenerFn = () => {\n\t\t\t\tif (document.hidden) return\n\t\t\t\tcallbackRef.current?.()\n\t\t\t\tclean()\n\t\t\t}\n\t\t\tlistenerRef.current = listenerFn\n\t\t\tdocument.addEventListener(\"visibilitychange\", listenerFn)\n\t\t},\n\t\t[clean],\n\t)\n}\n\n/**\n * Runs the specified callback if the element is in view. If not, it will wait until the element comes into view.\n */\nfunction useRunCallbackIfElementIsInView(): (callback: VoidFunction, ref: React.RefObject<HTMLElement>) => void {\n\tconst observerRefCleanup = useRef<() => void>()\n\tconst isInViewRef = useRef(false)\n\tconst callbackRef = useRef<VoidFunction>()\n\tconst observers = useContext(SharedIntersectionObserverContext)\n\n\tuseEffect(() => {\n\t\treturn () => {\n\t\t\tobserverRefCleanup.current?.()\n\t\t\tcallbackRef.current = undefined\n\t\t\tobserverRefCleanup.current = undefined\n\t\t}\n\t}, [])\n\n\treturn useCallback(\n\t\t(callback, ref) => {\n\t\t\tif (!ref?.current || isInViewRef.current) {\n\t\t\t\t// we don't have a ref (yet) or the ref is visible, so we can just call the callback immediately\n\t\t\t\tcallback()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tcallbackRef.current = callback // update the callback\n\n\t\t\t// observer exists already\n\t\t\tif (observerRefCleanup.current) return\n\n\t\t\t// By observing the element only when `setVariant` is called,\n\t\t\t// we avoid some overhead of observing potentially 1000s of elements initially.\n\t\t\tlet queuedMicrotask = false\n\t\t\tconst observerCallback = (entry: IntersectionObserverEntry) => {\n\t\t\t\tisInViewRef.current = entry.isIntersecting\n\n\t\t\t\t// when rapidly scrolling, the entries can contain multiple intersection states\n\t\t\t\t// we want the last one to 'win' (= be the one that determines if the element is in view)\n\t\t\t\tif (queuedMicrotask) return\n\t\t\t\tqueuedMicrotask = true\n\n\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\tqueuedMicrotask = false\n\n\t\t\t\t\tif (!isInViewRef.current) return\n\t\t\t\t\tcallbackRef.current?.()\n\t\t\t\t})\n\t\t\t}\n\n\t\t\t// \"undefined\" is the key the entry where no root margin has been passed -> all elements that have no root margin share that observer.\n\t\t\t// null is the document root.\n\t\t\tobserverRefCleanup.current = observeElement(observers, \"undefined\", ref.current, null, observerCallback)\n\t\t},\n\t\t[observers],\n\t)\n}\n\nfunction useUpdateIfVisible(ref?: React.RefObject<HTMLElement>) {\n\tconst runUpdateIfPageIsVisible = useRunCallbackIfPageIsVisible()\n\tconst runUpdateIfElementIsInView = useRunCallbackIfElementIsInView()\n\n\treturn useCallback(\n\t\t(callback: VoidFunction, checkViewport = false) => {\n\t\t\tif (isBot) {\n\t\t\t\t// don't intercept variant updates for bots.\n\t\t\t\tcallback()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst runUpdate = checkViewport && ref ? () => runUpdateIfElementIsInView(callback, ref) : callback\n\t\t\trunUpdateIfPageIsVisible(runUpdate)\n\t\t},\n\t\t[runUpdateIfPageIsVisible, runUpdateIfElementIsInView, ref],\n\t)\n}\n\nlet globalWaitingForClickPromise: Promise<void> | undefined\nlet globalWaitingForClickResolve: (() => void) | undefined\n\nasync function getPromiseWithFallback() {\n\treturn new Promise<void>(resolve => {\n\t\tlet resolveFn: (() => void) | undefined = resolve\n\t\t// Safety fallback in case `click` never fires, where 150ms ensures the delay isn't noticeable by users\n\t\t// TODO: Add a log here when `yieldOnTap` ships to stable, so we understand how often this occurs.\n\t\tsetTimeout(() => {\n\t\t\tif (!resolveFn) return\n\t\t\tperformance.mark(\"wait-for-click-fallback\")\n\t\t\tresolveFn()\n\t\t}, 150)\n\n\t\tglobalWaitingForClickResolve = () => {\n\t\t\tresolve()\n\t\t\tresolveFn = undefined\n\t\t}\n\t})\n}\n\nfunction globalWaitForClickListener(event: PointerEvent) {\n\tif (event.button === 0 /* primary / left mouse button */) {\n\t\t// Only after a left mouse button click (or any pointer up on mobile), a `click` event will fire.\n\t\t// So we only want to set `globalWaitingForClick` to `true` in that case.\n\t\tperformance.mark(\"pointerdown-listener\")\n\t\tglobalWaitingForClickPromise = getPromiseWithFallback()\n\t}\n}\n\nfunction globalClickReceivedListener() {\n\tperformance.mark(\"click-received-listener\")\n\tglobalWaitingForClickPromise = undefined\n\tglobalWaitingForClickResolve?.()\n\tglobalWaitingForClickResolve = undefined\n}\n\nfunction useWaitForGlobalClick(enabled = false) {\n\t// TODO: Make this a non-react-hook when `yieldOnTap` ships to stable, so we can skip the `useEffect` calls after initializing once.\n\tuseEffect(() => {\n\t\tif (!enabled) return\n\n\t\tdocument.addEventListener(\"pointerup\", globalWaitForClickListener, true)\n\t\t// @ts-expect-error TS(2339): We use `__proto__` here to bypass any overrides of the global `addEventListener` function (like from GTM).\n\t\tdocument.__proto__.addEventListener.call(document, \"click\", globalClickReceivedListener, true)\n\n\t\t// No cleanup, as those listeners should stay active for the lifetime of the page.\n\t\t// If one unmounting component would remove them, another component might still need them (= results in a bug).\n\t}, [enabled])\n}\n\n/**\n * Handle stateful logic in Framer Canvas Components.\n *\n * @public\n */\nexport function useVariantState({\n\tvariant,\n\tdefaultVariant: externalDefaultVariant,\n\ttransitions: externalTransitions,\n\tenabledGestures: externalEnabledGestures,\n\tcycleOrder: externalCycleOrder = [],\n\tvariantProps = {},\n\tvariantClassNames = {},\n\tref,\n}: {\n\tdefaultVariant: string\n\tcycleOrder: string[]\n\tvariant?: string\n\ttransitions?: Record<string, Partial<Transition>>\n\tenabledGestures?: EnabledVariantGestures\n\tvariantProps?: VariantProps\n\tvariantClassNames?: Record<string, string>\n\tref?: React.RefObject<HTMLElement>\n}): VariantState {\n\tconst forceUpdate = useForceUpdate()\n\tconst isCanvas = useIsOnFramerCanvas()\n\tconst validBaseVariants = useConstant(() => new Set(externalCycleOrder))\n\tconst { yieldOnTap: yieldOnTapFeatureOn } = useLibraryFeatures()\n\tuseWaitForGlobalClick(yieldOnTapFeatureOn)\n\n\tconst runUpdateIfVisible = useUpdateIfVisible(ref)\n\n\tconst internalState = useRef<InternalState>({\n\t\tisHovered: false,\n\t\tisHoveredHasUpdated: false,\n\t\tisPressed: false,\n\t\tisPressedHasUpdated: false,\n\t\tisError: false,\n\t\thasPressedVariants: true,\n\t\tbaseVariant: safeBaseVariant(variant, externalDefaultVariant, validBaseVariants),\n\t\tlastVariant: variant,\n\t\tgestureVariant: undefined,\n\t\tloadedBaseVariant: {},\n\n\t\t// When used in generated components, these are static values defined\n\t\t// outside of the component function that also need to not result in\n\t\t// memorized values being recalculated, so we dump them into the ref.\n\t\tdefaultVariant: externalDefaultVariant,\n\t\tenabledGestures: externalEnabledGestures,\n\t\tcycleOrder: externalCycleOrder,\n\t\ttransitions: externalTransitions,\n\t})\n\n\tconst resolveNextVariant = useCallback((targetBaseVariant: string | undefined): [string, string | undefined] => {\n\t\tconst { isHovered, isPressed, isError, enabledGestures, defaultVariant } = internalState.current\n\n\t\tconst nextBaseVariant = safeBaseVariant(targetBaseVariant, defaultVariant, validBaseVariants)\n\t\tconst gesture = getGesture(enabledGestures?.[nextBaseVariant], isHovered, isPressed, false, isError)\n\t\tconst nextGestureVariant = gesture ? createGestureVariant(nextBaseVariant, gesture) : undefined\n\n\t\treturn [nextBaseVariant, nextGestureVariant]\n\t}, [])\n\n\tconst updateIfNeeded = useCallback(\n\t\tasync (\n\t\t\tbaseVariant: string | undefined,\n\t\t\tgestureVariant: string | undefined,\n\t\t\tdefaultVariant: string,\n\t\t\tnextBaseVariant: string | undefined,\n\t\t\tcheckViewport = false,\n\t\t\tclearError = false,\n\t\t) => {\n\t\t\tconst [nextBase, nextGesture] = resolveNextVariant(nextBaseVariant)\n\n\t\t\t// Only force a render if the new active variants have changed\n\t\t\tif (nextBase === baseVariant && nextGesture === gestureVariant) return\n\n\t\t\tif (clearError) internalState.current.isError = false\n\t\t\tinternalState.current.baseVariant = nextBase || defaultVariant\n\t\t\tinternalState.current.gestureVariant = nextGesture\n\n\t\t\tconst yieldOnTap = yieldOnTapFeatureOn && internalState.current.isPressedHasUpdated\n\n\t\t\tif (yieldOnTap && globalWaitingForClickPromise) {\n\t\t\t\tperformance.mark(\"wait-for-tap-start\")\n\t\t\t\t// If `isPress` has updated and we've received a pointerup event, we know a click event is imminent.\n\t\t\t\t// To optimize INP, we do nothing until the click event - even a React transition would not suffice\n\t\t\t\t// as motion runs expensive synchronous stuff when we `forceUpdate`: https://framer-team.slack.com/archives/C08292HA17Z/p1745935667452839\n\t\t\t\tawait globalWaitingForClickPromise\n\t\t\t\tperformance.measure(\"wait-for-tap\", \"wait-for-tap-start\")\n\t\t\t}\n\n\t\t\tif (yieldOnTap) {\n\t\t\t\tperformance.mark(\"yield-on-tap-start\")\n\t\t\t\t// We still want to yield here to improve INP on any press interaction (pointerdown/pointerup/click)\n\t\t\t\t// user-blocking, because we want to potentially start the React transition asap\n\t\t\t\tawait yieldToMain({ priority: \"user-blocking\", continueAfter: \"paint\" })\n\t\t\t\tperformance.measure(\"yield-on-tap\", \"yield-on-tap-start\")\n\t\t\t}\n\n\t\t\tconst { isHovered, isPressed, isHoveredHasUpdated, isPressedHasUpdated } = internalState.current\n\n\t\t\t// If the component is hovered or pressed, we don't need to check for visibility\n\t\t\tif (isHovered || isHoveredHasUpdated || isPressed || isPressedHasUpdated) {\n\t\t\t\tstartTransition(forceUpdate)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// If the tab/element isn't visible, we wait until it is visible again before doing the update.\n\t\t\t// We still accept calls to `updateIfNeeded` and we de-dupe the update calls in the hooks.\n\t\t\t// This ensures the last update wins, similar to how React's transitions work (transitions are batched by time, not by visibility).\n\t\t\t// Avoiding updates reduces CPU & GPU and prevents memory leaks due to queued\n\t\t\t// requestAnimationFrames (from motion effects) that don't run when the tab is in background.\n\t\t\trunUpdateIfVisible(() => startTransition(forceUpdate), checkViewport)\n\t\t},\n\t\t[resolveNextVariant, forceUpdate, runUpdateIfVisible, yieldOnTapFeatureOn],\n\t)\n\n\tconst setGestureState: VariantState[\"setGestureState\"] = useCallback(\n\t\t({ isHovered, isPressed, isError }) => {\n\t\t\tconst isPressedHasUpdated = isPressed !== internalState.current.isPressed\n\t\t\tconst isHoveredHasUpdated = isHovered !== internalState.current.isHovered\n\t\t\tif (isHovered !== undefined) internalState.current.isHovered = isHovered\n\t\t\tif (isPressed !== undefined) internalState.current.isPressed = isPressed\n\t\t\tif (isError !== undefined) internalState.current.isError = isError\n\n\t\t\tconst { baseVariant, gestureVariant, defaultVariant } = internalState.current\n\n\t\t\tinternalState.current.isPressedHasUpdated = isPressedHasUpdated\n\t\t\tinternalState.current.isHoveredHasUpdated = isHoveredHasUpdated\n\t\t\tvoid updateIfNeeded(baseVariant, gestureVariant, defaultVariant, baseVariant, false)\n\t\t},\n\t\t[updateIfNeeded],\n\t)\n\n\tconst setVariant: VariantState[\"setVariant\"] = useCallback(\n\t\t(proposedVariant?: typeof CycleVariantState | string, pauseOffscreen = false) => {\n\t\t\tconst { defaultVariant, cycleOrder, baseVariant, gestureVariant } = internalState.current\n\t\t\tconst nextBaseVariant =\n\t\t\t\tproposedVariant === CycleVariantState\n\t\t\t\t\t? nextVariant(cycleOrder || [], baseVariant || defaultVariant)\n\t\t\t\t\t: proposedVariant\n\n\t\t\tvoid updateIfNeeded(baseVariant, gestureVariant, defaultVariant, nextBaseVariant, pauseOffscreen, true)\n\t\t},\n\t\t[updateIfNeeded],\n\t)\n\n\tconst clearLoadingGesture: VariantState[\"clearLoadingGesture\"] = useCallback(() => {\n\t\tconst { baseVariant } = internalState.current\n\t\tinternalState.current.loadedBaseVariant[baseVariant] = true\n\n\t\t// Clearing the loading state is always a low priority update as there is no user interaction that can cause it.\n\t\trunUpdateIfVisible(() => startTransition(forceUpdate), true)\n\t}, [forceUpdate, runUpdateIfVisible])\n\n\tif (variant !== internalState.current.lastVariant) {\n\t\tconst [nextBase, nextGesture] = resolveNextVariant(variant)\n\t\tinternalState.current.lastVariant = nextBase\n\t\tif (nextBase !== internalState.current.baseVariant || nextGesture !== internalState.current.gestureVariant) {\n\t\t\tinternalState.current.baseVariant = nextBase\n\t\t\tinternalState.current.gestureVariant = nextGesture\n\t\t}\n\t}\n\n\tconst {\n\t\tbaseVariant,\n\t\tgestureVariant,\n\t\tdefaultVariant,\n\t\tenabledGestures,\n\t\tisHovered,\n\t\tisPressed,\n\t\tisError,\n\t\tloadedBaseVariant,\n\t} = internalState.current\n\n\t// Backwards compatibility for old components generated before\n\t// addVariantProps was extracted to it's own hook.\n\tconst addVariantProps: VariantState[\"addVariantProps\"] = useAddVariantProps(\n\t\tinternalState.current.baseVariant,\n\t\tinternalState.current.gestureVariant,\n\t\tvariantProps,\n\t)\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: @TODO should `isError` be a dependency?\n\treturn useMemo<VariantState>(() => {\n\t\tconst variants: VariantNames = []\n\n\t\tif (baseVariant !== defaultVariant) variants.push(baseVariant)\n\n\t\tconst hasLoadingVariant = enabledGestures?.[baseVariant]?.loading\n\t\tconst isLoading = !isError && !isCanvas && !!hasLoadingVariant && !loadedBaseVariant[baseVariant]\n\t\tconst gesture = isLoading ? createGestureVariant(baseVariant, \"loading\") : gestureVariant\n\t\tif (gesture) variants.push(gesture)\n\n\t\tconst gestures = enabledGestures?.[baseVariant]\n\t\tconst gestureHandlers: GestureHandlers = {\n\t\t\tonMouseEnter: () => setGestureState({ isHovered: true }),\n\t\t\tonMouseLeave: () => setGestureState({ isHovered: false }),\n\t\t}\n\n\t\t// Only assign pressed gestures if the gesture is enabled for the\n\t\t// current base variant. This avoids motion automatically adding\n\t\t// tabIndex to the element.\n\t\tif (gestures?.pressed) {\n\t\t\tObject.assign(gestureHandlers, {\n\t\t\t\tonTapStart: () => setGestureState({ isPressed: true }),\n\t\t\t\tonTapCancel: () => setGestureState({ isPressed: false }),\n\t\t\t\tonTap: () => setGestureState({ isPressed: false }),\n\t\t\t})\n\t\t}\n\n\t\treturn {\n\t\t\tvariants,\n\t\t\tbaseVariant,\n\t\t\tgestureVariant: gesture,\n\t\t\tisLoading,\n\t\t\ttransition: activeTransition(internalState.current.transitions, baseVariant),\n\t\t\tsetVariant,\n\t\t\tsetGestureState,\n\t\t\tclearLoadingGesture,\n\t\t\taddVariantProps,\n\t\t\tgestureHandlers,\n\t\t\tclassNames: cx(\n\t\t\t\tcreateVariantClassName(baseVariant, variantClassNames),\n\t\t\t\tgetGesture(gestures, isHovered, isPressed, isLoading, isError),\n\t\t\t),\n\t\t}\n\t}, [\n\t\tbaseVariant,\n\t\tgestureVariant,\n\t\tisHovered,\n\t\tisPressed,\n\t\tloadedBaseVariant,\n\t\taddVariantProps,\n\t\tsetVariant,\n\t\tdefaultVariant,\n\t\tenabledGestures,\n\t\tsetGestureState,\n\t\tclearLoadingGesture,\n\t\tvariantClassNames,\n\t])\n}\n", "import { isString } from \"../utils/utils.ts\"\n\nconst reUnsafeCharacters = /[}{<>&;]/u\nexport function safeCSSValue(value: unknown): string | \"none\" {\n\t// Return \"none\" for invalid types\n\tif (!isString(value)) return \"none\"\n\n\t// Check for unsafe characters\n\tif (reUnsafeCharacters.test(value)) return \"none\"\n\n\t// Return only safe strings\n\treturn value\n}\n", "import type { ComponentType, ForwardedRef } from \"react\"\n// The React import is required by TypeScript: https://typescript.tv/errors/#ts2686\nimport React from \"react\"\nimport { useLibraryFeatures } from \"../LibraryFeaturesContext.ts\"\nimport { NodeIdContext } from \"../NodeIdContext.tsx\"\nimport { CodeComponentBoundary } from \"./CodeComponentBoundary.tsx\"\nimport { useNearestExternalComponent } from \"./ExternalComponentContext.tsx\"\nimport { collectErrorToAnalytics } from \"./collectErrorToAnalytics.tsx\"\nimport { getErrorMessageForOverride } from \"./errorMessages.ts\"\nimport { logError } from \"./logger.ts\"\nimport { shouldEnableCodeBoundaries } from \"./shouldEnableCodeBoundaries.ts\"\nimport { shouldWrapOverrideWithBoundary } from \"./shouldWrapWithBoundary.ts\"\n\ntype OverrideType<Props> = (Component: ComponentType<Props>) => ComponentType<Props>\n\nexport interface WithCodeBoundaryForOverridesParams<Props> {\n\toverride: OverrideType<Props>\n\t/** The ID of the scope (web page or smart component) where the override is applied. */\n\tscopeId: string\n\t/** The ID of the node that is wrapped with the override. */\n\tnodeId: string\n\t/** Whether the component is inside another component\u2019s slot. (Undefined if false.) */\n\tinComponentSlot?: true\n}\n\n/**\n * A code boundary for code overrides. Ensures any errors thrown by overrides\n * (either during SSR, or during client render) don\u2019t crash the whole page \u2013 and, instead,\n * just disable the override.\n *\n * Unlike code components (which might only throw during rendering), a code override might throw\n * in several situations:\n *\n * 1) in the override HOC:\n *\n *    ```tsx\n *    const withBlue = (Component) => {\n *      doSomething() // this throws\n *      return (props) => <Component {...props} color=\"blue\" />\n *    }\n *    ```\n *\n * 2) in the component created by the override:\n *\n *    ```tsx\n *    const withBlue = (Component) => {\n *      return (props) => {\n *        doSomething() // this throws\n *        return <Component {...props} color=\"blue\" />\n *      }\n *    }\n *    ```\n *\n * This means we have to try/catch both when applying the override, and when rendering the overridden component.\n */\nexport function withCodeBoundaryForOverrides<Props extends object>(\n\tComponent: ComponentType<Props>,\n\t{ scopeId, nodeId, override, inComponentSlot }: WithCodeBoundaryForOverridesParams<Props>,\n) {\n\tif (!shouldEnableCodeBoundaries()) {\n\t\treturn override(Component)\n\t}\n\n\t// If an override fails during the application time, we can\u2019t throw the error just yet.\n\t// That\u2019s because we don\u2019t know what exactly must be disabled in response to the error:\n\t// - only this override,\n\t// - or the whole external component that the override is inside of (https://www.notion.so/framer/Code-Boundaries-153adf6e8c96803dbd27ffe5cfd1e874?pvs=4#153adf6e8c96801d8a0ee6a7f7a3670f)\n\t//\n\t// Thus, we store the error and throw it only when the override is actually rendered.\n\tconst appliedOverride = tryToApplyOverride(Component, override)\n\n\tlet hasErrorBeenLogged = false\n\n\tfunction CodeBoundaryForOverrides(props: Props, ref: ForwardedRef<unknown>) {\n\t\tconst { disableCustomCode } = useLibraryFeatures()\n\t\tconst nearestExternalComponent = useNearestExternalComponent()\n\n\t\t// FIXME(upcoming debug mode): this will still execute some override code (in tryToApplyOverride) even if disableCustomCode is true\n\t\tif (disableCustomCode) {\n\t\t\treturn <Component {...props} ref={ref} />\n\t\t}\n\n\t\tconst shouldWrapWithBoundary = shouldWrapOverrideWithBoundary(\n\t\t\tscopeId,\n\t\t\tnearestExternalComponent?.scopeId,\n\t\t\tnearestExternalComponent?.level,\n\t\t\tinComponentSlot ?? false,\n\t\t)\n\n\t\t// If the override should be wrapped in a code boundary, do that:\n\t\t// - if it was applied successfully, return the overridden component wrapped in a code boundary\n\t\t// - if it failed, act as a code boundary and log the error\n\t\tif (shouldWrapWithBoundary) {\n\t\t\tif (appliedOverride.status === \"success\") {\n\t\t\t\t// \u201CShouldn\u2019t the fallback also be wrapped in the CodeComponentBoundary, in case it\u2019s a code component\n\t\t\t\t// that also throws?\u201D, you ask. \u201CNo,\u201D I answer, because if Component is a code component that might throw,\n\t\t\t\t// then this whole wrapper is already wrapped in a CodeComponentBoundary.\n\t\t\t\t//\n\t\t\t\t// That is, as of Nov 2024, codegen for code components that also have overrides looks like this:\n\t\t\t\t//\n\t\t\t\t//   import { CodeComponent } from \"../codeFile/CodeComponent.tsx\";\n\t\t\t\t//\n\t\t\t\t//   // Apply the override:\n\t\t\t\t//   const CodeComponentWithCodeBoundaryForOverridesAbc123 =\n\t\t\t\t//     withCodeBoundaryForOverrides(CodeComponent, ...);\n\t\t\t\t//\n\t\t\t\t//   ...\n\t\t\t\t//\n\t\t\t\t//   // Render the component:\n\t\t\t\t//   <Container> {/* \u2190 This wrapper part contains another code boundary */}\n\t\t\t\t//     <CodeComponentWithCodeBoundaryForOverridesAbc123 /> {/* \u2190 This is where the code boundary from withCodeBoundaryForOverrides lives */}\n\t\t\t\t//   </Container>\n\t\t\t\t//\n\t\t\t\t// which means the code boundary in Container will catch any errors thrown by the fallback Component.\n\t\t\t\treturn (\n\t\t\t\t\t<NodeIdContext.Provider value={nodeId}>\n\t\t\t\t\t\t<CodeComponentBoundary\n\t\t\t\t\t\t\tgetErrorMessage={getErrorMessageForOverride.bind(null, scopeId, nodeId)}\n\t\t\t\t\t\t\tfallback={<Component {...props} ref={ref} />}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<appliedOverride.Component {...props} ref={ref} />\n\t\t\t\t\t\t</CodeComponentBoundary>\n\t\t\t\t\t</NodeIdContext.Provider>\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tif (!hasErrorBeenLogged) {\n\t\t\t\t\tlogError(appliedOverride.error)\n\t\t\t\t\tlogError(getErrorMessageForOverride(scopeId, nodeId))\n\t\t\t\t\tcollectErrorToAnalytics(appliedOverride.error)\n\t\t\t\t\thasErrorBeenLogged = true\n\t\t\t\t}\n\n\t\t\t\treturn <Component {...props} ref={ref} />\n\t\t\t}\n\t\t}\n\n\t\t// If the override shouldn\u2019t be wrapped in a code boundary, then\n\t\t// - if it was applied successfully, return the overridden component without a code boundary\n\t\t// - if it failed, throw the error and let the parent (external smart component\u2019s) code boundary handle it\n\t\telse {\n\t\t\tif (appliedOverride.status === \"success\") {\n\t\t\t\treturn (\n\t\t\t\t\t<NodeIdContext.Provider value={nodeId}>\n\t\t\t\t\t\t<appliedOverride.Component {...props} ref={ref} />\n\t\t\t\t\t</NodeIdContext.Provider>\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tthrow appliedOverride.error\n\t\t\t}\n\t\t}\n\t}\n\n\treturn React.forwardRef(CodeBoundaryForOverrides)\n}\n\n/** Try to apply passed overrides, and return the error if that fails. */\nfunction tryToApplyOverride<Props>(\n\tComponent: ComponentType<Props>,\n\toverride: OverrideType<Props>,\n): { status: \"success\"; Component: ComponentType<Props> } | { status: \"error\"; error: unknown } {\n\ttry {\n\t\tconst ComponentWithOverrides = override(Component)\n\n\t\treturn { status: \"success\", Component: ComponentWithOverrides }\n\t} catch (error: unknown) {\n\t\treturn { status: \"error\", error }\n\t}\n}\n", "import type { MotionProps, Transition } from \"framer-motion\"\nimport { animate, frame, useMotionValue, useTransform, wrap } from \"framer-motion\"\nimport type React from \"react\"\nimport { forwardRef, useEffect } from \"react\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\nimport { isStaticRenderer } from \"./useIsStaticRenderer.ts\"\n\nexport interface Props {\n\tstrokeEffectLength: number\n\tstrokeEffectGap: number\n\tstrokeEffectOffset: number\n\tstrokeEffectTotalLength: number\n\tstrokeEffectLoop: boolean\n\tstrokeEffectLoopType: \"repeat\" | \"mirror\" | \"continuous\"\n\tpathLengthTransition: Omit<Transition, \"from\">\n}\n\nfunction valueWithMirroring(value: number, mirror: boolean) {\n\treturn mirror ? wrap(0, 2, value) : value\n}\n\nfunction singleFrame(): Promise<void> {\n\treturn new Promise(resolve => {\n\t\tframe.postRender(() => resolve())\n\t})\n}\n\nexport const withV1StrokeFX = <T extends MotionProps>(Component: React.ComponentType<T>) =>\n\tforwardRef((props: Props & T, forwardedRef: React.RefObject<SVGElement> | null) => {\n\t\tconst {\n\t\t\tstrokeEffectLength,\n\t\t\tstrokeEffectGap,\n\t\t\tstrokeEffectOffset,\n\t\t\tstrokeEffectLoop,\n\t\t\tstrokeEffectTotalLength,\n\t\t\tstrokeEffectLoopType,\n\t\t\tpathLengthTransition,\n\t\t\t...restProps\n\t\t} = props\n\n\t\tconst isCanvas = isStaticRenderer()\n\n\t\tconst offset = useMotionValue<number>(0)\n\t\tconst { length, gap } = useConstant(() => ({\n\t\t\tlength: strokeEffectTotalLength * strokeEffectLength,\n\t\t\tgap: strokeEffectTotalLength * strokeEffectGap,\n\t\t}))\n\n\t\t// biome-ignore lint/correctness/useExhaustiveDependencies: Stroke Effects run on mount only.\n\t\tuseEffect(() => {\n\t\t\tif (isCanvas) return\n\n\t\t\tconst signal = new AbortController()\n\n\t\t\tasync function loop() {\n\t\t\t\tlet index = 0\n\t\t\t\twhile (true) {\n\t\t\t\t\tif (signal.signal.aborted) break\n\n\t\t\t\t\tconst mirror = strokeEffectLoop && strokeEffectLoopType === \"mirror\"\n\n\t\t\t\t\tconst from = valueWithMirroring(index, mirror)\n\t\t\t\t\tconst to = valueWithMirroring(index + 1, mirror)\n\n\t\t\t\t\t// Wait at least one frame to prevent infinite animations. When the browser\n\t\t\t\t\t// changes pages/breakpoints, Motion enters instant animation mode, which causes\n\t\t\t\t\t// all motion animations to resolve to their end state instantly.\n\t\t\t\t\tawait Promise.all([animate(offset, [from, to], pathLengthTransition), singleFrame()])\n\n\t\t\t\t\t// If we are not looping break after the animation runs.\n\t\t\t\t\tif (!strokeEffectLoop) break\n\n\t\t\t\t\t// If we are looping but not mirroring or continuously animating, continue the\n\t\t\t\t\t// loop, don't increment the index.\n\t\t\t\t\tif (strokeEffectLoop && strokeEffectLoopType === \"repeat\") continue\n\n\t\t\t\t\tindex++\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvoid loop()\n\n\t\t\treturn () => {\n\t\t\t\tsignal.abort()\n\t\t\t}\n\t\t}, [])\n\n\t\tconst value = useTransform(offset, v => {\n\t\t\treturn (\n\t\t\t\tstrokeEffectOffset * strokeEffectTotalLength +\n\t\t\t\t(strokeEffectTotalLength - Math.max(v, 0.001) * strokeEffectTotalLength)\n\t\t\t)\n\t\t})\n\n\t\tconst effect = !isCanvas\n\t\t\t? {\n\t\t\t\t\t// These are static values, but they are set via js so that they are ignored\n\t\t\t\t\t// unless in the preview/published site.\n\t\t\t\t\tstrokeDasharray: `${length} ${gap}`,\n\t\t\t\t\tstrokeDashoffset: value,\n\t\t\t\t}\n\t\t\t: undefined\n\n\t\treturn <Component {...(restProps as unknown as T)} {...effect} ref={forwardedRef} />\n\t})\n", "import type { HTMLMotionProps, MotionStyle } from \"framer-motion\"\nimport { type PropsWithChildren, forwardRef, useState } from \"react\"\nimport { useIsStaticRenderer } from \"../../modules/useIsStaticRenderer.ts\"\nimport { isString } from \"../../utils/utils.ts\"\nimport { isFiniteNumber } from \"../utils/isFiniteNumber.ts\"\nimport { flattenChildrenToTickerItems } from \"../utils/tickerUtils.ts\"\nimport { BasicTicker } from \"./BasicTicker.tsx\"\nimport { DraggableTicker } from \"./DraggableTicker.tsx\"\nimport { TickerContextProvider, type TickerPlayState } from \"./TickerContext.tsx\"\n\nexport interface TickerEffectProps {\n\ttickerEffectVelocity?: number\n\t/** 0-100 percentage modifier stored as integer */\n\ttickerEffectHoverModifier?: number\n\ttickerEffectDirectionModifier?: \"default\" | \"reverse\"\n\ttickerEffectDraggable?: boolean\n\ttickerEffectAlign?: \"start\" | \"center\" | \"end\"\n\ttickerEffectStackDirection?: \"column\" | \"row\" | \"column-reverse\" | \"row-reverse\"\n\ttickerEffectGap?: number | string\n\ttickerEffectXOverflow?: \"auto\" | \"visible\" | \"hidden\" | \"clip\"\n\ttickerEffectYOverflow?: \"auto\" | \"visible\" | \"hidden\" | \"clip\"\n\ttickerEffectOverflow?: \"auto\" | \"visible\" | \"hidden\" | \"clip\"\n\ttickerEffectPosition?: \"relative\" | \"absolute\" | \"sticky\" | \"fixed\"\n\ttickerEffectIsDataRepeater?: boolean\n}\n\nexport interface TickerProps extends HTMLMotionProps<\"div\">, TickerEffectProps {\n\tas?: React.ElementType<HTMLMotionProps<\"div\">>\n}\n\nexport interface TickerSubComponentProps extends Omit<\n\tTickerProps,\n\t| \"tickerEffectDraggable\"\n\t| \"tickerEffectStackDirection\"\n\t| \"tickerEffectXOverflow\"\n\t| \"tickerEffectYOverflow\"\n\t| \"tickerEffectOverflow\"\n\t| \"tickerEffectItemWidth\"\n\t| \"tickerEffectItemHeight\"\n\t| \"tickerEffectGap\"\n\t| \"tickerEffectDirectionModifier\"\n\t| \"tickerEffectHoverModifier\"\n> {\n\titems: React.ReactNode[]\n\taxis: \"x\" | \"y\"\n\tdirectionModifier: -1 | 1\n\thoverModifier: number\n\tgap?: number\n\toverflow?: boolean\n\tplayState: TickerPlayState\n}\n\ninterface MotionStyleWithDynamicTickerCustomProperties extends MotionStyle {\n\t\"--ticker-cms-total-children\": number | undefined\n}\n\nexport const Ticker = /* @__PURE__ */ forwardRef(function Ticker(\n\tprops: PropsWithChildren<TickerProps>,\n\tref: React.RefObject<HTMLDivElement>,\n) {\n\tconst {\n\t\tchildren,\n\t\ttickerEffectDraggable,\n\t\ttickerEffectStackDirection,\n\t\ttickerEffectXOverflow,\n\t\ttickerEffectYOverflow,\n\t\ttickerEffectOverflow,\n\t\ttickerEffectGap,\n\t\ttickerEffectDirectionModifier,\n\t\ttickerEffectHoverModifier,\n\t\ttickerEffectPosition,\n\t\ttickerEffectIsDataRepeater,\n\t\tstyle: styleProps,\n\t\t...rest\n\t} = props\n\tconst isStatic = useIsStaticRenderer()\n\tconst [playState, setPlayState] = useState<TickerPlayState>(\"running\")\n\n\tconst axis = tickerEffectStackDirection?.startsWith(\"column\") ? \"y\" : \"x\"\n\tconst directionModifier = tickerEffectDirectionModifier === \"reverse\" ? -1 : 1\n\tconst hoverModifier = isFiniteNumber(tickerEffectHoverModifier) ? tickerEffectHoverModifier / 100 : 1\n\tconst xOverflowWithFallback = tickerEffectXOverflow ?? tickerEffectOverflow ?? \"visible\"\n\tconst yOverflowWithFallback = tickerEffectYOverflow ?? tickerEffectOverflow ?? \"visible\"\n\tconst overflow = (axis === \"x\" ? xOverflowWithFallback : yOverflowWithFallback) === \"visible\"\n\tconst gap = getGap(tickerEffectGap, axis)\n\tconst items = flattenChildrenToTickerItems(children)\n\tconst tickerStyle: MotionStyleWithDynamicTickerCustomProperties = {\n\t\t...styleProps,\n\t\t// Enable fractional unit fallback for dynamic numbers of CMS items\n\t\t\"--ticker-cms-total-children\": tickerEffectIsDataRepeater ? items.length : undefined,\n\t\t// collected position is not present on canvas and would be overridden when codegenned into a class\n\t\t// so we have to add it here to avoid it being set to relative by the underlying ticker component\n\t\tposition: tickerEffectPosition,\n\t}\n\n\tif (isStatic || !tickerEffectDraggable) {\n\t\treturn (\n\t\t\t<TickerContextProvider onPlayStateChange={setPlayState}>\n\t\t\t\t<BasicTicker\n\t\t\t\t\t{...rest}\n\t\t\t\t\tstyle={tickerStyle}\n\t\t\t\t\tref={ref}\n\t\t\t\t\taxis={axis}\n\t\t\t\t\tgap={gap}\n\t\t\t\t\toverflow={overflow}\n\t\t\t\t\tdirectionModifier={directionModifier}\n\t\t\t\t\thoverModifier={hoverModifier}\n\t\t\t\t\titems={items}\n\t\t\t\t\tplayState={playState}\n\t\t\t\t/>\n\t\t\t</TickerContextProvider>\n\t\t)\n\t}\n\n\treturn (\n\t\t<TickerContextProvider onPlayStateChange={setPlayState}>\n\t\t\t<DraggableTicker\n\t\t\t\t{...rest}\n\t\t\t\tstyle={tickerStyle}\n\t\t\t\tref={ref}\n\t\t\t\taxis={axis}\n\t\t\t\tgap={gap}\n\t\t\t\toverflow={overflow}\n\t\t\t\tdirectionModifier={directionModifier}\n\t\t\t\thoverModifier={hoverModifier}\n\t\t\t\titems={items}\n\t\t\t\tplayState={playState}\n\t\t\t/>\n\t\t</TickerContextProvider>\n\t)\n})\n\nfunction getGap(gap: number | string | undefined, axis: \"x\" | \"y\") {\n\tif (isFiniteNumber(gap)) return gap\n\tif (!isString(gap)) return undefined\n\n\tconst gaps = gap.split(\" \")\n\tconst rowGap = gaps[0]\n\tconst columnGap = gaps[1] ?? gaps[0]\n\n\tif (axis === \"x\" && columnGap) return naNToUndefined(parseInt(columnGap))\n\tif (axis === \"y\" && rowGap) return naNToUndefined(parseInt(rowGap))\n\n\treturn undefined\n}\n\nfunction naNToUndefined(value: number) {\n\treturn Number.isNaN(value) ? undefined : value\n}\n", "import { Children, Fragment, isValidElement } from \"react\"\n\n/**\n * Turns the react children prop into an array of react nodes to be consumed by the Ticker.\n * We flatten children of fragments to ensure the ticker can wrap the individual children even if they\n * were supplied like <><Child1 /> <Child2 /></><Child3 /> (this happens for cms items in the canvas).\n */\nexport function flattenChildrenToTickerItems(children: React.ReactNode): React.ReactNode[] {\n\tconst result: React.ReactNode[] = []\n\n\tChildren.forEach(children, child => {\n\t\tif (isValidElement(child) && child.type === Fragment) {\n\t\t\tresult.push(...flattenChildrenToTickerItems(child.props.children))\n\t\t} else if (child) {\n\t\t\tresult.push(child)\n\t\t}\n\t})\n\n\treturn result\n}\n", "import { motion } from \"framer-motion\"\nimport { type PropsWithChildren, forwardRef } from \"react\"\nimport { useIsStaticRenderer } from \"../../modules/useIsStaticRenderer.ts\"\nimport type { TickerSubComponentProps } from \"./Ticker.tsx\"\nimport { Ticker as MotionPlusTicker } from \"./motionplus/Ticker.tsx\"\n\nexport const BasicTicker = /* @__PURE__ */ forwardRef(function BasicTicker(\n\tprops: PropsWithChildren<TickerSubComponentProps>,\n\tref: React.RefObject<HTMLDivElement>,\n) {\n\tconst {\n\t\tchildren,\n\t\tas: asProp,\n\t\ttickerEffectVelocity,\n\t\ttickerEffectAlign,\n\t\taxis,\n\t\tdirectionModifier,\n\t\thoverModifier,\n\t\tgap,\n\t\toverflow,\n\t\tplayState,\n\t\t...rest\n\t} = props\n\tconst Component = asProp ?? motion.div\n\n\tconst isStatic = useIsStaticRenderer()\n\n\tconst baseVelocity = playState === \"paused\" ? 0 : (tickerEffectVelocity ?? 100)\n\tconst velocity = baseVelocity * directionModifier\n\n\treturn (\n\t\t<MotionPlusTicker\n\t\t\tref={ref}\n\t\t\tas={Component}\n\t\t\t{...rest}\n\t\t\tgap={gap}\n\t\t\taxis={axis}\n\t\t\talign={tickerEffectAlign ?? \"center\"}\n\t\t\tisStatic={isStatic}\n\t\t\tvelocity={velocity}\n\t\t\thoverFactor={hoverModifier}\n\t\t\titemSize=\"manual\"\n\t\t\toverflow={overflow}\n\t\t/>\n\t)\n})\n", "// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\n// This file is generated from motion-plus/react without types so we disable typechecking\nimport {\n\tanimate,\n\tclamp,\n\tframe,\n\tHTMLMotionProps,\n\tHTMLElements,\n\tLayoutGroup,\n\tmotion,\n\tMotionStyle,\n\tMotionValue,\n\tnoop,\n\tPanInfo,\n\tresize,\n\tTransition,\n\tuseAnimationFrame,\n\tuseComposedRefs,\n\tuseInView,\n\tuseIsomorphicLayoutEffect,\n\tuseMotionValue,\n\tuseMotionValueEvent,\n\tusePageInView,\n\tuseReducedMotion,\n\tuseTransform,\n\twrap,\n} from \"framer-motion\"\nimport React, {\n\tcreateContext,\n\tforwardRef,\n\tPropsWithChildren,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from \"react\"\n\nexport type ItemSize = \"auto\" | \"fill\" | \"manual\"\n\ntype Axis = \"x\" | \"y\"\n\ntype Direction = \"ltr\" | \"rtl\"\n\ninterface ItemPosition {\n\tstart: number\n\tend: number\n}\n\ninterface LayoutStrategy {\n\tsign: 1 | -1\n\tdirection: \"left\" | \"top\" | \"right\" | \"bottom\"\n\tlengthProp: \"offsetWidth\" | \"offsetHeight\"\n\tviewportLengthProp: \"innerWidth\" | \"innerHeight\"\n\tpaddingStartProp: \"paddingLeft\" | \"paddingTop\" | \"paddingRight\"\n\tmeasureItem: (item: HTMLElement, container: HTMLElement) => ItemPosition\n\tgetCumulativeInset: (element: HTMLElement) => number\n}\n\ninterface TickerState {\n\tdirection: Direction\n\tvisibleLength: number\n\tinset: number\n\tcontainerLength: number\n\ttotalItemLength: number\n\titemPositions: ItemPosition[]\n\tisMeasured: boolean\n\tmaxInset: number | null\n}\n\ninterface TickerInfo extends TickerState {\n\tgap: number\n\tclampOffset: (offset: number) => number\n\toffset: MotionValue<number>\n\trenderedOffset: MotionValue<number>\n}\n\ninterface TickerItemContextType {\n\toffset: MotionValue<number>\n\tprojection: MotionValue<number>\n\tprops: {\n\t\tclassName: string\n\t\tstyle: MotionStyle\n\t\t\"aria-hidden\"?: boolean | undefined\n\t\t\"aria-posinset\"?: number | undefined\n\t\t\"aria-setsize\"?: number | undefined\n\t}\n\titemIndex: number\n\tcloneIndex: number | undefined\n\tstart: number\n\tend: number\n}\n\n/**\n * Props for the Ticker component.\n */\nexport interface TickerProps<TagName extends keyof HTMLElements = \"div\"> {\n\t/**\n\t * An array of React nodes to be rendered as ticker items.\n\t */\n\titems: React.ReactNode[]\n\n\t/**\n\t * The axis along which the ticker scrolls.\n\t *\n\t * @default \"x\"\n\t */\n\taxis?: \"x\" | \"y\"\n\n\t/**\n\t * The velocity of the ticker scroll in pixels per second. Defaults to 50.\n\t */\n\tvelocity?: number // pixels per second\n\n\t/**\n\t * Factor by which the velocity is multiplied when the ticker is hovered. Defaults to 1 (no change).\n\t */\n\thoverFactor?: number // 0-1\n\n\t/**\n\t * The gap between ticker items in pixels. Defaults to 10.\n\t */\n\tgap?: number // gap between items\n\n\t/**\n\t * Alignment of items within the ticker. Defaults to \"center\".\n\t */\n\talign?: \"start\" | \"center\" | \"end\" | \"stretch\"\n\n\t/**\n\t * An optional MotionValue to control the ticker's offset externally.\n\t */\n\toffset?: MotionValue<number>\n\n\t/**\n\t * Whether the ticker should be static. This is a display mode suitable for\n\t * design canvases that disables animations, measurements and viewport tracking.\n\t * Defaults to false. **Must** remain static for the duration of the component's lifecycle.\n\t */\n\tisStatic?: boolean\n\n\t/**\n\t * The size of the ticker items.\n\t *\n\t * @default \"auto\"\n\t */\n\titemSize?: ItemSize\n\n\t/**\n\t * Show items that overflow the container.\n\t *\n\t * @default false\n\t */\n\toverflow?: boolean\n\n\t/**\n\t * Allow the carousel to loop through its items.\n\t * If this is disabled, the carousel will not clone\n\t * any additional children.\n\t *\n\t * @default true\n\t */\n\tloop?: boolean\n\n\t/**\n\t * By default, ticker items that disappear off the start of the visible area\n\t * will be reprojected to the end of the ticker items to reduce or eliminate\n\t * cloned items.\n\t *\n\t * The calculation for this is based on an item's layout. If for some reason\n\t * the item is transformed back within the visible area, this reprojection\n\t * might be visible. By setting a safe margin, you can extend the effective\n\t * visible area.\n\t *\n\t * @default 0\n\t */\n\tsafeMargin?: number\n\n\t/**\n\t * The element type to render as the root container. Defaults to \"div\".\n\t */\n\tas?: TagName\n\n\t/**\n\t * The length of the fade at each end of the container.\n\t *\n\t * When looping is disabled, the fade will automatically animate\n\t * away when the content is scrolled to each end of the container.\n\t *\n\t * @default 0\n\t */\n\tfade?: number | `${number}%`\n\n\t/**\n\t * The transition to use when fading the edges of the container.\n\t */\n\tfadeTransition?: Transition\n\n\t/**\n\t * The transition to use when paginating the container.\n\t *\n\t * @default { type: \"spring\", stiffness: 400, damping: 40 }\n\t */\n\tpageTransition?: Transition\n}\n\nfunction findCurrentIndexFromInset(\n\tcurrentInset: number,\n\titemPositions: ItemPosition[],\n\twrapInset: number\n): number {\n\tconst iteration = Math.floor(currentInset / wrapInset)\n\tconst transform = iteration * wrapInset\n\n\tlet itemIndex = 0\n\tfor (let i = 0; i < itemPositions.length; i++) {\n\t\tconst { end } = itemPositions[i]\n\t\titemIndex = i\n\n\t\tif (end + transform > currentInset) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// Return the iteration-adjusted index\n\treturn itemIndex + iteration * itemPositions.length\n}\n\nfunction findNextItemInset(\n\tcurrentInset: number,\n\titemPositions: ItemPosition[],\n\tgap: number,\n\ttargetInset?: number\n): number {\n\tif (itemPositions.length === 0) return 0\n\n\tconst totalItemLength = itemPositions[itemPositions.length - 1].end\n\tconst wrapInset = totalItemLength + gap\n\tconst idealInset =\n\t\ttargetInset ?? currentInset + (itemPositions[0]?.end ?? 0)\n\n\t/**\n\t * First, find the index of the item closest to the current\n\t * inset. We do this to ensure we paginate by at least one\n\t * item in the event that the items are larger than the\n\t * viewable container.\n\t */\n\tconst currentItemIndex = findCurrentIndexFromInset(\n\t\tcurrentInset,\n\t\titemPositions,\n\t\twrapInset\n\t)\n\n\tlet index = currentItemIndex + 1\n\tlet nextItemInset = 0\n\tlet hasFoundNextInset = false\n\twhile (!hasFoundNextInset) {\n\t\tconst { start, end } =\n\t\t\titemPositions[wrap(0, itemPositions.length, index)]\n\t\tconst iteration = Math.floor(index / itemPositions.length)\n\t\tconst transformInset = iteration * wrapInset\n\t\tconst transformedStart = start + transformInset\n\n\t\tnextItemInset = transformedStart\n\n\t\tif (end + transformInset > idealInset) {\n\t\t\thasFoundNextInset = true\n\t\t} else {\n\t\t\tindex++\n\t\t}\n\t}\n\n\treturn nextItemInset\n}\n\nfunction findPrevItemInset(\n\tcurrentInset: number,\n\titemPositions: ItemPosition[],\n\tgap: number,\n\ttargetInset?: number,\n\tcontainerLength?: number\n): number {\n\tif (itemPositions.length === 0) return 0\n\n\tconst totalItemLength = itemPositions[itemPositions.length - 1].end\n\tconst wrapInset = totalItemLength + gap\n\tconst idealInset = targetInset ?? currentInset - (containerLength ?? 0)\n\n\t/**\n\t * First, find the index of the item closest to the current\n\t * inset. We do this to ensure we paginate by at least one\n\t * item in the event that the items are larger than the\n\t * viewable container.\n\t */\n\tconst currentItemIndex = findCurrentIndexFromInset(\n\t\tcurrentInset,\n\t\titemPositions,\n\t\twrapInset\n\t)\n\n\tlet index = currentItemIndex\n\tlet prevItemInset = currentInset\n\tlet hasFoundPrevInset = false\n\twhile (!hasFoundPrevInset) {\n\t\tconst { start, end } =\n\t\t\titemPositions[wrap(0, itemPositions.length, index)]\n\t\tconst itemSize = end - start\n\t\tconst iteration = Math.floor(index / itemPositions.length)\n\t\tconst transformInset = iteration * wrapInset\n\t\tconst transformedStart = start + transformInset\n\n\t\tif (\n\t\t\tidealInset <= transformedStart + gap ||\n\t\t\ttransformedStart >= currentInset\n\t\t) {\n\t\t\tprevItemInset = transformedStart\n\t\t\tindex--\n\t\t} else if (idealInset <= transformedStart) {\n\t\t\tprevItemInset = transformedStart\n\t\t\thasFoundPrevInset = true\n\t\t} else {\n\t\t\tif (\n\t\t\t\t(containerLength && itemSize > containerLength) ||\n\t\t\t\t(prevItemInset === currentInset &&\n\t\t\t\t\tidealInset >= transformedStart)\n\t\t\t) {\n\t\t\t\tprevItemInset = transformedStart\n\t\t\t}\n\t\t\thasFoundPrevInset = true\n\t\t}\n\t}\n\n\treturn prevItemInset\n}\n\nconst TickerContext = /* @__PURE__ */ (() => {const Context = createContext(null)\n\tContext.displayName = \"TickerContext\";\n\treturn Context;\n})();\n\nfunction useTicker(): TickerInfo {\n\tconst context = useContext(TickerContext)\n\n\tinvariant(Boolean(context), \"useTicker must be used within a Ticker component\")\n\n\treturn context as TickerInfo\n}\n\nconst TickerItemContext = /* @__PURE__ */ (() => {const Context = createContext(undefined)\n\tContext.displayName = \"TickerItemContext\";\n\treturn Context;\n})();\n\nexport function useTickerItem(): TickerItemContextType {\n\tconst itemContext = useContext(TickerItemContext)\n\n\tinvariant(Boolean(itemContext), \"useTickerItem must be used within a TickerItem\")\n\n\treturn itemContext as TickerItemContextType\n}\n\nconst ltrStrategy = (\n\tinsetProp: \"offsetLeft\" | \"offsetTop\",\n\tlengthProp: \"offsetWidth\" | \"offsetHeight\",\n\tviewportLengthProp: \"innerWidth\" | \"innerHeight\",\n\tpaddingStartProp: \"paddingLeft\" | \"paddingTop\" | \"paddingRight\",\n\tdirection: \"left\" | \"top\" | \"right\" | \"bottom\"\n): LayoutStrategy => {\n\treturn {\n\t\tsign: 1,\n\t\tdirection,\n\t\tlengthProp,\n\t\tviewportLengthProp,\n\t\tpaddingStartProp,\n\t\tmeasureItem: (item: HTMLElement) => {\n\t\t\treturn {\n\t\t\t\tstart: item[insetProp],\n\t\t\t\tend: item[insetProp] + item[lengthProp],\n\t\t\t}\n\t\t},\n\t\tgetCumulativeInset: (element: HTMLElement) => {\n\t\t\tlet offset = 0\n\t\t\tlet el: HTMLElement | null = element\n\t\t\twhile (el) {\n\t\t\t\toffset += el[insetProp]\n\t\t\t\tel = el.offsetParent as HTMLElement\n\t\t\t}\n\t\t\treturn offset\n\t\t},\n\t}\n}\n\nconst xStrategy = /* @__PURE__ */(() => ltrStrategy(\n\t\"offsetLeft\",\n\t\"offsetWidth\",\n\t\"innerWidth\",\n\t\"paddingLeft\",\n\t\"right\"\n))()\n\nconst yStrategy = /* @__PURE__ */(() => ltrStrategy(\n\t\"offsetTop\",\n\t\"offsetHeight\",\n\t\"innerHeight\",\n\t\"paddingTop\",\n\t\"bottom\"\n))()\n\nfunction offsetRight(element: HTMLElement, container?: HTMLElement) {\n\tconst containerWidth = container?.offsetWidth ?? window.innerWidth\n\treturn containerWidth - (element.offsetLeft + element.offsetWidth)\n}\n\nconst xRtlStrategy: LayoutStrategy = /* @__PURE__ */(() => ({\n\t...xStrategy,\n\tsign: -1,\n\tdirection: \"left\",\n\tpaddingStartProp: \"paddingRight\",\n\tmeasureItem: (item: HTMLElement, container: HTMLElement) => {\n\t\tconst length = item.offsetWidth\n\t\tconst start = offsetRight(item, container)\n\t\treturn { start, end: start + length }\n\t},\n\tgetCumulativeInset: (element: HTMLElement) => {\n\t\tlet offset = 0\n\t\tlet el: HTMLElement | null = element\n\t\twhile (el) {\n\t\t\toffset += offsetRight(el, el.offsetParent as HTMLElement)\n\t\t\tel = el.offsetParent as HTMLElement\n\t\t}\n\t\treturn offset\n\t},\n}))()\n\nfunction getLayoutStrategy(axis: Axis, direction: Direction): LayoutStrategy {\n\treturn axis === \"y\" ? yStrategy : direction === \"ltr\" ? xStrategy : xRtlStrategy\n}\n\n/**\n * Represents an individual item within the Ticker.\n *\n * This component handles the logic for repositioning items to create the infinite scroll effect.\n *\n * @param offset - The current scroll offset of the ticker.\n * @param axis - The scroll axis (\"x\" or \"y\").\n * @param listSize - The total size of the list including all clones.\n * @param itemIndex - The original index of the item.\n * @param cloneIndex - The index of the clone, if this is a cloned item.\n * @param props - HTML attributes to pass to the list item li element.\n * @returns A ListItem React component.\n */\nfunction TickerItemWrapper({\n\tchildren,\n\toffset,\n\taxis,\n\tlistSize = 0,\n\tnumItems = 0,\n\titemIndex,\n\tcloneIndex,\n\tbounds,\n\talignItems,\n\treproject = true,\n\tsize = \"auto\",\n\tsafeMargin,\n}: HTMLMotionProps<\"li\"> & {\n\toffset: MotionValue<number>\n\taxis: \"x\" | \"y\"\n\tlistSize?: number\n\tbounds: { start: number; end: number }\n\tnumItems: number\n\titemIndex: number\n\tcloneIndex?: number\n\talignItems: \"flex-start\" | \"center\" | \"flex-end\" | \"stretch\"\n\tsize?: ItemSize\n\tsafeMargin: number\n\treproject?: boolean\n\tchildren: React.ReactNode\n}) {\n\tconst { start, end } = bounds\n\tconst { visibleLength, direction, inset } = useTicker()\n\tconst { sign } = getLayoutStrategy(axis, direction)\n\n\tconst projection = useTransform(() => {\n\t\tif (!reproject) return 0\n\n\t\tconst currentOffset = offset.get()\n\t\tif ((!start && !end) || !listSize) return 0\n\n\t\tif (currentOffset * sign + bounds.end <= -inset - safeMargin) {\n\t\t\treturn listSize * sign\n\t\t}\n\n\t\t/**\n\t\t * If we've defined a safeMargin, also project items backwards if they\n\t\t * fall outside the right boundary (+ margin). This fills-in the start area\n\t\t * without affecting the alignment of items.\n\t\t */\n\t\tif (safeMargin > 0) {\n\t\t\tconst rightBoundary = visibleLength - safeMargin - inset\n\t\t\tif (currentOffset * sign + bounds.start >= rightBoundary) {\n\t\t\t\treturn -listSize * sign\n\t\t\t}\n\t\t}\n\n\t\treturn 0\n\t})\n\n\tconst itemOffset = useTransform(() => {\n\t\tconst currentOffset = offset.get()\n\t\tconst currentTransform = projection.get()\n\t\tif ((!start && !end) || !listSize) return 0\n\n\t\treturn currentOffset * sign + start + currentTransform * sign\n\t})\n\n\tconst ariaProps =\n\t\tcloneIndex === undefined\n\t\t\t? {\n\t\t\t\t  [\"aria-hidden\"]: false,\n\t\t\t\t  [\"aria-posinset\"]: itemIndex + 1,\n\t\t\t\t  [\"aria-setsize\"]: numItems,\n\t\t\t  }\n\t\t\t: {\n\t\t\t\t  [\"aria-hidden\"]: true,\n\t\t\t  }\n\n\tconst isFill = size === \"fill\"\n\tconst offAxisSize = alignItems === \"stretch\" ? \"100%\" : \"fit-content\"\n\n\tconst props = {\n\t\tclassName: cloneIndex === undefined ? \"ticker-item\" : \"clone-item\",\n\t\tstyle: {\n\t\t\tflexGrow: 0,\n\t\t\tflexShrink: 0,\n\t\t\tposition: \"relative\",\n\t\t\tflexBasis: size === \"fill\" ? \"100%\" : undefined,\n\t\t\tdisplay: isFill ? \"grid\" : undefined,\n\t\t\tgridTemplateColumns: isFill ? \"1fr\" : undefined,\n\t\t\tgridTemplateRows: isFill ? \"1fr\" : undefined,\n\t\t\tminWidth: isFill ? 0 : undefined,\n\t\t\tminHeight: isFill ? 0 : undefined,\n\t\t\theight: axis === \"x\" ? offAxisSize : undefined,\n\t\t\twidth: axis === \"y\" ? offAxisSize : undefined,\n\t\t\tx: axis === \"x\" ? projection : 0,\n\t\t\ty: axis === \"y\" ? projection : 0,\n\t\t},\n\t\t...ariaProps,\n\t} as const\n\n\treturn (\n\t\t<TickerItemContext.Provider\n\t\t\tvalue={{\n\t\t\t\tstart,\n\t\t\t\tend,\n\t\t\t\toffset: itemOffset,\n\t\t\t\tprojection,\n\t\t\t\titemIndex,\n\t\t\t\tcloneIndex,\n\t\t\t\tprops,\n\t\t\t}}\n\t\t>\n\t\t\t{size === \"manual\" ? (\n\t\t\t\tchildren\n\t\t\t) : (\n\t\t\t\t<DefaultTickerItem>{children}</DefaultTickerItem>\n\t\t\t)}\n\t\t</TickerItemContext.Provider>\n\t)\n}\n\nfunction DefaultTickerItem({ children }: { children: React.ReactNode }) {\n\tconst { props } = useTickerItem()\n\n\treturn <motion.li {...props}>{children}</motion.li>\n}\n\nfunction useFocusNavigation(\n\tcontainerRef: React.RefObject<HTMLElement | null>,\n\taxis: \"x\" | \"y\",\n\tfocusOffset: MotionValue<number>,\n\toffset: MotionValue<number>,\n\tsetHasFocus: (hasFocus: boolean) => void\n) {\n\tconst isFocusTrapped = useRef(false)\n\n\tuseEffect(() => {\n\t\tconst container = containerRef.current\n\n\t\tif (!container) return\n\n\t\tlet detectionEnabled = false\n\n\t\tconst abortController = new AbortController()\n\t\tconst eventOptions: EventListenerOptions = {\n\t\t\tsignal: abortController.signal,\n\t\t} as any\n\t\tconst eventOptionsWithCapture = {\n\t\t\t...eventOptions,\n\t\t\tcapture: true,\n\t\t}\n\n\t\tconst scrollProp = axis === \"x\" ? \"scrollLeft\" : \"scrollTop\"\n\t\tconst offsetProp = axis === \"x\" ? \"offsetLeft\" : \"offsetTop\"\n\t\tconst leftKey = axis === \"x\" ? \"ArrowLeft\" : \"ArrowUp\"\n\t\tconst rightKey = axis === \"x\" ? \"ArrowRight\" : \"ArrowDown\"\n\n\t\tlet focusableElements: HTMLElement[] = []\n\t\tlet focusIndex = 0\n\n\t\tconst applyFocusOffset = () => {\n\t\t\tconst nextFocusableElement = focusableElements[focusIndex]\n\n\t\t\tif (!nextFocusableElement) return\n\n\t\t\tnextFocusableElement.focus({ preventScroll: true })\n\n\t\t\t// Move the ticker offset to the focused item\n\t\t\tfocusOffset.set(-nextFocusableElement[offsetProp])\n\n\t\t\t// Override the default browser scroll into view behaviour\n\t\t\tcontainer[scrollProp] = 0\n\t\t\tframe.render(() => {\n\t\t\t\tcontainer[scrollProp] = 0\n\t\t\t})\n\t\t}\n\n\t\tconst handleFocusNavigation = (event: KeyboardEvent) => {\n\t\t\tif (event.key === \"Tab\") {\n\t\t\t\tevent.preventDefault()\n\n\t\t\t\t// Focus the next selectable element in the DOM outside the container\n\t\t\t\tendFocusTrap()\n\n\t\t\t\t// Find the next focusable element after the container\n\t\t\t\tconst allFocusableElements = Array.from(\n\t\t\t\t\tdocument.querySelectorAll(\n\t\t\t\t\t\t'a, button, input, textarea, select, [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"]'\n\t\t\t\t\t)\n\t\t\t\t).filter(isHTMLElement)\n\n\t\t\t\t// Sort the focusable elements by their tabIndex\n\t\t\t\tallFocusableElements.sort(compareTabIndexes)\n\n\t\t\t\tconst lastFocusableElement =\n\t\t\t\t\tallFocusableElements[\n\t\t\t\t\t\tevent.shiftKey ? 0 : allFocusableElements.length - 1\n\t\t\t\t\t]\n\n\t\t\t\tconst initialIndex = event.shiftKey\n\t\t\t\t\t? allFocusableElements.length - 1\n\t\t\t\t\t: 0\n\n\t\t\t\t/**\n\t\t\t\t * If the last focusable element in the DOM is inside the container\n\t\t\t\t * then we want to set focus on the first DOM element\n\t\t\t\t */\n\t\t\t\tif (container.contains(lastFocusableElement)) {\n\t\t\t\t\tallFocusableElements[initialIndex].focus()\n\t\t\t\t\treturn\n\t\t\t\t} else {\n\t\t\t\t\tconst indexOfCurrentElement = allFocusableElements.indexOf(\n\t\t\t\t\t\tfocusableElements[focusIndex]\n\t\t\t\t\t)\n\n\t\t\t\t\tconst delta = event.shiftKey ? -1 : 1\n\n\t\t\t\t\tfor (\n\t\t\t\t\t\tlet i = indexOfCurrentElement;\n\t\t\t\t\t\ti < allFocusableElements.length && i >= 0;\n\t\t\t\t\t\ti += delta\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst element = allFocusableElements[i]\n\n\t\t\t\t\t\tif (!container.contains(element)) {\n\t\t\t\t\t\t\telement.focus()\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t} else if (event.key === leftKey) {\n\t\t\t\tfocusIndex--\n\t\t\t} else if (event.key === rightKey) {\n\t\t\t\tfocusIndex++\n\t\t\t}\n\n\t\t\tfocusIndex = wrap(0, focusableElements.length, focusIndex)\n\n\t\t\tapplyFocusOffset()\n\t\t}\n\n\t\tconst startFocusTrap = () => {\n\t\t\tif (isFocusTrapped.current) return\n\n\t\t\t// Get all focusable elements within .ticker-item elements\n\t\t\tfocusableElements = Array.from(\n\t\t\t\tcontainer.querySelectorAll(\n\t\t\t\t\t'.ticker-item a, .ticker-item button, .ticker-item input, .ticker-item textarea, .ticker-item select, .ticker-item [tabindex]:not([tabindex=\"-1\"]), .ticker-item [contenteditable=\"true\"]'\n\t\t\t\t)\n\t\t\t).filter(isHTMLElement)\n\n\t\t\tfocusIndex = 0\n\n\t\t\tif (!focusableElements.length) return\n\n\t\t\tsetHasFocus(true)\n\n\t\t\tisFocusTrapped.current = true\n\n\t\t\tapplyFocusOffset()\n\n\t\t\twindow.addEventListener(\n\t\t\t\t\"focus\",\n\t\t\t\tdetectTrapEnd,\n\t\t\t\teventOptionsWithCapture\n\t\t\t)\n\t\t\twindow.addEventListener(\n\t\t\t\t\"blur\",\n\t\t\t\tdetectTrapEnd,\n\t\t\t\teventOptionsWithCapture\n\t\t\t)\n\t\t\tcontainer.addEventListener(\n\t\t\t\t\"keydown\",\n\t\t\t\thandleFocusNavigation,\n\t\t\t\teventOptions\n\t\t\t)\n\t\t}\n\n\t\tconst detectTrapEnd = (event: FocusEvent) => {\n\t\t\tif (\n\t\t\t\t!event.target ||\n\t\t\t\t!(event.target instanceof HTMLElement) ||\n\t\t\t\t!container.contains(event.target)\n\t\t\t) {\n\t\t\t\tendFocusTrap()\n\t\t\t}\n\t\t}\n\n\t\tconst endFocusTrap = () => {\n\t\t\tif (!isFocusTrapped.current) return\n\n\t\t\tisFocusTrapped.current = false\n\n\t\t\tsetHasFocus(false)\n\t\t\toffset.set(focusOffset.get())\n\n\t\t\twindow.removeEventListener(\"focus\", detectTrapEnd)\n\t\t\twindow.removeEventListener(\"blur\", detectTrapEnd)\n\t\t\tcontainer.removeEventListener(\"keydown\", handleFocusNavigation)\n\t\t}\n\n\t\tconst handleFocus = (event: FocusEvent) => {\n\t\t\tconst { target } = event\n\n\t\t\tif (!isHTMLElement(target)) return\n\n\t\t\tif (!isFocusTrapped.current) {\n\t\t\t\tstartFocusTrap()\n\t\t\t}\n\t\t}\n\n\t\tconst detectFocusTrapEnable = () => {\n\t\t\tif (detectionEnabled) return\n\n\t\t\tdetectionEnabled = true\n\n\t\t\tcontainer.addEventListener(\n\t\t\t\t\"focus\",\n\t\t\t\thandleFocus,\n\t\t\t\teventOptionsWithCapture\n\t\t\t)\n\t\t\twindow.addEventListener(\n\t\t\t\t\"pointermove\",\n\t\t\t\thandlePointerMove,\n\t\t\t\teventOptions\n\t\t\t)\n\t\t}\n\n\t\tconst handlePointerMove = () => {\n\t\t\tif (!detectionEnabled) return\n\n\t\t\tdetectionEnabled = false\n\t\t\tcontainer.removeEventListener(\"focus\", handleFocus, true)\n\t\t\twindow.removeEventListener(\n\t\t\t\t\"pointermove\",\n\t\t\t\thandlePointerMove,\n\t\t\t\teventOptions\n\t\t\t)\n\t\t}\n\n\t\tconst handleAriaHiddenClicks = (event: PointerEvent) => {\n\t\t\tconst target = event.target as HTMLElement\n\n\t\t\t// Check if target is a descendant of an element with aria-hidden=\"true\"\n\t\t\tconst ariaHiddenAncestor = target.closest('[aria-hidden=\"true\"]')\n\t\t\tif (ariaHiddenAncestor) {\n\t\t\t\tariaHiddenAncestor.removeAttribute(\"aria-hidden\")\n\t\t\t}\n\t\t}\n\n\t\tconst resetScroll = () => {\n\t\t\tcontainer.scrollLeft = 0\n\t\t\tcontainer.scrollTop = 0\n\t\t}\n\n\t\twindow.addEventListener(\"keydown\", detectFocusTrapEnable, eventOptions)\n\t\tcontainer.addEventListener(\n\t\t\t\"pointerdown\",\n\t\t\thandleAriaHiddenClicks,\n\t\t\teventOptions\n\t\t)\n\t\tcontainer.addEventListener(\"scroll\", resetScroll, eventOptions)\n\n\t\treturn () => {\n\t\t\tabortController.abort()\n\t\t\tendFocusTrap()\n\t\t}\n\t}, [])\n}\n\nfunction compareTabIndexes(a: HTMLElement, b: HTMLElement) {\n\t// Elements with tabIndex >= 1 come first, ordered by tabIndex value\n\tif (a.tabIndex >= 1 && b.tabIndex >= 1) {\n\t\treturn a.tabIndex - b.tabIndex\n\t}\n\n\t// Elements with tabIndex >= 1 come before tabIndex 0 or -1\n\tif (a.tabIndex >= 1 && b.tabIndex <= 0) {\n\t\treturn -1\n\t}\n\n\tif (b.tabIndex >= 1 && a.tabIndex <= 0) {\n\t\treturn 1\n\t}\n\n\t// Both have tabIndex 0 or -1, maintain document order (return 0)\n\t// tabIndex -1 elements are focusable programmatically but not via tab navigation\n\treturn 0\n}\n\nfunction isHTMLElement(element: unknown): element is HTMLElement {\n\treturn element instanceof HTMLElement\n}\n\nfunction calcItemLength(itemPosition: ItemPosition) {\n\treturn itemPosition.end - itemPosition.start\n}\n\nfunction calcTotalItemLength(itemPositions: ItemPosition[]) {\n\treturn itemPositions[itemPositions.length - 1].end - itemPositions[0].start\n}\n\nfunction calcNumClones(\n\tvisibleLength: number,\n\titemPositions: ItemPosition[],\n\tgap: number\n) {\n\tconst totalItemLength = calcTotalItemLength(itemPositions)\n\tconst maxItemLength = Math.max(...itemPositions.map(calcItemLength))\n\n\tlet count = 0\n\n\t/**\n\t * A length where the largest item is out of the visible area.\n\t */\n\tlet safeFillLength = 0\n\n\twhile (safeFillLength < visibleLength) {\n\t\tsafeFillLength = (totalItemLength + gap) * (count + 1) - maxItemLength\n\t\tcount++\n\t}\n\n\treturn Math.max(count - 1, 0)\n}\n\nconst alignAlias = {\n\tstart: \"flex-start\",\n\tend: \"flex-end\",\n} as const\n\n/**\n * A performant, accessible, and infinitely scrolling ticker component.\n */\nfunction TickerComponent<TagName extends keyof HTMLElements = \"div\">(\n\t{\n\t\titems,\n\t\tvelocity = 50,\n\t\thoverFactor = 1,\n\t\tgap = 10,\n\t\taxis = \"x\",\n\t\talign = \"center\",\n\t\toffset,\n\t\tisStatic = false,\n\t\titemSize = \"auto\",\n\t\toverflow = false,\n\t\tloop = true,\n\t\tchildren,\n\t\tas = \"div\",\n\t\tsnap,\n\t\tsafeMargin = 0,\n\t\tfade = 0,\n\t\tfadeTransition,\n\t\tpageTransition,\n\t\t...props\n\t}: TickerProps<TagName> & PropsWithChildren & Record<string, any>,\n\tref: React.Ref<HTMLElement>\n) {\n\tconst internalContainerRef = useRef<HTMLElement>(null)\n\tconst containerRef = useComposedRefs(ref, internalContainerRef)\n\tconst listRef = useRef<HTMLUListElement>(null)\n\tconst [state, setState] = useState<TickerState>({\n\t\tdirection: \"ltr\",\n\t\tvisibleLength: 0,\n\t\tinset: 0,\n\t\ttotalItemLength: 0,\n\t\tcontainerLength: 0,\n\t\titemPositions: [],\n\t\tisMeasured: false,\n\t\tmaxInset: null,\n\t})\n\n\tconst alignItems = alignAlias[align as keyof typeof alignAlias] || align\n\tconst { sign } = getLayoutStrategy(axis, state.direction)\n\n\tif (isStatic) {\n\t\tconst renderedOffset = useMotionValue(0)\n\t\treturn (\n\t\t\t<TickerContext.Provider\n\t\t\t\tvalue={{\n\t\t\t\t\t...state,\n\t\t\t\t\tgap,\n\t\t\t\t\tclampOffset: noop,\n\t\t\t\t\toffset: renderedOffset,\n\t\t\t\t\trenderedOffset,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<ListView<TagName>\n\t\t\t\t\tcontainerProps={props}\n\t\t\t\t\tcontainerRef={containerRef}\n\t\t\t\t\tchildren={children}\n\t\t\t\t\tgap={gap}\n\t\t\t\t\taxis={axis}\n\t\t\t\t\talignItems={alignItems}\n\t\t\t\t\toffset={renderedOffset}\n\t\t\t\t\trenderedOffset={renderedOffset}\n\t\t\t\t\titems={items}\n\t\t\t\t\titemSize={itemSize}\n\t\t\t\t\tstate={state}\n\t\t\t\t\toverflow={overflow}\n\t\t\t\t\tsafeMargin={safeMargin}\n\t\t\t\t\tisStatic\n\t\t\t\t\tas={as}\n\t\t\t\t\tfade={fade}\n\t\t\t\t\tsign={sign}\n\t\t\t\t/>\n\t\t\t</TickerContext.Provider>\n\t\t)\n\t}\n\n\tconst [hasFocus, setHasFocus] = useState(false)\n\n\tconst velocityFactor = useMotionValue(1)\n\tconst defaultOffset = useMotionValue(0)\n\toffset ??= defaultOffset\n\n\tconst wrappedOffset = useTransform(() => {\n\t\t// TODO: Move to strategy\n\t\tif (state.direction === \"rtl\" && axis === \"x\") {\n\t\t\treturn wrap(\n\t\t\t\tstate.totalItemLength + gap + state.inset,\n\t\t\t\tstate.inset,\n\t\t\t\toffset.get()\n\t\t\t)\n\t\t}\n\t\treturn wrap(\n\t\t\t-state.totalItemLength - gap - state.inset,\n\t\t\t-state.inset,\n\t\t\toffset.get()\n\t\t)\n\t})\n\tconst focusOffset = useMotionValue(0)\n\n\tconst renderedOffset = hasFocus\n\t\t? focusOffset\n\t\t: loop\n\t\t? wrappedOffset\n\t\t: offset\n\n\tconst isInViewport = useInView(internalContainerRef, { margin: \"100px\" })\n\tconst isPageInView = usePageInView()\n\tconst isInView = isInViewport && isPageInView\n\tconst isReducedMotion = useReducedMotion()\n\n\tconst updateMeasurements = () => {\n\t\tif (!internalContainerRef.current || !listRef.current) return\n\n\t\tconst direction = window.getComputedStyle(internalContainerRef.current)\n\t\t\t.direction as \"ltr\" | \"rtl\"\n\t\tconst {\n\t\t\tmeasureItem,\n\t\t\tlengthProp,\n\t\t\tviewportLengthProp,\n\t\t\tgetCumulativeInset,\n\t\t} = getLayoutStrategy(axis, direction)\n\n\t\tconst paddingStartProp = axis === \"x\" ? \"paddingLeft\" : \"paddingTop\"\n\t\tconst paddingEndProp = axis === \"x\" ? \"paddingRight\" : \"paddingBottom\"\n\n\t\tconst container = internalContainerRef.current\n\t\tconst list = listRef.current\n\t\tconst allItems = list.querySelectorAll(\".ticker-item\")\n\n\t\tif (!allItems.length) return\n\n\t\tlet hasItemSizeChanged = false\n\t\tconst itemPositions: ItemPosition[] = []\n\n\t\tfor (let i = 0; i < allItems.length; i++) {\n\t\t\tconst size = measureItem(allItems[i] as HTMLElement, container)\n\t\t\titemPositions.push(size)\n\n\t\t\tconst prevSize = state.itemPositions[i]\n\t\t\tif (\n\t\t\t\t!prevSize ||\n\t\t\t\tsize.start !== prevSize.start ||\n\t\t\t\tsize.end !== prevSize.end\n\t\t\t) {\n\t\t\t\thasItemSizeChanged = true\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Cap to viewport size to prevent infinite or wasteful cloning in the event that the\n\t\t * container width is reactive to the number of children rendered within it.\n\t\t */\n\t\tconst containerLength = Math.min(\n\t\t\tcontainer[lengthProp],\n\t\t\twindow[viewportLengthProp]\n\t\t)\n\n\t\tlet visibleLength = overflow\n\t\t\t? window[viewportLengthProp]\n\t\t\t: containerLength\n\n\t\tif (safeMargin > 0) {\n\t\t\tvisibleLength += safeMargin * 2\n\t\t}\n\n\t\tconst totalItemLength = calcTotalItemLength(itemPositions)\n\n\t\tconst computedContainerStyle = window.getComputedStyle(container)\n\t\tconst containerPaddingStart = parseInt(\n\t\t\tcomputedContainerStyle[paddingStartProp] ?? 0\n\t\t)\n\t\tconst containerPaddingEnd = parseInt(\n\t\t\tcomputedContainerStyle[paddingEndProp] ?? 0\n\t\t)\n\n\t\tconst inset = overflow\n\t\t\t? getCumulativeInset(allItems[0] as HTMLElement)\n\t\t\t: containerPaddingStart\n\n\t\tconst maxInset =\n\t\t\tloop === false\n\t\t\t\t? Math.max(\n\t\t\t\t\t  0,\n\t\t\t\t\t  totalItemLength -\n\t\t\t\t\t\t  containerLength +\n\t\t\t\t\t\t  containerPaddingStart +\n\t\t\t\t\t\t  containerPaddingEnd\n\t\t\t\t  )\n\t\t\t\t: null\n\n\t\tif (\n\t\t\tvisibleLength !== state.visibleLength ||\n\t\t\ttotalItemLength !== state.totalItemLength ||\n\t\t\tinset !== state.inset ||\n\t\t\tstate.itemPositions.length !== itemPositions.length ||\n\t\t\thasItemSizeChanged\n\t\t) {\n\t\t\tsetState({\n\t\t\t\tdirection,\n\t\t\t\tvisibleLength,\n\t\t\t\titemPositions,\n\t\t\t\ttotalItemLength,\n\t\t\t\tinset,\n\t\t\t\tcontainerLength,\n\t\t\t\tmaxInset,\n\t\t\t\tisMeasured: true,\n\t\t\t})\n\t\t}\n\t}\n\n\tuseIsomorphicLayoutEffect(() => {\n\t\tif (!isInView || !internalContainerRef.current) return\n\t\tupdateMeasurements()\n\n\t\tconst trackViewport = overflow ? resize(updateMeasurements) : undefined\n\n\t\tconst trackContainer = resize(\n\t\t\tinternalContainerRef.current,\n\t\t\tupdateMeasurements\n\t\t)\n\n\t\treturn () => {\n\t\t\ttrackViewport?.()\n\t\t\ttrackContainer()\n\t\t}\n\t}, [items, isInView, overflow])\n\n\tconst isMeasured = state.totalItemLength > 0\n\n\tuseAnimationFrame(\n\t\tisMeasured && isInView && offset === defaultOffset && !isReducedMotion\n\t\t\t? (_time: number, delta: number) => {\n\t\t\t\t  const frameOffset =\n\t\t\t\t\t  (delta / 1000) * (velocity * sign * velocityFactor.get())\n\t\t\t\t  offset.set(offset.get() - frameOffset)\n\t\t\t  }\n\t\t\t: noop\n\t)\n\n\tconst cloneCount = useMemo(() => {\n\t\tif (!isMeasured || !state.visibleLength) return 0\n\n\t\treturn calcNumClones(state.visibleLength, state.itemPositions, gap)\n\t}, [isMeasured, state])\n\n\tconst totalListSize =\n\t\tstate.totalItemLength === 0\n\t\t\t? 0\n\t\t\t: (state.totalItemLength + gap) * (cloneCount + 1)\n\n\tconst clonedItemGroups: React.ReactNode[] = []\n\n\tif (loop) {\n\t\tfor (let i = 0; i < cloneCount; i++) {\n\t\t\tconst clonedItems: React.ReactNode[] = []\n\t\t\titems.forEach((item: React.ReactNode, itemIndex: number) => {\n\t\t\t\tconst originalBounds = state.itemPositions[itemIndex]\n\t\t\t\tconst cloneOffset = (state.totalItemLength + gap) * (i + 1)\n\t\t\t\tconst cloneBounds = originalBounds\n\t\t\t\t\t? {\n\t\t\t\t\t\t  start: originalBounds.start + cloneOffset,\n\t\t\t\t\t\t  end: originalBounds.end + cloneOffset,\n\t\t\t\t\t  }\n\t\t\t\t\t: defaultBounds\n\n\t\t\t\tclonedItems.push(\n\t\t\t\t\t<TickerItemWrapper\n\t\t\t\t\t\tkey={`clone-${i}-${itemIndex}`}\n\t\t\t\t\t\toffset={renderedOffset}\n\t\t\t\t\t\taxis={axis}\n\t\t\t\t\t\tlistSize={totalListSize}\n\t\t\t\t\t\titemIndex={itemIndex}\n\t\t\t\t\t\tcloneIndex={itemIndex}\n\t\t\t\t\t\tbounds={cloneBounds}\n\t\t\t\t\t\talignItems={alignItems}\n\t\t\t\t\t\tsize={itemSize}\n\t\t\t\t\t\tsafeMargin={safeMargin}\n\t\t\t\t\t\tnumItems={items.length}\n\t\t\t\t\t>\n\t\t\t\t\t\t{item}\n\t\t\t\t\t</TickerItemWrapper>\n\t\t\t\t)\n\t\t\t})\n\n\t\t\tconst id = `ticker-group-${i}`\n\t\t\tclonedItemGroups.push(\n\t\t\t\t<LayoutGroup key={id} id={id}>\n\t\t\t\t\t{clonedItems}\n\t\t\t\t</LayoutGroup>\n\t\t\t)\n\t\t}\n\t}\n\n\tuseFocusNavigation(\n\t\tinternalContainerRef,\n\t\taxis,\n\t\tfocusOffset,\n\t\toffset,\n\t\tsetHasFocus\n\t)\n\n\tconst clampOffset = useCallback(\n\t\t(offset: number) => {\n\t\t\treturn state.maxInset !== null\n\t\t\t\t? clamp(-state.maxInset, 0, offset)\n\t\t\t\t: offset\n\t\t},\n\t\t[state.maxInset]\n\t)\n\n\treturn (\n\t\t<TickerContext.Provider\n\t\t\tvalue={{ ...state, gap, clampOffset, offset, renderedOffset }}\n\t\t>\n\t\t\t<ListView<TagName>\n\t\t\t\tcontainerProps={props}\n\t\t\t\tchildren={children}\n\t\t\t\tcontainerRef={containerRef}\n\t\t\t\tlistRef={listRef}\n\t\t\t\tgap={gap}\n\t\t\t\taxis={axis}\n\t\t\t\talignItems={alignItems}\n\t\t\t\tisMeasured={isMeasured}\n\t\t\t\tisInView={isInView}\n\t\t\t\toffset={offset}\n\t\t\t\trenderedOffset={renderedOffset}\n\t\t\t\titems={items}\n\t\t\t\titemSize={itemSize}\n\t\t\t\tclonedItems={clonedItemGroups}\n\t\t\t\tclampOffset={clampOffset}\n\t\t\t\tsnap={snap}\n\t\t\t\tsafeMargin={safeMargin}\n\t\t\t\tonPointerEnter={() => {\n\t\t\t\t\tanimate(velocityFactor, hoverFactor)\n\t\t\t\t}}\n\t\t\t\tonPointerLeave={() => {\n\t\t\t\t\tanimate(velocityFactor, 1)\n\t\t\t\t}}\n\t\t\t\ttotalListSize={totalListSize}\n\t\t\t\tstate={state}\n\t\t\t\toverflow={overflow}\n\t\t\t\tloop={loop}\n\t\t\t\tas={as}\n\t\t\t\tfade={fade}\n\t\t\t\tsign={sign}\n\t\t\t\tfadeTransition={fadeTransition}\n\t\t\t\tpageTransition={pageTransition}\n\t\t\t/>\n\t\t</TickerContext.Provider>\n\t)\n}\n\nexport const Ticker = /** @__PURE__ */ forwardRef(TickerComponent)\n\nfunction ListView<TagName extends keyof HTMLElements>({\n\tchildren,\n\tcontainerProps,\n\tcontainerRef,\n\tlistRef,\n\tgap,\n\taxis,\n\talignItems,\n\tisMeasured,\n\tisInView,\n\tisStatic,\n\titems,\n\toffset,\n\tclonedItems,\n\tclampOffset,\n\trenderedOffset,\n\tonPointerEnter,\n\tonPointerLeave,\n\ttotalListSize,\n\titemSize,\n\toverflow,\n\tstate,\n\tsafeMargin,\n\tsnap,\n\tloop,\n\tas,\n\tfade,\n\tsign,\n\tfadeTransition = defaultFadeTransition,\n\tpageTransition,\n}: {\n\tchildren?: React.ReactNode\n\tcontainerProps: any\n\tcontainerRef: React.RefCallback<HTMLElement>\n\tlistRef?: React.RefObject<HTMLUListElement | null>\n\tgap: number\n\taxis: \"x\" | \"y\"\n\talignItems: \"flex-start\" | \"center\" | \"flex-end\" | \"stretch\"\n\toffset: MotionValue<number>\n\trenderedOffset: MotionValue<number>\n\tisMeasured?: boolean\n\tisInView?: boolean\n\tisStatic?: boolean\n\tonPointerEnter?: () => void\n\tonPointerLeave?: () => void\n\titems: React.ReactNode[]\n\tclonedItems?: React.ReactNode[]\n\tclampOffset?: (offset: number) => number\n\ttotalListSize?: number\n\titemSize: ItemSize\n\toverflow: boolean\n\tstate: TickerState\n\tsnap?: \"page\" | \"loose\" | false\n\tloop?: boolean\n\tsafeMargin: number\n\tas: TagName\n\tfade: number | `${number}%`\n\tsign: 1 | -1\n\tfadeTransition?: Transition\n\tpageTransition?: Transition\n}) {\n\tconst MotionComponent = useMemo(() => motion.create(as), [as]) as any\n\n\t/**\n\t * Derive drag constraints based on measurements.\n\t */\n\tlet dragConstraints: Record<string, number> = {}\n\tconst { maxInset } = state\n\tif (maxInset !== null) {\n\t\tif (axis === \"x\") {\n\t\t\tdragConstraints =\n\t\t\t\tsign > 0\n\t\t\t\t\t? { left: maxInset * -1, right: 0 }\n\t\t\t\t\t: { right: maxInset, left: 0 }\n\t\t} else {\n\t\t\tdragConstraints = { top: maxInset * -1, bottom: 0 }\n\t\t}\n\t}\n\n\tlet {\n\t\tdrag,\n\t\t_dragX,\n\t\t_dragY,\n\t\tdragMomentum = false,\n\t\tonDragEnd,\n\t\tonPointerDown,\n\t\t...remainingProps\n\t} = containerProps\n\tconst dragMotionValue = axis === \"x\" ? _dragX : _dragY\n\n\tconst dragMomentumAnimation = useRef<ReturnType<typeof animate> | null>(\n\t\tnull\n\t)\n\n\t/**\n\t * TODO: This should probably be accomplished with dragMotionValue.jump()\n\t * in the onPointerDown handler but investigate why this isn't working.\n\t */\n\tconst stopDragMomentumAnimation = () => {\n\t\tif (!dragMomentumAnimation.current) return\n\t\tdragMomentumAnimation.current.stop()\n\t\tdragMomentumAnimation.current = null\n\t}\n\n\tif (!onDragEnd && drag && dragMotionValue) {\n\t\tonPointerDown = () => {\n\t\t\tdragMotionValue.jump(offset.get())\n\t\t\tstopDragMomentumAnimation()\n\t\t}\n\n\t\tonDragEnd = (_e: PointerEvent, { velocity }: PanInfo) => {\n\t\t\tconst current = offset.get()\n\t\t\tstopDragMomentumAnimation()\n\n\t\t\tframe.postRender(() => {\n\t\t\t\tlet target = current + velocity[axis] * (snap ? 0.3 : 0.8)\n\n\t\t\t\tif (snap) {\n\t\t\t\t\tif (velocity[axis] < 0) {\n\t\t\t\t\t\ttarget = -findNextItemInset(\n\t\t\t\t\t\t\t-current,\n\t\t\t\t\t\t\tstate.itemPositions,\n\t\t\t\t\t\t\tgap,\n\t\t\t\t\t\t\t-target\n\t\t\t\t\t\t)\n\t\t\t\t\t} else if (velocity[axis] > 0) {\n\t\t\t\t\t\ttarget = -findPrevItemInset(\n\t\t\t\t\t\t\t-current,\n\t\t\t\t\t\t\tstate.itemPositions,\n\t\t\t\t\t\t\tgap,\n\t\t\t\t\t\t\t-target,\n\t\t\t\t\t\t\tstate.containerLength\n\t\t\t\t\t\t)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst closestNext = -findNextItemInset(\n\t\t\t\t\t\t\t-current,\n\t\t\t\t\t\t\tstate.itemPositions,\n\t\t\t\t\t\t\tgap,\n\t\t\t\t\t\t\t-current\n\t\t\t\t\t\t)\n\t\t\t\t\t\tconst closestPrev = -findPrevItemInset(\n\t\t\t\t\t\t\t-current,\n\t\t\t\t\t\t\tstate.itemPositions,\n\t\t\t\t\t\t\tgap,\n\t\t\t\t\t\t\t-current,\n\t\t\t\t\t\t\tstate.containerLength\n\t\t\t\t\t\t)\n\n\t\t\t\t\t\ttarget =\n\t\t\t\t\t\t\tMath.abs(current - closestNext) <\n\t\t\t\t\t\t\tMath.abs(current - closestPrev)\n\t\t\t\t\t\t\t\t? closestNext\n\t\t\t\t\t\t\t\t: closestPrev\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst constraints = loop\n\t\t\t\t\t? {}\n\t\t\t\t\t: sign > 0\n\t\t\t\t\t? {\n\t\t\t\t\t\t  max: 0,\n\t\t\t\t\t\t  min: dragConstraints[axis === \"x\" ? \"left\" : \"top\"],\n\t\t\t\t\t  }\n\t\t\t\t\t: {\n\t\t\t\t\t\t  min: 0,\n\t\t\t\t\t\t  max: dragConstraints.right,\n\t\t\t\t\t  }\n\n\t\t\t\tdragMomentumAnimation.current = animate(\n\t\t\t\t\tdragMotionValue,\n\t\t\t\t\tclampOffset!(target * sign) * sign,\n\t\t\t\t\tsnap\n\t\t\t\t\t\t? pageTransition\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t  type: \"inertia\",\n\t\t\t\t\t\t\t  velocity: velocity[axis],\n\t\t\t\t\t\t\t  modifyTarget: () => target,\n\t\t\t\t\t\t\t  bounceDamping: 40,\n\t\t\t\t\t\t\t  bounceStiffness: 400,\n\t\t\t\t\t\t\t  ...constraints,\n\t\t\t\t\t\t  }\n\t\t\t\t)\n\t\t\t})\n\t\t}\n\t}\n\n\t/**\n\t * Create mask image to fade edges out\n\t */\n\tconst fadeStartOpacity = useMotionValue(loop ? 0 : 1)\n\tconst fadeEndOpacity = useMotionValue(0)\n\tconst strategy = getLayoutStrategy(axis, state.direction)\n\tconst unit = typeof fade === \"number\" ? \"px\" : \"\"\n\tconst maskImage = useTransform(() => {\n\t\treturn `linear-gradient(to ${\n\t\t\tstrategy.direction\n\t\t}, rgba(0,0,0,${fadeStartOpacity.get()}) 0px, black ${fade}${unit}, black calc(100% - ${fade}${unit}), rgba(0,0,0,${fadeEndOpacity.get()}) 100%)`\n\t})\n\tconst fadeStyles = fade ? { maskImage, WebkitMaskImage: maskImage } : {}\n\tconst isAtLimits = useRef({ start: true, end: false })\n\tuseMotionValueEvent(renderedOffset, \"change\", (value: number) => {\n\t\tif (maxInset === null) return\n\t\tconst maxOffset = maxInset * -1\n\t\tvalue *= sign\n\n\t\t// Start edge\n\t\tif (value < 0) {\n\t\t\t// If it's currently at the limits, and moves, fade mask out\n\t\t\tif (isAtLimits.current.start) {\n\t\t\t\tanimate(fadeStartOpacity, 0, fadeTransition)\n\t\t\t\tisAtLimits.current.start = false\n\t\t\t}\n\t\t} else {\n\t\t\tif (!isAtLimits.current.start) {\n\t\t\t\tanimate(fadeStartOpacity, 1, fadeTransition)\n\t\t\t\tisAtLimits.current.start = true\n\t\t\t}\n\t\t}\n\n\t\t// End edge\n\t\tif (value > maxOffset) {\n\t\t\t// If it's currently at the limits, and moves, fade mask out\n\t\t\tif (isAtLimits.current.end) {\n\t\t\t\tanimate(fadeEndOpacity, 0, fadeTransition)\n\t\t\t\tisAtLimits.current.end = false\n\t\t\t}\n\t\t} else {\n\t\t\tif (!isAtLimits.current.end) {\n\t\t\t\tanimate(fadeEndOpacity, 1, fadeTransition)\n\t\t\t\tisAtLimits.current.end = true\n\t\t\t}\n\t\t}\n\t})\n\n\treturn (\n\t\t<>\n\t\t\t<MotionComponent\n\t\t\t\t{...remainingProps}\n\t\t\t\tref={containerRef}\n\t\t\t\tstyle={{\n\t\t\t\t\toverflowX: !overflow && axis === \"x\" ? \"clip\" : undefined,\n\t\t\t\t\toverflowY: !overflow && axis === \"y\" ? \"clip\" : undefined,\n\t\t\t\t\t...containerStyle,\n\t\t\t\t\t...containerProps.style,\n\t\t\t\t\t...fadeStyles,\n\t\t\t\t}}\n\t\t\t\tonPointerEnter={onPointerEnter}\n\t\t\t\tonPointerLeave={onPointerLeave}\n\t\t\t\tdrag={drag}\n\t\t\t\t_dragX={_dragX}\n\t\t\t\t_dragY={_dragY}\n\t\t\t\tdragConstraints={dragConstraints}\n\t\t\t\tdragMomentum={dragMomentum}\n\t\t\t\tonPointerDown={onPointerDown}\n\t\t\t\tonDragEnd={onDragEnd}\n\t\t\t>\n\t\t\t\t<motion.ul\n\t\t\t\t\tref={listRef}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\t...listStyle,\n\t\t\t\t\t\tflexDirection: axis === \"x\" ? \"row\" : \"column\",\n\t\t\t\t\t\tgap: `${gap}px`,\n\t\t\t\t\t\tx: axis === \"x\" ? renderedOffset : 0,\n\t\t\t\t\t\ty: axis === \"y\" ? renderedOffset : 0,\n\t\t\t\t\t\topacity: isMeasured || isStatic ? 1 : 0,\n\t\t\t\t\t\talignItems,\n\t\t\t\t\t\twillChange:\n\t\t\t\t\t\t\tisMeasured && isInView ? \"transform\" : undefined,\n\t\t\t\t\t\twidth: \"100%\",\n\t\t\t\t\t\theight: \"100%\",\n\t\t\t\t\t\tmaxHeight: \"100%\",\n\t\t\t\t\t\tmaxWidth: \"100%\",\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{items.map((item, index) => (\n\t\t\t\t\t\t<TickerItemWrapper\n\t\t\t\t\t\t\tkey={\"original-\" + index}\n\t\t\t\t\t\t\taxis={axis}\n\t\t\t\t\t\t\toffset={renderedOffset}\n\t\t\t\t\t\t\tlistSize={totalListSize}\n\t\t\t\t\t\t\titemIndex={index}\n\t\t\t\t\t\t\tbounds={state.itemPositions[index] ?? defaultBounds}\n\t\t\t\t\t\t\talignItems={alignItems}\n\t\t\t\t\t\t\tsize={itemSize}\n\t\t\t\t\t\t\treproject={loop}\n\t\t\t\t\t\t\tsafeMargin={safeMargin}\n\t\t\t\t\t\t\tnumItems={items.length}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{item}\n\t\t\t\t\t\t</TickerItemWrapper>\n\t\t\t\t\t))}\n\t\t\t\t\t{clonedItems || null}\n\t\t\t\t</motion.ul>\n\t\t\t</MotionComponent>{\" \"}\n\t\t\t{children}\n\t\t</>\n\t)\n}\n\nfunction invariant(condition: boolean, message: string) {\n\tif (!condition) {\n\t\tthrow new Error(message)\n\t}\n}\n\nconst defaultBounds = { start: 0, end: 0 }\n\nconst containerStyle: React.CSSProperties = {\n\tdisplay: \"flex\",\n\tposition: \"relative\",\n}\n\nconst listStyle: React.CSSProperties = {\n\tdisplay: \"flex\",\n\tposition: \"relative\",\n\twillChange: \"transform\",\n\tlistStyleType: \"none\",\n\tpadding: 0,\n\tmargin: 0,\n\tjustifyContent: \"flex-start\",\n}\n\nconst defaultFadeTransition: Transition = {\n\tduration: 0.2,\n\tease: \"linear\",\n}\n", "import { motion, useAnimationFrame, useMotionValue } from \"framer-motion\"\nimport { type PropsWithChildren, forwardRef, useEffect, useRef } from \"react\"\nimport { useLayoutDirection } from \"../../router/useLocale.ts\"\nimport type { TickerSubComponentProps } from \"./Ticker.tsx\"\nimport { Ticker as MotionPlusTicker } from \"./motionplus/Ticker.tsx\"\n\nexport const DraggableTicker = /* @__PURE__ */ forwardRef(function DraggableTicker(\n\tprops: PropsWithChildren<TickerSubComponentProps>,\n\tref: React.Ref<HTMLDivElement>,\n) {\n\tconst {\n\t\tchildren,\n\t\tas: asProp,\n\t\ttickerEffectVelocity,\n\t\ttickerEffectAlign,\n\t\taxis,\n\t\tdirectionModifier,\n\t\thoverModifier,\n\t\tgap,\n\t\toverflow,\n\t\tplayState,\n\t\t...rest\n\t} = props\n\tconst Component = asProp ?? motion.div\n\n\tconst layoutDirection = useLayoutDirection()\n\t// if the layout direction is rtl and the ticker is horizontal then we reverse the auto scroll direction to match the standard ticker autoscroll behavior\n\tconst layoutDirectionModifier = layoutDirection === \"rtl\" && axis === \"x\" ? -1 : 1\n\tconst baseVelocity = playState === \"paused\" ? 0 : (tickerEffectVelocity ?? 100)\n\tconst targetVelocity = baseVelocity * directionModifier * layoutDirectionModifier\n\n\tconst offsetMotionValue = useMotionValue(0)\n\tconst lastDrag = useRef(0)\n\tconst dragMomentum = useRef(false)\n\tconst isHovering = useRef(false)\n\tconst isDragging = useRef(false)\n\n\t// Prevent click actions being triggered on children during drag\n\t// e.g. ticker item contains link and it shouldn't be triggered on drag end\n\tconst handleClickCapture = (event: React.MouseEvent) => {\n\t\tif (!isDragging.current) return\n\n\t\t// Check if the click target is a link or inside a link\n\t\tif (event.target && event.target !== event.currentTarget) {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t}\n\t}\n\n\tuseAnimationFrame((_, delta) => {\n\t\tconst velocity = Math.abs(offsetMotionValue.getVelocity())\n\t\tconst currentTargetVelocity = isHovering.current ? targetVelocity * hoverModifier : targetVelocity\n\t\tif (performance.now() > lastDrag.current && (!dragMomentum.current || velocity < Math.abs(currentTargetVelocity))) {\n\t\t\tconst frameOffset = (delta / 1000) * currentTargetVelocity\n\t\t\tconst updated = offsetMotionValue.get() - frameOffset\n\t\t\tif (dragMomentum.current) {\n\t\t\t\toffsetMotionValue.stop()\n\t\t\t\tdragMomentum.current = false\n\t\t\t}\n\t\t\toffsetMotionValue.set(updated)\n\t\t}\n\t})\n\n\tuseEffect(() => {\n\t\tif (playState === \"paused\") {\n\t\t\toffsetMotionValue.stop()\n\t\t}\n\t}, [playState, offsetMotionValue])\n\n\treturn (\n\t\t<MotionPlusTicker\n\t\t\tref={ref}\n\t\t\tas={Component}\n\t\t\t{...rest}\n\t\t\tgap={gap}\n\t\t\taxis={axis}\n\t\t\talign={tickerEffectAlign ?? \"center\"}\n\t\t\titemSize=\"manual\"\n\t\t\toverflow={overflow}\n\t\t\t_dragX={axis === \"x\" ? offsetMotionValue : undefined}\n\t\t\t_dragY={axis === \"y\" ? offsetMotionValue : undefined}\n\t\t\toffset={offsetMotionValue}\n\t\t\tdrag={axis}\n\t\t\tdragMomentum\n\t\t\tonClickCapture={handleClickCapture}\n\t\t\tonDragStart={() => {\n\t\t\t\tisDragging.current = true\n\t\t\t}}\n\t\t\tonDragEnd={() => {\n\t\t\t\tlastDrag.current = performance.now()\n\t\t\t\tdragMomentum.current = true\n\t\t\t\t// Clear the flag after a short delay to allow normal clicks when not dragging\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tisDragging.current = false\n\t\t\t\t}, 5)\n\t\t\t}}\n\t\t\tonMouseEnter={() => {\n\t\t\t\tisHovering.current = true\n\t\t\t}}\n\t\t\tonMouseLeave={() => {\n\t\t\t\tisHovering.current = false\n\t\t\t}}\n\t\t/>\n\t)\n})\n", "import { type PropsWithChildren, createContext, startTransition, useMemo } from \"react\"\n\nexport type TickerPlayState = \"running\" | \"paused\"\nexport interface TickerContextType {\n\tstart: () => void\n\tstop: () => void\n}\nexport const TickerContext = /* @__PURE__ */ (() => {\n\tconst Context = createContext<TickerContextType | undefined>(undefined)\n\tContext.displayName = \"TickerContext\"\n\treturn Context\n})()\n\nexport const TickerContextProvider = ({\n\tonPlayStateChange,\n\tchildren,\n}: PropsWithChildren<{ onPlayStateChange: (playState: TickerPlayState) => void }>) => {\n\tconst value = useMemo<TickerContextType>(\n\t\t() => ({\n\t\t\tstart: () => startTransition(() => onPlayStateChange(\"running\")),\n\t\t\tstop: () => startTransition(() => onPlayStateChange(\"paused\")),\n\t\t}),\n\t\t[onPlayStateChange],\n\t)\n\n\treturn <TickerContext.Provider value={value}>{children}</TickerContext.Provider>\n}\n", "import type { PropsWithChildren } from \"react\"\nimport { Ticker, type TickerProps } from \"../render/presentation/Ticker.tsx\"\n\nexport const withTickerFX = <T extends PropsWithChildren<TickerProps> & Record<string, unknown>>(\n\tComponent: React.ComponentType<T>,\n) => {\n\treturn (props: T) => {\n\t\tif (props.tickerEffectEnabled) {\n\t\t\treturn <Ticker {...props} as={Component} />\n\t\t}\n\n\t\treturn <Component {...props} />\n\t}\n}\n", "import { LayoutGroup, MotionConfig, type MotionProps, type Transition } from \"framer-motion\"\nimport React, { useMemo } from \"react\"\n\ntype FlowEffectProps = {\n\tflowEffectEnabled?: boolean\n\tflowEffectTransition?: Transition\n\tisNestedFlowEffect?: boolean\n} & Partial<Omit<MotionProps, \"children\">> & { children: React.ReactNode }\n\nexport const withFlowFX = <T extends FlowEffectProps>(\n\tComponent: React.ComponentType<Omit<T, \"flowEffectEnabled\" | \"flowEffectTransition\">>,\n) =>\n\tReact.forwardRef((props: T, forwardedRef: React.RefObject<HTMLElement> | null) => {\n\t\tconst { flowEffectEnabled, flowEffectTransition, isNestedFlowEffect, transition, ...forwardedProps } = props\n\t\tconst mergedTransition = useMemo(\n\t\t\t() =>\n\t\t\t\tflowEffectTransition\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tdefault: transition,\n\t\t\t\t\t\t\tlayout: flowEffectTransition,\n\t\t\t\t\t\t}\n\t\t\t\t\t: transition,\n\t\t\t[transition, flowEffectTransition],\n\t\t)\n\n\t\tif (!flowEffectEnabled) {\n\t\t\treturn <Component {...(forwardedProps as T)} ref={forwardedRef} transition={transition} />\n\t\t}\n\n\t\tlet componentWithFlowEffect = <Component {...(forwardedProps as T)} ref={forwardedRef} />\n\t\t// If there's no transition we allow the ancestor transition to be inherited\n\t\tif (flowEffectTransition) {\n\t\t\tcomponentWithFlowEffect = <MotionConfig transition={mergedTransition}>{componentWithFlowEffect}</MotionConfig>\n\t\t}\n\t\t// If we're already inside a layout group effect then we don't need an extra LayoutGroup, the effect will\n\t\t// just set the layout prop on its children to support layout animations\n\t\tif (!isNestedFlowEffect) {\n\t\t\tcomponentWithFlowEffect = <LayoutGroup>{componentWithFlowEffect}</LayoutGroup>\n\t\t}\n\n\t\treturn componentWithFlowEffect\n\t})\n", "import type React from \"react\"\nimport { asRecord } from \"../utils/asRecord.ts\"\n\n/**\n * All code generated by Framer inlines its annotations as an exported object\n * that can be accessed. The shape of that object is stable, but could change in\n * future. This property access path is hardcoded to make sure that code that is\n * already generated never stops working. If the shape of the annotation\n * changes, this accessing of the value will also need to change at the same\n * time, but this code needs to remain backwards compatible so that old\n * code-generation is not effected.\n */\nfunction extractMappingFromInfo(info: Record<string, any>): Record<string, string> | undefined {\n\tconst json = info.__FramerMetadata__.exports.default.annotations?.framerVariables\n\tif (!json) return undefined\n\ttry {\n\t\treturn JSON.parse(json)\n\t} catch {\n\t\treturn undefined\n\t}\n}\n\n/**\n * Smart Component instances are code-generated with immutable react property\n * keys. This ensures that renaming or reordering variables in Framer, doesn't\n * cause dependents of the Smart Component to provide incorrect values to the\n * new component.\n *\n * However, when a user adds a code override to a smart component, they expect\n * to be able to reference the props by their human readable name. To allow\n * that, this HOC can be wrapped around all of the override HOCs, and when\n * provided an object with ids that map to the human readable property, will\n * remap the props so that those human readable keys are used instead of the\n * immutable ids, and this remapped version of props can be consumed by all user\n * overrides.\n */\nexport function withMappedReactProps<T extends object>(\n\tComponent: React.ComponentType<T>,\n\tinfo: Record<string, unknown>,\n) {\n\treturn (rawProps: T) => {\n\t\tconst props = {} as T\n\t\tconst mapping = extractMappingFromInfo(info)\n\t\tfor (const key in rawProps) {\n\t\t\tasRecord(props)[mapping?.[key] ?? key] = rawProps[key]\n\t\t}\n\n\t\treturn <Component {...props} />\n\t}\n}\n", "export type Vec2 = [number, number]\nexport type Vec4 = [number, number, number, number]\n\nexport const uniformPrefix = \"u_\"\nexport type UniformName = `${typeof uniformPrefix}${string}`\nexport type UniformValue =\n\t| {\n\t\t\ttype: \"float\"\n\t\t\tvalue: number\n\t  }\n\t| {\n\t\t\ttype: \"boolean\"\n\t\t\tvalue: boolean\n\t  }\n\t| {\n\t\t\ttype: \"int\"\n\t\t\tvalue: number\n\t  }\n\t| {\n\t\t\ttype: \"vec2\"\n\t\t\tvalue: Vec2\n\t  }\n\t| {\n\t\t\ttype: \"vec4\"\n\t\t\tvalue: Vec4\n\t  }\n\t| {\n\t\t\ttype: \"sampler2D\"\n\t\t\tvalue: TexImageSource\n\t  }\n\t| {\n\t\t\ttype: \"vec4[]\"\n\t\t\tvalue: Vec4[]\n\t  }\n\ninterface TextureEntry {\n\ttexture: WebGLTexture\n\timage: TexImageSource | null\n}\n\nconst supportedBufferFormats = [\"rgba8\", \"r8\", \"rg16f\", \"rgba16f\", \"rgba32f\"] as const\n\n/**\n * Internal pixel format for a buffer's render target.\n *\n * Choose the narrowest format that fits what the buffer actually stores \u2014 narrower\n * formats save memory bandwidth (meaningful perf on fullscreen passes), wider formats\n * avoid quantization for state that accumulates over time.\n *\n * - `\"rgba8\"` \u2014 4 channels, 8-bit normalized [0,1]. **Default.** Color trails, blur\n *   intermediates, composites, anything storing perceptual color. Cheapest 4-channel.\n * - `\"r8\"` \u2014 1 channel, 8-bit normalized. Masks, alpha-only fields, single-channel\n *   intensity, halftone-style state. **4\u00D7 less bandwidth than `rgba8`** \u2014 pick this\n *   whenever a buffer only needs one channel.\n * - `\"rg16f\"` \u2014 2 channels, 16-bit float. 2D vector fields: mouse displacement,\n *   velocity, flow direction. Stores signed values cleanly with no `(v * 0.5 + 0.5)`\n *   round-trip. Requires `EXT_color_buffer_float`.\n * - `\"rgba16f\"` \u2014 4 channels, 16-bit float. HDR color, precision-sensitive 4-channel\n *   state, light/bloom accumulation. Requires `EXT_color_buffer_float`.\n * - `\"rgba32f\"` \u2014 4 channels, 32-bit float. Long accumulation chains where 16-bit\n *   error compounds (fluid sim, reaction-diffusion). Most precision and most\n *   bandwidth \u2014 use only when 16f genuinely isn't enough. Requires\n *   `EXT_color_buffer_float`.\n */\nexport type ShaderBufferFormat = (typeof supportedBufferFormats)[number]\n\n/** Read-only view of the format catalog. */\nexport const shaderBufferFormats: ReadonlySet<ShaderBufferFormat> = /* @__PURE__ */ new Set(supportedBufferFormats)\n\n/** Built-in uniforms automatically provided to every pass (main and buffers). */\nexport const builtInUniforms = {\n\ttime: { name: \"u_time\", glslType: \"float\" },\n\tresolution: { name: \"u_resolution\", glslType: \"vec2\" },\n\tdeltaTime: { name: \"u_deltaTime\", glslType: \"float\" },\n\tpixelRatio: { name: \"u_pixelRatio\", glslType: \"float\" },\n\tmousePosition: { name: \"u_mousePosition\", glslType: \"vec4\" },\n\tmousePointerDown: { name: \"u_mousePointerDown\", glslType: \"float\" },\n\tmouseHover: { name: \"u_mouseHover\", glslType: \"float\" },\n} as const\n\ntype BuiltInUniformName = (typeof builtInUniforms)[keyof typeof builtInUniforms][\"name\"]\n\ntype MouseInput = { position: Vec4; pointerDown: number; hover: number }\n\nconst webGLContextLostEvent = \"webglcontextlost\"\n\nconst noop = () => {}\n\n/**\n * Resolved buffer descriptor \u2014 what flows through the renderer and runtime types after\n * `defineShader` has run. All fields are required: defaults are applied during prep.\n */\nexport interface BufferDescriptor {\n\t/** GLSL uniform identifier (`u_<name>_buffer`); used for `gl.getUniformLocation` lookups. */\n\tuniformName: UniformName\n\t/** Fragment shader source for this pass, with the auto-generated head prepended. */\n\tfragment: string\n\tresolutionScale: number\n\tformat: ShaderBufferFormat\n}\n\n/**\n * The complete set of GL resources owned by a constructed renderer. Assembled atomically\n * by `buildResources()` \u2014 either fully populated or the partial allocations are cleaned up and\n * the throw propagates. Render methods receive this as a parameter so they never have to\n * check for the absence of individual fields.\n */\ninterface GLResources {\n\tpositionBuffer: WebGLBuffer\n\ttexCoordBuffer: WebGLBuffer\n\tmainPass: PassState\n\tbufferPasses: BufferPass[]\n}\n\n/** Per-pass GL state shared by the main pass and every buffer pass. */\ninterface PassState {\n\tprogram: WebGLProgram\n\tvao: WebGLVertexArrayObject\n\tbuiltInLocations: Record<BuiltInUniformName, WebGLUniformLocation | null>\n\tcustomLocations: Map<string, WebGLUniformLocation | null>\n\tbufferSamplerLocations: Map<string, WebGLUniformLocation | null>\n}\n\n/**\n * GL state for one buffer pass, augmenting `PassState` with the ping-pong textures,\n * FBOs, size, and format.\n */\ninterface BufferPass extends PassState {\n\tuniformName: UniformName\n\tresolutionScale: number\n\t/** Original `ShaderBufferFormat` string. Kept for diagnostic messages (e.g. FBO completeness errors). */\n\tformat: ShaderBufferFormat\n\t/** Internal storage format passed as `texImage2D`'s `internalformat` (e.g. `gl.R8`, `gl.RGBA16F`). */\n\tinternalFormat: GLenum\n\t/** Pixel-data layout passed as `texImage2D`'s `format` (e.g. `gl.RED`, `gl.RG`, `gl.RGBA`). */\n\tuploadFormat: GLenum\n\t/** Pixel-data type passed as `texImage2D`'s `type` (e.g. `gl.UNSIGNED_BYTE`, `gl.HALF_FLOAT`, `gl.FLOAT`). */\n\tpixelType: GLenum\n\twidth: number\n\theight: number\n\ttextures: [WebGLTexture, WebGLTexture]\n\tfbos: [WebGLFramebuffer, WebGLFramebuffer]\n\t/**\n\t * Index (0 or 1) of the texture this pass will write to next.\n\t * The \"current\" / last-written texture is `textures[1 - writeIdx]`.\n\t */\n\twriteIdx: 0 | 1\n\t/** Reserved texture unit. The buffer's \"current\" texture stays bound here for the whole frame. */\n\ttextureUnit: number\n}\n\n/**\n * Encapsulates all WebGL operations for rendering custom fragment shaders, including\n * optional multi-pass buffers (ping-pong FBOs with cross-buffer sampling). Handles\n * context creation, shader compilation, and rendering lifecycle.\n */\nexport class WebGL2ShaderRenderer {\n\tprivate gl: WebGL2RenderingContext\n\tprivate canvas: HTMLCanvasElement | OffscreenCanvas\n\tprivate contextLostHandler: (event: Event) => void\n\tprivate disposed = false\n\tprivate pixelRatio = typeof window !== \"undefined\" ? window.devicePixelRatio : 1\n\tprivate resolutionScale: number\n\tprivate lastBufferWidth = 0\n\tprivate lastBufferHeight = 0\n\tprivate onContextLost: (() => void) | undefined\n\n\tprivate resources: GLResources\n\tprivate textures: Map<string, TextureEntry> = new Map()\n\n\t/** First texture unit available for custom samplers. Buffers occupy `[0, n)`; customs follow. */\n\tprivate get customTextureUnitBase(): number {\n\t\treturn this.resources.bufferPasses.length\n\t}\n\n\tconstructor(\n\t\tcanvas: HTMLCanvasElement | OffscreenCanvas,\n\t\tvertexSource: string,\n\t\tfragmentSource: string,\n\t\tresolutionScale: number,\n\t\tonContextLostHandler: (() => void) | undefined = noop,\n\t\tbufferDescriptors: readonly BufferDescriptor[] = [],\n\t) {\n\t\tthis.resolutionScale = resolutionScale\n\t\tthis.canvas = canvas\n\t\tthis.onContextLost = onContextLostHandler\n\n\t\tconst gl = canvas.getContext(\"webgl2\", {\n\t\t\talpha: true,\n\t\t\tpremultipliedAlpha: false,\n\t\t\tantialias: false,\n\t\t\tpowerPreference: \"default\",\n\t\t\tpreserveDrawingBuffer: canvas instanceof OffscreenCanvas,\n\t\t}) as unknown as WebGL2RenderingContext | null // Complains in dev mode\n\n\t\tif (!gl) {\n\t\t\tthrow new Error(\"WebGL2 not supported\")\n\t\t}\n\n\t\tthis.gl = gl\n\n\t\t// The context can be lost any time after this point.\n\t\t// If `buildResources` throws below, the catch unregisters it so the canvas\n\t\t// doesn't retain the failed renderer via the listener closure.\n\t\tthis.contextLostHandler = (event: Event) => {\n\t\t\tevent.preventDefault()\n\t\t\tthis.dispose()\n\t\t\tthis.onContextLost?.()\n\t\t}\n\t\tcanvas.addEventListener(webGLContextLostEvent, this.contextLostHandler)\n\n\t\t// `buildResources` is atomic: it either returns a fully-assembled `GLResources` or\n\t\t// cleans up its own partial allocations and rethrows.\n\t\ttry {\n\t\t\tthis.resources = this.buildResources(vertexSource, fragmentSource, bufferDescriptors)\n\t\t} catch (error) {\n\t\t\tcanvas.removeEventListener(webGLContextLostEvent, this.contextLostHandler)\n\t\t\tthrow error\n\t\t}\n\n\t\tconst { mainPass, bufferPasses } = this.resources\n\t\t// Set clear color once - it never changes (transparent black)\n\t\tgl.clearColor(0, 0, 0, 0)\n\n\t\t// In the no-buffer hot path we never switch program or VAO, so bind once here and\n\t\t// the per-frame draw avoids redundant `useProgram` / `bindVertexArray` calls.\n\t\tif (bufferPasses.length === 0) {\n\t\t\t// biome-ignore lint/correctness/useHookAtTopLevel: linters incorrectly recognize `useProgram` as a hook\n\t\t\tgl.useProgram(mainPass.program)\n\t\t\tgl.bindVertexArray(mainPass.vao)\n\t\t}\n\t}\n\n\t/**\n\t * Allocates every GL resource the renderer needs and returns them as a `GLResources`.\n\t * If any step throws, the catch deletes whatever was allocated up to that point before\n\t * rethrowing \u2014 so the constructor never has to know about partial state.\n\t */\n\tprivate buildResources(\n\t\tvertexSource: string,\n\t\tfragmentSource: string,\n\t\tbufferDescriptors: readonly BufferDescriptor[],\n\t): GLResources {\n\t\tconst { gl, canvas } = this\n\n\t\tconst offendingFloatBuffer = bufferDescriptors.find(d => shaderBufferFormatRequiresFloatExt(d.format))\n\t\tif (offendingFloatBuffer && !gl.getExtension(\"EXT_color_buffer_float\")) {\n\t\t\tthrow new Error(\n\t\t\t\t`Shader buffer \"${offendingFloatBuffer.uniformName}\" requested format \"${offendingFloatBuffer.format}\" but the EXT_color_buffer_float extension is not available.`,\n\t\t\t)\n\t\t}\n\t\t// `LINEAR` filtering on float textures requires OES_texture_float_linear; without it,\n\t\t// those samplers are incomplete and return black even when the FBO allocates fine.\n\t\t// We don't throw \u2014 float buffers are useful for vector fields where users may not\n\t\t// rely on smoothing \u2014 but float formats fall back to NEAREST when it's missing.\n\t\t// https://developer.mozilla.org/en-US/docs/Web/API/OES_texture_float_linear\n\t\tconst hasFloatLinear = !offendingFloatBuffer || !!gl.getExtension(\"OES_texture_float_linear\")\n\n\t\tconst vertexShader = this.compileShader(gl.VERTEX_SHADER, vertexSource)\n\t\tlet mainProgram: WebGLProgram | undefined\n\t\tconst bufferProgramPairs: [WebGLProgram, BufferDescriptor][] = []\n\t\tlet positionBuffer: WebGLBuffer | undefined\n\t\tlet texCoordBuffer: WebGLBuffer | undefined\n\t\tlet mainPass: PassState | undefined\n\t\tconst bufferPasses: BufferPass[] = []\n\n\t\ttry {\n\t\t\tmainProgram = this.linkFragmentProgram(vertexShader, fragmentSource)\n\t\t\tfor (const desc of bufferDescriptors) {\n\t\t\t\tbufferProgramPairs.push([this.linkFragmentProgram(vertexShader, desc.fragment), desc])\n\t\t\t}\n\n\t\t\t// Shared fullscreen-quad geometry. One position buffer + one texCoord buffer reused by every VAO.\n\t\t\tpositionBuffer = createStaticArrayBuffer(gl, new Float32Array([-1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1]))\n\t\t\ttexCoordBuffer = createStaticArrayBuffer(gl, new Float32Array([0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1]))\n\n\t\t\tmainPass = this.buildPassState(mainProgram, bufferDescriptors, positionBuffer, texCoordBuffer)\n\t\t\t// Buffers reserve a contiguous block of texture units starting at 0. Each one's\n\t\t\t// \"current\" texture stays pinned to its unit for the whole frame, which is what\n\t\t\t// `bindStaticSamplerUnits` relies on to wire sampler uniforms once at construction.\n\t\t\t// Custom samplers (image controls, heightmap) start at `customTextureUnitBase`.\n\t\t\tfor (let textureUnit = 0; textureUnit < bufferProgramPairs.length; textureUnit++) {\n\t\t\t\tconst pair = bufferProgramPairs[textureUnit]\n\t\t\t\tif (!pair) continue\n\t\t\t\tconst [program, desc] = pair\n\t\t\t\tbufferPasses.push(\n\t\t\t\t\tthis.buildBufferPass(\n\t\t\t\t\t\tprogram,\n\t\t\t\t\t\tdesc,\n\t\t\t\t\t\tbufferDescriptors,\n\t\t\t\t\t\thasFloatLinear,\n\t\t\t\t\t\ttextureUnit,\n\t\t\t\t\t\tpositionBuffer,\n\t\t\t\t\t\ttexCoordBuffer,\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t}\n\n\t\t\t// Allocate buffer textures + FBOs at the canvas's current size. `resize()` will\n\t\t\t// reallocate when the actual size becomes known.\n\t\t\tthis.allocateBufferPassStorages(bufferPasses, canvas.width, canvas.height)\n\n\t\t\t// Sampler-uniform-to-texture-unit bindings never change after compile, so set them once.\n\t\t\t// Each buffer's \"current\" texture stays bound to its reserved unit for the entire frame,\n\t\t\t// so per-frame `gl.uniform1i` calls for these sampler bindings are unnecessary.\n\t\t\tthis.bindStaticSamplerUnits(mainPass, bufferPasses)\n\n\t\t\treturn { positionBuffer, texCoordBuffer, mainPass, bufferPasses }\n\t\t} catch (error) {\n\t\t\t// Roll back in reverse-allocation order. `disposePass` / `disposeBufferPass` own\n\t\t\t// the programs + VAOs they wrap, so any program not yet wrapped is deleted manually.\n\t\t\tfor (const bufferPass of bufferPasses) {\n\t\t\t\tthis.disposeBufferPass(bufferPass)\n\t\t\t}\n\t\t\tfor (let i = bufferPasses.length; i < bufferProgramPairs.length; i++) {\n\t\t\t\tconst pair = bufferProgramPairs[i]\n\t\t\t\tif (pair) {\n\t\t\t\t\tgl.deleteProgram(pair[0])\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (mainPass) {\n\t\t\t\tthis.disposePass(mainPass)\n\t\t\t} else if (mainProgram) {\n\t\t\t\tgl.deleteProgram(mainProgram)\n\t\t\t}\n\t\t\tif (texCoordBuffer) {\n\t\t\t\tgl.deleteBuffer(texCoordBuffer)\n\t\t\t}\n\t\t\tif (positionBuffer) {\n\t\t\t\tgl.deleteBuffer(positionBuffer)\n\t\t\t}\n\t\t\tthrow error\n\t\t} finally {\n\t\t\t// Linked programs retain their own reference to the vertex shader, so it can be\n\t\t\t// released as soon as linking finishes \u2014 on the success path (no longer needed)\n\t\t\t// and on the catch path (any partial programs were already deleted above).\n\t\t\tgl.deleteShader(vertexShader)\n\t\t}\n\t}\n\n\t/**\n\t * Renders a frame with the given timing, optional custom uniforms, and mouse input.\n\t * Branches on whether any buffers are configured: the no-buffer path is a single\n\t * draw with program + VAO already bound from construction; the multi-pass path\n\t * walks each buffer's FBO in declaration order before drawing the main pass.\n\t */\n\trender(\n\t\telapsedTime: number,\n\t\tdeltaTime: number,\n\t\tuniforms: Record<UniformName, UniformValue> | undefined,\n\t\tmouseInput: MouseInput,\n\t): void {\n\t\tif (this.disposed) return\n\t\tif (this.resources.bufferPasses.length === 0) {\n\t\t\tthis.renderSinglePass(elapsedTime, deltaTime, uniforms, mouseInput)\n\t\t\treturn\n\t\t}\n\t\tthis.renderMultiPass(elapsedTime, deltaTime, uniforms, mouseInput)\n\t}\n\n\t/**\n\t * No-buffer hot path: program + VAO are bound once at construction, so each frame\n\t * is just built-ins + custom uniforms + clear + draw.\n\t */\n\tprivate renderSinglePass(\n\t\telapsedTime: number,\n\t\tdeltaTime: number,\n\t\tuniforms: Record<UniformName, UniformValue> | undefined,\n\t\tmouseInput: MouseInput,\n\t): void {\n\t\tconst {\n\t\t\tgl,\n\t\t\tcanvas,\n\t\t\tresources: { mainPass },\n\t\t} = this\n\t\tthis.updatePassBuiltIns(mainPass, elapsedTime, deltaTime, mouseInput, canvas.width, canvas.height)\n\t\tthis.applyCustomUniforms(mainPass, uniforms, this.customTextureUnitBase)\n\t\tgl.clear(gl.COLOR_BUFFER_BIT)\n\t\tgl.drawArrays(gl.TRIANGLES, 0, 6)\n\t}\n\n\t/**\n\t * Multi-pass render: each buffer in declaration order draws into its own FBO, with\n\t * its just-written texture re-pinned to its reserved unit so later buffers (and the\n\t * main pass) see the latest output. The main pass draws to the default framebuffer\n\t * with every buffer texture still bound.\n\t */\n\tprivate renderMultiPass(\n\t\telapsedTime: number,\n\t\tdeltaTime: number,\n\t\tuniforms: Record<UniformName, UniformValue> | undefined,\n\t\tmouseInput: MouseInput,\n\t): void {\n\t\tconst {\n\t\t\tgl,\n\t\t\tcanvas,\n\t\t\tresources: { mainPass, bufferPasses },\n\t\t\tcustomTextureUnitBase,\n\t\t} = this\n\n\t\t// Re-pin each buffer's \"current\" texture to its reserved unit. After each buffer\n\t\t// renders, this is repeated below to swap in the just-written texture, so by the\n\t\t// time the main pass runs every reserved unit holds the latest output.\n\t\tfor (const bufferPass of bufferPasses) {\n\t\t\tgl.activeTexture(gl.TEXTURE0 + bufferPass.textureUnit)\n\t\t\tgl.bindTexture(gl.TEXTURE_2D, bufferPass.textures[bufferPass.writeIdx === 0 ? 1 : 0])\n\t\t}\n\n\t\tfor (const bufferPass of bufferPasses) {\n\t\t\t// biome-ignore lint/correctness/useHookAtTopLevel: linters incorrectly recognize `useProgram` as a hook\n\t\t\tgl.useProgram(bufferPass.program)\n\t\t\tgl.bindVertexArray(bufferPass.vao)\n\t\t\tthis.updatePassBuiltIns(bufferPass, elapsedTime, deltaTime, mouseInput, bufferPass.width, bufferPass.height)\n\t\t\tthis.applyCustomUniforms(bufferPass, uniforms, customTextureUnitBase)\n\n\t\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, bufferPass.fbos[bufferPass.writeIdx])\n\t\t\tgl.viewport(0, 0, bufferPass.width, bufferPass.height)\n\t\t\tgl.clear(gl.COLOR_BUFFER_BIT)\n\t\t\tgl.drawArrays(gl.TRIANGLES, 0, 6)\n\n\t\t\t// Flip ping-pong: the just-written texture becomes the new \"current\". Re-pin so\n\t\t\t// downstream passes (later buffers and main) sample the latest output.\n\t\t\tgl.activeTexture(gl.TEXTURE0 + bufferPass.textureUnit)\n\t\t\tgl.bindTexture(gl.TEXTURE_2D, bufferPass.textures[bufferPass.writeIdx])\n\t\t\tbufferPass.writeIdx = bufferPass.writeIdx === 0 ? 1 : 0\n\t\t}\n\n\t\t// biome-ignore lint/correctness/useHookAtTopLevel: linters incorrectly recognize `useProgram` as a hook\n\t\tgl.useProgram(mainPass.program)\n\t\tgl.bindVertexArray(mainPass.vao)\n\t\tthis.updatePassBuiltIns(mainPass, elapsedTime, deltaTime, mouseInput, canvas.width, canvas.height)\n\t\tthis.applyCustomUniforms(mainPass, uniforms, customTextureUnitBase)\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, null)\n\t\tgl.viewport(0, 0, canvas.width, canvas.height)\n\t\tgl.clear(gl.COLOR_BUFFER_BIT)\n\t\tgl.drawArrays(gl.TRIANGLES, 0, 6)\n\t}\n\n\t/**\n\t * Syncs the canvas buffer and viewport to match display size, accounting for device pixel ratio.\n\t * Each buffer's render target resizes alongside (its size = canvas size \u00D7 buffer.resolutionScale).\n\t */\n\tresize(): void {\n\t\tif (this.disposed) return\n\n\t\tconst { canvas } = this\n\t\tif (canvas instanceof OffscreenCanvas) {\n\t\t\tthrow new Error(\"resize() is not supported for OffscreenCanvas.\")\n\t\t}\n\n\t\t// offsetWidth/offsetHeight reflect layout size, unaffected by CSS\n\t\t// transforms. On the canvas editor, zoom is applied via CSS scale()\n\t\t// which changes getBoundingClientRect() but not offset dimensions.\n\t\t// Always rendering at the designed size ensures consistent output for\n\t\t// resolution-dependent shaders while capping the buffer when zoomed in.\n\t\tconst cssWidth = canvas.offsetWidth\n\t\tconst cssHeight = canvas.offsetHeight\n\n\t\tconst dpr = window.devicePixelRatio\n\t\t// Clamp to 1.0 so we never render below CSS pixel resolution on DPR 1 screens.\n\t\t// Performance gains come from high-DPI screens where there are excess pixels to spare.\n\t\tconst effectiveDpr = Math.max(dpr * this.resolutionScale, 1)\n\t\tthis.pixelRatio = effectiveDpr\n\n\t\tconst width = cssWidth * effectiveDpr\n\t\tconst height = cssHeight * effectiveDpr\n\n\t\tif (width === this.lastBufferWidth && height === this.lastBufferHeight) return\n\n\t\tthis.lastBufferWidth = width\n\t\tthis.lastBufferHeight = height\n\t\tcanvas.width = width\n\t\tcanvas.height = height\n\n\t\tthis.gl.viewport(0, 0, width, height)\n\n\t\t// `allocateBufferPassStorage` can throw mid-resize (e.g. an FBO comes back incomplete at\n\t\t// the new size), leaving some buffers resized and others not \u2014 an inconsistent state\n\t\t// that later resize/render calls would keep hitting. Self-dispose so the renderer\n\t\t// settles into a known-dead state and callers can react via `disposed` or the rethrown\n\t\t// error without seeing the half-resized in-between.\n\t\ttry {\n\t\t\tthis.allocateBufferPassStorages(this.resources.bufferPasses, width, height)\n\t\t} catch (error) {\n\t\t\tthis.dispose()\n\t\t\tthrow error\n\t\t}\n\t}\n\n\t/**\n\t * @param pixelDensity - The ratio between the canvas's physical pixel\n\t * dimensions and the logical (CSS) dimensions the shader should assume.\n\t * Surfaces as `u_pixelRatio` so shaders can derive CSS-space values via\n\t * `u_resolution / u_pixelRatio`. On-screen canvases get this from\n\t * `window.devicePixelRatio`; offscreen renders must supply it explicitly\n\t * when the canvas is supersampled (e.g. 2x for fallback image sharpness).\n\t */\n\tresizeOffscreenCanvas(width: number, height: number, pixelDensity?: number): void {\n\t\tif (this.disposed) return\n\t\tif (pixelDensity !== undefined) this.pixelRatio = pixelDensity\n\t\tthis.gl.viewport(0, 0, width, height)\n\t\t// See `resize()` for why we self-dispose on allocation failure here.\n\t\ttry {\n\t\t\tthis.allocateBufferPassStorages(this.resources.bufferPasses, width, height)\n\t\t} catch (error) {\n\t\t\tthis.dispose()\n\t\t\tthrow error\n\t\t}\n\t}\n\n\t/**\n\t * Force all commands to complete execution; used for canvas fallback image generation\n\t */\n\tfinish(): void {\n\t\tif (this.disposed) return\n\t\tthis.gl.finish()\n\t}\n\n\t/**\n\t * Releases every WebGL resource owned by this renderer: shared geometry buffers,\n\t * user-supplied sampler textures, and each pass's program / VAO / (for buffers) FBOs\n\t * and ping-pong textures.\n\t *\n\t * Idempotent. Safe after the WebGL context has been lost \u2014 the GPU driver already\n\t * invalidated the resources, so we skip the gl.delete* calls. `disposed` gates all\n\t * public methods so reads after disposal short-circuit before touching `this.resources`.\n\t */\n\tdispose(): void {\n\t\tif (this.disposed) return\n\t\tthis.disposed = true\n\n\t\tthis.canvas.removeEventListener(webGLContextLostEvent, this.contextLostHandler)\n\n\t\t// Skip WebGL cleanup if context is lost - resources are already invalid\n\t\tif (this.gl.isContextLost()) return\n\n\t\tconst { gl, resources } = this\n\n\t\tfor (const bufferPass of resources.bufferPasses) this.disposeBufferPass(bufferPass)\n\t\tthis.disposePass(resources.mainPass)\n\t\tgl.deleteBuffer(resources.positionBuffer)\n\t\tgl.deleteBuffer(resources.texCoordBuffer)\n\n\t\tfor (const [, entry] of this.textures) gl.deleteTexture(entry.texture)\n\t\tthis.textures.clear()\n\t}\n\n\t/** Releases the program + VAO owned by any pass. Shared by main-pass and buffer-pass disposal. */\n\tprivate disposePass(pass: PassState): void {\n\t\tconst { gl } = this\n\t\tgl.deleteVertexArray(pass.vao)\n\t\tgl.deleteProgram(pass.program)\n\t}\n\n\t/** Releases everything a buffer pass owns: program + VAO (via `disposePass`), plus its ping-pong textures and FBOs. */\n\tprivate disposeBufferPass(bufferPass: BufferPass): void {\n\t\tconst { gl } = this\n\t\tthis.disposePass(bufferPass)\n\t\tfor (const tex of bufferPass.textures) gl.deleteTexture(tex)\n\t\tfor (const fbo of bufferPass.fbos) gl.deleteFramebuffer(fbo)\n\t}\n\n\t/**\n\t * Builds the GL state shared by main and buffer passes: a fresh VAO bound to the shared\n\t * fullscreen-quad geometry with this program's attribute locations, plus uniform-location\n\t * caches for built-ins, custom uniforms (lazy-filled on first set), and one entry per\n\t * buffer's `u_<name>_buffer` sampler. Geometry buffers are passed in so this works during\n\t * construction before the corresponding `this.*` fields are set.\n\t */\n\tprivate buildPassState(\n\t\tprogram: WebGLProgram,\n\t\tbufferDescriptors: readonly BufferDescriptor[],\n\t\tpositionBuffer: WebGLBuffer,\n\t\ttexCoordBuffer: WebGLBuffer,\n\t): PassState {\n\t\tconst { gl } = this\n\t\tconst vao = gl.createVertexArray()\n\t\tif (!vao) throw new Error(\"Failed to create vertex array object\")\n\n\t\tgl.bindVertexArray(vao)\n\t\tbindFullScreenQuadAttribs(gl, program, positionBuffer, texCoordBuffer)\n\t\tgl.bindVertexArray(null)\n\n\t\tconst builtInLocations = lookupBuiltInLocations(gl, program)\n\t\tconst bufferSamplerLocations = new Map<string, WebGLUniformLocation | null>()\n\t\tfor (const desc of bufferDescriptors) {\n\t\t\tbufferSamplerLocations.set(desc.uniformName, gl.getUniformLocation(program, desc.uniformName))\n\t\t}\n\n\t\treturn {\n\t\t\tprogram,\n\t\t\tvao,\n\t\t\tbuiltInLocations,\n\t\t\tcustomLocations: new Map(),\n\t\t\tbufferSamplerLocations,\n\t\t}\n\t}\n\n\t/**\n\t * Extends `buildPassState` with the per-buffer ping-pong storage: two textures + two\n\t * framebuffers, plus a reserved texture unit that every pass (including this buffer's\n\t * own pass, for self-feedback) samples from. Texture storage stays uninitialized\n\t * here \u2014 `allocateBufferPassStorage` sizes them once the canvas dimensions are known.\n\t */\n\tprivate buildBufferPass(\n\t\tprogram: WebGLProgram,\n\t\tdescriptor: BufferDescriptor,\n\t\tbufferDescriptors: readonly BufferDescriptor[],\n\t\thasFloatLinear: boolean,\n\t\ttextureUnit: number,\n\t\tpositionBuffer: WebGLBuffer,\n\t\ttexCoordBuffer: WebGLBuffer,\n\t): BufferPass {\n\t\tconst base = this.buildPassState(program, bufferDescriptors, positionBuffer, texCoordBuffer)\n\t\tconst { gl } = this\n\t\tconst formatGL = resolveBufferFormatGL(gl, descriptor.format)\n\t\t// Float formats only support LINEAR when OES_texture_float_linear is present.\n\t\tconst filter = shaderBufferFormatRequiresFloatExt(descriptor.format) && !hasFloatLinear ? gl.NEAREST : gl.LINEAR\n\n\t\tconst texA = createBufferTexture(gl, filter)\n\t\tconst texB = createBufferTexture(gl, filter)\n\t\tconst fboA = createBufferFramebuffer(gl, texA)\n\t\tconst fboB = createBufferFramebuffer(gl, texB)\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, null)\n\t\tgl.bindTexture(gl.TEXTURE_2D, null)\n\n\t\treturn {\n\t\t\t...base,\n\t\t\tuniformName: descriptor.uniformName,\n\t\t\tresolutionScale: descriptor.resolutionScale,\n\t\t\tformat: descriptor.format,\n\t\t\tinternalFormat: formatGL.internalFormat,\n\t\t\tuploadFormat: formatGL.uploadFormat,\n\t\t\tpixelType: formatGL.pixelType,\n\t\t\twidth: 0,\n\t\t\theight: 0,\n\t\t\ttextures: [texA, texB],\n\t\t\tfbos: [fboA, fboB],\n\t\t\twriteIdx: 0,\n\t\t\ttextureUnit,\n\t\t}\n\t}\n\n\t/**\n\t * Wires every `u_<bufferName>_buffer` sampler-to-unit binding once at construction.\n\t * Each buffer's \"current\" texture stays bound to its reserved unit for the entire frame,\n\t * and the unit number is fixed for the lifetime of the program \u2014 so we never need to call\n\t * `gl.uniform1i` for these samplers per-frame. A buffer reading its own name during its\n\t * own pass uses the same binding (the unit holds the prior-frame texture before draw\n\t * and the just-written texture after).\n\t */\n\tprivate bindStaticSamplerUnits(mainPass: PassState, bufferPasses: readonly BufferPass[]): void {\n\t\tconst { gl } = this\n\n\t\tconst allPasses: PassState[] = [mainPass, ...bufferPasses]\n\t\tfor (const pass of allPasses) {\n\t\t\t// biome-ignore lint/correctness/useHookAtTopLevel: linters incorrectly recognize `useProgram` as a hook\n\t\t\tgl.useProgram(pass.program)\n\t\t\tfor (const bufferPass of bufferPasses) {\n\t\t\t\tconst loc = pass.bufferSamplerLocations.get(bufferPass.uniformName)\n\t\t\t\tif (loc) gl.uniform1i(loc, bufferPass.textureUnit)\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Resizes every buffer pass to the given canvas dimensions. */\n\tprivate allocateBufferPassStorages(\n\t\tbufferPasses: readonly BufferPass[],\n\t\tcanvasWidth: number,\n\t\tcanvasHeight: number,\n\t): void {\n\t\tfor (const bufferPass of bufferPasses) {\n\t\t\tthis.allocateBufferPassStorage(bufferPass, canvasWidth, canvasHeight)\n\t\t}\n\t}\n\n\t/**\n\t * Sizes the buffer's two ping-pong textures to `canvas \u00D7 resolutionScale` (clamped to\n\t * at least 1\u00D71) and clears both attached FBOs so a stale prior frame doesn't leak in\n\t * after a resize. Idempotent \u2014 early-returns when the requested size matches the\n\t * current size.\n\t */\n\tprivate allocateBufferPassStorage(bufferPass: BufferPass, canvasWidth: number, canvasHeight: number): void {\n\t\tconst { gl } = this\n\t\tconst w = Math.max(1, Math.floor(canvasWidth * bufferPass.resolutionScale))\n\t\tconst h = Math.max(1, Math.floor(canvasHeight * bufferPass.resolutionScale))\n\n\t\tif (w === bufferPass.width && h === bufferPass.height) return\n\t\tbufferPass.width = w\n\t\tbufferPass.height = h\n\n\t\tfor (const tex of bufferPass.textures) {\n\t\t\tgl.bindTexture(gl.TEXTURE_2D, tex)\n\t\t\tgl.texImage2D(\n\t\t\t\tgl.TEXTURE_2D,\n\t\t\t\t0,\n\t\t\t\tbufferPass.internalFormat,\n\t\t\t\tw,\n\t\t\t\th,\n\t\t\t\t0,\n\t\t\t\tbufferPass.uploadFormat,\n\t\t\t\tbufferPass.pixelType,\n\t\t\t\tnull,\n\t\t\t)\n\t\t}\n\t\tgl.bindTexture(gl.TEXTURE_2D, null)\n\n\t\t// Save/restore the viewport so this helper doesn't leak buffer-sized viewport state.\n\t\t// `getParameter(VIEWPORT)` returns Int32Array(4) of [x, y, width, height] \u2014 narrow to a\n\t\t// concrete tuple so destructured elements aren't `number | undefined`.\n\t\t// https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getParameter\n\t\t// oxlint-disable-next-line typescript/no-unsafe-type-assertion\n\t\tconst [prevX, prevY, prevW, prevH] = gl.getParameter(gl.VIEWPORT) as [number, number, number, number]\n\n\t\t// Validate completeness once textures are sized (status is FRAMEBUFFER_INCOMPLETE_ATTACHMENT\n\t\t// before storage exists). Drivers can refuse some format/size combos \u2014 surfacing it as a\n\t\t// clear throw beats silently rendering nothing into a broken FBO.\n\t\t// https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/checkFramebufferStatus\n\t\tfor (const fbo of bufferPass.fbos) {\n\t\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, fbo)\n\t\t\tthrowIfFramebufferIncomplete(gl, bufferPass.uniformName, bufferPass.format)\n\t\t\tgl.viewport(0, 0, w, h)\n\t\t\tgl.clear(gl.COLOR_BUFFER_BIT)\n\t\t}\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, null)\n\t\tgl.viewport(prevX, prevY, prevW, prevH)\n\t}\n\n\t/**\n\t * Compiles GLSL source code into a shader object the GPU can execute.\n\t * @throws Error with shader info log if compilation fails\n\t */\n\tprivate compileShader(type: number, source: string): WebGLShader {\n\t\tconst { gl } = this\n\t\tconst shader = gl.createShader(type)\n\t\tif (!shader) {\n\t\t\tthrow new Error(\"Failed to create shader\")\n\t\t}\n\n\t\tgl.shaderSource(shader, source)\n\t\tgl.compileShader(shader)\n\n\t\tif (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {\n\t\t\tconst info = gl.getShaderInfoLog(shader)\n\t\t\tgl.deleteShader(shader)\n\t\t\tconst shaderType = type === gl.VERTEX_SHADER ? \"Vertex\" : \"Fragment\"\n\t\t\tthrow new Error(`${shaderType} shader compilation failed: ${info}`)\n\t\t}\n\n\t\treturn shader\n\t}\n\n\t/**\n\t * Compiles a fragment source, attaches it to the given vertex shader, and links them\n\t * into a program. The compiled fragment shader is released in a `finally` block so\n\t * we never leak it whether linking succeeds, fails, or compilation throws.\n\t *\n\t * @throws Error with the program info log if linking fails.\n\t */\n\tprivate linkFragmentProgram(vertexShader: WebGLShader, fragmentSource: string): WebGLProgram {\n\t\tconst { gl } = this\n\t\tconst fragmentShader = this.compileShader(gl.FRAGMENT_SHADER, fragmentSource)\n\t\ttry {\n\t\t\tconst program = gl.createProgram()\n\t\t\tif (!program) throw new Error(\"Failed to create program\")\n\n\t\t\tgl.attachShader(program, vertexShader)\n\t\t\tgl.attachShader(program, fragmentShader)\n\t\t\tgl.linkProgram(program)\n\n\t\t\tif (!gl.getProgramParameter(program, gl.LINK_STATUS)) {\n\t\t\t\tconst info = gl.getProgramInfoLog(program)\n\t\t\t\tgl.deleteProgram(program)\n\t\t\t\tthrow new Error(`Program linking failed: ${info}`)\n\t\t\t}\n\n\t\t\treturn program\n\t\t} finally {\n\t\t\t// The program retains a reference to the fragment shader after linking, so we can\n\t\t\t// release the shader object now whether we're returning the program or unwinding.\n\t\t\tgl.deleteShader(fragmentShader)\n\t\t}\n\t}\n\n\t/**\n\t * Sets a non-texture uniform value in the shader program.\n\t */\n\tprivate setUniform(\n\t\tlocation: WebGLUniformLocation | null,\n\t\tuniform: Exclude<UniformValue, { type: \"sampler2D\" }>,\n\t): void {\n\t\tif (location === null) return\n\n\t\tswitch (uniform.type) {\n\t\t\tcase \"boolean\":\n\t\t\t\tthis.gl.uniform1f(location, uniform.value ? 1.0 : 0.0)\n\t\t\t\tbreak\n\t\t\tcase \"float\":\n\t\t\t\tthis.gl.uniform1f(location, uniform.value)\n\t\t\t\tbreak\n\t\t\tcase \"int\":\n\t\t\t\tthis.gl.uniform1i(location, uniform.value)\n\t\t\t\tbreak\n\t\t\tcase \"vec2\":\n\t\t\t\tthis.gl.uniform2fv(location, uniform.value)\n\t\t\t\tbreak\n\t\t\tcase \"vec4\":\n\t\t\t\tthis.gl.uniform4fv(location, uniform.value)\n\t\t\t\tbreak\n\t\t\tcase \"vec4[]\":\n\t\t\t\tthis.gl.uniform4fv(location, uniform.value.flat())\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\t/**\n\t * Creates or updates a texture from an HTMLImageElement or ImageBitmap.\n\t * Binds the texture to the specified texture unit.\n\t */\n\tprivate bindTexture(uniformName: string, image: TexImageSource, textureUnit: number): void {\n\t\tconst { gl, textures } = this\n\t\tlet entry = textures.get(uniformName)\n\n\t\tconst isNewTexture = !entry\n\t\tif (isNewTexture) {\n\t\t\tconst texture = gl.createTexture()\n\t\t\tif (!texture) return\n\t\t\tentry = { texture, image: null }\n\t\t\ttextures.set(uniformName, entry)\n\t\t}\n\n\t\tif (!entry) return\n\n\t\tgl.activeTexture(gl.TEXTURE0 + textureUnit)\n\t\tgl.bindTexture(gl.TEXTURE_2D, entry.texture)\n\n\t\t// Upload on first bind or if the image changed\n\t\tif (isNewTexture || entry.image !== image) {\n\t\t\tif (entry.image instanceof ImageBitmap) {\n\t\t\t\tentry.image.close()\n\t\t\t}\n\t\t\tentry.image = image\n\t\t\tgl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image)\n\n\t\t\t// Prevent texture coordinates from wrapping at edges\n\t\t\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE)\n\t\t\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE)\n\n\t\t\t// Mipmaps + trilinear filtering keeps textures crisp when users resize shader frames.\n\t\t\t// Pre-computes downscaled versions (1/2, 1/4, 1/8, etc.) for smooth minification.\n\t\t\tgl.generateMipmap(gl.TEXTURE_2D)\n\t\t\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR)\n\t\t\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR)\n\t\t}\n\t}\n\n\t/**\n\t * Pushes user-supplied uniform values into the active program, lazy-caching their\n\t * locations on first encounter. Sampler2D values are uploaded to texture units\n\t * starting at `textureUnitBase` \u2014 which is `0` for the no-buffer hot path and\n\t * `this.resources.bufferPasses.length` when buffers are present (so reserved buffer units come first).\n\t */\n\tprivate applyCustomUniforms(\n\t\tpass: PassState,\n\t\tuniforms: Record<UniformName, UniformValue> | undefined,\n\t\ttextureUnitBase: number,\n\t): void {\n\t\tif (!uniforms) return\n\n\t\tconst { gl } = this\n\t\tlet textureUnit = textureUnitBase\n\n\t\tfor (const uniformName in uniforms) {\n\t\t\tconst uniformValue = uniforms[uniformName as UniformName]\n\t\t\tif (!uniformValue) continue\n\n\t\t\tlet location = pass.customLocations.get(uniformName)\n\t\t\tif (location === undefined) {\n\t\t\t\tlocation = gl.getUniformLocation(pass.program, uniformName)\n\t\t\t\tpass.customLocations.set(uniformName, location)\n\t\t\t}\n\n\t\t\tif (uniformValue.type === \"sampler2D\") {\n\t\t\t\tthis.bindTexture(uniformName, uniformValue.value, textureUnit)\n\t\t\t\tif (location !== null) gl.uniform1i(location, textureUnit)\n\t\t\t\ttextureUnit++\n\t\t\t} else {\n\t\t\t\tthis.setUniform(location, uniformValue)\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Sets every built-in uniform (`u_time`, `u_resolution`, mouse, etc.) for the active\n\t * program. `passWidth` / `passHeight` reflect the dimensions of THIS pass's render\n\t * target \u2014 for buffer passes that's `buffer.width \u00D7 buffer.height`, for the main pass\n\t * it's the canvas size \u2014 so `u_resolution` always matches the framebuffer being drawn.\n\t */\n\tprivate updatePassBuiltIns(\n\t\tpass: PassState,\n\t\telapsedTime: number,\n\t\tdeltaTime: number,\n\t\tmouseInput: MouseInput,\n\t\tpassWidth: number,\n\t\tpassHeight: number,\n\t): void {\n\t\tconst { gl, pixelRatio } = this\n\t\tconst locations = pass.builtInLocations\n\n\t\tif (locations[builtInUniforms.time.name] !== null) {\n\t\t\tgl.uniform1f(locations[builtInUniforms.time.name], elapsedTime)\n\t\t}\n\t\tif (locations[builtInUniforms.resolution.name] !== null) {\n\t\t\tgl.uniform2f(locations[builtInUniforms.resolution.name], passWidth, passHeight)\n\t\t}\n\t\tif (locations[builtInUniforms.deltaTime.name] !== null) {\n\t\t\tgl.uniform1f(locations[builtInUniforms.deltaTime.name], deltaTime)\n\t\t}\n\t\tif (locations[builtInUniforms.pixelRatio.name] !== null) {\n\t\t\tgl.uniform1f(locations[builtInUniforms.pixelRatio.name], pixelRatio)\n\t\t}\n\t\tif (locations[builtInUniforms.mousePosition.name] !== null) {\n\t\t\tgl.uniform4fv(locations[builtInUniforms.mousePosition.name], mouseInput.position)\n\t\t}\n\t\tif (locations[builtInUniforms.mousePointerDown.name] !== null) {\n\t\t\tgl.uniform1f(locations[builtInUniforms.mousePointerDown.name], mouseInput.pointerDown)\n\t\t}\n\t\tif (locations[builtInUniforms.mouseHover.name] !== null) {\n\t\t\tgl.uniform1f(locations[builtInUniforms.mouseHover.name], mouseInput.hover)\n\t\t}\n\t}\n}\n\nfunction createStaticArrayBuffer(gl: WebGL2RenderingContext, data: Float32Array): WebGLBuffer {\n\tconst buffer = gl.createBuffer()\n\tif (!buffer) throw new Error(\"Failed to create buffer\")\n\tgl.bindBuffer(gl.ARRAY_BUFFER, buffer)\n\tgl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW)\n\treturn buffer\n}\n\nfunction bindFullScreenQuadAttribs(\n\tgl: WebGL2RenderingContext,\n\tprogram: WebGLProgram,\n\tpositionBuffer: WebGLBuffer,\n\ttexCoordBuffer: WebGLBuffer,\n): void {\n\tconst positionLocation = gl.getAttribLocation(program, \"a_position\")\n\tif (positionLocation >= 0) {\n\t\tgl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer)\n\t\tgl.enableVertexAttribArray(positionLocation)\n\t\tgl.vertexAttribPointer(positionLocation, 2, gl.FLOAT, false, 0, 0)\n\t}\n\n\tconst texCoordLocation = gl.getAttribLocation(program, \"a_texCoord\")\n\tif (texCoordLocation >= 0) {\n\t\tgl.bindBuffer(gl.ARRAY_BUFFER, texCoordBuffer)\n\t\tgl.enableVertexAttribArray(texCoordLocation)\n\t\tgl.vertexAttribPointer(texCoordLocation, 2, gl.FLOAT, false, 0, 0)\n\t}\n}\n\nfunction lookupBuiltInLocations(\n\tgl: WebGL2RenderingContext,\n\tprogram: WebGLProgram,\n): Record<BuiltInUniformName, WebGLUniformLocation | null> {\n\treturn {\n\t\t[builtInUniforms.time.name]: gl.getUniformLocation(program, builtInUniforms.time.name),\n\t\t[builtInUniforms.resolution.name]: gl.getUniformLocation(program, builtInUniforms.resolution.name),\n\t\t[builtInUniforms.deltaTime.name]: gl.getUniformLocation(program, builtInUniforms.deltaTime.name),\n\t\t[builtInUniforms.pixelRatio.name]: gl.getUniformLocation(program, builtInUniforms.pixelRatio.name),\n\t\t[builtInUniforms.mousePosition.name]: gl.getUniformLocation(program, builtInUniforms.mousePosition.name),\n\t\t[builtInUniforms.mousePointerDown.name]: gl.getUniformLocation(program, builtInUniforms.mousePointerDown.name),\n\t\t[builtInUniforms.mouseHover.name]: gl.getUniformLocation(program, builtInUniforms.mouseHover.name),\n\t}\n}\n\n/**\n * Creates a buffer-pass texture pre-configured for ping-pong rendering: caller-supplied\n * `filter` (LINEAR for clean upsampling on most formats, NEAREST when the float-linear\n * extension is missing \u2014 decided at the call site), CLAMP_TO_EDGE so sampling outside\n * [0,1] returns the edge pixel instead of repeating. Storage is sized later by\n * `allocateBufferPassStorage` once the canvas dimensions are known.\n */\nfunction createBufferTexture(gl: WebGL2RenderingContext, filter: GLenum): WebGLTexture {\n\tconst texture = gl.createTexture()\n\tif (!texture) throw new Error(\"Failed to create buffer texture\")\n\tgl.bindTexture(gl.TEXTURE_2D, texture)\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter)\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter)\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE)\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE)\n\treturn texture\n}\n\n/** Creates a framebuffer with `texture` attached as COLOR_ATTACHMENT0 and returns it. */\nfunction createBufferFramebuffer(gl: WebGL2RenderingContext, texture: WebGLTexture): WebGLFramebuffer {\n\tconst fbo = gl.createFramebuffer()\n\tif (!fbo) throw new Error(\"Failed to create buffer framebuffer\")\n\tgl.bindFramebuffer(gl.FRAMEBUFFER, fbo)\n\tgl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0)\n\treturn fbo\n}\n\n/**\n * Throws if the currently-bound framebuffer is not complete. Caller must have called\n * `gl.bindFramebuffer(gl.FRAMEBUFFER, fbo)` immediately prior. The buffer's uniform name +\n * format are included so authors can trace failures back to their config.\n */\nfunction throwIfFramebufferIncomplete(\n\tgl: WebGL2RenderingContext,\n\tuniformName: UniformName,\n\tformat: ShaderBufferFormat,\n): void {\n\tconst status = gl.checkFramebufferStatus(gl.FRAMEBUFFER)\n\tif (status !== gl.FRAMEBUFFER_COMPLETE) {\n\t\tthrow new Error(\n\t\t\t`Shader buffer \"${uniformName}\" framebuffer is incomplete (format: \"${format}\", status: 0x${status.toString(16)}).`,\n\t\t)\n\t}\n}\n\ninterface BufferFormatGL {\n\tinternalFormat: GLenum\n\tuploadFormat: GLenum\n\tpixelType: GLenum\n}\n\n/**\n * Translates a `ShaderBufferFormat` string into the three GL constants `texImage2D`\n * needs (internal storage format, upload format, pixel type). Single source for the\n * mapping \u2014 adding a new format means adding one case here, and TypeScript's\n * exhaustiveness check will flag it at every call site if missed.\n */\nfunction resolveBufferFormatGL(gl: WebGL2RenderingContext, format: ShaderBufferFormat): BufferFormatGL {\n\tswitch (format) {\n\t\tcase \"rgba8\":\n\t\t\treturn { internalFormat: gl.RGBA8, uploadFormat: gl.RGBA, pixelType: gl.UNSIGNED_BYTE }\n\t\tcase \"r8\":\n\t\t\treturn { internalFormat: gl.R8, uploadFormat: gl.RED, pixelType: gl.UNSIGNED_BYTE }\n\t\tcase \"rg16f\":\n\t\t\treturn { internalFormat: gl.RG16F, uploadFormat: gl.RG, pixelType: gl.HALF_FLOAT }\n\t\tcase \"rgba16f\":\n\t\t\treturn { internalFormat: gl.RGBA16F, uploadFormat: gl.RGBA, pixelType: gl.HALF_FLOAT }\n\t\tcase \"rgba32f\":\n\t\t\treturn { internalFormat: gl.RGBA32F, uploadFormat: gl.RGBA, pixelType: gl.FLOAT }\n\t}\n}\n\n/**\n * Returns true for formats that need `EXT_color_buffer_float` to be color-renderable\n * (i.e. usable as an FBO color attachment). The 8-bit normalized formats are renderable\n * in the WebGL2 baseline; everything float is gated on the extension.\n */\nfunction shaderBufferFormatRequiresFloatExt(format: ShaderBufferFormat): boolean {\n\treturn format === \"rg16f\" || format === \"rgba16f\" || format === \"rgba32f\"\n}\n", "/**\n * Naming utilities for shader uniforms. The shader pipeline derives every uniform name\n * from a user-facing key (a propertyControl key, a buffer name, etc.) by applying a\n * stable string transform \u2014 keeping those transforms in one module avoids drift between\n * the head generator (`defineShader`) and the renderer's uniform-location lookups.\n */\nimport { type UniformName, uniformPrefix } from \"./WebGL2ShaderRenderer.ts\"\n\nconst heightmapSuffix = \"_heightmap\"\nconst arrayLengthSuffix = \"_length\"\nconst bufferSuffix = \"_buffer\"\n\n/** Matches any non-word character (anything outside `[A-Za-z0-9_]`). */\nconst nonWordCharPattern = /\\W/gu\n\n/** Type guard for strings that already match the `UniformName` template. */\nexport function isUniformName(s: string): s is UniformName {\n\treturn s.startsWith(uniformPrefix) && s.length > uniformPrefix.length\n}\n\n/** Returns true for the `u_<name>_heightmap` shape produced by `toHeightmapUniformName`. */\nexport function isHeightmapUniformName(s: string): boolean {\n\treturn isUniformName(s) && s.endsWith(heightmapSuffix)\n}\n\n/** Returns true for the `u_<name>_length` shape produced by `toArrayLengthName`. */\nexport function isArrayLengthUniformName(s: string): boolean {\n\treturn isUniformName(s) && s.endsWith(arrayLengthSuffix)\n}\n\n/** Returns true for the `u_<name>_buffer` shape produced by `toBufferUniformName`. */\nexport function isBufferUniformName(s: string): boolean {\n\treturn isUniformName(s) && s.endsWith(bufferSuffix)\n}\n\n/**\n * Replaces non-word chars in `key` with `_` so the result is safe to embed in a uniform name.\n * e.g. `foo-bar` \u2192 `foo_bar`, `foo bar` \u2192 `foo_bar`. Word chars (letters, digits, underscores)\n * pass through unchanged.\n */\nexport function sanitizeUniformKey(key: string): string {\n\treturn key.replace(nonWordCharPattern, \"_\")\n}\n\n/** Converts a control prop key to a valid uniform name. e.g. `fooBar` \u2192 `u_fooBar` */\nexport function toUniformName(key: string): UniformName {\n\treturn `${uniformPrefix}${sanitizeUniformKey(key)}`\n}\n\n/** Appends `_length` to a uniform name. e.g. `u_fooBar` \u2192 `u_fooBar_length` */\nexport function toArrayLengthName(uniformName: string): string {\n\treturn `${uniformName}${arrayLengthSuffix}`\n}\n\n/** Converts a control prop key to a heightmap uniform name. e.g. `logo` \u2192 `u_logo_heightmap` */\nexport function toHeightmapUniformName(key: string): UniformName {\n\treturn `${uniformPrefix}${sanitizeUniformKey(key)}${heightmapSuffix}`\n}\n\n/** Converts a buffer name to its sampler uniform. e.g. `trail` \u2192 `u_trail_buffer` */\nexport function toBufferUniformName(key: string): UniformName {\n\treturn `${uniformPrefix}${sanitizeUniformKey(key)}${bufferSuffix}`\n}\n\n/** Converts a control prop key to a valid array max length name. e.g. `fooBar` \u2192 `NUM_FOO_BAR` */\nexport function toArrayMaxLengthName(key: string): string {\n\tconst keyAsConstantCase = sanitizeUniformKey(key)\n\t\t.replace(/[a-z0-9](?=[A-Z])/g, \"$&_\")\n\t\t.toUpperCase()\n\treturn `NUM_${keyAsConstantCase}`\n}\n", "import {\n\ttype BufferDescriptor,\n\ttype ShaderBufferFormat,\n\ttype UniformValue,\n\tbuiltInUniforms,\n\tshaderBufferFormats,\n\tuniformPrefix,\n} from \"../render/presentation/Shader/WebGL2ShaderRenderer.ts\"\nimport {\n\tisArrayLengthUniformName,\n\tisBufferUniformName,\n\tisHeightmapUniformName,\n\tisUniformName,\n\ttoArrayLengthName,\n\ttoArrayMaxLengthName,\n\ttoBufferUniformName,\n\ttoHeightmapUniformName,\n\ttoUniformName,\n} from \"../render/presentation/Shader/uniformName.ts\"\nimport type {\n\tArrayControlDescription,\n\tBooleanControlDescription,\n\tColorControlDescription,\n\tControlDescription,\n\tEnumControlDescription,\n\tNumberControlDescription,\n\tResponsiveImageControlDescription,\n} from \"../render/types/PropertyControls.ts\"\nimport { ControlType } from \"../render/types/PropertyControls.ts\"\nimport { assertNever } from \"../utils/assert.ts\"\nimport { isNumber, isObject } from \"../utils/utils.ts\"\n\n/**\n * Maps scalar property control types to their corresponding GLSL uniform type declarations.\n */\nfunction controlTypeToGLSLType(controlType: ShaderScalarControlDescription[\"type\"]): UniformValue[\"type\"] {\n\tswitch (controlType) {\n\t\tcase ControlType.Number:\n\t\tcase ControlType.Enum:\n\t\t\treturn \"float\"\n\t\tcase ControlType.Boolean:\n\t\t\t// Booleans are passed as floats (0.0 or 1.0)\n\t\t\treturn \"float\"\n\t\tcase ControlType.Color:\n\t\t\treturn \"vec4\"\n\t\tcase ControlType.ResponsiveImage:\n\t\t\treturn \"sampler2D\"\n\t\tdefault:\n\t\t\tassertNever(controlType)\n\t}\n}\n\n/**\n * GLSL ES 3.0 version directive required by WebGL2.\n * Must be the first line in the shader source.\n */\nexport const glslVersionDirective = \"#version 300 es\"\n\n/**\n * Sets the default precision for float operations to highp (high precision).\n * Required in fragment shaders since GLSL ES has no default float precision.\n */\nexport const glslPrecisionDirective = \"precision highp float;\"\n\n/**\n * UV coordinates input from the vertex shader.\n * Provided as a varying from the default fullscreen quad vertex shader,\n * ranging from (0,0) at bottom-left to (1,1) at top-right.\n */\nexport const glslUVInput = \"in vec2 v_uv;\"\n\n/**\n * Fragment color output variable.\n * The final RGBA color written to the framebuffer for this fragment.\n */\nexport const glslFragColorOutput = \"out vec4 fragColor;\"\n\ninterface ShaderHeadOptions {\n\tpropertyControls?: ShaderControls\n\theightmapSource?: string\n\t/** Names of all buffers in this shader; declared as `sampler2D u_<name>_buffer` so any pass can sample them. */\n\tbufferNames?: readonly string[]\n}\n\n/**\n * Generates the complete shader head that gets prepended to user-provided fragment code.\n * The same head is generated for every pass (main and buffers) \u2014 same `propertyControls`,\n * same built-ins, same cross-buffer samplers (`u_<bufferName>_buffer`). For self-feedback\n * inside a buffer's own pass, sample its own name (`u_<thisBufferName>_buffer`) \u2014 the\n * renderer pins the prior-frame texture to that buffer's reserved unit during its own draw.\n */\nfunction generateShaderHead(options: ShaderHeadOptions = {}): string {\n\tconst { propertyControls, heightmapSource, bufferNames } = options\n\tconst lines: string[] = [glslVersionDirective, glslPrecisionDirective, \"\", glslUVInput, glslFragColorOutput]\n\n\t// Generate custom uniform declarations from property controls\n\tconst values = propertyControls ? Object.values(propertyControls) : []\n\tif (values.length > 0) {\n\t\t// If any controls are arrays, add a #define directive for the array max size\n\t\tconst hasArrays = values.some(control => control?.type === ControlType.Array)\n\t\tif (hasArrays) {\n\t\t\tlines.push(\"\")\n\t\t\tfor (const key in propertyControls) {\n\t\t\t\tconst control = propertyControls[key]\n\t\t\t\tif (!control || control.type !== ControlType.Array) continue\n\t\t\t\tif (control.control?.type !== ControlType.Color) {\n\t\t\t\t\tthrow new Error(`Shader array control \"${key}\" is not supported. Only color arrays may be defined.`)\n\t\t\t\t}\n\t\t\t\tif (!isNumber(control.maxCount)) {\n\t\t\t\t\tthrow new Error(`Shader array control \"${key}\" must have a maxCount.`)\n\t\t\t\t}\n\t\t\t\t// Note: no semicolon\n\t\t\t\tlines.push(`#define ${toArrayMaxLengthName(key)} ${control.maxCount}`)\n\t\t\t}\n\t\t}\n\n\t\t// Uniform declarations\n\t\tlines.push(\"\")\n\t\tfor (const key in propertyControls) {\n\t\t\tconst control = propertyControls[key]\n\t\t\tif (!control) continue\n\n\t\t\t// Define the array uniform **and** its length as `u_<key>_length`\n\t\t\tif (control.type === ControlType.Array) {\n\t\t\t\tconst name = toUniformName(key)\n\t\t\t\tlines.push(`uniform vec4 ${name}[${toArrayMaxLengthName(key)}];`)\n\t\t\t\tlines.push(`uniform int ${toArrayLengthName(name)};`)\n\t\t\t} else {\n\t\t\t\tconst glslType = controlTypeToGLSLType(control.type)\n\t\t\t\tlines.push(`uniform ${glslType} ${toUniformName(key)};`)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Auto-generated heightmap uniform for the designated source image\n\tif (heightmapSource) {\n\t\tlines.push(`uniform sampler2D ${toHeightmapUniformName(heightmapSource)};`)\n\t}\n\n\t// Cross-buffer samplers \u2014 every pass can read every buffer as `u_<bufferName>_buffer`.\n\t// The `_buffer` suffix keeps these from colliding with propertyControls uniforms.\n\tif (bufferNames && bufferNames.length > 0) {\n\t\tlines.push(\"\")\n\t\tfor (const name of bufferNames) {\n\t\t\tlines.push(`uniform sampler2D ${toBufferUniformName(name)};`)\n\t\t}\n\t}\n\n\t// NOTE: Built-in uniforms are always included regardless of whether they're used.\n\t// The GLSL compiler optimizes out unused uniforms, so there's no performance\n\t// impact from declaring them unconditionally.\n\tlines.push(\"\")\n\tfor (const uniform of Object.values(builtInUniforms)) {\n\t\tlines.push(`uniform ${uniform.glslType} ${uniform.name};`)\n\t}\n\tlines.push(\"\")\n\n\treturn lines.join(\"\\n\")\n}\n\n/**\n * Prepares a complete fragment shader by prepending the auto-generated head and the\n * optional shared `common` GLSL section to the user-provided fragment code. The order\n * is `head + common + fragment`, so authors can call into helpers declared in `common`\n * from `void main()` and still see all uniforms in scope inside `common`.\n */\nfunction prepareFragmentShader(fragment: string, common: string | undefined, options: ShaderHeadOptions = {}): string {\n\tconst head = generateShaderHead(options)\n\tif (!common) return head + fragment\n\treturn `${head}${common}\\n${fragment}`\n}\n\nconst defaultBufferResolutionScale = 0.5\nconst defaultBufferFormat: ShaderBufferFormat = \"rgba8\"\n\n/**\n * Resolves user `ShaderBufferConfig` inputs into the post-prep `BufferDescriptor` shape:\n * derives `uniformName`, prepends the auto-generated head to each fragment, and applies\n * defaults for `resolutionScale`/`format`.\n */\nfunction resolveBufferDescriptors(\n\tbuffers: readonly ShaderBufferConfig[] | undefined,\n\tcommon: string | undefined,\n\theadOptions: ShaderHeadOptions,\n): readonly BufferDescriptor[] | undefined {\n\tif (!buffers) return undefined\n\treturn buffers.map(buffer => ({\n\t\tuniformName: toBufferUniformName(buffer.name),\n\t\tfragment: prepareFragmentShader(buffer.fragment, common, headOptions),\n\t\tresolutionScale: buffer.resolutionScale ?? defaultBufferResolutionScale,\n\t\tformat: buffer.format ?? defaultBufferFormat,\n\t}))\n}\n\n/**\n * String constant used to brand objects created by defineShader.\n * We use a string instead of Symbol.for() to avoid side effects that\n * would prevent tree-shaking in published site bundles.\n */\nconst shaderConfigBrand = \"__framer_shaderConfig__\"\n\n/**\n * Checks if an object is a valid (post-prep) shader configuration.\n * @param obj - The object to check\n * @returns True if the object is a valid shader configuration, false otherwise\n * @internal\n */\nexport function isShaderConfig(obj: unknown): obj is ResolvedShaderConfig {\n\treturn isObject(obj) && shaderConfigBrand in obj\n}\n\n/**\n * Scalar control types supported in shader modules.\n * @internal\n */\nexport type ShaderScalarControlDescription =\n\t| NumberControlDescription\n\t| BooleanControlDescription\n\t| ColorControlDescription\n\t| ResponsiveImageControlDescription\n\t| EnumControlDescription\n\n/**\n * Color array control type for shader modules. Note that maxCount is required.\n * @internal\n */\nexport interface ShaderArrayControlDescription extends ArrayControlDescription {\n\tcontrol: ColorControlDescription\n\tmaxCount: number\n}\n\n/**\n * All control types supported in shader modules.\n * @internal\n */\nexport type ShaderControlDescription = ShaderScalarControlDescription | ShaderArrayControlDescription\n\nexport const shaderControlTypes: Record<string, true> = {\n\t[ControlType.Number]: true,\n\t[ControlType.Boolean]: true,\n\t[ControlType.Color]: true,\n\t[ControlType.ResponsiveImage]: true,\n\t[ControlType.Enum]: true,\n\t[ControlType.Array]: true,\n}\n\nexport function isShaderUniformControl<T extends ControlDescription>(\n\tcontrol: T,\n): control is Extract<T, { type: ShaderControlDescription[\"type\"] }> {\n\treturn control.type in shaderControlTypes\n}\n/**\n * Record of shader controls keyed by uniform name.\n * @internal\n */\nexport type ShaderControls = Record<string, ShaderControlDescription>\n\n/**\n * User-facing buffer config. Inherits `fragment` from `BufferDescriptor`, adds the\n * user-supplied `name` (which prep maps to `uniformName`), and relaxes `resolutionScale`\n * / `format` to optional (defaults applied by prep).\n * @internal\n */\nexport interface ShaderBufferConfig extends Omit<BufferDescriptor, \"uniformName\" | \"resolutionScale\" | \"format\"> {\n\tname: string\n\tresolutionScale?: number\n\tformat?: ShaderBufferFormat\n}\n\n/**\n * Shader definition object returned from the defineShader factory function.\n * @internal\n */\nexport interface ShaderConfig<C extends ShaderControls = ShaderControls> {\n\t/**\n\t * Fragment shader GLSL source code (required).\n\t * Only needs to contain void main() and any custom helper functions.\n\t * Version, precision, input/output declarations, and uniforms are auto-generated.\n\t */\n\tfragment: string\n\t/** Vertex shader GLSL source code (optional, uses default if not provided) */\n\tvertex?: string\n\t/** Property controls for shader uniforms */\n\tpropertyControls?: C\n\t/** Display name shown in properties panel and layers panel */\n\ttitle?: string\n\t/**\n\t * Controls the rendering resolution relative to device DPI.\n\t * - `\"performance\"` \u2014 reduced DPI (0.75x), fewer pixels on high-DPI screens\n\t * - `\"consistent\"` \u2014 forces DPR 1 on all screens for identical results across devices\n\t * - `number` \u2014 explicit scale factor applied to device DPI\n\t *\n\t * Defaults to full device DPI when omitted.\n\t * Effective DPI is clamped so the canvas never renders below CSS pixel resolution.\n\t */\n\tresolutionScale?: ShaderResolutionScale\n\t/**\n\t * Key of a ResponsiveImage property control to generate a heightmap for.\n\t * The heightmap is a three-channel texture passed as `u_<key>_heightmap`:\n\t * - Red:   normalized Poisson field (0 at boundary, 1 at deepest center)\n\t * - Green: inverted alpha (1 for transparent/outside, 0 for opaque/inside)\n\t * - Blue:  hard binary shape mask (1 = inside, 0 = outside, no anti-aliasing)\n\t */\n\theightmapSource?: string\n\t/**\n\t * Set explicitly to `false` to avoid continuous `requestAnimationFrame` render loop\n\t * for this shader. `true` (default) or `undefined` will result in continuous rendering.\n\t */\n\tanimated?: boolean\n\t/**\n\t * Enables mouse interactivity for this shader. When set, three uniforms are provided:\n\t *\n\t * - `u_mousePosition` (vec4): `(x, y, velocityX, velocityY)`.\n\t *   Position is element-relative (0\u20131 within bounds, y flipped for GLSL UV), extending\n\t *   outside 0\u20131 when the pointer is off the element. Velocity is in element-relative\n\t *   units per second, useful for directional effects like smudge.\n\t * - `u_mousePointerDown` (float): sprung 0\u21921 value, 1.0 when pointer is pressed.\n\t * - `u_mouseHover` (float): sprung 0\u21921 value, 1.0 when pointer is over the element.\n\t *\n\t * Mouse position follows the pointer instantly by default. Users can add a spring\n\t * transition per-instance via the properties panel to smooth position and state values.\n\t *\n\t * - `\"enabledByDefault\"` \u2014 mouse tracking active when the shader loads\n\t * - `\"disabledByDefault\"` \u2014 mouse tracking supported but off until the user enables it\n\t */\n\tmouse?: ShaderMouseDefault\n\t/**\n\t * Multi-pass buffers. Each buffer is a fullscreen pre-pass rendered to its own ping-pong\n\t * (https://ostefani.dev/tech-notes/ping-pong-technique) texture before the main pass;\n\t * `u_<bufferName>_buffer` samples it from the main pass and from later buffers.\n\t * Inside a buffer's own fragment, sampling its own name (`u_<thisBufferName>_buffer`)\n\t * returns the prior-frame output.\n\t *\n\t * Buffers run in array order each frame.\n\t */\n\tbuffers?: readonly ShaderBufferConfig[]\n\t/**\n\t * Shared GLSL injected into every pass (main and each buffer) between the auto-generated\n\t * head and the user's `void main()`. Useful for helper functions, `#define`s, and struct\n\t * types referenced from multiple passes. All built-in uniforms and propertyControl\n\t * uniforms are in scope, so helpers can read them directly.\n\t */\n\tcommon?: string\n\t/** Brand property for runtime type checking */\n\t__framer_shaderConfig__?: true\n}\n\n/**\n * Post-prep variant of `ShaderConfig` returned by `defineShader`. The user-facing `buffers`\n * list is replaced by resolved `BufferDescriptor`s (defaults applied, `uniformName` set).\n * @internal\n */\nexport interface ResolvedShaderConfig<C extends ShaderControls = ShaderControls> extends Omit<\n\tShaderConfig<C>,\n\t\"buffers\"\n> {\n\tbuffers?: readonly BufferDescriptor[]\n}\n\n/**\n * Resolution scale for shader modules.\n * - `\"performance\"` \u2014 reduced DPI (0.75x)\n * - `\"consistent\"` \u2014 forces DPR 1 on all screens\n * - `number` \u2014 explicit scale factor\n */\nexport type ShaderResolutionScale = \"performance\" | \"consistent\" | number\n\nexport type ShaderMouseDefault = \"enabledByDefault\" | \"disabledByDefault\"\n\n/**\n * Defines a shader module with fragment/vertex shaders, controls, and other shader configuration options.\n *\n * The fragment shader only needs to contain the main() function and any custom\n * helper functions. The following boilerplate is automatically prepended:\n * - Version declaration (#version 300 es)\n * - Precision qualifier (precision highp float)\n * - Input/output declarations (in vec2 v_uv, out vec4 fragColor)\n * - Uniform declarations derived from propertyControls\n * - Built-in uniforms\n *\n * @param shaderConfig - Shader configuration\n * @returns The shader definition with the prepared fragment shader\n *\n * @example\n * ```typescript\n * import { defineShader, ControlType } from \"framer\"\n *\n * export default defineShader({\n *     fragment: `\n *         void main() {\n *             vec2 uv = v_uv * u_speed;\n *             fragColor = vec4(uv, sin(u_time), 1.0);\n *         }\n *     `,\n *     propertyControls: {\n *         speed: { type: ControlType.Number, defaultValue: 0.5, min: 0, max: 5 },\n *     },\n * })\n * ```\n * @internal\n */\nexport function defineShader<C extends ShaderControls>(shaderConfig: ShaderConfig<C>): ResolvedShaderConfig<C> {\n\tvalidateShaderInputs(shaderConfig)\n\n\tconst bufferNames = shaderConfig.buffers ? shaderConfig.buffers.map(b => b.name) : undefined\n\n\tconst preparedMainFragment = prepareFragmentShader(shaderConfig.fragment, shaderConfig.common, {\n\t\tpropertyControls: shaderConfig.propertyControls,\n\t\theightmapSource: shaderConfig.heightmapSource,\n\t\tbufferNames,\n\t})\n\n\tconst resolvedBuffers = resolveBufferDescriptors(shaderConfig.buffers, shaderConfig.common, {\n\t\tpropertyControls: shaderConfig.propertyControls,\n\t\theightmapSource: shaderConfig.heightmapSource,\n\t\tbufferNames,\n\t})\n\n\treturn {\n\t\t...shaderConfig,\n\t\tfragment: preparedMainFragment,\n\t\tbuffers: resolvedBuffers,\n\t\t[shaderConfigBrand]: true as const,\n\t}\n}\n\n/**\n * Validates user inputs to `defineShader` before any prep runs. Catches author mistakes\n * (invalid identifiers, names that would double-wrap or collide with framework-derived\n * uniforms, heightmap source pointing to a non-image control) with clear errors instead\n * of opaque GLSL compile failures.\n */\nfunction validateShaderInputs(shaderConfig: ShaderConfig): void {\n\t// Track every derived uniform identifier we emit \u2014 from propertyControl keys AND buffer\n\t// names \u2014 so two inputs that sanitize to the same identifier (e.g. `foo-bar` vs `foo_bar`,\n\t// both \u2192 `u_foo_bar`) are caught with a clear error rather than silently collapsed into\n\t// one GLSL declaration. Property-control derived names (`u_<key>`) and buffer derived\n\t// names (`u_<name>_buffer`) live in disjoint sub-spaces \u2014 keys ending in `_buffer` are\n\t// already rejected below \u2014 so a single map covers both without false positives.\n\tconst seenDerivedNames = new Map<string, string>()\n\n\tif (shaderConfig.propertyControls) {\n\t\tfor (const key in shaderConfig.propertyControls) {\n\t\t\tif (isUniformName(key) || key === uniformPrefix) {\n\t\t\t\tthrow new Error(`Property control key \"${key}\" must not start with \"${uniformPrefix}\".`)\n\t\t\t}\n\t\t\t// `toUniformName(key)` is the propertyControl's eventual GLSL name; reject keys whose\n\t\t\t// derived name overlaps generated shapes, since same-name uniforms with different\n\t\t\t// types fail to compile.\n\t\t\tconst derivedName = toUniformName(key)\n\t\t\tif (isHeightmapUniformName(derivedName)) {\n\t\t\t\tthrow new Error(`Property control key \"${key}\" must not end with \"_heightmap\".`)\n\t\t\t}\n\t\t\tif (isArrayLengthUniformName(derivedName)) {\n\t\t\t\tthrow new Error(`Property control key \"${key}\" must not end with \"_length\".`)\n\t\t\t}\n\t\t\tif (isBufferUniformName(derivedName)) {\n\t\t\t\tthrow new Error(`Property control key \"${key}\" must not end with \"_buffer\".`)\n\t\t\t}\n\t\t\tconst collidingKey = seenDerivedNames.get(derivedName)\n\t\t\tif (collidingKey !== undefined) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Property control keys \"${collidingKey}\" and \"${key}\" both resolve to the same uniform \"${derivedName}\".`,\n\t\t\t\t)\n\t\t\t}\n\t\t\tseenDerivedNames.set(derivedName, key)\n\t\t}\n\t}\n\tif (shaderConfig.heightmapSource) {\n\t\tconst control = shaderConfig.propertyControls?.[shaderConfig.heightmapSource]\n\t\tif (!control || control.type !== ControlType.ResponsiveImage) {\n\t\t\tthrow new Error(\n\t\t\t\t`heightmapSource \"${shaderConfig.heightmapSource}\" must reference a ResponsiveImage property control.`,\n\t\t\t)\n\t\t}\n\t}\n\tif (shaderConfig.buffers) {\n\t\tfor (const buffer of shaderConfig.buffers) {\n\t\t\tif (isUniformName(buffer.name)) {\n\t\t\t\tthrow new Error(`Shader buffer name \"${buffer.name}\" must not start with \"${uniformPrefix}\".`)\n\t\t\t}\n\t\t\tconst derivedName = toBufferUniformName(buffer.name)\n\t\t\tconst collidingName = seenDerivedNames.get(derivedName)\n\t\t\tif (collidingName !== undefined) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\tcollidingName === buffer.name\n\t\t\t\t\t\t? `Duplicate shader buffer name \"${buffer.name}\".`\n\t\t\t\t\t\t: `Shader buffer names \"${collidingName}\" and \"${buffer.name}\" both resolve to the same uniform \"${derivedName}\".`,\n\t\t\t\t)\n\t\t\t}\n\t\t\tseenDerivedNames.set(derivedName, buffer.name)\n\n\t\t\tif (buffer.resolutionScale !== undefined) {\n\t\t\t\tif (!isNumber(buffer.resolutionScale) || buffer.resolutionScale <= 0 || buffer.resolutionScale > 1) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Shader buffer \"${buffer.name}\" has invalid resolutionScale ${buffer.resolutionScale}. Must be in the range (0, 1].`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (buffer.format !== undefined && !shaderBufferFormats.has(buffer.format)) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Shader buffer \"${buffer.name}\" has invalid format \"${buffer.format}\". Must be one of: ${[...shaderBufferFormats].join(\", \")}.`,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport { forwardRef, startTransition, useCallback, useEffect, useId, useLayoutEffect, useState } from \"react\"\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\"\nimport { useObserverRef } from \"../../../components/utils/refHelper.ts\"\nimport { useRenderTargetEnvironment } from \"../../../modules/RenderTargetEnvironmentContext.tsx\"\nimport { useIsOnFramerCanvas } from \"../../../modules/useIsOnFramerCanvas.ts\"\nimport { useSharedIntersectionObserver } from \"../../../modules/useSharedIntersectionObserver.ts\"\nimport { RenderTarget } from \"../../types/RenderEnvironment.ts\"\nimport { FrameWithMotion } from \"../Frame/FrameWithMotion.tsx\"\nimport { ShaderFallbackImage } from \"./ShaderFallbackImage.tsx\"\nimport { ShaderSandboxFallbackImage } from \"./ShaderSandboxFallbackImage.tsx\"\nimport { ShaderWithFallbackOverlay } from \"./ShaderWithFallbackOverlay.tsx\"\nimport { useShaderRenderState } from \"./hooks.ts\"\nimport type { ShaderProps } from \"./types.ts\"\nimport { useShaderMouse } from \"./useShaderMouse.ts\"\nimport { useShaderPoolSlot } from \"./useShaderPool.ts\"\n\n/**\n * Main shader component. Renders fallback, canvas, progressively or instantly based on `mode`.\n *\n * When rendered inside a ShaderPoolProvider (canvas), pool-based context management\n * controls which shaders get WebGL contexts. When no pool exists (published sites),\n * the component renders normally based on `mode`.\n */\nexport const Shader = /* @__PURE__ */ forwardRef<HTMLDivElement, ShaderProps>(function Shader(\n\t{\n\t\tmode = \"instant\",\n\t\tfallbackImage,\n\t\tskipInitialFallback,\n\t\tplaceholder,\n\t\tstyle,\n\t\twidth,\n\t\theight,\n\t\tvertexShader,\n\t\tfragmentShader,\n\t\tanimated,\n\t\tuniforms,\n\t\tonError,\n\t\tonReady,\n\t\tresolutionScale,\n\t\tpoolId,\n\t\tisSelected = false,\n\t\tisMultiSelected = false,\n\t\tisPreviewActive = false,\n\t\theightmapSource,\n\t\tmouse,\n\t\tbuffers,\n\t\t...rest\n\t},\n\tref,\n) {\n\tconst observerRef = useObserverRef<HTMLDivElement>(ref)\n\tconst renderTargetEnvironment = useRenderTargetEnvironment()\n\tconst renderTarget = RenderTarget.current()\n\tconst shouldSkipPreviewFallback = renderTarget === RenderTarget.preview && renderTargetEnvironment === \"preview\"\n\tconst shouldSkipInitialFallback = Boolean(fallbackImage && (skipInitialFallback || shouldSkipPreviewFallback))\n\n\tconst isOnCanvas = useIsOnFramerCanvas()\n\n\tconst mouseDataRef = useShaderMouse(observerRef, isOnCanvas ? undefined : mouse)\n\n\t// Assume visible initially when skipping fallback so above-the-fold shaders\n\t// mount immediately. The observer corrects this for below-the-fold elements.\n\tconst [isIntersecting, setIsIntersecting] = useState(shouldSkipInitialFallback)\n\n\tconst intersectionCallback = useCallback((entry: IntersectionObserverEntry) => {\n\t\tstartTransition(() => setIsIntersecting(entry.isIntersecting))\n\t}, [])\n\n\tuseSharedIntersectionObserver(observerRef, intersectionCallback, { threshold: 0, enabled: true })\n\n\tconst autoId = useId()\n\tconst id = poolId ?? autoId\n\tconst poolSlot = useShaderPoolSlot(id, isSelected, isIntersecting)\n\n\t// Beacon: tell the browser that a shader is going to be rendered.\n\t// This allows headless browsers (screenshotter) to know to wait for the `shader_rendered` mark.\n\tuseEffect(() => {\n\t\tperformance.mark?.(\"shader_register\")\n\t}, [])\n\n\tconst {\n\t\tisFallbackOnly,\n\t\teffectiveAnimated,\n\t\teffectiveSingleFrame,\n\t\teffectiveMode,\n\t\tshouldSkipFallbackOverlay,\n\t\tonContextLost,\n\t\tonUniformResolutionSucceeded,\n\t\tonUniformResolutionFailed,\n\t} = useShaderRenderState(\n\t\tpoolSlot,\n\t\tisSelected,\n\t\tisMultiSelected,\n\t\tisIntersecting,\n\t\tmode,\n\t\tanimated,\n\t\tshouldSkipInitialFallback,\n\t\tisPreviewActive,\n\t)\n\n\tconst [isShaderReady, setIsShaderReady] = useState(false)\n\n\tuseLayoutEffect(() => {\n\t\tif (isFallbackOnly) startTransition(() => setIsShaderReady(false))\n\t}, [isFallbackOnly])\n\n\tconst handleShaderReady = useCallback(() => {\n\t\tstartTransition(() => setIsShaderReady(true))\n\t\tonReady?.()\n\t}, [onReady])\n\n\tconst shaderProps = {\n\t\tvertexShader,\n\t\tfragmentShader,\n\t\tuniforms,\n\t\tresolutionScale,\n\t\tonError,\n\t\tonContextLost,\n\t\tonUniformResolutionSucceeded,\n\t\tonUniformResolutionFailed,\n\t\theightmapSource,\n\t\tbuffers,\n\t}\n\n\tconst containerFrameProps = { style, width, height, ...rest }\n\n\t// When on the canvas, the fallback image is optimised for being swapped out with another one.\n\tif (isOnCanvas) {\n\t\t// Hiding the fallback image with CSS opacity instead of unmounting avoids flickers when switching elements.\n\t\tconst hideFallback = !isFallbackOnly && (shouldSkipInitialFallback || isShaderReady)\n\n\t\treturn (\n\t\t\t<ShaderContainerFrame ref={observerRef} {...containerFrameProps}>\n\t\t\t\t{!isFallbackOnly && (\n\t\t\t\t\t<ShaderWithFallbackOverlay\n\t\t\t\t\t\tmode={effectiveMode}\n\t\t\t\t\t\tskipInitialFallback={shouldSkipFallbackOverlay}\n\t\t\t\t\t\tonReady={handleShaderReady}\n\t\t\t\t\t\t{...shaderProps}\n\t\t\t\t\t\tanimated={effectiveAnimated}\n\t\t\t\t\t\tsingleFrame={effectiveSingleFrame}\n\t\t\t\t\t\tmouseDataRef={mouseDataRef}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t<ShaderSandboxFallbackImage src={fallbackImage} hidden={hideFallback} />\n\t\t\t\t{isFallbackOnly && !fallbackImage && placeholder}\n\t\t\t</ShaderContainerFrame>\n\t\t)\n\t}\n\n\t// Suppress fallback while off-screen to prevent a flash when scrolling into view.\n\t// Still show it when visible (context loss, reduced motion).\n\tif (isFallbackOnly) {\n\t\treturn (\n\t\t\t<ShaderContainerFrame ref={observerRef} {...containerFrameProps}>\n\t\t\t\t{shouldSkipFallbackOverlay && !isIntersecting ? null : <ShaderFallbackImage src={fallbackImage} />}\n\t\t\t</ShaderContainerFrame>\n\t\t)\n\t}\n\n\treturn (\n\t\t<ShaderContainerFrame ref={observerRef} {...containerFrameProps}>\n\t\t\t<ShaderWithFallbackOverlay\n\t\t\t\tmode={effectiveMode}\n\t\t\t\tfallbackImage={fallbackImage}\n\t\t\t\tskipInitialFallback={shouldSkipFallbackOverlay}\n\t\t\t\tonReady={onReady}\n\t\t\t\t{...shaderProps}\n\t\t\t\tanimated={effectiveAnimated}\n\t\t\t\tsingleFrame={effectiveSingleFrame}\n\t\t\t\tmouseDataRef={mouseDataRef}\n\t\t\t/>\n\t\t</ShaderContainerFrame>\n\t)\n})\n\nconst ShaderContainerFrame = /* @__PURE__ */ forwardRef<\n\tHTMLDivElement,\n\tComponentPropsWithoutRef<typeof FrameWithMotion> & { children: ReactNode }\n>(function ShaderContainerFrame({ children, style, ...rest }, ref) {\n\tconst styles: MotionStyle = { borderRadius: \"inherit\", cornerShape: \"inherit\", ...style, overflow: \"hidden\" }\n\treturn (\n\t\t<FrameWithMotion ref={ref} __fromCanvasComponent style={styles} {...rest} componentType=\"Shader\">\n\t\t\t{children}\n\t\t</FrameWithMotion>\n\t)\n})\n", "import { memo } from \"react\"\nimport { BackgroundImageComponent } from \"../../style/BackgroundImageComponent.tsx\"\n\nexport const ShaderFallbackImage = /* @__PURE__ */ memo(function ShaderFallbackImage({\n\tsrc,\n}: {\n\tsrc: string | undefined\n}) {\n\tif (!src) return null\n\treturn <BackgroundImageComponent image={{ src, fit: \"fill\", loading: \"lazy\" }} draggable={false} alt=\"\" />\n})\n", "import { memo, startTransition, useEffect, useLayoutEffect, useRef, useState } from \"react\"\nimport { overlayStyle } from \"./helpers.ts\"\n\ntype ShaderSandboxFallbackImageProps = {\n\tsrc: string | undefined\n\thidden?: boolean\n\t/** Called when the displayed fallback image changes (after decode). Skips the initial mount. */\n\tonDisplaySrcChange?: () => void\n}\n\nconst sandboxFallbackImageStyle: React.CSSProperties = {\n\tdisplay: \"block\",\n\twidth: \"100%\",\n\theight: \"100%\",\n\tobjectFit: \"cover\",\n\tposition: \"absolute\",\n\tinset: 0,\n}\n\nconst sandboxFallbackContainerStyle: React.CSSProperties = { position: \"absolute\", inset: 0 }\n\nexport const ShaderSandboxFallbackImage = /* @__PURE__ */ memo(function ShaderSandboxFallbackImage({\n\tsrc,\n\thidden = false,\n\tonDisplaySrcChange,\n}: ShaderSandboxFallbackImageProps) {\n\tconst [displaySrc, setDisplaySrc] = useState<string | undefined>(src)\n\tconst [previousSrc, setPreviousSrc] = useState<string | undefined>(undefined)\n\tconst fadeRef = useRef<HTMLDivElement>(null)\n\n\tconst onDisplaySrcChangeRef = useRef(onDisplaySrcChange)\n\tuseLayoutEffect(() => {\n\t\tonDisplaySrcChangeRef.current = onDisplaySrcChange\n\t}, [onDisplaySrcChange])\n\n\tconst isInitialMountRef = useRef(true)\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: Intentional\n\tuseLayoutEffect(() => {\n\t\tif (isInitialMountRef.current) {\n\t\t\tisInitialMountRef.current = false\n\t\t\treturn\n\t\t}\n\t\t// If there's a previous image, a crossfade will animate \u2014 defer callback\n\t\t// to animation finish so the old image is fully gone first.\n\t\t// prevDisplayRef runs after this effect so it still holds the old value.\n\t\tif (!prevDisplayRef.current) {\n\t\t\tonDisplaySrcChangeRef.current?.()\n\t\t}\n\t}, [displaySrc])\n\n\t// Preload and decode the new image before showing it to avoid flicker\n\tuseEffect(() => {\n\t\tif (src === displaySrc) return\n\n\t\tlet isActive = true\n\n\t\tif (src) {\n\t\t\tconst img = new Image()\n\t\t\timg.src = src\n\n\t\t\tconst setSrc = () => (isActive ? startTransition(() => setDisplaySrc(src)) : void 0)\n\n\t\t\tif (typeof img.decode === \"function\") {\n\t\t\t\timg.decode().then(setSrc).catch(setSrc)\n\t\t\t} else {\n\t\t\t\timg.onload = setSrc\n\t\t\t}\n\t\t} else {\n\t\t\tstartTransition(() => setDisplaySrc(undefined))\n\t\t}\n\n\t\treturn () => {\n\t\t\tisActive = false\n\t\t}\n\t}, [src, displaySrc])\n\n\t// When displaySrc changes, save the old src so it stays visible behind the new one\n\tconst prevDisplayRef = useRef(displaySrc)\n\tuseLayoutEffect(() => {\n\t\tif (displaySrc !== prevDisplayRef.current && prevDisplayRef.current) {\n\t\t\tsetPreviousSrc(prevDisplayRef.current)\n\t\t}\n\t\tprevDisplayRef.current = displaySrc\n\t}, [displaySrc])\n\n\t// Fade in the new image on top of the old one, then remove the old one\n\tuseEffect(() => {\n\t\tconst el = fadeRef.current\n\t\tif (!el || !previousSrc) return\n\n\t\tlet cancelled = false\n\n\t\t// Web Animation API because Framer Motion won't work properly on the canvas\n\t\tconst animation = el.animate([{ opacity: 0 }, { opacity: 1 }], {\n\t\t\tduration: 300,\n\t\t\teasing: \"ease-in-out\",\n\t\t\tfill: \"forwards\",\n\t\t})\n\t\tanimation.onfinish = () => {\n\t\t\tif (!cancelled) {\n\t\t\t\tstartTransition(() => setPreviousSrc(undefined))\n\t\t\t\tonDisplaySrcChangeRef.current?.()\n\t\t\t}\n\t\t}\n\n\t\treturn () => {\n\t\t\tcancelled = true\n\t\t\tanimation.cancel()\n\t\t}\n\t}, [previousSrc])\n\n\tif (!displaySrc) return null\n\n\tconst containerStyle: React.CSSProperties = {\n\t\t...overlayStyle,\n\t\topacity: hidden ? 0 : 1,\n\t\tpointerEvents: hidden ? \"none\" : undefined,\n\t}\n\n\treturn (\n\t\t<div style={containerStyle}>\n\t\t\t{previousSrc && (\n\t\t\t\t<img\n\t\t\t\t\tkey={`prev-${previousSrc}`}\n\t\t\t\t\tsrc={previousSrc}\n\t\t\t\t\tdecoding=\"async\"\n\t\t\t\t\tstyle={sandboxFallbackImageStyle}\n\t\t\t\t\tdraggable={false}\n\t\t\t\t\talt=\"\"\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t<div key={displaySrc} ref={previousSrc ? fadeRef : undefined} style={sandboxFallbackContainerStyle}>\n\t\t\t\t<img src={displaySrc} style={sandboxFallbackImageStyle} decoding=\"async\" draggable={false} alt=\"\" />\n\t\t\t</div>\n\t\t</div>\n\t)\n})\n", "export interface CSSVarRange {\n\tstart: number\n\tend: number\n\tcommaIndex?: number\n}\n\n/**\n * Since the token metadata can contain `(` and `)` if the shared color name or\n * package contain them, we can't use a regex to just find the contents within\n * the parentheses. This function counts up and down as opening and closing\n * parentheses are encountered, returning the result when the first encountered\n * parenthesis is finally closed, excluding the leading and trailing\n * parentheses. Splitting by the first encountered comma, to return the custom\n * property reference, and the fallback value if provided.\n */\nexport function parseCSSVarRange(input: string, from = 0): CSSVarRange | null {\n\tconst varIndex = input.indexOf(\"var(\", from)\n\tif (varIndex === -1) return null\n\n\tconst start = varIndex + 4 // Starting right after \"var(\".\n\tlet parens = 1 // Already counting the one from \"var(\".\n\tlet commaIndex: number | undefined\n\n\tfor (let index = start; index < input.length; index++) {\n\t\tif (input[index] === \"(\") {\n\t\t\tparens++\n\t\t} else if (input[index] === \")\") {\n\t\t\tparens--\n\n\t\t\tif (parens === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tstart: varIndex,\n\t\t\t\t\tend: index + 1,\n\t\t\t\t\tcommaIndex,\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (commaIndex === undefined && input[index] === \",\") {\n\t\t\t// Track the first comma. If encountered, this marks the divider\n\t\t\t// between the custom property, and the fallback.\n\t\t\tcommaIndex = index\n\t\t}\n\t}\n\t// The opening parenthesis was never closed.\n\treturn null\n}\n\nfunction tokenFromVarRange(\n\tstring: string,\n\trange: CSSVarRange | null,\n): {\n\tcustomProperty?: string\n\tfallback?: string\n\tmetadata?: string\n} {\n\tif (!range) return {}\n\n\tconst { start, end, commaIndex } = range\n\tconst metadata = string.substring(end).trim()\n\n\tif (!commaIndex) {\n\t\treturn { customProperty: string.substring(start + 4, end - 1), metadata }\n\t}\n\n\treturn {\n\t\tcustomProperty: string.substring(start + 4, commaIndex),\n\t\tfallback: string.substring(commaIndex + 1, end - 1).trim(),\n\t\tmetadata,\n\t}\n}\n\nexport function parseCSSVariable(token: string): { customProperty?: string; fallback?: string; metadata?: string } {\n\tconst range = parseCSSVarRange(token)\n\treturn tokenFromVarRange(token, range)\n}\n", "type TextureSource = HTMLImageElement | HTMLCanvasElement\n\n/** Maximum URL-keyed entries in `load`'s store before FIFO eviction. */\nexport const maxLoadedTextures = 30\n\n/** Maximum derived-texture entries in `generate`'s store before FIFO eviction. */\nexport const maxGeneratedTextures = 20\n\n/**\n * Shared cache for textures resolved through the shader uniform pipeline.\n *\n * Two stores, separated by source semantics and memory profile:\n *\n * - `load(key, factory)`: async sources (URL-loaded images). Caches the in-flight\n *   promise so concurrent first loads dedupe to a single network/decode pass.\n *   Rejections are evicted so a retry can succeed. FIFO-evicted past\n *   `maxLoadedTextures` \u2014 entries are cheap (raster `HTMLImageElement`s share\n *   their decoded bytes with the browser image cache), but rasterized SVG\n *   canvases can reach 4096px on the longest side, so the cap matters.\n *\n * - `generate(key, factory)`: synchronously derived textures (heightmaps and\n *   future synthetics). FIFO-evicted past when limit is exceeded; each entry is\n *   a source-image-sized canvas and is usually the heaviest thing in the cache.\n *\n * Identity is the whole point: returning the same `HTMLImageElement` /\n * `HTMLCanvasElement` across renders lets `WebGL2ShaderRenderer.bindTexture`'s\n * reference-equality guard skip the GPU upload on drag-induced rerenders.\n *\n * @internal\n */\nexport class ShaderTextureCache {\n\tprivate loaders = new Map<string, Promise<TextureSource>>()\n\tprivate generated = new Map<string, TextureSource>()\n\n\tload(key: string, factory: () => Promise<TextureSource>): Promise<TextureSource> {\n\t\tconst cached = this.loaders.get(key)\n\t\tif (cached) return cached\n\n\t\tconst promise = factory()\n\t\tpromise.catch(() => {\n\t\t\tif (this.loaders.get(key) === promise) this.loaders.delete(key)\n\t\t})\n\t\tevictOldestIfFull(this.loaders, maxLoadedTextures)\n\t\tthis.loaders.set(key, promise)\n\t\treturn promise\n\t}\n\n\tgenerate(key: string, factory: () => TextureSource | undefined): TextureSource | undefined {\n\t\tconst cached = this.generated.get(key)\n\t\tif (cached) return cached\n\n\t\tconst created = factory()\n\t\tif (!created) return undefined\n\n\t\tevictOldestIfFull(this.generated, maxGeneratedTextures)\n\t\tthis.generated.set(key, created)\n\t\treturn created\n\t}\n\n\tclear(): void {\n\t\tthis.loaders.clear()\n\t\tthis.generated.clear()\n\t}\n\n\t/** @internal Exposed for testing. */\n\tget loadedSize(): number {\n\t\treturn this.loaders.size\n\t}\n\n\t/** @internal Exposed for testing. */\n\tget generatedSize(): number {\n\t\treturn this.generated.size\n\t}\n}\n\nfunction evictOldestIfFull(map: Map<string, unknown>, max: number): void {\n\tif (map.size < max) return\n\tconst oldest = map.keys().next().value\n\tif (oldest !== undefined) map.delete(oldest)\n}\n\nexport const shaderTextureCache = /* @__PURE__ */ new ShaderTextureCache()\n", "/**\n * Heightmap generation for shader modules.\n *\n * Generates a three-channel texture from a transparent image:\n * - Red:   normalized Poisson field (0 at boundary, 255 at deepest center)\n * - Green: inverted alpha from the original image (255 = outside/transparent, 0 = inside/opaque)\n * - Blue:  hard binary shape mask (255 = inside, 0 = outside) \u2014 no anti-aliasing\n *\n * The blue channel exists because bilinear texture filtering at the shape boundary\n * blends inside texels (r=depth, g=0) with outside texels (r=0, g=255), producing\n * pixels where both R and G are non-zero simultaneously. Shaders can threshold B\n * (e.g. `step(0.5, hm.b)`) to get a clean inside/outside decision for masking.\n *\n * Pipeline: scale to 1024 working res (short edge) \u2192 binary mask \u2192\n * 8-connected boundary detection \u2192 Poisson solve \u2192 write R+G+B at working res \u2192 upscale.\n * Working resolution scales by the short edge (1024px min) so wide/tall images get\n * more detail. SVGs arrive pre-rasterized at 4096px from loadTexture.\n * The Poisson solver produces smooth harmonic gradients naturally tolerant to noise.\n * Results are cached via `shaderTextureCache` when the caller provides a cache key.\n */\n\nimport { shaderTextureCache } from \"./shaderTextureCache.ts\"\n\nconst scaledDownWorkingResolution = 1024\n\n/**\n * Subset of TexImageSource that heightmap generation supports.\n * We accept TexImageSource at the public API boundary because that's the\n * type WebGL programs use for texture inputs, keeping the interface\n * consistent and easy to extend. Type guards narrow to this union\n * internally so new sources can be added here without changing callers.\n */\ntype HeightMapSupportedTexImageSource = HTMLImageElement | HTMLCanvasElement\n\n/**\n * Generates a heightmap texture from a source image with transparency.\n * Returns a canvas usable directly as a WebGL texture source.\n *\n * The caller provides cache identity via `getCacheKey` (e.g. URL, data\n * attribute) \u2014 passing `undefined` skips caching entirely.\n */\nexport function generateHeightmap(\n\timage: TexImageSource,\n\tgetCacheKey?: () => string | undefined,\n): HTMLCanvasElement | undefined {\n\tif (!isHeightMapSupportedTexImageSource(image)) return\n\n\tconst cacheKey = getCacheKey?.()\n\tif (!cacheKey) return buildHeightmap(image)\n\n\tconst cached = shaderTextureCache.generate(cacheKey, () => buildHeightmap(image))\n\tif (!(cached instanceof HTMLCanvasElement)) return undefined\n\treturn cached\n}\n\nfunction buildHeightmap(image: HeightMapSupportedTexImageSource): HTMLCanvasElement | undefined {\n\tconst info = getImageInfo(image)\n\tif (!info) return undefined\n\n\t// Scale so the short edge = scaledDownWorkingResolution, then cap total pixel count\n\t// to avoid OOM on extreme aspect ratios (e.g. 12000\u00D7200 would otherwise\n\t// produce a 61440\u00D71024 working canvas).\n\tlet scale = scaledDownWorkingResolution / Math.min(info.width, info.height)\n\tconst maxPixelCount = scaledDownWorkingResolution * scaledDownWorkingResolution\n\tconst uncappedPixels = info.width * scale * (info.height * scale)\n\tif (uncappedPixels > maxPixelCount) {\n\t\tscale *= Math.sqrt(maxPixelCount / uncappedPixels)\n\t}\n\tconst width = Math.max(1, Math.round(info.width * scale))\n\tconst height = Math.max(1, Math.round(info.height * scale))\n\n\t// Draw source image onto a canvas to extract pixel data\n\tconst srcCanvas = document.createElement(\"canvas\")\n\tsrcCanvas.width = width\n\tsrcCanvas.height = height\n\tconst srcCtx = srcCanvas.getContext(\"2d\")\n\tif (!srcCtx) return undefined\n\tsrcCtx.drawImage(info.source, 0, 0, width, height)\n\tconst pixels = srcCtx.getImageData(0, 0, width, height).data\n\n\t// Step 1: Binary shape mask from alpha \u2014 any visible pixel is shape.\n\t// The Poisson solver is naturally noise-tolerant, so no morphological\n\t// filtering is needed.\n\tconst size = width * height\n\tconst mask = new Uint8Array(size)\n\tfor (let i = 0; i < size; i++) {\n\t\tmask[i] = (pixels[i * 4 + 3] ?? 0) > 0 ? 1 : 0\n\t}\n\n\t// Step 2: Classify shape pixels as boundary vs interior (8-connected).\n\t// A shape pixel is \"boundary\" if it has at least one non-shape neighbor\n\t// or sits on the canvas edge. Boundary pixels are pinned at 0,\n\t// interior pixels get their value computed by the Poisson solver.\n\tconst interior = new Uint8Array(size)\n\tfor (let i = 0; i < size; i++) {\n\t\tif (mask[i] === 0) continue\n\t\tconst x = i % width\n\t\tconst y = Math.floor(i / width)\n\t\tif (x === 0 || x === width - 1 || y === 0 || y === height - 1) continue\n\n\t\tlet isBoundary = false\n\t\tfor (let dy = -1; dy <= 1 && !isBoundary; dy++) {\n\t\t\tfor (let dx = -1; dx <= 1 && !isBoundary; dx++) {\n\t\t\t\tif (dx === 0 && dy === 0) continue\n\t\t\t\tif (mask[(y + dy) * width + (x + dx)] === 0) isBoundary = true\n\t\t\t}\n\t\t}\n\t\tif (!isBoundary) interior[i] = 1\n\t}\n\n\t// Step 3: Poisson solve over interior pixels using Red-Black SOR.\n\t// Produces a smooth harmonic field that peaks at the deepest interior\n\t// and falls to 0 at boundaries \u2014 naturally noise-tolerant.\n\tconst field = solvePoissonField(interior, width, height)\n\n\t// Normalize to 0-1 range\n\tlet maxVal = 0\n\tfor (let i = 0; i < size; i++) {\n\t\tconst v = field[i] ?? 0\n\t\tif (v > maxVal) maxVal = v\n\t}\n\n\t// Step 4: Write R (Poisson field), G (inverted alpha), and B (hard mask)\n\t// at working resolution. All channels are upscaled together in step 5.\n\tconst lowResCanvas = document.createElement(\"canvas\")\n\tlowResCanvas.width = width\n\tlowResCanvas.height = height\n\tconst lowResCtx = lowResCanvas.getContext(\"2d\")\n\tif (!lowResCtx) return undefined\n\tconst outData = lowResCtx.createImageData(width, height)\n\tfor (let i = 0; i < size; i++) {\n\t\tconst normalized = maxVal > 0 ? (field[i] ?? 0) / maxVal : 0\n\t\toutData.data[i * 4] = Math.round(normalized * 255) // R = Poisson field\n\t\toutData.data[i * 4 + 1] = 255 - (pixels[i * 4 + 3] ?? 0) // G = inverted alpha\n\t\toutData.data[i * 4 + 2] = mask[i] ? 255 : 0 // B = hard shape mask (no AA)\n\t\toutData.data[i * 4 + 3] = 255 // A = full opacity\n\t}\n\n\tlowResCtx.putImageData(outData, 0, 0)\n\n\t// Step 5: Upscale all channels to output dimensions.\n\t// Bilinear interpolation smooths R and G; B gets interpolated too\n\t// but shaders threshold it at 0.5 for a hard edge.\n\tconst outCanvas = document.createElement(\"canvas\")\n\toutCanvas.width = info.width\n\toutCanvas.height = info.height\n\tconst outCtx = outCanvas.getContext(\"2d\")\n\tif (!outCtx) return undefined\n\toutCtx.imageSmoothingEnabled = true\n\toutCtx.drawImage(lowResCanvas, 0, 0, info.width, info.height)\n\n\treturn outCanvas\n}\n\ninterface ImageInfo {\n\treadonly source: CanvasImageSource\n\treadonly width: number\n\treadonly height: number\n}\n\n/**\n * Solves a Poisson equation over interior shape pixels using Red-Black\n * Successive Over-Relaxation (SOR). Produces a smooth harmonic field\n * that peaks at the deepest interior and falls to 0 at boundaries.\n *\n * Uses a sparse representation \u2014 only interior pixels are iterated,\n * with precomputed neighbor indices. For typical logos covering ~30%\n * of the image, this is ~3x faster than iterating the full grid.\n *\n * Parameters:\n * - omega 1.95: near-optimal SOR relaxation for large grids (theoretical\n *   optimum ~1.99 for 1024px). Conservative enough to avoid oscillation.\n * - iterations 50: tuned for 1024px working resolution. SOR convergence\n *   scales with grid dimension; 50 gives full propagation at 1024px.\n * - sourceTerm 0.01: constant driving term. Scale is arbitrary since the\n *   output is normalized to 0-1.\n *\n * @internal Exported for testing.\n */\nexport function solvePoissonField(\n\tinterior: Readonly<Uint8Array>,\n\twidth: number,\n\theight: number,\n): Readonly<Float32Array> {\n\tconst size = width * height\n\tconst field = new Float32Array(size)\n\n\tconst omega = 1.95\n\tconst sourceTerm = 0.01\n\tconst iterations = 50\n\n\t// Build sparse pixel lists split by red-black checkerboard parity.\n\t// Each list is a flat Int32Array with stride 5: [idx, top, bottom, left, right].\n\t// Neighbor index is -1 for out-of-bounds (reads as 0).\n\tconst redEntries: number[] = []\n\tconst blackEntries: number[] = []\n\tfor (let i = 0; i < size; i++) {\n\t\tif (interior[i] === 0) continue\n\t\tconst x = i % width\n\t\tconst y = Math.floor(i / width)\n\t\tconst entries = (x + y) % 2 === 0 ? redEntries : blackEntries\n\t\tentries.push(\n\t\t\ti,\n\t\t\ty > 0 ? i - width : -1,\n\t\t\ty < height - 1 ? i + width : -1,\n\t\t\tx > 0 ? i - 1 : -1,\n\t\t\tx < width - 1 ? i + 1 : -1,\n\t\t)\n\t}\n\tconst red = new Int32Array(redEntries)\n\tconst black = new Int32Array(blackEntries)\n\n\tconst oneMinusOmega = 1 - omega\n\tconst omegaOver4 = omega / 4\n\n\tfor (let iter = 0; iter < iterations; iter++) {\n\t\t// Standard Red-Black SOR: update all red pixels then all black pixels\n\t\t// within each iteration, so each color benefits from the other's updates.\n\t\tupdatePixels(red, field, oneMinusOmega, omegaOver4, sourceTerm)\n\t\tupdatePixels(black, field, oneMinusOmega, omegaOver4, sourceTerm)\n\t}\n\n\treturn field\n}\n\n/** Processes a sparse pixel list (stride 5) for one SOR half-step. */\nfunction updatePixels(\n\tpixels: Readonly<Int32Array>,\n\tfield: Float32Array,\n\toneMinusOmega: number,\n\tomegaOver4: number,\n\tsourceTerm: number,\n): void {\n\tfor (let j = 0; j < pixels.length; j += 5) {\n\t\tconst idx = pixels[j] ?? 0\n\t\tconst topIdx = pixels[j + 1] ?? -1\n\t\tconst bottomIdx = pixels[j + 2] ?? -1\n\t\tconst leftIdx = pixels[j + 3] ?? -1\n\t\tconst rightIdx = pixels[j + 4] ?? -1\n\n\t\tconst top = topIdx >= 0 ? (field[topIdx] ?? 0) : 0\n\t\tconst bottom = bottomIdx >= 0 ? (field[bottomIdx] ?? 0) : 0\n\t\tconst left = leftIdx >= 0 ? (field[leftIdx] ?? 0) : 0\n\t\tconst right = rightIdx >= 0 ? (field[rightIdx] ?? 0) : 0\n\n\t\tfield[idx] = oneMinusOmega * (field[idx] ?? 0) + omegaOver4 * (sourceTerm + top + bottom + left + right)\n\t}\n}\n\n// NOTE: Extend this with other instance checks in case sources other than\n// image and canvas elements need height map generation support.\nfunction getImageInfo(image: TexImageSource): ImageInfo | undefined {\n\tif (image instanceof HTMLImageElement) {\n\t\tconst w = image.naturalWidth\n\t\tconst h = image.naturalHeight\n\t\treturn w > 0 && h > 0 ? { source: image, width: w, height: h } : undefined\n\t}\n\tif (image instanceof HTMLCanvasElement) {\n\t\treturn image.width > 0 && image.height > 0 ? { source: image, width: image.width, height: image.height } : undefined\n\t}\n\n\treturn undefined\n}\n\nfunction isHeightMapSupportedTexImageSource(image: TexImageSource): image is HeightMapSupportedTexImageSource {\n\treturn image instanceof HTMLImageElement || image instanceof HTMLCanvasElement\n}\n", "import type { ShaderResolutionScale } from \"../../../modules/defineShader.ts\"\nimport { assertNever } from \"../../../utils/assert.ts\"\nimport { isObject, isString } from \"../../../utils/utils.ts\"\nimport { Color, P3Color } from \"../../types/Color/Color.ts\"\nimport { ControlType } from \"../../types/PropertyControls.ts\"\nimport { parseCSSVariable } from \"../../utils/parseCSSVariable.ts\"\nimport type { UniformName, UniformValue, Vec4 } from \"./WebGL2ShaderRenderer.ts\"\nimport { generateHeightmap } from \"./heightmap.ts\"\nimport { shaderTextureCache } from \"./shaderTextureCache.ts\"\nimport type { ShaderMouseData, ShaderUniformInput } from \"./types.ts\"\nimport { toArrayLengthName, toHeightmapUniformName, toUniformName } from \"./uniformName.ts\"\n\nexport const overlayStyle: React.CSSProperties = {\n\tposition: \"absolute\",\n\tinset: 0,\n\twidth: \"100%\",\n\theight: \"100%\",\n}\n\n/**\n * Multiplier to convert milliseconds to seconds.\n * Since we use requestAnimationFrame and performance.now(), the base time we receive in callbacks is in milliseconds.\n */\nexport const timeMultiplier = 0.001\n\n/**\n * Sentinel UV coordinate used when the pointer is absent or outside the element.\n */\nexport const offScreen = -999\n\n/**\n * Default mouse state representing \"no pointer interaction.\"\n * Non-interactive render paths (offscreen fallback worker, shaders without mouse\n * config) pass this explicitly to `WebGL2ShaderRenderer.render` \u2014 avoids the\n * WebGL zero-init trap where `u_mousePosition` would otherwise read as `vec4(0)`\n * (UV origin / bottom-left).\n */\nexport const defaultMouseData: ShaderMouseData = {\n\tposition: [offScreen, offScreen, 0, 0],\n\tpointerDown: 0,\n\thover: 0,\n}\n\n/**\n * Resolves a CSS variable string to its computed color value using the DOM.\n * Falls back to the inline fallback value if the custom property is not defined\n * or no element is available. P3 values are converted to sRGB because shaders\n * only work with sRGB color space.\n */\nexport function resolveCSSVariableColor(color: string, element?: Element | null): string {\n\tconst parsed = parseCSSVariable(color)\n\tif (!parsed.customProperty) return color\n\n\tif (element) {\n\t\tconst resolved = getComputedStyle(element).getPropertyValue(parsed.customProperty).trim()\n\t\tif (resolved) return P3Color.srgbFromValue(resolved)\n\t}\n\n\treturn P3Color.srgbFromValue(parsed.fallback ?? color)\n}\n\n/**\n * Converts a CSS color string to a normalized vec4 array for shader uniforms.\n * RGB values are normalized from 0-255 to 0-1 range.\n *\n * When the color is a CSS variable (e.g. a design token), the element is used\n * to resolve the variable via getComputedStyle before conversion.\n */\nexport function colorToVec4(color: string, element?: Element | null): Vec4 {\n\tconst resolved = resolveCSSVariableColor(color, element)\n\tconst rgba = Color.toRgb(Color(resolved))\n\treturn [rgba.r / 255, rgba.g / 255, rgba.b / 255, rgba.a]\n}\n\n/**\n * Loads an image from a URL for use as a WebGL texture.\n *\n * SVGs arrive rasterized at 4096px on the longest side (texture filtering handles\n * downscaling). Uses HTMLImageElement instead of createImageBitmap to preserve the\n * browser's native decoding, color-management, and premultiplied-alpha behavior\n * for `texImage2D`.\n */\nexport function loadTexture(url: string): Promise<HTMLImageElement | HTMLCanvasElement> {\n\treturn shaderTextureCache.load(url, () => loadTextureFromNetwork(url))\n}\n\nfunction loadTextureFromNetwork(url: string): Promise<HTMLImageElement | HTMLCanvasElement> {\n\treturn new Promise((resolve, reject) => {\n\t\tconst img = new Image()\n\t\timg.crossOrigin = \"anonymous\"\n\t\timg.onload = () => resolve(rasterizeSVGAtFixedRes(img) ?? img)\n\t\timg.onerror = event => {\n\t\t\tconst message =\n\t\t\t\tevent instanceof ErrorEvent && event.message\n\t\t\t\t\t? `Failed to load texture from \"${url}\": ${event.message}`\n\t\t\t\t\t: `Failed to load texture from \"${url}\"`\n\t\t\treject(new Error(message))\n\t\t}\n\t\timg.src = url\n\t})\n}\n\n/**\n * Returns a stable cache key for a texture source.\n * HTMLImageElement uses its src URL. HTMLCanvasElement uses data-src\n * (set during SVG rasterization to preserve the original image URL).\n * @internal Exported for testing.\n */\nexport function getTextureCacheKey(image: TexImageSource): string | undefined {\n\tif (image instanceof HTMLImageElement) return image.src || undefined\n\tif (image instanceof HTMLCanvasElement) return image.dataset.src || undefined\n\treturn undefined\n}\n\nconst svgExtension = \".svg\"\n\n/** Fixed high resolution for SVG rasterization. Matches Paper's approach. */\nconst svgRasterSize = 4096\n\n/**\n * Re-rasterizes an SVG at a fixed high resolution (4096px on longest side).\n * The browser re-renders the vector source at the target canvas dimensions,\n * producing crisp edges regardless of element size. The GPU handles\n * downscaling via texture filtering (LINEAR_MIPMAP_LINEAR).\n *\n * Returns undefined for non-SVG images.\n */\nfunction rasterizeSVGAtFixedRes(image: HTMLImageElement): HTMLCanvasElement | undefined {\n\tif (!isSVGSource(image.src)) return undefined\n\n\tconst w = image.naturalWidth\n\tconst h = image.naturalHeight\n\tif (w <= 0 || h <= 0) return undefined\n\n\tconst scale = svgRasterSize / Math.max(w, h)\n\tconst targetW = Math.max(1, Math.round(w * scale))\n\tconst targetH = Math.max(1, Math.round(h * scale))\n\n\tconst canvas = document.createElement(\"canvas\")\n\tcanvas.width = targetW\n\tcanvas.height = targetH\n\tconst ctx = canvas.getContext(\"2d\")\n\tif (!ctx) return undefined\n\n\tctx.drawImage(image, 0, 0, targetW, targetH)\n\n\t// Preserve the source URL so downstream consumers (e.g. heightmap cache)\n\t// can identify this canvas as originating from a specific image.\n\tcanvas.dataset.src = image.src\n\n\treturn canvas\n}\n\nfunction isSVGSource(url: string): boolean {\n\ttry {\n\t\tconst pathname = new URL(url, \"https://placeholder\").pathname.toLowerCase()\n\t\treturn pathname.endsWith(svgExtension)\n\t} catch {\n\t\treturn url.toLowerCase().includes(svgExtension)\n\t}\n}\n\n/**\n * Resolves a single uniform input to its WebGL-compatible value.\n * Immediate values resolve instantly, textures are loaded from their URL.\n * Color uniforms that contain CSS variables are resolved via the element's computed style.\n */\nexport async function resolveUniform(\n\tuniform: ShaderUniformInput,\n\telement?: Element | null,\n): Promise<UniformValue | undefined> {\n\tswitch (uniform.type) {\n\t\tcase ControlType.Number:\n\t\tcase ControlType.Enum:\n\t\t\treturn { type: \"float\", value: uniform.value }\n\t\tcase ControlType.Boolean:\n\t\t\treturn { type: \"boolean\", value: uniform.value }\n\t\tcase ControlType.Color:\n\t\t\treturn { type: \"vec4\", value: colorToVec4(uniform.value, element) }\n\t\tcase ControlType.ResponsiveImage: {\n\t\t\tlet url: string | undefined\n\n\t\t\tif (isString(uniform.value)) {\n\t\t\t\turl = uniform.value\n\t\t\t} else if (isObject(uniform.value) && \"src\" in uniform.value) {\n\t\t\t\turl = uniform.value.src\n\t\t\t}\n\n\t\t\tif (!url) return\n\n\t\t\tconst image = await loadTexture(url)\n\t\t\treturn { type: \"sampler2D\", value: image }\n\t\t}\n\t\tcase ControlType.Array:\n\t\t\treturn { type: \"vec4[]\", value: uniform.value.map(color => colorToVec4(color, element)) }\n\t\tdefault:\n\t\t\tassertNever(uniform)\n\t}\n}\n\n/**\n * Resolves all uniform inputs to WebGL-compatible values. Adds `u_<key>_length` for arrays.\n * Color uniforms that contain CSS variables are resolved via the element's computed style.\n *\n * When `heightmapSource` is set, also generates a heightmap texture from the referenced\n * image uniform and adds it as `u_<key>_heightmap`.\n */\nexport async function resolveUniforms(\n\tuniforms: Record<UniformName, ShaderUniformInput>,\n\telement?: Element | null,\n\theightmapSource?: string,\n): Promise<Record<UniformName, UniformValue>> {\n\tconst result: Record<string, UniformValue> = {}\n\tconst heightmapSourceUniform = heightmapSource ? toUniformName(heightmapSource) : undefined\n\n\tfor (const [name, uniform] of Object.entries(uniforms)) {\n\t\tconst resolved = await resolveUniform(uniform, element)\n\t\tif (!resolved) continue\n\n\t\tresult[name] = resolved\n\n\t\tif (uniform.type === ControlType.Array) {\n\t\t\tresult[toArrayLengthName(name)] = { type: \"int\", value: uniform.value.length }\n\t\t}\n\n\t\t// Generate heightmap for the designated source image\n\t\tif (heightmapSource && heightmapSourceUniform && name === heightmapSourceUniform && resolved.type === \"sampler2D\") {\n\t\t\tconst heightmap = generateHeightmap(resolved.value, () => getTextureCacheKey(resolved.value))\n\t\t\tif (heightmap) {\n\t\t\t\tresult[toHeightmapUniformName(heightmapSource)] = { type: \"sampler2D\", value: heightmap }\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result\n}\n\nexport function closeImageBitmaps(uniforms: Record<string, UniformValue>): void {\n\tfor (const uniform of Object.values(uniforms)) {\n\t\tif (uniform.type === \"sampler2D\" && uniform.value instanceof ImageBitmap) {\n\t\t\tuniform.value.close()\n\t\t}\n\t}\n}\n\nexport function resolveResolutionScale(scale: ShaderResolutionScale | undefined): number {\n\tif (typeof scale === \"number\") return scale\n\tif (scale === \"performance\") return 0.75\n\tif (scale === \"consistent\") return 0\n\treturn 1\n}\n\n/**\n * Calculates shader timing values from a raw millisecond timestamp.\n */\nexport function getShaderTiming(timeMs: number, startTime: number, lastTime: number) {\n\tconst currentTime = timeMs * timeMultiplier\n\tconst elapsedTime = currentTime - startTime\n\t// Use a sensible default for the first frame when lastTime equals startTime\n\tconst deltaTime = lastTime === startTime ? 1 / 60 : currentTime - lastTime\n\treturn { currentTime, elapsedTime, deltaTime }\n}\n", "import { memo, startTransition, useCallback, useEffect, useLayoutEffect, useRef, useState } from \"react\"\nimport { ShaderCanvas } from \"./ShaderCanvas.tsx\"\nimport { ShaderFallbackImage } from \"./ShaderFallbackImage.tsx\"\nimport { overlayStyle } from \"./helpers.ts\"\nimport { usePatchDelayShaderRender } from \"./hooks.ts\"\nimport type { ShaderMouseData, ShaderProps } from \"./types.ts\"\n\ntype ShaderWithFallbackOverlayProps = Pick<\n\tShaderProps,\n\t| \"fallbackImage\"\n\t| \"skipInitialFallback\"\n\t| \"vertexShader\"\n\t| \"fragmentShader\"\n\t| \"animated\"\n\t| \"resolutionScale\"\n\t| \"uniforms\"\n\t| \"onError\"\n\t| \"onReady\"\n\t| \"mode\"\n\t| \"onContextLost\"\n\t| \"onUniformResolutionSucceeded\"\n\t| \"onUniformResolutionFailed\"\n\t| \"heightmapSource\"\n\t| \"buffers\"\n> & {\n\t/** Pass through to ShaderCanvas for pool-based single-frame rendering. */\n\tsingleFrame?: boolean\n\t/** Ref to mouse interaction data. */\n\tmouseDataRef?: React.RefObject<ShaderMouseData>\n}\n\nconst SHADER_PLAY_DELAY = 250\n\nexport const ShaderWithFallbackOverlay = /* @__PURE__ */ memo(function ShaderWithFallbackOverlay({\n\tmode,\n\tfallbackImage,\n\tskipInitialFallback,\n\tvertexShader,\n\tfragmentShader,\n\tanimated,\n\tresolutionScale,\n\tuniforms,\n\tonError,\n\tonReady,\n\tsingleFrame,\n\tonContextLost,\n\tonUniformResolutionSucceeded,\n\tonUniformResolutionFailed,\n\theightmapSource,\n\tmouseDataRef,\n\tbuffers,\n}: ShaderWithFallbackOverlayProps) {\n\tconst [isShaderReady, setIsShaderReady] = useState(false)\n\tconst [shouldPlay, setShouldPlay] = useState(false)\n\n\t// When mode is progressive, the fallback image is shown initially\n\t// and then the real shader is rendered. (production / published site)\n\tconst isProgressive = mode === \"progressive\"\n\tconst hasFallbackImage = Boolean(fallbackImage)\n\tconst shouldSkipInitialFallback = Boolean(skipInitialFallback && hasFallbackImage)\n\tconst isFallbackShown = isProgressive && hasFallbackImage && !shouldSkipInitialFallback\n\tconst isRevealDelayComplete = usePatchDelayShaderRender(isFallbackShown)\n\n\t// Keep `handleReady` stable, but still call the latest `onReady`\n\tconst onReadyRef = useRef(onReady)\n\n\tuseLayoutEffect(() => {\n\t\tonReadyRef.current = onReady\n\t}, [onReady])\n\n\tconst handleReady = useCallback(() => {\n\t\tstartTransition(() => setIsShaderReady(true))\n\t\tonReadyRef.current?.()\n\t}, [])\n\n\t// Progressive mode: once the first frame has painted, start playing after a delay\n\t// to make the swap between the fallback and the shader less noticeable.\n\tuseEffect(() => {\n\t\t// If not progressive mode, shader plays right away\n\t\tif (!isProgressive) return\n\n\t\t// The shader calls `handleReady` when the first frame has painted.\n\t\t// `isRevealDelayComplete` is true after our delay has completed.\n\t\tif (!isShaderReady || !isRevealDelayComplete) return\n\n\t\t// Finally, we start playing the shader after a further delay to\n\t\t// make the swap less noticeable.\n\t\tconst timeout = window.setTimeout(() => {\n\t\t\tstartTransition(() => setShouldPlay(true))\n\t\t}, SHADER_PLAY_DELAY)\n\n\t\treturn () => {\n\t\t\tclearTimeout(timeout)\n\t\t}\n\t}, [isProgressive, isRevealDelayComplete, isShaderReady])\n\n\tconst shouldHideCanvas = isFallbackShown && !isRevealDelayComplete\n\n\t// In progressive mode, use singleFrame rendering until the reveal sequence completes.\n\t// This renders a single frame at t=0 (matching the fallback) until playback starts.\n\t// When skipInitialFallback is set, bypass the progressive reveal entirely and play immediately.\n\tconst isWaitingForPlayback = isProgressive && !shouldSkipInitialFallback && !shouldPlay\n\tconst effectiveSingleFrame = singleFrame || shouldHideCanvas || isWaitingForPlayback\n\tconst shouldShowFallback =\n\t\thasFallbackImage && !shouldSkipInitialFallback && (!isRevealDelayComplete || !isShaderReady)\n\n\treturn (\n\t\t<>\n\t\t\t<div style={{ ...overlayStyle, opacity: shouldHideCanvas ? 0 : 1 }}>\n\t\t\t\t<ShaderCanvas\n\t\t\t\t\tvertexShader={vertexShader}\n\t\t\t\t\tfragmentShader={fragmentShader}\n\t\t\t\t\tanimated={animated}\n\t\t\t\t\tresolutionScale={resolutionScale}\n\t\t\t\t\tsingleFrame={effectiveSingleFrame}\n\t\t\t\t\tuniforms={uniforms}\n\t\t\t\t\tonError={onError}\n\t\t\t\t\tonReady={handleReady}\n\t\t\t\t\tonContextLost={onContextLost}\n\t\t\t\t\tonUniformResolutionSucceeded={onUniformResolutionSucceeded}\n\t\t\t\t\tonUniformResolutionFailed={onUniformResolutionFailed}\n\t\t\t\t\theightmapSource={heightmapSource}\n\t\t\t\t\tmouseDataRef={mouseDataRef}\n\t\t\t\t\tbuffers={buffers}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t{fallbackImage && !shouldSkipInitialFallback && (\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\t...overlayStyle,\n\t\t\t\t\t\topacity: shouldShowFallback ? 1 : 0,\n\t\t\t\t\t\ttransition: \"opacity 200ms ease-in-out\",\n\t\t\t\t\t\tpointerEvents: \"none\",\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<ShaderFallbackImage src={fallbackImage} />\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</>\n\t)\n})\n", "import { useCallback, useEffect, useLayoutEffect, useRef } from \"react\"\nimport { WebGL2ShaderRenderer } from \"./WebGL2ShaderRenderer.ts\"\nimport { DEFAULT_FRAGMENT_SHADER, DEFAULT_VERTEX_SHADER } from \"./defaultShaders.ts\"\nimport { defaultMouseData, getShaderTiming, resolveResolutionScale, timeMultiplier } from \"./helpers.ts\"\nimport { useCanvasResize, useResolvedUniforms } from \"./hooks.ts\"\nimport type { ShaderMouseData, ShaderProps } from \"./types.ts\"\n\ntype ShaderCanvasProps = Pick<\n\tShaderProps,\n\t| \"vertexShader\"\n\t| \"fragmentShader\"\n\t| \"animated\"\n\t| \"resolutionScale\"\n\t| \"uniforms\"\n\t| \"onError\"\n\t| \"onContextLost\"\n\t| \"onUniformResolutionSucceeded\"\n\t| \"onUniformResolutionFailed\"\n\t| \"heightmapSource\"\n\t| \"buffers\"\n> & {\n\tonReady?: () => void\n\t/**\n\t * When true, no continuous rAF loop runs. Instead, a single frame is rendered\n\t * at t=0 on mount and whenever resolvedUniforms change or the canvas resizes.\n\t * Used by the pool system for non-selected shaders that hold a WebGL context,\n\t * and by progressive mode while waiting for reveal.\n\t */\n\tsingleFrame?: boolean\n\t/** Ref to mouse interaction data. Updated externally each frame. */\n\tmouseDataRef?: React.RefObject<ShaderMouseData>\n}\n\nconst canvasStyle: React.CSSProperties = {\n\tdisplay: \"block\",\n\twidth: \"100%\",\n\theight: \"100%\",\n}\n\n/**\n * WebGL2 canvas for rendering custom fragment shaders.\n *\n * Uniforms can include texture URLs (type: \"texture\") which are automatically\n * loaded and converted to sampler2D uniforms for the shader.\n */\nexport function ShaderCanvas({\n\tvertexShader = DEFAULT_VERTEX_SHADER,\n\tfragmentShader = DEFAULT_FRAGMENT_SHADER,\n\tanimated = true,\n\tresolutionScale,\n\tuniforms,\n\tonError,\n\tonReady,\n\tonContextLost,\n\tonUniformResolutionSucceeded,\n\tonUniformResolutionFailed,\n\tsingleFrame = false,\n\theightmapSource,\n\tmouseDataRef,\n\tbuffers,\n}: ShaderCanvasProps) {\n\tconst canvasRef = useRef<HTMLCanvasElement>(null)\n\tconst rendererRef = useRef<WebGL2ShaderRenderer | null>(null)\n\tconst animationFrameRef = useRef<number>(0)\n\tconst startTimeRef = useRef<number>(0)\n\tconst lastTimeRef = useRef<number>(0)\n\tconst shaderRenderedFrameRef = useRef<number | null>(null)\n\n\t// Store callbacks in refs so the WebGL setup effect doesn't re-run when they change.\n\tconst onReadyRef = useRef(onReady)\n\tuseLayoutEffect(() => {\n\t\tonReadyRef.current = onReady\n\t}, [onReady])\n\n\tconst onContextLostRef = useRef(onContextLost)\n\tuseLayoutEffect(() => {\n\t\tonContextLostRef.current = onContextLost\n\t}, [onContextLost])\n\n\tconst { resolvedUniforms, haveUniformsResolved } = useResolvedUniforms(\n\t\tuniforms,\n\t\tcanvasRef,\n\t\theightmapSource,\n\t\tonUniformResolutionSucceeded,\n\t\tonUniformResolutionFailed,\n\t)\n\n\t// Store resolved uniforms in a ref so animate callback doesn't need to depend on them.\n\t// This breaks the dependency chain that would otherwise cause WebGL context recreation on uniform changes.\n\tconst resolvedUniformsRef = useRef(resolvedUniforms)\n\n\t// Store animated in a ref so the animate loop doesn't depend on props directly,\n\t// avoiding WebGL context recreation when animation state changes.\n\tconst animatedRef = useRef(animated)\n\tuseLayoutEffect(() => {\n\t\tanimatedRef.current = animated\n\t}, [animated])\n\n\tconst singleFrameRef = useRef(singleFrame)\n\tuseLayoutEffect(() => {\n\t\tsingleFrameRef.current = singleFrame\n\t}, [singleFrame])\n\n\t// Tracks whether onReady has been signalled for the current renderer instance.\n\t// Reset in the setup effect when the renderer is recreated.\n\tconst readySignalledRef = useRef(false)\n\n\t/** Signal ready after the first frame where uniforms have been resolved. */\n\tconst signalReadyIfNeeded = useCallback(() => {\n\t\tif (readySignalledRef.current || !haveUniformsResolved) return\n\t\treadySignalledRef.current = true\n\t\tonReadyRef.current?.()\n\t\t// Mark on the next rAF so the draw has had a chance to reach the browser's paint pipeline.\n\t\tshaderRenderedFrameRef.current = requestAnimationFrame(() => {\n\t\t\tshaderRenderedFrameRef.current = null\n\n\t\t\t// Beacon: tell headless browsers (screenshotter) that the shader has finished\n\t\t\t// rendering the first frame and that it's safe to screenshot now\n\t\t\tperformance.mark?.(\"shader_rendered\")\n\t\t})\n\t}, [haveUniformsResolved])\n\n\t// Cached CSS size + DPR, populated from ResizeObserver and useOnDprChange callbacks.\n\t// `maybeResize` compares cached vs last-applied so the per-frame call is a no-op when\n\t// nothing has changed \u2014 `renderer.resize()` only runs on real change events.\n\tconst currentSizeRef = useRef({ width: 0, height: 0, dpr: 0 })\n\tconst lastAppliedSizeRef = useRef({ width: 0, height: 0, dpr: 0 })\n\n\tconst updateCurrentSize = useCallback(() => {\n\t\tconst canvas = canvasRef.current\n\t\tif (!canvas) return\n\t\tcurrentSizeRef.current = {\n\t\t\twidth: canvas.offsetWidth,\n\t\t\theight: canvas.offsetHeight,\n\t\t\tdpr: window.devicePixelRatio,\n\t\t}\n\t}, [])\n\n\tconst maybeResize = useCallback(() => {\n\t\tconst renderer = rendererRef.current\n\t\tif (!renderer) return\n\t\tconst current = currentSizeRef.current\n\t\tconst last = lastAppliedSizeRef.current\n\t\tif (current.width === last.width && current.height === last.height && current.dpr === last.dpr) return\n\t\trenderer.resize()\n\t\tlastAppliedSizeRef.current = { ...current }\n\t}, [])\n\n\tconst animate = useCallback(\n\t\t(time: number) => {\n\t\t\tconst renderer = rendererRef.current\n\t\t\tif (!renderer) return\n\n\t\t\t// If we've transitioned to single-frame mode, render one final frame at t=0\n\t\t\t// and stop the loop. This prevents a flash of the last animated time.\n\t\t\tif (singleFrameRef.current) {\n\t\t\t\tif (!haveUniformsResolved) return\n\t\t\t\tmaybeResize()\n\t\t\t\trenderer.render(0, 0, resolvedUniformsRef.current, mouseDataRef?.current ?? defaultMouseData)\n\t\t\t\tsignalReadyIfNeeded()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Skip the draw until async uniform resolution has settled \u2014 otherwise the\n\t\t\t// first frame composes from zero-init custom uniforms and flashes black.\n\t\t\t// Keep the loop alive so we pick up the resolved ref on the next tick.\n\t\t\tif (!haveUniformsResolved) {\n\t\t\t\tanimationFrameRef.current = requestAnimationFrame(animate)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// On the first frame after uniforms become ready, anchor t=0 to now so\n\t\t\t// shaders with intro animations don't skip past their start.\n\t\t\tif (!readySignalledRef.current) {\n\t\t\t\tstartTimeRef.current = time * timeMultiplier\n\t\t\t\tlastTimeRef.current = startTimeRef.current\n\t\t\t}\n\n\t\t\tmaybeResize()\n\n\t\t\tconst { currentTime, elapsedTime, deltaTime } = getShaderTiming(time, startTimeRef.current, lastTimeRef.current)\n\t\t\tlastTimeRef.current = currentTime\n\t\t\trenderer.render(elapsedTime, deltaTime, resolvedUniformsRef.current, mouseDataRef?.current ?? defaultMouseData)\n\n\t\t\tsignalReadyIfNeeded()\n\n\t\t\tif (!singleFrameRef.current && animatedRef.current) {\n\t\t\t\tanimationFrameRef.current = requestAnimationFrame(animate)\n\t\t\t}\n\t\t},\n\t\t[haveUniformsResolved, signalReadyIfNeeded, mouseDataRef, maybeResize],\n\t)\n\n\t/** Render a single frame at t=0 with current uniforms. */\n\tconst renderSingleFrame = useCallback(() => {\n\t\tconst renderer = rendererRef.current\n\t\tif (!renderer || !haveUniformsResolved) return\n\t\tmaybeResize()\n\t\trenderer.render(0, 0, resolvedUniformsRef.current, mouseDataRef?.current ?? defaultMouseData)\n\t\tsignalReadyIfNeeded()\n\t}, [haveUniformsResolved, mouseDataRef, signalReadyIfNeeded, maybeResize])\n\n\t// Sync resolved uniforms ref and re-render in single-frame mode when they change.\n\tuseLayoutEffect(() => {\n\t\tresolvedUniformsRef.current = resolvedUniforms\n\t\tif (singleFrameRef.current && rendererRef.current) {\n\t\t\trenderSingleFrame()\n\t\t}\n\t}, [resolvedUniforms, renderSingleFrame])\n\n\tuseEffect(() => {\n\t\tconst canvas = canvasRef.current\n\t\t// Defer renderer creation until uniforms resolve. Drawing earlier would\n\t\t// render with zero-init custom uniforms, and creating a context that gets\n\t\t// disposed when resolution fails wastes a WebGL slot.\n\t\tif (!canvas || !haveUniformsResolved) return\n\n\t\treadySignalledRef.current = false\n\n\t\ttry {\n\t\t\tconst renderer = new WebGL2ShaderRenderer(\n\t\t\t\tcanvas,\n\t\t\t\tvertexShader,\n\t\t\t\tfragmentShader,\n\t\t\t\tresolveResolutionScale(resolutionScale),\n\t\t\t\tonContextLostRef.current,\n\t\t\t\tbuffers,\n\t\t\t)\n\t\t\trendererRef.current = renderer\n\t\t\t// Reset the last-applied tracker so the new renderer always gets its first resize()\n\t\t\t// call \u2014 otherwise a `resolutionScale` change (which recreates the renderer but\n\t\t\t// leaves CSS size + DPR unchanged) would skip the call and leave canvas dims and\n\t\t\t// `u_pixelRatio` at the constructor defaults.\n\t\t\tlastAppliedSizeRef.current = { width: 0, height: 0, dpr: 0 }\n\t\t\tupdateCurrentSize()\n\t\t\tmaybeResize()\n\t\t\tstartTimeRef.current = performance.now() * timeMultiplier\n\t\t\tlastTimeRef.current = startTimeRef.current\n\n\t\t\tif (singleFrameRef.current) {\n\t\t\t\trenderSingleFrame()\n\t\t\t} else {\n\t\t\t\tanimationFrameRef.current = requestAnimationFrame(animate)\n\t\t\t}\n\t\t} catch (error) {\n\t\t\t// Shader compilation or context creation failed - notify rendering context via callback if provided\n\t\t\tif (onError && error instanceof Error) {\n\t\t\t\tonError(error)\n\t\t\t}\n\t\t}\n\n\t\treturn () => {\n\t\t\tcancelAnimationFrame(animationFrameRef.current)\n\t\t\tif (shaderRenderedFrameRef.current !== null) cancelAnimationFrame(shaderRenderedFrameRef.current)\n\t\t\trendererRef.current?.dispose()\n\t\t\trendererRef.current = null\n\t\t}\n\t}, [\n\t\tvertexShader,\n\t\tfragmentShader,\n\t\tresolutionScale,\n\t\tanimate,\n\t\trenderSingleFrame,\n\t\tonError,\n\t\tbuffers,\n\t\thaveUniformsResolved,\n\t\tupdateCurrentSize,\n\t\tmaybeResize,\n\t])\n\n\t// When leaving single-frame or non-animated state, reset timing so animation\n\t// starts from t=0 (matching the frozen frame the user was seeing) and\n\t// restart the rAF loop.\n\tconst wasAnimatedRef = useRef(animated)\n\tconst wasReactiveRef = useRef(singleFrame)\n\tuseEffect(() => {\n\t\tconst becameAnimated = animated && !wasAnimatedRef.current\n\t\tconst leftReactive = !singleFrame && wasReactiveRef.current\n\n\t\tif ((becameAnimated || leftReactive) && rendererRef.current) {\n\t\t\tstartTimeRef.current = performance.now() * timeMultiplier\n\t\t\tlastTimeRef.current = startTimeRef.current\n\t\t\tanimationFrameRef.current = requestAnimationFrame(animate)\n\t\t}\n\n\t\twasAnimatedRef.current = animated\n\t\twasReactiveRef.current = singleFrame\n\t}, [animated, singleFrame, animate])\n\n\tconst handleResize = useCallback(() => {\n\t\tconst renderer = rendererRef.current\n\t\tif (!renderer || !haveUniformsResolved) return\n\n\t\tupdateCurrentSize()\n\n\t\tif (singleFrameRef.current) {\n\t\t\trenderSingleFrame()\n\t\t\treturn\n\t\t}\n\n\t\tmaybeResize()\n\n\t\t// Render immediately after resize to prevent flashing.\n\t\tconst { currentTime, elapsedTime, deltaTime } = getShaderTiming(\n\t\t\tperformance.now(),\n\t\t\tstartTimeRef.current,\n\t\t\tlastTimeRef.current,\n\t\t)\n\t\tlastTimeRef.current = currentTime\n\t\trenderer.render(elapsedTime, deltaTime, resolvedUniformsRef.current, mouseDataRef?.current ?? defaultMouseData)\n\t}, [haveUniformsResolved, mouseDataRef, renderSingleFrame, updateCurrentSize, maybeResize])\n\n\tuseCanvasResize(canvasRef, handleResize)\n\n\treturn <canvas ref={canvasRef} style={canvasStyle} draggable={false} />\n}\n", "/**\n * Default vertex shader - fullscreen quad with UV coordinates passed to fragment shader.\n * This is the standard vertex shader for most 2D shader effects.\n */\nexport const DEFAULT_VERTEX_SHADER = `#version 300 es\nprecision highp float;\n\nin vec2 a_position;\nin vec2 a_texCoord;\n\nout vec2 v_uv;\n\nvoid main() {\n    v_uv = a_texCoord;\n    gl_Position = vec4(a_position, 0.0, 1.0);\n}\n`\n\n/**\n * Default fragment shader - transparent output.\n */\nexport const DEFAULT_FRAGMENT_SHADER = `#version 300 es\nprecision highp float;\n\nin vec2 v_uv;\nout vec4 fragColor;\n\nvoid main() {\n    fragColor = vec4(0.0);\n}\n`\n", "import { useReducedMotionConfig } from \"framer-motion\"\nimport { startTransition, useCallback, useEffect, useLayoutEffect, useRef, useState } from \"react\"\nimport { useIsomorphicLayoutEffect } from \"../../../useIsomorphicLayoutEffect.ts\"\nimport { RenderTarget } from \"../../types/RenderEnvironment.ts\"\nimport type { SlotStatus } from \"./ShaderPoolContext.ts\"\nimport { slotStatus } from \"./ShaderPoolContext.ts\"\nimport type { UniformName, UniformValue } from \"./WebGL2ShaderRenderer.ts\"\nimport { closeImageBitmaps, resolveUniforms } from \"./helpers.ts\"\nimport type { ShaderRenderMode, ShaderUniformInput } from \"./types.ts\"\n\n/**\n * Resolves uniform inputs to WebGL-compatible values.\n * All uniform types go through the same resolution path.\n * Color uniforms that contain CSS variables are resolved via the element's computed style.\n */\nexport function useResolvedUniforms(\n\tuniforms: Record<UniformName, ShaderUniformInput> | undefined,\n\tcanvasRef: React.RefObject<HTMLCanvasElement | null>,\n\theightmapSource?: string,\n\tonUniformResolutionSucceeded?: () => void,\n\tonUniformResolutionFailed?: () => void,\n): { resolvedUniforms: Record<UniformName, UniformValue>; haveUniformsResolved: boolean } {\n\tconst [resolvedUniforms, setResolvedUniforms] = useState<Record<UniformName, UniformValue>>({})\n\t// Sticky-true once the first resolution attempt commits, even if the result\n\t// is `{}` (e.g. all uniforms are unset images that resolve to undefined).\n\t// Used to gate renderer creation so we don't draw with zero-init custom\n\t// uniforms or allocate a WebGL context that gets disposed on failure.\n\tconst [haveUniformsResolved, setHaveUniformsResolved] = useState(uniforms === undefined)\n\n\tuseEffect(() => {\n\t\tif (!uniforms) {\n\t\t\tstartTransition(() => setHaveUniformsResolved(true))\n\t\t\treturn\n\t\t}\n\n\t\tlet isCancelled = false\n\n\t\tresolveUniforms(uniforms, canvasRef.current, heightmapSource)\n\t\t\t.then(resolved => {\n\t\t\t\tif (isCancelled) {\n\t\t\t\t\tcloseImageBitmaps(resolved)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tstartTransition(() => {\n\t\t\t\t\tsetResolvedUniforms(resolved)\n\t\t\t\t\tsetHaveUniformsResolved(true)\n\t\t\t\t})\n\t\t\t\tonUniformResolutionSucceeded?.()\n\t\t\t})\n\t\t\t.catch(() => {\n\t\t\t\tif (!isCancelled) onUniformResolutionFailed?.()\n\t\t\t})\n\n\t\treturn () => {\n\t\t\tisCancelled = true\n\t\t}\n\t}, [uniforms, canvasRef, heightmapSource, onUniformResolutionSucceeded, onUniformResolutionFailed])\n\n\treturn { resolvedUniforms, haveUniformsResolved }\n}\n\n/**\n * Observes canvas size and device pixel ratio changes.\n *\n * NOTE: ResizeObserver batches calls to the resize handler to once per frame.\n * Performance issues during resize should be done by improving shader performance in favor of enabling instant rendering on resize.\n */\nexport function useCanvasResize(canvasRef: React.RefObject<HTMLCanvasElement | null>, resizeHandler: () => void): void {\n\tuseEffect(() => {\n\t\tconst canvas = canvasRef.current\n\t\tif (!canvas) return\n\n\t\tconst resizeObserver = new ResizeObserver(resizeHandler)\n\t\tresizeObserver.observe(canvas)\n\n\t\treturn () => {\n\t\t\tresizeObserver.disconnect()\n\t\t}\n\t}, [canvasRef, resizeHandler])\n\n\tuseOnDprChange(resizeHandler)\n}\n\n/**\n * Fires callback when device pixel ratio changes (e.g., window moved between monitors).\n */\nexport function useOnDprChange(callback: () => void): void {\n\tuseEffect(() => {\n\t\tlet dprQuery = matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`)\n\n\t\tconst handleChange = () => {\n\t\t\tcallback()\n\t\t\tdprQuery.removeEventListener(\"change\", handleChange)\n\t\t\tdprQuery = matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`)\n\t\t\tdprQuery.addEventListener(\"change\", handleChange)\n\t\t}\n\n\t\tdprQuery.addEventListener(\"change\", handleChange)\n\n\t\treturn () => {\n\t\t\tdprQuery.removeEventListener(\"change\", handleChange)\n\t\t}\n\t}, [callback])\n}\n\ninterface ShaderRenderState {\n\tisFallbackOnly: boolean\n\teffectiveAnimated: boolean\n\teffectiveSingleFrame: boolean\n\teffectiveMode: ShaderRenderMode\n\tshouldSkipFallbackOverlay: boolean\n\t/** Invoke when the WebGL context is lost; sets the fallback latch. */\n\tonContextLost: () => void\n\t/** Invoke when uniform resolution succeeded; clears any prior failure latch. */\n\tonUniformResolutionSucceeded: () => void\n\t/** Invoke when uniform resolution failed; sets the fallback latch. */\n\tonUniformResolutionFailed: () => void\n}\n\n/**\n * Derives the rendering state for a shader based on pool slot, visibility,\n * reduced motion, and context loss. Handles recovery when a shader is\n * re-selected after context loss.\n */\nexport function useShaderRenderState(\n\tpoolSlot: SlotStatus | null,\n\tisSelected: boolean,\n\tisMultiSelected: boolean,\n\tisIntersecting: boolean,\n\tmode: ShaderRenderMode,\n\tanimated: boolean | undefined,\n\tskipInitialFallback: boolean,\n\tisPreviewActive: boolean,\n): ShaderRenderState {\n\tconst shouldReduceMotion = useReducedMotionConfig()\n\tconst shouldPauseOnFirstFrame = shouldReduceMotion === true || RenderTarget.current() === RenderTarget.export\n\tconst shouldSkipFallbackOverlay = skipInitialFallback || shouldPauseOnFirstFrame\n\n\tlet isFallbackOnly: boolean\n\tlet effectiveAnimated: boolean\n\tlet effectiveSingleFrame: boolean\n\tlet effectiveMode: ShaderRenderMode\n\n\tif (poolSlot !== null) {\n\t\tconst hasSlot = poolSlot !== slotStatus.noSlot\n\t\tisFallbackOnly = !hasSlot\n\t\t// Only animate when this is the sole selected node. Multi-selected shaders\n\t\t// render single frames to avoid competing animation loops.\n\t\t// The animated prop (from config) can disable animation entirely.\n\t\t// Skip when the preview is active \u2014 the canvas-side shader is occluded\n\t\t// and would otherwise run for nothing.\n\t\teffectiveAnimated =\n\t\t\t(animated ?? true) && isSelected && !isMultiSelected && !shouldPauseOnFirstFrame && !isPreviewActive\n\t\teffectiveSingleFrame = hasSlot && !effectiveAnimated\n\t\teffectiveMode = \"instant\"\n\t} else {\n\t\tisFallbackOnly = mode === \"fallback\" || !isIntersecting\n\t\teffectiveAnimated = (animated ?? true) && !shouldPauseOnFirstFrame && !isPreviewActive\n\t\teffectiveSingleFrame = !effectiveAnimated\n\t\teffectiveMode = mode\n\t}\n\n\tconst [contextLost, setContextLost] = useState(false)\n\tconst onContextLost = useCallback(() => {\n\t\tstartTransition(() => setContextLost(true))\n\t}, [])\n\n\t// Clear context-lost when the shader is selected so ShaderCanvas mounts\n\t// fresh and creates a new WebGL context.\n\tuseLayoutEffect(() => {\n\t\tif (contextLost && isSelected) {\n\t\t\tstartTransition(() => setContextLost(false))\n\t\t}\n\t}, [contextLost, isSelected])\n\n\tif (contextLost) {\n\t\tisFallbackOnly = true\n\t}\n\n\tconst [uniformResolutionFailed, setUniformResolutionFailed] = useState(false)\n\tconst onUniformResolutionFailed = useCallback(() => {\n\t\tstartTransition(() => setUniformResolutionFailed(true))\n\t}, [])\n\tconst onUniformResolutionSucceeded = useCallback(() => {\n\t\tstartTransition(() => setUniformResolutionFailed(false))\n\t}, [])\n\n\t// Recovery on canvas \u2014 fire only on the false \u2192 true edge of `isSelected`\n\t// so a deterministic failure (e.g. faulty texture URL) doesn't loop.\n\tconst wasSelectedRef = useRef(isSelected)\n\tuseLayoutEffect(() => {\n\t\tconst becameSelected = !wasSelectedRef.current && isSelected\n\t\twasSelectedRef.current = isSelected\n\t\tif (becameSelected && uniformResolutionFailed) {\n\t\t\t// Clearing the failure state lifts the fallback-only guard so ShaderCanvas\n\t\t\t// remounts and re-attempts uniform resolution.\n\t\t\tonUniformResolutionSucceeded()\n\t\t}\n\t}, [uniformResolutionFailed, isSelected, onUniformResolutionSucceeded])\n\n\tif (uniformResolutionFailed) {\n\t\tisFallbackOnly = true\n\t}\n\n\t// Skip fallback when visible, unless context is lost or the pool denied a\n\t// slot \u2014 without the pool check, component-embedded instances all bypass\n\t// the slot limit and race for browser-level WebGL contexts, and the losers\n\t// render blank with the fallback hidden.\n\t// Off-screen fallback suppression is handled in Shader.tsx's render path.\n\tif (\n\t\tmode !== \"fallback\" &&\n\t\tskipInitialFallback &&\n\t\t!contextLost &&\n\t\t!uniformResolutionFailed &&\n\t\tisIntersecting &&\n\t\tpoolSlot !== slotStatus.noSlot\n\t) {\n\t\tisFallbackOnly = false\n\t}\n\n\treturn {\n\t\tisFallbackOnly,\n\t\teffectiveAnimated,\n\t\teffectiveSingleFrame,\n\t\teffectiveMode,\n\t\tshouldSkipFallbackOverlay,\n\t\tonContextLost,\n\t\tonUniformResolutionSucceeded,\n\t\tonUniformResolutionFailed,\n\t}\n}\n\n/**\n * PATCH: Delays shader reveal with a fixed timeout.\n * This avoids, but doesn't fix, a flash of white in Chrome when the shader loads.\n * Other things tried: idle timeout, n frame delay, waiting for window load, PerformanceObserver.\n * It's basically a hack and we should find a better solution.\n */\nconst SHADER_REVEAL_DELAY_MS = 300\nexport function usePatchDelayShaderRender(enabled = true): boolean {\n\tconst [mayRender, setMayRender] = useState(!enabled)\n\n\tuseIsomorphicLayoutEffect(() => {\n\t\tif (!enabled) {\n\t\t\tstartTransition(() => setMayRender(true))\n\t\t\treturn\n\t\t}\n\n\t\tstartTransition(() => setMayRender(false))\n\n\t\tconst timeoutId = window.setTimeout(() => {\n\t\t\tstartTransition(() => setMayRender(true))\n\t\t}, SHADER_REVEAL_DELAY_MS)\n\n\t\treturn () => {\n\t\t\tclearTimeout(timeoutId)\n\t\t}\n\t}, [enabled])\n\n\treturn mayRender\n}\n", "import { createContext, useContext } from \"react\"\n\nexport const slotStatus = {\n\t/** No WebGL context slot allocated \u2014 show fallback image. */\n\tnoSlot: 0,\n\t/** Slot allocated, render a single frame at t=0 and re-render on change. */\n\tsingleFrame: 1,\n\t/** Slot allocated, run continuous rAF animation. */\n\tanimate: 2,\n} as const\n\nexport type SlotStatus = (typeof slotStatus)[keyof typeof slotStatus]\n\n/**\n * Abstract interface for the shader pool, consumed by <Shader> via context.\n * The implementation lives in vekter (ShaderPool.ts).\n */\nexport interface ShaderPoolHandle {\n\tregister(id: string, priority: number): void\n\tderegister(id: string): void\n\tsubscribe(id: string, listener: () => void): () => void\n\tgetSlotStatus(id: string): SlotStatus\n}\n\n/**\n * Context for the shader pool system. When present (canvas), shaders register\n * with the pool and rendering is managed by slot allocation. When null\n * (published sites), shaders render normally without pool management.\n */\nexport const ShaderPoolContext = /* @__PURE__ */ createContext<ShaderPoolHandle | null>(null)\n\nexport function useShaderPoolContext(): ShaderPoolHandle | null {\n\treturn useContext(ShaderPoolContext)\n}\n", "import type { SpringOptions } from \"framer-motion\"\nimport { frame, hover, press, resize, useMotionValue, useSpring, useTransform, useVelocity } from \"framer-motion\"\nimport { useCallback, useEffect, useRef } from \"react\"\nimport { usePointerPosition } from \"../motionplus/usePointerPosition.ts\"\nimport { defaultMouseData, offScreen } from \"./helpers.ts\"\nimport type { ResolvedShaderMouseConfig, ShaderMouseData } from \"./types.ts\"\n\n/** Instant follow \u2014 no spring smoothing. Used when no spring is configured. */\nconst fallbackShaderMouseSpringOptions: SpringOptions = { duration: 0 }\n\n/** Converts SpringOptions duration from seconds to milliseconds for useSpring. */\nexport function toSpringOptions(spring: SpringOptions | undefined): SpringOptions {\n\tconst resolved = spring ?? fallbackShaderMouseSpringOptions\n\treturn resolved.duration !== undefined ? { ...resolved, duration: resolved.duration * 1000 } : resolved\n}\n\nfunction toElementRelative(rect: DOMRect | null, clientX: number, clientY: number): [number, number] {\n\tif (!rect || rect.width <= 0 || rect.height <= 0) return [offScreen, offScreen]\n\tconst x = (clientX - rect.left) / rect.width\n\t// Flip Y for GLSL UV convention (0 at bottom, 1 at top)\n\tconst y = 1 - (clientY - rect.top) / rect.height\n\treturn [x, y]\n}\n\n/**\n * Returns a ref containing mouse position, state, and velocity for shader uniforms.\n * Position is tracked globally so shaders react before hover. pointerDown/hover are element-scoped.\n */\nexport function useShaderMouse(\n\tcontainerRef: React.RefObject<HTMLElement | null>,\n\tmouseConfig: ResolvedShaderMouseConfig | undefined,\n): React.RefObject<ShaderMouseData> {\n\tconst dataRef = useRef<ShaderMouseData>(defaultMouseData)\n\tconst enabled = mouseConfig?.enabled ?? false\n\n\tconst springOptions = toSpringOptions(mouseConfig?.springOptions)\n\n\t// Cache the element rect to avoid forcing layout on every pointermove.\n\tconst rectRef = useRef<DOMRect | null>(null)\n\n\tconst updateRect = useCallback(() => {\n\t\tconst el = containerRef.current\n\t\tif (el) rectRef.current = el.getBoundingClientRect()\n\t}, [containerRef])\n\n\tconst { x: trackedX, y: trackedY } = usePointerPosition(enabled)\n\t// Fallback to local stubs when tracking hasn't initialized (e.g. on the editor canvas\n\t// where every shader passes enabled=false). useTransform needs stable MotionValue\n\t// references every render and crashes on undefined.\n\tconst stubX = useMotionValue(0)\n\tconst stubY = useMotionValue(0)\n\tconst pointerX = trackedX ?? stubX\n\tconst pointerY = trackedY ?? stubY\n\n\tconst rawX = useTransform(pointerX, x => toElementRelative(rectRef.current, x, pointerY.get())[0])\n\tconst rawY = useTransform(pointerY, y => toElementRelative(rectRef.current, pointerX.get(), y)[1])\n\tconst rawPointerDown = useMotionValue(0)\n\tconst rawHover = useMotionValue(0)\n\n\tconst smoothX = useSpring(rawX, springOptions)\n\tconst smoothY = useSpring(rawY, springOptions)\n\tconst smoothPointerDown = useSpring(rawPointerDown, springOptions)\n\tconst smoothHover = useSpring(rawHover, springOptions)\n\n\tconst velocityX = useVelocity(smoothX)\n\tconst velocityY = useVelocity(smoothY)\n\n\tuseEffect(() => {\n\t\tif (!enabled) return\n\n\t\tconst el = containerRef.current\n\t\tif (!el) return\n\n\t\tupdateRect()\n\n\t\tlet hasEnteredOnce = false\n\n\t\twindow.addEventListener(\"scroll\", updateRect, { passive: true, capture: true })\n\n\t\t// Observes the element itself (via ResizeObserver) \u2014 catches size changes from\n\t\t// any source (viewport resize, parent layout, CSS changes), not just window resize.\n\t\tconst cleanupResize = resize(el, updateRect)\n\n\t\tconst cleanupHover = hover(el, () => {\n\t\t\tif (!hasEnteredOnce) {\n\t\t\t\t// Jump the spring to the current position to avoid animating from the\n\t\t\t\t// initial (0, 0) that pointerX/pointerY start at before the first move.\n\t\t\t\thasEnteredOnce = true\n\t\t\t\tsmoothX.jump(rawX.get())\n\t\t\t\tsmoothY.jump(rawY.get())\n\t\t\t}\n\t\t\tframe.update(() => rawHover.set(1))\n\t\t\treturn () => frame.update(() => rawHover.set(0))\n\t\t})\n\n\t\tconst cleanupPress = press(el, () => {\n\t\t\tframe.update(() => rawPointerDown.set(1))\n\t\t\treturn () => frame.update(() => rawPointerDown.set(0))\n\t\t})\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener(\"scroll\", updateRect, { capture: true })\n\t\t\tcleanupResize()\n\t\t\tcleanupHover()\n\t\t\tcleanupPress()\n\t\t\tdataRef.current = defaultMouseData\n\t\t}\n\t}, [enabled, containerRef, rawX, rawY, rawPointerDown, rawHover, smoothX, smoothY, updateRect])\n\n\tconst syncToRef = useCallback(() => {\n\t\tdataRef.current = {\n\t\t\tposition: [smoothX.get(), smoothY.get(), velocityX.get(), velocityY.get()],\n\t\t\tpointerDown: smoothPointerDown.get(),\n\t\t\thover: smoothHover.get(),\n\t\t}\n\t}, [smoothX, smoothY, smoothPointerDown, smoothHover, velocityX, velocityY])\n\n\tuseConditionalAnimationFrame(enabled, syncToRef)\n\n\treturn dataRef\n}\n\n/**\n * Runs the rAF loop only while `enabled` is true \u2014 disabled shaders pay zero cost.\n * `callback` should be wrapped in `useCallback` so the loop isn't torn down every render.\n */\nfunction useConditionalAnimationFrame(enabled: boolean, callback: (time: number, delta: number) => void): void {\n\tuseEffect(() => {\n\t\tif (!enabled) return\n\n\t\tlet rafId = 0\n\t\tlet lastTime = performance.now()\n\t\tfunction tick(time: number) {\n\t\t\tcallback(time, time - lastTime)\n\t\t\tlastTime = time\n\t\t\trafId = requestAnimationFrame(tick)\n\t\t}\n\n\t\trafId = requestAnimationFrame(tick)\n\t\treturn () => cancelAnimationFrame(rafId)\n\t}, [enabled, callback])\n}\n", "/**\n * This file is generated from motion-plus/react.\n * Before committing any changes, please make sure that the overrides we noted below persist.\n */\nimport { frame, type MotionValue, motionValue } from \"framer-motion\"\n\n// NOTE: This type has been extended with `undefined` to fit FramerStudio's use case better\nlet x: MotionValue<number> | undefined\nlet y: MotionValue<number> | undefined\n\nfunction initPointerTracking() {\n\tx = motionValue(0)\n\ty = motionValue(0)\n\n\t// Cached pointer\n\tlet pointerX = 0\n\tlet pointerY = 0\n\n\tfunction updatePointer() {\n\t\t// NOTE: This early return has been added due to the typing additions needed for FramerStudio's use case\n\t\tif (!x || !y) return\n\t\tx.set(pointerX)\n\t\ty.set(pointerY)\n\t}\n\n\tif (typeof window !== \"undefined\") {\n\t\twindow.addEventListener(\n\t\t\t\"pointermove\",\n\t\t\tonlyMouse((event: PointerEvent) => {\n\t\t\t\tpointerX = event.clientX\n\t\t\t\tpointerY = event.clientY\n\n\t\t\t\t/**\n\t\t\t\t * Don't update pointer until the next render frame to\n\t\t\t\t * avoid\n\t\t\t\t *\n\t\t\t\t * TODO: Update motion values to cache rendered value\n\t\t\t\t * and use that in projection measurements\n\t\t\t\t * instead of using this approach\n\t\t\t\t */\n\t\t\t\tframe.update(updatePointer)\n\t\t\t}),\n\t\t)\n\n\t\t// Track pointer during native HTML drag operations,\n\t\t// when pointermove stops firing.\n\t\twindow.addEventListener(\"dragover\", (event: DragEvent) => {\n\t\t\tpointerX = event.clientX\n\t\t\tpointerY = event.clientY\n\t\t\tframe.update(updatePointer)\n\t\t})\n\t}\n}\n\n/**\n * NOTE: this slightly differs from the motion-plus `usePointerPosition()` API, which has no\n * parameters and always attaches global window listeners on first call. The `enabled`\n * flag is a FramerStudio-specific addition so consumers can opt out of initializing the\n * singleton when they don't need pointer tracking. Once any caller opts in, tracking\n * is live for the page lifetime.\n */\nexport function usePointerPosition(enabled = true) {\n\tif (enabled && !x) initPointerTracking()\n\n\treturn { x, y }\n}\n\nfunction onlyMouse(callback: (event: PointerEvent) => void) {\n\treturn (event: PointerEvent) => {\n\t\tif (event.pointerType === \"mouse\") {\n\t\t\tcallback(event)\n\t\t}\n\t}\n}\n", "import { startTransition, useEffect, useState } from \"react\"\nimport type { SlotStatus } from \"./ShaderPoolContext.ts\"\nimport { slotStatus, useShaderPoolContext } from \"./ShaderPoolContext.ts\"\n\n/** Priority values for pool slot allocation. Higher = more likely to get a slot. */\nexport const shaderPriority = {\n\tlow: 0,\n\tmedium: 1,\n\thigh: 2,\n} as const\n\n/**\n * Hook that registers a shader with the pool and returns its current slot status.\n *\n * Returns null when no pool context exists (published sites).\n */\nexport function useShaderPoolSlot(id: string | undefined, isSelected: boolean, isVisible: boolean): SlotStatus | null {\n\tconst pool = useShaderPoolContext()\n\n\tconst priority = isSelected\n\t\t? shaderPriority.high // Animate continuously\n\t\t: isVisible\n\t\t\t? shaderPriority.medium // Render single frames on change\n\t\t\t: shaderPriority.low // May be evicted to show fallback\n\n\tconst [status, setStatus] = useState<SlotStatus>(slotStatus.noSlot)\n\n\t// Register with the pool and subscribe to slot status changes.\n\t// Re-runs on priority changes to update the pool in-place (without deregistering),\n\t// which preserves the shader's registrationOrder tiebreak position.\n\tuseEffect(() => {\n\t\tif (!pool || !id) return\n\t\tpool.register(id, priority)\n\t\tstartTransition(() => setStatus(pool.getSlotStatus(id)))\n\t\tconst unsub = pool.subscribe(id, () => {\n\t\t\tstartTransition(() => setStatus(pool.getSlotStatus(id)))\n\t\t})\n\t\treturn () => {\n\t\t\tunsub()\n\t\t}\n\t}, [pool, id, priority])\n\n\t// Deregister only when the shader leaves the pool (id/pool change or unmount).\n\t// Kept separate from the above effect so that priority changes don't trigger\n\t// a deregister\u2192register cycle, which would reset registrationOrder.\n\tuseEffect(() => {\n\t\tif (!pool || !id) return\n\t\treturn () => {\n\t\t\tpool.deregister(id)\n\t\t}\n\t}, [pool, id])\n\n\tif (!pool) return null\n\treturn status\n}\n", "import type { TargetAndTransition, VariantLabels } from \"framer-motion\"\nimport { scroll, transform } from \"framer-motion\"\nimport React from \"react\"\nimport { useObserverRef } from \"../components/utils/refHelper.ts\"\nimport { RenderTarget } from \"../render/types/RenderEnvironment.ts\"\nimport { useCurrentRouteKey, useOnRouteChange } from \"../router/useCurrentRoute.tsx\"\nimport { isNumber } from \"../utils/utils.ts\"\nimport type { EffectScrollTarget } from \"./createTransformInputRange.ts\"\nimport { createTransformInputRange } from \"./createTransformInputRange.ts\"\nimport type { Prefixed } from \"./hocOptions.ts\"\nimport { extractPrefixedProps } from \"./hocOptions.ts\"\nimport { useAppearEffect } from \"./useAppearEffect.ts\"\nimport { useScrollDirectionChange } from \"./useScrollDirectionChange.ts\"\n\ninterface VariantAppearEffectOptions {\n\tvisibleVariantId: string | undefined\n\tobscuredVariantId: string | undefined\n\tthreshold: number | undefined\n\tanimateOnce: boolean\n\tvariantAppearEffectEnabled: true | undefined\n\ttargets?: EffectVariantScrollTarget[]\n\texitTarget?: boolean\n\tscrollDirection?: EffectVariantScrollTarget\n}\n\nexport type EffectVariantScrollTarget = EffectScrollTarget<string>\n\nexport type PrefixedVariantAppearEffectOptions = Prefixed<VariantAppearEffectOptions>\n\nconst keys = new Set<keyof VariantAppearEffectOptions>([\n\t\"visibleVariantId\",\n\t\"obscuredVariantId\",\n\t\"threshold\",\n\t\"animateOnce\",\n\t\"variantAppearEffectEnabled\",\n\t\"targets\",\n\t\"exitTarget\",\n\t\"scrollDirection\",\n])\n\ninterface InputOutputRanges {\n\tinputRange: number[]\n\toutputRange: number[]\n}\n\nconst defaultRanges: InputOutputRanges = { inputRange: [], outputRange: [] }\n\n/**\n * Creates an input range in px offset from the top of the screen, and the index\n * of the transform target that should be active during those ranges. We use\n * index, rather than the target variant, because we want to be able to record\n * that we have animated to each transformTarget, to prevent running transitions\n * more than once when the user desires. If we recorded the variant string, and\n * the user used the same variant for multiple targets, we may not know if we\n * should or should not animate \"back\" to a variant we had already animated to\n * once before.\n *\n * -1 means the initial variant should be animated back to.\n *\n * e.g. [0, 199, 200, 400, 600, 800] | [-1, -1, 1, 1, 2, 2]\n */\nfunction createInputOutputRanges(\n\ttransformTargets: EffectVariantScrollTarget[],\n\tthreshold: number,\n\texitTarget?: boolean,\n): InputOutputRanges {\n\tconst outputRange: number[] = []\n\tconst inputRange = createTransformInputRange(transformTargets, threshold, index => outputRange.unshift(index, index))\n\n\tif (exitTarget) {\n\t\tconst lastInputRange = inputRange[inputRange.length - 1]\n\t\t// If the last item isn't a number, the ranges are invalid.\n\t\tif (!isNumber(lastInputRange)) return defaultRanges\n\t\tinputRange.push(lastInputRange + 1)\n\t\toutputRange.push(-1)\n\t}\n\n\tconst firstItem = inputRange[0]\n\t// If the first item isn't a number, the ranges are invalid.\n\tif (!isNumber(firstItem)) return defaultRanges\n\n\t// If the first variant scroll target starts so close to 0 that the\n\t// animation must start immediately, don't create ranges that support\n\t// animating away from the first scroll target to the current variant. It\n\t// will just confuse the transformer.\n\tif (firstItem <= 1) return { inputRange, outputRange }\n\n\t// If the input range supports animating back to the initial variant, the\n\t// input range must be at least [0, 1, 2, *, ...].\n\treturn { inputRange: [0, Math.max(firstItem - 1, 0), ...inputRange], outputRange: [-1, -1, ...outputRange] }\n}\n\n/**\n * @public\n */\nexport const withVariantAppearEffect = <\n\tT extends {\n\t\tvariant?: string | undefined\n\t} & object,\n>(\n\tComponent: React.ComponentType<T>,\n) =>\n\tReact.forwardRef(\n\t\t(props: Prefixed<VariantAppearEffectOptions> & T, forwardedRef: React.RefObject<HTMLElement> | null) => {\n\t\t\t// Disable the component when we are on the canvas. This doesn't\n\t\t\t// violate the rule of hooks because it will always be stable.\n\t\t\t//\n\t\t\t// This doesn't violate the rule of hooks because it will always be\n\t\t\t// stable. Rule lint/correctness/useHookAtTopLevel disabled in biome.jsonc for file.\n\t\t\tif (RenderTarget.current() === RenderTarget.canvas) return <Component {...props} ref={forwardedRef} />\n\n\t\t\tconst [options, rest] = extractPrefixedProps<VariantAppearEffectOptions, T>(props, keys)\n\t\t\tconst {\n\t\t\t\tvisibleVariantId,\n\t\t\t\tobscuredVariantId,\n\t\t\t\tanimateOnce,\n\t\t\t\tthreshold,\n\t\t\t\tvariantAppearEffectEnabled,\n\t\t\t\ttargets,\n\t\t\t\texitTarget,\n\t\t\t\tscrollDirection,\n\t\t\t} = options\n\t\t\tconst [activeVariant, setVariant] = React.useState<VariantLabels | undefined>(obscuredVariantId)\n\t\t\tconst animateState = React.useRef<VariantLabels | boolean | undefined>(false)\n\n\t\t\tconst observerRef = useObserverRef(forwardedRef)\n\n\t\t\t// If targets is not provided, we will run the effect based on the intersection of this element and the viewport.\n\t\t\tuseAppearEffect(\n\t\t\t\tobserverRef,\n\t\t\t\t(appears: boolean) => {\n\t\t\t\t\tif (options.targets) return\n\t\t\t\t\tif (options.scrollDirection) return\n\t\t\t\t\tif (animateOnce && animateState.current === true) return\n\t\t\t\t\tif (animateState.current === appears) return\n\n\t\t\t\t\tanimateState.current = appears\n\n\t\t\t\t\tReact.startTransition(() => {\n\t\t\t\t\t\tsetVariant(appears ? visibleVariantId : obscuredVariantId)\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tenabled: variantAppearEffectEnabled,\n\t\t\t\t\tanimateOnce,\n\t\t\t\t\tthreshold: {\n\t\t\t\t\t\ty: threshold,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t)\n\n\t\t\t// Track the current route so the scroll effect re-runs on navigation.\n\t\t\t// Without this, the scroll handler's closure state (playedState,\n\t\t\t// currentVariant) persists across route changes, preventing the\n\t\t\t// variant from resetting. This matches useStyleAppearEffect.\n\t\t\tconst currentRouteKey = useCurrentRouteKey()\n\t\t\tconst prevRouteKey = React.useRef(currentRouteKey)\n\n\t\t\t// When `targets` are provided, we run the effect based on the\n\t\t\t// scroll offsets of the target elements. We create a scroll handler\n\t\t\t// for each target. As soon as the progress is greater than 0 the\n\t\t\t// target has hit the threshold that should trigger the animation.\n\t\t\t// biome-ignore lint/correctness/useExhaustiveDependencies: We want to re-run it when `props.variant` changes\n\t\t\tReact.useEffect(() => {\n\t\t\t\tif (scrollDirection) return\n\t\t\t\tif (!targets) return\n\n\t\t\t\t// Reset variant state when the route changes (not on initial\n\t\t\t\t// mount or other dependency changes). The scroll handler below\n\t\t\t\t// cannot do this because at index -1 (above the first target)\n\t\t\t\t// the computed variant is `undefined` which matches the fresh\n\t\t\t\t// `currentVariant`, so setVariant is never called.\n\t\t\t\tif (prevRouteKey.current !== currentRouteKey) {\n\t\t\t\t\tprevRouteKey.current = currentRouteKey\n\t\t\t\t\tReact.startTransition(() => setVariant(obscuredVariantId))\n\t\t\t\t}\n\n\t\t\t\t// Track if we have animated to a variant. This allows us to avoid\n\t\t\t\t// running that animation more than once if the \"animateOnce\" is true.\n\t\t\t\t// We use an index instead of the variant because the variant could be\n\t\t\t\t// reused multiple times by different targets.\n\t\t\t\tconst playedState: Record<number, boolean> = {}\n\t\t\t\tlet currentVariant: TargetAndTransition | VariantLabels | undefined = undefined\n\t\t\t\treturn scroll((_, { y: scrollY }) => {\n\t\t\t\t\t/**\n\t\t\t\t\t * It can be that this function fires after scroll target refs have been\n\t\t\t\t\t * dehydrated. Check the first target to see if it is still hydrated and\n\t\t\t\t\t * bail if not.\n\t\t\t\t\t */\n\t\t\t\t\tif (!targets[0] || (targets[0].ref && !targets[0].ref.current)) return\n\n\t\t\t\t\tconst { inputRange, outputRange } = createInputOutputRanges(\n\t\t\t\t\t\ttargets,\n\t\t\t\t\t\t(threshold ?? 0) * scrollY.containerLength,\n\t\t\t\t\t\texitTarget,\n\t\t\t\t\t)\n\n\t\t\t\t\t// The input range can be empty if a ref is missing or\n\t\t\t\t\t// unset. Transform ranges must have the same number of\n\t\t\t\t\t// entries. If target refs are missing these ranges may not\n\t\t\t\t\t// match.\n\t\t\t\t\tif (inputRange.length === 0 || inputRange.length !== outputRange.length) return\n\n\t\t\t\t\tconst index = Math.floor(transform(scrollY.current, inputRange, outputRange))\n\t\t\t\t\tif (animateOnce && playedState[index]) return\n\t\t\t\t\tplayedState[index] = true\n\n\t\t\t\t\tconst variant = targets[index]?.target ?? undefined\n\t\t\t\t\tif (variant === currentVariant) return\n\t\t\t\t\tcurrentVariant = variant\n\n\t\t\t\t\tReact.startTransition(() => {\n\t\t\t\t\t\tsetVariant(variant)\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t}, [currentRouteKey, animateOnce, threshold, targets, props.variant, scrollDirection, exitTarget])\n\n\t\t\tuseScrollDirectionChange(scrollDirection, variant => React.startTransition(() => setVariant(variant)), {\n\t\t\t\tenabled: variantAppearEffectEnabled,\n\t\t\t\trepeat: !animateOnce,\n\t\t\t})\n\n\t\t\tuseOnRouteChange(() => {\n\t\t\t\tif (!variantAppearEffectEnabled) return\n\t\t\t\tconst useObscuredVariant = !options.targets && !options.scrollDirection\n\t\t\t\tconst target = useObscuredVariant ? options.obscuredVariantId : undefined\n\n\t\t\t\tReact.startTransition(() => setVariant(target))\n\t\t\t})\n\n\t\t\t// variantAppearEffectEnabled is a new property. Since code is\n\t\t\t// generated without this boolean, and `undefined` should be treated\n\t\t\t// as `false`, we must check if the key exists in the props, and if\n\t\t\t// it doesn't, consider the effect enabled.\n\t\t\tif (!(\"variantAppearEffectEnabled\" in options) || variantAppearEffectEnabled === true) {\n\t\t\t\treturn <Component {...rest} variant={activeVariant ?? props.variant} ref={observerRef} />\n\t\t\t} else {\n\t\t\t\treturn <Component {...rest} />\n\t\t\t}\n\t\t},\n\t)\n", "import type { MotionProps } from \"framer-motion\"\nimport React from \"react\"\nimport { useObserverRef } from \"../components/utils/refHelper.ts\"\nimport type { PresenceEffectOptions } from \"./usePresenceAnimation.ts\"\nimport { usePresenceAnimation } from \"./usePresenceAnimation.ts\"\n\ntype Props<T> = Omit<T, \"animate\" | \"initial\" | \"exit\"> & Pick<PresenceEffectOptions, \"animate\" | \"exit\" | \"initial\">\n\n/**\n * Allow motion elements inside of a Smart Component, which uses `animate`\n * inheritance to update visual variants, to perform presence animations without\n * breaking inheritance of the active variant for descendants.\n *\n * @deprecated - This component was used before we generally supported effects\n * in smart components, when we supported appear effects for relative overlays.\n * It is now no longer code-generated, and replaced with withFX. This does not\n * mean we can remove this code. Code generated by Framer may still import it.\n */\nexport const withVariantFX = <T extends MotionProps>(Component: React.ComponentType<T>) =>\n\tReact.forwardRef(\n\t\t({ initial, animate, exit, ...props }: Props<T>, forwardedRef: React.MutableRefObject<HTMLElement | null>) => {\n\t\t\tconst observerRef = useObserverRef(forwardedRef)\n\n\t\t\tconst effect = usePresenceAnimation(\n\t\t\t\t{\n\t\t\t\t\tinitial,\n\t\t\t\t\tanimate,\n\t\t\t\t\texit,\n\t\t\t\t},\n\t\t\t\tobserverRef,\n\t\t\t\ttrue,\n\t\t\t)\n\n\t\t\treturn <Component {...(props as T)} style={{ ...props?.style, ...effect.values }} ref={observerRef} />\n\t\t},\n\t)\n", "import React from \"react\"\n\n/** @public */\nexport const WindowContext = /* @__PURE__ */ React.createContext<(Window & typeof globalThis) | undefined | null>(\n\tundefined,\n)\n\n/** @public */\nexport const useProvidedWindow = () => React.useContext(WindowContext)\n", "import type React from \"react\"\n\n/**\n * Takes a CSS properties map of custom property to value and inserts them into the DOM.\n * @internal\n *\n */\nexport function CustomProperties({\n\tchildren,\n\tcustomProperties,\n}: {\n\tchildren?: React.ReactNode\n\tcustomProperties: { [property: string]: string }\n}) {\n\treturn <div style={customProperties}>{children}</div>\n}\n", "import type { MotionProps } from \"framer-motion\"\nimport { motion } from \"framer-motion\"\nimport type { Ref } from \"react\"\nimport type React from \"react\"\nimport { forwardRef, startTransition, useCallback } from \"react\"\nimport { cx } from \"../../../modules/cx.ts\"\nimport { withCSS } from \"../../../modules/withCSS.tsx\"\nimport { encodeSVGForCSS } from \"../../../utils/utils.ts\"\nimport type { LayerProps } from \"../Layer.tsx\"\nimport {\n\tFormInputStyleVariableNames as Var,\n\tcss,\n\temptyValueClassName,\n\tforcedFocusClassName,\n\ticonImageCSS,\n\ticonSize,\n\ticonSpacing,\n\tinputBorderAllSides,\n\tinputBorderCSS,\n\tinputClassName,\n\tinputIconCSSDeclaration,\n\tinputWrapperCSS,\n\tinputWrapperClassName,\n\trightIconSpacing,\n\tsharedInputCSS,\n\tuseCustomValidity,\n} from \"./shared.ts\"\nimport type { MotionInputProps } from \"./types.ts\"\nimport { useOptimisticValue } from \"./useOptimisticValue.ts\"\nimport { useReplayPreHydrationInput } from \"./useReplayPreHydrationInput.ts\"\n\nexport interface FormPlainTextInputProps extends MotionInputProps, Omit<LayerProps, \"children\">, MotionProps {\n\tisDisabled?: boolean\n\tinputName?: string\n\tvisible?: boolean\n\tdefaultValue?: string\n\tvalue?: string\n\tautofillEnabled?: boolean\n\tonChange?: (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void\n\tonValid?: () => void\n\tonClear?: () => void\n}\n\n// When the autofill property is disabled, these data props will be applied to the input.\n// This is to prevent the browser based & external password managers from\n// autofilling the input.\n// The list below is by no means exhaustive, but should cover most of the\n// major password managers such as LastPass, Dashlane, and 1Password.\nconst passwordManagerIgnoreDataProps = {\n\t// 1Password\n\t\"data-1p-ignore\": true,\n\t// LastPass\n\t\"data-lpignore\": true,\n\t// Dashlane\n\t// https://support.dashlane.com/hc/en-us/articles/4420122792594-Optimize-your-web-forms-for-Dashlane-Autofill\n\t\"data-form-type\": \"other\",\n\t// autocomplete=\"off\" is a generic property that disables autofilling. It\n\t// is not always respected by some browsers or password managers.\n\tautocomplete: \"off\",\n}\n\n/** @internal */\nexport enum TextAreaStyleVariableNames {\n\tResize = \"--framer-textarea-resize\",\n}\n\n/** @internal */\nconst PlainTextInput = /* @__PURE__ */ forwardRef(function FormPlainTextInput(\n\tprops: FormPlainTextInputProps,\n\tref: Ref<HTMLDivElement>,\n) {\n\tconst {\n\t\tautoFocus,\n\t\tclassName,\n\t\tinputName,\n\t\tmax,\n\t\tmin,\n\t\tplaceholder,\n\t\trequired,\n\t\tstep,\n\t\tstyle,\n\t\ttype,\n\t\tmaxLength,\n\t\tvalue,\n\t\t// We allow a defaultValue instead of a value so that the input remains\n\t\t// uncontrolled by React. This is important because we want the user\n\t\t// to be able to provide an initial value in the property panel, and for\n\t\t// the value to be editable by the user in the preview.\n\t\tdefaultValue,\n\t\tautofillEnabled,\n\t\tonChange,\n\t\tonBlur,\n\t\tonInvalid,\n\t\tonFocus,\n\t\tonValid,\n\t\tonClear,\n\t\t...rest\n\t} = props\n\n\tconst externalValue = value ?? defaultValue\n\tconst normalizedExternalValue = normalizeValueForInputType(externalValue, type)\n\tconst [optimisticValue, setOptimisticValue, handleChange] = useOptimisticValue(\n\t\tnormalizedExternalValue ?? \"\",\n\t\ttrue,\n\t\tonChange,\n\t)\n\n\tconst setInputRef = useReplayPreHydrationInput<HTMLInputElement | HTMLTextAreaElement, string>(\n\t\tnormalizedExternalValue,\n\t)\n\n\tconst handleClear = useCallback(() => {\n\t\t// Intentionally a non-transition setState\n\t\t// eslint-disable-next-line framer-studio/no-setstate-without-transition\n\t\tsetOptimisticValue(\"\")\n\n\t\tif (onClear) {\n\t\t\tstartTransition(() => onClear())\n\t\t}\n\t}, [onClear, setOptimisticValue])\n\n\tconst eventHandlers = useCustomValidity(onValid, onInvalid, handleChange, onBlur, onFocus)\n\n\t// visual area of the input is bigger than the real input area due to paddings,\n\t// so clicking on the wrapper padding should focus the input.\n\t// We don't use a label here as this component often wrapped in one already.\n\tconst handleWrapperClick = useCallback(\n\t\t(e: React.MouseEvent<HTMLDivElement>) => {\n\t\t\tif (e.target === e.currentTarget) {\n\t\t\t\tsetInputRef.current?.focus()\n\t\t\t}\n\t\t},\n\t\t[setInputRef],\n\t)\n\n\tif (type === \"hidden\") {\n\t\treturn <motion.input type=\"hidden\" name={inputName} defaultValue={defaultValue} />\n\t}\n\n\tconst dataProps = autofillEnabled === false ? passwordManagerIgnoreDataProps : undefined\n\tconst hasValue = !!optimisticValue\n\tconst showClear = !!onClear && hasValue\n\n\tconst wrapperClassName = cx(\n\t\ttextInputWrapperClassName,\n\t\tinputWrapperClassName,\n\t\tclassName,\n\t\ttype === \"text\" && textInputTypeWrapperClassName,\n\t\ttype === \"textarea\" && textareaInputTypeWrapperClassName,\n\t)\n\n\treturn (\n\t\t<motion.div ref={ref} onClick={handleWrapperClick} style={style} className={wrapperClassName} {...rest}>\n\t\t\t{type === \"textarea\" ? (\n\t\t\t\t<motion.textarea\n\t\t\t\t\tref={setInputRef as Ref<HTMLTextAreaElement>}\n\t\t\t\t\t{...dataProps}\n\t\t\t\t\t{...eventHandlers}\n\t\t\t\t\trequired={required}\n\t\t\t\t\tautoFocus={autoFocus}\n\t\t\t\t\tname={inputName}\n\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\tclassName={inputClassName}\n\t\t\t\t\tvalue={optimisticValue}\n\t\t\t\t\tmaxLength={maxLength}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<motion.input\n\t\t\t\t\tref={setInputRef as Ref<HTMLInputElement>}\n\t\t\t\t\t{...dataProps}\n\t\t\t\t\t{...eventHandlers}\n\t\t\t\t\ttype={type}\n\t\t\t\t\trequired={required}\n\t\t\t\t\tautoFocus={autoFocus}\n\t\t\t\t\tname={inputName}\n\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\tclassName={cx(inputClassName, !hasValue && emptyValueClassName)}\n\t\t\t\t\tvalue={optimisticValue}\n\t\t\t\t\tmin={min}\n\t\t\t\t\tmax={max}\n\t\t\t\t\tstep={step}\n\t\t\t\t\tmaxLength={maxLength}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{showClear && (\n\t\t\t\t<button type=\"button\" className={clearButtonClassName} onClick={handleClear} aria-label=\"Clear\">\n\t\t\t\t\t<ClearIcon />\n\t\t\t\t</button>\n\t\t\t)}\n\t\t</motion.div>\n\t)\n})\n\nfunction normalizeValueForInputType(value: string | undefined, type: string | undefined): string | undefined {\n\tif (!value || type !== \"date\") return value\n\tif (value.includes(\"T\")) return value.split(\"T\")[0]\n\treturn value\n}\n\nfunction ClearIcon() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"8\" height=\"8\" viewBox=\"0 0 8 8\" aria-hidden=\"true\">\n\t\t\t<path d=\"m1.5 6.5 5-5M6.5 6.5l-5-5\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" />\n\t\t</svg>\n\t)\n}\n\nconst textInputWrapperClassName = \"framer-form-text-input\"\nconst textInputTypeWrapperClassName = \"framer-form-text-input-type\"\nconst textareaInputTypeWrapperClassName = \"framer-form-textarea-input-type\"\nconst clearButtonClassName = \"framer-form-text-input-clear\"\n\nconst defaultTextareaResizerIcon = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\"><path d=\"m1.5 8 7-7M9 5.5l-3 3\" stroke=\"%23999\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path></svg>`\n// `transform` css property doesn't seem to work in `::-webkit-resizer`, so flipping the SVG asset manually\nconst defaultTextareaResizerIconFlipped = `<svg xmlns=\"http://www.w3.org/2000/svg\" transform=\"scale(-1, 1)\" width=\"14\" height=\"14\"><path d=\"m1.5 8 7-7M9 5.5l-3 3\" stroke=\"%23999\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path></svg>`\n\nconst defaultDateIconMaskImage =\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\"><path fill=\"rgb(153, 153, 153)\" d=\"M3 5a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2H3Z\" opacity=\".3\"/><path fill=\"transparent\" stroke=\"rgb(153, 153, 153)\" stroke-width=\"1.5\" d=\"M3.25 5.25a2 2 0 0 1 2-2h5.5a2 2 0 0 1 2 2v5.5a2 2 0 0 1-2 2h-5.5a2 2 0 0 1-2-2ZM3 6.75h9.5\"/></svg>'\nconst defaultTimeIconMaskImage =\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\"><path fill=\"transparent\" stroke=\"rgb(153, 153, 153)\" stroke-width=\"1.5\" d=\"M2.5 8a5.5 5.5 0 1 1 11 0 5.5 5.5 0 1 1-11 0Z\"/><path fill=\"transparent\" stroke=\"rgb(153, 153, 153)\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" d=\"M7.75 8.25v-3m0 3h2\"/></svg>'\n\nconst styles = /* @__PURE__ */ (() => [\n\t...sharedInputCSS,\n\t...inputBorderCSS,\n\t...inputWrapperCSS,\n\tcss(`.${inputWrapperClassName}`, {\n\t\tboxShadow: css.variable(Var.BoxShadow),\n\t\tborderTopLeftRadius: css.variable(Var.BorderRadiusTopLeft),\n\t\tborderTopRightRadius: css.variable(Var.BorderRadiusTopRight),\n\t\tborderBottomRightRadius: css.variable(Var.BorderRadiusBottomRight),\n\t\tborderBottomLeftRadius: css.variable(Var.BorderRadiusBottomLeft),\n\t\tcornerShape: css.variable(Var.CornerShape),\n\t\tbackground: css.variable(Var.Background),\n\t\ttransition: css.variable(Var.FocusedTransition),\n\t\ttransitionProperty: \"background, box-shadow\",\n\t}),\n\tcss(`.${textInputWrapperClassName} .${inputClassName}::placeholder`, {\n\t\tcolor: css.variable(Var.PlaceholderColor),\n\t}),\n\tcss(`.${textInputWrapperClassName}`, {\n\t\tdisplay: \"flex\",\n\t\talignItems: \"center\",\n\t\tpadding: css.variable(Var.Padding),\n\t}),\n\tcss(`.${textInputWrapperClassName} .${inputClassName}`, {\n\t\tflex: 1,\n\t\tminWidth: 0,\n\t\twidth: \"auto\",\n\t\tpadding: 0,\n\t}),\n\n\t// Textarea can't have an icon - so paddings don't need to be on wrapper.\n\t// Plus we have to deal with native resizer handle in webkit\n\tcss(`.${textInputWrapperClassName}.${textareaInputTypeWrapperClassName}`, {\n\t\tpadding: 0,\n\t}),\n\tcss(`.${textInputWrapperClassName}.${textareaInputTypeWrapperClassName} textarea.${inputClassName}`, {\n\t\twidth: \"100%\",\n\t\tpadding: css.variable(Var.Padding),\n\t}),\n\n\tcss(\n\t\t`.${textInputWrapperClassName} .${inputClassName}[type=\"date\"], .${textInputWrapperClassName} .${inputClassName}[type=\"time\"]`,\n\t\t{\n\t\t\t\"-webkit-appearance\": \"none\",\n\t\t\tappearance: \"none\",\n\t\t},\n\t),\n\t// iOS only fix for centered date & time inputs: https://github.com/tailwindlabs/tailwindcss-forms/pull/144\n\tcss(`.${textInputWrapperClassName} .${inputClassName}::-webkit-date-and-time-value`, {\n\t\ttextAlign: \"start\",\n\t}),\n\tcss(`.${textInputWrapperClassName} textarea`, {\n\t\tdisplay: \"flex\",\n\t\tresize: css.variable(TextAreaStyleVariableNames.Resize),\n\t\toverflowY: \"auto\",\n\t\tminHeight: \"inherit\",\n\t\tmaxHeight: \"inherit\",\n\t\twhiteSpace: \"break-spaces\",\n\t}),\n\t// This targets the resize handle in WebKit browsers. Unfortunately, it is not\n\t// possible in CSS to target the resize handle in Firefox, so FF will always\n\t// show the native resize handle.\n\tcss(`.${textInputWrapperClassName} textarea::-webkit-resizer`, {\n\t\tbackground: `no-repeat ${encodeSVGForCSS(defaultTextareaResizerIcon)}`,\n\t}),\n\tcss(`.${textInputWrapperClassName}:dir(rtl) textarea::-webkit-resizer`, {\n\t\tbackground: `no-repeat ${encodeSVGForCSS(defaultTextareaResizerIconFlipped)}`,\n\t}),\n\tcss(`.${textInputWrapperClassName} textarea::-webkit-scrollbar`, {\n\t\tcursor: \"pointer\",\n\t\tbackground: \"transparent\",\n\t}),\n\tcss(`.${textInputWrapperClassName} textarea::-webkit-scrollbar-thumb:window-inactive`, {\n\t\topacity: 0,\n\t}),\n\tcss(`.${textInputWrapperClassName} textarea::-webkit-scrollbar-corner`, {\n\t\tbackground: \"none\",\n\t\tbackgroundColor: \"transparent\",\n\t\toutline: \"none\",\n\t}),\n\tcss(`.${textInputWrapperClassName} .${inputClassName}::-webkit-datetime-edit`, {\n\t\t// Prevent browsers from improvising the date/time placeholder height.\n\t\theight: css.variable(Var.FontLineHeight),\n\t}),\n\tcss(`.${textInputWrapperClassName} .${inputClassName}.${emptyValueClassName}::-webkit-datetime-edit`, {\n\t\tcolor: css.variable(Var.PlaceholderColor),\n\t\t// This tells safari to use the color for the shadow dom elements.\n\t\t\"-webkit-text-fill-color\": css.variable(Var.PlaceholderColor),\n\t\toverflow: \"visible\",\n\t}),\n\n\tcss(`.${textInputWrapperClassName}.${textInputTypeWrapperClassName}::before`, {\n\t\tcontent: css.variable(Var.IconContent, \"none\"),\n\t\tdisplay: \"block\",\n\t\tflexShrink: 0,\n\t\twidth: `${iconSize}px`,\n\t\theight: `${iconSize}px`,\n\t\tmarginRight: `${iconSpacing}px`,\n\t\t...iconImageCSS,\n\t\tbackgroundPosition: \"center\",\n\t\tmaskPosition: \"center\",\n\t\tmaskImage: css.variable(Var.IconMaskImage),\n\t\tbackgroundImage: css.variable(Var.IconBackgroundImage),\n\t}),\n\n\t// Date/time input right-positioned input icon\n\tcss(\n\t\t`.${textInputWrapperClassName} .${inputClassName}[type=\"date\"]::before, .${textInputWrapperClassName} .${inputClassName}[type=\"time\"]::before`,\n\t\t{\n\t\t\t...inputIconCSSDeclaration,\n\t\t\tpaddingLeft: `${rightIconSpacing}px`,\n\t\t\tmaskPosition: `${rightIconSpacing}px center`,\n\t\t\tbackgroundPosition: `${rightIconSpacing}px center`,\n\t\t},\n\t),\n\tcss(`.${textInputWrapperClassName} .${inputClassName}[type=\"date\"]::before`, {\n\t\tmaskImage: css.variable(Var.IconMaskImage, encodeSVGForCSS(defaultDateIconMaskImage)),\n\t\tbackgroundImage: css.variable(Var.IconBackgroundImage),\n\t}),\n\tcss(`.${textInputWrapperClassName} .${inputClassName}[type=\"time\"]::before`, {\n\t\tmaskImage: css.variable(Var.IconMaskImage, encodeSVGForCSS(defaultTimeIconMaskImage)),\n\t\tbackgroundImage: css.variable(Var.IconBackgroundImage),\n\t}),\n\t// Hide the native date picker icon, but still align it with the custom icon, allowing user to click it to show the\n\t// date/time picker.\n\tcss(`.${textInputWrapperClassName} .${inputClassName}::-webkit-calendar-picker-indicator`, {\n\t\topacity: 0,\n\t\tposition: \"absolute\",\n\t\tright: 0,\n\t\ttop: 0,\n\t\tbottom: 0,\n\t\tpadding: css.variable(Var.Padding),\n\t\tpaddingTop: 0,\n\t\tpaddingBottom: 0,\n\t\twidth: `${iconSize}px`,\n\t\t// Makes sure the icon hit target covers the entire height of the input.\n\t\theight: \"100%\",\n\t}),\n\tcss(`.${textInputWrapperClassName}:focus-within, .${textInputWrapperClassName}.${forcedFocusClassName}`, {\n\t\tboxShadow: css.variable(Var.FocusedBoxShadow, Var.BoxShadow),\n\t\tbackground: css.variable(Var.FocusedBackground, Var.Background),\n\t}),\n\tcss(\n\t\t`.${textInputWrapperClassName}:focus-within::after, .${textInputWrapperClassName}.${forcedFocusClassName}::after`,\n\t\t{\n\t\t\tborderColor: css.variable(Var.FocusedBorderColor, Var.BorderColor),\n\t\t\tborderStyle: css.variable(Var.FocusedBorderStyle, Var.BorderStyle),\n\t\t\tborderWidth: css.variable(Var.FocusedBorderWidth, inputBorderAllSides),\n\t\t},\n\t),\n\tcss(`.${clearButtonClassName}`, {\n\t\tdisplay: \"flex\",\n\t\torder: 2,\n\t\talignItems: \"center\",\n\t\tjustifyContent: \"center\",\n\t\tflexShrink: 0,\n\t\twidth: `${iconSize}px`,\n\t\theight: `${iconSize}px`,\n\t\tmarginLeft: `${iconSpacing}px`,\n\t\tpadding: 0,\n\t\tborder: \"none\",\n\t\tbackground: \"transparent\",\n\t\tcursor: \"pointer\",\n\t\tcolor: css.variable(Var.PlaceholderColor),\n\t\ttransition: \"color 0.15s ease\",\n\t\toutline: \"none\",\n\t}),\n\tcss(`.${clearButtonClassName}:hover, .${clearButtonClassName}:focus-visible`, {\n\t\tcolor: css.variable(Var.FontColor),\n\t}),\n])()\n\nexport const FormPlainTextInput = /* @__PURE__ */ withCSS(PlainTextInput, styles, \"framer-lib-form-plain-text-input\")\n", "import React from \"react\"\nimport { shouldIgnoreReplayEvent } from \"./useReplayPreHydrationInput.ts\"\n\ntype FormChangeEvent = React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>\n\ntype UseOptimisticValueResult<T, E extends FormChangeEvent> = readonly [\n\tvalue: T,\n\tsetter: React.Dispatch<React.SetStateAction<T>>,\n\thandleChange: (event: E) => void,\n]\n\nconst defaultGetValueFromEvent = <T, E extends FormChangeEvent>(event: E): T => {\n\treturn (event.target as HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement).value as T\n}\n\nexport function useOptimisticValue<T, E extends FormChangeEvent = FormChangeEvent>(\n\texternalValue: T,\n\tshouldSyncExternalValue: boolean,\n\tonChange?: (event: E) => void,\n\tgetValueFromEvent: (event: E) => T = defaultGetValueFromEvent,\n): UseOptimisticValueResult<T, E> {\n\tconst [optimisticValue, setOptimisticValue] = React.useState(externalValue)\n\tconst [previousExternalValue, setPreviousExternalValue] = React.useState(externalValue)\n\n\tif (shouldSyncExternalValue && externalValue !== previousExternalValue) {\n\t\tsetPreviousExternalValue(externalValue)\n\t\tsetOptimisticValue(externalValue)\n\t}\n\n\tconst handleChange = React.useCallback(\n\t\t(event: E) => {\n\t\t\tif (shouldIgnoreReplayEvent(event)) return\n\n\t\t\tif (shouldSyncExternalValue) {\n\t\t\t\t// Intentionally a non-transition setState for immediate input UI response.\n\t\t\t\t// eslint-disable-next-line framer-studio/no-setstate-without-transition\n\t\t\t\tsetOptimisticValue(getValueFromEvent(event))\n\t\t\t}\n\n\t\t\tif (onChange) {\n\t\t\t\tReact.startTransition(() => {\n\t\t\t\t\tonChange(event)\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\t\t[getValueFromEvent, onChange, shouldSyncExternalValue],\n\t)\n\n\treturn [optimisticValue, setOptimisticValue, handleChange] as const\n}\n", "import type { MotionProps } from \"framer-motion\"\nimport { motion } from \"framer-motion\"\nimport React from \"react\"\nimport { setRef } from \"../../../components/utils/refHelper.ts\"\nimport { useBooleanLatch } from \"../../../hooks/useBooleanLatch.ts\"\nimport { cx } from \"../../../modules/cx.ts\"\nimport { useIsOnFramerCanvas } from \"../../../modules/useIsOnFramerCanvas.ts\"\nimport { withCSS } from \"../../../modules/withCSS.tsx\"\nimport type { LayerProps } from \"../Layer.tsx\"\nimport {\n\tcss,\n\tforcedCheckedClassName,\n\tforcedFocusClassName,\n\tFormInputStyleVariableNames as Var,\n\tinputBorderAllSides,\n\tinputIconCSSDeclaration,\n\tuseCustomValidity,\n} from \"./shared.ts\"\nimport type { MotionInputProps } from \"./types.ts\"\nimport { useOptimisticValue } from \"./useOptimisticValue.ts\"\nimport { useReplayPreHydrationInput } from \"./useReplayPreHydrationInput.ts\"\n\nexport interface FormBooleanInputProps extends MotionInputProps, Omit<LayerProps, \"children\">, MotionProps {\n\tinputName?: string\n\ttype?: \"checkbox\" | \"radio\"\n\tchecked?: boolean\n\tonValid?: () => void\n}\n\nconst className = \"framer-form-boolean-input\"\n\nconst getCheckedFromEvent = (event: React.ChangeEvent<HTMLInputElement>) => event.target.checked\n\n/** @internal */\nconst BooleanInput = /* @__PURE__ */ React.forwardRef(function FormBooleanInput(\n\tprops: FormBooleanInputProps,\n\tref: React.Ref<HTMLInputElement>,\n) {\n\tconst {\n\t\tinputName,\n\t\ttype = \"checkbox\",\n\t\tdefaultChecked,\n\t\tchecked,\n\t\tonValid,\n\t\tonChange,\n\t\tonBlur,\n\t\tonFocus,\n\t\tonInvalid,\n\t\t...rest\n\t} = props\n\n\tconst isCanvas = useIsOnFramerCanvas()\n\tconst isControlled = useBooleanLatch(!isCanvas && checked !== undefined)\n\tconst externalChecked = checked ?? false\n\n\tconst [optimisticChecked, , handleChange] = useOptimisticValue(\n\t\texternalChecked,\n\t\tisControlled,\n\t\tonChange,\n\t\tgetCheckedFromEvent,\n\t)\n\tconst setReplayInputRef = useReplayPreHydrationInput<HTMLInputElement, boolean | undefined>(\n\t\tisControlled ? externalChecked : defaultChecked,\n\t)\n\n\tconst eventHandlers = useCustomValidity(onValid, onInvalid, handleChange, onBlur, onFocus)\n\tconst attributes = isCanvas\n\t\t? { checked: defaultChecked }\n\t\t: isControlled\n\t\t\t? { checked: optimisticChecked }\n\t\t\t: { defaultChecked }\n\n\tconst setInputRef = React.useCallback(\n\t\t(input: HTMLInputElement | null) => {\n\t\t\tsetRef(ref, input)\n\t\t\tsetRef(setReplayInputRef, input)\n\t\t},\n\t\t[ref, setReplayInputRef],\n\t)\n\n\treturn (\n\t\t<motion.input\n\t\t\t{...rest}\n\t\t\t{...attributes}\n\t\t\t{...eventHandlers}\n\t\t\treadOnly={isCanvas}\n\t\t\tref={setInputRef}\n\t\t\ttype={type}\n\t\t\tname={inputName}\n\t\t\tclassName={cx(className, props.className)}\n\t\t/>\n\t)\n})\n\nexport const defaultCheckedIcon =\n\t'data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\"><path d=\"M 4 8 L 6.5 10.5 L 11.5 5.5\" fill=\"transparent\" stroke-width=\"2\" stroke=\"rgb(255, 255, 255)\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path></svg>'\nconst borderRadius = /* @__PURE__ */ `var(${Var.BorderRadiusTopLeft}) var(${Var.BorderRadiusTopRight}) var(${Var.BorderRadiusBottomRight}) var(${Var.BorderRadiusBottomLeft})`\n\nconst styles = /* @__PURE__ */ (() => [\n\tcss(`.${className}`, {\n\t\t\"-webkit-appearance\": \"none\",\n\t\t// background-color: #fff; fixes a bug on iOS where the checkbox shows\n\t\t// through the appearance: none;\n\t\talignItems: \"center\",\n\t\tappearance: \"none\",\n\t\tbackgroundColor: \"#fff\",\n\t\tbackground: Var.Background,\n\t\tborderRadius: borderRadius,\n\t\tcornerShape: css.variable(Var.CornerShape),\n\t\tboxShadow: Var.BoxShadow,\n\t\tdisplay: \"flex\",\n\t\tjustifyContent: \"center\",\n\t\tmargin: 0,\n\t\toverflow: \"hidden\",\n\t\tposition: \"relative\",\n\t\ttransition: Var.BooleanCheckedTransition,\n\t\ttransitionProperty: \"box-shadow, background\",\n\t}),\n\t// The after element styles the border of the checkbox to conform to\n\t// framer's inset border model.\n\tcss(`.${className}::after`, {\n\t\tbackground: \"transparent\",\n\t\tborderColor: css.variable(Var.BorderColor, \"transparent\"),\n\t\tborderRadius: borderRadius,\n\t\tcornerShape: css.variable(Var.CornerShape),\n\t\tborderStyle: Var.BorderStyle,\n\t\tborderWidth: inputBorderAllSides,\n\t\tboxSizing: \"border-box\",\n\t\tcontent: \"\",\n\t\tdisplay: \"block\",\n\t\tinset: 0,\n\t\tposition: \"absolute\",\n\t\ttransition: Var.BooleanCheckedTransition,\n\t\ttransitionProperty: \"border-color, border-width, border-style\",\n\t}),\n\t// The before element is used to display the check mark icon. It is\n\t// faded in when the input is checked.\n\tcss(`.${className}::before`, {\n\t\t...inputIconCSSDeclaration,\n\t\tbackgroundPosition: \"center\",\n\t\tbackgroundSize: \"contain\",\n\t\tmaskPosition: \"center\",\n\t\tmaskSize: \"contain\",\n\t\theight: \"100%\",\n\t\topacity: 0,\n\t\ttransition: Var.BooleanCheckedTransition,\n\t\ttransitionProperty: \"opacity\",\n\t\twidth: \"100%\",\n\t}),\n\t// The BooleanInput component shows an svg check mark icon whenever an\n\t// image url isn't provided. That's not an intuitive system for radios\n\t// however, where we never want to show the default check mark.\n\tcss(`.${className}[type=\"checkbox\"]::before`, {\n\t\tbackgroundImage: css.variable(Var.IconBackgroundImage),\n\t\tmaskImage: css.variable(Var.IconMaskImage, `url('${defaultCheckedIcon}')`),\n\t}),\n\tcss(`.${className}[type=\"radio\"]::before`, {\n\t\tbackgroundImage: css.variable(Var.IconBackgroundImage),\n\t\tmaskImage: css.variable(Var.IconMaskImage),\n\t}),\n\tcss(`.${className}:checked, .${className}.${forcedCheckedClassName}`, {\n\t\t// When not set, the styles when checked shouldn't clear the default\n\t\t// styles.\n\t\tbackgroundColor: css.variable(Var.BooleanCheckedBackground, Var.Background),\n\t\tboxShadow: css.variable(Var.BooleanCheckedBoxShadow, Var.BoxShadow),\n\t}),\n\tcss(`.${className}:checked::before, .${className}.${forcedCheckedClassName}::before`, {\n\t\topacity: 1,\n\t}),\n\tcss(`.${className}:checked::after, .${className}.${forcedCheckedClassName}::after`, {\n\t\t// When not set, the styles when checked shouldn't clear the default\n\t\t// styles.\n\t\tborderColor: css.variable(Var.BooleanCheckedBorderColor, Var.BorderColor, \"transparent\"),\n\t\tborderStyle: css.variable(Var.BooleanCheckedBorderStyle, Var.BorderStyle, \"solid\"),\n\t\tborderWidth: css.variable(Var.BooleanCheckedBorderWidth, inputBorderAllSides),\n\t}),\n\tcss(`.${className}:focus, .${className}.${forcedFocusClassName}`, {\n\t\tbackgroundColor: css.variable(Var.FocusedBackground, Var.Background),\n\t\tboxShadow: css.variable(Var.FocusedBoxShadow, Var.BoxShadow),\n\t}),\n\tcss(`.${className}:focus-visible`, { outline: \"none\" }),\n\tcss(`.${className}:focus::after, .${className}.${forcedFocusClassName}::after`, {\n\t\t// When not set, the styles when focused shouldn't clear the checked\n\t\t// styles.\n\t\tborderColor: css.variable(Var.FocusedBorderColor, Var.BorderColor, \"transparent\"),\n\t\tborderStyle: css.variable(Var.FocusedBorderStyle, Var.BorderStyle, \"solid\"),\n\t\tborderWidth: css.variable(Var.FocusedBorderWidth, inputBorderAllSides),\n\t}),\n\tcss(`.${className}:focus:checked`, {\n\t\tbackgroundColor: css.variable(Var.FocusedBackground, Var.BooleanCheckedBackground, Var.Background),\n\t\tboxShadow: css.variable(Var.FocusedBoxShadow, Var.BooleanCheckedBoxShadow, Var.BoxShadow),\n\t}),\n\tcss(`.${className}:focus:checked::after`, {\n\t\tborderStyle: css.variable(Var.FocusedBorderStyle, Var.BooleanCheckedBorderStyle, Var.BorderStyle, \"solid\"),\n\t\tborderWidth: css.variable(Var.FocusedBorderWidth, Var.BooleanCheckedBorderWidth, inputBorderAllSides),\n\t}),\n])()\n\nexport const FormBooleanInput = /* @__PURE__ */ withCSS(BooleanInput, styles, \"framer-lib-form-boolean-input\")\n", "import { useState } from \"react\"\n\n/**\n * Takes in a boolean value and optionally a latch target.\n * Once the value have become equal to the latch target,\n * it will remain latched to that value for the lifetime of the component\n *\n * @param value - The state that should be used to latch\n * @param latchTo - The value that the latch should stick to\n */\nexport function useBooleanLatch(value: boolean, latchTo: boolean = true) {\n\tconst [latchedValue, setLatchedValue] = useState(value)\n\n\tif (latchedValue !== latchTo && latchedValue !== value) {\n\t\tsetLatchedValue(value)\n\t}\n\n\treturn latchedValue\n}\n", "import type { HTMLMotionProps, MotionProps } from \"framer-motion\"\nimport { motion } from \"framer-motion\"\nimport React from \"react\"\nimport { cx } from \"../../../modules/cx.ts\"\nimport { useIsOnFramerCanvas } from \"../../../modules/useIsOnFramerCanvas.ts\"\nimport { withCSS } from \"../../../modules/withCSS.tsx\"\nimport { assertNever } from \"../../../utils/assert.ts\"\nimport { isNumber } from \"../../../utils/utils.ts\"\nimport type { LayerProps } from \"../Layer.tsx\"\nimport {\n\tFormInputStyleVariableNames as Var,\n\tcss,\n\tforcedFocusClassName,\n\tinputBorderAllSides,\n\tinputBorderCSS,\n\tinputClassName,\n\tinputIconCSSDeclaration,\n\tinputWrapperCSS,\n\tinputWrapperClassName,\n\trightIconSpacing,\n\tsharedInputCSS,\n\tuseCustomValidity,\n} from \"./shared.ts\"\nimport { useOptimisticValue } from \"./useOptimisticValue.ts\"\nimport { useReplayPreHydrationInput } from \"./useReplayPreHydrationInput.ts\"\ninterface FormSelectOptionBase {\n\ttype: \"option\"\n\tvalue: string | undefined\n\ttitle: string | undefined\n\t/* defaults to true */\n\tdisabled?: boolean\n}\n\ninterface FormSelectDivider {\n\ttype: \"divider\"\n\tvalue?: string\n\ttitle?: string\n\tdisabled?: boolean\n}\n\nexport type FormSelectOption = FormSelectOptionBase | FormSelectDivider\n\ntype PickedSelectProps = \"autoFocus\" | \"required\" | \"onInvalid\" | \"onChange\" | \"onBlur\" | \"onFocus\"\ntype WrapperProps = Omit<HTMLMotionProps<\"div\">, PickedSelectProps | \"defaultValue\">\ntype SelectDefaultProps = HTMLMotionProps<\"select\">\ntype SelectProps = Pick<SelectDefaultProps, PickedSelectProps> & {\n\t// We don't support `multiple`.\n\tdefaultValue?: Exclude<SelectDefaultProps[\"defaultValue\"], readonly string[]>\n}\n\nexport interface FormSelectProps extends WrapperProps, SelectProps, Omit<LayerProps, \"children\">, MotionProps {\n\tinputName?: string\n\tvalue?: string\n\tselectOptions?: FormSelectOption[]\n\tonValid?: () => void\n}\n\nconst Select = /* @__PURE__ */ React.forwardRef(function Select(\n\tprops: FormSelectProps,\n\tmeasureRef: React.Ref<HTMLDivElement>,\n) {\n\tconst {\n\t\tautoFocus,\n\t\tclassName,\n\t\tinputName,\n\t\trequired,\n\t\thidden,\n\t\tdefaultValue,\n\t\tvalue,\n\t\tselectOptions,\n\t\tstyle,\n\t\tonValid,\n\t\tonChange,\n\t\tonBlur,\n\t\tonInvalid,\n\t\tonFocus,\n\t\t...rest\n\t} = props\n\n\tconst isCanvas = useIsOnFramerCanvas()\n\tconst isControlled = !isCanvas && value !== undefined\n\tconst externalValue = value ?? \"\"\n\tconst [optimisticValue, , handleChange] = useOptimisticValue(externalValue, isControlled, onChange)\n\tconst setSelectRef = useReplayPreHydrationInput<HTMLSelectElement, string | number>(\n\t\tisControlled ? externalValue : defaultValue,\n\t)\n\n\tconst eventHandlers = useCustomValidity(onValid, onInvalid, handleChange, onBlur, onFocus)\n\n\tif (hidden) {\n\t\treturn <motion.input type=\"hidden\" name={inputName} defaultValue={defaultValue} />\n\t}\n\n\treturn (\n\t\t<motion.div\n\t\t\tref={measureRef}\n\t\t\tstyle={style}\n\t\t\tclassName={cx(inputWrapperClassName, selectWrapperClassName, className)}\n\t\t\t{...rest}\n\t\t>\n\t\t\t<motion.select\n\t\t\t\tref={setSelectRef}\n\t\t\t\t// Trick the select to update when the default value updates on the canvas.\n\t\t\t\tkey={isCanvas ? serializeDefaultValue(defaultValue) : undefined}\n\t\t\t\tname={inputName}\n\t\t\t\tautoFocus={autoFocus}\n\t\t\t\trequired={required}\n\t\t\t\tclassName={inputClassName}\n\t\t\t\tdefaultValue={defaultValue}\n\t\t\t\tvalue={isControlled ? optimisticValue : undefined}\n\t\t\t\t{...eventHandlers}\n\t\t\t>\n\t\t\t\t{selectOptions?.map((option, index) => {\n\t\t\t\t\tswitch (option.type) {\n\t\t\t\t\t\tcase \"divider\":\n\t\t\t\t\t\t\t// biome-ignore lint/suspicious/noArrayIndexKey: There might be multiple divider, so we could only use UUIDs here (but that isn't really better)\n\t\t\t\t\t\t\treturn <hr key={index} />\n\t\t\t\t\t\tcase \"option\":\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t// biome-ignore lint/suspicious/noArrayIndexKey: Values can be duplicated, so we could only use UUIDs here (but that isn't really better)\n\t\t\t\t\t\t\t\t<option key={index} value={option.value ?? option.title} disabled={option.disabled}>\n\t\t\t\t\t\t\t\t\t{option.title ?? option.value}\n\t\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn assertNever(option)\n\t\t\t\t\t}\n\t\t\t\t})}\n\t\t\t</motion.select>\n\t\t</motion.div>\n\t)\n})\n\nfunction serializeDefaultValue(defaultValue: string | number | undefined): string {\n\tif (defaultValue === undefined) return \"__undefined__\"\n\tif (isNumber(defaultValue)) return String(defaultValue)\n\tif (defaultValue === \"\") return \"__empty__\"\n\treturn defaultValue\n}\n\nconst selectWrapperClassName = \"framer-form-select-wrapper\"\nconst selectArrowSize = 16\nconst defaultSelectCaretMaskImage = /* @__PURE__ */ (() =>\n\t`data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${selectArrowSize}\" height=\"${selectArrowSize}\"><path d=\"M 3.5 6 L 8 10.5 L 12.5 6\" fill=\"transparent\" stroke-width=\"1.5\" stroke=\"rgb(153, 153, 153)\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path></svg>`)()\n\nconst styles = /* @__PURE__ */ (() => [\n\t...sharedInputCSS,\n\t...inputBorderCSS,\n\t...inputWrapperCSS,\n\tcss(`.${selectWrapperClassName}`, {\n\t\t// First we use the complete padding string, which may be any valid\n\t\t// padding string (10px, 10px 10px, 10px 10px 10px, or 10px 10px\n\t\t// 10px 10px), and use it to set only the right padding. This pushes\n\t\t// the actual select away from the arrow by 1x.\n\t\tpadding: css.variable(Var.Padding),\n\t\tpaddingTop: 0,\n\t\tpaddingBottom: 0,\n\t\tpaddingLeft: 0,\n\t\tbackground: css.variable(Var.Background),\n\t\tborderTopLeftRadius: css.variable(Var.BorderRadiusTopLeft),\n\t\tborderTopRightRadius: css.variable(Var.BorderRadiusTopRight),\n\t\tborderBottomRightRadius: css.variable(Var.BorderRadiusBottomRight),\n\t\tborderBottomLeftRadius: css.variable(Var.BorderRadiusBottomLeft),\n\t\tcornerShape: css.variable(Var.CornerShape),\n\t\tboxShadow: css.variable(Var.BoxShadow),\n\t\ttransition: css.variable(Var.FocusedTransition),\n\t\ttransitionProperty: \"background, box-shadow\",\n\t}),\n\tcss(`.${selectWrapperClassName} select`, {\n\t\tappearance: \"none\",\n\t\t\"-webkit-appearance\": \"none\",\n\t\t// Then we use the complete padding string again as the margin for\n\t\t// the select. This moves the select 2x the padding right away from\n\t\t// the arrow.\n\t\tpadding: css.variable(Var.Padding),\n\t\t// Overwrite the values inherited from .${inputClassName}. On a\n\t\t// select, these values are on the wrapper.\n\t\tbackground: \"transparent\",\n\t}),\n\tcss(`.${selectWrapperClassName}::before`, {\n\t\t...inputIconCSSDeclaration,\n\t\tpaddingLeft: `${rightIconSpacing}px`,\n\t\tbackgroundPosition: `${rightIconSpacing}px center`,\n\t\tmaskPosition: `${rightIconSpacing}px center`,\n\t\tbackgroundImage: css.variable(Var.IconBackgroundImage),\n\t\tmaskImage: css.variable(Var.IconMaskImage, `url('${defaultSelectCaretMaskImage}')`),\n\t}),\n\tcss(`.${selectWrapperClassName} select:required:invalid`, {\n\t\tcolor: css.variable(Var.InvalidTextColor),\n\t}),\n\tcss(`.${selectWrapperClassName}:focus-within, .${selectWrapperClassName}.${forcedFocusClassName}`, {\n\t\tbackground: css.variable(Var.FocusedBackground, Var.Background),\n\t\tboxShadow: css.variable(Var.FocusedBoxShadow, Var.BoxShadow),\n\t}),\n\tcss(`.${selectWrapperClassName}:focus-within::after, .${selectWrapperClassName}.${forcedFocusClassName}::after`, {\n\t\tborderColor: css.variable(Var.FocusedBorderColor, Var.BorderColor),\n\t\tborderStyle: css.variable(Var.FocusedBorderStyle, Var.BorderStyle),\n\t\tborderWidth: css.variable(Var.FocusedBorderWidth, inputBorderAllSides),\n\t}),\n\t// Enforcing a color on the native select options. On windows, browsers select options\n\t// inherit some style properties like color but not others so they might end up in a weird\n\t// state in which we can't read the options until we hover.\n\t// These are ignored on mac\n\tcss(`.${selectWrapperClassName} select option`, {\n\t\tcolor: \"#000\",\n\t}),\n\tcss(`.${selectWrapperClassName} select option:disabled`, {\n\t\tcolor: \"rgba(0, 0, 0, 0.4)\",\n\t}),\n])()\n\nexport const FormSelect = /* @__PURE__ */ withCSS(Select, styles, \"framer-lib-form-select\")\n", "import type { MotionStyle } from \"framer-motion\"\nimport React, { useMemo, useState } from \"react\"\nimport type { ImageAltProps } from \"../style/BackgroundImageComponent.tsx\"\nimport { BackgroundImageComponent } from \"../style/BackgroundImageComponent.tsx\"\nimport type { BackgroundImage, FitImageDimensionType } from \"../types/BackgroundImage.ts\"\nimport { getIntrinsicSizeForBackgroundImage } from \"../utils/getIntrinsicSizeForBackgroundImage.ts\"\nimport { htmlElementAsMotionComponent } from \"../utils/htmlElementAsMotionComponent.ts\"\nimport type { MotionDivProps } from \"./Frame/types.ts\"\nimport { withLightboxEffect } from \"./withLightbox.tsx\"\n\n/** @public */\ninterface BackgroundImageProps extends ImageAltProps {\n\tbackground: BackgroundImage\n\t/** @internal */\n\tfitImageDimension?: FitImageDimensionType\n}\n\n/** @public */\nexport interface ImageProps extends MotionDivProps, BackgroundImageProps {\n\tas?: keyof HTMLElementTagNameMap\n\tonClick?: React.HTMLAttributes<HTMLDivElement>[\"onClick\"]\n}\n\nconst Component = /* @__PURE__ */ React.forwardRef(function Image(\n\tprops: Partial<ImageProps>,\n\tref: React.Ref<HTMLDivElement>,\n) {\n\tconst { background, children, alt, draggable, fitImageDimension, style: styleFromProps, ...rest } = props\n\tconst style: MotionStyle = { ...styleFromProps }\n\tconst intrinsicSize = useMemo(() => getIntrinsicSizeForBackgroundImage(background), [background])\n\tconst [fallbackIntrinsicSize, setFallbackIntrinsicSize] = useState<{ width: number; height: number }>()\n\n\tReact.useLayoutEffect(() => {\n\t\tif (!background?.src) return\n\t\tif (!fitImageDimension) return\n\t\tif (intrinsicSize) return\n\n\t\tconst img = document.createElement(\"img\")\n\t\timg.onload = () => {\n\t\t\tif (img.naturalWidth && img.naturalHeight) {\n\t\t\t\tsetFallbackIntrinsicSize({ width: img.naturalWidth, height: img.naturalHeight })\n\t\t\t}\n\t\t}\n\t\timg.src = background.src\n\t}, [background?.src, fitImageDimension, intrinsicSize])\n\n\tconst size = intrinsicSize ?? fallbackIntrinsicSize\n\tif (fitImageDimension && size) {\n\t\tstyle[fitImageDimension] = \"auto\"\n\t\tstyle.aspectRatio = size.width / size.height\n\t}\n\n\tif (background) {\n\t\t// Remove existing `background` props from style, when we are rendering a background asset.\n\t\t// This ensures that the background prop can be properly reset when removing the background-image.\n\t\t// We prefer `delete` over `style.background = undefined` because `style.background = undefined`\n\t\t// might accidentally override other styles like `background-color` if the key is inserted after the other styles.\n\t\tdelete style.background\n\t}\n\n\tconst MotionComponent = htmlElementAsMotionComponent(props.as)\n\n\treturn (\n\t\t<MotionComponent {...rest} style={style} ref={ref} draggable={draggable}>\n\t\t\t{background && <BackgroundImageComponent image={background} alt={alt} draggable={draggable} />}\n\t\t\t{children as React.ReactNode /* Ignore that these can be MotionValues, that will not happen */}\n\t\t</MotionComponent>\n\t)\n})\n\n/** @public */\nexport const Image = /* @__PURE__ */ withLightboxEffect(Component)\n", "import type { TargetAndTransition, TransformProperties, Transition } from \"framer-motion\"\nimport { AnimatePresence, MotionConfigContext, frame, motion, visualElementStore } from \"framer-motion\"\nimport {\n\tFragment,\n\tforwardRef,\n\tstartTransition,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseId,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from \"react\"\nimport { createPortal } from \"react-dom\"\nimport { portalIdAttribute } from \"../../modules/CustomCursor.tsx\"\nimport { overlayContainerId, templateOverlayContainerId } from \"../../modules/Floating.tsx\"\nimport { useStableCallback } from \"../../utils/useStableCallback.ts\"\nimport { isNumber } from \"../../utils/utils.ts\"\nimport { BackgroundImageComponent } from \"../style/BackgroundImageComponent.tsx\"\nimport { getSrcSet } from \"../style/getSrcSet.ts\"\nimport type { BackgroundImage } from \"../types/BackgroundImage.ts\"\nimport type { Size } from \"../types/Size.ts\"\nimport type { ImageProps } from \"./Image.tsx\"\nimport { TickerContext } from \"./TickerContext.tsx\"\nimport { useEscToClose } from \"./useEscToClose.ts\"\n\nexport interface LightboxEffectProps {\n\ttransition: Transition\n\tzIndex: number\n\tmaxWidth: number\n\tbackdrop?: string\n\tpadding?: number\n\tpaddingTop?: number\n\tpaddingRight?: number\n\tpaddingBottom?: number\n\tpaddingLeft?: number\n}\n\nfunction calculateImageWidth(\n\taspectRatio: number,\n\tmaxWidth: number,\n\ttotalHorizontalPadding: number,\n\ttotalVerticalPadding: number,\n) {\n\tconst availableHeight = window.innerHeight - totalVerticalPadding\n\tconst availableWidth = Math.min(window.innerWidth - totalHorizontalPadding, maxWidth)\n\n\t// Calculate the maximum width that fits within both constraints:\n\t// 1. Width cannot exceed available width\n\t// 2. Width * aspectRatio cannot exceed available height\n\tconst maxWidthBasedOnHeight = availableHeight / aspectRatio\n\n\treturn Math.min(availableWidth, maxWidthBasedOnHeight)\n}\n\nfunction optimisticallyDecodeImage(\n\timage: BackgroundImageWithSrcSet,\n\t{ width, height }: Size,\n): Promise<void> | undefined {\n\tif (!image.src || !image.srcSet) return\n\n\tconst i = new window.Image()\n\ti.src = image.src\n\ti.srcset = image.srcSet\n\ti.sizes = image.sizes || \"\"\n\ti.width = width\n\ti.height = height\n\n\treturn i.decode()\n}\n\nfunction getPortalContainer() {\n\treturn (\n\t\tdocument.getElementById(templateOverlayContainerId) ?? document.getElementById(overlayContainerId) ?? document.body\n\t)\n}\n\nfunction getSidePadding(value: number | undefined, padding: number | undefined) {\n\tif (isNumber(value)) return value\n\treturn padding ?? 0\n}\n\nfunction getTotalVerticalPadding(lightbox: LightboxEffectProps | undefined) {\n\treturn (\n\t\tgetSidePadding(lightbox?.paddingTop, lightbox?.padding) + getSidePadding(lightbox?.paddingBottom, lightbox?.padding)\n\t)\n}\n\nfunction getTotalHorizontalPadding(lightbox: LightboxEffectProps | undefined) {\n\treturn (\n\t\tgetSidePadding(lightbox?.paddingLeft, lightbox?.padding) + getSidePadding(lightbox?.paddingRight, lightbox?.padding)\n\t)\n}\n\ninterface BackgroundImageWithSrcSet extends BackgroundImage {\n\tsrcSet?: string | undefined\n\tsizes?: string | undefined\n}\n\n/**\n * Create a new srcset for the image. Discard an existing srcset even if it exists, since we avoid\n * generating srcset entries that are smaller than the trigger. The lightbox however may scale down\n * past that since it is tied to the screen size.\n */\nfunction createImageWithSrcSet(\n\tlightbox: LightboxEffectProps | undefined,\n\tbackground: BackgroundImage | undefined,\n): BackgroundImageWithSrcSet | undefined {\n\tif (!lightbox || !background || !background.src) return background\n\n\tconst base = new URL(background.src)\n\n\tbase.searchParams.delete(\"scale-down-to\")\n\tbase.searchParams.delete(\"lossless\")\n\n\treturn {\n\t\t...background,\n\t\tsizes: `min(100vw, ${lightbox.maxWidth - getTotalHorizontalPadding(lightbox)}px)`,\n\t\tsrcSet: getSrcSet(background.nodeFixedSize, background, background.src).srcSet,\n\t}\n}\n\n// Undefined keys are not considered distortion transforms.\n// Motion stores transform values as numbers.\nconst distortionTransforms: Record<keyof TransformProperties, number | undefined> = (() => ({\n\tx: undefined,\n\ty: undefined,\n\tz: 0,\n\ttranslateX: undefined,\n\ttranslateY: undefined,\n\ttranslateZ: 0,\n\trotate: undefined,\n\trotateX: 0,\n\trotateY: 0,\n\trotateZ: undefined,\n\tscale: 1,\n\tscaleX: 1,\n\tscaleY: 1,\n\tscaleZ: 1,\n\tskew: 0,\n\tskewX: 0,\n\tskewY: 0,\n\toriginX: undefined,\n\toriginY: undefined,\n\toriginZ: undefined,\n\tperspective: 0,\n\ttransformPerspective: 0,\n}))()\n\nfunction isDistortionTransform(values: Record<string, number | string> | undefined) {\n\tif (!values) return false\n\n\t// TODO: We could be more permissive by only returning true for perspective if there are other\n\t// distortion transforms present.\n\tfor (const k in values) {\n\t\tif (!(k in distortionTransforms)) continue\n\t\tconst identityValue = distortionTransforms[k as keyof TransformProperties]\n\t\tconst value = values[k]\n\t\tif (!isNumber(identityValue) || !isNumber(value)) continue\n\t\tif (identityValue === value) continue\n\t\treturn true\n\t}\n\treturn false\n}\n\n/**\n * Check if an element is distorted by transforms, either by its own style, or by an ancestor.\n */\nfunction isDistorted(ref: React.RefObject<HTMLDivElement>) {\n\tconst element = visualElementStore.get(ref.current)\n\tif (!element) return false\n\n\tif (isDistortionTransform(element.projection?.latestValues)) return true\n\n\tconst path = element.projection?.path\n\tif (!path || path.length === 0) return false\n\n\tfor (const p of path) {\n\t\tif (isDistortionTransform(p.latestValues)) return true\n\t}\n\n\treturn false\n}\n\nconst enterExitBackdropAnimation: TargetAndTransition = { opacity: 0 }\nconst targetBackdropAnimation: TargetAndTransition = { opacity: 1 }\n\n/**\n * when browser view transitions support interruptions use that here...\n */\nexport function withLightboxEffect(Component: React.ComponentType<Partial<ImageProps>>) {\n\treturn forwardRef(function LightboxEffect(\n\t\t{\n\t\t\tlightbox,\n\t\t\tlightboxClassName,\n\t\t\tonClick,\n\t\t\t...props\n\t\t}: React.PropsWithChildren<\n\t\t\tPartial<ImageProps> & Partial<{ lightbox: LightboxEffectProps; lightboxClassName: string }>\n\t\t>,\n\t\tforwardedRef: React.RefObject<HTMLDivElement>,\n\t) {\n\t\tconst config = useContext(MotionConfigContext)\n\t\tconst ancestorTickerContext = useContext(TickerContext)\n\t\tconst isInTickerItem = Boolean(ancestorTickerContext)\n\t\tconst fallbackRef = useRef<HTMLDivElement>(null)\n\t\tconst ref = forwardedRef ?? fallbackRef\n\n\t\tconst decodePromiseRef = useRef<{ [src: string]: Promise<void> | undefined } | undefined>()\n\t\tconst image = useMemo(() => createImageWithSrcSet(lightbox, props.background), [lightbox, props.background])\n\n\t\tconst [open, setOpen] = useState<boolean>(false)\n\t\tconst [openOverrides, setOpenOverrides] = useState<\n\t\t\t| {\n\t\t\t\t\taspectRatio?: number\n\t\t\t\t\tborderRadius?: string\n\t\t\t\t\tborderTop?: string\n\t\t\t\t\tborderRight?: string\n\t\t\t\t\tborderBottom?: string\n\t\t\t\t\tborderLeft?: string\n\t\t\t\t\tborderStyle?: string\n\t\t\t\t\tborderColor?: string\n\t\t\t\t\ttransition?: Transition\n\t\t\t\t\timageRendering?: React.CSSProperties[\"imageRendering\"]\n\t\t\t\t\tfilter?: React.CSSProperties[\"filter\"]\n\t\t\t  }\n\t\t\t| undefined\n\t\t>()\n\n\t\tconst onOpen = useCallback(() => {\n\t\t\tif (!lightbox) return\n\n\t\t\tif (open) {\n\t\t\t\t// If the lightbox is already open, we don't need to do anything, we have\n\t\t\t\t// aborted the exit transition.\n\t\t\t\tstartTransition(() => {\n\t\t\t\t\tsetOpen(true)\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tframe.read(() => {\n\t\t\t\tif (!ref.current) return\n\n\t\t\t\tconst style = getComputedStyle(ref.current)\n\t\t\t\tconst hasBorder = ref.current.getAttribute(\"data-border\") === \"true\"\n\t\t\t\tconst borderStyle = hasBorder ? getComputedStyle(ref.current, \"::after\") : undefined\n\t\t\t\tconst width = ref.current.offsetWidth ?? 1\n\t\t\t\tconst height = ref.current.offsetHeight ?? 1\n\n\t\t\t\t// - Transitioning from a distorted image in one tree to a non-distorted image in\n\t\t\t\t// another tree is not supported by motion. It is however supported by layout\n\t\t\t\t// transitions.\n\t\t\t\t// - FIXME: We disable transitions in ticker items because it creates an offset flicker when the lightbox is\n\t\t\t\t// closed. If this is fixed, we can remove the isInTickerItem check.\n\t\t\t\tconst transition = isDistorted(ref) || isInTickerItem ? { duration: 0 } : lightbox.transition\n\n\t\t\t\tstartTransition(() => {\n\t\t\t\t\tsetOpenOverrides({\n\t\t\t\t\t\tborderRadius: style.borderRadius,\n\t\t\t\t\t\taspectRatio: width / (height || 1),\n\t\t\t\t\t\tborderTop: borderStyle?.borderTopWidth,\n\t\t\t\t\t\tborderRight: borderStyle?.borderRightWidth,\n\t\t\t\t\t\tborderBottom: borderStyle?.borderBottomWidth,\n\t\t\t\t\t\tborderLeft: borderStyle?.borderLeftWidth,\n\t\t\t\t\t\tborderStyle: borderStyle?.borderStyle,\n\t\t\t\t\t\tborderColor: borderStyle?.borderColor,\n\t\t\t\t\t\ttransition,\n\t\t\t\t\t\timageRendering: style.imageRendering as React.CSSProperties[\"imageRendering\"],\n\t\t\t\t\t\tfilter: style.filter,\n\t\t\t\t\t})\n\n\t\t\t\t\tsetOpen(true)\n\t\t\t\t\tancestorTickerContext?.stop()\n\t\t\t\t})\n\t\t\t})\n\t\t}, [lightbox, open, ref, ancestorTickerContext?.stop, isInTickerItem])\n\n\t\tconst aspectRatio = openOverrides?.aspectRatio ?? 1\n\n\t\t// Break the rules of setting refs to allow us to create a stable reference to a callback so we only\n\t\t// mount our effect once, and preserve the timer reference. Safe for this particular use case since\n\t\t// concurrent rendering setting different versions of the callback to the ref is not problematic for\n\t\t// the lightbox.\n\t\tconst decode = useStableCallback(() => {\n\t\t\tif (!lightbox || !image || !image.src) return\n\n\t\t\tconst srcDecodePromise = decodePromiseRef.current?.[image.src]\n\n\t\t\t// If we are already decoding, or have decoded, return the promise so as not to request\n\t\t\t// the image multiple times. This should speed up the initial load of the lightbox since\n\t\t\t// we should have started decoding on mouse enter, or pointer down.\n\t\t\tif (srcDecodePromise) return srcDecodePromise\n\n\t\t\t// Calculate the width the image will render at given the current screen size, this\n\t\t\t// allows us to decode the image at the correct size.\n\t\t\tconst width = calculateImageWidth(\n\t\t\t\taspectRatio,\n\t\t\t\tlightbox.maxWidth,\n\t\t\t\tgetTotalHorizontalPadding(lightbox),\n\t\t\t\tgetTotalVerticalPadding(lightbox),\n\t\t\t)\n\n\t\t\tconst promise = optimisticallyDecodeImage(image, { width, height: width * aspectRatio })\n\n\t\t\t// Track against the src so we always await a new promise when the image changes.\n\t\t\tdecodePromiseRef.current = { [image.src]: promise }\n\n\t\t\treturn promise\n\t\t})\n\n\t\tconst handleClick = useCallback(\n\t\t\tasync (e: React.MouseEvent<HTMLDivElement>) => {\n\t\t\t\tonClick?.(e)\n\n\t\t\t\tif (open || !lightbox || !image) return\n\n\t\t\t\t// Await decoding the image before opening the lightbox. This ensures that we never\n\t\t\t\t// have a transparent image during the layout transition.\n\t\t\t\tawait decode()\n\n\t\t\t\tonOpen()\n\t\t\t},\n\t\t\t[onClick, onOpen, open, image, lightbox, decode],\n\t\t)\n\n\t\tconst onClose = useCallback((e?: React.MouseEvent<HTMLDivElement>) => {\n\t\t\te?.stopPropagation()\n\t\t\tstartTransition(() => {\n\t\t\t\tsetOpen(false)\n\t\t\t})\n\t\t}, [])\n\n\t\tuseEscToClose(open, onClose)\n\n\t\tuseEffect(() => {\n\t\t\tif (!lightbox) return\n\n\t\t\tlet timer: number | undefined\n\n\t\t\tfunction enter() {\n\t\t\t\ttimer = setTimeout(() => {\n\t\t\t\t\tvoid decode()\n\t\t\t\t}, 50) as unknown as number\n\t\t\t}\n\n\t\t\tfunction clear() {\n\t\t\t\tclearTimeout(timer)\n\t\t\t}\n\n\t\t\tconst currentRef = ref.current\n\n\t\t\tcurrentRef?.addEventListener(\"mouseenter\", enter)\n\t\t\tcurrentRef?.addEventListener(\"mouseleave\", clear)\n\t\t\tcurrentRef?.addEventListener(\"pointerdown\", decode)\n\n\t\t\treturn () => {\n\t\t\t\tclear()\n\t\t\t\tcurrentRef?.removeEventListener(\"mouseenter\", enter)\n\t\t\t\tcurrentRef?.removeEventListener(\"mouseleave\", clear)\n\t\t\t\tcurrentRef?.removeEventListener(\"pointerdown\", decode)\n\t\t\t}\n\t\t}, [decode, ref, lightbox])\n\n\t\tconst fallbackLayoutId = useId()\n\n\t\t// Use the lightbox transition while open so the exit animation is the same\n\t\t// transition as the enter animation.\n\t\tconst transition = openOverrides?.transition ?? props.transition ?? config.transition\n\t\tconst borderRadius = openOverrides?.borderRadius\n\n\t\tconst imageRendering = openOverrides?.imageRendering\n\t\tconst filter = openOverrides?.filter\n\n\t\tconst borderTop = openOverrides?.borderTop\n\t\tconst borderRight = openOverrides?.borderRight\n\t\tconst borderBottom = openOverrides?.borderBottom\n\t\tconst borderLeft = openOverrides?.borderLeft\n\t\tconst borderStyle = openOverrides?.borderStyle\n\t\tconst borderColor = openOverrides?.borderColor\n\t\tconst hasAnyBorder = Boolean(borderTop || borderRight || borderBottom || borderLeft || borderStyle || borderColor)\n\n\t\tconst border = hasAnyBorder\n\t\t\t? {\n\t\t\t\t\t\"--border-top-width\": borderTop,\n\t\t\t\t\t\"--border-right-width\": borderRight,\n\t\t\t\t\t\"--border-bottom-width\": borderBottom,\n\t\t\t\t\t\"--border-left-width\": borderLeft,\n\t\t\t\t\t\"--border-style\": borderStyle,\n\t\t\t\t\t\"--border-color\": borderColor,\n\t\t\t\t}\n\t\t\t: undefined\n\n\t\t// Set an attribute to allow CustomCursor to traverse from the lightbox to the trigger, and\n\t\t// up to the ancestor that defines a cursor.\n\t\tconst portalProps = { [portalIdAttribute]: props.id }\n\n\t\tconst paddingTop = getSidePadding(lightbox?.paddingTop, lightbox?.padding)\n\t\tconst paddingBottom = getSidePadding(lightbox?.paddingBottom, lightbox?.padding)\n\t\tconst paddingLeft = getSidePadding(lightbox?.paddingLeft, lightbox?.padding)\n\t\tconst paddingRight = getSidePadding(lightbox?.paddingRight, lightbox?.padding)\n\n\t\tconst style = openOverrides?.borderRadius\n\t\t\t? { ...props.style, borderRadius: openOverrides.borderRadius }\n\t\t\t: props.style\n\n\t\t// When the layer has a layoutDependency, we need to modify it when the lightbox is open.\n\t\tconst layoutDependency = open\n\t\t\t? props.layoutDependency\n\t\t\t\t? `${props.layoutDependency}-open`\n\t\t\t\t: \"open\"\n\t\t\t: props.layoutDependency\n\t\t// FIXME: We also have to disable layout animations entirely to avoid the flickering\n\t\tconst layoutId = isInTickerItem && open ? undefined : (props.layoutId ?? (lightbox ? fallbackLayoutId : undefined))\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<Component\n\t\t\t\t\t{...props}\n\t\t\t\t\t// Set inline-style border-radius overrides so that motion can read the starting\n\t\t\t\t\t// radius, and scale correct during the transition. We remove these overrides\n\t\t\t\t\t// when the lightbox is closed.\n\t\t\t\t\tstyle={style}\n\t\t\t\t\tonClick={handleClick}\n\t\t\t\t\tlayoutId={layoutId}\n\t\t\t\t\tref={ref}\n\t\t\t\t\tlayoutDependency={layoutDependency}\n\t\t\t\t\ttransition={transition}\n\t\t\t\t/>\n\t\t\t\t<AnimatePresence\n\t\t\t\t\tonExitComplete={() => {\n\t\t\t\t\t\t// Clear the overrides when the backdrop is fully\n\t\t\t\t\t\t// removed.\n\t\t\t\t\t\tstartTransition(() => {\n\t\t\t\t\t\t\tsetOpenOverrides(undefined)\n\t\t\t\t\t\t\tancestorTickerContext?.start()\n\t\t\t\t\t\t})\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{open && lightbox && image && (\n\t\t\t\t\t\t<Fragment key=\"backdrop\">\n\t\t\t\t\t\t\t{createPortal(\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t{...portalProps}\n\t\t\t\t\t\t\t\t\t\tclassName={lightboxClassName}\n\t\t\t\t\t\t\t\t\t\tonClick={onClose}\n\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\tposition: \"fixed\",\n\t\t\t\t\t\t\t\t\t\t\tinset: 0,\n\t\t\t\t\t\t\t\t\t\t\tzIndex: lightbox.zIndex,\n\t\t\t\t\t\t\t\t\t\t\tbackgroundColor: lightbox.backdrop ?? \"transparent\",\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\ttransition={transition}\n\t\t\t\t\t\t\t\t\t\tinitial={enterExitBackdropAnimation}\n\t\t\t\t\t\t\t\t\t\tanimate={targetBackdropAnimation}\n\t\t\t\t\t\t\t\t\t\texit={enterExitBackdropAnimation}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t{...portalProps}\n\t\t\t\t\t\t\t\t\t\tclassName={lightboxClassName}\n\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\talignItems: \"center\",\n\t\t\t\t\t\t\t\t\t\t\tdisplay: \"flex\",\n\t\t\t\t\t\t\t\t\t\t\tinset: `${paddingTop}px ${paddingRight}px ${paddingBottom}px ${paddingLeft}px`,\n\t\t\t\t\t\t\t\t\t\t\tjustifyContent: \"center\",\n\t\t\t\t\t\t\t\t\t\t\tpointerEvents: \"none\",\n\t\t\t\t\t\t\t\t\t\t\tposition: \"fixed\",\n\t\t\t\t\t\t\t\t\t\t\tzIndex: lightbox.zIndex,\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\t\talignItems: \"center\",\n\t\t\t\t\t\t\t\t\t\t\t\taspectRatio,\n\t\t\t\t\t\t\t\t\t\t\t\tdisplay: \"flex\",\n\t\t\t\t\t\t\t\t\t\t\t\tjustifyContent: \"center\",\n\t\t\t\t\t\t\t\t\t\t\t\tmaxHeight: \"100%\",\n\t\t\t\t\t\t\t\t\t\t\t\tposition: \"relative\",\n\t\t\t\t\t\t\t\t\t\t\t\twidth: \"100%\",\n\t\t\t\t\t\t\t\t\t\t\t\tmaxWidth: lightbox.maxWidth,\n\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\t\tlayoutId={layoutId}\n\t\t\t\t\t\t\t\t\t\t\t\ttransition={transition}\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={onOpen}\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"framer-lightbox-container\"\n\t\t\t\t\t\t\t\t\t\t\t\tdata-border={hasAnyBorder}\n\t\t\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\t\t\taspectRatio,\n\t\t\t\t\t\t\t\t\t\t\t\t\tborderRadius,\n\t\t\t\t\t\t\t\t\t\t\t\t\tbottom: 0,\n\t\t\t\t\t\t\t\t\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\t\t\t\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t\t\t\t\t\t\t\t\tuserSelect: \"none\",\n\t\t\t\t\t\t\t\t\t\t\t\t\timageRendering,\n\t\t\t\t\t\t\t\t\t\t\t\t\tfilter,\n\t\t\t\t\t\t\t\t\t\t\t\t\t...border,\n\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<BackgroundImageComponent image={image} alt={image.alt} draggable={props.draggable} />\n\t\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t</>,\n\t\t\t\t\t\t\t\tgetPortalContainer(),\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t)}\n\t\t\t\t</AnimatePresence>\n\t\t\t</>\n\t\t)\n\t})\n}\n", "import { useEffect } from \"react\"\n\n/** @private */\nexport function useEscToClose(isOpen: boolean, close: () => void) {\n\tuseEffect(() => {\n\t\tfunction handleKeyDown(e: KeyboardEvent) {\n\t\t\tif (e.key === \"Escape\" && isOpen) {\n\t\t\t\te.preventDefault()\n\t\t\t\te.stopPropagation()\n\t\t\t\tclose()\n\t\t\t}\n\t\t}\n\n\t\twindow.addEventListener(\"keyup\", handleKeyDown)\n\t\treturn () => window.removeEventListener(\"keyup\", handleKeyDown)\n\t}, [isOpen, close])\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport React, { forwardRef } from \"react\"\n\nexport interface ColumnMasonryLayoutProps extends React.PropsWithChildren {\n\t/** Number of masonry tracks (columns). Defaults to `1`. */\n\ttrackCount: number\n\t/** Vertical spacing between items inside a column (in px). */\n\trowGap?: number\n\t/**\n\t * When the parent is a Data Repeater we need to flatten the first level of\n\t * fragments that Repeaters wrap their items in so that every item is\n\t * considered individually during track distribution.\n\t *\n\t * @default false\n\t */\n\tparentIsDataRepeater?: boolean\n\t/**\n\t * Visual ordering of children based on their original ids.\n\t */\n\titemsOrder?: string[]\n}\n\nconst ColumnMasonryLayout = /* @__PURE__ */ React.memo(function ColumnMasonryLayout({\n\ttrackCount,\n\trowGap,\n\tparentIsDataRepeater = false,\n\titemsOrder,\n\tchildren,\n}: ColumnMasonryLayoutProps): React.ReactElement[] | React.ReactNode {\n\tlet normalizedChildren = prepareChildrenArrayForMasonry(children, parentIsDataRepeater)\n\tif (itemsOrder?.length) {\n\t\tnormalizedChildren = reorderChildrenForItemsOrder(normalizedChildren, itemsOrder)\n\t}\n\n\tconst tracks = groupChildrenIntoTracks(trackCount, normalizedChildren)\n\tconst wrapperStyle = getMasonryColumnStyle(rowGap)\n\n\treturn tracks.map((trackChildren, i) => (\n\t\t<div key={getMasonryColumnKey(i)} style={wrapperStyle}>\n\t\t\t{trackChildren}\n\t\t</div>\n\t))\n})\n\nfunction getChildOrderId(child: React.ReactNode): string | undefined {\n\treturn React.isValidElement(child) ? child.props[\"data-framer-order-id\"] : undefined\n}\n\n/**\n * Reorder children based on the parent's itemsOrder property.\n *\n * We need to do this as our column masonry layout cannot utilize the `order` CSS property due to\n * conflicts with the redistribution of children into flex box tracks. Instead, we're marking each\n * child with a `data-framer-order-id` attribute that we can later extract from the serialized JSX and\n * reorder them based on the itemsOrder prop.\n *\n * @param children Serialized JSX children of the original node.\n * @param itemsOrder Visual ordering of children based on their original ids.\n * @returns Children reordered based on the itemsOrder.\n */\nfunction reorderChildrenForItemsOrder(children: React.ReactNode[], itemsOrder: string[]): React.ReactNode[] {\n\tconst childrenById: Map<string, React.ReactNode> = new Map()\n\tconst remaining: React.ReactNode[] = []\n\tconst orderSet = new Set(itemsOrder)\n\n\tfor (const child of children) {\n\t\tconst id = getChildOrderId(child)\n\t\tif (id && orderSet.has(id)) {\n\t\t\tchildrenById.set(id, child)\n\t\t} else {\n\t\t\tremaining.push(child)\n\t\t}\n\t}\n\n\tconst ordered: React.ReactNode[] = []\n\tfor (const id of itemsOrder) {\n\t\tconst child = childrenById.get(id)\n\t\tif (child) ordered.push(child)\n\t}\n\n\treturn [...ordered, ...remaining]\n}\n\nexport function prepareChildrenArrayForMasonry(\n\tchildren: React.ReactNode,\n\tparentIsDataRepeater: boolean,\n): React.ReactNode[] {\n\tconst array = React.Children.toArray(children)\n\tif (!parentIsDataRepeater) return array\n\treturn array.flatMap(child =>\n\t\tReact.isValidElement(child) && child.type === React.Fragment ? React.Children.toArray(child.props.children) : child,\n\t)\n}\n\n/**\n * Split the given children into Masonry tracks (columns) using the\n * provided distribution algorithm.\n */\nexport function groupChildrenIntoTracks(trackCount: number, children: React.ReactNode[]): React.ReactNode[][] {\n\tconst tracks: React.ReactNode[][] = Array.from({ length: trackCount }, () => [])\n\n\tchildren.forEach((child, idx) => {\n\t\tconst track = pickMasonryTrack(trackCount, idx)\n\t\ttracks[track]?.push(child)\n\t})\n\n\treturn tracks\n}\n\n/**\n * Compute the base column wrapper style for a Masonry stack.\n */\nexport function getMasonryColumnStyle(rowGap?: number): React.CSSProperties {\n\treturn {\n\t\tdisplay: \"flex\",\n\t\tflexDirection: \"column\",\n\t\trowGap,\n\t\twidth: \"100%\",\n\t}\n}\n\n/**\n * Get the key for a Masonry column wrapper.\n */\nfunction getMasonryColumnKey(i: number): `masonry-stack-${number}` {\n\treturn `masonry-stack-${i}`\n}\n\n/**\n * Simple picker function that evenly distributes children into tracks.\n *\n * This approach differs from  the proposed CSS specification, as the latter works with\n * height-aware distribution instead of child order.\n *\n * We're using the child index for a sequential distribution due to the fact that\n * our distribution logic needs to work both on the client and the server, and considering\n * that some nodes would have heights that we would need to measure on the client, we\n * cannot guarantee a consistent distribution on the server.\n *\n * Example:\n *   Suppose there are 3 tracks/columns and 7 children:\n *\n *   | Track 0 | Track 1 | Track 2 |\n *   |---------|---------|---------|\n *   |   0     |   1     |   2     |\n *   |   3     |   4     |   5     |\n *   |   6     |         |         |\n *\n *   Each child is placed in (childIndex % trackCount):\n *     pickMasonryTrack(3, 0) // 0 \u2192 Track 0\n *     pickMasonryTrack(3, 1) // 1 \u2192 Track 1\n *     pickMasonryTrack(3, 2) // 2 \u2192 Track 2\n *     pickMasonryTrack(3, 3) // 0 \u2192 Track 0 (wraps)\n *     ...\n */\nexport function pickMasonryTrack(trackCount: number, childIndex: number): number {\n\tif (trackCount <= 0) return 0\n\treturn childIndex % trackCount\n}\n\n/** @internal */\nexport const withColumnMasonryLayout = /* @__PURE__ */ <\n\tP extends { [key: string]: unknown; style?: MotionStyle },\n\tR = unknown,\n>(\n\tComponent: React.ComponentType<P & React.RefAttributes<R>>,\n) => {\n\treturn forwardRef<\n\t\tR,\n\t\tReact.PropsWithChildren<P & Partial<ColumnMasonryLayoutProps & { columnMasonryLayoutEnabled?: true }>>\n\t>(function MasonryLayout(\n\t\t{\n\t\t\tcolumnMasonryLayoutEnabled,\n\t\t\ttrackCount = 1,\n\t\t\trowGap,\n\t\t\tparentIsDataRepeater,\n\t\t\titemsOrder,\n\t\t\tchildren,\n\t\t\tstyle: existingStyle,\n\t\t\t...rest\n\t\t},\n\t\tref,\n\t) {\n\t\t// If the layout is not enabled for this variant, we avoid mounting the\n\t\t// extra wrapper entirely, and instead render the original component and its\n\t\t// children unmodified.\n\t\tif (!columnMasonryLayoutEnabled) {\n\t\t\treturn (\n\t\t\t\t<Component ref={ref} style={existingStyle} {...(rest as P)}>\n\t\t\t\t\t{children}\n\t\t\t\t</Component>\n\t\t\t)\n\t\t}\n\n\t\tconst mergedStyle: MotionStyle | undefined = {\n\t\t\t...existingStyle,\n\t\t\tgridTemplateColumns: `repeat(${trackCount}, 1fr)`,\n\t\t}\n\n\t\treturn (\n\t\t\t<Component ref={ref} style={mergedStyle} {...(rest as P)}>\n\t\t\t\t<ColumnMasonryLayout\n\t\t\t\t\ttrackCount={trackCount}\n\t\t\t\t\trowGap={rowGap}\n\t\t\t\t\tparentIsDataRepeater={parentIsDataRepeater}\n\t\t\t\t\titemsOrder={itemsOrder}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</ColumnMasonryLayout>\n\t\t\t</Component>\n\t\t)\n\t})\n}\n", "import { memo, startTransition, useEffect, useState } from \"react\"\nimport { useLocaleCode } from \"../../router/useLocale.ts\"\nimport { isValidDate, isWindow } from \"../../utils/utils.ts\"\nimport {\n\ttype RelativeDateFormat,\n\ttype RelativeDateNumeric,\n\ttype RelativeDateStyle,\n\tformatRelativeDate,\n} from \"./formatRelativeDate.ts\"\n\n/**\n * This file defines a `RelativeDate` component that's used by the relative date transform to format\n * dates. The special thing about this component is that it injects a little script that\n * synchronously runs before hydration so we don't flash the absolute date on page load.\n */\n\ninterface RelativeDateProps extends React.HTMLAttributes<HTMLTimeElement> {\n\tdate: string\n\tdateFormat?: RelativeDateFormat\n\tdateStyle?: RelativeDateStyle\n\tdateNumeric?: RelativeDateNumeric\n\tdateCapitalize?: boolean\n\tlocale?: string\n}\n\nexport const RelativeDate = /* @__PURE__ */ memo(function RelativeDate({\n\tdate: dateString,\n\tdateFormat = \"auto\",\n\tdateStyle = \"long\",\n\tdateNumeric = \"auto\",\n\tdateCapitalize = false,\n\tlocale: externalLocale,\n\t...props\n}: RelativeDateProps) {\n\tconst fallbackLocale = useLocaleCode()\n\tconst locale = externalLocale || fallbackLocale\n\n\tconst targetDate = dateString ? new Date(dateString) : null\n\n\tconst [currentDate, setCurrentDate] = useState(getCurrentDate)\n\n\tconst interval = dateFormat === \"second\" ? 1_000 : 60_000\n\n\tuseEffect(() => {\n\t\tconst timeout = setInterval(() => {\n\t\t\tstartTransition(() => {\n\t\t\t\tsetCurrentDate(getCurrentDate)\n\t\t\t})\n\t\t}, interval)\n\n\t\treturn () => {\n\t\t\tclearInterval(timeout)\n\t\t}\n\t}, [interval])\n\n\tif (!isValidDate(targetDate)) return null\n\n\tconst formattedDate = targetDate.toLocaleString(locale, {\n\t\ttimeZone: \"UTC\",\n\t\tdateStyle: \"long\",\n\t\ttimeStyle:\n\t\t\tdateFormat === \"second\"\n\t\t\t\t? \"medium\" // Show \"hh:mm:ss\" when formatting to seconds\n\t\t\t\t: dateFormat === \"minute\" || dateFormat === \"hour\"\n\t\t\t\t\t? \"short\" // Show \"hh:mm\" when formatting to minutes or hours\n\t\t\t\t\t: undefined,\n\t})\n\n\tconst formattedRelativeDate = formatRelativeDate(\n\t\ttargetDate,\n\t\tcurrentDate,\n\t\tdateFormat,\n\t\tdateStyle,\n\t\tdateNumeric,\n\t\tdateCapitalize,\n\t\tlocale,\n\t)\n\n\tconst formattedIsoDate = targetDate.toISOString()\n\n\treturn (\n\t\t<time suppressHydrationWarning dateTime={formattedIsoDate} title={formattedDate} {...props}>\n\t\t\t{isWindow ? formattedRelativeDate : formattedDate}\n\n\t\t\t{isWindow ? null : (\n\t\t\t\t<script\n\t\t\t\t\tdata-relative-date-script=\"inline\"\n\t\t\t\t\t// biome-ignore lint/security/noDangerouslySetInnerHtml: Intentional\n\t\t\t\t\tdangerouslySetInnerHTML={{\n\t\t\t\t\t\t__html: createHydrationScript(targetDate, dateFormat, dateStyle, dateNumeric, dateCapitalize, locale),\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</time>\n\t)\n})\n\nfunction getCurrentDate() {\n\tconst date = new Date()\n\n\treturn new Date(\n\t\tDate.UTC(\n\t\t\tdate.getFullYear(),\n\t\t\tdate.getMonth(),\n\t\t\tdate.getDate(),\n\t\t\tdate.getHours(),\n\t\t\tdate.getMinutes(),\n\t\t\tdate.getSeconds(),\n\t\t\tdate.getMilliseconds(),\n\t\t),\n\t)\n}\n\nfunction createHydrationScript(\n\tdate: Date,\n\tformat: RelativeDateFormat,\n\tstyle: RelativeDateStyle,\n\tnumeric: RelativeDateNumeric,\n\tcapitalize: boolean,\n\tlocale: string,\n) {\n\tconst serializedDate = date.getTime()\n\tconst serializedFormat = JSON.stringify(format)\n\tconst serializedStyle = JSON.stringify(style)\n\tconst serializedNumeric = JSON.stringify(numeric)\n\tconst serializedCapitalize = JSON.stringify(capitalize)\n\tconst serializedLocale = JSON.stringify(locale)\n\n\t// The `__framer_formatRelativeDate` is injected in the `exportToHTML.ts` file.\n\treturn /* js */ `document.currentScript.parentElement.textContent = window.__framer_formatRelativeDate(new Date(${serializedDate}), new Date(), ${serializedFormat}, ${serializedStyle}, ${serializedNumeric}, ${serializedCapitalize}, ${serializedLocale})`\n}\n", "type RelativeDateUnit = \"second\" | \"minute\" | \"hour\" | \"day\" | \"week\" | \"month\" | \"quarter\" | \"year\"\n\nexport type RelativeDateFormat = \"auto\" | RelativeDateUnit\nexport type RelativeDateStyle = \"narrow\" | \"short\" | \"long\"\nexport type RelativeDateNumeric = \"always\" | \"auto\"\n\nconst formatters = new Map<string, Intl.RelativeTimeFormat>()\n\nfunction getRelativeTimeFormat(\n\tstyle: RelativeDateStyle,\n\tnumeric: RelativeDateNumeric,\n\tlocale: string,\n): Intl.RelativeTimeFormat {\n\tconst options = { numeric, style } as const\n\tconst args = [locale, options] as const\n\tconst key = JSON.stringify(args)\n\n\tconst existing = formatters.get(key)\n\tif (existing) return existing\n\n\tconst formatter = new Intl.RelativeTimeFormat(...args)\n\n\tformatters.set(key, formatter)\n\treturn formatter\n}\n\nexport function formatRelativeDate(\n\ttargetDate: Date,\n\treferenceDate: Date,\n\tformat: RelativeDateFormat,\n\tstyle: RelativeDateStyle,\n\tnumeric: RelativeDateNumeric,\n\tcapitalize: boolean,\n\tlocale: string,\n): string {\n\tconst unit = getRelativeDateUnit(targetDate, referenceDate, format)\n\tconst value = getRelativeDateValue(targetDate, referenceDate, unit)\n\n\tconst formatted = getRelativeTimeFormat(style, numeric, locale).format(value, unit)\n\tif (capitalize) return capitalizeFirstLetter(formatted)\n\treturn formatted\n}\n\nfunction capitalizeFirstLetter(text: string): string {\n\treturn text.charAt(0).toUpperCase() + text.slice(1)\n}\n\nfunction getRelativeDateUnit(targetDate: Date, referenceDate: Date, format: RelativeDateFormat): RelativeDateUnit {\n\tif (format !== \"auto\") return format\n\n\tconst daysDiff = differenceInCalendarDays(targetDate, referenceDate)\n\tif (Math.abs(daysDiff) <= 7) return \"day\"\n\n\tconst weeksDiff = differenceInCalendarWeeks(targetDate, referenceDate)\n\tif (Math.abs(weeksDiff) <= 4) return \"week\"\n\n\tconst monthsDiff = differenceInCalendarMonths(targetDate, referenceDate)\n\tif (Math.abs(monthsDiff) <= 12) return \"month\"\n\n\treturn \"year\"\n}\n\nconst SECOND = 1000\nconst MINUTE = 60_000\nconst HOUR = 3_600_000\nconst DAY = 86_400_000\nconst WEEK = 604_800_000\n\nfunction getRelativeDateValue(targetDate: Date, referenceDate: Date, unit: RelativeDateUnit): number {\n\tconst delta = targetDate.getTime() - referenceDate.getTime()\n\n\tswitch (unit) {\n\t\tcase \"second\":\n\t\t\treturn Math.trunc(delta / SECOND)\n\t\tcase \"minute\":\n\t\t\treturn Math.trunc(delta / MINUTE)\n\t\tcase \"hour\":\n\t\t\treturn Math.trunc(delta / HOUR)\n\t\tcase \"day\":\n\t\t\treturn differenceInCalendarDays(targetDate, referenceDate)\n\t\tcase \"week\":\n\t\t\treturn differenceInCalendarWeeks(targetDate, referenceDate)\n\t\tcase \"month\":\n\t\t\treturn differenceInCalendarMonths(targetDate, referenceDate)\n\t\tcase \"quarter\":\n\t\t\treturn differenceInCalendarQuarters(targetDate, referenceDate)\n\t\tcase \"year\":\n\t\t\treturn differenceInCalendarYears(targetDate, referenceDate)\n\t}\n\n\tconst _: never = unit\n}\n\n// NOTE: We inline the `date-fns` functions to reduce the bundle size of the blocking JavaScript\n// script that runs at the start of the body tag. It also helps with tree shaking as the `date-fns`\n// library is not fully tree-shakeable.\n\n// From https://github.com/date-fns/date-fns/blob/main/src/startOfDay/index.ts\nfunction getUTCStartOfDay(date: Date) {\n\tconst result = new Date(date)\n\tresult.setUTCHours(0, 0, 0, 0)\n\treturn result\n}\n\n// From https://github.com/date-fns/date-fns/blob/main/src/differenceInCalendarDays/index.ts\nexport function differenceInCalendarDays(targetDate: Date, referenceDate: Date) {\n\tconst targetTimestamp = getUTCStartOfDay(targetDate).getTime()\n\tconst referenceTimestamp = getUTCStartOfDay(referenceDate).getTime()\n\n\treturn Math.round((targetTimestamp - referenceTimestamp) / DAY)\n}\n\n// From https://github.com/date-fns/date-fns/blob/main/src/startOfWeek/index.ts\nfunction getUTCStartOfWeek(date: Date) {\n\tconst result = new Date(date)\n\tconst day = result.getUTCDay()\n\tconst diff = (day < 1 ? 7 : 0) + day - 1\n\n\tresult.setUTCDate(result.getUTCDate() - diff)\n\tresult.setUTCHours(0, 0, 0, 0)\n\n\treturn result\n}\n\n// From https://github.com/date-fns/date-fns/blob/main/src/differenceInCalendarWeeks/index.ts\nexport function differenceInCalendarWeeks(targetDate: Date, referenceDate: Date) {\n\tconst targetTimestamp = getUTCStartOfWeek(targetDate).getTime()\n\tconst referenceTimestamp = getUTCStartOfWeek(referenceDate).getTime()\n\n\treturn Math.round((targetTimestamp - referenceTimestamp) / WEEK)\n}\n\n// From https://github.com/date-fns/date-fns/blob/main/src/differenceInCalendarMonths/index.ts\nexport function differenceInCalendarMonths(targetDate: Date, referenceDate: Date) {\n\tconst yearsDiff = targetDate.getUTCFullYear() - referenceDate.getUTCFullYear()\n\tconst monthsDiff = targetDate.getUTCMonth() - referenceDate.getUTCMonth()\n\n\treturn yearsDiff * 12 + monthsDiff\n}\n\n// From https://github.com/date-fns/date-fns/blob/main/src/getQuarter/index.ts\nfunction getUTCQuarter(date: Date) {\n\tconst month = date.getUTCMonth()\n\treturn Math.trunc(month / 3)\n}\n\n// From https://github.com/date-fns/date-fns/blob/main/src/differenceInCalendarQuarters/index.ts\nexport function differenceInCalendarQuarters(targetDate: Date, referenceDate: Date) {\n\tconst yearsDiff = targetDate.getUTCFullYear() - referenceDate.getUTCFullYear()\n\tconst quartersDiff = getUTCQuarter(targetDate) - getUTCQuarter(referenceDate)\n\n\treturn yearsDiff * 4 + quartersDiff\n}\n\n// From https://github.com/date-fns/date-fns/blob/main/src/differenceInCalendarYears/index.ts\nexport function differenceInCalendarYears(targetDate: Date, referenceDate: Date) {\n\treturn targetDate.getUTCFullYear() - referenceDate.getUTCFullYear()\n}\n", "import type { MotionProps, MotionStyle } from \"framer-motion\"\nimport { isMotionComponent, isValidMotionProp, motion, unwrapMotionComponent } from \"framer-motion\"\nimport type React from \"react\"\nimport { Children, Fragment, cloneElement, forwardRef, isValidElement, useContext, useMemo, useRef } from \"react\"\nimport { Animatable } from \"../../animation/Animatable/Animatable.ts\"\nimport { cx } from \"../../modules/cx.ts\"\nimport { asRecord } from \"../../utils/asRecord.ts\"\nimport { isPropValid } from \"../../utils/isPropValid.ts\"\nimport { slugify } from \"../../utils/slugify.ts\"\nimport { isNumber, isObject, isString, isUndefined } from \"../../utils/utils.ts\"\nimport { collectTextShadowsForProps } from \"../style/shadow.tsx\"\nimport type { FilterProperties } from \"../traits/Filters.ts\"\nimport type { TextShadowProperties } from \"../traits/Shadow.ts\"\nimport type { CustomConstraintProperties, NewConstraintProperties } from \"../types/NewConstraints.tsx\"\nimport { ParentSizeState, calculateRect, useParentSize } from \"../types/NewConstraints.tsx\"\nimport { RenderTarget } from \"../types/RenderEnvironment.ts\"\nimport { collectFiltersFromProps } from \"../utils/filtersForNode.ts\"\nimport { htmlElementAsMotionComponent } from \"../utils/htmlElementAsMotionComponent.ts\"\nimport { withLibraryCSS } from \"../utils/injectComponentCSSRules.ts\"\nimport { defaultRichTextContainerStyle } from \"../utils/injectRichTextRules.ts\"\nimport { transformTemplate } from \"../utils/transformTemplate.ts\"\nimport { useLayoutId } from \"../utils/useLayoutId.ts\"\nimport { useMeasureLayout } from \"../utils/useMeasureLayout.ts\"\nimport { ComponentContainerContext } from \"./ComponentContainerContext.tsx\"\nimport type { DeprecatedRichTextProps } from \"./DeprecatedRichText.tsx\"\nimport { DeprecatedRichText, convertVerticalAlignment, useLoadFonts } from \"./DeprecatedRichText.tsx\"\nimport type { LayerProps } from \"./Layer.tsx\"\nimport type { TextVerticalAlignment } from \"./Text.tsx\"\nimport type { TextEffect, TextEffectTokenizer } from \"./useTextEffect.tsx\"\nimport { useTextEffect } from \"./useTextEffect.tsx\"\n\n/** @internal */\nexport interface RichTextProps\n\textends\n\t\tPartial<NewConstraintProperties>,\n\t\tPartial<FilterProperties>,\n\t\tOmit<LayerProps, \"children\">,\n\t\tPartial<TextShadowProperties>,\n\t\tMotionProps {\n\t__fromCanvasComponent?: boolean\n\tas?: keyof HTMLElementTagNameMap\n\tchildren?: React.ReactElement\n\tclassName?: string\n\tenvironment?(): RenderTarget\n\tfonts?: string[]\n\tisEditable?: boolean\n\t/** Name of the node. Only provided in the scope of canvas pages. */\n\tname?: string\n\t/** Name of the node. Provided in every scope, assuming the node has a name. */\n\t[\"data-framer-name\"]?: string\n\topacity?: number\n\trotation?: Animatable<number> | number\n\tstylesPresetsClassNames?: Record<string, string>\n\ttext?: React.ReactNode\n\tverticalAlignment?: TextVerticalAlignment\n\tvisible?: boolean\n\t/** Means that we are in code generation and the layout styles are set in \"external\" CSS classes */\n\twithExternalLayout?: boolean\n\tviewBox?: string\n\tviewBoxScale?: number\n\t_initialStyle?: Partial<MotionStyle>\n\tanchorLinkOffsetY?: number\n\teffect?: TextEffect\n}\n\n// Create a custom motion component to give the SVG element the features of a motion\n// div. Otherwise motion.svg behaves differently, animating viewbox changes and ignoring\n// style and layout. Implementation taken from `svgForNode.ts`.\nconst BaseSVG = /* @__PURE__ */ forwardRef<SVGSVGElement, React.SVGProps<SVGSVGElement>>(\n\tfunction BaseSVG(props, forwardedRef) {\n\t\treturn (\n\t\t\t// biome-ignore lint/a11y/noSvgWithoutTitle: FIXME: FitText might be inaccessible to screen readers because it\u2019s wrapped in an svg\n\t\t\t<svg {...props} ref={forwardedRef}>\n\t\t\t\t{props.children}\n\t\t\t</svg>\n\t\t)\n\t},\n)\nconst MotionSVG = /* @__PURE__ */ motion.create(BaseSVG)\n\nconst FitText = /* @__PURE__ */ forwardRef<SVGSVGElement, FitTextProps>(function FitText(\n\t{ viewBoxScale, viewBox, children, ...props },\n\tforwardedRef,\n) {\n\treturn (\n\t\t<MotionSVG {...props} ref={forwardedRef} viewBox={viewBox}>\n\t\t\t<motion.foreignObject\n\t\t\t\twidth=\"100%\"\n\t\t\t\theight=\"100%\"\n\t\t\t\tclassName=\"framer-fit-text\"\n\t\t\t\ttransform={`scale(${viewBoxScale})`}\n\t\t\t\tstyle={{ overflow: \"visible\", transformOrigin: \"center center\" }}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</motion.foreignObject>\n\t\t</MotionSVG>\n\t)\n})\n\nconst defaultFonts: string[] = [] as const\nconst richTextContainerComponentType = \"RichTextContainer\"\n\n// Canvas-internal props (like `blendingMode`, `duplicatedFrom`, `_needsMeasure`,\n// `widthType`, `hueRotate`) are spread into `RichText` by the canvas renderer.\n// Filter the pass-through props to only valid motion/DOM attributes so these\n// don\u2019t leak onto the underlying DOM element and trigger React warnings.\nfunction getValidRestProps(rest: Record<string, unknown>): Record<string, unknown> {\n\tconst validProps: Record<string, unknown> = {}\n\tfor (const key in rest) {\n\t\tif (isValidMotionProp(key) || isPropValid(key)) {\n\t\t\tvalidProps[key] = rest[key]\n\t\t}\n\t}\n\treturn validProps\n}\n\nconst RichTextContainer = /* @__PURE__ */ forwardRef(function RichTextContainer<T extends RichTextProps>(\n\tprops: T,\n\tforwardedRef: React.RefObject<HTMLDivElement | SVGSVGElement> | null,\n) {\n\tconst {\n\t\t__fromCanvasComponent = false,\n\t\t_forwardedOverrideId,\n\t\t_forwardedOverrides,\n\t\t_usesDOMRect,\n\t\tanchorLinkOffsetY,\n\t\tas: _as,\n\t\tbottom,\n\t\tcenter,\n\t\tchildren,\n\t\tenvironment = RenderTarget.current,\n\t\tfonts = defaultFonts,\n\t\theight,\n\t\tisEditable = false,\n\t\tleft,\n\t\tname,\n\t\topacity,\n\t\tpositionSticky,\n\t\tpositionStickyBottom,\n\t\tpositionStickyLeft,\n\t\tpositionStickyRight,\n\t\tpositionStickyTop,\n\t\tright,\n\t\trotation = 0,\n\t\tstyle,\n\t\t_initialStyle,\n\t\tstylesPresetsClassNames,\n\t\ttext: plainText,\n\t\ttop,\n\t\tverticalAlignment = \"top\",\n\t\tvisible = true,\n\t\twidth,\n\t\twithExternalLayout = false,\n\t\tviewBox,\n\t\tviewBoxScale = 1,\n\t\teffect,\n\t\t...rest\n\t} = props\n\n\tconst parentSize = useParentSize()\n\tconst isOnCanvas = environment() === RenderTarget.canvas\n\tconst inCodeComponent = useContext(ComponentContainerContext)\n\tconst layoutId = useLayoutId(props)\n\n\tconst fallbackRef = useRef<HTMLDivElement | SVGSVGElement>(null)\n\tconst containerRef = forwardedRef ?? fallbackRef\n\n\tuseMeasureLayout(props, containerRef)\n\tuseLoadFonts(fonts, __fromCanvasComponent, containerRef)\n\n\tconst textEffect = useTextEffect(effect, containerRef)\n\tconst processedChildren = useMemo(() => {\n\t\tif (!children) return\n\n\t\treturn processRichTextChildren(\n\t\t\tchildren,\n\t\t\tstylesPresetsClassNames,\n\t\t\tplainText,\n\t\t\tanchorLinkOffsetY,\n\t\t\tundefined,\n\t\t\ttextEffect.getTokenizer(),\n\t\t)\n\t}, [children, stylesPresetsClassNames, plainText, anchorLinkOffsetY, textEffect])\n\n\tif (!visible) return null\n\n\tconst isHidden = isEditable && isOnCanvas\n\n\tconst containerStyle: MotionStyle = {\n\t\topacity: isHidden ? 0 : opacity,\n\t}\n\n\t/**\n\t * If the dynamic inline styles match the default static styles, we don't need to set them\n\t * inline. This reduces the size of the published sites' html. We need to be careful not to\n\t * remove animatable motion styles, but justify content is not animated in rich text.\n\t * @see https://www.notion.so/framer/71c2ef9441cf40a39f59d4ad51ec0e29?v=e8e59361f11b404c969372616a0af5a0\n\t */\n\tconst justifyContent = convertVerticalAlignment(verticalAlignment)\n\tif (justifyContent !== defaultRichTextContainerStyle.justifyContent) {\n\t\tcontainerStyle.justifyContent = justifyContent\n\t}\n\n\t// Sometimes on the canvas we use motion transform to position the element. We also\n\t// sometimes provide a style object with effect preview transforms. In those cases we need\n\t// to combine the x and y transforms.\n\tconst positionStyle: MotionStyle = {}\n\n\tconst restrictedRenderTarget = RenderTarget.hasRestrictions()\n\tconst frame = calculateRect(props, parentSize || ParentSizeState.Unknown, false)\n\tconst isAutoSized = _usesDOMRect && (width === \"auto\" || height === \"auto\")\n\tconst hasTransformTemplate =\n\t\t!!props.transformTemplate || !frame || !restrictedRenderTarget || __fromCanvasComponent || isAutoSized\n\tconst template = hasTransformTemplate ? (props.transformTemplate ?? transformTemplate(center)) : undefined\n\n\t// During code generation, we set layout styles in \"external\" CSS, but while editing in the\n\t// canvas we set them inline.\n\tif (!withExternalLayout) {\n\t\tif (frame && restrictedRenderTarget && !isAutoSized) {\n\t\t\tpositionStyle.x = frame.x + (isNumber(style?.x) ? style.x : 0)\n\t\t\tpositionStyle.y = frame.y + (isNumber(style?.y) ? style.y : 0)\n\t\t\tpositionStyle.left = 0\n\t\t\tpositionStyle.top = 0\n\t\t\tcontainerStyle.rotate = Animatable.getNumber(rotation)\n\t\t\tcontainerStyle.width = frame.width\n\t\t\tcontainerStyle.minWidth = frame.width\n\t\t\tcontainerStyle.height = frame.height\n\t\t} else {\n\t\t\tcontainerStyle.left = left\n\t\t\tcontainerStyle.right = right\n\t\t\tcontainerStyle.top = top\n\t\t\tcontainerStyle.bottom = bottom\n\t\t\tcontainerStyle.width = width\n\t\t\tcontainerStyle.height = height\n\t\t\t// I have no idea why this works as a number but not as a string. This is copied from the Text component.\n\t\t\tcontainerStyle.rotate = rotation as number\n\t\t}\n\n\t\tif (positionSticky) {\n\t\t\tif (!isOnCanvas || inCodeComponent) {\n\t\t\t\tcontainerStyle.position = \"sticky\"\n\t\t\t\tcontainerStyle.willChange = \"transform\"\n\t\t\t\tcontainerStyle.top = positionStickyTop\n\t\t\t\tcontainerStyle.right = positionStickyRight\n\t\t\t\tcontainerStyle.bottom = positionStickyBottom\n\t\t\t\tcontainerStyle.left = positionStickyLeft\n\t\t\t}\n\t\t} else if (isOnCanvas && (props.positionFixed || props.positionAbsolute)) {\n\t\t\tcontainerStyle.position = \"absolute\"\n\t\t}\n\t}\n\n\tcollectFiltersFromProps(props, containerStyle)\n\tcollectTextShadowsForProps(props, containerStyle)\n\n\tObject.assign(containerStyle, _initialStyle, style, positionStyle)\n\n\tif (layoutId) {\n\t\trest.layout = \"preserve-aspect\"\n\t}\n\n\tconst Component = htmlElementAsMotionComponent(props.as)\n\tconst dataFramerName = rest[\"data-framer-name\"] ?? name\n\tconst validRestProps = isOnCanvas ? getValidRestProps(asRecord(rest)) : rest\n\n\tif (isString(props.viewBox)) {\n\t\t// Handle the case where an svg is used to fit the text if the text size is set to fit.\n\n\t\tif (props.as !== undefined) {\n\t\t\treturn (\n\t\t\t\t<Component\n\t\t\t\t\t{...validRestProps}\n\t\t\t\t\t// This could another element besides div, but `htmlElementAsMotionComponent`\n\t\t\t\t\t// coerces the type of Component to `motion.div`.\n\t\t\t\t\tref={containerRef as React.RefObject<HTMLDivElement>}\n\t\t\t\t\tstyle={containerStyle}\n\t\t\t\t\tlayoutId={layoutId}\n\t\t\t\t\ttransformTemplate={template}\n\t\t\t\t\tdata-framer-name={dataFramerName}\n\t\t\t\t\tdata-framer-component-type={richTextContainerComponentType}\n\t\t\t\t>\n\t\t\t\t\t<FitText viewBox={viewBox} viewBoxScale={viewBoxScale} style={{ width: \"100%\", height: \"100%\" }}>\n\t\t\t\t\t\t{processedChildren}\n\t\t\t\t\t</FitText>\n\t\t\t\t</Component>\n\t\t\t)\n\t\t} else {\n\t\t\treturn (\n\t\t\t\t<FitText\n\t\t\t\t\t{...validRestProps}\n\t\t\t\t\tref={containerRef as React.RefObject<SVGSVGElement>}\n\t\t\t\t\tstyle={containerStyle}\n\t\t\t\t\tlayoutId={layoutId}\n\t\t\t\t\tviewBox={viewBox}\n\t\t\t\t\tviewBoxScale={viewBoxScale}\n\t\t\t\t\ttransformTemplate={template}\n\t\t\t\t\tdata-framer-name={dataFramerName}\n\t\t\t\t\tdata-framer-component-type={richTextContainerComponentType}\n\t\t\t\t>\n\t\t\t\t\t{processedChildren}\n\t\t\t\t</FitText>\n\t\t\t)\n\t\t}\n\t}\n\n\treturn (\n\t\t<Component\n\t\t\t{...validRestProps}\n\t\t\tref={containerRef as React.RefObject<HTMLDivElement>}\n\t\t\tstyle={containerStyle}\n\t\t\tlayoutId={layoutId}\n\t\t\ttransformTemplate={template}\n\t\t\tdata-framer-name={dataFramerName}\n\t\t\tdata-framer-component-type={richTextContainerComponentType}\n\t\t>\n\t\t\t{processedChildren}\n\t\t</Component>\n\t)\n})\n\ntype FitTextProps = Omit<RichTextProps, \"_constraints\"> & {\n\t// Function components don't support ref, so alias as innerRef so we can pass the ref to the underlying svg.\n\tinnerRef?: React.Ref<SVGSVGElement>\n\t// _constraints is optional in the case where it is being lifted to the wrapping element (using props.as).\n\t_constraints?: CustomConstraintProperties\n}\n\nfunction isFragment(element: React.ReactElement): boolean {\n\treturn element.type === Fragment\n}\n\nfunction isLineBreak(element: React.ReactElement): boolean {\n\treturn element.type === \"br\"\n}\n\nfunction processRichTextChildren(\n\telement: React.ReactElement,\n\tstylesPresetsClassNames: Record<string, string> | undefined,\n\tplainText: React.ReactNode | undefined,\n\tanchorLinkOffsetY: number | undefined,\n\t// biome-ignore lint/style/useDefaultParameterLast: <explanation>\n\tslugCounters: Record<string, number> = {},\n\ttokenizer: TextEffectTokenizer | undefined,\n\t// If the first node is a fragment, we want to offset the initial depth so\n\t// that the first real elements have depth 0. This let's us control where we\n\t// run certain effects.\n\tdepth: number = isFragment(element) ? -1 : 0,\n) {\n\tlet children: React.ReactNode[] = Children.toArray(element.props.children)\n\n\t// If a plain text is passed into the RichText component, trim the children\n\t// to only the first branch and replace the text of its leaf node below.\n\tif (!isUndefined(plainText)) {\n\t\tchildren = children.slice(0, 1)\n\t}\n\n\t// If the only children of this element are <br>, we won't animate the\n\t// element if it has a Text Effect.\n\tlet onlyLineBreaks = true\n\tchildren = children.map(child => {\n\t\t// Recursively process children.\n\t\tif (!isValidElement(child) || !isLineBreak(child)) onlyLineBreaks = false\n\t\tif (isValidElement(child)) {\n\t\t\treturn processRichTextChildren(\n\t\t\t\tchild,\n\t\t\t\tstylesPresetsClassNames,\n\t\t\t\tplainText,\n\t\t\t\tanchorLinkOffsetY,\n\t\t\t\tslugCounters,\n\t\t\t\ttokenizer,\n\t\t\t\tdepth + 1,\n\t\t\t)\n\t\t}\n\n\t\t// Replace the text of the leaf node.\n\t\tconst text = !isUndefined(plainText) ? plainText : child\n\t\treturn isString(text) && tokenizer ? tokenizer.text(text) : text\n\t})\n\n\tconst { [\"data-preset-tag\"]: dataPresetTag, ...props } = element.props\n\n\tif (isString(element.type) || isMotionComponent(element.type)) {\n\t\tconst elementType = unwrapMotionComponent(element.type) || element.type\n\t\tconst tag = dataPresetTag || elementType\n\t\tconst stylesPresetClassName = isString(tag) ? stylesPresetsClassNames?.[tag] : undefined\n\t\tprops.className = cx(\"framer-text\", props.className, stylesPresetClassName)\n\t\t// Apply tokenizer props to the top level elements, excluding line\n\t\t// breaks.\n\t\tif (tokenizer && depth === 0 && !onlyLineBreaks) Object.assign(props, tokenizer.props(props.style))\n\n\t\t// Note that we use the `elementType` instead of `tag`, because we only\n\t\t// are interested in true heading tags.\n\t\tconst isHeading =\n\t\t\telementType === \"h1\" ||\n\t\t\telementType === \"h2\" ||\n\t\t\telementType === \"h3\" ||\n\t\t\telementType === \"h4\" ||\n\t\t\telementType === \"h5\" ||\n\t\t\telementType === \"h6\"\n\n\t\t// Add IDs and anchor links to headings if necessary.\n\t\tconst anchorLinkStylePresetClassName = stylesPresetsClassNames?.[\"anchor\"]\n\t\tif (isHeading && anchorLinkStylePresetClassName) {\n\t\t\tconst slug = generateHeadingSlug(children, slugCounters)\n\t\t\tprops.id = slug\n\n\t\t\tconst className = cx(\"framer-text\", anchorLinkStylePresetClassName)\n\t\t\tconst anchorLink = (\n\t\t\t\t<a href={`#${slug}`} className={className}>\n\t\t\t\t\t{children}\n\t\t\t\t</a>\n\t\t\t)\n\n\t\t\tprops.style = { ...(props.style ?? {}), scrollMarginTop: anchorLinkOffsetY }\n\n\t\t\tchildren = [anchorLink]\n\t\t}\n\t}\n\n\t// Add `framer-text` className and the correct stylesPresetClassName if\n\t// necessary to the element.\n\treturn cloneElement(element, props, ...children)\n}\n\nfunction generateHeadingSlug(children: React.ReactNode[], slugCounters: Record<string, number>): string {\n\tconst headingText = children.map(extractTextFromReactNode).join(\"\")\n\tlet slug = slugify(headingText)\n\n\tconst slugCounter = slugCounters[slug] ?? 0\n\n\t// Append a number to the slug if it's already in use to ensure all IDs are unique.\n\tif (slugCounter > 0) {\n\t\tslug += `-${slugCounter}`\n\t}\n\n\tslugCounters[slug] = slugCounter + 1\n\n\treturn slug\n}\n\nfunction extractTextFromReactNode(node: React.ReactNode): string {\n\tif (isString(node) || isNumber(node)) {\n\t\treturn node.toString()\n\t}\n\n\tif (isValidElement(node)) {\n\t\treturn extractTextFromReactNode(node.props.children)\n\t}\n\n\tif (Array.isArray(node)) {\n\t\treturn node.map(extractTextFromReactNode).join(\"\")\n\t}\n\n\treturn \"\"\n}\n\n/** @internal */\nconst RichTextInner = /* @__PURE__ */ forwardRef(function RichText(\n\t{ children, html, htmlFromDesign, ...props }: RichTextProps & DeprecatedRichTextProps,\n\tforwardedRef: React.RefObject<HTMLDivElement | SVGSVGElement> | null,\n) {\n\tconst content = html || children || htmlFromDesign\n\n\t// The legacy RichText component did accept HTML instead of JSX. This is\n\t// used when VariantComponent hasn't been regenerated or if the user is\n\t// passing a code override that sets the `html` prop.\n\tif (isString(content)) {\n\t\t// The implementation of the collectElementStylesPresets has changed\n\t\t// to pass in a object but the DeprecatedRichText component still\n\t\t// expects a string.\n\t\tif (!props.stylesPresetsClassName && isObject(props.stylesPresetsClassNames)) {\n\t\t\tprops.stylesPresetsClassName = Object.values(props.stylesPresetsClassNames).join(\" \")\n\t\t}\n\n\t\tconst contentProp = {\n\t\t\t// We need to use the original prop name.\n\t\t\t[isString(html) ? \"html\" : \"htmlFromDesign\"]: content,\n\t\t}\n\n\t\treturn (\n\t\t\t<DeprecatedRichText\n\t\t\t\t{...props}\n\t\t\t\t{...contentProp}\n\t\t\t\t// DeprecatedRichText's ref goes directly to a motion.div.\n\t\t\t\tref={forwardedRef as React.RefObject<HTMLDivElement> | null}\n\t\t\t/>\n\t\t)\n\t}\n\n\t// Scenario: If the content has been regenerated but the\n\t// GeneratedVariantComponent is stale.\n\tif (!props.stylesPresetsClassNames && isString(props.stylesPresetsClassName)) {\n\t\t// Previously the collectElementStylesPresets was setting the\n\t\t// stylesPresetsClassName to a string with 5 classNames\n\t\t// representing the different presets. To separate them again we\n\t\t// depend on specific order they were defined in.\n\t\tconst [h1, h2, h3, p, a] = props.stylesPresetsClassName.split(\" \")\n\t\t// If one of them is set, all of them should be set.\n\t\tif (h1 === undefined || h2 === undefined || h3 === undefined || p === undefined || a === undefined) {\n\t\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\t\tconsole.warn(`Encountered invalid stylesPresetsClassNames: ${props.stylesPresetsClassNames}`)\n\t\t} else {\n\t\t\tprops.stylesPresetsClassNames = { h1, h2, h3, p, a }\n\t\t}\n\t}\n\n\treturn (\n\t\t<RichTextContainer {...props} ref={forwardedRef}>\n\t\t\t{isValidElement(content) ? content : undefined}\n\t\t</RichTextContainer>\n\t)\n})\n\nexport const RichText = /* @__PURE__ */ withLibraryCSS(RichTextInner)\n", "import { isCommandKeyPressed } from \"@framerjs/shared/src/environment.ts\"\nimport type { MotionProps, MotionStyle } from \"framer-motion\"\nimport { motion } from \"framer-motion\"\nimport * as React from \"react\"\nimport { useRef } from \"react\"\nimport { Animatable } from \"../../animation/Animatable/Animatable.ts\"\nimport { useImplicitPathVariables } from \"../../modules/Link/pathVariables.tsx\"\nimport { AnchorLinkTarget } from \"../../modules/Link/types.ts\"\nimport { cx } from \"../../modules/cx.ts\"\nimport { navigateFromAttributes } from \"../../modules/framerPageLink.ts\"\nimport { replaceFramerPageLinks } from \"../../modules/replaceFramerPageLinks.ts\"\nimport { useIsOnFramerCanvas } from \"../../modules/useIsOnFramerCanvas.ts\"\nimport { useRouter } from \"../../router/RouterContext.tsx\"\nimport { useCurrentRoute } from \"../../router/useCurrentRoute.tsx\"\nimport { useRoutePreloader } from \"../../router/useRoutePreloader.ts\"\nimport { fontStore } from \"../fonts/fontStore.ts\"\nimport { collectTextShadowsForProps } from \"../style/shadow.tsx\"\nimport type { FilterProperties } from \"../traits/Filters.ts\"\nimport type {\n\tNewConstraintProperties,\n\tParentSize,\n\tPositionAbsoluteProperties,\n\tPositionFixedProperties,\n} from \"../types/NewConstraints.tsx\"\nimport { ParentSizeState, calculateRect, useParentSize } from \"../types/NewConstraints.tsx\"\nimport { RenderTarget } from \"../types/RenderEnvironment.ts\"\nimport type { Shadow } from \"../types/Shadow.ts\"\nimport { escapeHTML } from \"../utils/dom.ts\"\nimport { collectFiltersFromProps } from \"../utils/filtersForNode.ts\"\nimport { findAnchorElement } from \"../utils/findAnchorElement.ts\"\nimport { withLibraryCSS } from \"../utils/injectComponentCSSRules.ts\"\nimport { isShallowEqualArray } from \"../utils/isShallowEqualArray.ts\"\nimport { transformTemplate } from \"../utils/transformTemplate.ts\"\nimport { useLayoutId } from \"../utils/useLayoutId.ts\"\nimport { measureClosestComponentContainer, useMeasureLayout } from \"../utils/useMeasureLayout.ts\"\nimport { ComponentContainerContext } from \"./ComponentContainerContext.tsx\"\nimport type { LayerProps } from \"./Layer.tsx\"\nimport type { TextVerticalAlignment } from \"./Text.tsx\"\n\n/**\n * @internal\n * Don't change these values as they are used in generated components as well.\n */\nexport const deprecatedRichTextPlaceholder = \"{{ text-placeholder }}\"\nexport const richTextWrapperClassName = \"rich-text-wrapper\"\n\n/** @internal */\nexport interface DeprecatedRichTextProps\n\textends\n\t\tPartial<NewConstraintProperties>,\n\t\tPositionFixedProperties,\n\t\tPositionAbsoluteProperties,\n\t\tPartial<FilterProperties>,\n\t\tLayerProps,\n\t\tPick<MotionProps, \"transformTemplate\"> {\n\t__fromCanvasComponent?: boolean\n\t__htmlStructure?: string\n\tclassName?: string\n\tenvironment?(): RenderTarget\n\tfonts?: string[]\n\thtml?: string\n\thtmlFromDesign?: string\n\tinnerRef?: React.MutableRefObject<HTMLDivElement | null>\n\tisEditable?: boolean\n\t/** Name of the node. Only provided in the scope of canvas pages. */\n\tname?: string\n\topacity?: number\n\tparentSize?: ParentSize\n\tpreload?: string[]\n\trotation?: Animatable<number> | number\n\tshadows?: readonly Shadow[]\n\tstyle?: MotionStyle\n\tstylesPresetsClassName?: string\n\ttext?: string\n\ttextFromDesign?: string\n\tvalue?: string\n\tverticalAlignment?: TextVerticalAlignment\n\tvisible?: boolean\n\twithExternalLayout?: boolean\n}\n\n/** @internal @deprecated */\nconst DeprecatedRichTextInner = /* @__PURE__ */ React.forwardRef<HTMLDivElement, Partial<DeprecatedRichTextProps>>(\n\tfunction Text(props: Partial<DeprecatedRichTextProps>, forwardedRef: React.RefObject<HTMLDivElement> | null) {\n\t\tconst {\n\t\t\tid,\n\t\t\tname,\n\t\t\thtml,\n\t\t\thtmlFromDesign,\n\t\t\ttext,\n\t\t\ttextFromDesign,\n\t\t\tfonts = [],\n\t\t\twidth,\n\t\t\theight,\n\t\t\tleft,\n\t\t\tright,\n\t\t\ttop,\n\t\t\tbottom,\n\t\t\tcenter,\n\t\t\tclassName,\n\t\t\tstylesPresetsClassName,\n\t\t\tvisible = true,\n\t\t\topacity,\n\t\t\trotation = 0,\n\t\t\tverticalAlignment = \"top\",\n\t\t\tisEditable = false,\n\t\t\tenvironment = RenderTarget.current,\n\t\t\twithExternalLayout = false,\n\t\t\tpositionSticky,\n\t\t\tpositionStickyTop,\n\t\t\tpositionStickyRight,\n\t\t\tpositionStickyBottom,\n\t\t\tpositionStickyLeft,\n\t\t\t__htmlStructure,\n\t\t\t__fromCanvasComponent = false,\n\t\t\t_forwardedOverrideId,\n\t\t\t_forwardedOverrides,\n\t\t\t_usesDOMRect,\n\t\t\tchildren: _children,\n\t\t\t...rest\n\t\t} = props\n\n\t\tconst parentSize = useParentSize()\n\t\tconst layoutId = useLayoutId(props)\n\n\t\tconst fallbackLayoutRef = useRef<HTMLDivElement>(null)\n\t\tconst layoutRef = forwardedRef ?? fallbackLayoutRef\n\n\t\tconst { navigate, getRoute } = useRouter()\n\t\tconst currentRoute = useCurrentRoute()\n\n\t\tuseRoutePreloader(props.preload ?? [])\n\t\tuseMeasureLayout(props, layoutRef)\n\n\t\tconst inCodeComponent = React.useContext(ComponentContainerContext)\n\t\tconst isOnCanvas = useIsOnFramerCanvas()\n\n\t\t// Replace HTML with text override or variable\n\t\tlet textOrOverride = text\n\t\tconst forwardedOverrideId = _forwardedOverrideId ?? id\n\t\tif (forwardedOverrideId && _forwardedOverrides) {\n\t\t\tconst override = _forwardedOverrides[forwardedOverrideId]\n\t\t\tif (typeof override === \"string\") {\n\t\t\t\ttextOrOverride = override\n\t\t\t}\n\t\t}\n\n\t\t// The __htmlStructure placeholder is inserted in:\n\t\t// - collectVariantDefinitionForNode.ts\n\t\t// - RichTextNode.getProps\n\t\t// - RichTextNode.getAttributes\n\t\tlet innerHTML = \"\"\n\n\t\tif (textOrOverride) {\n\t\t\tconst escapedText = escapeHTML(textOrOverride)\n\t\t\tinnerHTML = __htmlStructure\n\t\t\t\t? __htmlStructure.replace(deprecatedRichTextPlaceholder, escapedText)\n\t\t\t\t: `<p>${escapedText}</p>`\n\t\t} else if (html) {\n\t\t\tinnerHTML = html\n\t\t} else if (textFromDesign) {\n\t\t\tconst escapedText = escapeHTML(textFromDesign)\n\t\t\tinnerHTML = __htmlStructure\n\t\t\t\t? __htmlStructure.replace(deprecatedRichTextPlaceholder, escapedText)\n\t\t\t\t: `<p>${escapedText}</p>`\n\t\t} else if (htmlFromDesign) {\n\t\t\tinnerHTML = htmlFromDesign\n\t\t}\n\n\t\t// Parse the ProseMirror HTML to replace framer page links in the `data:framer/page-link,`\n\t\t// format with the correct paths their target corresponds to.\n\t\t// This needs to happen whenever the HTML string changes, since smart\n\t\t// components can update the ProseMirror HTML in variants by updating this prop value.\n\t\tconst implicitPathVariables = useImplicitPathVariables()\n\t\tconst innerHTMLWithReplacedFramerPageLinks = React.useMemo(() => {\n\t\t\tif (isOnCanvas || !getRoute || !currentRoute) return innerHTML\n\n\t\t\treturn replaceFramerPageLinks(innerHTML, getRoute, currentRoute, implicitPathVariables)\n\t\t}, [innerHTML, getRoute, currentRoute, implicitPathVariables])\n\n\t\t// biome-ignore lint/correctness/useExhaustiveDependencies: deprecated component\n\t\tReact.useEffect(() => {\n\t\t\tconst container = layoutRef.current\n\t\t\tif (container === null) return\n\n\t\t\tfunction interceptPageLinks(event: MouseEvent) {\n\t\t\t\tconst anchorElement = findAnchorElement(event.target, layoutRef.current)\n\t\t\t\t// Don't prevent cmd + click, allowing users to open in new tab.\n\t\t\t\tif (\n\t\t\t\t\tisCommandKeyPressed(event) ||\n\t\t\t\t\t!navigate ||\n\t\t\t\t\t!anchorElement ||\n\t\t\t\t\tanchorElement.getAttribute(\"target\") === AnchorLinkTarget._blank\n\t\t\t\t) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Page links written to the ProseMirror HTML in the `data:framer/page-link,`\n\t\t\t\t// format should have been parsed, and replaced with the correct paths.\n\t\t\t\t// If that has happened, we can access the route id and transition properties\n\t\t\t\t// as data attributes, finally performing a navigation.\n\t\t\t\tconst didNavigate = navigateFromAttributes(navigate, anchorElement, implicitPathVariables)\n\t\t\t\tif (didNavigate) {\n\t\t\t\t\tevent.preventDefault()\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If this is ever changed, please also update the test in the router\n\t\t\t// https://github.com/framer/FramerStudio/blob/d02564051eeb43e6a737f3301439d8efbc4167aa/src/router/src/Router.test.tsx#L89\n\t\t\tcontainer.addEventListener(\"click\", interceptPageLinks)\n\n\t\t\treturn () => {\n\t\t\t\tcontainer.removeEventListener(\"click\", interceptPageLinks)\n\t\t\t}\n\t\t}, [navigate, implicitPathVariables])\n\n\t\tuseLoadFonts(fonts, __fromCanvasComponent, layoutRef)\n\n\t\t// Hooks need to be above this line\n\t\tif (!visible) return null\n\n\t\tconst isHidden = isEditable && environment() === RenderTarget.canvas\n\n\t\tconst style: React.CSSProperties = {\n\t\t\toutline: \"none\",\n\t\t\tdisplay: \"flex\",\n\t\t\tflexDirection: \"column\",\n\t\t\tjustifyContent: convertVerticalAlignment(verticalAlignment),\n\t\t\topacity: isHidden ? 0 : opacity,\n\t\t\tflexShrink: 0,\n\t\t}\n\n\t\tconst restrictedRenderTarget = RenderTarget.hasRestrictions()\n\t\tconst frame = calculateRect(props, parentSize || ParentSizeState.Unknown, false)\n\t\tconst isAutoSized = _usesDOMRect && (width === \"auto\" || height === \"auto\")\n\t\tconst hasTransformTemplate =\n\t\t\t!!props.transformTemplate || !frame || !restrictedRenderTarget || __fromCanvasComponent || isAutoSized\n\t\tconst template = hasTransformTemplate ? (props.transformTemplate ?? transformTemplate(center)) : undefined\n\n\t\tif (!withExternalLayout) {\n\t\t\tif (frame && restrictedRenderTarget && !isAutoSized) {\n\t\t\t\tconst rotate = Animatable.getNumber(rotation).toFixed(4)\n\n\t\t\t\tstyle.transform = `translate(${frame.x}px, ${frame.y}px) rotate(${rotate}deg)`\n\t\t\t\tstyle.width = frame.width\n\t\t\t\tstyle.minWidth = frame.width\n\t\t\t\tstyle.height = frame.height\n\t\t\t} else {\n\t\t\t\tstyle.left = left\n\t\t\t\tstyle.right = right\n\t\t\t\tstyle.top = top\n\t\t\t\tstyle.bottom = bottom\n\t\t\t\tstyle.width = width\n\t\t\t\tstyle.height = height\n\t\t\t\t// I have no idea why this works as a number but not as a string. This is copied from the Text component.\n\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: deprecated component\n\t\t\t\tstyle.rotate = rotation as any\n\t\t\t}\n\n\t\t\tif (positionSticky) {\n\t\t\t\tif (!isOnCanvas || inCodeComponent) {\n\t\t\t\t\tstyle.position = \"sticky\"\n\t\t\t\t\tstyle.willChange = \"transform\"\n\t\t\t\t\tstyle.top = positionStickyTop\n\t\t\t\t\tstyle.right = positionStickyRight\n\t\t\t\t\tstyle.bottom = positionStickyBottom\n\t\t\t\t\tstyle.left = positionStickyLeft\n\t\t\t\t}\n\t\t\t} else if (isOnCanvas && (props.positionFixed || props.positionAbsolute)) {\n\t\t\t\tstyle.position = \"absolute\"\n\t\t\t}\n\t\t}\n\n\t\tcollectFiltersFromProps(props, style)\n\t\tcollectTextShadowsForProps(props, style)\n\n\t\tObject.assign(style, props.style)\n\n\t\treturn (\n\t\t\t<motion.div\n\t\t\t\tid={id}\n\t\t\t\tref={layoutRef}\n\t\t\t\t{...rest}\n\t\t\t\tstyle={style}\n\t\t\t\tlayoutId={layoutId}\n\t\t\t\tdata-framer-name={name}\n\t\t\t\tdata-framer-component-type=\"DeprecatedRichText\"\n\t\t\t\tdata-center={center}\n\t\t\t\tclassName={cx(className, stylesPresetsClassName, richTextWrapperClassName)}\n\t\t\t\ttransformTemplate={template}\n\t\t\t\t// biome-ignore lint/security/noDangerouslySetInnerHtml: intentional\n\t\t\t\tdangerouslySetInnerHTML={{ __html: innerHTMLWithReplacedFramerPageLinks }}\n\t\t\t/>\n\t\t)\n\t},\n)\n\nexport const DeprecatedRichText = /* @__PURE__ */ withLibraryCSS(DeprecatedRichTextInner)\n\nexport function convertVerticalAlignment(\n\tverticalAlignment: TextVerticalAlignment,\n): \"center\" | \"flex-start\" | \"flex-end\" {\n\tswitch (verticalAlignment) {\n\t\tcase \"top\":\n\t\t\treturn \"flex-start\"\n\t\tcase \"center\":\n\t\t\treturn \"center\"\n\t\tcase \"bottom\":\n\t\t\treturn \"flex-end\"\n\t}\n}\n\nexport function useLoadFonts(\n\tfonts: string[],\n\tfromCanvasComponent: boolean,\n\tcontainerRef: React.RefObject<HTMLElement | SVGElement>,\n) {\n\t// The fonts array is typically regenerated for every change to a text node,\n\t// so we need to keep track of previous values to avoid calls to the font\n\t// store when the contents of the array are the same between renders\n\tconst prevFontsRef = useRef<string[]>([])\n\n\tif (!isShallowEqualArray(prevFontsRef.current, fonts)) {\n\t\tprevFontsRef.current = fonts\n\n\t\tvoid fontStore.loadFonts(fonts).then(({ newlyLoadedFontCount }) => {\n\t\t\t// After fonts load, layout is likely to shift in auto-sized\n\t\t\t// elements. Since measurements would have typically already been\n\t\t\t// taken at this point, this can lead to selection outlines\n\t\t\t// appearing out of sync with the rendered component. On the canvas\n\t\t\t// we hook into the font loading process and manually trigger a\n\t\t\t// re-render for the node when it completes, which in turn makes\n\t\t\t// sure that all layout measurements take the latest layout shifts\n\t\t\t// into account. In compiled smart components, however, we can't use\n\t\t\t// the same solution. We'll instead check if new fonts have been\n\t\t\t// loaded, and attempt to add a measure request for the closest\n\t\t\t// component container, which in the case of component instances is\n\t\t\t// the only node whose measurements need updating (we don't track\n\t\t\t// measurements for things rendered inside the component itself,\n\t\t\t// which could also be affected by layout shifts).\n\n\t\t\t// If we're not running on the canvas and from within a smart\n\t\t\t// component, there's no need to measure.\n\t\t\tif (!fromCanvasComponent || !containerRef.current || RenderTarget.current() !== RenderTarget.canvas) return\n\n\t\t\t// We only need to measure if at least one new font has been loaded.\n\t\t\t// Otherwise we assume there was no layout shift.\n\t\t\tif (newlyLoadedFontCount > 0) {\n\t\t\t\tmeasureClosestComponentContainer(containerRef.current)\n\t\t\t}\n\t\t})\n\t}\n}\n", "import { isFirefox } from \"@framerjs/shared/src/environment.ts\"\nimport { safeWindow } from \"../../utils/safeWindow.ts\"\nimport type { Point } from \"../types/Point.ts\"\nimport { Rect } from \"../types/Rect.ts\"\n\nexport const ready = (callback: VoidFunction) => {\n\tif (document.readyState === \"loading\") {\n\t\tdocument.addEventListener(\"DOMContentLoaded\", () => setTimeout(callback))\n\t\treturn\n\t}\n\n\tcallback()\n}\n\n/** @internal */\nexport const frameFromElement = (element: Element): Rect => {\n\tconst frame = Rect.fromRect(element.getBoundingClientRect())\n\tframe.x = frame.x + safeWindow.scrollX\n\tframe.y = frame.y + safeWindow.scrollY\n\treturn frame\n}\n\n/** @internal */\nexport const frameFromElements = (elements: Element[]): Rect => {\n\treturn Rect.merge(...elements.map(frameFromElement))\n}\n\n/** Returns a page frame for the given element */\nexport const convertToPageFrame = (frame: Rect, element: Element): Rect => {\n\tconst point = convertToPagePoint(frame, element)\n\treturn {\n\t\tx: point.x,\n\t\ty: point.y,\n\t\twidth: frame.width,\n\t\theight: frame.height,\n\t}\n}\n\n/** Returns a parent frame for the given element */\nexport const convertFromPageFrame = (frame: Rect, element: Element): Rect => {\n\tconst point = convertFromPagePoint(frame, element)\n\treturn {\n\t\tx: point.x,\n\t\ty: point.y,\n\t\twidth: frame.width,\n\t\theight: frame.height,\n\t}\n}\n\nexport const getPageFrame = (element: Element): Rect => {\n\tconst rect = element.getBoundingClientRect()\n\treturn {\n\t\tx: rect.left + safeWindow.scrollX,\n\t\ty: rect.top + safeWindow.scrollY,\n\t\twidth: rect.width,\n\t\theight: rect.height,\n\t}\n}\n\nexport const fromEventForPage = (event: MouseEvent): Point => {\n\treturn {\n\t\tx: event.pageX,\n\t\ty: event.pageY,\n\t}\n}\n\nexport const fromEventForClient = (event: MouseEvent): Point => {\n\treturn {\n\t\tx: event.clientX,\n\t\ty: event.clientY,\n\t}\n}\n\nexport const convertToPagePoint = (point: Point, element: Element): Point => {\n\tconst frame = getPageFrame(element)\n\treturn {\n\t\tx: point.x + frame.x,\n\t\ty: point.y + frame.y,\n\t}\n}\n\nexport const convertFromPagePoint = (point: Point, element: Element): Point => {\n\tconst frame = getPageFrame(element)\n\treturn {\n\t\tx: point.x - frame.x,\n\t\ty: point.y - frame.y,\n\t}\n}\n\n/** @internal */\nexport const dispatchKeyDownEvent = (keyCode: number, options: Partial<KeyboardEventInit> = {}) => {\n\tconst keyboardEvent = new KeyboardEvent(\"keydown\", {\n\t\tbubbles: true,\n\t\tkeyCode,\n\t\t...options,\n\t} as KeyboardEventInit)\n\tconst activeElement = document.activeElement\n\tif (activeElement) {\n\t\tactiveElement.dispatchEvent(keyboardEvent)\n\t}\n}\n\n/** @internal */\nexport const DOM = {\n\tframeFromElement,\n\tframeFromElements,\n\tconvertToPageFrame,\n\tconvertFromPageFrame,\n\tgetPageFrame,\n\tfromEventForPage,\n\tfromEventForClient,\n\tconvertToPagePoint,\n\tconvertFromPagePoint,\n}\n\nlet parser: DOMParser\n// https://caniuse.com/mdn-api_document_parsehtmlunsafe_static\nconst supportsNativeParseHTML = /* #__PURE__ */ (() =>\n\t// Firefox has rare-random issues with the native parser: https://framer-team.slack.com/archives/C01B14R6E22/p1724159313153969\n\t!isFirefox() && typeof Document !== \"undefined\" && typeof Document.parseHTMLUnsafe === \"function\")()\n\n/**\n * @important Can cause XSS vulnerabilities if the returned document is appended to the current DOM.\n */\nexport function domParser(html: string, type?: DOMParserSupportedType): Document {\n\tif (supportsNativeParseHTML && !type) return Document.parseHTMLUnsafe(html)\n\n\tparser ??= new DOMParser()\n\treturn parser.parseFromString(html, type ?? \"text/html\")\n}\n\nexport function escapeHTML(value: string): string {\n\treturn value\n\t\t.replaceAll(\"&\", \"&amp;\")\n\t\t.replaceAll(\"<\", \"&lt;\")\n\t\t.replaceAll(\">\", \"&gt;\")\n\t\t.replaceAll('\"', \"&quot;\")\n\t\t.replaceAll(\"'\", \"&#39;\")\n}\n\n// inspired by https://github.com/SukkaW/fast-escape-html/blob/master/src/unescape.ts\nconst htmlUnescapeEntitiesRegExp = /&(?:[gl]t|quot|#39|amp|#6[02]|#34|apos|#38);/gu\nconst htmlUnescapeReplacers = {\n\t\"&lt;\": \"<\",\n\t\"&gt;\": \">\",\n\t\"&quot;\": '\"',\n\t\"&#39;\": \"'\",\n\t\"&amp;\": \"&\",\n\t\"&#60;\": \"<\",\n\t\"&#62;\": \">\",\n\t\"&#34;\": '\"',\n\t\"&apos;\": \"'\",\n\t\"&#38;\": \"&\",\n}\n\nexport function unescapeHTML(value: string): string {\n\treturn value.replace(\n\t\thtmlUnescapeEntitiesRegExp,\n\t\tmatch => htmlUnescapeReplacers[match as keyof typeof htmlUnescapeReplacers],\n\t)\n}\n", "import { escapeHTML } from \"../render/utils/dom.ts\"\nimport { computeRelativePath } from \"../router/computeRelativePath.ts\"\nimport { isRoute } from \"../router/isRoute.ts\"\nimport type { ActiveRoute, Route, RouteId } from \"../router/types.ts\"\nimport { getRouteElementId } from \"../router/utils.ts\"\nimport { isString } from \"../utils/utils.ts\"\nimport { linkFromFramerPageLink } from \"./Link/linkFromFramerPageLink.tsx\"\nimport { linkMatchesRoute } from \"./Link/linkMatchesRoute.tsx\"\nimport { pathVariablesRegExp } from \"./Link/pathVariables.tsx\"\nimport { PageLinkAttribute, parseFramerPageLink } from \"./framerPageLink.ts\"\n\n/** A regex that searches for html tags, and href values. */\nconst regex =\n\t/(<([a-z]+)(?:\\s+(?!href[\\s=])[^=\\s]+=(?:'[^']*'|\"[^\"]*\"))*)(?:(\\s+href\\s*=)(?:'([^']*)'|\"([^\"]*)\"))?((?:\\s+[^=\\s]+=(?:'[^']*'|\"[^\"]*\"))*>)/gi\n\n/**\n * @internal @deprecated\n */\nexport function replaceFramerPageLinks(\n\trawHTML: string,\n\tgetRoute: (routeId: RouteId) => Route | undefined,\n\tcurrentRoute: ActiveRoute,\n\timplicitPathVariables?: Record<string, unknown>,\n): string {\n\treturn rawHTML.replace(\n\t\tregex,\n\t\t(original, pre1: string, tag: string, pre2: string, value1: string, value2: string, post: string) => {\n\t\t\tif (tag.toLowerCase() !== \"a\") return original\n\n\t\t\tconst href = value1 || value2\n\t\t\tconst pageLink = parseFramerPageLink(href.replace(/&amp;/gu, \"&\"))\n\t\t\tif (!pageLink || !pageLink.target) return original\n\n\t\t\tconst targetRoute = getRoute(pageLink.target)\n\t\t\tif (!isRoute(targetRoute) || !isRoute(currentRoute)) return original\n\n\t\t\tconst targetPath = targetRoute.path\n\t\t\tconst currentPath = currentRoute.path\n\t\t\tif (!targetPath || !currentPath) return original\n\n\t\t\tlet attributes = ` ${PageLinkAttribute.Page}=\"${pageLink.target}\"`\n\n\t\t\tconst elementId = getRouteElementId(targetRoute, pageLink.element ?? undefined)\n\t\t\tif (elementId) {\n\t\t\t\tattributes += ` ${PageLinkAttribute.Element}=\"${pageLink.element}\"`\n\t\t\t}\n\n\t\t\tconst link = linkFromFramerPageLink(href)\n\t\t\tif (!link || isString(link)) return original\n\t\t\tif (linkMatchesRoute(currentRoute, link, implicitPathVariables)) {\n\t\t\t\tattributes += ` ${PageLinkAttribute.Current}`\n\t\t\t}\n\n\t\t\tlet relativePath = targetPath\n\t\t\tconst pathVariables = Object.assign({}, implicitPathVariables, pageLink.collectionItem?.pathVariables)\n\t\t\tif (Object.keys(pathVariables).length > 0) {\n\t\t\t\trelativePath = relativePath.replace(pathVariablesRegExp, (_, key) => \"\" + pathVariables[key])\n\t\t\t}\n\t\t\tif (pageLink.collectionItem?.pathVariables) {\n\t\t\t\t// Since implicit path variables will be provided when\n\t\t\t\t// navigating this link, we don't want to use the merged path\n\t\t\t\t// variables.\n\t\t\t\tconst params = new URLSearchParams(pageLink.collectionItem.pathVariables)\n\t\t\t\tattributes += ` ${PageLinkAttribute.PathVariables}=\"${params}\"`\n\t\t\t}\n\t\t\t// TODO: For complete correctness, currentPath should also have its path variables filled in.\n\t\t\trelativePath = computeRelativePath(currentPath, relativePath)\n\t\t\treturn pre1 + pre2 + `\"${escapeHTML(relativePath + (elementId ? `#${elementId}` : \"\"))}\"` + attributes + post\n\t\t},\n\t)\n}\n", "/** @internal */\nexport function isShallowEqualArray(a: any[], b: any[]) {\n\treturn a.length === b.length && a.every((v, i) => v === b[i])\n}\n", "import type { Spring, Tween } from \"framer-motion\"\nimport { animate, frame, inView, stagger, useReducedMotionConfig } from \"framer-motion\"\nimport * as React from \"react\"\nimport { useConstant } from \"../../components/utils/useConstant.ts\"\nimport { assertNever } from \"../../utils/assert.ts\"\nimport { isNumber, isUndefined } from \"../../utils/utils.ts\"\nimport type { OverrideableRef } from \"../utils/patchAndWaitForChild.ts\"\nimport { newOverrideableRef, patchAndWaitForChild } from \"../utils/patchAndWaitForChild.ts\"\ntype Transition = Omit<Spring | Tween, \"from\"> & { delay: number }\nimport { isStaticRenderer } from \"../../modules/useIsStaticRenderer.ts\"\n\nconst defaultValues = {\n\topacity: 1,\n\ty: 0,\n\tx: 0,\n\tscale: 1,\n\trotate: 0,\n\trotateX: 0,\n\trotateY: 0,\n\tskewX: 0,\n\tskewY: 0,\n\tfilter: \"none\",\n} as const\n\nfunction isEffectKey(key: string): key is keyof typeof defaultValues {\n\treturn key in defaultValues\n}\n\nfunction createKeyframes(\n\teffect: Partial<Effect>,\n\tshouldReduceMotion: boolean | null,\n): Record<string, [number | string, number | string]> {\n\tconst out: Record<string, [number | string, number | string]> = {}\n\tfor (const key in effect) {\n\t\tif (!isEffectKey(key)) continue\n\t\tconst effectValue = effect[key]\n\t\tconst defaultValue = defaultValues[key]\n\t\tif (isUndefined(effectValue) || isUndefined(defaultValue)) continue\n\t\tif (shouldReduceMotion && key !== \"opacity\") continue\n\t\tout[key] = [effectValue, defaultValue]\n\t}\n\treturn out\n}\n\ninterface Effect {\n\tfilter: string\n\topacity: number\n\trotate: number\n\trotateX: number\n\trotateY: number\n\tscale: number\n\tskewX: number\n\tskewY: number\n\tx: number\n\ty: number\n}\n\ntype Tokenization = \"character\" | \"word\" | \"line\" | \"element\"\n\ninterface Shared {\n\trepeat?: boolean\n\ttrigger: \"onMount\" | \"onInView\" | \"onScrollTarget\"\n\tthreshold?: number\n\ttarget?: { ref: React.MutableRefObject<HTMLElement | null> | undefined; offset?: number }\n}\n\n/** @internal */\nexport type TextEffect = Shared & {\n\ttype: \"appear\"\n\teffect: Partial<Effect>\n\ttransition?: Transition\n\trepeat?: boolean\n\ttokenization?: Tokenization\n\tstartDelay?: number\n}\n\nconst emojiSplitRe = /* @__PURE__ */ (() => {\n\t// eslint-disable-next-line redos-detector/no-unsafe-regex\n\treturn /\\p{Regional_Indicator}{2}|\\p{Emoji}\\p{Emoji_Modifier}?\\p{Variation_Selector}?(?:\\u{200d}\\p{Emoji}\\p{Emoji_Modifier}?\\p{Variation_Selector}?)*|./gu\n})()\n\nfunction tokenizeText(\n\ttext: string,\n\ttokenization: Tokenization = \"character\",\n\telements: Set<OverrideableRef<HTMLSpanElement>>,\n\tshouldReduceMotion: boolean | null,\n\tstyle?: React.CSSProperties,\n) {\n\t// Disable letter-by-letter animations but still respect delay\n\tif (shouldReduceMotion) {\n\t\tconst ref = newOverrideableRef<HTMLSpanElement>()\n\t\telements.add(ref)\n\t\treturn (\n\t\t\t<span ref={ref} style={style}>\n\t\t\t\t{text}\n\t\t\t</span>\n\t\t)\n\t}\n\n\tswitch (tokenization) {\n\t\tcase \"character\":\n\t\t// When we want to animate \"lines\" that aren't split by newlines, but\n\t\t// instead by wrapping, we have to split the text into characters, and\n\t\t// then measure the top offset of each character, creating groups of\n\t\t// characters every time the top offset changes\n\t\t// eslint-disable-next-line no-fallthrough\n\t\tcase \"line\": {\n\t\t\t// To ensure that text-wrap: balance works, we split into words,\n\t\t\t// then into characters.\n\t\t\tconst words = text.split(\" \")\n\t\t\tconst lastWordIndex = words.length - 1\n\t\t\treturn words.map((word, wordIndex) => {\n\t\t\t\tconst isLastWord = wordIndex === lastWordIndex\n\t\t\t\t// Generally we don't want words to wrap. But if they are long\n\t\t\t\t// and more likely to, we allow it. This is a compromise to try\n\t\t\t\t// to get the best of both worlds.\n\t\t\t\tconst short = word.length <= 12\n\t\t\t\treturn (\n\t\t\t\t\t<React.Fragment key={word + wordIndex + isLastWord}>\n\t\t\t\t\t\t<span style={{ whiteSpace: short ? \"nowrap\" : \"unset\" }}>\n\t\t\t\t\t\t\t{word.match(emojiSplitRe)?.map((char, i) => {\n\t\t\t\t\t\t\t\t// we must use our own ref here, as React prevents us from overriding `current` in React < 19\n\t\t\t\t\t\t\t\tconst ref = newOverrideableRef<HTMLSpanElement>()\n\t\t\t\t\t\t\t\telements.add(ref)\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t// biome-ignore lint/suspicious/noArrayIndexKey: We are combining index with char.\n\t\t\t\t\t\t\t\t\t<span key={char + i} ref={ref} style={style}>\n\t\t\t\t\t\t\t\t\t\t{char}\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t{isLastWord ? null : \" \"}\n\t\t\t\t\t</React.Fragment>\n\t\t\t\t)\n\t\t\t})\n\t\t}\n\t\tcase \"word\": {\n\t\t\tconst words = text.split(\" \")\n\t\t\tconst lastWordIndex = words.length - 1\n\t\t\treturn words.map((char, i) => {\n\t\t\t\tconst isLastWord = i === lastWordIndex\n\n\t\t\t\t// we must use our own ref here, as React prevents us from overriding `current` in React < 19\n\t\t\t\tconst ref = newOverrideableRef<HTMLSpanElement>()\n\t\t\t\telements.add(ref)\n\t\t\t\treturn (\n\t\t\t\t\t<React.Fragment key={char + i + isLastWord}>\n\t\t\t\t\t\t<span ref={ref} style={style}>\n\t\t\t\t\t\t\t{char}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t{isLastWord ? null : \" \"}\n\t\t\t\t\t</React.Fragment>\n\t\t\t\t)\n\t\t\t})\n\t\t}\n\t\t// Per: Element doesn't require text to be split.\n\t\tcase \"element\":\n\t\tdefault:\n\t\t\treturn text\n\t}\n}\n\nfunction tokenizationForEffect(effect: TextEffect): Tokenization | undefined {\n\tconst type = effect.type\n\tswitch (type) {\n\t\tcase \"appear\":\n\t\t\treturn effect.tokenization ?? \"character\"\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n\nfunction transformString(effect: Partial<Effect>): string {\n\tconst transforms: string[] = []\n\tif (isNumber(effect.x)) transforms.push(`translateX(${effect.x}px)`)\n\tif (isNumber(effect.y)) transforms.push(`translateY(${effect.y}px)`)\n\tif (isNumber(effect.scale)) transforms.push(`scale(${effect.scale})`)\n\tif (isNumber(effect.rotate)) transforms.push(`rotate(${effect.rotate}deg)`)\n\tif (isNumber(effect.rotateX)) transforms.push(`rotateX(${effect.rotateX}deg)`)\n\tif (isNumber(effect.rotateY)) transforms.push(`rotateY(${effect.rotateY}deg)`)\n\tif (isNumber(effect.skewX)) transforms.push(`skewX(${effect.skewX}deg)`)\n\tif (isNumber(effect.skewY)) transforms.push(`skewY(${effect.skewY}deg)`)\n\treturn transforms.join(\" \")\n}\n\nfunction getInitialEffectStyle(\n\tcanPlay: boolean,\n\tcanAnimate: boolean,\n\teffect: TextEffect | undefined,\n\tshouldReduceMotion: boolean | null,\n) {\n\tif (!effect || !effect.effect) return undefined\n\n\tconst type = effect.type\n\tswitch (type) {\n\t\tcase \"appear\":\n\t\t\tswitch (effect.tokenization) {\n\t\t\t\tcase \"element\":\n\t\t\t\t\tif (!canPlay || !canAnimate) return undefined\n\t\t\t\t\treturn {\n\t\t\t\t\t\topacity: effect.effect.opacity,\n\t\t\t\t\t\tfilter: shouldReduceMotion ? undefined : effect.effect.filter,\n\t\t\t\t\t\ttransform: shouldReduceMotion ? undefined : transformString(effect.effect),\n\t\t\t\t\t}\n\t\t\t\tcase \"line\":\n\t\t\t\tcase \"word\":\n\t\t\t\tcase \"character\":\n\t\t\t\tdefault:\n\t\t\t\t\t// Elements must always have inline-block so that they are\n\t\t\t\t\t// layed out identically on the canvas and preview. It's\n\t\t\t\t\t// required in the preview to apply transforms.\n\t\t\t\t\tif (!canPlay || !canAnimate) return { display: \"inline-block\" }\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdisplay: \"inline-block\",\n\t\t\t\t\t\topacity: effect.effect.opacity,\n\t\t\t\t\t\tfilter: shouldReduceMotion ? undefined : effect.effect.filter,\n\t\t\t\t\t\ttransform: shouldReduceMotion ? undefined : transformString(effect.effect),\n\t\t\t\t\t}\n\t\t\t}\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n\nexport interface TextEffectTokenizer {\n\ttext: (text: string) => string | JSX.Element | JSX.Element[]\n\tprops: <T extends HTMLElement = HTMLSpanElement>(\n\t\tstyle?: React.CSSProperties,\n\t) => { ref: React.Ref<T>; style: React.CSSProperties } | undefined\n}\n\n/** @internal */\nexport function useTextEffect(\n\tconfig: TextEffect | undefined,\n\tref?: React.RefObject<HTMLSpanElement | SVGSVGElement>,\n\tpreview?: boolean,\n) {\n\tconst elements = useConstant<Set<OverrideableRef<HTMLSpanElement>>>(() => new Set())\n\tconst isRenderingStaticContent = isStaticRenderer()\n\tconst canPlay = preview || !isRenderingStaticContent\n\tconst shouldReduceMotion = useReducedMotionConfig()\n\n\tconst state = React.useRef<{\n\t\thasMounted: boolean\n\t\thasAnimatedOnce: boolean\n\t\tisAnimating: boolean\n\t\teffect?: TextEffect\n\t}>({\n\t\thasMounted: false,\n\t\thasAnimatedOnce: false,\n\t\tisAnimating: false,\n\t\teffect: config,\n\t})\n\n\t// To ensure that we always access the latest effect without breaking the\n\t// memo, copy the current effect config into a ref.\n\tstate.current.effect = config\n\n\t// Rerun the effect if any of the props that require inView to be cleaned\n\t// up.\n\tconst trigger = config?.trigger ?? \"onMount\"\n\tconst target = config?.target\n\tconst threshold = config?.threshold\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: It depends on elements which is used inside the play function.\n\tReact.useEffect(() => {\n\t\tif (!canPlay || preview) return\n\n\t\tstate.current.hasMounted = true\n\n\t\tfunction play() {\n\t\t\tconst { effect } = state.current\n\t\t\tif (!canPlay || !effect) return\n\n\t\t\tif (effect?.repeat !== true && state.current.hasAnimatedOnce) return\n\t\t\tif (effect?.type === \"appear\" && state.current.isAnimating) return\n\n\t\t\tObject.assign(state.current, {\n\t\t\t\thasAnimatedOnce: true,\n\t\t\t\tisAnimating: true,\n\t\t\t})\n\n\t\t\tconst type = effect.type\n\t\t\tswitch (type) {\n\t\t\t\tcase \"appear\": {\n\t\t\t\t\tconst { transition, startDelay, repeat, tokenization } = effect\n\t\t\t\t\tconst cleanupRef: { current?: () => void } = { current: undefined }\n\t\t\t\t\tvoid runAppearEffect(\n\t\t\t\t\t\ttokenization,\n\t\t\t\t\t\teffect.effect,\n\t\t\t\t\t\telements,\n\t\t\t\t\t\ttransition,\n\t\t\t\t\t\tstartDelay,\n\t\t\t\t\t\trepeat,\n\t\t\t\t\t\tshouldReduceMotion,\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\tObject.assign(state.current, { isAnimating: false })\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcleanupRef,\n\t\t\t\t\t)\n\t\t\t\t\treturn () => cleanupRef.current?.()\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(type)\n\t\t\t}\n\t\t}\n\n\t\tswitch (trigger) {\n\t\t\tcase \"onMount\":\n\t\t\t\tplay()\n\t\t\t\treturn\n\t\t\tcase \"onInView\": {\n\t\t\t\tconst element = ref?.current\n\t\t\t\tif (!element) return\n\t\t\t\treturn inView(element, play, { amount: threshold ?? 0 })\n\t\t\t}\n\t\t\tcase \"onScrollTarget\": {\n\t\t\t\tconst element = target?.ref?.current\n\t\t\t\tif (!element) return\n\t\t\t\treturn inView(element, play, {\n\t\t\t\t\tamount: threshold ?? 0,\n\t\t\t\t\troot: document,\n\t\t\t\t\tmargin: target?.offset ? `${target.offset}px 0px 0px 0px` : undefined,\n\t\t\t\t})\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tassertNever(trigger)\n\t\t}\n\t}, [canPlay, elements, preview, ref, target, threshold, trigger])\n\n\tconst effectEnabled = !!config\n\tconst tokenization = config ? tokenizationForEffect(config) : undefined\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: It depends on elements which is used inside the getTokenizer and play functions.\n\treturn React.useMemo(\n\t\t() => ({\n\t\t\t// The tokenizer is memoized such that it won't trigger RichText to\n\t\t\t// be rerendered if the effect changes in a way that doesn't effect\n\t\t\t// the tokenization.\n\t\t\tgetTokenizer: (): TextEffectTokenizer | undefined => {\n\t\t\t\telements.clear()\n\n\t\t\t\t// Don't tokenize text if the effect is not enabled.\n\t\t\t\tif (!effectEnabled) return undefined\n\n\t\t\t\tconst { hasMounted, hasAnimatedOnce, effect } = state.current\n\t\t\t\t// Don't set initial style if the effect won't run at some point\n\t\t\t\t// after tokenizing. We still tokenize the text so that the dom\n\t\t\t\t// doesn't change which can impact kerning.\n\t\t\t\tconst effectStyle = getInitialEffectStyle(\n\t\t\t\t\tcanPlay,\n\t\t\t\t\tpreview || mayAnimate(hasMounted, hasAnimatedOnce, effect),\n\t\t\t\t\tstate.current.effect,\n\t\t\t\t\tshouldReduceMotion,\n\t\t\t\t)\n\n\t\t\t\treturn {\n\t\t\t\t\ttext: (text: string) => tokenizeText(text, tokenization, elements, shouldReduceMotion, effectStyle),\n\t\t\t\t\tprops: <T extends HTMLElement = HTMLSpanElement>(style: React.CSSProperties) => {\n\t\t\t\t\t\tif (effect?.tokenization !== \"element\") return undefined\n\t\t\t\t\t\tconst r = newOverrideableRef<T>()\n\t\t\t\t\t\telements.add(r)\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tref: r,\n\t\t\t\t\t\t\tstyle: { ...style, ...effectStyle },\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t},\n\t\t\tplay: () => {\n\t\t\t\tconst { effect } = state.current\n\t\t\t\tif (!effect) return\n\n\t\t\t\tconst type = effect.type\n\t\t\t\tswitch (type) {\n\t\t\t\t\tcase \"appear\": {\n\t\t\t\t\t\tconst { transition, startDelay } = effect\n\t\t\t\t\t\tvoid runAppearEffect(\n\t\t\t\t\t\t\ttokenization,\n\t\t\t\t\t\t\teffect.effect,\n\t\t\t\t\t\t\telements,\n\t\t\t\t\t\t\ttransition,\n\t\t\t\t\t\t\tstartDelay,\n\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\tshouldReduceMotion,\n\t\t\t\t\t\t)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tassertNever(type)\n\t\t\t\t}\n\t\t\t},\n\t\t}),\n\t\t[canPlay, effectEnabled, elements, preview, tokenization],\n\t)\n}\n\nfunction mayAnimate(hasMounted: boolean, hasAnimatedOnce: boolean, effect: TextEffect | undefined) {\n\treturn !(\n\t\t// If either the component has mounted and the trigger is\n\t\t// onMount, or if the component has run an animation to\n\t\t// completion, the effect is not repeatable, and the trigger\n\t\t// is one that is impacted by repeated effects, we don't\n\t\t// need to set initial style again.\n\t\t(\n\t\t\t(hasMounted && effect?.trigger === \"onMount\") ||\n\t\t\t(hasAnimatedOnce && !effect?.repeat && (effect?.trigger === \"onInView\" || effect?.trigger === \"onScrollTarget\"))\n\t\t)\n\t)\n}\n\nasync function runAppearEffect(\n\ttokenization: Tokenization = \"character\",\n\teffect: Partial<Effect>,\n\telements: Set<OverrideableRef<HTMLSpanElement>>,\n\ttransition: Transition | undefined,\n\tstartDelay: number = 0,\n\trepeat: boolean = false,\n\tshouldReduceMotion: boolean | null,\n\tcallback?: () => void,\n\n\t/**\n\t * The cleanup ref is used to make sure cleanup functions are called when the component unmounts, even if the flow inside this function is async (= promise returning).\n\t */\n\tcleanupRef?: { current?: () => void },\n): Promise<void> {\n\tconst enter = createKeyframes(effect, shouldReduceMotion)\n\t// ensure we're able to clean up the promises / timeouts\n\tconst controller = new AbortController()\n\tif (cleanupRef) cleanupRef.current = () => controller.abort()\n\n\tswitch (tokenization) {\n\t\tcase \"character\":\n\t\tcase \"element\":\n\t\tcase \"word\": {\n\t\t\tconst list = await createElementList(elements, controller)\n\t\t\tif (list === null) return // list is empty or promise has been rejected, so nothing to run anymore\n\n\t\t\tvoid animate(list, enter, {\n\t\t\t\t...transition,\n\t\t\t\trestDelta: 0.001,\n\t\t\t\tdelay: stagger(transition?.delay ?? 0, { startDelay }),\n\t\t\t}).then(() => callback?.())\n\n\t\t\tif (!repeat || !cleanupRef) return\n\n\t\t\t// The groups have already been created, so the cleanup function can now be reassigned from a cleanup function that aborts the promises awaiting refs, to a function that animates out the elements.\n\t\t\tcleanupRef.current = () => {\n\t\t\t\tconst actualEffect = shouldReduceMotion ? { opacity: effect.opacity } : effect\n\t\t\t\tvoid animate(list, actualEffect, {\n\t\t\t\t\t...transition,\n\t\t\t\t\trestDelta: 0.001,\n\t\t\t\t\tdelay: stagger(transition?.delay ?? 0, { startDelay }),\n\t\t\t\t})\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tcase \"line\": {\n\t\t\ttry {\n\t\t\t\t// wait for all children to mount\n\t\t\t\tfor (const element of elements) {\n\t\t\t\t\t// this either resolves when React has mounted the element and attached the ref, or rejects then the component unmounts\n\t\t\t\t\tawait patchAndWaitForChild(element, controller)\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// loop was aborted\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tlet list: HTMLElement[][]\n\t\t\t// Perform the creation of groups in motion's read phase so that the\n\t\t\t// reads are batched with any other reads on the site.\n\t\t\tframe.read(() => {\n\t\t\t\tlist = createLineGroups(elements)\n\t\t\t\tif (list.length === 0) return\n\t\t\t\tframe.update(() => {\n\t\t\t\t\tconst animations = list.map((group, i) => {\n\t\t\t\t\t\treturn animate(group, enter, {\n\t\t\t\t\t\t\t...transition,\n\t\t\t\t\t\t\trestDelta: 0.001,\n\t\t\t\t\t\t\t// Since text tokenized into lines are groups of individual\n\t\t\t\t\t\t\t// characters where each group is animated at once, we can't use\n\t\t\t\t\t\t\t// motion's built in `stagger()` function, and have to manage the\n\t\t\t\t\t\t\t// outer delay ourselves.\n\t\t\t\t\t\t\tdelay: startDelay + i * (transition?.delay ?? 0),\n\t\t\t\t\t\t})\n\t\t\t\t\t})\n\t\t\t\t\tvoid Promise.all(animations).then(() => callback?.())\n\t\t\t\t})\n\t\t\t})\n\n\t\t\tif (!repeat || !cleanupRef) return\n\n\t\t\tcleanupRef.current = () => {\n\t\t\t\tif (list.length === 0) return\n\t\t\t\tconst actualEffect = shouldReduceMotion ? { opacity: effect.opacity } : effect\n\t\t\t\tlist.forEach((group, i) => {\n\t\t\t\t\tvoid animate(group, actualEffect, {\n\t\t\t\t\t\t...transition,\n\t\t\t\t\t\trestDelta: 0.001,\n\t\t\t\t\t\tdelay: startDelay + i * (transition?.delay ?? 0),\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(tokenization)\n\t}\n}\n\nasync function createElementList(\n\telements: Set<OverrideableRef<HTMLSpanElement>>,\n\tcontroller: AbortController,\n): Promise<HTMLElement[] | null> {\n\tif (elements.size === 0) return null\n\n\tconst list: HTMLElement[] = []\n\tfor (const element of elements) {\n\t\ttry {\n\t\t\t// this either resolves when React has mounted the element and attached the ref, or rejects then the component unmounts\n\t\t\tconst node = await patchAndWaitForChild(element, controller)\n\t\t\tif (node) list.push(node)\n\t\t} catch {\n\t\t\t// loop was aborted\n\t\t\treturn null\n\t\t}\n\t}\n\n\treturn list\n}\n\nfunction createLineGroups(elements: Set<OverrideableRef<HTMLSpanElement>>) {\n\tconst groups: HTMLElement[][] = []\n\n\tlet currentGroup: HTMLElement[] = []\n\tlet lastOffset: number | null = null\n\tfor (const element of elements) {\n\t\tif (!element.current) continue\n\n\t\tconst top = element.current.offsetTop\n\t\t// Spaces can have no height, so should just be considered part of the\n\t\t// current group, and since their offset can disturb the line grouping,\n\t\t// we don't consider the top offset of a space span when comparing\n\t\t// offsets.\n\t\tconst height = element.current.offsetHeight\n\t\tif (!height || lastOffset === null || top === lastOffset) {\n\t\t\t// The first element, or an element with the same top as the previous\n\t\t\t// element, is on the same line.\n\t\t\tcurrentGroup.push(element.current)\n\t\t} else {\n\t\t\t// Otherwise we have encountered a new line. We consolidate the\n\t\t\t// previous group, and start a new one.\n\t\t\tgroups.push(currentGroup)\n\t\t\tcurrentGroup = [element.current]\n\t\t}\n\t\tif (height) lastOffset = top\n\t}\n\n\t// Finally consolidate the last group to the list.\n\tgroups.push(currentGroup)\n\n\treturn groups\n}\n", "/**\n * Ref created by `newOverrideableRef` and not `React.createRef`, as React won't allow us to override `current` in React < 19\n */\nexport interface OverrideableRef<T> {\n\tcurrent: T | null\n\t\" tag\": \"OverrideableRef\"\n}\n\nexport function newOverrideableRef<T>(): OverrideableRef<T> {\n\t// FIXME: With React 19, we can use `React.createRef` instead of this\n\treturn { current: null } as OverrideableRef<T>\n}\n\n/**\n * Overrides the ref's `current` property, and resolves the returned promise when the ref is set for the first time.\n * Rejects the returned promise if the controller's signal is aborted, or if the ref unmounts.\n */\nexport async function patchAndWaitForChild(\n\tref: OverrideableRef<HTMLElement>,\n\tcontroller: AbortController,\n): Promise<HTMLElement> {\n\tlet current: HTMLElement | null = ref.current\n\tif (current) return current\n\n\t/**\n\t * The elements in the set are refs of children. If they're wrapped in Suspense, they could mount later than the container.\n\t * Thus, we wait for each ref to be set.\n\t * We do that step by step (awaiting 1 ref at a time) as optimization, as it's likely that all refs mount at once.\n\t */\n\tlet refCallbackResolve: (element: HTMLElement) => void\n\tconst refCallbackPromise = new Promise<HTMLElement>((resolve, reject) => {\n\t\trefCallbackResolve = resolve\n\t\tcontroller.signal.addEventListener(\"abort\", () => reject())\n\t})\n\n\t// we need to listen to the ref setter, so let's override `current` - we can do that, because we don't use React's `useRef` hook for those refs.\n\tObject.defineProperty(ref, \"current\", {\n\t\tget() {\n\t\t\treturn current\n\t\t},\n\t\tset(element) {\n\t\t\tcurrent = element\n\t\t\tif (element === null) {\n\t\t\t\t// React calls with null when the element is unmounted\n\t\t\t\tcontroller.abort()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\trefCallbackResolve(element)\n\t\t},\n\t\tconfigurable: true,\n\t})\n\n\treturn refCallbackPromise\n}\n", "import type { Transition, Variants } from \"framer-motion\"\nimport React, { forwardRef } from \"react\"\nimport { Animatable } from \"../../animation/Animatable/Animatable.ts\"\nimport type { PropsAddedByLink } from \"../../modules/Link/types.ts\"\nimport { safeWindow } from \"../../utils/safeWindow.ts\"\nimport { encodeSVGForCSS } from \"../../utils/utils.ts\"\nimport { useProvidedWindow } from \"../WindowContext.ts\"\nimport type { BackgroundFilterProperties } from \"../traits/BackdropFilters.ts\"\nimport type { Background } from \"../traits/Background.ts\"\nimport type { FilterProperties } from \"../traits/Filters.ts\"\nimport type { WithOpacity } from \"../traits/Opacity.ts\"\nimport { collectOpacityFromProps } from \"../traits/Opacity.ts\"\nimport type { RadiusProperties } from \"../traits/Radius.ts\"\nimport { BackgroundImage } from \"../types/BackgroundImage.ts\"\nimport { Color } from \"../types/Color/Color.ts\"\nimport { LinearGradient } from \"../types/LinearGradient.ts\"\nimport type { NewConstraintProperties, ParentSize } from \"../types/NewConstraints.tsx\"\nimport { ParentSizeState, calculateRect, constraintsEnabled, useParentSize } from \"../types/NewConstraints.tsx\"\nimport { RadialGradient } from \"../types/RadialGradient.ts\"\nimport type { Rect } from \"../types/Rect.ts\"\nimport { RenderEnvironment, RenderTarget } from \"../types/RenderEnvironment.ts\"\nimport type { Shadow } from \"../types/Shadow.ts\"\nimport type { Size } from \"../types/Size.ts\"\nimport {\n\telementPropertiesForLinearGradient,\n\telementPropertiesForRadialGradient,\n} from \"../utils/elementPropertiesForGradient.ts\"\nimport { collectFiltersFromProps } from \"../utils/filtersForNode.ts\"\nimport { htmlElementAsMotionComponent } from \"../utils/htmlElementAsMotionComponent.ts\"\nimport { imagePatternPropsForFill } from \"../utils/imagePatternPropsForFill.tsx\"\nimport { withLibraryCSS } from \"../utils/injectComponentCSSRules.ts\"\nimport { isFiniteNumber } from \"../utils/isFiniteNumber.ts\"\nimport { layoutHintDataPropsForCenter } from \"../utils/layoutHintDataPropsForCenter.ts\"\nimport { countNodeRender } from \"../utils/performanceDebugging.ts\"\nimport { transformTemplate } from \"../utils/transformTemplate.ts\"\nimport { useLayoutId } from \"../utils/useLayoutId.ts\"\nimport { useMeasureLayout } from \"../utils/useMeasureLayout.ts\"\nimport { resetSetStyle } from \"../utils/useWebkitFixes.ts\"\nimport { ImagePatternElement } from \"./ImagePatternElement.tsx\"\nimport type { LayerProps } from \"./Layer.tsx\"\nimport { Layer } from \"./Layer.tsx\"\nimport { sharedSVGManager } from \"./SharedSVGManager.ts\"\n\n/**\n * @internal\n */\nexport interface SVGProps\n\textends\n\t\tPartial<NewConstraintProperties>,\n\t\tPartial<FilterProperties & BackgroundFilterProperties & RadiusProperties & WithOpacity>,\n\t\tPropsAddedByLink {\n\trotation: Animatable<number> | number\n\tvisible: boolean\n\tname?: string\n\tfill?: Animatable<Background> | Background | null\n\tsvg: string\n\tintrinsicWidth?: number\n\tintrinsicHeight?: number\n\tshadows: readonly Shadow[]\n\tparentSize?: ParentSize\n\twithExternalLayout?: boolean\n\tclassName?: string\n\tstyle?: React.CSSProperties\n\tvariants?: Variants\n\ttransition?: Transition\n\t/** If nonzero indicates a managed SVG of fixed size and with unique internal ids. */\n\tsvgContentId?: number\n\n\t// Accessibility\n\ttitle?: string\n\tdescription?: string\n\ttabIndex?: number\n\n\t// Custom html tag support\n\tas?: keyof HTMLElementTagNameMap\n\n\t/**\n\t * If set to true, we can't render the SVG as images, and needs overflow: visible on the SVG.\n\t * This is used for inline shapes (without a user-defined viewBox) which might have centered\n\t * strokes that could get cropped without overflow: visible.\n\t */\n\trequiresOverflowVisible?: boolean\n}\n\n/**\n * @internal\n */\nexport interface SVGProperties extends SVGProps, LayerProps {\n\tlayoutId?: string | undefined\n\t/** @internal */\n\tinnerRef?: React.RefObject<HTMLDivElement>\n\t/** @internal */\n\t// eslint-disable-next-line no-undef\n\tprovidedWindow?: typeof window | null\n}\n\n// Before migrating to functional components we need to get parentSize data from context\n/**\n * @internal\n */\nconst SVGInner = /* @__PURE__ */ forwardRef(function SVG(\n\tprops: Partial<SVGProperties>,\n\tforwardedRef: React.RefObject<HTMLDivElement>,\n): React.ReactElement {\n\tconst parentSize = useParentSize()\n\tconst layoutId = useLayoutId(props)\n\tconst layoutRef = React.useRef<HTMLDivElement>(null)\n\tconst ref = forwardedRef ?? layoutRef\n\tconst providedWindow = useProvidedWindow()\n\n\tuseMeasureLayout(props, layoutRef)\n\n\treturn (\n\t\t<SVGComponent\n\t\t\t{...props}\n\t\t\tinnerRef={ref}\n\t\t\tparentSize={parentSize}\n\t\t\tlayoutId={layoutId}\n\t\t\tprovidedWindow={providedWindow}\n\t\t/>\n\t)\n})\n\nconst MAX_BACKGROUND_SVG_TEXT_LENGTH = 50_000\n\nfunction containsImageReference(svg: string) {\n\treturn svg.indexOf(\"image\") >= 0\n}\n\nfunction containsCustomPropertyReference(svg: string) {\n\treturn svg.indexOf(\"var(--\") >= 0\n}\n\nfunction hasBorderRadius(style: React.CSSProperties): boolean {\n\treturn !!(\n\t\tstyle.borderRadius ||\n\t\tstyle.borderBottomLeftRadius ||\n\t\tstyle.borderBottomRightRadius ||\n\t\tstyle.borderTopLeftRadius ||\n\t\tstyle.borderTopRightRadius\n\t)\n}\n\nfunction sizeSVG(container: React.RefObject<HTMLDivElement>, props: SVGProperties) {\n\tconst div = container.current\n\tif (!div) return\n\n\t// The ResponsiveScreenContainer.tsx of vekter allows content to be rendered into an iframe via\n\t// a react portal. This means that the javascript is executed by react outside of the iframe,\n\t// but the html elements are mounted inside the iframe. That means that attempting to do checks\n\t// by reference between dom nodes and dom classes will fail. To work around this, we need to\n\t// make sure that we use the same reference. We do this by creating a context that captures the\n\t// value of the iframe's window, we then use that to reference the correct dom node class.\n\tconst localWindow = props.providedWindow ?? safeWindow\n\tconst svg = div.firstElementChild\n\tif (!svg || !(svg instanceof localWindow.SVGSVGElement)) return\n\n\t// Workaround for Firefox mostly: Sometimes react dehydration does not update\n\t// dangerouslySetInnerHTML properties. And ssg produces templates without viewBoxes, as there is\n\t// no DOMParser on the server side. And Firefox does not render the SVG correctly without a\n\t// viewBox that is the size of the svg referenced by <use ... />\n\t// See also: https://github.com/framer/company/issues/24019\n\tif (!svg.getAttribute(\"viewBox\")) {\n\t\tconst viewBox = sharedSVGManager.getViewBox(props.svg)\n\t\tif (viewBox) {\n\t\t\tsvg.setAttribute(\"viewBox\", viewBox)\n\t\t}\n\t}\n\n\tconst { withExternalLayout, parentSize } = props\n\t// SVGs rendered on the canvas will already have an explicit size calculated\n\t// and set by the `collectLayout()` method, so we don't need to resize them\n\t// again. When in a DOM Layout Stack or a code component parent size will be\n\t// disabled for the current level, so sizes won't be calculated, and SVGs\n\t// will be treated as if they have external layout.\n\tconst canUseCalculatedOnCanvasSize =\n\t\t!withExternalLayout &&\n\t\tconstraintsEnabled(props) &&\n\t\tparentSize !== ParentSizeState.Disabled &&\n\t\tparentSize !== ParentSizeState.DisabledForCurrentLevel\n\n\tif (canUseCalculatedOnCanvasSize) return\n\n\tconst { intrinsicWidth, intrinsicHeight, _constraints } = props\n\tif (\n\t\tsvg.viewBox?.baseVal?.width === 0 &&\n\t\tsvg.viewBox?.baseVal?.height === 0 &&\n\t\tisFiniteNumber(intrinsicWidth) &&\n\t\tisFiniteNumber(intrinsicHeight)\n\t) {\n\t\tsvg.setAttribute(\"viewBox\", `0 0 ${intrinsicWidth} ${intrinsicHeight}`)\n\t}\n\t// XXX TODO take the value from _constraints.aspectRatio into account\n\tif (_constraints && _constraints.aspectRatio) {\n\t\tsvg.setAttribute(\"preserveAspectRatio\", \"\")\n\t} else {\n\t\tsvg.setAttribute(\"preserveAspectRatio\", \"none\")\n\t}\n\tsvg.setAttribute(\"width\", \"100%\")\n\tsvg.setAttribute(\"height\", \"100%\")\n}\n\ndeclare class SVGComponentType extends Layer<SVGProperties, object> {\n\tstatic supportsConstraints: boolean\n\tstatic frame(props: Partial<SVGProperties>): Rect | null\n\tstatic defaultSVGProps: SVGProps\n\tstatic readonly defaultProps: SVGProperties\n\tsetSVGElement(element: SVGSVGElement | null): void\n\tget frame(): Rect | null\n}\n\nexport const SVGComponent: typeof SVGComponentType = /* @__PURE__ */ (() => {\n\treturn class SVGComponentInner extends Layer<SVGProperties, object> {\n\t\tstatic supportsConstraints = true\n\t\tstatic defaultSVGProps: SVGProps = {\n\t\t\tleft: undefined,\n\t\t\tright: undefined,\n\t\t\ttop: undefined,\n\t\t\tbottom: undefined,\n\t\t\tstyle: undefined,\n\t\t\t_constraints: {\n\t\t\t\tenabled: true,\n\t\t\t\taspectRatio: null,\n\t\t\t},\n\t\t\tparentSize: ParentSizeState.Unknown,\n\t\t\trotation: 0,\n\t\t\tvisible: true,\n\t\t\tsvg: \"\",\n\t\t\tshadows: [],\n\t\t}\n\n\t\tstatic override readonly defaultProps: SVGProperties = {\n\t\t\t...Layer.defaultProps,\n\t\t\t...SVGComponentInner.defaultSVGProps,\n\t\t}\n\n\t\tstatic frame(props: Partial<SVGProperties>) {\n\t\t\treturn calculateRect(props, props.parentSize || ParentSizeState.Unknown)\n\t\t}\n\n\t\tcontainer = React.createRef<HTMLDivElement>()\n\t\tsvgElement: SVGSVGElement | null = null\n\n\t\tsetSVGElement = (element: SVGSVGElement | null) => {\n\t\t\tthis.svgElement = element\n\t\t\tthis.setLayerElement(element)\n\t\t}\n\n\t\tpreviouslyRenderedSVG: string = \"\"\n\n\t\tget frame(): Rect | null {\n\t\t\treturn calculateRect(this.props, this.props.parentSize || ParentSizeState.Unknown)\n\t\t}\n\n\t\tprivate unmountedSVG: string | undefined = \"\"\n\t\toverride componentDidMount() {\n\t\t\t// This normally isn't called, but in strict+dev mode, react will call will did mount,\n\t\t\t// will unmount, did mount. If no render follows afterwards, the svg will disappear from the\n\t\t\t// page after 5 seconds.\n\t\t\tif (this.unmountedSVG) {\n\t\t\t\tconst { svgContentId } = this.props\n\t\t\t\tconst contentid = svgContentId ? `svg${svgContentId}` : null\n\t\t\t\tsharedSVGManager.subscribe(this.unmountedSVG, !svgContentId, contentid)\n\t\t\t\tthis.previouslyRenderedSVG = this.unmountedSVG\n\t\t\t}\n\n\t\t\tif (this.props.svgContentId) return\n\t\t\tsizeSVG(this.container, this.props)\n\t\t}\n\n\t\toverride componentWillUnmount() {\n\t\t\tsharedSVGManager.unsubscribe(this.previouslyRenderedSVG)\n\t\t\tthis.unmountedSVG = this.previouslyRenderedSVG\n\t\t\tthis.previouslyRenderedSVG = \"\"\n\t\t}\n\n\t\toverride componentDidUpdate(prevProps: SVGProperties) {\n\t\t\tsuper.componentDidUpdate(prevProps)\n\t\t\tif (this.props.svgContentId) return\n\n\t\t\tconst { fill } = this.props\n\t\t\tif (\n\t\t\t\tBackgroundImage.isImageObject(fill) &&\n\t\t\t\tBackgroundImage.isImageObject(prevProps.fill) &&\n\t\t\t\tfill.src !== prevProps.fill.src\n\t\t\t) {\n\t\t\t\tresetSetStyle(this.svgElement, \"fill\", null, false)\n\t\t\t}\n\t\t\tsizeSVG(this.container, this.props)\n\t\t}\n\n\t\tprivate collectLayout(style: React.CSSProperties, innerStyle: React.CSSProperties) {\n\t\t\tif (this.props.withExternalLayout) {\n\t\t\t\t// When the outer element is already sized correclty the inner element needs to fill it.\n\t\t\t\tinnerStyle.width = \"100%\"\n\t\t\t\tinnerStyle.height = \"100%\"\n\t\t\t\tinnerStyle.aspectRatio = \"inherit\"\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst frame = this.frame\n\t\t\tconst { rotation, intrinsicWidth, intrinsicHeight, width, height } = this.props\n\t\t\tconst rotate = Animatable.getNumber(rotation)\n\n\t\t\tstyle.opacity = isFiniteNumber(this.props.opacity) ? this.props.opacity : 1\n\n\t\t\t/**\n\t\t\t * The if-statement below switches between positioning the SVG with\n\t\t\t * transforms or (in the else statement) with DOM-layout.\n\t\t\t *\n\t\t\t * On the canvas (when RenderTarget.hasRestrictions()) we want to\n\t\t\t * position with transforms for performance reasons. When dragging an\n\t\t\t * SVG around, if we can reposition an SVG using transforms, it won't\n\t\t\t * trigger a browser layout.\n\t\t\t *\n\t\t\t * In the preview we always position with DOM-layout, to not interfere\n\t\t\t * with Magic Motion that uses the transforms for animating.\n\t\t\t *\n\t\t\t * However, there might be cases where we do not have a frame to use for\n\t\t\t * positioning the SVG using transforms. For example when rendering\n\t\t\t * inside a Scroll component (that uses DOM-layout for it's children,\n\t\t\t * also on the canvas), we cannot always calculate a frame. In these\n\t\t\t * cases we do use DOM-layout to position the SVG, even on the canvas.\n\t\t\t */\n\t\t\tif (RenderTarget.hasRestrictions() && frame) {\n\t\t\t\tObject.assign(style, {\n\t\t\t\t\ttransform: `translate(${frame.x}px, ${frame.y}px) rotate(${rotate.toFixed(4)}deg)`,\n\t\t\t\t\twidth: `${frame.width}px`,\n\t\t\t\t\theight: `${frame.height}px`,\n\t\t\t\t})\n\t\t\t\tif (constraintsEnabled(this.props)) {\n\t\t\t\t\tstyle.position = \"absolute\"\n\t\t\t\t}\n\t\t\t\tconst xFactor = frame.width / (intrinsicWidth || 1)\n\t\t\t\tconst yFactor = frame.height / (intrinsicHeight || 1)\n\n\t\t\t\tinnerStyle.transformOrigin = \"top left\"\n\n\t\t\t\tconst { zoom, target } = RenderEnvironment\n\t\t\t\tif (target === RenderTarget.export) {\n\t\t\t\t\tconst zoomFactor = zoom > 1 ? zoom : 1\n\t\t\t\t\tinnerStyle.transform = `scale(${xFactor * zoomFactor}, ${yFactor * zoomFactor})`\n\t\t\t\t\tinnerStyle.zoom = 1 / zoomFactor\n\t\t\t\t} else {\n\t\t\t\t\tinnerStyle.transform = `scale(${xFactor}, ${yFactor})`\n\t\t\t\t}\n\n\t\t\t\tif (intrinsicWidth && intrinsicHeight) {\n\t\t\t\t\tinnerStyle.width = intrinsicWidth\n\t\t\t\t\tinnerStyle.height = intrinsicHeight\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst { left, right, top, bottom } = this.props\n\t\t\tObject.assign(style, {\n\t\t\t\tleft,\n\t\t\t\tright,\n\t\t\t\ttop,\n\t\t\t\tbottom,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\trotate,\n\t\t\t})\n\n\t\t\tObject.assign(innerStyle, {\n\t\t\t\tleft: 0,\n\t\t\t\ttop: 0,\n\t\t\t\tbottom: 0,\n\t\t\t\tright: 0,\n\t\t\t\tposition: \"absolute\",\n\t\t\t})\n\t\t}\n\n\t\toverride render() {\n\t\t\tcountNodeRender()\n\n\t\t\tconst {\n\t\t\t\tid,\n\t\t\t\tvisible,\n\t\t\t\tstyle,\n\t\t\t\tfill,\n\t\t\t\tsvg,\n\t\t\t\tintrinsicHeight,\n\t\t\t\tintrinsicWidth,\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tlayoutId,\n\t\t\t\tclassName,\n\t\t\t\tvariants,\n\t\t\t\twithExternalLayout,\n\t\t\t\tinnerRef,\n\t\t\t\tsvgContentId,\n\t\t\t\theight: _height,\n\t\t\t\topacity: _opacity,\n\t\t\t\twidth: _width,\n\t\t\t\trequiresOverflowVisible,\n\t\t\t\t...rest\n\t\t\t} = this.props\n\n\t\t\tif (!withExternalLayout && (!visible || !id)) return null\n\n\t\t\tconst identifier = id ?? layoutId ?? \"svg\"\n\t\t\tconst frame = this.frame\n\n\t\t\t// XXX find another way to not need these defaults\n\t\t\tconst size: Size = frame || { width: intrinsicWidth || 100, height: intrinsicHeight || 100 }\n\n\t\t\tconst outerStyle: React.CSSProperties = { ...style, imageRendering: \"pixelated\", flexShrink: 0 }\n\t\t\tconst innerStyle: React.CSSProperties = {}\n\n\t\t\tthis.collectLayout(outerStyle, innerStyle)\n\n\t\t\tcollectOpacityFromProps(this.props, outerStyle)\n\t\t\tcollectFiltersFromProps(this.props, outerStyle)\n\n\t\t\tLayer.applyWillChange(this.props, outerStyle, false)\n\n\t\t\t/** The fillElement will be used an all paths in the SVG that have no fill set. */\n\t\t\tlet fillElement: JSX.Element | null = null\n\t\t\tif (typeof fill === \"string\" || Color.isColorObject(fill)) {\n\t\t\t\tconst fillColor = Color.isColorObject(fill) ? fill.initialValue || Color.toRgbString(fill) : fill\n\t\t\t\touterStyle.fill = fillColor\n\t\t\t\touterStyle.color = fillColor\n\t\t\t} else if (LinearGradient.isLinearGradient(fill)) {\n\t\t\t\tconst gradient = fill\n\t\t\t\t// We need encodeURI() here to handle our old id's that contained special characters like ';'\n\t\t\t\t// Creating an url() entry for those id's unescapes them, so we need to use the URI encoded version\n\t\t\t\tconst gradientId = `${encodeURI(id || \"\")}g${LinearGradient.hash(gradient)}`\n\t\t\t\touterStyle.fill = `url(#${gradientId})`\n\t\t\t\tconst { stops, x1, x2, y1, y2 } = elementPropertiesForLinearGradient(gradient, identifier)\n\n\t\t\t\tfillElement = (\n\t\t\t\t\t<svg ref={this.setSVGElement} width=\"100%\" height=\"100%\" style={{ position: \"absolute\" }} role=\"presentation\">\n\t\t\t\t\t\t<linearGradient id={gradientId} x1={x1} x2={x2} y1={y1} y2={y2}>\n\t\t\t\t\t\t\t{stops.map((stop, idx) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<stop\n\t\t\t\t\t\t\t\t\t\t// biome-ignore lint/suspicious/noArrayIndexKey: other properties might not be unique\n\t\t\t\t\t\t\t\t\t\tkey={idx}\n\t\t\t\t\t\t\t\t\t\toffset={stop.position}\n\t\t\t\t\t\t\t\t\t\tstopColor={stop.color}\n\t\t\t\t\t\t\t\t\t\tstopOpacity={stop.alpha}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</linearGradient>\n\t\t\t\t\t</svg>\n\t\t\t\t)\n\t\t\t} else if (RadialGradient.isRadialGradient(fill)) {\n\t\t\t\tconst gradient = fill\n\t\t\t\t// We need encodeURI() here to handle our old id's that contained special characters like ';'\n\t\t\t\t// Creating an url() entry for those id's unescapes them, so we need to use the URI encoded version\n\t\t\t\tconst gradientId = `${encodeURI(id || \"\")}g${RadialGradient.hash(gradient)}`\n\t\t\t\touterStyle.fill = `url(#${gradientId})`\n\t\t\t\tconst elementProperties = elementPropertiesForRadialGradient(gradient, identifier)\n\t\t\t\tfillElement = (\n\t\t\t\t\t<svg ref={this.setSVGElement} width=\"100%\" height=\"100%\" style={{ position: \"absolute\" }} role=\"presentation\">\n\t\t\t\t\t\t<radialGradient\n\t\t\t\t\t\t\tid={gradientId}\n\t\t\t\t\t\t\tcy={gradient.centerAnchorY}\n\t\t\t\t\t\t\tcx={gradient.centerAnchorX}\n\t\t\t\t\t\t\tr={gradient.widthFactor}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{elementProperties.stops.map((stop, idx) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<stop\n\t\t\t\t\t\t\t\t\t\t// biome-ignore lint/suspicious/noArrayIndexKey: other properties might not be unique\n\t\t\t\t\t\t\t\t\t\tkey={idx}\n\t\t\t\t\t\t\t\t\t\toffset={stop.position}\n\t\t\t\t\t\t\t\t\t\tstopColor={stop.color}\n\t\t\t\t\t\t\t\t\t\tstopOpacity={stop.alpha}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</radialGradient>\n\t\t\t\t\t</svg>\n\t\t\t\t)\n\t\t\t} else if (BackgroundImage.isImageObject(fill)) {\n\t\t\t\tconst imagePattern = imagePatternPropsForFill(fill, size, identifier)\n\t\t\t\tif (imagePattern) {\n\t\t\t\t\touterStyle.fill = `url(#${imagePattern.id})`\n\t\t\t\t\tfillElement = (\n\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\tref={this.setSVGElement}\n\t\t\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\t\t\theight=\"100%\"\n\t\t\t\t\t\t\tstyle={{ position: \"absolute\" }}\n\t\t\t\t\t\t\trole=\"presentation\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<defs>\n\t\t\t\t\t\t\t\t<ImagePatternElement {...imagePattern} />\n\t\t\t\t\t\t\t</defs>\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst dataProps = {\n\t\t\t\t\"data-framer-component-type\": \"SVG\",\n\t\t\t}\n\n\t\t\tconst hasTransformTemplate = !frame\n\t\t\tif (hasTransformTemplate) {\n\t\t\t\tObject.assign(dataProps, layoutHintDataPropsForCenter(this.props.center))\n\t\t\t}\n\n\t\t\t// If the svg is smallish, and doesn't contain images, and there is no fill defined, and no\n\t\t\t// background is defined, then we can use a much cheaper method to render this svg by using\n\t\t\t// a backgroundImage data url.\n\t\t\tconst svgAsBackgroundImage =\n\t\t\t\t// If requiresOverflowVisible is true, we cannot safely render the SVG as background\n\t\t\t\t// images, as it might cropped any centered stroke that exceeds the bounding box.\n\t\t\t\t!requiresOverflowVisible &&\n\t\t\t\t!fillElement &&\n\t\t\t\t!outerStyle.fill &&\n\t\t\t\t!outerStyle.background &&\n\t\t\t\t!outerStyle.backgroundImage &&\n\t\t\t\tsvg.length < MAX_BACKGROUND_SVG_TEXT_LENGTH &&\n\t\t\t\t!containsImageReference(svg) &&\n\t\t\t\t!containsCustomPropertyReference(svg)\n\n\t\t\tlet content: JSX.Element | null = null\n\t\t\tif (svgAsBackgroundImage) {\n\t\t\t\touterStyle.backgroundSize = \"100% 100%\"\n\t\t\t\touterStyle.backgroundImage = encodeSVGForCSS(svg)\n\t\t\t\tsharedSVGManager.unsubscribe(this.previouslyRenderedSVG)\n\t\t\t\tthis.previouslyRenderedSVG = \"\"\n\t\t\t} else {\n\t\t\t\tconst contentid = svgContentId ? `svg${svgContentId}` : null\n\t\t\t\tconst __html = sharedSVGManager.subscribe(svg, !svgContentId, contentid, requiresOverflowVisible)\n\t\t\t\tsharedSVGManager.unsubscribe(this.previouslyRenderedSVG)\n\t\t\t\tthis.previouslyRenderedSVG = svg\n\n\t\t\t\tif (hasBorderRadius(outerStyle)) {\n\t\t\t\t\t// Border radius will have no effect on nested elements, unless we add overflow hidden\n\t\t\t\t\touterStyle.overflow = \"hidden\"\n\t\t\t\t}\n\n\t\t\t\t// Note how the fillElement and fill is used below, via css a fill is set, then any svg\n\t\t\t\t// path that doesn't have a fill set will take on this fill.\n\n\t\t\t\tcontent = (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{fillElement}\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tkey={BackgroundImage.isImageObject(fill) ? fill.src : \"\"} // Webkit doesn't update when a new image is set\n\t\t\t\t\t\t\tclassName=\"svgContainer\" // Style for this class is added by `withLibraryCSS`\n\t\t\t\t\t\t\tstyle={innerStyle}\n\t\t\t\t\t\t\tref={this.container}\n\t\t\t\t\t\t\t// biome-ignore lint/security/noDangerouslySetInnerHtml: intentional for svg template\n\t\t\t\t\t\t\tdangerouslySetInnerHTML={{ __html }}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t)\n\t\t\t}\n\n\t\t\t// Tag support, aria support, link support\n\t\t\tconst MotionComponent = htmlElementAsMotionComponent(this.props.as)\n\t\t\tconst { href, target, rel, onClick, onTap } = this.props as PropsAddedByLink\n\t\t\tconst hasTitleOrDescription = title || description\n\n\t\t\treturn (\n\t\t\t\t<MotionComponent\n\t\t\t\t\t{...dataProps}\n\t\t\t\t\t{...rest}\n\t\t\t\t\tlayoutId={layoutId}\n\t\t\t\t\ttransformTemplate={hasTransformTemplate ? transformTemplate(this.props.center) : undefined}\n\t\t\t\t\tid={id}\n\t\t\t\t\tref={innerRef}\n\t\t\t\t\tstyle={outerStyle}\n\t\t\t\t\tclassName={className}\n\t\t\t\t\tvariants={variants}\n\t\t\t\t\ttabIndex={this.props.tabIndex}\n\t\t\t\t\trole={hasTitleOrDescription ? \"img\" : undefined}\n\t\t\t\t\taria-label={title}\n\t\t\t\t\t// eslint-disable-next-line jsx-a11y/aria-props -- this is a draft prop\n\t\t\t\t\taria-description={description}\n\t\t\t\t\taria-hidden={hasTitleOrDescription ? undefined : \"true\"}\n\t\t\t\t\tonTap={onTap}\n\t\t\t\t\tonClick={onClick}\n\t\t\t\t\t{...{ href, target, rel }}\n\t\t\t\t>\n\t\t\t\t\t{content}\n\t\t\t\t</MotionComponent>\n\t\t\t)\n\t\t}\n\t}\n})()\n\nexport const SVG = /* @__PURE__ */ withLibraryCSS(SVGInner)\n", "import { interpolate } from \"framer-motion\"\nimport { Line } from \"../../render/types/Line.ts\"\nimport { Point } from \"../../render/types/Point.ts\"\nimport { Rect } from \"../../render/types/Rect.ts\"\nimport { assert } from \"../../utils/assert.ts\"\nimport { ConvertColor } from \"../types/Color/ConvertColor.ts\"\nimport { LinearGradient, RadialGradient } from \"../types/Gradient.ts\"\nimport { gradientColorStops } from \"./gradientColorStops.ts\"\n\n/** @internal */\ninterface ColorStop {\n\tcolor: string\n\talpha: number\n\tposition: number\n}\n\n/** @internal */\nexport interface LinearGradientElementProperties {\n\tid: string\n\tstops: ColorStop[]\n\tx1: number\n\ty1: number\n\tx2: number\n\ty2: number\n}\n\n/**\n * Get a line made up of the 2 points where a line from the center of the layer\n * along the angle of the gradient would intersect with a 1x1 rectangle.\n */\nexport function linearGradientLine(angle: number): Line {\n\tconst rad = (angle * Math.PI) / 180\n\tconst offset = {\n\t\tx: -Math.sin(rad) * 100,\n\t\ty: Math.cos(rad) * 100,\n\t}\n\n\tconst anglePoint = Point(offset.x, offset.y)\n\tconst angleLine = Line(Point(0.5, 0.5), anglePoint)\n\n\t// Get points from a 1x1 rectangle.\n\tconst points = Rect.points({ x: 0, y: 0, width: 1, height: 1 })\n\n\t// Find the two closest points. These should always be the points that form\n\t// the side of the 1x1 square that the angled line travels through. This is\n\t// only true because we are using a square, and would not hold true for a\n\t// rectangle.\n\tconst sortedPoints = points\n\t\t.map(point => ({ point, distance: Point.distance(anglePoint, point) }))\n\t\t.sort((a, b) => a.distance - b.distance)\n\n\tconst a = sortedPoints[0]?.point\n\tconst b = sortedPoints[1]?.point\n\tassert(a && b, \"linearGradientLine: Must have 2 closest points.\")\n\n\t// Find the other points, together they should form the line of the opposing side.\n\tconst [c, d] = points.filter(point => !Point.isEqual(point, a) && !Point.isEqual(point, b))\n\tassert(c && d, \"linearGradientLine: Must have 2 opposing points.\")\n\n\t// The start and end point of the line of the gradient are defined by where\n\t// the angle line would intersect with our sides.\n\tconst start = Line.intersection(angleLine, Line(a, b))\n\tconst end = Line.intersection(angleLine, Line(c, d))\n\tassert(start && end, \"linearGradientLine: Must have a start and end point.\")\n\n\treturn Line(start, end)\n}\n\nexport function elementPropertiesForLinearGradient(\n\tgradient: LinearGradient,\n\tid: string,\n): LinearGradientElementProperties {\n\tconst line = linearGradientLine(gradient.angle)\n\tconst stops = gradientColorStops(gradient)\n\n\tconst startPosition = stops[0]?.position ?? 0\n\tconst endPosition = stops[stops.length - 1]?.position ?? 1\n\n\tconst startPoint = Line.pointAtPercentDistance(line, startPosition)\n\tconst endPoint = Line.pointAtPercentDistance(line, endPosition)\n\n\t// Since the gradient will be positioned by the coordinates of the start and\n\t// end point, we normalize the other points into that range.\n\tconst interpolator = interpolate([startPosition, endPosition], [0, 1])\n\n\treturn {\n\t\tid: `id${id}g${LinearGradient.hash(gradient)}`,\n\t\tx1: startPoint.x,\n\t\ty1: startPoint.y,\n\t\tx2: endPoint.x,\n\t\ty2: endPoint.y,\n\t\tstops: stops.map(stop => ({\n\t\t\tcolor: stop.value,\n\t\t\talpha: ConvertColor.getAlpha(stop.value) * gradient.alpha,\n\t\t\tposition: interpolator(stop.position),\n\t\t})),\n\t}\n}\n\n/** @internal */\nexport interface RadialGradientElementProperties {\n\tid: string\n\twidthFactor: number\n\theightFactor: number\n\tcenterAnchorX: number\n\tcenterAnchorY: number\n\tstops: ColorStop[]\n}\n\nexport function elementPropertiesForRadialGradient(\n\tgradient: RadialGradient,\n\tid: string,\n): RadialGradientElementProperties {\n\treturn {\n\t\tid: `id${id}g${RadialGradient.hash(gradient)}`,\n\t\twidthFactor: gradient.widthFactor,\n\t\theightFactor: gradient.heightFactor,\n\t\tcenterAnchorX: gradient.centerAnchorX,\n\t\tcenterAnchorY: gradient.centerAnchorY,\n\t\tstops: gradientColorStops(gradient).map(stop => ({\n\t\t\tcolor: stop.value,\n\t\t\talpha: ConvertColor.getAlpha(stop.value) * gradient.alpha,\n\t\t\tposition: stop.position,\n\t\t})),\n\t}\n}\n", "import { isNumber, isString } from \"../../utils/utils.ts\"\n\n/** @public */\nexport type RelativeNumber = `${number}%`\n\n/** @public */\nexport function isRelativeNumber(value: unknown): value is RelativeNumber {\n\tif (!isString(value)) return false\n\tconst lastChar = value.charAt(value.length - 1)\n\tif (lastChar !== \"%\") return false\n\tconst withoutLastChar = value.slice(0, -1)\n\tconst float = parseFloat(withoutLastChar)\n\treturn isNumber(float)\n}\n\n/** @public */\nexport function getRelativeNumberValue(value: RelativeNumber): number {\n\tconst withoutLastChar = value.slice(0, -1)\n\tconst float = parseFloat(withoutLastChar)\n\treturn isNumber(float) ? float : 50\n}\n", "import { Animatable } from \"../../animation/Animatable/Animatable.ts\"\nimport type { ImagePatternElementProperties } from \"../presentation/ImagePatternElement.tsx\"\nimport type { Background } from \"../traits/Background.ts\"\nimport { BackgroundImage } from \"../types/BackgroundImage.ts\"\nimport { getRelativeNumberValue, isRelativeNumber } from \"../types/RelativeNumber.ts\"\nimport type { Size } from \"../types/Size.ts\"\nimport type { TransformValues } from \"../types/TransformValues.ts\"\n\nfunction getPositionXFraction(positionX: BackgroundImage[\"positionX\"]) {\n\tif (isRelativeNumber(positionX)) return getRelativeNumberValue(positionX) / 100\n\tif (positionX === \"left\") return 0\n\tif (positionX === \"right\") return 1\n\treturn 0.5\n}\n\nfunction getPositionYFraction(positionY: BackgroundImage[\"positionY\"]) {\n\tif (isRelativeNumber(positionY)) return getRelativeNumberValue(positionY) / 100\n\tif (positionY === \"top\") return 0\n\tif (positionY === \"bottom\") return 1\n\treturn 0.5\n}\n\n/** @internal */\nexport function imagePatternPropsForFill(\n\tfill: Background | Animatable<Background>,\n\tframe: Size & Partial<TransformValues>,\n\tid: string,\n\tincludeTransform?: boolean,\n): ImagePatternElementProperties | undefined {\n\tfill = Animatable.get(fill, \"#09F\")\n\n\tif (!BackgroundImage.isImageObject(fill)) return undefined\n\tif (!fill.pixelWidth || !fill.pixelHeight) return undefined\n\n\tconst imageWidth = fill.pixelWidth\n\tconst imageHeight = fill.pixelHeight\n\n\tlet transform: string | undefined\n\tconst { fit } = fill\n\tlet width = 1,\n\t\theight = 1\n\tlet offsetX = 0\n\tlet offsetY = 0\n\n\tif (fit === \"fill\" || fit === \"fit\" || fit === \"tile\" || !fit) {\n\t\tlet scaleX = 1\n\t\tlet scaleY = 1\n\n\t\tconst imageRatio = imageWidth / imageHeight\n\t\tconst realWidth = frame.height * imageRatio\n\t\tconst realHeight = frame.width / imageRatio\n\t\tconst validScaleX = realWidth / frame.width\n\t\tconst validScaleY = realHeight / frame.height\n\n\t\tif (fit === \"tile\") {\n\t\t\tfill.backgroundSize ??= 1\n\n\t\t\t// We divide the pixel width/height by 2 because we assume that most designers\n\t\t\t// will be working with 2x (retina) assets.\n\t\t\twidth = Math.round(fill.backgroundSize * (imageWidth / 2))\n\t\t\theight = Math.round(fill.backgroundSize * (imageHeight / 2))\n\n\t\t\tconst layerPositionX = frame.x ?? 0\n\t\t\tconst layerPositionY = frame.y ?? 0\n\n\t\t\tlet extraOffsetX = 0\n\t\t\tlet extraOffsetY = 0\n\t\t\tif (includeTransform) {\n\t\t\t\textraOffsetX = layerPositionX\n\t\t\t\textraOffsetY = layerPositionY\n\t\t\t}\n\n\t\t\t// We calculate the offset based on the height and width of the tile (which is a function of the image size and the backgroundSize)\n\t\t\toffsetX = (frame.width - width) * getPositionXFraction(fill.positionX) + extraOffsetX\n\t\t\toffsetY = (frame.height - height) * getPositionYFraction(fill.positionY) + extraOffsetY\n\n\t\t\ttransform = `translate(${offsetX + layerPositionX}, ${offsetY + layerPositionY})`\n\t\t} else {\n\t\t\tif (fit === \"fill\" || !fit ? validScaleY > validScaleX : validScaleY < validScaleX) {\n\t\t\t\tscaleY = validScaleY\n\t\t\t\toffsetY = (1 - validScaleY) * getPositionYFraction(fill.positionY)\n\t\t\t} else {\n\t\t\t\tscaleX = validScaleX\n\t\t\t\toffsetX = (1 - validScaleX) * getPositionXFraction(fill.positionX)\n\t\t\t}\n\n\t\t\ttransform = `translate(${offsetX}, ${offsetY}) scale(${scaleX}, ${scaleY})`\n\t\t}\n\t}\n\n\tconst imageId = `id${id}g${\"-fillImage\"}`\n\treturn { id: imageId, path: fill.src ?? \"\", transform, width, height, offsetX, offsetY }\n}\n", "import { runtime } from \"../../utils/runtimeInjection.ts\"\nimport { RenderTarget } from \"../types/RenderEnvironment.ts\"\n\n// #region copied from src/app/assets/src/assetReference.ts to remove dependency on assets.\n// This includes the comma that separates the media type from the data.\nconst mediaType = \"framer/asset-reference,\"\n\nexport function isAssetReference(value: string): boolean {\n\treturn value.startsWith(`data:${mediaType}`)\n}\n// #endregion\n\n/**\n * @internal\n */\nexport function imageUrlForAsset(asset: string, pixelSize?: number) {\n\tif (/^\\w+:/u.test(asset) && !isAssetReference(asset)) return asset\n\n\tif (typeof pixelSize !== \"number\") pixelSize = undefined\n\telse if (pixelSize <= 512) pixelSize = 512\n\telse if (pixelSize <= 1024) pixelSize = 1024\n\telse if (pixelSize <= 2048) pixelSize = 2048\n\telse pixelSize = 4096\n\n\tconst isExport = RenderTarget.current() === RenderTarget.export\n\treturn runtime.assetResolver(asset, { pixelSize, isExport }) ?? \"\"\n}\n", "import { imageUrlForAsset } from \"../utils/imageUrlForAsset.ts\"\n\nexport interface ImagePatternElementProperties {\n\tid: string\n\tpath: string\n\ttransform?: string\n\trepeat?: boolean\n\t// Optional width and height for setting the tile size when repeat is true.\n\twidth?: number\n\theight?: number\n\n\t// Optional offset for the tile when repeat is true.\n\t// The offset is the same value as is interpolated into\n\t// transform: translate(x, y) in imagePatternPropsForFill, but\n\t// when tiling a svg pattern we need to use x and y attributes.\n\toffsetX?: number\n\toffsetY?: number\n}\n\nexport const ImagePatternElement = ({\n\tid,\n\tpath,\n\ttransform,\n\trepeat,\n\twidth,\n\theight,\n\toffsetX,\n\toffsetY,\n}: ImagePatternElementProperties) => {\n\tconst href = imageUrlForAsset(path)\n\n\treturn (\n\t\t<pattern\n\t\t\tid={id}\n\t\t\twidth={repeat ? width : \"100%\"}\n\t\t\theight={repeat ? height : \"100%\"}\n\t\t\tpatternContentUnits={repeat ? undefined : \"objectBoundingBox\"}\n\t\t\tpatternUnits={repeat ? \"userSpaceOnUse\" : undefined}\n\t\t\t// We only want to set the x and y values if we are tiling.\n\t\t\tx={repeat ? offsetX : undefined}\n\t\t\ty={repeat ? offsetY : undefined}\n\t\t>\n\t\t\t<image\n\t\t\t\tkey={href}\n\t\t\t\twidth={repeat ? width : 1}\n\t\t\t\theight={repeat ? height : 1}\n\t\t\t\thref={href}\n\t\t\t\tpreserveAspectRatio=\"none\"\n\t\t\t\ttransform={repeat ? undefined : transform}\n\t\t\t\tx={repeat ? 0 : undefined}\n\t\t\t\ty={repeat ? 0 : undefined}\n\t\t\t/>\n\t\t</pattern>\n\t)\n}\n", "import { isBrowser } from \"@framerjs/shared/src/environment.ts\"\nimport { useEffect } from \"react\"\nimport type { Size } from \"../../render/types/Size.ts\"\nimport { domParser } from \"../../render/utils/dom.ts\"\nimport { hash } from \"../../utils/string.ts\"\n\nconst useDOM = /* @__PURE__ */ isBrowser()\n\nclass SharedSVGEntry {\n\tconstructor(\n\t\tpublic id: string,\n\t\tpublic svg: string,\n\t\tpublic innerHTML: string,\n\t\tpublic viewBox: string | undefined,\n\t\tpublic count = 0,\n\t) {}\n}\n\n// due to browser bugs, we cannot use display:none or content-visibility:hidden for the templates div,\n// see https://issues.chromium.org/issues/40209403, https://bugs.webkit.org/show_bug.cgi?id=118376, https://bugzilla.mozilla.org/show_bug.cgi?id=376027\n// to work around that, we use:\n// - position: absolute + left/bottom -> makes sure we remove it from the document flow.\n// - height, width, overflow: hidden -> makes sure nothing is visible visually from the templates div.\n// - z-index: 0 -> makes sure browsers don't guess it could overlap other elements (= don't promote it to a layer).\n// - contain: strict -> makes sure it's cheaper to paint the node.\nconst visuallyHiddenStyle =\n\t\"position: absolute; overflow: hidden; bottom: 0; left: 0; width: 0; height: 0; z-index: 0; contain: strict\"\n\n/** Complex SVGs are placed once in a container and used as a template for all instances.\n * Notice the manager uses the svg string itself as the key to manage global instances with. */\nclass SharedSVGManager {\n\tprivate entries = new Map<string, SharedSVGEntry>()\n\tprivate vectorSetItems = new Map<string, { svg: string; count: number }>()\n\n\tdebugGetEntries(): Map<string, SharedSVGEntry> {\n\t\treturn this.entries\n\t}\n\n\t/** Request to render a svg, this will ensure there is a global instance and will return a\n\t * template referencing the image. Must be balanced with `unsubscribe()` calls using the same\n\t * svg. If called multiple times while the shared SVG exists, the generateUniqueIds and\n\t * contentId parameters are ignored. */\n\tsubscribe(svg: string, generateUniqueIds: boolean, contentId: string | null, overflowVisible?: boolean): string {\n\t\tif (!svg || svg === \"\") return \"\"\n\n\t\tlet entry = this.entries.get(svg)\n\t\tif (!entry) {\n\t\t\t// Create a new entry, computing a content id if needed, rewriting ids to be globally\n\t\t\t// unique if needed.\n\t\t\tif (!contentId) {\n\t\t\t\tcontentId = `svg${String(hash(svg))}_${String(svg.length)}`\n\t\t\t}\n\n\t\t\tlet uniqueSVG = svg\n\t\t\tlet svgSize: Size | undefined\n\n\t\t\tconst svgDom = parseSVG(svg)\n\t\t\tif (svgDom) {\n\t\t\t\tif (generateUniqueIds) {\n\t\t\t\t\tprefixIdsInSVG(svgDom, contentId)\n\t\t\t\t}\n\n\t\t\t\tsvgDom.id = contentId\n\t\t\t\tsvgSize = getSVGSize(svgDom)\n\t\t\t\t// we embed the svg in the document, so we don't need the xml namespace\n\t\t\t\tsvgDom.removeAttribute(\"xmlns\")\n\t\t\t\tsvgDom.removeAttribute(\"xlink\")\n\t\t\t\tsvgDom.removeAttribute(\"xmlns:xlink\")\n\n\t\t\t\tuniqueSVG = svgDom.outerHTML\n\t\t\t}\n\n\t\t\tentry = this.createDOMElementFor(uniqueSVG, contentId, svgSize, overflowVisible)\n\t\t\tthis.entries.set(svg, entry)\n\t\t}\n\n\t\tentry.count += 1\n\t\treturn entry.innerHTML\n\t}\n\n\t/** Returns the viewBox for the svg, or undefined if there is no viewBox. */\n\tgetViewBox(svg: string): string | undefined {\n\t\tif (!svg || svg === \"\") return\n\t\tconst entry = this.entries.get(svg)\n\t\treturn entry?.viewBox\n\t}\n\n\t/** When no longer rendering an svg it must be unsubscribed from so resources can be cleaned up.\n\t * Pass in the same svg as used with `subscribe()`. */\n\tunsubscribe(svg: string) {\n\t\tif (!svg || svg === \"\") return\n\n\t\tconst entry = this.entries.get(svg)\n\t\tif (!entry) return\n\n\t\tentry.count -= 1\n\t\tif (entry.count > 0) return\n\n\t\t// When the last use of the svg goes away, after a delay, we see if it should be removed.\n\t\tsetTimeout(() => this.maybeRemoveEntry(svg), 5000)\n\t}\n\n\tprivate maybeRemoveEntry(svg: string) {\n\t\tconst entry = this.entries.get(svg)\n\t\tif (!entry) return\n\t\tif (entry.count > 0) return\n\n\t\tthis.entries.delete(svg)\n\t\tthis.removeDOMElement(entry)\n\t}\n\n\tprivate removeDOMElement(entry: SharedSVGEntry): void {\n\t\tif (useDOM) {\n\t\t\tconst container = document?.getElementById(entry.id)\n\t\t\tcontainer?.remove()\n\t\t}\n\t}\n\n\tprivate getOrCreateTemplateContainer(): HTMLDivElement {\n\t\tconst container = document.getElementById(\"svg-templates\") as HTMLDivElement\n\t\tif (container) return container\n\n\t\tconst newContainer = document.createElement(\"div\")\n\t\tnewContainer.id = \"svg-templates\"\n\t\tnewContainer.ariaHidden = \"true\"\n\t\tnewContainer.style.cssText = visuallyHiddenStyle\n\t\tdocument.body.appendChild(newContainer)\n\t\treturn newContainer\n\t}\n\n\tprivate maybeAppendTemplate(id: string, svg: string) {\n\t\tif (document.getElementById(id)) return\n\t\tconst container = document.createElement(\"div\")\n\t\tcontainer.innerHTML = svg\n\t\tconst svgElement = container.firstElementChild\n\t\tif (!svgElement) return\n\n\t\tsvgElement.id = id\n\t\tthis.getOrCreateTemplateContainer().appendChild(svgElement)\n\t}\n\n\tprivate createDOMElementFor(\n\t\tsvg: string,\n\t\tid: string,\n\t\tsize: Size | undefined,\n\t\toverflowVisible?: boolean,\n\t): SharedSVGEntry {\n\t\tif (useDOM) this.maybeAppendTemplate(id, svg)\n\n\t\t// An svg referencing a shared template by id. For firefox, if the SVG has a width/height, we use that as our viewBox.\n\t\tconst box = size ? `0 0 ${size.width} ${size.height}` : undefined\n\t\tconst viewBox = box ? ` viewBox=\"${box}\"` : \"\"\n\t\tconst innerHTML = `<svg style=\"width:100%;height:100%;${overflowVisible ? \"overflow: visible;\" : \"\"}\"${viewBox}><use href=\"#${id}\"/></svg>`\n\n\t\treturn new SharedSVGEntry(id, svg, innerHTML, box)\n\t}\n\n\t/**\n\t * Vectors are serialized in such a way that they don't need to be parsed again, instead they\n\t * just need to provide their template. The hash is already known.\n\t *\n\t * VECTOR @TODO - Unsubscribe from vector set items.\n\t */\n\ttemplate(revision: string, svg: string): string {\n\t\tconst entry = this.vectorSetItems.get(revision)\n\t\tif (entry) return `#${revision}`\n\n\t\tthis.vectorSetItems.set(revision, { svg, count: 0 })\n\n\t\tif (!useDOM) return `#${revision}`\n\n\t\tthis.maybeAppendTemplate(revision, svg)\n\n\t\treturn `#${revision}`\n\t}\n\n\tsubscribeToTemplate(revision: string) {\n\t\tconst entry = this.vectorSetItems.get(revision)\n\t\tif (!entry) return\n\n\t\tentry.count++\n\n\t\treturn () => {\n\t\t\tconst latest = this.vectorSetItems.get(revision)\n\t\t\tif (!latest) return\n\n\t\t\tlatest.count--\n\n\t\t\tif (latest.count > 0) return\n\n\t\t\t// When the last use of the svg goes away, after a delay, we see if it should be removed.\n\t\t\tsetTimeout(() => {\n\t\t\t\tif (this.vectorSetItems.get(revision)?.count) return\n\t\t\t\tthis.vectorSetItems.delete(revision)\n\t\t\t\tif (useDOM) document?.getElementById(revision)?.remove()\n\t\t\t}, 5000)\n\t\t}\n\t}\n\n\tclear(): void {\n\t\tthis.entries.clear()\n\t}\n\n\t/** Returns a string containing a div#svg-templates and all the current svg templates. Can be\n\t * used after running `ReactDOMServer.renderToString()` */\n\tgenerateTemplates(): string {\n\t\tconst output: string[] = []\n\n\t\t// we cannot use e.g. `<svg><defs><symbol ...>` here, because <svg> allows to nest <svg>s, but you cannot nest <defs> or <symbol>s.\n\t\toutput.push(`<div id=\"svg-templates\" style=\"${visuallyHiddenStyle}\" aria-hidden=\"true\">`)\n\t\tthis.entries.forEach(value => output.push(value.svg))\n\t\tthis.vectorSetItems.forEach(value => output.push(value.svg))\n\t\toutput.push(\"</div>\")\n\t\treturn output.join(\"\\n\")\n\t}\n}\n\n/**\n * @internal\n */\nexport function useSVGTemplate(revision: string, svg: string): string {\n\t// Sub/unsub in an effect to ensure that in strict mode, we always unsubscribe for every subscription.\n\tuseEffect(() => sharedSVGManager.subscribeToTemplate(revision), [revision])\n\treturn sharedSVGManager.template(revision, svg)\n}\n\n/**\n * @internal\n */\nexport const sharedSVGManager = /* @__PURE__ */ new SharedSVGManager()\n\n// SVG Helper methods\nexport function parseSVG(svg: string): SVGSVGElement | undefined {\n\ttry {\n\t\t// We parse SVGs as text/html. That is more forgiving and the Deno DOMParser so far doesn't\n\t\t// support image/xml-svg. Output will differ slightly like elements don't autoclose: eg\n\t\t// instead of `<path .../>` it will become `<path ...></path>`.\n\t\tconst doc = domParser(svg)\n\t\tconst node = doc.getElementsByTagName(\"svg\")[0]\n\t\tif (!node) throw Error(\"no svg element found\")\n\t\treturn node\n\t} catch {\n\t\t// ignore errors\n\t\treturn\n\t}\n}\n\n/* Takes an SVG string and prefix all the ids and their occurrence with the given string */\nexport function prefixIdsInSVG(svg: SVGSVGElement, prefix: string): void {\n\tconst sanitizedPrefix = sanitizeString(prefix)\n\trecursivelyPrefixId(svg, sanitizedPrefix)\n}\n\n// Valid SVG IDs only include designated characters (letters, digits, and a few punctuation marks),\n// and do not start with a digit, a full stop (.) character, or a hyphen-minus (-) character.\n// https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/id\nfunction sanitizeString(str: string): string {\n\treturn str.replace(/[^\\w\\-:.]|^[^a-z]+/gi, \"\") // source: https://stackoverflow.com/a/9635731/9300219\n}\n\nfunction recursivelyPrefixId(el: Element, prefix: string) {\n\t// element itself\n\tprefixId(el, prefix)\n\n\t// handle children\n\tconst childNodes = Array.from(el.children)\n\tchildNodes.forEach(node => {\n\t\trecursivelyPrefixId(node, prefix)\n\t})\n}\n\nfunction prefixId(el: Element, prefix: string) {\n\tconst attributes = el.getAttributeNames()\n\tattributes.forEach(attr => {\n\t\tconst value = el.getAttribute(attr)\n\t\tif (!value) return\n\t\t// prefix the id\n\t\tif (attr === \"id\") {\n\t\t\tel.setAttribute(attr, `${prefix}_${value}`)\n\t\t}\n\n\t\t// prefix occurrence in href (SVG2) or xlink:href\n\t\tif (attr === \"href\" || attr === \"xlink:href\") {\n\t\t\tconst [base, fragmentIdentifier] = value.split(\"#\")\n\t\t\t// The value might have a base URL in two cases:\n\t\t\t// 1. It's a hyperlink\n\t\t\t// 2. It's referencing the fragment from another document\n\t\t\t// In both cases we don't want to touch the value\n\t\t\tif (base) return\n\n\t\t\tel.setAttribute(attr, `#${prefix}_${fragmentIdentifier}`)\n\t\t\treturn\n\t\t}\n\n\t\t// prefix occurrence in url()\n\t\tconst URL_REF = \"url(#\"\n\t\tif (value.includes(URL_REF)) {\n\t\t\tconst prefixedValue = value.replace(URL_REF, `${URL_REF}${prefix}_`)\n\t\t\tel.setAttribute(attr, prefixedValue)\n\t\t}\n\t})\n}\n\n// Absolute units converted to px according to the CSS3 specification:\n// https://www.w3.org/TR/css-values-3/#absolute-lengths\n// (1 inch is 2.54 centimeters is 96 pixels)\nconst unitsToPixels: { [unit: string]: number } = /* @__PURE__ */ (() => ({\n\tcm: 96 / 2.54,\n\tmm: 96 / 2.54 / 10,\n\tQ: 96 / 2.54 / 40,\n\tin: 96,\n\tpc: 96 / 6,\n\tpt: 96 / 72,\n\tpx: 1,\n\n\t// A few assumptions about relative units.\n\tem: 16,\n\tex: 8,\n\tch: 8,\n\trem: 16,\n}))()\n\n/** Parses values like 10cm in `<svg ... width=\"10cm\" ...>` turning them into pixel sizes. Ignoring\n * percentage values or unparsable values. Should at least parse anything browsers parse. */\nfunction parseLength(value: string | null | undefined): number | undefined {\n\tif (!value) return\n\tconst m = /(-?[\\d.]+)([a-z%]*)/u.exec(value)\n\tif (m?.[1] === undefined || m?.[2] === undefined) return\n\tif (m[2]?.startsWith(\"%\")) return\n\treturn Math.round(parseFloat(m[1]) * (unitsToPixels[m[2]] || 1))\n}\n\n/** Tries to return something sensible from the <svg width=\"X\" height=\"X\"> attributes. We use that\n * to give the outer svg a matching viewbox.\n *\n * Note, this is not a perfect solution. Ideally we know our SVGs better and we only use viewBoxes,\n * removed any percentage based sizes, etc. But at least we should be consistent between how canvas,\n * preview, and publish render.\n * */\nexport function getSVGSize(svg: SVGSVGElement): { width: number; height: number } | undefined {\n\tconst width = parseLength(svg.getAttribute(\"width\"))\n\tconst height = parseLength(svg.getAttribute(\"height\"))\n\tif (typeof width !== \"number\" || typeof height !== \"number\") return\n\tif (width <= 0 || height <= 0) return\n\treturn { width, height }\n}\n", "import { isCommandKeyPressed } from \"@framerjs/shared/src/environment.ts\"\nimport type { MotionProps, MotionStyle, Transition, Variants } from \"framer-motion\"\nimport { motion } from \"framer-motion\"\nimport React, { useEffect, useRef } from \"react\"\nimport { Animatable } from \"../../animation/Animatable/Animatable.ts\"\nimport { useLinkMatchesRoute } from \"../../modules/Link/linkMatchesRoute.tsx\"\nimport { useImplicitPathVariables } from \"../../modules/Link/pathVariables.tsx\"\nimport { cx } from \"../../modules/cx.ts\"\nimport { navigateFromAttributes } from \"../../modules/framerPageLink.ts\"\nimport { replaceFramerPageLinks } from \"../../modules/replaceFramerPageLinks.ts\"\nimport { useIsOnFramerCanvas } from \"../../modules/useIsOnFramerCanvas.ts\"\nimport { useRouter } from \"../../router/RouterContext.tsx\"\nimport { useCurrentRoute } from \"../../router/useCurrentRoute.tsx\"\nimport { useRoutePreloader } from \"../../router/useRoutePreloader.ts\"\nimport { asRecord } from \"../../utils/asRecord.ts\"\nimport { isString } from \"../../utils/utils.ts\"\nimport { fontStore } from \"../fonts/fontStore.ts\"\nimport type { FontLoadStatus } from \"../fonts/useFontLoadStatus.tsx\"\nimport { useFontLoadStatus } from \"../fonts/useFontLoadStatus.tsx\"\nimport { collectTextShadowsForProps } from \"../style/shadow.tsx\"\nimport type { FilterProperties } from \"../traits/Filters.ts\"\nimport { isAutoDimensionType } from \"../types/Constraints.ts\"\nimport type {\n\tNewConstraintProperties,\n\tParentSize,\n\tPositionAbsoluteProperties,\n\tPositionFixedProperties,\n} from \"../types/NewConstraints.tsx\"\nimport { ParentSizeState, calculateRect, useParentSize } from \"../types/NewConstraints.tsx\"\nimport type { Rect } from \"../types/Rect.ts\"\nimport { RenderTarget } from \"../types/RenderEnvironment.ts\"\nimport type { Shadow } from \"../types/Shadow.ts\"\nimport type { Size } from \"../types/Size.ts\"\nimport { collectFiltersFromProps } from \"../utils/filtersForNode.ts\"\nimport { findAnchorElement } from \"../utils/findAnchorElement.ts\"\nimport { withLibraryCSS } from \"../utils/injectComponentCSSRules.ts\"\nimport { isFiniteNumber } from \"../utils/isFiniteNumber.ts\"\nimport { isShallowEqualArray } from \"../utils/isShallowEqualArray.ts\"\nimport { layoutHintDataPropsForCenter } from \"../utils/layoutHintDataPropsForCenter.ts\"\nimport { countNodeRender } from \"../utils/performanceDebugging.ts\"\nimport { transformTemplate } from \"../utils/transformTemplate.ts\"\nimport { useLayoutId } from \"../utils/useLayoutId.ts\"\nimport { measureClosestComponentContainer, useMeasureLayout } from \"../utils/useMeasureLayout.ts\"\nimport { ComponentContainerContext } from \"./ComponentContainerContext.tsx\"\nimport type { LayerProps } from \"./Layer.tsx\"\nimport { Layer } from \"./Layer.tsx\"\n\n/**\n * @internal\n */\nexport type TextAlignment = \"left\" | \"right\" | \"center\" | undefined\n\n/**\n * @internal\n */\nexport type TextVerticalAlignment = \"top\" | \"center\" | \"bottom\"\n\n/**\n * @internal\n */\nexport interface TextProps\n\textends NewConstraintProperties, PositionFixedProperties, PositionAbsoluteProperties, Partial<FilterProperties> {\n\trotation: Animatable<number> | number\n\tvisible: boolean\n\t/** Name of the node. Only provided in the scope of canvas pages. */\n\tname?: string\n\t/** Name of the node. Provided in every scope, assuming the node has a name. */\n\t[\"data-framer-name\"]?: string\n\talignment: TextAlignment\n\tverticalAlignment: TextVerticalAlignment\n\t// The single autoSize property will only be passed in when the\n\t// supportsDomLayout platform check is NOT on, and will ultimately be\n\t// removed. The removal might not be possible because we've now got compiled\n\t// smart components that depend on this property.\n\t/**\n     * @deprecated The single autoSize property will only be passed in when the\n       supportsDomLayout platform check is NOT on, and will ultimately be\n       removed\n     */\n\tautoSize?: boolean\n\topacity?: number\n\tshadows: readonly Shadow[]\n\tstyle?: MotionStyle\n\ttext?: string\n\tfont?: string\n\tparentSize?: ParentSize\n\tviewportSize?: Size | null\n}\n\n/**\n * @internal\n */\nexport interface TextProperties extends TextProps, LayerProps, Pick<MotionProps, \"transformTemplate\"> {\n\trawHTML?: string\n\tisEditable?: boolean\n\tfonts?: string[]\n\tfontLoadStatus: FontLoadStatus\n\tlayoutId?: string | undefined\n\tclassName?: string\n\t/** @internal */\n\twithExternalLayout?: boolean\n\t/** @internal for testing */\n\tenvironment?(): RenderTarget\n\t/** @internal */\n\tinnerRef?: React.MutableRefObject<HTMLDivElement | null>\n\ttransition?: Transition\n\tvariants?: Variants\n\t/** @internal */\n\t__fromCanvasComponent?: boolean\n\t/** @internal */\n\t_initialStyle?: Partial<MotionStyle>\n\t/** @internal */\n\tpreload?: string[]\n\t/** @internal */\n\t__link?: string\n\t/** @internal */\n\ttabIndex?: number\n}\n\n/**\n * @internal\n * @deprecated this is the legacy text component.\n */\nconst TextInner = /* @__PURE__ */ React.forwardRef<HTMLDivElement, Partial<TextProperties>>(function Text(\n\tprops: Partial<TextProperties>,\n\tforwardedRef: React.RefObject<HTMLDivElement> | null,\n) {\n\tconst parentSize = useParentSize()\n\tconst layoutId = useLayoutId(props)\n\tconst fallbackLayoutRef = useRef<HTMLDivElement>(null)\n\tconst layoutRef = forwardedRef ?? fallbackLayoutRef\n\n\tconst { navigate, getRoute } = useRouter()\n\tconst currentRoute = useCurrentRoute()\n\n\tuseRoutePreloader(props.preload ?? [])\n\n\tconst onCanvas = useIsOnFramerCanvas()\n\n\tconst matchesCurrentRoute = useLinkMatchesRoute(props.__link)\n\n\tconst fontLoadStatus: FontLoadStatus = useFontLoadStatus(props.fonts)\n\n\tuseMeasureLayout(props, layoutRef)\n\n\tconst { fonts, __fromCanvasComponent } = props\n\n\t// The fonts array is typically regenerated for every change to a text node,\n\t// so we need to keep track of previous values to avoid calls to the font\n\t// store when the contents of the array are the same between renders\n\tconst prevFontsRef = useRef<string[] | undefined>([])\n\tconst fontsDidChange = !isShallowEqualArray(prevFontsRef.current ?? [], fonts ?? [])\n\tprevFontsRef.current = fonts\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: legacy text component\n\tuseEffect(() => {\n\t\tif (!fontsDidChange || !fonts) return\n\n\t\tvoid fontStore.loadFonts(fonts).then(({ newlyLoadedFontCount }) => {\n\t\t\t// After fonts load, layout is likely to shift in auto-sized\n\t\t\t// elements. Since measurements would have typically already been\n\t\t\t// taken at this point, this can lead to selection outlines\n\t\t\t// appearing out of sync with the rendered component. On the canvas\n\t\t\t// we hook into the font loading process and manually trigger a\n\t\t\t// re-render for the node when it completes, which in turn makes\n\t\t\t// sure that all layout measurements take the latest layout shifts\n\t\t\t// into account. In compiled smart components, however, we can't use\n\t\t\t// the same solution. We'll instead check if new fonts have been\n\t\t\t// loaded, and attempt to add a measure request for the closest\n\t\t\t// component container, which in the case of component instances is\n\t\t\t// the only node whose measurements need updating (we don't track\n\t\t\t// measurements for things rendered inside the component itself,\n\t\t\t// which could also be affected by layout shifts).\n\n\t\t\t// If we're not running on the canvas and from within a smart\n\t\t\t// component, there's no need to measure.\n\t\t\tif (!__fromCanvasComponent || !layoutRef.current || RenderTarget.current() !== RenderTarget.canvas) return\n\n\t\t\t// We only need to measure if at least one new font has been loaded.\n\t\t\t// Otherwise we assume there was no layout shift.\n\t\t\tif (newlyLoadedFontCount === 0) return\n\n\t\t\tmeasureClosestComponentContainer(layoutRef.current)\n\t\t})\n\t}, [fonts])\n\n\tconst implicitPathVariables = useImplicitPathVariables()\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: legacy text component\n\tconst interceptPageLinks = React.useCallback(\n\t\t(event: MouseEvent) => {\n\t\t\tconst anchorElement = findAnchorElement(event.target, layoutRef.current)\n\n\t\t\t// Don't prevent cmd + click, allowing users to open in new tab.\n\t\t\tif (isCommandKeyPressed(event) || !navigate || !anchorElement) return\n\n\t\t\t// Page links written to the draft text in the\n\t\t\t// data:framer/page-link, format should have been parsed, and\n\t\t\t// replaced with paths. If that has happened, we can access the\n\t\t\t// route id and transition properties as data attributes, finally\n\t\t\t// performing a navigation.\n\t\t\tconst didNavigate = navigateFromAttributes(navigate, anchorElement, implicitPathVariables)\n\t\t\tif (didNavigate) {\n\t\t\t\tevent.preventDefault()\n\t\t\t}\n\t\t},\n\t\t[navigate, implicitPathVariables],\n\t)\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: @TODO: This should be a ref callback\n\tuseEffect(() => {\n\t\tconst ref = layoutRef.current\n\t\tif (!ref) return\n\t\tref.addEventListener(\"click\", interceptPageLinks)\n\t\treturn () => ref.removeEventListener(\"click\", interceptPageLinks)\n\t}, [interceptPageLinks])\n\n\t// Parse the raw draft html to replace framer page links in the\n\t// data:framer/page-link, format with the paths their target corresponds to.\n\t// This needs to happen whenever the rawHTML string changes, since smart\n\t// components can update the draft text in variants by updating this prop\n\t// value.\n\t//\n\t// In future, for generated code, it might be better to try to convert the\n\t// draft html to a react tree during generation. We could do that in code\n\t// generation since we are already converting strings to jsx, and that would\n\t// allow us to do this replacement without a regex.\n\tconst rawHTML = React.useMemo(() => {\n\t\tif (!props.rawHTML || onCanvas || !getRoute || !currentRoute) return props.rawHTML\n\t\treturn replaceFramerPageLinks(props.rawHTML, getRoute, currentRoute, implicitPathVariables)\n\t}, [props.rawHTML, getRoute, currentRoute, implicitPathVariables])\n\n\treturn (\n\t\t<TextComponent\n\t\t\t{...props}\n\t\t\tinnerRef={layoutRef}\n\t\t\tlayoutId={layoutId}\n\t\t\tparentSize={parentSize}\n\t\t\tfontLoadStatus={fontLoadStatus}\n\t\t\trawHTML={rawHTML}\n\t\t\tmatchesCurrentRoute={matchesCurrentRoute}\n\t\t/>\n\t)\n})\n\n// biome-ignore lint/complexity/noBannedTypes: legacy text component\ndeclare class TextComponentType extends Layer<TextProperties & { matchesCurrentRoute: boolean }, {}> {\n\tstatic supportsConstraints: boolean\n\tstatic defaultTextProps: TextProps\n\tstatic readonly defaultProps: TextProperties\n\teditorText: string | undefined\n\tget frame(): Rect | null\n\tgetOverrideText(): void\n\t// biome-ignore lint/suspicious/noExplicitAny: legacy text component\n\tget transformTemplate(): ((_: any, generated: string) => string) | undefined\n}\n\nexport const TextComponent: typeof TextComponentType = /* @__PURE__ */ (() => {\n\t// biome-ignore lint/complexity/noBannedTypes: legacy text component\n\treturn class TextComponentInner extends Layer<TextProperties & { matchesCurrentRoute: boolean }, {}> {\n\t\tstatic supportsConstraints = true\n\t\tstatic defaultTextProps: TextProps = {\n\t\t\topacity: undefined,\n\t\t\tleft: undefined,\n\t\t\tright: undefined,\n\t\t\ttop: undefined,\n\t\t\tbottom: undefined,\n\t\t\t_constraints: {\n\t\t\t\tenabled: true,\n\t\t\t\taspectRatio: null,\n\t\t\t},\n\t\t\trotation: 0,\n\t\t\tvisible: true,\n\t\t\talignment: undefined,\n\t\t\tverticalAlignment: \"top\",\n\t\t\tshadows: [],\n\t\t\tfont: \"16px Arial\",\n\t\t}\n\n\t\tstatic override readonly defaultProps: TextProperties = {\n\t\t\t...Layer.defaultProps,\n\t\t\t...TextComponentInner.defaultTextProps,\n\t\t\tisEditable: false,\n\t\t\tenvironment: RenderTarget.current,\n\t\t\twithExternalLayout: false,\n\t\t\tfontLoadStatus: \"loading\",\n\t\t}\n\n\t\teditorText: string | undefined\n\n\t\tget frame(): Rect | null {\n\t\t\treturn calculateRect(this.props, this.props.parentSize || ParentSizeState.Unknown, false)\n\t\t}\n\n\t\tgetOverrideText() {\n\t\t\tconst { _forwardedOverrideId, _forwardedOverrides, id } = this.props\n\t\t\tconst forwardedOverrideId = _forwardedOverrideId ?? id\n\t\t\tif (forwardedOverrideId && _forwardedOverrides) {\n\t\t\t\tconst text = _forwardedOverrides[forwardedOverrideId]\n\t\t\t\tif (isString(text)) {\n\t\t\t\t\treturn text\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\toverride render() {\n\t\t\t// Refactor to use React.useContext()\n\t\t\treturn <ComponentContainerContext.Consumer>{this.renderMain}</ComponentContainerContext.Consumer>\n\t\t}\n\n\t\tprivate collectLayout(style: React.CSSProperties, inCodeComponent: boolean) {\n\t\t\tif (this.props.withExternalLayout) return\n\n\t\t\tconst frame = this.frame\n\t\t\tconst {\n\t\t\t\trotation,\n\t\t\t\tautoSize,\n\t\t\t\tpositionSticky,\n\t\t\t\tpositionStickyTop,\n\t\t\t\tpositionStickyRight,\n\t\t\t\tpositionStickyBottom,\n\t\t\t\tpositionStickyLeft,\n\t\t\t\twidth: externalWidth,\n\t\t\t\theight: externalHeight,\n\t\t\t\t_usesDOMRect,\n\t\t\t\tpositionFixed,\n\t\t\t\tpositionAbsolute,\n\t\t\t} = this.props\n\t\t\tconst rotate = Animatable.getNumber(rotation)\n\n\t\t\tconst isDOMLayoutAutoSized = _usesDOMRect && (externalWidth === \"auto\" || externalHeight === \"auto\")\n\t\t\tif (frame && !isDOMLayoutAutoSized && RenderTarget.hasRestrictions()) {\n\t\t\t\tObject.assign(style, {\n\t\t\t\t\ttransform: `translate(${frame.x}px, ${frame.y}px) rotate(${rotate.toFixed(4)}deg)`,\n\t\t\t\t\t// Using \u201Cauto\u201D fixes wrapping problems where our size calculation does not work out well when zooming the\n\t\t\t\t\t// text (due to rendering differences).\n\t\t\t\t\t// TODO: When the `autoSize` prop is removed, it's safe to leave\n\t\t\t\t\t// this at `${frame.width}px`, because all auto cases will be\n\t\t\t\t\t// handled by DOM layout in the `else` side of the conditional\n\t\t\t\t\twidth: autoSize ? \"auto\" : `${frame.width}px`,\n\t\t\t\t\tminWidth: `${frame.width}px`,\n\t\t\t\t\theight: `${frame.height}px`,\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tconst { left, right, top, bottom } = this.props\n\n\t\t\t\tlet width: number | string | undefined\n\t\t\t\tlet height: number | string | undefined\n\t\t\t\tif (autoSize) {\n\t\t\t\t\twidth = \"auto\"\n\t\t\t\t\theight = \"auto\"\n\t\t\t\t} else {\n\t\t\t\t\tif (!isFiniteNumber(left) || !isFiniteNumber(right)) {\n\t\t\t\t\t\twidth = externalWidth\n\t\t\t\t\t}\n\t\t\t\t\tif (!isFiniteNumber(top) || !isFiniteNumber(bottom)) {\n\t\t\t\t\t\theight = externalHeight\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tObject.assign(style, {\n\t\t\t\t\tleft,\n\t\t\t\t\tright,\n\t\t\t\t\ttop,\n\t\t\t\t\tbottom,\n\t\t\t\t\twidth,\n\t\t\t\t\theight,\n\t\t\t\t\trotate,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tconst onCanvas = RenderTarget.current() === RenderTarget.canvas\n\t\t\tif (positionSticky) {\n\t\t\t\tif (!onCanvas || inCodeComponent) {\n\t\t\t\t\tstyle.position = \"sticky\"\n\t\t\t\t\tstyle.willChange = \"transform\"\n\t\t\t\t\tstyle.top = positionStickyTop\n\t\t\t\t\tstyle.right = positionStickyRight\n\t\t\t\t\tstyle.bottom = positionStickyBottom\n\t\t\t\t\tstyle.left = positionStickyLeft\n\t\t\t\t}\n\t\t\t} else if (onCanvas && (positionFixed || positionAbsolute)) {\n\t\t\t\tstyle.position = \"absolute\"\n\t\t\t}\n\t\t}\n\n\t\tprivate setElement = (element: HTMLDivElement | null) => {\n\t\t\tif (this.props.innerRef) {\n\t\t\t\tthis.props.innerRef.current = element\n\t\t\t}\n\n\t\t\tthis.setLayerElement(element)\n\t\t}\n\n\t\t// biome-ignore lint/suspicious/useGetterReturn: legacy text component\n\t\tget transformTemplate() {\n\t\t\tconst { _usesDOMRect, widthType, heightType, __fromCanvasComponent } = this.props\n\n\t\t\tif (this.props.transformTemplate) return this.props.transformTemplate\n\n\t\t\tconst frame = this.frame\n\n\t\t\tconst isDOMLayoutAutoSized = _usesDOMRect && (isAutoDimensionType(widthType) || isAutoDimensionType(heightType))\n\t\t\tconst hasTransformTemplate =\n\t\t\t\t!frame || !RenderTarget.hasRestrictions() || __fromCanvasComponent || isDOMLayoutAutoSized\n\n\t\t\tif (hasTransformTemplate) return transformTemplate(this.props.center)\n\t\t}\n\n\t\t/** Used by the ComponentContainerContext */\n\t\tprivate renderMain = (inCodeComponent: boolean) => {\n\t\t\tcountNodeRender()\n\n\t\t\tconst {\n\t\t\t\tfont,\n\t\t\t\tvisible,\n\t\t\t\talignment,\n\t\t\t\topacity,\n\t\t\t\tid,\n\t\t\t\tlayoutId,\n\t\t\t\tclassName,\n\t\t\t\ttransition,\n\t\t\t\tvariants,\n\t\t\t\tname,\n\t\t\t\t__fromCanvasComponent,\n\t\t\t\t_initialStyle,\n\t\t\t\twidthType: _widthType,\n\t\t\t\theightType: _heightType,\n\t\t\t\t_usesDOMRect,\n\t\t\t\tautoSize,\n\t\t\t\tstyle: styleProp,\n\t\t\t\tfontLoadStatus,\n\t\t\t\tmatchesCurrentRoute,\n\t\t\t\tpreload: _preload,\n\t\t\t\ttabIndex,\n\t\t\t\t...rest\n\t\t\t} = this.props\n\n\t\t\tif (!visible) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\t// We want to hide the Text component underneath the TextEditor when editing.\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: legacy text component\n\t\t\tconst isHidden = this.props.isEditable && this.props.environment!() === RenderTarget.canvas\n\n\t\t\tconst justifyContent = convertVerticalAlignment(this.props.verticalAlignment)\n\n\t\t\t// Add more styling and support vertical text alignment\n\t\t\tconst style: React.CSSProperties = {\n\t\t\t\toutline: \"none\",\n\t\t\t\tdisplay: \"flex\",\n\t\t\t\tflexDirection: \"column\",\n\t\t\t\tjustifyContent: justifyContent,\n\t\t\t\topacity: isHidden ? 0 : opacity,\n\t\t\t\tflexShrink: 0,\n\t\t\t}\n\n\t\t\t// QUICKFIX: Legacy code overrides pass the style from the text node as _initialStyle.\n\t\t\t// We have only consumed that object in FrameWithMotion but never in the Text component.\n\t\t\t// With the new WithTextStyle we need to render some CSS custom properties that are passed by the TextNode.\n\t\t\t// As the _initialStyle object contains additional styles that could break old projects we can't spread it.\n\t\t\tif (_initialStyle) {\n\t\t\t\tfor (const key in _initialStyle) {\n\t\t\t\t\tif (key.startsWith(\"--framer\")) {\n\t\t\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: legacy text component\n\t\t\t\t\t\tasRecord(style)[key] = asRecord(_initialStyle)[key] as any\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst dataProps = {\n\t\t\t\t\"data-framer-component-type\": \"Text\",\n\t\t\t\t\"data-framer-name\": rest[\"data-framer-name\"] ?? name,\n\t\t\t}\n\n\t\t\t// Compatibility for Smart Components generated before\n\t\t\t// https://github.com/framer/FramerStudio/pull/8270.\n\t\t\tif (autoSize) {\n\t\t\t\tasRecord(dataProps)[\"data-framer-component-text-autosized\"] = \"true\"\n\t\t\t}\n\n\t\t\tthis.collectLayout(style, inCodeComponent)\n\n\t\t\tcollectFiltersFromProps(this.props, style)\n\t\t\tcollectTextShadowsForProps(this.props, style)\n\n\t\t\tif (style.opacity === 1 || style.opacity === undefined) {\n\t\t\t\t// Wipe opacity setting if it's the default (1 or undefined)\n\t\t\t\tdelete style.opacity\n\t\t\t}\n\n\t\t\tlet rawHTML = this.props.rawHTML\n\t\t\tconst text = this.getOverrideText() || this.props.text\n\n\t\t\tif (isString(text)) {\n\t\t\t\tif (rawHTML) {\n\t\t\t\t\trawHTML = replaceDraftHTMLWithText(rawHTML, text)\n\t\t\t\t} else {\n\t\t\t\t\trawHTML = `<p style=\"font: ${font}\">${text}</p>`\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.props.style) {\n\t\t\t\tObject.assign(style, this.props.style)\n\t\t\t}\n\n\t\t\tconst centeringTransformTemplate = this.transformTemplate\n\t\t\tif (centeringTransformTemplate) Object.assign(dataProps, layoutHintDataPropsForCenter(this.props.center))\n\n\t\t\tif (rawHTML) {\n\t\t\t\tstyle.lineHeight = \"1px\"\n\t\t\t\tstyle.fontSize = \"0px\"\n\n\t\t\t\t// Hide the fonts while loading to avoid layout flashes\n\t\t\t\tif (RenderTarget.current() === RenderTarget.canvas && fontLoadStatus === \"loading\") {\n\t\t\t\t\tstyle.visibility = \"hidden\"\n\t\t\t\t}\n\n\t\t\t\t// On the canvas, color the text background red if a font could not be loaded\n\t\t\t\tif (RenderTarget.current() === RenderTarget.canvas && fontLoadStatus === \"timeout\") {\n\t\t\t\t\tstyle.backgroundColor = \"rgba(255, 0, 0, 0.3)\"\n\t\t\t\t}\n\n\t\t\t\tObject.assign(style, styleProp)\n\n\t\t\t\t// Old compiled smart components use the dedicated alignment prop which should get preference over the property in style\n\t\t\t\tif (alignment) asRecord(style)[\"--framer-text-alignment\"] = alignment\n\n\t\t\t\t// Only render a tabindex attribute if its explicitely requested.\n\t\t\t\tconst tabIndexProps = getTabIndexProps(tabIndex)\n\n\t\t\t\treturn (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tlayoutId={layoutId}\n\t\t\t\t\t\tid={id}\n\t\t\t\t\t\t{...tabIndexProps}\n\t\t\t\t\t\t{...dataProps}\n\t\t\t\t\t\t{...rest}\n\t\t\t\t\t\tstyle={style}\n\t\t\t\t\t\ttransformTemplate={centeringTransformTemplate}\n\t\t\t\t\t\t// biome-ignore lint/security/noDangerouslySetInnerHtml: intentional\n\t\t\t\t\t\tdangerouslySetInnerHTML={{ __html: rawHTML }}\n\t\t\t\t\t\tdata-center={this.props.center}\n\t\t\t\t\t\tclassName={cx(className, matchesCurrentRoute && \"isCurrent\")}\n\t\t\t\t\t\ttransition={transition}\n\t\t\t\t\t\tvariants={variants}\n\t\t\t\t\t\tref={this.setElement}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n})()\n\nexport const Text = /* @__PURE__ */ withLibraryCSS(TextInner)\n\n// Wrapping link tag is optional.\nconst linkTag = \"(?:<a[^>]*>)?\"\nconst linkClosingTag = \"(?:</a>)?\"\n// Outer tag can be div, span, or other semantic tag.\nconst outerTag = \"<[^>]+>\"\nconst outerClosingTag = \"</[^>]+>\"\n// Block tag can be div (older components), or span (newer components).\nconst blockTag = \"<(?:div|span)[^>]*>\"\nconst blockClosingTag = \"</(?:div|span)>\"\n// Insidie a block there is one or more tags for inline styles.\nconst inlineTag = \"<[^>]+>\"\nconst inlineClosingTag = \"</[^>]+>\"\nconst textContentRegex = /* @__PURE__ */ (() =>\n\tnew RegExp(\n\t\t`^(${linkTag}${outerTag}${blockTag}${inlineTag}).*?(${inlineClosingTag}).*?(${blockClosingTag}${outerClosingTag}${linkClosingTag})$`,\n\t\t//                                              ^^^ this is the content we want to replace\n\t\t//                                                                      ^^^ this is the content we want to discard\n\n\t\t\"su\", // let the \".\" also match newlines\n\t))()\n/**\n * If text is overriden in an override or by a variable, we take the rawHTML,\n * find the first styled span inside the first block, put the text in there, and\n * discard everything else. For example:\n *\n *     <p>\n *         <span>\n *             <span style=\"BOLD\">Hello </span>\n *             <span>World from the 1st block</span>\n *             <br>\n *         </span>\n *         <span>\n *             <!-- Second block is an empty line -->\n *             <span><br></span>\n *         </span>\n *         <span>\n *             <span>More text in third block</span>\n *             <br>\n *         </span>\n *     </p>\n *\n * will become:\n *\n *     <h1>\n *         <span>\n *             <span style=\"BOLD\">Text from the text prop, e.g., a variable or an override</span>\n *             <br>\n *         </span>\n *     </h1>\n */\nexport function replaceDraftHTMLWithText(rawHTML: string, text: string): string {\n\t// We're going to hell for parsing HTML with regex, but using a DOMParser\n\t// won't work during SSR...\n\treturn rawHTML.replace(\n\t\ttextContentRegex,\n\t\t(_, openingTags, inlineClosingTag, closingTags) => openingTags + text + inlineClosingTag + \"<br>\" + closingTags,\n\t)\n}\n\nfunction convertVerticalAlignment(verticalAlignment: TextVerticalAlignment): \"center\" | \"flex-start\" | \"flex-end\" {\n\tswitch (verticalAlignment) {\n\t\tcase \"top\":\n\t\t\treturn \"flex-start\"\n\t\tcase \"center\":\n\t\t\treturn \"center\"\n\t\tcase \"bottom\":\n\t\t\treturn \"flex-end\"\n\t}\n}\n\n// biome-ignore lint/complexity/noBannedTypes: legacy text component\nfunction getTabIndexProps(tabIndex: undefined | number): { readonly tabIndex: number } | {} {\n\tif (tabIndex === undefined) return {}\n\n\treturn { tabIndex }\n}\n", "import React from \"react\"\nimport { fontStore } from \"./fontStore.ts\"\n\nexport type FontLoadStatus = \"loading\" | \"done\" | \"timeout\"\n\n/**\n * @internal\n * Hook to subscribe to font store and get the current font loading status.\n * @deprecated only used in legacy text\n * */\nexport function useFontLoadStatus(fontSelectors: string[] = [], timeout = 5000): FontLoadStatus {\n\tconst missingFontSelectors = fontSelectors.filter(s => !fontStore.isSelectorLoaded(s))\n\tconst [fontLoadStatus, setFontLoadStatus] = React.useState<FontLoadStatus>(\n\t\tmissingFontSelectors.length ? \"loading\" : \"done\",\n\t)\n\n\t// This is a poor mans version of shallow equal both arrays\n\t// We need both the used and the missing font selectors\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: deprecated\n\tReact.useEffect(() => {\n\t\tif (!missingFontSelectors.length) return\n\n\t\t// This may need startTransition to avoid synchronous, blocking re-renders.\n\t\t// However, this component is only used in the deprecated text component. Let's not modify the behavior.\n\t\t// eslint-disable-next-line framer-studio/no-setstate-without-transition -- deprecated hook\n\t\tsetFontLoadStatus(\"loading\")\n\n\t\tconst timer = setTimeout(() => {\n\t\t\t// This may need startTransition to avoid synchronous, blocking re-renders.\n\t\t\t// However, this component is only used in the deprecated text component. Let's not modify the behavior.\n\t\t\t// eslint-disable-next-line framer-studio/no-setstate-without-transition -- deprecated hook\n\t\t\tsetFontLoadStatus(\"timeout\")\n\t\t}, timeout)\n\n\t\t// @TODO: Ignored for now, but should re-check later.\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\tfontStore.loadFonts(missingFontSelectors).then(() => {\n\t\t\tclearTimeout(timer)\n\t\t\t// This may need startTransition to avoid synchronous, blocking re-renders.\n\t\t\t// However, this component is only used in the deprecated text component. Let's not modify the behavior.\n\t\t\t// eslint-disable-next-line framer-studio/no-setstate-without-transition -- deprecated hook\n\t\t\tsetFontLoadStatus(\"done\")\n\t\t})\n\t}, [fontSelectors.join(\", \"), missingFontSelectors.join(\", \")])\n\n\treturn fontLoadStatus\n}\n", "import { motion } from \"framer-motion\"\nimport { useTickerItem } from \"./motionplus/Ticker.tsx\"\n\n/**\n * @internal\n */\nexport interface TickerItemProps {\n\twidth?: string\n\theight?: string\n\tchildren: React.ReactNode\n}\n\n/**\n * @internal\n * To support relative sizes for ticker items we have to control the ticker item that is rendered in the ticker.\n * Ticker provides the props to us and we override the width and height to be relative.\n */\nexport function TickerItem({ height, width, children }: TickerItemProps) {\n\tconst itemProps = useSafeTickerItem()\n\tif (!itemProps || !children) return children\n\n\tconst { props } = itemProps\n\n\treturn (\n\t\t<motion.li\n\t\t\t{...props}\n\t\t\t// for percentage based sizing we set the height and width here, but other dimension types will be on the child element\n\t\t\t// and we will fit that instead\n\t\t\tstyle={{ ...props.style, width: width ?? \"fit-content\", height: height ?? \"fit-content\" }}\n\t\t>\n\t\t\t{children}\n\t\t</motion.li>\n\t)\n}\n\nfunction useSafeTickerItem() {\n\ttry {\n\t\t// biome-ignore lint/correctness/useHookAtTopLevel: not conditional, the same number of hooks are called whether an error occurs or not\n\t\tconst value = useTickerItem()\n\t\treturn value\n\t} catch {\n\t\t// not inside ticker so possibly a variant has no ticker effect, safe to return nothing\n\t\treturn undefined\n\t}\n}\n", "// used to generate id's and links to ids, they are stable per key, but only on runtime\n\nconst keys = new Map<string, InternalID>()\n\n/** @internal */\nexport class InternalID {\n\tprivate _link: string | null = null\n\tprivate _urllink: string | null = null\n\n\tconstructor(public id: string) {}\n\n\tadd(str: string): InternalID {\n\t\treturn InternalID.forKey(this.id + str)\n\t}\n\n\ttoString() {\n\t\treturn this.id\n\t}\n\n\tget link() {\n\t\tconst res = this._link\n\t\tif (res) return res\n\t\treturn (this._link = \"#\" + this.id)\n\t}\n\tget urlLink() {\n\t\tconst res = this._urllink\n\t\tif (res) return res\n\t\treturn (this._urllink = \"url(#\" + this.id + \")\")\n\t}\n\tstatic forKey(key: string): InternalID {\n\t\tlet res = keys.get(key)\n\t\tif (res) return res\n\t\tres = new InternalID(\"a\" + (1000 + keys.size) + \"z\")\n\t\tkeys.set(key, res)\n\t\treturn res\n\t}\n}\n", "const first = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\"\nconst letters = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_\"\n\nfunction f(): string {\n\treturn first[Math.floor(Math.random() * first.length)] as string\n}\n\nfunction l(): string {\n\treturn letters[Math.floor(Math.random() * letters.length)] as string\n}\n\n// most js engines should be able to inline upto 64 / 8 - 1 = 7 characters\nexport function randomID(): string {\n\treturn f() + l() + l() + l() + l() + l() + l() + l() + l()\n}\n", "import { assert } from \"./../../utils/assert.ts\"\nimport { Point } from \"./Point.ts\"\nimport { randomID } from \"./randomID.ts\"\n\nexport type HandleMirroring = \"straight\" | \"symmetric\" | \"disconnected\" | \"asymmetric\"\n\nconst PathSegmentOuter = /* @__PURE__ */ (() => {\n\t// We\u2019re wrapping the whole PathSegment class with `@__PURE__` because esbuild\n\t// can\u2019t compile static class properties in a tree-shakeable way: https://github.com/evanw/esbuild/issues/3765.\n\t// The wrapper allows them to stay in the IIFE and be tree-shaken.\n\t// If/when esbuild fixes that issue, we can remove `export type PathSegment`\n\t// and `export const PathSegment` and just export the class directly.\n\tclass PathSegment {\n\t\t// #region withClassDiscriminator\n\t\t// NOTE: this implementation carefully copies the implementation of `withClassDiscriminator`\n\t\t// from Vekter. If making changes here, make sure to sync them to `withClassDiscriminator` as well.\n\t\treadonly __class = \"PathSegment\" as string\n\t\tstatic displayName = \"WithClassDiscriminatorMixin(PathSegment)\"\n\t\t// #endregion\n\n\t\tdeclare readonly id: string\n\t\treadonly x: number = 0 // The anchor point of the segment.\n\t\treadonly y: number = 0\n\t\treadonly handleMirroring: HandleMirroring = \"straight\"\n\t\treadonly handleOutX: number = 0 // Describes the out tangent of the segment.\n\t\treadonly handleOutY: number = 0\n\t\treadonly handleInX: number = 0 // Describes the in tangent of the segment.\n\t\treadonly handleInY: number = 0\n\t\treadonly radius: number = 0\n\n\t\tconstructor(value?: Partial<PathSegment>) {\n\t\t\tif (value) {\n\t\t\t\tObject.assign(this, value)\n\t\t\t}\n\t\t\tif (!value?.id) {\n\t\t\t\tthis.id = randomID()\n\t\t\t}\n\t\t}\n\n\t\tmerge(value: Partial<PathSegment>): PathSegment {\n\t\t\treturn Object.assign(Object.create(Object.getPrototypeOf(this)), this, value)\n\t\t}\n\n\t\tstatic point = (pathSegment: PathSegment) => {\n\t\t\treturn { x: pathSegment.x, y: pathSegment.y }\n\t\t}\n\n\t\tstatic handleOut = (pathSegment: PathSegment) => {\n\t\t\treturn { x: pathSegment.handleOutX, y: pathSegment.handleOutY }\n\t\t}\n\n\t\tstatic handleIn = (pathSegment: PathSegment) => {\n\t\t\treturn { x: pathSegment.handleInX, y: pathSegment.handleInY }\n\t\t}\n\n\t\tstatic calculatedHandleOut = (pathSegment: PathSegment): Point => {\n\t\t\tswitch (pathSegment.handleMirroring) {\n\t\t\t\tcase \"symmetric\":\n\t\t\t\tcase \"disconnected\":\n\t\t\t\tcase \"asymmetric\":\n\t\t\t\t\treturn Point.add(PathSegment.point(pathSegment), PathSegment.handleOut(pathSegment))\n\t\t\t\tdefault:\n\t\t\t\t\treturn { x: pathSegment.x, y: pathSegment.y }\n\t\t\t}\n\t\t}\n\n\t\tstatic calculatedHandleIn = (pathSegment: PathSegment): Point => {\n\t\t\tswitch (pathSegment.handleMirroring) {\n\t\t\t\tcase \"symmetric\":\n\t\t\t\t\treturn Point.subtract(PathSegment.point(pathSegment), PathSegment.handleOut(pathSegment))\n\t\t\t\tcase \"disconnected\":\n\t\t\t\tcase \"asymmetric\":\n\t\t\t\t\treturn Point.add(PathSegment.point(pathSegment), PathSegment.handleIn(pathSegment))\n\t\t\t\tdefault:\n\t\t\t\t\treturn PathSegment.point(pathSegment)\n\t\t\t}\n\t\t}\n\n\t\tstatic curveDefault = (points: readonly PathSegment[], index: number): Point => {\n\t\t\tif (points.length > 2) {\n\t\t\t\tlet pointBefore: PathSegment | undefined\n\t\t\t\tlet pointAfter: PathSegment | undefined\n\n\t\t\t\tif (index === 0) {\n\t\t\t\t\tpointBefore = points[points.length - 1]\n\t\t\t\t} else {\n\t\t\t\t\tpointBefore = points[index - 1]\n\t\t\t\t}\n\n\t\t\t\tif (index === points.length - 1) {\n\t\t\t\t\tpointAfter = points[0]\n\t\t\t\t} else {\n\t\t\t\t\tpointAfter = points[index + 1]\n\t\t\t\t}\n\n\t\t\t\tassert(pointBefore, \"pointBefore should be defined\")\n\t\t\t\tassert(pointAfter, \"pointAfter should be defined\")\n\t\t\t\tconst delta = Point.subtract(PathSegment.point(pointAfter), PathSegment.point(pointBefore))\n\t\t\t\treturn { x: delta.x / 4, y: delta.y / 4 }\n\t\t\t}\n\n\t\t\treturn { x: 10, y: 10 }\n\t\t}\n\t}\n\t// #region withClassDiscriminator\n\t// NOTE: this implementation carefully copies the implementation of `withClassDiscriminator`\n\t// from Vekter. If making changes here, make sure to sync them to `withClassDiscriminator` as well.\n\t// @ts-expect-error - __class is readonly\n\tPathSegment.prototype.__class = \"PathSegment\"\n\t// #endregion\n\n\treturn PathSegment\n})()\n\n// Confused how two definitions with the same name work? See https://stackoverflow.com/a/67697999\n/** @internal */\nexport type PathSegment = InstanceType<typeof PathSegmentOuter>\n/** @internal */\nexport const PathSegment = PathSegmentOuter\n", "import { assert } from \"../../utils/assert.ts\"\nimport { PathSegment } from \"../types/PathSegment.ts\"\nimport { RenderTarget } from \"../types/RenderEnvironment.ts\"\nimport { isFiniteNumber } from \"../utils/isFiniteNumber.ts\"\nimport { roundedNumberString } from \"../utils/roundedNumber.ts\"\n\n/**\n * @internal\n */\nexport interface WithPath {\n\tpathSegments: readonly PathSegment[]\n\tpathClosed: boolean\n}\n\nconst key: keyof WithPath = \"pathSegments\"\n\n/**\n * @internal\n */\nexport function withPath(target: any): target is WithPath {\n\treturn key in target\n}\n\n/**\n * @internal\n */\nexport type WithPaths = WithPath[]\n\n/**\n * @internal\n */\nexport const pathDefaults: WithPath = {\n\tpathSegments: [],\n\tpathClosed: false,\n}\n\n/**\n * @internal\n */\nexport function toSVGPath(\n\twithPaths: WithPaths | WithPath,\n\ttranslate: { x: number; y: number } = { x: 0, y: 0 },\n\tcanvasMode: RenderTarget = RenderTarget.canvas,\n): string {\n\tlet pathElements: (number | string)[] = []\n\n\tlet paths: WithPaths = []\n\n\tif (Array.isArray(withPaths)) {\n\t\tpaths = withPaths\n\t} else {\n\t\tpaths = [withPaths]\n\t}\n\n\tpaths.forEach(path => {\n\t\tconst { pathClosed, pathSegments } = path\n\t\tconst segmentCount = pathSegments.length\n\t\tif (segmentCount === 0) return \"\"\n\n\t\tfor (let i = 0; i < segmentCount; i++) {\n\t\t\tconst segment = pathSegments[i]\n\t\t\tassert(segment, \"Path segment must be defined\")\n\t\t\tlet nextSegment: PathSegment | undefined\n\t\t\tlet prevSegment: PathSegment | undefined\n\n\t\t\tconst isFirstSegment = i === 0\n\t\t\tconst isLastSegment = i === segmentCount - 1\n\n\t\t\tif (!isLastSegment) {\n\t\t\t\tnextSegment = pathSegments[i + 1]\n\t\t\t} else if (pathClosed) {\n\t\t\t\tnextSegment = pathSegments[0]\n\t\t\t}\n\n\t\t\tif (!isFirstSegment) {\n\t\t\t\tprevSegment = pathSegments[i - 1]\n\t\t\t} else if (pathClosed) {\n\t\t\t\tprevSegment = pathSegments[segmentCount - 1]\n\t\t\t}\n\n\t\t\tif (i === 0) {\n\t\t\t\tpathElements.push(\"M\")\n\t\t\t} else if (prevSegment && isStraightCurve(prevSegment, segment)) {\n\t\t\t\tpathElements.push(\"L\")\n\t\t\t}\n\n\t\t\tpathElements.push(segment.x + translate.x, segment.y + translate.y)\n\n\t\t\tif (nextSegment && !isStraightCurve(segment, nextSegment)) {\n\t\t\t\tconst handleOut = PathSegment.calculatedHandleOut(segment)\n\t\t\t\tconst handleIn = PathSegment.calculatedHandleIn(nextSegment)\n\t\t\t\tpathElements.push(\n\t\t\t\t\t\"C\",\n\t\t\t\t\thandleOut.x + translate.x,\n\t\t\t\t\thandleOut.y + translate.y,\n\t\t\t\t\thandleIn.x + translate.x,\n\t\t\t\t\thandleIn.y + translate.y,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tif (isLastSegment && nextSegment) {\n\t\t\t\tif (isStraightCurve(segment, nextSegment)) {\n\t\t\t\t\tpathElements.push(\"Z\")\n\t\t\t\t} else {\n\t\t\t\t\tpathElements.push(nextSegment.x + translate.x, nextSegment.y + translate.y, \"Z\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\tif (canvasMode === RenderTarget.export || canvasMode === RenderTarget.preview) {\n\t\tpathElements = pathElements.map(value => (isFiniteNumber(value) ? roundedNumberString(value, 3) : value))\n\t}\n\treturn pathElements.join(\" \")\n}\n\n/**\n * @internal\n */\nexport function isStraightCurve(fromSegment: PathSegment, toSegment: PathSegment): boolean {\n\tconst fromStraight =\n\t\tfromSegment.handleMirroring === \"straight\" || (fromSegment.handleOutX === 0 && fromSegment.handleOutY === 0)\n\tconst toStraight =\n\t\ttoSegment.handleMirroring === \"straight\" || (toSegment.handleInX === 0 && toSegment.handleInY === 0)\n\treturn fromStraight && toStraight\n}\n", "import type React from \"react\"\n\n// These are the default values for the properties as found on the\n// browser's SVG element:\nexport const svgElementAttributeDefaults: React.SVGAttributes<SVGElement> = {\n\tstroke: \"none\",\n\tstrokeWidth: 1,\n\tstrokeLinecap: \"butt\",\n\tstrokeLinejoin: \"miter\",\n\tstrokeMiterlimit: 4,\n\tstrokeDasharray: \"0\",\n\tstrokeDashoffset: 0,\n\tstrokeOpacity: 1,\n\tfill: \"black\",\n\tfillRule: \"nonzero\",\n\tfillOpacity: 1,\n}\n", "import type { Rect } from \"../types/Rect.ts\"\nimport type { TransformValues } from \"../types/TransformValues.ts\"\n\ntype CreateTransformValuesMode = \"asIs\" | \"resetXY\"\n\nfunction createTransformValues(baseTransform: TransformValues, mode: CreateTransformValuesMode) {\n\tlet { x, y } = baseTransform\n\tconst { width, height, rotation } = baseTransform\n\n\tif (mode === \"resetXY\") {\n\t\tx = 0\n\t\ty = 0\n\t}\n\n\treturn { x, y, width, height, rotation }\n}\n\nfunction getTransformMode(isRootVectorNode: boolean, includeTransform?: boolean): CreateTransformValuesMode {\n\tif (includeTransform !== undefined) {\n\t\tif (includeTransform) {\n\t\t\treturn \"asIs\"\n\t\t}\n\t} else {\n\t\tif (!isRootVectorNode) {\n\t\t\treturn \"asIs\"\n\t\t}\n\t}\n\n\treturn \"resetXY\"\n}\n\nexport function transformValues(\n\trect: Rect,\n\trotation: number,\n\tisRootVectorNode: boolean,\n\tincludeTransform?: boolean,\n): TransformValues {\n\tconst transformMode = getTransformMode(isRootVectorNode, includeTransform)\n\tconst baseTransform = { ...rect, rotation: includeTransform === false ? 0 : rotation }\n\tconst transform = createTransformValues(baseTransform, transformMode)\n\treturn transform\n}\n", "import type { TransformValues } from \"../types/TransformValues.ts\"\nimport { roundedNumberString } from \"./roundedNumber.ts\"\n\n/** @internal */\nexport function transformString(transform: TransformValues | undefined): string | undefined {\n\tif (transform === undefined) {\n\t\treturn undefined\n\t}\n\tconst { x, y, rotation, width, height } = transform\n\tlet result: string | undefined\n\tif (x !== 0 || y !== 0) {\n\t\tresult = `translate(${roundedNumberString(x, 3)} ${roundedNumberString(y, 3)})`\n\t}\n\tif (rotation !== 0) {\n\t\tconst roundedRotation = roundedNumberString(rotation, 4)\n\t\tconst roundedWidth = roundedNumberString(width / 2, 3)\n\t\tconst roundedHeight = roundedNumberString(height / 2, 3)\n\t\tconst rotationString = `rotate(${roundedRotation} ${roundedWidth} ${roundedHeight})`\n\t\tresult = result ? `${result} ${rotationString}` : rotationString\n\t}\n\treturn result\n}\n", "import { Component } from \"react\"\nimport type {\n\tLinearGradientElementProperties,\n\tRadialGradientElementProperties,\n} from \"../utils/elementPropertiesForGradient.ts\"\n\nexport class LinearGradientElement extends Component<LinearGradientElementProperties, object> {\n\toverride render() {\n\t\tconst { id, stops, x1, x2, y1, y2 } = this.props\n\t\treturn (\n\t\t\t<linearGradient id={id} x1={x1} x2={x2} y1={y1} y2={y2}>\n\t\t\t\t{stops.map((stop, idx) => {\n\t\t\t\t\t// biome-ignore lint/suspicious/noArrayIndexKey: Intentional\n\t\t\t\t\treturn <stop key={idx} offset={stop.position} stopColor={stop.color} stopOpacity={stop.alpha} />\n\t\t\t\t})}\n\t\t\t</linearGradient>\n\t\t)\n\t}\n}\n\nexport class RadialGradientElement extends Component<RadialGradientElementProperties, object> {\n\toverride render() {\n\t\tconst { centerAnchorX, centerAnchorY, id, widthFactor, heightFactor, stops } = this.props\n\t\treturn (\n\t\t\t<radialGradient\n\t\t\t\tid={id}\n\t\t\t\tcy={centerAnchorY}\n\t\t\t\tcx={centerAnchorX}\n\t\t\t\tr={widthFactor}\n\t\t\t\tgradientTransform={getRadialGradientTransform(heightFactor, widthFactor, centerAnchorX, centerAnchorY)}\n\t\t\t>\n\t\t\t\t{stops.map((stop, idx) => {\n\t\t\t\t\t// biome-ignore lint/suspicious/noArrayIndexKey: Intentional\n\t\t\t\t\treturn <stop key={idx} offset={stop.position} stopColor={stop.color} stopOpacity={stop.alpha} />\n\t\t\t\t})}\n\t\t\t</radialGradient>\n\t\t)\n\t}\n}\n\nexport function getRadialGradientTransform(\n\theightFactor: number,\n\twidthFactor: number,\n\tcenterAnchorX: number,\n\tcenterAnchorY: number,\n) {\n\t// When the widthFactor is 0, we want the scale factor to be big enough, without using a 0 divisor.\n\tconst scaleWidth = widthFactor ? heightFactor / widthFactor : 1000\n\treturn `translate(${centerAnchorX}, ${centerAnchorY}) scale(1 ${\n\t\tscaleWidth\n\t}) translate(-${centerAnchorX}, -${centerAnchorY})`\n}\n", "import { isSafari } from \"@framerjs/shared/src/environment.ts\"\nimport React from \"react\"\nimport { useMeasureLayout } from \"../utils/useMeasureLayout.ts\"\nimport { ComponentContainerContext } from \"./ComponentContainerContext.tsx\"\nimport type { DOMLayoutProps } from \"./Layer.tsx\"\n\n/**\n * @internal\n */\nexport interface SVGRootProps extends DOMLayoutProps {\n\twidth: number\n\theight: number\n\tleft: number\n\ttop: number\n\tid?: string | undefined\n\tstyle?: React.CSSProperties\n}\n\n/**\n * @internal\n */\nexport const SVGRoot = (props: React.PropsWithChildren<SVGRootProps>) => {\n\tconst { id, children, left, width, height, top, style, _needsMeasure } = props\n\n\tconst inCodeComponent = React.useContext(ComponentContainerContext)\n\tconst ref = React.useRef<SVGSVGElement>(null)\n\n\tuseMeasureLayout(\n\t\t{\n\t\t\tid,\n\t\t\t// SVGRoot won't be rendered if the node is invisible.\n\t\t\tvisible: true,\n\t\t\t_needsMeasure,\n\t\t},\n\t\tref,\n\t)\n\t/**\n\t * @TODO These styles need to animate if changed by a Generated Variant.\n\t * However, we cannot use `animate` since that will block the children\n\t * from reacting to the active variant. We also have to consider canvas\n\t * performance.\n\t */\n\tconst svgStyle: React.CSSProperties = {\n\t\tposition: \"absolute\",\n\t\twidth,\n\t\theight,\n\t\tleft,\n\t\ttop,\n\t\toverflow: \"visible\",\n\t\tdisplay: \"block\",\n\t\t...style,\n\t}\n\n\tconst svgProps: React.SVGProps<SVGSVGElement> = {\n\t\t// Avoid duplicating IDs when the SVG is rendered through slots. We only need the ID for\n\t\t// measurement so code component descendants don't matter.\n\t\tid: inCodeComponent ? undefined : id,\n\t\tviewBox: `0 0 ${width} ${height}`,\n\t\tref,\n\t}\n\n\t// On a DPR=1 screen, browsers won't render SVG paths on half-pixels (both for position and\n\t// size), they snap them to the nearest full pixel. As a workaround for sub-pixel sizes, we\n\t// scale the SVG by 2x and counter-scale its descendants, so that the transform forces shapes\n\t// with sub-pixel sizes to sit on half-pixels instead. And then we translate the shape back to\n\t// the correct position as it should be without the browser rounding.\n\t//\n\t// Safari in particular behaves inconsistently:\n\t// - On DPR=1 screens, it renders sub-pixel sizes correctly but requires position correction via\n\t//   translate.\n\t// - On DPR=2 screens, it rounds sub-pixel sizes (why?!) but handles sub-pixel positions fine\n\t//   without translation.\n\tconst needsScale = isSafari() ? window.devicePixelRatio !== 1 : window.devicePixelRatio === 1\n\tconst needsTranslate = window.devicePixelRatio === 1\n\tif (!needsScale && !needsTranslate) {\n\t\treturn (\n\t\t\t<svg role=\"presentation\" {...svgProps} style={svgStyle}>\n\t\t\t\t{children}\n\t\t\t</svg>\n\t\t)\n\t}\n\n\tconst svgTransform = needsScale ? { transform: \"scale(2)\" } : undefined\n\n\treturn (\n\t\t<svg role=\"presentation\" {...svgProps} style={{ ...svgStyle, ...svgTransform }}>\n\t\t\t<g\n\t\t\t\tstyle={{\n\t\t\t\t\t// The default value of transform-origin is 0 0 for all SVG elements except\n\t\t\t\t\t// for root <svg> elements:\n\t\t\t\t\t// https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Attribute/transform-origin\n\t\t\t\t\ttransformOrigin: \"center\",\n\t\t\t\t\ttransform: getShapeTransform(needsScale, needsTranslate, left, top),\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</g>\n\t\t</svg>\n\t)\n}\n\nfunction getShapeTransform(needsScale: boolean, needsTranslate: boolean, left: number, top: number) {\n\tconst l = Math.floor(left) - left\n\tconst t = Math.floor(top) - top\n\n\tconst transforms: string[] = []\n\t// It's important that the scale applies later (transforms operate from right to left), so that\n\t// the final visual translate would be halved as well, putting the scaled shape back to the\n\t// origin.\n\tif (needsScale) transforms.push(\"scale(0.5)\")\n\tif (needsTranslate && (l || t)) transforms.push(`translate(${l}px, ${t}px)`)\n\treturn transforms.length ? transforms.join(\" \") : undefined\n}\n", "import type { Transition, Variants } from \"framer-motion\"\nimport { motion } from \"framer-motion\"\nimport type React from \"react\"\nimport { asRecord } from \"../../utils/asRecord.ts\"\nimport { InternalID } from \"../../utils/internalId.ts\"\nimport { isString } from \"../../utils/utils.ts\"\nimport { shadowForShape } from \"../style/shadow.tsx\"\nimport type { FillProperties } from \"../traits/Fill.ts\"\nimport type { WithPath } from \"../traits/Path.ts\"\nimport { toSVGPath } from \"../traits/Path.ts\"\nimport { BackgroundImage } from \"../types/BackgroundImage.ts\"\nimport { Color, ConvertColor } from \"../types/Color/index.ts\"\nimport { LinearGradient, RadialGradient } from \"../types/Gradient.ts\"\nimport type { Rect } from \"../types/Rect.ts\"\nimport { RenderEnvironment, RenderTarget } from \"../types/RenderEnvironment.ts\"\nimport type { BoxShadow } from \"../types/Shadow.ts\"\nimport type { LineCap, LineJoin } from \"../types/Stroke.ts\"\nimport type { StrokeAlignment } from \"../types/StrokeAlignment.ts\"\nimport { svgElementAttributeDefaults } from \"../types/svgElementAttributeDefaults.ts\"\nimport { transformValues } from \"../utils/createTransformValues.ts\"\nimport type {\n\tLinearGradientElementProperties,\n\tRadialGradientElementProperties,\n} from \"../utils/elementPropertiesForGradient.ts\"\nimport {\n\telementPropertiesForLinearGradient,\n\telementPropertiesForRadialGradient,\n} from \"../utils/elementPropertiesForGradient.ts\"\nimport { imagePatternPropsForFill } from \"../utils/imagePatternPropsForFill.tsx\"\nimport { countNodeRender } from \"../utils/performanceDebugging.ts\"\nimport { transformString } from \"../utils/transformString.ts\"\nimport { LinearGradientElement, RadialGradientElement } from \"./GradientElement.tsx\"\nimport type { ImagePatternElementProperties } from \"./ImagePatternElement.tsx\"\nimport { ImagePatternElement } from \"./ImagePatternElement.tsx\"\nimport type { LayerProps } from \"./Layer.tsx\"\nimport { Layer } from \"./Layer.tsx\"\nimport { SVGRoot } from \"./SVGRoot.tsx\"\n\n/**\n * @internal\n */\nexport interface VectorProps extends Partial<FillProperties> {\n\tisRootVectorNode: boolean\n\tname: string | null\n\tincludeTransform?: boolean\n\tdefaultFillColor?: string\n\tdefaultStrokeColor?: string\n\tdefaultStrokeWidth?: number\n\tdefaultStrokeAlignment?: StrokeAlignment\n\tx: number\n\ty: number\n\tleft: number\n\ttop: number\n\twidth: number\n\theight: number\n\trotation: number\n\t/**\n\t * For simplicity in Framer, accept `rotate`, (the framer-motion\n\t * property key), and prefer it when provided over the `rotation` prop.\n\t */\n\trotate?: number\n\topacity?: number\n\tcalculatedPath: WithPath[]\n\tcalculatedPathBoundingBox: Rect\n\td?: string\n\tinsideStroke: boolean\n\tstrokeEnabled: boolean\n\tstrokeClipId?: string\n\tstrokeWidth?: number\n\tidAttribute?: string\n\tshadows: BoxShadow[]\n\tstrokeAlpha: number\n\tlineCap: LineCap\n\tlineJoin: LineJoin\n\tstrokeColor: string\n\tstrokeMiterLimit: number\n\tstrokeDashArray: string\n\tstrokeDashOffset: number\n\tvariants?: Variants\n\ttransition?: Transition\n\tfillOpacity?: number\n\tvisible?: boolean\n}\n\n/**\n * @internal\n */\nexport interface VectorProperties extends VectorProps, LayerProps {\n\tstyle?: React.CSSProperties\n}\n\n// This type is used to collect attributes for both <use> and <motion.path>,\n// which is why we use SVGElement (the shared ancestor of SVGUseElement and\n// SVGPathElement) as the generic type for SVGAttributes. From this type we omit\n// all the keys from the DOMAttributes type, which contains handlers that we\n// currently do not set on this attributes type. If included, they would prevent\n// us from using one combined type as attributes for the two tags, because these\n// handlers are generic to the element.\ntype SVGStrokeAttributes = Omit<React.SVGAttributes<SVGElement>, keyof React.DOMAttributes<SVGElement> | \"values\">\n\ndeclare class VectorType extends Layer<VectorProperties, object> {\n\tstatic defaultVectorProps: VectorProps\n\tstatic readonly defaultProps: VectorProperties\n}\n\n/**\n * @internal\n */\nexport const Vector: typeof VectorType = /* @__PURE__ */ (() => {\n\treturn class VectorInner extends Layer<VectorProperties, object> {\n\t\tstatic defaultVectorProps: VectorProps = {\n\t\t\tisRootVectorNode: false,\n\t\t\tname: null,\n\t\t\tincludeTransform: undefined,\n\t\t\tdefaultFillColor: undefined,\n\t\t\tdefaultStrokeColor: undefined,\n\t\t\tdefaultStrokeWidth: undefined,\n\t\t\tdefaultStrokeAlignment: \"center\",\n\t\t\twidth: 100,\n\t\t\theight: 100,\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\tleft: 0,\n\t\t\ttop: 0,\n\t\t\trotation: 0,\n\t\t\trotate: undefined,\n\t\t\topacity: undefined,\n\t\t\tcalculatedPath: [],\n\t\t\tcalculatedPathBoundingBox: { x: 0, y: 0, width: 0, height: 0 },\n\t\t\td: undefined,\n\t\t\tinsideStroke: false,\n\t\t\tstrokeEnabled: true,\n\t\t\tstrokeClipId: undefined,\n\t\t\tstrokeWidth: undefined,\n\t\t\tidAttribute: undefined,\n\t\t\ttransition: undefined,\n\t\t\tshadows: [],\n\t\t\tstrokeAlpha: 1,\n\t\t\tlineCap: \"butt\",\n\t\t\tstrokeColor: \"#0AF\",\n\t\t\tlineJoin: \"miter\",\n\t\t\tstrokeMiterLimit: 4,\n\t\t\tstrokeDashArray: \"0\",\n\t\t\tstrokeDashOffset: 0,\n\t\t\tfill: \"rgba(0,170,255,0.5)\",\n\t\t\tvisible: undefined,\n\t\t}\n\n\t\tstatic override readonly defaultProps: VectorProperties = {\n\t\t\t...Layer.defaultProps,\n\t\t\t...VectorInner.defaultVectorProps,\n\t\t}\n\n\t\toverride render(): React.ReactElement<unknown> | null {\n\t\t\tcountNodeRender()\n\n\t\t\tconst {\n\t\t\t\topacity,\n\t\t\t\tcalculatedPath,\n\t\t\t\tcalculatedPathBoundingBox,\n\t\t\t\td,\n\t\t\t\tinsideStroke,\n\t\t\t\tstrokeEnabled,\n\t\t\t\tstrokeClipId,\n\t\t\t\tstrokeWidth,\n\t\t\t\tidAttribute,\n\t\t\t\tshadows,\n\t\t\t\tname,\n\t\t\t\tincludeTransform,\n\t\t\t\tisRootVectorNode,\n\t\t\t\trotation,\n\t\t\t\tid,\n\t\t\t\tlineCap,\n\t\t\t\tlineJoin,\n\t\t\t\tstrokeColor,\n\t\t\t\tstrokeMiterLimit,\n\t\t\t\tstrokeDashArray,\n\t\t\t\tstrokeDashOffset,\n\t\t\t\tfill,\n\t\t\t\tvariants,\n\t\t\t\ttransition,\n\t\t\t\tfillOpacity,\n\t\t\t\tvisible,\n\t\t\t\tx,\n\t\t\t\ty,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t} = this.props\n\t\t\tif (!visible) return null\n\t\t\tif (!id || !strokeClipId) return null\n\n\t\t\tconst rotate = this.props.rotate ?? rotation ?? 0\n\t\t\tconst { target } = RenderEnvironment\n\t\t\tconst rect = { x, y, width, height }\n\t\t\t/**\n\t\t\t * @TODO For Vectors to animate smoothly in Generated Components, we\n\t\t\t * need to reconsider how we set this transform. This transform needs to\n\t\t\t * be set on changes for the image fill to update, but also used in an\n\t\t\t * `initial` prop, and set by `variants` so that rotation animates. We\n\t\t\t * also have to consider canvas performance.\n\t\t\t */\n\t\t\tconst transform = transformValues(rect, rotate, isRootVectorNode, includeTransform)\n\n\t\t\tlet vectorFill: string | undefined\n\t\t\tlet fillAlpha = 0\n\t\t\tlet imagePattern: ImagePatternElementProperties | undefined\n\t\t\tlet linearGradient: LinearGradientElementProperties | undefined\n\t\t\tlet radialGradient: RadialGradientElementProperties | undefined\n\n\t\t\tif (isString(fill) || Color.isColorObject(fill)) {\n\t\t\t\tconst fillColor = Color.isColorObject(fill) ? fill.initialValue || Color.toRgbString(fill) : fill\n\t\t\t\tif (fillColor !== \"transparent\") {\n\t\t\t\t\tvectorFill = fillColor\n\t\t\t\t\tfillAlpha = ConvertColor.getAlpha(vectorFill)\n\t\t\t\t}\n\t\t\t} else if (LinearGradient.isLinearGradient(fill)) {\n\t\t\t\tlinearGradient = elementPropertiesForLinearGradient(fill, id)\n\t\t\t\tvectorFill = `url(#${linearGradient.id})`\n\t\t\t\tfillAlpha = 1\n\t\t\t} else if (RadialGradient.isRadialGradient(fill)) {\n\t\t\t\tradialGradient = elementPropertiesForRadialGradient(fill, id)\n\t\t\t\tvectorFill = `url(#${radialGradient.id})`\n\t\t\t\tfillAlpha = 1\n\t\t\t} else if (BackgroundImage.isImageObject(fill)) {\n\t\t\t\timagePattern = imagePatternPropsForFill(fill, transform, id, includeTransform)\n\n\t\t\t\tif (imagePattern) {\n\t\t\t\t\tvectorFill = `url(#${imagePattern.id})`\n\t\t\t\t\tfillAlpha = 1\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (vectorFill === svgElementAttributeDefaults.fill) {\n\t\t\t\tvectorFill = undefined\n\t\t\t}\n\n\t\t\tif (vectorFill === undefined) {\n\t\t\t\tvectorFill = \"transparent\"\n\t\t\t}\n\n\t\t\tconst fillEnabled = vectorFill !== undefined && vectorFill !== \"transparent\" && fillAlpha !== 0\n\n\t\t\t// If both fill and stroke are disabled, pretend there\u2019s a fill for the shadow\n\t\t\tif (!fillEnabled && !strokeEnabled) {\n\t\t\t\tfillAlpha = 1\n\t\t\t}\n\n\t\t\tlet mainElement: JSX.Element\n\t\t\tlet strokeClipPath: JSX.Element | null = null\n\t\t\tlet shapeReference: JSX.Element | null = null\n\t\t\tlet strokeElement: JSX.Element | null = null\n\n\t\t\tlet pathTranslate: { x: number; y: number } | undefined\n\t\t\tlet elementTransform: string | undefined\n\n\t\t\tconst translatePaths = target === RenderTarget.export\n\t\t\tif (transform.rotation === 0 && translatePaths) {\n\t\t\t\tpathTranslate = transform\n\t\t\t} else {\n\t\t\t\tpathTranslate = { x: 0, y: 0 }\n\t\t\t\telementTransform = transformString(transform)\n\t\t\t}\n\t\t\tconst pathAttributes: Omit<\n\t\t\t\tReact.SVGAttributes<SVGPathElement>,\n\t\t\t\tkeyof React.DOMAttributes<SVGPathElement> | \"values\"\n\t\t\t> = {\n\t\t\t\td: d ?? toSVGPath(calculatedPath, pathTranslate, target),\n\t\t\t\ttransform: elementTransform,\n\t\t\t}\n\n\t\t\t// When used from the Preview, we need to revive BoxShadow instances:\n\t\t\tconst svgStrokeAttributes: SVGStrokeAttributes = {}\n\t\t\tif (strokeEnabled && strokeWidth !== 0) {\n\t\t\t\tsvgStrokeAttributes.strokeWidth = strokeWidth\n\t\t\t\tsvgStrokeAttributes.stroke = strokeColor\n\t\t\t\tsvgStrokeAttributes.strokeLinecap = lineCap\n\t\t\t\tsvgStrokeAttributes.strokeLinejoin = lineJoin\n\t\t\t\tif (lineJoin === \"miter\") {\n\t\t\t\t\tsvgStrokeAttributes.strokeMiterlimit = strokeMiterLimit\n\t\t\t\t}\n\t\t\t\tsvgStrokeAttributes.strokeDasharray = strokeDashArray\n\t\t\t\tif (strokeDashOffset !== 0) {\n\t\t\t\t\tsvgStrokeAttributes.strokeDashoffset = strokeDashOffset\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const key in svgElementAttributeDefaults) {\n\t\t\t\tif (asRecord(svgStrokeAttributes)[key] === asRecord(svgElementAttributeDefaults)[key]) {\n\t\t\t\t\tasRecord(svgStrokeAttributes)[key] = undefined\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst internalShapeId = InternalID.forKey(id)\n\t\t\tconst internalStrokeClipId = InternalID.forKey(strokeClipId)\n\t\t\tconst shadow = shadowForShape(\n\t\t\t\tshadows,\n\t\t\t\t// Shadow filter uses 'objectBoundingBox' as filter units, so calculations should be\n\t\t\t\t// relative to the referenced object itself (path), instead of the node rect, which\n\t\t\t\t// can be larger than the path bounding box.\n\t\t\t\tcalculatedPathBoundingBox,\n\t\t\t\tinternalShapeId,\n\t\t\t\tBoolean(fill),\n\t\t\t\tstrokeEnabled,\n\t\t\t\tstrokeWidth,\n\t\t\t\tinternalStrokeClipId,\n\t\t\t\tsvgStrokeAttributes,\n\t\t\t)\n\n\t\t\tconst currentName = target === RenderTarget.preview ? name || undefined : undefined\n\n\t\t\tif (shadow.insetElement !== null || shadow.outsetElement !== null || insideStroke) {\n\t\t\t\tpathAttributes.id = internalShapeId.id\n\t\t\t\tshapeReference = <motion.path {...{ ...pathAttributes }} variants={variants} transition={transition} />\n\n\t\t\t\tif (shadow.needsStrokeClip || insideStroke) {\n\t\t\t\t\tstrokeClipPath = (\n\t\t\t\t\t\t<clipPath id={internalStrokeClipId.id}>\n\t\t\t\t\t\t\t<use xlinkHref={internalShapeId.link} />\n\t\t\t\t\t\t</clipPath>\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\tif (shadow.insetElement !== null && strokeEnabled && strokeWidth && strokeWidth > 0) {\n\t\t\t\t\tmainElement = (\n\t\t\t\t\t\t<use\n\t\t\t\t\t\t\txlinkHref={internalShapeId.link}\n\t\t\t\t\t\t\tfill={vectorFill}\n\t\t\t\t\t\t\tfillOpacity={fillOpacity}\n\t\t\t\t\t\t\tstrokeOpacity=\"0\"\n\t\t\t\t\t\t\tname={currentName}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t\tstrokeElement = (\n\t\t\t\t\t\t<use\n\t\t\t\t\t\t\txlinkHref={internalShapeId.link}\n\t\t\t\t\t\t\tclipPath={internalStrokeClipId.urlLink}\n\t\t\t\t\t\t\tfill=\"transparent\"\n\t\t\t\t\t\t\t{...svgStrokeAttributes}\n\t\t\t\t\t\t\tstrokeWidth={strokeWidth}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t} else {\n\t\t\t\t\tmainElement = (\n\t\t\t\t\t\t<use\n\t\t\t\t\t\t\txlinkHref={internalShapeId.link}\n\t\t\t\t\t\t\tfill={vectorFill}\n\t\t\t\t\t\t\tfillOpacity={fillOpacity}\n\t\t\t\t\t\t\tclipPath={internalStrokeClipId.urlLink}\n\t\t\t\t\t\t\t{...svgStrokeAttributes}\n\t\t\t\t\t\t\tstrokeWidth={strokeWidth}\n\t\t\t\t\t\t\tname={currentName}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tpathAttributes.id = idAttribute\n\t\t\t\tmainElement = (\n\t\t\t\t\t<motion.path\n\t\t\t\t\t\t{...{\n\t\t\t\t\t\t\t...pathAttributes,\n\t\t\t\t\t\t\tfill: vectorFill,\n\t\t\t\t\t\t\t...svgStrokeAttributes,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tname={currentName}\n\t\t\t\t\t\tfillOpacity={fillOpacity}\n\t\t\t\t\t\tvariants={variants}\n\t\t\t\t\t\ttransition={transition}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tconst imagePatternElement = imagePattern ? (\n\t\t\t\t<ImagePatternElement {...imagePattern} repeat={BackgroundImage.isImageObject(fill) && fill.fit === \"tile\"} />\n\t\t\t) : undefined\n\t\t\tlet gradient: JSX.Element | undefined\n\t\t\tif (linearGradient) {\n\t\t\t\tgradient = <LinearGradientElement {...linearGradient} />\n\t\t\t} else if (radialGradient) {\n\t\t\t\tgradient = <RadialGradientElement {...radialGradient} />\n\t\t\t}\n\n\t\t\tlet defs: JSX.Element | null = null\n\t\t\tif (\n\t\t\t\tshapeReference ||\n\t\t\t\tstrokeClipPath ||\n\t\t\t\t(shadow.definition && shadow.definition.length) ||\n\t\t\t\tgradient ||\n\t\t\t\timagePatternElement\n\t\t\t) {\n\t\t\t\tdefs = (\n\t\t\t\t\t<defs>\n\t\t\t\t\t\t{shapeReference}\n\t\t\t\t\t\t{strokeClipPath}\n\t\t\t\t\t\t{shadow.definition}\n\t\t\t\t\t\t{gradient}\n\t\t\t\t\t\t{imagePatternElement}\n\t\t\t\t\t</defs>\n\t\t\t\t)\n\t\t\t}\n\n\t\t\t// Generated Components with variants require a default value to animate to/from.\n\t\t\tconst opacityValue = opacity ?? (variants ? 1 : undefined)\n\t\t\tif (defs === null && shadow.outsetElement === null && shadow.insetElement === null && strokeElement === null) {\n\t\t\t\t// Render the mainElement with opacity\n\t\t\t\tmainElement = (\n\t\t\t\t\t<motion.path\n\t\t\t\t\t\t{...{\n\t\t\t\t\t\t\t...pathAttributes,\n\t\t\t\t\t\t\tfill: vectorFill,\n\t\t\t\t\t\t\t...svgStrokeAttributes,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tfillOpacity={fillOpacity}\n\t\t\t\t\t\topacity={opacityValue}\n\t\t\t\t\t\tvariants={variants}\n\t\t\t\t\t\ttransition={transition}\n\t\t\t\t\t\tname={currentName}\n\t\t\t\t\t/>\n\t\t\t\t)\n\n\t\t\t\t// Don't group the main element if not needed:\n\t\t\t\treturn this.renderElement(mainElement)\n\t\t\t}\n\n\t\t\treturn this.renderElement(\n\t\t\t\t<motion.g opacity={opacityValue} variants={variants} transition={transition}>\n\t\t\t\t\t{defs}\n\t\t\t\t\t{shadow.maskElement}\n\t\t\t\t\t{shadow.outsetElement}\n\t\t\t\t\t{mainElement}\n\t\t\t\t\t{shadow.insetElement}\n\t\t\t\t\t{strokeElement}\n\t\t\t\t</motion.g>,\n\t\t\t)\n\t\t}\n\n\t\tprivate renderElement(element: JSX.Element) {\n\t\t\tconst { id, isRootVectorNode, width, height, includeTransform, left, top, style, _needsMeasure } = this.props\n\n\t\t\tif (!isRootVectorNode) return element\n\t\t\tif (includeTransform) return element\n\n\t\t\t/**\n\t\t\t * @TODO For generated components, this <svg> wrapper needs to become a\n\t\t\t * <motion.svg> and animate it's changes to width/height with layout,\n\t\t\t * and translate x & y with variants.\n\t\t\t */\n\t\t\treturn (\n\t\t\t\t<SVGRoot\n\t\t\t\t\tid={id}\n\t\t\t\t\twidth={width}\n\t\t\t\t\theight={height}\n\t\t\t\t\tleft={left}\n\t\t\t\t\ttop={top}\n\t\t\t\t\tstyle={style}\n\t\t\t\t\t_needsMeasure={_needsMeasure}\n\t\t\t\t>\n\t\t\t\t\t{element}\n\t\t\t\t</SVGRoot>\n\t\t\t)\n\t\t}\n\t}\n})()\n", "import { RenderEnvironment, RenderTarget } from \"../types/RenderEnvironment.ts\"\nimport { transformValues } from \"../utils/createTransformValues.ts\"\nimport { countNodeRender } from \"../utils/performanceDebugging.ts\"\nimport { transformString } from \"../utils/transformString.ts\"\nimport type { LayerProps } from \"./Layer.tsx\"\nimport { Layer } from \"./Layer.tsx\"\nimport { SVGRoot } from \"./SVGRoot.tsx\"\n\n/**\n * @internal\n */\nexport interface VectorGroupProps {\n\tname?: string\n\topacity?: number\n\tx: number\n\ty: number\n\t// left & top is only used for root level shapes to position the SVG. They would be rounded to\n\t// half pixels to avoid SVG rendering issues.\n\tleft: number\n\ttop: number\n\trotation: number\n\twidth: number\n\theight: number\n\ttargetName?: string\n\tdefaultName: string\n\tisRootVectorNode: boolean\n\tincludeTransform?: boolean\n\tvisible?: boolean\n}\n/**\n * @internal\n */\nexport interface VectorGroupProperties extends VectorGroupProps, LayerProps {\n\tstyle?: React.CSSProperties\n}\n\ndeclare class VectorGroupType extends Layer<VectorGroupProperties, Record<string, never>> {\n\tstatic defaultVectorGroupProps: VectorGroupProps\n\tstatic readonly defaultProps: VectorGroupProperties\n}\n\n/**\n * @internal\n */\nexport const VectorGroup: typeof VectorGroupType = /* @__PURE__ */ (() => {\n\treturn class VectorGroupInner extends Layer<VectorGroupProperties, Record<string, never>> {\n\t\tstatic defaultVectorGroupProps: VectorGroupProps = {\n\t\t\tname: undefined,\n\t\t\topacity: undefined,\n\t\t\tvisible: true,\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\tleft: 0,\n\t\t\ttop: 0,\n\t\t\trotation: 0,\n\t\t\twidth: 100,\n\t\t\theight: 100,\n\t\t\ttargetName: undefined,\n\t\t\tdefaultName: \"\",\n\t\t\tisRootVectorNode: false,\n\t\t\tincludeTransform: undefined,\n\t\t}\n\n\t\tstatic override readonly defaultProps: VectorGroupProperties = {\n\t\t\t...Layer.defaultProps,\n\t\t\t...VectorGroupInner.defaultVectorGroupProps,\n\t\t}\n\n\t\toverride render(): JSX.Element | null {\n\t\t\tcountNodeRender()\n\n\t\t\tconst {\n\t\t\t\tname: nameProp,\n\t\t\t\topacity,\n\t\t\t\tvisible,\n\t\t\t\ttargetName,\n\t\t\t\tdefaultName,\n\t\t\t\tchildren,\n\t\t\t\tincludeTransform,\n\t\t\t\tx,\n\t\t\t\ty,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\trotation,\n\t\t\t\tisRootVectorNode,\n\t\t\t} = this.props\n\n\t\t\tif (!visible) return null\n\t\t\tconst { target } = RenderEnvironment\n\n\t\t\tconst rect = { x, y, width, height }\n\t\t\tconst transform = transformValues(rect, rotation, isRootVectorNode, includeTransform)\n\n\t\t\tconst addNames = target === RenderTarget.preview\n\t\t\tlet name: string | undefined = undefined\n\t\t\tif (addNames) {\n\t\t\t\tif (targetName) {\n\t\t\t\t\tname = targetName\n\t\t\t\t} else if (nameProp) {\n\t\t\t\t\tname = nameProp\n\t\t\t\t} else {\n\t\t\t\t\tname = defaultName\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn this.renderElement(\n\t\t\t\t<g transform={transformString(transform)} {...{ name, opacity }}>\n\t\t\t\t\t{children}\n\t\t\t\t</g>,\n\t\t\t)\n\t\t}\n\n\t\tprivate renderElement(element: JSX.Element) {\n\t\t\tconst { id, isRootVectorNode, width, height, includeTransform, left, top, style, _needsMeasure } = this.props\n\n\t\t\tif (!isRootVectorNode) return element\n\t\t\tif (includeTransform) return element\n\n\t\t\treturn (\n\t\t\t\t<SVGRoot\n\t\t\t\t\tid={id}\n\t\t\t\t\tleft={left}\n\t\t\t\t\ttop={top}\n\t\t\t\t\twidth={width}\n\t\t\t\t\theight={height}\n\t\t\t\t\tstyle={style}\n\t\t\t\t\t_needsMeasure={_needsMeasure}\n\t\t\t\t>\n\t\t\t\t\t{element}\n\t\t\t\t</SVGRoot>\n\t\t\t)\n\t\t}\n\t}\n})()\n", "import { isObject } from \"../../utils/utils.ts\"\nimport type { WithPaths } from \"./Path.ts\"\n\n/**\n * @internal\n */\nexport interface WithShape {\n\tcalculatedPaths(): WithPaths\n}\n\nconst key: keyof WithShape = \"calculatedPaths\"\n\n/**\n * @internal\n */\nexport function withShape(target: unknown): target is WithShape {\n\tif (!isObject(target)) return false\n\treturn key in target\n}\n", "/**\n * @public\n */\nexport interface Size {\n\twidth: number\n\theight: number\n}\n\nexport const Size = /* @__PURE__ */ (() => {\n\t/**\n\t * @public\n\t */\n\tfunction Size(width: number, height: number): Size {\n\t\treturn { width, height }\n\t}\n\n\t/**\n\t * @param sizeA -\n\t * @param sizeB -\n\t * @internal\n\t */\n\tSize.equals = (sizeA: Size | null, sizeB: Size | null) => {\n\t\tif (sizeA === sizeB) return true\n\t\tif (!sizeA || !sizeB) return false\n\t\treturn sizeA.width === sizeB.width && sizeA.height === sizeB.height\n\t}\n\n\t/**\n\t *\n\t * @param fromSize - The initial size\n\t * @param toSize - The size to update to\n\t * @param keepAspectRatio - If the updating should preserve the aspect ratio\n\t * @remarks\n\t * keepAspectRatio only works if passing a toSize with only a width or height\n\t * @internal\n\t */\n\tSize.update = (fromSize: Size, toSize: Partial<Size>, keepAspectRatio = false) => {\n\t\tlet { width, height } = fromSize\n\t\tconst sizeRatio = width / height\n\n\t\t// Update from partial\n\t\twidth = toSize.width !== undefined ? toSize.width : width\n\t\theight = toSize.height !== undefined ? toSize.height : height\n\n\t\t// Overwrite if we want and can keep the aspect ratio\n\t\tif (keepAspectRatio) {\n\t\t\tif (toSize.width === undefined && toSize.height !== undefined) {\n\t\t\t\twidth = toSize.height * sizeRatio\n\t\t\t}\n\t\t\tif (toSize.width !== undefined && toSize.height === undefined && sizeRatio !== 0) {\n\t\t\t\theight = toSize.width / sizeRatio\n\t\t\t}\n\t\t}\n\n\t\treturn { width, height }\n\t}\n\n\t/**\n\t *\n\t * @param sizeA -\n\t * @param sizeB -\n\t * @internal\n\t */\n\tSize.subtract = (sizeA: Size, sizeB: Size) => {\n\t\treturn {\n\t\t\twidth: Math.max(0, sizeA.width - sizeB.width),\n\t\t\theight: Math.max(0, sizeA.height - sizeB.height),\n\t\t}\n\t}\n\n\t/**\n\t * @public\n\t */\n\tSize.zero = Size(0, 0)\n\n\t/**\n\t * Checks if the size has a zero width and zero height\n\t * @param size - size to check\n\t * @public\n\t */\n\tSize.isZero = function (size: Size) {\n\t\treturn size === Size.zero || (size.width === 0 && size.height === 0)\n\t}\n\n\t/**\n\t * @param width -\n\t * @param height -\n\t * @param size -\n\t * @internal\n\t */\n\tSize.defaultIfZero = function (width: number, height: number, size: Size) {\n\t\tif (Size.isZero(size)) {\n\t\t\treturn Size(width, height)\n\t\t} // else\n\t\treturn size\n\t}\n\n\treturn Size\n})()\n", "// When applied to a type, JSON.stringify will append a \"__type__\" field to the outputted JSON string. This\n// can be used to re-instatiate an object of the correct type when deserializing the JSON.\n/** @internal */\nexport function annotateTypeOnStringify<T>(ctor: new (...args: any[]) => T, typeName: string) {\n\tconst existingToJSON = ctor.prototype.toJSON\n\tctor.prototype.toJSON = function () {\n\t\tconst base = existingToJSON ? existingToJSON.apply(this) : this\n\t\treturn Object.assign({}, base, { __type__: typeName })\n\t}\n\treturn ctor // moot; but seems like the sensical thing to do.\n}\n\n/** @internal */\nexport function isOfAnnotatedType(object: any, typeName: string) {\n\treturn object && object.__type__ && object.__type__ === typeName\n}\n", "const LOADING_LAZY_THRESHOLD = 1000\n\n/** @internal */\nexport function getLoadingLazyAtYPosition(offset: number) {\n\treturn offset > LOADING_LAZY_THRESHOLD ? \"lazy\" : undefined\n}\n", "import type { FillProperties } from \"../traits/Fill.ts\"\nimport type { WithShape } from \"../traits/Shape.ts\"\nimport { LinearGradient, RadialGradient } from \"../types/Gradient.ts\"\nimport type {\n\tLinearGradientElementProperties,\n\tRadialGradientElementProperties,\n} from \"./elementPropertiesForGradient.ts\"\nimport {\n\telementPropertiesForLinearGradient,\n\telementPropertiesForRadialGradient,\n} from \"./elementPropertiesForGradient.ts\"\n\n/**\n * @internal\n */\nexport function gradientForShape(\n\tnodeId: string,\n\tnode: WithShape & FillProperties,\n): LinearGradientElementProperties | RadialGradientElementProperties | undefined {\n\tif (LinearGradient.isLinearGradient(node.fill)) {\n\t\treturn elementPropertiesForLinearGradient(node.fill, nodeId)\n\t}\n\tif (RadialGradient.isRadialGradient(node.fill)) {\n\t\treturn elementPropertiesForRadialGradient(node.fill, nodeId)\n\t}\n\treturn undefined\n}\n", "import { safeWindow } from \"../../utils/safeWindow.ts\"\n\n/**\n *  @internal\n *  @deprecated - don't use outside of Library anymore.\n */\nexport function throttle<T extends any[]>(fn: (...args: T) => void, time: number): (...args: T) => void {\n\tlet previous = 0\n\tlet timeout: number | undefined\n\n\tconst later = (...args: T) => {\n\t\tprevious = Date.now()\n\t\ttimeout = undefined\n\t\tfn(...args)\n\t}\n\n\treturn (...args: T) => {\n\t\tconst now = Date.now()\n\t\tconst remaining = time - (now - previous)\n\t\tif (remaining <= 0 || remaining > time) {\n\t\t\tif (timeout) {\n\t\t\t\tsafeWindow.clearTimeout(timeout)\n\t\t\t\ttimeout = undefined\n\t\t\t}\n\t\t\tprevious = now\n\t\t\tfn(...args)\n\t\t} else if (!timeout) {\n\t\t\ttimeout = safeWindow.setTimeout(later, remaining, ...args)\n\t\t}\n\t}\n}\n", "import type { Action, ActionControls } from \"../render/types/Action.ts\"\nimport { runtime } from \"./runtimeInjection.ts\"\n\n/**\n * @internal\n */\nexport interface ActionInfo {\n\tcontrols: ActionControls<any>\n\ttitle?: string\n}\n\n/**\n * Provide a title and controls for an action, used in the Framer UI\n * @param action - a reference to an {@link Action}\n * @param title - the display title of the action\n * @param controls - the action controls\n * @internal\n */\nexport function addActionControls<Options extends { [key: string]: any }>(\n\taction: Action<Options>,\n\ttitle: string,\n\tcontrols: ActionControls<Options>,\n) {\n\truntime.addActionControls(action, title, controls)\n}\n", "import { emptyArray } from \"@framerjs/shared/src/emptyArray.ts\"\nimport type React from \"react\"\nimport { FRAMER_VARIABLE_FONT_SUFFIX } from \"../render/fonts/css.ts\"\nimport type { FontSourceName, ReadonlyFontVariationAxes } from \"../render/fonts/types.ts\"\nimport { FontSourceNames } from \"../render/fonts/types.ts\"\n\n/**\n * An older (pre-Feb 2024) version of ComponentFont that doesn\u2019t include the `source` field. This\n * version was introduced in the same PR that introduced ComponentFontBundle, thus upgrading from\n * ComponentFontV1 to ComponentFontV2 also involves wrapping ComponentFontV1s into a\n * ComponentFontBundle.\n *\n * While this version of ComponentFont is not used internally, it may still be passed into\n * `addFonts()` by older versions of smart components.\n */\nexport interface ComponentFontV1 {\n\turl: string\n\tfamily: string\n\n\t/**\n\t * Provides an alternative way to determine the font's URL in local modules,\n\t * by resolving `moduleAsset.url` (e.g., `assets/font.otf`) against the base\n\t * URL of the module given by the `localModuleIdentifier`.\n\t *\n\t * This exists to solve [a very specific problem with fonts in exported\n\t * prototypes][1], so even if we decide to make `addFonts` public, this\n\t * should probably stay internal.\n\t *\n\t * [1]: https://framer-team.slack.com/archives/C01UY26JGBB/p1623924715174900\n\t *\n\t * @internal\n\t *\n\t * @deprecated These days, we use absolute framerusercontent.com/assets URLs\n\t * for fonts, so there's no need to populate this field anymore\u2014but note\n\t * that existing components might still be using old module-relative URLs.\n\t */\n\tmoduleAsset?: { url: string; localModuleIdentifier?: string }\n\n\t// Font descriptors should match the [FontFaceDescriptors][1] defined in the\n\t// CSS Font Loading spec. This will allow us to use them as-is in FontFace\n\t// and `@font-face`, without the need for any further conversions.\n\t//\n\t// [1]: https://drafts.csswg.org/css-font-loading/#dictdef-fontfacedescriptors\n\tstyle?: string\n\tweight?: string\n\tstretch?: string\n\tunicodeRange?: string\n}\n\n/**\n * An older (pre-Sep 2025) version of ComponentFont that doesn\u2019t include the `cssFontFamily` field.\n *\n * While this version of ComponentFont is not used internally, it may still be passed into\n * `addFonts()` by older versions of smart components.\n */\nexport interface ComponentFontV2 extends ComponentFontV1 {\n\tsource: FontSourceName\n\tvariationAxes?: ReadonlyFontVariationAxes\n\t/**\n\t * This flag specifies whether the font has any applied OpenType features on\n\t * the node that uses it.\n\t *\n\t * This flag solves a very narrow problem: Google Fonts CSS API subsetting strips\n\t * OpenType features off fonts [1]. Therefore, when any component enables OpenType\n\t * on a Google font, we should disable subsetting. This flag signals us to do that.\n\t * It\u2019s very specific, is used only for Google Fonts, and is tightly coupled to how we do\n\t * font generation when publishing a site, so it should stay internal.\n\t *\n\t * [1] https://www.notion.so/framer/OpenType-Features-for-Google-Fonts-176adf6e8c968049af7afda39fab11b3?pvs=4#17cadf6e8c968000b86ee910b236c37a\n\t *\n\t * @internal\n\t */\n\topenType?: boolean\n}\n\n/**\n * Describes a single font used by a component. Unlike [Font](../render/fonts/types.ts) objects\n * which are fetched from the Google/Fontshare/etc APIs every time the canvas is loaded (and die\n * when the canvas is unloaded), these objects get serialized into codegenerated web pages and\n * components.\n *\n * @public\n */\nexport interface ComponentFont extends Omit<ComponentFontV2, \"family\"> {\n\t/**\n\t * Font family name, as defined in the source that provides the font.\n\t *\n\t * @internal\n\t */\n\tuiFamilyName: string\n\t/**\n\t * Defines a font\u2019s `font-family` property. The value of this field:\n\t * - must go into `@font-face` when loading the font\n\t * - will be used by DOM nodes inside the component (e.g. `style={fontFamily: \"XXX\"}`).\n\t *\n\t * In generated code, this will often (but not always) match the `uiFamilyName` field. E.g., as\n\t * of Sep 2025, most regular fonts will have the same `uiFamilyName` and `cssFamilyName`,\n\t * but variable fonts will have `cssFamilyName` as `${uiFamilyName} Variable`, and custom\n\t * fonts will have `cssFamilyName` as the selector.\n\t *\n\t * @internal\n\t */\n\tcssFamilyName: string\n}\n\n/**\n * Describes a bundle of fonts used by a single component, together with feature\n * flags to indicate which font features that component supported at the time of\n * codegen.\n */\nexport interface ComponentFontBundle<T extends ComponentFontV2 | ComponentFont = ComponentFont> {\n\t/**\n\t * This flag specifies whether the font bundle includes the specific font\n\t * weights of Framer\u2019s Inter font that the component uses. New smart\n\t * components do that (which means we can emit CSS only for Inter fonts that\n\t * are actually used); older smart components don\u2019t (which means some places\n\t * will emit CSS for all Inter fonts if this flag is not set).\n\t * https://www.notion.so/framer/RFC-ComponentFont-v2-d5fd3e822fb049ffb6971554ab0e4e42\n\t */\n\texplicitInter: boolean\n\tfonts: T[]\n}\n\n/** @public */\nexport function addFonts(\n\tcomponent: React.ComponentType<unknown>,\n\tfontsOrBundles: (ComponentFontV1 | ComponentFontBundle<ComponentFontV2 | ComponentFont>)[],\n\tflags?: { supportsExplicitInterCodegen?: boolean },\n): void {\n\tconst bundles = upgradeFontBundlesAsNeeded(fontsOrBundles)\n\n\t// Upgrade path (v1 -> v2): old components will call `addFonts` like this:\n\t//   addFonts(MyComponent, [<component\u2019s own fonts>, ...getFonts(ChildComponent1), ...getFonts(ChildComponent2), ...fontPreset1.fonts, ...fontPreset2.fonts])\n\t// With this notation, we can\u2019t distinguish between fontPreset1.fonts being empty\n\t// (which means the preset might use Inter) and missing. So as a precaution,\n\t// we make sure we always emit Inter if `addFonts` is called from an old component.\n\tif (\n\t\t!flags?.supportsExplicitInterCodegen &&\n\t\t// Only emit an `explicitInter: false` bundle if we don\u2019t already have one.\n\t\t!bundles.some(font => font.explicitInter === false)\n\t) {\n\t\tbundles.push({ explicitInter: false, fonts: [] })\n\t}\n\n\tObject.assign(component, { fonts: bundles })\n}\n\n/** @public */\nexport function getFonts(component: React.ComponentType<unknown>): ComponentFontBundle[] {\n\tif (!component) return emptyArray() as ComponentFontBundle[]\n\n\t// No need to transform fonts using `convertMixedFontArrayToFontBundles` here,\n\t// since this was already done in `addFonts`.\n\tconst fonts = (component as { fonts?: ComponentFontBundle[] }).fonts\n\treturn fonts ?? (emptyArray() as ComponentFontBundle[])\n}\n\n/** @internal */\nexport function getFontsFromSharedStyle(\n\tfontsOrBundles: (ComponentFontV1 | ComponentFontBundle<ComponentFontV2 | ComponentFont>)[],\n): ComponentFontBundle[] {\n\t// Upgrade path: old shared style arrays might emit an empty array both when\n\t// they have no fonts at all, and when they only use Inter. We can\u2019t\n\t// differentiate between these cases, so as a precaution, we emit a font\n\t// bundle with `explicitInter: false`.\n\t//\n\t// (Modern shared style arrays will never emit an empty array \u2013 instead, when\n\t// they use no fonts, they\u2019ll emit an array with an empty\n\t// ComponentFontBundle.)\n\tif (fontsOrBundles.length === 0) return [{ explicitInter: false, fonts: [] }]\n\n\treturn upgradeFontBundlesAsNeeded(fontsOrBundles)\n}\n\n/** @internal */\nexport function getFontsFromComponentPreset(\n\tfonts: (ComponentFontV1 | ComponentFontBundle<ComponentFontV2 | ComponentFont>)[],\n): ComponentFontBundle[] {\n\t// Upgrade path: same as in `getFontsFromSharedStyle()`.\n\tif (fonts.length === 0) return [{ explicitInter: false, fonts: [] }]\n\n\treturn upgradeFontBundlesAsNeeded(fonts)\n}\n\nfunction upgradeFontBundlesAsNeeded(\n\tfonts: (ComponentFontV1 | ComponentFontBundle<ComponentFontV2 | ComponentFont>)[],\n): ComponentFontBundle[] {\n\tconst oldFontBundle: ComponentFontBundle = { explicitInter: false, fonts: [] }\n\tconst fontBundles: ComponentFontBundle[] = []\n\n\t// To avoid iterating over all fonts several times, we\u2019re doing all upgrades in a single pass:\n\t// 1) v1 -> v2: upgrade any individual fonts into font bundles. Only old components (those that\n\t//    don\u2019t emit Inter explicitly) emit fonts as plain ComponentFont objects. (All modern ones\n\t//    will emit a ComponentFontBundle.) So if we receive any regular fonts, we wrap them into a\n\t//    single bundle with `explicitInter: false`.\n\t// 2) v1 \u2192 v2: also add the source field to the fonts\n\t// 3) v2 \u2192 v3: also add the cssFontFamily field to the fonts\n\tfor (const fontOrBundle of fonts) {\n\t\tif (isComponentFontBundle(fontOrBundle)) {\n\t\t\tfontBundles.push({\n\t\t\t\texplicitInter: fontOrBundle.explicitInter,\n\t\t\t\tfonts: fontOrBundle.fonts.map(upgradeComponentFont),\n\t\t\t})\n\t\t} else {\n\t\t\toldFontBundle.fonts.push(upgradeComponentFont(fontOrBundle))\n\t\t}\n\t}\n\n\tif (oldFontBundle.fonts.length > 0) fontBundles.push(oldFontBundle)\n\n\treturn fontBundles\n}\n\nconst componentFontBundleKey: keyof ComponentFontBundle = \"explicitInter\"\n/** @internal */\nexport function isComponentFontBundle<T extends ComponentFontV2 | ComponentFont>(\n\tfont: ComponentFontV1 | ComponentFontBundle<T>,\n): font is ComponentFontBundle<T> {\n\treturn componentFontBundleKey in font\n}\n\nfunction upgradeComponentFont(font: ComponentFontV1 | ComponentFontV2 | ComponentFont): ComponentFont {\n\tconst fontV2 = hasComponentFontV2(font) || hasComponentFontV3(font) ? font : upgradeToComponentFontV2(font)\n\tconst fontV3 = hasComponentFontV3(fontV2) ? fontV2 : upgradeToComponentFontV3(fontV2)\n\treturn fontV3\n}\n\nfunction hasComponentFontV2(font: ComponentFontV1 | ComponentFontV2 | ComponentFont): font is ComponentFontV2 {\n\tconst key: keyof ComponentFontV2 = \"source\"\n\treturn key in font\n}\n\nfunction hasComponentFontV3(font: ComponentFontV1 | ComponentFontV2 | ComponentFont): font is ComponentFont {\n\tconst key: keyof ComponentFont = \"cssFamilyName\"\n\treturn key in font\n}\n\n/** Upgrades an older ComponentFontV1 present in code-generated sources to the modern ComponentFont version. */\nfunction upgradeToComponentFontV2(font: ComponentFontV1): ComponentFontV2 | ComponentFont {\n\tlet source: FontSourceName\n\t// These strings are safe to hard-code, since this code path will only get\n\t// invoked by smart components compiled before Feb 2024. Any changes to the\n\t// URLs will require recompiling the smart components, which will also\n\t// update font objects and switch to a different code path.\n\tif (font.url.startsWith(\"https://fonts.gstatic.com/s/\")) {\n\t\tsource = FontSourceNames.Google\n\t} else if (font.url.startsWith(\"https://framerusercontent.com/third-party-assets/fontshare/\")) {\n\t\tsource = FontSourceNames.Fontshare\n\t} else {\n\t\t// We don\u2019t expect anyone to link directly to Framer Inter or local fonts\n\t\tsource = FontSourceNames.Custom\n\t}\n\n\treturn {\n\t\t...font,\n\t\tsource,\n\t}\n}\n\nfunction upgradeToComponentFontV3(font: ComponentFontV2): ComponentFont {\n\tconst { family, ...rest } = font\n\tconst cssFamilyName =\n\t\t// `font.source !== FontSourceNames.Custom` mimics the pre-ComponentFontV3 Vekter logic.\n\t\t// Without this, CSS font families used in `style={{ fontFamily: ... }}` won\u2019t match\n\t\t// `ComponentFont.cssFontFamily`s\n\t\tfont.variationAxes && font.source !== FontSourceNames.Custom ? `${family} ${FRAMER_VARIABLE_FONT_SUFFIX}` : family\n\treturn {\n\t\t...rest,\n\t\tuiFamilyName: family,\n\t\tcssFamilyName,\n\t}\n}\n", "export function withPerformanceMarks(prefix: string, callback: CallableFunction) {\n\tconst markStart = `${prefix}-start`\n\tperformance.mark(markStart)\n\tcallback()\n\tconst markEnd = `${prefix}-end`\n\tperformance.mark(markEnd)\n\tperformance.measure(prefix, markStart, markEnd)\n}\n", "// Re-export environment utilities from @framerjs/shared for backwards compatibility.\n// Do not import this file in library code. Internal library code should import directly\n// from @framerjs/shared/src/environment.ts.\nimport {\n\tchromeMainVersion,\n\tdeviceType,\n\tisAndroid,\n\tisBrowser,\n\tisChrome,\n\tisDataUrl,\n\tisDesktop,\n\tisEdge,\n\tisEmbedded,\n\tisFileUrl,\n\tisFirefox,\n\tisFramerX,\n\tisIOS,\n\tisLocalServerUrl,\n\tisLocalUrl,\n\tisMacOS,\n\tisMobile,\n\tisPhone,\n\tisRelativeUrl,\n\tisSafari,\n\tisTablet,\n\tisTest,\n\tisTouch,\n\tisWebKit,\n\tisWindows,\n\tsafariVersion,\n} from \"@framerjs/shared/src/environment.ts\"\n\n// The below utils are not used anywhere and thus are only defined for backwards compatibility\n// with the `environment` export.\ntype DeviceOS = \"macos\" | \"ios\" | \"android\" | \"windows\"\n\nfunction deviceOS(): DeviceOS | undefined {\n\tif (isMacOS()) return \"macos\"\n\tif (isIOS()) return \"ios\"\n\tif (isAndroid()) return \"android\"\n\tif (isWindows()) return \"windows\"\n\treturn undefined\n}\n\nfunction deviceFont(os?: DeviceOS): string {\n\t// https://github.com/jonathantneal/system-font-css\n\tif (!os) {\n\t\tos = deviceOS()\n\t}\n\n\tconst fonts = {\n\t\tapple: \"-apple-system, BlinkMacSystemFont, SF Pro Text, SF UI Text, Helvetica Neue\",\n\t\tgoogle: \"Roboto, Helvetica Neue\",\n\t\tmicrosoft: \"Segoe UI, Helvetica Neue\",\n\t}\n\n\tif (os === \"macos\") return fonts.apple\n\tif (os === \"ios\") return fonts.apple\n\tif (os === \"android\") return fonts.google\n\tif (os === \"windows\") return fonts.microsoft\n\n\treturn fonts.apple\n}\n\n// XXX: Workaround for https://github.com/microsoft/rushstack/issues/1029\n/** @internal */\n/** @deprecated Exported only for backwards compatibility; import directly from @framerjs/shared/src/environment.ts instead. */\nexport const environment = {\n\tchromeMainVersion,\n\tdeviceFont,\n\tdeviceOS,\n\tdeviceType,\n\tisAndroid,\n\tisBrowser,\n\tisChrome,\n\tisDataUrl,\n\tisDesktop,\n\tisEdge,\n\tisEmbedded,\n\tisFileUrl,\n\tisFirefox,\n\tisFramerX,\n\tisIOS,\n\tisLocalServerUrl,\n\tisLocalUrl,\n\tisMacOS,\n\tisMobile,\n\tisPhone,\n\tisRelativeUrl,\n\tisSafari,\n\tisTablet,\n\tisTest,\n\tisTouch,\n\tisWebKit,\n\tisWindows,\n\tsafariVersion,\n}\n", "/**\n * @internal\n */\nexport function loadJSON<T>(url: string): Promise<T> {\n\treturn fetch(url, { mode: \"cors\" }).then(res => res.json())\n}\n", "// Direct port of the old Framer equivalent:\n// https://github.com/koenbok/Framer/blob/master/framer/Utils.coffee#L225\n\nexport function inspectObjectType(item: any) {\n\t// This is a hacky way to get nice object names, it tries to\n\t// parse them from the .toString methods for objects.\n\n\tlet className\n\tif (\n\t\t(item.constructor !== null ? item.constructor.name : undefined) !== null &&\n\t\t(item.constructor !== null ? item.constructor.name : undefined) !== \"Object\"\n\t) {\n\t\treturn item.constructor.name\n\t}\n\n\tconst extract = function (str: string) {\n\t\tif (!str) {\n\t\t\treturn null\n\t\t}\n\t\tconst regex = /\\[object (\\w+)\\]/u\n\t\tconst match = regex.exec(str)\n\t\tif (match) {\n\t\t\treturn match[1]\n\t\t}\n\t\treturn null\n\t}\n\n\tif (item.toString) {\n\t\tclassName = extract(item.toString())\n\t\tif (className) {\n\t\t\treturn className\n\t\t}\n\t}\n\n\tif (item.constructor !== null ? item.constructor.toString : undefined) {\n\t\tclassName = extract(item.constructor !== null ? item.constructor.toString() : undefined)\n\t\tif (className) {\n\t\t\treturn className.replace(\"Constructor\", \"\")\n\t\t}\n\t}\n\n\treturn \"Object\"\n}\n", "// Direct port of the old Framer equivalent:\n// https://github.com/koenbok/Framer/blob/master/framer/Utils.coffee#L249\n\nimport { inspectObjectType } from \"./inspectObjectType.ts\"\nimport { isArray, isFunction, isNumber, isObject, isString } from \"./utils.ts\"\n\nexport function inspect(item: unknown, max?: number, l?: number): string {\n\tif (max === undefined) {\n\t\tmax = 5\n\t}\n\tif (l === undefined) {\n\t\tl = 0\n\t}\n\tif (item === null) {\n\t\treturn \"null\"\n\t}\n\tif (item === undefined) {\n\t\treturn \"undefined\"\n\t}\n\n\tif (isObject(item) && isFunction(item.toInspect)) {\n\t\treturn (item.toInspect as () => string)()\n\t}\n\tif (isString(item)) {\n\t\treturn `\"${item}\"`\n\t}\n\tif (isNumber(item)) {\n\t\treturn `${item}`\n\t}\n\tif (isFunction(item)) {\n\t\tlet code = item.toString().slice(\"function \".length).replace(/\\n/gu, \"\").replace(/\\s+/gu, \" \")\n\t\t// We limit the size of a function body if it's in a structure\n\t\tconst limit = 50\n\t\tif (code.length > limit && l > 0) {\n\t\t\tcode = `${code.slice(0, limit + 1).trim()}\u2026 }`\n\t\t}\n\t\treturn `<Function ${code}>`\n\t}\n\tif (isArray(item)) {\n\t\tif (l > max) {\n\t\t\treturn \"[...]\"\n\t\t}\n\t\treturn `[${item.map(i => inspect(i, max, (l || 0) + 1)).join(\", \")}]`\n\t}\n\tif (isObject(item)) {\n\t\tlet objectInfo\n\t\tconst objectType = inspectObjectType(item)\n\t\t// We should not loop over dom trees because we will have a bad time\n\t\tif (/HTML\\w+?Element/u.test(objectType)) {\n\t\t\treturn `<${objectType}>`\n\t\t}\n\t\tif (l > max) {\n\t\t\tobjectInfo = \"{...}\"\n\t\t} else {\n\t\t\tconst itemKeys = Object.keys(item)\n\t\t\tobjectInfo = `{${itemKeys.map(k => `${k}:${inspect(item[k], max, (l || 0) + 1)}`).join(\", \")}}`\n\t\t}\n\t\tif (objectType === \"Object\") {\n\t\t\treturn objectInfo\n\t\t}\n\t\treturn `<${objectType} ${objectInfo}>`\n\t}\n\n\treturn `${item}`\n}\n", "import { inspect } from \"./inspect.ts\"\n\n/**\n * Prints to the console.\n *\n * @param args - Arguments to print\n * @public\n */\nexport function print(...args: any[]) {\n\tconst line = args\n\t\t.map(arg => {\n\t\t\treturn inspect(arg)\n\t\t})\n\t\t.join(\", \")\n\n\t// For now, output to console. Further work tracked under:\n\t// https://github.com/framer/company/issues/8142\n\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\tconsole.log(line)\n}\n", "import { useEffect, useState } from \"react\"\nimport { withPreload } from \"../modules/usePrototypeNavigate.tsx\"\nimport type { RouteComponent, Routes } from \"../router/types.ts\"\n\nfunction initialRouteComponent(component: RouteComponent | undefined): RouteComponent | null {\n\tif (!component) return null\n\tif (withPreload(component)) return null\n\treturn component\n}\n\n/**\n * Workaround for SSG + React.Suspense \uD83D\uDCA5 ReactDomServer currently does not support Suspense in\n * React 17, and will fail if it encounters Suspense. To work around this, we have to implement a\n * simple version of Suspense ourselves. To do this we use this hook to fetch the initial route of a\n * prototype, and only render the component after it has been fetched.\n * @internal\n * @deprecated used by canvas pages only\n */\nexport function useInitialRouteComponent(routes: Routes, homeNodeId: string): RouteComponent | null {\n\tconst InitialRouteComponent = routes[homeNodeId]?.page\n\tconst [RouteComponent, setRouteComponent] = useState<RouteComponent | null>(() =>\n\t\tinitialRouteComponent(InitialRouteComponent),\n\t)\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: deprecated\n\tuseEffect(() => {\n\t\tif (withPreload(InitialRouteComponent)) {\n\t\t\tvoid (async () => {\n\t\t\t\tawait InitialRouteComponent.preload()\n\t\t\t\t// eslint-disable-next-line framer-studio/no-setstate-without-transition -- deprecated\n\t\t\t\tsetRouteComponent(InitialRouteComponent)\n\t\t\t})()\n\t\t}\n\t}, [])\n\n\treturn RouteComponent\n}\n", "import type { ComponentLoader } from \"./loaderTypes.ts\"\n\n/**\n * Attaches a loader function to a component for data preloading.\n *\n * @example\n * ```tsx\n * addLoader(ParentComponent, async (props, context) => {\n *   return Promise.allSettled([\n *     forwardLoader(ChildComponent, {\n *       ...props,\n *       url: \"https://api.example.com/data\"\n *     }, context),\n *     fetch(props.url ?? \"https://api.example.com/data\", { signal: context.signal, cache: \"force-cache\" })\n *   ])\n * })\n * ```\n *\n * @public\n */\nexport function addLoader<P>(component: React.ComponentType<P>, loaderFn: ComponentLoader<P>[\"load\"]): void {\n\tObject.assign(component, { loader: { load: loaderFn } })\n}\n\n/**\n * Get the loader for a component if it exists.\n * @internal\n */\nexport function getLoader<P>(\n\tcomponent: React.ComponentType<P> | { loader?: ComponentLoader<P> },\n): ComponentLoader<P> | undefined {\n\treturn (component as { loader?: ComponentLoader<P> }).loader\n}\n", "import { getLoader } from \"./addLoader.ts\"\nimport type { ComponentLoader, LoaderContext } from \"./loaderTypes.ts\"\n\n/**\n * Forwards a loader call to a child component if it has a loader defined.\n *\n * @example\n * ```tsx\n * addLoader(ParentComponent, async (props, context) => {\n *   return Promise.allSettled([\n *     forwardLoader(ChildComponent, {\n *       ...props,\n *       url: \"https://api.example.com/data\"\n *     }, context),\n *     fetch(props.url ?? \"https://api.example.com/data\", { signal: context.signal, cache: \"force-cache\" })\n *   ])\n * })\n * ```\n *\n * @public\n */\nexport function forwardLoader<P>(\n\tcomponent: React.ComponentType<P> | { loader?: ComponentLoader<P> },\n\tprops: P,\n\tcontext: LoaderContext,\n): Promise<unknown> {\n\tconst loader = getLoader(component)\n\tif (!loader) return Promise.resolve(undefined)\n\treturn loader.load(props, context)\n}\n", "{\n\t\"name\": \"framer\",\n\t\"version\": \"2.4.1\",\n\t\"private\": true,\n\t\"type\": \"module\",\n\t\"author\": \"Framer\",\n\t\"license\": \"MIT\",\n\t\"scripts\": {\n\t\t\"coverage\": \"yarn :jest --coverage\",\n\t\t\"lint\": \"yarn :lint ./src --ext .ts,.tsx --format gha-codeframe --quiet --cache\",\n\t\t\"lint:ci\": \"yarn lint --cache-strategy content --cache-location $HOME/.cache/eslint/framer-library\",\n\t\t\"lint:fix\": \"yarn lint --fix\",\n\t\t\"test\": \"TZ=UTC yarn :jest\",\n\t\t\"watch\": \"yarn :jest --watch\"\n\t},\n\t\"dependencies\": {\n\t\t\"@sqlite.org/sqlite-wasm\": \"^3.50.4-build1\",\n\t\t\"devalue\": \"^5.6.4\",\n\t\t\"eventemitter3\": \"^5.0.1\",\n\t\t\"fontfaceobserver\": \"2.2.0\",\n\t\t\"hoist-non-react-statics\": \"^3.3.2\",\n\t\t\"hsluv\": \"^1.0.1\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@juggle/resize-observer\": \"^3.4.0\",\n\t\t\"@microsoft/api-extractor\": \"^7.58.2\",\n\t\t\"@testing-library/dom\": \"^8.19.1\",\n\t\t\"@testing-library/jest-dom\": \"^5.16.5\",\n\t\t\"@testing-library/react\": \"^13.4.0\",\n\t\t\"@testing-library/user-event\": \"patch:@testing-library/user-event@npm%3A14.6.1#~/.yarn/patches/@testing-library-user-event-npm-14.6.1-5da7e1d4e2.patch\",\n\t\t\"@types/dom-navigation\": \"^1.0.6\",\n\t\t\"@types/fontfaceobserver\": \"2.1\",\n\t\t\"@types/google.fonts\": \"1.0\",\n\t\t\"@types/node\": \"24.10.15\",\n\t\t\"@types/react\": \"18.2\",\n\t\t\"@types/react-dom\": \"18.2\",\n\t\t\"@types/yargs\": \"^17.0.33\",\n\t\t\"chalk\": \"^4.1.2\",\n\t\t\"eslint-plugin-framer-studio\": \"workspace:*\",\n\t\t\"framer-motion\": \"12.39.0\",\n\t\t\"immutable\": \"^3.8.3\",\n\t\t\"jest-diff\": \"^29.3.1\",\n\t\t\"jest-environment-jsdom\": \"^29.3.1\",\n\t\t\"jest-environment-jsdom-global\": \"^4.0.0\",\n\t\t\"react\": \"^18.2.0\",\n\t\t\"react-dom\": \"^18.2.0\",\n\t\t\"semver\": \"^7.7.1\",\n\t\t\"typescript\": \"^5.9.2\",\n\t\t\"yargs\": \"^17.7.2\"\n\t},\n\t\"tsdoc\": {\n\t\t\"tsdocFlavor\": \"AEDoc\"\n\t},\n\t\"browserslist\": [\n\t\t\"extends @framer/browserslist-config/sites\"\n\t]\n}\n", "import packageJSON from \"../package.json\" with { type: \"json\" }\n\n/**\n * @public\n */\nexport const version = /* @__PURE__ */ (() => packageJSON.version)()\n", "import { MotionValue, motionValue } from \"framer-motion\"\n\ninterface AddChildProps {\n\ttransformer: (v: any) => any\n}\n// Lord forgive me for my sins\n// This is a hack to support addChild when providing MotionValues created in the latest\n// version of framer-motion to older versions, where its expected. This should be removed\n// when we can guarantee 3rd party modules are using a single version of framer-motion\n// as this will also manifest in less obvious bugs due to multiple contexts etc\n;(MotionValue.prototype as any).addChild = function ({ transformer = v => v }: AddChildProps): MotionValue {\n\tconst child = motionValue(transformer(this.get()))\n\tthis.onChange((v: any) => child.set(transformer(v)))\n\n\treturn child\n}\n", "import { isNumber, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { FourPixelNumberShorthand, TwoPixelNumberShorthand } from \"../NumberShorthand.ts\"\n\nconst supportedUnits = [\n\t\"%\",\n\t\"px\",\n\n\t// Font lengths\n\t\"cap\",\n\t\"ch\",\n\t\"em\",\n\t\"ex\",\n\t\"ic\",\n\t\"lh\",\n\t\"rem\",\n\t\"rlh\",\n\n\t// Real-world lengths\n\t\"cm\",\n\t\"mm\",\n\t\"Q\",\n\t\"in\",\n\t\"pc\",\n\t\"pt\",\n\n\t// Time units\n\t\"ms\",\n\t\"s\",\n\n\t// Frequency units\n\t\"Hz\",\n\t\"kHz\",\n\n\t// Resolution units\n\t\"dpi\",\n\t\"dpcm\",\n\t\"dppx\",\n\t\"x\",\n\n\t// Angle units\n\t\"deg\",\n\t\"grad\",\n\t\"rad\",\n\t\"turn\",\n\n\t// Flex units\n\t\"fr\",\n\n\t// Viewport-relative units\n\t\"vh\",\n\t\"svh\",\n\t\"lvh\",\n\t\"dvh\",\n\n\t\"vw\",\n\t\"svw\",\n\t\"lvw\",\n\t\"dvw\",\n\n\t\"vmin\",\n\t\"svmin\",\n\t\"lvmin\",\n\t\"dvmin\",\n\n\t\"vmax\",\n\t\"svmax\",\n\t\"lvmax\",\n\t\"dvmax\",\n\n\t\"vb\",\n\t\"svb\",\n\t\"lvb\",\n\t\"dvb\",\n\n\t\"vi\",\n\t\"svi\",\n\t\"lvi\",\n\t\"dvi\",\n] as const\n\nexport type CSSUnit = (typeof supportedUnits)[number]\n\n// https://developer.mozilla.org/en-US/docs/Web/CSS/dimension\nexport type CSSDimension<U extends CSSUnit = CSSUnit> = `${number}${U}`\n\n// eslint-disable-next-line regexp/prefer-character-class -- false positive, supportedUnits aren't single element\nconst cssDimensionRegExp = new RegExp(`^([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:e[+-]?\\\\d+)?)(${supportedUnits.join(\"|\")})?$`, \"i\")\nconst unitLookup = new Map<string, CSSUnit>(supportedUnits.map(unit => [unit.toLowerCase(), unit]))\n\n/**\n * Parses a CSS dimension and returns a number and an optional unit. If the\n * number or unit is invalid, the return value will be `[NaN, undefined]`.\n */\nexport function parseCSSDimension<U extends CSSUnit = CSSUnit>(value: CSSDimension<U>): [number, U]\nexport function parseCSSDimension(value: string): [number, CSSUnit | undefined]\nexport function parseCSSDimension<T extends CSSUnit>(value: string, defaultUnit?: T): [number, CSSUnit | T]\nexport function parseCSSDimension(value: string, defaultUnit?: CSSUnit): [number, CSSUnit | undefined] {\n\tconst match = value.match(cssDimensionRegExp)\n\tif (!match) return [NaN, undefined]\n\tconst [, numberString, unitString] = match\n\tconst number = parseFloat(numberString!)\n\tif (Number.isNaN(number)) return [NaN, undefined]\n\tif (!unitString) return [number, defaultUnit]\n\tconst unit = unitLookup.get(unitString.toLowerCase())\n\tif (!unit) throw Error(`unrecognized CSS unit ${unitString}`)\n\treturn [number, unit]\n}\n\nexport function isCSSDimension(value: unknown): value is CSSDimension {\n\tif (!isString(value)) return false\n\tconst [number] = parseCSSDimension(value)\n\treturn !Number.isNaN(number)\n}\n\n/**\n * Combine a value, and a supported unit into a CSSDimension string.\n */\nexport function createCSSDimension<U extends CSSUnit = CSSUnit>(value: number, unit: U): CSSDimension<U> {\n\treturn `${value}${unit}`\n}\n\ninterface SizeContext {\n\tparentSize?: number\n\tviewportSize?: number\n}\n\n/**\n * Given a CSSDimension, convert it into pixels, using the parent size if it is\n * a relative dimension.\n */\nexport function absoluteCSSDimension<U extends CSSUnit = CSSUnit>(\n\tsize: CSSDimension<U> | number | undefined,\n\t{ parentSize, viewportSize }: SizeContext,\n): number | undefined {\n\tif (isUndefined(size)) return undefined\n\tif (isNumber(size)) return size\n\n\tconst [value, unit] = parseCSSDimension(size)\n\tif (Number.isNaN(value)) return undefined\n\n\tswitch (unit) {\n\t\tcase \"px\":\n\t\t\treturn value\n\t\tcase \"%\":\n\t\t\treturn parentSize ? (value / 100) * parentSize : undefined\n\t\tcase \"vh\":\n\t\tcase \"vw\":\n\t\t\treturn viewportSize ? (value / 100) * viewportSize : undefined\n\t\tdefault:\n\t\t\treturn undefined\n\t}\n}\n\nexport function splitLonghandCSSDimension(\n\tvalue: FourPixelNumberShorthand,\n): [\n\tCSSDimension<\"px\"> | undefined,\n\tCSSDimension<\"px\"> | undefined,\n\tCSSDimension<\"px\"> | undefined,\n\tCSSDimension<\"px\"> | undefined,\n] {\n\tif (!isString(value)) return [undefined, undefined, undefined, undefined]\n\n\tconst segments = value.split(\" \")\n\tif (segments.length === 1) {\n\t\tconst [val] = parseCSSDimension(segments[0])\n\t\tconst valueWithUnit = createCSSDimension(val, \"px\")\n\t\treturn [valueWithUnit, valueWithUnit, valueWithUnit, valueWithUnit]\n\t}\n\n\tif (segments.length !== 4) return [undefined, undefined, undefined, undefined]\n\n\treturn segments.map(segment => {\n\t\tconst [val] = parseCSSDimension(segment)\n\t\treturn createCSSDimension(val, \"px\")\n\t}) as [CSSDimension<\"px\">, CSSDimension<\"px\">, CSSDimension<\"px\">, CSSDimension<\"px\">]\n}\n\nconst updateDimensionRegexp = /(?<value>\\d{1,5})px/gu\n/**\n * Updates all px values in the provided string by applying the provided transform function.\n * e.g. updatePxValueString(\"10px 20px 30px 40px\", val => val * 2) returns \"20px 40px 60px 80px\"\n */\nexport function updatePxValueString<T extends FourPixelNumberShorthand | TwoPixelNumberShorthand>(\n\tvalue: T,\n\ttransform: (val: number) => number,\n): T {\n\treturn value.replace(updateDimensionRegexp, (_, matchedValue) => {\n\t\treturn `${transform(Number(matchedValue))}px`\n\t}) as T\n}\n", "import { isNumber } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\n\nexport const DEFAULT_ROOT_FONT_SIZE = 16\n\nexport const rootFontSizeDefaults = {\n\trootFontSize: undefined,\n}\n\nexport interface WithRootFontSize {\n\trootFontSize: number | undefined\n}\n\ninterface HasRootFontSize {\n\trootFontSize: number\n}\n\nconst key: keyof WithRootFontSize = \"rootFontSize\"\nexport function withRootFontSize<T extends CanvasNode>(node: T): node is T & WithRootFontSize {\n\treturn key in node\n}\n\nexport function hasRootFontSize<T extends CanvasNode>(node: T): node is T & HasRootFontSize {\n\treturn key in node && isNumber(node[key])\n}\n", "import { assertNever } from \"@framerjs/shared\"\n// Text transform\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { Color, roundedNumber } from \"library/index.ts\"\nimport { P3Color } from \"library/render/types/Color/Color.ts\"\nimport { isArray, isNumber, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { OpenTypeFontFeatures } from \"../utils/openType.ts\"\nimport type { VariableReference } from \"./VariableReference.ts\"\nimport type { WithCornerShape } from \"./WithCornerShape.ts\"\nimport type { WithPadding } from \"./WithPadding.ts\"\nimport type { WithRadius } from \"./WithRadius.ts\"\nimport type { WithRadiusPerCorner } from \"./WithRadiusPerCorner.ts\"\nimport { DEFAULT_ROOT_FONT_SIZE } from \"./WithRootFontSize.ts\"\nimport { type CSSDimension, createCSSDimension, parseCSSDimension } from \"./utils/CSSDimension.ts\"\nimport type { OmitVariables } from \"./utils/OmitVariables.ts\"\n\nconst textTransformValues = [\"capitalize\", \"uppercase\", \"lowercase\", \"none\", \"inherit\"] as const\nexport type TextTransform = (typeof textTransformValues)[number]\n\nexport function isTextTransform(value: unknown): value is TextTransform {\n\treturn isString(value) && textTransformValues.includes(value as TextTransform)\n}\n\nexport const textTransformDefault: TextTransform = \"none\"\n\nexport const textTransformAddedDefault: TextTransform = \"capitalize\"\n\n// Text decoration\n\nexport const textDecorationValues = [\"underline\", \"line-through\", \"none\"] as const\nexport type TextDecoration = (typeof textDecorationValues)[number]\n\nexport const textDecorationStyleValues = [\"solid\", \"double\", \"dotted\", \"dashed\", \"wavy\"] as const\nexport type TextDecorationStyle = (typeof textDecorationStyleValues)[number]\nexport function isTextDecorationStyle(value: unknown): value is TextDecorationStyle {\n\treturn isString(value) && textDecorationStyleValues.includes(value as TextDecorationStyle)\n}\n\nexport const textDecorationSkipInkValues = [\"auto\", \"none\", \"all\"] as const\nexport type TextDecorationSkipInk = (typeof textDecorationSkipInkValues)[number]\nexport function isTextDecorationSkipInk(value: unknown): value is TextDecorationSkipInk {\n\treturn isString(value) && textDecorationSkipInkValues.includes(value as TextDecorationSkipInk)\n}\n\nexport const textDecorationDimensionUnits = [\"px\", \"em\"] as const\nexport type TextDecorationDimensionUnit = (typeof textDecorationDimensionUnits)[number]\nexport type TextDecorationCSSDimension = CSSDimension<TextDecorationDimensionUnit>\n\nexport function isTextDecorationCSSDimension(value: unknown): value is TextDecorationCSSDimension {\n\tif (!isString(value)) return false\n\ttry {\n\t\tconst [size, unit] = parseCSSDimension(value)\n\t\treturn isNumber(size) && textDecorationDimensionUnits.includes(unit as TextDecorationDimensionUnit)\n\t} catch {\n\t\treturn false\n\t}\n}\n\nexport function isTextDecorationThickness(value: unknown): value is TextDecorationCSSDimension | \"auto\" {\n\tif (!isString(value)) return false\n\treturn value === \"auto\" || isTextDecorationCSSDimension(value)\n}\n\nexport function isTextDecorationOffset(value: unknown): value is TextDecorationCSSDimension | \"auto\" {\n\tif (!isString(value)) return false\n\treturn value === \"auto\" || isTextDecorationCSSDimension(value)\n}\n\ntype TextStrokeDefault = \"initial\"\nexport type TextStrokeColor = string | TextStrokeDefault\nexport type TextStrokeWidth = number | TextStrokeDefault\n\nconst textStrokeDefault: TextStrokeDefault = \"initial\"\nexport const textStrokeWidthAddedDefault = 1\nexport const textStrokeColorAddedDefault = \"rgba(0, 0, 0, 1)\"\nexport const textBackgroundColorAddedDefault: string = \"rgba(0, 0, 0, 0.2)\"\n\nexport function textStrokeWidthToCSS(value: TextStrokeWidth): string {\n\treturn value === textStrokeDefault ? value : `${value}px`\n}\n\nexport function isTextDecoration(value: unknown): value is TextDecoration {\n\treturn isString(value) && textDecorationValues.includes(value as TextDecoration)\n}\n\nconst textDecorationDefault: TextDecoration = \"none\"\n\nexport const textDecorationAddedDefault: TextDecoration = \"underline\"\n\nexport const textDecorationCSSDefaults = {\n\ttextDecoration: \"none\",\n\ttextDecorationColor: \"currentColor\",\n\ttextDecorationThickness: \"auto\",\n\ttextDecorationStyle: \"solid\",\n\ttextDecorationSkipInk: \"auto\",\n\ttextDecorationOffset: \"auto\",\n} as const satisfies Required<Pick<WithTextStyle, Extract<keyof WithTextStyle, `textDecoration${string}`>>>\n\n// Letter spacing\nconst letterSpacingUnits = [\"px\", \"em\"] as const\nexport type LetterSpacingUnit = (typeof letterSpacingUnits)[number]\nexport type LetterSpacing = [number, LetterSpacingUnit]\n\nconst fontSizeUnits = [\"px\", \"rem\"] as const\nconst fontSizeAutoUnit = \"auto\" as const\nconst richTextFontSizeUnit = [...fontSizeUnits, fontSizeAutoUnit] as const\n\nexport type FontSizeUnit = (typeof fontSizeUnits)[number]\nexport type RichTextFontSizeUnit = (typeof richTextFontSizeUnit)[number]\nexport type FontSizeCSSDimension = CSSDimension<FontSizeUnit>\nexport type FontSize = [number, FontSizeUnit]\n\nexport const defaultFontSizePerUnit: Record<FontSizeUnit, FontSize> = {\n\tpx: [16, \"px\"],\n\trem: [1, \"rem\"],\n}\n\nexport const fontSizeRoundingPerUnit: Record<FontSizeUnit, number> = {\n\tpx: 0,\n\trem: 2,\n}\n\nconst validFontSizeCSSUnits = new Set<string>(fontSizeUnits)\nexport function isValidFontSizeUnit(unit: unknown): unit is FontSizeUnit {\n\treturn isString(unit) && validFontSizeCSSUnits.has(unit)\n}\n\nexport function isFontSizeCSSDimension(value: unknown): value is FontSizeCSSDimension {\n\tif (!isString(value)) return false\n\ttry {\n\t\tconst [size, unit] = parseCSSDimension(value)\n\t\treturn isNumber(size) && isValidFontSizeUnit(unit)\n\t} catch {\n\t\treturn false\n\t}\n}\n\nexport function isFontSize(value: unknown): value is FontSize {\n\tif (!isArray(value) || value.length !== 2) return false\n\tconst [size, unit = \"px\"] = value\n\tif (!isNumber(size) || !isString(unit)) return false\n\treturn isValidFontSizeUnit(unit)\n}\n\nexport function isPxFontSize(value: unknown): value is [number, \"px\"] {\n\tif (!isFontSize(value)) return false\n\tconst [, unit] = value\n\treturn unit === \"px\"\n}\n\n/**\n * Convert a font size value from one unit to another.\n * @param size - The size to convert. This could be either a `px` or `rem` value.\n * @param fromUnit - The unit of the size. `px` or `rem`.\n * @param toUnit - The unit to convert the size to. `px` or `rem`.\n * @param rootFontSize - The root font size of the node. Always in `px`. Defaults to 16.\n * @returns The converted font size value, rounded appropriately for the new unit.\n */\nexport function convertFontSizeValue(\n\tsize: number,\n\tfromUnit: FontSizeUnit,\n\ttoUnit: FontSizeUnit,\n\trootFontSize = DEFAULT_ROOT_FONT_SIZE,\n): number {\n\tif (fromUnit === toUnit) return size\n\n\tswitch (toUnit) {\n\t\tcase \"px\":\n\t\t\treturn roundedNumber(size * rootFontSize, fontSizeRoundingPerUnit[toUnit])\n\t\tcase \"rem\":\n\t\t\treturn roundedNumber(size / rootFontSize, fontSizeRoundingPerUnit[toUnit])\n\t\tdefault:\n\t\t\tassertNever(toUnit)\n\t}\n}\n\nexport function toFontSizeCSSDimensionString(\n\tvalue: number | string | FontSizeCSSDimension | FontSize,\n): FontSizeCSSDimension {\n\tif (isNumber(value)) return createCSSDimension(value, \"px\")\n\tif (isFontSize(value)) return createCSSDimension(...value)\n\n\tconst [size, unit] = parseCSSDimension(value)\n\tif (!isUndefined(unit) && isValidFontSizeUnit(unit)) return createCSSDimension(size, unit)\n\tif (isNumber(size)) return createCSSDimension(size, \"px\")\n\n\treturn textStyleDefaults.fontSize\n}\n\n/**\n * Convert a font size CSS dimension from one unit to another.\n * @param fontSize - The font size to convert. Comes with a unit.\n * @param toUnit - The unit to convert the font size to. `px` or `rem`.\n * @returns The converted CSS dimension string, rounded appropriately for the new unit.\n */\nexport function convertFontSizeCSSDimension(\n\tfontSize: FontSizeCSSDimension,\n\ttoUnit: FontSizeUnit,\n): FontSizeCSSDimension {\n\tconst [size, fromUnit] = parseCSSDimension(fontSize)\n\tconst convertedFontSize = convertFontSizeValue(size, fromUnit, toUnit)\n\treturn createCSSDimension(convertedFontSize, toUnit)\n}\n\nexport function isLetterSpacing(value: unknown): value is LetterSpacing {\n\tif (!isArray(value)) return false\n\tif (value.length !== 2) return false\n\tif (!isNumber(value[0])) return false\n\tif (!isLetterSpacingUnit(value[1])) return false\n\treturn true\n}\n\nexport function isLetterSpacingUnit(unit: unknown): unit is LetterSpacingUnit {\n\treturn isString(unit) && letterSpacingUnits.includes(unit as LetterSpacingUnit)\n}\n\nexport function migrateLetterSpacing(value: number | LetterSpacing): LetterSpacing {\n\tif (isArray(value)) return value\n\treturn [value, \"px\"]\n}\n// Line height\n\nconst lineHeightUnits = [\"px\", \"em\", \"%\"] as const\nexport type LineHeightUnit = (typeof lineHeightUnits)[number]\n\nexport function isLineHeightUnit(unit: unknown): unit is LineHeightUnit {\n\treturn isString(unit) && lineHeightUnits.includes(unit as LineHeightUnit)\n}\n\nexport type LineHeight = [number, LineHeightUnit]\n\nexport function isLineHeight(value: unknown): value is LineHeight {\n\tif (!isArray(value)) return false\n\tif (value.length !== 2) return false\n\tif (!isNumber(value[0])) return false\n\tif (!isLineHeightUnit(value[1])) return false\n\treturn true\n}\n\n// Text alignment\n\nconst textAlignmentValues = [\"start\", \"left\", \"center\", \"right\", \"justify\"] as const\nexport type TextAlignment = (typeof textAlignmentValues)[number]\n\nexport function isTextAlignment(value: unknown): value is TextAlignment {\n\treturn isString(value) && textAlignmentValues.includes(value as TextAlignment)\n}\n\nexport type TextBackgroundRadius = OmitVariables<WithRadius & WithRadiusPerCorner>\nexport type TextBackgroundCornerShape = OmitVariables<WithCornerShape>\nexport type TextBackgroundPadding = OmitVariables<WithPadding>\n\n// Text styles\n\nexport interface WithTextStyle {\n\tfont: string | undefined\n\ttextColor: string | VariableReference | undefined\n\ttextBackgroundColor: string | VariableReference | undefined\n\ttextBackgroundRadius: TextBackgroundRadius | undefined\n\ttextBackgroundCornerShape: TextBackgroundCornerShape | undefined\n\ttextBackgroundPadding: TextBackgroundPadding | undefined\n\tfontSize: number | FontSizeCSSDimension | VariableReference\n\t// We keep the `number` letterSpacing type to avoid a migration. During rendering and updating, we use\n\t// migrateLetterSpacing to populate the value with a unit for consistency.\n\tletterSpacing: number | LetterSpacing\n\ttextTransform: TextTransform | undefined\n\t/** https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration-line */\n\ttextDecoration: TextDecoration | undefined\n\t/** https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration-color */\n\ttextDecorationColor: string | undefined\n\t/** https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration-thickness */\n\ttextDecorationThickness: \"auto\" | TextDecorationCSSDimension | undefined\n\t/** https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration-style */\n\ttextDecorationStyle: TextDecorationStyle | undefined\n\t/** https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration-skip-ink */\n\ttextDecorationSkipInk: TextDecorationSkipInk | undefined\n\t/** https://developer.mozilla.org/en-US/docs/Web/CSS/text-underline-offset */\n\ttextDecorationOffset: \"auto\" | TextDecorationCSSDimension | undefined\n\tlineHeight: LineHeight\n\ttextAlignment: TextAlignment | undefined\n\ttextStrokeWidth: TextStrokeWidth\n\ttextStrokeColor: TextStrokeColor\n\topenTypeFontFeatures: OpenTypeFontFeatures | undefined\n}\n\nexport type WithStaticTextStyle = OmitVariables<WithTextStyle>\n\ninterface SizesWithCSSDimension {\n\tfontSize: true\n}\nexport type OmitCSSDimension<T extends WithTextStyle> = {\n\t[K in keyof T]: K extends keyof SizesWithCSSDimension ? Exclude<T[K], CSSDimension> : T[K]\n}\n\nexport const textStyleDefaults = {\n\tfont: \"Inter\",\n\ttextColor: \"hsl(0, 0%, 0%)\",\n\ttextBackgroundColor: undefined,\n\ttextBackgroundRadius: undefined,\n\ttextBackgroundCornerShape: undefined,\n\ttextBackgroundPadding: undefined,\n\tfontSize: createCSSDimension(16, \"px\"),\n\tletterSpacing: [0, \"em\"], // @NOTE: changing this default will impact code component as well, see `defaultFontValuesForOptionalKeys`\n\ttextTransform: textTransformDefault,\n\ttextDecoration: textDecorationDefault,\n\ttextDecorationColor: undefined,\n\ttextDecorationThickness: undefined,\n\ttextDecorationStyle: undefined,\n\ttextDecorationSkipInk: undefined,\n\ttextDecorationOffset: undefined,\n\tlineHeight: [1.2, \"em\"],\n\ttextAlignment: \"start\",\n\ttextStrokeWidth: textStrokeDefault,\n\ttextStrokeColor: textStrokeDefault,\n\topenTypeFontFeatures: undefined,\n} satisfies WithStaticTextStyle\n\nconst key: keyof WithTextStyle = \"font\"\n\nexport function withTextStyle<T extends CanvasNode>(node: T): node is T & WithTextStyle {\n\treturn key in node\n}\n\nexport function isTextDecorationEnabled(textDecoration: WithTextStyle[\"textDecoration\"]) {\n\treturn !isUndefined(textDecoration) && textDecoration !== \"none\"\n}\n\nexport function textBackgroundColorFromTextColor(textColor: string) {\n\tconst p3Color = P3Color.fromString(textColor)\n\tif (p3Color) {\n\t\treturn P3Color.multiplyAlpha(p3Color, 0.2).toString()\n\t}\n\n\treturn Color.multiplyAlpha(Color(textColor), 0.2).toValue()\n}\n", "/**\n *  base64.ts\n *\n *  Licensed under the BSD 3-Clause License.\n *    http://opensource.org/licenses/BSD-3-Clause\n *\n *  References:\n *    http://en.wikipedia.org/wiki/Base64\n *\n * @author Dan Kogai (https://github.com/dankogai)\n */\nconst version = '3.7.4';\n/**\n * @deprecated use lowercase `version`.\n */\nconst VERSION = version;\nconst _hasatob = typeof atob === 'function';\nconst _hasbtoa = typeof btoa === 'function';\nconst _hasBuffer = typeof Buffer === 'function';\nconst _TD = typeof TextDecoder === 'function' ? new TextDecoder() : undefined;\nconst _TE = typeof TextEncoder === 'function' ? new TextEncoder() : undefined;\nconst b64ch = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\nconst b64chs = Array.prototype.slice.call(b64ch);\nconst b64tab = ((a) => {\n    let tab = {};\n    a.forEach((c, i) => tab[c] = i);\n    return tab;\n})(b64chs);\nconst b64re = /^(?:[A-Za-z\\d+\\/]{4})*?(?:[A-Za-z\\d+\\/]{2}(?:==)?|[A-Za-z\\d+\\/]{3}=?)?$/;\nconst _fromCC = String.fromCharCode.bind(String);\nconst _U8Afrom = typeof Uint8Array.from === 'function'\n    ? Uint8Array.from.bind(Uint8Array)\n    : (it, fn = (x) => x) => new Uint8Array(Array.prototype.slice.call(it, 0).map(fn));\nconst _mkUriSafe = (src) => src\n    .replace(/=/g, '').replace(/[+\\/]/g, (m0) => m0 == '+' ? '-' : '_');\nconst _tidyB64 = (s) => s.replace(/[^A-Za-z0-9\\+\\/]/g, '');\n/**\n * polyfill version of `btoa`\n */\nconst btoaPolyfill = (bin) => {\n    // console.log('polyfilled');\n    let u32, c0, c1, c2, asc = '';\n    const pad = bin.length % 3;\n    for (let i = 0; i < bin.length;) {\n        if ((c0 = bin.charCodeAt(i++)) > 255 ||\n            (c1 = bin.charCodeAt(i++)) > 255 ||\n            (c2 = bin.charCodeAt(i++)) > 255)\n            throw new TypeError('invalid character found');\n        u32 = (c0 << 16) | (c1 << 8) | c2;\n        asc += b64chs[u32 >> 18 & 63]\n            + b64chs[u32 >> 12 & 63]\n            + b64chs[u32 >> 6 & 63]\n            + b64chs[u32 & 63];\n    }\n    return pad ? asc.slice(0, pad - 3) + \"===\".substring(pad) : asc;\n};\n/**\n * does what `window.btoa` of web browsers do.\n * @param {String} bin binary string\n * @returns {string} Base64-encoded string\n */\nconst _btoa = _hasbtoa ? (bin) => btoa(bin)\n    : _hasBuffer ? (bin) => Buffer.from(bin, 'binary').toString('base64')\n        : btoaPolyfill;\nconst _fromUint8Array = _hasBuffer\n    ? (u8a) => Buffer.from(u8a).toString('base64')\n    : (u8a) => {\n        // cf. https://stackoverflow.com/questions/12710001/how-to-convert-uint8-array-to-base64-encoded-string/12713326#12713326\n        const maxargs = 0x1000;\n        let strs = [];\n        for (let i = 0, l = u8a.length; i < l; i += maxargs) {\n            strs.push(_fromCC.apply(null, u8a.subarray(i, i + maxargs)));\n        }\n        return _btoa(strs.join(''));\n    };\n/**\n * converts a Uint8Array to a Base64 string.\n * @param {boolean} [urlsafe] URL-and-filename-safe a la RFC4648 \u00A75\n * @returns {string} Base64 string\n */\nconst fromUint8Array = (u8a, urlsafe = false) => urlsafe ? _mkUriSafe(_fromUint8Array(u8a)) : _fromUint8Array(u8a);\n// This trick is found broken https://github.com/dankogai/js-base64/issues/130\n// const utob = (src: string) => unescape(encodeURIComponent(src));\n// reverting good old fationed regexp\nconst cb_utob = (c) => {\n    if (c.length < 2) {\n        var cc = c.charCodeAt(0);\n        return cc < 0x80 ? c\n            : cc < 0x800 ? (_fromCC(0xc0 | (cc >>> 6))\n                + _fromCC(0x80 | (cc & 0x3f)))\n                : (_fromCC(0xe0 | ((cc >>> 12) & 0x0f))\n                    + _fromCC(0x80 | ((cc >>> 6) & 0x3f))\n                    + _fromCC(0x80 | (cc & 0x3f)));\n    }\n    else {\n        var cc = 0x10000\n            + (c.charCodeAt(0) - 0xD800) * 0x400\n            + (c.charCodeAt(1) - 0xDC00);\n        return (_fromCC(0xf0 | ((cc >>> 18) & 0x07))\n            + _fromCC(0x80 | ((cc >>> 12) & 0x3f))\n            + _fromCC(0x80 | ((cc >>> 6) & 0x3f))\n            + _fromCC(0x80 | (cc & 0x3f)));\n    }\n};\nconst re_utob = /[\\uD800-\\uDBFF][\\uDC00-\\uDFFFF]|[^\\x00-\\x7F]/g;\n/**\n * @deprecated should have been internal use only.\n * @param {string} src UTF-8 string\n * @returns {string} UTF-16 string\n */\nconst utob = (u) => u.replace(re_utob, cb_utob);\n//\nconst _encode = _hasBuffer\n    ? (s) => Buffer.from(s, 'utf8').toString('base64')\n    : _TE\n        ? (s) => _fromUint8Array(_TE.encode(s))\n        : (s) => _btoa(utob(s));\n/**\n * converts a UTF-8-encoded string to a Base64 string.\n * @param {boolean} [urlsafe] if `true` make the result URL-safe\n * @returns {string} Base64 string\n */\nconst encode = (src, urlsafe = false) => urlsafe\n    ? _mkUriSafe(_encode(src))\n    : _encode(src);\n/**\n * converts a UTF-8-encoded string to URL-safe Base64 RFC4648 \u00A75.\n * @returns {string} Base64 string\n */\nconst encodeURI = (src) => encode(src, true);\n// This trick is found broken https://github.com/dankogai/js-base64/issues/130\n// const btou = (src: string) => decodeURIComponent(escape(src));\n// reverting good old fationed regexp\nconst re_btou = /[\\xC0-\\xDF][\\x80-\\xBF]|[\\xE0-\\xEF][\\x80-\\xBF]{2}|[\\xF0-\\xF7][\\x80-\\xBF]{3}/g;\nconst cb_btou = (cccc) => {\n    switch (cccc.length) {\n        case 4:\n            var cp = ((0x07 & cccc.charCodeAt(0)) << 18)\n                | ((0x3f & cccc.charCodeAt(1)) << 12)\n                | ((0x3f & cccc.charCodeAt(2)) << 6)\n                | (0x3f & cccc.charCodeAt(3)), offset = cp - 0x10000;\n            return (_fromCC((offset >>> 10) + 0xD800)\n                + _fromCC((offset & 0x3FF) + 0xDC00));\n        case 3:\n            return _fromCC(((0x0f & cccc.charCodeAt(0)) << 12)\n                | ((0x3f & cccc.charCodeAt(1)) << 6)\n                | (0x3f & cccc.charCodeAt(2)));\n        default:\n            return _fromCC(((0x1f & cccc.charCodeAt(0)) << 6)\n                | (0x3f & cccc.charCodeAt(1)));\n    }\n};\n/**\n * @deprecated should have been internal use only.\n * @param {string} src UTF-16 string\n * @returns {string} UTF-8 string\n */\nconst btou = (b) => b.replace(re_btou, cb_btou);\n/**\n * polyfill version of `atob`\n */\nconst atobPolyfill = (asc) => {\n    // console.log('polyfilled');\n    asc = asc.replace(/\\s+/g, '');\n    if (!b64re.test(asc))\n        throw new TypeError('malformed base64.');\n    asc += '=='.slice(2 - (asc.length & 3));\n    let u24, bin = '', r1, r2;\n    for (let i = 0; i < asc.length;) {\n        u24 = b64tab[asc.charAt(i++)] << 18\n            | b64tab[asc.charAt(i++)] << 12\n            | (r1 = b64tab[asc.charAt(i++)]) << 6\n            | (r2 = b64tab[asc.charAt(i++)]);\n        bin += r1 === 64 ? _fromCC(u24 >> 16 & 255)\n            : r2 === 64 ? _fromCC(u24 >> 16 & 255, u24 >> 8 & 255)\n                : _fromCC(u24 >> 16 & 255, u24 >> 8 & 255, u24 & 255);\n    }\n    return bin;\n};\n/**\n * does what `window.atob` of web browsers do.\n * @param {String} asc Base64-encoded string\n * @returns {string} binary string\n */\nconst _atob = _hasatob ? (asc) => atob(_tidyB64(asc))\n    : _hasBuffer ? (asc) => Buffer.from(asc, 'base64').toString('binary')\n        : atobPolyfill;\n//\nconst _toUint8Array = _hasBuffer\n    ? (a) => _U8Afrom(Buffer.from(a, 'base64'))\n    : (a) => _U8Afrom(_atob(a), c => c.charCodeAt(0));\n/**\n * converts a Base64 string to a Uint8Array.\n */\nconst toUint8Array = (a) => _toUint8Array(_unURI(a));\n//\nconst _decode = _hasBuffer\n    ? (a) => Buffer.from(a, 'base64').toString('utf8')\n    : _TD\n        ? (a) => _TD.decode(_toUint8Array(a))\n        : (a) => btou(_atob(a));\nconst _unURI = (a) => _tidyB64(a.replace(/[-_]/g, (m0) => m0 == '-' ? '+' : '/'));\n/**\n * converts a Base64 string to a UTF-8 string.\n * @param {String} src Base64 string.  Both normal and URL-safe are supported\n * @returns {string} UTF-8 string\n */\nconst decode = (src) => _decode(_unURI(src));\n/**\n * check if a value is a valid Base64 string\n * @param {String} src a value to check\n  */\nconst isValid = (src) => {\n    if (typeof src !== 'string')\n        return false;\n    const s = src.replace(/\\s+/g, '').replace(/={0,2}$/, '');\n    return !/[^\\s0-9a-zA-Z\\+/]/.test(s) || !/[^\\s0-9a-zA-Z\\-_]/.test(s);\n};\n//\nconst _noEnum = (v) => {\n    return {\n        value: v, enumerable: false, writable: true, configurable: true\n    };\n};\n/**\n * extend String.prototype with relevant methods\n */\nconst extendString = function () {\n    const _add = (name, body) => Object.defineProperty(String.prototype, name, _noEnum(body));\n    _add('fromBase64', function () { return decode(this); });\n    _add('toBase64', function (urlsafe) { return encode(this, urlsafe); });\n    _add('toBase64URI', function () { return encode(this, true); });\n    _add('toBase64URL', function () { return encode(this, true); });\n    _add('toUint8Array', function () { return toUint8Array(this); });\n};\n/**\n * extend Uint8Array.prototype with relevant methods\n */\nconst extendUint8Array = function () {\n    const _add = (name, body) => Object.defineProperty(Uint8Array.prototype, name, _noEnum(body));\n    _add('toBase64', function (urlsafe) { return fromUint8Array(this, urlsafe); });\n    _add('toBase64URI', function () { return fromUint8Array(this, true); });\n    _add('toBase64URL', function () { return fromUint8Array(this, true); });\n};\n/**\n * extend Builtin prototypes with relevant methods\n */\nconst extendBuiltins = () => {\n    extendString();\n    extendUint8Array();\n};\nconst gBase64 = {\n    version: version,\n    VERSION: VERSION,\n    atob: _atob,\n    atobPolyfill: atobPolyfill,\n    btoa: _btoa,\n    btoaPolyfill: btoaPolyfill,\n    fromBase64: decode,\n    toBase64: encode,\n    encode: encode,\n    encodeURI: encodeURI,\n    encodeURL: encodeURI,\n    utob: utob,\n    btou: btou,\n    decode: decode,\n    isValid: isValid,\n    fromUint8Array: fromUint8Array,\n    toUint8Array: toUint8Array,\n    extendString: extendString,\n    extendUint8Array: extendUint8Array,\n    extendBuiltins: extendBuiltins,\n};\n// makecjs:CUT //\nexport { version };\nexport { VERSION };\nexport { _atob as atob };\nexport { atobPolyfill };\nexport { _btoa as btoa };\nexport { btoaPolyfill };\nexport { decode as fromBase64 };\nexport { encode as toBase64 };\nexport { utob };\nexport { encode };\nexport { encodeURI };\nexport { encodeURI as encodeURL };\nexport { btou };\nexport { decode };\nexport { isValid };\nexport { fromUint8Array };\nexport { toUint8Array };\nexport { extendString };\nexport { extendUint8Array };\nexport { extendBuiltins };\n// and finally,\nexport { gBase64 as Base64 };\n", "import type { Mixed } from \"@framerjs/shared\"\nimport { isMixed } from \"@framerjs/shared\"\n\n/** Initial state of a reduced value. */\nexport const NotFound = Symbol(\"Not Found\")\n\n/** Initial state of a reduced value. */\nexport type NotFound = typeof NotFound\n\nexport function isNotFound(value: unknown): value is NotFound {\n\treturn value === NotFound\n}\n\nexport function isFound<T>(value: T | NotFound): value is T {\n\treturn value !== NotFound\n}\n\nexport function isFoundAndNotMixed<T>(value: T | NotFound | Mixed): value is T {\n\treturn isFound(value) && !isMixed(value)\n}\n\nexport function isFoundAndNotUndefined<T>(value: T | undefined): value is Exclude<T, undefined | NotFound> {\n\treturn isFound(value) && value !== undefined\n}\n\nexport function isFoundAndNotMixedAndNotUndefined<T>(\n\tvalue: T | NotFound | Mixed | undefined,\n): value is Exclude<T, NotFound | Mixed | undefined> {\n\treturn isFoundAndNotMixed(value) && value !== undefined\n}\n\n/**\n * Reduced represents the common value from a selection of sources.\n *\n * The generic type `T` is returned when all values are equal. `Mixed` when multiple different\n * values are found. And `NotFound` means that it hasn't been set (yet).\n */\nexport type Reduced<T> = T | Mixed | NotFound\n\ntype OptionalToUndefinedWithAddedValueType<T, U> = {\n\t[P in keyof Required<T>]: T[P] | U\n}\n\n/**\n * Can be used to reduce all values on a Record. Perfect for reducing entire traits. Note that\n * properties can not be optional, because all reduced top level properties should start out as\n * NotFound.\n *\n * NOTE: In theory traits should never have optional properties, but in practice they do\n * sometimes, to prevent bugs we make sure those are correctly reduced to undefined.\n */\nexport type ReducedRecord<T> = OptionalToUndefinedWithAddedValueType<T, NotFound | Mixed>\nexport type UnreducedRecord<T> = { [P in keyof T]: Exclude<T[P], NotFound | Mixed> }\n\n/**\n * Sub properties are always found, because we start with finding an entire object. The properties\n * should not be optional because otherwise the behavior would be different when the order of your\n * selection changes.\n *\n * NOTE: Don't use this trait for top level properties, because those should always start out as\n * NotFound.\n */\nexport type ReducedSubPropertyRecord<T> = OptionalToUndefinedWithAddedValueType<T, Mixed>\n", "import { assert, type DeepReadonly, Mixed, isMixed } from \"@framerjs/shared\"\nimport { experiments } from \"app/experiments.ts\"\nimport { Base64 } from \"js-base64\"\nimport { FontSourceNames, fontStore } from \"library/index.ts\"\nimport type { ReadonlyFont, ReadonlyFontVariationAxes } from \"library/render/fonts/types.ts\"\nimport { isVariableFont } from \"library/render/fonts/variableFont.ts\"\nimport { isArray, isNumber, isUndefined } from \"utils/typeChecks.ts\"\nimport type { RichTextNode } from \"../nodes/RichTextNode.ts\"\nimport { isFoundAndNotMixed } from \"../traits/utils/Reduced.ts\"\nimport type { ReducedFontVariationAxes } from \"../traits/utils/reduceText.ts\"\n\nexport type VariationAxisTag = string\n\nexport interface VariationAxis {\n\ttag: VariationAxisTag\n\tminValue: number\n\tmaxValue: number\n\tdefaultValue: number\n\tname?: string\n}\n\nexport type VariationAxesToValues = Record<VariationAxisTag, number>\n\nconst quoteRegex = /[\"']/gu\n\n/**\n * Parses CSS font-variation-settings and returns a VariationAxesToValues object.\n *\n * Example:\n * \"wght\" 500, \"wdth\" 200, \"opsz\" 12, \"ital\" 0, \"slnt\" 0;`\n *\n * Returns:\n * {\n *   \"wght\": 500,\n *   \"wdth\": 200,\n *   \"opsz\": 12,\n *   \"ital\": 0,\n *   \"slnt\": 0,\n * }\n */\nexport function cssToVariationAxes(css: string): VariationAxesToValues | undefined {\n\tconst axisTags = css.split(\",\")\n\n\tconst axes: VariationAxesToValues = {}\n\n\tfor (const tag of axisTags) {\n\t\t// strip whitespace from the start and end of the string\n\t\tconst [axis, value] = tag.trim().split(\" \")\n\t\tif (isUndefined(axis) || isUndefined(value)) continue\n\t\tconst parsedValue = parseFloat(value)\n\t\tif (!isNumber(parsedValue)) continue\n\t\tconst axisTag = axis.replace(quoteRegex, \"\")\n\t\taxes[axisTag] = parsedValue\n\t}\n\treturn axes\n}\n\nexport function variationAxesToCSS(axes: VariationAxesToValues | undefined): string | undefined {\n\tif (isUndefined(axes)) return \"normal\"\n\tconst css: string[] = []\n\n\tfor (const axis in axes) {\n\t\tconst value = axes[axis]\n\t\tcss.push(`\"${axis}\" ${value}`)\n\t}\n\treturn css.join(\", \")\n}\n\nexport function updateVariationAxes(\n\taxisTag: VariationAxisTag | VariationAxisTag[],\n\tvalue: number | number[] | undefined,\n\tpreviousAxes: VariationAxesToValues | undefined,\n): VariationAxesToValues | undefined {\n\tconst axes = { ...previousAxes }\n\tif (Array.isArray(axisTag)) {\n\t\taxisTag.forEach((tag, index) => {\n\t\t\tconst currentValue = isArray(value) ? value[index] : value\n\t\t\tif (isUndefined(value) || isUndefined(currentValue)) {\n\t\t\t\tdelete axes[tag]\n\t\t\t} else {\n\t\t\t\taxes[tag] = currentValue\n\t\t\t}\n\t\t})\n\t} else {\n\t\tif (isUndefined(value)) {\n\t\t\tdelete axes[axisTag]\n\t\t} else {\n\t\t\tassert(isNumber(value), \"value should be a number\")\n\t\t\taxes[axisTag] = value\n\t\t}\n\t}\n\n\treturn axes\n}\n\n/**\n * Rounds a number to the closest non-variable font weight.\n * Example: 545 -> 500, 560 -> 600, 305 -> 300, etc.\n * @param number - The number to round\n */\nfunction variableWeightToNonVariableWeight(number: number): number {\n\treturn Math.round(number / 100) * 100\n}\n\n/**\n * Returns the closest non-variable font selector to the given font, based on the variation axes.\n * The only variation axis that is considered is 'wght', which is used to determine the closest font.\n * Example:\n * `{ wght: 400, ... }`, the closest non-variable font would be the Regular\n * variant since it corresponds to the 400 weight.\n *\n * `{ wght: 560, ... }`, the closest non-variable font would be the Semibold since\n * 560 is closest to 600 and 600 corresponds to the Semibold variant.\n */\nexport function getClosestNonVariableVariantSelector(\n\tinitialFont: ReadonlyFont,\n\tvariationAxes: ReducedFontVariationAxes,\n\tfallbackWeight: number = 400,\n): ReadonlyFont[\"selector\"] | undefined {\n\tassert(isFontVariable(initialFont), \"This method should only be called on fonts which are variable\")\n\n\tlet axisWeight = variationAxes[\"wght\"]\n\tif (!isFoundAndNotMixed(axisWeight) || isUndefined(axisWeight)) {\n\t\taxisWeight = fallbackWeight\n\t}\n\n\tconst weight = variableWeightToNonVariableWeight(axisWeight)\n\tlet fallbackSelector: string | undefined = undefined\n\tfor (const font of initialFont.family.fonts) {\n\t\tconst styleMatch = font.style === initialFont.style && !isFontVariable(font)\n\n\t\tif (font.weight === weight && styleMatch) {\n\t\t\treturn font.selector\n\t\t}\n\n\t\t// If by the end of the loop we haven't found a font with the same weight\n\t\t// and style we use the selector that matches the fallback weight and style.\n\t\tif (font.weight === fallbackWeight && styleMatch) {\n\t\t\tfallbackSelector = font.selector\n\t\t}\n\t}\n\n\treturn fallbackSelector\n}\n\nexport function isFontVariable(font: ReadonlyFont | undefined): boolean {\n\tif (!font) return false\n\t// @TODO: Investigate if we still need the `font.selector` check or we can safely rely on\n\t// `isVariableFont(font)` for all font sources\n\treturn isVariableFont(font) || font.selector.toLowerCase().includes(\"variable\")\n}\n\nfunction isFontItalic(font: ReadonlyFont): boolean {\n\tconst { variant, style } = font\n\treturn style === \"italic\" || (isUndefined(style) && variant.toLowerCase().includes(\"italic\"))\n}\n\nexport function getDefaultVariationAxesValues(\n\tvariationAxes: DeepReadonly<VariationAxis[]>,\n\tdefaultWeight: number | undefined,\n): { tags: VariationAxisTag[]; values: number[] } {\n\tconst tags: string[] = []\n\tconst values: number[] = []\n\n\tvariationAxes?.forEach(item => {\n\t\tlet value = item.defaultValue\n\t\tif (item.tag === \"wght\" && isNumber(defaultWeight)) {\n\t\t\tvalue = defaultWeight\n\t\t}\n\t\ttags.push(item.tag)\n\t\tvalues.push(value)\n\t})\n\treturn { tags, values }\n}\n\nexport function getVariationAxesTitle(font: ReadonlyFont, variationAxes: ReducedFontVariationAxes | undefined): string {\n\tconst weight = variationAxes?.[\"wght\"]\n\n\tconst title: string[] = []\n\tif (isNumber(weight)) {\n\t\ttitle.push(weight.toString())\n\t} else {\n\t\ttitle.push(\"Variable\")\n\t}\n\n\tif (isFontItalic(font)) {\n\t\ttitle.push(\"Italic\")\n\t}\n\n\treturn title.join(title[0] === \"Variable\" ? \" \" : \", \")\n}\n\nexport function getFontVariableSelectorFromFont(font: ReadonlyFont | undefined): string | undefined {\n\tif (isUndefined(font)) return undefined\n\tassert(!isFontVariable(font), \"This method should only be called on fonts which are not variable\")\n\n\tif (isFontItalic(font) && font.selectorVariableItalic) {\n\t\treturn font.selectorVariableItalic\n\t}\n\n\treturn font.selectorVariable\n}\n\nexport function getCommonVariableFont(fontSelectors: Set<string>): ReadonlyFont | Mixed | undefined {\n\tlet commonFont: ReadonlyFont | undefined\n\n\tfor (const fontSelector of fontSelectors) {\n\t\tconst font = fontStore.getFontBySelector(fontSelector)\n\t\tif (isUndefined(font)) return undefined\n\n\t\tif (isUndefined(commonFont)) {\n\t\t\tconst { source } = font.family\n\t\t\tif (\n\t\t\t\t(!experiments.isOn(\"customFontGrouping\") && source === FontSourceNames.Custom) ||\n\t\t\t\tsource === FontSourceNames.BuiltIn\n\t\t\t) {\n\t\t\t\tcommonFont = font\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst variableFont = fontStore.getFontBySelector(font.selectorVariable)\n\t\t\tif (isUndefined(variableFont)) return undefined\n\t\t\tcommonFont = variableFont\n\t\t} else if (font.family.source === FontSourceNames.Custom) {\n\t\t\tif (commonFont.family.source !== FontSourceNames.Custom) return Mixed\n\t\t\tif (font.selector !== commonFont.selector) return Mixed\n\t\t} else if (font.selectorVariable !== commonFont.selectorVariable) {\n\t\t\treturn Mixed\n\t\t}\n\t}\n\n\treturn commonFont\n}\n\n/**\n * Adds default variation axes to a font selector for variable fonts.\n * This is used when changing font or font family to ensure variable fonts have proper axes set.\n */\nexport function addDefaultVariationAxesToSelector(\n\tfontSelector: string,\n\tvariationAxes: readonly VariationAxis[] | undefined,\n\tnode: RichTextNode,\n\tselectedFontWeight: number | undefined,\n): string {\n\tif (!variationAxes || !experiments.isOn(\"customFontGrouping\")) return fontSelector\n\n\tconst [currentFontAxesCSS] = node.getVariationAxes(false)\n\tconst weight = currentFontAxesCSS?.wght ?? selectedFontWeight\n\tconst { tags, values } = getDefaultVariationAxesValues(variationAxes, weight)\n\tconst axes = updateVariationAxes(tags, values, currentFontAxesCSS)\n\tif (isUndefined(axes)) return fontSelector\n\n\treturn addEncodedAxesToSelector(fontSelector, axes)\n}\n\nconst variationAxesSplitter = \"VF=\"\n\nexport function addEncodedAxesToSelector(selector: string, axes: VariationAxesToValues): string {\n\tconst axesCSS = variationAxesToCSS(axes)\n\tif (isUndefined(axesCSS)) return selector\n\n\tconst encodedAxes = Base64.encode(axesCSS)\n\treturn `${selector}${variationAxesSplitter}${encodedAxes}`\n}\n\nexport function removeEncodedAxesFromSelector(selector: string): string {\n\treturn parseAxesFromFontSelector(selector).selector\n}\n\nexport function replaceEncodedAxesInSelector(currentSelector: string, axes: VariationAxesToValues): string {\n\tconst cleanedFontSelector = removeEncodedAxesFromSelector(currentSelector)\n\tconst newSelector = addEncodedAxesToSelector(cleanedFontSelector, axes)\n\treturn newSelector\n}\n\nexport function parseAxesFromFontSelector(fontSelector: string): { selector: string; axesCSS: string | undefined } {\n\tconst [selector, axes] = fontSelector.split(variationAxesSplitter)\n\treturn {\n\t\tselector,\n\t\taxesCSS: isUndefined(axes) ? undefined : Base64.decode(axes),\n\t}\n}\n\ninterface FontVariantChanges {\n\tvariationAxes: VariationAxesToValues | undefined\n\tfontsToLoad: string[]\n\tvariableFontSelector?: string\n\tshouldLoadFonts: boolean\n}\n\n/**\n * Gets the updated font selectors and variation axes for when font variation axes are changed\n */\nexport function getFontVariantChanges(options: {\n\tfontSelectors: Set<string>\n\taxisTag: VariationAxisTag | VariationAxisTag[]\n\taxisValue: number | number[] | undefined\n\tavailableAxes?: ReadonlyFontVariationAxes\n\tcurrentAxes?: VariationAxesToValues\n\tincludeItalic?: boolean\n}): FontVariantChanges {\n\tconst { fontSelectors, axisTag, axisValue, availableAxes, currentAxes, includeItalic = false } = options\n\n\tconst variationAxes = updateVariationAxes(axisTag, axisValue, currentAxes)\n\tconst fontsToLoad: string[] = []\n\n\tconst enablingAxes = isArray(axisTag) && isArray(axisValue) && !!availableAxes\n\n\tconst commonVariableFont = enablingAxes ? getCommonVariableFont(fontSelectors) : undefined\n\tif (isUndefined(commonVariableFont) || isMixed(commonVariableFont)) {\n\t\treturn { variationAxes, fontsToLoad, shouldLoadFonts: false }\n\t}\n\n\tconst { selectorVariableItalic, family } = commonVariableFont\n\tconst { source } = family\n\n\tconst variableFontSelector =\n\t\t(!experiments.isOn(\"customFontGrouping\") && source === FontSourceNames.Custom) || source === FontSourceNames.BuiltIn\n\t\t\t? commonVariableFont.selector\n\t\t\t: commonVariableFont.selectorVariable\n\n\tassert(variableFontSelector, \"Font does not have a variable selector.\")\n\n\tconst needsVariableSelector = enablingAxes && !!variableFontSelector && !fontSelectors.has(variableFontSelector)\n\n\tlet needsItalicVariableSelector = false\n\tif (enablingAxes && includeItalic && selectorVariableItalic) {\n\t\tfor (const fontSelector of fontSelectors) {\n\t\t\tconst font = fontStore.getFontBySelector(fontSelector)\n\t\t\tif (isUndefined(font)) continue\n\t\t\tif (isFontItalic(font) && font.selectorVariableItalic) {\n\t\t\t\tneedsItalicVariableSelector = !fontSelectors.has(selectorVariableItalic)\n\t\t\t\tif (needsItalicVariableSelector) break\n\t\t\t}\n\t\t}\n\t}\n\n\tif (needsVariableSelector && variableFontSelector) fontsToLoad.push(variableFontSelector)\n\tif (needsItalicVariableSelector && selectorVariableItalic) fontsToLoad.push(selectorVariableItalic)\n\n\tconst shouldLoadFonts = needsVariableSelector || needsItalicVariableSelector\n\n\treturn {\n\t\tvariationAxes,\n\t\tfontsToLoad,\n\t\tvariableFontSelector,\n\t\tshouldLoadFonts,\n\t}\n}\n\n/**\n * Returns the non-variable font selector to use when removing variation axes\n */\nexport function getNonVariableFontSelector(\n\tfontSelector: string,\n\tvariationAxes: ReducedFontVariationAxes,\n): string | undefined {\n\tconst currentFont = fontStore.getFontBySelector(fontSelector)\n\tif (!currentFont) return undefined\n\n\tif (!isFontVariable(currentFont)) return undefined\n\n\tconst { source } = currentFont.family\n\n\tif (\n\t\t(!experiments.isOn(\"customFontGrouping\") && source === FontSourceNames.Custom) ||\n\t\tsource === FontSourceNames.BuiltIn\n\t) {\n\t\treturn undefined\n\t}\n\n\t// For other fonts, find the closest non-variable variant\n\treturn getClosestNonVariableVariantSelector(currentFont, variationAxes)\n}\n\nexport const testing = {\n\tvariableWeightToNonVariableWeight,\n\tisFontVariable,\n\tisFontItalic,\n\tcssToVariationAxes,\n\tvariationAxesToCSS,\n\tgetClosestNonVariableVariantSelector,\n\tencodeAxesToSelector: addEncodedAxesToSelector,\n\tremoveEncodedAxesFromSelector,\n\tparseAxesFromFontSelector,\n}\n", "import { isArray, isNumber } from \"./typeChecks.ts\"\n\nexport function isFourNumberList(value: unknown): value is [number, number, number, number] {\n\treturn isArray(value) && value.length === 4 && value.every(isNumber)\n}\n", "/**\n * the first and the third parameters of a bezier-based ease definition must be >= 0 && <= 1 because we cannot go back in time\n */\n\nimport { isFourNumberList } from \"./isFourNumberList.ts\"\n\nexport function normalizeEase(easeDefinition: string): string\nexport function normalizeEase(easeDefinition: undefined): undefined\nexport function normalizeEase(easeDefinition: [number, number, number, number]): [number, number, number, number]\nexport function normalizeEase(\n\teaseDefinition?: [number, number, number, number] | string,\n): [number, number, number, number] | string | undefined {\n\tif (!isFourNumberList(easeDefinition)) return easeDefinition\n\treturn [\n\t\tMath.min(Math.max(easeDefinition[0], 0), 1),\n\t\teaseDefinition[1],\n\t\tMath.min(Math.max(easeDefinition[2], 0), 1),\n\t\teaseDefinition[3],\n\t]\n}\n", "import { isFunction } from \"./typeChecks.ts\"\n\nexport function add<E>(ls: E[], e: E): E[] {\n\treturn ls.concat([e])\n}\n\nexport function set<E>(ls: E[], index: number, e: E): E[] {\n\tconst ls2 = ls.slice()\n\tls2[index] = e\n\treturn ls2\n}\n\nexport function insert<E>(ls: E[], index: number, e: E): E[] {\n\tif (index > ls.length) {\n\t\treturn set(ls, index, e)\n\t}\n\treturn ls.slice(0, index).concat([e], ls.slice(index))\n}\n\nexport function remove<E>(ls: E[], index: number): E[] {\n\treturn ls.slice(0, index).concat(ls.slice(index + 1))\n}\n\nexport function update<T extends Record<string, any>>(o: T, properties: Partial<T>): T {\n\treturn Object.assign(Object.create(o.constructor.prototype), o, properties)\n}\n\n/** Recursively freeze objects, arrays and functions. */\nexport function deepFreeze<T extends object>(object: T): T {\n\tfor (const key of Reflect.ownKeys(object)) {\n\t\tconst value = object[key as keyof typeof object]\n\t\tif (!value || (typeof value !== \"object\" && !isFunction(value))) continue\n\t\tdeepFreeze(value)\n\t}\n\n\treturn Object.freeze(object)\n}\n", "import { assertNever } from \"@framerjs/shared\"\nimport { isFourNumberList } from \"utils/isFourNumberList.ts\"\nimport { normalizeEase } from \"utils/normalizeEase.ts\"\nimport { isNumber, isObject } from \"utils/typeChecks.ts\"\nimport { deepFreeze } from \"utils/updatable.ts\"\n\n// Different from the Transition type in motion, the control value has all the default types because it can be spring or tween\n// so if you're in ease, set some settings, then go to spring, set other settings, and then go back to ease, your settings are still saved\nexport interface Transition {\n\ttype: \"spring\" | \"tween\" | \"inertia\" | false\n\tease: [number, number, number, number]\n\tduration: number\n\tdelay: number\n\tstiffness: number\n\tdamping: number\n\tmass: number\n\t// Spring-only properties. Optional because they are introduced later as additional properties for duration-based-spring to avoid a migration.\n\tdurationBasedSpring?: boolean // default to undefined, which equals to false for backwards compatibility\n\tbounce?: number\n\t/**\n\t * The `stagger` property is not a transition value, it is used for calculating\n\t * appear effect compounding delays of repeated children.\n\t */\n\tstagger?: number\n}\n\nexport const defaultDurationBasedSpringTransition: Transition = {\n\ttype: \"spring\",\n\tease: [0.44, 0, 0.56, 1],\n\tduration: 0.4,\n\tdelay: 0,\n\tstiffness: 400,\n\tdamping: 30,\n\tmass: 1,\n\tdurationBasedSpring: true,\n\tbounce: 0.2,\n\tstagger: 0,\n}\ndeepFreeze(defaultDurationBasedSpringTransition)\n\n// This is the fallback for edge cases where a node does not have a transition defined. We fallback to the default\n// spring both in the UI and in code generation. This value should remain unchanged so that the transitions on such\n// nodes don't change sneakily on regen.  Any new transitions will use the duration-based spring default.\nexport const fallbackPhysicsBasedSpringTransition: Transition = {\n\ttype: \"spring\",\n\tease: [0.44, 0, 0.56, 1],\n\tduration: 0.3,\n\tdelay: 0,\n\tstiffness: 500,\n\tdamping: 60,\n\tmass: 1,\n\tstagger: 0,\n}\ndeepFreeze(fallbackPhysicsBasedSpringTransition)\n\nconst transitionTypeKey = \"type\" satisfies keyof Transition\nconst durationBasedSpringKey = \"durationBasedSpring\" satisfies keyof Transition\nexport const transitionEaseKey = \"ease\" satisfies keyof Transition\nexport const transitionDurationKey = \"duration\" satisfies keyof Transition\nexport const transitionDelayKey = \"delay\" satisfies keyof Transition\nexport const transitionStiffnessKey = \"stiffness\" satisfies keyof Transition\nexport const transitionDampingKey = \"damping\" satisfies keyof Transition\nexport const transitionMassKey = \"mass\" satisfies keyof Transition\nconst transitionNumberKeys = [\n\ttransitionDurationKey,\n\ttransitionDelayKey,\n\ttransitionStiffnessKey,\n\ttransitionDampingKey,\n\ttransitionMassKey,\n] as const satisfies readonly (keyof Transition)[]\n// The bounce key can't be part of transitionNumberKeys because it can be undefined (optional), and transitions without a bounce\n// value are still valid.\nexport const transitionBounceKey = \"bounce\" satisfies keyof Transition\nconst transitionStaggerKey = \"stagger\" satisfies keyof Transition\n\nfunction isValidTransitionType(value: unknown): value is Transition[\"type\"] {\n\treturn value === \"spring\" || value === \"tween\" || value === \"inertia\" || value === false\n}\n\nexport function isTransition(value: unknown): value is Transition {\n\tif (!isObject(value)) return false\n\tif (!isValidTransitionType(value[transitionTypeKey])) return false\n\tif (!isFourNumberList(value[transitionEaseKey])) return false\n\treturn transitionNumberKeys.every(numberKey => isNumber(value[numberKey]))\n}\n\nexport function isPartialTransition(value: unknown): value is Partial<Transition> {\n\tif (!isObject(value)) return false\n\tif (isValidTransitionType(value[transitionTypeKey])) return true\n\tif (isFourNumberList(value[transitionEaseKey])) return true\n\treturn transitionNumberKeys.some(numberKey => isNumber(value[numberKey]))\n}\n\nexport type MotionTransition =\n\t| {\n\t\t\ttype: \"spring\"\n\t\t\tstiffness: number\n\t\t\tdamping: number\n\t\t\tmass: number\n\t\t\tdelay: number\n\t  }\n\t| {\n\t\t\ttype: \"spring\"\n\t\t\tduration: number\n\t\t\tbounce: number\n\t\t\tdelay: number\n\t  }\n\t| { type: \"tween\"; duration: number; ease?: [number, number, number, number]; delay?: number }\n\t| {\n\t\t\ttype: \"inertia\"\n\t\t\tbounceStiffness: number\n\t\t\tbounceDamping: number\n\t\t\tdelay: number\n\t  }\n\t// A legacy instant transition variable can use type: false\n\t| {\n\t\t\ttype: false\n\t\t\tstiffness: number\n\t\t\tdamping: number\n\t\t\tmass: number\n\t\t\tduration: number\n\t\t\tdelay: number\n\t\t\tease: [number, number, number, number]\n\t  }\n/**\n * Framer's transition model retains all possible transition properties that can\n * be used across both an tween and spring transition. This allows changing the\n * transition type and retaining your previous settings. However when generating\n * code, we don't need to include information that is unnecessary for the set\n * type, and can strip it.\n */\nexport function toMotionTransition(value: Transition): MotionTransition {\n\tswitch (value.type) {\n\t\tcase \"spring\":\n\t\t\treturn {\n\t\t\t\ttype: \"spring\",\n\t\t\t\t...getPhysicsBasedSpringOptions(value),\n\t\t\t\tdelay: value.delay,\n\t\t\t}\n\t\tcase \"tween\":\n\t\t\treturn {\n\t\t\t\ttype: \"tween\",\n\t\t\t\tduration: value.duration,\n\t\t\t\tease: normalizeEase(value.ease),\n\t\t\t\tdelay: value.delay,\n\t\t\t}\n\t\tcase \"inertia\":\n\t\t\treturn {\n\t\t\t\ttype: \"inertia\",\n\t\t\t\tbounceStiffness: value.stiffness,\n\t\t\t\tbounceDamping: value.damping,\n\t\t\t\tdelay: value.delay,\n\t\t\t}\n\t\tcase false:\n\t\t\t// There is a bug in framer-motion where `{type: false}` transitions\n\t\t\t// don't interact correctly with relative layout animations. As a\n\t\t\t// temporary work around we are setting duration to 0.\n\t\t\treturn { type: \"tween\", duration: 0 }\n\t\tdefault:\n\t\t\tassertNever(value.type)\n\t}\n}\n\nconst physicsKeys = [\"stiffness\", \"damping\", \"mass\"]\nconst durationKeys = [\"duration\", \"bounce\"]\nconst tweenKeys = [\"ease\"]\nfunction isInstantTransition(\n\ttransition: Partial<MotionTransition>,\n): transition is Partial<MotionTransition> & { type: \"tween\" | false; duration: 0 } {\n\tif (!(\"type\" in transition)) return false\n\tif (transition.type === false) return true\n\tif (transition.type !== \"tween\") return false\n\tif (tweenKeys.some(key => key in transition)) return false\n\treturn transition.duration === 0\n}\n\nfunction isTimeBasedSpring(transition: Partial<Transition>): boolean {\n\tif (transition.type !== \"spring\") return false\n\tif (physicsKeys.some(key => key in transition)) return false\n\treturn durationKeys.some(key => key in transition)\n}\n\nconst inertiaStiffnessKey = \"bounceStiffness\"\nconst inertiaDampingKey = \"bounceDamping\"\n\nexport const toVekterTransition = (value: Partial<Transition>): Transition => {\n\tconst result: Transition = { ...fallbackPhysicsBasedSpringTransition }\n\n\tconst type = value[transitionTypeKey]\n\tif (isValidTransitionType(type)) {\n\t\tresult[transitionTypeKey] = isInstantTransition(value) ? false : type\n\t}\n\n\tconst ease = value[transitionEaseKey]\n\tif (isFourNumberList(ease)) {\n\t\tresult[transitionEaseKey] = ease\n\t}\n\n\tfor (const numberKey of transitionNumberKeys) {\n\t\tconst numberValue = value[numberKey]\n\t\tif (isNumber(numberValue)) {\n\t\t\tresult[numberKey] = numberValue\n\t\t}\n\t}\n\n\tif (inertiaStiffnessKey in value && isNumber(value[inertiaStiffnessKey])) {\n\t\tresult[transitionStiffnessKey] = value[inertiaStiffnessKey]\n\t}\n\n\tif (inertiaDampingKey in value && isNumber(value[inertiaDampingKey])) {\n\t\tresult[transitionDampingKey] = value[inertiaDampingKey]\n\t}\n\n\tif (transitionStaggerKey in value && isNumber(value[transitionStaggerKey])) {\n\t\tresult[transitionStaggerKey] = value[transitionStaggerKey]\n\t}\n\n\t// Optional props for duration-based spring\n\tif (durationBasedSpringKey in value) {\n\t\tresult[durationBasedSpringKey] = value[durationBasedSpringKey]\n\t} else if (isTimeBasedSpring(value)) {\n\t\t// Only set it to true if the value is a duration-based spring, otherwise leave it as undefined, so that we\n\t\t// can do a run-time migration in the transition popout to turn on durationBasedSpring when user switch the\n\t\t// transition type.\n\t\tresult[durationBasedSpringKey] = true\n\t}\n\n\tif (transitionBounceKey in value) {\n\t\tresult[transitionBounceKey] = value[transitionBounceKey]\n\t}\n\n\treturn result\n}\n\nexport function isTweenTransition(transition: unknown): transition is Transition & { type: \"tween\" } {\n\treturn isTransition(transition) && transition.type === \"tween\"\n}\n\nexport function tweenToCSSTransition(transition: Transition & { type: \"tween\" }) {\n\treturn `all ${transition.duration}s cubic-bezier(${transition.ease.join(\",\")}) ${transition.delay}s`\n}\n\nexport function getPhysicsBasedSpringOptions(\n\ttransition: Transition,\n): { stiffness: number; damping: number; mass: number } | { duration: number; bounce: number } {\n\tif (transition.type === \"spring\" && transition.durationBasedSpring) {\n\t\t// Calculate the physics spring options from duration and bounce. This is to simplify animation optimizations,\n\t\t// as they only work with physics-based springs now.\n\t\treturn {\n\t\t\t// Motion will ignore the duration and bounce values if the physics keys are set. But we still include them\n\t\t\t// here, so that we can parse the transition to see if it's a duration-based spring. Motion accepts a\n\t\t\t// maximum duration of 10s for spring animations, but the duration can be set via a tween transition. So we\n\t\t\t// need to clamp it here (and in the UI).\n\t\t\tduration: Math.min(transition.duration, 10),\n\t\t\t// Unlikely to be undefined when durationBasedSpring is set, but an undefined bounce is displayed as 0 in the UI\n\t\t\tbounce: transition.bounce ?? 0,\n\t\t}\n\t}\n\n\treturn {\n\t\tstiffness: transition.stiffness,\n\t\tdamping: transition.damping,\n\t\tmass: transition.mass,\n\t}\n}\n\nexport const secondsToMilliseconds = (seconds: number) => seconds * 1000\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport type { Transition } from \"document/models/Transition.ts\"\nimport { isTransition } from \"document/models/Transition.ts\"\nimport { assertNever } from \"library/utils/assert.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\nimport type { DynamicValue } from \"./DynamicValue.ts\"\nimport { isDynamicValue } from \"./DynamicValue.ts\"\nimport type {\n\tIsMaster,\n\tIsReplica,\n\tIsReplicaChild,\n\tIsReplicaOrReplicaChild,\n\tWithInheritedOverrides,\n} from \"./WithTemplate.ts\"\nimport { isMaster, isReplica, isReplicaChild, withInheritedOverrides } from \"./WithTemplate.ts\"\n\nexport interface WithVariant {\n\tisVariant?: boolean\n\tgesture?: GestureType\n\t// Only set on primary variant, can be overridden by other variants\n\tvariantTransition?: Transition | DynamicValue\n}\n\nexport interface IsVariant extends WithVariant {\n\tisVariant: true\n}\n\nexport const variantDefaults: WithVariant & WithBreakpoint = {\n\tisVariant: undefined,\n\tisBreakpoint: undefined,\n\tgesture: undefined,\n\tvariantTransition: undefined,\n}\n\nconst variantKey: keyof IsVariant = \"isVariant\"\nexport function withVariant<T extends CanvasNode>(node: T): node is T & WithVariant {\n\treturn variantKey in node\n}\n\nexport const variantInteractionGestures = [\"hover\", \"pressed\"] as const\nexport type GestureType = (typeof variantInteractionGestures)[number] | \"loading\" | \"error\"\nexport interface WithGesture {\n\tgesture: GestureType\n}\n\nconst gestureVariantKey: keyof WithGesture = \"gesture\"\nexport function withGesture(node: CanvasNode): node is CanvasNode & WithGesture {\n\treturn gestureVariantKey in node\n}\n\n/**\n * Node is any variant node: Primary, Top Level, or Gesture.\n */\nexport function isVariant(node: CanvasNode): node is CanvasNode & IsVariant {\n\treturn withVariant(node) && node.isVariant === true\n}\n\nexport type IsPrimaryVariant = IsMaster & IsVariant\n/**\n * Node is the primary variant node.\n * This node's tree is used for the generated canvas component's initial props, and tree.\n */\nexport function isPrimaryVariant(node: CanvasNode): node is CanvasNode & IsPrimaryVariant {\n\treturn isVariant(node) && isMaster(node)\n}\n\n/**\n * Finds the primary variant ancestor of a node by walking up the tree.\n */\nexport function getPrimaryVariantAncestor(node: CanvasNode): (CanvasNode & IsPrimaryVariant) | null {\n\tfor (const ancestor of node.ancestors()) {\n\t\tif (isPrimaryVariant(ancestor)) return ancestor\n\t}\n\treturn null\n}\n\nexport type IsTopLevelVariant = Exclude<IsVariant, WithGesture>\n/**\n * Node is a top level variant, in instances, this is selectable via the canvas component's variant property control.\n */\nexport function isTopLevelVariant(node: CanvasNode): node is CanvasNode & IsTopLevelVariant {\n\tif (!isVariant(node)) return false\n\treturn !withGesture(node) || !node.gesture\n}\n\nexport type IsGestureVariant = IsReplica & IsVariant & WithGesture & WithInheritedOverrides\n/**\n * Node is a gesture variant, in instances, it is only visible when the relevant gesture is triggered.\n * This node's tree is ignored, but it's overrides are used to generate the framer-motion variants of the generated code.\n */\nexport function isGestureVariant<T extends CanvasNode>(node: T): node is T & IsGestureVariant {\n\treturn isReplicaVariant(node) && withInheritedOverrides(node) && withGesture(node) && !!node.gesture\n}\n\nexport function isGestureOrGestureVariantChild(node: CanvasNode): boolean {\n\tif (isGestureVariant(node)) return true\n\tif (!isReplicaChild(node)) return false\n\tfor (const ancestor of node.ancestors()) {\n\t\tif (isGestureVariant(ancestor)) return true\n\t}\n\treturn false\n}\n\nexport function titleForGestureType(gesture: GestureType) {\n\tswitch (gesture) {\n\t\tcase \"loading\":\n\t\t\treturn \"Loading\"\n\t\tcase \"pressed\":\n\t\t\treturn Dictionary.Pressed\n\t\tcase \"hover\":\n\t\t\treturn Dictionary.Hover\n\t\tcase \"error\":\n\t\t\treturn \"Error\"\n\t\tdefault:\n\t\t\tassertNever(gesture)\n\t}\n}\n\n/**\n *\n * Node is a variant or variant child\n */\nexport function isVariantOrVariantChild(node: CanvasNode) {\n\treturn isVariant(node) || isVariantChild(node)\n}\n\nfunction isVariantChild(node: CanvasNode) {\n\treturn node.cache.insideVariant\n}\n\n/**\n * Node is a non-primary variant.\n */\nexport function isReplicaVariant(node: CanvasNode): node is CanvasNode & IsVariant & IsReplica {\n\treturn isReplica(node) && isVariant(node)\n}\n\n/**\n * Node is a child of a non-primary variant.\n */\nexport function isReplicaVariantChild(node: CanvasNode): node is CanvasNode & IsReplicaChild {\n\treturn isReplicaChild(node) && node.cache.insideVariant\n}\n\n/**\n * Node is a non-primary variant or a child of a non-primary variant.\n */\nexport function isReplicaVariantOrReplicaVariantChild(node: CanvasNode): node is CanvasNode & IsReplicaOrReplicaChild {\n\treturn isReplicaVariant(node) || isReplicaVariantChild(node)\n}\n\n/** Variant represents a breakpoint of a responsive component. */\nexport interface WithBreakpoint {\n\tisBreakpoint?: boolean\n}\n\nexport interface IsBreakpoint {\n\tisBreakpoint: true\n}\n\nconst breakpointKey: keyof IsBreakpoint = \"isBreakpoint\"\nexport function withBreakpoint<T extends CanvasNode>(node: T): node is T & WithBreakpoint {\n\treturn breakpointKey in node\n}\n\n/**\n * Node is a primary or replica breakpoint variant.\n */\nexport function isBreakpointVariant<N extends CanvasNode>(\n\tnode: N | null | undefined,\n): node is N & IsVariant & IsBreakpoint {\n\tif (!node) return false\n\treturn isVariant(node) && withBreakpoint(node) && node.isBreakpoint === true\n}\n\nexport function isPrimaryBreakpointVariant<N extends CanvasNode>(\n\tnode: N | null,\n): node is N & IsPrimaryVariant & IsBreakpoint {\n\treturn isBreakpointVariant(node) && isPrimaryVariant(node)\n}\n\nexport function isSmartComponentVariant<N extends CanvasNode>(\n\tnode: N | null | undefined,\n): node is N & IsVariant & { isBreakpoint: false } {\n\tif (!node) return false\n\treturn isVariant(node) && !isBreakpointVariant(node)\n}\n\nexport function hasVariantTransition<T extends CanvasNode>(\n\tnode: T,\n): node is T & WithVariant & { variantTransition: Transition | DynamicValue } {\n\tif (!isVariant(node)) return false\n\treturn isTransition(node.variantTransition) || isDynamicValue(node.variantTransition)\n}\n", "import { Mixed, isMixed } from \"@framerjs/shared\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport { isDynamicValue, isDynamicValueEqual } from \"../DynamicValue.ts\"\nimport type { NotFound, Reduced } from \"./Reduced.ts\"\nimport { isNotFound } from \"./Reduced.ts\"\n\ntype Unreduced<T> = Exclude<T, Mixed | NotFound>\n\n/**\n * Check if values are different. Supporting both value and variable reference types.\n * Does not support comparing objects. Use the reduceObjectProperty function for that.\n */\nexport function valuesAreDifferent(a: unknown, b: unknown): boolean {\n\tif (isDynamicValue(a)) {\n\t\treturn !isDynamicValueEqual(a, b)\n\t} else {\n\t\treturn a !== b\n\t}\n}\n\n/**\n * Given a property key, a collection target object, and a canvas node that\n * supports that property key, reduce the value into the collection target.\n * The value can optionally be transformed before comparing it to the reduced\n * result. This can for example be necessary when a value is optional but\n * being undefined resulting in a fallback being used.\n *\n * - If the collection target does not yet have a value for the property, the\n *   node's value will be set on the collection target.\n * - If the collection target has a value for the property, and it is different\n *   than the value on the node, the property will be set to Mixed on the\n *   collection target. We also support comparing dynamic values.\n * - If the collection target already has a Mixed value for the property,\n *   nothing will happen.\n */\nexport function reduceProperty<N extends CanvasNode, K extends keyof N, R extends Record<K, Reduced<N[K]>>>(\n\tkey: K,\n\tresult: Reduced<N[K]> extends R[K]\n\t\t? R\n\t\t: {\n\t\t\t\t__error: `The node's ${K extends string ? K : \"\"} property is not assignable to result's ${K extends string ? K : \"\"}`\n\t\t\t\texpected: Unreduced<R[K]>\n\t\t\t\tactual: N[K]\n\t\t\t},\n\tnode: N,\n): void\nexport function reduceProperty<N extends CanvasNode, K extends keyof N, R extends Record<K, Reduced<unknown>>>(\n\tkey: K,\n\tresult: R,\n\tnode: N,\n\ttransform: (currentValue: N[K]) => Unreduced<R[K]> | Mixed,\n): void\nexport function reduceProperty<N extends CanvasNode, K extends keyof N>(\n\tkey: K,\n\tresult: Record<K, Reduced<unknown>>,\n\tnode: N,\n\ttransform?: (currentValue: N[K]) => unknown,\n) {\n\tconst reducedValue = result[key]\n\tif (isMixed(reducedValue)) return\n\n\tconst nodeValue = node[key]\n\tconst value = transform ? transform(nodeValue) : nodeValue\n\tif (isNotFound(reducedValue)) {\n\t\tresult[key] = value\n\t} else if (valuesAreDifferent(value, reducedValue)) {\n\t\tresult[key] = Mixed\n\t}\n}\n", "import { type ModuleExportIdentifierString, isModuleExportIdentifier } from \"@framerjs/shared\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { VariableReference } from \"./VariableReference.ts\"\nimport type { WithControlProps } from \"./WithControlProps.ts\"\nimport type { Reduced } from \"./utils/Reduced.ts\"\nimport { reduceProperty } from \"./utils/reduceProperty.ts\"\n\nexport interface WithCodeComponent {\n\tcodeComponentIdentifier: string\n\tdynamicVectorSetIdentifier: VariableReference | undefined\n}\n\nexport const codeComponentDefaults: WithCodeComponent = {\n\tcodeComponentIdentifier: \"\",\n\tdynamicVectorSetIdentifier: undefined,\n}\n\nconst key: keyof WithCodeComponent = \"codeComponentIdentifier\"\n\nexport function withCodeComponent(node: CanvasNode): node is CanvasNode & WithCodeComponent & WithControlProps {\n\treturn node.hasProp(key)\n}\n\nexport function reduceCodeComponents(\n\tnode: CanvasNode,\n\tresult: {\n\t\tcodeComponentIdentifiers: Set<ModuleExportIdentifierString>\n\t\tdynamicVectorSetIdentifier: Reduced<VariableReference | undefined>\n\t},\n) {\n\tif (!withCodeComponent(node) || !isModuleExportIdentifier(node.codeComponentIdentifier)) return\n\n\tresult.codeComponentIdentifiers.add(node.codeComponentIdentifier)\n\treduceProperty(\"dynamicVectorSetIdentifier\", result, node)\n}\n", "export enum HardCodedCodeIdentifier {\n\t/**\n\t * @deprecated Creating new Scroll components in Framer is no longer supported as of July\n\t * 2025. Existing Scroll components will continue to work, but please use alternative solutions\n\t * for new projects.\n\t */\n\tscroll = \"framer/Scroll\",\n\t/**\n\t * @deprecated Creating new Page components in Framer is no longer supported as of July\n\t * 2025. Existing Page components will continue to work, but please use alternative solutions\n\t * for new projects.\n\t */\n\tpage = \"framer/Page\",\n\t/** @deprecated It's not possible to create new Stack components as of ~2024. */\n\tstack = \"framer/Stack\",\n\tprototype = \"framer/Prototype\",\n\tdevice = \"__builtin/Device\",\n\tlegacyDevice = \"@framer/framer.default/./Device.tsx_Device\",\n\tlegacyUnsplash = \"@framer/framer.default/./Unsplash.tsx_Unsplash\",\n\tnavigationAction = \"framer/useNavigate\",\n\topenURLAction = \"framer/useOpenURL\",\n\tconsoleLogAction = \"framer/useLog\",\n\tsetVariantAction = \"framer/useSetVariant\",\n\ttriggerEventAction = \"framer/useTriggerEvent\",\n\tshowOverlayAction = \"framer/useShowOverlay\",\n\tshowRelativeOverlayAction = \"framer/useShowRelativeOverlay\",\n\tloadMoreAction = \"framer/useLoadMore\",\n\tdismissOverlayAction = \"framer/useDismissOverlay\",\n\tsetLocaleAction = \"framer/useSetLocale\",\n\tsetVariableValueAction = \"framer/useSetVariableValue\",\n\tresetVariableValuesAction = \"framer/useResetVariableValues\",\n}\n\nexport const ALL_IDENTIFIERS = new Set<string>(Object.values(HardCodedCodeIdentifier))\n\n// The prototype component should render as if it is a normal component, even\n// though it is a hard coded code identifier.\nexport const ALL_BUILT_IN_IDENTIFIERS = new Set<string>(\n\tObject.values(HardCodedCodeIdentifier).filter(v => v !== HardCodedCodeIdentifier.prototype),\n)\n\nexport function isHardCodedCodeIdentifier(identifier: string): identifier is HardCodedCodeIdentifier {\n\treturn ALL_IDENTIFIERS.has(identifier)\n}\n", "import type { CanvasNode, DeviceNode } from \"document/models/CanvasTree/index.ts\"\nimport { isSlotNode, isSlotPropertyNode } from \"../../nodes/utils/nodeCheck.ts\"\nimport { type WithCodeComponent, withCodeComponent } from \"../WithCodeComponent.ts\"\nimport { HardCodedCodeIdentifier } from \"./hardCodedCodeComponentIdentifiers.ts\"\n\n/** @deprecated Don't add new styling features to CodeComponentNode, all of these are deprecated. */\nexport const stylableCodeComponents = new Set<string>([\n\tHardCodedCodeIdentifier.stack,\n\tHardCodedCodeIdentifier.page,\n\tHardCodedCodeIdentifier.scroll,\n])\n\n/**\n * Checks if a node is stylable. All nodes are stylable, except for code component nodes. There are\n * 3 built-in components that _are_ stylable though, so we check for that too, but they're\n * deprecated, so don't add new styling features to CodeComponentNode.\n */\nexport function isStylableNode(node: CanvasNode) {\n\tif (isSlotNode(node)) return false\n\tif (isSlotPropertyNode(node)) return false\n\treturn !withCodeComponent(node) || isStylableCodeComponent(node)\n}\n\nexport function isDeviceNode(node: CanvasNode): node is DeviceNode {\n\t// It would be more correct to check for isCodeComponentNode here, but that causes a circular dependency:\n\treturn withCodeComponent(node) && node.codeComponentIdentifier === HardCodedCodeIdentifier.device\n}\n\nexport function isStylableCodeComponent(node: CanvasNode & WithCodeComponent) {\n\treturn stylableCodeComponents.has(node.codeComponentIdentifier)\n}\n", "import { Mixed, isMixed } from \"@framerjs/shared\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isNumber, isUndefined } from \"utils/typeChecks.ts\"\nimport type { DynamicValue } from \"./DynamicValue.ts\"\nimport { isBreakpointVariant } from \"./WithVariant.ts\"\nimport type { OmitVariables } from \"./utils/OmitVariables.ts\"\nimport type { Reduced } from \"./utils/Reduced.ts\"\nimport { NotFound, isFound, isNotFound } from \"./utils/Reduced.ts\"\nimport { isStylableNode } from \"./utils/hardCodedCodeComponentIdentifierChecks.ts\"\nimport { valuesAreDifferent } from \"./utils/reduceProperty.ts\"\n\nexport interface WithRadius {\n\tradius: number | DynamicValue | undefined\n}\n\nexport interface WithRelativeRadius extends WithRadius {\n\tradiusIsRelative: boolean\n}\n\nexport const radiusDefaults: OmitVariables<WithRadius> = {\n\tradius: undefined,\n}\n\nexport const relativeRadiusDefaults: OmitVariables<WithRelativeRadius> = {\n\t...radiusDefaults,\n\tradiusIsRelative: false,\n}\n\nexport const radiusDefaultsWhenRemoved: WithRadius = {\n\tradius: undefined,\n}\n\nexport const relativeRadiusDefaultsWhenRemoved: WithRelativeRadius = {\n\t...radiusDefaultsWhenRemoved,\n\tradiusIsRelative: false,\n}\n\nconst key: keyof WithRadius = \"radius\"\n\nexport function withRadius<T extends CanvasNode>(node: T): node is T & WithRadius {\n\treturn key in node && isStylableNode(node)\n}\n\nexport function withRelativeRadius(node: CanvasNode): node is CanvasNode & WithRelativeRadius {\n\treturn \"radiusIsRelative\" in node && isStylableNode(node)\n}\n\nexport type RadiusValue = WithRadius[\"radius\"] | `${number}%`\n\nexport interface ReducedRadius {\n\t/** Can also be a string because we reduce `radiusIsRelative` by turning that into a string. */\n\tradius: Reduced<RadiusValue>\n}\n\nexport function isRadiusOptional(radius: ReducedRadius[\"radius\"], onlyBreakpointNodes: boolean): boolean {\n\treturn isFound(radius) && onlyBreakpointNodes\n}\n\nexport function isOptionalRadiusVisible(radius: ReducedRadius[\"radius\"], radiusPerCorner: Reduced<boolean>): boolean {\n\treturn !isUndefined(radius) || radiusPerCorner === true\n}\n\nfunction getRadius(node: CanvasNode & WithRadius): WithRadius[\"radius\"] {\n\tif (isBreakpointVariant(node)) return node.radius\n\treturn node.radius ?? 0\n}\n\nfunction isZeroRadius(radius: ReducedRadius[\"radius\"]): boolean {\n\treturn radius === 0 || radius === \"0%\"\n}\n\nexport function getReducedRadiusDefaults(): ReducedRadius {\n\treturn {\n\t\tradius: NotFound,\n\t}\n}\n\nexport function reduceRadius(node: CanvasNode, result: ReducedRadius) {\n\tif (!withRadius(node)) return\n\tif (isMixed(result.radius)) return\n\n\tconst radius = getRadius(node)\n\tconst isRelative = withRelativeRadius(node) && node.radiusIsRelative && isNumber(radius)\n\tconst radiusForDisplay: RadiusValue = isRelative ? `${radius}%` : radius\n\t// The radius control hides when the value is undefined, but undefined is also equal to zero. So\n\t// make sure that we don't set the value to Mixed when both result in zero.\n\tif (\n\t\t(isZeroRadius(result.radius) && isUndefined(radiusForDisplay)) ||\n\t\t(isUndefined(result.radius) && isZeroRadius(radiusForDisplay))\n\t) {\n\t\tresult.radius = result.radius ?? radiusForDisplay\n\t\treturn\n\t}\n\n\tif (isNotFound(result.radius)) {\n\t\tresult.radius = radiusForDisplay\n\t} else if (valuesAreDifferent(radiusForDisplay, result.radius)) {\n\t\tresult.radius = Mixed\n\t}\n}\n", "export function isValidEnumValue<T extends Record<string, string | number>>(\n\tenumObject: T,\n\tvalue: unknown,\n): value is T[keyof T] {\n\tfor (const key in enumObject) {\n\t\tconst enumValue = enumObject[key]\n\t\tif (enumValue === value) return true\n\t}\n\treturn false\n}\n", "import { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isValidEnumValue } from \"utils/isValidEnumValue.ts\"\n\nexport function isControlType(value: unknown): value is ControlType {\n\treturn isValidEnumValue(ControlType, value)\n}\n", "import type { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isObject } from \"utils/typeChecks.ts\"\nimport { isControlType } from \"./isControlType.ts\"\n\n/**\n * The raw control prop doesn't have much type safety because of the dynamic nature of property\n * controls. All control prop values in our tree are raw.\n */\nexport interface RawControlProp {\n\t/**\n\t * Type can be null because control props originally didn't have a type. During a migration\n\t * we've set unknown types to null.\n\t */\n\ttype: ControlType | null\n\tvalue?: unknown\n}\n\nconst typeKey: keyof RawControlProp = \"type\"\n\nexport function isRawControlProp(value: unknown): value is RawControlProp {\n\tif (!isObject(value)) return false\n\tif (!(typeKey in value)) return false\n\tconst type = value[typeKey]\n\t// The type has been set to `null` if the control prop is from before control props had types\n\treturn type === null || isControlType(type)\n}\n\n// @TODO: investigate if we could type the key with the $control__ literal template.\nexport type RawControlProps = Readonly<Record<string, RawControlProp | undefined>>\n", "import { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isArray, isNumber, isObject } from \"utils/typeChecks.ts\"\nimport type { RawControlProp } from \"./RawControlProp.ts\"\nimport { isRawControlProp } from \"./RawControlProp.ts\"\n\nexport interface FusedNumberControlPropValue {\n\tsingle: number\n\tfused: [number, number, number, number]\n}\n\nconst singleKey: keyof FusedNumberControlPropValue = \"single\"\nconst fusedKey: keyof FusedNumberControlPropValue = \"fused\"\n\nexport function createFusedNumberControlPropValue(value: number): FusedNumberControlPropValue {\n\treturn { single: value, fused: [value, value, value, value] }\n}\n\nexport function isFusedNumberControlPropValue(value: unknown): value is FusedNumberControlPropValue {\n\tif (!isObject(value)) return false\n\tif (!isNumber(value[singleKey])) return false\n\tconst fused = value[fusedKey]\n\treturn isArray(fused) && fused.length === 4 && fused.every(isNumber)\n}\n\nexport type RawFusedNumberControlProp = RawControlProp & { value: FusedNumberControlPropValue }\n\nexport function isRawFusedNumberControlProp(controlProp: unknown): controlProp is RawFusedNumberControlProp {\n\treturn (\n\t\tisRawControlProp(controlProp) &&\n\t\tcontrolProp.type === ControlType.FusedNumber &&\n\t\tisFusedNumberControlPropValue(controlProp.value)\n\t)\n}\n", "import { isBoolean, isObject } from \"utils/typeChecks.ts\"\n\nexport interface WithControlIsFused {\n\tisFused: boolean\n}\n\nconst key: keyof WithControlIsFused = \"isFused\"\n\nexport function withControlIsFused(value: unknown): value is WithControlIsFused {\n\treturn isObject(value) && isBoolean(value[key])\n}\n", "import { isString } from \"@framerjs/fresco/src/components/utils/typeCheck\"\nimport type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport type { Coordinate, Location } from \"library/render/types/PropertyControls.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isArray, isNull, isNumber, isObject, isUndefined } from \"utils/typeChecks.ts\"\nimport type { NodeID } from \"../CanvasTree/index.ts\"\nimport type { ComputedValue } from \"../CanvasTree/traits/ComputedValue.ts\"\nimport { isComputedValue } from \"../CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"../CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"../CanvasTree/traits/DynamicValue.ts\"\nimport type {\n\tFourPixelNumberShorthand,\n\tRelativeOrFourPixelNumberShorthand,\n\tTwoPixelNumberShorthand,\n} from \"../CanvasTree/traits/NumberShorthand.ts\"\nimport type { VariableReference } from \"../CanvasTree/traits/VariableReference.ts\"\nimport { isVariableReference } from \"../CanvasTree/traits/VariableReference.ts\"\nimport type { BorderValues } from \"../CanvasTree/traits/WithBorder.ts\"\nimport type { CSSCursor, CustomCursor } from \"../CanvasTree/traits/WithCursor.ts\"\nimport { parseCSSDimension } from \"../CanvasTree/traits/utils/CSSDimension.ts\"\nimport type { Link, LinkToWebPage } from \"../CanvasTree/traits/utils/Link.ts\"\nimport type { ResolvedCollectionItemSelector } from \"../CanvasTree/traits/utils/ResolvedCollectionItemSelector.ts\"\nimport type { EventAction } from \"../EventAction.ts\"\nimport type { BoxShadow } from \"../Shadow.ts\"\nimport type { SupportedLinkRelValue } from \"../SupportedRelValue.ts\"\nimport type { Transition } from \"../Transition.ts\"\nimport type { RichTextTreeValue } from \"../richText/richTextStorage.ts\"\nimport type { FontControlPropValue } from \"./FontControlPropValue.ts\"\nimport type { FusedNumberControlPropValue } from \"./FusedNumberControlPropValue.ts\"\nimport { isFusedNumberControlPropValue } from \"./FusedNumberControlPropValue.ts\"\nimport type { RawControlProp } from \"./RawControlProp.ts\"\nimport type { WithControlAltText } from \"./WithControlAltText.ts\"\nimport type { WithControlFocalPoint } from \"./WithControlFocalPoint.ts\"\nimport type { WithControlIsFused } from \"./WithControlIsFused.ts\"\nimport { withControlIsFused } from \"./WithControlIsFused.ts\"\nimport type { WithControlValueLocalized } from \"./hasControlValueLocalized.ts\"\n\nexport interface WithId {\n\tid: NodeID\n}\n\nconst idKey: keyof WithId = \"id\"\n\nexport function withId(value: object): value is WithId {\n\treturn idKey in value\n}\n\nexport type ArrayValue = Exclude<\n\tControlProp,\n\t| ArrayControlProp\n\t| EventHandlerControlProp\n\t| FusedNumberControlProp\n\t| PageScopeControlProp\n\t| FontControlProp\n\t| BoxShadowControlProp\n\t| GapControlProp\n\t| PaddingControlProp\n\t| BorderRadiusControlProp\n\t| CollectionReferenceControlProp\n\t| MultiCollectionReferenceControlProp\n\t| TrackingIdControlProp\n\t| VectorSetItemControlProp\n\t| SlotControlProp\n\t| LinkRelValuesControlProp\n> &\n\tWithId\n\nconst valueKey: keyof ArrayValue = \"value\"\n\nexport function isArrayValue(value: unknown): value is ArrayValue {\n\treturn isObject(value) && withId(value) && valueKey in value\n}\n\nexport function isStaticArrayControlPropValue(value: unknown): value is StaticArrayControlPropValue {\n\treturn isArray(value) && value.every(isArrayValue)\n}\n\nexport function isArrayControlPropValue(value: unknown): value is ArrayControlPropValue {\n\treturn isComputedValue(value) || isStaticArrayControlPropValue(value)\n}\n\nexport function isStaticArrayControlProp(value: RawControlProp): value is StaticArrayControlProp {\n\treturn value.type === ControlType.Array && isStaticArrayControlPropValue(value.value)\n}\n\nexport function isObjectControlProp(value: RawControlProp): value is ObjectControlProp {\n\treturn value.type === ControlType.Object && (isObject(value.value) || isNull(value.value))\n}\n\nexport function isFusedNumberControlProp(controlProp: RawControlProp): controlProp is FusedNumberControlProp {\n\tif (controlProp.type !== ControlType.FusedNumber) return false\n\tif (!withControlIsFused(controlProp)) return false\n\treturn isFusedNumberControlPropValue(controlProp.value)\n}\n\nfunction isPixelValue(value: unknown): value is `${number}px` {\n\treturn isString(value) && value.endsWith(\"px\") && isNumber(Number.parseFloat(value))\n}\n\nexport function isPercentageValue(value: unknown): value is `${number}%` {\n\tif (!isString(value)) return false\n\tconst [num, unit] = parseCSSDimension(value)\n\treturn !Number.isNaN(num) && unit === \"%\"\n}\n\nexport function isGapControlPropValue(value: unknown): value is GapControlPropValue {\n\tif (isDynamicValue(value)) return true\n\tif (!isString(value)) return false\n\tconst segments = value.split(\" \")\n\tif (segments.length === 1) return isPixelValue(segments[0])\n\treturn segments.length === 2 && segments.every(isPixelValue)\n}\n\nexport function isPaddingControlPropValue(value: unknown): value is PaddingControlPropValue {\n\tif (isDynamicValue(value)) return true\n\tif (!isString(value)) return false\n\tconst segments = value.split(\" \")\n\tif (segments.length === 1) return isPixelValue(segments[0])\n\treturn segments.length === 4 && segments.every(isPixelValue)\n}\n\nexport function isBorderRadiusControlPropValue(value: unknown): value is BorderRadiusControlPropValue {\n\tif (isDynamicValue(value)) return true\n\tif (!isString(value)) return false\n\tconst segments = value.split(\" \")\n\tif (segments.length === 1) return isPixelValue(segments[0]) || isPercentageValue(segments[0])\n\treturn segments.length === 4 && segments.every(isPixelValue)\n}\n\nexport function isCollectionReferenceControlPropValue(value: unknown): value is CollectionReferenceControlPropValue {\n\treturn isDynamicValue(value) || isString(value) || isUndefined(value)\n}\n\nexport function isMultiCollectionReferenceControlPropValue(\n\tvalue: unknown,\n): value is MultiCollectionReferenceControlPropValue {\n\treturn isDynamicValue(value) || (isArray(value) && value.every(isString)) || isUndefined(value)\n}\n\nexport function isTrackingIdControlPropValue(value: unknown): value is TrackingIdControlPropValue {\n\treturn isDynamicValue(value) || isString(value) || isUndefined(value)\n}\n\nexport function isImageControlProp(controlProp: ControlProp | undefined): controlProp is ImageControlProp {\n\treturn isObject(controlProp) && controlProp.type === ControlType.Image\n}\n\ntype LocalizableControlProp = Extract<ControlProp, WithControlValueLocalized>\n\ntype LocalizableControlPropType = LocalizableControlProp[\"type\"]\n\nconst allLocalizableControlPropTypes: Record<LocalizableControlPropType, true> = {\n\t[ControlType.String]: true,\n\t[ControlType.RichText]: true,\n\t[ControlType.Image]: true,\n\t[ControlType.Link]: true,\n}\n\n/**\n * Returns `true` if the control prop's _value_ supports localization.\n */\nexport function withLocalizableControlPropValue(\n\tcontrolProp: ControlProp | undefined,\n): controlProp is LocalizableControlProp {\n\tif (!controlProp) return false\n\treturn controlProp.type in allLocalizableControlPropTypes\n}\n\nexport interface ScrollSectionRefSelector {\n\ttarget: NodeID | VariableReference | undefined\n\tcollectionItem?: ResolvedCollectionItemSelector | VariableReference\n}\n\nexport interface SlotControlItem {\n\tid: string\n\treference: NodeID | undefined\n}\n\nexport type StaticArrayControlPropValue = readonly ArrayValue[]\nexport type ArrayControlPropValue = StaticArrayControlPropValue | ComputedValue\nexport type BooleanControlPropValue = boolean | null | DynamicValue\nexport type ColorControlPropValue = string | null | DynamicValue\nexport type DateControlPropValue = string | DynamicValue | undefined\nexport type EnumControlPropValue = string | boolean | number | undefined | null | DynamicValue\nexport type EventHandlerControlPropValue = readonly EventAction[]\nexport type FileControlPropValue = undefined | string | DynamicValue\nexport type LinkControlPropValue = Link | DynamicValue | undefined\nexport type LinkRelValuesControlPropValue = readonly SupportedLinkRelValue[] | VariableReference | undefined\nexport type NumberControlPropValue = number | null | DynamicValue\nexport type ObjectControlPropValue = Record<string, ControlProp> | null\nexport type RichTextControlPropValue = RichTextTreeValue | DynamicValue\nexport type StringControlPropValue = string | null | DynamicValue\nexport type TransitionControlPropValue = Transition | VariableReference\nexport type ImageControlPropValue = undefined | string | DynamicValue\nexport type PageScopeControlPropValue = LinkToWebPage | undefined\nexport type BoxShadowControlPropValue = readonly BoxShadow[] | DynamicValue\nexport type ScrollSectionRefControlPropValue = ScrollSectionRefSelector | VariableReference | undefined\nexport type CustomCursorControlPropValue = CustomCursor | VariableReference | undefined\nexport type BorderControlPropValue = BorderValues | VariableReference | null\nexport type CursorControlPropValue = CSSCursor | VariableReference\nexport type GapControlPropValue = TwoPixelNumberShorthand | DynamicValue\nexport type PaddingControlPropValue = FourPixelNumberShorthand | DynamicValue\nexport type BorderRadiusControlPropValue = RelativeOrFourPixelNumberShorthand | DynamicValue\nexport type CollectionReferenceControlPropValue = string | VariableReference | undefined\nexport type MultiCollectionReferenceControlPropValue = readonly string[] | DynamicValue | undefined\nexport type TrackingIdControlPropValue = string | VariableReference | undefined\nexport type VectorSetItemControlPropValue = ModuleExportIdentifierString | VariableReference | undefined\nexport type SlotControlPropValue = readonly SlotControlItem[]\nexport type LocationControlPropValue = Coordinate | VariableReference | undefined\n\nexport function isCoordinate(value: unknown): value is Coordinate {\n\treturn isObject(value) && isNumber(value.latitude) && isNumber(value.longitude)\n}\n\nexport function isLocation(value: unknown): value is Location {\n\tif (!isObject(value)) return false\n\tif (!isCoordinate(value.coordinate)) return false\n\tif (value.title !== undefined && !isString(value.title)) return false\n\tif (value.address !== undefined && !isString(value.address)) return false\n\treturn true\n}\n\nexport function isLocationControlPropValue(value: unknown): value is LocationControlPropValue {\n\treturn isCoordinate(value) || isVariableReference(value) || isUndefined(value)\n}\n\nexport interface ArrayControlProp {\n\ttype: ControlType.Array\n\tvalue: ArrayControlPropValue\n}\n\n/**\n * A special case for use in places where we know an ArrayControlProp will never by a computed value.\n * For example, a CMS collection array field will only contain literal values.\n */\nexport interface StaticArrayControlProp extends ArrayControlProp {\n\tvalue: StaticArrayControlPropValue\n}\n\nexport interface BooleanControlProp {\n\ttype: ControlType.Boolean\n\tvalue: BooleanControlPropValue\n}\n\nexport interface ColorControlProp {\n\ttype: ControlType.Color\n\tvalue: ColorControlPropValue\n}\n\nexport interface DateControlProp {\n\ttype: ControlType.Date\n\tvalue: DateControlPropValue\n}\n\nexport interface EnumControlProp {\n\ttype: ControlType.Enum\n\tvalue: EnumControlPropValue\n}\n\ninterface TransitionControlProp {\n\ttype: ControlType.Transition\n\tvalue: TransitionControlPropValue\n}\n\nexport interface BoxShadowControlProp {\n\ttype: ControlType.BoxShadow\n\tvalue: BoxShadowControlPropValue\n}\n\nexport interface EventHandlerControlProp {\n\ttype: ControlType.EventHandler\n\tvalue: EventHandlerControlPropValue\n}\n\nexport interface FileControlProp {\n\ttype: ControlType.File\n\tvalue: FileControlPropValue\n}\n\ninterface FusedNumberControlProp extends WithControlIsFused {\n\ttype: ControlType.FusedNumber\n\tvalue: FusedNumberControlPropValue\n}\n\nexport interface LinkControlProp extends WithControlValueLocalized {\n\ttype: ControlType.Link\n\tvalue: LinkControlPropValue\n}\n\nexport interface LinkRelValuesControlProp {\n\ttype: ControlType.LinkRelValues\n\tvalue: LinkRelValuesControlPropValue\n}\n\nexport interface NumberControlProp {\n\ttype: ControlType.Number\n\tvalue: NumberControlPropValue\n}\n\nexport interface ObjectControlProp {\n\ttype: ControlType.Object\n\tvalue: ObjectControlPropValue\n}\n\nexport interface RichTextControlProp extends WithControlValueLocalized {\n\ttype: ControlType.RichText\n\tvalue: RichTextControlPropValue\n}\n\nexport interface StringControlProp extends WithControlValueLocalized {\n\ttype: ControlType.String\n\tvalue: StringControlPropValue\n}\n\n/**\n * The control prop model is equal for both images and responsive images. Both use\n * `ControlType.Image` as the type, but only responsive images support alt text.\n */\nexport interface ImageControlProp extends WithControlValueLocalized, WithControlAltText, WithControlFocalPoint {\n\ttype: ControlType.Image\n\tvalue: ImageControlPropValue\n}\n\nexport interface FontControlProp {\n\ttype: ControlType.Font\n\tvalue: FontControlPropValue\n}\n\nexport interface PageScopeControlProp {\n\ttype: ControlType.PageScope\n\tvalue: PageScopeControlPropValue\n}\n\nexport interface ScrollSectionRefControlProp {\n\ttype: ControlType.ScrollSectionRef\n\tvalue: ScrollSectionRefControlPropValue\n}\n\ninterface CustomCursorControlProp {\n\ttype: ControlType.CustomCursor\n\tvalue: CustomCursorControlPropValue\n}\n\nexport interface BorderControlProp {\n\ttype: ControlType.Border\n\tvalue: BorderControlPropValue\n}\n\ninterface CursorControlProp {\n\ttype: ControlType.Cursor\n\tvalue: CursorControlPropValue\n}\n\nexport interface GapControlProp {\n\ttype: ControlType.Gap\n\tvalue: GapControlPropValue\n}\n\nexport interface PaddingControlProp {\n\ttype: ControlType.Padding\n\tvalue: PaddingControlPropValue\n}\n\nexport interface BorderRadiusControlProp {\n\ttype: ControlType.BorderRadius\n\tvalue: BorderRadiusControlPropValue\n}\n\nexport interface CollectionReferenceControlProp {\n\ttype: ControlType.CollectionReference\n\tvalue: CollectionReferenceControlPropValue\n}\n\nexport interface MultiCollectionReferenceControlProp {\n\ttype: ControlType.MultiCollectionReference\n\tvalue: MultiCollectionReferenceControlPropValue\n}\n\nexport interface VectorSetItemControlProp {\n\ttype: ControlType.VectorSetItem\n\tvalue: VectorSetItemControlPropValue\n}\n\nexport interface TrackingIdControlProp {\n\ttype: ControlType.TrackingId\n\tvalue: TrackingIdControlPropValue\n}\n\nexport interface SlotControlProp {\n\ttype: ControlType.Slot\n\tvalue: SlotControlPropValue\n}\n\nexport interface LocationControlProp {\n\ttype: ControlType.Location\n\tvalue: LocationControlPropValue\n\ttitle?: string\n\taddress?: string\n}\n\nexport type ControlProp =\n\t| ArrayControlProp\n\t| BooleanControlProp\n\t| ColorControlProp\n\t| DateControlProp\n\t| EnumControlProp\n\t| EventHandlerControlProp\n\t| FileControlProp\n\t| FusedNumberControlProp\n\t| LinkControlProp\n\t| LinkRelValuesControlProp\n\t| NumberControlProp\n\t| ObjectControlProp\n\t| RichTextControlProp\n\t| StringControlProp\n\t| TransitionControlProp\n\t| ImageControlProp\n\t| FontControlProp\n\t| PageScopeControlProp\n\t| ScrollSectionRefControlProp\n\t| CustomCursorControlProp\n\t| BorderControlProp\n\t| CursorControlProp\n\t| BoxShadowControlProp\n\t| GapControlProp\n\t| PaddingControlProp\n\t| BorderRadiusControlProp\n\t| CollectionReferenceControlProp\n\t| MultiCollectionReferenceControlProp\n\t| TrackingIdControlProp\n\t| VectorSetItemControlProp\n\t| SlotControlProp\n\t| LocationControlProp\n\nexport type ControlProps<T extends ControlProp = ControlProp> = Readonly<Record<string, T>>\n", "import type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { shouldBeNever } from \"@framerjs/shared\"\nimport type { FramerPageLinkCollectionItemAttribute } from \"library/modules/framerPageLink.ts\"\nimport { isFramerPageLink, parseFramerPageLink } from \"library/modules/framerPageLink.ts\"\nimport { isEqual } from \"library/render/utils/isEqual.ts\"\nimport { isObject, isString } from \"utils/typeChecks.ts\"\nimport type { NodeID } from \"../../nodes/NodeID.ts\"\nimport type { ReadonlyWebPagePathByWebPageId } from \"../../nodes/RouteSegmentRootNodeCache.ts\"\nimport type { DynamicValue } from \"../DynamicValue.ts\"\nimport { isDynamicValue } from \"../DynamicValue.ts\"\nimport type { VariableReference } from \"../VariableReference.ts\"\nimport { isVariableReference } from \"../VariableReference.ts\"\nimport type { Reduced } from \"./Reduced.ts\"\nimport type { ResolvedCollectionItemSelector } from \"./ResolvedCollectionItemSelector.ts\"\n\n/**\n * Currently we only support a single hash variable, as we don't allow linking\n * to layers nested in more than 1 repeater for simplicity, since this isn't a\n * common workflow.\n *\n * However, if we want to support nested repeaters, we would need multiple hash\n * variables. So, to ensure future compatibility, we store a single hash\n * variable in hashVariables.\n *\n * When we do support nested repeaters, the actual id used by the node, or the\n * hash used by links to that layer, are determined by the order of the target\n * node's ancestor repeaters, e.g. `${ancestor1.slug}-${ancestor2.slug}-name`.\n * As such this pattern does not need to be saved to the link, and can be\n * determined at code-generation time based on the state of the tree.\n *\n * This function is a helper to get the first variable until we support\n * multiple.\n */\nexport function getLinkHashVariable(\n\tvariables?: LinkVariables,\n): VariableReference | ResolvedCollectionItemSelector | undefined {\n\tfor (const key in variables) {\n\t\tconst value = variables[key]\n\t\tif (value) return value\n\t}\n}\n\nexport type LinkVariables = Record<string, VariableReference | ResolvedCollectionItemSelector | undefined>\n\nconst LINK_TO_WEB_PAGE_TYPE = \"webPage\"\nconst webPageIdKey: keyof LinkToWebPage = \"webPageId\"\nexport interface LinkToWebPage {\n\treadonly type: typeof LINK_TO_WEB_PAGE_TYPE\n\treadonly webPageId: NodeID\n\treadonly hash?: NodeID\n\treadonly pathVariables?: LinkVariables\n\treadonly hashVariables?: LinkVariables\n}\n\nconst LINK_TO_URL_TYPE = \"url\"\nconst urlKey: keyof LinkToURL = \"url\"\ninterface LinkToURL {\n\treadonly type: typeof LINK_TO_URL_TYPE\n\treadonly url: string\n}\n\n/**\n * A Link allows linking to a specific framer page, resolving the link by\n * incorporating VariableReferences or ResolvedCollectionItemSelector values.\n *\n * Link variables that are ResolvedCollectionItemSelectors allow keeping a\n * specific collection value in sync across changes to the value in the CMS.\n *\n * ```javascript\n * const link: Link = createLink({\n *      nodeId: webPage.id,\n *      hash: element.id,\n *      pathVariables: {\n *          [slugKey]: { type: \"variableReference\" },\n *      },\n *      hashVariables: {\n *          yyy: {\n *              identifier: `local-module:a/b:c`,\n *             collectionItemId: \"xxx\",\n *             key: \"yyy\",\n *             value: \"starting-a-career-in-web-design\",\n *          }\n *      }\n * })\n * ```\n *\n * This is code-generated into an optimized format that allows binding\n * javascript values to parts of the link:\n * ```javascript\n * <Link href={{\n *      path: webPage.id,\n *      hash: `starting-a-career-in-web-design-${id}`,\n *      variables: { zzz: zzzXXX }\n *  }}/>\n * ```\n *\n * This is mirrored to the library interface `Link` in `modules/Link/index.tsx`.\n * Please keep these in sync.\n */\nexport type Link = LinkToWebPage | LinkToURL\n\nexport function isLink(link: unknown): link is Link {\n\treturn isObject(link) && \"type\" in link && (link.type === LINK_TO_WEB_PAGE_TYPE || link.type === LINK_TO_URL_TYPE)\n}\n\nexport function isLinkToURL(link: unknown): link is LinkToURL {\n\treturn isLink(link) && link.type === LINK_TO_URL_TYPE\n}\n\nexport function isLinkToWebPage(link: unknown): link is LinkToWebPage {\n\treturn isLink(link) && link.type === LINK_TO_WEB_PAGE_TYPE\n}\n\nfunction inferLinkType(link: Omit<LinkToWebPage | LinkToURL, \"type\">): Link[\"type\"] {\n\tif (urlKey in link) return LINK_TO_URL_TYPE\n\tif (webPageIdKey in link) return LINK_TO_WEB_PAGE_TYPE\n\tthrow new Error(\"Link: Cannot infer Link type from link provided without a type.\")\n}\n\nexport function createLink(link: Omit<LinkToWebPage, \"type\">): LinkToWebPage\nexport function createLink(link: Omit<LinkToURL, \"type\">): LinkToURL\nexport function createLink(link: Record<string, unknown>): unknown {\n\treturn { ...link, type: inferLinkType(link) }\n}\n\nfunction createPathVariablesFromPageLinkCollectionItem(\n\tcollectionItem: FramerPageLinkCollectionItemAttribute | undefined,\n): LinkVariables | undefined {\n\tif (!collectionItem || !collectionItem.pathVariables) return undefined\n\n\tconst variables: LinkVariables = {}\n\tfor (const pathVariableKey in collectionItem.pathVariables) {\n\t\tconst value = collectionItem.pathVariables[pathVariableKey]\n\t\tif (!value) continue\n\t\tconst resolvedCollectionItem: ResolvedCollectionItemSelector = {\n\t\t\tidentifier: collectionItem.collection as ModuleExportIdentifierString,\n\t\t\tcollectionItemId: collectionItem.collectionItemId,\n\t\t\tkey: pathVariableKey,\n\t\t\tvalue,\n\t\t}\n\t\tvariables[pathVariableKey] = resolvedCollectionItem\n\t}\n\n\treturn variables\n}\n\n/**\n * Links can be Links, VariableReferences, or legacy framer/page-link strings.\n * We can't easily migrate away from framer/page-link strings, so we need to\n * convert them to Links when we read or modify them.\n *\n * We should try to only perform this transformation when reading links, or\n * ControlType.Links. If you have access to the node, node.getLinks() will\n * perform this transformation for you.\n */\nexport function getLink(link: DynamicValue): DynamicValue\nexport function getLink(link: unknown): Link | undefined\nexport function getLink(link: unknown): DynamicValue | Link | undefined {\n\tif (isDynamicValue(link) || isLink(link)) return link\n\tif (isFramerPageLink(link)) {\n\t\tconst parsed = parseFramerPageLink(link)\n\t\tif (!parsed || !parsed.target) return undefined\n\t\tconst collectionItem = parsed.collectionItem\n\n\t\tconst hash = parsed.element === \"none\" ? undefined : parsed.element\n\t\treturn createLink({\n\t\t\twebPageId: parsed.target,\n\t\t\thash: hash || undefined,\n\t\t\tpathVariables: createPathVariablesFromPageLinkCollectionItem(collectionItem),\n\t\t})\n\t}\n\n\tif (!isString(link) || !link) return undefined\n\n\treturn createLink({ url: link })\n}\n\nfunction isURLEqual(a: string, b: string): boolean {\n\tif (a === b) return true\n\ttry {\n\t\treturn new URL(a).href === new URL(b).href\n\t} catch {\n\t\treturn false\n\t}\n}\n\nexport function isLinkEqual(a: Link, b: Link, options?: { ignoreHash: boolean }) {\n\tif (isLinkToURL(a) && isLinkToURL(b)) return isURLEqual(a.url, b.url)\n\tif (!isLinkToWebPage(a) || !isLinkToWebPage(b)) return false\n\tif (a.webPageId !== b.webPageId) return false\n\n\tif (options?.ignoreHash) return isEqual(a.pathVariables, b.pathVariables)\n\n\tif (a.hash !== b.hash) return false\n\treturn isEqual(a.pathVariables, b.pathVariables) && isEqual(a.hashVariables, b.hashVariables)\n}\n\nexport function forEachVariableOfLink(link: Link, callback: (variableReference: VariableReference) => void): void {\n\tif (!isLinkToWebPage(link)) {\n\t\tif (isLinkToURL(link)) return\n\t\t// Make sure to get a type warning if we add a new link type\n\t\tshouldBeNever(link)\n\t\treturn\n\t}\n\n\tif (link.pathVariables) {\n\t\tfor (const key in link.pathVariables) {\n\t\t\tconst value = link.pathVariables[key]\n\t\t\tif (isVariableReference(value)) callback(value)\n\t\t}\n\t}\n\n\tif (link.hashVariables) {\n\t\tfor (const key in link.hashVariables) {\n\t\t\tconst value = link.hashVariables[key]\n\t\t\tif (isVariableReference(value)) callback(value)\n\t\t}\n\t}\n}\n\nexport function linkContainsPathOrHashVariable(link: Link): boolean {\n\tif (!isLinkToWebPage(link)) {\n\t\tif (isLinkToURL(link)) return false\n\t\t// Make sure to get a type warning if we add a new link type\n\t\tshouldBeNever(link)\n\t\treturn false\n\t}\n\n\tif (link.pathVariables) {\n\t\tfor (const key in link.pathVariables) {\n\t\t\tif (isVariableReference(link.pathVariables[key])) return true\n\t\t}\n\t}\n\n\tif (link.hashVariables) {\n\t\tfor (const key in link.hashVariables) {\n\t\t\tif (isVariableReference(link.hashVariables[key])) return true\n\t\t}\n\t}\n\n\treturn false\n}\n\nexport function isLinkedWebPageMissing(\n\tlink: Reduced<Link | DynamicValue | undefined>,\n\twebPageIdToRawPathMap: ReadonlyWebPagePathByWebPageId | undefined,\n): boolean {\n\treturn isLinkToWebPage(link) && !webPageIdToRawPathMap?.has(link.webPageId)\n}\n", "import type { BoxShadow as BoxShadowInterface, Shadow as ShadowInterface } from \"library/render/types/Shadow.ts\"\nimport { boxShadowKeys } from \"library/render/types/Shadow.ts\"\nimport { isArray, isObject } from \"utils/typeChecks.ts\"\nimport { randomID } from \"./CanvasTree/nodes/NodeID.ts\"\n\nexport interface Shadow extends ShadowInterface {\n\tid: string\n\t__class?: \"Shadow\"\n}\n\nexport interface BoxShadow extends BoxShadowInterface {\n\tid: string\n\t__class?: \"BoxShadow\"\n\ttype: \"box\" | \"realistic\"\n}\n\nconst defaultShadow: Omit<Shadow, \"id\"> = {\n\tcolor: \"rgba(0,0,0,0.25)\",\n\tx: 0,\n\ty: 2,\n\tblur: 5,\n}\n\nconst defaultBoxShadow: Omit<BoxShadow, \"id\"> = {\n\ttype: \"box\",\n\n\t// Settings for all shadow types\n\tcolor: \"rgba(0,0,0,0.25)\",\n\tx: 0,\n\ty: 2,\n\tinset: false,\n\n\t// Box shadow settings\n\tblur: 5,\n\tspread: 0,\n\n\t// Realistic shadow settings\n\tdiffusion: 0.5,\n\tfocus: 0.5,\n}\n\nfunction createAnyShadow<T extends Shadow | BoxShadow>(values: Partial<T>, defaultValues: Omit<T, \"id\">): T {\n\tconst result = {\n\t\t...defaultValues,\n\t\t...values,\n\t} as T\n\n\tif (!result.id) {\n\t\tresult.id = randomID()\n\t}\n\n\treturn result\n}\n\nexport function isBoxShadow(shadow: unknown): shadow is BoxShadow {\n\tif (!isObject(shadow)) return false\n\n\tconst id: keyof BoxShadow = \"id\"\n\tif (!(id in shadow)) return false\n\n\tfor (const key of boxShadowKeys) {\n\t\tif (!(key in shadow)) return false\n\t}\n\treturn true\n}\n\nexport function isBoxShadowList(shadows: unknown): shadows is readonly BoxShadow[] {\n\treturn isArray(shadows) && shadows.every(isBoxShadow)\n}\n\nexport function createShadow(values: Partial<Shadow>): Shadow {\n\treturn createAnyShadow(values, defaultShadow)\n}\n\nexport function createBoxShadow(values: Partial<BoxShadow>): BoxShadow {\n\treturn createAnyShadow(values, defaultBoxShadow)\n}\n\nexport function getDuplicatedShadow<T extends Shadow | BoxShadow>(shadow: T): T {\n\treturn {\n\t\t...shadow,\n\t\tid: randomID(),\n\t}\n}\n\nexport function getUpdatedShadow<T extends Shadow | BoxShadow>(shadow: T, values: Partial<Shadow | BoxShadow>): T {\n\treturn {\n\t\t...shadow,\n\t\t...values,\n\t}\n}\n", "import type { ControlProp } from \"./ControlProp.ts\"\n\n// This should never change\nconst controlPrefix = \"$control__\"\n\nexport type PrefixedControlPropKey<T extends string = string> = `${typeof controlPrefix}${T}`\nexport type PrefixedControlProps<T extends ControlProp = ControlProp> = Readonly<\n\tRecord<PrefixedControlPropKey, T | undefined>\n>\n\nexport function isPrefixedControlPropKey(propKey: string): propKey is PrefixedControlPropKey {\n\treturn propKey.startsWith(controlPrefix)\n}\n\nexport function removeControlPropKeyPrefix<T extends string>(propKey: PrefixedControlPropKey<T>): T {\n\treturn propKey.substring(controlPrefix.length) as T\n}\n\nexport function prefixControlPropKey<T extends string>(key: T): PrefixedControlPropKey<T> {\n\treturn `${controlPrefix}${key}`\n}\n\nexport function prefixControlProps<T extends ControlProp>(\n\tcontrolProps: Record<string, T | undefined>,\n): PrefixedControlProps<T> {\n\tconst props: Record<PrefixedControlPropKey, T | undefined> = {}\n\tfor (const key of Object.keys(controlProps)) {\n\t\tconst controlProp = controlProps[key]\n\t\tprops[prefixControlPropKey(key)] = controlProp\n\t}\n\n\treturn props\n}\n\n/** Check if some node update contains a prefixed control prop. Used for cache busting. */\nexport function containsPrefixedControlProp(properties: Record<string, unknown>): boolean {\n\tfor (const key in properties) {\n\t\tif (isPrefixedControlPropKey(key)) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n", "// oxlint-disable typescript/no-non-null-assertion\n\nimport { assert } from \"@framerjs/shared\"\nimport type { MutableNode } from \"./MutableNode.ts\"\nimport type { NodeID } from \"./NodeID.ts\"\n\nexport abstract class ReadonlyChildList<Node extends MutableNode = MutableNode> implements Iterable<Node> {\n\tabstract get length(): number\n\tabstract at(index: number): Node | undefined\n\tabstract indexOf(node: Node): number\n\tabstract some(predicate: (node: Node, index: number) => unknown): boolean\n\tabstract every(predicate: (node: Node, index: number) => unknown): boolean\n\tabstract forEach(callback: (node: Node, index: number) => void): void\n\tabstract map<Result>(callback: (node: Node, index: number) => Result): Result[]\n\tabstract reduce<Result>(callback: (result: Result, node: Node, index: number) => Result, initialValue: Result): Result\n\tabstract filter<Search extends Node>(predicate: (node: Node, index: number) => node is Search): Search[]\n\tabstract filter(predicate: (node: Node, index: number) => unknown): Node[]\n\tabstract find<Search extends Node>(predicate: (node: Node, index: number) => node is Search): Search | undefined\n\tabstract find(predicate: (node: Node, index: number) => unknown): Node | undefined\n\tabstract findIndex(predicate: (node: Node, index: number) => unknown): number\n\tabstract findLast<Search extends Node>(predicate: (node: Node, index: number) => node is Search): Search | undefined\n\tabstract findLast(predicate: (node: Node, index: number) => unknown): Node | undefined\n\tabstract findLastIndex(predicate: (node: Node, index: number) => unknown): number\n\tabstract slice(start?: number, end?: number): Node[]\n\tabstract toArray(): Node[]\n\tabstract [Symbol.iterator](): IterableIterator<Node>\n}\n\nexport abstract class ChildList<Node extends MutableNode = MutableNode> extends ReadonlyChildList<Node> {\n\tabstract sort(compare: (left: Node, right: Node) => number): void\n\tabstract splice(start: number, deleteCount?: number, ...nodes: Node[]): void\n\tabstract push(...nodes: Node[]): void\n}\n\nexport class CanvasChildList<Node extends MutableNode = MutableNode> extends ChildList<Node> {\n\tprivate childIds: NodeID[] = []\n\tprivate childById = new Map<NodeID, Node>()\n\n\tconstructor(children?: Iterable<Node>) {\n\t\tsuper()\n\n\t\tif (children) {\n\t\t\tfor (const child of children) {\n\t\t\t\tthis.push(child)\n\t\t\t}\n\t\t}\n\t}\n\n\tget length() {\n\t\treturn this.childIds.length\n\t}\n\n\tat(index: number): Node | undefined {\n\t\tconst id = this.childIds.at(index)\n\t\tif (!id) return undefined\n\n\t\treturn this.childById.get(id)\n\t}\n\n\tindexOf(node: Node): number {\n\t\treturn this.findIndex(child => child === node)\n\t}\n\n\tsome(predicate: (node: Node, index: number) => unknown): boolean {\n\t\tfor (let index = 0; index < this.childIds.length; index++) {\n\t\t\tconst id = this.childIds[index]!\n\t\t\tconst child = this.childById.get(id)!\n\n\t\t\tif (predicate(child, index)) return true\n\t\t}\n\n\t\treturn false\n\t}\n\n\tevery(predicate: (node: Node, index: number) => unknown): boolean {\n\t\tfor (let index = 0; index < this.childIds.length; index++) {\n\t\t\tconst id = this.childIds[index]!\n\t\t\tconst child = this.childById.get(id)!\n\n\t\t\tif (!predicate(child, index)) return false\n\t\t}\n\n\t\treturn true\n\t}\n\n\tforEach(callback: (node: Node, index: number) => void): void {\n\t\tfor (let index = 0; index < this.childIds.length; index++) {\n\t\t\tconst id = this.childIds[index]!\n\t\t\tconst child = this.childById.get(id)!\n\n\t\t\tcallback(child, index)\n\t\t}\n\t}\n\n\tmap<Result>(callback: (node: Node, index: number) => Result): Result[] {\n\t\tconst result = Array<Result>(this.childIds.length)\n\n\t\tfor (let index = 0; index < this.childIds.length; index++) {\n\t\t\tconst id = this.childIds[index]!\n\t\t\tconst child = this.childById.get(id)!\n\n\t\t\tresult[index] = callback(child, index)\n\t\t}\n\n\t\treturn result\n\t}\n\n\treduce<Result>(callback: (result: Result, node: Node, index: number) => Result, initialValue: Result): Result {\n\t\tlet result = initialValue\n\n\t\tfor (let index = 0; index < this.childIds.length; index++) {\n\t\t\tconst id = this.childIds[index]!\n\t\t\tconst child = this.childById.get(id)!\n\n\t\t\tresult = callback(result, child, index)\n\t\t}\n\n\t\treturn result\n\t}\n\n\tfilter<Search extends Node>(predicate: (node: Node, index: number) => node is Search): Search[]\n\tfilter(predicate: (node: Node, index: number) => unknown): Node[]\n\tfilter(predicate: (node: Node, index: number) => unknown): Node[] {\n\t\tconst result: Node[] = []\n\n\t\tfor (let index = 0; index < this.childIds.length; index++) {\n\t\t\tconst id = this.childIds[index]!\n\t\t\tconst child = this.childById.get(id)!\n\n\t\t\tif (predicate(child, index)) {\n\t\t\t\tresult.push(child)\n\t\t\t}\n\t\t}\n\n\t\treturn result\n\t}\n\n\tsort(compare: (left: Node, right: Node) => number): void {\n\t\t// Materialize the nodes once and sort the array of nodes directly so the\n\t\t// comparator does not have to look up nodes by id on every comparison.\n\t\tconst nodes = this.toArray().sort(compare)\n\n\t\tfor (let index = 0; index < nodes.length; index++) {\n\t\t\tthis.childIds[index] = nodes[index]!.id\n\t\t}\n\t}\n\n\tfind<Search extends Node>(predicate: (node: Node, index: number) => node is Search): Search | undefined\n\tfind(predicate: (node: Node, index: number) => unknown): Node | undefined\n\tfind(predicate: (node: Node, index: number) => unknown): Node | undefined {\n\t\tconst index = this.findIndex(predicate)\n\t\tif (index === -1) return undefined\n\n\t\treturn this.at(index)\n\t}\n\n\tfindIndex(predicate: (node: Node, index: number) => unknown): number {\n\t\tfor (let index = 0; index < this.childIds.length; index++) {\n\t\t\tconst id = this.childIds[index]!\n\t\t\tconst child = this.childById.get(id)!\n\n\t\t\tif (predicate(child, index)) return index\n\t\t}\n\n\t\treturn -1\n\t}\n\n\tfindLast<Search extends Node>(predicate: (node: Node, index: number) => node is Search): Search | undefined\n\tfindLast(predicate: (node: Node, index: number) => unknown): Node | undefined\n\tfindLast(predicate: (node: Node, index: number) => unknown): Node | undefined {\n\t\tconst index = this.findLastIndex(predicate)\n\t\tif (index === -1) return undefined\n\n\t\treturn this.at(index)\n\t}\n\n\tfindLastIndex(predicate: (node: Node, index: number) => unknown): number {\n\t\tfor (let index = this.childIds.length - 1; index >= 0; index--) {\n\t\t\tconst id = this.childIds[index]!\n\t\t\tconst child = this.childById.get(id)!\n\n\t\t\tif (predicate(child, index)) return index\n\t\t}\n\n\t\treturn -1\n\t}\n\n\tslice(start?: number, end?: number): Node[] {\n\t\tconst childIds = this.childIds.slice(start, end)\n\t\tconst result = Array<Node>(childIds.length)\n\n\t\tfor (let index = 0; index < childIds.length; index++) {\n\t\t\tconst id = childIds[index]!\n\t\t\tconst child = this.childById.get(id)!\n\n\t\t\tresult[index] = child\n\t\t}\n\n\t\treturn result\n\t}\n\n\tsplice(start: number, deleteCount = Infinity, ...nodes: Node[]): void {\n\t\tconst nodeIds = nodes.map(node => node.id)\n\n\t\tif (process.env.NODE_ENV !== \"production\") {\n\t\t\tconst removedIds = this.childIds.slice().splice(start, deleteCount)\n\n\t\t\tnodeIds.forEach((id, index) => {\n\t\t\t\tassert(!this.childById.has(id) || removedIds.includes(id), \"Duplicate node:\", id)\n\t\t\t\tassert(nodeIds.indexOf(id) === index, \"Duplicate node:\", id)\n\t\t\t})\n\t\t}\n\n\t\tconst removedIds = this.childIds.splice(start, deleteCount, ...nodeIds)\n\n\t\tfor (const removedId of removedIds) {\n\t\t\tthis.childById.delete(removedId)\n\t\t}\n\n\t\tfor (const node of nodes) {\n\t\t\tthis.childById.set(node.id, node)\n\t\t}\n\t}\n\n\tpush(...nodes: Node[]): void {\n\t\tfor (const node of nodes) {\n\t\t\tif (process.env.NODE_ENV !== \"production\") {\n\t\t\t\tassert(!this.childById.has(node.id), \"Duplicate node:\", node.id)\n\t\t\t}\n\n\t\t\tthis.childIds.push(node.id)\n\t\t\tthis.childById.set(node.id, node)\n\t\t}\n\t}\n\n\tswap(node: Node): void {\n\t\tif (this.childById.has(node.id)) {\n\t\t\tthis.childById.set(node.id, node)\n\t\t}\n\t}\n\n\ttoArray(): Node[] {\n\t\tconst result = Array<Node>(this.childIds.length)\n\n\t\tfor (let index = 0; index < this.childIds.length; index++) {\n\t\t\tconst id = this.childIds[index]!\n\t\t\tconst child = this.childById.get(id)!\n\n\t\t\tresult[index] = child\n\t\t}\n\n\t\treturn result\n\t}\n\n\t*[Symbol.iterator](): IterableIterator<Node> {\n\t\tfor (let index = 0; index < this.childIds.length; index++) {\n\t\t\tconst id = this.childIds[index]!\n\t\t\tconst child = this.childById.get(id)!\n\n\t\t\tyield child\n\t\t}\n\t}\n}\n", "// These are helper functions for TreeNode. But can also be used directly by code that works with\n// node values, like when serializing or deserializing.\n\nexport function isTreeNodeClass(__class: string | null | undefined): boolean {\n\tif (!__class) return false\n\tif (__class === \"RootNode\") return true\n\treturn isDrawableNodeClass(__class)\n}\n\nexport function isDrawableNodeClass(__class: string | null | undefined): boolean {\n\tif (!__class) return false\n\n\tif (isDrawableGroundNodeClass(__class)) return true\n\tif (isVectorNodeClass(__class)) return true\n\tif (__class === \"OverlayNode\") return true\n\tif (__class === \"SlotNode\") return true\n\tif (__class === \"SlotPropertyNode\") return true\n\n\treturn false\n}\n\nexport function isDrawableGroundNodeClass(__class: string | null | undefined): boolean {\n\tif (!__class) return false\n\n\tswitch (__class) {\n\t\tcase \"CodeComponentNode\":\n\t\tcase \"FormBooleanInputNode\":\n\t\tcase \"FormPlainTextInputNode\":\n\t\tcase \"FormSelectNode\":\n\t\tcase \"FrameNode\":\n\t\tcase \"RichTextNode\":\n\t\tcase \"ShapeContainerNode\":\n\t\tcase \"SVGNode\":\n\t\tcase \"TextNode\":\n\t\tcase \"PathNode\":\n\t\tcase \"BooleanShapeNode\":\n\t\tcase \"ShaderNode\":\n\t\tcase \"ShapeGroupNode\":\n\t\tcase \"RectangleShapeNode\":\n\t\tcase \"OvalShapeNode\":\n\t\tcase \"StarShapeNode\":\n\t\tcase \"PolygonShapeNode\":\n\t\t\treturn true\n\t\tdefault:\n\t\t\treturn false\n\t}\n}\n\nexport function isVectorNodeClass(__class: string | null | undefined): boolean {\n\tswitch (__class) {\n\t\tcase \"PathNode\":\n\t\tcase \"BooleanShapeNode\":\n\t\tcase \"ShapeGroupNode\":\n\t\tcase \"RectangleShapeNode\":\n\t\tcase \"OvalShapeNode\":\n\t\tcase \"StarShapeNode\":\n\t\tcase \"PolygonShapeNode\":\n\t\t\treturn true\n\t\tdefault:\n\t\t\treturn false\n\t}\n}\n\nexport function isContentNodeClass(__class: string | null | undefined): boolean {\n\tswitch (__class) {\n\t\tcase \"CollectionNode\":\n\t\tcase \"CollectionItemNode\":\n\t\tcase \"ContentManagementNode\":\n\t\t\treturn true\n\t\tdefault:\n\t\t\treturn false\n\t}\n}\n", "import type { CanvasTree } from \"../CanvasTree.ts\"\nimport type { CanvasNode } from \"./CanvasNode.ts\"\nimport type CodeComponentNode from \"./CodeComponentNode.ts\"\nimport type { CollectionItemNode } from \"./CollectionItemNode.ts\"\nimport type { CollectionNode } from \"./CollectionNode.ts\"\nimport type { ContentManagementNode } from \"./ContentManagementNode.ts\"\nimport type FrameNode from \"./FrameNode.ts\"\nimport type { ImmutableNode } from \"./MutableNode.ts\"\nimport type { OverlayNode } from \"./OverlayNode.ts\"\nimport type { RichTextNode } from \"./RichTextNode.ts\"\nimport type { RootNode } from \"./RootNode.ts\"\nimport type { SVGNode } from \"./SVGNode.ts\"\nimport type ShapeContainerNode from \"./ShapeContainerNode.ts\"\nimport type ShapeGroupNode from \"./ShapeGroupNode.ts\"\nimport type { TextNode } from \"./TextNode.ts\"\nimport {\n\tisContentNodeClass,\n\tisDrawableGroundNodeClass,\n\tisDrawableNodeClass,\n\tisTreeNodeClass,\n\tisVectorNodeClass,\n} from \"./TreeNodeClasses.ts\"\nimport type { FormBooleanInputNode } from \"./forms/FormBooleanInputNode.ts\"\nimport type { FormPlainTextInputNode } from \"./forms/FormPlainTextInputNode.ts\"\nimport type { FormSelectNode } from \"./forms/FormSelectNode.ts\"\nimport type { BooleanShapeNode } from \"./shapes/BooleanShapeNode.ts\"\nimport type { OvalShapeNode } from \"./shapes/OvalShapeNode.ts\"\nimport type { PathNode } from \"./shapes/PathNode.ts\"\nimport type { PolygonShapeNode } from \"./shapes/PolygonShapeNode.ts\"\nimport type { RectangleShapeNode } from \"./shapes/RectangleShapeNode.ts\"\nimport type { StarShapeNode } from \"./shapes/StarShapeNode.ts\"\nimport { isShapeContainerNode } from \"./utils/nodeCheck.ts\"\n\nexport type VectorNode =\n\t| PathNode\n\t| BooleanShapeNode\n\t| ShapeGroupNode\n\t| RectangleShapeNode\n\t| OvalShapeNode\n\t| StarShapeNode\n\t| PolygonShapeNode\n\nexport type DrawableGroundNode =\n\t| CodeComponentNode\n\t| FormBooleanInputNode\n\t| FormPlainTextInputNode\n\t| FormSelectNode\n\t| FrameNode\n\t| RichTextNode\n\t| ShapeContainerNode\n\t| SVGNode\n\t| TextNode<any>\n\nexport type DrawableNode = OverlayNode | VectorNode | DrawableGroundNode\nexport type ContentNode = ContentManagementNode | CollectionNode | CollectionItemNode\nexport type TreeNode = RootNode | DrawableNode\n\nexport function isTreeNode(node: ImmutableNode | null | undefined): node is TreeNode {\n\tif (!node) return false\n\treturn isTreeNodeClass(node.__class)\n}\n\nexport function isDrawableGroundNode(node: ImmutableNode | null | undefined): node is DrawableGroundNode {\n\tif (!node) return false\n\treturn isDrawableGroundNodeClass(node.__class)\n}\n\n// Helper function for compiler, works around a typescript design limitation, c.f.,\n// https://github.com/Microsoft/TypeScript/issues/10422#issuecomment-265311779\nexport function isDrawableNode(node: ImmutableNode | null | undefined): node is DrawableNode {\n\tif (!node) return false\n\treturn isDrawableNodeClass(node.__class)\n}\n\nexport function isVectorNode(node: ImmutableNode | null | undefined): node is VectorNode {\n\tif (!node) return false\n\treturn isVectorNodeClass(node.__class)\n}\n\nexport function isContentNode(node: ImmutableNode | null | undefined): node is ContentNode {\n\tif (!node) return false\n\treturn isContentNodeClass(node.__class)\n}\n\nexport function isRootVectorNode(tree: CanvasTree, node: VectorNode) {\n\tconst parent = tree.getNodeParent(node)\n\treturn parent === null || !isVectorNode(parent)\n}\n\nexport function isInlineVectorNode(tree: CanvasTree, node: CanvasNode): boolean {\n\tif (!isVectorNode(node)) return false\n\tconst parent = tree.getNodeParent(node)\n\tif (parent === null) return true\n\treturn !isVectorNode(parent) && !isShapeContainerNode(parent)\n}\n", "import type { ImmutableNode, MutableNode } from \"../nodes/MutableNode.ts\"\n\nexport let driverNodeConstructorHook = (_node: MutableNode) => {}\n\nexport function setDriverNodeConstructorHook(fn: (node: MutableNode) => void) {\n\tdriverNodeConstructorHook = fn\n}\n\nexport let driverNodeFreezeHook = (_node: MutableNode) => {}\n\nexport function setDriverNodeFreezeHook(fn: (node: MutableNode) => void) {\n\tdriverNodeFreezeHook = fn\n}\n\nexport let driverNodeAssignDefaults = <T extends ImmutableNode>(\n\tnode: T,\n\tdefaults: Partial<T>,\n\t...properties: (Partial<T> | undefined)[]\n) => {\n\tnode.assign(defaults, ...properties)\n}\n\nexport function setDriverNodeAssignDefaults(\n\tfn: (\n\t\tnode: ImmutableNode,\n\t\tdefaults: Partial<ImmutableNode>,\n\t\t...properties: (Partial<ImmutableNode> | undefined)[]\n\t) => void,\n) {\n\tdriverNodeAssignDefaults = fn\n}\n", "import type { NodeTree } from \"../NodeTree.ts\"\nimport type { MutableNode } from \"./MutableNode.ts\"\n\nexport class NodeCache {\n\ttreeLineage: {\n\t\tlatestTree: NodeTree\n\t\trecordEditReason(): void\n\t\tonEditStart?(): void\n\t\tonEditEnd?(): void\n\t\tonEditError?(error: unknown): void\n\t} | null = null\n\n\tdraft: MutableNode | null = null\n\thierarchyChange = false\n\n\ttree(): NodeTree | undefined {\n\t\treturn this.treeLineage?.latestTree\n\t}\n\n\treset() {\n\t\tthis.hierarchyChange = false\n\t}\n}\n", "import type { AnyComponentLoader } from \"@framerjs/framer-runtime\"\nimport { assert, USE_FREEZE } from \"@framerjs/shared\"\nimport type { WithEquals } from \"library/render/utils/isEqual.ts\"\nimport { withClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { NodeTree } from \"../NodeTree.ts\"\nimport { driverNodeAssignDefaults, driverNodeConstructorHook, driverNodeFreezeHook } from \"../drivers/DriverHooks.ts\"\nimport type { OmitFunctions, WithObjectMethods } from \"../traits/WithObjectMethods.ts\"\nimport type { ReplicaInfo } from \"../traits/WithTemplate.ts\"\nimport type { ChildList, ReadonlyChildList } from \"./ChildList.ts\"\nimport { CanvasChildList } from \"./ChildList.ts\"\nimport { NodeCache } from \"./NodeCache.ts\"\nimport type { MaybeNodeID, NodeID } from \"./NodeID.ts\"\nimport { NullID, randomID } from \"./NodeID.ts\"\n\nexport interface ReadonlyChildren {\n\treadonly children?: ReadonlyChildList<ImmutableNode>\n}\n\nexport interface NodeAccessor {\n\treadonly id: string\n\treadonly __class: string\n\tget(key: string): unknown\n\tskipChildren?: boolean\n}\n\nexport type ImmutableNode = Readonly<MutableNode> & ReadonlyChildren\n\nexport function setDefaults<T extends ImmutableNode>(\n\tnode: T,\n\tdefaults: Partial<T>,\n\t...properties: (Partial<T> | undefined)[]\n): void {\n\tdriverNodeAssignDefaults(node, defaults, ...properties)\n}\n\ninterface SerializableToJS {\n\ttoJS: () => any\n}\n\nexport function isSerializableToJS(value: unknown): value is SerializableToJS {\n\tif (!value) return false\n\tconst key: keyof SerializableToJS = \"toJS\"\n\treturn value[key] instanceof Function\n}\n\nconst cloneOverrides = { mutable: true, update: 0 }\n\nexport interface SerializableMutableNode {\n\tid: NodeID\n\t__class: string\n\t[key: string]: unknown\n}\n\n/** Properties we should not just serialize. */\nconst propertiesNotToSerialize: Record<string, boolean> = {\n\tcache: true,\n\tmutable: true,\n\tupdate: true,\n}\n\n/** Properties that need special consideration while serializing. */\nexport const specialSerializationProperties: Record<string, boolean> = {\n\t...propertiesNotToSerialize,\n\t__class: true,\n\tchildren: true,\n\tid: true,\n}\n\n/**\n * The base class node for a copy-on-write tree. It implements functionality without any specific dependencies.\n * Nodes become immutable after the tree does a commit. Mutation should be done via `.set()` method, which creates\n * a draft version.\n */\nexport class MutableNode extends withClassDiscriminator(\"MutableNode\") implements WithEquals, WithObjectMethods {\n\t/** An immutable identifier to get the version of the node as it exists in one tree. */\n\tdeclare readonly id: NodeID\n\t/** A mutable object that persists over all the versions of the same node. */\n\tdeclare readonly cache: NodeCache\n\tdeclare duplicatedFrom: string[] | null\n\t/**\n\t * Set to `true` if current version is the draft version of the node. `node.cache.draft` will point to this\n\t * instsance.\n\t */\n\tdeclare mutable: boolean\n\t/** Increments every time a node goes from draft to immutable version. */\n\tdeclare update: number\n\n\t/**\n\t * An indirect reference to its parent. Nodes cannot have direct reference to its parent, or else we would\n\t * have to make draft versions for children when their parent gets a draft version.\n\t */\n\tdeclare parentid: MaybeNodeID\n\t/** If this node is part of a replica, this points to the peer node in the master. */\n\tdeclare originalid: NodeID | null\n\t/**\n\t * If this is the root of a replica, points to the master node and contains all the override properties.\n\t * This is how Breakpoints and Variants are implemented.\n\t */\n\tdeclare replicaInfo: ReplicaInfo | null | undefined\n\n\t// N.B.: setting a default value for children here, although it might be undefined.\n\t// Previously we set the same empty array on all nodes, but since this is mutable now\n\t// we can\u2019t do this (or all nodes would keep sharing the array).\n\t// The `WithChildren` trait *relies* on children being `undefined` though, so subclasses\n\t// that don\u2019t support children must delete the default value in their constructor!\n\tdeclare children?: ChildList<ImmutableNode>\n\n\tconstructor(props?: Partial<MutableNode>, cache?: NodeCache) {\n\t\tsuper()\n\n\t\tdriverNodeConstructorHook(this)\n\n\t\tthis.id = props?.id ?? randomID()\n\t\tthis.parentid = props?.parentid ?? NullID\n\t\tthis.cache = props?.cache ?? cache ?? new NodeCache()\n\t\tthis.duplicatedFrom = props?.duplicatedFrom ?? null\n\t\tthis.children = props?.children ?? new CanvasChildList()\n\t\tthis.originalid = props?.originalid ?? null\n\t\tthis.mutable = props?.mutable ?? true\n\t\tthis.update = props?.update ?? 0\n\n\t\tif (props?.replicaInfo) {\n\t\t\tthis.replicaInfo = props.replicaInfo\n\t\t}\n\t}\n\n\tassign<T extends unknown[]>(...sources: T): this {\n\t\treturn Object.assign(this, ...sources)\n\t}\n\n\tkeys(): string[] {\n\t\t// eslint-disable-next-line framer-studio/no-mutable-node-object-methods,framer-studio/no-mutable-node-type-operations\n\t\treturn Object.keys(this)\n\t}\n\n\tvalues() {\n\t\t// eslint-disable-next-line framer-studio/no-mutable-node-type-operations,framer-studio/no-mutable-node-object-methods\n\t\treturn Object.values(this)\n\t}\n\n\tentries() {\n\t\t// eslint-disable-next-line framer-studio/no-mutable-node-type-operations,framer-studio/no-mutable-node-object-methods\n\t\treturn Object.entries(this)\n\t}\n\n\traw<T extends Record<string, unknown>>(overrides?: T) {\n\t\t// eslint-disable-next-line framer-studio/no-mutable-node-object-methods\n\t\treturn Object.assign({}, this, overrides) as OmitFunctions<this> & T\n\t}\n\n\tsetProp<Key extends keyof this>(key: Key, value: this[Key]) {\n\t\t// eslint-disable-next-line framer-studio/no-mutable-node-property-operations\n\t\tthis[key] = value\n\t}\n\n\tdeleteProp(key: string) {\n\t\t// @ts-ignore String key does not exist in any type but is needed to support control props\n\t\t// eslint-disable-next-line framer-studio/no-mutable-node-object-operations\n\t\tdelete this[key]\n\t}\n\n\thasProp(key: string) {\n\t\t// eslint-disable-next-line framer-studio/no-mutable-node-object-methods\n\t\treturn Object.hasOwn(this, key)\n\t}\n\n\t// library/render/utils/isEqual.ts is using this method to shortcut the deep equality check\n\tequals(other: unknown): boolean {\n\t\treturn this === other\n\t}\n\n\t/** Returns the original id if the node is a replica or replica child, or the own id otherwise */\n\tgetPrimaryId(): NodeID {\n\t\treturn this.originalid ?? this.id\n\t}\n\n\t// compatibility\n\ttoJS(): SerializableMutableNode {\n\t\tconst serializableValue: SerializableMutableNode = {\n\t\t\tid: this.id,\n\t\t\t__class: this.__class,\n\t\t}\n\n\t\tif (this.children) {\n\t\t\t// replica's don't need to store their children\n\t\t\tserializableValue.children = this.replicaInfo ? [] : this.children.map((child: ImmutableNode) => child.toJS())\n\t\t}\n\n\t\tfor (const key in this) {\n\t\t\tif (specialSerializationProperties[key]) continue\n\n\t\t\tconst value = this[key]\n\n\t\t\tif (key === \"replicaInfo\" && value) {\n\t\t\t\t// We force a serialization of replicaInfo here, that way\n\t\t\t\t// overrides of styledText and others have their toJSON()\n\t\t\t\t// called, and trees can be sent via postMessage.\n\t\t\t\tserializableValue[key] = JSON.parse(JSON.stringify(value))\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif (isSerializableToJS(value)) {\n\t\t\t\tserializableValue[key] = value.toJS()\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tserializableValue[key] = value\n\t\t}\n\n\t\treturn serializableValue\n\t}\n\n\t// see also CanvasNode.set()\n\tset(properties: { [key: string]: any }, tree?: NodeTree): this {\n\t\tthis.cache.treeLineage?.onEditStart?.()\n\n\t\ttry {\n\t\t\tconst draft = this.asDraft(tree)\n\t\t\tdraft.verifyPropertiesToSet(properties)\n\t\t\tdraft.assign(properties)\n\t\t\treturn draft\n\t\t} catch (error) {\n\t\t\tthis.cache.treeLineage?.onEditError?.(error)\n\t\t\tthrow error\n\t\t} finally {\n\t\t\tthis.cache.treeLineage?.onEditEnd?.()\n\t\t}\n\t}\n\n\tverifyPropertiesToSet(props: { [key: string]: any }): void {\n\t\t// if not in a tree, we allow anything\n\t\tif (!this.cache.treeLineage) return\n\n\t\tassert(!props.id, \"`id` should not be set\")\n\t\tassert(!props.parentid || this.parentid === props.parentid, \"`parentid` should not be set\")\n\t\tassert(!props.children, \"`children` should not be set\")\n\t\tassert(!props.mutable, \"`mutable` should not be set\")\n\t\tassert(!props.update, \"`update` should not be set\")\n\t\tassert(!props.cache, \"`cache` should not be set\")\n\t}\n\n\tcloneEmpty() {\n\t\treturn new (this.constructor as any)() as this\n\t}\n\n\t// returns a similar deep clone of the node, but with new ids etc\n\tclone(props?: { [key: string]: any }): this {\n\t\tconst clone = this.cloneEmpty()\n\t\tclone.assign(this, cloneOverrides, { cache: clone.cache, id: clone.id }, props)\n\t\tif (props && props.children) return clone\n\n\t\tconst children = this.children\n\t\tif (children) {\n\t\t\tclone.children = new CanvasChildList(children.map(c => c.clone({ parentid: clone.id })))\n\t\t}\n\t\treturn clone\n\t}\n\n\t// preserve id while cloning, for copy/paste or such\n\tcloneWithIds(props?: { [key: string]: any }): this {\n\t\tconst clone = this.cloneEmpty()\n\t\tclone.assign(this, cloneOverrides, { cache: clone.cache }, props)\n\t\tif (props?.children) return clone\n\n\t\tconst children = this.children\n\t\tif (children) {\n\t\t\tclone.children = new CanvasChildList(children.map(c => c.cloneWithIds()))\n\t\t}\n\t\treturn clone\n\t}\n\n\t/**\n\t * Clone while maintaining a map from old to new ids.\n\t */\n\tcloneWithRenamedIds(renamedIds: Map<NodeID, NodeID>, props?: { [key: string]: any }): this {\n\t\tconst clone = this.cloneEmpty()\n\t\tclone.assign(this, cloneOverrides, { cache: clone.cache, id: clone.id }, props)\n\t\trenamedIds.set(this.id, clone.id)\n\t\tif (props && props.children) return clone\n\n\t\tconst children = this.children\n\t\tif (children) {\n\t\t\tclone.children = new CanvasChildList(children.map(c => c.cloneWithRenamedIds(renamedIds, { parentid: clone.id })))\n\t\t}\n\t\treturn clone\n\t}\n\n\t// overrides the clone with props returned from the callback, by default will rename the ids\n\tcloneWithCallback(callback: (node: MutableNode) => { [key: string]: unknown } | undefined, parentId?: NodeID): this {\n\t\tconst clone = this.cloneEmpty()\n\t\tconst props = callback(this)\n\t\tclone.assign(this, cloneOverrides, { cache: clone.cache, id: clone.id }, props)\n\t\tif (parentId) {\n\t\t\tclone.parentid = parentId\n\t\t}\n\t\tif (props && props.children) return clone\n\n\t\tconst children = this.children\n\t\tif (children) {\n\t\t\tclone.children = new CanvasChildList(children.map(c => c.cloneWithCallback(callback, clone.id)))\n\t\t}\n\t\treturn clone\n\t}\n\n\tfreeze(): Readonly<this> {\n\t\tassert(this.mutable, \"Node must be mutable when freezing\")\n\t\tthis.mutable = false\n\t\tthis.cache.draft = null\n\t\t// eslint-disable-next-line framer-studio/no-mutable-node-object-methods\n\t\tif (USE_FREEZE) driverNodeFreezeHook(this)\n\t\treturn this\n\t}\n\n\tpreCommit(_tree: NodeTree, _componentLoader: AnyComponentLoader): void {}\n\n\tpreFreeze(_tree: NodeTree, _componentLoader: AnyComponentLoader): void {}\n\n\t// Shortcut to resolve the tree from one that was passed in, or via node.cache.lineage\n\ttreeOrLatest<T extends NodeTree>(tree?: T): T | undefined {\n\t\tif (tree) return tree\n\t\treturn this.tree() as T | undefined\n\t}\n\n\t// Will return the latest tree.\n\ttree(): NodeTree | undefined {\n\t\treturn this.cache.treeLineage?.latestTree\n\t}\n\n\tisMutable(): this is MutableNode {\n\t\treturn this.mutable\n\t}\n\n\t/** Returns the latest mutable draft version of this node, creating it if needed. */\n\tasDraft(tree?: NodeTree): this {\n\t\tif (this.mutable) return this\n\t\treturn this.treeOrLatest(tree)?.getNodeAsDraft(this) as typeof this\n\t}\n\n\t/** Returns the draft version of this node if it exists, otherwise returns the node itself. */\n\tdraftOrCurrent(): this {\n\t\tif (this.cache.draft) return this.cache.draft as this\n\t\treturn this\n\t}\n\n\tgetChild<T extends ImmutableNode>(index: number): T | null {\n\t\tif (!this.children) return null\n\t\tif (index < 0 || index >= this.children.length) return null\n\t\tconst child = this.children.at(index)\n\t\tif (!child) return null\n\t\treturn child as T\n\t}\n\n\taddChild<T extends MutableNode>(child: T): T {\n\t\tassert(this.mutable, \"Node must be mutable when adding children\")\n\t\tassert(this.children, \"Node must have children\")\n\t\tif (this.children) {\n\t\t\tchild.parentid = this.id\n\t\t\tthis.children.push(child)\n\t\t}\n\t\treturn child\n\t}\n\n\tfind(predicate: (node: ImmutableNode) => boolean): ImmutableNode | null {\n\t\tif (predicate(this)) return this\n\t\tconst children = this.children\n\t\tif (children) {\n\t\t\tfor (const child of children) {\n\t\t\t\tconst foundNode = child.find(predicate)\n\t\t\t\tif (foundNode) return foundNode\n\t\t\t}\n\t\t}\n\t\treturn null\n\t}\n\n\t*ancestors(): IterableIterator<ImmutableNode> {\n\t\tconst tree = this.tree()\n\t\tif (!tree || !tree.has(this.id)) throw Error(\"Only nodes in a tree have access to their parents.\")\n\n\t\tlet ancestor = tree.get(this.parentid)\n\t\twhile (ancestor) {\n\t\t\tyield ancestor\n\t\t\tancestor = tree.get(ancestor.parentid)\n\t\t}\n\t}\n\n\t/**\n\t * This isn't actually faster than walk on MutableNode; it exists for\n\t * compatibility with DataNodes, where `fastWalk` is actually faster.\n\t * Unlike walk, the yielded accessor honors `skipChildren` so callers can\n\t * prune subtrees during iteration.\n\t */\n\t*fastWalk(): IterableIterator<NodeAccessor> {\n\t\tconst accessor: NodeAccessor = {\n\t\t\tid: this.id,\n\t\t\t__class: this.__class,\n\t\t\tget: (key: string) => (this as unknown as Record<string, unknown>)[key],\n\t\t\tskipChildren: false,\n\t\t}\n\n\t\tyield accessor\n\n\t\tif (accessor.skipChildren) return\n\n\t\tconst children = this.children\n\t\tif (!children) return\n\t\tfor (let i = 0, il = children.length; i < il; i++) {\n\t\t\tyield* children.at(i)!.fastWalk()\n\t\t}\n\t}\n\n\tget(key: keyof MutableNode): unknown {\n\t\treturn this[key]\n\t}\n\n\twalk(): IterableIterator<MutableNode> {\n\t\tlet first = true\n\t\tlet done = false\n\t\tlet current: [node: MutableNode, index: number] = [this, 0]\n\t\tconst stack: (typeof current)[] = []\n\n\t\treturn {\n\t\t\t[Symbol.iterator]() {\n\t\t\t\treturn this\n\t\t\t},\n\t\t\tnext() {\n\t\t\t\tif (first) {\n\t\t\t\t\t// Special case: return the originating node the first time.\n\t\t\t\t\tfirst = false\n\t\t\t\t\treturn { value: current[0], done: false }\n\t\t\t\t}\n\t\t\t\tif (done) {\n\t\t\t\t\treturn { value: undefined, done: true }\n\t\t\t\t}\n\t\t\t\t// Unwind stack until we can iterate children again.\n\t\t\t\twhile (!current[0].children || current[1] >= current[0].children.length) {\n\t\t\t\t\t// No more children to iterate.\n\t\t\t\t\tconst next = stack.pop()\n\t\t\t\t\tif (!next) {\n\t\t\t\t\t\t// Nothing more to iterate.\n\t\t\t\t\t\tdone = true\n\t\t\t\t\t\treturn { value: undefined, done: true }\n\t\t\t\t\t}\n\t\t\t\t\tcurrent = next\n\t\t\t\t}\n\t\t\t\tconst child = current[0].children.at(current[1]++)!\n\t\t\t\tif (child.children) {\n\t\t\t\t\t// We will iterate the children of this node next, store current state on stack.\n\t\t\t\t\tstack.push(current)\n\t\t\t\t\tcurrent = [child, 0]\n\t\t\t\t}\n\t\t\t\treturn { value: child, done: false }\n\t\t\t},\n\t\t}\n\t}\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { type BoxShadow, isBoxShadowList } from \"document/models/Shadow.ts\"\nimport { isObject } from \"utils/typeChecks.ts\"\nimport { isVectorNode } from \"../nodes/TreeNode.ts\"\nimport type { DynamicValue } from \"./DynamicValue.ts\"\nimport { isStylableNode } from \"./utils/hardCodedCodeComponentIdentifierChecks.ts\"\n\nexport function supportsShadowInset(node: CanvasNode): boolean {\n\tif (!supportsBoxShadow(node)) return false\n\n\tswitch (node.__class) {\n\t\tcase \"ImageStylePresetNode\":\n\t\t\treturn false\n\t\tdefault:\n\t\t\treturn true\n\t}\n}\n\nexport function supportsShadowSpread(node: CanvasNode): boolean {\n\t// VectorNode shadows are rendered using SVG filters and they don't support spread values. If at\n\t// least one node in the current selection is a VectorNode, we disable spread.\n\treturn withBoxShadow(node) && !isVectorNode(node)\n}\n\nexport function supportsRealisticShadow(node: CanvasNode): node is CanvasNode & WithBoxShadow {\n\tif (!supportsBoxShadow(node)) return false\n\n\tswitch (node.__class) {\n\t\tcase \"CodeComponentNode\":\n\t\tcase \"FormBooleanInputNode\":\n\t\tcase \"FormPlainTextInputNode\":\n\t\tcase \"FormSelectNode\":\n\t\tcase \"FrameNode\":\n\t\tcase \"ImageStylePresetNode\":\n\t\tcase \"ShaderNode\":\n\t\t\treturn true\n\t\tdefault:\n\t\t\treturn false\n\t}\n}\n\nexport function supportsBoxShadow<T extends CanvasNode>(node: T): node is T & WithBoxShadow {\n\t// CodeComponentNode implements the WithBoxShadow trait, but only (legacy) framer components\n\t// like Scroll/Page support it.\n\treturn withBoxShadow(node) && isStylableNode(node)\n}\n\nexport interface WithBoxShadow {\n\tboxShadows: readonly BoxShadow[] | DynamicValue | undefined\n}\n\nconst boxShadowsKey: keyof WithBoxShadow = \"boxShadows\"\nexport const isBoxShadowKey = (key: string | undefined) => key === boxShadowsKey\n\nexport function withBoxShadow<N extends CanvasNode>(target: N | undefined | null): target is N & WithBoxShadow {\n\tif (!isObject(target)) return false\n\treturn boxShadowsKey in target\n}\n\nexport function hasBoxShadow(\n\tnode: CanvasNode,\n): node is CanvasNode & WithBoxShadow & { boxShadows: readonly BoxShadow[] } {\n\tif (!withBoxShadow(node)) return false\n\tif (!isBoxShadowList(node.boxShadows)) return false\n\treturn node.boxShadows.length > 0\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { Shadow } from \"document/models/Shadow.ts\"\nimport { shadowKeys } from \"library/render/types/Shadow.ts\"\nimport { isObject } from \"utils/typeChecks.ts\"\n\nconst shadowsKey: keyof WithShadow = \"shadows\"\nexport const isShadowKey = (key: string | undefined) => key === shadowsKey\n\nexport function withShadow(node: CanvasNode): node is CanvasNode & WithShadow {\n\treturn shadowsKey in node\n}\n\nexport interface WithShadow {\n\tshadows: readonly Shadow[] | undefined\n}\n\nexport const shadowDefaults: WithShadow = {\n\tshadows: undefined,\n}\n\nexport function isShadow(shadow: unknown): shadow is Shadow {\n\tif (!isObject(shadow)) return false\n\treturn shadow && shadowKeys.every(key => key in shadow)\n}\n", "/**\n * Interface for CanvasNode properties that can reference TokenNodes. Provides\n * a way for the VekterEngine to query and replace tokens without having to\n * inspect every property on the node.\n */\nexport interface WithTokenVariables<T> {\n\t/**\n\t * Called when one or more Tokens are deleted, the implementation should\n\t * replace the variable with the value provided and return a new instance.\n\t */\n\tremoveTokenVariables(variables: { [tokenId: string]: string }): T | undefined\n}\n\nconst key: keyof WithTokenVariables<any> = \"removeTokenVariables\"\n\nexport function withTokenVariables<T>(node: any): node is object & WithTokenVariables<T> {\n\treturn typeof node === \"object\" && node !== null && key in node\n}\n", "import type { PackageIdentifier } from \"@framerjs/framer-runtime\"\nimport { localPackageFallbackIdentifier } from \"@framerjs/framer-runtime/crossorigin\"\nimport { isBoxShadow } from \"document/models/Shadow.ts\"\nimport { isRawControlProp } from \"document/models/controlProps/RawControlProp.ts\"\nimport { isPrefixedControlPropKey } from \"document/models/controlProps/controlPropKey.ts\"\nimport { P3Color } from \"library/render/types/Color/Color.ts\"\nimport { Color } from \"library/render/types/Color/index.ts\"\nimport { type CSSVarRange, parseCSSVariable } from \"library/render/utils/parseCSSVariable.ts\"\nimport { isArray, isObject, isString } from \"utils/typeChecks.ts\"\nimport type { AnyNodeUpdate } from \"../index.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\nimport type { ColorStyleTokenNode } from \"../nodes/ColorStyleTokenNode.ts\"\nimport { MutableNode } from \"../nodes/MutableNode.ts\"\nimport { isRichTextNode } from \"../nodes/utils/nodeCheck.ts\"\nimport { isBoxShadowKey } from \"../traits/WithBoxShadow.ts\"\nimport { isShadow, isShadowKey } from \"../traits/WithShadow.ts\"\nimport type { ReplicaOverrides } from \"../traits/WithTemplate.ts\"\nimport { withTokenVariables } from \"../traits/WithTokenVariables.ts\"\n\n/**\n * Returns an object map of CSS custom properties to value for all tokens both local and imported.\n * Useful for generating a stylesheet or passing into a style prop on a React component.\n */\nexport function getTokenCSSProperties(\n\ttokenNodes: readonly ColorStyleTokenNode[],\n\tisDarkMode: boolean = false,\n): { [prop: string]: string } {\n\tconst result: { [id: string]: string } = {}\n\n\t// Collect local tokens.\n\tfor (const token of tokenNodes) {\n\t\tconst value = token.colorForMode(isDarkMode)\n\t\tif (value) result[tokenToCSSCustomProperty(token)] = value\n\t}\n\n\treturn result\n}\n\nfunction getTokenStringsByColorMode(tokenNodes: readonly ColorStyleTokenNode[]): {\n\tlight: {\n\t\tsrgb: string\n\t\tp3: string\n\t}\n\tdark: {\n\t\tsrgb: string\n\t\tp3: string\n\t}\n} {\n\tconst tokens = {\n\t\tlight: {\n\t\t\tsrgb: \"\",\n\t\t\tp3: \"\",\n\t\t},\n\t\tdark: {\n\t\t\tsrgb: \"\",\n\t\t\tp3: \"\",\n\t\t},\n\t}\n\n\t// Collect local tokens.\n\tfor (const token of tokenNodes) {\n\t\tconst key = tokenToCSSCustomProperty(token)\n\t\tif (Color.isP3String(token.light)) {\n\t\t\ttokens.light.p3 += `${key}: ${token.light};`\n\t\t\tconst rgb = P3Color.fromString(token.light)?.toString(\"srgb\")\n\t\t\tif (rgb) tokens.light.srgb += `${key}: ${rgb};`\n\t\t} else {\n\t\t\ttokens.light.srgb += `${key}: ${token.light};`\n\t\t}\n\n\t\tif (!token.dark || token.softDeleted) continue\n\n\t\tif (Color.isP3String(token.dark)) {\n\t\t\ttokens.dark.p3 += `${key}: ${token.dark};`\n\t\t\tconst rgb = P3Color.fromString(token.dark)?.toString(\"srgb\")\n\t\t\tif (rgb) tokens.dark.srgb += `${key}: ${rgb};`\n\t\t} else {\n\t\t\ttokens.dark.srgb += `${key}: ${token.dark};`\n\t\t}\n\t}\n\n\treturn tokens\n}\n\nexport function getExportTokenCSSRules(tokenNodes: readonly ColorStyleTokenNode[]) {\n\tconst tokens = getTokenStringsByColorMode(tokenNodes)\n\treturn [\n\t\t`body { ${tokens.light.srgb} @supports (color: color(display-p3 1 1 1)) { ${tokens.light.p3} } }`,\n\t\t`@media (prefers-color-scheme: dark) { body { ${tokens.dark.srgb} @supports (color: color(display-p3 1 1 1)) { ${tokens.dark.p3} } } }`,\n\t]\n}\n\nexport function getPreviewTokenCSSRules(tokenNodes: readonly ColorStyleTokenNode[]) {\n\tconst tokens = getTokenStringsByColorMode(tokenNodes)\n\treturn [\n\t\t`body { ${tokens.light.srgb} @supports (color: color(display-p3 1 1 1)) { ${tokens.light.p3} } }`,\n\t\t`body[data-framer-theme=\"dark\"] { ${tokens.dark.srgb} @supports (color: color(display-p3 1 1 1)) { ${tokens.dark.p3} } }`,\n\t]\n}\n\n/**\n * Returns an object of updates that can be performed on the node provided\n * to restore any properties using the tokens provided to their original\n * value. Will return `undefined` if no changes were made.\n */\nexport function removeTokensFromNode(\n\tnode: CanvasNode,\n\ttokens: ColorStyleTokenNode[],\n\t/**\n\t * For export, we need to replace based on the current color mode. We can't\n\t * \"just\" rely on the custom property definitions because our sandbox for\n\t * exports doesn't load Shared Color packages which nodes may reference.\n\t */\n\tisDarkMode: boolean = false,\n): AnyNodeUpdate | undefined {\n\tlet updated: AnyNodeUpdate | undefined\n\tconst map: { [tokenId: string]: string } = {}\n\tfor (const t of tokens) {\n\t\tconst value = t.colorForMode(isDarkMode)\n\t\tif (!value) return\n\t\tmap[t.id] = value\n\t}\n\n\tif (isRichTextNode(node)) {\n\t\t// Skip the ProseMirror parse/serialize when no removed token appears in the html.\n\t\tconst tokensInHTML = tokens.some(t => node.html.includes(tokenToCSSCustomProperty(t)))\n\t\tif (tokensInHTML) {\n\t\t\tconst newHTML = node.removeTokenVariables(map)\n\n\t\t\tif (newHTML !== node.html) {\n\t\t\t\tupdated ??= {}\n\t\t\t\tupdated.html = newHTML\n\t\t\t}\n\t\t}\n\t}\n\n\tconst updates = removeTokensFromProps(node, map)\n\tif (updates) {\n\t\tupdated = { ...updated, ...updates }\n\t}\n\n\treturn updated\n}\n\nfunction shouldSkipProperty(key: string) {\n\treturn key === \"children\" || key === \"id\" || key === \"cache\"\n}\n\nfunction removeTokensFromProps<Props extends CanvasNode>(\n\tprops: Props | ReplicaOverrides,\n\ttokenMap: { [tokenId: string]: string },\n) {\n\tlet updated: AnyNodeUpdate | undefined\n\n\tconst entries = props instanceof MutableNode ? props.entries() : Object.entries(props)\n\tentries.forEach(([key, value]) => {\n\t\tif (shouldSkipProperty(key)) return\n\n\t\tlet result: unknown\n\n\t\tconst isShadowOrBoxShadow = isShadowKey(key) || isBoxShadowKey(key)\n\t\tif (isArray(value)) {\n\t\t\tconst mapped: unknown[] = []\n\t\t\tlet didReplaceToken = false\n\t\t\tvalue.forEach((item, idx) => {\n\t\t\t\tconst isAnyShadow = isShadowOrBoxShadow && (isShadow(item) || isBoxShadow(item))\n\t\t\t\tconst replaced = isAnyShadow\n\t\t\t\t\t? removeTokenFromValue(item, tokenMap)\n\t\t\t\t\t: replacePropertyToken(String(idx), item, tokenMap)\n\n\t\t\t\tif (replaced) didReplaceToken = true\n\t\t\t\tmapped.push(replaced ? replaced : item)\n\t\t\t})\n\t\t\tif (didReplaceToken) result = mapped\n\t\t} else {\n\t\t\tresult = replacePropertyToken(key, value, tokenMap)\n\t\t}\n\n\t\tif (typeof result !== \"undefined\") {\n\t\t\tif (!updated) updated = {}\n\t\t\tupdated[key] = result\n\t\t}\n\t})\n\n\treturn updated\n}\n\nfunction hasTokenInValue(value: unknown, tokenId: string): boolean {\n\tif (isArray(value)) {\n\t\tfor (const item of value) {\n\t\t\tif (hasTokenInValue(item, tokenId)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\n\t\treturn false\n\t}\n\n\tif (isObject(value)) {\n\t\tconst items = Object.values(value)\n\n\t\tfor (const item of items) {\n\t\t\tif (hasTokenInValue(item, tokenId)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\n\t\treturn false\n\t}\n\n\tif (isTokenCSSVariable(value)) {\n\t\treturn tokenIdFromCSSVariable(value) === tokenId\n\t}\n\n\treturn false\n}\n\nexport function hasTokenInNode(node: CanvasNode, tokenId: string) {\n\tif (isRichTextNode(node)) {\n\t\tconst colors = node.getTextColors(false)\n\t\tfor (const color of colors) {\n\t\t\tif (hasTokenInValue(color, tokenId)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\n\t\tconst fills = node.getFills()\n\t\tfor (const fill of fills) {\n\t\t\tif (hasTokenInValue(fill, tokenId)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const key in node) {\n\t\tif (shouldSkipProperty(key)) {\n\t\t\tcontinue\n\t\t}\n\n\t\tif (hasTokenInValue(node[key as keyof typeof node], tokenId)) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\nexport function findValueForTokenCSSVariable(value: unknown, map: Record<string, string>): string | undefined {\n\tif (!isTokenCSSVariable(value)) return\n\tconst tokenId = tokenIdFromCSSVariable(value)\n\tif (!tokenId) return\n\treturn map[tokenId]\n}\n\nfunction replacePropertyToken(key: string, value: unknown, map: { [tokenId: string]: string }): unknown | undefined {\n\tif (isPrefixedControlPropKey(key)) {\n\t\treturn removeTokenFromCodeComponentProp(value, map)\n\t}\n\n\tif (withTokenVariables(value)) {\n\t\tconst newValue = value.removeTokenVariables(map)\n\t\tif (newValue) {\n\t\t\treturn newValue\n\t\t}\n\t}\n\n\tconst replacement = findValueForTokenCSSVariable(value, map)\n\tif (replacement) return replacement\n\n\t// If we have a token variable, but couldn't find replacement (e.g. the color package no longer exist in the project),\n\t// at least strip away the metadata\n\tif (isTokenCSSVariable(value)) {\n\t\treturn stripMetadataFromCSSVariable(value)\n\t}\n}\n\nfunction removeTokenFromCodeComponentProp(prop: unknown, map: { [tokenId: string]: string }): unknown | undefined {\n\tif (!isRawControlProp(prop)) return\n\tconst { value } = prop\n\tconst replacement = removeTokenFromValue(value, map)\n\treturn replacement === undefined ? undefined : { ...prop, value: replacement }\n}\n\nfunction removeTokenFromValue(value: unknown, map: { [tokenId: string]: string }): unknown | undefined {\n\tif (isArray(value)) {\n\t\tlet hasChanged = false\n\t\tconst clonedArray = value.map(entry => {\n\t\t\tconst replacement = removeTokenFromValue(entry, map)\n\t\t\tif (replacement) {\n\t\t\t\thasChanged = true\n\t\t\t\treturn replacement\n\t\t\t} else {\n\t\t\t\treturn entry\n\t\t\t}\n\t\t})\n\n\t\treturn hasChanged ? clonedArray : undefined\n\t}\n\n\tif (isObject(value)) {\n\t\tconst clonedObject = {} as typeof value\n\t\tlet hasChanged = false\n\t\tfor (const key in value) {\n\t\t\tconst replacement = removeTokenFromValue(value[key], map)\n\t\t\tif (replacement) {\n\t\t\t\thasChanged = true\n\t\t\t\tclonedObject[key] = replacement\n\t\t\t} else {\n\t\t\t\tclonedObject[key] = value[key]\n\t\t\t}\n\t\t}\n\t\treturn hasChanged ? clonedObject : undefined\n\t}\n\n\tif (isTokenCSSVariable(value)) {\n\t\treturn findValueForTokenCSSVariable(value, map)\n\t}\n\n\treturn undefined\n}\n\nexport type TokenId = string\n\ninterface TokenMetadata {\n\tname: string\n\tpackageIdentifier?: string\n}\n\nconst tokenPrefix = \"--token-\"\n\n/**\n * Returns a CSS Custom Property for the TokenNode provided.\n * This is used for the custom property declaration somewhere on the page.\n */\nexport function tokenToCSSCustomProperty(node: { id: TokenId }): `${typeof tokenPrefix}${TokenId}` {\n\treturn `${tokenPrefix}${node.id}`\n}\n\n/**\n * Returns a CSS variable for the TokenNode provided. This\n * is used to refer to a CSS custom property as a value on a CanvasNode.\n * By default will include a CSS comment containing origin information about\n * the token. Pass the `excludeMetadata` option to disable this.\n */\nexport function tokenToCSSVariable(\n\tnode: ColorStyleTokenNode,\n\toptions: { packageIdentifier?: PackageIdentifier; excludeMetadata?: boolean } = {},\n): string {\n\tconst color = node.light\n\tif (!color) return \"\"\n\tconst value = Color.isColor(color) ? Color.toRgbString(Color(color)) : color\n\tconst variable = `var(${tokenToCSSCustomProperty(node)}, ${value})`\n\tif (options.excludeMetadata === true) {\n\t\treturn variable\n\t}\n\treturn `${variable} ${tokenMetadata(node.name, options.packageIdentifier)}`\n}\n\n/**\n * Strip away the metadata from a CSS variable\n */\nexport function stripMetadataFromCSSVariable(variable: string) {\n\tconst { customProperty, fallback } = parseCSSVariable(variable)\n\tif (customProperty && fallback) {\n\t\treturn `var(${customProperty}, ${fallback})`\n\t} else if (customProperty) {\n\t\treturn `var(${customProperty})`\n\t}\n\treturn undefined\n}\n\nexport function valueOrTokenWithoutMetadata(\n\tvalue: string | undefined,\n\ttransform?: (value: string) => string,\n): string | undefined {\n\tif (isTokenCSSVariable(value)) {\n\t\tconst variable = stripMetadataFromCSSVariable(value)\n\t\tif (variable) return variable\n\t}\n\n\tif (!isString(value)) return value\n\tif (transform) return transform(value)\n\treturn value\n}\n\n/**\n * Returns a CSS comment containing the origins of the node\n */\nfunction tokenMetadata(name: string, packageIdentifier?: PackageIdentifier) {\n\tconst metadata: TokenMetadata = { name: name }\n\n\tif (packageIdentifier && packageIdentifier !== localPackageFallbackIdentifier) {\n\t\tmetadata.packageIdentifier = packageIdentifier\n\t}\n\n\treturn `/* ${JSON.stringify(metadata)} */`\n}\n\nfunction removeTokenPrefix(token?: string): TokenId | null {\n\treturn token ? token.slice(tokenPrefix.length) : null\n}\n\nexport function tokenIdFromCSSVarRange(str: string, range: CSSVarRange): TokenId | null {\n\tconst end = range.commaIndex ?? range.end - 1\n\tconst customProperty = str.substring(range.start + 4, end)\n\treturn removeTokenPrefix(customProperty)\n}\n\nexport function tokenIdFromCustomProperty(str: string): TokenId | null {\n\treturn removeTokenPrefix(str)\n}\n\n/**\n * Parses out the TokenId from a CSS variable.\n */\nexport function tokenIdFromCSSVariable(str: string): TokenId | null {\n\tconst { customProperty } = parseCSSVariable(str)\n\treturn removeTokenPrefix(customProperty)\n}\n\n/**\n * Parses out the fallback value from a CSS variable.\n */\nexport function fallbackValueFromCSSVariable(str: string): string | null {\n\treturn parseCSSVariable(str).fallback || null\n}\n\n/**\n * Returns true if the CSS variable provided references a TokenNode.\n */\nexport function isTokenCSSVariable(value: unknown): value is string {\n\tif (typeof value !== \"string\") return false\n\treturn value.trim().startsWith(`var(${tokenPrefix}`)\n}\n", "import type { WithControlFocalPoint } from \"document/models/controlProps/WithControlFocalPoint.ts\"\nimport { isObject, isString } from \"utils/typeChecks.ts\"\n\nexport interface ResponsiveImage extends Partial<WithControlFocalPoint> {\n\treadonly src: string\n\treadonly srcSet?: string\n\treadonly alt?: string\n}\n\nconst srcKey: keyof ResponsiveImage = \"src\"\n\nexport function isResponsiveImage(value: unknown): value is ResponsiveImage {\n\treturn isObject(value) && isString(value[srcKey])\n}\n", "import { isObject } from \"utils/typeChecks.ts\"\nimport type { RawControlProps } from \"./controlProps/RawControlProp.ts\"\n\nexport interface RecordedGamepadKey {\n\tkey: string\n\tmapping: Gamepad[\"mapping\"]\n\tgamepadId: string\n}\n\nexport interface RecordedKeyboardKey {\n\tkey: string\n\tcode: string\n\tkeyCode: number\n\taltKey: boolean\n\tctrlKey: boolean\n\tmetaKey: boolean\n\tshiftKey: boolean\n}\n\n/**\n * If set, when triggered by an input event, only perform the\n * interaction of the input value passes one of these predicates.\n */\nexport type EventActionInputValuePredicate = \"empty\" | \"set\"\n\nexport interface EventAction {\n\treadonly identifier: string\n\treadonly actionIdentifier: string\n\treadonly controls: Readonly<RawControlProps>\n\t/* settings apply to all actions */\n\treadonly meta?: Readonly<{\n\t\tdelay?: number\n\t\tkey?: RecordedKeyboardKey | RecordedGamepadKey\n\t\tinputValue?: EventActionInputValuePredicate\n\t}>\n}\n\nexport type EventActions = readonly EventAction[] | undefined\n\nconst keys: (keyof EventAction)[] = [\"actionIdentifier\", \"identifier\", \"controls\"]\n\nexport function isEventAction(value: unknown): value is EventAction {\n\treturn isObject(value) && keys.every(key => key in value)\n}\n\nexport function isRecordedGamepadKey(value: unknown): value is RecordedGamepadKey {\n\treturn isObject(value) && \"gamepadId\" in value\n}\n", "/** Supported rel values for links https://www.iana.org/assignments/link-relations/link-relations.xhtml */\nexport const supportedLinkRelValues = [\"nofollow\", \"noreferrer\", \"me\", \"ugc\", \"sponsored\"] as const\n\n/** Supported rel values for links https://www.iana.org/assignments/link-relations/link-relations.xhtml */\nexport type SupportedLinkRelValue = (typeof supportedLinkRelValues)[number]\n", "import {\n\ttype SupportedLinkRelValue,\n\tsupportedLinkRelValues as allSupportedRelValues,\n} from \"library/render/types/SupportedRelValue.ts\"\nimport { isArray } from \"utils/typeChecks.ts\"\nexport type { SupportedLinkRelValue } from \"library/render/types/SupportedRelValue.ts\"\n\nexport const supportedLinkRelValues = allSupportedRelValues\n\nconst supportedRelValuesSet = new Set(supportedLinkRelValues)\nexport const isSupportedLinkRelValue = (value: string): value is SupportedLinkRelValue => {\n\treturn supportedRelValuesSet.has(value as SupportedLinkRelValue)\n}\n\nexport const isSupportedLinkRelValueArray = (value: unknown): value is readonly SupportedLinkRelValue[] => {\n\tif (!isArray(value)) return false\n\treturn value.every(isSupportedLinkRelValue)\n}\n", "import { Mixed } from \"@framerjs/shared\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { NotFound, isFoundAndNotMixed, isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\n\nexport type CommonValue<T> = T | Mixed | NotFound\n\n/**\n * Ensures that an iterable only contains a single value. If it contains more\n * than one unique value return `Mixed`, for zero values, returns `NotFound`.\n */\nexport function commonValue<Value>(\n\tvalues: Iterable<Value>,\n\tareEqual: (a: Value, b: Value) => boolean = (a, b) => a === b,\n): CommonValue<Value> {\n\tlet result: CommonValue<Value> = NotFound\n\tfor (const value of values) {\n\t\tif (isNotFound(result)) {\n\t\t\tresult = value\n\t\t} else if (!areEqual(value, result)) {\n\t\t\treturn Mixed\n\t\t}\n\t}\n\treturn result\n}\n\n/**\n * Returns the common value for a certain key on a list of records, `NotFound`\n * when there are no records, and Mixed when different values are found.\n */\nexport function commonPropertyValue<K extends string, T extends Record<K, unknown>>(\n\trecords: T[],\n\tkey: K,\n): T[K] | Mixed | NotFound {\n\t// Empty array\n\tconst firstRecord = records[0]\n\tif (firstRecord === undefined) {\n\t\treturn NotFound\n\t}\n\n\tconst firstValue = firstRecord[key]\n\n\tfor (const [index, record] of records.entries()) {\n\t\tif (index === 0) continue\n\t\tconst value = record[key]\n\t\tif (firstValue !== value) {\n\t\t\treturn Mixed\n\t\t}\n\t}\n\n\treturn firstValue\n}\n\nexport function getFirstCommonValue<T>(...values: Reduced<T>[]): T | undefined {\n\treturn values.find(isFoundAndNotMixed)\n}\n", "import { isNumber } from \"@framerjs/assets/src/utils.ts\"\nimport { isMixed } from \"@framerjs/shared\"\nimport type { BorderComponentProps, BorderStyle } from \"library/render/style/BorderComponent.tsx\"\nimport type { Border } from \"library/render/types/PropertyControls.ts\"\nimport { commonValue } from \"utils/commonValue.ts\"\nimport { isBoolean, isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../CanvasTree/index.ts\"\nimport type { BorderValues, WithBorder } from \"../CanvasTree/traits/WithBorder.ts\"\nimport type { ReducedRecord } from \"../CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedBorder } from \"../CanvasTree/traits/utils/reduceBorder.ts\"\n\nexport const borderColorKey = \"borderColor\" satisfies keyof Border & keyof BorderValues & keyof BorderComponentProps\n\n/**\n * Converts our internal BorderValues data model to the BorderComponentProps type which gets passed\n * to the library BorderComponent component while rendering the canvas border.\n */\nexport function toBorderComponentProps(value: BorderValues): BorderComponentProps {\n\treturn {\n\t\tborderWidth: !value.borderPerSide\n\t\t\t? value.borderWidth\n\t\t\t: {\n\t\t\t\t\ttop: value.borderTop,\n\t\t\t\t\tright: value.borderRight,\n\t\t\t\t\tbottom: value.borderBottom,\n\t\t\t\t\tleft: value.borderLeft,\n\t\t\t\t},\n\t\tborderColor: value.borderColor,\n\t\tborderStyle: value.borderStyle,\n\t}\n}\n\nexport function isBorderValues(value: unknown): value is BorderValues {\n\tif (!isObject(value)) return false\n\n\tconst borderWidthKey: keyof BorderValues = \"borderWidth\"\n\tconst borderStyleKey: keyof BorderValues = \"borderStyle\"\n\tconst borderPerSideKey: keyof BorderValues = \"borderPerSide\"\n\tconst borderTopKey: keyof BorderValues = \"borderTop\"\n\tconst borderRightKey: keyof BorderValues = \"borderRight\"\n\tconst borderBottomKey: keyof BorderValues = \"borderBottom\"\n\tconst borderLeftKey: keyof BorderValues = \"borderLeft\"\n\n\tif (!isString(value[borderColorKey])) return false\n\tif (!isString(value[borderStyleKey])) return false\n\tif (!isNumber(value[borderWidthKey])) return false\n\tif (!isBoolean(value[borderPerSideKey])) return false\n\tif (!isNumber(value[borderTopKey])) return false\n\tif (!isNumber(value[borderRightKey])) return false\n\tif (!isNumber(value[borderLeftKey])) return false\n\tif (!isNumber(value[borderBottomKey])) return false\n\n\treturn true\n}\n\nconst allBorderStyles: Record<string, boolean> = {\n\tsolid: true,\n\tdashed: true,\n\tdotted: true,\n\tdouble: true,\n} satisfies Record<BorderStyle, true>\n\nexport function isBorderStyle(value: unknown): value is BorderStyle {\n\treturn isString(value) && Object.hasOwn(allBorderStyles, value)\n}\n\nexport type ReducedBorderValues = ReducedRecord<BorderValues>\n\n/**\n * Represents some sensible defaults to use for border values.\n * These generally reflect defaults in most browsers.\n */\nexport const borderValueDefaults: BorderValues = {\n\tborderColor: \"black\",\n\tborderStyle: \"solid\",\n\tborderPerSide: false,\n\tborderBottom: 1,\n\tborderLeft: 1,\n\tborderRight: 1,\n\tborderTop: 1,\n\tborderWidth: 1,\n}\n\n/**\n * Converts our internal BorderValues data model to the public Border API. If the provided value is\n * not BorderValues, it will just be returned as is. The difference between BorderValues and Border\n * is that BorderValues contains internal attributes such as borderPerSide, whereas Border is a more\n * user facing version of the same data.\n */\nexport function toBorderReactCSSProperties(value: BorderValues | Border): Border {\n\t// If the value is not in the BorderValues format, we assume it's already in the Border format\n\t// and return it as is.\n\tif (!isBorderValues(value)) return value\n\n\t// Otherwise, we convert the BorderValues to the Border format.\n\tconst { borderColor, borderStyle, borderPerSide, borderWidth, borderTop, borderRight, borderBottom, borderLeft } =\n\t\tvalue\n\n\tif (borderPerSide) {\n\t\treturn {\n\t\t\tborderColor,\n\t\t\tborderStyle,\n\t\t\tborderTopWidth: borderTop,\n\t\t\tborderRightWidth: borderRight,\n\t\t\tborderBottomWidth: borderBottom,\n\t\t\tborderLeftWidth: borderLeft,\n\t\t}\n\t}\n\n\treturn {\n\t\tborderColor,\n\t\tborderStyle,\n\t\tborderWidth,\n\t}\n}\n\n/**\n * Converts the ReducedBorder type to our BorderValues type.\n */\nexport function fromReducedNodeBorderTrait(value: Omit<ReducedBorder, \"borderEnabled\">): BorderValues {\n\tconst result = { ...borderValueDefaults }\n\tif (isNumber(value.borderTop)) result.borderTop = value.borderTop\n\tif (isNumber(value.borderRight)) result.borderRight = value.borderRight\n\tif (isNumber(value.borderBottom)) result.borderBottom = value.borderBottom\n\tif (isNumber(value.borderLeft)) result.borderLeft = value.borderLeft\n\tif (isNumber(value.borderWidth)) result.borderWidth = value.borderWidth\n\tif (isString(value.borderColor)) result.borderColor = value.borderColor\n\tif (isString(value.borderStyle)) result.borderStyle = value.borderStyle\n\tif (isBoolean(value.borderPerSide)) result.borderPerSide = value.borderPerSide\n\n\treturn result\n}\n\n/**\n * Extracts the border values from a node implementing WithBorder into a\n * BorderValues object.\n */\nexport function fromNodeBorderValues(node: CanvasNode & WithBorder): BorderValues {\n\tconst result = { ...borderValueDefaults }\n\tif (isNumber(node.borderTop)) result.borderTop = node.borderTop\n\tif (isNumber(node.borderRight)) result.borderRight = node.borderRight\n\tif (isNumber(node.borderBottom)) result.borderBottom = node.borderBottom\n\tif (isNumber(node.borderLeft)) result.borderLeft = node.borderLeft\n\tif (isNumber(node.borderWidth)) result.borderWidth = node.borderWidth\n\tif (isString(node.borderColor)) result.borderColor = node.borderColor\n\tif (isString(node.borderStyle)) result.borderStyle = node.borderStyle\n\tif (isBoolean(node.borderPerSide)) result.borderPerSide = node.borderPerSide\n\n\treturn result\n}\n\n/**\n * Converts the public-facing Border type to our internal BorderValues data\n * model.\n */\nexport function fromBorderReactCSSProperties(value: Border | undefined): BorderValues {\n\tif (!value) return borderValueDefaults\n\tconst defaultBorderWidth = 0\n\tconst borderTop = value.borderTopWidth ?? value.borderWidth ?? defaultBorderWidth\n\tconst borderRight = value.borderRightWidth ?? value.borderWidth ?? defaultBorderWidth\n\tconst borderBottom = value.borderBottomWidth ?? value.borderWidth ?? defaultBorderWidth\n\tconst borderLeft = value.borderLeftWidth ?? value.borderWidth ?? defaultBorderWidth\n\tconst borderWidth = value.borderWidth ?? borderValueDefaults.borderWidth\n\n\t// If the common value of all of the possible border widths is mixed,\n\t// then we should consider this as a per-side border in our internal model.\n\tconst borderPerSide = isMixed(commonValue([borderTop, borderRight, borderBottom, borderLeft, borderWidth]))\n\tconst borderStyle = value.borderStyle ?? borderValueDefaults.borderStyle\n\tconst borderColor = value.borderColor ?? borderValueDefaults.borderColor\n\n\treturn { borderPerSide, borderTop, borderRight, borderBottom, borderLeft, borderColor, borderStyle, borderWidth }\n}\n\nfunction isOptionalString(value: unknown): value is string | undefined {\n\treturn isString(value) || isUndefined(value)\n}\n\nfunction isOptionalNumber(value: unknown): value is number | undefined {\n\treturn isNumber(value) || isUndefined(value)\n}\n\nexport function isValidBorderReactCSSProperties(value: unknown): value is Border {\n\tif (!isObject(value)) return false\n\n\tconst borderWidthKey: keyof Border = \"borderWidth\"\n\tconst borderStyleKey: keyof Border = \"borderStyle\"\n\tconst borderTopWidthKey: keyof Border = \"borderTopWidth\"\n\tconst borderRightWidthKey: keyof Border = \"borderRightWidth\"\n\tconst borderBottomWidthKey: keyof Border = \"borderBottomWidth\"\n\tconst borderLeftWidthKey: keyof Border = \"borderLeftWidth\"\n\n\tif (!isOptionalString(value[borderColorKey])) return false\n\tif (!isOptionalString(value[borderStyleKey])) return false\n\n\tif (!isOptionalNumber(value[borderTopWidthKey])) return false\n\tif (!isOptionalNumber(value[borderRightWidthKey])) return false\n\tif (!isOptionalNumber(value[borderLeftWidthKey])) return false\n\tif (!isOptionalNumber(value[borderBottomWidthKey])) return false\n\n\tif (!isOptionalNumber(value[borderWidthKey])) return false\n\n\treturn true\n}\n", "import { assertNever, isModuleExportIdentifier } from \"@framerjs/shared\"\nimport { isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type {\n\tFourPixelNumberShorthand,\n\tRelativeOrFourPixelNumberShorthand,\n\tTwoPixelNumberShorthand,\n} from \"document/models/CanvasTree/traits/NumberShorthand.ts\"\nimport type { ResponsiveImage } from \"document/models/CanvasTree/traits/ResponsiveImage.ts\"\nimport { isResponsiveImage } from \"document/models/CanvasTree/traits/ResponsiveImage.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { BorderValues } from \"document/models/CanvasTree/traits/WithBorder.ts\"\nimport type { CSSCursor } from \"document/models/CanvasTree/traits/WithCursor.ts\"\nimport { getLink, isLink } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport type { EventAction } from \"document/models/EventAction.ts\"\nimport { isEventAction } from \"document/models/EventAction.ts\"\nimport { isBoxShadowList } from \"document/models/Shadow.ts\"\nimport { isSupportedLinkRelValue } from \"document/models/SupportedRelValue.ts\"\nimport type { Transition } from \"document/models/Transition.ts\"\nimport { isPartialTransition } from \"document/models/Transition.ts\"\nimport { isBorderValues } from \"document/models/controlProps/BorderControlPropValue.ts\"\nimport { isCoordinate } from \"document/models/controlProps/ControlProp.ts\"\nimport { isFusedNumberControlPropValue } from \"document/models/controlProps/FusedNumberControlPropValue.ts\"\nimport type { ControlDescription, Coordinate, EnumControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport type { ReactElement } from \"react\"\nimport { isValidElement } from \"react\"\nimport { isValidElementType } from \"react-is\"\nimport { isArray, isBoolean, isNumber, isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\n\n/** @deprecated */\nexport function isValidPropertyValue(property: ControlDescription, value: unknown) {\n\tif (!isValidPropertyValueType(property.type, value)) return false\n\n\tswitch (property.type) {\n\t\tcase ControlType.Enum:\n\t\tcase ControlType.SegmentedEnum:\n\t\t\tif (isVariableReference(value)) return true\n\t\t\tif (isComputedValue(value) && value.outputType === ControlType.Enum) return true\n\t\t\treturn property.options.some(option => option === value)\n\t}\n\n\treturn true\n}\n\nexport type EnumValueType = EnumControlDescription[\"defaultValue\"]\n\n/** @deprecated */\nexport function isValidPropertyValueType(type: ControlType.Boolean, value: unknown): value is boolean\nexport function isValidPropertyValueType(type: ControlType.Number, value: unknown): value is number\nexport function isValidPropertyValueType(type: ControlType.String, value: unknown): value is string\nexport function isValidPropertyValueType(type: ControlType.RichText, value: unknown): value is string | ReactElement\nexport function isValidPropertyValueType(type: ControlType.Color, value: unknown): value is string\nexport function isValidPropertyValueType(type: ControlType.File, value: unknown): value is string | undefined\nexport function isValidPropertyValueType(type: ControlType.Image, value: unknown): value is string | undefined\nexport function isValidPropertyValueType(type: ControlType.ResponsiveImage, value: unknown): value is ResponsiveImage\nexport function isValidPropertyValueType(type: ControlType.Enum, value: unknown): value is EnumValueType\nexport function isValidPropertyValueType(type: ControlType.Transition, value: unknown): value is Partial<Transition>\nexport function isValidPropertyValueType(type: ControlType.Link, value: unknown): value is string | undefined\nexport function isValidPropertyValueType(type: ControlType.EventHandler, value: unknown): value is EventAction[]\nexport function isValidPropertyValueType(type: ControlType.Border, value: unknown): value is BorderValues\nexport function isValidPropertyValueType(type: ControlType.Cursor, value: unknown): value is CSSCursor\nexport function isValidPropertyValueType(type: ControlType.BoxShadow, value: unknown): value is string | undefined\nexport function isValidPropertyValueType(type: ControlType.Gap, value: unknown): value is TwoPixelNumberShorthand\nexport function isValidPropertyValueType(type: ControlType.Padding, value: unknown): value is FourPixelNumberShorthand\nexport function isValidPropertyValueType(\n\ttype: ControlType.BorderRadius,\n\tvalue: unknown,\n): value is RelativeOrFourPixelNumberShorthand\nexport function isValidPropertyValueType(type: ControlType.CollectionReference, value: unknown): value is string\nexport function isValidPropertyValueType(type: ControlType.MultiCollectionReference, value: unknown): value is string[]\nexport function isValidPropertyValueType(type: ControlType.Location, value: unknown): value is Coordinate\nexport function isValidPropertyValueType(type: ControlType | null, value: unknown): boolean\nexport function isValidPropertyValueType(type: ControlType | null, value: unknown) {\n\tif (isVariableReference(value)) return true\n\tif (isComputedValue(value)) return value.outputType === type\n\n\tswitch (type) {\n\t\tcase ControlType.Boolean:\n\t\t\treturn isBoolean(value)\n\t\tcase ControlType.Number:\n\t\t\treturn isNumber(value)\n\t\tcase ControlType.String:\n\t\tcase ControlType.Color:\n\t\tcase ControlType.ComponentInstance:\n\t\t\treturn isString(value)\n\t\tcase ControlType.Slot:\n\t\t\treturn isString(value) || isArray(value)\n\t\tcase ControlType.RichText:\n\t\t\treturn isString(value) || isValidElement(value)\n\t\tcase ControlType.ResponsiveImage:\n\t\t\treturn isResponsiveImage(value)\n\t\tcase ControlType.File:\n\t\tcase ControlType.Image:\n\t\t\treturn isString(value) || isUndefined(value)\n\t\tcase ControlType.Enum:\n\t\tcase ControlType.SegmentedEnum:\n\t\t\tif (value === undefined) return true\n\t\t\tif (value === null) return true\n\t\t\tif (isBoolean(value)) return true\n\t\t\tif (isNumber(value)) return true\n\t\t\tif (isString(value)) return true\n\t\t\treturn false\n\t\tcase ControlType.FusedNumber:\n\t\t\treturn isFusedNumberControlPropValue(value)\n\t\tcase ControlType.EventHandler:\n\t\t\treturn isArray(value) && value.every(isEventAction)\n\t\tcase ControlType.Transition:\n\t\t\treturn isPartialTransition(value)\n\t\tcase ControlType.Border:\n\t\t\treturn isBorderValues(value)\n\t\tcase ControlType.Link:\n\t\t\treturn isLink(getLink(value))\n\t\tcase ControlType.LinkRelValues:\n\t\t\treturn isArray(value) && value.every(isSupportedLinkRelValue)\n\t\tcase ControlType.Date:\n\t\t\tif (value === undefined) return true\n\t\t\treturn isString(value)\n\t\tcase ControlType.Object:\n\t\t\treturn isObject(value)\n\t\tcase ControlType.Cursor:\n\t\t\treturn isString(value)\n\t\tcase ControlType.BoxShadow:\n\t\t\treturn isBoxShadowList(value)\n\t\tcase ControlType.Gap:\n\t\tcase ControlType.Padding:\n\t\tcase ControlType.BorderRadius:\n\t\t\treturn isString(value)\n\t\tcase ControlType.CollectionReference:\n\t\t\treturn isString(value)\n\t\tcase ControlType.MultiCollectionReference:\n\t\t\treturn isArray(value) && value.every(isString)\n\t\tcase ControlType.TrackingId:\n\t\t\treturn isString(value)\n\t\tcase ControlType.Array:\n\t\t\treturn isArray(value)\n\t\tcase ControlType.VectorSetItem:\n\t\t\treturn (isString(value) && isModuleExportIdentifier(value)) || isValidElementType(value)\n\t\tcase ControlType.ChangeHandler:\n\t\t\treturn false\n\t\tcase ControlType.Location:\n\t\t\treturn isCoordinate(value)\n\t\tcase ControlType.Font:\n\t\tcase ControlType.PageScope:\n\t\tcase ControlType.CustomCursor:\n\t\tcase ControlType.ScrollSectionRef:\n\t\tcase null:\n\t\t\t// FIXME: these should probably have been handled\n\t\t\treturn false\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n", "import { parseNumberRounded } from \"@framerjs/shared\"\nimport type { BoxShadow } from \"document/models/Shadow.ts\"\nimport { createBoxShadow } from \"document/models/Shadow.ts\"\nimport { Color } from \"library/render/types/Color/index.ts\"\nimport type { WithBoxShadow } from \"../WithBoxShadow.ts\"\n\n// Loosely copied from https://github.com/jxnblk/css-box-shadow\nconst VALUES_REG = /,(?![^(]*\\))/u\nconst PARTS_REG = /\\s(?![^(]*\\))/u\nconst COLOR_REG = /(?:#|0x)(?:[a-f\\d]{3}|[a-f\\d]{6})\\b|(?:rgb|hsl)a?\\([^)]*\\)/u\n\nconst parseValue = (value: string, index: number): BoxShadow => {\n\tconst parts = value.trim().toLowerCase().split(PARTS_REG)\n\tconst inset = parts.includes(\"inset\")\n\tconst values: (number | undefined)[] = []\n\tconst color = parts.find(part => COLOR_REG.test(part)) ?? parts[parts.length - 1]\n\n\tfor (const part of parts) {\n\t\tif (part === \"inset\") continue\n\t\tif (part === color) continue\n\n\t\tvalues.push(parseNumberRounded(part))\n\t}\n\n\tconst [x, y, blur, spread] = values\n\treturn createBoxShadow({ type: \"box\", inset, x, y, blur, spread, color, id: `box-shadow-${index}` })\n}\n\nexport function parseBoxShadow(value: string, id: string): BoxShadow | undefined {\n\tconst shadow = parseValue(value, 0)\n\tif (shadow.color === \"transparent\" || shadow.color === \"rgba(0, 0, 0, 0)\") return undefined\n\tif (shadow.x === 0 && shadow.y === 0 && shadow.spread === 0 && shadow.blur === 0) return undefined\n\tconst color = Color(shadow.color)\n\tif (!color || color.a <= 0) return undefined\n\treturn { ...shadow, id }\n}\n\nexport function parseBoxShadows(value: string): BoxShadow[] {\n\treturn value\n\t\t.split(VALUES_REG)\n\t\t.map(parseValue)\n\t\t.filter(shadow => {\n\t\t\tif (shadow.color === \"transparent\" || shadow.color === \"rgba(0, 0, 0, 0)\") return false\n\t\t\tif (shadow.x === 0 && shadow.y === 0 && shadow.spread === 0 && shadow.blur === 0) return false\n\t\t\tconst color = Color(shadow.color)\n\t\t\tif (!color) return false\n\t\t\treturn color.a > 0\n\t\t})\n}\n\ninterface WithoutDynamicBoxShadow extends WithBoxShadow {\n\tboxShadows: readonly BoxShadow[] | undefined\n}\n\nexport function parseBoxShadowsFromStyle(style: CSSStyleDeclaration): WithoutDynamicBoxShadow | undefined {\n\tconst value = style.boxShadow\n\tif (!value || value === \"none\") return\n\n\treturn {\n\t\tboxShadows: parseBoxShadows(value),\n\t}\n}\n", "import { BoxShadow as LibraryBoxShadow } from \"library/render/types/Shadow.ts\"\nimport { isArray, isString } from \"utils/typeChecks.ts\"\nimport type { DynamicValue } from \"../CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"../CanvasTree/traits/DynamicValue.ts\"\nimport { parseBoxShadows } from \"../CanvasTree/traits/utils/parseBoxShadowFromStyle.ts\"\nimport type { BoxShadow } from \"../Shadow.ts\"\nimport { createBoxShadow, isBoxShadowList } from \"../Shadow.ts\"\n\n/**\n * Box shadows can be defined as an array of BoxShadow objects, a string or a DynamicValue.\n * This function will return the array of BoxShadow objects if the input is valid, otherwise it will return undefined.\n * @param shadows - The input to parse.\n * @returns An array of BoxShadow objects or undefined.\n */\nexport function getBoxShadow(shadows: unknown): readonly BoxShadow[] | DynamicValue {\n\tif (isBoxShadowList(shadows)) return shadows\n\tif (isDynamicValue(shadows)) return shadows\n\n\treturn []\n}\n\nexport function getBoxShadowFromControlDefault(value: unknown): readonly BoxShadow[] {\n\tif (isString(value)) {\n\t\tconst parsedBoxShadows = parseBoxShadows(value)\n\t\treturn parsedBoxShadows\n\t}\n\n\tif (isArray(value) && value.every(LibraryBoxShadow.is)) {\n\t\treturn value.map((item, index) => createBoxShadow({ ...item, id: `box-shadow-${index}` }))\n\t}\n\n\treturn []\n}\n\nexport function toLibraryBoxShadow(shadow: BoxShadow): LibraryBoxShadow {\n\tconst { id: _id, ...libraryShadow } = shadow\n\treturn libraryShadow\n}\n", "import { isObject } from \"utils/typeChecks.ts\"\nimport type { LocalizedValues } from \"../LocalizedValue.ts\"\n\nexport interface WithControlAltText {\n\talt?: string\n\taltLocalized?: LocalizedValues\n}\n\nconst altKey: keyof WithControlAltText = \"alt\"\n\nexport function withControlAltText(value: unknown): value is WithControlAltText {\n\treturn isObject(value) && altKey in value\n}\n\nconst altLocalizedKey: keyof WithControlAltText = \"altLocalized\"\n\nexport function hasControlAltLocalized<T>(value: T): value is T & Required<WithControlAltText> {\n\treturn isObject(value) && altLocalizedKey in value && Boolean(value[altLocalizedKey])\n}\n", "import type { RelativeNumber } from \"library/render/types/RelativeNumber.ts\"\nimport type { NonUndefinedRecord } from \"utils/NonUndefined.ts\"\nimport { isObject, isString } from \"utils/typeChecks.ts\"\nimport type { OptionalToUndefined } from \"../CanvasTree/traits/utils/OptionalToUndefined.ts\"\n\nexport interface WithControlFocalPoint {\n\tpositionX?: RelativeNumber\n\tpositionY?: RelativeNumber\n}\n\nconst focalPositionXKey: keyof WithControlFocalPoint = \"positionX\"\nconst focalPositionYKey: keyof WithControlFocalPoint = \"positionY\"\n\nexport function withControlFocalPoint(value: unknown): value is WithControlFocalPoint {\n\tif (!isObject(value)) return false\n\treturn focalPositionXKey in value || focalPositionYKey in value\n}\n\nexport function hasControlFocalPoint(\n\tvalue: unknown,\n): value is NonUndefinedRecord<OptionalToUndefined<WithControlFocalPoint>> {\n\tif (!withControlFocalPoint(value)) return false\n\treturn isString(value.positionX) && isString(value.positionY)\n}\n\nconst noControlFocalPoint: WithControlFocalPoint = {}\n\nexport function getControlFocalPosition(value: unknown): WithControlFocalPoint {\n\treturn withControlFocalPoint(value) ? value : noControlFocalPoint\n}\n", "import { titleCase } from \"./titleCase.ts\"\nimport { isUndefined } from \"./typeChecks.ts\"\n\nexport function safeName(name: string | null | undefined): string | null {\n\tif (!name || name.length === 0) return null\n\tif (name.match(/^\\d/u)) {\n\t\tname = \"$\" + name\n\t}\n\tname = name.replace(/^[^A-Z_$]+/i, \"_\").replace(/[^\\w$]+/g, \"_\")\n\tif (name.length === 0) return null\n\treturn name\n}\n\nexport function safeProperty(property: string | null | undefined): string | null {\n\tif (!property || property.length === 0) return null\n\n\t// We used to title case variable titles but we stopped doing that. Because we don't want the\n\t// existing APIs of generated component to break we are title casing the variable name here.\n\tproperty = titleCase(property)\n\n\tif (property.match(/^\\d/u)) {\n\t\tproperty = \"_\" + property\n\t}\n\tproperty = property\n\t\t.split(\" \")\n\t\t.map(part => upperCaseFirstChar(part))\n\t\t.join(\"\")\n\t\t.replace(/^[^A-Z_$]+/i, \"_\")\n\t\t.replace(/[^\\w$]+/g, \"_\")\n\n\tif (property.length === 0) return null\n\treturn lowerCaseFirstChar(property)\n}\n\nexport function safeTagName(name?: string) {\n\tif (!name) return \"UserComponent\"\n\tconst safeTag = name\n\t\t.replace(/^[^a-z_]+|\\W+/gi, \" \")\n\t\t.split(\" \")\n\t\t.map(upperCaseFirstChar)\n\t\t.join(\"\")\n\n\tif (safeTag.length === 0) return \"UserComponent\"\n\n\treturn upperCaseFirstChar(safeTag)\n}\n\nexport function safeComponentName(name: string | null | undefined): string {\n\treturn upperCaseFirstChar(safeName(name) || \"Component\")\n}\n\nexport function upperCaseFirstChar(name: string): string {\n\treturn upperOrLowerCasefirstChar(name, \"upper\")\n}\n\nexport function lowerCaseFirstChar(name: string): string {\n\treturn upperOrLowerCasefirstChar(name, \"lower\")\n}\n\nfunction upperOrLowerCasefirstChar(name: string, type: \"upper\" | \"lower\"): string {\n\tconst first = name[0]\n\tif (isUndefined(first)) return name\n\tconst newFirst = type === \"upper\" ? first.toUpperCase() : first.toLowerCase()\n\tif (first === newFirst) return name\n\treturn newFirst + name.slice(1)\n}\nconst customPropertyPrefix = \"--\"\nexport function camelCaseToCSS(key: string) {\n\t// Assume that css custom property names have already been formatted, and\n\t// don't try to add additional dashes.\n\tif (key.startsWith(customPropertyPrefix)) return key\n\tlet result = \"\"\n\tfor (const char of key) {\n\t\tif (/[a-z]/i.test(char) && char.toUpperCase() === char) {\n\t\t\tresult += `-${char.toLowerCase()}`\n\t\t} else {\n\t\t\tresult += char\n\t\t}\n\t}\n\treturn result\n}\n\nexport function svgAttrToCamelCase(name: string) {\n\tconst idx = name.includes(\":\") ? name.indexOf(\":\") : name.indexOf(\"-\")\n\n\tif (idx !== -1) {\n\t\treturn name.slice(0, idx) + (name[idx + 1]?.toUpperCase() ?? \"\") + name.slice(idx + 2)\n\t}\n\n\treturn name\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { BlendingMode } from \"library/render/traits/Blending.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport type { DynamicValue } from \"./DynamicValue.ts\"\n\nexport const blendingModeValues: readonly BlendingMode[] = [\n\t\"normal\",\n\t\"multiply\",\n\t\"screen\",\n\t\"plus-lighter\",\n\t\"overlay\",\n\t\"darken\",\n\t\"lighten\",\n\t\"color-dodge\",\n\t\"color-burn\",\n\t\"hard-light\",\n\t\"soft-light\",\n\t\"difference\",\n\t\"exclusion\",\n\t\"hue\",\n\t\"saturation\",\n\t\"color\",\n\t\"luminosity\",\n] as const\nexport const defaultBlendingMode: BlendingMode = \"multiply\"\n\nexport interface WithBlending {\n\tblendingMode: BlendingMode | DynamicValue | undefined\n}\n\nexport const blendingDefaults: WithBlending = {\n\tblendingMode: undefined,\n}\n\nconst blendingModeKey: keyof WithBlending = \"blendingMode\"\n\nexport function withBlending<T extends CanvasNode>(node: T): node is T & WithBlending {\n\treturn blendingModeKey in node\n}\n\nconst valueSet = new Set<string>(blendingModeValues)\nexport function isBlendingModeValue(value: unknown): value is BlendingMode {\n\treturn isString(value) && valueSet.has(value)\n}\n", "import { isNumber, isString } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\nimport type { DynamicValue } from \"./DynamicValue.ts\"\n\nexport const gridItemAlignmentOptions = [\"start\", \"center\", \"end\"] as const\nexport type GridItemAlignment = (typeof gridItemAlignmentOptions)[number]\nexport type GridItemColumnSpan = number | \"all\"\n\nexport const gridRowSpanOptions: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]\nexport const gridColumnSpanOptions: GridItemColumnSpan[] = [...gridRowSpanOptions, \"all\"]\n\nexport function getTitleForSpanOption(spanOption: GridItemColumnSpan): string {\n\tif (isNumber(spanOption)) return `Span ${spanOption}`\n\treturn \"Span All\"\n}\n\nexport const gridRowSpanOptionTitles = gridRowSpanOptions.map(getTitleForSpanOption)\nexport const gridColumnSpanOptionTitles = gridColumnSpanOptions.map(getTitleForSpanOption)\n\nexport function isGridItemColumnSpan(value: unknown): value is GridItemColumnSpan {\n\tconst allValue: GridItemColumnSpan = \"all\"\n\tif (value === allValue) return true\n\treturn isNumber(value) && value > 0\n}\n\nexport function isGridItemRowSpan(value: unknown): value is number {\n\treturn isNumber(value) && value > 0\n}\n\nexport function isSupportedGridItemAlignment(alignment: unknown): alignment is GridItemAlignment {\n\tif (!isString(alignment)) return false\n\treturn gridItemAlignmentOptions.includes(alignment as GridItemAlignment)\n}\n\nexport interface WithGridItemLayout {\n\tgridItemHorizontalAlignment: GridItemAlignment | undefined\n\tgridItemVerticalAlignment: GridItemAlignment | undefined\n\tgridItemColumnSpan: GridItemColumnSpan | DynamicValue | undefined\n\t/**\n\t * We don't support \"all\" for row span because that can easily lead to invalid layout. The\n\t * column count is fixed while the min row count is auto calculated based on the content. So if\n\t * every grid item spans all rows that will be invalid as soon as there are more items than\n\t * columns.\n\t */\n\tgridItemRowSpan: number | DynamicValue | undefined\n}\n\nexport const gridItemLayoutDefaults: WithGridItemLayout = {\n\tgridItemHorizontalAlignment: undefined,\n\tgridItemVerticalAlignment: undefined,\n\tgridItemColumnSpan: undefined,\n\tgridItemRowSpan: undefined,\n}\n\nconst key: keyof WithGridItemLayout = \"gridItemHorizontalAlignment\"\n\nexport function withGridItemLayout<N extends CanvasNode>(node: N): node is N & WithGridItemLayout {\n\treturn key in node\n}\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../index.ts\"\nimport { isRichTextNode } from \"../nodes/utils/nodeCheck.ts\"\nimport { type DynamicValue, isDynamicValue } from \"./DynamicValue.ts\"\n\n/**\n * The image rendering values that are supported by the canvas.\n * More details here: https://developer.mozilla.org/en-US/docs/Web/CSS/image-rendering\n *\n * @note \"smooth\" is not supported because it is not supported by most browsers.\n * @note \"crisp-edges\" is not supported because there are not many visual differences between\n * \"pixelated\" and \"crisp-edges\" in our most used browsers.\n */\nexport const allImageRenderingValues = [\"auto\", \"pixelated\"] as const\n\ntype ImageRenderingValues = typeof allImageRenderingValues\nexport type ImageRenderingValue = ImageRenderingValues[number]\n\nexport interface WithImageRendering {\n\timageRendering: ImageRenderingValue | DynamicValue | undefined\n}\n\nexport const imageRenderingDefaults: WithImageRendering = {\n\timageRendering: undefined,\n}\n\nexport const imageRenderingAddedDefaults: WithImageRendering = {\n\timageRendering: \"auto\",\n}\n\nconst key: keyof WithImageRendering = \"imageRendering\"\n\nexport function withImageRendering<T extends CanvasNode>(node: T): node is WithImageRendering & T {\n\tif (isRichTextNode(node) && !isDynamicValue(node.htmlContent)) return false\n\treturn key in node\n}\n\nconst values = new Set<string>(allImageRenderingValues)\nexport function isImageRenderingValue(value: unknown): value is ImageRenderingValue {\n\treturn isString(value) && values.has(value)\n}\n\nexport function toImageRenderingValue(value: unknown): ImageRenderingValue {\n\treturn isImageRenderingValue(value) ? value : \"auto\"\n}\n\nexport function imageRenderingValueToTitle(value: ImageRenderingValue): string {\n\tswitch (value) {\n\t\tcase \"auto\":\n\t\t\treturn Dictionary.Smooth\n\t\tcase \"pixelated\":\n\t\t\treturn Dictionary.Sharp\n\t\tdefault:\n\t\t\treturn Dictionary.Unknown\n\t}\n}\n", "import { shouldBeNever } from \"@framerjs/shared\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { DynamicValue } from \"./DynamicValue.ts\"\n\n/**\n * The order of the overflow values in these lists determines the order in which they appear in the\n * UI. Compatible values should appear next to each other, so that they they look good when\n * incompatible values are disabled in the UI.\n\n * @see OverflowPanel.tsx\n */\nexport const allOverflowValues = [\"clip\", \"visible\", \"hidden\", \"auto\"] as const\n\nconst allClippingOverflowValues = [\"clip\", \"hidden\"] as const\nconst allNonClippingOverflowValues = [\"visible\", \"auto\"] as const\n\nexport type Overflow = (typeof allOverflowValues)[number]\ntype ClippingOverflow = (typeof allClippingOverflowValues)[number]\ntype NonClippingOverflow = (typeof allNonClippingOverflowValues)[number]\n\nexport interface KeyToOptionsMap {\n\toverflow: Overflow\n\toverflowX: Overflow\n\toverflowY: Overflow\n}\n\nexport interface WithOverflow {\n\toverflow: Overflow | DynamicValue | undefined\n\toverflowX: Overflow | DynamicValue | undefined\n\toverflowY: Overflow | DynamicValue | undefined\n}\n\nexport type AxisOverflowKeys = keyof Pick<WithOverflow, \"overflowX\" | \"overflowY\">\n\n/**\n * If the value is undefined, it will be assumed to be \"visible\" in the property\n * panel, and when collected for rendering or code generation. However, there\n * are many places where we set an explicit initial value based on where a node\n * is created. For example, creating a ground node results in a node with\n * overflow explicitly set to \"hidden\". Otherwise a node created via the canvas\n * as a non-ground node has it's overflow explicitly set to \"visible\", see:\n * src/app/vekter/src/document/components/tools/CreateFrame.tsx\n */\nexport const overflowDefaults: WithOverflow = {\n\toverflow: undefined,\n\toverflowX: undefined,\n\toverflowY: undefined,\n}\n\nconst overflowKey = \"overflow\" satisfies keyof WithOverflow\nexport const allOverflowKeys = [overflowKey, \"overflowX\", \"overflowY\"] as const satisfies (keyof WithOverflow)[]\nexport function withOverflow<T extends CanvasNode>(node: T | null | undefined): node is T & WithOverflow {\n\tif (!node) return false\n\t// Checking one key is enough, but all keys are expected to be present\n\treturn overflowKey in node\n}\n\nconst overflowValuesSet = new Set<string>(allOverflowValues)\nexport function isOverflowValue(value: unknown): value is Overflow {\n\tif (!isString(value)) return false\n\treturn overflowValuesSet.has(value)\n}\n\nconst clippingOverflowValues = new Set<string>(allClippingOverflowValues)\nexport function isClippingOverflowValue(value: unknown): value is ClippingOverflow {\n\treturn isString(value) && clippingOverflowValues.has(value)\n}\n\nconst nonClippingOverflowValues = new Set<string>(allNonClippingOverflowValues)\nexport function isNonClippingOverflowValue(value: unknown): value is NonClippingOverflow {\n\treturn isString(value) && nonClippingOverflowValues.has(value)\n}\n\nexport function titleForOverflowOption(option: string): string {\n\tif (option === \"auto\") return \"Scroll\"\n\treturn titleCase(option)\n}\n\n/**\n * Used for things like:\n * - Exporting a node as an image in the Desktop version of Framer.\n *\n * It assumes that we prevent \"incompatible\" (@link{compatibleOverflowCombinations}) static axis\n * overflow values from being selected in the UI, and also that incompatible dynamic axis overflow\n * values are stripped out in @link{toAxisOverflow}. It needs to be kept in sync with both.\n *\n * We resolve dynamic values, because we are interested in what the node looks like in the canvas/preview.\n *\n * @returns true if the node is guaranteed not to visually overflow its bounding box, false\n * otherwise.\n */\nexport function isOverflowVisuallyHidden(node: CanvasNode): node is CanvasNode & WithOverflow {\n\tif (!withOverflow(node)) return false\n\n\tconst overflow = node.resolveValue(\"overflow\")\n\n\tswitch (overflow) {\n\t\t// If hidden/auto: \"visible\" is not allowed in the axis overflows, so return true.\n\t\tcase \"hidden\":\n\t\tcase \"auto\":\n\t\t\treturn true\n\t\t// If visible or undefined: it is only guaranteed to be visually hidden if both axis overflows are clip.\n\t\tcase \"visible\":\n\t\tcase undefined:\n\t\t\treturn node.resolveValue(\"overflowX\") === \"clip\" && node.resolveValue(\"overflowY\") === \"clip\"\n\t\t// If clip: return true unless any of the axis overflows are \"visible\".\n\t\tcase \"clip\":\n\t\t\tif (node.resolveValue(\"overflowX\") === \"visible\") return false\n\t\t\tif (node.resolveValue(\"overflowY\") === \"visible\") return false\n\t\t\treturn true\n\t\tdefault:\n\t\t\t// NOTE: this should never happen\n\t\t\t// TODO: find out why this is happening with overflow === true\n\t\t\t// @see https://framer-team.slack.com/archives/C083WMT1ESC/p1757049884158449\n\t\t\t// return assertNever(overflow)\n\t\t\tshouldBeNever(overflow)\n\t\t\treturn false\n\t}\n}\n\nexport function isAnyOverflowAuto(node: CanvasNode): node is CanvasNode & WithOverflow {\n\tif (!withOverflow(node)) return false\n\n\treturn node.overflow === \"auto\" || node.overflowX === \"auto\" || node.overflowY === \"auto\"\n}\n\n/**\n * Overflow values that allow scroll and create a new formatting context (auto, hidden) cannot be\n * combined in different axes with values that don't allow scroll (visible, clip).\n *\n * If that happens, the browser computes non scrollable overflows (visible/clip) to the scrollable\n * counterparts (auto/hidden).\n *\n * compatibleOverflowCounterparts describes this relationship and allows us to go from a clipping to\n * a non-clipping overflow and vice versa, all while keeping the values compatible, in the sense\n * that both either create, or not, a new formatting context.\n *\n * Note: \"hidden\" is not scrollable manually, but can be scrolled programmatically.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-x#formal_definition\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_display/Block_formatting_context\n */\nexport const compatibleOverflowCounterpart = {\n\tvisible: \"clip\",\n\tclip: \"visible\",\n\tauto: \"hidden\",\n\thidden: \"auto\",\n} as const satisfies Record<Overflow, Overflow>\n\n/**\n * When adding an overflow[X|Y] style to a node, we try to default its value to be compatible with\n * other existing overflow values on that node. Compatible means that scrollable overflows shouldn't\n * get combined with non-scrollable overflows.\n *\n * @param node - The node to get a compatible overflow value for.\n * @param compatibleWith - The most important existing overflow value on the node. e.g. overflow,\n * overflowX or overflowY.\n * @param orCompatibleWith - The second most important existing overflow value on the node. Used in\n * case compatibleWith is undefined.\n * @returns The most likely compatible overflow value, or if there are no existing overflows, the\n * default clipping overflow.\n */\nexport function getOverflowCompatibleWith(\n\tnode: CanvasNode & WithOverflow,\n\tcompatibleWith: keyof WithOverflow,\n\torCompatibleWith: keyof WithOverflow,\n\toptions: {\n\t\tpreferSame?: boolean\n\t} = {},\n): Overflow {\n\tconst existingOverflow: Overflow | undefined =\n\t\tnode.resolveValue(compatibleWith) || node.resolveValue(orCompatibleWith)\n\n\tif (existingOverflow) {\n\t\treturn options.preferSame ? existingOverflow : compatibleOverflowCounterpart[existingOverflow]\n\t}\n\t// If for some reason there is no overflow already set, we use the default clipping overflow.\n\treturn \"clip\"\n}\n\n/**\n * Checks if an axis overflow is compatible with the main overflow without causing the browser to\n * automatically convert the non-scrollable overflow values to the scrollable counterparts.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-x#formal_definition\n */\nexport function isAxisOverflowCompatible(overflow: Overflow | undefined, axisOverflow: Overflow | undefined): boolean {\n\t// An overflow value is always compatible with itself.\n\tif (overflow === axisOverflow) return true\n\t// Undefined axis overflows are always compatible with any overflow value because they have no effect.\n\tif (isUndefined(axisOverflow)) return true\n\t// If the overflow is undefined, we consider it to be \"visible\" as computed by the browser.\n\tif (isUndefined(overflow)) overflow = \"visible\"\n\t// Otherwise, they must be compatible counterparts.\n\treturn compatibleOverflowCounterpart[overflow] === axisOverflow\n}\n", "import { isString } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\nimport type { DynamicValue } from \"./DynamicValue.ts\"\n\nexport const allOverscrollBehaviorValues = [\"contain\", \"none\"] as const\n\nexport type OverscrollBehavior = (typeof allOverscrollBehaviorValues)[number]\n\nexport interface WithOverscrollBehavior {\n\t// undefined values are equivalent to \"auto\"\n\toverscrollBehavior: OverscrollBehavior | DynamicValue | undefined\n}\n\nexport const overscrollBehaviorDefaults: WithOverscrollBehavior = {\n\toverscrollBehavior: undefined,\n}\n\nconst key: keyof WithOverscrollBehavior = \"overscrollBehavior\"\nexport function withOverscrollBehavior(\n\tnode: CanvasNode | null | undefined,\n): node is CanvasNode & WithOverscrollBehavior {\n\tif (!node) return false\n\treturn key in node\n}\n\nexport function isOverscrollBehavior(value: unknown): value is OverscrollBehavior {\n\treturn isString(value) && (value === \"contain\" || value === \"none\")\n}\n\nexport const overscrollBehaviorAddedDefaults: WithOverscrollBehavior = {\n\toverscrollBehavior: \"contain\",\n}\n", "import { isString } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../index.ts\"\nimport type { DynamicValue } from \"./DynamicValue.ts\"\n\n/**\n * Pointer Events brought by the `WithPointerEvents` trait should only be\n * applicable in the scope of a published site.\n */\n\n/** Tuple containing internally available values for CSS `pointer-events`  */\nexport const pointerEventsValues = [\"none\", \"auto\"] as const\n\nexport type PointerEventsValue = (typeof pointerEventsValues)[number]\n\nexport interface WithPointerEvents {\n\tpointerEvents: PointerEventsValue | DynamicValue | undefined\n}\n\nexport const pointerEventsDefaults: WithPointerEvents = {\n\tpointerEvents: undefined,\n}\n\nexport const pointerEventsAddedDefaults: WithPointerEvents = {\n\tpointerEvents: \"none\",\n}\n\nconst key: keyof WithPointerEvents = \"pointerEvents\"\n\nexport function withPointerEvents<T extends CanvasNode>(node: T): node is T & WithPointerEvents {\n\treturn key in node\n}\n\nconst values = new Set<string>(pointerEventsValues)\nexport function hasPointerEvents<T extends CanvasNode>(\n\tnode: T & WithPointerEvents,\n): node is T & WithPointerEvents & { pointerEvents: PointerEventsValue } {\n\treturn isString(node.pointerEvents) && values.has(node.pointerEvents)\n}\n\nexport function isPointerEventsValue(value: unknown): value is PointerEventsValue {\n\treturn isString(value) && values.has(value)\n}\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\nimport type { DynamicValue } from \"./DynamicValue.ts\"\nimport { withLayout } from \"./WithLayout.ts\"\n\nexport type TickerEffectDirectionModifier = \"default\" | \"reverse\"\nexport const allTickerEffectDirectionModifiers = [\n\t\"default\",\n\t\"reverse\",\n] as const satisfies TickerEffectDirectionModifier[]\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- needs to extend Record<string, unknown>\nexport type WithTickerEffect = {\n\ttickerEffectEnabled: boolean | undefined\n\ttickerEffectVelocity: number | DynamicValue | undefined\n\ttickerEffectHoverModifier: number | DynamicValue | undefined\n\ttickerEffectDirectionModifier: TickerEffectDirectionModifier | DynamicValue | undefined\n\ttickerEffectDraggable: boolean | DynamicValue | undefined\n}\n\nexport const tickerEffectDefaults: WithTickerEffect = {\n\ttickerEffectEnabled: undefined,\n\ttickerEffectVelocity: undefined,\n\ttickerEffectHoverModifier: undefined,\n\ttickerEffectDirectionModifier: undefined,\n\ttickerEffectDraggable: undefined,\n}\n\nexport const tickerEffectEnabledDefaults = {\n\ttickerEffectEnabled: true,\n\ttickerEffectVelocity: 100,\n\ttickerEffectHoverModifier: 100,\n\ttickerEffectDirectionModifier: \"default\",\n\ttickerEffectDraggable: false,\n} as const satisfies WithTickerEffect\n\nconst key: keyof WithTickerEffect = \"tickerEffectEnabled\"\n\nexport function withTickerEffect<T extends CanvasNode>(node: T): node is T & WithTickerEffect {\n\treturn key in node\n}\n\nexport function hasTickerEffect<T extends CanvasNode>(\n\tnode: T,\n): node is T & WithTickerEffect & { tickerEffectEnabled: true } {\n\treturn supportsTickerEffect(node) && node.tickerEffectEnabled === true\n}\n\nexport function supportsTickerEffect<T extends CanvasNode>(node: T): node is T & WithTickerEffect {\n\tif (!withTickerEffect(node)) return false\n\tif (!withLayout(node) || node.layout !== \"stack\") return false\n\tif (isNodeInTickerEffect(node)) return false\n\tif (node.stackWrapEnabled) return false\n\n\treturn true\n}\n\n/** If the node is a descendant of a ticker effect node. */\nexport function isNodeInTickerEffect(node: CanvasNode): boolean {\n\treturn !!node.cache.tickerAncestorId\n}\n\n/**\n * If the node is a direct child of a ticker effect node.\n */\nexport function isNodeTickerItem(node: CanvasNode): boolean {\n\treturn Boolean(node.cache.tickerAncestorId && node.parentid === node.cache.tickerAncestorId)\n}\n\nexport function isTickerEffectDirectionModifier(value: unknown): value is \"default\" | \"reverse\" {\n\treturn value === \"default\" || value === \"reverse\"\n}\n\nexport function tickerDirectionModifierToTitle(value: TickerEffectDirectionModifier): string {\n\tswitch (value) {\n\t\tcase \"default\":\n\t\t\treturn Dictionary.Default\n\t\tcase \"reverse\":\n\t\t\treturn Dictionary.Reverse\n\t}\n}\n", "import { isString } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../index.ts\"\nimport type { DynamicValue } from \"./DynamicValue.ts\"\n\n/**\n * User select brought by the `WithUserSelect` trait should only be\n * applicable in the scope of a published site.\n */\n\n/** Internally available values for `user-select`  */\nexport const allUserSelectValues = [\"none\", \"auto\"] as const\n\ntype UserSelectValues = typeof allUserSelectValues\nexport type UserSelectValue = UserSelectValues[number]\n\nexport interface WithUserSelect {\n\tuserSelect: UserSelectValue | DynamicValue | undefined\n}\n\nexport const userSelectDefaults: WithUserSelect = {\n\tuserSelect: undefined,\n}\n\nexport const userSelectAddedDefaults: WithUserSelect = {\n\tuserSelect: \"none\",\n}\n\nconst key: keyof WithUserSelect = \"userSelect\"\n\nexport function withUserSelect<T extends CanvasNode>(node: T): node is WithUserSelect & T {\n\treturn key in node\n}\n\nconst values = new Set<string>(allUserSelectValues)\nexport function hasUserSelect<T extends CanvasNode & WithUserSelect>(\n\tnode: T,\n): node is T & { userSelect: UserSelectValue } {\n\treturn isString(node.userSelect) && values.has(node.userSelect)\n}\n\nexport function isUserSelectValue(value: unknown): value is UserSelectValue {\n\treturn isString(value) && values.has(value)\n}\n", "import { isString } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport { type DynamicValue, isDynamicValue } from \"../DynamicValue.ts\"\n\nexport const inputTypes = [\"text\", \"textarea\", \"email\", \"number\", \"tel\", \"url\", \"date\", \"time\"] as const\n\n/**\n * InputType represents all of the HTML5 input types that are supported by the\n * FormPlainTextInputNode.\n */\nexport type InputType = (typeof inputTypes)[number]\n\nconst inputTypeTitles: Record<InputType, string> = {\n\ttext: \"Text\",\n\ttextarea: \"Text Area\",\n\tnumber: \"Number\",\n\temail: \"Email\",\n\ttel: \"Phone Number\",\n\turl: \"URL\",\n\tdate: \"Date\",\n\ttime: \"Time\",\n}\n\nexport function isTextInputType(value: unknown): value is InputType {\n\treturn isString(value) && value in inputTypeTitles\n}\n\nexport function titleForTextInputTypeOption(option: string): string {\n\tif (!isTextInputType(option)) return \"Text\"\n\treturn inputTypeTitles[option]\n}\n\n/**\n * some inputs have icons by default, even without icon image provided\n */\nexport function inputHasDefaultIcon(type: InputType | DynamicValue | undefined): boolean {\n\t// we allow passing in components with dynamic \"type\" property,\n\t// but as icon rendering is enforced through CSS, it is not a big problem.\n\treturn isDynamicValue(type) || type === \"date\" || type === \"time\"\n}\n\nexport function inputCanHaveLeftPositionedIcon(type: InputType | DynamicValue | undefined): boolean {\n\treturn isDynamicValue(type) || type === \"text\"\n}\n\n/**\n * Trait that represents the type of the input element.\n * Only relevant for <input> elements.\n */\nexport interface WithFormTextInputType {\n\t/**\n\t * The type for the input element. Defaults to \"text\".\n\t */\n\tformTextInputType: InputType | DynamicValue | undefined\n\n\t/**\n\t * Whether the textarea should be user-resizable.\n\t * Only vertical resizing is supported currently (e.g. resize: vertical; in CSS-land).\n\t */\n\tformTextAreaResizable: boolean | DynamicValue | undefined\n\t/**\n\t * formTextInputMinNumber, and formTextInputMaxNumber specify the min and\n\t * max attributes of an input when it is type=\"number\", but not \"date\".\n\t */\n\tformTextInputMinNumber: number | DynamicValue | undefined\n\tformTextInputMaxNumber: number | DynamicValue | undefined\n\t/**\n\t * formInputMaxLength specifies max number of characters\n\t * on the text area and input elements\n\t */\n\tformInputMaxLength: number | DynamicValue | undefined\n}\n\nconst typeKey: keyof WithFormTextInputType = \"formTextInputType\"\n\nexport function withFormTextInputType<T extends CanvasNode>(node: T): node is T & WithFormTextInputType {\n\treturn typeKey in node\n}\n\nexport const formInputTypeDefaults: WithFormTextInputType = {\n\tformTextInputType: undefined,\n\tformTextAreaResizable: undefined,\n\tformTextInputMinNumber: undefined,\n\tformTextInputMaxNumber: undefined,\n\tformInputMaxLength: undefined,\n}\n\nexport function isFormTextAreaInput<T extends CanvasNode>(\n\tnode: T,\n): node is T & WithFormTextInputType & { formInputType: \"textArea\" } {\n\treturn withFormTextInputType(node) && node.formTextInputType === \"textarea\"\n}\n", "import type { VerifiedControlDescription } from \"@framerjs/framer-runtime\"\nimport { assert } from \"@framerjs/shared\"\nimport { ControlType, toFlexDirection } from \"library/index.ts\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport type { WithBlending } from \"../traits/WithBlending.ts\"\nimport { blendingModeValues } from \"../traits/WithBlending.ts\"\nimport {\n\ttype WithGridItemLayout,\n\tgridColumnSpanOptionTitles,\n\tgridColumnSpanOptions,\n\tgridRowSpanOptionTitles,\n\tgridRowSpanOptions,\n} from \"../traits/WithGridItemLayout.ts\"\nimport {\n\ttype ImageRenderingValue,\n\ttype WithImageRendering,\n\tallImageRenderingValues,\n\timageRenderingValueToTitle,\n} from \"../traits/WithImageRendering.ts\"\nimport type { WithLayout } from \"../traits/WithLayout.ts\"\nimport {\n\tdefaultStackAlignment,\n\tdefaultStackDirection,\n\tdefaultStackDistribution,\n\tstackAlignments,\n\tstackDirections,\n\tstackDistributions,\n\ttoFlexAlign,\n\ttoFlexJustify,\n} from \"../traits/WithLayout.ts\"\nimport type { WithOpacity } from \"../traits/WithOpacity.ts\"\nimport type { WithOverflow } from \"../traits/WithOverflow.ts\"\nimport { allOverflowValues, titleForOverflowOption } from \"../traits/WithOverflow.ts\"\nimport type { WithOverscrollBehavior } from \"../traits/WithOverscrollBehavior.ts\"\nimport { allOverscrollBehaviorValues } from \"../traits/WithOverscrollBehavior.ts\"\nimport type { WithPadding } from \"../traits/WithPadding.ts\"\nimport type { WithPointerEvents } from \"../traits/WithPointerEvents.ts\"\nimport { pointerEventsValues } from \"../traits/WithPointerEvents.ts\"\nimport type { WithRadius } from \"../traits/WithRadius.ts\"\nimport type { WithTabIndex } from \"../traits/WithTabIndex.ts\"\nimport {\n\ttype TickerEffectDirectionModifier,\n\ttype WithTickerEffect,\n\tallTickerEffectDirectionModifiers,\n\ttickerDirectionModifierToTitle,\n} from \"../traits/WithTickerEffect.ts\"\nimport type { WithUserSelect } from \"../traits/WithUserSelect.ts\"\nimport { allUserSelectValues } from \"../traits/WithUserSelect.ts\"\nimport type { WithFormTextInputType } from \"../traits/forms/WithTextInputType.ts\"\nimport { inputTypes, titleForTextInputTypeOption } from \"../traits/forms/WithTextInputType.ts\"\n\nexport const nodePropertyDefinitionEntityIdentifier = \"framer/nodePropertyDefinitions\"\nexport type NodePropertyControlKey =\n\t| keyof Pick<WithBlending, \"blendingMode\">\n\t| keyof Pick<WithUserSelect, \"userSelect\">\n\t| keyof Pick<WithImageRendering, \"imageRendering\">\n\t| keyof Pick<WithPointerEvents, \"pointerEvents\">\n\t| keyof Pick<WithOverscrollBehavior, \"overscrollBehavior\">\n\t| keyof Pick<WithOverflow, \"overflow\">\n\t| keyof Pick<WithFormTextInputType, \"formTextInputType\">\n\t| keyof Pick<WithLayout, \"stackDirection\" | \"stackDistribution\" | \"stackAlignment\" | \"gap\">\n\t| keyof Pick<WithGridItemLayout, \"gridItemColumnSpan\" | \"gridItemRowSpan\">\n\t| keyof Pick<WithOpacity, \"opacity\">\n\t| keyof Pick<WithPadding, \"padding\">\n\t| keyof Pick<WithRadius, \"radius\">\n\t| keyof Pick<WithTabIndex, \"tabIndex\">\n\t| keyof Pick<WithTickerEffect, \"tickerEffectDirectionModifier\">\n\n/**\n * Property control definitions for our first-class node properties. The enum controls are used for\n * control references, (see NodePropertyControlReferenceVariableDefinition), which will be rendered\n * using the definitions here. And some of the other controls are used to make the computed value\n * popout inputs behave as expected. For example by showing the correct number ranges for opacity.\n */\nconst nodePropertyControlDefinitions = {\n\tstackDirection: {\n\t\ttype: ControlType.Enum,\n\t\tdefaultValue: toFlexDirection(defaultStackDirection),\n\t\toptions: stackDirections.map(toFlexDirection), // variables already use the flex values\n\t\toptionTitles: stackDirections.map(titleCase),\n\t\tdisplaySegmentedControl: true,\n\t\toptionIcons: [\"direction-horizontal\", \"direction-vertical\"],\n\t},\n\tstackDistribution: {\n\t\ttype: ControlType.Enum,\n\t\tdefaultValue: toFlexJustify(defaultStackDistribution),\n\t\toptions: stackDistributions.map(toFlexJustify),\n\t\toptionTitles: stackDistributions.map(titleCase),\n\t},\n\tstackAlignment: {\n\t\ttype: ControlType.Enum,\n\t\tdefaultValue: toFlexJustify(defaultStackAlignment),\n\t\toptions: stackAlignments.map(toFlexAlign),\n\t\toptionTitles: stackAlignments.map(titleCase),\n\t},\n\tgridItemColumnSpan: {\n\t\ttype: ControlType.Enum,\n\t\tdefaultValue: 1,\n\t\toptions: gridColumnSpanOptions,\n\t\toptionTitles: gridColumnSpanOptionTitles,\n\t},\n\tgridItemRowSpan: {\n\t\ttype: ControlType.Enum,\n\t\tdefaultValue: 1,\n\t\toptions: gridRowSpanOptions,\n\t\toptionTitles: gridRowSpanOptionTitles,\n\t},\n\tuserSelect: {\n\t\ttype: ControlType.Enum,\n\t\tdefaultValue: \"auto\",\n\t\toptions: allUserSelectValues.map(value => value),\n\t\toptionTitles: allUserSelectValues.map(titleCase),\n\t},\n\toverscrollBehavior: {\n\t\ttype: ControlType.Enum,\n\t\tdefaultValue: \"none\",\n\t\toptions: allOverscrollBehaviorValues.map(value => value),\n\t\toptionTitles: allOverscrollBehaviorValues.map(titleCase),\n\t},\n\toverflow: {\n\t\ttype: ControlType.Enum,\n\t\tdefaultValue: \"auto\",\n\t\toptions: allOverflowValues.map(value => value),\n\t\toptionTitles: allOverflowValues.map(titleForOverflowOption),\n\t},\n\tpointerEvents: {\n\t\ttype: ControlType.Enum,\n\t\tdefaultValue: \"auto\",\n\t\toptions: pointerEventsValues.map(value => value),\n\t\toptionTitles: pointerEventsValues.map(titleCase),\n\t},\n\tblendingMode: {\n\t\ttype: ControlType.Enum,\n\t\tdefaultValue: \"multiply\",\n\t\toptions: blendingModeValues.map(value => value),\n\t\toptionTitles: blendingModeValues.map(titleCase),\n\t},\n\tformTextInputType: {\n\t\ttype: ControlType.Enum,\n\t\tdefaultValue: \"text\",\n\t\toptions: [...inputTypes],\n\t\toptionTitles: inputTypes.map(titleForTextInputTypeOption),\n\t},\n\timageRendering: {\n\t\ttype: ControlType.Enum,\n\t\tdefaultValue: \"auto\" satisfies ImageRenderingValue,\n\t\tdisplaySegmentedControl: true,\n\t\toptions: [...allImageRenderingValues],\n\t\toptionTitles: allImageRenderingValues.map(imageRenderingValueToTitle),\n\t},\n\topacity: {\n\t\ttype: ControlType.Number,\n\t\tmin: 0,\n\t\tmax: 1,\n\t\tstep: 0.01,\n\t\tdefaultValue: 1,\n\t\tdisplayStepper: false,\n\t},\n\tgap: {\n\t\ttype: ControlType.Gap,\n\t},\n\tpadding: {\n\t\ttype: ControlType.Padding,\n\t},\n\tradius: {\n\t\ttype: ControlType.BorderRadius,\n\t},\n\ttabIndex: {\n\t\ttype: ControlType.Number,\n\t\tmin: -1,\n\t\tmax: 5,\n\t\tstep: 1,\n\t\tdefaultValue: 0,\n\t\tdisplayStepper: true,\n\t},\n\ttickerEffectDirectionModifier: {\n\t\ttype: ControlType.Enum,\n\t\tdefaultValue: \"default\" satisfies TickerEffectDirectionModifier,\n\t\tdisplaySegmentedControl: true,\n\t\toptions: allTickerEffectDirectionModifiers,\n\t\toptionTitles: allTickerEffectDirectionModifiers.map(tickerDirectionModifierToTitle),\n\t},\n} as const satisfies Record<NodePropertyControlKey, VerifiedControlDescription>\n\nexport function isNodePropertyControlKey(key: PropertyKey): key is NodePropertyControlKey {\n\treturn Object.hasOwn(nodePropertyControlDefinitions, key)\n}\n\nexport function getNodePropertyControlDescription(key: NodePropertyControlKey): VerifiedControlDescription {\n\tconst description = nodePropertyControlDefinitions[key]\n\tassert(description, \"unknown node property control\", key)\n\treturn description\n}\n", "import type { Transition } from \"document/models/Transition.ts\"\nimport { fallbackPhysicsBasedSpringTransition } from \"document/models/Transition.ts\"\nimport { borderValueDefaults } from \"document/models/controlProps/BorderControlPropValue.ts\"\nimport type { StaticArrayControlPropValue } from \"document/models/controlProps/ControlProp.ts\"\nimport { isFusedNumberControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport { isRawControlProp } from \"document/models/controlProps/RawControlProp.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isArray, isNumber, isObject } from \"utils/typeChecks.ts\"\nimport type { FourPixelNumberShorthand, RelativeOrFourPixelNumberShorthand } from \"../NumberShorthand.ts\"\nimport type { BorderValues } from \"../WithBorder.ts\"\n\nexport function getControlPropsValues(controlProps: Record<string, unknown>): { [key: string]: unknown } {\n\tconst result = {} as { [key: string]: unknown }\n\tfor (const key in controlProps) {\n\t\tconst prop = controlProps[key]\n\t\tif (!isRawControlProp(prop)) continue\n\t\tif (prop.type === ControlType.FusedNumber) {\n\t\t\tif (isNumber(prop.value)) {\n\t\t\t\tresult[key] = prop.value\n\t\t\t} else if (isFusedNumberControlProp(prop)) {\n\t\t\t\tresult[key] = prop.value.single\n\t\t\t}\n\t\t} else if (prop.type === ControlType.Object && isObject(prop.value)) {\n\t\t\tif (!isObject(prop.value)) continue\n\t\t\tresult[key] = getControlPropsValues(prop.value)\n\t\t} else if (prop.type === ControlType.Array && isArray(prop.value)) {\n\t\t\tresult[key] = prop.value.filter(isRawControlProp).map(arrayItem => {\n\t\t\t\tif (arrayItem.type === ControlType.Object) {\n\t\t\t\t\tif (!isObject(arrayItem.value)) return\n\t\t\t\t\treturn getControlPropsValues(arrayItem.value)\n\t\t\t\t}\n\t\t\t\treturn arrayItem.value\n\t\t\t})\n\t\t} else {\n\t\t\tresult[key] = prop.value\n\t\t}\n\t}\n\treturn result\n}\n\nexport function getFallbackValue(type: ControlType.Boolean): boolean\nexport function getFallbackValue(type: ControlType.Number): number\nexport function getFallbackValue(type: ControlType.String): string\nexport function getFallbackValue(type: ControlType.RichText): string\nexport function getFallbackValue(type: ControlType.Color): string\nexport function getFallbackValue(type: ControlType.Transition): Transition\nexport function getFallbackValue(type: ControlType.Border): BorderValues\nexport function getFallbackValue(type: ControlType.BoxShadow): undefined\nexport function getFallbackValue(type: ControlType.Image): undefined\nexport function getFallbackValue(type: ControlType.EventHandler): undefined\nexport function getFallbackValue(type: ControlType.Link): string\nexport function getFallbackValue(type: ControlType.Padding): FourPixelNumberShorthand\nexport function getFallbackValue(type: ControlType.BorderRadius): RelativeOrFourPixelNumberShorthand\nexport function getFallbackValue(type: ControlType.CollectionReference): undefined\nexport function getFallbackValue(type: ControlType.MultiCollectionReference): undefined\nexport function getFallbackValue(type: ControlType.Array): StaticArrayControlPropValue\nexport function getFallbackValue(type: ControlType.Date): undefined\nexport function getFallbackValue(type: ControlType.Enum): undefined\nexport function getFallbackValue(type: ControlType.File): undefined\nexport function getFallbackValue(type: ControlType): unknown\nexport function getFallbackValue(type: ControlType): unknown {\n\tswitch (type) {\n\t\tcase ControlType.Boolean:\n\t\t\treturn true\n\t\tcase ControlType.Number:\n\t\t\treturn 0\n\t\tcase ControlType.String:\n\t\tcase ControlType.Link:\n\t\t\treturn \"\"\n\t\tcase ControlType.RichText:\n\t\t\treturn \"\"\n\t\tcase ControlType.Color:\n\t\t\treturn \"#09F\"\n\t\tcase ControlType.FusedNumber:\n\t\t\treturn { single: 0, fused: [0, 0, 0, 0] }\n\t\tcase ControlType.Transition:\n\t\t\treturn fallbackPhysicsBasedSpringTransition\n\t\tcase ControlType.Border:\n\t\t\treturn borderValueDefaults\n\t\tcase ControlType.Object:\n\t\t\treturn {}\n\t\tcase ControlType.Padding:\n\t\tcase ControlType.BorderRadius:\n\t\t\treturn \"0px\"\n\t\tcase ControlType.Array:\n\t\t\treturn []\n\t\tdefault:\n\t\t\treturn undefined\n\t}\n}\n", "import type {\n\tAnyComponentLoader,\n\tVerifiedArrayControlDescription,\n\tVerifiedControlDescription,\n\tVerifiedObjectControlDescription,\n\tVerifiedObjectPropertyControlDescription,\n} from \"@framerjs/framer-runtime\"\nimport type {\n\tDefaultResponsiveImage,\n\tOptionalDefaultAssetReference,\n\tWithOptionalVekterDefault,\n} from \"@framerjs/framer-runtime/sandbox\"\nimport type { GlobalModuleId, ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { assert, isExternalModuleIdentifier, isModuleExportIdentifier, parseModuleIdentifier } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { isValidPropertyValueType } from \"document/components/chrome/properties/codeComponentRows/utils/isValidPropertyValue.ts\"\nimport type {\n\tAnyScopeNode,\n\tCanvasNode,\n\tCanvasTree,\n\tLayoutTemplateNode,\n\tSmartComponentNode,\n} from \"document/models/CanvasTree/index.ts\"\nimport type { ExternalModuleNode } from \"document/models/CanvasTree/nodes/ExternalModuleNode.ts\"\nimport type { VectorSetNode } from \"document/models/CanvasTree/nodes/VectorSetNode.ts\"\nimport type { WebPageNode } from \"document/models/CanvasTree/nodes/WebPageNode.ts\"\nimport type { BorderValues } from \"document/models/CanvasTree/traits/WithBorder.ts\"\nimport type { LocalizedValues } from \"document/models/LocalizedValue.ts\"\nimport type { BoxShadow } from \"document/models/Shadow.ts\"\nimport type { SupportedLinkRelValue } from \"document/models/SupportedRelValue.ts\"\nimport type { Transition } from \"document/models/Transition.ts\"\nimport { toMotionTransition } from \"document/models/Transition.ts\"\nimport { toBorderReactCSSProperties } from \"document/models/controlProps/BorderControlPropValue.ts\"\nimport { toLibraryBoxShadow } from \"document/models/controlProps/BoxShadowControlPropValue.ts\"\nimport type { ImageControlProp, StaticArrayControlPropValue } from \"document/models/controlProps/ControlProp.ts\"\nimport { isRawControlProp } from \"document/models/controlProps/RawControlProp.ts\"\nimport { withControlAltText } from \"document/models/controlProps/WithControlAltText.ts\"\nimport { hasControlFocalPoint } from \"document/models/controlProps/WithControlFocalPoint.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { ConvertColor } from \"library/render/types/Color/index.ts\"\nimport type { Coordinate, Location } from \"library/render/types/PropertyControls.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport type { RelativeNumber } from \"library/render/types/RelativeNumber.ts\"\nimport { assertNever } from \"library/utils/assert.ts\"\nimport { upperCaseFirstChar } from \"utils/names.ts\"\nimport { isBoolean, isNullish, isNumber, isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { ContentType } from \"#framer-plugin/collections.ts\"\nimport { isLayoutTemplateNode, isSmartComponentNode, isVectorSetNode, isWebPageNode } from \"../nodes/utils/nodeCheck.ts\"\nimport type {\n\tNodePropertyControlKey,\n\tnodePropertyDefinitionEntityIdentifier,\n} from \"../utils/nodePropertyControlDefinitions.ts\"\nimport { getNodePropertyControlDescription } from \"../utils/nodePropertyControlDefinitions.ts\"\nimport { isTokenCSSVariable } from \"../utils/tokens.ts\"\nimport { isDynamicValue } from \"./DynamicValue.ts\"\nimport type {\n\tFourPixelNumberShorthand,\n\tRelativeOrFourPixelNumberShorthand,\n\tTwoPixelNumberShorthand,\n} from \"./NumberShorthand.ts\"\nimport type { CSSCursor } from \"./WithCursor.ts\"\nimport type { Link } from \"./utils/Link.ts\"\nimport { getFallbackValue } from \"./utils/codeComponentProps.ts\"\nimport { isVariableType } from \"./utils/isVariableType.ts\"\n\nexport type VariableType =\n\t| ControlType.Array\n\t| ControlType.Boolean\n\t| ControlType.Color\n\t| ControlType.EventHandler\n\t| ControlType.Image\n\t| ControlType.Number\n\t| ControlType.String\n\t| ControlType.RichText\n\t| ControlType.Link\n\t| ControlType.LinkRelValues\n\t| ControlType.Date\n\t| ControlType.Enum\n\t| ControlType.File\n\t| ControlType.ScrollSectionRef\n\t| ControlType.CustomCursor\n\t| ControlType.Cursor\n\t| ControlType.Transition\n\t| ControlType.Border\n\t| ControlType.BoxShadow\n\t| ControlType.Gap\n\t| ControlType.Padding\n\t| ControlType.BorderRadius\n\t| ControlType.CollectionReference\n\t| ControlType.MultiCollectionReference\n\t| ControlType.Location\n\t| ControlType.TrackingId\n\t| ControlType.VectorSetItem\n\t| \"controlReference\"\n\t| \"nodePropertyControlReference\"\n\t| \"slug\"\n\ntype ControlReferenceExpectedType = Exclude<\n\tControlReferenceVariableDefinition[\"expectedType\"],\n\tControlType.SegmentedEnum\n>\n\nexport type CanCreateVariableOptions =\n\t| { type: Exclude<VariableType, \"controlReference\"> }\n\t| { type: \"controlReference\"; expectedType: ControlReferenceExpectedType; entityIdentifier: string }\n\nexport function isControlReferenceExpectedType(type: ControlType): type is ControlReferenceExpectedType {\n\treturn type === ControlType.Enum || type === ControlType.File\n}\n\nexport function variableTypeTitle(type: VariableType): string {\n\tswitch (type) {\n\t\tcase ControlType.EventHandler:\n\t\t\treturn \"Event\"\n\t\tcase ControlType.RichText:\n\t\t\treturn Dictionary.FormattedText\n\t\tcase ControlType.String:\n\t\t\treturn \"Plain Text\"\n\t\tcase ControlType.Boolean:\n\t\t\treturn Dictionary.Toggle\n\t\tcase ControlType.Enum:\n\t\t\treturn Dictionary.Option\n\t\tcase ControlType.Cursor:\n\t\t\treturn Dictionary.Cursor\n\t\tcase ControlType.BoxShadow:\n\t\t\treturn Dictionary.Shadow\n\t\tcase ControlType.BorderRadius:\n\t\t\treturn \"Border Radius\"\n\t\tcase ControlType.ScrollSectionRef:\n\t\t\treturn Dictionary.ScrollSection\n\t\tcase ControlType.Array:\n\t\t\treturn Dictionary.Gallery\n\t\tcase ControlType.LinkRelValues:\n\t\t\treturn Dictionary.LinkRel\n\t\tcase ControlType.Location:\n\t\t\treturn Dictionary.Location\n\t}\n\treturn upperCaseFirstChar(type)\n}\n\ntype VerifiedControlDescriptionType = VerifiedControlDescription[\"type\"]\n\nconst nonVariableControlTypeToVariableType: Record<\n\tExclude<VerifiedControlDescriptionType, VariableType>,\n\tVariableType | null\n> = {\n\t[ControlType.ResponsiveImage]: ControlType.Image,\n\t[ControlType.FusedNumber]: null,\n\t[ControlType.Slot]: null,\n\t[ControlType.ChangeHandler]: null,\n\t[ControlType.Object]: null,\n\t[ControlType.Font]: null,\n\t[ControlType.PageScope]: null,\n}\n\nexport function convertControlTypeToVariableType(type: VerifiedControlDescriptionType): VariableType | null {\n\tif (isVariableType(type)) return type\n\treturn nonVariableControlTypeToVariableType[type]\n}\n\nexport type VariableID = string\n\nconst variableTypesSupportingSorting = [\n\tControlType.String,\n\tControlType.Date,\n\tControlType.Number,\n\tControlType.Enum,\n\tControlType.Boolean,\n\t\"slug\",\n] as const\n\ntype VariableTypeSupportingSorting = (typeof variableTypesSupportingSorting)[number]\n\nexport type VariableSupportingSorting = Extract<VariableDefinition, { type: VariableTypeSupportingSorting }>\n\nexport function variableSupportsSorting(\n\tvariable: VariableDefinition | undefined,\n): variable is VariableSupportingSorting {\n\tif (!variable) return false\n\treturn variableTypesSupportingSorting.includes(variable.type as VariableTypeSupportingSorting)\n}\n\nexport function controlPropSupportsSorting(type: ControlType): boolean {\n\treturn variableTypesSupportingSorting.includes(type as VariableTypeSupportingSorting)\n}\n\nexport type VariableDefinition =\n\t| ArrayVariableDefinition\n\t| BooleanVariableDefinition\n\t| BorderRadiusVariableDefinition\n\t| BorderVariableDefinition\n\t| BoxShadowVariableDefinition\n\t| CollectionReferenceVariableDefinition\n\t| ColorVariableDefinition\n\t| ControlReferenceVariableDefinition\n\t| LocationVariableDefinition\n\t| CursorVariableDefinition\n\t| CustomCursorVariableDefinition\n\t| DateVariableDefinition\n\t| EnumVariableDefinition\n\t| EventHandlerVariableDefinition\n\t| FileVariableDefinition\n\t| ImageVariableDefinition\n\t| LinkVariableDefinition\n\t| LinkRelValuesVariableDefinition\n\t| MultiCollectionReferenceVariableDefinition\n\t| TrackingIdVariableDefinition\n\t| NodePropertyControlReferenceVariableDefinition\n\t| NumberVariableDefinition\n\t| GapVariableDefinition\n\t| PaddingVariableDefinition\n\t| RichTextVariableDefinition\n\t| ScrollSectionRefVariableDefinition\n\t| SlugVariableDefinition\n\t| StringVariableDefinition\n\t| TransitionVariableDefinition\n\t| VectorSetItemVariableDefinition\n\ninterface VariableDefinitionBase {\n\tid: VariableID\n\tname: string\n\ttype: VariableType\n\tinitialValue: unknown\n\tdescription?: string\n\t/** Used by plugins. */\n\texternalId?: string\n\t/** Used by plugins that manage collections. */\n\tuserEditable?: boolean\n\t/** @deprecated unused */\n\texposeInProps?: boolean\n}\n\nexport type ArrayItemVariableDefinition =\n\t| ImageVariableDefinition\n\t| BooleanVariableDefinition\n\t| NumberVariableDefinition\n\t| StringVariableDefinition\n\t| ColorVariableDefinition\n\t| VariableDivider\n\nexport interface ArrayVariableOptions {\n\tminCount?: number\n\tmaxCount?: number\n}\n\nexport interface ArrayVariableDefinition extends VariableDefinitionBase, ArrayVariableOptions, WithRequired {\n\ttype: ControlType.Array\n\titemVariables: readonly ArrayItemVariableDefinition[]\n\tinitialValue: StaticArrayControlPropValue\n}\n\nexport interface BooleanVariableDefinition extends VariableDefinitionBase, WithOptional, WithQueryParam {\n\ttype: ControlType.Boolean\n\tinitialValue: boolean\n\toptions?: BooleanVariableOptions\n}\n\nexport interface ColorVariableDefinition extends VariableDefinitionBase {\n\ttype: ControlType.Color\n\tinitialValue: string\n}\n\nexport interface NumberVariableDefinition extends VariableDefinitionBase, WithOptional, WithQueryParam {\n\ttype: ControlType.Number\n\tinitialValue: number\n\toptions?: NumberVariableOptions\n}\n\nexport interface StringVariableDefinition\n\textends VariableDefinitionBase, WithRequired, WithOptional, WithPreventLocalization, WithQueryParam {\n\ttype: ControlType.String\n\tinitialValue: string\n\toptions?: StringVariableOptions\n\t// Only meant for CMS string variables which can use a sibling string value as the fallback\n\tfallbackValue?: \"initialValue\" | \"associatedVariable\"\n\tassociatedStringVariable?: VariableID | null\n}\n\nexport interface RichTextVariableDefinition extends VariableDefinitionBase, WithRequired, WithPreventLocalization {\n\ttype: ControlType.RichText\n\tinitialValue: string\n\toptions?: RichTextVariableOptions\n\t/** Controls how formatted text content is processed: \"auto\" (detect), \"markdown\", or \"html\" */\n\tcontentType?: ContentType\n}\n\nexport interface EventHandlerVariableDefinition extends VariableDefinitionBase {\n\ttype: ControlType.EventHandler\n}\n\nexport interface ImageVariableDefinition extends VariableDefinitionBase, WithRequired {\n\ttype: ControlType.Image\n\tinitialValue: string | ImageControlProp | undefined\n}\n\nexport interface FileVariableExtension {\n\tid: string\n\t/** @see AllowedFileTypes in PropertyControls */\n\textension: string\n}\n\nexport interface FileVariableDefinition extends VariableDefinitionBase, WithRequired {\n\ttype: ControlType.File\n\tinitialValue: string | undefined\n\tallowedFileTypes: FileVariableExtension[]\n}\n\nexport interface ScrollSectionRefVariableDefinition extends VariableDefinitionBase {\n\ttype: ControlType.ScrollSectionRef\n}\n\nexport interface CustomCursorVariableDefinition extends VariableDefinitionBase {\n\ttype: ControlType.CustomCursor\n}\n\nexport interface CursorVariableDefinition extends VariableDefinitionBase {\n\ttype: ControlType.Cursor\n\tinitialValue: CSSCursor\n}\n\nexport interface TransitionVariableDefinition extends VariableDefinitionBase {\n\ttype: ControlType.Transition\n\tinitialValue: Partial<Transition> | undefined\n}\n\nexport interface BorderVariableDefinition extends VariableDefinitionBase {\n\ttype: ControlType.Border\n\tinitialValue: BorderValues | undefined\n}\n\nexport interface LocationVariableDefinition extends VariableDefinitionBase {\n\ttype: ControlType.Location\n\tinitialValue: Location | undefined\n}\n\nexport interface BoxShadowVariableDefinition extends VariableDefinitionBase {\n\ttype: ControlType.BoxShadow\n\tinitialValue: readonly BoxShadow[]\n}\n\nexport interface GapVariableDefinition extends VariableDefinitionBase {\n\ttype: ControlType.Gap\n\tinitialValue: TwoPixelNumberShorthand\n}\n\nexport interface PaddingVariableDefinition extends VariableDefinitionBase {\n\ttype: ControlType.Padding\n\tinitialValue: FourPixelNumberShorthand\n}\n\nexport interface BorderRadiusVariableDefinition extends VariableDefinitionBase {\n\ttype: ControlType.BorderRadius\n\tinitialValue: RelativeOrFourPixelNumberShorthand\n}\n\nexport interface CollectionReferenceVariableDefinition\n\textends VariableDefinitionBase, WithRequired, WithOptional, WithQueryParam {\n\ttype: ControlType.CollectionReference\n\tdataIdentifier: ModuleExportIdentifierString\n\tinitialValue: string | undefined\n}\n\nexport interface MultiCollectionReferenceVariableDefinition\n\textends VariableDefinitionBase, WithRequired, WithOptional, WithQueryParam {\n\ttype: ControlType.MultiCollectionReference\n\tdataIdentifier: ModuleExportIdentifierString\n\tinitialValue: string[] | undefined\n}\n\nexport interface TrackingIdVariableDefinition extends VariableDefinitionBase {\n\ttype: ControlType.TrackingId\n\tinitialValue: string | undefined\n}\n\nexport interface VectorSetItemVariableInitialValue {\n\tidentifier: ModuleExportIdentifierString\n\tmoduleId: GlobalModuleId\n}\n\nexport interface VectorSetItemVariableDefinition extends VariableDefinitionBase {\n\ttype: ControlType.VectorSetItem\n\tinitialValue: VectorSetItemVariableInitialValue\n\tsetModuleId: GlobalModuleId\n}\n\nexport function isVectorSetItemVariableInitialValue(value: unknown): value is VectorSetItemVariableInitialValue {\n\tif (!isObject(value)) return false\n\tconst identifier = value.identifier\n\tconst moduleId = value.moduleId\n\treturn isString(identifier) && isModuleExportIdentifier(identifier) && isString(moduleId)\n}\n\nexport interface LinkVariableDefinition extends VariableDefinitionBase, WithRequired {\n\ttype: ControlType.Link\n\t/** @deprecated https://github.com/framer/company/issues/34146 */\n\tinitialValue: string | Omit<Link, \"type\"> | undefined\n}\n\nexport interface LinkRelValuesVariableDefinition extends VariableDefinitionBase, WithRequired {\n\ttype: ControlType.LinkRelValues\n\tinitialValue: readonly SupportedLinkRelValue[] | undefined\n}\n\nexport interface DateVariableDefinition extends VariableDefinitionBase, WithRequired, WithOptional, WithQueryParam {\n\ttype: ControlType.Date\n\tinitialValue: string | undefined\n\toptions?: DateVariableOptions\n}\n\nexport interface VariableDivider {\n\ttype: \"divider\"\n\tid: VariableID\n\tname: string\n\tdescription?: string\n}\n\nexport interface EnumVariableCase {\n\tid: string\n\tname: string\n\tnameLocalized?: LocalizedValues\n\t/** Used by plugins. */\n\texternalId?: string\n}\n\nexport interface EnumVariableDefinition extends VariableDefinitionBase, WithOptional, WithPreventLocalization {\n\ttype: ControlType.Enum\n\tinitialValue: string | undefined\n\tcases: readonly EnumVariableCase[]\n}\n\nexport interface NodePropertyControlReferenceVariableDefinition extends VariableDefinitionBase {\n\ttype: \"nodePropertyControlReference\"\n\tinitialValue: unknown\n\tentityIdentifier: typeof nodePropertyDefinitionEntityIdentifier\n\t/**\n\t * Represents first class Framer property keys, e.g. \"stackDirection\". When an enum type control has 'controlKey'\n\t * set, it restricts editing to the default value alone, ensuring compatibility with the specified prop options. It\n\t * also means that the enum variable cannot be assigned to other properties.\n\t */\n\tcontrolKey: NodePropertyControlKey\n\texpectedType: ControlType.Enum\n}\n\nexport interface ControlReferenceVariableDefinition extends VariableDefinitionBase, WithOptional, WithQueryParam {\n\ttype: \"controlReference\"\n\tinitialValue: unknown\n\tentityIdentifier: string\n\tcontrolKey: string\n\texpectedType: ControlType.Enum | ControlType.SegmentedEnum | ControlType.File\n}\n\nexport interface SlugVariableDefinition extends VariableDefinitionBase {\n\ttype: \"slug\"\n\t/** Slugified by default */\n\tassociatedStringVariable: VariableID | null\n}\n\nconst variablesWithoutDescription = [ControlType.EventHandler] as const\nexport type VariablesWithoutDescriptionType = (typeof variablesWithoutDescription)[number]\n\nexport function isVariableWithoutDescription(variable: VariableOrDivider) {\n\treturn (variablesWithoutDescription as readonly (VariableType | \"divider\")[]).includes(variable.type)\n}\n\nexport type ArrayItemVariableType = ArrayItemVariableDefinition[\"type\"]\n\nconst allVariableTypesSupportingArrayItem: Record<ArrayItemVariableType, true> = {\n\t[ControlType.Image]: true,\n\t[ControlType.Boolean]: true,\n\t[ControlType.Number]: true,\n\t[ControlType.Color]: true,\n\t[ControlType.String]: true,\n\tdivider: true,\n}\n\nexport function isArrayItemVariableType(type: unknown): type is ArrayItemVariableType {\n\treturn isString(type) && Object.hasOwn(allVariableTypesSupportingArrayItem, type)\n}\n\nexport function isArrayItemVariableDefinition(variable: VariableOrDivider): variable is ArrayItemVariableDefinition {\n\treturn isArrayItemVariableType(variable.type)\n}\n\nexport function isStringVariableDefinition(variable: VariableOrDivider): variable is StringVariableDefinition {\n\treturn variable.type === ControlType.String\n}\n\nexport function isRichTextVariableDefinition(variable: VariableOrDivider): variable is RichTextVariableDefinition {\n\treturn variable.type === ControlType.RichText\n}\n\nexport function isSlugVariableDefinition(variable: VariableOrDivider): variable is SlugVariableDefinition {\n\treturn variable.type === \"slug\"\n}\n\nexport function isDateVariableDefinition(variable: VariableOrDivider): variable is DateVariableDefinition {\n\treturn variable.type === ControlType.Date\n}\n\nexport function isCollectionReferenceVariableDefinition(\n\tvariable: VariableOrDivider,\n): variable is CollectionReferenceVariableDefinition {\n\treturn variable.type === ControlType.CollectionReference\n}\n\nexport function isMultiCollectionReferenceVariableDefinition(\n\tvariable: VariableOrDivider,\n): variable is MultiCollectionReferenceVariableDefinition {\n\treturn variable.type === ControlType.MultiCollectionReference\n}\n\nexport function isAnyCollectionReferencingVariableDefinition(\n\tvariable: VariableOrDivider,\n): variable is CollectionReferenceVariableDefinition | MultiCollectionReferenceVariableDefinition {\n\treturn isCollectionReferenceVariableDefinition(variable) || isMultiCollectionReferenceVariableDefinition(variable)\n}\n\n/**\n * `required` is used in the CMS to show a warning when a variable\u2019s value is empty. For example, an\n * empty string or an empty gallery array is not allowed when a variable is marked as required.\n */\ninterface WithRequired {\n\trequired?: boolean\n}\n\n/**\n * `optional` indicates that a component or web-page variable may be `undefined`. This is useful,\n * for example, when filtering a collection: a boolean value enforces that an item\u2019s field must\n * match that value, while `undefined` disables the filter.\n *\n * You might expect `required: false` to express the same idea, but it becomes misleading across\n * contexts. For components, `optional` means a value may intentionally be `undefined`, whereas in\n * the CMS an empty field should still produce a warning.\n *\n * Concretely: in the CMS, boolean fields are effectively non-optional because they always have a\n * default value; but in components, booleans should be optional, since `undefined` communicates\n * meaning distinct from `false`.\n */\ninterface WithOptional {\n\toptional?: boolean\n}\n\ninterface WithPreventLocalization {\n\tpreventLocalization?: boolean\n}\n\n/**\n * Only applicable for variables of {@link WebPageNode}.\n * If not set, defaults to {@link generateQueryParamNameForVariableName}.\n */\nexport interface WithQueryParam {\n\tqueryParam?: string\n}\n\ntype VariablesSupportingRequired = Extract<VariableDefinition, WithRequired>\ntype VariableTypesSupportingRequired = VariablesSupportingRequired[\"type\"]\n\nconst allVariableTypesSupportingRequired: Record<VariableTypesSupportingRequired, true> = {\n\t[ControlType.String]: true,\n\t[ControlType.RichText]: true,\n\t[ControlType.Image]: true,\n\t[ControlType.File]: true,\n\t[ControlType.Link]: true,\n\t[ControlType.LinkRelValues]: true,\n\t[ControlType.CollectionReference]: true,\n\t[ControlType.MultiCollectionReference]: true,\n\t[ControlType.Array]: true,\n\t[ControlType.Date]: true,\n}\n\nexport function withRequired(variable: VariableOrDivider): variable is VariablesSupportingRequired {\n\treturn Object.hasOwn(allVariableTypesSupportingRequired, variable.type)\n}\n\nexport function isRequiredVariable(\n\tvariable: VariableDefinition,\n): variable is (VariablesSupportingRequired & { required: true }) | DateVariableDefinition {\n\tif (!withRequired(variable)) return false\n\treturn variable.required ?? false\n}\n\ntype VariablesSupportingOptional = Extract<VariableDefinition, WithOptional>\ntype VariableTypesSupportingOptional = VariablesSupportingOptional[\"type\"]\n\nconst allVariableTypesSupportingOptional: Record<VariableTypesSupportingOptional, true> = {\n\t[ControlType.Boolean]: true,\n\t[ControlType.Date]: true,\n\t[ControlType.Enum]: true,\n\t[ControlType.Number]: true,\n\t[ControlType.String]: true,\n\t[ControlType.CollectionReference]: true,\n\t[ControlType.MultiCollectionReference]: true,\n\tcontrolReference: true,\n}\n\nfunction scopeSupportsOptionalVariables(scopeType: ScopeType): boolean {\n\treturn scopeType === ScopeType.WebPage || scopeType === ScopeType.SmartComponent\n}\n\nexport function isOptionalVariableTypeForScopeType(\n\tvariableType: VariableType | VariableDivider[\"type\"],\n\tscopeType: ScopeType,\n): variableType is VariableTypesSupportingOptional {\n\tif (!scopeSupportsOptionalVariables(scopeType)) return false\n\treturn Object.hasOwn(allVariableTypesSupportingOptional, variableType)\n}\n\nexport function withOptional(\n\tvariable: VariableOrDivider,\n\tscopeType: ScopeType,\n): variable is VariablesSupportingOptional {\n\tif (!isOptionalVariableTypeForScopeType(variable.type, scopeType)) return false\n\tif (variable.type !== \"controlReference\") return true\n\treturn variable.expectedType !== ControlType.File\n}\n\nexport function isOptionalVariable(\n\tvariable: VariableOrDivider,\n\tscopeType: ScopeType,\n): variable is VariablesSupportingOptional & { optional: true } {\n\treturn withOptional(variable, scopeType) && variable.optional === true\n}\n\nexport type VariablesSupportingPreventLocalization = Extract<VariableDefinition, WithPreventLocalization>\ntype VariableTypesSupportingPreventLocalization = VariablesSupportingPreventLocalization[\"type\"]\n\nconst allVariableTypesSupportingPreventLocalization: Record<VariableTypesSupportingPreventLocalization, true> = {\n\t[ControlType.String]: true,\n\t[ControlType.RichText]: true,\n\t[ControlType.Enum]: true,\n}\n\nexport function withPreventLocalization(\n\tvariable: VariableOrDivider,\n): variable is VariablesSupportingPreventLocalization {\n\tif (!isVariableDefinition(variable)) return false\n\treturn variable.type in allVariableTypesSupportingPreventLocalization\n}\n\nexport function isPreventingLocalization(\n\tvariable: VariablesSupportingPreventLocalization,\n): variable is VariablesSupportingPreventLocalization & { preventLocalization: true } {\n\treturn withPreventLocalization(variable) && variable.preventLocalization === true\n}\n\ntype VariablesSupportingQueryParam = Extract<VariableDefinition, WithQueryParam>\ntype VariableTypesSupportingQueryParam = VariablesSupportingQueryParam[\"type\"]\n\nconst allVariableTypesSupportingQueryParam: Record<VariableTypesSupportingQueryParam, true> = {\n\t[ControlType.Boolean]: true,\n\t[ControlType.Date]: true,\n\t[ControlType.String]: true,\n\t[ControlType.Number]: true,\n\t[ControlType.CollectionReference]: true,\n\t[ControlType.MultiCollectionReference]: true,\n\tcontrolReference: true,\n}\n\nexport function withQueryParam(variable: VariableOrDivider): variable is VariablesSupportingQueryParam {\n\tif (!isVariableDefinition(variable)) return false\n\treturn Object.hasOwn(allVariableTypesSupportingQueryParam, variable.type)\n}\n\nexport function isVariableDefinition(value: VariableOrDivider | null | undefined): value is VariableDefinition {\n\treturn !isNullish(value) && value.type !== \"divider\"\n}\n\nexport function isArrayVariable(variable: VariableOrDivider): variable is ArrayVariableDefinition {\n\treturn variable.type === ControlType.Array\n}\n\nfunction isImageVariable(variable: VariableOrDivider): variable is ImageVariableDefinition {\n\treturn variable.type === ControlType.Image\n}\n\nexport function isArrayGalleryVariable(\n\tvariable: VariableOrDivider,\n): variable is ArrayVariableDefinition & { itemVariables: readonly [ImageVariableDefinition] } {\n\treturn (\n\t\tisArrayVariable(variable) && variable.itemVariables.length === 1 && variable.itemVariables.every(isImageVariable)\n\t)\n}\n\n// Variable options\ninterface BooleanVariableOptions {\n\tenabledTitle?: string\n\tdisabledTitle?: string\n}\n\nexport interface NumberVariableOptions {\n\tmin?: number\n\tmax?: number\n\tunit?: \"%\" | \"\u00B0\"\n\tstep?: number\n\tdisplayStepper?: boolean\n}\n\ninterface StringVariableOptions {\n\tplaceholder?: string\n\tdisplayTextArea?: boolean\n\tmaxLength?: number\n}\n\ninterface DateVariableOptions {\n\tdisplayTime?: boolean\n}\n\ninterface RichTextVariableOptions {\n\tplaceholder?: string\n\tmaxLength?: number\n}\n\nexport type VariableOrDivider<T extends VariableDefinition = VariableDefinition> = T | VariableDivider\nexport type VariablesAndDividers<T extends VariableDefinition = VariableDefinition> = readonly VariableOrDivider<T>[]\n\n/** Nodes that hold the variable definitions. */\nexport interface WithVariables {\n\tvariables: VariablesAndDividers\n\tcanCreateVariable(options: CanCreateVariableOptions): boolean\n\tgetVariable(id: VariableID): VariableDefinition | undefined\n\tgetVariableValue(id: VariableID): unknown\n\thasVariable(id: VariableID): boolean\n}\n\nconst key: keyof WithVariables = \"variables\"\n\nexport function withVariables<T extends CanvasNode | AnyScopeNode>(node: T | null): node is T & WithVariables {\n\tif (!node) return false\n\treturn key in node\n}\n\n// Control descriptions\n\nfunction variableTitle(variable: VariableDefinition) {\n\treturn variable.name || Dictionary.Unknown\n}\n\nconst allObjectPropertyControlTypes: Record<VerifiedObjectPropertyControlDescription[\"type\"], true> = {\n\t[ControlType.Number]: true,\n\t[ControlType.Enum]: true,\n\t[ControlType.Boolean]: true,\n\t[ControlType.String]: true,\n\t[ControlType.RichText]: true,\n\t[ControlType.Color]: true,\n\t[ControlType.Image]: true,\n\t[ControlType.ResponsiveImage]: true,\n\t[ControlType.File]: true,\n\t[ControlType.Transition]: true,\n\t[ControlType.BoxShadow]: true,\n\t[ControlType.Link]: true,\n\t[ControlType.Date]: true,\n\t[ControlType.Array]: true,\n\t[ControlType.Object]: true,\n\t[ControlType.FusedNumber]: true,\n\t[ControlType.Font]: true,\n\t[ControlType.PageScope]: true,\n\t[ControlType.ScrollSectionRef]: true,\n\t[ControlType.CustomCursor]: true,\n\t[ControlType.Border]: true,\n\t[ControlType.Cursor]: true,\n\t[ControlType.Gap]: true,\n\t[ControlType.Padding]: true,\n\t[ControlType.BorderRadius]: true,\n\t[ControlType.CollectionReference]: true,\n\t[ControlType.MultiCollectionReference]: true,\n\t[ControlType.TrackingId]: true,\n\t[ControlType.Location]: true,\n}\n\nfunction isObjectPropertyControlDescription(\n\tcontrol: VerifiedControlDescription,\n): control is VerifiedObjectPropertyControlDescription {\n\treturn Object.hasOwn(allObjectPropertyControlTypes, control.type)\n}\n\nexport type ArrayOfObjectControlDescription = VerifiedArrayControlDescription & {\n\tcontrol: VerifiedObjectControlDescription\n}\n\nexport function isArrayOfObjectControlDescription(\n\tcontrol: VerifiedControlDescription | undefined,\n): control is ArrayOfObjectControlDescription {\n\treturn control?.type === ControlType.Array && control.control.type === ControlType.Object\n}\n\nexport function isArrayControlDescription(\n\tcontrol: VerifiedControlDescription,\n): control is VerifiedArrayControlDescription {\n\treturn control.type === ControlType.Array\n}\n\nfunction arrayControlDescription(\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tvariable: ArrayVariableDefinition,\n\tscopeType: ScopeType,\n): VerifiedArrayControlDescription {\n\tconst controls: VerifiedObjectControlDescription[\"controls\"] = {}\n\n\tfor (const controlVariable of variable.itemVariables) {\n\t\tif (!isVariableDefinition(controlVariable)) continue\n\n\t\tconst control = controlDescriptionFromVariable(tree, componentLoader, controlVariable, scopeType)\n\t\tif (!control) continue\n\t\tassert(\n\t\t\tisObjectPropertyControlDescription(control),\n\t\t\t\"Expected array item property control to be usable in an object\",\n\t\t)\n\t\tcontrols[controlVariable.id] = control\n\t}\n\n\tconst __vekterDefault: unknown[] | undefined = variable.initialValue?.map(itemControlProp => {\n\t\tconst item: Record<string, unknown> = {}\n\n\t\tif (!itemControlProp || itemControlProp.type !== ControlType.Object) return item\n\t\tif (!isObject(itemControlProp.value)) return item\n\n\t\tfor (const objectPropertyKey in itemControlProp.value) {\n\t\t\tconst objectPropertyControlProp = itemControlProp.value[objectPropertyKey]\n\t\t\tif (!objectPropertyControlProp) continue\n\t\t\tconst propertyDefaultValue = getDefaultArrayItemPropertyValue(objectPropertyControlProp)\n\t\t\tif (isUndefined(propertyDefaultValue)) continue\n\t\t\titem[objectPropertyKey] = propertyDefaultValue\n\t\t}\n\n\t\treturn item\n\t})\n\n\treturn {\n\t\ttype: variable.type,\n\t\tcontrol: {\n\t\t\ttype: ControlType.Object,\n\t\t\tcontrols,\n\t\t},\n\t\ttitle: variableTitle(variable),\n\t\tdescription: variable.description,\n\t\tminCount: variable.minCount,\n\t\tmaxCount: variable.maxCount,\n\t\t// We are adding the default value using a private API, because the actual default value can\n\t\t// only contain values valid for rendering, and we want to store values that are only needed\n\t\t// within Vekter, like asset references, and box shadow in our object model.\n\t\t__vekterDefault,\n\t}\n}\n\nfunction getDefaultArrayItemPropertyValue(itemControlProp: unknown): unknown {\n\tif (!isRawControlProp(itemControlProp)) return undefined\n\tconst arrayItemType = itemControlProp.type\n\tif (!isArrayItemVariableType(arrayItemType)) return undefined\n\n\tswitch (arrayItemType) {\n\t\tcase ControlType.Image: {\n\t\t\tif (!isString(itemControlProp.value)) return undefined\n\n\t\t\tlet alt: string | undefined\n\t\t\tlet positionX: RelativeNumber | undefined\n\t\t\tlet positionY: RelativeNumber | undefined\n\n\t\t\tif (withControlAltText(itemControlProp)) {\n\t\t\t\talt = itemControlProp.alt\n\t\t\t}\n\t\t\tif (hasControlFocalPoint(itemControlProp)) {\n\t\t\t\tpositionX = itemControlProp.positionX\n\t\t\t\tpositionY = itemControlProp.positionY\n\t\t\t}\n\n\t\t\tconst defaultResponsiveImage: DefaultResponsiveImage = {\n\t\t\t\tassetReference: itemControlProp.value,\n\t\t\t\talt,\n\t\t\t\tpositionX,\n\t\t\t\tpositionY,\n\t\t\t}\n\n\t\t\treturn defaultResponsiveImage\n\t\t}\n\t\tcase ControlType.Boolean:\n\t\t\treturn isBoolean(itemControlProp.value) ? itemControlProp.value : undefined\n\t\tcase ControlType.Number:\n\t\t\treturn isNumber(itemControlProp.value) ? itemControlProp.value : undefined\n\t\tcase ControlType.String:\n\t\tcase ControlType.Color:\n\t\t\treturn isString(itemControlProp.value) ? itemControlProp.value : undefined\n\t\tdefault:\n\t\t\tassertNever(arrayItemType)\n\t}\n}\n\nfunction booleanControlDescription(\n\tvariable: BooleanVariableDefinition,\n\tscopeType: ScopeType,\n): Extract<VerifiedControlDescription, { type: ControlType.Boolean }> {\n\tconst { enabledTitle, disabledTitle } = variable.options ?? {}\n\n\tconst isOptional = isOptionalVariable(variable, scopeType)\n\n\treturn {\n\t\ttype: variable.type,\n\t\ttitle: variableTitle(variable),\n\t\tdefaultValue: isOptional ? undefined : getDefaultVariableValue(variable.type, variable.initialValue),\n\t\tenabledTitle,\n\t\tdisabledTitle,\n\t\tdescription: variable.description,\n\t\toptional: isOptional ? true : undefined,\n\t}\n}\n\nexport function numberControlDescription(\n\tvariable: NumberVariableDefinition,\n\tscopeType: ScopeType,\n): Extract<VerifiedControlDescription, { type: ControlType.Number }> {\n\tconst { min, max, step, unit, displayStepper } = variable.options ?? {}\n\n\tconst isOptional = isOptionalVariable(variable, scopeType)\n\n\treturn {\n\t\ttype: variable.type,\n\t\ttitle: variableTitle(variable),\n\t\tdefaultValue: isOptional ? undefined : getDefaultVariableValue(variable.type, variable.initialValue),\n\t\tmin,\n\t\tmax,\n\t\tstep,\n\t\tunit,\n\t\tdisplayStepper,\n\t\tdescription: variable.description,\n\t\toptional: isOptional ? true : undefined,\n\t}\n}\n\nfunction colorControlDescription(\n\tvariable: ColorVariableDefinition,\n): Extract<VerifiedControlDescription, { type: ControlType.Color }> {\n\tconst defaultValue = isTokenCSSVariable(variable.initialValue)\n\t\t? variable.initialValue\n\t\t: ConvertColor.toFormatString(variable.initialValue)\n\n\treturn {\n\t\ttype: variable.type,\n\t\ttitle: variableTitle(variable),\n\t\tdefaultValue: getDefaultVariableValue(variable.type, defaultValue),\n\t\tdescription: variable.description,\n\t}\n}\n\nfunction stringControlDescription(\n\tvariable: StringVariableDefinition,\n\tscopeType: ScopeType,\n): Extract<VerifiedControlDescription, { type: ControlType.String }> & WithMaxLength {\n\tconst { placeholder, displayTextArea, maxLength } = variable.options ?? {}\n\n\tconst isOptional = isOptionalVariable(variable, scopeType)\n\n\treturn {\n\t\ttype: variable.type,\n\t\ttitle: variableTitle(variable),\n\t\tdefaultValue: isOptional ? undefined : getDefaultVariableValue(variable.type, variable.initialValue),\n\t\tplaceholder,\n\t\tdisplayTextArea,\n\t\tmaxLength,\n\t\tdescription: variable.description,\n\t\tpreventLocalization: variable.preventLocalization,\n\t\toptional: isOptional ? true : undefined,\n\t}\n}\n\nfunction richTextControlDescription(\n\tvariable: RichTextVariableDefinition,\n): Extract<VerifiedControlDescription, { type: ControlType.RichText }> & WithMaxLength {\n\tconst { placeholder, maxLength } = variable.options ?? {}\n\treturn {\n\t\ttype: variable.type,\n\t\ttitle: variableTitle(variable),\n\t\tdefaultValue: getDefaultVariableValue(variable.type, variable.initialValue),\n\t\tplaceholder,\n\t\tmaxLength,\n\t\tdescription: variable.description,\n\t\tpreventLocalization: variable.preventLocalization,\n\t}\n}\n\n/**\n * Here we extend the public `ResponsiveImageControlDescription` type with a\n * __defaultAssetReference value to allow us to store default image url for\n * use in the generated component. This lets us avoid publishing a new public\n * type that could lead to end-user confusion, since `defaultValue` is not a\n * valid property control value for images. We strip this value when we\n * generate the Variant Instance's property controls.\n */\nfunction imageControlDescription(\n\tvariable: ImageVariableDefinition,\n): Extract<VerifiedControlDescription, { type: ControlType.ResponsiveImage }> {\n\tconst result: Extract<VerifiedControlDescription, { type: ControlType.ResponsiveImage }> &\n\t\tOptionalDefaultAssetReference &\n\t\tWithOptionalVekterDefault = {\n\t\ttype: ControlType.ResponsiveImage,\n\t\ttitle: variableTitle(variable),\n\t\tdescription: variable.description,\n\t}\n\tif (isString(variable.initialValue)) {\n\t\tresult.__defaultAssetReference = variable.initialValue\n\t}\n\tif (isRawControlProp(variable.initialValue) && isString(variable.initialValue.value)) {\n\t\tconst assetReference = variable.initialValue.value\n\t\tresult.__defaultAssetReference = assetReference\n\n\t\tconst defaultImage: DefaultResponsiveImage = { assetReference: assetReference }\n\t\tresult.__vekterDefault = defaultImage\n\n\t\tif (withControlAltText(variable.initialValue) && isString(variable.initialValue.alt)) {\n\t\t\tdefaultImage.alt = variable.initialValue.alt\n\t\t}\n\n\t\tif (hasControlFocalPoint(variable.initialValue)) {\n\t\t\tdefaultImage.positionX = variable.initialValue.positionX\n\t\t\tdefaultImage.positionY = variable.initialValue.positionY\n\t\t}\n\t}\n\treturn result\n}\n\nfunction fileControlDescription(\n\tvariable: FileVariableDefinition,\n): Extract<VerifiedControlDescription, { type: ControlType.File }> {\n\tconst fileExtensions = variable.allowedFileTypes.map(fileType => fileType.extension)\n\tconst uniqueFileExtensions = new Set(fileExtensions)\n\tconst allowedFileTypes = Array.from(uniqueFileExtensions).filter(Boolean)\n\n\treturn {\n\t\ttype: ControlType.File,\n\t\ttitle: variableTitle(variable),\n\t\tallowedFileTypes,\n\t\t__defaultAssetReference: getDefaultVariableValue(variable.type, variable.initialValue),\n\t\tdescription: variable.description,\n\t}\n}\n\nfunction eventHandlerControlDescription(\n\tvariable: EventHandlerVariableDefinition,\n): Extract<VerifiedControlDescription, { type: ControlType.EventHandler }> {\n\treturn { type: variable.type, title: variableTitle(variable) }\n}\n\nfunction scrollSectionRefControlDescription(\n\tvariable: ScrollSectionRefVariableDefinition,\n): Extract<VerifiedControlDescription, { type: ControlType.ScrollSectionRef }> {\n\treturn { type: variable.type, title: variableTitle(variable), description: variable.description }\n}\n\nfunction customCursorControlDescription(\n\tvariable: CustomCursorVariableDefinition,\n): Extract<VerifiedControlDescription, { type: ControlType.CustomCursor }> {\n\treturn { type: variable.type, title: variableTitle(variable), description: variable.description }\n}\n\nfunction cursorControlDescription(\n\tvariable: CursorVariableDefinition,\n): Extract<VerifiedControlDescription, { type: ControlType.Cursor }> {\n\treturn {\n\t\ttype: variable.type,\n\t\ttitle: variableTitle(variable),\n\t\tdescription: variable.description,\n\t\tdefaultValue: variable.initialValue,\n\t}\n}\n\nfunction transitionControlDescription(\n\tvariable: TransitionVariableDefinition,\n): Extract<VerifiedControlDescription, { type: ControlType.Transition }> {\n\tconst transitionValues = getDefaultVariableValue(variable.type, variable.initialValue)\n\treturn {\n\t\ttype: variable.type,\n\t\ttitle: variableTitle(variable),\n\t\tdefaultValue: transitionValues ? toMotionTransition(transitionValues) : undefined,\n\t\tdescription: variable.description,\n\t}\n}\n\nfunction locationControlDescription(\n\tvariable: LocationVariableDefinition,\n): Extract<VerifiedControlDescription, { type: ControlType.Location }> {\n\treturn {\n\t\ttype: variable.type,\n\t\ttitle: variableTitle(variable),\n\t\tdefaultValue: variable.initialValue,\n\t\tdescription: variable.description,\n\t}\n}\n\nfunction borderControlDescription(\n\tvariable: BorderVariableDefinition,\n): Extract<VerifiedControlDescription, { type: ControlType.Border }> {\n\tconst borderValues = getDefaultVariableValue(variable.type, variable.initialValue)\n\tconst defaultValue = borderValues ? toBorderReactCSSProperties(borderValues) : undefined\n\n\treturn {\n\t\ttype: variable.type,\n\t\ttitle: variableTitle(variable),\n\t\tdescription: variable.description,\n\t\tdefaultValue,\n\t}\n}\n\nexport function boxShadowControlDescription(\n\tvariable: BoxShadowVariableDefinition,\n): Extract<VerifiedControlDescription, { type: ControlType.BoxShadow }> {\n\treturn {\n\t\ttype: variable.type,\n\t\ttitle: variableTitle(variable),\n\t\tdefaultValue: variable.initialValue.map(toLibraryBoxShadow),\n\t\tdescription: variable.description,\n\t}\n}\n\nfunction gapControlDescription(\n\tvariable: GapVariableDefinition,\n): Extract<VerifiedControlDescription, { type: ControlType.Gap }> {\n\treturn {\n\t\ttype: variable.type,\n\t\ttitle: variableTitle(variable),\n\t\tdescription: variable.description,\n\t\tdefaultValue: variable.initialValue,\n\t}\n}\n\nfunction paddingControlDescription(\n\tvariable: PaddingVariableDefinition,\n): Extract<VerifiedControlDescription, { type: ControlType.Padding }> {\n\treturn {\n\t\ttype: variable.type,\n\t\ttitle: variableTitle(variable),\n\t\tdescription: variable.description,\n\t\tdefaultValue: variable.initialValue,\n\t}\n}\n\nfunction borderRadiusControlDescription(\n\tvariable: BorderRadiusVariableDefinition,\n): Extract<VerifiedControlDescription, { type: ControlType.BorderRadius }> {\n\treturn {\n\t\ttype: variable.type,\n\t\ttitle: variableTitle(variable),\n\t\tdescription: variable.description,\n\t\tdefaultValue: variable.initialValue,\n\t}\n}\n\nfunction collectionReferenceControlDescription(\n\tvariable: CollectionReferenceVariableDefinition,\n\tscopeType: ScopeType,\n): Extract<VerifiedControlDescription, { type: ControlType.CollectionReference }> {\n\tconst isOptional = isOptionalVariable(variable, scopeType)\n\treturn {\n\t\ttype: variable.type,\n\t\ttitle: variableTitle(variable),\n\t\tdescription: variable.description,\n\t\tdataIdentifier: variable.dataIdentifier,\n\t\tdefaultValue: variable.initialValue,\n\t\toptional: isOptional ? true : undefined,\n\t}\n}\n\nfunction multiCollectionReferenceControlDescription(\n\tvariable: MultiCollectionReferenceVariableDefinition,\n\tscopeType: ScopeType,\n): Extract<VerifiedControlDescription, { type: ControlType.MultiCollectionReference }> {\n\tconst isOptional = isOptionalVariable(variable, scopeType)\n\treturn {\n\t\ttype: variable.type,\n\t\ttitle: variableTitle(variable),\n\t\tdescription: variable.description,\n\t\tdataIdentifier: variable.dataIdentifier,\n\t\tdefaultValue: variable.initialValue,\n\t\toptional: isOptional ? true : undefined,\n\t}\n}\n\nfunction trackingIdControlDescription(\n\tvariable: TrackingIdVariableDefinition,\n): Extract<VerifiedControlDescription, { type: ControlType.TrackingId }> {\n\treturn { type: variable.type, title: variableTitle(variable), description: variable.description }\n}\n\nfunction vectorSetItemControlDescription(\n\tvariable: VectorSetItemVariableDefinition,\n): Extract<VerifiedControlDescription, { type: ControlType.VectorSetItem }> {\n\treturn {\n\t\ttype: variable.type,\n\t\ttitle: variableTitle(variable),\n\t\tdescription: variable.description,\n\t\tsetModuleId: variable.setModuleId,\n\t\tdefaultValue: variable.initialValue,\n\t}\n}\n\nfunction linkControlDescription(\n\tvariable: LinkVariableDefinition,\n): Extract<VerifiedControlDescription, { type: ControlType.Link }> {\n\treturn { type: variable.type, title: variableTitle(variable), description: variable.description }\n}\n\nfunction linkRelValuesControlDescription(\n\tvariable: LinkRelValuesVariableDefinition,\n): Extract<VerifiedControlDescription, { type: ControlType.LinkRelValues }> {\n\treturn {\n\t\ttype: variable.type,\n\t\ttitle: variableTitle(variable),\n\t\tdescription: variable.description,\n\t\tdefaultValue: variable.initialValue,\n\t}\n}\n\nfunction dateControlDescription(\n\tvariable: DateVariableDefinition,\n\tscopeType: ScopeType,\n): Extract<VerifiedControlDescription, { type: ControlType.Date }> {\n\tconst isOptional = isOptionalVariable(variable, scopeType)\n\n\tconst description: Extract<VerifiedControlDescription, { type: ControlType.Date }> = {\n\t\ttype: variable.type,\n\t\ttitle: variableTitle(variable),\n\t\tdefaultValue: isOptional ? undefined : getDefaultVariableValue(variable.type, variable.initialValue),\n\t\tdescription: variable.description,\n\t\toptional: isOptional ? true : undefined,\n\t}\n\n\tif (variable.options?.displayTime) {\n\t\tdescription.displayTime = true\n\t}\n\n\treturn description\n}\n\nfunction enumControlDescription(\n\tvariable: EnumVariableDefinition,\n\tscopeType: ScopeType,\n): Extract<VerifiedControlDescription, { type: ControlType.Enum }> {\n\tconst isOptional = isOptionalVariable(variable, scopeType)\n\n\tlet defaultValue: string | undefined\n\n\tconst options: string[] = []\n\tconst optionTitles: string[] = []\n\tvariable.cases.forEach(enumCase => {\n\t\toptions.push(enumCase.id)\n\t\toptionTitles.push(enumCase.name)\n\n\t\tif (!isOptional && variable.initialValue === enumCase.id) {\n\t\t\tdefaultValue = enumCase.id\n\t\t}\n\t})\n\n\treturn {\n\t\ttype: variable.type,\n\t\ttitle: variableTitle(variable),\n\t\tdefaultValue,\n\t\toptions,\n\t\toptionTitles,\n\t\tdescription: variable.description,\n\t\toptional: isOptional ? true : undefined,\n\t}\n}\n\nfunction isCompatibleControlType(controlType: ControlType, expectedType: ControlType) {\n\tswitch (controlType) {\n\t\tcase ControlType.Enum:\n\t\t\treturn expectedType === ControlType.Enum || expectedType === ControlType.SegmentedEnum\n\t\tdefault:\n\t\t\treturn controlType === expectedType\n\t}\n}\n\nexport function componentIdentifierForVariableReference(tree: CanvasTree, entityIdentifier: string) {\n\tconst moduleIdentifier = parseModuleIdentifier(entityIdentifier)\n\n\tif (isExternalModuleIdentifier(moduleIdentifier)) {\n\t\t// The save id might have changed, attempt to look up version used by\n\t\t// the project and use that.\n\t\tconst moduleNode = tree.getNode<ExternalModuleNode>(moduleIdentifier.moduleId)\n\t\tif (moduleNode) return moduleNode.codeComponentIdentifier\n\t}\n\n\treturn entityIdentifier\n}\n\n// The \u201CcontrolReference\u201D type will result in either an enum or file type when converted to a control description\ntype ResolvedControlReferenceType = ControlType.Enum | ControlType.File\n\nexport function getReferencedPropertyControl(\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tvariable: ControlReferenceVariableDefinition | NodePropertyControlReferenceVariableDefinition,\n) {\n\tif (variable.type === \"nodePropertyControlReference\") {\n\t\tconst control = getNodePropertyControlDescription(variable.controlKey)\n\t\tassert(\n\t\t\tcontrol && isCompatibleControlType(control.type, variable.expectedType),\n\t\t\t\"incompatible node property control\",\n\t\t\tvariable.controlKey,\n\t\t\tvariable.expectedType,\n\t\t)\n\t\treturn control\n\t}\n\tconst identifier = componentIdentifierForVariableReference(tree, variable.entityIdentifier)\n\tconst component = componentLoader.componentForIdentifier(identifier)\n\n\tif (!component?.properties) return null\n\t// For now we only support references to components and collections, not actions\n\tif (component.type !== \"component\" && component.type !== \"data\") return null\n\tconst control = component.properties[variable.controlKey]\n\tif (!control) return null\n\tif (!isCompatibleControlType(control.type, variable.expectedType)) return null\n\treturn control\n}\n\nfunction controlReferenceControlDescription(\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tvariable: ControlReferenceVariableDefinition | NodePropertyControlReferenceVariableDefinition,\n\tscopeType: ScopeType,\n): Extract<VerifiedControlDescription, { type: ResolvedControlReferenceType }> | null {\n\tconst control = getReferencedPropertyControl(tree, componentLoader, variable)\n\tif (!control) return null\n\n\tconst isOptional = variable.type === \"controlReference\" && isOptionalVariable(variable, scopeType)\n\n\tswitch (variable.expectedType) {\n\t\tcase ControlType.Enum:\n\t\tcase ControlType.SegmentedEnum: {\n\t\t\tif (control.type !== ControlType.Enum) return null\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Enum,\n\t\t\t\ttitle: variableTitle(variable),\n\t\t\t\toptions: control.options,\n\t\t\t\toptionTitles: control.optionTitles,\n\t\t\t\tdisplaySegmentedControl: control.displaySegmentedControl,\n\t\t\t\tdefaultValue: isOptional ? undefined : getDefaultVariableValue(variable.expectedType, variable.initialValue),\n\t\t\t\toptionIcons: control.type === ControlType.Enum ? control.optionIcons : undefined,\n\t\t\t\tdescription: variable.description,\n\t\t\t\toptional: isOptional ? true : undefined,\n\t\t\t}\n\t\t}\n\t\tcase ControlType.File:\n\t\t\tif (control.type !== ControlType.File) return null\n\t\t\treturn {\n\t\t\t\ttype: ControlType.File,\n\t\t\t\ttitle: variableTitle(variable),\n\t\t\t\tallowedFileTypes: control.allowedFileTypes,\n\t\t\t\tdescription: variable.description,\n\t\t\t\t__defaultAssetReference: isString(variable.initialValue) ? variable.initialValue : undefined,\n\t\t\t}\n\t\tdefault:\n\t\t\tthrow Error(\"Unsupported control reference type\")\n\t}\n}\n\nfunction slugControlDescription(\n\ttree: CanvasTree,\n\tvariable: SlugVariableDefinition,\n): Extract<VerifiedControlDescription, { type: ControlType.String }> {\n\treturn {\n\t\ttype: ControlType.String,\n\t\ttitle: variableTitle(variable),\n\t\tdescription: variable.description,\n\t\tpreventLocalization: tree.root.translatePagePaths === \"no\",\n\t}\n}\n\nexport type VariableControlDescription = Extract<\n\tVerifiedControlDescription,\n\t{ type: VariableType | ResolvedControlReferenceType | ControlType.ResponsiveImage }\n>\n\ninterface WithMaxLength {\n\tmaxLength?: number\n}\n\ntype ControlsSupportingMaxLength = Extract<VariableControlDescription, WithMaxLength>\ntype ControlTypesTypesSupportingMaxLength = ControlsSupportingMaxLength[\"type\"]\n\nconst allControlTypesSupportingMaxLength: Record<ControlTypesTypesSupportingMaxLength, true> = {\n\t[ControlType.String]: true,\n\t[ControlType.RichText]: true,\n}\n\nexport function withMaxLength(\n\tcontrol: Pick<VerifiedControlDescription, \"type\">,\n): control is ControlsSupportingMaxLength {\n\treturn control.type in allControlTypesSupportingMaxLength\n}\n\nexport function controlDescriptionFromVariable(\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tvariable: ArrayVariableDefinition,\n\tscopeType: ScopeType,\n): VerifiedArrayControlDescription\nexport function controlDescriptionFromVariable(\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tvariable: BooleanVariableDefinition,\n\tscopeType: ScopeType,\n): Extract<VerifiedControlDescription, { type: ControlType.Boolean }>\nexport function controlDescriptionFromVariable(\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tvariable: NumberVariableDefinition,\n\tscopeType: ScopeType,\n): Extract<VerifiedControlDescription, { type: ControlType.Number }>\nexport function controlDescriptionFromVariable(\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tvariable: ColorVariableDefinition,\n\tscopeType: ScopeType,\n): Extract<VerifiedControlDescription, { type: ControlType.Color }>\nexport function controlDescriptionFromVariable(\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tvariable: StringVariableDefinition,\n\tscopeType: ScopeType,\n): Extract<VerifiedControlDescription, { type: ControlType.String }>\nexport function controlDescriptionFromVariable(\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tvariable: RichTextVariableDefinition,\n\tscopeType: ScopeType,\n): Extract<VerifiedControlDescription, { type: ControlType.RichText }>\nexport function controlDescriptionFromVariable(\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tvariable: ImageVariableDefinition,\n\tscopeType: ScopeType,\n): Extract<VerifiedControlDescription, { type: ControlType.Image | ControlType.ResponsiveImage }>\nexport function controlDescriptionFromVariable(\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tvariable: EventHandlerVariableDefinition,\n\tscopeType: ScopeType,\n): Extract<VerifiedControlDescription, { type: ControlType.EventHandler }>\nexport function controlDescriptionFromVariable(\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tvariable: ControlReferenceVariableDefinition | NodePropertyControlReferenceVariableDefinition,\n\tscopeType: ScopeType,\n): VerifiedControlDescription | null\nexport function controlDescriptionFromVariable(\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tvariable: SlugVariableDefinition,\n\tscopeType: ScopeType,\n): Extract<VerifiedControlDescription, { type: ControlType.String }> | null\nexport function controlDescriptionFromVariable(\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tvariable: LinkVariableDefinition,\n\tscopeType: ScopeType,\n): Extract<VerifiedControlDescription, { type: ControlType.Link }>\nexport function controlDescriptionFromVariable(\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tvariable: TrackingIdVariableDefinition,\n\tscopeType: ScopeType,\n): Extract<VerifiedControlDescription, { type: ControlType.TrackingId }>\nexport function controlDescriptionFromVariable(\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tvariable: VectorSetItemVariableDefinition,\n\tscopeType: ScopeType,\n): Extract<VerifiedControlDescription, { type: ControlType.VectorSetItem }>\nexport function controlDescriptionFromVariable(\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tvariable: DateVariableDefinition,\n\tscopeType: ScopeType,\n): Extract<VerifiedControlDescription, { type: ControlType.Date }>\nexport function controlDescriptionFromVariable(\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tvariable: EnumVariableDefinition,\n\tscopeType: ScopeType,\n): Extract<VerifiedControlDescription, { type: ControlType.Enum }>\nexport function controlDescriptionFromVariable(\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tvariable: BorderVariableDefinition,\n\tscopeType: ScopeType,\n): Extract<VerifiedControlDescription, { type: ControlType.Border }>\nexport function controlDescriptionFromVariable(\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tvariable: LocationVariableDefinition,\n\tscopeType: ScopeType,\n): Extract<VerifiedControlDescription, { type: ControlType.Location }>\nexport function controlDescriptionFromVariable(\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tvariable: VariableDefinition,\n\tscopeType: ScopeType,\n): VariableControlDescription | null\nexport function controlDescriptionFromVariable(\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tvariable: TransitionVariableDefinition,\n\tscopeType: ScopeType,\n): Extract<VerifiedControlDescription, { type: ControlType.Transition }>\nexport function controlDescriptionFromVariable(\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tvariable: CursorVariableDefinition,\n\tscopeType: ScopeType,\n): Extract<VerifiedControlDescription, { type: ControlType.CustomCursor }>\nexport function controlDescriptionFromVariable(\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tvariable: BoxShadowVariableDefinition,\n\tscopeType: ScopeType,\n): Extract<VerifiedControlDescription, { type: ControlType.BoxShadow }>\nexport function controlDescriptionFromVariable(\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tvariable: VariableDefinition,\n\tscopeType: ScopeType,\n): VariableControlDescription | null {\n\tswitch (variable.type) {\n\t\tcase ControlType.Array:\n\t\t\treturn arrayControlDescription(tree, componentLoader, variable, scopeType)\n\t\tcase ControlType.Boolean:\n\t\t\treturn booleanControlDescription(variable, scopeType)\n\t\tcase ControlType.Number:\n\t\t\treturn numberControlDescription(variable, scopeType)\n\t\tcase ControlType.Color:\n\t\t\treturn colorControlDescription(variable)\n\t\tcase ControlType.String:\n\t\t\treturn stringControlDescription(variable, scopeType)\n\t\tcase ControlType.RichText:\n\t\t\treturn richTextControlDescription(variable)\n\t\tcase ControlType.Image:\n\t\t\treturn imageControlDescription(variable)\n\t\tcase ControlType.EventHandler:\n\t\t\treturn eventHandlerControlDescription(variable)\n\t\tcase ControlType.Link:\n\t\t\treturn linkControlDescription(variable)\n\t\tcase ControlType.LinkRelValues:\n\t\t\treturn linkRelValuesControlDescription(variable)\n\t\tcase ControlType.Date:\n\t\t\treturn dateControlDescription(variable, scopeType)\n\t\tcase ControlType.Enum:\n\t\t\treturn enumControlDescription(variable, scopeType)\n\t\tcase ControlType.File:\n\t\t\treturn fileControlDescription(variable)\n\t\tcase ControlType.ScrollSectionRef:\n\t\t\treturn scrollSectionRefControlDescription(variable)\n\t\tcase ControlType.CustomCursor:\n\t\t\treturn customCursorControlDescription(variable)\n\t\tcase ControlType.Cursor:\n\t\t\treturn cursorControlDescription(variable)\n\t\tcase ControlType.Transition:\n\t\t\treturn transitionControlDescription(variable)\n\t\tcase ControlType.Border:\n\t\t\treturn borderControlDescription(variable)\n\t\tcase ControlType.Location:\n\t\t\treturn locationControlDescription(variable)\n\t\tcase ControlType.BoxShadow:\n\t\t\treturn boxShadowControlDescription(variable)\n\t\tcase ControlType.Gap:\n\t\t\treturn gapControlDescription(variable)\n\t\tcase ControlType.Padding:\n\t\t\treturn paddingControlDescription(variable)\n\t\tcase ControlType.BorderRadius:\n\t\t\treturn borderRadiusControlDescription(variable)\n\t\tcase ControlType.CollectionReference:\n\t\t\treturn collectionReferenceControlDescription(variable, scopeType)\n\t\tcase ControlType.MultiCollectionReference:\n\t\t\treturn multiCollectionReferenceControlDescription(variable, scopeType)\n\t\tcase ControlType.TrackingId:\n\t\t\treturn trackingIdControlDescription(variable)\n\t\tcase ControlType.VectorSetItem:\n\t\t\treturn vectorSetItemControlDescription(variable)\n\t\tcase \"nodePropertyControlReference\":\n\t\tcase \"controlReference\":\n\t\t\treturn controlReferenceControlDescription(tree, componentLoader, variable, scopeType)\n\t\tcase \"slug\":\n\t\t\treturn slugControlDescription(tree, variable)\n\t\tdefault:\n\t\t\tassertNever(variable)\n\t}\n}\n\n// FIXME: The return type doesn't match the implementation. According to the\n// implementation. For example the function can return a VariableReference for\n// all control types, for enums it can also return a number, boolean, null, or\n// undefined, for rich text it can return a ReactElement.\nexport function getDefaultVariableValue(type: ControlType.Array, initialValue: unknown): StaticArrayControlPropValue\nexport function getDefaultVariableValue(type: ControlType.Boolean, initialValue: unknown): boolean\nexport function getDefaultVariableValue(type: ControlType.Color, initialValue: unknown): string\nexport function getDefaultVariableValue(type: ControlType.Image, initialValue: unknown): string\nexport function getDefaultVariableValue(type: ControlType.Number, initialValue: unknown): number\nexport function getDefaultVariableValue(type: ControlType.String, initialValue: unknown): string\nexport function getDefaultVariableValue(type: ControlType.RichText, initialValue: unknown): string\nexport function getDefaultVariableValue(type: ControlType.Link, initialValue: unknown): string\nexport function getDefaultVariableValue(\n\ttype: ControlType.LinkRelValues,\n\tinitialValue: unknown,\n): readonly SupportedLinkRelValue[] | undefined\nexport function getDefaultVariableValue(type: ControlType.Date, initialValue: unknown): string | undefined\nexport function getDefaultVariableValue(\n\ttype: ControlType.Enum | ControlType.SegmentedEnum,\n\tinitialValue: unknown,\n): string | undefined\nexport function getDefaultVariableValue(type: ControlType.File, initialValue: unknown): string | undefined\nexport function getDefaultVariableValue(type: ControlType.Transition, initialValue: unknown): Transition\nexport function getDefaultVariableValue(type: ControlType.Border, initialValue: unknown): BorderValues | undefined\nexport function getDefaultVariableValue(type: ControlType.Cursor, initialValue: unknown): CSSCursor\nexport function getDefaultVariableValue(type: ControlType.BoxShadow, initialValue: unknown): readonly BoxShadow[]\nexport function getDefaultVariableValue(type: ControlType.Gap, initialValue: unknown): TwoPixelNumberShorthand\nexport function getDefaultVariableValue(type: ControlType.Padding, initialValue: unknown): FourPixelNumberShorthand\nexport function getDefaultVariableValue(\n\ttype: ControlType.BorderRadius,\n\tinitialValue: unknown,\n): RelativeOrFourPixelNumberShorthand\nexport function getDefaultVariableValue(\n\ttype: ControlType.CollectionReference,\n\tinitialValue: unknown,\n): string | undefined\nexport function getDefaultVariableValue(\n\ttype: ControlType.MultiCollectionReference,\n\tinitialValue: unknown,\n): string[] | undefined\nexport function getDefaultVariableValue(type: ControlType.TrackingId, initialValue: unknown): string | undefined\nexport function getDefaultVariableValue(type: ControlType.VectorSetItem, initialValue: unknown): string | undefined\nexport function getDefaultVariableValue(type: ControlType.Location, value: unknown): Coordinate | undefined\nexport function getDefaultVariableValue(type: ControlType, initialValue: unknown): unknown\nexport function getDefaultVariableValue(type: ControlType, initialValue: unknown): unknown {\n\t// A DynamicValue is a valid property value, but variable initial values\n\t// cannot themselves reference other variables so we must use a fallback\n\t// here if this somehow occurs.\n\treturn isValidPropertyValueType(type, initialValue) && !isDynamicValue(initialValue)\n\t\t? initialValue\n\t\t: getFallbackValue(type)\n}\n\nexport function getDefaultNameForVariable(type: VariableType): string {\n\tswitch (type) {\n\t\tcase ControlType.Array:\n\t\t\treturn Dictionary.Array\n\t\tcase ControlType.Boolean:\n\t\t\treturn Dictionary.Featured\n\t\tcase ControlType.Color:\n\t\t\treturn \"Tint\"\n\t\tcase ControlType.Image:\n\t\t\treturn Dictionary.Image\n\t\tcase ControlType.Number:\n\t\t\treturn \"Count\"\n\t\tcase ControlType.String:\n\t\t\treturn Dictionary.Name\n\t\tcase ControlType.RichText:\n\t\t\treturn Dictionary.Content\n\t\tcase ControlType.Link:\n\t\t\treturn Dictionary.Link\n\t\tcase ControlType.LinkRelValues:\n\t\t\treturn Dictionary.LinkRel\n\t\tcase ControlType.Date:\n\t\t\treturn \"Date\"\n\t\tcase ControlType.Enum:\n\t\t\treturn Dictionary.Option\n\t\tcase ControlType.File:\n\t\t\treturn \"File\"\n\t\tcase ControlType.Gap:\n\t\t\treturn \"Gap\"\n\t\tcase ControlType.Padding:\n\t\t\treturn Dictionary.Padding\n\t\tcase ControlType.BorderRadius:\n\t\t\treturn Dictionary.Radius\n\t\tcase ControlType.CollectionReference:\n\t\t\treturn \"Reference\"\n\t\tcase ControlType.Location:\n\t\t\treturn Dictionary.Location\n\t\tcase ControlType.MultiCollectionReference:\n\t\t\treturn \"Multi-Reference\"\n\t\tcase ControlType.TrackingId:\n\t\t\treturn Dictionary.Tracking\n\t\tcase ControlType.VectorSetItem:\n\t\t\treturn Dictionary.Icon\n\t\tcase ControlType.EventHandler:\n\t\t\treturn Dictionary.Click\n\t\tcase ControlType.ScrollSectionRef:\n\t\t\treturn Dictionary.ScrollSection\n\t\tcase ControlType.CustomCursor:\n\t\tcase ControlType.Cursor:\n\t\t\treturn Dictionary.Cursor\n\t\tcase ControlType.Transition:\n\t\t\treturn Dictionary.Transition\n\t\tcase ControlType.Border:\n\t\t\treturn Dictionary.Border\n\t\tcase ControlType.BoxShadow:\n\t\t\treturn Dictionary.Shadow\n\t\tcase \"nodePropertyControlReference\":\n\t\tcase \"controlReference\":\n\t\t\t// Should never appear anywhere because control references can't be created by the user, only lifted\n\t\t\treturn \"Control Reference\"\n\t\tcase \"slug\":\n\t\t\treturn Dictionary.Slug\n\t}\n}\n\ninterface StringVariableDefinitionWithAssociatedVariable extends Omit<\n\tStringVariableDefinition,\n\t\"fallbackValue\" | \"associatedStringVariable\"\n> {\n\tfallbackValue: \"associatedVariable\"\n\tassociatedStringVariable: VariableID\n}\n\nexport function hasAssociatedStringVariable(\n\tvariable: StringVariableDefinition,\n): variable is StringVariableDefinitionWithAssociatedVariable {\n\treturn variable.fallbackValue === \"associatedVariable\" && !!variable.associatedStringVariable\n}\n\nexport function isCanvasScopeWithVariables<N extends CanvasNode>(\n\tnode: N | null | undefined,\n): node is N & (SmartComponentNode | LayoutTemplateNode | VectorSetNode | WebPageNode) {\n\tif (!node) return false\n\treturn isSmartComponentNode(node) || isLayoutTemplateNode(node) || isVectorSetNode(node) || isWebPageNode(node)\n}\n", "import type { FramerFontDefinition, FramerFontVariant } from \"library/render/fonts/FramerFontSource.ts\"\n\n/**\n * To get the framerusercontent URLs for Framer Fonts, the font first must be\n * uploaded to a \"Framer Custom Fonts\" team. The uploaded fonts\n * must be the same as the ones in src/app/vekter/src/app/fonts/\n *\n * Once uploaded, you can obtain the URLs be inspecting the network requests\n * and looking into the /assets request on load which contains the URL for a given\n * font.\n */\n\nconst InterBlackCyrillic = \"https://framerusercontent.com/assets/X5hj6qzcHUYv7h1390c8Rhm6550.woff2\"\nconst InterBlackCyrillicExt = \"https://framerusercontent.com/assets/mkY5Sgyq51ik0AMrSBwhm9DJg.woff2\"\nconst InterBlackGreek = \"https://framerusercontent.com/assets/cugnVhSraaRyANCaUtI5FV17wk.woff2\"\nconst InterBlackGreekExt = \"https://framerusercontent.com/assets/gQhNpS3tN86g8RcVKYUUaKt2oMQ.woff2\"\nconst InterBlackLatin = \"https://framerusercontent.com/assets/rZ5DdENNqIdFTIyQQiP5isO7M.woff2\"\nconst InterBlackLatinExt = \"https://framerusercontent.com/assets/5HcVoGak8k5agFJSaKa4floXVu0.woff2\"\nconst InterBlackVietnamese = \"https://framerusercontent.com/assets/P2Bw01CtL0b9wqygO0sSVogWbo.woff2\"\nconst InterBlack = \"https://framerusercontent.com/assets/nG3o4SDuA4BWwrtiguDyXfG6ajw.woff2\"\nconst InterBlackItalicCyrillic = \"https://framerusercontent.com/assets/ky8ovPukK4dJ1Pxq74qGhOqCYI.woff2\"\nconst InterBlackItalicCyrillicExt = \"https://framerusercontent.com/assets/05KsVHGDmqXSBXM4yRZ65P8i0s.woff2\"\nconst InterBlackItalicGreek = \"https://framerusercontent.com/assets/3ZmXbBKToJifDV9gwcifVd1tEY.woff2\"\nconst InterBlackItalicGreekExt = \"https://framerusercontent.com/assets/vvNSqIj42qeQ2bvCRBIWKHscrc.woff2\"\nconst InterBlackItalicLatin = \"https://framerusercontent.com/assets/gcnfba68tfm7qAyrWRCf9r34jg.woff2\"\nconst InterBlackItalicLatinExt = \"https://framerusercontent.com/assets/FNfhX3dt4ChuLJq2PwdlxHO7PU.woff2\"\nconst InterBlackItalicVietnamese = \"https://framerusercontent.com/assets/efTfQcBJ53kM2pB1hezSZ3RDUFs.woff2\"\nconst InterBlackItalic = \"https://framerusercontent.com/assets/LymiGJ4hx5TKP1rifbezrohbgck.woff2\"\nconst InterBoldCyrillic = \"https://framerusercontent.com/assets/4RAEQdEOrcnDkhHiiCbJOw92Lk.woff2\"\nconst InterBoldCyrillicExt = \"https://framerusercontent.com/assets/DpPBYI0sL4fYLgAkX8KXOPVt7c.woff2\"\nconst InterBoldGreek = \"https://framerusercontent.com/assets/tUSCtfYVM1I1IchuyCwz9gDdQ.woff2\"\nconst InterBoldGreekExt = \"https://framerusercontent.com/assets/1K3W8DizY3v4emK8Mb08YHxTbs.woff2\"\nconst InterBoldLatin = \"https://framerusercontent.com/assets/syRNPWzAMIrcJ3wIlPIP43KjQs.woff2\"\nconst InterBoldLatinExt = \"https://framerusercontent.com/assets/VgYFWiwsAC5OYxAycRXXvhze58.woff2\"\nconst InterBoldVietnamese = \"https://framerusercontent.com/assets/GIryZETIX4IFypco5pYZONKhJIo.woff2\"\nconst InterBold = \"https://framerusercontent.com/assets/ACEaYWisZIYMt1AMEVgshPgBBw.woff2\"\nconst InterBoldItalicCyrillic = \"https://framerusercontent.com/assets/u6gJwDuwB143kpNK1T1MDKDWkMc.woff2\"\nconst InterBoldItalicCyrillicExt = \"https://framerusercontent.com/assets/H89BbHkbHDzlxZzxi8uPzTsp90.woff2\"\nconst InterBoldItalicGreek = \"https://framerusercontent.com/assets/wccHG0r4gBDAIRhfHiOlq6oEkqw.woff2\"\nconst InterBoldItalicGreekExt = \"https://framerusercontent.com/assets/43sJ6MfOPh1LCJt46OvyDuSbA6o.woff2\"\nconst InterBoldItalicLatin = \"https://framerusercontent.com/assets/ia3uin3hQWqDrVloC1zEtYHWw.woff2\"\nconst InterBoldItalicLatinExt = \"https://framerusercontent.com/assets/WZ367JPwf9bRW6LdTHN8rXgSjw.woff2\"\nconst InterBoldItalicVietnamese = \"https://framerusercontent.com/assets/2A4Xx7CngadFGlVV4xrO06OBHY.woff2\"\nconst InterBoldItalic = \"https://framerusercontent.com/assets/of7m7CkW8MXVSnoJt6P1WHNTKWM.woff2\"\nconst InterExtraBoldCyrillic = \"https://framerusercontent.com/assets/zsnJN7Z1wdzUvepJniD3rbvJIyU.woff2\"\nconst InterExtraBoldCyrillicExt = \"https://framerusercontent.com/assets/PONfPc6h4EPYwJliXQBmjVx7QxI.woff2\"\nconst InterExtraBoldGreek = \"https://framerusercontent.com/assets/996sR9SfSDuYELz8oHhDOcErkY.woff2\"\nconst InterExtraBoldGreekExt = \"https://framerusercontent.com/assets/UrzZBOy7RyJEWAZGduzOeHiHuY.woff2\"\nconst InterExtraBoldLatin = \"https://framerusercontent.com/assets/Mput0MSwESKlJ6TMz9MPDXhgrk.woff2\"\nconst InterExtraBoldLatinExt = \"https://framerusercontent.com/assets/ftN1HpyPVJEoEb4q36SOrNdLXU.woff2\"\nconst InterExtraBoldVietnamese = \"https://framerusercontent.com/assets/JAur4lGGSGRGyrFi59JSIKqVgU.woff2\"\nconst InterExtraBold = \"https://framerusercontent.com/assets/lsNyHyko8O4SkkhZiNbOJ9Za0.woff2\"\nconst InterExtraBoldItalicCyrillic = \"https://framerusercontent.com/assets/GdJ7SQjcmkU1sz7lk5lMpKUlKY.woff2\"\nconst InterExtraBoldItalicCyrillicExt = \"https://framerusercontent.com/assets/if4nAQEfO1l3iBiurvlUSTaMA.woff2\"\nconst InterExtraBoldItalicGreek = \"https://framerusercontent.com/assets/zUCSsMbWBcHOQoATrhsPVigkc.woff2\"\nconst InterExtraBoldItalicGreekExt = \"https://framerusercontent.com/assets/sOA6LVskcCqlqggyjIZe0Zh39UQ.woff2\"\nconst InterExtraBoldItalicLatin = \"https://framerusercontent.com/assets/8AYN209PzikkmqPEbOGJlpgu6M.woff2\"\nconst InterExtraBoldItalicLatinExt = \"https://framerusercontent.com/assets/6eYp9yIAUvPZY7o0yfI4e2OP6g.woff2\"\nconst InterExtraBoldItalicVietnamese = \"https://framerusercontent.com/assets/L9nHaKi7ULzGWchEehsfwttxOwM.woff2\"\nconst InterExtraBoldItalic = \"https://framerusercontent.com/assets/KyBGXEv1BFKapgL5v6KC3i5I30.woff2\"\nconst InterExtraLightCyrillic = \"https://framerusercontent.com/assets/WXQXYfAQJIi2pCJACAfWWXfIDqI.woff2\"\nconst InterExtraLightCyrillicExt = \"https://framerusercontent.com/assets/MVhJhYeDWxeyqT939zMNyw9p8.woff2\"\nconst InterExtraLightGreek = \"https://framerusercontent.com/assets/4hBRAuM02i3fsxYDzyNvt5Az2so.woff2\"\nconst InterExtraLightGreekExt = \"https://framerusercontent.com/assets/RJeJJARdrtNUtic58kOz7hIgBuE.woff2\"\nconst InterExtraLightLatin = \"https://framerusercontent.com/assets/Z4sGWU2OKBoXPWulb5P25vULA.woff2\"\nconst InterExtraLightLatinExt = \"https://framerusercontent.com/assets/fz1JbBffNGgK7BNUI1mmbFBlgA8.woff2\"\nconst InterExtraLightVietnamese = \"https://framerusercontent.com/assets/eIZyQwIlHYR0mnMSneEDMtqBPgw.woff2\"\nconst InterExtraLight = \"https://framerusercontent.com/assets/JfsjWXOK3KasspnZwpcXaL2SXU.woff2\"\nconst InterExtraLightItalicCyrillic = \"https://framerusercontent.com/assets/bNYh7lNMEpOegeRYAtyGel1WqBE.woff2\"\nconst InterExtraLightItalicCyrillicExt = \"https://framerusercontent.com/assets/vpq17U0WM26sBGHgq9jnrUmUf8.woff2\"\nconst InterExtraLightItalicGreek = \"https://framerusercontent.com/assets/ua60IRqWK94xCrq0SC639Hbsdjg.woff2\"\nconst InterExtraLightItalicGreekExt = \"https://framerusercontent.com/assets/FBzcXZYmdulcZC0z278U6o0cw.woff2\"\nconst InterExtraLightItalicLatin = \"https://framerusercontent.com/assets/6OdIurwS6YHsVW2i5fR5CKn0gg.woff2\"\nconst InterExtraLightItalicLatinExt = \"https://framerusercontent.com/assets/Pd8gNPn2dSCh4FyjWFw9PJysoQ.woff2\"\nconst InterExtraLightItalicVietnamese = \"https://framerusercontent.com/assets/DtVQjTG8OGGKnwKYrMHRZVCyo.woff2\"\nconst InterExtraLightItalic = \"https://framerusercontent.com/assets/ap1coPIELrn34cLuJqketBUNM8.woff2\"\nconst InterItalicCyrillic = \"https://framerusercontent.com/assets/867QObYax8ANsfX4TGEVU9YiCM.woff2\"\nconst InterItalicCyrillicExt = \"https://framerusercontent.com/assets/CfMzU8w2e7tHgF4T4rATMPuWosA.woff2\"\nconst InterItalicGreek = \"https://framerusercontent.com/assets/cdAe8hgZ1cMyLu9g005pAW3xMo.woff2\"\nconst InterItalicGreekExt = \"https://framerusercontent.com/assets/Oyn2ZbENFdnW7mt2Lzjk1h9Zb9k.woff2\"\nconst InterItalicLatin = \"https://framerusercontent.com/assets/pKRFNWFoZl77qYCAIp84lN1h944.woff2\"\nconst InterItalicLatinExt = \"https://framerusercontent.com/assets/DOfvtmE1UplCq161m6Hj8CSQYg.woff2\"\nconst InterItalicVietnamese = \"https://framerusercontent.com/assets/tKtBcDnBMevsEEJKdNGhhkLzYo.woff2\"\nconst InterItalic = \"https://framerusercontent.com/assets/1JbOkuUhXKxkqtEfehWricQJaJQ.woff2\"\nconst InterLightCyrillic = \"https://framerusercontent.com/assets/zAMK70AQRFSShJgUiaR5IiIhgzk.woff2\"\nconst InterLightCyrillicExt = \"https://framerusercontent.com/assets/BkDpl4ghaqvMi1btKFyG2tdbec.woff2\"\nconst InterLightGreek = \"https://framerusercontent.com/assets/oLCoaT3ioA0fHdJnWR9W6k7NY.woff2\"\nconst InterLightGreekExt = \"https://framerusercontent.com/assets/IETjvc5qzUaRoaruDpPSwCUM8.woff2\"\nconst InterLightLatin = \"https://framerusercontent.com/assets/aqiiD4LUKkKzXdjGL5UzHq8bo5w.woff2\"\nconst InterLightLatinExt = \"https://framerusercontent.com/assets/Sj0PCHQSBjFmEp6NBWg6FNaKc.woff2\"\nconst InterLightVietnamese = \"https://framerusercontent.com/assets/H4TfENUY1rh8R9UaSD6vngjJP3M.woff2\"\nconst InterLight = \"https://framerusercontent.com/assets/5RC56WoPSimB0nUN68tRvT52pc.woff2\"\nconst InterLightItalicCyrillic = \"https://framerusercontent.com/assets/miJTzODdiyIr3tRo9KEoqXXk2PM.woff2\"\nconst InterLightItalicCyrillicExt = \"https://framerusercontent.com/assets/YYB6GZmCWnZq3RWZOghuZIOxQY.woff2\"\nconst InterLightItalicGreek = \"https://framerusercontent.com/assets/8sCN6PGUr4I8q5hC5twAXfcwqV0.woff2\"\nconst InterLightItalicGreekExt = \"https://framerusercontent.com/assets/6ZMhcggRFfEfbf7lncCpaUbA.woff2\"\nconst InterLightItalicLatin = \"https://framerusercontent.com/assets/8mwKwShtYEXIZ5diRBT74yn9jdQ.woff2\"\nconst InterLightItalicLatinExt = \"https://framerusercontent.com/assets/aUYDUTztS7anQw5JuwCncXeLOBY.woff2\"\nconst InterLightItalicVietnamese = \"https://framerusercontent.com/assets/yDiPvYxioBHsicnYxpPW35WQmx8.woff2\"\nconst InterLightItalic = \"https://framerusercontent.com/assets/pL8Kc8yEZ4G0R7o5HqiiYCyNpg.woff2\"\nconst InterMediumCyrillic = \"https://framerusercontent.com/assets/Qx95Xyt0Ka3SGhinnbXIGpEIyP4.woff2\"\nconst InterMediumCyrillicExt = \"https://framerusercontent.com/assets/5A3Ce6C9YYmCjpQx9M4inSaKU.woff2\"\nconst InterMediumGreek = \"https://framerusercontent.com/assets/xYYWaj7wCU5zSQH0eXvSaS19wo.woff2\"\nconst InterMediumGreekExt = \"https://framerusercontent.com/assets/6mJuEAguuIuMog10gGvH5d3cl8.woff2\"\nconst InterMediumLatin = \"https://framerusercontent.com/assets/UjlFhCnUjxhNfep4oYBPqnEssyo.woff2\"\nconst InterMediumLatinExt = \"https://framerusercontent.com/assets/otTaNuNpVK4RbdlT7zDDdKvQBA.woff2\"\nconst InterMediumVietnamese = \"https://framerusercontent.com/assets/DolVirEGb34pEXEp8t8FQBSK4.woff2\"\nconst InterMedium = \"https://framerusercontent.com/assets/ApCBb3GVWcHF7zo7LgD22hXocgo.woff2\"\nconst InterMediumItalicCyrillic = \"https://framerusercontent.com/assets/0E7IMbDzcGABpBwwqNEt60wU0w.woff2\"\nconst InterMediumItalicCyrillicExt = \"https://framerusercontent.com/assets/khkJkwSL66WFg8SX6Wa726c.woff2\"\nconst InterMediumItalicGreek = \"https://framerusercontent.com/assets/QrcNhgEPfRl0LS8qz5Ln8olanl8.woff2\"\nconst InterMediumItalicGreekExt = \"https://framerusercontent.com/assets/NTJ0nQgIF0gcDelS14zQ9NR9Q.woff2\"\nconst InterMediumItalicLatin = \"https://framerusercontent.com/assets/Bo5CNzBv77CafbxOtKIkpw9egw.woff2\"\nconst InterMediumItalicLatinExt = \"https://framerusercontent.com/assets/JEXmejW8mXOYMtt0hyRg811kHac.woff2\"\nconst InterMediumItalicVietnamese = \"https://framerusercontent.com/assets/uy9s0iWuxiNnVt8EpTI3gzohpwo.woff2\"\nconst InterMediumItalic = \"https://framerusercontent.com/assets/aguECCdqrzklw0uW2SWADvlcI.woff2\"\nconst InterRegularCyrillic = \"https://framerusercontent.com/assets/EOr0mi4hNtlgWNn9if640EZzXCo.woff2\"\nconst InterRegularCyrillicExt = \"https://framerusercontent.com/assets/5vvr9Vy74if2I6bQbJvbw7SY1pQ.woff2\"\nconst InterRegularGreek = \"https://framerusercontent.com/assets/OYrD2tBIBPvoJXiIHnLoOXnY9M.woff2\"\nconst InterRegularGreekExt = \"https://framerusercontent.com/assets/Y9k9QrlZAqio88Klkmbd8VoMQc.woff2\"\nconst InterRegularLatin = \"https://framerusercontent.com/assets/GrgcKwrN6d3Uz8EwcLHZxwEfC4.woff2\"\nconst InterRegularLatinExt = \"https://framerusercontent.com/assets/JeYwfuaPfZHQhEG8U5gtPDZ7WQ.woff2\"\nconst InterRegularVietnamese = \"https://framerusercontent.com/assets/b6Y37FthZeALduNqHicBT6FutY.woff2\"\nconst InterRegular = \"https://framerusercontent.com/assets/I3vvuIUcGf5qCtzlC6dFVOEtcQ.woff2\"\nconst InterSemiBoldCyrillic = \"https://framerusercontent.com/assets/NeGmSOXrPBfEFIy5YZeHq17LEDA.woff2\"\nconst InterSemiBoldCyrillicExt = \"https://framerusercontent.com/assets/hyOgCu0Xnghbimh0pE8QTvtt2AU.woff2\"\nconst InterSemiBoldGreek = \"https://framerusercontent.com/assets/lEJLP4R0yuCaMCjSXYHtJw72M.woff2\"\nconst InterSemiBoldGreekExt = \"https://framerusercontent.com/assets/oYaAX5himiTPYuN8vLWnqBbfD2s.woff2\"\nconst InterSemiBoldLatin = \"https://framerusercontent.com/assets/yDtI2UI8XcEg1W2je9XPN3Noo.woff2\"\nconst InterSemiBoldLatinExt = \"https://framerusercontent.com/assets/cRJyLNuTJR5jbyKzGi33wU9cqIQ.woff2\"\nconst InterSemiBoldVietnamese = \"https://framerusercontent.com/assets/A0Wcc7NgXMjUuFdquHDrIZpzZw0.woff2\"\nconst InterSemiBold = \"https://framerusercontent.com/assets/swkvpkCuf242vgQ1fmul6WFU7vI.woff2\"\nconst InterSemiBoldItalicCyrillic = \"https://framerusercontent.com/assets/zSsEuoJdh8mcFVk976C05ZfQr8.woff2\"\nconst InterSemiBoldItalicCyrillicExt = \"https://framerusercontent.com/assets/vxBnBhH8768IFAXAb4Qf6wQHKs.woff2\"\nconst InterSemiBoldItalicGreek = \"https://framerusercontent.com/assets/mvNEIBLyHbscgHtwfsByjXUz3XY.woff2\"\nconst InterSemiBoldItalicGreekExt = \"https://framerusercontent.com/assets/b8ezwLrN7h2AUoPEENcsTMVJ0.woff2\"\nconst InterSemiBoldItalicLatin = \"https://framerusercontent.com/assets/fuyXZpVvOjq8NesCOfgirHCWyg.woff2\"\nconst InterSemiBoldItalicLatinExt = \"https://framerusercontent.com/assets/6FI2EneKzM3qBy5foOZXey7coCA.woff2\"\nconst InterSemiBoldItalicVietnamese = \"https://framerusercontent.com/assets/NHHeAKJVP0ZWHk5YZnQQChIsBM.woff2\"\nconst InterSemiBoldItalic = \"https://framerusercontent.com/assets/M50NrwMmOuC0I4Cji1E0zQbZYQ.woff2\"\nconst InterThinCyrillic = \"https://framerusercontent.com/assets/5CcgcVyoWSqO1THBiISd6oCog.woff2\"\nconst InterThinCyrillicExt = \"https://framerusercontent.com/assets/NXxvFRoY5LDh3yCm7MEP2jqYk.woff2\"\nconst InterThinGreek = \"https://framerusercontent.com/assets/TNtxudDBkAm2RXdtU3rvTBwoM.woff2\"\nconst InterThinGreekExt = \"https://framerusercontent.com/assets/MF544SVCvk3yNpLIz3pwDXFZPKM.woff2\"\nconst InterThinLatin = \"https://framerusercontent.com/assets/8kSLqTnVCEtjx0nu8PxTD4Nh5UU.woff2\"\nconst InterThinLatinExt = \"https://framerusercontent.com/assets/fIabp4VN5z7iJ3lNOz9qfNeQHc.woff2\"\nconst InterThinVietnamese = \"https://framerusercontent.com/assets/9iRSYClnXA0RMygyIn6yjjWXJw.woff2\"\nconst InterThin = \"https://framerusercontent.com/assets/OHDlG9QU5m7j9Q8kiEUmYp31HE.woff2\"\nconst InterThinItalicCyrillic = \"https://framerusercontent.com/assets/oJJMyJlDykMObEyb5VexHSxd24.woff2\"\nconst InterThinItalicCyrillicExt = \"https://framerusercontent.com/assets/YJsHMqeEm0oDHuxRTVCwg5eZuo.woff2\"\nconst InterThinItalicGreek = \"https://framerusercontent.com/assets/KCj1bV3vDXY5OLHttTeRYcu9J8.woff2\"\nconst InterThinItalicGreekExt = \"https://framerusercontent.com/assets/IpeaX0WzLaonj68howNZg4SJJaY.woff2\"\nconst InterThinItalicLatin = \"https://framerusercontent.com/assets/3on0VNjjmogkq1f9ziKFcrY72MI.woff2\"\nconst InterThinItalicLatinExt = \"https://framerusercontent.com/assets/biaVHhOprxbHaR3dIP7Z8cYurHg.woff2\"\nconst InterThinItalicVietnamese = \"https://framerusercontent.com/assets/gNa011yWpVpNFgUhhSlDX8nUiPQ.woff2\"\nconst InterThinItalic = \"https://framerusercontent.com/assets/eL1Loa3BU9WncB3tQ78R5CvH54.woff2\"\nconst InterVariableCyrillic = \"https://framerusercontent.com/assets/ZRl8AlxwsX1m7xS1eJCiSPbztg.woff2\"\nconst InterVariableCyrillicExt = \"https://framerusercontent.com/assets/mYcqTSergLb16PdbJJQMl9ebYm4.woff2\"\nconst InterVariableGreek = \"https://framerusercontent.com/assets/DYHjxG0qXjopUuruoacfl5SA.woff2\"\nconst InterVariableGreekExt = \"https://framerusercontent.com/assets/nhSQpBRqFmXNUBY2p5SENQ8NplQ.woff2\"\nconst InterVariableLatin = \"https://framerusercontent.com/assets/7lw0VWkeXrGYJT05oB3DsFy8BaY.woff2\"\nconst InterVariableLatinExt = \"https://framerusercontent.com/assets/s7NH6sl7w4NU984r5hcmo1tPSYo.woff2\"\nconst InterVariableVietnamese = \"https://framerusercontent.com/assets/wx5nfqEgOXnxuFaxB0Mn9OhmcZA.woff2\"\nconst InterVariable = \"https://framerusercontent.com/assets/nvXX0oklueAhP2e4EFhw4Kt5xE.woff2\"\nconst InterVariableItalicCyrillic = \"https://framerusercontent.com/assets/XRXDXcGEcHEhj5vRoCcaNzLUII.woff2\"\nconst InterVariableItalicCyrillicExt = \"https://framerusercontent.com/assets/FMAZXZOvzvP9daUF2pk7jeNQE.woff2\"\nconst InterVariableItalicGreek = \"https://framerusercontent.com/assets/LfqxQLLXCFxnUuZS8fkv9AT0uI.woff2\"\nconst InterVariableItalicGreekExt = \"https://framerusercontent.com/assets/WL8JiibS9vHU7Cb3NGaJKioRjQ.woff2\"\nconst InterVariableItalicLatin = \"https://framerusercontent.com/assets/N9O1YBTY0ROZrE0GiMsoMSyPbQ.woff2\"\nconst InterVariableItalicLatinExt = \"https://framerusercontent.com/assets/3IqofWpyruZr7Qc3kaedPmw7o.woff2\"\nconst InterVariableItalicVietnamese = \"https://framerusercontent.com/assets/Qpek1Wzh1dJ3f8j88Vebg4yC92w.woff2\"\nconst InterVariableItalic = \"https://framerusercontent.com/assets/YwhyaqyP4ZpQDG8tYS9heVw0g0E.woff2\"\n\nconst InterDisplayBlackCyrillic = \"https://framerusercontent.com/assets/TMYuLEOqLWgunxD5qCFeADEgk.woff2\"\nconst InterDisplayBlackCyrillicExt = \"https://framerusercontent.com/assets/EZSFVoaPWKnZ6GuVk5dlS5pk.woff2\"\nconst InterDisplayBlackGreek = \"https://framerusercontent.com/assets/vSoBOmgqFUd0rVCgogjwL7jQI.woff2\"\nconst InterDisplayBlackGreekExt = \"https://framerusercontent.com/assets/EL4v8OG6t2XwHSJLO1YF25DNiDw.woff2\"\nconst InterDisplayBlackLatin = \"https://framerusercontent.com/assets/x8eJ5VkmPMHVhVbF0E8JYFJmwc.woff2\"\nconst InterDisplayBlackLatinExt = \"https://framerusercontent.com/assets/bIwBTbnyeAOa9wQIBagEdRDHXhE.woff2\"\nconst InterDisplayBlackVietnamese = \"https://framerusercontent.com/assets/fmXYBApyDC604dR7g2aaACGvCk.woff2\"\nconst InterDisplayBlack = \"https://framerusercontent.com/assets/bAAFvHK7fkWe7TxLp8mIU5yeLzs.woff2\"\nconst InterDisplayBlackItalicCyrillic = \"https://framerusercontent.com/assets/UHqhq621TbUtspKtPKPA1Ne8qY.woff2\"\nconst InterDisplayBlackItalicCyrillicExt = \"https://framerusercontent.com/assets/yHWoQPBZSEiCC3aW3JXtcoFby8o.woff2\"\nconst InterDisplayBlackItalicGreek = \"https://framerusercontent.com/assets/TQqnntSFYYGDv7XtyT3ZhfvDA.woff2\"\nconst InterDisplayBlackItalicGreekExt = \"https://framerusercontent.com/assets/6dsy2CbviAWDcszGLlgyaLpRMk.woff2\"\nconst InterDisplayBlackItalicLatin = \"https://framerusercontent.com/assets/U1kEiQQO1ar9PuYJyyRkclmq8o.woff2\"\nconst InterDisplayBlackItalicLatinExt = \"https://framerusercontent.com/assets/nE03Xxh2GngsU8hDpg6CRGxqfoM.woff2\"\nconst InterDisplayBlackItalicVietnamese = \"https://framerusercontent.com/assets/dWFiPjtJpfcxAIDV8RPyuCq04.woff2\"\nconst InterDisplayBlackItalic = \"https://framerusercontent.com/assets/9FKMKuIbLSuF8l3BOjXdlis7a0.woff2\"\nconst InterDisplayBoldCyrillic = \"https://framerusercontent.com/assets/UjFZPDy3qGuDktQM4q9CxhKfIa8.woff2\"\nconst InterDisplayBoldCyrillicExt = \"https://framerusercontent.com/assets/I11LrmuBDQZweplJ62KkVsklU5Y.woff2\"\nconst InterDisplayBoldGreek = \"https://framerusercontent.com/assets/UTeedEK21hO5jDxEUldzdScUqpg.woff2\"\nconst InterDisplayBoldGreekExt = \"https://framerusercontent.com/assets/8exwVHJy2DhJ4N5prYlVMrEKmQ.woff2\"\nconst InterDisplayBoldLatin = \"https://framerusercontent.com/assets/qITWJ2WdG0wrgQPDb8lvnYnTXDg.woff2\"\nconst InterDisplayBoldLatinExt = \"https://framerusercontent.com/assets/Ig8B8nzy11hzIWEIYnkg91sofjo.woff2\"\nconst InterDisplayBoldVietnamese = \"https://framerusercontent.com/assets/qctQFoJqJ9aIbRSIp0AhCQpFxn8.woff2\"\nconst InterDisplayBold = \"https://framerusercontent.com/assets/ChDvB6Z6QNg8Fzr69XEVBBBJg.woff2\"\nconst InterDisplayBoldItalicCyrillic = \"https://framerusercontent.com/assets/7pScaNeb6M7n2HF2jKemDqzCIr4.woff2\"\nconst InterDisplayBoldItalicCyrillicExt = \"https://framerusercontent.com/assets/fXvVh2JeZlehNcEhKHpHH0frSl0.woff2\"\nconst InterDisplayBoldItalicGreek = \"https://framerusercontent.com/assets/VfD2n20yM7v0hrUEBHEyafsmMBY.woff2\"\nconst InterDisplayBoldItalicGreekExt = \"https://framerusercontent.com/assets/qS4UjQYyATcVV9rODk0Zx9KhkY8.woff2\"\nconst InterDisplayBoldItalicLatin = \"https://framerusercontent.com/assets/MzumQQZJQBC6KM1omtmwOtsogtI.woff2\"\nconst InterDisplayBoldItalicLatinExt = \"https://framerusercontent.com/assets/4oIO9fB59bn3cKFWz7piCj28z9s.woff2\"\nconst InterDisplayBoldItalicVietnamese = \"https://framerusercontent.com/assets/F5Lmfd3fCAu7TwiYbI4DLWw4ks.woff2\"\nconst InterDisplayBoldItalic = \"https://framerusercontent.com/assets/4TOjq7qxUECIaAMkiDNuRcpOAwc.woff2\"\nconst InterDisplayExtraBoldCyrillic = \"https://framerusercontent.com/assets/e97VFGU1js4GGgvQCnvIiHpRf0.woff2\"\nconst InterDisplayExtraBoldCyrillicExt = \"https://framerusercontent.com/assets/RDJfWXA0aFdpD2OO2AJLBh2Z7E.woff2\"\nconst InterDisplayExtraBoldGreek = \"https://framerusercontent.com/assets/Kc2pkIGjh9K7EmlGx2sorKHcJDw.woff2\"\nconst InterDisplayExtraBoldGreekExt = \"https://framerusercontent.com/assets/9WZaFuMg9OiQ7an8bugAJkUG04.woff2\"\nconst InterDisplayExtraBoldLatin = \"https://framerusercontent.com/assets/9Nu9BRcGkRrLnJCGqVdSUXJt2Ig.woff2\"\nconst InterDisplayExtraBoldLatinExt = \"https://framerusercontent.com/assets/pFve2DToKu0uyKsWs4NBTHpK7Vc.woff2\"\nconst InterDisplayExtraBoldVietnamese = \"https://framerusercontent.com/assets/4hhgqiTCDCCa8WhFmTB7QXODupk.woff2\"\nconst InterDisplayExtraBold = \"https://framerusercontent.com/assets/aOXtl8JlHovl07vg1Tyem5mGnY.woff2\"\nconst InterDisplayExtraBoldItalicCyrillic = \"https://framerusercontent.com/assets/xPVm3TFQkuvdIaC7nzaBBAiE5Y.woff2\"\nconst InterDisplayExtraBoldItalicCyrillicExt = \"https://framerusercontent.com/assets/toNasQAsgu8B7dP8n9xdXRzdNhU.woff2\"\nconst InterDisplayExtraBoldItalicGreek = \"https://framerusercontent.com/assets/oG51mTqVfF2JDETyCzOOIQOpzY.woff2\"\nconst InterDisplayExtraBoldItalicGreekExt = \"https://framerusercontent.com/assets/xwWV9Y5bwNwM4PjHKFG1XmdwA.woff2\"\nconst InterDisplayExtraBoldItalicLatin = \"https://framerusercontent.com/assets/QTKFuIAPTQlFFMI0HG9beHs3Xc.woff2\"\nconst InterDisplayExtraBoldItalicLatinExt = \"https://framerusercontent.com/assets/1aaySnsnw0pKE2qUemKvHaM1tw.woff2\"\nconst InterDisplayExtraBoldItalicVietnamese = \"https://framerusercontent.com/assets/gLJVFeatQcrirAaS7jqVJIO4.woff2\"\nconst InterDisplayExtraBoldItalic = \"https://framerusercontent.com/assets/Wpgo7gB3rpDzc0gVOA81XW3rmw4.woff2\"\nconst InterDisplayExtraLightCyrillic = \"https://framerusercontent.com/assets/zLXnIInNs9VhCJZQ1B0FvHgtWDM.woff2\"\nconst InterDisplayExtraLightCyrillicExt = \"https://framerusercontent.com/assets/kZK78sVb0ChIxwI4EF00ArQvpu0.woff2\"\nconst InterDisplayExtraLightGreek = \"https://framerusercontent.com/assets/w3wwH92cnNPcZVAf63gAmGQW0k.woff2\"\nconst InterDisplayExtraLightGreekExt = \"https://framerusercontent.com/assets/yHa3FUh9QDCLkYGoHU44PsRbTI.woff2\"\nconst InterDisplayExtraLightLatin = \"https://framerusercontent.com/assets/t5RNiwIqoB2GvYhcdv6NPQF6kfk.woff2\"\nconst InterDisplayExtraLightLatinExt = \"https://framerusercontent.com/assets/w9aHRXFhel7kScIgRMsPqEwE3AY.woff2\"\nconst InterDisplayExtraLightVietnamese = \"https://framerusercontent.com/assets/eDNmF3DmGWYDX8NrhNZOl1SDyQ.woff2\"\nconst InterDisplayExtraLight = \"https://framerusercontent.com/assets/yWwCs5XhjMlulYonQa7qlToc.woff2\"\nconst InterDisplayExtraLightItalicCyrillic = \"https://framerusercontent.com/assets/FuEG87bF2T2uEeI84KQYYAE9wA.woff2\"\nconst InterDisplayExtraLightItalicCyrillicExt = \"https://framerusercontent.com/assets/7b925B3vAlG2atcrbV7LoSudp7c.woff2\"\nconst InterDisplayExtraLightItalicGreek = \"https://framerusercontent.com/assets/PjAOIKsdFTryeYPWcKg4xHgWCTI.woff2\"\nconst InterDisplayExtraLightItalicGreekExt = \"https://framerusercontent.com/assets/l72nQILmlFUAK8OXlvJB8Qybl2M.woff2\"\nconst InterDisplayExtraLightItalicLatin = \"https://framerusercontent.com/assets/OxW7bkxVYziGRnONbuXLAeuUEkQ.woff2\"\nconst InterDisplayExtraLightItalicLatinExt = \"https://framerusercontent.com/assets/5u1LyW8isA2RA3QfYvCc6TVeGSU.woff2\"\nconst InterDisplayExtraLightItalicVietnamese = \"https://framerusercontent.com/assets/vFOa28RMJNgff4GnWLns8E8vGZw.woff2\"\nconst InterDisplayExtraLightItalic = \"https://framerusercontent.com/assets/YBYIhVC2I1JAh7dqd0J6Zm2koqY.woff2\"\nconst InterDisplayItalicCyrillic = \"https://framerusercontent.com/assets/sQxGYWDlRkDr0eOKqiNRl6g5rs.woff2\"\nconst InterDisplayItalicCyrillicExt = \"https://framerusercontent.com/assets/THWAFHoAcmqLMy81E8hCSdziVKA.woff2\"\nconst InterDisplayItalicGreek = \"https://framerusercontent.com/assets/P2qr9PAWBt905929rHfxmneMUG0.woff2\"\nconst InterDisplayItalicGreekExt = \"https://framerusercontent.com/assets/NNTAT1XAm8ZRkr824inYPkjNeL4.woff2\"\nconst InterDisplayItalicLatin = \"https://framerusercontent.com/assets/P0JCAnd2N1Q6qwTQohre3XmQ.woff2\"\nconst InterDisplayItalicLatinExt = \"https://framerusercontent.com/assets/2BmSa4TZZvFKAZg2DydxTbvKlTU.woff2\"\nconst InterDisplayItalicVietnamese = \"https://framerusercontent.com/assets/KMFW46iYsEZaUBwXbwPc9nQm71o.woff2\"\nconst InterDisplayItalic = \"https://framerusercontent.com/assets/I9ty8kkDQliLNKnPqUFTMcu2uVs.woff2\"\nconst InterDisplayLightCyrillic = \"https://framerusercontent.com/assets/fEqgEChcTaneQFxeugexHq7Bk.woff2\"\nconst InterDisplayLightCyrillicExt = \"https://framerusercontent.com/assets/MaMAn5Jp5gJg1z3VaLH65QwWPLc.woff2\"\nconst InterDisplayLightGreek = \"https://framerusercontent.com/assets/YOHXUQlY1iC2t7qT4HeLSoBDtn4.woff2\"\nconst InterDisplayLightGreekExt = \"https://framerusercontent.com/assets/nL7d8Ph0ViwUQorApF89PoAagQI.woff2\"\nconst InterDisplayLightLatin = \"https://framerusercontent.com/assets/CnMzVKZxLPB68RITfNGUfLe65m4.woff2\"\nconst InterDisplayLightLatinExt = \"https://framerusercontent.com/assets/TfzHIi6ZmZDuhnIFGcgM6Ipuim4.woff2\"\nconst InterDisplayLightVietnamese = \"https://framerusercontent.com/assets/ub5XwqqEAMrXQz31ej6fNqbxnBc.woff2\"\nconst InterDisplayLight = \"https://framerusercontent.com/assets/ylVq1FlpuwAKWbNuITwLhihuRI.woff2\"\nconst InterDisplayLightItalicCyrillic = \"https://framerusercontent.com/assets/GeFYhvsobZhw8u0Xza2zCmC8Cw.woff2\"\nconst InterDisplayLightItalicCyrillicExt = \"https://framerusercontent.com/assets/JVGAsgKKXCCsDQ3MCrxIs5u1U.woff2\"\nconst InterDisplayLightItalicGreek = \"https://framerusercontent.com/assets/f2kclCrwmFV8YeznrosrT3kcjE.woff2\"\nconst InterDisplayLightItalicGreekExt = \"https://framerusercontent.com/assets/8dxmIktsyEgZt0OloSu5gz6TgLI.woff2\"\nconst InterDisplayLightItalicLatin = \"https://framerusercontent.com/assets/raPlI8zqlyoXu4yBGiiecGg2dI.woff2\"\nconst InterDisplayLightItalicLatinExt = \"https://framerusercontent.com/assets/HTPyW5jOpXfwIja9CrgNJUDriY4.woff2\"\nconst InterDisplayLightItalicVietnamese = \"https://framerusercontent.com/assets/xFtzow8wtMpaEQuIGgCbt25Qorg.woff2\"\nconst InterDisplayLightItalic = \"https://framerusercontent.com/assets/J5iPOM1MLClTWdiblC3Zdqh8.woff2\"\nconst InterDisplayMediumCyrillic = \"https://framerusercontent.com/assets/V3j1L0o5vPFKe26Sw4HcpXCfHo.woff2\"\nconst InterDisplayMediumCyrillicExt = \"https://framerusercontent.com/assets/ePuN3mCjzajIHnyCdvKBFiZkyY0.woff2\"\nconst InterDisplayMediumGreek = \"https://framerusercontent.com/assets/0iDmxkizU9goZoclqIqsV5rvETU.woff2\"\nconst InterDisplayMediumGreekExt = \"https://framerusercontent.com/assets/F3kdpd2N0cToWV5huaZjjgM.woff2\"\nconst InterDisplayMediumLatin = \"https://framerusercontent.com/assets/iwWTDc49ENF2tCHbqlNARXw6Ug.woff2\"\nconst InterDisplayMediumLatinExt = \"https://framerusercontent.com/assets/r0mv3NegmA0akcQsNFotG32Las.woff2\"\nconst InterDisplayMediumVietnamese = \"https://framerusercontent.com/assets/Ii21jnSJkulBKsHHXKlapi7fv9w.woff2\"\nconst InterDisplayMedium = \"https://framerusercontent.com/assets/dyI9GRZNPT6RPMtpCuOKQBJ0VW0.woff2\"\nconst InterDisplayMediumItalicCyrillic = \"https://framerusercontent.com/assets/vuPfygr1n1zYxscvWgGI8hRf3LE.woff2\"\nconst InterDisplayMediumItalicCyrillicExt = \"https://framerusercontent.com/assets/A5P4nkYCJlLQxGxaS1lzG8PNSc.woff2\"\nconst InterDisplayMediumItalicGreek = \"https://framerusercontent.com/assets/sSIKP2TfVPvfK7YVENPE5H87A.woff2\"\nconst InterDisplayMediumItalicGreekExt = \"https://framerusercontent.com/assets/jplzYzqFHXreyADwk9yrkQlWQ.woff2\"\nconst InterDisplayMediumItalicLatin = \"https://framerusercontent.com/assets/RkMAGv2iAm3rw7tZzs7FaZf0rM.woff2\"\nconst InterDisplayMediumItalicLatinExt = \"https://framerusercontent.com/assets/gawbeo7iEJSRZ4kcrh6YRrU8o.woff2\"\nconst InterDisplayMediumItalicVietnamese = \"https://framerusercontent.com/assets/8E92vrr3j1gDqzepmeSbD2u0JxA.woff2\"\nconst InterDisplayMediumItalic = \"https://framerusercontent.com/assets/kHY4OQ0EcoeRo4aMeM9szO64.woff2\"\nconst InterDisplayRegularCyrillic = \"https://framerusercontent.com/assets/Zwfz6xbVe5pmcWRJRgBDHnMkOkI.woff2\"\nconst InterDisplayRegularCyrillicExt = \"https://framerusercontent.com/assets/2uIBiALfCHVpWbHqRMZutfT7giU.woff2\"\nconst InterDisplayRegularGreek = \"https://framerusercontent.com/assets/tVew2LzXJ1t7QfxP1gdTIdj2o0g.woff2\"\nconst InterDisplayRegularGreekExt = \"https://framerusercontent.com/assets/U9LaDDmbRhzX3sB8g8glTy5feTE.woff2\"\nconst InterDisplayRegularLatin = \"https://framerusercontent.com/assets/bHYNJqzTyl2lqvmMiRRS6Y16Es.woff2\"\nconst InterDisplayRegularLatinExt = \"https://framerusercontent.com/assets/DF7bjCRmStYPqSb945lAlMfCCVQ.woff2\"\nconst InterDisplayRegularVietnamese = \"https://framerusercontent.com/assets/vebZUMjGyKkYsfcY73iwWTzLNag.woff2\"\nconst InterDisplayRegular = \"https://framerusercontent.com/assets/XMkvXivlrESQyJ5X32wCgbcpSs.woff2\"\nconst InterDisplaySemiBoldCyrillic = \"https://framerusercontent.com/assets/pe8RoujoPxuTZhqoNzYqHX2MXA.woff2\"\nconst InterDisplaySemiBoldCyrillicExt = \"https://framerusercontent.com/assets/gazZKZuUEtvr9ULhdA4SprP0AZ0.woff2\"\nconst InterDisplaySemiBoldGreek = \"https://framerusercontent.com/assets/qQHxgTnEk6Czu1yW4xS82HQWFOk.woff2\"\nconst InterDisplaySemiBoldGreekExt = \"https://framerusercontent.com/assets/teGhWnhH3bCqefKGsIsqFy3hK8.woff2\"\nconst InterDisplaySemiBoldLatin = \"https://framerusercontent.com/assets/PfdOpgzFf7N2Uye9JX7xRKYTgSc.woff2\"\nconst InterDisplaySemiBoldLatinExt = \"https://framerusercontent.com/assets/MJ3N6lfN4iP5Um8rJGqLYl03tE.woff2\"\nconst InterDisplaySemiBoldVietnamese = \"https://framerusercontent.com/assets/0SEEmmWc3vovhaai4RlRQSWRrz0.woff2\"\nconst InterDisplaySemiBold = \"https://framerusercontent.com/assets/V2Mt2NtoauWDg1T4W7B9jTw2eg.woff2\"\nconst InterDisplaySemiBoldItalicCyrillic = \"https://framerusercontent.com/assets/ugFYeIKZEJXDxI6Kh0YQUX6EK9I.woff2\"\nconst InterDisplaySemiBoldItalicCyrillicExt = \"https://framerusercontent.com/assets/KKQXBq6BF0xEmVbrTnWxh3Yw.woff2\"\nconst InterDisplaySemiBoldItalicGreek = \"https://framerusercontent.com/assets/2yEyxokC6poTg3Uc5E2ogfVi6WE.woff2\"\nconst InterDisplaySemiBoldItalicGreekExt = \"https://framerusercontent.com/assets/DgDysCLt0HkIpWMu2uN5tivgQ.woff2\"\nconst InterDisplaySemiBoldItalicLatin = \"https://framerusercontent.com/assets/e3ySEnhUUpItjJUo5buJawUl4Y.woff2\"\nconst InterDisplaySemiBoldItalicLatinExt = \"https://framerusercontent.com/assets/wmHLUqO4QxLaADUScavxvknnBQ.woff2\"\nconst InterDisplaySemiBoldItalicVietnamese = \"https://framerusercontent.com/assets/DuYGXsyDXsSnxlZ8qzmcA4x3JiI.woff2\"\nconst InterDisplaySemiBoldItalic = \"https://framerusercontent.com/assets/is8WkSz2Vl0QifNy04SxFJwO6R8.woff2\"\nconst InterDisplayThinCyrillic = \"https://framerusercontent.com/assets/eOWZqb2nQ1SLbtYmcGBFYFSOE5U.woff2\"\nconst InterDisplayThinCyrillicExt = \"https://framerusercontent.com/assets/Vu4RH4OOAYHIXg4LpXVzNVmbpY.woff2\"\nconst InterDisplayThinGreek = \"https://framerusercontent.com/assets/sMud1BrfhejzYfhsGoUtjWdRb90.woff2\"\nconst InterDisplayThinGreekExt = \"https://framerusercontent.com/assets/H0Z3dXk6VFBv9TPQedY7FZVVVQ.woff2\"\nconst InterDisplayThinLatin = \"https://framerusercontent.com/assets/GoWsxcsKZ1Hiy2Y8l40zBgNwYvo.woff2\"\nconst InterDisplayThinLatinExt = \"https://framerusercontent.com/assets/SDel4nEmK9AyiBktaYZfYI9DrY.woff2\"\nconst InterDisplayThinVietnamese = \"https://framerusercontent.com/assets/iPDparXDXhfwSxmuiEXzr0b1vAU.woff2\"\nconst InterDisplayThin = \"https://framerusercontent.com/assets/x8NcnzUXMxLvCAlSdfqOBJLMI.woff2\"\nconst InterDisplayThinItalicCyrillic = \"https://framerusercontent.com/assets/syX0favWwGMDkTs34aSUJp2FDg.woff2\"\nconst InterDisplayThinItalicCyrillicExt = \"https://framerusercontent.com/assets/fWaKVy6hRB8Z8aBaXHMiFEvPILU.woff2\"\nconst InterDisplayThinItalicGreek = \"https://framerusercontent.com/assets/dkR8k5Cze1rY2rQWCcFiLvNxm8M.woff2\"\nconst InterDisplayThinItalicGreekExt = \"https://framerusercontent.com/assets/MRDnh8epalyri0qENYQVaYkjNjA.woff2\"\nconst InterDisplayThinItalicLatin = \"https://framerusercontent.com/assets/mKzAiDvphQ1qAmJcRwlQ0QOK3Dc.woff2\"\nconst InterDisplayThinItalicLatinExt = \"https://framerusercontent.com/assets/3RO0kKTqHkJmvsJcJAr5at0.woff2\"\nconst InterDisplayThinItalicVietnamese = \"https://framerusercontent.com/assets/GSo3TkcX0SwmUNLnnUlsKhqgZI.woff2\"\nconst InterDisplayThinItalic = \"https://framerusercontent.com/assets/YAd3BhG5LtrOlgXPwVb23S5k.woff2\"\n\nconst subsetCyrillicExt = \"U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F\"\nconst subsetCyrillic = \"U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116\"\nconst subsetGreekExt = \"U+1F00-1FFF\"\nconst subsetGreek = \"U+0370-03FF\"\nconst subsetLatinExt =\n\t\"U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF\"\nconst subsetLatin =\n\t\"U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2070, U+2074-207E, U+2080-208E, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD\"\nconst subsetVietnamese =\n\t\"U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB\"\n\n// Note: Inter font selectors don\u2019t have a prefix for historical reasons.\n// However, if you ever add a new font, consider adding a prefix like `FR;` to\n// clearly distinguish Framer fonts from other fonts.\nexport const INTER_FONTS: FramerFontDefinition[] = [\n\t{\n\t\tuiFamilyName: \"Inter\",\n\t\tcssFamilyName: \"Inter\",\n\t\tvariant: \"Regular\",\n\t\tselector: \"Inter\",\n\t\tweight: 400,\n\t\tstyle: \"normal\",\n\t\tselectorBold: \"Inter-Bold\",\n\t\tselectorBoldItalic: \"Inter-BoldItalic\",\n\t\tselectorItalic: \"Inter-Italic\",\n\t\tselectorVariable: \"Inter-Variable\",\n\t\tselectorVariableItalic: \"Inter-VariableItalic\",\n\t\tfile: InterRegular,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterRegularCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterRegularCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterRegularGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterRegularGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterRegularLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterRegularLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterRegularVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter\",\n\t\tcssFamilyName: \"Inter\",\n\t\tvariant: \"Thin\",\n\t\tselector: \"Inter-Thin\",\n\t\tweight: 100,\n\t\tstyle: \"normal\",\n\t\tselectorBold: \"Inter\",\n\t\tselectorBoldItalic: \"Inter-Italic\",\n\t\tselectorItalic: \"Inter-ThinItalic\",\n\t\tselectorVariable: \"Inter-Variable\",\n\t\tselectorVariableItalic: \"Inter-VariableItalic\",\n\t\tfile: InterThin,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterThinCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterThinCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterThinGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterThinGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterThinLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterThinLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterThinVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter\",\n\t\tcssFamilyName: \"Inter\",\n\t\tvariant: \"Extra Light\",\n\t\tselector: \"Inter-ExtraLight\",\n\t\tweight: 200,\n\t\tstyle: \"normal\",\n\t\tselectorBold: \"Inter\",\n\t\tselectorBoldItalic: \"Inter-Italic\",\n\t\tselectorItalic: \"Inter-ExtraLightItalic\",\n\t\tselectorVariable: \"Inter-Variable\",\n\t\tselectorVariableItalic: \"Inter-VariableItalic\",\n\t\tfile: InterExtraLight,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterExtraLightCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterExtraLightCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterExtraLightGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterExtraLightGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterExtraLightLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterExtraLightLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterExtraLightVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter\",\n\t\tcssFamilyName: \"Inter\",\n\t\tvariant: \"Light\",\n\t\tselector: \"Inter-Light\",\n\t\tweight: 300,\n\t\tstyle: \"normal\",\n\t\tselectorBold: \"Inter\",\n\t\tselectorBoldItalic: \"Inter-Italic\",\n\t\tselectorItalic: \"Inter-LightItalic\",\n\t\tselectorVariable: \"Inter-Variable\",\n\t\tselectorVariableItalic: \"Inter-VariableItalic\",\n\t\tfile: InterLight,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterLightCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterLightCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterLightGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterLightGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterLightLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterLightLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterLightVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter\",\n\t\tcssFamilyName: \"Inter\",\n\t\tvariant: \"Medium\",\n\t\tselector: \"Inter-Medium\",\n\t\tweight: 500,\n\t\tstyle: \"normal\",\n\t\tselectorBold: \"Inter-Bold\",\n\t\tselectorBoldItalic: \"Inter-BoldItalic\",\n\t\tselectorItalic: \"Inter-MediumItalic\",\n\t\tselectorVariable: \"Inter-Variable\",\n\t\tselectorVariableItalic: \"Inter-VariableItalic\",\n\t\tfile: InterMedium,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterMediumCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterMediumCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterMediumGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterMediumGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterMediumLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterMediumLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterMediumVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter\",\n\t\tcssFamilyName: \"Inter\",\n\t\tvariant: \"Semibold\",\n\t\tselector: \"Inter-SemiBold\",\n\t\tweight: 600,\n\t\tstyle: \"normal\",\n\t\tselectorBold: \"Inter-Bold\",\n\t\tselectorBoldItalic: \"Inter-BoldItalic\",\n\t\tselectorItalic: \"Inter-SemiBoldItalic\",\n\t\tselectorVariable: \"Inter-Variable\",\n\t\tselectorVariableItalic: \"Inter-VariableItalic\",\n\t\tfile: InterSemiBold,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterSemiBoldCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterSemiBoldCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterSemiBoldGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterSemiBoldGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterSemiBoldLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterSemiBoldLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterSemiBoldVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter\",\n\t\tcssFamilyName: \"Inter\",\n\t\tvariant: \"Bold\",\n\t\tselector: \"Inter-Bold\",\n\t\tweight: 700,\n\t\tstyle: \"normal\",\n\t\tselectorBold: \"Inter-Black\",\n\t\tselectorBoldItalic: \"Inter-BlackItalic\",\n\t\tselectorItalic: \"Inter-BoldItalic\",\n\t\tselectorVariable: \"Inter-Variable\",\n\t\tselectorVariableItalic: \"Inter-VariableItalic\",\n\t\tfile: InterBold,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterBoldCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterBoldCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterBoldGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterBoldGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterBoldLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterBoldLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterBoldVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter\",\n\t\tcssFamilyName: \"Inter\",\n\t\tvariant: \"Extra Bold\",\n\t\tselector: \"Inter-ExtraBold\",\n\t\tweight: 800,\n\t\tstyle: \"normal\",\n\t\tselectorBold: \"Inter-Black\",\n\t\tselectorBoldItalic: \"Inter-BlackItalic\",\n\t\tselectorItalic: \"Inter-ExtraBoldItalic\",\n\t\tselectorVariable: \"Inter-Variable\",\n\t\tselectorVariableItalic: \"Inter-VariableItalic\",\n\t\tfile: InterExtraBold,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterExtraBoldCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterExtraBoldCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterExtraBoldGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterExtraBoldGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterExtraBoldLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterExtraBoldLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterExtraBoldVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter\",\n\t\tcssFamilyName: \"Inter\",\n\t\tvariant: \"Black\",\n\t\tselector: \"Inter-Black\",\n\t\tweight: 900,\n\t\tstyle: \"normal\",\n\t\tselectorBold: undefined,\n\t\tselectorBoldItalic: \"Inter-BlackItalic\",\n\t\tselectorVariable: \"Inter-Variable\",\n\t\tselectorVariableItalic: \"Inter-VariableItalic\",\n\t\tselectorItalic: undefined,\n\t\tfile: InterBlack,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterBlackCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterBlackCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterBlackGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterBlackGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterBlackLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterBlackLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterBlackVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter\",\n\t\tcssFamilyName: \"Inter\",\n\t\tvariant: \"Thin Italic\",\n\t\tselector: \"Inter-ThinItalic\",\n\t\tweight: 100,\n\t\tstyle: \"italic\",\n\t\tselectorBold: \"Inter-Italic\",\n\t\tselectorBoldItalic: \"Inter-Italic\",\n\t\tselectorItalic: \"Inter-ThinItalic\",\n\t\tselectorVariable: \"Inter-Variable\",\n\t\tselectorVariableItalic: \"Inter-VariableItalic\",\n\t\tfile: InterThinItalic,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterThinItalicCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterThinItalicCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterThinItalicGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterThinItalicGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterThinItalicLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterThinItalicLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterThinItalicVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter\",\n\t\tcssFamilyName: \"Inter\",\n\t\tvariant: \"Extra Light Italic\",\n\t\tselector: \"Inter-ExtraLightItalic\",\n\t\tweight: 200,\n\t\tstyle: \"italic\",\n\t\tselectorBold: \"Inter-Italic\",\n\t\tselectorBoldItalic: \"Inter-Italic\",\n\t\tselectorItalic: \"Inter-ExtraLightItalic\",\n\t\tselectorVariable: \"Inter-Variable\",\n\t\tselectorVariableItalic: \"Inter-VariableItalic\",\n\t\tfile: InterExtraLightItalic,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterExtraLightItalicCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterExtraLightItalicCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterExtraLightItalicGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterExtraLightItalicGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterExtraLightItalicLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterExtraLightItalicLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterExtraLightItalicVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter\",\n\t\tcssFamilyName: \"Inter\",\n\t\tvariant: \"Light Italic\",\n\t\tselector: \"Inter-LightItalic\",\n\t\tweight: 300,\n\t\tstyle: \"italic\",\n\t\tselectorBold: \"Inter-Italic\",\n\t\tselectorBoldItalic: \"Inter-Italic\",\n\t\tselectorItalic: \"Inter-LightItalic\",\n\t\tselectorVariable: \"Inter-Variable\",\n\t\tselectorVariableItalic: \"Inter-VariableItalic\",\n\t\tfile: InterLightItalic,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterLightItalicCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterLightItalicCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterLightItalicGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterLightItalicGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterLightItalicLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterLightItalicLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterLightItalicVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter\",\n\t\tcssFamilyName: \"Inter\",\n\t\tvariant: \"Italic\",\n\t\tselector: \"Inter-Italic\",\n\t\tweight: 400,\n\t\tstyle: \"italic\",\n\t\tselectorBold: \"Inter-BoldItalic\",\n\t\tselectorBoldItalic: \"Inter-BoldItalic\",\n\t\tselectorItalic: \"Inter-Italic\",\n\t\tselectorVariable: \"Inter-Variable\",\n\t\tselectorVariableItalic: \"Inter-VariableItalic\",\n\t\tfile: InterItalic,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterItalicCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterItalicCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterItalicGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterItalicGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterItalicLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterItalicLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterItalicVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter\",\n\t\tcssFamilyName: \"Inter\",\n\t\tvariant: \"Medium Italic\",\n\t\tselector: \"Inter-MediumItalic\",\n\t\tweight: 500,\n\t\tstyle: \"italic\",\n\t\tselectorBold: \"Inter-BoldItalic\",\n\t\tselectorBoldItalic: \"Inter-BoldItalic\",\n\t\tselectorItalic: \"Inter-MediumItalic\",\n\t\tselectorVariable: \"Inter-Variable\",\n\t\tselectorVariableItalic: \"Inter-VariableItalic\",\n\t\tfile: InterMediumItalic,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterMediumItalicCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterMediumItalicCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterMediumItalicGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterMediumItalicGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterMediumItalicLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterMediumItalicLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterMediumItalicVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter\",\n\t\tcssFamilyName: \"Inter\",\n\t\tvariant: \"Semibold Italic\",\n\t\tselector: \"Inter-SemiBoldItalic\",\n\t\tweight: 600,\n\t\tstyle: \"italic\",\n\t\tselectorBold: \"Inter-BoldItalic\",\n\t\tselectorBoldItalic: \"Inter-BoldItalic\",\n\t\tselectorItalic: \"Inter-SemiBoldItalic\",\n\t\tselectorVariable: \"Inter-Variable\",\n\t\tselectorVariableItalic: \"Inter-VariableItalic\",\n\t\tfile: InterSemiBoldItalic,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterSemiBoldItalicCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterSemiBoldItalicCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterSemiBoldItalicGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterSemiBoldItalicGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterSemiBoldItalicLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterSemiBoldItalicLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterSemiBoldItalicVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter\",\n\t\tcssFamilyName: \"Inter\",\n\t\tvariant: \"Bold Italic\",\n\t\tselector: \"Inter-BoldItalic\",\n\t\tweight: 700,\n\t\tstyle: \"italic\",\n\t\tselectorBold: \"Inter-BlackItalic\",\n\t\tselectorBoldItalic: \"Inter-BlackItalic\",\n\t\tselectorItalic: \"Inter-BoldItalic\",\n\t\tselectorVariable: \"Inter-Variable\",\n\t\tselectorVariableItalic: \"Inter-VariableItalic\",\n\t\tfile: InterBoldItalic,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterBoldItalicCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterBoldItalicCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterBoldItalicGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterBoldItalicGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterBoldItalicLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterBoldItalicLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterBoldItalicVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter\",\n\t\tcssFamilyName: \"Inter\",\n\t\tvariant: \"Extra Bold Italic\",\n\t\tselector: \"Inter-ExtraBoldItalic\",\n\t\tweight: 800,\n\t\tstyle: \"italic\",\n\t\tselectorBold: \"Inter-BlackItalic\",\n\t\tselectorBoldItalic: \"Inter-BlackItalic\",\n\t\tselectorItalic: \"Inter-ExtraBoldItalic\",\n\t\tselectorVariable: \"Inter-Variable\",\n\t\tselectorVariableItalic: \"Inter-VariableItalic\",\n\t\tfile: InterExtraBoldItalic,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterExtraBoldItalicCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterExtraBoldItalicCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterExtraBoldItalicGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterExtraBoldItalicGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterExtraBoldItalicLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterExtraBoldItalicLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterExtraBoldItalicVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter\",\n\t\tcssFamilyName: \"Inter\",\n\t\tvariant: \"Black Italic\",\n\t\tselector: \"Inter-BlackItalic\",\n\t\tweight: 900,\n\t\tstyle: \"italic\",\n\t\tselectorBold: undefined,\n\t\tselectorBoldItalic: undefined,\n\t\tselectorItalic: \"Inter-BlackItalic\",\n\t\tselectorVariable: \"Inter-Variable\",\n\t\tselectorVariableItalic: \"Inter-VariableItalic\",\n\t\tfile: InterBlackItalic,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterBlackItalicCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterBlackItalicCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterBlackItalicGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterBlackItalicGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterBlackItalicLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterBlackItalicLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterBlackItalicVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter\",\n\t\tcssFamilyName: \"Inter Variable\",\n\t\tvariant: \"Regular\",\n\t\tselector: \"Inter-Variable\",\n\t\tweight: 400,\n\t\tstyle: \"normal\",\n\t\tselectorBold: undefined,\n\t\tselectorBoldItalic: undefined,\n\t\tselectorItalic: undefined,\n\t\tselectorVariable: \"Inter-Variable\",\n\t\tselectorVariableItalic: \"Inter-VariableItalic\",\n\t\tfile: InterVariable,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterVariableCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterVariableCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterVariableGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterVariableGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterVariableLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterVariableLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterVariableVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter\",\n\t\tcssFamilyName: \"Inter Variable\",\n\t\tvariant: \"Regular Italic\",\n\t\tselector: \"Inter-VariableItalic\",\n\t\tweight: 400,\n\t\tstyle: \"italic\",\n\t\tselectorBold: undefined,\n\t\tselectorBoldItalic: undefined,\n\t\tselectorItalic: undefined,\n\t\tselectorVariable: \"Inter-Variable\",\n\t\tselectorVariableItalic: \"Inter-VariableItalic\",\n\t\tfile: InterVariableItalic,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterVariableItalicCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterVariableItalicCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterVariableItalicGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterVariableItalicGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterVariableItalicLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterVariableItalicLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterVariableItalicVietnamese },\n\t\t],\n\t},\n]\n\n// To generate metrics for a font, run:\n//   cd tools/font-metadata-extractor\n//   yarn build\n//   node bin/extract-custom-font-metrics <path to the 400 regular (non-italic) latin font file>\nexport const INTER_FONT_METRICS = {\n\tascent: 1984,\n\tdescent: -494,\n\tlineGap: 0,\n\tunitsPerEm: 2048,\n\tazAvgWidth: 1008.2093023255813,\n}\n\nexport const INTER_DISPLAY_FONTS: FramerFontDefinition[] = [\n\t{\n\t\tuiFamilyName: \"Inter Display\",\n\t\tcssFamilyName: \"Inter Display\",\n\t\tvariant: \"Regular\",\n\t\tselector: \"FR;InterDisplay\",\n\t\tweight: 400,\n\t\tstyle: \"normal\",\n\t\tselectorBold: \"FR;InterDisplay-Bold\",\n\t\tselectorBoldItalic: \"FR;InterDisplay-BoldItalic\",\n\t\tselectorItalic: \"FR;InterDisplay-Italic\",\n\t\tfile: InterDisplayRegular,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterDisplayRegularCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterDisplayRegularCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterDisplayRegularGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterDisplayRegularGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterDisplayRegularLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterDisplayRegularLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterDisplayRegularVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter Display\",\n\t\tcssFamilyName: \"Inter Display\",\n\t\tvariant: \"Thin\",\n\t\tselector: \"FR;InterDisplay-Thin\",\n\t\tweight: 100,\n\t\tstyle: \"normal\",\n\t\tselectorBold: \"FR;InterDisplay\",\n\t\tselectorBoldItalic: \"FR;InterDisplay-Italic\",\n\t\tselectorItalic: \"FR;InterDisplay-ThinItalic\",\n\t\tfile: InterDisplayThin,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterDisplayThinCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterDisplayThinCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterDisplayThinGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterDisplayThinGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterDisplayThinLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterDisplayThinLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterDisplayThinVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter Display\",\n\t\tcssFamilyName: \"Inter Display\",\n\t\tvariant: \"Extra Light\",\n\t\tselector: \"FR;InterDisplay-ExtraLight\",\n\t\tweight: 200,\n\t\tstyle: \"normal\",\n\t\tselectorBold: \"FR;InterDisplay\",\n\t\tselectorBoldItalic: \"FR;InterDisplay-Italic\",\n\t\tselectorItalic: \"FR;InterDisplay-ExtraLightItalic\",\n\t\tfile: InterDisplayExtraLight,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterDisplayExtraLightCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterDisplayExtraLightCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterDisplayExtraLightGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterDisplayExtraLightGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterDisplayExtraLightLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterDisplayExtraLightLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterDisplayExtraLightVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter Display\",\n\t\tcssFamilyName: \"Inter Display\",\n\t\tvariant: \"Light\",\n\t\tselector: \"FR;InterDisplay-Light\",\n\t\tweight: 300,\n\t\tstyle: \"normal\",\n\t\tselectorBold: \"FR;InterDisplay\",\n\t\tselectorBoldItalic: \"FR;InterDisplay-Italic\",\n\t\tselectorItalic: \"FR;InterDisplay-LightItalic\",\n\t\tfile: InterDisplayLight,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterDisplayLightCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterDisplayLightCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterDisplayLightGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterDisplayLightGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterDisplayLightLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterDisplayLightLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterDisplayLightVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter Display\",\n\t\tcssFamilyName: \"Inter Display\",\n\t\tvariant: \"Medium\",\n\t\tselector: \"FR;InterDisplay-Medium\",\n\t\tweight: 500,\n\t\tstyle: \"normal\",\n\t\tselectorBold: \"FR;InterDisplay-Bold\",\n\t\tselectorBoldItalic: \"FR;InterDisplay-BoldItalic\",\n\t\tselectorItalic: \"FR;InterDisplay-MediumItalic\",\n\t\tfile: InterDisplayMedium,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterDisplayMediumCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterDisplayMediumCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterDisplayMediumGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterDisplayMediumGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterDisplayMediumLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterDisplayMediumLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterDisplayMediumVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter Display\",\n\t\tcssFamilyName: \"Inter Display\",\n\t\tvariant: \"Semibold\",\n\t\tselector: \"FR;InterDisplay-SemiBold\",\n\t\tweight: 600,\n\t\tstyle: \"normal\",\n\t\tselectorBold: \"FR;InterDisplay-Bold\",\n\t\tselectorBoldItalic: \"FR;InterDisplay-BoldItalic\",\n\t\tselectorItalic: \"FR;InterDisplay-SemiBoldItalic\",\n\t\tfile: InterDisplaySemiBold,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterDisplaySemiBoldCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterDisplaySemiBoldCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterDisplaySemiBoldGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterDisplaySemiBoldGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterDisplaySemiBoldLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterDisplaySemiBoldLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterDisplaySemiBoldVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter Display\",\n\t\tcssFamilyName: \"Inter Display\",\n\t\tvariant: \"Bold\",\n\t\tselector: \"FR;InterDisplay-Bold\",\n\t\tweight: 700,\n\t\tstyle: \"normal\",\n\t\tselectorBold: \"FR;InterDisplay-Black\",\n\t\tselectorBoldItalic: \"FR;InterDisplay-BlackItalic\",\n\t\tselectorItalic: \"FR;InterDisplay-BoldItalic\",\n\t\tfile: InterDisplayBold,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterDisplayBoldCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterDisplayBoldCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterDisplayBoldGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterDisplayBoldGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterDisplayBoldLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterDisplayBoldLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterDisplayBoldVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter Display\",\n\t\tcssFamilyName: \"Inter Display\",\n\t\tvariant: \"Extra Bold\",\n\t\tselector: \"FR;InterDisplay-ExtraBold\",\n\t\tweight: 800,\n\t\tstyle: \"normal\",\n\t\tselectorBold: \"FR;InterDisplay-Black\",\n\t\tselectorBoldItalic: \"FR;InterDisplay-BlackItalic\",\n\t\tselectorItalic: \"FR;InterDisplay-ExtraBoldItalic\",\n\t\tfile: InterDisplayExtraBold,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterDisplayExtraBoldCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterDisplayExtraBoldCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterDisplayExtraBoldGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterDisplayExtraBoldGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterDisplayExtraBoldLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterDisplayExtraBoldLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterDisplayExtraBoldVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter Display\",\n\t\tcssFamilyName: \"Inter Display\",\n\t\tvariant: \"Black\",\n\t\tselector: \"FR;InterDisplay-Black\",\n\t\tweight: 900,\n\t\tstyle: \"normal\",\n\t\tselectorBold: undefined,\n\t\tselectorBoldItalic: \"FR;InterDisplay-BlackItalic\",\n\t\tselectorItalic: undefined,\n\t\tfile: InterDisplayBlack,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterDisplayBlackCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterDisplayBlackCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterDisplayBlackGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterDisplayBlackGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterDisplayBlackLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterDisplayBlackLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterDisplayBlackVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter Display\",\n\t\tcssFamilyName: \"Inter Display\",\n\t\tvariant: \"Thin Italic\",\n\t\tselector: \"FR;InterDisplay-ThinItalic\",\n\t\tweight: 100,\n\t\tstyle: \"italic\",\n\t\tselectorBold: \"FR;InterDisplay-Italic\",\n\t\tselectorBoldItalic: \"FR;InterDisplay-Italic\",\n\t\tselectorItalic: \"FR;InterDisplay-ThinItalic\",\n\t\tfile: InterDisplayThinItalic,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterDisplayThinItalicCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterDisplayThinItalicCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterDisplayThinItalicGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterDisplayThinItalicGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterDisplayThinItalicLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterDisplayThinItalicLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterDisplayThinItalicVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter Display\",\n\t\tcssFamilyName: \"Inter Display\",\n\t\tvariant: \"Extra Light Italic\",\n\t\tselector: \"FR;InterDisplay-ExtraLightItalic\",\n\t\tweight: 200,\n\t\tstyle: \"italic\",\n\t\tselectorBold: \"FR;InterDisplay-Italic\",\n\t\tselectorBoldItalic: \"FR;InterDisplay-Italic\",\n\t\tselectorItalic: \"FR;InterDisplay-ExtraLightItalic\",\n\t\tfile: InterDisplayExtraLightItalic,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterDisplayExtraLightItalicCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterDisplayExtraLightItalicCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterDisplayExtraLightItalicGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterDisplayExtraLightItalicGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterDisplayExtraLightItalicLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterDisplayExtraLightItalicLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterDisplayExtraLightItalicVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter Display\",\n\t\tcssFamilyName: \"Inter Display\",\n\t\tvariant: \"Light Italic\",\n\t\tselector: \"FR;InterDisplay-LightItalic\",\n\t\tweight: 300,\n\t\tstyle: \"italic\",\n\t\tselectorBold: \"FR;InterDisplay-Italic\",\n\t\tselectorBoldItalic: \"FR;InterDisplay-Italic\",\n\t\tselectorItalic: \"FR;InterDisplay-LightItalic\",\n\t\tfile: InterDisplayLightItalic,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterDisplayLightItalicCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterDisplayLightItalicCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterDisplayLightItalicGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterDisplayLightItalicGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterDisplayLightItalicLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterDisplayLightItalicLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterDisplayLightItalicVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter Display\",\n\t\tcssFamilyName: \"Inter Display\",\n\t\tvariant: \"Italic\",\n\t\tselector: \"FR;InterDisplay-Italic\",\n\t\tweight: 400,\n\t\tstyle: \"italic\",\n\t\tselectorBold: \"FR;InterDisplay-BoldItalic\",\n\t\tselectorBoldItalic: \"FR;InterDisplay-BoldItalic\",\n\t\tselectorItalic: \"FR;InterDisplay-Italic\",\n\t\tfile: InterDisplayItalic,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterDisplayItalicCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterDisplayItalicCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterDisplayItalicGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterDisplayItalicGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterDisplayItalicLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterDisplayItalicLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterDisplayItalicVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter Display\",\n\t\tcssFamilyName: \"Inter Display\",\n\t\tvariant: \"Medium Italic\",\n\t\tselector: \"FR;InterDisplay-MediumItalic\",\n\t\tweight: 500,\n\t\tstyle: \"italic\",\n\t\tselectorBold: \"FR;InterDisplay-BoldItalic\",\n\t\tselectorBoldItalic: \"FR;InterDisplay-BoldItalic\",\n\t\tselectorItalic: \"FR;InterDisplay-MediumItalic\",\n\t\tfile: InterDisplayMediumItalic,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterDisplayMediumItalicCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterDisplayMediumItalicCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterDisplayMediumItalicGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterDisplayMediumItalicGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterDisplayMediumItalicLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterDisplayMediumItalicLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterDisplayMediumItalicVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter Display\",\n\t\tcssFamilyName: \"Inter Display\",\n\t\tvariant: \"Semibold Italic\",\n\t\tselector: \"FR;InterDisplay-SemiBoldItalic\",\n\t\tweight: 600,\n\t\tstyle: \"italic\",\n\t\tselectorBold: \"FR;InterDisplay-BoldItalic\",\n\t\tselectorBoldItalic: \"FR;InterDisplay-BoldItalic\",\n\t\tselectorItalic: \"FR;InterDisplay-SemiBoldItalic\",\n\t\tfile: InterDisplaySemiBoldItalic,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterDisplaySemiBoldItalicCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterDisplaySemiBoldItalicCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterDisplaySemiBoldItalicGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterDisplaySemiBoldItalicGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterDisplaySemiBoldItalicLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterDisplaySemiBoldItalicLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterDisplaySemiBoldItalicVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter Display\",\n\t\tcssFamilyName: \"Inter Display\",\n\t\tvariant: \"Bold Italic\",\n\t\tselector: \"FR;InterDisplay-BoldItalic\",\n\t\tweight: 700,\n\t\tstyle: \"italic\",\n\t\tselectorBold: \"FR;InterDisplay-BlackItalic\",\n\t\tselectorBoldItalic: \"FR;InterDisplay-BlackItalic\",\n\t\tselectorItalic: \"FR;InterDisplay-BoldItalic\",\n\t\tfile: InterDisplayBoldItalic,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterDisplayBoldItalicCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterDisplayBoldItalicCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterDisplayBoldItalicGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterDisplayBoldItalicGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterDisplayBoldItalicLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterDisplayBoldItalicLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterDisplayBoldItalicVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter Display\",\n\t\tcssFamilyName: \"Inter Display\",\n\t\tvariant: \"Extra Bold Italic\",\n\t\tselector: \"FR;InterDisplay-ExtraBoldItalic\",\n\t\tweight: 800,\n\t\tstyle: \"italic\",\n\t\tselectorBold: \"FR;InterDisplay-BlackItalic\",\n\t\tselectorBoldItalic: \"FR;InterDisplay-BlackItalic\",\n\t\tselectorItalic: \"FR;InterDisplay-ExtraBoldItalic\",\n\t\tfile: InterDisplayExtraBoldItalic,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterDisplayExtraBoldItalicCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterDisplayExtraBoldItalicCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterDisplayExtraBoldItalicGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterDisplayExtraBoldItalicGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterDisplayExtraBoldItalicLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterDisplayExtraBoldItalicLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterDisplayExtraBoldItalicVietnamese },\n\t\t],\n\t},\n\t{\n\t\tuiFamilyName: \"Inter Display\",\n\t\tcssFamilyName: \"Inter Display\",\n\t\tvariant: \"Black Italic\",\n\t\tselector: \"FR;InterDisplay-BlackItalic\",\n\t\tweight: 900,\n\t\tstyle: \"italic\",\n\t\tselectorBold: undefined,\n\t\tselectorBoldItalic: undefined,\n\t\tselectorItalic: \"FR;InterDisplay-BlackItalic\",\n\t\tfile: InterDisplayBlackItalic,\n\t\tcategory: \"sans-serif\",\n\t\thasOpenTypeFeatures: true,\n\t\tsubsets: [\n\t\t\t{ unicodeRange: subsetCyrillicExt, file: InterDisplayBlackItalicCyrillicExt },\n\t\t\t{ unicodeRange: subsetCyrillic, file: InterDisplayBlackItalicCyrillic },\n\t\t\t{ unicodeRange: subsetGreekExt, file: InterDisplayBlackItalicGreekExt },\n\t\t\t{ unicodeRange: subsetGreek, file: InterDisplayBlackItalicGreek },\n\t\t\t{ unicodeRange: subsetLatinExt, file: InterDisplayBlackItalicLatinExt },\n\t\t\t{ unicodeRange: subsetLatin, file: InterDisplayBlackItalicLatin },\n\t\t\t{ unicodeRange: subsetVietnamese, file: InterDisplayBlackItalicVietnamese },\n\t\t],\n\t},\n]\n// To generate metrics for a font, run:\n//   cd tools/font-metadata-extractor\n//   yarn build\n//   node bin/extract-custom-font-metrics <path to the 400 regular (non-italic) latin font file>\nexport const INTER_DISPLAY_FONT_METRICS = {\n\tascent: 1984,\n\tdescent: -494,\n\tlineGap: 0,\n\tunitsPerEm: 2048,\n\tazAvgWidth: 918.5348837209302,\n}\n\n/**\n * Get the selector for an Inter font variant.\n * @param variant - The variant of the font.\n * @returns The selector for the font variant.\n */\nexport function getInterFontSelectorFromVariant(variant: FramerFontVariant): string {\n\tfor (const font of INTER_FONTS) {\n\t\tif (font.variant === variant) return font.selector\n\t}\n\treturn \"Inter\"\n}\n\nexport const FRAMER_BUILTIN_FONTS: FramerFontDefinition[] = [...INTER_FONTS, ...INTER_DISPLAY_FONTS]\n", "import type { NonUndefinedRecord } from \"utils/NonUndefined.ts\"\nimport type { CanvasNode } from \"../index.ts\"\nimport { isDataRepeater } from \"../nodes/utils/nodeCheck.ts\"\nimport type { VariableReference } from \"./VariableReference.ts\"\nimport { isVariant } from \"./WithVariant.ts\"\n\nexport interface WithRepeatArray {\n\t/**\n\t * A variable reference pointing to an array that should repeat this node.\n\t */\n\trepeatArray: VariableReference | undefined\n}\n\nexport const repeatArrayDefaults: WithRepeatArray = {\n\trepeatArray: undefined,\n}\n\nconst key: keyof WithRepeatArray = \"repeatArray\"\n\nexport function withRepeatArray<T extends CanvasNode>(node: T | null | undefined): node is T & WithRepeatArray {\n\tif (!node) return false\n\tif (!(key in node)) return false\n\tif (isVariant(node)) return false\n\tif (isDataRepeater(node)) return false\n\treturn true\n}\n\nexport type HasRepeatArray = NonUndefinedRecord<WithRepeatArray>\n\nexport function hasRepeatArray<T extends CanvasNode>(node: T | null | undefined): node is T & HasRepeatArray {\n\treturn !!node && withRepeatArray(node) && !!node.repeatArray\n}\n", "import type { RenamedIds } from \"document/components/tools/utils/updateNodeConnections.ts\"\nimport type { CanvasTree } from \"document/models/CanvasTree/index.ts\"\nimport type { CanvasNode, MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport type { CollectionRepeater, DataRepeater } from \"document/models/CanvasTree/nodes/FrameNode.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { isCollectionRepeater, isDataRepeater } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { WithCollectionOptions } from \"document/models/CanvasTree/traits/WithCollectionOptions.ts\"\nimport { hasRepeatArray } from \"document/models/CanvasTree/traits/WithRepeatArray.ts\"\n\ntype RepeatedItemIdUpdate = Pick<WithCollectionOptions, \"collectionRepeatedItemId\" | \"repeatedItemId\">\n\nexport function getRepeatedItemIdUpdate(repeatedItemId: NodeID | undefined): RepeatedItemIdUpdate {\n\treturn {\n\t\tcollectionRepeatedItemId: repeatedItemId,\n\t\trepeatedItemId,\n\t}\n}\n\n/**\n * Gets the node that is the specifically repeated item of an original repeater.\n */\nexport function getOriginalRepeatedItemOfDataRepeater(tree: CanvasTree, repeater: MaybeCanvasNode): MaybeCanvasNode {\n\tconst repeaterOriginalId = repeater?.getPrimaryId()\n\trepeater = tree.get(repeaterOriginalId)\n\tif (!isDataRepeater(repeater)) return null\n\n\tif (repeater.repeatedItemId !== undefined) {\n\t\treturn getDirectRepeatedItem(tree, repeater, repeater.repeatedItemId)\n\t}\n\n\tconst repeatedItem = getDirectRepeatedItem(tree, repeater, repeater.collectionRepeatedItemId)\n\tif (repeatedItem) return repeatedItem\n\n\treturn getFallbackRepeatedItem(repeater)\n}\n\n/**\n * Get the nearest ancestor of a node that is a data repeater,\n * and whether we are in the repeated item of that repeater.\n */\nexport function getNearestAncestorRepeaterContext(tree: CanvasTree, node: CanvasNode) {\n\tlet child = node\n\tfor (const parent of node.ancestors()) {\n\t\tif (isDataRepeater(parent)) {\n\t\t\treturn {\n\t\t\t\trepeater: parent,\n\t\t\t\tinRepeatedChild: isRepeatedItem(tree, child, parent),\n\t\t\t}\n\t\t}\n\t\tchild = parent\n\t}\n}\n\n/**\n * Get the nearest ancestor of a node that is a data repeater.\n */\nexport function getNearestAncestorDataRepeater(node: CanvasNode) {\n\tfor (const parent of node.ancestors()) {\n\t\tif (isDataRepeater(parent)) return parent\n\t}\n}\n\n/**\n * Get the parent of a node if its a data repeater.\n */\nexport function getParentDataRepeater(tree: CanvasTree, node: CanvasNode): DataRepeater | undefined {\n\treturn tree.getNodeWithTrait(node.parentid, isDataRepeater) ?? undefined\n}\n\n/**\n * Get the parent of a node if its a collection repeater.\n */\nexport function getParentCollectionRepeater(tree: CanvasTree, node: CanvasNode): CollectionRepeater | undefined {\n\treturn tree.getNodeWithTrait(node.parentid, isCollectionRepeater) ?? undefined\n}\n\n/**\n * Gets the node that is the specifically repeated item of a repeater.\n */\nexport function getRepeatedItemOfDataRepeater(tree: CanvasTree, repeater: MaybeCanvasNode): MaybeCanvasNode {\n\tif (!repeater) return null\n\tconst originalRepeatedItem = getOriginalRepeatedItemOfDataRepeater(tree, repeater)\n\tif (!originalRepeatedItem) return null\n\n\tif (!repeater.originalid) return originalRepeatedItem\n\n\tconst repeatedItem = repeater.children?.find(child => child.originalid === originalRepeatedItem.id)\n\treturn repeatedItem\n}\n\n/**\n * Checks whether a node is the specifically repeated item of a repeater.\n *\n * This will not return true for children of a repeated node.\n */\nexport function isRepeatedItem(tree: CanvasTree, node: CanvasNode, repeater?: DataRepeater): boolean {\n\trepeater ??= getParentDataRepeater(tree, node)\n\n\tconst repeatedItem = getRepeatedItemOfDataRepeater(tree, repeater)\n\treturn repeatedItem?.id === node.id\n}\n\nexport function isNonRepeatedChildOfRepeater(\n\tnode: CanvasNode,\n\ttree: CanvasTree,\n\tchild: CanvasNode | undefined,\n): boolean {\n\treturn !!child && isDataRepeater(node) && !isRepeatedItem(tree, child, node)\n}\n\nexport function resetRepeatedItemOfDataRepeater(repeater: DataRepeater) {\n\tconst firstRepeaterChild = repeater.children?.at(0)\n\trepeater.set(getRepeatedItemIdUpdate(firstRepeaterChild?.id))\n}\n\ninterface RepeatedItemSnapshot {\n\trepeaterId: NodeID\n\tdisableFallback: boolean\n\trepeatedItemId: NodeID\n\trepeatedItemChildIds: NodeID[]\n}\n\nexport function snapshotRepeatedItemsForNodes(tree: CanvasTree, nodes: Iterable<CanvasNode>): RepeatedItemSnapshot[] {\n\tconst snapshots = new Map<NodeID, RepeatedItemSnapshot>()\n\n\tfor (const node of nodes) {\n\t\tconst snapshot = snapshotRepeatedItemForNode(tree, node)\n\t\tif (snapshot) snapshots.set(snapshot.repeaterId, snapshot)\n\t}\n\n\treturn [...snapshots.values()]\n}\n\nfunction snapshotRepeatedItemForNode(tree: CanvasTree, node: CanvasNode): RepeatedItemSnapshot | null {\n\tconst repeater = getParentDataRepeater(tree, node)\n\tif (!repeater || !isRepeatedItem(tree, node, repeater)) return null\n\n\tconst repeatedItemId = node.getPrimaryId()\n\treturn {\n\t\trepeaterId: repeater.getPrimaryId(),\n\t\tdisableFallback: repeater.repeatedItemId !== undefined,\n\t\trepeatedItemId,\n\t\trepeatedItemChildIds: node.children?.map(child => child.getPrimaryId()) ?? [],\n\t}\n}\n\nexport function restoreRepeatedItemsFromSnapshots(\n\ttree: CanvasTree,\n\tsnapshots: Iterable<RepeatedItemSnapshot>,\n\trenamedIds?: RenamedIds,\n) {\n\tfor (const snapshot of snapshots) {\n\t\tconst repeater = tree.get(snapshot.repeaterId)\n\t\tif (!isDataRepeater(repeater)) continue\n\n\t\tconst repeatedItemId = resolveRepeatedItemId(tree, repeater, snapshot, renamedIds)\n\t\tif (repeatedItemId === repeater.repeatedItemId && repeatedItemId === repeater.collectionRepeatedItemId) continue\n\n\t\trepeater.set(getRepeatedItemIdUpdate(repeatedItemId))\n\t}\n}\n\nfunction resolveRepeatedItemId(\n\ttree: CanvasTree,\n\trepeater: DataRepeater,\n\tsnapshot: RepeatedItemSnapshot,\n\trenamedIds?: RenamedIds,\n): NodeID | undefined {\n\tconst candidateIds = new Set<NodeID>()\n\tconst renamedRepeatedItemId = renamedIds?.get(snapshot.repeatedItemId)\n\tif (renamedRepeatedItemId) candidateIds.add(renamedRepeatedItemId)\n\tcandidateIds.add(snapshot.repeatedItemId)\n\tfor (const childId of snapshot.repeatedItemChildIds) {\n\t\tcandidateIds.add(childId)\n\t}\n\n\tfor (const candidateId of candidateIds) {\n\t\tconst repeatedItem = findDirectRepeaterChild(tree, repeater, candidateId)\n\t\tif (repeatedItem) return repeatedItem.id\n\t}\n\n\tif (snapshot.disableFallback) return undefined\n\n\treturn getFallbackRepeatedItem(repeater)?.id\n}\n\nfunction findDirectRepeaterChild(tree: CanvasTree, repeater: DataRepeater, candidateId: NodeID) {\n\tlet candidate = tree.get(candidateId)\n\n\twhile (candidate) {\n\t\tif (candidate.parentid === repeater.id) {\n\t\t\t// The repeated item must be a direct repeater child. Nested repeated\n\t\t\t// descendants carry repeat arrays of their own and should not become\n\t\t\t// the repeater's collectionRepeatedItemId.\n\t\t\tif (hasRepeatArray(candidate)) return null\n\t\t\treturn candidate\n\t\t}\n\n\t\tif (!candidate.parentid) return null\n\t\tcandidate = tree.get(candidate.parentid)\n\t}\n\n\treturn null\n}\n\nfunction getDirectRepeatedItem(tree: CanvasTree, repeater: DataRepeater, repeatedItemId: NodeID | undefined) {\n\tconst repeatedItem = tree.get(repeatedItemId)\n\tif (!repeatedItem) return null\n\tif (hasRepeatArray(repeatedItem)) return null\n\tif (repeatedItem.parentid !== repeater.id) return null\n\treturn repeatedItem\n}\n\nfunction getFallbackRepeatedItem(repeater: DataRepeater) {\n\tconst fallbackRepeatedItem = repeater.children.at(0)\n\tif (!fallbackRepeatedItem) return null\n\tif (hasRepeatArray(fallbackRepeatedItem)) return null\n\treturn fallbackRepeatedItem\n}\n", "export type LocaleId = string\n/**\n * Locale identifier (language, optional script, optional region).\n *\n * @example \"en\", \"nl-NL\", \"nl-BE\", \"sr-Latn-RS\", \"zh-Hans-CN\"\n */\nexport type LocaleCode = string\n\nexport const defaultLocaleId: LocaleId = \"default\"\n\ntype TextDirection = \"ltr\" | \"rtl\"\n\n/**\n * A unique locale with an id, code (e.g. \"en-US\"), name, slug, and optional fallback.\n *\n * @example\n * const locale: Locale = {\n *   id: \"ES\",\n *   code: \"es-ES\",\n *   slug: \"es\",\n *   name: \"Spanish\",\n *   textDirection: \"ltr\", // Optional\n * }\n */\nexport interface Locale {\n\tid: LocaleId\n\tcode: LocaleCode\n\tslug: string\n\tname: string\n\tfallback?: Locale\n\ttextDirection?: TextDirection\n}\n", "type Range = [from: number, to: number]\n\n/** Returns the input without any empty/overlapping ranges. */\nexport function pruneRanges(ranges: readonly Range[]): Range[] {\n\t// Sort the ranges according to their start index (or end index if same).\n\tranges = [...ranges].sort((a, b) => a[0] - b[0] || a[1] - b[1])\n\t// Remove empty/overlapping ranges and return the result.\n\tconst prunedRanges: Range[] = []\n\tfor (const range of ranges) {\n\t\tif (range[0] === range[1]) continue // Empty range.\n\t\tconst lastRange = prunedRanges[prunedRanges.length - 1]\n\t\tif (!lastRange) {\n\t\t\t// First range is always added.\n\t\t\tprunedRanges.push(range)\n\t\t\tcontinue\n\t\t}\n\t\t// Attempt to merge with last added range if possible.\n\t\tif (range[0] <= lastRange[1]) {\n\t\t\t// The ranges are either overlapping or adjacent.\n\t\t\tif (lastRange[1] < range[1]) {\n\t\t\t\t// The current range extends farther than the last added range.\n\t\t\t\tlastRange[1] = range[1]\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\t// There was no overlap, so we keep the current range.\n\t\tprunedRanges.push(range)\n\t}\n\treturn prunedRanges\n}\n\n/**\n * Returns the inverted ranges for the input. A length should be passed in to\n * account for the inverted range after the last input range.\n */\nexport function invertRanges(ranges: Range[], length?: number): Range[] {\n\tconst invertedRanges: Range[] = []\n\tlet lastEnd = 0\n\tfor (const [start, end] of ranges) {\n\t\tif (start <= lastEnd) {\n\t\t\t// Don't create 0 length ranges.\n\t\t\tlastEnd = end\n\t\t\tcontinue\n\t\t}\n\t\tinvertedRanges.push([lastEnd, start])\n\t\tlastEnd = end\n\t}\n\tif (length !== undefined && lastEnd < length) {\n\t\tinvertedRanges.push([lastEnd, length])\n\t}\n\treturn invertedRanges\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { pathVariablesRegExpRaw } from \"library/router/pathVariables.ts\"\nimport { slugify } from \"library/utils/slugify.ts\"\nimport { invertRanges, pruneRanges } from \"utils/ranges.ts\"\n\nconst slashesRegExp = /\\/+/gu\nconst doubleSlashesRegExp = /\\/{2,}/gu\nconst dashedPathVariablesRegExp = new RegExp(`-?${pathVariablesRegExpRaw}-?`, \"gi\")\nconst relativePathIndicatorsRegExp = /^\\.\\.?\\//u\n\nfunction ensureLeadingSlash(value: string): string {\n\tif (value.startsWith(\"/\")) return value\n\treturn \"/\" + value\n}\n\nfunction replaceDoubleSlashes(value: string): string {\n\treturn value.replace(doubleSlashesRegExp, \"/\")\n}\n\n/**\n * Takes a freeform string value and turns it into a slugified path, retaining\n * slashes and path variables.\n */\nexport function valueToPath(value: string): string {\n\t// Strip relative path indicators at the start (e.g., \"./\" or \"../\")\n\tvalue = value.replace(relativePathIndicatorsRegExp, \"/\")\n\tconst immutableRanges = getCharacterRanges(value, slashesRegExp, dashedPathVariablesRegExp)\n\tconst mutableRanges = invertRanges(immutableRanges, value.length)\n\tvalue = replaceRanges(value, mutableRanges, slugify)\n\tvalue = ensureLeadingSlash(value)\n\treturn replaceDoubleSlashes(value)\n}\n\n/**\n * Given an input string and one or more regular expressions, returns the\n * unique, non-overlapping ranges that match any of the regular expressions.\n */\nfunction getCharacterRanges(input: string, ...regexps: RegExp[]): [number, number][] {\n\t// Get all matching ranges in the input string.\n\tconst ranges: [number, number][] = []\n\tfor (const re of regexps) {\n\t\tfor (const match of input.matchAll(re)) {\n\t\t\tassert(match.index !== undefined)\n\t\t\tranges.push([match.index, match.index + match[0].length])\n\t\t}\n\t}\n\treturn pruneRanges(ranges)\n}\n\nfunction replaceRanges(value: string, ranges: [number, number][], replace: (value: string) => string): string {\n\tlet result = \"\"\n\tlet lastEnd = 0\n\tfor (const [start, end] of ranges) {\n\t\tif (start > lastEnd) {\n\t\t\tresult += value.substring(lastEnd, start)\n\t\t}\n\t\tresult += replace(value.substring(start, end))\n\t\tlastEnd = end\n\t}\n\tif (lastEnd < value.length) {\n\t\tresult += value.substring(lastEnd)\n\t}\n\treturn result\n}\n", "/**\n * Generic validation for destinations.\n * Reduces code duplication in validation functions.\n */\n\nimport { assertNever } from \"library/utils/assert.ts\"\nimport type { ValidationResult } from \"./ValidationResult.ts\"\nexport const maxInputLength = 1000\n\ntype LocationType = \"path\" | \"URL\"\n/* Message should contain the %s placeholder for the route type. */\ntype InvalidCharacterOption = { value: string; message: (locationType: LocationType) => string }\nconst invalidCharacters: InvalidCharacterOption[] = [\n\t{ value: \" \", message: locationType => `The ${locationType} cannot contain spaces` },\n\t{ value: \"*\", message: locationType => `The ${locationType} cannot contain *` },\n\t{ value: \"|\", message: locationType => `The ${locationType} cannot contain |` },\n]\n\nexport function validatePathOrURL(\n\tlocation: string,\n\tlocationType: LocationType,\n\toptions?: {\n\t\t// spaces-only needed for origin paths that allow * modifiers\n\t\tblockInvalidCharacters?: \"all\" | \"spaces-only\" | InvalidCharacterOption[]\n\t},\n): ValidationResult {\n\tlocation = location.trim()\n\n\t// Generic validation\n\tif (!location) {\n\t\treturn { result: \"empty\" }\n\t}\n\n\tif (location.length > maxInputLength) {\n\t\treturn { result: \"error\", message: `The ${locationType} is too long (max ${maxInputLength} characters)` }\n\t}\n\n\tif (options?.blockInvalidCharacters) {\n\t\tlet invalidCharactersToCheck: InvalidCharacterOption[]\n\n\t\tif (options.blockInvalidCharacters === \"spaces-only\") {\n\t\t\tinvalidCharactersToCheck = invalidCharacters.filter(char => char.value === \" \")\n\t\t} else if (options.blockInvalidCharacters === \"all\") {\n\t\t\tinvalidCharactersToCheck = invalidCharacters\n\t\t} else if (Array.isArray(options.blockInvalidCharacters)) {\n\t\t\tinvalidCharactersToCheck = options.blockInvalidCharacters\n\t\t} else {\n\t\t\tassertNever(options.blockInvalidCharacters)\n\t\t}\n\n\t\tfor (const invalidCharacter of invalidCharactersToCheck) {\n\t\t\tif (location.includes(invalidCharacter.value)) {\n\t\t\t\treturn { result: \"error\", message: invalidCharacter.message(locationType) }\n\t\t\t}\n\t\t}\n\t}\n\n\t// Path validation\n\tif (locationType === \"path\") {\n\t\tif (!location.startsWith(\"/\")) {\n\t\t\treturn { result: \"error\", message: \"The path must begin with /\" }\n\t\t}\n\t}\n\n\treturn { result: \"ok\", normalizedValue: location }\n}\n", "import { assert } from \"@framerjs/shared\"\nimport type { RouteNode } from \"document/models/CanvasTree/nodes/RouteNode.ts\"\nimport type { ValidationResult } from \"./ValidationResult.ts\"\nimport { validatePathOrURL } from \"./validatePathOrURL.ts\"\n\nconst genericErrorMessage = \"Please enter a valid path\"\n\n/**\n * Escapes parentheses in a path for storage.\n * `hello-(world)` \u2192 `hello-\\(world\\)`\n */\nexport function escapeParenthesesInPath(path: string): string {\n\t// Safari doesn't support lookbehind regexes, so we do this manually\n\tlet result = \"\"\n\tfor (let i = 0; i < path.length; i++) {\n\t\tconst char = path[i]\n\t\tconst prevChar = path[i - 1]\n\t\tresult += (char === \"(\" || char === \")\") && prevChar !== \"\\\\\" ? `\\\\${char}` : char\n\t}\n\treturn result\n}\n\nconst unescapeOpenParenthesesRegExp = /\\\\\\(/gu\nconst unescapeCloseParenthesesRegExp = /\\\\\\)/gu\n\n/**\n * Unescapes parentheses in a path for display.\n * `hello-\\(world\\)` \u2192 `hello-(world)`\n */\nfunction unescapeParenthesesInPath(path: string): string {\n\treturn path.replace(unescapeOpenParenthesesRegExp, \"(\").replace(unescapeCloseParenthesesRegExp, \")\")\n}\n\n/**\n * Transforms a stored path into a display-friendly format.\n */\nexport function getPathForDisplay(path: string): string {\n\treturn unescapeParenthesesInPath(path)\n}\n\nconst namedParamWithModifier = /:[a-z]\\w*[?+*]/i\nconst blockedPathFramerRegex = /^\\/_framer\\/login/u\nconst blockedPathWellKnownRegex = /\\/\\.well-known/u\n\n// Block ACME challenge paths (TLS certificate validation).\n// NOTE: URL-encoded bypasses like `/.well-known/%61cme-challenge` are not an issue,\n// because FDS (Go) decodes incoming request paths, so encoded requests won't match encoded rules.\nconst blockedPathAcmeChallengeRegex = /^\\/\\.well-known\\/acme-challenge(\\/|$)/u\n\n// Block wildcard/param paths that could match ACME challenge paths.\n// e.g. `/.well-known/*`, `/.well-known/:param` could match\n// `/.well-known/acme-challenge/:token` to bypass blockedPathAcmeChallengeRegex.\nconst couldMatchAcmeChallengeRegex = /^\\/\\.well-known\\/(\\*|\\(|:[^/]+)/u\n\nexport function validateRouteNodePathUniqueness(\n\trouteNodeType: \"redirect\" | \"rewrite\" | \"proxy\",\n\tpath: string,\n\texistingRouteNodes: readonly RouteNode[] = [],\n\teditingRouteNodeId?: string,\n): ValidationResult<undefined> {\n\tfor (const existing of existingRouteNodes) {\n\t\tif (path === existing.path && existing.id !== editingRouteNodeId) {\n\t\t\t// We store files as proxy nodes, but customers should only see \"files\".\n\t\t\tconst publicNodeType = routeNodeType === \"proxy\" ? \"file\" : routeNodeType\n\t\t\treturn { result: \"error\", message: `A ${publicNodeType} for this path already exists` }\n\t\t}\n\t}\n\n\treturn { result: \"ok\", normalizedValue: undefined }\n}\n\nconst unescapedParenthesesRegExp = /[(){}]/gu // we want to match unescaped (){} (i.e., not preceeded by \"\\\")\n\ninterface ValidateRouteNodePathOptions {\n\tallowWellKnownRewrites?: boolean\n}\n\nexport function validateRouteNodePath(\n\trouteNodeType: \"redirect\" | \"rewrite\" | \"header\" | \"proxy\",\n\tpath: string,\n\toptions: ValidateRouteNodePathOptions = {},\n): ValidationResult {\n\tconst validationResult = validatePathOrURL(path, \"path\", { blockInvalidCharacters: \"spaces-only\" })\n\tif (validationResult.result !== \"ok\") {\n\t\treturn validationResult\n\t}\n\n\tpath = validationResult.normalizedValue\n\n\t// Prevent modifiers (?, +, *) from being used in named parameters (:param) because they are\n\t// not supported\n\tif (namedParamWithModifier.exec(path)) {\n\t\treturn { result: \"error\", message: genericErrorMessage }\n\t}\n\n\tif (path.includes(\"?\")) {\n\t\treturn { result: \"error\", message: `Can't use query parameters (?)` }\n\t}\n\n\tif (path.includes(\"#\")) {\n\t\treturn { result: \"error\", message: `Can't use a scroll target (#)` }\n\t}\n\n\tif (path.includes(\"|\")) {\n\t\treturn { result: \"error\", message: `The path cannot contain |` }\n\t}\n\n\t// We want to match unescaped (){} (i.e., not preceeded by \"\\\"). Safari\n\t// doesn't support lookbehind regexes, so we do this manually.\n\tfor (const match of path.matchAll(unescapedParenthesesRegExp)) {\n\t\t// https://github.com/microsoft/TypeScript/issues/36788\n\t\tassert(match.index, \"validateRouteNodePath: match.index should be defined\")\n\n\t\t// According to MDN, no need to worry about charAt(-1).\n\t\t//\n\t\t// > If the index you supply is out of this range, JavaScript returns an empty string.\n\t\t//\n\t\t// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charAt#description\n\t\tif (path.charAt(match.index - 1) !== \"\\\\\") {\n\t\t\treturn { result: \"error\", message: genericErrorMessage }\n\t\t}\n\t}\n\n\tconst blockedPathsRegex = [blockedPathFramerRegex]\n\tif (routeNodeType === \"redirect\") {\n\t\t// Never allow redirects for `/.well-known/acme-challenge/*` paths.\n\t\t// Also block wildcards that could match acme-challenge paths.\n\t\tblockedPathsRegex.push(blockedPathAcmeChallengeRegex, couldMatchAcmeChallengeRegex)\n\t} else if (routeNodeType === \"rewrite\" && options.allowWellKnownRewrites) {\n\t\t// Enterprise only: allow `/.well-known/*` rewrites except acme-challenge.\n\t\t// Also block wildcards that could match acme-challenge paths.\n\t\tblockedPathsRegex.push(blockedPathAcmeChallengeRegex, couldMatchAcmeChallengeRegex)\n\t} else if (routeNodeType === \"proxy\") {\n\t\t// Allow `/.well-known/*` rewrites except acme-challenge.\n\t\t// Also block wildcards that could match acme-challenge paths.\n\t\tblockedPathsRegex.push(blockedPathAcmeChallengeRegex, couldMatchAcmeChallengeRegex)\n\t} else {\n\t\t// Block all `/.well-known` paths for headers and non-enterprise.\n\t\tblockedPathsRegex.push(blockedPathWellKnownRegex)\n\t}\n\n\tconst isBlockedPath = blockedPathsRegex.some(rx => rx.test(path))\n\tif (isBlockedPath) {\n\t\treturn { result: \"error\", message: `Reserved path, not allowed` }\n\t}\n\n\treturn { result: \"ok\", normalizedValue: path }\n}\n\nexport const testing = {\n\tunescapeParenthesesInPath,\n}\n", "import { valueToPath } from \"document/components/utils/valueToPath.ts\"\nimport type { CanvasNode, CanvasTree, LoadedScopeNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { RouteSegmentNode } from \"document/models/CanvasTree/nodes/RouteSegmentNode.ts\"\nimport {\n\tisCanvasPageNode,\n\tisRouteSegmentNode,\n\tisWebPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { escapeParenthesesInPath } from \"web/pages/projects/components/Domains/validation/validateRouteNode.ts\"\n\nexport function isEmptyCanvasPage(scope: LoadedScopeNode) {\n\tif (!isCanvasPageNode(scope)) return false\n\tconst groundNodes = scope.getGroundNodes()\n\treturn groundNodes.length === 0\n}\n\nexport function isEmptyWebPage(scope: LoadedScopeNode) {\n\tif (!isWebPageNode(scope)) return false\n\n\t// When creating a web page, we always insert a breakpoint already.\n\t// Only consider the web page empty if the only ground node has no children.\n\tconst groundNodes = scope.getGroundNodes()\n\tif (groundNodes.length > 1) return false\n\tif (groundNodes.length === 0) return true\n\n\tconst onlyGroundNode = groundNodes[0]\n\treturn onlyGroundNode?.children?.length === 0\n}\n\nexport function isWithoutChildren(node: CanvasNode | null) {\n\tif (!node) return false\n\treturn !node.children || node.children.length === 0\n}\n\nexport function hasAnyDescendantsWithWebPages(tree: CanvasTree, segmentId: NodeID) {\n\tconst segment = tree.get(segmentId)\n\tif (!isRouteSegmentNode(segment)) return false\n\n\tfor (const child of segment.walk()) {\n\t\tif (isRouteSegmentNode(child) && child.webPageId) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\nexport function splitPathToSegmentsAndSlugify(path: string, isWebPage: boolean = true) {\n\tconst segments = path\n\t\t.trim()\n\t\t.split(\"/\")\n\t\t.filter(Boolean)\n\t\t.map(segment => {\n\t\t\tconst segmentWithSlashStart = \"/\" + segment\n\t\t\tconst slugifiedPath = valueToPath(segmentWithSlashStart)\n\t\t\tconst slugifiedSegment = slugifiedPath.startsWith(\"/\") ? slugifiedPath.slice(1) : slugifiedPath\n\t\t\t// Escape parentheses for storage (e.g., \"hello-(world)\" \u2192 \"hello-\\(world\\)\")\n\t\t\treturn escapeParenthesesInPath(slugifiedSegment)\n\t\t})\n\n\tif (path.endsWith(\"/\") && isWebPage) segments.push(\"\") // turn the trailing slash to an index page\n\treturn segments\n}\n\nexport function formatPath(path: string) {\n\treturn `/${splitPathToSegmentsAndSlugify(path).join(\"/\")}`\n}\n\n/**\n * Returns true if the segment is a trailing slash segment.\n */\nfunction isTrailingSlashSegmentPath(segmentPath: string | undefined) {\n\treturn segmentPath === \"\"\n}\n\n/**\n * Returns true if the segment node has a trailing slash segment. A trailing\n * slash segment is a segment that is empty. For example, the path \"/blog/\" has\n * two segments: \"blog\" and \"\". The second segment is a trailing slash segment.\n */\nexport function isTrailingSlashSegmentNode(node: RouteSegmentNode): boolean {\n\treturn Boolean(node.webPageId && isTrailingSlashSegmentPath(node.segment))\n}\n\nexport function removeEmptySegmentsRecursive(segmentId: NodeID, tree: CanvasTree) {\n\tconst node = tree.get(segmentId)\n\tif (!isRouteSegmentNode(node)) return\n\n\tconst webPage = tree.get(node.webPageId)\n\tif (isWebPageNode(webPage)) return\n\n\tif (node.children.length > 0) return\n\n\tconst parent = node.parentid\n\n\ttree.removeNode(node)\n\n\tif (parent) removeEmptySegmentsRecursive(parent, tree)\n}\n", "import type { LanguageModel } from \"app/ai/languageModels.ts\"\nimport { isObject } from \"utils/typeChecks.ts\"\n\nexport type LocaleId = string\n\nexport const defaultLocaleId = \"default\"\n\nexport interface Locale {\n\tid: LocaleId\n\tcode: string\n\tslug: string\n\tname: string\n\tdraft: boolean\n\tcustomAiInstructions?: string\n\tfallback?: LocaleId\n\taiModel?: LanguageModel\n\tmanagedByAI?: boolean\n}\n\nexport interface WithLocales {\n\tlocales: readonly Locale[] | undefined\n}\n\nconst key = \"locales\" satisfies keyof WithLocales\nexport function isLocalesUpdate(change: unknown): change is WithLocales {\n\treturn isObject(change) && key in change\n}\n\n/**\n * Removing a locale may affect other locales' fallback chains. CMS Databases\n * generate locale fallback chains into indices. This means that removing a\n * locale that is a fallback or changing a fallback requires databases to be\n * regenerated.\n */\nexport function shouldRegenerateCollections(\n\tfromLocales: readonly Locale[] | undefined,\n\ttoLocales: readonly Locale[] | undefined,\n): boolean {\n\tif (!toLocales || !fromLocales) return false\n\n\t// Removing a locale may affect other locales' fallback chains\n\tif (fromLocales.length > toLocales.length) return true\n\n\tfor (const locale of toLocales) {\n\t\tconst matchingFromLocale = fromLocales.find(fromLocale => fromLocale.id === locale.id)\n\n\t\tif (!matchingFromLocale) continue\n\n\t\t// Changing a locale's fallback affects its fallback chain\n\t\tif (matchingFromLocale.fallback !== locale.fallback) return true\n\t}\n\n\treturn false\n}\n", "import { domParser } from \"library/render/utils/dom.ts\"\n\n/**\n * @important Can cause XSS vulnerabilities if the returned HTMLElement is\n * appended to the current DOM.\n * @return {HTMLElement} Returns an unsafe HTML element. This means, it does not\n * sanitize the input and is not safe to append to the current DOM.\n */\nexport function parseHTML(html: string): HTMLElement {\n\tconst string = `<body>${html}</body>` // we add a body tag so we don't accidentally have something in the head.\n\treturn domParser(string).body\n}\n", "import { environment } from \"environment/index.ts\"\nimport { assert } from \"library/utils/assert.ts\"\nimport { parseHTML } from \"./parseHTML.ts\"\nimport { isString } from \"./typeChecks.ts\"\n\nfunction memoize(fn: (arg: string) => string, maxSize: number) {\n\tconst cache = new Map<string, string>()\n\n\tfunction getMemoizedResult(arg: string): string {\n\t\tconst cachedValue = cache.get(arg)\n\t\tif (isString(cachedValue)) {\n\t\t\treturn cachedValue\n\t\t}\n\n\t\tconst result = fn(arg)\n\t\tcache.set(arg, result)\n\t\tif (cache.size > maxSize) {\n\t\t\tconst firstKey = cache.keys().next().value\n\t\t\tif (isString(firstKey)) {\n\t\t\t\tcache.delete(firstKey)\n\t\t\t}\n\t\t}\n\n\t\treturn result\n\t}\n\n\treturn getMemoizedResult\n}\n\nconst MAX_CACHE_SIZE = 100_000\n\nexport const getHTMLTextContentCached = memoize(getHTMLTextContent, MAX_CACHE_SIZE)\n\nfunction getHTMLTextContent(html: string): string {\n\tconst container = parseHTML(html)\n\n\t// innerText is not implemented in jsdom, so adding a fallback so tests\n\t// won't throw. This should not affect the behavior in the browser at all,\n\t// as innerText should always return a string. Read more:\n\t// https://github.com/jsdom/jsdom/issues/1245 Using textContent in tests as\n\t// it's close enough: https://stackoverflow.com/a/35213639/242684\n\n\tconst text = container.innerText as string | null\n\tif (environment.isTest) return text ?? container.textContent ?? \"\"\n\tassert(text !== null)\n\treturn text\n}\n\n/** Add newlines after specific ending tags so that line break info is not lost. */\nexport function getHTMLTextContentPreservingNewLinesCached(html: string, newLineReplacementCharacter = \"\\n\"): string {\n\tconst htmlWithNewlines = html.replace(/<\\/(h[1-6]|p|ul|ol)>/gu, `</$1>${newLineReplacementCharacter}`)\n\tconst textContent = getHTMLTextContentCached(htmlWithNewlines)\n\n\tconst replacementCharacterLength = newLineReplacementCharacter.length\n\tif (replacementCharacterLength && textContent.endsWith(newLineReplacementCharacter)) {\n\t\treturn textContent.slice(0, replacementCharacterLength * -1)\n\t}\n\n\treturn textContent\n}\n", "import type {\n\tRichTextBlock,\n\tRichTextDocument,\n\tRichTextInline,\n\tRichTextListItem,\n\tRichTextTableCell,\n\tRichTextTableRow,\n} from \"./RichTextDocument.ts\"\n\nexport function getPlainTextFromRichTextDocument(\n\tdocument: RichTextDocument,\n\t{ preserveTrailingEmptyBlockNewLine = false }: { preserveTrailingEmptyBlockNewLine?: boolean } = {},\n): string {\n\tconst blocks = getPlainTextFromRichTextBlocks(document.children)\n\tif (blocks.length === 0) return \"\"\n\n\tconst plainText = blocks.join(\"\\n\")\n\tif (!preserveTrailingEmptyBlockNewLine) return plainText\n\tif (document.children.some(richTextBlockHasText)) return plainText\n\treturn plainText + \"\\n\"\n}\n\nexport function stripNewLinesFromPlainText(plainText: string): string {\n\treturn plainText.replaceAll(/\\n+/gu, \"\")\n}\n\nfunction getPlainTextFromRichTextBlocks(blocks: RichTextBlock[]): string[] {\n\treturn blocks.flatMap(block => {\n\t\tif (block.type === \"media\" || block.type === \"module\") return []\n\t\treturn [getPlainTextFromRichTextBlock(block)]\n\t})\n}\n\nfunction getPlainTextFromRichTextBlock(block: RichTextBlock): string {\n\tswitch (block.type) {\n\t\tcase \"textBlock\":\n\t\t\treturn block.children.map(getPlainTextFromRichTextInline).join(\"\")\n\n\t\tcase \"bulletedList\":\n\t\tcase \"numberedList\":\n\t\t\treturn getPlainTextFromRichTextListItems(block.children).join(\"\\n\")\n\n\t\tcase \"blockquote\":\n\t\t\treturn getPlainTextFromRichTextBlocks(block.children).join(\"\\n\")\n\n\t\tcase \"table\":\n\t\t\treturn block.children.map(getPlainTextFromRichTextTableRow).join(\"\\n\")\n\n\t\tcase \"media\":\n\t\tcase \"module\":\n\t\t\treturn \"\"\n\t}\n}\n\nfunction getPlainTextFromRichTextListItem(item: RichTextListItem): string {\n\treturn getPlainTextFromRichTextBlocks(item.children).join(\"\\n\")\n}\n\nfunction getPlainTextFromRichTextListItems(items: RichTextListItem[]): string[] {\n\treturn items.flatMap(item => {\n\t\tconst plainText = getPlainTextFromRichTextListItem(item)\n\t\treturn plainText.length > 0 ? [plainText] : []\n\t})\n}\n\nfunction getPlainTextFromRichTextTableRow(row: RichTextTableRow): string {\n\treturn row.children.map(getPlainTextFromRichTextTableCell).join(\"\\n\")\n}\n\nfunction getPlainTextFromRichTextTableCell(cell: RichTextTableCell): string {\n\treturn getPlainTextFromRichTextBlocks(cell.children).join(\"\\n\")\n}\n\nfunction getPlainTextFromRichTextInline(inline: RichTextInline): string {\n\tswitch (inline.type) {\n\t\tcase \"text\":\n\t\t\treturn inline.text\n\n\t\tcase \"lineBreak\":\n\t\t\treturn \"\\n\"\n\t}\n}\n\nfunction richTextBlockHasText(block: RichTextBlock): boolean {\n\tswitch (block.type) {\n\t\tcase \"textBlock\":\n\t\t\treturn block.children.some(richTextInlineHasText)\n\n\t\tcase \"bulletedList\":\n\t\tcase \"numberedList\":\n\t\t\treturn block.children.some(richTextListItemHasText)\n\n\t\tcase \"blockquote\":\n\t\t\treturn block.children.some(richTextBlockHasText)\n\n\t\tcase \"table\":\n\t\t\treturn block.children.some(richTextTableRowHasText)\n\n\t\tcase \"media\":\n\t\tcase \"module\":\n\t\t\treturn false\n\t}\n}\n\nfunction richTextListItemHasText(item: RichTextListItem): boolean {\n\treturn item.children.some(richTextBlockHasText)\n}\n\nfunction richTextTableRowHasText(row: RichTextTableRow): boolean {\n\treturn row.children.some(richTextTableCellHasText)\n}\n\nfunction richTextTableCellHasText(cell: RichTextTableCell): boolean {\n\treturn cell.children.some(richTextBlockHasText)\n}\n\nfunction richTextInlineHasText(inline: RichTextInline): boolean {\n\tswitch (inline.type) {\n\t\tcase \"text\":\n\t\t\treturn inline.text.length > 0\n\n\t\tcase \"lineBreak\":\n\t\t\treturn false\n\t}\n}\n", "import type { RelativeNumber } from \"library/render/types/RelativeNumber.ts\"\nimport type { Size } from \"library/render/types/Size.ts\"\nimport type { PluginManifestId } from \"plugins/plugins.ts\"\nimport { getHTMLTextContentCached, getHTMLTextContentPreservingNewLinesCached } from \"utils/getHTMLTextContent.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport type { Mode } from \"#framer-plugin/messages.ts\"\nimport type { LocaleId } from \"./CanvasTree/traits/WithLocales.ts\"\nimport type { RichTextDocument } from \"./richText/RichTextDocument.ts\"\nimport { getPlainTextFromRichTextDocument, stripNewLinesFromPlainText } from \"./richText/richTextPlainText.ts\"\n\n/**\n * Hash of the original value. To calculate if the current value is possibly outdated. Hashes\n * were originally stored as strings but are now stored as numbers.\n */\nexport type LocalizedValueHash = number | string\nexport type LocalizedTextValue = string | RichTextDocument\n\nexport interface LocalizedValue<T = string> {\n\t/** `null` means that the original value is approved without overriding it. */\n\treadonly value: T | null\n\treadonly lastEdited: number\n\t/**\n\t * Hash of the original value. To calculate if the current value is possibly outdated. Hashes\n\t * were originally stored as strings but are now stored as numbers.\n\t */\n\treadonly hash: LocalizedValueHash\n\t/**\n\t * Defaults to `undefined` which stands for `text`. Can be `text` or `rich-text`. You can't set\n\t * `text` to keep the stored data small.\n\t */\n\treadonly type?: \"rich-text\"\n\t/** Manually ask for a review. By default this state only happens if the hash is outdated. */\n\treadonly needsReview?: true\n\t/** Whether the value is generated by GPT. */\n\treadonly generatedByAI?: true\n\t/** The manifest ID of the plugin that set the localized value, if set by a plugin. */\n\treadonly pluginId?: PluginManifestId\n\t/** The mode of the plugin that set the localized value, if set by a plugin. */\n\treadonly pluginMode?: Mode\n\t/**\n\t * Only needed for images, unfortunately we can't merge this into the value because we store\n\t * localized images as a string.\n\t */\n\treadonly imageFocalPoint?: { positionX: RelativeNumber; positionY: RelativeNumber }\n}\n\nexport type LocalizedValues<T = string> = Readonly<Record<LocaleId, LocalizedValue<T>>>\n\nexport type LocalizedSize = Record<LocaleId, Size>\n\nexport type NonNullLocalizedValue<T = string> = LocalizedValue<T> & { value: T }\n\nexport function isNonNullLocalizedValue<T>(\n\tlocalizedValue: LocalizedValue<T> | null | undefined,\n): localizedValue is NonNullLocalizedValue<T> {\n\treturn localizedValue?.value !== undefined && localizedValue?.value !== null\n}\n\nfunction getLocalizedValueTextFromNonNullValue(\n\tlocalizedValue: NonNullLocalizedValue<string | RichTextDocument>,\n\t{ preserveNewLines = false }: { preserveNewLines?: boolean } = {},\n): string {\n\tif (isString(localizedValue.value)) {\n\t\tif (localizedValue.type !== \"rich-text\") return localizedValue.value\n\n\t\treturn preserveNewLines\n\t\t\t? getHTMLTextContentPreservingNewLinesCached(localizedValue.value)\n\t\t\t: getHTMLTextContentCached(localizedValue.value)\n\t}\n\n\treturn getLocalizedRichTextPlainText(localizedValue.value, { preserveNewLines })\n}\n\nexport function getLocalizedValueText(\n\tlocalizedValue: NonNullLocalizedValue<string | RichTextDocument>,\n\toptions?: { preserveNewLines?: boolean },\n): string\nexport function getLocalizedValueText(\n\tlocalizedValue: LocalizedValue<string | RichTextDocument> | null | undefined,\n\toptions?: { preserveNewLines?: boolean },\n): string | null | undefined\nexport function getLocalizedValueText(\n\tlocalizedValue: LocalizedValue<string | RichTextDocument> | null | undefined,\n\toptions?: { preserveNewLines?: boolean },\n): string | null | undefined {\n\tif (localizedValue === null || localizedValue === undefined) return undefined\n\tif (localizedValue.value === null) return null\n\tif (!isNonNullLocalizedValue(localizedValue)) return undefined\n\treturn getLocalizedValueTextFromNonNullValue(localizedValue, options)\n}\n\nfunction getLocalizedRichTextPlainText(\n\tdocument: RichTextDocument,\n\t{ preserveNewLines }: { preserveNewLines: boolean },\n): string {\n\tconst plainText = getPlainTextFromRichTextDocument(document)\n\treturn preserveNewLines ? plainText : stripNewLinesFromPlainText(plainText)\n}\n", "import { defaultLocaleId } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport type { LocalizedValues, NonNullLocalizedValue } from \"document/models/LocalizedValue.ts\"\nimport { isNonNullLocalizedValue } from \"document/models/LocalizedValue.ts\"\nimport type { Locale } from \"library/router/types.ts\"\n\n/** Returns a non null localized value. Checks for possible fallbacks. */\nexport function getLocalizedValueForActiveLocale<T = string>(\n\tactiveLocale: Locale | undefined,\n\tlocalizedValues: LocalizedValues<T> | undefined,\n): NonNullLocalizedValue<T> | null {\n\tif (!localizedValues) return null\n\tif (!activeLocale || activeLocale.id === defaultLocaleId) return null\n\n\twhile (activeLocale) {\n\t\tconst localizedValue = localizedValues[activeLocale.id]\n\n\t\tif (localizedValue && isNonNullLocalizedValue(localizedValue)) {\n\t\t\treturn localizedValue\n\t\t}\n\n\t\tactiveLocale = activeLocale.fallback\n\t}\n\n\treturn null\n}\n", "import type { TextDirection } from \"text/types.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\n\n// Copied from https://stackoverflow.com/questions/3191664/list-of-all-locales-and-their-short-codes\n//\n// Extended with: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes\n//\n// Cross-checked against:\n// https://www.loc.gov/standards/iso639-2/php/code_list.php\n// The only code missing is \"Bihari languages\" (\"bh\"), which according to\n// Wikipedia is deprecated, so I left it out.\nconst allLocaleLanguages = {\n\taa: \"Afar\",\n\tab: \"Abkhazian\",\n\tae: \"Avestan\",\n\taf: \"Afrikaans\",\n\tak: \"Akan\",\n\tsq: \"Albanian\",\n\tam: \"Amharic\",\n\tan: \"Aragonese\",\n\tar: \"Arabic\",\n\thy: \"Armenian\",\n\tas: \"Assamese\",\n\tasa: \"Asu\",\n\tav: \"Avaric\",\n\tay: \"Aymara\",\n\taz: \"Azerbaijani\",\n\t\"az-Cyrl\": \"Azerbaijani (Cyrillic)\",\n\t\"az-Latn\": \"Azerbaijani (Latin)\",\n\tbm: \"Bambara\",\n\tba: \"Bashkir\",\n\teu: \"Basque\",\n\tbe: \"Belarusian\",\n\tbem: \"Bemba\",\n\tbez: \"Bena\",\n\tbn: \"Bengali\",\n\tbi: \"Bislama\",\n\tbs: \"Bosnian\",\n\tbr: \"Breton\",\n\tbg: \"Bulgarian\",\n\tmy: \"Burmese\",\n\t\"yue-Hant\": \"Cantonese (Traditional)\",\n\tca: \"Catalan\",\n\ttzm: \"Central Morocco Tamazight\",\n\t\"tzm-Latn\": \"Central Morocco Tamazight (Latin)\",\n\tchr: \"Cherokee\",\n\tch: \"Chamorro\",\n\tce: \"Chechen\",\n\tny: \"Chichewa, Chewa, Nyanja\",\n\tcgg: \"Chiga\",\n\tzh: \"Chinese\",\n\t\"zh-Hans\": \"Chinese (Simplified Han)\",\n\t\"zh-Hant\": \"Chinese (Traditional Han)\",\n\tcu: \"Church Slavic, Old Slavonic\",\n\tcv: \"Chuvash\",\n\tkw: \"Cornish\",\n\tco: \"Corsican\",\n\tcr: \"Cree\",\n\thr: \"Croatian\",\n\tcs: \"Czech\",\n\tda: \"Danish\",\n\tdv: \"Divehi, Dhivehi, Maldivian\",\n\tnl: \"Dutch\",\n\tdz: \"Dzongkha\",\n\tebu: \"Embu\",\n\ten: \"English\",\n\teo: \"Esperanto\",\n\tet: \"Estonian\",\n\tee: \"Ewe\",\n\tfo: \"Faroese\",\n\tfil: \"Filipino\",\n\tfi: \"Finnish\",\n\tfj: \"Fijian\",\n\tfr: \"French\",\n\tff: \"Fulah\",\n\tgd: \"Gaelic, Scottish Gaelic\",\n\tgl: \"Galician\",\n\tlg: \"Ganda\",\n\tka: \"Georgian\",\n\tde: \"German\",\n\tel: \"Greek\",\n\tgn: \"Guarani\",\n\tgu: \"Gujarati\",\n\tguz: \"Gusii\",\n\tht: \"Haitian, Haitian Creole\",\n\tha: \"Hausa\",\n\t\"ha-Latn\": \"Hausa (Latin)\",\n\thaw: \"Hawaiian\",\n\the: \"Hebrew\",\n\thz: \"Herero\",\n\thi: \"Hindi\",\n\tho: \"Hiri Motu\",\n\thu: \"Hungarian\",\n\tis: \"Icelandic\",\n\tio: \"Ido\",\n\tig: \"Igbo\",\n\tid: \"Indonesian\",\n\tia: \"Interlingua\",\n\tie: \"Interlingue, Occidental\",\n\tiu: \"Inuktitut\",\n\tik: \"Inupiaq\",\n\tga: \"Irish\",\n\tit: \"Italian\",\n\tja: \"Japanese\",\n\tjv: \"Javanese\",\n\tkea: \"Kabuverdianu\",\n\tkab: \"Kabyle\",\n\tkl: \"Kalaallisut\",\n\tkln: \"Kalenjin\",\n\tkam: \"Kamba\",\n\tkn: \"Kannada\",\n\tkr: \"Kanuri\",\n\tks: \"Kashmiri\",\n\tkk: \"Kazakh\",\n\t\"kk-Cyrl\": \"Kazakh (Cyrillic)\",\n\tkm: \"Khmer\",\n\tki: \"Kikuyu\",\n\trw: \"Kinyarwanda\",\n\tky: \"Kirghiz, Kyrgyz\",\n\tkv: \"Komi\",\n\tkg: \"Kongo\",\n\tkok: \"Konkani\",\n\tko: \"Korean\",\n\tkhq: \"Koyra Chiini\",\n\tses: \"Koyraboro Senni\",\n\tkj: \"Kuanyama, Kwanyama\",\n\tku: \"Kurdish\",\n\tlag: \"Langi\",\n\tlo: \"Lao\",\n\tla: \"Latin\",\n\tlv: \"Latvian\",\n\tli: \"Limburgan, Limburger, Limburgish\",\n\tln: \"Lingala\",\n\tlt: \"Lithuanian\",\n\tlu: \"Luba-Katanga\",\n\tluo: \"Luo\",\n\tlb: \"Luxembourgish, Letzeburgesch\",\n\tluy: \"Luyia\",\n\tmk: \"Macedonian\",\n\tjmc: \"Machame\",\n\tkde: \"Makonde\",\n\tmg: \"Malagasy\",\n\tms: \"Malay\",\n\tml: \"Malayalam\",\n\tmt: \"Maltese\",\n\tgv: \"Manx\",\n\tmi: \"Maori\",\n\tna: \"Nauru\",\n\tmr: \"Marathi\",\n\tmh: \"Marshallese\",\n\tmas: \"Masai\",\n\tnv: \"Navajo, Navaho\",\n\tmer: \"Meru\",\n\tmn: \"Mongolian\",\n\tcnr: \"Montenegrin\",\n\tmfe: \"Morisyen\",\n\tnaq: \"Nama\",\n\tne: \"Nepali\",\n\tng: \"Ndonga\",\n\tse: \"Northern Sami\",\n\tnd: \"North Ndebele\",\n\tnb: \"Norwegian Bokm\u00E5l\",\n\tnn: \"Norwegian Nynorsk\",\n\tno: \"Norwegian\",\n\tnyn: \"Nyankole\",\n\toc: \"Occitan\",\n\toj: \"Ojibwa\",\n\tor: \"Oriya\",\n\tom: \"Oromo\",\n\tos: \"Ossetian, Ossetic\",\n\tpi: \"Pali\",\n\tps: \"Pashto\",\n\tfa: \"Persian\",\n\tpl: \"Polish\",\n\tpt: \"Portuguese\",\n\tpa: \"Punjabi\",\n\t\"pa-Arab\": \"Punjabi (Arabic)\",\n\t\"pa-Guru\": \"Punjabi (Gurmukhi)\",\n\tqu: \"Quechua\",\n\tro: \"Romanian\",\n\trm: \"Romansh\",\n\trof: \"Rombo\",\n\trn: \"Rundi\",\n\tru: \"Russian\",\n\trwk: \"Rwa\",\n\tsm: \"Samoan\",\n\tsaq: \"Samburu\",\n\tsg: \"Sango\",\n\tsa: \"Sanskrit\",\n\tsc: \"Sardinian\",\n\tseh: \"Sena\",\n\tsr: \"Serbian\",\n\t\"sr-Cyrl\": \"Serbian (Cyrillic)\",\n\t\"sr-Latn\": \"Serbian (Latin)\",\n\tsn: \"Shona\",\n\tii: \"Sichuan Yi\",\n\tsd: \"Sindhi\",\n\tsi: \"Sinhala\",\n\tsk: \"Slovak\",\n\tsl: \"Slovenian\",\n\txog: \"Soga\",\n\tso: \"Somali\",\n\tst: \"Southern Sotho\",\n\tnr: \"South Ndebele\",\n\tes: \"Spanish\",\n\tsu: \"Sundanese\",\n\tsw: \"Swahili\",\n\tss: \"Swati\",\n\tsv: \"Swedish\",\n\tgsw: \"Swiss German\",\n\tshi: \"Tachelhit\",\n\t\"shi-Latn\": \"Tachelhit (Latin)\",\n\t\"shi-Tfng\": \"Tachelhit (Tifinagh)\",\n\ttl: \"Tagalog\",\n\tty: \"Tahitian\",\n\tdav: \"Taita\",\n\ttg: \"Tajik\",\n\tta: \"Tamil\",\n\ttt: \"Tatar\",\n\tte: \"Telugu\",\n\tteo: \"Teso\",\n\tth: \"Thai\",\n\tbo: \"Tibetan\",\n\tti: \"Tigrinya\",\n\tto: \"Tonga\",\n\tts: \"Tsonga\",\n\ttn: \"Tswana\",\n\ttr: \"Turkish\",\n\ttk: \"Turkmen\",\n\ttw: \"Twi\",\n\tug: \"Uighur, Uyghur\",\n\tuk: \"Ukrainian\",\n\tur: \"Urdu\",\n\tuz: \"Uzbek\",\n\t\"uz-Arab\": \"Uzbek (Arabic)\",\n\t\"uz-Cyrl\": \"Uzbek (Cyrillic)\",\n\t\"uz-Latn\": \"Uzbek (Latin)\",\n\tve: \"Venda\",\n\tvi: \"Vietnamese\",\n\tvo: \"Volap\u00FCk\",\n\tvun: \"Vunjo\",\n\twa: \"Walloon\",\n\tcy: \"Welsh\",\n\tfy: \"Western Frisian\",\n\two: \"Wolof\",\n\txh: \"Xhosa\",\n\tyi: \"Yiddish\",\n\tyo: \"Yoruba\",\n\tza: \"Zhuang, Chuang\",\n\tzu: \"Zulu\",\n} as const\n\nconst allLocaleRegions = {\n\tAL: \"Albania\",\n\tAS: \"American Samoa\",\n\tAR: \"Argentina\",\n\tAM: \"Armenia\",\n\tAT: \"Austria\",\n\tAU: \"Australia\",\n\tAZ: \"Azerbaijan\",\n\tBA: \"Bosnia and Herzegovina\",\n\tBD: \"Bangladesh\",\n\tBE: \"Belgium\",\n\tBF: \"Burkina Faso\",\n\tBG: \"Bulgaria\",\n\tBH: \"Bahrain\",\n\tBI: \"Burundi\",\n\tBJ: \"Benin\",\n\tBL: \"Saint Barth\u00E9lemy\",\n\tBN: \"Brunei\",\n\tBO: \"Bolivia\",\n\tBR: \"Brazil\",\n\tBW: \"Botswana\",\n\tBY: \"Belarus\",\n\tBZ: \"Belize\",\n\tCA: \"Canada\",\n\tCD: \"Congo - Kinshasa\",\n\tCF: \"Central African Republic\",\n\tCG: \"Congo - Brazzaville\",\n\tCH: \"Switzerland\",\n\tCI: \"C\u00F4te d\u2019Ivoire\",\n\tCL: \"Chile\",\n\tCM: \"Cameroon\",\n\tCV: \"Cape Verde\",\n\tCN: \"China\",\n\tCO: \"Colombia\",\n\tCR: \"Costa Rica\",\n\tCY: \"Cyprus\",\n\tCZ: \"Czechia\",\n\tDE: \"Germany\",\n\tDJ: \"Djibouti\",\n\tDK: \"Denmark\",\n\tDO: \"Dominican Republic\",\n\tDZ: \"Algeria\",\n\tEC: \"Ecuador\",\n\tEE: \"Estonia\",\n\tEG: \"Egypt\",\n\tER: \"Eritrea\",\n\tES: \"Spain\",\n\tET: \"Ethiopia\",\n\tFI: \"Finland\",\n\tFO: \"Faroe Islands\",\n\tFR: \"France\",\n\tGA: \"Gabon\",\n\tGB: \"United Kingdom\",\n\tGE: \"Georgia\",\n\tGH: \"Ghana\",\n\tGL: \"Greenland\",\n\tGN: \"Guinea\",\n\tGP: \"Guadeloupe\",\n\tGQ: \"Equatorial Guinea\",\n\tGR: \"Greece\",\n\tGT: \"Guatemala\",\n\tGU: \"Guam\",\n\tGW: \"Guinea-Bissau\",\n\tHK: \"Hong Kong SAR China\",\n\tHN: \"Honduras\",\n\tHR: \"Croatia\",\n\tHU: \"Hungary\",\n\tID: \"Indonesia\",\n\tIE: \"Ireland\",\n\tIL: \"Israel\",\n\tIN: \"India\",\n\tIQ: \"Iraq\",\n\tIR: \"Iran\",\n\tIS: \"Iceland\",\n\tIT: \"Italy\",\n\tJM: \"Jamaica\",\n\tJO: \"Jordan\",\n\tJP: \"Japan\",\n\tKE: \"Kenya\",\n\tKH: \"Cambodia\",\n\tKM: \"Comoros\",\n\tKR: \"South Korea\",\n\tKW: \"Kuwait\",\n\tKZ: \"Kazakhstan\",\n\tLB: \"Lebanon\",\n\tLI: \"Liechtenstein\",\n\tLK: \"Sri Lanka\",\n\tLT: \"Lithuania\",\n\tLU: \"Luxembourg\",\n\tLV: \"Latvia\",\n\tLY: \"Libya\",\n\tMA: \"Morocco\",\n\tMC: \"Monaco\",\n\tMD: \"Moldova\",\n\tME: \"Montenegro\",\n\tMF: \"Saint Martin\",\n\tMG: \"Madagascar\",\n\tMH: \"Marshall Islands\",\n\tMK: \"Macedonia\",\n\tML: \"Mali\",\n\tMM: \"Myanmar [Burma]\",\n\tMO: \"Macau SAR China\",\n\tMP: \"Northern Mariana Islands\",\n\tMQ: \"Martinique\",\n\tMT: \"Malta\",\n\tMU: \"Mauritius\",\n\tMX: \"Mexico\",\n\tMY: \"Malaysia\",\n\tMZ: \"Mozambique\",\n\tNA: \"Namibia\",\n\tNE: \"Niger\",\n\tNG: \"Nigeria\",\n\tNI: \"Nicaragua\",\n\tNL: \"Netherlands\",\n\tNO: \"Norway\",\n\tNP: \"Nepal\",\n\tNZ: \"New Zealand\",\n\tOM: \"Oman\",\n\tPA: \"Panama\",\n\tPE: \"Peru\",\n\tPH: \"Philippines\",\n\tPK: \"Pakistan\",\n\tPL: \"Poland\",\n\tPR: \"Puerto Rico\",\n\tPT: \"Portugal\",\n\tPY: \"Paraguay\",\n\tQA: \"Qatar\",\n\tRE: \"R\u00E9union\",\n\tRO: \"Romania\",\n\tRS: \"Serbia\",\n\tRU: \"Russia\",\n\tRW: \"Rwanda\",\n\tSA: \"Saudi Arabia\",\n\tSD: \"Sudan\",\n\tSE: \"Sweden\",\n\tSG: \"Singapore\",\n\tSI: \"Slovenia\",\n\tSK: \"Slovakia\",\n\tSN: \"Senegal\",\n\tSO: \"Somalia\",\n\tSV: \"El Salvador\",\n\tSY: \"Syria\",\n\tTD: \"Chad\",\n\tTG: \"Togo\",\n\tTH: \"Thailand\",\n\tTN: \"Tunisia\",\n\tTO: \"Tonga\",\n\tTR: \"Turkey\",\n\tTT: \"Trinidad and Tobago\",\n\tTW: \"Taiwan\",\n\tTZ: \"Tanzania\",\n\tUA: \"Ukraine\",\n\tUG: \"Uganda\",\n\tUM: \"U.S. Minor Outlying Islands\",\n\tAE: \"United Arab Emirates\",\n\tUS: \"United States\",\n\tUY: \"Uruguay\",\n\tAF: \"Afghanistan\",\n\tUZ: \"Uzbekistan\",\n\tVE: \"Venezuela\",\n\tVI: \"U.S. Virgin Islands\",\n\tVN: \"Vietnam\",\n\tYE: \"Yemen\",\n\tZA: \"South Africa\",\n\tZM: \"Zambia\",\n\tZW: \"Zimbabwe\",\n\t\"419\": \"Latin America\",\n} as const\n\n// Languages\n\nexport type LocaleLanguageCode = keyof typeof allLocaleLanguages\n\nexport function isLocaleLanguageCode(code: unknown): code is LocaleLanguageCode {\n\treturn isString(code) && code in allLocaleLanguages\n}\n\nexport const localeLanguages: Readonly<Record<LocaleLanguageCode, string>> = allLocaleLanguages\n\n// Regions\n\nexport type LocaleRegionCode = keyof typeof allLocaleRegions\n\nexport function isLocaleRegionCode(code: unknown): code is LocaleRegionCode {\n\treturn isString(code) && code in allLocaleRegions\n}\n\nexport const localeRegions: Readonly<Record<LocaleRegionCode, string>> = allLocaleRegions\n\n// Locale\n\nexport type LocaleCode = string\n\nexport function isLocaleCode(code: unknown): code is LocaleCode {\n\tif (!isString(code)) return false\n\tif (isLocaleLanguageCode(code)) return true\n\tconst [languageCode, regionCode] = parseLocaleLanguageAndRegion(code)\n\treturn Boolean(languageCode && regionCode)\n}\n\n// Parsing\n\nexport function parseLocaleLanguageAndRegion(\n\tlocale: string,\n): [LocaleLanguageCode | undefined, LocaleRegionCode | undefined] {\n\tif (!isString(locale)) return [undefined, undefined]\n\n\tconst segments = locale.split(\"-\")\n\n\tlet rawLanguageCode = \"\"\n\tlet regionCode: LocaleRegionCode | undefined\n\n\tfor (const segment of segments) {\n\t\tif (isLocaleRegionCode(segment)) {\n\t\t\tregionCode = segment\n\t\t\tcontinue\n\t\t}\n\t\tif (!rawLanguageCode) {\n\t\t\trawLanguageCode = segment\n\t\t\tcontinue\n\t\t}\n\t\trawLanguageCode += \"-\" + segment\n\t}\n\n\treturn [isLocaleLanguageCode(rawLanguageCode) ? rawLanguageCode : undefined, regionCode]\n}\n\n/** Languages that are effectively always RTL */\nconst rtlLanguages: Set<LocaleLanguageCode> = new Set([\n\t\"ar\",\n\t\"dv\",\n\t\"fa\",\n\t\"he\",\n\t\"ks\",\n\t\"ps\",\n\t\"sd\",\n\t\"ug\",\n\t\"ur\",\n\t\"yi\",\n\t// deliberately NOT: ku\n])\n\nfunction isArabicScript(locale: string): boolean {\n\treturn locale.endsWith(\"-Arab\") || locale.includes(\"-Arab-\")\n}\n\nexport function getTextDirection(locale: string): NonNullable<TextDirection> {\n\tif (isArabicScript(locale)) return \"rtl\"\n\n\tconst [languageCode] = parseLocaleLanguageAndRegion(locale)\n\treturn languageCode && rtlLanguages.has(languageCode) ? \"rtl\" : \"ltr\"\n}\n", "import { isShallowArrayEqual } from \"./isShallowEqual.ts\"\n\nconst VALUE_NOT_CALCULATED = Symbol()\n\n/**\n * Memoize the last calculated value by comparing all arguments with shallow equality. Memoization\n * is not performed if the function throws an error.\n */\nexport function memoizeOne<Args extends unknown[], Result>(calculate: (...args: Args) => Result) {\n\tlet previousArgs: Args | undefined\n\t// We use a symbol to be able to differentiate between a case when `calculate` returns undefined\n\t// (and we should memoize that) and a case when `calculate` throws an error (and we should *not*\n\t// memoize that or erroneously return undefined on subsequent calls).\n\tlet previousValue: Result | typeof VALUE_NOT_CALCULATED = VALUE_NOT_CALCULATED\n\treturn (...args: Args): Result => {\n\t\tif (previousArgs && isShallowArrayEqual(previousArgs, args) && previousValue !== VALUE_NOT_CALCULATED) {\n\t\t\treturn previousValue\n\t\t}\n\t\tpreviousArgs = args\n\t\tconst value = calculate(...args)\n\t\tpreviousValue = value\n\t\treturn value\n\t}\n}\n", "import { assert, emptyArray } from \"@framerjs/shared\"\nimport { getTextDirection } from \"document/components/chrome/shared/locales.ts\"\nimport type { CanvasTree } from \"document/models/CanvasTree/index.ts\"\nimport type { LocaleId, Locale as VekterLocale } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport type { Locale as RouterLocale } from \"library/router/types.ts\"\nimport type { Mutable } from \"./Mutable.ts\"\nimport { memoizeOne } from \"./memoizeOne.ts\"\n\ntype GetRouterLocalesMode = \"includeDrafts\" | \"excludeDrafts\"\n\n/**\n * Converts \"Vekter\" locales (persisted) to \"Router\" locales (runtime).\n *\n * We maintain two Locale interfaces for different purposes:\n *\n * **Vekter Locale (persisted):**\n * - Stored in the canvas tree document\n * - Contains editor-specific fields (e.g. `draft`, `customAiInstructions`)\n * - Uses `fallback?: LocaleId` (just an ID reference for storage efficiency)\n * - Mutable for editing\n *\n * **Router Locale (runtime):**\n * - Used in published sites and navigation\n * - Contains runtime fields (e.g. `textDirection`)\n * - Uses `fallback?: Locale` (resolved chain for fast traversal)\n * - Readonly for stability\n * - No editor-specific concerns\n *\n * This conversion resolves fallback ID references into nested locale chains,\n * filters draft locales when needed, and adds text direction for rendering.\n *\n * @param tree - The tree to get the locales from.\n * @param mode - Whether to include draft locales.\n * @returns The router locales.\n */\nexport function getRouterLocales(tree: CanvasTree, mode: GetRouterLocalesMode): readonly RouterLocale[] {\n\tconst defaultLocale = tree.root.getDefaultLocale()\n\tconst locales = tree.root.locales ?? emptyArray()\n\n\tif (mode === \"includeDrafts\") {\n\t\treturn memoizedVekterLocalesToRouterLocalesIncludingDrafts(defaultLocale, locales)\n\t}\n\n\treturn memoizedVekterLocalesToRouterLocalesExcludingDrafts(defaultLocale, locales)\n}\n\nexport function getRouterLocale(\n\ttree: CanvasTree,\n\tlocaleId?: LocaleId,\n\tmode: GetRouterLocalesMode = \"includeDrafts\",\n): RouterLocale {\n\tconst locales = getRouterLocales(tree, mode)\n\tconst defaultLocale = locales[0]\n\tassert(defaultLocale, \"Default locale should always exist\")\n\n\tif (!localeId) return defaultLocale\n\n\treturn locales.find(({ id }) => id === localeId) ?? defaultLocale\n}\n\nconst memoizedVekterLocalesToRouterLocalesIncludingDrafts = memoizeOne(\n\t(defaultLocale: VekterLocale, locales: readonly VekterLocale[]): readonly RouterLocale[] => {\n\t\tconst vekterLocales = [defaultLocale, ...locales]\n\t\treturn vekterLocalesToRouterLocales(vekterLocales, { includeDrafts: true })\n\t},\n)\n\nconst memoizedVekterLocalesToRouterLocalesExcludingDrafts = memoizeOne(\n\t(defaultLocale: VekterLocale, locales: readonly VekterLocale[]): readonly RouterLocale[] => {\n\t\tconst vekterLocales = [defaultLocale, ...locales]\n\t\treturn vekterLocalesToRouterLocales(vekterLocales, { includeDrafts: false })\n\t},\n)\n\nfunction vekterLocalesToRouterLocales(\n\tlocales: readonly VekterLocale[],\n\t{ includeDrafts }: { includeDrafts: boolean },\n): RouterLocale[] {\n\tconst vekterLocaleById: Map<LocaleId, VekterLocale> = new Map()\n\tconst fallbackByLocaleId: Map<LocaleId, LocaleId> = new Map()\n\n\tfor (const locale of locales) {\n\t\tvekterLocaleById.set(locale.id, locale)\n\t\tif (!locale.fallback) continue\n\t\tfallbackByLocaleId.set(locale.id, locale.fallback)\n\t}\n\n\tconst routerLocales: RouterLocale[] = []\n\n\tfor (const locale of locales) {\n\t\tif (!includeDrafts && locale.draft) continue\n\n\t\tconst routerLocale = vekterLocaleToRouterLocale(locale)\n\t\trouterLocales.push(routerLocale)\n\n\t\tif (!locale.fallback) continue\n\n\t\tlet currentRouterLocale = routerLocale\n\t\tlet fallbackLocale: VekterLocale | undefined = vekterLocaleById.get(locale.fallback)\n\n\t\tconst seenLocales = new Set<LocaleId>()\n\t\tseenLocales.add(locale.id)\n\n\t\twhile (fallbackLocale) {\n\t\t\tif (seenLocales.has(fallbackLocale.id)) break\n\t\t\tseenLocales.add(fallbackLocale.id)\n\n\t\t\tconst routerLocaleFallback = vekterLocaleToRouterLocale(fallbackLocale)\n\t\t\tcurrentRouterLocale.fallback = routerLocaleFallback\n\t\t\tcurrentRouterLocale = routerLocaleFallback\n\n\t\t\tconst fallbackId = fallbackByLocaleId.get(fallbackLocale.id)\n\t\t\tfallbackLocale = fallbackId ? vekterLocaleById.get(fallbackId) : undefined\n\t\t}\n\t}\n\n\treturn routerLocales\n}\n\nfunction vekterLocaleToRouterLocale(locale: VekterLocale): Mutable<RouterLocale> {\n\tconst routerLocale: Mutable<RouterLocale> = {\n\t\tid: locale.id,\n\t\tcode: locale.code,\n\t\tslug: locale.slug,\n\t\tname: locale.name,\n\t\ttextDirection: getTextDirection(locale.code),\n\t}\n\n\treturn routerLocale\n}\n\n/**\n * Please use the `getRouterLocales` and `getRouterLocale` functions instead of this when possible.\n * They are memoized and always include the default locale. In some tests and after post message\n * changes you will still need to convert vekter locales to router locales manually. But please use\n * with caution.\n */\nexport const unsafeGetRouterLocaleUtils = { vekterLocalesToRouterLocales }\n", "import { assert } from \"@framerjs/shared\"\nimport { defaultLocaleId } from \"@framerjs/shared/src/ssg/locale.ts\"\nimport { isTrailingSlashSegmentNode } from \"document/components/chrome/Pages/utils/commons.ts\"\nimport { getLocalizedValueForActiveLocale } from \"document/components/chrome/localization/getValueForActiveLocale.ts\"\nimport { customNotFoundPageSegments } from \"library/router/customNotFoundPagePaths.ts\"\nimport type { LocaleId, Locale as RouterLocale } from \"library/router/types.ts\"\nimport { getRouterLocales } from \"utils/getRouterLocales.ts\"\nimport type { CanvasTree } from \"../CanvasTree.ts\"\nimport type { NodeID } from \"./NodeID.ts\"\nimport type { RouteSegmentNode } from \"./RouteSegmentNode.ts\"\nimport type { RouteSegmentRootNode } from \"./RouteSegmentRootNode.ts\"\nimport type { WebPageNode } from \"./WebPageNode.ts\"\n\nconst segmentReferencePathPrefix = \"$\"\n\nexport type ReadonlyWebPageSegmentReferencePathByWebPageId = ReadonlyMap<NodeID, string>\ntype WebPageSegmentReferencePathByWebPageId = Map<NodeID, string>\ntype SegmentId = `${typeof segmentReferencePathPrefix}${number}`\ntype SegmentById = Record<SegmentId, string>\nexport type LocalizedSegments = Record<LocaleId, SegmentById>\n\nexport const ROUTE_SEGMENT_ROOT_NODE_ID = \"routeSegmentRoot\"\nexport function getRouteSegmentRootNode(tree: CanvasTree) {\n\tconst routeSegmentRootNode = tree.get<RouteSegmentRootNode>(ROUTE_SEGMENT_ROOT_NODE_ID)\n\n\tassert(routeSegmentRootNode, \"RouteSegmentRootNode not found\")\n\t// Due to an unknown bug, we're seeing cases where the routeSegmentRootNode is moved out of the tree root into\n\t// other nodes. We recognize only a route segment root that's under the tree root.\n\tassert(\n\t\trouteSegmentRootNode.parentid === tree.root.id,\n\t\t\"RouteSegmentRootNode is not under the tree root. Parent id: \" + routeSegmentRootNode.parentid,\n\t)\n\n\treturn routeSegmentRootNode\n}\n\nexport function generateWebPageIdToSegmentReferencePath(\n\ttree: CanvasTree,\n\tnode: RouteSegmentRootNode,\n): {\n\twebPageSegmentReferencePathByWebPageId: WebPageSegmentReferencePathByWebPageId\n\tlocalizedSegments: LocalizedSegments\n} {\n\tconst routerLocales = getRouterLocales(tree, \"excludeDrafts\")\n\tconst localizedSegments: LocalizedSegments = Object.fromEntries(routerLocales.map(locale => [locale.id, {}]))\n\n\tconst webPageSegmentReferencePathByWebPageId: WebPageSegmentReferencePathByWebPageId = new Map()\n\n\tlet segmentIdCounter = 0\n\tconst getNextSegmentId = (): SegmentId => `${segmentReferencePathPrefix}${segmentIdCounter++}`\n\n\tfor (const routeSegmentNode of node.children) {\n\t\tcollectWebPageIdToSegmentReferencePath(\n\t\t\ttree,\n\t\t\t\"\",\n\t\t\twebPageSegmentReferencePathByWebPageId,\n\t\t\tlocalizedSegments,\n\t\t\tgetNextSegmentId,\n\t\t\trouteSegmentNode,\n\t\t\trouterLocales,\n\t\t)\n\t}\n\n\treturn { webPageSegmentReferencePathByWebPageId, localizedSegments }\n}\n\n// Returns true if there are any non-draft pages in the subtree (current node or descendants)\nfunction collectWebPageIdToSegmentReferencePath(\n\ttree: CanvasTree,\n\tpath: string,\n\twebPageSegmentReferencePathByWebPageId: WebPageSegmentReferencePathByWebPageId,\n\tlocalizedSegments: LocalizedSegments,\n\tgetNextSegmentId: () => SegmentId,\n\trouteSegmentNode: RouteSegmentNode,\n\trouterLocales: readonly RouterLocale[],\n): boolean {\n\tassert(localizedSegments[defaultLocaleId], \"dictionary should include default\")\n\n\tconst isDraft = routeSegmentNode.webPageId ? !!tree.get<WebPageNode>(routeSegmentNode.webPageId)?.isDraft : false\n\tlet segmentId: SegmentId | undefined\n\n\tif (!checkShouldSegmentBeLocalized(routeSegmentNode)) {\n\t\tpath = `${path}/${routeSegmentNode.segment}`\n\t} else if (routeSegmentNode.segment) {\n\t\tsegmentId = getNextSegmentId()\n\t\tpath = `${path}/${segmentId}`\n\t} else {\n\t\tpath = `${path}/`\n\t}\n\n\t// If the current node is a folder then we can treat it the same as a draft. It only gets\n\t// included if it has children (that are not drafts)\n\tlet hasNonDraftInThisSubtree = !isDraft && !!routeSegmentNode.webPageId\n\n\tfor (const childNode of routeSegmentNode.children) {\n\t\tconst hasNonDraftInChildSubtree = collectWebPageIdToSegmentReferencePath(\n\t\t\ttree,\n\t\t\tpath,\n\t\t\twebPageSegmentReferencePathByWebPageId,\n\t\t\tlocalizedSegments,\n\t\t\tgetNextSegmentId,\n\t\t\tchildNode,\n\t\t\trouterLocales,\n\t\t)\n\n\t\thasNonDraftInThisSubtree = hasNonDraftInChildSubtree || hasNonDraftInThisSubtree\n\t}\n\n\tif (hasNonDraftInThisSubtree && segmentId) {\n\t\tlocalizedSegments[defaultLocaleId][segmentId] = routeSegmentNode.segment\n\n\t\t// Build the localized path for this segment for all locales\n\t\tfor (const routerLocale of routerLocales) {\n\t\t\tconst localizedSegment = getLocalizedValueForActiveLocale(routerLocale, routeSegmentNode.segmentLocalized)\n\n\t\t\tif (localizedSegment?.value && localizedSegment.value !== routeSegmentNode.segment) {\n\t\t\t\tconst localeId = routerLocale.id\n\t\t\t\tassert(localizedSegments[localeId], \"localizedSegments should include all locales\")\n\t\t\t\tlocalizedSegments[localeId][segmentId] = localizedSegment.value\n\t\t\t}\n\t\t}\n\t}\n\n\tif (routeSegmentNode.webPageId && !isDraft) {\n\t\twebPageSegmentReferencePathByWebPageId.set(routeSegmentNode.webPageId, path)\n\t}\n\n\treturn hasNonDraftInThisSubtree\n}\n\nexport const checkShouldSegmentBeLocalized = (routeSegmentNode: RouteSegmentNode) => {\n\t// CMS slugs translations are handled separately, don't translate them;\n\tconst isCmsSlug = !!routeSegmentNode.dataIdentifier\n\tif (isCmsSlug) return false\n\n\t// 404 page should not be translated, server does matching by path to serve it\n\tconst is404Page = customNotFoundPageSegments.has(routeSegmentNode.segment)\n\tif (is404Page) return false\n\n\tif (isTrailingSlashSegmentNode(routeSegmentNode)) return false\n\n\treturn true\n}\n", "import type { CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { RouteSegmentNode } from \"document/models/CanvasTree/nodes/RouteSegmentNode.ts\"\nimport { getRouteSegmentRootNode } from \"document/models/CanvasTree/nodes/RouteSegmentRootNode.utils.ts\"\n\n/**\n * Returns the route segment node for the given webPageId. It is cached, so it is safe to call this function multiple times.\n */\nexport function getRouteSegmentNodeByWebPageId(tree: CanvasTree, webPageId: NodeID) {\n\tconst routeSegmentRootNode = getRouteSegmentRootNode(tree)\n\tconst routeSegmentId = routeSegmentRootNode.getRouteSegmentIdForWebPageId(webPageId)\n\treturn tree.getNode<RouteSegmentNode>(routeSegmentId)\n}\n", "import {\n\tModuleType,\n\ttype ModuleExportIdentifierString,\n\tisLocalModuleIdentifier,\n\tisModuleExportIdentifier,\n\tparseModuleIdentifier,\n} from \"@framerjs/shared\"\nimport type { CanvasTree, CollectionNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isCollectionNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\n\nexport function getCollectionForIdentifier(\n\ttree: CanvasTree,\n\tidentifier: ModuleExportIdentifierString | null | undefined,\n): CollectionNode | null {\n\tconst collectionNodeId = getCollectionIdForIdentifier(identifier)\n\tif (!collectionNodeId) return null\n\n\treturn tree.getNodeWithTrait(collectionNodeId, isCollectionNode)\n}\n\nexport function getCollectionIdForIdentifier(\n\tidentifier: ModuleExportIdentifierString | null | undefined,\n): NodeID | null {\n\tif (!identifier) return null\n\n\tconst parsed = parseModuleIdentifier(identifier)\n\tif (!isLocalModuleIdentifier(parsed) || !isModuleExportIdentifier(parsed)) return null\n\tif (parsed.type !== ModuleType.Collection) return null\n\n\treturn parsed.localIdName\n}\n", "import { assertNever } from \"@framerjs/shared\"\nimport type { Point } from \"library/render/types/Point.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\n\nexport type FloatingPlacement = \"top\" | \"right\" | \"bottom\" | \"left\"\nexport type FloatingAlignment = \"start\" | \"center\" | \"end\"\n\nexport const DEFAULT_FLOATING_COLLISION_PADDING = 20\nexport const DEFAULT_FLOATING_OFFSET_X = 0\nexport const DEFAULT_FLOATING_OFFSET_Y = 10\n\nexport interface WithFloatingPosition {\n\tfloatingPositionEnabled: boolean | undefined\n\n\tfloatingPlacement: FloatingPlacement | undefined\n\tfloatingAlignment: FloatingAlignment | undefined\n\n\tfloatingOffsetX: number | undefined\n\tfloatingOffsetY: number | undefined\n\n\tfloatingSafeArea: boolean | undefined\n\n\tfloatingCollisionDetection: boolean | undefined\n\tfloatingCollisionPadding: number | undefined\n}\n\nconst key: keyof WithFloatingPosition = \"floatingPositionEnabled\"\n\nexport const floatingPositionDefaults: WithFloatingPosition = {\n\tfloatingPositionEnabled: undefined,\n\tfloatingPlacement: undefined,\n\tfloatingAlignment: undefined,\n\tfloatingOffsetX: undefined,\n\tfloatingOffsetY: undefined,\n\tfloatingSafeArea: undefined,\n\tfloatingCollisionDetection: undefined,\n\tfloatingCollisionPadding: undefined,\n}\n\nexport function withFloatingPosition<N extends CanvasNode>(\n\tnode: N | null | undefined,\n): node is N & WithFloatingPosition {\n\tif (!node) return false\n\treturn key in node\n}\n\nexport function hasFloatingPosition<N extends CanvasNode>(\n\tnode: N | null | undefined,\n): node is N & WithFloatingPosition & { floatingPositionEnabled: true } {\n\tif (!node || !withFloatingPosition(node)) return false\n\n\treturn node.floatingPositionEnabled === true\n}\n\nexport const DEFAULT_FLOATING_PLACEMENT = \"bottom\"\nexport const DEFAULT_FLOATING_ALIGNMENT = \"center\"\n\nexport function getFloatingPositionProps(node: CanvasNode & WithFloatingPosition): WithFloatingPosition {\n\treturn {\n\t\tfloatingPositionEnabled: node.floatingPositionEnabled,\n\t\tfloatingPlacement: node.floatingPlacement,\n\t\tfloatingAlignment: node.floatingAlignment,\n\t\tfloatingOffsetX: node.floatingOffsetX,\n\t\tfloatingOffsetY: node.floatingOffsetY,\n\t\tfloatingSafeArea: node.floatingSafeArea,\n\t\tfloatingCollisionDetection: node.floatingCollisionDetection,\n\t\tfloatingCollisionPadding: node.floatingCollisionPadding,\n\t}\n}\n\n/**\n * Calculate the absolute x (left) position relative to the parent given the widths and floating settings.\n */\nexport function getRebasedInsetX(\n\twidth: number,\n\tparentWidth: number,\n\tdirection: \"top\" | \"right\" | \"bottom\" | \"left\" = DEFAULT_FLOATING_PLACEMENT,\n\talignment: \"start\" | \"center\" | \"end\" = DEFAULT_FLOATING_ALIGNMENT,\n\toffset: number = 0,\n) {\n\tswitch (direction) {\n\t\tcase \"bottom\":\n\t\tcase \"top\":\n\t\t\tswitch (alignment) {\n\t\t\t\tcase \"start\":\n\t\t\t\t\treturn offset\n\t\t\t\tcase \"center\":\n\t\t\t\t\treturn parentWidth / 2 - width / 2 + offset\n\t\t\t\tcase \"end\":\n\t\t\t\t\treturn parentWidth - width + offset\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(alignment)\n\t\t\t}\n\t\t\tbreak\n\t\tcase \"left\":\n\t\t\treturn -width + offset\n\t\tcase \"right\":\n\t\t\treturn parentWidth + offset\n\t\tdefault:\n\t\t\tassertNever(direction)\n\t}\n}\n\n/**\n * Calculate the absolute y (top) position relative to the parent given the widths and floating settings.\n */\nexport function getRebasedInsetY(\n\theight: number,\n\tparentHeight: number,\n\tdirection: \"top\" | \"right\" | \"bottom\" | \"left\" = DEFAULT_FLOATING_PLACEMENT,\n\talignment: \"start\" | \"center\" | \"end\" = DEFAULT_FLOATING_ALIGNMENT,\n\toffset: number = 0,\n) {\n\tswitch (direction) {\n\t\tcase \"left\":\n\t\tcase \"right\":\n\t\t\tswitch (alignment) {\n\t\t\t\tcase \"start\":\n\t\t\t\t\treturn offset\n\t\t\t\tcase \"center\":\n\t\t\t\t\treturn parentHeight / 2 - height / 2 + offset\n\t\t\t\tcase \"end\":\n\t\t\t\t\treturn parentHeight - height + offset\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(alignment)\n\t\t\t}\n\t\t\tbreak\n\t\tcase \"top\":\n\t\t\treturn -height + offset\n\t\tcase \"bottom\":\n\t\t\treturn parentHeight + offset\n\t\tdefault:\n\t\t\tassertNever(direction)\n\t}\n}\n\nexport function getRelativeOffsetX(\n\tleft: number,\n\twidth: number,\n\tparentWidth: number,\n\tdirection: \"top\" | \"right\" | \"bottom\" | \"left\" = DEFAULT_FLOATING_PLACEMENT,\n\talignment: \"start\" | \"center\" | \"end\" = DEFAULT_FLOATING_ALIGNMENT,\n) {\n\tswitch (direction) {\n\t\tcase \"bottom\":\n\t\tcase \"top\":\n\t\t\tswitch (alignment) {\n\t\t\t\tcase \"start\":\n\t\t\t\t\treturn left\n\t\t\t\tcase \"center\":\n\t\t\t\t\treturn left - parentWidth / 2 + width / 2\n\t\t\t\tcase \"end\":\n\t\t\t\t\treturn left - parentWidth + width\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(alignment)\n\t\t\t}\n\t\t\tbreak\n\t\tcase \"left\":\n\t\t\treturn left + width\n\t\tcase \"right\":\n\t\t\treturn left - parentWidth\n\t\tdefault:\n\t\t\tassertNever(direction)\n\t}\n}\n\nexport function getRelativeOffsetY(\n\ttop: number,\n\theight: number,\n\tparentHeight: number,\n\tdirection: \"top\" | \"right\" | \"bottom\" | \"left\" = DEFAULT_FLOATING_PLACEMENT,\n\talignment: \"start\" | \"center\" | \"end\" = DEFAULT_FLOATING_ALIGNMENT,\n) {\n\tswitch (direction) {\n\t\tcase \"left\":\n\t\tcase \"right\":\n\t\t\tswitch (alignment) {\n\t\t\t\tcase \"start\":\n\t\t\t\t\treturn top\n\t\t\t\tcase \"center\":\n\t\t\t\t\treturn top - parentHeight / 2 + height / 2\n\t\t\t\tcase \"end\":\n\t\t\t\t\treturn top - parentHeight + height\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(alignment)\n\t\t\t}\n\t\t\tbreak\n\t\tcase \"top\":\n\t\t\treturn top + height\n\t\tcase \"bottom\":\n\t\t\treturn top - parentHeight\n\t\tdefault:\n\t\t\tassertNever(direction)\n\t}\n}\n\nfunction isVerticalPosition(placement: FloatingPlacement | undefined = DEFAULT_FLOATING_PLACEMENT): boolean {\n\treturn placement === \"bottom\" || placement === \"top\"\n}\n\nexport function isHorizontalPosition(placement: FloatingPlacement | undefined = DEFAULT_FLOATING_PLACEMENT): boolean {\n\treturn placement === \"right\" || placement === \"left\"\n}\n\nfunction invert(value: number | undefined): number {\n\tif (isUndefined(value)) return 0\n\treturn value * -1\n}\n\ntype PartialPoint = { [K in keyof Point]: Point[K] | undefined }\n\nexport function maintainRelativeOffset(\n\tcurrentPlacement: FloatingPlacement = DEFAULT_FLOATING_PLACEMENT,\n\tnextPlacement: FloatingPlacement,\n\t{ x, y }: Partial<Point>,\n): PartialPoint {\n\t// If we are flipping vertical position, invert the y offset to maintain an\n\t// absolute offset.\n\tif (isVerticalPosition(currentPlacement) && isVerticalPosition(nextPlacement)) {\n\t\treturn {\n\t\t\ty: invert(y),\n\t\t\tx,\n\t\t}\n\t}\n\n\t// If we are flipping horizontal position, invert the x offset to maintain\n\t// an absolute offset.\n\tif (isHorizontalPosition(currentPlacement) && isHorizontalPosition(nextPlacement)) {\n\t\treturn {\n\t\t\tx: invert(x),\n\t\t\ty,\n\t\t}\n\t}\n\n\t// If we are moving from vertical to horizontal, swap the offsets to\n\t// maintain the absolute offset.\n\tconst update: PartialPoint = {\n\t\tx: y,\n\t\ty: x,\n\t}\n\n\tif (\n\t\t(currentPlacement === \"left\" && nextPlacement === \"bottom\") ||\n\t\t(currentPlacement === \"right\" && nextPlacement === \"top\")\n\t) {\n\t\tupdate.y = invert(update.y)\n\t}\n\n\tif (\n\t\t(currentPlacement === \"bottom\" && nextPlacement === \"left\") ||\n\t\t(currentPlacement === \"top\" && nextPlacement === \"right\")\n\t) {\n\t\tupdate.x = invert(update.x)\n\t}\n\n\treturn update\n}\n", "import type { CanvasTree } from \"../CanvasTree.ts\"\nimport type { AnyContentManagementNode } from \"./ContentManagementNode.ts\"\n\nexport const CONTENT_MANAGEMENT_ID = \"contentManagement\"\nexport function getContentManagementNode(tree: CanvasTree) {\n\treturn tree.get<AnyContentManagementNode>(CONTENT_MANAGEMENT_ID)\n}\n", "/**\n * Copyright 2019 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *     http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n  Endpoint,\n  EventSource,\n  Message,\n  MessageType,\n  PostMessageWithOrigin,\n  WireValue,\n  WireValueType,\n} from \"./protocol\";\nexport { Endpoint };\n\nexport const proxyMarker = Symbol(\"Comlink.proxy\");\nexport const createEndpoint = Symbol(\"Comlink.endpoint\");\nexport const releaseProxy = Symbol(\"Comlink.releaseProxy\");\n\nconst throwMarker = Symbol(\"Comlink.thrown\");\n\n/**\n * Interface of values that were marked to be proxied with `comlink.proxy()`.\n * Can also be implemented by classes.\n */\nexport interface ProxyMarked {\n  [proxyMarker]: true;\n}\n\n/**\n * Takes a type and wraps it in a Promise, if it not already is one.\n * This is to avoid `Promise<Promise<T>>`.\n *\n * This is the inverse of `Unpromisify<T>`.\n */\ntype Promisify<T> = T extends Promise<unknown> ? T : Promise<T>;\n/**\n * Takes a type that may be Promise and unwraps the Promise type.\n * If `P` is not a Promise, it returns `P`.\n *\n * This is the inverse of `Promisify<T>`.\n */\ntype Unpromisify<P> = P extends Promise<infer T> ? T : P;\n\n/**\n * Takes the raw type of a remote property and returns the type that is visible to the local thread on the proxy.\n *\n * Note: This needs to be its own type alias, otherwise it will not distribute over unions.\n * See https://www.typescriptlang.org/docs/handbook/advanced-types.html#distributive-conditional-types\n */\ntype RemoteProperty<T> =\n  // If the value is a method, comlink will proxy it automatically.\n  // Objects are only proxied if they are marked to be proxied.\n  // Otherwise, the property is converted to a Promise that resolves the cloned value.\n  T extends Function | ProxyMarked ? Remote<T> : Promisify<T>;\n\n/**\n * Takes the raw type of a property as a remote thread would see it through a proxy (e.g. when passed in as a function\n * argument) and returns the type that the local thread has to supply.\n *\n * This is the inverse of `RemoteProperty<T>`.\n *\n * Note: This needs to be its own type alias, otherwise it will not distribute over unions. See\n * https://www.typescriptlang.org/docs/handbook/advanced-types.html#distributive-conditional-types\n */\ntype LocalProperty<T> = T extends Function | ProxyMarked\n  ? Local<T>\n  : Unpromisify<T>;\n\n/**\n * Proxies `T` if it is a `ProxyMarked`, clones it otherwise (as handled by structured cloning and transfer handlers).\n */\nexport type ProxyOrClone<T> = T extends ProxyMarked ? Remote<T> : T;\n/**\n * Inverse of `ProxyOrClone<T>`.\n */\nexport type UnproxyOrClone<T> = T extends RemoteObject<ProxyMarked>\n  ? Local<T>\n  : T;\n\n/**\n * Takes the raw type of a remote object in the other thread and returns the type as it is visible to the local thread\n * when proxied with `Comlink.proxy()`.\n *\n * This does not handle call signatures, which is handled by the more general `Remote<T>` type.\n *\n * @template T The raw type of a remote object as seen in the other thread.\n */\nexport type RemoteObject<T> = { [P in keyof T]: RemoteProperty<T[P]> };\n/**\n * Takes the type of an object as a remote thread would see it through a proxy (e.g. when passed in as a function\n * argument) and returns the type that the local thread has to supply.\n *\n * This does not handle call signatures, which is handled by the more general `Local<T>` type.\n *\n * This is the inverse of `RemoteObject<T>`.\n *\n * @template T The type of a proxied object.\n */\nexport type LocalObject<T> = { [P in keyof T]: LocalProperty<T[P]> };\n\n/**\n * Additional special comlink methods available on each proxy returned by `Comlink.wrap()`.\n */\nexport interface ProxyMethods {\n  [createEndpoint]: () => Promise<MessagePort>;\n  [releaseProxy]: () => void;\n}\n\n/**\n * Takes the raw type of a remote object, function or class in the other thread and returns the type as it is visible to\n * the local thread from the proxy return value of `Comlink.wrap()` or `Comlink.proxy()`.\n */\nexport type Remote<T> =\n  // Handle properties\n  RemoteObject<T> &\n    // Handle call signature (if present)\n    (T extends (...args: infer TArguments) => infer TReturn\n      ? (\n          ...args: { [I in keyof TArguments]: UnproxyOrClone<TArguments[I]> }\n        ) => Promisify<ProxyOrClone<Unpromisify<TReturn>>>\n      : unknown) &\n    // Handle construct signature (if present)\n    // The return of construct signatures is always proxied (whether marked or not)\n    (T extends { new (...args: infer TArguments): infer TInstance }\n      ? {\n          new (\n            ...args: {\n              [I in keyof TArguments]: UnproxyOrClone<TArguments[I]>;\n            }\n          ): Promisify<Remote<TInstance>>;\n        }\n      : unknown) &\n    // Include additional special comlink methods available on the proxy.\n    ProxyMethods;\n\n/**\n * Expresses that a type can be either a sync or async.\n */\ntype MaybePromise<T> = Promise<T> | T;\n\n/**\n * Takes the raw type of a remote object, function or class as a remote thread would see it through a proxy (e.g. when\n * passed in as a function argument) and returns the type the local thread has to supply.\n *\n * This is the inverse of `Remote<T>`. It takes a `Remote<T>` and returns its original input `T`.\n */\nexport type Local<T> =\n  // Omit the special proxy methods (they don't need to be supplied, comlink adds them)\n  Omit<LocalObject<T>, keyof ProxyMethods> &\n    // Handle call signatures (if present)\n    (T extends (...args: infer TArguments) => infer TReturn\n      ? (\n          ...args: { [I in keyof TArguments]: ProxyOrClone<TArguments[I]> }\n        ) => // The raw function could either be sync or async, but is always proxied automatically\n        MaybePromise<UnproxyOrClone<Unpromisify<TReturn>>>\n      : unknown) &\n    // Handle construct signature (if present)\n    // The return of construct signatures is always proxied (whether marked or not)\n    (T extends { new (...args: infer TArguments): infer TInstance }\n      ? {\n          new (\n            ...args: {\n              [I in keyof TArguments]: ProxyOrClone<TArguments[I]>;\n            }\n          ): // The raw constructor could either be sync or async, but is always proxied automatically\n          MaybePromise<Local<Unpromisify<TInstance>>>;\n        }\n      : unknown);\n\nconst isObject = (val: unknown): val is object =>\n  (typeof val === \"object\" && val !== null) || typeof val === \"function\";\n\n/**\n * Customizes the serialization of certain values as determined by `canHandle()`.\n *\n * @template T The input type being handled by this transfer handler.\n * @template S The serialized type sent over the wire.\n */\nexport interface TransferHandler<T, S> {\n  /**\n   * Gets called for every value to determine whether this transfer handler\n   * should serialize the value, which includes checking that it is of the right\n   * type (but can perform checks beyond that as well).\n   */\n  canHandle(value: unknown): value is T;\n\n  /**\n   * Gets called with the value if `canHandle()` returned `true` to produce a\n   * value that can be sent in a message, consisting of structured-cloneable\n   * values and/or transferrable objects.\n   */\n  serialize(value: T): [S, Transferable[]];\n\n  /**\n   * Gets called to deserialize an incoming value that was serialized in the\n   * other thread with this transfer handler (known through the name it was\n   * registered under).\n   */\n  deserialize(value: S): T;\n}\n\n/**\n * Internal transfer handle to handle objects marked to proxy.\n */\nconst proxyTransferHandler: TransferHandler<object, MessagePort> = {\n  canHandle: (val): val is ProxyMarked =>\n    isObject(val) && (val as ProxyMarked)[proxyMarker],\n  serialize(obj) {\n    const { port1, port2 } = new MessageChannel();\n    expose(obj, port1);\n    return [port2, [port2]];\n  },\n  deserialize(port) {\n    port.start();\n    return wrap(port);\n  },\n};\n\ninterface ThrownValue {\n  [throwMarker]: unknown; // just needs to be present\n  value: unknown;\n}\ntype SerializedThrownValue =\n  | { isError: true; value: Error }\n  | { isError: false; value: unknown };\n\n/**\n * Internal transfer handler to handle thrown exceptions.\n */\nconst throwTransferHandler: TransferHandler<\n  ThrownValue,\n  SerializedThrownValue\n> = {\n  canHandle: (value): value is ThrownValue =>\n    isObject(value) && throwMarker in value,\n  serialize({ value }) {\n    let serialized: SerializedThrownValue;\n    if (value instanceof Error) {\n      serialized = {\n        isError: true,\n        value: {\n          message: value.message,\n          name: value.name,\n          stack: value.stack,\n        },\n      };\n    } else {\n      serialized = { isError: false, value };\n    }\n    return [serialized, []];\n  },\n  deserialize(serialized) {\n    if (serialized.isError) {\n      throw Object.assign(\n        new Error(serialized.value.message),\n        serialized.value\n      );\n    }\n    throw serialized.value;\n  },\n};\n\n/**\n * Allows customizing the serialization of certain values.\n */\nexport const transferHandlers = new Map<\n  string,\n  TransferHandler<unknown, unknown>\n>([\n  [\"proxy\", proxyTransferHandler],\n  [\"throw\", throwTransferHandler],\n]);\n\nexport function expose(obj: any, ep: Endpoint = self as any) {\n  ep.addEventListener(\"message\", function callback(ev: MessageEvent) {\n    if (!ev || !ev.data) {\n      return;\n    }\n    const { id, type, path } = {\n      path: [] as string[],\n      ...(ev.data as Message),\n    };\n    const argumentList = (ev.data.argumentList || []).map(fromWireValue);\n    let returnValue;\n    try {\n      const parent = path.slice(0, -1).reduce((obj, prop) => obj[prop], obj);\n      const rawValue = path.reduce((obj, prop) => obj[prop], obj);\n      switch (type) {\n        case MessageType.GET:\n          {\n            returnValue = rawValue;\n          }\n          break;\n        case MessageType.SET:\n          {\n            parent[path.slice(-1)[0]] = fromWireValue(ev.data.value);\n            returnValue = true;\n          }\n          break;\n        case MessageType.APPLY:\n          {\n            returnValue = rawValue.apply(parent, argumentList);\n          }\n          break;\n        case MessageType.CONSTRUCT:\n          {\n            const value = new rawValue(...argumentList);\n            returnValue = proxy(value);\n          }\n          break;\n        case MessageType.ENDPOINT:\n          {\n            const { port1, port2 } = new MessageChannel();\n            expose(obj, port2);\n            returnValue = transfer(port1, [port1]);\n          }\n          break;\n        case MessageType.RELEASE:\n          {\n            returnValue = undefined;\n          }\n          break;\n      }\n    } catch (value) {\n      returnValue = { value, [throwMarker]: 0 };\n    }\n    Promise.resolve(returnValue)\n      .catch((value) => {\n        return { value, [throwMarker]: 0 };\n      })\n      .then((returnValue) => {\n        const [wireValue, transferables] = toWireValue(returnValue);\n        ep.postMessage({ ...wireValue, id }, transferables);\n        if (type === MessageType.RELEASE) {\n          // detach and deactive after sending release response above.\n          ep.removeEventListener(\"message\", callback as any);\n          closeEndPoint(ep);\n        }\n      });\n  } as any);\n  if (ep.start) {\n    ep.start();\n  }\n}\n\nfunction isMessagePort(endpoint: Endpoint): endpoint is MessagePort {\n  return endpoint.constructor.name === \"MessagePort\";\n}\n\nfunction closeEndPoint(endpoint: Endpoint) {\n  if (isMessagePort(endpoint)) endpoint.close();\n}\n\nexport function wrap<T>(ep: Endpoint, target?: any): Remote<T> {\n  return createProxy<T>(ep, [], target) as any;\n}\n\nfunction throwIfProxyReleased(isReleased: boolean) {\n  if (isReleased) {\n    throw new Error(\"Proxy has been released and is not useable\");\n  }\n}\n\nfunction createProxy<T>(\n  ep: Endpoint,\n  path: (string | number | symbol)[] = [],\n  target: object = function () {}\n): Remote<T> {\n  let isProxyReleased = false;\n  const proxy = new Proxy(target, {\n    get(_target, prop) {\n      throwIfProxyReleased(isProxyReleased);\n      if (prop === releaseProxy) {\n        return () => {\n          return requestResponseMessage(ep, {\n            type: MessageType.RELEASE,\n            path: path.map((p) => p.toString()),\n          }).then(() => {\n            closeEndPoint(ep);\n            isProxyReleased = true;\n          });\n        };\n      }\n      if (prop === \"then\") {\n        if (path.length === 0) {\n          return { then: () => proxy };\n        }\n        const r = requestResponseMessage(ep, {\n          type: MessageType.GET,\n          path: path.map((p) => p.toString()),\n        }).then(fromWireValue);\n        return r.then.bind(r);\n      }\n      return createProxy(ep, [...path, prop]);\n    },\n    set(_target, prop, rawValue) {\n      throwIfProxyReleased(isProxyReleased);\n      // FIXME: ES6 Proxy Handler `set` methods are supposed to return a\n      // boolean. To show good will, we return true asynchronously ¯\\_(ツ)_/¯\n      const [value, transferables] = toWireValue(rawValue);\n      return requestResponseMessage(\n        ep,\n        {\n          type: MessageType.SET,\n          path: [...path, prop].map((p) => p.toString()),\n          value,\n        },\n        transferables\n      ).then(fromWireValue) as any;\n    },\n    apply(_target, _thisArg, rawArgumentList) {\n      throwIfProxyReleased(isProxyReleased);\n      const last = path[path.length - 1];\n      if ((last as any) === createEndpoint) {\n        return requestResponseMessage(ep, {\n          type: MessageType.ENDPOINT,\n        }).then(fromWireValue);\n      }\n      // We just pretend that `bind()` didn’t happen.\n      if (last === \"bind\") {\n        return createProxy(ep, path.slice(0, -1));\n      }\n      const [argumentList, transferables] = processArguments(rawArgumentList);\n      return requestResponseMessage(\n        ep,\n        {\n          type: MessageType.APPLY,\n          path: path.map((p) => p.toString()),\n          argumentList,\n        },\n        transferables\n      ).then(fromWireValue);\n    },\n    construct(_target, rawArgumentList) {\n      throwIfProxyReleased(isProxyReleased);\n      const [argumentList, transferables] = processArguments(rawArgumentList);\n      return requestResponseMessage(\n        ep,\n        {\n          type: MessageType.CONSTRUCT,\n          path: path.map((p) => p.toString()),\n          argumentList,\n        },\n        transferables\n      ).then(fromWireValue);\n    },\n  });\n  return proxy as any;\n}\n\nfunction myFlat<T>(arr: (T | T[])[]): T[] {\n  return Array.prototype.concat.apply([], arr);\n}\n\nfunction processArguments(argumentList: any[]): [WireValue[], Transferable[]] {\n  const processed = argumentList.map(toWireValue);\n  return [processed.map((v) => v[0]), myFlat(processed.map((v) => v[1]))];\n}\n\nconst transferCache = new WeakMap<any, Transferable[]>();\nexport function transfer(obj: any, transfers: Transferable[]) {\n  transferCache.set(obj, transfers);\n  return obj;\n}\n\nexport function proxy<T>(obj: T): T & ProxyMarked {\n  return Object.assign(obj, { [proxyMarker]: true }) as any;\n}\n\nexport function windowEndpoint(\n  w: PostMessageWithOrigin,\n  context: EventSource = self,\n  targetOrigin = \"*\"\n): Endpoint {\n  return {\n    postMessage: (msg: any, transferables: Transferable[]) =>\n      w.postMessage(msg, targetOrigin, transferables),\n    addEventListener: context.addEventListener.bind(context),\n    removeEventListener: context.removeEventListener.bind(context),\n  };\n}\n\nfunction toWireValue(value: any): [WireValue, Transferable[]] {\n  for (const [name, handler] of transferHandlers) {\n    if (handler.canHandle(value)) {\n      const [serializedValue, transferables] = handler.serialize(value);\n      return [\n        {\n          type: WireValueType.HANDLER,\n          name,\n          value: serializedValue,\n        },\n        transferables,\n      ];\n    }\n  }\n  return [\n    {\n      type: WireValueType.RAW,\n      value,\n    },\n    transferCache.get(value) || [],\n  ];\n}\n\nfunction fromWireValue(value: WireValue): any {\n  switch (value.type) {\n    case WireValueType.HANDLER:\n      return transferHandlers.get(value.name)!.deserialize(value.value);\n    case WireValueType.RAW:\n      return value.value;\n  }\n}\n\nfunction requestResponseMessage(\n  ep: Endpoint,\n  msg: Message,\n  transfers?: Transferable[]\n): Promise<WireValue> {\n  return new Promise((resolve) => {\n    const id = generateUUID();\n    ep.addEventListener(\"message\", function l(ev: MessageEvent) {\n      if (!ev.data || !ev.data.id || ev.data.id !== id) {\n        return;\n      }\n      ep.removeEventListener(\"message\", l as any);\n      resolve(ev.data);\n    } as any);\n    if (ep.start) {\n      ep.start();\n    }\n    ep.postMessage({ id, ...msg }, transfers);\n  });\n}\n\nfunction generateUUID(): string {\n  return new Array(4)\n    .fill(0)\n    .map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16))\n    .join(\"-\");\n}\n", "import { triggerEvent } from \"../listeners\";\nfunction createUiLongFrameEvent(payload) {\n  console.warn(\"[DEPRECATED] Use triggerUiLongFrameEvent instead of createUiLongFrameEvent.\");\n  return {\n    ...payload,\n    event: \"ui_long_frame\"\n  };\n}\nconst meta = {\n  track: true\n};\nfunction triggerUiLongFrameEvent(payload) {\n  const event = {\n    ...payload,\n    event: \"ui_long_frame\"\n  };\n  triggerEvent(event, meta);\n}\nexport {\n  createUiLongFrameEvent,\n  triggerUiLongFrameEvent\n};\n", "import { triggerEvent } from \"../listeners\";\nfunction createVekterStatisticsEvent(payload) {\n  console.warn(\"[DEPRECATED] Use triggerVekterStatisticsEvent instead of createVekterStatisticsEvent.\");\n  return {\n    ...payload,\n    event: \"vekter_statistics\"\n  };\n}\nconst meta = {\n  track: true\n};\nfunction triggerVekterStatisticsEvent(payload) {\n  const event = {\n    ...payload,\n    event: \"vekter_statistics\"\n  };\n  triggerEvent(event, meta);\n}\nexport {\n  createVekterStatisticsEvent,\n  triggerVekterStatisticsEvent\n};\n", "import type { UiLongFrameRenderingPhase } from \"@framerjs/framer-events\"\nimport { triggerUiLongFrameEvent, triggerVekterStatisticsEvent } from \"@framerjs/framer-events\"\nimport { assert, assertNever, getLogger } from \"@framerjs/shared\"\nimport { EngineStore } from \"document/EngineStore.ts\"\nimport type { Changeset } from \"document/models/CanvasTree/Changeset.ts\"\nimport type { DebugRenderingFeatures } from \"renderer/DebugRenderingFeatures.ts\"\nimport type { RenderingPhase } from \"renderer/DeferredRendering.ts\"\n\nconst log = getLogger(\"app\")\n\nconst MINUTE = 60 * 1000 // a minute in milliseconds\n\nexport interface FrameStats {\n\treadonly timestamp: number\n\treadonly isInitialLoad: boolean\n\n\treadonly update: number\n\treadonly updateStartTime: number\n\treadonly toolName: string\n\n\treadonly didScopeChange: boolean\n\treadonly didLoadScript: boolean\n\treadonly didZoom: boolean\n\treadonly documentWasHidden: boolean\n\treadonly documentWasFocused: boolean\n\treadonly userIdle: boolean\n\treadonly mouseDown: boolean\n\treadonly selectionCount: number\n\treadonly treeSize: number\n\treadonly zoom: number\n\n\treadonly totalTime: number\n\treadonly eventProcessing: number\n\treadonly toolUpdate: number\n\treadonly postProcessing: number\n\treadonly reactUpdate: number\n\treadonly browserPaint: number\n\treadonly sandboxUpdating: number\n\treadonly sandboxRendering: number\n\treadonly remoteDocument: number\n\t/** @deprecated do not use droppedFrame */\n\treadonly droppedFrame?: boolean\n\treadonly forcedRendering: boolean\n\treadonly atomicFrame: boolean\n\treadonly renderingPhase: RenderingPhase\n\n\treadonly mainMemory: number\n\treadonly sandboxMemory: number\n\n\treadonly concurrentEditors: number\n\treadonly bytesSent: number\n\treadonly bytesReceived: number\n\treadonly rtt: number\n\treadonly socketId: number\n\n\treadonly logs: string[]\n\n\tlongFrame: boolean\n\t// biome-ignore lint/suspicious/noExplicitAny: @TODO add explanation\n\tperf?: any\n}\n\ninterface MemoryStats {\n\tmemoryTotal: number\n\tmemoryUsed: number\n\tmemoryLimit: number\n}\n\nconst FRAMES_BUFFER_SIZE = 1000\nconst FRAMES_FOR_REPORT = 100\n\nexport enum ReactBuild {\n\tInstrumented = \"instrumented\",\n\tDevelopment = \"development\",\n\tProductionWithProfiling = \"production-with-profiling\",\n\tProduction = \"production\",\n}\n\ninterface DebuggingOfPublishedSites {\n\tforceRendererLambda: boolean\n\tminification: boolean\n\tbundling: boolean\n\tdisableCustomCode: boolean\n\treactBuild: ReactBuild\n\treactVersionOverride: string | undefined\n\tschedulerVersionOverride: string | undefined\n\tstepByStepInit: boolean\n}\n\nexport class DebugStore extends EngineStore {\n\t// Written by engine on doStartFrame\n\tupdate = -1\n\n\t#frames: FrameStats[] = []\n\t#lastUpdate = -1\n\t#longFrameCount = 0\n\n\t#sandboxDomNodes?: number\n\t#sandboxMemoryTotal?: number\n\t#sandboxMemoryUsed?: number\n\t#sandboxMemoryLimit?: number\n\n\t// Vekter Rendering\n\thideArrows = false\n\thideTitles = false\n\n\t// Sandbox Rendering\n\trenderingFeatures: Partial<DebugRenderingFeatures> = {}\n\n\tchangesets: { handle: Changeset; nodeId: string }[] = []\n\n\tdebuggingOfPublishedSites: DebuggingOfPublishedSites = {\n\t\tforceRendererLambda: false,\n\t\tminification: true,\n\t\tbundling: true,\n\t\tdisableCustomCode: false,\n\t\treactBuild: ReactBuild.Production,\n\t\treactVersionOverride: undefined,\n\t\tschedulerVersionOverride: undefined,\n\t\tstepByStepInit: false,\n\t}\n\n\t// Necessary as framer-events only accept lowercase enum properties\n\t// which collide with the interface CanvasSandboxService.RenderingPhase\n\t#getUiLongFrameRenderingPhase(renderingPhase: RenderingPhase): UiLongFrameRenderingPhase {\n\t\tswitch (renderingPhase) {\n\t\t\tcase \"Normal\":\n\t\t\t\treturn \"normal\"\n\t\t\tcase \"Deferred\":\n\t\t\t\treturn \"deferred\"\n\t\t\tcase \"Unknown\":\n\t\t\t\treturn \"unknown\"\n\t\t\tdefault:\n\t\t\t\tassertNever(renderingPhase)\n\t\t}\n\t}\n\n\tget frames() {\n\t\treturn this.#frames\n\t}\n\n\tget lastUpdate() {\n\t\treturn this.#lastUpdate\n\t}\n\n\tget longFrameCount() {\n\t\treturn this.#longFrameCount\n\t}\n\n\treset() {\n\t\tthis.hideArrows = false\n\t\tthis.hideTitles = false\n\t}\n\n\tgetLastReport(): FrameStats {\n\t\tconst last = this.#frames[this.#frames.length - 1]\n\t\tassert(last, \"Last report must be defined\")\n\t\treturn last\n\t}\n\n\taddFrameReport(frame: FrameStats) {\n\t\t// because of flux stores and how we load, its not always a clean event -> process -> render\n\t\t// TODO: Remove this\n\t\tif (frame.update === this.#lastUpdate) {\n\t\t\tthis.#frames[this.#frames.length - 1] = frame\n\t\t\tlog.warnOncePerMinute(\"double frame: \" + frame.update + \" - \" + frame.totalTime + \"ms\", frame)\n\t\t\treturn\n\t\t}\n\n\t\tthis.#lastUpdate = frame.update\n\t\tthis.#frames.push(frame)\n\t\twhile (this.#frames.length > FRAMES_BUFFER_SIZE) {\n\t\t\tthis.#frames.shift()\n\t\t}\n\n\t\tif (process.env.NODE_ENV === \"test\") return\n\t\tthis.reportStatistics()\n\n\t\tif (!frame.documentWasHidden && frame.totalTime > 350) {\n\t\t\tframe.longFrame = true\n\t\t\tlog.info(\"long frame: \" + frame.update + \" - \" + frame.totalTime + \"ms \" + frame.toolName, frame)\n\t\t\tthis.#longFrameCount++\n\t\t\t// Only log the first 100 long frames for this session to\n\t\t\t// avoid saturating the backend if we end up in a bad state.\n\t\t\t// TODO: Revise this check once we have average user stats.\n\t\t\tif (this.#longFrameCount <= 100) {\n\t\t\t\tthis.reportLongFrame(frame)\n\t\t\t}\n\t\t}\n\t}\n\n\tgetSandboxDomNodes(): number {\n\t\treturn this.#sandboxDomNodes ?? 0\n\t}\n\n\tsetSandboxDomNodes(count: number): void {\n\t\tthis.#sandboxDomNodes = count\n\t}\n\n\tgetSandboxMemoryUse(): number {\n\t\treturn this.#sandboxMemoryUsed ?? 0\n\t}\n\n\taddSandboxMemoryReport({ memoryTotal, memoryUsed, memoryLimit }: MemoryStats) {\n\t\tthis.#sandboxMemoryTotal = memoryTotal\n\t\tthis.#sandboxMemoryUsed = memoryUsed\n\t\tthis.#sandboxMemoryLimit = memoryLimit\n\t}\n\n\treportToConsole = () => {\n\t\tconst slice = this.#frames.slice(-60)\n\n\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\tconsole.table(\n\t\t\tslice.map(frame => {\n\t\t\t\tframe = { ...frame, perf: 0 }\n\t\t\t\tdelete frame.perf\n\t\t\t\treturn frame\n\t\t\t}),\n\t\t)\n\n\t\tslice.forEach(frame => {\n\t\t\tif (!frame.perf) return\n\t\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\t\tconsole.log(\"frame: \" + frame.update + \" - \" + frame.totalTime + \"ms\", frame.perf)\n\t\t})\n\t}\n\n\t// These two variables control when to send a new vekter statistics report.\n\t#nextReport = performance.now() + 1 * MINUTE\n\t#framesSinceLastReport = 0\n\t#vekterMemoryUsed = 0\n\t#vekterMemoryUsedLastUpdate = 0\n\n\tgetVekterMemory(): number {\n\t\tconst now = performance.now()\n\t\tif (now - this.#vekterMemoryUsedLastUpdate < 10_000) {\n\t\t\treturn this.#vekterMemoryUsed\n\t\t}\n\n\t\t// biome-ignore lint/suspicious/noExplicitAny: @TODO add explanation\n\t\tconst { memory } = performance as any\n\t\tif (memory) {\n\t\t\tthis.#vekterMemoryUsedLastUpdate = now\n\t\t\tthis.#vekterMemoryUsed = memory.usedJSHeapSize\n\t\t}\n\t\treturn this.#vekterMemoryUsed\n\t}\n\n\treportStatistics() {\n\t\tthis.#framesSinceLastReport += 1\n\n\t\t// Make sure enough time has passed. And that enough new frame reports\n\t\t// have been seen to prevent idle sessions from reporting.\n\t\tif (this.#framesSinceLastReport < 100) return\n\t\tif (this.#nextReport > performance.now()) return\n\n\t\t// Setup new deadline and reset frames seen.\n\t\tthis.#nextReport = performance.now() + 10 * MINUTE\n\t\tthis.#framesSinceLastReport = 0\n\n\t\t// Build and send report.\n\t\tlet totalTime = 0\n\t\tlet eventProcessing = 0\n\t\tlet toolUpdate = 0\n\t\tlet postProcessing = 0\n\t\tlet reactUpdate = 0\n\t\tlet browserPaint = 0\n\t\tlet sandboxUpdating = 0\n\t\tlet sandboxRendering = 0\n\t\tlet remoteDocument = 0\n\t\tlet roundTripTime = 0\n\t\tlet concurrentEditors = 0\n\n\t\t// Take the last 100 frames of when vekter was focused and not busy loading.\n\t\tlet entries = 0\n\t\tconst length = this.#frames.length\n\t\tconst lowerLimit = Math.max(0, length - FRAMES_FOR_REPORT * 1.5)\n\t\tfor (let i = length - 1; i >= lowerLimit; i--) {\n\t\t\tif (entries >= FRAMES_FOR_REPORT) break\n\n\t\t\tconst frame = this.#frames[i]\n\t\t\tif (!frame) continue\n\t\t\tif (!frame.documentWasFocused) continue\n\t\t\tif (frame.documentWasHidden) continue\n\t\t\tif (frame.isInitialLoad) continue\n\n\t\t\tentries += 1\n\t\t\ttotalTime += frame.totalTime\n\t\t\teventProcessing += frame.eventProcessing\n\t\t\ttoolUpdate += frame.toolUpdate\n\t\t\tpostProcessing += frame.postProcessing\n\t\t\treactUpdate += frame.reactUpdate\n\t\t\tbrowserPaint += frame.browserPaint\n\t\t\tsandboxUpdating += frame.sandboxUpdating\n\t\t\tsandboxRendering += frame.sandboxRendering\n\t\t\tremoteDocument += frame.remoteDocument\n\t\t\troundTripTime += frame.rtt\n\n\t\t\tconcurrentEditors = Math.max(concurrentEditors, frame.concurrentEditors)\n\t\t}\n\n\t\t// If there are too few entries because we skipped non-focused frames, skip reporting.\n\t\tif (entries < FRAMES_FOR_REPORT * 0.6) return\n\n\t\tconst lastFrame = this.#frames[length - 1]\n\t\tassert(lastFrame, \"Must have at least one frame to report\")\n\t\ttriggerVekterStatisticsEvent({\n\t\t\ttotalTime: Math.round(totalTime / entries),\n\t\t\teventProcessing: Math.round(eventProcessing / entries),\n\t\t\ttoolUpdate: Math.round(toolUpdate / entries),\n\t\t\tpostProcessing: Math.round(postProcessing / entries),\n\t\t\treactUpdate: Math.round(reactUpdate / entries),\n\t\t\tbrowserPaint: Math.round(browserPaint / entries),\n\t\t\tsandboxUpdating: Math.round(sandboxUpdating / entries),\n\t\t\tsandboxRendering: Math.round(sandboxRendering / entries),\n\t\t\tremoteDocument: Math.round(remoteDocument / entries),\n\t\t\troundTripTime: Math.round(roundTripTime / entries),\n\t\t\tconcurrentEditors,\n\t\t\tupdate: lastFrame.update,\n\t\t\ttreeSize: lastFrame.treeSize,\n\t\t\tdocumentVisible: !lastFrame.documentWasHidden,\n\t\t\tuserIdle: lastFrame.userIdle,\n\t\t\tsandboxMemoryTotal: this.#sandboxMemoryTotal,\n\t\t\tsandboxMemoryUsed: this.#sandboxMemoryUsed,\n\t\t\tsandboxMemoryLimit: this.#sandboxMemoryLimit,\n\t\t\tvekterMemoryUsed: this.getVekterMemory(),\n\t\t})\n\t}\n\n\treportLongFrame(frame: FrameStats) {\n\t\ttriggerUiLongFrameEvent({\n\t\t\tisInitialLoad: frame.isInitialLoad,\n\t\t\ttotalTime: Math.round(frame.totalTime),\n\t\t\teventProcessing: Math.round(frame.eventProcessing),\n\t\t\ttoolUpdate: Math.round(frame.toolUpdate),\n\t\t\tpostProcessing: Math.round(frame.postProcessing),\n\t\t\treactUpdate: Math.round(frame.reactUpdate),\n\t\t\tbrowserPaint: Math.round(frame.browserPaint),\n\t\t\tsandboxUpdating: Math.round(frame.sandboxUpdating),\n\t\t\tsandboxRendering: Math.round(frame.sandboxRendering),\n\t\t\tremoteDocument: Math.round(frame.remoteDocument),\n\t\t\trenderingPhase: this.#getUiLongFrameRenderingPhase(frame.renderingPhase),\n\t\t\tupdate: frame.update,\n\t\t\ttreeSize: frame.treeSize,\n\t\t\tselectionCount: frame.selectionCount,\n\t\t\ttoolName: frame.toolName,\n\t\t\tmouseDown: frame.mouseDown,\n\t\t\tzoom: frame.zoom,\n\t\t\tdidLoadScript: frame.didLoadScript,\n\t\t\tdidZoom: frame.didZoom,\n\t\t})\n\t}\n}\n", "import { assert, getLogger, getServiceMap } from \"@framerjs/shared\"\nimport { experiments } from \"app/experiments.ts\"\nimport type { Remote } from \"comlink\"\nimport { proxy, wrap } from \"comlink\"\nimport { ReactBuild } from \"document/stores/DebugStore.ts\"\nimport { assertNever } from \"library/utils/assert.ts\"\nimport { version as reactVersion } from \"react\"\nimport schedulerPackageJSON from \"scheduler/package.json\" with { type: \"json\" }\nimport * as semver from \"semver\"\nimport { countAndNoun } from \"utils/countAndNoun.ts\"\nimport { isObject, isString } from \"utils/typeChecks.ts\"\nimport { absoluteEditorPath } from \"../utils/platformPaths.ts\"\nimport type { DependenciesMap, ImportMap } from \"./types.ts\"\n\nexport const PROVIDED_DEPENDENCIES = new Set([\n\t\"react\",\n\t\"react/jsx-runtime\",\n\t\"react/jsx-dev-runtime\",\n\t\"react-dom\",\n\t\"react-dom/server\",\n\t\"react-dom/client\",\n\t\"framer\",\n\t\"framer-motion\",\n\t\"framer-motion/three\",\n\t\"fs\",\n\t\"process\",\n\t\"scheduler\",\n])\n\n/** Dependencies that jspm should still resolve as transitive dependencies,\n *  even though they're \"provided\" in the base import map scope. Allows jspm\n *  to place more specific polyfills/versions in package-specific scopes\n *  (e.g. react-reconciler \u2192 scheduler, scheduler \u2192 process). */\nconst JSPM_RESOLVABLE = new Set([\"scheduler\", \"fs\", \"process\"])\n\nfunction toJSPMIgnoreList(ignoreList: Set<string>): string[] {\n\tif (experiments.isOn(\"importMapPruning\")) {\n\t\treturn Array.from(ignoreList).filter(dep => !JSPM_RESOLVABLE.has(dep))\n\t}\n\treturn Array.from(ignoreList)\n}\n\n/**\n * A list of dependencies that are known to cause issues.\n * Eventually we will want to switch to an allowlist.\n * However we will take a slower brown-out style approach, starting with a blocklist.\n */\nconst BLOCKED_DEPENDENCIES = new Set([\n\t\"@babel\",\n\t\"@chakra-ui/icons\",\n\t\"@chakra-ui/react\",\n\t\"@heroicons/react\",\n\t\"@material-ui\",\n\t\"@mui\",\n\t\"@rainbow-me/rainbowkit\",\n\t\"@uniswap/widgets\",\n\t\"babel-runtime\",\n\t\"chakra-ui\",\n\t\"dotenv-safe\",\n\t\"ethers\",\n\t\"firebase\",\n\t\"@jspm/core\",\n\t\"next\",\n\t\"next-themes\",\n\t\"react-code-blocks\",\n\t\"react-firebase-hooks\",\n\t\"react-icons\",\n\t\"react-konva\",\n\t\"react-syntax-highlighter\",\n\t\"wagmi\",\n])\n\n/**\n * This is a dictionary of all dependency version overrides.\n * It is used to enforce resolution of certain libraries to specific versions,\n * that we know are working in Framer.\n */\nexport const RESOLUTIONS: Record<string, string> = {}\n\nconst log = getLogger(\"importMapManager\")\nconst proxiedDebugLog = proxy((msg: string) => log.debug(msg))\nconst importMapGeneratorLogsFlag = \"__ENABLE_IMPORT_MAP_GENERATOR_LOGS__\"\n\n// Generator can log 100k+ lines, so we only enable them when flag is set.\nfunction getImportMapGeneratorLogProxy() {\n\tif (typeof window === \"undefined\") return undefined\n\tif (!(importMapGeneratorLogsFlag in window)) return undefined\n\treturn proxiedDebugLog\n}\n\nexport interface InstallDescriptor {\n\t/** E.g. `\"react@17.0\"` */\n\ttarget: string\n\n\t/** E.g. `\"./jsx-runtime\"` */\n\tsubpath?: \".\" | `./${string}`\n\n\t/** Same as subpath but if you need to install multiple */\n\tsubpaths?: (\".\" | `./${string}`)[]\n\n\t/** Name to use for the dependency in the output import map */\n\talias?: string\n}\n\nexport function getImportMapKey({ target, subpath }: InstallDescriptor) {\n\tconst indexOfVersion = target.indexOf(\"@\", 1)\n\tconst name = indexOfVersion !== -1 ? target.substring(0, indexOfVersion) : target\n\n\tif (!subpath) return name\n\n\tif (subpath === \".\") return name\n\n\tif (!subpath.startsWith(\"./\")) {\n\t\tlog.warn(`${subpath} for ${target} is not valid (not equal to \".\" || \"./\\${string}\")`)\n\t\treturn name\n\t}\n\n\treturn name + subpath.substring(1)\n}\n\n// Logs are separate parameters because comlink doesn't support proxy() inside objects.\ninterface GeneratorResult {\n\timportMap: ImportMap\n\tcache?: Record<string, unknown>\n}\n\ninterface Generator {\n\tinstall(\n\t\toptions: {\n\t\t\tinputMap: ImportMap\n\t\t\tinstallDescriptor: InstallDescriptor | InstallDescriptor[] | undefined\n\t\t\tignoreList: string[]\n\t\t\tresolutions: Record<string, string>\n\t\t\toptionOverrides?: Record<string, unknown>\n\t\t},\n\t\tlog?: (msg: string) => void,\n\t): Promise<GeneratorResult>\n\tuninstall(\n\t\toptions: {\n\t\t\tinputMap: ImportMap\n\t\t\tnames: string | string[]\n\t\t\tignoreList: string[]\n\t\t\tresolutions: Record<string, string>\n\t\t},\n\t\tlog?: (msg: string) => void,\n\t): Promise<GeneratorResult>\n\treinstall(inputMap: ImportMap, ignoreList?: string[], resolutions?: Record<string, string>): Promise<GeneratorResult>\n\tlink(\n\t\toptions: {\n\t\t\tinputMap: ImportMap\n\t\t\tentryPoints: string[]\n\t\t\tignoreList: string[]\n\t\t\tresolutions: Record<string, string>\n\t\t\tmodulesCDN: string\n\t\t},\n\t\tlog?: (msg: string) => void,\n\t): Promise<GeneratorResult>\n}\n\ntype ImportMapFixtureOperation = \"install\" | \"reinstall\" | \"link\"\ntype ImportMapFixturePhase = \"input\" | \"output\"\n\ninterface ImportMapFixtureCaptureEntry {\n\tcaptureId: string\n\toperation: ImportMapFixtureOperation\n\tphase: ImportMapFixturePhase\n\tpayload: unknown\n\ttimestamp: number\n}\n\ninterface WindowWithImportMapFixtureCapture extends Window {\n\t__CAPTURE_IMPORT_MAP_FIXTURES__?: true\n\t__IMPORT_MAP_FIXTURE__?: ImportMapFixtureCaptureEntry[]\n}\n\nfunction createFixtureCapture(operation: ImportMapFixtureOperation) {\n\tconst captureId = `${Date.now()}-${operation}-${Math.random().toString(36).slice(2, 8)}`\n\n\tfunction capture(phase: ImportMapFixturePhase, payload: unknown) {\n\t\tconst fixtureWindow = window as WindowWithImportMapFixtureCapture\n\t\tif (!(\"__CAPTURE_IMPORT_MAP_FIXTURES__\" in fixtureWindow)) return\n\n\t\tlog.debug(`[Capturing import map fixture: ${operation}:${phase}]`)\n\n\t\tconst nextEntry: ImportMapFixtureCaptureEntry = {\n\t\t\tcaptureId,\n\t\t\toperation,\n\t\t\tphase,\n\t\t\tpayload,\n\t\t\ttimestamp: Date.now(),\n\t\t}\n\n\t\tconst existingEntries = fixtureWindow.__IMPORT_MAP_FIXTURE__ ?? []\n\t\texistingEntries.push(nextEntry)\n\n\t\t// We should never need more than 1-2 captures per test.\n\t\t// Bound them just in case you leave the option enabled.\n\t\tif (existingEntries.length > 10) {\n\t\t\texistingEntries.splice(0, existingEntries.length - 10)\n\t\t}\n\t\tfixtureWindow.__IMPORT_MAP_FIXTURE__ = existingEntries\n\n\t\twindow.dispatchEvent(new CustomEvent(\"import-map-fixture-captured\", { detail: nextEntry }))\n\t}\n\n\treturn {\n\t\tinput: (payload: unknown) => capture(\"input\", payload),\n\t\toutput: (payload: unknown) => capture(\"output\", payload),\n\t}\n}\n\nexport async function addDependencies(\n\tinputMap: ImportMap,\n\tinstallDescriptor: InstallDescriptor | InstallDescriptor[],\n\tignoreList: Set<string>,\n\tresolutions: Record<string, string>,\n): Promise<{ importMap: ImportMap; resolvedDependencies: PackageResolution[] }> {\n\tconst generator = getGenerator()\n\tconst capture = createFixtureCapture(\"install\")\n\n\tlog.debug(\"Installing\", installDescriptor)\n\n\tconst installOptions = {\n\t\tinputMap,\n\t\tinstallDescriptor,\n\t\tignoreList: toJSPMIgnoreList(ignoreList),\n\t\tresolutions,\n\t\toptionOverrides: { flattenScopes: !experiments.isOn(\"importMapPruning\") },\n\t}\n\n\tcapture.input(installOptions)\n\n\tconst { importMap } = await generator.install(installOptions, getImportMapGeneratorLogProxy())\n\n\tcapture.output(importMap)\n\n\tconst installDescriptors = Array.isArray(installDescriptor) ? installDescriptor : [installDescriptor]\n\tconst resolvedDependencies: PackageResolution[] = []\n\tfor (const install of installDescriptors) {\n\t\tconst url = importMap.imports[getImportMapKey(install)]\n\t\tif (!url) continue\n\n\t\tconst resolution = parsePackageUrl(url)\n\t\tif (resolution) {\n\t\t\tresolution.version = `^${resolution.version}`\n\t\t\tresolvedDependencies.push(resolution)\n\t\t}\n\t}\n\n\t// Merge scopes from inputMap into importMap because install strips them.\n\tif (experiments.isOn(\"importMapPruning\")) {\n\t\tif (inputMap.scopes) {\n\t\t\timportMap.scopes ??= {}\n\t\t\tfor (const [name, sourceScope] of Object.entries(inputMap.scopes)) {\n\t\t\t\timportMap.scopes[name] = Object.assign({}, sourceScope, importMap.scopes?.[name])\n\t\t\t}\n\t\t}\n\t}\n\n\treturn { importMap, resolvedDependencies }\n}\n\nexport async function reinstallDependencies(\n\tinputMap: ImportMap,\n\tignoreList: Set<string>,\n\tresolutions: Record<string, string>,\n) {\n\tconst generator = getGenerator()\n\tconst capture = createFixtureCapture(\"reinstall\")\n\n\tlog.debug(\"Reinstalling\")\n\n\tconst installOptions = {\n\t\tinputMap,\n\t\tinstallDescriptor: undefined,\n\t\tignoreList: toJSPMIgnoreList(ignoreList),\n\t\tresolutions,\n\t\toptionOverrides: { flattenScopes: !experiments.isOn(\"importMapPruning\") },\n\t}\n\n\tcapture.input(installOptions)\n\n\tconst { importMap } = await generator.install(installOptions, getImportMapGeneratorLogProxy())\n\n\tcapture.output(importMap)\n\n\treturn { importMap }\n}\n\nasync function uninstallDependencies(\n\tinputMap: ImportMap,\n\tnames: string | string[],\n\tignoreList: Set<string>,\n\tresolutions: Record<string, string>,\n) {\n\tconst generator = getGenerator()\n\n\tlog.debug(\"Uninstalling\")\n\n\tconst { importMap } = await generator.uninstall(\n\t\t{\n\t\t\tinputMap,\n\t\t\tnames,\n\t\t\tignoreList: toJSPMIgnoreList(ignoreList),\n\t\t\tresolutions,\n\t\t},\n\t\tgetImportMapGeneratorLogProxy(),\n\t)\n\n\treturn { importMap }\n}\n\nexport function isImportMapEmpty(importMap: ImportMap) {\n\tif (Object.keys(importMap.imports).length > 0) return false\n\tif (importMap.scopes && Object.keys(importMap.scopes).length > 0) return false\n\treturn true\n}\n\nexport function isBlockedDependency(dependency: string) {\n\tif (BLOCKED_DEPENDENCIES.has(dependency)) return true\n\n\t// Capture all sub-paths of blocked deps\n\tfor (const blockedDependency of BLOCKED_DEPENDENCIES) {\n\t\tif (dependency.startsWith(blockedDependency)) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\nexport function removeBlockedDependencies(dependenciesMap: DependenciesMap) {\n\tlet removalCount = 0\n\n\tfor (const dep in dependenciesMap.dependencies) {\n\t\tif (isBlockedDependency(dep)) {\n\t\t\tdelete dependenciesMap.dependencies[dep]\n\t\t\tremovalCount++\n\t\t}\n\t}\n\n\tlog.info(`Removed ${countAndNoun(removalCount, \"problematic dependency.\", \"problematic dependencies.\")} `)\n\n\treturn dependenciesMap\n}\n\nexport async function uninstallBlockedDependencies(importMap: ImportMap) {\n\tconst dependenciesToRemove: string[] = []\n\n\tfor (const dep in importMap.imports) {\n\t\tif (isBlockedDependency(dep)) {\n\t\t\tdependenciesToRemove.push(dep)\n\t\t}\n\t}\n\n\tif (dependenciesToRemove.length === 0) return importMap\n\n\tconst { importMap: newImportMap } = await uninstallDependencies(\n\t\timportMap,\n\t\tdependenciesToRemove,\n\t\tPROVIDED_DEPENDENCIES,\n\t\tRESOLUTIONS,\n\t)\n\n\treturn newImportMap\n}\n\nexport function extendImportMap(\n\ttargetMap: ImportMap,\n\tsourceMap: ImportMap,\n\tstrategy: \"source-wins\" | \"target-wins\" = \"target-wins\",\n): ImportMap {\n\tconst extendedMap: ImportMap = { ...targetMap }\n\n\textendedMap.imports =\n\t\tstrategy === \"target-wins\"\n\t\t\t? Object.assign({}, sourceMap.imports, targetMap.imports)\n\t\t\t: Object.assign({}, targetMap.imports, sourceMap.imports)\n\n\tif (sourceMap.scopes) {\n\t\textendedMap.scopes ??= {}\n\t\tfor (const [name, sourceScope] of Object.entries(sourceMap.scopes)) {\n\t\t\textendedMap.scopes[name] =\n\t\t\t\tstrategy === \"target-wins\"\n\t\t\t\t\t? Object.assign({}, sourceScope, targetMap.scopes?.[name])\n\t\t\t\t\t: Object.assign({}, targetMap.scopes?.[name], sourceScope)\n\t\t}\n\t}\n\n\treturn extendedMap\n}\n\n/**\n * Configured via the `TAILSCALE_URL`. Pass it the URL (without trailing slash) printed when running:\n * ```\n * tailscale funnel --https=443 https+insecure://localhost:8009\n * ```\n */\nconst tailscaleScreenshotURL = (process.env.TAILSCALE_URL ?? \"\").replace(/\\/+$/u, \"\")\n\nexport function isTailscaleScreenshotConfigured(): boolean {\n\treturn tailscaleScreenshotURL.length > 0\n}\n\n/**\n * Returns an import map that points the `framer` and `framer-motion` entries at the configured Tailscale funnel.\n */\nexport function getTailscaleScreenshotImportMap(): ImportMap | undefined {\n\tif (!tailscaleScreenshotURL) return undefined\n\treturn {\n\t\timports: {\n\t\t\tframer: `${tailscaleScreenshotURL}/framer.debug.mjs`,\n\t\t\t\"framer-motion\": `${tailscaleScreenshotURL}/framer-motion.debug.mjs`,\n\t\t},\n\t}\n}\n\nfunction getParentScopeUrl(scopeUrl: string) {\n\tconst protocolSeparatorIndex = scopeUrl.indexOf(\"://\")\n\tconst minSlashIndex = protocolSeparatorIndex === -1 ? 0 : protocolSeparatorIndex + 3\n\tconst endIndex = scopeUrl.endsWith(\"/\") ? scopeUrl.length - 1 : scopeUrl.length\n\tconst parentSlashIndex = scopeUrl.lastIndexOf(\"/\", endIndex - 1)\n\n\tif (parentSlashIndex < minSlashIndex) return undefined\n\n\treturn scopeUrl.slice(0, parentSlashIndex + 1)\n}\n\nfunction getImportMapResolution(\n\timportMap: ImportMap,\n\tscopeUrl: string | undefined,\n\tspecifier: string,\n): string | undefined {\n\tfor (\n\t\tlet currentScopeUrl = scopeUrl;\n\t\tcurrentScopeUrl !== undefined;\n\t\tcurrentScopeUrl = getParentScopeUrl(currentScopeUrl)\n\t) {\n\t\tconst scopedResolution = importMap.scopes?.[currentScopeUrl]?.[specifier]\n\t\tif (scopedResolution !== undefined) return scopedResolution\n\t}\n\n\treturn importMap.imports?.[specifier]\n}\n\nexport function hasChangedImportMapResolutions(current: ImportMap, next: ImportMap): boolean {\n\tconst currentScopes = current.scopes ?? {}\n\tconst nextScopes = next.scopes ?? {}\n\n\tfor (const specifier in current.imports ?? {}) {\n\t\tif (current.imports[specifier] !== next.imports?.[specifier]) return true\n\t}\n\n\tfunction hasChangedExistingResolution(scopeUrl: string, specifier: string) {\n\t\tconst currentResolution = getImportMapResolution(current, scopeUrl, specifier)\n\t\treturn currentResolution !== undefined && currentResolution !== getImportMapResolution(next, scopeUrl, specifier)\n\t}\n\n\tfor (const scopeUrl in currentScopes) {\n\t\tconst currentScope = currentScopes[scopeUrl] ?? {}\n\t\tconst nextScope = nextScopes[scopeUrl] ?? {}\n\n\t\tfor (const specifier in currentScope) {\n\t\t\tif (hasChangedExistingResolution(scopeUrl, specifier)) return true\n\t\t}\n\n\t\tfor (const specifier in nextScope) {\n\t\t\tif (specifier in currentScope) continue\n\t\t\tif (hasChangedExistingResolution(scopeUrl, specifier)) return true\n\t\t}\n\t}\n\n\tfor (const scopeUrl in nextScopes) {\n\t\tif (scopeUrl in currentScopes) continue\n\n\t\tconst nextScope = nextScopes[scopeUrl] ?? {}\n\t\tfor (const specifier in nextScope) {\n\t\t\tif (hasChangedExistingResolution(scopeUrl, specifier)) return true\n\t\t}\n\t}\n\n\treturn false\n}\n\nfunction isStringRecord(value: unknown): value is Record<string, string> {\n\treturn isObject(value) && Object.values(value).every(isString)\n}\n\nexport function assertIsImportMap(importMap: unknown): asserts importMap is ImportMap {\n\tassert(isObject(importMap), \"Expected import map content to be an object\")\n\tassert(isStringRecord(importMap.imports), \"Expected import map imports to be a string record\")\n\n\tconst scopesAreStringRecords = isObject(importMap.scopes) && Object.values(importMap.scopes).every(isStringRecord)\n\tassert(\n\t\timportMap.scopes === undefined || scopesAreStringRecords,\n\t\t\"Expected import map scopes to be a string record of string records\",\n\t)\n}\n\nexport function parseImportMapContent(content: string): ImportMap {\n\tconst importMap: unknown = JSON.parse(content)\n\tassertIsImportMap(importMap)\n\treturn importMap\n}\n\nexport function didExistingImportMapResolutionChange(\n\tcurrentImportMapContent: string | undefined,\n\tnextImportMapContent: string | undefined,\n): boolean {\n\tif (currentImportMapContent === nextImportMapContent) return false\n\tif (!currentImportMapContent) return false\n\tif (!nextImportMapContent) return true\n\n\tconst currentImportMap = parseImportMapContent(currentImportMapContent)\n\tconst nextImportMap = parseImportMapContent(nextImportMapContent)\n\treturn hasChangedImportMapResolutions(currentImportMap, nextImportMap)\n}\n\nexport function extendDependencies(target: DependenciesMap, source: DependenciesMap) {\n\tconst dependencies: DependenciesMap = { dependencies: {} }\n\tdependencies.dependencies = Object.assign({}, source?.dependencies, target?.dependencies)\n\tdependencies.resolutions = Object.assign({}, source?.resolutions, target?.resolutions)\n\n\treturn dependencies\n}\n\nexport function generateDependenciesFromImportMap(importMap: ImportMap) {\n\tconst dependenciesMap: DependenciesMap = { dependencies: {} }\n\n\tif (importMap.imports) {\n\t\tfor (const importURL of Object.values(importMap.imports)) {\n\t\t\tconst resolution = importURL && parsePackageUrl(importURL)\n\t\t\tif (resolution) {\n\t\t\t\tdependenciesMap.dependencies[resolution.name] = `^${resolution.version}`\n\t\t\t}\n\t\t}\n\t}\n\treturn dependenciesMap\n}\n\nfunction verifyExpectedSubDependencies(\n\tscopes: Record<string, string | null> | undefined,\n\texpectedSubDependencies: string[],\n) {\n\tif (expectedSubDependencies.length === 0) return true\n\tif (!scopes) return false\n\n\tconst scopesKeys = Object.keys(scopes)\n\tif (scopesKeys.length !== expectedSubDependencies.length) return false\n\n\treturn scopesKeys.every(subDependency => expectedSubDependencies.includes(subDependency))\n}\n\nexport function getInstalledPackageVersion(importMap: ImportMap, dependency: string): string | null {\n\tconst packageURL = importMap.imports[dependency]\n\tif (!packageURL) return null\n\n\t// Maches `npm:{packageName}@{version}`\n\tconst regex = /npm:.+@(?<version>[\\d.]+)/u\n\tconst match = regex.exec(packageURL)\n\n\tif (!match) return null\n\n\treturn match.groups?.version ?? null\n}\n\nexport function shouldUpgradeDependency(importMap: ImportMap, dependency: string, version: string) {\n\tconst currentInstalledVersion = importMap.imports[dependency]\n\n\t// We always upgrade to the latest version.\n\tif (version === \"latest\") return true\n\n\t// Not yet installed so an upgrade\n\tif (!currentInstalledVersion) return true\n\n\tconst minRequestedVersion = semver.minVersion(version)\n\tif (!minRequestedVersion) {\n\t\tthrow new Error(`${version} is not a valid semver version`)\n\t}\n\n\tconst installedVersion = getInstalledPackageVersion(importMap, dependency)\n\tif (!installedVersion) {\n\t\tthrow new Error(\"Installed version is not a valid semver version\")\n\t}\n\n\treturn semver.gt(minRequestedVersion, installedVersion)\n}\n\nexport async function unsafeUpgradeDependency(\n\timportMap: ImportMap,\n\tdependency: string,\n\texpectedSubDependencies: string[],\n\tversion: string = \"latest\",\n): Promise<ImportMap> {\n\tconst dependencyTarget = `${dependency}@${version}`\n\tconst generator = getGenerator()\n\n\tif (!shouldUpgradeDependency(importMap, dependency, version)) {\n\t\treturn importMap\n\t}\n\n\tconst { importMap: dependencyImportMap } = await generator.install(\n\t\t{\n\t\t\tinputMap: { imports: {} },\n\t\t\tinstallDescriptor: { target: dependencyTarget },\n\t\t\tignoreList: toJSPMIgnoreList(PROVIDED_DEPENDENCIES),\n\t\t\tresolutions: {},\n\t\t\toptionOverrides: { flattenScopes: !experiments.isOn(\"importMapPruning\") },\n\t\t},\n\t\tgetImportMapGeneratorLogProxy(),\n\t)\n\n\tconst containsExpectedSubDependencies = verifyExpectedSubDependencies(\n\t\tdependencyImportMap?.scopes?.[\"https://ga.jspm.io/\"],\n\t\texpectedSubDependencies,\n\t)\n\n\tif (!containsExpectedSubDependencies) {\n\t\tthrow new Error(\"Sub-dependencies do not match expected sub-dependencies\")\n\t}\n\n\t// TODO: When refactoring into a more generic function, this should be handled by the Generator.\n\t// We do not do this now as dependency lists are artificially large and slow to operate on.\n\tconst newImportMap = extendImportMap(dependencyImportMap, importMap, \"target-wins\")\n\n\treturn newImportMap\n}\n\nexport async function generateImportMapFromDependencies(\n\tdependencies: DependenciesMap,\n\tignoreList: Set<string>,\n\tresolutions: Record<string, string>,\n) {\n\tconst generator = getGenerator()\n\tconst installDescriptor: InstallDescriptor[] = []\n\tconst allResolutions = Object.assign({}, resolutions, dependencies?.resolutions)\n\n\tfor (const [name, version] of Object.entries(dependencies.dependencies)) {\n\t\tinstallDescriptor.push(toInstallDescriptor(name, version))\n\t}\n\n\tlet { importMap } = await generator.install(\n\t\t{\n\t\t\tinputMap: { imports: {} },\n\t\t\tinstallDescriptor,\n\t\t\tignoreList: toJSPMIgnoreList(ignoreList),\n\t\t\tresolutions: allResolutions,\n\t\t\toptionOverrides: { flattenScopes: !experiments.isOn(\"importMapPruning\") },\n\t\t},\n\t\tgetImportMapGeneratorLogProxy(),\n\t)\n\n\tif (!importMap.imports) {\n\t\t// The generator can return an empty object if no imports were generated.\n\t\timportMap = { ...importMap, imports: {} }\n\t}\n\n\treturn importMap\n}\n\n/**\n * Uses JSPM Generator link method to generate an import map.\n * Walks the import graph starting from entry points to determine which dependencies are being used.\n * Any unused dependencies will be removed from the import map.\n * Any missing dependencies will be added to the import map.\n */\nexport async function generateImportMapFromEntryPoints(\n\tentryPoints: string[],\n\tignoreList: Set<string>,\n\tresolutions: Record<string, string>,\n\tcurrentImportMap?: ImportMap,\n) {\n\tconst generator = getGenerator()\n\tconst capture = createFixtureCapture(\"link\")\n\n\t// If no current import map provided, start with static base\n\tconst baseImportMap = currentImportMap || getStaticImportMap()\n\tconst { modulesCDN } = getServiceMap()\n\n\tconst linkOptions = {\n\t\tinputMap: baseImportMap,\n\t\tentryPoints,\n\t\tignoreList: toJSPMIgnoreList(ignoreList),\n\t\tresolutions,\n\t\tmodulesCDN,\n\t}\n\n\tcapture.input(linkOptions)\n\n\tlet { importMap } = await generator.link(linkOptions, getImportMapGeneratorLogProxy())\n\n\tif (!importMap.imports) {\n\t\t// The generator can return an empty object if no imports were generated.\n\t\timportMap = { ...importMap, imports: {} }\n\t}\n\n\tcapture.output(importMap)\n\n\treturn importMap\n}\n\nlet generator: Remote<Generator> | undefined = undefined\n\nfunction getGenerator(): Remote<Generator> {\n\tif (!generator) {\n\t\tconst worker = new Worker(absoluteEditorPath(\"./importMapGeneratorWorker.js\"))\n\t\tgenerator = wrap<Generator>(worker)\n\t}\n\n\treturn generator\n}\n\nexport interface PackageResolution {\n\tregistry: string\n\tname: string\n\tversion: string\n}\n\n// jspm changes its subdomain every year when it does its major release\nconst cdnUrlRegex = /^https:\\/\\/[a-z]{2}.jspm.io\\//\nconst exactPkgRegEx = /^(([a-z]+):)?((?:@[^/\\\\%@]+\\/)?[^./\\\\%@][^/\\\\%@]*)@([^/]+)(\\/.*)?$/\nexport function parsePackageUrl(url: string): PackageResolution | undefined {\n\t// for custom specifiers or null resolutions\n\tconst match = url.match(cdnUrlRegex)\n\tif (!match) return\n\n\tconst [, , registry, name, version] = url.slice(match[0]?.length).match(exactPkgRegEx) || []\n\tassert(registry && name && version, \"Unparseable package url:\", url)\n\treturn { registry, name, version }\n}\n\nexport function parseInstallDescriptor(bareModuleSpecifier: string): InstallDescriptor | undefined {\n\tlet sepIndex = bareModuleSpecifier.indexOf(\"/\")\n\n\tif (bareModuleSpecifier[0] === \"@\") {\n\t\tif (sepIndex === -1) return // early exit if there is a namespace indicator without a packageName\n\t\tsepIndex = bareModuleSpecifier.indexOf(\"/\", sepIndex + 1)\n\t}\n\n\tif (sepIndex === -1) {\n\t\treturn { target: bareModuleSpecifier }\n\t}\n\n\treturn { target: bareModuleSpecifier.slice(0, sepIndex), subpath: `./${bareModuleSpecifier.slice(sepIndex + 1)}` }\n}\n\nfunction toInstallDescriptor(bareModuleSpecifier: string, version: string): InstallDescriptor {\n\treturn { target: `${bareModuleSpecifier}@${version}` }\n}\n\n/**\n * Returns the \"base\" importmap used by Sites and various previews.\n */\nexport function getStaticImportMap(\n\t// Accepting this as an argument instead of reading `engine.debugStore.enableProfilingOfPublishedSites` directly\n\t// because importing `engine` in this file screws up ESBuild code splitting (https://github.com/evanw/esbuild/issues/399)\n\treactBuild: ReactBuild = ReactBuild.Production,\n\treactVersionOverride: string | undefined = undefined,\n\tschedulerVersionOverride: string | undefined = undefined,\n) {\n\tconst { libraryURL, framerMotionURL } = getExportAssets()\n\n\tconst { reactHref, reactDomHref, reactDomClientHref, reactDomServerHref, reactJsxRuntimeHref, schedulerHref } =\n\t\tgetReactAssets(reactBuild, reactVersionOverride, schedulerVersionOverride)\n\n\t// Based on:\n\t// https://generator.jspm.io/#U2NhYGDhD80rySzJSU1hKEpNTC7RTcnPdTC00DPUM8AQ0C9OLSpLLdJLKsovBzIh8iiKYQqziit0i0qBBuemAgB04TJHZQA\n\t// (Please update the URL in the comment if you're updating the import map.)\n\t// (Please also update the development map beflow with development versions.)\n\treturn {\n\t\timports: {\n\t\t\tframer: libraryURL.href,\n\t\t\t\"framer-motion\": framerMotionURL.href,\n\t\t\treact: reactHref,\n\t\t\t\"react-dom\": reactDomHref,\n\t\t\t\"react-dom/client\": reactDomClientHref,\n\t\t\t\"react-dom/server\": reactDomServerHref,\n\t\t\t\"react/jsx-runtime\": reactJsxRuntimeHref,\n\t\t},\n\t\t// For why scheduler lives in a scope, see: https://github.com/framer/FramerStudio/pull/15962#discussion_r1412687036\n\t\tscopes: {\n\t\t\t\"https://ga.jspm.io/\": {\n\t\t\t\tfs: \"https://framer.com/m/framer/empty.js@0.1.0\",\n\t\t\t\tprocess: \"https://framer.com/m/framer/empty.js@0.1.0\",\n\t\t\t\tscheduler: schedulerHref,\n\t\t\t},\n\t\t\t...(reactBuild === ReactBuild.Instrumented\n\t\t\t\t? {\n\t\t\t\t\t\t\"https://framer.github.io/framer-react-instrumented/\": {\n\t\t\t\t\t\t\tscheduler: schedulerHref,\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t},\n\t} satisfies ImportMap\n}\n\ntype WindowWithExportAssets = Window & {\n\texportAssets: {\n\t\tlibrary: string\n\t\tframerMotion: string\n\t}\n}\n\nfunction getExportAssets() {\n\tconst exportAssetsWindow = window as unknown as WindowWithExportAssets\n\n\t// window.exportAssets is defined in web.ejs\n\treturn {\n\t\tlibraryURL: new URL(exportAssetsWindow.exportAssets.library, window.location.origin),\n\t\tframerMotionURL: new URL(exportAssetsWindow.exportAssets.framerMotion, window.location.origin),\n\t}\n}\n\nfunction getReactAssets(\n\treactBuild: ReactBuild,\n\treactVersionOverride: string | undefined,\n\tschedulerVersionOverride: string | undefined,\n) {\n\tconst resolvedReactVersion = reactVersionOverride ?? reactVersion\n\tconst resolvedSchedulerVersion = schedulerVersionOverride ?? schedulerPackageJSON.version\n\n\tconst isReact19 = resolvedReactVersion.startsWith(\"19\")\n\n\tswitch (reactBuild) {\n\t\tcase ReactBuild.Production:\n\t\t\treturn {\n\t\t\t\treactHref: `https://ga.jspm.io/npm:react@${resolvedReactVersion}/index.js`,\n\t\t\t\treactDomHref: `https://ga.jspm.io/npm:react-dom@${resolvedReactVersion}/index.js`,\n\t\t\t\treactDomClientHref: `https://ga.jspm.io/npm:react-dom@${resolvedReactVersion}/client.js`,\n\t\t\t\treactDomServerHref: `https://ga.jspm.io/npm:react-dom@${resolvedReactVersion}/server.browser.js`,\n\t\t\t\treactJsxRuntimeHref: `https://ga.jspm.io/npm:react@${resolvedReactVersion}/jsx-runtime.js`,\n\t\t\t\tschedulerHref: `https://ga.jspm.io/npm:scheduler@${resolvedSchedulerVersion}/index.js`,\n\t\t\t}\n\t\tcase ReactBuild.ProductionWithProfiling:\n\t\t\treturn {\n\t\t\t\treactHref: `https://ga.jspm.io/npm:react@${resolvedReactVersion}/index.js`,\n\t\t\t\t// Ternary per https://github.com/facebook/react/issues/32992#issuecomment-2823405273\n\t\t\t\treactDomHref: `https://ga.jspm.io/npm:react-dom@${resolvedReactVersion}/${isReact19 ? \"index\" : \"profiling\"}.js`,\n\t\t\t\treactDomClientHref: `https://ga.jspm.io/npm:react-dom@${resolvedReactVersion}/${isReact19 ? \"profiling\" : \"client\"}.js`,\n\t\t\t\treactDomServerHref: `https://ga.jspm.io/npm:react-dom@${resolvedReactVersion}/server.browser.js`,\n\t\t\t\treactJsxRuntimeHref: `https://ga.jspm.io/npm:react@${resolvedReactVersion}/jsx-runtime.js`,\n\t\t\t\tschedulerHref: `https://ga.jspm.io/npm:scheduler@${resolvedSchedulerVersion}/index.js`,\n\t\t\t}\n\t\tcase ReactBuild.Development:\n\t\t\treturn {\n\t\t\t\treactHref: `https://ga.jspm.io/npm:react@${resolvedReactVersion}/dev.index.js`,\n\t\t\t\t// Ternary per https://github.com/facebook/react/issues/32992#issuecomment-2823405273\n\t\t\t\treactDomHref: `https://ga.jspm.io/npm:react-dom@${resolvedReactVersion}/dev.${isReact19 ? \"index\" : \"profiling\"}.js`,\n\t\t\t\treactDomClientHref: `https://ga.jspm.io/npm:react-dom@${resolvedReactVersion}/dev.${isReact19 ? \"profiling\" : \"client\"}.js`,\n\t\t\t\treactDomServerHref: `https://ga.jspm.io/npm:react-dom@${resolvedReactVersion}/dev.server.browser.js`,\n\t\t\t\treactJsxRuntimeHref: `https://ga.jspm.io/npm:react@${resolvedReactVersion}/dev.jsx-runtime.js`,\n\t\t\t\tschedulerHref: `https://ga.jspm.io/npm:scheduler@${resolvedSchedulerVersion}/dev.index.js`,\n\t\t\t}\n\t\tcase ReactBuild.Instrumented:\n\t\t\treturn {\n\t\t\t\treactHref: `https://framer.github.io/framer-react-instrumented/react/esm/react.development.js`,\n\t\t\t\treactDomHref: `https://framer.github.io/framer-react-instrumented/react-dom/esm/react-dom.development.js`,\n\t\t\t\treactDomClientHref: `https://framer.github.io/framer-react-instrumented/react-dom/esm/react-dom-profiling.development.js`,\n\t\t\t\treactDomServerHref: `https://framer.github.io/framer-react-instrumented/react-dom/esm/react-dom-server.browser.development.js`,\n\t\t\t\treactJsxRuntimeHref: `https://framer.github.io/framer-react-instrumented/react/esm/react-jsx-runtime.development.js`,\n\t\t\t\tschedulerHref: `https://framer.github.io/framer-react-instrumented/scheduler/esm/scheduler.development.js`,\n\t\t\t}\n\t\tdefault:\n\t\t\tassertNever(reactBuild)\n\t}\n}\n", "{\n  \"name\": \"scheduler\",\n  \"version\": \"0.23.0\",\n  \"description\": \"Cooperative scheduler for the browser environment.\",\n  \"main\": \"index.js\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/facebook/react.git\",\n    \"directory\": \"packages/scheduler\"\n  },\n  \"license\": \"MIT\",\n  \"keywords\": [\n    \"react\"\n  ],\n  \"bugs\": {\n    \"url\": \"https://github.com/facebook/react/issues\"\n  },\n  \"homepage\": \"https://reactjs.org/\",\n  \"dependencies\": {\n    \"loose-envify\": \"^1.1.0\"\n  },\n  \"files\": [\n    \"LICENSE\",\n    \"README.md\",\n    \"index.js\",\n    \"unstable_mock.js\",\n    \"unstable_post_task.js\",\n    \"cjs/\",\n    \"umd/\"\n  ],\n  \"browserify\": {\n    \"transform\": [\n      \"loose-envify\"\n    ]\n  }\n}", "import type { ComponentLoader, EntityDefinition } from \"@framerjs/framer-runtime\"\nimport type {\n\tAnnotationKey,\n\tModuleAnnotations,\n\tParsedAnnotations,\n\tParsedModuleAnnotations,\n} from \"@framerjs/framer-runtime/crossorigin\"\nimport type { ModulesAPI } from \"@framerjs/framer-services\"\nimport type {\n\tLocalModuleExportIdentifier,\n\tLocalModuleExportIdentifierString,\n\tLocalModuleId,\n\tModuleIdentifierString,\n} from \"@framerjs/shared\"\nimport {\n\tModuleType,\n\tassertNever,\n\tgetServiceMap,\n\tisEmptyObject,\n\tisLocalModuleIdentifier,\n\tlocalModuleIdentifier,\n\tparseModuleIdentifier,\n} from \"@framerjs/shared\"\nimport type { PersistedModuleProvider } from \"document/stores/ModulesStore.ts\"\nimport { safeTagName } from \"utils/names.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { PROVIDED_DEPENDENCIES } from \"./importMapManager.ts\"\nimport type { AnalyzedImport, AnalyzedImports, ModuleName, TypeSlashName } from \"./types.ts\"\n\nexport function isLocalSmartComponent(entity: EntityDefinition): boolean {\n\tconst identifier = parseModuleIdentifier(entity.identifier)\n\tif (!isLocalModuleIdentifier(identifier)) return false\n\n\treturn identifier.type === ModuleType.Canvas\n}\n\nexport function isModuleURL(url: string): boolean {\n\tconst services = getServiceMap()\n\treturn url.startsWith(services.modulesShortLink) || url.startsWith(services.modulesCDN)\n}\n\nexport function scopeNodeIdFromModule(module: ModulesAPI.ModuleWithSave): string | undefined {\n\treturn module.type === ModuleType.Canvas ? module.name : undefined\n}\n\ntype ModuleFieldsForInfo = Pick<ModulesAPI.ModuleWithSave, \"exports\" | \"title\">\ntype ExternalModuleInfoForImportStatement = {\n\tkind: \"external\"\n\tspecifier: string\n} & ModuleFieldsForInfo\ntype LocalModuleInfoForImportStatement = {\n\tkind: \"local\"\n\ttypeSlashName: string\n} & ModuleFieldsForInfo\ntype ModuleInfoForImportStatement = ExternalModuleInfoForImportStatement | LocalModuleInfoForImportStatement\n\nexport class ImportStatement<T extends ModuleInfoForImportStatement = ModuleInfoForImportStatement> {\n\tconstructor(\n\t\tpublic readonly bindings: string[],\n\t\tpublic readonly info: T,\n\t) {}\n\ttoStringRelativeTo(path: string) {\n\t\tconst { info } = this\n\t\tconst specifier = info.kind === \"external\" ? info.specifier : createRelativePath(path, info.typeSlashName)\n\t\tif (this.bindings.length === 0) {\n\t\t\treturn `import \"${specifier}\"`\n\t\t}\n\t\treturn `import ${this.bindings.join(\", \")} from \"${specifier}\"`\n\t}\n\ttoString() {\n\t\t// Fall back to assuming the import is for a code file that's not in a directory.\n\t\treturn this.toStringRelativeTo(`${ModuleType.Code}/`)\n\t}\n}\n\nexport function getModuleImportStatement(info: ExternalModuleInfoForImportStatement): ImportStatement<typeof info>\nexport function getModuleImportStatement(info: LocalModuleInfoForImportStatement): ImportStatement<typeof info>\nexport function getModuleImportStatement(info: ModuleInfoForImportStatement): ImportStatement<typeof info>\nexport function getModuleImportStatement(info: ModuleInfoForImportStatement) {\n\tconst importBindings: string[] = []\n\tconst namedImports: string[] = []\n\tfor (const specifier of info.exports) {\n\t\tif (specifier === \"default\") {\n\t\t\timportBindings.push(safeTagName(info.title))\n\t\t\tcontinue\n\t\t} else if (specifier === \"__FramerMetadata__\") {\n\t\t\t// Nobody wants to see this one so we hide it.\n\t\t\tcontinue\n\t\t}\n\t\tnamedImports.push(specifier)\n\t}\n\tnamedImports.sort()\n\n\tif (namedImports.length > 0) importBindings.push(`{ ${namedImports.join(\", \")} }`)\n\n\tconst importStatement = new ImportStatement(importBindings, info)\n\treturn importStatement\n}\n\nexport function getNpmImports(imports: AnalyzedImports): AnalyzedImport[] {\n\treturn imports.bare.filter(({ specifier }) => !PROVIDED_DEPENDENCIES.has(specifier))\n}\n\n/**\n * Normalize a relative file path to a virtual base or a provided base\n */\nexport function normalizePath(path: string, base?: string): string | undefined {\n\tconst virtualRoot = `/root${Math.random()}/`\n\tlet baseForURL = virtualRoot\n\n\tif (base) {\n\t\tif (base.startsWith(\"/\")) base = base.substring(1)\n\t\tconst normalizedBase = normalizePath(base)\n\t\tif (normalizedBase === undefined) return\n\t\tbaseForURL += normalizedBase\n\t}\n\n\tconst { pathname } = new URL(path, `file://${baseForURL}`)\n\n\tif (!pathname.startsWith(virtualRoot)) return // Relative path escaped root.\n\treturn pathname.slice(virtualRoot.length)\n}\n\nexport function createRelativePath(from: string, to: string, base?: string): string | undefined {\n\t// Normalize the paths to make sure there's no \".\" or \"..\" in there.\n\tconst fromParts = normalizePath(from, base)?.split(\"/\")\n\tconst toParts = normalizePath(to, base)?.split(\"/\")\n\tif (!fromParts || !toParts) return\n\t// Calculate the number of common directories shared between \"from\" and \"to\".\n\t// Note: We always consider the last part a file and not a directory.\n\tlet commonDirs = 0\n\tfor (let i = 0; i < fromParts.length - 1; i++) {\n\t\tif (i >= toParts.length) break // Nothing more to check in the \"to\" path.\n\t\tif (fromParts[i] !== toParts[i]) break // Paths are not common at this point.\n\t\tcommonDirs++\n\t}\n\t// Number of directories in the \"from\" path (we always assume the last part is a file).\n\tconst fromDirs = fromParts.length - 1\n\tif (commonDirs >= fromDirs) {\n\t\t// The \"from\" parts shares the full path with the \"to\" path, which means\n\t\t// no need to leave the current directory.\n\t\treturn `./${toParts.slice(commonDirs).join(\"/\")}`\n\t} else {\n\t\t// The paths don't fully share the root path, which means we need to\n\t\t// walk up until we hit the common path.\n\t\treturn new Array(fromDirs - commonDirs).fill(\"..\").concat(toParts.slice(commonDirs)).join(\"/\")\n\t}\n}\n\nexport function getTypeSlashName(obj: { type: string; name: string }): TypeSlashName {\n\treturn `${obj.type}/${obj.name}`\n}\n\n/**\n * This function does not guarantee that the returned moduleType is valid.\n */\nexport function splitTypeSlashName(str: ModuleIdentifierString): never\nexport function splitTypeSlashName(str: TypeSlashName): [moduleType: string, name: ModuleName]\nexport function splitTypeSlashName(str: TypeSlashName): [moduleType: string, name: ModuleName] {\n\tconst splitIndex = str.indexOf(\"/\")\n\treturn [str.substring(0, splitIndex), str.substring(splitIndex + 1)]\n}\n\n// Always returns the same object for a specific local id and export specifier\n// pair for stable equality checks.\n// TODO: Consider adopting this behavior in localModuleIdentifier etc directly.\nconst cachedLocalModuleIdentifierMap = new Map<string, LocalModuleExportIdentifier>()\nfunction cachedLocalModuleIdentifier(localId: LocalModuleId, exportSpecifier: string): LocalModuleExportIdentifier {\n\tconst key = `${localId}:${exportSpecifier}`\n\tlet identifier = cachedLocalModuleIdentifierMap.get(key)\n\tif (identifier) return identifier\n\tidentifier = localModuleIdentifier(localId, exportSpecifier)\n\tcachedLocalModuleIdentifierMap.set(key, identifier)\n\treturn identifier\n}\n\ninterface ModuleInfo {\n\texports: readonly string[]\n\tlocalId: LocalModuleId\n}\n\n/**\n * Appends a #exportName fragment to a module URL when the export specifier is\n * a named (non-default) export. Returns the URL unchanged when the specifier\n * is \"default\" or undefined, since the module loader defaults to looking for a\n * \"default\" export.\n */\nexport function moduleUrlWithExportSpecifierFragment(url: string, exportSpecifier: string | undefined): string {\n\tif (!exportSpecifier || exportSpecifier === \"default\") return url\n\treturn `${url}#${exportSpecifier}`\n}\n\n/**\n * Returns the component identifier string for a module by its local id.\n * Resolves the correct export specifier via {@link componentExportIdentifierForModule},\n * falling back to `\"default\"` when the module is unavailable.\n */\nexport function componentExportIdentifierStringForLocalModule(\n\tcomponentLoader: ComponentLoader,\n\tmodulesStore: PersistedModuleProvider,\n\tlocalId: LocalModuleId,\n): LocalModuleExportIdentifierString {\n\tconst persistedModule = modulesStore.getPersistedModuleByLocalId(localId)\n\treturn (\n\t\tcomponentExportIdentifierForModule(componentLoader, persistedModule)?.value ??\n\t\tlocalModuleIdentifier(localId, \"default\").value\n\t)\n}\n\nexport function componentExportIdentifierForModule(\n\tcomponentLoader: ComponentLoader,\n\tmodule: ModuleInfo | undefined,\n): LocalModuleExportIdentifier | undefined {\n\tif (!module) return undefined\n\tif (!module.exports) return undefined\n\n\tconst eligibleSpecifiers = new Set<string>()\n\tfor (const exportSpecifier of module.exports) {\n\t\tconst identifier = cachedLocalModuleIdentifier(module.localId, exportSpecifier).value\n\t\tif (componentLoader.componentForIdentifier(identifier)) {\n\t\t\t// A component exists for this export.\n\t\t\teligibleSpecifiers.add(exportSpecifier)\n\t\t}\n\t}\n\t// Always prefer default over the others.\n\tif (!eligibleSpecifiers.has(\"default\")) {\n\t\tfor (const exportSpecifier of eligibleSpecifiers) {\n\t\t\t// Return a random export specifier (if there's more than 1).\n\t\t\treturn cachedLocalModuleIdentifier(module.localId, exportSpecifier)\n\t\t}\n\t}\n\t// If there were 0 export specifiers, or one of them was default, then return default.\n\treturn cachedLocalModuleIdentifier(module.localId, \"default\")\n}\n\nfunction safeValue(value: string): string | unknown {\n\ttry {\n\t\treturn JSON.parse(value)\n\t} catch {\n\t\treturn value\n\t}\n}\n\nexport function parseModuleAnnotations(annotations: ModuleAnnotations): ParsedModuleAnnotations {\n\tconst parsed: ParsedModuleAnnotations = {}\n\tfor (const exportIdentifier in annotations) {\n\t\tconst value: ParsedAnnotations = {}\n\n\t\tconst exportAnnotations = annotations[exportIdentifier]\n\t\tif (!exportAnnotations) continue\n\n\t\tfor (const key in exportAnnotations) {\n\t\t\tconst annotationKey = key as AnnotationKey\n\t\t\tconst annotationValue = exportAnnotations[annotationKey]\n\t\t\tif (!isString(annotationValue)) continue\n\t\t\tvalue[annotationKey] = safeValue(annotationValue)\n\t\t}\n\n\t\tif (isEmptyObject(value)) continue\n\n\t\tparsed[exportIdentifier] = value\n\t}\n\n\treturn parsed\n}\n\nexport function isEvaluatedModuleType(type: ModuleType) {\n\tswitch (type) {\n\t\tcase ModuleType.Canvas:\n\t\tcase ModuleType.Code:\n\t\tcase ModuleType.Collection:\n\t\tcase ModuleType.DraftCollection:\n\t\tcase ModuleType.ComponentPresets:\n\t\tcase ModuleType.Prototype:\n\t\tcase ModuleType.Screen:\n\t\tcase ModuleType.CSS:\n\t\tcase ModuleType.WebPageMetadata:\n\t\tcase ModuleType.SiteMetadata:\n\t\tcase ModuleType.Snippets:\n\t\tcase ModuleType.LayoutTemplate:\n\t\tcase ModuleType.Localization:\n\t\tcase ModuleType.Vector:\n\t\tcase ModuleType.VectorSet:\n\t\tcase ModuleType.Design:\n\t\tcase ModuleType.Shader:\n\t\t\treturn true\n\t\tcase ModuleType.Config:\n\t\tcase ModuleType.Kit:\n\t\t\treturn false\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n", "import { getLogger } from \"@framerjs/shared\"\nimport { pathVariablesRegExp, pathVariablesRegExpGlobal } from \"library/router/pathVariables.ts\"\nimport { isString } from \"./typeChecks.ts\"\n\n// Match everything except for letters and numbers.\nconst nonSlugCharactersRegExp = /[^\\p{Letter}\\p{Number}]+/gu\n// Match leading/trailing dashes, for trimming purposes.\nconst trimSlugRegExp = /^_+|_+$/gu\n\n/**\n * Slugify path variables in a way that matches `pathVariablesRegExp`.\n *\n * Regular slugify will separate words with `-`, but `pathVariablesRegExp`\n * expects words to be separated with `_`.\n */\nexport function slugifyPathVariable(value: string): string {\n\treturn value.toLowerCase().replace(nonSlugCharactersRegExp, \"_\").replace(trimSlugRegExp, \"\")\n}\n\nexport function hasPathVariableShape(segment: string): boolean {\n\treturn pathVariablesRegExp.test(segment)\n}\n\nexport function hasSegmentWithPathVariableShape(path: string): boolean {\n\tconst segments = path.split(\"/\")\n\tfor (const segment of segments) {\n\t\tif (hasPathVariableShape(segment)) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\nexport function extractPathVariables(path: string): string[] {\n\tconst pathVariables: string[] = []\n\tfor (const match of path.matchAll(pathVariablesRegExpGlobal)) {\n\t\tif (isString(match[1])) {\n\t\t\tpathVariables.push(match[1])\n\t\t}\n\t}\n\n\treturn pathVariables\n}\n\nclass MissingPathVariableError extends Error {}\n\n/**\n * @returns The path with path variables filled in, or undefined if any path variable is missing or empty.\n */\nexport function fillPathVariables(\n\tpath: string,\n\tvariables: Record<string, string>,\n\tallowBlank?: boolean,\n): string | undefined {\n\ttry {\n\t\treturn path.replace(pathVariablesRegExpGlobal, (match, name) => {\n\t\t\tconst value = variables[name]\n\t\t\tif (!value) {\n\t\t\t\tif (allowBlank) return \"\"\n\t\t\t\tthrow new MissingPathVariableError(`Could not substitute ${match} in path`)\n\t\t\t}\n\t\t\treturn encodeURIComponent(value)\n\t\t})\n\t} catch (error) {\n\t\tif (error instanceof MissingPathVariableError) {\n\t\t\tgetLogger(\"app\").warn(error)\n\t\t\treturn\n\t\t} else {\n\t\t\tthrow error\n\t\t}\n\t}\n}\n", "export function getFirstObjectValue<T extends Record<string, unknown>>(object: T): T[keyof T] | undefined {\n\tfor (const key in object) {\n\t\treturn object[key]\n\t}\n\treturn undefined\n}\n", "import type { DataDefinition } from \"@framerjs/framer-runtime\"\nimport type { ItemToSlug } from \"@framerjs/framer-runtime/crossorigin\"\nimport { AnnotationKey } from \"@framerjs/framer-runtime/crossorigin\"\nimport type { SlugVariableDefinition } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { pathVariablesRegExpGlobal } from \"library/router/pathVariables.ts\"\nimport { getFirstObjectValue } from \"utils/getFirstObjectValue.ts\"\nimport { slugifyPathVariable } from \"utils/pathVariables.ts\"\n\nconst missingSlugFallback = \":missing-slug\"\n\nexport function convertIdPathVariablesToReadable(\n\tdataDefinition: DataDefinition,\n\tpath: string,\n\ttype: \"title\" | \"value\" = \"title\",\n): string {\n\tconst slugKey = dataDefinition.annotations?.[AnnotationKey.FramerSlug]\n\n\treturn path.replace(pathVariablesRegExpGlobal, (_variable, name) => {\n\t\tif (type === \"value\" && name === slugKey) {\n\t\t\tconst itemToSlug = dataDefinition?.itemToSlug\n\t\t\tif (itemToSlug) {\n\t\t\t\tconst slug = getFirstObjectValue(itemToSlug)\n\t\t\t\tif (slug) return slug\n\t\t\t}\n\t\t}\n\n\t\tconst prop = dataDefinition.properties[name]\n\t\tif (!prop?.title) return missingSlugFallback\n\n\t\treturn `:${slugifyPathVariable(prop.title)}`\n\t})\n}\n\n/** This function should do the same as convertIdPathVariablesToReadable but without relying on a dataDefinition */\nexport function convertSlugToReadable(\n\tpath: string,\n\titemToSlug: ItemToSlug,\n\tslugVariable: SlugVariableDefinition,\n\ttype: \"title\" | \"value\" = \"title\",\n) {\n\treturn path.replace(pathVariablesRegExpGlobal, (_variable, name) => {\n\t\tif (type === \"value\" && name === slugVariable.id) {\n\t\t\tconst slug = getFirstObjectValue(itemToSlug)\n\t\t\tif (slug) return slug\n\t\t}\n\n\t\treturn `:${slugifyPathVariable(slugVariable.name)}`\n\t})\n}\n\n/** Replaces the slug variable in the path with the readable title. */\nexport function convertSlugToReadableTitle(path: string, slugVariable: SlugVariableDefinition | undefined) {\n\treturn path.replace(pathVariablesRegExpGlobal, (_variable, _name) => {\n\t\tif (!slugVariable) return missingSlugFallback\n\t\treturn `:${slugifyPathVariable(slugVariable.name)}`\n\t})\n}\n", "import type { LocalModuleExportIdentifierString } from \"@framerjs/shared\"\nimport type { AnyWebPageNode, CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getContentManagementNode } from \"document/models/CanvasTree/nodes/ContentManagementNode.utils.ts\"\nimport type { ABTestingParentIdMap } from \"document/models/CanvasTree/nodes/RootNodeCache.ts\"\nimport { getRouteSegmentRootNode } from \"document/models/CanvasTree/nodes/RouteSegmentRootNode.utils.ts\"\nimport type { ReadonlyWebPagePathByWebPageId } from \"document/models/CanvasTree/nodes/RouteSegmentRootNodeCache.ts\"\nimport { isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { LocaleId } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport { defaultLocaleId } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport { fillPathVariables } from \"utils/pathVariables.ts\"\nimport { getPathForDisplay } from \"web/pages/projects/components/Domains/validation/validateRouteNode.ts\"\nimport { convertSlugToReadableTitle } from \"./convertIdPathVariablesToReadable.ts\"\n\nexport const FALLBACK_PATH = \"/unknown\"\n\nexport type PathLocalized = Record<LocaleId, string>\ntype PathNonLocalized = string\n\nexport type MaybePathLocalized = PathLocalized | undefined\nexport type MaybePathNonLocalized = PathNonLocalized | undefined\n\nfunction getRawWebPagePathFromCachedData(\n\twebPageId: NodeID,\n\twebPageIdToRawPathMap: ReadonlyWebPagePathByWebPageId,\n\tabTestingParentIdMap: ABTestingParentIdMap,\n): MaybePathNonLocalized {\n\tconst controlPageId = abTestingParentIdMap.get(webPageId) ?? webPageId\n\treturn webPageIdToRawPathMap.get(controlPageId)\n}\n\nfunction getRawPagePathForLocale(tree: CanvasTree, webPageId: NodeID, localeId: LocaleId): string | undefined {\n\tlet rawPagePathLocalized: string | undefined\n\tif (localeId !== defaultLocaleId) {\n\t\tconst webPageIdToRawPathLocalizedMap = getRouteSegmentRootNode(tree).getWebPageIdToRawPathLocalizedMap(tree)\n\t\trawPagePathLocalized = webPageIdToRawPathLocalizedMap.get(webPageId)?.[localeId]\n\t}\n\n\tif (rawPagePathLocalized) return rawPagePathLocalized\n\n\t// when locale is default, or non-default locale exist but path is not localized, we should fallback to default path\n\treturn getRouteSegmentRootNode(tree).getWebPageIdToRawPathMap(tree).get(webPageId)\n}\n\n/**\n * Returns a path for the given web page, replacing path variables if needed:\n *\n * - if you pass in path variables, it'll use those\n *   (e.g., `/blog/:kpPYRAjRC` \u2192 `/blog/hello-world`)\n * - otherwise, it'll replace path variable IDs with their human-readable titles\n *   (e.g., `/blog/:kpPYRAjRC` \u2192 `/blog/:title`)\n *\n * Parentheses are automatically unescaped for display (e.g., `hello-\\(world\\)` \u2192 `hello-(world)`).\n *\n * By default, returns undefined if we couldn't determine the correct page path.\n * In that case, if you absolutely need to show _something_, use the `FALLBACK_PATH`.\n * When passing `allowBlank = true`, returns incomplete URLs instead (e.g. `/blog/`).\n */\nexport function getWebPagePath(\n\ttree: CanvasTree,\n\twebPageNode: AnyWebPageNode,\n\tlocaleId: LocaleId = defaultLocaleId,\n\tpathVariables?: Record<string, string>,\n\tallowBlank?: boolean,\n) {\n\tconst abTestingParentIdMap = tree.root.getABTestingParentIdMap()\n\tconst dataIdentifierByWebPageIdMap = tree.root.getDataIdentifierByWebPageIdMap()\n\tconst slugVariableByIdentifierMap = getContentManagementNode(tree)?.loaded?.getSlugVariableByIdentifierMap()\n\n\t// The path of the A/B testing variant should match the one of the control page\n\tconst controlPageId = abTestingParentIdMap.get(webPageNode.id) ?? webPageNode.id\n\n\tconst rawPagePath = getRawPagePathForLocale(tree, controlPageId, localeId)\n\tif (!rawPagePath) return\n\n\t// resolving path variables\n\tconst dataIdentifier = dataIdentifierByWebPageIdMap.get(controlPageId)\n\tif (!dataIdentifier) return getPathForDisplay(rawPagePath)\n\n\tif (pathVariables) return getPathForDisplay(fillPathVariables(rawPagePath, pathVariables, allowBlank) ?? \"\")\n\n\tconst slugVariable = slugVariableByIdentifierMap?.get(dataIdentifier as LocalModuleExportIdentifierString)\n\treturn getPathForDisplay(convertSlugToReadableTitle(rawPagePath, slugVariable))\n}\n\n/**\n * Returns a path for the given web page without any conversions. (e.g.,\n * `/blog/:kpPYRAjRC` will stay as-is)\n *\n * Returns undefined if we couldn't determine the correct page path. If you\n * absolutely need to show _something_, use the `FALLBACK_PATH`.\n */\nexport function getRawWebPagePath(\n\ttree: CanvasTree,\n\twebPageNode: AnyWebPageNode | null | undefined,\n): MaybePathNonLocalized {\n\tif (!webPageNode) return\n\n\tconst webPageIdToRawPathMap = getRouteSegmentRootNode(tree).getWebPageIdToRawPathMap(tree)\n\tconst abTestingParentIdMap = tree.root.getABTestingParentIdMap()\n\n\treturn getRawWebPagePathFromCachedData(webPageNode.id, webPageIdToRawPathMap, abTestingParentIdMap)\n}\n\nexport function getRawWebPagePathLocalized(\n\ttree: CanvasTree,\n\twebPageNode: AnyWebPageNode | null | undefined,\n): MaybePathLocalized {\n\tif (!webPageNode) return\n\n\t// The path of the A/B testing variant should match the one of the control page\n\tconst controlPageNode = tree.getNodeWithTrait(webPageNode.abTestingParentId, isWebPageNode) ?? webPageNode\n\n\treturn getRouteSegmentRootNode(tree).getRawWebPagePathLocalizedByWebPageId(tree, controlPageNode.id)\n}\n", "import { isString } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../index.ts\"\n\n/**\n * This Trait does have an effect on the nodes rendered in the canvas. Its\n * purpose is to give TextNodes - TextStyleDrafts custom HTML tags for\n * accessibility, and SEO during code generation for published sites. Currently\n * using DraftJS but to be replace with our upcoming new editor.\n */\nexport interface WithHTMLTextTag {\n\treadonly htmlTextTag?: HTMLTextTag\n}\n\n/** Unfortunately we have to use a `span` instead of a `div` to provide valid\n semantic markup in legacy `TextNodes` using **DraftJS** */\nexport const htmlTextTags = [\"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\", \"p\", \"span\"] as const\ntype HTMLTextTags = typeof htmlTextTags\nexport type HTMLTextTag = HTMLTextTags[number]\n\nexport const htmlTextTagDefaults: WithHTMLTextTag = {\n\thtmlTextTag: undefined,\n}\n\nexport const defaultHTMLTextTag = \"span\"\n\nexport const htmlTextTagEnabledDefaults: WithHTMLTextTag = {\n\thtmlTextTag: defaultHTMLTextTag,\n}\n\nconst key: keyof WithHTMLTextTag = \"htmlTextTag\"\n\nexport function withHTMLTextTag<T extends CanvasNode>(node: T): node is T & WithHTMLTextTag {\n\treturn key in node\n}\n\nexport function isHTMLTextTag(value: unknown): value is HTMLTextTag {\n\treturn isString(value) && htmlTextTags.includes(value as HTMLTextTag)\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { DynamicValue } from \"./DynamicValue.ts\"\n\nexport interface WithPadding {\n\tpadding: number | DynamicValue | undefined\n\tpaddingPerSide: boolean | undefined\n\tpaddingTop: number | undefined\n\tpaddingRight: number | undefined\n\tpaddingBottom: number | undefined\n\tpaddingLeft: number | undefined\n}\n\nexport const paddingDefaults: WithPadding = {\n\tpadding: undefined,\n\tpaddingPerSide: undefined,\n\tpaddingTop: undefined,\n\tpaddingRight: undefined,\n\tpaddingBottom: undefined,\n\tpaddingLeft: undefined,\n}\n\nexport const paddingDefinedDefaults = {\n\tpadding: 0,\n\tpaddingPerSide: false,\n\tpaddingTop: 0,\n\tpaddingRight: 0,\n\tpaddingBottom: 0,\n\tpaddingLeft: 0,\n} as const satisfies WithPadding\n\nconst key: keyof WithPadding = \"padding\"\n\nexport function withPadding<T extends CanvasNode>(node: T): node is T & WithPadding {\n\treturn key in node\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { getKeys } from \"utils/getKeys.ts\"\nimport type { ReducedRecord } from \"./utils/Reduced.ts\"\nimport { NotFound } from \"./utils/Reduced.ts\"\nimport { reduceProperty } from \"./utils/reduceProperty.ts\"\n\nexport interface WithRadiusPerCorner {\n\tradiusPerCorner: boolean\n\tradiusTopLeft: number\n\tradiusTopRight: number\n\tradiusBottomLeft: number\n\tradiusBottomRight: number\n}\n\nconst radiusDefaults: Pick<\n\tWithRadiusPerCorner,\n\t\"radiusTopLeft\" | \"radiusTopRight\" | \"radiusBottomLeft\" | \"radiusBottomRight\"\n> = {\n\tradiusTopLeft: 0,\n\tradiusTopRight: 0,\n\tradiusBottomRight: 0,\n\tradiusBottomLeft: 0,\n}\n\nexport const radiusPerCornerDefaults: WithRadiusPerCorner = {\n\tradiusPerCorner: false,\n\t...radiusDefaults,\n}\n\nexport const radiusPerCornerKeys = getKeys(radiusDefaults) as [string, string, string, string]\n\nconst key: keyof WithRadiusPerCorner = \"radiusPerCorner\"\n\nexport function withRadiusPerCorner(node: CanvasNode): node is CanvasNode & WithRadiusPerCorner {\n\treturn key in node\n}\n\nexport type ReducedRadiusPerCorner = ReducedRecord<WithRadiusPerCorner>\n\nexport function getReducedRadiusPerCornerDefaults(): ReducedRadiusPerCorner {\n\treturn {\n\t\tradiusPerCorner: NotFound,\n\t\tradiusTopLeft: NotFound,\n\t\tradiusTopRight: NotFound,\n\t\tradiusBottomLeft: NotFound,\n\t\tradiusBottomRight: NotFound,\n\t}\n}\n\nexport function reduceRadiusPerCorner(node: CanvasNode, result: ReducedRadiusPerCorner) {\n\tif (!withRadiusPerCorner(node)) return\n\n\treduceProperty(\"radiusPerCorner\", result, node)\n\treduceProperty(\"radiusTopLeft\", result, node)\n\treduceProperty(\"radiusTopRight\", result, node)\n\treduceProperty(\"radiusBottomLeft\", result, node)\n\treduceProperty(\"radiusBottomRight\", result, node)\n}\n", "import { getLogger } from \"@framerjs/shared\"\nimport { isArray, isNull, isNumber, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { SerializableRecord, SerializableValue } from \"./SerializableValue.ts\"\n\nconst log = getLogger(\"serializeJS\")\n\nexport interface ObjectSerializationConfig {\n\tserializeSpread(spread: SafeJS): string\n\tserializeKeyValue(key: string, value: unknown, subRefs: Set<unknown>): string | undefined\n\tjoinObject(pieces: string[]): string\n}\n\nconst plainJSConfig: ObjectSerializationConfig = {\n\tserializeSpread(spread: SafeJS) {\n\t\treturn `...${spread}`\n\t},\n\tserializeKeyValue(key: string, value: unknown, subRefs: Set<unknown>) {\n\t\tconst stringValue = serializeJS(value, subRefs)\n\t\t// Skip non-serializable values (serializeJS returned undefined)\n\t\tif (isUndefined(stringValue)) return\n\t\tlet safeKey = key\n\t\tif (!/^[a-z$_][\\w$]*$/i.test(safeKey)) {\n\t\t\t// Only stringify keys that are not valid without quotes.\n\t\t\tsafeKey = JSON.stringify(safeKey)\n\t\t} else if (safeKey === stringValue) {\n\t\t\t// `{ xyz: xyz }` becomes just the shorthand, `{ xyz }`.\n\t\t\treturn stringValue\n\t\t}\n\n\t\treturn `${safeKey}: ${stringValue}`\n\t},\n\tjoinObject(pieces: string[]) {\n\t\treturn `{${pieces.join(\", \")}}`\n\t},\n}\n\n// Creating a compare function ahead of time is a performance recommendation\n// when sorting lists:\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare#performance\nconst compare = new Intl.Collator(\"en\", { sensitivity: \"base\" }).compare\n\nexport function serializeObject(config: ObjectSerializationConfig, value: object, refs: Set<unknown>): string {\n\tconst subRefs = checkCircularReference(refs, value)\n\tconst pieces: string[] = []\n\tfor (const [k, v] of Object.entries(value as Record<string, unknown>)) {\n\t\tconst piece = config.serializeKeyValue(k, v, subRefs)\n\t\tif (piece) {\n\t\t\tpieces.push(piece)\n\t\t}\n\t}\n\n\tif (value instanceof SerializableObject) {\n\t\tif (SerializableObject.isSorted(value)) pieces.sort(compare)\n\t\tpieces.unshift(...SerializableObject.spreadsAtStart(value).map(config.serializeSpread))\n\t\tpieces.push(...SerializableObject.spreadsAtEnd(value).map(config.serializeSpread))\n\t} else {\n\t\tpieces.sort(compare)\n\t}\n\treturn config.joinObject(pieces)\n}\n\n/**\n * Serializes a JavaScript object into a string that can be evaluated as\n * JavaScript. Unlike `JSON.stringify`, this function allows injecting arbitrary\n * JavaScript by using the `SafeJS` class (an extension of `String`).\n */\nexport function serializeJS(value: SerializableValue): string\nexport function serializeJS(value: unknown[]): string\nexport function serializeJS(value: unknown): string | undefined\nexport function serializeJS(value: unknown, refs: Set<unknown>): string | undefined\nexport function serializeJS(value: unknown, refs = new Set<unknown>()): string | undefined {\n\t// TODO: This could be a linear string serializer instead of a recursive function.\n\tif (value instanceof SafeJS) {\n\t\treturn String(value)\n\t} else if (isString(value) || typeof value === \"number\" || typeof value === \"boolean\" || isNull(value)) {\n\t\t// Replace characters that JavaScript used to consider newlines to avoid\n\t\t// tools breaking because of it.\n\t\t// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#issue_with_plain_json.stringify_for_use_as_javascript\n\t\treturn JSON.stringify(value).replace(/[\\u2028\\u2029]/gu, m => `\\\\u${m.charCodeAt(0).toString(16)}`)\n\t} else if (isArray(value)) {\n\t\tconst subRefs = checkCircularReference(refs, value)\n\t\tconst pieces: string[] = []\n\t\tfor (const v of value) {\n\t\t\tconst stringValue = serializeJS(v, subRefs)\n\t\t\tif (isUndefined(stringValue)) continue\n\t\t\tpieces.push(stringValue)\n\t\t}\n\t\treturn `[${pieces.join(\", \")}]`\n\t} else if (typeof value === \"object\") {\n\t\treturn serializeObject(plainJSConfig, value, refs)\n\t}\n\t// Unsupported type, return undefined.\n}\n\nfunction checkCircularReference(refs: Set<unknown>, value: unknown): Set<unknown> {\n\tif (refs.has(value)) {\n\t\tlog.error(\"Encountered circular reference to object while serializing:\", value)\n\t\tthrow Error(\"Circular Reference\")\n\t}\n\tconst subRefs = new Set(refs)\n\tsubRefs.add(value)\n\treturn subRefs\n}\n\nexport class SafeJS extends String {\n\tstatic fn(name: SafeJS, ...args: (SerializableValue | undefined)[]): SafeJS {\n\t\tconst fnArgs: string[] = []\n\t\tfor (const arg of args) {\n\t\t\t// Skip falsy args, excluding 0, or empty string. Functions that\n\t\t\t// require null or undefined should use js`null` etc instead.\n\t\t\tif (arg || (isNumber(arg) && arg === 0) || (isString(arg) && arg === \"\")) fnArgs.push(serializeJS(arg))\n\t\t}\n\t\treturn new SafeJS(`${name}(${fnArgs.join(\", \")})`)\n\t}\n\n\tstatic optionalFn(name: SafeJS, ...args: SerializableValue[]): SafeJS {\n\t\treturn new SafeJS(`${name}?.(${args.map(value => serializeJS(value)).join(\", \")})`)\n\t}\n\n\tstatic fromValue(value: unknown): SafeJS {\n\t\treturn new SafeJS(serializeJS(value))\n\t}\n\n\t/** Returns JS that converts a module-relative URL to an absolute one. */\n\tstatic absoluteURL(href: SafeJS | string): SafeJS {\n\t\tif (href.match(/^https?:/u)) {\n\t\t\t// It's an absolute URL and won't need to be resolved with a URL object.\n\t\t\treturn new SafeJS(serializeJS(href))\n\t\t}\n\t\treturn new SafeJS(`new URL(${serializeJS(href)}, import.meta.url).href`)\n\t}\n\n\tstatic hasMarker(instance: SafeJS, marker: symbol) {\n\t\treturn instance.#marker === marker\n\t}\n\n\tstatic withMarker(marker: symbol, safeJS: string) {\n\t\tconst instance = new SafeJS(safeJS)\n\t\tinstance.#marker = marker\n\t\treturn instance\n\t}\n\n\tstatic isUndefined(value: unknown) {\n\t\treturn value instanceof SafeJS && serializeJS(value) === \"undefined\"\n\t}\n\n\tstatic isTrue(value: unknown) {\n\t\treturn value instanceof SafeJS && serializeJS(value) === \"true\"\n\t}\n\n\t// This ensures that this instance cannot be considered equal to raw strings.\n\t#marker = Symbol(\"Safe JS\")\n}\n\nexport namespace SafeJS {\n\texport class Set implements Iterable<SafeJS> {\n\t\t#values = new globalThis.Set<string>()\n\n\t\tconstructor(values?: Iterable<SafeJS>) {\n\t\t\tif (values) {\n\t\t\t\tfor (const value of values) {\n\t\t\t\t\tthis.add(value)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t*[Symbol.iterator]() {\n\t\t\tfor (const value of this.#values) {\n\t\t\t\tyield new SafeJS(value)\n\t\t\t}\n\t\t}\n\n\t\tget size() {\n\t\t\treturn this.#values.size\n\t\t}\n\n\t\tadd(value: SafeJS) {\n\t\t\tthis.#values.add(String(value))\n\t\t}\n\n\t\tdelete(value: SafeJS) {\n\t\t\tthis.#values.delete(String(value))\n\t\t}\n\n\t\thas(value: SafeJS): boolean {\n\t\t\treturn this.#values.has(String(value))\n\t\t}\n\n\t\tvalues() {\n\t\t\treturn this.#values.values()\n\t\t}\n\t}\n}\n\nexport function isSafeJS(value: unknown): value is SafeJS {\n\treturn value instanceof SafeJS\n}\n\nexport interface SerializableObject extends Object, SerializableRecord {}\n\nexport enum SortBehavior {\n\tSorted,\n\tUnsorted,\n}\n\n/**\n * This object can be used instead of a regular object to add a variable spread\n * to the serialized version of that object.\n *\n * The interface above restricts the type of the object to only contain\n * SerializableValue's or undefined. Literal undefined values in an object are\n * serializable, but they will be omitted by serializeJS.\n */\n// biome-ignore lint/suspicious/noUnsafeDeclarationMerging: intentional\nexport class SerializableObject extends Object {\n\t#sortBehavior: SortBehavior\n\n\tconstructor(\n\t\tinitial?: Record<string, SerializableValue | undefined>,\n\t\t/**\n\t\t * We sort object keys alphabetically when serializing. However, there may\n\t\t * be cases where the order of keys is important to maintain. In these cases\n\t\t * you can lock the order of an object to prevent its keys from being\n\t\t * sorted.\n\t\t */\n\t\tsortBehavior: SortBehavior = SortBehavior.Sorted,\n\t) {\n\t\tsuper()\n\t\tif (!isUndefined(initial)) SerializableObject.assign(this, initial)\n\t\tthis.#sortBehavior = sortBehavior\n\t}\n\n\t#spreadsAtEnd: SafeJS[] = []\n\tstatic spreadsAtEnd(object: SerializableObject) {\n\t\treturn object.#spreadsAtEnd\n\t}\n\n\t#spreadsAtStart: SafeJS[] = []\n\tstatic spreadsAtStart(object: SerializableObject) {\n\t\treturn object.#spreadsAtStart\n\t}\n\n\tstatic hasSpreads(object: SerializableObject) {\n\t\treturn object.#spreadsAtEnd.length > 0 || object.#spreadsAtStart.length > 0\n\t}\n\n\tstatic addSpreadAtEnd(object: SerializableObject, field: SafeJS) {\n\t\tobject.#spreadsAtEnd.push(field)\n\t}\n\n\tstatic addSpreadAtStart(object: SerializableObject, field: SafeJS) {\n\t\tobject.#spreadsAtStart.push(field)\n\t}\n\n\tstatic isSorted(object: SerializableObject) {\n\t\treturn object.#sortBehavior === SortBehavior.Sorted\n\t}\n\n\tstatic override assign(\n\t\ttarget: SerializableObject,\n\t\tobject: SerializableObject | Record<string, unknown> | undefined,\n\t): SerializableObject {\n\t\tif (object instanceof SerializableObject) {\n\t\t\ttarget.#spreadsAtEnd.push(...object.#spreadsAtEnd)\n\t\t\ttarget.#spreadsAtStart.push(...object.#spreadsAtStart)\n\t\t}\n\t\treturn Object.assign(target, object)\n\t}\n\n\tstatic override fromEntries(\n\t\tentries: Iterable<readonly [SafeJS | string | symbol | number, SerializableValue | undefined]>,\n\t) {\n\t\tconst initial: Record<string | symbol | number, SerializableValue | undefined> = {}\n\t\tfor (const [serializableKey, serializableValue] of entries) {\n\t\t\tconst key = serializableKey instanceof SafeJS ? serializeJS(serializableKey) : serializableKey\n\t\t\tinitial[key] = serializableValue\n\t\t}\n\n\t\treturn new SerializableObject(initial)\n\t}\n}\n\nexport function isSerializableObject(value: unknown): value is SerializableObject {\n\treturn value instanceof SerializableObject\n}\n", "import { SafeJS, serializeJS } from \"code-generation/js/serializeJS.ts\"\n\ntype Value = SafeJS | string | false | undefined | 0\n\n/**\n * Joins values from the iterable, skipping falsy values for ease of use when\n * generating large strings with conditional values.\n */\nexport function join(values: Iterable<Value>, separator = \"\") {\n\tlet result: string = \"\"\n\tfor (const value of values) {\n\t\tif (!value) continue\n\t\tif (result) result += separator\n\t\tresult += value instanceof SafeJS ? serializeJS(value) : value\n\t}\n\treturn result\n}\n\nexport namespace join {\n\texport function list(...values: Value[]) {\n\t\treturn join(values, \", \")\n\t}\n\n\texport function listFrom(values: Iterable<Value>) {\n\t\treturn join(values, \", \")\n\t}\n\n\t/** Joins arguments by a single newline, skipping falsy values. */\n\texport function lines(...values: Value[]) {\n\t\treturn join(values, \"\\n\")\n\t}\n\n\t/** Joins values from the iterable by a newline, skipping falsy values. */\n\texport function linesFrom(values: Iterable<Value>) {\n\t\treturn join(values, \"\\n\")\n\t}\n\n\t/** Joins arguments by two newlines, skipping falsy values. */\n\texport function sections(...values: Value[]) {\n\t\treturn join(values, \"\\n\\n\")\n\t}\n\n\t/** Joins values from the iterable by two newlines, skipping falsy values. */\n\texport function sectionsFrom(values: Iterable<Value>) {\n\t\treturn join(values, \"\\n\\n\")\n\t}\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { join } from \"utils/join.ts\"\nimport { isBoolean, isNull, isNumber, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { SerializableValue } from \"./SerializableValue.ts\"\nimport type { ObjectSerializationConfig, SerializableObject } from \"./serializeJS.ts\"\nimport { SafeJS, isSafeJS, serializeJS, serializeObject } from \"./serializeJS.ts\"\n\nexport function js(strings: readonly string[], ...values: readonly SerializableValue[]): SafeJS {\n\tconst result = [strings[0]]\n\tvalues.forEach((value, i) => {\n\t\tresult.push(serializeJS(value), strings[i + 1])\n\t})\n\treturn new SafeJS(result.join(\"\"))\n}\n\nexport namespace js {\n\ttype Value = SafeJS | false | undefined | 0\n\n\t/**\n\t * Joins SafeJS values from the arguments into lines, skipping falsy values\n\t * for ease of use when generating large strings with conditional values.\n\t */\n\texport function joinLines(...values: Value[]) {\n\t\treturn new SafeJS(join(values, \"\\n\"))\n\t}\n\n\t/**\n\t * Joins SafeJS values from the iterable into sections separated by two\n\t * newlines, skipping falsy values for ease of use when generating large\n\t * strings with conditional values.\n\t */\n\texport function joinSections(...values: Value[]) {\n\t\treturn new SafeJS(join(values, \"\\n\\n\"))\n\t}\n\n\t/**\n\t * Joins SafeJS values from the iterable into lines, skipping falsy values\n\t * for ease of use when generating large strings with conditional values.\n\t */\n\texport function linesFrom(values: Iterable<Value>) {\n\t\treturn new SafeJS(join(values, \"\\n\"))\n\t}\n\n\t/**\n\t * Joins SafeJS values from the iterable into a comma-separated list,\n\t * skipping falsy values for ease of use when generating large strings with\n\t * conditional values.\n\t */\n\texport function listFrom(values: Iterable<Value>) {\n\t\treturn new SafeJS(join(values, \", \"))\n\t}\n}\n\nconst jstMarker = Symbol(\"jst template literal\")\n\n/**\n * Construct a JavaScript template literal snippet. Strings will be inlined\n * while all other values will become variable placeholders.\n */\nexport function jst(strings: readonly string[], ...values: readonly SerializableValue[]): SafeJS | string {\n\t// If the resulting template string is completely static (we know exactly\n\t// what it will look like), just return a basic string instead because this\n\t// will make generated code a lot cleaner. We don't include objects and\n\t// arrays here as they can contain nested SafeJS values and we don't want to\n\t// have to analyze them.\n\tif (values.every(v => isString(v) || isNumber(v) || isBoolean(v) || isNull(v))) {\n\t\tconst result = [strings[0]]\n\t\tvalues.forEach((value, i) => {\n\t\t\tresult.push(String(value), strings[i + 1])\n\t\t})\n\t\treturn result.join(\"\")\n\t}\n\n\tconst result = [\"`\", escapeStringForTemplateLiteral(strings[0])]\n\tvalues.forEach((value, i) => {\n\t\tif (isString(value)) {\n\t\t\tresult.push(escapeStringForTemplateLiteral(value))\n\t\t} else if (typeof value === \"number\" || typeof value === \"boolean\" || isNull(value)) {\n\t\t\tresult.push(String(value))\n\t\t} else {\n\t\t\tif (value instanceof SafeJS && SafeJS.hasMarker(value, jstMarker)) {\n\t\t\t\t// Other template literals can be directly embedded into this one.\n\t\t\t\tresult.push(value.substring(1, value.length - 1))\n\t\t\t} else {\n\t\t\t\tresult.push(\"${\", serializeJS(value), \"}\")\n\t\t\t}\n\t\t}\n\t\tresult.push(escapeStringForTemplateLiteral(strings[i + 1]))\n\t})\n\tresult.push(\"`\")\n\treturn SafeJS.withMarker(jstMarker, result.join(\"\"))\n}\n\nexport namespace jst {\n\texport function join(values: SerializableValue[], separator: SerializableValue): SafeJS | string {\n\t\t// TODO: This code can be optimized to append all parts into an array\n\t\t// and concatenating everything at the end.\n\t\tlet value = jst`${values[0]!}`\n\t\tfor (let i = 1; i < values.length; i++) {\n\t\t\tvalue = jst`${value}${separator}${values[i]!}`\n\t\t}\n\t\treturn value\n\t}\n\n\texport function replaceAll(input: string, searchValue: RegExp, replaceValue: SerializableValue): SafeJS | string\n\texport function replaceAll(\n\t\tinput: string,\n\t\tsearchValue: RegExp,\n\t\treplacer: (substring: string, ...args: string[]) => SerializableValue,\n\t): SafeJS | string\n\texport function replaceAll(\n\t\tinput: string,\n\t\tsearchValue: RegExp,\n\t\treplaceValueOrFunction: SerializableValue | ((substring: string, ...args: string[]) => SerializableValue),\n\t): SafeJS | string {\n\t\tconst strings: string[] = []\n\t\tconst values: SerializableValue[] = []\n\t\tlet lastIndex = 0\n\t\t// TODO: Consider changing from matchAll to something that supports a\n\t\t// string searchValue as well.\n\t\tfor (const match of input.matchAll(searchValue)) {\n\t\t\tassert(typeof match.index === \"number\", \"unexpected non-number in match\")\n\t\t\tstrings.push(input.substring(lastIndex, match.index))\n\t\t\tvalues.push(\n\t\t\t\ttypeof replaceValueOrFunction === \"function\"\n\t\t\t\t\t? replaceValueOrFunction(match[0], ...match.slice(1))\n\t\t\t\t\t: replaceValueOrFunction,\n\t\t\t)\n\t\t\tlastIndex = match.index + match[0].length\n\t\t}\n\t\tstrings.push(input.substring(lastIndex))\n\t\treturn jst(strings, ...values)\n\t}\n}\n\nexport type TagTransform = (jsx: SafeJS) => SafeJS\n\nconst upperCaseRegex = /(?<char>[A-Z])/gu\nfunction kebabCase(value: string) {\n\treturn value.replace(upperCaseRegex, \"-$<char>\").toLowerCase()\n}\n\nconst camelCaseKeys = new Set([\"viewBox\", \"stdDeviation\"])\n\nconst svgAttributeConfig: ObjectSerializationConfig = {\n\tserializeSpread(spread: SafeJS) {\n\t\treturn `{...${spread}}`\n\t},\n\tserializeKeyValue(key: string, value: unknown, subRefs: Set<unknown>) {\n\t\tif (isUndefined(value) || SafeJS.isUndefined(value)) return\n\t\tconst svgKey = camelCaseKeys.has(key) ? key : kebabCase(key)\n\t\tif (value === true || SafeJS.isTrue(value)) return svgKey\n\t\tif (isNumber(value)) return `${svgKey}=\"${value}\"`\n\n\t\tconst stringValue = serializeJS(value, subRefs)\n\t\tif (stringValue === \"\") return\n\t\treturn `${svgKey}=${stringValue}`\n\t},\n\tjoinObject(pieces: string[]) {\n\t\treturn pieces.join(\" \")\n\t},\n}\n\nfunction safeSVGAttributes(props: SerializableObject | undefined) {\n\treturn props ? new SafeJS(\" \" + serializeObject(svgAttributeConfig, props, new Set())) : js``\n}\n\nconst svgMarker = Symbol(\"svg tag\")\n\nexport function svg(strings: readonly string[], ...values: readonly SerializableValue[]): SafeJS {\n\tconst result = [strings[0]]\n\tvalues.forEach((value, i) => {\n\t\tresult.push(serializeJS(value), strings[i + 1])\n\t})\n\treturn SafeJS.withMarker(svgMarker, result.join(\"\"))\n}\n\nexport namespace svg {\n\texport function tag(\n\t\tname: keyof SVGElementTagNameMap | \"svg\",\n\t\tprops: SerializableObject | undefined,\n\t\tsvgChildren?: SafeJS,\n\t): SafeJS {\n\t\treturn svgChildren && serializeJS(svgChildren)\n\t\t\t? svg`<${new SafeJS(name)}${safeSVGAttributes(props)}>${svg.children(svgChildren)}</${new SafeJS(name)}>`\n\t\t\t: svg`<${new SafeJS(name)}${safeSVGAttributes(props)}/>`\n\t}\n\n\texport function applyTransforms(svgTag: SafeJS, transforms: (TagTransform | undefined)[]): SafeJS {\n\t\tfor (const t of transforms) svgTag = t?.(svgTag) ?? svgTag\n\t\treturn svgTag\n\t}\n\n\texport function fromTrustedString(value: string) {\n\t\treturn SafeJS.withMarker(svgMarker, value)\n\t}\n\n\texport function children(value: SafeJS) {\n\t\tassert(SafeJS.hasMarker(value, svgMarker), \"SVG children can only be svg\")\n\t\treturn value\n\t}\n}\n\nexport const jsxAttributeConfig: ObjectSerializationConfig = {\n\tserializeSpread(spread: SafeJS) {\n\t\treturn `{...${spread}}`\n\t},\n\tserializeKeyValue(key: string, value: unknown, subRefs: Set<unknown>) {\n\t\tif (isUndefined(value) || SafeJS.isUndefined(value)) return\n\t\tif (value === true || SafeJS.isTrue(value)) return key\n\n\t\tconst stringValue = serializeJS(value, subRefs)\n\t\tif (stringValue === \"\") return\n\t\treturn `${key}={${stringValue}}`\n\t},\n\tjoinObject(pieces: string[]) {\n\t\treturn pieces.join(\" \")\n\t},\n}\n\nfunction safeJSXAttributes(props: SerializableObject | undefined) {\n\treturn props ? new SafeJS(\" \" + serializeObject(jsxAttributeConfig, props, new Set())) : js``\n}\n\nconst jsxMarker = Symbol(\"jsx tag\")\n\nexport function jsx(strings: readonly string[], ...values: readonly SerializableValue[]): SafeJS {\n\tconst result = [strings[0]]\n\tvalues.forEach((value, i) => {\n\t\tresult.push(serializeJS(value), strings[i + 1])\n\t})\n\treturn SafeJS.withMarker(jsxMarker, result.join(\"\"))\n}\n\nexport namespace jsx {\n\texport function children(value: SafeJS) {\n\t\treturn SafeJS.hasMarker(value, jsxMarker) ? value : jsx`{${value}}`\n\t}\n\n\texport function fromTrustedString(value: string) {\n\t\treturn SafeJS.withMarker(jsxMarker, value)\n\t}\n\n\texport function tag(name: SafeJS | string, props: SerializableObject | undefined, jsxChildren?: SafeJS): SafeJS {\n\t\t// A JSX Tag is always <tag>, never <\"tag\">.\n\t\tname = isSafeJS(name) ? name : new SafeJS(name)\n\t\t// Ensure `children` does not serialize to an empty string so that we\n\t\t// can avoid unnecessary closing tags.\n\t\treturn jsxChildren && serializeJS(jsxChildren)\n\t\t\t? jsx`<${name}${safeJSXAttributes(props)}>${jsx.children(jsxChildren)}</${name}>`\n\t\t\t: jsx`<${name}${safeJSXAttributes(props)}/>`\n\t}\n\n\texport function applyTransforms(jsxTag: SafeJS, transforms: (TagTransform | undefined)[]): SafeJS {\n\t\tfor (const t of transforms) jsxTag = t?.(jsxTag) ?? jsxTag\n\t\treturn jsxTag\n\t}\n}\n\nfunction escapeStringForTemplateLiteral(value: string | undefined): string {\n\tif (!value) return \"\"\n\t// Examples of what we need to escape: https://regex101.com/r/7zpat3/1\n\treturn value.replace(/[`\\\\]|\\$(?=\\{)/gu, \"\\\\$&\")\n}\n", "import { isNumber } from \"@framerjs/assets/src/utils.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { DynamicValue } from \"./DynamicValue.ts\"\nimport { isVariant } from \"./WithVariant.ts\"\n\nexport const minZIndex = -1\nexport const maxZIndex = 10\nexport const floatingZIndex = maxZIndex + 1\n\n/**\n * Stacking context brought by the `WithZIndex` trait should only be\n * applicable in the scope of a published site.\n */\nexport interface WithZIndex {\n\tzIndex: number | DynamicValue | undefined\n}\n\nexport const zIndexDefaults: WithZIndex = {\n\tzIndex: undefined,\n}\n\nconst key: keyof WithZIndex = \"zIndex\"\n\nexport function withZIndex<T extends CanvasNode>(node: T): node is T & WithZIndex {\n\treturn key in node\n}\n\nexport function hasZIndex<T extends CanvasNode>(node: T): node is T & WithZIndex & { readonly zIndex: number } {\n\treturn !isVariant(node) && withZIndex(node) && isNumber(node.zIndex)\n}\n\nexport function getDefaultZIndex(isStickyFixedOrAbsolute: boolean, isFloating: boolean): number {\n\tif (isFloating) return floatingZIndex\n\treturn isStickyFixedOrAbsolute ? 1 : 0\n}\n\nexport function isValidZIndex(\n\tzIndex: number | DynamicValue | undefined,\n\tisSticky: boolean,\n\tisFloating: boolean,\n): boolean {\n\tif (!isNumber(zIndex)) return true\n\tif (!Number.isInteger(zIndex)) return false\n\n\tconst min = isSticky ? 1 : minZIndex\n\tconst max = isFloating ? floatingZIndex : maxZIndex\n\treturn zIndex >= min && zIndex <= max\n}\n", "import type { AnyCollection } from \"library/modules/cms/types.ts\"\nimport { isLegacyCollection, isLegacyLocalizedCollection } from \"library/modules/cms/types.ts\"\nimport type { ActionControlDescription } from \"library/render/types/Action.ts\"\nimport type {\n\tArrayControlDescription,\n\tArrayItemControlDescription,\n\tControlDescription,\n\tControlType,\n\tFileControlDescription,\n\tImageControlDescription,\n\tObjectControlDescription,\n\tObjectPropertyControlDescription,\n\tResponsiveImageControlDescription,\n} from \"library/render/types/PropertyControls.ts\"\nimport { type RelativeNumber, isRelativeNumber } from \"library/render/types/RelativeNumber.ts\"\nimport type { Locale } from \"library/router/types.ts\"\nimport type { ComponentType as ReactComponentType } from \"react\"\nimport type { Annotations, ItemToSlug } from \"../../crossorigin/index.ts\"\nimport { AnnotationKey, hasAnnotation } from \"../../crossorigin/index.ts\"\nimport type {\n\tEntityDefinition,\n\tEntityIdentifier,\n\tEntityType,\n\tOverrideType,\n\tPackageInfo,\n} from \"../../host/componentLoader/types.ts\"\nimport { isObject, isString, isUndefined } from \"../../utils/typeChecks.ts\"\n\n// Sandbox types are mostly mirroring their Host counterparts,\n// but also include some fields that are not serializable and cannot\n// be sent between Sandbox iframe and Host window\n\n// biome-ignore lint/complexity/noBannedTypes: legacy\ntype Override = {}\n\n// biome-ignore lint/suspicious/noExplicitAny: legacy\nexport type SandboxEntityDefinition<P = any> = OverrideType<\n\tEntityDefinition,\n\t{\n\t\tclass: ReactComponentType<P> | JSON | Override\n\t\tproperties: VerifiedPropertyControls | VerifiedActionControls\n\t}\n>\n\nexport interface SandboxEntityMap {\n\t[name: string]: SandboxEntityDefinition\n}\n\nexport interface SandboxEntityIdsByPackageIdMap {\n\t[packageIdentifier: string]: EntityIdentifier[]\n}\n\n/**\n * EntityInfo is generated by analyzer.ts in build-library\n * and injected into the bundle as exported `__info__` variable in every code file\n */\nexport interface EntityInfo {\n\t/**\n\t * only used/needed for modules, used to store the\n\t * exportSpecifier instead of its name for default exports\n\t */\n\texportSpecifier?: string\n\t/**\n\t * for module components, the extracted name of the export\n\t * */\n\tname: string\n\t/**\n\t * Indicates whether the component uses `children` prop\n\t */\n\tchildren: boolean | undefined\n\ttype: EntityType | undefined\n\t/**\n\t * Map of Framer metadata annotations extracted from JSDoc, e.g:\n\t * ```js\n\t * { \"framerVersion\": \"42\", \"framerVariables\": \"{}\", \"framerPreviewPlugin\": \"\" }\n\t * ```\n\t * NOTE! It might only be present for the module-backed React components.\n\t * MODULES-TODO: Remove this field when we switch to a fully static metadata extraction\n\t *               (one that doesn't require evaluating the module in a sandbox).\n\t */\n\tannotations?: Annotations | null\n}\n\nexport interface LazyMap<T> {\n\t[key: string]: () => T\n}\n\nexport interface SourceModuleExports {\n\t__info__?: EntityInfo[]\n\terror?: { message: string } | string\n}\n\ninterface FramerMetadata {\n\tpackageJson: {\n\t\tname?: string // Can be undefined for the local package.\n\t\tframer?: {\n\t\t\tcomponents?: EntityInfo[]\n\t\t\tdisplayName?: string\n\t\t}\n\t\t// biome-ignore lint/suspicious/noExplicitAny: @TODO add explanation\n\t\tdesign?: any\n\t}\n\tdependencies?: LazyMap<FramerModuleExports>\n\tsourceModules?: LazyMap<SourceModuleExports>\n}\n\nexport interface FramerModuleExports {\n\t__framer__?: FramerMetadata\n}\n\nexport interface FramerIndexModule {\n\texports: FramerModuleExports\n}\n\nexport interface SandboxPackageInfo extends PackageInfo {\n\t/** The object exported from the index module of this package. */\n\texportsObject: FramerModuleExports\n\n\t/**\n\t * Map of functions that will import the associated package when called.\n\t * Key is the name of another package that is a dependency of this package.\n\t */\n\tdependencies: LazyMap<FramerModuleExports>\n\t/**\n\t * Map of functions that will import the associated module when called.\n\t * Key is a filename relative to the \"code\" directory of the package.\n\t */\n\tsourceModules: LazyMap<SourceModuleExports>\n}\n\nexport interface SandboxPackageMap {\n\t[name: string]: SandboxPackageInfo\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: @TODO add explanation\nexport interface SandboxReactComponentDefinition<P = any> extends SandboxEntityDefinition<P> {\n\ttype: \"component\"\n\tclass: ReactComponentType<P>\n\tproperties: VerifiedPropertyControls\n\t/** @deprecated default props are now handled by verifyPropertyControls. */\n\tdefaultProps: Partial<P> | undefined\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: @TODO add explanation\nexport interface SandboxRenderableComponentDefinition<P = any> extends SandboxEntityDefinition<P> {\n\ttype: \"component\" | \"screen\" | \"responsiveScreen\"\n\tclass: ReactComponentType<P>\n\tdefaultProps: Partial<P> | undefined\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: @TODO add explanation\nexport function isSandboxReactComponentDefinition<P = any>(\n\td: SandboxEntityDefinition<P>,\n): d is SandboxReactComponentDefinition<P> {\n\treturn d.type === \"component\"\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: @TODO add explanation\nexport function isSandboxRenderableComponentDefinition<P = any>(\n\td: SandboxEntityDefinition<P>,\n): d is SandboxRenderableComponentDefinition<P> {\n\treturn d.type === \"component\" || d.type === \"screen\" || d.type === \"responsiveScreen\"\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: @TODO add explanation\nexport function isSandboxPreviewPluginDefinition<P = any>(\n\td: SandboxEntityDefinition<P>,\n): d is SandboxReactComponentDefinition<P> {\n\treturn isSandboxReactComponentDefinition(d) && hasAnnotation(d.annotations, AnnotationKey.FramerPreviewPlugin)\n}\n\nexport interface SandboxSymbolDefinition extends SandboxEntityDefinition {\n\ttype: \"master\"\n\tclass: Record<string, unknown>\n}\n\nexport interface SandboxDataDefinition extends SandboxEntityDefinition {\n\ttype: \"data\"\n\tclass: AnyCollection\n\titemToSlug?: ItemToSlug\n}\n\nexport function isSandboxDataDefinition(d: SandboxEntityDefinition): d is SandboxDataDefinition {\n\treturn d.type === \"data\"\n}\n\nexport interface SandboxShaderDefinition extends SandboxEntityDefinition {\n\ttype: \"shader\"\n\tproperties: VerifiedPropertyControls\n\ttitle?: string\n}\n\nexport function isSandboxShaderDefinition(d: SandboxEntityDefinition): d is SandboxShaderDefinition {\n\treturn d.type === \"shader\"\n}\n\nexport function getDataFromDataDefinition(definition: SandboxDataDefinition, locale: Locale | undefined) {\n\tif (isLegacyCollection(definition.class)) {\n\t\treturn definition.class\n\t}\n\n\tif (isLegacyLocalizedCollection(definition.class)) {\n\t\treturn definition.class.read(locale)\n\t}\n\n\tthrow new Error(\"Unsupported collection module\")\n}\n\nexport interface SandboxErrorDefinition extends SandboxEntityDefinition<{}> {\n\terror: string\n\tfileDoesNotExist?: boolean\n}\n\nexport function isSandboxErrorDefinition(\n\tdef: SandboxEntityDefinition | SandboxErrorDefinition | null | undefined,\n): def is SandboxErrorDefinition {\n\treturn def !== undefined && (def as SandboxErrorDefinition).error !== undefined\n}\n\nexport type ProjectBundleGlobalEnvironment = {\n\tcomponentHash?: string | number\n\tcomponentScript?: string\n\tcomponentSrc?: string\n} & {\n\t[evalScriptFunctionName: string]: (\n\t\tmodule: FramerIndexModule,\n\t\texports: object,\n\t\t// biome-ignore lint/suspicious/noExplicitAny: @TODO add explanation\n\t\trequire: (name: string) => any,\n\t) => void\n}\n\nexport const defaultAssetReferenceKey: keyof OptionalDefaultAssetReference = \"__defaultAssetReference\"\n\nexport interface OptionalDefaultAssetReference {\n\t__defaultAssetReference?: string\n}\n\nexport function hasDefaultAssetReference<T>(value: T): value is T & Required<OptionalDefaultAssetReference> {\n\treturn isObject(value) && isString(value[defaultAssetReferenceKey])\n}\n\nexport interface DefaultResponsiveImage {\n\tassetReference: string\n\talt?: string\n\tpositionX?: RelativeNumber\n\tpositionY?: RelativeNumber\n}\n\nfunction isOptionalString(value: unknown): value is string | undefined {\n\treturn isString(value) || isUndefined(value)\n}\n\nfunction isOptionalRelativeNumber(value: unknown): value is RelativeNumber | undefined {\n\treturn isUndefined(value) || isRelativeNumber(value)\n}\n\nexport function isDefaultResponsiveImage(value: unknown): value is DefaultResponsiveImage {\n\tif (!isObject(value)) return false\n\n\tconst assetReferenceKey: keyof DefaultResponsiveImage = \"assetReference\"\n\tif (!isString(value[assetReferenceKey])) return false\n\n\tconst altKey: keyof DefaultResponsiveImage = \"alt\"\n\tif (!isOptionalString(value[altKey])) return false\n\n\tconst positionXKey: keyof DefaultResponsiveImage = \"positionX\"\n\tif (!isOptionalRelativeNumber(value[positionXKey])) return false\n\n\tconst positionYKey: keyof DefaultResponsiveImage = \"positionY\"\n\tif (!isOptionalRelativeNumber(value[positionYKey])) return false\n\n\treturn true\n}\n\nexport const vekterDefaultKey: keyof WithOptionalVekterDefault = \"__vekterDefault\"\n\nexport interface WithOptionalVekterDefault {\n\t__vekterDefault?: unknown\n}\n\nexport function hasVekterDefault<T>(value: T): value is T & WithOptionalVekterDefault {\n\treturn isObject(value) && vekterDefaultKey in value\n}\n\n// MARK: Verified Controls\n\nexport type VerifiedArrayItemControlDescription = Extract<\n\tVerifiedControlDescription,\n\t{ type: ArrayItemControlDescription[\"type\"] }\n>\n\nexport type VerifiedArrayControlDescription = Omit<ArrayControlDescription, \"propertyControl\" | \"control\"> & {\n\tcontrol: VerifiedArrayItemControlDescription\n} & WithOptionalVekterDefault\n\nexport type VerifiedObjectPropertyControlDescription = Extract<\n\tVerifiedControlDescription,\n\t{ type: ObjectPropertyControlDescription[\"type\"] }\n>\n\nexport type VerifiedObjectControlDescription = Omit<ObjectControlDescription, \"controls\"> & {\n\tcontrols: { [key: string]: VerifiedObjectPropertyControlDescription }\n}\n\ntype ControlDescriptionWithOverrides =\n\t| (ImageControlDescription & OptionalDefaultAssetReference)\n\t| (ResponsiveImageControlDescription & OptionalDefaultAssetReference & WithOptionalVekterDefault)\n\t| (FileControlDescription & OptionalDefaultAssetReference)\n\t| VerifiedArrayControlDescription\n\t| VerifiedObjectControlDescription\n\ntype ControlDescriptionWithoutOverridesTypes = Exclude<\n\tControlType,\n\tControlDescriptionWithOverrides[\"type\"] | ControlType.ComponentInstance | ControlType.SegmentedEnum\n>\n\ntype ControlDescriptionsWithoutOverrides = Extract<\n\tControlDescription,\n\t{ type: ControlDescriptionWithoutOverridesTypes }\n>\n\nexport type VerifiedControlDescription = ControlDescriptionsWithoutOverrides | ControlDescriptionWithOverrides\n\nexport type VerifiedPropertyControls = Record<string, VerifiedControlDescription>\n\n// MARK: Exhaustive Verified Controls\n\nexport type OptionalToUndefined<T> = {\n\t[P in keyof Required<T>]: Pick<T, P> extends Required<Pick<T, P>> ? T[P] : T[P] | undefined\n}\n\nexport type VerifiedExhaustiveArrayControlDescription = OptionalToUndefined<VerifiedArrayControlDescription>\n\nexport type VerifiedExhaustiveObjectControlDescription = OptionalToUndefined<VerifiedObjectControlDescription>\n\nexport type VerifiedExhaustiveControlDescription = OptionalToUndefined<VerifiedControlDescription>\n\n// MARK: Verified Action Controls\n\nexport type VerifiedActionControlDescription = Extract<VerifiedControlDescription, { type: ActionControlType }>\n\nexport type VerifiedActionControls = Record<string, VerifiedActionControlDescription>\n\nexport type ActionControlType = ActionControlDescription[\"type\"]\n\n// MARK: Serialized Verified Controls\n\ntype OverrideUnionElements<U, O extends object> = U extends unknown ? OverrideType<U, O> : never\n\nexport type SerializedVerifiedControlDescription = OverrideUnionElements<VerifiedControlDescription, { hidden?: never }>\n\nexport type SerializedVerifiedPropertyControls = Record<string, SerializedVerifiedControlDescription>\n\nexport type SerializedVerifiedActionControlDescription = OverrideUnionElements<\n\tVerifiedActionControlDescription,\n\t{ hidden?: never }\n>\n\nexport type SerializedVerifiedActionControls = Record<string, SerializedVerifiedActionControlDescription>\n", "import { deprecationWarning, isEmptyObject } from \"@framerjs/shared\"\nimport type { BorderStyle } from \"library/render/style/BorderComponent.tsx\"\nimport type { ActionControlDescription } from \"library/render/types/Action.ts\"\nimport type {\n\tArrayControlDescription,\n\tBooleanControlDescription,\n\tBorder,\n\tBorderControlDescription,\n\tBorderRadiusControlDescription,\n\tBoxShadowControlDescription,\n\tChangeHandlerControlDescription,\n\tCollectionReferenceControlDescription,\n\tColorControlDescription,\n\tComponentInstanceDescription,\n\tControlDescription,\n\tCoordinate,\n\tCursorControlDescription,\n\tCustomCursorControlDescription,\n\tDateControlDescription,\n\tDeprecatedFusedNumberControlDescription,\n\tEnumControlDescription,\n\tEventHandlerControlDescription,\n\tFileControlDescription,\n\tFontControlDescription,\n\tFusedNumberControlDescription,\n\tGapControlDescription,\n\tImageControlDescription,\n\tLinkControlDescription,\n\tLinkRelValuesControlDescription,\n\tLocation,\n\tLocationControlDescription,\n\tMultiCollectionReferenceControlDescription,\n\tNumberControlDescription,\n\tObjectControlDescription,\n\tObjectPropertyControlDescription,\n\tPaddingControlDescription,\n\tPageScopeControlDescription,\n\tResponsiveImageControlDescription,\n\tRichTextControlDescription,\n\tScrollSectionRefControlDescription,\n\tSegmentedControlIcon,\n\tSegmentedEnumControlDescription,\n\tSlotControlDescription,\n\tStringControlDescription,\n\tTrackingIdControlDescription,\n\tTransitionControlDescription,\n\tVectorSetItemControlDescription,\n} from \"library/render/types/PropertyControls.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport type { RelativeNumber } from \"library/render/types/RelativeNumber.ts\"\nimport { isRelativeNumber } from \"library/render/types/RelativeNumber.ts\"\nimport { isNull } from \"library/utils/utils.ts\"\nimport { isArray, isBoolean, isFunction, isNumber, isObject, isString, isUndefined } from \"../../utils/typeChecks.ts\"\nimport type {\n\tDefaultResponsiveImage,\n\tOptionalDefaultAssetReference,\n\tOptionalToUndefined,\n\tVerifiedActionControls,\n\tVerifiedControlDescription,\n\tVerifiedExhaustiveControlDescription,\n\tVerifiedObjectControlDescription,\n\tVerifiedPropertyControls,\n\tWithOptionalVekterDefault,\n} from \"./types.ts\"\nimport { hasVekterDefault, isDefaultResponsiveImage } from \"./types.ts\"\n\ntype RawControlDescription =\n\t| BooleanControlDescription\n\t| NumberControlDescription\n\t| StringControlDescription\n\t| RichTextControlDescription\n\t| FusedNumberControlDescription\n\t| DeprecatedFusedNumberControlDescription\n\t| EnumControlDescription\n\t| SegmentedEnumControlDescription\n\t| ColorControlDescription\n\t| (ImageControlDescription & OptionalDefaultAssetReference)\n\t| (ResponsiveImageControlDescription & OptionalDefaultAssetReference & WithOptionalVekterDefault)\n\t| (FileControlDescription & OptionalDefaultAssetReference)\n\t| ComponentInstanceDescription\n\t| SlotControlDescription\n\t| (ArrayControlDescription & WithOptionalVekterDefault)\n\t| EventHandlerControlDescription\n\t| ChangeHandlerControlDescription\n\t| TransitionControlDescription\n\t| LinkControlDescription\n\t| LinkRelValuesControlDescription\n\t| DateControlDescription\n\t| ObjectControlDescription\n\t| FontControlDescription\n\t| PageScopeControlDescription\n\t| ScrollSectionRefControlDescription\n\t| CustomCursorControlDescription\n\t| BorderControlDescription\n\t| CursorControlDescription\n\t| BoxShadowControlDescription\n\t| GapControlDescription\n\t| PaddingControlDescription\n\t| BorderRadiusControlDescription\n\t| CollectionReferenceControlDescription\n\t| MultiCollectionReferenceControlDescription\n\t| TrackingIdControlDescription\n\t| VectorSetItemControlDescription\n\t| LocationControlDescription\n\nconst controlTypes: Record<ControlType, true> = {\n\tboolean: true,\n\tnumber: true,\n\tstring: true,\n\trichtext: true,\n\tfusednumber: true,\n\tenum: true,\n\tsegmentedenum: true,\n\tcolor: true,\n\timage: true,\n\tresponsiveimage: true,\n\tfile: true,\n\tcomponentinstance: true,\n\tslot: true,\n\tarray: true,\n\teventhandler: true,\n\tchangehandler: true,\n\ttransition: true,\n\tlink: true,\n\tlinkrelvalues: true,\n\tdate: true,\n\tobject: true,\n\tfont: true,\n\tpagescope: true,\n\tscrollsectionref: true,\n\tcustomcursor: true,\n\tborder: true,\n\tcursor: true,\n\tboxshadow: true,\n\tpadding: true,\n\tborderradius: true,\n\tgap: true,\n\tcollectionreference: true,\n\tmulticollectionreference: true,\n\ttrackingid: true,\n\tvectorsetitem: true,\n\tlocation: true,\n}\n\nfunction isControlType(name: unknown): name is ControlType {\n\tif (!isString(name)) return false\n\treturn Object.hasOwn(controlTypes, name)\n}\n\nexport function isControlDescription(value: unknown): value is ControlDescription {\n\tif (!isObject(value)) return false\n\treturn isControlType(value.type)\n}\n\nexport function verifyPropertyControls(\n\tcontrols: { [key: string]: unknown },\n\tdefaultProps?: unknown,\n): VerifiedPropertyControls {\n\tconst verifiedControls: VerifiedPropertyControls = {}\n\tconst reactDefaultProps = isObject(defaultProps) ? defaultProps : {}\n\n\tfor (const controlKey in controls) {\n\t\tconst control = controls[controlKey]\n\t\tconst rawControlDescription = getRawControlDescription(control)\n\t\tif (!rawControlDescription) continue\n\n\t\tconst reactDefault = reactDefaultProps[controlKey]\n\t\tconst verifiedControl = getVerifiedControl(rawControlDescription, reactDefault)\n\t\tif (!verifiedControl) continue\n\n\t\tverifiedControls[controlKey] = verifiedControl\n\t}\n\n\treturn verifiedControls\n}\n\ntype ActionControlType = ActionControlDescription[\"type\"]\n\nconst actionControlTypes: Record<ActionControlType, true> = {\n\t[ControlType.Number]: true,\n\t[ControlType.Enum]: true,\n\t[ControlType.Boolean]: true,\n\t[ControlType.String]: true,\n\t[ControlType.RichText]: true,\n\t[ControlType.Color]: true,\n\t[ControlType.FusedNumber]: true,\n\t[ControlType.SegmentedEnum]: true,\n\t[ControlType.Image]: true,\n\t[ControlType.ResponsiveImage]: true,\n\t[ControlType.File]: true,\n\t[ControlType.ComponentInstance]: true,\n\t[ControlType.Transition]: true,\n\t[ControlType.Slot]: true,\n}\n\nfunction isActionControlType(name: unknown): name is ActionControlType {\n\tif (!isString(name)) return false\n\treturn Object.hasOwn(actionControlTypes, name)\n}\n\nfunction isActionControl(\n\tcontrol: VerifiedControlDescription | null,\n): control is Extract<VerifiedControlDescription, { type: ActionControlType }> {\n\tif (!control) return false\n\treturn isActionControlType(control.type)\n}\n\nexport function verifyActionControls(controls: { [key: string]: unknown }): VerifiedActionControls {\n\tconst verifiedControls: VerifiedActionControls = {}\n\n\tfor (const key in controls) {\n\t\tconst control = controls[key]\n\t\tconst rawControlDescription = getRawControlDescription(control)\n\t\tif (!rawControlDescription) continue\n\n\t\tconst verifiedControl = getVerifiedControl(rawControlDescription)\n\t\tif (!isActionControl(verifiedControl)) continue\n\n\t\tverifiedControls[key] = verifiedControl\n\t}\n\treturn verifiedControls\n}\n\nfunction getRawControlDescription(value: unknown): RawControlDescription | undefined {\n\tif (isString(value)) {\n\t\tif (!isControlType(value)) return undefined\n\t\treturn { type: value } as RawControlDescription\n\t}\n\tif (isControlDescription(value)) {\n\t\treturn value\n\t}\n\treturn undefined\n}\n\n// Objects and arrays should not be nested more than this level\nconst maximumDepth = 5\n\nfunction getVerifiedControl(\n\tvalues: RawControlDescription,\n\treactDefault?: unknown,\n\tdepthLevel = 0,\n\tparentType: ControlType | null = null,\n): VerifiedExhaustiveControlDescription | null {\n\tconst title = toOptionalString(values.title)\n\tconst description = toOptionalString(values.description)\n\tconst section = toOptionalString(values.section)\n\tconst hidden = toHiddenControl(values.hidden)\n\tconst type = values.type\n\tif (!isControlType(type)) return null\n\n\tswitch (type) {\n\t\tcase ControlType.Boolean: {\n\t\t\tconst disabledTitle = toOptionalString(values.disabledTitle)\n\t\t\tconst enabledTitle = toOptionalString(values.enabledTitle)\n\t\t\tconst defaultValue = isBoolean(values.defaultValue) ? values.defaultValue : toOptionalBoolean(reactDefault)\n\t\t\tconst optional = toControlIsOptional(parentType, values.optional)\n\t\t\tconst hiddenWhenUnset = toControlIsHiddenWhenUnset(parentType, values.hiddenWhenUnset, hidden)\n\t\t\treturn {\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tsection,\n\t\t\t\thidden,\n\t\t\t\tdefaultValue,\n\t\t\t\ttype,\n\t\t\t\tdisabledTitle,\n\t\t\t\tenabledTitle,\n\t\t\t\toptional,\n\t\t\t\thiddenWhenUnset,\n\t\t\t}\n\t\t}\n\t\tcase ControlType.Number: {\n\t\t\tconst min = toOptionalNumber(values.min)\n\t\t\tconst max = toOptionalNumber(values.max)\n\t\t\tconst unit = toOptionalString(values.unit)\n\t\t\tconst step = toOptionalNumber(values.step)\n\t\t\tconst displayStepper = toOptionalBoolean(values.displayStepper)\n\t\t\tconst defaultValue = isNumber(values.defaultValue)\n\t\t\t\t? toOptionalNumber(values.defaultValue, min, max)\n\t\t\t\t: toOptionalNumber(reactDefault, min, max)\n\t\t\tconst optional = toControlIsOptional(parentType, values.optional)\n\t\t\tconst hiddenWhenUnset = toControlIsHiddenWhenUnset(parentType, values.hiddenWhenUnset, hidden)\n\t\t\treturn {\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tsection,\n\t\t\t\thidden,\n\t\t\t\tdefaultValue,\n\t\t\t\ttype,\n\t\t\t\tmin,\n\t\t\t\tmax,\n\t\t\t\tunit,\n\t\t\t\tstep,\n\t\t\t\tdisplayStepper,\n\t\t\t\toptional,\n\t\t\t\thiddenWhenUnset,\n\t\t\t}\n\t\t}\n\t\tcase ControlType.String: {\n\t\t\tconst placeholder = toOptionalString(values.placeholder)\n\t\t\tconst obscured = toOptionalBoolean(values.obscured)\n\t\t\tconst displayTextArea = toOptionalBoolean(values.displayTextArea)\n\t\t\tconst defaultValue = isString(values.defaultValue) ? values.defaultValue : toOptionalString(reactDefault)\n\t\t\tconst preventLocalization = toOptionalBoolean(values.preventLocalization)\n\t\t\tconst optional = toControlIsOptional(parentType, values.optional)\n\t\t\tconst hiddenWhenUnset = toControlIsHiddenWhenUnset(parentType, values.hiddenWhenUnset, hidden)\n\t\t\treturn {\n\t\t\t\ttype,\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tsection,\n\t\t\t\thidden,\n\t\t\t\tdefaultValue,\n\t\t\t\tplaceholder,\n\t\t\t\tobscured,\n\t\t\t\tdisplayTextArea,\n\t\t\t\tpreventLocalization,\n\t\t\t\tmaxLength: undefined, // Max length is private API, only used in the CMS\n\t\t\t\toptional,\n\t\t\t\thiddenWhenUnset,\n\t\t\t}\n\t\t}\n\t\tcase ControlType.RichText: {\n\t\t\tconst { defaultValue } = values\n\t\t\tconst placeholder = toOptionalString(values.placeholder)\n\t\t\tconst preventLocalization = toOptionalBoolean(values.preventLocalization)\n\t\t\treturn {\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tsection,\n\t\t\t\thidden,\n\t\t\t\tdefaultValue: toOptionalString(defaultValue),\n\t\t\t\ttype,\n\t\t\t\tplaceholder,\n\t\t\t\tpreventLocalization,\n\t\t\t\tmaxLength: undefined, // Max length is private API, only used in the CMS\n\t\t\t}\n\t\t}\n\t\tcase ControlType.FusedNumber: {\n\t\t\tconst controlDescription = values as Partial<\n\t\t\t\tDeprecatedFusedNumberControlDescription & FusedNumberControlDescription\n\t\t\t>\n\n\t\t\tconst valueKeys = toOptionalFourStringTuple(controlDescription.valueKeys)\n\t\t\tconst valueLabels = toOptionalFourStringTuple(controlDescription.valueLabels)\n\t\t\tconst min = toOptionalNumber(controlDescription.min)\n\n\t\t\tlet toggleKey = toOptionalString(controlDescription.toggleKey)\n\t\t\tlet toggleTitles = toOptionalTwoStringTuple(controlDescription.toggleTitles)\n\n\t\t\tif (!toggleKey) {\n\t\t\t\ttoggleKey = toOptionalString(controlDescription.splitKey)\n\t\t\t\tif (!toggleKey) return null\n\t\t\t\tdeprecationWarning(\"splitKey option of FusedNumber control type\", \"1.0.0\", \"toggleKey\")\n\t\t\t}\n\n\t\t\tif (!toggleTitles) {\n\t\t\t\ttoggleTitles = toOptionalTwoStringTuple(controlDescription.splitLabels)\n\t\t\t\tif (!toggleTitles) return null\n\t\t\t\tdeprecationWarning(\"splitLabels option of FusedNumber control type\", \"1.0.0\", \"toggleTitles\")\n\t\t\t}\n\n\t\t\tif (!toggleKey || !toggleTitles || !valueKeys || !valueLabels) return null\n\n\t\t\tconst defaultValue = isNumber(controlDescription.defaultValue)\n\t\t\t\t? toOptionalNumber(controlDescription.defaultValue, min)\n\t\t\t\t: toOptionalNumber(reactDefault, min)\n\n\t\t\treturn {\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tsection,\n\t\t\t\thidden,\n\t\t\t\tdefaultValue,\n\t\t\t\ttype,\n\t\t\t\ttoggleKey,\n\t\t\t\ttoggleTitles,\n\t\t\t\tvalueKeys,\n\t\t\t\tvalueLabels,\n\t\t\t\tmin,\n\t\t\t}\n\t\t}\n\t\tcase ControlType.Enum: {\n\t\t\tconst { defaultValue, displaySegmentedControl, segmentedControlDirection, optional } = values\n\t\t\tconst options = toDefinedPrimitiveList(values.options)\n\t\t\tif (!options) return null\n\t\t\tconst hiddenWhenUnset = toControlIsHiddenWhenUnset(parentType, values.hiddenWhenUnset, hidden)\n\n\t\t\treturn normalizeOptionalEnumControlDescription({\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tsection,\n\t\t\t\thidden,\n\t\t\t\tdefaultValue: isValidPrimitive(defaultValue, options) ? defaultValue : toOptionalPrimitive(reactDefault),\n\t\t\t\ttype,\n\t\t\t\toptions,\n\t\t\t\toptionTitles: toStringList(values.optionTitles),\n\t\t\t\toptional: toControlIsOptional(parentType, optional),\n\t\t\t\tdisplaySegmentedControl: toOptionalBoolean(displaySegmentedControl),\n\t\t\t\tsegmentedControlDirection: toSegmentedControlDirection(segmentedControlDirection),\n\t\t\t\toptionIcons: toOptionIcons(values.optionIcons),\n\t\t\t\thiddenWhenUnset,\n\t\t\t})\n\t\t}\n\t\tcase ControlType.SegmentedEnum: {\n\t\t\tconst { defaultValue } = values\n\t\t\tconst options = toStringList(values.options)\n\t\t\tif (!options) return null\n\t\t\tconst optionTitles = toStringList(values.optionTitles)\n\t\t\treturn {\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tsection,\n\t\t\t\thidden,\n\t\t\t\tdefaultValue: isValidPrimitive(defaultValue, options)\n\t\t\t\t\t? toOptionalString(defaultValue)\n\t\t\t\t\t: toOptionalString(reactDefault),\n\t\t\t\ttype: ControlType.Enum,\n\t\t\t\toptions,\n\t\t\t\toptionTitles,\n\t\t\t\toptional: undefined,\n\t\t\t\tdisplaySegmentedControl: true,\n\t\t\t\tsegmentedControlDirection: undefined,\n\t\t\t\toptionIcons: undefined,\n\t\t\t\thiddenWhenUnset: undefined,\n\t\t\t}\n\t\t}\n\t\tcase ControlType.Color: {\n\t\t\tconst { defaultValue, optional, hiddenWhenUnset } = values\n\t\t\treturn {\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tsection,\n\t\t\t\thidden,\n\t\t\t\tdefaultValue: isString(defaultValue) ? defaultValue : toOptionalString(reactDefault),\n\t\t\t\ttype,\n\t\t\t\toptional: toControlIsOptional(parentType, optional),\n\t\t\t\thiddenWhenUnset: toControlIsHiddenWhenUnset(parentType, hiddenWhenUnset, hidden),\n\t\t\t}\n\t\t}\n\t\tcase ControlType.Image: {\n\t\t\treturn {\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tsection,\n\t\t\t\thidden,\n\t\t\t\ttype,\n\t\t\t\t__defaultAssetReference: toOptionalString(values.__defaultAssetReference),\n\t\t\t}\n\t\t}\n\t\tcase ControlType.PageScope: {\n\t\t\treturn { title, description, section, hidden, type }\n\t\t}\n\t\tcase ControlType.ResponsiveImage: {\n\t\t\treturn {\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tsection,\n\t\t\t\thidden,\n\t\t\t\ttype,\n\t\t\t\t__defaultAssetReference: toOptionalString(values.__defaultAssetReference),\n\t\t\t\t__vekterDefault: getOptionalDefaultImage(values),\n\t\t\t}\n\t\t}\n\t\tcase ControlType.File: {\n\t\t\tconst allowedFileTypes = toStringList(values.allowedFileTypes)\n\t\t\tif (!allowedFileTypes) return null\n\t\t\treturn {\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tsection,\n\t\t\t\thidden,\n\t\t\t\ttype,\n\t\t\t\tallowedFileTypes,\n\t\t\t\t__defaultAssetReference: toOptionalString(values.__defaultAssetReference),\n\t\t\t}\n\t\t}\n\t\tcase ControlType.ComponentInstance:\n\t\t\treturn { title, description, section, hidden, type: ControlType.Slot, maxCount: 1 }\n\t\tcase ControlType.Slot: {\n\t\t\treturn { title, description, section, hidden, type, maxCount: values.maxCount }\n\t\t}\n\t\tcase ControlType.Array: {\n\t\t\tif (depthLevel >= maximumDepth) return null\n\t\t\t// Fallback to deprecated propertyControl if control isn't defined\n\t\t\tconst controlValues = values.control ?? values.propertyControl\n\t\t\tif (!isObject(controlValues)) return null\n\n\t\t\tconst minCount = toOptionalNumber(values.minCount, 1)\n\t\t\tlet maxCount = toOptionalNumber(values.maxCount, 1)\n\n\t\t\tif (isNumber(minCount) && isNumber(maxCount) && maxCount < minCount) {\n\t\t\t\tmaxCount = minCount\n\t\t\t}\n\n\t\t\tif (controlValues.type === ControlType.ComponentInstance) {\n\t\t\t\tif (depthLevel > 0) return null\n\t\t\t\treturn { title, description, section, hidden, type: ControlType.Slot, maxCount }\n\t\t\t}\n\n\t\t\tconst control = getVerifiedControl(controlValues, undefined, depthLevel + 1, ControlType.Array)\n\t\t\tif (!control) return null\n\n\t\t\tswitch (control.type) {\n\t\t\t\tcase ControlType.Array:\n\t\t\t\tcase ControlType.EventHandler:\n\t\t\t\tcase ControlType.ChangeHandler:\n\t\t\t\tcase ControlType.FusedNumber:\n\t\t\t\tcase ControlType.BoxShadow:\n\t\t\t\tcase ControlType.PageScope:\n\t\t\t\tcase ControlType.Font:\n\t\t\t\tcase ControlType.Padding:\n\t\t\t\tcase ControlType.BorderRadius:\n\t\t\t\tcase ControlType.Gap:\n\t\t\t\tcase ControlType.CollectionReference:\n\t\t\t\tcase ControlType.Slot:\n\t\t\t\tcase ControlType.MultiCollectionReference:\n\t\t\t\tcase ControlType.TrackingId:\n\t\t\t\tcase ControlType.VectorSetItem:\n\t\t\t\tcase ControlType.LinkRelValues:\n\t\t\t\t\t// Unsupported array element types\n\t\t\t\t\treturn null\n\t\t\t}\n\n\t\t\tlet defaultValue: unknown[] | undefined\n\n\t\t\tif (isArray(values.defaultValue)) {\n\t\t\t\tdefaultValue = toArray(values.defaultValue, control)\n\t\t\t} else if (isArray(reactDefault)) {\n\t\t\t\tdefaultValue = toArray(reactDefault, control)\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tsection,\n\t\t\t\thidden,\n\t\t\t\ttype,\n\t\t\t\tcontrol,\n\t\t\t\tminCount,\n\t\t\t\tmaxCount,\n\t\t\t\tdefaultValue,\n\t\t\t\t__vekterDefault: toOptionalArray(values.__vekterDefault),\n\t\t\t}\n\t\t}\n\t\tcase ControlType.Link: {\n\t\t\tconst { defaultValue } = values\n\t\t\treturn {\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tsection,\n\t\t\t\thidden,\n\t\t\t\ttype,\n\t\t\t\tdefaultValue: isString(defaultValue) ? defaultValue : toOptionalString(reactDefault),\n\t\t\t}\n\t\t}\n\t\tcase ControlType.LinkRelValues: {\n\t\t\treturn {\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tsection,\n\t\t\t\thidden,\n\t\t\t\ttype,\n\t\t\t\tdefaultValue: isArray(values.defaultValue) ? values.defaultValue : undefined,\n\t\t\t}\n\t\t}\n\t\tcase ControlType.Font: {\n\t\t\tconst { defaultFontType, displayFontSize, displayTextAlignment, defaultValue } = values\n\t\t\tconst controls = toFontControls(values.controls)\n\n\t\t\treturn {\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tsection,\n\t\t\t\thidden,\n\t\t\t\ttype,\n\t\t\t\tcontrols,\n\t\t\t\tdefaultFontType: toDefaultFontType(defaultFontType),\n\t\t\t\tdisplayFontSize: isBoolean(displayFontSize) ? displayFontSize : controls === \"extended\",\n\t\t\t\tdisplayTextAlignment: isBoolean(displayTextAlignment) ? displayTextAlignment : controls === \"extended\",\n\t\t\t\tdefaultValue: isObject(defaultValue) ? defaultValue : undefined,\n\t\t\t}\n\t\t}\n\t\tcase ControlType.Object: {\n\t\t\tif (depthLevel >= maximumDepth) return null\n\t\t\tif (!isObject(values.controls)) return null\n\n\t\t\tconst objectControls: VerifiedObjectControlDescription[\"controls\"] = {}\n\n\t\t\tObject.entries(values.controls).forEach(([key, value]) => {\n\t\t\t\tconst rawControlDescription = getRawControlDescription(value)\n\t\t\t\tif (!rawControlDescription) return\n\n\t\t\t\tconst objectPropertyControl = getVerifiedControl(\n\t\t\t\t\trawControlDescription,\n\t\t\t\t\tundefined,\n\t\t\t\t\tdepthLevel + 1,\n\t\t\t\t\tControlType.Object,\n\t\t\t\t)\n\t\t\t\tif (!objectPropertyControl) return\n\n\t\t\t\tswitch (objectPropertyControl.type) {\n\t\t\t\t\tcase ControlType.EventHandler:\n\t\t\t\t\tcase ControlType.ChangeHandler:\n\t\t\t\t\tcase ControlType.Slot:\n\t\t\t\t\tcase ControlType.VectorSetItem:\n\t\t\t\t\tcase ControlType.LinkRelValues:\n\t\t\t\t\t\t// Unsupported object property types\n\t\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tobjectControls[key] = objectPropertyControl\n\t\t\t})\n\n\t\t\tif (isEmptyObject(objectControls)) return null\n\n\t\t\tlet defaultValue: { [key: string]: unknown } | undefined\n\n\t\t\tif (isObject(values.defaultValue)) {\n\t\t\t\tdefaultValue = toObjectDefault(values.defaultValue, values.controls)\n\t\t\t} else if (isObject(reactDefault)) {\n\t\t\t\tdefaultValue = toObjectDefault(reactDefault, values.controls)\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tsection,\n\t\t\t\thidden,\n\t\t\t\ttype,\n\t\t\t\tcontrols: objectControls,\n\t\t\t\tdefaultValue,\n\t\t\t\tbuttonTitle: toOptionalString(values.buttonTitle),\n\t\t\t\toptional: toControlIsOptional(parentType, values.optional),\n\t\t\t\thiddenWhenUnset: toControlIsHiddenWhenUnset(parentType, values.hiddenWhenUnset, hidden),\n\t\t\t\ticon: isString(values.icon) ? values.icon : undefined,\n\t\t\t}\n\t\t}\n\t\tcase ControlType.Date: {\n\t\t\treturn {\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tsection,\n\t\t\t\thidden,\n\t\t\t\ttype: values.type,\n\t\t\t\tdefaultValue: isNonEmptyString(values.defaultValue)\n\t\t\t\t\t? values.defaultValue\n\t\t\t\t\t: toOptionalNonEmptyString(reactDefault),\n\t\t\t\tdisplayTime: toOptionalBoolean(values.displayTime),\n\t\t\t\toptional: toControlIsOptional(parentType, values.optional),\n\t\t\t\thiddenWhenUnset: toControlIsHiddenWhenUnset(parentType, values.hiddenWhenUnset, hidden),\n\t\t\t}\n\t\t}\n\t\tcase ControlType.EventHandler:\n\t\t\treturn { title, description, section, hidden, type }\n\t\tcase ControlType.ChangeHandler: {\n\t\t\tconst changes = toOptionalString(values.changes)\n\t\t\tif (!changes) return null\n\t\t\treturn { title, description, section, hidden, type, changes }\n\t\t}\n\t\tcase ControlType.Transition: {\n\t\t\tlet { defaultValue } = values\n\n\t\t\tif (isObject(defaultValue)) {\n\t\t\t\tconst transitionType = inferDefaultTransitionType(defaultValue)\n\t\t\t\tdefaultValue = { type: transitionType, ...defaultValue }\n\t\t\t} else if (isObject(reactDefault)) {\n\t\t\t\tconst transitionType = inferDefaultTransitionType(reactDefault)\n\t\t\t\tdefaultValue = { type: transitionType, ...reactDefault }\n\t\t\t}\n\n\t\t\treturn { title, description, section, hidden, type, defaultValue }\n\t\t}\n\t\tcase ControlType.ScrollSectionRef: {\n\t\t\treturn {\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tsection,\n\t\t\t\ttype,\n\t\t\t\thidden,\n\t\t\t}\n\t\t}\n\t\tcase ControlType.CustomCursor: {\n\t\t\treturn {\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tsection,\n\t\t\t\ttype,\n\t\t\t\thidden,\n\t\t\t}\n\t\t}\n\t\tcase ControlType.Border: {\n\t\t\treturn {\n\t\t\t\ttitle,\n\t\t\t\thidden,\n\t\t\t\tdescription,\n\t\t\t\tsection,\n\t\t\t\ttype,\n\t\t\t\tdefaultValue: borderControlDefaultValueWithFallback(values.defaultValue),\n\t\t\t\toptional: toControlIsOptional(parentType, values.optional),\n\t\t\t\thiddenWhenUnset: toControlIsHiddenWhenUnset(parentType, values.hiddenWhenUnset, hidden),\n\t\t\t}\n\t\t}\n\t\tcase ControlType.Cursor: {\n\t\t\treturn {\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tsection,\n\t\t\t\ttype,\n\t\t\t\thidden,\n\t\t\t\tdefaultValue: toOptionalString(values.defaultValue),\n\t\t\t}\n\t\t}\n\t\tcase ControlType.BoxShadow: {\n\t\t\tconst { defaultValue } = values\n\t\t\treturn {\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tsection,\n\t\t\t\ttype,\n\t\t\t\thidden,\n\t\t\t\tdefaultValue: isString(defaultValue) || isArray(defaultValue) ? defaultValue : undefined,\n\t\t\t}\n\t\t}\n\t\tcase ControlType.Padding:\n\t\tcase ControlType.BorderRadius:\n\t\tcase ControlType.Gap: {\n\t\t\treturn {\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tsection,\n\t\t\t\ttype,\n\t\t\t\thidden,\n\t\t\t\tdefaultValue: toOptionalString(values.defaultValue),\n\t\t\t}\n\t\t}\n\t\tcase ControlType.CollectionReference: {\n\t\t\tif (!isString(values.dataIdentifier)) return null\n\t\t\treturn {\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tsection,\n\t\t\t\ttype,\n\t\t\t\thidden,\n\t\t\t\tdataIdentifier: values.dataIdentifier,\n\t\t\t\tdefaultValue: toOptionalString(values.defaultValue),\n\t\t\t\toptional: toControlIsOptional(parentType, values.optional),\n\t\t\t\thiddenWhenUnset: toControlIsHiddenWhenUnset(parentType, values.hiddenWhenUnset, hidden),\n\t\t\t}\n\t\t}\n\t\tcase ControlType.MultiCollectionReference: {\n\t\t\tif (!isString(values.dataIdentifier)) return null\n\n\t\t\treturn {\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tsection,\n\t\t\t\ttype,\n\t\t\t\thidden,\n\t\t\t\tdataIdentifier: values.dataIdentifier,\n\t\t\t\tdefaultValue: toStringList(values.defaultValue),\n\t\t\t\toptional: toControlIsOptional(parentType, values.optional),\n\t\t\t\thiddenWhenUnset: toControlIsHiddenWhenUnset(parentType, values.hiddenWhenUnset, hidden),\n\t\t\t}\n\t\t}\n\t\tcase ControlType.VectorSetItem: {\n\t\t\tif (!isString(values.setModuleId)) return null\n\n\t\t\treturn {\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tsection,\n\t\t\t\ttype,\n\t\t\t\thidden,\n\t\t\t\tsetModuleId: values.setModuleId,\n\t\t\t\tdefaultValue: values.defaultValue,\n\t\t\t}\n\t\t}\n\t\tcase ControlType.TrackingId: {\n\t\t\treturn {\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tsection,\n\t\t\t\ttype,\n\t\t\t\thidden,\n\t\t\t\tdefaultValue: toOptionalString(values.defaultValue),\n\t\t\t}\n\t\t}\n\t\tcase ControlType.Location: {\n\t\t\treturn {\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tsection,\n\t\t\t\ttype,\n\t\t\t\thidden,\n\t\t\t\tdefaultValue: toLocationDefaultValue(values.defaultValue),\n\t\t\t\toptional: toControlIsOptional(parentType, values.optional),\n\t\t\t\thiddenWhenUnset: toControlIsHiddenWhenUnset(parentType, values.hiddenWhenUnset, hidden),\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction normalizeOptionalEnumControlDescription<T extends EnumControlDescription>(control: T): T {\n\tif (control.optionTitles && control.optionTitles.length !== control.options.length) {\n\t\tcontrol.optionTitles = undefined\n\t}\n\t// `null` is an allowed enum option. If it is present, we unset `optional`, because the `null` option will be used to represent absence.\n\tconst hasNullOption = control.options.includes(null)\n\tif (hasNullOption && control.optional) control.optional = undefined\n\t// Segmented controls do not have a way to unset. Optional takes precedence.\n\tif (control.displaySegmentedControl && control.optional) control.displaySegmentedControl = undefined\n\treturn control\n}\n\nfunction toFontControls(value: unknown): NonNullable<FontControlDescription[\"controls\"]> {\n\tconst extendedFontControls = \"extended\" satisfies FontControlDescription[\"controls\"]\n\tif (value === extendedFontControls) return value\n\treturn \"basic\"\n}\n\nfunction toDefaultFontType(value: unknown): FontControlDescription[\"defaultFontType\"] {\n\tswitch (value) {\n\t\tcase \"monospace\":\n\t\tcase \"serif\":\n\t\tcase \"sans-serif\":\n\t\t\treturn value\n\n\t\tdefault:\n\t\t\treturn undefined\n\t}\n}\n\n/** Return boolean unless child of an array */\nfunction toControlIsOptional(parentType: ControlType | null, optional: boolean | undefined): boolean | undefined {\n\tif (parentType === ControlType.Array) return undefined\n\treturn toOptionalBoolean(optional)\n}\n\n/** Check if `hiddenWhenUnset` is outside of an array, and not used in conjunction with `hidden` */\nfunction toControlIsHiddenWhenUnset(\n\tparentType: ControlType | null,\n\toptional: boolean | undefined,\n\thidden: HiddenControl,\n): boolean | undefined {\n\tif (parentType === ControlType.Array || parentType === ControlType.Object) return undefined\n\tif (!isUndefined(hidden)) return undefined\n\treturn toOptionalBoolean(optional)\n}\n\nfunction toOptionalBoolean(value: unknown): boolean | undefined {\n\treturn isBoolean(value) ? value : undefined\n}\n\nfunction toOptionalNumber(value: unknown, min?: number, max?: number): number | undefined {\n\tif (!isNumber(value)) return\n\tif (isNumber(min) && value < min) return min\n\tif (isNumber(max) && value > max) return max\n\treturn value\n}\n\ntype NonEmptyString<T> = T extends string ? (T extends \"\" ? never : T) : never\n\nfunction isNonEmptyString<T>(value: T): value is NonEmptyString<T> {\n\treturn isString(value) && value.length > 0\n}\n\nfunction toOptionalString(value: unknown): string | undefined {\n\treturn isString(value) ? value : undefined\n}\n\nfunction toOptionalNonEmptyString(value: unknown): string | undefined {\n\treturn isNonEmptyString(value) ? value : undefined\n}\n\nfunction toOptionalRelativeNumber(value: unknown): RelativeNumber | undefined {\n\treturn isRelativeNumber(value) ? value : undefined\n}\n\nfunction toOptionalArray(value: unknown): unknown[] | undefined {\n\treturn isArray(value) ? value : undefined\n}\n\nfunction getOptionalDefaultImage(value: unknown): OptionalToUndefined<DefaultResponsiveImage> | undefined {\n\tif (!hasVekterDefault(value) || !isDefaultResponsiveImage(value.__vekterDefault)) return\n\n\tconst { assetReference, alt, positionX, positionY } = value.__vekterDefault\n\n\treturn {\n\t\tassetReference,\n\t\talt: toOptionalString(alt),\n\t\tpositionX: toOptionalRelativeNumber(positionX),\n\t\tpositionY: toOptionalRelativeNumber(positionY),\n\t}\n}\n\ntype DefinedPrimitive = string | number | boolean | null\ntype Primitive = DefinedPrimitive | undefined\n\nfunction isDefinedPrimitive(value: unknown): value is DefinedPrimitive {\n\treturn isString(value) || isNumber(value) || isBoolean(value) || isNull(value)\n}\n\nfunction isPrimitive(value: unknown): value is Primitive {\n\treturn isDefinedPrimitive(value) || isUndefined(value)\n}\n\nfunction isValidPrimitive(value: unknown, validValues: Primitive[]): value is Primitive {\n\treturn isPrimitive(value) && validValues.includes(value)\n}\n\nfunction toOptionalPrimitive(value: unknown): Primitive {\n\treturn isPrimitive(value) ? value : null\n}\n\nfunction toStringList(value: unknown): string[] | undefined {\n\tif (!isArray(value)) return undefined\n\treturn value.map(toOptionalString).filter(isNonEmptyString)\n}\n\nfunction toOptionalDefinedPrimitive(value: unknown): DefinedPrimitive {\n\treturn isDefinedPrimitive(value) ? value : null\n}\n\nfunction toDefinedPrimitiveList(value: unknown): DefinedPrimitive[] | undefined {\n\tif (!isArray(value)) return undefined\n\treturn value.map(toOptionalDefinedPrimitive)\n}\n\nfunction toOptionalTwoStringTuple(value: unknown): [string, string] | undefined {\n\tif (!isArray(value)) return undefined\n\tconst s1 = toOptionalString(value[0])\n\tconst s2 = toOptionalString(value[1])\n\tif (!s1 || !s2) return undefined\n\treturn [s1, s2]\n}\n\nfunction toOptionalFourStringTuple(value: unknown): [string, string, string, string] | undefined {\n\tif (!isArray(value)) return undefined\n\tconst s1 = toOptionalString(value[0])\n\tconst s2 = toOptionalString(value[1])\n\tconst s3 = toOptionalString(value[2])\n\tconst s4 = toOptionalString(value[3])\n\tif (!s1 || !s2 || !s3 || !s4) return undefined\n\treturn [s1, s2, s3, s4]\n}\n\ntype HiddenControlCallback<P = unknown> = (props: P) => boolean\ntype HiddenControl<P = unknown> = HiddenControlCallback<P> | boolean | undefined\n\nfunction toHiddenControl<P = unknown>(value: unknown): HiddenControl<P> {\n\tif (isBoolean(value)) return value\n\tif (!isFunction(value)) return undefined\n\treturn value as HiddenControlCallback<P>\n}\n\ninterface StaticSwitch<T> {\n\t[expressionKey: string]: {\n\t\t[caseKey: string]: T\n\t}\n}\n\nfunction isStaticSwitch<T>(value: unknown, isValidResult: (r: unknown) => r is T): value is StaticSwitch<T> {\n\tif (!isObject(value)) return false\n\n\tconst keys = Object.keys(value)\n\tif (keys.length !== 1) return false\n\n\tconst expressionKey = keys[0]\n\tif (!expressionKey) return false\n\tconst expressionValue = value[expressionKey]\n\tif (!isObject(expressionValue)) return false\n\n\tconst caseKeys = Object.keys(expressionValue)\n\tif (caseKeys.length === 0) return false\n\n\tfor (const caseKey of caseKeys) {\n\t\tconst caseResult = expressionValue[caseKey]\n\t\tif (!isValidResult(caseResult)) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n\nfunction toOptionIcons(value: unknown): SegmentedControlIcon[] | StaticSwitch<SegmentedControlIcon[]> | undefined {\n\tif (isArray(value)) {\n\t\treturn toStringList(value) as SegmentedControlIcon[]\n\t} else if (isStaticSwitch(value, isArrayContainingControlIcons)) {\n\t\treturn value\n\t} else {\n\t\treturn undefined\n\t}\n}\n\nfunction toArray(value: unknown, itemControl: ArrayControlDescription[\"control\"]): unknown[] | undefined {\n\tif (!isArray(value)) return undefined\n\n\tswitch (itemControl.type) {\n\t\tcase ControlType.Boolean:\n\t\t\treturn value.filter(isBoolean)\n\t\tcase ControlType.Number:\n\t\t\treturn value.filter(isNumber)\n\t\tcase ControlType.String:\n\t\tcase ControlType.Enum:\n\t\tcase ControlType.SegmentedEnum:\n\t\tcase ControlType.Color:\n\t\t\treturn toStringList(value)\n\t\tcase ControlType.Object:\n\t\t\treturn value.map(item => toObjectDefault(item, itemControl.controls)).filter(Boolean)\n\t\tdefault:\n\t\t\treturn undefined\n\t}\n}\n\ntype ObjectPropertyType = ObjectPropertyControlDescription[\"type\"]\n\nconst allObjectPropertyTypes: Record<ObjectPropertyType, true> = {\n\t[ControlType.Number]: true,\n\t[ControlType.Enum]: true,\n\t[ControlType.Boolean]: true,\n\t[ControlType.String]: true,\n\t[ControlType.RichText]: true,\n\t[ControlType.Color]: true,\n\t[ControlType.SegmentedEnum]: true,\n\t[ControlType.Image]: true,\n\t[ControlType.ResponsiveImage]: true,\n\t[ControlType.File]: true,\n\t[ControlType.Transition]: true,\n\t[ControlType.BoxShadow]: true,\n\t[ControlType.Link]: true,\n\t[ControlType.Date]: true,\n\t[ControlType.Array]: true,\n\t[ControlType.Object]: true,\n\t[ControlType.FusedNumber]: true,\n\t[ControlType.Font]: true,\n\t[ControlType.PageScope]: true,\n\t[ControlType.ScrollSectionRef]: true,\n\t[ControlType.CustomCursor]: true,\n\t[ControlType.Border]: true,\n\t[ControlType.Cursor]: true,\n\t[ControlType.Padding]: true,\n\t[ControlType.BorderRadius]: true,\n\t[ControlType.Gap]: true,\n\t[ControlType.CollectionReference]: true,\n\t[ControlType.MultiCollectionReference]: true,\n\t[ControlType.TrackingId]: true,\n\t[ControlType.Location]: true,\n}\n\nfunction isObjectPropertyType(type: unknown): type is ObjectPropertyType {\n\treturn isString(type) && type in allObjectPropertyTypes\n}\n\nfunction toObjectDefault(\n\tvalue: unknown,\n\tcontrols: ObjectControlDescription[\"controls\"],\n): { [key: string]: unknown } | undefined {\n\tif (!isObject(value)) return undefined\n\n\tconst result: { [key: string]: unknown } = {}\n\n\tfor (const objectPropertyKey in controls) {\n\t\tconst objectPropertyControl = controls[objectPropertyKey]\n\t\tif (!isObject(objectPropertyControl)) continue\n\t\tif (!isObjectPropertyType(objectPropertyControl.type)) continue\n\n\t\tconst objectPropertyValue = value[objectPropertyKey]\n\n\t\tswitch (objectPropertyControl.type) {\n\t\t\tcase ControlType.Boolean:\n\t\t\t\tif (isBoolean(objectPropertyValue)) {\n\t\t\t\t\tresult[objectPropertyKey] = objectPropertyValue\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase ControlType.Color:\n\t\t\tcase ControlType.Enum:\n\t\t\tcase ControlType.SegmentedEnum:\n\t\t\tcase ControlType.String:\n\t\t\tcase ControlType.Date:\n\t\t\tcase ControlType.Cursor:\n\t\t\tcase ControlType.Gap:\n\t\t\tcase ControlType.Padding:\n\t\t\tcase ControlType.BorderRadius:\n\t\t\t\tif (isString(objectPropertyValue)) {\n\t\t\t\t\tresult[objectPropertyKey] = objectPropertyValue\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase ControlType.Number:\n\t\t\t\tif (isNumber(objectPropertyValue)) {\n\t\t\t\t\tresult[objectPropertyKey] = objectPropertyValue\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase ControlType.Transition:\n\t\t\t\tif (isObject(objectPropertyValue)) {\n\t\t\t\t\tresult[objectPropertyKey] = objectPropertyValue\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase ControlType.BoxShadow:\n\t\t\t\tif (isString(objectPropertyValue) || isArray(objectPropertyValue)) {\n\t\t\t\t\tresult[objectPropertyKey] = objectPropertyValue\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase ControlType.Border: {\n\t\t\t\tconst borderDefault = borderControlDefaultValueWithFallback(objectPropertyValue)\n\t\t\t\tif (borderDefault) {\n\t\t\t\t\tresult[objectPropertyKey] = borderDefault\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase ControlType.RichText:\n\t\t\tcase ControlType.Image:\n\t\t\tcase ControlType.ResponsiveImage:\n\t\t\tcase ControlType.File:\n\t\t\tcase ControlType.Link:\n\t\t\tcase ControlType.Array:\n\t\t\tcase ControlType.Object:\n\t\t\tcase ControlType.FusedNumber:\n\t\t\tcase ControlType.Font:\n\t\t\tcase ControlType.PageScope:\n\t\t\tcase ControlType.ScrollSectionRef:\n\t\t\tcase ControlType.CustomCursor:\n\t\t\tcase ControlType.CollectionReference:\n\t\t\tcase ControlType.MultiCollectionReference:\n\t\t\tcase ControlType.TrackingId:\n\t\t\tcase ControlType.Location:\n\t\t\t\t// These currently don't support object property default values\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tobjectPropertyControl satisfies never\n\t\t}\n\t}\n\n\treturn isEmptyObject(result) ? undefined : result\n}\n\nfunction inferDefaultTransitionType(transition: Record<string, unknown>): \"spring\" | \"tween\" {\n\tconst transitionKeys = new Set(Object.keys(transition))\n\n\tswitch (transition.type) {\n\t\tcase \"spring\":\n\t\tcase \"tween\": {\n\t\t\treturn transition.type\n\t\t}\n\t\tdefault: {\n\t\t\tif (transitionKeys.has(\"duration\") || transitionKeys.has(\"ease\")) {\n\t\t\t\treturn \"tween\"\n\t\t\t} else {\n\t\t\t\treturn \"spring\"\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction isArrayContainingControlIcons(value: unknown): value is SegmentedControlIcon[] {\n\treturn isArray(value) && value.every(isString)\n}\n\nfunction toSegmentedControlDirection(value: unknown): EnumControlDescription[\"segmentedControlDirection\"] {\n\tif (value !== \"horizontal\" && value !== \"vertical\") return undefined\n\treturn value\n}\n\nconst allBorderStyles: Record<BorderStyle, true> = {\n\tsolid: true,\n\tdashed: true,\n\tdotted: true,\n\tdouble: true,\n}\n\nfunction isBorderStyle(value: unknown): value is BorderStyle {\n\treturn isString(value) && value in allBorderStyles\n}\n\nfunction toCoordinateDefaultValue(value: unknown): Coordinate | undefined {\n\tif (!isObject(value)) return undefined\n\tif (!isNumber(value.latitude)) return undefined\n\tif (!isNumber(value.longitude)) return undefined\n\treturn { latitude: value.latitude, longitude: value.longitude }\n}\n\nfunction toLocationDefaultValue(value: unknown): Location | undefined {\n\tif (!isObject(value)) return undefined\n\tconst coordinate = toCoordinateDefaultValue(value.coordinate)\n\tif (!coordinate) return undefined\n\tconst result: Location = { coordinate }\n\tif (isString(value.title)) result.title = value.title\n\tif (isString(value.address)) result.address = value.address\n\treturn result\n}\n\nfunction borderControlDefaultValueWithFallback(value: unknown): Border | undefined {\n\tif (!isObject(value)) return\n\n\tconst result: Border & Record<string, unknown> = {}\n\n\tif (isString(value.borderColor)) result.borderColor = value.borderColor\n\tif (isBorderStyle(value.borderStyle)) result.borderStyle = value.borderStyle\n\tif (isNumber(value.borderTopWidth)) result.borderTopWidth = value.borderTopWidth\n\tif (isNumber(value.borderRightWidth)) result.borderRightWidth = value.borderRightWidth\n\tif (isNumber(value.borderBottomWidth)) result.borderBottomWidth = value.borderBottomWidth\n\tif (isNumber(value.borderLeftWidth)) result.borderLeftWidth = value.borderLeftWidth\n\tif (isNumber(value.borderWidth)) result.borderWidth = value.borderWidth\n\n\tif (isEmptyObject(result)) return undefined\n\n\treturn result\n}\n", "import type { ActionHandler } from \"library/render/types/Action.ts\"\nimport { addActionControls } from \"./actionControls.ts\"\n\n// This is a no-op hook that is implemented in code generation. The only purpose\n// of this hook is to become available in the actions UI.\nexport function useDismissOverlay(): ActionHandler {\n\treturn () => {}\n}\n\naddActionControls(useDismissOverlay, \"Close Overlay\", {})\n", "import type { ActionHandler } from \"library/render/types/Action.ts\"\nimport { addActionControls } from \"./actionControls.ts\"\n\n// This is a no-op hook that is implemented in code generation. The only purpose\n// of this hook is to become available in the actions UI.\nexport function useLoadMore(): ActionHandler {\n\treturn () => {}\n}\n\naddActionControls(useLoadMore, \"Load More\", {})\n", "import type { ActionHandler } from \"library/render/types/Action.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { addActionControls } from \"./actionControls.ts\"\n\ninterface LogOptions {\n\ttype: \"event\" | \"message\" | \"count\"\n\tmessage: string\n}\n\nexport function useLog(options: LogOptions): ActionHandler {\n\treturn (event: unknown) => {\n\t\tswitch (options.type) {\n\t\t\tcase \"event\":\n\t\t\t\t// Because our custom console is async, we need to persist the event. Otherwise React will re-use\n\t\t\t\t// the event object between events. See https://reactjs.org/docs/events.html#event-pooling for details.\n\t\t\t\tif (isReactEvent(event)) {\n\t\t\t\t\tevent.persist()\n\t\t\t\t}\n\t\t\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\t\t\tconsole.log(event)\n\t\t\t\tbreak\n\t\t\tcase \"message\":\n\t\t\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\t\t\tconsole.log(options.message)\n\t\t\t\tbreak\n\t\t\tcase \"count\":\n\t\t\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\t\t\tconsole.count(options.message)\n\t\t\t\tbreak\n\t\t}\n\t}\n}\n\naddActionControls(useLog, \"Console Log\", {\n\ttype: {\n\t\ttype: ControlType.Enum,\n\t\toptions: [\"event\", \"message\", \"count\"],\n\t\toptionTitles: [\"Event\", \"Message\", \"Count\"],\n\t\tdefaultValue: \"event\",\n\t\ttitle: \"Type\",\n\t},\n\tmessage: {\n\t\ttype: ControlType.String,\n\t\ttitle: \"Message\",\n\t\thidden(props) {\n\t\t\treturn props.type === \"event\"\n\t\t},\n\t},\n})\n\nfunction isObject(value: unknown): value is { [key: string]: unknown } {\n\treturn !!value && typeof value === \"object\"\n}\n\ninterface ReactEvent {\n\tpersist: () => void\n}\n\nfunction isReactEvent(value: unknown): value is ReactEvent {\n\tif (!isObject(value)) return false\n\treturn typeof value[\"persist\"] === \"function\"\n}\n", "import type { ActionHandler } from \"library/render/types/Action.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { addActionControls } from \"./actionControls.ts\"\n\nexport interface OpenURLOptions {\n\turl: string\n}\n\n/**\n * Performs similar work to open url action serialization in EventCollector. In\n * future one of these two files will no longer be required, depending on our\n * approach. E.g. if we decide to support Custom Actions in compiled code, we\n * can remove the code in EventCollector.\n */\nexport function useOpenURL(options: OpenURLOptions): ActionHandler {\n\treturn () => {\n\t\tconst { url } = options\n\t\tif (!url) return\n\t\tconst isLinkToElement = url.startsWith(\"#\")\n\t\tif (isLinkToElement) {\n\t\t\twindow.open(url, \"_self\")\n\t\t} else {\n\t\t\tconst validURL = url.includes(\":\") ? url : `http://${url}`\n\t\t\twindow.open(validURL, \"_blank\", \"noopener\")\n\t\t}\n\t}\n}\n\naddActionControls(useOpenURL, \"Open Link\", {\n\turl: { type: ControlType.String, placeholder: \"www.framer.com\", title: \"URL\" },\n})\n", "import type { ActionHandler } from \"library/render/types/Action.ts\"\nimport { addActionControls } from \"./actionControls.ts\"\n\n// This is a no-op hook that is implemented in code generation. The only purpose\n// of this hook is to become available in the actions UI.\n// eslint-disable-next-line @eslint-react/hooks-extra/no-redundant-custom-hook,@eslint-react/hooks-extra/no-unnecessary-use-prefix\nexport function useResetVariableValues(): ActionHandler {\n\treturn () => {}\n}\n\naddActionControls(useResetVariableValues, \"Reset Variables\", {})\n", "import type { ActionHandler } from \"library/render/types/Action.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { addActionControls } from \"./actionControls.ts\"\n\n// This is a no-op hook that is implemented in code generation. The only purpose\n// of this hook is to become available in the actions UI.\nexport function useSetLocale(): ActionHandler {\n\treturn () => {}\n}\n\naddActionControls(useSetLocale, \"Set Locale\", {\n\t// The enum variable will be set from Vekter using the global locale variable.\n\tlocaleId: { type: ControlType.Enum, title: \"Locale\", options: [\"default\"], optionTitles: [\"Default\"] },\n})\n", "import type { ActionHandler } from \"library/render/types/Action.ts\"\nimport { addActionControls } from \"./actionControls.ts\"\n\nexport interface SetVariableValueOptions {\n\tvariableId: string\n\tvalue: unknown\n}\n\n// This is a no-op hook that is implemented in code generation. The only purpose\n// of this hook is to become available in the actions UI.\n// eslint-disable-next-line @eslint-react/hooks-extra/no-redundant-custom-hook,@eslint-react/hooks-extra/no-unnecessary-use-prefix\nexport function useSetVariableValue(): ActionHandler {\n\treturn () => {}\n}\n\naddActionControls(useSetVariableValue, \"Set Variable\", {\n\t// The controls are set from Vekter because they depend on the variable.\n})\n", "import type { ActionHandler } from \"library/render/types/Action.ts\"\nimport { addActionControls } from \"./actionControls.ts\"\n\n// This is a no-op hook that is implemented in code generation. The only purpose\n// of this hook is to become available in the actions UI.\nexport function useShowOverlay(): ActionHandler {\n\treturn () => {}\n}\n\naddActionControls(useShowOverlay, \"Overlay\", {})\n", "import type { ActionHandler } from \"library/render/types/Action.ts\"\nimport { addActionControls } from \"./actionControls.ts\"\n\n// This is a no-op hook that is implemented in code generation. The only purpose\n// of this hook is to become available in the actions UI.\nexport function useShowRelativeOverlay(): ActionHandler {\n\treturn () => {}\n}\n\naddActionControls(useShowRelativeOverlay, \"Overlay\", {})\n", "import { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { addActionControls } from \"./actionControls.ts\"\n\nexport interface TriggerEventOptions {\n\tid: string\n}\n\n// This is a no-op hook that is implemented in code generation. The only purpose\n// of this hook is to become available in the actions UI.\nexport function useTriggerEvent(_: TriggerEventOptions) {\n\treturn () => {}\n}\n\naddActionControls(useTriggerEvent, \"Event\", {\n\tid: { type: ControlType.String },\n})\n", "import type { Action } from \"library/render/types/Action.ts\"\nimport type { SandboxEntityDefinition, SandboxEntityMap } from \"../componentLoader/types.ts\"\nimport { verifyActionControls } from \"../componentLoader/verifyPropertyControls.ts\"\nimport { getActionControls } from \"./actionControls.ts\"\nimport { useDismissOverlay } from \"./useDismissOverlay.ts\"\nimport { useLoadMore } from \"./useLoadMore.ts\"\nimport { useLog } from \"./useLog.ts\"\nimport { useNavigate } from \"./useNavigate.ts\"\nimport { useOpenURL } from \"./useOpenURL.ts\"\nimport { useResetVariableValues } from \"./useResetVariableValues.ts\"\nimport { useSetLocale } from \"./useSetLocale.ts\"\nimport { useSetVariableValue } from \"./useSetVariableValue.ts\"\nimport { useSetVariant } from \"./useSetVariant.ts\"\nimport { useShowOverlay } from \"./useShowOverlay.ts\"\nimport { useShowRelativeOverlay } from \"./useShowRelativeOverlay.ts\"\nimport { useTriggerEvent } from \"./useTriggerEvent.ts\"\n\ntype DefaultActionKey =\n\t| \"framer/useNavigate\"\n\t| \"framer/useOpenURL\"\n\t| \"framer/useDismissOverlay\"\n\t| \"framer/useLog\"\n\t| \"framer/useSetVariant\"\n\t| \"framer/useTriggerEvent\"\n\t| \"framer/useShowOverlay\"\n\t| \"framer/useShowRelativeOverlay\"\n\t| \"framer/useSetLocale\"\n\t| \"framer/useLoadMore\"\n\t| \"framer/useSetVariableValue\"\n\t| \"framer/useResetVariableValues\"\n\nconst defaultActionKeys: DefaultActionKey[] = [\n\t\"framer/useNavigate\",\n\t\"framer/useOpenURL\",\n\t\"framer/useDismissOverlay\",\n\t\"framer/useLog\",\n\t\"framer/useSetVariant\",\n\t\"framer/useTriggerEvent\",\n\t\"framer/useShowOverlay\",\n\t\"framer/useShowRelativeOverlay\",\n\t\"framer/useSetLocale\",\n\t\"framer/useLoadMore\",\n\t\"framer/useSetVariableValue\",\n\t\"framer/useResetVariableValues\",\n]\n\n// biome-ignore lint/suspicious/noExplicitAny: @TODO add explanation\nfunction actionForKey(key: DefaultActionKey): Action<any> {\n\tswitch (key) {\n\t\tcase \"framer/useNavigate\":\n\t\t\treturn useNavigate\n\t\tcase \"framer/useDismissOverlay\":\n\t\t\treturn useDismissOverlay\n\t\tcase \"framer/useShowOverlay\":\n\t\t\treturn useShowOverlay\n\t\tcase \"framer/useShowRelativeOverlay\":\n\t\t\treturn useShowRelativeOverlay\n\t\tcase \"framer/useOpenURL\":\n\t\t\treturn useOpenURL\n\t\tcase \"framer/useLoadMore\":\n\t\t\treturn useLoadMore\n\t\tcase \"framer/useLog\":\n\t\t\treturn useLog\n\t\tcase \"framer/useSetVariant\":\n\t\t\treturn useSetVariant\n\t\tcase \"framer/useTriggerEvent\":\n\t\t\treturn useTriggerEvent\n\t\tcase \"framer/useSetLocale\":\n\t\t\treturn useSetLocale\n\t\tcase \"framer/useSetVariableValue\":\n\t\t\treturn useSetVariableValue\n\t\tcase \"framer/useResetVariableValues\":\n\t\t\treturn useResetVariableValues\n\t}\n}\n\nexport const defaultActionsMap: SandboxEntityMap = {}\n\nfor (const defaultActionKey of defaultActionKeys) {\n\tconst action = actionForKey(defaultActionKey)\n\tconst actionControls = getActionControls(action)\n\tif (actionControls?.title && actionControls.controls) {\n\t\tconst definition: SandboxEntityDefinition = {\n\t\t\tclass: action,\n\t\t\tdepth: 1,\n\t\t\tfile: \"\",\n\t\t\tidentifier: defaultActionKey,\n\t\t\tname: actionControls.title,\n\t\t\tpackageIdentifier: \"framer\",\n\t\t\tproperties: verifyActionControls(actionControls.controls),\n\t\t\ttype: \"action\",\n\t\t\tupdate: 0,\n\t\t}\n\t\tdefaultActionsMap[defaultActionKey] = definition\n\t}\n}\n", "import { isLocalModuleIdentifier } from \"@framerjs/shared\"\nimport React from \"react\"\nimport { extractFileNameFromIdentifier } from \"./extractFileNameFromIdentifier.ts\"\nimport type { SandboxErrorDefinition } from \"./types.ts\"\n\nexport function createErrorDefinition(identifier: string, error: string, custom?: Partial<SandboxErrorDefinition>) {\n\tconst file = custom?.file ?? extractFileNameFromIdentifier(identifier)\n\tconst definition: SandboxErrorDefinition = {\n\t\tclass: createErrorComponentClass(error),\n\t\t// Assume a depth of 1 when non-local.\n\t\tdepth: identifier.startsWith(\".\") || isLocalModuleIdentifier(identifier) ? 0 : 1,\n\t\terror,\n\t\tfile,\n\t\tidentifier,\n\t\tname: cleanFilename(file),\n\t\tpackageIdentifier: \"<unknown>\",\n\t\tproperties: {},\n\t\ttype: \"component\",\n\t\tupdate: 0,\n\t\t...custom,\n\t}\n\treturn definition\n}\n\nfunction cleanFilename(filename: string) {\n\tif (filename.startsWith(\"./\")) {\n\t\treturn filename.slice(2)\n\t}\n\treturn filename\n}\n\nfunction createErrorComponentClass(error: string | Error): React.ComponentClass {\n\treturn class ErrorComponent extends React.Component {\n\t\t// eslint-disable-next-line react/require-render-return\n\t\toverride render(): React.ReactNode {\n\t\t\tthrow error\n\t\t}\n\t}\n}\n", "export function extractFileNameFromIdentifier(identifier: string): string {\n\tconst match = /(.*?\\.[tj]sx?)_.*/.exec(identifier)\n\tif (!match?.[1]) return identifier\n\treturn match[1]\n}\n", "export enum BuiltInFramerComponentIdentifier {\n\t/**\n\t * @deprecated Creating new Scroll components in Framer is no longer supported as of July 2025.\n\t * Existing Scroll components will continue to work, but please use alternative solutions for\n\t * new projects.\n\t */\n\tScroll = \"framer/Scroll\",\n\t/**\n\t * @deprecated Creating new Page components in Framer is no longer supported as of July 2025.\n\t * Existing Page components will continue to work, but please use alternative solutions for new\n\t * projects.\n\t */\n\tPage = \"framer/Page\",\n\tStack = \"framer/Stack\",\n\tDevice = \"__builtin/Device\",\n\tPrototype = \"framer/Prototype\",\n}\n\n// A \"fake\" package identifier for components built into the Framer app itself,\n// as opposed to those built into the Framer library.\nexport const BuiltInPackageIdentifier = \"__builtin\"\n\nexport const BUILT_IN_COMPONENT_IDENTIFIERS: string[] = Object.values(BuiltInFramerComponentIdentifier)\n", "import { DeviceCodeComponent } from \"library/components/Device/index.ts\"\nimport { Page } from \"library/components/Page/Page.tsx\"\nimport { Scroll } from \"library/components/Scroll/Scroll.tsx\"\nimport { Stack } from \"library/components/Stack/Stack.tsx\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { getPropertyControls } from \"library/utils/addPropertyControls.ts\"\nimport {\n\tBuiltInFramerComponentIdentifier,\n\tBuiltInPackageIdentifier,\n} from \"../../sandbox/componentLoader/BuiltInFramerComponentIdentifier.ts\"\nimport type { SerializedVerifiedPropertyControls } from \"../../sandbox/componentLoader/types.ts\"\nimport type { EntityMap } from \"./types.ts\"\n// Hardcoded because bundlers rename components, and we can\u2019t rely on `Function.name`\nexport const stackComponentName = \"Stack\"\n\n/**\n * @deprecated Creating new Scroll components in Framer is no longer supported as of July 2025.\n * Existing Scroll components will continue to work, but please use alternative solutions for new\n * projects.\n */\nexport const scrollComponentName = \"Scroll\"\n\n/**\n * @deprecated Creating new Page components in Framer is no longer supported as of July 2025.\n * Existing Page components will continue to work, but please use alternative solutions for new\n * projects.\n */\nexport const pageComponentName = \"Page\"\nexport const deviceComponentName = \"Device\"\nexport const prototypeComponentName = \"Prototype\"\nexport const defaultComponentDefinitions: EntityMap = {\n\t[BuiltInFramerComponentIdentifier.Stack]: {\n\t\tdepth: 1,\n\t\tfile: \"\",\n\t\tidentifier: BuiltInFramerComponentIdentifier.Stack,\n\t\tname: stackComponentName,\n\t\tpackageIdentifier: \"framer\",\n\t\t// Because the Stack comes from \"framer\", but the ComponentMap from \"framer/render\",\n\t\t// the PropertyControl types don't match up and we need this cast\n\t\tproperties: serializable(getPropertyControls(Stack)) as SerializedVerifiedPropertyControls,\n\t\ttype: \"component\",\n\t\tupdate: 0,\n\t},\n\t[BuiltInFramerComponentIdentifier.Scroll]: {\n\t\tdepth: 1,\n\t\tfile: \"\",\n\t\tidentifier: BuiltInFramerComponentIdentifier.Scroll,\n\t\tname: scrollComponentName,\n\t\tpackageIdentifier: \"framer\",\n\t\t// Because the Stack comes from \"framer\", but the ComponentMap from \"framer/render\",\n\t\t// the PropertyControl types don't match up and we need this cast\n\t\tproperties: {\n\t\t\t...serializable(getPropertyControls(Scroll)),\n\t\t\tchildren: {\n\t\t\t\ttitle: \"Content\",\n\t\t\t\ttype: ControlType.Slot,\n\t\t\t\tmaxCount: 1,\n\t\t\t},\n\t\t} as SerializedVerifiedPropertyControls,\n\t\ttype: \"component\",\n\t\tupdate: 0,\n\t},\n\t[BuiltInFramerComponentIdentifier.Page]: {\n\t\tdepth: 1,\n\t\tfile: \"\",\n\t\tidentifier: BuiltInFramerComponentIdentifier.Page,\n\t\tname: pageComponentName,\n\t\tpackageIdentifier: \"framer\",\n\t\t// Because the Stack comes from \"framer\", but the ComponentMap from \"framer/render\",\n\t\t// the PropertyControl types don't match up and we need this cast\n\t\tproperties: serializable(getPropertyControls(Page)) as SerializedVerifiedPropertyControls,\n\t\ttype: \"component\",\n\t\tupdate: 0,\n\t},\n\t[BuiltInFramerComponentIdentifier.Device]: {\n\t\tdepth: 1,\n\t\tfile: \"\",\n\t\tidentifier: BuiltInFramerComponentIdentifier.Device,\n\t\tname: deviceComponentName,\n\t\tpackageIdentifier: BuiltInPackageIdentifier,\n\t\tproperties: serializable(getPropertyControls(DeviceCodeComponent)) as SerializedVerifiedPropertyControls,\n\t\ttype: \"component\",\n\t\tupdate: 0,\n\t},\n}\n\nfunction serializable(obj: {} | undefined): {} | undefined {\n\treturn JSON.parse(JSON.stringify(obj))\n}\n", "import type { ModuleIdentifier } from \"@framerjs/shared\"\nimport { assert, getLogger, withExportSpecifier } from \"@framerjs/shared\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { getFonts } from \"library/utils/addFonts.ts\"\nimport { getPropertyControls } from \"library/utils/addPropertyControls.ts\"\nimport { isString } from \"library/utils/utils.ts\"\nimport { singular } from \"pluralize\"\nimport type { ComponentType } from \"react\"\nimport type { ItemToSlug } from \"../../crossorigin/index.ts\"\nimport type { EntityType } from \"../../host/componentLoader/types.ts\"\nimport { getActionControls } from \"../actions/actionControls.ts\"\nimport { BUILT_IN_COMPONENT_IDENTIFIERS } from \"./BuiltInFramerComponentIdentifier.ts\"\nimport {\n\tisSandboxShaderDefinition,\n\ttype EntityInfo,\n\ttype SandboxDataDefinition,\n\ttype SandboxEntityDefinition,\n\ttype SandboxPackageInfo,\n\ttype SandboxReactComponentDefinition,\n} from \"./types.ts\"\nimport { verifyActionControls, verifyPropertyControls } from \"./verifyPropertyControls.ts\"\nimport { warn } from \"./warn.ts\"\n\nconst log = getLogger(\"collectEntities\")\n\n/** Information representing the context of one or more components. */\nexport interface ComponentsContext {\n\tpackageInfo: SandboxPackageInfo\n\n\tfile?: string\n\tidentifierPrefix?: string\n\t/** If this entity is from a module, holds information about which module. */\n\tmoduleIdentifier?: ModuleIdentifier\n\tupdate?: number\n}\n\nfunction prefixIdentifier(packageInfo: SandboxPackageInfo, identifier: string, prefix = \"\") {\n\t// Prefix all non-local identifiers with the package name followed by a slash.\n\tif (packageInfo.depth > 0) {\n\t\tprefix = `${packageInfo.name}/${prefix}`\n\t}\n\treturn `${prefix}${identifier}`\n}\n\nfunction getEntityName(entity: unknown): string | undefined {\n\tif (!isObject(entity) || typeof entity.userInterfaceName !== \"string\") {\n\t\treturn undefined\n\t}\n\treturn entity.userInterfaceName\n}\n\nfunction safeObject<T extends Record<string, unknown> | undefined | null>(value: T): T {\n\tif (!value) return value\n\treturn JSON.parse(JSON.stringify(value))\n}\n\n/** Default values for asset references (ResponsiveImage controls) aren't copied by default - here we extract them for shaders. */\nfunction captureShaderDefaultTextures(propertyControls: Record<string, unknown>): Record<string, unknown> {\n\tconst normalizedControls: Record<string, unknown> = { ...propertyControls }\n\n\tfor (const key in propertyControls) {\n\t\tconst control = propertyControls[key]\n\t\tif (!isObject(control)) continue\n\t\tif (control.type !== ControlType.ResponsiveImage) continue\n\t\tif (typeof control.defaultValue !== \"string\") continue\n\t\tif (typeof control.__defaultAssetReference === \"string\") continue\n\n\t\tnormalizedControls[key] = {\n\t\t\t...control,\n\t\t\t__defaultAssetReference: control.defaultValue,\n\t\t}\n\t}\n\n\treturn normalizedControls\n}\n\nexport function entityDefinitionFromInfo(\n\tinfo: EntityInfo,\n\t// biome-ignore lint/suspicious/noExplicitAny: @TODO add explanation\n\tentity: any,\n\t{ identifierPrefix, packageInfo, file, moduleIdentifier, update }: ComponentsContext,\n\titemToSlug?: ItemToSlug,\n): SandboxEntityDefinition {\n\tlet identifier: string\n\tif (moduleIdentifier) {\n\t\t// This is a module identifier. Add the export specifier to it.\n\t\tassert(info.exportSpecifier, \"export specifier was missing for\", info.name)\n\t\tmoduleIdentifier = withExportSpecifier(moduleIdentifier, info.exportSpecifier)\n\t\tidentifier = moduleIdentifier.value\n\t} else {\n\t\t// This is an NPM package identifier. Add the export name to it.\n\t\tidentifier = prefixIdentifier(packageInfo, info.name, identifierPrefix)\n\t}\n\n\tlet { type } = info\n\n\t// Built-in components aren't processed with Analyzer during the build\n\t// instead their entityInfo is taken from the Library's package.json\n\t// that info may lack \"type\" field for some Library versions,\n\t// so if that is the case we manually assign `type` to such components\n\tif (!type) {\n\t\tif (!BUILT_IN_COMPONENT_IDENTIFIERS.includes(identifier)) {\n\t\t\twarn(`Entity info '${info.name}' doesn't have \"type\", assuming \"component\"`)\n\t\t}\n\t\ttype = \"component\"\n\t}\n\n\tconst sandboxEntity: SandboxEntityDefinition = {\n\t\tclass: entity,\n\t\tdepth: packageInfo.depth,\n\t\tfile: file ?? \"\",\n\t\tidentifier,\n\t\tname: getEntityName(entity) ?? info.name,\n\t\tpackageIdentifier: packageInfo.name,\n\t\tproperties: {},\n\t\tfonts: undefined,\n\t\ttype,\n\t\t// Make annotations safe in case someone put in a function or something.\n\t\tannotations: safeObject(info.annotations),\n\t\tupdate: update ?? 0,\n\t}\n\n\tif (type === \"action\") {\n\t\tconst actionInfo = getActionControls(entity)\n\t\tif (actionInfo?.controls) {\n\t\t\tsandboxEntity.properties = verifyActionControls(actionInfo.controls)\n\t\t}\n\t\tif (actionInfo?.title) {\n\t\t\tsandboxEntity.name = actionInfo.title\n\t\t}\n\t\treturn sandboxEntity\n\t}\n\n\tif (withDisplayName(entity)) {\n\t\tsandboxEntity.name = entity.displayName\n\t}\n\n\tif (type === \"data\") {\n\t\tconst dataDefinition = sandboxEntity as SandboxDataDefinition\n\n\t\tconst properties = getPropertyControls(entity)\n\t\tif (properties) {\n\t\t\t// TODO: Assert this if we don't have any logged errors.\n\t\t\tdataDefinition.properties = {\n\t\t\t\tid: {\n\t\t\t\t\ttitle: singular(dataDefinition.name),\n\t\t\t\t\ttype: ControlType.CollectionReference,\n\t\t\t\t\tdataIdentifier: dataDefinition.identifier,\n\t\t\t\t},\n\t\t\t\t...properties,\n\t\t\t}\n\t\t} else {\n\t\t\tlog.reportError(new Error(\"Property controls not found for collection.\"))\n\t\t}\n\n\t\tdataDefinition.itemToSlug = itemToSlug\n\n\t\treturn dataDefinition\n\t}\n\n\t// For shaders, the property controls are directly on the entity (shader config object)\n\t// returned from defineShader(), not attached via addPropertyControls.\n\tif (isSandboxShaderDefinition(sandboxEntity)) {\n\t\tif (isObject(entity) && isObject(entity.propertyControls)) {\n\t\t\tsandboxEntity.properties = verifyPropertyControls(captureShaderDefaultTextures(entity.propertyControls))\n\t\t}\n\t\tif (isObject(entity) && isString(entity.title)) {\n\t\t\tsandboxEntity.title = entity.title\n\t\t}\n\t\treturn sandboxEntity\n\t}\n\n\tconst componentControls = getPropertyControls(entity)\n\tif (componentControls) {\n\t\tconst defaultProps = isReactComponent(entity, type) ? entity.defaultProps : undefined\n\t\tsandboxEntity.properties = verifyPropertyControls(componentControls, defaultProps)\n\t}\n\tif (info.children && !sandboxEntity.properties.children) {\n\t\tsandboxEntity.properties.children = {\n\t\t\ttitle: \"Content\",\n\t\t\ttype: ControlType.Slot,\n\t\t\tmaxCount: 1,\n\t\t}\n\t}\n\n\tsandboxEntity.fonts = getFonts(entity)\n\n\tif (!isReactComponent(entity, type)) {\n\t\treturn sandboxEntity\n\t}\n\n\t// Legacy (build-service-based) components will be automatically wrapped\n\t// in the withMeasuredSize HOC, and may therefore render twice to ensure\n\t// that a numeric value can be provided as the `width` and `height` prop\n\t// to the component. This ensures that we don't break existing\n\t// components as users transition away from using these props.\n\t//\n\t// If we manage to successfully detect that the component is using the\n\t// width and height prop in its source, we'll show a warning in the\n\t// console.\n\n\tconst reactComponentDefinition = Object.assign(sandboxEntity, {\n\t\ttype: \"component\",\n\t\tdefaultProps: undefined,\n\t}) as SandboxReactComponentDefinition\n\n\treturn reactComponentDefinition\n}\n\nfunction isReactComponent(entity: unknown, type: EntityType | undefined): entity is ComponentType<unknown> {\n\treturn type === \"component\"\n}\n\ninterface WithDisplayName {\n\tdisplayName: string\n}\n\nfunction isObject(value: unknown): value is { [key: string]: unknown } {\n\treturn !!value && typeof value === \"object\"\n}\n\nfunction isFunction(value: unknown): value is Function {\n\treturn typeof value === \"function\"\n}\n\nfunction withDisplayName<T>(entity: T): entity is T & WithDisplayName {\n\tif (!isObject(entity) && !isFunction(entity)) return false\n\tif (!(\"displayName\" in entity)) return false\n\tconst displayName = entity.displayName\n\treturn typeof displayName === \"string\" && displayName.trim().length > 0\n}\n", "export function warn(message: string, error?: unknown) {\n\tif (process.env.NODE_ENV === \"test\") return\n\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\tconsole.log(\n\t\t\"%c Loader: %c \" + message,\n\t\t\"color: white; font-weight: bold; background-color: #EE4444; border-radius: 5px; padding: 2px 5px\",\n\t\t\"color: #EE4444\",\n\t)\n\tif (!error) return\n\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\tconsole.warn(error)\n}\n", "import { DeviceCodeComponent } from \"library/components/Device/index.ts\"\nimport { Page } from \"library/components/Page/Page.tsx\"\nimport { Scroll } from \"library/components/Scroll/Scroll.tsx\"\nimport { Stack } from \"library/components/Stack/Stack.tsx\"\nimport {\n\tdeviceComponentName,\n\tpageComponentName,\n\tprototypeComponentName,\n\tscrollComponentName,\n\tstackComponentName,\n} from \"../../host/componentLoader/defaultComponentDefinitions.ts\"\nimport { BuiltInFramerComponentIdentifier, BuiltInPackageIdentifier } from \"./BuiltInFramerComponentIdentifier.ts\"\nimport { entityDefinitionFromInfo } from \"./collectEntities.ts\"\nimport type { SandboxEntityMap, SandboxPackageInfo } from \"./types.ts\"\n\n// Components built into the Framer library.\nconst defaultFramerPackageInfo: SandboxPackageInfo = {\n\tname: \"framer\",\n\tdisplayName: \"framer\",\n\tdepth: 1,\n\texportsObject: {},\n\tdependencies: {},\n\tsourceModules: {},\n}\n\n// Components built into the Framer app itself. Not an actual package.\nconst builtInPackageInfo: SandboxPackageInfo = {\n\tname: BuiltInPackageIdentifier,\n\tdisplayName: \"Built-in\",\n\tdepth: 1,\n\texportsObject: {},\n\tdependencies: {},\n\tsourceModules: {},\n}\n\nexport const defaultComponentsMap: SandboxEntityMap = {\n\t[BuiltInFramerComponentIdentifier.Stack]: entityDefinitionFromInfo(\n\t\t{ name: stackComponentName, children: undefined, type: undefined },\n\t\tStack,\n\t\t{\n\t\t\tpackageInfo: defaultFramerPackageInfo,\n\t\t},\n\t),\n\t[BuiltInFramerComponentIdentifier.Scroll]: entityDefinitionFromInfo(\n\t\t{ name: scrollComponentName, children: true, type: undefined },\n\t\tScroll,\n\t\t{\n\t\t\tpackageInfo: defaultFramerPackageInfo,\n\t\t},\n\t),\n\t[BuiltInFramerComponentIdentifier.Page]: entityDefinitionFromInfo(\n\t\t{ name: pageComponentName, children: undefined, type: undefined },\n\t\tPage,\n\t\t{\n\t\t\tpackageInfo: defaultFramerPackageInfo,\n\t\t},\n\t),\n\t[BuiltInFramerComponentIdentifier.Prototype]: entityDefinitionFromInfo(\n\t\t{ name: prototypeComponentName, children: undefined, type: undefined },\n\t\tDeviceCodeComponent,\n\t\t{\n\t\t\tpackageInfo: defaultFramerPackageInfo,\n\t\t},\n\t),\n\t[BuiltInFramerComponentIdentifier.Device]: entityDefinitionFromInfo(\n\t\t{ name: deviceComponentName, children: undefined, type: undefined },\n\t\tDeviceCodeComponent,\n\t\t{\n\t\t\tpackageInfo: builtInPackageInfo,\n\t\t},\n\t),\n}\n", "import {\n\tModuleType,\n\terrorIdentifierFromModuleIdentifier,\n\tisLocalModuleIdentifier,\n\tparseModuleIdentifier,\n} from \"@framerjs/shared\"\nimport type { EntityIdentifier } from \"../../host/componentLoader/types.ts\"\nimport { defaultActionsMap } from \"../actions/defaultActionsMap.ts\"\nimport { createErrorDefinition } from \"./createErrorDefinition.ts\"\nimport { defaultComponentsMap } from \"./defaultComponentsMap.ts\"\nimport type {\n\tSandboxDataDefinition,\n\tSandboxEntityDefinition,\n\tSandboxErrorDefinition,\n\tSandboxReactComponentDefinition,\n\tSandboxRenderableComponentDefinition,\n\tSandboxShaderDefinition,\n\tVerifiedPropertyControls,\n} from \"./types.ts\"\nimport {\n\tisSandboxDataDefinition,\n\tisSandboxErrorDefinition,\n\tisSandboxReactComponentDefinition,\n\tisSandboxRenderableComponentDefinition,\n\tisSandboxShaderDefinition,\n} from \"./types.ts\"\n\ntype TestSandboxEntityDefinition<T extends SandboxEntityDefinition> = Pick<T, \"identifier\" | \"type\"> &\n\tOmit<Partial<T>, \"identifier\" | \"type\">\n\ntype AnyTestSandboxEntityDefinition =\n\t| TestSandboxEntityDefinition<SandboxEntityDefinition>\n\t| TestSandboxEntityDefinition<SandboxDataDefinition>\n\t| TestSandboxEntityDefinition<SandboxReactComponentDefinition>\n\nexport class SandboxComponentLoader {\n\treadonly environment = \"sandbox\"\n\n\tprivate localModulesInitialized = false\n\treadonly entities = new Map<string, SandboxEntityDefinition>()\n\n\tconstructor() {\n\t\tfor (const id in defaultComponentsMap) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion -- `in` loop needs this\n\t\t\tthis.entities.set(id, defaultComponentsMap[id]!)\n\t\t}\n\n\t\tfor (const id in defaultActionsMap) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion -- `in` loop needs this\n\t\t\tthis.entities.set(id, defaultActionsMap[id]!)\n\t\t}\n\t}\n\n\tpublic componentForIdentifier(identifier: EntityIdentifier): SandboxEntityDefinition | null {\n\t\treturn this.entities.get(identifier) ?? null\n\t}\n\n\tpublic reactComponentForIdentifier(identifier: EntityIdentifier): SandboxReactComponentDefinition | null {\n\t\tconst definition = this.componentForIdentifier(identifier)\n\t\tif (!definition || !isSandboxReactComponentDefinition(definition)) return null\n\t\treturn definition\n\t}\n\n\tpublic getPropertyControlsForIdentifier(identifier: EntityIdentifier): VerifiedPropertyControls | null {\n\t\tconst definition = this.componentForIdentifier(identifier)\n\t\treturn definition?.properties ?? null\n\t}\n\n\tpublic renderableComponentForIdentifier(identifier: EntityIdentifier): SandboxRenderableComponentDefinition | null {\n\t\tconst definition = this.componentForIdentifier(identifier)\n\t\tif (!definition || !isSandboxRenderableComponentDefinition(definition)) return null\n\t\treturn definition\n\t}\n\n\tpublic dataForIdentifier(identifier: EntityIdentifier | null | undefined): SandboxDataDefinition | null {\n\t\tif (!identifier) return null\n\t\tconst definition = this.componentForIdentifier(identifier)\n\t\tif (!definition || !isSandboxDataDefinition(definition)) return null\n\t\treturn definition\n\t}\n\n\tpublic shaderForIdentifier(identifier: EntityIdentifier): SandboxShaderDefinition | null {\n\t\tconst definition = this.componentForIdentifier(identifier)\n\t\tif (!definition || !isSandboxShaderDefinition(definition)) return null\n\t\treturn definition\n\t}\n\n\tpublic errorForIdentifier(identifier: EntityIdentifier): SandboxErrorDefinition | null {\n\t\tconst parsedId = parseModuleIdentifier(identifier)\n\t\tif (!parsedId) {\n\t\t\treturn createErrorDefinition(identifier, \"Components that are not modules do not exist.\", {\n\t\t\t\tfileDoesNotExist: true,\n\t\t\t})\n\t\t}\n\n\t\tconst errorIdentifier = errorIdentifierFromModuleIdentifier(parsedId)\n\t\tconst isError = parsedId.value === errorIdentifier\n\n\t\tconst entity = this.entities.get(errorIdentifier)\n\t\tif (isSandboxErrorDefinition(entity)) return entity\n\n\t\tif (isLocalModuleIdentifier(parsedId) || (isError && this.localModulesInitialized)) {\n\t\t\t// The component doesn't exist, return that as error.\n\t\t\tlet message = \"Component does not exist.\"\n\t\t\tif (isLocalModuleIdentifier(parsedId) && parsedId.type === ModuleType.Code) {\n\t\t\t\tmessage = \"Component file does not exist.\"\n\t\t\t}\n\t\t\treturn createErrorDefinition(identifier, message, { fileDoesNotExist: true })\n\t\t}\n\n\t\treturn null\n\t}\n\n\tpublic setLocalModulesInitialized(initialized: boolean) {\n\t\tthis.localModulesInitialized = initialized\n\t}\n\n\tpublic updateModuleEntities(entities: SandboxEntityDefinition[]) {\n\t\tfor (const entityDefinition of entities) {\n\t\t\tconst id = entityDefinition.identifier\n\t\t\tthis.entities.set(id, entityDefinition)\n\t\t}\n\t}\n\n\tpublic deleteModuleEntities(entityIds: EntityIdentifier[]) {\n\t\tfor (const id of entityIds) {\n\t\t\tthis.entities.delete(id)\n\t\t}\n\t}\n\n\treadonly testing = {\n\t\tsetEntity: (definition: AnyTestSandboxEntityDefinition) => {\n\t\t\tthis.entities.set(definition.identifier, definition as SandboxEntityDefinition)\n\t\t},\n\t\tclearEntities: () => {\n\t\t\tthis.entities.clear()\n\t\t},\n\t}\n}\n", "import type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport type { Link } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport type { SupportedLinkRelValue } from \"document/models/SupportedRelValue.ts\"\nimport type { RawControlProps } from \"document/models/controlProps/RawControlProp.ts\"\nimport type { BackgroundMaskAttrs } from \"prosemirror/schema/backgroundMask.ts\"\nimport type { BlockStyles, InlineStyles } from \"prosemirror/styles.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\n\n/**\n * WIP rich text JSON schema used by the current HTML -> JSON migration work.\n *\n */\nexport type RichTextId = string\n\nexport type RichTextTextBlockTag = \"p\" | \"div\" | \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\"\nexport type RichTextDirection = \"auto\" | \"ltr\" | \"rtl\" | \"inherit\"\nexport type RichTextModuleWidth = \"fill\" | \"fit\"\nexport type RichTextModuleAlignment = \"left\" | \"center\" | \"right\"\n\ninterface RichTextDocumentCapabilities {\n\treadonly media: boolean\n\treadonly embeds: boolean\n\treadonly links: boolean\n\treadonly styles: boolean\n\treadonly blockquotes: boolean\n\treadonly tables: boolean\n}\n\n// Single source of truth for variant capabilities. Adding a variant here updates the variant union, capability aliases,\n// and runtime guards.\nconst richTextDocumentCapabilities = {\n\tcollectionControlProp: {\n\t\tmedia: true,\n\t\tembeds: true,\n\t\tlinks: true,\n\t\tstyles: false,\n\t\tblockquotes: true,\n\t\ttables: true,\n\t},\n\tcollectionControlPropLocalized: {\n\t\tmedia: true,\n\t\tembeds: true,\n\t\tlinks: true,\n\t\tstyles: false,\n\t\tblockquotes: true,\n\t\ttables: true,\n\t},\n\tcontrolProp: {\n\t\tmedia: false,\n\t\tembeds: false,\n\t\tlinks: true,\n\t\tstyles: false,\n\t\tblockquotes: false,\n\t\ttables: false,\n\t},\n\tcontrolPropLocalized: {\n\t\tmedia: false,\n\t\tembeds: false,\n\t\tlinks: true,\n\t\tstyles: false,\n\t\tblockquotes: false,\n\t\ttables: false,\n\t},\n\trichTextNode: {\n\t\tmedia: false,\n\t\tembeds: false,\n\t\tlinks: true,\n\t\tstyles: true,\n\t\tblockquotes: false,\n\t\ttables: false,\n\t},\n\trichTextNodeLocalized: {\n\t\tmedia: false,\n\t\tembeds: false,\n\t\tlinks: true,\n\t\tstyles: true,\n\t\tblockquotes: false,\n\t\ttables: false,\n\t},\n} as const satisfies Record<string, RichTextDocumentCapabilities>\n\ntype RichTextDocumentCapabilityMap = typeof richTextDocumentCapabilities\n\nexport type RichTextDocumentVariant = keyof RichTextDocumentCapabilityMap\nexport type LocalizedRichTextDocumentVariant = Extract<RichTextDocumentVariant, `${string}Localized`>\nexport type RichTextDocumentCapability = keyof RichTextDocumentCapabilities\ntype VariantsSupportingCapability<Capability extends RichTextDocumentCapability> = {\n\t[Variant in RichTextDocumentVariant]: RichTextDocumentCapabilityMap[Variant][Capability] extends true\n\t\t? Variant\n\t\t: never\n}[RichTextDocumentVariant]\n// Fields require every possible variant to support a capability. Blocks only require one possible variant, because\n// callers reading an unknown rich text document still need to handle every block shape that could be stored.\ntype EveryVariantSupportsCapability<\n\tV extends RichTextDocumentVariant,\n\tCapability extends RichTextDocumentCapability,\n> = [V] extends [VariantsSupportingCapability<Capability>] ? true : false\ntype SomeVariantSupportsCapability<V extends RichTextDocumentVariant, Capability extends RichTextDocumentCapability> = [\n\tExtract<V, VariantsSupportingCapability<Capability>>,\n] extends [never]\n\t? false\n\t: true\n\ntype RichTextDocumentWithCapability<\n\tV extends RichTextDocumentVariant,\n\tCapability extends RichTextDocumentCapability,\n> = RichTextDocument<Extract<V, VariantsSupportingCapability<Capability>>> & {\n\treadonly variant: Extract<V, VariantsSupportingCapability<Capability>>\n}\n\nexport interface RichTextDocument<V extends RichTextDocumentVariant = RichTextDocumentVariant> {\n\treadonly type: \"richText\"\n\treadonly variant: V\n\tchildren: RichTextBlock<V>[]\n}\n\nexport interface RichTextTextBlockBase<V extends RichTextDocumentVariant = RichTextDocumentVariant> {\n\tid: RichTextId\n\ttype: \"textBlock\"\n\ttag: RichTextTextBlockTag\n\ttextDirection: RichTextDirection\n\tchildren: RichTextInline<V>[]\n}\n\nexport interface RichTextTextBlockWithStyles {\n\tblockStyles?: BlockStyles\n\tbackgroundMask?: BackgroundMaskAttrs\n}\n\nexport type RichTextTextBlock<V extends RichTextDocumentVariant = RichTextDocumentVariant> = RichTextTextBlockBase<V> &\n\t(EveryVariantSupportsCapability<V, \"styles\"> extends true ? RichTextTextBlockWithStyles : unknown)\n\nexport interface RichTextBulletedListBlock<V extends RichTextDocumentVariant = RichTextDocumentVariant> {\n\tid: RichTextId\n\ttype: \"bulletedList\"\n\t// Direction is stored on the list container; child blocks may still carry explicit direction overrides.\n\ttextDirection: RichTextDirection\n\tchildren: RichTextListItem<V>[]\n}\n\nexport interface RichTextNumberedListBlock<V extends RichTextDocumentVariant = RichTextDocumentVariant> {\n\tid: RichTextId\n\ttype: \"numberedList\"\n\t// Direction is stored on the list container; child blocks may still carry explicit direction overrides.\n\ttextDirection: RichTextDirection\n\tlistStyleType: string\n\tstart: number\n\tchildren: RichTextListItem<V>[]\n}\n\nexport type RichTextListBlock<V extends RichTextDocumentVariant = RichTextDocumentVariant> =\n\t| RichTextBulletedListBlock<V>\n\t| RichTextNumberedListBlock<V>\n\nexport interface RichTextListItem<V extends RichTextDocumentVariant = RichTextDocumentVariant> {\n\tid: RichTextId\n\ttype: \"listItem\"\n\tchildren: RichTextBlock<V>[]\n}\n\nexport interface RichTextBlockquoteBlock<V extends RichTextDocumentVariant = RichTextDocumentVariant> {\n\tid: RichTextId\n\ttype: \"blockquote\"\n\tchildren: RichTextBlock<V>[]\n}\n\nexport interface RichTextMediaBlock {\n\tid: RichTextId\n\ttype: \"media\"\n\tsrc: string\n\talt?: string\n\tpixelWidth?: number\n\tpixelHeight?: number\n\tmediaType: \"image\" | \"video\"\n\tlink?: RichTextLink\n}\n\nexport interface RichTextModuleBlock {\n\tid: RichTextId\n\ttype: \"module\"\n\tidentifier: ModuleExportIdentifierString\n\tprops: RawControlProps\n\twidth?: RichTextModuleWidth\n\talignment?: RichTextModuleAlignment\n}\n\nexport interface RichTextTableBlock<V extends RichTextDocumentVariant = RichTextDocumentVariant> {\n\tid: RichTextId\n\ttype: \"table\"\n\tchildren: RichTextTableRow<V>[]\n}\n\nexport interface RichTextTableRow<V extends RichTextDocumentVariant = RichTextDocumentVariant> {\n\tid: RichTextId\n\ttype: \"tableRow\"\n\tchildren: RichTextTableCell<V>[]\n}\n\nexport const richTextTableCellTypes = [\"header\", \"cell\"] as const\nexport type RichTextTableCellType = (typeof richTextTableCellTypes)[number]\n\nexport function isRichTextTableCellType(value: unknown): value is RichTextTableCellType {\n\treturn isString(value) && richTextTableCellTypes.some(cellType => value === cellType)\n}\n\nexport interface RichTextTableCell<V extends RichTextDocumentVariant = RichTextDocumentVariant> {\n\tid: RichTextId\n\ttype: \"tableCell\"\n\tcellType: RichTextTableCellType\n\tchildren: RichTextBlock<V>[]\n}\n\nexport type RichTextBlock<V extends RichTextDocumentVariant = RichTextDocumentVariant> =\n\t| RichTextTextBlock<V>\n\t| RichTextListBlock<V>\n\t| (SomeVariantSupportsCapability<V, \"blockquotes\"> extends true ? RichTextBlockquoteBlock<V> : never)\n\t| (SomeVariantSupportsCapability<V, \"media\"> extends true ? RichTextMediaBlock : never)\n\t| (SomeVariantSupportsCapability<V, \"embeds\"> extends true ? RichTextModuleBlock : never)\n\t| (SomeVariantSupportsCapability<V, \"tables\"> extends true ? RichTextTableBlock<V> : never)\n\nexport interface RichTextTextBase {\n\tid: RichTextId\n\ttype: \"text\"\n\ttext: string\n\tbold?: true\n\titalic?: true\n\tinlineCode?: true\n\tlink?: RichTextLink\n}\n\nexport interface RichTextTextWithStyles {\n\tinlineStyles?: InlineStyles\n}\n\nexport type RichTextText<V extends RichTextDocumentVariant = RichTextDocumentVariant> = RichTextTextBase &\n\t(EveryVariantSupportsCapability<V, \"styles\"> extends true ? RichTextTextWithStyles : unknown)\n\nexport interface RichTextLineBreak {\n\tid: RichTextId\n\ttype: \"lineBreak\"\n}\n\nexport type RichTextInline<V extends RichTextDocumentVariant = RichTextDocumentVariant> =\n\t| RichTextText<V>\n\t| RichTextLineBreak\n\nexport interface RichTextLink {\n\tlink: Link\n\topenInNewTab?: boolean\n\tsmoothScroll?: boolean\n\tclickTrackingId?: string\n\trelValues?: readonly SupportedLinkRelValue[]\n\tpreserveParams?: boolean\n}\n\nexport function isRichTextDocumentVariant(value: unknown): value is RichTextDocumentVariant {\n\treturn isString(value) && value in richTextDocumentCapabilities\n}\n\nexport function isLocalizedRichTextDocumentVariant(value: unknown): value is LocalizedRichTextDocumentVariant {\n\treturn isRichTextDocumentVariant(value) && value.endsWith(\"Localized\")\n}\n\nexport function supportsRichTextDocumentCapability<\n\tV extends RichTextDocumentVariant,\n\tCapability extends RichTextDocumentCapability,\n>(\n\tdocument: RichTextDocument<V>,\n\tcapability: Capability,\n): document is RichTextDocument<V> & RichTextDocumentWithCapability<V, Capability> {\n\treturn document.variant !== undefined && richTextDocumentCapabilities[document.variant][capability]\n}\n", "import { assert } from \"@framerjs/shared\"\nimport type { RichTextDocument } from \"./RichTextDocument.ts\"\nimport { isRichTextDocumentVariant } from \"./RichTextDocument.ts\"\n\nexport type RichTextTreeValue = string | RichTextDocument\n\nexport function isRichTextDocument(value: unknown): value is RichTextDocument {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"type\" in value &&\n\t\tvalue.type === \"richText\" &&\n\t\t\"variant\" in value &&\n\t\tisRichTextDocumentVariant(value.variant) &&\n\t\t\"children\" in value &&\n\t\tArray.isArray(value.children)\n\t)\n}\n\nexport function isRichTextTreeValue(value: unknown): value is RichTextTreeValue {\n\treturn typeof value === \"string\" || isRichTextDocument(value)\n}\n\nexport function assertRichTextTreeValueIsHTML(value: unknown, context: string): asserts value is string {\n\tassert(\n\t\ttypeof value === \"string\",\n\t\t`${context}: Rich text value is stored as JSON here, but this path still expects HTML.`,\n\t)\n}\n", "import { isNull } from \"utils/typeChecks.ts\"\nimport type { CanvasTree } from \"../../CanvasTree.ts\"\nimport { isReplicaChild } from \"../../traits/WithTemplate.ts\"\nimport type { IsBreakpoint, IsVariant } from \"../../traits/WithVariant.ts\"\nimport { isBreakpointVariant, isVariant } from \"../../traits/WithVariant.ts\"\nimport type { CanvasNode } from \"../CanvasNode.ts\"\nimport type { MaybeNodeID, NodeID } from \"../NodeID.ts\"\nimport type { LoadedWebPageNode } from \"../WebPageNode.ts\"\nimport { isWebPageNode } from \"./nodeCheck.ts\"\n\nexport function isInBreakpoint(tree: CanvasTree, nodeId: NodeID) {\n\tconst breakpoint = getBreakpointForNode(tree, nodeId)\n\treturn !isNull(breakpoint)\n}\n\n/**\n * If a node is in a breakpoint, return the breakpoint ground node. This will\n * either be a primary variant or a replica breakpoint. We avoid recursing\n * through the tree by directly getting the node based on either\n * cache.masterAncestorId or cache.replicaAncestorId. If neither of these cache\n * values are set, we are not in a breakpoint and cannot determine the node.\n */\nexport function getBreakpointForNode(tree: CanvasTree, nodeId: NodeID): (CanvasNode & IsVariant & IsBreakpoint) | null {\n\tconst maybeBreakpoint = getVariantForNode(tree, nodeId)\n\n\tif (maybeBreakpoint && isBreakpointVariant(maybeBreakpoint)) return maybeBreakpoint\n\n\treturn null\n}\n\n/**\n * Get the variant for a given node. If the node itself is a variant, return the node. If allowCache\n * is true, it will try to use the cache values as a shortcut first to get the variant, falling back\n * to walking up the tree if not found in the cache.\n */\nexport function getVariantForNode(\n\ttree: CanvasTree,\n\tnodeId: NodeID,\n\tallowCache: boolean = true,\n): (CanvasNode & IsVariant) | null {\n\tconst node = tree.get(nodeId)\n\tif (!node) return null\n\n\tif (isVariant(node)) return node\n\n\tif (allowCache) {\n\t\tlet maybeVariantId: MaybeNodeID = null\n\t\tif (isReplicaChild(node)) {\n\t\t\tmaybeVariantId = node.cache.replicaAncestorId\n\t\t} else if (node.cache.masterAncestorId) {\n\t\t\tmaybeVariantId = node.cache.masterAncestorId\n\t\t}\n\n\t\tif (maybeVariantId) {\n\t\t\tconst variant = tree.getNode(maybeVariantId)\n\t\t\tif (!variant || !isVariant(variant)) return null\n\t\t\treturn variant\n\t\t}\n\t}\n\n\tconst variant = tree.getGroundNodeFor(node)\n\tif (!variant || !isVariant(variant)) return null\n\treturn variant\n}\n\n// This is a cheaper version of tree.getWebPageNodeFor that relies on the node cache.\nexport function unsafeGetWebPageForNode(tree: CanvasTree, nodeId: NodeID): LoadedWebPageNode | null {\n\tconst breakpoint = getBreakpointForNode(tree, nodeId)\n\tif (!breakpoint || !breakpoint.parentid) return null\n\n\tconst webPageNode = tree.getScopeNodeFor(breakpoint)\n\tif (!webPageNode || !isWebPageNode(webPageNode)) return null\n\n\treturn webPageNode\n}\n\nexport function isChildOfBreakpoint(tree: CanvasTree, node: CanvasNode) {\n\treturn node.parentid && isBreakpointVariant(tree.get(node.parentid))\n}\n", "import { isNumber, isObject, isString } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\nimport type FrameNode from \"../nodes/FrameNode.ts\"\nimport type { NodeID } from \"../nodes/NodeID.ts\"\nimport type { AnyScopeNode } from \"../nodes/ScopeNode.ts\"\nimport type { WithReplicaVariants } from \"./WithReplicaVariants.ts\"\nimport type { IsReplica } from \"./WithTemplate.ts\"\nimport type { IsBreakpoint, IsPrimaryVariant, IsTopLevelVariant, IsVariant } from \"./WithVariant.ts\"\n\nexport interface Breakpoint {\n\tmin?: number\n\tmax?: number\n\t/**\n\t * Layout Template breakpoints can record a class name that when applied to\n\t * the parent dom node of the the layout template instance, will render a\n\t * specific breakpoint without the screen being at the correct size. This is\n\t * used on the canvas to render the correct breakpoint that matches the\n\t * canvas size.\n\t */\n\tcanvasClassName?: string\n\t/**\n\t * The minimum height of the layout template at this breakpoint. It mirrors the fixed height of\n\t * the breakpoint in the layout template.\n\t */\n\tminHeight?: number\n\t/** The fixed width of the breakpoint. It usually matches either min or max of a breakpoint,\n\t * except for the biggest/smallest breakpoint. */\n\twidth?: number\n\t/**\n\t * The viewport height set on the breakpoint.\n\t */\n\tviewportHeight?: number\n\t/**\n\t * Name of the breakpoint.\n\t */\n\tname?: string\n\t/**\n\t * The root font size set on the breakpoint. This is what `rem` font size units\n\t * are rendered relative to per breakpoint.\n\t */\n\trootFontSize?: number\n}\n\nexport type Breakpoints = Record<NodeID, Breakpoint>\n\nexport interface WithBreakpointVariants extends WithReplicaVariants {\n\tgetPrimaryVariant(): FrameNode & IsPrimaryVariant & IsBreakpoint\n\tgetReplicaVariants(): (FrameNode & IsReplica & IsVariant & IsBreakpoint)[]\n\tgetTopLevelReplicaVariants(): (FrameNode & IsReplica & IsTopLevelVariant & IsBreakpoint)[]\n\tgetTopLevelVariants(): [\n\t\tFrameNode & IsPrimaryVariant & IsBreakpoint,\n\t\t...(FrameNode & IsReplica & IsTopLevelVariant & IsBreakpoint)[],\n\t]\n\tgetVariants(): [FrameNode & IsPrimaryVariant & IsBreakpoint, ...(FrameNode & IsReplica & IsBreakpoint)[]]\n\n\tgetBreakpointValues(): Breakpoints\n}\n\nconst withBreakpointVariantsKey: keyof WithBreakpointVariants = \"getBreakpointValues\"\nexport function withBreakpointVariants<N extends CanvasNode | AnyScopeNode>(\n\tnode: N | null | undefined,\n): node is N & WithBreakpointVariants {\n\tif (!node) return false\n\treturn withBreakpointVariantsKey in node\n}\n\nconst minKey: keyof Breakpoint = \"min\"\nconst maxKey: keyof Breakpoint = \"max\"\nconst canvasClassNameKey: keyof Breakpoint = \"canvasClassName\"\nfunction isBreakpoint(breakpoint: unknown): breakpoint is Breakpoint {\n\tif (!isObject(breakpoint)) return false\n\tif (minKey in breakpoint) return isNumber(breakpoint.min)\n\tif (maxKey in breakpoint) return isNumber(breakpoint.max)\n\tif (canvasClassNameKey in breakpoint) return isString(breakpoint.canvasClassName)\n\treturn false\n}\n\nexport function isBreakpoints(values: unknown): values is Breakpoints {\n\tif (!isObject(values)) return false\n\tfor (const key in values) {\n\t\tconst breakpoint = values[key]\n\t\tif (isBreakpoint(breakpoint)) return true\n\t}\n\treturn false\n}\n", "import type { AnyComponentLoader } from \"@framerjs/framer-runtime\"\nimport type { LocalModuleExportIdentifierString } from \"@framerjs/shared\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { LayerProps } from \"library/render/presentation/Layer.tsx\"\nimport type { Rect } from \"library/render/types/Rect.ts\"\nimport type { ParentSizeInfo } from \"./WithRect.ts\"\n\nexport interface WithDOMLayout {\n\t/**\n\t * Determines whether this node is using a DOMRect, and caches the result.\n\t * If a cached value is available already, it will be returned. If you need\n\t * to check whether a node should be using a DOMRect, it's recommended that\n\t * you use this method over its non-cached alternative `usesDOMRect`.\n\t */\n\tusesDOMRectCached(): boolean\n\n\t/**\n\t * Determines whether this node is using a DOMRect. Since the result of\n\t * this method isn't cached, it should be used sparingly. When in doubt, use\n\t * the cached `usesDOMRectCached` method.\n\t */\n\tusesDOMRect(): boolean\n\n\t/**\n\t * Determines whether this node should use a layout template rect, and caches the result.\n\t */\n\tusesLayoutTemplateRectForModuleIdentifierCached(): LocalModuleExportIdentifierString | undefined\n\n\t/**\n\t * Determines whether this node should use a layout template rect. For example,\n\t * a breakpoint variant with a layout template applied could use the layout\n\t * template rect instead of its DOMRect. The result is not cached, so please use\n\t * `usesLayoutTemplateRectCached()` if possible.\n\t */\n\tusesLayoutTemplateRectForModuleIdentifier(): LocalModuleExportIdentifierString | undefined\n\n\t/**\n\t * Resets the cached values for `usesDOMRect` and `domRect`.\n\t */\n\tinvalidateDOMRect(): void\n\n\t/** Returns the latest DOMRect from the layout cache if one is available */\n\tgetDOMRect(): Rect | null\n\n\t/**\n\t * Overrides CanvasNode's `rect` to return the DOMRect for this node if one\n\t * is available AND if it should be used for this node. If none of those\n\t * conditions are true, it will hand off the rect call to its superclass.\n\t *\n\t * Note that due to the idiosyncrasies of the browser's paint behavior, DOM\n\t * rects will never be pixelAligned, and the `pixelAlign` argument will be ignored.\n\t */\n\trect: (parentSizeInfo: ParentSizeInfo | null, pixelAlign: boolean) => Rect\n\n\t/**\n\t * Adds DOM layout-specific props like _needsMeasure to the result of\n\t * `getProps`, so they can be used during rendering.\n\t */\n\tgetProps(componentLoader: AnyComponentLoader): Partial<LayerProps>\n}\n\nconst key: keyof WithDOMLayout = \"usesDOMRect\"\n\nexport function withDOMLayout(node: CanvasNode): node is CanvasNode & WithDOMLayout {\n\treturn key in node\n}\n", "import type { Breakpoints } from \"document/models/CanvasTree/traits/WithBreakpointVariants.ts\"\nimport { isUndefined } from \"./typeChecks.ts\"\n\n/**\n * Return the active breakpoint based on the current width. The active breakpoint\n * is the breakpoint that the width falls into.\n *\n * Given breakpoints:\n * Desktop: min: 1024px\n * Tablet: min: 768px, max: 1023px\n * Mobile: max: 767px\n *\n * For a width of 800px the active breakpoint is Tablet.\n * For a width of 500px the active breakpoint is Mobile.\n * For a width of 1200px the active breakpoint is Desktop.\n */\nexport function findActiveBreakpointId(breakpoints: Breakpoints | undefined, width: number): string | undefined {\n\tif (isUndefined(breakpoints)) return undefined\n\tfor (const breakpointId in breakpoints) {\n\t\tconst breakpoint = breakpoints[breakpointId]\n\t\tconst min = breakpoint?.min ?? 0\n\t\tconst max = breakpoint?.max ?? Infinity\n\t\tif (width >= min && width <= max) {\n\t\t\treturn breakpointId\n\t\t}\n\t}\n\treturn undefined\n}\n", "import type { ComponentLoader, EntityDefinition } from \"@framerjs/framer-runtime\"\nimport { AnnotationKey } from \"@framerjs/framer-runtime/crossorigin\"\nimport type { LocalModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { findActiveBreakpointId } from \"utils/getActiveBreakpoint.ts\"\nimport type { CanvasTree } from \"../CanvasTree.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\nimport type { AnyScopeNode } from \"../nodes/ScopeNode.ts\"\nimport { withDOMLayout } from \"./WithDOMLayout.ts\"\nimport { isBreakpointVariant } from \"./WithVariant.ts\"\n\nexport interface WithLayoutTemplate {\n\t/**\n\t * Currently active layout template identifier. A web page with an `undefined` layoutTemplateIdentifier will try to\n\t * look up the layout template on the root (accessed via the home page). `null` means the web page has removed the\n\t * layout template, ignoring the root value.\n\t */\n\tlayoutTemplateIdentifier: LocalModuleExportIdentifierString | undefined | null\n}\n\n// The actual layout template identifier set on a node is stored in the (private) layoutTemplateIdentifierOverride\n// field, and exposed via the getter/setter. Assign the default value to the private field without triggering the\n// setter.\nexport const layoutTemplateOverrideDefaults = {\n\tlayoutTemplateIdentifierOverride: undefined,\n}\n\nconst key: keyof WithLayoutTemplate = \"layoutTemplateIdentifier\"\n\nexport function withLayoutTemplate<N extends CanvasNode | AnyScopeNode>(\n\tnode: N | null | undefined,\n): node is N & WithLayoutTemplate {\n\tif (!node) return false\n\treturn key in node\n}\n\nexport function getLayoutTemplateForBreakpoint<N extends CanvasNode>(\n\ttree: CanvasTree,\n\tnode: N | null | undefined,\n): LocalModuleExportIdentifierString | undefined | null {\n\tif (!node || !isBreakpointVariant(node)) return\n\n\tconst scope = tree.getScopeNodeFor(node)\n\tif (!withLayoutTemplate(scope)) return\n\n\treturn scope.layoutTemplateIdentifier\n}\n\nexport interface HasLayoutTemplate {\n\tlayoutTemplateIdentifier: LocalModuleExportIdentifierString\n}\n\nexport function hasLayoutTemplate<N extends CanvasNode | AnyScopeNode>(\n\tnode: N | null | undefined,\n): node is N & HasLayoutTemplate {\n\treturn Boolean(withLayoutTemplate(node) && node.layoutTemplateIdentifier)\n}\n\nexport function isBreakpointWithLayoutTemplate(node: CanvasNode | null | undefined) {\n\tif (!node || !withDOMLayout(node)) return false\n\treturn !!node.usesLayoutTemplateRectForModuleIdentifierCached()\n}\n\n/** @TODO - Duplicated in CanvasLayoutTemplate.tsx with rudimentary caching. */\nfunction getActiveBreakpoint(\n\tannotations: Exclude<EntityDefinition[\"annotations\"], null | undefined>,\n\tbreakpointWidth: number,\n): string | undefined {\n\tconst defaultVariant = annotations[AnnotationKey.FramerDefaultVariant]\n\tconst breakpointAnnotation = annotations[AnnotationKey.FramerBreakpoints]\n\tif (!breakpointAnnotation) return defaultVariant\n\n\tconst breakpoints = JSON.parse(breakpointAnnotation)\n\n\treturn findActiveBreakpointId(breakpoints, breakpointWidth) ?? defaultVariant\n}\n\nexport function activeLayoutTemplateBreakpoint(identifier: string, componentLoader: ComponentLoader, width: number) {\n\tconst annotations = componentLoader.componentForIdentifier(identifier)?.annotations\n\tif (!annotations) return undefined\n\treturn getActiveBreakpoint(annotations, width)\n}\n", "import { AnnotationKey, type ParsedAnnotations } from \"@framerjs/framer-runtime/crossorigin\"\nimport type { LocalModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { assert, ModuleType, parseModuleIdentifier } from \"@framerjs/shared\"\nimport type { ModulesStore } from \"document/stores/ModulesStore.ts\"\nimport { findActiveBreakpointId } from \"utils/getActiveBreakpoint.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport type { CanvasTree } from \"../../CanvasTree.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport type { NodeID } from \"../../nodes/NodeID.ts\"\nimport type { RootNode } from \"../../nodes/RootNode.ts\"\nimport type { LoadedScopeNode } from \"../../nodes/ScopeNode.ts\"\nimport { getBreakpointForNode } from \"../../nodes/utils/breakpointHelpers.ts\"\nimport { isLayoutTemplateNode, isWebPageNode } from \"../../nodes/utils/nodeCheck.ts\"\nimport { isBreakpoints } from \"../WithBreakpointVariants.ts\"\nimport { getLayoutTemplateForBreakpoint, isBreakpointWithLayoutTemplate } from \"../WithLayoutTemplate.ts\"\nimport { DEFAULT_ROOT_FONT_SIZE, hasRootFontSize } from \"../WithRootFontSize.ts\"\nimport { withSize } from \"../WithSize.ts\"\n\nexport const ROOT_FONT_SIZE_CSS_PROPERTY = \"--framer-root-font-size\"\n\n/**\n * Gets the root font size for a given node.\n *\n * If the caller has passed in a specific node and it's on a page (Web Page or Layout Template),\n * we then check for the root font size of its breakpoint. If the node is on a breakpoint, we\n * return that variant's root font size or the default.\n *\n * If no node is passed in, or it's not under a breakpoint (like if it's a Smart Component),\n * we try to get the root font size from the active scope's primary variant (breakpoint).\n *\n * If that is not possible either, then we get the root font size from the home page's Layout\n * Template's annotated root font size or the primary breakpoint's root font size.\n */\nexport function getRootFontSize(\n\tactiveScope: LoadedScopeNode,\n\ttree: CanvasTree,\n\tmodulesStore: ModulesStore,\n\tnodeId?: NodeID,\n): number | undefined {\n\tif (nodeId) {\n\t\tconst size = getRootFontSizeForNodeInBreakpoint(tree, nodeId, modulesStore)\n\t\tif (isNumber(size)) return size\n\t}\n\n\tif (isLayoutTemplateNode(activeScope)) {\n\t\treturn activeScope.getPrimaryVariant().rootFontSize\n\t}\n\n\tif (isWebPageNode(activeScope)) {\n\t\tconst layoutTemplateIdentifier = activeScope.layoutTemplateIdentifier\n\t\tif (!layoutTemplateIdentifier) {\n\t\t\treturn activeScope.getPrimaryVariant().rootFontSize\n\t\t}\n\t\treturn getRootFontSizeFromLayoutTemplate(layoutTemplateIdentifier, modulesStore)\n\t}\n\n\t// If the scope is not a Web Page or Layout Template, we always want to get the\n\t// root font size defined on the Home Page's Layout Template annotation or\n\t// Screen annotation.\n\treturn getPrimaryRootFontSize(tree.root, modulesStore)\n}\n\nfunction getRootFontSizeForNodeInBreakpoint(\n\ttree: CanvasTree,\n\tnodeId: NodeID,\n\tmodulesStore: ModulesStore,\n): number | undefined {\n\tconst breakpointNode = getBreakpointForNode(tree, nodeId)\n\tif (!breakpointNode) return\n\n\tif (isBreakpointWithLayoutTemplate(breakpointNode)) {\n\t\treturn getRootFontSizeFromLayoutTemplateBreakpoint(tree, modulesStore, breakpointNode)\n\t}\n\n\t// If there is no root font size defined on the breakpoint, then we return the default value,\n\t// as the that node might not have been updated yet. Reducing the font size on a Breakpoint without\n\t// a value yet falls back to the default value.\n\treturn hasRootFontSize(breakpointNode) ? breakpointNode.rootFontSize : DEFAULT_ROOT_FONT_SIZE\n}\n\n/**\n * Gets the root font size for a particular breakpoint from a Layout Template. For example,\n * on a page other than the home page and/or a breakpoint other than the default one.\n *\n * If there is no root font size defined on the breakpoint, then we return the default value,\n * as the that node might not have been updated yet. Reducing the font size on a Breakpoint without\n * a value yet falls back to the default value.\n */\nfunction getRootFontSizeFromLayoutTemplateBreakpoint(\n\ttree: CanvasTree,\n\tmodulesStore: ModulesStore,\n\tbreakpointNode: CanvasNode,\n): number {\n\tconst identifier = getLayoutTemplateForBreakpoint(tree, breakpointNode)\n\tif (!identifier) return DEFAULT_ROOT_FONT_SIZE\n\n\tconst localId = parseModuleIdentifier(identifier)?.localId\n\tif (!localId) return DEFAULT_ROOT_FONT_SIZE\n\n\tconst breakpointAnnotation = modulesStore\n\t\t.forType(ModuleType.LayoutTemplate)\n\t\t.getByLocalId(localId)\n\t\t.annotations(null, \"default\")?.[AnnotationKey.FramerBreakpoints]\n\n\tif (!breakpointAnnotation || !isBreakpoints(breakpointAnnotation)) return DEFAULT_ROOT_FONT_SIZE\n\n\tassert(withSize(breakpointNode), \"Breakpoint node must have size properties\")\n\n\tconst activeBreakpointId = findActiveBreakpointId(breakpointAnnotation, breakpointNode.width)\n\n\treturn activeBreakpointId && isNumber(breakpointAnnotation[activeBreakpointId]?.rootFontSize)\n\t\t? breakpointAnnotation[activeBreakpointId].rootFontSize\n\t\t: DEFAULT_ROOT_FONT_SIZE\n}\n\n/**\n * Gets the root font size used on the Home Page's primary breakpoint. We derive this value\n * from either the Layout Template's annotations, if an LT is on the root node, or from the\n * Home Page's Screen annotation.\n */\nfunction getPrimaryRootFontSize(root: RootNode, modulesStore: ModulesStore): number | undefined {\n\tif (root.layoutTemplateIdentifier) {\n\t\treturn getRootFontSizeFromLayoutTemplate(root.layoutTemplateIdentifier, modulesStore)\n\t}\n\n\tif (!root.homePageNodeId) return\n\n\tconst annotations = modulesStore\n\t\t.forType(ModuleType.Screen)\n\t\t.getByStableName(root.homePageNodeId)\n\t\t.annotations(null, \"default\")\n\treturn getRootFontSizeFromAnnotation(annotations)\n}\n\n/**\n * Gets the root font size from a Layout Template's high-level annotation.\n */\nfunction getRootFontSizeFromLayoutTemplate(\n\tlayoutTemplateIdentifier: LocalModuleExportIdentifierString,\n\tmodulesStore: ModulesStore,\n): number | undefined {\n\tconst parsed = parseModuleIdentifier(layoutTemplateIdentifier)\n\tconst annotations = modulesStore\n\t\t.forType(ModuleType.LayoutTemplate)\n\t\t.getByLocalId(parsed.localId)\n\t\t.annotations(null, parsed.exportSpecifier)\n\treturn getRootFontSizeFromAnnotation(annotations)\n}\n\nfunction getRootFontSizeFromAnnotation(annotations: ParsedAnnotations | undefined): number | undefined {\n\tif (!annotations) return\n\n\tconst rootFontSize = annotations[AnnotationKey.FramerRootFontSize]\n\tif (!isNumber(rootFontSize)) return\n\n\treturn rootFontSize\n}\n", "import { isAssetReference } from \"@framerjs/assets\"\nimport type {\n\tVerifiedArrayControlDescription,\n\tVerifiedControlDescription,\n\tVerifiedObjectControlDescription,\n\tVerifiedPropertyControls,\n} from \"@framerjs/framer-runtime\"\nimport { isDefaultResponsiveImage } from \"@framerjs/framer-runtime/sandbox\"\nimport { assertNever, isEmptyObject, isModuleExportIdentifier, shouldBeNever } from \"@framerjs/shared\"\nimport { getInterFontSelectorFromVariant } from \"document/utils/interFonts.ts\"\nimport type { Border, WithOptional } from \"library/render/types/PropertyControls.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { useMemo } from \"react\"\nimport type { Mutable } from \"utils/Mutable.ts\"\nimport { isArray, isBoolean, isNull, isNullish, isNumber, isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { isValidPropertyValueType } from \"../../components/chrome/properties/codeComponentRows/utils/isValidPropertyValue.ts\"\nimport { randomID } from \"../CanvasTree/nodes/NodeID.ts\"\nimport { isComputedValue } from \"../CanvasTree/traits/ComputedValue.ts\"\nimport { isDynamicValue } from \"../CanvasTree/traits/DynamicValue.ts\"\nimport type { VariableReference } from \"../CanvasTree/traits/VariableReference.ts\"\nimport { isVariableReference } from \"../CanvasTree/traits/VariableReference.ts\"\nimport type { BorderValues } from \"../CanvasTree/traits/WithBorder.ts\"\nimport { fallbackCursor, isCSSCursor } from \"../CanvasTree/traits/WithCursor.ts\"\nimport { getLink, isLink, isLinkToWebPage } from \"../CanvasTree/traits/utils/Link.ts\"\nimport { parseBorderString } from \"../CanvasTree/traits/utils/reduceFormInputFocusedStyles.ts\"\nimport { isEventAction } from \"../EventAction.ts\"\nimport { isSupportedLinkRelValueArray } from \"../SupportedRelValue.ts\"\nimport type { Transition } from \"../Transition.ts\"\nimport { fallbackPhysicsBasedSpringTransition, isPartialTransition, toVekterTransition } from \"../Transition.ts\"\nimport { isRichTextDocument } from \"../richText/richTextStorage.ts\"\nimport {\n\tborderValueDefaults,\n\tfromBorderReactCSSProperties,\n\tisBorderStyle,\n\tisBorderValues,\n} from \"./BorderControlPropValue.ts\"\nimport { getBoxShadow, getBoxShadowFromControlDefault } from \"./BoxShadowControlPropValue.ts\"\nimport type {\n\tArrayControlPropValue,\n\tArrayValue,\n\tBooleanControlPropValue,\n\tBorderControlPropValue,\n\tBorderRadiusControlPropValue,\n\tBoxShadowControlPropValue,\n\tCollectionReferenceControlPropValue,\n\tColorControlPropValue,\n\tControlProp,\n\tControlProps,\n\tCursorControlPropValue,\n\tCustomCursorControlPropValue,\n\tDateControlPropValue,\n\tEnumControlPropValue,\n\tEventHandlerControlPropValue,\n\tFileControlPropValue,\n\tGapControlPropValue,\n\tImageControlProp,\n\tImageControlPropValue,\n\tLinkControlProp,\n\tLinkControlPropValue,\n\tLinkRelValuesControlPropValue,\n\tLocationControlProp,\n\tLocationControlPropValue,\n\tMultiCollectionReferenceControlPropValue,\n\tNumberControlPropValue,\n\tObjectControlPropValue,\n\tPaddingControlPropValue,\n\tPageScopeControlPropValue,\n\tRichTextControlProp,\n\tRichTextControlPropValue,\n\tScrollSectionRefControlPropValue,\n\tSlotControlProp,\n\tSlotControlPropValue,\n\tStringControlProp,\n\tStringControlPropValue,\n\tTrackingIdControlPropValue,\n\tTransitionControlPropValue,\n\tVectorSetItemControlPropValue,\n} from \"./ControlProp.ts\"\nimport {\n\tisArrayControlPropValue,\n\tisBorderRadiusControlPropValue,\n\tisCollectionReferenceControlPropValue,\n\tisGapControlPropValue,\n\tisLocation,\n\tisLocationControlPropValue,\n\tisMultiCollectionReferenceControlPropValue,\n\tisPaddingControlPropValue,\n\twithId,\n} from \"./ControlProp.ts\"\nimport type { FontControlPropRawValue, FontControlPropValue } from \"./FontControlPropValue.ts\"\nimport { defaultFontValuesForOptionalKeys, isRawFontValue } from \"./FontControlPropValue.ts\"\nimport type { FusedNumberControlPropValue, RawFusedNumberControlProp } from \"./FusedNumberControlPropValue.ts\"\nimport {\n\tcreateFusedNumberControlPropValue,\n\tisFusedNumberControlPropValue,\n\tisRawFusedNumberControlProp,\n} from \"./FusedNumberControlPropValue.ts\"\nimport type { RawControlProp } from \"./RawControlProp.ts\"\nimport { isRawControlProp } from \"./RawControlProp.ts\"\nimport { hasControlAltLocalized, withControlAltText } from \"./WithControlAltText.ts\"\nimport { withControlFocalPoint } from \"./WithControlFocalPoint.ts\"\nimport { withControlIsFused } from \"./WithControlIsFused.ts\"\nimport { controlTypesAreCompatible } from \"./controlTypesAreCompatible.ts\"\nimport { hasControlValueLocalized } from \"./hasControlValueLocalized.ts\"\n\nfunction isCompatibleRawControlProp(type: ControlType, rawControlProp: unknown): rawControlProp is RawControlProp {\n\tif (!isRawControlProp(rawControlProp)) return false\n\tif (rawControlProp.type === null) return true\n\treturn controlTypesAreCompatible(type, rawControlProp.type)\n}\n\nfunction isCompatibleRawControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Array }>,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp & { value: ArrayControlPropValue }\nfunction isCompatibleRawControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Boolean }>,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp & { value: BooleanControlPropValue }\nfunction isCompatibleRawControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Color }>,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp & { value: ColorControlPropValue }\nfunction isCompatibleRawControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Slot }>,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp & { value: SlotControlPropValue }\nfunction isCompatibleRawControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Date }>,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp & { value: DateControlPropValue }\nfunction isCompatibleRawControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Enum | ControlType.SegmentedEnum }>,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp & { value: EnumControlPropValue }\nfunction isCompatibleRawControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.EventHandler }>,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp & { value: EventHandlerControlPropValue }\nfunction isCompatibleRawControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.File }>,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp & { value: FileControlPropValue }\nfunction isCompatibleRawControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.FusedNumber }>,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp & { value: FusedNumberControlPropValue }\nfunction isCompatibleRawControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Link }>,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp & { value: LinkControlPropValue }\nfunction isCompatibleRawControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.LinkRelValues }>,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp & { value: LinkRelValuesControlPropValue }\nfunction isCompatibleRawControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.PageScope }>,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp & { value: PageScopeControlPropValue }\nfunction isCompatibleRawControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Number }>,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp & { value: NumberControlPropValue }\nfunction isCompatibleRawControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Object }>,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp & { value: ObjectControlPropValue }\nfunction isCompatibleRawControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.RichText }>,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp & { value: RichTextControlPropValue }\nfunction isCompatibleRawControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.String }>,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp & { value: StringControlPropValue }\nfunction isCompatibleRawControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Transition }>,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp & { value: Partial<Transition> | VariableReference }\nfunction isCompatibleRawControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.BoxShadow }>,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp & { value: BoxShadowControlPropValue }\nfunction isCompatibleRawControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Image | ControlType.ResponsiveImage }>,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp & { value: ImageControlPropValue }\nfunction isCompatibleRawControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Font }>,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp & { value: FontControlPropValue }\nfunction isCompatibleRawControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.ScrollSectionRef }>,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp & { value: ScrollSectionRefControlPropValue }\nfunction isCompatibleRawControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.CustomCursor }>,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp & { value: CustomCursorControlPropValue }\nfunction isCompatibleRawControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Border }>,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp & { value: BorderControlPropValue }\nfunction isCompatibleRawControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Cursor }>,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp & { value: CursorControlPropValue }\nfunction isCompatibleRawControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Padding }>,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp & {\n\tvalue: FusedNumberControlPropValue | NumberControlPropValue | PaddingControlPropValue\n}\nfunction isCompatibleRawControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.BorderRadius }>,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp & {\n\tvalue: FusedNumberControlPropValue | NumberControlPropValue | BorderRadiusControlPropValue\n}\nfunction isCompatibleRawControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.CollectionReference }>,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp & { value: CollectionReferenceControlPropValue }\nfunction isCompatibleRawControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.MultiCollectionReference }>,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp & { value: MultiCollectionReferenceControlPropValue }\nfunction isCompatibleRawControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.TrackingId }>,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp & { value: TrackingIdControlPropValue }\nfunction isCompatibleRawControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.VectorSetItem }>,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp & { value: VectorSetItemControlPropValue }\nfunction isCompatibleRawControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Location }>,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp & { value: LocationControlPropValue }\nfunction isCompatibleRawControlPropValue(\n\tcontrol: VerifiedControlDescription,\n\trawControlProp: unknown,\n): rawControlProp is RawControlProp {\n\treturn (\n\t\tisCompatibleRawControlProp(control.type, rawControlProp) && isValidControlPropValue(control, rawControlProp.value)\n\t)\n}\n\nfunction isValidControlPropValueForType(type: ControlType.Array, rawValue: unknown): rawValue is unknown[]\nfunction isValidControlPropValueForType(\n\ttype: ControlType.Boolean,\n\trawValue: unknown,\n): rawValue is BooleanControlPropValue\nfunction isValidControlPropValueForType(type: ControlType.Color, rawValue: unknown): rawValue is ColorControlPropValue\nfunction isValidControlPropValueForType(type: ControlType.Slot, rawValue: unknown): rawValue is SlotControlPropValue\nfunction isValidControlPropValueForType(type: ControlType.Date, rawValue: unknown): rawValue is DateControlPropValue\nfunction isValidControlPropValueForType(\n\ttype: ControlType.Enum | ControlType.SegmentedEnum,\n\trawValue: unknown,\n): rawValue is EnumControlPropValue\nfunction isValidControlPropValueForType(\n\ttype: ControlType.EventHandler,\n\trawValue: unknown,\n): rawValue is EventHandlerControlPropValue\nfunction isValidControlPropValueForType(type: ControlType.File, rawValue: unknown): rawValue is FileControlPropValue\nfunction isValidControlPropValueForType(\n\ttype: ControlType.FusedNumber,\n\trawValue: unknown,\n): rawValue is FusedNumberControlPropValue\nfunction isValidControlPropValueForType(type: ControlType.Link, rawValue: unknown): rawValue is LinkControlPropValue\nfunction isValidControlPropValueForType(type: ControlType.Number, rawValue: unknown): rawValue is NumberControlPropValue\nfunction isValidControlPropValueForType(type: ControlType.Object, rawValue: unknown): rawValue is ObjectControlPropValue\nfunction isValidControlPropValueForType(\n\ttype: ControlType.RichText,\n\trawValue: unknown,\n): rawValue is RichTextControlPropValue\nfunction isValidControlPropValueForType(type: ControlType.String, rawValue: unknown): rawValue is StringControlPropValue\nfunction isValidControlPropValueForType(\n\ttype: ControlType.Transition,\n\trawValue: unknown,\n): rawValue is Partial<Transition> | VariableReference\nfunction isValidControlPropValueForType(\n\ttype: ControlType.Image | ControlType.ResponsiveImage,\n\trawValue: unknown,\n): rawValue is ImageControlPropValue\nfunction isValidControlPropValueForType(type: ControlType.Font, rawValue: unknown): rawValue is FontControlPropRawValue\nfunction isValidControlPropValueForType(type: ControlType.Gap, rawValue: unknown): rawValue is GapControlPropValue\nfunction isValidControlPropValueForType(\n\ttype: ControlType.Padding,\n\trawValue: unknown,\n): rawValue is PaddingControlPropValue\nfunction isValidControlPropValueForType(\n\ttype: ControlType.BorderRadius,\n\trawValue: unknown,\n): rawValue is BorderRadiusControlPropValue\nfunction isValidControlPropValueForType(\n\ttype: ControlType.CollectionReference,\n\trawValue: unknown,\n): rawValue is CollectionReferenceControlPropValue\nfunction isValidControlPropValueForType(\n\ttype: ControlType.Location,\n\trawValue: unknown,\n): rawValue is LocationControlPropValue\nfunction isValidControlPropValueForType(type: ControlType, rawValue: unknown): boolean\nfunction isValidControlPropValueForType(type: ControlType, rawValue: unknown): boolean {\n\tswitch (type) {\n\t\tcase ControlType.Array:\n\t\t\treturn isArrayControlPropValue(rawValue)\n\t\tcase ControlType.Boolean:\n\t\t\treturn isDynamicValue(rawValue) || isBoolean(rawValue)\n\t\tcase ControlType.Color:\n\t\tcase ControlType.String:\n\t\tcase ControlType.TrackingId:\n\t\t\treturn isDynamicValue(rawValue) || isString(rawValue)\n\t\tcase ControlType.RichText:\n\t\t\treturn isDynamicValue(rawValue) || isString(rawValue) || isRichTextDocument(rawValue)\n\t\tcase ControlType.Slot:\n\t\t\treturn isArray(rawValue)\n\t\tcase ControlType.ComponentInstance:\n\t\t\treturn isString(rawValue) || isUndefined(rawValue)\n\t\tcase ControlType.Date:\n\t\t\treturn isDynamicValue(rawValue) || isString(rawValue) || isUndefined(rawValue)\n\t\tcase ControlType.Enum:\n\t\tcase ControlType.SegmentedEnum:\n\t\t\treturn (\n\t\t\t\tisDynamicValue(rawValue) ||\n\t\t\t\tisString(rawValue) ||\n\t\t\t\tisBoolean(rawValue) ||\n\t\t\t\tisNumber(rawValue) ||\n\t\t\t\tisUndefined(rawValue) ||\n\t\t\t\tisNull(rawValue)\n\t\t\t)\n\t\tcase ControlType.EventHandler:\n\t\t\treturn isArray(rawValue) && rawValue.every(isEventAction)\n\t\tcase ControlType.Number:\n\t\t\treturn isDynamicValue(rawValue) || isNumber(rawValue)\n\t\tcase ControlType.Object:\n\t\t\treturn isObject(rawValue)\n\t\tcase ControlType.File:\n\t\tcase ControlType.Image:\n\t\tcase ControlType.ResponsiveImage:\n\t\t\treturn isDynamicValue(rawValue) || isString(rawValue) || isUndefined(rawValue)\n\t\tcase ControlType.FusedNumber:\n\t\t\treturn isFusedNumberControlPropValue(rawValue)\n\t\tcase ControlType.Link:\n\t\t\treturn isDynamicValue(rawValue) || isLink(getLink(rawValue)) || isUndefined(rawValue)\n\t\tcase ControlType.LinkRelValues: {\n\t\t\treturn isDynamicValue(rawValue) || isSupportedLinkRelValueArray(rawValue)\n\t\t}\n\t\tcase ControlType.PageScope:\n\t\t\treturn isLinkToWebPage(rawValue) || isUndefined(rawValue)\n\t\tcase ControlType.Transition:\n\t\t\treturn isDynamicValue(rawValue) || isPartialTransition(rawValue)\n\t\tcase ControlType.BoxShadow:\n\t\t\treturn isDynamicValue(rawValue) || isArray(rawValue)\n\t\tcase ControlType.Font:\n\t\t\treturn isRawFontValue(rawValue) || isUndefined(rawValue)\n\t\tcase ControlType.ScrollSectionRef:\n\t\t\treturn isObject(rawValue) || isUndefined(rawValue)\n\t\tcase ControlType.CustomCursor:\n\t\t\treturn isObject(rawValue) || isUndefined(rawValue)\n\t\tcase ControlType.Border:\n\t\t\treturn isDynamicValue(rawValue) || isBorderValues(rawValue)\n\t\tcase ControlType.Cursor:\n\t\t\treturn isDynamicValue(rawValue) || isCSSCursor(rawValue)\n\t\tcase ControlType.Gap:\n\t\t\treturn isGapControlPropValue(rawValue)\n\t\tcase ControlType.Padding:\n\t\t\treturn isPaddingControlPropValue(rawValue)\n\t\tcase ControlType.BorderRadius:\n\t\t\treturn isBorderRadiusControlPropValue(rawValue)\n\t\tcase ControlType.CollectionReference:\n\t\t\treturn isCollectionReferenceControlPropValue(rawValue)\n\t\tcase ControlType.MultiCollectionReference:\n\t\t\treturn isMultiCollectionReferenceControlPropValue(rawValue)\n\t\tcase ControlType.VectorSetItem:\n\t\t\treturn (\n\t\t\t\t(isString(rawValue) && isModuleExportIdentifier(rawValue)) ||\n\t\t\t\tisVariableReference(rawValue) ||\n\t\t\t\tisUndefined(rawValue)\n\t\t\t)\n\t\tcase ControlType.Location:\n\t\t\treturn isLocationControlPropValue(rawValue)\n\t\tcase ControlType.ChangeHandler:\n\t\t\treturn false\n\t\tdefault:\n\t\t\tshouldBeNever(type)\n\t\t\treturn false\n\t}\n}\n\nfunction isValidControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Array }>,\n\trawValue: unknown,\n): rawValue is ArrayControlPropValue\nfunction isValidControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Boolean }>,\n\trawValue: unknown,\n): rawValue is BooleanControlPropValue\nfunction isValidControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Color }>,\n\trawValue: unknown,\n): rawValue is ColorControlPropValue\nfunction isValidControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Slot }>,\n\trawValue: unknown,\n): rawValue is SlotControlPropValue\nfunction isValidControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Date }>,\n\trawValue: unknown,\n): rawValue is DateControlPropValue\nfunction isValidControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Enum | ControlType.SegmentedEnum }>,\n\trawValue: unknown,\n): rawValue is EnumControlPropValue\nfunction isValidControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.EventHandler }>,\n\trawValue: unknown,\n): rawValue is EventHandlerControlPropValue\nfunction isValidControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.File }>,\n\trawValue: unknown,\n): rawValue is FileControlPropValue\nfunction isValidControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.FusedNumber }>,\n\trawValue: unknown,\n): rawValue is FusedNumberControlPropValue\nfunction isValidControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Link }>,\n\trawValue: unknown,\n): rawValue is LinkControlPropValue\nfunction isValidControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Number }>,\n\trawValue: unknown,\n): rawValue is NumberControlPropValue\nfunction isValidControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Object }>,\n\trawValue: unknown,\n): rawValue is ObjectControlPropValue\nfunction isValidControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.RichText }>,\n\trawValue: unknown,\n): rawValue is RichTextControlPropValue\nfunction isValidControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.String }>,\n\trawValue: unknown,\n): rawValue is RichTextControlPropValue\nfunction isValidControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Transition }>,\n\trawValue: unknown,\n): rawValue is TransitionControlPropValue\nfunction isValidControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.BoxShadow }>,\n\trawValue: unknown,\n): rawValue is BoxShadowControlPropValue\nfunction isValidControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Image | ControlType.ResponsiveImage }>,\n\trawValue: unknown,\n): rawValue is ImageControlPropValue\nfunction isValidControlPropValue(control: VerifiedControlDescription, rawValue: unknown): boolean\nfunction isValidControlPropValue(control: VerifiedControlDescription, rawValue: unknown): boolean {\n\tconst optionalKey: keyof WithOptional = \"optional\"\n\tif (optionalKey in control && control[optionalKey] && isNull(rawValue)) return true\n\tif (!isValidControlPropValueForType(control.type, rawValue)) return false\n\tif (control.type !== ControlType.Enum) return true\n\treturn isDynamicValue(rawValue) || control.options.includes(rawValue as any)\n}\n\ntype ControlPropFallbackValues = { [T in ControlProp[\"type\"]]: Extract<ControlProp, { type: T }>[\"value\"] }\n\nconst controlPropFallbackValues: ControlPropFallbackValues = {\n\t[ControlType.Boolean]: true,\n\t[ControlType.Number]: 0,\n\t[ControlType.String]: \"\",\n\t[ControlType.RichText]: \"\",\n\t[ControlType.FusedNumber]: createFusedNumberControlPropValue(0),\n\t[ControlType.Enum]: undefined,\n\t[ControlType.Color]: \"#09F\",\n\t[ControlType.Image]: undefined,\n\t[ControlType.File]: undefined,\n\t[ControlType.Array]: [],\n\t[ControlType.EventHandler]: [],\n\t[ControlType.Transition]: fallbackPhysicsBasedSpringTransition,\n\t[ControlType.Link]: undefined,\n\t[ControlType.LinkRelValues]: undefined,\n\t[ControlType.Date]: undefined,\n\t[ControlType.Object]: {},\n\t[ControlType.Font]: undefined,\n\t[ControlType.PageScope]: undefined,\n\t[ControlType.ScrollSectionRef]: undefined,\n\t[ControlType.BoxShadow]: [],\n\t[ControlType.CustomCursor]: undefined,\n\t[ControlType.Border]: borderValueDefaults,\n\t[ControlType.Cursor]: fallbackCursor,\n\t[ControlType.Gap]: \"0px\",\n\t[ControlType.BorderRadius]: \"0px\",\n\t[ControlType.Padding]: \"0px\",\n\t[ControlType.CollectionReference]: undefined,\n\t[ControlType.MultiCollectionReference]: undefined,\n\t[ControlType.TrackingId]: undefined,\n\t[ControlType.VectorSetItem]: undefined,\n\t[ControlType.Slot]: [],\n\t[ControlType.Location]: undefined,\n}\n\n/** Get the fallback value for a given control type, e.g. ControlType.Color -> \"#09F\" */\nexport function getControlPropFallbackValue(controlType: ControlType): unknown {\n\tif (controlType in controlPropFallbackValues) {\n\t\treturn controlPropFallbackValues[controlType as keyof typeof controlPropFallbackValues]\n\t}\n\treturn undefined\n}\n\nfunction getArrayDefault(control: VerifiedArrayControlDescription, defaultOverride: unknown): ArrayControlPropValue {\n\tconst result: ArrayValue[] = []\n\n\tconst defaultValue = isArray(defaultOverride)\n\t\t? defaultOverride\n\t\t: isArray(control.__vekterDefault)\n\t\t\t? control.__vekterDefault\n\t\t\t: control.defaultValue\n\n\tif (!isArray(defaultValue)) return result\n\n\tfor (const value of defaultValue) {\n\t\tif (isNumber(control.maxCount) && result.length >= control.maxCount) break\n\t\tconst controlProp = getControlProp(control.control, { type: control.control.type, value }, value) as ArrayValue\n\t\tif (!controlProp) continue\n\t\t// Default items get a predictable and constant id so the popout doesn't unmount on changes\n\t\tcontrolProp.id = `default-item-${result.length}`\n\t\tresult.push(controlProp)\n\t}\n\n\treturn result\n}\n\nfunction getSlotControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Slot }>,\n\trawControlProp: unknown,\n): SlotControlPropValue {\n\tconst result: Mutable<SlotControlPropValue> = []\n\n\tif (!isRawControlProp(rawControlProp)) return result\n\n\tif (rawControlProp.type === ControlType.Slot && isArray(rawControlProp.value)) {\n\t\tfor (const rawSlotReference of rawControlProp.value) {\n\t\t\tif (isNumber(control.maxCount) && result.length >= control.maxCount) break\n\t\t\tif (!isObject(rawSlotReference)) continue\n\t\t\tif (!isString(rawSlotReference.reference) && !isUndefined(rawSlotReference.reference)) continue\n\t\t\tif (!isString(rawSlotReference.id)) continue\n\n\t\t\tresult.push({\n\t\t\t\tid: rawSlotReference.id,\n\t\t\t\treference: rawSlotReference.reference,\n\t\t\t})\n\t\t}\n\t\treturn result\n\t}\n\n\tif (rawControlProp.type === ControlType.ComponentInstance && isString(rawControlProp.value)) {\n\t\tconst id = withId(rawControlProp) ? rawControlProp.id : randomID()\n\t\tresult.push({ id, reference: rawControlProp.value })\n\t\treturn result\n\t}\n\n\tif (\n\t\t(rawControlProp.type !== null &&\n\t\t\trawControlProp.type !== ControlType.Array &&\n\t\t\trawControlProp.type !== ControlType.ComponentInstance) ||\n\t\t!isArray(rawControlProp.value)\n\t) {\n\t\treturn result\n\t}\n\n\tfor (const rawItemControlProp of rawControlProp.value) {\n\t\tif (isNumber(control.maxCount) && result.length >= control.maxCount) break\n\t\tif (!isRawControlProp(rawItemControlProp)) continue\n\t\tif (rawItemControlProp.type !== ControlType.ComponentInstance) continue\n\t\tif (!isString(rawItemControlProp.value) && !isUndefined(rawItemControlProp.value)) continue\n\n\t\tconst id = withId(rawItemControlProp) ? rawItemControlProp.id : randomID()\n\t\tresult.push({ id, reference: rawItemControlProp.value })\n\t}\n\n\treturn result\n}\n\nfunction getSlotControlProp(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Slot }>,\n\trawControlProp: unknown,\n): SlotControlProp {\n\treturn {\n\t\ttype: ControlType.Slot,\n\t\tvalue: getSlotControlPropValue(control, rawControlProp),\n\t}\n}\n\nexport function getArrayControlPropValue(\n\tcontrol: VerifiedArrayControlDescription,\n\trawControlProp: unknown,\n\tdefaultOverride?: unknown,\n\tignoreMaxCount?: boolean,\n): ArrayControlPropValue {\n\tif (\n\t\t!isRawControlProp(rawControlProp) ||\n\t\t(rawControlProp.type !== null && !controlTypesAreCompatible(control.type, rawControlProp.type))\n\t) {\n\t\treturn getArrayDefault(control, defaultOverride)\n\t}\n\n\tif (isComputedValue(rawControlProp.value)) return rawControlProp.value\n\tif (!isArray(rawControlProp.value)) return getArrayDefault(control, defaultOverride)\n\n\tconst result: Mutable<ArrayControlPropValue> = []\n\n\tfor (const rawItemControlProp of rawControlProp.value) {\n\t\tif (!ignoreMaxCount && isNumber(control.maxCount) && result.length >= control.maxCount) break\n\t\tif (!isRawControlProp(rawItemControlProp)) continue\n\t\tif (!isValidControlPropValue(control.control, rawItemControlProp.value)) continue\n\t\tconst controlProp = getControlProp(control.control, rawItemControlProp, control.defaultValue) as ArrayValue\n\n\t\t// Add id if its missing\n\t\tcontrolProp.id = withId(rawItemControlProp) ? rawItemControlProp.id : randomID()\n\t\tresult.push(controlProp)\n\t}\n\n\treturn result\n}\n\nexport function getBooleanControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Boolean }>,\n\trawControlProp: unknown,\n\tdefaultOverride?: unknown,\n): BooleanControlPropValue {\n\tif (isCompatibleRawControlPropValue(control, rawControlProp)) return rawControlProp.value\n\tif (control.optional && isNull(defaultOverride)) return null\n\tif (isValidControlPropValue(control, defaultOverride)) return defaultOverride\n\tif (isValidControlPropValue(control, control.defaultValue)) return control.defaultValue\n\tif (control.optional) return null\n\treturn controlPropFallbackValues[control.type]\n}\n\nexport function getColorControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Color }>,\n\trawControlProp: unknown,\n\tdefaultOverride?: unknown,\n): ColorControlPropValue {\n\tif (\n\t\tcontrol.optional &&\n\t\tisRawControlProp(rawControlProp) &&\n\t\trawControlProp.type === ControlType.Color &&\n\t\t// We check for nullish because we were using `undefined` before changing it to `null`,\n\t\t// this change was made because `undefined` disappears in JSON and when sent over post message.\n\t\tisNullish(rawControlProp.value)\n\t) {\n\t\treturn null\n\t}\n\n\tif (isCompatibleRawControlPropValue(control, rawControlProp)) return rawControlProp.value\n\n\tif (control.optional && isNull(defaultOverride)) return null\n\tif (isValidControlPropValueForType(control.type, defaultOverride)) return defaultOverride\n\tif (isValidControlPropValueForType(control.type, control.defaultValue)) return control.defaultValue\n\n\tif (control.optional) return null\n\n\treturn controlPropFallbackValues[control.type]\n}\n\nexport function getDateControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Date }>,\n\trawControlProp: unknown,\n\tdefaultOverride?: unknown,\n): DateControlPropValue {\n\tif (isCompatibleRawControlPropValue(control, rawControlProp)) {\n\t\treturn rawControlProp.value\n\t}\n\tif (isValidControlPropValueForType(control.type, defaultOverride) && !isUndefined(defaultOverride)) {\n\t\treturn defaultOverride\n\t}\n\tif (isValidControlPropValueForType(control.type, control.defaultValue) && !isUndefined(control.defaultValue)) {\n\t\treturn control.defaultValue\n\t}\n\treturn controlPropFallbackValues[control.type]\n}\n\nfunction getLocationControlProp(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Location }>,\n\trawControlProp: unknown,\n\tdefaultOverride?: unknown,\n): LocationControlProp {\n\tif (isCompatibleRawControlPropValue(control, rawControlProp)) {\n\t\tconst result: LocationControlProp = {\n\t\t\ttype: ControlType.Location,\n\t\t\tvalue: rawControlProp.value,\n\t\t}\n\t\tconst raw = rawControlProp as unknown as Record<string, unknown>\n\t\tif (isString(raw.title)) result.title = raw.title\n\t\tif (isString(raw.address)) result.address = raw.address\n\t\treturn result\n\t}\n\n\tif (isLocationControlPropValue(defaultOverride) && !isUndefined(defaultOverride)) {\n\t\treturn {\n\t\t\ttype: ControlType.Location,\n\t\t\tvalue: defaultOverride,\n\t\t}\n\t}\n\n\tif (isLocation(defaultOverride)) {\n\t\treturn {\n\t\t\ttype: ControlType.Location,\n\t\t\tvalue: defaultOverride.coordinate,\n\t\t\ttitle: defaultOverride.title,\n\t\t\taddress: defaultOverride.address,\n\t\t}\n\t}\n\n\tif (control.defaultValue) {\n\t\treturn {\n\t\t\ttype: ControlType.Location,\n\t\t\tvalue: control.defaultValue.coordinate,\n\t\t\ttitle: control.defaultValue.title,\n\t\t\taddress: control.defaultValue.address,\n\t\t}\n\t}\n\n\treturn {\n\t\ttype: ControlType.Location,\n\t\tvalue: controlPropFallbackValues[control.type],\n\t}\n}\n\nexport function getEnumControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Enum | ControlType.SegmentedEnum }>,\n\trawControlProp: unknown,\n\tdefaultOverride?: unknown,\n): EnumControlPropValue {\n\tif (isCompatibleRawControlPropValue(control, rawControlProp)) return rawControlProp.value\n\tif (isValidControlPropValue(control, defaultOverride)) return defaultOverride\n\tif (isValidControlPropValue(control, control.defaultValue)) return control.defaultValue\n\tif (control.optional) return null\n\treturn control.options[0]\n}\n\nfunction getEventHandlerControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.EventHandler }>,\n\trawControlProp: unknown,\n): EventHandlerControlPropValue {\n\tif (isCompatibleRawControlPropValue(control, rawControlProp)) return rawControlProp.value\n\treturn controlPropFallbackValues[control.type]\n}\n\nfunction getFusedNumberDefault(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.FusedNumber }>,\n\tdefaultOverride: unknown,\n): FusedNumberControlPropValue {\n\tconst min = control.min\n\tlet value = isNumber(min) && 0 < min ? min : 0\n\tif (isNumber(defaultOverride)) {\n\t\tvalue = defaultOverride\n\t} else if (isNumber(control.defaultValue)) {\n\t\tvalue = control.defaultValue\n\t}\n\treturn createFusedNumberControlPropValue(value)\n}\n\nfunction applyFusedNumberConstraints(\n\tvalue: FusedNumberControlPropValue,\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.FusedNumber }>,\n): FusedNumberControlPropValue {\n\tconst min = control.min\n\tif (!isNumber(min)) return value\n\n\tconst numberNeedsUpdate = value.single > min || value.fused.some(fusedValue => fusedValue < min)\n\tif (!numberNeedsUpdate) return value\n\n\tconst [v1, v2, v3, v4] = value.fused\n\n\treturn {\n\t\tsingle: value.single < min ? min : value.single,\n\t\tfused: [v1 < min ? min : v1, v2 < min ? min : v2, v3 < min ? min : v3, v4 < min ? min : v4],\n\t}\n}\n\nfunction getFusedNumberControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.FusedNumber }>,\n\trawControlProp: unknown,\n\tdefaultOverride?: unknown,\n): FusedNumberControlPropValue {\n\tif (isCompatibleRawControlPropValue(control, rawControlProp)) {\n\t\treturn applyFusedNumberConstraints(rawControlProp.value, control)\n\t}\n\treturn getFusedNumberDefault(control, defaultOverride)\n}\n\nexport function getLinkControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Link }>,\n\trawControlProp: unknown,\n\tdefaultOverride?: unknown,\n): LinkControlPropValue {\n\tif (isCompatibleRawControlPropValue(control, rawControlProp)) {\n\t\treturn getLink(rawControlProp.value)\n\t}\n\tif (isValidControlPropValueForType(control.type, defaultOverride) && !isUndefined(defaultOverride)) {\n\t\treturn getLink(defaultOverride)\n\t}\n\tif (isValidControlPropValueForType(control.type, control.defaultValue) && !isUndefined(control.defaultValue)) {\n\t\treturn getLink(control.defaultValue)\n\t}\n\treturn controlPropFallbackValues[control.type]\n}\n\nfunction getLinkRelValuesControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.LinkRelValues }>,\n\trawControlProp: unknown,\n): LinkRelValuesControlPropValue {\n\tif (isCompatibleRawControlPropValue(control, rawControlProp)) return rawControlProp.value\n\tif (isValidControlPropValueForType(control.type, control.defaultValue)) return control.defaultValue\n\treturn controlPropFallbackValues[control.type]\n}\n\nfunction getPageScopeControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.PageScope }>,\n\trawControlProp: unknown,\n): PageScopeControlPropValue {\n\tif (isCompatibleRawControlPropValue(control, rawControlProp)) return rawControlProp.value\n\treturn controlPropFallbackValues[control.type]\n}\n\nexport function getScrollSectionRefControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.ScrollSectionRef }>,\n\trawControlProp: unknown,\n): ScrollSectionRefControlPropValue {\n\tif (isCompatibleRawControlPropValue(control, rawControlProp)) return rawControlProp.value\n\treturn controlPropFallbackValues[control.type]\n}\n\nfunction getCustomCursorControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.CustomCursor }>,\n\trawControlProp: unknown,\n): CustomCursorControlPropValue {\n\tif (isCompatibleRawControlPropValue(control, rawControlProp)) return rawControlProp.value\n\treturn controlPropFallbackValues[control.type]\n}\n\nfunction getBorderControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Border }>,\n\trawControlProp: unknown,\n\tdefaultOverride?: unknown,\n): BorderControlPropValue {\n\tif (isCompatibleRawControlPropValue(control, rawControlProp)) return rawControlProp.value\n\n\tconst migrated = migrateBorderLikeObjectControlPropValueToBorderValues(rawControlProp)\n\tif (migrated !== undefined) return migrated\n\n\tif (control.optional && isNull(defaultOverride)) return null\n\tif (isObject(defaultOverride)) return fromBorderReactCSSProperties(defaultOverride)\n\tif (isObject(control.defaultValue)) return fromBorderReactCSSProperties(control.defaultValue)\n\n\tif (control.optional) return null\n\n\treturn fromBorderReactCSSProperties(undefined)\n}\n\n/**\n * Migrates to `BorderValues` object from a `RawControlProp` that represents a border-like object. If the given input is\n * invalid or does not contain the required border properties, the function returns `undefined`. Attempts to get border\n * properties from property keys commonly used in our own `CodeBlock` and custom user code that we are aware of.\n */\nfunction migrateBorderLikeObjectControlPropValueToBorderValues(rawControlProp: unknown): BorderValues | undefined {\n\tif (\n\t\t!isRawControlProp(rawControlProp) ||\n\t\trawControlProp.type !== ControlType.Object ||\n\t\t!isObject(rawControlProp.value)\n\t) {\n\t\treturn undefined\n\t}\n\n\tconst borderValues: Border = {}\n\n\tfor (const borderColorKey of [\"borderColor\", \"color\"]) {\n\t\tconst objectPropertyControlProp = rawControlProp.value[borderColorKey]\n\n\t\tif (\n\t\t\tisRawControlProp(objectPropertyControlProp) &&\n\t\t\tobjectPropertyControlProp.type === ControlType.Color &&\n\t\t\tisValidPropertyValueType(ControlType.Color, objectPropertyControlProp.value)\n\t\t) {\n\t\t\tborderValues.borderColor = objectPropertyControlProp.value\n\t\t\tbreak\n\t\t}\n\t}\n\n\tfor (const borderStyleKey of [\"borderStyle\", \"style\"]) {\n\t\tconst objectPropertyControlProp = rawControlProp.value[borderStyleKey]\n\n\t\tif (\n\t\t\tisRawControlProp(objectPropertyControlProp) &&\n\t\t\tobjectPropertyControlProp.type === ControlType.Enum &&\n\t\t\tisBorderStyle(objectPropertyControlProp.value)\n\t\t) {\n\t\t\tborderValues.borderStyle = objectPropertyControlProp.value\n\t\t\tbreak\n\t\t}\n\t}\n\n\tfor (const borderWidthKey of [\"borderWidth\", \"width\"]) {\n\t\tconst objectPropertyControlProp = rawControlProp.value[borderWidthKey]\n\n\t\tif (isRawFusedNumberControlProp(objectPropertyControlProp)) {\n\t\t\tconst [top, right, bottom, left] = objectPropertyControlProp.value.fused\n\t\t\tborderValues.borderTopWidth = top\n\t\t\tborderValues.borderRightWidth = right\n\t\t\tborderValues.borderBottomWidth = bottom\n\t\t\tborderValues.borderLeftWidth = left\n\t\t\tborderValues.borderWidth = objectPropertyControlProp.value.single\n\t\t\tbreak\n\t\t}\n\n\t\t// some users used this workaround to have \"optional\" border object with a number shorthand string value\n\t\tif (\n\t\t\tisObject(objectPropertyControlProp) &&\n\t\t\tobjectPropertyControlProp.type === ControlType.Padding &&\n\t\t\tisValidPropertyValueType(ControlType.Padding, objectPropertyControlProp.value)\n\t\t) {\n\t\t\tconst parsed = parseBorderString(objectPropertyControlProp.value)\n\t\t\tborderValues.borderTopWidth = parsed.borderTop\n\t\t\tborderValues.borderRightWidth = parsed.borderRight\n\t\t\tborderValues.borderBottomWidth = parsed.borderBottom\n\t\t\tborderValues.borderLeftWidth = parsed.borderLeft\n\t\t\tborderValues.borderWidth = parsed.borderWidth\n\t\t\tbreak\n\t\t}\n\n\t\t// we can expect some users using simplified number control for the border width\n\t\tif (\n\t\t\tisObject(objectPropertyControlProp) &&\n\t\t\tobjectPropertyControlProp.type === ControlType.Number &&\n\t\t\tisValidPropertyValueType(ControlType.Number, objectPropertyControlProp.value)\n\t\t) {\n\t\t\tborderValues.borderWidth = objectPropertyControlProp.value\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif (isEmptyObject(borderValues)) return undefined\n\n\treturn fromBorderReactCSSProperties(borderValues)\n}\n\nfunction getCursorControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Cursor }>,\n\trawControlProp: unknown,\n\tdefaultOverride?: unknown,\n): CursorControlPropValue {\n\tif (isCompatibleRawControlPropValue(control, rawControlProp)) return rawControlProp.value\n\tif (isValidControlPropValueForType(control.type, defaultOverride) && isCSSCursor(defaultOverride)) {\n\t\treturn defaultOverride\n\t}\n\tif (isValidControlPropValueForType(control.type, control.defaultValue) && isCSSCursor(control.defaultValue)) {\n\t\treturn control.defaultValue\n\t}\n\treturn controlPropFallbackValues[control.type]\n}\n\nfunction getBoxShadowControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.BoxShadow }>,\n\trawControlProp: unknown,\n\tdefaultOverride?: unknown,\n): BoxShadowControlPropValue {\n\tif (isCompatibleRawControlPropValue(control, rawControlProp)) return getBoxShadow(rawControlProp.value)\n\tif (defaultOverride) return getBoxShadowFromControlDefault(defaultOverride)\n\treturn getBoxShadowFromControlDefault(control.defaultValue)\n}\n\nfunction convertFusedNumberToNumberShorthand(\n\trawControlProp: RawFusedNumberControlProp,\n): `${number}px` | `${number}px ${number}px ${number}px ${number}px` {\n\tconst isFused = withControlIsFused(rawControlProp) ? rawControlProp.isFused : false\n\tif (!isFused) return `${rawControlProp.value.single}px`\n\treturn rawControlProp.value.fused\n\t\t.map(value => `${Math.max(0, value)}px`)\n\t\t.join(\" \") as `${number}px ${number}px ${number}px ${number}px`\n}\n\nfunction getGapControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Gap }>,\n\trawControlProp: unknown,\n\tdefaultOverride?: unknown,\n): GapControlPropValue {\n\tif (isCompatibleRawControlProp(control.type, rawControlProp)) {\n\t\tif (isGapControlPropValue(rawControlProp.value)) return rawControlProp.value\n\t\tif (isNumber(rawControlProp.value)) return `${Math.max(0, rawControlProp.value)}px`\n\t}\n\n\tif (isValidControlPropValueForType(control.type, defaultOverride)) {\n\t\treturn defaultOverride\n\t}\n\n\tif (isValidControlPropValueForType(control.type, control.defaultValue)) return control.defaultValue\n\treturn controlPropFallbackValues[control.type]\n}\n\nfunction getPaddingControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Padding }>,\n\trawControlProp: unknown,\n\tdefaultOverride?: unknown,\n): PaddingControlPropValue {\n\tif (isCompatibleRawControlProp(control.type, rawControlProp)) {\n\t\tif (isPaddingControlPropValue(rawControlProp.value)) return rawControlProp.value\n\t\tif (isNumber(rawControlProp.value)) return `${Math.max(0, rawControlProp.value)}px`\n\t\tif (isRawFusedNumberControlProp(rawControlProp)) return convertFusedNumberToNumberShorthand(rawControlProp)\n\t}\n\n\tif (isValidControlPropValueForType(control.type, defaultOverride)) {\n\t\treturn defaultOverride\n\t}\n\n\tif (isValidControlPropValueForType(control.type, control.defaultValue)) return control.defaultValue\n\treturn controlPropFallbackValues[control.type]\n}\n\nfunction getBorderRadiusControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.BorderRadius }>,\n\trawControlProp: unknown,\n\tdefaultOverride?: unknown,\n): BorderRadiusControlPropValue {\n\tif (isCompatibleRawControlProp(control.type, rawControlProp)) {\n\t\tif (isBorderRadiusControlPropValue(rawControlProp.value)) return rawControlProp.value\n\t\tif (isNumber(rawControlProp.value)) return `${Math.max(0, rawControlProp.value)}px`\n\t\tif (isRawFusedNumberControlProp(rawControlProp)) return convertFusedNumberToNumberShorthand(rawControlProp)\n\t}\n\n\tif (isValidControlPropValueForType(control.type, defaultOverride)) {\n\t\treturn defaultOverride\n\t}\n\n\tif (isValidControlPropValueForType(control.type, control.defaultValue)) return control.defaultValue\n\treturn controlPropFallbackValues[control.type]\n}\n\nexport function getCollectionReferenceControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.CollectionReference }>,\n\trawControlProp: unknown,\n\tdefaultOverride?: unknown,\n): CollectionReferenceControlPropValue {\n\tif (isCompatibleRawControlPropValue(control, rawControlProp)) return rawControlProp.value\n\tif (isString(defaultOverride)) return defaultOverride\n\tif (isString(control.defaultValue)) return control.defaultValue\n\treturn controlPropFallbackValues[control.type]\n}\n\nexport function getMultiCollectionReferenceControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.MultiCollectionReference }>,\n\trawControlProp: unknown,\n\tdefaultOverride?: unknown,\n): MultiCollectionReferenceControlPropValue {\n\tif (isCompatibleRawControlPropValue(control, rawControlProp)) {\n\t\tif (control.optional && isArray(rawControlProp.value) && rawControlProp.value.length === 0) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn rawControlProp.value\n\t}\n\tif (isArray(defaultOverride) && defaultOverride.every(isString)) return defaultOverride\n\tif (isArray(control.defaultValue) && control.defaultValue.every(isString)) return control.defaultValue\n\treturn controlPropFallbackValues[control.type]\n}\n\nfunction applyNumberConstraints(\n\tvalue: NumberControlPropValue,\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Number }>,\n): NumberControlPropValue {\n\tif (!isNumber(value)) return value\n\tif (isNumber(control.min) && value < control.min) return control.min\n\tif (isNumber(control.max) && value > control.max) return control.max\n\treturn value\n}\n\nexport function getNumberControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Number }>,\n\trawControlProp: unknown,\n\tdefaultOverride?: unknown,\n): NumberControlPropValue {\n\tif (isCompatibleRawControlPropValue(control, rawControlProp)) {\n\t\treturn applyNumberConstraints(rawControlProp.value, control)\n\t}\n\tif (control.optional && isNull(defaultOverride)) {\n\t\treturn null\n\t}\n\tif (isValidControlPropValueForType(control.type, defaultOverride)) {\n\t\treturn applyNumberConstraints(defaultOverride, control)\n\t}\n\tif (isValidControlPropValueForType(control.type, control.defaultValue)) {\n\t\treturn applyNumberConstraints(control.defaultValue, control)\n\t}\n\tif (control.optional) {\n\t\treturn null\n\t}\n\treturn applyNumberConstraints(controlPropFallbackValues[control.type], control)\n}\n\nexport function getObjectControlPropValue(\n\tcontrol: VerifiedObjectControlDescription,\n\trawControlProp: unknown,\n\tdefaultOverride?: unknown,\n): ObjectControlPropValue {\n\tif (control.optional) {\n\t\tif (isRawControlProp(rawControlProp) && rawControlProp.type === ControlType.Object) {\n\t\t\tif (!isObject(rawControlProp.value)) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t} else if (!control.defaultValue && !defaultOverride) {\n\t\t\treturn null\n\t\t}\n\t}\n\n\tconst result: ObjectControlPropValue = {}\n\n\tfor (const key in control.controls) {\n\t\t// biome-ignore lint/style/noNonNullAssertion: guaranteed by loop\n\t\tconst subControl = control.controls[key]!\n\t\tconst subValue =\n\t\t\tisRawControlProp(rawControlProp) && isObject(rawControlProp.value) ? rawControlProp.value[key] : undefined\n\t\tconst subRawControlProp = isRawControlProp(subValue) ? subValue : undefined\n\n\t\tlet defaultValue: unknown = undefined\n\n\t\tif (isObject(defaultOverride) && key in defaultOverride) {\n\t\t\tdefaultValue = defaultOverride[key]\n\t\t} else if (isObject(control.defaultValue) && key in control.defaultValue) {\n\t\t\tdefaultValue = control.defaultValue[key]\n\t\t}\n\n\t\tconst subControlProp = getControlProp(subControl, subRawControlProp, defaultValue)\n\t\tif (!subControlProp) continue\n\t\tresult[key] = subControlProp\n\t}\n\n\treturn result\n}\n\nexport function getRichTextControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.RichText }>,\n\trawControlProp: unknown,\n\tdefaultOverride?: unknown,\n): RichTextControlPropValue {\n\tif (isCompatibleRawControlPropValue(control, rawControlProp)) return rawControlProp.value\n\tif (isValidControlPropValueForType(control.type, defaultOverride)) return defaultOverride\n\tif (isValidControlPropValueForType(control.type, control.defaultValue)) return control.defaultValue\n\treturn controlPropFallbackValues[control.type]\n}\n\nfunction getStringControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.String }>,\n\trawControlProp: unknown,\n\tdefaultOverride?: unknown,\n): StringControlPropValue {\n\tif (isCompatibleRawControlPropValue(control, rawControlProp)) return rawControlProp.value\n\tif (control.optional && isNull(defaultOverride)) return null\n\tif (isValidControlPropValueForType(control.type, defaultOverride)) return defaultOverride\n\tif (isValidControlPropValueForType(control.type, control.defaultValue)) return control.defaultValue\n\tif (control.optional) return null\n\treturn controlPropFallbackValues[control.type]\n}\n\nfunction getTransitionControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Transition }>,\n\trawControlProp: unknown,\n\tdefaultOverride?: unknown,\n): TransitionControlPropValue {\n\tif (isCompatibleRawControlPropValue(control, rawControlProp)) {\n\t\tif (isVariableReference(rawControlProp.value)) return rawControlProp.value\n\t\treturn toVekterTransition(rawControlProp.value)\n\t}\n\tif (isValidControlPropValueForType(control.type, defaultOverride)) {\n\t\tif (isVariableReference(defaultOverride)) return defaultOverride\n\t\treturn toVekterTransition(defaultOverride)\n\t}\n\tif (isValidControlPropValueForType(control.type, control.defaultValue)) {\n\t\tif (isVariableReference(control.defaultValue)) return control.defaultValue\n\t\treturn toVekterTransition(control.defaultValue)\n\t}\n\treturn controlPropFallbackValues[control.type]\n}\n\nfunction getFontControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Font }>,\n\trawControlProp: unknown,\n\tdefaultOverride?: unknown,\n): FontControlPropValue {\n\tif (\n\t\tisRawControlProp(rawControlProp) &&\n\t\tisValidControlPropValueForType(control.type, rawControlProp.value) &&\n\t\t!isUndefined(rawControlProp.value)\n\t) {\n\t\treturn defaultFontValuesForOptionalKeys(control, rawControlProp.value)\n\t}\n\n\tif (isValidControlPropValueForType(control.type, defaultOverride) && isRawFontValue(defaultOverride)) {\n\t\treturn defaultFontValuesForOptionalKeys(control, defaultOverride)\n\t}\n\n\t// Changing these default values is a breaking change.\n\n\tconst defaultFontType = control.defaultFontType\n\tswitch (defaultFontType) {\n\t\tcase \"monospace\":\n\t\t\treturn defaultFontValuesForOptionalKeys(control, {\n\t\t\t\tfontSelector: \"GF;Fragment Mono-regular\",\n\t\t\t})\n\t\tcase \"serif\":\n\t\t\treturn defaultFontValuesForOptionalKeys(control, {\n\t\t\t\tfontSelector: \"GF;Noto Serif-regular\",\n\t\t\t})\n\t\tcase \"sans-serif\": {\n\t\t\tconst defaultValue = control.defaultValue\n\t\t\treturn defaultFontValuesForOptionalKeys(control, {\n\t\t\t\tfontSelector: defaultValue?.variant ? getInterFontSelectorFromVariant(defaultValue.variant) : \"Inter\",\n\t\t\t})\n\t\t}\n\t\tcase undefined:\n\t\t\treturn controlPropFallbackValues[ControlType.Font]\n\t\tdefault:\n\t\t\tassertNever(defaultFontType)\n\t}\n}\n\nexport function getImageControlProp(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.Image | ControlType.ResponsiveImage }>,\n\trawControlProp: unknown,\n\tdefaultOverride?: unknown,\n): ImageControlProp {\n\tconst controlProp: ImageControlProp = {\n\t\ttype: ControlType.Image,\n\t\tvalue: controlPropFallbackValues[ControlType.Image],\n\t}\n\n\t// Make sure localized value is always applied.\n\tif (hasControlValueLocalized(rawControlProp)) {\n\t\tcontrolProp.valueLocalized = rawControlProp.valueLocalized\n\t}\n\n\t// Make sure localized alt is always applied.\n\tif (hasControlAltLocalized(rawControlProp)) {\n\t\tcontrolProp.altLocalized = rawControlProp.altLocalized\n\t}\n\n\tif (isCompatibleRawControlPropValue(control, rawControlProp) && rawControlProp.value !== undefined) {\n\t\tcontrolProp.value = rawControlProp.value\n\n\t\t// Only use existing alt when the current value is defined.\n\t\tif (withControlAltText(rawControlProp)) {\n\t\t\tcontrolProp.alt = rawControlProp.alt\n\t\t}\n\n\t\t// Only use the existing focal point when the current value is defined.\n\t\tif (withControlFocalPoint(rawControlProp)) {\n\t\t\tcontrolProp.positionX = rawControlProp.positionX\n\t\t\tcontrolProp.positionY = rawControlProp.positionY\n\t\t}\n\n\t\treturn controlProp\n\t}\n\n\tif (isDefaultResponsiveImage(defaultOverride)) {\n\t\tconst { assetReference, alt, positionX, positionY } = defaultOverride\n\t\tcontrolProp.value = assetReference\n\t\tcontrolProp.alt = alt\n\t\tcontrolProp.positionX = positionX\n\t\tcontrolProp.positionY = positionY\n\t}\n\n\tif (isString(defaultOverride) && isAssetReference(defaultOverride)) {\n\t\tcontrolProp.value = defaultOverride\n\t\treturn controlProp\n\t}\n\n\tif (control.type === ControlType.ResponsiveImage && isDefaultResponsiveImage(control.__vekterDefault)) {\n\t\tconst { assetReference, alt, positionX, positionY } = control.__vekterDefault\n\t\tcontrolProp.value = assetReference\n\t\tcontrolProp.alt = alt\n\t\tcontrolProp.positionX = positionX\n\t\tcontrolProp.positionY = positionY\n\t\treturn controlProp\n\t}\n\n\tif (control.__defaultAssetReference) {\n\t\tcontrolProp.value = control.__defaultAssetReference\n\t\treturn controlProp\n\t}\n\n\treturn controlProp\n}\n\nexport function getFileControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.File }>,\n\trawControlProp: unknown,\n\tdefaultOverride?: unknown,\n): FileControlPropValue {\n\tif (isCompatibleRawControlPropValue(control, rawControlProp)) return rawControlProp.value\n\tif (isString(defaultOverride) && isAssetReference(defaultOverride)) return defaultOverride\n\tif (control.__defaultAssetReference) return control.__defaultAssetReference\n\treturn controlPropFallbackValues[control.type]\n}\n\nfunction getTrackingIdControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.TrackingId }>,\n\trawControlProp: unknown,\n\tdefaultOverride?: unknown,\n): TrackingIdControlPropValue {\n\tif (isCompatibleRawControlPropValue(control, rawControlProp)) return rawControlProp.value\n\tif (isString(defaultOverride)) return defaultOverride\n\tif (isString(control.defaultValue)) return control.defaultValue\n\treturn controlPropFallbackValues[control.type]\n}\n\nexport function getVectorSetItemControlPropValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.VectorSetItem }>,\n\trawControlProp: unknown,\n\tdefaultOverride?: unknown,\n): VectorSetItemControlPropValue {\n\tif (isCompatibleRawControlPropValue(control, rawControlProp)) return rawControlProp.value\n\tif (isString(defaultOverride) && isModuleExportIdentifier(defaultOverride)) return defaultOverride\n\tif (isModuleExportIdentifier(control.defaultValue?.identifier)) return control.defaultValue.identifier\n\treturn controlPropFallbackValues[control.type]\n}\n\nexport function getControlProp(\n\tcontrol: VerifiedControlDescription,\n\trawControlProp: unknown,\n\t/** Used by ControlType.Object */\n\tdefaultOverride?: unknown,\n): ControlProp | null {\n\tswitch (control.type) {\n\t\tcase ControlType.Array:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Array,\n\t\t\t\tvalue: getArrayControlPropValue(control, rawControlProp, defaultOverride),\n\t\t\t}\n\t\tcase ControlType.Boolean:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Boolean,\n\t\t\t\tvalue: getBooleanControlPropValue(control, rawControlProp, defaultOverride),\n\t\t\t}\n\t\tcase ControlType.Color:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Color,\n\t\t\t\tvalue: getColorControlPropValue(control, rawControlProp, defaultOverride),\n\t\t\t}\n\t\tcase ControlType.Slot:\n\t\t\treturn getSlotControlProp(control, rawControlProp)\n\t\tcase ControlType.Date:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Date,\n\t\t\t\tvalue: getDateControlPropValue(control, rawControlProp, defaultOverride),\n\t\t\t}\n\t\tcase ControlType.Enum:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Enum,\n\t\t\t\tvalue: getEnumControlPropValue(control, rawControlProp, defaultOverride),\n\t\t\t}\n\t\tcase ControlType.EventHandler:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.EventHandler,\n\t\t\t\tvalue: getEventHandlerControlPropValue(control, rawControlProp),\n\t\t\t}\n\t\tcase ControlType.File:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.File,\n\t\t\t\tvalue: getFileControlPropValue(control, rawControlProp, defaultOverride),\n\t\t\t}\n\t\tcase ControlType.FusedNumber:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.FusedNumber,\n\t\t\t\tisFused: withControlIsFused(rawControlProp) ? rawControlProp.isFused : false,\n\t\t\t\tvalue: getFusedNumberControlPropValue(control, rawControlProp, defaultOverride),\n\t\t\t}\n\t\tcase ControlType.Number:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Number,\n\t\t\t\tvalue: getNumberControlPropValue(control, rawControlProp, defaultOverride),\n\t\t\t}\n\t\tcase ControlType.Object:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Object,\n\t\t\t\tvalue: getObjectControlPropValue(control, rawControlProp, defaultOverride),\n\t\t\t}\n\t\tcase ControlType.RichText: {\n\t\t\tconst controlProp: RichTextControlProp = {\n\t\t\t\ttype: ControlType.RichText,\n\t\t\t\tvalue: getRichTextControlPropValue(control, rawControlProp, defaultOverride),\n\t\t\t}\n\n\t\t\tif (hasControlValueLocalized(rawControlProp)) {\n\t\t\t\tcontrolProp.valueLocalized = rawControlProp.valueLocalized\n\t\t\t}\n\n\t\t\treturn controlProp\n\t\t}\n\t\tcase ControlType.String: {\n\t\t\tconst controlProp: StringControlProp = {\n\t\t\t\ttype: ControlType.String,\n\t\t\t\tvalue: getStringControlPropValue(control, rawControlProp, defaultOverride),\n\t\t\t}\n\n\t\t\tif (hasControlValueLocalized(rawControlProp)) {\n\t\t\t\tcontrolProp.valueLocalized = rawControlProp.valueLocalized\n\t\t\t}\n\n\t\t\treturn controlProp\n\t\t}\n\t\tcase ControlType.Link: {\n\t\t\tconst controlProp: LinkControlProp = {\n\t\t\t\ttype: ControlType.Link,\n\t\t\t\tvalue: getLinkControlPropValue(control, rawControlProp, defaultOverride),\n\t\t\t}\n\n\t\t\tif (hasControlValueLocalized(rawControlProp)) {\n\t\t\t\tcontrolProp.valueLocalized = rawControlProp.valueLocalized\n\t\t\t}\n\n\t\t\treturn controlProp\n\t\t}\n\t\tcase ControlType.LinkRelValues: {\n\t\t\treturn {\n\t\t\t\ttype: ControlType.LinkRelValues,\n\t\t\t\tvalue: getLinkRelValuesControlPropValue(control, rawControlProp),\n\t\t\t}\n\t\t}\n\t\tcase ControlType.Transition:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Transition,\n\t\t\t\tvalue: getTransitionControlPropValue(control, rawControlProp, defaultOverride),\n\t\t\t}\n\t\tcase ControlType.Image:\n\t\tcase ControlType.ResponsiveImage: {\n\t\t\treturn getImageControlProp(control, rawControlProp, defaultOverride)\n\t\t}\n\t\tcase ControlType.Font:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Font,\n\t\t\t\tvalue: getFontControlPropValue(control, rawControlProp, defaultOverride),\n\t\t\t}\n\t\tcase ControlType.PageScope:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.PageScope,\n\t\t\t\tvalue: getPageScopeControlPropValue(control, rawControlProp),\n\t\t\t}\n\t\tcase ControlType.ScrollSectionRef:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.ScrollSectionRef,\n\t\t\t\tvalue: getScrollSectionRefControlPropValue(control, rawControlProp),\n\t\t\t}\n\t\tcase ControlType.CustomCursor:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.CustomCursor,\n\t\t\t\tvalue: getCustomCursorControlPropValue(control, rawControlProp),\n\t\t\t}\n\t\tcase ControlType.Border:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Border,\n\t\t\t\tvalue: getBorderControlPropValue(control, rawControlProp, defaultOverride),\n\t\t\t}\n\t\tcase ControlType.Cursor:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Cursor,\n\t\t\t\tvalue: getCursorControlPropValue(control, rawControlProp, defaultOverride),\n\t\t\t}\n\t\tcase ControlType.BoxShadow:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.BoxShadow,\n\t\t\t\tvalue: getBoxShadowControlPropValue(control, rawControlProp, defaultOverride),\n\t\t\t}\n\t\tcase ControlType.Gap:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Gap,\n\t\t\t\tvalue: getGapControlPropValue(control, rawControlProp, defaultOverride),\n\t\t\t}\n\t\tcase ControlType.BorderRadius:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.BorderRadius,\n\t\t\t\tvalue: getBorderRadiusControlPropValue(control, rawControlProp, defaultOverride),\n\t\t\t}\n\t\tcase ControlType.Padding:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Padding,\n\t\t\t\tvalue: getPaddingControlPropValue(control, rawControlProp, defaultOverride),\n\t\t\t}\n\t\tcase ControlType.CollectionReference:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.CollectionReference,\n\t\t\t\tvalue: getCollectionReferenceControlPropValue(control, rawControlProp, defaultOverride),\n\t\t\t}\n\t\tcase ControlType.MultiCollectionReference:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.MultiCollectionReference,\n\t\t\t\tvalue: getMultiCollectionReferenceControlPropValue(control, rawControlProp, defaultOverride),\n\t\t\t}\n\t\tcase ControlType.TrackingId:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.TrackingId,\n\t\t\t\tvalue: getTrackingIdControlPropValue(control, rawControlProp, defaultOverride),\n\t\t\t}\n\t\tcase ControlType.VectorSetItem:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.VectorSetItem,\n\t\t\t\tvalue: getVectorSetItemControlPropValue(control, rawControlProp, defaultOverride),\n\t\t\t}\n\t\tcase ControlType.Location:\n\t\t\treturn getLocationControlProp(control, rawControlProp, defaultOverride)\n\t\tcase ControlType.ChangeHandler:\n\t\t\t// Change handlers don't store any data\n\t\t\treturn null\n\t\tdefault:\n\t\t\tshouldBeNever(control)\n\t\t\treturn null\n\t}\n}\n\n/**\n * The result will include a control prop for all defined controls. The result is type safe and all\n * of the control constraints are already applied (e.g. number min / max and array max count).\n */\nexport function getControlProps(\n\tcontrols: VerifiedPropertyControls,\n\trawControlProps: Record<string, unknown>,\n): ControlProps {\n\tconst result: Mutable<ControlProps> = {}\n\n\tfor (const controlKey in controls) {\n\t\tconst control = controls[controlKey]\n\t\tif (!control) continue\n\t\tconst rawControlProp = rawControlProps[controlKey]\n\t\tconst controlProp = getControlProp(control, rawControlProp)\n\t\tif (!controlProp) continue\n\t\tresult[controlKey] = controlProp\n\t}\n\n\treturn result\n}\n\nexport function useControlProps(\n\tcontrols: VerifiedPropertyControls,\n\trawControlProps: Record<string, unknown>,\n): ControlProps {\n\treturn useMemo(() => getControlProps(controls, rawControlProps), [controls, rawControlProps])\n}\n", "import type { Transition } from \"document/models/Transition.ts\"\nimport { isObject, isString } from \"utils/typeChecks.ts\"\nimport type { CanvasTree } from \"../CanvasTree.ts\"\nimport type { CanvasNode, MaybeCanvasNode } from \"../nodes/CanvasNode.ts\"\nimport type { NodeID } from \"../nodes/NodeID.ts\"\nimport { isSmartComponentNode } from \"../nodes/utils/nodeCheck.ts\"\nimport type { DynamicValue } from \"./DynamicValue.ts\"\nimport type { VariableReference } from \"./VariableReference.ts\"\nimport type { FloatingAlignment, FloatingPlacement } from \"./WithFloatingPosition.ts\"\n\n/**\n * These are \"mostly\" the official supported CSS cursor values. We explicitly\n * omitted the \"wait\" value because it looks the same as the \"progress\" value on\n * Mac in all major browsers (Chrome, Safari, Firefox). Also, keep in mind that\n * the order of values reflects the order of the cursors in the UI.\n */\nexport const cssCursors = [\n\t\"default\",\n\t\"pointer\",\n\t\"progress\",\n\t\"copy\",\n\t\"no-drop\",\n\t\"context-menu\",\n\t\"grab\",\n\t\"grabbing\",\n\t\"cell\",\n\t\"crosshair\",\n\t\"alias\",\n\t\"zoom-in\",\n\t\"zoom-out\",\n\t\"help\",\n\t\"nw-resize\",\n\t\"n-resize\",\n\t\"ne-resize\",\n\t\"w-resize\",\n\t\"move\",\n\t\"e-resize\",\n\t\"sw-resize\",\n\t\"s-resize\",\n\t\"se-resize\",\n\t\"ew-resize\",\n\t\"ns-resize\",\n\t\"nwse-resize\",\n\t\"nesw-resize\",\n\t\"col-resize\",\n\t\"row-resize\",\n\t\"text\",\n\t\"vertical-text\",\n\t\"not-allowed\",\n\t\"none\",\n] as const\n\nexport type CSSCursor = (typeof cssCursors)[number]\n\nconst cssCursorSet = new Set<string>(cssCursors)\nexport function isCSSCursor(value: unknown): value is CSSCursor {\n\treturn isString(value) && cssCursorSet.has(value)\n}\n\nexport const CUSTOM_CURSORS_CSS_VARIABLE = \"--framer-custom-cursors\" as const\n\nexport enum CustomCursorType {\n\tComponent = \"component\",\n\tVariant = \"variant\",\n}\n\nexport interface CustomCursor {\n\tcustomCursorSmartComponentId: NodeID | undefined\n\tcustomCursorVariant: string | undefined\n\n\tcustomCursorFollow: boolean | undefined\n\tcustomCursorOffsetX: number | undefined\n\tcustomCursorOffsetY: number | undefined\n\tcustomCursorPlacement: FloatingPlacement | undefined\n\tcustomCursorAlignment: FloatingAlignment | undefined\n\n\tcustomCursorTransitionEnabled: boolean | undefined\n\tcustomCursorTransition: Transition | undefined\n}\nconst customCursorKey: keyof CustomCursor = \"customCursorSmartComponentId\"\nexport function isCustomCursor(value: unknown): value is CustomCursor {\n\treturn isObject(value) && customCursorKey in value\n}\n\nexport const customCursorDefaults: CustomCursor = {\n\tcustomCursorSmartComponentId: undefined,\n\tcustomCursorVariant: undefined,\n\tcustomCursorFollow: undefined,\n\tcustomCursorOffsetX: undefined,\n\tcustomCursorOffsetY: undefined,\n\tcustomCursorTransitionEnabled: undefined,\n\tcustomCursorTransition: undefined,\n\tcustomCursorPlacement: undefined,\n\tcustomCursorAlignment: undefined,\n}\n\nexport interface WithCursor extends CustomCursor {\n\tcursor: CSSCursor | DynamicValue | undefined\n\tcustomCursorType: CustomCursorType | VariableReference | undefined\n}\n\nexport const cursorDefaults: WithCursor = {\n\t...customCursorDefaults,\n\tcursor: undefined,\n\tcustomCursorType: undefined,\n}\n\nexport const fallbackCursor: CSSCursor = \"default\"\n\nconst key: keyof WithCursor = \"cursor\"\n\nexport function withCursor<T extends CanvasNode>(node: T): node is T & WithCursor {\n\treturn key in node\n}\n\nexport function extractCustomCursorProperties(node: CanvasNode): Omit<WithCursor, \"cursor\"> | undefined {\n\tif (!withCursor(node)) return\n\n\treturn {\n\t\tcustomCursorType: node.customCursorType,\n\t\tcustomCursorSmartComponentId: node.customCursorSmartComponentId,\n\t\tcustomCursorVariant: node.customCursorVariant,\n\t\tcustomCursorFollow: node.customCursorFollow,\n\t\tcustomCursorOffsetX: node.customCursorOffsetX,\n\t\tcustomCursorOffsetY: node.customCursorOffsetY,\n\t\tcustomCursorTransitionEnabled: node.customCursorTransitionEnabled,\n\t\tcustomCursorTransition: node.customCursorTransition,\n\t\tcustomCursorPlacement: node.customCursorPlacement,\n\t\tcustomCursorAlignment: node.customCursorAlignment,\n\t}\n}\n\nexport const DEFAULT_CURSOR_OFFSET = 20\n\nexport function isValidCustomCursor(\n\tvalue: CustomCursor,\n): value is CustomCursor & { customCursorSmartComponentId: NodeID } {\n\treturn isString(value.customCursorSmartComponentId)\n}\n\nexport type NodeProvidingCursorComponent = CanvasNode &\n\tWithCursor & { customCursorSmartComponentId: NodeID; customCursorType: CustomCursorType.Component }\n\n/**\n * Check if a node provides a custom cursor component that exists in the\n * project.\n */\nexport function isNodeProvidingCustomCursorComponent(\n\ttree: CanvasTree,\n\tnode: MaybeCanvasNode,\n): node is NodeProvidingCursorComponent {\n\tif (\n\t\t!node ||\n\t\t!withCursor(node) ||\n\t\tnode.customCursorType !== CustomCursorType.Component ||\n\t\t!isValidCustomCursor(node)\n\t) {\n\t\treturn false\n\t}\n\treturn isSmartComponentNode(tree.get(node.customCursorSmartComponentId))\n}\n", "import type { BoxShadow } from \"document/models/Shadow.ts\"\nimport type { Transition } from \"document/models/Transition.ts\"\nimport type { BorderStyle } from \"library/index.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport type { FourPixelNumberShorthand } from \"../NumberShorthand.ts\"\n\n/**\n * WithFormInputFocusedStyles is a trait that provides additional non-standard\n * styles that are specific to inputs within a form when they are focused.\n * We cannot reuse the existing traits such as WithBorder & WithOptionalFill\n * for this because they require that the property keys not be prefixed with\n * the 'formInputFocused' prefix. Instead, we will use the Border, BoxShadow,\n * and Color controls to provide the UI for the properties.\n */\nexport interface WithFormInputFocusedStyles {\n\tformInputFocusedBorderColor: string | undefined\n\tformInputFocusedBorderWidth: FourPixelNumberShorthand | undefined\n\tformInputFocusedBorderStyle: BorderStyle | undefined\n\tformInputFocusedBackgroundColor: string | undefined\n\tformInputFocusedBoxShadow: readonly BoxShadow[] | undefined\n\tformInputFocusedTransition: Transition | undefined\n}\n\nconst focusedStyleKey: keyof WithFormInputFocusedStyles = \"formInputFocusedBorderColor\"\n\nexport function withFormInputFocusedStyles<T extends CanvasNode>(node: T): node is T & WithFormInputFocusedStyles {\n\treturn focusedStyleKey in node\n}\n\nexport const formInputFocusedStylesDefaults: WithFormInputFocusedStyles = {\n\tformInputFocusedBorderColor: undefined,\n\tformInputFocusedBorderWidth: undefined,\n\tformInputFocusedBorderStyle: undefined,\n\tformInputFocusedBackgroundColor: undefined,\n\tformInputFocusedBoxShadow: undefined,\n\tformInputFocusedTransition: undefined,\n}\n\nexport const formInputDefaultFocusedBorderColor = \"rgba(0, 153, 255, 1)\"\nexport const formInputDefaultFocussedBorderWidthWithoutUnit = 1\nexport const formInputDefaultFocusedBorderWidth = `${formInputDefaultFocussedBorderWidthWithoutUnit}px`\nexport const formInputDefaultFocusedBorderStyle = \"solid\"\n\nexport const formInputFocusedStylesCreateDefaults: WithFormInputFocusedStyles = {\n\tformInputFocusedBackgroundColor: undefined,\n\tformInputFocusedBorderColor: formInputDefaultFocusedBorderColor,\n\tformInputFocusedBorderStyle: formInputDefaultFocusedBorderStyle,\n\tformInputFocusedBorderWidth: formInputDefaultFocusedBorderWidth,\n\tformInputFocusedBoxShadow: [],\n\tformInputFocusedTransition: undefined,\n}\n", "import { Mixed, isMixed } from \"@framerjs/shared\"\nimport { type BoxShadow, type Shadow, isBoxShadow } from \"document/models/Shadow.ts\"\nimport { isArray } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport type { DynamicValue } from \"../DynamicValue.ts\"\nimport { isDynamicValue } from \"../DynamicValue.ts\"\nimport {\n\tsupportsBoxShadow,\n\tsupportsRealisticShadow,\n\tsupportsShadowInset,\n\tsupportsShadowSpread,\n} from \"../WithBoxShadow.ts\"\nimport { withShadow } from \"../WithShadow.ts\"\nimport type { Reduced } from \"./Reduced.ts\"\nimport { NotFound, isFound, isFoundAndNotMixed, isNotFound } from \"./Reduced.ts\"\nimport { valuesAreDifferent } from \"./reduceProperty.ts\"\n\nexport interface ReducedShadow {\n\tid: string\n\ttype: Reduced<\"box\" | \"realistic\">\n\tcolor: Reduced<string>\n\tx: Reduced<number>\n\ty: Reduced<number>\n\tblur: Reduced<number>\n\tinset: Reduced<boolean>\n\tspread: Reduced<number>\n\tdiffusion: Reduced<number>\n\tfocus: Reduced<number>\n}\n\nexport function isAnyShadowPropertyMixed(shadow: ReducedShadow): boolean {\n\tif (isMixed(shadow.type)) return true\n\tif (isMixed(shadow.color)) return true\n\tif (isMixed(shadow.x)) return true\n\tif (isMixed(shadow.y)) return true\n\tif (isMixed(shadow.blur)) return true\n\tif (isMixed(shadow.inset)) return true\n\tif (isMixed(shadow.spread)) return true\n\tif (isMixed(shadow.diffusion)) return true\n\tif (isMixed(shadow.focus)) return true\n\treturn false\n}\n\nexport type ReducedShadowList = Reduced<ReducedShadow[] | DynamicValue>\n\nexport interface ReducedShadows {\n\tanyNodesWithShadows: boolean\n\tshadows: ReducedShadowList\n\tonlyNodesSupportingShadowSpread: boolean\n\tonlyNodesSupportingRealisticShadows: boolean\n\tonlyNodesSupportingShadowInset: boolean\n}\n\nconst noBoxShadows: readonly BoxShadow[] = []\nconst noShadows: readonly Shadow[] = []\n\nexport function reduceShadowList(\n\tvalue: readonly BoxShadow[] | DynamicValue | undefined,\n\treduced: ReducedShadowList,\n): ReducedShadowList {\n\tif (isMixed(reduced)) return reduced\n\tconst boxShadows = isArray(value) ? value : isDynamicValue(value) ? value : noBoxShadows\n\n\tif (isNotFound(reduced)) {\n\t\tif (isDynamicValue(boxShadows)) return boxShadows\n\n\t\treturn boxShadows.map(boxShadow => ({\n\t\t\tid: boxShadow.id,\n\t\t\ttype: boxShadow.type,\n\t\t\tcolor: boxShadow.color,\n\t\t\tx: boxShadow.x,\n\t\t\ty: boxShadow.y,\n\t\t\tblur: boxShadow.blur,\n\t\t\tinset: boxShadow.inset,\n\t\t\tspread: boxShadow.spread,\n\t\t\tdiffusion: boxShadow.diffusion,\n\t\t\tfocus: boxShadow.focus,\n\t\t}))\n\t}\n\n\tif (isDynamicValue(boxShadows) || isDynamicValue(reduced)) {\n\t\tif (valuesAreDifferent(boxShadows, reduced)) {\n\t\t\treturn Mixed\n\t\t}\n\t\treturn reduced\n\t}\n\n\tif (boxShadows.length !== reduced.length) return Mixed\n\n\tboxShadows.forEach((boxShadow: BoxShadow, idx: number) => {\n\t\tconst reducedShadow: ReducedShadow | undefined = reduced[idx]\n\t\tif (!reducedShadow) return\n\t\tcombineShadows(reducedShadow, boxShadow)\n\t})\n\n\treturn reduced\n}\n\n/**\n * isCompleteShadowList returns a boolean indicating whether a reduced shadow list\n * is complete, meaning that all shadows and their constituent properties are found and not mixed.\n * We use this to determine if an array of shadows can be copied.\n */\nexport function isCompleteShadowList(shadows: ReducedShadowList): boolean {\n\tif (isMixed(shadows)) return false\n\tif (isNotFound(shadows)) return false\n\tif (isDynamicValue(shadows)) return true\n\n\treturn shadows.every(isCompleteShadow)\n}\n\nfunction isCompleteShadow(shadow: ReducedShadow): boolean {\n\treturn (\n\t\tisFoundAndNotMixed(shadow.color) &&\n\t\tisFoundAndNotMixed(shadow.x) &&\n\t\tisFoundAndNotMixed(shadow.y) &&\n\t\tisFoundAndNotMixed(shadow.blur) &&\n\t\tisFoundAndNotMixed(shadow.inset) &&\n\t\tisFoundAndNotMixed(shadow.spread) &&\n\t\tisFoundAndNotMixed(shadow.diffusion) &&\n\t\tisFoundAndNotMixed(shadow.focus) &&\n\t\tisFoundAndNotMixed(shadow.type)\n\t)\n}\n\nexport function reduceShadows(node: CanvasNode, result: ReducedShadows) {\n\tif (result.onlyNodesSupportingShadowSpread && !supportsShadowSpread(node)) {\n\t\tresult.onlyNodesSupportingShadowSpread = false\n\t}\n\n\tif (result.onlyNodesSupportingRealisticShadows && !supportsRealisticShadow(node)) {\n\t\tresult.onlyNodesSupportingRealisticShadows = false\n\t}\n\n\tif (result.onlyNodesSupportingShadowInset && !supportsShadowInset(node)) {\n\t\tresult.onlyNodesSupportingShadowInset = false\n\t}\n\n\tif (!supportsBoxShadow(node) && !withShadow(node)) return\n\n\tif (supportsBoxShadow(node)) {\n\t\tresult.anyNodesWithShadows = true\n\t\tresult.shadows = reduceShadowList(node.boxShadows, result.shadows)\n\t}\n\tif (withShadow(node)) {\n\t\tresult.anyNodesWithShadows = true\n\n\t\tif (isMixed(result.shadows)) return\n\t\tconst shadows = node.shadows ?? noShadows\n\n\t\tif (isNotFound(result.shadows)) {\n\t\t\tresult.shadows = shadows.map(shadow => ({\n\t\t\t\tid: shadow.id,\n\t\t\t\tcolor: shadow.color,\n\t\t\t\tx: shadow.x,\n\t\t\t\ty: shadow.y,\n\t\t\t\tblur: shadow.blur,\n\t\t\t\ttype: NotFound,\n\t\t\t\tinset: NotFound,\n\t\t\t\tspread: NotFound,\n\t\t\t\tdiffusion: NotFound,\n\t\t\t\tfocus: NotFound,\n\t\t\t}))\n\t\t\treturn\n\t\t}\n\n\t\tif (isDynamicValue(result.shadows)) {\n\t\t\tresult.shadows = Mixed\n\t\t\treturn\n\t\t}\n\n\t\tif (shadows.length !== result.shadows.length) {\n\t\t\tresult.shadows = Mixed\n\t\t\treturn\n\t\t}\n\n\t\tconst reducedShadowList = result.shadows\n\n\t\tshadows.forEach((shadow, idx: number) => {\n\t\t\tconst reducedShadow: ReducedShadow | undefined = reducedShadowList[idx]\n\t\t\tif (!reducedShadow) return\n\t\t\tcombineShadows(reducedShadow, shadow)\n\t\t})\n\t}\n}\n\nexport function combineShadows(reduced: ReducedShadow, shadow: BoxShadow | Shadow) {\n\tif (reduced.color !== shadow.color) {\n\t\treduced.color = Mixed\n\t}\n\tif (reduced.x !== shadow.x) {\n\t\treduced.x = Mixed\n\t}\n\tif (reduced.y !== shadow.y) {\n\t\treduced.y = Mixed\n\t}\n\tif (reduced.blur !== shadow.blur) {\n\t\treduced.blur = Mixed\n\t}\n\n\tif (isBoxShadow(shadow)) {\n\t\tif (reduced.type !== shadow.type) {\n\t\t\treduced.type = Mixed\n\t\t}\n\n\t\tif (reduced.diffusion !== shadow.diffusion) {\n\t\t\treduced.diffusion = Mixed\n\t\t}\n\n\t\tif (reduced.focus !== shadow.focus) {\n\t\t\treduced.focus = Mixed\n\t\t}\n\n\t\tif (reduced.inset !== shadow.inset) {\n\t\t\treduced.inset = Mixed\n\t\t}\n\n\t\tif (reduced.spread !== shadow.spread) {\n\t\t\treduced.spread = Mixed\n\t\t}\n\t} else {\n\t\tif (isFound(reduced.type)) {\n\t\t\treduced.type = Mixed\n\t\t}\n\t}\n}\n\nexport function isOptionalShadowVisible(shadows: ReducedShadows[\"shadows\"]): boolean {\n\treturn isArray(shadows) && shadows.length > 0\n}\n\nexport function isShadowOptional(\n\tshadows: ReducedShadows[\"shadows\"],\n\tonlyBreakpointNodes: boolean,\n\tonlyShapeNodes: boolean,\n): boolean {\n\treturn isFound(shadows) && (onlyBreakpointNodes || onlyShapeNodes)\n}\n", "import { assert, isMixed } from \"@framerjs/shared\"\nimport type { BorderValues } from \"document/models/CanvasTree/traits/WithBorder.ts\"\nimport type { BorderStyle } from \"library/render/style/BorderComponent.tsx\"\nimport { isArray, isUndefined } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport type { FourPixelNumberShorthand } from \"../NumberShorthand.ts\"\nimport type { WithFormInputFocusedStyles } from \"../forms/WithFormInputFocusedStyles.ts\"\nimport { withFormInputFocusedStyles } from \"../forms/WithFormInputFocusedStyles.ts\"\nimport type { Reduced, ReducedRecord } from \"./Reduced.ts\"\nimport { NotFound, isFoundAndNotUndefined, isNotFound } from \"./Reduced.ts\"\nimport { reduceProperty } from \"./reduceProperty.ts\"\nimport type { ReducedShadowList } from \"./reduceShadows.ts\"\nimport { reduceShadowList } from \"./reduceShadows.ts\"\n\nexport interface ReducedFormInputFocusedStyles extends ReducedRecord<\n\tOmit<WithFormInputFocusedStyles, \"formInputFocusedBoxShadow\">\n> {\n\tformInputFocusedBoxShadow: ReducedShadowList | NotFound\n}\n\nexport function reduceFormInputFocusedStyles(node: CanvasNode, result: ReducedFormInputFocusedStyles) {\n\tif (!withFormInputFocusedStyles(node)) {\n\t\treturn\n\t}\n\treduceProperty(\"formInputFocusedBorderColor\", result, node)\n\treduceProperty(\"formInputFocusedBorderWidth\", result, node)\n\treduceProperty(\"formInputFocusedBorderStyle\", result, node)\n\treduceProperty(\"formInputFocusedBackgroundColor\", result, node)\n\treduceProperty(\"formInputFocusedTransition\", result, node)\n\n\t// reduceShadowList initialises an empty array if the value\n\t// is undefined, which we do not want to do as this will result\n\t// in the shadows row always being visible.\n\tconst reducedShadows = !isUndefined(node.formInputFocusedBoxShadow)\n\t\t? reduceShadowList(node.formInputFocusedBoxShadow, result.formInputFocusedBoxShadow)\n\t\t: NotFound\n\tresult.formInputFocusedBoxShadow = reducedShadows\n}\n\nexport function toReducedBorderValues(value: {\n\tcolor: Reduced<string | undefined>\n\twidth: Reduced<FourPixelNumberShorthand | undefined>\n\tstyle: Reduced<BorderStyle | undefined>\n}): ReducedRecord<BorderValues> | null {\n\tif (!value.color || !value.style) return null\n\t// If the border width is some reduced value type (Mixed, NotFound,\n\t// undefined), set all of the sizes to that value so that the UI can\n\t// easily reflect that state.\n\tconst width = value.width ?? NotFound\n\tif (isNotFound(width) || isUndefined(width) || isMixed(width)) {\n\t\treturn {\n\t\t\tborderColor: value.color,\n\t\t\tborderStyle: value.style,\n\t\t\tborderWidth: width,\n\t\t\tborderBottom: width,\n\t\t\tborderTop: width,\n\t\t\tborderLeft: width,\n\t\t\tborderRight: width,\n\t\t\tborderPerSide: width,\n\t\t}\n\t}\n\n\t// Otherwise we can create real values.\n\treturn {\n\t\t...parseBorderString(width),\n\t\tborderColor: value.color,\n\t\tborderStyle: value.style,\n\t}\n}\n\n/**\n * Converts our internal BorderValues data model to a WithFormInputStyles trait partial.\n */\nexport function fromBorderValues(values: BorderValues): Partial<WithFormInputFocusedStyles> {\n\tconst borderWidth: FourPixelNumberShorthand = values.borderPerSide\n\t\t? `${values.borderTop}px ${values.borderRight}px ${values.borderBottom}px ${values.borderLeft}px`\n\t\t: `${values.borderWidth}px`\n\treturn {\n\t\tformInputFocusedBorderColor: values.borderColor,\n\t\tformInputFocusedBorderWidth: borderWidth,\n\t\tformInputFocusedBorderStyle: values.borderStyle,\n\t}\n}\n\nexport function parseBorderString(value: FourPixelNumberShorthand): Omit<BorderValues, \"borderColor\" | \"borderStyle\"> {\n\t// parseInt is forgiving of the extraneous px unit in the input string,\n\t// so we can just split on space\n\tconst values = value.split(\" \").map(v => parseInt(v, 10))\n\n\tif (values.length === 1) {\n\t\tconst singleValue = values[0] ?? 0\n\t\treturn {\n\t\t\tborderWidth: singleValue,\n\t\t\tborderTop: singleValue,\n\t\t\tborderRight: singleValue,\n\t\t\tborderBottom: singleValue,\n\t\t\tborderLeft: singleValue,\n\t\t\tborderPerSide: false,\n\t\t}\n\t}\n\n\tassert(values.length === 4, \"Expected 4 values\")\n\tconst [top = 0, right = 0, bottom = 0, left = 0] = values\n\n\treturn {\n\t\tborderWidth: top,\n\t\tborderTop: top,\n\t\tborderRight: right,\n\t\tborderBottom: bottom,\n\t\tborderLeft: left,\n\t\tborderPerSide: true,\n\t}\n}\n\n/**\n * hasFormInputFocusedStyles checks if the given trait values contain any focused styles. Focused styles are considered to be 'active' (e.g we won't\n * show the 'Add' button) if any of styles are set to a value that isn't undefined.\n */\nexport function hasFormInputFocusedStyles(values: ReducedFormInputFocusedStyles): boolean {\n\tconst hasBackground = isFoundAndNotUndefined(values.formInputFocusedBackgroundColor)\n\tconst hasBorderColor =\n\t\tisFoundAndNotUndefined(values.formInputFocusedBorderColor) &&\n\t\tisFoundAndNotUndefined(values.formInputFocusedBorderStyle) &&\n\t\tisFoundAndNotUndefined(values.formInputFocusedBorderWidth)\n\tconst hasBoxShadow =\n\t\t(isArray(values.formInputFocusedBoxShadow) && values.formInputFocusedBoxShadow.length > 0) ||\n\t\tisMixed(values.formInputFocusedBoxShadow)\n\tconst hasTransition = isFoundAndNotUndefined(values.formInputFocusedTransition)\n\treturn hasBackground || hasBorderColor || hasBoxShadow || hasTransition\n}\n", "import type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { instantiateExistingVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { FontSize } from \"document/models/CanvasTree/traits/WithTextStyle.ts\"\nimport { ROOT_FONT_SIZE_CSS_PROPERTY } from \"document/models/CanvasTree/traits/utils/rootFontSizeHelpers.ts\"\nimport { isNumber, isString } from \"utils/typeChecks.ts\"\n\nconst variableRegex = /var\\(--variable-reference-(?<variableId>[^)-]*)(?:-(?<providerId>[^)]*))?/\n\ninterface VariableMatchGroups extends Record<string, string | undefined> {\n\tvariableId: string\n\tproviderId: string | undefined\n}\n\nexport function getRichTextVariables(html: string): VariableReference[] {\n\tconst regex = new RegExp(variableRegex, \"g\")\n\tconst matches = html.matchAll(regex)\n\tconst result: VariableReference[] = []\n\n\tfor (const match of matches) {\n\t\tif (!match.groups) continue\n\t\tconst { variableId, providerId } = match.groups as VariableMatchGroups\n\t\tconst reference = instantiateExistingVariableReference(variableId, providerId)\n\t\tresult.push(reference)\n\t}\n\n\treturn result\n}\n\n// Serialization\nexport type CSSVariableName = `--${string}`\n\nexport function isCSSVariableName(value: unknown): value is CSSVariableName {\n\treturn isString(value) && value.startsWith(\"--\")\n}\n\nexport function parseVariable(value: string): VariableReference | undefined {\n\tconst match = variableRegex.exec(value)\n\n\tif (match && match.groups) {\n\t\tconst { variableId, providerId } = match.groups as VariableMatchGroups\n\t\treturn instantiateExistingVariableReference(variableId, providerId)\n\t}\n}\n\nexport function serializeVariableName(variable: VariableReference): CSSVariableName {\n\tconst providerId = variable.providerId ? `-${variable.providerId}` : \"\"\n\treturn `--variable-reference-${variable.id}${providerId}`\n}\n\nexport function serializeVariable(variable: VariableReference): string {\n\treturn `var(${serializeVariableName(variable)})`\n}\n\n/**\n * Creates a CSS value that is a calculation of the root font size multiplied by the given value.\n * This is because `rem` units are relative to the root font size. For published websites\n * and previews, the `html` element has the proper `font-size` set. However, for the canvas,\n * we must manually calculate the value in pixels. The calculation relies on a canvas-only\n * variable, so when doing codegen, the raw `rem` value is then used.\n *\n * @example\n * serializeRemFontSizeCalcString(1.5) // \"calc(var(--framer-root-font-size, 1rem) * 1.5)\"\n *\n */\nexport function serializeRemFontSizeCalcString(remValue: number): string {\n\treturn `calc(var(${ROOT_FONT_SIZE_CSS_PROPERTY}, 1rem) * ${remValue})`\n}\n\ninterface FontSizeMatchGroups extends Record<string, string | undefined> {\n\tremValue: string\n}\n\nconst fontSizeRegex = /calc\\(var\\(--framer-root-font-size,\\s*1rem\\)\\s*\\*\\s*(?<remValue>\\d+(?:\\.\\d+)?)\\)/u\n\n/**\n * When setting a `rem` font size, we use a calc string based on a canvas-only variable. This\n * ensures proper live updates on the canvas. We need to be able to extract the `rem` value\n * when reading the value from the inline styles so `fontSizes` can be retrieved.\n *\n * @see serializeRemFontSizeCalcString\n */\nexport function parseRemFontSize(value: string): FontSize | undefined {\n\tconst match = fontSizeRegex.exec(value)\n\n\tif (match?.groups) {\n\t\tconst { remValue } = match.groups as FontSizeMatchGroups\n\t\tconst fontSize = parseFloat(remValue)\n\t\treturn isNumber(fontSize) ? [fontSize, \"rem\"] : undefined\n\t}\n}\n", "import { isString } from \"@framerjs/assets/src/utils.ts\"\nimport { isObject } from \"@framerjs/fresco/src/components/utils/typeCheck\"\nimport type { ComponentFont } from \"library/index.ts\"\nimport type { FontSourceName, OpenTypeFeature } from \"library/render/fonts/types.ts\"\nimport { isArray } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\nimport type { TextStylePresetNode } from \"../nodes/TextStylePresetNode.ts\"\nimport { isRichTextNode, isTextStylePresetNode } from \"../nodes/utils/nodeCheck.ts\"\n\n// All OpenType tags from the OpenType Feature List.\n// See: https://learn.microsoft.com/en-us/typography/opentype/spec/featurelist\nconst staticTags = [\n\t\"aalt\", // Access All Alternates\n\t\"abvf\", // Above-base Forms\n\t\"abvm\", // Above-base Mark Positioning\n\t\"abvs\", // Above-base Substitutions\n\t\"afrc\", // Alternative Fractions\n\t\"akhn\", // Akhand\n\t\"apkn\", // Kerning for Alternate Proportional Widths\n\t\"blwf\", // Below-base Forms\n\t\"blwm\", // Below-base Mark Positioning\n\t\"blws\", // Below-base Substitutions\n\t\"calt\", // Contextual Alternates\n\t\"case\", // Case-sensitive Forms\n\t\"ccmp\", // Glyph Composition / Decomposition\n\t\"cfar\", // Conjunct Form After Ro\n\t\"chws\", // Contextual Half-width Spacing\n\t\"cjct\", // Conjunct Forms\n\t\"clig\", // Contextual Ligatures\n\t\"cpct\", // Centered CJK Punctuation\n\t\"cpsp\", // Capital Spacing\n\t\"cswh\", // Contextual Swash\n\t\"curs\", // Cursive Positioning\n\t\"c2pc\", // Petite Capitals From Capitals\n\t\"c2sc\", // Small Capitals From Capitals\n\t\"dist\", // Distances\n\t\"dlig\", // Discretionary Ligatures\n\t\"dnom\", // Denominators\n\t\"dtls\", // Dotless Forms\n\t\"expt\", // Expert Forms\n\t\"falt\", // Final Glyph on Line Alternates\n\t\"fin2\", // Terminal Forms #2\n\t\"fin3\", // Terminal Forms #3\n\t\"fina\", // Terminal Forms\n\t\"flac\", // Flattened Accent Forms\n\t\"frac\", // Fractions\n\t\"fwid\", // Full Widths\n\t\"half\", // Half Forms\n\t\"haln\", // Halant Forms\n\t\"halt\", // Alternate Half Widths\n\t\"hist\", // Historical Forms\n\t\"hkna\", // Horizontal Kana Alternates\n\t\"hlig\", // Historical Ligatures\n\t\"hngl\", // Hangul\n\t\"hojo\", // Hojo Kanji Forms\n\t\"hwid\", // Half Widths\n\t\"init\", // Initial Forms\n\t\"isol\", // Isolated Forms\n\t\"ital\", // Italics\n\t\"jalt\", // Justification Alternates\n\t\"jp78\", // JIS78 Forms\n\t\"jp83\", // JIS83 Forms\n\t\"jp90\", // JIS90 Forms\n\t\"jp04\", // JIS2004 Forms\n\t\"kern\", // Kerning\n\t\"lfbd\", // Left Bounds\n\t\"liga\", // Standard Ligatures\n\t\"ljmo\", // Leading Jamo Forms\n\t\"lnum\", // Lining Figures\n\t\"locl\", // Localized Forms\n\t\"ltra\", // Left-to-right Alternates\n\t\"ltrm\", // Left-to-right Mirrored Forms\n\t\"mark\", // Mark Positioning\n\t\"med2\", // Medial Forms #2\n\t\"medi\", // Medial Forms\n\t\"mgrk\", // Mathematical Greek\n\t\"mkmk\", // Mark to Mark Positioning\n\t\"mset\", // Mark Positioning via Substitution\n\t\"nalt\", // Alternate Annotation Forms\n\t\"nlck\", // NLC Kanji Forms\n\t\"nukt\", // Nukta Forms\n\t\"numr\", // Numerators\n\t\"onum\", // Oldstyle Figures\n\t\"opbd\", // Optical Bounds\n\t\"ordn\", // Ordinals\n\t\"ornm\", // Ornaments\n\t\"palt\", // Proportional Alternate Widths\n\t\"pcap\", // Petite Capitals\n\t\"pkna\", // Proportional Kana\n\t\"pnum\", // Proportional Figures\n\t\"pref\", // Pre-base Forms\n\t\"pres\", // Pre-base Substitutions\n\t\"pstf\", // Post-base Forms\n\t\"psts\", // Post-base Substitutions\n\t\"pwid\", // Proportional Widths\n\t\"qwid\", // Quarter Widths\n\t\"rand\", // Randomize\n\t\"rclt\", // Required Contextual Alternates\n\t\"rkrf\", // Rakar Forms\n\t\"rlig\", // Required Ligatures\n\t\"rphf\", // Reph Form\n\t\"rtbd\", // Right Bounds\n\t\"rtla\", // Right-to-left Alternates\n\t\"rtlm\", // Right-to-left Mirrored Forms\n\t\"ruby\", // Ruby Notation Forms\n\t\"rvrn\", // Required Variation Alternates\n\t\"salt\", // Stylistic Alternates\n\t\"sinf\", // Scientific Inferiors\n\t\"size\", // Optical size\n\t\"smcp\", // Small Capitals\n\t\"smpl\", // Simplified Forms\n\t\"ssty\", // Math Script-style Alternates\n\t\"stch\", // Stretching Glyph Decomposition\n\t\"subs\", // Subscript\n\t\"sups\", // Superscript\n\t\"swsh\", // Swash\n\t\"titl\", // Titling\n\t\"tjmo\", // Trailing Jamo Forms\n\t\"tnam\", // Traditional Name Forms\n\t\"tnum\", // Tabular Figures\n\t\"trad\", // Traditional Forms\n\t\"twid\", // Third Widths\n\t\"unic\", // Unicase\n\t\"valt\", // Alternate Vertical Metrics\n\t\"vapk\", // Kerning for Alternate Proportional Vertical Metrics\n\t\"vatu\", // Vattu Variants\n\t\"vchw\", // Vertical Contextual Half-width Spacing\n\t\"vert\", // Vertical Alternates\n\t\"vhal\", // Alternate Vertical Half Metrics\n\t\"vjmo\", // Vowel Jamo Forms\n\t\"vkna\", // Vertical Kana Alternates\n\t\"vkrn\", // Vertical Kerning\n\t\"vpal\", // Proportional Alternate Vertical Metrics\n\t\"vrt2\", // Vertical Alternates and Rotation\n\t\"vrtr\", // Vertical Alternates for Rotation\n\t\"zero\", // Slashed Zero\n\t\"crcy\", // Currency Symbols\n] as const\n\nconst stylisticSetTags = Array.from({ length: 20 }, (_, i) => `ss${padNumber(i + 1) as OneToTwenty}` as const) // from ss01 to ss20\nconst stylisticSetTagsSet = new Set<string>(stylisticSetTags)\nconst characterVariantTags = Array.from({ length: 99 }, (_, i) => `cv${padNumber(i + 1) as OneToNinetyNine}` as const) // from cv01 to cv99\nconst characterVariantTagsSet = new Set<string>(characterVariantTags)\nconst allTags = [...staticTags, ...characterVariantTags, ...stylisticSetTags] as const\n\nconst openTypeFontFeaturesSet = new Set<string>(allTags)\nconst tagsAppliedByDefault = {\n\tkern: true,\n\tliga: true,\n\topbd: true,\n\tcalt: true,\n\tclig: true,\n\trvrn: true,\n\tsize: true,\n} as const\n\nexport type StylisticSetOpenTypeFeatureTag = (typeof stylisticSetTags)[number]\nexport type CharacterVariantOpenTypeFeatureTag = (typeof characterVariantTags)[number]\ntype TagsAppliedByDefault = keyof typeof tagsAppliedByDefault\n\nexport type StaticOpenTypeFeatureTag = (typeof staticTags)[number]\nexport type OpenTypeFeatureTag = (typeof allTags)[number]\nexport type OpenTypeFontFeatures = OpenTypeFeatureTag[]\n\nexport function cssToOpenTypeFeatureTags(css: string): OpenTypeFeatureTag[] {\n\t// We remove the quotes, \"on\" and \"off\" to only keep the feature tags.\n\tconst maybeOpenTypeFeatureTags = css.split(\",\").map(item => item.trim().replace(/['\"]|\\s*on|\\s*off/giu, \"\"))\n\treturn maybeOpenTypeFeatureTags.filter(isOpenTypeFeatureTag)\n}\n\nexport function openTypeFeatureTagsToCSS(\n\ttags: OpenTypeFeatureTag[] | undefined,\n\tdefaultValue: \"normal\" | null = \"normal\",\n): string | undefined {\n\tif (!tags || tags.length === 0) return defaultValue ? \"normal\" : undefined\n\treturn tags\n\t\t.map(tag => {\n\t\t\t// Some features are applied by default on all fonts, so we need to do the opposite.\n\t\t\tconst featureStatus = isFeatureAppliedByDefault(tag) ? \"off\" : \"on\"\n\t\t\treturn `'${tag}' ${featureStatus}`\n\t\t})\n\t\t.join(\", \")\n}\n\n/**\n * Checks if the given tag is a Stylistic Set OpenType Feature Tag (ss01 to ss20).\n */\nexport function isOpenTypeStylisticSetFeatureTag(tag: unknown): tag is StylisticSetOpenTypeFeatureTag {\n\treturn isString(tag) && stylisticSetTagsSet.has(tag)\n}\n\n/**\n * Checks if the given tag is a Character Variant OpenType Feature Tag (cv01 to cv99).\n */\nexport function isOpenTypeCharacterVariantFeatureTag(tag: unknown): tag is CharacterVariantOpenTypeFeatureTag {\n\treturn isString(tag) && characterVariantTagsSet.has(tag)\n}\n\nexport function isOpenTypeFeatureTag(tag: unknown): tag is OpenTypeFeatureTag {\n\treturn isString(tag) && openTypeFontFeaturesSet.has(tag)\n}\n\nfunction isOpenTypeFeature(data: unknown): data is OpenTypeFeature {\n\treturn isObject(data) && isOpenTypeFeatureTag(data.tag)\n}\n\nexport function isValidOpenTypeFeatures(data: unknown): data is OpenTypeFeature[] {\n\treturn Array.isArray(data) && data.every(isOpenTypeFeature)\n}\n\n/**\n * Some features are applied by default on all fonts, following the OpenType spec.\n */\n\nexport function isFeatureAppliedByDefault(tag: OpenTypeFeatureTag): tag is TagsAppliedByDefault {\n\treturn tag in tagsAppliedByDefault\n}\n\nfunction padNumber(num: number): string {\n\treturn num.toString().padStart(2, \"0\")\n}\n\n/**\n * Checks if the given node has any applied OpenType features.\n */\nexport function hasAppliedOpenTypeFeatures(node: CanvasNode | TextStylePresetNode): boolean {\n\tif (!isTextStylePresetNode(node) && !isRichTextNode(node)) return false\n\tif (isTextStylePresetNode(node)) return isArray(node.openTypeFontFeatures) && node.openTypeFontFeatures.length > 0\n\n\treturn node.getOpenTypeFontFeatures(false).some(features => features && features.length > 0)\n}\n\n/**\n * When a Google font with OpenType features is used, we need to serialize\n * openType=true for the font so that we can choose the complete font file\n * rather than a subset when publishing.\n */\nexport function shouldSerializeOpenType(source: FontSourceName, openType: ComponentFont[\"openType\"]): true | undefined {\n\tif (!openType || source !== \"google\") return undefined\n\n\treturn true\n}\n\ntype Digit = \"0\" | \"1\" | \"2\" | \"3\" | \"4\" | \"5\" | \"6\" | \"7\" | \"8\" | \"9\"\ntype NonZeroDigit = Exclude<Digit, \"0\">\ntype OneToTwenty = `0${NonZeroDigit}` | `1${Digit}` | \"20\"\ntype OneToNinetyNine = `0${NonZeroDigit}` | `${NonZeroDigit}${Digit}`\n", "import { clampNumber } from \"@framerjs/shared\"\nimport { roundedNumber } from \"library/index.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\nimport type { DynamicValue } from \"./DynamicValue.ts\"\nimport type { OmitVariables } from \"./utils/OmitVariables.ts\"\nimport { NotFound } from \"./utils/Reduced.ts\"\nimport type { ReducedRecord } from \"./utils/Reduced.ts\"\nimport { isStylableNode } from \"./utils/hardCodedCodeComponentIdentifierChecks.ts\"\nimport { reduceProperty } from \"./utils/reduceProperty.ts\"\n\nconst cornerShapeKey = \"cornerShape\"\n\nexport interface WithCornerShape {\n\t[cornerShapeKey]: number | DynamicValue | undefined\n}\n\nexport function withCornerShape<T extends CanvasNode>(node: T): node is T & WithCornerShape {\n\treturn cornerShapeKey in node && isStylableNode(node)\n}\n\nexport const cornerShapeDefaults = {\n\tcornerShape: undefined,\n} as const satisfies OmitVariables<WithCornerShape>\n\nexport const cornerShapeDefaultsWhenAdded = {\n\tcornerShape: 1.5,\n} as const satisfies OmitVariables<WithCornerShape>\n\nexport type ReducedCornerShape = ReducedRecord<WithCornerShape>\n\nexport const reducedCornerShapeDefaults = {\n\tcornerShape: NotFound,\n} as const satisfies ReducedCornerShape\n\nexport function reduceCornerShape(node: CanvasNode, result: ReducedCornerShape) {\n\tif (!withCornerShape(node)) return\n\treduceProperty(\"cornerShape\", result, node)\n}\n\nexport const cornerShapeTitle = \"Squircle\"\nexport const cornerShapeBrowserDefault = 1\nconst cornerShapePrecision = 2\nconst minimumCornerShape = 1\nconst maximumCornerShape = 2\nconst minmaxCornerShapeDelta = maximumCornerShape - minimumCornerShape\n\nexport function cornerShapeToPercentage(value: number): number {\n\treturn clampNumber(Math.round(((value - minimumCornerShape) / minmaxCornerShapeDelta) * 100), 0, 100)\n}\n\n// Need to be below `cornerShapeToPercentage` because something doesn't get hoisted right, and these\n// values end up being NaN.\nexport const cornerShapeBrowserDefaultPercentage = cornerShapeToPercentage(cornerShapeBrowserDefault)\nexport const cornerShapeOptionalDefaultPercentage = cornerShapeToPercentage(cornerShapeDefaultsWhenAdded.cornerShape)\n\nexport function roundAndClampCornerShape(value: number): number {\n\treturn clampNumber(roundedNumber(value, cornerShapePrecision), minimumCornerShape, maximumCornerShape)\n}\n\nexport function percentageToCornerShape(value: number): number {\n\treturn roundAndClampCornerShape((value / 100) * minmaxCornerShapeDelta + minimumCornerShape)\n}\n\nexport function unknownPercentageToCornerShape(value: unknown): number | undefined {\n\tif (isNumber(value)) return percentageToCornerShape(value)\n}\n", "import type { AssetMap } from \"@framerjs/assets\"\nimport type { ComponentLoader, DataDefinition } from \"@framerjs/framer-runtime\"\nimport type { ModuleType } from \"@framerjs/shared\"\nimport type { SafeJS } from \"code-generation/js/serializeJS.ts\"\nimport type { PreloadCollector } from \"code-generation/loader/PreloadCollector.ts\"\nimport type { SimulatedDOM } from \"code-generation/simulatedDOM/SimulatedDOM.ts\"\nimport type { SerializableMotionStyle } from \"code-generation/types.ts\"\nimport type { AppearIdCollector } from \"code-generation/utils/AppearIdCollector.ts\"\nimport type { AssetCollector } from \"code-generation/utils/AssetCollector.ts\"\nimport type { BindingCollector } from \"code-generation/utils/BindingCollector.ts\"\nimport type { CSSCollector } from \"code-generation/utils/CSSCollector.ts\"\nimport type { CSSVariableDefinitionCollector } from \"code-generation/utils/CSSVariableDefinitionCollector.ts\"\nimport type { ConditionalRenderingCollector } from \"code-generation/utils/ConditionalRenderingCollector.ts\"\nimport type { CustomCursorCollector } from \"code-generation/utils/CustomCursorCollector.ts\"\nimport type { JSXDeclarationCollector } from \"code-generation/utils/DeclarationCollector.ts\"\nimport type { ElementIdCollector } from \"code-generation/utils/ElementIdCollector.ts\"\nimport type { ErrorCollector } from \"code-generation/utils/ErrorCollector.ts\"\nimport type { EventCollector } from \"code-generation/utils/EventCollector.ts\"\nimport type { FetchDataCollector } from \"code-generation/utils/FetchDataCollector.ts\"\nimport type { FontCollector } from \"code-generation/utils/FontCollector.ts\"\nimport type { ImportCollector } from \"code-generation/utils/ImportCollector.ts\"\nimport type { KitSectionsStructureCollector } from \"code-generation/utils/KitSectionStructureCollector.ts\"\nimport type { LayoutTemplateHitTargetAnnotationCollector } from \"code-generation/utils/LayoutTemplateHitTargetAnnotationCollector.ts\"\nimport type { LinkCollector } from \"code-generation/utils/LinkCollector.ts\"\nimport type { ModuleLocalizedValueCollector } from \"code-generation/utils/LocalizedValueCollector.ts\"\nimport type { MetricsCollector } from \"code-generation/utils/MetricsCollector.ts\"\nimport type { OverlayCollector } from \"code-generation/utils/OverlayCollector.ts\"\nimport type { SubqueryCollector } from \"code-generation/utils/SubqueryCollector.ts\"\nimport type { TrackingIdCollector } from \"code-generation/utils/TrackingIdCollector.ts\"\nimport type { TriggerActionCollector } from \"code-generation/utils/TriggerActionCollector.ts\"\nimport type { VariableCollector } from \"code-generation/utils/VariableCollector.ts\"\nimport type { VectorSetCollector } from \"code-generation/utils/VectorSetCollector.ts\"\nimport type { ValueTransformCollector } from \"code-generation/utils/valueTransformCollector/ValueTransformCollector.ts\"\nimport type { EngineChanges } from \"document/EngineChanges.ts\"\nimport type { CanvasTree, FrameNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { CombinedVariableProviderControlMap } from \"document/models/CanvasTree/traits/VariableProvider.ts\"\nimport type { VariantGradientInfo } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport type { IsReplica } from \"document/models/CanvasTree/traits/WithTemplate.ts\"\nimport type { IsVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport type { NodeRendersWithMotion } from \"document/models/CanvasTree/traits/collectStyles/nodeRendersWithMotion.ts\"\nimport type { ModulesStore } from \"document/stores/ModulesStore.ts\"\nimport type { ScopeType } from \"document/utils/scopeType.ts\"\nimport { isObject } from \"utils/typeChecks.ts\"\nimport type { CreateDeduplicatedDynamicValueBinding } from \"./createDeduplicatedDynamicValueBinding.ts\"\nimport type { JSXElementProps } from \"./jsxAttributesForNode.ts\"\n\ntype OrderMap = Map<NodeID, number>\n\ninterface AncestorInfoVariantFlags {\n\treadonly itemsOrderOverrides: Record<NodeID, OrderMap | undefined>\n\treadonly hiddenInVariants: Set<NodeID>\n\treadonly inheritedControlMap: CombinedVariableProviderControlMap | undefined\n\treadonly inCodeOverride: boolean\n\treadonly subqueries?: SubqueryCollector\n\treadonly kitSectionNodeId?: NodeID\n}\n\nexport interface RepeaterInfo {\n\treadonly id: NodeID\n\treadonly annotations: DataDefinition[\"annotations\"] | undefined\n}\n\nexport interface AncestorInfo extends Partial<AncestorInfoVariantFlags> {\n\treadonly index?: number\n\treadonly style?: SerializableMotionStyle\n\treadonly withKey?: boolean\n\treadonly layoutId?: string\n\treadonly lastRepeaterId?: NodeID\n\treadonly inRepeatedItem?: boolean\n\treadonly inComponentSlot?: boolean\n\treadonly isColumnMasonryLayout?: boolean\n}\n\nexport interface JSXEngineDependencies {\n\treadonly componentLoader: ComponentLoader\n\treadonly modulesStore: ModulesStore\n\treadonly tree: CanvasTree\n\treadonly engineChanges: EngineChanges\n\treadonly assetMap: AssetMap\n}\n\nexport interface PackageDependencies {\n\treadonly dependencies: Set<string>\n\treadonly addDependency: (name: string) => void\n}\n\nexport const defaultJSXMetrics = () => ({ nodes: 0, svgBytes: 0, textBytes: 0, variants: 0 })\n\ninterface Collectors {\n\treadonly overlays: OverlayCollector\n\treadonly events: EventCollector\n\treadonly assets: AssetCollector\n\treadonly fonts: FontCollector\n\treadonly variables: VariableCollector\n\treadonly fetches: FetchDataCollector\n\treadonly valueTransforms: ValueTransformCollector\n\treadonly links: LinkCollector\n\treadonly imports: ImportCollector\n\treadonly elementIds: ElementIdCollector\n\treadonly metrics: MetricsCollector<keyof ReturnType<typeof defaultJSXMetrics>>\n\treadonly appearIds: AppearIdCollector\n\treadonly declarations: JSXDeclarationCollector\n\treadonly localizedValues: ModuleLocalizedValueCollector\n\treadonly trackingIds: TrackingIdCollector\n\treadonly kitSectionsStructure: KitSectionsStructureCollector\n\treadonly triggerActions: TriggerActionCollector\n}\n\nexport interface JSXCollectors extends Collectors {\n\treadonly css: CSSCollector\n\treadonly imports: ImportCollector\n\treadonly bindings: BindingCollector\n\treadonly renderFunctions: ConditionalRenderingCollector\n\treadonly packages: PackageDependencies\n\treadonly componentPresetIds: Set<NodeID>\n\treadonly customCursors: CustomCursorCollector\n\treadonly errors: ErrorCollector\n\treadonly preload: PreloadCollector\n\treadonly hitTargets: LayoutTemplateHitTargetAnnotationCollector\n\treadonly vectorSets: VectorSetCollector\n\treadonly cssVariableDefinitions: CSSVariableDefinitionCollector\n}\n\nexport function isJSXContext(context: unknown): context is JSXContext {\n\treturn isObject(context) && context.type === \"jsxContext\"\n}\n\n/**\n * A context object that contains the data that is required to generate JSX\n * while recursing a tree of CanvasNodes to create SafeJS jsx.\n */\nexport interface JSXContext extends JSXCollectors, JSXEngineDependencies {\n\treadonly type: \"jsxContext\"\n\treadonly rootId: NodeID\n\treadonly scopeId: NodeID\n\treadonly scopeType:\n\t\t| ScopeType.CanvasPage\n\t\t| ScopeType.WebPage\n\t\t| ScopeType.SmartComponent\n\t\t| ScopeType.LayoutTemplate\n\t\t| ScopeType.VectorSet\n\t\t| ScopeType.DesignPage\n\n\t/**\n\t * When true, code generation will prefer to use inline style over css rules, skip variants, and\n\t * add other values that allow an LLM to understand the code.\n\t */\n\treadonly llmSnapshot: boolean\n\t/**\n\t * Keeps a record of which nodes should be rendered using <ul> tags\n\t */\n\treadonly renderAsListNodes: Map<NodeID, true>\n\t/**\n\t * Keeps a record of nodes that will render as Image because at least one\n\t * variant has image fill.\n\t */\n\treadonly nodesRenderedAsImageInAnyVariant: Set<NodeID>\n\treadonly nodeRendersWithMotion: NodeRendersWithMotion\n\t/**\n\t * Map of overlay node id -> props used by the Overlay component that wraps overlay triggers.\n\t */\n\treadonly overlayProps: Map<NodeID, JSXElementProps | undefined>\n\treadonly moduleType: ModuleType\n\treadonly variants: (FrameNode & IsReplica & IsVariant)[]\n\t/**\n\t * Lookup table to see if a variant has any gesture.\n\t */\n\treadonly topLevelVariantsWithGestures: Record<NodeID, boolean>\n\t/**\n\t * If a layer is a link in any variant, all variants of that layer will\n\t * be rendered with an <a> in code generation, and must never be\n\t * display: inline. We can reuse the same className for all of these\n\t * layers.\n\t */\n\treadonly linkClassName: string\n\treadonly repeaterInfo: Map<NodeID, RepeaterInfo>\n\treadonly renderConditions: Map<NodeID, true | SafeJS>\n\t/**\n\t * When serializing a Layout Template we reserve the binding `children`\n\t * early for the slot, and reference it later in the JSX.\n\t */\n\treadonly layoutTemplateSlotBinding: SafeJS | undefined\n\n\t/**\n\t * Keeps a record of which nodes have any gradient fill. This allows us to apply\n\t * a generated gradient to simulate solid background colors when creating variants\n\t * with a solid background.\n\t */\n\treadonly nodesWithAnyGradientFill: Map<NodeID, VariantGradientInfo>\n\n\t/**\n\t * Track form ids encountered while serializing the source.\n\t */\n\treadonly formIds: Set<NodeID>\n\n\t/**\n\t * Creates a dynamic value binding for a node, deduplicating it if it's a\n\t * computed value. If the computed value is based on a variable reference that\n\t * is provided by a data repeater, the declaration will be inserted into the\n\t * javascript scope provided by the repeater.\n\t */\n\treadonly createDeduplicatedDynamicValueBinding: CreateDeduplicatedDynamicValueBinding\n\n\treadonly simulatedDOM: SimulatedDOM\n\n\t/**\n\t * The serialization id of the current code-generation. This is a unique\n\t * hash that allows ensuring that updating declarations for a stable\n\t * className doesn't cause the browser to apply stale rules.\n\t */\n\treadonly serializationId: string\n\n\t/** If the scope is a web page that accepts a Layout Template. */\n\treadonly acceptsLayoutTemplate: boolean | undefined\n}\n\n/**\n * When reducing the code component identifiers to a Set of unique identifiers, we want to treat\n * Vector instances with dynamic identifiers as a single identifier. We use a Symbol to represent\n * this to ensure uniqueness.\n */\nexport const VariableInstance = Symbol(\"VariableInstance\")\n\nexport interface ProcessedVariantsFlags extends AncestorInfoVariantFlags {\n\tisAnyVariantALink: boolean\n\tisAnyVariantAnImage: boolean\n\tisAnyVariantAnEffect: boolean\n\tisAnyVariantAVariantAppearEffect: boolean\n\tisAnyVariantATickerEffect: boolean\n\tisAnyVariantATickerItem: boolean\n\tisAnyVariantATransitionOverride: boolean\n\tisAnyVariantARef: boolean\n\tisAnyVariantFloating: boolean\n\tisAnyVariantOptimizedAppearEffect: boolean\n\tisAnyVariantPaginated: boolean\n\tisAnyVariantColumnMasonryLayout: boolean\n\tidentifiers?: Set<string | typeof VariableInstance>\n}\n", "import type { AnyComponentLoader } from \"@framerjs/framer-runtime\"\nimport type { Opaque } from \"@framerjs/shared\"\nimport type { SerializableRecord } from \"code-generation/js/SerializableValue.ts\"\nimport type { JSXContext } from \"code-generation/jsx/types.ts\"\nimport type { SerializableMotionStyle } from \"code-generation/types.ts\"\nimport type { FetchDataValueResolver } from \"document/models/CanvasTree/traits/FetchDataValue.ts\"\nimport type { UnknownProps } from \"document/models/CanvasTree/traits/utils/UnknownProps.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../../document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport type { CombinedVariableProviderValueMap } from \"../../document/models/CanvasTree/traits/VariableProvider.ts\"\nimport type { AllOrNothing } from \"../../document/models/CanvasTree/traits/utils/AllOrNothing.ts\"\nimport type { ColorCollector } from \"./CSSVariableDefinitionCollector.ts\"\n\ninterface BaseContext {\n\treadonly componentLoader: AnyComponentLoader\n}\n\ninterface CanvasContext extends BaseContext {\n\treadonly variableOverrides: CombinedVariableProviderValueMap | undefined\n\treadonly getResolvedFetchDataValue?: FetchDataValueResolver\n}\n\nexport interface StylePresetContext extends BaseContext {\n\treadonly colors: ColorCollector\n}\n\nexport function isStylePresetContext(context: CollectorContext | undefined): context is StylePresetContext {\n\treturn !isUndefined(context) && \"colors\" in context\n}\n\nexport type CollectorContext = BaseContext &\n\tOmit<AllOrNothing<JSXContext> & AllOrNothing<CanvasContext> & AllOrNothing<StylePresetContext>, keyof BaseContext>\n\n/**\n * @FIXME - UnknownProps is not the right type here. It should be\n * `SerializableRecord`, which would ensure that we aren't collecting values we\n * cannot code-generate (like functions, Sets, Maps, etc.). Unfortunately, that\n * makes it hard to reuse prop collectors in CanvasNode.getProps()\n * implementations where a specific type is expected.\n */\ntype CollectionFunction<T extends UnknownProps> = (node: CanvasNode, props: T, context: CollectorContext) => void\n\ntype PropCollectionFunction = Opaque<CollectionFunction<UnknownProps>, \"propCollector\">\ntype StyleCollectionFunction = Opaque<CollectionFunction<SerializableMotionStyle>, \"propCollector\">\n\n// Create collection functions for the 2 collection targets we currently\n// support: MotionStyle and ReactProps, providing the shared interface, and\n// augments the type with an Opaque type that ensures that these functions are\n// distinct to typescript and that generic function with the same type signature\n// is not valid.\n//\n// This is slightly overkill, but it makes refactoring simpler, since collection\n// functions are just functions, that are all implemented in separate files.\n//\n// If this causes headaches, the opaque types can be removed.\nexport const propCollector = (fn: CollectionFunction<UnknownProps>) => fn as PropCollectionFunction\nexport const styleCollector = (fn: CollectionFunction<SerializableMotionStyle>) => fn as StyleCollectionFunction\n\nconst collector = <T extends UnknownProps>(fn: CollectionFunction<T>) => fn\n\n/**\n * Create a function ahead of time that will run all provided\n * CollectionFunctions, guaranteeing consistent arguments are passed to all\n * provided collector functions. CollectionFunctions must all be of a single\n * sub-type.\n */\nexport function mergeCollectors<T extends SerializableRecord>(\n\t...collectors: CollectionFunction<T>[]\n): CollectionFunction<T> {\n\tconst uniqueCollectors = new Set(collectors)\n\n\treturn collector((node, props, context) => {\n\t\tfor (const fn of uniqueCollectors) fn(node, props, context)\n\t})\n}\n", "export function mapTuple<T extends readonly unknown[], R>(\n\tarray: T,\n\tcallback: (value: T[number], index: number, array: T) => R,\n): { [K in keyof T]: R } {\n\treturn array.map(callback) as { [K in keyof T]: R }\n}\n", "import type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport type { DynamicValue } from \"../DynamicValue.ts\"\n\n/**\n * Represents element within a FormContainer that are input elements that are\n * Interactive. The properties in this trait should be common to all form\n * elements.\n */\nexport interface WithFormInput {\n\t/**\n\t * The name of the input.\n\t * Equates to <input name=\"foo\" />\n\t */\n\tformInputName: string | DynamicValue | undefined\n\t/**\n\t * Whether the input should be required\n\t */\n\tformInputRequired: boolean | DynamicValue | undefined\n\t/**\n\t * Whether the input should be hidden Only applicable for input elements.\n\t */\n\tformInputHidden: boolean | DynamicValue | undefined\n\n\t/**\n\t * The initial value, or value of the hidden input.\n\t */\n\tformInputValue: string | DynamicValue | undefined\n\t/**\n\t * Whether the input field should be auto focused.\n\t */\n\tformInputAutoFocus: boolean | DynamicValue | undefined\n}\n\nexport const formInputDefaults: WithFormInput = {\n\tformInputName: undefined,\n\tformInputRequired: undefined,\n\tformInputHidden: undefined,\n\tformInputValue: undefined,\n\tformInputAutoFocus: undefined,\n}\n\nconst key: keyof WithFormInput = \"formInputName\"\n\nexport function withFormInput<T extends CanvasNode>(node: T): node is T & WithFormInput {\n\treturn key in node\n}\n", "import { shouldBeNever } from \"@framerjs/shared\"\n\ntype EnumOption = string | number | boolean | null\n\nexport function fallbackTitleForOption(option: EnumOption): string {\n\tif (typeof option === \"string\") return option\n\tif (typeof option === \"number\") return `${option}`\n\tif (option === true) return \"true\"\n\tif (option === false) return \"false\"\n\tif (option === null) return \"null\"\n\n\tshouldBeNever(option)\n\treturn \"Not Found\"\n}\n", "/**\n * Combine creating and checking the validity of a date into a single function\n */\nexport function getValidDate(value: string): Date | null {\n\tconst date = new Date(value)\n\treturn !Number.isNaN(date.getTime()) ? date : null\n}\n", "import type { AnyComponentLoader } from \"@framerjs/framer-runtime\"\nimport type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport type { SandboxRepeaterData } from \"document/SandboxRepeaterData.ts\"\nimport type { CanvasNode, CanvasTree } from \"document/models/CanvasTree/index.ts\"\nimport type {\n\tVariableProviderControlMap,\n\tVariableProviderValueMap,\n\tVariableProviderVariableMap,\n} from \"./VariableProvider.ts\"\n\n/**\n * Exposes information about all the variables that the node provides to some of its descendants.\n * If you need to know which variables are provided to a specific child and its subtree\n * (which might be a subset of all variables), pass a `child` parameter to the methods.\n *\n * Note: This is a workaround because repeaters may have non-repeated children that do not have access to all variables.\n * For a ScopeNode, you can assume that all children are treated equally.\n * We eventually want nodes to separate 'array data providing' from 'repeating oneself on an array' and\n * make nodes provide variables starting at themselves and not at their children, then this special handling is eliminated.\n */\nexport interface WithVariableProvider {\n\t/** The data source identifier for collections and instance identifier for smart components. */\n\tgetVariableSourceIdentifier(): ModuleExportIdentifierString | undefined\n\n\tgetProvidedVariableMap(\n\t\ttree: CanvasTree,\n\t\tchild: CanvasNode | undefined,\n\t\tcomponentLoader: AnyComponentLoader,\n\t\tcomponentLoaderHash: string | undefined,\n\t): VariableProviderVariableMap | undefined\n\n\t/** A map of variable id to variable value. */\n\tgetProvidedValueMap(\n\t\ttree: CanvasTree,\n\t\tchild: CanvasNode | undefined,\n\t\tcomponentLoader: AnyComponentLoader,\n\t\tsandboxRepeaterData: SandboxRepeaterData,\n\t\tcomponentLoaderHash: string | undefined,\n\t): VariableProviderValueMap | undefined\n\n\t/** A map of variable id to variable control description. */\n\tgetProvidedControlMap(\n\t\ttree: CanvasTree,\n\t\tchild: CanvasNode | undefined,\n\t\tcomponentLoader: AnyComponentLoader,\n\t\tcomponentLoaderHash: string | undefined,\n\t): VariableProviderControlMap | undefined\n}\n\nconst key: keyof WithVariableProvider = \"getProvidedVariableMap\"\n\nexport function withVariableProvider(node: CanvasNode | null | undefined): node is CanvasNode & WithVariableProvider {\n\treturn !!node && key in node\n}\n", "// NOTE: Only `RichTextNode.textContent` supports `relative`.\nexport const dateDisplayOptions = [\"date\", \"time\", \"date-time\", \"relative\"] as const\n\nexport type DateDisplayOption = (typeof dateDisplayOptions)[number]\n\nconst relativeDateFormatOptions = [\n\t\"auto\",\n\t\"second\",\n\t\"minute\",\n\t\"hour\",\n\t\"day\",\n\t\"week\",\n\t\"month\",\n\t\"quarter\",\n\t\"year\",\n] as const\n\nexport type RelativeDateFormatOption = (typeof relativeDateFormatOptions)[number]\n\nexport const dateDisplayConfig = {\n\tdate: {\n\t\tlabel: \"Date\",\n\t\tformats: [\"all\", \"day\", \"month\", \"year\", \"day-month\", \"month-year\"],\n\t\tdefault: \"all\",\n\t},\n\ttime: {\n\t\tlabel: \"Time\",\n\t\tformats: [\"hours-minutes\"],\n\t\tdefault: \"hours-minutes\",\n\t},\n\t\"date-time\": {\n\t\tlabel: \"Date & Time\",\n\t\tformats: [\"all\"],\n\t\tdefault: \"all\",\n\t},\n\trelative: {\n\t\tlabel: \"Relative\",\n\t\tformats: relativeDateFormatOptions,\n\t\tdefault: \"auto\",\n\t},\n} as const satisfies Record<\n\tDateDisplayOption,\n\t{\n\t\tformats: readonly string[]\n\t\tdefault: string\n\t\tlabel: string\n\t}\n>\n\ntype DateDisplayConfig = typeof dateDisplayConfig\n\nexport type DateFormatOption = DateDisplayConfig[keyof DateDisplayConfig][\"formats\"][number]\n\nexport function getAllDateFormatOptions(): readonly DateFormatOption[] {\n\tconst seen = new Set<DateFormatOption>()\n\tfor (const display of Object.values(dateDisplayConfig)) {\n\t\tfor (const format of display.formats) seen.add(format)\n\t}\n\treturn [...seen]\n}\n\nexport const dateStyleOptions = [\"narrow\", \"compact\", \"short\", \"medium\", \"long\", \"full\"] as const\n\nexport type DateStyleOption = (typeof dateStyleOptions)[number]\n\nexport const DEFAULT_DATE_STYLE: DateStyleOption = \"medium\"\n\ntype DateFormatKey = keyof LooseDateFormatConfig\n\ntype LooseDateFormatConfig = {\n\t[K in keyof DateDisplayConfig as `${K}_${DateDisplayConfig[K][\"formats\"][number]}`]: {\n\t\tlabel: string\n\t\tstyles: readonly DateStyleOption[]\n\t\tdefault: DateStyleOption\n\t\tcontrolDirection: ControlDirection\n\t}\n}\n\nconst relativeDateStyleOptions = [\"narrow\", \"short\", \"long\"] as const\n\nexport type RelativeDateStyleOption = (typeof relativeDateStyleOptions)[number]\n\nenum ControlDirection {\n\tHorizontal = \"horizontal\",\n\tVertical = \"vertical\",\n}\n\nexport const dateFormatConfig = {\n\tdate_all: {\n\t\tlabel: \"Full Date\",\n\t\tstyles: [\"short\", \"medium\", \"long\", \"full\"],\n\t\tdefault: \"short\",\n\t\tcontrolDirection: ControlDirection.Horizontal,\n\t},\n\tdate_day: {\n\t\tlabel: \"Day\",\n\t\tstyles: [\"short\", \"medium\", \"long\", \"full\"],\n\t\tdefault: \"short\",\n\t\tcontrolDirection: ControlDirection.Horizontal,\n\t},\n\tdate_month: {\n\t\tlabel: \"Month\",\n\t\tstyles: [\"short\", \"medium\", \"long\"],\n\t\tdefault: \"short\",\n\t\tcontrolDirection: ControlDirection.Horizontal,\n\t},\n\tdate_year: {\n\t\tlabel: \"Year\",\n\t\tstyles: [\"short\", \"full\"],\n\t\tdefault: \"short\",\n\t\tcontrolDirection: ControlDirection.Horizontal,\n\t},\n\t\"date_day-month\": {\n\t\tlabel: \"Day & Month\",\n\t\tstyles: [\"compact\", \"short\", \"medium\", \"long\", \"full\"],\n\t\tdefault: \"short\",\n\t\tcontrolDirection: ControlDirection.Horizontal,\n\t},\n\t\"date_month-year\": {\n\t\tlabel: \"Month & Year\",\n\t\tstyles: [\"short\", \"medium\", \"long\"],\n\t\tdefault: \"short\",\n\t\tcontrolDirection: ControlDirection.Horizontal,\n\t},\n\t\"time_hours-minutes\": {\n\t\tlabel: \"Hours & Minutes\",\n\t\tstyles: [\"short\", \"medium\", \"long\"],\n\t\tdefault: \"short\",\n\t\tcontrolDirection: ControlDirection.Vertical,\n\t},\n\t\"date-time_all\": {\n\t\tlabel: \"Date & Time\",\n\t\tstyles: [\"short\", \"medium\", \"long\", \"full\"],\n\t\tdefault: \"short\",\n\t\tcontrolDirection: ControlDirection.Horizontal,\n\t},\n\trelative_auto: {\n\t\tlabel: \"Auto\",\n\t\tstyles: relativeDateStyleOptions,\n\t\tdefault: \"long\",\n\t\tcontrolDirection: ControlDirection.Horizontal,\n\t},\n\trelative_second: {\n\t\tlabel: \"Seconds\",\n\t\tstyles: relativeDateStyleOptions,\n\t\tdefault: \"long\",\n\t\tcontrolDirection: ControlDirection.Horizontal,\n\t},\n\trelative_minute: {\n\t\tlabel: \"Minutes\",\n\t\tstyles: relativeDateStyleOptions,\n\t\tdefault: \"long\",\n\t\tcontrolDirection: ControlDirection.Horizontal,\n\t},\n\trelative_hour: {\n\t\tlabel: \"Hours\",\n\t\tstyles: relativeDateStyleOptions,\n\t\tdefault: \"long\",\n\t\tcontrolDirection: ControlDirection.Horizontal,\n\t},\n\trelative_day: {\n\t\tlabel: \"Days\",\n\t\tstyles: relativeDateStyleOptions,\n\t\tdefault: \"long\",\n\t\tcontrolDirection: ControlDirection.Horizontal,\n\t},\n\trelative_week: {\n\t\tlabel: \"Weeks\",\n\t\tstyles: relativeDateStyleOptions,\n\t\tdefault: \"long\",\n\t\tcontrolDirection: ControlDirection.Horizontal,\n\t},\n\trelative_month: {\n\t\tlabel: \"Months\",\n\t\tstyles: relativeDateStyleOptions,\n\t\tdefault: \"long\",\n\t\tcontrolDirection: ControlDirection.Horizontal,\n\t},\n\trelative_quarter: {\n\t\tlabel: \"Quarters\",\n\t\tstyles: relativeDateStyleOptions,\n\t\tdefault: \"long\",\n\t\tcontrolDirection: ControlDirection.Horizontal,\n\t},\n\trelative_year: {\n\t\tlabel: \"Years\",\n\t\tstyles: relativeDateStyleOptions,\n\t\tdefault: \"long\",\n\t\tcontrolDirection: ControlDirection.Horizontal,\n\t},\n} as const satisfies LooseDateFormatConfig\n\ntype StrictDateFormatConfig = typeof dateFormatConfig\n\ntype DateStyleConfig = {\n\t[K in keyof StrictDateFormatConfig as `${K}_${StrictDateFormatConfig[K][\"styles\"][number]}`]: {\n\t\toptions: Intl.DateTimeFormatOptions\n\t\toverrideLabel?: string\n\t}\n}\n\ntype DateStyleKey = keyof typeof dateStyleConfig\n\nexport const dateStyleConfig: DateStyleConfig = {\n\tdate_all_short: {\n\t\toptions: { dateStyle: \"short\" },\n\t},\n\tdate_all_medium: {\n\t\toptions: { dateStyle: \"medium\" },\n\t},\n\tdate_all_long: {\n\t\toptions: { dateStyle: \"long\" },\n\t},\n\tdate_all_full: {\n\t\toptions: { dateStyle: \"full\" },\n\t},\n\tdate_day_short: {\n\t\toptions: { day: \"numeric\" },\n\t},\n\tdate_day_medium: {\n\t\toptions: { weekday: \"short\" },\n\t},\n\tdate_day_long: {\n\t\toptions: { weekday: \"long\" },\n\t},\n\tdate_day_full: {\n\t\toptions: { weekday: \"long\", day: \"numeric\" },\n\t},\n\tdate_month_short: {\n\t\toptions: { month: \"numeric\" },\n\t},\n\tdate_month_medium: {\n\t\toptions: { month: \"short\" },\n\t},\n\tdate_month_long: {\n\t\toptions: { month: \"long\" },\n\t},\n\tdate_year_short: {\n\t\toverrideLabel: \"Short\",\n\t\toptions: { year: \"2-digit\" },\n\t},\n\tdate_year_full: {\n\t\toverrideLabel: \"Full\",\n\t\toptions: { year: \"numeric\" },\n\t},\n\t\"date_day-month_compact\": {\n\t\toptions: { day: \"numeric\", month: \"numeric\" },\n\t},\n\t\"date_day-month_short\": {\n\t\toptions: { day: \"numeric\", month: \"short\" },\n\t},\n\t\"date_day-month_medium\": {\n\t\toptions: { day: \"numeric\", month: \"long\" },\n\t},\n\t\"date_day-month_long\": {\n\t\toptions: { day: \"numeric\", weekday: \"short\", month: \"long\" },\n\t},\n\t\"date_day-month_full\": {\n\t\toptions: { day: \"numeric\", weekday: \"long\", month: \"long\" },\n\t},\n\t\"date_month-year_short\": {\n\t\toptions: { month: \"numeric\", year: \"numeric\" },\n\t},\n\t\"date_month-year_medium\": {\n\t\toptions: { month: \"short\", year: \"numeric\" },\n\t},\n\t\"date_month-year_long\": {\n\t\toptions: { month: \"long\", year: \"numeric\" },\n\t},\n\t\"time_hours-minutes_short\": {\n\t\toverrideLabel: \"Locale Default\",\n\t\toptions: { timeStyle: \"short\" },\n\t},\n\t\"time_hours-minutes_medium\": {\n\t\toverrideLabel: \"12-hour\",\n\t\toptions: { hour: \"2-digit\", minute: \"2-digit\", hour12: true },\n\t},\n\t\"time_hours-minutes_long\": {\n\t\toverrideLabel: \"24-hour\",\n\t\toptions: { hour: \"2-digit\", minute: \"2-digit\", hour12: false },\n\t},\n\t\"date-time_all_short\": {\n\t\toptions: { dateStyle: \"short\", timeStyle: \"short\" },\n\t},\n\t\"date-time_all_medium\": {\n\t\toptions: { dateStyle: \"medium\", timeStyle: \"short\" },\n\t},\n\t\"date-time_all_long\": {\n\t\toptions: { dateStyle: \"long\", timeStyle: \"short\" },\n\t},\n\t\"date-time_all_full\": {\n\t\toptions: { dateStyle: \"full\", timeStyle: \"short\" },\n\t},\n\trelative_auto_narrow: {\n\t\toverrideLabel: \"S\",\n\t\toptions: {},\n\t},\n\trelative_auto_short: {\n\t\toverrideLabel: \"M\",\n\t\toptions: {},\n\t},\n\trelative_auto_long: {\n\t\toverrideLabel: \"L\",\n\t\toptions: {},\n\t},\n\trelative_second_narrow: {\n\t\toverrideLabel: \"S\",\n\t\toptions: {},\n\t},\n\trelative_second_short: {\n\t\toverrideLabel: \"M\",\n\t\toptions: {},\n\t},\n\trelative_second_long: {\n\t\toverrideLabel: \"L\",\n\t\toptions: {},\n\t},\n\trelative_minute_narrow: {\n\t\toverrideLabel: \"S\",\n\t\toptions: {},\n\t},\n\trelative_minute_short: {\n\t\toverrideLabel: \"M\",\n\t\toptions: {},\n\t},\n\trelative_minute_long: {\n\t\toverrideLabel: \"L\",\n\t\toptions: {},\n\t},\n\trelative_hour_narrow: {\n\t\toverrideLabel: \"S\",\n\t\toptions: {},\n\t},\n\trelative_hour_short: {\n\t\toverrideLabel: \"M\",\n\t\toptions: {},\n\t},\n\trelative_hour_long: {\n\t\toverrideLabel: \"L\",\n\t\toptions: {},\n\t},\n\trelative_day_narrow: {\n\t\toverrideLabel: \"S\",\n\t\toptions: {},\n\t},\n\trelative_day_short: {\n\t\toverrideLabel: \"M\",\n\t\toptions: {},\n\t},\n\trelative_day_long: {\n\t\toverrideLabel: \"L\",\n\t\toptions: {},\n\t},\n\trelative_week_narrow: {\n\t\toverrideLabel: \"S\",\n\t\toptions: {},\n\t},\n\trelative_week_short: {\n\t\toverrideLabel: \"M\",\n\t\toptions: {},\n\t},\n\trelative_week_long: {\n\t\toverrideLabel: \"L\",\n\t\toptions: {},\n\t},\n\trelative_month_narrow: {\n\t\toverrideLabel: \"S\",\n\t\toptions: {},\n\t},\n\trelative_month_short: {\n\t\toverrideLabel: \"M\",\n\t\toptions: {},\n\t},\n\trelative_month_long: {\n\t\toverrideLabel: \"L\",\n\t\toptions: {},\n\t},\n\trelative_quarter_narrow: {\n\t\toverrideLabel: \"S\",\n\t\toptions: {},\n\t},\n\trelative_quarter_short: {\n\t\toverrideLabel: \"M\",\n\t\toptions: {},\n\t},\n\trelative_quarter_long: {\n\t\toverrideLabel: \"L\",\n\t\toptions: {},\n\t},\n\trelative_year_narrow: {\n\t\toverrideLabel: \"S\",\n\t\toptions: {},\n\t},\n\trelative_year_short: {\n\t\toverrideLabel: \"M\",\n\t\toptions: {},\n\t},\n\trelative_year_long: {\n\t\toverrideLabel: \"L\",\n\t\toptions: {},\n\t},\n}\n\nexport function getVerifiedDateDisplayValue(display: DateDisplayOption | undefined, supportsRelativeDates: boolean) {\n\tif (display === \"relative\" && !supportsRelativeDates) return \"date\"\n\tif (display && dateDisplayOptions.includes(display)) return display\n\treturn \"date\"\n}\n\nexport function getVerifiedDateFormatValue(display: DateDisplayOption, format: DateFormatOption | undefined) {\n\tconst formatOptions = dateDisplayConfig[display]\n\tif (format && (formatOptions.formats as readonly string[]).includes(format)) return format\n\treturn formatOptions.default\n}\n\nexport function getVerifiedDateStyleValue(\n\tdisplay: DateDisplayOption,\n\tformat: DateFormatOption,\n\tstyle: DateStyleOption | undefined,\n) {\n\tconst styleOptions = dateFormatConfig[`${display}_${format}` as DateFormatKey]\n\tif (style && dateFormatConfig && (styleOptions.styles as readonly string[]).includes(style)) {\n\t\treturn style\n\t}\n\treturn styleOptions.default\n}\n\nexport function transformOptionsToDateFormatKey(\n\tdisplay: DateDisplayOption | undefined,\n\tformat: DateFormatOption | undefined,\n\tsupportsRelativeDates: boolean,\n) {\n\tconst displayValue = getVerifiedDateDisplayValue(display, supportsRelativeDates)\n\tconst formatValue = getVerifiedDateFormatValue(displayValue, format)\n\treturn `${displayValue}_${formatValue}` as DateFormatKey\n}\n\nexport function transformOptionsToDateStyleKey(\n\tdisplay: DateDisplayOption | undefined,\n\tformat: DateFormatOption | undefined,\n\tstyle: DateStyleOption | undefined,\n\tsupportsRelativeDates: boolean,\n) {\n\tconst displayValue = getVerifiedDateDisplayValue(display, supportsRelativeDates)\n\tconst formatValue = getVerifiedDateFormatValue(displayValue, format)\n\tconst styleValue = getVerifiedDateStyleValue(displayValue, formatValue, style)\n\treturn `${displayValue}_${formatValue}_${styleValue}` as DateStyleKey\n}\n", "import type { VerifiedArrayControlDescription } from \"@framerjs/framer-runtime\"\nimport { assert, assertNever, emptyArray, getLogger, isEmptyObject } from \"@framerjs/shared\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { getEnumControlPropValue } from \"document/models/controlProps/getControlProps.ts\"\nimport type { ControlDescription, ObjectPropertyControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isBoolean, isNumber, isObject, isString } from \"utils/typeChecks.ts\"\nimport { randomID } from \"../../nodes/NodeID.ts\"\nimport { type ComputedValue, createComputedValue } from \"../ComputedValue.ts\"\nimport { isDynamicValue } from \"../DynamicValue.ts\"\nimport type {\n\tConvertFromBooleanOutputType,\n\tConvertFromBooleanOutputValueType,\n\tConvertFromEnumCase,\n\tConvertFromEnumOrStringOutputValueType,\n\tConvertFromEnumOutputType,\n\tConvertFromStringCase,\n\tConvertFromStringOutputType,\n\tValueTransform,\n\tValueTransformEquals,\n\tValueTransformName,\n\tValueTransformNegate,\n\tValueTransformType,\n} from \"../ValueTransform.ts\"\nimport { getOutputTypesForValueTransformName } from \"../ValueTransform.ts\"\nimport { type VariableReference, createInlineTransformVariableReference } from \"../VariableReference.ts\"\nimport { withVariableProvider } from \"../WithVariableProvider.ts\"\nimport { type ArrayOfObjectControlDescription, isArrayOfObjectControlDescription } from \"../WithVariables.ts\"\nimport type { Link } from \"./Link.ts\"\nimport { isLink } from \"./Link.ts\"\nimport { DEFAULT_DATE_STYLE } from \"./toDateStringTransformOptions.ts\"\n\nconst log = getLogger(\"valueTransformUtils\")\n\nexport function createNegateTransform(): ValueTransformNegate {\n\treturn { id: randomID(), type: \"valueTransform\", name: \"negate\" }\n}\n\nfunction getDefaultNumberValue(control: ValueTransformType | ControlDescription | undefined): number {\n\tif (!isObject(control)) return 0\n\tif (control.type !== ControlType.Number) return 0\n\n\tlet value = 0\n\tif (isNumber(control.defaultValue)) {\n\t\tvalue = control.defaultValue\n\t}\n\tif (isNumber(control.min) && value < control.min) {\n\t\tvalue = control.min\n\t}\n\tif (isNumber(control.max) && value > control.max) {\n\t\tvalue = control.max\n\t}\n\treturn value\n}\n\n/** Input enums only support values of type string. */\nfunction getDefaultEnumValueForInput(input: ValueTransformType | ControlDescription): string | undefined {\n\tif (isString(input)) return undefined\n\tif (input.type !== ControlType.Enum) return undefined\n\tif (isString(input.defaultValue)) return input.defaultValue\n\tconst firstOption = input.options[0]\n\tif (isString(firstOption)) return firstOption\n\treturn undefined\n}\n\ninterface CreateValueTransformWithName<T extends ValueTransformName> {\n\tname: T\n\tinput: ValueTransformType | ControlDescription\n\toutput: (T extends \"convertFromEnum\" ? ConvertFromEnumOutputType : ValueTransformType) | ControlDescription\n}\n\nexport function createValueTransformWithName<T extends ValueTransformName>({\n\tname,\n\tinput,\n\toutput,\n}: CreateValueTransformWithName<T>): Extract<ValueTransform, { name: T }> {\n\tconst id = randomID()\n\tconst type = \"valueTransform\"\n\tconst inputType = isString(input) ? input : input.type\n\tconst outputType = isString(output) ? output : output.type\n\ttype Result = Extract<ValueTransform, { name: T }>\n\tswitch (name) {\n\t\tcase \"contains\":\n\t\tcase \"endsWith\":\n\t\tcase \"startsWith\":\n\t\tcase \"prefix\":\n\t\tcase \"suffix\":\n\t\t\treturn { id, type, name, value: \"\" } as Result\n\t\tcase \"containsAny\":\n\t\tcase \"containsAll\":\n\t\t\treturn { id, type, name, value: emptyArray() } as Result\n\t\tcase \"isIncludedIn\":\n\t\tcase \"toggleInList\":\n\t\t\treturn { id, type, name, value: undefined } as Result\n\t\tcase \"greaterThan\":\n\t\tcase \"lessThan\":\n\t\t\treturn {\n\t\t\t\tid,\n\t\t\t\ttype,\n\t\t\t\tname,\n\t\t\t\tvalue: getDefaultNumberValue(input),\n\t\t\t} as Result\n\t\tcase \"isAfter\":\n\t\tcase \"isBefore\":\n\t\t\treturn { id, type, name, value: \"\" } as Result\n\t\tcase \"isBetweenDates\":\n\t\t\treturn { id, type, name, start: \"\", end: \"\" } as Result\n\t\tcase \"equals\": {\n\t\t\tlet value: ValueTransformEquals[\"value\"] = undefined\n\t\t\tswitch (inputType) {\n\t\t\t\tcase ControlType.String:\n\t\t\t\tcase ControlType.Date:\n\t\t\t\t\tvalue = \"\"\n\t\t\t\t\tbreak\n\t\t\t\tcase ControlType.Number:\n\t\t\t\t\tvalue = getDefaultNumberValue(input)\n\t\t\t\t\tbreak\n\t\t\t\tcase ControlType.Boolean:\n\t\t\t\t\tvalue = true\n\t\t\t\t\tbreak\n\t\t\t\tcase ControlType.Color:\n\t\t\t\t\tvalue = \"#09F\"\n\t\t\t\t\tbreak\n\t\t\t\tcase ControlType.Enum:\n\t\t\t\t\tvalue = getDefaultEnumValueForInput(input)\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn { id, type, name, value } as Result\n\t\t}\n\t\tcase \"toDateString\":\n\t\t\treturn {\n\t\t\t\tid,\n\t\t\t\ttype,\n\t\t\t\tname,\n\t\t\t\tlocale: \"\",\n\t\t\t\tdateStyle: DEFAULT_DATE_STYLE,\n\t\t\t\tcapitalize: true,\n\t\t\t} as Result\n\t\tcase \"extractDateSegment\":\n\t\t\treturn {\n\t\t\t\tid,\n\t\t\t\ttype,\n\t\t\t\tname,\n\t\t\t\tsegment: \"year\",\n\t\t\t} as Result\n\t\tcase \"numberToString\":\n\t\t\treturn {\n\t\t\t\tid,\n\t\t\t\ttype,\n\t\t\t\tname,\n\t\t\t\tlocale: \"\",\n\t\t\t\tgrouping: \"auto\",\n\t\t\t\tnotation: \"standard\",\n\t\t\t\tcompactDisplay: \"short\",\n\t\t\t\tstyle: \"decimal\",\n\t\t\t\tcurrency: \"USD\",\n\t\t\t\tcurrencyDisplay: \"symbol\",\n\t\t\t\tunit: \"percent\",\n\t\t\t\tunitDisplay: \"short\",\n\t\t\t} as Result\n\t\tcase \"offsetAndLimitArray\":\n\t\t\treturn { id, type, name, startOffset: 0, limit: undefined } as Result\n\t\tcase \"arrayToArray\":\n\t\t\treturn { id, type, name, mapping: {} } as Result\n\t\tcase \"convertFromEnum\": {\n\t\t\tassert(isValidConvertFromEnumOutputType(outputType))\n\t\t\tconst outputControl = isString(output) ? undefined : output\n\t\t\tconst defaultOutputValue = convertFromEnumOrStringFallbackOutputValue(outputType, outputControl)\n\t\t\tconst fromOption = getDefaultEnumValueForInput(input) ?? \"\"\n\t\t\tconst caseOption: ConvertFromEnumCase = {\n\t\t\t\tid: randomID(),\n\t\t\t\tfrom: fromOption,\n\t\t\t\tto: defaultOutputValue,\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tid,\n\t\t\t\ttype,\n\t\t\t\tname,\n\t\t\t\tcases: [caseOption],\n\t\t\t\tdefault: defaultOutputValue,\n\t\t\t\toutputType,\n\t\t\t} as Result\n\t\t}\n\t\tcase \"convertFromString\": {\n\t\t\tassert(isValidConvertFromStringOutputType(outputType))\n\t\t\tconst outputControl = isString(output) ? undefined : output\n\t\t\tconst defaultOutputValue = convertFromEnumOrStringFallbackOutputValue(outputType, outputControl)\n\t\t\tconst caseOption: ConvertFromStringCase = {\n\t\t\t\tid: randomID(),\n\t\t\t\tfrom: \"\",\n\t\t\t\tto: defaultOutputValue,\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tid,\n\t\t\t\ttype,\n\t\t\t\tname,\n\t\t\t\tcases: [caseOption],\n\t\t\t\tdefault: defaultOutputValue,\n\t\t\t\toutputType,\n\t\t\t} as Result\n\t\t}\n\t\tcase \"convertFromBoolean\": {\n\t\t\tassert(isValidConvertFromBooleanOutputType(outputType))\n\t\t\tconst outputControl = isString(output) ? undefined : output\n\t\t\tconst defaultOutputValue = convertFromBooleanFallbackOutputValue(outputType, outputControl)\n\t\t\treturn {\n\t\t\t\tid,\n\t\t\t\ttype,\n\t\t\t\tname,\n\t\t\t\ttruthy: defaultOutputValue,\n\t\t\t\tfalsy: defaultOutputValue,\n\t\t\t\toutputType,\n\t\t\t} as Result\n\t\t}\n\t\tcase \"isSet\":\n\t\tcase \"negate\":\n\t\tcase \"toString\":\n\t\tcase \"toNumber\":\n\t\tcase \"toBoolean\":\n\t\tcase \"reverseArray\":\n\t\tcase \"arrayLength\":\n\t\tcase \"toResponsiveImage\":\n\t\tcase \"toImageSrc\":\n\t\tcase \"toZIndex\":\n\t\tcase \"toAxisOverflow\":\n\t\tcase \"toOverflowWithClipFallback\":\n\t\tcase \"addImageAlt\":\n\t\tcase \"jsonStringify\":\n\t\tcase \"htmlEscape\":\n\t\tcase \"htmlUnescape\":\n\t\tcase \"enumToDisplayName\":\n\t\tcase \"numberToPixelString\":\n\t\tcase \"radiusForCorner\":\n\t\tcase \"percentageToCornerShape\":\n\t\tcase \"isEven\":\n\t\tcase \"isOdd\":\n\t\tcase \"getGridColumnCSSValue\":\n\t\tcase \"getGridRowCSSValue\":\n\t\tcase \"getNumericColumnGap\":\n\t\t\treturn { id, type, name } as Result\n\t\tdefault:\n\t\t\tassertNever(name, `createValueTransformWithName(), should handle value transforms: ${name}`)\n\t}\n}\n\n// Convert from enum\n\nexport function isValidConvertFromEnumOutputType(value: unknown): value is ConvertFromEnumOutputType {\n\treturn getOutputTypesForValueTransformName(\"convertFromEnum\").includes(value as ConvertFromEnumOutputType)\n}\n\nexport function isValidConvertFromStringOutputType(value: unknown): value is ConvertFromStringOutputType {\n\treturn getOutputTypesForValueTransformName(\"convertFromString\").includes(value as ConvertFromStringOutputType)\n}\n\nexport function isValidConvertFromEnumOrStringOutputValue(\n\toutputType: ConvertFromEnumOutputType | ConvertFromStringOutputType,\n\tvalue: unknown,\n\toutputControl: ControlDescription | undefined,\n): boolean {\n\tswitch (outputType) {\n\t\tcase ControlType.String:\n\t\tcase ControlType.Color:\n\t\t\treturn isString(value)\n\t\tcase ControlType.Boolean:\n\t\t\treturn isBoolean(value)\n\t\tcase ControlType.Number:\n\t\t\treturn isNumber(value)\n\t\tcase ControlType.Link:\n\t\t\treturn isLink(value)\n\t\tcase ControlType.Gap:\n\t\tcase ControlType.Padding:\n\t\tcase ControlType.BorderRadius:\n\t\t\treturn isString(value)\n\t\tcase ControlType.Enum:\n\t\t\tif (\n\t\t\t\toutputControl &&\n\t\t\t\t(outputControl.type === ControlType.Enum || outputControl.type === ControlType.SegmentedEnum)\n\t\t\t) {\n\t\t\t\treturn outputControl.options.some(option => option === value)\n\t\t\t}\n\t\t\treturn isString(value)\n\t\tdefault:\n\t\t\tassertNever(outputType)\n\t}\n}\n\nexport function convertFromEnumOrStringFallbackOutputValue(\n\toutputType: ConvertFromEnumOutputType,\n\toutputControl: ControlDescription | undefined,\n): Exclude<ConvertFromEnumOrStringOutputValueType, Link> {\n\tswitch (outputType) {\n\t\tcase ControlType.String:\n\t\t\treturn \"\"\n\t\tcase ControlType.Color:\n\t\t\treturn \"#09F\"\n\t\tcase ControlType.Number:\n\t\t\treturn 0\n\t\tcase ControlType.Boolean:\n\t\t\treturn true\n\t\tcase ControlType.Link:\n\t\t\treturn undefined\n\t\tcase ControlType.Gap:\n\t\tcase ControlType.Padding:\n\t\tcase ControlType.BorderRadius:\n\t\t\treturn \"0px\"\n\t\tcase ControlType.Enum: {\n\t\t\tif (outputControl?.type !== ControlType.Enum) return undefined\n\t\t\tconst enumDefault = getEnumControlPropValue(outputControl, undefined)\n\t\t\tassert(!isDynamicValue(enumDefault))\n\t\t\treturn enumDefault\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(outputType)\n\t}\n}\n\n// Convert from boolean\n\nexport function isValidConvertFromBooleanOutputType(value: unknown): value is ConvertFromBooleanOutputType {\n\treturn getOutputTypesForValueTransformName(\"convertFromBoolean\").includes(value as ConvertFromBooleanOutputType)\n}\n\nexport function isValidConvertFromBooleanOutputValue(\n\toutputType: ConvertFromBooleanOutputType,\n\tvalue: unknown,\n\toutputControl: ControlDescription | undefined,\n): value is ConvertFromBooleanOutputValueType {\n\tswitch (outputType) {\n\t\tcase ControlType.String:\n\t\tcase ControlType.Color:\n\t\t\treturn isString(value)\n\t\tcase ControlType.Number:\n\t\t\treturn isNumber(value)\n\t\tcase ControlType.Link:\n\t\t\treturn isLink(value)\n\t\tcase ControlType.Gap:\n\t\tcase ControlType.Padding:\n\t\tcase ControlType.BorderRadius:\n\t\t\treturn isString(value)\n\t\tcase ControlType.Enum:\n\t\t\tif (\n\t\t\t\toutputControl &&\n\t\t\t\t(outputControl.type === ControlType.Enum || outputControl.type === ControlType.SegmentedEnum)\n\t\t\t) {\n\t\t\t\treturn outputControl.options.some(option => option === value)\n\t\t\t}\n\t\t\treturn isString(value)\n\t\tdefault:\n\t\t\tassertNever(outputType)\n\t}\n}\n\nexport function convertFromBooleanFallbackOutputValue(\n\toutputType: ConvertFromBooleanOutputType,\n\toutputControl: ControlDescription | undefined,\n): Exclude<ConvertFromBooleanOutputValueType, Link> {\n\tswitch (outputType) {\n\t\tcase ControlType.String:\n\t\t\treturn \"\"\n\t\tcase ControlType.Color:\n\t\t\treturn \"#09F\"\n\t\tcase ControlType.Number:\n\t\t\treturn getDefaultNumberValue(outputControl)\n\t\tcase ControlType.Link:\n\t\t\treturn undefined\n\t\tcase ControlType.Gap:\n\t\tcase ControlType.Padding:\n\t\tcase ControlType.BorderRadius:\n\t\t\treturn \"0px\"\n\t\tcase ControlType.Enum: {\n\t\t\tif (outputControl?.type !== ControlType.Enum) return undefined\n\t\t\tconst enumDefault = getEnumControlPropValue(outputControl, undefined)\n\t\t\tassert(!isDynamicValue(enumDefault))\n\t\t\treturn enumDefault\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(outputType)\n\t}\n}\n\n/**\n * Given a variable reference to an array (eg: from a repeater) and a targetArrayControl (eg: an\n * Array control prop exposed by a Code Component or Smart Component) will create a computed value\n * with an arrayToArray transform that maps the array item variables to the target array control\n * item variables. Will return undefined if a complete mapping is not possible.\n */\nexport function createArrayToArrayComputedValue({\n\tengine,\n\tsourceArrayReference,\n\ttargetArrayControl,\n\tsourceArrayControl,\n}: {\n\tengine: VekterEngine\n\tsourceArrayReference: VariableReference\n\ttargetArrayControl: VerifiedArrayControlDescription\n\t/**\n\t * Optional, by default loaded via component loader, but can be set when value isn't available\n\t * in the component loader yet, for example when creating a new variable.\n\t */\n\tsourceArrayControl?: ArrayOfObjectControlDescription\n}): ComputedValue | undefined {\n\tif (!isArrayOfObjectControlDescription(targetArrayControl)) return\n\n\tif (!sourceArrayControl) {\n\t\tconst providerNode = engine.tree.getNodeWithTrait(sourceArrayReference.providerId, withVariableProvider)\n\t\tif (!providerNode) return\n\n\t\tconst controlMap = providerNode.getProvidedControlMap(\n\t\t\tengine.tree,\n\t\t\tundefined,\n\t\t\tengine.componentLoader,\n\t\t\tengine.componentLoader.activeBundleHash,\n\t\t)\n\t\tconst referencedSourceArrayControl = controlMap?.get(sourceArrayReference.id)\n\t\tif (!isArrayOfObjectControlDescription(referencedSourceArrayControl)) return\n\n\t\tsourceArrayControl = referencedSourceArrayControl\n\t}\n\n\tconst transform = createValueTransformWithName({\n\t\tname: \"arrayToArray\",\n\t\tinput: targetArrayControl,\n\t\toutput: ControlType.Array,\n\t})\n\n\tconst sourceItemControls = sourceArrayControl.control.controls\n\tconst targetItemControls = targetArrayControl.control.controls\n\n\tconst availableSourceItemControls = new Map(Object.entries(sourceItemControls))\n\n\tfor (const targetControlKey in targetItemControls) {\n\t\tconst targetControl = targetItemControls[targetControlKey]\n\t\tassert(targetControl)\n\n\t\tconst sourceControlKey = getKeyOfCompatibleSourceControl(targetControl, availableSourceItemControls)\n\t\tif (!sourceControlKey) continue\n\n\t\tconst compatibleSourceControl = availableSourceItemControls.get(sourceControlKey)\n\t\tassert(compatibleSourceControl?.type === ControlType.ResponsiveImage, \"We only support Galleries for now\")\n\n\t\tavailableSourceItemControls.delete(sourceControlKey)\n\n\t\ttransform.mapping[targetControlKey] = {\n\t\t\ttype: ControlType.Image,\n\t\t\tvalue: createInlineTransformVariableReference(sourceControlKey),\n\t\t}\n\t}\n\n\tif (isEmptyObject(transform.mapping)) {\n\t\tlog.error(\"Unable to automatically create arrayToArray transform\", {\n\t\t\tproviderNodeId: sourceArrayReference.providerId,\n\t\t\tavailableSourceItemControls,\n\t\t})\n\t\treturn\n\t}\n\n\treturn createComputedValue(ControlType.Array, sourceArrayReference, [transform])\n}\n\nfunction getKeyOfCompatibleSourceControl(\n\ttargetItemControl: ObjectPropertyControlDescription,\n\tsourceItemControls: Map<string, ObjectPropertyControlDescription>,\n): string | undefined {\n\tfor (const [key, control] of sourceItemControls) {\n\t\tif (control.type === targetItemControl.type) {\n\t\t\treturn key\n\t\t}\n\t}\n}\n", "import type { VerifiedControlDescription } from \"@framerjs/framer-runtime\"\nimport { assert, assertNever } from \"@framerjs/shared\"\nimport { getLocalizedValueForActiveLocale } from \"document/components/chrome/localization/getValueForActiveLocale.ts\"\nimport type { LocalizedValues } from \"document/models/LocalizedValue.ts\"\nimport { isMultiCollectionReferenceControlPropValue } from \"document/models/controlProps/ControlProp.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { escapeHTML, unescapeHTML } from \"library/render/utils/dom.ts\"\nimport type { Locale } from \"library/router/types.ts\"\nimport { fallbackTitleForOption } from \"utils/enumControlUtils.ts\"\nimport { getValidDate } from \"utils/getValidDate.ts\"\nimport { isArray, isBoolean, isNull, isNumber, isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { VariableValueResolver } from \"../../nodes/CanvasNodeCache.ts\"\nimport type { PixelNumber } from \"../NumberShorthand.ts\"\nimport type { ResponsiveImage } from \"../ResponsiveImage.ts\"\nimport { isResponsiveImage } from \"../ResponsiveImage.ts\"\nimport type {\n\tConvertFromBooleanOutputValueType,\n\tTransformArrayToArrayMapping,\n\tValueTransform,\n\tValueTransformToDateString,\n} from \"../ValueTransform.ts\"\nimport { isKnownValueTransformName } from \"../ValueTransform.ts\"\nimport type { CombinedVariableProviderValueMap } from \"../VariableProvider.ts\"\nimport type { VariableReference } from \"../VariableReference.ts\"\nimport { isInlineTransformVariableReference, isVariableReference } from \"../VariableReference.ts\"\nimport type { ArrayOfObjectControlDescription } from \"../WithVariables.ts\"\nimport { isArrayOfObjectControlDescription } from \"../WithVariables.ts\"\nimport { floatingZIndex, minZIndex } from \"../WithZIndex.ts\"\nimport {\n\tconvertFromBooleanFallbackOutputValue,\n\tconvertFromEnumOrStringFallbackOutputValue,\n\tisValidConvertFromBooleanOutputValue,\n\tisValidConvertFromEnumOrStringOutputValue,\n\tisValidConvertFromEnumOutputType,\n\tisValidConvertFromStringOutputType,\n} from \"../utils/valueTransformUtils.ts\"\nimport { dateStyleConfig, transformOptionsToDateStyleKey } from \"./toDateStringTransformOptions.ts\"\n\nfunction resolveValue(\n\tvalue: unknown,\n\tvariableValueResolver: VariableValueResolver,\n\tvariableOverrides: CombinedVariableProviderValueMap | undefined,\n): unknown {\n\tif (!isVariableReference(value)) return value\n\treturn variableValueResolver.getVariableReferenceValue(value, variableOverrides)\n}\n\nfunction compareNormalizedStrings(\n\tinputValue: unknown,\n\tvalue: unknown,\n\tvariableValueResolver: VariableValueResolver,\n\tvariableOverrides: CombinedVariableProviderValueMap | undefined,\n\tcompareCallback: (normalizedInput: string, normalizedValue: string) => boolean,\n): boolean {\n\tif (!isString(inputValue)) return false\n\tconst otherValue = resolveValue(value, variableValueResolver, variableOverrides)\n\tif (!isString(otherValue)) return false\n\treturn compareCallback(inputValue.toLowerCase(), otherValue.toLowerCase())\n}\n\nexport function toString(value: unknown): string {\n\treturn isString(value) ? value : String(value)\n}\n\nexport function toNumber(value: unknown): number {\n\tif (isNumber(value)) return value\n\tif (!isString(value)) return 0\n\tconst parsedNumber = parseFloat(value)\n\treturn isNumber(parsedNumber) ? parsedNumber : 0\n}\n\nfunction toZIndex(value: unknown): number {\n\tif (!isNumber(value)) return 0\n\tif (value < minZIndex) return minZIndex\n\tif (value > floatingZIndex) return floatingZIndex\n\treturn value\n}\n\nexport function toBoolean(value: unknown): boolean {\n\treturn Boolean(value)\n}\n\nexport function toDateString(\n\tvalue: unknown,\n\tvalueTransform: ValueTransformToDateString,\n\trouterLocale: Locale | undefined,\n): string {\n\tconst options = valueTransform\n\tconst activeLocale = routerLocale?.code\n\n\tif (!isString(value)) return \"\"\n\tconst date = getValidDate(value)\n\tif (!date) return \"\"\n\n\tconst fallbackLocale = \"en-US\"\n\tconst locale = options.locale || activeLocale || fallbackLocale\n\n\tconst dateStyleKey = transformOptionsToDateStyleKey(options.display, options.format, options.dateStyle, false)\n\tconst formatOptions = { ...dateStyleConfig[dateStyleKey].options, timeZone: \"UTC\" }\n\n\ttry {\n\t\treturn date.toLocaleString(locale, formatOptions)\n\t} catch {\n\t\treturn date.toLocaleString(fallbackLocale, formatOptions)\n\t}\n}\n\nfunction toResponsiveImage(value: unknown): ResponsiveImage | undefined {\n\tif (isString(value)) return { src: value }\n\treturn isResponsiveImage(value) ? value : undefined\n}\n\nexport function toImageSrc(value: unknown): string | undefined {\n\tif (isResponsiveImage(value)) return value.src\n\treturn isString(value) ? value : undefined\n}\n\n/**\n * Also encodes ETAGO-delimiters.\n * @see https://mathiasbynens.be/notes/etago\n */\nexport function jsonStringify(value: unknown): string | undefined {\n\tconst result = JSON.stringify(value)\n\t// eslint-disable-next-line regexp/prefer-lookaround -- we want to keep it like jsesc: https://github.com/mathiasbynens/jsesc/blob/203c8694d605b6f29d4c67d372897499ec4468fb/src/jsesc.js#L326C4-L326C45\n\tif (isString(result)) return result.replace(/<\\/(script|style)/gi, \"<\\\\/$1\")\n\treturn result\n}\n\nfunction htmlEscape(value: unknown): string {\n\tif (!isString(value)) return \"\"\n\treturn escapeHTML(value)\n}\n\nexport function htmlUnescape(value: unknown): string {\n\tif (!isString(value)) return \"\"\n\treturn unescapeHTML(value)\n}\n\nexport function numberToPixelString(value: unknown) {\n\treturn isNumber(value) ? Math.max(0, value) + \"px\" : value\n}\n\nexport function radiusForCorner(value: unknown, cornerIndex: number): string | undefined {\n\tif (isNumber(value)) return `${Math.max(0, value)}px`\n\tif (!isString(value)) return undefined\n\tconst segments = value.split(\" \")\n\treturn segments[cornerIndex] || segments[cornerIndex - 2] || segments[0]\n}\n\nexport function radiusNumberForCorner(value: unknown, cornerIndex: number): number {\n\tconst radius = radiusForCorner(value, cornerIndex)\n\treturn toNumber(radius)\n}\n\nfunction getPaddingPerSide(value: unknown): {\n\ttop: PixelNumber\n\tright: PixelNumber\n\tbottom: PixelNumber\n\tleft: PixelNumber\n} {\n\tif (!isString(value)) {\n\t\tconst numberValue = isNumber(value) ? Math.max(0, value) : 0\n\t\tconst shorthandValue: PixelNumber = `${numberValue}px`\n\t\treturn {\n\t\t\ttop: shorthandValue,\n\t\t\tright: shorthandValue,\n\t\t\tbottom: shorthandValue,\n\t\t\tleft: shorthandValue,\n\t\t}\n\t}\n\tconst segments = value.split(\" \")\n\tconst top = segments[0] as PixelNumber\n\tconst right = (segments[1] || top) as PixelNumber\n\tconst bottom = (segments[2] || top) as PixelNumber\n\tconst left = (segments[3] || right) as PixelNumber\n\treturn { top, right, bottom, left }\n}\n\nexport function getPaddingNumberPerSide(value: unknown): { top: number; right: number; bottom: number; left: number } {\n\tconst padding = getPaddingPerSide(value)\n\treturn {\n\t\ttop: toNumber(padding.top),\n\t\tright: toNumber(padding.right),\n\t\tbottom: toNumber(padding.bottom),\n\t\tleft: toNumber(padding.left),\n\t}\n}\n\nfunction transformArrayItem(\n\tinputControl: ArrayOfObjectControlDescription,\n\toutputControl: ArrayOfObjectControlDescription,\n\titem: unknown,\n\tmapping: TransformArrayToArrayMapping,\n) {\n\tconst mappedItem: Record<string, unknown> = {}\n\n\tif (!isObject(item)) return mappedItem\n\n\tconst inputItemControls = inputControl.control.controls\n\tconst outputItemControls = outputControl.control.controls\n\n\tfor (const targetControlKey in mapping) {\n\t\t// The outputControl no longer contains the key defined in the mapping, the mapping must be\n\t\t// outdated.\n\t\tconst outputItemControl = outputItemControls[targetControlKey]\n\t\tif (!outputItemControl) continue\n\n\t\tconst valueForTargetControl = mapping[targetControlKey]\n\t\tif (!isObject(valueForTargetControl)) continue\n\n\t\tif (isVariableReference(valueForTargetControl.value)) {\n\t\t\tassert(\n\t\t\t\tisInlineTransformVariableReference(valueForTargetControl.value),\n\t\t\t\t\"Only inline transform variable references are supported within arrayToArray transforms\",\n\t\t\t)\n\n\t\t\t// The inputControl no longer contains the key defined in the mapping, the mapping must\n\t\t\t// also be outdated in this case.\n\t\t\tconst inputItemControl = inputItemControls[valueForTargetControl.value.id]\n\t\t\tif (!inputItemControl) continue\n\n\t\t\tmappedItem[targetControlKey] = item[valueForTargetControl.value.id]\n\t\t\tcontinue\n\t\t}\n\n\t\t// Make sure we get a type warning when we start supporting inline item values.\n\t\tvalueForTargetControl.value satisfies never\n\t}\n\n\treturn mappedItem\n}\n\n/**\n *\n * @param value input value, already resolved\n * @param valueTransform transform description\n * @param variableValueResolver variable values in scope\n * @param variableOverrides variable overrides, used by repeater content\n * @returns transformed result\n */\nexport function applyValueTransform(\n\tvalue: unknown,\n\tvalueTransform: ValueTransform,\n\tvariableValueResolver: VariableValueResolver,\n\tvariableOverrides: CombinedVariableProviderValueMap | undefined,\n\tinputControl: VerifiedControlDescription | undefined,\n\toutputControl: VerifiedControlDescription | undefined,\n\trouterLocale: Locale | undefined,\n): unknown {\n\t// Value transforms might be unknown after a rollback\n\tif (!isKnownValueTransformName(valueTransform.name)) {\n\t\treturn value\n\t}\n\n\tswitch (valueTransform.name) {\n\t\tcase \"equals\": {\n\t\t\tif (isString(value)) {\n\t\t\t\treturn compareNormalizedStrings(\n\t\t\t\t\tvalue,\n\t\t\t\t\tvalueTransform.value,\n\t\t\t\t\tvariableValueResolver,\n\t\t\t\t\tvariableOverrides,\n\t\t\t\t\t(inputValue, otherValue) => inputValue === otherValue,\n\t\t\t\t)\n\t\t\t}\n\t\t\tconst otherValue = resolveValue(valueTransform.value, variableValueResolver, variableOverrides)\n\t\t\treturn value === otherValue\n\t\t}\n\t\tcase \"contains\": {\n\t\t\tif (isMultiCollectionReferenceControlPropValue(value)) {\n\t\t\t\tconst transformValue = resolveValue(valueTransform.value, variableValueResolver, variableOverrides)\n\t\t\t\tif (!isArray(value) || !value.every(isString) || !isString(transformValue)) return false\n\t\t\t\treturn value.includes(transformValue)\n\t\t\t}\n\t\t\treturn compareNormalizedStrings(\n\t\t\t\tvalue,\n\t\t\t\tvalueTransform.value,\n\t\t\t\tvariableValueResolver,\n\t\t\t\tvariableOverrides,\n\t\t\t\t(inputValue, otherValue) => inputValue.includes(otherValue),\n\t\t\t)\n\t\t}\n\t\tcase \"containsAny\": {\n\t\t\tif (!isMultiCollectionReferenceControlPropValue(value)) return false\n\n\t\t\tconst a = value\n\t\t\tconst b = resolveValue(valueTransform.value, variableValueResolver, variableOverrides)\n\n\t\t\tif (!isArray(a)) return false\n\t\t\tif (isUndefined(b)) return true\n\t\t\tif (!isArray(b)) return false\n\t\t\tif (b.length === 0) return true\n\n\t\t\tconst aSet = new Set(a)\n\t\t\tfor (const item of b) {\n\t\t\t\tif (aSet.has(item)) return true\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tcase \"containsAll\": {\n\t\t\tif (!isMultiCollectionReferenceControlPropValue(value)) return false\n\n\t\t\tconst a = value\n\t\t\tconst b = resolveValue(valueTransform.value, variableValueResolver, variableOverrides)\n\n\t\t\tif (!isArray(a)) return false\n\t\t\tif (isUndefined(b)) return true\n\t\t\tif (!isArray(b)) return false\n\t\t\tif (b.length === 0) return true\n\n\t\t\tconst aSet = new Set(a)\n\t\t\tfor (const item of b) {\n\t\t\t\tif (!aSet.has(item)) return false\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t\tcase \"startsWith\": {\n\t\t\treturn compareNormalizedStrings(\n\t\t\t\tvalue,\n\t\t\t\tvalueTransform.value,\n\t\t\t\tvariableValueResolver,\n\t\t\t\tvariableOverrides,\n\t\t\t\t(inputValue, otherValue) => inputValue.startsWith(otherValue),\n\t\t\t)\n\t\t}\n\t\tcase \"endsWith\": {\n\t\t\treturn compareNormalizedStrings(\n\t\t\t\tvalue,\n\t\t\t\tvalueTransform.value,\n\t\t\t\tvariableValueResolver,\n\t\t\t\tvariableOverrides,\n\t\t\t\t(inputValue, otherValue) => inputValue.endsWith(otherValue),\n\t\t\t)\n\t\t}\n\t\tcase \"isSet\":\n\t\t\tif (Array.isArray(value)) return value.length > 0\n\t\t\treturn !isUndefined(value) && !isNull(value) && value !== \"\"\n\t\tcase \"negate\":\n\t\t\treturn !value\n\t\tcase \"toString\":\n\t\t\treturn toString(value)\n\t\tcase \"toNumber\":\n\t\t\treturn toNumber(value)\n\t\tcase \"toBoolean\":\n\t\t\treturn toBoolean(value)\n\t\tcase \"toDateString\": {\n\t\t\treturn toDateString(value, valueTransform, routerLocale)\n\t\t}\n\t\tcase \"extractDateSegment\": {\n\t\t\tif (typeof value !== \"string\") return\n\n\t\t\tconst date = getValidDate(value)\n\t\t\tif (!date) return\n\n\t\t\tconst segment = valueTransform.segment\n\t\t\tif (segment === \"year\") return date.getUTCFullYear()\n\t\t\tif (segment === \"month\") return date.getUTCMonth() + 1\n\t\t\tif (segment === \"day\") return date.getUTCDate()\n\t\t\tif (segment === \"hour24\") return date.getUTCHours()\n\t\t\tif (segment === \"hour12\") {\n\t\t\t\tconst hour = date.getUTCHours()\n\t\t\t\treturn hour === 0 ? 12 : hour > 12 ? hour - 12 : hour\n\t\t\t}\n\t\t\tif (segment === \"minute\") return date.getUTCMinutes()\n\t\t\treturn\n\t\t}\n\t\tcase \"numberToString\": {\n\t\t\tconst fallbackLocale = \"en-US\"\n\t\t\tconst locale = valueTransform.locale || routerLocale?.code || fallbackLocale\n\n\t\t\tconst options: Intl.NumberFormatOptions = {\n\t\t\t\tnotation: valueTransform.notation,\n\t\t\t\tstyle: valueTransform.style,\n\t\t\t\tminimumFractionDigits: valueTransform.minimumFractionDigits,\n\t\t\t\tmaximumFractionDigits: valueTransform.maximumFractionDigits,\n\t\t\t\tminimumIntegerDigits: valueTransform.minimumIntegerDigits,\n\t\t\t}\n\t\t\tif (isBoolean(valueTransform.grouping)) options.useGrouping = valueTransform.grouping\n\t\t\tif (valueTransform.notation === \"compact\") options.compactDisplay = valueTransform.compactDisplay\n\n\t\t\tswitch (valueTransform.style) {\n\t\t\t\tcase \"currency\":\n\t\t\t\t\toptions.currency = valueTransform.currency\n\t\t\t\t\toptions.currencyDisplay = valueTransform.currencyDisplay\n\t\t\t\t\tbreak\n\t\t\t\tcase \"unit\":\n\t\t\t\t\toptions.unit = valueTransform.unit\n\t\t\t\t\toptions.unitDisplay = valueTransform.unitDisplay\n\t\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tconst number = Number(value)\n\n\t\t\ttry {\n\t\t\t\treturn number.toLocaleString(locale, options)\n\t\t\t} catch {\n\t\t\t\ttry {\n\t\t\t\t\treturn number.toLocaleString(fallbackLocale, options)\n\t\t\t\t} catch {\n\t\t\t\t\treturn number.toLocaleString()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcase \"numberToPixelString\":\n\t\t\treturn numberToPixelString(value)\n\t\tcase \"radiusForCorner\":\n\t\t\t// The `applyValueTransform` function not be used for `radiusForCorner` because it\n\t\t\t// requires a corner index argument. So use the `radiusForCorner` function directly.\n\t\t\tthrow Error(\"radiusForCorner can't be called without a corner index argument\")\n\t\tcase \"percentageToCornerShape\":\n\t\t\tthrow new Error(\"percentageToCornerShape is CSSVariableDefinitionCollector-only\")\n\t\tcase \"reverseArray\":\n\t\t\treturn isArray(value) ? Array.from(value).reverse() : []\n\t\tcase \"offsetAndLimitArray\": {\n\t\t\tconst end = isNumber(valueTransform.limit) ? valueTransform.startOffset + valueTransform.limit : undefined\n\t\t\treturn isArray(value) ? value.splice(valueTransform.startOffset, end) : []\n\t\t}\n\t\tcase \"arrayLength\":\n\t\t\treturn isArray(value) ? value.length : 0\n\t\tcase \"arrayToArray\": {\n\t\t\tconst newValue: Record<string, unknown>[] = []\n\n\t\t\tif (!isArray(value)) return newValue\n\t\t\tif (!isArrayOfObjectControlDescription(inputControl)) return newValue\n\t\t\tif (!isArrayOfObjectControlDescription(outputControl)) return newValue\n\n\t\t\tfor (const item of value) {\n\t\t\t\tif (!isObject(item)) continue\n\t\t\t\tconst newItem = transformArrayItem(inputControl, outputControl, item, valueTransform.mapping)\n\t\t\t\tnewValue.push(newItem)\n\t\t\t}\n\n\t\t\treturn newValue\n\t\t}\n\t\tcase \"prefix\":\n\t\tcase \"suffix\": {\n\t\t\tlet addition: string | number | undefined | unknown = undefined\n\n\t\t\tif (routerLocale && !isVariableReference(valueTransform.value) && valueTransform.valueLocalized) {\n\t\t\t\taddition = getLocalizedValueForActiveLocale(routerLocale, valueTransform.valueLocalized)?.value\n\t\t\t}\n\n\t\t\taddition ??= resolveValue(valueTransform.value, variableValueResolver, variableOverrides)\n\n\t\t\tif (typeof value === \"string\" && typeof addition === \"string\") {\n\t\t\t\treturn valueTransform.name === \"prefix\" ? addition + value : value + addition\n\t\t\t} else if (typeof value === \"string\") {\n\t\t\t\treturn value\n\t\t\t} else if (typeof addition === \"string\") {\n\t\t\t\treturn addition\n\t\t\t}\n\t\t\treturn \"\"\n\t\t}\n\t\tcase \"greaterThan\":\n\t\tcase \"lessThan\": {\n\t\t\tconst valueB = resolveValue(valueTransform.value, variableValueResolver, variableOverrides)\n\t\t\tif (!isNumber(value) || !isNumber(valueB)) return false\n\t\t\tif (valueTransform.name === \"greaterThan\") {\n\t\t\t\treturn value > valueB\n\t\t\t} else {\n\t\t\t\treturn value < valueB\n\t\t\t}\n\t\t}\n\t\tcase \"isEven\": {\n\t\t\treturn isNumber(value) && value % 2 === 0\n\t\t}\n\t\tcase \"isOdd\": {\n\t\t\treturn isNumber(value) && value % 2 === 1\n\t\t}\n\t\tcase \"isBefore\":\n\t\tcase \"isAfter\": {\n\t\t\tconst valueB = resolveValue(valueTransform.value, variableValueResolver, variableOverrides)\n\t\t\tif (!isString(value) || !isString(valueB)) return false\n\n\t\t\tconst date = getValidDate(value)\n\t\t\tconst dateB = getValidDate(valueB)\n\t\t\tif (!date || !dateB) return false\n\t\t\tif (valueTransform.name === \"isBefore\") {\n\t\t\t\treturn date <= dateB\n\t\t\t} else {\n\t\t\t\treturn date >= dateB\n\t\t\t}\n\t\t}\n\t\tcase \"isBetweenDates\": {\n\t\t\tconst valueStart = resolveValue(valueTransform.start, variableValueResolver, variableOverrides)\n\t\t\tconst valueEnd = resolveValue(valueTransform.end, variableValueResolver, variableOverrides)\n\n\t\t\tif (!isString(value) || !isString(valueStart) || !isString(valueEnd)) {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\tconst date = getValidDate(value)\n\t\t\tconst startDate = getValidDate(valueStart)\n\t\t\tconst endDate = getValidDate(valueEnd)\n\n\t\t\tif (!date || !startDate || !endDate) {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\treturn date >= startDate && date <= endDate\n\t\t}\n\t\tcase \"isIncludedIn\": {\n\t\t\tconst valueB = resolveValue(valueTransform.value, variableValueResolver, variableOverrides)\n\t\t\tif (!isString(value) || !isArray(valueB) || !valueB.every(isString)) return false\n\t\t\treturn valueB.includes(value)\n\t\t}\n\t\tcase \"toggleInList\": {\n\t\t\tconst itemToToggle = resolveValue(valueTransform.value, variableValueResolver, variableOverrides)\n\t\t\tif (!isString(itemToToggle)) return value\n\n\t\t\tif (!isArray(value) || !value.every(isString)) return [itemToToggle]\n\n\t\t\tconst filtered = value.filter(item => item !== itemToToggle)\n\n\t\t\tif (filtered.length === value.length) {\n\t\t\t\treturn [...value, itemToToggle]\n\t\t\t}\n\n\t\t\treturn filtered\n\t\t}\n\t\tcase \"toZIndex\":\n\t\t\treturn toZIndex(value)\n\t\tcase \"toAxisOverflow\":\n\t\t\t// Prevent invalid axis overflow values from being set.\n\t\t\treturn value === \"visible\" ? undefined : value\n\t\tcase \"toOverflowWithClipFallback\":\n\t\t\tthrow Error(\"toOverflowWithClipFallback transforms are not applied on the Canvas.\")\n\t\tcase \"toResponsiveImage\":\n\t\t\treturn toResponsiveImage(value)\n\t\tcase \"toImageSrc\":\n\t\t\treturn toImageSrc(value)\n\t\tcase \"addImageAlt\":\n\t\t\treturn toResponsiveImage(value)\n\t\tcase \"jsonStringify\":\n\t\t\treturn jsonStringify(value)\n\t\tcase \"htmlEscape\":\n\t\t\treturn htmlEscape(value)\n\t\tcase \"htmlUnescape\":\n\t\t\treturn htmlUnescape(value)\n\t\tcase \"getGridColumnCSSValue\":\n\t\tcase \"getGridRowCSSValue\":\n\t\t\tthrow Error(\"Grid Span transforms are not applied on the Canvas.\")\n\t\tcase \"getNumericColumnGap\":\n\t\t\tthrow Error(\"Numeric column gap transform isn't applied on the Canvas.\")\n\t\tcase \"enumToDisplayName\": {\n\t\t\tif (!inputControl) return \"\"\n\t\t\tif (inputControl.type !== ControlType.Enum) return \"\"\n\t\t\tif (!isString(value)) return \"\"\n\t\t\tconst index = inputControl.options.indexOf(value)\n\t\t\tif (index < 0) return \"\"\n\t\t\treturn inputControl.optionTitles?.[index] ?? fallbackTitleForOption(value)\n\t\t}\n\t\tcase \"convertFromEnum\": {\n\t\t\tconst fallbackValue = convertFromEnumOrStringFallbackOutputValue(valueTransform.outputType, outputControl)\n\n\t\t\tif (!inputControl || inputControl.type !== ControlType.Enum) {\n\t\t\t\treturn fallbackValue\n\t\t\t}\n\t\t\tif (!isValidConvertFromEnumOutputType(valueTransform.outputType)) {\n\t\t\t\treturn fallbackValue\n\t\t\t}\n\n\t\t\tfor (const enumCase of valueTransform.cases) {\n\t\t\t\tif (value !== enumCase.from) continue\n\t\t\t\tif (!inputControl.options.includes(enumCase.from)) continue\n\n\t\t\t\tif (isVariableReference(enumCase.to)) {\n\t\t\t\t\treturn resolveValue(enumCase.to, variableValueResolver, variableOverrides)\n\t\t\t\t}\n\n\t\t\t\tif (isValidConvertFromEnumOrStringOutputValue(valueTransform.outputType, enumCase.to, outputControl)) {\n\t\t\t\t\tif (routerLocale && valueTransform.outputType === ControlType.String) {\n\t\t\t\t\t\tconst localizedValue = getLocalizedValueForActiveLocale(routerLocale, enumCase.toLocalized)\n\t\t\t\t\t\tif (localizedValue) return localizedValue.value\n\t\t\t\t\t}\n\n\t\t\t\t\treturn enumCase.to\n\t\t\t\t}\n\t\t\t\treturn fallbackValue\n\t\t\t}\n\n\t\t\tif (isVariableReference(valueTransform.default)) {\n\t\t\t\treturn resolveValue(valueTransform.default, variableValueResolver, variableOverrides)\n\t\t\t}\n\n\t\t\tif (isValidConvertFromEnumOrStringOutputValue(valueTransform.outputType, valueTransform.default, outputControl)) {\n\t\t\t\tif (routerLocale && valueTransform.outputType === ControlType.String) {\n\t\t\t\t\tconst localizedValue = getLocalizedValueForActiveLocale(routerLocale, valueTransform.defaultLocalized)\n\n\t\t\t\t\tif (localizedValue) return localizedValue.value\n\t\t\t\t}\n\n\t\t\t\treturn valueTransform.default\n\t\t\t}\n\n\t\t\treturn fallbackValue\n\t\t}\n\t\tcase \"convertFromString\": {\n\t\t\tconst fallbackValue = convertFromEnumOrStringFallbackOutputValue(valueTransform.outputType, outputControl)\n\n\t\t\tif (!isValidConvertFromStringOutputType(valueTransform.outputType)) {\n\t\t\t\treturn fallbackValue\n\t\t\t}\n\n\t\t\tconst lowerCaseValue = isString(value) ? value.toLowerCase() : value\n\n\t\t\tfor (const enumCase of valueTransform.cases) {\n\t\t\t\tif (lowerCaseValue !== enumCase.from.toLowerCase()) continue\n\n\t\t\t\tif (isVariableReference(enumCase.to)) {\n\t\t\t\t\treturn resolveValue(enumCase.to, variableValueResolver, variableOverrides)\n\t\t\t\t}\n\n\t\t\t\tif (isValidConvertFromEnumOrStringOutputValue(valueTransform.outputType, enumCase.to, outputControl)) {\n\t\t\t\t\tif (routerLocale && valueTransform.outputType === ControlType.String) {\n\t\t\t\t\t\tconst localizedValue = getLocalizedValueForActiveLocale(routerLocale, enumCase.toLocalized)\n\t\t\t\t\t\tif (localizedValue) return localizedValue.value\n\t\t\t\t\t}\n\n\t\t\t\t\treturn enumCase.to\n\t\t\t\t}\n\t\t\t\treturn fallbackValue\n\t\t\t}\n\n\t\t\tif (isVariableReference(valueTransform.default)) {\n\t\t\t\treturn resolveValue(valueTransform.default, variableValueResolver, variableOverrides)\n\t\t\t}\n\n\t\t\tif (isValidConvertFromEnumOrStringOutputValue(valueTransform.outputType, valueTransform.default, outputControl)) {\n\t\t\t\tif (routerLocale && valueTransform.outputType === ControlType.String) {\n\t\t\t\t\tconst localizedValue = getLocalizedValueForActiveLocale(routerLocale, valueTransform.defaultLocalized)\n\n\t\t\t\t\tif (localizedValue) return localizedValue.value\n\t\t\t\t}\n\n\t\t\t\treturn valueTransform.default\n\t\t\t}\n\n\t\t\treturn fallbackValue\n\t\t}\n\t\tcase \"convertFromBoolean\": {\n\t\t\tlet outputValue: VariableReference | ConvertFromBooleanOutputValueType | undefined\n\t\t\tlet outputLocalized: LocalizedValues | undefined\n\n\t\t\tif (valueTransform.fallback && !isBoolean(value)) {\n\t\t\t\toutputValue = valueTransform.fallback.value\n\t\t\t\toutputLocalized = valueTransform.fallback.valueLocalized\n\t\t\t} else {\n\t\t\t\toutputValue = value ? valueTransform.truthy : valueTransform.falsy\n\t\t\t\toutputLocalized = value ? valueTransform.truthyLocalized : valueTransform.falsyLocalized\n\t\t\t}\n\n\t\t\tif (isVariableReference(outputValue)) {\n\t\t\t\treturn resolveValue(outputValue, variableValueResolver, variableOverrides)\n\t\t\t}\n\n\t\t\tif (isValidConvertFromBooleanOutputValue(valueTransform.outputType, outputValue, outputControl)) {\n\t\t\t\tif (routerLocale && valueTransform.outputType === ControlType.String) {\n\t\t\t\t\tconst localizedValue = getLocalizedValueForActiveLocale(routerLocale, outputLocalized)\n\n\t\t\t\t\tif (localizedValue) return localizedValue.value\n\t\t\t\t}\n\n\t\t\t\treturn outputValue\n\t\t\t}\n\n\t\t\treturn convertFromBooleanFallbackOutputValue(valueTransform.outputType, outputControl)\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(valueTransform, \"All value transforms should be handled\")\n\t}\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isDynamicValue } from \"../DynamicValue.ts\"\nimport type { WithRadius } from \"../WithRadius.ts\"\nimport { withRadius, withRelativeRadius } from \"../WithRadius.ts\"\nimport { type WithRadiusPerCorner, withRadiusPerCorner } from \"../WithRadiusPerCorner.ts\"\n\ntype CornerRadii = [WithRadius[\"radius\"], WithRadius[\"radius\"], WithRadius[\"radius\"], WithRadius[\"radius\"]]\n\ntype ResolvedRadiusValue =\n\t| undefined\n\t| number\n\t| `${number}%`\n\t| { topLeft: number; topRight: number; bottomRight: number; bottomLeft: number }\n\nfunction shouldUseRadiusPerCorner(\n\tnode: CanvasNode & WithRadius,\n): node is CanvasNode & WithRadius & WithRadiusPerCorner {\n\tif (!withRadiusPerCorner(node)) return false\n\tif (!node.radiusPerCorner) return false\n\n\tif (withRelativeRadius(node) && node.radiusIsRelative) return false\n\n\tif (isDynamicValue(node.radius)) return false\n\n\treturn true\n}\n\nexport function getCornerRadii(node: CanvasNode): CornerRadii | undefined {\n\tif (!withRadius(node)) return undefined\n\n\treturn shouldUseRadiusPerCorner(node)\n\t\t? [node.radiusTopLeft, node.radiusTopRight, node.radiusBottomRight, node.radiusBottomLeft]\n\t\t: [node.radius, node.radius, node.radius, node.radius]\n}\n\nexport function getResolvedRadiusValue(node: CanvasNode): ResolvedRadiusValue | undefined {\n\tif (!withRadius(node)) return undefined\n\n\tif (node.radius !== undefined && withRelativeRadius(node) && node.radiusIsRelative && !isDynamicValue(node.radius)) {\n\t\treturn `${node.radius}%`\n\t}\n\n\tif (shouldUseRadiusPerCorner(node)) {\n\t\treturn {\n\t\t\ttopLeft: node.radiusTopLeft,\n\t\t\ttopRight: node.radiusTopRight,\n\t\t\tbottomRight: node.radiusBottomRight,\n\t\t\tbottomLeft: node.radiusBottomLeft,\n\t\t}\n\t}\n\n\treturn node.resolveValue(\"radius\")\n}\n\nexport function hasNonDefaultRadius(node: CanvasNode): boolean {\n\tconst cornerRadii = getCornerRadii(node)\n\tif (!cornerRadii) return false\n\n\tfor (const value of cornerRadii) {\n\t\tif (value === undefined || value === 0) continue\n\t\treturn true\n\t}\n\n\treturn false\n}\n", "import { js, jst } from \"code-generation/js/js.ts\"\nimport { SafeJS } from \"code-generation/js/serializeJS.ts\"\nimport { isJSXContext } from \"code-generation/jsx/types.ts\"\nimport type { CSSVariableReference } from \"code-generation/utils/CSSVariableDefinitionCollector.ts\"\nimport { type CollectorContext, styleCollector } from \"code-generation/utils/collector.ts\"\nimport { type WithRadius, withRadius, withRelativeRadius } from \"document/models/CanvasTree/traits/WithRadius.ts\"\nimport { FormInputStyleVariableNames } from \"library/render/presentation/Forms/shared.ts\"\nimport { withShape } from \"library/render/traits/Shape.ts\"\nimport { oneIfCornerShapeSupportedCSSVariable } from \"library/render/utils/injectComponentCSSRules.ts\"\nimport { mapTuple } from \"utils/mapTuple.ts\"\nimport { isNumber, isUndefined } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport { type DynamicValue, isDynamicValue } from \"../DynamicValue.ts\"\nimport { type WithCornerShape, unknownPercentageToCornerShape, withCornerShape } from \"../WithCornerShape.ts\"\nimport { withFormInput } from \"../forms/WithFormInput.ts\"\nimport { createCSSDimension } from \"../utils/CSSDimension.ts\"\nimport type { UnknownProps } from \"../utils/UnknownProps.ts\"\nimport { radiusForCorner } from \"../utils/applyValueTransform.ts\"\nimport { isStylableNode } from \"../utils/hardCodedCodeComponentIdentifierChecks.ts\"\nimport { getCornerRadii } from \"../utils/radius.ts\"\n\nexport const collectCorner = styleCollector((node, style, context) => {\n\tif (withShape(node)) return\n\tif (!withRadius(node)) return\n\n\t// Code Components support the WithRadius trait, but only to support Page\n\t// and Scroll which are style-able. If this node is not one of those\n\t// components, don't collect radius.\n\tif (!isStylableNode(node)) return\n\n\tconst cornerRadii = getCornerRadii(node)\n\tif (!cornerRadii) return\n\n\tconst plainRadiusValues = mapTuple(cornerRadii, (value, cornerIndex) =>\n\t\tgetRadiusValue(node, context, value, cornerIndex),\n\t)\n\n\tconst patchedRadiusValues = collectCornerShapeAndGetPatchedRadius(node, style, context, plainRadiusValues)\n\n\tconst topLeftKey = withFormInput(node) ? FormInputStyleVariableNames.BorderRadiusTopLeft : \"borderTopLeftRadius\"\n\tconst topRightKey = withFormInput(node) ? FormInputStyleVariableNames.BorderRadiusTopRight : \"borderTopRightRadius\"\n\tconst bottomRightKey = withFormInput(node)\n\t\t? FormInputStyleVariableNames.BorderRadiusBottomRight\n\t\t: \"borderBottomRightRadius\"\n\tconst bottomLeftKey = withFormInput(node)\n\t\t? FormInputStyleVariableNames.BorderRadiusBottomLeft\n\t\t: \"borderBottomLeftRadius\"\n\n\tstyle[topLeftKey] = patchedRadiusValues[0]\n\tstyle[topRightKey] = patchedRadiusValues[1]\n\tstyle[bottomRightKey] = patchedRadiusValues[2]\n\tstyle[bottomLeftKey] = patchedRadiusValues[3]\n})\n\nfunction getRadiusValue(\n\tnode: CanvasNode & WithRadius,\n\tcontext: CollectorContext,\n\tvalue: number | DynamicValue | undefined,\n\tcornerIndex: number,\n): RadiusValue {\n\tif (isUndefined(value)) return undefined\n\n\tif (isDynamicValue(value)) {\n\t\tif (isJSXContext(context)) return context.cssVariableDefinitions.create(node, \"radius\", cornerIndex)\n\t\treturn radiusForCorner(node.resolveValue(\"radius\", context.variableOverrides), cornerIndex)\n\t}\n\n\tif (value === 0) return undefined\n\tif (withRelativeRadius(node) && node.radiusIsRelative) return createCSSDimension(value, \"%\")\n\treturn withFormInput(node) ? createCSSDimension(value, \"px\") : value\n}\n\ntype RadiusValue = string | number | SafeJS | undefined\n\nfunction collectCornerShapeAndGetPatchedRadius(\n\tnode: CanvasNode,\n\tstyle: UnknownProps,\n\tcontext: CollectorContext,\n\tradii: readonly [RadiusValue, RadiusValue, RadiusValue, RadiusValue],\n): readonly [RadiusValue, RadiusValue, RadiusValue, RadiusValue] {\n\tif (!withCornerShape(node)) return radii\n\n\tconst cornerShape = getCornerShapeValue(node, context)\n\tconst key = withFormInput(node) ? FormInputStyleVariableNames.CornerShape : \"cornerShape\"\n\tstyle[key] = isUndefined(cornerShape) ? undefined : jst`superellipse(${cornerShape})`\n\n\tif (isUndefined(cornerShape)) return radii\n\n\tif (isJSXContext(context)) {\n\t\tconst patchBorderRadiusScaleCorrector = context.imports.addImport(\"framer\", {\n\t\t\texportSpecifier: \"patchBorderRadiusScaleCorrector\",\n\t\t})\n\n\t\t// The declaration itself isn't used, but there's no \"side-effect collector\"\n\t\tcontext.declarations.file.dedupe(\"patchBorderRadiusScaleCorrector\", SafeJS.fn(patchBorderRadiusScaleCorrector))\n\t}\n\n\tstyle[fallbackCSSVariable] = getRadiusCornerShapeFallbackFactor(cornerShape)\n\treturn mapTuple(radii, radius => wrapRadiusInCornerShapeFallback(radius, `var(${fallbackCSSVariable},1)`))\n}\n\nfunction getCornerShapeValue(\n\tnode: CanvasNode & WithCornerShape,\n\tcontext: CollectorContext,\n): number | SafeJS | undefined {\n\tif (isUndefined(node.cornerShape)) return undefined\n\tif (isNumber(node.cornerShape)) return node.cornerShape\n\n\tif (isJSXContext(context)) {\n\t\treturn context.createDeduplicatedDynamicValueBinding(\n\t\t\tnode.cornerShape,\n\t\t\tnode,\n\t\t\t\"cornerShape\",\n\t\t\tcontext.cssVariableDefinitions.transformForKey(\"cornerShape\", []),\n\t\t)\n\t}\n\n\treturn unknownPercentageToCornerShape(node.resolveValue(\"cornerShape\", context.variableOverrides))\n}\n\nconst fallbackCSSVariable = \"--corner-shape-fallback\"\n\nexport function getRadiusCornerShapeFallbackFactor<T extends number | SafeJS>(cornerShape: T): T {\n\tif (isNumber(cornerShape)) {\n\t\treturn (Math.round(Math.exp(-decayConstant * (cornerShape - 1)) * roundingFactor) / roundingFactor) as T\n\t}\n\n\treturn js`Math.round(Math.exp(-${decayConstant} * (${cornerShape} - 1)) * ${roundingFactor}) / ${roundingFactor}` as T\n}\n\nconst decayConstant = 0.57 // As in \"exponential decay\", arrived at empirically, see Corner Shape RFC\nconst roundingFactor = 10 ** 3 // Where 3 is the number of decimal places\n\n// The generics help exclude `undefined` from the return type\nexport function wrapRadiusInCornerShapeFallback<T extends RadiusValue>(\n\tradius: T,\n\tradiusFactor: CSSVariableReference,\n): T | string | SafeJS {\n\tif (isUndefined(radius)) return radius\n\treturn jst`calc(${isNumber(radius) ? createCSSDimension(radius, \"px\") : radius}*var(${oneIfCornerShapeSupportedCSSVariable},${radiusFactor}))`\n}\n", "import { parseNumberRounded } from \"@framerjs/shared\"\nimport { isNumber, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { WithRadius } from \"../WithRadius.ts\"\nimport type { WithRadiusPerCorner } from \"../WithRadiusPerCorner.ts\"\n\nexport function parseBorderRadius(value: unknown): number | Omit<WithRadiusPerCorner, \"radiusPerCorner\"> | undefined {\n\tif (isNumber(value)) return value\n\tif (!isString(value)) return undefined\n\n\tconst values: string[] = []\n\tfor (const corner of value.split(\" \")) {\n\t\tif (corner === \"/\") break\n\t\tvalues.push(corner.replace(\"calc(\", \"\")) // To handle corner shape fallback\n\t}\n\n\tconst firstValue = values[0]\n\tif (values.length === 1 || values.every(value => value === firstValue)) {\n\t\treturn parseNumberRounded(firstValue)\n\t}\n\n\tconst [topLeft, topRight, bottomRight = topLeft, bottomLeft = topRight] = values\n\n\tconst result = {\n\t\tradiusTopLeft: parseNumberRounded(topLeft) ?? 0,\n\t\tradiusTopRight: parseNumberRounded(topRight) ?? 0,\n\t\tradiusBottomLeft: parseNumberRounded(bottomLeft) ?? 0,\n\t\tradiusBottomRight: parseNumberRounded(bottomRight) ?? 0,\n\t}\n\n\tif (\n\t\tresult.radiusTopLeft === result.radiusTopRight &&\n\t\tresult.radiusTopLeft === result.radiusBottomLeft &&\n\t\tresult.radiusTopLeft === result.radiusBottomRight\n\t) {\n\t\treturn result.radiusTopLeft\n\t}\n\n\treturn result\n}\n\n/**\n * Parse borderRadius from style that has been extracted with\n * getComputedStyle(), so does not account for % radius.\n */\nexport function parseBorderRadiusFromStyle(style: CSSStyleDeclaration): WithRadius | WithRadiusPerCorner | undefined {\n\tconst value = style.borderRadius\n\tif (!value || value === \"none\") return undefined\n\n\tconst radius = parseBorderRadius(value)\n\tif (isUndefined(radius) || radius === 0) return undefined\n\n\tif (isNumber(radius)) {\n\t\treturn { radius }\n\t}\n\n\treturn {\n\t\tradiusPerCorner: true,\n\t\t...radius,\n\t}\n}\n", "import { isUndefined } from \"utils/typeChecks.ts\"\nimport { type WithCornerShape, roundAndClampCornerShape } from \"../WithCornerShape.ts\"\nimport type { OmitVariables } from \"./OmitVariables.ts\"\n\nexport function parseCornerShapeFromStyle({\n\tcornerShape: value,\n}: CSSStyleDeclaration): OmitVariables<WithCornerShape> | undefined {\n\tif (!isUndefined(value)) return parseCornerShape(value)\n}\n\nexport function parseCornerShape(value: string): OmitVariables<WithCornerShape> | undefined {\n\tconst k = extractK(value)\n\tif (!isUndefined(k) && !Number.isNaN(k)) return { cornerShape: roundAndClampCornerShape(k) }\n}\n\nconst namedValues = {\n\tbevel: 0,\n\tnotch: Number.NEGATIVE_INFINITY,\n\tround: 1,\n\tscoop: -1,\n\tsquare: Number.POSITIVE_INFINITY,\n\tsquircle: 2,\n\t// CSS uses \"infinity\", but parseFloat wants \"Infinity\", hence the special cases\n\t\"superellipse(infinity)\": Number.POSITIVE_INFINITY,\n\t\"superellipse(-infinity)\": Number.NEGATIVE_INFINITY,\n} as const\n\nconst kPrefix = \"superellipse(\"\n\nfunction extractK(value: string): number | undefined {\n\tif (value in namedValues) return namedValues[value as keyof typeof namedValues]\n\tif (value.startsWith(kPrefix)) return parseFloat(value.slice(kPrefix.length))\n}\n", "import type { CSSVariableReference } from \"code-generation/utils/CSSVariableDefinitionCollector.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { cornerShapeDefaults } from \"document/models/CanvasTree/traits/WithCornerShape.ts\"\nimport { paddingDefinedDefaults } from \"document/models/CanvasTree/traits/WithPadding.ts\"\nimport { radiusPerCornerDefaults } from \"document/models/CanvasTree/traits/WithRadiusPerCorner.ts\"\nimport type {\n\tFontSize,\n\tLetterSpacing,\n\tLineHeight,\n\tTextAlignment,\n\tTextBackgroundCornerShape,\n\tTextBackgroundPadding,\n\tTextBackgroundRadius,\n\tTextStrokeColor,\n\tTextStrokeWidth,\n\tTextTransform,\n\tWithTextStyle,\n} from \"document/models/CanvasTree/traits/WithTextStyle.ts\"\nimport {\n\tisFontSize,\n\tisLetterSpacingUnit,\n\tisLineHeightUnit,\n\tisTextAlignment,\n\tisTextDecoration,\n\tisTextDecorationCSSDimension,\n\tisTextDecorationSkipInk,\n\tisTextDecorationStyle,\n\tisTextTransform,\n\tmigrateLetterSpacing,\n\ttextDecorationCSSDefaults,\n\ttextStrokeWidthToCSS,\n\ttextStyleDefaults,\n} from \"document/models/CanvasTree/traits/WithTextStyle.ts\"\nimport {\n\tgetRadiusCornerShapeFallbackFactor,\n\twrapRadiusInCornerShapeFallback,\n} from \"document/models/CanvasTree/traits/collectStyles/collectCorner.ts\"\nimport { createCSSDimension, parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { getPaddingNumberPerSide } from \"document/models/CanvasTree/traits/utils/applyValueTransform.ts\"\nimport { parseBorderRadius } from \"document/models/CanvasTree/traits/utils/parseBorderRadiusFromStyle.ts\"\nimport { parseCornerShape } from \"document/models/CanvasTree/traits/utils/parseCornerShapeFromStyle.ts\"\nimport type { OpenTypeFontFeatures } from \"document/models/CanvasTree/utils/openType.ts\"\nimport { cssToOpenTypeFeatureTags, openTypeFeatureTagsToCSS } from \"document/models/CanvasTree/utils/openType.ts\"\nimport { isTokenCSSVariable, stripMetadataFromCSSVariable } from \"document/models/CanvasTree/utils/tokens.ts\"\nimport { Base64 } from \"js-base64\"\nimport { P3Color } from \"library/render/types/Color/Color.ts\"\nimport { Color, ConvertColor } from \"library/render/types/Color/index.ts\"\nimport { getFontStyleProperties } from \"text\"\nimport { isNumber, isUndefined } from \"utils/typeChecks.ts\"\nimport { parseRemFontSize, parseVariable, serializeRemFontSizeCalcString, serializeVariable } from \"./variables.ts\"\n\nexport type AnyStyles = Record<string, any>\n\nexport interface StyleTransform<Type, Styles> {\n\tfromCSS(css: CSSStyleDeclaration): Type\n\ttoCSS(css: CSSStyleDeclaration, value: Type, styles?: Styles): void\n}\n\ntype StyleTransforms<Styles extends AnyStyles> = {\n\t[Key in keyof Styles]-?: StyleTransform<Styles[Key], Styles>\n}\n\nexport enum TextStyleCustomProperty {\n\tFontFamily = \"--framer-font-family\",\n\tFontOpenTypeFeatures = \"--framer-font-open-type-features\",\n\tFontSize = \"--framer-font-size\",\n\tFontStyle = \"--framer-font-style\",\n\tFontVariationAxes = \"--framer-font-variation-axes\",\n\tFontWeight = \"--framer-font-weight\",\n\tLetterSpacing = \"--framer-letter-spacing\",\n\tLineHeight = \"--framer-line-height\",\n\tTextBackgroundPadding = \"--framer-text-background-padding\",\n\tTextBackgroundRadius = \"--framer-text-background-radius\",\n\tTextBackgroundCornerShape = \"--framer-text-background-corner-shape\",\n\tTextBackgroundCornerShapeFallback = \"--framer-text-background-corner-shape-fallback\",\n\tTextAlignment = \"--framer-text-alignment\",\n\tTextColor = \"--framer-text-color\",\n\tTextColorRgb = \"--framer-text-color-rgb\",\n\tTextBackgroundColor = \"--framer-text-background-color\",\n\tTextBackgroundColorRgb = \"--framer-text-background-color-rgb\",\n\tTextDecoration = \"--framer-text-decoration\",\n\tTextDecorationColor = \"--framer-text-decoration-color\",\n\tTextDecorationColorRgb = \"--framer-text-decoration-color-rgb\",\n\tTextDecorationThickness = \"--framer-text-decoration-thickness\",\n\tTextDecorationStyle = \"--framer-text-decoration-style\",\n\tTextDecorationSkipInk = \"--framer-text-decoration-skip-ink\",\n\tTextDecorationOffset = \"--framer-text-decoration-offset\",\n\tTextStrokeColor = \"--framer-text-stroke-color\",\n\tTextStrokeColorRgb = \"--framer-text-stroke-color-rgb\",\n\tTextStrokeWidth = \"--framer-text-stroke-width\",\n\tTextTransform = \"--framer-text-transform\",\n}\n\n// Inline styles\n\nexport interface InlineStyles {\n\treadonly font?: string\n\treadonly textColor?: string | VariableReference\n\treadonly fontSize?: FontSize | number | VariableReference\n\treadonly letterSpacing?: LetterSpacing\n\treadonly textTransform?: TextTransform\n\treadonly textDecoration?: WithTextStyle[\"textDecoration\"]\n\treadonly textDecorationColor?: WithTextStyle[\"textDecorationColor\"]\n\treadonly textDecorationThickness?: WithTextStyle[\"textDecorationThickness\"]\n\treadonly textDecorationStyle?: WithTextStyle[\"textDecorationStyle\"]\n\treadonly textDecorationSkipInk?: WithTextStyle[\"textDecorationSkipInk\"]\n\treadonly textDecorationOffset?: WithTextStyle[\"textDecorationOffset\"]\n\treadonly textStrokeWidth?: TextStrokeWidth\n\treadonly textStrokeColor?: TextStrokeColor\n\treadonly openTypeFontFeatures?: OpenTypeFontFeatures\n}\n\nexport namespace InlineStyles {\n\texport const defaults: Required<InlineStyles> = {\n\t\tfont: textStyleDefaults.font,\n\t\t// textColor.fromCSS converts any color to RGB\n\t\ttextColor: ConvertColor.toRgbString(textStyleDefaults.textColor),\n\t\tfontSize: parseCSSDimension(textStyleDefaults.fontSize),\n\t\tletterSpacing: textStyleDefaults.letterSpacing,\n\t\ttextTransform: textStyleDefaults.textTransform,\n\t\ttextDecoration: textStyleDefaults.textDecoration,\n\t\ttextDecorationColor: textDecorationCSSDefaults.textDecorationColor,\n\t\ttextDecorationThickness: textDecorationCSSDefaults.textDecorationThickness,\n\t\ttextDecorationStyle: textDecorationCSSDefaults.textDecorationStyle,\n\t\ttextDecorationSkipInk: textDecorationCSSDefaults.textDecorationSkipInk,\n\t\ttextDecorationOffset: textDecorationCSSDefaults.textDecorationOffset,\n\t\ttextStrokeWidth: textStyleDefaults.textStrokeWidth,\n\t\ttextStrokeColor: textStyleDefaults.textStrokeColor,\n\t\topenTypeFontFeatures: [],\n\t}\n\n\texport const transforms: StyleTransforms<InlineStyles> = {\n\t\tfont: {\n\t\t\tfromCSS(css) {\n\t\t\t\tconst encoded = css.getPropertyValue(\"--font-selector\").trim()\n\t\t\t\tif (encoded === \"\") return undefined\n\n\t\t\t\ttry {\n\t\t\t\t\treturn Base64.decode(encoded)\n\t\t\t\t} catch {\n\t\t\t\t\treturn undefined\n\t\t\t\t}\n\t\t\t},\n\n\t\t\ttoCSS(css, value) {\n\t\t\t\tif (value === undefined) return\n\n\t\t\t\tconst font = getFontStyleProperties(value)\n\t\t\t\tconst fontWeight = String(font.fontWeight ?? 400)\n\t\t\t\tcss.setProperty(TextStyleCustomProperty.FontFamily, font.fontFamily ?? \"sans-serif\")\n\t\t\t\tcss.setProperty(TextStyleCustomProperty.FontStyle, font.fontStyle ?? \"normal\")\n\t\t\t\tcss.setProperty(TextStyleCustomProperty.FontWeight, fontWeight)\n\n\t\t\t\tconst fontVariationAxes = font.fontVariationAxes ?? \"normal\"\n\t\t\t\tcss.setProperty(TextStyleCustomProperty.FontVariationAxes, fontVariationAxes)\n\n\t\t\t\tconst encoded = Base64.encode(value)\n\t\t\t\tcss.setProperty(\"--font-selector\", encoded)\n\t\t\t},\n\t\t},\n\n\t\ttextColor: {\n\t\t\tfromCSS(css) {\n\t\t\t\tconst textColor = (css.getPropertyValue(TextStyleCustomProperty.TextColor) || css.color).trim()\n\t\t\t\tif (textColor === \"\") return undefined\n\n\t\t\t\tconst parsedVariable = parseVariable(textColor)\n\t\t\t\tif (parsedVariable) return parsedVariable\n\n\t\t\t\tconst isColorToken = isTokenCSSVariable(textColor)\n\t\t\t\tif (isColorToken) return textColor\n\n\t\t\t\treturn ConvertColor.toFormatString(textColor)\n\t\t\t},\n\n\t\t\ttoCSS(css, value) {\n\t\t\t\tif (value === undefined) return\n\n\t\t\t\tif (isVariableReference(value)) {\n\t\t\t\t\tvalue = serializeVariable(value)\n\t\t\t\t} else if (isTokenCSSVariable(value)) {\n\t\t\t\t\tvalue = stripMetadataFromCSSVariable(value)\n\t\t\t\t}\n\n\t\t\t\tcss.setProperty(TextStyleCustomProperty.TextColor, value ?? null)\n\t\t\t\tif (Color.isP3String(value)) {\n\t\t\t\t\tconst rgb = P3Color.fromString(value)?.toString(\"srgb\") ?? null\n\t\t\t\t\tcss.setProperty(TextStyleCustomProperty.TextColorRgb, rgb)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\n\t\tfontSize: {\n\t\t\tfromCSS(css) {\n\t\t\t\tconst fontSize = (css.getPropertyValue(TextStyleCustomProperty.FontSize) || css.fontSize).trim()\n\n\t\t\t\tconst parsedVariable = parseVariable(fontSize)\n\t\t\t\tif (parsedVariable) return parsedVariable\n\n\t\t\t\tconst parsedRem = parseRemFontSize(fontSize)\n\t\t\t\tif (parsedRem) return parsedRem\n\n\t\t\t\ttry {\n\t\t\t\t\tconst parsedCSS = parseCSSDimension(fontSize, \"px\")\n\t\t\t\t\tif (isFontSize(parsedCSS)) return parsedCSS\n\t\t\t\t} catch {\n\t\t\t\t\treturn undefined\n\t\t\t\t}\n\t\t\t},\n\n\t\t\ttoCSS(css, value) {\n\t\t\t\tif (value === undefined) return\n\n\t\t\t\tif (isVariableReference(value)) {\n\t\t\t\t\t// Variable values are unit less so we need to convert them into pixels\n\t\t\t\t\tconst variable = serializeVariable(value)\n\t\t\t\t\tcss.setProperty(TextStyleCustomProperty.FontSize, `calc(${variable} * 1px)`)\n\t\t\t\t} else if (isNumber(value)) {\n\t\t\t\t\t// We assume all number values are pixels for simplicity\n\t\t\t\t\tcss.setProperty(TextStyleCustomProperty.FontSize, createCSSDimension(value, \"px\"))\n\t\t\t\t} else {\n\t\t\t\t\tconst [size, unit] = value\n\t\t\t\t\tcss.setProperty(\n\t\t\t\t\t\tTextStyleCustomProperty.FontSize,\n\t\t\t\t\t\tunit === \"rem\" ? serializeRemFontSizeCalcString(size) : createCSSDimension(size, unit),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\n\t\tletterSpacing: {\n\t\t\tfromCSS(css) {\n\t\t\t\tconst letterSpacing = (css.getPropertyValue(TextStyleCustomProperty.LetterSpacing) || css.letterSpacing).trim()\n\t\t\t\tconst [value, unit = \"px\"] = parseCSSDimension(letterSpacing)\n\t\t\t\tif (!Number.isNaN(value) && isLetterSpacingUnit(unit)) {\n\t\t\t\t\treturn [value, unit]\n\t\t\t\t}\n\n\t\t\t\treturn undefined\n\t\t\t},\n\n\t\t\ttoCSS(css, value) {\n\t\t\t\tif (value === undefined) return\n\t\t\t\t// We did not do a migration when introducing letter spacing units, so we need to anticipate incoming\n\t\t\t\t// numeric values when migrating a TextNode to RichText.\n\t\t\t\tconst letterSpacing = migrateLetterSpacing(value)\n\t\t\t\tcss.setProperty(TextStyleCustomProperty.LetterSpacing, letterSpacing.join(\"\"))\n\t\t\t},\n\t\t},\n\n\t\ttextTransform: {\n\t\t\tfromCSS(css) {\n\t\t\t\tconst textTransform = (css.getPropertyValue(TextStyleCustomProperty.TextTransform) || css.textTransform).trim()\n\n\t\t\t\tif (isTextTransform(textTransform)) {\n\t\t\t\t\treturn textTransform\n\t\t\t\t}\n\n\t\t\t\treturn undefined\n\t\t\t},\n\n\t\t\ttoCSS(css, value) {\n\t\t\t\tif (value === undefined) return\n\t\t\t\tcss.setProperty(TextStyleCustomProperty.TextTransform, value)\n\t\t\t},\n\t\t},\n\n\t\ttextDecoration: {\n\t\t\tfromCSS(css) {\n\t\t\t\tconst textDecoration = (\n\t\t\t\t\tcss.getPropertyValue(TextStyleCustomProperty.TextDecoration) || css.textDecoration\n\t\t\t\t).trim()\n\n\t\t\t\tif (isTextDecoration(textDecoration)) {\n\t\t\t\t\treturn textDecoration\n\t\t\t\t}\n\n\t\t\t\treturn undefined\n\t\t\t},\n\n\t\t\ttoCSS(css, value) {\n\t\t\t\tif (value === undefined) return\n\t\t\t\tcss.setProperty(TextStyleCustomProperty.TextDecoration, value)\n\t\t\t},\n\t\t},\n\n\t\ttextDecorationColor: {\n\t\t\tfromCSS(css) {\n\t\t\t\tconst textDecorationColor = (\n\t\t\t\t\tcss.getPropertyValue(TextStyleCustomProperty.TextDecorationColor) || css.textDecorationColor\n\t\t\t\t).trim()\n\t\t\t\treturn textDecorationColor === \"\" ? textStyleDefaults.textDecorationColor : textDecorationColor\n\t\t\t},\n\t\t\ttoCSS(css, value) {\n\t\t\t\tif (value === undefined) return\n\t\t\t\tcss.setProperty(TextStyleCustomProperty.TextDecorationColor, value)\n\t\t\t\tif (Color.isP3String(value)) {\n\t\t\t\t\tconst rgb = P3Color.fromString(value)?.toString(\"srgb\") ?? null\n\t\t\t\t\tcss.setProperty(TextStyleCustomProperty.TextDecorationColorRgb, rgb)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\n\t\ttextDecorationThickness: {\n\t\t\tfromCSS(css) {\n\t\t\t\tconst textDecorationThickness = withFallbackForOutdatedJSDom(\n\t\t\t\t\tcss.getPropertyValue(TextStyleCustomProperty.TextDecorationThickness) || css.textDecorationThickness,\n\t\t\t\t).trim()\n\n\t\t\t\treturn isTextDecorationCSSDimension(textDecorationThickness) ? textDecorationThickness : undefined\n\t\t\t},\n\t\t\ttoCSS(css, value) {\n\t\t\t\tif (value === undefined) return\n\t\t\t\tcss.setProperty(TextStyleCustomProperty.TextDecorationThickness, value)\n\t\t\t},\n\t\t},\n\n\t\ttextDecorationOffset: {\n\t\t\tfromCSS(css) {\n\t\t\t\tconst textDecorationOffset = withFallbackForOutdatedJSDom(\n\t\t\t\t\tcss.getPropertyValue(TextStyleCustomProperty.TextDecorationOffset) || css.textUnderlineOffset,\n\t\t\t\t).trim()\n\t\t\t\treturn isTextDecorationCSSDimension(textDecorationOffset) ? textDecorationOffset : undefined\n\t\t\t},\n\t\t\ttoCSS(css, value) {\n\t\t\t\tif (value === undefined) return\n\t\t\t\tcss.setProperty(TextStyleCustomProperty.TextDecorationOffset, value)\n\t\t\t},\n\t\t},\n\n\t\ttextDecorationStyle: {\n\t\t\tfromCSS(css) {\n\t\t\t\tconst textDecorationStyle = (\n\t\t\t\t\tcss.getPropertyValue(TextStyleCustomProperty.TextDecorationStyle) || css.textDecorationStyle\n\t\t\t\t).trim()\n\t\t\t\treturn isTextDecorationStyle(textDecorationStyle) ? textDecorationStyle : undefined\n\t\t\t},\n\t\t\ttoCSS(css, value) {\n\t\t\t\tif (value === undefined) return\n\t\t\t\tcss.setProperty(TextStyleCustomProperty.TextDecorationStyle, value)\n\t\t\t},\n\t\t},\n\n\t\ttextDecorationSkipInk: {\n\t\t\tfromCSS(css) {\n\t\t\t\tconst textDecorationSkipInk = withFallbackForOutdatedJSDom(\n\t\t\t\t\tcss.getPropertyValue(TextStyleCustomProperty.TextDecorationSkipInk) || css.textDecorationSkipInk,\n\t\t\t\t).trim()\n\t\t\t\treturn isTextDecorationSkipInk(textDecorationSkipInk) ? textDecorationSkipInk : undefined\n\t\t\t},\n\t\t\ttoCSS(css, value) {\n\t\t\t\tif (value === undefined) return\n\t\t\t\tcss.setProperty(TextStyleCustomProperty.TextDecorationSkipInk, value)\n\t\t\t},\n\t\t},\n\n\t\ttextStrokeWidth: {\n\t\t\tfromCSS(css) {\n\t\t\t\tconst textStrokeWidth = (\n\t\t\t\t\tcss.getPropertyValue(TextStyleCustomProperty.TextStrokeWidth) || css.webkitTextStrokeWidth\n\t\t\t\t).trim()\n\t\t\t\tif (textStrokeWidth === \"\") return undefined\n\t\t\t\tif (textStrokeWidth === textStyleDefaults.textStrokeWidth) return textStrokeWidth\n\t\t\t\treturn parseNumber(textStrokeWidth)\n\t\t\t},\n\t\t\ttoCSS(css, value) {\n\t\t\t\tif (value === undefined) return\n\t\t\t\tcss.setProperty(TextStyleCustomProperty.TextStrokeWidth, textStrokeWidthToCSS(value))\n\t\t\t},\n\t\t},\n\n\t\ttextStrokeColor: {\n\t\t\tfromCSS(css) {\n\t\t\t\tconst textStrokeColor = (\n\t\t\t\t\tcss.getPropertyValue(TextStyleCustomProperty.TextStrokeColor) || css.webkitTextStrokeColor\n\t\t\t\t).trim()\n\t\t\t\tif (textStrokeColor === \"\") return undefined\n\t\t\t\treturn textStrokeColor\n\t\t\t},\n\n\t\t\ttoCSS(css, value) {\n\t\t\t\tif (value === undefined) return\n\t\t\t\tcss.setProperty(TextStyleCustomProperty.TextStrokeColor, value)\n\t\t\t\tif (Color.isP3String(value)) {\n\t\t\t\t\tconst rgb = P3Color.fromString(value)?.toString(\"srgb\") ?? null\n\t\t\t\t\tcss.setProperty(TextStyleCustomProperty.TextStrokeColorRgb, rgb)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\n\t\topenTypeFontFeatures: {\n\t\t\tfromCSS(css) {\n\t\t\t\tconst rawValue = (css.getPropertyValue(TextStyleCustomProperty.FontOpenTypeFeatures) || \"\").trim()\n\t\t\t\tif (rawValue === \"\") return undefined\n\t\t\t\treturn cssToOpenTypeFeatureTags(rawValue)\n\t\t\t},\n\n\t\t\ttoCSS(css, value) {\n\t\t\t\tif (value === undefined) return\n\t\t\t\tconst openTypeFontFeatures = openTypeFeatureTagsToCSS(value)\n\t\t\t\tif (!openTypeFontFeatures) return\n\t\t\t\tcss.setProperty(TextStyleCustomProperty.FontOpenTypeFeatures, openTypeFontFeatures)\n\t\t\t},\n\t\t},\n\t}\n}\n\n/**\n * Some CSS properties don't exist on JSDOM CSSStyleDeclaration, but they do exist on our typescript version.\n * So we have to fallback to an empty string to prevent tests breaking for any property added since 2020\n */\nfunction withFallbackForOutdatedJSDom(value: string | undefined) {\n\treturn value ?? \"\"\n}\n\nexport function serializeTextBackgroundRadius(\n\tvalue: TextBackgroundRadius | undefined,\n\tcornerShape: TextBackgroundCornerShape | undefined,\n\tcornerShapeFallback: CSSVariableReference,\n): { radius?: string; radiusCornerShapeFallbackFactor?: number } {\n\tif (value?.radiusPerCorner) {\n\t\tconst radii = [\n\t\t\tcreateCSSDimension(value.radiusTopLeft, \"px\"),\n\t\t\tcreateCSSDimension(value.radiusTopRight, \"px\"),\n\t\t\tcreateCSSDimension(value.radiusBottomRight, \"px\"),\n\t\t\tcreateCSSDimension(value.radiusBottomLeft, \"px\"),\n\t\t]\n\n\t\tif (isUndefined(cornerShape?.cornerShape)) return { radius: radii.join(\" \") }\n\t\treturn {\n\t\t\tradius: radii.map(radius => wrapRadiusInCornerShapeFallback(radius, cornerShapeFallback)).join(\" \"),\n\t\t\tradiusCornerShapeFallbackFactor: getRadiusCornerShapeFallbackFactor(cornerShape.cornerShape),\n\t\t}\n\t}\n\n\tif (isUndefined(value?.radius)) return {}\n\tif (isUndefined(cornerShape?.cornerShape)) return { radius: createCSSDimension(value.radius, \"px\") }\n\n\treturn {\n\t\tradius: String(wrapRadiusInCornerShapeFallback(createCSSDimension(value.radius, \"px\"), cornerShapeFallback)),\n\t\tradiusCornerShapeFallbackFactor: getRadiusCornerShapeFallbackFactor(cornerShape.cornerShape),\n\t}\n}\n\nfunction parseTextBackgroundRadius(value: string) {\n\tconst parsedRadius = parseBorderRadius(value)\n\tif (isUndefined(parsedRadius)) return undefined\n\n\tif (isNumber(parsedRadius)) {\n\t\treturn {\n\t\t\tradius: parsedRadius,\n\t\t\tradiusPerCorner: value.includes(\" \"),\n\t\t\tradiusTopLeft: parsedRadius,\n\t\t\tradiusTopRight: parsedRadius,\n\t\t\tradiusBottomLeft: parsedRadius,\n\t\t\tradiusBottomRight: parsedRadius,\n\t\t}\n\t}\n\n\treturn {\n\t\tradius: parsedRadius.radiusTopLeft,\n\t\tradiusPerCorner: true,\n\t\tradiusTopLeft: parsedRadius.radiusTopLeft,\n\t\tradiusTopRight: parsedRadius.radiusTopRight,\n\t\tradiusBottomLeft: parsedRadius.radiusBottomLeft,\n\t\tradiusBottomRight: parsedRadius.radiusBottomRight,\n\t}\n}\n\nexport function serializeTextBackgroundCornerShape(value: number) {\n\treturn `superellipse(${value})`\n}\n\nfunction serializeTextBackgroundPadding(value: TextBackgroundPadding) {\n\tif (value.paddingPerSide) {\n\t\treturn `${value.paddingTop}px ${value.paddingRight}px ${value.paddingBottom}px ${value.paddingLeft}px`\n\t}\n\treturn `${value.padding}px`\n}\n\nfunction parseTextBackgroundPadding(value: string) {\n\tconst { top, right, bottom, left } = getPaddingNumberPerSide(value)\n\treturn {\n\t\tpadding: top,\n\t\tpaddingPerSide: value.includes(\" \"),\n\t\tpaddingTop: top,\n\t\tpaddingRight: right,\n\t\tpaddingBottom: bottom,\n\t\tpaddingLeft: left,\n\t}\n}\n\n/**\n * Mark styles are separated from standard inline styles to make them easier to define css rules for and easier to override on sub-spans.\n */\nexport interface BackgroundStyles {\n\treadonly textBackgroundColor?: WithTextStyle[\"textBackgroundColor\"]\n\treadonly textBackgroundRadius?: TextBackgroundRadius\n\treadonly textBackgroundCornerShape?: TextBackgroundCornerShape\n\treadonly textBackgroundPadding?: TextBackgroundPadding\n}\n\nexport namespace BackgroundStyles {\n\texport const defaults = {\n\t\ttextBackgroundColor: \"initial\",\n\t\ttextBackgroundRadius: { ...radiusPerCornerDefaults, radius: 0 },\n\t\ttextBackgroundCornerShape: { ...cornerShapeDefaults },\n\t\ttextBackgroundPadding: { ...(paddingDefinedDefaults as TextBackgroundPadding) },\n\t} as const satisfies Required<BackgroundStyles>\n\n\texport const transforms: StyleTransforms<BackgroundStyles> = {\n\t\ttextBackgroundColor: {\n\t\t\tfromCSS(css) {\n\t\t\t\tconst backgroundColor = (\n\t\t\t\t\tcss.getPropertyValue(TextStyleCustomProperty.TextBackgroundColor) || css.backgroundColor\n\t\t\t\t).trim()\n\t\t\t\tif (!backgroundColor || backgroundColor === \"initial\") return undefined\n\n\t\t\t\tconst parsedVariable = parseVariable(backgroundColor)\n\t\t\t\tif (parsedVariable) return parsedVariable\n\n\t\t\t\tconst isColorToken = isTokenCSSVariable(backgroundColor)\n\t\t\t\tif (isColorToken) return backgroundColor\n\n\t\t\t\treturn ConvertColor.toFormatString(backgroundColor)\n\t\t\t},\n\n\t\t\ttoCSS(css, value) {\n\t\t\t\tif (value === undefined) return\n\n\t\t\t\tif (isVariableReference(value)) {\n\t\t\t\t\tvalue = serializeVariable(value)\n\t\t\t\t} else if (isTokenCSSVariable(value)) {\n\t\t\t\t\tvalue = stripMetadataFromCSSVariable(value)\n\t\t\t\t}\n\n\t\t\t\tcss.setProperty(TextStyleCustomProperty.TextBackgroundColor, value ?? null)\n\t\t\t\tif (Color.isP3String(value)) {\n\t\t\t\t\tconst rgb = P3Color.fromString(value)?.toString(\"srgb\") ?? null\n\t\t\t\t\tcss.setProperty(TextStyleCustomProperty.TextBackgroundColorRgb, rgb)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\ttextBackgroundRadius: {\n\t\t\tfromCSS(css) {\n\t\t\t\tconst radius = (css.getPropertyValue(TextStyleCustomProperty.TextBackgroundRadius) || css.borderRadius).trim()\n\t\t\t\tif (!radius) return undefined\n\n\t\t\t\treturn parseTextBackgroundRadius(radius)\n\t\t\t},\n\t\t\ttoCSS(css, value, styles) {\n\t\t\t\tif (isUndefined(value)) return\n\n\t\t\t\tconst { radius, radiusCornerShapeFallbackFactor } = serializeTextBackgroundRadius(\n\t\t\t\t\tvalue,\n\t\t\t\t\tstyles?.textBackgroundCornerShape,\n\t\t\t\t\t`var(${TextStyleCustomProperty.TextBackgroundCornerShapeFallback},1)`,\n\t\t\t\t)\n\n\t\t\t\tif (isUndefined(radius)) return\n\t\t\t\tcss.setProperty(TextStyleCustomProperty.TextBackgroundRadius, radius)\n\n\t\t\t\tif (isUndefined(radiusCornerShapeFallbackFactor)) return\n\t\t\t\tcss.setProperty(\n\t\t\t\t\tTextStyleCustomProperty.TextBackgroundCornerShapeFallback,\n\t\t\t\t\tString(radiusCornerShapeFallbackFactor),\n\t\t\t\t)\n\t\t\t},\n\t\t},\n\t\ttextBackgroundCornerShape: {\n\t\t\tfromCSS(css) {\n\t\t\t\tconst cornerShape = (\n\t\t\t\t\tcss.getPropertyValue(TextStyleCustomProperty.TextBackgroundCornerShape) || css.cornerShape\n\t\t\t\t)?.trim()\n\t\t\t\tif (!cornerShape) return undefined\n\t\t\t\treturn parseCornerShape(cornerShape)\n\t\t\t},\n\t\t\ttoCSS(css, value) {\n\t\t\t\tif (value?.cornerShape === undefined) return\n\t\t\t\tcss.setProperty(\n\t\t\t\t\tTextStyleCustomProperty.TextBackgroundCornerShape,\n\t\t\t\t\tserializeTextBackgroundCornerShape(value.cornerShape),\n\t\t\t\t)\n\t\t\t},\n\t\t},\n\t\ttextBackgroundPadding: {\n\t\t\tfromCSS(css) {\n\t\t\t\tconst padding = (css.getPropertyValue(TextStyleCustomProperty.TextBackgroundPadding) || css.padding).trim()\n\t\t\t\tif (!padding) return undefined\n\n\t\t\t\treturn parseTextBackgroundPadding(padding)\n\t\t\t},\n\t\t\ttoCSS(css, value) {\n\t\t\t\tif (value === undefined) return\n\t\t\t\tcss.setProperty(TextStyleCustomProperty.TextBackgroundPadding, serializeTextBackgroundPadding(value))\n\t\t\t},\n\t\t},\n\t}\n}\n\n// Block styles\n\nexport interface BlockStyles {\n\treadonly lineHeight?: LineHeight\n\treadonly textAlignment?: TextAlignment\n}\n\nexport namespace BlockStyles {\n\texport const defaults: Required<BlockStyles> = {\n\t\tlineHeight: [1.2, \"em\"],\n\t\ttextAlignment: \"start\",\n\t}\n\n\texport const transforms: StyleTransforms<BlockStyles> = {\n\t\tlineHeight: {\n\t\t\tfromCSS(css) {\n\t\t\t\tconst lineHeight = (css.getPropertyValue(TextStyleCustomProperty.LineHeight) || css.lineHeight).trim()\n\t\t\t\tconst [value, unit = \"em\"] = parseCSSDimension(lineHeight)\n\t\t\t\tif (!Number.isNaN(value) && isLineHeightUnit(unit)) {\n\t\t\t\t\treturn [value, unit]\n\t\t\t\t}\n\t\t\t\treturn undefined\n\t\t\t},\n\n\t\t\ttoCSS(css, value) {\n\t\t\t\tif (value === undefined) return\n\t\t\t\tconst lineHeight = value.join(\"\")\n\t\t\t\tcss.setProperty(TextStyleCustomProperty.LineHeight, lineHeight)\n\t\t\t},\n\t\t},\n\n\t\ttextAlignment: {\n\t\t\tfromCSS(css) {\n\t\t\t\tconst textAlignment = (css.getPropertyValue(TextStyleCustomProperty.TextAlignment) || css.textAlign).trim()\n\n\t\t\t\tif (isTextAlignment(textAlignment)) {\n\t\t\t\t\treturn textAlignment\n\t\t\t\t}\n\n\t\t\t\treturn undefined\n\t\t\t},\n\n\t\t\ttoCSS(css, value) {\n\t\t\t\tif (value === undefined) return\n\t\t\t\tcss.setProperty(TextStyleCustomProperty.TextAlignment, value)\n\t\t\t},\n\t\t},\n\t}\n}\n\n// Serialization\n\nexport function setStyles<Styles extends AnyStyles>(\n\tcss: CSSStyleDeclaration,\n\ttransforms: StyleTransforms<Styles>,\n\tvalues: Styles,\n) {\n\tfor (const key in transforms) {\n\t\tconst transform = transforms[key]\n\t\tconst value = values[key]\n\t\ttransform.toCSS(css, value, values)\n\t}\n}\n\nexport function getStyles<Styles extends AnyStyles>(\n\tcss: CSSStyleDeclaration,\n\ttransforms: StyleTransforms<Styles>,\n): Styles {\n\tconst values: Partial<Styles> = {}\n\n\tfor (const key in transforms) {\n\t\tconst transform = transforms[key]\n\t\tconst value = transform.fromCSS(css)\n\t\tif (value === undefined) continue\n\t\tvalues[key] = value\n\t}\n\n\treturn values as Styles\n}\n\n// Helpers\n\nfunction parseNumber(value: string) {\n\tconst number = parseFloat(value)\n\n\tif (Number.isFinite(number)) {\n\t\treturn number\n\t}\n\n\treturn undefined\n}\n", "/**\n * Javascript implementation of djb2 hash function\n * More info see: https://gist.github.com/eplawless/52813b1d8ad9af510d85\n * In case you wonder where this magic 5381 value comes from see:\n * https://stackoverflow.com/questions/10696223/reason-for-5381-number-in-djb-hash-function/10697529#10697529\n */\nconst getStringHash = (s: string) => {\n\tlet hash = 5381,\n\t\ti = s.length\n\n\twhile (i) {\n\t\thash = (hash * 33) ^ s.charCodeAt(--i)\n\t}\n\n\t/* JavaScript does bitwise operations (like XOR, above) on 32-bit signed\n\t * integers. Since we want the results to be always positive, convert the\n\t * signed int to an unsigned by doing an unsigned bitshift. */\n\treturn hash >>> 0\n}\n\nconst getObjectHash = (obj: unknown) => {\n\treturn getStringHash(JSON.stringify(obj))\n}\n\nconst globalCache = new Map<string, unknown>()\n\nfunction cacheGet(k: string) {\n\treturn globalCache.get(k)\n}\n\nfunction cacheSet(k: string, v: unknown) {\n\tglobalCache.set(k, v)\n}\n\nconst timers: { [index: string]: number } = {}\n\nexport function cached<T>(key: string, f: Function, validator?: (result: any) => boolean, time = 0) {\n\treturn (...args: T[]) => {\n\t\tconst cacheKey = `${key}-${getObjectHash(args)}`\n\t\tconst cacheValue = cacheGet(cacheKey)\n\n\t\tif (typeof cacheValue !== \"undefined\") {\n\t\t\treturn cacheValue\n\t\t}\n\n\t\tconst value = f(...args)\n\n\t\tif (time > 0) {\n\t\t\tcacheSet(cacheKey, value)\n\t\t\ttimers[cacheKey] = window.setTimeout(() => cacheSet(cacheKey, undefined), time)\n\t\t}\n\n\t\tif (!validator || validator(value)) {\n\t\t\tcacheSet(cacheKey, value)\n\t\t\ttimers[cacheKey] && window.clearTimeout(timers[cacheKey])\n\t\t}\n\n\t\treturn value\n\t}\n}\n", "import type { FontCategory } from \"library/render/fonts/types.ts\"\n\nexport function inferFontCategory(value: string): FontCategory {\n\tif (value.match(/mono|consolas|console|courier|menlo|monaco/i)) {\n\t\treturn \"monospace\"\n\t} else if (value.match(/roboto.slab/i)) {\n\t\treturn \"slab\"\n\t} else if (value.match(/serif/i)) {\n\t\treturn \"serif\"\n\t} else if (value.match(/sans|arial|roboto|sfui|futura|helvetica|grande|tahoma|verdana|inter/i)) {\n\t\treturn \"sans-serif\"\n\t} else {\n\t\treturn \"sans-serif\"\n\t}\n}\n", "export type Range = [number, number]\n\nexport function isRangeOverlappingRange(a: Range, b: Range) {\n\ta = getSortedRange(a)\n\tb = getSortedRange(b)\n\treturn Math.max(a[0], b[0]) < Math.min(a[1], b[1])\n}\n\nexport function getRangeForCharacterIndex(index: number): Range {\n\treturn [index, index + 1]\n}\n\n// NOTE: Only exported for testing\nexport function isIndexInRange(index: number, range: Range) {\n\treturn index >= Math.min(...range) && index <= Math.max(...range)\n}\n\nfunction isIndexInRanges(index: number, ranges: Range[]) {\n\tfor (const range of ranges) {\n\t\tif (isIndexInRange(index, range)) return true\n\t}\n\treturn false\n}\n\n// NOTE: Only exported for testing\nexport function isRangeCovered(range: Range, ranges: Range[]) {\n\tif (!ranges.length) return false\n\tfor (let index = range[0]; index <= range[1]; index++) {\n\t\tif (isIndexInRanges(index, ranges)) continue\n\t\treturn false\n\t}\n\treturn true\n}\n\nexport function getSortedRange(range: Range): Range {\n\treturn [Math.min(...range), Math.max(...range)]\n}\n\nexport function isRangeCollapsed(range: Range) {\n\treturn range[0] === range[1]\n}\n", "import type { AssetMap } from \"@framerjs/assets\"\nimport { INTER_DISPLAY_FONT_METRICS, INTER_FONT_METRICS } from \"document/utils/interFonts.ts\"\nimport type { FontSourceName } from \"library/index.ts\"\nimport { fontStore } from \"library/index.ts\"\nimport type { FontCategory } from \"library/render/fonts/types.ts\"\nimport { assertNever } from \"../../../../services/src/runtime/typescript/assertNever.ts\"\nimport { inferFontCategory } from \"./inferFontCategory.ts\"\n\n// Same as tools/font-metadata-extractor/types.ts\ninterface FontMetrics {\n\tascent: number\n\tdescent: number\n\tlineGap: number\n\tunitsPerEm: number\n\tazAvgWidth?: number\n}\n\n// These metrics are [copy-pasted straight from Next.js][1], but they can be (re-)generated manually using\n// tools/font-metadata-extractor (yarn build && node extractCustomFontMetrics.js <path to font>).\n//\n// The reason we\u2019re hardcoding these metrics instead of generating them as part of our regularly-scheduled\n// font-metadata-extractor GitHub Action run:\n//\n//   - reliability (we can\u2019t rely on these fonts being present in the CI environment)\n//   - licensing (we can\u2019t commit Arial and Times New Roman fonts into our repo either)\n//\n// [1]: https://github.com/vercel/next.js/blob/90bfb762c8c3af0282b1abb98d06962e8904e001/packages/font/src/utils.ts#L4-L13\nconst defaultFallbackFonts = {\n\t\"sans-serif\": {\n\t\tname: \"Arial\",\n\t\tazAvgWidth: 934.5116279069767,\n\t\tunitsPerEm: 2048,\n\t},\n\tserif: {\n\t\tname: \"Times New Roman\",\n\t\tazAvgWidth: 854.3953488372093,\n\t\tunitsPerEm: 2048,\n\t},\n}\n\nexport function shouldGenerateSizeAdjustedFallback(\n\tsource: FontSourceName,\n\tfontWeight: string | undefined,\n\tfontCategory: FontCategory | undefined,\n): boolean {\n\t// Only fonts in serif and sans-serif categories should generate size-adjusted fallbacks.\n\t//\n\t// Why only serif and sans-serif categories? That\u2019s because our size-adjusted fallbacks are Arial and Times New\n\t// Roman. They work well for sans-serif and serif fonts, but for other fonts (like fancy handwriting ones), they\n\t// produce a too big visual jump:\n\t//\n\t// https://paper.dropbox.com/doc/Framer-Lighthouse-Audit--Bx7VlN25uPuTX4OqnW__jOTRAg-cNi805eZ9i42R4eszN0PJ#:uid=890719051645189991683945&h2=4.-Use-font-display:-swap-for-\n\t//\n\t// Even though this visual jump (called FOUT) is standard on the web, in Framer, we\u2019re trying to reduce it because\n\t// we care about how the site looks while loading.\n\tconst fontCategoryHasFallback = fontCategory === \"serif\" || fontCategory === \"sans-serif\"\n\n\t// Only regular, medium, and bold weights have size-adjusted fallbacks. That\u2019s because our size-adjusted fallbacks\n\t// are Arial and Times New Roman, and they only ship with 400 and 700 weights. Using an Arial 400 for e.g. Roboto\n\t// 100 will produce a more noticeable visual jump (FOUT), which we\u2019re trying to minimize.\n\tconst fontWeightHasFallback = Boolean(\n\t\tfontWeight && [\"300\", \"400\", \"500\", \"600\", \"700\", \"800\", \"normal\", \"bold\"].includes(fontWeight),\n\t)\n\n\tswitch (source) {\n\t\tcase \"fontshare\":\n\t\tcase \"framer\":\n\t\tcase \"google\":\n\t\tcase \"builtIn\":\n\t\t\treturn fontCategoryHasFallback && fontWeightHasFallback\n\t\tcase \"custom\":\n\t\t\treturn fontWeight\n\t\t\t\t? // We generally don\u2019t know the category of custom fonts, so we only check the weight.\n\t\t\t\t\t// This has a drawback of introducing a visual jump for fancy handwriting fonts; if\n\t\t\t\t\t// people complain, we can adjust the heuristic.\n\t\t\t\t\tfontWeightHasFallback\n\t\t\t\t: // Before https://github.com/framer/FramerStudio/pull/24693 lands, custom fonts\n\t\t\t\t\t// won\u2019t have a font weight. Let\u2019s use `font-display: swap` for all fonts.\n\t\t\t\t\ttrue\n\t\tcase \"local\":\n\t\t\treturn false\n\t\tdefault:\n\t\t\tassertNever(source)\n\t}\n}\n\nexport function getSizeAdjustedFallbackFontFamily(cssFontFamily: string): string {\n\treturn cssFontFamily + \" Placeholder\"\n}\n\nexport interface FallbackFontValues {\n\tfallbackFontName: string\n\tascentOverride: string\n\tdescentOverride: string\n\tlineGapOverride: string\n\tsizeAdjust: string\n}\n\n/**\n * Calculate the font metrics, per https://github.com/vercel/next.js/blob/b1f154d88b5ee597f07c7eff603295b0d0ccf5a5/packages/next/src/server/font-utils.ts#L121-L142.\n */\nfunction calculateSizeAdjustedFallbackValues(\n\t{ ascent, descent, lineGap, unitsPerEm, azAvgWidth }: FontMetrics,\n\tcategory: FontCategory | undefined,\n): FallbackFontValues {\n\tconst fallbackFont = (category && defaultFallbackFonts[category]) || defaultFallbackFonts[\"sans-serif\"]\n\n\tlet sizeAdjust: number\n\tif (azAvgWidth) {\n\t\tconst mainFontAvgWidth = azAvgWidth / unitsPerEm\n\t\tconst fallbackFontAvgWidth = fallbackFont.azAvgWidth / fallbackFont.unitsPerEm\n\t\tsizeAdjust = mainFontAvgWidth / fallbackFontAvgWidth\n\t} else {\n\t\tsizeAdjust = 1\n\t}\n\n\tconst ascentOverride = ascent / (unitsPerEm * sizeAdjust)\n\tconst descentOverride = descent / (unitsPerEm * sizeAdjust)\n\tconst lineGapOverride = lineGap / (unitsPerEm * sizeAdjust)\n\n\treturn {\n\t\tfallbackFontName: fallbackFont.name,\n\t\tascentOverride: formatOverrideValue(ascentOverride),\n\t\tdescentOverride: formatOverrideValue(descentOverride),\n\t\tlineGapOverride: formatOverrideValue(lineGapOverride),\n\t\tsizeAdjust: formatOverrideValue(sizeAdjust),\n\t}\n}\n\nfunction formatOverrideValue(value: number) {\n\treturn Math.abs(value * 100).toFixed(2) + \"%\"\n}\n\nexport async function getGoogleFontFallbackValues(fontFamilyName: string) {\n\tconst googleFontMetrics = await loadGoogleFontMetrics()\n\n\tconst fontMetrics: FontMetrics | undefined = googleFontMetrics[fontFamilyName]\n\t// Some Google Fonts might be newer than the ones we have metrics for.\n\tif (!fontMetrics) return\n\n\tconst fontFamily = fontStore.google.getFontFamilyByName(fontFamilyName)\n\t// If the project is not using any Google Fonts, just our own Inter, fontStore.google will be uninitialized. But we\n\t// might still want to look up the fallback values for Inter. So let's hard-code its category.\n\tconst fontCategory: FontCategory | undefined =\n\t\tfontFamilyName === \"Inter\" ? \"sans-serif\" : fontFamily?.fonts[0]?.category\n\n\treturn calculateSizeAdjustedFallbackValues(fontMetrics, fontCategory)\n}\n\nexport async function getFontshareFallbackValues(fontFamilyName: string) {\n\tconst fontshareFontMetrics = await loadFontshareFontMetrics()\n\n\tconst fontMetrics: FontMetrics | undefined = fontshareFontMetrics[fontFamilyName]\n\t// Some Fontshare fonts might be newer than the ones we have metrics for.\n\tif (!fontMetrics) return\n\n\tconst fontFamily = fontStore.fontshare.getFontFamilyByName(fontFamilyName)\n\tconst fontCategory = fontFamily?.fonts[0]?.category\n\n\treturn calculateSizeAdjustedFallbackValues(fontMetrics, fontCategory)\n}\n\nexport function getFramerFontFallbackValues(fontFamilyName: string) {\n\tconst framerFontMetrics = {\n\t\tInter: INTER_FONT_METRICS,\n\t\t\"Inter Display\": INTER_DISPLAY_FONT_METRICS,\n\t}\n\n\tconst fontMetrics: FontMetrics | undefined = framerFontMetrics[fontFamilyName]\n\tif (!fontMetrics) return\n\n\tconst fontFamily = fontStore.framer.getFontFamilyByName(fontFamilyName)\n\tconst fontCategory = fontFamily?.fonts[0]?.category\n\n\treturn calculateSizeAdjustedFallbackValues(fontMetrics, fontCategory)\n}\n\nexport function getCustomOrBuiltInFontFallbackValues(fontFamily: string, fontAssetURL: string, assetMap: AssetMap) {\n\tconst assetKey = fontAssetURL.split(\"/\").pop()?.split(\"~\")[0]\n\tif (!assetKey) return\n\n\tconst asset = assetMap.assetForKey(assetKey)\n\tif (!asset) return\n\n\tconst fontMetrics: FontMetrics | undefined = asset.properties?.font?.metrics as any\n\tif (!fontMetrics) return\n\n\tconst fontCategory = inferFontCategory(fontFamily)\n\n\treturn calculateSizeAdjustedFallbackValues(fontMetrics, fontCategory)\n}\n\nfunction loadGoogleFontMetrics(): Promise<{ [fontFamily: string]: FontMetrics }> {\n\t// Delay the import of the font metrics until we actually need them.\n\t// Otherwise, the first-load JS gets 20-40 (gzipped) KB larger.\n\treturn import(\"./font-metrics/google.json\", { with: { type: \"json\" } }).then(i => i.default)\n}\n\nfunction loadFontshareFontMetrics(): Promise<{ [fontFamily: string]: FontMetrics }> {\n\t// Delay the import of the font metrics until we actually need them.\n\t// Otherwise, the first-load JS gets 20-40 (gzipped) KB larger.\n\treturn import(\"./font-metrics/fontshare.json\", { with: { type: \"json\" } }).then(i => i.default)\n}\n", "import type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { HTMLTextTag } from \"document/models/CanvasTree/traits/WithHTMLTextTag.ts\"\nimport { defaultHTMLTextTag } from \"document/models/CanvasTree/traits/WithHTMLTextTag.ts\"\nimport type { OmitCSSDimension, WithTextStyle } from \"document/models/CanvasTree/traits/WithTextStyle.ts\"\nimport {\n\tisLetterSpacingUnit,\n\tisLineHeightUnit,\n\tisTextAlignment,\n\tisTextDecoration,\n\tisTextDecorationSkipInk,\n\tisTextDecorationStyle,\n\tisTextTransform,\n\tmigrateLetterSpacing,\n\ttextStrokeWidthToCSS,\n} from \"document/models/CanvasTree/traits/WithTextStyle.ts\"\nimport { type CSSDimension, parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { cssToOpenTypeFeatureTags, openTypeFeatureTagsToCSS } from \"document/models/CanvasTree/utils/openType.ts\"\nimport { parseAxesFromFontSelector } from \"document/models/CanvasTree/utils/variableFont.ts\"\nimport type { RawDraftContentBlock, RawDraftContentState, RawDraftInlineStyleRange, SelectionState } from \"draft-js\"\nimport { propsForLink } from \"library/modules/Link/propsForLink.tsx\"\nimport { isFramerPageLink } from \"library/modules/framerPageLink.ts\"\nimport { fontStore } from \"library/render/fonts/fontStore.ts\"\nimport type { FontCategory } from \"library/render/fonts/types.ts\"\nimport { FontSourceNames } from \"library/render/fonts/types.ts\"\nimport { RenderTarget } from \"library/render/types/RenderEnvironment.ts\"\nimport { escapeHTML } from \"library/render/utils/dom.ts\"\nimport type React from \"react\"\nimport { isNumber, isString } from \"utils/typeChecks.ts\"\nimport { TextStyleCustomProperty } from \"../prosemirror/styles.ts\"\nimport { cached } from \"../utils/cached.ts\"\nimport { inferFontCategory } from \"./inferFontCategory.ts\"\nimport type { Range } from \"./range.ts\"\nimport {\n\tgetRangeForCharacterIndex,\n\tgetSortedRange,\n\tisRangeCollapsed,\n\tisRangeCovered,\n\tisRangeOverlappingRange,\n} from \"./range.ts\"\nimport { getSizeAdjustedFallbackFontFamily, shouldGenerateSizeAdjustedFallback } from \"./sizeAdjustedFallback.ts\"\nimport type { TextDirection } from \"./types.ts\"\n\ninterface Options {\n\tlink?: string\n\thtmlTextTag?: HTMLTextTag\n}\n\n/** Cached version of {@link draftContentStateToHTMLConverter} */\nexport const draftContentStateToHTML: (content: RawDraftContentState, options?: Options) => string = cached(\n\t\"html\",\n\tdraftContentStateToHTMLConverter,\n)\n\nfunction anchorOpenTag(link: string, inlineStyle: string): string {\n\t// We only add the http prefix if the link doesn't already include a colon\n\t// _or_ is a link to an element on the same page. All valid links should\n\t// include a colon (e.g. mailto:).\n\tconst framerPageLink = isFramerPageLink(link)\n\tconst props = framerPageLink ? { href: link } : propsForLink(link)\n\n\treturn `<a style='${inlineStyle}' ${Object.entries(props)\n\t\t.map(([key, value]) => (value && isString(value) ? `${escapeHTML(key)}=\"${escapeHTML(value)}\"` : \"\"))\n\t\t.join(\" \")}>`\n}\n/**\n * Converts a RawDraftContentState to plain HTML\n * @param content - A {@link RawDraftContentState} representing a text draft\n */\nfunction draftContentStateToHTMLConverter(\n\tcontent: RawDraftContentState,\n\t{ link, htmlTextTag = defaultHTMLTextTag }: Options = {},\n): string {\n\tconst reactCSS: React.CSSProperties = {\n\t\twordWrap: \"inherit\", // Usually set by containing Text component\n\t\twhiteSpace: \"inherit\", // Usually set by containing Text component\n\t\ttabSize: 4, // NOTE: Matches value set in `stylesForHandoff`\n\t\tlineHeight: 0,\n\t\tfontSize: 0,\n\t}\n\n\tconst cssStyles = getStylesFromReact(reactCSS)\n\tconst inlineStyles = cssToString(cssStyles)\n\n\tif (isString(link) && link) {\n\t\tconst body = draftContentBlocksToHTML(content.blocks, true)\n\t\treturn `${anchorOpenTag(link, inlineStyles)}<${htmlTextTag}>${body}</${htmlTextTag}></a>`\n\t} else {\n\t\tconst body = draftContentBlocksToHTML(content.blocks, false)\n\t\treturn `<${htmlTextTag} style='${inlineStyles}'>${body}</${htmlTextTag}>`\n\t}\n}\n\nconst DraftPrefixes = {\n\tFONT: \"FONT:\",\n\tCOLOR: \"COLOR:\",\n\tSIZE: \"SIZE:\",\n\tLETTERSPACING: \"LETTERSPACING:\",\n\tLINEHEIGHT: \"LINEHEIGHT:\",\n\tALIGN: \"ALIGN:\",\n\tLINK: \"LINK:\",\n\tBOLD: \"BOLD:\",\n\tITALIC: \"ITALIC:\",\n\tUNDERLINE: \"UNDERLINE:\",\n\tSELECTION: \"SELECTION:\",\n\tTEXTDECORATION: \"TEXTDECORATION:\",\n\tTEXTTRANSFORM: \"TEXTTRANSFORM:\",\n\tTEXTSTROKEWIDTH: \"TEXTSTROKEWIDTH:\",\n\tTEXTSTROKECOLOR: \"TEXTSTROKECOLOR:\",\n}\n\ntype DraftPrefix = keyof typeof DraftPrefixes\n\n/**\n * A set of functions which define how to set a specific attribute of text\n * styling (font, color, size, etc.) to a CSSProperties object\n */\nexport interface StyleHandler<Value> {\n\tprefix: string\n\tdefault?: Value\n\tparseValue(raw: string): Exclude<Value, VariableReference | CSSDimension> | undefined\n\tsetCSS(value: Value, css: React.CSSProperties): void\n}\n\nfunction parseString(value: string) {\n\treturn value\n}\n\nfunction parseNumber(value: string) {\n\tconst number = parseFloat(value)\n\n\tif (Number.isFinite(number)) {\n\t\treturn number\n\t}\n\n\treturn undefined\n}\n\ntype DraftStyleDefinitions = {\n\t[Key in keyof WithTextStyle]: StyleHandler<OmitCSSDimension<WithTextStyle>[Key]>\n}\n\nexport const draftStyleDefinitions: DraftStyleDefinitions = {\n\tfont: {\n\t\tprefix: \"FONT:\",\n\t\tparseValue: parseString,\n\t\tsetCSS(value, css) {\n\t\t\tif (value === undefined) return\n\t\t\tconst style = getFontStyleProperties(value)\n\t\t\tcss[TextStyleCustomProperty.FontFamily] = style.fontFamily\n\t\t\tcss[TextStyleCustomProperty.FontStyle] = style.fontStyle\n\t\t\tcss[TextStyleCustomProperty.FontWeight] = style.fontWeight\n\t\t\tcss[TextStyleCustomProperty.FontVariationAxes] = style.fontVariationAxes\n\t\t},\n\t},\n\ttextColor: {\n\t\tprefix: \"COLOR:\",\n\t\tparseValue: parseString,\n\t\tsetCSS(value, css) {\n\t\t\tif (isVariableReference(value)) return\n\t\t\tcss[TextStyleCustomProperty.TextColor] = value\n\t\t},\n\t},\n\ttextBackgroundColor: {\n\t\tprefix: \"TEXTBACKGROUNDCOLOR:\",\n\t\tparseValue: parseString,\n\t\tsetCSS(value, css) {\n\t\t\tif (isVariableReference(value)) return\n\t\t\tcss[TextStyleCustomProperty.TextBackgroundColor] = value\n\t\t},\n\t},\n\ttextBackgroundRadius: {\n\t\tprefix: \"TEXTBACKGROUNDRADIUS:\",\n\t\t// Text background radius is not supported in text\n\t\tparseValue: () => undefined,\n\t\tsetCSS() {},\n\t},\n\ttextBackgroundCornerShape: {\n\t\tprefix: \"TEXTBACKGROUNDCORNERSHAPE:\",\n\t\t// Text background corner shape is not supported in text\n\t\tparseValue: () => undefined,\n\t\tsetCSS() {},\n\t},\n\ttextBackgroundPadding: {\n\t\tprefix: \"TEXTBACKGROUNDPADDING:\",\n\t\t// Text background padding is not supported in text\n\t\tparseValue: () => undefined,\n\t\tsetCSS() {},\n\t},\n\tfontSize: {\n\t\tprefix: \"SIZE:\",\n\t\tparseValue: parseNumber,\n\t\tsetCSS(value, css) {\n\t\t\tcss[TextStyleCustomProperty.FontSize] = value + \"px\"\n\t\t},\n\t},\n\tletterSpacing: {\n\t\tprefix: \"LETTERSPACING:\",\n\t\tparseValue(letterSpacing) {\n\t\t\tconst [value, unit = \"px\"] = parseCSSDimension(letterSpacing)\n\t\t\tif (!Number.isNaN(value) && isLetterSpacingUnit(unit)) {\n\t\t\t\treturn [value, unit]\n\t\t\t}\n\t\t\treturn undefined\n\t\t},\n\t\tsetCSS(value, css) {\n\t\t\tcss[TextStyleCustomProperty.LetterSpacing] = migrateLetterSpacing(value).join(\"\")\n\t\t},\n\t},\n\ttextTransform: {\n\t\tprefix: \"TEXTTRANSFORM:\",\n\t\tparseValue(textTransform) {\n\t\t\ttextTransform = textTransform.toLowerCase()\n\n\t\t\tif (isTextTransform(textTransform)) {\n\t\t\t\treturn textTransform\n\t\t\t}\n\n\t\t\treturn undefined\n\t\t},\n\t\tsetCSS(value, css) {\n\t\t\tcss[TextStyleCustomProperty.TextTransform] = value\n\t\t},\n\t},\n\ttextDecoration: {\n\t\tprefix: \"TEXTDECORATION:\",\n\t\tparseValue(textDecoration) {\n\t\t\ttextDecoration = textDecoration.toLowerCase()\n\n\t\t\tif (isTextDecoration(textDecoration)) {\n\t\t\t\treturn textDecoration\n\t\t\t}\n\n\t\t\treturn undefined\n\t\t},\n\t\tsetCSS(value, css) {\n\t\t\tcss[TextStyleCustomProperty.TextDecoration] = value\n\t\t},\n\t},\n\ttextDecorationColor: {\n\t\tprefix: \"TEXTDECORATIONCOLOR:\",\n\t\tparseValue(textDecorationColor) {\n\t\t\tif (isString(textDecorationColor)) {\n\t\t\t\treturn textDecorationColor\n\t\t\t}\n\t\t\treturn undefined\n\t\t},\n\t\tsetCSS(value, css) {\n\t\t\tcss[TextStyleCustomProperty.TextDecorationColor] = value\n\t\t},\n\t},\n\ttextDecorationThickness: {\n\t\tprefix: \"TEXTDECORATIONTHICKNESS:\",\n\t\tparseValue() {\n\t\t\treturn \"auto\"\n\t\t},\n\t\tsetCSS(value, css) {\n\t\t\tcss[TextStyleCustomProperty.TextDecorationThickness] = value\n\t\t},\n\t},\n\ttextDecorationOffset: {\n\t\tprefix: \"TEXTDECORATIONOFFSET:\",\n\t\tparseValue() {\n\t\t\treturn \"auto\"\n\t\t},\n\t\tsetCSS(value, css) {\n\t\t\tcss[TextStyleCustomProperty.TextDecorationOffset] = value\n\t\t},\n\t},\n\ttextDecorationSkipInk: {\n\t\tprefix: \"TEXTDECORATIONSKIPINK:\",\n\t\tparseValue(textDecorationSkipInk) {\n\t\t\tif (isTextDecorationSkipInk(textDecorationSkipInk)) {\n\t\t\t\treturn textDecorationSkipInk\n\t\t\t}\n\t\t\treturn undefined\n\t\t},\n\t\tsetCSS(value, css) {\n\t\t\tcss[TextStyleCustomProperty.TextDecorationSkipInk] = value\n\t\t},\n\t},\n\ttextDecorationStyle: {\n\t\tprefix: \"TEXTDECORATIONSTYLE:\",\n\t\tparseValue(textDecorationStyle) {\n\t\t\tif (isTextDecorationStyle(textDecorationStyle)) {\n\t\t\t\treturn textDecorationStyle\n\t\t\t}\n\t\t\treturn undefined\n\t\t},\n\t\tsetCSS(value, css) {\n\t\t\tcss[TextStyleCustomProperty.TextDecorationStyle] = value\n\t\t},\n\t},\n\tlineHeight: {\n\t\tprefix: \"LINEHEIGHT:\",\n\t\tparseValue(lineHeight) {\n\t\t\tconst [value, unit = \"em\"] = parseCSSDimension(lineHeight)\n\t\t\tif (!Number.isNaN(value) && isLineHeightUnit(unit)) {\n\t\t\t\treturn [value, unit]\n\t\t\t}\n\t\t\treturn undefined\n\t\t},\n\t\tsetCSS(value, css) {\n\t\t\tcss[TextStyleCustomProperty.LineHeight] = value.join(\"\")\n\t\t},\n\t},\n\ttextAlignment: {\n\t\tprefix: \"ALIGN:\",\n\t\tparseValue(textAlignment) {\n\t\t\ttextAlignment = textAlignment.toLowerCase()\n\n\t\t\tif (isTextAlignment(textAlignment)) {\n\t\t\t\treturn textAlignment\n\t\t\t}\n\n\t\t\treturn undefined\n\t\t},\n\t\tsetCSS(value, css) {\n\t\t\tcss[TextStyleCustomProperty.TextAlignment] = value\n\t\t},\n\t},\n\ttextStrokeWidth: {\n\t\tprefix: \"TEXTSTROKEWIDTH:\",\n\t\tparseValue(textStrokeWidth) {\n\t\t\tif (isNumber(textStrokeWidth)) {\n\t\t\t\treturn textStrokeWidth\n\t\t\t}\n\n\t\t\treturn undefined\n\t\t},\n\t\tsetCSS(value, css) {\n\t\t\tcss[TextStyleCustomProperty.TextStrokeWidth] = textStrokeWidthToCSS(value)\n\t\t},\n\t},\n\ttextStrokeColor: {\n\t\tprefix: \"TEXTSTROKECOLOR:\",\n\t\tparseValue(textStrokeColor) {\n\t\t\tif (isString(textStrokeColor)) {\n\t\t\t\treturn textStrokeColor\n\t\t\t}\n\t\t\treturn undefined\n\t\t},\n\t\tsetCSS(value, css) {\n\t\t\tcss[TextStyleCustomProperty.TextStrokeColor] = value\n\t\t},\n\t},\n\topenTypeFontFeatures: {\n\t\tprefix: \"OPENTYPEFONTFEATURES:\",\n\t\tparseValue(value) {\n\t\t\treturn cssToOpenTypeFeatureTags(value)\n\t\t},\n\t\tsetCSS(value, css) {\n\t\t\tcss[TextStyleCustomProperty.FontOpenTypeFeatures] = openTypeFeatureTagsToCSS(value)\n\t\t},\n\t},\n}\n\nfunction draftContentBlocksToHTML(blocks: RawDraftContentBlock[], ignoreLinks: boolean): string {\n\tlet body = \"\"\n\tfor (const block of blocks) {\n\t\tbody += draftContentBlockToHTML(block, ignoreLinks)\n\t}\n\treturn body\n}\n\n/**\n * Convert a block of Draft to html.\n */\nfunction draftContentBlockToHTML(block: RawDraftContentBlock, ignoreLinks: boolean): string {\n\tif (!block.text.length) {\n\t\tconst css = { width: \"auto\", ...getReactStylesFromDraft([]) }\n\t\tconst style = cssToString(getStylesFromReact(css))\n\t\treturn `<span><span style='${style}'><br></span></span>`\n\t}\n\n\tconst chunkIndexes = new Set([0, block.text.length])\n\n\tfor (const style of block.inlineStyleRanges) {\n\t\tchunkIndexes.add(style.offset)\n\t\tchunkIndexes.add(style.offset + style.length)\n\t}\n\n\tconst html: string[] = []\n\n\tconst characters = block.text.split(\"\")\n\n\tlet lastWasLink = false\n\n\tfor (const [index, character] of characters.entries()) {\n\t\tif (chunkIndexes.has(index)) {\n\t\t\tconst range = getRangeForCharacterIndex(index)\n\t\t\tconst draftStyles = getDraftBlockStylesInRange(block, range)\n\t\t\tconst css = getReactStylesFromDraft(draftStyles)\n\t\t\tconst styles = getStylesFromReact(css)\n\n\t\t\tconst linkStyle = draftStyles.find(style => style.startsWith(\"LINK:\"))\n\n\t\t\tif (index > 0) {\n\t\t\t\thtml.push(lastWasLink ? \"</a>\" : \"</span>\")\n\t\t\t}\n\n\t\t\tconst inlineStyle = cssToString(styles)\n\t\t\tlastWasLink = false\n\n\t\t\tif (linkStyle && !ignoreLinks) {\n\t\t\t\tlastWasLink = true\n\t\t\t\tconst link = linkStyle.slice(\"LINK:\".length)\n\t\t\t\tconst openTag = anchorOpenTag(link, inlineStyle)\n\t\t\t\thtml.push(openTag)\n\t\t\t} else {\n\t\t\t\thtml.push(`<span style='${inlineStyle}'>`)\n\t\t\t}\n\t\t}\n\n\t\thtml.push(escapeHTML(character))\n\t}\n\n\thtml.push(lastWasLink ? \"</a>\" : \"</span>\")\n\n\tconst blockDraftStyles = getDraftBlockStylesInRange(block, [0, block.text.length])\n\n\tconst blockStyles = getStylesFromReact({\n\t\tfontSize: 0,\n\t\t...getReactStylesFromDraft(blockDraftStyles, true),\n\t\t...getReactStylesForTextDirection(block.data?.direction),\n\t})\n\n\treturn `<span style='${cssToString(blockStyles)}'>${html.join(\"\")}<br></span>`\n}\n\nexport function getDraftRange(content: RawDraftContentState): Range {\n\tconst textLength = getDraftText(content).length\n\treturn [0, textLength - 1]\n}\n\n/**\n * Return the plain text for a given draft data structure, with an optional delimiter.\n */\nexport function getDraftText(content: RawDraftContentState, delimiter = \"\") {\n\treturn content.blocks.map(block => block.text).join(delimiter)\n}\n\n/**\n * Returns the range for the style to insert at the next caret insertion. This is always the previous character, except for the beginning (first character) and beyond the last character (last character)\n */\nfunction getCharacterRangeAtIndex(content: RawDraftContentState, index: number): Range {\n\tconst text = getDraftText(content)\n\tif (index === 0) return [0, 1]\n\tif (index > text.length) return getCharacterRangeAtIndex(content, text.length)\n\treturn [index - 1, index]\n}\n\ntype RawDraftInlineStyleRangeWithIndex = RawDraftInlineStyleRange & { index: number }\n\n/**\n * Return all the draft styles in this text range. If the range is collapsed, we assume it's the caret position.\n */\nfunction getDraftStyleRangesWithPrefix(\n\tcontent: RawDraftContentState,\n\tprefix?: DraftPrefix,\n\trange?: Range,\n\tstopAtFirst = false,\n\tmodify?: (inlineStyle: RawDraftInlineStyleRangeWithIndex) => RawDraftInlineStyleRange,\n): RawDraftInlineStyleRangeWithIndex[] {\n\t// Use the full range if no range was given\n\trange = range || getDraftRange(content)\n\n\t// If this range is collapsed, we assume we are dealing with the caret position\n\tif (isRangeCollapsed(range)) {\n\t\trange = getCharacterRangeAtIndex(content, range[0])\n\t}\n\n\t// Make sure the range is sorted\n\trange = getSortedRange(range)\n\n\tlet blockRangeIndex = 0\n\tconst results: RawDraftInlineStyleRangeWithIndex[] = []\n\tfor (const block of content.blocks) {\n\t\tif (block.text.length === 0) continue\n\t\t// We can stop if the block range exceeds the requested range\n\t\tif (blockRangeIndex > Math.max(...range)) return results\n\n\t\tfor (const [inlineStyleIndex, inlineStyle] of block.inlineStyleRanges.entries()) {\n\t\t\t// If a prefix filter was given, skip if this is not a match\n\t\t\tif (prefix && !inlineStyle.style.startsWith(prefix)) continue\n\n\t\t\t// Calcluate the range for this inline style so we can compare it\n\t\t\tconst inlineStyleRangeIndex = blockRangeIndex + inlineStyle.offset\n\t\t\tconst inlineStyleRange: Range = [inlineStyleRangeIndex, inlineStyleRangeIndex + inlineStyle.length]\n\n\t\t\t// See if the requested range overlaps with this style range and add to results\n\t\t\tif (isRangeOverlappingRange(range, inlineStyleRange)) {\n\t\t\t\tconst inlineStyleWithIndex = { index: inlineStyleRangeIndex, ...inlineStyle }\n\n\t\t\t\tresults.push(inlineStyleWithIndex)\n\n\t\t\t\tif (modify) {\n\t\t\t\t\tblock.inlineStyleRanges[inlineStyleIndex] = modify(inlineStyleWithIndex)\n\t\t\t\t}\n\n\t\t\t\t// If we're just looking for a first match, we can stop here\n\t\t\t\tif (stopAtFirst) break\n\t\t\t}\n\t\t}\n\t\tblockRangeIndex += block.text.length\n\t}\n\n\treturn results\n}\n\ninterface FontStyles {\n\tfontFamily: string\n\tfontWeight: number\n\tfontStyle: string\n\tfontVariationAxes: string\n}\n\n// `value` can be:\n//\n// - a selector\n// - a font family (i.e., selector for FontSourceNames.Local)\n// - an alias (__Something__) (when/why?)\n// - a |-separated list of selectors (when/why?)\n//\n// If you know the answers to any of these, please update this comment!\nexport function getFontStyleProperties(initialValue: string): Partial<FontStyles> {\n\tconst result: Partial<FontStyles> = {}\n\n\tconst { selector: fontSelector, axesCSS } = parseAxesFromFontSelector(initialValue)\n\tresult.fontVariationAxes = axesCSS\n\n\tlet value = fontSelector\n\n\tlet selectors: string[] = []\n\tlet selector = \"\"\n\tlet alias = \"\"\n\n\t// Styled text will have the alias set as \"value\". See if this is the case:\n\tif (fontStore.local.isFontFamilyAlias(value)) {\n\t\talias = value\n\t\t// The value is an alias. Resolve it to the full selector:\n\t\tvalue = fontStore.local.getFontSelectorByAlias(value) || \"\"\n\t}\n\n\tconst fontFamily = fontStore.getFontFamily({ source: FontSourceNames.Local, name: value })\n\tconst firstFontFamily = fontFamily?.fonts[0]\n\tif (firstFontFamily) {\n\t\t// Try to match by an exact selector since taking fontFamily.fonts[0]\n\t\t// relies on the order of fonts, which may arrive in a different order\n\t\tconst font = fontFamily.fonts.find(t => t.selector === value) || firstFontFamily\n\t\tselector = font.selector\n\t}\n\tif (selector) {\n\t\t// An alias comes in at this level for the font selector. See if this is the case:\n\t\tif (fontStore.local.isFontFamilyAlias(selector)) {\n\t\t\t// The value is an alias. Resolve it to the full selector:\n\t\t\tselector = fontStore.local.getFontSelectorByAlias(selector) || \"\"\n\t\t}\n\n\t\tselectors = selector.split(\"|\")\n\t}\n\n\tif (!selector) {\n\t\tselectors = value.split(\"|\")\n\t\tconst fontProperties = fontStore.getDraftPropertiesBySelector(alias || value)\n\n\t\tif (fontProperties) {\n\t\t\tresult.fontWeight = fontProperties.weight\n\t\t\tresult.fontStyle = fontProperties.style\n\n\t\t\tif (!selectors.includes(fontProperties.cssFamilyName)) {\n\t\t\t\tselectors.push(fontProperties.cssFamilyName)\n\t\t\t}\n\t\t}\n\t}\n\n\tconst fontFamilies = new Set<string>()\n\tlet fontCategoryForGenericFallback: FontCategory | undefined\n\n\tfor (const selector of selectors) {\n\t\tconst fontProperties = fontStore.getDraftPropertiesBySelector(selector)\n\t\tif (!fontProperties) {\n\t\t\tfontFamilies.add(selector)\n\t\t\tfontCategoryForGenericFallback ??= inferFontCategory(selector)\n\t\t\tcontinue\n\t\t}\n\n\t\tconst cssFamilyName = fontProperties.source !== FontSourceNames.Local ? fontProperties.cssFamilyName : selector\n\t\tconst fontWeightString = result.fontWeight !== undefined ? String(result.fontWeight) : undefined\n\t\tconst fontCategory = fontProperties.category || inferFontCategory(cssFamilyName)\n\n\t\tfontFamilies.add(cssFamilyName)\n\t\tfontCategoryForGenericFallback ??= fontCategory\n\n\t\tif (shouldGenerateSizeAdjustedFallback(fontProperties.source, fontWeightString, fontCategory)) {\n\t\t\tconst fallbackFontFamily = getSizeAdjustedFallbackFontFamily(cssFamilyName)\n\t\t\tfontFamilies.add(fallbackFontFamily)\n\t\t}\n\t}\n\n\tresult.fontFamily = Array.from(fontFamilies).map(quoteFontFamilyIfNeeded).join(\", \")\n\n\tconst genericFallbackPerCategory: Record<FontCategory, string> = {\n\t\tserif: \"serif\",\n\t\t\"sans-serif\": \"sans-serif\",\n\t\tslab: \"serif\",\n\t\tmonospace: \"monospace\",\n\t\tdisplay: \"sans-serif\",\n\t\thandwriting: \"sans-serif\",\n\t}\n\tresult.fontFamily +=\n\t\t\", \" + (fontCategoryForGenericFallback ? genericFallbackPerCategory[fontCategoryForGenericFallback] : \"sans-serif\")\n\n\treturn result\n}\n\n/** These font families should never be quoted in css, if they do they won't have any effect */\nconst GENERIC_FAMILIES = [\"cursive\", \"fantasy\", \"monospace\", \"serif\", \"sans-serif\"]\n\nfunction quoteFontFamilyIfNeeded(s: string): string {\n\treturn GENERIC_FAMILIES.includes(s) ? s : `\"${s}\"`\n}\n\n/**\n * Convert React styles to a regular css style object (camel case to dash case)\n */\nfunction getStylesFromReact(reactCSS: React.CSSProperties): Record<string, string | number | undefined> {\n\tconst css: Record<string, string | number | undefined> = {}\n\n\t// We sort the keys for consistent results, I know you technically can't sort object keys, but practically you totally can.\n\tconst keys = Object.keys(reactCSS).sort()\n\n\tfor (const key of keys) {\n\t\tif (typeof key !== \"string\") continue\n\n\t\t// Convert key to dash case\n\t\tlet property = key.replace(/([a-zA-Z])(?=[A-Z])/gu, \"$1-\").toLowerCase()\n\n\t\tif (property.startsWith(\"webkit\")) {\n\t\t\tproperty = `-${property}`\n\t\t}\n\n\t\tcss[property] = reactCSS[key as keyof typeof reactCSS]\n\t}\n\n\treturn css\n}\n\nfunction getDraftBlockStylesInRange(block: RawDraftContentBlock, range: Range) {\n\treturn block.inlineStyleRanges\n\t\t.filter(inlineStyle => isRangeOverlappingRange(getDraftBlockInlineStyleRange(inlineStyle), range))\n\t\t.map(styleRange => styleRange.style)\n}\n\nfunction getDraftBlockInlineStyleRange(inlineStyle: RawDraftInlineStyleRange): Range {\n\treturn [inlineStyle.offset, inlineStyle.offset + inlineStyle.length]\n}\n\nfunction getReactStylesForTextDirection(direction: TextDirection): React.CSSProperties {\n\tif (direction === \"ltr\") return { direction: \"ltr\" }\n\tif (direction === \"rtl\") return { direction: \"rtl\", textAlign: \"right\" }\n\treturn {}\n}\n\nexport function getDraftStylesWithPrefixCoverRange(\n\tcontent: RawDraftContentState,\n\tprefixes: DraftPrefix[],\n\trange?: Range,\n) {\n\trange = range || getDraftRange(content)\n\n\tfor (const prefix of prefixes) {\n\t\tconst inlineStyleRanges = getDraftStyleRangesWithPrefix(content, prefix)\n\t\tconst ranges: Range[] = inlineStyleRanges.map(inlineStyleRange => [\n\t\t\tinlineStyleRange.index,\n\t\t\tinlineStyleRange.index + inlineStyleRange.length,\n\t\t])\n\t\tif (!isRangeCovered(range, ranges)) return false\n\t}\n\n\treturn true\n}\n\n/**\n * Return the draft styles filtered by a specific prefix for an optional character range.\n */\nexport function getDraftStylesWithPrefix(\n\tcontent: RawDraftContentState,\n\tprefix?: DraftPrefix,\n\trange?: Range,\n\tstopAtFirst = false,\n): string[] {\n\treturn getDraftStyleRangesWithPrefix(content, prefix, range, stopAtFirst).map(styleRange => styleRange.style)\n}\n\n/**\n * Return the text range for a give draft block by key.\n */\nfunction getDraftBlockRange(content: RawDraftContentState, key: string): Range | undefined {\n\tlet position = 0\n\n\tfor (const block of content.blocks) {\n\t\tif (block.key === key) {\n\t\t\treturn [position, position + block.text.length]\n\t\t}\n\n\t\tposition += block.text.length\n\t}\n}\n\n/**\n * Return the text range for a give draft selection object.\n */\nexport function getDraftRangeFromSelection(\n\tcontent: RawDraftContentState,\n\tselection: SelectionState,\n): Range | undefined {\n\tconst anchorKey = selection.getAnchorKey()\n\tconst anchorRange = getDraftBlockRange(content, anchorKey)\n\n\tconst focusKey = selection.getFocusKey()\n\tconst focusRange = getDraftBlockRange(content, focusKey)\n\n\tif (anchorRange && focusRange) {\n\t\tconst anchor = anchorRange[0] + selection.getAnchorOffset()\n\t\tconst focus = focusRange[0] + selection.getFocusOffset()\n\n\t\treturn anchor < focus ? [anchor, focus] : [focus, anchor]\n\t}\n}\n\n/**\n * Return a new draft content structure with the given text and styles applied.\n */\nexport function getDraftContent(text: string = \"\", styles: string[] = []): RawDraftContentState {\n\treturn {\n\t\tblocks: text.split(\"\\n\").map(line => getDraftContentBlock(line, styles)),\n\t\tentityMap: {},\n\t}\n}\n\nexport function getDraftContentDefaultEmptyText() {\n\treturn {\n\t\tblocks: [getDraftContentBlock(\"\", [], \"dflt0\")],\n\t\tentityMap: {},\n\t}\n}\n\nfunction randomString(n: number, characters = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\") {\n\tlet result = \"\"\n\tconst charactersLength = characters.length\n\tfor (let i = 0; i < n; i++) {\n\t\tresult += characters.charAt(Math.floor(Math.random() * charactersLength))\n\t}\n\treturn result\n}\n\n/**\n * Return a new draft content block with the given text and styles applied.\n */\nfunction getDraftContentBlock(text: string, styles: string[], key?: string): RawDraftContentBlock {\n\treturn {\n\t\t// TODO: could this just be an ever incrementing number instead?\n\t\tkey: key ?? randomString(5),\n\t\ttext: text,\n\t\ttype: \"unstyled\",\n\t\tdepth: 0,\n\t\tinlineStyleRanges: styles.map(\n\t\t\tstyle =>\n\t\t\t\t({\n\t\t\t\t\toffset: 0,\n\t\t\t\t\tlength: text.length,\n\t\t\t\t\tstyle: style,\n\t\t\t\t}) as any,\n\t\t),\n\t\tentityRanges: [],\n\t\tdata: {},\n\t}\n}\n\n// Style queries and changes\n\nfunction isBlockStyle(key: keyof WithTextStyle) {\n\treturn key === \"textAlignment\" || key === \"lineHeight\"\n}\n\nfunction getReactStylesFromDraft(\n\tdraftStyles: string[],\n\treturnBlockStyles = false,\n\tisDraftJS = false,\n\tisLink = false,\n\tlinkMatchesCurrentRoute = false,\n): React.CSSProperties {\n\tconst styles: React.CSSProperties = {}\n\tconst draftStylesMap = new Map<string, string>()\n\n\t// DraftJS is automatically setting these properties\n\tstyles.fontStyle = undefined\n\tstyles.fontWeight = undefined\n\n\tfor (const style of draftStyles) {\n\t\tconst colonIndex = style.indexOf(\":\")\n\t\tconst prefixLength = colonIndex < 0 ? style.length : colonIndex\n\n\t\tconst prefix = style.slice(0, prefixLength)\n\t\tconst value = style.slice(prefixLength + 1)\n\n\t\tdraftStylesMap.set(prefix, value)\n\t}\n\n\tfor (const key in draftStyleDefinitions) {\n\t\tconst styleHandler: StyleHandler<unknown> = draftStyleDefinitions[key as keyof typeof draftStyleDefinitions]\n\n\t\tif (isBlockStyle(key as keyof WithTextStyle) !== returnBlockStyles) continue\n\n\t\tconst prefix = styleHandler.prefix.slice(0, -1)\n\t\tconst rawValue = draftStylesMap.get(prefix)\n\n\t\tlet parsedValue: unknown | undefined\n\t\tif (rawValue !== undefined) {\n\t\t\tparsedValue = styleHandler.parseValue(rawValue)\n\t\t}\n\n\t\tif (parsedValue !== undefined) {\n\t\t\tstyleHandler.setCSS(parsedValue, styles)\n\t\t}\n\t}\n\n\tif (!returnBlockStyles) {\n\t\tif (draftStylesMap.has(\"BOLD\")) {\n\t\t\tstyles[\"--framer-font-weight-increase\"] = 300\n\t\t}\n\n\t\tif (draftStylesMap.has(\"ITALIC\")) {\n\t\t\tstyles[TextStyleCustomProperty.FontStyle] = \"italic\"\n\t\t}\n\n\t\tif (RenderTarget.current() === RenderTarget.canvas && draftStylesMap.has(\"SELECTION\")) {\n\t\t\t// TODO: This should really not be a static value here, but that's how I found it\n\t\t\tstyles.backgroundColor = \"rgba(128,128,128,0.33)\"\n\t\t}\n\n\t\t// This is only needed inside DraftJS\n\t\tif ((draftStylesMap.has(\"LINK\") || isLink) && isDraftJS) {\n\t\t\tif (linkMatchesCurrentRoute) {\n\t\t\t\tstyles[\"--font-weight\"] =\n\t\t\t\t\t\"var(--framer-link-current-font-weight, var(--framer-link-font-weight, var(--framer-font-weight))\"\n\t\t\t\tstyles[\"--font-family\"] =\n\t\t\t\t\t\"var(--framer-link-current-font-family, var(--framer-link-font-family, var(--framer-font-family))\"\n\t\t\t\tstyles[\"--font-style\"] =\n\t\t\t\t\t\"var(--framer-link-current-font-style, var(--framer-link-font-style, var(--framer-font-style))\"\n\t\t\t\tstyles[\"--text-color\"] =\n\t\t\t\t\t\"var(--framer-link-current-text-color, var(--framer-link-text-color, var(--framer-text-color))\"\n\t\t\t\tstyles[\"--font-size\"] =\n\t\t\t\t\t\"var(--framer-link-current-font-size, var(--framer-link-font-size, var(--framer-font-size))\"\n\t\t\t\tstyles[\"--text-transform\"] =\n\t\t\t\t\t\"var(--framer-link-current-text-transform, var(--framer-link-text-transform, var(--framer-text-transform))\"\n\t\t\t\tstyles[\"--text-decoration\"] =\n\t\t\t\t\t\"var(--framer-link-current-text-decoration, var(--framer-link-text-decoration, var(--framer-text-decoration))\"\n\t\t\t} else {\n\t\t\t\tstyles[\"--font-weight\"] = \"var(--framer-link-font-weight, var(--framer-font-weight))\"\n\t\t\t\tstyles[\"--font-family\"] = \"var(--framer-link-font-family, var(--framer-font-family))\"\n\t\t\t\tstyles[\"--font-style\"] = \"var(--framer-link-font-style, var(--framer-font-style))\"\n\t\t\t\tstyles[\"--text-color\"] = \"var(--framer-link-text-color, var(--framer-text-color))\"\n\t\t\t\tstyles[\"--font-size\"] = \"var(--framer-link-font-size, var(--framer-font-size))\"\n\t\t\t\tstyles[\"--text-transform\"] = \"var(--framer-link-text-transform, var(--framer-text-transform))\"\n\t\t\t\tstyles[\"--text-decoration\"] = \"var(--framer-link-text-decoration, var(--framer-text-decoration))\"\n\t\t\t\tstyles[\"--text-decoration-color\"] =\n\t\t\t\t\t\"var(--framer-link-text-decoration-color, var(--framer-text-decoration-color))\"\n\t\t\t\tstyles[\"--text-decoration-thickness\"] =\n\t\t\t\t\t\"var(--framer-link-text-decoration-thickness, var(--framer-text-decoration-thickness))\"\n\t\t\t\tstyles[\"--text-decoration-offset\"] =\n\t\t\t\t\t\"var(--framer-link-text-decoration-offset, var(--framer-text-decoration-offset))\"\n\t\t\t\tstyles[\"--text-decoration-skip-ink\"] =\n\t\t\t\t\t\"var(--framer-link-text-decoration-skip-ink, var(--framer-text-decoration-skip-ink))\"\n\t\t\t\tstyles[\"--text-decoration-style\"] =\n\t\t\t\t\t\"var(--framer-link-text-decoration-style, var(--framer-text-decoration-style))\"\n\t\t\t}\n\t\t}\n\t}\n\n\treturn styles\n}\n\n/**\n * Convert an object with css properties to an inline string to insert in html\n */\nfunction cssToString(css: Record<string, string | number | undefined>): string {\n\tconst inline = Object.keys(css)\n\t\t// Ignore undefined and null values\n\t\t.filter(k => css[k] !== undefined && css[k] !== null)\n\t\t// Convert to inline key:value style string\n\t\t.map(k => `${k}: ${css[k]}`)\n\t\t.join(\"; \")\n\treturn escapeHTML(inline)\n}\n", "import type { FontSelector } from \"library/render/fonts/types.ts\"\nimport type { FontControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport { serializeRemFontSizeCalcString } from \"prosemirror/variables.ts\"\nimport { getFontStyleProperties } from \"text\"\nimport { isNumber, isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type {\n\tFontSizeCSSDimension,\n\tLetterSpacing,\n\tLineHeight,\n\tTextAlignment,\n} from \"../CanvasTree/traits/WithTextStyle.ts\"\nimport {\n\tisFontSizeCSSDimension,\n\tisLetterSpacing,\n\tisLineHeight,\n\tisTextAlignment,\n\tmigrateLetterSpacing,\n\ttextStyleDefaults,\n\ttoFontSizeCSSDimensionString,\n} from \"../CanvasTree/traits/WithTextStyle.ts\"\nimport { parseCSSDimension } from \"../CanvasTree/traits/utils/CSSDimension.ts\"\nimport type { OpenTypeFontFeatures } from \"../CanvasTree/utils/openType.ts\"\nimport { openTypeFeatureTagsToCSS } from \"../CanvasTree/utils/openType.ts\"\nimport type { VariationAxesToValues } from \"../CanvasTree/utils/variableFont.ts\"\n\ninterface RawFontValue {\n\tfontSelector: FontSelector\n\tlineHeight?: LineHeight\n\t// We keep the `number` fontSize type to avoid a migration. During rendering and updating, we use\n\t// toFontSizeCSSDimensionString to populate the value with a unit for consistency.\n\tfontSize?: number | FontSizeCSSDimension\n\ttextAlignment?: TextAlignment\n\t// We keep the `number` letterSpacing type to avoid a migration. During rendering and updating, we use\n\t// migrateLetterSpacing to populate the value with a unit for consistency.\n\tletterSpacing?: number | LetterSpacing\n\topenTypeFontFeatures?: OpenTypeFontFeatures\n\tvariationAxes?: VariationAxesToValues\n}\n\nexport interface FontValue extends RawFontValue {\n\tfontSize?: FontSizeCSSDimension\n\tletterSpacing?: LetterSpacing\n\tvariationAxes?: VariationAxesToValues\n}\n\nconst fontSelectorKey: keyof FontValue = \"fontSelector\"\nconst fontSizeKey: keyof FontValue = \"fontSize\"\nconst lineHeightKey: keyof FontValue = \"lineHeight\"\nconst textAlignmentKey: keyof FontValue = \"textAlignment\"\nconst letterSpacingKey: keyof FontValue = \"letterSpacing\"\n\nexport type FontControlPropRawValue = undefined | RawFontValue\nexport type FontControlPropValue = undefined | FontValue\n\nexport function defaultFontValuesForOptionalKeys(\n\tcontrol: FontControlDescription,\n\tcurrentValue: RawFontValue,\n): FontValue {\n\tconst defaults = control.defaultValue ?? {}\n\tconst result: FontValue = {\n\t\tfontSelector: currentValue.fontSelector,\n\t}\n\n\tif (control.displayFontSize) {\n\t\tresult.fontSize = result.fontSize = isUndefined(currentValue.fontSize)\n\t\t\t? toFontSizeCSSDimensionString(defaults?.fontSize ?? 16)\n\t\t\t: toFontSizeCSSDimensionString(currentValue.fontSize)\n\t}\n\n\tif (control.displayTextAlignment) {\n\t\t// To better support RTL we don't set a textAlignment default. See discussion here:\n\t\t// https://github.com/framer/FramerStudio/pull/14192#discussion_r1173447347\n\t\tconst defaultTextAlignment = isString(defaults.textAlign) ? defaults.textAlign : undefined\n\t\tresult.textAlignment = isString(currentValue.textAlignment) ? currentValue.textAlignment : defaultTextAlignment\n\t}\n\n\tif (control.controls === \"extended\") {\n\t\t// We do a run-time migration for letter spacing to populate the unit if it doesn't have one.\n\t\tconst defaultLetterSpacing = getDefaultLetterSpacing(defaults.letterSpacing)\n\n\t\tconst currentLetterSpacing = currentValue.letterSpacing\n\t\tconst migratedLetterSpacing = isUndefined(currentLetterSpacing)\n\t\t\t? defaultLetterSpacing\n\t\t\t: migrateLetterSpacing(currentLetterSpacing)\n\n\t\tresult.letterSpacing = isLetterSpacing(migratedLetterSpacing)\n\t\t\t? migratedLetterSpacing\n\t\t\t: textStyleDefaults.letterSpacing\n\n\t\tconst defaultLineHeight: LineHeight = getDefaultLineHeight(defaults.lineHeight)\n\t\tresult.lineHeight = isLineHeight(currentValue.lineHeight) ? currentValue.lineHeight : defaultLineHeight\n\t}\n\n\tif (currentValue.openTypeFontFeatures) {\n\t\tresult.openTypeFontFeatures = currentValue.openTypeFontFeatures\n\t}\n\n\tif (currentValue.variationAxes) {\n\t\tresult.variationAxes = currentValue.variationAxes\n\t}\n\n\treturn result\n}\n\nfunction getDefaultLetterSpacing(letterSpacing: unknown): LetterSpacing | undefined {\n\tif (isNumber(letterSpacing)) return [letterSpacing, \"px\"]\n\tif (!isString(letterSpacing)) return undefined\n\tconst parsedLetterSpacing = parseCSSDimension(letterSpacing)\n\treturn isLetterSpacing(parsedLetterSpacing) ? parsedLetterSpacing : undefined\n}\n\nfunction getDefaultLineHeight(lineHeight: unknown): LineHeight {\n\tif (isNumber(lineHeight)) return [lineHeight, \"em\"]\n\tif (!isString(lineHeight)) return [1, \"em\"]\n\tconst parsedLineHeight = parseCSSDimension(lineHeight)\n\treturn isLineHeight(parsedLineHeight) ? parsedLineHeight : [1, \"em\"]\n}\n\nexport function isRawFontValue(value: unknown): value is RawFontValue {\n\tif (!isObject(value)) return false\n\tif (!isString(value[fontSelectorKey])) return false\n\tconst fontSize = value[fontSizeKey]\n\tconst lineHeight = value[lineHeightKey]\n\tconst textAlignment = value[textAlignmentKey]\n\tconst letterSpacing = value[letterSpacingKey]\n\tif (!isUndefined(fontSize) && !isFontSizeCSSDimension(fontSize) && !isNumber(fontSize)) return false\n\tif (!isUndefined(lineHeight) && !isLineHeight(lineHeight)) return false\n\tif (!isUndefined(textAlignment) && !isTextAlignment(textAlignment)) return false\n\tif (!isUndefined(letterSpacing) && !isLetterSpacing(letterSpacing) && !isNumber(letterSpacing)) return false\n\treturn true\n}\n\n// Will check if the value of every key is correct\nexport function isFontValue(value: unknown): value is FontValue {\n\tif (!isRawFontValue(value)) return false\n\n\t// These extra checks ensure that the only the new types are being used instead\n\t// of the deprecated `number` values.\n\tconst fontSize = value[fontSizeKey]\n\tif (!isUndefined(fontSize) && !isFontSizeCSSDimension(fontSize)) return false\n\tconst letterSpacing = value[letterSpacingKey]\n\tif (!isUndefined(letterSpacing) && !isLetterSpacing(letterSpacing)) return false\n\n\treturn true\n}\n\nexport type FontStyle = Pick<\n\tReact.CSSProperties,\n\t| \"fontFamily\"\n\t| \"fontWeight\"\n\t| \"fontStyle\"\n\t| \"fontSize\"\n\t| \"lineHeight\"\n\t| \"textAlign\"\n\t| \"letterSpacing\"\n\t| \"fontFeatureSettings\"\n>\nexport function styleForFontValue(value: FontValue): FontStyle {\n\tconst style: FontStyle = value.fontSelector ? getFontStyleProperties(value.fontSelector) : {}\n\tif (!isUndefined(value.fontSize)) {\n\t\tconst [size, unit] = parseCSSDimension(value.fontSize)\n\t\t// Because `rem` is not supported in the sandbox, as we cannot set the root font size\n\t\t// as we would in the browser, we need to convert it to a pixel value via a variable.\n\t\tstyle.fontSize = unit === \"rem\" ? serializeRemFontSizeCalcString(size) : value.fontSize\n\t}\n\tif (!isUndefined(value.lineHeight)) {\n\t\tstyle.lineHeight = value.lineHeight.join(\"\")\n\t}\n\tif (!isUndefined(value.textAlignment)) {\n\t\tstyle.textAlign = value.textAlignment\n\t}\n\n\tif (!isUndefined(value.letterSpacing)) {\n\t\tstyle.letterSpacing = value.letterSpacing.join(\"\")\n\t}\n\n\tif (!isUndefined(value.openTypeFontFeatures)) {\n\t\tstyle.fontFeatureSettings = openTypeFeatureTagsToCSS(value.openTypeFontFeatures)\n\t}\n\n\treturn style\n}\n", "import { ControlType } from \"library/render/types/PropertyControls.ts\"\n\n/**\n * Certain control types both support the same data model. So switching types should not result in\n * data loss.\n */\nexport function controlTypesAreCompatible(controlType: ControlType, rawDataType: ControlType): boolean {\n\tif (controlType === rawDataType) return true\n\n\tswitch (controlType) {\n\t\tcase ControlType.ResponsiveImage:\n\t\t\treturn rawDataType === ControlType.Image\n\t\tcase ControlType.Image:\n\t\t\treturn rawDataType === ControlType.ResponsiveImage\n\t\tcase ControlType.Enum:\n\t\t\tif (rawDataType === ControlType.SegmentedEnum) return true\n\t\t\t// We are allowing for control prop values of type string, number, and boolean because\n\t\t\t// Toss somehow ended up with those and this used to work before the `getControlProps`\n\t\t\t// refactor: https://github.com/framer/FramerStudio/pull/13911\n\t\t\tif (rawDataType === ControlType.String) return true\n\t\t\tif (rawDataType === ControlType.Number) return true\n\t\t\tif (rawDataType === ControlType.Boolean) return true\n\t\t\treturn false\n\t\tcase ControlType.SegmentedEnum:\n\t\t\treturn rawDataType === ControlType.Enum\n\t\tcase ControlType.Color:\n\t\t\t// We are allowing for control prop values of type string, because Toss somehow ended up\n\t\t\t// with them and it used to work before the `getControlProps` refactor:\n\t\t\t// https://github.com/framer/FramerStudio/pull/13911\n\t\t\treturn rawDataType === ControlType.String\n\t\tcase ControlType.ComponentInstance:\n\t\t\treturn rawDataType === ControlType.Array\n\t\tcase ControlType.Array:\n\t\t\treturn rawDataType === ControlType.ComponentInstance\n\t\tcase ControlType.Slot:\n\t\t\treturn rawDataType === ControlType.ComponentInstance || rawDataType === ControlType.Array\n\t\tcase ControlType.BorderRadius:\n\t\tcase ControlType.Padding:\n\t\t\t// It should be possible to convert a number or a fused number to padding or border\n\t\t\t// radius without data loss.\n\t\t\treturn rawDataType === ControlType.Number || rawDataType === ControlType.FusedNumber\n\t\tcase ControlType.Gap:\n\t\t\t// It should be possible to convert a number to gap without data loss.\n\t\t\treturn rawDataType === ControlType.Number\n\t}\n\n\treturn false\n}\n", "import { isObject } from \"utils/typeChecks.ts\"\nimport type { LocalizedTextValue, LocalizedValues } from \"../LocalizedValue.ts\"\n\nconst key = \"valueLocalized\"\n\nexport interface WithControlValueLocalized {\n\t[key]?: LocalizedValues<LocalizedTextValue>\n}\n\nexport function hasControlValueLocalized(value: unknown): value is Required<WithControlValueLocalized> {\n\treturn isObject(value) && key in value && Boolean(value[key])\n}\n", "import type { TreeUpdater } from \"document/models/CanvasTree/TreeUpdater.ts\"\nimport type { CanvasTree } from \"document/models/CanvasTree/index.ts\"\n\nexport type TreeMode = \"crdt\" | \"json\"\n\nexport const defaultTreeMode: TreeMode = \"crdt\"\n\nexport function isTreeMode(value: unknown): value is TreeMode {\n\treturn value === \"crdt\" || value === \"json\"\n}\n\nexport function setTreeMode(tree: CanvasTree, mode: TreeMode): void {\n\ttree.setService(\"mode\", mode)\n}\n\nexport function treeModeForTree(tree: CanvasTree): TreeMode {\n\treturn tree.getService(\"mode\")\n}\n\ninterface CrdtTimelineShape {\n\tremoteTrees: { length: number }\n\tstore: { length: number }\n}\n\ninterface JsonTimelineShape {\n\tremoteTreeIndex: number\n\tlength: number\n\tisPartialLoading: boolean\n}\n\nfunction hasCrdtTimelineShape(timeline: TreeUpdater): timeline is TreeUpdater & CrdtTimelineShape {\n\tconst candidate = timeline as TreeUpdater & Partial<CrdtTimelineShape>\n\treturn candidate.remoteTrees !== undefined && candidate.store !== undefined\n}\n\nfunction hasJsonTimelineShape(timeline: TreeUpdater): timeline is TreeUpdater & JsonTimelineShape {\n\tconst candidate = timeline as TreeUpdater & Partial<JsonTimelineShape>\n\treturn (\n\t\tcandidate.remoteTreeIndex !== undefined &&\n\t\tcandidate.length !== undefined &&\n\t\tcandidate.isPartialLoading !== undefined\n\t)\n}\n\nexport function treeModeForTimeline(timeline: TreeUpdater): TreeMode {\n\tif (hasCrdtTimelineShape(timeline)) return \"crdt\"\n\treturn \"json\"\n}\n\n// Keep this duck-typed so TreeMode value imports do not pull timeline implementations into unrelated bundles.\nexport function treeTimelineHasData(timeline: TreeUpdater): boolean {\n\tif (hasCrdtTimelineShape(timeline)) {\n\t\treturn timeline.remoteTreeVersion !== 0 || timeline.remoteTrees.length > 0 || timeline.store.length > 0\n\t}\n\n\tif (hasJsonTimelineShape(timeline)) {\n\t\treturn (\n\t\t\ttimeline.remoteTreeVersion !== 0 ||\n\t\t\ttimeline.remoteTreeIndex !== 0 ||\n\t\t\ttimeline.length > 1 ||\n\t\t\ttimeline.isPartialLoading\n\t\t)\n\t}\n\n\treturn true\n}\n", "import type { AnyComponentLoader } from \"@framerjs/framer-runtime\"\nimport type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport type { ControlProp, ControlProps } from \"document/models/controlProps/ControlProp.ts\"\nimport type { RawControlProp, RawControlProps } from \"document/models/controlProps/RawControlProp.ts\"\nimport type { PrefixedControlPropKey } from \"document/models/controlProps/controlPropKey.ts\"\nimport type { PropertyControls } from \"library/index.ts\"\nimport type { Locale } from \"library/router/types.ts\"\nimport type { AssetResolverWithHash } from \"renderer/getAssetResolver.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\nimport type { FetchDataValueResolver } from \"./FetchDataValue.ts\"\nimport type { CombinedVariableProviderValueMap } from \"./VariableProvider.ts\"\n\nexport type RichTextControlKeys = readonly string[]\nexport type ResolvedControlPropValues = Readonly<Record<string, unknown>>\nexport type ComponentVectorSetChildren = Readonly<Record<string, ModuleExportIdentifierString | undefined>>\n\nexport interface WithControlProps {\n\t[key: PrefixedControlPropKey]: RawControlProp | undefined\n\n\tgetControlPropSourceIdentifier(): string | undefined\n\n\tgetRawControlProps(): RawControlProps\n\tgetRawControlProp(key: string): RawControlProp | undefined\n\n\tgetControlProps(controls: PropertyControls): ControlProps\n\tsetControlProp(propKey: string, value: ControlProp | undefined): void\n\n\tgetResolvedControlPropValues(\n\t\tcomponentLoader: AnyComponentLoader,\n\t\tassetResolverWithHash?: AssetResolverWithHash | null,\n\t\tvariableOverrides?: CombinedVariableProviderValueMap,\n\t\tactiveLocale?: Locale,\n\t\tgetResolvedFetchDataValue?: FetchDataValueResolver,\n\t): ResolvedControlPropValues\n\n\tgetRichTextControlKeys(componentLoader: AnyComponentLoader): RichTextControlKeys\n\n\tgetComponentVectorSetChildren(\n\t\tcomponentLoader: AnyComponentLoader,\n\t\tvariableOverrides?: CombinedVariableProviderValueMap,\n\t): ComponentVectorSetChildren\n}\n\nconst getRawControlPropsKey: keyof WithControlProps = \"getRawControlProps\"\n\nexport function withControlProps<T extends CanvasNode>(node: T): node is T & WithControlProps {\n\treturn getRawControlPropsKey in node\n}\n", "import type { VerifiedControlDescription } from \"@framerjs/framer-runtime\"\nimport { shouldBeNever } from \"@framerjs/shared\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport type { Locale } from \"library/router/types.ts\"\nimport type { VariableValueResolver } from \"../../nodes/CanvasNodeCache.ts\"\nimport type { ComputedValue, ComputedValueOutputType } from \"../ComputedValue.ts\"\nimport { isComputedValueFromFetchData } from \"../ComputedValue.ts\"\nimport type { FetchDataValueResolver } from \"../FetchDataValue.ts\"\nimport { getFetchFallbackValue } from \"../FetchDataValue.ts\"\nimport type { CombinedVariableProviderValueMap } from \"../VariableProvider.ts\"\nimport { isVariableReference } from \"../VariableReference.ts\"\nimport { applyValueTransform, toBoolean, toNumber, toString } from \"./applyValueTransform.ts\"\n\nfunction makeTypeSafe(value: unknown, outputType: ComputedValueOutputType): unknown {\n\tswitch (outputType) {\n\t\tcase ControlType.Boolean:\n\t\t\treturn toBoolean(value)\n\t\tcase ControlType.Number:\n\t\t\treturn toNumber(value)\n\t\tcase ControlType.String:\n\t\tcase ControlType.Color:\n\t\t\treturn toString(value)\n\t\tcase ControlType.Array:\n\t\tcase ControlType.Enum:\n\t\tcase ControlType.Link:\n\t\tcase ControlType.Gap:\n\t\tcase ControlType.Padding:\n\t\tcase ControlType.BorderRadius:\n\t\tcase ControlType.Image:\n\t\tcase ControlType.MultiCollectionReference:\n\t\t\treturn value\n\t\tdefault:\n\t\t\t// All output types should be handled\n\t\t\tshouldBeNever(outputType)\n\t\t\treturn value\n\t}\n}\n\nexport function getResolvedComputedValueStartValue(\n\tcomputedValue: ComputedValue,\n\tvariableOverrides: CombinedVariableProviderValueMap | undefined,\n\tvariableValueResolver: VariableValueResolver,\n\tgetResolvedFetchDataValue: FetchDataValueResolver | undefined,\n): unknown {\n\tif (isComputedValueFromFetchData(computedValue)) {\n\t\t// Only on the canvas sandbox do we actually know how to get a resolved\n\t\t// fetch value\n\t\tif (getResolvedFetchDataValue) {\n\t\t\treturn getResolvedFetchDataValue(computedValue.startValue)\n\t\t}\n\n\t\tconst fallbackValue = getFetchFallbackValue(computedValue.startValue)\n\t\tif (isVariableReference(fallbackValue)) {\n\t\t\treturn variableValueResolver.getVariableReferenceValue(fallbackValue, variableOverrides)\n\t\t}\n\n\t\treturn fallbackValue\n\t}\n\n\treturn variableValueResolver.getVariableReferenceValue(computedValue.startValue, variableOverrides)\n}\n\nexport function computeValue(\n\tcomputedValue: ComputedValue,\n\tvariableValueResolver: VariableValueResolver,\n\tvariableOverrides: CombinedVariableProviderValueMap | undefined,\n\tinputControl: VerifiedControlDescription | undefined,\n\toutputControl: VerifiedControlDescription | undefined,\n\t/** Router locale is only available in the sandbox, so in Vekter we do not rely on having this info. */\n\trouterLocale: Locale | undefined,\n\t/** Allow start value to be overridden. */\n\toptions?: { startValue: unknown },\n\tgetResolvedFetchDataValue?: FetchDataValueResolver,\n): unknown {\n\tconst resolvedStartValue = options\n\t\t? options.startValue\n\t\t: getResolvedComputedValueStartValue(\n\t\t\t\tcomputedValue,\n\t\t\t\tvariableOverrides,\n\t\t\t\tvariableValueResolver,\n\t\t\t\tgetResolvedFetchDataValue,\n\t\t\t)\n\n\tconst transformedValue = computedValue.transforms.reduce((previous, valueTransform) => {\n\t\treturn applyValueTransform(\n\t\t\tprevious,\n\t\t\tvalueTransform,\n\t\t\tvariableValueResolver,\n\t\t\tvariableOverrides,\n\t\t\tinputControl,\n\t\t\toutputControl,\n\t\t\trouterLocale,\n\t\t)\n\t}, resolvedStartValue)\n\n\treturn makeTypeSafe(transformedValue, computedValue.outputType)\n}\n", "import type { WithFontVariants } from \"document/models/CanvasTree/traits/WithFontVariants.ts\"\n\ninterface FontPreviewBase {\n\tfontSelector: string\n}\n\ninterface RichTextFontPreview extends FontPreviewBase {\n\ttype: \"rich-text\"\n}\n\ninterface PropertyControlFontPreview extends FontPreviewBase {\n\ttype: \"property-control\"\n\tcontrolKey: string\n}\n\nexport interface StylePresetFontPreview extends FontPreviewBase {\n\ttype: \"style-preset\"\n\t/** Unused by inline-code style presets */\n\tvariantSelectors?: WithFontVariants\n}\n\n/** Font preview state for a node. */\nexport type FontPreview = RichTextFontPreview | PropertyControlFontPreview | StylePresetFontPreview\n\nexport function isPropertyControlFontPreview(fontPreview: FontPreview): fontPreview is PropertyControlFontPreview {\n\treturn fontPreview.type === \"property-control\"\n}\n\nexport function isStylePresetFontPreview(fontPreview: FontPreview): fontPreview is StylePresetFontPreview {\n\treturn fontPreview.type === \"style-preset\"\n}\n", "/**\n * List of keywords reserved by the ECMAScript standards, including future reserved keywords.\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#keywords\n */\nexport const JAVASCRIPT_RESERVED_KEYWORDS = new Set([\n\t\"break\",\n\t\"case\",\n\t\"catch\",\n\t\"class\",\n\t\"const\",\n\t\"continue\",\n\t\"debugger\",\n\t\"default\",\n\t\"delete\",\n\t\"do\",\n\t\"else\",\n\t\"export\",\n\t\"extends\",\n\t\"false\",\n\t\"finally\",\n\t\"for\",\n\t\"function\",\n\t\"if\",\n\t\"import\",\n\t\"in\",\n\t\"instanceof\",\n\t\"new\",\n\t\"null\",\n\t\"return\",\n\t\"super\",\n\t\"switch\",\n\t\"this\",\n\t\"throw\",\n\t\"true\",\n\t\"try\",\n\t\"typeof\",\n\t\"var\",\n\t\"void\",\n\t\"while\",\n\t\"with\",\n\t// The following are only reserved when they are found in strict mode code:\n\t\"let\",\n\t\"static\",\n\t\"yield\",\n\t// The following are only reserved when they are found in module code or async function bodies:\n\t\"await\",\n\n\t// Future reserved words\n\t// These are always reserved:\n\t\"enum\",\n\t// The following are only reserved when they are found in strict mode code:\n\t\"implements\",\n\t\"interface\",\n\t\"package\",\n\t\"private\",\n\t\"protected\",\n\t\"public\",\n\n\t// Identifiers with special meanings\n\t\"arguments\",\n\t\"as\",\n\t\"async\",\n\t\"eval\",\n\t\"from\",\n\t\"get\",\n\t\"of\",\n\t\"set\",\n\n\t// JavaScript standard built-in objects\n\t// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects\n\n\t// Value properties\n\t\"Infinity\",\n\t\"NaN\",\n\t\"globalThis\",\n\t\"undefined\",\n\n\t// Function properties\n\t\"decodeURI\",\n\t\"decodeURIComponent\",\n\t\"encodeURI\",\n\t\"encodeURIComponent\",\n\t\"escape\",\n\t\"isFinite\",\n\t\"isNaN\",\n\t\"parseFloat\",\n\t\"parseInt\",\n\t\"unescape\",\n\n\t// Fundamental objects\n\t\"Boolean\",\n\t\"Function\",\n\t\"Object\",\n\t\"Symbol\",\n\n\t// Error objects\n\t\"AggregateError\",\n\t\"Error\",\n\t\"EvalError\",\n\t\"InternalError\",\n\t\"RangeError\",\n\t\"ReferenceError\",\n\t\"SuppressedError\",\n\t\"SyntaxError\",\n\t\"TypeError\",\n\t\"URIError\",\n\n\t// Numbers and dates\n\t\"BigInt\",\n\t\"Date\",\n\t\"Math\",\n\t\"Number\",\n\n\t// Text processing\n\t\"RegExp\",\n\t\"String\",\n\n\t// Indexed collections\n\t\"Array\",\n\t\"BigInt64Array\",\n\t\"BigUint64Array\",\n\t\"Float16Array\",\n\t\"Float32Array\",\n\t\"Float64Array\",\n\t\"Int16Array\",\n\t\"Int32Array\",\n\t\"Int8Array\",\n\t\"TypedArray\",\n\t\"Uint16Array\",\n\t\"Uint32Array\",\n\t\"Uint8Array\",\n\t\"Uint8ClampedArray\",\n\n\t// Keyed collections\n\t\"Map\",\n\t\"Set\",\n\t\"WeakMap\",\n\t\"WeakSet\",\n\n\t// Structured data\n\t\"ArrayBuffer\",\n\t\"Atomics\",\n\t\"DataView\",\n\t\"JSON\",\n\t\"SharedArrayBuffer\",\n\n\t// Managing memory\n\t\"FinalizationRegistry\",\n\t\"WeakRef\",\n\n\t// Control abstraction objects\n\t\"AsyncFunction\",\n\t\"AsyncGenerator\",\n\t\"AsyncGeneratorFunction\",\n\t\"AsyncIterator\",\n\t\"Generator\",\n\t\"GeneratorFunction\",\n\t\"Iterator\",\n\t\"Promise\",\n\n\t// Reflection\n\t\"Proxy\",\n\t\"Reflect\",\n\n\t// Internationalization\n\t\"Intl\",\n\n\t// Web/Browser globals\n\t\"document\",\n\t\"window\",\n\t\"console\",\n\t\"alert\",\n\t\"confirm\",\n\t\"prompt\",\n\t\"fetch\",\n\t\"setTimeout\",\n\t\"setInterval\",\n\t\"clearTimeout\",\n\t\"clearInterval\",\n\t\"requestAnimationFrame\",\n\t\"cancelAnimationFrame\",\n\t\"queueMicrotask\",\n\t\"atob\",\n\t\"btoa\",\n\t\"structuredClone\",\n\t\"reportError\",\n\n\t// Web API constructors and namespaces\n\t\"AbortController\",\n\t\"AbortSignal\",\n\t\"Blob\",\n\t\"BroadcastChannel\",\n\t\"Cache\",\n\t\"CacheStorage\",\n\t\"ClipboardItem\",\n\t\"CryptoKey\",\n\t\"CustomEvent\",\n\t\"DOMException\",\n\t\"DOMParser\",\n\t\"DOMRect\",\n\t\"DOMMatrix\",\n\t\"DOMPoint\",\n\t\"Element\",\n\t\"Event\",\n\t\"EventTarget\",\n\t\"File\",\n\t\"FileReader\",\n\t\"FormData\",\n\t\"Headers\",\n\t\"History\",\n\t\"HTMLElement\",\n\t\"Image\",\n\t\"IntersectionObserver\",\n\t\"Location\",\n\t\"MediaQueryList\",\n\t\"MessageChannel\",\n\t\"MessagePort\",\n\t\"MutationObserver\",\n\t\"Navigator\",\n\t\"Node\",\n\t\"Notification\",\n\t\"Performance\",\n\t\"PerformanceObserver\",\n\t\"PermissionStatus\",\n\t\"ReadableStream\",\n\t\"Request\",\n\t\"ResizeObserver\",\n\t\"Response\",\n\t\"Selection\",\n\t\"ServiceWorker\",\n\t\"Storage\",\n\t\"TextDecoder\",\n\t\"TextEncoder\",\n\t\"URL\",\n\t\"URLSearchParams\",\n\t\"WebSocket\",\n\t\"Window\",\n\t\"Worker\",\n\t\"WritableStream\",\n\t\"XMLHttpRequest\",\n\t\"XMLSerializer\",\n])\n", "import { assert } from \"@framerjs/shared\"\nimport { SafeJS } from \"code-generation/js/serializeJS.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { JAVASCRIPT_RESERVED_KEYWORDS } from \"../js/reserved.ts\"\n\nexport class BindingCollector {\n\t#bindings = new Set<string>(JAVASCRIPT_RESERVED_KEYWORDS)\n\t#nodeBindings = new Map<string, SafeJS>()\n\n\tconstructor(...bindings: string[]) {\n\t\tif (!bindings) return\n\n\t\tfor (const word of bindings) {\n\t\t\tif (this.#bindings.has(word)) {\n\t\t\t\tthrow new Error(`Binding Collector: Attempting to reserve a word \"${word}\" that has already been used.`)\n\t\t\t}\n\t\t\tthis.#bindings.add(word)\n\t\t}\n\t}\n\n\t/**\n\t * @TODO - We should add some validation to the provided binding that\n\t * ensures it is a valid javascript binding, e.g. removing spaces or leading\n\t * numbers.\n\t */\n\tcreate(binding: string): SafeJS {\n\t\tassert(binding !== \"\", \"Binding Collector: The provided binding name cannot be an empty string.\")\n\t\treturn new SafeJS(createUnique(binding, this.#bindings))\n\t}\n\n\t/**\n\t * Create and stores a binding that is scoped to a specific node.\n\t *\n\t * Sometimes we need to be able to refer to a a shared binding for a\n\t * specific node in different places.\n\t */\n\tcreateWithNode(\n\t\t/**\n\t\t * You can add to this type to add new bindings. We add all of them here so they stay in\n\t\t * sync, and for nice autocomplete.\n\t\t */\n\t\tbinding: \"paginationInfo\" | \"loadMore\" | \"collection\" | \"index\",\n\t\tnode: CanvasNode,\n\t): SafeJS {\n\t\tconst id = node.getPrimaryId()\n\t\tconst hash = binding + id\n\t\tconst existingBinding = this.#nodeBindings.get(hash)\n\t\tif (existingBinding) return existingBinding\n\n\t\tconst newBinding = this.create(binding)\n\t\tthis.#nodeBindings.set(hash, newBinding)\n\t\treturn newBinding\n\t}\n}\n\n/**\n * Create a unique name based on a Set of unavailable names. Mutates the set\n * when an available candidate is created.\n */\nexport function createUnique(binding: string, bindings: Set<string>) {\n\t// If a binding is provided, and the same binding hasn't been used,\n\t// return that binding and reserve it.\n\tif (!bindings.has(binding)) {\n\t\tbindings.add(binding)\n\t\treturn binding\n\t}\n\n\t// Create a base for a unique binding to be created from.\n\tlet draftBinding = binding\n\tlet count = 0\n\n\t// Iterate a counter, trying to use it to create a unique binding.\n\twhile (bindings.has(draftBinding)) {\n\t\tcount += 1\n\t\tdraftBinding = binding + count\n\t}\n\n\t// Finally when the binding is unique, reserve it, and return it.\n\tbindings.add(draftBinding)\n\treturn draftBinding\n}\n", "import type { LocalizedValues } from \"document/models/LocalizedValue.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../index.ts\"\n\n/**\n * Extend your node by providing a custom ALT attribute used in HTML images.\n */\nexport interface WithAltText {\n\treadonly altAttribute: string | undefined\n\treadonly altAttributeLocalized: LocalizedValues | undefined\n}\n\nexport const altTextDefaults: WithAltText = {\n\taltAttribute: undefined,\n\taltAttributeLocalized: undefined,\n}\n\n/**\n * @name fallbackAltText\n * Its best accessibility practice to use an empty string as a default value for image ALT attributes.\n * It signalizes assistance devices like screen readers that we are semantically dealing with decoration images.\n * The image will also be removed from the Accessibility Tree/API.\n */\nexport const fallbackAltText = \"\"\n\nexport const altAttributeKey: keyof WithAltText = \"altAttribute\"\n\nexport function withAltText<T extends CanvasNode>(node: T): node is T & WithAltText {\n\treturn altAttributeKey in node\n}\n\nexport function hasAltText<T extends CanvasNode>(node: T): node is T & { altAttribute: string } {\n\t// For alt attributes an empty string should not be considered false.\n\t// An empty string indicates that the image is only there for decoration purposes.\n\treturn withAltText(node) && isString(node.altAttribute)\n}\n", "import type { VerifiedControlDescription, VerifiedPropertyControls } from \"@framerjs/framer-runtime\"\nimport { assert, assertNever } from \"@framerjs/shared\"\nimport { ControlType, type Location } from \"library/render/types/PropertyControls.ts\"\nimport { isReadonlyArray, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { isDynamicValue } from \"../CanvasTree/traits/DynamicValue.ts\"\nimport type { ResponsiveImage } from \"../CanvasTree/traits/ResponsiveImage.ts\"\nimport type { ControlProp, ControlProps } from \"./ControlProp.ts\"\nimport { hasControlFocalPoint } from \"./WithControlFocalPoint.ts\"\n\ntype TransformableControlPropType = Exclude<ControlProp[\"type\"], ControlType.Object | ControlType.FusedNumber>\n\ntype TransformableControlProp = Extract<ControlProp, { type: TransformableControlPropType }>\n\nexport type ControlPropValueTransform = (\n\tkey: string,\n\tcontrolProp: TransformableControlProp,\n\tcontrol: VerifiedControlDescription,\n) => unknown\n\nfunction collectControlPropValue(\n\tcontrolKey: string,\n\tcontrolProp: ControlProp,\n\tcontrol: VerifiedControlDescription,\n\tresult: Record<string, unknown>,\n\ttransformValue: ControlPropValueTransform | undefined,\n): void {\n\tswitch (controlProp.type) {\n\t\tcase ControlType.EventHandler:\n\t\tcase ControlType.Slot:\n\t\t\tbreak\n\t\tcase ControlType.Enum:\n\t\tcase ControlType.Boolean:\n\t\tcase ControlType.Border:\n\t\tcase ControlType.BoxShadow:\n\t\tcase ControlType.Date:\n\t\tcase ControlType.Number:\n\t\tcase ControlType.Transition:\n\t\tcase ControlType.String:\n\t\tcase ControlType.Color:\n\t\tcase ControlType.RichText:\n\t\tcase ControlType.Link:\n\t\tcase ControlType.LinkRelValues:\n\t\tcase ControlType.Font:\n\t\tcase ControlType.PageScope:\n\t\tcase ControlType.ScrollSectionRef:\n\t\tcase ControlType.CustomCursor:\n\t\tcase ControlType.Cursor:\n\t\tcase ControlType.File:\n\t\tcase ControlType.Gap:\n\t\tcase ControlType.Padding:\n\t\tcase ControlType.BorderRadius:\n\t\tcase ControlType.CollectionReference:\n\t\tcase ControlType.MultiCollectionReference:\n\t\tcase ControlType.VectorSetItem:\n\t\tcase ControlType.TrackingId: {\n\t\t\tif (transformValue) {\n\t\t\t\tresult[controlKey] = transformValue(controlKey, controlProp, control)\n\t\t\t} else {\n\t\t\t\tresult[controlKey] = controlProp.value\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tcase ControlType.Location: {\n\t\t\tif (transformValue) {\n\t\t\t\tresult[controlKey] = transformValue(controlKey, controlProp, control)\n\t\t\t} else if (isDynamicValue(controlProp.value)) {\n\t\t\t\tresult[controlKey] = controlProp.value\n\t\t\t} else if (controlProp.value) {\n\t\t\t\tconst location: Location = {\n\t\t\t\t\t// NOTE: We clone the location so user components don't accidentally mutate the\n\t\t\t\t\t// value in the control prop.\n\t\t\t\t\tcoordinate: { ...controlProp.value },\n\t\t\t\t}\n\t\t\t\tif (controlProp.title) location.title = controlProp.title\n\t\t\t\tif (controlProp.address) location.address = controlProp.address\n\t\t\t\tresult[controlKey] = location\n\t\t\t} else {\n\t\t\t\tresult[controlKey] = undefined\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tcase ControlType.Image:\n\t\t\tif (transformValue) {\n\t\t\t\tresult[controlKey] = transformValue(controlKey, controlProp, control)\n\t\t\t} else if (isDynamicValue(controlProp.value)) {\n\t\t\t\tresult[controlKey] = controlProp.value\n\t\t\t} else if (control.type !== ControlType.ResponsiveImage || isUndefined(controlProp.value)) {\n\t\t\t\tresult[controlKey] = controlProp.value\n\t\t\t} else {\n\t\t\t\tconst responsiveImage: ResponsiveImage = { src: controlProp.value, alt: controlProp.alt }\n\t\t\t\tif (hasControlFocalPoint(controlProp)) {\n\t\t\t\t\tresponsiveImage.positionX = controlProp.positionX\n\t\t\t\t\tresponsiveImage.positionY = controlProp.positionY\n\t\t\t\t}\n\t\t\t\tresult[controlKey] = responsiveImage\n\t\t\t}\n\t\t\tbreak\n\t\tcase ControlType.FusedNumber: {\n\t\t\tassert(control.type === ControlType.FusedNumber)\n\t\t\tassert(isString(control.toggleKey))\n\t\t\tresult[controlKey] = controlProp.value.single\n\t\t\tresult[control.toggleKey] = controlProp.isFused\n\t\t\tconst [v1, v2, v3, v4] = controlProp.value.fused\n\t\t\tconst [k1, k2, k3, k4] = control.valueKeys\n\t\t\tassert(isString(k1))\n\t\t\tassert(isString(k2))\n\t\t\tassert(isString(k3))\n\t\t\tassert(isString(k4))\n\t\t\tresult[k1] = v1\n\t\t\tresult[k2] = v2\n\t\t\tresult[k3] = v3\n\t\t\tresult[k4] = v4\n\t\t\tbreak\n\t\t}\n\t\tcase ControlType.Object: {\n\t\t\tassert(control.type === ControlType.Object)\n\t\t\tif (!controlProp.value) {\n\t\t\t\tassert(control.optional, \"Only optional object value can be falsy\")\n\t\t\t\tresult[controlKey] = undefined\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tconst object: Record<string, unknown> = {}\n\t\t\tfor (const objectPropertyKey in controlProp.value) {\n\t\t\t\tconst objectPropertyControlProp = controlProp.value[objectPropertyKey]\n\t\t\t\tassert(objectPropertyControlProp)\n\t\t\t\tconst objectPropertyControl = control.controls[objectPropertyKey]\n\t\t\t\tassert(objectPropertyControl)\n\t\t\t\tcollectControlPropValue(\n\t\t\t\t\tobjectPropertyKey,\n\t\t\t\t\tobjectPropertyControlProp,\n\t\t\t\t\tobjectPropertyControl,\n\t\t\t\t\tobject,\n\t\t\t\t\ttransformValue,\n\t\t\t\t)\n\t\t\t}\n\t\t\tresult[controlKey] = object\n\t\t\tbreak\n\t\t}\n\t\tcase ControlType.Array: {\n\t\t\tif (control.type === ControlType.Slot) break\n\t\t\tassert(control.type === ControlType.Array)\n\t\t\tconst collectorKey = \"value\"\n\t\t\tconst collectorObject = { [collectorKey]: undefined }\n\t\t\tconst list: unknown[] = []\n\t\t\tresult[controlKey] = list\n\n\t\t\tif (isDynamicValue(controlProp.value)) {\n\t\t\t\tif (transformValue) {\n\t\t\t\t\tresult[controlKey] = transformValue(controlKey, controlProp, control)\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif (isReadonlyArray(controlProp.value)) {\n\t\t\t\tfor (const arrayItemControlProp of controlProp.value) {\n\t\t\t\t\tcollectControlPropValue(collectorKey, arrayItemControlProp, control.control, collectorObject, transformValue)\n\t\t\t\t\tif (isUndefined(collectorObject.value)) return\n\t\t\t\t\tlist.push(collectorObject.value)\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tcontrolProp.value satisfies never\n\t\t\tbreak\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(controlProp, \"All control prop types should be handled.\")\n\t}\n}\n\n/**\n * Get all control prop values excluding slots and event handlers. The values can be transformed,\n * which is useful for resolving dynamic values and assets.\n */\nexport function getControlPropValues(\n\tcontrols: VerifiedPropertyControls,\n\tcontrolProps: ControlProps,\n\ttransformValue?: ControlPropValueTransform,\n) {\n\tconst result: Record<string, unknown> = {}\n\n\tfor (const controlKey in controlProps) {\n\t\tconst control = controls[controlKey]\n\t\tassert(control, \"Control must exist\")\n\n\t\tconst controlProp = controlProps[controlKey]\n\t\tassert(controlProp, \"Control prop must exist\")\n\n\t\tcollectControlPropValue(controlKey, controlProp, control, result, transformValue)\n\t}\n\n\treturn result\n}\n\nexport function getControlPropValue(\n\tcontrol: VerifiedControlDescription,\n\tcontrolProp: ControlProp,\n\ttransformValue?: ControlPropValueTransform,\n) {\n\tconst controlKey = \"value\"\n\tconst result: Record<string, unknown> = {}\n\n\tcollectControlPropValue(controlKey, controlProp, control, result, transformValue)\n\n\treturn result[controlKey]\n}\n", "/* eslint-disable */\n// Inspired by https://github.com/garycourt/murmurhash-js\n// Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86\nfunction murmur2(str) {\n  // 'm' and 'r' are mixing constants generated offline.\n  // They're not really 'magic', they just happen to work well.\n  // const m = 0x5bd1e995;\n  // const r = 24;\n  // Initialize the hash\n  var h = 0; // Mix 4 bytes at a time into the hash\n\n  var k,\n      i = 0,\n      len = str.length;\n\n  for (; len >= 4; ++i, len -= 4) {\n    k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;\n    k =\n    /* Math.imul(k, m): */\n    (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16);\n    k ^=\n    /* k >>> r: */\n    k >>> 24;\n    h =\n    /* Math.imul(k, m): */\n    (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^\n    /* Math.imul(h, m): */\n    (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);\n  } // Handle the last few bytes of the input array\n\n\n  switch (len) {\n    case 3:\n      h ^= (str.charCodeAt(i + 2) & 0xff) << 16;\n\n    case 2:\n      h ^= (str.charCodeAt(i + 1) & 0xff) << 8;\n\n    case 1:\n      h ^= str.charCodeAt(i) & 0xff;\n      h =\n      /* Math.imul(h, m): */\n      (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);\n  } // Do a few final mixes of the hash to ensure the last few\n  // bytes are well-incorporated.\n\n\n  h ^= h >>> 13;\n  h =\n  /* Math.imul(h, m): */\n  (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);\n  return ((h ^ h >>> 15) >>> 0).toString(36);\n}\n\nexport { murmur2 as default };\n", "import { experiments } from \"app/experiments.ts\"\nimport { treeModeForTree } from \"document/stores/TreeMode.ts\"\nimport type { Elements } from \"library/router/types.ts\"\nimport { slugify } from \"library/utils/slugify.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport type { CanvasNode, WebPageNode } from \"../index.ts\"\nimport type { NodeAccessor } from \"../nodes/MutableNode.ts\"\nimport { isReplicaOrReplicaChild } from \"./WithTemplate.ts\"\n\nexport interface WithScrollTarget {\n\t/**\n\t * While this value is specifically used for scroll targets, and could\n\t * therefore be named `scrollTargetElementId`, its important to note that\n\t * this value will always be used to provide a user defined value to the id\n\t * of the html element in generated code. It's important that other features\n\t * do not try to also set an element id.\n\t */\n\telementId: string | undefined\n\tscrollMarginTop: number | undefined\n\tscrollTargetEnabled: boolean | undefined\n}\n\nexport const scrollTargetDefaults: WithScrollTarget = {\n\telementId: undefined,\n\tscrollMarginTop: undefined,\n\tscrollTargetEnabled: undefined,\n}\n\nconst key: keyof WithScrollTarget = \"scrollTargetEnabled\"\n\nexport function withScrollTarget<T extends CanvasNode>(node: T): node is T & WithScrollTarget {\n\treturn key in node\n}\n\nexport interface HasScrollTarget extends WithScrollTarget {\n\tscrollTargetEnabled: true\n\telementId: string\n}\n\nexport function hasScrollTarget<T extends CanvasNode>(node: T): node is T & WithScrollTarget & HasScrollTarget {\n\treturn withScrollTarget(node) && !!node.scrollTargetEnabled && isString(node.elementId) && node.elementId !== \"\"\n}\n\n/**\n * Filter nodes that don't have an enabled, valid, element id, or that are\n * replicas.\n */\nfunction isScrollTargetAccessor(accessor: NodeAccessor): boolean {\n\tif (accessor.get(\"originalid\")) return false\n\tif (!accessor.get(\"scrollTargetEnabled\")) return false\n\tconst elementId = accessor.get(\"elementId\")\n\treturn isString(elementId) && elementId !== \"\"\n}\n\n/**\n * Filter nodes that don't have an enabled, valid, element id, or that are\n * replicas.\n */\nfunction isUniquePageScrollTargetNode<T extends CanvasNode>(\n\tnode: T,\n): node is T & WithScrollTarget & { elementId: string } {\n\treturn !isReplicaOrReplicaChild(node) && hasScrollTarget(node)\n}\n\n/**\n * Create a map of node ids to user defined element ids that can be linked to by\n * framer page links. These values will be used as the html element id in\n * runtime, so must be unique.\n */\nexport function getWebPageScrollTargets(webPage: WebPageNode): Elements {\n\t// Framer adds a #main element to the page, and assigns style to it. So we can't allow a user\n\t// section to have the same id.\n\tconst usedElementIds = new Set<string>([\"main\"])\n\tconst elements: Record<string, string> = {}\n\n\t// Use fastWalk only where it's needed: data-only tree on a crdt project.\n\t// TODO: remove this gate (and the walk() branch) once dataOnlyTree is fully rolled out.\n\tconst tree = webPage.cache.tree()\n\tif (experiments.isOn(\"dataOnlyTree\") && tree && treeModeForTree(tree) === \"crdt\") {\n\t\tfor (const accessor of webPage.fastWalk()) {\n\t\t\tif (!isScrollTargetAccessor(accessor)) continue\n\n\t\t\tlet elementId = accessor.get(\"elementId\") as string\n\t\t\tconst baseId = elementId\n\t\t\tlet counter = 0\n\t\t\twhile (usedElementIds.has(elementId)) {\n\t\t\t\tcounter += 1\n\t\t\t\telementId = slugify(`${baseId}-${counter}`)\n\t\t\t}\n\t\t\tusedElementIds.add(elementId)\n\t\t\telements[accessor.id] = elementId\n\t\t}\n\t} else {\n\t\tfor (const node of webPage.walk()) {\n\t\t\tif (!isUniquePageScrollTargetNode(node)) continue\n\n\t\t\tlet elementId = node.elementId\n\t\t\tlet counter = 0\n\t\t\twhile (usedElementIds.has(elementId)) {\n\t\t\t\tcounter += 1\n\t\t\t\telementId = slugify(`${node.elementId}-${counter}`)\n\t\t\t}\n\t\t\tusedElementIds.add(elementId)\n\t\t\telements[node.id] = elementId\n\t\t}\n\t}\n\n\treturn elements\n}\n", "import type { AnyComponentLoader } from \"@framerjs/framer-runtime\"\nimport { AnnotationKey } from \"@framerjs/framer-runtime/crossorigin\"\nimport { assert, type ModuleExportIdentifierString, assertNever, isEmptyObject } from \"@framerjs/shared\"\nimport { jst } from \"code-generation/js/js.ts\"\nimport type { SafeJS } from \"code-generation/js/serializeJS.ts\"\nimport { isSafeJS } from \"code-generation/js/serializeJS.ts\"\nimport type { CanvasNode, CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isDataRepeater } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { HasScrollTarget } from \"document/models/CanvasTree/traits/WithScrollTarget.ts\"\nimport { pathVariablesRegExp } from \"library/modules/Link/pathVariables.tsx\"\nimport { getOriginalRepeatedItemOfDataRepeater } from \"utils/repeaterUtils.ts\"\nimport { isDefined, isNull, isObject, isString } from \"utils/typeChecks.ts\"\n\nexport const scrollSectionPatternSeparator = \"-\"\n\nexport interface ScrollSectionPattern {\n\tpattern: string\n\tname: string\n\tslugs?: Record<string, { identifier: ModuleExportIdentifierString; provider: NodeID }>\n}\n\nconst key = \"pattern\" satisfies keyof ScrollSectionPattern\nexport function isScrollSectionPattern(value: unknown): value is ScrollSectionPattern {\n\tif (!isObject(value)) return false\n\treturn key in value && isString(value[key])\n}\n\n/**\n * An ElementIdPattern is an annotated value that allows a link to be created to an element on this\n * page without fully loading the Web Page Node. e.g.\n *\n * @framerScrollSections {\n *   [id: NodeID]: {\n *      pattern: \":xxx-:yyy-:zzz\",\n *      name: \"section-about\",\n *      slugs: {\n *          xxx: { identifier: \"local-module:aaa/bbb:default\", provider: \"aaa\" }\n *          yyy: { identifier: \"local-module:ccc/qqq:default\", provider: \"bbb\" }\n *      }\n *   }\n * }\n */\nexport interface ScrollSectionPatternAnnotation {\n\t[id: NodeID]: ScrollSectionPattern\n}\n\nexport function isScrollSectionPatternAnnotation(annotation: unknown): annotation is ScrollSectionPatternAnnotation {\n\tif (!isObject(annotation)) return false\n\tfor (const id in annotation) {\n\t\tif (!isScrollSectionPattern(annotation[id])) return false\n\t}\n\treturn true\n}\n\nexport type ScrollSectionPatternPart =\n\t| {\n\t\t\ttype: \"element\"\n\t\t\tid: NodeID\n\t  }\n\t| {\n\t\t\ttype: \"slug\"\n\t\t\tid: NodeID\n\t\t\tproviderId: NodeID\n\t\t\tidentifier: ModuleExportIdentifierString\n\t  }\n\nexport function createScrollSectionPattern(\n\tnode: CanvasNode & HasScrollTarget & { elementId: string },\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n): ScrollSectionPattern | undefined {\n\tconst slugs: Record<string, { identifier: ModuleExportIdentifierString; provider: NodeID }> = {}\n\tconst pattern = scrollSectionPatternFromTree(node, tree, componentLoader, (part): string | undefined => {\n\t\tconst type = part.type\n\t\tswitch (type) {\n\t\t\tcase \"slug\": {\n\t\t\t\tconst provider = tree.get(part.providerId)\n\t\t\t\tif (!provider || !isDataRepeater(provider) || !isString(provider.dataIdentifier)) return undefined\n\t\t\t\tslugs[part.id] = { identifier: provider.dataIdentifier, provider: provider.id }\n\t\t\t\treturn `:${part.id}`\n\t\t\t}\n\t\t\tcase \"element\": {\n\t\t\t\treturn `:${part.id}`\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tassertNever(type)\n\t\t}\n\t})\n\n\tif (!pattern) return undefined\n\n\treturn {\n\t\tpattern,\n\t\tname: node.elementId,\n\t\tslugs: !isEmptyObject(slugs) ? slugs : undefined,\n\t}\n}\n\nexport function scrollSectionPatternFromAnnotation<T extends SafeJS | string>(\n\t{ pattern, slugs }: ScrollSectionPattern,\n\tgetValue: (part: ScrollSectionPatternPart) => T | undefined,\n): T | undefined {\n\treturn jst.join(\n\t\tpattern\n\t\t\t.split(scrollSectionPatternSeparator)\n\t\t\t.map(part => {\n\t\t\t\tconst match = part.match(pathVariablesRegExp)\n\t\t\t\tif (!match) return part\n\n\t\t\t\tconst id = match[0].substring(1)\n\t\t\t\tconst info = slugs?.[id]\n\t\t\t\tif (!info) return getValue({ type: \"element\", id: id })\n\n\t\t\t\tconst { identifier, provider: providerId } = info\n\t\t\t\treturn getValue({ type: \"slug\", id: id, providerId, identifier })\n\t\t\t})\n\t\t\t.filter(isDefined),\n\t\tscrollSectionPatternSeparator,\n\t) as T\n}\n\n/**\n * In the case where the target node has never been visited, e.g. when editing\n * the CMS in a fresh session, the cache will not be set. In that case, walk up\n * from the target node and create a list of all data repeater ids.\n */\nexport function getAncestorRepeaterIds(node: CanvasNode, tree: CanvasTree): NodeID[] {\n\tif (isNull(node.cache.repeatedAncestorRepeaterIds)) {\n\t\tconst ancestorRepeaterIds: NodeID[] = []\n\t\tlet previous = node\n\t\tlet parent = tree.getParent(node.id)\n\t\twhile (parent) {\n\t\t\tconst repeatedChild = getOriginalRepeatedItemOfDataRepeater(tree, parent)\n\t\t\tif (isDataRepeater(parent) && repeatedChild) {\n\t\t\t\tconst originalId = previous.getPrimaryId()\n\t\t\t\tif (originalId === repeatedChild?.id) ancestorRepeaterIds.unshift(parent.id)\n\t\t\t}\n\t\t\tprevious = parent\n\t\t\tparent = tree.getParent(parent.id)\n\t\t\tif (parent && tree.isGroundNode(parent)) break\n\t\t}\n\n\t\treturn (node.cache.repeatedAncestorRepeaterIds = ancestorRepeaterIds)\n\t}\n\n\treturn node.cache.repeatedAncestorRepeaterIds\n}\n\n/**\n * When trying to (re)create the `id` of an element in a code-generated page,\n * the pattern is based on the ancestor repeaters of the target node.\n *\n * What fills those patterns depends on the caller.\n *\n * `getValue` allows the caller to determine the value for each \"part\" of the\n * pattern, based on the id of the part. A partId can be the id of the node, or\n * the slug key of an ancestor repeater.\n *\n * In the future this function may allow for elements inside nested repeaters to\n * have ids by getting a part for each ancestor repeater instead of just the\n * first.\n */\nexport function scrollSectionPatternFromTree<T extends string | SafeJS>(\n\tnode: CanvasNode,\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tgetValue: (part: ScrollSectionPatternPart) => T | undefined,\n): T | undefined {\n\tconst id = getValue({ type: \"element\", id: node.id })\n\tif (!id) return undefined\n\n\tconst ancestorRepeaterIds = getAncestorRepeaterIds(node, tree)\n\n\t// Nodes outside of repeaters just need the base id.\n\tif (!ancestorRepeaterIds || ancestorRepeaterIds.length === 0) return id\n\n\treturn jst.join(\n\t\t[\n\t\t\t...ancestorRepeaterIds\n\t\t\t\t.map(repeaterId => {\n\t\t\t\t\tconst repeater = tree.get(repeaterId)\n\t\t\t\t\tassert(\n\t\t\t\t\t\trepeater && isDataRepeater(repeater),\n\t\t\t\t\t\t\"ElementIdCollector: RepeaterInfo must exist if recorded to ancestors.\",\n\t\t\t\t\t)\n\t\t\t\t\tconst data = componentLoader.dataForIdentifier(repeater.dataIdentifier)\n\t\t\t\t\tif (!data || !repeater.dataIdentifier) return undefined\n\n\t\t\t\t\tconst slugKey = data.annotations?.[AnnotationKey.FramerSlug]\n\t\t\t\t\tif (!slugKey) return undefined\n\n\t\t\t\t\tconst slugValue = getValue({\n\t\t\t\t\t\ttype: \"slug\",\n\t\t\t\t\t\tid: slugKey,\n\t\t\t\t\t\tproviderId: repeaterId,\n\t\t\t\t\t\tidentifier: repeater.dataIdentifier,\n\t\t\t\t\t})\n\t\t\t\t\tif (!isString(slugValue) && !isSafeJS(slugValue)) return undefined\n\n\t\t\t\t\treturn slugValue\n\t\t\t\t})\n\t\t\t\t.filter(isDefined),\n\t\t\tid,\n\t\t],\n\t\tscrollSectionPatternSeparator,\n\t) as T\n}\n", "import type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { isObject } from \"utils/typeChecks.ts\"\nimport type { NodeID } from \"../../nodes/NodeID.ts\"\n\n/**\n * In Framer, sometimes a value is bound to the value of a specific key of a\n * specific collection record. Currently we cannot generate code that always\n * resolves the correct value at runtime because we don't have a performant API\n * to query a collection without importing the entire collection and iterating\n * through the records.\n *\n * This means that for the time being, code-generation has to inline the value\n * at the time of generation.\n *\n * To support this, we store all the relevant information needed to know the\n * relationship between collections and dependents as a\n * ResolvedCollectionItemSelector.\n *\n * When updating a collection item's slug, the Framer editor looks up all\n * CanvasNode's that have a reference to that slug, and updates the values. This\n * in turn tells code-generation to update any code that depends on this\n * collection item value.\n *\n * @FIXME - In the future, when we have an efficient collection query API, we\n * should stop storing a value, and instead provide code-generation with the\n * means to get the up-to-date value when the code is executed. We can rename\n * this type to `CollectionItemSelector` to indicate it is no longer already\n * resolved to a value.\n */\nexport interface ResolvedCollectionItemSelector {\n\tidentifier: ModuleExportIdentifierString\n\tcollectionItemId: NodeID\n\tkey: NodeID\n\t/**\n\t * The value property is no longer read in newer versions of local\n\t * collection modules. Instead the value is resolved at runtime.\n\t *\n\t * IMPORTANT: The property cannot be removed because older projects with\n\t * uncompiled collection modules can exists. Also, external collection\n\t * modules cannot be updated by users, and currently we don't have a way to\n\t * resolve them at runtime. So we keep the value property around to support\n\t * these cases.\n\t */\n\tvalue: string\n}\n\nconst key: keyof ResolvedCollectionItemSelector = \"collectionItemId\"\nexport function isResolvedCollectionItemSelector(item: unknown): item is ResolvedCollectionItemSelector {\n\treturn isObject(item) && key in item\n}\n", "import type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { assert, assertNever, shouldBeNever } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { getAncestorRepeaterIds, scrollSectionPatternSeparator } from \"code-generation/utils/elementIdPatternForNode.ts\"\nimport { getRouteSegmentNodeByWebPageId } from \"document/components/chrome/Pages/utils/getRouteSegmentNodeByWebPageId.ts\"\nimport { getLocalizedValueForActiveLocale } from \"document/components/chrome/localization/getValueForActiveLocale.ts\"\nimport type { CanvasNode, CanvasTree, CollectionNode } from \"document/models/CanvasTree/index.ts\"\nimport type { VariableValueResolver } from \"document/models/CanvasTree/nodes/CanvasNodeCache.ts\"\nimport { isCollectionRepeater, isRouteSegmentNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { withScrollTarget } from \"document/models/CanvasTree/traits/WithScrollTarget.ts\"\nimport type { LinkToWebPage } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport type { ResolvedCollectionItemSelector } from \"document/models/CanvasTree/traits/utils/ResolvedCollectionItemSelector.ts\"\nimport { isResolvedCollectionItemSelector } from \"document/models/CanvasTree/traits/utils/ResolvedCollectionItemSelector.ts\"\nimport type { Locale as RouterLocale } from \"library/router/types.ts\"\nimport { slugify } from \"library/utils/slugify.ts\"\nimport { getCollectionForIdentifier } from \"utils/getCollectionForIdentifier.ts\"\nimport { getRouterLocales } from \"utils/getRouterLocales.ts\"\nimport { slugifyPathVariable } from \"utils/pathVariables.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\n\nexport enum SlugBehavior {\n\tResolve,\n\t/** Displays the slug variable in human readable form: `:slug` */\n\tDisplayName,\n}\n\nfunction getFirstPathVariableFromLink(\n\tlink: LinkToWebPage,\n): ResolvedCollectionItemSelector | VariableReference | undefined {\n\tfor (const key in link.pathVariables) {\n\t\tconst value = link.pathVariables[key]\n\t\tif (isResolvedCollectionItemSelector(value)) return value\n\t\tif (isVariableReference(value)) return value\n\t}\n}\n\nfunction getCollectionItemInfo(\n\tlink: LinkToWebPage,\n\tcollectionNode: CollectionNode,\n\tlocale: RouterLocale,\n):\n\t| {\n\t\t\tslugTitle: string\n\t\t\tslugVariable: VariableReference\n\t\t\tresolvedCollectionItemSelector?: undefined\n\t\t\tslugValue?: undefined\n\t  }\n\t| {\n\t\t\tslugTitle: string\n\t\t\tresolvedCollectionItemSelector: ResolvedCollectionItemSelector\n\t\t\tslugValue: string\n\t\t\tslugVariable?: undefined\n\t  }\n\t| undefined {\n\tconst slugVariable = collectionNode.getSlugVariable()\n\tconst slugTitle = slugVariable?.name ?? Dictionary.Unknown\n\n\tconst pathVariable = getFirstPathVariableFromLink(link)\n\tif (!pathVariable) return\n\tif (isResolvedCollectionItemSelector(pathVariable)) {\n\t\tconst itemToSlug = collectionNode.getItemToSlug(locale)\n\t\tconst slugValue = itemToSlug[pathVariable.collectionItemId]\n\t\tif (!slugValue) return\n\t\treturn { resolvedCollectionItemSelector: pathVariable, slugValue, slugTitle }\n\t}\n\n\tif (isVariableReference(pathVariable)) {\n\t\treturn { slugVariable: pathVariable, slugTitle }\n\t}\n\n\tshouldBeNever(pathVariable)\n}\n\nfunction getWebPagePathViaRouteSegments(\n\ttree: CanvasTree,\n\tlink: LinkToWebPage,\n\tslugBehavior: SlugBehavior,\n\tlocale: RouterLocale,\n\tvariableValueResolver: VariableValueResolver | undefined,\n): string | undefined {\n\tif (tree.root.homePageNodeId === link.webPageId) return \"/\"\n\n\tconst routeSegment = getRouteSegmentNodeByWebPageId(tree, link.webPageId)\n\tif (!routeSegment) return\n\n\tlet pagePath = \"\"\n\n\tfunction prependPathSegment(segment: string) {\n\t\tpagePath = \"/\" + segment + pagePath\n\t}\n\n\tlet segment: CanvasNode | null = routeSegment\n\twhile (isRouteSegmentNode(segment)) {\n\t\tconst currentSegment = segment\n\t\tsegment = tree.get(segment.parentid)\n\n\t\tconst collectionNode = currentSegment.dataIdentifier\n\t\t\t? getCollectionForIdentifier(tree, currentSegment.dataIdentifier)\n\t\t\t: undefined\n\n\t\tif (!collectionNode || !currentSegment.dataIdentifier) {\n\t\t\tlet segmentValue = currentSegment.segment\n\t\t\tif (tree.root.translatePagePaths === \"yes\") {\n\t\t\t\tconst localizedValue = getLocalizedValueForActiveLocale(locale, currentSegment.segmentLocalized)\n\t\t\t\tsegmentValue = localizedValue?.value || segmentValue\n\t\t\t}\n\t\t\tprependPathSegment(segmentValue)\n\t\t\tcontinue\n\t\t}\n\n\t\tconst collectionItemInfo = getCollectionItemInfo(link, collectionNode, locale)\n\t\tif (!collectionItemInfo) return\n\n\t\tif (slugBehavior === SlugBehavior.Resolve) {\n\t\t\tif (collectionItemInfo.slugVariable) {\n\t\t\t\tif (!variableValueResolver) return\n\n\t\t\t\tconst resolvedSlug = variableValueResolver.getVariableReferenceValue(collectionItemInfo.slugVariable, undefined)\n\t\t\t\tif (!isString(resolvedSlug)) return\n\n\t\t\t\tprependPathSegment(resolvedSlug)\n\t\t\t} else {\n\t\t\t\tprependPathSegment(collectionItemInfo.slugValue)\n\t\t\t}\n\t\t} else if (slugBehavior === SlugBehavior.DisplayName) {\n\t\t\tconst slugTitle = slugifyPathVariable(collectionItemInfo.slugTitle)\n\t\t\tprependPathSegment(`:${slugTitle}`)\n\t\t} else {\n\t\t\tassertNever(slugBehavior)\n\t\t}\n\t}\n\n\treturn pagePath\n}\n\nfunction getDefaultRouterLocale(tree: CanvasTree): RouterLocale {\n\tconst routerLocales = getRouterLocales(tree, \"includeDrafts\")\n\tconst defaultLocale = routerLocales[0]\n\tassert(defaultLocale, \"Default locale should always exist\")\n\treturn defaultLocale\n}\n\nfunction getResolvedHashVariableValue(\n\ttree: CanvasTree,\n\trepeaterDataIdentifier: ModuleExportIdentifierString,\n\thashVariable: ResolvedCollectionItemSelector | VariableReference,\n\tlocale: RouterLocale,\n\tvariableValueResolver: VariableValueResolver | undefined,\n): string | undefined {\n\tif (isResolvedCollectionItemSelector(hashVariable)) {\n\t\tconst collectionNode = getCollectionForIdentifier(tree, repeaterDataIdentifier)\n\t\tif (!collectionNode) return hashVariable.value\n\n\t\treturn collectionNode.getItemToSlug(locale)[hashVariable.collectionItemId] ?? hashVariable.value\n\t}\n\n\tif (!variableValueResolver) return undefined\n\n\tconst resolvedValue = variableValueResolver.getVariableReferenceValue(hashVariable, undefined)\n\treturn isString(resolvedValue) ? resolvedValue : undefined\n}\n\nfunction getMatchingHashVariable(\n\tlink: LinkToWebPage,\n\trepeaterId: string,\n\trepeaterDataIdentifier: ModuleExportIdentifierString,\n): ResolvedCollectionItemSelector | VariableReference | undefined {\n\tfor (const hashVariable of Object.values(link.hashVariables ?? {})) {\n\t\tif (!hashVariable) continue\n\n\t\tconst matchesRepeater =\n\t\t\t(isResolvedCollectionItemSelector(hashVariable) && hashVariable.identifier === repeaterDataIdentifier) ||\n\t\t\t(isVariableReference(hashVariable) && hashVariable.providerId === repeaterId)\n\t\tif (matchesRepeater) return hashVariable\n\t}\n}\n\nfunction getResolvedLinkHash(\n\ttree: CanvasTree,\n\tlink: LinkToWebPage,\n\tlocale: RouterLocale,\n\tvariableValueResolver: VariableValueResolver | undefined,\n): string | undefined {\n\tconst elementNode = link.hash ? tree.get(link.hash) : undefined\n\tif (!elementNode || !withScrollTarget(elementNode) || !elementNode.scrollTargetEnabled || !elementNode.elementId) {\n\t\treturn undefined\n\t}\n\n\tconst hashParts: string[] = []\n\tconst ancestorRepeaterIds = getAncestorRepeaterIds(elementNode, tree)\n\n\tfor (const repeaterId of ancestorRepeaterIds) {\n\t\tconst repeater = tree.get(repeaterId)\n\t\tif (!isCollectionRepeater(repeater)) continue\n\n\t\tconst hashVariable = getMatchingHashVariable(link, repeater.id, repeater.dataIdentifier)\n\t\tif (!hashVariable) return undefined\n\n\t\tconst resolvedValue = getResolvedHashVariableValue(\n\t\t\ttree,\n\t\t\trepeater.dataIdentifier,\n\t\t\thashVariable,\n\t\t\tlocale,\n\t\t\tvariableValueResolver,\n\t\t)\n\t\tif (!resolvedValue) return undefined\n\n\t\thashParts.push(resolvedValue)\n\t}\n\n\thashParts.push(slugify(elementNode.elementId))\n\treturn hashParts.join(scrollSectionPatternSeparator)\n}\n\nexport function getResolvedLinkToWebPage(\n\ttree: CanvasTree | undefined,\n\tlink: LinkToWebPage,\n\tslugBehavior: SlugBehavior,\n\toptionalLocale?: RouterLocale,\n\tvariableValueResolver?: VariableValueResolver,\n\tincludeLocalePrefix = true,\n) {\n\t/**\n\t * @FIXME - WebPage Path's could change and the code component\n\t * would not receive an up to date path value on the canvas.\n\t * Improve after open beta as this will only impact users who\n\t * try to use a link control with a user code component, and\n\t * expect an up to date value on the canvas. Since the control\n\t * is not documented, we can delay adding perfect support.\n\t */\n\tif (!tree) return\n\n\tconst locale = optionalLocale ?? getDefaultRouterLocale(tree)\n\n\tlet pagePath = getWebPagePathViaRouteSegments(tree, link, slugBehavior, locale, variableValueResolver)\n\tif (!pagePath) return\n\n\tconst resolvedHash = getResolvedLinkHash(tree, link, locale, variableValueResolver)\n\tif (resolvedHash) {\n\t\tpagePath = `${pagePath}#${resolvedHash}`\n\t}\n\n\tif (includeLocalePrefix && locale?.slug) {\n\t\tpagePath = `/${locale.slug}${pagePath}`\n\t}\n\n\treturn pagePath\n}\n", "import hash from \"@emotion/hash\"\nimport type { ComponentLoader } from \"@framerjs/framer-runtime\"\nimport type { ExportSpecifier } from \"@framerjs/framer-runtime/crossorigin\"\nimport type { ModuleExportIdentifier, ModuleExportIdentifierString, ModuleType } from \"@framerjs/shared\"\nimport { assert, getServiceMap, parseModuleIdentifier } from \"@framerjs/shared\"\nimport type { SerializableValue } from \"code-generation/js/SerializableValue.ts\"\nimport { js } from \"code-generation/js/js.ts\"\nimport type { SerializableCodeBoundaryOverridesParams } from \"code-generation/jsx/jsxTagNameForNode.ts\"\nimport type { CodeOverride } from \"document/models/CanvasTree/traits/WithCodeOverrides.ts\"\nimport type { ModulesStore } from \"document/stores/ModulesStore.ts\"\nimport { getTypeSlashName } from \"modules/utils.ts\"\nimport { safeTagName } from \"utils/names.ts\"\nimport { isArray, isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { SafeJS, isSafeJS, serializeJS } from \"../js/serializeJS.ts\"\nimport type { ImportBinding, Imports } from \"../types.ts\"\nimport { BindingCollector } from \"./BindingCollector.ts\"\n\nexport type ComposedImport = [SafeJS, SerializableValue] | SafeJS\n\n/**\n * Imports must specify an export specifier. Imports can specify a higher order\n * component to be wrapped in. If imports require a higher order component, they\n * cannot currently be lazy imported. If a component is lazy imported it must be\n * the default export, and provide an import binding to use as the name.\n */\ninterface AddImportOptions {\n\texportSpecifier: ExportSpecifier\n\timportBinding?: ImportBinding\n\tcomposeWithImports?: ComposedImport[]\n\tlazy?: false\n\tcontrols?: CodeOverride[\"controls\"]\n\tabsolute?: boolean\n}\n\ninterface LazyAddImportOptions extends Omit<AddImportOptions, \"importBinding\" | \"lazy\"> {\n\t// Lazy import (default OR named) \u2013 an alias (importBinding) is required so we can assign the constant\n\timportBinding: ImportBinding\n\tlazy: true\n}\n\nexport class ImportCollector {\n\t#imports: Imports = new Map()\n\t#composedImports = new Map<string, { name: SafeJS; importBindings: ComposedImport[] }>()\n\t#lazyImports = new Set<string>()\n\t#eagerImports = new Set<string>()\n\n\tprivate getImportKey(url: string, exportSpecifier: string) {\n\t\treturn `${url}#${exportSpecifier}`\n\t}\n\n\tconstructor(\n\t\tprivate readonly moduleType: ModuleType | undefined,\n\t\tprivate readonly componentLoader: ComponentLoader,\n\t\tprivate readonly modulesStore: ModulesStore,\n\t\tprivate readonly bindings: BindingCollector = new BindingCollector(),\n\t) {}\n\n\tprivate createSafeImportBinding(\n\t\turl: string,\n\t\t{\n\t\t\texportSpecifier,\n\t\t\timportBinding,\n\t\t}: {\n\t\t\texportSpecifier: ExportSpecifier\n\t\t\timportBinding?: ImportBinding\n\t\t},\n\t): SafeJS {\n\t\tconst existingURLMapping = this.#imports.get(url)\n\n\t\tif (existingURLMapping) {\n\t\t\tconst existingImportBinding = existingURLMapping.get(exportSpecifier)\n\t\t\t// If this exportSpecifier for this url has already been added, we\n\t\t\t// will already have generated a unique import binding, so we can\n\t\t\t// just return that.\n\t\t\tif (existingImportBinding) return existingImportBinding\n\n\t\t\t// Otherwise we need to generate a new safe import binding. Mark it\n\t\t\t// as reserved, and return it.\n\t\t\tconst safeImportBinding = this.bindings.create(importBinding ?? exportSpecifier)\n\t\t\texistingURLMapping.set(exportSpecifier, safeImportBinding)\n\t\t\treturn safeImportBinding\n\t\t} else {\n\t\t\t// If we haven't previously added an import from the url, create a\n\t\t\t// unique import binding, save the mapping, and return the import\n\t\t\t// binding.\n\t\t\tconst safeImportBinding = this.bindings.create(importBinding ?? exportSpecifier)\n\t\t\tthis.#imports.set(url, new Map([[exportSpecifier, safeImportBinding]]))\n\n\t\t\treturn safeImportBinding\n\t\t}\n\t}\n\n\t/**\n\t * Returns true if we have an import of the provided specifier that includes\n\t * the provided export specifier with the given binding (alias).\n\t */\n\tprivate hasImportBinding(\n\t\timportSpecifier: string,\n\t\texportSpecifier: ExportSpecifier,\n\t\tbinding: ImportBinding | SafeJS,\n\t): boolean {\n\t\tconst existingBinding = this.#imports.get(importSpecifier)?.get(exportSpecifier)\n\t\tif (!existingBinding) return false\n\t\t// String casting lets us do strict equality on any SafeJS values.\n\t\treturn String(existingBinding) === String(binding)\n\t}\n\n\t/**\n\t * Checks if `safeImportBinding` is the result of importing a \"framer\"\n\t * function given by `name`.\n\t */\n\tprivate isPredefinedComposeFunction(\n\t\tname:\n\t\t\t| \"withMeasuredSize\"\n\t\t\t| \"getPropertyControls\"\n\t\t\t| \"getFonts\"\n\t\t\t| \"withGeneratedLayoutId\"\n\t\t\t| \"withCodeBoundaryForOverrides\",\n\t\tcomposedImport: ComposedImport | undefined,\n\t): boolean {\n\t\tif (!composedImport) return false\n\t\tconst binding = bindingForComposedImport(composedImport)\n\t\treturn this.hasImportBinding(\"framer\", name, binding)\n\t}\n\n\t/**\n\t * Given a `safeImportBinding` such as \"motion.div\" (or, e.g.,\n\t * \"motion1.div\", which could be the case if \"motion\" was already taken),\n\t * returns the corresponding motion element (in this example: \"div\").\n\t *\n\t * If `safeImportBinding` does not reference an actual \"motion\" import from\n\t * \"framer\", the return value is undefined.\n\t */\n\tprivate getMotionElement(safeImportBinding: string) {\n\t\tconst [importBinding, property] = safeImportBinding.split(\".\", 2)\n\t\tif (this.hasImportBinding(\"framer-motion\", \"motion\", importBinding)) return property\n\t\treturn undefined\n\t}\n\n\t/**\n\t * For readability of the generated code, certain composed imports get to\n\t * have custom, idiomatic names\u2014e.g., getPropertyControls(Component) becomes\n\t * ComponentControls.\n\t */\n\tprivate composedName(composedFunction: ComposedImport, nameSoFar: string) {\n\t\tif (this.isPredefinedComposeFunction(\"withMeasuredSize\", composedFunction)) {\n\t\t\treturn `Measured${nameSoFar}`\n\t\t} else if (this.isPredefinedComposeFunction(\"getPropertyControls\", composedFunction)) {\n\t\t\treturn `${nameSoFar}Controls`\n\t\t} else if (this.isPredefinedComposeFunction(\"getFonts\", composedFunction)) {\n\t\t\treturn `${nameSoFar}Fonts`\n\t\t} else if (this.isPredefinedComposeFunction(\"withCodeBoundaryForOverrides\", composedFunction)) {\n\t\t\t// Make override import names look like `MotionDivWith<OverrideName>` and not `MotionDivWithCodeBoundaryForOverrides`\n\t\t\tassert(isArray(composedFunction), \"ImportCollector: withCodeBoundaryForOverrides must be composed with an array.\")\n\t\t\tconst controls = composedFunction[1]\n\t\t\tassert(\n\t\t\t\tisSerializableCodeBoundaryOverridesParams(controls),\n\t\t\t\t\"ImportCollector: withCodeBoundaryForOverrides must be composed with a WithCodeBoundaryForOverridesParams.\",\n\t\t\t)\n\t\t\treturn `${nameSoFar}${safeTagName(serializeJS(controls.override) + hash(controls.nodeId))}`\n\t\t} else {\n\t\t\tconst isFunctionWithControls = isArray(composedFunction)\n\t\t\tif (isFunctionWithControls) {\n\t\t\t\tconst [name, controls] = composedFunction\n\t\t\t\tconst controlHash = controls ? hash(JSON.stringify(controls)) : \"\"\n\t\t\t\treturn `${nameSoFar}${safeTagName(serializeJS(name) + controlHash)}`\n\t\t\t} else {\n\t\t\t\treturn `${nameSoFar}${safeTagName(serializeJS(composedFunction))}`\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate createSafeComposedImportReference(primaryImport: SafeJS, importBindings: ComposedImport[] = []): SafeJS {\n\t\tlet name = safeTagName(serializeJS(primaryImport))\n\t\tlet index = 0\n\n\t\t// If this is a `withGeneratedLayoutId(motion.div)`, call it a \"Frame\".\n\t\tconst firstHOC = importBindings[0]\n\t\tif (\n\t\t\tthis.getMotionElement(serializeJS(primaryImport)) === \"div\" &&\n\t\t\tthis.isPredefinedComposeFunction(\"withGeneratedLayoutId\", firstHOC)\n\t\t) {\n\t\t\tname = \"Frame\"\n\t\t\tindex = 1\n\t\t}\n\n\t\tfor (; index < importBindings.length; index++) {\n\t\t\tconst safeBinding = importBindings[index]\n\t\t\tassert(safeBinding, \"ImportCollector: A binding must not be falsy to be composed into a HOC definition.\")\n\t\t\tname = this.composedName(safeBinding, name)\n\t\t}\n\n\t\t// If we already have an identical \"composition\" of imports, let's\n\t\t// re-use the reference. Composed imports are considered identical if\n\t\t// they end up having the same name.\n\t\tconst existingImport = this.#composedImports.get(name)\n\t\tif (existingImport) return existingImport.name\n\n\t\t// Otherwise, create a new reference. `createSafeComponentName` will\n\t\t// ensure its uniqueness.\n\t\tconst safeName = this.bindings.create(name)\n\t\timportBindings.unshift(primaryImport)\n\t\tthis.#composedImports.set(name, { name: safeName, importBindings })\n\n\t\treturn safeName\n\t}\n\n\t/**\n\t * Resolves a URL before adding an import. Does nothing by default. Can be\n\t * replaced during testing for custom behaviors.\n\t */\n\tstatic resolveURL(url: string) {\n\t\treturn url\n\t}\n\n\taddImport(\n\t\turl: string,\n\t\t{ exportSpecifier, importBinding, composeWithImports, lazy }: AddImportOptions | LazyAddImportOptions,\n\t): SafeJS {\n\t\tconst nextURL = ImportCollector.resolveURL(url)\n\n\t\tconst [exportSpecifierRoot, property] = exportSpecifier.split(\".\", 2)\n\n\t\tlet safeImportBinding = this.createSafeImportBinding(nextURL, {\n\t\t\texportSpecifier: exportSpecifierRoot,\n\t\t\timportBinding,\n\t\t})\n\n\t\tif (property) {\n\t\t\t// We trust that the property is valid JavaScript.\n\t\t\tconst safeProperty = new SafeJS(property)\n\t\t\tsafeImportBinding = js`${safeImportBinding}.${safeProperty}`\n\t\t}\n\n\t\tconst importKey = this.getImportKey(nextURL, exportSpecifier)\n\t\tif (lazy) {\n\t\t\tthis.#lazyImports.add(importKey)\n\t\t} else {\n\t\t\tthis.#lazyImports.delete(importKey)\n\t\t\tthis.#eagerImports.add(importKey)\n\t\t}\n\n\t\tif (composeWithImports?.length) {\n\t\t\treturn this.createSafeComposedImportReference(new SafeJS(safeImportBinding), composeWithImports)\n\t\t}\n\n\t\treturn new SafeJS(safeImportBinding)\n\t}\n\n\taddModuleImport(\n\t\tidentifier: ModuleExportIdentifier | ModuleExportIdentifierString,\n\t\toptions: Pick<\n\t\t\tPartial<AddImportOptions | LazyAddImportOptions>,\n\t\t\t\"composeWithImports\" | \"absolute\" | \"lazy\" | \"exportSpecifier\" | \"importBinding\"\n\t\t> = {},\n\t) {\n\t\tconst specifiers = moduleImportSpecifiers(\n\t\t\tisString(identifier) ? parseModuleIdentifier(identifier) : identifier,\n\t\t\tthis.moduleType,\n\t\t\tthis.componentLoader,\n\t\t\tthis.modulesStore,\n\t\t\toptions?.absolute,\n\t\t)\n\n\t\tif (!specifiers.importSpecifier) return\n\n\t\treturn this.addImport(specifiers.importSpecifier, {\n\t\t\texportSpecifier: options.exportSpecifier ?? specifiers.exportSpecifier,\n\t\t\timportBinding: options.importBinding ?? specifiers.importBinding,\n\t\t\t...options,\n\t\t})\n\t}\n\n\tget statements(): SafeJS[] {\n\t\tif (this.#imports.size === 0) return []\n\n\t\tconst lazyImportBinding =\n\t\t\tthis.#lazyImports.size > 0 ? this.addImport(\"framer\", { exportSpecifier: \"lazy\" }) : undefined\n\n\t\tconst importStatements = new SafeJS.Set()\n\t\tconst lazyImports = new SafeJS.Set()\n\n\t\t// Sort imports by their import specifier, in alphabetical order.\n\t\tconst compare = new Intl.Collator(\"en\", { sensitivity: \"base\" }).compare\n\t\tconst imports = Array.from(this.#imports.entries()).sort(([url1], [url2]) => {\n\t\t\tconst value1 = specifierSortValue(url1)\n\t\t\tconst value2 = specifierSortValue(url2)\n\t\t\treturn value1 === value2 ? compare(url1, url2) : value1 - value2\n\t\t})\n\n\t\tfor (const [url, mapping] of imports) {\n\t\t\tlet defaultImportSpecifier: SafeJS | undefined\n\t\t\tlet wildCardImportSpecifier: SafeJS | undefined\n\t\t\tconst namedImportParts: SafeJS[] = []\n\n\t\t\tfor (const [exportSpecifier, importBinding] of mapping) {\n\t\t\t\tif (this.#lazyImports.has(this.getImportKey(url, exportSpecifier))) {\n\t\t\t\t\tassert(importBinding, \"Import Collector: Missing import binding for lazy import.\")\n\t\t\t\t\tassert(lazyImportBinding, \"Import Collector: Missing lazy import binding.\")\n\n\t\t\t\t\tconst importFunction = SafeJS.fn(js`import`, url)\n\t\t\t\t\tconst lazyFunction = SafeJS.fn(\n\t\t\t\t\t\tlazyImportBinding,\n\t\t\t\t\t\tjs`() => ${importFunction}`,\n\t\t\t\t\t\texportSpecifier === \"default\" ? undefined : exportSpecifier,\n\t\t\t\t\t)\n\t\t\t\t\tlazyImports.add(js`const ${importBinding} = ${lazyFunction};`)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif (exportSpecifier === \"default\") {\n\t\t\t\t\tif (importBinding) defaultImportSpecifier = new SafeJS(importBinding)\n\t\t\t\t} else if (exportSpecifier === \"*\") {\n\t\t\t\t\tif (!importBinding || serializeJS(importBinding) === \"*\") {\n\t\t\t\t\t\tthrow new Error(\"Import Collector: wildcard imports must have an import binding.\")\n\t\t\t\t\t}\n\t\t\t\t\twildCardImportSpecifier = js`* as ${importBinding}`\n\t\t\t\t} else {\n\t\t\t\t\tconst safeExportSpecifier = new SafeJS(exportSpecifier)\n\t\t\t\t\tnamedImportParts.push(\n\t\t\t\t\t\tisUndefined(importBinding) || exportSpecifier === serializeJS(importBinding)\n\t\t\t\t\t\t\t? safeExportSpecifier\n\t\t\t\t\t\t\t: js`${safeExportSpecifier} as ${importBinding}`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t\tnamedImportParts.sort((a, b) => compare(String(a), String(b)))\n\t\t\tconst namedImportSpecifiers = namedImportParts.length > 0 ? js`{ ${js.listFrom(namedImportParts)} }` : undefined\n\n\t\t\tconst importSpecifiers: SafeJS[] = []\n\t\t\tif (defaultImportSpecifier) importSpecifiers.push(defaultImportSpecifier)\n\n\t\t\t// If we have created a wildcard import as well as a named import,\n\t\t\t// create 2 separate import statements to support this behavior.\n\t\t\tif (wildCardImportSpecifier && namedImportSpecifiers) {\n\t\t\t\timportStatements.add(js`import ${wildCardImportSpecifier} from ${url};`)\n\t\t\t} else if (wildCardImportSpecifier) {\n\t\t\t\timportSpecifiers.push(wildCardImportSpecifier)\n\t\t\t}\n\t\t\tif (namedImportSpecifiers) importSpecifiers.push(namedImportSpecifiers)\n\n\t\t\tif (importSpecifiers.length > 0) {\n\t\t\t\timportStatements.add(js`import ${js.listFrom(importSpecifiers)} from ${url};`)\n\t\t\t}\n\t\t}\n\n\t\tconst composedImportStatements: SafeJS[] = []\n\t\tfor (const { name, importBindings } of this.#composedImports.values()) {\n\t\t\tcomposedImportStatements.push(createComposedImportStatement(name, importBindings))\n\t\t}\n\n\t\treturn [...importStatements, ...lazyImports, ...composedImportStatements]\n\t}\n}\n\n/**\n * Retrieve the specifiers used to import a module into generated code.\n */\nexport function moduleImportSpecifiers(\n\tidentifier: ModuleExportIdentifier,\n\tforType: ModuleType | undefined,\n\tcomponentLoader: ComponentLoader,\n\tmodulesStore: ModulesStore,\n\tabsolute?: boolean,\n\timportBindingOverride?: string,\n) {\n\tlet importSpecifier: string\n\tconst { exportSpecifier } = identifier\n\tconst component = componentLoader.componentForIdentifier(identifier.value)\n\tconst importBinding = safeTagName(importBindingOverride ?? component?.name)\n\tif (identifier.kind === \"localModuleExport\") {\n\t\tconst { localId } = identifier\n\t\tconst entry = modulesStore.getModuleEntryByLocalId(localId)\n\t\tif (!entry) return {}\n\t\tif (absolute) {\n\t\t\t// Get the persisted module to construct the absolute URL\n\t\t\tconst persistedModule = modulesStore.getPersistedModuleByLocalId(localId)\n\t\t\tif (!persistedModule) return {}\n\n\t\t\tconst { modulesCDN } = getServiceMap()\n\t\t\tconst fileName = persistedModule.files.module\n\t\t\tif (!fileName) return {}\n\n\t\t\timportSpecifier = `${modulesCDN}/${persistedModule.id}/${persistedModule.saveId}/${fileName}`\n\t\t} else {\n\t\t\timportSpecifier = entry.type === forType ? `./${entry.name}` : `../${getTypeSlashName(entry)}`\n\t\t}\n\t} else {\n\t\timportSpecifier = identifier.importSpecifier\n\t}\n\n\treturn { importSpecifier, exportSpecifier, importBinding }\n}\n\nfunction bindingForComposedImport(composedImport: ComposedImport): SafeJS {\n\tif (isArray(composedImport)) return composedImport[0]\n\treturn composedImport\n}\n\nfunction createComposedImportStatement(name: SafeJS, importBindings: ComposedImport[]) {\n\tconst [firstBinding, ...remainingBindings] = importBindings\n\tlet rightHandSide = isArray(firstBinding) ? firstBinding[0] : firstBinding\n\tassert(\n\t\trightHandSide,\n\t\t\"ImportCollector: An initial binding must be defined when creating a composed import statement.\",\n\t)\n\tfor (const composedImport of remainingBindings) {\n\t\tconst [binding, controls] = isArray(composedImport) ? composedImport : [composedImport, undefined]\n\t\tif (controls) {\n\t\t\trightHandSide = js`${binding}(${rightHandSide}, ${controls})`\n\t\t} else {\n\t\t\trightHandSide = js`${binding}(${rightHandSide})`\n\t\t}\n\t}\n\treturn js`const ${name} = ${rightHandSide};`\n}\n\n/**\n * Returns a number that can be used with `.sort(\u2026)` to order import specifiers by:\n * 1. Bare module specifiers\n * 2. URL specifiers\n * 3. Relative imports (outside current \"folder\")\n * 4. Relative imports (inside current \"folder\")\n */\nfunction specifierSortValue(specifier: string) {\n\tif (specifier.startsWith(\"./\")) {\n\t\treturn 4\n\t} else if (specifier.startsWith(\"../\")) {\n\t\treturn 3\n\t} else if (specifier.includes(\":\")) {\n\t\treturn 2\n\t} else {\n\t\treturn 1\n\t}\n}\n\nfunction isSerializableCodeBoundaryOverridesParams(value: unknown): value is SerializableCodeBoundaryOverridesParams {\n\treturn isObject(value) && isString(value.nodeId) && isString(value.scopeId) && isSafeJS(value.override)\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { clamp, cubicBezier, distance2D, mix, progress } from \"framer-motion\"\nimport { calcMaxRealisticShadowBlur, calcRealisticShadowSpread } from \"library/render/style/shadow.tsx\"\nimport { Color, P3Color } from \"library/render/types/Color/Color.ts\"\nimport { BoxShadow as LibraryBoxShadow } from \"library/render/types/Shadow.ts\"\nimport { isArray, isObject } from \"utils/typeChecks.ts\"\n\nfunction isLibraryBoxShadow(value: unknown): value is LibraryBoxShadow {\n\treturn isObject(value) && LibraryBoxShadow.is(value)\n}\n\nexport function isListOfLibraryBoxShadow(value: unknown): value is LibraryBoxShadow[] {\n\treturn isArray(value) && value.every(isLibraryBoxShadow)\n}\n\nconst generateBoxShadow = (\n\t{ inset, x, y, blur, spread, color }: LibraryBoxShadow,\n\tresolveColor?: (color: string) => string | undefined,\n) => {\n\tconst resolvedColor = resolveColor?.(color) ?? color\n\treturn `${inset ? \"inset \" : \"\"}${x}px ${y}px ${blur}px ${spread}px ${resolvedColor}`\n}\n\nexport function singleBoxShadowToCSS(shadow: LibraryBoxShadow, resolveColor?: (color: string) => string | undefined) {\n\tif (shadow.type === \"realistic\") {\n\t\treturn generateRealisticShadow(shadow, resolveColor)\n\t}\n\n\treturn generateBoxShadow(shadow, resolveColor)\n}\n\nexport function boxShadowToCSS(\n\tshadows: readonly LibraryBoxShadow[] | undefined,\n\t/**\n\t * Sometimes an empty string is wanted for an empty list, for example when it should override\n\t * the fallback value. Otherwise its impossible to clear the box shadow.\n\t */\n\temptyListBehavior: \"undefinedWhenEmpty\" | \"emptyStringWhenEmpty\",\n\tresolveColor?: (color: string) => string | undefined,\n): string | undefined {\n\tif (!shadows) return undefined\n\tif (shadows.length === 0) return emptyListBehavior === \"undefinedWhenEmpty\" ? undefined : \"\"\n\treturn shadows.map(shadow => singleBoxShadowToCSS(shadow, resolveColor)).join(\", \")\n}\n\nconst minNumShadows = 2\nconst maxNumShadows = 8\nconst maxDistance = 50\n\nconst zeroPoint = { x: 0, y: 0 }\nconst calcDistance = (x: number, y: number) => distance2D(zeroPoint, { x, y })\n\nconst ease = cubicBezier(0.7, 0.08, 0.85, 0.3)\n\nfunction getColorWithAlpha(color: string) {\n\tconst isP3 = Color.isP3String(color)\n\tif (isP3) {\n\t\tconst value = P3Color.fromString(color)\n\t\tassert(value, \"Invalid P3 color.\")\n\t\treturn {\n\t\t\talpha: value.a,\n\t\t\tsetAlpha: (alpha: number) => {\n\t\t\t\treturn value.toString(\"p3\", { a: alpha })\n\t\t\t},\n\t\t}\n\t}\n\n\tconst value = Color(color)\n\treturn {\n\t\talpha: value.a,\n\t\tsetAlpha: (alpha: number) => {\n\t\t\treturn Color.toRgbString(Color.alpha(value, alpha))\n\t\t},\n\t}\n}\n\nfunction generateRealisticShadow(\n\t{ x, y, diffusion, focus, color, inset }: LibraryBoxShadow,\n\tresolveColor?: (color: string) => string | undefined,\n) {\n\tlet shadow = \"\"\n\n\tconst distance = calcDistance(x, y)\n\tconst maxBlur = calcMaxRealisticShadowBlur(distance, focus)\n\tconst targetSpread = calcRealisticShadowSpread(diffusion)\n\tconst innerOpacity = mix(1, 0, diffusion)\n\tconst outerOpacity = mix(0, 1, diffusion)\n\n\tconst numShadows = Math.round(mix(minNumShadows, maxNumShadows, clamp(0, 1, progress(0, maxDistance, distance))))\n\n\tconst { alpha, setAlpha } = getColorWithAlpha(color)\n\n\tfor (let i = 1; i <= numShadows; i++) {\n\t\tconst p = progress(0, numShadows, i)\n\t\tconst easedP = ease(p)\n\n\t\tconst colorString = setAlpha(mix(innerOpacity, outerOpacity, easedP) * alpha)\n\t\tconst xLength = easedP * x\n\t\tconst yLength = easedP * y\n\t\tconst blur = easedP * maxBlur\n\t\tconst spread = p * targetSpread\n\n\t\tif (inset) shadow += \"inset \"\n\n\t\tshadow += `${xLength}px ${yLength}px ${blur}px ${spread}px ${resolveColor?.(colorString) ?? colorString}`\n\t\tif (i !== numShadows) shadow += \", \"\n\t}\n\n\treturn shadow\n}\n", "import hash from \"@emotion/hash\"\nimport type { ComponentLoader } from \"@framerjs/framer-runtime\"\nimport {\n\tassert,\n\tModuleType,\n\tassertNever,\n\tisModuleExportIdentifier,\n\tlocalModuleIdentifierForStableName,\n\tparseModuleIdentifier,\n} from \"@framerjs/shared\"\nimport type { SerializableRecord } from \"code-generation/js/SerializableValue.ts\"\nimport { SafeJS, SerializableObject, serializeJS } from \"code-generation/js/serializeJS.ts\"\nimport type { CollectorEntryNode, MakeSerializable } from \"code-generation/types.ts\"\nimport type { CanvasNode, CanvasTree, MaybeNodeID, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport {\n\tisLayoutTemplateNode,\n\tisSmartComponentNode,\n\tisWebPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { CustomCursor, NodeProvidingCursorComponent } from \"document/models/CanvasTree/traits/WithCursor.ts\"\nimport {\n\tCustomCursorType,\n\tisNodeProvidingCustomCursorComponent,\n\tisValidCustomCursor,\n\twithCursor,\n} from \"document/models/CanvasTree/traits/WithCursor.ts\"\nimport type { FloatingAlignment, FloatingPlacement } from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport {\n\tDEFAULT_FLOATING_ALIGNMENT,\n\tDEFAULT_FLOATING_PLACEMENT,\n} from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport { hasLayoutTemplate } from \"document/models/CanvasTree/traits/WithLayoutTemplate.ts\"\nimport {\n\ttype MotionTransition,\n\tfallbackPhysicsBasedSpringTransition,\n\ttoMotionTransition,\n} from \"document/models/Transition.ts\"\nimport type { ModulesStore } from \"document/stores/ModulesStore.ts\"\nimport type { Point } from \"framer-motion\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { FileDeclarationCollector } from \"./DeclarationCollector.ts\"\nimport type { FontCollector } from \"./FontCollector.ts\"\nimport type { ImportCollector } from \"./ImportCollector.ts\"\nimport { moduleImportSpecifiers } from \"./ImportCollector.ts\"\nimport type { VariableCollector } from \"./VariableCollector.ts\"\n\ninterface Cursor {\n\tid: NodeID\n\tplacement?: FloatingPlacement\n\talignment?: FloatingAlignment\n\toffset?: MakeSerializable<Point>\n\ttransition?: MotionTransition | undefined\n\tvariant: string | undefined\n}\n\ntype VariantId = NodeID\n\n/**\n * The id of the node that provides the cursor. Not the id of the smart\n * component node who's component will be used as the cursor.\n */\ntype NodeProvidingCursorId = NodeID\n\nexport class CustomCursorCollector {\n\tconstructor(\n\t\tprivate readonly entryNode: CollectorEntryNode,\n\t\tprivate readonly componentLoader: ComponentLoader,\n\t\tprivate readonly fonts: FontCollector,\n\t\tprivate readonly imports: ImportCollector,\n\t\tprivate readonly declarations: FileDeclarationCollector,\n\t\tprivate readonly variables: VariableCollector,\n\t\tprivate readonly modulesStore: ModulesStore,\n\t\tprivate readonly tree: CanvasTree,\n\t) {\n\t\tif (!isWebPageNode(this.entryNode) || !hasLayoutTemplate(this.entryNode)) return\n\n\t\tconst controls = componentLoader.componentForIdentifier(this.entryNode.layoutTemplateIdentifier)?.properties\n\t\tif (!controls) return\n\n\t\tassert(this.entryNode.isLoaded(), \"The entry node must be loaded.\")\n\n\t\t// Add any Custom Cursor control props to the list. They must be registered in the Web Page\n\t\t// so that providing the hash as a prop to the Layout Template instance can render the\n\t\t// correct cursor.\n\t\tconst controlProps = this.entryNode.getControlProps(controls)\n\t\tfor (const key in controlProps) {\n\t\t\tconst controlProp = controlProps[key]\n\t\t\tif (controlProp?.type !== ControlType.CustomCursor) continue\n\t\t\tif (isUndefined(controlProp.value) || isVariableReference(controlProp.value)) continue\n\t\t\tthis.addControl(key, this.entryNode, controlProp.value)\n\t\t}\n\t}\n\n\t/**\n\t * In order to reduce or avoid walking back up the tree to find the ancestor\n\t * of a node which sets the variant of an ancestor's cursor component, track\n\t * the id of the ancestor of each node encountered that provides a cursor\n\t * component. This allows us to first check if the parent is inheriting a\n\t * cursor, rather than walking back up to the ancestor that provides it.\n\t */\n\t#cursorInheritance = new Map<NodeID, NodeProvidingCursorId | undefined>()\n\n\t#cursors = new Map<NodeProvidingCursorId, Cursor>()\n\t#variants = new Map<NodeProvidingCursorId, { variant: VariantId; id: NodeID }[]>()\n\n\t/**\n\t * Record the string created from hashing the Cursor configuration for a\n\t * node, by the node's id, allowing us to consistently reference it in the\n\t * generated code..\n\t */\n\t#hashes: Record<NodeID, string> = {}\n\n\tget cursors() {\n\t\tif (!isWebPageNode(this.entryNode) && !isLayoutTemplateNode(this.entryNode)) return undefined\n\n\t\tconst cursors: SerializableRecord = {}\n\t\tconst bindings: Record<NodeID, SafeJS> = {}\n\n\t\t// 1. iterate through the cursors with components and create a binding\n\t\t//    for each one, importing the component.\n\t\tfor (const [id, cursor] of this.#cursors) {\n\t\t\tconst cursorHash = this.#hashes[id]\n\t\t\tif (!cursorHash) continue\n\n\t\t\t// Record the binding by id for lookup in the next step when\n\t\t\t// code-generating configs that set the variant of inherited\n\t\t\t// cursors, and record the binding by the hash for use in the hook\n\t\t\t// argument.\n\t\t\tbindings[id] = cursors[cursorHash] = this.declarations.dedupe(\"cursor\", {\n\t\t\t\talignment: cursor.alignment,\n\t\t\t\toffset: cursor.offset,\n\t\t\t\tplacement: cursor.placement,\n\t\t\t\ttransition: !isUndefined(cursor.transition)\n\t\t\t\t\t? this.declarations.dedupe(\"transition\", cursor.transition)\n\t\t\t\t\t: undefined,\n\t\t\t\tvariant: cursor.variant,\n\t\t\t\tcomponent: this.importCursorComponent(cursor.id),\n\t\t\t})\n\t\t}\n\n\t\t// 2. Iterate through the cursors that update the variant of an ancestor\n\t\t//    cursor, spreading the cursor settings of the ancestor, and\n\t\t//    defining the variant override. The result is something like:\n\t\t//\n\t\t//    { xxx: cursor1, yyy: { ...cursor1, variant: \"zzz\" } }\n\t\tfor (const [nodeId, overrides = []] of this.#variants) {\n\t\t\tconst binding = bindings[nodeId]\n\t\t\tif (!binding) continue\n\n\t\t\tfor (const { variant, id } of overrides) {\n\t\t\t\tconst cursor = new SerializableObject({ variant })\n\t\t\t\tSerializableObject.addSpreadAtStart(cursor, binding)\n\t\t\t\tconst cursorHash = this.#hashes[id]\n\t\t\t\tif (!cursorHash) continue\n\n\t\t\t\tcursors[cursorHash] = cursor\n\t\t\t}\n\t\t}\n\n\t\t// 3. Wrap the return value in the hook that reports the cursor object\n\t\t//    to the Custom Cursor Context on mount of the web page. We include\n\t\t//    this hook even when no cursors are necessary to tell the context\n\t\t//    it can stop listening for cursors when navigating to this page.\n\t\treturn SafeJS.fn(this.imports.addImport(\"framer\", { exportSpecifier: \"useCustomCursors\" }), cursors)\n\t}\n\n\tprivate getCursor(node: CanvasNode): Cursor | undefined {\n\t\tconst nodeProvidingCursor = this.getFallbackCursor(node)\n\t\tif (!withCursor(node) || !node.customCursorType || isVariableReference(node.customCursorType)) return\n\t\tif (!nodeProvidingCursor || !isString(nodeProvidingCursor.customCursorSmartComponentId)) {\n\t\t\treturn\n\t\t}\n\n\t\tconst smartComponent = this.tree.get(nodeProvidingCursor.customCursorSmartComponentId)\n\t\tif (!isSmartComponentNode(smartComponent)) return\n\n\t\tconst baseVariantId = smartComponent.getPossiblyNonLoadedBaseVariantId()\n\n\t\tswitch (node.customCursorType) {\n\t\t\tcase CustomCursorType.Component: {\n\t\t\t\tconst cursor = cursorFromValue(nodeProvidingCursor, baseVariantId)\n\n\t\t\t\tthis.#cursors.set(nodeProvidingCursor.id, cursor)\n\n\t\t\t\treturn cursor\n\t\t\t}\n\t\t\tcase CustomCursorType.Variant: {\n\t\t\t\tif (!node.customCursorVariant) return\n\n\t\t\t\tconst variant = node.customCursorVariant ?? baseVariantId\n\n\t\t\t\tconst overrides = this.#variants.get(nodeProvidingCursor.id) ?? []\n\t\t\t\toverrides.push({ variant, id: node.id })\n\t\t\t\tthis.#variants.set(nodeProvidingCursor.id, overrides)\n\n\t\t\t\t// Extract the cursor information from the node, ensuring it is\n\t\t\t\t// recorded to #cursors, so that a code generation can safely\n\t\t\t\t// reference it later\n\t\t\t\tconst cursor = this.getCursor(nodeProvidingCursor)\n\t\t\t\tif (!cursor) return\n\n\t\t\t\treturn { ...cursor, variant }\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tassertNever(node.customCursorType)\n\t\t}\n\t}\n\n\tprivate importCursorComponent(id: NodeID) {\n\t\tconst identifier = localModuleIdentifierForStableName(ModuleType.Canvas, id, \"default\").value\n\t\tconst moduleIdentifier = parseModuleIdentifier(identifier)\n\n\t\tassert(isModuleExportIdentifier(moduleIdentifier), \"A code component that is not a package must be a module.\")\n\n\t\tconst { importSpecifier, exportSpecifier, importBinding } = moduleImportSpecifiers(\n\t\t\tmoduleIdentifier,\n\t\t\tModuleType.Screen,\n\t\t\tthis.componentLoader,\n\t\t\tthis.modulesStore,\n\t\t)\n\n\t\tassert(importSpecifier, \"A module must have an import specifier.\")\n\n\t\tthis.fonts.addFontReference({\n\t\t\tcomponentIdentifier: identifier,\n\t\t\tfontReference: this.imports.addImport(importSpecifier, {\n\t\t\t\texportSpecifier,\n\t\t\t\timportBinding,\n\t\t\t\tcomposeWithImports: [this.imports.addImport(\"framer\", { exportSpecifier: \"getFonts\" })],\n\t\t\t}),\n\t\t})\n\n\t\treturn this.imports.addImport(importSpecifier, {\n\t\t\texportSpecifier,\n\t\t\timportBinding,\n\t\t})\n\t}\n\n\t/**\n\t * Some layers \"just\" specify the variant of the cursor component, but when\n\t * the mouse moves over this element, the actual component as well as all of\n\t * the additional cursor configurations should match those specified by the\n\t * nearest ancestor that has been given this configuration by the user. In\n\t * those cases we must walk up the tree to find the properties defined by\n\t * that ancestor to merge with the updated variant such that we can create\n\t * an accurate hash of all of the configuration, as well as generate code\n\t * that combines those configurations with this variant.\n\t */\n\tprivate searchForAncestorCursorComponent(node: CanvasNode): NodeID | undefined {\n\t\tif (!node.parentid) return\n\n\t\tlet id: MaybeNodeID = node.id\n\t\twhile (id) {\n\t\t\tconst maybeCursorComponentNode: CanvasNode | null = this.tree.get(id)\n\t\t\tif (!maybeCursorComponentNode) return undefined\n\n\t\t\t// If the node provides a cursor, return the node id.\n\t\t\tif (isNodeProvidingCustomCursorComponent(this.tree, maybeCursorComponentNode)) return id\n\t\t\tif (!maybeCursorComponentNode.parentid) return undefined\n\n\t\t\t// If we have already determined the cursor that the parent of this\n\t\t\t// node sets or inherits, return that cursor.\n\t\t\tif (this.#cursorInheritance.has(maybeCursorComponentNode.parentid)) {\n\t\t\t\treturn this.#cursorInheritance.get(maybeCursorComponentNode.parentid)\n\t\t\t}\n\n\t\t\t// Otherwise continue to walk up the tree.\n\t\t\tid = maybeCursorComponentNode.parentid\n\t\t}\n\t}\n\n\tprivate getFallbackCursor(node: CanvasNode): NodeProvidingCursorComponent | null {\n\t\tconst id = this.searchForAncestorCursorComponent(node)\n\n\t\tthis.#cursorInheritance.set(node.id, id)\n\n\t\tconst nodeProvidingCursor = this.tree.get(id)\n\n\t\treturn isNodeProvidingCustomCursorComponent(this.tree, nodeProvidingCursor) ? nodeProvidingCursor : null\n\t}\n\n\t/**\n\t * Determine the hashed cursor identifier for a node, recording the cursor\n\t * information for serialization into the generated component, and returning\n\t * the hash.\n\t */\n\tadd(node: CanvasNode): SafeJS | string | undefined {\n\t\tif (!withCursor(node)) return\n\t\tif (isVariableReference(node.customCursorType)) return this.variables.create(node.customCursorType)\n\t\tif (!isWebPageNode(this.entryNode) && !isLayoutTemplateNode(this.entryNode)) return\n\n\t\tconst cursor = this.getCursor(node)\n\t\tif (!cursor) return\n\n\t\tconst cursorString = serializeJS(cursor)\n\t\tif (!isString(cursorString)) return\n\n\t\t// Record the hash by the node id for consistent referencing later.\n\t\treturn (this.#hashes[node.id] = hash(cursorString))\n\t}\n\n\t/**\n\t * Determine the hashed cursor identifier for a code component's control\n\t * prop. This is distinct from CustomCursorCollector.add() in several ways:\n\t * 1. A single code component node may have multiple cursors for multiple\n\t *    control props, and that means we must not store the config against\n\t *    just the node.id.\n\t * 2. A code component cursor cannot set only a variant, and inherit the\n\t *    rest of the cursor configuration, so the extra work to determine an\n\t *    ancestor that this node inherits a cursor from is irrelevant.\n\t * 3. The data is not directly from `WithCursor`, but rather from the\n\t *    ControlProp of type ControlType.CustomCursor.\n\t */\n\taddControl(controlKey: string, node: CanvasNode, value: CustomCursor) {\n\t\tif (!isWebPageNode(this.entryNode) && !isLayoutTemplateNode(this.entryNode)) return\n\n\t\tconst smartComponent = this.tree.get(value.customCursorSmartComponentId)\n\t\tif (!isSmartComponentNode(smartComponent) || !isValidCustomCursor(value)) return\n\n\t\tconst cursor = cursorFromValue(value, smartComponent.getPossiblyNonLoadedBaseVariantId())\n\t\tconst key = `${node.id}-${controlKey}`\n\n\t\tthis.#cursors.set(key, cursor)\n\n\t\tconst cursorString = serializeJS(cursor)\n\t\tif (!isString(cursorString)) return\n\n\t\t// Record the hash by the node id for consistent referencing later.\n\t\treturn (this.#hashes[key] = hash(cursorString))\n\t}\n}\n\nfunction cursorFromValue(\n\tvalue: CustomCursor & { customCursorSmartComponentId: NodeID },\n\tbaseVariantId?: NodeID,\n): Cursor {\n\tconst offset: Point | undefined = value.customCursorFollow\n\t\t? { x: value.customCursorOffsetX ?? 0, y: value.customCursorOffsetY ?? 0 }\n\t\t: undefined\n\n\treturn {\n\t\tid: value.customCursorSmartComponentId,\n\t\tplacement: value.customCursorFollow ? (value.customCursorPlacement ?? DEFAULT_FLOATING_PLACEMENT) : undefined,\n\t\talignment: value.customCursorFollow ? (value.customCursorAlignment ?? DEFAULT_FLOATING_ALIGNMENT) : undefined,\n\t\tvariant: value.customCursorVariant ?? baseVariantId,\n\t\toffset,\n\t\ttransition: value.customCursorTransitionEnabled\n\t\t\t? toMotionTransition(value.customCursorTransition ?? fallbackPhysicsBasedSpringTransition)\n\t\t\t: undefined,\n\t}\n}\n\nexport function getCursorHash(value: CustomCursor, tree: CanvasTree) {\n\tconst smartComponent = tree.get(value.customCursorSmartComponentId)\n\tif (!isSmartComponentNode(smartComponent) || !isValidCustomCursor(value)) return\n\n\tconst cursor = cursorFromValue(value, smartComponent.getPossiblyNonLoadedBaseVariantId())\n\n\tconst cursorString = serializeJS(cursor)\n\tif (!isString(cursorString)) return\n\treturn hash(cursorString)\n}\n", "import type { ComponentLoader } from \"@framerjs/framer-runtime\"\nimport { AnnotationKey } from \"@framerjs/framer-runtime/crossorigin\"\nimport { assert, ModuleType, isEmptyObject, isModuleExportIdentifier, parseModuleIdentifier } from \"@framerjs/shared\"\nimport type { SerializableRecord, SerializableValue } from \"code-generation/js/SerializableValue.ts\"\nimport { js } from \"code-generation/js/js.ts\"\nimport { SafeJS, SerializableObject } from \"code-generation/js/serializeJS.ts\"\nimport type { RepeaterInfo } from \"code-generation/jsx/types.ts\"\nimport type { CollectorEntryNode, RecordWithSafeJS } from \"code-generation/types.ts\"\nimport { getRawWebPagePath } from \"document/components/utils/getWebPagePath.ts\"\nimport type { CanvasNode, CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport {\n\tisLayoutTemplateNode,\n\tisSmartComponentNode,\n\tisWebPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { createVariableReference, isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { hasScrollTarget } from \"document/models/CanvasTree/traits/WithScrollTarget.ts\"\nimport type { Link, LinkToWebPage, LinkVariables } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { isLinkToURL, isLinkToWebPage } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport type { ResolvedCollectionItemSelector } from \"document/models/CanvasTree/traits/utils/ResolvedCollectionItemSelector.ts\"\nimport { isResolvedCollectionItemSelector } from \"document/models/CanvasTree/traits/utils/ResolvedCollectionItemSelector.ts\"\nimport type { ModulesStore } from \"document/stores/ModulesStore.ts\"\nimport { extractPathVariables } from \"utils/pathVariables.ts\"\nimport { isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { BindingCollector } from \"./BindingCollector.ts\"\nimport type { ImportCollector } from \"./ImportCollector.ts\"\nimport type { VariableCollector } from \"./VariableCollector.ts\"\nimport {\n\ttype ScrollSectionPatternPart,\n\tisScrollSectionPattern,\n\tisScrollSectionPatternAnnotation,\n\tscrollSectionPatternFromAnnotation,\n\tscrollSectionPatternFromTree,\n} from \"./elementIdPatternForNode.ts\"\n\nexport interface SerializableLink\n\textends SerializableRecord, Omit<RecordWithSafeJS<Link>, \"pathVariables\" | \"hashVariables\" | \"type\"> {\n\tpathVariables?: Record<string, SafeJS | string>\n\tunresolvedPathSlugs?: Record<string, SerializableRecord>\n\tunresolvedHashSlugs?: Record<string, SerializableRecord>\n}\n\n// Keep in sync with UnresolvedLink in ResolveLinks.ts\nexport interface SerializableUnresolvedLink {\n\thref: SerializableLink | SafeJS | undefined\n\timplicitPathVariables?: SerializableRecord | SafeJS | undefined\n\t/**\n\t * The provided SerializableLink should be resolved to a Scroll Section id\n\t * (the hash of a link).\n\t */\n\trefKey?: boolean\n}\n\nexport function createUnresolvedSlug(collectionItem: ResolvedCollectionItemSelector) {\n\tconst identifier = parseModuleIdentifier(collectionItem.identifier)\n\n\tassert(isModuleExportIdentifier(identifier), \"Expected a module export identifier\")\n\n\t// External modules cannot by updated by users. Their slug values will not\n\t// be resolved at runtime, but instead embedded in generated code\n\tif (identifier.kind === \"externalModuleExport\") return undefined\n\n\tconst collectionId = identifier.localIdName\n\n\treturn {\n\t\tcollectionItemId: collectionItem.collectionItemId,\n\t\tcollectionId,\n\t}\n}\n\nexport class LinkCollector {\n\tprivate nodeUnresolvedLinks = new Map<NodeID, { binding: SafeJS; unresolvedLinks: SerializableUnresolvedLink[] }>()\n\n\tconstructor(\n\t\tprivate readonly entryNode: CollectorEntryNode,\n\t\tprivate readonly componentLoader: ComponentLoader,\n\t\tprivate readonly imports: ImportCollector,\n\t\tprivate readonly bindings: BindingCollector,\n\t\tprivate readonly variables: VariableCollector | undefined,\n\t\tprivate readonly tree: CanvasTree,\n\t\tprivate readonly modulesStore: ModulesStore,\n\t\t/**\n\t\t * The binding for `router` used to resolve links by `resolveLinks(link,\n\t\t * pathVariables, router)`, is provided by a hook, since the router\n\t\t * object is provided by a React Provider.\n\t\t *\n\t\t * In generated Rich Text in Collections, Rich Text is generated into a\n\t\t * React fragment, not a component. This means we cannot use the normal\n\t\t * method of using the `useRouter` hook to get a binding to the router,\n\t\t * since hooks are only valid in components.\n\t\t *\n\t\t * Instead, we wrap text that requires a reference to the router in a\n\t\t * <ProvideRouter> component that uses children-as-a-function pattern to\n\t\t * inject a binding to `router` into scope.\n\t\t *\n\t\t * Since the LinkCollector doesn't care how we are handling the router,\n\t\t * we provide a method to get a binding to the router when its required.\n\t\t *\n\t\t * This ensures that if we are importing the router from the library, we\n\t\t * only add the import when its needed, or if we are wrapping text in\n\t\t * <ProvideRouter>, we only add the definition for that component when\n\t\t * its needed.\n\t\t *\n\t\t * Sometimes we will not have a router binding, for instance when\n\t\t * creating a link in a collection for ControlType.Link. In those cases\n\t\t * we cannot resolve a link.\n\t\t */\n\t\tprivate readonly provideRouterBinding?: () => SafeJS,\n\t) {}\n\n\tresolve(node: CanvasNode, link: Link | VariableReference | undefined, repeaterInfo?: RepeaterInfo) {\n\t\tconst serializedLink = this.create(link)\n\n\t\tif (\n\t\t\tisVariableReference(link) &&\n\t\t\t(isSmartComponentNode(this.entryNode) || isLayoutTemplateNode(this.entryNode)) &&\n\t\t\tlink.providerId === this.entryNode.id\n\t\t) {\n\t\t\t// If the variable reference is provided by the smart component we\n\t\t\t// are generating, so is guaranteed to be provided by React props,\n\t\t\t// we don't need to wrap the variable reference in `resolveLink()`.\n\t\t\t// We can count on it already being resolved by the caller of this\n\t\t\t// component.\n\t\t\treturn serializedLink\n\t\t}\n\n\t\tif (isString(serializedLink) || isUndefined(serializedLink)) return serializedLink\n\n\t\t// If we haven't returned already, `link` is a `LinkToNode` or\n\t\t// `VariableReference`. We could `assert` this to let typescript know,\n\t\t// but we don't want to crash code-generation on the off chance bad data\n\t\t// gets into the system. Instead we early return undefined as an invalid\n\t\t// link can be dropped.\n\t\tif (!isLinkToWebPage(link) && !isVariableReference(link)) return undefined\n\n\t\tif (!this.provideRouterBinding) return undefined\n\n\t\tconst router = this.provideRouterBinding()\n\t\tconst linkArguments: SerializableValue[] = [serializedLink, router]\n\n\t\tconst additionalPathVariables = repeaterInfo && this.getAdditionalPathVariables(link, repeaterInfo)\n\t\tif (additionalPathVariables) linkArguments.push(additionalPathVariables)\n\n\t\treturn this.createResolvedBinding(node, serializedLink, additionalPathVariables)\n\t}\n\n\tgetUnresolvedLinksForNode(node: CanvasNode) {\n\t\treturn this.nodeUnresolvedLinks.get(node.getPrimaryId())\n\t}\n\n\t/**\n\t * Creates a new binding for links with unresolved slug values. All\n\t * unresolved links for a node will be collected so these links can resolve\n\t * in parallel. The function returns a binding to access the resolved\n\t * version of the link. This binding is accessible because any components\n\t * with unresolved links will be wrapped in a component responsible for\n\t * resolving the links, that has a render prop for \"children\" which provides\n\t * the binding.\n\t */\n\tcreateResolvedBinding(node: CanvasNode, link: SerializableLink | SafeJS, implicitPathVariables?: SerializableRecord) {\n\t\tconst nodeId = node.getPrimaryId()\n\t\tconst state = this.nodeUnresolvedLinks.get(nodeId) ?? {\n\t\t\tbinding: this.bindings.create(\"resolvedLinks\"),\n\t\t\tunresolvedLinks: [],\n\t\t}\n\n\t\tstate.unresolvedLinks.push({\n\t\t\timplicitPathVariables: implicitPathVariables ?? js`undefined`,\n\t\t\thref: link,\n\t\t})\n\t\tthis.nodeUnresolvedLinks.set(nodeId, state)\n\n\t\treturn js`${state.binding}[${state.unresolvedLinks.length - 1}]`\n\t}\n\n\tresolvePageScope(link: Link | DynamicValue | undefined) {\n\t\tassert(!isComputedValue(link), \"Page scope cannot be a computed value\")\n\t\tconst serializedLink = this.create(link)\n\n\t\tif (isString(serializedLink) || isUndefined(serializedLink)) return serializedLink\n\n\t\t// If we haven't returned already, `link` is a `LinkToNode` or\n\t\t// `VariableReference`. We could `assert` this to let typescript know,\n\t\t// but we don't want to crash code-generation on the off chance bad data\n\t\t// gets into the system. Instead we early return undefined as an invalid\n\t\t// link can be dropped.\n\t\tif (!isLinkToWebPage(link) && !isVariableReference(link)) return undefined\n\t\tif (!this.provideRouterBinding) return undefined\n\n\t\tconst router = this.provideRouterBinding()\n\t\tconst linkArguments: SerializableValue[] = [serializedLink, router]\n\n\t\treturn SafeJS.fn(this.imports.addImport(\"framer\", { exportSpecifier: \"resolvePageScope\" }), ...linkArguments)\n\t}\n\n\t/**\n\t * There are cases in which a Link will not provide all of the\n\t * variables required for the path of the target page.\n\t * - Legacy framer/page-link's did not include a variable binding path\n\t *   variables to some value.\n\t * - Links to a dynamic page path created inside a smart component, or from\n\t *   CMS rich text.\n\t *\n\t * As a result, in the case where:\n\t * -  we are in a repeater,\n\t * -  and we have a link to a page that requires path variables\n\t * -  and our link is missing any variables\n\t *\n\t * We must assume that we need to provide an object with variables based on\n\t * the mapped repeater data.\n\t */\n\tprivate getAdditionalPathVariables(link: LinkToWebPage | VariableReference, repeaterInfo: RepeaterInfo) {\n\t\t// If the link is a variable we must provide all path variables because\n\t\t// we don't know what page the link is to.\n\t\tconst pathVariables = this.getPathVariablesForRepeaterInfo(repeaterInfo)\n\t\tif (isVariableReference(link)) return pathVariables\n\n\t\tconst targetWebPage = this.tree.get(link.webPageId)\n\t\tif (!isWebPageNode(targetWebPage)) return undefined\n\t\tconst targetPagePath = getRawWebPagePath(this.tree, targetWebPage)\n\t\tif (!targetPagePath) return undefined\n\t\tconst targetPathVariables = targetPagePath ? extractPathVariables(targetPagePath) : undefined\n\t\tif (!targetPathVariables || targetPathVariables.length === 0) return undefined\n\n\t\tconst linkProvidesAllPathVariables =\n\t\t\tlink.pathVariables && linkHasPathVariables(link.pathVariables, new Set(targetPathVariables))\n\t\tif (linkProvidesAllPathVariables) return undefined\n\n\t\tif (!pathVariables) return undefined\n\t\treturn pathVariables\n\t}\n\n\t/**\n\t * Create a link from a variable reference, string, framer/page-link, or\n\t * Link.\n\t *\n\t * framer/page-links will be parsed and converted to a Link. Any Variable\n\t * References in Links will be converted to SafeJS, and any Resolved\n\t * Collection Item Selectors will be flattened to their resolved value.\n\t *\n\t * @FIXME - In the future, we would ideally not flatten Resolved Collection\n\t * Item Selectors to a string, but instead generate code that gets the\n\t * up-to-date value from the collection. This is currently not possible to\n\t * do in a performant way, as it would require importing the entire\n\t * collection, and iterating through the data until we found the desired\n\t * record. When a performant API exists to query collections, we should\n\t * reconsider this.\n\t */\n\tcreate(link: Link | VariableReference | undefined): SafeJS | SerializableLink | string | undefined {\n\t\tif (isUndefined(link)) return undefined\n\n\t\tif (isVariableReference(link)) {\n\t\t\treturn this.createVariable(link)\n\t\t}\n\n\t\t// AbsoluteURLs currently only support a url string, not variables. As\n\t\t// such we can code-generate these into the `href` value of `<Link>` as\n\t\t// a string. In the future, if we support variables for AbsoluteURLs,\n\t\t// like query string variables, we may want to provide the whole object.\n\t\t// This will be a safe code-generation change because <Link> must always\n\t\t// support a string href since it did in the past.\n\t\tif (isLinkToURL(link)) return link.url || undefined\n\t\treturn createLink(link, this.tree, this.componentLoader, this.modulesStore, (variable: VariableReference) =>\n\t\t\tthis.createVariable(variable),\n\t\t)\n\t}\n\n\tprivate createVariable(variable: VariableReference) {\n\t\tassert(this.variables, \"LinkCollector was initialized without VariableCollector\")\n\t\treturn this.variables.create(variable)\n\t}\n\n\tgetPathVariablesForRepeaterInfo(repeaterInfo: RepeaterInfo | undefined) {\n\t\tconst slugVariableId = repeaterInfo?.annotations?.[AnnotationKey.FramerSlug]\n\t\tif (!slugVariableId) return\n\n\t\tconst slugVariable = createVariableReference(slugVariableId, repeaterInfo.id)\n\t\treturn new SerializableObject({\n\t\t\t[slugVariableId]: this.createVariable(slugVariable),\n\t\t})\n\t}\n}\n\nexport function createLink(\n\tlink: LinkToWebPage,\n\ttree: CanvasTree,\n\tcomponentLoader: ComponentLoader,\n\tmodulesStore: ModulesStore,\n\tcreateVariable?: (variable: VariableReference) => SafeJS,\n) {\n\tlet pathVariables: SerializableLink[\"pathVariables\"] = undefined\n\tlet unresolvedPathSlugs: SerializableLink[\"unresolvedPathSlugs\"] = undefined\n\n\tfor (const variableKey in link.pathVariables) {\n\t\tconst variableValue = link.pathVariables[variableKey]\n\t\tif (!variableValue) continue\n\n\t\tif (isVariableReference(variableValue)) {\n\t\t\tpathVariables ??= {}\n\n\t\t\tconst value = createVariable?.(variableValue)\n\t\t\tif (!isUndefined(value)) pathVariables[variableKey] = value\n\t\t} else if (isResolvedCollectionItemSelector(variableValue) && isString(variableValue.value)) {\n\t\t\tconst collection = componentLoader.dataForIdentifier(variableValue.identifier)\n\t\t\tconst annotation = collection?.annotations?.[AnnotationKey.FramerCollectionUtils]\n\n\t\t\tif (isString(annotation)) {\n\t\t\t\tunresolvedPathSlugs ??= {}\n\n\t\t\t\tconst unresolvedSlug = createUnresolvedSlug(variableValue)\n\t\t\t\tif (unresolvedSlug) {\n\t\t\t\t\tunresolvedPathSlugs[variableKey] = unresolvedSlug\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Fallback in case async slug resolving for some reason.\n\t\t\t// Notice that value.value is deprecated. at some point in the future we want to get rid of this\n\t\t\t// Fallback behavior once we are confident in the async slug resolving.\n\t\t\tpathVariables ??= {}\n\t\t\tpathVariables[variableKey] = variableValue.value\n\t\t}\n\t}\n\n\treturn {\n\t\twebPageId: link.webPageId,\n\t\tpathVariables,\n\t\tunresolvedPathSlugs,\n\t\t...createLinkHash(link, tree, componentLoader, modulesStore, createVariable),\n\t}\n}\n\nfunction createLinkCollectingValues(\n\tlink: LinkToWebPage,\n\tcomponentLoader: ComponentLoader,\n\tcreateVariable?: (variable: VariableReference) => SafeJS,\n) {\n\tconst values: {\n\t\thashVariables: Record<string, SafeJS | string>\n\t\tunresolvedHashSlugs: Exclude<SerializableLink[\"unresolvedHashSlugs\"], undefined>\n\t} = {\n\t\thashVariables: {},\n\t\tunresolvedHashSlugs: {},\n\t}\n\n\treturn {\n\t\tvalues,\n\t\tcreateValue: ({ id, type }: ScrollSectionPatternPart) => {\n\t\t\tconst value = link.hashVariables?.[id]\n\t\t\tif (isVariableReference(value)) {\n\t\t\t\t// If we have a variable reference for a part of the link pattern,\n\t\t\t\t// we can return a placeholder to the pattern, and add the variable\n\t\t\t\t// reference to the hashVariables.\n\t\t\t\tconst hashValue = createVariable?.(value)\n\t\t\t\tif (!isUndefined(hashValue)) values.hashVariables[value.id] = hashValue\n\t\t\t\treturn `:${value.id}`\n\t\t\t} else if (isResolvedCollectionItemSelector(value)) {\n\t\t\t\tconst collection = componentLoader.dataForIdentifier(value.identifier)\n\t\t\t\tconst annotation = collection?.annotations?.[AnnotationKey.FramerCollectionUtils]\n\n\t\t\t\tif (isString(annotation)) {\n\t\t\t\t\tconst unresolvedSlug = createUnresolvedSlug(value)\n\t\t\t\t\tif (unresolvedSlug) values.unresolvedHashSlugs[value.key] = unresolvedSlug\n\n\t\t\t\t\t// Fallback in case async slug resolving for some reason.\n\t\t\t\t\t// Notice that value.value is deprecated. at some point in the future we want to get rid of this\n\t\t\t\t\t// Fallback behavior once we are confident in the async slug resolving.\n\t\t\t\t\tvalues.hashVariables[value.key] = value.value\n\n\t\t\t\t\t// Unresolved hashes are prefixed with the \":\" character\n\t\t\t\t\treturn `:${value.key}`\n\t\t\t\t} else {\n\t\t\t\t\t// If we have a resolved value for a part of the link pattern, we\n\t\t\t\t\t// can slugify it and inline it.\n\t\t\t\t\treturn value.value\n\t\t\t\t}\n\t\t\t} else if (type === \"slug\") {\n\t\t\t\t// In the case where the element requires a slug to define a\n\t\t\t\t// part of the hash pattern, but the Link does not provide a\n\t\t\t\t// VariableReference or a ResolvedCollectionItemSelector, the\n\t\t\t\t// link is invalid and we drop the hash to ensure the link is\n\t\t\t\t// valid.\n\t\t\t\treturn undefined\n\t\t\t}\n\n\t\t\t// Else we can return the part id placeholders, and expect the router\n\t\t\t// to resolve it based on path variables, or the router element map.\n\t\t\tif (type === \"element\") return `:${id}`\n\n\t\t\t// Else the link hash is invalid.\n\t\t\treturn undefined\n\t\t},\n\t}\n}\n\nfunction hashValuesWithoutEmptyObjects(link: Partial<SerializableLink>) {\n\treturn {\n\t\thash: link.hash,\n\t\thashVariables: isObject(link.hashVariables) && !isEmptyObject(link.hashVariables) ? link.hashVariables : undefined,\n\t\tunresolvedHashSlugs:\n\t\t\tisObject(link.unresolvedHashSlugs) && !isEmptyObject(link.unresolvedHashSlugs)\n\t\t\t\t? link.unresolvedHashSlugs\n\t\t\t\t: undefined,\n\t}\n}\n\nexport function createLinkHash(\n\tlink: LinkToWebPage,\n\ttree: CanvasTree,\n\tcomponentLoader: ComponentLoader,\n\tmodulesStore: ModulesStore,\n\tcreateVariable?: (variable: VariableReference) => SafeJS,\n) {\n\tif (!link.hash) return undefined\n\n\tconst { values, createValue } = createLinkCollectingValues(link, componentLoader, createVariable)\n\tconst annotation = modulesStore\n\t\t.forType(ModuleType.Screen)\n\t\t.getByStableName(link.webPageId)\n\t\t?.annotations(null, \"default\")?.[AnnotationKey.FramerScrollSections]\n\n\tconst webPage = tree.getNodeWithTrait(link.webPageId, isWebPageNode)\n\tif (!webPage) return undefined\n\n\t// If we are creating a link to a loaded Web Page, or we don't have an annotation, we can use\n\t// the tree to resolve the hash.\n\tif (webPage.isLoaded() || isUndefined(annotation)) {\n\t\tconst node = tree.get(link.hash)\n\t\tif (!node || !hasScrollTarget(node)) return undefined\n\t\tconst hash = scrollSectionPatternFromTree(node, tree, componentLoader, createValue)\n\t\treturn hashValuesWithoutEmptyObjects({ ...values, hash })\n\t}\n\n\t// If the annotation exists, but is not a scroll section path annotation, the target web page\n\t// has no scroll sections.\n\tif (!isScrollSectionPatternAnnotation(annotation)) return undefined\n\n\tconst info = annotation[link.hash]\n\tif (!isScrollSectionPattern(info)) return undefined\n\tconst hash = scrollSectionPatternFromAnnotation(info, createValue)\n\treturn hashValuesWithoutEmptyObjects({ ...values, hash })\n}\n\nfunction linkHasPathVariables(linkPathVariables: LinkVariables, pathVariables: Set<string>): boolean {\n\tconst pathVariablesMissingFromLink = new Set(pathVariables)\n\tfor (const variableKey in linkPathVariables) {\n\t\tconst value = linkPathVariables[variableKey]\n\t\tif (!isUndefined(value) && pathVariables.has(variableKey)) {\n\t\t\tpathVariablesMissingFromLink.delete(variableKey)\n\t\t}\n\t}\n\n\treturn pathVariablesMissingFromLink.size === 0\n}\n", "import type { AnyComponentLoader } from \"@framerjs/framer-runtime\"\nimport { AnnotationKey } from \"@framerjs/framer-runtime/crossorigin\"\nimport { type SerializableLink, createUnresolvedSlug } from \"code-generation/utils/LinkCollector.ts\"\nimport { scrollSectionPatternFromTree } from \"code-generation/utils/elementIdPatternForNode.ts\"\nimport type { CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { hasScrollTarget } from \"document/models/CanvasTree/traits/WithScrollTarget.ts\"\nimport {\n\ttype ResolvedCollectionItemSelector,\n\tisResolvedCollectionItemSelector,\n} from \"document/models/CanvasTree/traits/utils/ResolvedCollectionItemSelector.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\n\n/**\n * Create an { @see UnresolvedLink } for a scroll section reference.\n */\nexport function getUnresolvedLinkToScrollSection(\n\ttarget: NodeID,\n\tcollectionItem: ResolvedCollectionItemSelector | undefined,\n\ttree: CanvasTree,\n\tscopeId: NodeID,\n\tcomponentLoader: AnyComponentLoader,\n) {\n\tconst node = tree.get(target)\n\tif (!node || !hasScrollTarget(node)) return undefined\n\n\tlet unresolvedHashSlugs: SerializableLink[\"unresolvedHashSlugs\"] | undefined = undefined\n\n\tconst hash = scrollSectionPatternFromTree(node, tree, componentLoader, ({ id, type }) => {\n\t\tconst part =\n\t\t\tisResolvedCollectionItemSelector(collectionItem) && collectionItem.key === id ? collectionItem : undefined\n\t\tif (part) {\n\t\t\tconst collection = componentLoader.dataForIdentifier(part.identifier)\n\t\t\tconst annotation = collection?.annotations?.[AnnotationKey.FramerCollectionUtils]\n\n\t\t\tif (isString(annotation)) {\n\t\t\t\tunresolvedHashSlugs ??= {}\n\n\t\t\t\tconst unresolvedSlug = createUnresolvedSlug(part)\n\t\t\t\tif (unresolvedSlug) unresolvedHashSlugs[part.key] = unresolvedSlug\n\n\t\t\t\t// Unresolved hashes are prefixed with the \":\" character\n\t\t\t\treturn `:${part.key}`\n\t\t\t}\n\t\t}\n\n\t\t// Else we can return the part id placeholders, and expect the router\n\t\t// to resolve it based on path variables, or the router element map.\n\t\tif (type === \"element\") return `:${id}`\n\n\t\t// Else the link hash is invalid.\n\t\treturn undefined\n\t})\n\n\treturn {\n\t\thref: {\n\t\t\twebPageId: scopeId,\n\t\t\thash,\n\t\t\tunresolvedHashSlugs,\n\t\t},\n\t\trefKey: true,\n\t}\n}\n", "import { parseAssetReference } from \"@framerjs/assets\"\nimport { isNumber } from \"utils/typeChecks.ts\"\n\n/**\n * Extracts width and height from an image src. Supporting the following formats:\n * - data:framer/asset-reference,test.png?originalFilename=test.png&preferredSize=auto&width=300&height=150\n * - https://framerusercontent.com/images/test.jpg?width=1400&height=800\n * - test.png?width=300&height=150\n */\nexport function getPixelDimensionsFromImageSrc(src: string) {\n\tconst assetReference = parseAssetReference(src)\n\tif (assetReference) return assetReference.intrinsicSize\n\n\tconst search = src.split(\"?\")[1]\n\tif (!search) return undefined\n\n\t// Handle resolved relative and absolute URLs\n\tconst searchParams = new URLSearchParams(search)\n\tconst width = parseInt(searchParams.get(\"width\") ?? \"\", 10)\n\tconst height = parseInt(searchParams.get(\"height\") ?? \"\", 10)\n\n\treturn isNumber(width) && isNumber(height) ? { width, height } : undefined\n}\n", "import type { AssetResolver } from \"@framerjs/assets\"\nimport type { AnyComponentLoader, VerifiedControlDescription, VerifiedPropertyControls } from \"@framerjs/framer-runtime\"\nimport { assert, type ModuleExportIdentifierString, assertNever, shouldBeNever } from \"@framerjs/shared\"\nimport type { SerializableValue } from \"code-generation/js/SerializableValue.ts\"\nimport { type SafeJS, isSafeJS } from \"code-generation/js/serializeJS.ts\"\nimport { getCursorHash } from \"code-generation/utils/CustomCursorCollector.ts\"\nimport type { SerializableLink, SerializableUnresolvedLink } from \"code-generation/utils/LinkCollector.ts\"\nimport { getLocalizedValueForActiveLocale } from \"document/components/chrome/localization/getValueForActiveLocale.ts\"\nimport type { CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isFontValue, styleForFontValue } from \"document/models/controlProps/FontControlPropValue.ts\"\nimport type { FontPreview } from \"document/utils/FontPreviewTypes.ts\"\nimport { isPropertyControlFontPreview } from \"document/utils/FontPreviewTypes.ts\"\nimport { SlugBehavior, getResolvedLinkToWebPage } from \"document/utils/getResolvedLinkToWebPage.ts\"\nimport { getUnresolvedLinkToScrollSection } from \"document/utils/getUnresolvedLinkToScrollSection.ts\"\nimport { fontStore } from \"library/render/fonts/fontStore.ts\"\nimport type {\n\tControlDescription,\n\tFileControlDescription,\n\tImageControlDescription,\n\tLocation,\n\tResponsiveImageControlDescription,\n\tVectorSetItemControlDescription,\n\tWithOptional,\n} from \"library/render/types/PropertyControls.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { RenderTarget } from \"library/render/types/RenderEnvironment.ts\"\nimport type { Locale } from \"library/router/types.ts\"\nimport type { AssetResolverWithHash } from \"renderer/getAssetResolver.ts\"\nimport { boxShadowToCSS } from \"utils/boxShadowToCSS.ts\"\nimport { isNull, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { VariableValueResolver } from \"../CanvasTree/nodes/CanvasNodeCache.ts\"\nimport { isComputedValue, isComputedValueFromVariableReference } from \"../CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"../CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"../CanvasTree/traits/DynamicValue.ts\"\nimport type { FetchDataValueResolver } from \"../CanvasTree/traits/FetchDataValue.ts\"\nimport type { ResponsiveImage } from \"../CanvasTree/traits/ResponsiveImage.ts\"\nimport { isResponsiveImage } from \"../CanvasTree/traits/ResponsiveImage.ts\"\nimport type { CombinedVariableProviderValueMap } from \"../CanvasTree/traits/VariableProvider.ts\"\nimport type { VariableReference } from \"../CanvasTree/traits/VariableReference.ts\"\nimport { isVariableReference } from \"../CanvasTree/traits/VariableReference.ts\"\nimport { fallbackAltText } from \"../CanvasTree/traits/WithAltText.ts\"\nimport { type CustomCursor, isCustomCursor } from \"../CanvasTree/traits/WithCursor.ts\"\nimport { getLink, isLink, isLinkToURL, isLinkToWebPage } from \"../CanvasTree/traits/utils/Link.ts\"\nimport { isResolvedCollectionItemSelector } from \"../CanvasTree/traits/utils/ResolvedCollectionItemSelector.ts\"\nimport { numberToPixelString } from \"../CanvasTree/traits/utils/applyValueTransform.ts\"\nimport { computeValue } from \"../CanvasTree/traits/utils/computeValue.ts\"\nimport { getPixelDimensionsFromImageSrc } from \"../CanvasTree/traits/utils/getPixelDimensionsFromImageSrc.ts\"\nimport { isTokenCSSVariable } from \"../CanvasTree/utils/tokens.ts\"\nimport type { LocalizedTextValue, LocalizedValues } from \"../LocalizedValue.ts\"\nimport { getLocalizedValueText } from \"../LocalizedValue.ts\"\nimport type { Transition } from \"../Transition.ts\"\nimport { isTransition, toMotionTransition, toVekterTransition } from \"../Transition.ts\"\nimport { isRichTextDocument, type RichTextTreeValue } from \"../richText/richTextStorage.ts\"\nimport {\n\tborderColorKey,\n\tisBorderValues,\n\tisValidBorderReactCSSProperties,\n\ttoBorderReactCSSProperties,\n} from \"./BorderControlPropValue.ts\"\nimport type {\n\tControlProp,\n\tControlProps,\n\tFileControlProp,\n\tImageControlProp,\n\tLinkControlProp,\n\tScrollSectionRefSelector,\n\tVectorSetItemControlPropValue,\n} from \"./ControlProp.ts\"\nimport { withLocalizableControlPropValue } from \"./ControlProp.ts\"\nimport type { FontStyle } from \"./FontControlPropValue.ts\"\nimport { getControlFocalPosition } from \"./WithControlFocalPoint.ts\"\nimport type { ControlPropValueTransform } from \"./getControlPropValues.ts\"\nimport { getControlPropValue, getControlPropValues } from \"./getControlPropValues.ts\"\n\nexport interface ControlPropResolvers<\n\tResolvedAsset = string | SafeJS,\n\tResolvedResponsiveImage = ResponsiveImage | SerializableValue,\n\tResolvedRichText = SerializableValue,\n> {\n\tresolveDynamicValue: (dynamicValue: DynamicValue, control: VerifiedControlDescription) => unknown\n\tresolveAsset: (\n\t\tvalue: string | undefined,\n\t\tcontrol: ImageControlDescription | FileControlDescription,\n\t\tcontrolProp: ImageControlProp | FileControlProp,\n\t\tresolveImage: boolean,\n\t) => ResolvedAsset | undefined\n\tresolveResponsiveImage: (\n\t\tvalue: string | undefined,\n\t\tcontrol: ResponsiveImageControlDescription,\n\t\tcontrolProp: ImageControlProp,\n\t) => ResolvedResponsiveImage | undefined\n\tresolveLink: (\n\t\tcontrolKey: string,\n\t\tcontrolProp: LinkControlProp,\n\t\tcontrol: ControlDescription,\n\t) => string | SafeJS | SerializableLink | SerializableUnresolvedLink | undefined\n\tresolvePageScope: (value: unknown) => string | SafeJS | SerializableLink | undefined\n\tresolveFont: (controlKey: string, value: unknown) => FontStyle\n\tresolveLocalizedValue: (\n\t\tvalue: SerializableValue | RichTextTreeValue,\n\t\tlocalizedValues: LocalizedValues<LocalizedTextValue> | undefined,\n\t) => SerializableValue | RichTextTreeValue\n\t/** Optional resolver, used for plugins where CSS variables can't be resolved. */\n\tresolveTokenCSSVariable?: (value: string) => string | undefined\n\tresolveRichText?: (\n\t\tvalue: RichTextTreeValue,\n\t\thtmlLocalized: LocalizedValues<LocalizedTextValue> | undefined,\n\t) => ResolvedRichText\n\tresolveScrollSectionRef: (\n\t\tcontrolKey: string,\n\t\tvalue: ScrollSectionRefSelector | VariableReference | undefined,\n\t) => SafeJS | SerializableUnresolvedLink | undefined\n\tresolveCustomCursor: (\n\t\tcontrolKey: string,\n\t\tvalue: CustomCursor | VariableReference | undefined,\n\t) => SafeJS | string | undefined\n\tresolveVectorSetItem: (\n\t\tvalue: VectorSetItemControlPropValue | undefined,\n\t\tcontrol: VectorSetItemControlDescription,\n\t) => SafeJS | ModuleExportIdentifierString | React.ComponentType<unknown> | undefined\n\tresolveColor: (value: string) => string | undefined\n}\n\nfunction resolveColorLikeValue(value: unknown, resolvers: ControlPropResolvers<unknown, unknown, unknown>): unknown {\n\tif (resolvers.resolveTokenCSSVariable && isTokenCSSVariable(value)) {\n\t\treturn resolvers.resolveTokenCSSVariable(value)\n\t}\n\n\t// TODO: Canvas Components can only animate between variants when colors are all in the same\n\t// color space, so for those code components, color picker values need to be converted to\n\t// RGB(A). Because it would be really hard to catch all ways for a color to reach a Smart\n\t// Component (such as if the component is from another project, or if the value is coming in via\n\t// a variable), we always convert it to RGBA.\n\tif (isString(value)) return resolvers.resolveColor(value)\n\treturn value\n}\n\nfunction getControlPropValueTransform(\n\tresolvers: ControlPropResolvers<unknown, unknown, unknown>,\n): ControlPropValueTransform {\n\treturn (controlKey, controlProp, control) => {\n\t\tswitch (controlProp.type) {\n\t\t\tcase ControlType.EventHandler:\n\t\t\tcase ControlType.Slot:\n\t\t\t\tbreak\n\t\t\tcase ControlType.Border: {\n\t\t\t\tconst resolvedValue = isDynamicValue(controlProp.value)\n\t\t\t\t\t? resolvers.resolveDynamicValue(controlProp.value, control)\n\t\t\t\t\t: controlProp.value\n\n\t\t\t\tif (isSafeJS(resolvedValue)) return resolvedValue\n\n\t\t\t\tif (isBorderValues(resolvedValue) || isValidBorderReactCSSProperties(resolvedValue)) {\n\t\t\t\t\tconst border = toBorderReactCSSProperties(resolvedValue)\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...border,\n\t\t\t\t\t\t[borderColorKey]: resolveColorLikeValue(border[borderColorKey], resolvers),\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn undefined // Should never happen\n\t\t\t}\n\t\t\tcase ControlType.Transition: {\n\t\t\t\tif (isDynamicValue(controlProp.value)) {\n\t\t\t\t\treturn resolvers.resolveDynamicValue(controlProp.value, control)\n\t\t\t\t}\n\n\t\t\t\tif (!controlProp.value) return undefined\n\n\t\t\t\tconst transition: Transition = isTransition(controlProp.value)\n\t\t\t\t\t? controlProp.value\n\t\t\t\t\t: toVekterTransition(controlProp.value)\n\t\t\t\treturn toMotionTransition(transition)\n\t\t\t}\n\t\t\tcase ControlType.Enum:\n\t\t\tcase ControlType.Boolean:\n\t\t\tcase ControlType.Date:\n\t\t\tcase ControlType.Number:\n\t\t\tcase ControlType.Cursor:\n\t\t\tcase ControlType.String:\n\t\t\tcase ControlType.Array:\n\t\t\tcase ControlType.Gap:\n\t\t\tcase ControlType.Padding:\n\t\t\tcase ControlType.BorderRadius:\n\t\t\tcase ControlType.CollectionReference:\n\t\t\tcase ControlType.MultiCollectionReference:\n\t\t\tcase ControlType.LinkRelValues:\n\t\t\tcase ControlType.TrackingId: {\n\t\t\t\tif (isDynamicValue(controlProp.value)) {\n\t\t\t\t\treturn resolvers.resolveDynamicValue(controlProp.value, control)\n\t\t\t\t}\n\n\t\t\t\tconst optionalKey: keyof WithOptional = \"optional\"\n\t\t\t\tif (optionalKey in control && control[optionalKey] && isNull(controlProp.value)) return undefined\n\n\t\t\t\tif (withLocalizableControlPropValue(controlProp)) {\n\t\t\t\t\treturn resolvers.resolveLocalizedValue(controlProp.value, controlProp.valueLocalized)\n\t\t\t\t}\n\n\t\t\t\treturn controlProp.value\n\t\t\t}\n\t\t\tcase ControlType.VectorSetItem:\n\t\t\t\tassert(control.type === ControlType.VectorSetItem)\n\t\t\t\treturn resolvers.resolveVectorSetItem(controlProp.value, control)\n\t\t\tcase ControlType.RichText: {\n\t\t\t\tif (isDynamicValue(controlProp.value)) {\n\t\t\t\t\treturn resolvers.resolveDynamicValue(controlProp.value, control)\n\t\t\t\t}\n\t\t\t\tif (resolvers.resolveRichText) {\n\t\t\t\t\treturn resolvers.resolveRichText(controlProp.value, controlProp.valueLocalized)\n\t\t\t\t}\n\t\t\t\tconst value = controlProp.value\n\t\t\t\treturn resolvers.resolveLocalizedValue(value, controlProp.valueLocalized)\n\t\t\t}\n\t\t\tcase ControlType.BoxShadow: {\n\t\t\t\tif (isDynamicValue(controlProp.value)) {\n\t\t\t\t\treturn resolvers.resolveDynamicValue(controlProp.value, control)\n\t\t\t\t}\n\n\t\t\t\treturn boxShadowToCSS(controlProp.value, \"emptyStringWhenEmpty\", color => resolvers.resolveColor(color))\n\t\t\t}\n\t\t\tcase ControlType.Color: {\n\t\t\t\tconst resolvedValue = isDynamicValue(controlProp.value)\n\t\t\t\t\t? resolvers.resolveDynamicValue(controlProp.value, control)\n\t\t\t\t\t: controlProp.value\n\n\t\t\t\tif (isNull(resolvedValue)) return undefined\n\n\t\t\t\treturn resolveColorLikeValue(resolvedValue, resolvers)\n\t\t\t}\n\t\t\tcase ControlType.Link:\n\t\t\t\treturn resolvers.resolveLink(controlKey, controlProp, control)\n\t\t\tcase ControlType.ScrollSectionRef:\n\t\t\t\treturn resolvers.resolveScrollSectionRef(controlKey, controlProp.value)\n\t\t\tcase ControlType.CustomCursor:\n\t\t\t\treturn resolvers.resolveCustomCursor(controlKey, controlProp.value)\n\t\t\tcase ControlType.PageScope:\n\t\t\t\treturn resolvers.resolvePageScope(controlProp.value)\n\t\t\tcase ControlType.Font:\n\t\t\t\treturn resolvers.resolveFont(controlKey, controlProp.value)\n\t\t\tcase ControlType.Image:\n\t\t\tcase ControlType.File: {\n\t\t\t\tassert(\n\t\t\t\t\tcontrol.type === ControlType.Image ||\n\t\t\t\t\t\tcontrol.type === ControlType.ResponsiveImage ||\n\t\t\t\t\t\tcontrol.type === ControlType.File,\n\t\t\t\t)\n\n\t\t\t\tconst resolvedValue = isDynamicValue(controlProp.value)\n\t\t\t\t\t? resolvers.resolveDynamicValue(controlProp.value, control)\n\t\t\t\t\t: controlProp.value\n\n\t\t\t\t// Data from the CMS contains responsive images which are already resolved\n\t\t\t\tif (isResponsiveImage(resolvedValue)) {\n\t\t\t\t\tif (control.type === ControlType.Image) {\n\t\t\t\t\t\treturn resolvedValue.src\n\t\t\t\t\t}\n\t\t\t\t\tif (control.type === ControlType.ResponsiveImage) {\n\t\t\t\t\t\treturn addDimensionsToResponsiveImage(resolvedValue)\n\t\t\t\t\t}\n\t\t\t\t\tthrow Error(\"Only image and responsive image support responsive images\")\n\t\t\t\t}\n\n\t\t\t\tif (!isString(resolvedValue)) {\n\t\t\t\t\treturn resolvedValue\n\t\t\t\t}\n\n\t\t\t\tconst isLegacyImage = control.type === ControlType.Image\n\t\t\t\tif (control.type === ControlType.File || isLegacyImage) {\n\t\t\t\t\treturn resolvers.resolveAsset(resolvedValue, control, controlProp, isLegacyImage)\n\t\t\t\t}\n\n\t\t\t\tassert(controlProp.type === ControlType.Image)\n\t\t\t\treturn addDimensionsToResponsiveImage(resolvers.resolveResponsiveImage(resolvedValue, control, controlProp))\n\t\t\t}\n\t\t\tcase ControlType.Location: {\n\t\t\t\tif (isVariableReference(controlProp.value)) {\n\t\t\t\t\treturn resolvers.resolveDynamicValue(controlProp.value, control)\n\t\t\t\t}\n\t\t\t\tif (!controlProp.value) return undefined\n\t\t\t\tconst location: Location = { coordinate: controlProp.value }\n\t\t\t\tif (controlProp.title) location.title = controlProp.title\n\t\t\t\tif (controlProp.address) location.address = controlProp.address\n\t\t\t\treturn location\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tassertNever(controlProp, \"All control prop types should be handled.\")\n\t\t}\n\t}\n}\n\n/**\n * Returned value doesn't include slots and event handlers. These are handled separately.\n */\nexport function getResolvedControlPropValues(\n\tcontrols: VerifiedPropertyControls,\n\tcontrolProps: ControlProps,\n\tresolvers: ControlPropResolvers<unknown, unknown, unknown>,\n): Record<string, unknown> {\n\tconst transformValue = getControlPropValueTransform(resolvers)\n\treturn getControlPropValues(controls, controlProps, transformValue)\n}\n\nexport function getResolvedControlPropValue(\n\tcontrol: VerifiedControlDescription,\n\tcontrolProp: ControlProp,\n\tresolvers: ControlPropResolvers<unknown, unknown, unknown>,\n) {\n\tconst transformValue = getControlPropValueTransform(resolvers)\n\treturn getControlPropValue(control, controlProp, transformValue)\n}\n\ninterface GetControlPropValueResolvers {\n\tvariableOverrides?: CombinedVariableProviderValueMap\n\tassetResolverWithHash: AssetResolverWithHash | null\n\tvariableValueResolver: VariableValueResolver\n\tgetResolvedFetchDataValue: FetchDataValueResolver | undefined\n\tgetVariableControlByReference(ref: VariableReference): VerifiedControlDescription | undefined\n\tgetCanvasTree(): CanvasTree | undefined\n\tactiveLocale?: Locale\n\tcomponentLoader: AnyComponentLoader\n\tscopeId?: NodeID\n\tfontPreview?: FontPreview | null\n\tresolveVectorSetItem?: ControlPropResolvers[\"resolveVectorSetItem\"]\n}\n\nexport function getControlPropValueResolvers({\n\tassetResolverWithHash,\n\tvariableOverrides,\n\tvariableValueResolver,\n\tgetVariableControlByReference,\n\tgetResolvedFetchDataValue,\n\tgetCanvasTree,\n\tactiveLocale,\n\tcomponentLoader,\n\tscopeId,\n\tfontPreview,\n\tresolveVectorSetItem: resolveVectorSetItemOverride,\n}: GetControlPropValueResolvers): ControlPropResolvers {\n\treturn {\n\t\tresolveAsset: (value, _control, controlProp) => {\n\t\t\tif (withLocalizableControlPropValue(controlProp)) {\n\t\t\t\tconst localizedValue = getLocalizedValueForActiveLocale(activeLocale, controlProp.valueLocalized)\n\t\t\t\tif (isString(localizedValue?.value) && localizedValue.value) value = localizedValue.value\n\t\t\t}\n\t\t\treturn resolveAssetValue(value, assetResolverWithHash?.assetResolver)\n\t\t},\n\t\tresolveResponsiveImage: (value, _control, controlProp) => {\n\t\t\tlet { positionX, positionY } = getControlFocalPosition(controlProp)\n\n\t\t\tif (withLocalizableControlPropValue(controlProp)) {\n\t\t\t\tconst localizedValue = getLocalizedValueForActiveLocale(activeLocale, controlProp.valueLocalized)\n\t\t\t\tif (isString(localizedValue?.value)) {\n\t\t\t\t\tvalue = localizedValue.value\n\t\t\t\t\tpositionX = localizedValue.imageFocalPoint?.positionX\n\t\t\t\t\tpositionY = localizedValue.imageFocalPoint?.positionY\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst src = resolveAssetValue(value, assetResolverWithHash?.assetResolver)\n\t\t\tif (!src) return\n\n\t\t\tlet alt = controlProp.alt ?? fallbackAltText\n\t\t\tconst localizedAltValue = getLocalizedValueForActiveLocale(activeLocale, controlProp.altLocalized)\n\t\t\tif (localizedAltValue && isString(localizedAltValue.value)) alt = localizedAltValue.value\n\n\t\t\treturn {\n\t\t\t\tsrc,\n\t\t\t\talt,\n\t\t\t\tsrcSet: undefined,\n\t\t\t\tpositionX,\n\t\t\t\tpositionY,\n\t\t\t}\n\t\t},\n\t\tresolveDynamicValue: (value, control) => {\n\t\t\tlet resolvedValue: unknown\n\t\t\tif (isVariableReference(value)) {\n\t\t\t\tresolvedValue = variableValueResolver.getVariableReferenceValue(value, variableOverrides)\n\t\t\t} else if (isComputedValue(value)) {\n\t\t\t\tresolvedValue = computeValue(\n\t\t\t\t\tvalue,\n\t\t\t\t\tvariableValueResolver,\n\t\t\t\t\tvariableOverrides,\n\t\t\t\t\tisComputedValueFromVariableReference(value) ? getVariableControlByReference(value.startValue) : undefined,\n\t\t\t\t\tcontrol,\n\t\t\t\t\tactiveLocale,\n\t\t\t\t\tundefined,\n\t\t\t\t\tgetResolvedFetchDataValue,\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tshouldBeNever(value)\n\t\t\t\treturn undefined\n\t\t\t}\n\n\t\t\tif (control.type === ControlType.Padding || control.type === ControlType.BorderRadius) {\n\t\t\t\treturn numberToPixelString(resolvedValue)\n\t\t\t}\n\t\t\treturn resolvedValue\n\t\t},\n\t\tresolveLink: (_controlKey, controlProp) => {\n\t\t\tconst value = controlProp.value\n\t\t\tconst resolvedValue = isVariableReference(value)\n\t\t\t\t? variableValueResolver.getVariableReferenceValue(value, variableOverrides)\n\t\t\t\t: value\n\t\t\tconst link = getLink(resolvedValue)\n\t\t\tif (!isLink(link)) return\n\t\t\tif (isLinkToURL(link)) return link.url\n\t\t\tif (isLinkToWebPage(link)) {\n\t\t\t\treturn getResolvedLinkToWebPage(\n\t\t\t\t\tgetCanvasTree(),\n\t\t\t\t\tlink,\n\t\t\t\t\tSlugBehavior.Resolve,\n\t\t\t\t\tactiveLocale,\n\t\t\t\t\tvariableValueResolver,\n\t\t\t\t)\n\t\t\t}\n\t\t\tshouldBeNever(link)\n\t\t},\n\t\tresolvePageScope: value => {\n\t\t\tconst link = getLink(value)\n\t\t\tif (!isLinkToWebPage(link)) return\n\t\t\treturn getResolvedLinkToWebPage(getCanvasTree(), link, SlugBehavior.DisplayName)\n\t\t},\n\t\tresolveFont: (controlKey, value) => {\n\t\t\tif (!isFontValue(value)) return {}\n\n\t\t\t// Check if there's a font preview for this control prop.\n\t\t\t//\n\t\t\t// We implement the font preview in resolveFont, because that is the only place\n\t\t\t// where the controlKey comes together with the value of the property control. Afterwards, it\n\t\t\t// is already transformed by styleForFontValue, and before it is only being passed around in\n\t\t\t// generic code that decouples the value of these property controls from the transforms that\n\t\t\t// need to happen.\n\t\t\t//\n\t\t\t// The font is already loaded in CanvasSandboxApp, so no need to do it here again\n\t\t\tif (fontPreview && isPropertyControlFontPreview(fontPreview) && fontPreview.controlKey === controlKey) {\n\t\t\t\treturn styleForFontValue({ ...value, fontSelector: fontPreview.fontSelector })\n\t\t\t}\n\n\t\t\tvoid fontStore.loadFonts([value.fontSelector])\n\t\t\treturn styleForFontValue(value)\n\t\t},\n\t\tresolveLocalizedValue: (value, localizedValues) => {\n\t\t\tconst localizedValue = getLocalizedValueForActiveLocale(activeLocale, localizedValues)\n\t\t\tif (localizedValue?.value === null) return null\n\n\t\t\tconst localizedRawValue = localizedValue?.value\n\t\t\tif (isString(localizedRawValue) && (localizedValue?.type === \"rich-text\" || isRichTextDocument(value))) {\n\t\t\t\treturn localizedRawValue\n\t\t\t}\n\t\t\tif (isRichTextDocument(localizedRawValue)) {\n\t\t\t\treturn localizedRawValue\n\t\t\t}\n\t\t\t// Defensive: rich text controls should go through `resolveRichText`. If routing changes,\n\t\t\t// avoid flattening RichTextDocument values through this string-only localized value path.\n\t\t\tif (isRichTextDocument(value)) return value\n\t\t\treturn getLocalizedValueText(localizedValue, { preserveNewLines: true }) ?? value\n\t\t},\n\t\tresolveScrollSectionRef: (_controlKey, value) => {\n\t\t\tconst tree = getCanvasTree()\n\t\t\t// Scroll Section Refs can be resolved to UnresolvedLinks for Layout\n\t\t\t// Template props when scopeId is provided.\n\t\t\t//\n\t\t\t// @TODO - in future perhaps we can also provide unresolved links on\n\t\t\t// the canvas by wrapping instances in ResolveLinks.\n\t\t\tif (!tree || !scopeId || !value || isVariableReference(value)) return undefined\n\t\t\tif (isVariableReference(value.target) || isUndefined(value.target)) return undefined\n\n\t\t\treturn getUnresolvedLinkToScrollSection(\n\t\t\t\tvalue.target,\n\t\t\t\tisResolvedCollectionItemSelector(value.collectionItem) ? value.collectionItem : undefined,\n\t\t\t\ttree,\n\t\t\t\tscopeId,\n\t\t\t\tcomponentLoader,\n\t\t\t)\n\t\t},\n\t\tresolveCustomCursor: (_key, value) => {\n\t\t\tconst resolvedValue = isVariableReference(value)\n\t\t\t\t? variableValueResolver.getVariableReferenceValue(value, variableOverrides)\n\t\t\t\t: value\n\n\t\t\tif (!isCustomCursor(resolvedValue)) return undefined\n\n\t\t\tconst tree = getCanvasTree()\n\t\t\tif (!tree) return undefined\n\n\t\t\treturn getCursorHash(resolvedValue, tree)\n\t\t},\n\t\t// Vector Set Item instances get resolved on the Canvas via modules runtime.\n\t\tresolveVectorSetItem: resolveVectorSetItemOverride ?? (_value => undefined),\n\t\tresolveColor: value => value,\n\t}\n}\n\nfunction resolveAssetValue(value: unknown, assetResolver: AssetResolver | undefined): string | undefined {\n\tif (!isString(value) && !isUndefined(value)) return\n\tconst resolvedValue = assetResolver?.(value, {\n\t\tisFramerResourceURL: true,\n\t\tisExport: RenderTarget.current() === RenderTarget.export,\n\t})\n\treturn resolvedValue ?? value ?? undefined\n}\n\nfunction addDimensionsToResponsiveImage<T extends ResponsiveImage | unknown | undefined>(image: T): T {\n\tif (!isResponsiveImage(image)) return image\n\n\tconst dimensions = getPixelDimensionsFromImageSrc(image.src)\n\treturn {\n\t\t...image,\n\t\tpixelWidth: dimensions?.width,\n\t\tpixelHeight: dimensions?.height,\n\t}\n}\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AO;AAAA,IAC5C,qBAAqB;AAAA,IACrB,UAAU,aAAa,QAAQ,MAAM,aAAa;AAAA,EACnD,CAAC;AACD,SAAO,iBAAiB,SAAS;AAClC;AAEA,SAAS,+BAAgF,OAAa;AACrG,MAAI,CAAC,kBAAkB,KAAK,EAAG,QAAO;AAEtC,QAAM,aAAa,+BAA+B,MAAM,GAAG;AAC3D,SAAO;AAAA,IACN,GAAG;AAAA,IACH,YAAY,YAAY;AAAA,IACxB,aAAa,YAAY;AAAA,EAC1B;AACD;",
  "names": ["Hsluv", "hex", "l", "prefix", "EventEmitter", "l", "isValidElementType", "Element", "Fragment", "Memo", "Suspense", "isFragment", "version", "m", "parse", "version", "parse", "version", "parse", "version", "version", "parse", "version2", "prefix", "parse", "version", "compare", "compare", "compare", "compare", "gt", "compare", "compare", "compare", "compare", "compare", "gt", "parse", "version", "key", "first", "cached", "cache", "version", "m", "m", "version", "version", "gt", "minVersion", "require_valid", "gt", "version", "version", "version", "compare", "first", "version", "compare", "gt", "require_semver", "parse", "compare", "gt", "minVersion", "contractVersion", "version", "key", "x", "y", "Point", "environment", "degrees", "Line", "x", "y", "alpha", "distance", "x", "y", "x2", "y2", "assertNever", "assert", "distance", "deprecationWarning", "warnOnce", "Animatable", "deprecationWarning", "key", "progress", "DimensionType", "aspectRatio", "values", "assertNever", "x", "y", "f", "ColorFormat", "ColorMixModelType", "l", "hex", "f", "color", "color", "x", "y", "m", "f", "color", "isString", "alpha", "Color", "l", "hex", "key", "progress", "fraction", "import_react", "import_hoist_non_react_statics", "import_react", "f", "scale", "progress", "initialState", "f", "assert", "frame", "React", "Component", "assert", "x", "y", "scale", "key", "hoistNonReactStatic", "import_jsx_runtime", "React", "hoistNonReactStatic", "import_react", "import_jsx_runtime", "aspectRatio", "ParentSizeState", "React", "import_react", "ObservableObject", "key", "keys", "import_jsx_runtime", "isString", "isMotionValue", "cache", "key", "color", "alpha", "key", "alpha", "key", "key", "key", "key", "alpha", "isMotionValue", "key", "key", "color", "key", "inset", "import_jsx_runtime", "distance", "frame", "isTextNode", "x", "y", "scale", "import_react", "transform", "isString", "key", "microtask", "isString", "isNumber", "Layer", "import_jsx_runtime", "key", "className", "React", "import_react", "import_react", "memoize", "cache", "import_react", "scale", "import_jsx_runtime", "x", "y", "React", "isString", "isNumber", "import_react", "import_react", "React", "cache", "import_jsx_runtime", "Component", "React", "cache", "css", "import_react", "FormInputStyleVariableNames", "css", "key", "assert", "React", "anySafariVersion", "Component", "cache", "styles", "isChrome", "import_react", "React", "import_react", "import_react", "import_jsx_runtime", "React", "cache", "assert", "import_react", "import_react", "useIsomorphicLayoutEffect", "import_react", "React", "import_react", "import_react", "useForceUpdate", "React", "import_jsx_runtime", "useForceUpdate", "React", "useIsomorphicLayoutEffect", "Component", "useIsomorphicLayoutEffect", "import_jsx_runtime", "key", "React", "isValid", "VisibleFrame", "FrameWithMotion", "import_jsx_runtime", "FrameInner", "FrameWithMotion", "import_react", "import_jsx_runtime", "import_react", "log", "values", "featureSet", "setFeatureSet", "featureSet", "runtime", "executionTimeBudgets", "setFeatureSet", "import_react", "import_react", "warnOnce", "ClassDiscriminator", "isObject", "regex", "isObject", "isUndefined", "key", "isString", "groups", "isString", "isString", "typeKey", "typeValue", "inputTypes", "isNull", "isUndefined", "transform", "outputTypes", "isObject", "key", "typeKey", "typeValue", "isString", "isObject", "transform", "key", "isString", "isString", "isUndefined", "key", "key", "key", "FormBooleanInput", "FormPlainTextInput", "FrameWithMotion", "Image", "Page", "PropertyOverrides", "RichText", "SVG", "Text", "addActionControls", "animate", "clamp", "environment", "getComputedStyle", "isBrowser", "isGenerator", "isMotionValue", "isObject", "noop", "scrapeMotionValuesFromProps", "toFlexDirection", "transformString", "useNavigate", "warnOnce", "import_react", "hash", "import_jsx_runtime", "Component", "import_react", "import_react", "import_react", "import_react", "React", "import_jsx_runtime", "React", "import_jsx_runtime", "React", "hash", "React", "import_react", "import_react", "import_react", "React", "import_react", "keys", "key", "keys", "str", "value", "key", "stringify", "m", "values", "data", "values", "map", "key", "key", "keys", "index", "value", "stringify_primitive", "m", "isString", "key", "data", "map", "import_jsx_runtime", "cache", "assert", "cached", "data", "React", "import_react", "hash", "key", "isString", "import_react", "import_react", "import_jsx_runtime", "React", "maxDuration", "generator", "time", "keyframes", "x", "y", "progress", "values", "progress", "keyframes", "noop", "import_react", "import_react", "hash", "data", "isString", "startViewTransition", "m", "relative", "prefix", "import_react", "import_react", "React", "import_react", "import_react", "import_jsx_runtime", "Context", "import_react", "isString", "Context", "React", "import_jsx_runtime", "Context", "key", "isString", "isNumber", "cache", "getCollectionUtilsCache", "map", "assert", "import_react", "hash", "React", "import_react", "import_react", "event", "import_react", "import_react", "import_react", "import_jsx_runtime", "Page", "React", "assert", "key", "React", "assert", "x", "epsilon", "x2", "progress", "keys", "key", "progress", "Defaults", "time", "assert", "isMotionValue", "key", "import_jsx_runtime", "separator", "correctBorderRadius", "x", "pixelsToPercent", "y", "warnOnce", "deprecationWarning", "isMotionValue", "animate", "import_react", "import_jsx_runtime", "baseStyle", "textStyle", "titleStyle", "messageStyle", "import_jsx_runtime", "scale", "ResizeObserver", "React", "containerStyle", "import_react", "shouldBeNever", "isString", "isNumber", "map", "transform", "color", "import_react", "React", "import_jsx_runtime", "React", "defaultWidth", "defaultHeight", "import_react", "import_jsx_runtime", "React", "FrameWithMotion", "import_react", "import_react", "import_jsx_runtime", "React", "import_jsx_runtime", "import_react", "import_react", "import_react", "import_react", "key", "React", "import_react", "import_jsx_runtime", "React", "import_react", "React", "import_react", "import_jsx_runtime", "import_jsx_runtime", "React", "NavigationContainer", "isPrevious", "animate", "animations", "FrameWithMotion", "key", "assert", "transitions", "import_jsx_runtime", "React", "key", "assert", "isPrevious", "FrameWithMotion", "import_hoist_non_react_statics", "import_react", "NavigateTo", "NavigationTransitionType", "import_jsx_runtime", "React", "hoistNonReactStatic", "import_react", "import_jsx_runtime", "React", "Component", "import_react", "import_react", "time", "data", "clampX", "clampY", "updateX", "updateY", "x", "y", "import_react", "import_jsx_runtime", "React", "StackInner", "wrap", "className", "toFlexDirection", "FrameWithMotion", "import_jsx_runtime", "FrameWithMotion", "import_jsx_runtime", "React", "warnOnce", "isMotionValue", "values", "key", "useIsomorphicLayoutEffect", "x", "y", "FrameWithMotion", "Page", "Page", "import_react", "time", "import_react", "import_react", "import_jsx_runtime", "import_react", "import_react", "import_jsx_runtime", "React", "x", "isMotionValue", "y", "useIsomorphicLayoutEffect", "data", "isEmpty", "FrameWithMotion", "EmulatedScroll", "import_react", "import_react", "animations", "React", "time", "useIsomorphicLayoutEffect", "isMotionValue", "import_jsx_runtime", "React", "className", "isMotionValue", "useIsomorphicLayoutEffect", "FrameWithMotion", "NativeScroll", "import_jsx_runtime", "React", "ScrollInner", "NativeScroll", "EmulatedScroll", "Data", "PropertyStore", "deprecationWarning", "import_react", "key", "data", "initialState", "version", "defaultState", "initialState", "import_react", "import_jsx_runtime", "React", "import_hoist_non_react_statics", "import_react", "isMotionValue", "import_jsx_runtime", "Component", "hoistNonReactStatic", "import_react", "keys", "key", "import_react", "import_react", "React", "import_react", "React", "import_jsx_runtime", "React", "import_jsx_runtime", "cloneAsElement", "import_jsx_runtime", "React", "key", "assert", "SSRVariants", "className", "React", "assertNever", "PropertyOverrides", "import_jsx_runtime", "assert", "className", "transformTemplate", "animate", "isString", "Component", "React", "import_react", "key", "values", "React", "import_react", "values", "delay", "key", "import_react", "React", "transform", "import_react", "key", "motionValue", "isNumber", "isString", "import_react", "import_react", "React", "_", "isNumber", "animateVariant", "React", "key", "_", "import_react", "defaultRanges", "values", "spring", "React", "key", "startAnimation", "m", "_", "import_jsx_runtime", "key", "keys", "add", "values", "isNumber", "isVariantOrVariantList", "isString", "Component", "React", "transformValues", "scale", "x", "y", "animate", "import_react", "import_jsx_runtime", "import_react", "import_jsx_runtime", "React", "ComponentViewportProvider", "y", "import_react", "import_react", "import_jsx_runtime", "Component", "React", "import_react", "import_react", "import_react", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_react", "import_react", "import_jsx_runtime", "React", "import_jsx_runtime", "import_jsx_runtime", "React", "ContainerInner", "SmartComponentScopedContainer", "Component", "import_react", "import_jsx_runtime", "map", "hash", "assertNever", "x", "y", "CustomCursorComponent", "useForceUpdate", "isEmptyObject", "spring", "transformTemplate", "import_react", "import_react", "assert", "isValidURL", "isString", "isString", "pathVariablesKey", "import_jsx_runtime", "assert", "import_react", "styles", "el", "React", "polygonPoints", "intersection", "assertNever", "x", "y", "import_jsx_runtime", "x", "y", "Context", "React", "values", "container", "isString", "className", "ReactDOM", "import_react", "import_jsx_runtime", "React", "Instance", "Component", "import_react", "import_jsx_runtime", "PropertyOverrides", "import_react", "import_jsx_runtime", "import_react", "import_react", "import_jsx_runtime", "Component", "hash", "assert", "import_react", "import_react", "pathVariablesRegExp", "hash", "key", "pathVariablesRegExp", "isString", "AnchorLinkTarget", "isValidURL", "import_react", "assert", "result", "import_react", "isString", "Link", "resolveSlugsWithSuspense", "isString", "navigate", "isEmptyObject", "resolveSlugs", "isString", "hash", "import_react", "import_react", "salt", "difficulty", "tokenLength", "maxTime", "hash", "data", "document", "key", "import_react", "import_jsx_runtime", "React", "import_react", "React", "import_jsx_runtime", "assertNever", "isValidURL", "React", "FormContainer", "isString", "matchingRoute", "routeId", "elementId", "pathVariables", "assert", "data", "key", "import_react", "import_react", "import_react", "import_jsx_runtime", "key", "import_react", "key", "map", "safeWindow", "assert", "assertNever", "import_jsx_runtime", "Context", "initialState", "assert", "import_react", "import_react", "import_jsx_runtime", "React", "assert", "assertNever", "key", "key", "import_react", "isString", "import_react", "useForceUpdate", "React", "import_jsx_runtime", "hash", "startViewTransition", "useForceUpdate", "loadSnippets", "switchLocale", "isString", "currentRouteId", "currentRoute", "key", "currentPathVariables", "React", "import_jsx_runtime", "isString", "isNumber", "isValidURL", "noop", "data", "key", "cached", "_subscribers", "noop", "import_jsx_runtime", "environment", "React", "import_react", "resolveSlugsWithSuspense", "isString", "React", "Fetcher", "generator", "assert", "values", "keys", "key", "collation", "number", "key", "assertNever", "isNumber", "isString", "assert", "assert", "key", "data", "prefix", "data", "cached", "assertNever", "hash", "assert", "assert", "generator", "values", "assert", "isString", "key", "assert", "cache", "cached", "data", "data", "assert", "assert", "keys", "key", "assert", "generator", "collation", "assert", "assertNever", "node", "collation", "collation", "collation", "hash", "assert", "key", "assert", "collation", "collation", "intersection", "collation", "assert", "memo", "assert", "collation", "assert", "collation", "assert", "cache", "assertNever", "join", "log", "getLogger", "key", "handoverDataType", "queryEngine", "key", "import_react", "import_react", "cached", "isString", "safeWindow", "import_react", "import_react", "import_react", "variantProps", "React", "import_react", "hash", "isStaticRenderer", "useForceUpdate", "updateStateAndRerender", "useIsomorphicLayoutEffect", "requestIdleCallback", "import_react", "key", "import_react", "map", "React", "key", "import_react", "React", "import_react", "keys", "key", "React", "useNavigate", "import_react", "map", "React", "import_react", "React", "import_react", "key", "React", "preloadKey", "isString", "Component", "import_react", "import_react", "hash", "startTransition", "hash", "import_react", "nextVariant", "assert", "transitions", "VariantSelector", "hover", "variantProps", "useForceUpdate", "isHovered", "isPressed", "isError", "enabledGestures", "defaultVariant", "baseVariant", "gestureVariant", "isString", "import_react", "import_jsx_runtime", "Component", "React", "import_react", "import_jsx_runtime", "Component", "import_react", "import_react", "import_react", "import_react", "import_jsx_runtime", "transform", "Context", "invariant", "inset", "isHTMLElement", "renderedOffset", "noop", "defaultOffset", "offset", "clamp", "import_jsx_runtime", "BasicTicker", "Component", "import_react", "import_jsx_runtime", "DraggableTicker", "Component", "isDragging", "import_react", "import_jsx_runtime", "TickerContext", "Context", "import_jsx_runtime", "Ticker", "isString", "import_jsx_runtime", "Component", "Ticker", "import_react", "import_jsx_runtime", "Component", "React", "import_jsx_runtime", "Component", "key", "noop", "data", "key", "assertNever", "values", "key", "isNumber", "import_react", "import_react", "import_jsx_runtime", "ShaderFallbackImage", "import_react", "parseCSSVariable", "key", "cached", "map", "getCacheKey", "cached", "scale", "x", "y", "color", "parseCSSVariable", "rgba", "scale", "isString", "assertNever", "import_jsx_runtime", "ShaderSandboxFallbackImage", "containerStyle", "import_react", "import_react", "import_react", "import_react", "useIsomorphicLayoutEffect", "import_jsx_runtime", "singleFrame", "animate", "time", "import_jsx_runtime", "ShaderWithFallbackOverlay", "singleFrame", "import_react", "spring", "x", "y", "time", "import_react", "import_jsx_runtime", "Shader", "ShaderContainerFrame", "styles", "FrameWithMotion", "import_react", "import_jsx_runtime", "defaultRanges", "createInputOutputRanges", "isNumber", "Component", "React", "import_react", "import_jsx_runtime", "Component", "React", "animate", "import_react", "React", "import_jsx_runtime", "import_react", "import_react", "React", "import_jsx_runtime", "className", "step", "FormPlainTextInput", "import_react", "import_react", "import_jsx_runtime", "className", "React", "styles", "FormBooleanInput", "import_react", "import_jsx_runtime", "React", "Select", "className", "assertNever", "isNumber", "styles", "import_react", "import_react", "import_react_dom", "import_react", "import_jsx_runtime", "aspectRatio", "getPortalContainer", "isNumber", "values", "Component", "TickerContext", "style", "borderStyle", "transition", "decode", "borderRadius", "import_jsx_runtime", "Component", "React", "Image", "import_react", "import_jsx_runtime", "React", "ColumnMasonryLayout", "wrapperStyle", "Component", "import_react", "key", "capitalizeFirstLetter", "import_jsx_runtime", "RelativeDate", "import_react", "React", "import_react", "frame", "isString", "pathVariablesRegExp", "key", "import_jsx_runtime", "className", "environment", "frame", "isAutoSized", "React", "import_jsx_runtime", "defaultValues", "key", "assertNever", "isNumber", "tokenization", "animations", "groups", "import_jsx_runtime", "BaseSVG", "FitText", "key", "RichTextContainer", "environment", "containerStyle", "frame", "isAutoSized", "isNumber", "Component", "isString", "className", "RichText", "import_react", "a", "b", "assert", "isString", "isNumber", "frame", "transform", "mediaType", "isAssetReference", "import_jsx_runtime", "transform", "import_react", "svg", "prefix", "m", "import_jsx_runtime", "React", "svg", "frame", "className", "SVG", "import_react", "import_react", "React", "import_jsx_runtime", "React", "Text", "className", "convertVerticalAlignment", "key", "isString", "frame", "inlineClosingTag", "import_jsx_runtime", "keys", "key", "randomID", "randomID", "assert", "PathSegment", "key", "assert", "x", "y", "isRootVectorNode", "transform", "transformString", "transform", "x", "y", "import_react", "import_jsx_runtime", "import_react", "import_jsx_runtime", "React", "l", "import_jsx_runtime", "isRootVectorNode", "x", "y", "transform", "isString", "transformString", "key", "import_jsx_runtime", "x", "y", "isRootVectorNode", "transform", "transformString", "key", "Size", "time", "addActionControls", "key", "prefix", "environment", "className", "regex", "l", "isString", "isNumber", "import_react", "MainLoop", "number", "isString", "isUndefined", "isNumber", "transform", "key", "isNumber", "isString", "isNumber", "isArray", "isUndefined", "key", "version", "x", "l", "encodeURI", "css", "isUndefined", "isNumber", "isArray", "number", "values", "isArray", "isNumber", "key", "isFunction", "isObject", "isNumber", "key", "ease", "secondsToMilliseconds", "assertNever", "key", "transform", "key", "HardCodedCodeIdentifier", "key", "isUndefined", "isNumber", "key", "typeKey", "isObject", "isObject", "isNumber", "isArray", "key", "isObject", "isBoolean", "isObject", "isArray", "isNull", "isString", "isNumber", "isUndefined", "key", "isObject", "isLinkToWebPage", "hash", "isString", "values", "defaultValues", "isObject", "key", "isArray", "key", "compare", "removedIds", "key", "cache", "first", "key", "isObject", "key", "isObject", "key", "key", "map", "isArray", "isObject", "color", "parseCSSVariable", "transform", "isString", "isObject", "isString", "keys", "isObject", "key", "supportedLinkRelValues", "isArray", "values", "key", "isObject", "isString", "isBoolean", "isUndefined", "import_react", "isBoolean", "isNumber", "isString", "isArray", "isUndefined", "isObject", "inset", "values", "color", "x", "y", "isString", "isArray", "isObject", "isObject", "isString", "first", "isUndefined", "key", "isString", "isNumber", "isString", "key", "key", "isString", "overflowKey", "isString", "isUndefined", "key", "isString", "key", "values", "isString", "key", "key", "values", "isString", "isString", "typeKey", "toFlexDirection", "key", "key", "isNumber", "isObject", "isArray", "isObject", "isString", "isNullish", "key", "isUndefined", "isBoolean", "isNumber", "assertNever", "step", "control", "key", "defaultLocaleId", "assertNever", "defaultLocaleId", "key", "isObject", "memoize", "cache", "isString", "assert", "document", "isString", "document", "defaultLocaleId", "isString", "defaultLocaleId", "key", "isUndefined", "x", "y", "isObject", "wrap", "obj", "returnValue", "proxy", "l", "meta", "log", "MINUTE", "frame", "MINUTE", "log", "import_react", "package_default", "log", "generator", "isObject", "isString", "regex", "version", "wrap", "reactVersion", "package_default", "assertNever", "key", "isString", "nonSlugCharactersRegExp", "isString", "fillPathVariables", "key", "defaultLocaleId", "fillPathVariables", "key", "isString", "key", "radiusDefaults", "key", "log", "key", "isUndefined", "compare", "isString", "isNull", "m", "isArray", "isNumber", "SafeJS", "Set", "values", "isUndefined", "key", "values", "separator", "join", "values", "js", "isString", "isNumber", "isBoolean", "isNull", "result", "jst", "join", "separator", "key", "isUndefined", "svg", "jsx", "key", "isObject", "isString", "isOptionalString", "isUndefined", "altKey", "isControlType", "isString", "isObject", "key", "values", "isBoolean", "step", "isNumber", "isArray", "isNonEmptyString", "isUndefined", "isFunction", "keys", "allBorderStyles", "isBorderStyle", "isObject", "key", "import_react", "createErrorDefinition", "cleanFilename", "React", "BuiltInFramerComponentIdentifier", "Page", "log", "prefix", "isObject", "key", "isString", "isReactComponent", "isFunction", "Page", "createErrorDefinition", "initialized", "isString", "isNull", "variant", "isObject", "isNumber", "isString", "values", "key", "key", "isUndefined", "key", "isNumber", "import_react", "isString", "isObject", "key", "isString", "isArray", "isUndefined", "values", "hasBoxShadow", "isArray", "regex", "isCSSVariableName", "isString", "isNumber", "css", "data", "isObject", "isArray", "isNumber", "isObject", "isUndefined", "key", "key", "log", "isObject", "isNumber", "isString", "isBoolean", "transform", "key", "isString", "isNumber", "isObject", "otherValue", "transformValue", "isArray", "isUndefined", "isNull", "isBoolean", "number", "getRadiusValue", "isUndefined", "key", "patchBorderRadiusScaleCorrector", "isNumber", "isNumber", "isString", "values", "value", "isUndefined", "isUndefined", "InlineStyles", "css", "isNumber", "isUndefined", "BackgroundStyles", "styles", "BlockStyles", "values", "key", "transform", "number", "hash", "key", "f", "time", "assertNever", "key", "isString", "parseNumber", "number", "css", "isString", "isNumber", "styles", "prefix", "selector", "keys", "key", "isLink", "prefixLength", "isUndefined", "isString", "isNumber", "isObject", "key", "isObject", "isBoolean", "isString", "isArray", "isUndefined", "isNumber", "isNull", "isObject", "isLinkToWebPage", "optionalKey", "isNullish", "borderColorKey", "key", "hash", "isString", "transformValue", "isUndefined", "isString", "key", "isString", "key", "isObject", "isString", "pathVariablesRegExp", "isNull", "data", "key", "isObject", "key", "segment", "isString", "isArray", "safeName", "lazy", "safeProperty", "isString", "compare", "isUndefined", "isObject", "isObject", "isArray", "inset", "x", "y", "color", "zeroPoint", "value", "alpha", "distance", "clamp", "key", "isUndefined", "isString", "getCursorHash", "isString", "isUndefined", "isLinkToWebPage", "createLink", "values", "isObject", "hash", "hash", "isString", "isNumber", "isString", "optionalKey", "isNull", "color", "transformValue", "isLinkToWebPage", "isUndefined", "getCursorHash"]
}
