{
  "version": 3,
  "sources": ["../../src/document/components/canvas/workaroundBlurArtefacts.ts", "../../src/renderer/CanvasRenderer.tsx", "../../src/renderer/CanvasNodeRenderer.tsx", "../../src/renderer/CanvasFloatingPosition.tsx", "../../src/renderer/CanvasFloatingPosition.styles.ts", "../../src/renderer/CanvasLayoutTemplate.tsx", "../../src/renderer/CanvasLayoutTemplate.styles.ts", "../../src/renderer/CanvasOverlay.tsx", "../../src/renderer/CanvasSlot.tsx", "../../src/renderer/CanvasSlot.styles.ts", "../../src/renderer/DataRepeaterNoItemsPlaceholder.tsx", "../../src/renderer/ModuleContainers.tsx", "../../src/renderer/ResponsiveScreenContainer.tsx", "../../src/renderer/withCanvasFixedPositioning.tsx", "../../src/renderer/renderElement.tsx", "../../src/utils/repairSVGStrokeSafari.ts", "../../src/renderer/CanvasCurrentRouteProvider.tsx", "../../src/renderer/CanvasElement.tsx", "../../src/renderer/CanvasElement.styles.ts", "../../src/renderer/CanvasElementTransform.tsx", "../../src/renderer/useChromeResetDisplayWorkaround.tsx", "../../src/renderer/useWindowsTextBlurWorkaround.ts", "../../src/renderer/GroundNodeErrorBoundary.tsx", "../../src/renderer/ShaderPoolProvider.tsx", "../../src/renderer/ShaderPool.ts", "../../src/renderer/workaroundBadlyScaledChildLayers.ts"],
  "sourcesContent": ["import { isFramerX, isSafari } from \"@framerjs/shared/src/environment.ts\"\nimport type { CanvasNode, CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { stringFromNodeID } from \"document/models/CanvasTree/index.ts\"\nimport { withFilters } from \"document/models/CanvasTree/traits/WithFilters.ts\"\nimport { environment } from \"environment/index.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { forceLayerBackingOnElement } from \"../../../../../../library/src/render/utils/setLayerBacked.ts\"\n\n/**\n * When dragging around frames with blur enabled, webkit doesn't always\n * re-render enough to remove all the affected pixels, leaving a trail while\n * dragging. On the one hand it is harmless, any re-render of the parent will\n * clear it up. But it looks terrible. A workaround is to make sure all nodes\n * involved are layers.\n */\n\nconst emptySet = new Set<NodeID>()\nconst workaroundLayers: Set<NodeID> = new Set()\n/**\n * Because this function captures the workaroundLayers variable that is defined\n * outside of it, it should only be called from one place, which currently is\n * the CanvasRenderer\n */\nexport function workaroundBlurArtefacts(inMoveTool: boolean, tree: CanvasTree, selection: NodeID[]) {\n\tif (!(isSafari() || isFramerX() || environment.isTest)) return\n\n\tif (!inMoveTool) {\n\t\tmaintainWorkaroundLayers(emptySet, workaroundLayers)\n\t} else {\n\t\tconst asLayers = nodesWithBlurredSiblingsOrParent(tree, tree.getNodes(selection))\n\t\tmaintainWorkaroundLayers(asLayers, workaroundLayers)\n\t}\n}\n\nfunction hasBlur(node: CanvasNode): boolean {\n\tif (!withFilters(node)) return false\n\treturn isNumber(node.blur) || isNumber(node.backgroundBlur)\n}\n\nexport function nodesWithBlurredSiblingsOrParent(tree: CanvasTree, nodes: CanvasNode[]): Set<NodeID> {\n\tconst parentsProcessed = new Set<NodeID>()\n\tconst result = new Set<NodeID>()\n\tfor (const node of nodes) {\n\t\tif (result.has(node.id)) continue\n\t\tif (parentsProcessed.has(node.parentid!)) continue\n\t\tparentsProcessed.add(node.parentid!)\n\n\t\tconst parent = tree.getParent(node.id) as CanvasNode & { children: CanvasNode[] }\n\t\tif (!parent) continue\n\n\t\tlet seenBlur = hasBlur(parent)\n\t\tif (!seenBlur) {\n\t\t\tfor (const child of parent.children) {\n\t\t\t\tif (hasBlur(child)) {\n\t\t\t\t\tseenBlur = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (!seenBlur) continue\n\t\tresult.add(parent.id)\n\t\tfor (const child of parent.children) {\n\t\t\tresult.add(child.id)\n\t\t}\n\t}\n\treturn result\n}\n\nexport function maintainWorkaroundLayers(nodes: Set<NodeID>, layers: Set<NodeID>): void {\n\t// For every node that needs to, make sure the state is as it needs to be.\n\t// Note: because nodes change hierarchy over time, document.getElementById()\n\t// sometimes returns a fresh element and we need to redo the setup.\n\tfor (const id of nodes) {\n\t\tconst element = document.getElementById(stringFromNodeID(id))\n\t\tif (!element) continue\n\n\t\t// For every node, we only do what we need to to bring it back to the state we need\n\t\tif (!layers.has(id)) {\n\t\t\tlayers.add(id)\n\t\t}\n\t\tforceLayerBackingOnElement(element, true)\n\t}\n\n\t// For all nodes previously made layers, but no longer have an entry in\n\t// nodes, restore to normal.\n\tfor (const id of layers) {\n\t\tif (nodes.has(id)) continue\n\n\t\tconst element = document.getElementById(stringFromNodeID(id))\n\t\tif (!element) continue\n\n\t\tlayers.delete(id)\n\t\tforceLayerBackingOnElement(element, false)\n\t}\n}\n", "import { executionTimeBudgets, useExecutionTimeBudgetsWhileRendering } from \"@framerjs/framer-runtime\"\nimport { chromeMainVersion, isFramerX, isSafari } from \"@framerjs/shared/src/environment.ts\"\nimport { noopAsync } from \"@framerjs/shared/src/noop.ts\"\nimport { cx } from \"@linaria/core\"\nimport { workaroundBlurArtefacts } from \"document/components/canvas/workaroundBlurArtefacts.ts\"\nimport { isIncludedInLocale } from \"document/components/chrome/localization/includedLocales.ts\"\nimport type { CanvasNode, CanvasTree, MaybeNodeID, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { CodeComponentNode } from \"document/models/CanvasTree/index.ts\"\nimport { ColorStyleTokenListNode } from \"document/models/CanvasTree/nodes/ColorStyleTokenListNode.ts\"\nimport { PresetsListNode } from \"document/models/CanvasTree/nodes/PresetsListNode.ts\"\nimport { isSmartComponentNode, isVectorSetNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { viewportHeightStyle } from \"document/models/CanvasTree/traits/utils/viewportHelpers.ts\"\nimport { getGroundNodeRectWithPinnedPosition } from \"document/models/CanvasTree/utils/getGroundNodeRect.ts\"\nimport { getTokenCSSProperties } from \"document/models/CanvasTree/utils/tokens.ts\"\nimport type { FontPreview } from \"document/utils/FontPreviewTypes.ts\"\nimport type { ActiveLinkStyle } from \"document/utils/activeLinkStylePreset.ts\"\nimport { getActiveLinkStylePresetClassName } from \"document/utils/activeLinkStylePreset.ts\"\nimport { MotionConfig } from \"framer-motion\"\nimport { CustomProperties } from \"library/index.ts\"\nimport { FetchClientProvider } from \"library/modules/FetchClient.tsx\"\nimport { RenderTarget, useRenderEnvironment } from \"library/render/types/RenderEnvironment.ts\"\nimport type { Locale, LocaleId, LocaleInfo } from \"library/router/types.ts\"\nimport { LayoutDirectionContext, LocaleInfoContext } from \"library/router/useLocale.ts\"\nimport type { FunctionComponent } from \"react\"\nimport React, { useEffect, useLayoutEffect, useMemo, useRef } from \"react\"\nimport { renderElement } from \"renderer/renderElement.tsx\"\nimport { getRouterLocale, getRouterLocales } from \"utils/getRouterLocales.ts\"\nimport { repairStrokedSVGs } from \"utils/repairSVGStrokeSafari.ts\"\nimport type { SandboxError } from \"utils/rpc/shared/definitions.ts\"\nimport { useConstant } from \"utils/useConstant.ts\"\nimport { CanvasCurrentRouteProvider } from \"./CanvasCurrentRouteProvider.tsx\"\nimport { CanvasElement } from \"./CanvasElement.tsx\"\nimport * as styles from \"./CanvasRenderer.styles.ts\"\nimport type { DeferredRendering } from \"./DeferredRendering.ts\"\nimport { GroundNodeErrorBoundary } from \"./GroundNodeErrorBoundary.tsx\"\nimport { InjectStylePresets } from \"./InjectStylePresets.tsx\"\nimport type { OptimizedCanvasImageRenderer } from \"./OptimizedCanvasImageRenderer.ts\"\nimport type { RenderingStateTracker } from \"./RenderingStateTracker.ts\"\nimport { ShaderPoolProvider } from \"./ShaderPoolProvider.tsx\"\nimport {\n\tgetStylePresetBreakpointClassNamesForGroundNode,\n\tuseStylePresetBreakpoints,\n} from \"./utils/getStylePresetBreakpointClassNames.ts\"\nimport {\n\tscaleFromZoomForBadlySizedChildLayersWorkaround,\n\tworkaroundBadlySizedChildLayers,\n} from \"./workaroundBadlyScaledChildLayers.ts\"\n\nexport const canvasTransformContainerStyle: React.CSSProperties = {\n\tposition: \"fixed\",\n\ttop: 0,\n\tleft: 0,\n\twidth: 0,\n\theight: 0,\n\twillChange: \"transform\",\n\tisolation: \"isolate\",\n}\n\nexport function canvasTransform(zoom: number, offsetX: number, offsetY: number): string {\n\treturn `scale(${zoom}) translateX(${-offsetX}px) translateY(${-offsetY}px)`\n}\n\nconst browserNeedsBlurArtefactWorkaround = isFramerX() || isSafari()\n\nfunction useIncreasedBudgetWhileLoading(deferredRendering: DeferredRendering | undefined) {\n\tconst shouldIncreasedBudget = deferredRendering\n\t\t? deferredRendering.nodesDeferredRendering.size !== 0 || deferredRendering.nodesLoadingResources.size !== 0\n\t\t: false\n\n\tif (shouldIncreasedBudget) {\n\t\texecutionTimeBudgets.frame.addScope(\"while-loading\", 15000)\n\t}\n\n\tuseEffect(() => {\n\t\tif (shouldIncreasedBudget) return\n\t\texecutionTimeBudgets.frame.removeScope(\"while-loading\")\n\t}, [shouldIncreasedBudget])\n}\n\ninterface State {\n\ttracker: RenderingStateTracker\n\ttree: CanvasTree\n\tscopeId: MaybeNodeID\n\tgroundNodes: CanvasNode[]\n\tgroundNodeIdsInViewport: Set<string>\n\tdeferredRendering: DeferredRendering | undefined\n\toptimizedCanvasImageRenderer: OptimizedCanvasImageRenderer | undefined\n\tshouldSetMinHeight: boolean\n\tselection: NodeID[]\n\tisInitialLoad: boolean\n\tisLoadingModules: boolean\n\tisDarkMode: boolean\n\tinMoveTool: boolean\n\toffsetX: number\n\toffsetY: number\n\tcanvasZoom: number\n\tliveZoom: number | undefined\n\tassetMapHash: number\n\trootFontSize: number | null | undefined\n\tcodeRevision: string\n\tperformanceMode: boolean\n\trenderTarget: RenderTarget\n\tactiveLocaleId: LocaleId | undefined\n\toptionalSelectedCollectionItemId: NodeID | undefined\n\tinRelativeOverlayEditMode: boolean\n\tactiveLinkStyle: ActiveLinkStyle | undefined\n\tfontPreviewByNodeId: ReadonlyMap<NodeID, FontPreview> | undefined\n\treportError: (error: SandboxError) => void\n}\n\ninterface Props {\n\treadonly useState: CanvasRendererStateHook\n}\n\n/**\n * The function that provides CanvasRenderer with the information needed to render canvas elements. This can return\n * a static object, but since it's called as a React hook you can use other standard hooks to trigger re-rendering of\n * the CanvasRenderer component.\n */\nexport type CanvasRendererStateHook = () => State\n\n/**\n * The container that displays canvas elements, given the data and visual state provided by the `useState` hook.\n */\nexport const CanvasRenderer: FunctionComponent<Props> = React.memo(function CanvasRenderer({ useState }: Props) {\n\tconst state = useState()\n\n\tconst {\n\t\ttracker,\n\t\ttree,\n\t\tscopeId,\n\t\tgroundNodes,\n\t\tgroundNodeIdsInViewport: groundNodesInViewport,\n\t\tshouldSetMinHeight,\n\t\tdeferredRendering,\n\t\toptimizedCanvasImageRenderer,\n\t\tselection,\n\t\tisLoadingModules,\n\t\tisInitialLoad,\n\t\tisDarkMode,\n\t\tinMoveTool,\n\t\toffsetX,\n\t\toffsetY,\n\t\tliveZoom,\n\t\tassetMapHash,\n\t\tcodeRevision,\n\t\tperformanceMode,\n\t\tactiveLocaleId,\n\t\trenderTarget,\n\t\treportError,\n\t\trootFontSize,\n\t\tinRelativeOverlayEditMode,\n\t\tactiveLinkStyle,\n\t\toptionalSelectedCollectionItemId,\n\t\tfontPreviewByNodeId,\n\t} = state\n\n\tuseExecutionTimeBudgetsWhileRendering()\n\tuseIncreasedBudgetWhileLoading(deferredRendering)\n\n\t// This is a pretty important piece of code that protects the gpu from blowing up in Chrome\n\t// Every time we change the canvasZoom, the underlying frames will get diffed and we minimize that,\n\t// so keeping this as stable as possible is important. If we have to diff, it's best to do so\n\t// when there are few elements on screen (zoomed in).\n\n\tconst isLiveZooming = Boolean(liveZoom)\n\tconst canvasZoomRef = useRef<number>(state.canvasZoom)\n\tconst liveZoomStartRef = useRef<number | null>(null)\n\n\tif (!liveZoom) {\n\t\tliveZoomStartRef.current = null\n\t} else if (liveZoomStartRef.current === null) {\n\t\t// When live zoom starts in sandbox mode, the canvas zoom will also be set to the initial live value.\n\t\t// Use the last stable canvas zoom instead, to make sure we don't invalidate the entire tree right before\n\t\t// we start a live zoom session should be as smooth as possible.\n\t\tliveZoomStartRef.current = canvasZoomRef.current\n\t}\n\n\t// Store the minimum zoom in a live zoom session so that we never make tiles smaller\n\tconst minLiveZoomRef = useRef<number | null>(null)\n\tminLiveZoomRef.current = liveZoom ? Math.min(minLiveZoomRef.current || Infinity, liveZoom) : null\n\tconst minLiveZoom = minLiveZoomRef.current || liveZoom\n\n\tcanvasZoomRef.current = state.canvasZoom\n\tlet canvasZoom = liveZoomStartRef.current ?? canvasZoomRef.current\n\n\tif (\n\t\t// We are in a live zoom session\n\t\tminLiveZoom &&\n\t\t// We are somewhat zoomed in (re-diffing with many visible nodes is expensive)\n\t\tcanvasZoom > 1 &&\n\t\t// We are zooming out (so we need more small tiles), zooming in is fine\n\t\tminLiveZoom < canvasZoom\n\t) {\n\t\t// Calculate how much change there was in zooming, and let the ground\n\t\t// nodes scale quickly to smaller sizes. Otherwise going from 32x -> 1x\n\t\t// causes a lot more pixels becoming visible, while the tiles the\n\t\t// browser uses to render those pixels is crazy small. Also notice that\n\t\t// during live zoom, we only update the ground nodes in scale, and never\n\t\t// touch any content. So this is fairly cheap to do.\n\t\tconst zoomDelta = (canvasZoom - minLiveZoom) / canvasZoom\n\t\tif (zoomDelta > 0.1) {\n\t\t\tcanvasZoom = 0.25\n\t\t\tif (minLiveZoom > 1) canvasZoom = 1\n\t\t\tif (minLiveZoom > 4) canvasZoom = 4\n\t\t\tif (minLiveZoom > 8) canvasZoom = 8\n\t\t\tif (minLiveZoom > 16) canvasZoom = 16\n\t\t}\n\t}\n\n\t// Apply canvas position/zoom\n\tconst zoom = liveZoom || canvasZoom\n\tconst containerRef = useRef<HTMLDivElement>(null)\n\n\t// Apply the blur workaround if needed, note the condition is a constant\n\tif (browserNeedsBlurArtefactWorkaround) {\n\t\t// biome-ignore lint/correctness/useHookAtTopLevel: <explanation>\n\t\tuseLayoutEffect(() => {\n\t\t\tworkaroundBlurArtefacts(inMoveTool, tree, selection)\n\t\t}, [inMoveTool, tree, selection])\n\t}\n\n\t// Each ground node will compute a scale from canvasZoom and will re-create its backing layer\n\t// when this scale changes. When that happens we also want to re-create all layers that were\n\t// created inside implicitly, due to backdrop filters, or due to code components with elements\n\t// that have will-change: transform set. Otherwise these layers might be enormous GPU layers and\n\t// drain performance or crash the page. Or these layers might be tiny and blurry. This is\n\t// however a very expensive operation for large DOM trees. The browser can easily be blocked\n\t// recomputing styles for hundreds of milliseconds. So we first check if there are any elements\n\t// that might have such layers.\n\tconst scale = scaleFromZoomForBadlySizedChildLayersWorkaround(canvasZoom)\n\tuseLayoutEffect(() => {\n\t\tvoid workaroundBadlySizedChildLayers()\n\t}, [containerRef, scale])\n\n\t// Set different canvas rendering effects through CSS styles that override\n\t// canvas element styling. The global canvas style doesn't technically apply\n\t// to this element, but by adding it here we are explicit about when it must\n\t// exist to ensure no tree shaking or other optimizations happen.\n\tconst canvasClassName: string[] = [styles.globalCanvas]\n\n\t// Only update zoom settings effects if we are not live zooming\n\tconst zoomRef = React.useRef(zoom)\n\tif (!isLiveZooming) zoomRef.current = zoom\n\n\tif (renderTarget === RenderTarget.canvas) {\n\t\t// We hide box, text and svg shadows beyond zoom = 4 for performance, unless the scope needs precise shadow editing\n\t\tif (zoomRef.current > 4) {\n\t\t\tif (canDisableShadowsForScope(tree, scopeId)) {\n\t\t\t\tcanvasClassName.push(styles.disableShadowsClass)\n\t\t\t}\n\t\t\tcanvasClassName.push(styles.disableFiltersClass)\n\t\t\tcanvasClassName.push(styles.disableBackdropFiltersClass)\n\t\t}\n\n\t\t// When zoomed in, we always want images to look pixelated so we can inspect them well\n\t\tif (zoomRef.current > 1) canvasClassName.push(styles.disableSmoothImageRenderingClass)\n\t}\n\n\t// Disable image smoothing when exporting. This will lead to not so nice\n\t// results when exporting at sizes smaller than the screen\u2019s DPR, but much\n\t// nicer when exporting at >=2x. An alternative solution is to do this\n\t// dynamically in the `useWebRenderingProvider` hook, taking the screen\u2019s\n\t// DPR into account.\n\t// Users are able to override this by setting the imageRendering property on the nodes.\n\tif (renderTarget === RenderTarget.export) {\n\t\tcanvasClassName.push(styles.disableSmoothImageRenderingClass)\n\t}\n\n\t// Apply a class to the container to indicate the currently editing link style state so we can adjust the\n\t// rendering of links on the canvas that are using that link style.\n\tconst activeLinkStyleClassName = getActiveLinkStyleClassName(activeLinkStyle)\n\tif (renderTarget === RenderTarget.canvas && activeLinkStyleClassName) {\n\t\tcanvasClassName.push(activeLinkStyleClassName)\n\t}\n\n\toptimizedCanvasImageRenderer?.setZoom(zoom)\n\n\tconst scopeNode = tree.get(scopeId)\n\tconst isVisibleInLocale = scopeNode && activeLocaleId ? isIncludedInLocale(tree, scopeNode, activeLocaleId) : true\n\n\tconst content = (\n\t\t<div\n\t\t\t// We need to set the text direction to ltr, because otherwise all ground nodes will be\n\t\t\t// rendered in a different position when the text direction is rtl.\n\t\t\tdir=\"ltr\"\n\t\t\tref={containerRef}\n\t\t\tstyle={{ ...canvasTransformContainerStyle, transform: canvasTransform(zoom, offsetX, offsetY) }}\n\t\t\tclassName={canvasClassName.join(\" \")}\n\t\t\t// When changing or removing this ID, please make sure no other code relies on it. Specifically,\n\t\t\t// as of Mar 2023, the image exporter code in Electron uses the ID to manipulate the canvas container\n\t\t\t// (lacking better ways to do so).\n\t\t\tid=\"canvas-container\"\n\t\t>\n\t\t\t<InjectStylePresets\n\t\t\t\tcomponentLoader={tracker.componentLoader}\n\t\t\t\tpresetsListNode={PresetsListNode.get(tree)}\n\t\t\t\tfontPreviewByNodeId={fontPreviewByNodeId}\n\t\t\t/>\n\n\t\t\t<CanvasCurrentRouteProvider\n\t\t\t\ttree={tree}\n\t\t\t\tcomponentLoader={tracker.componentLoader}\n\t\t\t\tscopeId={scopeId}\n\t\t\t\toptionalSelectedCollectionItemId={optionalSelectedCollectionItemId}\n\t\t\t>\n\t\t\t\t<CanvasElements\n\t\t\t\t\ttracker={tracker}\n\t\t\t\t\ttree={tree}\n\t\t\t\t\toffset={offsetX * offsetY}\n\t\t\t\t\tzoom={canvasZoom}\n\t\t\t\t\tisInitialLoad={isInitialLoad}\n\t\t\t\t\tisLiveZooming={isLiveZooming}\n\t\t\t\t\tisLoadingModules={isLoadingModules}\n\t\t\t\t\tgroundNodes={groundNodes}\n\t\t\t\t\tgroundNodesInViewport={groundNodesInViewport}\n\t\t\t\t\tgroundNodesDeferredRendering={deferredRendering?.nodesDeferredRendering}\n\t\t\t\t\tgroundNodesLoadingResources={deferredRendering?.nodesLoadingResources}\n\t\t\t\t\tdeferredRendering={deferredRendering}\n\t\t\t\t\toptionalSelectedCollectionItemId={optionalSelectedCollectionItemId}\n\t\t\t\t\tperformanceMode={performanceMode}\n\t\t\t\t\tassetMapHash={assetMapHash}\n\t\t\t\t\tcodeRevision={codeRevision}\n\t\t\t\t\trootFontSize={rootFontSize ?? undefined}\n\t\t\t\t\trenderTarget={renderTarget}\n\t\t\t\t\treportError={reportError}\n\t\t\t\t\tactiveLocaleId={activeLocaleId}\n\t\t\t\t\tinSmartComponent={isSmartComponentNode(tree.get(scopeId))}\n\t\t\t\t\tinRelativeOverlayEditMode={inRelativeOverlayEditMode}\n\t\t\t\t\tisVisibleInLocale={isVisibleInLocale}\n\t\t\t\t\tshouldSetMinHeight={shouldSetMinHeight}\n\t\t\t\t/>\n\t\t\t</CanvasCurrentRouteProvider>\n\t\t</div>\n\t)\n\n\t// The codeRevision is a proxy for changed data inside the\n\t// sandboxComponentLoader, but linter cannot know that...\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: see above\n\tconst tokens = useMemo(\n\t\t() => getTokenCSSProperties(ColorStyleTokenListNode.getAllTokenNodes(tree), isDarkMode),\n\t\t[tree, isDarkMode, codeRevision],\n\t)\n\n\treturn <CustomProperties customProperties={tokens}>{content}</CustomProperties>\n})\n\ninterface CanvasElementsProps {\n\ttracker: RenderingStateTracker\n\ttree: CanvasTree\n\toffset: number\n\tzoom: number\n\tisLoadingModules: boolean\n\tisInitialLoad: boolean\n\tisLiveZooming: boolean\n\tgroundNodes: CanvasNode[]\n\tgroundNodesInViewport: Set<string>\n\tgroundNodesDeferredRendering: ReadonlySet<string> | undefined\n\tgroundNodesLoadingResources: ReadonlySet<string> | undefined\n\tdeferredRendering: DeferredRendering | undefined\n\tperformanceMode: boolean\n\tassetMapHash: number\n\tcodeRevision: string\n\trenderTarget: RenderTarget\n\tactiveLocaleId: LocaleId | undefined\n\tinSmartComponent: boolean | undefined\n\tinRelativeOverlayEditMode: boolean | undefined\n\tisVisibleInLocale: boolean\n\toptionalSelectedCollectionItemId: NodeID | undefined\n\trootFontSize: number | undefined\n\treportError: (error: SandboxError) => void\n\tshouldSetMinHeight: boolean\n}\n\n// On chrome, in rare cases, we can be rendering the canvas, but the browser refuses to paint if all\n// we do is change transforms. Like when closing the preview. If we just render anything the problem\n// goes away. This seems to have been fixed in Chrome 121 and later.\nconst chromeVersion = chromeMainVersion()\nconst workaroundChromeNotPaintingBug = chromeVersion < 121\n\nexport const CanvasElements = React.memo(function CanvasElements({\n\ttracker,\n\ttree,\n\toffset,\n\tzoom,\n\tisInitialLoad,\n\tisLoadingModules,\n\tisLiveZooming,\n\tgroundNodes,\n\tgroundNodesInViewport,\n\tgroundNodesDeferredRendering,\n\tgroundNodesLoadingResources,\n\tdeferredRendering,\n\toptionalSelectedCollectionItemId,\n\tperformanceMode,\n\tactiveLocaleId,\n\tassetMapHash,\n\tcodeRevision,\n\trenderTarget,\n\tinSmartComponent,\n\tinRelativeOverlayEditMode,\n\tisVisibleInLocale,\n\trootFontSize,\n\treportError,\n\tshouldSetMinHeight,\n}: CanvasElementsProps) {\n\tconst containerRef = useRef<HTMLDivElement>(null)\n\tconst container = containerRef.current\n\n\t// Update the Library rendering environment\n\tconst { willChangeElements } = useRenderEnvironment(renderTarget, zoom)\n\n\t// See if there are other changes affecting Library output\n\tconst previousAssetMapHash = useRef(assetMapHash)\n\tconst didChangeAssets = previousAssetMapHash.current !== assetMapHash\n\tpreviousAssetMapHash.current = assetMapHash\n\n\tconst previousCodeRevision = useRef(codeRevision)\n\tconst didChangeCode = previousCodeRevision.current !== codeRevision\n\tpreviousCodeRevision.current = codeRevision\n\n\t// Sometimes force re-rendering of everything, including pure/memo components\n\tconst forceRenderCounter = useRef(0)\n\tif (willChangeElements || didChangeAssets || didChangeCode) {\n\t\tforceRenderCounter.current++\n\t\tif (didChangeAssets) {\n\t\t\tgroundNodes.forEach(invalidateRenderCache)\n\t\t}\n\t}\n\n\tconst locales = getRouterLocales(tree, \"includeDrafts\")\n\tconst activeLocale = getRouterLocale(tree, activeLocaleId, \"includeDrafts\")\n\n\tconst localeInfo = useMemo((): LocaleInfo => {\n\t\treturn { activeLocale, locales, setLocale: noopAsync }\n\t}, [locales, activeLocale])\n\n\tconst adaptLayoutToTextDirection = tree.root.adaptLayoutToTextDirection\n\tconst textDirection = localeInfo.activeLocale?.textDirection ?? \"ltr\"\n\tconst layoutDirection = adaptLayoutToTextDirection ? textDirection : \"ltr\"\n\n\tuseLayoutEffect(() => {\n\t\tif (adaptLayoutToTextDirection) {\n\t\t\tdocument.documentElement.setAttribute(\"dir\", textDirection)\n\t\t} else {\n\t\t\tdocument.documentElement.removeAttribute(\"dir\")\n\t\t}\n\t}, [adaptLayoutToTextDirection, textDirection])\n\n\t// Work around SVG issues\n\tuseEffect(() => {\n\t\tif (container) repairStrokedSVGs(container)\n\t}, [container])\n\n\tconst hideNodeContent = performanceMode && groundNodes.length > 200 && zoom < 0.2\n\tconst stylePresetBreakpoints = useStylePresetBreakpoints(tree)\n\n\t// Keep a map of all seen node ids with a timestamp of when they were seen.\n\tconst seenGroundNodes = useConstant(() => new Map<string, number>())\n\tconst activeGroundNodes = new Map<string, CanvasNode>()\n\t// Ensure that all active ground nodes exist in the map.\n\tconst now = performance.now()\n\tfor (const node of groundNodes) {\n\t\tseenGroundNodes.set(node.id, now)\n\t\t// Lookup map for later when we render active ones.\n\t\tactiveGroundNodes.set(node.id, node)\n\t}\n\n\tconst canvasElements: React.ReactNode[] = []\n\n\t// If we need a workaround for Chrome not painting after preview closes, we write engine.update\n\t// invisibly on the canvas.\n\tif (workaroundChromeNotPaintingBug) {\n\t\tcanvasElements.push(\n\t\t\t<div\n\t\t\t\tkey=\"chrome-paint-workaround\"\n\t\t\t\tstyle={{\n\t\t\t\t\twillChange: \"transform\",\n\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\tcolor: \"transparent\",\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{window[\"sandboxApp\"]?.lastEngineUpdate}\n\t\t\t</div>,\n\t\t)\n\t}\n\n\tfor (const [id, timestamp] of seenGroundNodes) {\n\t\t// Clear out ground nodes that have not been seen for a significant amount\n\t\t// of time (enough for them to be unmounted completely).\n\t\t// We reduce the delta resolution to 1 second so we batch remove.\n\t\tif (Math.floor((now - timestamp) / 1_000) >= 1) {\n\t\t\t// Remove stale ground node from map.\n\t\t\tseenGroundNodes.delete(id)\n\t\t\tcontinue\n\t\t}\n\t\tconst node = activeGroundNodes.get(id)\n\t\tif (!node) {\n\t\t\t// React 18 makes errors bubble up outside of the render cycle, so\n\t\t\t// if the error boundary is removed immediately (for example,\n\t\t\t// because we are switching to a new canvas page), and the child\n\t\t\t// inside the error boundary has a pending error, then the error\n\t\t\t// boundary will no longer be around to catch it. This would make\n\t\t\t// the entire sandbox crash and unmount. Because of this we leave\n\t\t\t// the empty error boundary around for a bit so it has time to catch\n\t\t\t// any pending errors.\n\t\t\tcanvasElements.push(<GroundNodeErrorBoundary key={id} id={id} reportError={reportError} />)\n\t\t\tcontinue\n\t\t}\n\t\tconst stylePresetBreakpointClassNames = getStylePresetBreakpointClassNamesForGroundNode(\n\t\t\tstylePresetBreakpoints,\n\t\t\tnode,\n\t\t)\n\t\tcanvasElements.push(\n\t\t\t<GroundNodeErrorBoundary\n\t\t\t\tkey={id}\n\t\t\t\tid={id}\n\t\t\t\tzoom={zoom}\n\t\t\t\trect={getGroundNodeRectWithPinnedPosition(node)}\n\t\t\t\treportError={reportError}\n\t\t\t>\n\t\t\t\t<CanvasElement\n\t\t\t\t\tkey={node.id}\n\t\t\t\t\tnode={node}\n\t\t\t\t\tzoom={zoom}\n\t\t\t\t\toffset={offset}\n\t\t\t\t\ttextDirection={adaptLayoutToTextDirection ? textDirection : undefined}\n\t\t\t\t\thideNodeContent={hideNodeContent}\n\t\t\t\t\tisInitialLoad={isInitialLoad}\n\t\t\t\t\tisLoadingModules={isLoadingModules}\n\t\t\t\t\tisInViewport={groundNodesInViewport.has(node.id)}\n\t\t\t\t\tisDeferredRendering={groundNodesDeferredRendering?.has(node.id) ?? false}\n\t\t\t\t\tisLoadingResources={groundNodesLoadingResources?.has(node.id) ?? false}\n\t\t\t\t\tdeferredRendering={deferredRendering}\n\t\t\t\t\tcomponentLoader={tracker.componentLoader}\n\t\t\t\t\tstylePresetBreakpointClassNames={stylePresetBreakpointClassNames}\n\t\t\t\t\tinSmartComponent={inSmartComponent}\n\t\t\t\t\tinRelativeOverlayEditMode={inRelativeOverlayEditMode}\n\t\t\t\t\trootFontSizeFallback={rootFontSize}\n\t\t\t\t>\n\t\t\t\t\t<LiveZoomGate\n\t\t\t\t\t\ttracker={tracker}\n\t\t\t\t\t\tnode={node}\n\t\t\t\t\t\tisLiveZooming={isLiveZooming}\n\t\t\t\t\t\tactiveLocale={localeInfo.activeLocale ?? undefined}\n\t\t\t\t\t\tshouldSetMinHeight={shouldSetMinHeight}\n\t\t\t\t\t\toptionalSelectedCollectionItemId={optionalSelectedCollectionItemId}\n\t\t\t\t\t/>\n\t\t\t\t</CanvasElement>\n\t\t\t</GroundNodeErrorBoundary>,\n\t\t)\n\t}\n\n\treturn (\n\t\t<LocaleInfoContext.Provider value={localeInfo}>\n\t\t\t<LayoutDirectionContext.Provider value={layoutDirection}>\n\t\t\t\t<FetchClientProvider>\n\t\t\t\t\t<ShaderPoolProvider>\n\t\t\t\t\t\t<MotionConfig isStatic>\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tkey=\"CanvasElements\"\n\t\t\t\t\t\t\t\tref={containerRef}\n\t\t\t\t\t\t\t\tstyle={viewportHeightStyle}\n\t\t\t\t\t\t\t\tclassName={cx(!isVisibleInLocale && styles.canvasElementsDisabled)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{canvasElements}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</MotionConfig>\n\t\t\t\t\t</ShaderPoolProvider>\n\t\t\t\t</FetchClientProvider>\n\t\t\t</LayoutDirectionContext.Provider>\n\t\t</LocaleInfoContext.Provider>\n\t)\n})\n\ninterface LiveZoomGateProps {\n\ttracker: RenderingStateTracker\n\tnode: CanvasNode\n\tisLiveZooming: boolean\n\tactiveLocale: Locale | undefined\n\tshouldSetMinHeight: boolean\n\toptionalSelectedCollectionItemId: NodeID | undefined\n}\n\n/** A component that renders the node as react elements, but only when not in live zooming. */\nconst LiveZoomGate = React.memo<LiveZoomGateProps>(renderElement, (_, { isLiveZooming }) => {\n\treturn isLiveZooming\n})\n\nfunction canDisableShadowsForScope(tree: CanvasTree, scopeId: MaybeNodeID) {\n\tif (scopeId) {\n\t\tconst scopeNode = tree.get(scopeId)\n\t\tif (isVectorSetNode(scopeNode)) return false\n\t}\n\n\treturn true\n}\n\nfunction invalidateRenderCache(subtree: CanvasNode) {\n\tfor (const node of subtree.walk()) {\n\t\tif (node instanceof CodeComponentNode) {\n\t\t\tnode.cache.clearRawControlProps()\n\t\t}\n\t}\n}\n\nfunction getActiveLinkStyleClassName(activeLinkStyle: ActiveLinkStyle | undefined) {\n\tif (!activeLinkStyle) return undefined\n\n\treturn getActiveLinkStylePresetClassName(activeLinkStyle)\n}\n", "import type { VerifiedPropertyControls } from \"@framerjs/framer-runtime\"\nimport { RenderPlaceholder } from \"@framerjs/framer-runtime/components/RenderPlaceholder\"\nimport {\n\tRenderingTaskPriority,\n\ttype SandboxComponentLoader,\n\ttype SandboxDataDefinition,\n\tisSandboxErrorDefinition,\n\tisSandboxRenderableComponentDefinition,\n\trenderingTaskQueues,\n} from \"@framerjs/framer-runtime/sandbox\"\nimport type { LocalModuleExportIdentifierString, ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport {\n\tassert,\n\tModuleType,\n\tassertNever,\n\terrorIdentifierFromModuleIdentifier,\n\tgetLogger,\n\tisEmptyObject,\n\tisExternalModuleIdentifier,\n\tisLocalModuleIdentifier,\n\tparseModuleIdentifier,\n\tunhandledError,\n} from \"@framerjs/shared\"\nimport { employeesOnlySettings } from \"app/employeesOnlySettings.ts\"\nimport { createComponentFontHash } from \"code-generation/utils/createComponentFontHash.ts\"\nimport { flattenComponentFontBundles } from \"code-generation/utils/flattenComponentFonts.ts\"\nimport { getQueryForDataRepeater } from \"code-generation/utils/valueTransformCollector/getQueryForDataRepeater.ts\"\nimport { getSelectedCollectionItem } from \"document/components/utils/collectionItemUtils.ts\"\nimport { hasLoadMoreActions } from \"document/models/CanvasTree/actions/paginationActions.ts\"\nimport type {\n\tCanvasNode,\n\tCanvasTree,\n\tCodeComponentNode,\n\tCollectionNode,\n\tNodeID,\n\tScopeNode,\n} from \"document/models/CanvasTree/index.ts\"\nimport { FrameNode, RichTextNode, TextNode, isScopeNode, isVectorNode } from \"document/models/CanvasTree/index.ts\"\nimport { getContentManagementNode } from \"document/models/CanvasTree/nodes/ContentManagementNode.utils.ts\"\nimport type { ExternalModuleNode } from \"document/models/CanvasTree/nodes/ExternalModuleNode.ts\"\nimport type { DataRepeater } from \"document/models/CanvasTree/nodes/FrameNode.ts\"\nimport { stringFromNodeID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { getArraySourceVariablesFromControlDescription } from \"document/models/CanvasTree/nodes/getArraySourceVariablesFromControlDescription.ts\"\nimport {\n\tcompileRichTextForCanvasRendering,\n\tcompileRichTextForCanvasRenderingMemoized,\n} from \"document/models/CanvasTree/nodes/utils/compileRichText.tsx\"\nimport {\n\tisArrayRepeater,\n\tisCanvasPageNode,\n\tisCodeComponentNode,\n\tisCollectionRepeater,\n\tisDataRepeater,\n\tisFormBooleanInputNode,\n\tisFormPlainTextInputNode,\n\tisFormSelectNode,\n\tisOverlayNode,\n\tisSVGNode,\n\tisShaderNode,\n\tisShapeContainerNode,\n\tisSlotNode,\n\tisWebPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport {\n\tisFixedOrRelativeOverlay,\n\tisValidSandboxOverlay,\n} from \"document/models/CanvasTree/nodes/utils/overlayHelpers.ts\"\nimport { getChildrenSlotItems, getSlotItemsBySlotKey } from \"document/models/CanvasTree/nodes/utils/slotUtils.ts\"\nimport type {\n\tCombinedVariableProviderControlMap,\n\tCombinedVariableProviderValueMap,\n\tVariableProviderControlMap,\n\tVariableProviderValueMap,\n} from \"document/models/CanvasTree/traits/VariableProvider.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { hasCollectionDataSource } from \"document/models/CanvasTree/traits/WithCollectionDataSource.ts\"\nimport { hasPaginationEnabled } from \"document/models/CanvasTree/traits/WithCollectionOptions.ts\"\nimport { withControlProps } from \"document/models/CanvasTree/traits/WithControlProps.ts\"\nimport { withDOMLayout } from \"document/models/CanvasTree/traits/WithDOMLayout.ts\"\nimport {\n\thasDataLoaderDisabledVariant,\n\tisRepeaterLoaderInstance,\n} from \"document/models/CanvasTree/traits/WithDataLoaderVariants.ts\"\nimport { withFill } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport { hasFloatingPosition } from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport { type WithLayout, hasAnyLayout, withLayout } from \"document/models/CanvasTree/traits/WithLayout.ts\"\nimport { hasLayoutTemplate } from \"document/models/CanvasTree/traits/WithLayoutTemplate.ts\"\nimport { defaultLocaleId } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport type { WithPins } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport { type HasRepeatArray, hasRepeatArray } from \"document/models/CanvasTree/traits/WithRepeatArray.ts\"\nimport { withSize } from \"document/models/CanvasTree/traits/WithSize.ts\"\nimport { hasAnyViewHeightConstraints, usingViewHeight } from \"document/models/CanvasTree/traits/WithSizeConstraints.ts\"\nimport {\n\thasViewportHeight,\n\thasViewportWidth,\n\tviewportUnitToPixelValueOnCanvas,\n} from \"document/models/CanvasTree/traits/WithSizeDimensionType.ts\"\nimport { hasTickerEffect } from \"document/models/CanvasTree/traits/WithTickerEffect.ts\"\nimport { isCanvasScopeWithVariables } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { collectFixedPositionCustomPropertyOverrides } from \"document/models/CanvasTree/traits/collectStyles/collectLayout.ts\"\nimport { getArrayProviderNodeInAncestorScope } from \"document/models/CanvasTree/traits/utils/getArrayProviderNodeInAncestorScope.ts\"\nimport { ALL_IDENTIFIERS } from \"document/models/CanvasTree/traits/utils/hardCodedCodeComponentIdentifiers.ts\"\nimport {\n\tcanNodeProvideViewportRect,\n\tgetViewportHeight,\n} from \"document/models/CanvasTree/traits/utils/viewportHelpers.ts\"\nimport { isRichTextDocument } from \"document/models/richText/richTextStorage.ts\"\nimport {\n\tgetLocaleCombinedVariableProviderControlMap,\n\tgetLocaleCombinedVariableProviderValueMap,\n\tisProvidingLocaleVariable,\n} from \"document/utils/LocaleVariable.ts\"\nimport {\n\ttype RenderId,\n\tgetChildRenderId,\n\tgetComponentSlotRenderId,\n\tgetRepeatedChildRenderId,\n\tisPrimaryRenderId,\n} from \"document/utils/RenderId.ts\"\nimport { createNonRepeatedChildMapsFromRepeaterMaps } from \"document/utils/RepeaterVariables.ts\"\nimport { ControlType, DimensionType, FrameWithMotion, RichText, SVG, Text, isEqual } from \"library/index.ts\"\nimport type { QueryResult } from \"library/modules/cms/QueryEngine.ts\"\nimport type { Expression } from \"library/modules/cms/types.ts\"\nimport type { Locale } from \"library/router/types.ts\"\nimport type { ReactNode } from \"react\"\nimport React from \"react\"\nimport { CanvasRichText } from \"renderer/CanvasRichText.tsx\"\nimport { getItemToSlug } from \"utils/collectionSlugUtils.ts\"\nimport { getCollectionForIdentifier } from \"utils/getCollectionForIdentifier.ts\"\nimport { memoizeOne } from \"utils/memoizeOne.ts\"\nimport { getNearestAncestorDataRepeater, getRepeatedItemOfDataRepeater } from \"utils/repeaterUtils.ts\"\nimport { isArray, isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { ModuleState } from \"utils/useModuleState.tsx\"\nimport { maybeRenderWithFloatingPosition } from \"./CanvasFloatingPosition.tsx\"\nimport { CanvasFormBooleanInput, CanvasFormPlainTextInput, CanvasFormSelect } from \"./CanvasFormElements.tsx\"\nimport type { CanvasLayoutProps } from \"./CanvasLayout.tsx\"\nimport { CanvasLayout } from \"./CanvasLayout.tsx\"\nimport { maybeRenderWithLayoutTemplate } from \"./CanvasLayoutTemplate.tsx\"\nimport { CanvasOverlay } from \"./CanvasOverlay.tsx\"\nimport { ViewportCanvasPortal, viewportPortalID, visibleOverflowPortalID } from \"./CanvasPortal.tsx\"\nimport { CanvasSlot } from \"./CanvasSlot.tsx\"\nimport { CanvasVector, reactComponentForVectorSetIdentifier } from \"./CanvasVector.tsx\"\nimport { ComponentContainer } from \"./ComponentContainer.tsx\"\nimport { DataRepeaterNoItemsPlaceholder } from \"./DataRepeaterNoItemsPlaceholder.tsx\"\nimport { ExternalModuleContainer, LocalModuleContainer } from \"./ModuleContainers.tsx\"\nimport type { NodeRendering, RenderingStateTracker } from \"./RenderingStateTracker.ts\"\nimport { ResponsiveScreenContainer } from \"./ResponsiveScreenContainer.tsx\"\nimport { ShaderNodeRenderer } from \"./ShaderNodeRenderer.tsx\"\nimport {\n\taddPaginationClauseToQuery,\n\tcreateValueMapForRepeatedChild,\n\tgetComponentIdentifiersForCollectionNode,\n\tgetQueryForWebPageNode,\n\tresolveCollection,\n} from \"./collectionRenderUtils.ts\"\nimport { getAssetResolverWithHash } from \"./getAssetResolver.ts\"\nimport { getVectorForNode } from \"./getVectorForNode.tsx\"\nimport { resetCacheForGraphics } from \"./resetCacheForGraphics.tsx\"\nimport { getRichTextChildren, getRichTextRelativeDate, getRichTextViewBox } from \"./richTextRenderUtils.tsx\"\nimport { updateStackAndGridChildCacheForCanvasSandbox } from \"./updateStackAndGridChildCache.ts\"\nimport { getVariableReferencesForProvider } from \"./utils/getVariableReferencesForProvider.ts\"\nimport { RenderedInPortal } from \"./withCanvasFixedPositioning.tsx\"\n\nconst log = getLogger(\"CanvasNodeRenderer\")\n\ninterface Props {\n\ttracker: RenderingStateTracker\n\tnode: CanvasNode\n\tparent: CanvasNode\n\tparentRenderId: RenderId\n\tgroundNodeId: NodeID\n\tcombinedValueMap?: CombinedVariableProviderValueMap\n\tcombinedControlMap?: CombinedVariableProviderControlMap\n\tactiveLocale?: Locale\n\tlayoutTemplateIdentifier?: LocalModuleExportIdentifierString | null | undefined\n\tlayoutTemplatePropsVersion?: number | undefined\n\tshouldSetMinHeight?: boolean\n\toptionalSelectedCollectionItemId: NodeID | undefined\n\t/** When true, rich text control props on code components should be skipped for loading state:\n\t * It temporarily withholds rich text props from code components while data is still loading inside repeaters\n\t * during AI generation. Without this, we would compile and render rich text too early, causing flicker.\n\t * By suppressing them, components can show proper loading states, and we only render the text once r\n\t * eal data is ready.\n\t */\n\tskipRichTextProps?: boolean\n\tskipNodeLevelRepeat?: boolean\n}\n\n// Code components might read and write properties using React.Children and React.CloneNode. For\n// those we precompute the properties and pass them in via \"private\" fields.\ninterface PrecomputedProps {\n\t__tracker: RenderingStateTracker\n\t__node: CanvasNode\n\t__renderId: RenderId\n\t__combinedValueMap: CombinedVariableProviderValueMap | undefined\n\t__combinedVariableControlMap: CombinedVariableProviderControlMap | undefined\n\t__activeLocale: Locale | undefined\n\t__groundNodeId: NodeID\n}\n\n// The CanvasNodeRenderer component is a memo, but we only want to re-render if a select few\n// properties of the parent changes.\nfunction canvasNodeRendererPropsAreSame(prev: Props, next: Props): boolean {\n\t// Most properties we care about by identity.\n\tif (prev.node !== next.node) return false\n\tif (prev.parentRenderId !== next.parentRenderId) return false\n\tif (prev.groundNodeId !== next.groundNodeId) return false\n\tif (prev.combinedValueMap !== next.combinedValueMap) return false\n\tif (prev.combinedControlMap !== next.combinedControlMap) return false\n\tif (prev.activeLocale !== next.activeLocale) return false\n\tif (prev.shouldSetMinHeight !== next.shouldSetMinHeight) return false\n\tif (prev.optionalSelectedCollectionItemId !== next.optionalSelectedCollectionItemId) return false\n\n\t// Check if layout template props have changed\n\tif (prev.layoutTemplateIdentifier !== next.layoutTemplateIdentifier) {\n\t\treturn false\n\t}\n\tif (prev.layoutTemplatePropsVersion !== next.layoutTemplatePropsVersion) {\n\t\treturn false\n\t}\n\n\t// Except parent, for it we want to rerender only if certain properties change. Mostly for\n\t// updateStackAndGridChildCache. Notice we don't really care about the content of these fields\n\t// or if they exist, only if they change, hence the cast to a partial type.\n\tconst prevParent = prev.parent\n\tconst nextParent = next.parent\n\n\tif (\n\t\t!parentLayoutIsSame(\n\t\t\tprevParent as CanvasNode & WithLayout & WithPins,\n\t\t\tnextParent as CanvasNode & WithLayout & WithPins,\n\t\t)\n\t) {\n\t\treturn false\n\t}\n\n\treturn true\n}\n\nfunction parentLayoutIsSame(\n\tprevParent: CanvasNode & WithLayout & WithPins,\n\tnextParent: CanvasNode & WithLayout & WithPins,\n): boolean {\n\tif (prevParent.layout !== nextParent.layout) return false\n\tif (!nextParent.layout) return true\n\n\t// Only check these properties if the parent has a layout in the first place.\n\tif (prevParent.gridRowHeightType !== nextParent.gridRowHeightType) {\n\t\treturn false\n\t}\n\tif (prevParent.gridColumnCount !== nextParent.gridColumnCount) return false\n\tif (prevParent.gridType !== nextParent.gridType) return false\n\tif (prevParent.stackDirection !== nextParent.stackDirection) return false\n\tif (prevParent.widthType !== nextParent.widthType) return false\n\tif (prevParent.heightType !== nextParent.heightType) return false\n\n\treturn true\n}\n\ninterface NodeForStateArgs {\n\ttracker: RenderingStateTracker\n\tnode: CodeComponentNode\n\trendering: NodeRendering\n\tgroundNodeId: NodeID\n\tcombinedValueMap: CombinedVariableProviderValueMap | undefined\n\tcombinedControlMap: CombinedVariableProviderControlMap | undefined\n\tactiveLocale: Locale | undefined\n}\n\n// Used by ExternalModuleContainer, defined here and passed as prop to avoid circular dependencies\nfunction nodeForState(state: ModuleState, args: NodeForStateArgs): React.ReactNode {\n\tif (state.status === \"loading\") {\n\t\targs.tracker.trackLoading(args.rendering.id)\n\t\treturn <RenderPlaceholder key=\"loading-placeholder\" />\n\t} else if (state.status === \"error\") {\n\t\targs.tracker.trackLoaded(args.rendering.id)\n\t\treturn <RenderPlaceholder error={{ title: state.title, message: state.message }} />\n\t}\n\n\targs.tracker.trackLoaded(args.rendering.id)\n\n\tconst Component = state.definition.class\n\tconst [componentProps, componentChildren] = getCodeComponentPropsAndChildren(\n\t\targs.tracker,\n\t\targs.node,\n\t\targs.rendering,\n\t\targs.groundNodeId,\n\t\targs.combinedValueMap,\n\t\targs.combinedControlMap,\n\t\targs.activeLocale,\n\t\t/* skipRichTextProps */ false,\n\t)\n\n\treturn <Component {...componentProps}>{componentChildren}</Component>\n}\n\nfunction codeComponentForNode(\n\ttracker: RenderingStateTracker,\n\tnode: CodeComponentNode,\n\trendering: NodeRendering,\n\tgroundNodeId: NodeID,\n\tcombinedValueMap: CombinedVariableProviderValueMap | undefined,\n\tcombinedControlMap: CombinedVariableProviderControlMap | undefined,\n\tactiveLocale: Locale | undefined,\n\tskipRichTextProps: boolean,\n): JSX.Element | null {\n\tconst componentIdentifier = node.codeComponentIdentifier\n\tconst componentDefinition = tracker.componentLoader.renderableComponentForIdentifier(componentIdentifier)\n\tconst [props, children] = getCodeComponentPropsAndChildren(\n\t\ttracker,\n\t\tnode,\n\t\trendering,\n\t\tgroundNodeId,\n\t\tcombinedValueMap,\n\t\tcombinedControlMap,\n\t\tactiveLocale,\n\t\tskipRichTextProps,\n\t)\n\n\tlet shouldDelay = false\n\tif (ALL_IDENTIFIERS.has(componentIdentifier)) {\n\t\tprops.__fromCodeComponentNode = true\n\t\tshouldDelay = true\n\t}\n\n\tif (componentDefinition?.type === \"responsiveScreen\") {\n\t\tconst size = node.rect(null)\n\t\tprops.style = { width: \"100%\", minHeight: \"100%\" }\n\t\tprops.width = size.width\n\t}\n\n\tconst codeComponent = reactElementForComponentIdentifier(\n\t\ttracker.componentLoader,\n\t\tcomponentIdentifier,\n\t\tprops,\n\t\tchildren,\n\t)\n\n\t// We wrap page and scroll components in a delay, so that when loading a new page into the\n\t// canvas, we can delay rendering that duplicated content until all image assets and other\n\t// things have loaded. This speeds up loading. And keeps the canvas more reponsive while\n\t// starting to render page and scroll components.\n\tif (shouldDelay) return <DelayPageScroll>{codeComponent}</DelayPageScroll>\n\treturn codeComponent\n}\n\nfunction getCodeComponentPropsAndChildren(\n\ttracker: RenderingStateTracker,\n\tnode: CodeComponentNode,\n\trendering: NodeRendering,\n\tgroundNodeId: NodeID,\n\tcombinedValueMap: CombinedVariableProviderValueMap | undefined,\n\tcombinedControlMap: CombinedVariableProviderControlMap | undefined,\n\tactiveLocale: Locale | undefined,\n\tskipRichTextProps: boolean,\n): [props: Record<string, unknown>, children: React.ReactNode[]] {\n\tconst assetResolverWithHash = getAssetResolverWithHash()\n\n\tconst props = node.getCodeComponentProps(\n\t\ttracker.componentLoader,\n\t\tassetResolverWithHash,\n\t\tcombinedValueMap,\n\t\tactiveLocale,\n\t\ttracker.createFetchDataValueResolver(node),\n\t)\n\tconst tree = node.tree()!\n\tconst componentChildren = getChildrenSlotItems(tree, node, tracker.componentLoader)\n\tconst slotItemsBySlotKey = getSlotItemsBySlotKey(tree, node, tracker.componentLoader)\n\n\tconst children = componentChildren.map(childItem => {\n\t\tconst renderId = getComponentSlotRenderId(rendering.id, node.id, \"children\", childItem.key)\n\n\t\treturn (\n\t\t\t<PrecomputedCanvasNodeRenderer\n\t\t\t\tkey={childItem.key}\n\t\t\t\t__tracker={tracker}\n\t\t\t\t__node={childItem.node}\n\t\t\t\t__combinedValueMap={combinedValueMap}\n\t\t\t\t__combinedVariableControlMap={combinedControlMap}\n\t\t\t\t__activeLocale={activeLocale}\n\t\t\t\t__groundNodeId={groundNodeId}\n\t\t\t\t{...getPrecomputedProps(\n\t\t\t\t\ttracker,\n\t\t\t\t\tchildItem.node,\n\t\t\t\t\trenderId,\n\t\t\t\t\tcombinedValueMap,\n\t\t\t\t\tcombinedControlMap,\n\t\t\t\t\tactiveLocale,\n\t\t\t\t\tchildItem.key,\n\t\t\t\t)}\n\t\t\t/>\n\t\t)\n\t})\n\n\tfor (const slotKey in slotItemsBySlotKey) {\n\t\t// The children property will already have been processed by the above children.\n\t\tif (slotKey === \"children\") continue\n\n\t\tconst slotItems = slotItemsBySlotKey[slotKey]\n\t\tif (!slotItems) continue\n\n\t\tprops[slotKey] = slotItems.map(slotItem => {\n\t\t\tconst renderId = getComponentSlotRenderId(rendering.id, node.id, slotKey, slotItem.key)\n\n\t\t\treturn (\n\t\t\t\t<PrecomputedCanvasNodeRenderer\n\t\t\t\t\tkey={slotItem.key}\n\t\t\t\t\t__tracker={tracker}\n\t\t\t\t\t__node={slotItem.node}\n\t\t\t\t\t__combinedValueMap={combinedValueMap}\n\t\t\t\t\t__combinedVariableControlMap={combinedControlMap}\n\t\t\t\t\t__activeLocale={activeLocale}\n\t\t\t\t\t__groundNodeId={groundNodeId}\n\t\t\t\t\t{...getPrecomputedProps(\n\t\t\t\t\t\ttracker,\n\t\t\t\t\t\tslotItem.node,\n\t\t\t\t\t\trenderId,\n\t\t\t\t\t\tcombinedValueMap,\n\t\t\t\t\t\tcombinedControlMap,\n\t\t\t\t\t\tactiveLocale,\n\t\t\t\t\t\tslotItem.key,\n\t\t\t\t\t)}\n\t\t\t\t/>\n\t\t\t)\n\t\t})\n\t}\n\n\tconst richTextProps = node.getRichTextControlKeys(tracker.componentLoader)\n\tfor (const name of richTextProps) {\n\t\t// skip rich text props during AI generation for repeated children to show loading state.\n\t\t// We should only compile props which have not previously been compiled.\n\t\tconst value = !skipRichTextProps ? props[name] : undefined\n\t\tif (isString(value)) {\n\t\t\tprops[name] = compileRichTextForCanvasRenderingMemoized(value)\n\t\t} else if (isRichTextDocument(value)) {\n\t\t\tprops[name] = compileRichTextForCanvasRendering(value)\n\t\t}\n\t}\n\n\tconst vectorSetItemProps = node.getComponentVectorSetChildren(tracker.componentLoader, combinedValueMap)\n\tfor (const key in vectorSetItemProps) {\n\t\tconst value = vectorSetItemProps[key]\n\t\tif (isUndefined(value)) continue\n\t\tprops[key] = reactComponentForVectorSetIdentifier(value)\n\t}\n\n\t// Enable dataLoaderDisabledVariant when their repeater is showing empty state\n\tif (hasDataLoaderDisabledVariant(node)) {\n\t\t// e.g. Load More: action connected to closest ancestor repeater\n\t\tconst ancestorRepeater = getNearestAncestorDataRepeater(node)\n\t\tif (\n\t\t\tancestorRepeater &&\n\t\t\thasLoadMoreActions(tracker.componentLoader, node) &&\n\t\t\ttracker.isRepeaterShowingEmptyState(ancestorRepeater.id)\n\t\t) {\n\t\t\tprops.variant = node.dataLoaderDisabledVariant\n\t\t}\n\n\t\t// e.g. Infinite Scroll: connected via dataSourceLoaderId\n\t\tfor (const ancestor of node.ancestors()) {\n\t\t\tif (isDataRepeater(ancestor)) {\n\t\t\t\tif (isRepeaterLoaderInstance(node, ancestor) && tracker.isRepeaterShowingEmptyState(ancestor.id)) {\n\t\t\t\t\tprops.variant = node.dataLoaderDisabledVariant\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\t// TODO what to do with placeholders?\n\t// props.placeholders = node.cache.placeholders\n\treturn [props, children]\n}\n\ntype DataLoadingState =\n\t| {\n\t\t\ttype: \"loading\"\n\t  }\n\t| {\n\t\t\ttype: \"error\"\n\t\t\terror: string\n\t  }\n\t| {\n\t\t\ttype: \"successFromComponentLoader\"\n\t\t\tdataDefinition: SandboxDataDefinition\n\t  }\n\t| {\n\t\t\ttype: \"successFromTree\"\n\t  }\n\ntype DataLoadingSuccessState = Extract<DataLoadingState, { type: \"successFromComponentLoader\" | \"successFromTree\" }>\n\nfunction getLoadingStateForDataIdentifier(\n\ttree: CanvasTree,\n\ttracker: RenderingStateTracker,\n\tdataIdentifier: ModuleExportIdentifierString,\n\trenderId: RenderId,\n): DataLoadingState {\n\tconst dataIdentifiers = new Set<ModuleExportIdentifierString>()\n\tdataIdentifiers.add(dataIdentifier)\n\n\tlet successStateForDataIdentifier: DataLoadingSuccessState | undefined = undefined\n\n\tfor (const currentIdentifier of dataIdentifiers) {\n\t\tconst loadingState = getLoadingStateForDataIdentifierWithoutReferences(tree, tracker, currentIdentifier, renderId)\n\n\t\tif (loadingState.type === \"loading\" || loadingState.type === \"error\") {\n\t\t\treturn loadingState\n\t\t}\n\n\t\tif (currentIdentifier === dataIdentifier) {\n\t\t\tsuccessStateForDataIdentifier = loadingState\n\t\t}\n\n\t\tlet controls: VerifiedPropertyControls | undefined\n\n\t\tif (loadingState.type === \"successFromTree\") {\n\t\t\tconst collectionNode = getCollectionForIdentifier(tree, currentIdentifier)\n\t\t\tassert(collectionNode, \"Collection node should exist\")\n\t\t\tcontrols = collectionNode.getPropertyControlsIncludingAutoGenerated(tree, tracker.componentLoader)\n\t\t} else {\n\t\t\tcontrols = loadingState.dataDefinition.properties\n\t\t}\n\n\t\tfor (const control of Object.values(controls)) {\n\t\t\tif (control?.type === ControlType.CollectionReference || control?.type === ControlType.MultiCollectionReference) {\n\t\t\t\tdataIdentifiers.add(control.dataIdentifier as ModuleExportIdentifierString)\n\t\t\t}\n\t\t}\n\t}\n\n\tassert(successStateForDataIdentifier, \"Should have loaded successfully\")\n\treturn successStateForDataIdentifier\n}\n\nfunction getLoadingStateForDataIdentifierWithoutReferences(\n\ttree: CanvasTree,\n\ttracker: RenderingStateTracker,\n\tdataIdentifier: ModuleExportIdentifierString,\n\trenderId: RenderId,\n): DataLoadingState {\n\tconst contentManagementNode = getContentManagementNode(tree)?.loaded\n\tconst controlsByDataIdentifier = contentManagementNode?.getControlsIncludingAutoGeneratedByIdentifierMap(\n\t\ttree,\n\t\ttracker.componentLoader,\n\t)\n\tconst controls = controlsByDataIdentifier?.get(dataIdentifier)\n\tif (controls) {\n\t\tconst collectionNode = getCollectionForIdentifier(tree, dataIdentifier)\n\n\t\tif (collectionNode) {\n\t\t\tconst collectionLoadingState = getLoadingStateForComponentsInCollectionNode(tracker, collectionNode, renderId)\n\n\t\t\tif (collectionLoadingState) return collectionLoadingState\n\t\t}\n\n\t\treturn { type: \"successFromTree\" }\n\t}\n\n\tconst dataDefinition = tracker.componentLoader.dataForIdentifier(dataIdentifier)\n\n\tif (dataDefinition) {\n\t\tconst collectionNode = getCollectionForIdentifier(tree, dataIdentifier)\n\t\tif (collectionNode) {\n\t\t\tconst collectionLoadingState = getLoadingStateForComponentsInCollectionNode(tracker, collectionNode, renderId)\n\n\t\t\tif (collectionLoadingState) return collectionLoadingState\n\t\t}\n\n\t\treturn { type: \"successFromComponentLoader\", dataDefinition }\n\t}\n\n\t// When not success we want to load the module and subscribe to updates.\n\tif (isLocalModuleIdentifier(dataIdentifier)) {\n\t\ttracker.loadLocalModule(dataIdentifier, renderId)\n\t}\n\n\t// Check if the module is known with the modules runtime. Otherwise we have a buggy document\n\t// linking unknown collections.\n\tconst moduleExists = tracker.modulesRuntime.moduleExists(dataIdentifier)\n\tif (!moduleExists) {\n\t\treturn { type: \"error\", error: \"Collection does not exist\" }\n\t}\n\n\t// Check if there is an error loading the module.\n\tconst errorDefinition = tracker.componentLoader.errorForIdentifier(dataIdentifier)\n\tif (errorDefinition) {\n\t\treturn { type: \"error\", error: errorDefinition.error }\n\t}\n\n\t// Check if maybe the module has loaded properly but it was not a collection module.\n\tconst anyDefinition = tracker.componentLoader.componentForIdentifier(dataIdentifier)\n\tif (anyDefinition) {\n\t\treturn { type: \"error\", error: \"Module is not a collection\" }\n\t}\n\n\t// Otherwise we are still downloading or evaluating modules.\n\treturn { type: \"loading\" }\n}\n\nfunction getLoadingStateForComponentsInCollectionNode(\n\ttracker: RenderingStateTracker,\n\tcollectionNode: CollectionNode,\n\trenderId: RenderId,\n): DataLoadingState | undefined {\n\tconst componentIdentifiers = getComponentIdentifiersForCollectionNode(collectionNode)\n\n\tfor (const componentIdentifier of componentIdentifiers) {\n\t\tconst componentDefinition = tracker.componentLoader.componentForIdentifier(componentIdentifier)\n\t\tif (componentDefinition) continue\n\n\t\tif (isLocalModuleIdentifier(componentIdentifier)) {\n\t\t\t// For local modules, match reactElementForNode: load without checking errorForIdentifier first, since\n\t\t\t// it treats missing local modules as errors even when they just haven't been loaded yet.\n\t\t\tconst hasBeenEvaluated = tracker.modulesRuntime.getLocalModuleExports(componentIdentifier) !== undefined\n\n\t\t\tif (!hasBeenEvaluated) {\n\t\t\t\ttracker.loadLocalModule(componentIdentifier, renderId)\n\t\t\t} else {\n\t\t\t\t// After evaluation completes, check for actual error entities from failed evaluation\n\t\t\t\tconst parsedId = parseModuleIdentifier(componentIdentifier)\n\t\t\t\tif (parsedId) {\n\t\t\t\t\tconst errorIdentifier = errorIdentifierFromModuleIdentifier(parsedId)\n\t\t\t\t\tconst errorEntity = tracker.componentLoader.componentForIdentifier(errorIdentifier)\n\t\t\t\t\tif (errorEntity && isSandboxErrorDefinition(errorEntity)) {\n\t\t\t\t\t\treturn { type: \"error\", error: errorEntity.error }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// For non-local modules, check for errors first before attempting to load. errorForIdentifier only\n\t\t\t// auto-creates an error for local modules. If the identifier belongs to an external bundle, it just returns\n\t\t\t// null, which means \u201Ccould still be loading.\u201D\n\t\t\tconst errorDefinition = tracker.componentLoader.errorForIdentifier(componentIdentifier)\n\t\t\tif (errorDefinition) {\n\t\t\t\treturn { type: \"error\", error: errorDefinition.error }\n\t\t\t}\n\n\t\t\tif (isExternalModuleIdentifier(componentIdentifier)) {\n\t\t\t\ttracker.waitForExternalModule(componentIdentifier, renderId).catch(unhandledError)\n\t\t\t}\n\t\t}\n\n\t\t// Check if the module is known with the modules runtime. Otherwise we have a buggy\n\t\t// collection linking to unknown components.\n\t\tconst componentExists = tracker.modulesRuntime.moduleExists(componentIdentifier)\n\t\tif (!componentExists) {\n\t\t\treturn {\n\t\t\t\ttype: \"error\",\n\t\t\t\terror: \"Component inside collection does not exist\",\n\t\t\t}\n\t\t}\n\n\t\t// Otherwise we are still downloading or evaluating modules.\n\t\treturn { type: \"loading\" }\n\t}\n}\n\nfunction getRepeatedChildren(\n\ttracker: RenderingStateTracker,\n\tnode: DataRepeater,\n\ttree: CanvasTree,\n\tgroundNodeId: NodeID,\n\trendering: NodeRendering,\n\tcombinedValueMap: CombinedVariableProviderValueMap | undefined,\n\tcombinedControlMap: CombinedVariableProviderControlMap | undefined,\n\tactiveLocale: Locale | undefined,\n\tskipRichTextProps: boolean,\n\tshouldRenderRepeatedChild: boolean,\n): { repeatedChildren: React.ReactNode; itemCount: number } {\n\tconst repeatedChild = getRepeatedItemOfDataRepeater(tree, node)\n\tconst repeatedChildForLegacy = shouldRenderRepeatedChild ? repeatedChild : undefined\n\tconst isMissingRepeatedChildForLegacy = !repeatedChildForLegacy && shouldRenderRepeatedChild\n\n\ttracker.trackLoading(rendering.id)\n\n\tif (isCollectionRepeater(node)) {\n\t\tconst dataIdentifier = node.dataIdentifier\n\n\t\tconst loadingState = getLoadingStateForDataIdentifier(tree, tracker, dataIdentifier, rendering.id)\n\n\t\tif (loadingState.type === \"loading\") {\n\t\t\treturn {\n\t\t\t\trepeatedChildren: <DataRepeaterNoItemsPlaceholder reason=\"loading\" node={node} tree={tree} />,\n\t\t\t\titemCount: 0,\n\t\t\t}\n\t\t}\n\n\t\ttracker.trackLoaded(rendering.id)\n\n\t\tif (loadingState.type === \"error\") {\n\t\t\treturn {\n\t\t\t\trepeatedChildren: (\n\t\t\t\t\t<DataRepeaterNoItemsPlaceholder reason=\"collectionError\" node={node} tree={tree} error={loadingState.error} />\n\t\t\t\t),\n\t\t\t\titemCount: 0,\n\t\t\t}\n\t\t}\n\n\t\tlet collectionList: QueryResult | undefined\n\n\t\tconst controlMap = node.getProvidedControlMap(\n\t\t\ttree,\n\t\t\tundefined,\n\t\t\ttracker.componentLoader,\n\t\t\ttracker.state.componentLoaderHash,\n\t\t)\n\t\tassert(controlMap, \"Control map must exist\")\n\n\t\t// One set of controls for all items.\n\t\tlet childCombinedControlMap = new Map(combinedControlMap)\n\t\tchildCombinedControlMap.set(node.getPrimaryId(), controlMap)\n\n\t\t// If equal to the previous rendering, we use that map instead, so props are shallow equal again.\n\t\tif (rendering.cachedControlMap && isEqual(rendering.cachedControlMap, childCombinedControlMap)) {\n\t\t\tchildCombinedControlMap = rendering.cachedControlMap\n\t\t} else {\n\t\t\trendering.cachedControlMap = childCombinedControlMap\n\t\t}\n\n\t\tconst usedVariableIds = getVariableReferencesForProvider(tree, node)\n\t\tconst selectedVariableIds = new Set(usedVariableIds)\n\n\t\tconst query = getQueryForDataRepeater(\n\t\t\tnode,\n\t\t\tchildCombinedControlMap,\n\t\t\tselectedVariableIds,\n\t\t\t(variable): Expression => {\n\t\t\t\tconst value = node.cache.getVariableReferenceValue(variable, combinedValueMap)\n\t\t\t\treturn { type: \"LiteralValue\", value }\n\t\t\t},\n\t\t\tidentifier => resolveCollection(tree, tracker.componentLoader, node, identifier, activeLocale),\n\t\t)\n\n\t\tif (hasPaginationEnabled(node)) {\n\t\t\taddPaginationClauseToQuery(query, node)\n\t\t}\n\n\t\t// Limit the amount of items on the canvas to prevent it from slowing down or crashing.\n\t\tquery.limit ??= {\n\t\t\ttype: \"LiteralValue\",\n\t\t\tvalue: 50,\n\t\t}\n\n\t\ttry {\n\t\t\tcollectionList = tracker.queryCollection(rendering, query, activeLocale)\n\t\t} catch (error) {\n\t\t\tlog.reportError(error)\n\t\t\ttracker.sandboxRepeaterData.set(rendering.id, undefined, controlMap)\n\t\t\treturn {\n\t\t\t\trepeatedChildren: <DataRepeaterNoItemsPlaceholder reason=\"queryError\" node={node} tree={tree} />,\n\t\t\t\titemCount: 0,\n\t\t\t}\n\t\t}\n\n\t\tif (!collectionList) {\n\t\t\ttracker.sandboxRepeaterData.set(rendering.id, undefined, controlMap)\n\t\t\treturn {\n\t\t\t\trepeatedChildren: <DataRepeaterNoItemsPlaceholder reason=\"loading\" node={node} tree={tree} />,\n\t\t\t\titemCount: 0,\n\t\t\t}\n\t\t}\n\n\t\tif (rendering.repeaterShowingEmptyState) {\n\t\t\tcollectionList = []\n\t\t}\n\t\ttracker.sandboxRepeaterData.set(rendering.id, collectionList, controlMap)\n\t\tconst itemCount = collectionList.length\n\n\t\tif (isMissingRepeatedChildForLegacy) {\n\t\t\treturn {\n\t\t\t\trepeatedChildren: <DataRepeaterNoItemsPlaceholder reason=\"missingChild\" node={node} tree={tree} />,\n\t\t\t\titemCount,\n\t\t\t}\n\t\t}\n\n\t\tif (itemCount === 0) {\n\t\t\tif (repeatedChildForLegacy) {\n\t\t\t\tconst repeatedChildRenderId = getChildRenderId(rendering.id, repeatedChildForLegacy.id)\n\t\t\t\ttracker.sandboxVisibility.setVisible(repeatedChildRenderId, false)\n\t\t\t}\n\n\t\t\tconst itemToSlug = getItemToSlug(tree, tracker.componentLoader, dataIdentifier, activeLocale?.id)\n\t\t\tconst isEmptyCollection = isUndefined(itemToSlug) || isEmptyObject(itemToSlug)\n\t\t\tconst hasRepeaterFilters = !!node.collectionFilters?.filters.length\n\t\t\tconst showFiltered = !isEmptyCollection && hasRepeaterFilters\n\n\t\t\treturn {\n\t\t\t\trepeatedChildren: (\n\t\t\t\t\t<DataRepeaterNoItemsPlaceholder\n\t\t\t\t\t\treason={showFiltered ? \"filtered\" : \"emptyCollection\"}\n\t\t\t\t\t\tnode={node}\n\t\t\t\t\t\ttree={tree}\n\t\t\t\t\t/>\n\t\t\t\t),\n\t\t\t\titemCount: 0,\n\t\t\t}\n\t\t}\n\n\t\tif (!repeatedChildForLegacy) {\n\t\t\treturn {\n\t\t\t\trepeatedChildren: null,\n\t\t\t\titemCount,\n\t\t\t}\n\t\t}\n\n\t\t// A map of variable values per item.\n\t\tlet combinedValueMapPerItem = collectionList.map((dataItem, index) => {\n\t\t\tconst childCombinedValueMap = new Map(combinedValueMap)\n\t\t\tconst valueMap = createValueMapForRepeatedChild(tree, controlMap, dataItem, index, itemCount)\n\t\t\tchildCombinedValueMap.set(node.getPrimaryId(), valueMap)\n\t\t\treturn childCombinedValueMap\n\t\t})\n\n\t\t// If equal to the previous rendering, we use that map instead, so props are shallow equal again.\n\t\tif (\n\t\t\trendering.cachedCombinedValueMapPerItem &&\n\t\t\tisEqual(rendering.cachedCombinedValueMapPerItem, combinedValueMapPerItem)\n\t\t) {\n\t\t\tcombinedValueMapPerItem = rendering.cachedCombinedValueMapPerItem\n\t\t} else {\n\t\t\trendering.cachedCombinedValueMapPerItem = combinedValueMapPerItem\n\t\t}\n\n\t\treturn {\n\t\t\trepeatedChildren: repeatedChildForLegacy\n\t\t\t\t? collectionList.map((dataItem, childIndex) => {\n\t\t\t\t\t\tconst childCombinedValueMap = combinedValueMapPerItem[childIndex]\n\t\t\t\t\t\tconst itemId = isString(dataItem.id) ? dataItem.id : childIndex\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<CanvasNodeRenderer\n\t\t\t\t\t\t\t\tkey={itemId}\n\t\t\t\t\t\t\t\ttracker={tracker}\n\t\t\t\t\t\t\t\tnode={repeatedChildForLegacy}\n\t\t\t\t\t\t\t\tparent={node}\n\t\t\t\t\t\t\t\tparentRenderId={getRepeatedChildRenderId(rendering.id, node.id, itemId, childIndex)}\n\t\t\t\t\t\t\t\tgroundNodeId={groundNodeId}\n\t\t\t\t\t\t\t\tcombinedValueMap={childCombinedValueMap}\n\t\t\t\t\t\t\t\tcombinedControlMap={childCombinedControlMap}\n\t\t\t\t\t\t\t\tactiveLocale={activeLocale}\n\t\t\t\t\t\t\t\tskipRichTextProps={skipRichTextProps}\n\t\t\t\t\t\t\t\toptionalSelectedCollectionItemId={undefined}\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: null,\n\t\t\titemCount,\n\t\t}\n\t}\n\n\tif (isArrayRepeater(node)) {\n\t\tassert(node.dataRepeaterArray.providerId, \"providerId is expected\")\n\t\tconst arrayControl = combinedControlMap?.get(node.dataRepeaterArray.providerId)?.get(node.dataRepeaterArray.id)\n\t\tconst { controlMap } = getArraySourceVariablesFromControlDescription(arrayControl)\n\n\t\ttracker.trackLoaded(rendering.id)\n\n\t\t// Note, in the context of the array repeater rendering we can assume the array data will\n\t\t// be available as the parent collection will not render its children until it has finished\n\t\t// loading itself. Any data failures at this point would point to bad data in the collection\n\t\t// or a bug.\n\t\tconst arrayValue = combinedValueMap?.get(node.dataRepeaterArray.providerId)?.get(node.dataRepeaterArray.id)\n\t\tif (!isArray(arrayValue) || !arrayValue.every(isObject)) {\n\t\t\ttracker.sandboxRepeaterData.set(rendering.id, undefined, controlMap)\n\t\t\treturn {\n\t\t\t\trepeatedChildren: <DataRepeaterNoItemsPlaceholder reason=\"arrayError\" node={node} tree={tree} />,\n\t\t\t\titemCount: 0,\n\t\t\t}\n\t\t}\n\n\t\tconst arrayDisplayValue = rendering.repeaterShowingEmptyState ? [] : arrayValue\n\t\ttracker.sandboxRepeaterData.set(rendering.id, arrayDisplayValue, controlMap)\n\t\tconst itemCount = arrayDisplayValue.length\n\n\t\tif (isMissingRepeatedChildForLegacy) {\n\t\t\treturn {\n\t\t\t\trepeatedChildren: <DataRepeaterNoItemsPlaceholder reason=\"missingChild\" node={node} tree={tree} />,\n\t\t\t\titemCount,\n\t\t\t}\n\t\t}\n\n\t\tif (arrayDisplayValue.length === 0) {\n\t\t\tif (repeatedChildForLegacy) {\n\t\t\t\tconst repeatedChildRenderId = getChildRenderId(rendering.id, repeatedChildForLegacy.id)\n\t\t\t\ttracker.sandboxVisibility.setVisible(repeatedChildRenderId, false)\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\trepeatedChildren: <DataRepeaterNoItemsPlaceholder reason=\"emptyArray\" node={node} tree={tree} />,\n\t\t\t\titemCount: 0,\n\t\t\t}\n\t\t}\n\n\t\tif (!repeatedChildForLegacy) {\n\t\t\treturn {\n\t\t\t\trepeatedChildren: null,\n\t\t\t\titemCount,\n\t\t\t}\n\t\t}\n\n\t\t// One set of controls for all items.\n\t\tlet childCombinedControlMap = new Map(combinedControlMap)\n\t\tchildCombinedControlMap.set(node.getPrimaryId(), controlMap)\n\n\t\tif (rendering.cachedControlMap && isEqual(rendering.cachedControlMap, childCombinedControlMap)) {\n\t\t\t// If equal to the previous rendering, we use that map instead, so props are shallow equal again.\n\t\t\tchildCombinedControlMap = rendering.cachedControlMap\n\t\t} else {\n\t\t\trendering.cachedControlMap = childCombinedControlMap\n\t\t}\n\n\t\t// A map of variable values per item.\n\t\tlet combinedValueMapPerItem = arrayDisplayValue.map((dataItem, index) => {\n\t\t\tconst childCombinedValueMap = new Map(combinedValueMap)\n\t\t\tconst valueMap = createValueMapForRepeatedChild(tree, controlMap, dataItem, index, itemCount)\n\t\t\tchildCombinedValueMap.set(node.getPrimaryId(), valueMap)\n\t\t\treturn childCombinedValueMap\n\t\t})\n\n\t\tif (\n\t\t\trendering.cachedCombinedValueMapPerItem &&\n\t\t\tisEqual(rendering.cachedCombinedValueMapPerItem, combinedValueMapPerItem)\n\t\t) {\n\t\t\t// If equal to the previous rendering, we use that map instead, so props are shallow equal again.\n\t\t\tcombinedValueMapPerItem = rendering.cachedCombinedValueMapPerItem\n\t\t} else {\n\t\t\trendering.cachedCombinedValueMapPerItem = combinedValueMapPerItem\n\t\t}\n\n\t\treturn {\n\t\t\trepeatedChildren: repeatedChildForLegacy\n\t\t\t\t? arrayDisplayValue.map((dataItem, childIndex) => {\n\t\t\t\t\t\tconst childCombinedValueMap = combinedValueMapPerItem[childIndex]\n\t\t\t\t\t\tconst itemId = isString(dataItem.id) ? dataItem.id : childIndex\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<CanvasNodeRenderer\n\t\t\t\t\t\t\t\tkey={itemId}\n\t\t\t\t\t\t\t\ttracker={tracker}\n\t\t\t\t\t\t\t\tnode={repeatedChildForLegacy}\n\t\t\t\t\t\t\t\tparent={node}\n\t\t\t\t\t\t\t\tparentRenderId={getRepeatedChildRenderId(rendering.id, node.id, itemId, childIndex)}\n\t\t\t\t\t\t\t\tgroundNodeId={groundNodeId}\n\t\t\t\t\t\t\t\tcombinedValueMap={childCombinedValueMap}\n\t\t\t\t\t\t\t\tcombinedControlMap={childCombinedControlMap}\n\t\t\t\t\t\t\t\tactiveLocale={activeLocale}\n\t\t\t\t\t\t\t\tskipRichTextProps={skipRichTextProps}\n\t\t\t\t\t\t\t\toptionalSelectedCollectionItemId={undefined}\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: null,\n\t\t\titemCount,\n\t\t}\n\t}\n\n\tassertNever(node, \"Cannot render unsupported repeater\")\n}\n\ninterface NodeLevelRepeatProps extends Pick<\n\tProps,\n\t| \"tracker\"\n\t| \"node\"\n\t| \"parent\"\n\t| \"groundNodeId\"\n\t| \"activeLocale\"\n\t| \"layoutTemplateIdentifier\"\n\t| \"layoutTemplatePropsVersion\"\n\t| \"shouldSetMinHeight\"\n\t| \"optionalSelectedCollectionItemId\"\n\t| \"skipRichTextProps\"\n> {\n\tnode: CanvasNode & HasRepeatArray\n\trendering: NodeRendering\n\tcombinedValueMap: CombinedVariableProviderValueMap | undefined\n\tcombinedControlMap: CombinedVariableProviderControlMap | undefined\n}\n\nfunction getNodeLevelRepeatedNodes({\n\ttracker,\n\tnode,\n\tparent,\n\trendering,\n\tgroundNodeId,\n\tcombinedValueMap,\n\tcombinedControlMap,\n\tactiveLocale,\n\tlayoutTemplateIdentifier,\n\tlayoutTemplatePropsVersion,\n\tshouldSetMinHeight,\n\toptionalSelectedCollectionItemId,\n\tskipRichTextProps,\n}: NodeLevelRepeatProps): React.ReactNode {\n\tconst providerId = node.repeatArray.providerId\n\tassert(providerId, \"providerId is expected\")\n\tconst providerNode = getArrayProviderNodeInAncestorScope(node, providerId)\n\n\tif (!providerNode) {\n\t\tconst { controlMap } = getArraySourceVariablesFromControlDescription(undefined)\n\t\ttracker.sandboxRepeaterData.set(rendering.id, undefined, controlMap)\n\t\treturn null\n\t}\n\n\tconst tree = node.tree()!\n\tconst providerControlMap = providerNode.getProvidedControlMap(\n\t\ttree,\n\t\tnode,\n\t\ttracker.componentLoader,\n\t\ttracker.state.componentLoaderHash,\n\t)\n\tconst arrayControl = combinedControlMap?.get(providerId)?.get(node.repeatArray.id)\n\tconst fallbackArrayControl = providerControlMap?.get(node.repeatArray.id)\n\tconst { controlMap } = getArraySourceVariablesFromControlDescription(arrayControl)\n\tconst resolvedControlMap =\n\t\tarrayControl !== undefined\n\t\t\t? controlMap\n\t\t\t: getArraySourceVariablesFromControlDescription(fallbackArrayControl).controlMap\n\n\ttracker.trackLoaded(rendering.id)\n\n\tconst providerValueMap = providerNode.getProvidedValueMap(\n\t\ttree,\n\t\tnode,\n\t\ttracker.componentLoader,\n\t\ttracker.sandboxRepeaterData,\n\t\ttracker.state.componentLoaderHash,\n\t)\n\tconst arrayValue =\n\t\tcombinedValueMap?.get(providerId)?.get(node.repeatArray.id) ?? providerValueMap?.get(node.repeatArray.id)\n\tif (!isArray(arrayValue) || !arrayValue.every(isObject)) {\n\t\ttracker.sandboxRepeaterData.set(rendering.id, undefined, resolvedControlMap)\n\t\treturn null\n\t}\n\n\ttracker.sandboxRepeaterData.set(rendering.id, arrayValue, resolvedControlMap)\n\n\tif (arrayValue.length === 0) return null\n\n\tlet repeatedNodeCombinedControlMap = new Map(combinedControlMap)\n\trepeatedNodeCombinedControlMap.set(node.getPrimaryId(), resolvedControlMap)\n\n\tif (rendering.cachedControlMap && isEqual(rendering.cachedControlMap, repeatedNodeCombinedControlMap)) {\n\t\trepeatedNodeCombinedControlMap = rendering.cachedControlMap\n\t} else {\n\t\trendering.cachedControlMap = repeatedNodeCombinedControlMap\n\t}\n\n\tconst itemCount = arrayValue.length\n\tlet repeatedNodeCombinedValueMapPerItem = arrayValue.map((dataItem, index) => {\n\t\tconst repeatedNodeCombinedValueMap = new Map(combinedValueMap)\n\t\tconst valueMap = createValueMapForRepeatedChild(tree, resolvedControlMap, dataItem, index, itemCount)\n\t\trepeatedNodeCombinedValueMap.set(node.getPrimaryId(), valueMap)\n\t\treturn repeatedNodeCombinedValueMap\n\t})\n\n\tif (\n\t\trendering.cachedCombinedValueMapPerItem &&\n\t\tisEqual(rendering.cachedCombinedValueMapPerItem, repeatedNodeCombinedValueMapPerItem)\n\t) {\n\t\trepeatedNodeCombinedValueMapPerItem = rendering.cachedCombinedValueMapPerItem\n\t} else {\n\t\trendering.cachedCombinedValueMapPerItem = repeatedNodeCombinedValueMapPerItem\n\t}\n\n\treturn arrayValue.map((dataItem, itemIndex) => {\n\t\tconst itemId = isString(dataItem.id) ? dataItem.id : itemIndex\n\n\t\treturn (\n\t\t\t<CanvasNodeRenderer\n\t\t\t\tkey={itemId}\n\t\t\t\ttracker={tracker}\n\t\t\t\tnode={node}\n\t\t\t\tparent={parent}\n\t\t\t\t// Use the first repeated render as the primary render id so layout/measurement\n\t\t\t\t// aligns with the visible first item.\n\t\t\t\tparentRenderId={getRepeatedChildRenderId(rendering.id, node.id, itemId, itemIndex)}\n\t\t\t\tgroundNodeId={groundNodeId}\n\t\t\t\tcombinedValueMap={repeatedNodeCombinedValueMapPerItem[itemIndex]}\n\t\t\t\tcombinedControlMap={repeatedNodeCombinedControlMap}\n\t\t\t\tactiveLocale={activeLocale}\n\t\t\t\tlayoutTemplateIdentifier={layoutTemplateIdentifier}\n\t\t\t\tlayoutTemplatePropsVersion={layoutTemplatePropsVersion}\n\t\t\t\tshouldSetMinHeight={shouldSetMinHeight}\n\t\t\t\toptionalSelectedCollectionItemId={optionalSelectedCollectionItemId}\n\t\t\t\tskipRichTextProps={skipRichTextProps}\n\t\t\t\tskipNodeLevelRepeat={true}\n\t\t\t/>\n\t\t)\n\t})\n}\n\nfunction convertViewportUnitsToFixedValuesForCanvasRendering(\n\ttree: CanvasTree,\n\tnode: CanvasNode,\n\tprops: Record<string, unknown>,\n) {\n\tconst usesViewportWidth = hasViewportWidth(node)\n\tconst usesViewportHeight = hasViewportHeight(node)\n\tconst usesHeightConstraints = hasAnyViewHeightConstraints(node)\n\tconst usesViewportForMaxHeight = usesHeightConstraints && usingViewHeight(node.maxHeight)\n\tconst usesViewportForMinHeight = usesHeightConstraints && usingViewHeight(node.minHeight)\n\n\tif (!usesViewportWidth && !usesViewportHeight && !usesViewportForMaxHeight && !usesViewportForMinHeight) {\n\t\treturn\n\t}\n\n\tconst groundNode = tree.getGroundNodeFor(node)\n\tif (!groundNode || !canNodeProvideViewportRect(groundNode)) return\n\n\tnode.cache.useViewportState(groundNode.id)\n\n\tconst rect = groundNode.rect()\n\tconst viewportWidth = rect.width\n\t// The viewport height calculated here is used only for `vh`-based sizing or constraints, not for fixed elements or\n\t// overlays (which is rendered in a ViewportCanvasPortal already clamped by the max-height: 100%). Therefore, using\n\t// the minimum screen height is unnecessary and could create a circular dependency: the viewport height might be\n\t// clamped by the node's height, which itself depends on the viewport height.\n\tconst preferMinScreenHeight = false\n\tconst viewportHeight = getViewportHeight(groundNode, rect, preferMinScreenHeight)\n\n\t// Treat viewport unit as fixed number on the canvas right before we pass\n\t// down the props to canvas components like FrameWithMotion, so that they\n\t// don't need to know about the viewport.\n\tif (withSize(node)) {\n\t\tif (usesViewportWidth) {\n\t\t\tprops.width = viewportUnitToPixelValueOnCanvas(node.width, viewportWidth)\n\t\t\tprops.widthType = DimensionType.FixedNumber\n\t\t}\n\t\tif (usesViewportHeight) {\n\t\t\tprops.height = viewportUnitToPixelValueOnCanvas(node.height, viewportHeight)\n\t\t\tprops.heightType = DimensionType.FixedNumber\n\t\t}\n\t}\n\n\t// Treat viewport unit as fixed number on the canvas right before we pass down the props to canvas components like\n\t// FrameWithMotion, so that they can render the constrained size correctly without knowing the viewport.\n\tif (usesHeightConstraints) {\n\t\tif (isString(node.maxHeight) && usesViewportForMaxHeight) {\n\t\t\tprops.maxHeight = (parseFloat(node.maxHeight) / 100) * viewportHeight\n\t\t}\n\t\tif (isString(node.minHeight) && usesViewportForMinHeight) {\n\t\t\tprops.minHeight = (parseFloat(node.minHeight) / 100) * viewportHeight\n\t\t}\n\t}\n}\n\nfunction reactElementForNode(\n\ttracker: RenderingStateTracker,\n\ttree: CanvasTree,\n\tnode: CanvasNode,\n\trendering: NodeRendering,\n\tgroundNodeId: NodeID,\n\tprops: any,\n\tcombinedValueMap: CombinedVariableProviderValueMap | undefined,\n\tcombinedControlMap: CombinedVariableProviderControlMap | undefined,\n\tactiveLocale: Locale | undefined,\n\tlayoutTemplateIdentifier: LocalModuleExportIdentifierString | null | undefined,\n\tlayoutTemplateProps: Record<string, unknown> | undefined,\n\tshouldSetMinHeight?: boolean,\n\tskipRichTextProps?: boolean,\n): React.ReactElement | null {\n\tconst debugRenderingFeatures = tracker.debugRenderingFeatures\n\tconst cache = node.cache\n\n\tif (debugRenderingFeatures?.hideGradients) {\n\t\tremoveGradientFromProps(node, props)\n\t}\n\n\tif (isSVGNode(node)) {\n\t\tif (debugRenderingFeatures?.hideSVGs) return null\n\t\tcache.useRenderingState(\"zoom\")\n\t\treturn <SVG {...props} />\n\t}\n\n\tif (isShapeContainerNode(node)) {\n\t\tif (debugRenderingFeatures?.hideGraphics) return null\n\n\t\tresetCacheForGraphics(node)\n\n\t\treturn (\n\t\t\t<FrameWithMotion {...props} as=\"svg\">\n\t\t\t\t{node.children.map(child => {\n\t\t\t\t\tconst childRenderId = getChildRenderId(rendering.id, child.id)\n\t\t\t\t\treturn getVectorForNode(\n\t\t\t\t\t\tchild,\n\t\t\t\t\t\ttracker.componentLoader,\n\t\t\t\t\t\tcombinedValueMap,\n\t\t\t\t\t\ttracker.sandboxVisibility,\n\t\t\t\t\t\tchildRenderId,\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t)\n\t\t\t\t})}\n\t\t\t</FrameWithMotion>\n\t\t)\n\t}\n\n\tif (isVectorNode(node)) {\n\t\tif (debugRenderingFeatures?.hideGraphics) return null\n\n\t\tresetCacheForGraphics(node)\n\n\t\treturn getVectorForNode(\n\t\t\tnode,\n\t\t\ttracker.componentLoader,\n\t\t\tcombinedValueMap,\n\t\t\ttracker.sandboxVisibility,\n\t\t\trendering.id,\n\t\t\ttrue,\n\t\t\tundefined,\n\t\t)\n\t}\n\n\tif (node instanceof TextNode) {\n\t\tif (debugRenderingFeatures?.hideTexts) return null\n\t\tif (rendering.isPrimary) {\n\t\t\tprops.isEditable = node.cache.isEditable\n\t\t}\n\t\treturn <Text {...props} />\n\t}\n\n\tif (node instanceof RichTextNode) {\n\t\tif (debugRenderingFeatures?.hideTexts) return null\n\t\tif (rendering.isPrimary) {\n\t\t\tprops.isEditable = node.cache.isEditable\n\t\t}\n\n\t\tconst viewBox = getRichTextViewBox(node, activeLocale)\n\t\tif (viewBox) props.viewBox = viewBox\n\n\t\tconst children = getRichTextChildren(node, combinedValueMap, activeLocale)\n\n\t\tconst overlayChildren: React.ReactNode[] = []\n\t\tfor (const child of node.children) {\n\t\t\tif (!isFixedOrRelativeOverlay(child)) continue\n\n\t\t\toverlayChildren.push(\n\t\t\t\t<CanvasNodeRenderer\n\t\t\t\t\tkey={child.id}\n\t\t\t\t\ttracker={tracker}\n\t\t\t\t\tnode={child}\n\t\t\t\t\tparent={node}\n\t\t\t\t\tparentRenderId={rendering.id}\n\t\t\t\t\tgroundNodeId={groundNodeId}\n\t\t\t\t\tcombinedValueMap={combinedValueMap}\n\t\t\t\t\tcombinedControlMap={combinedControlMap}\n\t\t\t\t\tactiveLocale={activeLocale}\n\t\t\t\t\toptionalSelectedCollectionItemId={undefined}\n\t\t\t\t/>,\n\t\t\t)\n\t\t}\n\n\t\tconst fetchDataValueResolver = tracker.createFetchDataValueResolver(node)\n\t\tconst relativeDate = getRichTextRelativeDate(node, combinedValueMap, fetchDataValueResolver)\n\t\tif (relativeDate) props.text = relativeDate\n\n\t\tif (isVariableReference(node.htmlContent) && node.getComponentPresets().size > 0) {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t<CanvasRichText tree={tree} componentLoader={tracker.componentLoader} node={node} richTextProps={props}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</CanvasRichText>\n\t\t\t\t\t{overlayChildren}\n\t\t\t\t</>\n\t\t\t)\n\t\t} else {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t<RichText {...props}>{children}</RichText>\n\t\t\t\t\t{overlayChildren}\n\t\t\t\t</>\n\t\t\t)\n\t\t}\n\t}\n\n\tif (node instanceof FrameNode) {\n\t\t// In the case that a frame node can provide a viewport rect, get the\n\t\t// viewport height, and provide a portal target for all position: fixed\n\t\t// descendants to render into on the canvas.\n\t\tif (canNodeProvideViewportRect(node)) {\n\t\t\tconst nodeRect = node.rect()\n\t\t\tprops.__portal = (\n\t\t\t\t<ViewportCanvasPortal\n\t\t\t\t\tid={rendering.id}\n\t\t\t\t\t// The portal is rendered with max-height: 100% to ensure that it does not overflow the breakpoint,\n\t\t\t\t\t// so we don't need to use the min screen height.\n\t\t\t\t\tviewportHeight={getViewportHeight(node, nodeRect, false)}\n\t\t\t\t\ttype={node.layout}\n\t\t\t\t/>\n\t\t\t)\n\t\t}\n\n\t\tlet children: ReactNode | undefined\n\t\tconst childrenInVisualOrder = node.getChildrenInVisualOrder()\n\n\t\tif (isDataRepeater(node)) {\n\t\t\tconst repeatedChildNode = getRepeatedItemOfDataRepeater(tree, node)\n\t\t\tconst shouldRenderLegacyRepeatedChild = !hasRepeatArray(repeatedChildNode)\n\n\t\t\t// biome-ignore lint/correctness/useHookAtTopLevel: not a hook\n\t\t\tcache.useRenderingState(\"componentLoaderHash\")\n\t\t\t// biome-ignore lint/correctness/useHookAtTopLevel: not a hook\n\t\t\tcache.useRenderingState(\"collectionQueryUpdate\")\n\t\t\tconst { repeatedChildren: legacyRepeatedChildren, itemCount } = getRepeatedChildren(\n\t\t\t\ttracker,\n\t\t\t\tnode,\n\t\t\t\ttree,\n\t\t\t\tgroundNodeId,\n\t\t\t\trendering,\n\t\t\t\tcombinedValueMap,\n\t\t\t\tcombinedControlMap,\n\t\t\t\tactiveLocale,\n\t\t\t\t!!shouldSetMinHeight,\n\t\t\t\tshouldRenderLegacyRepeatedChild,\n\t\t\t)\n\n\t\t\t// Enable ticker replacement of fr sizing on canvas for CMS items in data repeaters.\n\t\t\tif (itemCount > 0 && hasTickerEffect(node) && isObject(props.style)) {\n\t\t\t\tprops.style[\"--ticker-cms-total-children\"] = itemCount\n\t\t\t}\n\n\t\t\tconst repeatedChildId = shouldRenderLegacyRepeatedChild ? repeatedChildNode?.id : undefined\n\n\t\t\tconst { nonRepeatedChildCombinedControlMap, nonRepeatedChildCombinedValueMap } =\n\t\t\t\tcreateNonRepeatedChildMapsFromRepeaterMaps(combinedControlMap, combinedValueMap, node.getPrimaryId(), itemCount)\n\n\t\t\tchildren = childrenInVisualOrder.map(child => {\n\t\t\t\tif (child.id === repeatedChildId) {\n\t\t\t\t\t// eslint-disable-next-line @eslint-react/no-duplicate-key\n\t\t\t\t\treturn <React.Fragment key=\"repeated\">{legacyRepeatedChildren}</React.Fragment>\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t<CanvasNodeRenderer\n\t\t\t\t\t\tkey={child.id}\n\t\t\t\t\t\ttracker={tracker}\n\t\t\t\t\t\tnode={child}\n\t\t\t\t\t\tparent={node}\n\t\t\t\t\t\tparentRenderId={rendering.id}\n\t\t\t\t\t\tgroundNodeId={groundNodeId}\n\t\t\t\t\t\tcombinedValueMap={nonRepeatedChildCombinedValueMap}\n\t\t\t\t\t\tcombinedControlMap={nonRepeatedChildCombinedControlMap}\n\t\t\t\t\t\tactiveLocale={activeLocale}\n\t\t\t\t\t\toptionalSelectedCollectionItemId={undefined}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t})\n\t\t} else if (childrenInVisualOrder.length === 0) {\n\t\t\tchildren = []\n\t\t} else {\n\t\t\tchildren = childrenInVisualOrder.map(child => {\n\t\t\t\treturn (\n\t\t\t\t\t<CanvasNodeRenderer\n\t\t\t\t\t\tkey={child.id}\n\t\t\t\t\t\ttracker={tracker}\n\t\t\t\t\t\tnode={child}\n\t\t\t\t\t\tparent={node}\n\t\t\t\t\t\tparentRenderId={rendering.id}\n\t\t\t\t\t\tgroundNodeId={groundNodeId}\n\t\t\t\t\t\tcombinedValueMap={combinedValueMap}\n\t\t\t\t\t\tcombinedControlMap={combinedControlMap}\n\t\t\t\t\t\tactiveLocale={activeLocale}\n\t\t\t\t\t\toptionalSelectedCollectionItemId={undefined}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t})\n\t\t}\n\n\t\tif (hasAnyLayout(node)) {\n\t\t\treturn maybeRenderWithLayoutTemplate(\n\t\t\t\ttracker,\n\t\t\t\tnode,\n\t\t\t\tlayoutTemplateIdentifier,\n\t\t\t\tlayoutTemplateProps,\n\t\t\t\tmaybeRenderWithFloatingPosition(\n\t\t\t\t\tnode,\n\t\t\t\t\t<CanvasLayout\n\t\t\t\t\t\t{...(props as CanvasLayoutProps)}\n\t\t\t\t\t\tnode={node}\n\t\t\t\t\t\t// This will disable the parent size mechanisms\n\t\t\t\t\t\tisRepeater={true}\n\t\t\t\t\t\t// TODO: might want to add only if isPrimaryRendering(node, renderId), but this\n\t\t\t\t\t\t// replicates the old renderer behavior to some extent.\n\t\t\t\t\t\tplaceholders={node.cache.placeholders ?? undefined}\n\t\t\t\t\t\t// When generating a web page, set a min height equal to the current height of the parent.\n\t\t\t\t\t\t// This ensures that the page doesn't jump when new sections are added.\n\t\t\t\t\t\tminHeight={shouldSetMinHeight ? node.rect().height : undefined}\n\t\t\t\t\t>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</CanvasLayout>,\n\t\t\t\t),\n\t\t\t)\n\t\t}\n\n\t\treturn maybeRenderWithLayoutTemplate(\n\t\t\ttracker,\n\t\t\tnode,\n\t\t\tlayoutTemplateIdentifier,\n\t\t\tlayoutTemplateProps,\n\t\t\tmaybeRenderWithFloatingPosition(node, <FrameWithMotion {...props}>{children}</FrameWithMotion>),\n\t\t)\n\t}\n\n\tif (isFormPlainTextInputNode(node)) {\n\t\treturn <CanvasFormPlainTextInput {...props} />\n\t}\n\n\tif (isFormSelectNode(node)) {\n\t\treturn (\n\t\t\t<CanvasFormSelect\n\t\t\t\t{...props}\n\t\t\t\tnode={node}\n\t\t\t\ttree={tree}\n\t\t\t\tcomponentLoader={tracker.componentLoader}\n\t\t\t\tcombinedValueMap={combinedValueMap}\n\t\t\t\tactiveLocale={activeLocale}\n\t\t\t/>\n\t\t)\n\t}\n\n\tif (isFormBooleanInputNode(node)) {\n\t\tconst groundNodeId = tree.getGroundNodeFor(node).id\n\t\treturn <CanvasFormBooleanInput {...props} groundNodeId={groundNodeId} />\n\t}\n\n\tif (isOverlayNode(node)) {\n\t\tif (!rendering.isPrimary) return null\n\n\t\tprops.visible = cache.visible\n\t\tconst children = node.children.map(child => {\n\t\t\treturn (\n\t\t\t\t<PrecomputedCanvasNodeRenderer\n\t\t\t\t\tkey={child.id}\n\t\t\t\t\t__tracker={tracker}\n\t\t\t\t\t__node={child}\n\t\t\t\t\t__combinedValueMap={combinedValueMap}\n\t\t\t\t\t__combinedVariableControlMap={combinedControlMap}\n\t\t\t\t\t__activeLocale={activeLocale}\n\t\t\t\t\t__groundNodeId={groundNodeId}\n\t\t\t\t\t{...getPrecomputedProps(tracker, child, child.id, combinedValueMap, combinedControlMap, activeLocale)}\n\t\t\t\t/>\n\t\t\t)\n\t\t})\n\n\t\t// The OverlayNode itself has no size, but its children FrameWithMotion\n\t\t// relies on the parent/viewportSize from the ancestors. So we provide\n\t\t// a size same as the viewport size to the OverlayNode.\n\t\tconst groundNode = tree.getGroundNodeFor(node)\n\t\tif (canNodeProvideViewportRect(groundNode)) {\n\t\t\tconst rect = groundNode.rect()\n\t\t\tprops.width = rect.width\n\t\t\tprops.height = getViewportHeight(groundNode, rect)\n\t\t}\n\n\t\tprops._needsMeasure = true\n\t\tprops.widthType = DimensionType.FixedNumber\n\t\tprops.heightType = DimensionType.FixedNumber\n\t\t// All nodes with props.positionFixed will be wrapped and rendered via a portal later on.\n\t\tassert(props.positionFixed, \"must be position fixed\")\n\t\treturn <CanvasOverlay {...props}>{children}</CanvasOverlay>\n\t}\n\n\tif (isCodeComponentNode(node)) {\n\t\tcache.useRenderingState(\"componentLoaderHash\")\n\n\t\tconst overlayChildren: JSX.Element[] = []\n\t\tfor (const child of node.children) {\n\t\t\tif (!isFixedOrRelativeOverlay(child)) continue\n\t\t\tif (!isValidSandboxOverlay(child, tree)) continue\n\t\t\toverlayChildren.push(\n\t\t\t\t<CanvasNodeRenderer\n\t\t\t\t\tkey={child.id}\n\t\t\t\t\ttracker={tracker}\n\t\t\t\t\tnode={child}\n\t\t\t\t\tparent={node}\n\t\t\t\t\tparentRenderId={rendering.id}\n\t\t\t\t\tgroundNodeId={groundNodeId}\n\t\t\t\t\tcombinedValueMap={combinedValueMap}\n\t\t\t\t\tcombinedControlMap={combinedControlMap}\n\t\t\t\t\tactiveLocale={activeLocale}\n\t\t\t\t\toptionalSelectedCollectionItemId={undefined}\n\t\t\t\t/>,\n\t\t\t)\n\t\t}\n\n\t\tconst parsedIdentifier = parseModuleIdentifier(node.codeComponentIdentifier)\n\t\tconst componentDefinition = tracker.componentLoader.renderableComponentForIdentifier(node.codeComponentIdentifier)\n\n\t\tif (!componentDefinition && isLocalModuleIdentifier(node.codeComponentIdentifier)) {\n\t\t\ttracker.loadLocalModule(node.codeComponentIdentifier, node.id)\n\t\t}\n\n\t\tif (node.isVectorInstance) {\n\t\t\treturn maybeRenderWithFloatingPosition(\n\t\t\t\tnode,\n\t\t\t\t<CanvasVector\n\t\t\t\t\ttracker={tracker}\n\t\t\t\t\tnode={node}\n\t\t\t\t\tframeProps={props}\n\t\t\t\t\tactiveLocale={activeLocale}\n\t\t\t\t\tcombinedValueMap={combinedValueMap}\n\t\t\t\t/>,\n\t\t\t)\n\t\t}\n\n\t\tif (isExternalModuleIdentifier(parsedIdentifier)) {\n\t\t\tif (debugRenderingFeatures?.hideExternalComponents) return null\n\n\t\t\tprops.__externalModuleType = tree.getNode<ExternalModuleNode>(parsedIdentifier.moduleId)?.type\n\t\t\tconst nodeForStateArgs: NodeForStateArgs = {\n\t\t\t\ttracker,\n\t\t\t\tnode,\n\t\t\t\trendering,\n\t\t\t\tgroundNodeId,\n\t\t\t\tcombinedValueMap,\n\t\t\t\tcombinedControlMap,\n\t\t\t\tactiveLocale,\n\t\t\t}\n\t\t\tprops.__renderContext = nodeForStateArgs\n\t\t\tprops.nodeForState = nodeForState\n\t\t\treturn maybeRenderWithFloatingPosition(\n\t\t\t\tnode,\n\t\t\t\t<ExternalModuleContainer {...props}>{overlayChildren}</ExternalModuleContainer>,\n\t\t\t)\n\t\t}\n\n\t\tif (\n\t\t\tisLocalModuleIdentifier(parsedIdentifier) &&\n\t\t\tparsedIdentifier.type === ModuleType.Canvas &&\n\t\t\tcomponentDefinition?.type !== \"responsiveScreen\" &&\n\t\t\t!employeesOnlySettings.isOn(\"disableLazyModuleLoading\")\n\t\t) {\n\t\t\tif (debugRenderingFeatures?.hideLocalComponents) return null\n\n\t\t\tconst nodeForStateArgs: NodeForStateArgs = {\n\t\t\t\ttracker,\n\t\t\t\tnode,\n\t\t\t\trendering,\n\t\t\t\tgroundNodeId,\n\t\t\t\tcombinedValueMap,\n\t\t\t\tcombinedControlMap,\n\t\t\t\tactiveLocale,\n\t\t\t}\n\t\t\tprops.__renderContext = nodeForStateArgs\n\t\t\tprops.nodeForState = nodeForState\n\t\t\treturn maybeRenderWithFloatingPosition(\n\t\t\t\tnode,\n\t\t\t\t<LocalModuleContainer {...props}>{overlayChildren}</LocalModuleContainer>,\n\t\t\t)\n\t\t}\n\n\t\tlet children: React.ReactNode = codeComponentForNode(\n\t\t\ttracker,\n\t\t\tnode,\n\t\t\trendering,\n\t\t\tgroundNodeId,\n\t\t\tcombinedValueMap,\n\t\t\tcombinedControlMap,\n\t\t\tactiveLocale,\n\t\t\t!!skipRichTextProps,\n\t\t)\n\t\tif (overlayChildren.length > 0) {\n\t\t\tchildren = [children, ...overlayChildren]\n\t\t}\n\t\tif (\n\t\t\tisLocalModuleIdentifier(parsedIdentifier) &&\n\t\t\tcomponentDefinition?.type === \"responsiveScreen\" &&\n\t\t\tisCanvasPageNode(tree.getScopeNodeFor(node))\n\t\t) {\n\t\t\tif (debugRenderingFeatures?.hideLocalComponents) return null\n\n\t\t\tconst fonts = new Map()\n\t\t\tflattenComponentFontBundles(componentDefinition.fonts ?? []).forEach(font =>\n\t\t\t\tfonts.set(createComponentFontHash(font), font),\n\t\t\t)\n\n\t\t\tprops = {\n\t\t\t\twidth: props.width,\n\t\t\t\theight: props.height,\n\t\t\t\tcomponentIdentifier: node.codeComponentIdentifier,\n\t\t\t\tfonts,\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<ResponsiveScreenContainer componentLoader={tracker.componentLoader} {...props}>\n\t\t\t\t\t{children}\n\t\t\t\t</ResponsiveScreenContainer>\n\t\t\t)\n\t\t}\n\n\t\tif (debugRenderingFeatures?.hideCodeComponents && parsedIdentifier?.type === ModuleType.Code) {\n\t\t\treturn null\n\t\t}\n\n\t\treturn maybeRenderWithFloatingPosition(\n\t\t\tnode,\n\t\t\t<ComponentContainer componentLoader={tracker.componentLoader} __rendering={rendering} {...props}>\n\t\t\t\t{children}\n\t\t\t</ComponentContainer>,\n\t\t)\n\t}\n\n\tif (isSlotNode(node)) {\n\t\treturn <CanvasSlot id={node.id} />\n\t}\n\n\tif (isShaderNode(node)) {\n\t\tcache.useRenderingState(\"tokenColorRevision\")\n\t\tcache.useRenderingState(\"selectionCount\")\n\t\tcache.useRenderingState(\"previewState\")\n\t\treturn (\n\t\t\t<ShaderNodeRenderer\n\t\t\t\t{...props}\n\t\t\t\tnode={node}\n\t\t\t\tcomponentLoader={tracker.componentLoader}\n\t\t\t\tcombinedValueMap={combinedValueMap}\n\t\t\t\tactiveLocale={activeLocale}\n\t\t\t\tisMultiSelected={node.cache.selected && tracker.state.selectionCount > 1}\n\t\t\t\tisPreviewActive={tracker.state.previewState === \"active\"}\n\t\t\t/>\n\t\t)\n\t}\n\n\treturn <div style={{ background: \"lightred\", color: \"black\" }}>Error: {node.__class}</div>\n}\n\nfunction elementForNode(\n\ttracker: RenderingStateTracker,\n\tnode: CanvasNode,\n\trendering: NodeRendering,\n\tgroundNodeId: NodeID,\n\tcombinedValueMap: CombinedVariableProviderValueMap | undefined,\n\tcombinedControlMap: CombinedVariableProviderControlMap | undefined,\n\tactiveLocale: Locale | undefined,\n\tlayoutTemplateIdentifier: LocalModuleExportIdentifierString | null | undefined,\n\tlayoutTemplateProps: Record<string, unknown> | undefined,\n\tprecomputedProps?: Record<string, unknown>,\n\tshouldSetMinHeight?: boolean,\n): React.ReactElement | null {\n\tconst cache = node.cache\n\tconst tree = node.tree()\n\tassert(tree, \"rendering a node without a tree\")\n\n\tif (isFixedOrRelativeOverlay(node)) {\n\t\tif (!isValidSandboxOverlay(node, tree)) {\n\t\t\tcache.visible = false\n\t\t} else {\n\t\t\tcache.visible = rendering.isPrimary ? cache.overlayVisible : false\n\t\t}\n\t} else {\n\t\tcache.visible = node.resolveValue(\"visible\", combinedValueMap) !== false\n\t}\n\n\ttracker.sandboxVisibility.setVisible(rendering.id, cache.visible)\n\n\tif (!cache.visible) {\n\t\ttracker.trackLoaded(rendering.id)\n\t\treturn null\n\t}\n\n\tlet props: Record<string, unknown> | undefined\n\tif (precomputedProps) {\n\t\t// If the props were pre computed by the PrecomputedCanvasNodeRenderer we just copy those\n\t\t// and not compute them again. Note that they may have been altered by code components.\n\t\tprops = precomputedProps\n\t} else {\n\t\tprops = node.getProps(\n\t\t\ttracker.componentLoader,\n\t\t\tcombinedValueMap,\n\t\t\tactiveLocale,\n\t\t\ttracker.createFetchDataValueResolver(node),\n\t\t) as Record<string, unknown>\n\t\tprops.id = rendering.elementId\n\t}\n\tconvertViewportUnitsToFixedValuesForCanvasRendering(tree, node, props)\n\n\t// If the node has image fill set, and produces a background prop, we should re-render when the\n\t// asset hash updates.\n\tif (withFill(node) && node.fillType === \"image\" && props.background) {\n\t\tcache.useRenderingState(\"assetHash\")\n\t}\n\n\t// Position fixed, non-overlay layers pinned relative to the bottom of the\n\t// screen use a css statement to be relative to the viewport line.\n\tif (!isFixedOrRelativeOverlay(node)) {\n\t\tcollectFixedPositionCustomPropertyOverrides(node, props)\n\t}\n\n\tconst component = reactElementForNode(\n\t\ttracker,\n\t\ttree,\n\t\tnode,\n\t\trendering,\n\t\tgroundNodeId,\n\t\tprops,\n\t\tcombinedValueMap,\n\t\tcombinedControlMap,\n\t\tactiveLocale,\n\t\tlayoutTemplateIdentifier,\n\t\tlayoutTemplateProps,\n\t\tshouldSetMinHeight,\n\t)\n\n\tif (isFixedOrRelativeOverlay(node) && isValidSandboxOverlay(node, tree)) {\n\t\tconst groundNode = tree.getGroundNodeFor(node)\n\t\tif (groundNode) {\n\t\t\tconst layout = withLayout(groundNode) ? groundNode.layout : undefined\n\n\t\t\tif (hasFloatingPosition(node)) {\n\t\t\t\tnode.cache.useGroundNodeInViewport(groundNode.id)\n\t\t\t\tnode.cache.useNodeRectsState(getAncestorIdsTillGroundNode(tree, node, groundNode))\n\t\t\t} else {\n\t\t\t\tnode.cache.useViewportState(groundNode.id)\n\t\t\t}\n\n\t\t\tconst portalId = hasFloatingPosition(node)\n\t\t\t\t? visibleOverflowPortalID(groundNode.id, layout)\n\t\t\t\t: viewportPortalID(groundNode.id, layout)\n\n\t\t\treturn (\n\t\t\t\t<RenderedInPortal id={rendering.id} portalId={portalId}>\n\t\t\t\t\t{component}\n\t\t\t\t</RenderedInPortal>\n\t\t\t)\n\t\t}\n\t}\n\n\treturn component\n}\n\nfunction getAncestorIdsTillGroundNode(tree: CanvasTree, node: CanvasNode, groundNode: CanvasNode) {\n\tconst ids = new Set<string>()\n\tlet parentId = node.parentid\n\twhile (parentId) {\n\t\tconst parent = tree.getNode(parentId)\n\t\tif (!parent || !withDOMLayout(parent)) break\n\n\t\tids.add(parent.id)\n\t\tif (parent.id === groundNode.id) break\n\n\t\tparentId = parent.parentid\n\t}\n\n\treturn ids\n}\n\nfunction useNodeRendering(tracker: RenderingStateTracker, renderId: RenderId, groundNodeId: NodeID): NodeRendering {\n\tconst [_, updateRenderingState] = React.useState(tracker.state)\n\tconst rendering = tracker.renderingInstanceFor(renderId, groundNodeId, updateRenderingState)\n\tReact.useEffect(() => {\n\t\treturn () => tracker.unmount(rendering)\n\t}, [tracker, rendering])\n\treturn rendering\n}\n\nfunction getPrecomputedProps(\n\ttracker: RenderingStateTracker,\n\tnode: CanvasNode,\n\trenderId: RenderId,\n\tcombinedValueMap: CombinedVariableProviderValueMap | undefined,\n\tcombinedControlMap: CombinedVariableProviderControlMap | undefined,\n\tactiveLocale: Locale | undefined,\n\tkeyOverride?: string,\n): Record<string, unknown> & { __renderId: RenderId } {\n\t// To run getProps we have to setup the cache for this render. The component will later do the\n\t// same thing.\n\tconst cache = node.cache\n\tconst tree = node.tree()!\n\tcache.resetForRendering()\n\tcache.setVariableValueAndControlMap(\n\t\tcombinedValueMap,\n\t\tcombinedValueMap,\n\t\tcombinedControlMap,\n\t\tactiveLocale,\n\t\tnode,\n\t\ttree,\n\t\tundefined,\n\t)\n\tupdateStackAndGridChildCacheForCanvasSandbox(undefined, node)\n\n\tconst props = node.getProps(tracker.componentLoader, undefined, activeLocale) as ReturnType<\n\t\ttypeof getPrecomputedProps\n\t>\n\tprops.id = stringFromNodeID(renderId)\n\n\tif (hasFloatingPosition(node) && isPrimaryRenderId(renderId) && isValidSandboxOverlay(node, tree)) {\n\t\tprops._needsMeasure = true\n\t}\n\n\t// Like the old renderer, a ground node rendered from a slot will get position: relative\n\tconst hasRelativePosition = node.__unsafeIsGroundNode() || node.__unsafeIsSlotPropertyChildNode()\n\tif (hasRelativePosition) {\n\t\tprops.position = \"relative\"\n\t}\n\n\t// NOTE: if node.getProps() will ever start to call cache.useRenderingState for ligit reasons,\n\t// we will need to pass them on from the precomputed props to the actual rendering.\n\tassert(\n\t\t!cache.renderingStatesUsed &&\n\t\t\t!cache.useViewportOfNodeId &&\n\t\t\t!cache.useRectsOfRenderIds &&\n\t\t\t!cache.useGroundNodeInViewportRendering,\n\t\t\"precomputed nodes cannot track states here\",\n\t)\n\n\tif (keyOverride) {\n\t\tprops.key = keyOverride\n\t}\n\n\tprops.__renderId = renderId\n\treturn props\n}\n\n/** Similar to the regular CanvasNodeRenderer but where the props are precomputed. This is to allow\n * code components to inspect their React.Children and read the props and write new ones via\n * React.cloneNode().  */\nconst PrecomputedCanvasNodeRenderer = React.memo(function PrecomputedCanvasNodeRenderer(props: PrecomputedProps) {\n\tconst {\n\t\t__tracker: tracker,\n\t\t__node: node,\n\t\t__renderId: renderId,\n\t\t__combinedValueMap: combinedValueMap,\n\t\t__combinedVariableControlMap: combinedControlMap,\n\t\t__activeLocale: activeLocale,\n\t\t__groundNodeId: groundNodeId,\n\t\t...precomputedProps\n\t} = props\n\tconst cache = node.cache\n\n\t// Setup tracking the rendering state.\n\tconst rendering = useNodeRendering(tracker, renderId, groundNodeId)\n\n\t// Reset the cache for the node based renderer and update the cache just before actually\n\t// rendering. We won't be recomputing variables as the CanvasNodeRenderer does.\n\tcache.resetForRendering()\n\tcache.setVariableValueAndControlMap(\n\t\tcombinedValueMap,\n\t\tcombinedValueMap,\n\t\tcombinedControlMap,\n\t\tactiveLocale,\n\t\tnode,\n\t\tnode.tree()!,\n\t\tundefined,\n\t)\n\tupdateStackAndGridChildCacheForCanvasSandbox(undefined, node)\n\n\tconst element = elementForNode(\n\t\ttracker,\n\t\tnode,\n\t\trendering,\n\t\tgroundNodeId,\n\t\tcombinedValueMap,\n\t\tcombinedControlMap,\n\t\tactiveLocale,\n\t\tundefined,\n\t\tundefined,\n\t\tprecomputedProps,\n\t)\n\n\t// Track the new states.\n\ttracker.useStates(rendering, cache.renderingStatesUsed)\n\tif (cache.useViewportOfNodeId) {\n\t\ttracker.useViewport(rendering, cache.useViewportOfNodeId)\n\t}\n\n\tif (cache.useRectsOfRenderIds) {\n\t\ttracker.useNodeRect(rendering, cache.useRectsOfRenderIds)\n\t}\n\n\tif (cache.useGroundNodeInViewportRendering) {\n\t\ttracker.useGroundNodeInViewport(rendering, cache.useGroundNodeInViewportRendering)\n\t}\n\n\tlog.trace(\n\t\t\"rendered with pre computed props:\",\n\t\trenderId,\n\t\tnode.__class,\n\t\trendering.states,\n\t\tcache.useViewportOfNodeId ? \"viewport\" : \"\",\n\t\t\"node rects:\",\n\t\tcache.useRectsOfRenderIds,\n\t)\n\treturn element\n})\n\n/** Takes a node, a alternative id if renderer multiple times on the canvas, and variables. Renders\n * itself. And if this node has children, will render those as CanvasNodeRenderer. */\nexport const CanvasNodeRenderer = React.memo(function CanvasNodeRenderer(props: Props) {\n\tconst tracker = props.tracker\n\tconst parent = props.parent\n\tconst node = props.node\n\tconst cache = node.cache\n\n\t// The render id is a unique id for each rendering.\n\tconst renderId = getChildRenderId(props.parentRenderId, node.id)\n\n\t// Setup tracking the rendering state.\n\tconst rendering = useNodeRendering(tracker, renderId, props.groundNodeId)\n\n\t// First we reset the cache for the node based renderer.\n\tcache.resetForRendering()\n\n\t// Then compute new values and controls if our parent is a scope node.\n\tlet combinedValueMap = props.combinedValueMap\n\tlet combinedControlMap = props.combinedControlMap\n\n\tif (isScopeNode(parent)) {\n\t\tif (isWebPageNode(parent)) {\n\t\t\tcache.useRenderingState(\"componentLoaderHash\")\n\t\t\tcache.useRenderingState(\"collectionItemId\")\n\n\t\t\tif (hasCollectionDataSource(parent)) {\n\t\t\t\tcache.useRenderingState(\"collectionQueryUpdate\")\n\t\t\t}\n\t\t}\n\n\t\tassert(parent.isLoaded(), \"Scope should be fully loaded\")\n\t\t// TODO: Should be needed only once per update. Not for every ground node. And even then,\n\t\t// only if the input changes.\n\t\tconst valueAndControlMap = getVariableValueAndControlMapFromScope(\n\t\t\ttracker,\n\t\t\tparent,\n\t\t\tnode,\n\t\t\tprops.activeLocale,\n\t\t\tprops.optionalSelectedCollectionItemId,\n\t\t\trendering,\n\t\t)\n\t\tcombinedValueMap = valueAndControlMap?.combinedValueMap\n\t\tcombinedControlMap = valueAndControlMap?.combinedControlMap\n\t}\n\n\tconst shouldRenderNodeLevelRepeat = !props.skipNodeLevelRepeat && hasRepeatArray(node)\n\n\t// Then update the cache just before actually rendering.\n\t// TODO: Refactor after we remove the old rendering methods.\n\tcache.setVariableValueAndControlMap(\n\t\tcombinedValueMap,\n\t\tprops.combinedValueMap ?? combinedValueMap,\n\t\tcombinedControlMap,\n\t\tprops.activeLocale,\n\t\tnode,\n\t\tnode.tree()!,\n\t\tundefined,\n\t)\n\tupdateStackAndGridChildCacheForCanvasSandbox(parent, node)\n\tnode.cache.tickerAncestorId = hasTickerEffect(parent) ? parent.id : undefined\n\n\tlet layoutTemplateProps: Record<string, unknown> | undefined = undefined\n\n\tif (hasLayoutTemplate(parent)) {\n\t\tassert(\n\t\t\tprops.layoutTemplateIdentifier === parent.layoutTemplateIdentifier,\n\t\t\t\"layout template identifier mismatch\",\n\t\t\tprops.layoutTemplateIdentifier,\n\t\t\tparent.layoutTemplateIdentifier,\n\t\t)\n\t\tassert(withControlProps(parent), \"Scope using layout template must support control props\", parent.id)\n\t\tlayoutTemplateProps = parent.getResolvedControlPropValues(\n\t\t\ttracker.componentLoader,\n\t\t\tgetAssetResolverWithHash(),\n\t\t\tcombinedValueMap,\n\t\t\tprops.activeLocale,\n\t\t)\n\n\t\tfor (const name of parent.getRichTextControlKeys(tracker.componentLoader)) {\n\t\t\t// We should only compile props which have not previously been compiled.\n\t\t\tconst value = layoutTemplateProps[name]\n\t\t\tif (isString(value)) {\n\t\t\t\tlayoutTemplateProps[name] = compileRichTextForCanvasRenderingMemoized(value)\n\t\t\t} else if (isRichTextDocument(value)) {\n\t\t\t\tlayoutTemplateProps[name] = compileRichTextForCanvasRendering(value)\n\t\t\t}\n\t\t}\n\n\t\tconst vectorSetItemProps = parent.getComponentVectorSetChildren(tracker.componentLoader, combinedValueMap)\n\t\tfor (const key in vectorSetItemProps) {\n\t\t\tconst value = vectorSetItemProps[key]\n\t\t\tif (isUndefined(value)) continue\n\t\t\tlayoutTemplateProps[key] = reactComponentForVectorSetIdentifier(value)\n\t\t}\n\t}\n\n\tconst element = shouldRenderNodeLevelRepeat\n\t\t? getNodeLevelRepeatedNodes({\n\t\t\t\ttracker,\n\t\t\t\tnode,\n\t\t\t\tparent,\n\t\t\t\trendering,\n\t\t\t\tgroundNodeId: props.groundNodeId,\n\t\t\t\tcombinedValueMap,\n\t\t\t\tcombinedControlMap,\n\t\t\t\tactiveLocale: props.activeLocale,\n\t\t\t\tlayoutTemplateIdentifier: props.layoutTemplateIdentifier,\n\t\t\t\tlayoutTemplatePropsVersion: props.layoutTemplatePropsVersion,\n\t\t\t\tshouldSetMinHeight: props.shouldSetMinHeight,\n\t\t\t\toptionalSelectedCollectionItemId: props.optionalSelectedCollectionItemId,\n\t\t\t\tskipRichTextProps: props.skipRichTextProps,\n\t\t\t})\n\t\t: elementForNode(\n\t\t\t\ttracker,\n\t\t\t\tnode,\n\t\t\t\trendering,\n\t\t\t\tprops.groundNodeId,\n\t\t\t\tcombinedValueMap,\n\t\t\t\tcombinedControlMap,\n\t\t\t\tprops.activeLocale,\n\t\t\t\tprops.layoutTemplateIdentifier,\n\t\t\t\tlayoutTemplateProps,\n\t\t\t\tundefined,\n\t\t\t\tprops.shouldSetMinHeight,\n\t\t\t)\n\n\t// Track the new states.\n\ttracker.useStates(rendering, cache.renderingStatesUsed)\n\tif (cache.useViewportOfNodeId) {\n\t\ttracker.useViewport(rendering, cache.useViewportOfNodeId)\n\t}\n\n\tif (cache.useRectsOfRenderIds) {\n\t\ttracker.useNodeRect(rendering, cache.useRectsOfRenderIds)\n\t}\n\n\tif (cache.useGroundNodeInViewportRendering) {\n\t\ttracker.useGroundNodeInViewport(rendering, cache.useGroundNodeInViewportRendering)\n\t}\n\n\tlog.trace(\n\t\t\"rendered:\",\n\t\trenderId,\n\t\tnode.__class,\n\t\trendering.states,\n\t\tcache.useViewportOfNodeId ? \"viewport\" : \"\",\n\t\t\"node rects:\",\n\t\tcache.useRectsOfRenderIds,\n\t)\n\treturn element\n}, canvasNodeRendererPropsAreSame)\n\ninterface VariableValueAndControlMap {\n\tcombinedValueMap?: CombinedVariableProviderValueMap\n\tcombinedControlMap?: CombinedVariableProviderControlMap\n}\n\n/** Returns variables and control maps from scopes. Will return the same maps as long as there were\n * no changes to the content. */\nfunction getVariableValueAndControlMapFromScope(\n\ttracker: RenderingStateTracker,\n\tscopeNode: ScopeNode,\n\tgroundNode: CanvasNode,\n\tactiveLocale: Locale | undefined,\n\tselectedCollectionItemId: NodeID | undefined,\n\trendering: NodeRendering,\n): VariableValueAndControlMap | undefined {\n\tconst tree = scopeNode.tree()\n\tassert(tree, \"Scope must have a tree\")\n\n\t// TODO: this can be removed after we remove the old rendering and renderElement uses the scope\n\t// as prop. But for now we have to make sure that the parent we are looking at is the actual\n\t// scope.\n\tscopeNode = tree.current(scopeNode)!\n\n\tconst sandboxRepeaterData = tracker.sandboxRepeaterData\n\n\tif (isWebPageNode(scopeNode) && hasCollectionDataSource(scopeNode)) {\n\t\tconst loadingState = getLoadingStateForDataIdentifier(tree, tracker, scopeNode.dataIdentifier, rendering.id)\n\n\t\tif (loadingState.type === \"successFromComponentLoader\" || loadingState.type === \"successFromTree\") {\n\t\t\tconst localeId = activeLocale?.id ?? defaultLocaleId\n\t\t\tconst controlMap = scopeNode.getProvidedControlMap(\n\t\t\t\ttree,\n\t\t\t\tundefined,\n\t\t\t\ttracker.componentLoader,\n\t\t\t\ttracker.state.componentLoaderHash,\n\t\t\t)\n\t\t\tassert(controlMap, \"Control map must exist\")\n\n\t\t\tconst selectedCollectionItem = getSelectedCollectionItem(\n\t\t\t\ttree,\n\t\t\t\ttracker.componentLoader,\n\t\t\t\tscopeNode.dataIdentifier,\n\t\t\t\tselectedCollectionItemId,\n\t\t\t\tlocaleId,\n\t\t\t)\n\n\t\t\tif (selectedCollectionItem) {\n\t\t\t\tassert(scopeNode.isLoaded(), \"WebPageNode must be loaded\")\n\t\t\t\tconst query = getQueryForWebPageNode(\n\t\t\t\t\ttree,\n\t\t\t\t\ttracker.componentLoader,\n\t\t\t\t\tcontrolMap,\n\t\t\t\t\tscopeNode,\n\t\t\t\t\tgroundNode,\n\t\t\t\t\tactiveLocale,\n\t\t\t\t\tselectedCollectionItem?.id,\n\t\t\t\t)\n\n\t\t\t\ttry {\n\t\t\t\t\tconst collectionList = tracker.queryCollection(rendering, query, activeLocale)\n\t\t\t\t\tsandboxRepeaterData.set(scopeNode.id, collectionList, controlMap)\n\t\t\t\t} catch (error) {\n\t\t\t\t\tlog.reportError(error)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tlet localeCombinedValueMap: CombinedVariableProviderValueMap | undefined\n\tlet localeCombinedControlMap: CombinedVariableProviderControlMap | undefined\n\n\tif (isProvidingLocaleVariable(scopeNode)) {\n\t\tlocaleCombinedValueMap = getLocaleCombinedVariableProviderValueMap(tree, activeLocale)\n\t\tlocaleCombinedControlMap = getLocaleCombinedVariableProviderControlMap(tree)\n\t}\n\n\tif (isCanvasScopeWithVariables(scopeNode)) {\n\t\tconst valueMap = scopeNode.getProvidedValueMap(\n\t\t\ttree,\n\t\t\tundefined,\n\t\t\ttracker.componentLoader,\n\t\t\tsandboxRepeaterData,\n\t\t\ttracker.state.componentLoaderHash,\n\t\t)\n\t\tconst combinedValueMap = addLocaleValueMapToVariableValueMap(scopeNode.id, localeCombinedValueMap, valueMap)\n\n\t\tconst controlMap = scopeNode.getProvidedControlMap(\n\t\t\ttree,\n\t\t\tundefined,\n\t\t\ttracker.componentLoader,\n\t\t\ttracker.state.componentLoaderHash,\n\t\t)\n\t\tconst combinedControlMap = addLocaleControlMapToVariableControlMap(\n\t\t\tscopeNode.id,\n\t\t\tlocaleCombinedControlMap,\n\t\t\tcontrolMap,\n\t\t)\n\n\t\treturn {\n\t\t\tcombinedValueMap,\n\t\t\tcombinedControlMap,\n\t\t}\n\t}\n}\n\nconst addLocaleValueMapToVariableValueMap = memoizeOne(\n\t(\n\t\tscopeId: NodeID,\n\t\tlocaleCombinedValueMap: CombinedVariableProviderValueMap | undefined,\n\t\tvalueMap: VariableProviderValueMap | undefined,\n\t) => {\n\t\tif (!valueMap) return localeCombinedValueMap\n\t\tconst combinedVariables: CombinedVariableProviderValueMap = new Map(localeCombinedValueMap)\n\t\treturn combinedVariables.set(scopeId, valueMap)\n\t},\n)\n\nconst addLocaleControlMapToVariableControlMap = memoizeOne(\n\t(\n\t\tscopeId: NodeID,\n\t\tlocaleCombinedControlMap: CombinedVariableProviderControlMap | undefined,\n\t\tcontrolMap: VariableProviderControlMap | undefined,\n\t) => {\n\t\tif (!controlMap) return localeCombinedControlMap\n\t\tconst combinedControls: CombinedVariableProviderControlMap = new Map(localeCombinedControlMap)\n\t\treturn combinedControls.set(scopeId, controlMap)\n\t},\n)\n\nfunction removeGradientFromProps(node: CanvasNode, props: Record<string, any>) {\n\tif (!withFill(node)) return\n\n\tswitch (node.fillType) {\n\t\tcase \"linear-gradient\":\n\t\tcase \"radial-gradient\":\n\t\tcase \"conic-gradient\":\n\t\t\tprops.background = null\n\t\t\tif (props.style?.background) {\n\t\t\t\tprops.style.background = null\n\t\t\t}\n\t}\n}\n\nfunction reactElementForComponentIdentifier(\n\tcomponentLoader: SandboxComponentLoader,\n\tidentifier: string,\n\tprops: Record<string, unknown> = {},\n\tchildren: readonly ReactNode[] = [],\n): React.ReactElement | null {\n\tconst componentDefinition = componentLoader.renderableComponentForIdentifier(identifier)\n\n\tif (!componentDefinition) {\n\t\treturn handleNullComponentDefinition(componentLoader, identifier)\n\t} else if (\n\t\tisSandboxErrorDefinition(componentDefinition) ||\n\t\t!isSandboxRenderableComponentDefinition(componentDefinition)\n\t) {\n\t\treturn null\n\t}\n\n\treturn React.createElement(componentDefinition.class, props, children)\n}\n\nfunction handleNullComponentDefinition(componentLoader: SandboxComponentLoader, identifier: string) {\n\t// If there is an error, the ComponentContainer will take care of it\n\tconst error = componentLoader.errorForIdentifier(identifier)\n\tif (error) return null\n\n\t// Otherwise, show a loading placeholder\n\treturn <RenderPlaceholder key=\"component-placeholder\" />\n}\n\n// When rendering a tree for the first time, we don't immediately want to show the content of Scroll\n// and Page components. Thus we hold back rendering of the CachedNodeProxy until the first stages of\n// rendering are done.\nconst taskQueue = renderingTaskQueues.getTaskQueue(\"cached-node-proxy\", {\n\tdelay: 100,\n\tpriority: RenderingTaskPriority.CachedNodeProxies,\n\tmaxBatchSize: 50,\n})\n\ninterface DelayPageScrollProps {\n\tchildren?: React.ReactNode\n}\n\ninterface DelayPageScrollState {\n\tshouldRender: boolean\n}\n\nclass DelayPageScroll extends React.Component<DelayPageScrollProps, DelayPageScrollState> {\n\ttask?: { cancel: () => void }\n\n\toverride readonly state = {\n\t\tshouldRender: renderingTaskQueues.getPriority() <= RenderingTaskPriority.CachedNodeProxies,\n\t}\n\n\toverride componentWillUnmount() {\n\t\tthis.task?.cancel()\n\t}\n\n\toverride componentDidMount() {\n\t\tif (this.state.shouldRender) return\n\n\t\tthis.task = taskQueue.add(() => {\n\t\t\tthis.task = undefined\n\t\t\tif (this.state.shouldRender) return\n\t\t\tthis.setState({ shouldRender: true })\n\t\t})\n\t}\n\n\toverride render() {\n\t\tif (!this.state.shouldRender) return null\n\t\treturn this.props.children\n\t}\n}\n", "import { assert } from \"@framerjs/shared\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { stringFromNodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isValidSandboxOverlay } from \"document/models/CanvasTree/nodes/utils/overlayHelpers.ts\"\nimport type { WithFloatingPosition } from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport {\n\tDEFAULT_FLOATING_ALIGNMENT,\n\tDEFAULT_FLOATING_PLACEMENT,\n\tgetRebasedInsetX,\n\tgetRebasedInsetY,\n\thasFloatingPosition,\n} from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport { isBreakpointVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport type React from \"react\"\nimport { useLayoutEffect, useRef } from \"react\"\nimport * as styles from \"./CanvasFloatingPosition.styles.ts\"\n\n/**\n * We render an invisible 1x1 div that we will measure during rendering to\n * calculate the canvas scale we need for positioning the floating layer\n * (CanvasFloatingLayout.tsx). This avoids having to pass the canvasStore zoom\n * number down, which would create unnecessary rerenders when we just need this\n * number for our initial calculations.\n *\n * It's possible that we could avoid this by using a ref stored in React\n * Context, but this works and adds little to no overhead.\n */\nfunction getFloatingScaleFactorDivId(id: string) {\n\treturn \"__framer_floating_scale_\" + id\n}\n\nfunction FloatingPosition({\n\tchildren,\n\tnode,\n\tgroundNode,\n}: React.PropsWithChildren<{\n\tnode: CanvasNode & WithFloatingPosition & { floatingPositionEnabled: true }\n\tgroundNode: CanvasNode\n}>) {\n\tconst ref = useRef<HTMLDivElement>(null)\n\tconst {\n\t\tfloatingPlacement = DEFAULT_FLOATING_PLACEMENT,\n\t\tfloatingAlignment = DEFAULT_FLOATING_ALIGNMENT,\n\t\tfloatingOffsetX = 0,\n\t\tfloatingOffsetY = 0,\n\t} = node\n\n\tconst tree = node.tree()\n\tassert(tree, \"rendering a node without a tree\")\n\n\tuseLayoutEffect(() => {\n\t\tif (!ref.current || !node.parentid || !groundNode) return\n\n\t\t// When rendered inside a Layout Template instance, the measurable\n\t\t// ground node canvas element is not prefixed with id_.\n\t\tconst groundNodeEl =\n\t\t\tdocument.getElementById(groundNode.id) ?? document.getElementById(stringFromNodeID(groundNode.id))\n\t\tif (!groundNodeEl) return\n\n\t\tconst anchor = document.getElementById(stringFromNodeID(node.parentid))\n\t\tif (!anchor) return\n\n\t\tconst scaleDiv = document.getElementById(getFloatingScaleFactorDivId(node.id))\n\t\tif (!scaleDiv) return\n\n\t\tconst scaleDivRect = scaleDiv.getBoundingClientRect()\n\t\tconst rect = ref.current.getBoundingClientRect()\n\t\tconst groundNodeRect = groundNodeEl.getBoundingClientRect()\n\t\tconst anchorRect = anchor.getBoundingClientRect()\n\n\t\tconst canvasScale = scaleDivRect.width / 1 // the scale div is 1x1\n\n\t\tconst transformedOffsetX = floatingOffsetX * canvasScale\n\t\tconst transformedOffsetY = floatingOffsetY * canvasScale\n\n\t\tconst transformedDeltaX = getRebasedInsetX(\n\t\t\trect.width,\n\t\t\tanchorRect.width,\n\t\t\tfloatingPlacement,\n\t\t\tfloatingAlignment,\n\t\t\ttransformedOffsetX,\n\t\t)\n\t\tconst transformedDeltaY = getRebasedInsetY(\n\t\t\trect.height,\n\t\t\tanchorRect.height,\n\t\t\tfloatingPlacement,\n\t\t\tfloatingAlignment,\n\t\t\ttransformedOffsetY,\n\t\t)\n\n\t\t// Final positioning is relative to the ground node, and should undo the canvas scale.\n\t\tconst anchorInsetX = anchorRect.x - groundNodeRect.x\n\t\tconst anchorInsetY = anchorRect.y - groundNodeRect.y\n\t\tconst x = Math.round(anchorInsetX + transformedDeltaX) / canvasScale\n\t\tconst y = Math.round(anchorInsetY + transformedDeltaY) / canvasScale\n\n\t\tref.current.style.left = x + \"px\"\n\t\tref.current.style.top = y + \"px\"\n\t})\n\n\treturn (\n\t\t<div ref={ref} style={{ position: \"absolute\" }}>\n\t\t\t{children}\n\t\t</div>\n\t)\n}\n\n/**\n * A helper to render any nodes with valid floating position in a portal,\n * positioned relative to the triggering node. Otherwise has no impact. We use a\n * plain function instead of a component to reduce the raw number of React\n * components.\n */\nexport function maybeRenderWithFloatingPosition(node: CanvasNode, component: JSX.Element | null) {\n\tconst tree = node.tree()\n\tif (!tree || !hasFloatingPosition(node) || !isValidSandboxOverlay(node, tree)) return component\n\n\tconst groundNode = tree.getGroundNodeFor(node)\n\n\treturn (\n\t\t<div\n\t\t\tclassName={styles.floatingPositionContainer}\n\t\t\tstyle={{ overflow: isBreakpointVariant(groundNode) ? \"hidden\" : undefined }}\n\t\t>\n\t\t\t<div className={styles.floatingPositionScaleFactor} id={getFloatingScaleFactorDivId(node.id)} />\n\t\t\t<FloatingPosition node={node} groundNode={groundNode}>\n\t\t\t\t{component}\n\t\t\t</FloatingPosition>\n\t\t</div>\n\t)\n}\n", "import \"CanvasFloatingPosition.styles_1seks1r.wyw.css\"; export const floatingPositionContainer = \"floatingPositionContainer_f1wexhsn\";\nexport const floatingPositionScaleFactor = \"floatingPositionScaleFactor_f1ohstba\";", "import { RenderPlaceholder } from \"@framerjs/framer-runtime/components/RenderPlaceholder\"\nimport type { LocalModuleExportIdentifierString, ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { ModuleType, isLocalModuleIdentifier, parseModuleIdentifier } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport type { FrameNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\tcreateLayoutTemplateAnnotationCache,\n\tuseLayoutTemplateAnnotations,\n} from \"document/models/CanvasTree/nodes/utils/useLayoutTemplateAnnotations.ts\"\nimport { isBreakpointVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { createCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { ROOT_FONT_SIZE_CSS_PROPERTY } from \"document/models/CanvasTree/traits/utils/rootFontSizeHelpers.ts\"\nimport { RenderTarget } from \"library/index.ts\"\nimport { runtime } from \"library/utils/runtimeInjection.ts\"\nimport React, { useEffect, useLayoutEffect, useRef } from \"react\"\nimport { useModulesRuntime } from \"utils/ModulesRuntimeContext.ts\"\nimport { errorTitleForDefinition, useModuleState } from \"utils/useModuleState.tsx\"\nimport { getLayoutChildrenForMeasurement } from \"./CanvasLayout.tsx\"\nimport * as styles from \"./CanvasLayoutTemplate.styles.ts\"\nimport { ComponentContainer } from \"./ComponentContainer.tsx\"\nimport type { RenderingStateTracker } from \"./RenderingStateTracker.ts\"\n\ninterface Props<T extends ModuleExportIdentifierString> {\n\ttracker: RenderingStateTracker\n\tchildren: JSX.Element | null\n\tcomponentIdentifier: T\n\tbreakpointId: string\n\tbreakpointWidth: number\n\tneedsMeasure: boolean\n\thideChildren: boolean\n\t/** Control props */\n\t[key: string]: unknown\n}\n\nconst annotationCache = createLayoutTemplateAnnotationCache()\n\n// Using inline styles since the placeholder component sets all of its styles inline.\nconst errorPlaceholderStyle: React.CSSProperties = {\n\tminHeight: 1000,\n\t// Make the font size larger since at 1000\u00D71000px size, the default 12px font size would be too small to read.\n\tfontSize: \"1.5em\",\n}\n\nfunction CanvasLayoutTemplate({\n\ttracker,\n\tcomponentIdentifier,\n\tchildren,\n\tbreakpointId,\n\tbreakpointWidth,\n\tneedsMeasure = true,\n\thideChildren = false,\n\t...controlProps\n}: Props<ModuleExportIdentifierString>) {\n\tconst ref = useRef<HTMLDivElement>()\n\t// A ref to target the breakpoint descendants for measurements when a layout template is applied.\n\tconst contentRef = useRef<HTMLDivElement>(null)\n\tconst modulesRuntime = useModulesRuntime()\n\tconst [state, ModuleErrorBoundary] = useModuleState(modulesRuntime, componentIdentifier)\n\n\tconst parsedAnnotations = useLayoutTemplateAnnotations(\n\t\tmodulesRuntime.componentLoader,\n\t\tcomponentIdentifier,\n\t\tbreakpointWidth,\n\t\tannotationCache,\n\t)\n\n\t// Schedule measurement for any position: fixed elements in the layout\n\t// template. The layout template rect itself will be scheduled to measure by\n\t// the ComponentContainer.\n\tuseLayoutEffect(() => {\n\t\tif (state.status !== \"success\") return\n\t\tif (!parsedAnnotations) return\n\n\t\t// must have a valid ref, id, be visible and need measure\n\t\tif (!ref.current || !needsMeasure) return\n\n\t\t// Queue measure requests for the fixed layers in the layout template.\n\t\tparsedAnnotations.selectors?.forEach(selector => {\n\t\t\t// Find elements that are descendants of the current ground node, not the whole canvas.\n\t\t\tconst element = ref.current?.querySelector(selector)\n\t\t\tif (element) runtime.queueMeasureRequest(breakpointId, element, [], selector)\n\t\t})\n\n\t\t// Measure the layout template container, but targets the breakpoint content for the childrenRects.\n\t\truntime.queueMeasureRequest(breakpointId, ref.current, getLayoutChildrenForMeasurement(contentRef.current))\n\t})\n\n\tconst loaded = state.status === \"success\" && !!parsedAnnotations\n\tuseTrackLayoutTemplateExport(tracker, componentIdentifier, loaded)\n\n\tif (!children) return null\n\tif (state.status === \"loading\") return null\n\n\tconst clonedChildren = React.cloneElement(children, {\n\t\tstyle: { ...children.props.style, display: \"contents\", position: \"relative\" },\n\t\t\"data-layout-template-root\": true,\n\t\t// Never measure the breakpoint frame node. We instead measure\n\t\t// the Layout Template root element.\n\t\t_needsMeasure: false,\n\t\tref: contentRef,\n\t})\n\n\tlet layoutTemplate: JSX.Element | null = null\n\tif (state.status === \"error\") {\n\t\tlayoutTemplate = (\n\t\t\t<RenderPlaceholder style={errorPlaceholderStyle} error={{ title: state.title, message: state.message }} />\n\t\t)\n\t} else if (!parsedAnnotations) {\n\t\tconst definition = componentIdentifier\n\t\t\t? (tracker.componentLoader.componentForIdentifier(componentIdentifier) ??\n\t\t\t\ttracker.componentLoader.errorForIdentifier(componentIdentifier))\n\t\t\t: undefined\n\t\tlayoutTemplate = (\n\t\t\t<RenderPlaceholder\n\t\t\t\tstyle={errorPlaceholderStyle}\n\t\t\t\terror={{\n\t\t\t\t\ttitle: errorTitleForDefinition(definition),\n\t\t\t\t\tmessage: \"Can\u2019t parse annotations for the layout template.\",\n\t\t\t\t}}\n\t\t\t/>\n\t\t)\n\t} else {\n\t\tconst Component = state.definition.class\n\t\tconst { activeVariant, minHeight: annotatedMinHeight, rootFontSize: annotatedRootFontSize } = parsedAnnotations\n\t\t// Reserve a minimum height on the canvas for users to design within the breakpoint.\n\t\tconst minHeight = Math.min(annotatedMinHeight, 1000)\n\t\tlayoutTemplate = (\n\t\t\t<Component\n\t\t\t\t{...controlProps}\n\t\t\t\tvariant={activeVariant}\n\t\t\t\tclassName={cx(children.props.className, hideChildren && styles.hideBackgroundAndChildren)}\n\t\t\t\tstyle={{\n\t\t\t\t\tminHeight,\n\t\t\t\t\t// We override the root font size in order for `rem` units inside a layout template\n\t\t\t\t\t// to be rendered correctly on the canvas.\n\t\t\t\t\t[ROOT_FONT_SIZE_CSS_PROPERTY]: createCSSDimension(annotatedRootFontSize, \"px\"),\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{clonedChildren}\n\t\t\t</Component>\n\t\t)\n\t}\n\n\treturn (\n\t\t<ComponentContainer\n\t\t\tkey={componentIdentifier}\n\t\t\tcomponentLoader={tracker.componentLoader}\n\t\t\tcomponentIdentifier={componentIdentifier}\n\t\t\twidth=\"100%\"\n\t\t\theight=\"auto\"\n\t\t\t// For useMeasureLayout\n\t\t\tisSlotContainer\n\t\t\tvisible={true}\n\t\t\t// We already scheduled a measurement in the useLayoutEffect above.\n\t\t\t_needsMeasure={false}\n\t\t\tinnerRef={ref}\n\t\t\tclassName={parsedAnnotations?.className}\n\t\t\t// This id won't clash with the breakpoint id because it doesn't have the id_ prefix.\n\t\t\tid={breakpointId}\n\t\t>\n\t\t\t<ModuleErrorBoundary>{layoutTemplate}</ModuleErrorBoundary>\n\t\t</ComponentContainer>\n\t)\n}\n\nexport function maybeRenderWithLayoutTemplate(\n\ttracker: RenderingStateTracker,\n\tnode: FrameNode,\n\tlayoutTemplateIdentifier: LocalModuleExportIdentifierString | null | undefined,\n\tcontrolProps: Record<string, unknown> | undefined,\n\tcomponent: JSX.Element | null,\n) {\n\tif (!layoutTemplateIdentifier) return component\n\tif (!isBreakpointVariant(node)) return component\n\tif (!component) return null\n\n\tconst parsedIdentifier = parseModuleIdentifier(layoutTemplateIdentifier)\n\tif (!isLocalModuleIdentifier(parsedIdentifier) || parsedIdentifier.type !== ModuleType.LayoutTemplate) {\n\t\treturn component\n\t}\n\n\tconst isExporting = RenderTarget.current() === RenderTarget.export\n\n\treturn (\n\t\t<CanvasLayoutTemplate\n\t\t\ttracker={tracker}\n\t\t\tcomponentIdentifier={layoutTemplateIdentifier}\n\t\t\tbreakpointId={node.id}\n\t\t\tbreakpointWidth={node.width}\n\t\t\tneedsMeasure={component.props._needsMeasure}\n\t\t\thideChildren={isExporting && node.cache.isLayoutTemplateContentHiddenInExport}\n\t\t\t{...controlProps}\n\t\t>\n\t\t\t{component}\n\t\t</CanvasLayoutTemplate>\n\t)\n}\n\n/**\n * Tracks layout templates that need to be loaded during export.\n */\nfunction useTrackLayoutTemplateExport(\n\ttracker: RenderingStateTracker,\n\tcomponentIdentifier: ModuleExportIdentifierString,\n\tloaded: boolean,\n) {\n\tuseEffect(() => {\n\t\t// We only want to track layout templates when exporting\n\t\tif (RenderTarget.current() !== RenderTarget.export) return\n\n\t\ttracker.layoutTemplatesToLoad.add(componentIdentifier)\n\n\t\tif (loaded) {\n\t\t\ttracker.layoutTemplatesToLoad.delete(componentIdentifier)\n\t\t}\n\n\t\treturn () => {\n\t\t\ttracker.layoutTemplatesToLoad.delete(componentIdentifier)\n\t\t}\n\t}, [tracker, componentIdentifier, loaded])\n}\n", "import \"CanvasLayoutTemplate.styles_hb8lc7.wyw.css\"; export const hideBackgroundAndChildren = \"hideBackgroundAndChildren_h7uwxh5\";", "import type { FrameProps, MotionStyle } from \"library/index.ts\"\nimport { FrameWithMotion } from \"library/index.ts\"\nimport { isReactChild, isReactElement } from \"library/utils/type-guards.ts\"\nimport React from \"react\"\n\n/**\n * Overlays on the canvas need to provide a backdrop div that is a sibling of\n * the overlay content to prevent discrepancies with generated-code, where this\n * hierarchy is required for animations.\n */\nexport function CanvasOverlay({ children, style, ...props }: React.PropsWithChildren<Partial<FrameProps>>) {\n\treturn (\n\t\t<FrameWithMotion {...props}>\n\t\t\t<FrameWithMotion {...props} style={style} />\n\t\t\t{React.Children.map(children, child => {\n\t\t\t\tif (!child || !isReactChild(child) || !isReactElement(child)) return child\n\t\t\t\t// Ensure z-index always matches the overlay, unless otherwise\n\t\t\t\t// specified.\n\t\t\t\treturn React.cloneElement(child, {\n\t\t\t\t\t...child.props,\n\t\t\t\t\tstyle: matchZIndex(child.props.style, style),\n\t\t\t\t})\n\t\t\t})}\n\t\t</FrameWithMotion>\n\t)\n}\n\nfunction matchZIndex(childStyle: MotionStyle, backdropStyle?: MotionStyle) {\n\treturn { ...childStyle, zIndex: childStyle.zIndex ?? backdropStyle?.zIndex }\n}\n", "import { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { RenderTarget, useMeasureLayout } from \"library/index.ts\"\nimport React from \"react\"\nimport * as styles from \"./CanvasSlot.styles.ts\"\n\nexport const CanvasSlot = React.memo(({ id }: { id: NodeID }) => {\n\tconst layoutRef = React.useRef<HTMLDivElement>(null)\n\tuseMeasureLayout(\n\t\t{\n\t\t\tid,\n\t\t\tvisible: true,\n\t\t\t_needsMeasure: true,\n\t\t},\n\t\tlayoutRef,\n\t)\n\n\t// When exporting, we don't want to show the placeholder and we want to have\n\t// a transparent background.\n\tconst isExporting = RenderTarget.current() === RenderTarget.export\n\n\treturn (\n\t\t<div id={id} className={cx(styles.canvasSlot, isExporting && styles.transparent)} ref={layoutRef}>\n\t\t\t{!isExporting && (\n\t\t\t\t<div className={styles.wrapper}>\n\t\t\t\t\t<IconTemplatePlaceholder />\n\t\t\t\t\t<div className={styles.content}>\n\t\t\t\t\t\t<p className={styles.title}>{Dictionary.Placeholder}</p>\n\t\t\t\t\t\t<p className={styles.description}>\n\t\t\t\t\t\t\tYour page content\n\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\twill appear here.\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t)\n})\n\nfunction IconTemplatePlaceholder() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 18 18\">\n\t\t\t<path\n\t\t\t\td=\"M 1 4 C 1 2.343 2.343 1 4 1 L 14 1 C 15.657 1 17 2.343 17 4 L 17 14 C 17 15.657 15.657 17 14 17 L 4 17 C 2.343 17 1 15.657 1 14 Z\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t/>\n\t\t\t<path d=\"M 2 6 L 16 6\" fill=\"transparent\" stroke=\"currentColor\" />\n\t\t\t<path d=\"M 2 6.5 L 16 6.5 L 16 17 L 2 17 Z\" fill=\"currentColor\" fillOpacity={0.2} />\n\t\t</svg>\n\t)\n}\n", "import \"CanvasSlot.styles_14yvirp.wyw.css\"; export const canvasSlot = \"canvasSlot_cke2v8s\";\nexport const transparent = \"transparent_tgmrtzx\";\nexport const wrapper = \"wrapper_w1t42tfh\";\nexport const content = \"content_cek9n5i\";\nexport const title = \"title_t17c4cno\";\nexport const description = \"description_daxy54u\";", "import { assertNever } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { CanvasNode, CanvasTree } from \"document/models/CanvasTree/index.ts\"\nimport type { DataRepeater } from \"document/models/CanvasTree/nodes/FrameNode.ts\"\nimport { hasAnyDataLoaderVariants } from \"document/models/CanvasTree/traits/WithDataLoaderVariants.ts\"\nimport { EmptyState } from \"library/components/EmptyState.tsx\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport { isRepeatedItem } from \"utils/repeaterUtils.ts\"\n\ntype EmptyStateReason =\n\t| \"collectionError\"\n\t| \"arrayError\"\n\t| \"missingChild\"\n\t| \"loading\"\n\t| \"filtered\"\n\t| \"emptyCollection\"\n\t| \"emptyArray\"\n\t| \"queryError\"\n\nfunction reasonClass(reason: EmptyStateReason): \"error\" | \"empty\" | \"other\" {\n\tswitch (reason) {\n\t\tcase \"collectionError\":\n\t\tcase \"arrayError\":\n\t\tcase \"queryError\":\n\t\t\treturn \"error\"\n\n\t\tcase \"filtered\":\n\t\tcase \"emptyCollection\":\n\t\tcase \"emptyArray\":\n\t\t\treturn \"empty\"\n\n\t\tcase \"missingChild\":\n\t\tcase \"loading\":\n\t\t\treturn \"other\"\n\n\t\tdefault:\n\t\t\tassertNever(reason)\n\t}\n}\n\nfunction getTitleForReason(reason: EmptyStateReason): string {\n\tswitch (reason) {\n\t\tcase \"collectionError\":\n\t\t\treturn `Error Loading ${Dictionary.Collection}`\n\t\tcase \"arrayError\":\n\t\t\treturn `Error Loading ${Dictionary.Gallery}`\n\t\tcase \"queryError\":\n\t\t\treturn `Failed to Query ${Dictionary.Collection}`\n\n\t\tcase \"filtered\":\n\t\t\treturn \"No Items Match the Current Filters\"\n\t\tcase \"emptyCollection\":\n\t\t\treturn \"No Items\"\n\t\tcase \"emptyArray\":\n\t\t\treturn \"No Items\"\n\n\t\tcase \"missingChild\":\n\t\t\treturn \"Missing a Child Layer\"\n\t\tcase \"loading\":\n\t\t\treturn Dictionary.LoadingEllipsis\n\n\t\tdefault:\n\t\t\tassertNever(reason)\n\t}\n}\n\nconst isPaginationComponentNode = hasAnyDataLoaderVariants\n/**\n * If we have extra children (like an empty state fallback), we assume the user knows what they're doing,\n * and we want the user to be able to see the repeater as close as possible to reality in its empty state,\n * so we don't render a default empty state. These ignored types of children are the only ones that are\n * acceptable beside the placeholder.\n */\nfunction shouldIgnoreChildForPlaceholder(tree: CanvasTree, repeater: DataRepeater, child: CanvasNode): boolean {\n\tif (isRepeatedItem(tree, child, repeater)) return true\n\tif (isPaginationComponentNode(child)) return true\n\treturn false\n}\n\ninterface Props {\n\treason: EmptyStateReason\n\tnode: DataRepeater\n\ttree: CanvasTree\n\terror?: string\n}\n\nexport function DataRepeaterNoItemsPlaceholder({ reason, node, tree, error }: Props) {\n\tconst width = node.widthType === DimensionType.Auto ? 200 : \"100%\"\n\tconst height = node.heightType === DimensionType.Auto ? 100 : \"100%\"\n\n\tif (reasonClass(reason) === \"error\") {\n\t\treturn (\n\t\t\t<EmptyState\n\t\t\t\tposition=\"relative\"\n\t\t\t\ttitle={getTitleForReason(reason)}\n\t\t\t\tdescription={error ?? \"Unknown error\"}\n\t\t\t\tsize={{ width, height }}\n\t\t\t>\n\t\t\t\t{null}\n\t\t\t</EmptyState>\n\t\t)\n\t}\n\n\tconst hidePlaceholder = node.children.some(child => !shouldIgnoreChildForPlaceholder(tree, node, child))\n\n\tif (hidePlaceholder) {\n\t\treturn null\n\t}\n\n\treturn (\n\t\t<EmptyState\n\t\t\tposition=\"relative\"\n\t\t\ttitle={getTitleForReason(reason)}\n\t\t\tdescription={\n\t\t\t\treasonClass(reason) === \"empty\" && (\n\t\t\t\t\t<span>\n\t\t\t\t\t\tSelect the layer and click the plus\n\t\t\t\t\t\t<br />\n\t\t\t\t\t\tbutton to add an empty state.\n\t\t\t\t\t</span>\n\t\t\t\t)\n\t\t\t}\n\t\t\tsize={{ width, height }}\n\t\t>\n\t\t\t{null}\n\t\t</EmptyState>\n\t)\n}\n", "import type {\n\tExternalModuleExportIdentifierString,\n\tLocalModuleExportIdentifierString,\n\tModuleIdentifierString,\n} from \"@framerjs/shared\"\nimport type { CodeComponentNode } from \"document/models/CanvasTree/index.ts\"\nimport type React from \"react\"\nimport { forwardRef } from \"react\"\nimport { useModulesRuntime } from \"utils/ModulesRuntimeContext.ts\"\nimport type { ModuleState } from \"../utils/useModuleState.tsx\"\nimport { useModuleState } from \"../utils/useModuleState.tsx\"\nimport { ComponentContainer } from \"./ComponentContainer.tsx\"\nimport type { RenderContext } from \"./RenderContext.ts\"\n\ninterface Props<T extends ModuleIdentifierString> extends Record<string, unknown> {\n\tchildren: React.ReactNode\n\tcomponentIdentifier: T\n\t__renderContext: RenderContext<CodeComponentNode>\n\tnodeForState(state: ModuleState, ctx: RenderContext<CodeComponentNode>): React.ReactNode\n}\n\n/**\n * This component is responsible for rendering components coming from external\n * modules. It ensures loading of the module (through sandboxComponentLoader)\n * and handling the possible errors in that process. Once the module is loaded\n * and evaluated it passes the loaded code over to ComponentContainer which\n * handles the rest.\n */\nexport const ExternalModuleContainer = forwardRef(function ExternalModuleContainer(\n\t{\n\t\t__renderContext,\n\t\tcomponentIdentifier,\n\t\tchildren,\n\t\tnodeForState,\n\t\t...props\n\t}: Props<ExternalModuleExportIdentifierString>,\n\tref,\n) {\n\tconst modulesRuntime = useModulesRuntime()\n\tconst [state, ModuleErrorBoundary] = useModuleState(modulesRuntime, componentIdentifier)\n\tlet { width, height } = props\n\n\t// Prevent error containers from being inserted as 0x0.\n\tif (state.status === \"error\" && (width === \"auto\" || height === \"auto\")) {\n\t\twidth = \"200px\"\n\t\theight = \"200px\"\n\t}\n\n\t// Passing the \"key\" ensures the component is re-instantiated if the node's\n\t// \"codeComponentIdentifier\" changes.\n\treturn (\n\t\t<ComponentContainer\n\t\t\tkey={componentIdentifier}\n\t\t\tcomponentLoader={modulesRuntime.componentLoader}\n\t\t\tcomponentIdentifier={componentIdentifier}\n\t\t\t{...props}\n\t\t\twidth={width}\n\t\t\theight={height}\n\t\t\tref={ref}\n\t\t>\n\t\t\t<ModuleErrorBoundary>{nodeForState(state, __renderContext)}</ModuleErrorBoundary>\n\t\t\t{/* External modules can trigger overlays, which are rendered as siblings of the triggering component. */}\n\t\t\t{children}\n\t\t</ComponentContainer>\n\t)\n})\n\n/**\n * This component is responsible for rendering components coming from local\n * modules. It ensures loading of the module (through sandboxComponentLoader)\n * and handling the possible errors in that process. Once the module is loaded\n * and evaluated it passes the loaded code over to ComponentContainer which\n * handles the rest.\n */\nexport const LocalModuleContainer = forwardRef(function LocalModuleContainer(\n\t{ __renderContext, componentIdentifier, children, nodeForState, ...props }: Props<LocalModuleExportIdentifierString>,\n\tref,\n) {\n\tconst modulesRuntime = useModulesRuntime()\n\tconst [state, ModuleErrorBoundary] = useModuleState(modulesRuntime, componentIdentifier)\n\n\t// Passing the \"key\" ensures the old component is unmounted and a new component is mounted when\n\t// \"componentIdentifier\" changes.\n\treturn (\n\t\t<ComponentContainer\n\t\t\tkey={componentIdentifier}\n\t\t\tcomponentLoader={modulesRuntime.componentLoader}\n\t\t\tcomponentIdentifier={componentIdentifier}\n\t\t\t{...props}\n\t\t\tref={ref}\n\t\t>\n\t\t\t<ModuleErrorBoundary>{nodeForState(state, __renderContext)}</ModuleErrorBoundary>\n\t\t\t{/* Modules can trigger overlays, which are rendered as siblings of the triggering component. */}\n\t\t\t{children}\n\t\t</ComponentContainer>\n\t)\n})\n", "import { assert, unhandledError } from \"@framerjs/shared\"\nimport { globalStylesForExport } from \"export/globalStylesForExport.ts\"\nimport type { StylesheetContextValue } from \"library/render/StyleSheetContext.ts\"\nimport { StyleSheetContext } from \"library/render/StyleSheetContext.ts\"\nimport { WindowContext } from \"library/render/WindowContext.ts\"\nimport { injectComponentCSSRulesWithSheet } from \"library/render/utils/injectComponentCSSRules.ts\"\nimport type { ComponentFont } from \"library/utils/addFonts.ts\"\nimport React from \"react\"\nimport { createPortal } from \"react-dom\"\nimport { useConstant } from \"utils/useConstant.ts\"\nimport { withErrorBoundary } from \"./withErrorBoundary.tsx\"\n\nfunction constructAndInjectFontFace(font: ComponentFont, contentDocument?: Document | null) {\n\tif (!contentDocument) return\n\n\tnew FontFace(font.cssFamilyName, `url(${font.url})`, {\n\t\tweight: font.weight,\n\t\tstyle: font.style,\n\t\tunicodeRange: font.unicodeRange,\n\t})\n\t\t.load()\n\t\t.then(loadedFont => contentDocument.fonts.add(loadedFont))\n\t\t.catch(unhandledError)\n}\n\ntype Props = React.PropsWithChildren<{\n\treadonly width?: number | string\n\treadonly height?: number | string\n\treadonly fonts?: Map<string, ComponentFont>\n}>\n\nconst globalStylesElement = document.createElement(\"style\")\nglobalStylesElement.setAttribute(\"type\", \"text/css\")\nglobalStylesElement.appendChild(document.createTextNode(globalStylesForExport))\n\n/**\n * Render children into an iframe, and injecting css and fonts into the iframe's\n * document. This allows this content to be rendered as if it were in a viewport\n * the size of the iframe instance, as well as isolating styles from other\n * ground nodes.\n *\n * How this works:\n * 1. We create a div element\n * 2. We render an iframe with a ref\n * 3. After mount, in a layout effect, we use the iframe ref to access the\n *    iframe's contentDocument, which we can do since it's not a crossorigin\n *    iframe. We can then append the div we created earlier to the iframe's\n *    document, and also inject styles and fonts that we need inside the iframe.\n * 4. Finally when the layout effect completes, we trigger a render and allow\n *    React to render the children of this component into the div element via a\n *    portal. Because the div element is now appended to the iframe's document,\n *    this react render results in the children being rendered inside the\n *    iframe, even though the javascript has been executed outside of the iframe\n *    (currently in the sandbox).\n */\nconst FramePortal = React.memo(function FramePortal({ width, height, children, fonts = new Map() }: Props) {\n\tconst [isReady, setIsReady] = React.useState(false)\n\tconst contextValueRef = React.useRef<StylesheetContextValue | undefined>(undefined)\n\tconst iframeRef = React.useRef<HTMLIFrameElement>(null)\n\tconst lastFonts = React.useRef(fonts)\n\tconst mount = useConstant(() => document.createElement(\"div\"))\n\n\t// Create a stylesheet to host the iframe's scoped CSS rules. We will inject\n\t// this into the iframe after render in a layout effect.\n\tconst stylesheet = useConstant(() => {\n\t\tconst styleElement = document.createElement(\"style\")\n\t\tstyleElement.setAttribute(\"type\", \"text/css\")\n\t\tstyleElement.setAttribute(\"data-framer-css\", \"true\")\n\t\treturn styleElement\n\t})\n\n\t// Ensure that the same global stylesheet used for export/publish is used to\n\t// render the responsive screen. We must clone the node because we cannot\n\t// use a reference to the same node in multiple instances.\n\tconst globalStyleSheet = useConstant(() => globalStylesElement.cloneNode(true))\n\n\t// After the iframe has been rendered, use a ref to access its\n\t// contentDocument, and insert our style tags, as well as the div element\n\t// React is going to render to via a portal. Finally, when this is all\n\t// complete, rerender, allowing React to render into the iframe via the\n\t// portal, and allowing styles to be injected into the iFrame's `<head>` via\n\t// the StyleSheetContext.\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: @TODO add explanation\n\tconst onLoad = React.useCallback(() => {\n\t\tif (!iframeRef.current?.contentDocument) return\n\n\t\t// Since the iframe is not crossorigin, we can manipulate its content\n\t\t// directly.\n\t\tiframeRef.current.contentDocument.head.appendChild(stylesheet)\n\t\tiframeRef.current.contentDocument.head.appendChild(globalStyleSheet)\n\t\tiframeRef.current.contentDocument.body.appendChild(mount)\n\n\t\t// Since the iframe does not inherit it's parent document's fonts, we\n\t\t// must inject them into the iframe. We only have to do this on mount to\n\t\t// ensure we include the fonts we ship with Framer, namely all the\n\t\t// variations of Inter. However, this will also include fonts that have\n\t\t// been added when designing a screen or component in isolation. This\n\t\t// ensure that even though the generated module is being evaluated as a\n\t\t// blob, and the url does not point to a valid resource yet, that the\n\t\t// font is still injected into the iframe.\n\t\tdocument.fonts.forEach(font => {\n\t\t\tfont\n\t\t\t\t.load()\n\t\t\t\t.then(loadedFont => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tiframeRef.current?.contentDocument?.fonts.add(loadedFont)\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t// Firefox does not allow injecting font faces that were\n\t\t\t\t\t\t// added via @font-face css rules, with javascript. This\n\t\t\t\t\t\t// doesn't seem to have a visual impact, so we just\n\t\t\t\t\t\t// swallow those errors here for now.\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.catch(unhandledError)\n\t\t})\n\n\t\t// Next, inject fonts that are required by the responsive screen\n\t\t// instance. These may differ from the sandbox's fonts if a font is used\n\t\t// in the component that hasn't yet been rendered in the sandbox outside\n\t\t// of a generated component. They may also include invalid blob urls if\n\t\t// the component has been generated and compiled in memory in the\n\t\t// current session. In that case we will depend on the above insertion\n\t\t// that adds all of the sandbox's fonts.\n\t\tfonts?.forEach(font => {\n\t\t\t// Framer-provided fonts (like Inter) were already injected above\n\t\t\tif (font.source === \"framer\") return\n\n\t\t\tconstructAndInjectFontFace(font, iframeRef.current?.contentDocument)\n\t\t})\n\n\t\t// HTMLStyleElement only gets a sheet (CSSStyleSheet) after we insert it\n\t\t// into the DOM.\n\t\tassert(stylesheet.sheet, \"ResponsiveScreenContainer: stylesheet should have a sheet\")\n\n\t\tconst cache = new Set<string>()\n\t\tcontextValueRef.current = { sheet: stylesheet.sheet, cache }\n\n\t\t// Inject the component CSS rules into the iframe's stylesheet.\n\t\t// Otherwise they will be included into the sandbox's document since\n\t\t// the library's CSS is not context aware when implemented in\n\t\t// our Library components. Perhaps a future implementation would extract\n\t\t// these rules to a static stylesheet that could be appended like the\n\t\t// global styles above.\n\t\tinjectComponentCSSRulesWithSheet(stylesheet.sheet, cache)\n\n\t\tsetIsReady(true)\n\t}, [])\n\n\t// If fonts change after mount, inject them. This can happen when a remote\n\t// session updates a generated component to include new fonts.\n\t// We only want to run this effect if a new font is added to the map.\n\t// The fonts Map uses the same hash we use in export to decide which\n\t// fonts are unique. If a distinct font is added, this effect will run.\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: see above\n\tReact.useEffect(() => {\n\t\tfonts?.forEach((font, key) => {\n\t\t\t// Don't add fonts that have already been injected.\n\t\t\tif (lastFonts.current?.has(key)) return\n\t\t\tconstructAndInjectFontFace(font, iframeRef.current?.contentDocument)\n\t\t})\n\n\t\tlastFonts.current = fonts\n\t}, [...fonts.keys()])\n\n\t// Firefox requires that we wait for the iframe to be loaded before we start\n\t// injecting into it's document. See suggestions here:\n\t// https://gist.github.com/robertgonzales/b1966af8d2a428a8299663b92fb2fe03#gistcomment-2984779\n\tReact.useLayoutEffect(() => {\n\t\tconst ref = iframeRef.current\n\t\tif (!ref) return\n\n\t\tref.addEventListener(\"load\", onLoad)\n\t\treturn () => ref?.removeEventListener(\"load\", onLoad)\n\t}, [onLoad])\n\n\t// Provide the iframe's contentWindow via context to descendants.\n\tconst localWindow = isWindow(iframeRef.current) ? iframeRef.current?.contentWindow : undefined\n\n\treturn (\n\t\t<iframe\n\t\t\tsrcDoc=\"<!DOCTYPE html>\"\n\t\t\ttitle=\"iframe\"\n\t\t\tref={iframeRef}\n\t\t\tstyle={{\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\tborder: \"none\",\n\t\t\t}}\n\t\t>\n\t\t\t{isReady ? (\n\t\t\t\t<WindowContext.Provider value={localWindow}>\n\t\t\t\t\t<StyleSheetContext.Provider value={contextValueRef.current}>\n\t\t\t\t\t\t{createPortal(children, mount)}\n\t\t\t\t\t</StyleSheetContext.Provider>\n\t\t\t\t</WindowContext.Provider>\n\t\t\t) : null}\n\t\t</iframe>\n\t)\n})\n\n// We must use a type predicate because the type of\n// `HTMLIFrameElement.contentWindow` seems to incorrectly exclude `typeof\n// globalThis`, which is required for SVG to compare html node class references.\nfunction isWindow(\n\telement: HTMLIFrameElement | null,\n): element is HTMLIFrameElement & { contentWindow: (Window & typeof globalThis) | null } {\n\treturn !!element && element.contentWindow?.self === element.contentWindow\n}\n\nexport const ResponsiveScreenContainer = withErrorBoundary((props: Props) => <FramePortal {...props} />)\n", "import { ComponentContainerContext } from \"library/render/presentation/ComponentContainerContext.tsx\"\nimport type { FrameProps } from \"library/render/presentation/Frame/FrameWithMotion.tsx\"\nimport React from \"react\"\nimport * as ReactDOM from \"react-dom\"\n\n/** @deprecated - Remove when `render.tsx` is fully removed. */\nconst withFixedCanvasPositioning =\n\t(Component: React.ComponentType) => (props: Partial<FrameProps> & { portalId: string }) => {\n\t\tconst { id, positionFixed } = props\n\t\tconst { portalId, ...restProps } = props\n\t\tconst target = document.getElementById(portalId)\n\t\tconst [show, setShow] = React.useState(!!target)\n\n\t\t// In some cases, the ground node rendering is deferred in such a way\n\t\t// that the container for the portal does not exist yet, for example\n\t\t// when switching scopes where the target scope has an active overlay.\n\t\t// In these cases we must wait for the layout effect phase to find the\n\t\t// portal target.\n\t\t// biome-ignore lint/correctness/useExhaustiveDependencies: deprecated\n\t\tReact.useLayoutEffect(() => {\n\t\t\tif (show || !positionFixed) return\n\t\t\tsetShow(true)\n\t\t}, [])\n\n\t\tif (!positionFixed) return <Component {...restProps} />\n\n\t\tif (!show || !target) return null\n\n\t\t// useMeasureLayout will not add a node into the measuring queue if it\n\t\t// is inside a code component. However the descendants of an overlay do\n\t\t// need to be measured, even if the overlay node parent is a code\n\t\t// component. Therefore we override the context value to be false, so\n\t\t// the hook wouldn't consider the overlay to be in a code component.\n\t\treturn ReactDOM.createPortal(\n\t\t\t<ComponentContainerContext.Provider value={false}>\n\t\t\t\t<Component {...restProps} />\n\t\t\t</ComponentContainerContext.Provider>,\n\t\t\ttarget,\n\t\t\tid,\n\t\t)\n\t}\n\n// Dynamically wrapping React component functions in higher order components\n// runs the risk that rerenders treat the dynamically created component as\n// non-referentially identical to the previously rendered component. That causes\n// the component to be instantiated as a new component instead of just\n// rerendered which leads to unexpected behavior with the React life cycle. For\n// instance, useLayoutEffects that are only expected to run on initial mount get\n// rerun on every render.\n//\n// This memo avoids this problem for Framer's canvas rendering of its built in\n// components by only instantiating the component type once, and reusing the\n// reference for rerenders. This is safe because Framer's built-in components\n// like RichText and FrameWithMotion are static and cannot change during a\n// session, unlike user code components which may change on rerenders. This\n// allows us to safely provide portal rendering to Canvas elements that require\n// it on-demand, without adding this complexity to every component in the Framer\n// library.\nconst componentMemo = new Map()\n/** @deprecated - Remove when `render.tsx` is fully removed. */\nexport function withFixedCanvasPositioningMemo(Component: React.ComponentType): React.ComponentType {\n\tif (componentMemo.has(Component)) return componentMemo.get(Component)\n\n\tconst ComponentType = withFixedCanvasPositioning(Component)\n\n\tcomponentMemo.set(Component, ComponentType)\n\n\treturn ComponentType\n}\n\n/**\n * A component to render children in a portal, similar to the withFixedCanvasPositioning, but for the new\n * CanvasNodeRenderer.\n */\nexport function RenderedInPortal({\n\tid,\n\tportalId,\n\tchildren,\n}: React.PropsWithChildren<{ id: string; portalId: string }>): React.ReactElement | null {\n\tconst target = document.getElementById(portalId)\n\tconst [_, setTargetAvailable] = React.useState(Boolean(target))\n\n\t// In some cases, the ground node rendering is deferred in such a way that the container for the\n\t// portal does not exist yet, for example when switching scopes where the target scope has an\n\t// active overlay. For these cases we update the state from a layout effect and only render in\n\t// the portal if there is actually a target.\n\tReact.useLayoutEffect(() => {\n\t\tsetTargetAvailable(true)\n\t}, [])\n\n\tif (!target) return null\n\n\t// useMeasureLayout will not add a node into the measuring queue if it\n\t// is inside a code component. However the descendants of an overlay do\n\t// need to be measured, even if the overlay node parent is a code\n\t// component. Therefore we override the context value to be false, so\n\t// the hook wouldn't consider the overlay to be in a code component.\n\treturn ReactDOM.createPortal(\n\t\t<ComponentContainerContext.Provider value={false}>{children}</ComponentContainerContext.Provider>,\n\t\ttarget,\n\t\tid,\n\t)\n}\n", "import { assert, type LocalModuleExportIdentifierString } from \"@framerjs/shared\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { GeneratedComponentContext } from \"library/index.ts\"\nimport type { Locale } from \"library/router/types.ts\"\nimport type React from \"react\"\nimport { getGeneratedComponentContextValue } from \"utils/getGeneratedComponentContextValue.ts\"\nimport { CanvasNodeRenderer } from \"./CanvasNodeRenderer.tsx\"\nimport type { RenderingStateTracker } from \"./RenderingStateTracker.ts\"\n\n/**\n * Creates a Library React component from the CanvasNode. A modify\n * callback can be provided to extend the behaviour to return\n * different component types/props for different use cases.\n */\nexport function renderElement({\n\ttracker,\n\tnode,\n\tactiveLocale,\n\tshouldSetMinHeight,\n\toptionalSelectedCollectionItemId,\n}: {\n\ttracker: RenderingStateTracker\n\tnode: CanvasNode\n\tactiveLocale: Locale | undefined\n\tshouldSetMinHeight: boolean | undefined\n\toptionalSelectedCollectionItemId: NodeID | undefined\n}): React.ReactElement {\n\t// Get the parent scope node for the rendered node. Currently, the scope node ancestor is always shared\n\t// between all descendants because we do not allow navigation transitions to link between pages. If we do offer\n\t// that feature, this is no longer true, and could lead to bugs.\n\tconst tree = node.tree()\n\n\tconst parent = tree?.get(node.parentid)\n\tassert(parent, \"cannot render a node without a parent\")\n\n\tconst scopeNode = tree?.getScopeNodeFor(node)\n\tconst generatedComponentContextValue = scopeNode\n\t\t? getGeneratedComponentContextValue(scopeNode, node, tracker.componentLoader)\n\t\t: undefined\n\n\tconst layoutTemplateIdentifier: LocalModuleExportIdentifierString | null | undefined = isWebPageNode(parent)\n\t\t? parent.layoutTemplateIdentifier\n\t\t: undefined\n\tconst layoutTemplatePropsVersion: number | undefined = isWebPageNode(parent)\n\t\t? parent.cache.controlPropVersion\n\t\t: undefined\n\n\treturn (\n\t\t<GeneratedComponentContext.Provider value={generatedComponentContextValue}>\n\t\t\t<CanvasNodeRenderer\n\t\t\t\ttracker={tracker}\n\t\t\t\tnode={node}\n\t\t\t\tparent={parent}\n\t\t\t\tparentRenderId={parent.id}\n\t\t\t\tgroundNodeId={node.id}\n\t\t\t\tactiveLocale={activeLocale}\n\t\t\t\toptionalSelectedCollectionItemId={optionalSelectedCollectionItemId}\n\t\t\t\t// When the root layout template identifier changes, the breakpoint node needs to react to it and\n\t\t\t\t// re-render, while itself remains unchanged. Therefore we drill the layout template props down to the\n\t\t\t\t// breakpoint node renderer to trigger a re-render.\n\t\t\t\tlayoutTemplateIdentifier={layoutTemplateIdentifier}\n\t\t\t\tlayoutTemplatePropsVersion={layoutTemplatePropsVersion}\n\t\t\t\tshouldSetMinHeight={shouldSetMinHeight}\n\t\t\t/>\n\t\t</GeneratedComponentContext.Provider>\n\t)\n}\n", "// to workaround a Safari bug that multiplies the zoom to any svg stroke defined on the outer element\n// we use a mutation observer, scan for <svg stroke-width=\"\"> and copy that stroke to all direct children\n\nlet globalObserver: MutationObserver | null = null\n\nfunction copyStrokeToChildren(element: Element) {\n\tconst strokeWidth = element.getAttribute(\"stroke-width\")\n\tif (strokeWidth) {\n\t\tlet child = element.firstElementChild\n\t\twhile (child) {\n\t\t\tif (!child.hasAttribute(\"stroke-width\")) {\n\t\t\t\tchild.setAttribute(\"stroke-width\", strokeWidth)\n\t\t\t}\n\t\t\tchild = child.nextElementSibling\n\t\t}\n\t}\n}\n\nexport function repairStrokedSVGs(root: Element | null) {\n\tif (!root) return\n\tif (!window[\"MutationObserver\"]) return\n\n\t// only Safari\n\tif (!navigator.appVersion.includes(\"AppleWebKit\")) return\n\tif (navigator.appVersion.includes(\"Chrome\")) return\n\n\tif (!globalObserver) {\n\t\tglobalObserver = new MutationObserver((ls: MutationRecord[]) => {\n\t\t\tfor (const mutation of ls) {\n\t\t\t\tfor (const node of mutation.addedNodes) {\n\t\t\t\t\tif (!(node instanceof Element)) continue\n\n\t\t\t\t\t// check if the added node is an <svg> node\n\t\t\t\t\tswitch (node.nodeName) {\n\t\t\t\t\t\tcase \"SVG\":\n\t\t\t\t\t\tcase \"svg\":\n\t\t\t\t\t\t\tcopyStrokeToChildren(node)\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\t// check if the added tree contains any <svg> elements with a stroke-width property\n\t\t\t\t\tif (!node.firstChild) continue\n\t\t\t\t\tif (!node.firstElementChild) continue\n\t\t\t\t\tfor (const child of node.querySelectorAll(\"svg[stroke-width]\")) {\n\t\t\t\t\t\tif (!(child instanceof Element)) continue\n\t\t\t\t\t\tcopyStrokeToChildren(child)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n\n\tglobalObserver.observe(root, { attributes: false, childList: true, subtree: true })\n}\n", "import type { AnyComponentLoader } from \"@framerjs/framer-runtime\"\nimport { AnnotationKey } from \"@framerjs/framer-runtime/crossorigin\"\nimport type { SandboxComponentLoader } from \"@framerjs/framer-runtime/sandbox\"\nimport type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { getSelectedCollectionItem } from \"document/components/utils/collectionItemUtils.ts\"\nimport { getRawWebPagePath } from \"document/components/utils/getWebPagePath.ts\"\nimport type { CanvasTree, MaybeNodeID, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isEqual } from \"library/render/utils/isEqual.ts\"\nimport { RoutesProvider } from \"library/router/RouterContext.tsx\"\nimport type { Routes } from \"library/router/types.ts\"\nimport { CurrentRouteProvider } from \"library/router/useCurrentRoute.tsx\"\nimport type React from \"react\"\nimport { useEffect, useMemo, useRef } from \"react\"\n\ninterface CanvasCurrentRouteProviderProps {\n\ttree: CanvasTree\n\tcomponentLoader: SandboxComponentLoader\n\tscopeId: MaybeNodeID\n\tchildren: React.ReactNode\n\toptionalSelectedCollectionItemId: NodeID | undefined\n}\n\ninterface RoutesAndPathVariables {\n\troutes: Routes\n\tpathVariables: Record<string, string> | undefined\n}\n\n/**\n * Provide a fake route for the current scope to ensure that useCurrentRoute returns an actual route.\n * This can then be used for Link components to resolve the current link styling.\n */\nexport function CanvasCurrentRouteProvider({\n\ttree,\n\tcomponentLoader,\n\tscopeId,\n\tchildren,\n\toptionalSelectedCollectionItemId,\n}: CanvasCurrentRouteProviderProps) {\n\tconst previousRoutesAndPathVariablesRef = useRef<RoutesAndPathVariables | undefined>()\n\n\tconst routesAndPathVariables = useMemo<RoutesAndPathVariables>(() => {\n\t\tconst scope = tree.get(scopeId)\n\t\tconst webPageNode = isWebPageNode(scope) && scope.isLoaded() ? scope : null\n\t\tif (!scopeId || !webPageNode) return { routes: {}, pathVariables: undefined }\n\n\t\tconst path = getRawWebPagePath(tree, webPageNode) ?? \"/\"\n\n\t\tconst newRoutesAndPathVariables = {\n\t\t\troutes: { [scopeId]: { page: FakeRouteComponent, path } },\n\t\t\tpathVariables: getWebPagePathVariables(\n\t\t\t\ttree,\n\t\t\t\tcomponentLoader,\n\t\t\t\twebPageNode?.dataIdentifier,\n\t\t\t\toptionalSelectedCollectionItemId,\n\t\t\t),\n\t\t}\n\n\t\tconst previousRoutesAndPathVariables = previousRoutesAndPathVariablesRef.current\n\t\tif (previousRoutesAndPathVariables && isEqual(newRoutesAndPathVariables, previousRoutesAndPathVariables)) {\n\t\t\treturn previousRoutesAndPathVariables\n\t\t}\n\n\t\treturn newRoutesAndPathVariables\n\t}, [tree, componentLoader, scopeId, optionalSelectedCollectionItemId])\n\n\tuseEffect(() => {\n\t\tpreviousRoutesAndPathVariablesRef.current = routesAndPathVariables\n\t}, [routesAndPathVariables])\n\n\treturn (\n\t\t<RoutesProvider routes={routesAndPathVariables.routes}>\n\t\t\t<CurrentRouteProvider routeId={scopeId ?? undefined} pathVariables={routesAndPathVariables.pathVariables}>\n\t\t\t\t{children}\n\t\t\t</CurrentRouteProvider>\n\t\t</RoutesProvider>\n\t)\n}\n\nfunction FakeRouteComponent() {\n\treturn null\n}\n\nfunction getWebPagePathVariables(\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tdataIdentifier: ModuleExportIdentifierString | null | undefined,\n\toptionalSelectedCollectionItemId: NodeID | undefined,\n): Record<string, string> | undefined {\n\tconst dataDefinition = componentLoader.dataForIdentifier(dataIdentifier)\n\tconst slugKey = dataDefinition?.annotations?.[AnnotationKey.FramerSlug]\n\tif (!slugKey) return\n\n\tconst selectedItem = getSelectedCollectionItem(\n\t\ttree,\n\t\tcomponentLoader,\n\t\tdataIdentifier,\n\t\toptionalSelectedCollectionItemId,\n\t)\n\tif (!selectedItem) return\n\n\treturn { id: selectedItem.id, [slugKey]: selectedItem.slug }\n}\n", "import type { SandboxComponentLoader } from \"@framerjs/framer-runtime/sandbox\"\nimport { colors } from \"@framerjs/fresco/tokens\"\nimport type { CollectorContext } from \"code-generation/utils/collector.ts\"\nimport { type CanvasNode, isVectorNode } from \"document/models/CanvasTree/index.ts\"\nimport { isRichTextNode, isTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { withLayout } from \"document/models/CanvasTree/traits/WithLayout.ts\"\nimport { hasRootFontSize } from \"document/models/CanvasTree/traits/WithRootFontSize.ts\"\nimport type { FontSizeCSSDimension } from \"document/models/CanvasTree/traits/WithTextStyle.ts\"\nimport { floatingZIndex } from \"document/models/CanvasTree/traits/WithZIndex.ts\"\nimport { collectCorner } from \"document/models/CanvasTree/traits/collectStyles/collectCorner.ts\"\nimport { createCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { ROOT_FONT_SIZE_CSS_PROPERTY } from \"document/models/CanvasTree/traits/utils/rootFontSizeHelpers.ts\"\nimport {\n\tCANVAS_FIXED_POSITION_PROPERTY,\n\tVIEWPORT_HEIGHT_CSS_PROPERTY,\n\tcanNodeProvideViewportRect,\n\tgetViewportHeight,\n} from \"document/models/CanvasTree/traits/utils/viewportHelpers.ts\"\nimport { getGroundNodeRectWithPinnedPosition } from \"document/models/CanvasTree/utils/getGroundNodeRect.ts\"\nimport { RenderTarget } from \"library/render/types/RenderEnvironment.ts\"\nimport { roundToHalfPixel } from \"library/render/utils/roundedNumber.ts\"\nimport React from \"react\"\nimport type { TextDirection } from \"text/types.ts\"\nimport { isShallowEqual } from \"utils/isShallowEqual.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport {\n\tcanvasFrameOffscreenBackground,\n\tcanvasFramerLoadingOverlay,\n\tsmartComponentNodeOffscreenBackground,\n\tsmartComponentOverlayEditBackdrop,\n} from \"./CanvasElement.styles.ts\"\nimport type { CanvasElementAppearance } from \"./CanvasElementTransform.tsx\"\nimport { CanvasElementTransform } from \"./CanvasElementTransform.tsx\"\nimport { VisibleOverflowCanvasPortal } from \"./CanvasPortal.tsx\"\nimport { groundNodeWrapperClassName } from \"./CanvasRenderer.styles.ts\"\nimport type { DeferredRendering } from \"./DeferredRendering.ts\"\n\ninterface Props {\n\tnode: CanvasNode\n\tchildren: React.ReactNode\n\tzoom: number\n\toffset: number\n\thideNodeContent: boolean\n\tisInitialLoad: boolean\n\tisLoadingModules: boolean\n\tisInViewport: boolean\n\tisDeferredRendering: boolean\n\tisLoadingResources: boolean\n\tcomponentLoader: SandboxComponentLoader\n\tdeferredRendering: DeferredRendering | undefined\n\tstylePresetBreakpointClassNames: string\n\tinRelativeOverlayEditMode?: boolean\n\tinSmartComponent?: boolean\n\trootFontSizeFallback?: number\n\ttextDirection: TextDirection\n}\n\nfunction scaleFromZoom(zoom: number, offscreen: boolean): number {\n\t// If the frame is not in the viewport, we scale things down a lot, greatly reducing gpu size.\n\tif (offscreen) return 0.0625\n\n\t// Otherwise we scale close to the zoom, but quantize to nice round binary numbers.\n\tif (zoom <= 0.0625) return 0.0625\n\tif (zoom <= 0.125) return 0.125\n\tif (zoom <= 0.25) return 0.25\n\tif (zoom <= 0.5) return 0.5\n\tif (zoom <= 1) return 1\n\tif (zoom <= 2) return 2\n\tif (zoom <= 4) return 4\n\tif (zoom <= 8) return 8\n\tif (zoom <= 16) return 16\n\n\treturn 32\n}\n\nexport class CanvasElement extends React.Component<Props> {\n\tloadingOverlayRef = React.createRef<HTMLDivElement>()\n\tlastRenderedProps: Props | undefined = undefined\n\n\toverride shouldComponentUpdate(nextProps: Props) {\n\t\t// Always update if this is not the canvas (but likely the exporter)\n\t\tif (RenderTarget.current() !== RenderTarget.canvas) return true\n\n\t\t// Always update when inViewport changes\n\t\tif (nextProps.isInViewport !== this.props.isInViewport) return true\n\n\t\t// But ignore re-renders while not in viewport and not in selection\n\t\tconst inViewportOrSelection = nextProps.isInViewport || nextProps.node.cache.selected\n\t\t// We need to render the node if we are still loading resources\n\t\tif (!inViewportOrSelection && !nextProps.isLoadingResources) return false\n\n\t\t// Don't update if we hide the content\n\t\tconst hideNodeContent = this.props.hideNodeContent && nextProps.hideNodeContent\n\t\tif (hideNodeContent && !nextProps.isLoadingResources) return false\n\n\t\t// Otherwise, don't compare the current props, but the props against\n\t\t// which we were last rendered.\n\t\treturn !isShallowEqual(this.lastRenderedProps, nextProps)\n\t}\n\n\toverride componentDidMount() {\n\t\tthis.componentDidUpdate()\n\t}\n\n\toverride componentDidUpdate() {\n\t\tthis.props.deferredRendering?.checkLoadingState(this.props.node.id)\n\n\t\tconst isLoadingResourcesOrModules = this.props.deferredRendering?.isLoadingResourcesOrModules()\n\t\tif (!isLoadingResourcesOrModules && this.loadingOverlayRef.current) {\n\t\t\tthis.loadingOverlayRef.current.style.visibility = \"hidden\"\n\t\t}\n\t}\n\n\toverride render() {\n\t\tthis.lastRenderedProps = this.props\n\n\t\tconst {\n\t\t\tnode,\n\t\t\tchildren,\n\t\t\tzoom,\n\t\t\toffset,\n\t\t\thideNodeContent,\n\t\t\tisInitialLoad,\n\t\t\tisInViewport,\n\t\t\tisDeferredRendering,\n\t\t\tisLoadingResources,\n\t\t\tcomponentLoader,\n\t\t\tstylePresetBreakpointClassNames,\n\t\t\tinRelativeOverlayEditMode,\n\t\t\trootFontSizeFallback,\n\t\t\tinSmartComponent,\n\t\t\tisLoadingModules,\n\t\t\ttextDirection,\n\t\t} = this.props\n\n\t\tconst rect = getGroundNodeRectWithPinnedPosition(node)\n\t\tconst isOutsideViewport = !isInViewport && RenderTarget.current() === RenderTarget.canvas\n\n\t\t// We have two different ways to hide the content:\n\t\t// - \"none\" which uses display: none\n\t\t// - \"hidden\" which uses visibility: hidden.\n\t\tlet appearance: CanvasElementAppearance = \"visible\"\n\t\tif (isDeferredRendering || hideNodeContent) {\n\t\t\t// We can hide everything and scale down the node if the canvas is still loading or we are not in the viewport.\n\t\t\t// This will reduce the gpu size and hide the node completely.\n\t\t\tappearance = \"none\"\n\t\t} else if (isLoadingResources) {\n\t\t\t// If we are loading resources we need to measure node sizes so we can't scale the node\n\t\t\t// down and we can't use display: \"none\".\n\t\t\t//\n\t\t\t// We should make the node \"hidden\". Then make it \"visible\" once we know the resources\n\t\t\t// have loaded. However, this will flash empty content. Because right now, we only\n\t\t\t// update this via react, which requires another render. Ideally, we would update the\n\t\t\t// DOM from componentDidUpdate.\n\t\t\tappearance = \"visible\"\n\t\t} else if (isOutsideViewport) {\n\t\t\tappearance = \"none\"\n\t\t}\n\n\t\tlet className = groundNodeWrapperClassName\n\t\tconst isHidden = appearance !== \"visible\"\n\n\t\tconst isOffscreen = isHidden && (isOutsideViewport || isInitialLoad)\n\n\t\tif (isOffscreen) {\n\t\t\tclassName += \" \" + canvasFrameOffscreenBackground\n\t\t} else if (isHidden) {\n\t\t\tclassName += \" \" + smartComponentNodeOffscreenBackground\n\t\t}\n\n\t\tif (stylePresetBreakpointClassNames) {\n\t\t\tclassName += \" \" + stylePresetBreakpointClassNames\n\t\t}\n\n\t\tconst style: React.CSSProperties = {\n\t\t\ttransition: \"opacity 50ms ease-out\",\n\t\t\tWebkitFontSmoothing: \"antialiased\",\n\t\t\tMozOsxFontSmoothing: \"grayscale\",\n\t\t\t[CANVAS_FIXED_POSITION_PROPERTY]: \"absolute\",\n\t\t\t// When a node can provide a viewport rect, we also set a css\n\t\t\t// property with a height variable. This allows instances of\n\t\t\t// generated components that are rendered inside of this ground node\n\t\t\t// to render with a viewport height based on this node's value.\n\t\t\t//\n\t\t\t// The viewport height calculated can not prefer the min screen\n\t\t\t// height because the min screen height can depend on elements\n\t\t\t// rendering based on this value, creating a circular reference.\n\t\t\t// Instead, rendering that relies on this value should be designed\n\t\t\t// to never exceed the height of the screen using css clamping.\n\t\t\t[VIEWPORT_HEIGHT_CSS_PROPERTY]: canNodeProvideViewportRect(node)\n\t\t\t\t? createCSSDimension(getViewportHeight(node, rect, false), \"px\")\n\t\t\t\t: undefined,\n\t\t\t// We need to set the root font size in order for `rem` units to show up\n\t\t\t// accurately based on the configured root font size.\n\t\t\t[ROOT_FONT_SIZE_CSS_PROPERTY]: getRootFontSizeForStyle(node, rootFontSizeFallback),\n\t\t}\n\n\t\t// Scale basically determines the backing layer pixels.\n\t\tconst scale = scaleFromZoom(zoom, appearance === \"none\")\n\n\t\t// we only want to show the loading overlay on the canvas\n\t\t// in other targets like exporter we don't want\n\t\t// to show the loading overlay as it might result in outputting the loading overlay in the exported artifact\n\t\tconst showCanvasLoadingOverlay = (isLoadingModules || isHidden) && RenderTarget.current() === RenderTarget.canvas\n\n\t\tconst isExporting = RenderTarget.current() === RenderTarget.export\n\n\t\treturn (\n\t\t\t<CanvasElementTransform\n\t\t\t\tid={node.id}\n\t\t\t\tenabled={RenderTarget.current() === RenderTarget.canvas}\n\t\t\t\tscale={scale}\n\t\t\t\toffset={offset}\n\t\t\t\ttop={rounded(rect.y, node)}\n\t\t\t\tleft={rounded(rect.x, node)}\n\t\t\t\twidth={rect.width}\n\t\t\t\theight={rect.height}\n\t\t\t\tstyle={style}\n\t\t\t\tclassName={className}\n\t\t\t\tappearance={appearance}\n\t\t\t\ttextDirection={textDirection}\n\t\t\t>\n\t\t\t\t{isDeferredRendering ? null : children}\n\t\t\t\t{inRelativeOverlayEditMode && !isExporting && (\n\t\t\t\t\t<RelativeOverlayEditBackdrop\n\t\t\t\t\t\tinSmartComponent={inSmartComponent}\n\t\t\t\t\t\tcomponentLoader={componentLoader}\n\t\t\t\t\t\tnode={node}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{/* Dock the relative overlay portal outside of the ground node wrapper, so it won't be clipped by the ground node's overflow: hidden */}\n\t\t\t\t<VisibleOverflowCanvasPortal id={node.id} type={withLayout(node) ? node.layout : undefined} />\n\t\t\t\t{showCanvasLoadingOverlay ? (\n\t\t\t\t\t<div ref={this.loadingOverlayRef} className={`${canvasFramerLoadingOverlay}`} />\n\t\t\t\t) : null}\n\t\t\t</CanvasElementTransform>\n\t\t)\n\t}\n}\n\nfunction RelativeOverlayEditBackdrop({\n\tinSmartComponent,\n\tcomponentLoader,\n\tnode,\n}: {\n\tinSmartComponent: boolean | undefined\n\tcomponentLoader: SandboxComponentLoader\n\tnode: CanvasNode\n}) {\n\t// Get the corner radius of the node we are covering in a backdrop to\n\t// prevent the backdrop's corners from being visible in some cases.\n\tconst style: React.CSSProperties = {}\n\tconst context: CollectorContext = { componentLoader }\n\tcollectCorner(node, style, context)\n\n\treturn (\n\t\t<div\n\t\t\tclassName={smartComponentOverlayEditBackdrop}\n\t\t\tstyle={{\n\t\t\t\tborderTopLeftRadius: style.borderTopLeftRadius,\n\t\t\t\tborderTopRightRadius: style.borderTopRightRadius,\n\t\t\t\tborderBottomRightRadius: style.borderBottomRightRadius,\n\t\t\t\tborderBottomLeftRadius: style.borderBottomLeftRadius,\n\t\t\t\tcornerShape: style.cornerShape,\n\t\t\t\tzIndex: floatingZIndex,\n\t\t\t\t// Use inline style to set the dynamic background color and\n\t\t\t\t// avoid creating CSS custom properties which could have an\n\t\t\t\t// impact on rendering performance.\n\t\t\t\tbackground: inSmartComponent\n\t\t\t\t\t? colors.canvasRelativeOverlaySmartComponentBackdrop\n\t\t\t\t\t: colors.canvasRelativeOverlayBackdrop,\n\t\t\t}}\n\t\t/>\n\t)\n}\n\n/**\n * We set the root font size if the node has a trait or there's a fallback.\n * The fallback is most often used in the case of Smart Component nodes (where\n * there is no breakpoint) or a node is rendered in a Webpage/LT scope but off\n * the canvas, as we wish to provide the primary variant breakpoint's root font\n * size as its relative base.\n */\nfunction getRootFontSizeForStyle(\n\tnode: CanvasNode,\n\trootFontSizeFallback: number | undefined,\n): FontSizeCSSDimension | undefined {\n\tconst value = hasRootFontSize(node) ? node.rootFontSize : rootFontSizeFallback\n\tif (!isNumber(value)) return\n\treturn createCSSDimension(value, \"px\")\n}\n\nfunction rounded(value: number, node: CanvasNode) {\n\t// Vectors can sit on half pixels.\n\tif (isVectorNode(node)) return roundToHalfPixel(value)\n\tif (isTextNode(node) || isRichTextNode(node)) return value\n\treturn Math.round(value)\n}\n", "import \"CanvasElement.styles_6wcez7.wyw.css\"; import { cx } from \"@linaria/core\";\nexport const canvasFrameOffscreenBackground = \"canvasFrameOffscreenBackground_c12zorou\";\nexport const smartComponentNodeOffscreenBackground = \"smartComponentNodeOffscreenBackground_stomjyu\";\nexport const smartComponentOverlayEditBackdrop = \"smartComponentOverlayEditBackdrop_s1sfgde\";\nexport const canvasFramerLoadingOverlay = cx(canvasFrameOffscreenBackground, \"canvasFramerLoadingOverlay_c62fy97\");", "import { isChrome, isSafari } from \"@framerjs/shared/src/environment.ts\"\nimport React from \"react\"\nimport type { TextDirection } from \"text/types.ts\"\nimport { useChromeResetDisplayWorkaround } from \"./useChromeResetDisplayWorkaround.tsx\"\nimport { shouldUseWindowsTextBlurWorkaround, useWindowsTextBlurWorkaround } from \"./useWindowsTextBlurWorkaround.ts\"\n\nexport type CanvasElementAppearance = \"none\" | \"hidden\" | \"visible\"\n\ninterface Props {\n\tid: string\n\tscale: number\n\toffset: number\n\tleft: number\n\ttop: number\n\twidth: number\n\theight: number\n\tchildren?: React.ReactNode\n\tstyle?: React.CSSProperties\n\tchildrenStyle?: React.CSSProperties\n\tclassName?: string\n\trotation?: number\n\tenabled?: boolean\n\tappearance?: CanvasElementAppearance\n\tmatrix?: string\n\ttextDirection?: TextDirection\n}\n\nexport function CanvasElementTransform({\n\tenabled = true,\n\tid,\n\tscale: scaleIfEnabled,\n\toffset,\n\tleft,\n\ttop,\n\trotation = 0,\n\twidth,\n\theight,\n\tchildren,\n\tstyle = {},\n\tappearance = \"visible\",\n\tclassName = \"\",\n\ttextDirection,\n\tmatrix,\n}: Props) {\n\tconst wrapperRef = React.useRef<HTMLDivElement>(null)\n\n\tconst scale = enabled ? scaleIfEnabled : 1\n\tconst rotate = rotation === 0 ? \"\" : `rotate(${rotation.toFixed(4)}deg)`\n\n\tconst wrapperInlineStyle: React.CSSProperties = {\n\t\t...style,\n\t\tposition: \"fixed\",\n\t\tdisplay: \"block\",\n\t\ttransformOrigin: \"top left\",\n\t\twillChange: enabled ? \"transform\" : \"none\",\n\t\t// Force the wrapper to be it's own stacking context, might help performance on some browsers.\n\t\tisolation: \"isolate\",\n\t\t// Contain styles and layout withint the wrapper, might help performance on some browsers.\n\t\t// Note the wrapper can show overflow, so we cannot contain paints.\n\t\tcontain: \"layout style\",\n\t}\n\n\t// We use a <style> element instead of inline styles, see comment in CanvasRenderer.tsx\n\tconst wrapper: React.CSSProperties = {\n\t\ttransform: matrix ? undefined : `translateX(${left}px) translateY(${top}px) ${rotate} scale(${1 / scale})`,\n\t\twidth: width * scale,\n\t\theight: height * scale,\n\t}\n\n\tconst innerInlineStyle: React.CSSProperties = {\n\t\ttransformOrigin: \"top left\",\n\t}\n\n\tconst inner: React.CSSProperties = {\n\t\tdisplay: appearance === \"none\" ? \"none\" : \"block\",\n\t\tvisibility: appearance === \"hidden\" ? \"hidden\" : \"visible\",\n\t\ttransform: matrix ?? `scale(${scale})`,\n\t\twidth,\n\t\theight,\n\t}\n\n\tif (!enabled || isSafari()) {\n\t\t// On safari, or when we didn't enable scaling, we use only inline styles, because every\n\t\t// change to a <style> element will re-paint all layers.\n\t\treturn (\n\t\t\t<div style={{ ...wrapperInlineStyle, ...wrapper }} className={className}>\n\t\t\t\t<div dir={textDirection} style={{ ...innerInlineStyle, ...inner }}>\n\t\t\t\t\t{children}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t)\n\t}\n\n\tif (isChrome()) {\n\t\t// biome-ignore lint/correctness/useHookAtTopLevel: <explanation>\n\t\twrapperInlineStyle.display = useChromeResetDisplayWorkaround(wrapperRef, scale)\n\t}\n\n\tif (shouldUseWindowsTextBlurWorkaround) {\n\t\t// biome-ignore lint/correctness/useHookAtTopLevel: <explanation>\n\t\tuseWindowsTextBlurWorkaround(wrapperRef, { id, scale, offset, left, top, width, height })\n\t}\n\n\t// The normal stringFromNodeId doesn't work here because we put it in a <style> element. Hence\n\t// this replaceAll. Also the need to escape is only needed for nodes coming from ancient\n\t// documents. And we we are not worried about collisions, the use is all local, and only ground\n\t// nodes.\n\tconst cssId = id.replaceAll(/\\W/g, \"\")\n\treturn (\n\t\t<div id={`wrapper-${cssId}`} ref={wrapperRef} style={wrapperInlineStyle} className={className}>\n\t\t\t<style>{`\n                #wrapper-${cssId} {\n                    transform: ${wrapper.transform}; width: ${wrapper.width}px; height: ${wrapper.height}px;\n                }\n                #inner-${cssId} {\n                    transform: ${inner.transform}; width: ${inner.width}px; height: ${inner.height}px;\n                    display: ${inner.display}; visibility: ${inner.visibility};\n                }\n            `}</style>\n\t\t\t<div id={`inner-${cssId}`} dir={textDirection} style={innerInlineStyle}>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n", "import React from \"react\"\n\n// During Chrome 87 beta, there was a bug where tiling/rasterizing didn't correctly reset after scaling the canvas.\n// At time of writing, the bug was intercepted before Chrome 87 went final. The issue may return when they tweak the\n// compositor for 88+ so we're keeping this workaround in our back pocket, inert.\n// https://github.com/framer/company/issues/19926\n// https://bugs.chromium.org/p/chromium/issues/detail?id=1146393\n\nexport const usesChromeResetDisplayWorkaround = false\n\n// React will render with display: none set in the inline style if the Chrome workaround is active\nconst chromeResetDisplayWorkaroundQueue: HTMLElement[] = []\n\n// We force a layer reset by forcing layout. Unfortunately this could cause extra painting and no longer reuses the existing layer, so this workaround should be removed again in the future. Note that the expected layering behavior is documented in the render performance tests.\nexport const useChromeResetDisplayWorkaround = usesChromeResetDisplayWorkaround\n\t? (ref: React.RefObject<HTMLElement>, scale: number) => {\n\t\t\t// Make sure we only return \"display: none\" if the effect will restore the correct value\n\t\t\tconst previousScale = React.useRef(scale)\n\t\t\tlet willResetInLayoutEffect = previousScale.current !== scale\n\t\t\tpreviousScale.current = scale\n\n\t\t\t// Add the element to the queue\n\t\t\tif (willResetInLayoutEffect && ref.current) {\n\t\t\t\tchromeResetDisplayWorkaroundQueue.push(ref.current)\n\t\t\t} else {\n\t\t\t\twillResetInLayoutEffect = false\n\t\t\t}\n\n\t\t\tReact.useLayoutEffect(() => {\n\t\t\t\t// The first effect does the work of all of them, to prevent more layout thrashing than needed\n\t\t\t\tconst queue = chromeResetDisplayWorkaroundQueue\n\t\t\t\tconst element = queue[0]\n\t\t\t\tif (!element) return\n\t\t\t\t// Force layout, resetting the layer backing in the process\n\t\t\t\tconst sharedAncestor = element.parentElement\n\t\t\t\t// eslint-disable-next-line no-unused-expressions\n\t\t\t\tsharedAncestor?.offsetTop\n\n\t\t\t\t// Restore the correct display value, which produces a correctly tiled/rasterized layer at some point in the future\n\t\t\t\tfor (const e of queue) {\n\t\t\t\t\te.style.display = \"block\"\n\t\t\t\t}\n\n\t\t\t\t// Clean up for the next render batch\n\t\t\t\tqueue.splice(0, queue.length)\n\t\t\t}, [scale])\n\n\t\t\treturn willResetInLayoutEffect ? \"none\" : \"block\"\n\t\t}\n\t: () => \"block\"\n", "import { isFirefox, isWindows } from \"@framerjs/shared/src/environment.ts\"\nimport React from \"react\"\nimport { isShallowEqual } from \"utils/isShallowEqual.ts\"\n\n// On windows, with displays set to a non integer scale (commonly 125%, 150%, etc.) text rendering\n// is blurry and weird if the pixel backing layer started out small. And general rendering can be\n// more blurry than expected if layers have moved.\n//\n// This workaround forces all changed or moved ground nodes on screen to render without a layer for\n// one frame, then with a layer again the next. That seems to fix the blurriness and text weirdness.\n// We only do this for zoom levels around 1, so the amount of layers involved is always bounded.\n//\n// See also this chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1189070\n\nexport const shouldUseWindowsTextBlurWorkaround = isWindows() && !isFirefox()\n\nlet frameCounter = 0\nlet queueTimer: any = null\nconst queue: Record<string, { ref: React.RefObject<HTMLElement>; frame: number }> = {}\n\nfunction processQueueInAnimationFrame() {\n\tframeCounter += 1\n\tqueueTimer = null\n\n\tfor (const [id, record] of Object.entries(queue)) {\n\t\tconst element = record.ref.current\n\t\tif (!element) {\n\t\t\tdelete queue[id]\n\t\t} else if (frameCounter === record.frame + 2) {\n\t\t\telement.style.willChange = \"unset\"\n\t\t} else if (frameCounter > record.frame + 2) {\n\t\t\telement.style.willChange = \"transform\"\n\t\t\tdelete queue[id]\n\t\t}\n\t}\n\n\t// If there are elements in the queue, schedule a new frame\n\tif (Object.keys(queue).length > 0) {\n\t\tqueueTimer = requestAnimationFrame(processQueueInAnimationFrame)\n\t}\n}\n\ninterface WindowsTextWorkaroundProps {\n\tid: string\n\tscale: number\n\toffset?: number\n\twidth?: number\n\theight?: number\n\tleft?: number\n\ttop?: number\n}\n\nconst emptyProps = {\n\tid: \"\",\n\tscale: 0,\n}\n\nexport function useWindowsTextBlurWorkaround(\n\tref: React.RefObject<HTMLElement>,\n\tprops: WindowsTextWorkaroundProps,\n): void {\n\t// We apply the workaround to all initial layers, otherwise things like alt+drag often still shows bluriness.\n\tconst previousProps = React.useRef<WindowsTextWorkaroundProps>(emptyProps)\n\tconst displayNeedsWorkaround = !Number.isInteger(window.devicePixelRatio)\n\n\t// If this element is already in the queue, just update when the workaround should apply\n\tconst element = queue[props.id]\n\tif (element) {\n\t\telement.frame = frameCounter\n\t\treturn\n\t}\n\n\t// If we ever move to a different screen, we will need the workaround.\n\tif (!displayNeedsWorkaround) {\n\t\tpreviousProps.current = emptyProps\n\t\treturn\n\t}\n\n\t// Only use workaround if scale is around 1, will also ignore all out of viewport nodes.\n\tif (props.scale < 0.9 || props.scale >= 2) {\n\t\tpreviousProps.current = emptyProps\n\t\treturn\n\t}\n\n\t// Nothing changed, so we don't need the workaround.\n\tif (isShallowEqual(previousProps.current, props)) return\n\n\t// Our layer has moved, or resized, so we need the workaround.\n\tpreviousProps.current = props\n\tqueue[props.id] = { ref, frame: frameCounter }\n\n\t// Make sure a frame is scheduled to process the work.\n\tif (!queueTimer) {\n\t\tqueueTimer = requestAnimationFrame(processQueueInAnimationFrame)\n\t}\n}\n", "import type { Rect } from \"library/render/types/Rect.ts\"\nimport React from \"react\"\nimport type { SandboxError } from \"utils/rpc/shared/definitions.ts\"\nimport { CanvasElementTransform } from \"./CanvasElementTransform.tsx\"\nimport { groundNodeWrapperClassName } from \"./CanvasRenderer.styles.ts\"\n\ninterface Props {\n\tid: string\n\treportError: (error: SandboxError) => void\n\n\trect?: Rect\n\tzoom?: number\n\n\tchildren?: React.ReactNode\n}\n\ninterface State {\n\terror?: string\n}\n\nexport class GroundNodeErrorBoundary extends React.PureComponent<Props, State> {\n\toverride state: State = {}\n\n\tstatic getDerivedStateFromError(error: unknown): Partial<State> {\n\t\t// As of React 18, we have to make sure the state is updated as soon\n\t\t// as possible, so this returns the error without the component\n\t\t// stack, then the setState call in componentDidCatch will add it.\n\t\treturn { error: String(error) }\n\t}\n\n\toverride componentDidCatch(error: unknown, info: React.ErrorInfo) {\n\t\tconst message = String(error)\n\t\tthis.props.reportError({\n\t\t\ttype: \"GroundNodeErrorBoundary\",\n\t\t\tgroundNodeId: this.props.id,\n\t\t\tmessage,\n\t\t\tstack: info.componentStack ?? undefined,\n\t\t})\n\t\tthis.setState({\n\t\t\terror: message + (info.componentStack && info.componentStack.split(\"\\n\").slice(0, 5).join(\"\\n\")),\n\t\t})\n\t}\n\n\toverride render() {\n\t\tif (this.state.error) {\n\t\t\tconst { id, rect, zoom } = this.props\n\t\t\tif (!rect || !zoom) {\n\t\t\t\t// If these values are missing, the ground node is gone.\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst { x, y, width, height } = rect\n\t\t\treturn (\n\t\t\t\t<CanvasElementTransform\n\t\t\t\t\tid={id}\n\t\t\t\t\tscale={zoom}\n\t\t\t\t\toffset={0}\n\t\t\t\t\ttop={y}\n\t\t\t\t\tleft={x}\n\t\t\t\t\twidth={width}\n\t\t\t\t\theight={height}\n\t\t\t\t\tclassName={groundNodeWrapperClassName}\n\t\t\t\t>\n\t\t\t\t\t<div className=\"framerInternalUI-errorPlaceholder\" style={{ width, height }}>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\tdisplay: \"flex\",\n\t\t\t\t\t\t\t\talignItems: \"center\",\n\t\t\t\t\t\t\t\tjustifyContent: \"center\",\n\t\t\t\t\t\t\t\twidth: \"100%\",\n\t\t\t\t\t\t\t\theight: \"100%\",\n\t\t\t\t\t\t\t\tmaxHeight: 1000,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<pre style={{ maxWidth: \"100%\", whiteSpace: \"pre-wrap\" }}>{this.state.error}</pre>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</CanvasElementTransform>\n\t\t\t)\n\t\t}\n\t\treturn this.props.children\n\t}\n}\n", "import { ShaderPoolContext } from \"library/render/presentation/Shader/ShaderPoolContext.ts\"\nimport { useRef } from \"react\"\nimport { ShaderPool } from \"./ShaderPool.ts\"\n\n/**\n * Provides the ShaderPool context to the canvas tree. All <Shader> instances\n * within this provider \u2014 whether from ShaderNodeRenderer or generated code \u2014\n * register with the same pool.\n */\nexport function ShaderPoolProvider({ children }: { children: React.ReactNode }) {\n\tconst poolRef = useRef<ShaderPool | null>(null)\n\tif (!poolRef.current) {\n\t\tpoolRef.current = new ShaderPool()\n\t}\n\n\treturn <ShaderPoolContext.Provider value={poolRef.current}>{children}</ShaderPoolContext.Provider>\n}\n", "import type { ShaderPoolHandle, SlotStatus } from \"library/render/presentation/Shader/ShaderPoolContext.ts\"\nimport { slotStatus } from \"library/render/presentation/Shader/ShaderPoolContext.ts\"\nimport { shaderPriority } from \"library/render/presentation/Shader/useShaderPool.ts\"\n\nexport const maxPoolSize = 5\n\ninterface PoolEntry {\n\tid: string\n\tpriority: number\n\t/** Monotonically increasing counter for tie-breaking (lower = registered earlier). */\n\tregistrationOrder: number\n}\n\ntype Listener = () => void\n\n/**\n * Pool-based shader context manager. Allocates up to MAX_POOL_SIZE WebGL\n * context slots to shaders based on priority. High-priority shaders animate,\n * others in the pool render a single frame on change, and overflow shaders\n * show fallback images.\n */\nexport class ShaderPool implements ShaderPoolHandle {\n\tprivate entries = new Map<string, PoolEntry>()\n\tprivate listeners = new Map<string, Listener>()\n\tprivate nextOrder = 0\n\t/** Cached set of IDs that currently have a slot, recomputed on changes. */\n\tprivate allocatedIds = new Set<string>()\n\n\tregister(id: string, priority: number): void {\n\t\tconst existing = this.entries.get(id)\n\t\tif (existing) {\n\t\t\tif (existing.priority !== priority) {\n\t\t\t\texisting.priority = priority\n\t\t\t\tthis.reallocate()\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tthis.entries.set(id, { id, priority, registrationOrder: this.nextOrder++ })\n\t\tthis.reallocate()\n\t}\n\n\tderegister(id: string): void {\n\t\tif (!this.entries.has(id)) return\n\t\tthis.entries.delete(id)\n\t\tthis.listeners.delete(id)\n\t\tthis.reallocate()\n\t}\n\n\tgetSlotStatus(id: string): SlotStatus {\n\t\tconst entry = this.entries.get(id)\n\t\tif (!entry || !this.allocatedIds.has(id)) return slotStatus.noSlot\n\t\treturn entry.priority === shaderPriority.high ? slotStatus.animate : slotStatus.singleFrame\n\t}\n\n\t/** Subscribe for external store pattern. Returns unsubscribe function. */\n\tsubscribe(id: string, listener: Listener): () => void {\n\t\tthis.listeners.set(id, listener)\n\t\treturn () => {\n\t\t\t// Only delete if it's still the same listener (not replaced by a new registration)\n\t\t\tif (this.listeners.get(id) === listener) {\n\t\t\t\tthis.listeners.delete(id)\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate reallocate(): void {\n\t\tconst sorted = [...this.entries.values()].sort((a, b) => {\n\t\t\tif (b.priority !== a.priority) return b.priority - a.priority\n\t\t\treturn a.registrationOrder - b.registrationOrder\n\t\t})\n\n\t\tconst prevAllocated = this.allocatedIds\n\t\tthis.allocatedIds = new Set<string>()\n\n\t\tfor (let i = 0; i < Math.min(sorted.length, maxPoolSize); i++) {\n\t\t\tconst entry = sorted[i]\n\t\t\tif (entry) this.allocatedIds.add(entry.id)\n\t\t}\n\n\t\t// Notify entries whose slot status changed\n\t\tfor (const entry of this.entries.values()) {\n\t\t\tconst wasAllocated = prevAllocated.has(entry.id)\n\t\t\tconst isAllocated = this.allocatedIds.has(entry.id)\n\t\t\tif (wasAllocated !== isAllocated) {\n\t\t\t\tthis.listeners.get(entry.id)?.()\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Visible for testing. */\n\tget size(): number {\n\t\treturn this.entries.size\n\t}\n\n\t/** Visible for testing. */\n\tget allocatedCount(): number {\n\t\treturn this.allocatedIds.size\n\t}\n}\n", "import { isChrome, isFirefox } from \"@framerjs/shared/src/environment.ts\"\nimport { performanceMeasure } from \"utils/userTiming.ts\"\nimport * as styles from \"./CanvasRenderer.styles.ts\"\n\n// This is a workaround for badly sized backing buffers for layers. When they are too large, it eats\n// GPU memory, and can result in low performance, weird visuals, or tabs crashing. When they are too\n// small, their content will be fuzzy.\n//\n// We control the backing buffer for the ground node, but there might be layers in the DOM from code\n// components, smart components, backdrop filters, or overlap with any of these. There we don't have\n// control. But there are a few workaround to have such layers recreate their backing buffers.\n\nfunction hasWillChange(element: Element) {\n\tswitch (getComputedStyle(element)?.willChange) {\n\t\tcase null:\n\t\tcase undefined:\n\t\tcase \"\":\n\t\tcase \"auto\":\n\t\tcase \"inherit\":\n\t\tcase \"unset\":\n\t\tcase \"none\":\n\t\t\treturn false\n\t}\n\treturn true\n}\n\nfunction hasBackdropFilter(element: Element) {\n\tswitch (getComputedStyle(element)?.backdropFilter) {\n\t\tcase null:\n\t\tcase undefined:\n\t\tcase \"\":\n\t\tcase \"auto\":\n\t\tcase \"inherit\":\n\t\tcase \"unset\":\n\t\tcase \"none\":\n\t\t\treturn false\n\t}\n\treturn true\n}\n\nfunction childrenHaveLayers(element: Element) {\n\tfor (const child of element.children) {\n\t\tif (hasWillChange(child)) return true\n\t\tif (hasBackdropFilter(child)) return true\n\t\tif (childrenHaveLayers(child)) return true\n\t}\n\treturn false\n}\n\n// A reduced version of the scaleFromZoom function in CanvasRenderer.ts so we trigger this\n// workaround at about half the scale changes. Reducing the performance impact.\nexport function scaleFromZoomForBadlySizedChildLayersWorkaround(zoom: number): number {\n\tif (zoom <= 0.0625) return 0.0625\n\tif (zoom <= 0.25) return 0.25\n\tif (zoom <= 1) return 1\n\tif (zoom <= 4) return 4\n\tif (zoom <= 16) return 16\n\treturn 32\n}\n\nconst groundNodeSelector = `.${styles.groundNodeWrapperClassName}`\n\nlet lastWorkaroundScaleChildLayersCall = 0\nexport async function workaroundBadlySizedChildLayers(): Promise<void> {\n\t// Firefox doesn't work with rasterized layers at all, so no workaround is needed.\n\tif (isFirefox()) return\n\n\tconst start = performance.now()\n\ttry {\n\t\tlastWorkaroundScaleChildLayersCall += 1\n\t\tconst current = lastWorkaroundScaleChildLayersCall\n\n\t\t// On Chrome, it suffices to remove and add a child to have the layer tree to be rebuilt. This\n\t\t// is still costly, so we do this one groundNode per frame. Since we are going to pause and\n\t\t// resume, we also check if a new call has started after every await and return if this call is\n\t\t// outdated.\n\t\tif (isChrome()) {\n\t\t\tfor (const groundNode of document.querySelectorAll(groundNodeSelector)) {\n\t\t\t\tif (!groundNode.isConnected) continue\n\t\t\t\tconst children = Array.from(groundNode.childNodes)\n\t\t\t\tfor (const child of children) {\n\t\t\t\t\tgroundNode.removeChild(child)\n\t\t\t\t}\n\t\t\t\tfor (const child of children) {\n\t\t\t\t\tgroundNode.appendChild(child)\n\t\t\t\t}\n\t\t\t\tawait new Promise(resolve => requestAnimationFrame(resolve))\n\t\t\t\tif (current !== lastWorkaroundScaleChildLayersCall) return\n\t\t\t}\n\t\t\t// This last await is to have measure capture the full impact of this workaround.\n\t\t\tawait new Promise(resolve => requestAnimationFrame(resolve))\n\t\t\treturn\n\t\t}\n\n\t\t// On other browsers, we add a class that will overwrite both will-change transform and\n\t\t// backdrop-filter to none with !important, removing that class again after one frame. Again\n\t\t// doing one groundnode per frame.\n\t\tfor (const groundNode of document.querySelectorAll(groundNodeSelector)) {\n\t\t\tif (!groundNode.isConnected) continue\n\t\t\tif (!childrenHaveLayers(groundNode)) continue\n\t\t\tgroundNode.classList.toggle(styles.disableWillChangeClass, true)\n\t\t\tawait new Promise(resolve => requestAnimationFrame(resolve))\n\t\t\tgroundNode.classList.toggle(styles.disableWillChangeClass, false)\n\t\t\tawait new Promise(resolve => requestAnimationFrame(resolve))\n\t\t\tif (current !== lastWorkaroundScaleChildLayersCall) return\n\t\t}\n\t} finally {\n\t\tconst duration = performance.now() - start\n\t\tperformanceMeasure(\"workaroundBadlySizedChildLayers\", { start, duration })\n\t}\n}\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,IAAM,WAAW,oBAAI,IAAY;AACjC,IAAM,mBAAgC,oBAAI,IAAI;AAMvC,SAAS,wBAAwB,YAAqB,MAAkB,WAAqB;AACnG,MAAI,EAAE,SAAS,KAAK,UAAU,KAAK,YAAY,QAAS;AAExD,MAAI,CAAC,YAAY;AAChB,6BAAyB,UAAU,gBAAgB;AAAA,EACpD,OAAO;AACN,UAAM,WAAW,iCAAiC,MAAM,KAAK,SAAS,SAAS,CAAC;AAChF,6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_runtime", "React", "import_react", "import_jsx_runtime", "React", "import_react", "import_jsx_runtime", "React", "import_jsx_runtime", "import_react", "import_jsx_runtime", "ExternalModuleContainer", "nodeForState", "LocalModuleContainer", "import_react", "import_jsx_runtime", "React", "FramePortal", "import_react", "import_jsx_runtime", "React", "import_jsx_runtime", "controlMap", "React", "groundNodeId", "PrecomputedCanvasNodeRenderer", "CanvasNodeRenderer", "import_jsx_runtime", "import_react", "import_jsx_runtime", "import_react", "import_react", "import_react", "React", "queue", "import_react", "React", "import_jsx_runtime", "React", "wrapper", "import_jsx_runtime", "React", "import_react", "import_jsx_runtime", "React", "import_react", "import_jsx_runtime", "import_jsx_runtime", "React", "CanvasRenderer", "content", "CanvasElements"]
}
